! function(e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : e.videojs = t() }(this, function() { var e = "7.2.4", t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; function i(e, t) { return e(t = { exports: {} }, t.exports), t.exports } var r, n = "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {}, a = {}, s = Object.freeze({ default: a }), o = s && a || s, u = void 0 !== t ? t : "undefined" != typeof window ? window : {}; "undefined" != typeof document ? r = document : (r = u["__GLOBAL_DOCUMENT_CACHE@4"]) || (r = u[ "__GLOBAL_DOCUMENT_CACHE@4"] = o); var l = r, d = void 0, c = "info", h = [], f = function(e, t) { var i = d.levels[c], r = new RegExp("^(" + i + ")$"); if ("log" !== e && t.unshift(e.toUpperCase() + ":"), h && h.push([].concat(t)), t.unshift("VIDEOJS:"), n .console) { var a = n.console[e]; a || "debug" !== e || (a = n.console.info || n.console.log), a && i && r.test(e) } }; (d = function() { for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i]; f("log", t) }).levels = { all: "debug|log|warn|error", off: "", debug: "debug|log|warn|error", info: "log|warn|error", warn: "warn|error", error: "error", DEFAULT: c }, d.level = function(e) { if ("string" == typeof e) { if (!d.levels.hasOwnProperty(e)) throw new Error('"' + e + '" in not a valid log level'); c = e } return c }, d.history = function() { return h ? [].concat(h) : [] }, d.history.clear = function() { h && (h.length = 0) }, d.history.disable = function() { null !== h && (h.length = 0, h = null) }, d.history.enable = function() { null === h && (h = []) }, d.error = function() { for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i]; return f("error", t) }, d.warn = function() { for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i]; return f("warn", t) }, d.debug = function() { for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i]; return f("debug", t) }; var p = d; function m(e) { return e.replace(/\n\r?\s*/g, "") } var g = function(e) { for (var t = "", i = 0; i < arguments.length; i++) t += m(e[i]) + (arguments[i + 1] || ""); return t }, v = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, y = function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, _ = function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }, b = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t }, w = function(e, t) { return e.raw = t, e }, E = Object.prototype.toString, T = function(e) { return k(e) ? Object.keys(e) : [] }; function S(e, t) { T(e).forEach(function(i) { return t(e[i], i) }) } function A(e) { for (var t = arguments.length, i = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) i[r - 1] = arguments[r]; return Object.assign ? Object.assign.apply(Object, [e].concat(i)) : (i.forEach(function(t) { t && S(t, function(t, i) { e[i] = t }) }), e) } function k(e) { return !!e && "object" === (void 0 === e ? "undefined" : v(e)) } function R(e) { return k(e) && "[object Object]" === E.call(e) && e.constructor === Object } function M(e, t) { if (!e || !t) return ""; if ("function" == typeof n.getComputedStyle) { var i = n.getComputedStyle(e); return i ? i[t] : "" } return "" } var O = w([ "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 ", "." ]); function C(e) { return "string" == typeof e && /\S/.test(e) } function D(e) { if (/\s/.test(e)) throw new Error("class has illegal whitespace characters") } function I() { return l === n.document } function L(e) { return k(e) && 1 === e.nodeType } function x() { try { return n.parent !== n.self } catch (e) { return !0 } } function P(e) { return function(t, i) { if (!C(t)) return l[e](null); C(i) && (i = l.querySelector(i)); var r = L(i) ? i : l; return r[e] && r[e](t) } } function U() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "div", t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, r = arguments[3], n = l.createElement(e); return Object.getOwnPropertyNames(t).forEach(function(e) { var i = t[e]; - 1 !== e.indexOf("aria-") || "role" === e || "type" === e ? (p.warn(g(O, e, i)), n .setAttribute(e, i)) : "textContent" === e ? N(n, i) : n[e] = i }), Object.getOwnPropertyNames(i).forEach(function(e) { n.setAttribute(e, i[e]) }), r && ie(n, r), n } function N(e, t) { return void 0 === e.textContent ? e.innerText = t : e.textContent = t, e } function B(e, t) { t.firstChild ? t.insertBefore(e, t.firstChild) : t.appendChild(e) } function F(e, t) { return D(t), e.classList ? e.classList.contains(t) : (i = t, new RegExp("(^|\\s)" + i + "($|\\s)")).test(e .className); var i } function j(e, t) { return e.classList ? e.classList.add(t) : F(e, t) || (e.className = (e.className + " " + t).trim()), e } function H(e, t) { return e.classList ? e.classList.remove(t) : (D(t), e.className = e.className.split(/\s+/).filter(function(e) { return e !== t }).join(" ")), e } function G(e, t, i) { var r = F(e, t); if ("function" == typeof i && (i = i(e, t)), "boolean" != typeof i && (i = !r), i !== r) return i ? j(e, t) : H(e, t), e } function V(e, t) { Object.getOwnPropertyNames(t).forEach(function(i) { var r = t[i]; null === r || void 0 === r || !1 === r ? e.removeAttribute(i) : e.setAttribute(i, !0 === r ? "" : r) }) } function W(e) { var t = {}, i = ",autoplay,stretch,fluent,controls,playsinline,loop,muted,default,defaultMuted,"; if (e && e.attributes && e.attributes.length > 0) for (var r = e.attributes, n = r.length - 1; n >= 0; n--) { var a = r[n].name, s = r[n].value; "boolean" != typeof e[a] && -1 === i.indexOf("," + a + ",") || (s = null !== s), t[a] = s } return t } function q(e, t) { return e.getAttribute(t) } function X(e, t, i) { e.setAttribute(t, i) } function z(e, t) { e.removeAttribute(t) } function K() { l.body.focus(), l.onselectstart = function() { return !1 } } function Y() { l.onselectstart = function() { return !0 } } function Q(e) { if (e && e.getBoundingClientRect && e.parentNode) { var t = e.getBoundingClientRect(), i = {}; return ["bottom", "height", "left", "right", "top", "width"].forEach(function(e) { void 0 !== t[e] && (i[e] = t[e]) }), i.height || (i.height = parseFloat(M(e, "height"))), i.width || (i.width = parseFloat(M(e, "width"))), i } } function J(e) { var t = void 0; if (e.getBoundingClientRect && e.parentNode && (t = e.getBoundingClientRect()), !t) return { left: 0, top: 0 }; var i = l.documentElement, r = l.body, a = i.clientLeft || r.clientLeft || 0, s = n.pageXOffset || r.scrollLeft, o = t.left + s - a, u = i.clientTop || r.clientTop || 0, d = n.pageYOffset || r.scrollTop, c = t.top + d - u; return { left: Math.round(o), top: Math.round(c) } } function Z(e, t) { var i = {}, r = J(e), n = e.offsetWidth, a = e.offsetHeight, s = r.top, o = r.left, u = t.pageY, l = t.pageX; return t.changedTouches && (l = t.changedTouches[0].pageX, u = t.changedTouches[0].pageY), i.y = Math.max(0, Math .min(1, (s - u + a) / a)), i.x = Math.max(0, Math.min(1, (l - o) / n)), i } function $(e) { return k(e) && 3 === e.nodeType } function ee(e) { for (; e.firstChild;) e.removeChild(e.firstChild); return e } function te(e) { return "function" == typeof e && (e = e()), (Array.isArray(e) ? e : [e]).map(function(e) { return "function" == typeof e && (e = e()), L(e) || $(e) ? e : "string" == typeof e && /\S/.test(e) ? l .createTextNode(e) : void 0 }).filter(function(e) { return e }) } function ie(e, t) { return te(t).forEach(function(t) { return e.appendChild(t) }), e } function re(e, t) { return ie(ee(e), t) } function ne(e) { return void 0 === e.button && void 0 === e.buttons || (0 === e.button && void 0 === e.buttons || 0 === e.button && 1 === e.buttons) } var ae = P("querySelector"), se = P("querySelectorAll"), oe = Object.freeze({ isReal: I, isEl: L, isInFrame: x, createEl: U, textContent: N, prependTo: B, hasClass: F, addClass: j, removeClass: H, toggleClass: G, setAttributes: V, getAttributes: W, getAttribute: q, setAttribute: X, removeAttribute: z, blockTextSelection: K, unblockTextSelection: Y, getBoundingClientRect: Q, findPosition: J, getPointerPosition: Z, isTextNode: $, emptyEl: ee, normalizeContent: te, appendContent: ie, insertContent: re, isSingleLeftClick: ne, $: ae, $$: se }), ue = 1; function le() { return ue++ } var de = {}, ce = "vdata" + (new Date).getTime(); function he(e) { var t = e[ce]; return t || (t = e[ce] = le()), de[t] || (de[t] = {}), de[t] } function fe(e) { var t = e[ce]; return !!t && !!Object.getOwnPropertyNames(de[t]).length } function pe(e) { var t = e[ce]; if (t) { delete de[t]; try { delete e[ce] } catch (t) { e.removeAttribute ? e.removeAttribute(ce) : e[ce] = null } } } function me(e, t) { var i = he(e); 0 === i.handlers[t].length && (delete i.handlers[t], e.removeEventListener ? e.removeEventListener(t, i .dispatcher, !1) : e.detachEvent && e.detachEvent("on" + t, i.dispatcher)), Object.getOwnPropertyNames(i .handlers).length <= 0 && (delete i.handlers, delete i.dispatcher, delete i.disabled), 0 === Object .getOwnPropertyNames(i).length && pe(e) } function ge(e, t, i, r) { i.forEach(function(i) { e(t, i, r) }) } function ve(e) { function t() { return !0 } function i() { return !1 } if (!e || !e.isPropagationStopped) { var r = e || n.event; for (var a in e = {}, r) "layerX" !== a && "layerY" !== a && "keyLocation" !== a && "webkitMovementX" !== a && "webkitMovementY" !== a && ("returnValue" === a && r.preventDefault || (e[a] = r[a])); if (e.target || (e.target = e.srcElement || l), e.relatedTarget || (e.relatedTarget = e.fromElement === e .target ? e.toElement : e.fromElement), e.preventDefault = function() { r.preventDefault && r.preventDefault(), e.returnValue = !1, r.returnValue = !1, e.defaultPrevented = !0 }, e.defaultPrevented = !1, e.stopPropagation = function() { r.stopPropagation && r.stopPropagation(), e.cancelBubble = !0, r.cancelBubble = !0, e.isPropagationStopped = t }, e.isPropagationStopped = i, e.stopImmediatePropagation = function() { r.stopImmediatePropagation && r.stopImmediatePropagation(), e.isImmediatePropagationStopped = t, e .stopPropagation() }, e.isImmediatePropagationStopped = i, null !== e.clientX && void 0 !== e.clientX) { var s = l.documentElement, o = l.body; e.pageX = e.clientX + (s && s.scrollLeft || o && o.scrollLeft || 0) - (s && s.clientLeft || o && o .clientLeft || 0), e.pageY = e.clientY + (s && s.scrollTop || o && o.scrollTop || 0) - (s && s .clientTop || o && o.clientTop || 0) } e.which = e.charCode || e.keyCode, null !== e.button && void 0 !== e.button && (e.button = 1 & e.button ? 0 : 4 & e.button ? 1 : 2 & e.button ? 2 : 0) } return e } var ye = !1; ! function() { try { var e = Object.defineProperty({}, "passive", { get: function() { ye = !0 } }); n.addEventListener("test", null, e), n.removeEventListener("test", null, e) } catch (e) {} }(); var _e = ["touchstart", "touchmove"]; function be(e, t, i) { if (Array.isArray(t)) return ge(be, e, t, i); var r = he(e); if (r.handlers || (r.handlers = {}), r.handlers[t] || (r.handlers[t] = []), i.guid || (i.guid = le()), r.handlers[ t].push(i), r.dispatcher || (r.disabled = !1, r.dispatcher = function(t, i) { if (!r.disabled) { t = ve(t); var n = r.handlers[t.type]; if (n) for (var a = n.slice(0), s = 0, o = a.length; s < o && !t.isImmediatePropagationStopped(); s++) try { a[s].call(e, t, i) } catch (e) { p.error(e) } } }), 1 === r.handlers[t].length) if (e.addEventListener) { var n = !1; ye && _e.indexOf(t) > -1 && (n = { passive: !0 }), e.addEventListener(t, r.dispatcher, n) } else e.attachEvent && e.attachEvent("on" + t, r.dispatcher) } function we(e, t, i) { if (fe(e)) { var r = he(e); if (r.handlers) { if (Array.isArray(t)) return ge(we, e, t, i); var n = function(e, t) { r.handlers[t] = [], me(e, t) }; if (void 0 !== t) { var a = r.handlers[t]; if (a) if (i) { if (i.guid) for (var s = 0; s < a.length; s++) a[s].guid === i.guid && a.splice(s--, 1); me(e, t) } else n(e, t) } else for (var o in r.handlers) Object.prototype.hasOwnProperty.call(r.handlers || {}, o) && n(e, o) } } } function Ee(e, t, i) { var r = fe(e) ? he(e) : {}, n = e.parentNode || e.ownerDocument; if ("string" == typeof t ? t = { type: t, target: e } : t.target || (t.target = e), t = ve(t), r.dispatcher && r.dispatcher.call(e, t, i), n && !t .isPropagationStopped() && !0 === t.bubbles) Ee.call(null, n, t, i); else if (!n && !t.defaultPrevented) { var a = he(t.target); t.target[t.type] && (a.disabled = !0, "function" == typeof t.target[t.type] && t.target[t.type](), a .disabled = !1) } return !t.defaultPrevented } function Te(e, t, i) { if (Array.isArray(t)) return ge(Te, e, t, i); var r = function r() { we(e, t, r), i.apply(this, arguments) }; r.guid = i.guid = i.guid || le(), be(e, t, r) } var Se = Object.freeze({ fixEvent: ve, on: be, off: we, trigger: Ee, one: Te }), Ae = !1, ke = void 0, Re = function() { if (I() && !1 !== ke.options.autoSetup) { var e = Array.prototype.slice.call(l.getElementsByTagName("video")), t = Array.prototype.slice.call(l.getElementsByTagName("audio")), i = Array.prototype.slice.call(l.getElementsByTagName("video-js")), r = e.concat(t, i); if (r && r.length > 0) for (var n = 0, a = r.length; n < a; n++) { var s = r[n]; if (!s || !s.getAttribute) { Me(1); break } void 0 === s.player && null !== s.getAttribute("data-setup") && ke(s) } else Ae || Me(1) } }; function Me(e, t) { t && (ke = t), n.setTimeout(Re, e) } I() && "complete" === l.readyState ? Ae = !0 : Te(n, "load", function() { Ae = !0 }); var Oe = function(e) { var t = l.createElement("style"); return t.className = e, t }, Ce = function(e, t) { e.styleSheet ? e.styleSheet.cssText = t : e.textContent = t }, De = function(e, t, i) { t.guid || (t.guid = le()); var r = function() { return t.apply(e, arguments) }; return r.guid = i ? i + "_" + t.guid : t.guid, r }, Ie = function(e, t) { var i = Date.now(); return function() { var r = Date.now(); r - i >= t && (e.apply(void 0, arguments), i = r) } }, Le = function(e, t, i) { var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : n, a = void 0, s = function() { var n = this, s = arguments, o = function() { a = null, o = null, i || e.apply(n, s) }; !a && i && e.apply(n, s), r.clearTimeout(a), a = r.setTimeout(o, t) }; return s.cancel = function() { r.clearTimeout(a), a = null }, s }, xe = function() {}; xe.prototype.allowedEvents_ = {}, xe.prototype.on = function(e, t) { var i = this.addEventListener; this.addEventListener = function() {}, be(this, e, t), this.addEventListener = i }, xe.prototype.addEventListener = xe.prototype.on, xe.prototype.off = function(e, t) { we(this, e, t) }, xe.prototype.removeEventListener = xe.prototype.off, xe.prototype.one = function(e, t) { var i = this.addEventListener; this.addEventListener = function() {}, Te(this, e, t), this.addEventListener = i }, xe.prototype.trigger = function(e) { var t = e.type || e; "string" == typeof e && (e = { type: t }), e = ve(e), this.allowedEvents_[t] && this["on" + t] && this["on" + t](e), Ee(this, e) }, xe.prototype.dispatchEvent = xe.prototype.trigger; var Pe = void 0; xe.prototype.queueTrigger = function(e) { var t = this; Pe || (Pe = new Map); var i = e.type || e, r = Pe.get(this); r || (r = new Map, Pe.set(this, r)); var a = r.get(i); r.delete(i), n.clearTimeout(a); var s = n.setTimeout(function() { 0 === r.size && (r = null, Pe.delete(t)), t.trigger(e) }, 0); r.set(i, s) }; var Ue = function(e) { return e instanceof xe || !!e.eventBusEl_ && ["on", "one", "off", "trigger"].every(function(t) { return "function" == typeof e[t] }) }, Ne = function(e) { return "string" == typeof e && /\S/.test(e) || Array.isArray(e) && !!e.length }, Be = function(e) { if (!e.nodeName && !Ue(e)) throw new Error("Invalid target; must be a DOM node or evented object.") }, Fe = function(e) { if (!Ne(e)) throw new Error("Invalid event type; must be a non-empty string or array.") }, je = function(e) { if ("function" != typeof e) throw new Error("Invalid listener; must be a function.") }, He = function(e, t) { var i = t.length < 3 || t[0] === e || t[0] === e.eventBusEl_, r = void 0, n = void 0, a = void 0; return i ? (r = e.eventBusEl_, t.length >= 3 && t.shift(), n = t[0], a = t[1]) : (r = t[0], n = t[1], a = t[2]), Be(r), Fe(n), je(a), { isTargetingSelf: i, target: r, type: n, listener: a = De(e, a) } }, Ge = function(e, t, i, r) { Be(e), e.nodeName ? Se[t](e, i, r) : e[t](i, r) }, Ve = { on: function() { for (var e = this, t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r]; var n = He(this, i), a = n.isTargetingSelf, s = n.target, o = n.type, u = n.listener; if (Ge(s, "on", o, u), !a) { var l = function() { return e.off(s, o, u) }; l.guid = u.guid; var d = function() { return e.off("dispose", l) }; d.guid = u.guid, Ge(this, "on", "dispose", l), Ge(s, "on", "dispose", d) } }, one: function() { for (var e = this, t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r]; var n = He(this, i), a = n.isTargetingSelf, s = n.target, o = n.type, u = n.listener; if (a) Ge(s, "one", o, u); else { var l = function t() { for (var i = arguments.length, r = Array(i), n = 0; n < i; n++) r[n] = arguments[n]; e.off(s, o, t), u.apply(null, r) }; l.guid = u.guid, Ge(s, "one", o, l) } }, off: function(e, t, i) { if (!e || Ne(e)) we(this.eventBusEl_, e, t); else { var r = e, n = t; Be(r), Fe(n), je(i), i = De(this, i), this.off("dispose", i), r.nodeName ? (we(r, n, i), we(r, "dispose", i)) : Ue(r) && (r.off(n, i), r.off("dispose", i)) } }, trigger: function(e, t) { return Ee(this.eventBusEl_, e, t) } }; function We(e) { var t = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}).eventBusKey; if (t) { if (!e[t].nodeName) throw new Error('The eventBusKey "' + t + '" does not refer to an element.'); e.eventBusEl_ = e[t] } else e.eventBusEl_ = U("span", { className: "vjs-event-bus" }); return A(e, Ve), e.on("dispose", function() { e.off(), n.setTimeout(function() { e.eventBusEl_ = null }, 0) }), e } var qe = { state: {}, setState: function(e) { var t = this; "function" == typeof e && (e = e()); var i = void 0; return S(e, function(e, r) { t.state[r] !== e && ((i = i || {})[r] = { from: t.state[r], to: e }), t.state[r] = e }), i && Ue(this) && this.trigger({ changes: i, type: "statechanged" }), i } }; function Xe(e, t) { return A(e, qe), e.state = A({}, e.state, t), "function" == typeof e.handleStateChanged && Ue(e) && e.on( "statechanged", e.handleStateChanged), e } function ze(e) { return "string" != typeof e ? e : e.charAt(0).toUpperCase() + e.slice(1) } function Ke() { for (var e = {}, t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r]; return i.forEach(function(t) { t && S(t, function(t, i) { R(t) ? (R(e[i]) || (e[i] = {}), e[i] = Ke(e[i], t)) : e[i] = t }) }), e } var Ye = function() { function e(t, i, r) { if (y(this, e), !t && this.play ? this.player_ = t = this : this.player_ = t, this.options_ = Ke({}, this .options_), i = this.options_ = Ke(this.options_, i), this.id_ = i.id || i.el && i.el.id, !this.id_) { var n = t && t.id && t.id() || "no_player"; this.id_ = n + "_component_" + le() } this.name_ = i.name || null, i.el ? this.el_ = i.el : !1 !== i.createEl && (this.el_ = this.createEl()), ! 1 !== i.evented && We(this, { eventBusKey: this.el_ ? "el_" : null }), Xe(this, this.constructor.defaultState), this.children_ = [], this.childIndex_ = {}, this .childNameIndex_ = {}, !1 !== i.initChildren && this.initChildren(), this.ready(r), !1 !== i .reportTouchActivity && this.enableTouchActivity() } return e.prototype.dispose = function() { if (this.trigger({ type: "dispose", bubbles: !1 }), this.children_) for (var e = this.children_.length - 1; e >= 0; e--) this.children_[e].dispose && this.children_[e] .dispose(); this.children_ = null, this.childIndex_ = null, this.childNameIndex_ = null, this.el_ && (this.el_ .parentNode && this.el_.parentNode.removeChild(this.el_), pe(this.el_), this.el_ = null), this.player_ = null }, e.prototype.player = function() { return this.player_ }, e.prototype.options = function(e) { return p.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"), e ? (this .options_ = Ke(this.options_, e), this.options_) : this.options_ }, e.prototype.el = function() { return this.el_ }, e.prototype.createEl = function(e, t, i) { return U(e, t, i) }, e.prototype.localize = function(e, t) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e, r = this.player_.language && this.player_.language(), n = this.player_.languages && this.player_.languages(), a = n && n[r], s = r && r.split("-")[0], o = n && n[s], u = i; return a && a[e] ? u = a[e] : o && o[e] && (u = o[e]), t && (u = u.replace(/\{(\d+)\}/g, function(e, i) { var r = t[i - 1], n = r; return void 0 === r && (n = e), n })), u }, e.prototype.contentEl = function() { return this.contentEl_ || this.el_ }, e.prototype.id = function() { return this.id_ }, e.prototype.name = function() { return this.name_ }, e.prototype.children = function() { return this.children_ }, e.prototype.getChildById = function(e) { return this.childIndex_[e] }, e.prototype.getChild = function(e) { if (e) return e = ze(e), this.childNameIndex_[e] }, e.prototype.addChild = function(t) { var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.children_.length, n = void 0, a = void 0; if ("string" == typeof t) { a = ze(t); var s = i.componentClass || a; i.name = a; var o = e.getComponent(s); if (!o) throw new Error("Component " + s + " does not exist"); if ("function" != typeof o) return null; n = new o(this.player_ || this, i) } else n = t; if (this.children_.splice(r, 0, n), "function" == typeof n.id && (this.childIndex_[n.id()] = n), (a = a || n .name && ze(n.name())) && (this.childNameIndex_[a] = n), "function" == typeof n.el && n.el()) { var u = this.contentEl().children[r] || null; this.contentEl().insertBefore(n.el(), u) } return n }, e.prototype.removeChild = function(e) { if ("string" == typeof e && (e = this.getChild(e)), e && this.children_) { for (var t = !1, i = this.children_.length - 1; i >= 0; i--) if (this.children_[i] === e) { t = !0, this.children_.splice(i, 1); break } if (t) { this.childIndex_[e.id()] = null, this.childNameIndex_[e.name()] = null; var r = e.el(); r && r.parentNode === this.contentEl() && this.contentEl().removeChild(e.el()) } } }, e.prototype.initChildren = function() { var t = this, i = this.options_.children; if (i) { var r = this.options_, n = void 0, a = e.getComponent("Tech"); (n = Array.isArray(i) ? i : Object.keys(i)).concat(Object.keys(this.options_).filter(function(e) { return !n.some(function(t) { return "string" == typeof t ? e === t : e === t.name }) })).map(function(e) { var r = void 0, n = void 0; return "string" == typeof e ? n = i[r = e] || t.options_[r] || {} : (r = e.name, n = e), { name: r, opts: n } }).filter(function(t) { var i = e.getComponent(t.opts.componentClass || ze(t.name)); return i && !a.isTech(i) }).forEach(function(e) { var i = e.name, n = e.opts; if (void 0 !== r[i] && (n = r[i]), !1 !== n) { !0 === n && (n = {}), n.playerOptions = t.options_.playerOptions; var a = t.addChild(i, n); a && (t[i] = a) } }) } }, e.prototype.buildCSSClass = function() { return "" }, e.prototype.ready = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; if (e) return this.isReady_ ? void(t ? e.call(this) : this.setTimeout(e, 1)) : (this.readyQueue_ = this .readyQueue_ || [], void this.readyQueue_.push(e)) }, e.prototype.triggerReady = function() { this.isReady_ = !0, this.setTimeout(function() { var e = this.readyQueue_; this.readyQueue_ = [], e && e.length > 0 && e.forEach(function(e) { e.call(this) }, this), this.trigger("ready") }, 1) }, e.prototype.$ = function(e, t) { return ae(e, t || this.contentEl()) }, e.prototype.$$ = function(e, t) { return se(e, t || this.contentEl()) }, e.prototype.hasClass = function(e) { return F(this.el_, e) }, e.prototype.addClass = function(e) { j(this.el_, e) }, e.prototype.removeClass = function(e) { H(this.el_, e) }, e.prototype.toggleClass = function(e, t) { G(this.el_, e, t) }, e.prototype.show = function() { this.removeClass("vjs-hidden") }, e.prototype.hide = function() { this.addClass("vjs-hidden") }, e.prototype.lockShowing = function() { this.addClass("vjs-lock-showing") }, e.prototype.unlockShowing = function() { this.removeClass("vjs-lock-showing") }, e.prototype.getAttribute = function(e) { return q(this.el_, e) }, e.prototype.setAttribute = function(e, t) { X(this.el_, e, t) }, e.prototype.removeAttribute = function(e) { z(this.el_, e) }, e.prototype.width = function(e, t) { return this.dimension("width", e, t) }, e.prototype.height = function(e, t) { return this.dimension("height", e, t) }, e.prototype.dimensions = function(e, t) { this.width(e, !0), this.height(t) }, e.prototype.dimension = function(e, t, i) { if (void 0 !== t) return null !== t && t == t || (t = 0), -1 !== ("" + t).indexOf("%") || -1 !== ("" + t) .indexOf("px") ? this.el_.style[e] = t : this.el_.style[e] = "auto" === t ? "" : t + "px", void(i || this.trigger("componentresize")); if (!this.el_) return 0; var r = this.el_.style[e], n = r.indexOf("px"); return -1 !== n ? parseInt(r.slice(0, n), 10) : parseInt(this.el_["offset" + ze(e)], 10) }, e.prototype.currentDimension = function(e) { var t = 0; if ("width" !== e && "height" !== e) throw new Error("currentDimension only accepts width or height value"); if ("function" == typeof n.getComputedStyle) { var i = n.getComputedStyle(this.el_); t = i.getPropertyValue(e) || i[e] } if (0 === (t = parseFloat(t))) { var r = "offset" + ze(e); t = this.el_[r] } return t }, e.prototype.currentDimensions = function() { return { width: this.currentDimension("width"), height: this.currentDimension("height") } }, e.prototype.currentWidth = function() { return this.currentDimension("width") }, e.prototype.currentHeight = function() { return this.currentDimension("height") }, e.prototype.focus = function() { this.el_.focus() }, e.prototype.blur = function() { this.el_.blur() }, e.prototype.emitTapEvents = function() { var e = 0, t = null, i = void 0; this.on("touchstart", function(r) { 1 === r.touches.length && (t = { pageX: r.touches[0].pageX, pageY: r.touches[0].pageY }, e = (new Date).getTime(), i = !0) }), this.on("touchmove", function(e) { if (e.touches.length > 1) i = !1; else if (t) { var r = e.touches[0].pageX - t.pageX, n = e.touches[0].pageY - t.pageY; Math.sqrt(r * r + n * n) > 10 && (i = !1) } }); var r = function() { i = !1 }; this.on("touchleave", r), this.on("touchcancel", r), this.on("touchend", function(r) { (t = null, !0 === i) && ((new Date).getTime() - e < 200 && (r.preventDefault(), this.trigger("tap"))) }) }, e.prototype.enableTouchActivity = function() { if (this.player() && this.player().reportUserActivity) { var e = De(this.player(), this.player().reportUserActivity), t = void 0; this.on("touchstart", function() { e(), this.clearInterval(t), t = this.setInterval(e, 250) }); var i = function(i) { e(), this.clearInterval(t) }; this.on("touchmove", e), this.on("touchend", i), this.on("touchcancel", i) } }, e.prototype.setTimeout = function(e, t) { var i, r, a = this; return e = De(this, e), i = n.setTimeout(function() { a.off("dispose", r), e() }, t), (r = function() { return a.clearTimeout(i) }).guid = "vjs-timeout-" + i, this.on("dispose", r), i }, e.prototype.clearTimeout = function(e) { n.clearTimeout(e); var t = function() {}; return t.guid = "vjs-timeout-" + e, this.off("dispose", t), e }, e.prototype.setInterval = function(e, t) { var i = this; e = De(this, e); var r = n.setInterval(e, t), a = function() { return i.clearInterval(r) }; return a.guid = "vjs-interval-" + r, this.on("dispose", a), r }, e.prototype.clearInterval = function(e) { n.clearInterval(e); var t = function() {}; return t.guid = "vjs-interval-" + e, this.off("dispose", t), e }, e.prototype.requestAnimationFrame = function(e) { var t, i, r = this; return this.supportsRaf_ ? (e = De(this, e), t = n.requestAnimationFrame(function() { r.off("dispose", i), e() }), (i = function() { return r.cancelAnimationFrame(t) }).guid = "vjs-raf-" + t, this.on("dispose", i), t) : this.setTimeout(e, 1e3 / 60) }, e.prototype.cancelAnimationFrame = function(e) { if (this.supportsRaf_) { n.cancelAnimationFrame(e); var t = function() {}; return t.guid = "vjs-raf-" + e, this.off("dispose", t), e } return this.clearTimeout(e) }, e.registerComponent = function(t, i) { if ("string" != typeof t || !t) throw new Error('Illegal component name, "' + t + '"; must be a non-empty string.'); var r = e.getComponent("Tech"), n = r && r.isTech(i), a = e === i || e.prototype.isPrototypeOf(i.prototype); if (n || !a) { var s = void 0; throw s = n ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass", new Error('Illegal component, "' + t + '"; ' + s + ".") } t = ze(t), e.components_ || (e.components_ = {}); var o = e.getComponent("Player"); if ("Player" === t && o && o.players) { var u = o.players, l = Object.keys(u); if (u && l.length > 0 && l.map(function(e) { return u[e] }).every(Boolean)) throw new Error("Can not register Player component after player has been created.") } return e.components_[t] = i, i }, e.getComponent = function(t) { if (t) return t = ze(t), e.components_ && e.components_[t] ? e.components_[t] : void 0 }, e }(); Ye.prototype.supportsRaf_ = "function" == typeof n.requestAnimationFrame && "function" == typeof n .cancelAnimationFrame, Ye.registerComponent("Component", Ye); var Qe, Je = n.navigator && n.navigator.userAgent || "", Ze = /AppleWebKit\/([\d.]+)/i.exec(Je), $e = Ze ? parseFloat(Ze.pop()) : null, et = /iPad/i.test(Je), tt = /iPhone/i.test(Je) && !et, it = /iPod/i.test(Je), rt = tt || et || it, nt = (Qe = Je.match(/OS (\d+)_/i)) && Qe[1] ? Qe[1] : null, at = /Android/i.test(Je), st = function() { var e = Je.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i); if (!e) return null; var t = e[1] && parseFloat(e[1]), i = e[2] && parseFloat(e[2]); return t && i ? parseFloat(e[1] + "." + e[2]) : t || null }(), ot = at && st < 5 && $e < 537, ut = /Firefox/i.test(Je), lt = /Edge/i.test(Je), dt = !lt && (/Chrome/i.test(Je) || /CriOS/i.test(Je)), ct = function() { var e = Je.match(/(Chrome|CriOS)\/(\d+)/); return e && e[2] ? parseFloat(e[2]) : null }(), ht = function() { var e = /MSIE\s(\d+)\.\d/.exec(Je), t = e && parseFloat(e[1]); return !t && /Trident\/7.0/i.test(Je) && /rv:11.0/.test(Je) && (t = 11), t }(), ft = /Safari/i.test(Je) && !dt && !at && !lt, pt = (ft || rt) && !dt, mt = I() && ("ontouchstart" in n || n.navigator.maxTouchPoints || n.DocumentTouch && n.document instanceof n .DocumentTouch), gt = Object.freeze({ IS_IPAD: et, IS_IPHONE: tt, IS_IPOD: it, IS_IOS: rt, IOS_VERSION: nt, IS_ANDROID: at, ANDROID_VERSION: st, IS_NATIVE_ANDROID: ot, IS_FIREFOX: ut, IS_EDGE: lt, IS_CHROME: dt, CHROME_VERSION: ct, IE_VERSION: ht, IS_SAFARI: ft, IS_ANY_SAFARI: pt, TOUCH_ENABLED: mt }); function vt(e, t, i, r) { return function(e, t, i) { if ("number" != typeof t || t < 0 || t > i) throw new Error("Failed to execute '" + e + "' on 'TimeRanges': The index provided (" + t + ") is non-numeric or out of bounds (0-" + i + ").") }(e, r, i.length - 1), i[r][t] } function yt(e) { return void 0 === e || 0 === e.length ? { length: 0, start: function() { throw new Error("This TimeRanges object is empty") }, end: function() { throw new Error("This TimeRanges object is empty") } } : { length: e.length, start: vt.bind(null, "start", 0, e), end: vt.bind(null, "end", 1, e) } } function _t(e, t) { return Array.isArray(e) ? yt(e) : void 0 === e || void 0 === t ? yt() : yt([ [e, t] ]) } function bt(e, t) { var i = 0, r = void 0, n = void 0; if (!t) return 0; e && e.length || (e = _t(0, 0)); for (var a = 0; a < e.length; a++) r = e.start(a), (n = e.end(a)) > t && (n = t), i += n - r; return i / t } for (var wt = {}, Et = [ ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror" ], ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror" ], ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror" ], ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror" ], ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError" ] ], Tt = Et[0], St = void 0, At = 0; At < Et.length; At++) if (Et[At][1] in l) { St = Et[At]; break } if (St) for (var kt = 0; kt < St.length; kt++) wt[Tt[kt]] = St[kt]; function Rt(e) { if (e instanceof Rt) return e; "number" == typeof e ? this.code = e : "string" == typeof e ? this.message = e : k(e) && ("number" == typeof e .code && (this.code = e.code), A(this, e)), this.message || (this.message = Rt.defaultMessages[this.code] || "") } Rt.prototype.code = 0, Rt.prototype.message = "", Rt.prototype.status = null, Rt.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED" ], Rt.defaultMessages = { 1: "You aborted the media playback", 2: "A network error caused the media download to fail part-way.", 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.", 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.", 5: "The media is encrypted and we do not have the keys to decrypt it." }; for (var Mt = 0; Mt < Rt.errorTypes.length; Mt++) Rt[Rt.errorTypes[Mt]] = Mt, Rt.prototype[Rt.errorTypes[Mt]] = Mt; var Ot = function(e, t) { var i, r = null; try { i = JSON.parse(e, t) } catch (e) { r = e } return [r, i] }; function Ct(e) { return void 0 !== e && null !== e && "function" == typeof e.then } function Dt(e) { Ct(e) && e.then(null, function(e) {}) } var It = function(e) { return ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function(t, i, r) { return e[i] && (t[i] = e[i]), t }, { cues: e.cues && Array.prototype.map.call(e.cues, function(e) { return { startTime: e.startTime, endTime: e.endTime, text: e.text, id: e.id } }) }) }, Lt = function(e) { var t = e.$$("track"), i = Array.prototype.map.call(t, function(e) { return e.track }); return Array.prototype.map.call(t, function(e) { var t = It(e.track); return e.src && (t.src = e.src), t }).concat(Array.prototype.filter.call(e.textTracks(), function(e) { return -1 === i.indexOf(e) }).map(It)) }, xt = function(e, t) { return e.forEach(function(e) { var i = t.addRemoteTextTrack(e).track; !e.src && e.cues && e.cues.forEach(function(e) { return i.addCue(e) }) }), t.textTracks() }, Pt = "vjs-modal-dialog", Ut = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.opened_ = n.hasBeenOpened_ = n.hasBeenFilled_ = !1, n.closeable(!n.options_.uncloseable), n.content(n .options_.content), n.contentEl_ = U("div", { className: Pt + "-content" }, { role: "document" }), n.descEl_ = U("p", { className: Pt + "-description vjs-control-text", id: n.el().getAttribute("aria-describedby") }), N(n.descEl_, n.description()), n.el_.appendChild(n.descEl_), n.el_.appendChild(n.contentEl_), n } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: this.buildCSSClass(), tabIndex: -1 }, { "aria-describedby": this.id() + "_description", "aria-hidden": "true", "aria-label": this.label(), role: "dialog" }) }, t.prototype.dispose = function() { this.contentEl_ = null, this.descEl_ = null, this.previouslyActiveEl_ = null, e.prototype.dispose.call(this) }, t.prototype.buildCSSClass = function() { return Pt + " vjs-hidden " + e.prototype.buildCSSClass.call(this) }, t.prototype.handleKeyPress = function(e) { 27 === e.which && this.closeable() && this.close() }, t.prototype.label = function() { return this.localize(this.options_.label || "Modal Window") }, t.prototype.description = function() { var e = this.options_.description || this.localize("This is a modal window."); return this.closeable() && (e += " " + this.localize( "This modal can be closed by pressing the Escape key or activating the close button.")), e }, t.prototype.open = function() { if (!this.opened_) { var e = this.player(); this.trigger("beforemodalopen"), this.opened_ = !0, (this.options_.fillAlways || !this.hasBeenOpened_ && ! this.hasBeenFilled_) && this.fill(), this.wasPlaying_ = !e.paused(), this.options_.pauseOnOpen && this .wasPlaying_ && e.pause(), this.closeable() && this.on(this.el_.ownerDocument, "keydown", De(this, this .handleKeyPress)), this.hadControls_ = e.controls(), e.controls(!1), this.show(), this .conditionalFocus_(), this.el().setAttribute("aria-hidden", "false"), this.trigger("modalopen"), this .hasBeenOpened_ = !0 } }, t.prototype.opened = function(e) { return "boolean" == typeof e && this[e ? "open" : "close"](), this.opened_ }, t.prototype.close = function() { if (this.opened_) { var e = this.player(); this.trigger("beforemodalclose"), this.opened_ = !1, this.wasPlaying_ && this.options_.pauseOnOpen && e .play(), this.closeable() && this.off(this.el_.ownerDocument, "keydown", De(this, this.handleKeyPress)), this.hadControls_ && e.controls(!0), this.hide(), this.el().setAttribute("aria-hidden", "true"), this .trigger("modalclose"), this.conditionalBlur_(), this.options_.temporary && this.dispose() } }, t.prototype.closeable = function(e) { if ("boolean" == typeof e) { var t = this.closeable_ = !!e, i = this.getChild("closeButton"); if (t && !i) { var r = this.contentEl_; this.contentEl_ = this.el_, i = this.addChild("closeButton", { controlText: "Close Modal Dialog" }), this.contentEl_ = r, this.on(i, "close", this.close) }!t && i && (this.off(i, "close", this.close), this.removeChild(i), i.dispose()) } return this.closeable_ }, t.prototype.fill = function() { this.fillWith(this.content()) }, t.prototype.fillWith = function(e) { var t = this.contentEl(), i = t.parentNode, r = t.nextSibling; this.trigger("beforemodalfill"), this.hasBeenFilled_ = !0, i.removeChild(t), this.empty(), re(t, e), this .trigger("modalfill"), r ? i.insertBefore(t, r) : i.appendChild(t); var n = this.getChild("closeButton"); n && i.appendChild(n.el_) }, t.prototype.empty = function() { this.trigger("beforemodalempty"), ee(this.contentEl()), this.trigger("modalempty") }, t.prototype.content = function(e) { return void 0 !== e && (this.content_ = e), this.content_ }, t.prototype.conditionalFocus_ = function() { var e = l.activeElement, t = this.player_.el_; this.previouslyActiveEl_ = null, (t.contains(e) || t === e) && (this.previouslyActiveEl_ = e, this.focus(), this.on(l, "keydown", this.handleKeyDown)) }, t.prototype.conditionalBlur_ = function() { this.previouslyActiveEl_ && (this.previouslyActiveEl_.focus(), this.previouslyActiveEl_ = null), this.off(l, "keydown", this.handleKeyDown) }, t.prototype.handleKeyDown = function(e) { if (9 === e.which) { for (var t = this.focusableEls_(), i = this.el_.querySelector(":focus"), r = void 0, n = 0; n < t .length; n++) if (i === t[n]) { r = n; break } l.activeElement === this.el_ && (r = 0), e.shiftKey && 0 === r ? (t[t.length - 1].focus(), e .preventDefault()) : e.shiftKey || r !== t.length - 1 || (t[0].focus(), e.preventDefault()) } }, t.prototype.focusableEls_ = function() { var e = this.el_.querySelectorAll("*"); return Array.prototype.filter.call(e, function(e) { return (e instanceof n.HTMLAnchorElement || e instanceof n.HTMLAreaElement) && e.hasAttribute( "href") || (e instanceof n.HTMLInputElement || e instanceof n.HTMLSelectElement || e instanceof n .HTMLTextAreaElement || e instanceof n.HTMLButtonElement) && !e.hasAttribute("disabled") || e instanceof n.HTMLIFrameElement || e instanceof n.HTMLObjectElement || e instanceof n .HTMLEmbedElement || e.hasAttribute("tabindex") && -1 !== e.getAttribute("tabindex") || e .hasAttribute("contenteditable") }) }, t }(Ye); Ut.prototype.options_ = { pauseOnOpen: !0, temporary: !0 }, Ye.registerComponent("ModalDialog", Ut); var Nt = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; y(this, t); var r = b(this, e.call(this)); r.tracks_ = [], Object.defineProperty(r, "length", { get: function() { return this.tracks_.length } }); for (var n = 0; n < i.length; n++) r.addTrack(i[n]); return r } return _(t, e), t.prototype.addTrack = function(e) { var t = this.tracks_.length; "" + t in this || Object.defineProperty(this, t, { get: function() { return this.tracks_[t] } }), -1 === this.tracks_.indexOf(e) && (this.tracks_.push(e), this.trigger({ track: e, type: "addtrack" })) }, t.prototype.removeTrack = function(e) { for (var t = void 0, i = 0, r = this.length; i < r; i++) if (this[i] === e) { (t = this[i]).off && t.off(), this.tracks_.splice(i, 1); break } t && this.trigger({ track: t, type: "removetrack" }) }, t.prototype.getTrackById = function(e) { for (var t = null, i = 0, r = this.length; i < r; i++) { var n = this[i]; if (n.id === e) { t = n; break } } return t }, t }(xe); for (var Bt in Nt.prototype.allowedEvents_ = { change: "change", addtrack: "addtrack", removetrack: "removetrack" }, Nt.prototype.allowedEvents_) Nt.prototype["on" + Bt] = null; var Ft = function(e, t) { for (var i = 0; i < e.length; i++) Object.keys(e[i]).length && t.id !== e[i].id && (e[i].enabled = !1) }, jt = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; y(this, t); for (var r = i.length - 1; r >= 0; r--) if (i[r].enabled) { Ft(i, i[r]); break } var n = b(this, e.call(this, i)); return n.changing_ = !1, n } return _(t, e), t.prototype.addTrack = function(t) { var i = this; t.enabled && Ft(this, t), e.prototype.addTrack.call(this, t), t.addEventListener && t.addEventListener( "enabledchange", function() { i.changing_ || (i.changing_ = !0, Ft(i, t), i.changing_ = !1, i.trigger("change")) }) }, t }(Nt), Ht = function(e, t) { for (var i = 0; i < e.length; i++) Object.keys(e[i]).length && t.id !== e[i].id && (e[i].selected = !1) }, Gt = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; y(this, t); for (var r = i.length - 1; r >= 0; r--) if (i[r].selected) { Ht(i, i[r]); break } var n = b(this, e.call(this, i)); return n.changing_ = !1, Object.defineProperty(n, "selectedIndex", { get: function() { for (var e = 0; e < this.length; e++) if (this[e].selected) return e; return -1 }, set: function() {} }), n } return _(t, e), t.prototype.addTrack = function(t) { var i = this; t.selected && Ht(this, t), e.prototype.addTrack.call(this, t), t.addEventListener && t.addEventListener( "selectedchange", function() { i.changing_ || (i.changing_ = !0, Ht(i, t), i.changing_ = !1, i.trigger("change")) }) }, t }(Nt), Vt = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.addTrack = function(t) { e.prototype.addTrack.call(this, t), t.addEventListener("modechange", De(this, function() { this.queueTrigger("change") })); - 1 === ["metadata", "chapters"].indexOf(t.kind) && t.addEventListener("modechange", De(this, function() { this.trigger("selectedlanguagechange") })) }, t }(Nt), Wt = function() { function e() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; y(this, e), this.trackElements_ = [], Object.defineProperty(this, "length", { get: function() { return this.trackElements_.length } }); for (var i = 0, r = t.length; i < r; i++) this.addTrackElement_(t[i]) } return e.prototype.addTrackElement_ = function(e) { var t = this.trackElements_.length; "" + t in this || Object.defineProperty(this, t, { get: function() { return this.trackElements_[t] } }), -1 === this.trackElements_.indexOf(e) && this.trackElements_.push(e) }, e.prototype.getTrackElementByTrack_ = function(e) { for (var t = void 0, i = 0, r = this.trackElements_.length; i < r; i++) if (e === this.trackElements_[i].track) { t = this.trackElements_[i]; break } return t }, e.prototype.removeTrackElement_ = function(e) { for (var t = 0, i = this.trackElements_.length; t < i; t++) if (e === this.trackElements_[t]) { this.trackElements_.splice(t, 1); break } }, e }(), qt = function() { function e(t) { y(this, e), e.prototype.setCues_.call(this, t), Object.defineProperty(this, "length", { get: function() { return this.length_ } }) } return e.prototype.setCues_ = function(e) { var t = this.length || 0, i = 0, r = e.length; this.cues_ = e, this.length_ = e.length; var n = function(e) { "" + e in this || Object.defineProperty(this, "" + e, { get: function() { return this.cues_[e] } }) }; if (t < r) for (i = t; i < r; i++) n.call(this, i) }, e.prototype.getCueById = function(e) { for (var t = null, i = 0, r = this.length; i < r; i++) { var n = this[i]; if (n.id === e) { t = n; break } } return t }, e }(), Xt = { alternative: "alternative", captions: "captions", main: "main", sign: "sign", subtitles: "subtitles", commentary: "commentary" }, zt = { alternative: "alternative", descriptions: "descriptions", main: "main", "main-desc": "main-desc", translation: "translation", commentary: "commentary" }, Kt = { subtitles: "subtitles", captions: "captions", descriptions: "descriptions", chapters: "chapters", metadata: "metadata" }, Yt = { disabled: "disabled", hidden: "hidden", showing: "showing" }, Qt = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; y(this, t); var r = b(this, e.call(this)), n = { id: i.id || "vjs_track_" + le(), kind: i.kind || "", label: i.label || "", language: i.language || "" }, a = function(e) { Object.defineProperty(r, e, { get: function() { return n[e] }, set: function() {} }) }; for (var s in n) a(s); return r } return _(t, e), t }(xe), Jt = function(e) { var t = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"], i = l.createElement("a"); i.href = e; var r = "" === i.host && "file:" !== i.protocol, a = void 0; r && ((a = l.createElement("div")).innerHTML = '', i = a.firstChild, a.setAttribute( "style", "display:none; position:absolute;"), l.body.appendChild(a)); for (var s = {}, o = 0; o < t.length; o++) s[t[o]] = i[t[o]]; return "http:" === s.protocol && (s.host = s.host.replace(/:80$/, "")), "https:" === s.protocol && (s.host = s .host.replace(/:443$/, "")), s.protocol || (s.protocol = n.location.protocol), r && l.body.removeChild(a), s }, Zt = function(e) { if (!e.match(/^https?:\/\//)) { var t = l.createElement("div"); t.innerHTML = 'x', e = t.firstChild.href } return e }, $t = function(e) { if ("string" == typeof e) { var t = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(e); if (t) return t.pop().toLowerCase() } return "" }, ei = function(e) { var t = n.location, i = Jt(e); return (":" === i.protocol ? t.protocol : i.protocol) + i.host !== t.protocol + t.host }, ti = Object.freeze({ parseUrl: Jt, getAbsoluteURL: Zt, getFileExtension: $t, isCrossOrigin: ei }), ii = function(e) { var t = ri.call(e); return "[object Function]" === t || "function" == typeof e && "[object RegExp]" !== t || "undefined" != typeof window && (e === window.setTimeout || e === window.alert || e === window.confirm || e === window .prompt) }, ri = Object.prototype.toString; var ni = Object.freeze({ default: ii, __moduleExports: ii }), ai = i(function(e, t) { (t = e.exports = function(e) { return e.replace(/^\s*|\s*$/g, "") }).left = function(e) { return e.replace(/^\s*/, "") }, t.right = function(e) { return e.replace(/\s*$/, "") } }), si = ai.left, oi = ai.right, ui = Object.freeze({ default: ai, __moduleExports: ai, left: si, right: oi }), li = ni && ii || ni, di = function(e, t, i) { if (!li(t)) throw new TypeError("iterator must be a function"); arguments.length < 3 && (i = this); "[object Array]" === ci.call(e) ? function(e, t, i) { for (var r = 0, n = e.length; r < n; r++) hi.call(e, r) && t.call(i, e[r], r, e) }(e, t, i) : "string" == typeof e ? function(e, t, i) { for (var r = 0, n = e.length; r < n; r++) t.call(i, e.charAt(r), r, e) }(e, t, i) : function(e, t, i) { for (var r in e) hi.call(e, r) && t.call(i, e[r], r, e) }(e, t, i) }, ci = Object.prototype.toString, hi = Object.prototype.hasOwnProperty; var fi = Object.freeze({ default: di, __moduleExports: di }), pi = ui && ai || ui, mi = fi && di || fi, gi = function(e) { if (!e) return {}; var t = {}; return mi(pi(e).split("\n"), function(e) { var i, r = e.indexOf(":"), n = pi(e.slice(0, r)).toLowerCase(), a = pi(e.slice(r + 1)); void 0 === t[n] ? t[n] = a : (i = t[n], "[object Array]" === Object.prototype.toString.call(i) ? t[n] .push(a) : t[n] = [t[n], a]) }), t }, vi = Object.freeze({ default: gi, __moduleExports: gi }), yi = function() { for (var e = {}, t = 0; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) _i.call(i, r) && (e[r] = i[r]) } return e }, _i = Object.prototype.hasOwnProperty; var bi = Object.freeze({ default: yi, __moduleExports: yi }), wi = vi && gi || vi, Ei = bi && yi || bi, Ti = Ai; function Si(e, t, i) { var r = e; return li(t) ? (i = t, "string" == typeof e && (r = { uri: e })) : r = Ei(t, { uri: e }), r.callback = i, r } function Ai(e, t, i) { return ki(t = Si(e, t, i)) } function ki(e) { if (void 0 === e.callback) throw new Error("callback argument missing"); var t = !1, i = function(i, r, n) { t || (t = !0, e.callback(i, r, n)) }; function r(e) { return clearTimeout(u), e instanceof Error || (e = new Error("" + (e || "Unknown XMLHttpRequest Error"))), e .statusCode = 0, i(e, m) } function n() { if (!s) { var t; clearTimeout(u), t = e.useXDR && void 0 === o.status ? 200 : 1223 === o.status ? 204 : o.status; var r = m, n = null; return 0 !== t ? (r = { body: function() { var e = void 0; if (e = o.response ? o.response : o.responseText || function(e) { if ("document" === e.responseType) return e.responseXML; var t = e.responseXML && "parsererror" === e.responseXML.documentElement.nodeName; return "" !== e.responseType || t ? null : e.responseXML }(o), p) try { e = JSON.parse(e) } catch (e) {} return e }(), statusCode: t, method: d, headers: {}, url: l, rawRequest: o }, o.getAllResponseHeaders && (r.headers = wi(o.getAllResponseHeaders()))) : n = new Error( "Internal XMLHttpRequest Error"), i(n, r, r.body) } } var a, s, o = e.xhr || null; o || (o = e.cors || e.useXDR ? new Ai.XDomainRequest : new Ai.XMLHttpRequest); var u, l = o.url = e.uri || e.url, d = o.method = e.method || "GET", c = e.body || e.data, h = o.headers = e.headers || {}, f = !!e.sync, p = !1, m = { body: void 0, headers: {}, statusCode: 0, method: d, url: l, rawRequest: o }; if ("json" in e && !1 !== e.json && (p = !0, h.accept || h.Accept || (h.Accept = "application/json"), "GET" !== d && "HEAD" !== d && (h["content-type"] || h["Content-Type"] || (h["Content-Type"] = "application/json"), c = JSON.stringify(!0 === e.json ? c : e.json))), o.onreadystatechange = function() { 4 === o.readyState && setTimeout(n, 0) }, o.onload = n, o.onerror = r, o.onprogress = function() {}, o.onabort = function() { s = !0 }, o.ontimeout = r, o.open(d, l, !f, e.username, e.password), f || (o.withCredentials = !!e.withCredentials), ! f && e.timeout > 0 && (u = setTimeout(function() { if (!s) { s = !0, o.abort("timeout"); var e = new Error("XMLHttpRequest timeout"); e.code = "ETIMEDOUT", r(e) } }, e.timeout)), o.setRequestHeader) for (a in h) h.hasOwnProperty(a) && o.setRequestHeader(a, h[a]); else e.headers && function(e) { for (var t in e) if (e.hasOwnProperty(t)) return !1 }(e.headers); return "responseType" in e && (o.responseType = e.responseType), "beforeSend" in e && "function" == typeof e .beforeSend && e.beforeSend(o), o.send(c || null), o } Ai.XMLHttpRequest = n.XMLHttpRequest || function() {}, Ai.XDomainRequest = "withCredentials" in new Ai .XMLHttpRequest ? Ai.XMLHttpRequest : n.XDomainRequest, function(e, t) { for (var i = 0; i < e.length; i++) t(e[i]) }(["get", "put", "post", "patch", "head", "delete"], function(e) { Ai["delete" === e ? "del" : e] = function(t, i, r) { return (i = Si(t, i, r)).method = e.toUpperCase(), ki(i) } }); var Ri = function(e, t) { var i = new n.WebVTT.Parser(n, n.vttjs, n.WebVTT.StringDecoder()), r = []; i.oncue = function(e) { t.addCue(e) }, i.onparsingerror = function(e) { r.push(e) }, i.onflush = function() { t.trigger({ type: "loadeddata", target: t }) }, i.parse(e), r.length > 0 && (n.console && n.console.groupCollapsed && n.console.groupCollapsed( "Text Track parsing errors for " + t.src), r.forEach(function(e) { return p.error(e) }), n.console && n.console.groupEnd && n.console.groupEnd()), i.flush() }, Mi = function(e, t) { var i = { uri: e }, r = ei(e); r && (i.cors = r), Ti(i, De(this, function(e, i, r) { if (e) return p.error(e, i); if (t.loaded_ = !0, "function" != typeof n.WebVTT) { if (t.tech_) { var a = function() { return Ri(r, t) }; t.tech_.on("vttjsloaded", a), t.tech_.on("vttjserror", function() { p.error("vttjs failed to load, stopping trying to process " + t.src), t.tech_.off( "vttjsloaded", a) }) } } else Ri(r, t) })) }, Oi = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; if (y(this, t), !i.tech) throw new Error("A tech was not provided."); var r = Ke(i, { kind: Kt[i.kind] || "subtitles", language: i.language || i.srclang || "" }), n = Yt[r.mode] || "disabled", a = r.default; "metadata" !== r.kind && "chapters" !== r.kind || (n = "hidden"); var s = b(this, e.call(this, r)); s.tech_ = r.tech, s.cues_ = [], s.activeCues_ = []; var o = new qt(s.cues_), u = new qt(s.activeCues_), l = !1, d = De(s, function() { this.activeCues = this.activeCues, l && (this.trigger("cuechange"), l = !1) }); return "disabled" !== n && s.tech_.ready(function() { s.tech_.on("timeupdate", d) }, !0), Object.defineProperties(s, { default: { get: function() { return a }, set: function() {} }, mode: { get: function() { return n }, set: function(e) { var t = this; Yt[e] && ("disabled" !== (n = e) ? this.tech_.ready(function() { t.tech_.on("timeupdate", d) }, !0) : this.tech_.off("timeupdate", d), this.trigger("modechange")) } }, cues: { get: function() { return this.loaded_ ? o : null }, set: function() {} }, activeCues: { get: function() { if (!this.loaded_) return null; if (0 === this.cues.length) return u; for (var e = this.tech_.currentTime(), t = [], i = 0, r = this.cues.length; i < r; i++) { var n = this.cues[i]; n.startTime <= e && n.endTime >= e ? t.push(n) : n.startTime === n.endTime && n.startTime <= e && n.startTime + .5 >= e && t.push(n) } if (l = !1, t.length !== this.activeCues_.length) l = !0; else for (var a = 0; a < t.length; a++) - 1 === this.activeCues_.indexOf(t[a]) && (l = !0); return this.activeCues_ = t, u.setCues_(this.activeCues_), u }, set: function() {} } }), r.src ? (s.src = r.src, Mi(r.src, s)) : s.loaded_ = !0, s } return _(t, e), t.prototype.addCue = function(e) { var t = e; if (n.vttjs && !(e instanceof n.vttjs.VTTCue)) { for (var i in t = new n.vttjs.VTTCue(e.startTime, e.endTime, e.text), e) i in t || (t[i] = e[i]); t.id = e.id, t.originalCue_ = e } for (var r = this.tech_.textTracks(), a = 0; a < r.length; a++) r[a] !== this && r[a].removeCue(t); this.cues_.push(t), this.cues.setCues_(this.cues_) }, t.prototype.removeCue = function(e) { for (var t = this.cues_.length; t--;) { var i = this.cues_[t]; if (i === e || i.originalCue_ && i.originalCue_ === e) { this.cues_.splice(t, 1), this.cues.setCues_(this.cues_); break } } }, t }(Qt); Oi.prototype.allowedEvents_ = { cuechange: "cuechange" }; var Ci = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; y(this, t); var r = Ke(i, { kind: zt[i.kind] || "" }), n = b(this, e.call(this, r)), a = !1; return Object.defineProperty(n, "enabled", { get: function() { return a }, set: function(e) { "boolean" == typeof e && e !== a && (a = e, this.trigger("enabledchange")) } }), r.enabled && (n.enabled = r.enabled), n.loaded_ = !0, n } return _(t, e), t }(Qt), Di = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; y(this, t); var r = Ke(i, { kind: Xt[i.kind] || "" }), n = b(this, e.call(this, r)), a = !1; return Object.defineProperty(n, "selected", { get: function() { return a }, set: function(e) { "boolean" == typeof e && e !== a && (a = e, this.trigger("selectedchange")) } }), r.selected && (n.selected = r.selected), n } return _(t, e), t }(Qt), Ii = 0, Li = 2, xi = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; y(this, t); var r = b(this, e.call(this)), n = void 0, a = new Oi(i); return r.kind = a.kind, r.src = a.src, r.srclang = a.language, r.label = a.label, r.default = a.default, Object.defineProperties(r, { readyState: { get: function() { return n } }, track: { get: function() { return a } } }), n = Ii, a.addEventListener("loadeddata", function() { n = Li, r.trigger({ type: "load", target: r }) }), r } return _(t, e), t }(xe); xi.prototype.allowedEvents_ = { load: "load" }, xi.NONE = Ii, xi.LOADING = 1, xi.LOADED = Li, xi.ERROR = 3; var Pi = { audio: { ListClass: jt, TrackClass: Ci, capitalName: "Audio" }, video: { ListClass: Gt, TrackClass: Di, capitalName: "Video" }, text: { ListClass: Vt, TrackClass: Oi, capitalName: "Text" } }; Object.keys(Pi).forEach(function(e) { Pi[e].getterName = e + "Tracks", Pi[e].privateName = e + "Tracks_" }); var Ui = { remoteText: { ListClass: Vt, TrackClass: Oi, capitalName: "RemoteText", getterName: "remoteTextTracks", privateName: "remoteTextTracks_" }, remoteTextEl: { ListClass: Wt, TrackClass: xi, capitalName: "RemoteTextTrackEls", getterName: "remoteTextTrackEls", privateName: "remoteTextTrackEls_" } }, Ni = Ke(Pi, Ui); Ui.names = Object.keys(Ui), Pi.names = Object.keys(Pi), Ni.names = [].concat(Ui.names).concat(Pi.names); var Bi = Object.create || function() { function e() {} return function(t) { if (1 !== arguments.length) throw new Error("Object.create shim only accepts one parameter."); return e.prototype = t, new e } }(); function Fi(e, t) { this.name = "ParsingError", this.code = e.code, this.message = t || e.message } function ji(e) { function t(e, t, i, r) { return 3600 * (0 | e) + 60 * (0 | t) + (0 | i) + (0 | r) / 1e3 } var i = e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/); return i ? i[3] ? t(i[1], i[2], i[3].replace(":", ""), i[4]) : i[1] > 59 ? t(i[1], i[2], 0, i[4]) : t(0, i[1], i[ 2], i[4]) : null } function Hi() { this.values = Bi(null) } function Gi(e, t, i, r) { var n = r ? e.split(r) : [e]; for (var a in n) if ("string" == typeof n[a]) { var s = n[a].split(i); if (2 === s.length) t(s[0], s[1]) } } function Vi(e, t, i) { var r = e; function n() { var t = ji(e); if (null === t) throw new Fi(Fi.Errors.BadTimeStamp, "Malformed timestamp: " + r); return e = e.replace(/^[^\sa-zA-Z-]+/, ""), t } function a() { e = e.replace(/^\s+/, "") } if (a(), t.startTime = n(), a(), "--\x3e" !== e.substr(0, 3)) throw new Fi(Fi.Errors.BadTimeStamp, "Malformed time stamp (time stamps must be separated by '--\x3e'): " + r); e = e.substr(3), a(), t.endTime = n(), a(), function(e, t) { var r = new Hi; Gi(e, function(e, t) { switch (e) { case "region": for (var n = i.length - 1; n >= 0; n--) if (i[n].id === t) { r.set(e, i[n].region); break } break; case "vertical": r.alt(e, t, ["rl", "lr"]); break; case "line": var a = t.split(","), s = a[0]; r.integer(e, s), r.percent(e, s) && r.set("snapToLines", !1), r.alt(e, s, ["auto"]), 2 === a .length && r.alt("lineAlign", a[1], ["start", "middle", "end"]); break; case "position": a = t.split(","), r.percent(e, a[0]), 2 === a.length && r.alt("positionAlign", a[1], ["start", "middle", "end" ]); break; case "size": r.percent(e, t); break; case "align": r.alt(e, t, ["start", "middle", "end", "left", "right"]) } }, /:/, /\s/), t.region = r.get("region", null), t.vertical = r.get("vertical", ""), t.line = r.get("line", "auto"), t.lineAlign = r.get("lineAlign", "start"), t.snapToLines = r.get("snapToLines", !0), t.size = r .get("size", 100), t.align = r.get("align", "middle"), t.position = r.get("position", { start: 0, left: 0, middle: 50, end: 100, right: 100 }, t.align), t.positionAlign = r.get("positionAlign", { start: "start", left: "start", middle: "middle", end: "end", right: "end" }, t.align) }(e, t) } Fi.prototype = Bi(Error.prototype), Fi.prototype.constructor = Fi, Fi.Errors = { BadSignature: { code: 0, message: "Malformed WebVTT signature." }, BadTimeStamp: { code: 1, message: "Malformed time stamp." } }, Hi.prototype = { set: function(e, t) { this.get(e) || "" === t || (this.values[e] = t) }, get: function(e, t, i) { return i ? this.has(e) ? this.values[e] : t[i] : this.has(e) ? this.values[e] : t }, has: function(e) { return e in this.values }, alt: function(e, t, i) { for (var r = 0; r < i.length; ++r) if (t === i[r]) { this.set(e, t); break } }, integer: function(e, t) { /^-?\d+$/.test(t) && this.set(e, parseInt(t, 10)) }, percent: function(e, t) { return !!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/) && (t = parseFloat(t)) >= 0 && t <= 100) && (this.set(e, t), ! 0) } }; var Wi = { "&": "&", "<": "<", ">": ">", "‎": "‎", "‏": "‏", " ": " " }, qi = { c: "span", i: "i", b: "b", u: "u", ruby: "ruby", rt: "rt", v: "span", lang: "span" }, Xi = { v: "title", lang: "lang" }, zi = { rt: "ruby" }; function Ki(e, t) { function i() { if (!t) return null; var e, i = t.match(/^([^<]*)(<[^>]*>?)?/); return e = i[1] ? i[1] : i[2], t = t.substr(e.length), e } function r(e) { return Wi[e] } function n(e) { for (; f = e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);) e = e.replace(f[0], r); return e } function a(e, t) { return !zi[t.localName] || zi[t.localName] === e.localName } function s(t, i) { var r = qi[t]; if (!r) return null; var n = e.document.createElement(r); n.localName = r; var a = Xi[t]; return a && i && (n[a] = i.trim()), n } for (var o, u = e.document.createElement("div"), l = u, d = []; null !== (o = i());) if ("<" !== o[0]) l.appendChild(e.document.createTextNode(n(o))); else { if ("/" === o[1]) { d.length && d[d.length - 1] === o.substr(2).replace(">", "") && (d.pop(), l = l.parentNode); continue } var c, h = ji(o.substr(1, o.length - 2)); if (h) { c = e.document.createProcessingInstruction("timestamp", h), l.appendChild(c); continue } var f = o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/); if (!f) continue; if (!(c = s(f[1], f[3]))) continue; if (!a(l, c)) continue; f[2] && (c.className = f[2].substr(1).replace(".", " ")), d.push(f[1]), l.appendChild(c), l = c } return u } var Yi = [ [1470, 1470], [1472, 1472], [1475, 1475], [1478, 1478], [1488, 1514], [1520, 1524], [1544, 1544], [1547, 1547], [1549, 1549], [1563, 1563], [1566, 1610], [1645, 1647], [1649, 1749], [1765, 1766], [1774, 1775], [1786, 1805], [1807, 1808], [1810, 1839], [1869, 1957], [1969, 1969], [1984, 2026], [2036, 2037], [2042, 2042], [2048, 2069], [2074, 2074], [2084, 2084], [2088, 2088], [2096, 2110], [2112, 2136], [2142, 2142], [2208, 2208], [2210, 2220], [8207, 8207], [64285, 64285], [64287, 64296], [64298, 64310], [64312, 64316], [64318, 64318], [64320, 64321], [64323, 64324], [64326, 64449], [64467, 64829], [64848, 64911], [64914, 64967], [65008, 65020], [65136, 65140], [65142, 65276], [67584, 67589], [67592, 67592], [67594, 67637], [67639, 67640], [67644, 67644], [67647, 67669], [67671, 67679], [67840, 67867], [67872, 67897], [67903, 67903], [67968, 68023], [68030, 68031], [68096, 68096], [68112, 68115], [68117, 68119], [68121, 68147], [68160, 68167], [68176, 68184], [68192, 68223], [68352, 68405], [68416, 68437], [68440, 68466], [68472, 68479], [68608, 68680], [126464, 126467], [126469, 126495], [126497, 126498], [126500, 126500], [126503, 126503], [126505, 126514], [126516, 126519], [126521, 126521], [126523, 126523], [126530, 126530], [126535, 126535], [126537, 126537], [126539, 126539], [126541, 126543], [126545, 126546], [126548, 126548], [126551, 126551], [126553, 126553], [126555, 126555], [126557, 126557], [126559, 126559], [126561, 126562], [126564, 126564], [126567, 126570], [126572, 126578], [126580, 126583], [126585, 126588], [126590, 126590], [126592, 126601], [126603, 126619], [126625, 126627], [126629, 126633], [126635, 126651], [1114109, 1114109] ]; function Qi(e) { for (var t = 0; t < Yi.length; t++) { var i = Yi[t]; if (e >= i[0] && e <= i[1]) return !0 } return !1 } function Ji() {} function Zi(e, t, i) { Ji.call(this), this.cue = t, this.cueDiv = Ki(e, t.text); var r = { color: "rgba(255, 255, 255, 1)", backgroundColor: "rgba(0, 0, 0, 0.8)", position: "relative", left: 0, right: 0, top: 0, bottom: 0, display: "inline", writingMode: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl", unicodeBidi: "plaintext" }; this.applyStyles(r, this.cueDiv), this.div = e.document.createElement("div"), r = { direction: function(e) { var t = [], i = ""; if (!e || !e.childNodes) return "ltr"; function r(e, t) { for (var i = t.childNodes.length - 1; i >= 0; i--) e.push(t.childNodes[i]) } function n(e) { if (!e || !e.length) return null; var t = e.pop(), i = t.textContent || t.innerText; if (i) { var a = i.match(/^.*(\n|\r)/); return a ? (e.length = 0, a[0]) : i } return "ruby" === t.tagName ? n(e) : t.childNodes ? (r(e, t), n(e)) : void 0 } for (r(t, e); i = n(t);) for (var a = 0; a < i.length; a++) if (Qi(i.charCodeAt(a))) return "rtl"; return "ltr" }(this.cueDiv), writingMode: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl", unicodeBidi: "plaintext", textAlign: "middle" === t.align ? "center" : t.align, font: i.font, whiteSpace: "pre-line", position: "absolute" }, this.applyStyles(r), this.div.appendChild(this.cueDiv); var n = 0; switch (t.positionAlign) { case "start": n = t.position; break; case "middle": n = t.position - t.size / 2; break; case "end": n = t.position - t.size } "" === t.vertical ? this.applyStyles({ left: this.formatStyle(n, "%"), width: this.formatStyle(t.size, "%") }) : this.applyStyles({ top: this.formatStyle(n, "%"), height: this.formatStyle(t.size, "%") }), this.move = function(e) { this.applyStyles({ top: this.formatStyle(e.top, "px"), bottom: this.formatStyle(e.bottom, "px"), left: this.formatStyle(e.left, "px"), right: this.formatStyle(e.right, "px"), height: this.formatStyle(e.height, "px"), width: this.formatStyle(e.width, "px") }) } } function $i(e) { var t, i, r, n; if (e.div) { i = e.div.offsetHeight, r = e.div.offsetWidth, n = e.div.offsetTop; var a = (a = e.div.childNodes) && (a = a[0]) && a.getClientRects && a.getClientRects(); e = e.div.getBoundingClientRect(), t = a ? Math.max(a[0] && a[0].height || 0, e.height / a.length) : 0 } this.left = e.left, this.right = e.right, this.top = e.top || n, this.height = e.height || i, this.bottom = e .bottom || n + (e.height || i), this.width = e.width || r, this.lineHeight = void 0 !== t ? t : e.lineHeight } function er(e, t, i, r) { var n = new $i(t), a = t.cue, s = function(e) { if ("number" == typeof e.line && (e.snapToLines || e.line >= 0 && e.line <= 100)) return e.line; if (!e.track || !e.track.textTrackList || !e.track.textTrackList.mediaElement) return -1; for (var t = e.track, i = t.textTrackList, r = 0, n = 0; n < i.length && i[n] !== t; n++) "showing" === i[n] .mode && r++; return -1 * ++r }(a), o = []; if (a.snapToLines) { var u; switch (a.vertical) { case "": o = ["+y", "-y"], u = "height"; break; case "rl": o = ["+x", "-x"], u = "width"; break; case "lr": o = ["-x", "+x"], u = "width" } var l = n.lineHeight, d = l * Math.round(s), c = i[u] + l, h = o[0]; Math.abs(d) > c && (d = d < 0 ? -1 : 1, d *= Math.ceil(c / l) * l), s < 0 && (d += "" === a.vertical ? i .height : i.width, o = o.reverse()), n.move(h, d) } else { var f = n.lineHeight / i.height * 100; switch (a.lineAlign) { case "middle": s -= f / 2; break; case "end": s -= f } switch (a.vertical) { case "": t.applyStyles({ top: t.formatStyle(s, "%") }); break; case "rl": t.applyStyles({ left: t.formatStyle(s, "%") }); break; case "lr": t.applyStyles({ right: t.formatStyle(s, "%") }) } o = ["+y", "-x", "+x", "-y"], n = new $i(t) } var p = function(e, t) { for (var n, a = new $i(e), s = 1, o = 0; o < t.length; o++) { for (; e.overlapsOppositeAxis(i, t[o]) || e.within(i) && e.overlapsAny(r);) e.move(t[o]); if (e.within(i)) return e; var u = e.intersectPercentage(i); s > u && (n = new $i(e), s = u), e = new $i(a) } return n || a }(n, o); t.move(p.toCSSCompatValues(i)) } function tr() {} Ji.prototype.applyStyles = function(e, t) { for (var i in t = t || this.div, e) e.hasOwnProperty(i) && (t.style[i] = e[i]) }, Ji.prototype.formatStyle = function(e, t) { return 0 === e ? 0 : e + t }, Zi.prototype = Bi(Ji.prototype), Zi.prototype.constructor = Zi, $i.prototype.move = function(e, t) { switch (t = void 0 !== t ? t : this.lineHeight, e) { case "+x": this.left += t, this.right += t; break; case "-x": this.left -= t, this.right -= t; break; case "+y": this.top += t, this.bottom += t; break; case "-y": this.top -= t, this.bottom -= t } }, $i.prototype.overlaps = function(e) { return this.left < e.right && this.right > e.left && this.top < e.bottom && this.bottom > e.top }, $i.prototype.overlapsAny = function(e) { for (var t = 0; t < e.length; t++) if (this.overlaps(e[t])) return !0; return !1 }, $i.prototype.within = function(e) { return this.top >= e.top && this.bottom <= e.bottom && this.left >= e.left && this.right <= e.right }, $i.prototype.overlapsOppositeAxis = function(e, t) { switch (t) { case "+x": return this.left < e.left; case "-x": return this.right > e.right; case "+y": return this.top < e.top; case "-y": return this.bottom > e.bottom } }, $i.prototype.intersectPercentage = function(e) { return Math.max(0, Math.min(this.right, e.right) - Math.max(this.left, e.left)) * Math.max(0, Math.min(this .bottom, e.bottom) - Math.max(this.top, e.top)) / (this.height * this.width) }, $i.prototype.toCSSCompatValues = function(e) { return { top: this.top - e.top, bottom: e.bottom - this.bottom, left: this.left - e.left, right: e.right - this.right, height: this.height, width: this.width } }, $i.getSimpleBoxPosition = function(e) { var t = e.div ? e.div.offsetHeight : e.tagName ? e.offsetHeight : 0, i = e.div ? e.div.offsetWidth : e.tagName ? e.offsetWidth : 0, r = e.div ? e.div.offsetTop : e.tagName ? e.offsetTop : 0; return { left: (e = e.div ? e.div.getBoundingClientRect() : e.tagName ? e.getBoundingClientRect() : e).left, right: e.right, top: e.top || r, height: e.height || t, bottom: e.bottom || r + (e.height || t), width: e.width || i } }, tr.StringDecoder = function() { return { decode: function(e) { if (!e) return ""; if ("string" != typeof e) throw new Error("Error - expected string data."); return decodeURIComponent(encodeURIComponent(e)) } } }, tr.convertCueToDOMTree = function(e, t) { return e && t ? Ki(e, t) : null }; tr.processCues = function(e, t, i) { if (!e || !t || !i) return null; for (; i.firstChild;) i.removeChild(i.firstChild); var r = e.document.createElement("div"); if (r.style.position = "absolute", r.style.left = "0", r.style.right = "0", r.style.top = "0", r.style.bottom = "0", r.style.margin = "1.5%", i.appendChild(r), function(e) { for (var t = 0; t < e.length; t++) if (e[t].hasBeenReset || !e[t].displayState) return !0; return !1 }(t)) { var n = [], a = $i.getSimpleBoxPosition(r), s = { font: Math.round(.05 * a.height * 100) / 100 + "px sans-serif" }; ! function() { for (var i, o, u = 0; u < t.length; u++) o = t[u], i = new Zi(e, o, s), r.appendChild(i.div), er(0, i, a, n), o.displayState = i.div, n.push($i.getSimpleBoxPosition(i)) }() } else for (var o = 0; o < t.length; o++) r.appendChild(t[o].displayState) }, tr.Parser = function(e, t, i) { i || (i = t, t = {}), t || (t = {}), this.window = e, this.vttjs = t, this.state = "INITIAL", this.buffer = "", this.decoder = i || new TextDecoder("utf8"), this.regionList = [] }, tr.Parser.prototype = { reportOrThrowError: function(e) { if (!(e instanceof Fi)) throw e; this.onparsingerror && this.onparsingerror(e) }, parse: function(e) { var t = this; function i() { for (var e = t.buffer, i = 0; i < e.length && "\r" !== e[i] && "\n" !== e[i];) ++i; var r = e.substr(0, i); return "\r" === e[i] && ++i, "\n" === e[i] && ++i, t.buffer = e.substr(i), r } function r(e) { e.match(/X-TIMESTAMP-MAP/) ? Gi(e, function(e, i) { switch (e) { case "X-TIMESTAMP-MAP": r = i, n = new Hi, Gi(r, function(e, t) { switch (e) { case "MPEGT": n.integer(e + "S", t); break; case "LOCA": n.set(e + "L", ji(t)) } }, /[^\d]:/, /,/), t.ontimestampmap && t.ontimestampmap({ MPEGTS: n.get("MPEGTS"), LOCAL: n.get("LOCAL") }) } var r, n }, /=/) : Gi(e, function(e, i) { switch (e) { case "Region": ! function(e) { var i = new Hi; if (Gi(e, function(e, t) { switch (e) { case "id": i.set(e, t); break; case "width": i.percent(e, t); break; case "lines": i.integer(e, t); break; case "regionanchor": case "viewportanchor": var r = t.split(","); if (2 !== r.length) break; var n = new Hi; if (n.percent("x", r[0]), n.percent("y", r[1]), !n.has("x") || !n.has("y")) break; i.set(e + "X", n.get("x")), i.set(e + "Y", n.get("y")); break; case "scroll": i.alt(e, t, ["up"]) } }, /=/, /\s/), i.has("id")) { var r = new(t.vttjs.VTTRegion || t.window.VTTRegion); r.width = i.get("width", 100), r.lines = i.get("lines", 3), r.regionAnchorX = i.get( "regionanchorX", 0), r.regionAnchorY = i.get("regionanchorY", 100), r.viewportAnchorX = i.get("viewportanchorX", 0), r.viewportAnchorY = i.get("viewportanchorY", 100), r.scroll = i.get("scroll", ""), t.onregion && t.onregion(r), t.regionList.push({ id: i.get("id"), region: r }) } }(i) } }, /:/) } e && (t.buffer += t.decoder.decode(e, { stream: !0 })); try { var n; if ("INITIAL" === t.state) { if (!/\r\n|\n/.test(t.buffer)) return this; var a = (n = i()).match(/^WEBVTT([ \t].*)?$/); if (!a || !a[0]) throw new Fi(Fi.Errors.BadSignature); t.state = "HEADER" } for (var s = !1; t.buffer;) { if (!/\r\n|\n/.test(t.buffer)) return this; switch (s ? s = !1 : n = i(), t.state) { case "HEADER": /:/.test(n) ? r(n) : n || (t.state = "ID"); continue; case "NOTE": n || (t.state = "ID"); continue; case "ID": if (/^NOTE($|[ \t])/.test(n)) { t.state = "NOTE"; break } if (!n) continue; if (t.cue = new(t.vttjs.VTTCue || t.window.VTTCue)(0, 0, ""), t.state = "CUE", -1 === n.indexOf( "--\x3e")) { t.cue.id = n; continue } case "CUE": try { Vi(n, t.cue, t.regionList) } catch (e) { t.reportOrThrowError(e), t.cue = null, t.state = "BADCUE"; continue } t.state = "CUETEXT"; continue; case "CUETEXT": var o = -1 !== n.indexOf("--\x3e"); if (!n || o && (s = !0)) { t.oncue && t.oncue(t.cue), t.cue = null, t.state = "ID"; continue } t.cue.text && (t.cue.text += "\n"), t.cue.text += n; continue; case "BADCUE": n || (t.state = "ID"); continue } } } catch (e) { t.reportOrThrowError(e), "CUETEXT" === t.state && t.cue && t.oncue && t.oncue(t.cue), t.cue = null, t .state = "INITIAL" === t.state ? "BADWEBVTT" : "BADCUE" } return this }, flush: function() { try { if (this.buffer += this.decoder.decode(), (this.cue || "HEADER" === this.state) && (this.buffer += "\n\n", this.parse()), "INITIAL" === this.state) throw new Fi(Fi.Errors.BadSignature) } catch (e) { this.reportOrThrowError(e) } return this.onflush && this.onflush(), this } }; var ir = tr, rr = Object.freeze({ default: ir, __moduleExports: ir }), nr = "auto", ar = { "": 1, lr: 1, rl: 1 }, sr = { start: 1, middle: 1, end: 1, left: 1, right: 1 }; function or(e) { return "string" == typeof e && (!!sr[e.toLowerCase()] && e.toLowerCase()) } function ur(e, t, i) { this.hasBeenReset = !1; var r = "", n = !1, a = e, s = t, o = i, u = null, l = "", d = !0, c = "auto", h = "start", f = 50, p = "middle", m = 50, g = "middle"; Object.defineProperties(this, { id: { enumerable: !0, get: function() { return r }, set: function(e) { r = "" + e } }, pauseOnExit: { enumerable: !0, get: function() { return n }, set: function(e) { n = !!e } }, startTime: { enumerable: !0, get: function() { return a }, set: function(e) { if ("number" != typeof e) throw new TypeError("Start time must be set to a number."); a = e, this.hasBeenReset = !0 } }, endTime: { enumerable: !0, get: function() { return s }, set: function(e) { if ("number" != typeof e) throw new TypeError("End time must be set to a number."); s = e, this.hasBeenReset = !0 } }, text: { enumerable: !0, get: function() { return o }, set: function(e) { o = "" + e, this.hasBeenReset = !0 } }, region: { enumerable: !0, get: function() { return u }, set: function(e) { u = e, this.hasBeenReset = !0 } }, vertical: { enumerable: !0, get: function() { return l }, set: function(e) { var t = function(e) { return "string" == typeof e && !!ar[e.toLowerCase()] && e.toLowerCase() }(e); if (!1 === t) throw new SyntaxError("An invalid or illegal string was specified."); l = t, this.hasBeenReset = !0 } }, snapToLines: { enumerable: !0, get: function() { return d }, set: function(e) { d = !!e, this.hasBeenReset = !0 } }, line: { enumerable: !0, get: function() { return c }, set: function(e) { if ("number" != typeof e && e !== nr) throw new SyntaxError( "An invalid number or illegal string was specified."); c = e, this.hasBeenReset = !0 } }, lineAlign: { enumerable: !0, get: function() { return h }, set: function(e) { var t = or(e); if (!t) throw new SyntaxError("An invalid or illegal string was specified."); h = t, this.hasBeenReset = !0 } }, position: { enumerable: !0, get: function() { return f }, set: function(e) { if (e < 0 || e > 100) throw new Error("Position must be between 0 and 100."); f = e, this.hasBeenReset = !0 } }, positionAlign: { enumerable: !0, get: function() { return p }, set: function(e) { var t = or(e); if (!t) throw new SyntaxError("An invalid or illegal string was specified."); p = t, this.hasBeenReset = !0 } }, size: { enumerable: !0, get: function() { return m }, set: function(e) { if (e < 0 || e > 100) throw new Error("Size must be between 0 and 100."); m = e, this.hasBeenReset = !0 } }, align: { enumerable: !0, get: function() { return g }, set: function(e) { var t = or(e); if (!t) throw new SyntaxError("An invalid or illegal string was specified."); g = t, this.hasBeenReset = !0 } } }), this.displayState = void 0 } ur.prototype.getCueAsHTML = function() { return WebVTT.convertCueToDOMTree(window, this.text) }; var lr = ur, dr = Object.freeze({ default: lr, __moduleExports: lr }), cr = { "": !0, up: !0 }; function hr(e) { return "number" == typeof e && e >= 0 && e <= 100 } var fr = function() { var e = 100, t = 3, i = 0, r = 100, n = 0, a = 100, s = ""; Object.defineProperties(this, { width: { enumerable: !0, get: function() { return e }, set: function(t) { if (!hr(t)) throw new Error("Width must be between 0 and 100."); e = t } }, lines: { enumerable: !0, get: function() { return t }, set: function(e) { if ("number" != typeof e) throw new TypeError("Lines must be set to a number."); t = e } }, regionAnchorY: { enumerable: !0, get: function() { return r }, set: function(e) { if (!hr(e)) throw new Error("RegionAnchorX must be between 0 and 100."); r = e } }, regionAnchorX: { enumerable: !0, get: function() { return i }, set: function(e) { if (!hr(e)) throw new Error("RegionAnchorY must be between 0 and 100."); i = e } }, viewportAnchorY: { enumerable: !0, get: function() { return a }, set: function(e) { if (!hr(e)) throw new Error("ViewportAnchorY must be between 0 and 100."); a = e } }, viewportAnchorX: { enumerable: !0, get: function() { return n }, set: function(e) { if (!hr(e)) throw new Error("ViewportAnchorX must be between 0 and 100."); n = e } }, scroll: { enumerable: !0, get: function() { return s }, set: function(e) { var t = function(e) { return "string" == typeof e && !!cr[e.toLowerCase()] && e.toLowerCase() }(e); if (!1 === t) throw new SyntaxError("An invalid or illegal string was specified."); s = t } } }) }, pr = Object.freeze({ default: fr, __moduleExports: fr }), mr = rr && ir || rr, gr = dr && lr || dr, vr = pr && fr || pr, yr = i(function(e) { var t = e.exports = { WebVTT: mr, VTTCue: gr, VTTRegion: vr }; n.vttjs = t, n.WebVTT = t.WebVTT; var i = t.VTTCue, r = t.VTTRegion, a = n.VTTCue, s = n.VTTRegion; t.shim = function() { n.VTTCue = i, n.VTTRegion = r }, t.restore = function() { n.VTTCue = a, n.VTTRegion = s }, n.VTTCue || t.shim() }); yr.WebVTT, yr.VTTCue, yr.VTTRegion; var _r = function(e) { function t() { var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function() {}; y(this, t), i.reportTouchActivity = !1; var n = b(this, e.call(this, null, i, r)); return n.hasStarted_ = !1, n.on("playing", function() { this.hasStarted_ = !0 }), n.on("loadstart", function() { this.hasStarted_ = !1 }), Ni.names.forEach(function(e) { var t = Ni[e]; i && i[t.getterName] && (n[t.privateName] = i[t.getterName]) }), n.featuresProgressEvents || n.manualProgressOn(), n.featuresTimeupdateEvents || n.manualTimeUpdatesOn(), ["Text", "Audio", "Video"].forEach(function(e) { !1 === i["native" + e + "Tracks"] && (n["featuresNative" + e + "Tracks"] = !1) }), !1 === i.nativeCaptions || !1 === i.nativeTextTracks ? n.featuresNativeTextTracks = !1 : !0 !== i .nativeCaptions && !0 !== i.nativeTextTracks || (n.featuresNativeTextTracks = !0), n .featuresNativeTextTracks || n.emulateTextTracks(), n.autoRemoteTextTracks_ = new Ni.text.ListClass, n .initTrackListeners(), i.nativeControlsForTouch || n.emitTapEvents(), n.constructor && (n.name_ = n .constructor.name || "Unknown Tech"), n } return _(t, e), t.prototype.triggerSourceset = function(e) { var t = this; this.isReady_ || this.one("ready", function() { return t.setTimeout(function() { return t.triggerSourceset(e) }, 1) }), this.trigger({ src: e, type: "sourceset" }) }, t.prototype.manualProgressOn = function() { this.on("durationchange", this.onDurationChange), this.manualProgress = !0, this.one("ready", this .trackProgress) }, t.prototype.manualProgressOff = function() { this.manualProgress = !1, this.stopTrackingProgress(), this.off("durationchange", this.onDurationChange) }, t.prototype.trackProgress = function(e) { this.stopTrackingProgress(), this.progressInterval = this.setInterval(De(this, function() { var e = this.bufferedPercent(); this.bufferedPercent_ !== e && this.trigger("progress"), this.bufferedPercent_ = e, 1 === e && this .stopTrackingProgress() }), 500) }, t.prototype.onDurationChange = function(e) { this.duration_ = this.duration() }, t.prototype.buffered = function() { return _t(0, 0) }, t.prototype.bufferedPercent = function() { return bt(this.buffered(), this.duration_) }, t.prototype.stopTrackingProgress = function() { this.clearInterval(this.progressInterval) }, t.prototype.manualTimeUpdatesOn = function() { this.manualTimeUpdates = !0, this.on("play", this.trackCurrentTime), this.on("pause", this .stopTrackingCurrentTime) }, t.prototype.manualTimeUpdatesOff = function() { this.manualTimeUpdates = !1, this.stopTrackingCurrentTime(), this.off("play", this.trackCurrentTime), this .off("pause", this.stopTrackingCurrentTime) }, t.prototype.trackCurrentTime = function() { this.currentTimeInterval && this.stopTrackingCurrentTime(), this.currentTimeInterval = this.setInterval( function() { this.trigger({ type: "timeupdate", target: this, manuallyTriggered: !0 }) }, 250) }, t.prototype.stopTrackingCurrentTime = function() { this.clearInterval(this.currentTimeInterval), this.trigger({ type: "timeupdate", target: this, manuallyTriggered: !0 }) }, t.prototype.dispose = function() { this.clearTracks(Pi.names), this.manualProgress && this.manualProgressOff(), this.manualTimeUpdates && this .manualTimeUpdatesOff(), e.prototype.dispose.call(this) }, t.prototype.clearTracks = function(e) { var t = this; (e = [].concat(e)).forEach(function(e) { for (var i = t[e + "Tracks"]() || [], r = i.length; r--;) { var n = i[r]; "text" === e && t.removeRemoteTextTrack(n), i.removeTrack(n) } }) }, t.prototype.cleanupAutoTextTracks = function() { for (var e = this.autoRemoteTextTracks_ || [], t = e.length; t--;) { var i = e[t]; this.removeRemoteTextTrack(i) } }, t.prototype.reset = function() {}, t.prototype.error = function(e) { return void 0 !== e && (this.error_ = new Rt(e), this.trigger("error")), this.error_ }, t.prototype.played = function() { return this.hasStarted_ ? _t(0, 0) : _t() }, t.prototype.setCurrentTime = function() { this.manualTimeUpdates && this.trigger({ type: "timeupdate", target: this, manuallyTriggered: !0 }) }, t.prototype.initTrackListeners = function() { var e = this; Pi.names.forEach(function(t) { var i = Pi[t], r = function() { e.trigger(t + "trackchange") }, n = e[i.getterName](); n.addEventListener("removetrack", r), n.addEventListener("addtrack", r), e.on("dispose", function() { n.removeEventListener("removetrack", r), n.removeEventListener("addtrack", r) }) }) }, t.prototype.addWebVttScript_ = function() { var e = this; if (!n.WebVTT) if (l.body.contains(this.el())) { if (!this.options_["vtt.js"] && R(yr) && Object.keys(yr).length > 0) return void this.trigger( "vttjsloaded"); var t = l.createElement("script"); t.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js", t.onload = function() { e.trigger("vttjsloaded") }, t.onerror = function() { e.trigger("vttjserror") }, this.on("dispose", function() { t.onload = null, t.onerror = null }), n.WebVTT = !0, this.el().parentNode.appendChild(t) } else this.ready(this.addWebVttScript_) }, t.prototype.emulateTextTracks = function() { var e = this, t = this.textTracks(), i = this.remoteTextTracks(), r = function(e) { return t.addTrack(e.track) }, n = function(e) { return t.removeTrack(e.track) }; i.on("addtrack", r), i.on("removetrack", n), this.addWebVttScript_(); var a = function() { return e.trigger("texttrackchange") }, s = function() { a(); for (var e = 0; e < t.length; e++) { var i = t[e]; i.removeEventListener("cuechange", a), "showing" === i.mode && i.addEventListener("cuechange", a) } }; s(), t.addEventListener("change", s), t.addEventListener("addtrack", s), t.addEventListener("removetrack", s), this.on("dispose", function() { i.off("addtrack", r), i.off("removetrack", n), t.removeEventListener("change", s), t .removeEventListener("addtrack", s), t.removeEventListener("removetrack", s); for (var e = 0; e < t.length; e++) { t[e].removeEventListener("cuechange", a) } }) }, t.prototype.addTextTrack = function(e, t, i) { if (!e) throw new Error("TextTrack kind is required but was not provided"); return function(e, t, i, r) { var n = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {}, a = e.textTracks(); n.kind = t, i && (n.label = i), r && (n.language = r), n.tech = e; var s = new Ni.text.TrackClass(n); return a.addTrack(s), s }(this, e, t, i) }, t.prototype.createRemoteTextTrack = function(e) { var t = Ke(e, { tech: this }); return new Ui.remoteTextEl.TrackClass(t) }, t.prototype.addRemoteTextTrack = function() { var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = arguments[1], r = this.createRemoteTextTrack(t); return !0 !== i && !1 !== i && (p.warn( 'Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js' ), i = !0), this.remoteTextTrackEls().addTrackElement_(r), this.remoteTextTracks().addTrack(r.track), ! 0 !== i && this.ready(function() { return e.autoRemoteTextTracks_.addTrack(r.track) }), r }, t.prototype.removeRemoteTextTrack = function(e) { var t = this.remoteTextTrackEls().getTrackElementByTrack_(e); this.remoteTextTrackEls().removeTrackElement_(t), this.remoteTextTracks().removeTrack(e), this .autoRemoteTextTracks_.removeTrack(e) }, t.prototype.getVideoPlaybackQuality = function() { return {} }, t.prototype.setPoster = function() {}, t.prototype.playsinline = function() {}, t.prototype .setPlaysinline = function() {}, t.prototype.overrideNativeAudioTracks = function() {}, t.prototype .overrideNativeVideoTracks = function() {}, t.prototype.canPlayType = function() { return "" }, t.canPlayType = function() { return "" }, t.canPlaySource = function(e, i) { return t.canPlayType(e.type) }, t.isTech = function(e) { return e.prototype instanceof t || e instanceof t || e === t }, t.registerTech = function(e, i) { if (t.techs_ || (t.techs_ = {}), !t.isTech(i)) throw new Error("Tech " + e + " must be a Tech"); if (!t.canPlayType) throw new Error("Techs must have a static canPlayType method on them"); if (!t.canPlaySource) throw new Error("Techs must have a static canPlaySource method on them"); return e = ze(e), t.techs_[e] = i, "Tech" !== e && t.defaultTechOrder_.push(e), i }, t.getTech = function(e) { if (e) return e = ze(e), t.techs_ && t.techs_[e] ? t.techs_[e] : n && n.videojs && n.videojs[e] ? (p.warn( "The " + e + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)" ), n.videojs[e]) : void 0 }, t }(Ye); Ni.names.forEach(function(e) { var t = Ni[e]; _r.prototype[t.getterName] = function() { return this[t.privateName] = this[t.privateName] || new t.ListClass, this[t.privateName] } }), _r.prototype.featuresVolumeControl = !0, _r.prototype.featuresMuteControl = !0, _r.prototype .featuresFullscreenResize = !1, _r.prototype.featuresPlaybackRate = !1, _r.prototype.featuresProgressEvents = !1, _r.prototype.featuresSourceset = !1, _r.prototype.featuresTimeupdateEvents = !1, _r.prototype .featuresNativeTextTracks = !1, _r.withSourceHandlers = function(e) { e.registerSourceHandler = function(t, i) { var r = e.sourceHandlers; r || (r = e.sourceHandlers = []), void 0 === i && (i = r.length), r.splice(i, 0, t) }, e.canPlayType = function(t) { for (var i = e.sourceHandlers || [], r = void 0, n = 0; n < i.length; n++) if (r = i[n].canPlayType(t)) return r; return "" }, e.selectSourceHandler = function(t, i) { for (var r = e.sourceHandlers || [], n = 0; n < r.length; n++) if (r[n].canHandleSource(t, i)) return r[n]; return null }, e.canPlaySource = function(t, i) { var r = e.selectSourceHandler(t, i); return r ? r.canHandleSource(t, i) : "" }; ["seekable", "seeking", "duration"].forEach(function(e) { var t = this[e]; "function" == typeof t && (this[e] = function() { return this.sourceHandler_ && this.sourceHandler_[e] ? this.sourceHandler_[e].apply(this .sourceHandler_, arguments) : t.apply(this, arguments) }) }, e.prototype), e.prototype.setSource = function(t) { var i = e.selectSourceHandler(t, this.options_); i || (e.nativeSourceHandler ? i = e.nativeSourceHandler : p.error( "No source handler found for the current source.")), this.disposeSourceHandler(), this.off("dispose", this.disposeSourceHandler), i !== e.nativeSourceHandler && (this.currentSource_ = t), this .sourceHandler_ = i.handleSource(t, this, this.options_), this.on("dispose", this.disposeSourceHandler) }, e.prototype.disposeSourceHandler = function() { this.currentSource_ && (this.clearTracks(["audio", "video"]), this.currentSource_ = null), this .cleanupAutoTextTracks(), this.sourceHandler_ && (this.sourceHandler_.dispose && this.sourceHandler_ .dispose(), this.sourceHandler_ = null) } }, Ye.registerComponent("Tech", _r), _r.registerTech("Tech", _r), _r.defaultTechOrder_ = []; var br = {}, wr = {}, Er = {}; function Tr(e, t, i) { e.setTimeout(function() { return function e() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : []; var r = arguments[2]; var n = arguments[3]; var a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : []; var s = arguments.length > 5 && void 0 !== arguments[5] && arguments[5]; var o = i[0], u = i.slice(1); if ("string" == typeof o) e(t, br[o], r, n, a, s); else if (o) { var l = function(e, t) { var i = wr[e.id()], r = null; if (void 0 === i || null === i) return r = t(e), wr[e.id()] = [ [t, r] ], r; for (var n = 0; n < i.length; n++) { var a = i[n], s = a[0], o = a[1]; s === t && (r = o) } null === r && (r = t(e), i.push([t, r])); return r }(n, o); if (!l.setSource) return a.push(l), e(t, u, r, n, a, s); l.setSource(A({}, t), function(i, o) { if (i) return e(t, u, r, n, a, s); a.push(l), e(o, t.type === o.type ? u : br[o.type], r, n, a, s) }) } else u.length ? e(t, u, r, n, a, s) : s ? r(t, a) : e(t, br["*"], r, n, a, !0) }(t, br[t.type], i, e) }, 1) } function Sr(e, t, i) { var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, n = "call" + ze(i), a = e.reduce(Mr(n), r), s = a === Er, o = s ? null : t[i](a); return function(e, t, i, r) { for (var n = e.length - 1; n >= 0; n--) { var a = e[n]; a[t] && a[t](r, i) } }(e, i, o, s), o } var Ar = { buffered: 1, currentTime: 1, duration: 1, seekable: 1, played: 1, paused: 1 }, kr = { setCurrentTime: 1 }, Rr = { play: 1, pause: 1 }; function Mr(e) { return function(t, i) { return t === Er ? Er : i[e] ? i[e](t) : t } } var Or = { opus: "video/ogg", ogv: "video/ogg", mp4: "video/mp4", mov: "video/mp4", m4v: "video/mp4", mkv: "video/x-matroska", mp3: "audio/mpeg", aac: "audio/aac", oga: "audio/ogg", m3u8: "application/x-mpegURL" }, Cr = function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", t = $t(e); return Or[t.toLowerCase()] || "" }; function Dr(e) { var t = Cr(e.src); return !e.type && t && (e.type = t), e } var Ir = function(e) { function t(i, r, n) { y(this, t); var a = Ke({ createEl: !1 }, r), s = b(this, e.call(this, i, a, n)); if (r.playerOptions.sources && 0 !== r.playerOptions.sources.length) i.src(r.playerOptions.sources); else for (var o = 0, u = r.playerOptions.techOrder; o < u.length; o++) { var l = ze(u[o]), d = _r.getTech(l); if (l || (d = Ye.getComponent(l)), d && d.isSupported()) { i.loadTech_(l); break } } return s } return _(t, e), t }(Ye); Ye.registerComponent("MediaLoader", Ir); var Lr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.emitTapEvents(), n.enable(), n } return _(t, e), t.prototype.createEl = function() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "div", i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; i = A({ innerHTML: '', className: this.buildCSSClass(), tabIndex: 0 }, i), "button" === t && p.error("Creating a ClickableComponent with an HTML element of " + t + " is not supported; use a Button instead."), r = A({ role: "button" }, r), this.tabIndex_ = i.tabIndex; var n = e.prototype.createEl.call(this, t, i, r); return this.createControlTextEl(n), n }, t.prototype.dispose = function() { this.controlTextEl_ = null, e.prototype.dispose.call(this) }, t.prototype.createControlTextEl = function(e) { return this.controlTextEl_ = U("span", { className: "vjs-control-text" }, { "aria-live": "polite" }), e && e.appendChild(this.controlTextEl_), this.controlText(this.controlText_, e), this.controlTextEl_ }, t.prototype.controlText = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.el(); if (void 0 === e) return this.controlText_ || "Need Text"; var i = this.localize(e); this.controlText_ = e, N(this.controlTextEl_, i), this.nonIconControl || t.setAttribute("title", i) }, t.prototype.buildCSSClass = function() { return "vjs-control vjs-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.enable = function() { this.enabled_ || (this.enabled_ = !0, this.removeClass("vjs-disabled"), this.el_.setAttribute( "aria-disabled", "false"), void 0 !== this.tabIndex_ && this.el_.setAttribute("tabIndex", this .tabIndex_), this.on(["tap", "click"], this.handleClick), this.on("focus", this.handleFocus), this.on( "blur", this.handleBlur)) }, t.prototype.disable = function() { this.enabled_ = !1, this.addClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "true"), void 0 !== this.tabIndex_ && this.el_.removeAttribute("tabIndex"), this.off(["tap", "click"], this .handleClick), this.off("focus", this.handleFocus), this.off("blur", this.handleBlur) }, t.prototype.handleClick = function(e) {}, t.prototype.handleFocus = function(e) { be(l, "keydown", De(this, this.handleKeyPress)) }, t.prototype.handleKeyPress = function(t) { 32 === t.which || 13 === t.which ? (t.preventDefault(), this.trigger("click")) : e.prototype .handleKeyPress && e.prototype.handleKeyPress.call(this, t) }, t.prototype.handleBlur = function(e) { we(l, "keydown", De(this, this.handleKeyPress)) }, t }(Ye); Ye.registerComponent("ClickableComponent", Lr); var xr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.update(), i.on("posterchange", De(n, n.update)), n } return _(t, e), t.prototype.dispose = function() { this.player().off("posterchange", this.update), e.prototype.dispose.call(this) }, t.prototype.createEl = function() { return U("div", { className: "vjs-poster", tabIndex: -1 }) }, t.prototype.update = function(e) { var t = this.player().poster(); this.setSrc(t), t ? this.show() : this.hide() }, t.prototype.setSrc = function(e) { var t = ""; e && (t = 'url("' + e + '")'), this.el_.style.backgroundImage = t }, t.prototype.handleClick = function(e) { this.player_.controls() && (this.player_.paused() ? Dt(this.player_.play()) : this.player_.pause()) }, t }(Lr); Ye.registerComponent("PosterImage", xr); var Pr = { monospace: "monospace", sansSerif: "sans-serif", serif: "serif", monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace', monospaceSerif: '"Courier New", monospace', proportionalSansSerif: "sans-serif", proportionalSerif: "serif", casual: '"Comic Sans MS", Impact, fantasy', script: '"Monotype Corsiva", cursive', smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif' }; function Ur(e, t) { var i = void 0; if (4 === e.length) i = e[1] + e[1] + e[2] + e[2] + e[3] + e[3]; else { if (7 !== e.length) throw new Error("Invalid color code provided, " + e + "; must be formatted as e.g. #f0e or #f604e2."); i = e.slice(1) } return "rgba(" + parseInt(i.slice(0, 2), 16) + "," + parseInt(i.slice(2, 4), 16) + "," + parseInt(i.slice(4, 6), 16) + "," + t + ")" } function Nr(e, t, i) { try { e.style[t] = i } catch (e) { return } } var Br = function(e) { function t(i, r, a) { y(this, t); var s = b(this, e.call(this, i, r, a)), o = De(s, s.updateDisplay); return i.on("loadstart", De(s, s.toggleDisplay)), i.on("texttrackchange", o), i.on("loadstart", De(s, s .preselectTrack)), i.ready(De(s, function() { if (i.tech_ && i.tech_.featuresNativeTextTracks) this.hide(); else { i.on("fullscreenchange", o), i.on("playerresize", o), n.addEventListener("orientationchange", o), i .on("dispose", function() { return n.removeEventListener("orientationchange", o) }); for (var e = this.options_.playerOptions.tracks || [], t = 0; t < e.length; t++) this.player_ .addRemoteTextTrack(e[t], !0); this.preselectTrack() } })), s } return _(t, e), t.prototype.preselectTrack = function() { for (var e = { captions: 1, subtitles: 1 }, t = this.player_.textTracks(), i = this.player_.cache_.selectedLanguage, r = void 0, n = void 0, a = void 0, s = 0; s < t.length; s++) { var o = t[s]; i && i.enabled && i.language === o.language ? o.kind === i.kind ? a = o : a || (a = o) : i && !i.enabled ? (a = null, r = null, n = null) : o.default && ("descriptions" !== o.kind || r ? o.kind in e && !n && ( n = o) : r = o) } a ? a.mode = "showing" : n ? n.mode = "showing" : r && (r.mode = "showing") }, t.prototype.toggleDisplay = function() { this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks ? this.hide() : this.show() }, t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-text-track-display" }, { "aria-live": "off", "aria-atomic": "true" }) }, t.prototype.clearDisplay = function() { "function" == typeof n.WebVTT && n.WebVTT.processCues(n, [], this.el_) }, t.prototype.updateDisplay = function() { var e = this.player_.textTracks(); this.clearDisplay(); for (var t = null, i = null, r = e.length; r--;) { var n = e[r]; "showing" === n.mode && ("descriptions" === n.kind ? t = n : i = n) } i ? ("off" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "off"), this.updateForTrack( i)) : t && ("assertive" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "assertive"), this.updateForTrack(t)) }, t.prototype.updateForTrack = function(e) { if ("function" == typeof n.WebVTT && e.activeCues) { for (var t = [], i = 0; i < e.activeCues.length; i++) t.push(e.activeCues[i]); if (n.WebVTT.processCues(n, t, this.el_), this.player_.textTrackSettings) for (var r = this.player_.textTrackSettings.getValues(), a = t.length; a--;) { var s = t[a]; if (s) { var o = s.displayState; if (r.color && (o.firstChild.style.color = r.color), r.textOpacity && Nr(o.firstChild, "color", Ur(r .color || "#fff", r.textOpacity)), r.backgroundColor && (o.firstChild.style.backgroundColor = r .backgroundColor), r.backgroundOpacity && Nr(o.firstChild, "backgroundColor", Ur(r .backgroundColor || "#000", r.backgroundOpacity)), r.windowColor && (r.windowOpacity ? Nr(o, "backgroundColor", Ur(r.windowColor, r.windowOpacity)) : o.style.backgroundColor = r .windowColor), r.edgeStyle && ("dropshadow" === r.edgeStyle ? o.firstChild.style.textShadow = "2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222" : "raised" === r.edgeStyle ? o.firstChild .style.textShadow = "1px 1px #222, 2px 2px #222, 3px 3px #222" : "depressed" === r.edgeStyle ? o .firstChild.style.textShadow = "1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222" : "uniform" === r.edgeStyle && (o.firstChild.style.textShadow = "0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")), r.fontPercent && 1 !== r .fontPercent) { var u = n.parseFloat(o.style.fontSize); o.style.fontSize = u * r.fontPercent + "px", o.style.height = "auto", o.style.top = "auto", o .style.bottom = "2px" } r.fontFamily && "default" !== r.fontFamily && ("small-caps" === r.fontFamily ? o.firstChild.style .fontVariant = "small-caps" : o.firstChild.style.fontFamily = Pr[r.fontFamily]) } } } }, t }(Ye); Ye.registerComponent("TextTrackDisplay", Br); var Fr = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function() { var t = this.player_.isAudio(), i = this.localize(t ? "Audio Player" : "Video Player"), r = U("span", { className: "vjs-control-text", innerHTML: this.localize("{1} is loading.", [i]) }), n = e.prototype.createEl.call(this, "div", { className: "vjs-loading-spinner", dir: "ltr" }); return n.appendChild(r), n }, t }(Ye); Ye.registerComponent("LoadingSpinner", Fr); var jr = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; t = A({ innerHTML: '', className: this.buildCSSClass() }, t), i = A({ type: "button" }, i); var r = Ye.prototype.createEl.call(this, "button", t, i); return this.createControlTextEl(r), r }, t.prototype.addChild = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = this.constructor.name; return p.warn("Adding an actionable (user controllable) child to a Button (" + i + ") is not supported; use a ClickableComponent instead."), Ye.prototype.addChild.call(this, e, t) }, t.prototype.enable = function() { e.prototype.enable.call(this), this.el_.removeAttribute("disabled") }, t.prototype.disable = function() { e.prototype.disable.call(this), this.el_.setAttribute("disabled", "disabled") }, t.prototype.handleKeyPress = function(t) { 32 !== t.which && 13 !== t.which && e.prototype.handleKeyPress.call(this, t) }, t }(Lr); Ye.registerComponent("Button", jr); var Hr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.mouseused_ = !1, n.on("mousedown", n.handleMouseDown), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-big-play-button" }, t.prototype.handleClick = function(e) { var t = this.player_.play(); if (this.mouseused_ && e.clientX && e.clientY) Dt(t); else { var i = this.player_.getChild("controlBar"), r = i && i.getChild("playToggle"); if (r) { var n = function() { return r.focus() }; Ct(t) ? t.then(n, function() {}) : this.setTimeout(n, 1) } else this.player_.focus() } }, t.prototype.handleKeyPress = function(t) { this.mouseused_ = !1, e.prototype.handleKeyPress.call(this, t) }, t.prototype.handleMouseDown = function(e) { this.mouseused_ = !0 }, t }(jr); Hr.prototype.controlText_ = "Play Video", Ye.registerComponent("BigPlayButton", Hr); var Gr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.controlText(r && r.controlText || n.localize("Close")), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-close-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.handleClick = function(e) { this.trigger({ type: "close", bubbles: !1 }) }, t }(jr); Ye.registerComponent("CloseButton", Gr); var Vr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.on(i, "play", n.handlePlay), n.on(i, "pause", n.handlePause), n.on(i, "ended", n.handleEnded), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-play-control " + e.prototype.buildCSSClass.call(this) }, t.prototype.handleClick = function(e) { this.player_.paused() ? this.player_.play() : this.player_.pause() }, t.prototype.handleSeeked = function(e) { this.removeClass("vjs-ended"), this.player_.paused() ? this.handlePause(e) : this.handlePlay(e) }, t.prototype.handlePlay = function(e) { this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this .controlText("Pause") }, t.prototype.handlePause = function(e) { this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.controlText("Play") }, t.prototype.handleEnded = function(e) { this.removeClass("vjs-playing"), this.addClass("vjs-ended"), this.controlText("Replay"), this.one(this .player_, "seeked", this.handleSeeked) }, t }(jr); Vr.prototype.controlText_ = "Play", Ye.registerComponent("PlayToggle", Vr); var Wr = function(e, t) { e = e < 0 ? 0 : e; var i = Math.floor(e % 60), r = Math.floor(e / 60 % 60), n = Math.floor(e / 3600), a = Math.floor(t / 60 % 60), s = Math.floor(t / 3600); return (isNaN(e) || e === 1 / 0) && (n = r = i = "-"), (n = n > 0 || s > 0 ? n + ":" : "") + (r = ((n || a >= 10) && r < 10 ? "0" + r : r) + ":") + (i = i < 10 ? "0" + i : i) }, qr = Wr; function Xr(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e; return qr(e, t) } var zr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.throttledUpdateContent = Ie(De(n, n.updateContent), 25), n.on(i, "timeupdate", n .throttledUpdateContent), n } return _(t, e), t.prototype.createEl = function(t) { var i = this.buildCSSClass(), r = e.prototype.createEl.call(this, "div", { className: i + " vjs-time-control vjs-control", innerHTML: '' + this.localize(this.labelText_) + " " }); return this.contentEl_ = U("span", { className: i + "-display" }, { "aria-live": "off" }), this.updateTextNode_(), r.appendChild(this.contentEl_), r }, t.prototype.dispose = function() { this.contentEl_ = null, this.textNode_ = null, e.prototype.dispose.call(this) }, t.prototype.updateTextNode_ = function() { if (this.contentEl_) { for (; this.contentEl_.firstChild;) this.contentEl_.removeChild(this.contentEl_.firstChild); this.textNode_ = l.createTextNode(this.formattedTime_ || this.formatTime_(0)), this.contentEl_ .appendChild(this.textNode_) } }, t.prototype.formatTime_ = function(e) { return Xr(e) }, t.prototype.updateFormattedTime_ = function(e) { var t = this.formatTime_(e); t !== this.formattedTime_ && (this.formattedTime_ = t, this.requestAnimationFrame(this.updateTextNode_)) }, t.prototype.updateContent = function(e) {}, t }(Ye); zr.prototype.labelText_ = "Time", zr.prototype.controlText_ = "Time", Ye.registerComponent("TimeDisplay", zr); var Kr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.on(i, "ended", n.handleEnded), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-current-time" }, t.prototype.updateContent = function(e) { var t = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime(); this.updateFormattedTime_(t) }, t.prototype.handleEnded = function(e) { this.player_.duration() && this.updateFormattedTime_(this.player_.duration()) }, t }(zr); Kr.prototype.labelText_ = "Current Time", Kr.prototype.controlText_ = "Current Time", Ye.registerComponent( "CurrentTimeDisplay", Kr); var Yr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.on(i, "durationchange", n.updateContent), n.on(i, "loadedmetadata", n.throttledUpdateContent), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-duration" }, t.prototype.updateContent = function(e) { var t = this.player_.duration(); t && this.duration_ !== t && (this.duration_ = t, this.updateFormattedTime_(t)) }, t }(zr); Yr.prototype.labelText_ = "Duration", Yr.prototype.controlText_ = "Duration", Ye.registerComponent( "DurationDisplay", Yr); var Qr = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-time-control vjs-time-divider", innerHTML: "
/
" }) }, t }(Ye); Ye.registerComponent("TimeDivider", Qr); var Jr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.on(i, "durationchange", n.throttledUpdateContent), n.on(i, "ended", n.handleEnded), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-remaining-time" }, t.prototype.formatTime_ = function(t) { return "-" + e.prototype.formatTime_.call(this, t) }, t.prototype.updateContent = function(e) { this.player_.duration() && (this.player_.remainingTimeDisplay ? this.updateFormattedTime_(this.player_ .remainingTimeDisplay()) : this.updateFormattedTime_(this.player_.remainingTime())) }, t.prototype.handleEnded = function(e) { this.player_.duration() && this.updateFormattedTime_(0) }, t }(zr); Jr.prototype.labelText_ = "Remaining Time", Jr.prototype.controlText_ = "Remaining Time", Ye.registerComponent( "RemainingTimeDisplay", Jr); var Zr = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.updateShowing(), n.on(n.player(), "durationchange", n.updateShowing), n } return _(t, e), t.prototype.createEl = function() { var t = e.prototype.createEl.call(this, "div", { className: "vjs-live-control vjs-control" }); return this.contentEl_ = U("div", { className: "vjs-live-display", innerHTML: '' + this.localize("Stream Type") + " " + this .localize("LIVE") }, { "aria-live": "off" }), t.appendChild(this.contentEl_), t }, t.prototype.dispose = function() { this.contentEl_ = null, e.prototype.dispose.call(this) }, t.prototype.updateShowing = function(e) { this.player().duration() === 1 / 0 ? this.show() : this.hide() }, t }(Ye); Ye.registerComponent("LiveDisplay", Zr); var $r = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.bar = n.getChild(n.options_.barName), n.vertical(!!n.options_.vertical), n.enable(), n } return _(t, e), t.prototype.enabled = function() { return this.enabled_ }, t.prototype.enable = function() { this.enabled() || (this.on("mousedown", this.handleMouseDown), this.on("touchstart", this.handleMouseDown), this.on("focus", this.handleFocus), this.on("blur", this.handleBlur), this.on("click", this .handleClick), this.on(this.player_, "controlsvisible", this.update), this.playerEvent && this.on(this .player_, this.playerEvent, this.update), this.removeClass("disabled"), this.setAttribute("tabindex", 0), this.enabled_ = !0) }, t.prototype.disable = function() { if (this.enabled()) { var e = this.bar.el_.ownerDocument; this.off("mousedown", this.handleMouseDown), this.off("touchstart", this.handleMouseDown), this.off( "focus", this.handleFocus), this.off("blur", this.handleBlur), this.off("click", this.handleClick), this.off(this.player_, "controlsvisible", this.update), this.off(e, "mousemove", this.handleMouseMove), this.off(e, "mouseup", this.handleMouseUp), this.off(e, "touchmove", this.handleMouseMove), this.off(e, "touchend", this.handleMouseUp), this.removeAttribute("tabindex"), this.addClass("disabled"), this .playerEvent && this.off(this.player_, this.playerEvent, this.update), this.enabled_ = !1 } }, t.prototype.createEl = function(t) { var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; return i.className = i.className + " vjs-slider", i = A({ tabIndex: 0 }, i), r = A({ role: "slider", "aria-valuenow": 0, "aria-valuemin": 0, "aria-valuemax": 100, tabIndex: 0 }, r), e.prototype.createEl.call(this, t, i, r) }, t.prototype.handleMouseDown = function(e) { var t = this.bar.el_.ownerDocument; "mousedown" === e.type && e.preventDefault(), "touchstart" !== e.type || dt || e.preventDefault(), K(), this .addClass("vjs-sliding"), this.trigger("slideractive"), this.on(t, "mousemove", this.handleMouseMove), this.on(t, "mouseup", this.handleMouseUp), this.on(t, "touchmove", this.handleMouseMove), this.on(t, "touchend", this.handleMouseUp), this.handleMouseMove(e) }, t.prototype.handleMouseMove = function(e) {}, t.prototype.handleMouseUp = function() { var e = this.bar.el_.ownerDocument; Y(), this.removeClass("vjs-sliding"), this.trigger("sliderinactive"), this.off(e, "mousemove", this .handleMouseMove), this.off(e, "mouseup", this.handleMouseUp), this.off(e, "touchmove", this .handleMouseMove), this.off(e, "touchend", this.handleMouseUp), this.update() }, t.prototype.update = function() { if (this.el_) { var e = this.getPercent(), t = this.bar; if (t) { ("number" != typeof e || e != e || e < 0 || e === 1 / 0) && (e = 0); var i = (100 * e).toFixed(2) + "%", r = t.el().style; return this.vertical() ? r.height = i : r.width = i, e } } }, t.prototype.calculateDistance = function(e) { var t = Z(this.el_, e); return this.vertical() ? t.y : t.x }, t.prototype.handleFocus = function() { this.on(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress) }, t.prototype.handleKeyPress = function(e) { 37 === e.which || 40 === e.which ? (e.preventDefault(), this.stepBack()) : 38 !== e.which && 39 !== e .which || (e.preventDefault(), this.stepForward()) }, t.prototype.handleBlur = function() { this.off(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress) }, t.prototype.handleClick = function(e) { e.stopImmediatePropagation(), e.preventDefault() }, t.prototype.vertical = function(e) { if (void 0 === e) return this.vertical_ || !1; this.vertical_ = !!e, this.vertical_ ? this.addClass("vjs-slider-vertical") : this.addClass( "vjs-slider-horizontal") }, t }(Ye); Ye.registerComponent("Slider", $r); var en = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.partEls_ = [], n.on(i, "progress", n.update), n } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-load-progress", innerHTML: '' + this.localize("Loaded") + ": 0%" }) }, t.prototype.dispose = function() { this.partEls_ = null, e.prototype.dispose.call(this) }, t.prototype.update = function(e) { var t = this.player_.buffered(), i = this.player_.duration(), r = this.player_.bufferedEnd(), n = this.partEls_, a = function(e, t) { var i = e / t || 0; return 100 * (i >= 1 ? 1 : i) + "%" }; this.el_.style.width = a(r, i); for (var s = 0; s < t.length; s++) { var o = t.start(s), u = t.end(s), l = n[s]; l || (l = this.el_.appendChild(U()), n[s] = l), l.style.left = a(o, r), l.style.width = a(u - o, r) } for (var d = n.length; d > t.length; d--) this.el_.removeChild(n[d - 1]); n.length = t.length }, t }(Ye); Ye.registerComponent("LoadProgressBar", en); var tn = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-time-tooltip" }) }, t.prototype.update = function(e, t, i) { var r = Q(this.el_), n = Q(this.player_.el()), a = e.width * t; if (n && r) { var s = e.left - n.left + a, o = e.width - a + (n.right - e.right), u = r.width / 2; s < u ? u += u - s : o < u && (u = o), u < 0 ? u = 0 : u > r.width && (u = r.width), this.el_.style .right = "-" + u + "px", N(this.el_, i) } }, t }(Ye); Ye.registerComponent("TimeTooltip", tn); var rn = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-play-progress vjs-slider-bar", innerHTML: '' + this.localize("Progress") + ": 0%" }) }, t.prototype.update = function(e, t) { var i = this; this.rafId_ && this.cancelAnimationFrame(this.rafId_), this.rafId_ = this.requestAnimationFrame(function() { var r = Xr(i.player_.scrubbing() ? i.player_.getCache().currentTime : i.player_.currentTime(), i .player_.duration()), n = i.getChild("timeTooltip"); n && n.update(e, t, r) }) }, t }(Ye); rn.prototype.options_ = { children: [] }, rt || at || rn.prototype.options_.children.push("timeTooltip"), Ye.registerComponent("PlayProgressBar", rn); var nn = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.update = Ie(De(n, n.update), 25), n } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-mouse-display" }) }, t.prototype.update = function(e, t) { var i = this; this.rafId_ && this.cancelAnimationFrame(this.rafId_), this.rafId_ = this.requestAnimationFrame(function() { var r = i.player_.duration(), n = Xr(t * r, r); i.el_.style.left = e.width * t + "px", i.getChild("timeTooltip").update(e, t, n) }) }, t }(Ye); nn.prototype.options_ = { children: ["timeTooltip"] }, Ye.registerComponent("MouseTimeDisplay", nn); var an = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.setEventHandlers_(), n } return _(t, e), t.prototype.setEventHandlers_ = function() { var e = this; this.update = Ie(De(this, this.update), 30), this.on(this.player_, "timeupdate", this.update), this.on(this .player_, "ended", this.handleEnded), this.updateInterval = null, this.on(this.player_, ["playing"], function() { e.clearInterval(e.updateInterval), e.updateInterval = e.setInterval(function() { e.requestAnimationFrame(function() { e.update() }) }, 30) }), this.on(this.player_, ["ended", "pause", "waiting"], function() { e.clearInterval(e.updateInterval) }), this.on(this.player_, ["timeupdate", "ended"], this.update) }, t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-progress-holder" }, { "aria-label": this.localize("Progress Bar") }) }, t.prototype.update_ = function(e, t) { var i = this.player_.duration(); this.el_.setAttribute("aria-valuenow", (100 * t).toFixed(2)), this.el_.setAttribute("aria-valuetext", this .localize("progress bar timing: currentTime={1} duration={2}", [Xr(e, i), Xr(i, i)], "{1} of {2}")), this.bar.update(Q(this.el_), t) }, t.prototype.update = function(t) { var i = e.prototype.update.call(this); return this.update_(this.getCurrentTime_(), i), i }, t.prototype.getCurrentTime_ = function() { return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime() }, t.prototype.handleEnded = function(e) { this.update_(this.player_.duration(), 1) }, t.prototype.getPercent = function() { var e = this.getCurrentTime_() / this.player_.duration(); return e >= 1 ? 1 : e || 0 }, t.prototype.handleMouseDown = function(t) { ne(t) && (t.stopPropagation(), this.player_.scrubbing(!0), this.videoWasPlaying = !this.player_.paused(), this.player_.pause(), e.prototype.handleMouseDown.call(this, t)) }, t.prototype.handleMouseMove = function(e) { if (ne(e)) { var t = this.calculateDistance(e) * this.player_.duration(); t === this.player_.duration() && (t -= .1), this.player_.currentTime(t) } }, t.prototype.enable = function() { e.prototype.enable.call(this); var t = this.getChild("mouseTimeDisplay"); t && t.show() }, t.prototype.disable = function() { e.prototype.disable.call(this); var t = this.getChild("mouseTimeDisplay"); t && t.hide() }, t.prototype.handleMouseUp = function(t) { e.prototype.handleMouseUp.call(this, t), t && t.stopPropagation(), this.player_.scrubbing(!1), this.player_ .trigger({ type: "timeupdate", target: this, manuallyTriggered: !0 }), this.videoWasPlaying && Dt(this.player_.play()) }, t.prototype.stepForward = function() { this.player_.currentTime(this.player_.currentTime() + 5) }, t.prototype.stepBack = function() { this.player_.currentTime(this.player_.currentTime() - 5) }, t.prototype.handleAction = function(e) { this.player_.paused() ? this.player_.play() : this.player_.pause() }, t.prototype.handleKeyPress = function(t) { 32 === t.which || 13 === t.which ? (t.preventDefault(), this.handleAction(t)) : e.prototype .handleKeyPress && e.prototype.handleKeyPress.call(this, t) }, t }($r); an.prototype.options_ = { children: ["loadProgressBar", "playProgressBar"], barName: "playProgressBar" }, rt || at || an.prototype.options_.children.splice(1, 0, "mouseTimeDisplay"), an.prototype.playerEvent = "timeupdate", Ye.registerComponent("SeekBar", an); var sn = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.handleMouseMove = Ie(De(n, n.handleMouseMove), 25), n.throttledHandleMouseSeek = Ie(De(n, n .handleMouseSeek), 25), n.enable(), n } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-progress-control vjs-control" }) }, t.prototype.handleMouseMove = function(e) { var t = this.getChild("seekBar"); if (t) { var i = t.getChild("mouseTimeDisplay"), r = t.el(), n = Q(r), a = Z(r, e).x; a > 1 ? a = 1 : a < 0 && (a = 0), i && i.update(n, a) } }, t.prototype.handleMouseSeek = function(e) { var t = this.getChild("seekBar"); t && t.handleMouseMove(e) }, t.prototype.enabled = function() { return this.enabled_ }, t.prototype.disable = function() { this.children().forEach(function(e) { return e.disable && e.disable() }), this.enabled() && (this.off(["mousedown", "touchstart"], this.handleMouseDown), this.off(this.el_, "mousemove", this.handleMouseMove), this.handleMouseUp(), this.addClass("disabled"), this.enabled_ = ! 1) }, t.prototype.enable = function() { this.children().forEach(function(e) { return e.enable && e.enable() }), this.enabled() || (this.on(["mousedown", "touchstart"], this.handleMouseDown), this.on(this.el_, "mousemove", this.handleMouseMove), this.removeClass("disabled"), this.enabled_ = !0) }, t.prototype.handleMouseDown = function(e) { var t = this.el_.ownerDocument, i = this.getChild("seekBar"); i && i.handleMouseDown(e), this.on(t, "mousemove", this.throttledHandleMouseSeek), this.on(t, "touchmove", this.throttledHandleMouseSeek), this.on(t, "mouseup", this.handleMouseUp), this.on(t, "touchend", this .handleMouseUp) }, t.prototype.handleMouseUp = function(e) { var t = this.el_.ownerDocument, i = this.getChild("seekBar"); i && i.handleMouseUp(e), this.off(t, "mousemove", this.throttledHandleMouseSeek), this.off(t, "touchmove", this.throttledHandleMouseSeek), this.off(t, "mouseup", this.handleMouseUp), this.off(t, "touchend", this .handleMouseUp) }, t }(Ye); sn.prototype.options_ = { children: ["seekBar"] }, Ye.registerComponent("ProgressControl", sn); var on = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.on(i, "fullscreenchange", n.handleFullscreenChange), !1 === l[wt.fullscreenEnabled] && n.disable(), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-fullscreen-control " + e.prototype.buildCSSClass.call(this) }, t.prototype.handleFullscreenChange = function(e) { this.player_.isFullscreen() ? this.controlText("Non-Fullscreen") : this.controlText("Fullscreen") }, t.prototype.handleClick = function(e) { this.player_.isFullscreen() ? this.player_.exitFullscreen() : this.player_.requestFullscreen() }, t }(jr); on.prototype.controlText_ = "Fullscreen", Ye.registerComponent("FullscreenToggle", on); var un = function(e, t) { t.tech_ && !t.tech_.featuresVolumeControl && e.addClass("vjs-hidden"), e.on(t, "loadstart", function() { t.tech_.featuresVolumeControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden") }) }, ln = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-volume-level", innerHTML: '' }) }, t }(Ye); Ye.registerComponent("VolumeLevel", ln); var dn = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.on("slideractive", n.updateLastVolume_), n.on(i, "volumechange", n.updateARIAAttributes), i.ready( function() { return n.updateARIAAttributes() }), n } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-volume-bar vjs-slider-bar" }, { "aria-label": this.localize("Volume Level"), "aria-live": "polite" }) }, t.prototype.handleMouseDown = function(t) { ne(t) && e.prototype.handleMouseDown.call(this, t) }, t.prototype.handleMouseMove = function(e) { ne(e) && (this.checkMuted(), this.player_.volume(this.calculateDistance(e))) }, t.prototype.checkMuted = function() { this.player_.muted() && this.player_.muted(!1) }, t.prototype.getPercent = function() { return this.player_.muted() ? 0 : this.player_.volume() }, t.prototype.stepForward = function() { this.checkMuted(), this.player_.volume(this.player_.volume() + .1) }, t.prototype.stepBack = function() { this.checkMuted(), this.player_.volume(this.player_.volume() - .1) }, t.prototype.updateARIAAttributes = function(e) { var t = this.player_.muted() ? 0 : this.volumeAsPercentage_(); this.el_.setAttribute("aria-valuenow", t), this.el_.setAttribute("aria-valuetext", t + "%") }, t.prototype.volumeAsPercentage_ = function() { return Math.round(100 * this.player_.volume()) }, t.prototype.updateLastVolume_ = function() { var e = this, t = this.player_.volume(); this.one("sliderinactive", function() { 0 === e.player_.volume() && e.player_.lastVolume_(t) }) }, t }($r); dn.prototype.options_ = { children: ["volumeLevel"], barName: "volumeLevel" }, dn.prototype.playerEvent = "volumechange", Ye.registerComponent("VolumeBar", dn); var cn = function(e) { function t(i) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; y(this, t), r.vertical = r.vertical || !1, (void 0 === r.volumeBar || R(r.volumeBar)) && (r.volumeBar = r .volumeBar || {}, r.volumeBar.vertical = r.vertical); var n = b(this, e.call(this, i, r)); return un(n, i), n.throttledHandleMouseMove = Ie(De(n, n.handleMouseMove), 25), n.on("mousedown", n .handleMouseDown), n.on("touchstart", n.handleMouseDown), n.on(n.volumeBar, ["focus", "slideractive"], function() { n.volumeBar.addClass("vjs-slider-active"), n.addClass("vjs-slider-active"), n.trigger("slideractive") }), n.on(n.volumeBar, ["blur", "sliderinactive"], function() { n.volumeBar.removeClass("vjs-slider-active"), n.removeClass("vjs-slider-active"), n.trigger( "sliderinactive") }), n } return _(t, e), t.prototype.createEl = function() { var t = "vjs-volume-horizontal"; return this.options_.vertical && (t = "vjs-volume-vertical"), e.prototype.createEl.call(this, "div", { className: "vjs-volume-control vjs-control " + t }) }, t.prototype.handleMouseDown = function(e) { var t = this.el_.ownerDocument; this.on(t, "mousemove", this.throttledHandleMouseMove), this.on(t, "touchmove", this .throttledHandleMouseMove), this.on(t, "mouseup", this.handleMouseUp), this.on(t, "touchend", this .handleMouseUp) }, t.prototype.handleMouseUp = function(e) { var t = this.el_.ownerDocument; this.off(t, "mousemove", this.throttledHandleMouseMove), this.off(t, "touchmove", this .throttledHandleMouseMove), this.off(t, "mouseup", this.handleMouseUp), this.off(t, "touchend", this .handleMouseUp) }, t.prototype.handleMouseMove = function(e) { this.volumeBar.handleMouseMove(e) }, t }(Ye); cn.prototype.options_ = { children: ["volumeBar"] }, Ye.registerComponent("VolumeControl", cn); var hn = function(e, t) { t.tech_ && !t.tech_.featuresMuteControl && e.addClass("vjs-hidden"), e.on(t, "loadstart", function() { t.tech_.featuresMuteControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden") }) }, fn = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return hn(n, i), n.on(i, ["loadstart", "volumechange"], n.update), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-mute-control " + e.prototype.buildCSSClass.call(this) }, t.prototype.handleClick = function(e) { var t = this.player_.volume(), i = this.player_.lastVolume_(); if (0 === t) { var r = i < .1 ? .1 : i; this.player_.volume(r), this.player_.muted(!1) } else this.player_.muted(!this.player_.muted()) }, t.prototype.update = function(e) { this.updateIcon_(), this.updateControlText_() }, t.prototype.updateIcon_ = function() { var e = this.player_.volume(), t = 3; rt && this.player_.muted(this.player_.tech_.el_.muted), 0 === e || this.player_.muted() ? t = 0 : e < .33 ? t = 1 : e < .67 && (t = 2); for (var i = 0; i < 4; i++) H(this.el_, "vjs-vol-" + i); j(this.el_, "vjs-vol-" + t) }, t.prototype.updateControlText_ = function() { var e = this.player_.muted() || 0 === this.player_.volume() ? "Unmute" : "Mute"; this.controlText() !== e && this.controlText(e) }, t }(jr); fn.prototype.controlText_ = "Mute", Ye.registerComponent("MuteToggle", fn); var pn = function(e) { function t(i) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; y(this, t), void 0 !== r.inline ? r.inline = r.inline : r.inline = !0, (void 0 === r.volumeControl || R(r .volumeControl)) && (r.volumeControl = r.volumeControl || {}, r.volumeControl.vertical = !r.inline); var n = b(this, e.call(this, i, r)); return n.on(i, ["loadstart"], n.volumePanelState_), n.on(n.volumeControl, ["slideractive"], n.sliderActive_), n.on(n.volumeControl, ["sliderinactive"], n.sliderInactive_), n } return _(t, e), t.prototype.sliderActive_ = function() { this.addClass("vjs-slider-active") }, t.prototype.sliderInactive_ = function() { this.removeClass("vjs-slider-active") }, t.prototype.volumePanelState_ = function() { this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden") && this.addClass( "vjs-hidden"), this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden") && this.addClass("vjs-mute-toggle-only") }, t.prototype.createEl = function() { var t = "vjs-volume-panel-horizontal"; return this.options_.inline || (t = "vjs-volume-panel-vertical"), e.prototype.createEl.call(this, "div", { className: "vjs-volume-panel vjs-control " + t }) }, t }(Ye); pn.prototype.options_ = { children: ["muteToggle", "volumeControl"] }, Ye.registerComponent("VolumePanel", pn); var mn = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return r && (n.menuButton_ = r.menuButton), n.focusedChild_ = -1, n.on("keydown", n.handleKeyPress), n } return _(t, e), t.prototype.addItem = function(e) { this.addChild(e), e.on("click", De(this, function(t) { this.menuButton_ && (this.menuButton_.unpressButton(), "CaptionSettingsMenuItem" !== e.name() && this.menuButton_.focus()) })) }, t.prototype.createEl = function() { var t = this.options_.contentElType || "ul"; this.contentEl_ = U(t, { className: "vjs-menu-content" }), this.contentEl_.setAttribute("role", "menu"); var i = e.prototype.createEl.call(this, "div", { append: this.contentEl_, className: "vjs-menu" }); return i.appendChild(this.contentEl_), be(i, "click", function(e) { e.preventDefault(), e.stopImmediatePropagation() }), i }, t.prototype.dispose = function() { this.contentEl_ = null, e.prototype.dispose.call(this) }, t.prototype.handleKeyPress = function(e) { 37 === e.which || 40 === e.which ? (e.preventDefault(), this.stepForward()) : 38 !== e.which && 39 !== e .which || (e.preventDefault(), this.stepBack()) }, t.prototype.stepForward = function() { var e = 0; void 0 !== this.focusedChild_ && (e = this.focusedChild_ + 1), this.focus(e) }, t.prototype.stepBack = function() { var e = 0; void 0 !== this.focusedChild_ && (e = this.focusedChild_ - 1), this.focus(e) }, t.prototype.focus = function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, t = this.children().slice(); t.length && t[0].className && /vjs-menu-title/.test(t[0].className) && t.shift(), t.length > 0 && (e < 0 ? e = 0 : e >= t.length && (e = t.length - 1), this.focusedChild_ = e, t[e].el_.focus()) }, t }(Ye); Ye.registerComponent("Menu", mn); var gn = function(e) { function t(i) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; y(this, t); var n = b(this, e.call(this, i, r)); n.menuButton_ = new jr(i, r), n.menuButton_.controlText(n.controlText_), n.menuButton_.el_.setAttribute( "aria-haspopup", "true"); var a = jr.prototype.buildCSSClass(); return n.menuButton_.el_.className = n.buildCSSClass() + " " + a, n.menuButton_.removeClass("vjs-control"), n .addChild(n.menuButton_), n.update(), n.enabled_ = !0, n.on(n.menuButton_, "tap", n.handleClick), n.on(n .menuButton_, "click", n.handleClick), n.on(n.menuButton_, "focus", n.handleFocus), n.on(n.menuButton_, "blur", n.handleBlur), n.on("keydown", n.handleSubmenuKeyPress), n } return _(t, e), t.prototype.update = function() { var e = this.createMenu(); this.menu && (this.menu.dispose(), this.removeChild(this.menu)), this.menu = e, this.addChild(e), this .buttonPressed_ = !1, this.menuButton_.el_.setAttribute("aria-expanded", "false"), this.items && this .items.length <= this.hideThreshold_ ? this.hide() : this.show() }, t.prototype.createMenu = function() { var e = new mn(this.player_, { menuButton: this }); if (this.hideThreshold_ = 0, this.options_.title) { var t = U("li", { className: "vjs-menu-title", innerHTML: ze(this.options_.title), tabIndex: -1 }); this.hideThreshold_ += 1, e.children_.unshift(t), B(t, e.contentEl()) } if (this.items = this.createItems(), this.items) for (var i = 0; i < this.items.length; i++) e.addItem(this.items[i]); return e }, t.prototype.createItems = function() {}, t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: this.buildWrapperCSSClass() }, {}) }, t.prototype.buildWrapperCSSClass = function() { var t = "vjs-menu-button"; return !0 === this.options_.inline ? t += "-inline" : t += "-popup", "vjs-menu-button " + t + " " + jr .prototype.buildCSSClass() + " " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildCSSClass = function() { var t = "vjs-menu-button"; return !0 === this.options_.inline ? t += "-inline" : t += "-popup", "vjs-menu-button " + t + " " + e .prototype.buildCSSClass.call(this) }, t.prototype.controlText = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.menuButton_.el(); return this.menuButton_.controlText(e, t) }, t.prototype.handleClick = function(e) { this.one(this.menu.contentEl(), "mouseleave", De(this, function(e) { this.unpressButton(), this.el_.blur() })), this.buttonPressed_ ? this.unpressButton() : this.pressButton() }, t.prototype.focus = function() { this.menuButton_.focus() }, t.prototype.blur = function() { this.menuButton_.blur() }, t.prototype.handleFocus = function() { be(l, "keydown", De(this, this.handleKeyPress)) }, t.prototype.handleBlur = function() { we(l, "keydown", De(this, this.handleKeyPress)) }, t.prototype.handleKeyPress = function(e) { 27 === e.which || 9 === e.which ? (this.buttonPressed_ && this.unpressButton(), 9 !== e.which && (e .preventDefault(), this.menuButton_.el_.focus())) : 38 !== e.which && 40 !== e.which || this .buttonPressed_ || (this.pressButton(), e.preventDefault()) }, t.prototype.handleSubmenuKeyPress = function(e) { 27 !== e.which && 9 !== e.which || (this.buttonPressed_ && this.unpressButton(), 9 !== e.which && (e .preventDefault(), this.menuButton_.el_.focus())) }, t.prototype.pressButton = function() { if (this.enabled_) { if (this.buttonPressed_ = !0, this.menu.lockShowing(), this.menuButton_.el_.setAttribute("aria-expanded", "true"), rt && x()) return; this.menu.focus() } }, t.prototype.unpressButton = function() { this.enabled_ && (this.buttonPressed_ = !1, this.menu.unlockShowing(), this.menuButton_.el_.setAttribute( "aria-expanded", "false")) }, t.prototype.disable = function() { this.unpressButton(), this.enabled_ = !1, this.addClass("vjs-disabled"), this.menuButton_.disable() }, t.prototype.enable = function() { this.enabled_ = !0, this.removeClass("vjs-disabled"), this.menuButton_.enable() }, t }(Ye); Ye.registerComponent("MenuButton", gn); var vn = function(e) { function t(i, r) { y(this, t); var n = r.tracks, a = b(this, e.call(this, i, r)); if (a.items.length <= 1 && a.hide(), !n) return b(a); var s = De(a, a.update); return n.addEventListener("removetrack", s), n.addEventListener("addtrack", s), a.player_.on("ready", s), a .player_.on("dispose", function() { n.removeEventListener("removetrack", s), n.removeEventListener("addtrack", s) }), a } return _(t, e), t }(gn); Ye.registerComponent("TrackButton", vn); var yn = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.selectable = r.selectable, n.isSelected_ = r.selected || !1, n.multiSelectable = r.multiSelectable, n .selected(n.isSelected_), n.selectable ? n.multiSelectable ? n.el_.setAttribute("role", "menuitemcheckbox") : n.el_.setAttribute("role", "menuitemradio") : n.el_.setAttribute("role", "menuitem"), n } return _(t, e), t.prototype.createEl = function(t, i, r) { return this.nonIconControl = !0, e.prototype.createEl.call(this, "li", A({ className: "vjs-menu-item", innerHTML: '' + this.localize(this.options_.label) + "", tabIndex: -1 }, i), r) }, t.prototype.handleClick = function(e) { this.selected(!0) }, t.prototype.selected = function(e) { this.selectable && (e ? (this.addClass("vjs-selected"), this.el_.setAttribute("aria-checked", "true"), this .controlText(", selected"), this.isSelected_ = !0) : (this.removeClass("vjs-selected"), this.el_ .setAttribute("aria-checked", "false"), this.controlText(""), this.isSelected_ = !1)) }, t }(Lr); Ye.registerComponent("MenuItem", yn); var _n = function(e) { function t(i, r) { y(this, t); var a = r.track, s = i.textTracks(); r.label = a.label || a.language || "Unknown", r.selected = "showing" === a.mode; var o = b(this, e.call(this, i, r)); o.track = a; var u = function() { for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i]; o.handleTracksChange.apply(o, t) }, d = function() { for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i]; o.handleSelectedLanguageChange.apply(o, t) }; if (i.on(["loadstart", "texttrackchange"], u), s.addEventListener("change", u), s.addEventListener( "selectedlanguagechange", d), o.on("dispose", function() { i.off(["loadstart", "texttrackchange"], u), s.removeEventListener("change", u), s.removeEventListener( "selectedlanguagechange", d) }), void 0 === s.onchange) { var c = void 0; o.on(["tap", "click"], function() { if ("object" !== v(n.Event)) try { c = new n.Event("change") } catch (e) {} c || (c = l.createEvent("Event")).initEvent("change", !0, !0), s.dispatchEvent(c) }) } return o.handleTracksChange(), o } return _(t, e), t.prototype.handleClick = function(t) { var i = this.track.kind, r = this.track.kinds, n = this.player_.textTracks(); if (r || (r = [i]), e.prototype.handleClick.call(this, t), n) for (var a = 0; a < n.length; a++) { var s = n[a]; s === this.track && r.indexOf(s.kind) > -1 ? "showing" !== s.mode && (s.mode = "showing") : "disabled" !== s.mode && (s.mode = "disabled") } }, t.prototype.handleTracksChange = function(e) { var t = "showing" === this.track.mode; t !== this.isSelected_ && this.selected(t) }, t.prototype.handleSelectedLanguageChange = function(e) { if ("showing" === this.track.mode) { var t = this.player_.cache_.selectedLanguage; if (t && t.enabled && t.language === this.track.language && t.kind !== this.track.kind) return; this.player_.cache_.selectedLanguage = { enabled: !0, language: this.track.language, kind: this.track.kind } } }, t.prototype.dispose = function() { this.track = null, e.prototype.dispose.call(this) }, t }(yn); Ye.registerComponent("TextTrackMenuItem", _n); var bn = function(e) { function t(i, r) { return y(this, t), r.track = { player: i, kind: r.kind, kinds: r.kinds, default: !1, mode: "disabled" }, r.kinds || (r.kinds = [r.kind]), r.label ? r.track.label = r.label : r.track.label = r.kinds.join( " and ") + " off", r.selectable = !0, r.multiSelectable = !1, b(this, e.call(this, i, r)) } return _(t, e), t.prototype.handleTracksChange = function(e) { for (var t = this.player().textTracks(), i = !0, r = 0, n = t.length; r < n; r++) { var a = t[r]; if (this.options_.kinds.indexOf(a.kind) > -1 && "showing" === a.mode) { i = !1; break } } i !== this.isSelected_ && this.selected(i) }, t.prototype.handleSelectedLanguageChange = function(e) { for (var t = this.player().textTracks(), i = !0, r = 0, n = t.length; r < n; r++) { var a = t[r]; if (["captions", "descriptions", "subtitles"].indexOf(a.kind) > -1 && "showing" === a.mode) { i = !1; break } } i && (this.player_.cache_.selectedLanguage = { enabled: !1 }) }, t }(_n); Ye.registerComponent("OffTextTrackMenuItem", bn); var wn = function(e) { function t(i) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; return y(this, t), r.tracks = i.textTracks(), b(this, e.call(this, i, r)) } return _(t, e), t.prototype.createItems = function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : _n, i = void 0; this.label_ && (i = this.label_ + " off"), e.push(new bn(this.player_, { kinds: this.kinds_, kind: this.kind_, label: i })), this.hideThreshold_ += 1; var r = this.player_.textTracks(); Array.isArray(this.kinds_) || (this.kinds_ = [this.kind_]); for (var n = 0; n < r.length; n++) { var a = r[n]; if (this.kinds_.indexOf(a.kind) > -1) { var s = new t(this.player_, { track: a, selectable: !0, multiSelectable: !1 }); s.addClass("vjs-" + a.kind + "-menu-item"), e.push(s) } } return e }, t }(vn); Ye.registerComponent("TextTrackButton", wn); var En = function(e) { function t(i, r) { y(this, t); var n = r.track, a = r.cue, s = i.currentTime(); r.selectable = !0, r.multiSelectable = !1, r.label = a.text, r.selected = a.startTime <= s && s < a.endTime; var o = b(this, e.call(this, i, r)); return o.track = n, o.cue = a, n.addEventListener("cuechange", De(o, o.update)), o } return _(t, e), t.prototype.handleClick = function(t) { e.prototype.handleClick.call(this), this.player_.currentTime(this.cue.startTime), this.update(this.cue .startTime) }, t.prototype.update = function(e) { var t = this.cue, i = this.player_.currentTime(); this.selected(t.startTime <= i && i < t.endTime) }, t }(yn); Ye.registerComponent("ChaptersTrackMenuItem", En); var Tn = function(e) { function t(i, r, n) { return y(this, t), b(this, e.call(this, i, r, n)) } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-chapters-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildWrapperCSSClass = function() { return "vjs-chapters-button " + e.prototype.buildWrapperCSSClass.call(this) }, t.prototype.update = function(t) { this.track_ && (!t || "addtrack" !== t.type && "removetrack" !== t.type) || this.setTrack(this .findChaptersTrack()), e.prototype.update.call(this) }, t.prototype.setTrack = function(e) { if (this.track_ !== e) { if (this.updateHandler_ || (this.updateHandler_ = this.update.bind(this)), this.track_) { var t = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_); t && t.removeEventListener("load", this.updateHandler_), this.track_ = null } if (this.track_ = e, this.track_) { this.track_.mode = "hidden"; var i = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_); i && i.addEventListener("load", this.updateHandler_) } } }, t.prototype.findChaptersTrack = function() { for (var e = this.player_.textTracks() || [], t = e.length - 1; t >= 0; t--) { var i = e[t]; if (i.kind === this.kind_) return i } }, t.prototype.getMenuCaption = function() { return this.track_ && this.track_.label ? this.track_.label : this.localize(ze(this.kind_)) }, t.prototype.createMenu = function() { return this.options_.title = this.getMenuCaption(), e.prototype.createMenu.call(this) }, t.prototype.createItems = function() { var e = []; if (!this.track_) return e; var t = this.track_.cues; if (!t) return e; for (var i = 0, r = t.length; i < r; i++) { var n = t[i], a = new En(this.player_, { track: this.track_, cue: n }); e.push(a) } return e }, t }(wn); Tn.prototype.kind_ = "chapters", Tn.prototype.controlText_ = "Chapters", Ye.registerComponent("ChaptersButton", Tn); var Sn = function(e) { function t(i, r, n) { y(this, t); var a = b(this, e.call(this, i, r, n)), s = i.textTracks(), o = De(a, a.handleTracksChange); return s.addEventListener("change", o), a.on("dispose", function() { s.removeEventListener("change", o) }), a } return _(t, e), t.prototype.handleTracksChange = function(e) { for (var t = this.player().textTracks(), i = !1, r = 0, n = t.length; r < n; r++) { var a = t[r]; if (a.kind !== this.kind_ && "showing" === a.mode) { i = !0; break } } i ? this.disable() : this.enable() }, t.prototype.buildCSSClass = function() { return "vjs-descriptions-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildWrapperCSSClass = function() { return "vjs-descriptions-button " + e.prototype.buildWrapperCSSClass.call(this) }, t }(wn); Sn.prototype.kind_ = "descriptions", Sn.prototype.controlText_ = "Descriptions", Ye.registerComponent( "DescriptionsButton", Sn); var An = function(e) { function t(i, r, n) { return y(this, t), b(this, e.call(this, i, r, n)) } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-subtitles-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildWrapperCSSClass = function() { return "vjs-subtitles-button " + e.prototype.buildWrapperCSSClass.call(this) }, t }(wn); An.prototype.kind_ = "subtitles", An.prototype.controlText_ = "Subtitles", Ye.registerComponent("SubtitlesButton", An); var kn = function(e) { function t(i, r) { y(this, t), r.track = { player: i, kind: r.kind, label: r.kind + " settings", selectable: !1, default: !1, mode: "disabled" }, r.selectable = !1, r.name = "CaptionSettingsMenuItem"; var n = b(this, e.call(this, i, r)); return n.addClass("vjs-texttrack-settings"), n.controlText(", opens " + r.kind + " settings dialog"), n } return _(t, e), t.prototype.handleClick = function(e) { this.player().getChild("textTrackSettings").open() }, t }(_n); Ye.registerComponent("CaptionSettingsMenuItem", kn); var Rn = function(e) { function t(i, r, n) { return y(this, t), b(this, e.call(this, i, r, n)) } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-captions-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildWrapperCSSClass = function() { return "vjs-captions-button " + e.prototype.buildWrapperCSSClass.call(this) }, t.prototype.createItems = function() { var t = []; return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild( "textTrackSettings") || (t.push(new kn(this.player_, { kind: this.kind_ })), this.hideThreshold_ += 1), e.prototype.createItems.call(this, t) }, t }(wn); Rn.prototype.kind_ = "captions", Rn.prototype.controlText_ = "Captions", Ye.registerComponent("CaptionsButton", Rn); var Mn = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function(t, i, r) { var n = '' + this.localize(this.options_.label); return "captions" === this.options_.track.kind && (n += '\n \n ' + this.localize("Captions") + "\n "), n += "", e.prototype.createEl.call(this, t, A({ innerHTML: n }, i), r) }, t }(_n); Ye.registerComponent("SubsCapsMenuItem", Mn); var On = function(e) { function t(i) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; y(this, t); var n = b(this, e.call(this, i, r)); return n.label_ = "subtitles", ["en", "en-us", "en-ca", "fr-ca"].indexOf(n.player_.language_) > -1 && (n .label_ = "captions"), n.menuButton_.controlText(ze(n.label_)), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-subs-caps-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildWrapperCSSClass = function() { return "vjs-subs-caps-button " + e.prototype.buildWrapperCSSClass.call(this) }, t.prototype.createItems = function() { var t = []; return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild( "textTrackSettings") || (t.push(new kn(this.player_, { kind: this.label_ })), this.hideThreshold_ += 1), t = e.prototype.createItems.call(this, t, Mn) }, t }(wn); On.prototype.kinds_ = ["captions", "subtitles"], On.prototype.controlText_ = "Subtitles", Ye.registerComponent( "SubsCapsButton", On); var Cn = function(e) { function t(i, r) { y(this, t); var n = r.track, a = i.audioTracks(); r.label = n.label || n.language || "Unknown", r.selected = n.enabled; var s = b(this, e.call(this, i, r)); s.track = n, s.addClass("vjs-" + n.kind + "-menu-item"); var o = function() { for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i]; s.handleTracksChange.apply(s, t) }; return a.addEventListener("change", o), s.on("dispose", function() { a.removeEventListener("change", o) }), s } return _(t, e), t.prototype.createEl = function(t, i, r) { var n = '' + this.localize(this.options_.label); return "main-desc" === this.options_.track.kind && (n += '\n \n ' + this.localize("Descriptions") + "\n "), n += "", e.prototype.createEl.call(this, t, A({ innerHTML: n }, i), r) }, t.prototype.handleClick = function(t) { var i = this.player_.audioTracks(); e.prototype.handleClick.call(this, t); for (var r = 0; r < i.length; r++) { var n = i[r]; n.enabled = n === this.track } }, t.prototype.handleTracksChange = function(e) { this.selected(this.track.enabled) }, t }(yn); Ye.registerComponent("AudioTrackMenuItem", Cn); var Dn = function(e) { function t(i) { var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; return y(this, t), r.tracks = i.audioTracks(), b(this, e.call(this, i, r)) } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-audio-button " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildWrapperCSSClass = function() { return "vjs-audio-button " + e.prototype.buildWrapperCSSClass.call(this) }, t.prototype.createItems = function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : []; this.hideThreshold_ = 1; for (var t = this.player_.audioTracks(), i = 0; i < t.length; i++) { var r = t[i]; e.push(new Cn(this.player_, { track: r, selectable: !0, multiSelectable: !1 })) } return e }, t }(vn); Dn.prototype.controlText_ = "Audio Track", Ye.registerComponent("AudioTrackButton", Dn); var In = function(e) { function t(i, r) { y(this, t); var n = r.rate, a = parseFloat(n, 10); r.label = n, r.selected = 1 === a, r.selectable = !0, r.multiSelectable = !1; var s = b(this, e.call(this, i, r)); return s.label = n, s.rate = a, s.on(i, "ratechange", s.update), s } return _(t, e), t.prototype.handleClick = function(t) { e.prototype.handleClick.call(this), this.player().playbackRate(this.rate) }, t.prototype.update = function(e) { this.selected(this.player().playbackRate() === this.rate) }, t }(yn); In.prototype.contentElType = "button", Ye.registerComponent("PlaybackRateMenuItem", In); var Ln = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.updateVisibility(), n.updateLabel(), n.on(i, "loadstart", n.updateVisibility), n.on(i, "ratechange", n.updateLabel), n } return _(t, e), t.prototype.createEl = function() { var t = e.prototype.createEl.call(this); return this.labelEl_ = U("div", { className: "vjs-playback-rate-value", innerHTML: "1x" }), t.appendChild(this.labelEl_), t }, t.prototype.dispose = function() { this.labelEl_ = null, e.prototype.dispose.call(this) }, t.prototype.buildCSSClass = function() { return "vjs-playback-rate " + e.prototype.buildCSSClass.call(this) }, t.prototype.buildWrapperCSSClass = function() { return "vjs-playback-rate " + e.prototype.buildWrapperCSSClass.call(this) }, t.prototype.createMenu = function() { var e = new mn(this.player()), t = this.playbackRates(); if (t) for (var i = t.length - 1; i >= 0; i--) e.addChild(new In(this.player(), { rate: t[i] + "x" })); return e }, t.prototype.updateARIAAttributes = function() { this.el().setAttribute("aria-valuenow", this.player().playbackRate()) }, t.prototype.handleClick = function(e) { for (var t = this.player().playbackRate(), i = this.playbackRates(), r = i[0], n = 0; n < i.length; n++) if (i[n] > t) { r = i[n]; break } this.player().playbackRate(r) }, t.prototype.playbackRates = function() { return this.options_.playbackRates || this.options_.playerOptions && this.options_.playerOptions .playbackRates }, t.prototype.playbackRateSupported = function() { return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this .playbackRates().length > 0 }, t.prototype.updateVisibility = function(e) { this.playbackRateSupported() ? this.removeClass("vjs-hidden") : this.addClass("vjs-hidden") }, t.prototype.updateLabel = function(e) { this.playbackRateSupported() && (this.labelEl_.innerHTML = this.player().playbackRate() + "x") }, t }(gn); Ln.prototype.controlText_ = "Playback Rate", Ye.registerComponent("PlaybackRateMenuButton", Ln); var xn = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-spacer " + e.prototype.buildCSSClass.call(this) }, t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: this.buildCSSClass() }) }, t }(Ye); Ye.registerComponent("Spacer", xn); var Pn = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-custom-control-spacer " + e.prototype.buildCSSClass.call(this) }, t.prototype.createEl = function() { var t = e.prototype.createEl.call(this, { className: this.buildCSSClass() }); return t.innerHTML = " ", t }, t }(xn); Ye.registerComponent("CustomControlSpacer", Pn); var Un = function(e) { function t() { return y(this, t), b(this, e.apply(this, arguments)) } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "div", { className: "vjs-control-bar", dir: "ltr" }) }, t }(Ye); Un.prototype.options_ = { children: ["playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle" ] }, Ye.registerComponent("ControlBar", Un); var Nn = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)); return n.on(i, "error", n.open), n } return _(t, e), t.prototype.buildCSSClass = function() { return "vjs-error-display " + e.prototype.buildCSSClass.call(this) }, t.prototype.content = function() { var e = this.player().error(); return e ? this.localize(e.message) : "" }, t }(Ut); Nn.prototype.options_ = Ke(Ut.prototype.options_, { pauseOnOpen: !1, fillAlways: !0, temporary: !1, uncloseable: !0 }), Ye.registerComponent("ErrorDisplay", Nn); var Bn = ["#000", "Black"], Fn = ["#00F", "Blue"], jn = ["#0FF", "Cyan"], Hn = ["#0F0", "Green"], Gn = ["#F0F", "Magenta"], Vn = ["#F00", "Red"], Wn = ["#FFF", "White"], qn = ["#FF0", "Yellow"], Xn = ["1", "Opaque"], zn = ["0.5", "Semi-Transparent"], Kn = ["0", "Transparent"], Yn = { backgroundColor: { selector: ".vjs-bg-color > select", id: "captions-background-color-%s", label: "Color", options: [Bn, Wn, Vn, Hn, Fn, qn, Gn, jn] }, backgroundOpacity: { selector: ".vjs-bg-opacity > select", id: "captions-background-opacity-%s", label: "Transparency", options: [Xn, zn, Kn] }, color: { selector: ".vjs-fg-color > select", id: "captions-foreground-color-%s", label: "Color", options: [Wn, Bn, Vn, Hn, Fn, qn, Gn, jn] }, edgeStyle: { selector: ".vjs-edge-style > select", id: "%s", label: "Text Edge Style", options: [ ["none", "None"], ["raised", "Raised"], ["depressed", "Depressed"], ["uniform", "Uniform"], ["dropshadow", "Dropshadow"] ] }, fontFamily: { selector: ".vjs-font-family > select", id: "captions-font-family-%s", label: "Font Family", options: [ ["proportionalSansSerif", "Proportional Sans-Serif"], ["monospaceSansSerif", "Monospace Sans-Serif"], ["proportionalSerif", "Proportional Serif"], ["monospaceSerif", "Monospace Serif"], ["casual", "Casual"], ["script", "Script"], ["small-caps", "Small Caps"] ] }, fontPercent: { selector: ".vjs-font-percent > select", id: "captions-font-size-%s", label: "Font Size", options: [ ["0.50", "50%"], ["0.75", "75%"], ["1.00", "100%"], ["1.25", "125%"], ["1.50", "150%"], ["1.75", "175%"], ["2.00", "200%"], ["3.00", "300%"], ["4.00", "400%"] ], default: 2, parser: function(e) { return "1.00" === e ? null : Number(e) } }, textOpacity: { selector: ".vjs-text-opacity > select", id: "captions-foreground-opacity-%s", label: "Transparency", options: [Xn, zn] }, windowColor: { selector: ".vjs-window-color > select", id: "captions-window-color-%s", label: "Color" }, windowOpacity: { selector: ".vjs-window-opacity > select", id: "captions-window-opacity-%s", label: "Transparency", options: [Kn, zn, Xn] } }; function Qn(e, t) { if (t && (e = t(e)), e && "none" !== e) return e } Yn.windowColor.options = Yn.backgroundColor.options; var Jn = function(e) { function t(i, r) { y(this, t), r.temporary = !1; var n = b(this, e.call(this, i, r)); return n.updateDisplay = De(n, n.updateDisplay), n.fill(), n.hasBeenOpened_ = n.hasBeenFilled_ = !0, n .endDialog = U("p", { className: "vjs-control-text", textContent: n.localize("End of dialog window.") }), n.el().appendChild(n.endDialog), n.setDefaults(), void 0 === r.persistTextTrackSettings && (n.options_ .persistTextTrackSettings = n.options_.playerOptions.persistTextTrackSettings), n.on(n.$( ".vjs-done-button"), "click", function() { n.saveSettings(), n.close() }), n.on(n.$(".vjs-default-button"), "click", function() { n.setDefaults(), n.updateDisplay() }), S(Yn, function(e) { n.on(n.$(e.selector), "change", n.updateDisplay) }), n.options_.persistTextTrackSettings && n.restoreSettings(), n } return _(t, e), t.prototype.dispose = function() { this.endDialog = null, e.prototype.dispose.call(this) }, t.prototype.createElSelect_ = function(e) { var t = this, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "", r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "label", n = Yn[e], a = n.id.replace("%s", this.id_), s = [i, a].join(" ").trim(); return ["<" + r + ' id="' + a + '" class="' + ("label" === r ? "vjs-label" : "") + '">', this.localize(n .label), "", '").join("") }, t.prototype.createElFgColor_ = function() { var e = "captions-text-legend-" + this.id_; return ['
', '', this.localize( "Text"), "", this.createElSelect_("color", e), '', this.createElSelect_("textOpacity", e), "", "
" ].join("") }, t.prototype.createElBgColor_ = function() { var e = "captions-background-" + this.id_; return ['
', '', this.localize( "Background"), "", this.createElSelect_("backgroundColor", e), '', this.createElSelect_("backgroundOpacity", e), "", "
" ].join("") }, t.prototype.createElWinColor_ = function() { var e = "captions-window-" + this.id_; return ['
', '', this.localize( "Window"), "", this.createElSelect_("windowColor", e), '', this.createElSelect_("windowOpacity", e), "", "
" ].join("") }, t.prototype.createElColors_ = function() { return U("div", { className: "vjs-track-settings-colors", innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("") }) }, t.prototype.createElFont_ = function() { return U("div", { className: "vjs-track-settings-font", innerHTML: ['
', this.createElSelect_( "fontPercent", "", "legend"), "
", '
', this.createElSelect_("edgeStyle", "", "legend"), "
", '
', this .createElSelect_("fontFamily", "", "legend"), "
" ].join("") }) }, t.prototype.createElControls_ = function() { var e = this.localize("restore all settings to the default values"); return U("div", { className: "vjs-track-settings-controls", innerHTML: ['", '" ].join("") }) }, t.prototype.content = function() { return [this.createElColors_(), this.createElFont_(), this.createElControls_()] }, t.prototype.label = function() { return this.localize("Caption Settings Dialog") }, t.prototype.description = function() { return this.localize("Beginning of dialog window. Escape will cancel and close the window.") }, t.prototype.buildCSSClass = function() { return e.prototype.buildCSSClass.call(this) + " vjs-text-track-settings" }, t.prototype.getValues = function() { var e = this; return function(e, t) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0; return T(e).reduce(function(i, r) { return t(i, e[r], r) }, i) }(Yn, function(t, i, r) { var n, a, s = (n = e.$(i.selector), a = i.parser, Qn(n.options[n.options.selectedIndex].value, a)); return void 0 !== s && (t[r] = s), t }, {}) }, t.prototype.setValues = function(e) { var t = this; S(Yn, function(i, r) { ! function(e, t, i) { if (t) for (var r = 0; r < e.options.length; r++) if (Qn(e.options[r].value, i) === t) { e.selectedIndex = r; break } }(t.$(i.selector), e[r], i.parser) }) }, t.prototype.setDefaults = function() { var e = this; S(Yn, function(t) { var i = t.hasOwnProperty("default") ? t.default : 0; e.$(t.selector).selectedIndex = i }) }, t.prototype.restoreSettings = function() { var e = void 0; try { e = JSON.parse(n.localStorage.getItem("vjs-text-track-settings")) } catch (e) { p.warn(e) } e && this.setValues(e) }, t.prototype.saveSettings = function() { if (this.options_.persistTextTrackSettings) { var e = this.getValues(); try { Object.keys(e).length ? n.localStorage.setItem("vjs-text-track-settings", JSON.stringify(e)) : n .localStorage.removeItem("vjs-text-track-settings") } catch (e) { p.warn(e) } } }, t.prototype.updateDisplay = function() { var e = this.player_.getChild("textTrackDisplay"); e && e.updateDisplay() }, t.prototype.conditionalBlur_ = function() { this.previouslyActiveEl_ = null, this.off(l, "keydown", this.handleKeyDown); var e = this.player_.controlBar, t = e && e.subsCapsButton, i = e && e.captionsButton; t ? t.focus() : i && i.focus() }, t }(Ut); Ye.registerComponent("TextTrackSettings", Jn); var Zn = function(e) { function t(i, r) { y(this, t); var a = r.ResizeObserver || n.ResizeObserver; null === r.ResizeObserver && (a = !1); var s = Ke({ createEl: !a, reportTouchActivity: !1 }, r), o = b(this, e.call(this, i, s)); return o.ResizeObserver = r.ResizeObserver || n.ResizeObserver, o.loadListener_ = null, o.resizeObserver_ = null, o.debouncedHandler_ = Le(function() { o.resizeHandler() }, 100, !1, o), a ? (o.resizeObserver_ = new o.ResizeObserver(o.debouncedHandler_), o.resizeObserver_ .observe(i.el())) : (o.loadListener_ = function() { o.el_ && o.el_.contentWindow && be(o.el_.contentWindow, "resize", o.debouncedHandler_) }, o.one("load", o.loadListener_)), o } return _(t, e), t.prototype.createEl = function() { return e.prototype.createEl.call(this, "iframe", { className: "vjs-resize-manager" }) }, t.prototype.resizeHandler = function() { this.player_ && this.player_.trigger && this.player_.trigger("playerresize") }, t.prototype.dispose = function() { this.debouncedHandler_ && this.debouncedHandler_.cancel(), this.resizeObserver_ && (this.player_.el() && this.resizeObserver_.unobserve(this.player_.el()), this.resizeObserver_.disconnect()), this.el_ && this .el_.contentWindow && we(this.el_.contentWindow, "resize", this.debouncedHandler_), this.loadListener_ && this.off("load", this.loadListener_), this.ResizeObserver = null, this.resizeObserver = null, this .debouncedHandler_ = null, this.loadListener_ = null }, t }(Ye); Ye.registerComponent("ResizeManager", Zn); var $n = function(e) { var t = e.el(); if (t.hasAttribute("src")) return e.triggerSourceset(t.src), !0; var i = e.$$("source"), r = [], n = ""; if (!i.length) return !1; for (var a = 0; a < i.length; a++) { var s = i[a].src; s && -1 === r.indexOf(s) && r.push(s) } return !!r.length && (1 === r.length && (n = r[0]), e.triggerSourceset(n), !0) }, ea = Object.defineProperty({}, "innerHTML", { get: function() { return this.cloneNode(!0).innerHTML }, set: function(e) { var t = l.createElement(this.nodeName.toLowerCase()); t.innerHTML = e; for (var i = l.createDocumentFragment(); t.childNodes.length;) i.appendChild(t.childNodes[0]); return this.innerText = "", n.Element.prototype.appendChild.call(this, i), this.innerHTML } }), ta = function(e, t) { for (var i = {}, r = 0; r < e.length && !((i = Object.getOwnPropertyDescriptor(e[r], t)) && i.set && i .get); r++); return i.enumerable = !0, i.configurable = !0, i }, ia = function(e) { var t = e.el(); if (!t.resetSourceWatch_) { var i = {}, r = function(e) { return ta([e.el(), n.HTMLMediaElement.prototype, n.Element.prototype, ea], "innerHTML") }(e), a = function(i) { return function() { for (var r = arguments.length, n = Array(r), a = 0; a < r; a++) n[a] = arguments[a]; var s = i.apply(t, n); return $n(e), s } }; ["append", "appendChild", "insertAdjacentHTML"].forEach(function(e) { t[e] && (i[e] = t[e], t[e] = a(i[e])) }), Object.defineProperty(t, "innerHTML", Ke(r, { set: a(r.set) })), t.resetSourceWatch_ = function() { t.resetSourceWatch_ = null, Object.keys(i).forEach(function(e) { t[e] = i[e] }), Object.defineProperty(t, "innerHTML", r) }, e.one("sourceset", t.resetSourceWatch_) } }, ra = Object.defineProperty({}, "src", { get: function() { return this.hasAttribute("src") ? Zt(n.Element.prototype.getAttribute.call(this, "src")) : "" }, set: function(e) { return n.Element.prototype.setAttribute.call(this, "src", e), e } }), na = function(e) { if (e.featuresSourceset) { var t = e.el(); if (!t.resetSourceset_) { var i = function(e) { return ta([e.el(), n.HTMLMediaElement.prototype, ra], "src") }(e), r = t.setAttribute, a = t.load; Object.defineProperty(t, "src", Ke(i, { set: function(r) { var n = i.set.call(t, r); return e.triggerSourceset(t.src), n } })), t.setAttribute = function(i, n) { var a = r.call(t, i, n); return /src/i.test(i) && e.triggerSourceset(t.src), a }, t.load = function() { var i = a.call(t); return $n(e) || (e.triggerSourceset(""), ia(e)), i }, t.currentSrc ? e.triggerSourceset(t.currentSrc) : $n(e) || ia(e), t.resetSourceset_ = function() { t.resetSourceset_ = null, t.load = a, t.setAttribute = r, Object.defineProperty(t, "src", i), t .resetSourceWatch_ && t.resetSourceWatch_() } } } }, aa = w([ "Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading." ], [ "Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading." ]), sa = function(e) { function t(i, r) { y(this, t); var n = b(this, e.call(this, i, r)), a = i.source, s = !1; if (a && (n.el_.currentSrc !== a.src || i.tag && 3 === i.tag.initNetworkState_) ? n.setSource(a) : n .handleLateInit_(n.el_), i.enableSourceset && n.setupSourcesetHandling_(), n.el_.hasChildNodes()) { for (var o = n.el_.childNodes, u = o.length, l = []; u--;) { var d = o[u]; "track" === d.nodeName.toLowerCase() && (n.featuresNativeTextTracks ? (n.remoteTextTrackEls() .addTrackElement_(d), n.remoteTextTracks().addTrack(d.track), n.textTracks().addTrack(d.track), s || n.el_.hasAttribute("crossorigin") || !ei(d.src) || (s = !0)) : l.push(d)) } for (var c = 0; c < l.length; c++) n.el_.removeChild(l[c]) } return n.proxyNativeTracks_(), n.featuresNativeTextTracks && s && p.warn(g(aa)), n .restoreMetadataTracksInIOSNativePlayer_(), (mt || tt || ot) && !0 === i.nativeControlsForTouch && n .setControls(!0), n.proxyWebkitFullscreen_(), n.triggerReady(), n } return _(t, e), t.prototype.dispose = function() { this.el_ && this.el_.resetSourceset_ && this.el_.resetSourceset_(), t.disposeMediaElement(this.el_), this .options_ = null, e.prototype.dispose.call(this) }, t.prototype.setupSourcesetHandling_ = function() { na(this) }, t.prototype.restoreMetadataTracksInIOSNativePlayer_ = function() { var e = this.textTracks(), t = void 0, i = function() { t = []; for (var i = 0; i < e.length; i++) { var r = e[i]; "metadata" === r.kind && t.push({ track: r, storedMode: r.mode }) } }; i(), e.addEventListener("change", i), this.on("dispose", function() { return e.removeEventListener("change", i) }); var r = function i() { for (var r = 0; r < t.length; r++) { var n = t[r]; "disabled" === n.track.mode && n.track.mode !== n.storedMode && (n.track.mode = n.storedMode) } e.removeEventListener("change", i) }; this.on("webkitbeginfullscreen", function() { e.removeEventListener("change", i), e.removeEventListener("change", r), e.addEventListener("change", r) }), this.on("webkitendfullscreen", function() { e.removeEventListener("change", i), e.addEventListener("change", i), e.removeEventListener("change", r) }) }, t.prototype.overrideNative_ = function(e, t) { var i = this; if (t === this["featuresNative" + e + "Tracks"]) { var r = e.toLowerCase(); this[r + "TracksListeners_"] && Object.keys(this[r + "TracksListeners_"]).forEach(function(e) { i.el()[r + "Tracks"].removeEventListener(e, i[r + "TracksListeners_"][e]) }), this["featuresNative" + e + "Tracks"] = !t, this[r + "TracksListeners_"] = null, this .proxyNativeTracksForType_(r) } }, t.prototype.overrideNativeAudioTracks = function(e) { this.overrideNative_("Audio", e) }, t.prototype.overrideNativeVideoTracks = function(e) { this.overrideNative_("Video", e) }, t.prototype.proxyNativeTracksForType_ = function(e) { var t = this, i = Pi[e], r = this.el()[i.getterName], n = this[i.getterName](); if (this["featuresNative" + i.capitalName + "Tracks"] && r && r.addEventListener) { var a = { change: function(e) { n.trigger({ type: "change", target: n, currentTarget: n, srcElement: n }) }, addtrack: function(e) { n.addTrack(e.track) }, removetrack: function(e) { n.removeTrack(e.track) } }, s = function() { for (var e = [], t = 0; t < n.length; t++) { for (var i = !1, a = 0; a < r.length; a++) if (r[a] === n[t]) { i = !0; break } i || e.push(n[t]) } for (; e.length;) n.removeTrack(e.shift()) }; this[i.getterName + "Listeners_"] = a, Object.keys(a).forEach(function(e) { var i = a[e]; r.addEventListener(e, i), t.on("dispose", function(t) { return r.removeEventListener(e, i) }) }), this.on("loadstart", s), this.on("dispose", function(e) { return t.off("loadstart", s) }) } }, t.prototype.proxyNativeTracks_ = function() { var e = this; Pi.names.forEach(function(t) { e.proxyNativeTracksForType_(t) }) }, t.prototype.createEl = function() { var e = this.options_.tag; if (!e || !this.options_.playerElIngest && !this.movingMediaElementInDOM) { if (e) { var i = e.cloneNode(!0); e.parentNode && e.parentNode.insertBefore(i, e), t.disposeMediaElement(e), e = i } else { e = l.createElement("video"); var r = Ke({}, this.options_.tag && W(this.options_.tag)); mt && !0 === this.options_.nativeControlsForTouch || delete r.controls, V(e, A(r, { id: this.options_.techId, class: "vjs-tech" })) } e.playerId = this.options_.playerId } void 0 !== this.options_.preload && X(e, "preload", this.options_.preload); for (var n = ["loop", "muted", "playsinline", "autoplay", "stretch", "fluent"], a = 0; a < n.length; a++) { var s = n[a], o = this.options_[s]; void 0 !== o && (o ? X(e, s, s) : z(e, s), e[s] = o) } return e }, t.prototype.handleLateInit_ = function(e) { if (0 !== e.networkState && 3 !== e.networkState) { if (0 === e.readyState) { var t = !1, i = function() { t = !0 }; this.on("loadstart", i); var r = function() { t || this.trigger("loadstart") }; return this.on("loadedmetadata", r), void this.ready(function() { this.off("loadstart", i), this.off("loadedmetadata", r), t || this.trigger("loadstart") }) } var n = ["loadstart"]; n.push("loadedmetadata"), e.readyState >= 2 && n.push("loadeddata"), e.readyState >= 3 && n.push( "canplay"), e.readyState >= 4 && n.push("canplaythrough"), this.ready(function() { n.forEach(function(e) { this.trigger(e) }, this) }) } }, t.prototype.setCurrentTime = function(e) { try { this.el_.currentTime = e } catch (e) { p(e, "Video is not ready. (Video.js)") } }, t.prototype.duration = function() { var e = this; if (this.el_.duration === 1 / 0 && at && dt && 0 === this.el_.currentTime) { return this.on("timeupdate", function t() { e.el_.currentTime > 0 && (e.el_.duration === 1 / 0 && e.trigger("durationchange"), e.off( "timeupdate", t)) }), NaN } return this.el_.duration || NaN }, t.prototype.width = function() { return this.el_.offsetWidth }, t.prototype.height = function() { return this.el_.offsetHeight }, t.prototype.proxyWebkitFullscreen_ = function() { var e = this; if ("webkitDisplayingFullscreen" in this.el_) { var t = function() { this.trigger("fullscreenchange", { isFullscreen: !1 }) }, i = function() { "webkitPresentationMode" in this.el_ && "picture-in-picture" !== this.el_.webkitPresentationMode && ( this.one("webkitendfullscreen", t), this.trigger("fullscreenchange", { isFullscreen: !0 })) }; this.on("webkitbeginfullscreen", i), this.on("dispose", function() { e.off("webkitbeginfullscreen", i), e.off("webkitendfullscreen", t) }) } }, t.prototype.supportsFullScreen = function() { if ("function" == typeof this.el_.webkitEnterFullScreen) { var e = n.navigator && n.navigator.userAgent || ""; if (/Android/.test(e) || !/Chrome|Mac OS X 10.5/.test(e)) return !0 } return !1 }, t.prototype.enterFullScreen = function() { var e = this.el_; e.paused && e.networkState <= e.HAVE_METADATA ? (this.el_.play(), this.setTimeout(function() { e.pause(), e.webkitEnterFullScreen() }, 0)) : e.webkitEnterFullScreen() }, t.prototype.exitFullScreen = function() { this.el_.webkitExitFullScreen() }, t.prototype.src = function(e) { if (void 0 === e) return this.el_.src; this.setSrc(e) }, t.prototype.reset = function() { t.resetMediaElement(this.el_) }, t.prototype.currentSrc = function() { return this.currentSource_ ? this.currentSource_.src : this.el_.currentSrc }, t.prototype.setControls = function(e) { this.el_.controls = !!e }, t.prototype.addTextTrack = function(t, i, r) { return this.featuresNativeTextTracks ? this.el_.addTextTrack(t, i, r) : e.prototype.addTextTrack.call(this, t, i, r) }, t.prototype.createRemoteTextTrack = function(t) { if (!this.featuresNativeTextTracks) return e.prototype.createRemoteTextTrack.call(this, t); var i = l.createElement("track"); return t.kind && (i.kind = t.kind), t.label && (i.label = t.label), (t.language || t.srclang) && (i .srclang = t.language || t.srclang), t.default && (i.default = t.default), t.id && (i.id = t.id), t .src && (i.src = t.src), i }, t.prototype.addRemoteTextTrack = function(t, i) { var r = e.prototype.addRemoteTextTrack.call(this, t, i); return this.featuresNativeTextTracks && this.el().appendChild(r), r }, t.prototype.removeRemoteTextTrack = function(t) { if (e.prototype.removeRemoteTextTrack.call(this, t), this.featuresNativeTextTracks) for (var i = this.$$("track"), r = i.length; r--;) t !== i[r] && t !== i[r].track || this.el() .removeChild(i[r]) }, t.prototype.getVideoPlaybackQuality = function() { if ("function" == typeof this.el().getVideoPlaybackQuality) return this.el().getVideoPlaybackQuality(); var e = {}; return void 0 !== this.el().webkitDroppedFrameCount && void 0 !== this.el().webkitDecodedFrameCount && (e .droppedVideoFrames = this.el().webkitDroppedFrameCount, e.totalVideoFrames = this.el() .webkitDecodedFrameCount), n.performance && "function" == typeof n.performance.now ? e.creationTime = n .performance.now() : n.performance && n.performance.timing && "number" == typeof n.performance.timing .navigationStart && (e.creationTime = n.Date.now() - n.performance.timing.navigationStart), e }, t }(_r); if (I()) { sa.TEST_VID = l.createElement("video"); var oa = l.createElement("track"); oa.kind = "captions", oa.srclang = "en", oa.label = "English", sa.TEST_VID.appendChild(oa) } sa.isSupported = function() { try { sa.TEST_VID.volume = .5 } catch (e) { return !1 } return !(!sa.TEST_VID || !sa.TEST_VID.canPlayType) }, sa.canPlayType = function(e) { return sa.TEST_VID.canPlayType(e) }, sa.canPlaySource = function(e, t) { return sa.canPlayType(e.type) }, sa.canControlVolume = function() { try { var e = sa.TEST_VID.volume; return sa.TEST_VID.volume = e / 2 + .1, e !== sa.TEST_VID.volume } catch (e) { return !1 } }, sa.canMuteVolume = function() { try { var e = sa.TEST_VID.muted; return sa.TEST_VID.muted = !e, sa.TEST_VID.muted ? X(sa.TEST_VID, "muted", "muted") : z(sa.TEST_VID, "muted"), e !== sa.TEST_VID.muted } catch (e) { return !1 } }, sa.canControlPlaybackRate = function() { if (at && dt && ct < 58) return !1; try { var e = sa.TEST_VID.playbackRate; return sa.TEST_VID.playbackRate = e / 2 + .1, e !== sa.TEST_VID.playbackRate } catch (e) { return !1 } }, sa.canOverrideAttributes = function() { try { var e = function() {}; Object.defineProperty(l.createElement("video"), "src", { get: e, set: e }), Object.defineProperty(l.createElement("audio"), "src", { get: e, set: e }), Object.defineProperty(l.createElement("video"), "innerHTML", { get: e, set: e }), Object.defineProperty(l.createElement("audio"), "innerHTML", { get: e, set: e }) } catch (e) { return !1 } return !0 }, sa.supportsNativeTextTracks = function() { return pt || rt && dt }, sa.supportsNativeVideoTracks = function() { return !(!sa.TEST_VID || !sa.TEST_VID.videoTracks) }, sa.supportsNativeAudioTracks = function() { return !(!sa.TEST_VID || !sa.TEST_VID.audioTracks) }, sa.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange" ], sa.prototype.featuresVolumeControl = sa.canControlVolume(), sa.prototype.featuresMuteControl = sa .canMuteVolume(), sa.prototype.featuresPlaybackRate = sa.canControlPlaybackRate(), sa.prototype .featuresSourceset = sa.canOverrideAttributes(), sa.prototype.movingMediaElementInDOM = !rt, sa.prototype .featuresFullscreenResize = !0, sa.prototype.featuresProgressEvents = !0, sa.prototype .featuresTimeupdateEvents = !0, sa.prototype.featuresNativeTextTracks = sa.supportsNativeTextTracks(), sa .prototype.featuresNativeVideoTracks = sa.supportsNativeVideoTracks(), sa.prototype.featuresNativeAudioTracks = sa .supportsNativeAudioTracks(); var ua = sa.TEST_VID && sa.TEST_VID.constructor.prototype.canPlayType, la = /^application\/(?:x-|vnd\.apple\.)mpegurl/i; sa.patchCanPlayType = function() { st >= 4 && !ut && !dt && (sa.TEST_VID.constructor.prototype.canPlayType = function(e) { return e && la.test(e) ? "maybe" : ua.call(this, e) }) }, sa.unpatchCanPlayType = function() { var e = sa.TEST_VID.constructor.prototype.canPlayType; return sa.TEST_VID.constructor.prototype.canPlayType = ua, e }, sa.patchCanPlayType(), sa.disposeMediaElement = function(e) { if (e) { for (e.parentNode && e.parentNode.removeChild(e); e.hasChildNodes();) e.removeChild(e.firstChild); e.removeAttribute("src"), "function" == typeof e.load && function() { try { e.load() } catch (e) {} }() } }, sa.resetMediaElement = function(e) { if (e) { for (var t = e.querySelectorAll("source"), i = t.length; i--;) e.removeChild(t[i]); e.removeAttribute("src"), "function" == typeof e.load && function() { try { e.load() } catch (e) {} }() } }, ["muted", "defaultMuted", "autoplay", "stretch", "fluent", "controls", "loop", "playsinline"].forEach(function( e) { sa.prototype[e] = function() { return this.el_[e] || this.el_.hasAttribute(e) } }), ["muted", "defaultMuted", "autoplay", "loop", "playsinline"].forEach(function(e) { sa.prototype["set" + ze(e)] = function(t) { this.el_[e] = t, t ? this.el_.setAttribute(e, e) : this.el_.removeAttribute(e) } }), ["paused", "currentTime", "buffered", "volume", "poster", "preload", "error", "seeking", "seekable", "ended", "playbackRate", "defaultPlaybackRate", "played", "networkState", "readyState", "videoWidth", "videoHeight" ].forEach(function(e) { sa.prototype[e] = function() { return this.el_[e] } }), ["volume", "src", "poster", "preload", "playbackRate", "defaultPlaybackRate"].forEach(function(e) { sa.prototype["set" + ze(e)] = function(t) { this.el_[e] = t } }), ["pause", "load", "play"].forEach(function(e) { sa.prototype[e] = function() { return this.el_[e]() } }), _r.withSourceHandlers(sa), sa.nativeSourceHandler = {}, sa.nativeSourceHandler.canPlayType = function(e) { try { return sa.TEST_VID.canPlayType(e) } catch (e) { return "" } }, sa.nativeSourceHandler.canHandleSource = function(e, t) { if (e.type) return sa.nativeSourceHandler.canPlayType(e.type); if (e.src) { var i = $t(e.src); return sa.nativeSourceHandler.canPlayType("video/" + i) } return "" }, sa.nativeSourceHandler.handleSource = function(e, t, i) { t.setSrc(e.src) }, sa.nativeSourceHandler.dispose = function() {}, sa.registerSourceHandler(sa.nativeSourceHandler), _r .registerTech("Html5", sa); var da = w([ "\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n " ], [ "\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n " ]), ca = ["progress", "abort", "suspend", "emptied", "stalled", "loadedmetadata", "loadeddata", "timeupdate", "resize", "volumechange", "texttrackchange" ], ha = { canplay: "CanPlay", canplaythrough: "CanPlayThrough", playing: "Playing", seeked: "Seeked" }, fa = function(t) { function i(r, n, a) { if (y(this, i), r.id = r.id || n.id || "vjs_video_" + le(), (n = A(i.getTagSettings(r), n)).initChildren = !1, n.createEl = !1, n.evented = !1, n.reportTouchActivity = !1, !n.language) if ("function" == typeof r.closest) { var s = r.closest("[lang]"); s && s.getAttribute && (n.language = s.getAttribute("lang")) } else for (var o = r; o && 1 === o.nodeType;) { if (W(o).hasOwnProperty("lang")) { n.language = o.getAttribute("lang"); break } o = o.parentNode } var u = b(this, t.call(this, null, n, a)); if (u.isPosterFromTech_ = !1, u.queuedCallbacks_ = [], u.isReady_ = !1, u.hasStarted_ = !1, u.userActive_ = ! 1, !u.options_ || !u.options_.techOrder || !u.options_.techOrder.length) throw new Error( "No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?" ); if (u.tag = r, u.tagAttributes = r && W(r), u.language(u.options_.language), n.languages) { var l = {}; Object.getOwnPropertyNames(n.languages).forEach(function(e) { l[e.toLowerCase()] = n.languages[e] }), u.languages_ = l } else u.languages_ = i.prototype.options_.languages; u.cache_ = {}, u.poster_ = n.poster || "", u.controls_ = !!n.controls, u.cache_.lastVolume = 1, r.controls = ! 1, r.removeAttribute("controls"), r.hasAttribute("autoplay") ? u.options_.autoplay = !0 : u.autoplay(u .options_.autoplay), u.scrubbing_ = !1, u.el_ = u.createEl(), u.cache_.lastPlaybackRate = u .defaultPlaybackRate(), We(u, { eventBusKey: "el_" }); var d = Ke(u.options_); if (n.plugins) { var c = n.plugins; Object.keys(c).forEach(function(e) { if ("function" != typeof this[e]) throw new Error('plugin "' + e + '" does not exist'); this[e](c[e]) }, u) } u.options_.playerOptions = d, u.middleware_ = [], u.initChildren(), u.isAudio("audio" === r.nodeName .toLowerCase()), u.controls() ? u.addClass("vjs-controls-enabled") : u.addClass("vjs-controls-disabled"), u.el_.setAttribute("role", "region"), u.isAudio() ? u.el_.setAttribute("aria-label", u.localize( "Audio Player")) : u.el_.setAttribute("aria-label", u.localize("Video Player")), u.isAudio() && u .addClass("vjs-audio"), u.flexNotSupported_() && u.addClass("vjs-no-flex"), rt || u.addClass( "vjs-workinghover"), i.players[u.id_] = u; var h = e.split(".")[0]; return u.addClass("vjs-v" + h), u.userActive(!0), u.reportUserActivity(), u.one("play", u .listenForUserActivity_), u.on("fullscreenchange", u.handleFullscreenChange_), u.on("stageclick", u .handleStageClick_), u.changingSrc_ = !1, u.playWaitingForReady_ = !1, u.playOnLoadstart_ = null, u } return _(i, t), i.prototype.dispose = function() { this.trigger("dispose"), this.off("dispose"), this.styleEl_ && this.styleEl_.parentNode && (this.styleEl_ .parentNode.removeChild(this.styleEl_), this.styleEl_ = null), i.players[this.id_] = null, this.tag && this.tag.player && (this.tag.player = null), this.el_ && this.el_.player && (this.el_.player = null), this .tech_ && (this.tech_.dispose(), this.isPosterFromTech_ = !1, this.poster_ = ""), this.playerElIngest_ && (this.playerElIngest_ = null), this.tag && (this.tag = null), wr[this.id()] = null, t.prototype.dispose .call(this) }, i.prototype.createEl = function() { var e = this.tag, i = void 0, r = this.playerElIngest_ = e.parentNode && e.parentNode.hasAttribute && e.parentNode.hasAttribute( "data-vjs-player"), a = "video-js" === this.tag.tagName.toLowerCase(); r ? i = this.el_ = e.parentNode : a || (i = this.el_ = t.prototype.createEl.call(this, "div")); var s = W(e); if (a) { for (i = this.el_ = e, e = this.tag = l.createElement("video"); i.children.length;) e.appendChild(i .firstChild); F(i, "video-js") || j(i, "video-js"), i.appendChild(e), r = this.playerElIngest_ = i, Object.keys(i) .forEach(function(t) { e[t] = i[t] }) } if (e.setAttribute("tabindex", "-1"), s.tabindex = "-1", ht && (e.setAttribute("role", "application"), s .role = "application"), e.removeAttribute("width"), e.removeAttribute("height"), "width" in s && delete s.width, "height" in s && delete s.height, Object.getOwnPropertyNames(s).forEach(function(t) { a && "class" === t || i.setAttribute(t, s[t]), a && e.setAttribute(t, s[t]) }), e.playerId = e.id, e.id += "_html5_api", e.className = "vjs-tech", e.player = i.player = this, this .addClass("vjs-paused"), !0 !== n.VIDEOJS_NO_DYNAMIC_STYLE) { this.styleEl_ = Oe("vjs-styles-dimensions"); var o = ae(".vjs-styles-defaults"), u = ae("head"); u.insertBefore(this.styleEl_, o ? o.nextSibling : u.firstChild) } this.width(this.options_.width), this.height(this.options_.height), this.fluid(this.options_.fluid), this .aspectRatio(this.options_.aspectRatio); for (var d = e.getElementsByTagName("a"), c = 0; c < d.length; c++) { var h = d.item(c); j(h, "vjs-hidden"), h.setAttribute("hidden", "hidden") } return e.initNetworkState_ = e.networkState, e.parentNode && !r && e.parentNode.insertBefore(i, e), B(e, i), this.children_.unshift(e), this.el_.setAttribute("lang", this.language_), this.el_ = i, i }, i.prototype.width = function(e) { return this.dimension("width", e) }, i.prototype.height = function(e) { return this.dimension("height", e) }, i.prototype.dimension = function(e, t) { var i = e + "_"; if (void 0 === t) return this[i] || 0; if ("" === t) return this[i] = void 0, void this.updateStyleEl_(); var r = parseFloat(t); isNaN(r) ? p.error('Improper value "' + t + '" supplied for for ' + e) : (this[i] = r, this .updateStyleEl_()) }, i.prototype.fluid = function(e) { if (void 0 === e) return !!this.fluid_; this.fluid_ = !!e, e ? this.addClass("vjs-fluid") : this.removeClass("vjs-fluid"), this.updateStyleEl_() }, i.prototype.aspectRatio = function(e) { if (void 0 === e) return this.aspectRatio_; if (!/^\d+\:\d+$/.test(e)) throw new Error( "Improper value supplied for aspect ratio. The format should be width:height, for example 16:9."); this.aspectRatio_ = e, this.fluid(!0), this.updateStyleEl_() }, i.prototype.updateStyleEl_ = function() { if (!0 !== n.VIDEOJS_NO_DYNAMIC_STYLE) { var e = void 0, t = void 0, i = void 0, r = (void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this .videoWidth() > 0 ? this.videoWidth() + ":" + this.videoHeight() : "16:9").split(":"), a = r[1] / r[0]; e = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / a : this .videoWidth() || 300, t = void 0 !== this.height_ ? this.height_ : e * a, i = /^[^a-zA-Z]/.test(this .id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", this.addClass(i), Ce(this.styleEl_, "\n ." + i + " {\n width: " + e + "px;\n height: " + t + "px;\n }\n\n ." + i + ".vjs-fluid {\n padding-top: " + 100 * a + "%;\n }\n ") } else { var s = "number" == typeof this.width_ ? this.width_ : this.options_.width, o = "number" == typeof this.height_ ? this.height_ : this.options_.height, u = this.tech_ && this.tech_.el(); u && (s >= 0 && (u.width = s), o >= 0 && (u.height = o)) } }, i.prototype.loadTech_ = function(e, t) { var i = this; this.tech_ && this.unloadTech_(); var r = ze(e), n = e.charAt(0).toLowerCase() + e.slice(1); "Html5" !== r && this.tag && (_r.getTech("Html5").disposeMediaElement(this.tag), this.tag.player = null, this.tag = null), this.techName_ = r, this.isReady_ = !1; var a = { source: t, autoplay: "string" != typeof this.autoplay() && this.autoplay(), nativeControlsForTouch: this.options_.nativeControlsForTouch, playerId: this.id(), techId: this.id() + "_" + n + "_api", playsinline: this.options_.playsinline, stretch: this.options_.stretch, fluent: this.options_.fluent, preload: this.options_.preload, loop: this.options_.loop, muted: this.options_.muted, poster: this.poster(), language: this.language(), playerElIngest: this.playerElIngest_ || !1, "vtt.js": this.options_["vtt.js"], canOverridePoster: !!this.options_.techCanOverridePoster, enableSourceset: this.options_.enableSourceset }; Ni.names.forEach(function(e) { var t = Ni[e]; a[t.getterName] = i[t.privateName] }), A(a, this.options_[r]), A(a, this.options_[n]), A(a, this.options_[e.toLowerCase()]), this.tag && (a .tag = this.tag), t && t.src === this.cache_.src && this.cache_.currentTime > 0 && (a.startTime = this .cache_.currentTime); var s = _r.getTech(e); if (!s) throw new Error("No Tech named '" + r + "' exists! '" + r + "' should be registered using videojs.registerTech()'"); this.tech_ = new s(a), this.tech_.ready(De(this, this.handleTechReady_), !0), xt(this.textTracksJson_ || [], this.tech_), ca.forEach(function(e) { i.on(i.tech_, e, i["handleTech" + ze(e) + "_"]) }), Object.keys(ha).forEach(function(e) { i.on(i.tech_, e, function(t) { 0 === i.tech_.playbackRate() && i.tech_.seeking() ? i.queuedCallbacks_.push({ callback: i["handleTech" + ha[e] + "_"].bind(i), event: t }) : i["handleTech" + ha[e] + "_"](t) }) }), this.on(this.tech_, "loadstart", this.handleTechLoadStart_), this.on(this.tech_, "sourceset", this .handleTechSourceset_), this.on(this.tech_, "waiting", this.handleTechWaiting_), this.on(this.tech_, "ended", this.handleTechEnded_), this.on(this.tech_, "seeking", this.handleTechSeeking_), this.on(this .tech_, "play", this.handleTechPlay_), this.on(this.tech_, "firstplay", this.handleTechFirstPlay_), this .on(this.tech_, "pause", this.handleTechPause_), this.on(this.tech_, "durationchange", this .handleTechDurationChange_), this.on(this.tech_, "fullscreenchange", this.handleTechFullscreenChange_), this.on(this.tech_, "fullscreentoggle", this.handleTechFullscreenToggle_), this.on(this.tech_, "error", this.handleTechError_), this.on(this.tech_, "loadedmetadata", this.updateStyleEl_), this.on(this.tech_, "posterchange", this.handleTechPosterChange_), this.on(this.tech_, "textdata", this .handleTechTextData_), this.on(this.tech_, "ratechange", this.handleTechRateChange_), this .usingNativeControls(this.techGet_("controls")), this.controls() && !this.usingNativeControls() && this .addTechControlsListeners_(), this.tech_.el().parentNode === this.el() || "Html5" === r && this.tag || B( this.tech_.el(), this.el()), this.tag && (this.tag.player = null, this.tag = null) }, i.prototype.unloadTech_ = function() { var e = this; Ni.names.forEach(function(t) { var i = Ni[t]; e[i.privateName] = e[i.getterName]() }), this.textTracksJson_ = Lt(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1, this .isPosterFromTech_ && (this.poster_ = "", this.trigger("posterchange")), this.isPosterFromTech_ = !1 }, i.prototype.tech = function(e) { return void 0 === e && p.warn(g(da)), this.tech_ }, i.prototype.addTechControlsListeners_ = function() { this.removeTechControlsListeners_(), this.on(this.tech_, "mousedown", this.handleTechClick_), this.on(this .tech_, "dblclick", this.handleTechDoubleClick_), this.on(this.tech_, "touchstart", this .handleTechTouchStart_), this.on(this.tech_, "touchmove", this.handleTechTouchMove_), this.on(this .tech_, "touchend", this.handleTechTouchEnd_), this.on(this.tech_, "tap", this.handleTechTap_) }, i.prototype.removeTechControlsListeners_ = function() { this.off(this.tech_, "tap", this.handleTechTap_), this.off(this.tech_, "touchstart", this .handleTechTouchStart_), this.off(this.tech_, "touchmove", this.handleTechTouchMove_), this.off(this .tech_, "touchend", this.handleTechTouchEnd_), this.off(this.tech_, "mousedown", this.handleTechClick_), this.off(this.tech_, "dblclick", this.handleTechDoubleClick_) }, i.prototype.handleTechReady_ = function() { this.triggerReady(), this.cache_.volume && this.techCall_("setVolume", this.cache_.volume), this .handleTechPosterChange_(), this.handleTechDurationChange_() }, i.prototype.handleTechLoadStart_ = function() { this.removeClass("vjs-ended"), this.removeClass("vjs-seeking"), this.error(null), this.paused() ? (this .hasStarted(!1), this.trigger("loadstart")) : (this.trigger("loadstart"), this.trigger("firstplay")), this.manualAutoplay_(this.autoplay()) }, i.prototype.manualAutoplay_ = function(e) { var t = this; if (this.tech_ && "string" == typeof e) { var i = function() { var e = t.muted(); t.muted(!0); var i = t.play(); if (i && i.then && i.catch) return i.catch(function(i) { t.muted(e) }) }, r = void 0; if ("any" === e ? (r = this.play()) && r.then && r.catch && r.catch(function() { return i() }) : r = "muted" === e ? i() : this.play(), r && r.then && r.catch) return r.then(function() { t.trigger({ type: "autoplay-success", autoplay: e }) }).catch(function(i) { t.trigger({ type: "autoplay-failure", autoplay: e }) }) } }, i.prototype.updateSourceCaches_ = function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", t = e, i = ""; if ("string" != typeof t && (t = e.src, i = e.type), !/^blob:/.test(t)) { this.cache_.source = this.cache_.source || {}, this.cache_.sources = this.cache_.sources || [], t && !i && (i = function(e, t) { if (!t) return ""; if (e.cache_.source.src === t && e.cache_.source.type) return e.cache_.source.type; var i = e.cache_.sources.filter(function(e) { return e.src === t }); if (i.length) return i[0].type; for (var r = e.$$("source"), n = 0; n < r.length; n++) { var a = r[n]; if (a.type && a.src && a.src === t) return a.type } return Cr(t) }(this, t)), this.cache_.source = Ke({}, e, { src: t, type: i }); for (var r = this.cache_.sources.filter(function(e) { return e.src && e.src === t }), n = [], a = this.$$("source"), s = [], o = 0; o < a.length; o++) { var u = W(a[o]); n.push(u), u.src && u.src === t && s.push(u.src) } s.length && !r.length ? this.cache_.sources = n : r.length || (this.cache_.sources = [this.cache_ .source]), this.cache_.src = t } }, i.prototype.handleTechSourceset_ = function(e) { var t = this; if (!this.changingSrc_ && (this.updateSourceCaches_(e.src), !e.src)) { this.tech_.one(["sourceset", "loadstart"], function e(i) { "sourceset" !== i.type && t.updateSourceCaches_(t.techGet_("currentSrc")), t.tech_.off(["sourceset", "loadstart" ], e) }) } this.trigger({ src: e.src, type: "sourceset" }) }, i.prototype.hasStarted = function(e) { if (void 0 === e) return this.hasStarted_; e !== this.hasStarted_ && (this.hasStarted_ = e, this.hasStarted_ ? (this.addClass("vjs-has-started"), this .trigger("firstplay")) : this.removeClass("vjs-has-started")) }, i.prototype.handleTechPlay_ = function() { this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this .hasStarted(!0), this.trigger("play") }, i.prototype.handleTechRateChange_ = function() { this.tech_.playbackRate() > 0 && 0 === this.cache_.lastPlaybackRate && (this.queuedCallbacks_.forEach( function(e) { return e.callback(e.event) }), this.queuedCallbacks_ = []), this.cache_.lastPlaybackRate = this.tech_.playbackRate(), this.trigger( "ratechange") }, i.prototype.handleTechWaiting_ = function() { var e = this; this.addClass("vjs-waiting"), this.trigger("waiting"), this.one("timeupdate", function() { return e.removeClass("vjs-waiting") }) }, i.prototype.handleTechCanPlay_ = function() { this.removeClass("vjs-waiting"), this.trigger("canplay") }, i.prototype.handleTechCanPlayThrough_ = function() { this.removeClass("vjs-waiting"), this.trigger("canplaythrough") }, i.prototype.handleTechPlaying_ = function() { this.removeClass("vjs-waiting"), this.trigger("playing") }, i.prototype.handleTechSeeking_ = function() { this.addClass("vjs-seeking"), this.trigger("seeking") }, i.prototype.handleTechSeeked_ = function() { this.removeClass("vjs-seeking"), this.trigger("seeked") }, i.prototype.handleTechFirstPlay_ = function() { this.options_.starttime && (p.warn( "Passing the `starttime` option to the player will be deprecated in 6.0"), this.currentTime(this .options_.starttime)), this.addClass("vjs-has-started"), this.trigger("firstplay") }, i.prototype.handleTechPause_ = function() { this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.trigger("pause") }, i.prototype.handleTechEnded_ = function() { this.addClass("vjs-ended"), this.options_.loop ? (this.currentTime(0), this.play()) : this.paused() || this .pause(), this.trigger("ended") }, i.prototype.handleTechDurationChange_ = function() { this.duration(this.techGet_("duration")) }, i.prototype.handleTechClick_ = function(e) { ne(e) && this.controls_ && this.paused() }, i.prototype.handleTechDoubleClick_ = function(e) { this.controls_ && (Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), function(t) { return t.contains(e.target) }) || (this.isFullscreen() ? this.exitFullscreen() : this.requestFullscreen())) }, i.prototype.handleTechTap_ = function() { this.userActive(!this.userActive()) }, i.prototype.handleTechTouchStart_ = function() { this.userWasActive = this.userActive() }, i.prototype.handleTechTouchMove_ = function() { this.userWasActive && this.reportUserActivity() }, i.prototype.handleTechTouchEnd_ = function(e) { e.preventDefault() }, i.prototype.handleFullscreenChange_ = function() { this.isFullscreen() ? this.addClass("vjs-fullscreen") : this.removeClass("vjs-fullscreen") }, i.prototype.handleStageClick_ = function() { this.reportUserActivity() }, i.prototype.handleTechFullscreenChange_ = function(e, t) { t && this.isFullscreen(t.isFullscreen), this.trigger("fullscreenchange") }, i.prototype.handleTechFullscreenToggle_ = function(e, t) { this.isFullscreen() ? this.exitFullscreen() : this.requestFullscreen() }, i.prototype.handleTechError_ = function() { var e = this.tech_.error(); this.error(e) }, i.prototype.handleTechTextData_ = function() { var e = null; arguments.length > 1 && (e = arguments[1]), this.trigger("textdata", e) }, i.prototype.getCache = function() { return this.cache_ }, i.prototype.techCall_ = function(e, t) { this.ready(function() { if (e in kr) return function(e, t, i, r) { return t[i](e.reduce(Mr(i), r)) }(this.middleware_, this.tech_, e, t); if (e in Rr) return Sr(this.middleware_, this.tech_, e, t); try { this.tech_ && this.tech_[e](t) } catch (e) { throw p(e), e } }, !0) }, i.prototype.techGet_ = function(e) { if (this.tech_ && this.tech_.isReady_) { if (e in Ar) return function(e, t, i) { return e.reduceRight(Mr(i), t[i]()) }(this.middleware_, this.tech_, e); if (e in Rr) return Sr(this.middleware_, this.tech_, e); try { return this.tech_[e]() } catch (t) { if (void 0 === this.tech_[e]) throw p("Video.js: " + e + " method not defined for " + this.techName_ + " playback technology.", t), t; if ("TypeError" === t.name) throw p("Video.js: " + e + " unavailable on " + this.techName_ + " playback technology element.", t), this.tech_.isReady_ = !1, t; throw p(t), t } } }, i.prototype.play = function() { var e = this, t = this.options_.Promise || n.Promise; return t ? new t(function(t) { e.play_(t) }) : this.play_() }, i.prototype.play_ = function() { var e = this, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Dt; if (this.playOnLoadstart_ && this.off("loadstart", this.playOnLoadstart_), this.isReady_) { if (!this.changingSrc_ && (this.src() || this.currentSrc())) return void t(this.techGet_("play")); this.playOnLoadstart_ = function() { e.playOnLoadstart_ = null, t(e.play()) }, this.one("loadstart", this.playOnLoadstart_) } else { if (this.playWaitingForReady_) return; this.playWaitingForReady_ = !0, this.ready(function() { e.playWaitingForReady_ = !1, t(e.play()) }) } }, i.prototype.pause = function() { this.techCall_("pause") }, i.prototype.paused = function() { return !1 !== this.techGet_("paused") }, i.prototype.played = function() { return this.techGet_("played") || _t(0, 0) }, i.prototype.scrubbing = function(e) { if (void 0 === e) return this.scrubbing_; this.scrubbing_ = !!e, e ? this.addClass("vjs-scrubbing") : this.removeClass("vjs-scrubbing") }, i.prototype.currentTime = function(e) { return void 0 !== e ? (e < 0 && (e = 0), void this.techCall_("setCurrentTime", e)) : (this.cache_ .currentTime = this.techGet_("currentTime") || 0, this.cache_.currentTime) }, i.prototype.duration = function(e) { if (void 0 === e) return void 0 !== this.cache_.duration ? this.cache_.duration : NaN; (e = parseFloat(e)) < 0 && (e = 1 / 0), e !== this.cache_.duration && (this.cache_.duration = e, e === 1 / 0 ? this.addClass("vjs-live") : this.removeClass("vjs-live"), this.trigger("durationchange")) }, i.prototype.remainingTime = function() { return this.duration() - this.currentTime() }, i.prototype.remainingTimeDisplay = function() { return Math.floor(this.duration()) - Math.floor(this.currentTime()) }, i.prototype.buffered = function() { var e = this.techGet_("buffered"); return e && e.length || (e = _t(0, 0)), e }, i.prototype.bufferedPercent = function() { return bt(this.buffered(), this.duration()) }, i.prototype.bufferedEnd = function() { var e = this.buffered(), t = this.duration(), i = e.end(e.length - 1); return i > t && (i = t), i }, i.prototype.volume = function(e) { var t = void 0; return void 0 !== e ? (t = Math.max(0, Math.min(1, parseFloat(e))), this.cache_.volume = t, this.techCall_( "setVolume", t), void(t > 0 && this.lastVolume_(t))) : (t = parseFloat(this.techGet_("volume")), isNaN( t) ? 1 : t) }, i.prototype.muted = function(e) { if (void 0 === e) return this.techGet_("muted") || !1; this.techCall_("setMuted", e) }, i.prototype.defaultMuted = function(e) { return void 0 !== e ? this.techCall_("setDefaultMuted", e) : this.techGet_("defaultMuted") || !1 }, i.prototype.lastVolume_ = function(e) { if (void 0 === e || 0 === e) return this.cache_.lastVolume; this.cache_.lastVolume = e }, i.prototype.supportsFullScreen = function() { return this.techGet_("supportsFullScreen") || !1 }, i.prototype.isFullscreen = function(e) { if (void 0 === e) return !!this.isFullscreen_; this.isFullscreen_ = !!e }, i.prototype.requestFullscreen = function() { var e = wt; this.isFullscreen(!0), e.requestFullscreen ? (be(l, e.fullscreenchange, De(this, function t(i) { this.isFullscreen(l[e.fullscreenElement]), !1 === this.isFullscreen() && we(l, e.fullscreenchange, t), this.trigger("fullscreenchange") })), this.el_[e.requestFullscreen]()) : this.tech_.supportsFullScreen() ? this.techCall_( "enterFullScreen") : (this.enterFullWindow(), this.trigger("fullscreenchange")) }, i.prototype.exitFullscreen = function() { var e = wt; this.isFullscreen(!1), e.requestFullscreen ? l[e.exitFullscreen]() : this.tech_.supportsFullScreen() ? this .techCall_("exitFullScreen") : (this.exitFullWindow(), this.trigger("fullscreenchange")) }, i.prototype.enterFullWindow = function() { this.isFullWindow = !0, this.docOrigOverflow = l.documentElement.style.overflow, be(l, "keydown", De(this, this.fullWindowOnEscKey)), l.documentElement.style.overflow = "hidden", j(l.body, "vjs-full-window"), this.trigger("enterFullWindow") }, i.prototype.fullWindowOnEscKey = function(e) { 27 === e.keyCode && (!0 === this.isFullscreen() ? this.exitFullscreen() : this.exitFullWindow()) }, i.prototype.exitFullWindow = function() { this.isFullWindow = !1, we(l, "keydown", this.fullWindowOnEscKey), l.documentElement.style.overflow = this .docOrigOverflow, H(l.body, "vjs-full-window"), this.trigger("exitFullWindow") }, i.prototype.canPlayType = function(e) { for (var t = void 0, i = 0, r = this.options_.techOrder; i < r.length; i++) { var n = r[i], a = _r.getTech(n); if (a || (a = Ye.getComponent(n)), a) { if (a.isSupported() && (t = a.canPlayType(e))) return t } else p.error('The "' + n + '" tech is undefined. Skipped browser support check for that tech.') } return "" }, i.prototype.selectSource = function(e) { var t, i = this, r = this.options_.techOrder.map(function(e) { return [e, _r.getTech(e)] }).filter(function(e) { var t = e[0], i = e[1]; return i ? i.isSupported() : (p.error('The "' + t + '" tech is undefined. Skipped browser support check for that tech.'), !1) }), n = function(e, t, i) { var r = void 0; return e.some(function(e) { return t.some(function(t) { if (r = i(e, t)) return !0 }) }), r }, a = function(e, t) { var r = e[0]; if (e[1].canPlaySource(t, i.options_[r.toLowerCase()])) return { source: t, tech: r } }; return (this.options_.sourceOrder ? n(e, r, (t = a, function(e, i) { return t(i, e) })) : n(r, e, a)) || !1 }, i.prototype.src = function(e) { var t = this; if (void 0 === e) return this.cache_.src || ""; var i = function e(t) { if (Array.isArray(t)) { var i = []; t.forEach(function(t) { t = e(t), Array.isArray(t) ? i = i.concat(t) : k(t) && i.push(t) }), t = i } else t = "string" == typeof t && t.trim() ? [Dr({ src: t })] : k(t) && "string" == typeof t.src && t.src && t.src.trim() ? [Dr(t)] : []; return t }(e); i.length ? (this.changingSrc_ = !0, this.cache_.sources = i, this.updateSourceCaches_(i[0]), Tr(this, i[0], function(e, r) { var n, a; if (t.middleware_ = r, t.cache_.sources = i, t.updateSourceCaches_(e), t.src_(e)) return i.length > 1 ? t.src(i.slice(1)) : (t.changingSrc_ = !1, t.setTimeout(function() { this.error({ code: 4, message: this.localize(this.options_.notSupportedMessage) }) }, 0), void t.triggerReady()); n = r, a = t.tech_, n.forEach(function(e) { return e.setTech && e.setTech(a) }) })) : this.setTimeout(function() { this.error({ code: 4, message: this.localize(this.options_.notSupportedMessage) }) }, 0) }, i.prototype.src_ = function(e) { var t, i, r = this, n = this.selectSource([e]); return !n || (t = n.tech, i = this.techName_, ze(t) !== ze(i) ? (this.changingSrc_ = !0, this.loadTech_(n .tech, n.source), this.tech_.ready(function() { r.changingSrc_ = !1 }), !1) : (this.ready(function() { this.tech_.constructor.prototype.hasOwnProperty("setSource") ? this.techCall_("setSource", e) : this.techCall_("src", e.src), this.changingSrc_ = !1 }, !0), !1)) }, i.prototype.load = function() { this.techCall_("load") }, i.prototype.reset = function() { this.tech_ && this.tech_.clearTracks("text"), this.loadTech_(this.options_.techOrder[0], null), this .techCall_("reset") }, i.prototype.currentSources = function() { var e = this.currentSource(), t = []; return 0 !== Object.keys(e).length && t.push(e), this.cache_.sources || t }, i.prototype.currentSource = function() { return this.cache_.source || {} }, i.prototype.currentSrc = function() { return this.currentSource() && this.currentSource().src || "" }, i.prototype.currentType = function() { return this.currentSource() && this.currentSource().type || "" }, i.prototype.preload = function(e) { return void 0 !== e ? (this.techCall_("setPreload", e), void(this.options_.preload = e)) : this.techGet_( "preload") }, i.prototype.autoplay = function(e) { if (void 0 === e) return this.options_.autoplay || !1; var t = void 0; "string" == typeof e && /(any|play|muted)/.test(e) ? (this.options_.autoplay = e, this.manualAutoplay_(e), t = !1) : this.options_.autoplay = !!e, t = t || this.options_.autoplay, this.tech_ && this.techCall_( "setAutoplay", t) }, i.prototype.playsinline = function(e) { return void 0 !== e ? (this.techCall_("setPlaysinline", e), this.options_.playsinline = e, this) : this .techGet_("playsinline") }, i.prototype.loop = function(e) { return void 0 !== e ? (this.techCall_("setLoop", e), void(this.options_.loop = e)) : this.techGet_("loop") }, i.prototype.stretch = function(e) { return void 0 !== e ? (this.techCall_("setStretch", e), this.options_.stretch = e, this) : this.techGet_( "stretch", e) }, i.prototype.fluent = function(e) { return void 0 != e ? (this.techCall_("setFluent", e), this.options_.fluent = e, this) : this.techGet_( "fluent", e) }, i.prototype.poster = function(e) { if (void 0 === e) return this.poster_; e || (e = ""), e !== this.poster_ && (this.poster_ = e, this.techCall_("setPoster", e), this .isPosterFromTech_ = !1, this.trigger("posterchange")) }, i.prototype.handleTechPosterChange_ = function() { if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) { var e = this.tech_.poster() || ""; e !== this.poster_ && (this.poster_ = e, this.isPosterFromTech_ = !0, this.trigger("posterchange")) } }, i.prototype.controls = function(e) { if (void 0 === e) return !!this.controls_; e = !!e, this.controls_ !== e && (this.controls_ = e, this.usingNativeControls() && this.techCall_( "setControls", e), this.controls_ ? (this.removeClass("vjs-controls-disabled"), this.addClass( "vjs-controls-enabled"), this.trigger("controlsenabled"), this.usingNativeControls() || this .addTechControlsListeners_()) : (this.removeClass("vjs-controls-enabled"), this.addClass( "vjs-controls-disabled"), this.trigger("controlsdisabled"), this.usingNativeControls() || this .removeTechControlsListeners_())) }, i.prototype.usingNativeControls = function(e) { if (void 0 === e) return !!this.usingNativeControls_; e = !!e, this.usingNativeControls_ !== e && (this.usingNativeControls_ = e, this.usingNativeControls_ ? ( this.addClass("vjs-using-native-controls"), this.trigger("usingnativecontrols")) : (this.removeClass( "vjs-using-native-controls"), this.trigger("usingcustomcontrols"))) }, i.prototype.error = function(e) { return void 0 === e ? this.error_ || null : null === e ? (this.error_ = e, this.removeClass("vjs-error"), void(this.errorDisplay && this.errorDisplay.close())) : (this.error_ = new Rt(e), this.addClass( "vjs-error"), p.error("(CODE:" + this.error_.code + " " + Rt.errorTypes[this.error_.code] + ")", this .error_.message, this.error_), void this.trigger("error")) }, i.prototype.reportUserActivity = function(e) { this.userActivity_ = !0 }, i.prototype.userActive = function(e) { if (void 0 === e) return this.userActive_; if ((e = !!e) !== this.userActive_) { if (this.userActive_ = e, this.userActive_) return this.userActivity_ = !0, this.removeClass( "vjs-user-inactive"), this.addClass("vjs-user-active"), void this.trigger("useractive"); this.tech_ && this.tech_.one("mousemove", function(e) { e.stopPropagation(), e.preventDefault() }), this.userActivity_ = !1, this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"), this.trigger("userinactive") } }, i.prototype.listenForUserActivity_ = function() { var e = void 0, t = void 0, i = void 0, r = De(this, this.reportUserActivity); this.on("mousedown", function() { r(), this.clearInterval(e), e = this.setInterval(r, 250) }), this.on("mousemove", function(e) { e.screenX === t && e.screenY === i || (t = e.screenX, i = e.screenY, r()) }), this.on("mouseup", function(t) { r(), this.clearInterval(e) }), this.on("keydown", r), this.on("keyup", r); var n = void 0; this.setInterval(function() { if (this.userActivity_) { this.userActivity_ = !1, this.userActive(!0), this.clearTimeout(n); var e = this.options_.inactivityTimeout; e <= 0 || (n = this.setTimeout(function() { this.userActivity_ || this.userActive(!1) }, e)) } }, 250) }, i.prototype.playbackRate = function(e) { if (void 0 === e) return this.tech_ && this.tech_.featuresPlaybackRate ? this.cache_.lastPlaybackRate || this.techGet_("playbackRate") : 1; this.techCall_("setPlaybackRate", e) }, i.prototype.defaultPlaybackRate = function(e) { return void 0 !== e ? this.techCall_("setDefaultPlaybackRate", e) : this.tech_ && this.tech_ .featuresPlaybackRate ? this.techGet_("defaultPlaybackRate") : 1 }, i.prototype.isAudio = function(e) { if (void 0 === e) return !!this.isAudio_; this.isAudio_ = !!e }, i.prototype.addTextTrack = function(e, t, i) { if (this.tech_) return this.tech_.addTextTrack(e, t, i) }, i.prototype.addRemoteTextTrack = function(e, t) { if (this.tech_) return this.tech_.addRemoteTextTrack(e, t) }, i.prototype.removeRemoteTextTrack = function() { var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).track, t = void 0 === e ? arguments[0] : e; if (this.tech_) return this.tech_.removeRemoteTextTrack(t) }, i.prototype.getVideoPlaybackQuality = function() { return this.techGet_("getVideoPlaybackQuality") }, i.prototype.videoWidth = function() { return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0 }, i.prototype.videoHeight = function() { return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0 }, i.prototype.language = function(e) { if (void 0 === e) return this.language_; this.language_ = String(e).toLowerCase() }, i.prototype.languages = function() { return Ke(i.prototype.options_.languages, this.languages_) }, i.prototype.toJSON = function() { var e = Ke(this.options_), t = e.tracks; e.tracks = []; for (var i = 0; i < t.length; i++) { var r = t[i]; (r = Ke(r)).player = void 0, e.tracks[i] = r } return e }, i.prototype.createModal = function(e, t) { var i = this; (t = t || {}).content = e || ""; var r = new Ut(this, t); return this.addChild(r), r.on("dispose", function() { i.removeChild(r) }), r.open(), r }, i.getTagSettings = function(e) { var t = { sources: [], tracks: [] }, i = W(e), r = i["data-setup"]; if (F(e, "vjs-fluid") && (i.fluid = !0), null !== r) { var n = Ot(r || "{}"), a = n[0], s = n[1]; a && p.error(a), A(i, s) } if (A(t, i), e.hasChildNodes()) for (var o = e.childNodes, u = 0, l = o.length; u < l; u++) { var d = o[u], c = d.nodeName.toLowerCase(); "source" === c ? t.sources.push(W(d)) : "track" === c && t.tracks.push(W(d)) } return t }, i.prototype.flexNotSupported_ = function() { var e = l.createElement("i"); return !("flexBasis" in e.style || "webkitFlexBasis" in e.style || "mozFlexBasis" in e.style || "msFlexBasis" in e.style || "msFlexOrder" in e.style) }, i }(Ye); Ni.names.forEach(function(e) { var t = Ni[e]; fa.prototype[t.getterName] = function() { return this.tech_ ? this.tech_[t.getterName]() : (this[t.privateName] = this[t.privateName] || new t .ListClass, this[t.privateName]) } }), fa.players = {}; var pa = n.navigator; fa.prototype.options_ = { techOrder: _r.defaultTechOrder_, html5: {}, flash: {}, inactivityTimeout: 2e3, playbackRates: [], children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager" ], language: pa && (pa.languages && pa.languages[0] || pa.userLanguage || pa.language) || "en", languages: {}, notSupportedMessage: "No compatible source was found for this media." }, ["ended", "seeking", "seekable", "networkState", "readyState"].forEach(function(e) { fa.prototype[e] = function() { return this.techGet_(e) } }), ca.forEach(function(e) { fa.prototype["handleTech" + ze(e) + "_"] = function() { return this.trigger(e) } }), Ye.registerComponent("Player", fa); var ma = {}, ga = function(e) { return ma.hasOwnProperty(e) }, va = function(e) { return ga(e) ? ma[e] : void 0 }, ya = function(e, t) { e.activePlugins_ = e.activePlugins_ || {}, e.activePlugins_[t] = !0 }, _a = function(e, t, i) { var r = (i ? "before" : "") + "pluginsetup"; e.trigger(r, t), e.trigger(r + ":" + t.name, t) }, ba = function(e, t) { return t.prototype.name = e, function() { _a(this, { name: e, plugin: t, instance: null }, !0); for (var i = arguments.length, r = Array(i), n = 0; n < i; n++) r[n] = arguments[n]; var a = new(Function.prototype.bind.apply(t, [null].concat([this].concat(r)))); return this[e] = function() { return a }, _a(this, a.getEventHash()), a } }, wa = function() { function e(t) { if (y(this, e), this.constructor === e) throw new Error( "Plugin must be sub-classed; not directly instantiated."); this.player = t, We(this), delete this.trigger, Xe(this, this.constructor.defaultState), ya(t, this.name), this.dispose = De(this, this.dispose), t.on("dispose", this.dispose) } return e.prototype.version = function() { return this.constructor.VERSION }, e.prototype.getEventHash = function() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; return e.name = this.name, e.plugin = this.constructor, e.instance = this, e }, e.prototype.trigger = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; return Ee(this.eventBusEl_, e, this.getEventHash(t)) }, e.prototype.handleStateChanged = function(e) {}, e.prototype.dispose = function() { var e = this.name, t = this.player; this.trigger("dispose"), this.off(), t.off("dispose", this.dispose), t.activePlugins_[e] = !1, this.player = this.state = null, t[e] = ba(e, ma[e]) }, e.isBasic = function(t) { var i = "string" == typeof t ? va(t) : t; return "function" == typeof i && !e.prototype.isPrototypeOf(i.prototype) }, e.registerPlugin = function(t, i) { if ("string" != typeof t) throw new Error('Illegal plugin name, "' + t + '", must be a string, was ' + ( void 0 === t ? "undefined" : v(t)) + "."); if (ga(t)) p.warn('A plugin named "' + t + '" already exists. You may want to avoid re-registering plugins!'); else if (fa.prototype.hasOwnProperty(t)) throw new Error('Illegal plugin name, "' + t + '", cannot share a name with an existing player method!'); if ("function" != typeof i) throw new Error('Illegal plugin for "' + t + '", must be a function, was ' + ( void 0 === i ? "undefined" : v(i)) + "."); return ma[t] = i, "plugin" !== t && (e.isBasic(i) ? fa.prototype[t] = function(e, t) { var i = function() { _a(this, { name: e, plugin: t, instance: null }, !0); var i = t.apply(this, arguments); return ya(this, e), _a(this, { name: e, plugin: t, instance: i }), i }; return Object.keys(t).forEach(function(e) { i[e] = t[e] }), i }(t, i) : fa.prototype[t] = ba(t, i)), i }, e.deregisterPlugin = function(e) { if ("plugin" === e) throw new Error("Cannot de-register base plugin."); ga(e) && (delete ma[e], delete fa.prototype[e]) }, e.getPlugins = function() { var e = void 0; return (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Object.keys(ma)).forEach(function( t) { var i = va(t); i && ((e = e || {})[t] = i) }), e }, e.getPluginVersion = function(e) { var t = va(e); return t && t.VERSION || "" }, e }(); wa.getPlugin = va, wa.BASE_PLUGIN_NAME = "plugin", wa.registerPlugin("plugin", wa), fa.prototype.usingPlugin = function(e) { return !!this.activePlugins_ && !0 === this.activePlugins_[e] }, fa.prototype.hasPlugin = function(e) { return !!ga(e) }; var Ea = function(e) { return 0 === e.indexOf("#") ? e.slice(1) : e }; function Ta(e, t, i) { var r = Ta.getPlayer(e); if (r) return t && p.warn('Player "' + e + '" is already initialised. Options will not be applied.'), i && r .ready(i), r; var n = "string" == typeof e ? ae("#" + Ea(e)) : e; if (!L(n)) throw new TypeError("The element or ID supplied is not valid. (videojs)"); l.body.contains(n) || p.warn("The element supplied is not included in the DOM"), t = t || {}, Ta.hooks( "beforesetup").forEach(function(e) { var i = e(n, Ke(t)); k(i) && !Array.isArray(i) ? t = Ke(t, i) : p.error("please return an object in beforesetup hooks") }); var a = Ye.getComponent("Player"); return r = new a(n, t, i), Ta.hooks("setup").forEach(function(e) { return e(r) }), r } if (Ta.hooks_ = {}, Ta.hooks = function(e, t) { return Ta.hooks_[e] = Ta.hooks_[e] || [], t && (Ta.hooks_[e] = Ta.hooks_[e].concat(t)), Ta.hooks_[e] }, Ta.hook = function(e, t) { Ta.hooks(e, t) }, Ta.hookOnce = function(e, t) { Ta.hooks(e, [].concat(t).map(function(t) { return function i() { return Ta.removeHook(e, i), t.apply(void 0, arguments) } })) }, Ta.removeHook = function(e, t) { var i = Ta.hooks(e).indexOf(t); return !(i <= -1) && (Ta.hooks_[e] = Ta.hooks_[e].slice(), Ta.hooks_[e].splice(i, 1), !0) }, !0 !== n.VIDEOJS_NO_DYNAMIC_STYLE && I()) { var Sa = ae(".vjs-styles-defaults"); if (!Sa) { Sa = Oe("vjs-styles-defaults"); var Aa = ae("head"); Aa && Aa.insertBefore(Sa, Aa.firstChild), Ce(Sa, "\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n " ) } } Me(1, Ta), Ta.VERSION = e, Ta.options = fa.prototype.options_, Ta.getPlayers = function() { return fa.players }, Ta.getPlayer = function(e) { var t = fa.players, i = void 0; if ("string" == typeof e) { var r = Ea(e), n = t[r]; if (n) return n; i = ae("#" + r) } else i = e; if (L(i)) { var a = i, s = a.player, o = a.playerId; if (s || t[o]) return s || t[o] } }, Ta.getAllPlayers = function() { return Object.keys(fa.players).map(function(e) { return fa.players[e] }).filter(Boolean) }, Ta.players = fa.players, Ta.getComponent = Ye.getComponent, Ta.registerComponent = function(e, t) { _r.isTech(t) && p.warn("The " + e + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)" ), Ye.registerComponent.call(Ye, e, t) }, Ta.getTech = _r.getTech, Ta.registerTech = _r.registerTech, Ta.use = function(e, t) { br[e] = br[e] || [], br[e].push(t) }, Object.defineProperty(Ta, "middleware", { value: {}, writeable: !1, enumerable: !0 }), Object.defineProperty(Ta.middleware, "TERMINATOR", { value: Er, writeable: !1, enumerable: !0 }), Ta.browser = gt, Ta.TOUCH_ENABLED = mt, Ta.extend = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = function() { e.apply(this, arguments) }, r = {}; for (var n in "object" === (void 0 === t ? "undefined" : v(t)) ? (t.constructor !== Object.prototype .constructor && (i = t.constructor), r = t) : "function" == typeof t && (i = t), function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t))); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (e.super_ = t) }(i, e), r) r.hasOwnProperty(n) && (i.prototype[n] = r[n]); return i }, Ta.mergeOptions = Ke, Ta.bind = De, Ta.registerPlugin = wa.registerPlugin, Ta.deregisterPlugin = wa .deregisterPlugin, Ta.plugin = function(e, t) { return p.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"), wa.registerPlugin(e, t) }, Ta.getPlugins = wa.getPlugins, Ta.getPlugin = wa.getPlugin, Ta.getPluginVersion = wa.getPluginVersion, Ta .addLanguage = function(e, t) { var i; return e = ("" + e).toLowerCase(), Ta.options.languages = Ke(Ta.options.languages, ((i = {})[e] = t, i)), Ta .options.languages[e] }, Ta.log = p, Ta.createTimeRange = Ta.createTimeRanges = _t, Ta.formatTime = Xr, Ta.setFormatTime = function(e) { qr = e }, Ta.resetFormatTime = function() { qr = Wr }, Ta.parseUrl = Jt, Ta.isCrossOrigin = ei, Ta.EventTarget = xe, Ta.on = be, Ta.one = Te, Ta.off = we, Ta .trigger = Ee, Ta.xhr = Ti, Ta.TextTrack = Oi, Ta.AudioTrack = Ci, Ta.VideoTrack = Di, ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent" ].forEach(function(e) { Ta[e] = function() { return p.warn("videojs." + e + "() is deprecated; use videojs.dom." + e + "() instead"), oe[e].apply(null, arguments) } }), Ta.computedStyle = M, Ta.dom = oe, Ta.url = ti; var ka = i(function(e, t) { var i, r, n, a, s; i = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/, r = /^([^\/?#]*)(.*)$/, n = /(?:\/|^)\.(?=\/)/g, a = /(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g, s = { buildAbsoluteURL: function(e, t, i) { if (i = i || {}, e = e.trim(), !(t = t.trim())) { if (!i.alwaysNormalize) return e; var n = s.parseURL(e); if (!n) throw new Error("Error trying to parse base URL."); return n.path = s.normalizePath(n.path), s.buildURLFromParts(n) } var a = s.parseURL(t); if (!a) throw new Error("Error trying to parse relative URL."); if (a.scheme) return i.alwaysNormalize ? (a.path = s.normalizePath(a.path), s.buildURLFromParts(a)) : t; var o = s.parseURL(e); if (!o) throw new Error("Error trying to parse base URL."); if (!o.netLoc && o.path && "/" !== o.path[0]) { var u = r.exec(o.path); o.netLoc = u[1], o.path = u[2] } o.netLoc && !o.path && (o.path = "/"); var l = { scheme: o.scheme, netLoc: a.netLoc, path: null, params: a.params, query: a.query, fragment: a.fragment }; if (!a.netLoc && (l.netLoc = o.netLoc, "/" !== a.path[0])) if (a.path) { var d = o.path, c = d.substring(0, d.lastIndexOf("/") + 1) + a.path; l.path = s.normalizePath(c) } else l.path = o.path, a.params || (l.params = o.params, a.query || (l.query = o.query)); return null === l.path && (l.path = i.alwaysNormalize ? s.normalizePath(a.path) : a.path), s .buildURLFromParts(l) }, parseURL: function(e) { var t = i.exec(e); return t ? { scheme: t[1] || "", netLoc: t[2] || "", path: t[3] || "", params: t[4] || "", query: t[5] || "", fragment: t[6] || "" } : null }, normalizePath: function(e) { for (e = e.split("").reverse().join("").replace(n, ""); e.length !== (e = e.replace(a, "")).length;); return e.split("").reverse().join("") }, buildURLFromParts: function(e) { return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment } }, e.exports = s }), Ra = function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, Ma = Object.assign || function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }, Oa = function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t))); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }, Ca = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t }, Da = function() { function e() { Ra(this, e), this.listeners = {} } return e.prototype.on = function(e, t) { this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t) }, e.prototype.off = function(e, t) { if (!this.listeners[e]) return !1; var i = this.listeners[e].indexOf(t); return this.listeners[e].splice(i, 1), i > -1 }, e.prototype.trigger = function(e) { var t = this.listeners[e], i = void 0, r = void 0, n = void 0; if (t) if (2 === arguments.length) for (r = t.length, i = 0; i < r; ++i) t[i].call(this, arguments[1]); else for (n = Array.prototype.slice.call(arguments, 1), r = t.length, i = 0; i < r; ++i) t[i].apply(this, n) }, e.prototype.dispose = function() { this.listeners = {} }, e.prototype.pipe = function(e) { this.on("data", function(t) { e.push(t) }) }, e }(), Ia = function(e) { function t() { Ra(this, t); var i = Ca(this, e.call(this)); return i.buffer = "", i } return Oa(t, e), t.prototype.push = function(e) { var t = void 0; for (this.buffer += e, t = this.buffer.indexOf("\n"); t > -1; t = this.buffer.indexOf("\n")) this.trigger( "data", this.buffer.substring(0, t)), this.buffer = this.buffer.substring(t + 1) }, t }(Da), La = function(e) { for (var t = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), i = {}, r = t.length, n = void 0; r--;) "" !== t[r] && ((n = /([^=]*)=(.*)/.exec(t[r]).slice(1))[0] = n[0].replace(/^\s+|\s+$/g, ""), n[ 1] = n[1].replace(/^\s+|\s+$/g, ""), n[1] = n[1].replace(/^['"](.*)['"]$/g, "$1"), i[n[0]] = n[1]); return i }, xa = function(e) { function t() { Ra(this, t); var i = Ca(this, e.call(this)); return i.customParsers = [], i } return Oa(t, e), t.prototype.push = function(e) { var t = void 0, i = void 0; if (0 !== (e = e.replace(/^[\u0000\s]+|[\u0000\s]+$/g, "")).length) if ("#" === e[0]) { for (var r = 0; r < this.customParsers.length; r++) if (this.customParsers[r].call(this, e)) return; if (0 === e.indexOf("#EXT")) if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e)) this.trigger("data", { type: "tag", tagType: "m3u" }); else { if (t = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "inf" }, t[1] && (i.duration = parseFloat(t[1])), t[2] && (i.title = t[2]), void this.trigger("data", i); if (t = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "targetduration" }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "totalduration" }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "version" }, t[1] && (i.version = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "media-sequence" }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "discontinuity-sequence" }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "playlist-type" }, t[1] && (i.playlistType = t[1]), void this.trigger("data", i); if (t = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "byterange" }, t[1] && (i.length = parseInt(t[1], 10)), t[2] && (i.offset = parseInt(t[2], 10)), void this .trigger("data", i); if (t = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return i = { type: "tag", tagType: "allow-cache" }, t[1] && (i.allowed = !/NO/.test(t[1])), void this.trigger("data", i); if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) { if (i = { type: "tag", tagType: "map" }, t[1]) { var n = La(t[1]); if (n.URI && (i.uri = n.URI), n.BYTERANGE) { var a = n.BYTERANGE.split("@"), s = a[0], o = a[1]; i.byterange = {}, s && (i.byterange.length = parseInt(s, 10)), o && (i.byterange.offset = parseInt(o, 10)) } } this.trigger("data", i) } else if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) { if (i = { type: "tag", tagType: "stream-inf" }, t[1]) { if (i.attributes = La(t[1]), i.attributes.RESOLUTION) { var u = i.attributes.RESOLUTION.split("x"), l = {}; u[0] && (l.width = parseInt(u[0], 10)), u[1] && (l.height = parseInt(u[1], 10)), i.attributes .RESOLUTION = l } i.attributes.BANDWIDTH && (i.attributes.BANDWIDTH = parseInt(i.attributes.BANDWIDTH, 10)), i .attributes["PROGRAM-ID"] && (i.attributes["PROGRAM-ID"] = parseInt(i.attributes[ "PROGRAM-ID"], 10)) } this.trigger("data", i) } else { if (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "media" }, t[1] && (i.attributes = La(t[1])), void this.trigger("data", i); if (t = /^#EXT-X-ENDLIST/.exec(e)) this.trigger("data", { type: "tag", tagType: "endlist" }); else if (t = /^#EXT-X-DISCONTINUITY/.exec(e)) this.trigger("data", { type: "tag", tagType: "discontinuity" }); else { if (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "program-date-time" }, t[1] && (i.dateTimeString = t[1], i.dateTimeObject = new Date(t[1])), void this.trigger( "data", i); if (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "key" }, t[1] && (i.attributes = La(t[1]), i.attributes.IV && ("0x" === i.attributes.IV.substring( 0, 2).toLowerCase() && (i.attributes.IV = i.attributes.IV.substring(2)), i.attributes .IV = i.attributes.IV.match(/.{8}/g), i.attributes.IV[0] = parseInt(i.attributes.IV[0], 16), i.attributes.IV[1] = parseInt(i.attributes.IV[1], 16), i.attributes.IV[2] = parseInt(i.attributes.IV[2], 16), i.attributes.IV[3] = parseInt(i.attributes.IV[3], 16), i.attributes.IV = new Uint32Array(i.attributes.IV))), void this.trigger("data", i); if (t = /^#EXT-X-START:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "start" }, t[1] && (i.attributes = La(t[1]), i.attributes["TIME-OFFSET"] = parseFloat(i.attributes[ "TIME-OFFSET"]), i.attributes.PRECISE = /YES/.test(i.attributes.PRECISE)), void this .trigger("data", i); if (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-out-cont" }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i); if (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-out" }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i); if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-in" }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i); this.trigger("data", { type: "tag", data: e.slice(4) }) } } } else this.trigger("data", { type: "comment", text: e.slice(1) }) } else this.trigger("data", { type: "uri", uri: e }) }, t.prototype.addParser = function(e) { var t = this, i = e.expression, r = e.customType, n = e.dataParser, a = e.segment; "function" != typeof n && (n = function(e) { return e }), this.customParsers.push(function(e) { if (i.exec(e)) return t.trigger("data", { type: "custom", data: n(e), customType: r, segment: a }), !0 }) }, t }(Da), Pa = function(e) { function t() { Ra(this, t); var i = Ca(this, e.call(this)); i.lineStream = new Ia, i.parseStream = new xa, i.lineStream.pipe(i.parseStream); var r = i, n = [], a = {}, s = void 0, o = void 0, u = { AUDIO: {}, VIDEO: {}, "CLOSED-CAPTIONS": {}, SUBTITLES: {} }, l = 0; return i.manifest = { allowCache: !0, discontinuityStarts: [], segments: [] }, i.parseStream.on("data", function(e) { var t = void 0, i = void 0; ({ tag: function() { (({ "allow-cache": function() { this.manifest.allowCache = e.allowed, "allowed" in e || (this.trigger("info", { message: "defaulting allowCache to YES" }), this.manifest.allowCache = !0) }, byterange: function() { var t = {}; "length" in e && (a.byterange = t, t.length = e.length, "offset" in e || (this .trigger("info", { message: "defaulting offset to zero" }), e.offset = 0)), "offset" in e && (a.byterange = t, t.offset = e.offset) }, endlist: function() { this.manifest.endList = !0 }, inf: function() { "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this.trigger( "info", { message: "defaulting media sequence to zero" })), "discontinuitySequence" in this.manifest || (this.manifest .discontinuitySequence = 0, this.trigger("info", { message: "defaulting discontinuity sequence to zero" })), e.duration > 0 && (a.duration = e.duration), 0 === e.duration && (a .duration = .01, this.trigger("info", { message: "updating zero segment duration to a small value" })), this.manifest.segments = n }, key: function() { e.attributes ? "NONE" !== e.attributes.METHOD ? e.attributes.URI ? (e.attributes .METHOD || this.trigger("warn", { message: "defaulting key method to AES-128" }), o = { method: e.attributes.METHOD || "AES-128", uri: e.attributes.URI }, void 0 !== e.attributes.IV && (o.iv = e.attributes.IV)) : this.trigger( "warn", { message: "ignoring key declaration without URI" }) : o = null : this.trigger("warn", { message: "ignoring key declaration without attribute list" }) }, "media-sequence": function() { isFinite(e.number) ? this.manifest.mediaSequence = e.number : this.trigger("warn", { message: "ignoring invalid media sequence: " + e.number }) }, "discontinuity-sequence": function() { isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, l = e.number) : this.trigger("warn", { message: "ignoring invalid discontinuity sequence: " + e.number }) }, "playlist-type": function() { /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e.playlistType : this .trigger("warn", { message: "ignoring unknown playlist type: " + e.playlist }) }, map: function() { s = {}, e.uri && (s.uri = e.uri), e.byterange && (s.byterange = e.byterange) }, "stream-inf": function() { this.manifest.playlists = n, this.manifest.mediaGroups = this.manifest.mediaGroups || u, e.attributes ? (a.attributes || (a.attributes = {}), Ma(a.attributes, e .attributes)) : this.trigger("warn", { message: "ignoring empty stream-inf attributes" }) }, media: function() { if (this.manifest.mediaGroups = this.manifest.mediaGroups || u, e.attributes && e .attributes.TYPE && e.attributes["GROUP-ID"] && e.attributes.NAME) { var r = this.manifest.mediaGroups[e.attributes.TYPE]; r[e.attributes["GROUP-ID"]] = r[e.attributes["GROUP-ID"]] || {}, t = r[e.attributes[ "GROUP-ID"]], (i = { default: /yes/i.test(e.attributes.DEFAULT) }).default ? i.autoselect = !0 : i.autoselect = /yes/i.test(e.attributes .AUTOSELECT), e.attributes.LANGUAGE && (i.language = e.attributes.LANGUAGE), e .attributes.URI && (i.uri = e.attributes.URI), e.attributes["INSTREAM-ID"] && (i .instreamId = e.attributes["INSTREAM-ID"]), e.attributes.CHARACTERISTICS && (i .characteristics = e.attributes.CHARACTERISTICS), e.attributes.FORCED && (i .forced = /yes/i.test(e.attributes.FORCED)), t[e.attributes.NAME] = i } else this.trigger("warn", { message: "ignoring incomplete or missing media group" }) }, discontinuity: function() { l += 1, a.discontinuity = !0, this.manifest.discontinuityStarts.push(n.length) }, "program-date-time": function() { void 0 === this.manifest.dateTimeString && (this.manifest.dateTimeString = e .dateTimeString, this.manifest.dateTimeObject = e.dateTimeObject), a .dateTimeString = e.dateTimeString, a.dateTimeObject = e.dateTimeObject }, targetduration: function() { !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", { message: "ignoring invalid target duration: " + e.duration }) : this.manifest.targetDuration = e.duration }, totalduration: function() { !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", { message: "ignoring invalid total duration: " + e.duration }) : this.manifest.totalDuration = e.duration }, start: function() { e.attributes && !isNaN(e.attributes["TIME-OFFSET"]) ? this.manifest.start = { timeOffset: e.attributes["TIME-OFFSET"], precise: e.attributes.PRECISE } : this.trigger("warn", { message: "ignoring start declaration without appropriate attribute list" }) }, "cue-out": function() { a.cueOut = e.data }, "cue-out-cont": function() { a.cueOutCont = e.data }, "cue-in": function() { a.cueIn = e.data } })[e.tagType] || function() {}).call(r) }, uri: function() { a.uri = e.uri, n.push(a), !this.manifest.targetDuration || "duration" in a || (this.trigger( "warn", { message: "defaulting segment duration to the target duration" }), a.duration = this.manifest.targetDuration), o && (a.key = o), a.timeline = l, s && (a .map = s), a = {} }, comment: function() {}, custom: function() { e.segment ? (a.custom = a.custom || {}, a.custom[e.customType] = e.data) : (this.manifest .custom = this.manifest.custom || {}, this.manifest.custom[e.customType] = e.data) } })[e.type].call(r) }), i } return Oa(t, e), t.prototype.push = function(e) { this.lineStream.push(e) }, t.prototype.end = function() { this.lineStream.push("\n") }, t.prototype.addParser = function(e) { this.parseStream.addParser(e) }, t }(Da), Ua = function(e) { var t, i = e.attributes, r = e.segments, n = { attributes: (t = { NAME: i.id, AUDIO: "audio", SUBTITLES: "subs", RESOLUTION: { width: i.width, height: i.height }, CODECS: i.codecs, BANDWIDTH: i.bandwidth }, t["PROGRAM-ID"] = 1, t), uri: "", endList: "static" === (i.type || "static"), timeline: i.periodIndex, resolvedUri: "", targetDuration: i.duration, segments: r, mediaSequence: r.length ? r[0].number : 1 }; return i.contentProtection && (n.contentProtection = i.contentProtection), n }, Na = "function" == typeof Symbol && "symbol" === v(Symbol.iterator) ? function(e) { return void 0 === e ? "undefined" : v(e) } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : void 0 === e ? "undefined" : v(e) }, Ba = function(e) { return !!e && "object" === (void 0 === e ? "undefined" : Na(e)) }, Fa = function e() { for (var t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r]; return i.reduce(function(t, i) { return Object.keys(i).forEach(function(r) { Array.isArray(t[r]) && Array.isArray(i[r]) ? t[r] = t[r].concat(i[r]) : Ba(t[r]) && Ba(i[r]) ? t[ r] = e(t[r], i[r]) : t[r] = i[r] }), t }, {}) }, ja = function(e, t) { return /^[a-z]+:/i.test(t) ? t : (/\/\//i.test(e) || (e = ka.buildAbsoluteURL(n.location.href, e)), ka .buildAbsoluteURL(e, t)) }, Ha = function(e) { var t = e.baseUrl, i = void 0 === t ? "" : t, r = e.source, n = void 0 === r ? "" : r, a = e.range, s = void 0 === a ? "" : a, o = { uri: n, resolvedUri: ja(i || "", n) }; if (s) { var u = s.split("-"), l = parseInt(u[0], 10), d = parseInt(u[1], 10); o.byterange = { length: d - l, offset: l } } return o }, Ga = function(e, t, i) { var r = e.NOW, n = e.clientOffset, a = e.availabilityStartTime, s = e.timescale, o = void 0 === s ? 1 : s, u = e.start, l = void 0 === u ? 0 : u, d = e.minimumUpdatePeriod, c = (r + n) / 1e3 + (void 0 === d ? 0 : d) - (a + l); return Math.ceil((c * o - t) / i) }, Va = function(e, t) { for (var i = e.type, r = void 0 === i ? "static" : i, n = e.minimumUpdatePeriod, a = void 0 === n ? 0 : n, s = e .media, o = void 0 === s ? "" : s, u = e.sourceDuration, l = e.timescale, d = void 0 === l ? 1 : l, c = e .startNumber, h = void 0 === c ? 1 : c, f = e.periodIndex, p = [], m = -1, g = 0; g < t.length; g++) { var v = t[g], y = v.d, _ = v.r || 0, b = v.t || 0; m < 0 && (m = b), b && b > m && (m = b); var w = void 0; if (_ < 0) { var E = g + 1; w = E === t.length ? "dynamic" === r && a > 0 && o.indexOf("$Number$") > 0 ? Ga(e, m, y) : (u * d - m) / y : (t[E].t - m) / y } else w = _ + 1; for (var T = h + p.length + w, S = h + p.length; S < T;) p.push({ number: S, duration: y / d, time: m, timeline: f }), m += y, S++ } return p }, Wa = function(e) { return e.reduce(function(e, t) { return e.concat(t) }, []) }, qa = function(e) { if (!e.length) return []; for (var t = [], i = 0; i < e.length; i++) t.push(e[i]); return t }, Xa = { static: function(e) { var t = e.duration, i = e.timescale, r = void 0 === i ? 1 : i, n = e.sourceDuration; return { start: 0, end: Math.ceil(n / (t / r)) } }, dynamic: function(e) { var t = e.NOW, i = e.clientOffset, r = e.availabilityStartTime, n = e.timescale, a = void 0 === n ? 1 : n, s = e.duration, o = e.start, u = void 0 === o ? 0 : o, l = e.minimumUpdatePeriod, d = void 0 === l ? 0 : l, c = e.timeShiftBufferDepth, h = void 0 === c ? 1 / 0 : c, f = (t + i) / 1e3, p = r + u, m = f + d - p, g = Math.ceil(m * a / s), v = Math.floor((f - p - h) * a / s), y = Math.floor((f - p) * a / s); return { start: Math.max(0, v), end: Math.min(g, y) } } }, za = function(e) { var t = e.type, i = void 0 === t ? "static" : t, r = e.duration, n = e.timescale, a = void 0 === n ? 1 : n, s = e.sourceDuration, o = Xa[i](e), u = function(e, t) { for (var i = [], r = e; r < t; r++) i.push(r); return i }(o.start, o.end).map(function(e) { return function(t, i) { var r = e.duration, n = e.timescale, a = void 0 === n ? 1 : n, s = e.periodIndex, o = e.startNumber; return { number: (void 0 === o ? 1 : o) + t, duration: r / a, timeline: s, time: i * r } } }(e)); if ("static" === i) { var l = u.length - 1; u[l].duration = s - r / a * l } return u }, Ka = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g, Ya = function(e, t) { return e.replace(Ka, function(e) { return function(t, i, r, n) { if ("$$" === t) return "$"; if (void 0 === e[i]) return t; var a = "" + e[i]; return "RepresentationID" === i ? a : (n = r ? parseInt(n, 10) : 1, a.length >= n ? a : "" + new Array(n - a.length + 1).join("0") + a) } }(t)) }, Qa = function(e, t) { var i = { RepresentationID: e.id, Bandwidth: e.bandwidth || 0 }, r = e.initialization, n = void 0 === r ? { sourceURL: "", range: "" } : r, a = Ha({ baseUrl: e.baseUrl, source: Ya(n.sourceURL, i), range: n.range }); return function(e, t) { return e.duration || t ? e.duration ? za(e) : Va(e, t) : [{ number: e.startNumber || 1, duration: e.sourceDuration, time: 0, timeline: e.periodIndex }] }(e, t).map(function(t) { i.Number = t.number, i.Time = t.time; var r = Ya(e.media || "", i); return { uri: r, timeline: t.timeline, duration: t.duration, resolvedUri: ja(e.baseUrl || "", r), map: a, number: t.number } }) }, Ja = "INVALID_NUMBER_OF_PERIOD", Za = "DASH_EMPTY_MANIFEST", $a = "DASH_INVALID_XML", es = "NO_BASE_URL", ts = "SEGMENT_TIME_UNSPECIFIED", is = "UNSUPPORTED_UTC_TIMING_SCHEME", rs = function(e, t) { var i = e.duration, r = e.segmentUrls, n = void 0 === r ? [] : r; if (!i && !t || i && t) throw new Error(ts); var a = n.map(function(t) { return function(e, t) { var i = e.baseUrl, r = e.initialization, n = void 0 === r ? {} : r, a = Ha({ baseUrl: i, source: n.sourceURL, range: n.range }), s = Ha({ baseUrl: i, source: t.media, range: t.mediaRange }); return s.map = a, s }(e, t) }), s = void 0; return i && (s = za(e)), t && (s = Va(e, t)), s.map(function(e, t) { if (a[t]) { var i = a[t]; return i.timeline = e.timeline, i.duration = e.duration, i.number = e.number, i } }).filter(function(e) { return e }) }, ns = function(e) { var t = e.baseUrl, i = e.initialization, r = void 0 === i ? {} : i, n = e.sourceDuration, a = e.timescale, s = void 0 === a ? 1 : a, o = e.indexRange, u = void 0 === o ? "" : o, l = e.duration; if (!t) throw new Error(es); var d = Ha({ baseUrl: t, source: r.sourceURL, range: r.range }), c = Ha({ baseUrl: t, source: t, range: u }); if (c.map = d, l) { var h = za(e); h.length && (c.duration = h[0].duration, c.timeline = h[0].timeline) } else n && (c.duration = n / s, c.timeline = 0); return c.number = 0, [c] }, as = function(e) { var t = e.attributes, i = e.segmentInfo, r = void 0, n = void 0; if (i.template ? (n = Qa, r = Fa(t, i.template)) : i.base ? (n = ns, r = Fa(t, i.base)) : i.list && (n = rs, r = Fa(t, i.list)), !n) return { attributes: t }; var a = n(r, i.timeline); if (r.duration) { var s = r, o = s.duration, u = s.timescale, l = void 0 === u ? 1 : u; r.duration = o / l } else a.length ? r.duration = a.reduce(function(e, t) { return Math.max(e, Math.ceil(t.duration)) }, 0) : r.duration = 0; return { attributes: r, segments: a } }, ss = function(e, t) { return qa(e.childNodes).filter(function(e) { return e.tagName === t }) }, os = function(e) { return e.textContent.trim() }, us = function(e) { var t = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e); if (!t) return 0; var i = t.slice(1), r = i[0], n = i[1], a = i[2], s = i[3], o = i[4], u = i[5]; return 31536e3 * parseFloat(r || 0) + 2592e3 * parseFloat(n || 0) + 86400 * parseFloat(a || 0) + 3600 * parseFloat(s || 0) + 60 * parseFloat(o || 0) + parseFloat(u || 0) }, ls = { mediaPresentationDuration: function(e) { return us(e) }, availabilityStartTime: function(e) { return /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t = e) && (t += "Z"), Date.parse(t) / 1e3; var t }, minimumUpdatePeriod: function(e) { return us(e) }, timeShiftBufferDepth: function(e) { return us(e) }, start: function(e) { return us(e) }, width: function(e) { return parseInt(e, 10) }, height: function(e) { return parseInt(e, 10) }, bandwidth: function(e) { return parseInt(e, 10) }, startNumber: function(e) { return parseInt(e, 10) }, timescale: function(e) { return parseInt(e, 10) }, duration: function(e) { var t = parseInt(e, 10); return isNaN(t) ? us(e) : t }, d: function(e) { return parseInt(e, 10) }, t: function(e) { return parseInt(e, 10) }, r: function(e) { return parseInt(e, 10) }, DEFAULT: function(e) { return e } }, ds = function(e) { return e && e.attributes ? qa(e.attributes).reduce(function(e, t) { var i = ls[t.name] || ls.DEFAULT; return e[t.name] = i(t.value), e }, {}) : {} }; var cs, hs, fs, ps, ms, gs, vs, ys, _s, bs, ws, Es, Ts, Ss, As, ks, Rs, Ms, Os, Cs, Ds, Is, Ls, xs, Ps, Us, Ns, Bs, Fs, js, Hs, Gs, Vs, Ws, qs, Xs, zs, Ks, Ys, Qs, Js, Zs, $s = { "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey", "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha", "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready", "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime" }, eo = function(e, t) { return t.length ? Wa(e.map(function(e) { return t.map(function(t) { return ja(e, os(t)) }) })) : e }, to = function(e) { var t = ss(e, "SegmentTemplate")[0], i = ss(e, "SegmentList")[0], r = i && ss(i, "SegmentURL").map(function(e) { return Fa({ tag: "SegmentURL" }, ds(e)) }), n = ss(e, "SegmentBase")[0], a = i || t, s = a && ss(a, "SegmentTimeline")[0], o = i || n || t, u = o && ss(o, "Initialization")[0], l = t && ds(t); l && u ? l.initialization = u && ds(u) : l && l.initialization && (l.initialization = { sourceURL: l.initialization }); var d = { template: l, timeline: s && ss(s, "S").map(function(e) { return ds(e) }), list: i && Fa(ds(i), { segmentUrls: r, initialization: ds(u) }), base: n && Fa(ds(n), { initialization: ds(u) }) }; return Object.keys(d).forEach(function(e) { d[e] || delete d[e] }), d }, io = function(e) { return e.reduce(function(e, t) { var i = ds(t), r = $s[i.schemeIdUri]; if (r) { e[r] = { attributes: i }; var a = ss(t, "cenc:pssh")[0]; if (a) { var s = os(a), o = s && function(e) { for (var t = n.atob(e), i = new Uint8Array(t.length), r = 0; r < t.length; r++) i[r] = t .charCodeAt(r); return i }(s); e[r].pssh = o } } return e }, {}) }, ro = function(e, t, i) { return function(r) { var n = ds(r), a = eo(t, ss(r, "BaseURL")), s = ss(r, "Role")[0], o = { role: ds(s) }, u = Fa(e, n, o), l = io(ss(r, "ContentProtection")); Object.keys(l).length && (u = Fa(u, { contentProtection: l })); var d = to(r), c = ss(r, "Representation"), h = Fa(i, d); return Wa(c.map(function(e, t, i) { return function(r) { var n = ss(r, "BaseURL"), a = eo(t, n), s = Fa(e, ds(r)), o = to(r); return a.map(function(e) { return { segmentInfo: Fa(i, o), attributes: Fa(s, { baseUrl: e }) } }) } }(u, a, h))) } }, no = function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = t.manifestUri, r = void 0 === i ? "" : i, n = t.NOW, a = void 0 === n ? Date.now() : n, s = t.clientOffset, o = void 0 === s ? 0 : s, u = ss(e, "Period"); if (1 !== u.length) throw new Error(Ja); var l = ds(e), d = eo([r], ss(e, "BaseURL")); return l.sourceDuration = l.mediaPresentationDuration || 0, l.NOW = a, l.clientOffset = o, Wa(u.map(function(e, t) { return function(i, r) { var n = eo(t, ss(i, "BaseURL")), a = ds(i), s = Fa(e, a, { periodIndex: r }), o = ss(i, "AdaptationSet"), u = to(i); return Wa(o.map(ro(s, n, u))) } }(l, d))) }, ao = function(e) { if ("" === e) throw new Error(Za); var t = (new n.DOMParser).parseFromString(e, "application/xml"), i = t && "MPD" === t.documentElement.tagName ? t.documentElement : null; if (!i || i && i.getElementsByTagName("parsererror").length > 0) throw new Error($a); return i }, so = function(e, t) { return function(e) { var t; if (!e.length) return {}; var i = e[0].attributes, r = i.sourceDuration, n = i.minimumUpdatePeriod, a = void 0 === n ? 0 : n, s = e.filter(function(e) { var t = e.attributes; return "video/mp4" === t.mimeType || "video" === t.contentType }).map(Ua), o = e.filter(function(e) { var t = e.attributes; return "audio/mp4" === t.mimeType || "audio" === t.contentType }), u = e.filter(function(e) { var t = e.attributes; return "text/vtt" === t.mimeType || "text" === t.contentType }), l = { allowCache: !0, discontinuityStarts: [], segments: [], endList: !0, mediaGroups: (t = { AUDIO: {}, VIDEO: {} }, t["CLOSED-CAPTIONS"] = {}, t.SUBTITLES = {}, t), uri: "", duration: r, playlists: s, minimumUpdatePeriod: 1e3 * a }; return o.length && (l.mediaGroups.AUDIO.audio = o.reduce(function(e, t) { var i = t.attributes.role && t.attributes.role.value || "main", r = t.attributes.lang || "", n = "main"; return r && (n = t.attributes.lang + " (" + i + ")"), e[n] && e[n].playlists[0].attributes .BANDWIDTH > t.attributes.bandwidth ? e : (e[n] = { language: r, autoselect: !0, default: "main" === i, playlists: [function(e) { var t, i = e.attributes, r = e.segments, n = { attributes: (t = { NAME: i.id, BANDWIDTH: i.bandwidth, CODECS: i.codecs }, t["PROGRAM-ID"] = 1, t), uri: "", endList: "static" === (i.type || "static"), timeline: i.periodIndex, resolvedUri: "", targetDuration: i.duration, segments: r, mediaSequence: r.length ? r[0].number : 1 }; return i.contentProtection && (n.contentProtection = i.contentProtection), n }(t)], uri: "" }, e) }, {})), u.length && (l.mediaGroups.SUBTITLES.subs = function(e) { return e.reduce(function(e, t) { var i, r, n, a, s = t.attributes.lang || "text"; return e[s] ? e : (e[s] = { language: s, default: !1, autoselect: !1, playlists: [(i = t, n = i.attributes, a = i.segments, void 0 === a && (a = [{ uri: n.baseUrl, timeline: n.periodIndex, resolvedUri: n.baseUrl || "", duration: n.sourceDuration, number: 0 }], n.duration = n.sourceDuration), { attributes: (r = { NAME: n.id, BANDWIDTH: n.bandwidth }, r["PROGRAM-ID"] = 1, r), uri: "", endList: "static" === (n.type || "static"), timeline: n.periodIndex, resolvedUri: n.baseUrl || "", targetDuration: n.duration, segments: a, mediaSequence: a.length ? a[0].number : 1 })], uri: "" }, e) }, {}) }(u)), l }(no(ao(e), t).map(as)) }, oo = function(e) { return function(e) { var t = ss(e, "UTCTiming")[0]; if (!t) return null; var i = ds(t); switch (i.schemeIdUri) { case "urn:mpeg:dash:utc:http-head:2014": case "urn:mpeg:dash:utc:http-head:2012": i.method = "HEAD"; break; case "urn:mpeg:dash:utc:http-xsdate:2014": case "urn:mpeg:dash:utc:http-iso:2014": case "urn:mpeg:dash:utc:http-xsdate:2012": case "urn:mpeg:dash:utc:http-iso:2012": i.method = "GET"; break; case "urn:mpeg:dash:utc:direct:2014": case "urn:mpeg:dash:utc:direct:2012": i.method = "DIRECT", i.value = Date.parse(i.value); break; case "urn:mpeg:dash:utc:http-ntp:2014": case "urn:mpeg:dash:utc:ntp:2014": case "urn:mpeg:dash:utc:sntp:2014": default: throw new Error(is) } return i }(ao(e)) }, uo = { toUnsigned: function(e) { return e >>> 0 } }, lo = uo.toUnsigned, co = Object.freeze({ default: uo, __moduleExports: uo, toUnsigned: lo }), ho = (co && uo || co).toUnsigned, fo = { findBox: cs = function(e, t) { var i, r, n, a, s, o = []; if (!t.length) return null; for (i = 0; i < e.byteLength;) r = ho(e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3]), n = hs(e .subarray(i + 4, i + 8)), a = r > 1 ? i + r : e.byteLength, n === t[0] && (1 === t.length ? o.push(e .subarray(i + 8, a)) : (s = cs(e.subarray(i + 8, a), t.slice(1))).length && (o = o.concat(s))), i = a; return o }, parseType: hs = function(e) { var t = ""; return t += String.fromCharCode(e[0]), t += String.fromCharCode(e[1]), t += String.fromCharCode(e[2]), t += String.fromCharCode(e[3]) }, timescale: function(e) { return cs(e, ["moov", "trak"]).reduce(function(e, t) { var i, r, n, a, s; return (i = cs(t, ["tkhd"])[0]) ? (r = i[0], a = ho(i[n = 0 === r ? 12 : 20] << 24 | i[n + 1] << 16 | i[n + 2] << 8 | i[n + 3]), (s = cs(t, ["mdia", "mdhd"])[0]) ? (n = 0 === (r = s[0]) ? 12 : 20, e[a] = ho(s[n] << 24 | s[n + 1] << 16 | s[n + 2] << 8 | s[n + 3]), e) : null) : null }, {}) }, startTime: function(e, t) { var i, r, n; return i = cs(t, ["moof", "traf"]), r = [].concat.apply([], i.map(function(t) { return cs(t, ["tfhd"]).map(function(i) { var r, n; return r = ho(i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7]), n = e[r] || 9e4, (cs(t, ["tfdt"]) .map(function(e) { var t, i; return t = e[0], i = ho(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]), 1 === t && (i *= Math.pow(2, 32), i += ho(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11])), i })[0] || 1 / 0) / n }) })), n = Math.min.apply(null, r), isFinite(n) ? n : 0 }, videoTrackIds: function(e) { var t = []; return cs(e, ["moov", "trak"]).forEach(function(e) { var i = cs(e, ["mdia", "hdlr"]), r = cs(e, ["tkhd"]); i.forEach(function(e, i) { var n, a, s = hs(e.subarray(8, 12)), o = r[i]; "vide" === s && (a = 0 === (n = new DataView(o.buffer, o.byteOffset, o.byteLength)).getUint8( 0) ? n.getUint32(12) : n.getUint32(20), t.push(a)) }) }), t } }, po = Math.pow(2, 32) - 1; ! function() { var e; if (xs = { avc1: [], avcC: [], btrt: [], dinf: [], dref: [], esds: [], ftyp: [], hdlr: [], mdat: [], mdhd: [], mdia: [], mfhd: [], minf: [], moof: [], moov: [], mp4a: [], mvex: [], mvhd: [], sdtp: [], smhd: [], stbl: [], stco: [], stsc: [], stsd: [], stsz: [], stts: [], styp: [], tfdt: [], tfhd: [], traf: [], trak: [], trun: [], trex: [], tkhd: [], vmhd: [] }, "undefined" != typeof Uint8Array) { for (e in xs) xs.hasOwnProperty(e) && (xs[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e.charCodeAt( 3)]); Ps = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]), Ns = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]), Us = new Uint8Array([0, 0, 0, 1]), Bs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0 ]), Fs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0 ]), js = { video: Bs, audio: Fs }, Vs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), Gs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), Ws = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), qs = Ws, Xs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), zs = Ws, Hs = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]) } }(), fs = function(e) { var t, i, r = [], n = 0; for (t = 1; t < arguments.length; t++) r.push(arguments[t]); for (t = r.length; t--;) n += r[t].byteLength; for (i = new Uint8Array(n + 8), new DataView(i.buffer, i.byteOffset, i.byteLength).setUint32(0, i.byteLength), i .set(e, 4), t = 0, n = 8; t < r.length; t++) i.set(r[t], n), n += r[t].byteLength; return i }, ps = function() { return fs(xs.dinf, fs(xs.dref, Vs)) }, ms = function(e) { return fs(xs.esds, new Uint8Array([0, 0, 0, 0, 3, 25, 0, 0, 0, 4, 17, 64, 21, 0, 6, 0, 0, 0, 218, 192, 0, 0, 218, 192, 5, 2, e.audioobjecttype << 3 | e.samplingfrequencyindex >>> 1, e.samplingfrequencyindex << 7 | e.channelcount << 3, 6, 1, 2 ])) }, Rs = function(e) { return fs(xs.hdlr, js[e]) }, ks = function(e) { var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 1, 95, 144, e.duration >>> 24 & 255, e .duration >>> 16 & 255, e.duration >>> 8 & 255, 255 & e.duration, 85, 196, 0, 0 ]); return e.samplerate && (t[12] = e.samplerate >>> 24 & 255, t[13] = e.samplerate >>> 16 & 255, t[14] = e .samplerate >>> 8 & 255, t[15] = 255 & e.samplerate), fs(xs.mdhd, t) }, As = function(e) { return fs(xs.mdia, ks(e), Rs(e.type), ys(e)) }, vs = function(e) { return fs(xs.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 & e) >> 8, 255 & e ])) }, ys = function(e) { return fs(xs.minf, "video" === e.type ? fs(xs.vmhd, Hs) : fs(xs.smhd, Gs), ps(), Os(e)) }, _s = function(e, t) { for (var i = [], r = t.length; r--;) i[r] = Ds(t[r]); return fs.apply(null, [xs.moof, vs(e)].concat(i)) }, bs = function(e) { for (var t = e.length, i = []; t--;) i[t] = Ts(e[t]); return fs.apply(null, [xs.moov, Es(4294967295)].concat(i).concat(ws(e))) }, ws = function(e) { for (var t = e.length, i = []; t--;) i[t] = Is(e[t]); return fs.apply(null, [xs.mvex].concat(i)) }, Es = function(e) { var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 95, 144, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 ]); return fs(xs.mvhd, t) }, Ms = function(e) { var t, i, r = e.samples || [], n = new Uint8Array(4 + r.length); for (i = 0; i < r.length; i++) t = r[i].flags, n[i + 4] = t.dependsOn << 4 | t.isDependedOn << 2 | t .hasRedundancy; return fs(xs.sdtp, n) }, Os = function(e) { return fs(xs.stbl, Cs(e), fs(xs.stts, zs), fs(xs.stsc, qs), fs(xs.stsz, Xs), fs(xs.stco, Ws)) }, Cs = function(e) { return fs(xs.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === e.type ? Ks(e) : Ys(e)) }, Ks = function(e) { var t, i = e.sps || [], r = e.pps || [], n = [], a = []; for (t = 0; t < i.length; t++) n.push((65280 & i[t].byteLength) >>> 8), n.push(255 & i[t].byteLength), n = n .concat(Array.prototype.slice.call(i[t])); for (t = 0; t < r.length; t++) a.push((65280 & r[t].byteLength) >>> 8), a.push(255 & r[t].byteLength), a = a .concat(Array.prototype.slice.call(r[t])); return fs(xs.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ( 65280 & e.width) >> 8, 255 & e.width, (65280 & e.height) >> 8, 255 & e.height, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 19, 118, 105, 100, 101, 111, 106, 115, 45, 99, 111, 110, 116, 114, 105, 98, 45, 104, 108, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17 ]), fs(xs.avcC, new Uint8Array([1, e.profileIdc, e.profileCompatibility, e.levelIdc, 255].concat([i.length]) .concat(n).concat([r.length]).concat(a))), fs(xs.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192 ]))) }, Ys = function(e) { return fs(xs.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & e.channelcount) >> 8, 255 & e.channelcount, (65280 & e.samplesize) >> 8, 255 & e.samplesize, 0, 0, 0, 0, (65280 & e .samplerate) >> 8, 255 & e.samplerate, 0, 0 ]), ms(e)) }, Ss = function(e) { var t = new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 0, (4278190080 & e.duration) >> 24, (16711680 & e.duration) >> 16, (65280 & e.duration) >> 8, 255 & e.duration, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, ( 65280 & e.width) >> 8, 255 & e.width, 0, 0, (65280 & e.height) >> 8, 255 & e.height, 0, 0 ]); return fs(xs.tkhd, t) }, Ds = function(e) { var t, i, r, n, a, s; return t = fs(xs.tfhd, new Uint8Array([0, 0, 0, 58, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), a = Math.floor(e .baseMediaDecodeTime / (po + 1)), s = Math.floor(e.baseMediaDecodeTime % (po + 1)), i = fs(xs.tfdt, new Uint8Array([1, 0, 0, 0, a >>> 24 & 255, a >>> 16 & 255, a >>> 8 & 255, 255 & a, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s ])), 92, "audio" === e.type ? (r = Ls(e, 92), fs(xs.traf, t, i, r)) : (n = Ms(e), r = Ls(e, n.length + 92), fs(xs.traf, t, i, r, n)) }, Ts = function(e) { return e.duration = e.duration || 4294967295, fs(xs.trak, Ss(e), As(e)) }, Is = function(e) { var t = new Uint8Array([0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 ]); return "video" !== e.type && (t[t.length - 1] = 0), fs(xs.trex, t) }, Zs = function(e, t) { var i = 0, r = 0, n = 0, a = 0; return e.length && (void 0 !== e[0].duration && (i = 1), void 0 !== e[0].size && (r = 2), void 0 !== e[0] .flags && (n = 4), void 0 !== e[0].compositionTimeOffset && (a = 8)), [0, 0, i | r | n | a, 1, (4278190080 & e.length) >>> 24, (16711680 & e.length) >>> 16, (65280 & e.length) >>> 8, 255 & e.length, (4278190080 & t) >>> 24, (16711680 & t) >>> 16, (65280 & t) >>> 8, 255 & t ] }, Js = function(e, t) { var i, r, n, a; for (t += 20 + 16 * (r = e.samples || []).length, i = Zs(r, t), a = 0; a < r.length; a++) n = r[a], i = i .concat([(4278190080 & n.duration) >>> 24, (16711680 & n.duration) >>> 16, (65280 & n.duration) >>> 8, 255 & n .duration, (4278190080 & n.size) >>> 24, (16711680 & n.size) >>> 16, (65280 & n.size) >>> 8, 255 & n.size, n.flags.isLeading << 2 | n.flags.dependsOn, n.flags.isDependedOn << 6 | n.flags.hasRedundancy << 4 | n .flags.paddingValue << 1 | n.flags.isNonSyncSample, 61440 & n.flags.degradationPriority, 15 & n.flags .degradationPriority, (4278190080 & n.compositionTimeOffset) >>> 24, (16711680 & n .compositionTimeOffset) >>> 16, (65280 & n.compositionTimeOffset) >>> 8, 255 & n.compositionTimeOffset ]); return fs(xs.trun, new Uint8Array(i)) }, Qs = function(e, t) { var i, r, n, a; for (t += 20 + 8 * (r = e.samples || []).length, i = Zs(r, t), a = 0; a < r.length; a++) n = r[a], i = i.concat( [(4278190080 & n.duration) >>> 24, (16711680 & n.duration) >>> 16, (65280 & n.duration) >>> 8, 255 & n .duration, (4278190080 & n.size) >>> 24, (16711680 & n.size) >>> 16, (65280 & n.size) >>> 8, 255 & n.size ]); return fs(xs.trun, new Uint8Array(i)) }, Ls = function(e, t) { return "audio" === e.type ? Qs(e, t) : Js(e, t) }; var mo = { ftyp: gs = function() { return fs(xs.ftyp, Ps, Us, Ps, Ns) }, mdat: function(e) { return fs(xs.mdat, e) }, moof: _s, moov: bs, initSegment: function(e) { var t, i = gs(), r = bs(e); return (t = new Uint8Array(i.byteLength + r.byteLength)).set(i), t.set(r, i.byteLength), t } }, go = mo.ftyp, vo = mo.mdat, yo = mo.moof, _o = mo.moov, bo = mo.initSegment, wo = Object.freeze({ default: mo, __moduleExports: mo, ftyp: go, mdat: vo, moof: yo, moov: _o, initSegment: bo }), Eo = function() { this.init = function() { var e = {}; this.on = function(t, i) { e[t] || (e[t] = []), e[t] = e[t].concat(i) }, this.off = function(t, i) { var r; return !!e[t] && (r = e[t].indexOf(i), e[t] = e[t].slice(), e[t].splice(r, 1), r > -1) }, this.trigger = function(t) { var i, r, n, a; if (i = e[t]) if (2 === arguments.length) for (n = i.length, r = 0; r < n; ++r) i[r].call(this, arguments[1]); else { for (a = [], r = arguments.length, r = 1; r < arguments.length; ++r) a.push(arguments[r]); for (n = i.length, r = 0; r < n; ++r) i[r].apply(this, a) } }, this.dispose = function() { e = {} } } }; Eo.prototype.pipe = function(e) { return this.on("data", function(t) { e.push(t) }), this.on("done", function(t) { e.flush(t) }), e }, Eo.prototype.push = function(e) { this.trigger("data", e) }, Eo.prototype.flush = function(e) { this.trigger("done", e) }; var To = Eo, So = Object.freeze({ default: To, __moduleExports: To }), Ao = function(e, t) { var i = { size: 0, flags: { isLeading: 0, dependsOn: 1, isDependedOn: 0, hasRedundancy: 0, degradationPriority: 0, isNonSyncSample: 1 } }; return i.dataOffset = t, i.compositionTimeOffset = e.pts - e.dts, i.duration = e.duration, i.size = 4 * e .length, i.size += e.byteLength, e.keyFrame && (i.flags.dependsOn = 2, i.flags.isNonSyncSample = 0), i }, ko = { groupNalsIntoFrames: function(e) { var t, i, r = [], n = []; for (r.byteLength = 0, t = 0; t < e.length; t++) "access_unit_delimiter_rbsp" === (i = e[t]).nalUnitType ? ( r.length && (r.duration = i.dts - r.dts, n.push(r)), (r = [i]).byteLength = i.data.byteLength, r.pts = i .pts, r.dts = i.dts) : ("slice_layer_without_partitioning_rbsp_idr" === i.nalUnitType && (r.keyFrame = ! 0), r.duration = i.dts - r.dts, r.byteLength += i.data.byteLength, r.push(i)); return n.length && (!r.duration || r.duration <= 0) && (r.duration = n[n.length - 1].duration), n.push(r), n }, groupFramesIntoGops: function(e) { var t, i, r = [], n = []; for (r.byteLength = 0, r.nalCount = 0, r.duration = 0, r.pts = e[0].pts, r.dts = e[0].dts, n.byteLength = 0, n.nalCount = 0, n.duration = 0, n.pts = e[0].pts, n.dts = e[0].dts, t = 0; t < e.length; t++)(i = e[t]) .keyFrame ? (r.length && (n.push(r), n.byteLength += r.byteLength, n.nalCount += r.nalCount, n.duration += r.duration), (r = [i]).nalCount = i.length, r.byteLength = i.byteLength, r.pts = i.pts, r.dts = i.dts, r.duration = i.duration) : (r.duration += i.duration, r.nalCount += i.length, r.byteLength += i .byteLength, r.push(i)); return n.length && r.duration <= 0 && (r.duration = n[n.length - 1].duration), n.byteLength += r.byteLength, n.nalCount += r.nalCount, n.duration += r.duration, n.push(r), n }, extendFirstKeyFrame: function(e) { var t; return !e[0][0].keyFrame && e.length > 1 && (t = e.shift(), e.byteLength -= t.byteLength, e.nalCount -= t .nalCount, e[0][0].dts = t.dts, e[0][0].pts = t.pts, e[0][0].duration += t.duration), e }, generateSampleTable: function(e, t) { var i, r, n, a, s, o = t || 0, u = []; for (i = 0; i < e.length; i++) for (a = e[i], r = 0; r < a.length; r++) s = a[r], o += (n = Ao(s, o)).size, u.push(n); return u }, concatenateNalData: function(e) { var t, i, r, n, a, s, o = 0, u = e.byteLength, l = e.nalCount, d = new Uint8Array(u + 4 * l), c = new DataView(d.buffer); for (t = 0; t < e.length; t++) for (n = e[t], i = 0; i < n.length; i++) for (a = n[i], r = 0; r < a.length; r++) s = a[r], c.setUint32(o, s.data.byteLength), o += 4, d.set(s .data, o), o += s.data.byteLength; return d } }, Ro = ko.groupNalsIntoFrames, Mo = ko.groupFramesIntoGops, Oo = ko.extendFirstKeyFrame, Co = ko.generateSampleTable, Do = ko.concatenateNalData, Io = Object.freeze({ default: ko, __moduleExports: ko, groupNalsIntoFrames: Ro, groupFramesIntoGops: Mo, extendFirstKeyFrame: Oo, generateSampleTable: Co, concatenateNalData: Do }), Lo = { clearDtsInfo: function(e) { delete e.minSegmentDts, delete e.maxSegmentDts, delete e.minSegmentPts, delete e.maxSegmentPts }, calculateTrackBaseMediaDecodeTime: function(e, t) { var i, r = e.minSegmentDts; return t || (r -= e.timelineStartInfo.dts), i = e.timelineStartInfo.baseMediaDecodeTime, i += r, i = Math .max(0, i), "audio" === e.type && (i *= e.samplerate / 9e4, i = Math.floor(i)), i }, collectDtsInfo: function(e, t) { "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t.pts), void 0 === e.minSegmentPts ? e.minSegmentPts = t.pts : e.minSegmentPts = Math.min(e.minSegmentPts, t .pts), void 0 === e.maxSegmentPts ? e.maxSegmentPts = t.pts : e.maxSegmentPts = Math.max(e .maxSegmentPts, t.pts)), "number" == typeof t.dts && (void 0 === e.timelineStartInfo.dts && (e .timelineStartInfo.dts = t.dts), void 0 === e.minSegmentDts ? e.minSegmentDts = t.dts : e .minSegmentDts = Math.min(e.minSegmentDts, t.dts), void 0 === e.maxSegmentDts ? e.maxSegmentDts = t .dts : e.maxSegmentDts = Math.max(e.maxSegmentDts, t.dts)) } }, xo = Lo.clearDtsInfo, Po = Lo.calculateTrackBaseMediaDecodeTime, Uo = Lo.collectDtsInfo, No = Object.freeze({ default: Lo, __moduleExports: Lo, clearDtsInfo: xo, calculateTrackBaseMediaDecodeTime: Po, collectDtsInfo: Uo }), Bo = { parseSei: function(e) { for (var t = 0, i = { payloadType: -1, payloadSize: 0 }, r = 0, n = 0; t < e.byteLength && 128 !== e[t];) { for (; 255 === e[t];) r += 255, t++; for (r += e[t++]; 255 === e[t];) n += 255, t++; if (n += e[t++], !i.payload && 4 === r) { i.payloadType = r, i.payloadSize = n, i.payload = e.subarray(t, t + n); break } t += n, r = 0, n = 0 } return i }, parseUserData: function(e) { return 181 !== e.payload[0] ? null : 49 != (e.payload[1] << 8 | e.payload[2]) ? null : "GA94" !== String .fromCharCode(e.payload[3], e.payload[4], e.payload[5], e.payload[6]) ? null : 3 !== e.payload[7] ? null : e.payload.subarray(8, e.payload.length - 1) }, parseCaptionPackets: function(e, t) { var i, r, n, a, s = []; if (!(64 & t[0])) return s; for (r = 31 & t[0], i = 0; i < r; i++) a = { type: 3 & t[2 + (n = 3 * i)], pts: e }, 4 & t[n + 2] && (a.ccData = t[n + 3] << 8 | t[n + 4], s.push(a)); return s }, discardEmulationPreventionBytes: function(e) { for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ? (n.push(a + 2), a += 2) : a++; if (0 === n.length) return e; t = r - n.length, i = new Uint8Array(t); var s = 0; for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s]; return i }, USER_DATA_REGISTERED_ITU_T_T35: 4 }, Fo = Bo.parseSei, jo = Bo.parseUserData, Ho = Bo.parseCaptionPackets, Go = Bo.discardEmulationPreventionBytes, Vo = Bo.USER_DATA_REGISTERED_ITU_T_T35, Wo = Object.freeze({ default: Bo, __moduleExports: Bo, parseSei: Fo, parseUserData: jo, parseCaptionPackets: Ho, discardEmulationPreventionBytes: Go, USER_DATA_REGISTERED_ITU_T_T35: Vo }), qo = So && To || So, Xo = Wo && Bo || Wo, zo = function e() { e.prototype.init.call(this), this.captionPackets_ = [], this.ccStreams_ = [new Zo(0, 0), new Zo(0, 1), new Zo(1, 0), new Zo(1, 1)], this.reset(), this.ccStreams_.forEach(function(e) { e.on("data", this.trigger.bind(this, "data")), e.on("done", this.trigger.bind(this, "done")) }, this) }; (zo.prototype = new qo).push = function(e) { var t, i, r; if ("sei_rbsp" === e.nalUnitType && (t = Xo.parseSei(e.escapedRBSP)).payloadType === Xo .USER_DATA_REGISTERED_ITU_T_T35 && (i = Xo.parseUserData(t))) if (e.dts < this.latestDts_) this.ignoreNextEqualDts_ = !0; else { if (e.dts === this.latestDts_ && this.ignoreNextEqualDts_) return this.numSameDts_--, void(this .numSameDts_ || (this.ignoreNextEqualDts_ = !1)); r = Xo.parseCaptionPackets(e.pts, i), this.captionPackets_ = this.captionPackets_.concat(r), this .latestDts_ !== e.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = e.dts } }, zo.prototype.flush = function() { this.captionPackets_.length ? (this.captionPackets_.forEach(function(e, t) { e.presortIndex = t }), this.captionPackets_.sort(function(e, t) { return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts }), this.captionPackets_.forEach(function(e) { e.type < 2 && this.dispatchCea608Packet(e) }, this), this.captionPackets_.length = 0, this.ccStreams_.forEach(function(e) { e.flush() }, this)) : this.ccStreams_.forEach(function(e) { e.flush() }, this) }, zo.prototype.reset = function() { this.latestDts_ = null, this.ignoreNextEqualDts_ = !1, this.numSameDts_ = 0, this.activeCea608Channel_ = [null, null ], this.ccStreams_.forEach(function(e) { e.reset() }) }, zo.prototype.dispatchCea608Packet = function(e) { this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && (this .activeCea608Channel_[e.type] = 1), null !== this.activeCea608Channel_[e.type] && this.ccStreams_[(e.type << 1) + this.activeCea608Channel_[e.type]].push(e) }, zo.prototype.setsChannel1Active = function(e) { return 4096 == (30720 & e.ccData) }, zo.prototype.setsChannel2Active = function(e) { return 6144 == (30720 & e.ccData) }; var Ko = { 42: 225, 92: 233, 94: 237, 95: 243, 96: 250, 123: 231, 124: 247, 125: 209, 126: 241, 127: 9608, 304: 174, 305: 176, 306: 189, 307: 191, 308: 8482, 309: 162, 310: 163, 311: 9834, 312: 224, 313: 160, 314: 232, 315: 226, 316: 234, 317: 238, 318: 244, 319: 251, 544: 193, 545: 201, 546: 211, 547: 218, 548: 220, 549: 252, 550: 8216, 551: 161, 552: 42, 553: 39, 554: 8212, 555: 169, 556: 8480, 557: 8226, 558: 8220, 559: 8221, 560: 192, 561: 194, 562: 199, 563: 200, 564: 202, 565: 203, 566: 235, 567: 206, 568: 207, 569: 239, 570: 212, 571: 217, 572: 249, 573: 219, 574: 171, 575: 187, 800: 195, 801: 227, 802: 205, 803: 204, 804: 236, 805: 210, 806: 242, 807: 213, 808: 245, 809: 123, 810: 125, 811: 92, 812: 94, 813: 95, 814: 124, 815: 126, 816: 196, 817: 228, 818: 214, 819: 246, 820: 223, 821: 165, 822: 164, 823: 9474, 824: 197, 825: 229, 826: 216, 827: 248, 828: 9484, 829: 9488, 830: 9492, 831: 9496 }, Yo = function(e) { return null === e ? "" : (e = Ko[e] || e, String.fromCharCode(e)) }, Qo = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152], Jo = function() { for (var e = [], t = 15; t--;) e.push(""); return e }, Zo = function e(t, i) { e.prototype.init.call(this), this.field_ = t || 0, this.dataChannel_ = i || 0, this.name_ = "CC" + (1 + (this .field_ << 1 | this.dataChannel_)), this.setConstants(), this.reset(), this.push = function(e) { var t, i, r, n, a; if ((t = 32639 & e.ccData) !== this.lastControlCode_) { if (4096 == (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this.lastControlCode_ = null), r = t >>> 8, n = 255 & t, t !== this.PADDING_) if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn"; else if (t === this.END_OF_CAPTION_) this.mode_ = "popOn", this.clearFormatting(e.pts), this .flushDisplayed(e.pts), i = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ = i, this.startPts_ = e.pts; else if (t === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(e.pts); else if (t === this.ROLL_UP_3_ROWS_) this.rollUpRows_ = 3, this.setRollUp(e.pts); else if (t === this.ROLL_UP_4_ROWS_) this.rollUpRows_ = 4, this.setRollUp(e.pts); else if (t === this.CARRIAGE_RETURN_) this.clearFormatting(e.pts), this.flushDisplayed(e.pts), this .shiftRowsUp_(), this.startPts_ = e.pts; else if (t === this.BACKSPACE_) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice( 0, -1); else if (t === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(e.pts), this.displayed_ = Jo(); else if (t === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = Jo(); else if (t === this.RESUME_DIRECT_CAPTIONING_) "paintOn" !== this.mode_ && (this.flushDisplayed(e.pts), this.displayed_ = Jo()), this.mode_ = "paintOn", this.startPts_ = e.pts; else if (this.isSpecialCharacter(r, n)) a = Yo((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this .column_++; else if (this.isExtCharacter(r, n)) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice( 0, -1), a = Yo((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++; else if (this.isMidRowCode(r, n)) this.clearFormatting(e.pts), this[this.mode_](e.pts, " "), this .column_++, 14 == (14 & n) && this.addFormatting(e.pts, ["i"]), 1 == (1 & n) && this.addFormatting(e .pts, ["u"]); else if (this.isOffsetControlCode(r, n)) this.column_ += 3 & n; else if (this.isPAC(r, n)) { var s = Qo.indexOf(7968 & t); "rollUp" === this.mode_ && this.setRollUp(e.pts, s), s !== this.row_ && (this.clearFormatting(e.pts), this.row_ = s), 1 & n && -1 === this.formatting_.indexOf("u") && this.addFormatting(e.pts, ["u"]), 16 == (16 & t) && (this.column_ = 4 * ((14 & t) >> 1)), this.isColorPAC(n) && 14 == (14 & n) && this .addFormatting(e.pts, ["i"]) } else this.isNormalChar(r) && (0 === n && (n = null), a = Yo(r), a += Yo(n), this[this.mode_](e.pts, a), this.column_ += a.length) } else this.lastControlCode_ = null } }; Zo.prototype = new qo, Zo.prototype.flushDisplayed = function(e) { var t = this.displayed_.map(function(e) { return e.trim() }).join("\n").replace(/^\n+|\n+$/g, ""); t.length && this.trigger("data", { startPts: this.startPts_, endPts: e, text: t, stream: this.name_ }) }, Zo.prototype.reset = function() { this.mode_ = "popOn", this.topRow_ = 0, this.startPts_ = 0, this.displayed_ = Jo(), this.nonDisplayed_ = Jo(), this.lastControlCode_ = null, this.column_ = 0, this.row_ = 14, this.rollUpRows_ = 2, this.formatting_ = [] }, Zo.prototype.setConstants = function() { 0 === this.dataChannel_ ? (this.BASE_ = 16, this.EXT_ = 17, this.CONTROL_ = (20 | this.field_) << 8, this .OFFSET_ = 23) : 1 === this.dataChannel_ && (this.BASE_ = 24, this.EXT_ = 25, this.CONTROL_ = (28 | this .field_) << 8, this.OFFSET_ = 31), this.PADDING_ = 0, this.RESUME_CAPTION_LOADING_ = 32 | this.CONTROL_, this.END_OF_CAPTION_ = 47 | this.CONTROL_, this.ROLL_UP_2_ROWS_ = 37 | this.CONTROL_, this.ROLL_UP_3_ROWS_ = 38 | this.CONTROL_, this.ROLL_UP_4_ROWS_ = 39 | this.CONTROL_, this.CARRIAGE_RETURN_ = 45 | this.CONTROL_, this.RESUME_DIRECT_CAPTIONING_ = 41 | this.CONTROL_, this.BACKSPACE_ = 33 | this.CONTROL_, this .ERASE_DISPLAYED_MEMORY_ = 44 | this.CONTROL_, this.ERASE_NON_DISPLAYED_MEMORY_ = 46 | this.CONTROL_ }, Zo.prototype.isSpecialCharacter = function(e, t) { return e === this.EXT_ && t >= 48 && t <= 63 }, Zo.prototype.isExtCharacter = function(e, t) { return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && t <= 63 }, Zo.prototype.isMidRowCode = function(e, t) { return e === this.EXT_ && t >= 32 && t <= 47 }, Zo.prototype.isOffsetControlCode = function(e, t) { return e === this.OFFSET_ && t >= 33 && t <= 35 }, Zo.prototype.isPAC = function(e, t) { return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && t <= 127 }, Zo.prototype.isColorPAC = function(e) { return e >= 64 && e <= 79 || e >= 96 && e <= 127 }, Zo.prototype.isNormalChar = function(e) { return e >= 32 && e <= 127 }, Zo.prototype.setRollUp = function(e, t) { if ("rollUp" !== this.mode_ && (this.row_ = 14, this.mode_ = "rollUp", this.flushDisplayed(e), this .nonDisplayed_ = Jo(), this.displayed_ = Jo()), void 0 !== t && t !== this.row_) for (var i = 0; i < this.rollUpRows_; i++) this.displayed_[t - i] = this.displayed_[this.row_ - i], this .displayed_[this.row_ - i] = ""; void 0 === t && (t = this.row_), this.topRow_ = t - this.rollUpRows_ + 1 }, Zo.prototype.addFormatting = function(e, t) { this.formatting_ = this.formatting_.concat(t); var i = t.reduce(function(e, t) { return e + "<" + t + ">" }, ""); this[this.mode_](e, i) }, Zo.prototype.clearFormatting = function(e) { if (this.formatting_.length) { var t = this.formatting_.reverse().reduce(function(e, t) { return e + "" }, ""); this.formatting_ = [], this[this.mode_](e, t) } }, Zo.prototype.popOn = function(e, t) { var i = this.nonDisplayed_[this.row_]; i += t, this.nonDisplayed_[this.row_] = i }, Zo.prototype.rollUp = function(e, t) { var i = this.displayed_[this.row_]; i += t, this.displayed_[this.row_] = i }, Zo.prototype.shiftRowsUp_ = function() { var e; for (e = 0; e < this.topRow_; e++) this.displayed_[e] = ""; for (e = this.row_ + 1; e < 15; e++) this.displayed_[e] = ""; for (e = this.topRow_; e < this.row_; e++) this.displayed_[e] = this.displayed_[e + 1]; this.displayed_[this.row_] = "" }, Zo.prototype.paintOn = function(e, t) { var i = this.displayed_[this.row_]; i += t, this.displayed_[this.row_] = i }; var $o = { CaptionStream: zo, Cea608Stream: Zo }, eu = $o.CaptionStream, tu = $o.Cea608Stream, iu = Object.freeze({ default: $o, __moduleExports: $o, CaptionStream: eu, Cea608Stream: tu }), ru = { H264_STREAM_TYPE: 27, ADTS_STREAM_TYPE: 15, METADATA_STREAM_TYPE: 21 }, nu = ru.H264_STREAM_TYPE, au = ru.ADTS_STREAM_TYPE, su = ru.METADATA_STREAM_TYPE, ou = Object.freeze({ default: ru, __moduleExports: ru, H264_STREAM_TYPE: nu, ADTS_STREAM_TYPE: au, METADATA_STREAM_TYPE: su }), uu = function(e, t) { var i = 1; for (e > t && (i = -1); Math.abs(t - e) > 4294967296;) e += 8589934592 * i; return e }, lu = function e(t) { var i, r; e.prototype.init.call(this), this.type_ = t, this.push = function(e) { e.type === this.type_ && (void 0 === r && (r = e.dts), e.dts = uu(e.dts, r), e.pts = uu(e.pts, r), i = e .dts, this.trigger("data", e)) }, this.flush = function() { r = i, this.trigger("done") }, this.discontinuity = function() { r = void 0, i = void 0 } }; lu.prototype = new qo; var du, cu = { TimestampRolloverStream: lu, handleRollover: uu }, hu = cu.TimestampRolloverStream, fu = cu.handleRollover, pu = Object.freeze({ default: cu, __moduleExports: cu, TimestampRolloverStream: hu, handleRollover: fu }), mu = ou && ru || ou, gu = function(e, t, i) { var r, n = ""; for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2); return n }, vu = function(e, t, i) { return decodeURIComponent(gu(e, t, i)) }, yu = function(e) { return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3] }, _u = { TXXX: function(e) { var t; if (3 === e.data[0]) { for (t = 1; t < e.data.length; t++) if (0 === e.data[t]) { e.description = vu(e.data, 1, t), e.value = vu(e.data, t + 1, e.data.length).replace(/\0*$/, ""); break } e.data = e.value } }, WXXX: function(e) { var t; if (3 === e.data[0]) for (t = 1; t < e.data.length; t++) if (0 === e.data[t]) { e.description = vu(e.data, 1, t), e.url = vu(e.data, t + 1, e.data.length); break } }, PRIV: function(e) { var t, i; for (t = 0; t < e.data.length; t++) if (0 === e.data[t]) { e.owner = (i = e.data, unescape(gu(i, 0, t))); break } e.privateData = e.data.subarray(t + 1), e.data = e.privateData } }; (du = function(e) { var t, i = { debug: !(!e || !e.debug), descriptor: e && e.descriptor }, r = 0, n = [], a = 0; if (du.prototype.init.call(this), this.dispatchType = mu.METADATA_STREAM_TYPE.toString(16), i.descriptor) for (t = 0; t < i.descriptor.length; t++) this.dispatchType += ("00" + i.descriptor[t].toString(16)).slice(- 2); this.push = function(e) { var t, s, o, u, l; if ("timed-metadata" === e.type) if (e.dataAlignmentIndicator && (a = 0, n.length = 0), 0 === n.length && (e.data.length < 10 || e.data[ 0] !== "I".charCodeAt(0) || e.data[1] !== "D".charCodeAt(0) || e.data[2] !== "3".charCodeAt(0))) i .debug && console.log("Skipping unrecognized metadata packet"); else if (n.push(e), a += e.data.byteLength, 1 === n.length && (r = yu(e.data.subarray(6, 10)), r += 10), ! (a < r)) { for (t = { data: new Uint8Array(r), frames: [], pts: n[0].pts, dts: n[0].dts }, l = 0; l < r;) t.data.set(n[0].data.subarray(0, r - l), l), l += n[0].data.byteLength, a -= n[0].data .byteLength, n.shift(); s = 10, 64 & t.data[5] && (s += 4, s += yu(t.data.subarray(10, 14)), r -= yu(t.data.subarray(16, 20))); do { if ((o = yu(t.data.subarray(s + 4, s + 8))) < 1) return console.log( "Malformed ID3 frame encountered. Skipping metadata parsing."); if ((u = { id: String.fromCharCode(t.data[s], t.data[s + 1], t.data[s + 2], t.data[s + 3]), data: t.data.subarray(s + 10, s + o + 10) }).key = u.id, _u[u.id] && (_u[u.id](u), "com.apple.streaming.transportStreamTimestamp" === u .owner)) { var d = u.data, c = (1 & d[3]) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; c *= 4, c += 3 & d[7], u.timeStamp = c, void 0 === t.pts && void 0 === t.dts && (t.pts = u.timeStamp, t.dts = u.timeStamp), this.trigger("timestamp", u) } t.frames.push(u), s += 10, s += o } while (s < r); this.trigger("data", t) } } }).prototype = new qo; var bu, wu, Eu, Tu = du, Su = Object.freeze({ default: Tu, __moduleExports: Tu }), Au = iu && $o || iu, ku = pu && cu || pu, Ru = Su && Tu || Su, Mu = ku.TimestampRolloverStream; (bu = function() { var e = new Uint8Array(188), t = 0; bu.prototype.init.call(this), this.push = function(i) { var r, n = 0, a = 188; for (t ? ((r = new Uint8Array(i.byteLength + t)).set(e.subarray(0, t)), r.set(i, t), t = 0) : r = i; a < r .byteLength;) 71 !== r[n] || 71 !== r[a] ? (n++, a++) : (this.trigger("data", r.subarray(n, a)), n += 188, a += 188); n < r.byteLength && (e.set(r.subarray(n), 0), t = r.byteLength - n) }, this.flush = function() { 188 === t && 71 === e[0] && (this.trigger("data", e), t = 0), this.trigger("done") } }).prototype = new qo, (wu = function() { var e, t, i, r; wu.prototype.init.call(this), r = this, this.packetsWaitingForPmt = [], this.programMapTable = void 0, e = function(e, r) { var n = 0; r.payloadUnitStartIndicator && (n += e[n] + 1), "pat" === r.type ? t(e.subarray(n), r) : i(e.subarray(n), r) }, t = function(e, t) { t.section_number = e[7], t.last_section_number = e[8], r.pmtPid = (31 & e[10]) << 8 | e[11], t.pmtPid = r .pmtPid }, i = function(e, t) { var i, n; if (1 & e[5]) { for (r.programMapTable = { video: null, audio: null, "timed-metadata": {} }, i = 3 + ((15 & e[1]) << 8 | e[2]) - 4, n = 12 + ((15 & e[10]) << 8 | e[11]); n < i;) { var a = e[n], s = (31 & e[n + 1]) << 8 | e[n + 2]; a === mu.H264_STREAM_TYPE && null === r.programMapTable.video ? r.programMapTable.video = s : a === mu .ADTS_STREAM_TYPE && null === r.programMapTable.audio ? r.programMapTable.audio = s : a === mu .METADATA_STREAM_TYPE && (r.programMapTable["timed-metadata"][s] = a), n += 5 + ((15 & e[n + 3]) << 8 | e[n + 4]) } t.programMapTable = r.programMapTable } }, this.push = function(t) { var i = {}, r = 4; if (i.payloadUnitStartIndicator = !!(64 & t[1]), i.pid = 31 & t[1], i.pid <<= 8, i.pid |= t[2], (48 & t[ 3]) >>> 4 > 1 && (r += t[r] + 1), 0 === i.pid) i.type = "pat", e(t.subarray(r), i), this.trigger( "data", i); else if (i.pid === this.pmtPid) for (i.type = "pmt", e(t.subarray(r), i), this.trigger("data", i); this.packetsWaitingForPmt.length;) this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); else void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, r, i]) : this.processPes_(t, r, i) }, this.processPes_ = function(e, t, i) { i.pid === this.programMapTable.video ? i.streamType = mu.H264_STREAM_TYPE : i.pid === this.programMapTable .audio ? i.streamType = mu.ADTS_STREAM_TYPE : i.streamType = this.programMapTable["timed-metadata"][i .pid ], i.type = "pes", i.data = e.subarray(t), this.trigger("data", i) } }).prototype = new qo, wu.STREAM_TYPES = { h264: 27, adts: 15 }, (Eu = function() { var e = this, t = { data: [], size: 0 }, i = { data: [], size: 0 }, r = { data: [], size: 0 }, n = function(t, i, r) { var n, a, s = new Uint8Array(t.size), o = { type: i }, u = 0, l = 0; if (t.data.length && !(t.size < 9)) { for (o.trackId = t.data[0].pid, u = 0; u < t.data.length; u++) a = t.data[u], s.set(a.data, l), l += a .data.byteLength; var d, c, h; d = s, (c = o).packetLength = 6 + (d[4] << 8 | d[5]), c.dataAlignmentIndicator = 0 != (4 & d[6]), 192 & (h = d[7]) && (c.pts = (14 & d[9]) << 27 | (255 & d[10]) << 20 | (254 & d[11]) << 12 | (255 & d[ 12]) << 5 | (254 & d[13]) >>> 3, c.pts *= 4, c.pts += (6 & d[13]) >>> 1, c.dts = c.pts, 64 & h && (c .dts = (14 & d[14]) << 27 | (255 & d[15]) << 20 | (254 & d[16]) << 12 | (255 & d[17]) << 5 | ( 254 & d[18]) >>> 3, c.dts *= 4, c.dts += (6 & d[18]) >>> 1)), c.data = d.subarray(9 + d[8]), n = "video" === i || o.packetLength <= t.size, (r || n) && (t.size = 0, t.data.length = 0), n && e .trigger("data", o) } }; Eu.prototype.init.call(this), this.push = function(a) { ({ pat: function() {}, pes: function() { var e, s; switch (a.streamType) { case mu.H264_STREAM_TYPE: case mu.H264_STREAM_TYPE: e = t, s = "video"; break; case mu.ADTS_STREAM_TYPE: e = i, s = "audio"; break; case mu.METADATA_STREAM_TYPE: e = r, s = "timed-metadata"; break; default: return } a.payloadUnitStartIndicator && n(e, s, !0), e.data.push(a), e.size += a.data.byteLength }, pmt: function() { var t = { type: "metadata", tracks: [] }, i = a.programMapTable; null !== i.video && t.tracks.push({ timelineStartInfo: { baseMediaDecodeTime: 0 }, id: +i.video, codec: "avc", type: "video" }), null !== i.audio && t.tracks.push({ timelineStartInfo: { baseMediaDecodeTime: 0 }, id: +i.audio, codec: "adts", type: "audio" }), e.trigger("data", t) } })[a.type]() }, this.flush = function() { n(t, "video"), n(i, "audio"), n(r, "timed-metadata"), this.trigger("done") } }).prototype = new qo; var Ou = { PAT_PID: 0, MP2T_PACKET_LENGTH: 188, TransportPacketStream: bu, TransportParseStream: wu, ElementaryStream: Eu, TimestampRolloverStream: Mu, CaptionStream: Au.CaptionStream, Cea608Stream: Au.Cea608Stream, MetadataStream: Ru }; for (var Cu in mu) mu.hasOwnProperty(Cu) && (Ou[Cu] = mu[Cu]); var Du, Iu = Ou, Lu = Object.freeze({ default: Iu, __moduleExports: Iu }), xu = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]; (Du = function() { var e; Du.prototype.init.call(this), this.push = function(t) { var i, r, n, a, s, o, u = 0, l = 0; if ("audio" === t.type) for (e ? (a = e, (e = new Uint8Array(a.byteLength + t.data.byteLength)).set(a), e.set(t.data, a .byteLength)) : e = t.data; u + 5 < e.length;) if (255 === e[u] && 240 == (246 & e[u + 1])) { if (r = 2 * (1 & ~e[u + 1]), i = (3 & e[u + 3]) << 11 | e[u + 4] << 3 | (224 & e[u + 5]) >> 5, o = 9e4 * (s = 1024 * (1 + (3 & e[u + 6]))) / xu[(60 & e[u + 2]) >>> 2], n = u + i, e.byteLength < n) return; if (this.trigger("data", { pts: t.pts + l * o, dts: t.dts + l * o, sampleCount: s, audioobjecttype: 1 + (e[u + 2] >>> 6 & 3), channelcount: (1 & e[u + 2]) << 2 | (192 & e[u + 3]) >>> 6, samplerate: xu[(60 & e[u + 2]) >>> 2], samplingfrequencyindex: (60 & e[u + 2]) >>> 2, samplesize: 16, data: e.subarray(u + 7 + r, n) }), e.byteLength === n) return void(e = void 0); l++, e = e.subarray(n) } else u++ }, this.flush = function() { this.trigger("done") } }).prototype = new qo; var Pu, Uu, Nu, Bu = Du, Fu = Object.freeze({ default: Bu, __moduleExports: Bu }), ju = function(e) { var t = e.byteLength, i = 0, r = 0; this.length = function() { return 8 * t }, this.bitsAvailable = function() { return 8 * t + r }, this.loadWord = function() { var n = e.byteLength - t, a = new Uint8Array(4), s = Math.min(4, t); if (0 === s) throw new Error("no bytes available"); a.set(e.subarray(n, n + s)), i = new DataView(a.buffer).getUint32(0), r = 8 * s, t -= s }, this.skipBits = function(e) { var n; r > e ? (i <<= e, r -= e) : (e -= r, e -= 8 * (n = Math.floor(e / 8)), t -= n, this.loadWord(), i <<= e, r -= e) }, this.readBits = function(e) { var n = Math.min(r, e), a = i >>> 32 - n; return (r -= n) > 0 ? i <<= n : t > 0 && this.loadWord(), (n = e - n) > 0 ? a << n | this.readBits(n) : a }, this.skipLeadingZeros = function() { var e; for (e = 0; e < r; ++e) if (0 != (i & 2147483648 >>> e)) return i <<= e, r -= e, e; return this.loadWord(), e + this.skipLeadingZeros() }, this.skipUnsignedExpGolomb = function() { this.skipBits(1 + this.skipLeadingZeros()) }, this.skipExpGolomb = function() { this.skipBits(1 + this.skipLeadingZeros()) }, this.readUnsignedExpGolomb = function() { var e = this.skipLeadingZeros(); return this.readBits(e + 1) - 1 }, this.readExpGolomb = function() { var e = this.readUnsignedExpGolomb(); return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1) }, this.readBoolean = function() { return 1 === this.readBits(1) }, this.readUnsignedByte = function() { return this.readBits(8) }, this.loadWord() }, Hu = Object.freeze({ default: ju, __moduleExports: ju }), Gu = Hu && ju || Hu; (Uu = function() { var e, t, i = 0; Uu.prototype.init.call(this), this.push = function(r) { var n; for (t ? ((n = new Uint8Array(t.byteLength + r.data.byteLength)).set(t), n.set(r.data, t.byteLength), t = n) : t = r.data; i < t.byteLength - 3; i++) if (1 === t[i + 2]) { e = i + 5; break } for (; e < t.byteLength;) switch (t[e]) { case 0: if (0 !== t[e - 1]) { e += 2; break } if (0 !== t[e - 2]) { e++; break } i + 3 !== e - 2 && this.trigger("data", t.subarray(i + 3, e - 2)); do { e++ } while (1 !== t[e] && e < t.length); i = e - 2, e += 3; break; case 1: if (0 !== t[e - 1] || 0 !== t[e - 2]) { e += 3; break } this.trigger("data", t.subarray(i + 3, e - 2)), i = e - 2, e += 3; break; default: e += 3 } t = t.subarray(i), e -= i, i = 0 }, this.flush = function() { t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)), t = null, i = 0, this.trigger("done") } }).prototype = new qo, Nu = { 100: !0, 110: !0, 122: !0, 244: !0, 44: !0, 83: !0, 86: !0, 118: !0, 128: !0, 138: !0, 139: !0, 134: !0 }, (Pu = function() { var e, t, i, r, n, a, s, o = new Uu; Pu.prototype.init.call(this), e = this, this.push = function(e) { "video" === e.type && (t = e.trackId, i = e.pts, r = e.dts, o.push(e)) }, o.on("data", function(s) { var o = { trackId: t, pts: i, dts: r, data: s }; switch (31 & s[0]) { case 5: o.nalUnitType = "slice_layer_without_partitioning_rbsp_idr"; break; case 6: o.nalUnitType = "sei_rbsp", o.escapedRBSP = n(s.subarray(1)); break; case 7: o.nalUnitType = "seq_parameter_set_rbsp", o.escapedRBSP = n(s.subarray(1)), o.config = a(o .escapedRBSP); break; case 8: o.nalUnitType = "pic_parameter_set_rbsp"; break; case 9: o.nalUnitType = "access_unit_delimiter_rbsp" } e.trigger("data", o) }), o.on("done", function() { e.trigger("done") }), this.flush = function() { o.flush() }, s = function(e, t) { var i, r = 8, n = 8; for (i = 0; i < e; i++) 0 !== n && (n = (r + t.readExpGolomb() + 256) % 256), r = 0 === n ? r : n }, n = function(e) { for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ? (n.push(a + 2), a += 2) : a++; if (0 === n.length) return e; t = r - n.length, i = new Uint8Array(t); var s = 0; for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s]; return i }, a = function(e) { var t, i, r, n, a, o, u, l, d, c, h, f, p, m = 0, g = 0, v = 0, y = 0, _ = 1; if (i = (t = new Gu(e)).readUnsignedByte(), n = t.readUnsignedByte(), r = t.readUnsignedByte(), t .skipUnsignedExpGolomb(), Nu[i] && (3 === (a = t.readUnsignedExpGolomb()) && t.skipBits(1), t .skipUnsignedExpGolomb(), t.skipUnsignedExpGolomb(), t.skipBits(1), t.readBoolean())) for (h = 3 !== a ? 8 : 12, p = 0; p < h; p++) t.readBoolean() && s(p < 6 ? 16 : 64, t); if (t.skipUnsignedExpGolomb(), 0 === (o = t.readUnsignedExpGolomb())) t.readUnsignedExpGolomb(); else if (1 === o) for (t.skipBits(1), t.skipExpGolomb(), t.skipExpGolomb(), u = t.readUnsignedExpGolomb(), p = 0; p < u; p++) t.skipExpGolomb(); if (t.skipUnsignedExpGolomb(), t.skipBits(1), l = t.readUnsignedExpGolomb(), d = t .readUnsignedExpGolomb(), 0 === (c = t.readBits(1)) && t.skipBits(1), t.skipBits(1), t.readBoolean() && ( m = t.readUnsignedExpGolomb(), g = t.readUnsignedExpGolomb(), v = t.readUnsignedExpGolomb(), y = t .readUnsignedExpGolomb()), t.readBoolean() && t.readBoolean()) { switch (t.readUnsignedByte()) { case 1: f = [1, 1]; break; case 2: f = [12, 11]; break; case 3: f = [10, 11]; break; case 4: f = [16, 11]; break; case 5: f = [40, 33]; break; case 6: f = [24, 11]; break; case 7: f = [20, 11]; break; case 8: f = [32, 11]; break; case 9: f = [80, 33]; break; case 10: f = [18, 11]; break; case 11: f = [15, 11]; break; case 12: f = [64, 33]; break; case 13: f = [160, 99]; break; case 14: f = [4, 3]; break; case 15: f = [3, 2]; break; case 16: f = [2, 1]; break; case 255: f = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t .readUnsignedByte() ] } f && (_ = f[0] / f[1]) } return { profileIdc: i, levelIdc: r, profileCompatibility: n, width: Math.ceil((16 * (l + 1) - 2 * m - 2 * g) * _), height: (2 - c) * (d + 1) * 16 - 2 * v - 2 * y } } }).prototype = new qo; var Vu, Wu = { H264Stream: Pu, NalByteStream: Uu }, qu = Wu.H264Stream, Xu = Wu.NalByteStream, zu = Object.freeze({ default: Wu, __moduleExports: Wu, H264Stream: qu, NalByteStream: Xu }); (Vu = function() { var e = new Uint8Array, t = 0; Vu.prototype.init.call(this), this.setTimestamp = function(e) { t = e }, this.parseId3TagSize = function(e, t) { var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]; return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10 }, this.parseAdtsSize = function(e, t) { var i = (224 & e[t + 5]) >> 5, r = e[t + 4] << 3; return 6144 & e[t + 3] | r | i }, this.push = function(i) { var r, n, a, s, o = 0, u = 0; for (e.length ? (s = e.length, (e = new Uint8Array(i.byteLength + s)).set(e.subarray(0, s)), e.set(i, s)) : e = i; e.length - u >= 3;) if (e[u] !== "I".charCodeAt(0) || e[u + 1] !== "D".charCodeAt(0) || e[u + 2] !== "3".charCodeAt(0)) if (!0 & e[u] && 240 == (240 & e[u + 1])) { if (e.length - u < 7) break; if ((o = this.parseAdtsSize(e, u)) > e.length) break; a = { type: "audio", data: e.subarray(u, u + o), pts: t, dts: t }, this.trigger("data", a), u += o } else u++; else { if (e.length - u < 10) break; if ((o = this.parseId3TagSize(e, u)) > e.length) break; n = { type: "timed-metadata", data: e.subarray(u, u + o) }, this.trigger("data", n), u += o } r = e.length - u, e = r > 0 ? e.subarray(u) : new Uint8Array } }).prototype = new qo; var Ku, Yu, Qu, Ju, Zu, $u, el, tl, il, rl, nl, al, sl = Vu, ol = Object.freeze({ default: sl, __moduleExports: sl }), ul = [33, 16, 5, 32, 164, 27], ll = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252], dl = function(e) { for (var t = []; e--;) t.push(0); return t }, cl = { 96000: [ul, [227, 64], dl(154), [56]], 88200: [ul, [231], dl(170), [56]], 64000: [ul, [248, 192], dl(240), [56]], 48000: [ul, [255, 192], dl(268), [55, 148, 128], dl(54), [112]], 44100: [ul, [255, 192], dl(268), [55, 163, 128], dl(84), [112]], 32000: [ul, [255, 192], dl(268), [55, 234], dl(226), [112]], 24000: [ul, [255, 192], dl(268), [55, 255, 128], dl(268), [111, 112], dl(126), [224]], 16000: [ul, [255, 192], dl(268), [55, 255, 128], dl(268), [111, 255], dl(269), [223, 108], dl(195), [1, 192]], 12000: [ll, dl(268), [3, 127, 248], dl(268), [6, 255, 240], dl(268), [13, 255, 224], dl(268), [27, 253, 128], dl(259), [56] ], 11025: [ll, dl(268), [3, 127, 248], dl(268), [6, 255, 240], dl(268), [13, 255, 224], dl(268), [27, 255, 192], dl(268), [55, 175, 128], dl(108), [112] ], 8000: [ll, dl(268), [3, 121, 16], dl(47), [7]] }, hl = (Ku = cl, Object.keys(Ku).reduce(function(e, t) { return e[t] = new Uint8Array(Ku[t].reduce(function(e, t) { return e.concat(t) }, [])), e }, {})), fl = Object.freeze({ default: hl, __moduleExports: hl }), pl = { secondsToVideoTs: Yu = function(e) { return 9e4 * e }, secondsToAudioTs: Qu = function(e, t) { return e * t }, videoTsToSeconds: Ju = function(e) { return e / 9e4 }, audioTsToSeconds: Zu = function(e, t) { return e / t }, audioTsToVideoTs: function(e, t) { return Yu(Zu(e, t)) }, videoTsToAudioTs: function(e, t) { return Qu(Ju(e), t) } }, ml = pl.secondsToVideoTs, gl = pl.secondsToAudioTs, vl = pl.videoTsToSeconds, yl = pl.audioTsToSeconds, _l = pl.audioTsToVideoTs, bl = pl.videoTsToAudioTs, wl = Object.freeze({ default: pl, __moduleExports: pl, secondsToVideoTs: ml, secondsToAudioTs: gl, videoTsToSeconds: vl, audioTsToSeconds: yl, audioTsToVideoTs: _l, videoTsToAudioTs: bl }), El = wo && mo || wo, Tl = Io && ko || Io, Sl = No && Lo || No, Al = Lu && Iu || Lu, kl = Fu && Bu || Fu, Rl = ol && sl || ol, Ml = fl && hl || fl, Ol = wl && pl || wl, Cl = (zu && Wu || zu).H264Stream, Dl = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"], Il = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility"]; rl = function(e) { return e[0] === "I".charCodeAt(0) && e[1] === "D".charCodeAt(0) && e[2] === "3".charCodeAt(0) }, nl = function(e, t) { var i; if (e.length !== t.length) return !1; for (i = 0; i < e.length; i++) if (e[i] !== t[i]) return !1; return !0 }, al = function(e) { var t, i = 0; for (t = 0; t < e.length; t++) i += e[t].data.byteLength; return i }, (el = function(e, t) { var i = [], r = 0, n = 0, a = 0, s = 1 / 0; t = t || {}, el.prototype.init.call(this), this.push = function(t) { Sl.collectDtsInfo(e, t), e && Dl.forEach(function(i) { e[i] = t[i] }), i.push(t) }, this.setEarliestDts = function(t) { n = t - e.timelineStartInfo.baseMediaDecodeTime }, this.setVideoBaseMediaDecodeTime = function(e) { s = e }, this.setAudioAppendStart = function(e) { a = e }, this.flush = function() { var n, a, s, o; 0 !== i.length ? (n = this.trimAdtsFramesByEarliestDts_(i), e.baseMediaDecodeTime = Sl .calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), this.prefixWithSilence_(e, n), e .samples = this.generateSampleTable_(n), s = El.mdat(this.concatenateFrameData_(n)), i = [], a = El .moof(r, [e]), o = new Uint8Array(a.byteLength + s.byteLength), r++, o.set(a), o.set(s, a.byteLength), Sl.clearDtsInfo(e), this.trigger("data", { track: e, boxes: o }), this.trigger("done", "AudioSegmentStream")) : this.trigger("done", "AudioSegmentStream") }, this.prefixWithSilence_ = function(e, t) { var i, r, n, o, u = 0, l = 0, d = 0; if (t.length && (i = Ol.audioTsToVideoTs(e.baseMediaDecodeTime, e.samplerate), r = Math.ceil(9e4 / (e .samplerate / 1024)), a && s && (u = i - Math.max(a, s), d = (l = Math.floor(u / r)) * r), !(l < 1 || d > 45e3))) { for ((n = Ml[e.samplerate]) || (n = t[0].data), o = 0; o < l; o++) t.splice(o, 0, { data: n }); e.baseMediaDecodeTime -= Math.floor(Ol.videoTsToAudioTs(d, e.samplerate)) } }, this.trimAdtsFramesByEarliestDts_ = function(t) { return e.minSegmentDts >= n ? t : (e.minSegmentDts = 1 / 0, t.filter(function(t) { return t.dts >= n && (e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), e.minSegmentPts = e .minSegmentDts, !0) })) }, this.generateSampleTable_ = function(e) { var t, i, r = []; for (t = 0; t < e.length; t++) i = e[t], r.push({ size: i.data.byteLength, duration: 1024 }); return r }, this.concatenateFrameData_ = function(e) { var t, i, r = 0, n = new Uint8Array(al(e)); for (t = 0; t < e.length; t++) i = e[t], n.set(i.data, r), r += i.data.byteLength; return n } }).prototype = new qo, ($u = function(e, t) { var i, r, n = 0, a = [], s = []; t = t || {}, $u.prototype.init.call(this), delete e.minPTS, this.gopCache_ = [], this.push = function(t) { Sl.collectDtsInfo(e, t), "seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config, e.sps = [t .data], Il.forEach(function(t) { e[t] = i[t] }, this)), "pic_parameter_set_rbsp" !== t.nalUnitType || r || (r = t.data, e.pps = [t.data]), a.push(t) }, this.flush = function() { for (var i, r, o, u, l, d; a.length && "access_unit_delimiter_rbsp" !== a[0].nalUnitType;) a.shift(); if (0 === a.length) return this.resetStream_(), void this.trigger("done", "VideoSegmentStream"); if (i = Tl.groupNalsIntoFrames(a), (o = Tl.groupFramesIntoGops(i))[0][0].keyFrame || ((r = this .getGopForFusion_(a[0], e)) ? (o.unshift(r), o.byteLength += r.byteLength, o.nalCount += r.nalCount, o.pts = r.pts, o.dts = r.dts, o.duration += r.duration) : o = Tl.extendFirstKeyFrame(o)), s.length) { var c; if (!(c = t.alignGopsAtEnd ? this.alignGopsAtEnd_(o) : this.alignGopsAtStart_(o))) return this.gopCache_ .unshift({ gop: o.pop(), pps: e.pps, sps: e.sps }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.resetStream_(), void this.trigger("done", "VideoSegmentStream"); Sl.clearDtsInfo(e), o = c } Sl.collectDtsInfo(e, o), e.samples = Tl.generateSampleTable(o), l = El.mdat(Tl.concatenateNalData(o)), e .baseMediaDecodeTime = Sl.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), this.trigger( "processedGopsInfo", o.map(function(e) { return { pts: e.pts, dts: e.dts, byteLength: e.byteLength } })), this.gopCache_.unshift({ gop: o.pop(), pps: e.pps, sps: e.sps }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.trigger( "baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e.timelineStartInfo), u = El.moof(n, [e]), d = new Uint8Array(u.byteLength + l.byteLength), n++, d.set(u), d.set(l, u .byteLength), this.trigger("data", { track: e, boxes: d }), this.resetStream_(), this.trigger("done", "VideoSegmentStream") }, this.resetStream_ = function() { Sl.clearDtsInfo(e), i = void 0, r = void 0 }, this.getGopForFusion_ = function(t) { var i, r, n, a, s, o = 1 / 0; for (s = 0; s < this.gopCache_.length; s++) n = (a = this.gopCache_[s]).gop, e.pps && nl(e.pps[0], a.pps[ 0]) && e.sps && nl(e.sps[0], a.sps[0]) && (n.dts < e.timelineStartInfo.dts || (i = t.dts - n.dts - n .duration) >= -1e4 && i <= 45e3 && (!r || o > i) && (r = a, o = i)); return r ? r.gop : null }, this.alignGopsAtStart_ = function(e) { var t, i, r, n, a, o, u, l; for (a = e.byteLength, o = e.nalCount, u = e.duration, t = i = 0; t < s.length && i < e.length && (r = s[ t], n = e[i], r.pts !== n.pts);) n.pts > r.pts ? t++ : (i++, a -= n.byteLength, o -= n.nalCount, u -= n.duration); return 0 === i ? e : i === e.length ? null : ((l = e.slice(i)).byteLength = a, l.duration = u, l .nalCount = o, l.pts = l[0].pts, l.dts = l[0].dts, l) }, this.alignGopsAtEnd_ = function(e) { var t, i, r, n, a, o, u; for (t = s.length - 1, i = e.length - 1, a = null, o = !1; t >= 0 && i >= 0;) { if (r = s[t], n = e[i], r.pts === n.pts) { o = !0; break } r.pts > n.pts ? t-- : (t === s.length - 1 && (a = i), i--) } if (!o && null === a) return null; if (0 === (u = o ? i : a)) return e; var l = e.slice(u), d = l.reduce(function(e, t) { return e.byteLength += t.byteLength, e.duration += t.duration, e.nalCount += t.nalCount, e }, { byteLength: 0, duration: 0, nalCount: 0 }); return l.byteLength = d.byteLength, l.duration = d.duration, l.nalCount = d.nalCount, l.pts = l[0].pts, l .dts = l[0].dts, l }, this.alignGopsWith = function(e) { s = e } }).prototype = new qo, (il = function(e, t) { this.numberOfTracks = 0, this.metadataStream = t, void 0 !== e.remux ? this.remuxTracks = !!e.remux : this .remuxTracks = !0, this.pendingTracks = [], this.videoTrack = null, this.pendingBoxes = [], this .pendingCaptions = [], this.pendingMetadata = [], this.pendingBytes = 0, this.emittedTracks = 0, il .prototype.init.call(this), this.push = function(e) { return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (this .pendingTracks.push(e.track), this.pendingBoxes.push(e.boxes), this.pendingBytes += e.boxes .byteLength, "video" === e.track.type && (this.videoTrack = e.track), void("audio" === e.track.type && (this.audioTrack = e.track))) } }).prototype = new qo, il.prototype.flush = function(e) { var t, i, r, n, a = 0, s = { captions: [], captionStreams: {}, metadata: [], info: {} }, o = 0; if (this.pendingTracks.length < this.numberOfTracks) { if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return; if (this.remuxTracks) return; if (0 === this.pendingTracks.length) return this.emittedTracks++, void(this.emittedTracks >= this .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0)) } for (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts, Il.forEach(function(e) { s.info[e] = this.videoTrack[e] }, this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts, Dl.forEach(function(e) { s.info[e] = this.audioTrack[e] }, this)), 1 === this.pendingTracks.length ? s.type = this.pendingTracks[0].type : s.type = "combined", this .emittedTracks += this.pendingTracks.length, r = El.initSegment(this.pendingTracks), s.initSegment = new Uint8Array(r.byteLength), s.initSegment.set(r), s.data = new Uint8Array(this.pendingBytes), n = 0; n < this.pendingBoxes.length; n++) s.data.set(this.pendingBoxes[n], a), a += this.pendingBoxes[n].byteLength; for (n = 0; n < this.pendingCaptions.length; n++)(t = this.pendingCaptions[n]).startTime = t.startPts - o, t .startTime /= 9e4, t.endTime = t.endPts - o, t.endTime /= 9e4, s.captionStreams[t.stream] = !0, s.captions .push(t); for (n = 0; n < this.pendingMetadata.length; n++)(i = this.pendingMetadata[n]).cueTime = i.pts - o, i.cueTime /= 9e4, s.metadata.push(i); s.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this.videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this.pendingBytes = 0, this .pendingMetadata.length = 0, this.trigger("data", s), this.emittedTracks >= this.numberOfTracks && (this .trigger("done"), this.emittedTracks = 0) }, (tl = function(e) { var t, i, r = this, n = !0; tl.prototype.init.call(this), e = e || {}, this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0, this .transmuxPipeline_ = {}, this.setupAacPipeline = function() { var t = {}; this.transmuxPipeline_ = t, t.type = "aac", t.metadataStream = new Al.MetadataStream, t.aacStream = new Rl, t.audioTimestampRolloverStream = new Al.TimestampRolloverStream("audio"), t .timedMetadataTimestampRolloverStream = new Al.TimestampRolloverStream("timed-metadata"), t.adtsStream = new kl, t.coalesceStream = new il(e, t.metadataStream), t.headOfPipeline = t.aacStream, t.aacStream .pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream), t.aacStream.pipe(t .timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream), t.metadataStream .on("timestamp", function(e) { t.aacStream.setTimestamp(e.timeStamp) }), t.aacStream.on("data", function(n) { "timed-metadata" !== n.type || t.audioSegmentStream || (i = i || { timelineStartInfo: { baseMediaDecodeTime: r.baseMediaDecodeTime }, codec: "adts", type: "audio" }, t.coalesceStream.numberOfTracks++, t.audioSegmentStream = new el(i, e), t.adtsStream.pipe(t .audioSegmentStream).pipe(t.coalesceStream)) }), t.coalesceStream.on("data", this.trigger.bind(this, "data")), t.coalesceStream.on("done", this .trigger.bind(this, "done")) }, this.setupTsPipeline = function() { var n = {}; this.transmuxPipeline_ = n, n.type = "ts", n.metadataStream = new Al.MetadataStream, n.packetStream = new Al.TransportPacketStream, n.parseStream = new Al.TransportParseStream, n.elementaryStream = new Al .ElementaryStream, n.videoTimestampRolloverStream = new Al.TimestampRolloverStream("video"), n .audioTimestampRolloverStream = new Al.TimestampRolloverStream("audio"), n .timedMetadataTimestampRolloverStream = new Al.TimestampRolloverStream("timed-metadata"), n.adtsStream = new kl, n.h264Stream = new Cl, n.captionStream = new Al.CaptionStream, n.coalesceStream = new il(e, n .metadataStream), n.headOfPipeline = n.packetStream, n.packetStream.pipe(n.parseStream).pipe(n .elementaryStream), n.elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream), n .elementaryStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream), n.elementaryStream.pipe(n .timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream), n.h264Stream .pipe(n.captionStream).pipe(n.coalesceStream), n.elementaryStream.on("data", function(a) { var s; if ("metadata" === a.type) { for (s = a.tracks.length; s--;) t || "video" !== a.tracks[s].type ? i || "audio" !== a.tracks[s] .type || ((i = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r.baseMediaDecodeTime) : ( t = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r.baseMediaDecodeTime; t && !n.videoSegmentStream && (n.coalesceStream.numberOfTracks++, n.videoSegmentStream = new $u(t, e), n.videoSegmentStream.on("timelineStartInfo", function(e) { i && (i.timelineStartInfo = e, n.audioSegmentStream.setEarliestDts(e.dts)) }), n.videoSegmentStream.on("processedGopsInfo", r.trigger.bind(r, "gopInfo")), n .videoSegmentStream.on("baseMediaDecodeTime", function(e) { i && n.audioSegmentStream.setVideoBaseMediaDecodeTime(e) }), n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)), i && !n .audioSegmentStream && (n.coalesceStream.numberOfTracks++, n.audioSegmentStream = new el(i, e), n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream)) } }), n.coalesceStream.on("data", this.trigger.bind(this, "data")), n.coalesceStream.on("done", this .trigger.bind(this, "done")) }, this.setBaseMediaDecodeTime = function(e) { var r = this.transmuxPipeline_; this.baseMediaDecodeTime = e, i && (i.timelineStartInfo.dts = void 0, i.timelineStartInfo.pts = void 0, Sl .clearDtsInfo(i), i.timelineStartInfo.baseMediaDecodeTime = e, r.audioTimestampRolloverStream && r .audioTimestampRolloverStream.discontinuity()), t && (r.videoSegmentStream && (r.videoSegmentStream .gopCache_ = [], r.videoTimestampRolloverStream.discontinuity()), t.timelineStartInfo.dts = void 0, t.timelineStartInfo.pts = void 0, Sl.clearDtsInfo(t), r.captionStream.reset(), t.timelineStartInfo .baseMediaDecodeTime = e), r.timedMetadataTimestampRolloverStream && r .timedMetadataTimestampRolloverStream.discontinuity() }, this.setAudioAppendStart = function(e) { i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e) }, this.alignGopsWith = function(e) { t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream.alignGopsWith( e) }, this.push = function(e) { if (n) { var t = rl(e); t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this .transmuxPipeline_.type || this.setupTsPipeline(), n = !1 } this.transmuxPipeline_.headOfPipeline.push(e) }, this.flush = function() { n = !0, this.transmuxPipeline_.headOfPipeline.flush() }, this.resetCaptions = function() { this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset() } }).prototype = new qo; var Ll, xl, Pl = { Transmuxer: tl, VideoSegmentStream: $u, AudioSegmentStream: el, AUDIO_PROPERTIES: Dl, VIDEO_PROPERTIES: Il }, Ul = Pl.Transmuxer, Nl = Pl.VideoSegmentStream, Bl = Pl.AudioSegmentStream, Fl = Pl.AUDIO_PROPERTIES, jl = Pl.VIDEO_PROPERTIES, Hl = Object.freeze({ default: Pl, __moduleExports: Pl, Transmuxer: Ul, VideoSegmentStream: Nl, AudioSegmentStream: Bl, AUDIO_PROPERTIES: Fl, VIDEO_PROPERTIES: jl }), Gl = fo.parseType, Vl = function(e) { return new Date(1e3 * e - 20828448e5) }, Wl = function(e) { return { isLeading: (12 & e[0]) >>> 2, dependsOn: 3 & e[0], isDependedOn: (192 & e[1]) >>> 6, hasRedundancy: (48 & e[1]) >>> 4, paddingValue: (14 & e[1]) >>> 1, isNonSyncSample: 1 & e[1], degradationPriority: e[2] << 8 | e[3] } }, ql = { avc1: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { dataReferenceIndex: t.getUint16(6), width: t.getUint16(24), height: t.getUint16(26), horizresolution: t.getUint16(28) + t.getUint16(30) / 16, vertresolution: t.getUint16(32) + t.getUint16(34) / 16, frameCount: t.getUint16(40), depth: t.getUint16(74), config: Ll(e.subarray(78, e.byteLength)) } }, avcC: function(e) { var t, i, r, n, a = new DataView(e.buffer, e.byteOffset, e.byteLength), s = { configurationVersion: e[0], avcProfileIndication: e[1], profileCompatibility: e[2], avcLevelIndication: e[3], lengthSizeMinusOne: 3 & e[4], sps: [], pps: [] }, o = 31 & e[5]; for (r = 6, n = 0; n < o; n++) i = a.getUint16(r), r += 2, s.sps.push(new Uint8Array(e.subarray(r, r + i))), r += i; for (t = e[r], r++, n = 0; n < t; n++) i = a.getUint16(r), r += 2, s.pps.push(new Uint8Array(e.subarray(r, r + i))), r += i; return s }, btrt: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { bufferSizeDB: t.getUint32(0), maxBitrate: t.getUint32(4), avgBitrate: t.getUint32(8) } }, esds: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), esId: e[6] << 8 | e[7], streamPriority: 31 & e[8], decoderConfig: { objectProfileIndication: e[11], streamType: e[12] >>> 2 & 63, bufferSize: e[13] << 16 | e[14] << 8 | e[15], maxBitrate: e[16] << 24 | e[17] << 16 | e[18] << 8 | e[19], avgBitrate: e[20] << 24 | e[21] << 16 | e[22] << 8 | e[23], decoderConfigDescriptor: { tag: e[24], length: e[25], audioObjectType: e[26] >>> 3 & 31, samplingFrequencyIndex: (7 & e[26]) << 1 | e[27] >>> 7 & 1, channelConfiguration: e[27] >>> 3 & 15 } } } }, ftyp: function(e) { for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = { majorBrand: Gl(e.subarray(0, 4)), minorVersion: t.getUint32(4), compatibleBrands: [] }, r = 8; r < e.byteLength;) i.compatibleBrands.push(Gl(e.subarray(r, r + 4))), r += 4; return i }, dinf: function(e) { return { boxes: Ll(e) } }, dref: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), dataReferences: Ll(e.subarray(8)) } }, hdlr: function(e) { var t = { version: new DataView(e.buffer, e.byteOffset, e.byteLength).getUint8(0), flags: new Uint8Array(e.subarray(1, 4)), handlerType: Gl(e.subarray(8, 12)), name: "" }, i = 8; for (i = 24; i < e.byteLength; i++) { if (0 === e[i]) { i++; break } t.name += String.fromCharCode(e[i]) } return t.name = decodeURIComponent(escape(t.name)), t }, mdat: function(e) { return { byteLength: e.byteLength, nals: function(e) { var t, i, r = new DataView(e.buffer, e.byteOffset, e.byteLength), n = []; for (t = 0; t + 4 < e.length; t += i) if (i = r.getUint32(t), t += 4, i <= 0) n.push("MALFORMED DATA"); else switch (31 & e[t]) { case 1: n.push("slice_layer_without_partitioning_rbsp"); break; case 5: n.push("slice_layer_without_partitioning_rbsp_idr"); break; case 6: n.push("sei_rbsp"); break; case 7: n.push("seq_parameter_set_rbsp"); break; case 8: n.push("pic_parameter_set_rbsp"); break; case 9: n.push("access_unit_delimiter_rbsp"); break; default: n.push("UNKNOWN NAL - " + e[t] & 31) } return n }(e) } }, mdhd: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = 4, n = { version: i.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)), language: "" }; return 1 === n.version ? (r += 4, n.creationTime = Vl(i.getUint32(r)), r += 8, n.modificationTime = Vl(i .getUint32(r)), r += 4, n.timescale = i.getUint32(r), r += 8, n.duration = i.getUint32(r)) : (n .creationTime = Vl(i.getUint32(r)), r += 4, n.modificationTime = Vl(i.getUint32(r)), r += 4, n .timescale = i.getUint32(r), r += 4, n.duration = i.getUint32(r)), r += 4, t = i.getUint16(r), n .language += String.fromCharCode(96 + (t >> 10)), n.language += String.fromCharCode(96 + ((992 & t) >> 5)), n.language += String.fromCharCode(96 + (31 & t)), n }, mdia: function(e) { return { boxes: Ll(e) } }, mfhd: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sequenceNumber: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7] } }, minf: function(e) { return { boxes: Ll(e) } }, mp4a: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = { dataReferenceIndex: t.getUint16(6), channelcount: t.getUint16(16), samplesize: t.getUint16(18), samplerate: t.getUint16(24) + t.getUint16(26) / 65536 }; return e.byteLength > 28 && (i.streamDescriptor = Ll(e.subarray(28))[0]), i }, moof: function(e) { return { boxes: Ll(e) } }, moov: function(e) { return { boxes: Ll(e) } }, mvex: function(e) { return { boxes: Ll(e) } }, mvhd: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = 4, r = { version: t.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)) }; return 1 === r.version ? (i += 4, r.creationTime = Vl(t.getUint32(i)), i += 8, r.modificationTime = Vl(t .getUint32(i)), i += 4, r.timescale = t.getUint32(i), i += 8, r.duration = t.getUint32(i)) : (r .creationTime = Vl(t.getUint32(i)), i += 4, r.modificationTime = Vl(t.getUint32(i)), i += 4, r .timescale = t.getUint32(i), i += 4, r.duration = t.getUint32(i)), i += 4, r.rate = t.getUint16(i) + t .getUint16(i + 2) / 16, i += 4, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i += 2, i += 2, i += 8, r.matrix = new Uint32Array(e.subarray(i, i + 36)), i += 36, i += 24, r.nextTrackId = t.getUint32(i), r }, pdin: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { version: t.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)), rate: t.getUint32(4), initialDelay: t.getUint32(8) } }, sdtp: function(e) { var t, i = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), samples: [] }; for (t = 4; t < e.byteLength; t++) i.samples.push({ dependsOn: (48 & e[t]) >> 4, isDependedOn: (12 & e[t]) >> 2, hasRedundancy: 3 & e[t] }); return i }, sidx: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), references: [], referenceId: i.getUint32(4), timescale: i.getUint32(8), earliestPresentationTime: i.getUint32(12), firstOffset: i.getUint32(16) }, n = i.getUint16(22); for (t = 24; n; t += 12, n--) r.references.push({ referenceType: (128 & e[t]) >>> 7, referencedSize: 2147483647 & i.getUint32(t), subsegmentDuration: i.getUint32(t + 4), startsWithSap: !!(128 & e[t + 8]), sapType: (112 & e[t + 8]) >>> 4, sapDeltaTime: 268435455 & i.getUint32(t + 8) }); return r }, smhd: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), balance: e[4] + e[5] / 256 } }, stbl: function(e) { return { boxes: Ll(e) } }, stco: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), chunkOffsets: [] }, n = i.getUint32(4); for (t = 8; n; t += 4, n--) r.chunkOffsets.push(i.getUint32(t)); return r }, stsc: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = i.getUint32(4), n = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sampleToChunks: [] }; for (t = 8; r; t += 12, r--) n.sampleToChunks.push({ firstChunk: i.getUint32(t), samplesPerChunk: i.getUint32(t + 4), sampleDescriptionIndex: i.getUint32(t + 8) }); return n }, stsd: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sampleDescriptions: Ll(e.subarray(8)) } }, stsz: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sampleSize: i.getUint32(4), entries: [] }; for (t = 12; t < e.byteLength; t += 4) r.entries.push(i.getUint32(t)); return r }, stts: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), timeToSamples: [] }, n = i.getUint32(4); for (t = 8; n; t += 8, n--) r.timeToSamples.push({ sampleCount: i.getUint32(t), sampleDelta: i.getUint32(t + 4) }); return r }, styp: function(e) { return ql.ftyp(e) }, tfdt: function(e) { var t = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), baseMediaDecodeTime: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7] }; return 1 === t.version && (t.baseMediaDecodeTime *= Math.pow(2, 32), t.baseMediaDecodeTime += e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11]), t }, tfhd: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), trackId: i.getUint32(4) }, n = 1 & r.flags[2], a = 2 & r.flags[2], s = 8 & r.flags[2], o = 16 & r.flags[2], u = 32 & r.flags[2], l = 65536 & r.flags[0], d = 131072 & r.flags[0]; return t = 8, n && (t += 4, r.baseDataOffset = i.getUint32(12), t += 4), a && (r.sampleDescriptionIndex = i .getUint32(t), t += 4), s && (r.defaultSampleDuration = i.getUint32(t), t += 4), o && (r .defaultSampleSize = i.getUint32(t), t += 4), u && (r.defaultSampleFlags = i.getUint32(t)), l && (r .durationIsEmpty = !0), !n && d && (r.baseDataOffsetIsMoof = !0), r }, tkhd: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = 4, r = { version: t.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)) }; return 1 === r.version ? (i += 4, r.creationTime = Vl(t.getUint32(i)), i += 8, r.modificationTime = Vl(t .getUint32(i)), i += 4, r.trackId = t.getUint32(i), i += 4, i += 8, r.duration = t.getUint32(i)) : (r .creationTime = Vl(t.getUint32(i)), i += 4, r.modificationTime = Vl(t.getUint32(i)), i += 4, r.trackId = t.getUint32(i), i += 4, i += 4, r.duration = t.getUint32(i)), i += 4, i += 8, r.layer = t.getUint16(i), i += 2, r.alternateGroup = t.getUint16(i), i += 2, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i += 2, i += 2, r.matrix = new Uint32Array(e.subarray(i, i + 36)), i += 36, r.width = t.getUint16(i) + t .getUint16(i + 2) / 16, i += 4, r.height = t.getUint16(i) + t.getUint16(i + 2) / 16, r }, traf: function(e) { return { boxes: Ll(e) } }, trak: function(e) { return { boxes: Ll(e) } }, trex: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), trackId: t.getUint32(4), defaultSampleDescriptionIndex: t.getUint32(8), defaultSampleDuration: t.getUint32(12), defaultSampleSize: t.getUint32(16), sampleDependsOn: 3 & e[20], sampleIsDependedOn: (192 & e[21]) >> 6, sampleHasRedundancy: (48 & e[21]) >> 4, samplePaddingValue: (14 & e[21]) >> 1, sampleIsDifferenceSample: !!(1 & e[21]), sampleDegradationPriority: t.getUint16(22) } }, trun: function(e) { var t, i = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), samples: [] }, r = new DataView(e.buffer, e.byteOffset, e.byteLength), n = 1 & i.flags[2], a = 4 & i.flags[2], s = 1 & i.flags[1], o = 2 & i.flags[1], u = 4 & i.flags[1], l = 8 & i.flags[1], d = r.getUint32(4), c = 8; for (n && (i.dataOffset = r.getInt32(c), c += 4), a && d && (t = { flags: Wl(e.subarray(c, c + 4)) }, c += 4, s && (t.duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4), l && (t .compositionTimeOffset = r.getUint32(c), c += 4), i.samples.push(t), d--); d--;) t = {}, s && (t .duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4), u && (t.flags = Wl(e .subarray(c, c + 4)), c += 4), l && (t.compositionTimeOffset = r.getUint32(c), c += 4), i.samples.push( t); return i }, "url ": function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)) } }, vmhd: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), graphicsmode: t.getUint16(4), opcolor: new Uint16Array([t.getUint16(6), t.getUint16(8), t.getUint16(10)]) } } }, Xl = { inspect: Ll = function(e) { for (var t, i, r, n, a, s = 0, o = [], u = new ArrayBuffer(e.length), l = new Uint8Array(u), d = 0; d < e .length; ++d) l[d] = e[d]; for (t = new DataView(u); s < e.byteLength;) i = t.getUint32(s), r = Gl(e.subarray(s + 4, s + 8)), n = i > 1 ? s + i : e.byteLength, (a = (ql[r] || function(e) { return { data: e } })(e.subarray(s + 8, n))).size = i, a.type = r, o.push(a), s = n; return o }, textify: xl = function(e, t) { var i; return t = t || 0, i = new Array(2 * t + 1).join(" "), e.map(function(e, r) { return i + e.type + "\n" + Object.keys(e).filter(function(e) { return "type" !== e && "boxes" !== e }).map(function(t) { var r = i + " " + t + ": ", n = e[t]; if (n instanceof Uint8Array || n instanceof Uint32Array) { var a = Array.prototype.slice.call(new Uint8Array(n.buffer, n.byteOffset, n.byteLength)).map( function(e) { return " " + ("00" + e.toString(16)).slice(-2) }).join("").match(/.{1,24}/g); return a ? 1 === a.length ? r + "<" + a.join("").slice(1) + ">" : r + "<\n" + a.map(function( e) { return i + " " + e }).join("\n") + "\n" + i + " >" : r + "<>" } return r + JSON.stringify(n, null, 2).split("\n").map(function(e, t) { return 0 === t ? e : i + " " + e }).join("\n") }).join("\n") + (e.boxes ? "\n" + xl(e.boxes, t + 1) : "") }).join("\n") }, parseTfdt: ql.tfdt, parseHdlr: ql.hdlr, parseTfhd: ql.tfhd, parseTrun: ql.trun }, zl = Xl.inspect, Kl = Xl.textify, Yl = Xl.parseTfdt, Ql = Xl.parseHdlr, Jl = Xl.parseTfhd, Zl = Xl.parseTrun, $l = Object.freeze({ default: Xl, __moduleExports: Xl, inspect: zl, textify: Kl, parseTfdt: Yl, parseHdlr: Ql, parseTfhd: Jl, parseTrun: Zl }), ed = $l && Xl || $l, td = Xo.discardEmulationPreventionBytes, id = Au.CaptionStream, rd = function(e, t) { for (var i = e, r = 0; r < t.length; r++) { var n = t[r]; if (i < n.size) return n; i -= n.size } return null }, nd = function(e, t) { var i = fo.findBox(e, ["moof", "traf"]), r = {}, n = []; return fo.findBox(e, ["mdat"]).forEach(function(e, t) { var r = i[t]; n.push({ mdat: e, traf: r }) }), n.forEach(function(e) { var i, n = e.mdat, a = e.traf, s = fo.findBox(a, ["tfhd"]), o = ed.parseTfhd(s[0]), u = o.trackId, l = fo.findBox(a, ["tfdt"]), d = l.length > 0 ? ed.parseTfdt(l[0]).baseMediaDecodeTime : 0, c = fo.findBox(a, ["trun"]); t === u && c.length > 0 && (i = function(e, t, i) { var r, n, a, s, o = new DataView(e.buffer, e.byteOffset, e.byteLength), u = []; for (n = 0; n + 4 < e.length; n += a) if (a = o.getUint32(n), n += 4, !(a <= 0)) switch (31 & e[n]) { case 6: var l = e.subarray(n + 1, n + 1 + a), d = rd(n, t); r = { nalUnitType: "sei_rbsp", size: a, data: l, escapedRBSP: td(l), trackId: i }, d ? (r.pts = d.pts, r.dts = d.dts, s = d) : (r.pts = s.pts, r.dts = s.dts), u.push(r) } return u }(n, function(e, t, i) { var r = t, n = i.defaultSampleDuration || 0, a = i.defaultSampleSize || 0, s = i.trackId, o = []; return e.forEach(function(e) { var t = ed.parseTrun(e).samples; t.forEach(function(e) { void 0 === e.duration && (e.duration = n), void 0 === e.size && (e.size = a), e .trackId = s, e.dts = r, void 0 === e.compositionTimeOffset && (e .compositionTimeOffset = 0), e.pts = r + e.compositionTimeOffset, r += e.duration }), o = o.concat(t) }), o }(c, d, o), u), r[u] || (r[u] = []), r[u] = r[u].concat(i)) }), r }, ad = function() { var e, t, i, r, n, a = !1; this.isInitialized = function() { return a }, this.init = function() { e = new id, a = !0, e.on("data", function(e) { e.startTime = e.startPts / r, e.endTime = e.endPts / r, n.captions.push(e), n.captionStreams[e .stream] = !0 }) }, this.isNewInit = function(e, t) { return !(e && 0 === e.length || t && "object" === (void 0 === t ? "undefined" : v(t)) && 0 === Object.keys( t).length || i === e[0] && r === t[i]) }, this.parse = function(e, a, s) { var o; if (!this.isInitialized()) return null; if (!a || !s) return null; if (this.isNewInit(a, s)) i = a[0], r = s[i]; else if (!i || !r) return t.push(e), null; for (; t.length > 0;) { var u = t.shift(); this.parse(u, a, s) } return null !== (o = function(e, t, i) { return t ? { seiNals: nd(e, t)[t], timescale: i } : null }(e, i, r)) && o.seiNals ? (this.pushNals(o.seiNals), this.flushStream(), n) : null }, this.pushNals = function(t) { if (!this.isInitialized() || !t || 0 === t.length) return null; t.forEach(function(t) { e.push(t) }) }, this.flushStream = function() { if (!this.isInitialized()) return null; e.flush() }, this.clearParsedCaptions = function() { n.captions = [], n.captionStreams = {} }, this.resetCaptionStream = function() { if (!this.isInitialized()) return null; e.reset() }, this.clearAllCaptions = function() { this.clearParsedCaptions(), this.resetCaptionStream() }, this.reset = function() { t = [], i = null, r = null, n ? this.clearParsedCaptions() : n = { captions: [], captionStreams: {} }, this.resetCaptionStream() }, this.reset() }, sd = Object.freeze({ default: ad, __moduleExports: ad }), od = Hl && Pl || Hl, ud = sd && ad || sd, ld = { generator: El, probe: fo, Transmuxer: od.Transmuxer, AudioSegmentStream: od.AudioSegmentStream, VideoSegmentStream: od.VideoSegmentStream, CaptionParser: ud }.CaptionParser, dd = function(e) { var t = 31 & e[1]; return t <<= 8, t |= e[2] }, cd = function(e) { return !!(64 & e[1]) }, hd = function(e) { var t = 0; return (48 & e[3]) >>> 4 > 1 && (t += e[4] + 1), t }, fd = function(e) { switch (e) { case 5: return "slice_layer_without_partitioning_rbsp_idr"; case 6: return "sei_rbsp"; case 7: return "seq_parameter_set_rbsp"; case 8: return "pic_parameter_set_rbsp"; case 9: return "access_unit_delimiter_rbsp"; default: return null } }, pd = { parseType: function(e, t) { var i = dd(e); return 0 === i ? "pat" : i === t ? "pmt" : t ? "pes" : null }, parsePat: function(e) { var t = cd(e), i = 4 + hd(e); return t && (i += e[i] + 1), (31 & e[i + 10]) << 8 | e[i + 11] }, parsePmt: function(e) { var t = {}, i = cd(e), r = 4 + hd(e); if (i && (r += e[r] + 1), 1 & e[r + 5]) { var n; n = 3 + ((15 & e[r + 1]) << 8 | e[r + 2]) - 4; for (var a = 12 + ((15 & e[r + 10]) << 8 | e[r + 11]); a < n;) { var s = r + a; t[(31 & e[s + 1]) << 8 | e[s + 2]] = e[s], a += 5 + ((15 & e[s + 3]) << 8 | e[s + 4]) } return t } }, parsePayloadUnitStartIndicator: cd, parsePesType: function(e, t) { switch (t[dd(e)]) { case mu.H264_STREAM_TYPE: return "video"; case mu.ADTS_STREAM_TYPE: return "audio"; case mu.METADATA_STREAM_TYPE: return "timed-metadata"; default: return null } }, parsePesTime: function(e) { if (!cd(e)) return null; var t = 4 + hd(e); if (t >= e.byteLength) return null; var i, r = null; return 192 & (i = e[t + 7]) && ((r = {}).pts = (14 & e[t + 9]) << 27 | (255 & e[t + 10]) << 20 | (254 & e[ t + 11]) << 12 | (255 & e[t + 12]) << 5 | (254 & e[t + 13]) >>> 3, r.pts *= 4, r.pts += (6 & e[t + 13]) >>> 1, r.dts = r.pts, 64 & i && (r.dts = (14 & e[t + 14]) << 27 | (255 & e[t + 15]) << 20 | ( 254 & e[t + 16]) << 12 | (255 & e[t + 17]) << 5 | (254 & e[t + 18]) >>> 3, r.dts *= 4, r.dts += (6 & e[t + 18]) >>> 1)), r }, videoPacketContainsKeyFrame: function(e) { for (var t = 4 + hd(e), i = e.subarray(t), r = 0, n = 0, a = !1; n < i.byteLength - 3; n++) if (1 === i[n + 2]) { r = n + 5; break } for (; r < i.byteLength;) switch (i[r]) { case 0: if (0 !== i[r - 1]) { r += 2; break } if (0 !== i[r - 2]) { r++; break } n + 3 !== r - 2 && "slice_layer_without_partitioning_rbsp_idr" === fd(31 & i[n + 3]) && (a = !0); do { r++ } while (1 !== i[r] && r < i.length); n = r - 2, r += 3; break; case 1: if (0 !== i[r - 1] || 0 !== i[r - 2]) { r += 3; break } "slice_layer_without_partitioning_rbsp_idr" === fd(31 & i[n + 3]) && (a = !0), n = r - 2, r += 3; break; default: r += 3 } return i = i.subarray(n), r -= n, n = 0, i && i.byteLength > 3 && "slice_layer_without_partitioning_rbsp_idr" === fd(31 & i[n + 3]) && (a = !0), a } }, md = pd.parseType, gd = pd.parsePat, vd = pd.parsePmt, yd = pd.parsePayloadUnitStartIndicator, _d = pd.parsePesType, bd = pd.parsePesTime, wd = pd.videoPacketContainsKeyFrame, Ed = Object.freeze({ default: pd, __moduleExports: pd, parseType: md, parsePat: gd, parsePmt: vd, parsePayloadUnitStartIndicator: yd, parsePesType: _d, parsePesTime: bd, videoPacketContainsKeyFrame: wd }), Td = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350], Sd = function(e) { return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3] }, Ad = { parseId3TagSize: function(e, t) { var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]; return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10 }, parseAdtsSize: function(e, t) { var i = (224 & e[t + 5]) >> 5, r = e[t + 4] << 3; return 6144 & e[t + 3] | r | i }, parseType: function(e, t) { return e[t] === "I".charCodeAt(0) && e[t + 1] === "D".charCodeAt(0) && e[t + 2] === "3".charCodeAt(0) ? "timed-metadata" : !0 & e[t] && 240 == (240 & e[t + 1]) ? "audio" : null }, parseSampleRate: function(e) { for (var t = 0; t + 5 < e.length;) { if (255 === e[t] && 240 == (246 & e[t + 1])) return Td[(60 & e[t + 2]) >>> 2]; t++ } return null }, parseAacTimestamp: function(e) { var t, i, r; t = 10, 64 & e[5] && (t += 4, t += Sd(e.subarray(10, 14))); do { if ((i = Sd(e.subarray(t + 4, t + 8))) < 1) return null; if ("PRIV" === String.fromCharCode(e[t], e[t + 1], e[t + 2], e[t + 3])) { r = e.subarray(t + 10, t + i + 10); for (var n = 0; n < r.byteLength; n++) if (0 === r[n]) { if ("com.apple.streaming.transportStreamTimestamp" === unescape(function(e, t, i) { var r, n = ""; for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2); return n }(r, 0, n))) { var a = r.subarray(n + 1), s = (1 & a[3]) << 30 | a[4] << 22 | a[5] << 14 | a[6] << 6 | a[7] >>> 2; return s *= 4, s += 3 & a[7] } break } } t += 10, t += i } while (t < e.byteLength); return null } }, kd = Ad.parseId3TagSize, Rd = Ad.parseAdtsSize, Md = Ad.parseType, Od = Ad.parseSampleRate, Cd = Ad.parseAacTimestamp, Dd = Object.freeze({ default: Ad, __moduleExports: Ad, parseId3TagSize: kd, parseAdtsSize: Rd, parseType: Md, parseSampleRate: Od, parseAacTimestamp: Cd }), Id = Ed && pd || Ed, Ld = Dd && Ad || Dd, xd = ku.handleRollover, Pd = {}; Pd.ts = Id, Pd.aac = Ld; var Ud = function(e, t, i) { for (var r, n, a, s, o = 0, u = 188, l = !1; u < e.byteLength;) if (71 !== e[o] || 71 !== e[u]) o++, u++; else { switch (r = e.subarray(o, u), Pd.ts.parseType(r, t.pid)) { case "pes": n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "audio" === n && a && ( s = Pd.ts.parsePesTime(r)) && (s.type = "audio", i.audio.push(s), l = !0) } if (l) break; o += 188, u += 188 } for (o = (u = e.byteLength) - 188, l = !1; o >= 0;) if (71 !== e[o] || 71 !== e[u]) o--, u--; else { switch (r = e.subarray(o, u), Pd.ts.parseType(r, t.pid)) { case "pes": n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "audio" === n && a && ( s = Pd.ts.parsePesTime(r)) && (s.type = "audio", i.audio.push(s), l = !0) } if (l) break; o -= 188, u -= 188 } }, Nd = function(e, t, i) { for (var r, n, a, s, o, u, l, d = 0, c = 188, h = !1, f = { data: [], size: 0 }; c < e.byteLength;) if (71 !== e[d] || 71 !== e[c]) d++, c++; else { switch (r = e.subarray(d, c), Pd.ts.parseType(r, t.pid)) { case "pes": if (n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "video" === n && ( a && !h && (s = Pd.ts.parsePesTime(r)) && (s.type = "video", i.video.push(s), h = !0), !i .firstKeyFrame)) { if (a && 0 !== f.size) { for (o = new Uint8Array(f.size), u = 0; f.data.length;) l = f.data.shift(), o.set(l, u), u += l .byteLength; Pd.ts.videoPacketContainsKeyFrame(o) && (i.firstKeyFrame = Pd.ts.parsePesTime(o), i.firstKeyFrame .type = "video"), f.size = 0 } f.data.push(r), f.size += r.byteLength } } if (h && i.firstKeyFrame) break; d += 188, c += 188 } for (d = (c = e.byteLength) - 188, h = !1; d >= 0;) if (71 !== e[d] || 71 !== e[c]) d--, c--; else { switch (r = e.subarray(d, c), Pd.ts.parseType(r, t.pid)) { case "pes": n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "video" === n && a && ( s = Pd.ts.parsePesTime(r)) && (s.type = "video", i.video.push(s), h = !0) } if (h) break; d -= 188, c -= 188 } }, Bd = function(e) { var t = { pid: null, table: null }, i = {}; for (var r in function(e, t) { for (var i, r = 0, n = 188; n < e.byteLength;) if (71 !== e[r] || 71 !== e[n]) r++, n++; else { switch (i = e.subarray(r, n), Pd.ts.parseType(i, t.pid)) { case "pat": t.pid || (t.pid = Pd.ts.parsePat(i)); break; case "pmt": t.table || (t.table = Pd.ts.parsePmt(i)) } if (t.pid && t.table) return; r += 188, n += 188 } }(e, t), t.table) { if (t.table.hasOwnProperty(r)) switch (t.table[r]) { case mu.H264_STREAM_TYPE: i.video = [], Nd(e, t, i), 0 === i.video.length && delete i.video; break; case mu.ADTS_STREAM_TYPE: i.audio = [], Ud(e, t, i), 0 === i.audio.length && delete i.audio } } return i }, Fd = function(e, t) { var i, r; return (r = (i = e)[0] === "I".charCodeAt(0) && i[1] === "D".charCodeAt(0) && i[2] === "3".charCodeAt(0) ? function(e) { for (var t, i = !1, r = 0, n = null, a = null, s = 0, o = 0; e.length - o >= 3;) { switch (Pd.aac.parseType(e, o)) { case "timed-metadata": if (e.length - o < 10) { i = !0; break } if ((s = Pd.aac.parseId3TagSize(e, o)) > e.length) { i = !0; break } null === a && (t = e.subarray(o, o + s), a = Pd.aac.parseAacTimestamp(t)), o += s; break; case "audio": if (e.length - o < 7) { i = !0; break } if ((s = Pd.aac.parseAdtsSize(e, o)) > e.length) { i = !0; break } null === n && (t = e.subarray(o, o + s), n = Pd.aac.parseSampleRate(t)), r++, o += s; break; default: o++ } if (i) return null } if (null === n || null === a) return null; var u = 9e4 / n; return { audio: [{ type: "audio", dts: a, pts: a }, { type: "audio", dts: a + 1024 * r * u, pts: a + 1024 * r * u }] } }(e) : Bd(e)) && (r.audio || r.video) ? (function(e, t) { if (e.audio && e.audio.length) { var i = t; void 0 === i && (i = e.audio[0].dts), e.audio.forEach(function(e) { e.dts = xd(e.dts, i), e.pts = xd(e.pts, i), e.dtsTime = e.dts / 9e4, e.ptsTime = e.pts / 9e4 }) } if (e.video && e.video.length) { var r = t; if (void 0 === r && (r = e.video[0].dts), e.video.forEach(function(e) { e.dts = xd(e.dts, r), e.pts = xd(e.pts, r), e.dtsTime = e.dts / 9e4, e.ptsTime = e.pts / 9e4 }), e.firstKeyFrame) { var n = e.firstKeyFrame; n.dts = xd(n.dts, r), n.pts = xd(n.pts, r), n.dtsTime = n.dts / 9e4, n.ptsTime = n.dts / 9e4 } } }(r, t), r) : null }; var jd = function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, Hd = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), Gd = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t }, Vd = function() { var e = [ [ [], [], [], [], [] ], [ [], [], [], [], [] ] ], t = e[0], i = e[1], r = t[4], n = i[4], a = void 0, s = void 0, o = void 0, u = [], l = [], d = void 0, c = void 0, h = void 0, f = void 0, p = void 0; for (a = 0; a < 256; a++) l[(u[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a; for (s = o = 0; !r[s]; s ^= d || 1, o = l[o] || 1) for (h = (h = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4) >> 8 ^ 255 & h ^ 99, r[s] = h, n[h] = s, p = 16843009 * u[c = u[d = u[s]]] ^ 65537 * c ^ 257 * d ^ 16843008 * s, f = 257 * u[h] ^ 16843008 * h, a = 0; a < 4; a++) t[a][s] = f = f << 24 ^ f >>> 8, i[a][h] = p = p << 24 ^ p >>> 8; for (a = 0; a < 5; a++) t[a] = t[a].slice(0), i[a] = i[a].slice(0); return e }, Wd = null, qd = function() { function e(t) { jd(this, e), Wd || (Wd = Vd()), this._tables = [ [Wd[0][0].slice(), Wd[0][1].slice(), Wd[0][2].slice(), Wd[0][3].slice(), Wd[0][4].slice()], [Wd[1][0].slice(), Wd[1][1].slice(), Wd[1][2].slice(), Wd[1][3].slice(), Wd[1][4].slice()] ]; var i = void 0, r = void 0, n = void 0, a = void 0, s = void 0, o = this._tables[0][4], u = this._tables[1], l = t.length, d = 1; if (4 !== l && 6 !== l && 8 !== l) throw new Error("Invalid aes key size"); for (a = t.slice(0), s = [], this._key = [a, s], i = l; i < 4 * l + 28; i++) n = a[i - 1], (i % l == 0 || 8 === l && i % l == 4) && (n = o[n >>> 24] << 24 ^ o[n >> 16 & 255] << 16 ^ o[n >> 8 & 255] << 8 ^ o[255 & n], i % l == 0 && (n = n << 8 ^ n >>> 24 ^ d << 24, d = d << 1 ^ 283 * (d >> 7))), a[i] = a[i - l] ^ n; for (r = 0; i; r++, i--) n = a[3 & r ? i : i - 4], s[r] = i <= 4 || r < 4 ? n : u[0][o[n >>> 24]] ^ u[1][o[ n >> 16 & 255]] ^ u[2][o[n >> 8 & 255]] ^ u[3][o[255 & n]] } return e.prototype.decrypt = function(e, t, i, r, n, a) { var s = this._key[1], o = e ^ s[0], u = r ^ s[1], l = i ^ s[2], d = t ^ s[3], c = void 0, h = void 0, f = void 0, p = s.length / 4 - 2, m = void 0, g = 4, v = this._tables[1], y = v[0], _ = v[1], b = v[2], w = v[3], E = v[4]; for (m = 0; m < p; m++) c = y[o >>> 24] ^ _[u >> 16 & 255] ^ b[l >> 8 & 255] ^ w[255 & d] ^ s[g], h = y[ u >>> 24] ^ _[l >> 16 & 255] ^ b[d >> 8 & 255] ^ w[255 & o] ^ s[g + 1], f = y[l >>> 24] ^ _[d >> 16 & 255] ^ b[o >> 8 & 255] ^ w[255 & u] ^ s[g + 2], d = y[d >>> 24] ^ _[o >> 16 & 255] ^ b[u >> 8 & 255] ^ w[255 & l] ^ s[g + 3], g += 4, o = c, u = h, l = f; for (m = 0; m < 4; m++) n[(3 & -m) + a] = E[o >>> 24] << 24 ^ E[u >> 16 & 255] << 16 ^ E[l >> 8 & 255] << 8 ^ E[255 & d] ^ s[g++], c = o, o = u, u = l, l = d, d = c }, e }(), Xd = function() { function e() { jd(this, e), this.listeners = {} } return e.prototype.on = function(e, t) { this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t) }, e.prototype.off = function(e, t) { if (!this.listeners[e]) return !1; var i = this.listeners[e].indexOf(t); return this.listeners[e].splice(i, 1), i > -1 }, e.prototype.trigger = function(e) { var t = this.listeners[e]; if (t) if (2 === arguments.length) for (var i = t.length, r = 0; r < i; ++r) t[r].call(this, arguments[1]); else for (var n = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s].apply(this, n) }, e.prototype.dispose = function() { this.listeners = {} }, e.prototype.pipe = function(e) { this.on("data", function(t) { e.push(t) }) }, e }(), zd = function(e) { function t() { jd(this, t); var i = Gd(this, e.call(this, Xd)); return i.jobs = [], i.delay = 1, i.timeout_ = null, i } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t))); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, e), t.prototype.processJob_ = function() { this.jobs.shift()(), this.jobs.length ? this.timeout_ = setTimeout(this.processJob_.bind(this), this .delay) : this.timeout_ = null }, t.prototype.push = function(e) { this.jobs.push(e), this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay)) }, t }(Xd), Kd = function(e) { return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24 }, Yd = function(e, t, i) { var r = new Int32Array(e.buffer, e.byteOffset, e.byteLength >> 2), n = new qd(Array.prototype.slice.call(t)), a = new Uint8Array(e.byteLength), s = new Int32Array(a.buffer), o = void 0, u = void 0, l = void 0, d = void 0, c = void 0, h = void 0, f = void 0, p = void 0, m = void 0; for (o = i[0], u = i[1], l = i[2], d = i[3], m = 0; m < r.length; m += 4) c = Kd(r[m]), h = Kd(r[m + 1]), f = Kd(r[m + 2]), p = Kd(r[m + 3]), n.decrypt(c, h, f, p, s, m), s[m] = Kd(s[m] ^ o), s[m + 1] = Kd(s[m + 1] ^ u), s[m + 2] = Kd(s[m + 2] ^ l), s[m + 3] = Kd(s[m + 3] ^ d), o = c, u = h, l = f, d = p; return a }, Qd = function() { function e(t, i, r, n) { jd(this, e); var a = e.STEP, s = new Int32Array(t.buffer), o = new Uint8Array(t.byteLength), u = 0; for (this.asyncStream_ = new zd, this.asyncStream_.push(this.decryptChunk_(s.subarray(u, u + a), i, r, o)), u = a; u < s.length; u += a) r = new Uint32Array([Kd(s[u - 4]), Kd(s[u - 3]), Kd(s[u - 2]), Kd(s[u - 1])]), this.asyncStream_.push(this.decryptChunk_(s.subarray(u, u + a), i, r, o)); this.asyncStream_.push(function() { var e; n(null, (e = o).subarray(0, e.byteLength - e[e.byteLength - 1])) }) } return e.prototype.decryptChunk_ = function(e, t, i, r) { return function() { var n = Yd(e, t, i); r.set(n, e.byteOffset) } }, Hd(e, null, [{ key: "STEP", get: function() { return 32e3 } }]), e }(), Jd = function(e, t) { return /^[a-z]+:/i.test(t) ? t : (/\/\//i.test(e) || (e = ka.buildAbsoluteURL(n.location.href, e)), ka .buildAbsoluteURL(e, t)) }, Zd = function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, $d = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), ec = function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t))); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }, tc = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t }, ic = function() { return function(e, t) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return function(e, t) { var i = [], r = !0, n = !1, a = void 0; try { for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s.value), !t || i .length !== t); r = !0); } catch (e) { n = !0, a = e } finally { try { !r && o.return && o.return() } finally { if (n) throw a } } return i }(e, t); throw new TypeError("Invalid attempt to destructure non-iterable instance") } }(), rc = Ta.mergeOptions, nc = Ta.EventTarget, ac = Ta.log, sc = function(e, t) { ["AUDIO", "SUBTITLES"].forEach(function(i) { for (var r in e.mediaGroups[i]) for (var n in e.mediaGroups[i][r]) { var a = e.mediaGroups[i][r][n]; t(a, i, r, n) } }) }, oc = function(e, t) { var i = rc(e, {}), r = i.playlists[t.uri]; if (!r) return null; if (r.segments && t.segments && r.segments.length === t.segments.length && r.mediaSequence === t.mediaSequence) return null; var n = rc(r, t); r.segments && (n.segments = function(e, t, i) { var r = t.slice(); i = i || 0; for (var n = Math.min(e.length, t.length + i), a = i; a < n; a++) r[a - i] = rc(e[a], r[a - i]); return r }(r.segments, t.segments, t.mediaSequence - r.mediaSequence)), n.segments.forEach(function(e) { ! function(e, t) { e.resolvedUri || (e.resolvedUri = Jd(t, e.uri)), e.key && !e.key.resolvedUri && (e.key.resolvedUri = Jd( t, e.key.uri)), e.map && !e.map.resolvedUri && (e.map.resolvedUri = Jd(t, e.map.uri)) }(e, n.resolvedUri) }); for (var a = 0; a < i.playlists.length; a++) i.playlists[a].uri === t.uri && (i.playlists[a] = n); return i.playlists[t.uri] = n, i }, uc = function(e) { for (var t = e.playlists.length; t--;) { var i = e.playlists[t]; e.playlists[i.uri] = i, i.resolvedUri = Jd(e.uri, i.uri), i.id = t, i.attributes || (i.attributes = {}, ac .warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")) } }, lc = function(e) { sc(e, function(t) { t.uri && (t.resolvedUri = Jd(e.uri, t.uri)) }) }, dc = function(e, t) { var i = e.segments[e.segments.length - 1]; return t && i && i.duration ? 1e3 * i.duration : 500 * (e.targetDuration || 10) }, cc = function(e) { function t(e, i, r) { Zd(this, t); var n = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); if (n.srcUrl = e, n.hls_ = i, n.withCredentials = r, !n.srcUrl) throw new Error( "A non-empty playlist URL is required"); return n.state = "HAVE_NOTHING", n.on("mediaupdatetimeout", function() { "HAVE_METADATA" === n.state && (n.state = "HAVE_CURRENT_METADATA", n.request = n.hls_.xhr({ uri: Jd(n.master.uri, n.media().uri), withCredentials: n.withCredentials }, function(e, t) { if (n.request) return e ? n.playlistRequestError(n.request, n.media().uri, "HAVE_METADATA") : void n.haveMetadata(n.request, n.media().uri) })) }), n } return ec(t, nc), $d(t, [{ key: "playlistRequestError", value: function(e, t, i) { this.request = null, i && (this.state = i), this.error = { playlist: this.master.playlists[t], status: e.status, message: "HLS playlist request error at URL: " + t, responseText: e.responseText, code: e.status >= 500 ? 4 : 2 }, this.trigger("error") } }, { key: "haveMetadata", value: function(e, t) { var i = this; this.request = null, this.state = "HAVE_METADATA"; var r = new Pa; r.push(e.responseText), r.end(), r.manifest.uri = t, r.manifest.attributes = r.manifest .attributes || {}; var a = oc(this.master, r.manifest); this.targetDuration = r.manifest.targetDuration, a ? (this.master = a, this.media_ = this.master .playlists[r.manifest.uri]) : this.trigger("playlistunchanged"), this.media().endList || (n .clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = n.setTimeout(function() { i.trigger("mediaupdatetimeout") }, dc(this.media(), !!a))), this.trigger("loadedplaylist") } }, { key: "dispose", value: function() { this.stopRequest(), n.clearTimeout(this.mediaUpdateTimeout) } }, { key: "stopRequest", value: function() { if (this.request) { var e = this.request; this.request = null, e.onreadystatechange = null, e.abort() } } }, { key: "media", value: function(e) { var t = this; if (!e) return this.media_; if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this .state); var i = this.state; if ("string" == typeof e) { if (!this.master.playlists[e]) throw new Error("Unknown playlist URI: " + e); e = this.master.playlists[e] } var r = !this.media_ || e.uri !== this.media_.uri; if (this.master.playlists[e.uri].endList) return this.request && (this.request.onreadystatechange = null, this.request.abort(), this.request = null), this.state = "HAVE_METADATA", this.media_ = e, void(r && (this.trigger("mediachanging"), this.trigger("mediachange"))); if (r) { if (this.state = "SWITCHING_MEDIA", this.request) { if (Jd(this.master.uri, e.uri) === this.request.url) return; this.request.onreadystatechange = null, this.request.abort(), this.request = null } this.media_ && this.trigger("mediachanging"), this.request = this.hls_.xhr({ uri: Jd(this.master.uri, e.uri), withCredentials: this.withCredentials }, function(r, n) { if (t.request) { if (r) return t.playlistRequestError(t.request, e.uri, i); t.haveMetadata(n, e.uri), "HAVE_MASTER" === i ? t.trigger("loadedmetadata") : t.trigger( "mediachange") } }) } } }, { key: "pause", value: function() { this.stopRequest(), n.clearTimeout(this.mediaUpdateTimeout), "HAVE_NOTHING" === this.state && (this .started = !1), "SWITCHING_MEDIA" === this.state ? this.media_ ? this.state = "HAVE_METADATA" : this.state = "HAVE_MASTER" : "HAVE_CURRENT_METADATA" === this.state && (this.state = "HAVE_METADATA") } }, { key: "load", value: function(e) { var t = this; n.clearTimeout(this.mediaUpdateTimeout); var i = this.media(); if (e) { var r = i ? i.targetDuration / 2 * 1e3 : 5e3; this.mediaUpdateTimeout = n.setTimeout(function() { return t.load() }, r) } else this.started ? i && !i.endList ? this.trigger("mediaupdatetimeout") : this.trigger( "loadedplaylist") : this.start() } }, { key: "start", value: function() { var e = this; this.started = !0, this.request = this.hls_.xhr({ uri: this.srcUrl, withCredentials: this.withCredentials }, function(t, i) { if (e.request) { if (e.request = null, t) return e.error = { status: i.status, message: "HLS playlist request error at URL: " + e.srcUrl, responseText: i.responseText, code: 2 }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error"); var r = new Pa; return r.push(i.responseText), r.end(), e.state = "HAVE_MASTER", r.manifest.uri = e.srcUrl, r.manifest.playlists ? (e.master = r.manifest, uc(e.master), lc(e.master), e.trigger( "loadedplaylist"), void(e.request || e.media(r.manifest.playlists[0]))) : (e.master = { mediaGroups: { AUDIO: {}, VIDEO: {}, "CLOSED-CAPTIONS": {}, SUBTITLES: {} }, uri: n.location.href, playlists: [{ uri: e.srcUrl, id: 0 }] }, e.master.playlists[e.srcUrl] = e.master.playlists[0], e.master.playlists[0] .resolvedUri = e.srcUrl, e.master.playlists[0].attributes = e.master.playlists[0] .attributes || {}, e.haveMetadata(i, e.srcUrl), e.trigger("loadedmetadata")) } }) } }]), t }(), hc = Ta.createTimeRange, fc = function(e, t, i) { var r, n; return void 0 === t && (t = e.mediaSequence + e.segments.length), t < e.mediaSequence ? 0 : (r = function(e, t) { var i = 0, r = t - e.mediaSequence, n = e.segments[r]; if (n) { if (void 0 !== n.start) return { result: n.start, precise: !0 }; if (void 0 !== n.end) return { result: n.end - n.duration, precise: !0 } } for (; r--;) { if (void 0 !== (n = e.segments[r]).end) return { result: i + n.end, precise: !0 }; if (i += n.duration, void 0 !== n.start) return { result: i + n.start, precise: !0 } } return { result: i, precise: !1 } }(e, t)).precise ? r.result : (n = function(e, t) { for (var i = 0, r = void 0, n = t - e.mediaSequence; n < e.segments.length; n++) { if (void 0 !== (r = e.segments[n]).start) return { result: r.start - i, precise: !0 }; if (i += r.duration, void 0 !== r.end) return { result: r.end - i, precise: !0 } } return { result: -1, precise: !1 } }(e, t)).precise ? n.result : r.result + i }, pc = function(e, t, i) { if (!e) return 0; if ("number" != typeof i && (i = 0), void 0 === t) { if (e.totalDuration) return e.totalDuration; if (!e.endList) return n.Infinity } return fc(e, t, i) }, mc = function(e, t, i) { var r = 0; if (t > i) { var n = [i, t]; t = n[0], i = n[1] } if (t < 0) { for (var a = t; a < Math.min(0, i); a++) r += e.targetDuration; t = 0 } for (var s = t; s < i; s++) r += e.segments[s].duration; return r }, gc = function(e) { if (!e.segments.length) return 0; for (var t = e.segments.length - 1, i = e.segments[t].duration || e.targetDuration, r = i + 2 * e .targetDuration; t-- && !((i += e.segments[t].duration) >= r);); return Math.max(0, t) }, vc = function(e, t, i) { if (!e || !e.segments) return null; if (e.endList) return pc(e); if (null === t) return null; t = t || 0; var r = i ? gc(e) : e.segments.length; return fc(e, e.mediaSequence + r, t) }, yc = function(e) { return e - Math.floor(e) == 0 }, _c = function(e, t) { if (yc(t)) return t + .1 * e; for (var i = t.toString().split(".")[1].length, r = 1; r <= i; r++) { var n = Math.pow(10, r), a = t * n; if (yc(a) || r === i) return (a + e) / n } }, bc = _c.bind(null, 1), wc = _c.bind(null, -1), Ec = function(e) { return e.excludeUntil && e.excludeUntil > Date.now() }, Tc = function(e) { return e.excludeUntil && e.excludeUntil === 1 / 0 }, Sc = function(e) { var t = Ec(e); return !e.disabled && !t }, Ac = function(e, t) { return t.attributes && t.attributes[e] }, kc = function(e, t) { if (1 === e.playlists.length) return !0; var i = t.attributes.BANDWIDTH || Number.MAX_VALUE; return 0 === e.playlists.filter(function(e) { return !!Sc(e) && (e.attributes.BANDWIDTH || 0) < i }).length }, Rc = { duration: pc, seekable: function(e, t) { var i = t || 0, r = vc(e, t, !0); return null === r ? hc() : hc(i, r) }, safeLiveIndex: gc, getMediaInfoForTime: function(e, t, i, r) { var n = void 0, a = void 0, s = e.segments.length, o = t - r; if (o < 0) { if (i > 0) for (n = i - 1; n >= 0; n--) if (a = e.segments[n], (o += wc(a.duration)) > 0) return { mediaIndex: n, startTime: r - mc(e, i, n) }; return { mediaIndex: 0, startTime: t } } if (i < 0) { for (n = i; n < 0; n++) if ((o -= e.targetDuration) < 0) return { mediaIndex: 0, startTime: t }; i = 0 } for (n = i; n < s; n++) if (a = e.segments[n], (o -= bc(a.duration)) < 0) return { mediaIndex: n, startTime: r + mc(e, i, n) }; return { mediaIndex: s - 1, startTime: t } }, isEnabled: Sc, isDisabled: function(e) { return e.disabled }, isBlacklisted: Ec, isIncompatible: Tc, playlistEnd: vc, isAes: function(e) { for (var t = 0; t < e.segments.length; t++) if (e.segments[t].key) return !0; return !1 }, isFmp4: function(e) { for (var t = 0; t < e.segments.length; t++) if (e.segments[t].map) return !0; return !1 }, hasAttribute: Ac, estimateSegmentRequestTime: function(e, t, i) { var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0; return Ac("BANDWIDTH", i) ? (e * i.attributes.BANDWIDTH - 8 * r) / t : NaN }, isLowestEnabledRendition: kc }, Mc = Ta.xhr, Oc = Ta.mergeOptions, Cc = function() { return function e(t, i) { t = Oc({ timeout: 45e3 }, t); var r = e.beforeRequest || Ta.Hls.xhr.beforeRequest; if (r && "function" == typeof r) { var n = r(t); n && (t = n) } var a = Mc(t, function(e, t) { var r = a.response; !e && r && (a.responseTime = Date.now(), a.roundTripTime = a.responseTime - a.requestTime, a .bytesReceived = r.byteLength || r.length, a.bandwidth || (a.bandwidth = Math.floor(a .bytesReceived / a.roundTripTime * 8 * 1e3))), t.headers && (a.responseHeaders = t.headers), e && "ETIMEDOUT" === e.code && (a.timedout = !0), e || a.aborted || 200 === t.statusCode || 206 === t.statusCode || 0 === t.statusCode || (e = new Error("XHR Failed with a response of: " + (a && (r || a.responseText)))), i(e, a) }), s = a.abort; return a.abort = function() { return a.aborted = !0, s.apply(a, arguments) }, a.uri = t.uri, a.requestTime = Date.now(), a } }, Dc = function(e, t) { return e.start(t) + "-" + e.end(t) }, Ic = function(e, t) { var i = e.toString(16); return "00".substring(0, 2 - i.length) + i + (t % 2 ? " " : "") }, Lc = function(e) { return e >= 32 && e < 126 ? String.fromCharCode(e) : "." }, xc = function(e) { var t = {}; return Object.keys(e).forEach(function(i) { var r = e[i]; ArrayBuffer.isView(r) ? t[i] = { bytes: r.buffer, byteOffset: r.byteOffset, byteLength: r.byteLength } : t[i] = r }), t }, Pc = function(e) { var t = e.byterange || { length: 1 / 0, offset: 0 }; return [t.length, t.offset, e.resolvedUri].join(",") }, Uc = function(e) { for (var t = Array.prototype.slice.call(e), i = "", r = 0; r < t.length / 16; r++) i += t.slice(16 * r, 16 * r + 16).map(Ic).join("") + " " + t.slice(16 * r, 16 * r + 16).map(Lc).join("") + "\n"; return i }, Nc = Object.freeze({ createTransferableMessage: xc, initSegmentId: Pc, hexDump: Uc, tagDump: function(e) { var t = e.bytes; return Uc(t) }, textRanges: function(e) { var t = "", i = void 0; for (i = 0; i < e.length; i++) t += Dc(e, i) + " "; return t } }), Bc = function(e, t) { var i = [], r = void 0; if (e && e.length) for (r = 0; r < e.length; r++) t(e.start(r), e.end(r)) && i.push([e.start(r), e.end(r)]); return Ta.createTimeRanges(i) }, Fc = function(e, t) { return Bc(e, function(e, i) { return e - 1 / 30 <= t && i + 1 / 30 >= t }) }, jc = function(e, t) { return Bc(e, function(e) { return e - 1 / 30 >= t }) }, Hc = function(e) { var t = []; if (!e || !e.length) return ""; for (var i = 0; i < e.length; i++) t.push(e.start(i) + " => " + e.end(i)); return t.join(", ") }, Gc = function(e) { for (var t = [], i = 0; i < e.length; i++) t.push({ start: e.start(i), end: e.end(i) }); return t }, Vc = function(e, t, i) { var r = void 0, n = void 0; if (i && i.cues) for (r = i.cues.length; r--;)(n = i.cues[r]).startTime <= t && n.endTime >= e && i.removeCue(n) }, Wc = function(e) { return isNaN(e) || Math.abs(e) === 1 / 0 ? Number.MAX_VALUE : e }, qc = function(e, t, i) { var r = n.WebKitDataCue || n.VTTCue; if (t && t.forEach(function(e) { var t = e.stream; this.inbandTextTracks_[t].addCue(new r(e.startTime + this.timestampOffset, e.endTime + this .timestampOffset, e.text)) }, e), i) { var a = Wc(e.mediaSource_.duration); if (i.forEach(function(e) { var t = e.cueTime + this.timestampOffset; e.frames.forEach(function(e) { var i = new r(t, t, e.value || e.url || e.data || ""); i.frame = e, i.value = e, function(e) { Object.defineProperties(e.frame, { id: { get: function() { return Ta.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."), e .value.key } }, value: { get: function() { return Ta.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."), e.value.data } }, privateData: { get: function() { return Ta.log.warn( "cue.frame.privateData is deprecated. Use cue.value.data instead."), e.value .data } } }) }(i), this.metadataTrack_.addCue(i) }, this) }, e), e.metadataTrack_ && e.metadataTrack_.cues && e.metadataTrack_.cues.length) { for (var s = e.metadataTrack_.cues, o = [], u = 0; u < s.length; u++) s[u] && o.push(s[u]); var l = o.reduce(function(e, t) { var i = e[t.startTime] || []; return i.push(t), e[t.startTime] = i, e }, {}), d = Object.keys(l).sort(function(e, t) { return Number(e) - Number(t) }); d.forEach(function(e, t) { var i = l[e], r = Number(d[t + 1]) || a; i.forEach(function(e) { e.endTime = r }) }) } } }, Xc = "undefined" != typeof window ? window : {}, zc = "undefined" == typeof Symbol ? "__target" : Symbol(), Kc = "application/javascript", Yc = Xc.BlobBuilder || Xc.WebKitBlobBuilder || Xc.MozBlobBuilder || Xc.MSBlobBuilder, Qc = Xc.URL || Xc.webkitURL || Qc && Qc.msURL, Jc = Xc.Worker; function Zc(e, t) { return function(i) { var r = this; if (!t) return new Jc(e); if (Jc && !i) { var n = ih(t.toString().replace(/^function.+?{/, "").slice(0, -1)); return this[zc] = new Jc(n), function(e, t) { if (!e || !t) return; var i = e.terminate; e.objURL = t, e.terminate = function() { e.objURL && Qc.revokeObjectURL(e.objURL), i.call(e) } }(this[zc], n), this[zc] } var a = { postMessage: function(e) { r.onmessage && setTimeout(function() { r.onmessage({ data: e, target: a }) }) } }; t.call(a), this.postMessage = function(e) { setTimeout(function() { a.onmessage({ data: e, target: r }) }) }, this.isThisThread = !0 } } if (Jc) { var $c, eh = ih("self.onmessage = function () {}"), th = new Uint8Array(1); try { ($c = new Jc(eh)).postMessage(th, [th.buffer]) } catch (e) { Jc = null } finally { Qc.revokeObjectURL(eh), $c && $c.terminate() } } function ih(e) { try { return Qc.createObjectURL(new Blob([e], { type: Kc })) } catch (i) { var t = new Yc; return t.append(e), Qc.createObjectURL(t.getBlob(type)) } } var rh = new Zc("./transmuxer-worker.worker.js", function(e, t) { var i = this; ! function() { var e, t, r, n, a, s, o, u, l, d, c, h, f, p, m, g, y, _, b, w, E, T, S, A, k, R, M, O, C, D, I, L, x, P, U, N, B, F, j, H, G = Math.pow(2, 32) - 1; ! function() { var e; if (T = { avc1: [], avcC: [], btrt: [], dinf: [], dref: [], esds: [], ftyp: [], hdlr: [], mdat: [], mdhd: [], mdia: [], mfhd: [], minf: [], moof: [], moov: [], mp4a: [], mvex: [], mvhd: [], sdtp: [], smhd: [], stbl: [], stco: [], stsc: [], stsd: [], stsz: [], stts: [], styp: [], tfdt: [], tfhd: [], traf: [], trak: [], trun: [], trex: [], tkhd: [], vmhd: [] }, "undefined" != typeof Uint8Array) { for (e in T) T.hasOwnProperty(e) && (T[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e .charCodeAt(3) ]); S = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]), k = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]), A = new Uint8Array([0, 0, 0, 1]), R = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0 ]), M = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0 ]), O = { video: R, audio: M }, I = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), D = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), L = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), x = L, P = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), U = L, C = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]) } }(), e = function(e) { var t, i, r = [], n = 0; for (t = 1; t < arguments.length; t++) r.push(arguments[t]); for (t = r.length; t--;) n += r[t].byteLength; for (i = new Uint8Array(n + 8), new DataView(i.buffer, i.byteOffset, i.byteLength).setUint32(0, i .byteLength), i.set(e, 4), t = 0, n = 8; t < r.length; t++) i.set(r[t], n), n += r[t].byteLength; return i }, t = function() { return e(T.dinf, e(T.dref, I)) }, r = function(t) { return e(T.esds, new Uint8Array([0, 0, 0, 0, 3, 25, 0, 0, 0, 4, 17, 64, 21, 0, 6, 0, 0, 0, 218, 192, 0, 0, 218, 192, 5, 2, t.audioobjecttype << 3 | t.samplingfrequencyindex >>> 1, t .samplingfrequencyindex << 7 | t.channelcount << 3, 6, 1, 2 ])) }, m = function(t) { return e(T.hdlr, O[t]) }, p = function(t) { var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 1, 95, 144, t.duration >>> 24 & 255, t .duration >>> 16 & 255, t.duration >>> 8 & 255, 255 & t.duration, 85, 196, 0, 0 ]); return t.samplerate && (i[12] = t.samplerate >>> 24 & 255, i[13] = t.samplerate >>> 16 & 255, i[14] = t .samplerate >>> 8 & 255, i[15] = 255 & t.samplerate), e(T.mdhd, i) }, f = function(t) { return e(T.mdia, p(t), m(t.type), s(t)) }, a = function(t) { return e(T.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & t) >> 24, (16711680 & t) >> 16, (65280 & t) >> 8, 255 & t ])) }, s = function(i) { return e(T.minf, "video" === i.type ? e(T.vmhd, C) : e(T.smhd, D), t(), y(i)) }, o = function(t, i) { for (var r = [], n = i.length; n--;) r[n] = b(i[n]); return e.apply(null, [T.moof, a(t)].concat(r)) }, u = function(t) { for (var i = t.length, r = []; i--;) r[i] = c(t[i]); return e.apply(null, [T.moov, d(4294967295)].concat(r).concat(l(t))) }, l = function(t) { for (var i = t.length, r = []; i--;) r[i] = w(t[i]); return e.apply(null, [T.mvex].concat(r)) }, d = function(t) { var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 95, 144, (4278190080 & t) >> 24, ( 16711680 & t) >> 16, (65280 & t) >> 8, 255 & t, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 ]); return e(T.mvhd, i) }, g = function(t) { var i, r, n = t.samples || [], a = new Uint8Array(4 + n.length); for (r = 0; r < n.length; r++) i = n[r].flags, a[r + 4] = i.dependsOn << 4 | i.isDependedOn << 2 | i .hasRedundancy; return e(T.sdtp, a) }, y = function(t) { return e(T.stbl, _(t), e(T.stts, U), e(T.stsc, x), e(T.stsz, P), e(T.stco, L)) }, _ = function(t) { return e(T.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === t.type ? N(t) : B(t)) }, N = function(t) { var i, r = t.sps || [], n = t.pps || [], a = [], s = []; for (i = 0; i < r.length; i++) a.push((65280 & r[i].byteLength) >>> 8), a.push(255 & r[i].byteLength), a = a.concat(Array.prototype.slice.call(r[i])); for (i = 0; i < n.length; i++) s.push((65280 & n[i].byteLength) >>> 8), s.push(255 & n[i].byteLength), s = s.concat(Array.prototype.slice.call(n[i])); return e(T.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & t.width) >> 8, 255 & t.width, (65280 & t.height) >> 8, 255 & t.height, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 19, 118, 105, 100, 101, 111, 106, 115, 45, 99, 111, 110, 116, 114, 105, 98, 45, 104, 108, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17 ]), e(T.avcC, new Uint8Array([1, t.profileIdc, t.profileCompatibility, t.levelIdc, 255].concat([r .length ]).concat(a).concat([n.length]).concat(s))), e(T.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192 ]))) }, B = function(t) { return e(T.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & t .channelcount) >> 8, 255 & t.channelcount, (65280 & t.samplesize) >> 8, 255 & t.samplesize, 0, 0, 0, 0, (65280 & t.samplerate) >> 8, 255 & t.samplerate, 0, 0 ]), r(t)) }, h = function(t) { var i = new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, (4278190080 & t.id) >> 24, (16711680 & t .id) >> 16, (65280 & t.id) >> 8, 255 & t.id, 0, 0, 0, 0, (4278190080 & t.duration) >> 24, ( 16711680 & t.duration) >> 16, (65280 & t.duration) >> 8, 255 & t.duration, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, (65280 & t.width) >> 8, 255 & t.width, 0, 0, (65280 & t .height) >> 8, 255 & t.height, 0, 0 ]); return e(T.tkhd, i) }, b = function(t) { var i, r, n, a, s, o; return i = e(T.tfhd, new Uint8Array([0, 0, 0, 58, (4278190080 & t.id) >> 24, (16711680 & t.id) >> 16, ( 65280 & t.id) >> 8, 255 & t.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), s = Math.floor(t .baseMediaDecodeTime / (G + 1)), o = Math.floor(t.baseMediaDecodeTime % (G + 1)), r = e(T.tfdt, new Uint8Array([1, 0, 0, 0, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s, o >>> 24 & 255, o >>> 16 & 255, o >>> 8 & 255, 255 & o ])), 92, "audio" === t.type ? (n = E(t, 92), e(T.traf, i, r, n)) : (a = g(t), n = E(t, a.length + 92), e(T.traf, i, r, n, a)) }, c = function(t) { return t.duration = t.duration || 4294967295, e(T.trak, h(t), f(t)) }, w = function(t) { var i = new Uint8Array([0, 0, 0, 0, (4278190080 & t.id) >> 24, (16711680 & t.id) >> 16, (65280 & t .id) >> 8, 255 & t.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 ]); return "video" !== t.type && (i[i.length - 1] = 0), e(T.trex, i) }, H = function(e, t) { var i = 0, r = 0, n = 0, a = 0; return e.length && (void 0 !== e[0].duration && (i = 1), void 0 !== e[0].size && (r = 2), void 0 !== e[ 0].flags && (n = 4), void 0 !== e[0].compositionTimeOffset && (a = 8)), [0, 0, i | r | n | a, 1, ( 4278190080 & e.length) >>> 24, (16711680 & e.length) >>> 16, (65280 & e.length) >>> 8, 255 & e .length, (4278190080 & t) >>> 24, (16711680 & t) >>> 16, (65280 & t) >>> 8, 255 & t ] }, j = function(t, i) { var r, n, a, s; for (i += 20 + 16 * (n = t.samples || []).length, r = H(n, i), s = 0; s < n.length; s++) a = n[s], r = r .concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a.duration) >>> 8, 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>> 16, (65280 & a.size) >>> 8, 255 & a.size, a.flags.isLeading << 2 | a.flags.dependsOn, a.flags.isDependedOn << 6 | a.flags .hasRedundancy << 4 | a.flags.paddingValue << 1 | a.flags.isNonSyncSample, 61440 & a.flags .degradationPriority, 15 & a.flags.degradationPriority, (4278190080 & a.compositionTimeOffset) >>> 24, (16711680 & a.compositionTimeOffset) >>> 16, (65280 & a.compositionTimeOffset) >>> 8, 255 & a .compositionTimeOffset ]); return e(T.trun, new Uint8Array(r)) }, F = function(t, i) { var r, n, a, s; for (i += 20 + 8 * (n = t.samples || []).length, r = H(n, i), s = 0; s < n.length; s++) a = n[s], r = r .concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a.duration) >>> 8, 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>> 16, (65280 & a.size) >>> 8, 255 & a.size ]); return e(T.trun, new Uint8Array(r)) }, E = function(e, t) { return "audio" === e.type ? F(e, t) : j(e, t) }; var V, W, q = { ftyp: n = function() { return e(T.ftyp, S, A, S, k) }, mdat: function(t) { return e(T.mdat, t) }, moof: o, moov: u, initSegment: function(e) { var t, i = n(), r = u(e); return (t = new Uint8Array(i.byteLength + r.byteLength)).set(i), t.set(r, i.byteLength), t } }, X = function(e) { return e >>> 0 }, z = { findBox: V = function(e, t) { var i, r, n, a, s, o = []; if (!t.length) return null; for (i = 0; i < e.byteLength;) r = X(e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3]), n = W( e.subarray(i + 4, i + 8)), a = r > 1 ? i + r : e.byteLength, n === t[0] && (1 === t.length ? o .push(e.subarray(i + 8, a)) : (s = V(e.subarray(i + 8, a), t.slice(1))).length && (o = o.concat( s))), i = a; return o }, parseType: W = function(e) { var t = ""; return t += String.fromCharCode(e[0]), t += String.fromCharCode(e[1]), t += String.fromCharCode(e[ 2]), t += String.fromCharCode(e[3]) }, timescale: function(e) { return V(e, ["moov", "trak"]).reduce(function(e, t) { var i, r, n, a, s; return (i = V(t, ["tkhd"])[0]) ? (r = i[0], a = X(i[n = 0 === r ? 12 : 20] << 24 | i[n + 1] << 16 | i[n + 2] << 8 | i[n + 3]), (s = V(t, ["mdia", "mdhd"])[0]) ? (n = 0 === (r = s[ 0]) ? 12 : 20, e[a] = X(s[n] << 24 | s[n + 1] << 16 | s[n + 2] << 8 | s[n + 3]), e) : null) : null }, {}) }, startTime: function(e, t) { var i, r, n; return i = V(t, ["moof", "traf"]), r = [].concat.apply([], i.map(function(t) { return V(t, ["tfhd"]).map(function(i) { var r, n; return r = X(i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7]), n = e[r] || 9e4, (V(t, [ "tfdt" ]).map(function(e) { var t, i; return t = e[0], i = X(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]), 1 === t && (i *= Math.pow(2, 32), i += X(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[ 11])), i })[0] || 1 / 0) / n }) })), n = Math.min.apply(null, r), isFinite(n) ? n : 0 }, videoTrackIds: function(e) { var t = []; return V(e, ["moov", "trak"]).forEach(function(e) { var i = V(e, ["mdia", "hdlr"]), r = V(e, ["tkhd"]); i.forEach(function(e, i) { var n, a, s = W(e.subarray(8, 12)), o = r[i]; "vide" === s && (a = 0 === (n = new DataView(o.buffer, o.byteOffset, o.byteLength)) .getUint8(0) ? n.getUint32(12) : n.getUint32(20), t.push(a)) }) }), t } }, K = function() { this.init = function() { var e = {}; this.on = function(t, i) { e[t] || (e[t] = []), e[t] = e[t].concat(i) }, this.off = function(t, i) { var r; return !!e[t] && (r = e[t].indexOf(i), e[t] = e[t].slice(), e[t].splice(r, 1), r > -1) }, this.trigger = function(t) { var i, r, n, a; if (i = e[t]) if (2 === arguments.length) for (n = i.length, r = 0; r < n; ++r) i[r].call(this, arguments[1]); else { for (a = [], r = arguments.length, r = 1; r < arguments.length; ++r) a.push(arguments[r]); for (n = i.length, r = 0; r < n; ++r) i[r].apply(this, a) } }, this.dispose = function() { e = {} } } }; K.prototype.pipe = function(e) { return this.on("data", function(t) { e.push(t) }), this.on("done", function(t) { e.flush(t) }), e }, K.prototype.push = function(e) { this.trigger("data", e) }, K.prototype.flush = function(e) { this.trigger("done", e) }; var Y = K, Q = function(e, t) { var i = { size: 0, flags: { isLeading: 0, dependsOn: 1, isDependedOn: 0, hasRedundancy: 0, degradationPriority: 0, isNonSyncSample: 1 } }; return i.dataOffset = t, i.compositionTimeOffset = e.pts - e.dts, i.duration = e.duration, i.size = 4 * e.length, i.size += e.byteLength, e.keyFrame && (i.flags.dependsOn = 2, i.flags.isNonSyncSample = 0), i }, J = function(e) { var t, i, r = [], n = []; for (r.byteLength = 0, t = 0; t < e.length; t++) "access_unit_delimiter_rbsp" === (i = e[t]) .nalUnitType ? (r.length && (r.duration = i.dts - r.dts, n.push(r)), (r = [i]).byteLength = i.data .byteLength, r.pts = i.pts, r.dts = i.dts) : ("slice_layer_without_partitioning_rbsp_idr" === i .nalUnitType && (r.keyFrame = !0), r.duration = i.dts - r.dts, r.byteLength += i.data.byteLength, r .push(i)); return n.length && (!r.duration || r.duration <= 0) && (r.duration = n[n.length - 1].duration), n.push( r), n }, Z = function(e) { var t, i, r = [], n = []; for (r.byteLength = 0, r.nalCount = 0, r.duration = 0, r.pts = e[0].pts, r.dts = e[0].dts, n .byteLength = 0, n.nalCount = 0, n.duration = 0, n.pts = e[0].pts, n.dts = e[0].dts, t = 0; t < e .length; t++)(i = e[t]).keyFrame ? (r.length && (n.push(r), n.byteLength += r.byteLength, n .nalCount += r.nalCount, n.duration += r.duration), (r = [i]).nalCount = i.length, r.byteLength = i.byteLength, r.pts = i.pts, r.dts = i.dts, r.duration = i.duration) : (r.duration += i.duration, r .nalCount += i.length, r.byteLength += i.byteLength, r.push(i)); return n.length && r.duration <= 0 && (r.duration = n[n.length - 1].duration), n.byteLength += r .byteLength, n.nalCount += r.nalCount, n.duration += r.duration, n.push(r), n }, $ = function(e) { var t; return !e[0][0].keyFrame && e.length > 1 && (t = e.shift(), e.byteLength -= t.byteLength, e.nalCount -= t.nalCount, e[0][0].dts = t.dts, e[0][0].pts = t.pts, e[0][0].duration += t.duration), e }, ee = function(e, t) { var i, r, n, a, s, o = t || 0, u = []; for (i = 0; i < e.length; i++) for (a = e[i], r = 0; r < a.length; r++) s = a[r], o += (n = Q(s, o)).size, u.push(n); return u }, te = function(e) { var t, i, r, n, a, s, o = 0, u = e.byteLength, l = e.nalCount, d = new Uint8Array(u + 4 * l), c = new DataView(d.buffer); for (t = 0; t < e.length; t++) for (n = e[t], i = 0; i < n.length; i++) for (a = n[i], r = 0; r < a.length; r++) s = a[r], c.setUint32(o, s.data.byteLength), o += 4, d.set( s.data, o), o += s.data.byteLength; return d }, ie = function(e) { delete e.minSegmentDts, delete e.maxSegmentDts, delete e.minSegmentPts, delete e.maxSegmentPts }, re = function(e, t) { var i, r = e.minSegmentDts; return t || (r -= e.timelineStartInfo.dts), i = e.timelineStartInfo.baseMediaDecodeTime, i += r, i = Math.max(0, i), "audio" === e.type && (i *= e.samplerate / 9e4, i = Math.floor(i)), i }, ne = function(e, t) { "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t.pts), void 0 === e.minSegmentPts ? e.minSegmentPts = t.pts : e.minSegmentPts = Math.min(e.minSegmentPts, t .pts), void 0 === e.maxSegmentPts ? e.maxSegmentPts = t.pts : e.maxSegmentPts = Math.max(e .maxSegmentPts, t.pts)), "number" == typeof t.dts && (void 0 === e.timelineStartInfo.dts && (e .timelineStartInfo.dts = t.dts), void 0 === e.minSegmentDts ? e.minSegmentDts = t.dts : e .minSegmentDts = Math.min(e.minSegmentDts, t.dts), void 0 === e.maxSegmentDts ? e.maxSegmentDts = t .dts : e.maxSegmentDts = Math.max(e.maxSegmentDts, t.dts)) }, ae = function(e) { for (var t = 0, i = { payloadType: -1, payloadSize: 0 }, r = 0, n = 0; t < e.byteLength && 128 !== e[t];) { for (; 255 === e[t];) r += 255, t++; for (r += e[t++]; 255 === e[t];) n += 255, t++; if (n += e[t++], !i.payload && 4 === r) { i.payloadType = r, i.payloadSize = n, i.payload = e.subarray(t, t + n); break } t += n, r = 0, n = 0 } return i }, se = function(e) { return 181 !== e.payload[0] ? null : 49 != (e.payload[1] << 8 | e.payload[2]) ? null : "GA94" !== String .fromCharCode(e.payload[3], e.payload[4], e.payload[5], e.payload[6]) ? null : 3 !== e.payload[7] ? null : e.payload.subarray(8, e.payload.length - 1) }, oe = function(e, t) { var i, r, n, a, s = []; if (!(64 & t[0])) return s; for (r = 31 & t[0], i = 0; i < r; i++) a = { type: 3 & t[2 + (n = 3 * i)], pts: e }, 4 & t[n + 2] && (a.ccData = t[n + 3] << 8 | t[n + 4], s.push(a)); return s }, ue = function(e) { for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ? (n.push(a + 2), a += 2) : a++; if (0 === n.length) return e; t = r - n.length, i = new Uint8Array(t); var s = 0; for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s]; return i }, le = 4, de = function e() { e.prototype.init.call(this), this.captionPackets_ = [], this.ccStreams_ = [new me(0, 0), new me(0, 1), new me(1, 0), new me(1, 1) ], this.reset(), this.ccStreams_.forEach(function(e) { e.on("data", this.trigger.bind(this, "data")), e.on("done", this.trigger.bind(this, "done")) }, this) }; (de.prototype = new Y).push = function(e) { var t, i, r; if ("sei_rbsp" === e.nalUnitType && (t = ae(e.escapedRBSP)).payloadType === le && (i = se(t))) if (e.dts < this.latestDts_) this.ignoreNextEqualDts_ = !0; else { if (e.dts === this.latestDts_ && this.ignoreNextEqualDts_) return this.numSameDts_--, void(this .numSameDts_ || (this.ignoreNextEqualDts_ = !1)); r = oe(e.pts, i), this.captionPackets_ = this.captionPackets_.concat(r), this.latestDts_ !== e .dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = e.dts } }, de.prototype.flush = function() { this.captionPackets_.length ? (this.captionPackets_.forEach(function(e, t) { e.presortIndex = t }), this.captionPackets_.sort(function(e, t) { return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts }), this.captionPackets_.forEach(function(e) { e.type < 2 && this.dispatchCea608Packet(e) }, this), this.captionPackets_.length = 0, this.ccStreams_.forEach(function(e) { e.flush() }, this)) : this.ccStreams_.forEach(function(e) { e.flush() }, this) }, de.prototype.reset = function() { this.latestDts_ = null, this.ignoreNextEqualDts_ = !1, this.numSameDts_ = 0, this .activeCea608Channel_ = [null, null], this.ccStreams_.forEach(function(e) { e.reset() }) }, de.prototype.dispatchCea608Packet = function(e) { this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && (this .activeCea608Channel_[e.type] = 1), null !== this.activeCea608Channel_[e.type] && this.ccStreams_[(e .type << 1) + this.activeCea608Channel_[e.type]].push(e) }, de.prototype.setsChannel1Active = function(e) { return 4096 == (30720 & e.ccData) }, de.prototype.setsChannel2Active = function(e) { return 6144 == (30720 & e.ccData) }; var ce = { 42: 225, 92: 233, 94: 237, 95: 243, 96: 250, 123: 231, 124: 247, 125: 209, 126: 241, 127: 9608, 304: 174, 305: 176, 306: 189, 307: 191, 308: 8482, 309: 162, 310: 163, 311: 9834, 312: 224, 313: 160, 314: 232, 315: 226, 316: 234, 317: 238, 318: 244, 319: 251, 544: 193, 545: 201, 546: 211, 547: 218, 548: 220, 549: 252, 550: 8216, 551: 161, 552: 42, 553: 39, 554: 8212, 555: 169, 556: 8480, 557: 8226, 558: 8220, 559: 8221, 560: 192, 561: 194, 562: 199, 563: 200, 564: 202, 565: 203, 566: 235, 567: 206, 568: 207, 569: 239, 570: 212, 571: 217, 572: 249, 573: 219, 574: 171, 575: 187, 800: 195, 801: 227, 802: 205, 803: 204, 804: 236, 805: 210, 806: 242, 807: 213, 808: 245, 809: 123, 810: 125, 811: 92, 812: 94, 813: 95, 814: 124, 815: 126, 816: 196, 817: 228, 818: 214, 819: 246, 820: 223, 821: 165, 822: 164, 823: 9474, 824: 197, 825: 229, 826: 216, 827: 248, 828: 9484, 829: 9488, 830: 9492, 831: 9496 }, he = function(e) { return null === e ? "" : (e = ce[e] || e, String.fromCharCode(e)) }, fe = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152], pe = function() { for (var e = [], t = 15; t--;) e.push(""); return e }, me = function e(t, i) { e.prototype.init.call(this), this.field_ = t || 0, this.dataChannel_ = i || 0, this.name_ = "CC" + (1 + (this.field_ << 1 | this.dataChannel_)), this.setConstants(), this.reset(), this.push = function( e) { var t, i, r, n, a; if ((t = 32639 & e.ccData) !== this.lastControlCode_) { if (4096 == (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this .lastControlCode_ = null), r = t >>> 8, n = 255 & t, t !== this.PADDING_) if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn"; else if (t === this.END_OF_CAPTION_) this.mode_ = "popOn", this.clearFormatting(e.pts), this .flushDisplayed(e.pts), i = this.displayed_, this.displayed_ = this.nonDisplayed_, this .nonDisplayed_ = i, this.startPts_ = e.pts; else if (t === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(e.pts); else if (t === this.ROLL_UP_3_ROWS_) this.rollUpRows_ = 3, this.setRollUp(e.pts); else if (t === this.ROLL_UP_4_ROWS_) this.rollUpRows_ = 4, this.setRollUp(e.pts); else if (t === this.CARRIAGE_RETURN_) this.clearFormatting(e.pts), this.flushDisplayed(e.pts), this.shiftRowsUp_(), this.startPts_ = e.pts; else if (t === this.BACKSPACE_) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_] .slice(0, -1); else if (t === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(e.pts), this.displayed_ = pe(); else if (t === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = pe(); else if (t === this.RESUME_DIRECT_CAPTIONING_) "paintOn" !== this.mode_ && (this.flushDisplayed(e .pts), this.displayed_ = pe()), this.mode_ = "paintOn", this.startPts_ = e.pts; else if (this.isSpecialCharacter(r, n)) a = he((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++; else if (this.isExtCharacter(r, n)) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_] .slice(0, -1), a = he((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++; else if (this.isMidRowCode(r, n)) this.clearFormatting(e.pts), this[this.mode_](e.pts, " "), this .column_++, 14 == (14 & n) && this.addFormatting(e.pts, ["i"]), 1 == (1 & n) && this .addFormatting(e.pts, ["u"]); else if (this.isOffsetControlCode(r, n)) this.column_ += 3 & n; else if (this.isPAC(r, n)) { var s = fe.indexOf(7968 & t); "rollUp" === this.mode_ && this.setRollUp(e.pts, s), s !== this.row_ && (this.clearFormatting(e .pts), this.row_ = s), 1 & n && -1 === this.formatting_.indexOf("u") && this.addFormatting(e .pts, ["u"]), 16 == (16 & t) && (this.column_ = 4 * ((14 & t) >> 1)), this.isColorPAC(n) && 14 == (14 & n) && this.addFormatting(e.pts, ["i"]) } else this.isNormalChar(r) && (0 === n && (n = null), a = he(r), a += he(n), this[this.mode_](e .pts, a), this.column_ += a.length) } else this.lastControlCode_ = null } }; me.prototype = new Y, me.prototype.flushDisplayed = function(e) { var t = this.displayed_.map(function(e) { return e.trim() }).join("\n").replace(/^\n+|\n+$/g, ""); t.length && this.trigger("data", { startPts: this.startPts_, endPts: e, text: t, stream: this.name_ }) }, me.prototype.reset = function() { this.mode_ = "popOn", this.topRow_ = 0, this.startPts_ = 0, this.displayed_ = pe(), this.nonDisplayed_ = pe(), this.lastControlCode_ = null, this.column_ = 0, this.row_ = 14, this.rollUpRows_ = 2, this .formatting_ = [] }, me.prototype.setConstants = function() { 0 === this.dataChannel_ ? (this.BASE_ = 16, this.EXT_ = 17, this.CONTROL_ = (20 | this.field_) << 8, this.OFFSET_ = 23) : 1 === this.dataChannel_ && (this.BASE_ = 24, this.EXT_ = 25, this.CONTROL_ = ( 28 | this.field_) << 8, this.OFFSET_ = 31), this.PADDING_ = 0, this.RESUME_CAPTION_LOADING_ = 32 | this.CONTROL_, this.END_OF_CAPTION_ = 47 | this.CONTROL_, this.ROLL_UP_2_ROWS_ = 37 | this.CONTROL_, this.ROLL_UP_3_ROWS_ = 38 | this.CONTROL_, this.ROLL_UP_4_ROWS_ = 39 | this.CONTROL_, this .CARRIAGE_RETURN_ = 45 | this.CONTROL_, this.RESUME_DIRECT_CAPTIONING_ = 41 | this.CONTROL_, this .BACKSPACE_ = 33 | this.CONTROL_, this.ERASE_DISPLAYED_MEMORY_ = 44 | this.CONTROL_, this .ERASE_NON_DISPLAYED_MEMORY_ = 46 | this.CONTROL_ }, me.prototype.isSpecialCharacter = function(e, t) { return e === this.EXT_ && t >= 48 && t <= 63 }, me.prototype.isExtCharacter = function(e, t) { return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && t <= 63 }, me.prototype.isMidRowCode = function(e, t) { return e === this.EXT_ && t >= 32 && t <= 47 }, me.prototype.isOffsetControlCode = function(e, t) { return e === this.OFFSET_ && t >= 33 && t <= 35 }, me.prototype.isPAC = function(e, t) { return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && t <= 127 }, me.prototype.isColorPAC = function(e) { return e >= 64 && e <= 79 || e >= 96 && e <= 127 }, me.prototype.isNormalChar = function(e) { return e >= 32 && e <= 127 }, me.prototype.setRollUp = function(e, t) { if ("rollUp" !== this.mode_ && (this.row_ = 14, this.mode_ = "rollUp", this.flushDisplayed(e), this .nonDisplayed_ = pe(), this.displayed_ = pe()), void 0 !== t && t !== this.row_) for (var i = 0; i < this.rollUpRows_; i++) this.displayed_[t - i] = this.displayed_[this.row_ - i], this.displayed_[this.row_ - i] = ""; void 0 === t && (t = this.row_), this.topRow_ = t - this.rollUpRows_ + 1 }, me.prototype.addFormatting = function(e, t) { this.formatting_ = this.formatting_.concat(t); var i = t.reduce(function(e, t) { return e + "<" + t + ">" }, ""); this[this.mode_](e, i) }, me.prototype.clearFormatting = function(e) { if (this.formatting_.length) { var t = this.formatting_.reverse().reduce(function(e, t) { return e + "" }, ""); this.formatting_ = [], this[this.mode_](e, t) } }, me.prototype.popOn = function(e, t) { var i = this.nonDisplayed_[this.row_]; i += t, this.nonDisplayed_[this.row_] = i }, me.prototype.rollUp = function(e, t) { var i = this.displayed_[this.row_]; i += t, this.displayed_[this.row_] = i }, me.prototype.shiftRowsUp_ = function() { var e; for (e = 0; e < this.topRow_; e++) this.displayed_[e] = ""; for (e = this.row_ + 1; e < 15; e++) this.displayed_[e] = ""; for (e = this.topRow_; e < this.row_; e++) this.displayed_[e] = this.displayed_[e + 1]; this.displayed_[this.row_] = "" }, me.prototype.paintOn = function(e, t) { var i = this.displayed_[this.row_]; i += t, this.displayed_[this.row_] = i }; var ge = { CaptionStream: de, Cea608Stream: me }, ve = { H264_STREAM_TYPE: 27, ADTS_STREAM_TYPE: 15, METADATA_STREAM_TYPE: 21 }, ye = function(e, t) { var i = 1; for (e > t && (i = -1); Math.abs(t - e) > 4294967296;) e += 8589934592 * i; return e }, _e = function e(t) { var i, r; e.prototype.init.call(this), this.type_ = t, this.push = function(e) { e.type === this.type_ && (void 0 === r && (r = e.dts), e.dts = ye(e.dts, r), e.pts = ye(e.pts, r), i = e.dts, this.trigger("data", e)) }, this.flush = function() { r = i, this.trigger("done") }, this.discontinuity = function() { r = void 0, i = void 0 } }; _e.prototype = new Y; var be, we = _e, Ee = function(e, t, i) { var r, n = ""; for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2); return n }, Te = function(e, t, i) { return decodeURIComponent(Ee(e, t, i)) }, Se = function(e) { return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3] }, Ae = { TXXX: function(e) { var t; if (3 === e.data[0]) { for (t = 1; t < e.data.length; t++) if (0 === e.data[t]) { e.description = Te(e.data, 1, t), e.value = Te(e.data, t + 1, e.data.length).replace(/\0*$/, ""); break } e.data = e.value } }, WXXX: function(e) { var t; if (3 === e.data[0]) for (t = 1; t < e.data.length; t++) if (0 === e.data[t]) { e.description = Te(e.data, 1, t), e.url = Te(e.data, t + 1, e.data.length); break } }, PRIV: function(e) { var t, i; for (t = 0; t < e.data.length; t++) if (0 === e.data[t]) { e.owner = (i = e.data, unescape(Ee(i, 0, t))); break } e.privateData = e.data.subarray(t + 1), e.data = e.privateData } }; (be = function(e) { var t, i = { debug: !(!e || !e.debug), descriptor: e && e.descriptor }, r = 0, n = [], a = 0; if (be.prototype.init.call(this), this.dispatchType = ve.METADATA_STREAM_TYPE.toString(16), i .descriptor) for (t = 0; t < i.descriptor.length; t++) this.dispatchType += ("00" + i.descriptor[t].toString(16)) .slice(-2); this.push = function(e) { var t, s, o, u, l; if ("timed-metadata" === e.type) if (e.dataAlignmentIndicator && (a = 0, n.length = 0), 0 === n.length && (e.data.length < 10 || e .data[0] !== "I".charCodeAt(0) || e.data[1] !== "D".charCodeAt(0) || e.data[2] !== "3" .charCodeAt(0))) i.debug && console.log("Skipping unrecognized metadata packet"); else if (n.push(e), a += e.data.byteLength, 1 === n.length && (r = Se(e.data.subarray(6, 10)), r += 10), !(a < r)) { for (t = { data: new Uint8Array(r), frames: [], pts: n[0].pts, dts: n[0].dts }, l = 0; l < r;) t.data.set(n[0].data.subarray(0, r - l), l), l += n[0].data.byteLength, a -= n[0].data.byteLength, n.shift(); s = 10, 64 & t.data[5] && (s += 4, s += Se(t.data.subarray(10, 14)), r -= Se(t.data.subarray(16, 20))); do { if ((o = Se(t.data.subarray(s + 4, s + 8))) < 1) return console.log( "Malformed ID3 frame encountered. Skipping metadata parsing."); if ((u = { id: String.fromCharCode(t.data[s], t.data[s + 1], t.data[s + 2], t.data[s + 3]), data: t.data.subarray(s + 10, s + o + 10) }).key = u.id, Ae[u.id] && (Ae[u.id](u), "com.apple.streaming.transportStreamTimestamp" === u .owner)) { var d = u.data, c = (1 & d[3]) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2; c *= 4, c += 3 & d[7], u.timeStamp = c, void 0 === t.pts && void 0 === t.dts && (t.pts = u .timeStamp, t.dts = u.timeStamp), this.trigger("timestamp", u) } t.frames.push(u), s += 10, s += o } while (s < r); this.trigger("data", t) } } }).prototype = new Y; var ke, Re, Me, Oe = be, Ce = we; (ke = function() { var e = new Uint8Array(188), t = 0; ke.prototype.init.call(this), this.push = function(i) { var r, n = 0, a = 188; for (t ? ((r = new Uint8Array(i.byteLength + t)).set(e.subarray(0, t)), r.set(i, t), t = 0) : r = i; a < r.byteLength;) 71 !== r[n] || 71 !== r[a] ? (n++, a++) : (this.trigger("data", r.subarray( n, a)), n += 188, a += 188); n < r.byteLength && (e.set(r.subarray(n), 0), t = r.byteLength - n) }, this.flush = function() { 188 === t && 71 === e[0] && (this.trigger("data", e), t = 0), this.trigger("done") } }).prototype = new Y, (Re = function() { var e, t, i, r; Re.prototype.init.call(this), r = this, this.packetsWaitingForPmt = [], this.programMapTable = void 0, e = function(e, r) { var n = 0; r.payloadUnitStartIndicator && (n += e[n] + 1), "pat" === r.type ? t(e.subarray(n), r) : i(e .subarray(n), r) }, t = function(e, t) { t.section_number = e[7], t.last_section_number = e[8], r.pmtPid = (31 & e[10]) << 8 | e[11], t .pmtPid = r.pmtPid }, i = function(e, t) { var i, n; if (1 & e[5]) { for (r.programMapTable = { video: null, audio: null, "timed-metadata": {} }, i = 3 + ((15 & e[1]) << 8 | e[2]) - 4, n = 12 + ((15 & e[10]) << 8 | e[11]); n < i;) { var a = e[n], s = (31 & e[n + 1]) << 8 | e[n + 2]; a === ve.H264_STREAM_TYPE && null === r.programMapTable.video ? r.programMapTable.video = s : a === ve.ADTS_STREAM_TYPE && null === r.programMapTable.audio ? r.programMapTable.audio = s : a === ve.METADATA_STREAM_TYPE && (r.programMapTable["timed-metadata"][s] = a), n += 5 + ((15 & e[n + 3]) << 8 | e[n + 4]) } t.programMapTable = r.programMapTable } }, this.push = function(t) { var i = {}, r = 4; if (i.payloadUnitStartIndicator = !!(64 & t[1]), i.pid = 31 & t[1], i.pid <<= 8, i.pid |= t[2], ( 48 & t[3]) >>> 4 > 1 && (r += t[r] + 1), 0 === i.pid) i.type = "pat", e(t.subarray(r), i), this.trigger("data", i); else if (i.pid === this.pmtPid) for (i.type = "pmt", e(t.subarray(r), i), this.trigger("data", i); this.packetsWaitingForPmt .length;) this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); else void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, r, i]) : this .processPes_(t, r, i) }, this.processPes_ = function(e, t, i) { i.pid === this.programMapTable.video ? i.streamType = ve.H264_STREAM_TYPE : i.pid === this .programMapTable.audio ? i.streamType = ve.ADTS_STREAM_TYPE : i.streamType = this .programMapTable["timed-metadata"][i.pid], i.type = "pes", i.data = e.subarray(t), this.trigger( "data", i) } }).prototype = new Y, Re.STREAM_TYPES = { h264: 27, adts: 15 }, (Me = function() { var e = this, t = { data: [], size: 0 }, i = { data: [], size: 0 }, r = { data: [], size: 0 }, n = function(t, i, r) { var n, a, s = new Uint8Array(t.size), o = { type: i }, u = 0, l = 0; if (t.data.length && !(t.size < 9)) { for (o.trackId = t.data[0].pid, u = 0; u < t.data.length; u++) a = t.data[u], s.set(a.data, l), l += a.data.byteLength; var d, c, h; d = s, (c = o).packetLength = 6 + (d[4] << 8 | d[5]), c.dataAlignmentIndicator = 0 != (4 & d[ 6]), 192 & (h = d[7]) && (c.pts = (14 & d[9]) << 27 | (255 & d[10]) << 20 | (254 & d[11]) << 12 | (255 & d[12]) << 5 | (254 & d[13]) >>> 3, c.pts *= 4, c.pts += (6 & d[13]) >>> 1, c .dts = c.pts, 64 & h && (c.dts = (14 & d[14]) << 27 | (255 & d[15]) << 20 | (254 & d[16]) << 12 | (255 & d[17]) << 5 | (254 & d[18]) >>> 3, c.dts *= 4, c.dts += (6 & d[18]) >>> 1)), c .data = d.subarray(9 + d[8]), n = "video" === i || o.packetLength <= t.size, (r || n) && (t .size = 0, t.data.length = 0), n && e.trigger("data", o) } }; Me.prototype.init.call(this), this.push = function(a) { ({ pat: function() {}, pes: function() { var e, s; switch (a.streamType) { case ve.H264_STREAM_TYPE: case ve.H264_STREAM_TYPE: e = t, s = "video"; break; case ve.ADTS_STREAM_TYPE: e = i, s = "audio"; break; case ve.METADATA_STREAM_TYPE: e = r, s = "timed-metadata"; break; default: return } a.payloadUnitStartIndicator && n(e, s, !0), e.data.push(a), e.size += a.data.byteLength }, pmt: function() { var t = { type: "metadata", tracks: [] }, i = a.programMapTable; null !== i.video && t.tracks.push({ timelineStartInfo: { baseMediaDecodeTime: 0 }, id: +i.video, codec: "avc", type: "video" }), null !== i.audio && t.tracks.push({ timelineStartInfo: { baseMediaDecodeTime: 0 }, id: +i.audio, codec: "adts", type: "audio" }), e.trigger("data", t) } })[a.type]() }, this.flush = function() { n(t, "video"), n(i, "audio"), n(r, "timed-metadata"), this.trigger("done") } }).prototype = new Y; var De = { PAT_PID: 0, MP2T_PACKET_LENGTH: 188, TransportPacketStream: ke, TransportParseStream: Re, ElementaryStream: Me, TimestampRolloverStream: Ce, CaptionStream: ge.CaptionStream, Cea608Stream: ge.Cea608Stream, MetadataStream: Oe }; for (var Ie in ve) ve.hasOwnProperty(Ie) && (De[Ie] = ve[Ie]); var Le, xe = De, Pe = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]; (Le = function() { var e; Le.prototype.init.call(this), this.push = function(t) { var i, r, n, a, s, o, u = 0, l = 0; if ("audio" === t.type) for (e ? (a = e, (e = new Uint8Array(a.byteLength + t.data.byteLength)).set(a), e.set(t.data, a .byteLength)) : e = t.data; u + 5 < e.length;) if (255 === e[u] && 240 == (246 & e[u + 1])) { if (r = 2 * (1 & ~e[u + 1]), i = (3 & e[u + 3]) << 11 | e[u + 4] << 3 | (224 & e[u + 5]) >> 5, o = 9e4 * (s = 1024 * (1 + (3 & e[u + 6]))) / Pe[(60 & e[u + 2]) >>> 2], n = u + i, e .byteLength < n) return; if (this.trigger("data", { pts: t.pts + l * o, dts: t.dts + l * o, sampleCount: s, audioobjecttype: 1 + (e[u + 2] >>> 6 & 3), channelcount: (1 & e[u + 2]) << 2 | (192 & e[u + 3]) >>> 6, samplerate: Pe[(60 & e[u + 2]) >>> 2], samplingfrequencyindex: (60 & e[u + 2]) >>> 2, samplesize: 16, data: e.subarray(u + 7 + r, n) }), e.byteLength === n) return void(e = void 0); l++, e = e.subarray(n) } else u++ }, this.flush = function() { this.trigger("done") } }).prototype = new Y; var Ue, Ne, Be, Fe = Le, je = function(e) { var t = e.byteLength, i = 0, r = 0; this.length = function() { return 8 * t }, this.bitsAvailable = function() { return 8 * t + r }, this.loadWord = function() { var n = e.byteLength - t, a = new Uint8Array(4), s = Math.min(4, t); if (0 === s) throw new Error("no bytes available"); a.set(e.subarray(n, n + s)), i = new DataView(a.buffer).getUint32(0), r = 8 * s, t -= s }, this.skipBits = function(e) { var n; r > e ? (i <<= e, r -= e) : (e -= r, e -= 8 * (n = Math.floor(e / 8)), t -= n, this.loadWord(), i <<= e, r -= e) }, this.readBits = function(e) { var n = Math.min(r, e), a = i >>> 32 - n; return (r -= n) > 0 ? i <<= n : t > 0 && this.loadWord(), (n = e - n) > 0 ? a << n | this.readBits( n) : a }, this.skipLeadingZeros = function() { var e; for (e = 0; e < r; ++e) if (0 != (i & 2147483648 >>> e)) return i <<= e, r -= e, e; return this.loadWord(), e + this.skipLeadingZeros() }, this.skipUnsignedExpGolomb = function() { this.skipBits(1 + this.skipLeadingZeros()) }, this.skipExpGolomb = function() { this.skipBits(1 + this.skipLeadingZeros()) }, this.readUnsignedExpGolomb = function() { var e = this.skipLeadingZeros(); return this.readBits(e + 1) - 1 }, this.readExpGolomb = function() { var e = this.readUnsignedExpGolomb(); return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1) }, this.readBoolean = function() { return 1 === this.readBits(1) }, this.readUnsignedByte = function() { return this.readBits(8) }, this.loadWord() }; (Ne = function() { var e, t, i = 0; Ne.prototype.init.call(this), this.push = function(r) { var n; for (t ? ((n = new Uint8Array(t.byteLength + r.data.byteLength)).set(t), n.set(r.data, t .byteLength), t = n) : t = r.data; i < t.byteLength - 3; i++) if (1 === t[i + 2]) { e = i + 5; break } for (; e < t.byteLength;) switch (t[e]) { case 0: if (0 !== t[e - 1]) { e += 2; break } if (0 !== t[e - 2]) { e++; break } i + 3 !== e - 2 && this.trigger("data", t.subarray(i + 3, e - 2)); do { e++ } while (1 !== t[e] && e < t.length); i = e - 2, e += 3; break; case 1: if (0 !== t[e - 1] || 0 !== t[e - 2]) { e += 3; break } this.trigger("data", t.subarray(i + 3, e - 2)), i = e - 2, e += 3; break; default: e += 3 } t = t.subarray(i), e -= i, i = 0 }, this.flush = function() { t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)), t = null, i = 0, this.trigger( "done") } }).prototype = new Y, Be = { 100: !0, 110: !0, 122: !0, 244: !0, 44: !0, 83: !0, 86: !0, 118: !0, 128: !0, 138: !0, 139: !0, 134: !0 }, (Ue = function() { var e, t, i, r, n, a, s, o = new Ne; Ue.prototype.init.call(this), e = this, this.push = function(e) { "video" === e.type && (t = e.trackId, i = e.pts, r = e.dts, o.push(e)) }, o.on("data", function(s) { var o = { trackId: t, pts: i, dts: r, data: s }; switch (31 & s[0]) { case 5: o.nalUnitType = "slice_layer_without_partitioning_rbsp_idr"; break; case 6: o.nalUnitType = "sei_rbsp", o.escapedRBSP = n(s.subarray(1)); break; case 7: o.nalUnitType = "seq_parameter_set_rbsp", o.escapedRBSP = n(s.subarray(1)), o.config = a(o .escapedRBSP); break; case 8: o.nalUnitType = "pic_parameter_set_rbsp"; break; case 9: o.nalUnitType = "access_unit_delimiter_rbsp" } e.trigger("data", o) }), o.on("done", function() { e.trigger("done") }), this.flush = function() { o.flush() }, s = function(e, t) { var i, r = 8, n = 8; for (i = 0; i < e; i++) 0 !== n && (n = (r + t.readExpGolomb() + 256) % 256), r = 0 === n ? r : n }, n = function(e) { for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ? (n.push(a + 2), a += 2) : a++; if (0 === n.length) return e; t = r - n.length, i = new Uint8Array(t); var s = 0; for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s]; return i }, a = function(e) { var t, i, r, n, a, o, u, l, d, c, h, f, p, m = 0, g = 0, v = 0, y = 0, _ = 1; if (i = (t = new je(e)).readUnsignedByte(), n = t.readUnsignedByte(), r = t.readUnsignedByte(), t .skipUnsignedExpGolomb(), Be[i] && (3 === (a = t.readUnsignedExpGolomb()) && t.skipBits(1), t .skipUnsignedExpGolomb(), t.skipUnsignedExpGolomb(), t.skipBits(1), t.readBoolean())) for (h = 3 !== a ? 8 : 12, p = 0; p < h; p++) t.readBoolean() && s(p < 6 ? 16 : 64, t); if (t.skipUnsignedExpGolomb(), 0 === (o = t.readUnsignedExpGolomb())) t.readUnsignedExpGolomb(); else if (1 === o) for (t.skipBits(1), t.skipExpGolomb(), t.skipExpGolomb(), u = t.readUnsignedExpGolomb(), p = 0; p < u; p++) t.skipExpGolomb(); if (t.skipUnsignedExpGolomb(), t.skipBits(1), l = t.readUnsignedExpGolomb(), d = t .readUnsignedExpGolomb(), 0 === (c = t.readBits(1)) && t.skipBits(1), t.skipBits(1), t .readBoolean() && (m = t.readUnsignedExpGolomb(), g = t.readUnsignedExpGolomb(), v = t .readUnsignedExpGolomb(), y = t.readUnsignedExpGolomb()), t.readBoolean() && t.readBoolean() ) { switch (t.readUnsignedByte()) { case 1: f = [1, 1]; break; case 2: f = [12, 11]; break; case 3: f = [10, 11]; break; case 4: f = [16, 11]; break; case 5: f = [40, 33]; break; case 6: f = [24, 11]; break; case 7: f = [20, 11]; break; case 8: f = [32, 11]; break; case 9: f = [80, 33]; break; case 10: f = [18, 11]; break; case 11: f = [15, 11]; break; case 12: f = [64, 33]; break; case 13: f = [160, 99]; break; case 14: f = [4, 3]; break; case 15: f = [3, 2]; break; case 16: f = [2, 1]; break; case 255: f = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t .readUnsignedByte() ] } f && (_ = f[0] / f[1]) } return { profileIdc: i, levelIdc: r, profileCompatibility: n, width: Math.ceil((16 * (l + 1) - 2 * m - 2 * g) * _), height: (2 - c) * (d + 1) * 16 - 2 * v - 2 * y } } }).prototype = new Y; var He, Ge = { H264Stream: Ue, NalByteStream: Ne }; (He = function() { var e = new Uint8Array, t = 0; He.prototype.init.call(this), this.setTimestamp = function(e) { t = e }, this.parseId3TagSize = function(e, t) { var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]; return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10 }, this.parseAdtsSize = function(e, t) { var i = (224 & e[t + 5]) >> 5, r = e[t + 4] << 3; return 6144 & e[t + 3] | r | i }, this.push = function(i) { var r, n, a, s, o = 0, u = 0; for (e.length ? (s = e.length, (e = new Uint8Array(i.byteLength + s)).set(e.subarray(0, s)), e.set( i, s)) : e = i; e.length - u >= 3;) if (e[u] !== "I".charCodeAt(0) || e[u + 1] !== "D".charCodeAt(0) || e[u + 2] !== "3".charCodeAt( 0)) if (!0 & e[u] && 240 == (240 & e[u + 1])) { if (e.length - u < 7) break; if ((o = this.parseAdtsSize(e, u)) > e.length) break; a = { type: "audio", data: e.subarray(u, u + o), pts: t, dts: t }, this.trigger("data", a), u += o } else u++; else { if (e.length - u < 10) break; if ((o = this.parseId3TagSize(e, u)) > e.length) break; n = { type: "timed-metadata", data: e.subarray(u, u + o) }, this.trigger("data", n), u += o } r = e.length - u, e = r > 0 ? e.subarray(u) : new Uint8Array } }).prototype = new Y; var Ve, We, qe, Xe, ze, Ke, Ye, Qe, Je, Ze, $e, et, tt = He, it = [33, 16, 5, 32, 164, 27], rt = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252], nt = function(e) { for (var t = []; e--;) t.push(0); return t }, at = { 96000: [it, [227, 64], nt(154), [56]], 88200: [it, [231], nt(170), [56]], 64000: [it, [248, 192], nt(240), [56]], 48000: [it, [255, 192], nt(268), [55, 148, 128], nt(54), [112]], 44100: [it, [255, 192], nt(268), [55, 163, 128], nt(84), [112]], 32000: [it, [255, 192], nt(268), [55, 234], nt(226), [112]], 24000: [it, [255, 192], nt(268), [55, 255, 128], nt(268), [111, 112], nt(126), [224]], 16000: [it, [255, 192], nt(268), [55, 255, 128], nt(268), [111, 255], nt(269), [223, 108], nt(195), [1, 192 ]], 12000: [rt, nt(268), [3, 127, 248], nt(268), [6, 255, 240], nt(268), [13, 255, 224], nt(268), [27, 253, 128 ], nt(259), [56]], 11025: [rt, nt(268), [3, 127, 248], nt(268), [6, 255, 240], nt(268), [13, 255, 224], nt(268), [27, 255, 192 ], nt(268), [55, 175, 128], nt(108), [112]], 8000: [rt, nt(268), [3, 121, 16], nt(47), [7]] }, st = (Ve = at, Object.keys(Ve).reduce(function(e, t) { return e[t] = new Uint8Array(Ve[t].reduce(function(e, t) { return e.concat(t) }, [])), e }, {})), ot = (We = function(e) { return 9e4 * e }, qe = function(e, t) { return e * t }, Xe = function(e) { return e / 9e4 }, ze = function(e, t) { return e / t }, function(e, t) { return We(ze(e, t)) }), ut = function(e, t) { return qe(Xe(e), t) }, lt = Ge.H264Stream, dt = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"], ct = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility"]; Ze = function(e) { return e[0] === "I".charCodeAt(0) && e[1] === "D".charCodeAt(0) && e[2] === "3".charCodeAt(0) }, $e = function(e, t) { var i; if (e.length !== t.length) return !1; for (i = 0; i < e.length; i++) if (e[i] !== t[i]) return !1; return !0 }, et = function(e) { var t, i = 0; for (t = 0; t < e.length; t++) i += e[t].data.byteLength; return i }, (Ye = function(e, t) { var i = [], r = 0, n = 0, a = 0, s = 1 / 0; t = t || {}, Ye.prototype.init.call(this), this.push = function(t) { ne(e, t), e && dt.forEach(function(i) { e[i] = t[i] }), i.push(t) }, this.setEarliestDts = function(t) { n = t - e.timelineStartInfo.baseMediaDecodeTime }, this.setVideoBaseMediaDecodeTime = function(e) { s = e }, this.setAudioAppendStart = function(e) { a = e }, this.flush = function() { var n, a, s, o; 0 !== i.length ? (n = this.trimAdtsFramesByEarliestDts_(i), e.baseMediaDecodeTime = re(e, t .keepOriginalTimestamps), this.prefixWithSilence_(e, n), e.samples = this .generateSampleTable_(n), s = q.mdat(this.concatenateFrameData_(n)), i = [], a = q.moof(r, [ e]), o = new Uint8Array(a.byteLength + s.byteLength), r++, o.set(a), o.set(s, a.byteLength), ie(e), this.trigger("data", { track: e, boxes: o }), this.trigger("done", "AudioSegmentStream")) : this.trigger("done", "AudioSegmentStream") }, this.prefixWithSilence_ = function(e, t) { var i, r, n, o, u = 0, l = 0, d = 0; if (t.length && (i = ot(e.baseMediaDecodeTime, e.samplerate), r = Math.ceil(9e4 / (e.samplerate / 1024)), a && s && (u = i - Math.max(a, s), d = (l = Math.floor(u / r)) * r), !(l < 1 || d > 45e3))) { for ((n = st[e.samplerate]) || (n = t[0].data), o = 0; o < l; o++) t.splice(o, 0, { data: n }); e.baseMediaDecodeTime -= Math.floor(ut(d, e.samplerate)) } }, this.trimAdtsFramesByEarliestDts_ = function(t) { return e.minSegmentDts >= n ? t : (e.minSegmentDts = 1 / 0, t.filter(function(t) { return t.dts >= n && (e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), e .minSegmentPts = e.minSegmentDts, !0) })) }, this.generateSampleTable_ = function(e) { var t, i, r = []; for (t = 0; t < e.length; t++) i = e[t], r.push({ size: i.data.byteLength, duration: 1024 }); return r }, this.concatenateFrameData_ = function(e) { var t, i, r = 0, n = new Uint8Array(et(e)); for (t = 0; t < e.length; t++) i = e[t], n.set(i.data, r), r += i.data.byteLength; return n } }).prototype = new Y, (Ke = function(e, t) { var i, r, n = 0, a = [], s = []; t = t || {}, Ke.prototype.init.call(this), delete e.minPTS, this.gopCache_ = [], this.push = function( t) { ne(e, t), "seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config, e.sps = [t.data], ct .forEach(function(t) { e[t] = i[t] }, this)), "pic_parameter_set_rbsp" !== t.nalUnitType || r || (r = t.data, e.pps = [t.data]), a.push(t) }, this.flush = function() { for (var i, r, o, u, l, d; a.length && "access_unit_delimiter_rbsp" !== a[0].nalUnitType;) a .shift(); if (0 === a.length) return this.resetStream_(), void this.trigger("done", "VideoSegmentStream"); if (i = J(a), (o = Z(i))[0][0].keyFrame || ((r = this.getGopForFusion_(a[0], e)) ? (o.unshift(r), o.byteLength += r.byteLength, o.nalCount += r.nalCount, o.pts = r.pts, o.dts = r.dts, o .duration += r.duration) : o = $(o)), s.length) { var c; if (!(c = t.alignGopsAtEnd ? this.alignGopsAtEnd_(o) : this.alignGopsAtStart_(o))) return this .gopCache_.unshift({ gop: o.pop(), pps: e.pps, sps: e.sps }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.resetStream_(), void this.trigger("done", "VideoSegmentStream"); ie(e), o = c } ne(e, o), e.samples = ee(o), l = q.mdat(te(o)), e.baseMediaDecodeTime = re(e, t .keepOriginalTimestamps), this.trigger("processedGopsInfo", o.map(function(e) { return { pts: e.pts, dts: e.dts, byteLength: e.byteLength } })), this.gopCache_.unshift({ gop: o.pop(), pps: e.pps, sps: e.sps }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.trigger( "baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e .timelineStartInfo), u = q.moof(n, [e]), d = new Uint8Array(u.byteLength + l.byteLength), n++, d.set(u), d.set(l, u.byteLength), this.trigger("data", { track: e, boxes: d }), this.resetStream_(), this.trigger("done", "VideoSegmentStream") }, this.resetStream_ = function() { ie(e), i = void 0, r = void 0 }, this.getGopForFusion_ = function(t) { var i, r, n, a, s, o = 1 / 0; for (s = 0; s < this.gopCache_.length; s++) n = (a = this.gopCache_[s]).gop, e.pps && $e(e.pps[0], a.pps[0]) && e.sps && $e(e.sps[0], a.sps[0]) && (n.dts < e.timelineStartInfo.dts || (i = t .dts - n.dts - n.duration) >= -1e4 && i <= 45e3 && (!r || o > i) && (r = a, o = i)); return r ? r.gop : null }, this.alignGopsAtStart_ = function(e) { var t, i, r, n, a, o, u, l; for (a = e.byteLength, o = e.nalCount, u = e.duration, t = i = 0; t < s.length && i < e.length && (r = s[t], n = e[i], r.pts !== n.pts);) n.pts > r.pts ? t++ : (i++, a -= n.byteLength, o -= n .nalCount, u -= n.duration); return 0 === i ? e : i === e.length ? null : ((l = e.slice(i)).byteLength = a, l.duration = u, l .nalCount = o, l.pts = l[0].pts, l.dts = l[0].dts, l) }, this.alignGopsAtEnd_ = function(e) { var t, i, r, n, a, o, u; for (t = s.length - 1, i = e.length - 1, a = null, o = !1; t >= 0 && i >= 0;) { if (r = s[t], n = e[i], r.pts === n.pts) { o = !0; break } r.pts > n.pts ? t-- : (t === s.length - 1 && (a = i), i--) } if (!o && null === a) return null; if (0 === (u = o ? i : a)) return e; var l = e.slice(u), d = l.reduce(function(e, t) { return e.byteLength += t.byteLength, e.duration += t.duration, e.nalCount += t.nalCount, e }, { byteLength: 0, duration: 0, nalCount: 0 }); return l.byteLength = d.byteLength, l.duration = d.duration, l.nalCount = d.nalCount, l.pts = l[0] .pts, l.dts = l[0].dts, l }, this.alignGopsWith = function(e) { s = e } }).prototype = new Y, (Je = function(e, t) { this.numberOfTracks = 0, this.metadataStream = t, void 0 !== e.remux ? this.remuxTracks = !!e.remux : this.remuxTracks = !0, this.pendingTracks = [], this.videoTrack = null, this.pendingBoxes = [], this .pendingCaptions = [], this.pendingMetadata = [], this.pendingBytes = 0, this.emittedTracks = 0, Je .prototype.init.call(this), this.push = function(e) { return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (this .pendingTracks.push(e.track), this.pendingBoxes.push(e.boxes), this.pendingBytes += e.boxes .byteLength, "video" === e.track.type && (this.videoTrack = e.track), void("audio" === e.track .type && (this.audioTrack = e.track))) } }).prototype = new Y, Je.prototype.flush = function(e) { var t, i, r, n, a = 0, s = { captions: [], captionStreams: {}, metadata: [], info: {} }, o = 0; if (this.pendingTracks.length < this.numberOfTracks) { if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return; if (this.remuxTracks) return; if (0 === this.pendingTracks.length) return this.emittedTracks++, void(this.emittedTracks >= this .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0)) } for (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts, ct.forEach(function(e) { s.info[e] = this.videoTrack[e] }, this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts, dt.forEach(function(e) { s.info[e] = this.audioTrack[e] }, this)), 1 === this.pendingTracks.length ? s.type = this.pendingTracks[0].type : s.type = "combined", this.emittedTracks += this.pendingTracks.length, r = q.initSegment(this.pendingTracks), s .initSegment = new Uint8Array(r.byteLength), s.initSegment.set(r), s.data = new Uint8Array(this .pendingBytes), n = 0; n < this.pendingBoxes.length; n++) s.data.set(this.pendingBoxes[n], a), a += this.pendingBoxes[n].byteLength; for (n = 0; n < this.pendingCaptions.length; n++)(t = this.pendingCaptions[n]).startTime = t.startPts - o, t.startTime /= 9e4, t.endTime = t.endPts - o, t.endTime /= 9e4, s.captionStreams[t.stream] = !0, s .captions.push(t); for (n = 0; n < this.pendingMetadata.length; n++)(i = this.pendingMetadata[n]).cueTime = i.pts - o, i .cueTime /= 9e4, s.metadata.push(i); s.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this .videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this.pendingBytes = 0, this.pendingMetadata.length = 0, this.trigger("data", s), this.emittedTracks >= this .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0) }, (Qe = function(e) { var t, i, r = this, n = !0; Qe.prototype.init.call(this), e = e || {}, this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0, this .transmuxPipeline_ = {}, this.setupAacPipeline = function() { var t = {}; this.transmuxPipeline_ = t, t.type = "aac", t.metadataStream = new xe.MetadataStream, t .aacStream = new tt, t.audioTimestampRolloverStream = new xe.TimestampRolloverStream("audio"), t .timedMetadataTimestampRolloverStream = new xe.TimestampRolloverStream("timed-metadata"), t .adtsStream = new Fe, t.coalesceStream = new Je(e, t.metadataStream), t.headOfPipeline = t .aacStream, t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream), t.aacStream .pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream), t .metadataStream.on("timestamp", function(e) { t.aacStream.setTimestamp(e.timeStamp) }), t.aacStream.on("data", function(n) { "timed-metadata" !== n.type || t.audioSegmentStream || (i = i || { timelineStartInfo: { baseMediaDecodeTime: r.baseMediaDecodeTime }, codec: "adts", type: "audio" }, t.coalesceStream.numberOfTracks++, t.audioSegmentStream = new Ye(i, e), t.adtsStream .pipe(t.audioSegmentStream).pipe(t.coalesceStream)) }), t.coalesceStream.on("data", this.trigger.bind(this, "data")), t.coalesceStream.on("done", this.trigger.bind(this, "done")) }, this.setupTsPipeline = function() { var n = {}; this.transmuxPipeline_ = n, n.type = "ts", n.metadataStream = new xe.MetadataStream, n .packetStream = new xe.TransportPacketStream, n.parseStream = new xe.TransportParseStream, n .elementaryStream = new xe.ElementaryStream, n.videoTimestampRolloverStream = new xe .TimestampRolloverStream("video"), n.audioTimestampRolloverStream = new xe .TimestampRolloverStream("audio"), n.timedMetadataTimestampRolloverStream = new xe .TimestampRolloverStream("timed-metadata"), n.adtsStream = new Fe, n.h264Stream = new lt, n .captionStream = new xe.CaptionStream, n.coalesceStream = new Je(e, n.metadataStream), n .headOfPipeline = n.packetStream, n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream), n .elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream), n.elementaryStream .pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream), n.elementaryStream.pipe(n .timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream), n .h264Stream.pipe(n.captionStream).pipe(n.coalesceStream), n.elementaryStream.on("data", function(a) { var s; if ("metadata" === a.type) { for (s = a.tracks.length; s--;) t || "video" !== a.tracks[s].type ? i || "audio" !== a .tracks[s].type || ((i = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r .baseMediaDecodeTime) : (t = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r .baseMediaDecodeTime; t && !n.videoSegmentStream && (n.coalesceStream.numberOfTracks++, n.videoSegmentStream = new Ke(t, e), n.videoSegmentStream.on("timelineStartInfo", function(e) { i && (i.timelineStartInfo = e, n.audioSegmentStream.setEarliestDts(e.dts)) }), n.videoSegmentStream.on("processedGopsInfo", r.trigger.bind(r, "gopInfo")), n .videoSegmentStream.on("baseMediaDecodeTime", function(e) { i && n.audioSegmentStream.setVideoBaseMediaDecodeTime(e) }), n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)), i && !n .audioSegmentStream && (n.coalesceStream.numberOfTracks++, n.audioSegmentStream = new Ye(i, e), n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream)) } }), n.coalesceStream.on("data", this.trigger.bind(this, "data")), n.coalesceStream.on("done", this.trigger.bind(this, "done")) }, this.setBaseMediaDecodeTime = function(e) { var r = this.transmuxPipeline_; this.baseMediaDecodeTime = e, i && (i.timelineStartInfo.dts = void 0, i.timelineStartInfo.pts = void 0, ie(i), i.timelineStartInfo.baseMediaDecodeTime = e, r.audioTimestampRolloverStream && r.audioTimestampRolloverStream.discontinuity()), t && (r.videoSegmentStream && (r .videoSegmentStream.gopCache_ = [], r.videoTimestampRolloverStream.discontinuity()), t .timelineStartInfo.dts = void 0, t.timelineStartInfo.pts = void 0, ie(t), r.captionStream .reset(), t.timelineStartInfo.baseMediaDecodeTime = e), r .timedMetadataTimestampRolloverStream && r.timedMetadataTimestampRolloverStream.discontinuity() }, this.setAudioAppendStart = function(e) { i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e) }, this.alignGopsWith = function(e) { t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream .alignGopsWith(e) }, this.push = function(e) { if (n) { var t = Ze(e); t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this .transmuxPipeline_.type || this.setupTsPipeline(), n = !1 } this.transmuxPipeline_.headOfPipeline.push(e) }, this.flush = function() { n = !0, this.transmuxPipeline_.headOfPipeline.flush() }, this.resetCaptions = function() { this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset() } }).prototype = new Y; var ht, ft, pt = { Transmuxer: Qe, VideoSegmentStream: Ke, AudioSegmentStream: Ye, AUDIO_PROPERTIES: dt, VIDEO_PROPERTIES: ct }, mt = z.parseType, gt = function(e) { return new Date(1e3 * e - 20828448e5) }, vt = function(e) { return { isLeading: (12 & e[0]) >>> 2, dependsOn: 3 & e[0], isDependedOn: (192 & e[1]) >>> 6, hasRedundancy: (48 & e[1]) >>> 4, paddingValue: (14 & e[1]) >>> 1, isNonSyncSample: 1 & e[1], degradationPriority: e[2] << 8 | e[3] } }, yt = { avc1: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { dataReferenceIndex: t.getUint16(6), width: t.getUint16(24), height: t.getUint16(26), horizresolution: t.getUint16(28) + t.getUint16(30) / 16, vertresolution: t.getUint16(32) + t.getUint16(34) / 16, frameCount: t.getUint16(40), depth: t.getUint16(74), config: ht(e.subarray(78, e.byteLength)) } }, avcC: function(e) { var t, i, r, n, a = new DataView(e.buffer, e.byteOffset, e.byteLength), s = { configurationVersion: e[0], avcProfileIndication: e[1], profileCompatibility: e[2], avcLevelIndication: e[3], lengthSizeMinusOne: 3 & e[4], sps: [], pps: [] }, o = 31 & e[5]; for (r = 6, n = 0; n < o; n++) i = a.getUint16(r), r += 2, s.sps.push(new Uint8Array(e.subarray(r, r + i))), r += i; for (t = e[r], r++, n = 0; n < t; n++) i = a.getUint16(r), r += 2, s.pps.push(new Uint8Array(e .subarray(r, r + i))), r += i; return s }, btrt: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { bufferSizeDB: t.getUint32(0), maxBitrate: t.getUint32(4), avgBitrate: t.getUint32(8) } }, esds: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), esId: e[6] << 8 | e[7], streamPriority: 31 & e[8], decoderConfig: { objectProfileIndication: e[11], streamType: e[12] >>> 2 & 63, bufferSize: e[13] << 16 | e[14] << 8 | e[15], maxBitrate: e[16] << 24 | e[17] << 16 | e[18] << 8 | e[19], avgBitrate: e[20] << 24 | e[21] << 16 | e[22] << 8 | e[23], decoderConfigDescriptor: { tag: e[24], length: e[25], audioObjectType: e[26] >>> 3 & 31, samplingFrequencyIndex: (7 & e[26]) << 1 | e[27] >>> 7 & 1, channelConfiguration: e[27] >>> 3 & 15 } } } }, ftyp: function(e) { for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = { majorBrand: mt(e.subarray(0, 4)), minorVersion: t.getUint32(4), compatibleBrands: [] }, r = 8; r < e.byteLength;) i.compatibleBrands.push(mt(e.subarray(r, r + 4))), r += 4; return i }, dinf: function(e) { return { boxes: ht(e) } }, dref: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), dataReferences: ht(e.subarray(8)) } }, hdlr: function(e) { var t = { version: new DataView(e.buffer, e.byteOffset, e.byteLength).getUint8(0), flags: new Uint8Array(e.subarray(1, 4)), handlerType: mt(e.subarray(8, 12)), name: "" }, i = 8; for (i = 24; i < e.byteLength; i++) { if (0 === e[i]) { i++; break } t.name += String.fromCharCode(e[i]) } return t.name = decodeURIComponent(escape(t.name)), t }, mdat: function(e) { return { byteLength: e.byteLength, nals: function(e) { var t, i, r = new DataView(e.buffer, e.byteOffset, e.byteLength), n = []; for (t = 0; t + 4 < e.length; t += i) if (i = r.getUint32(t), t += 4, i <= 0) n.push( "MALFORMED DATA"); else switch (31 & e[t]) { case 1: n.push("slice_layer_without_partitioning_rbsp"); break; case 5: n.push("slice_layer_without_partitioning_rbsp_idr"); break; case 6: n.push("sei_rbsp"); break; case 7: n.push("seq_parameter_set_rbsp"); break; case 8: n.push("pic_parameter_set_rbsp"); break; case 9: n.push("access_unit_delimiter_rbsp"); break; default: n.push("UNKNOWN NAL - " + e[t] & 31) } return n }(e) } }, mdhd: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = 4, n = { version: i.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)), language: "" }; return 1 === n.version ? (r += 4, n.creationTime = gt(i.getUint32(r)), r += 8, n.modificationTime = gt(i.getUint32(r)), r += 4, n.timescale = i.getUint32(r), r += 8, n.duration = i.getUint32(r)) : (n.creationTime = gt(i.getUint32(r)), r += 4, n.modificationTime = gt(i.getUint32(r)), r += 4, n .timescale = i.getUint32(r), r += 4, n.duration = i.getUint32(r)), r += 4, t = i.getUint16(r), n .language += String.fromCharCode(96 + (t >> 10)), n.language += String.fromCharCode(96 + ((992 & t) >> 5)), n.language += String.fromCharCode(96 + (31 & t)), n }, mdia: function(e) { return { boxes: ht(e) } }, mfhd: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sequenceNumber: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7] } }, minf: function(e) { return { boxes: ht(e) } }, mp4a: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = { dataReferenceIndex: t.getUint16(6), channelcount: t.getUint16(16), samplesize: t.getUint16(18), samplerate: t.getUint16(24) + t.getUint16(26) / 65536 }; return e.byteLength > 28 && (i.streamDescriptor = ht(e.subarray(28))[0]), i }, moof: function(e) { return { boxes: ht(e) } }, moov: function(e) { return { boxes: ht(e) } }, mvex: function(e) { return { boxes: ht(e) } }, mvhd: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = 4, r = { version: t.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)) }; return 1 === r.version ? (i += 4, r.creationTime = gt(t.getUint32(i)), i += 8, r.modificationTime = gt(t.getUint32(i)), i += 4, r.timescale = t.getUint32(i), i += 8, r.duration = t.getUint32(i)) : (r.creationTime = gt(t.getUint32(i)), i += 4, r.modificationTime = gt(t.getUint32(i)), i += 4, r .timescale = t.getUint32(i), i += 4, r.duration = t.getUint32(i)), i += 4, r.rate = t.getUint16( i) + t.getUint16(i + 2) / 16, i += 4, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i += 2, i += 2, i += 8, r.matrix = new Uint32Array(e.subarray(i, i + 36)), i += 36, i += 24, r .nextTrackId = t.getUint32(i), r }, pdin: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { version: t.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)), rate: t.getUint32(4), initialDelay: t.getUint32(8) } }, sdtp: function(e) { var t, i = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), samples: [] }; for (t = 4; t < e.byteLength; t++) i.samples.push({ dependsOn: (48 & e[t]) >> 4, isDependedOn: (12 & e[t]) >> 2, hasRedundancy: 3 & e[t] }); return i }, sidx: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), references: [], referenceId: i.getUint32(4), timescale: i.getUint32(8), earliestPresentationTime: i.getUint32(12), firstOffset: i.getUint32(16) }, n = i.getUint16(22); for (t = 24; n; t += 12, n--) r.references.push({ referenceType: (128 & e[t]) >>> 7, referencedSize: 2147483647 & i.getUint32(t), subsegmentDuration: i.getUint32(t + 4), startsWithSap: !!(128 & e[t + 8]), sapType: (112 & e[t + 8]) >>> 4, sapDeltaTime: 268435455 & i.getUint32(t + 8) }); return r }, smhd: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), balance: e[4] + e[5] / 256 } }, stbl: function(e) { return { boxes: ht(e) } }, stco: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), chunkOffsets: [] }, n = i.getUint32(4); for (t = 8; n; t += 4, n--) r.chunkOffsets.push(i.getUint32(t)); return r }, stsc: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = i.getUint32(4), n = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sampleToChunks: [] }; for (t = 8; r; t += 12, r--) n.sampleToChunks.push({ firstChunk: i.getUint32(t), samplesPerChunk: i.getUint32(t + 4), sampleDescriptionIndex: i.getUint32(t + 8) }); return n }, stsd: function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sampleDescriptions: ht(e.subarray(8)) } }, stsz: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), sampleSize: i.getUint32(4), entries: [] }; for (t = 12; t < e.byteLength; t += 4) r.entries.push(i.getUint32(t)); return r }, stts: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), timeToSamples: [] }, n = i.getUint32(4); for (t = 8; n; t += 8, n--) r.timeToSamples.push({ sampleCount: i.getUint32(t), sampleDelta: i.getUint32(t + 4) }); return r }, styp: function(e) { return yt.ftyp(e) }, tfdt: function(e) { var t = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), baseMediaDecodeTime: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7] }; return 1 === t.version && (t.baseMediaDecodeTime *= Math.pow(2, 32), t.baseMediaDecodeTime += e[ 8] << 24 | e[9] << 16 | e[10] << 8 | e[11]), t }, tfhd: function(e) { var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength), r = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), trackId: i.getUint32(4) }, n = 1 & r.flags[2], a = 2 & r.flags[2], s = 8 & r.flags[2], o = 16 & r.flags[2], u = 32 & r.flags[2], l = 65536 & r.flags[0], d = 131072 & r.flags[0]; return t = 8, n && (t += 4, r.baseDataOffset = i.getUint32(12), t += 4), a && (r .sampleDescriptionIndex = i.getUint32(t), t += 4), s && (r.defaultSampleDuration = i.getUint32( t), t += 4), o && (r.defaultSampleSize = i.getUint32(t), t += 4), u && (r.defaultSampleFlags = i .getUint32(t)), l && (r.durationIsEmpty = !0), !n && d && (r.baseDataOffsetIsMoof = !0), r }, tkhd: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = 4, r = { version: t.getUint8(0), flags: new Uint8Array(e.subarray(1, 4)) }; return 1 === r.version ? (i += 4, r.creationTime = gt(t.getUint32(i)), i += 8, r.modificationTime = gt(t.getUint32(i)), i += 4, r.trackId = t.getUint32(i), i += 4, i += 8, r.duration = t .getUint32(i)) : (r.creationTime = gt(t.getUint32(i)), i += 4, r.modificationTime = gt(t .getUint32(i)), i += 4, r.trackId = t.getUint32(i), i += 4, i += 4, r.duration = t.getUint32( i)), i += 4, i += 8, r.layer = t.getUint16(i), i += 2, r.alternateGroup = t.getUint16(i), i += 2, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i += 2, i += 2, r.matrix = new Uint32Array(e .subarray(i, i + 36)), i += 36, r.width = t.getUint16(i) + t.getUint16(i + 2) / 16, i += 4, r .height = t.getUint16(i) + t.getUint16(i + 2) / 16, r }, traf: function(e) { return { boxes: ht(e) } }, trak: function(e) { return { boxes: ht(e) } }, trex: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), trackId: t.getUint32(4), defaultSampleDescriptionIndex: t.getUint32(8), defaultSampleDuration: t.getUint32(12), defaultSampleSize: t.getUint32(16), sampleDependsOn: 3 & e[20], sampleIsDependedOn: (192 & e[21]) >> 6, sampleHasRedundancy: (48 & e[21]) >> 4, samplePaddingValue: (14 & e[21]) >> 1, sampleIsDifferenceSample: !!(1 & e[21]), sampleDegradationPriority: t.getUint16(22) } }, trun: function(e) { var t, i = { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), samples: [] }, r = new DataView(e.buffer, e.byteOffset, e.byteLength), n = 1 & i.flags[2], a = 4 & i.flags[2], s = 1 & i.flags[1], o = 2 & i.flags[1], u = 4 & i.flags[1], l = 8 & i.flags[1], d = r.getUint32(4), c = 8; for (n && (i.dataOffset = r.getInt32(c), c += 4), a && d && (t = { flags: vt(e.subarray(c, c + 4)) }, c += 4, s && (t.duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4), l && (t.compositionTimeOffset = r.getUint32(c), c += 4), i.samples.push(t), d--); d--;) t = {}, s && (t.duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4), u && (t .flags = vt(e.subarray(c, c + 4)), c += 4), l && (t.compositionTimeOffset = r.getUint32(c), c += 4), i.samples.push(t); return i }, "url ": function(e) { return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)) } }, vmhd: function(e) { var t = new DataView(e.buffer, e.byteOffset, e.byteLength); return { version: e[0], flags: new Uint8Array(e.subarray(1, 4)), graphicsmode: t.getUint16(4), opcolor: new Uint16Array([t.getUint16(6), t.getUint16(8), t.getUint16(10)]) } } }, _t = { inspect: ht = function(e) { for (var t, i, r, n, a, s = 0, o = [], u = new ArrayBuffer(e.length), l = new Uint8Array(u), d = 0; d < e.length; ++d) l[d] = e[d]; for (t = new DataView(u); s < e.byteLength;) i = t.getUint32(s), r = mt(e.subarray(s + 4, s + 8)), n = i > 1 ? s + i : e.byteLength, (a = (yt[r] || function(e) { return { data: e } })(e.subarray(s + 8, n))).size = i, a.type = r, o.push(a), s = n; return o }, textify: ft = function(e, t) { var i; return t = t || 0, i = new Array(2 * t + 1).join(" "), e.map(function(e, r) { return i + e.type + "\n" + Object.keys(e).filter(function(e) { return "type" !== e && "boxes" !== e }).map(function(t) { var r = i + " " + t + ": ", n = e[t]; if (n instanceof Uint8Array || n instanceof Uint32Array) { var a = Array.prototype.slice.call(new Uint8Array(n.buffer, n.byteOffset, n .byteLength)).map(function(e) { return " " + ("00" + e.toString(16)).slice(-2) }).join("").match(/.{1,24}/g); return a ? 1 === a.length ? r + "<" + a.join("").slice(1) + ">" : r + "<\n" + a.map( function(e) { return i + " " + e }).join("\n") + "\n" + i + " >" : r + "<>" } return r + JSON.stringify(n, null, 2).split("\n").map(function(e, t) { return 0 === t ? e : i + " " + e }).join("\n") }).join("\n") + (e.boxes ? "\n" + ft(e.boxes, t + 1) : "") }).join("\n") }, parseTfdt: yt.tfdt, parseHdlr: yt.hdlr, parseTfhd: yt.tfhd, parseTrun: yt.trun }, bt = ue, wt = ge.CaptionStream, Et = function(e, t) { for (var i = e, r = 0; r < t.length; r++) { var n = t[r]; if (i < n.size) return n; i -= n.size } return null }, Tt = function(e, t) { var i = z.findBox(e, ["moof", "traf"]), r = {}, n = []; return z.findBox(e, ["mdat"]).forEach(function(e, t) { var r = i[t]; n.push({ mdat: e, traf: r }) }), n.forEach(function(e) { var i, n = e.mdat, a = e.traf, s = z.findBox(a, ["tfhd"]), o = _t.parseTfhd(s[0]), u = o.trackId, l = z.findBox(a, ["tfdt"]), d = l.length > 0 ? _t.parseTfdt(l[0]).baseMediaDecodeTime : 0, c = z.findBox(a, ["trun"]); t === u && c.length > 0 && (i = function(e, t, i) { var r, n, a, s, o = new DataView(e.buffer, e.byteOffset, e.byteLength), u = []; for (n = 0; n + 4 < e.length; n += a) if (a = o.getUint32(n), n += 4, !(a <= 0)) switch (31 & e[n]) { case 6: var l = e.subarray(n + 1, n + 1 + a), d = Et(n, t); r = { nalUnitType: "sei_rbsp", size: a, data: l, escapedRBSP: bt(l), trackId: i }, d ? (r.pts = d.pts, r.dts = d.dts, s = d) : (r.pts = s.pts, r.dts = s.dts), u .push(r) } return u }(n, function(e, t, i) { var r = t, n = i.defaultSampleDuration || 0, a = i.defaultSampleSize || 0, s = i.trackId, o = []; return e.forEach(function(e) { var t = _t.parseTrun(e).samples; t.forEach(function(e) { void 0 === e.duration && (e.duration = n), void 0 === e.size && (e.size = a), e.trackId = s, e.dts = r, void 0 === e.compositionTimeOffset && (e .compositionTimeOffset = 0), e.pts = r + e.compositionTimeOffset, r += e .duration }), o = o.concat(t) }), o }(c, d, o), u), r[u] || (r[u] = []), r[u] = r[u].concat(i)) }), r }, St = { generator: q, probe: z, Transmuxer: pt.Transmuxer, AudioSegmentStream: pt.AudioSegmentStream, VideoSegmentStream: pt.VideoSegmentStream, CaptionParser: function() { var e, t, i, r, n, a = !1; this.isInitialized = function() { return a }, this.init = function() { e = new wt, a = !0, e.on("data", function(e) { e.startTime = e.startPts / r, e.endTime = e.endPts / r, n.captions.push(e), n .captionStreams[e.stream] = !0 }) }, this.isNewInit = function(e, t) { return !(e && 0 === e.length || t && "object" === (void 0 === t ? "undefined" : v(t)) && 0 === Object.keys(t).length || i === e[0] && r === t[i]) }, this.parse = function(e, a, s) { var o; if (!this.isInitialized()) return null; if (!a || !s) return null; if (this.isNewInit(a, s)) i = a[0], r = s[i]; else if (!i || !r) return t.push(e), null; for (; t.length > 0;) { var u = t.shift(); this.parse(u, a, s) } return null !== (o = function(e, t, i) { return t ? { seiNals: Tt(e, t)[t], timescale: i } : null }(e, i, r)) && o.seiNals ? (this.pushNals(o.seiNals), this.flushStream(), n) : null }, this.pushNals = function(t) { if (!this.isInitialized() || !t || 0 === t.length) return null; t.forEach(function(t) { e.push(t) }) }, this.flushStream = function() { if (!this.isInitialized()) return null; e.flush() }, this.clearParsedCaptions = function() { n.captions = [], n.captionStreams = {} }, this.resetCaptionStream = function() { if (!this.isInitialized()) return null; e.reset() }, this.clearAllCaptions = function() { this.clearParsedCaptions(), this.resetCaptionStream() }, this.reset = function() { t = [], i = null, r = null, n ? this.clearParsedCaptions() : n = { captions: [], captionStreams: {} }, this.resetCaptionStream() }, this.reset() } }, At = function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, kt = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), Rt = function() { function e(t, i) { At(this, e), this.options = i || {}, this.self = t, this.init() } return kt(e, [{ key: "init", value: function() { var e, t; this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new St.Transmuxer(this .options), e = this.self, (t = this.transmuxer).on("data", function(t) { var i = t.initSegment; t.initSegment = { data: i.buffer, byteOffset: i.byteOffset, byteLength: i.byteLength }; var r = t.data; t.data = r.buffer, e.postMessage({ action: "data", segment: t, byteOffset: r.byteOffset, byteLength: r.byteLength }, [t.data]) }), t.captionStream && t.captionStream.on("data", function(t) { e.postMessage({ action: "caption", data: t }) }), t.on("done", function(t) { e.postMessage({ action: "done" }) }), t.on("gopInfo", function(t) { e.postMessage({ action: "gopInfo", gopInfo: t }) }) } }, { key: "push", value: function(e) { var t = new Uint8Array(e.data, e.byteOffset, e.byteLength); this.transmuxer.push(t) } }, { key: "reset", value: function() { this.init() } }, { key: "setTimestampOffset", value: function(e) { var t = e.timestampOffset || 0; this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4 * t)) } }, { key: "setAudioAppendStart", value: function(e) { this.transmuxer.setAudioAppendStart(Math.ceil(9e4 * e.appendStart)) } }, { key: "flush", value: function(e) { this.transmuxer.flush() } }, { key: "resetCaptions", value: function() { this.transmuxer.resetCaptions() } }, { key: "alignGopsWith", value: function(e) { this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice()) } }]), e }(); new function(e) { e.onmessage = function(t) { "init" === t.data.action && t.data.options ? this.messageHandlers = new Rt(e, t.data.options) : (this .messageHandlers || (this.messageHandlers = new Rt(e)), t.data && t.data.action && "init" !== t .data.action && this.messageHandlers[t.data.action] && this.messageHandlers[t.data.action](t.data) ) } }(i) }() }), nh = { videoCodec: "avc1", videoObjectTypeIndicator: ".4d400d", audioProfile: "2" }, ah = function(e) { return e.map(function(e) { return e.replace(/avc1\.(\d+)\.(\d+)/i, function(e, t, i) { return "avc1." + ("00" + Number(t).toString(16)).slice(-2) + "00" + ("00" + Number(i).toString(16)) .slice(-2) }) }) }, sh = function() { var e, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", i = { codecCount: 0 }; return i.codecCount = t.split(",").length, i.codecCount = i.codecCount || 2, (e = /(^|\s|,)+(avc[13])([^ ,]*)/i .exec(t)) && (i.videoCodec = e[2], i.videoObjectTypeIndicator = e[3]), i.audioProfile = /(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t), i.audioProfile = i.audioProfile && i.audioProfile[2], i }, oh = function(e, t, i) { return e + "/" + t + '; codecs="' + i.filter(function(e) { return !!e }).join(", ") + '"' }, uh = function(e, t) { var i = function(e) { return e.segments && e.segments.length && e.segments[0].map ? "mp4" : "mp2t" }(t), r = function(e) { var t = e.attributes || {}; return t.CODECS ? sh(t.CODECS) : nh }(t), n = t.attributes || {}, a = !0, s = !1; if (!t) return []; if (e.mediaGroups.AUDIO && n.AUDIO) { var o = e.mediaGroups.AUDIO[n.AUDIO]; if (o) for (var u in s = !0, a = !1, o) if (!o[u].uri && !o[u].playlists) { a = !0; break } } s && !r.audioProfile && (a || (r.audioProfile = function(e, t) { if (!e.mediaGroups.AUDIO || !t) return null; var i = e.mediaGroups.AUDIO[t]; if (!i) return null; for (var r in i) { var n = i[r]; if (n.default && n.playlists) return sh(n.playlists[0].attributes.CODECS).audioProfile } return null }(e, n.AUDIO)), r.audioProfile || (Ta.log.warn( "Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)" ), r.audioProfile = nh.audioProfile)); var l = {}; r.videoCodec && (l.video = "" + r.videoCodec + r.videoObjectTypeIndicator), r.audioProfile && (l.audio = "mp4a.40." + r.audioProfile); var d = oh("audio", i, [l.audio]), c = oh("video", i, [l.video]), h = oh("video", i, [l.video, l.audio]); return s ? !a && l.video ? [c, d] : a || l.video ? [h, d] : [d, d] : l.video ? [h] : [d] }, lh = function(e) { return /mp4a\.\d+.\d+/i.test(e) }, dh = function(e) { return /avc1\.[\da-f]+/i.test(e) }, ch = function(e, t, i) { var r = null, n = null, a = 0, s = [], o = []; if (!e && !t) return Ta.createTimeRange(); if (!e) return t.buffered; if (!t) return e.buffered; if (i) return e.buffered; if (0 === e.buffered.length && 0 === t.buffered.length) return Ta.createTimeRange(); for (var u = e.buffered, l = t.buffered, d = u.length; d--;) s.push({ time: u.start(d), type: "start" }), s.push({ time: u.end(d), type: "end" }); for (d = l.length; d--;) s.push({ time: l.start(d), type: "start" }), s.push({ time: l.end(d), type: "end" }); for (s.sort(function(e, t) { return e.time - t.time }), d = 0; d < s.length; d++) "start" === s[d].type ? 2 === ++a && (r = s[d].time) : "end" === s[d].type && 1 === --a && (n = s[d].time), null !== r && null !== n && (o.push([r, n]), r = null, n = null); return Ta.createTimeRanges(o) }, hh = function(e) { function t(e, i) { Zd(this, t); var r = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, Ta.EventTarget)); r.timestampOffset_ = 0, r.pendingBuffers_ = [], r.bufferUpdating_ = !1, r.mediaSource_ = e, r.codecs_ = i, r .audioCodec_ = null, r.videoCodec_ = null, r.audioDisabled_ = !1, r.appendAudioInitSegment_ = !0, r .gopBuffer_ = [], r.timeMapping_ = 0, r.safeAppend_ = Ta.browser.IE_VERSION >= 11; var n = { remux: !1, alignGopsAtEnd: r.safeAppend_ }; return r.codecs_.forEach(function(e) { lh(e) ? r.audioCodec_ = e : dh(e) && (r.videoCodec_ = e) }), r.transmuxer_ = new rh, r.transmuxer_.postMessage({ action: "init", options: n }), r.transmuxer_.onmessage = function(e) { return "data" === e.data.action ? r.data_(e) : "done" === e.data.action ? r.done_(e) : "gopInfo" === e .data.action ? r.appendGopInfo_(e) : void 0 }, Object.defineProperty(r, "timestampOffset", { get: function() { return this.timestampOffset_ }, set: function(e) { "number" == typeof e && e >= 0 && (this.timestampOffset_ = e, this.appendAudioInitSegment_ = !0, this.gopBuffer_.length = 0, this.timeMapping_ = 0, this.transmuxer_.postMessage({ action: "setTimestampOffset", timestampOffset: e })) } }), Object.defineProperty(r, "appendWindowStart", { get: function() { return (this.videoBuffer_ || this.audioBuffer_).appendWindowStart }, set: function(e) { this.videoBuffer_ && (this.videoBuffer_.appendWindowStart = e), this.audioBuffer_ && (this .audioBuffer_.appendWindowStart = e) } }), Object.defineProperty(r, "updating", { get: function() { return !!(this.bufferUpdating_ || !this.audioDisabled_ && this.audioBuffer_ && this.audioBuffer_ .updating || this.videoBuffer_ && this.videoBuffer_.updating) } }), Object.defineProperty(r, "buffered", { get: function() { return ch(this.videoBuffer_, this.audioBuffer_, this.audioDisabled_) } }), r } return ec(t, e), $d(t, [{ key: "data_", value: function(e) { var t = e.data.segment; t.data = new Uint8Array(t.data, e.data.byteOffset, e.data.byteLength), t.initSegment = new Uint8Array(t.initSegment.data, t.initSegment.byteOffset, t.initSegment.byteLength), function(e, t, i) { var r = t.player_; if (i.captions && i.captions.length) for (var n in e.inbandTextTracks_ || (e.inbandTextTracks_ = {}), i.captionStreams) if (!e.inbandTextTracks_[n]) { r.tech_.trigger({ type: "usage", name: "hls-608" }); var a = r.textTracks().getTrackById(n); e.inbandTextTracks_[n] = a || r.addRemoteTextTrack({ kind: "captions", id: n, label: n }, !1).track } i.metadata && i.metadata.length && !e.metadataTrack_ && (e.metadataTrack_ = r .addRemoteTextTrack({ kind: "metadata", label: "Timed Metadata" }, !1).track, e.metadataTrack_.inBandMetadataTrackDispatchType = i.metadata.dispatchType) }(this, this.mediaSource_, t), this.pendingBuffers_.push(t) } }, { key: "done_", value: function(e) { "closed" !== this.mediaSource_.readyState ? this.processPendingSegments_() : this.pendingBuffers_ .length = 0 } }, { key: "createRealSourceBuffers_", value: function() { var e = this, t = ["audio", "video"]; t.forEach(function(i) { if (e[i + "Codec_"] && !e[i + "Buffer_"]) { var r = null; if (e.mediaSource_[i + "Buffer_"])(r = e.mediaSource_[i + "Buffer_"]).updating = !1; else { var n = i + '/mp4;codecs="' + e[i + "Codec_"] + '"'; r = function(e, t) { var i = e.addSourceBuffer(t), r = Object.create(null); r.updating = !1, r.realBuffer_ = i; var n = function(e) { "function" == typeof i[e] ? r[e] = function() { return i[e].apply(i, arguments) } : void 0 === r[e] && Object.defineProperty(r, e, { get: function() { return i[e] }, set: function(t) { return i[e] = t } }) }; for (var a in i) n(a); return r }(e.mediaSource_.nativeMediaSource_, n), e.mediaSource_[i + "Buffer_"] = r } e[i + "Buffer_"] = r, ["update", "updatestart", "updateend"].forEach(function(n) { r.addEventListener(n, function() { if ("audio" !== i || !e.audioDisabled_) return "updateend" === n && (e[i + "Buffer_"].updating = !1), t.every(function(t) { return !("audio" !== t || !e.audioDisabled_) || (i === t || !e[t + "Buffer_"] || !e[t + "Buffer_"].updating) }) ? e.trigger(n) : void 0 }) }) } }) } }, { key: "appendBuffer", value: function(e) { if (this.bufferUpdating_ = !0, this.audioBuffer_ && this.audioBuffer_.buffered.length) { var t = this.audioBuffer_.buffered; this.transmuxer_.postMessage({ action: "setAudioAppendStart", appendStart: t.end(t.length - 1) }) } this.videoBuffer_ && this.transmuxer_.postMessage({ action: "alignGopsWith", gopsToAlignWith: function(e, t, i) { if (void 0 === t || null === t || !e.length) return []; var r = Math.ceil(9e4 * (t - i + 3)), n = void 0; for (n = 0; n < e.length && !(e[n].pts > r); n++); return e.slice(n) }(this.gopBuffer_, this.mediaSource_.player_ ? this.mediaSource_.player_.currentTime() : null, this.timeMapping_) }), this.transmuxer_.postMessage({ action: "push", data: e.buffer, byteOffset: e.byteOffset, byteLength: e.byteLength }, [e.buffer]), this.transmuxer_.postMessage({ action: "flush" }) } }, { key: "appendGopInfo_", value: function(e) { this.gopBuffer_ = function(e, t, i) { if (!t.length) return e; if (i) return t.slice(); for (var r = t[0].pts, n = 0; n < e.length && !(e[n].pts >= r); n++); return e.slice(0, n).concat(t) }(this.gopBuffer_, e.data.gopInfo, this.safeAppend_) } }, { key: "remove", value: function(e, t) { if (this.videoBuffer_ && (this.videoBuffer_.updating = !0, this.videoBuffer_.remove(e, t), this .gopBuffer_ = function(e, t, i, r) { for (var n = Math.ceil(9e4 * (t - r)), a = Math.ceil(9e4 * (i - r)), s = e.slice(), o = e .length; o-- && !(e[o].pts <= a);); if (-1 === o) return s; for (var u = o + 1; u-- && !(e[u].pts <= n);); return u = Math.max(u, 0), s.splice(u, o - u + 1), s }(this.gopBuffer_, e, t, this.timeMapping_)), !this.audioDisabled_ && this.audioBuffer_ && (this .audioBuffer_.updating = !0, this.audioBuffer_.remove(e, t)), Vc(e, t, this.metadataTrack_), this.inbandTextTracks_) for (var i in this.inbandTextTracks_) Vc(e, t, this.inbandTextTracks_[i]) } }, { key: "processPendingSegments_", value: function() { var e = { video: { segments: [], bytes: 0 }, audio: { segments: [], bytes: 0 }, captions: [], metadata: [] }; e = this.pendingBuffers_.reduce(function(e, t) { var i = t.type, r = t.data, n = t.initSegment; return e[i].segments.push(r), e[i].bytes += r.byteLength, e[i].initSegment = n, t.captions && (e.captions = e.captions.concat(t.captions)), t.info && (e[i].info = t.info), t.metadata && (e.metadata = e.metadata.concat(t.metadata)), e }, e), this.videoBuffer_ || this.audioBuffer_ || (0 === e.video.bytes && (this.videoCodec_ = null), 0 === e.audio.bytes && (this.audioCodec_ = null), this.createRealSourceBuffers_()), e .audio.info && this.mediaSource_.trigger({ type: "audioinfo", info: e.audio.info }), e.video.info && this.mediaSource_.trigger({ type: "videoinfo", info: e.video.info }), this.appendAudioInitSegment_ && (!this.audioDisabled_ && this.audioBuffer_ && (e.audio .segments.unshift(e.audio.initSegment), e.audio.bytes += e.audio.initSegment.byteLength), this .appendAudioInitSegment_ = !1); var t = !1; this.videoBuffer_ && e.video.bytes ? (e.video.segments.unshift(e.video.initSegment), e.video .bytes += e.video.initSegment.byteLength, this.concatAndAppendSegments_(e.video, this .videoBuffer_), qc(this, e.captions, e.metadata)) : !this.videoBuffer_ || !this .audioDisabled_ && this.audioBuffer_ || (t = !0), !this.audioDisabled_ && this.audioBuffer_ && this.concatAndAppendSegments_(e.audio, this.audioBuffer_), this.pendingBuffers_.length = 0, t && this.trigger("updateend"), this.bufferUpdating_ = !1 } }, { key: "concatAndAppendSegments_", value: function(e, t) { var i = 0, r = void 0; if (e.bytes) { r = new Uint8Array(e.bytes), e.segments.forEach(function(e) { r.set(e, i), i += e.byteLength }); try { t.updating = !0, t.appendBuffer(r) } catch (e) { this.mediaSource_.player_ && this.mediaSource_.player_.error({ code: -3, type: "APPEND_BUFFER_ERR", message: e.message, originalError: e }) } } } }, { key: "abort", value: function() { this.videoBuffer_ && this.videoBuffer_.abort(), !this.audioDisabled_ && this.audioBuffer_ && this .audioBuffer_.abort(), this.transmuxer_ && this.transmuxer_.postMessage({ action: "reset" }), this.pendingBuffers_.length = 0, this.bufferUpdating_ = !1 } }]), t }(Ta.EventTarget), fh = function(e) { function t() { Zd(this, t); var e = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)), i = void 0; for (i in e.nativeMediaSource_ = new n.MediaSource, e.nativeMediaSource_) i in t.prototype || "function" != typeof e.nativeMediaSource_[i] || (e[i] = e.nativeMediaSource_[i].bind(e.nativeMediaSource_)); return e.duration_ = NaN, Object.defineProperty(e, "duration", { get: function() { return this.duration_ === 1 / 0 ? this.duration_ : this.nativeMediaSource_.duration }, set: function(e) { this.duration_ = e, e === 1 / 0 || (this.nativeMediaSource_.duration = e) } }), Object.defineProperty(e, "seekable", { get: function() { return this.duration_ === 1 / 0 ? Ta.createTimeRanges([ [0, this.nativeMediaSource_.duration] ]) : this.nativeMediaSource_.seekable } }), Object.defineProperty(e, "readyState", { get: function() { return this.nativeMediaSource_.readyState } }), Object.defineProperty(e, "activeSourceBuffers", { get: function() { return this.activeSourceBuffers_ } }), e.sourceBuffers = [], e.activeSourceBuffers_ = [], e.updateActiveSourceBuffers_ = function() { if (e.activeSourceBuffers_.length = 0, 1 === e.sourceBuffers.length) { var t = e.sourceBuffers[0]; return t.appendAudioInitSegment_ = !0, t.audioDisabled_ = !t.audioCodec_, void e.activeSourceBuffers_ .push(t) } for (var i = !1, r = !0, n = 0; n < e.player_.audioTracks().length; n++) { var a = e.player_.audioTracks()[n]; if (a.enabled && "main" !== a.kind) { i = !0, r = !1; break } } e.sourceBuffers.forEach(function(t, n) { if (t.appendAudioInitSegment_ = !0, t.videoCodec_ && t.audioCodec_) t.audioDisabled_ = i; else if (t.videoCodec_ && !t.audioCodec_) t.audioDisabled_ = !0, r = !1; else if (!t.videoCodec_ && t.audioCodec_ && (t.audioDisabled_ = n ? r : !r, t.audioDisabled_)) return; e.activeSourceBuffers_.push(t) }) }, e.onPlayerMediachange_ = function() { e.sourceBuffers.forEach(function(e) { e.appendAudioInitSegment_ = !0 }) }, e.onHlsReset_ = function() { e.sourceBuffers.forEach(function(e) { e.transmuxer_ && e.transmuxer_.postMessage({ action: "resetCaptions" }) }) }, e.onHlsSegmentTimeMapping_ = function(t) { e.sourceBuffers.forEach(function(e) { return e.timeMapping_ = t.mapping }) }, ["sourceopen", "sourceclose", "sourceended"].forEach(function(e) { this.nativeMediaSource_.addEventListener(e, this.trigger.bind(this)) }, e), e.on("sourceopen", function(t) { var i = l.querySelector('[src="' + e.url_ + '"]'); i && (e.player_ = Ta(i.parentNode), e.player_.tech_.on("hls-reset", e.onHlsReset_), e.player_.tech_.on( "hls-segment-time-mapping", e.onHlsSegmentTimeMapping_), e.player_.audioTracks && e.player_ .audioTracks() && (e.player_.audioTracks().on("change", e.updateActiveSourceBuffers_), e.player_ .audioTracks().on("addtrack", e.updateActiveSourceBuffers_), e.player_.audioTracks().on( "removetrack", e.updateActiveSourceBuffers_)), e.player_.on("mediachange", e .onPlayerMediachange_)) }), e.on("sourceended", function(t) { for (var i = Wc(e.duration), r = 0; r < e.sourceBuffers.length; r++) { var n = e.sourceBuffers[r], a = n.metadataTrack_ && n.metadataTrack_.cues; a && a.length && (a[a.length - 1].endTime = i) } }), e.on("sourceclose", function(e) { this.sourceBuffers.forEach(function(e) { e.transmuxer_ && e.transmuxer_.terminate() }), this.sourceBuffers.length = 0, this.player_ && (this.player_.audioTracks && this.player_ .audioTracks() && (this.player_.audioTracks().off("change", this.updateActiveSourceBuffers_), this .player_.audioTracks().off("addtrack", this.updateActiveSourceBuffers_), this.player_ .audioTracks().off("removetrack", this.updateActiveSourceBuffers_)), this.player_.el_ && (this .player_.off("mediachange", this.onPlayerMediachange_), this.player_.tech_.off("hls-reset", this .onHlsReset_), this.player_.tech_.off("hls-segment-time-mapping", this.onHlsSegmentTimeMapping_) )) }), e } return ec(t, e), $d(t, [{ key: "addSeekableRange_", value: function(e, t) { var i = void 0; if (this.duration !== 1 / 0) throw (i = new Error( "MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name = "InvalidStateError", i.code = 11, i; (t > this.nativeMediaSource_.duration || isNaN(this.nativeMediaSource_.duration)) && (this .nativeMediaSource_.duration = t) } }, { key: "addSourceBuffer", value: function(e) { var t = void 0, i = function(e) { var t = { type: "", parameters: {} }, i = e.trim().split(";"); return t.type = i.shift().trim(), i.forEach(function(e) { var i = e.trim().split("="); if (i.length > 1) { var r = i[0].replace(/"/g, "").trim(), n = i[1].replace(/"/g, "").trim(); t.parameters[r] = n } }), t }(e); if (/^(video|audio)\/mp2t$/i.test(i.type)) { var r = []; i.parameters && i.parameters.codecs && (r = i.parameters.codecs.split(","), r = (r = ah(r)) .filter(function(e) { return lh(e) || dh(e) })), 0 === r.length && (r = ["avc1.4d400d", "mp4a.40.2"]), t = new hh(this, r), 0 !== this .sourceBuffers.length && (this.sourceBuffers[0].createRealSourceBuffers_(), t .createRealSourceBuffers_(), this.sourceBuffers[0].audioDisabled_ = !0) } else t = this.nativeMediaSource_.addSourceBuffer(e); return this.sourceBuffers.push(t), t } }]), t }(Ta.EventTarget), ph = 0; Ta.mediaSources = {}; var mh = function(e, t) { var i = Ta.mediaSources[e]; if (!i) throw new Error("Media Source not found (Video.js)"); i.trigger({ type: "sourceopen", swfId: t }) }, gh = function() { return !!n.MediaSource && !!n.MediaSource.isTypeSupported && n.MediaSource.isTypeSupported( 'video/mp4;codecs="avc1.4d400d,mp4a.40.2"') }, vh = function() { if (this.MediaSource = { open: mh, supportsNativeMediaSources: gh }, gh()) return new fh; throw new Error("Cannot use create a virtual MediaSource for this video") }; vh.open = mh, vh.supportsNativeMediaSources = gh; var yh = { createObjectURL: function(e) { var t = void 0; return e instanceof fh ? (t = n.URL.createObjectURL(e.nativeMediaSource_), e.url_ = t, t) : e instanceof fh ? (t = "blob:vjs-media-source/" + ph, ph++, Ta.mediaSources[t] = e, t) : (t = n.URL .createObjectURL(e), e.url_ = t, t) } }; Ta.MediaSource = vh, Ta.URL = yh; var _h = Ta.EventTarget, bh = Ta.mergeOptions, wh = function(e, t) { for (var i = bh(e, { duration: t.duration, minimumUpdatePeriod: t.minimumUpdatePeriod }), r = 0; r < t.playlists.length; r++) { var n = oc(i, t.playlists[r]); n && (i = n) } return sc(t, function(e, t, r, n) { if (e.playlists && e.playlists.length) { var a = e.playlists[0].uri, s = oc(i, e.playlists[0]); s && ((i = s).mediaGroups[t][r][n].playlists[0] = i.playlists[a]) } }), i }, Eh = function(e) { function t(e, i, r, a) { Zd(this, t); var s = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); if (s.hls_ = i, s.withCredentials = r, !e) throw new Error( "A non-empty playlist URL or playlist is required"); return s.on("minimumUpdatePeriod", function() { s.refreshXml_() }), s.on("mediaupdatetimeout", function() { s.refreshMedia_() }), "string" == typeof e ? (s.srcUrl = e, s.state = "HAVE_NOTHING", tc(s)) : (s.masterPlaylistLoader_ = a, s .state = "HAVE_METADATA", s.started = !0, s.media(e), n.setTimeout(function() { s.trigger("loadedmetadata") }, 0), s) } return ec(t, _h), $d(t, [{ key: "dispose", value: function() { this.stopRequest(), n.clearTimeout(this.mediaUpdateTimeout) } }, { key: "stopRequest", value: function() { if (this.request) { var e = this.request; this.request = null, e.onreadystatechange = null, e.abort() } } }, { key: "media", value: function(e) { if (!e) return this.media_; if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this .state); var t = this.state; if ("string" == typeof e) { if (!this.master.playlists[e]) throw new Error("Unknown playlist URI: " + e); e = this.master.playlists[e] } var i = !this.media_ || e.uri !== this.media_.uri; this.state = "HAVE_METADATA", i && (this.media_ && this.trigger("mediachanging"), this.media_ = e, this.refreshMedia_(), "HAVE_MASTER" !== t && this.trigger("mediachange")) } }, { key: "pause", value: function() { this.stopRequest(), "HAVE_NOTHING" === this.state && (this.started = !1) } }, { key: "load", value: function() { this.started ? this.trigger("loadedplaylist") : this.start() } }, { key: "parseMasterXml", value: function() { var e = so(this.masterXml_, { manifestUri: this.srcUrl, clientOffset: this.clientOffset_ }); e.uri = this.srcUrl; for (var t = 0; t < e.playlists.length; t++) { var i = "placeholder-uri-" + t; e.playlists[t].uri = i, e.playlists[i] = e.playlists[t] } return sc(e, function(t, i, r, n) { if (t.playlists && t.playlists.length) { var a = "placeholder-uri-" + i + "-" + r + "-" + n; t.playlists[0].uri = a, e.playlists[a] = t.playlists[0] } }), uc(e), lc(e), e } }, { key: "start", value: function() { var e = this; this.started = !0, this.request = this.hls_.xhr({ uri: this.srcUrl, withCredentials: this.withCredentials }, function(t, i) { if (e.request) { if (e.request = null, t) return e.error = { status: i.status, message: "DASH playlist request error at URL: " + e.srcUrl, responseText: i.responseText, code: 2 }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error"); e.masterXml_ = i.responseText, i.responseHeaders && i.responseHeaders.date ? e .masterLoaded_ = Date.parse(i.responseHeaders.date) : e.masterLoaded_ = Date.now(), e .syncClientServerClock_(e.onClientServerClockSync_.bind(e)) } }) } }, { key: "syncClientServerClock_", value: function(e) { var t = this, i = oo(this.masterXml_); return null === i ? (this.clientOffset_ = this.masterLoaded_ - Date.now(), e()) : "DIRECT" === i .method ? (this.clientOffset_ = i.value - Date.now(), e()) : void(this.request = this.hls_.xhr({ uri: Jd(this.srcUrl, i.value), method: i.method, withCredentials: this.withCredentials }, function(r, n) { if (t.request) { if (r) return t.clientOffset_ = t.masterLoaded_ - Date.now(), e(); var a = void 0; a = "HEAD" === i.method ? n.responseHeaders && n.responseHeaders.date ? Date.parse(n .responseHeaders.date) : t.masterLoaded_ : Date.parse(n.responseText), t .clientOffset_ = a - Date.now(), e() } })) } }, { key: "onClientServerClockSync_", value: function() { var e = this; this.master = this.parseMasterXml(), this.state = "HAVE_MASTER", this.trigger("loadedplaylist"), this.media_ || this.media(this.master.playlists[0]), n.setTimeout(function() { e.trigger("loadedmetadata") }, 0), this.master.minimumUpdatePeriod && n.setTimeout(function() { e.trigger("minimumUpdatePeriod") }, this.master.minimumUpdatePeriod) } }, { key: "refreshXml_", value: function() { var e = this; this.request = this.hls_.xhr({ uri: this.srcUrl, withCredentials: this.withCredentials }, function(t, i) { if (e.request) { if (e.request = null, t) return e.error = { status: i.status, message: "DASH playlist request error at URL: " + e.srcUrl, responseText: i.responseText, code: 2 }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error"); e.masterXml_ = i.responseText; var r = e.parseMasterXml(); e.master = wh(e.master, r), n.setTimeout(function() { e.trigger("minimumUpdatePeriod") }, e.master.minimumUpdatePeriod) } }) } }, { key: "refreshMedia_", value: function() { var e = this, t = void 0, i = void 0; this.masterPlaylistLoader_ ? (t = this.masterPlaylistLoader_.master, i = this.masterPlaylistLoader_ .parseMasterXml()) : (t = this.master, i = this.parseMasterXml()); var r = wh(t, i); r ? (this.masterPlaylistLoader_ ? this.masterPlaylistLoader_.master = r : this.master = r, this .media_ = r.playlists[this.media_.uri]) : this.trigger("playlistunchanged"), this.media() .endList || (this.mediaUpdateTimeout = n.setTimeout(function() { e.trigger("mediaupdatetimeout") }, dc(this.media(), !!r))), this.trigger("loadedplaylist") } }]), t }(), Th = function(e) { return Ta.log.debug ? Ta.log.debug.bind(Ta, "VHS:", e + " >") : function() {} }; function Sh() {} var Ah = function() { function e(t, i, r, n) { Zd(this, e), this.callbacks_ = [], this.pendingCallback_ = null, this.timestampOffset_ = 0, this.mediaSource = t, this.processedAppend_ = !1, this.type_ = r, this.mimeType_ = i, this.logger_ = Th("SourceUpdater[" + r + "][" + i + "]"), "closed" === t.readyState ? t.addEventListener("sourceopen", this.createSourceBuffer_ .bind(this, i, n)) : this.createSourceBuffer_(i, n) } return $d(e, [{ key: "createSourceBuffer_", value: function(e, t) { var i = this; this.sourceBuffer_ = this.mediaSource.addSourceBuffer(e), this.logger_("created SourceBuffer"), t && (t.trigger("sourcebufferadded"), this.mediaSource.sourceBuffers.length < 2) ? t.on( "sourcebufferadded", function() { i.start_() }) : this.start_() } }, { key: "start_", value: function() { var e = this; this.started_ = !0, this.onUpdateendCallback_ = function() { var t = e.pendingCallback_; e.pendingCallback_ = null, e.logger_("buffered [" + Hc(e.buffered()) + "]"), t && t(), e .runCallback_() }, this.sourceBuffer_.addEventListener("updateend", this.onUpdateendCallback_), this .runCallback_() } }, { key: "abort", value: function(e) { var t = this; this.processedAppend_ && this.queueCallback_(function() { t.sourceBuffer_.abort() }, e) } }, { key: "appendBuffer", value: function(e, t) { var i = this; this.processedAppend_ = !0, this.queueCallback_(function() { i.sourceBuffer_.appendBuffer(e) }, t) } }, { key: "buffered", value: function() { return this.sourceBuffer_ ? this.sourceBuffer_.buffered : Ta.createTimeRanges() } }, { key: "remove", value: function(e, t) { var i = this, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Sh; this.processedAppend_ && this.queueCallback_(function() { i.logger_("remove [" + e + " => " + t + "]"), i.sourceBuffer_.remove(e, t) }, r) } }, { key: "updating", value: function() { return !this.sourceBuffer_ || this.sourceBuffer_.updating || this.pendingCallback_ } }, { key: "timestampOffset", value: function(e) { var t = this; return void 0 !== e && (this.queueCallback_(function() { t.sourceBuffer_.timestampOffset = e }), this.timestampOffset_ = e), this.timestampOffset_ } }, { key: "queueCallback_", value: function(e, t) { this.callbacks_.push([e.bind(this), t]), this.runCallback_() } }, { key: "runCallback_", value: function() { var e = void 0; !this.updating() && this.callbacks_.length && this.started_ && (e = this.callbacks_.shift(), this .pendingCallback_ = e[1], e[0]()) } }, { key: "dispose", value: function() { this.sourceBuffer_.removeEventListener("updateend", this.onUpdateendCallback_), this .sourceBuffer_ && "open" === this.mediaSource.readyState && this.sourceBuffer_.abort() } }]), e }(), kh = { GOAL_BUFFER_LENGTH: 30, MAX_GOAL_BUFFER_LENGTH: 60, GOAL_BUFFER_LENGTH_RATE: 1, BANDWIDTH_VARIANCE: 1.2, BUFFER_LOW_WATER_LINE: 0, MAX_BUFFER_LOW_WATER_LINE: 30, BUFFER_LOW_WATER_LINE_RATE: 1 }, Rh = 2, Mh = -101, Oh = -102, Ch = function(e) { var t, i, r = {}; return e.byterange && (r.Range = (t = e.byterange, i = t.offset + t.length - 1, "bytes=" + t.offset + "-" + i)), r }, Dh = function(e) { e.forEach(function(e) { e.abort() }) }, Ih = function(e, t) { return t.timedout ? { status: t.status, message: "HLS request timed-out at URL: " + t.uri, code: Mh, xhr: t } : t.aborted ? { status: t.status, message: "HLS request aborted at URL: " + t.uri, code: Oh, xhr: t } : e ? { status: t.status, message: "HLS request errored at URL: " + t.uri, code: Rh, xhr: t } : null }, Lh = function(e, t, i) { var r = [], n = 0; return function(a, s) { if (a && (Dh(e), r.push(a)), (n += 1) === e.length) { if (s.endOfAllRequests = Date.now(), r.length > 0) { var o = function(e) { return e.reduce(function(e, t) { return t.code > e.code ? t : e }) }(r); return i(o, s) } return s.encryptedBytes ? function(e, t, i) { e.addEventListener("message", function r(n) { if (n.data.source === t.requestId) { e.removeEventListener("message", r); var a = n.data.decrypted; return t.bytes = new Uint8Array(a.bytes, a.byteOffset, a.byteLength), i(null, t) } }), e.postMessage(xc({ source: t.requestId, encrypted: t.encryptedBytes, key: t.key.bytes, iv: t.key.iv }), [t.encryptedBytes.buffer, t.key.bytes.buffer]) }(t, s, i) : i(null, s) } } }, xh = function(e, t) { return function(i) { var r, n, a; return e.stats = Ta.mergeOptions(e.stats, (n = (r = i).target, (a = { bandwidth: 1 / 0, bytesReceived: 0, roundTripTime: Date.now() - n.requestTime || 0 }).bytesReceived = r.loaded, a.bandwidth = Math.floor(a.bytesReceived / a.roundTripTime * 8 * 1e3), a)), ! e.stats.firstBytesReceivedAt && e.stats.bytesReceived && (e.stats.firstBytesReceivedAt = Date.now()), t(i, e) } }, Ph = function(e, t, i, r, n, a, s) { var o = [], u = Lh(o, i, s); if (n.key) { var l = e(Ta.mergeOptions(t, { uri: n.key.resolvedUri, responseType: "arraybuffer" }), function(e, t) { return function(i, r) { var n = r.response, a = Ih(i, r); if (a) return t(a, e); if (16 !== n.byteLength) return t({ status: r.status, message: "Invalid HLS key at URL: " + r.uri, code: Rh, xhr: r }, e); var s = new DataView(n); return e.key.bytes = new Uint32Array([s.getUint32(0), s.getUint32(4), s.getUint32(8), s.getUint32( 12)]), t(null, e) } }(n, u)); o.push(l) } if (n.map && !n.map.bytes) { var d = e(Ta.mergeOptions(t, { uri: n.map.resolvedUri, responseType: "arraybuffer", headers: Ch(n.map) }), function(e, t, i) { return function(r, n) { var a = n.response, s = Ih(r, n); return s ? i(s, e) : 0 === a.byteLength ? i({ status: n.status, message: "Empty HLS segment content at URL: " + n.uri, code: Rh, xhr: n }, e) : (e.map.bytes = new Uint8Array(n.response), t.isInitialized() || t.init(), e.map .timescales = fo.timescale(e.map.bytes), e.map.videoTrackIds = fo.videoTrackIds(e.map.bytes), i( null, e)) } }(n, r, u)); o.push(d) } var c = e(Ta.mergeOptions(t, { uri: n.resolvedUri, responseType: "arraybuffer", headers: Ch(n) }), function(e, t, i) { return function(r, n) { var a = n.response, s = Ih(r, n), o = void 0; return s ? i(s, e) : 0 === a.byteLength ? i({ status: n.status, message: "Empty HLS segment content at URL: " + n.uri, code: Rh, xhr: n }, e) : (e.stats = function(e) { return { bandwidth: e.bandwidth, bytesReceived: e.bytesReceived || 0, roundTripTime: e.roundTripTime || 0 } }(n), e.key ? e.encryptedBytes = new Uint8Array(n.response) : e.bytes = new Uint8Array(n .response), e.map && e.map.bytes && (t.isInitialized() || t.init(), (o = t.parse(e.bytes, e.map .videoTrackIds, e.map.timescales)) && o.captions && (e.captionStreams = o.captionStreams, e .fmp4Captions = o.captions)), i(null, e)) } }(n, r, u)); return c.addEventListener("progress", xh(n, a)), o.push(c), function() { return Dh(o) } }, Uh = function(e, t) { var i; return e && (i = n.getComputedStyle(e)) ? i[t] : "" }, Nh = function(e, t) { var i = e.slice(); e.sort(function(e, r) { var n = t(e, r); return 0 === n ? i.indexOf(e) - i.indexOf(r) : n }) }, Bh = function(e, t) { var i = void 0, r = void 0; return e.attributes.BANDWIDTH && (i = e.attributes.BANDWIDTH), i = i || n.Number.MAX_VALUE, t.attributes .BANDWIDTH && (r = t.attributes.BANDWIDTH), i - (r = r || n.Number.MAX_VALUE) }, Fh = function(e, t, i) { if (!e || !t) return !1; var r = i === e.segments.length; return e.endList && "open" === t.readyState && r }, jh = function(e) { return "number" == typeof e && isFinite(e) }, Hh = function(e) { function t(e) { Zd(this, t); var i = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); if (!e) throw new TypeError("Initialization settings are required"); if ("function" != typeof e.currentTime) throw new TypeError("No currentTime getter specified"); if (!e.mediaSource) throw new TypeError("No MediaSource specified"); return i.bandwidth = e.bandwidth, i.throughput = { rate: 0, count: 0 }, i.roundTrip = NaN, i.resetStats_(), i.mediaIndex = null, i.hasPlayed_ = e.hasPlayed, i.currentTime_ = e .currentTime, i.seekable_ = e.seekable, i.seeking_ = e.seeking, i.duration_ = e.duration, i.mediaSource_ = e .mediaSource, i.hls_ = e.hls, i.loaderType_ = e.loaderType, i.startingMedia_ = void 0, i .segmentMetadataTrack_ = e.segmentMetadataTrack, i.goalBufferLength_ = e.goalBufferLength, i.sourceType_ = e .sourceType, i.inbandTextTracks_ = e.inbandTextTracks, i.state_ = "INIT", i.checkBufferTimeout_ = null, i .error_ = void 0, i.currentTimeline_ = -1, i.pendingSegment_ = null, i.mimeType_ = null, i.sourceUpdater_ = null, i.xhrOptions_ = null, i.activeInitSegmentId_ = null, i.initSegments_ = {}, i.captionParser_ = new ld, i.decrypter_ = e.decrypter, i.syncController_ = e.syncController, i.syncPoint_ = { segmentIndex: 0, time: 0 }, i.syncController_.on("syncinfoupdate", function() { return i.trigger("syncinfoupdate") }), i.mediaSource_.addEventListener("sourceopen", function() { return i.ended_ = !1 }), i.fetchAtBuffer_ = !1, i.logger_ = Th("SegmentLoader[" + i.loaderType_ + "]"), Object.defineProperty(i, "state", { get: function() { return this.state_ }, set: function(e) { e !== this.state_ && (this.logger_(this.state_ + " -> " + e), this.state_ = e) } }), i } return ec(t, e), $d(t, [{ key: "resetStats_", value: function() { this.mediaBytesTransferred = 0, this.mediaRequests = 0, this.mediaRequestsAborted = 0, this .mediaRequestsTimedout = 0, this.mediaRequestsErrored = 0, this.mediaTransferDuration = 0, this .mediaSecondsLoaded = 0 } }, { key: "dispose", value: function() { this.state = "DISPOSED", this.pause(), this.abort_(), this.sourceUpdater_ && this.sourceUpdater_ .dispose(), this.resetStats_(), this.captionParser_.reset() } }, { key: "abort", value: function() { "WAITING" === this.state ? (this.abort_(), this.state = "READY", this.paused() || this .monitorBuffer_()) : this.pendingSegment_ && (this.pendingSegment_ = null) } }, { key: "abort_", value: function() { this.pendingSegment_ && this.pendingSegment_.abortRequests(), this.pendingSegment_ = null } }, { key: "error", value: function(e) { return void 0 !== e && (this.error_ = e), this.pendingSegment_ = null, this.error_ } }, { key: "endOfStream", value: function() { this.ended_ = !0, this.pause(), this.trigger("ended") } }, { key: "buffered_", value: function() { return this.sourceUpdater_ ? this.sourceUpdater_.buffered() : Ta.createTimeRanges() } }, { key: "initSegment", value: function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; if (!e) return null; var i = Pc(e), r = this.initSegments_[i]; return t && !r && e.bytes && (this.initSegments_[i] = r = { resolvedUri: e.resolvedUri, byterange: e.byterange, bytes: e.bytes, timescales: e.timescales, videoTrackIds: e.videoTrackIds }), r || e } }, { key: "couldBeginLoading_", value: function() { return this.playlist_ && (this.sourceUpdater_ || this.mimeType_ && "INIT" === this.state) && !this .paused() } }, { key: "load", value: function() { if (this.monitorBuffer_(), this.playlist_) { if (this.syncController_.setDateTimeMapping(this.playlist_), "INIT" === this.state && this .couldBeginLoading_()) return this.init_(); !this.couldBeginLoading_() || "READY" !== this.state && "INIT" !== this.state || (this.state = "READY") } } }, { key: "init_", value: function() { return this.state = "READY", this.sourceUpdater_ = new Ah(this.mediaSource_, this.mimeType_, this .loaderType_, this.sourceBufferEmitter_), this.resetEverything(), this.monitorBuffer_() } }, { key: "playlist", value: function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; if (e) { var i = this.playlist_, r = this.pendingSegment_; this.playlist_ = e, this.xhrOptions_ = t, this.hasPlayed_() || (e.syncInfo = { mediaSequence: e.mediaSequence, time: 0 }); var n = i ? i.id : null; if (this.logger_("playlist update [" + n + " => " + e.id + "]"), this.trigger("syncinfoupdate"), "INIT" === this.state && this.couldBeginLoading_()) return this.init_(); if (i && i.uri === e.uri) { var a = e.mediaSequence - i.mediaSequence; this.logger_("live window shift [" + a + "]"), null !== this.mediaIndex && (this.mediaIndex -= a), r && (r.mediaIndex -= a, r.mediaIndex >= 0 && (r.segment = e.segments[r.mediaIndex])), this.syncController_.saveExpiredSegmentInfo(i, e) } else null !== this.mediaIndex && this.resyncLoader() } } }, { key: "pause", value: function() { this.checkBufferTimeout_ && (n.clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = null) } }, { key: "paused", value: function() { return null === this.checkBufferTimeout_ } }, { key: "mimeType", value: function(e, t) { this.mimeType_ || (this.mimeType_ = e, this.sourceBufferEmitter_ = t, "INIT" === this.state && this .couldBeginLoading_() && this.init_()) } }, { key: "resetEverything", value: function(e) { this.ended_ = !1, this.resetLoader(), this.remove(0, this.duration_(), e), this.captionParser_ .clearAllCaptions(), this.trigger("reseteverything") } }, { key: "resetLoader", value: function() { this.fetchAtBuffer_ = !1, this.resyncLoader() } }, { key: "resyncLoader", value: function() { this.mediaIndex = null, this.syncPoint_ = null, this.abort() } }, { key: "remove", value: function(e, t, i) { if (this.sourceUpdater_ && this.sourceUpdater_.remove(e, t, i), Vc(e, t, this .segmentMetadataTrack_), this.inbandTextTracks_) for (var r in this.inbandTextTracks_) Vc(e, t, this.inbandTextTracks_[r]) } }, { key: "monitorBuffer_", value: function() { this.checkBufferTimeout_ && n.clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = n .setTimeout(this.monitorBufferTick_.bind(this), 1) } }, { key: "monitorBufferTick_", value: function() { "READY" === this.state && this.fillBuffer_(), this.checkBufferTimeout_ && n.clearTimeout(this .checkBufferTimeout_), this.checkBufferTimeout_ = n.setTimeout(this.monitorBufferTick_.bind( this), 500) } }, { key: "fillBuffer_", value: function() { if (!this.sourceUpdater_.updating()) { this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this .duration_(), this.currentTimeline_, this.currentTime_())); var e = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this.hasPlayed_(), this.currentTime_(), this.syncPoint_); if (e) Fh(this.playlist_, this.mediaSource_, e.mediaIndex) ? this.endOfStream() : (e .mediaIndex !== this.playlist_.segments.length - 1 || "ended" !== this.mediaSource_ .readyState || this.seeking_()) && ((e.timeline !== this.currentTimeline_ || null !== e .startOfSegment && e.startOfSegment < this.sourceUpdater_.timestampOffset()) && (this .syncController_.reset(), e.timestampOffset = e.startOfSegment, this.captionParser_ .clearAllCaptions()), this.loadSegment_(e)) } } }, { key: "checkBuffer_", value: function(e, t, i, r, n, a) { var s = 0, o = void 0; e.length && (s = e.end(e.length - 1)); var u = Math.max(0, s - n); if (!t.segments.length) return null; if (u >= this.goalBufferLength_()) return null; if (!r && u >= 1) return null; if (null === a) return i = this.getSyncSegmentCandidate_(t), this.generateSegmentInfo_(t, i, null, ! 0); if (null !== i) { var l = t.segments[i]; return o = l && l.end ? l.end : s, this.generateSegmentInfo_(t, i + 1, o, !1) } if (this.fetchAtBuffer_) { var d = Rc.getMediaInfoForTime(t, s, a.segmentIndex, a.time); i = d.mediaIndex, o = d.startTime } else { var c = Rc.getMediaInfoForTime(t, n, a.segmentIndex, a.time); i = c.mediaIndex, o = c.startTime } return this.generateSegmentInfo_(t, i, o, !1) } }, { key: "getSyncSegmentCandidate_", value: function(e) { var t = this; if (-1 === this.currentTimeline_) return 0; var i = e.segments.map(function(e, t) { return { timeline: e.timeline, segmentIndex: t } }).filter(function(e) { return e.timeline === t.currentTimeline_ }); return i.length ? i[Math.min(i.length - 1, 1)].segmentIndex : Math.max(e.segments.length - 1, 0) } }, { key: "generateSegmentInfo_", value: function(e, t, i, r) { if (t < 0 || t >= e.segments.length) return null; var n = e.segments[t]; return { requestId: "segment-loader-" + Math.random(), uri: n.resolvedUri, mediaIndex: t, isSyncRequest: r, startOfSegment: i, playlist: e, bytes: null, encryptedBytes: null, timestampOffset: null, timeline: n.timeline, duration: n.duration, segment: n } } }, { key: "abortRequestEarly_", value: function(e) { if (this.hls_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH) return !1; if (Date.now() - (e.firstBytesReceivedAt || Date.now()) < 1e3) return !1; var t = this.currentTime_(), i = e.bandwidth, r = this.pendingSegment_.duration, n = Rc.estimateSegmentRequestTime(r, i, this.playlist_, e.bytesReceived), a = function(e, t) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1; return ((e.length ? e.end(e.length - 1) : 0) - t) / i }(this.buffered_(), t, this.hls_.tech_.playbackRate()) - 1; if (n <= a) return !1; var s = function(e) { var t = e.master, i = e.currentTime, r = e.bandwidth, n = e.duration, a = e.segmentDuration, s = e.timeUntilRebuffer, o = e.currentTimeline, u = e.syncController, l = t.playlists.filter(function(e) { return !Rc.isIncompatible(e) }), d = l.filter(Rc.isEnabled); d.length || (d = l.filter(function(e) { return !Rc.isDisabled(e) })); var c = d.filter(Rc.hasAttribute.bind(null, "BANDWIDTH")).map(function(e) { var t = u.getSyncPoint(e, n, o, i) ? 1 : 2; return { playlist: e, rebufferingImpact: Rc.estimateSegmentRequestTime(a, r, e) * t - s } }), h = c.filter(function(e) { return e.rebufferingImpact <= 0 }); return Nh(h, function(e, t) { return Bh(t.playlist, e.playlist) }), h.length ? h[0] : (Nh(c, function(e, t) { return e.rebufferingImpact - t.rebufferingImpact }), c[0] || null) }({ master: this.hls_.playlists.master, currentTime: t, bandwidth: i, duration: this.duration_(), segmentDuration: r, timeUntilRebuffer: a, currentTimeline: this.currentTimeline_, syncController: this.syncController_ }); if (s) { var o = n - a - s.rebufferingImpact, u = .5; return a <= 1 / 30 && (u = 1), !s.playlist || s.playlist.uri === this.playlist_.uri || o < u ? ! 1 : (this.bandwidth = s.playlist.attributes.BANDWIDTH * kh.BANDWIDTH_VARIANCE + 1, this.abort(), this.trigger("earlyabort"), !0) } } }, { key: "handleProgress_", value: function(e, t) { this.pendingSegment_ && t.requestId === this.pendingSegment_.requestId && !this.abortRequestEarly_(t .stats) && this.trigger("progress") } }, { key: "loadSegment_", value: function(e) { this.state = "WAITING", this.pendingSegment_ = e, this.trimBackBuffer_(e), e.abortRequests = Ph(this .hls_.xhr, this.xhrOptions_, this.decrypter_, this.captionParser_, this .createSimplifiedSegmentObj_(e), this.handleProgress_.bind(this), this.segmentRequestFinished_ .bind(this)) } }, { key: "trimBackBuffer_", value: function(e) { var t = function(e, t, i) { var r = void 0; return r = e.length && e.start(0) > 0 && e.start(0) < t ? e.start(0) : t - 30, Math.min(r, t - i) }(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); t > 0 && this.remove(0, t) } }, { key: "createSimplifiedSegmentObj_", value: function(e) { var t = e.segment, i = { resolvedUri: t.resolvedUri, byterange: t.byterange, requestId: e.requestId }; if (t.key) { var r = t.key.iv || new Uint32Array([0, 0, 0, e.mediaIndex + e.playlist.mediaSequence]); i.key = { resolvedUri: t.key.resolvedUri, iv: r } } return t.map && (i.map = this.initSegment(t.map)), i } }, { key: "segmentRequestFinished_", value: function(e, t) { if (this.mediaRequests += 1, t.stats && (this.mediaBytesTransferred += t.stats.bytesReceived, this .mediaTransferDuration += t.stats.roundTripTime), this.pendingSegment_) { if (t.requestId === this.pendingSegment_.requestId) { if (e) return this.pendingSegment_ = null, this.state = "READY", e.code === Oh ? void(this .mediaRequestsAborted += 1) : (this.pause(), e.code === Mh ? (this .mediaRequestsTimedout += 1, this.bandwidth = 1, this.roundTrip = NaN, void this .trigger("bandwidthupdate")) : (this.mediaRequestsErrored += 1, this.error(e), void this .trigger("error"))); this.bandwidth = t.stats.bandwidth, this.roundTrip = t.stats.roundTripTime, t.map && (t.map = this.initSegment(t.map, !0)), this.processSegmentResponse_(t) } } else this.mediaRequestsAborted += 1 } }, { key: "processSegmentResponse_", value: function(e) { var t = this.pendingSegment_; t.bytes = e.bytes, e.map && (t.segment.map.bytes = e.map.bytes), t.endOfAllRequests = e .endOfAllRequests, e.fmp4Captions && (! function(e, t, i) { for (var r in i) if (!e[r]) { t.trigger({ type: "usage", name: "hls-608" }); var n = t.textTracks().getTrackById(r); e[r] = n || t.addRemoteTextTrack({ kind: "captions", id: r, label: r }, !1).track } }(this.inbandTextTracks_, this.hls_.tech_, e.captionStreams), function(e) { var t = e.inbandTextTracks, i = e.captionArray, r = e.timestampOffset; if (i) { var n = window.WebKitDataCue || window.VTTCue; i.forEach(function(e) { var i = e.stream, a = e.startTime, s = e.endTime; t[i] && (a += r, s += r, t[i].addCue(new n(a, s, e.text))) }) } }({ inbandTextTracks: this.inbandTextTracks_, captionArray: e.fmp4Captions, timestampOffset: 0 }), this.captionParser_.clearParsedCaptions()), this.handleSegment_() } }, { key: "handleSegment_", value: function() { var e = this; if (this.pendingSegment_) { var t = this.pendingSegment_, i = t.segment, r = this.syncController_.probeSegmentInfo(t); void 0 === this.startingMedia_ && r && (r.containsAudio || r.containsVideo) && (this .startingMedia_ = { containsAudio: r.containsAudio, containsVideo: r.containsVideo }); var n, a, s, o = (n = this.loaderType_, a = this.startingMedia_, s = r, "main" === n && a && s ? s .containsAudio || s.containsVideo ? a.containsVideo && !s.containsVideo ? "Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest." : !a.containsVideo && s.containsVideo ? "Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest." : null : "Neither audio nor video found in segment." : null); if (o) return this.error({ message: o, blacklistDuration: 1 / 0 }), void this.trigger("error"); if (t.isSyncRequest) return this.trigger("syncinfoupdate"), this.pendingSegment_ = null, void(this .state = "READY"); null !== t.timestampOffset && t.timestampOffset !== this.sourceUpdater_.timestampOffset() && (this .sourceUpdater_.timestampOffset(t.timestampOffset), this.trigger("timestampoffset")); var u = this.syncController_.mappingForTimeline(t.timeline); if (null !== u && this.trigger({ type: "segmenttimemapping", mapping: u }), this.state = "APPENDING", i.map) { var l = Pc(i.map); if (!this.activeInitSegmentId_ || this.activeInitSegmentId_ !== l) { var d = this.initSegment(i.map); this.sourceUpdater_.appendBuffer(d.bytes, function() { e.activeInitSegmentId_ = l }) } } t.byteLength = t.bytes.byteLength, "number" == typeof i.start && "number" == typeof i.end ? this .mediaSecondsLoaded += i.end - i.start : this.mediaSecondsLoaded += i.duration, this.logger_( function(e) { var t = e.segment, i = t.start, r = t.end, n = e.playlist, a = n.mediaSequence, s = n.id, o = n.segments, u = void 0 === o ? [] : o, l = e.mediaIndex, d = e.timeline; return ["appending [" + l + "] of [" + a + ", " + (a + u.length) + "] from playlist [" + s + "]", "[" + i + " => " + r + "] in timeline [" + d + "]" ].join(" ") }(t)), this.sourceUpdater_.appendBuffer(t.bytes, this.handleUpdateEnd_.bind(this)) } else this.state = "READY" } }, { key: "handleUpdateEnd_", value: function() { if (!this.pendingSegment_) return this.state = "READY", void(this.paused() || this .monitorBuffer_()); var e = this.pendingSegment_, t = e.segment, i = null !== this.mediaIndex; (this.pendingSegment_ = null, this.recordThroughput_(e), this.addSegmentMetadataCue_(e), this .state = "READY", this.mediaIndex = e.mediaIndex, this.fetchAtBuffer_ = !0, this .currentTimeline_ = e.timeline, this.trigger("syncinfoupdate"), t.end && this.currentTime_() - t .end > 3 * e.playlist.targetDuration) ? this.resetEverything(): (i && this.trigger( "bandwidthupdate"), this.trigger("progress"), Fh(e.playlist, this.mediaSource_, e.mediaIndex + 1) && this.endOfStream(), this.paused() || this.monitorBuffer_()) } }, { key: "recordThroughput_", value: function(e) { var t = this.throughput.rate, i = Date.now() - e.endOfAllRequests + 1, r = Math.floor(e.byteLength / i * 8 * 1e3); this.throughput.rate += (r - t) / ++this.throughput.count } }, { key: "addSegmentMetadataCue_", value: function(e) { if (this.segmentMetadataTrack_) { var t = e.segment, i = t.start, r = t.end; if (jh(i) && jh(r)) { Vc(i, r, this.segmentMetadataTrack_); var a = n.WebKitDataCue || n.VTTCue, s = { bandwidth: e.playlist.attributes.BANDWIDTH, resolution: e.playlist.attributes.RESOLUTION, codecs: e.playlist.attributes.CODECS, byteLength: e.byteLength, uri: e.uri, timeline: e.timeline, playlist: e.playlist.uri, start: i, end: r }, o = new a(i, r, JSON.stringify(s)); o.value = s, this.segmentMetadataTrack_.addCue(o) } } } }]), t }(Ta.EventTarget), Gh = function(e) { return decodeURIComponent(escape(String.fromCharCode.apply(null, e))) }, Vh = new Uint8Array("\n\n".split("").map(function(e) { return e.charCodeAt(0) })), Wh = function(e) { function t(e) { var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; Zd(this, t); var r = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, i)); return r.mediaSource_ = null, r.subtitlesTrack_ = null, r } return ec(t, Hh), $d(t, [{ key: "buffered_", value: function() { if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues.length) return Ta.createTimeRanges(); var e = this.subtitlesTrack_.cues, t = e[0].startTime, i = e[e.length - 1].startTime; return Ta.createTimeRanges([ [t, i] ]) } }, { key: "initSegment", value: function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; if (!e) return null; var i = Pc(e), r = this.initSegments_[i]; if (t && !r && e.bytes) { var n = Vh.byteLength + e.bytes.byteLength, a = new Uint8Array(n); a.set(e.bytes), a.set(Vh, e.bytes.byteLength), this.initSegments_[i] = r = { resolvedUri: e.resolvedUri, byterange: e.byterange, bytes: a } } return r || e } }, { key: "couldBeginLoading_", value: function() { return this.playlist_ && this.subtitlesTrack_ && !this.paused() } }, { key: "init_", value: function() { return this.state = "READY", this.resetEverything(), this.monitorBuffer_() } }, { key: "track", value: function(e) { return void 0 === e ? this.subtitlesTrack_ : (this.subtitlesTrack_ = e, "INIT" === this.state && this.couldBeginLoading_() && this.init_(), this.subtitlesTrack_) } }, { key: "remove", value: function(e, t) { Vc(e, t, this.subtitlesTrack_) } }, { key: "fillBuffer_", value: function() { var e = this; this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this .duration_(), this.currentTimeline_, this.currentTime_())); var t = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this.hasPlayed_(), this .currentTime_(), this.syncPoint_); if (t = this.skipEmptySegments_(t)) { if (null === this.syncController_.timestampOffsetForTimeline(t.timeline)) { return this.syncController_.one("timestampoffset", function() { e.state = "READY", e.paused() || e.monitorBuffer_() }), void(this.state = "WAITING_ON_TIMELINE") } this.loadSegment_(t) } } }, { key: "skipEmptySegments_", value: function(e) { for (; e && e.segment.empty;) e = this.generateSegmentInfo_(e.playlist, e.mediaIndex + 1, e .startOfSegment + e.duration, e.isSyncRequest); return e } }, { key: "handleSegment_", value: function() { var e = this; if (this.pendingSegment_ && this.subtitlesTrack_) { this.state = "APPENDING"; var t = this.pendingSegment_, i = t.segment; if ("function" != typeof n.WebVTT && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) { var r = function() { e.handleSegment_() }; return this.state = "WAITING_ON_VTTJS", this.subtitlesTrack_.tech_.one("vttjsloaded", r), void this.subtitlesTrack_.tech_.one("vttjserror", function() { e.subtitlesTrack_.tech_.off("vttjsloaded", r), e.error({ message: "Error loading vtt.js" }), e.state = "READY", e.pause(), e.trigger("error") }) } i.requested = !0; try { this.parseVTTCues_(t) } catch (e) { return this.error({ message: e.message }), this.state = "READY", this.pause(), this.trigger("error") } if (this.updateTimeMapping_(t, this.syncController_.timelines[t.timeline], this.playlist_), t .isSyncRequest) return this.trigger("syncinfoupdate"), this.pendingSegment_ = null, void(this .state = "READY"); t.byteLength = t.bytes.byteLength, this.mediaSecondsLoaded += i.duration, t.cues.length && this .remove(t.cues[0].endTime, t.cues[t.cues.length - 1].endTime), t.cues.forEach(function(t) { e.subtitlesTrack_.addCue(t) }), this.handleUpdateEnd_() } else this.state = "READY" } }, { key: "parseVTTCues_", value: function(e) { var t = void 0, i = !1; "function" == typeof n.TextDecoder ? t = new n.TextDecoder("utf8") : (t = n.WebVTT.StringDecoder(), i = !0); var r = new n.WebVTT.Parser(n, n.vttjs, t); if (e.cues = [], e.timestampmap = { MPEGTS: 0, LOCAL: 0 }, r.oncue = e.cues.push.bind(e.cues), r.ontimestampmap = function(t) { return e.timestampmap = t }, r.onparsingerror = function(e) { Ta.log.warn("Error encountered when parsing cues: " + e.message) }, e.segment.map) { var a = e.segment.map.bytes; i && (a = Gh(a)), r.parse(a) } var s = e.bytes; i && (s = Gh(s)), r.parse(s), r.flush() } }, { key: "updateTimeMapping_", value: function(e, t, i) { var r = e.segment; if (t) if (e.cues.length) { var n = e.timestampmap, a = n.MPEGTS / 9e4 - n.LOCAL + t.mapping; if (e.cues.forEach(function(e) { e.startTime += a, e.endTime += a }), !i.syncInfo) { var s = e.cues[0].startTime, o = e.cues[e.cues.length - 1].startTime; i.syncInfo = { mediaSequence: i.mediaSequence + e.mediaIndex, time: Math.min(s, o - r.duration) } } } else r.empty = !0 } }]), t }(), qh = function(e, t) { for (var i = e.cues, r = 0; r < i.length; r++) { var n = i[r]; if (t >= n.adStartTime && t <= n.adEndTime) return n } return null }, Xh = Fd, zh = [{ name: "VOD", run: function(e, t, i, r, n) { if (i !== 1 / 0) { return { time: 0, segmentIndex: 0 } } return null } }, { name: "ProgramDateTime", run: function(e, t, i, r, n) { if (!e.datetimeToDisplayTime) return null; var a = t.segments || [], s = null, o = null; n = n || 0; for (var u = 0; u < a.length; u++) { var l = a[u]; if (l.dateTimeObject) { var d = l.dateTimeObject.getTime() / 1e3 + e.datetimeToDisplayTime, c = Math.abs(n - d); if (null !== o && o < c) break; o = c, s = { time: d, segmentIndex: u } } } return s } }, { name: "Segment", run: function(e, t, i, r, n) { var a = t.segments || [], s = null, o = null; n = n || 0; for (var u = 0; u < a.length; u++) { var l = a[u]; if (l.timeline === r && void 0 !== l.start) { var d = Math.abs(n - l.start); if (null !== o && o < d) break; (!s || null === o || o >= d) && (o = d, s = { time: l.start, segmentIndex: u }) } } return s } }, { name: "Discontinuity", run: function(e, t, i, r, n) { var a = null; if (n = n || 0, t.discontinuityStarts && t.discontinuityStarts.length) for (var s = null, o = 0; o < t.discontinuityStarts.length; o++) { var u = t.discontinuityStarts[o], l = t.discontinuitySequence + o + 1, d = e.discontinuities[l]; if (d) { var c = Math.abs(n - d.time); if (null !== s && s < c) break; (!a || null === s || s >= c) && (s = c, a = { time: d.time, segmentIndex: u }) } } return a } }, { name: "Playlist", run: function(e, t, i, r, n) { return t.syncInfo ? { time: t.syncInfo.time, segmentIndex: t.syncInfo.mediaSequence - t.mediaSequence } : null } }], Kh = function(e) { function t() { Zd(this, t); var e = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); return e.inspectCache_ = void 0, e.timelines = [], e.discontinuities = [], e.datetimeToDisplayTime = null, e .logger_ = Th("SyncController"), e } return ec(t, e), $d(t, [{ key: "getSyncPoint", value: function(e, t, i, r) { var n = this.runStrategies_(e, t, i, r); return n.length ? this.selectSyncPoint_(n, { key: "time", value: r }) : null } }, { key: "getExpiredTime", value: function(e, t) { if (!e || !e.segments) return null; var i = this.runStrategies_(e, t, e.discontinuitySequence, 0); if (!i.length) return null; var r = this.selectSyncPoint_(i, { key: "segmentIndex", value: 0 }); return r.segmentIndex > 0 && (r.time *= -1), Math.abs(r.time + mc(e, r.segmentIndex, 0)) } }, { key: "runStrategies_", value: function(e, t, i, r) { for (var n = [], a = 0; a < zh.length; a++) { var s = zh[a], o = s.run(this, e, t, i, r); o && (o.strategy = s.name, n.push({ strategy: s.name, syncPoint: o })) } return n } }, { key: "selectSyncPoint_", value: function(e, t) { for (var i = e[0].syncPoint, r = Math.abs(e[0].syncPoint[t.key] - t.value), n = e[0].strategy, a = 1; a < e.length; a++) { var s = Math.abs(e[a].syncPoint[t.key] - t.value); s < r && (r = s, i = e[a].syncPoint, n = e[a].strategy) } return this.logger_("syncPoint for [" + t.key + ": " + t.value + "] chosen with strategy [" + n + "]: [time:" + i.time + ", segmentIndex:" + i.segmentIndex + "]"), i } }, { key: "saveExpiredSegmentInfo", value: function(e, t) { for (var i = t.mediaSequence - e.mediaSequence - 1; i >= 0; i--) { var r = e.segments[i]; if (r && void 0 !== r.start) { t.syncInfo = { mediaSequence: e.mediaSequence + i, time: r.start }, this.logger_("playlist refresh sync: [time:" + t.syncInfo.time + ", mediaSequence: " + t .syncInfo.mediaSequence + "]"), this.trigger("syncinfoupdate"); break } } } }, { key: "setDateTimeMapping", value: function(e) { if (!this.datetimeToDisplayTime && e.segments && e.segments.length && e.segments[0] .dateTimeObject) { var t = e.segments[0].dateTimeObject.getTime() / 1e3; this.datetimeToDisplayTime = -t } } }, { key: "reset", value: function() { this.inspectCache_ = void 0 } }, { key: "probeSegmentInfo", value: function(e) { var t = e.segment, i = e.playlist, r = void 0; return (r = t.map ? this.probeMp4Segment_(e) : this.probeTsSegment_(e)) && this .calculateSegmentTimeMapping_(e, r) && (this.saveDiscontinuitySyncInfo_(e), i.syncInfo || (i .syncInfo = { mediaSequence: i.mediaSequence + e.mediaIndex, time: t.start })), r } }, { key: "probeMp4Segment_", value: function(e) { var t = e.segment, i = fo.timescale(t.map.bytes), r = fo.startTime(i, e.bytes); return null !== e.timestampOffset && (e.timestampOffset -= r), { start: r, end: r + t.duration } } }, { key: "probeTsSegment_", value: function(e) { var t = Xh(e.bytes, this.inspectCache_), i = void 0, r = void 0; return t ? (t.video && 2 === t.video.length ? (this.inspectCache_ = t.video[1].dts, i = t.video[0] .dtsTime, r = t.video[1].dtsTime) : t.audio && 2 === t.audio.length && (this.inspectCache_ = t .audio[1].dts, i = t.audio[0].dtsTime, r = t.audio[1].dtsTime), { start: i, end: r, containsVideo: t.video && 2 === t.video.length, containsAudio: t.audio && 2 === t.audio.length }) : null } }, { key: "timestampOffsetForTimeline", value: function(e) { return void 0 === this.timelines[e] ? null : this.timelines[e].time } }, { key: "mappingForTimeline", value: function(e) { return void 0 === this.timelines[e] ? null : this.timelines[e].mapping } }, { key: "calculateSegmentTimeMapping_", value: function(e, t) { var i = e.segment, r = this.timelines[e.timeline]; if (null !== e.timestampOffset) r = { time: e.startOfSegment, mapping: e.startOfSegment - t.start }, this.timelines[e.timeline] = r, this.trigger("timestampoffset"), this.logger_( "time mapping for timeline " + e.timeline + ": [time: " + r.time + "] [mapping: " + r.mapping + "]"), i.start = e.startOfSegment, i.end = t.end + r.mapping; else { if (!r) return !1; i.start = t.start + r.mapping, i.end = t.end + r.mapping } return !0 } }, { key: "saveDiscontinuitySyncInfo_", value: function(e) { var t = e.playlist, i = e.segment; if (i.discontinuity) this.discontinuities[i.timeline] = { time: i.start, accuracy: 0 }; else if (t.discontinuityStarts && t.discontinuityStarts.length) for (var r = 0; r < t.discontinuityStarts.length; r++) { var n = t.discontinuityStarts[r], a = t.discontinuitySequence + r + 1, s = n - e.mediaIndex, o = Math.abs(s); if (!this.discontinuities[a] || this.discontinuities[a].accuracy > o) { var u = void 0; u = s < 0 ? i.start - mc(t, e.mediaIndex, n) : i.end + mc(t, e.mediaIndex + 1, n), this .discontinuities[a] = { time: u, accuracy: o } } } } }]), t }(Ta.EventTarget), Yh = new Zc("./decrypter-worker.worker.js", function(e, t) { var i = this; ! function() { var e = function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, t = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), r = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t }, n = function() { var e = [ [ [], [], [], [], [] ], [ [], [], [], [], [] ] ], t = e[0], i = e[1], r = t[4], n = i[4], a = void 0, s = void 0, o = void 0, u = [], l = [], d = void 0, c = void 0, h = void 0, f = void 0, p = void 0; for (a = 0; a < 256; a++) l[(u[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a; for (s = o = 0; !r[s]; s ^= d || 1, o = l[o] || 1) for (h = (h = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4) >> 8 ^ 255 & h ^ 99, r[s] = h, n[h] = s, p = 16843009 * u[c = u[d = u[s]]] ^ 65537 * c ^ 257 * d ^ 16843008 * s, f = 257 * u[h] ^ 16843008 * h, a = 0; a < 4; a++) t[a][s] = f = f << 24 ^ f >>> 8, i[a][h] = p = p << 24 ^ p >>> 8; for (a = 0; a < 5; a++) t[a] = t[a].slice(0), i[a] = i[a].slice(0); return e }, a = null, s = function() { function t(i) { e(this, t), a || (a = n()), this._tables = [ [a[0][0].slice(), a[0][1].slice(), a[0][2].slice(), a[0][3].slice(), a[0][4].slice()], [a[1][0].slice(), a[1][1].slice(), a[1][2].slice(), a[1][3].slice(), a[1][4].slice()] ]; var r = void 0, s = void 0, o = void 0, u = void 0, l = void 0, d = this._tables[0][4], c = this._tables[1], h = i.length, f = 1; if (4 !== h && 6 !== h && 8 !== h) throw new Error("Invalid aes key size"); for (u = i.slice(0), l = [], this._key = [u, l], r = h; r < 4 * h + 28; r++) o = u[r - 1], (r % h == 0 || 8 === h && r % h == 4) && (o = d[o >>> 24] << 24 ^ d[o >> 16 & 255] << 16 ^ d[o >> 8 & 255] << 8 ^ d[255 & o], r % h == 0 && (o = o << 8 ^ o >>> 24 ^ f << 24, f = f << 1 ^ 283 * (f >> 7))), u[r] = u[r - h] ^ o; for (s = 0; r; s++, r--) o = u[3 & s ? r : r - 4], l[s] = r <= 4 || s < 4 ? o : c[0][d[o >>> 24]] ^ c[ 1][d[o >> 16 & 255]] ^ c[2][d[o >> 8 & 255]] ^ c[3][d[255 & o]] } return t.prototype.decrypt = function(e, t, i, r, n, a) { var s = this._key[1], o = e ^ s[0], u = r ^ s[1], l = i ^ s[2], d = t ^ s[3], c = void 0, h = void 0, f = void 0, p = s.length / 4 - 2, m = void 0, g = 4, v = this._tables[1], y = v[0], _ = v[1], b = v[2], w = v[3], E = v[4]; for (m = 0; m < p; m++) c = y[o >>> 24] ^ _[u >> 16 & 255] ^ b[l >> 8 & 255] ^ w[255 & d] ^ s[g], h = y[u >>> 24] ^ _[l >> 16 & 255] ^ b[d >> 8 & 255] ^ w[255 & o] ^ s[g + 1], f = y[l >>> 24] ^ _[ d >> 16 & 255] ^ b[o >> 8 & 255] ^ w[255 & u] ^ s[g + 2], d = y[d >>> 24] ^ _[o >> 16 & 255] ^ b[u >> 8 & 255] ^ w[255 & l] ^ s[g + 3], g += 4, o = c, u = h, l = f; for (m = 0; m < 4; m++) n[(3 & -m) + a] = E[o >>> 24] << 24 ^ E[u >> 16 & 255] << 16 ^ E[l >> 8 & 255] << 8 ^ E[255 & d] ^ s[g++], c = o, o = u, u = l, l = d, d = c }, t }(), o = function() { function t() { e(this, t), this.listeners = {} } return t.prototype.on = function(e, t) { this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t) }, t.prototype.off = function(e, t) { if (!this.listeners[e]) return !1; var i = this.listeners[e].indexOf(t); return this.listeners[e].splice(i, 1), i > -1 }, t.prototype.trigger = function(e) { var t = this.listeners[e]; if (t) if (2 === arguments.length) for (var i = t.length, r = 0; r < i; ++r) t[r].call(this, arguments[1]); else for (var n = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s] .apply(this, n) }, t.prototype.dispose = function() { this.listeners = {} }, t.prototype.pipe = function(e) { this.on("data", function(t) { e.push(t) }) }, t }(), u = function(t) { function i() { e(this, i); var n = r(this, t.call(this, o)); return n.jobs = [], n.delay = 1, n.timeout_ = null, n } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v( t))); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(i, t), i.prototype.processJob_ = function() { this.jobs.shift()(), this.jobs.length ? this.timeout_ = setTimeout(this.processJob_.bind(this), this .delay) : this.timeout_ = null }, i.prototype.push = function(e) { this.jobs.push(e), this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind(this), this .delay)) }, i }(o), l = function(e) { return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24 }, d = function() { function i(t, r, n, a) { e(this, i); var s = i.STEP, o = new Int32Array(t.buffer), d = new Uint8Array(t.byteLength), c = 0; for (this.asyncStream_ = new u, this.asyncStream_.push(this.decryptChunk_(o.subarray(c, c + s), r, n, d)), c = s; c < o.length; c += s) n = new Uint32Array([l(o[c - 4]), l(o[c - 3]), l(o[c - 2]), l(o[ c - 1])]), this.asyncStream_.push(this.decryptChunk_(o.subarray(c, c + s), r, n, d)); this.asyncStream_.push(function() { var e; a(null, (e = d).subarray(0, e.byteLength - e[e.byteLength - 1])) }) } return i.prototype.decryptChunk_ = function(e, t, i, r) { return function() { var n = function(e, t, i) { var r = new Int32Array(e.buffer, e.byteOffset, e.byteLength >> 2), n = new s(Array.prototype.slice.call(t)), a = new Uint8Array(e.byteLength), o = new Int32Array(a.buffer), u = void 0, d = void 0, c = void 0, h = void 0, f = void 0, p = void 0, m = void 0, g = void 0, v = void 0; for (u = i[0], d = i[1], c = i[2], h = i[3], v = 0; v < r.length; v += 4) f = l(r[v]), p = l(r[v + 1]), m = l(r[v + 2]), g = l(r[v + 3]), n.decrypt(f, p, m, g, o, v), o[v] = l(o[ v] ^ u), o[v + 1] = l(o[v + 1] ^ d), o[v + 2] = l(o[v + 2] ^ c), o[v + 3] = l(o[v + 3] ^ h), u = f, d = p, c = m, h = g; return a }(e, t, i); r.set(n, e.byteOffset) } }, t(i, null, [{ key: "STEP", get: function() { return 32e3 } }]), i }(); new function(e) { e.onmessage = function(t) { var i = t.data, r = new Uint8Array(i.encrypted.bytes, i.encrypted.byteOffset, i.encrypted.byteLength), n = new Uint32Array(i.key.bytes, i.key.byteOffset, i.key.byteLength / 4), a = new Uint32Array(i.iv.bytes, i.iv.byteOffset, i.iv.byteLength / 4); new d(r, n, a, function(t, r) { var n, a; e.postMessage((n = { source: i.source, decrypted: r }, a = {}, Object.keys(n).forEach(function(e) { var t = n[e]; ArrayBuffer.isView(t) ? a[e] = { bytes: t.buffer, byteOffset: t.byteOffset, byteLength: t.byteLength } : a[e] = t }), a), [r.buffer]) }) } }(i) }() }), Qh = function(e) { var t = e.default ? "main" : "alternative"; return e.characteristics && e.characteristics.indexOf("public.accessibility.describes-video") >= 0 && (t = "main-desc"), t }, Jh = function(e, t) { e.abort(), e.pause(), t && t.activePlaylistLoader && (t.activePlaylistLoader.pause(), t.activePlaylistLoader = null) }, Zh = function(e, t) { t.activePlaylistLoader = e, e.load() }, $h = { AUDIO: function(e, t) { return function() { var i = t.segmentLoaders[e], r = t.mediaTypes[e], n = t.blacklistCurrentPlaylist; Jh(i, r); var a = r.activeTrack(), s = r.activeGroup(), o = (s.filter(function(e) { return e.default })[0] || s[0]).id, u = r.tracks[o]; if (a !== u) { for (var l in Ta.log.warn( "Problem encountered loading the alternate audio track.Switching back to default."), r.tracks) r .tracks[l].enabled = r.tracks[l] === u; r.onTrackChanged() } else n({ message: "Problem encountered loading the default audio track." }) } }, SUBTITLES: function(e, t) { return function() { var i = t.segmentLoaders[e], r = t.mediaTypes[e]; Ta.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."), Jh(i, r); var n = r.activeTrack(); n && (n.mode = "disabled"), r.onTrackChanged() } } }, ef = { AUDIO: function(e, t, i) { if (t) { var r = i.tech, n = i.requestOptions, a = i.segmentLoaders[e]; t.on("loadedmetadata", function() { var e = t.media(); a.playlist(e, n), (!r.paused() || e.endList && "none" !== r.preload()) && a.load() }), t.on("loadedplaylist", function() { a.playlist(t.media(), n), r.paused() || a.load() }), t.on("error", $h[e](e, i)) } }, SUBTITLES: function(e, t, i) { var r = i.tech, n = i.requestOptions, a = i.segmentLoaders[e], s = i.mediaTypes[e]; t.on("loadedmetadata", function() { var e = t.media(); a.playlist(e, n), a.track(s.activeTrack()), (!r.paused() || e.endList && "none" !== r.preload()) && a .load() }), t.on("loadedplaylist", function() { a.playlist(t.media(), n), r.paused() || a.load() }), t.on("error", $h[e](e, i)) } }, tf = function(e, t) { return function(i) { return i.attributes[e] === t } }, rf = function(e) { return function(t) { return t.resolvedUri === e } }, nf = { AUDIO: function(e, t) { var i = t.hls, r = t.sourceType, n = t.segmentLoaders[e], a = t.requestOptions.withCredentials, s = t.master, o = s.mediaGroups, u = s.playlists, l = t.mediaTypes[e], d = l.groups, c = l.tracks, h = t.masterPlaylistLoader; for (var f in o[e] && 0 !== Object.keys(o[e]).length || (o[e] = { main: { default: { default: !0 } } }), o[e]) { d[f] || (d[f] = []); var p = u.filter(tf(e, f)); for (var m in o[e][f]) { var g = o[e][f][m]; p.filter(rf(g.resolvedUri)).length && delete g.resolvedUri; var v = void 0; if (v = g.resolvedUri ? new cc(g.resolvedUri, i, a) : g.playlists && "dash" === r ? new Eh(g.playlists[ 0], i, a, h) : null, g = Ta.mergeOptions({ id: m, playlistLoader: v }, g), ef[e](e, g.playlistLoader, t), d[f].push(g), void 0 === c[m]) { var y = new Ta.AudioTrack({ id: m, kind: Qh(g), enabled: !1, language: g.language, default: g.default, label: m }); c[m] = y } } } n.on("error", $h[e](e, t)) }, SUBTITLES: function(e, t) { var i = t.tech, r = t.hls, n = t.sourceType, a = t.segmentLoaders[e], s = t.requestOptions.withCredentials, o = t.master.mediaGroups, u = t.mediaTypes[e], l = u.groups, d = u.tracks, c = t.masterPlaylistLoader; for (var h in o[e]) for (var f in l[h] || (l[h] = []), o[e][h]) if (!o[e][h][f].forced) { var p = o[e][h][f], m = void 0; if ("hls" === n ? m = new cc(p.resolvedUri, r, s) : "dash" === n && (m = new Eh(p.playlists[0], r, s, c)), p = Ta.mergeOptions({ id: f, playlistLoader: m }, p), ef[e](e, p.playlistLoader, t), l[h].push(p), void 0 === d[f]) { var g = i.addRemoteTextTrack({ id: f, kind: "subtitles", enabled: !1, language: p.language, label: f }, !1).track; d[f] = g } } a.on("error", $h[e](e, t)) }, "CLOSED-CAPTIONS": function(e, t) { var i = t.tech, r = t.master.mediaGroups, n = t.mediaTypes[e], a = n.groups, s = n.tracks; for (var o in r[e]) for (var u in a[o] || (a[o] = []), r[e][o]) { var l = r[e][o][u]; if (l.instreamId.match(/CC\d/) && (a[o].push(Ta.mergeOptions({ id: u }, l)), void 0 === s[u])) { var d = i.addRemoteTextTrack({ id: l.instreamId, kind: "captions", enabled: !1, language: l.language, label: u }, !1).track; s[u] = d } } } }, af = { AUDIO: function(e, t) { return function() { var i = t.mediaTypes[e].tracks; for (var r in i) if (i[r].enabled) return i[r]; return null } }, SUBTITLES: function(e, t) { return function() { var i = t.mediaTypes[e].tracks; for (var r in i) if ("showing" === i[r].mode) return i[r]; return null } } }, sf = function(e) { ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) { nf[t](t, e) }); var t = e.mediaTypes, i = e.masterPlaylistLoader, r = e.tech, n = e.hls; ["AUDIO", "SUBTITLES"].forEach(function(i) { t[i].activeGroup = function(e, t) { return function(i) { var r = t.masterPlaylistLoader, n = t.mediaTypes[e].groups, a = r.media(); if (!a) return null; var s = null; return a.attributes[e] && (s = n[a.attributes[e]]), s = s || n.main, void 0 === i ? s : null === i ? null : s.filter(function(e) { return e.id === i.id })[0] || null } }(i, e), t[i].activeTrack = af[i](i, e), t[i].onGroupChanged = function(e, t) { return function() { var i = t.segmentLoaders, r = i[e], n = i.main, a = t.mediaTypes[e], s = a.activeTrack(), o = a.activeGroup(s), u = a.activePlaylistLoader; Jh(r, a), o && (o.playlistLoader ? (r.resyncLoader(), Zh(o.playlistLoader, a)) : u && n .resetEverything()) } }(i, e), t[i].onTrackChanged = function(e, t) { return function() { var i = t.segmentLoaders, r = i[e], n = i.main, a = t.mediaTypes[e], s = a.activeTrack(), o = a.activeGroup(s), u = a.activePlaylistLoader; Jh(r, a), o && (o.playlistLoader ? u !== o.playlistLoader ? (r.track && r.track(s), r .resetEverything(), Zh(o.playlistLoader, a)) : Zh(o.playlistLoader, a) : n .resetEverything()) } }(i, e) }); var a = t.AUDIO.activeGroup(), s = (a.filter(function(e) { return e.default })[0] || a[0]).id; t.AUDIO.tracks[s].enabled = !0, t.AUDIO.onTrackChanged(), i.on("mediachange", function() { ["AUDIO", "SUBTITLES"].forEach(function(e) { return t[e].onGroupChanged() }) }); var o = function() { t.AUDIO.onTrackChanged(), r.trigger({ type: "usage", name: "hls-audio-change" }) }; for (var u in r.audioTracks().addEventListener("change", o), r.remoteTextTracks().addEventListener("change", t .SUBTITLES.onTrackChanged), n.on("dispose", function() { r.audioTracks().removeEventListener("change", o), r.remoteTextTracks().removeEventListener("change", t .SUBTITLES.onTrackChanged) }), r.clearTracks("audio"), t.AUDIO.tracks) r.audioTracks().addTrack(t.AUDIO.tracks[u]) }, of = function() { var e = {}; return ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) { e[t] = { groups: {}, tracks: {}, activePlaylistLoader: null, activeGroup: Sh, activeTrack: Sh, onGroupChanged: Sh, onTrackChanged: Sh } }), e }, uf = void 0, lf = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred" ], df = function(e) { return this.audioSegmentLoader_[e] + this.mainSegmentLoader_[e] }, cf = function(e) { function t(e) { Zd(this, t); var i = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)), r = e.url, n = e.withCredentials, a = e.tech, s = e.bandwidth, o = e.externHls, u = e.useCueTags, l = e.blacklistDuration, d = e.enableLowInitialPlaylist, c = e.sourceType, h = e.seekTo; if (!r) throw new Error("A non-empty playlist URL is required"); uf = o, i.withCredentials = n, i.tech_ = a, i.hls_ = a.hls, i.seekTo_ = h, i.sourceType_ = c, i.useCueTags_ = u, i.blacklistDuration = l, i.enableLowInitialPlaylist = d, i.useCueTags_ && (i.cueTagsTrack_ = i.tech_ .addTextTrack("metadata", "ad-cues"), i.cueTagsTrack_.inBandMetadataTrackDispatchType = ""), i .requestOptions_ = { withCredentials: i.withCredentials, timeout: null }, i.mediaTypes_ = of (), i.mediaSource = new Ta.MediaSource, i.mediaSource.addEventListener("sourceopen", i .handleSourceOpen_.bind(i)), i.seekable_ = Ta.createTimeRanges(), i.hasPlayed_ = function() { return !1 }, i.syncController_ = new Kh(e), i.segmentMetadataTrack_ = a.addRemoteTextTrack({ kind: "metadata", label: "segment-metadata" }, !1).track, i.decrypter_ = new Yh, i.inbandTextTracks_ = {}; var f = { hls: i.hls_, mediaSource: i.mediaSource, currentTime: i.tech_.currentTime.bind(i.tech_), seekable: function() { return i.seekable() }, seeking: function() { return i.tech_.seeking() }, duration: function() { return i.mediaSource.duration }, hasPlayed: function() { return i.hasPlayed_() }, goalBufferLength: function() { return i.goalBufferLength() }, bandwidth: s, syncController: i.syncController_, decrypter: i.decrypter_, sourceType: i.sourceType_, inbandTextTracks: i.inbandTextTracks_ }; return i.masterPlaylistLoader_ = "dash" === i.sourceType_ ? new Eh(r, i.hls_, i.withCredentials) : new cc(r, i .hls_, i.withCredentials), i.setupMasterPlaylistLoaderListeners_(), i.mainSegmentLoader_ = new Hh(Ta .mergeOptions(f, { segmentMetadataTrack: i.segmentMetadataTrack_, loaderType: "main" }), e), i.audioSegmentLoader_ = new Hh(Ta.mergeOptions(f, { loaderType: "audio" }), e), i.subtitleSegmentLoader_ = new Wh(Ta.mergeOptions(f, { loaderType: "vtt" }), e), i.setupSegmentLoaderListeners_(), lf.forEach(function(e) { i[e + "_"] = df.bind(i, e) }), i.logger_ = Th("MPC"), i.masterPlaylistLoader_.load(), i } return ec(t, e), $d(t, [{ key: "setupMasterPlaylistLoaderListeners_", value: function() { var e = this; this.masterPlaylistLoader_.on("loadedmetadata", function() { var t = e.masterPlaylistLoader_.media(), i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3; kc(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? e.requestOptions_ .timeout = 0 : e.requestOptions_.timeout = i, t.endList && "none" !== e.tech_.preload() && ( e.mainSegmentLoader_.playlist(t, e.requestOptions_), e.mainSegmentLoader_.load()), sf({ sourceType: e.sourceType_, segmentLoaders: { AUDIO: e.audioSegmentLoader_, SUBTITLES: e.subtitleSegmentLoader_, main: e.mainSegmentLoader_ }, tech: e.tech_, requestOptions: e.requestOptions_, masterPlaylistLoader: e.masterPlaylistLoader_, hls: e.hls_, master: e.master(), mediaTypes: e.mediaTypes_, blacklistCurrentPlaylist: e.blacklistCurrentPlaylist.bind(e) }), e.triggerPresenceUsage_(e.master(), t); try { e.setupSourceBuffers_() } catch (t) { return Ta.log.warn("Failed to create SourceBuffers", t), e.mediaSource.endOfStream("decode") } e.setupFirstPlay(), e.trigger("selectedinitialmedia") }), this.masterPlaylistLoader_.on("loadedplaylist", function() { var t = e.masterPlaylistLoader_.media(); if (!t) { e.excludeUnsupportedVariants_(); var i = void 0; return e.enableLowInitialPlaylist && (i = e.selectInitialPlaylist()), i || (i = e .selectPlaylist()), e.initialMedia_ = i, void e.masterPlaylistLoader_.media(e .initialMedia_) } if (e.useCueTags_ && e.updateAdCues_(t), e.mainSegmentLoader_.playlist(t, e.requestOptions_), e.updateDuration(), e.tech_.paused() || (e.mainSegmentLoader_.load(), e .audioSegmentLoader_ && e.audioSegmentLoader_.load()), !t.endList) { var r = function() { var t = e.seekable(); 0 !== t.length && e.mediaSource.addSeekableRange_(t.start(0), t.end(0)) }; if (e.duration() !== 1 / 0) { e.tech_.one("durationchange", function t() { e.duration() === 1 / 0 ? r() : e.tech_.one("durationchange", t) }) } else r() } }), this.masterPlaylistLoader_.on("error", function() { e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error) }), this.masterPlaylistLoader_.on("mediachanging", function() { e.mainSegmentLoader_.abort(), e.mainSegmentLoader_.pause() }), this.masterPlaylistLoader_.on("mediachange", function() { var t = e.masterPlaylistLoader_.media(), i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3; kc(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? e.requestOptions_ .timeout = 0 : e.requestOptions_.timeout = i, e.mainSegmentLoader_.playlist(t, e .requestOptions_), e.mainSegmentLoader_.load(), e.tech_.trigger({ type: "mediachange", bubbles: !0 }) }), this.masterPlaylistLoader_.on("playlistunchanged", function() { var t = e.masterPlaylistLoader_.media(); e.stuckAtPlaylistEnd_(t) && (e.blacklistCurrentPlaylist({ message: "Playlist no longer updating." }), e.tech_.trigger("playliststuck")) }), this.masterPlaylistLoader_.on("renditiondisabled", function() { e.tech_.trigger({ type: "usage", name: "hls-rendition-disabled" }) }), this.masterPlaylistLoader_.on("renditionenabled", function() { e.tech_.trigger({ type: "usage", name: "hls-rendition-enabled" }) }) } }, { key: "triggerPresenceUsage_", value: function(e, t) { var i = e.mediaGroups || {}, r = !0, n = Object.keys(i.AUDIO); for (var a in i.AUDIO) for (var s in i.AUDIO[a]) { i.AUDIO[a][s].uri || (r = !1) } r && this.tech_.trigger({ type: "usage", name: "hls-demuxed" }), Object.keys(i.SUBTITLES).length && this.tech_.trigger({ type: "usage", name: "hls-webvtt" }), uf.Playlist.isAes(t) && this.tech_.trigger({ type: "usage", name: "hls-aes" }), uf.Playlist.isFmp4(t) && this.tech_.trigger({ type: "usage", name: "hls-fmp4" }), n.length && Object.keys(i.AUDIO[n[0]]).length > 1 && this.tech_.trigger({ type: "usage", name: "hls-alternate-audio" }), this.useCueTags_ && this.tech_.trigger({ type: "usage", name: "hls-playlist-cue-tags" }) } }, { key: "setupSegmentLoaderListeners_", value: function() { var e = this; this.mainSegmentLoader_.on("bandwidthupdate", function() { var t = e.selectPlaylist(), i = e.masterPlaylistLoader_.media(), r = e.tech_.buffered(), n = r.length ? r.end(r.length - 1) - e.tech_.currentTime() : 0, a = e.bufferLowWaterLine(); (!i.endList || e.duration() < kh.MAX_BUFFER_LOW_WATER_LINE || t.attributes.BANDWIDTH < i .attributes.BANDWIDTH || n >= a) && e.masterPlaylistLoader_.media(t), e.tech_.trigger( "bandwidthupdate") }), this.mainSegmentLoader_.on("progress", function() { e.trigger("progress") }), this.mainSegmentLoader_.on("error", function() { e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error()) }), this.mainSegmentLoader_.on("syncinfoupdate", function() { e.onSyncInfoUpdate_() }), this.mainSegmentLoader_.on("timestampoffset", function() { e.tech_.trigger({ type: "usage", name: "hls-timestamp-offset" }) }), this.audioSegmentLoader_.on("syncinfoupdate", function() { e.onSyncInfoUpdate_() }), this.mainSegmentLoader_.on("ended", function() { e.onEndOfStream() }), this.mainSegmentLoader_.on("earlyabort", function() { e.blacklistCurrentPlaylist({ message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering." }, 120) }), this.mainSegmentLoader_.on("reseteverything", function() { e.tech_.trigger("hls-reset") }), this.mainSegmentLoader_.on("segmenttimemapping", function(t) { e.tech_.trigger({ type: "hls-segment-time-mapping", mapping: t.mapping }) }), this.audioSegmentLoader_.on("ended", function() { e.onEndOfStream() }) } }, { key: "mediaSecondsLoaded_", value: function() { return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_ .mediaSecondsLoaded) } }, { key: "load", value: function() { this.mainSegmentLoader_.load(), this.mediaTypes_.AUDIO.activePlaylistLoader && this .audioSegmentLoader_.load(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this .subtitleSegmentLoader_.load() } }, { key: "smoothQualityChange_", value: function() { var e = this.selectPlaylist(); e !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(e), this .mainSegmentLoader_.resetLoader()) } }, { key: "fastQualityChange_", value: function() { var e = this, t = this.selectPlaylist(); t !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(t), this .mainSegmentLoader_.resetEverything(function() { Ta.browser.IE_VERSION || Ta.browser.IS_EDGE ? e.tech_.setCurrentTime(e.tech_.currentTime() + .04) : e.tech_.setCurrentTime(e.tech_.currentTime()) })) } }, { key: "play", value: function() { if (!this.setupFirstPlay()) { this.tech_.ended() && this.seekTo_(0), this.hasPlayed_() && this.load(); var e = this.tech_.seekable(); return this.tech_.duration() === 1 / 0 && this.tech_.currentTime() < e.start(0) ? this.seekTo_(e .end(e.length - 1)) : void 0 } } }, { key: "setupFirstPlay", value: function() { var e = this, t = this.masterPlaylistLoader_.media(); if (!t || this.tech_.paused() || this.hasPlayed_()) return !1; if (!t.endList) { var i = this.seekable(); if (!i.length) return !1; if (Ta.browser.IE_VERSION && 0 === this.tech_.readyState()) return this.tech_.one( "loadedmetadata", function() { e.trigger("firstplay"), e.seekTo_(i.end(0)), e.hasPlayed_ = function() { return !0 } }), !1; this.trigger("firstplay"), this.seekTo_(i.end(0)) } return this.hasPlayed_ = function() { return !0 }, this.load(), !0 } }, { key: "handleSourceOpen_", value: function() { try { this.setupSourceBuffers_() } catch (e) { return Ta.log.warn("Failed to create Source Buffers", e), this.mediaSource.endOfStream("decode") } if (this.tech_.autoplay()) { var e = this.tech_.play(); void 0 !== e && "function" == typeof e.then && e.then(null, function(e) {}) } this.trigger("sourceopen") } }, { key: "onEndOfStream", value: function() { var e = this.mainSegmentLoader_.ended_; this.mediaTypes_.AUDIO.activePlaylistLoader && (e = !this.mainSegmentLoader_.startingMedia_ || this .mainSegmentLoader_.startingMedia_.containsVideo ? e && this.audioSegmentLoader_.ended_ : this .audioSegmentLoader_.ended_), e && this.mediaSource.endOfStream() } }, { key: "stuckAtPlaylistEnd_", value: function(e) { if (!this.seekable().length) return !1; var t = this.syncController_.getExpiredTime(e, this.mediaSource.duration); if (null === t) return !1; var i = uf.Playlist.playlistEnd(e, t), r = this.tech_.currentTime(), n = this.tech_.buffered(); if (!n.length) return i - r <= .1; var a = n.end(n.length - 1); return a - r <= .1 && i - a <= .1 } }, { key: "blacklistCurrentPlaylist", value: function() { var e, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, i = arguments[1], r = void 0; if (r = t.playlist || this.masterPlaylistLoader_.media(), i = i || t.blacklistDuration || this .blacklistDuration, !r) { this.error = t; try { return this.mediaSource.endOfStream("network") } catch (e) { return this.trigger("error") } } var n = 1 === this.masterPlaylistLoader_.master.playlists.filter(Sc).length; return n ? (Ta.log.warn( "Problem encountered with the current HLS playlist. Trying again since it is the final playlist." ), this.tech_.trigger("retryplaylist"), this.masterPlaylistLoader_.load(n)) : (r.excludeUntil = Date.now() + 1e3 * i, this.tech_.trigger("blacklistplaylist"), this.tech_.trigger({ type: "usage", name: "hls-rendition-blacklisted" }), e = this.selectPlaylist(), Ta.log.warn( "Problem encountered with the current HLS playlist." + (t.message ? " " + t.message : "") + " Switching to another playlist."), this.masterPlaylistLoader_.media(e)) } }, { key: "pauseLoading", value: function() { this.mainSegmentLoader_.pause(), this.mediaTypes_.AUDIO.activePlaylistLoader && this .audioSegmentLoader_.pause(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this .subtitleSegmentLoader_.pause() } }, { key: "setCurrentTime", value: function(e) { var t = Fc(this.tech_.buffered(), e); return this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media() && this .masterPlaylistLoader_.media().segments ? t && t.length ? e : (this.mainSegmentLoader_ .resetEverything(), this.mainSegmentLoader_.abort(), this.mediaTypes_.AUDIO .activePlaylistLoader && (this.audioSegmentLoader_.resetEverything(), this.audioSegmentLoader_ .abort()), this.mediaTypes_.SUBTITLES.activePlaylistLoader && (this.subtitleSegmentLoader_ .resetEverything(), this.subtitleSegmentLoader_.abort()), void this.load()) : 0 } }, { key: "duration", value: function() { return this.masterPlaylistLoader_ ? this.mediaSource ? this.mediaSource.duration : uf.Playlist .duration(this.masterPlaylistLoader_.media()) : 0 } }, { key: "seekable", value: function() { return this.seekable_ } }, { key: "onSyncInfoUpdate_", value: function() { var e = void 0, t = void 0; if (this.masterPlaylistLoader_) { var i = this.masterPlaylistLoader_.media(); if (i) { var r = this.syncController_.getExpiredTime(i, this.mediaSource.duration); if (null !== r && 0 !== (e = uf.Playlist.seekable(i, r)).length) { if (this.mediaTypes_.AUDIO.activePlaylistLoader) { if (i = this.mediaTypes_.AUDIO.activePlaylistLoader.media(), null === (r = this .syncController_.getExpiredTime(i, this.mediaSource.duration))) return; if (0 === (t = uf.Playlist.seekable(i, r)).length) return } t ? t.start(0) > e.end(0) || e.start(0) > t.end(0) ? this.seekable_ = e : this.seekable_ = Ta .createTimeRanges([ [t.start(0) > e.start(0) ? t.start(0) : e.start(0), t.end(0) < e.end(0) ? t.end(0) : e .end(0) ] ]) : this.seekable_ = e, this.logger_("seekable updated [" + Hc(this.seekable_) + "]"), this .tech_.trigger("seekablechanged") } } } } }, { key: "updateDuration", value: function() { var e = this, t = this.mediaSource.duration, i = uf.Playlist.duration(this.masterPlaylistLoader_.media()), r = this.tech_.buffered(), n = function t() { e.mediaSource.duration = i, e.tech_.trigger("durationchange"), e.mediaSource .removeEventListener("sourceopen", t) }; r.length > 0 && (i = Math.max(i, r.end(r.length - 1))), t !== i && ("open" !== this.mediaSource .readyState ? this.mediaSource.addEventListener("sourceopen", n) : n()) } }, { key: "dispose", value: function() { var e = this; this.decrypter_.terminate(), this.masterPlaylistLoader_.dispose(), this.mainSegmentLoader_ .dispose(), ["AUDIO", "SUBTITLES"].forEach(function(t) { var i = e.mediaTypes_[t].groups; for (var r in i) i[r].forEach(function(e) { e.playlistLoader && e.playlistLoader.dispose() }) }), this.audioSegmentLoader_.dispose(), this.subtitleSegmentLoader_.dispose() } }, { key: "master", value: function() { return this.masterPlaylistLoader_.master } }, { key: "media", value: function() { return this.masterPlaylistLoader_.media() || this.initialMedia_ } }, { key: "setupSourceBuffers_", value: function() { var e, t = this.masterPlaylistLoader_.media(); if (t && "open" === this.mediaSource.readyState) { if ((e = uh(this.masterPlaylistLoader_.master, t)).length < 1) return this.error = "No compatible SourceBuffer configuration for the variant stream:" + t.resolvedUri, this .mediaSource.endOfStream("decode"); this.configureLoaderMimeTypes_(e), this.excludeIncompatibleVariants_(t) } } }, { key: "configureLoaderMimeTypes_", value: function(e) { var t = e.length > 1 && -1 === e[0].indexOf(",") && e[0] !== e[1] ? new Ta.EventTarget : null; this.mainSegmentLoader_.mimeType(e[0], t), e[1] && this.audioSegmentLoader_.mimeType(e[1], t) } }, { key: "excludeUnsupportedVariants_", value: function() { this.master().playlists.forEach(function(e) { var t; e.attributes.CODECS && n.MediaSource && n.MediaSource.isTypeSupported && !n.MediaSource .isTypeSupported('video/mp4; codecs="' + (t = e.attributes.CODECS, t.replace( /avc1\.(\d+)\.(\d+)/i, function(e) { return ah([e])[0] })) + '"') && (e.excludeUntil = 1 / 0) }) } }, { key: "excludeIncompatibleVariants_", value: function(e) { var t = 2, i = null, r = void 0; e.attributes.CODECS && (r = sh(e.attributes.CODECS), i = r.videoCodec, t = r.codecCount), this .master().playlists.forEach(function(e) { var r = { codecCount: 2, videoCodec: null }; e.attributes.CODECS && (r = sh(e.attributes.CODECS)), r.codecCount !== t && (e.excludeUntil = 1 / 0), r.videoCodec !== i && (e.excludeUntil = 1 / 0) }) } }, { key: "updateAdCues_", value: function(e) { var t = 0, i = this.seekable(); i.length && (t = i.start(0)), function(e, t) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0; if (e.segments) for (var r = i, a = void 0, s = 0; s < e.segments.length; s++) { var o = e.segments[s]; if (a || (a = qh(t, r + o.duration / 2)), a) { if ("cueIn" in o) { a.endTime = r, a.adEndTime = r, r += o.duration, a = null; continue } if (r < a.endTime) { r += o.duration; continue } a.endTime += o.duration } else if ("cueOut" in o && ((a = new n.VTTCue(r, r + o.duration, o.cueOut)).adStartTime = r, a.adEndTime = r + parseFloat(o.cueOut), t.addCue(a)), "cueOutCont" in o) { var u, l, d = o.cueOutCont.split("/").map(parseFloat), c = ic(d, 2); u = c[0], l = c[1], (a = new n.VTTCue(r, r + o.duration, "")).adStartTime = r - u, a .adEndTime = a.adStartTime + l, t.addCue(a) } r += o.duration } }(e, this.cueTagsTrack_, t) } }, { key: "goalBufferLength", value: function() { var e = this.tech_.currentTime(), t = kh.GOAL_BUFFER_LENGTH, i = kh.GOAL_BUFFER_LENGTH_RATE, r = Math.max(t, kh.MAX_GOAL_BUFFER_LENGTH); return Math.min(t + e * i, r) } }, { key: "bufferLowWaterLine", value: function() { var e = this.tech_.currentTime(), t = kh.BUFFER_LOW_WATER_LINE, i = kh.BUFFER_LOW_WATER_LINE_RATE, r = Math.max(t, kh.MAX_BUFFER_LOW_WATER_LINE); return Math.min(t + e * i, r) } }]), t }(Ta.EventTarget), hf = function e(t, i, r) { Zd(this, e); var n, a, s, o = t.masterPlaylistController_.fastQualityChange_.bind(t.masterPlaylistController_); if (i.attributes.RESOLUTION) { var u = i.attributes.RESOLUTION; this.width = u.width, this.height = u.height } this.bandwidth = i.attributes.BANDWIDTH, this.id = r, this.enabled = (n = t.playlists, a = i.uri, s = o, function(e) { var t = n.master.playlists[a], i = Tc(t), r = Sc(t); return void 0 === e ? r : (e ? delete t.disabled : t.disabled = !0, e === r || i || (s(), e ? n.trigger( "renditionenabled") : n.trigger("renditiondisabled")), e) }) }, ff = ["seeking", "seeked", "pause", "playing", "error"], pf = function() { function e(t) { var i = this; Zd(this, e), this.tech_ = t.tech, this.seekable = t.seekable, this.seekTo = t.seekTo, this .consecutiveUpdates = 0, this.lastRecordedTime = null, this.timer_ = null, this.checkCurrentTimeTimeout_ = null, this.logger_ = Th("PlaybackWatcher"), this.logger_("initialize"); var r = function() { return i.monitorCurrentTime_() }, a = function() { return i.techWaiting_() }, s = function() { return i.cancelTimer_() }, o = function() { return i.fixesBadSeeks_() }; this.tech_.on("seekablechanged", o), this.tech_.on("waiting", a), this.tech_.on(ff, s), this.tech_.on( "canplay", r), this.dispose = function() { i.logger_("dispose"), i.tech_.off("seekablechanged", o), i.tech_.off("waiting", a), i.tech_.off(ff, s), i .tech_.off("canplay", r), i.checkCurrentTimeTimeout_ && n.clearTimeout(i.checkCurrentTimeTimeout_), i .cancelTimer_() } } return $d(e, [{ key: "monitorCurrentTime_", value: function() { this.checkCurrentTime_(), this.checkCurrentTimeTimeout_ && n.clearTimeout(this .checkCurrentTimeTimeout_), this.checkCurrentTimeTimeout_ = n.setTimeout(this .monitorCurrentTime_.bind(this), 250) } }, { key: "checkCurrentTime_", value: function() { if (this.tech_.seeking() && this.fixesBadSeeks_()) return this.consecutiveUpdates = 0, void(this .lastRecordedTime = this.tech_.currentTime()); if (!this.tech_.paused() && !this.tech_.seeking()) { var e = this.tech_.currentTime(), t = this.tech_.buffered(); if (this.lastRecordedTime === e && (!t.length || e + .1 >= t.end(t.length - 1))) return this .techWaiting_(); this.consecutiveUpdates >= 5 && e === this.lastRecordedTime ? (this.consecutiveUpdates++, this .waiting_()) : e === this.lastRecordedTime ? this.consecutiveUpdates++ : (this .consecutiveUpdates = 0, this.lastRecordedTime = e) } } }, { key: "cancelTimer_", value: function() { this.consecutiveUpdates = 0, this.timer_ && (this.logger_("cancelTimer_"), clearTimeout(this .timer_)), this.timer_ = null } }, { key: "fixesBadSeeks_", value: function() { var e = this.tech_.seeking(), t = this.seekable(), i = this.tech_.currentTime(), r = void 0; e && this.afterSeekableWindow_(t, i) && (r = t.end(t.length - 1)); e && this.beforeSeekableWindow_(t, i) && (r = t.start(0) + .1); return void 0 !== r && (this.logger_("Trying to seek outside of seekable at time " + i + " with seekable range " + Hc(t) + ". Seeking to " + r + "."), this.seekTo(r), !0) } }, { key: "waiting_", value: function() { if (!this.techWaiting_()) { var e = this.tech_.currentTime(), t = this.tech_.buffered(), i = Fc(t, e); return i.length && e + 3 <= i.end(0) ? (this.cancelTimer_(), this.seekTo(e), this.logger_( "Stopped at " + e + " while inside a buffered region [" + i.start(0) + " -> " + i.end(0) + "]. Attempting to resume playback by seeking to the current time."), void this.tech_ .trigger({ type: "usage", name: "hls-unknown-waiting" })) : void 0 } } }, { key: "techWaiting_", value: function() { var e = this.seekable(), t = this.tech_.currentTime(); if (this.tech_.seeking() && this.fixesBadSeeks_()) return !0; if (this.tech_.seeking() || null !== this.timer_) return !0; if (this.beforeSeekableWindow_(e, t)) { var i = e.end(e.length - 1); return this.logger_("Fell out of live window at time " + t + ". Seeking to live point (seekable end) " + i), this.cancelTimer_(), this.seekTo(i), this .tech_.trigger({ type: "usage", name: "hls-live-resync" }), !0 } var r = this.tech_.buffered(), n = jc(r, t); if (this.videoUnderflow_(n, r, t)) return this.cancelTimer_(), this.seekTo(t), this.tech_.trigger({ type: "usage", name: "hls-video-underflow" }), !0; if (n.length > 0) { var a = n.start(0) - t; return this.logger_("Stopped at " + t + ", setting timer for " + a + ", seeking to " + n.start( 0)), this.timer_ = setTimeout(this.skipTheGap_.bind(this), 1e3 * a, t), !0 } return !1 } }, { key: "afterSeekableWindow_", value: function(e, t) { return !!e.length && t > e.end(e.length - 1) + .1 } }, { key: "beforeSeekableWindow_", value: function(e, t) { return !!(e.length && e.start(0) > 0 && t < e.start(0) - .1) } }, { key: "videoUnderflow_", value: function(e, t, i) { if (0 === e.length) { var r = this.gapFromVideoUnderflow_(t, i); if (r) return this.logger_("Encountered a gap in video from " + r.start + " to " + r.end + ". Seeking to current time " + i), !0 } return !1 } }, { key: "skipTheGap_", value: function(e) { var t = this.tech_.buffered(), i = this.tech_.currentTime(), r = jc(t, i); this.cancelTimer_(), 0 !== r.length && i === e && (this.logger_("skipTheGap_:", "currentTime:", i, "scheduled currentTime:", e, "nextRange start:", r.start(0)), this.seekTo(r.start(0) + 1 / 30), this.tech_.trigger({ type: "usage", name: "hls-gap-skip" })) } }, { key: "gapFromVideoUnderflow_", value: function(e, t) { for (var i = function(e) { if (e.length < 2) return Ta.createTimeRanges(); for (var t = [], i = 1; i < e.length; i++) { var r = e.end(i - 1), n = e.start(i); t.push([r, n]) } return Ta.createTimeRanges(t) }(e), r = 0; r < i.length; r++) { var n = i.start(r), a = i.end(r); if (t - n < 4 && t - n > 2) return { start: n, end: a } } return null } }]), e }(), mf = { errorInterval: 30, getSource: function(e) { return e(this.tech({ IWillNotUseThisInPlugins: !0 }).currentSource_) } }, gf = function(e) { ! function e(t, i) { var r = 0, n = 0, a = Ta.mergeOptions(mf, i); t.ready(function() { t.trigger({ type: "usage", name: "hls-error-reload-initialized" }) }); var s = function() { n && t.currentTime(n) }, o = function(e) { null !== e && void 0 !== e && (n = t.duration() !== 1 / 0 && t.currentTime() || 0, t.one("loadedmetadata", s), t.src(e), t.trigger({ type: "usage", name: "hls-error-reload" }), t.play()) }, u = function() { if (Date.now() - r < 1e3 * a.errorInterval) t.trigger({ type: "usage", name: "hls-error-reload-canceled" }); else { if (a.getSource && "function" == typeof a.getSource) return r = Date.now(), a.getSource.call(t, o); Ta.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!") } }, l = function e() { t.off("loadedmetadata", s), t.off("error", u), t.off("dispose", e) }; t.on("error", u), t.on("dispose", l), t.reloadSourceOnError = function(i) { l(), e(t, i) } }(this, e) }; Ta.use("*", function(e) { return { setSource: function(e, t) { t(null, e) }, setCurrentTime: function(t) { return e.vhs && e.currentSource().src === e.vhs.source_.src && e.vhs.setCurrentTime(t), t }, play: function() { e.vhs && e.currentSource().src === e.vhs.source_.src && e.vhs.setCurrentTime(e.currentTime()) } } }); var vf = { PlaylistLoader: cc, Playlist: Rc, Decrypter: Qd, AsyncStream: zd, decrypt: Yd, utils: Nc, STANDARD_PLAYLIST_SELECTOR: function() { return function(e, t, i, r) { var a = e.playlists.map(function(e) { var t, i; return t = e.attributes.RESOLUTION && e.attributes.RESOLUTION.width, i = e.attributes .RESOLUTION && e.attributes.RESOLUTION.height, { bandwidth: e.attributes.BANDWIDTH || n.Number.MAX_VALUE, width: t, height: i, playlist: e } }); Nh(a, function(e, t) { return e.bandwidth - t.bandwidth }); var s = (a = a.filter(function(e) { return !Rc.isIncompatible(e.playlist) })).filter(function(e) { return Rc.isEnabled(e.playlist) }); s.length || (s = a.filter(function(e) { return !Rc.isDisabled(e.playlist) })); var o = s.filter(function(e) { return e.bandwidth * kh.BANDWIDTH_VARIANCE < t }), u = o[o.length - 1], l = o.filter(function(e) { return e.bandwidth === u.bandwidth })[0], d = o.filter(function(e) { return e.width && e.height }); Nh(d, function(e, t) { return e.width - t.width }); var c = d.filter(function(e) { return e.width === i && e.height === r }); u = c[c.length - 1]; var h = c.filter(function(e) { return e.bandwidth === u.bandwidth })[0], f = void 0, p = void 0, m = void 0; h || (p = (f = d.filter(function(e) { return e.width > i || e.height > r })).filter(function(e) { return e.width === f[0].width && e.height === f[0].height }), u = p[p.length - 1], m = p.filter(function(e) { return e.bandwidth === u.bandwidth })[0]); var g = m || h || l || s[0] || a[0]; return g ? g.playlist : null }(this.playlists.master, this.systemBandwidth, parseInt(Uh(this.tech_.el(), "width"), 10), parseInt(Uh( this.tech_.el(), "height"), 10)) }, INITIAL_PLAYLIST_SELECTOR: function() { var e = this.playlists.master.playlists.filter(Rc.isEnabled); return Nh(e, function(e, t) { return Bh(e, t) }), e.filter(function(e) { return sh(e.attributes.CODECS).videoCodec })[0] || null }, comparePlaylistBandwidth: Bh, comparePlaylistResolution: function(e, t) { var i = void 0, r = void 0; return e.attributes.RESOLUTION && e.attributes.RESOLUTION.width && (i = e.attributes.RESOLUTION.width), i = i || n.Number.MAX_VALUE, t.attributes.RESOLUTION && t.attributes.RESOLUTION.width && (r = t.attributes .RESOLUTION.width), i === (r = r || n.Number.MAX_VALUE) && e.attributes.BANDWIDTH && t.attributes .BANDWIDTH ? e.attributes.BANDWIDTH - t.attributes.BANDWIDTH : i - r }, xhr: Cc() }; ["GOAL_BUFFER_LENGTH", "MAX_GOAL_BUFFER_LENGTH", "GOAL_BUFFER_LENGTH_RATE", "BUFFER_LOW_WATER_LINE", "MAX_BUFFER_LOW_WATER_LINE", "BUFFER_LOW_WATER_LINE_RATE", "BANDWIDTH_VARIANCE" ].forEach(function(e) { Object.defineProperty(vf, e, { get: function() { return Ta.log.warn("using Hls." + e + " is UNSAFE be sure you know what you are doing"), kh[e] }, set: function(t) { Ta.log.warn("using Hls." + e + " is UNSAFE be sure you know what you are doing"), "number" != typeof t || t < 0 ? Ta.log.warn("value of Hls." + e + " must be greater than or equal to 0") : kh[ e] = t } }) }); var yf = function(e) { if (/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e)) return "hls"; return /^application\/dash\+xml/i.test(e) ? "dash" : null }, _f = function(e, t) { for (var i = t.media(), r = -1, n = 0; n < e.length; n++) if (e[n].id === i.uri) { r = n; break } e.selectedIndex_ = r, e.trigger({ selectedIndex: r, type: "change" }) }; vf.canPlaySource = function() { return Ta.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.") }; var bf = function(e) { if ("dash" === e.options_.sourceType) { var t = Ta.players[e.tech_.options_.playerId]; if (t.eme) { var i = function(e, t, i) { if (!e) return e; var r = {}; for (var n in e) r[n] = { audioContentType: 'audio/mp4; codecs="' + i.attributes.CODECS + '"', videoContentType: 'video/mp4; codecs="' + t.attributes.CODECS + '"' }, t.contentProtection && t.contentProtection[n] && t.contentProtection[n].pssh && (r[n].pssh = t .contentProtection[n].pssh), "string" == typeof e[n] && (r[n].url = e[n]); return Ta.mergeOptions(e, r) }(e.source_.keySystems, e.playlists.media(), e.masterPlaylistController_.mediaTypes_.AUDIO .activePlaylistLoader.media()); i && (t.currentSource().keySystems = i) } } }; vf.supportsNativeHls = function() { var e = l.createElement("video"); if (!Ta.getTech("Html5").isSupported()) return !1; return ["application/vnd.apple.mpegurl", "audio/mpegurl", "audio/x-mpegurl", "application/x-mpegurl", "video/x-mpegurl", "video/mpegurl", "application/mpegurl" ].some(function(t) { return /maybe|probably/i.test(e.canPlayType(t)) }) }(), vf.supportsNativeDash = !!Ta.getTech("Html5").isSupported() && /maybe|probably/i.test(l.createElement( "video").canPlayType("application/dash+xml")), vf.supportsTypeNatively = function(e) { return "hls" === e ? vf.supportsNativeHls : "dash" === e && vf.supportsNativeDash }, vf.isSupported = function() { return Ta.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.") }; var wf = Ta.getComponent("Component"), Ef = function(e) { function t(e, i, r) { Zd(this, t); var n = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, i, r.hls)); if (i.options_ && i.options_.playerId) { var a = Ta(i.options_.playerId); a.hasOwnProperty("hls") || Object.defineProperty(a, "hls", { get: function() { return Ta.log.warn("player.hls is deprecated. Use player.tech().hls instead."), i.trigger({ type: "usage", name: "hls-player-access" }), n } }), a.vhs = n, a.dash = n } if (n.tech_ = i, n.source_ = e, n.stats = {}, n.setOptions_(), n.options_.overrideNative && i .overrideNativeAudioTracks && i.overrideNativeVideoTracks) i.overrideNativeAudioTracks(!0), i .overrideNativeVideoTracks(!0); else if (n.options_.overrideNative && (i.featuresNativeVideoTracks || i.featuresNativeAudioTracks)) throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB"); return n.on(l, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], function(e) { var t = l.fullscreenElement || l.webkitFullscreenElement || l.mozFullScreenElement || l .msFullscreenElement; t && t.contains(n.tech_.el()) && n.masterPlaylistController_.smoothQualityChange_() }), n.on(n.tech_, "error", function() { this.masterPlaylistController_ && this.masterPlaylistController_.pauseLoading() }), n.on(n.tech_, "play", n.play), n } return ec(t, wf), $d(t, [{ key: "setOptions_", value: function() { var e = this; this.options_.withCredentials = this.options_.withCredentials || !1, "number" != typeof this .options_.blacklistDuration && (this.options_.blacklistDuration = 300), "number" != typeof this .options_.bandwidth && (this.options_.bandwidth = 4194304), this.options_ .enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && 4194304 === this.options_ .bandwidth, ["withCredentials", "bandwidth"].forEach(function(t) { void 0 !== e.source_[t] && (e.options_[t] = e.source_[t]) }), this.bandwidth = this.options_.bandwidth } }, { key: "src", value: function(e, t) { var i = this; e && (this.setOptions_(), this.options_.url = this.source_.src, this.options_.tech = this.tech_, this.options_.externHls = vf, this.options_.sourceType = yf(t), this.options_.seekTo = function( e) { i.tech_.setCurrentTime(e), i.setCurrentTime(e) }, this.masterPlaylistController_ = new cf(this.options_), this.playbackWatcher_ = new pf(Ta .mergeOptions(this.options_, { seekable: function() { return i.seekable() } })), this.masterPlaylistController_.on("error", function() { Ta.players[i.tech_.options_.playerId].error(i.masterPlaylistController_.error) }), this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist .bind(this) : vf.STANDARD_PLAYLIST_SELECTOR.bind(this), this.masterPlaylistController_ .selectInitialPlaylist = vf.INITIAL_PLAYLIST_SELECTOR.bind(this), this.playlists = this .masterPlaylistController_.masterPlaylistLoader_, this.mediaSource = this .masterPlaylistController_.mediaSource, Object.defineProperties(this, { selectPlaylist: { get: function() { return this.masterPlaylistController_.selectPlaylist }, set: function(e) { this.masterPlaylistController_.selectPlaylist = e.bind(this) } }, throughput: { get: function() { return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate }, set: function(e) { this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = e, this .masterPlaylistController_.mainSegmentLoader_.throughput.count = 1 } }, bandwidth: { get: function() { return this.masterPlaylistController_.mainSegmentLoader_.bandwidth }, set: function(e) { this.masterPlaylistController_.mainSegmentLoader_.bandwidth = e, this .masterPlaylistController_.mainSegmentLoader_.throughput = { rate: 0, count: 0 } } }, systemBandwidth: { get: function() { var e = 1 / (this.bandwidth || 1), t = void 0; return t = this.throughput > 0 ? 1 / this.throughput : 0, Math.floor(1 / (e + t)) }, set: function() { Ta.log.error('The "systemBandwidth" property is read-only') } } }), Object.defineProperties(this.stats, { bandwidth: { get: function() { return i.bandwidth || 0 }, enumerable: !0 }, mediaRequests: { get: function() { return i.masterPlaylistController_.mediaRequests_() || 0 }, enumerable: !0 }, mediaRequestsAborted: { get: function() { return i.masterPlaylistController_.mediaRequestsAborted_() || 0 }, enumerable: !0 }, mediaRequestsTimedout: { get: function() { return i.masterPlaylistController_.mediaRequestsTimedout_() || 0 }, enumerable: !0 }, mediaRequestsErrored: { get: function() { return i.masterPlaylistController_.mediaRequestsErrored_() || 0 }, enumerable: !0 }, mediaTransferDuration: { get: function() { return i.masterPlaylistController_.mediaTransferDuration_() || 0 }, enumerable: !0 }, mediaBytesTransferred: { get: function() { return i.masterPlaylistController_.mediaBytesTransferred_() || 0 }, enumerable: !0 }, mediaSecondsLoaded: { get: function() { return i.masterPlaylistController_.mediaSecondsLoaded_() || 0 }, enumerable: !0 }, buffered: { get: function() { return Gc(i.tech_.buffered()) }, enumerable: !0 }, currentTime: { get: function() { return i.tech_.currentTime() }, enumerable: !0 }, currentSource: { get: function() { return i.tech_.currentSource_ }, enumerable: !0 }, currentTech: { get: function() { return i.tech_.name_ }, enumerable: !0 }, duration: { get: function() { return i.tech_.duration() }, enumerable: !0 }, master: { get: function() { return i.playlists.master }, enumerable: !0 }, playerDimensions: { get: function() { return i.tech_.currentDimensions() }, enumerable: !0 }, seekable: { get: function() { return Gc(i.tech_.seekable()) }, enumerable: !0 }, timestamp: { get: function() { return Date.now() }, enumerable: !0 }, videoPlaybackQuality: { get: function() { return i.tech_.getVideoPlaybackQuality() }, enumerable: !0 } }), this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay.bind(this .masterPlaylistController_)), this.masterPlaylistController_.on("selectedinitialmedia", function() { var e, t; t = (e = i).playlists, e.representations = function() { return t.master.playlists.filter(function(e) { return !Tc(e) }).map(function(t, i) { return new hf(e, t, t.uri) }) }, bf(i) }), this.on(this.masterPlaylistController_, "progress", function() { this.tech_.trigger("progress") }), this.tech_.ready(function() { return i.setupQualityLevels_() }), this.tech_.el() && this.tech_.src(Ta.URL.createObjectURL(this.masterPlaylistController_ .mediaSource))) } }, { key: "setupQualityLevels_", value: function() { var e = this, t = Ta.players[this.tech_.options_.playerId]; t && t.qualityLevels && (this.qualityLevels_ = t.qualityLevels(), this.masterPlaylistController_.on( "selectedinitialmedia", function() { var t, i; t = e.qualityLevels_, (i = e).representations().forEach(function(e) { t.addQualityLevel(e) }), _f(t, i.playlists) }), this.playlists.on("mediachange", function() { _f(e.qualityLevels_, e.playlists) })) } }, { key: "play", value: function() { this.masterPlaylistController_.play() } }, { key: "setCurrentTime", value: function(e) { this.masterPlaylistController_.setCurrentTime(e) } }, { key: "duration", value: function() { return this.masterPlaylistController_.duration() } }, { key: "seekable", value: function() { return this.masterPlaylistController_.seekable() } }, { key: "dispose", value: function() { this.playbackWatcher_ && this.playbackWatcher_.dispose(), this.masterPlaylistController_ && this .masterPlaylistController_.dispose(), this.qualityLevels_ && this.qualityLevels_.dispose(), function e(t, i, r) { null === t && (t = Function.prototype); var n = Object.getOwnPropertyDescriptor(t, i); if (void 0 === n) { var a = Object.getPrototypeOf(t); return null === a ? void 0 : e(a, i, r) } if ("value" in n) return n.value; var s = n.get; return void 0 !== s ? s.call(r) : void 0 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "dispose", this).call(this) } }]), t }(), Tf = { name: "videojs-http-streaming", VERSION: "1.2.6", canHandleSource: function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = Ta.mergeOptions(Ta.options, t); return Tf.canPlayType(e.type, i) }, handleSource: function(e, t) { var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, r = Ta.mergeOptions(Ta.options, i); return t.hls = new Ef(e, t, r), t.hls.xhr = Cc(), t.hls.src(e.src, e.type), t.hls }, canPlayType: function(e) { var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}, i = Ta.mergeOptions(Ta.options, t).hls.overrideNative, r = yf(e); return r && (!vf.supportsTypeNatively(r) || i) ? "maybe" : "" } }; return void 0 !== Ta.MediaSource && void 0 !== Ta.URL || (Ta.MediaSource = vh, Ta.URL = yh), vh .supportsNativeMediaSources() && Ta.getTech("Html5").registerSourceHandler(Tf, 0), Ta.HlsHandler = Ef, Ta .HlsSourceHandler = Tf, Ta.Hls = vf, Ta.use || Ta.registerComponent("Hls", vf), Ta.options.hls = Ta.options.hls || {}, Ta.registerPlugin ? Ta.registerPlugin("reloadSourceOnError", gf) : Ta.plugin("reloadSourceOnError", gf), Ta }), function() { var e, t; e = window, (t = e && e.videojs) && (t.CDN_VERSION = "7.2.4") }(), function(e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define .amd ? define([], t) : "object" == typeof exports ? exports.flvjs = t() : e.flvjs = t() }(this, function() { return function(e) { var t = {}; function i(r) { if (t[r]) return t[r].exports; var n = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports } return i.m = e, i.c = t, i.d = function(e, t, r) { i.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }) }, i.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, i.t = function(e, t) { if (1 & t && (e = i(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var r = Object.create(null); if (i.r(r), Object.defineProperty(r, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var n in e) i.d(r, n, function(t) { return e[t] }.bind(null, n)); return r }, i.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e }; return i.d(t, "a", t), t }, i.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, i.p = "", i(i.s = 230) }([function(e, t, i) { "use strict"; var r = i(8), n = i.n(r), a = function() { function e() {} return e.e = function(t, i) { t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG); var r = "[" + t + "] > " + i; e.ENABLE_CALLBACK && e.emitter.emit("log", "error", r), e.ENABLE_ERROR && (console.error ? console .error(r) : console.warn ? console.warn(r) : console.log(r)) }, e.i = function(t, i) { t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG); var r = "[" + t + "] > " + i; e.ENABLE_CALLBACK && e.emitter.emit("log", "info", r), e.ENABLE_INFO && (console.info ? console .info(r) : console.log(r)) }, e.w = function(t, i) { t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG); var r = "[" + t + "] > " + i; e.ENABLE_CALLBACK && e.emitter.emit("log", "warn", r), e.ENABLE_WARN && (console.warn ? console .warn(r) : console.log(r)) }, e.d = function(t, i) { t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG); var r = "[" + t + "] > " + i; e.ENABLE_CALLBACK && e.emitter.emit("log", "debug", r), e.ENABLE_DEBUG && (console.debug ? console .debug(r) : console.log(r)) }, e.v = function(t, i) { t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG); var r = "[" + t + "] > " + i; e.ENABLE_CALLBACK && e.emitter.emit("log", "verbose", r), e.ENABLE_VERBOSE && console.log(r) }, e }(); a.GLOBAL_TAG = "flv.js", a.FORCE_GLOBAL_TAG = !1, a.ENABLE_ERROR = !0, a.ENABLE_INFO = !1, a.ENABLE_WARN = ! 1, a.ENABLE_DEBUG = !1, a.ENABLE_VERBOSE = !1, a.ENABLE_CALLBACK = !1, a.emitter = new n.a, t.a = a }, function(e, t, i) { "use strict"; i.d(t, "G", function() { return r }), i.d(t, "E", function() { return n }), i.d(t, "F", function() { return a }), i.d(t, "w", function() { return s }), i.d(t, "l", function() { return o }), i.d(t, "q", function() { return u }), i.d(t, "y", function() { return l }), i.d(t, "v", function() { return d }), i.d(t, "k", function() { return c }), i.d(t, "s", function() { return h }), i.d(t, "t", function() { return f }), i.d(t, "m", function() { return p }), i.d(t, "D", function() { return m }), i.d(t, "x", function() { return g }), i.d(t, "A", function() { return v }), i.d(t, "B", function() { return y }), i.d(t, "u", function() { return _ }), i.d(t, "r", function() { return b }), i.d(t, "o", function() { return w }), i.d(t, "z", function() { return E }), i.d(t, "n", function() { return T }), i.d(t, "b", function() { return S }), i.d(t, "a", function() { return A }), i.d(t, "f", function() { return k }), i.d(t, "p", function() { return R }), i.d(t, "C", function() { return M }), i.d(t, "i", function() { return D }), i.d(t, "d", function() { return I }), i.d(t, "h", function() { return L }), i.d(t, "c", function() { return x }), i.d(t, "j", function() { return P }), i.d(t, "e", function() { return U }), i.d(t, "g", function() { return N }); var r = 1, n = 2, a = 3, s = 1, o = 2, u = 3, l = 4, d = 6, c = 7, h = 10, f = 11, p = 12, m = 13, g = 14, v = 15, y = 16, _ = 20, b = 21, w = 102, E = 103, T = 200, S = 1, A = 2, k = 3, R = 22, M = 23, O = !0, C = !0; function D(e) { O = e } function I() { return O } function L(e) {} function x() { return C } function P(e) { return new Promise(function(t) { return setTimeout(t, e) }) } function U(e) { var t, i = new Date, r = i.getFullYear(), n = i.getMonth() + 1, a = i.getDate(); i.getDay(), t = r + "-" + n + "-" + a + " " + i.getHours() + ":" + i.getMinutes() + ":" + i.getSeconds(), console.log("[" + t + "]: " + e) } function N() { for (var e = window.location.href.split("/"), t = "", i = 0; i < 3; i++) t += e[i], t += "/"; return t } }, function(e, t, i) { "use strict"; t.a = { IO_ERROR: "io_error", DEMUX_ERROR: "demux_error", INIT_SEGMENT: "init_segment", MEDIA_SEGMENT: "media_segment", LOADING_COMPLETE: "loading_complete", RECOVERED_EARLY_EOF: "recovered_early_eof", MEDIA_INFO: "media_info", METADATA_ARRIVED: "metadata_arrived", SCRIPTDATA_ARRIVED: "scriptdata_arrived", STATISTICS_INFO: "statistics_info", RECOMMEND_SEEKPOINT: "recommend_seekpoint", RECONNECT_ING: "reconnect_ing", RECONNECT_SUCCESS: "reconnect_success", IS_ENCODED_H265: "encoded_265", SOURCE_ENDED: "source_ended", UPDATE_DURATION: "update_duration", UPDATE_KBPS: "update_kbps", SOCKET_CLOSE: "socket_close", SEI_DATA: "sei_data", AUDIO_ERROR: "audio_error", ON_DBL_CLICK: "ondblclick", RECORDING: "recording" } }, function(e, t, i) { "use strict"; i.d(t, "c", function() { return a }), i.d(t, "b", function() { return s }), i.d(t, "a", function() { return o }); var r = i(4); function n(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var a = { kIdle: 0, kConnecting: 1, kBuffering: 2, kError: 3, kComplete: 4 }, s = { OK: "OK", EXCEPTION: "Exception", HTTP_STATUS_CODE_INVALID: "HttpStatusCodeInvalid", CONNECTING_TIMEOUT: "ConnectingTimeout", EARLY_EOF: "EarlyEof", UNRECOVERABLE_EARLY_EOF: "UnrecoverableEarlyEof" }, o = function() { function e(e) { this._type = e || "undefined", this._status = a.kIdle, this._needStash = !1, this ._onContentLengthKnown = null, this._onURLRedirect = null, this._onDataArrival = null, this ._onHLSError = null, this._onError = null, this._onComplete = null } var t, i, s = e.prototype; return s.destroy = function() { this._status = a.kIdle, this._onContentLengthKnown = null, this._onURLRedirect = null, this ._onDataArrival = null, this._onError = null, this._onHLSError = null, this._onComplete = null }, s.isWorking = function() { return this._status === a.kConnecting || this._status === a.kBuffering }, s.open = function(e, t) { throw new r.c("Unimplemented abstract function!") }, s.abort = function() { throw new r.c("Unimplemented abstract function!") }, t = e, (i = [{ key: "type", get: function() { return this._type } }, { key: "status", get: function() { return this._status } }, { key: "needStashBuffer", get: function() { return this._needStash } }, { key: "onContentLengthKnown", get: function() { return this._onContentLengthKnown }, set: function(e) { this._onContentLengthKnown = e } }, { key: "onURLRedirect", get: function() { return this._onURLRedirect }, set: function(e) { this._onURLRedirect = e } }, { key: "onDataArrival", get: function() { return this._onDataArrival }, set: function(e) { this._onDataArrival = e } }, { key: "onHLSError", get: function() { return this._onHLSError }, set: function(e) { this._onHLSError = e } }, { key: "onError", get: function() { return this._onError }, set: function(e) { this._onError = e } }, { key: "onComplete", get: function() { return this._onComplete }, set: function(e) { this._onComplete = e } }]) && n(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }() }, function(e, t, i) { "use strict"; function r(e, t) { e.prototype = Object.create(t.prototype), e.prototype.constructor = e, function(e, t) { (Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) }(e, t) } function n(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function a(e, t, i) { return t && n(e.prototype, t), i && n(e, i), Object.defineProperty(e, "prototype", { writable: !1 }), e } i.d(t, "d", function() { return s }), i.d(t, "a", function() { return o }), i.d(t, "b", function() { return u }), i.d(t, "c", function() { return l }); var s = function() { function e(e) { this._message = e } return e.prototype.toString = function() { return this.name + ": " + this.message }, a(e, [{ key: "name", get: function() { return "RuntimeException" } }, { key: "message", get: function() { return this._message } }]), e }(), o = function(e) { function t(t) { return e.call(this, t) || this } return r(t, e), a(t, [{ key: "name", get: function() { return "IllegalStateException" } }]), t }(s), u = function(e) { function t(t) { return e.call(this, t) || this } return r(t, e), a(t, [{ key: "name", get: function() { return "InvalidArgumentException" } }]), t }(s), l = function(e) { function t(t) { return e.call(this, t) || this } return r(t, e), a(t, [{ key: "name", get: function() { return "NotImplementedException" } }]), t }(s) }, function(e, t) { "function" == typeof Object.create ? e.exports = function(e, t) { t && (e.super_ = t, e.prototype = Object.create(t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } })) } : e.exports = function(e, t) { if (t) { e.super_ = t; var i = function() {}; i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e } } }, function(e, t, i) { var r = i(10), n = r.Buffer; function a(e, t) { for (var i in e) t[i] = e[i] } function s(e, t, i) { return n(e, t, i) } n.from && n.alloc && n.allocUnsafe && n.allocUnsafeSlow ? e.exports = r : (a(r, t), t.Buffer = s), s .prototype = Object.create(n.prototype), a(n, s), s.from = function(e, t, i) { if ("number" == typeof e) throw new TypeError("Argument must not be a number"); return n(e, t, i) }, s.alloc = function(e, t, i) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); var r = n(e); return void 0 !== t ? "string" == typeof i ? r.fill(t, i) : r.fill(t) : r.fill(0), r }, s.allocUnsafe = function(e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return n(e) }, s.allocUnsafeSlow = function(e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return r.SlowBuffer(e) } }, function(e, t, i) { "use strict"; var r = {}; ! function() { var e = self.navigator.userAgent.toLowerCase(), t = /(edge)\/([\w.]+)/.exec(e) || /(opr)[\/]([\w.]+)/.exec(e) || /(chrome)[ \/]([\w.]+)/.exec(e) || /(iemobile)[\/]([\w.]+)/.exec(e) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( e) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e) || /(webkit)[ \/]([\w.]+)/.exec(e) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e) || /(msie) ([\w.]+)/ .exec(e) || e.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(e) || e.indexOf("compatible") < 0 && /(firefox)[ \/]([\w.]+)/.exec(e) || [], i = /(ipad)/.exec(e) || /(ipod)/.exec(e) || /(windows phone)/.exec(e) || /(iphone)/.exec(e) || /(kindle)/.exec(e) || /(android)/.exec(e) || /(windows)/.exec(e) || /(mac)/.exec(e) || /(linux)/.exec( e) || /(cros)/.exec(e) || [], n = { browser: t[5] || t[3] || t[1] || "", version: t[2] || t[4] || "0", majorVersion: t[4] || t[2] || "0", platform: i[0] || "" }, a = {}; if (n.browser) { a[n.browser] = !0; var s = n.majorVersion.split("."); a.version = { major: parseInt(n.majorVersion, 10), string: n.version }, s.length > 1 && (a.version.minor = parseInt(s[1], 10)), s.length > 2 && (a.version.build = parseInt(s[2], 10)) } for (var o in n.platform && (a[n.platform] = !0), (a.chrome || a.opr || a.safari) && (a.webkit = !0), (a .rv || a.iemobile) && (a.rv && delete a.rv, n.browser = "msie", a.msie = !0), a.edge && (delete a .edge, n.browser = "msedge", a.msedge = !0), a.opr && (n.browser = "opera", a.opera = !0), a .safari && a.android && (n.browser = "android", a.android = !0), a.name = n.browser, a.platform = n .platform, r) r.hasOwnProperty(o) && delete r[o]; Object.assign(r, a) }(), t.a = r }, function(e, t, i) { "use strict"; var r, n = "object" == typeof Reflect ? Reflect : null, a = n && "function" == typeof n.apply ? n.apply : function(e, t, i) { return Function.prototype.apply.call(e, t, i) }; r = n && "function" == typeof n.ownKeys ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) { return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)) } : function(e) { return Object.getOwnPropertyNames(e) }; var s = Number.isNaN || function(e) { return e != e }; function o() { o.init.call(this) } e.exports = o, e.exports.once = function(e, t) { return new Promise(function(i, r) { function n(i) { e.removeListener(t, a), r(i) } function a() { "function" == typeof e.removeListener && e.removeListener("error", n), i([].slice.call( arguments)) } g(e, t, a, { once: !0 }), "error" !== t && function(e, t, i) { "function" == typeof e.on && g(e, "error", t, { once: !0 }) }(e, n) }) }, o.EventEmitter = o, o.prototype._events = void 0, o.prototype._eventsCount = 0, o.prototype ._maxListeners = void 0; var u = 10; function l(e) { if ("function" != typeof e) throw new TypeError( 'The "listener" argument must be of type Function. Received type ' + typeof e) } function d(e) { return void 0 === e._maxListeners ? o.defaultMaxListeners : e._maxListeners } function c(e, t, i, r) { var n, a, s, o; if (l(i), void 0 === (a = e._events) ? (a = e._events = Object.create(null), e._eventsCount = 0) : ( void 0 !== a.newListener && (e.emit("newListener", t, i.listener ? i.listener : i), a = e._events), s = a[t]), void 0 === s) s = a[t] = i, ++e._eventsCount; else if ("function" == typeof s ? s = a[t] = r ? [i, s] : [s, i] : r ? s.unshift(i) : s.push(i), (n = d( e)) > 0 && s.length > n && !s.warned) { s.warned = !0; var u = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit"); u.name = "MaxListenersExceededWarning", u.emitter = e, u.type = t, u.count = s.length, o = u, console && console.warn && console.warn(o) } return e } function h(e, t, i) { var r = { fired: !1, wrapFn: void 0, target: e, type: t, listener: i }, n = function() { if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 0 === arguments.length ? this.listener.call(this.target) : this.listener.apply(this.target, arguments) }.bind(r); return n.listener = i, r.wrapFn = n, n } function f(e, t, i) { var r = e._events; if (void 0 === r) return []; var n = r[t]; return void 0 === n ? [] : "function" == typeof n ? i ? [n.listener || n] : [n] : i ? function(e) { for (var t = new Array(e.length), i = 0; i < t.length; ++i) t[i] = e[i].listener || e[i]; return t }(n) : m(n, n.length) } function p(e) { var t = this._events; if (void 0 !== t) { var i = t[e]; if ("function" == typeof i) return 1; if (void 0 !== i) return i.length } return 0 } function m(e, t) { for (var i = new Array(t), r = 0; r < t; ++r) i[r] = e[r]; return i } function g(e, t, i, r) { if ("function" == typeof e.on) r.once ? e.once(t, i) : e.on(t, i); else { if ("function" != typeof e.addEventListener) throw new TypeError( 'The "emitter" argument must be of type EventEmitter. Received type ' + typeof e); e.addEventListener(t, function n(a) { r.once && e.removeEventListener(t, n), i(a) }) } } Object.defineProperty(o, "defaultMaxListeners", { enumerable: !0, get: function() { return u }, set: function(e) { if ("number" != typeof e || e < 0 || s(e)) throw new RangeError( 'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + "."); u = e } }), o.init = function() { void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0 }, o.prototype.setMaxListeners = function(e) { if ("number" != typeof e || e < 0 || s(e)) throw new RangeError( 'The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this }, o.prototype.getMaxListeners = function() { return d(this) }, o.prototype.emit = function(e) { for (var t = [], i = 1; i < arguments.length; i++) t.push(arguments[i]); var r = "error" === e, n = this._events; if (void 0 !== n) r = r && void 0 === n.error; else if (!r) return !1; if (r) { var s; if (t.length > 0 && (s = t[0]), s instanceof Error) throw s; var o = new Error("Unhandled error." + (s ? " (" + s.message + ")" : "")); throw o.context = s, o } var u = n[e]; if (void 0 === u) return !1; if ("function" == typeof u) a(u, this, t); else { var l = u.length, d = m(u, l); for (i = 0; i < l; ++i) a(d[i], this, t) } return !0 }, o.prototype.addListener = function(e, t) { return c(this, e, t, !1) }, o.prototype.on = o.prototype.addListener, o.prototype.prependListener = function(e, t) { return c(this, e, t, !0) }, o.prototype.once = function(e, t) { return l(t), this.on(e, h(this, e, t)), this }, o.prototype.prependOnceListener = function(e, t) { return l(t), this.prependListener(e, h(this, e, t)), this }, o.prototype.removeListener = function(e, t) { var i, r, n, a, s; if (l(t), void 0 === (r = this._events)) return this; if (void 0 === (i = r[e])) return this; if (i === t || i.listener === t) 0 == --this._eventsCount ? this._events = Object.create(null) : ( delete r[e], r.removeListener && this.emit("removeListener", e, i.listener || t)); else if ("function" != typeof i) { for (n = -1, a = i.length - 1; a >= 0; a--) if (i[a] === t || i[a].listener === t) { s = i[a].listener, n = a; break } if (n < 0) return this; 0 === n ? i.shift() : function(e, t) { for (; t + 1 < e.length; t++) e[t] = e[t + 1]; e.pop() }(i, n), 1 === i.length && (r[e] = i[0]), void 0 !== r.removeListener && this.emit("removeListener", e, s || t) } return this }, o.prototype.off = o.prototype.removeListener, o.prototype.removeAllListeners = function(e) { var t, i, r; if (void 0 === (i = this._events)) return this; if (void 0 === i.removeListener) return 0 === arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== i[e] && (0 == --this._eventsCount ? this._events = Object .create(null) : delete i[e]), this; if (0 === arguments.length) { var n, a = Object.keys(i); for (r = 0; r < a.length; ++r) "removeListener" !== (n = a[r]) && this.removeAllListeners(n); return this.removeAllListeners("removeListener"), this._events = Object.create(null), this ._eventsCount = 0, this } if ("function" == typeof(t = i[e])) this.removeListener(e, t); else if (void 0 !== t) for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]); return this }, o.prototype.listeners = function(e) { return f(this, e, !0) }, o.prototype.rawListeners = function(e) { return f(this, e, !1) }, o.listenerCount = function(e, t) { return "function" == typeof e.listenerCount ? e.listenerCount(t) : p.call(e, t) }, o.prototype.listenerCount = p, o.prototype.eventNames = function() { return this._eventsCount > 0 ? r(this._events) : [] } }, function(e, t) { var i, r, n = e.exports = {}; function a() { throw new Error("setTimeout has not been defined") } function s() { throw new Error("clearTimeout has not been defined") } function o(e) { if (i === setTimeout) return setTimeout(e, 0); if ((i === a || !i) && setTimeout) return i = setTimeout, setTimeout(e, 0); try { return i(e, 0) } catch (t) { try { return i.call(null, e, 0) } catch (t) { return i.call(this, e, 0) } } }! function() { try { i = "function" == typeof setTimeout ? setTimeout : a } catch (e) { i = a } try { r = "function" == typeof clearTimeout ? clearTimeout : s } catch (e) { r = s } }(); var u, l = [], d = !1, c = -1; function h() { d && u && (d = !1, u.length ? l = u.concat(l) : c = -1, l.length && f()) } function f() { if (!d) { var e = o(h); d = !0; for (var t = l.length; t;) { for (u = l, l = []; ++c < t;) u && u[c].run(); c = -1, t = l.length } u = null, d = !1, function(e) { if (r === clearTimeout) return clearTimeout(e); if ((r === s || !r) && clearTimeout) return r = clearTimeout, clearTimeout(e); try { r(e) } catch (t) { try { return r.call(null, e) } catch (t) { return r.call(this, e) } } }(e) } } function p(e, t) { this.fun = e, this.array = t } function m() {} n.nextTick = function(e) { var t = new Array(arguments.length - 1); if (arguments.length > 1) for (var i = 1; i < arguments.length; i++) t[i - 1] = arguments[i]; l.push(new p(e, t)), 1 !== l.length || d || o(f) }, p.prototype.run = function() { this.fun.apply(null, this.array) }, n.title = "browser", n.browser = !0, n.env = {}, n.argv = [], n.version = "", n.versions = {}, n.on = m, n.addListener = m, n.once = m, n.off = m, n.removeListener = m, n.removeAllListeners = m, n.emit = m, n .prependListener = m, n.prependOnceListener = m, n.listeners = function(e) { return [] }, n.binding = function(e) { throw new Error("process.binding is not supported") }, n.cwd = function() { return "/" }, n.chdir = function(e) { throw new Error("process.chdir is not supported") }, n.umask = function() { return 0 } }, function(e, t, i) { "use strict"; (function(e) { var r = i(125), n = i(126), a = i(66); function s() { return u.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823 } function o(e, t) { if (s() < t) throw new RangeError("Invalid typed array length"); return u.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = u.prototype : (null === e && (e = new u(t)), e.length = t), e } function u(e, t, i) { if (!(u.TYPED_ARRAY_SUPPORT || this instanceof u)) return new u(e, t, i); if ("number" == typeof e) { if ("string" == typeof t) throw new Error( "If encoding is specified then the first argument must be a string"); return c(this, e) } return l(this, e, t, i) } function l(e, t, i, r) { if ("number" == typeof t) throw new TypeError('"value" argument must not be a number'); return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function(e, t, i, r) { if (t.byteLength, i < 0 || t.byteLength < i) throw new RangeError("'offset' is out of bounds"); if (t.byteLength < i + (r || 0)) throw new RangeError("'length' is out of bounds"); return t = void 0 === i && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t, i) : new Uint8Array(t, i, r), u.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = u.prototype : e = h(e, t), e }(e, t, i, r) : "string" == typeof t ? function(e, t, i) { if ("string" == typeof i && "" !== i || (i = "utf8"), !u.isEncoding(i)) throw new TypeError( '"encoding" must be a valid string encoding'); var r = 0 | p(t, i), n = (e = o(e, r)).write(t, i); return n !== r && (e = e.slice(0, n)), e }(e, t, i) : function(e, t) { if (u.isBuffer(t)) { var i = 0 | f(t.length); return 0 === (e = o(e, i)).length || t.copy(e, 0, 0, i), e } if (t) { if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length" in t) return "number" != typeof t.length || (r = t.length) != r ? o(e, 0) : h(e, t); if ("Buffer" === t.type && a(t.data)) return h(e, t.data) } var r; throw new TypeError( "First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.") }(e, t) } function d(e) { if ("number" != typeof e) throw new TypeError('"size" argument must be a number'); if (e < 0) throw new RangeError('"size" argument must not be negative') } function c(e, t) { if (d(t), e = o(e, t < 0 ? 0 : 0 | f(t)), !u.TYPED_ARRAY_SUPPORT) for (var i = 0; i < t; ++i) e[i] = 0; return e } function h(e, t) { var i = t.length < 0 ? 0 : 0 | f(t.length); e = o(e, i); for (var r = 0; r < i; r += 1) e[r] = 255 & t[r]; return e } function f(e) { if (e >= s()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + s() .toString(16) + " bytes"); return 0 | e } function p(e, t) { if (u.isBuffer(e)) return e.length; if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer .isView(e) || e instanceof ArrayBuffer)) return e.byteLength; "string" != typeof e && (e = "" + e); var i = e.length; if (0 === i) return 0; for (var r = !1;;) switch (t) { case "ascii": case "latin1": case "binary": return i; case "utf8": case "utf-8": case void 0: return F(e).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return 2 * i; case "hex": return i >>> 1; case "base64": return j(e).length; default: if (r) return F(e).length; t = ("" + t).toLowerCase(), r = !0 } } function m(e, t, i) { var r = e[t]; e[t] = e[i], e[i] = r } function g(e, t, i, r, n) { if (0 === e.length) return -1; if ("string" == typeof i ? (r = i, i = 0) : i > 2147483647 ? i = 2147483647 : i < -2147483648 && ( i = -2147483648), i = +i, isNaN(i) && (i = n ? 0 : e.length - 1), i < 0 && (i = e.length + i), i >= e.length) { if (n) return -1; i = e.length - 1 } else if (i < 0) { if (!n) return -1; i = 0 } if ("string" == typeof t && (t = u.from(t, r)), u.isBuffer(t)) return 0 === t.length ? -1 : v(e, t, i, r, n); if ("number" == typeof t) return t &= 255, u.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array .prototype.indexOf ? n ? Uint8Array.prototype.indexOf.call(e, t, i) : Uint8Array.prototype .lastIndexOf.call(e, t, i) : v(e, [t], i, r, n); throw new TypeError("val must be string, number or Buffer") } function v(e, t, i, r, n) { var a, s = 1, o = e.length, u = t.length; if (void 0 !== r && ("ucs2" === (r = String(r).toLowerCase()) || "ucs-2" === r || "utf16le" === r || "utf-16le" === r)) { if (e.length < 2 || t.length < 2) return -1; s = 2, o /= 2, u /= 2, i /= 2 } function l(e, t) { return 1 === s ? e[t] : e.readUInt16BE(t * s) } if (n) { var d = -1; for (a = i; a < o; a++) if (l(e, a) === l(t, -1 === d ? 0 : a - d)) { if (-1 === d && (d = a), a - d + 1 === u) return d * s } else -1 !== d && (a -= a - d), d = -1 } else for (i + u > o && (i = o - u), a = i; a >= 0; a--) { for (var c = !0, h = 0; h < u; h++) if (l(e, a + h) !== l(t, h)) { c = !1; break } if (c) return a } return -1 } function y(e, t, i, r) { i = Number(i) || 0; var n = e.length - i; r ? (r = Number(r)) > n && (r = n) : r = n; var a = t.length; if (a % 2 != 0) throw new TypeError("Invalid hex string"); r > a / 2 && (r = a / 2); for (var s = 0; s < r; ++s) { var o = parseInt(t.substr(2 * s, 2), 16); if (isNaN(o)) return s; e[i + s] = o } return s } function _(e, t, i, r) { return H(F(t, e.length - i), e, i, r) } function b(e, t, i, r) { return H(function(e) { for (var t = [], i = 0; i < e.length; ++i) t.push(255 & e.charCodeAt(i)); return t }(t), e, i, r) } function w(e, t, i, r) { return b(e, t, i, r) } function E(e, t, i, r) { return H(j(t), e, i, r) } function T(e, t, i, r) { return H(function(e, t) { for (var i, r, n, a = [], s = 0; s < e.length && !((t -= 2) < 0); ++s) r = (i = e.charCodeAt( s)) >> 8, n = i % 256, a.push(n), a.push(r); return a }(t, e.length - i), e, i, r) } function S(e, t, i) { return 0 === t && i === e.length ? r.fromByteArray(e) : r.fromByteArray(e.slice(t, i)) } function A(e, t, i) { i = Math.min(e.length, i); for (var r = [], n = t; n < i;) { var a, s, o, u, l = e[n], d = null, c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1; if (n + c <= i) switch (c) { case 1: l < 128 && (d = l); break; case 2: 128 == (192 & (a = e[n + 1])) && (u = (31 & l) << 6 | 63 & a) > 127 && (d = u); break; case 3: a = e[n + 1], s = e[n + 2], 128 == (192 & a) && 128 == (192 & s) && (u = (15 & l) << 12 | ( 63 & a) << 6 | 63 & s) > 2047 && (u < 55296 || u > 57343) && (d = u); break; case 4: a = e[n + 1], s = e[n + 2], o = e[n + 3], 128 == (192 & a) && 128 == (192 & s) && 128 == ( 192 & o) && (u = (15 & l) << 18 | (63 & a) << 12 | (63 & s) << 6 | 63 & o) > 65535 && u < 1114112 && (d = u) } null === d ? (d = 65533, c = 1) : d > 65535 && (d -= 65536, r.push(d >>> 10 & 1023 | 55296), d = 56320 | 1023 & d), r.push(d), n += c } return function(e) { var t = e.length; if (t <= 4096) return String.fromCharCode.apply(String, e); for (var i = "", r = 0; r < t;) i += String.fromCharCode.apply(String, e.slice(r, r += 4096)); return i }(r) } function k(e, t, i) { var r = ""; i = Math.min(e.length, i); for (var n = t; n < i; ++n) r += String.fromCharCode(127 & e[n]); return r } function R(e, t, i) { var r = ""; i = Math.min(e.length, i); for (var n = t; n < i; ++n) r += String.fromCharCode(e[n]); return r } function M(e, t, i) { var r = e.length; (!t || t < 0) && (t = 0), (!i || i < 0 || i > r) && (i = r); for (var n = "", a = t; a < i; ++a) n += B(e[a]); return n } function O(e, t, i) { for (var r = e.slice(t, i), n = "", a = 0; a < r.length; a += 2) n += String.fromCharCode(r[a] + 256 * r[a + 1]); return n } function C(e, t, i) { if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint"); if (e + t > i) throw new RangeError("Trying to access beyond buffer length") } function D(e, t, i, r, n, a) { if (!u.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (t > n || t < a) throw new RangeError('"value" argument is out of bounds'); if (i + r > e.length) throw new RangeError("Index out of range") } function I(e, t, i, r) { t < 0 && (t = 65535 + t + 1); for (var n = 0, a = Math.min(e.length - i, 2); n < a; ++n) e[i + n] = (t & 255 << 8 * (r ? n : 1 - n)) >>> 8 * (r ? n : 1 - n) } function L(e, t, i, r) { t < 0 && (t = 4294967295 + t + 1); for (var n = 0, a = Math.min(e.length - i, 4); n < a; ++n) e[i + n] = t >>> 8 * (r ? n : 3 - n) & 255 } function x(e, t, i, r, n, a) { if (i + r > e.length) throw new RangeError("Index out of range"); if (i < 0) throw new RangeError("Index out of range") } function P(e, t, i, r, a) { return a || x(e, 0, i, 4), n.write(e, t, i, r, 23, 4), i + 4 } function U(e, t, i, r, a) { return a || x(e, 0, i, 8), n.write(e, t, i, r, 52, 8), i + 8 } t.Buffer = u, t.SlowBuffer = function(e) { return +e != e && (e = 0), u.alloc(+e) }, t.INSPECT_MAX_BYTES = 50, u.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e .TYPED_ARRAY_SUPPORT : function() { try { var e = new Uint8Array(1); return e.__proto__ = { __proto__: Uint8Array.prototype, foo: function() { return 42 } }, 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength } catch (e) { return !1 } }(), t.kMaxLength = s(), u.poolSize = 8192, u._augment = function(e) { return e.__proto__ = u.prototype, e }, u.from = function(e, t, i) { return l(null, e, t, i) }, u.TYPED_ARRAY_SUPPORT && (u.prototype.__proto__ = Uint8Array.prototype, u.__proto__ = Uint8Array, "undefined" != typeof Symbol && Symbol.species && u[Symbol.species] === u && Object.defineProperty( u, Symbol.species, { value: null, configurable: !0 })), u.alloc = function(e, t, i) { return function(e, t, i, r) { return d(t), t <= 0 ? o(e, t) : void 0 !== i ? "string" == typeof r ? o(e, t).fill(i, r) : o(e, t).fill(i) : o(e, t) }(null, e, t, i) }, u.allocUnsafe = function(e) { return c(null, e) }, u.allocUnsafeSlow = function(e) { return c(null, e) }, u.isBuffer = function(e) { return !(null == e || !e._isBuffer) }, u.compare = function(e, t) { if (!u.isBuffer(e) || !u.isBuffer(t)) throw new TypeError("Arguments must be Buffers"); if (e === t) return 0; for (var i = e.length, r = t.length, n = 0, a = Math.min(i, r); n < a; ++n) if (e[n] !== t[n]) { i = e[n], r = t[n]; break } return i < r ? -1 : r < i ? 1 : 0 }, u.isEncoding = function(e) { switch (String(e).toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "latin1": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return !0; default: return !1 } }, u.concat = function(e, t) { if (!a(e)) throw new TypeError('"list" argument must be an Array of Buffers'); if (0 === e.length) return u.alloc(0); var i; if (void 0 === t) for (t = 0, i = 0; i < e.length; ++i) t += e[i].length; var r = u.allocUnsafe(t), n = 0; for (i = 0; i < e.length; ++i) { var s = e[i]; if (!u.isBuffer(s)) throw new TypeError('"list" argument must be an Array of Buffers'); s.copy(r, n), n += s.length } return r }, u.byteLength = p, u.prototype._isBuffer = !0, u.prototype.swap16 = function() { var e = this.length; if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var t = 0; t < e; t += 2) m(this, t, t + 1); return this }, u.prototype.swap32 = function() { var e = this.length; if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var t = 0; t < e; t += 4) m(this, t, t + 3), m(this, t + 1, t + 2); return this }, u.prototype.swap64 = function() { var e = this.length; if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var t = 0; t < e; t += 8) m(this, t, t + 7), m(this, t + 1, t + 6), m(this, t + 2, t + 5), m( this, t + 3, t + 4); return this }, u.prototype.toString = function() { var e = 0 | this.length; return 0 === e ? "" : 0 === arguments.length ? A(this, 0, e) : function(e, t, i) { var r = !1; if ((void 0 === t || t < 0) && (t = 0), t > this.length) return ""; if ((void 0 === i || i > this.length) && (i = this.length), i <= 0) return ""; if ((i >>>= 0) <= (t >>>= 0)) return ""; for (e || (e = "utf8");;) switch (e) { case "hex": return M(this, t, i); case "utf8": case "utf-8": return A(this, t, i); case "ascii": return k(this, t, i); case "latin1": case "binary": return R(this, t, i); case "base64": return S(this, t, i); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return O(this, t, i); default: if (r) throw new TypeError("Unknown encoding: " + e); e = (e + "").toLowerCase(), r = !0 } }.apply(this, arguments) }, u.prototype.equals = function(e) { if (!u.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); return this === e || 0 === u.compare(this, e) }, u.prototype.inspect = function() { var e = "", i = t.INSPECT_MAX_BYTES; return this.length > 0 && (e = this.toString("hex", 0, i).match(/.{2}/g).join(" "), this.length > i && (e += " ... ")), "" }, u.prototype.compare = function(e, t, i, r, n) { if (!u.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); if (void 0 === t && (t = 0), void 0 === i && (i = e ? e.length : 0), void 0 === r && (r = 0), void 0 === n && (n = this.length), t < 0 || i > e.length || r < 0 || n > this.length) throw new RangeError("out of range index"); if (r >= n && t >= i) return 0; if (r >= n) return -1; if (t >= i) return 1; if (this === e) return 0; for (var a = (n >>>= 0) - (r >>>= 0), s = (i >>>= 0) - (t >>>= 0), o = Math.min(a, s), l = this .slice(r, n), d = e.slice(t, i), c = 0; c < o; ++c) if (l[c] !== d[c]) { a = l[c], s = d[c]; break } return a < s ? -1 : s < a ? 1 : 0 }, u.prototype.includes = function(e, t, i) { return -1 !== this.indexOf(e, t, i) }, u.prototype.indexOf = function(e, t, i) { return g(this, e, t, i, !0) }, u.prototype.lastIndexOf = function(e, t, i) { return g(this, e, t, i, !1) }, u.prototype.write = function(e, t, i, r) { if (void 0 === t) r = "utf8", i = this.length, t = 0; else if (void 0 === i && "string" == typeof t) r = t, i = this.length, t = 0; else { if (!isFinite(t)) throw new Error( "Buffer.write(string, encoding, offset[, length]) is no longer supported"); t |= 0, isFinite(i) ? (i |= 0, void 0 === r && (r = "utf8")) : (r = i, i = void 0) } var n = this.length - t; if ((void 0 === i || i > n) && (i = n), e.length > 0 && (i < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds"); r || (r = "utf8"); for (var a = !1;;) switch (r) { case "hex": return y(this, e, t, i); case "utf8": case "utf-8": return _(this, e, t, i); case "ascii": return b(this, e, t, i); case "latin1": case "binary": return w(this, e, t, i); case "base64": return E(this, e, t, i); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return T(this, e, t, i); default: if (a) throw new TypeError("Unknown encoding: " + r); r = ("" + r).toLowerCase(), a = !0 } }, u.prototype.toJSON = function() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) } }, u.prototype.slice = function(e, t) { var i, r = this.length; if ((e = ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), (t = void 0 === t ? r : ~~t) < 0 ? ( t += r) < 0 && (t = 0) : t > r && (t = r), t < e && (t = e), u.TYPED_ARRAY_SUPPORT)(i = this .subarray(e, t)).__proto__ = u.prototype; else { var n = t - e; i = new u(n, void 0); for (var a = 0; a < n; ++a) i[a] = this[a + e] } return i }, u.prototype.readUIntLE = function(e, t, i) { e |= 0, t |= 0, i || C(e, t, this.length); for (var r = this[e], n = 1, a = 0; ++a < t && (n *= 256);) r += this[e + a] * n; return r }, u.prototype.readUIntBE = function(e, t, i) { e |= 0, t |= 0, i || C(e, t, this.length); for (var r = this[e + --t], n = 1; t > 0 && (n *= 256);) r += this[e + --t] * n; return r }, u.prototype.readUInt8 = function(e, t) { return t || C(e, 1, this.length), this[e] }, u.prototype.readUInt16LE = function(e, t) { return t || C(e, 2, this.length), this[e] | this[e + 1] << 8 }, u.prototype.readUInt16BE = function(e, t) { return t || C(e, 2, this.length), this[e] << 8 | this[e + 1] }, u.prototype.readUInt32LE = function(e, t) { return t || C(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 * this[e + 3] }, u.prototype.readUInt32BE = function(e, t) { return t || C(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[ e + 3]) }, u.prototype.readIntLE = function(e, t, i) { e |= 0, t |= 0, i || C(e, t, this.length); for (var r = this[e], n = 1, a = 0; ++a < t && (n *= 256);) r += this[e + a] * n; return r >= (n *= 128) && (r -= Math.pow(2, 8 * t)), r }, u.prototype.readIntBE = function(e, t, i) { e |= 0, t |= 0, i || C(e, t, this.length); for (var r = t, n = 1, a = this[e + --r]; r > 0 && (n *= 256);) a += this[e + --r] * n; return a >= (n *= 128) && (a -= Math.pow(2, 8 * t)), a }, u.prototype.readInt8 = function(e, t) { return t || C(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e] }, u.prototype.readInt16LE = function(e, t) { t || C(e, 2, this.length); var i = this[e] | this[e + 1] << 8; return 32768 & i ? 4294901760 | i : i }, u.prototype.readInt16BE = function(e, t) { t || C(e, 2, this.length); var i = this[e + 1] | this[e] << 8; return 32768 & i ? 4294901760 | i : i }, u.prototype.readInt32LE = function(e, t) { return t || C(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24 }, u.prototype.readInt32BE = function(e, t) { return t || C(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3] }, u.prototype.readFloatLE = function(e, t) { return t || C(e, 4, this.length), n.read(this, e, !0, 23, 4) }, u.prototype.readFloatBE = function(e, t) { return t || C(e, 4, this.length), n.read(this, e, !1, 23, 4) }, u.prototype.readDoubleLE = function(e, t) { return t || C(e, 8, this.length), n.read(this, e, !0, 52, 8) }, u.prototype.readDoubleBE = function(e, t) { return t || C(e, 8, this.length), n.read(this, e, !1, 52, 8) }, u.prototype.writeUIntLE = function(e, t, i, r) { e = +e, t |= 0, i |= 0, r || D(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); var n = 1, a = 0; for (this[t] = 255 & e; ++a < i && (n *= 256);) this[t + a] = e / n & 255; return t + i }, u.prototype.writeUIntBE = function(e, t, i, r) { e = +e, t |= 0, i |= 0, r || D(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); var n = i - 1, a = 1; for (this[t + n] = 255 & e; --n >= 0 && (a *= 256);) this[t + n] = e / a & 255; return t + i }, u.prototype.writeUInt8 = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 1, 255, 0), u.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), this[t] = 255 & e, t + 1 }, u.prototype.writeUInt16LE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : I(this, e, t, !0), t + 2 }, u.prototype.writeUInt16BE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : I(this, e, t, !1), t + 2 }, u.prototype.writeUInt32LE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 4, 4294967295, 0), u.TYPED_ARRAY_SUPPORT ? (this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e) : L(this, e, t, !0), t + 4 }, u.prototype.writeUInt32BE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 4, 4294967295, 0), u.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : L(this, e, t, !1), t + 4 }, u.prototype.writeIntLE = function(e, t, i, r) { if (e = +e, t |= 0, !r) { var n = Math.pow(2, 8 * i - 1); D(this, e, t, i, n - 1, -n) } var a = 0, s = 1, o = 0; for (this[t] = 255 & e; ++a < i && (s *= 256);) e < 0 && 0 === o && 0 !== this[t + a - 1] && (o = 1), this[t + a] = (e / s >> 0) - o & 255; return t + i }, u.prototype.writeIntBE = function(e, t, i, r) { if (e = +e, t |= 0, !r) { var n = Math.pow(2, 8 * i - 1); D(this, e, t, i, n - 1, -n) } var a = i - 1, s = 1, o = 0; for (this[t + a] = 255 & e; --a >= 0 && (s *= 256);) e < 0 && 0 === o && 0 !== this[t + a + 1] && ( o = 1), this[t + a] = (e / s >> 0) - o & 255; return t + i }, u.prototype.writeInt8 = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 1, 127, -128), u.TYPED_ARRAY_SUPPORT || (e = Math.floor( e)), e < 0 && (e = 255 + e + 1), this[t] = 255 & e, t + 1 }, u.prototype.writeInt16LE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : I(this, e, t, !0), t + 2 }, u.prototype.writeInt16BE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : I(this, e, t, !1), t + 2 }, u.prototype.writeInt32LE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 4, 2147483647, -2147483648), u.TYPED_ARRAY_SUPPORT ? ( this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24) : L( this, e, t, !0), t + 4 }, u.prototype.writeInt32BE = function(e, t, i) { return e = +e, t |= 0, i || D(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), u.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : L(this, e, t, !1), t + 4 }, u.prototype.writeFloatLE = function(e, t, i) { return P(this, e, t, !0, i) }, u.prototype.writeFloatBE = function(e, t, i) { return P(this, e, t, !1, i) }, u.prototype.writeDoubleLE = function(e, t, i) { return U(this, e, t, !0, i) }, u.prototype.writeDoubleBE = function(e, t, i) { return U(this, e, t, !1, i) }, u.prototype.copy = function(e, t, i, r) { if (i || (i = 0), r || 0 === r || (r = this.length), t >= e.length && (t = e.length), t || (t = 0), r > 0 && r < i && (r = i), r === i) return 0; if (0 === e.length || 0 === this.length) return 0; if (t < 0) throw new RangeError("targetStart out of bounds"); if (i < 0 || i >= this.length) throw new RangeError("sourceStart out of bounds"); if (r < 0) throw new RangeError("sourceEnd out of bounds"); r > this.length && (r = this.length), e.length - t < r - i && (r = e.length - t + i); var n, a = r - i; if (this === e && i < t && t < r) for (n = a - 1; n >= 0; --n) e[n + t] = this[n + i]; else if (a < 1e3 || !u.TYPED_ARRAY_SUPPORT) for (n = 0; n < a; ++n) e[n + t] = this[n + i]; else Uint8Array.prototype.set.call(e, this.subarray(i, i + a), t); return a }, u.prototype.fill = function(e, t, i, r) { if ("string" == typeof e) { if ("string" == typeof t ? (r = t, t = 0, i = this.length) : "string" == typeof i && (r = i, i = this.length), 1 === e.length) { var n = e.charCodeAt(0); n < 256 && (e = n) } if (void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string"); if ("string" == typeof r && !u.isEncoding(r)) throw new TypeError("Unknown encoding: " + r) } else "number" == typeof e && (e &= 255); if (t < 0 || this.length < t || this.length < i) throw new RangeError("Out of range index"); if (i <= t) return this; var a; if (t >>>= 0, i = void 0 === i ? this.length : i >>> 0, e || (e = 0), "number" == typeof e) for (a = t; a < i; ++a) this[a] = e; else { var s = u.isBuffer(e) ? e : F(new u(e, r).toString()), o = s.length; for (a = 0; a < i - t; ++a) this[a + t] = s[a % o] } return this }; var N = /[^+\/0-9A-Za-z-_]/g; function B(e) { return e < 16 ? "0" + e.toString(16) : e.toString(16) } function F(e, t) { var i; t = t || 1 / 0; for (var r = e.length, n = null, a = [], s = 0; s < r; ++s) { if ((i = e.charCodeAt(s)) > 55295 && i < 57344) { if (!n) { if (i > 56319) { (t -= 3) > -1 && a.push(239, 191, 189); continue } if (s + 1 === r) { (t -= 3) > -1 && a.push(239, 191, 189); continue } n = i; continue } if (i < 56320) { (t -= 3) > -1 && a.push(239, 191, 189), n = i; continue } i = 65536 + (n - 55296 << 10 | i - 56320) } else n && (t -= 3) > -1 && a.push(239, 191, 189); if (n = null, i < 128) { if ((t -= 1) < 0) break; a.push(i) } else if (i < 2048) { if ((t -= 2) < 0) break; a.push(i >> 6 | 192, 63 & i | 128) } else if (i < 65536) { if ((t -= 3) < 0) break; a.push(i >> 12 | 224, i >> 6 & 63 | 128, 63 & i | 128) } else { if (!(i < 1114112)) throw new Error("Invalid code point"); if ((t -= 4) < 0) break; a.push(i >> 18 | 240, i >> 12 & 63 | 128, i >> 6 & 63 | 128, 63 & i | 128) } } return a } function j(e) { return r.toByteArray(function(e) { if ((e = function(e) { return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "") }(e).replace(N, "")).length < 2) return ""; for (; e.length % 4 != 0;) e += "="; return e }(e)) } function H(e, t, i, r) { for (var n = 0; n < r && !(n + i >= t.length || n >= e.length); ++n) t[n + i] = e[n]; return n } }).call(this, i(13)) }, function(e, t, i) { (function(e) { ! function(e, t) { "use strict"; function r(e, t) { if (!e) throw new Error(t || "Assertion failed") } function n(e, t) { e.super_ = t; var i = function() {}; i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e } function a(e, t, i) { if (a.isBN(e)) return e; this.negative = 0, this.words = null, this.length = 0, this.red = null, null !== e && ("le" !== t && "be" !== t || (i = t, t = 10), this._init(e || 0, t || 10, i || "be")) } var s; "object" == typeof e ? e.exports = a : t.BN = a, a.BN = a, a.wordSize = 26; try { s = "undefined" != typeof window && void 0 !== window.Buffer ? window.Buffer : i(178).Buffer } catch (e) {} function o(e, t) { var i = e.charCodeAt(t); return i >= 65 && i <= 70 ? i - 55 : i >= 97 && i <= 102 ? i - 87 : i - 48 & 15 } function u(e, t, i) { var r = o(e, i); return i - 1 >= t && (r |= o(e, i - 1) << 4), r } function l(e, t, i, r) { for (var n = 0, a = Math.min(e.length, i), s = t; s < a; s++) { var o = e.charCodeAt(s) - 48; n *= r, n += o >= 49 ? o - 49 + 10 : o >= 17 ? o - 17 + 10 : o } return n } a.isBN = function(e) { return e instanceof a || null !== e && "object" == typeof e && e.constructor.wordSize === a .wordSize && Array.isArray(e.words) }, a.max = function(e, t) { return e.cmp(t) > 0 ? e : t }, a.min = function(e, t) { return e.cmp(t) < 0 ? e : t }, a.prototype._init = function(e, t, i) { if ("number" == typeof e) return this._initNumber(e, t, i); if ("object" == typeof e) return this._initArray(e, t, i); "hex" === t && (t = 16), r(t === (0 | t) && t >= 2 && t <= 36); var n = 0; "-" === (e = e.toString().replace(/\s+/g, ""))[0] && (n++, this.negative = 1), n < e.length && ( 16 === t ? this._parseHex(e, n, i) : (this._parseBase(e, t, n), "le" === i && this._initArray( this.toArray(), t, i))) }, a.prototype._initNumber = function(e, t, i) { e < 0 && (this.negative = 1, e = -e), e < 67108864 ? (this.words = [67108863 & e], this.length = 1) : e < 4503599627370496 ? (this.words = [67108863 & e, e / 67108864 & 67108863], this .length = 2) : (r(e < 9007199254740992), this.words = [67108863 & e, e / 67108864 & 67108863, 1 ], this.length = 3), "le" === i && this._initArray(this.toArray(), t, i) }, a.prototype._initArray = function(e, t, i) { if (r("number" == typeof e.length), e.length <= 0) return this.words = [0], this.length = 1, this; this.length = Math.ceil(e.length / 3), this.words = new Array(this.length); for (var n = 0; n < this.length; n++) this.words[n] = 0; var a, s, o = 0; if ("be" === i) for (n = e.length - 1, a = 0; n >= 0; n -= 3) s = e[n] | e[n - 1] << 8 | e[n - 2] << 16, this .words[a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && (o -= 26, a++); else if ("le" === i) for (n = 0, a = 0; n < e.length; n += 3) s = e[n] | e[n + 1] << 8 | e[n + 2] << 16, this.words[ a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && ( o -= 26, a++); return this.strip() }, a.prototype._parseHex = function(e, t, i) { this.length = Math.ceil((e.length - t) / 6), this.words = new Array(this.length); for (var r = 0; r < this.length; r++) this.words[r] = 0; var n, a = 0, s = 0; if ("be" === i) for (r = e.length - 1; r >= t; r -= 2) n = u(e, t, r) << a, this.words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8; else for (r = (e.length - t) % 2 == 0 ? t + 1 : t; r < e.length; r += 2) n = u(e, t, r) << a, this .words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8; this.strip() }, a.prototype._parseBase = function(e, t, i) { this.words = [0], this.length = 1; for (var r = 0, n = 1; n <= 67108863; n *= t) r++; r--, n = n / t | 0; for (var a = e.length - i, s = a % r, o = Math.min(a, a - s) + i, u = 0, d = i; d < o; d += r) u = l(e, d, d + r, t), this.imuln(n), this.words[0] + u < 67108864 ? this.words[0] += u : this ._iaddn(u); if (0 !== s) { var c = 1; for (u = l(e, d, e.length, t), d = 0; d < s; d++) c *= t; this.imuln(c), this.words[0] + u < 67108864 ? this.words[0] += u : this._iaddn(u) } this.strip() }, a.prototype.copy = function(e) { e.words = new Array(this.length); for (var t = 0; t < this.length; t++) e.words[t] = this.words[t]; e.length = this.length, e.negative = this.negative, e.red = this.red }, a.prototype.clone = function() { var e = new a(null); return this.copy(e), e }, a.prototype._expand = function(e) { for (; this.length < e;) this.words[this.length++] = 0; return this }, a.prototype.strip = function() { for (; this.length > 1 && 0 === this.words[this.length - 1];) this.length--; return this._normSign() }, a.prototype._normSign = function() { return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this }, a.prototype.inspect = function() { return (this.red ? "" }; var d = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000", "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000", "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000", "00000000000000000000", "000000000000000000000", "0000000000000000000000", "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000" ], c = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ], h = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 ]; function f(e, t, i) { i.negative = t.negative ^ e.negative; var r = e.length + t.length | 0; i.length = r, r = r - 1 | 0; var n = 0 | e.words[0], a = 0 | t.words[0], s = n * a, o = 67108863 & s, u = s / 67108864 | 0; i.words[0] = o; for (var l = 1; l < r; l++) { for (var d = u >>> 26, c = 67108863 & u, h = Math.min(l, t.length - 1), f = Math.max(0, l - e .length + 1); f <= h; f++) { var p = l - f | 0; d += (s = (n = 0 | e.words[p]) * (a = 0 | t.words[f]) + c) / 67108864 | 0, c = 67108863 & s } i.words[l] = 0 | c, u = 0 | d } return 0 !== u ? i.words[l] = 0 | u : i.length--, i.strip() } a.prototype.toString = function(e, t) { var i; if (t = 0 | t || 1, 16 === (e = e || 10) || "hex" === e) { i = ""; for (var n = 0, a = 0, s = 0; s < this.length; s++) { var o = this.words[s], u = (16777215 & (o << n | a)).toString(16); i = 0 != (a = o >>> 24 - n & 16777215) || s !== this.length - 1 ? d[6 - u.length] + u + i : u + i, (n += 2) >= 26 && (n -= 26, s--) } for (0 !== a && (i = a.toString(16) + i); i.length % t != 0;) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i } if (e === (0 | e) && e >= 2 && e <= 36) { var l = c[e], f = h[e]; i = ""; var p = this.clone(); for (p.negative = 0; !p.isZero();) { var m = p.modn(f).toString(e); i = (p = p.idivn(f)).isZero() ? m + i : d[l - m.length] + m + i } for (this.isZero() && (i = "0" + i); i.length % t != 0;) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i } r(!1, "Base should be between 2 and 36") }, a.prototype.toNumber = function() { var e = this.words[0]; return 2 === this.length ? e += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[ 2] ? e += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && r(!1, "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e }, a.prototype.toJSON = function() { return this.toString(16) }, a.prototype.toBuffer = function(e, t) { return r(void 0 !== s), this.toArrayLike(s, e, t) }, a.prototype.toArray = function(e, t) { return this.toArrayLike(Array, e, t) }, a.prototype.toArrayLike = function(e, t, i) { var n = this.byteLength(), a = i || Math.max(1, n); r(n <= a, "byte array longer than desired length"), r(a > 0, "Requested array length <= 0"), this .strip(); var s, o, u = "le" === t, l = new e(a), d = this.clone(); if (u) { for (o = 0; !d.isZero(); o++) s = d.andln(255), d.iushrn(8), l[o] = s; for (; o < a; o++) l[o] = 0 } else { for (o = 0; o < a - n; o++) l[o] = 0; for (o = 0; !d.isZero(); o++) s = d.andln(255), d.iushrn(8), l[a - o - 1] = s } return l }, Math.clz32 ? a.prototype._countBits = function(e) { return 32 - Math.clz32(e) } : a.prototype._countBits = function(e) { var t = e, i = 0; return t >= 4096 && (i += 13, t >>>= 13), t >= 64 && (i += 7, t >>>= 7), t >= 8 && (i += 4, t >>>= 4), t >= 2 && (i += 2, t >>>= 2), i + t }, a.prototype._zeroBits = function(e) { if (0 === e) return 26; var t = e, i = 0; return 0 == (8191 & t) && (i += 13, t >>>= 13), 0 == (127 & t) && (i += 7, t >>>= 7), 0 == (15 & t) && (i += 4, t >>>= 4), 0 == (3 & t) && (i += 2, t >>>= 2), 0 == (1 & t) && i++, i }, a.prototype.bitLength = function() { var e = this.words[this.length - 1], t = this._countBits(e); return 26 * (this.length - 1) + t }, a.prototype.zeroBits = function() { if (this.isZero()) return 0; for (var e = 0, t = 0; t < this.length; t++) { var i = this._zeroBits(this.words[t]); if (e += i, 26 !== i) break } return e }, a.prototype.byteLength = function() { return Math.ceil(this.bitLength() / 8) }, a.prototype.toTwos = function(e) { return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone() }, a.prototype.fromTwos = function(e) { return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone() }, a.prototype.isNeg = function() { return 0 !== this.negative }, a.prototype.neg = function() { return this.clone().ineg() }, a.prototype.ineg = function() { return this.isZero() || (this.negative ^= 1), this }, a.prototype.iuor = function(e) { for (; this.length < e.length;) this.words[this.length++] = 0; for (var t = 0; t < e.length; t++) this.words[t] = this.words[t] | e.words[t]; return this.strip() }, a.prototype.ior = function(e) { return r(0 == (this.negative | e.negative)), this.iuor(e) }, a.prototype.or = function(e) { return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this) }, a.prototype.uor = function(e) { return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this) }, a.prototype.iuand = function(e) { var t; t = this.length > e.length ? e : this; for (var i = 0; i < t.length; i++) this.words[i] = this.words[i] & e.words[i]; return this.length = t.length, this.strip() }, a.prototype.iand = function(e) { return r(0 == (this.negative | e.negative)), this.iuand(e) }, a.prototype.and = function(e) { return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this) }, a.prototype.uand = function(e) { return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this) }, a.prototype.iuxor = function(e) { var t, i; this.length > e.length ? (t = this, i = e) : (t = e, i = this); for (var r = 0; r < i.length; r++) this.words[r] = t.words[r] ^ i.words[r]; if (this !== t) for (; r < t.length; r++) this.words[r] = t.words[r]; return this.length = t.length, this.strip() }, a.prototype.ixor = function(e) { return r(0 == (this.negative | e.negative)), this.iuxor(e) }, a.prototype.xor = function(e) { return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this) }, a.prototype.uxor = function(e) { return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this) }, a.prototype.inotn = function(e) { r("number" == typeof e && e >= 0); var t = 0 | Math.ceil(e / 26), i = e % 26; this._expand(t), i > 0 && t--; for (var n = 0; n < t; n++) this.words[n] = 67108863 & ~this.words[n]; return i > 0 && (this.words[n] = ~this.words[n] & 67108863 >> 26 - i), this.strip() }, a.prototype.notn = function(e) { return this.clone().inotn(e) }, a.prototype.setn = function(e, t) { r("number" == typeof e && e >= 0); var i = e / 26 | 0, n = e % 26; return this._expand(i + 1), this.words[i] = t ? this.words[i] | 1 << n : this.words[i] & ~(1 << n), this.strip() }, a.prototype.iadd = function(e) { var t, i, r; if (0 !== this.negative && 0 === e.negative) return this.negative = 0, t = this.isub(e), this .negative ^= 1, this._normSign(); if (0 === this.negative && 0 !== e.negative) return e.negative = 0, t = this.isub(e), e.negative = 1, t._normSign(); this.length > e.length ? (i = this, r = e) : (i = e, r = this); for (var n = 0, a = 0; a < r.length; a++) t = (0 | i.words[a]) + (0 | r.words[a]) + n, this.words[ a] = 67108863 & t, n = t >>> 26; for (; 0 !== n && a < i.length; a++) t = (0 | i.words[a]) + n, this.words[a] = 67108863 & t, n = t >>> 26; if (this.length = i.length, 0 !== n) this.words[this.length] = n, this.length++; else if (i !== this) for (; a < i.length; a++) this.words[a] = i.words[a]; return this }, a.prototype.add = function(e) { var t; return 0 !== e.negative && 0 === this.negative ? (e.negative = 0, t = this.sub(e), e.negative ^= 1, t) : 0 === e.negative && 0 !== this.negative ? (this.negative = 0, t = e.sub(this), this .negative = 1, t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this) }, a.prototype.isub = function(e) { if (0 !== e.negative) { e.negative = 0; var t = this.iadd(e); return e.negative = 1, t._normSign() } if (0 !== this.negative) return this.negative = 0, this.iadd(e), this.negative = 1, this ._normSign(); var i, r, n = this.cmp(e); if (0 === n) return this.negative = 0, this.length = 1, this.words[0] = 0, this; n > 0 ? (i = this, r = e) : (i = e, r = this); for (var a = 0, s = 0; s < r.length; s++) a = (t = (0 | i.words[s]) - (0 | r.words[s]) + a) >> 26, this.words[s] = 67108863 & t; for (; 0 !== a && s < i.length; s++) a = (t = (0 | i.words[s]) + a) >> 26, this.words[s] = 67108863 & t; if (0 === a && s < i.length && i !== this) for (; s < i.length; s++) this.words[s] = i.words[s]; return this.length = Math.max(this.length, s), i !== this && (this.negative = 1), this.strip() }, a.prototype.sub = function(e) { return this.clone().isub(e) }; var p = function(e, t, i) { var r, n, a, s = e.words, o = t.words, u = i.words, l = 0, d = 0 | s[0], c = 8191 & d, h = d >>> 13, f = 0 | s[1], p = 8191 & f, m = f >>> 13, g = 0 | s[2], v = 8191 & g, y = g >>> 13, _ = 0 | s[3], b = 8191 & _, w = _ >>> 13, E = 0 | s[4], T = 8191 & E, S = E >>> 13, A = 0 | s[5], k = 8191 & A, R = A >>> 13, M = 0 | s[6], O = 8191 & M, C = M >>> 13, D = 0 | s[7], I = 8191 & D, L = D >>> 13, x = 0 | s[8], P = 8191 & x, U = x >>> 13, N = 0 | s[9], B = 8191 & N, F = N >>> 13, j = 0 | o[0], H = 8191 & j, G = j >>> 13, V = 0 | o[1], W = 8191 & V, q = V >>> 13, X = 0 | o[2], z = 8191 & X, K = X >>> 13, Y = 0 | o[3], Q = 8191 & Y, J = Y >>> 13, Z = 0 | o[4], $ = 8191 & Z, ee = Z >>> 13, te = 0 | o[5], ie = 8191 & te, re = te >>> 13, ne = 0 | o[6], ae = 8191 & ne, se = ne >>> 13, oe = 0 | o[7], ue = 8191 & oe, le = oe >>> 13, de = 0 | o[8], ce = 8191 & de, he = de >>> 13, fe = 0 | o[9], pe = 8191 & fe, me = fe >>> 13; i.negative = e.negative ^ t.negative, i.length = 19; var ge = (l + (r = Math.imul(c, H)) | 0) + ((8191 & (n = (n = Math.imul(c, G)) + Math.imul(h, H) | 0)) << 13) | 0; l = ((a = Math.imul(h, G)) + (n >>> 13) | 0) + (ge >>> 26) | 0, ge &= 67108863, r = Math.imul(p, H), n = (n = Math.imul(p, G)) + Math.imul(m, H) | 0, a = Math.imul(m, G); var ve = (l + (r = r + Math.imul(c, W) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, q) | 0) + Math.imul(h, W) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, q) | 0) + (n >>> 13) | 0) + (ve >>> 26) | 0, ve &= 67108863, r = Math .imul(v, H), n = (n = Math.imul(v, G)) + Math.imul(y, H) | 0, a = Math.imul(y, G), r = r + Math .imul(p, W) | 0, n = (n = n + Math.imul(p, q) | 0) + Math.imul(m, W) | 0, a = a + Math.imul(m, q) | 0; var ye = (l + (r = r + Math.imul(c, z) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, K) | 0) + Math.imul(h, z) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, K) | 0) + (n >>> 13) | 0) + (ye >>> 26) | 0, ye &= 67108863, r = Math .imul(b, H), n = (n = Math.imul(b, G)) + Math.imul(w, H) | 0, a = Math.imul(w, G), r = r + Math .imul(v, W) | 0, n = (n = n + Math.imul(v, q) | 0) + Math.imul(y, W) | 0, a = a + Math.imul(y, q) | 0, r = r + Math.imul(p, z) | 0, n = (n = n + Math.imul(p, K) | 0) + Math.imul(m, z) | 0, a = a + Math.imul(m, K) | 0; var _e = (l + (r = r + Math.imul(c, Q) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, J) | 0) + Math.imul(h, Q) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, J) | 0) + (n >>> 13) | 0) + (_e >>> 26) | 0, _e &= 67108863, r = Math .imul(T, H), n = (n = Math.imul(T, G)) + Math.imul(S, H) | 0, a = Math.imul(S, G), r = r + Math .imul(b, W) | 0, n = (n = n + Math.imul(b, q) | 0) + Math.imul(w, W) | 0, a = a + Math.imul(w, q) | 0, r = r + Math.imul(v, z) | 0, n = (n = n + Math.imul(v, K) | 0) + Math.imul(y, z) | 0, a = a + Math.imul(y, K) | 0, r = r + Math.imul(p, Q) | 0, n = (n = n + Math.imul(p, J) | 0) + Math.imul(m, Q) | 0, a = a + Math.imul(m, J) | 0; var be = (l + (r = r + Math.imul(c, $) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, ee) | 0) + Math.imul(h, $) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, ee) | 0) + (n >>> 13) | 0) + (be >>> 26) | 0, be &= 67108863, r = Math .imul(k, H), n = (n = Math.imul(k, G)) + Math.imul(R, H) | 0, a = Math.imul(R, G), r = r + Math .imul(T, W) | 0, n = (n = n + Math.imul(T, q) | 0) + Math.imul(S, W) | 0, a = a + Math.imul(S, q) | 0, r = r + Math.imul(b, z) | 0, n = (n = n + Math.imul(b, K) | 0) + Math.imul(w, z) | 0, a = a + Math.imul(w, K) | 0, r = r + Math.imul(v, Q) | 0, n = (n = n + Math.imul(v, J) | 0) + Math.imul(y, Q) | 0, a = a + Math.imul(y, J) | 0, r = r + Math.imul(p, $) | 0, n = (n = n + Math .imul(p, ee) | 0) + Math.imul(m, $) | 0, a = a + Math.imul(m, ee) | 0; var we = (l + (r = r + Math.imul(c, ie) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, re) | 0) + Math.imul(h, ie) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, re) | 0) + (n >>> 13) | 0) + (we >>> 26) | 0, we &= 67108863, r = Math .imul(O, H), n = (n = Math.imul(O, G)) + Math.imul(C, H) | 0, a = Math.imul(C, G), r = r + Math .imul(k, W) | 0, n = (n = n + Math.imul(k, q) | 0) + Math.imul(R, W) | 0, a = a + Math.imul(R, q) | 0, r = r + Math.imul(T, z) | 0, n = (n = n + Math.imul(T, K) | 0) + Math.imul(S, z) | 0, a = a + Math.imul(S, K) | 0, r = r + Math.imul(b, Q) | 0, n = (n = n + Math.imul(b, J) | 0) + Math.imul(w, Q) | 0, a = a + Math.imul(w, J) | 0, r = r + Math.imul(v, $) | 0, n = (n = n + Math .imul(v, ee) | 0) + Math.imul(y, $) | 0, a = a + Math.imul(y, ee) | 0, r = r + Math.imul(p, ie) | 0, n = (n = n + Math.imul(p, re) | 0) + Math.imul(m, ie) | 0, a = a + Math.imul(m, re) | 0; var Ee = (l + (r = r + Math.imul(c, ae) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, se) | 0) + Math.imul(h, ae) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, se) | 0) + (n >>> 13) | 0) + (Ee >>> 26) | 0, Ee &= 67108863, r = Math .imul(I, H), n = (n = Math.imul(I, G)) + Math.imul(L, H) | 0, a = Math.imul(L, G), r = r + Math .imul(O, W) | 0, n = (n = n + Math.imul(O, q) | 0) + Math.imul(C, W) | 0, a = a + Math.imul(C, q) | 0, r = r + Math.imul(k, z) | 0, n = (n = n + Math.imul(k, K) | 0) + Math.imul(R, z) | 0, a = a + Math.imul(R, K) | 0, r = r + Math.imul(T, Q) | 0, n = (n = n + Math.imul(T, J) | 0) + Math.imul(S, Q) | 0, a = a + Math.imul(S, J) | 0, r = r + Math.imul(b, $) | 0, n = (n = n + Math .imul(b, ee) | 0) + Math.imul(w, $) | 0, a = a + Math.imul(w, ee) | 0, r = r + Math.imul(v, ie) | 0, n = (n = n + Math.imul(v, re) | 0) + Math.imul(y, ie) | 0, a = a + Math.imul(y, re) | 0, r = r + Math.imul(p, ae) | 0, n = (n = n + Math.imul(p, se) | 0) + Math.imul(m, ae) | 0, a = a + Math.imul(m, se) | 0; var Te = (l + (r = r + Math.imul(c, ue) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, le) | 0) + Math.imul(h, ue) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, le) | 0) + (n >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, r = Math .imul(P, H), n = (n = Math.imul(P, G)) + Math.imul(U, H) | 0, a = Math.imul(U, G), r = r + Math .imul(I, W) | 0, n = (n = n + Math.imul(I, q) | 0) + Math.imul(L, W) | 0, a = a + Math.imul(L, q) | 0, r = r + Math.imul(O, z) | 0, n = (n = n + Math.imul(O, K) | 0) + Math.imul(C, z) | 0, a = a + Math.imul(C, K) | 0, r = r + Math.imul(k, Q) | 0, n = (n = n + Math.imul(k, J) | 0) + Math.imul(R, Q) | 0, a = a + Math.imul(R, J) | 0, r = r + Math.imul(T, $) | 0, n = (n = n + Math .imul(T, ee) | 0) + Math.imul(S, $) | 0, a = a + Math.imul(S, ee) | 0, r = r + Math.imul(b, ie) | 0, n = (n = n + Math.imul(b, re) | 0) + Math.imul(w, ie) | 0, a = a + Math.imul(w, re) | 0, r = r + Math.imul(v, ae) | 0, n = (n = n + Math.imul(v, se) | 0) + Math.imul(y, ae) | 0, a = a + Math.imul(y, se) | 0, r = r + Math.imul(p, ue) | 0, n = (n = n + Math.imul(p, le) | 0) + Math.imul(m, ue) | 0, a = a + Math.imul(m, le) | 0; var Se = (l + (r = r + Math.imul(c, ce) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, he) | 0) + Math.imul(h, ce) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, he) | 0) + (n >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, r = Math .imul(B, H), n = (n = Math.imul(B, G)) + Math.imul(F, H) | 0, a = Math.imul(F, G), r = r + Math .imul(P, W) | 0, n = (n = n + Math.imul(P, q) | 0) + Math.imul(U, W) | 0, a = a + Math.imul(U, q) | 0, r = r + Math.imul(I, z) | 0, n = (n = n + Math.imul(I, K) | 0) + Math.imul(L, z) | 0, a = a + Math.imul(L, K) | 0, r = r + Math.imul(O, Q) | 0, n = (n = n + Math.imul(O, J) | 0) + Math.imul(C, Q) | 0, a = a + Math.imul(C, J) | 0, r = r + Math.imul(k, $) | 0, n = (n = n + Math .imul(k, ee) | 0) + Math.imul(R, $) | 0, a = a + Math.imul(R, ee) | 0, r = r + Math.imul(T, ie) | 0, n = (n = n + Math.imul(T, re) | 0) + Math.imul(S, ie) | 0, a = a + Math.imul(S, re) | 0, r = r + Math.imul(b, ae) | 0, n = (n = n + Math.imul(b, se) | 0) + Math.imul(w, ae) | 0, a = a + Math.imul(w, se) | 0, r = r + Math.imul(v, ue) | 0, n = (n = n + Math.imul(v, le) | 0) + Math.imul(y, ue) | 0, a = a + Math.imul(y, le) | 0, r = r + Math.imul(p, ce) | 0, n = (n = n + Math.imul(p, he) | 0) + Math.imul(m, ce) | 0, a = a + Math.imul(m, he) | 0; var Ae = (l + (r = r + Math.imul(c, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, me) | 0) + Math.imul(h, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, me) | 0) + (n >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, r = Math .imul(B, W), n = (n = Math.imul(B, q)) + Math.imul(F, W) | 0, a = Math.imul(F, q), r = r + Math .imul(P, z) | 0, n = (n = n + Math.imul(P, K) | 0) + Math.imul(U, z) | 0, a = a + Math.imul(U, K) | 0, r = r + Math.imul(I, Q) | 0, n = (n = n + Math.imul(I, J) | 0) + Math.imul(L, Q) | 0, a = a + Math.imul(L, J) | 0, r = r + Math.imul(O, $) | 0, n = (n = n + Math.imul(O, ee) | 0) + Math.imul(C, $) | 0, a = a + Math.imul(C, ee) | 0, r = r + Math.imul(k, ie) | 0, n = (n = n + Math.imul(k, re) | 0) + Math.imul(R, ie) | 0, a = a + Math.imul(R, re) | 0, r = r + Math.imul( T, ae) | 0, n = (n = n + Math.imul(T, se) | 0) + Math.imul(S, ae) | 0, a = a + Math.imul(S, se) | 0, r = r + Math.imul(b, ue) | 0, n = (n = n + Math.imul(b, le) | 0) + Math.imul(w, ue) | 0, a = a + Math.imul(w, le) | 0, r = r + Math.imul(v, ce) | 0, n = (n = n + Math.imul(v, he) | 0) + Math.imul(y, ce) | 0, a = a + Math.imul(y, he) | 0; var ke = (l + (r = r + Math.imul(p, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(p, me) | 0) + Math.imul(m, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(m, me) | 0) + (n >>> 13) | 0) + (ke >>> 26) | 0, ke &= 67108863, r = Math .imul(B, z), n = (n = Math.imul(B, K)) + Math.imul(F, z) | 0, a = Math.imul(F, K), r = r + Math .imul(P, Q) | 0, n = (n = n + Math.imul(P, J) | 0) + Math.imul(U, Q) | 0, a = a + Math.imul(U, J) | 0, r = r + Math.imul(I, $) | 0, n = (n = n + Math.imul(I, ee) | 0) + Math.imul(L, $) | 0, a = a + Math.imul(L, ee) | 0, r = r + Math.imul(O, ie) | 0, n = (n = n + Math.imul(O, re) | 0) + Math.imul(C, ie) | 0, a = a + Math.imul(C, re) | 0, r = r + Math.imul(k, ae) | 0, n = (n = n + Math.imul(k, se) | 0) + Math.imul(R, ae) | 0, a = a + Math.imul(R, se) | 0, r = r + Math.imul( T, ue) | 0, n = (n = n + Math.imul(T, le) | 0) + Math.imul(S, ue) | 0, a = a + Math.imul(S, le) | 0, r = r + Math.imul(b, ce) | 0, n = (n = n + Math.imul(b, he) | 0) + Math.imul(w, ce) | 0, a = a + Math.imul(w, he) | 0; var Re = (l + (r = r + Math.imul(v, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(v, me) | 0) + Math.imul(y, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(y, me) | 0) + (n >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, r = Math .imul(B, Q), n = (n = Math.imul(B, J)) + Math.imul(F, Q) | 0, a = Math.imul(F, J), r = r + Math .imul(P, $) | 0, n = (n = n + Math.imul(P, ee) | 0) + Math.imul(U, $) | 0, a = a + Math.imul(U, ee) | 0, r = r + Math.imul(I, ie) | 0, n = (n = n + Math.imul(I, re) | 0) + Math.imul(L, ie) | 0, a = a + Math.imul(L, re) | 0, r = r + Math.imul(O, ae) | 0, n = (n = n + Math.imul(O, se) | 0) + Math.imul(C, ae) | 0, a = a + Math.imul(C, se) | 0, r = r + Math.imul(k, ue) | 0, n = ( n = n + Math.imul(k, le) | 0) + Math.imul(R, ue) | 0, a = a + Math.imul(R, le) | 0, r = r + Math.imul(T, ce) | 0, n = (n = n + Math.imul(T, he) | 0) + Math.imul(S, ce) | 0, a = a + Math .imul(S, he) | 0; var Me = (l + (r = r + Math.imul(b, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(b, me) | 0) + Math.imul(w, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(w, me) | 0) + (n >>> 13) | 0) + (Me >>> 26) | 0, Me &= 67108863, r = Math .imul(B, $), n = (n = Math.imul(B, ee)) + Math.imul(F, $) | 0, a = Math.imul(F, ee), r = r + Math.imul(P, ie) | 0, n = (n = n + Math.imul(P, re) | 0) + Math.imul(U, ie) | 0, a = a + Math .imul(U, re) | 0, r = r + Math.imul(I, ae) | 0, n = (n = n + Math.imul(I, se) | 0) + Math.imul( L, ae) | 0, a = a + Math.imul(L, se) | 0, r = r + Math.imul(O, ue) | 0, n = (n = n + Math .imul(O, le) | 0) + Math.imul(C, ue) | 0, a = a + Math.imul(C, le) | 0, r = r + Math.imul(k, ce) | 0, n = (n = n + Math.imul(k, he) | 0) + Math.imul(R, ce) | 0, a = a + Math.imul(R, he) | 0; var Oe = (l + (r = r + Math.imul(T, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(T, me) | 0) + Math.imul(S, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(S, me) | 0) + (n >>> 13) | 0) + (Oe >>> 26) | 0, Oe &= 67108863, r = Math .imul(B, ie), n = (n = Math.imul(B, re)) + Math.imul(F, ie) | 0, a = Math.imul(F, re), r = r + Math.imul(P, ae) | 0, n = (n = n + Math.imul(P, se) | 0) + Math.imul(U, ae) | 0, a = a + Math .imul(U, se) | 0, r = r + Math.imul(I, ue) | 0, n = (n = n + Math.imul(I, le) | 0) + Math.imul( L, ue) | 0, a = a + Math.imul(L, le) | 0, r = r + Math.imul(O, ce) | 0, n = (n = n + Math .imul(O, he) | 0) + Math.imul(C, ce) | 0, a = a + Math.imul(C, he) | 0; var Ce = (l + (r = r + Math.imul(k, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(k, me) | 0) + Math.imul(R, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(R, me) | 0) + (n >>> 13) | 0) + (Ce >>> 26) | 0, Ce &= 67108863, r = Math .imul(B, ae), n = (n = Math.imul(B, se)) + Math.imul(F, ae) | 0, a = Math.imul(F, se), r = r + Math.imul(P, ue) | 0, n = (n = n + Math.imul(P, le) | 0) + Math.imul(U, ue) | 0, a = a + Math .imul(U, le) | 0, r = r + Math.imul(I, ce) | 0, n = (n = n + Math.imul(I, he) | 0) + Math.imul( L, ce) | 0, a = a + Math.imul(L, he) | 0; var De = (l + (r = r + Math.imul(O, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(O, me) | 0) + Math.imul(C, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(C, me) | 0) + (n >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, r = Math .imul(B, ue), n = (n = Math.imul(B, le)) + Math.imul(F, ue) | 0, a = Math.imul(F, le), r = r + Math.imul(P, ce) | 0, n = (n = n + Math.imul(P, he) | 0) + Math.imul(U, ce) | 0, a = a + Math .imul(U, he) | 0; var Ie = (l + (r = r + Math.imul(I, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(I, me) | 0) + Math.imul(L, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(L, me) | 0) + (n >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, r = Math .imul(B, ce), n = (n = Math.imul(B, he)) + Math.imul(F, ce) | 0, a = Math.imul(F, he); var Le = (l + (r = r + Math.imul(P, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(P, me) | 0) + Math.imul(U, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(U, me) | 0) + (n >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863; var xe = (l + (r = Math.imul(B, pe)) | 0) + ((8191 & (n = (n = Math.imul(B, me)) + Math.imul(F, pe) | 0)) << 13) | 0; return l = ((a = Math.imul(F, me)) + (n >>> 13) | 0) + (xe >>> 26) | 0, xe &= 67108863, u[0] = ge, u[1] = ve, u[2] = ye, u[3] = _e, u[4] = be, u[5] = we, u[6] = Ee, u[7] = Te, u[8] = Se, u[9] = Ae, u[10] = ke, u[11] = Re, u[12] = Me, u[13] = Oe, u[14] = Ce, u[15] = De, u[16] = Ie, u[17] = Le, u[18] = xe, 0 !== l && (u[19] = l, i.length++), i }; function m(e, t, i) { return (new g).mulp(e, t, i) } function g(e, t) { this.x = e, this.y = t } Math.imul || (p = f), a.prototype.mulTo = function(e, t) { var i = this.length + e.length; return 10 === this.length && 10 === e.length ? p(this, e, t) : i < 63 ? f(this, e, t) : i < 1024 ? function(e, t, i) { i.negative = t.negative ^ e.negative, i.length = e.length + t.length; for (var r = 0, n = 0, a = 0; a < i.length - 1; a++) { var s = n; n = 0; for (var o = 67108863 & r, u = Math.min(a, t.length - 1), l = Math.max(0, a - e.length + 1); l <= u; l++) { var d = a - l, c = (0 | e.words[d]) * (0 | t.words[l]), h = 67108863 & c; o = 67108863 & (h = h + o | 0), n += (s = (s = s + (c / 67108864 | 0) | 0) + (h >>> 26) | 0) >>> 26, s &= 67108863 } i.words[a] = o, r = s, s = n } return 0 !== r ? i.words[a] = r : i.length--, i.strip() }(this, e, t) : m(this, e, t) }, g.prototype.makeRBT = function(e) { for (var t = new Array(e), i = a.prototype._countBits(e) - 1, r = 0; r < e; r++) t[r] = this .revBin(r, i, e); return t }, g.prototype.revBin = function(e, t, i) { if (0 === e || e === i - 1) return e; for (var r = 0, n = 0; n < t; n++) r |= (1 & e) << t - n - 1, e >>= 1; return r }, g.prototype.permute = function(e, t, i, r, n, a) { for (var s = 0; s < a; s++) r[s] = t[e[s]], n[s] = i[e[s]] }, g.prototype.transform = function(e, t, i, r, n, a) { this.permute(a, e, t, i, r, n); for (var s = 1; s < n; s <<= 1) for (var o = s << 1, u = Math.cos(2 * Math.PI / o), l = Math.sin(2 * Math.PI / o), d = 0; d < n; d += o) for (var c = u, h = l, f = 0; f < s; f++) { var p = i[d + f], m = r[d + f], g = i[d + f + s], v = r[d + f + s], y = c * g - h * v; v = c * v + h * g, g = y, i[d + f] = p + g, r[d + f] = m + v, i[d + f + s] = p - g, r[d + f + s] = m - v, f !== o && (y = u * c - l * h, h = u * h + l * c, c = y) } }, g.prototype.guessLen13b = function(e, t) { var i = 1 | Math.max(t, e), r = 1 & i, n = 0; for (i = i / 2 | 0; i; i >>>= 1) n++; return 1 << n + 1 + r }, g.prototype.conjugate = function(e, t, i) { if (!(i <= 1)) for (var r = 0; r < i / 2; r++) { var n = e[r]; e[r] = e[i - r - 1], e[i - r - 1] = n, n = t[r], t[r] = -t[i - r - 1], t[i - r - 1] = -n } }, g.prototype.normalize13b = function(e, t) { for (var i = 0, r = 0; r < t / 2; r++) { var n = 8192 * Math.round(e[2 * r + 1] / t) + Math.round(e[2 * r] / t) + i; e[r] = 67108863 & n, i = n < 67108864 ? 0 : n / 67108864 | 0 } return e }, g.prototype.convert13b = function(e, t, i, n) { for (var a = 0, s = 0; s < t; s++) a += 0 | e[s], i[2 * s] = 8191 & a, a >>>= 13, i[2 * s + 1] = 8191 & a, a >>>= 13; for (s = 2 * t; s < n; ++s) i[s] = 0; r(0 === a), r(0 == (-8192 & a)) }, g.prototype.stub = function(e) { for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0; return t }, g.prototype.mulp = function(e, t, i) { var r = 2 * this.guessLen13b(e.length, t.length), n = this.makeRBT(r), a = this.stub(r), s = new Array(r), o = new Array(r), u = new Array(r), l = new Array(r), d = new Array(r), c = new Array(r), h = i.words; h.length = r, this.convert13b(e.words, e.length, s, r), this.convert13b(t.words, t.length, l, r), this.transform(s, a, o, u, r, n), this.transform(l, a, d, c, r, n); for (var f = 0; f < r; f++) { var p = o[f] * d[f] - u[f] * c[f]; u[f] = o[f] * c[f] + u[f] * d[f], o[f] = p } return this.conjugate(o, u, r), this.transform(o, u, h, a, r, n), this.conjugate(h, a, r), this .normalize13b(h, r), i.negative = e.negative ^ t.negative, i.length = e.length + t.length, i .strip() }, a.prototype.mul = function(e) { var t = new a(null); return t.words = new Array(this.length + e.length), this.mulTo(e, t) }, a.prototype.mulf = function(e) { var t = new a(null); return t.words = new Array(this.length + e.length), m(this, e, t) }, a.prototype.imul = function(e) { return this.clone().mulTo(e, this) }, a.prototype.imuln = function(e) { r("number" == typeof e), r(e < 67108864); for (var t = 0, i = 0; i < this.length; i++) { var n = (0 | this.words[i]) * e, a = (67108863 & n) + (67108863 & t); t >>= 26, t += n / 67108864 | 0, t += a >>> 26, this.words[i] = 67108863 & a } return 0 !== t && (this.words[i] = t, this.length++), this }, a.prototype.muln = function(e) { return this.clone().imuln(e) }, a.prototype.sqr = function() { return this.mul(this) }, a.prototype.isqr = function() { return this.imul(this.clone()) }, a.prototype.pow = function(e) { var t = function(e) { for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) { var r = i / 26 | 0, n = i % 26; t[i] = (e.words[r] & 1 << n) >>> n } return t }(e); if (0 === t.length) return new a(1); for (var i = this, r = 0; r < t.length && 0 === t[r]; r++, i = i.sqr()); if (++r < t.length) for (var n = i.sqr(); r < t.length; r++, n = n.sqr()) 0 !== t[r] && (i = i.mul(n)); return i }, a.prototype.iushln = function(e) { r("number" == typeof e && e >= 0); var t, i = e % 26, n = (e - i) / 26, a = 67108863 >>> 26 - i << 26 - i; if (0 !== i) { var s = 0; for (t = 0; t < this.length; t++) { var o = this.words[t] & a, u = (0 | this.words[t]) - o << i; this.words[t] = u | s, s = o >>> 26 - i } s && (this.words[t] = s, this.length++) } if (0 !== n) { for (t = this.length - 1; t >= 0; t--) this.words[t + n] = this.words[t]; for (t = 0; t < n; t++) this.words[t] = 0; this.length += n } return this.strip() }, a.prototype.ishln = function(e) { return r(0 === this.negative), this.iushln(e) }, a.prototype.iushrn = function(e, t, i) { var n; r("number" == typeof e && e >= 0), n = t ? (t - t % 26) / 26 : 0; var a = e % 26, s = Math.min((e - a) / 26, this.length), o = 67108863 ^ 67108863 >>> a << a, u = i; if (n -= s, n = Math.max(0, n), u) { for (var l = 0; l < s; l++) u.words[l] = this.words[l]; u.length = s } if (0 === s); else if (this.length > s) for (this.length -= s, l = 0; l < this.length; l++) this.words[l] = this.words[l + s]; else this.words[0] = 0, this.length = 1; var d = 0; for (l = this.length - 1; l >= 0 && (0 !== d || l >= n); l--) { var c = 0 | this.words[l]; this.words[l] = d << 26 - a | c >>> a, d = c & o } return u && 0 !== d && (u.words[u.length++] = d), 0 === this.length && (this.words[0] = 0, this .length = 1), this.strip() }, a.prototype.ishrn = function(e, t, i) { return r(0 === this.negative), this.iushrn(e, t, i) }, a.prototype.shln = function(e) { return this.clone().ishln(e) }, a.prototype.ushln = function(e) { return this.clone().iushln(e) }, a.prototype.shrn = function(e) { return this.clone().ishrn(e) }, a.prototype.ushrn = function(e) { return this.clone().iushrn(e) }, a.prototype.testn = function(e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26, n = 1 << t; return !(this.length <= i || !(this.words[i] & n)) }, a.prototype.imaskn = function(e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26; if (r(0 === this.negative, "imaskn works only with positive numbers"), this.length <= i) return this; if (0 !== t && i++, this.length = Math.min(i, this.length), 0 !== t) { var n = 67108863 ^ 67108863 >>> t << t; this.words[this.length - 1] &= n } return this.strip() }, a.prototype.maskn = function(e) { return this.clone().imaskn(e) }, a.prototype.iaddn = function(e) { return r("number" == typeof e), r(e < 67108864), e < 0 ? this.isubn(-e) : 0 !== this.negative ? 1 === this.length && (0 | this.words[0]) < e ? (this.words[0] = e - (0 | this.words[0]), this .negative = 0, this) : (this.negative = 0, this.isubn(e), this.negative = 1, this) : this ._iaddn(e) }, a.prototype._iaddn = function(e) { this.words[0] += e; for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) this.words[t] -= 67108864, t === this.length - 1 ? this.words[t + 1] = 1 : this.words[t + 1]++; return this.length = Math.max(this.length, t + 1), this }, a.prototype.isubn = function(e) { if (r("number" == typeof e), r(e < 67108864), e < 0) return this.iaddn(-e); if (0 !== this.negative) return this.negative = 0, this.iaddn(e), this.negative = 1, this; if (this.words[0] -= e, 1 === this.length && this.words[0] < 0) this.words[0] = -this.words[0], this.negative = 1; else for (var t = 0; t < this.length && this.words[t] < 0; t++) this.words[t] += 67108864, this .words[t + 1] -= 1; return this.strip() }, a.prototype.addn = function(e) { return this.clone().iaddn(e) }, a.prototype.subn = function(e) { return this.clone().isubn(e) }, a.prototype.iabs = function() { return this.negative = 0, this }, a.prototype.abs = function() { return this.clone().iabs() }, a.prototype._ishlnsubmul = function(e, t, i) { var n, a, s = e.length + i; this._expand(s); var o = 0; for (n = 0; n < e.length; n++) { a = (0 | this.words[n + i]) + o; var u = (0 | e.words[n]) * t; o = ((a -= 67108863 & u) >> 26) - (u / 67108864 | 0), this.words[n + i] = 67108863 & a } for (; n < this.length - i; n++) o = (a = (0 | this.words[n + i]) + o) >> 26, this.words[n + i] = 67108863 & a; if (0 === o) return this.strip(); for (r(-1 === o), o = 0, n = 0; n < this.length; n++) o = (a = -(0 | this.words[n]) + o) >> 26, this.words[n] = 67108863 & a; return this.negative = 1, this.strip() }, a.prototype._wordDiv = function(e, t) { var i = (this.length, e.length), r = this.clone(), n = e, s = 0 | n.words[n.length - 1]; 0 != (i = 26 - this._countBits(s)) && (n = n.ushln(i), r.iushln(i), s = 0 | n.words[n.length - 1]); var o, u = r.length - n.length; if ("mod" !== t) { (o = new a(null)).length = u + 1, o.words = new Array(o.length); for (var l = 0; l < o.length; l++) o.words[l] = 0 } var d = r.clone()._ishlnsubmul(n, 1, u); 0 === d.negative && (r = d, o && (o.words[u] = 1)); for (var c = u - 1; c >= 0; c--) { var h = 67108864 * (0 | r.words[n.length + c]) + (0 | r.words[n.length + c - 1]); for (h = Math.min(h / s | 0, 67108863), r._ishlnsubmul(n, h, c); 0 !== r.negative;) h--, r .negative = 0, r._ishlnsubmul(n, 1, c), r.isZero() || (r.negative ^= 1); o && (o.words[c] = h) } return o && o.strip(), r.strip(), "div" !== t && 0 !== i && r.iushrn(i), { div: o || null, mod: r } }, a.prototype.divmod = function(e, t, i) { return r(!e.isZero()), this.isZero() ? { div: new a(0), mod: new a(0) } : 0 !== this.negative && 0 === e.negative ? (o = this.neg().divmod(e, t), "mod" !== t && (n = o.div.neg()), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.iadd(e)), { div: n, mod: s }) : 0 === this.negative && 0 !== e.negative ? (o = this.divmod(e.neg(), t), "mod" !== t && (n = o.div.neg()), { div: n, mod: o.mod }) : 0 != (this.negative & e.negative) ? (o = this.neg().divmod(e.neg(), t), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.isub(e)), { div: o.div, mod: s }) : e.length > this.length || this.cmp(e) < 0 ? { div: new a(0), mod: this } : 1 === e.length ? "div" === t ? { div: this.divn(e.words[0]), mod: null } : "mod" === t ? { div: null, mod: new a(this.modn(e.words[0])) } : { div: this.divn(e.words[0]), mod: new a(this.modn(e.words[0])) } : this._wordDiv(e, t); var n, s, o }, a.prototype.div = function(e) { return this.divmod(e, "div", !1).div }, a.prototype.mod = function(e) { return this.divmod(e, "mod", !1).mod }, a.prototype.umod = function(e) { return this.divmod(e, "mod", !0).mod }, a.prototype.divRound = function(e) { var t = this.divmod(e); if (t.mod.isZero()) return t.div; var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod, r = e.ushrn(1), n = e.andln(1), a = i.cmp(r); return a < 0 || 1 === n && 0 === a ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn( 1) }, a.prototype.modn = function(e) { r(e <= 67108863); for (var t = (1 << 26) % e, i = 0, n = this.length - 1; n >= 0; n--) i = (t * i + (0 | this.words[ n])) % e; return i }, a.prototype.idivn = function(e) { r(e <= 67108863); for (var t = 0, i = this.length - 1; i >= 0; i--) { var n = (0 | this.words[i]) + 67108864 * t; this.words[i] = n / e | 0, t = n % e } return this.strip() }, a.prototype.divn = function(e) { return this.clone().idivn(e) }, a.prototype.egcd = function(e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for (var n = new a(1), s = new a(0), o = new a(0), u = new a(1), l = 0; t.isEven() && i.isEven();) t.iushrn(1), i.iushrn(1), ++l; for (var d = i.clone(), c = t.clone(); !t.isZero();) { for (var h = 0, f = 1; 0 == (t.words[0] & f) && h < 26; ++h, f <<= 1); if (h > 0) for (t.iushrn(h); h-- > 0;)(n.isOdd() || s.isOdd()) && (n.iadd(d), s.isub(c)), n.iushrn(1), s .iushrn(1); for (var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, m <<= 1); if (p > 0) for (i.iushrn(p); p-- > 0;)(o.isOdd() || u.isOdd()) && (o.iadd(d), u.isub(c)), o.iushrn(1), u .iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), n.isub(o), s.isub(u)) : (i.isub(t), o.isub(n), u.isub(s)) } return { a: o, b: u, gcd: i.iushln(l) } }, a.prototype._invmp = function(e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for (var n, s = new a(1), o = new a(0), u = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0;) { for (var l = 0, d = 1; 0 == (t.words[0] & d) && l < 26; ++l, d <<= 1); if (l > 0) for (t.iushrn(l); l-- > 0;) s.isOdd() && s.iadd(u), s.iushrn(1); for (var c = 0, h = 1; 0 == (i.words[0] & h) && c < 26; ++c, h <<= 1); if (c > 0) for (i.iushrn(c); c-- > 0;) o.isOdd() && o.iadd(u), o.iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), s.isub(o)) : (i.isub(t), o.isub(s)) } return (n = 0 === t.cmpn(1) ? s : o).cmpn(0) < 0 && n.iadd(e), n }, a.prototype.gcd = function(e) { if (this.isZero()) return e.abs(); if (e.isZero()) return this.abs(); var t = this.clone(), i = e.clone(); t.negative = 0, i.negative = 0; for (var r = 0; t.isEven() && i.isEven(); r++) t.iushrn(1), i.iushrn(1); for (;;) { for (; t.isEven();) t.iushrn(1); for (; i.isEven();) i.iushrn(1); var n = t.cmp(i); if (n < 0) { var a = t; t = i, i = a } else if (0 === n || 0 === i.cmpn(1)) break; t.isub(i) } return i.iushln(r) }, a.prototype.invm = function(e) { return this.egcd(e).a.umod(e) }, a.prototype.isEven = function() { return 0 == (1 & this.words[0]) }, a.prototype.isOdd = function() { return 1 == (1 & this.words[0]) }, a.prototype.andln = function(e) { return this.words[0] & e }, a.prototype.bincn = function(e) { r("number" == typeof e); var t = e % 26, i = (e - t) / 26, n = 1 << t; if (this.length <= i) return this._expand(i + 1), this.words[i] |= n, this; for (var a = n, s = i; 0 !== a && s < this.length; s++) { var o = 0 | this.words[s]; a = (o += a) >>> 26, o &= 67108863, this.words[s] = o } return 0 !== a && (this.words[s] = a, this.length++), this }, a.prototype.isZero = function() { return 1 === this.length && 0 === this.words[0] }, a.prototype.cmpn = function(e) { var t, i = e < 0; if (0 !== this.negative && !i) return -1; if (0 === this.negative && i) return 1; if (this.strip(), this.length > 1) t = 1; else { i && (e = -e), r(e <= 67108863, "Number is too big"); var n = 0 | this.words[0]; t = n === e ? 0 : n < e ? -1 : 1 } return 0 !== this.negative ? 0 | -t : t }, a.prototype.cmp = function(e) { if (0 !== this.negative && 0 === e.negative) return -1; if (0 === this.negative && 0 !== e.negative) return 1; var t = this.ucmp(e); return 0 !== this.negative ? 0 | -t : t }, a.prototype.ucmp = function(e) { if (this.length > e.length) return 1; if (this.length < e.length) return -1; for (var t = 0, i = this.length - 1; i >= 0; i--) { var r = 0 | this.words[i], n = 0 | e.words[i]; if (r !== n) { r < n ? t = -1 : r > n && (t = 1); break } } return t }, a.prototype.gtn = function(e) { return 1 === this.cmpn(e) }, a.prototype.gt = function(e) { return 1 === this.cmp(e) }, a.prototype.gten = function(e) { return this.cmpn(e) >= 0 }, a.prototype.gte = function(e) { return this.cmp(e) >= 0 }, a.prototype.ltn = function(e) { return -1 === this.cmpn(e) }, a.prototype.lt = function(e) { return -1 === this.cmp(e) }, a.prototype.lten = function(e) { return this.cmpn(e) <= 0 }, a.prototype.lte = function(e) { return this.cmp(e) <= 0 }, a.prototype.eqn = function(e) { return 0 === this.cmpn(e) }, a.prototype.eq = function(e) { return 0 === this.cmp(e) }, a.red = function(e) { return new T(e) }, a.prototype.toRed = function(e) { return r(!this.red, "Already a number in reduction context"), r(0 === this.negative, "red works only with positives"), e.convertTo(this)._forceRed(e) }, a.prototype.fromRed = function() { return r(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom( this) }, a.prototype._forceRed = function(e) { return this.red = e, this }, a.prototype.forceRed = function(e) { return r(!this.red, "Already a number in reduction context"), this._forceRed(e) }, a.prototype.redAdd = function(e) { return r(this.red, "redAdd works only with red numbers"), this.red.add(this, e) }, a.prototype.redIAdd = function(e) { return r(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e) }, a.prototype.redSub = function(e) { return r(this.red, "redSub works only with red numbers"), this.red.sub(this, e) }, a.prototype.redISub = function(e) { return r(this.red, "redISub works only with red numbers"), this.red.isub(this, e) }, a.prototype.redShl = function(e) { return r(this.red, "redShl works only with red numbers"), this.red.shl(this, e) }, a.prototype.redMul = function(e) { return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red .mul(this, e) }, a.prototype.redIMul = function(e) { return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red .imul(this, e) }, a.prototype.redSqr = function() { return r(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr( this) }, a.prototype.redISqr = function() { return r(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr( this) }, a.prototype.redSqrt = function() { return r(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt( this) }, a.prototype.redInvm = function() { return r(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm( this) }, a.prototype.redNeg = function() { return r(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg( this) }, a.prototype.redPow = function(e) { return r(this.red && !e.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, e) }; var v = { k256: null, p224: null, p192: null, p25519: null }; function y(e, t) { this.name = e, this.p = new a(t, 16), this.n = this.p.bitLength(), this.k = new a(1).iushln(this.n) .isub(this.p), this.tmp = this._tmp() } function _() { y.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f") } function b() { y.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001") } function w() { y.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff") } function E() { y.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed") } function T(e) { if ("string" == typeof e) { var t = a._prime(e); this.m = t.p, this.prime = t } else r(e.gtn(1), "modulus must be greater than 1"), this.m = e, this.prime = null } function S(e) { T.call(this, e), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this .shift % 26), this.r = new a(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this .rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv) } y.prototype._tmp = function() { var e = new a(null); return e.words = new Array(Math.ceil(this.n / 13)), e }, y.prototype.ireduce = function(e) { var t, i = e; do { this.split(i, this.tmp), t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength() } while (t > this.n); var r = t < this.n ? -1 : i.ucmp(this.p); return 0 === r ? (i.words[0] = 0, i.length = 1) : r > 0 ? i.isub(this.p) : void 0 !== i.strip ? i .strip() : i._strip(), i }, y.prototype.split = function(e, t) { e.iushrn(this.n, 0, t) }, y.prototype.imulK = function(e) { return e.imul(this.k) }, n(_, y), _.prototype.split = function(e, t) { for (var i = Math.min(e.length, 9), r = 0; r < i; r++) t.words[r] = e.words[r]; if (t.length = i, e.length <= 9) return e.words[0] = 0, void(e.length = 1); var n = e.words[9]; for (t.words[t.length++] = 4194303 & n, r = 10; r < e.length; r++) { var a = 0 | e.words[r]; e.words[r - 10] = (4194303 & a) << 4 | n >>> 22, n = a } n >>>= 22, e.words[r - 10] = n, 0 === n && e.length > 10 ? e.length -= 10 : e.length -= 9 }, _.prototype.imulK = function(e) { e.words[e.length] = 0, e.words[e.length + 1] = 0, e.length += 2; for (var t = 0, i = 0; i < e.length; i++) { var r = 0 | e.words[i]; t += 977 * r, e.words[i] = 67108863 & t, t = 64 * r + (t / 67108864 | 0) } return 0 === e.words[e.length - 1] && (e.length--, 0 === e.words[e.length - 1] && e.length--), e }, n(b, y), n(w, y), n(E, y), E.prototype.imulK = function(e) { for (var t = 0, i = 0; i < e.length; i++) { var r = 19 * (0 | e.words[i]) + t, n = 67108863 & r; r >>>= 26, e.words[i] = n, t = r } return 0 !== t && (e.words[e.length++] = t), e }, a._prime = function(e) { if (v[e]) return v[e]; var t; if ("k256" === e) t = new _; else if ("p224" === e) t = new b; else if ("p192" === e) t = new w; else { if ("p25519" !== e) throw new Error("Unknown prime " + e); t = new E } return v[e] = t, t }, T.prototype._verify1 = function(e) { r(0 === e.negative, "red works only with positives"), r(e.red, "red works only with red numbers") }, T.prototype._verify2 = function(e, t) { r(0 == (e.negative | t.negative), "red works only with positives"), r(e.red && e.red === t.red, "red works only with red numbers") }, T.prototype.imod = function(e) { return this.prime ? this.prime.ireduce(e)._forceRed(this) : e.umod(this.m)._forceRed(this) }, T.prototype.neg = function(e) { return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this) }, T.prototype.add = function(e, t) { this._verify2(e, t); var i = e.add(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this) }, T.prototype.iadd = function(e, t) { this._verify2(e, t); var i = e.iadd(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i }, T.prototype.sub = function(e, t) { this._verify2(e, t); var i = e.sub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this) }, T.prototype.isub = function(e, t) { this._verify2(e, t); var i = e.isub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i }, T.prototype.shl = function(e, t) { return this._verify1(e), this.imod(e.ushln(t)) }, T.prototype.imul = function(e, t) { return this._verify2(e, t), this.imod(e.imul(t)) }, T.prototype.mul = function(e, t) { return this._verify2(e, t), this.imod(e.mul(t)) }, T.prototype.isqr = function(e) { return this.imul(e, e.clone()) }, T.prototype.sqr = function(e) { return this.mul(e, e) }, T.prototype.sqrt = function(e) { if (e.isZero()) return e.clone(); var t = this.m.andln(3); if (r(t % 2 == 1), 3 === t) { var i = this.m.add(new a(1)).iushrn(2); return this.pow(e, i) } for (var n = this.m.subn(1), s = 0; !n.isZero() && 0 === n.andln(1);) s++, n.iushrn(1); r(!n.isZero()); var o = new a(1).toRed(this), u = o.redNeg(), l = this.m.subn(1).iushrn(1), d = this.m.bitLength(); for (d = new a(2 * d * d).toRed(this); 0 !== this.pow(d, l).cmp(u);) d.redIAdd(u); for (var c = this.pow(d, n), h = this.pow(e, n.addn(1).iushrn(1)), f = this.pow(e, n), p = s; 0 !== f.cmp(o);) { for (var m = f, g = 0; 0 !== m.cmp(o); g++) m = m.redSqr(); r(g < p); var v = this.pow(c, new a(1).iushln(p - g - 1)); h = h.redMul(v), c = v.redSqr(), f = f.redMul(c), p = g } return h }, T.prototype.invm = function(e) { var t = e._invmp(this.m); return 0 !== t.negative ? (t.negative = 0, this.imod(t).redNeg()) : this.imod(t) }, T.prototype.pow = function(e, t) { if (t.isZero()) return new a(1).toRed(this); if (0 === t.cmpn(1)) return e.clone(); var i = new Array(16); i[0] = new a(1).toRed(this), i[1] = e; for (var r = 2; r < i.length; r++) i[r] = this.mul(i[r - 1], e); var n = i[0], s = 0, o = 0, u = t.bitLength() % 26; for (0 === u && (u = 26), r = t.length - 1; r >= 0; r--) { for (var l = t.words[r], d = u - 1; d >= 0; d--) { var c = l >> d & 1; n !== i[0] && (n = this.sqr(n)), 0 !== c || 0 !== s ? (s <<= 1, s |= c, (4 == ++o || 0 === r && 0 === d) && (n = this.mul(n, i[s]), o = 0, s = 0)) : o = 0 } u = 26 } return n }, T.prototype.convertTo = function(e) { var t = e.umod(this.m); return t === e ? t.clone() : t }, T.prototype.convertFrom = function(e) { var t = e.clone(); return t.red = null, t }, a.mont = function(e) { return new S(e) }, n(S, T), S.prototype.convertTo = function(e) { return this.imod(e.ushln(this.shift)) }, S.prototype.convertFrom = function(e) { var t = this.imod(e.mul(this.rinv)); return t.red = null, t }, S.prototype.imul = function(e, t) { if (e.isZero() || t.isZero()) return e.words[0] = 0, e.length = 1, e; var i = e.imul(t), r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), n = i.isub(r).iushrn(this.shift), a = n; return n.cmp(this.m) >= 0 ? a = n.isub(this.m) : n.cmpn(0) < 0 && (a = n.iadd(this.m)), a ._forceRed(this) }, S.prototype.mul = function(e, t) { if (e.isZero() || t.isZero()) return new a(0)._forceRed(this); var i = e.mul(t), r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), n = i.isub(r).iushrn(this.shift), s = n; return n.cmp(this.m) >= 0 ? s = n.isub(this.m) : n.cmpn(0) < 0 && (s = n.iadd(this.m)), s ._forceRed(this) }, S.prototype.invm = function(e) { return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this) } }(e, this) }).call(this, i(55)(e)) }, function(e, t, i) { "use strict"; t.a = { OK: "OK", FORMAT_ERROR: "FormatError", FORMAT_UNSUPPORTED: "FormatUnsupported", CODEC_UNSUPPORTED: "CodecUnsupported" } }, function(e, t) { var i; i = function() { return this }(); try { i = i || new Function("return this")() } catch (e) { "object" == typeof window && (i = window) } e.exports = i }, function(e, t) { function i(e, t) { if (!e) throw new Error(t || "Assertion failed") } e.exports = i, i.equal = function(e, t, i) { if (e != t) throw new Error(i || "Assertion failed: " + e + " != " + t) } }, function(e, t, i) { "use strict"; var r = t, n = i(11), a = i(14), s = i(108); r.assert = a, r.toArray = s.toArray, r.zero2 = s.zero2, r.toHex = s.toHex, r.encode = s.encode, r.getNAF = function(e, t, i) { var r = new Array(Math.max(e.bitLength(), i) + 1); r.fill(0); for (var n = 1 << t + 1, a = e.clone(), s = 0; s < r.length; s++) { var o, u = a.andln(n - 1); a.isOdd() ? (o = u > (n >> 1) - 1 ? (n >> 1) - u : u, a.isubn(o)) : o = 0, r[s] = o, a.iushrn(1) } return r }, r.getJSF = function(e, t) { var i = [ [], [] ]; e = e.clone(), t = t.clone(); for (var r, n = 0, a = 0; e.cmpn(-n) > 0 || t.cmpn(-a) > 0;) { var s, o, u = e.andln(3) + n & 3, l = t.andln(3) + a & 3; 3 === u && (u = -1), 3 === l && (l = -1), s = 0 == (1 & u) ? 0 : 3 != (r = e.andln(7) + n & 7) && 5 !== r || 2 !== l ? u : -u, i[0].push(s), o = 0 == (1 & l) ? 0 : 3 != (r = t.andln(7) + a & 7) && 5 !== r || 2 !== u ? l : -l, i[1].push(o), 2 * n === s + 1 && (n = 1 - n), 2 * a === o + 1 && (a = 1 - a), e.iushrn(1), t.iushrn(1) } return i }, r.cachedProperty = function(e, t, i) { var r = "_" + t; e.prototype[t] = function() { return void 0 !== this[r] ? this[r] : this[r] = i.call(this) } }, r.parseBytes = function(e) { return "string" == typeof e ? r.toArray(e, "hex") : e }, r.intFromLE = function(e) { return new n(e, "hex", "le") } }, function(e, t, i) { "use strict"; function r(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } i.d(t, "d", function() { return n }), i.d(t, "b", function() { return a }), i.d(t, "a", function() { return s }), i.d(t, "c", function() { return o }); var n = function(e, t, i, r, n) { this.dts = e, this.pts = t, this.duration = i, this.originalDts = r, this.isSyncPoint = n, this .fileposition = null }, a = function() { function e() { this.beginDts = 0, this.endDts = 0, this.beginPts = 0, this.endPts = 0, this.originalBeginDts = 0, this.originalEndDts = 0, this.syncPoints = [], this.firstSample = null, this.lastSample = null } return e.prototype.appendSyncPoint = function(e) { e.isSyncPoint = !0, this.syncPoints.push(e) }, e }(), s = function() { function e() { this._list = [] } var t = e.prototype; return t.clear = function() { this._list = [] }, t.appendArray = function(e) { var t = this._list; 0 !== e.length && (t.length > 0 && e[0].originalDts < t[t.length - 1].originalDts && this.clear(), Array.prototype.push.apply(t, e)) }, t.getLastSyncPointBeforeDts = function(e) { if (0 == this._list.length) return null; var t = this._list, i = 0, r = t.length - 1, n = 0, a = 0, s = r; for (e < t[0].dts && (i = 0, a = s + 1); a <= s;) { if ((n = a + Math.floor((s - a) / 2)) === r || e >= t[n].dts && e < t[n + 1].dts) { i = n; break } t[n].dts < e ? a = n + 1 : s = n - 1 } return this._list[i] }, e }(), o = function() { function e(e) { this._type = e, this._list = [], this._lastAppendLocation = -1 } var t, i, n = e.prototype; return n.isEmpty = function() { return 0 === this._list.length }, n.clear = function() { this._list = [], this._lastAppendLocation = -1 }, n._searchNearestSegmentBefore = function(e) { var t = this._list; if (0 === t.length) return -2; var i = t.length - 1, r = 0, n = 0, a = i, s = 0; if (e < t[0].originalBeginDts) return -1; for (; n <= a;) { if ((r = n + Math.floor((a - n) / 2)) === i || e > t[r].lastSample.originalDts && e < t[r + 1] .originalBeginDts) { s = r; break } t[r].originalBeginDts < e ? n = r + 1 : a = r - 1 } return s }, n._searchNearestSegmentAfter = function(e) { return this._searchNearestSegmentBefore(e) + 1 }, n.append = function(e) { var t = this._list, i = e, r = this._lastAppendLocation, n = 0; - 1 !== r && r < t.length && i.originalBeginDts >= t[r].lastSample.originalDts && (r === t .length - 1 || r < t.length - 1 && i.originalBeginDts < t[r + 1].originalBeginDts) ? n = r + 1 : t.length > 0 && (n = this._searchNearestSegmentBefore(i.originalBeginDts) + 1), this ._lastAppendLocation = n, this._list.splice(n, 0, i) }, n.getLastSegmentBefore = function(e) { var t = this._searchNearestSegmentBefore(e); return t >= 0 ? this._list[t] : null }, n.getLastSampleBefore = function(e) { var t = this.getLastSegmentBefore(e); return null != t ? t.lastSample : null }, n.getLastSyncPointBefore = function(e) { for (var t = this._searchNearestSegmentBefore(e), i = this._list[t].syncPoints; 0 === i.length && t > 0;) t--, i = this._list[t].syncPoints; return i.length > 0 ? i[i.length - 1] : null }, t = e, (i = [{ key: "type", get: function() { return this._type } }, { key: "length", get: function() { return this._list.length } }]) && r(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }() }, function(e, t, i) { "use strict"; var r = function() { function e() { this.mimeType = null, this.duration = null, this.hasAudio = null, this.hasVideo = null, this .audioCodec = null, this.videoCodec = null, this.audioDataRate = null, this.videoDataRate = null, this.audioSampleRate = null, this.audioChannelCount = null, this.width = null, this.height = null, this.fps = null, this.profile = null, this.level = null, this.refFrames = null, this.chromaFormat = null, this.sarNum = null, this.sarDen = null, this.metadata = null, this.segments = null, this .segmentCount = null, this.hasKeyframesIndex = null, this.keyframesIndex = null } var t = e.prototype; return t.isComplete = function() { var e = !1 === this.hasAudio || !0 === this.hasAudio && null != this.audioCodec && null != this .audioSampleRate && null != this.audioChannelCount, t = !1 === this.hasVideo || !0 === this.hasVideo && null != this.videoCodec && null != this .width && null != this.height && null != this.fps && null != this.profile && null != this.level && null != this.refFrames && null != this.chromaFormat && null != this.sarNum && null != this.sarDen; return null != this.mimeType && null != this.duration && null != this.metadata && null != this .hasKeyframesIndex && e && t }, t.isSeekable = function() { return !0 === this.hasKeyframesIndex }, t.getNearestKeyframe = function(e) { if (null == this.keyframesIndex) return null; var t = this.keyframesIndex, i = this._search(t.times, e); return { index: i, milliseconds: t.times[i], fileposition: t.filepositions[i] } }, t._search = function(e, t) { var i = 0, r = e.length - 1, n = 0, a = 0, s = r; for (t < e[0] && (i = 0, a = s + 1); a <= s;) { if ((n = a + Math.floor((s - a) / 2)) === r || t >= e[n] && t < e[n + 1]) { i = n; break } e[n] < t ? a = n + 1 : s = n - 1 } return i }, e }(); t.a = r }, function(e, t, i) { "use strict"; var r = i(14), n = i(5); function a(e, t) { return 55296 == (64512 & e.charCodeAt(t)) && !(t < 0 || t + 1 >= e.length) && 56320 == (64512 & e .charCodeAt(t + 1)) } function s(e) { return (e >>> 24 | e >>> 8 & 65280 | e << 8 & 16711680 | (255 & e) << 24) >>> 0 } function o(e) { return 1 === e.length ? "0" + e : e } function u(e) { return 7 === e.length ? "0" + e : 6 === e.length ? "00" + e : 5 === e.length ? "000" + e : 4 === e .length ? "0000" + e : 3 === e.length ? "00000" + e : 2 === e.length ? "000000" + e : 1 === e.length ? "0000000" + e : e } t.inherits = n, t.toArray = function(e, t) { if (Array.isArray(e)) return e.slice(); if (!e) return []; var i = []; if ("string" == typeof e) if (t) { if ("hex" === t) for ((e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), n = 0; n < e .length; n += 2) i.push(parseInt(e[n] + e[n + 1], 16)) } else for (var r = 0, n = 0; n < e.length; n++) { var s = e.charCodeAt(n); s < 128 ? i[r++] = s : s < 2048 ? (i[r++] = s >> 6 | 192, i[r++] = 63 & s | 128) : a(e, n) ? (s = 65536 + ((1023 & s) << 10) + (1023 & e.charCodeAt(++n)), i[r++] = s >> 18 | 240, i[r++] = s >> 12 & 63 | 128, i[r++] = s >> 6 & 63 | 128, i[r++] = 63 & s | 128) : (i[r++] = s >> 12 | 224, i[r++] = s >> 6 & 63 | 128, i[r++] = 63 & s | 128) } else for (n = 0; n < e.length; n++) i[n] = 0 | e[n]; return i }, t.toHex = function(e) { for (var t = "", i = 0; i < e.length; i++) t += o(e[i].toString(16)); return t }, t.htonl = s, t.toHex32 = function(e, t) { for (var i = "", r = 0; r < e.length; r++) { var n = e[r]; "little" === t && (n = s(n)), i += u(n.toString(16)) } return i }, t.zero2 = o, t.zero8 = u, t.join32 = function(e, t, i, n) { var a = i - t; r(a % 4 == 0); for (var s = new Array(a / 4), o = 0, u = t; o < s.length; o++, u += 4) { var l; l = "big" === n ? e[u] << 24 | e[u + 1] << 16 | e[u + 2] << 8 | e[u + 3] : e[u + 3] << 24 | e[u + 2] << 16 | e[u + 1] << 8 | e[u], s[o] = l >>> 0 } return s }, t.split32 = function(e, t) { for (var i = new Array(4 * e.length), r = 0, n = 0; r < e.length; r++, n += 4) { var a = e[r]; "big" === t ? (i[n] = a >>> 24, i[n + 1] = a >>> 16 & 255, i[n + 2] = a >>> 8 & 255, i[n + 3] = 255 & a) : (i[n + 3] = a >>> 24, i[n + 2] = a >>> 16 & 255, i[n + 1] = a >>> 8 & 255, i[n] = 255 & a) } return i }, t.rotr32 = function(e, t) { return e >>> t | e << 32 - t }, t.rotl32 = function(e, t) { return e << t | e >>> 32 - t }, t.sum32 = function(e, t) { return e + t >>> 0 }, t.sum32_3 = function(e, t, i) { return e + t + i >>> 0 }, t.sum32_4 = function(e, t, i, r) { return e + t + i + r >>> 0 }, t.sum32_5 = function(e, t, i, r, n) { return e + t + i + r + n >>> 0 }, t.sum64 = function(e, t, i, r) { var n = e[t], a = r + e[t + 1] >>> 0, s = (a < r ? 1 : 0) + i + n; e[t] = s >>> 0, e[t + 1] = a }, t.sum64_hi = function(e, t, i, r) { return (t + r >>> 0 < t ? 1 : 0) + e + i >>> 0 }, t.sum64_lo = function(e, t, i, r) { return t + r >>> 0 }, t.sum64_4_hi = function(e, t, i, r, n, a, s, o) { var u = 0, l = t; return u += (l = l + r >>> 0) < t ? 1 : 0, u += (l = l + a >>> 0) < a ? 1 : 0, e + i + n + s + (u += ( l = l + o >>> 0) < o ? 1 : 0) >>> 0 }, t.sum64_4_lo = function(e, t, i, r, n, a, s, o) { return t + r + a + o >>> 0 }, t.sum64_5_hi = function(e, t, i, r, n, a, s, o, u, l) { var d = 0, c = t; return d += (c = c + r >>> 0) < t ? 1 : 0, d += (c = c + a >>> 0) < a ? 1 : 0, d += (c = c + o >>> 0) < o ? 1 : 0, e + i + n + s + u + (d += (c = c + l >>> 0) < l ? 1 : 0) >>> 0 }, t.sum64_5_lo = function(e, t, i, r, n, a, s, o, u, l) { return t + r + a + o + l >>> 0 }, t.rotr64_hi = function(e, t, i) { return (t << 32 - i | e >>> i) >>> 0 }, t.rotr64_lo = function(e, t, i) { return (e << 32 - i | t >>> i) >>> 0 }, t.shr64_hi = function(e, t, i) { return e >>> i }, t.shr64_lo = function(e, t, i) { return (e << 32 - i | t >>> i) >>> 0 } }, function(e, t, i) { "use strict"; var r = i(8), n = i.n(r), a = i(0); function s(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var o = function() { function e() {} var t, i; return e.getConfig = function() { return { globalTag: a.a.GLOBAL_TAG, forceGlobalTag: a.a.FORCE_GLOBAL_TAG, enableVerbose: a.a.ENABLE_VERBOSE, enableDebug: a.a.ENABLE_DEBUG, enableInfo: a.a.ENABLE_INFO, enableWarn: a.a.ENABLE_WARN, enableError: a.a.ENABLE_ERROR, enableCallback: a.a.ENABLE_CALLBACK } }, e.applyConfig = function(e) { a.a.GLOBAL_TAG = e.globalTag, a.a.FORCE_GLOBAL_TAG = e.forceGlobalTag, a.a.ENABLE_VERBOSE = e .enableVerbose, a.a.ENABLE_DEBUG = e.enableDebug, a.a.ENABLE_INFO = e.enableInfo, a.a .ENABLE_WARN = e.enableWarn, a.a.ENABLE_ERROR = e.enableError, a.a.ENABLE_CALLBACK = e .enableCallback }, e._notifyChange = function() { var t = e.emitter; if (t.listenerCount("change") > 0) { var i = e.getConfig(); t.emit("change", i) } }, e.registerListener = function(t) { e.emitter.addListener("change", t) }, e.removeListener = function(t) { e.emitter.removeListener("change", t) }, e.addLogListener = function(t) { a.a.emitter.addListener("log", t), a.a.emitter.listenerCount("log") > 0 && (a.a.ENABLE_CALLBACK = ! 0, e._notifyChange()) }, e.removeLogListener = function(t) { a.a.emitter.removeListener("log", t), 0 === a.a.emitter.listenerCount("log") && (a.a .ENABLE_CALLBACK = !1, e._notifyChange()) }, t = e, i = [{ key: "forceGlobalTag", get: function() { return a.a.FORCE_GLOBAL_TAG }, set: function(t) { a.a.FORCE_GLOBAL_TAG = t, e._notifyChange() } }, { key: "globalTag", get: function() { return a.a.GLOBAL_TAG }, set: function(t) { a.a.GLOBAL_TAG = t, e._notifyChange() } }, { key: "enableAll", get: function() { return a.a.ENABLE_VERBOSE && a.a.ENABLE_DEBUG && a.a.ENABLE_INFO && a.a.ENABLE_WARN && a.a .ENABLE_ERROR }, set: function(t) { a.a.ENABLE_VERBOSE = t, a.a.ENABLE_DEBUG = t, a.a.ENABLE_INFO = t, a.a.ENABLE_WARN = t, a.a .ENABLE_ERROR = t, e._notifyChange() } }, { key: "enableDebug", get: function() { return a.a.ENABLE_DEBUG }, set: function(t) { a.a.ENABLE_DEBUG = t, e._notifyChange() } }, { key: "enableVerbose", get: function() { return a.a.ENABLE_VERBOSE }, set: function(t) { a.a.ENABLE_VERBOSE = t, e._notifyChange() } }, { key: "enableInfo", get: function() { return a.a.ENABLE_INFO }, set: function(t) { a.a.ENABLE_INFO = t, e._notifyChange() } }, { key: "enableWarn", get: function() { return a.a.ENABLE_WARN }, set: function(t) { a.a.ENABLE_WARN = t, e._notifyChange() } }, { key: "enableError", get: function() { return a.a.ENABLE_ERROR }, set: function(t) { a.a.ENABLE_ERROR = t, e._notifyChange() } }], null && s(t.prototype, null), i && s(t, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); o.emitter = new n.a, t.a = o }, function(e, t, i) { var r = i(6).Buffer, n = i(148).Transform, a = i(22).StringDecoder; function s(e) { n.call(this), this.hashMode = "string" == typeof e, this.hashMode ? this[e] = this._finalOrDigest : this .final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this ._decoder = null, this._encoding = null } i(5)(s, n), s.prototype.update = function(e, t, i) { "string" == typeof e && (e = r.from(e, t)); var n = this._update(e); return this.hashMode ? this : (i && (n = this._toString(n, i)), n) }, s.prototype.setAutoPadding = function() {}, s.prototype.getAuthTag = function() { throw new Error("trying to get auth tag in unsupported state") }, s.prototype.setAuthTag = function() { throw new Error("trying to set auth tag in unsupported state") }, s.prototype.setAAD = function() { throw new Error("trying to set aad in unsupported state") }, s.prototype._transform = function(e, t, i) { var r; try { this.hashMode ? this._update(e) : this.push(this._update(e)) } catch (e) { r = e } finally { i(r) } }, s.prototype._flush = function(e) { var t; try { this.push(this.__final()) } catch (e) { t = e } e(t) }, s.prototype._finalOrDigest = function(e) { var t = this.__final() || r.alloc(0); return e && (t = this._toString(t, e, !0)), t }, s.prototype._toString = function(e, t, i) { if (this._decoder || (this._decoder = new a(t), this._encoding = t), this._encoding !== t) throw new Error("can't switch encodings"); var r = this._decoder.write(e); return i && (r += this._decoder.end()), r }, e.exports = s }, function(e, t, i) { function r(e) { var t = {}; function i(r) { if (t[r]) return t[r].exports; var n = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports } i.m = e, i.c = t, i.i = function(e) { return e }, i.d = function(e, t, r) { i.o(e, t) || Object.defineProperty(e, t, { configurable: !1, enumerable: !0, get: r }) }, i.r = function(e) { Object.defineProperty(e, "__esModule", { value: !0 }) }, i.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e }; return i.d(t, "a", t), t }, i.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, i.p = "/", i.oe = function(e) { throw console.error(e), e }; var r = i(i.s = ENTRY_MODULE); return r.default || r } function n(e) { return (e + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") } function a(e, t, r) { var a = {}; a[r] = []; var s = t.toString(), o = s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/); if (!o) return a; for (var u, l = o[1], d = new RegExp("(\\\\n|\\W)" + n(l) + "\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)", "g"); u = d.exec(s);) "dll-reference" !== u[3] && a[r].push(u[3]); for (d = new RegExp("\\(" + n(l) + '\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)', "g"); u = d.exec(s);) e[u[2]] || (a[r].push(u[1]), e[u[2]] = i(u[1]).m), a[u[2]] = a[u[2]] || [], a[u[ 2]].push(u[4]); for (var c, h = Object.keys(a), f = 0; f < h.length; f++) for (var p = 0; p < a[h[f]].length; p++) c = a[h[f]][p], isNaN(1 * c) || (a[h[f]][p] = 1 * a[h[f]][p]); return a } function s(e) { return Object.keys(e).reduce(function(t, i) { return t || e[i].length > 0 }, !1) } e.exports = function(e, t) { t = t || {}; var n = { main: i.m }, o = t.all ? { main: Object.keys(n.main) } : function(e, t) { for (var i = { main: [t] }, r = { main: [] }, n = { main: {} }; s(i);) for (var o = Object.keys(i), u = 0; u < o.length; u++) { var l = o[u], d = i[l].pop(); if (n[l] = n[l] || {}, !n[l][d] && e[l][d]) { n[l][d] = !0, r[l] = r[l] || [], r[l].push(d); for (var c = a(e, e[l][d], l), h = Object.keys(c), f = 0; f < h.length; f++) i[h[f]] = i[h[ f]] || [], i[h[f]] = i[h[f]].concat(c[h[f]]) } } return r }(n, e), u = ""; Object.keys(o).filter(function(e) { return "main" !== e }).forEach(function(e) { for (var t = 0; o[e][t];) t++; o[e].push(t), n[e][t] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", u = u + "var " + e + " = (" + r.toString().replace("ENTRY_MODULE", JSON.stringify(t)) + ")({" + o[e].map(function(t) { return JSON.stringify(t) + ": " + n[e][t].toString() }).join(",") + "});\n" }), u = u + "new ((" + r.toString().replace("ENTRY_MODULE", JSON.stringify(e)) + ")({" + o.main.map( function(e) { return JSON.stringify(e) + ": " + n.main[e].toString() }).join(",") + "}))(self);"; var l = new window.Blob([u], { type: "text/javascript" }); if (t.bare) return l; var d = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(l), c = new window.Worker(d); return c.objectURL = d, c } }, function(e, t, i) { "use strict"; var r = i(6).Buffer, n = r.isEncoding || function(e) { switch ((e = "" + e) && e.toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": case "raw": return !0; default: return !1 } }; function a(e) { var t; switch (this.encoding = function(e) { var t = function(e) { if (!e) return "utf8"; for (var t;;) switch (e) { case "utf8": case "utf-8": return "utf8"; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return "utf16le"; case "latin1": case "binary": return "latin1"; case "base64": case "ascii": case "hex": return e; default: if (t) return; e = ("" + e).toLowerCase(), t = !0 } }(e); if ("string" != typeof t && (r.isEncoding === n || !n(e))) throw new Error("Unknown encoding: " + e); return t || e }(e), this.encoding) { case "utf16le": this.text = u, this.end = l, t = 4; break; case "utf8": this.fillLast = o, t = 4; break; case "base64": this.text = d, this.end = c, t = 3; break; default: return this.write = h, void(this.end = f) } this.lastNeed = 0, this.lastTotal = 0, this.lastChar = r.allocUnsafe(t) } function s(e) { return e <= 127 ? 0 : e >> 5 == 6 ? 2 : e >> 4 == 14 ? 3 : e >> 3 == 30 ? 4 : e >> 6 == 2 ? -1 : -2 } function o(e) { var t = this.lastTotal - this.lastNeed, i = function(e, t, i) { if (128 != (192 & t[0])) return e.lastNeed = 0, "�"; if (e.lastNeed > 1 && t.length > 1) { if (128 != (192 & t[1])) return e.lastNeed = 1, "�"; if (e.lastNeed > 2 && t.length > 2 && 128 != (192 & t[2])) return e.lastNeed = 2, "�" } }(this, e); return void 0 !== i ? i : this.lastNeed <= e.length ? (e.copy(this.lastChar, t, 0, this.lastNeed), this .lastChar.toString(this.encoding, 0, this.lastTotal)) : (e.copy(this.lastChar, t, 0, e.length), void( this.lastNeed -= e.length)) } function u(e, t) { if ((e.length - t) % 2 == 0) { var i = e.toString("utf16le", t); if (i) { var r = i.charCodeAt(i.length - 1); if (r >= 55296 && r <= 56319) return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = e[e .length - 2], this.lastChar[1] = e[e.length - 1], i.slice(0, -1) } return i } return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = e[e.length - 1], e.toString("utf16le", t, e.length - 1) } function l(e) { var t = e && e.length ? this.write(e) : ""; if (this.lastNeed) { var i = this.lastTotal - this.lastNeed; return t + this.lastChar.toString("utf16le", 0, i) } return t } function d(e, t) { var i = (e.length - t) % 3; return 0 === i ? e.toString("base64", t) : (this.lastNeed = 3 - i, this.lastTotal = 3, 1 === i ? this .lastChar[0] = e[e.length - 1] : (this.lastChar[0] = e[e.length - 2], this.lastChar[1] = e[e.length - 1]), e.toString("base64", t, e.length - i)) } function c(e) { var t = e && e.length ? this.write(e) : ""; return this.lastNeed ? t + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : t } function h(e) { return e.toString(this.encoding) } function f(e) { return e && e.length ? this.write(e) : "" } t.StringDecoder = a, a.prototype.write = function(e) { if (0 === e.length) return ""; var t, i; if (this.lastNeed) { if (void 0 === (t = this.fillLast(e))) return ""; i = this.lastNeed, this.lastNeed = 0 } else i = 0; return i < e.length ? t ? t + this.text(e, i) : this.text(e, i) : t || "" }, a.prototype.end = function(e) { var t = e && e.length ? this.write(e) : ""; return this.lastNeed ? t + "�" : t }, a.prototype.text = function(e, t) { var i = function(e, t, i) { var r = t.length - 1; if (r < i) return 0; var n = s(t[r]); return n >= 0 ? (n > 0 && (e.lastNeed = n - 1), n) : --r < i || -2 === n ? 0 : (n = s(t[r])) >= 0 ? (n > 0 && (e.lastNeed = n - 2), n) : --r < i || -2 === n ? 0 : (n = s(t[r])) >= 0 ? (n > 0 && ( 2 === n ? n = 0 : e.lastNeed = n - 3), n) : 0 }(this, e, t); if (!this.lastNeed) return e.toString("utf8", t); this.lastTotal = i; var r = e.length - (i - this.lastNeed); return e.copy(this.lastChar, 0, r), e.toString("utf8", t, r) }, a.prototype.fillLast = function(e) { if (this.lastNeed <= e.length) return e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this .lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal); e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), this.lastNeed -= e.length } }, function(e, t, i) { "use strict"; var r = i(38), n = Object.keys || function(e) { var t = []; for (var i in e) t.push(i); return t }; e.exports = c; var a = Object.create(i(32)); a.inherits = i(5); var s = i(81), o = i(51); a.inherits(c, s); for (var u = n(o.prototype), l = 0; l < u.length; l++) { var d = u[l]; c.prototype[d] || (c.prototype[d] = o.prototype[d]) } function c(e) { if (!(this instanceof c)) return new c(e); s.call(this, e), o.call(this, e), e && !1 === e.readable && (this.readable = !1), e && !1 === e .writable && (this.writable = !1), this.allowHalfOpen = !0, e && !1 === e.allowHalfOpen && (this .allowHalfOpen = !1), this.once("end", h) } function h() { this.allowHalfOpen || this._writableState.ended || r.nextTick(f, this) } function f(e) { e.end() } Object.defineProperty(c.prototype, "writableHighWaterMark", { enumerable: !1, get: function() { return this._writableState.highWaterMark } }), Object.defineProperty(c.prototype, "destroyed", { get: function() { return void 0 !== this._readableState && void 0 !== this._writableState && this._readableState .destroyed && this._writableState.destroyed }, set: function(e) { void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState .destroyed = e, this._writableState.destroyed = e) } }), c.prototype._destroy = function(e, t) { this.push(null), this.end(), r.nextTick(t, e) } }, function(e, t, i) { "use strict"; (function(t, r) { var n = i(6).Buffer, a = t.crypto || t.msCrypto; a && a.getRandomValues ? e.exports = function(e, t) { if (e > 4294967295) throw new RangeError("requested too many random bytes"); var i = n.allocUnsafe(e); if (e > 0) if (e > 65536) for (var s = 0; s < e; s += 65536) a.getRandomValues(i.slice(s, s + 65536)); else a.getRandomValues(i); return "function" == typeof t ? r.nextTick(function() { t(null, i) }) : i } : e.exports = function() { throw new Error( "Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11" ) } }).call(this, i(13), i(9)) }, function(e, t, i) { "use strict"; var r = {}; function n(e, t, i) { i || (i = Error); var n = function(e) { var i, r; function n(i, r, n) { return e.call(this, function(e, i, r) { return "string" == typeof t ? t : t(e, i, n) }(i, r)) || this } return r = e, (i = n).prototype = Object.create(r.prototype), i.prototype.constructor = i, i .__proto__ = r, n }(i); n.prototype.name = i.name, n.prototype.code = e, r[e] = n } function a(e, t) { if (Array.isArray(e)) { var i = e.length; return e = e.map(function(e) { return String(e) }), i > 2 ? "one of ".concat(t, " ").concat(e.slice(0, i - 1).join(", "), ", or ") + e[i - 1] : 2 === i ? "one of ".concat(t, " ").concat(e[0], " or ").concat(e[1]) : "of ".concat(t, " ").concat(e[0]) } return "of ".concat(t, " ").concat(String(e)) } n("ERR_INVALID_OPT_VALUE", function(e, t) { return 'The value "' + t + '" is invalid for option "' + e + '"' }, TypeError), n("ERR_INVALID_ARG_TYPE", function(e, t, i) { var r, n, s; if ("string" == typeof t && (n = "not ", t.substr(0, n.length) === n) ? (r = "must not be", t = t .replace(/^not /, "")) : r = "must be", function(e, t, i) { return (void 0 === i || i > e.length) && (i = e.length), e.substring(i - t.length, i) === t }(e, " argument")) s = "The ".concat(e, " ").concat(r, " ").concat(a(t, "type")); else { var o = function(e, t, i) { return "number" != typeof i && (i = 0), !(i + ".".length > e.length) && -1 !== e.indexOf(".", i) }(e) ? "property" : "argument"; s = 'The "'.concat(e, '" ').concat(o, " ").concat(r, " ").concat(a(t, "type")) } return s + ". Received type ".concat(typeof i) }, TypeError), n("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), n("ERR_METHOD_NOT_IMPLEMENTED", function(e) { return "The " + e + " method is not implemented" }), n("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), n("ERR_STREAM_DESTROYED", function(e) { return "Cannot call " + e + " after a stream was destroyed" }), n("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), n("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), n("ERR_STREAM_WRITE_AFTER_END", "write after end"), n( "ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), n("ERR_UNKNOWN_ENCODING", function(e) { return "Unknown encoding: " + e }, TypeError), n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), e.exports .codes = r }, function(e, t, i) { "use strict"; (function(t) { var r = Object.keys || function(e) { var t = []; for (var i in e) t.push(i); return t }; e.exports = l; var n = i(73), a = i(77); i(5)(l, n); for (var s = r(a.prototype), o = 0; o < s.length; o++) { var u = s[o]; l.prototype[u] || (l.prototype[u] = a.prototype[u]) } function l(e) { if (!(this instanceof l)) return new l(e); n.call(this, e), a.call(this, e), this.allowHalfOpen = !0, e && (!1 === e.readable && (this .readable = !1), !1 === e.writable && (this.writable = !1), !1 === e.allowHalfOpen && (this .allowHalfOpen = !1, this.once("end", d))) } function d() { this._writableState.ended || t.nextTick(c, this) } function c(e) { e.end() } Object.defineProperty(l.prototype, "writableHighWaterMark", { enumerable: !1, get: function() { return this._writableState.highWaterMark } }), Object.defineProperty(l.prototype, "writableBuffer", { enumerable: !1, get: function() { return this._writableState && this._writableState.getBuffer() } }), Object.defineProperty(l.prototype, "writableLength", { enumerable: !1, get: function() { return this._writableState.length } }), Object.defineProperty(l.prototype, "destroyed", { enumerable: !1, get: function() { return void 0 !== this._readableState && void 0 !== this._writableState && this._readableState .destroyed && this._writableState.destroyed }, set: function(e) { void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState .destroyed = e, this._writableState.destroyed = e) } }) }).call(this, i(9)) }, function(e, t, i) { var r = i(6).Buffer; function n(e, t) { this._block = r.alloc(e), this._finalSize = t, this._blockSize = e, this._len = 0 } n.prototype.update = function(e, t) { "string" == typeof e && (t = t || "utf8", e = r.from(e, t)); for (var i = this._block, n = this._blockSize, a = e.length, s = this._len, o = 0; o < a;) { for (var u = s % n, l = Math.min(a - o, n - u), d = 0; d < l; d++) i[u + d] = e[o + d]; o += l, (s += l) % n == 0 && this._update(i) } return this._len += a, this }, n.prototype.digest = function(e) { var t = this._len % this._blockSize; this._block[t] = 128, this._block.fill(0, t + 1), t >= this._finalSize && (this._update(this._block), this._block.fill(0)); var i = 8 * this._len; if (i <= 4294967295) this._block.writeUInt32BE(i, this._blockSize - 4); else { var r = (4294967295 & i) >>> 0, n = (i - r) / 4294967296; this._block.writeUInt32BE(n, this._blockSize - 8), this._block.writeUInt32BE(r, this._blockSize - 4) } this._update(this._block); var a = this._hash(); return e ? a.toString(e) : a }, n.prototype._update = function() { throw new Error("_update must be implemented by subclass") }, e.exports = n }, function(e, t, i) { "use strict"; var r = {}; function n(e, t, i) { i || (i = Error); var n = function(e) { var i, r; function n(i, r, n) { return e.call(this, function(e, i, r) { return "string" == typeof t ? t : t(e, i, n) }(i, r)) || this } return r = e, (i = n).prototype = Object.create(r.prototype), i.prototype.constructor = i, i .__proto__ = r, n }(i); n.prototype.name = i.name, n.prototype.code = e, r[e] = n } function a(e, t) { if (Array.isArray(e)) { var i = e.length; return e = e.map(function(e) { return String(e) }), i > 2 ? "one of ".concat(t, " ").concat(e.slice(0, i - 1).join(", "), ", or ") + e[i - 1] : 2 === i ? "one of ".concat(t, " ").concat(e[0], " or ").concat(e[1]) : "of ".concat(t, " ").concat(e[0]) } return "of ".concat(t, " ").concat(String(e)) } n("ERR_INVALID_OPT_VALUE", function(e, t) { return 'The value "' + t + '" is invalid for option "' + e + '"' }, TypeError), n("ERR_INVALID_ARG_TYPE", function(e, t, i) { var r, n, s; if ("string" == typeof t && (n = "not ", t.substr(0, n.length) === n) ? (r = "must not be", t = t .replace(/^not /, "")) : r = "must be", function(e, t, i) { return (void 0 === i || i > e.length) && (i = e.length), e.substring(i - t.length, i) === t }(e, " argument")) s = "The ".concat(e, " ").concat(r, " ").concat(a(t, "type")); else { var o = function(e, t, i) { return "number" != typeof i && (i = 0), !(i + ".".length > e.length) && -1 !== e.indexOf(".", i) }(e) ? "property" : "argument"; s = 'The "'.concat(e, '" ').concat(o, " ").concat(r, " ").concat(a(t, "type")) } return s + ". Received type ".concat(typeof i) }, TypeError), n("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), n("ERR_METHOD_NOT_IMPLEMENTED", function(e) { return "The " + e + " method is not implemented" }), n("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), n("ERR_STREAM_DESTROYED", function(e) { return "Cannot call " + e + " after a stream was destroyed" }), n("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), n("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), n("ERR_STREAM_WRITE_AFTER_END", "write after end"), n( "ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), n("ERR_UNKNOWN_ENCODING", function(e) { return "Unknown encoding: " + e }, TypeError), n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), e.exports .codes = r }, function(e, t, i) { "use strict"; (function(t) { var r = Object.keys || function(e) { var t = []; for (var i in e) t.push(i); return t }; e.exports = l; var n = i(102), a = i(106); i(5)(l, n); for (var s = r(a.prototype), o = 0; o < s.length; o++) { var u = s[o]; l.prototype[u] || (l.prototype[u] = a.prototype[u]) } function l(e) { if (!(this instanceof l)) return new l(e); n.call(this, e), a.call(this, e), this.allowHalfOpen = !0, e && (!1 === e.readable && (this .readable = !1), !1 === e.writable && (this.writable = !1), !1 === e.allowHalfOpen && (this .allowHalfOpen = !1, this.once("end", d))) } function d() { this._writableState.ended || t.nextTick(c, this) } function c(e) { e.end() } Object.defineProperty(l.prototype, "writableHighWaterMark", { enumerable: !1, get: function() { return this._writableState.highWaterMark } }), Object.defineProperty(l.prototype, "writableBuffer", { enumerable: !1, get: function() { return this._writableState && this._writableState.getBuffer() } }), Object.defineProperty(l.prototype, "writableLength", { enumerable: !1, get: function() { return this._writableState.length } }), Object.defineProperty(l.prototype, "destroyed", { enumerable: !1, get: function() { return void 0 !== this._readableState && void 0 !== this._writableState && this._readableState .destroyed && this._writableState.destroyed }, set: function(e) { void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState .destroyed = e, this._writableState.destroyed = e) } }) }).call(this, i(9)) }, function(e, t, i) { "use strict"; var r = function() { function e() { this.listeners = {} } var t = e.prototype; return t.on = function(e, t) { this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t) }, t.off = function(e, t) { if (!this.listeners[e]) return !1; var i = this.listeners[e].indexOf(t); return this.listeners[e] = this.listeners[e].slice(0), this.listeners[e].splice(i, 1), i > -1 }, t.trigger = function(e) { var t = this.listeners[e]; if (t) if (2 === arguments.length) for (var i = t.length, r = 0; r < i; ++r) t[r].call(this, arguments[1]); else for (var n = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s] .apply(this, n) }, t.dispose = function() { this.listeners = {} }, t.pipe = function(e) { this.on("data", function(t) { e.push(t) }) }, e }(); e.exports = r }, function(e, t, i) { "use strict"; var r = i(5), n = i(44), a = i(47), s = i(48), o = i(20); function u(e) { o.call(this, "digest"), this._hash = e } r(u, o), u.prototype._update = function(e) { this._hash.update(e) }, u.prototype._final = function() { return this._hash.digest() }, e.exports = function(e) { return "md5" === (e = e.toLowerCase()) ? new n : "rmd160" === e || "ripemd160" === e ? new a : new u(s( e)) } }, function(e, t, i) { function r(e) { return Object.prototype.toString.call(e) } t.isArray = function(e) { return Array.isArray ? Array.isArray(e) : "[object Array]" === r(e) }, t.isBoolean = function(e) { return "boolean" == typeof e }, t.isNull = function(e) { return null === e }, t.isNullOrUndefined = function(e) { return null == e }, t.isNumber = function(e) { return "number" == typeof e }, t.isString = function(e) { return "string" == typeof e }, t.isSymbol = function(e) { return "symbol" == typeof e }, t.isUndefined = function(e) { return void 0 === e }, t.isRegExp = function(e) { return "[object RegExp]" === r(e) }, t.isObject = function(e) { return "object" == typeof e && null !== e }, t.isDate = function(e) { return "[object Date]" === r(e) }, t.isError = function(e) { return "[object Error]" === r(e) || e instanceof Error }, t.isFunction = function(e) { return "function" == typeof e }, t.isPrimitive = function(e) { return null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || "symbol" == typeof e || void 0 === e }, t.isBuffer = i(10).Buffer.isBuffer }, function(e, t, i) { (function(t) { e.exports = function(e, i) { for (var r = Math.min(e.length, i.length), n = new t(r), a = 0; a < r; ++a) n[a] = e[a] ^ i[a]; return n } }).call(this, i(10).Buffer) }, function(e, t, i) { "use strict"; var r = i(18), n = i(14); function a() { this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this .constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this .blockSize / 32 } t.BlockHash = a, a.prototype.update = function(e, t) { if (e = r.toArray(e, t), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this .pendingTotal += e.length, this.pending.length >= this._delta8) { var i = (e = this.pending).length % this._delta8; this.pending = e.slice(e.length - i, e.length), 0 === this.pending.length && (this.pending = null), e = r.join32(e, 0, e.length - i, this.endian); for (var n = 0; n < e.length; n += this._delta32) this._update(e, n, n + this._delta32) } return this }, a.prototype.digest = function(e) { return this.update(this._pad()), n(null === this.pending), this._digest(e) }, a.prototype._pad = function() { var e = this.pendingTotal, t = this._delta8, i = t - (e + this.padLength) % t, r = new Array(i + this.padLength); r[0] = 128; for (var n = 1; n < i; n++) r[n] = 0; if (e <<= 3, "big" === this.endian) { for (var a = 8; a < this.padLength; a++) r[n++] = 0; r[n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = e >>> 24 & 255, r[n++] = e >>> 16 & 255, r[ n++] = e >>> 8 & 255, r[n++] = 255 & e } else for (r[n++] = 255 & e, r[n++] = e >>> 8 & 255, r[n++] = e >>> 16 & 255, r[n++] = e >>> 24 & 255, r[ n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = 0, a = 8; a < this.padLength; a++) r[n++] = 0; return r } }, function(e, t, i) { "use strict"; var r = i(5), n = i(64).Reporter, a = i(62).Buffer; function s(e, t) { n.call(this, t), a.isBuffer(e) ? (this.base = e, this.offset = 0, this.length = e.length) : this.error( "Input not Buffer") } function o(e, t) { if (Array.isArray(e)) this.length = 0, this.value = e.map(function(e) { return o.isEncoderBuffer(e) || (e = new o(e, t)), this.length += e.length, e }, this); else if ("number" == typeof e) { if (!(0 <= e && e <= 255)) return t.error("non-byte EncoderBuffer value"); this.value = e, this.length = 1 } else if ("string" == typeof e) this.value = e, this.length = a.byteLength(e); else { if (!a.isBuffer(e)) return t.error("Unsupported type: " + typeof e); this.value = e, this.length = e.length } } r(s, n), t.DecoderBuffer = s, s.isDecoderBuffer = function(e) { return e instanceof s || "object" == typeof e && a.isBuffer(e.base) && "DecoderBuffer" === e.constructor .name && "number" == typeof e.offset && "number" == typeof e.length && "function" == typeof e.save && "function" == typeof e.restore && "function" == typeof e.isEmpty && "function" == typeof e .readUInt8 && "function" == typeof e.skip && "function" == typeof e.raw }, s.prototype.save = function() { return { offset: this.offset, reporter: n.prototype.save.call(this) } }, s.prototype.restore = function(e) { var t = new s(this.base); return t.offset = e.offset, t.length = this.offset, this.offset = e.offset, n.prototype.restore.call( this, e.reporter), t }, s.prototype.isEmpty = function() { return this.offset === this.length }, s.prototype.readUInt8 = function(e) { return this.offset + 1 <= this.length ? this.base.readUInt8(this.offset++, !0) : this.error(e || "DecoderBuffer overrun") }, s.prototype.skip = function(e, t) { if (!(this.offset + e <= this.length)) return this.error(t || "DecoderBuffer overrun"); var i = new s(this.base); return i._reporterState = this._reporterState, i.offset = this.offset, i.length = this.offset + e, this .offset += e, i }, s.prototype.raw = function(e) { return this.base.slice(e ? e.offset : this.offset, this.length) }, t.EncoderBuffer = o, o.isEncoderBuffer = function(e) { return e instanceof o || "object" == typeof e && "EncoderBuffer" === e.constructor.name && "number" == typeof e.length && "function" == typeof e.join }, o.prototype.join = function(e, t) { return e || (e = a.alloc(this.length)), t || (t = 0), 0 === this.length || (Array.isArray(this.value) ? this.value.forEach(function(i) { i.join(e, t), t += i.length }) : ("number" == typeof this.value ? e[t] = this.value : "string" == typeof this.value ? e.write( this.value, t) : a.isBuffer(this.value) && this.value.copy(e, t), t += this.length)), e } }, function(e, t, i) { "use strict"; var r = i(8), n = i.n(r), a = i(0), s = i(7), o = i(17); function u(e, t, i) { var r = e; if (t + i < r.length) { for (; i--;) if (128 != (192 & r[++t])) return !1; return !0 } return !1 } var l, d = function(e) { for (var t = [], i = e, r = 0, n = e.length; r < n;) if (i[r] < 128) t.push(String.fromCharCode(i[r])), ++r; else { if (i[r] < 192); else if (i[r] < 224) { if (u(i, r, 1)) { var a = (31 & i[r]) << 6 | 63 & i[r + 1]; if (a >= 128) { t.push(String.fromCharCode(65535 & a)), r += 2; continue } } } else if (i[r] < 240) { if (u(i, r, 2)) { var s = (15 & i[r]) << 12 | (63 & i[r + 1]) << 6 | 63 & i[r + 2]; if (s >= 2048 && 55296 != (63488 & s)) { t.push(String.fromCharCode(65535 & s)), r += 3; continue } } } else if (i[r] < 248 && u(i, r, 3)) { var o = (7 & i[r]) << 18 | (63 & i[r + 1]) << 12 | (63 & i[r + 2]) << 6 | 63 & i[r + 3]; if (o > 65536 && o < 1114112) { o -= 65536, t.push(String.fromCharCode(o >>> 10 | 55296)), t.push(String.fromCharCode(1023 & o | 56320)), r += 4; continue } } t.push(String.fromCharCode(65533)), ++r } return t.join("") }, c = i(4), h = (l = new ArrayBuffer(2), new DataView(l).setInt16(0, 256, !0), 256 === new Int16Array(l)[0]), f = function() { function e() {} return e.parseScriptData = function(t, i, r) { var n = {}; try { var s = e.parseValue(t, i, r), o = e.parseValue(t, i + s.size, r - s.size); n[s.data] = o.data } catch (e) { a.a.e("AMF", e.toString()) } return n }, e.parseObject = function(t, i, r) { if (r < 3) throw new c.a("Data not enough when parse ScriptDataObject"); var n = e.parseString(t, i, r), a = e.parseValue(t, i + n.size, r - n.size), s = a.objectEnd; return { data: { name: n.data, value: a.data }, size: n.size + a.size, objectEnd: s } }, e.parseVariable = function(t, i, r) { return e.parseObject(t, i, r) }, e.parseString = function(e, t, i) { if (i < 2) throw new c.a("Data not enough when parse String"); var r = new DataView(e, t, i).getUint16(0, !h); return { data: r > 0 ? d(new Uint8Array(e, t + 2, r)) : "", size: 2 + r } }, e.parseLongString = function(e, t, i) { if (i < 4) throw new c.a("Data not enough when parse LongString"); var r = new DataView(e, t, i).getUint32(0, !h); return { data: r > 0 ? d(new Uint8Array(e, t + 4, r)) : "", size: 4 + r } }, e.parseDate = function(e, t, i) { if (i < 10) throw new c.a("Data size invalid when parse Date"); var r = new DataView(e, t, i), n = r.getFloat64(0, !h), a = r.getInt16(8, !h); return { data: new Date(n += 60 * a * 1e3), size: 10 } }, e.parseValue = function(t, i, r) { if (r < 1) throw new c.a("Data not enough when parse Value"); var n, s = new DataView(t, i, r), o = 1, u = s.getUint8(0), l = !1; try { switch (u) { case 0: n = s.getFloat64(1, !h), o += 8; break; case 1: n = !!s.getUint8(1), o += 1; break; case 2: var d = e.parseString(t, i + 1, r - 1); n = d.data, o += d.size; break; case 3: n = {}; var f = 0; for (9 == (16777215 & s.getUint32(r - 4, !h)) && (f = 3); o < r - 4;) { var p = e.parseObject(t, i + o, r - o - f); if (p.objectEnd) break; n[p.data.name] = p.data.value, o += p.size } o <= r - 3 && 9 == (16777215 & s.getUint32(o - 1, !h)) && (o += 3); break; case 8: n = {}, o += 4; var m = 0; for (9 == (16777215 & s.getUint32(r - 4, !h)) && (m = 3); o < r - 8;) { var g = e.parseVariable(t, i + o, r - o - m); if (g.objectEnd) break; n[g.data.name] = g.data.value, o += g.size } o <= r - 3 && 9 == (16777215 & s.getUint32(o - 1, !h)) && (o += 3); break; case 9: n = void 0, o = 1, l = !0; break; case 10: n = []; var v = s.getUint32(1, !h); o += 4; for (var y = 0; y < v; y++) { var _ = e.parseValue(t, i + o, r - o); n.push(_.data), o += _.size } break; case 11: var b = e.parseDate(t, i + 1, r - 1); n = b.data, o += b.size; break; case 12: var w = e.parseString(t, i + 1, r - 1); n = w.data, o += w.size; break; default: o = r, a.a.w("AMF", "Unsupported AMF value type " + u) } } catch (e) { a.a.e("AMF", e.toString()) } return { data: n, size: o, objectEnd: l } }, e }(), p = function() { function e(e) { this.TAG = "ExpGolomb", this._buffer = e, this._buffer_index = 0, this._total_bytes = e.byteLength, this._total_bits = 8 * e.byteLength, this._current_word = 0, this._current_word_bits_left = 0 } var t = e.prototype; return t.destroy = function() { this._buffer = null }, t._fillCurrentWord = function() { var e = this._total_bytes - this._buffer_index; if (e <= 0) throw new c.a("ExpGolomb: _fillCurrentWord() but no bytes available"); var t = Math.min(4, e), i = new Uint8Array(4); i.set(this._buffer.subarray(this._buffer_index, this._buffer_index + t)), this._current_word = new DataView(i.buffer).getUint32(0, !1), this._buffer_index += t, this._current_word_bits_left = 8 * t }, t.readBits = function(e) { if (e > 32) throw new c.b("ExpGolomb: readBits() bits exceeded max 32bits!"); if (e <= this._current_word_bits_left) { var t = this._current_word >>> 32 - e; return this._current_word <<= e, this._current_word_bits_left -= e, t } var i = this._current_word_bits_left ? this._current_word : 0; i >>>= 32 - this._current_word_bits_left; var r = e - this._current_word_bits_left; this._fillCurrentWord(); var n = Math.min(r, this._current_word_bits_left), a = this._current_word >>> 32 - n; return this._current_word <<= n, this._current_word_bits_left -= n, i << n | a }, t.readBool = function() { return 1 === this.readBits(1) }, t.readByte = function() { return this.readBits(8) }, t._skipLeadingZero = function() { var e; for (e = 0; e < this._current_word_bits_left; e++) if (0 != (this._current_word & 2147483648 >>> e)) return this._current_word <<= e, this ._current_word_bits_left -= e, e; return this._fillCurrentWord(), e + this._skipLeadingZero() }, t.readUEG = function() { var e = this._skipLeadingZero(); return this.readBits(e + 1) - 1 }, t.readSEG = function() { var e = this.readUEG(); return 1 & e ? e + 1 >>> 1 : -1 * (e >>> 1) }, e }(), m = function() { function e() {} return e._ebsp2rbsp = function(e) { for (var t = e, i = t.byteLength, r = new Uint8Array(i), n = 0, a = 0; a < i; a++) a >= 2 && 3 === t[a] && 0 === t[a - 1] && 0 === t[a - 2] || (r[n] = t[a], n++); return new Uint8Array(r.buffer, 0, n) }, e.parseSPS = function(t) { var i = e._ebsp2rbsp(t), r = new p(i); r.readByte(); var n = r.readByte(); r.readByte(); var a = r.readByte(); r.readUEG(); var s = e.getProfileString(n), o = e.getLevelString(a), u = 1, l = 420, d = 8; if ((100 === n || 110 === n || 122 === n || 244 === n || 44 === n || 83 === n || 86 === n || 118 === n || 128 === n || 138 === n || 144 === n) && (3 === (u = r.readUEG()) && r.readBits(1), u <= 3 && (l = [0, 420, 422, 444][u]), d = r.readUEG() + 8, r.readUEG(), r.readBits(1), r.readBool() )) for (var c = 3 !== u ? 8 : 12, h = 0; h < c; h++) r.readBool() && (h < 6 ? e._skipScalingList(r, 16) : e._skipScalingList(r, 64)); r.readUEG(); var f = r.readUEG(); if (0 === f) r.readUEG(); else if (1 === f) { r.readBits(1), r.readSEG(), r.readSEG(); for (var m = r.readUEG(), g = 0; g < m; g++) r.readSEG() } var v = r.readUEG(); r.readBits(1); var y = r.readUEG(), _ = r.readUEG(), b = r.readBits(1); 0 === b && r.readBits(1), r.readBits(1); var w = 0, E = 0, T = 0, S = 0; r.readBool() && (w = r.readUEG(), E = r.readUEG(), T = r.readUEG(), S = r.readUEG()); var A = 1, k = 1, R = 0, M = !0, O = 0, C = 0; if (r.readBool()) { if (r.readBool()) { var D = r.readByte(); D > 0 && D < 16 ? (A = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2][D - 1], k = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1][D - 1]) : 255 === D && (A = r.readByte() << 8 | r.readByte(), k = r.readByte() << 8 | r.readByte()) } if (r.readBool() && r.readBool(), r.readBool() && (r.readBits(4), r.readBool() && r.readBits(24)), r.readBool() && (r.readUEG(), r.readUEG()), r.readBool()) { var I = r.readBits(32), L = r.readBits(32); M = r.readBool(), R = (O = L) / (C = 2 * I) } } var x = 1; 1 === A && 1 === k || (x = A / k); var P = 0, U = 0; 0 === u ? (P = 1, U = 2 - b) : (P = 3 === u ? 1 : 2, U = (1 === u ? 2 : 1) * (2 - b)); var N = 16 * (y + 1), B = 16 * (_ + 1) * (2 - b); N -= (w + E) * P, B -= (T + S) * U; var F = Math.ceil(N * x); return r.destroy(), r = null, { avc_profile: n, profile_string: s, avc_level: a, level_string: o, bit_depth: d, ref_frames: v, chroma_format: l, chroma_format_string: e.getChromaFormatString(l), frame_rate: { fixed: M, fps: R, fps_den: C, fps_num: O }, sar_ratio: { width: A, height: k }, codec_size: { width: N, height: B }, present_size: { width: F, height: B } } }, e._skipScalingList = function(e, t) { for (var i = 8, r = 8, n = 0; n < t; n++) 0 !== r && (r = (i + e.readSEG() + 256) % 256), i = 0 === r ? i : r }, e.getProfileString = function(e) { switch (e) { case 66: return "Baseline"; case 77: return "Main"; case 88: return "Extended"; case 100: return "High"; case 110: return "High10"; case 122: return "High422"; case 244: return "High444"; default: return "Unknown" } }, e.getLevelString = function(e) { return (e / 10).toFixed(1) }, e.getChromaFormatString = function(e) { switch (e) { case 420: return "4:2:0"; case 422: return "4:2:2"; case 444: return "4:4:4"; default: return "Unknown" } }, e }(), g = i(1), v = i(12); function y(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var _ = function() { function e(e, t) { this.TAG = "FLVDemuxer", this._config = t, this._onError = null, this._onMediaInfo = null, this ._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this ._onDataAvailable = null, this._dataOffset = e.dataOffset, this._firstParse = !0, this._dispatch = ! 1, this._hasAudio = e.hasAudioTrack, this._hasVideo = e.hasVideoTrack, this ._hasAudioFlagOverrided = !1, this._hasVideoFlagOverrided = !1, this ._audioInitialMetadataDispatched = !1, this._videoInitialMetadataDispatched = !1, this._mediaInfo = new o.a, this._mediaInfo.hasAudio = this._hasAudio, this._mediaInfo.hasVideo = this._hasVideo, this ._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this._naluLengthSize = 4, this._timestampBase = 0, this._timescale = 1e3, this._duration = 0, this._durationOverrided = !1, this._referenceFrameRate = { fixed: !0, fps: 23.976, fps_num: 23976, fps_den: 1e3 }, this._flvSoundRateTable = [5500, 11025, 22050, 44100, 48e3], this._mpegSamplingRates = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350 ], this._mpegAudioV10SampleRateTable = [44100, 48e3, 32e3, 0], this._mpegAudioV20SampleRateTable = [ 22050, 24e3, 16e3, 0 ], this._mpegAudioV25SampleRateTable = [11025, 12e3, 8e3, 0], this._mpegAudioL1BitRateTable = [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1 ], this._mpegAudioL2BitRateTable = [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1 ], this._mpegAudioL3BitRateTable = [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1 ], this._videoTrack = { type: "video", id: 1, sequenceNumber: 0, samples: [], length: 0 }, this._audioTrack = { type: "audio", id: 2, sequenceNumber: 0, samples: [], length: 0 }, this._littleEndian = function() { var e = new ArrayBuffer(2); return new DataView(e).setInt16(0, 256, !0), 256 === new Int16Array(e)[0] }(), this._onReceiveH265MediaFLVFrame = null, this._onAudioError = null, this._videoCodecId = 0, this._audioCodecId = 0, this._AVC_SPS = null, this._AVC_PPS = null, this._HEVC_VPS = null, this ._HEVC_SPS = null, this._HEVC_PPS = null, this._StartCode = [0, 0, 0, 1], this._SampleRate = 8e3, this._ChannelNum = 1, this._AudioMaxFrameSize = 0, this._DebugBuf = null, this._DebugBufPos = 0, this._lastAudioPts = 0, this._lastVideoPts = 0, this._index = 0, this._allowAudio = !1, this .sei_data = null } var t, i, r = e.prototype; return r.destroy = function() { this._mediaInfo = null, this._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this._videoTrack = null, this._audioTrack = null, this._onError = null, this._onMediaInfo = null, this._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this._onDataAvailable = null, this._onAudioError = null, this._onReceiveSEIData = null, this ._onReceiveH265MediaFLVFrame = null }, e.probe = function(e) { var t = new Uint8Array(e), i = { match: !1 }; if (70 !== t[0] || 76 !== t[1] || 86 !== t[2] || 1 !== t[3]) return i; var r, n = (4 & t[4]) >>> 2 != 0, a = 0 != (1 & t[4]), s = (r = t)[5] << 24 | r[6] << 16 | r[7] << 8 | r[8]; return s < 9 ? i : { match: !0, consumed: s, dataOffset: s, hasAudioTrack: n, hasVideoTrack: a } }, r.bindDataSource = function(e) { return e.onDataArrival = this.parseChunks.bind(this), this }, r.resetMediaInfo = function() { this._mediaInfo = new o.a }, r._isInitialMetadataDispatched = function() { return this._hasAudio && this._hasVideo ? this._audioInitialMetadataDispatched && this ._videoInitialMetadataDispatched : this._hasAudio && !this._hasVideo ? this ._audioInitialMetadataDispatched : !(this._hasAudio || !this._hasVideo) && this ._videoInitialMetadataDispatched }, r.parseChunks = function(t, i) { if (!(this._onError && this._onMediaInfo && this._onTrackMetadata && this._onDataAvailable)) throw new c.a( "Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified"); var r = 0, n = this._littleEndian; if (0 === i) { if (!(t.byteLength > 13)) return 0; r = e.probe(t).dataOffset } for (this._firstParse && (this._firstParse = !1, i + r !== this._dataOffset && a.a.w(this.TAG, "First time parsing but chunk byteStart invalid!"), 0 !== new DataView(t, r).getUint32(0, ! n) && a.a.w(this.TAG, "PrevTagSize0 !== 0 !!!"), r += 4); r < t.byteLength;) { this._dispatch = !0; var s = new DataView(t, r); if (r + 11 + 4 > t.byteLength) break; var o = s.getUint8(0), u = 16777215 & s.getUint32(0, !n); if (r + 11 + u + 4 > t.byteLength) break; if (8 === o || 9 === o || 18 === o) { var l = s.getUint8(4), d = s.getUint8(5), h = s.getUint8(6) | d << 8 | l << 16 | s.getUint8(7) << 24; 0 != (16777215 & s.getUint32(7, !n)) && a.a.w(this.TAG, "Meet tag which has StreamID != 0!"); var f = r + 11; switch (o) { case 8: h - this._lastAudioPts <= 0 && (this._index > 1 && (this._hasAudioFlagOverrided = !0, this ._mediaInfo.hasAudio = !1, this._hasAudio = !1, this._onAudioError()), this._index++), this._lastAudioPts = h, this._audioCodecId = this._parseAudioData(t, f, u, h); break; case 9: this._lastVideoPts = h, this._parseVideoData(t, f, u, h, i + r); break; case 18: this._parseScriptData(t, f, u) } var p = s.getUint32(11 + u, !n); p !== 11 + u && a.a.w(this.TAG, "Invalid PrevTagSize " + p), r += 11 + u + 4 } else a.a.w(this.TAG, "Unsupported tag type " + o + ", skipped"), r += 11 + u + 4 } return this._isInitialMetadataDispatched() && this._dispatch && (this._audioTrack.samples.length || this._videoTrack.samples.length) && (7 === this._videoCodecId || 0 === this._videoCodecId ? "auto" === this._config.decodeType ? this._onDataAvailable(this._audioTrack, this._videoTrack) : (this._videoTrack.samples.length > 0 && this._onDataAvailableToSoftwareDecodeVideo(27, this ._videoTrack), this._audioTrack.samples.length > 0 && this ._onDataAvailableToSoftwareDecodeAudio(10 === this._audioCodecId ? 86018 : 0, this ._audioTrack)) : 12 === this._videoCodecId && (this._videoTrack.samples.length > 0 && this ._onDataAvailableToSoftwareDecodeVideo(173, this._videoTrack), this._audioTrack.samples .length > 0 && this._onDataAvailableToSoftwareDecodeAudio(10 === this._audioCodecId ? 86018 : 0, this._audioTrack))), r }, r._parseScriptData = function(e, t, i) { new DataView(e, t, i); var r = f.parseScriptData(e, t, i); if (r.hasOwnProperty("onMetaData")) { if (null == r.onMetaData || "object" != typeof r.onMetaData) return void a.a.w(this.TAG, "Invalid onMetaData structure!"); this._metadata && a.a.w(this.TAG, "Found another onMetaData tag!"), this._metadata = r; var n = this._metadata.onMetaData; if (this._onMetaDataArrived && this._onMetaDataArrived(Object.assign({}, n)), "boolean" == typeof n.hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = n.hasAudio, this ._mediaInfo.hasAudio = this._hasAudio), "boolean" == typeof n.hasVideo && !1 === this ._hasVideoFlagOverrided && (this._hasVideo = n.hasVideo, this._mediaInfo.hasVideo = this ._hasVideo), "number" == typeof n.audiodatarate && (this._mediaInfo.audioDataRate = n .audiodatarate), "number" == typeof n.videodatarate && (this._mediaInfo.videoDataRate = n .videodatarate), "number" == typeof n.width && (this._mediaInfo.width = n.width), "number" == typeof n.height && (this._mediaInfo.height = n.height), "number" == typeof n.duration) { if (!this._durationOverrided) { var s = Math.floor(n.duration * this._timescale); this._duration = s, this._mediaInfo.duration = s } } else this._mediaInfo.duration = 0; if ("number" == typeof n.framerate) { var o = Math.floor(1e3 * n.framerate); if (o > 0) { var u = o / 1e3; this._referenceFrameRate.fixed = !0, this._referenceFrameRate.fps = u, this ._referenceFrameRate.fps_num = o, this._referenceFrameRate.fps_den = 1e3, this._mediaInfo .fps = u } } if ("object" == typeof n.keyframes) { this._mediaInfo.hasKeyframesIndex = !0; var l = n.keyframes; this._mediaInfo.keyframesIndex = this._parseKeyframesIndex(l), n.keyframes = null } else this._mediaInfo.hasKeyframesIndex = !1; this._dispatch = !1, this._mediaInfo.metadata = n, a.a.v(this.TAG, "Parsed onMetaData"), this ._mediaInfo.isComplete() && this._onMediaInfo(this._mediaInfo) } Object.keys(r).length > 0 && this._onScriptDataArrived && this._onScriptDataArrived(Object .assign({}, r)) }, r._parseKeyframesIndex = function(e) { for (var t = [], i = [], r = 1; r < e.times.length; r++) { var n = this._timestampBase + Math.floor(1e3 * e.times[r]); t.push(n), i.push(e.filepositions[r]) } return { times: t, filepositions: i } }, r._parseAudioData = function(e, t, i, r) { if (i <= 1) return a.a.w(this.TAG, "Flv: Invalid audio packet, missing SoundData payload!"), 0; if (!0 === this._hasAudioFlagOverrided && !1 === this._hasAudio) return 0; this._littleEndian; var n = new DataView(e, t, i).getUint8(0), s = n >>> 4; if (2 !== s && 10 !== s) return this._onError(v.a.CODEC_UNSUPPORTED, "Flv: Unsupported audio codec idx: " + s), 0; var o, u = (12 & n) >>> 2; if (!(u >= 0 && u <= 4)) return this._onError(v.a.FORMAT_ERROR, "Flv: Invalid audio sample rate idx: " + u), 0; o = this._flvSoundRateTable[u]; var l = 1 & n, d = this._audioMetadata, c = this._audioTrack; if (d || (!1 === this._hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = !0, this ._mediaInfo.hasAudio = !0), (d = this._audioMetadata = {}).type = "audio", d.id = c.id, d .timescale = this._timescale, d.duration = this._duration, d.audioSampleRate = o, d .channelCount = 0 === l ? 1 : 2), 10 === s) { var h = this._parseAACAudioData(e, t + 1, i - 1); if (null == h) return 0; if (0 === h.packetType) { d.config && a.a.w(this.TAG, "Found another AudioSpecificConfig!"); var f = h.data; d.audioSampleRate = f.samplingRate, d.channelCount = f.channelCount, d.codec = f.codec, d .originalCodec = f.originalCodec, d.config = f.config, d.refSampleDuration = 1024 / d .audioSampleRate * d.timescale, a.a.v(this.TAG, "Parsed AudioSpecificConfig"), this ._SampleRate = f.samplingRate, this._ChannelNum = f.channelCount, this ._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.samples.length || this ._videoTrack.samples.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this._audioInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata("audio", d); var p = this._mediaInfo; p.audioCodec = d.originalCodec, p.audioSampleRate = d.audioSampleRate, p.audioChannelCount = d .channelCount, p.hasVideo ? null != p.videoCodec && (p.mimeType = 'video/x-flv; codecs="' + p .videoCodec + "," + p.audioCodec + '"') : p.mimeType = 'video/x-flv; codecs="' + p .audioCodec + '"', p.isComplete() && this._onMediaInfo(p) } else if (1 === h.packetType) { var m = this._timestampBase + r, g = { unit: h.data, length: h.data.byteLength, dts: m, pts: m }; c.samples.push(g), c.length += h.data.length, h.data.length > this._AudioMaxFrameSize && (this ._AudioMaxFrameSize = h.data.length) } else a.a.e(this.TAG, "Flv: Unsupported AAC data type " + h.packetType) } else if (2 === s) { if (!d.codec) { var y = this._parseMP3AudioData(e, t + 1, i - 1, !0); if (null == y) return 0; d.audioSampleRate = y.samplingRate, d.channelCount = y.channelCount, d.codec = y.codec, d .originalCodec = y.originalCodec, d.refSampleDuration = 1152 / d.audioSampleRate * d .timescale, a.a.v(this.TAG, "Parsed MPEG Audio Frame Header"), this ._audioInitialMetadataDispatched = !0, this._onTrackMetadata("audio", d); var _ = this._mediaInfo; _.audioCodec = d.codec, _.audioSampleRate = d.audioSampleRate, _.audioChannelCount = d .channelCount, _.audioDataRate = y.bitRate, _.hasVideo ? null != _.videoCodec && (_.mimeType = 'video/x-flv; codecs="' + _.videoCodec + "," + _.audioCodec + '"') : _.mimeType = 'video/x-flv; codecs="' + _.audioCodec + '"', _.isComplete() && this._onMediaInfo(_) } var b = this._parseMP3AudioData(e, t + 1, i - 1, !1); if (null == b) return 0; var w = this._timestampBase + r, E = { unit: b, length: b.byteLength, dts: w, pts: w }; c.samples.push(E), c.length += b.length } return s }, r._parseAACAudioData = function(e, t, i) { if (!(i <= 1)) { var r = {}, n = new Uint8Array(e, t, i); return r.packetType = n[0], 0 === n[0] ? r.data = this._parseAACAudioSpecificConfig(e, t + 1, i - 1) : r.data = n.subarray(1), r } a.a.w(this.TAG, "Flv: Invalid AAC packet, missing AACPacketType or/and Data!") }, r._parseAACAudioSpecificConfig = function(e, t, i) { var r, n, a = new Uint8Array(e, t, i), s = null, o = 0, u = null; if (o = r = a[0] >>> 3, (n = (7 & a[0]) << 1 | a[1] >>> 7) < 0 || n >= this._mpegSamplingRates .length) this._onError(v.a.FORMAT_ERROR, "Flv: AAC invalid sampling frequency index!"); else { var l = this._mpegSamplingRates[n], d = (120 & a[1]) >>> 3; if (!(d < 0 || d >= 8)) { 5 === o && (u = (7 & a[1]) << 1 | a[2] >>> 7, a[2]); var c = self.navigator.userAgent.toLowerCase(); return -1 !== c.indexOf("firefox") ? n >= 6 ? (o = 5, s = new Array(4), u = n - 3) : (o = 2, s = new Array(2), u = n) : -1 !== c.indexOf("android") ? (o = 2, s = new Array(2), u = n) : (o = 5, u = n, s = new Array(4), n >= 6 ? u = n - 3 : 1 === d && (o = 2, s = new Array(2), u = n) ), s[0] = o << 3, s[0] |= (15 & n) >>> 1, s[1] = (15 & n) << 7, s[1] |= (15 & d) << 3, 5 === o && (s[1] |= (15 & u) >>> 1, s[2] = (1 & u) << 7, s[2] |= 8, s[3] = 0), { config: s, samplingRate: l, channelCount: d, codec: "mp4a.40." + o, originalCodec: "mp4a.40." + r } } this._onError(v.a.FORMAT_ERROR, "Flv: AAC invalid channel configuration") } }, r._parseMP3AudioData = function(e, t, i, r) { if (!(i < 4)) { this._littleEndian; var n = new Uint8Array(e, t, i), s = null; if (r) { if (255 !== n[0]) return; var o = n[1] >>> 3 & 3, u = (6 & n[1]) >> 1, l = (240 & n[2]) >>> 4, d = (12 & n[2]) >>> 2, c = 3 != (n[3] >>> 6 & 3) ? 2 : 1, h = 0, f = 0; switch (o) { case 0: h = this._mpegAudioV25SampleRateTable[d]; break; case 2: h = this._mpegAudioV20SampleRateTable[d]; break; case 3: h = this._mpegAudioV10SampleRateTable[d] } switch (u) { case 1: l < this._mpegAudioL3BitRateTable.length && (f = this._mpegAudioL3BitRateTable[l]); break; case 2: l < this._mpegAudioL2BitRateTable.length && (f = this._mpegAudioL2BitRateTable[l]); break; case 3: l < this._mpegAudioL1BitRateTable.length && (f = this._mpegAudioL1BitRateTable[l]) } s = { bitRate: f, samplingRate: h, channelCount: c, codec: "mp3", originalCodec: "mp3" } } else s = n; return s } a.a.w(this.TAG, "Flv: Invalid MP3 packet, header missing!") }, r._parseVideoData = function(e, t, i, r, n) { if (i <= 1) a.a.w(this.TAG, "Flv: Invalid video packet, missing VideoData payload!"); else if (!0 !== this._hasVideoFlagOverrided || !1 !== this._hasVideo) { var s = new Uint8Array(e, t, i)[0], o = (240 & s) >>> 4; this._videoCodecId = 15 & s, 7 === this._videoCodecId || 12 === this._videoCodecId ? (g.h(7 === this._videoCodecId ? "H264" : "H265"), this._parseAVCAndHEVCVideoPacket(e, t + 1, i - 1, r, n, o)) : this._onError(v.a.CODEC_UNSUPPORTED, "Flv: Unsupported codec in video frame: " + codecId) } }, r._parseAVCAndHEVCVideoPacket = function(e, t, i, r, n, s) { if (i < 4) a.a.w(this.TAG, "Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime"); else { var o = this._littleEndian, u = new DataView(e, t, i), l = u.getUint8(0), d = (16777215 & u.getUint32(0, !o)) << 8 >> 8; if (0 === l) 7 === this._videoCodecId ? this._parseAVCDecoderConfigurationRecord(e, t + 4, i - 4) : this._parseHEVCDecoderConfigurationRecord(e, t + 4, i - 4); else if (1 === l) 7 === this._videoCodecId ? this._parseAVCVideoData(e, t + 4, i - 4, r, n, s, d) : this._parseHEVCVideoData(e, t + 4, i - 4, r, n, s, d); else if (2 !== l) return void this._onError(v.a.FORMAT_ERROR, "Flv: Invalid video packet type " + l) } }, r._parseAVCDecoderConfigurationRecord = function(e, t, i) { if (i < 7) a.a.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!"); else { var r = this._videoMetadata, n = this._videoTrack, s = this._littleEndian, o = new DataView(e, t, i); if (r) void 0 !== r.avcc && a.a.w(this.TAG, "Found another AVCDecoderConfigurationRecord!"); else { !1 === this._hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = !0, this ._mediaInfo.hasVideo = !0), (r = this._videoMetadata = {}).type = "video", r.id = n.id, r .timescale = this._timescale, r.duration = this._duration; var u = o.getUint8(0), l = o.getUint8(1); if (o.getUint8(2), o.getUint8(3), 1 === u && 0 !== l) if (this._naluLengthSize = 1 + (3 & o.getUint8(4)), 3 === this._naluLengthSize || 4 === this ._naluLengthSize) { var d = 31 & o.getUint8(5); if (0 !== d) { d > 1 && a.a.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: SPS Count = " + d); for (var c = 6, h = 0; h < d; h++) { var f = o.getUint16(c, !s); if (c += 2, 0 !== f) { var p = new Uint8Array(e, t + c, f); this._AVC_SPS = new Uint8Array(f + 4), c += f, this._AVC_SPS.set(this._StartCode, 0), this._AVC_SPS.set(p, 4); var g = m.parseSPS(p); if (0 === h) { r.codecWidth = g.codec_size.width, r.codecHeight = g.codec_size.height, r .presentWidth = g.present_size.width, r.presentHeight = g.present_size.height, r .profile = g.profile_string, r.level = g.level_string, r.bitDepth = g.bit_depth, r .chromaFormat = g.chroma_format, r.sarRatio = g.sar_ratio, r.frameRate = g .frame_rate, !1 !== g.frame_rate.fixed && 0 !== g.frame_rate.fps_num && 0 !== g .frame_rate.fps_den || (r.frameRate = this._referenceFrameRate); var y = r.frameRate.fps_den, _ = r.frameRate.fps_num; r.refSampleDuration = r.timescale * (y / _); for (var b = p.subarray(1, 4), w = "avc1.", E = 0; E < 3; E++) { var T = b[E].toString(16); T.length < 2 && (T = "0" + T), w += T } r.codec = w; var S = this._mediaInfo; S.width = r.codecWidth, S.height = r.codecHeight, S.fps = r.frameRate.fps, S .profile = r.profile, S.level = r.level, S.refFrames = g.ref_frames, S .chromaFormat = g.chroma_format_string, S.sarNum = r.sarRatio.width, S.sarDen = r .sarRatio.height, S.videoCodec = w, S.hasAudio ? null != S.audioCodec && (S .mimeType = 'video/x-flv; codecs="' + S.videoCodec + "," + S.audioCodec + '"') : S.mimeType = 'video/x-flv; codecs="' + S.videoCodec + '"', S.isComplete() && this ._onMediaInfo(S) } } } var A = o.getUint8(c); if (0 !== A) { A > 1 && a.a.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: PPS Count = " + A), c++; for (var k = 0; k < A; k++) { var R = o.getUint16(c, !s); if (c += 2, 0 !== R) { var M = new Uint8Array(e, t + c, R); this._AVC_PPS = new Uint8Array(R + 4), this._AVC_PPS.set(this._StartCode, 0), this ._AVC_PPS.set(M, 4), c += R } } r.avcc = new Uint8Array(i), r.avcc.set(new Uint8Array(e, t, i), 0), a.a.v(this.TAG, "Parsed AVCDecoderConfigurationRecord"), this._isInitialMetadataDispatched() ? this ._dispatch && (this._audioTrack.length || this._videoTrack.length) && this ._onDataAvailable(this._audioTrack, this._videoTrack) : this ._videoInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata( "video", r), a.a.i(this.TAG, "Video resolution: " + r.codecWidth + " x " + r .codecHeight) } else this._onError(v.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No PPS") } else this._onError(v.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No SPS") } else this._onError(v.a.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this ._naluLengthSize - 1)); else this._onError(v.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord") } } }, r._parseHEVCDecoderConfigurationRecord = function(e, t, i) { if (i < 7) a.a.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!"); else { var r = this._videoMetadata, n = this._videoTrack, s = this._littleEndian, o = new DataView(e, t, i); r ? void 0 !== r.avcc && a.a.w(this.TAG, "Found another AVCDecoderConfigurationRecord!") : (!1 === this._hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = !0, this._mediaInfo .hasVideo = !0), (r = this._videoMetadata = {}).type = "video", r.id = n.id, r.timescale = this._timescale, r.duration = this._duration); var u = o.getUint8(0), l = o.getUint8(1), d = o.getUint8(2), c = o.getUint8(3); if (0 === u && 0 === l && 0 === d && 1 === c); else { var h = 22, f = o.getUint8(h); h += 1; for (var p = 0; p < f; p++) { var m = o.getUint8(h); h += 1, o.getUint16(h, !s), h += 2; var g = o.getUint16(h, !s); if (h += 2, 32 === m || 160 == m) { var v = new Uint8Array(e, t + h, g); this._HEVC_VPS = new Uint8Array(g + 4), this._HEVC_VPS.set(this._StartCode, 0), this ._HEVC_VPS.set(v, 4) } else if (33 === m || 161 == m) { var y = new Uint8Array(e, t + h, g); this._HEVC_SPS = new Uint8Array(g + 4), this._HEVC_SPS.set(this._StartCode, 0), this ._HEVC_SPS.set(y, 4) } else if (34 === m || 162 == m) { var _ = new Uint8Array(e, t + h, g); this._HEVC_PPS = new Uint8Array(g + 4), this._HEVC_PPS.set(this._StartCode, 0), this ._HEVC_PPS.set(_, 4) } h += g } } this._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.length || this ._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this ._videoInitialMetadataDispatched = !0, this._dispatch = !1 } }, r._parseAVCVideoData = function(e, t, i, r, n, s, o) { var u = 0, l = this._littleEndian, d = new DataView(e, t, i), c = [], h = 0, f = 0, p = this._naluLengthSize, m = this._timestampBase + r, g = 1 === s, v = !0; for (7 == this._videoCodecId && ("auto" !== this._config.decodeType && "hard" !== this._config .decodeType || (v = !1)); f < i;) { if (f + 4 >= i) { a.a.w(this.TAG, "Malformed Nalu near timestamp " + m + ", offset = " + f + ", dataSize = " + i); break } var y = d.getUint32(f, !l); if (3 === p && (y >>>= 8), y > i - p) return void a.a.w(this.TAG, "Malformed Nalus near timestamp " + m + ", NaluSize > DataSize!"); if (5 == (u = 31 & d.getUint8(f + p)) && (g = !0, c.length < 1 && this._AVC_SPS && this._AVC_SPS .length > 0)) if (v) { var _ = { type: 7, data: this._AVC_SPS }; c.push(_), h += _.data.length; var b = { type: 8, data: this._AVC_PPS }; c.push(b), h += b.data.length } else { var w = this._AVC_SPS.subarray(0, this._AVC_SPS.length), E = w.length - 4; w[0] = E >> 24, w[1] = E >> 16, w[2] = E >> 8, w[3] = 255 & E; var T = { type: 7, data: w }; c.push(T), h += T.data.length; var S = this._AVC_PPS.subarray(0, this._AVC_PPS.length), A = S.length - 4; S[0] = A >> 24, S[1] = A >> 16, S[2] = A >> 8, S[3] = 255 & A; var k = { type: 8, data: S }; c.push(k), h += k.data.length } if (6 === u && c.length < 1) { var R = d.getUint8(f + p + 1); if (d.getUint8(f + p + 4), 100 === R) { for (var M = 0, O = 0, C = 0; C < 10; C++) { var D = 255 & d.getUint8(f + p + 1 + 1 + O); if (O++, M += D, 255 !== D) break } var I = void 0, L = null; return (M > 16 || M >= 3) && (I = new Uint8Array(e, t + f + p + 1 + O + 1, M - 1), L = new TextDecoder("utf-8").decode(I)), this.sei_data = L } return this.sei_data = null } var x = new Uint8Array(e, t + f, p + y), P = { type: u, data: x }; c.push(P), h += x.byteLength, f += p + y } if (6 === u && "soft" !== this._config.decodeType) return console.log("{unitType:" + u + ",decodeType:" + this._config.decodeType); if (c.length) { var U = this._videoTrack, N = { units: c, length: h, isKeyframe: g, dts: m, cts: o, pts: m + o, sei: this.sei_data }; g && (N.fileposition = n), U.samples.push(N), U.length += h, this.sei_data = null } }, r._makeH265Header = function(e) { var t = 2; switch (e) { case 78: case 80: t = 1; break; case 64: case 66: case 32: case 34: case 36: case 38: case 40: case 42: t = 1 } return t }, r._parseHEVCVideoData = function(e, t, i, r, n, s, o) { var u = this._littleEndian, l = new DataView(e, t, i), d = this._timestampBase + r, c = 1 === s, h = [], f = 0; for (this._naluLengthSize; f < i;) { if (f + 4 >= i) { a.a.w(this.TAG, "Malformed Nalu near timestamp " + d + ", offset = " + f + ", dataSize = " + i); break } var p = l.getUint8(f), m = l.getUint8(f + 1), g = l.getUint8(f + 2), v = l.getUint8(f + 3); if (0 === p && 0 === m && 0 === g && 1 === v); else { var y = l.getUint32(f, !u); f += 4; var _ = l.getUint8(f); if (f += 1, y > i - 4) return void a.a.w(this.TAG, "Malformed Nalus near timestamp " + d + ", NaluSize > DataSize!"); if (y + f - 1 > i) break; var b = l.getUint8(f - 1), w = this._makeH265Header(b); if ((32 === b || 34 === b || 36 === b || 38 === b || 40 === b || 42 === b) && h.length < 1) { if (this._HEVC_VPS) { var E = { type: 5, data: this._HEVC_VPS }; h.push(E), this._HEVC_VPS.length } if (this._HEVC_SPS) { var T = { type: 6, data: this._HEVC_SPS }; h.push(T), this._HEVC_SPS.length } if (this._HEVC_PPS) { var S = { type: 7, data: this._HEVC_PPS }; h.push(S), this._HEVC_PPS.length } } if (1 === w && this._HEVC_VPS && this._HEVC_VPS[0], 78 != _ && t + f - 1 - 4 >= 0 && y > 0) { var A = new Uint8Array(e, t + f - 1 - 4, y + 4); A[0] = 0, A[1] = 0, A[2] = 0, A[3] = 1; var k = { type: 5, data: A }; h.push(k), A.length } f += y - 1 } } if (h.length) { var R = this._videoTrack, M = { units: h, length: 0, isKeyframe: c, dts: d, cts: o, pts: d + o }; c && (M.fileposition = n), R.samples.push(M), R.length += 0 } }, r._onDataAvailableToSoftwareDecodeVideo = function(e, t) { var i = t.samples, r = -1; for (i.length > 1 && (r = 0); i.length;) { for (var n = i.shift(), a = 0, s = 0; s < n.units.length; s++) a += n.units[s].data.length; for (var o = 0, u = new Uint8Array(a); n.units.length;) { var l = n.units.shift(); 27 === e && (l.data[0] = 0, l.data[1] = 0, l.data[2] = 0, l.data[3] = 1), u.set(l.data, o), o += l.data.length } this._onReceiveH265MediaFLVFrame && (r >= 0 && r++, this._onReceiveH265MediaFLVFrame("video", !0, 1, e, n.isKeyframe, u, a, n.pts, 0, 0, 0, n.sei)) } }, r._onDataAvailableToSoftwareDecodeAudio = function(e, t) { var i = t.samples, r = -1; for (i.length > 1 && (r = 0); i.length;) { var n = i.shift(); this._onReceiveH265MediaFLVFrame && (r >= 0 && r++, this._onReceiveH265MediaFLVFrame("audio", !0, 2, e, 0, n.unit, n.length, n.pts, this._SampleRate, this._ChannelNum, this._SampleRate >= 44100 ? 32 : 16)) } }, t = e, (i = [{ key: "onTrackMetadata", get: function() { return this._onTrackMetadata }, set: function(e) { this._onTrackMetadata = e } }, { key: "onMediaInfo", get: function() { return this._onMediaInfo }, set: function(e) { this._onMediaInfo = e } }, { key: "onMetaDataArrived", get: function() { return this._onMetaDataArrived }, set: function(e) { this._onMetaDataArrived = e } }, { key: "onReceiveH265MediaFLVFrame", get: function() { return this._onReceiveH265MediaFLVFrame }, set: function(e) { this._onReceiveH265MediaFLVFrame = e } }, { key: "onAudioError", get: function() { return this._onAudioError }, set: function(e) { this._onAudioError = e } }, { key: "onReceiveSEIData", get: function() { return this._onReceiveSEIData }, set: function(e) { this._onReceiveSEIData = e } }, { key: "onScriptDataArrived", get: function() { return this._onScriptDataArrived }, set: function(e) { this._onScriptDataArrived = e } }, { key: "onError", get: function() { return this._onError }, set: function(e) { this._onError = e } }, { key: "onDataAvailable", get: function() { return this._onDataAvailable }, set: function(e) { this._onDataAvailable = e } }, { key: "timestampBase", get: function() { return this._timestampBase }, set: function(e) { this._timestampBase = e } }, { key: "overridedDuration", get: function() { return this._duration }, set: function(e) { this._durationOverrided = !0, this._duration = e, this._mediaInfo.duration = e } }, { key: "overridedHasAudio", set: function(e) { this._hasAudioFlagOverrided = !0, this._hasAudio = e, this._mediaInfo.hasAudio = e } }, { key: "overridedHasVideo", set: function(e) { this._hasVideoFlagOverrided = !0, this._hasVideo = e, this._mediaInfo.hasVideo = e } }]) && y(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); function b(e, t) { return !!(t + 1 < e.length && function(e, t) { return 255 === e[t] && 240 == (246 & e[t + 1]) }(e, t)) } function w(e, t, i) { return function(e, t, i) { var r, n, a, s, o, u = navigator.userAgent.toLowerCase(), l = i, d = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]; if (r = 1 + ((192 & e[t + 2]) >>> 6), !((n = (60 & e[t + 2]) >>> 2) > d.length - 1)) return s = (1 & e[t + 2]) << 2, s |= (192 & e[t + 3]) >>> 6, /firefox/i.test(u) ? n >= 6 ? (r = 5, o = new Array(4), a = n - 3) : (r = 2, o = new Array(2), a = n) : -1 !== u.indexOf("android") ? (r = 2, o = new Array(2), a = n) : (r = 5, o = new Array(4), i && (-1 !== i.indexOf("mp4a.40.29") || -1 !== i.indexOf("mp4a.40.5")) || !i && n >= 6 ? a = n - 3 : ((i && -1 !== i.indexOf( "mp4a.40.2") && (n >= 6 && 1 === s || /vivaldi/i.test(u)) || !i && 1 === s) && (r = 2, o = new Array(2)), a = n)), o[0] = r << 3, o[0] |= (14 & n) >> 1, o[1] |= (1 & n) << 7, o[1] |= s << 3, 5 === r && (o[1] |= (14 & a) >> 1, o[2] = (1 & a) << 7, o[2] |= 8, o[3] = 0), { config: o, samplerate: d[n], channelCount: s, codec: "mp4a.40." + r, manifestCodec: l }; console.log("ADTS parse fail. reason: 'invalid ADTS sampling index:${adtsSampleingIndex}'") }(e, t, i) } function E(e) { return 9216e4 / e } function T(e, t, i, r, n) { var a = function(e, t, i, r, n) { var a, s, o = e.length; if (a = function(e, t) { return 1 & e[t + 1] ? 7 : 9 }(e, t), s = function(e, t) { return (3 & e[t + 3]) << 11 | e[t + 4] << 3 | (224 & e[t + 5]) >>> 5 }(e, t), (s -= a) > 0 && t + a + s <= o) return { headerLength: a, frameLength: s, stamp: i + r * n } }(t, i, r, n, E(e)); if (a) { var s = a.stamp, o = a.headerLength, u = a.frameLength; return { sample: { unit: t.subarray(i + o, i + o + u), pts: s, dts: s }, length: u + o } } } var S = function() { function e(e) { this.data = e, this.bytesAvailable = e.byteLength, this.word = 0, this.bitsAvailable = 0 } var t = e.prototype; return t.loadWord = function() { var e = this.data, t = this.bytesAvailable, i = e.byteLength - t, r = new Uint8Array(4), n = Math.min(4, t); if (0 === n) throw new Error("no bytes available"); r.set(e.subarray(i, i + n)), this.word = new DataView(r.buffer).getUint32(0), this.bitsAvailable = 8 * n, this.bytesAvailable -= n }, t.skipBits = function(e) { var t; this.bitsAvailable > e ? (this.word <<= e, this.bitsAvailable -= e) : (e -= this.bitsAvailable, e -= (t = e >> 3) >> 3, this.bytesAvailable -= t, this.loadWord(), this.word <<= e, this .bitsAvailable -= e) }, t.readBits = function(e) { var t = Math.min(this.bitsAvailable, e), i = this.word >>> 32 - t; return e > 32 && logger.error("Cannot read more than 32 bits at a time"), this.bitsAvailable -= t, this.bitsAvailable > 0 ? this.word <<= t : this.bytesAvailable > 0 && this.loadWord(), (t = e - t) > 0 && this.bitsAvailable ? i << t | this.readBits(t) : i }, t.skipLZ = function() { var e; for (e = 0; e < this.bitsAvailable; ++e) if (0 != (this.word & 2147483648 >>> e)) return this.word <<= e, this.bitsAvailable -= e, e; return this.loadWord(), e + this.skipLZ() }, t.skipUEG = function() { this.skipBits(1 + this.skipLZ()) }, t.skipEG = function() { this.skipBits(1 + this.skipLZ()) }, t.readUEG = function() { var e = this.skipLZ(); return this.readBits(e + 1) - 1 }, t.readEG = function() { var e = this.readUEG(); return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1) }, t.readBoolean = function() { return 1 === this.readBits(1) }, t.readUByte = function() { return this.readBits(8) }, t.readUShort = function() { return this.readBits(16) }, t.readUInt = function() { return this.readBits(32) }, t.skipScalingList = function(e) { var t, i = 8, r = 8; for (t = 0; t < e; t++) 0 !== r && (r = (i + this.readEG() + 256) % 256), i = 0 === r ? i : r }, t.readSPS = function() { var e, t, i, r, n, a, s, o = 0, u = 0, l = 0, d = 0, c = this.readUByte.bind(this), h = this.readBits.bind(this), f = this.readUEG.bind(this), p = this.readBoolean.bind(this), m = this.skipBits.bind(this), g = this.skipEG.bind(this), v = this.skipUEG.bind(this), y = this.skipScalingList.bind(this); if (c(), e = c(), h(5), m(3), c(), v(), 100 === e || 110 === e || 122 === e || 244 === e || 44 === e || 83 === e || 86 === e || 118 === e || 128 === e) { var _ = f(); if (3 === _ && m(1), v(), v(), m(1), p()) for (a = 3 !== _ ? 8 : 12, s = 0; s < a; s++) p() && y(s < 6 ? 16 : 64) } v(); var b = f(); if (0 === b) f(); else if (1 === b) for (m(1), g(), g(), t = f(), s = 0; s < t; s++) g(); v(), m(1), i = f(), r = f(), 0 === (n = h(1)) && m(1), m(1), p() && (o = f(), u = f(), l = f(), d = f()); var w = [1, 1]; if (p() && p()) switch (c()) { case 1: w = [1, 1]; break; case 2: w = [12, 11]; break; case 3: w = [10, 11]; break; case 4: w = [16, 11]; break; case 5: w = [40, 33]; break; case 6: w = [24, 11]; break; case 7: w = [20, 11]; break; case 8: w = [32, 11]; break; case 9: w = [80, 33]; break; case 10: w = [18, 11]; break; case 11: w = [15, 11]; break; case 12: w = [64, 33]; break; case 13: w = [160, 99]; break; case 14: w = [4, 3]; break; case 15: w = [3, 2]; break; case 16: w = [2, 1]; break; case 255: w = [c() << 8 | c(), c() << 8 | c()] } return { width: Math.ceil(16 * (i + 1) - 2 * o - 2 * u), height: (2 - n) * (r + 1) * 16 - (n ? 2 : 4) * (l + d), pixelRatio: w } }, t.readSliceType = function() { return this.readUByte(), this.readUEG(), this.readUEG() }, e }(); function A(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var k = function() { function e(e, t, i) { this.TAG = "M3U8Demuxer", this._config = e, this._onError = null, this._onMediaInfo = null, this ._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this ._onDataAvailable = null, this._hasAudio = !1, this._hasVideo = !1, this._hasAudioFlagOverrided = ! 1, this._hasVideoFlagOverrided = !1, this._initVideoMetadata = !1, this._initAudioMetadata = !1, this._mediaInfo = new o.a, this._mediaInfo.hasAudio = !1, this._mediaInfo.hasVideo = !1, this ._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this.tagPosition = 0, this.filePosition = 0, this.isHEVC = 0, this.isAAC = 0, this.avcTrackPid = -1, this .audioTrackPid = -1, this.id3TrackPid = -1, this.audioSampleRate = 0, this.audioChannel = 2, this .audioBitPerSample = 16, this.avcTrackPesData = null, this.audioTrackPesData = null, this .id3TrackPesData = null, this.findKeyframe = !0, this.syncVideoPts = 0, this.syncAudioPts = 0, this .startVideoPts = 0, this.startAudioPts = 0, this.accurateTimeOffset = 0, this.lastVideoPts = 0, this .currentVideoPts = 0, this.seekVideoHistoryPts = 0, this.currentAudioPts = 0, this.audioFrameNum = 0, this.reset = 0, this._videoTrack = { type: "video", id: 1, sequenceNumber: 0, samples: [], length: 0 }, this._audioTrack = { type: "audio", id: 2, sequenceNumber: 0, samples: [], length: 0 }, this._timestampBase = 0, this._timescale = 1e3, this._duration = 0, this._durationOverrided = !1, this._AVC_SPS = null, this._AVC_PPS = null, this._HEVC_VPS = null, this._HEVC_SPS = null, this ._HEVC_PPS = null, this._StartCode = [0, 0, 0, 1], this._AVC_Config = null, this ._callbackInitFlag = !1, this._callbackMediaDataFunc = t, this._callbackMediaDataUserPtr = i, this ._onReceiveH265MediaHLSFrame = null } var t, i, r = e.prototype; return r.bindDataSource = function(e) { return e.onDataArrival = this.append.bind(this), this }, r.resetMediaInfo = function() { this._mediaInfo = new o.a }, r.resetMediaPts = function(e) { this.reset = e, this.syncVideoPts = 0, this.syncAudioPts = 0, this.findKeyframe = !0, this ._videoTrack.samples = [], this._audioTrack.samples = [] }, r._onDataAvailableToSoftwareDecodeVideo = function(e, t) { var i = t.samples; if (e < 1 && i.length > 0) console.log("EXCEPTION:: No used..."); else { var r = -1; for (i.length > 1 && (r = 0); i.length;) { for (var n = i.shift(), a = 0, s = 0; s < n.units.length; s++) a += n.units[s].data.length; for (var o = 0, u = new Uint8Array(a); n.units.length;) { var l = n.units.shift(); 27 == e && (l.data[0] = 0, l.data[1] = 0, l.data[2] = 0, l.data[3] = 1), u.set(l.data, o), o += l.data.length } this._onReceiveH265MediaHLSFrame && (r >= 0 && r++, this._onReceiveH265MediaHLSFrame("video", ! 0, 1, e, n.isKeyframe, u, a, n.pts, 0, 0, 0)) } } }, r._onDataAvailableToSoftwareDecodeAudio = function(e, t) { var i = t.samples, r = -1; for (i.length > 1 && (r = 0); i.length;) { var n = i.shift(); this._onReceiveH265MediaHLSFrame && (r >= 0 && r++, this._onReceiveH265MediaHLSFrame("audio", !0, 2, e, 0, n.unit, n.length, n.pts, this._SampleRate, this._ChannelNum, this._SampleRate >= 44100 ? 32 : 16)) } }, e.createTrack = function(e, t) { return { container: "video" === e || "audio" === e ? "video/mp2t" : void 0, type: e, id: RemuxerTrackIdConfig[e], pid: -1, inputTimeScale: 9e4, sequenceNumber: 0, samples: [], dropped: "video" === e ? 0 : void 0, isAAC: "audio" === e || void 0, duration: "audio" === e ? t : void 0, isHEVC: 0 } }, e._syncOffset = function(e) { for (var t = Math.min(1e3, e.length - 564), i = 0; i < t;) { if (71 === e[i] && 71 === e[i + 188] && 71 === e[i + 376]) return i; i++ } return -1 }, r.destroy = function() { this._initPTS = this._initDTS = void 0, this._duration = 0, this._onReceiveH265MediaHLSFrame = null }, r.parsePAT = function(e, t) { return (31 & e[t + 10]) << 8 | e[t + 11] }, r.parsePMT = function(e, t, i, r) { var n, a, s = { audio: -1, avc: -1, hevc: -1, id3: -1, isAAC: !0 }; for (n = t + 3 + ((15 & e[t + 1]) << 8 | e[t + 2]) - 4, t += 12 + ((15 & e[t + 10]) << 8 | e[t + 11]); t < n;) { switch (a = (31 & e[t + 1]) << 8 | e[t + 2], e[t]) { case 207: if (!r) break; case 15: -1 === s.audio && (s.audio = a); break; case 21: -1 === s.id3 && (s.id3 = a); break; case 219: if (!r) { logger.log("unknown stream type:" + e[t]); break } case 27: -1 === s.avc && (s.avc = a), g.h("H264"); break; case 36: -1 === s.avc && (s.avc = a, s.hevc = a), g.h("H265"); break; case 3: case 4: i ? -1 === s.audio && (s.audio = a, s.isAAC = !1) : logger.log( "MPEG audio found, not supported in this browser for now"); break; case 36: console.warn("HEVC stream type found, not supported for now") } t += 5 + ((15 & e[t + 3]) << 8 | e[t + 4]) } return s }, r.parsePES = function(e) { if (1 !== this.reset) { var t, i, r, n, a, s, o, u, l = 0, d = e.data; if (!e || 0 === e.size) return null; for (; d[0].length < 19 && d.length > 1;) { var c = new Uint8Array(d[0].length + d[1].length); c.set(d[0]), c.set(d[1], d[0].length), d[0] = c, d.splice(1, 1) } if (1 === ((t = d[0])[0] << 16) + (t[1] << 8) + t[2]) { if ((r = (t[4] << 8) + t[5]) && r > e.size - 6) return null; if (192 & (i = t[7]) && ((s = 536870912 * (14 & t[9]) + 4194304 * (255 & t[10]) + 16384 * (254 & t[11]) + 128 * (255 & t[12]) + (254 & t[13]) / 2) > 4294967295 && (s -= 4294967295), 64 & i ? ((o = 536870912 * (14 & t[14]) + 4194304 * (255 & t[15]) + 16384 * (254 & t[16]) + 128 * (255 & t[17]) + (254 & t[18]) / 2) > 4294967295 && (o -= 4294967295), s - o > 54e5 && ( console.warn(Math.round((s - o) / 9e4) + "s delta between PTS and DTS, align them"), s = o)) : o = s), u = (n = t[8]) + 9, e.size <= u) return null; e.size -= u, a = new Uint8Array(e.size); for (var h = 0, f = d.length; h < f; h++) { var p = (t = d[h]).byteLength; if (u) { if (u > p) { u -= p; continue } t = t.subarray(u), p -= u, u = 0 } a.set(t, l), l += p } return r && (r -= n + 3), { data: a, pts: s, dts: o, len: r } } return null } }, r.pushAccesUnit = function(e, t) { if (e.units.length && e.frame) { var i = t.samples, r = i.length; if (isNaN(e.pts)) { if (!r) return void t.dropped++; var n = i[r - 1]; e.pts = n.pts, e.dts = n.dts }!this.config.forceKeyFrameOnDiscontinuity || !0 === e.key || t.sps && (r || this.contiguous) ? (e .id = r, i.push(e)) : t.dropped++ } e.debug.length && logger.log(e.pts + "/" + e.dts + ":" + e.debug) }, r.parseAVCPES = function(e, t, i) { var r = this, n = 0; (0 === this.startVideoPts || e.pts < this.startVideoPts) && (this.startVideoPts = e.pts, n = 1), this.audioFrameNum = 0; var s = this._parseAVCNALu(e.data), o = [], u = 0; e.data = null; var l = !1; s.forEach(function(t) { var i = t.data.length, n = new Uint8Array(4 + i); n[0] = i >> 24 & 255, n[1] = i >> 16 & 255, n[2] = i >> 8 & 255, n[3] = 255 & i, n.set(t.data, 4); var s = { type: t.type, data: n }; switch (u += n.length, o.push(s), t.type) { case 1: break; case 5: r.findKeyframe = !1, l = !0; break; case 6: var d = new S(r.discardEPB(t.data)); d.readUByte(); for (var c = 0, h = 0, f = !1, p = 0; !f && d.bytesAvailable > 1;) { c = 0; do { c += p = d.readUByte() } while (255 === p); h = 0; do { h += p = d.readUByte() } while (255 === p); if (4 === c && 0 !== d.bytesAvailable) { if (f = !0, 181 === d.readUByte() && 49 === d.readUShort() && 1195456820 === d .readUInt() && 3 === d.readUByte()) { for (var g = d.readUByte(), v = 31 & g, y = [g, d.readUByte()], _ = 0; _ < v; _++) y .push(d.readUByte()), y.push(d.readUByte()), y.push(d.readUByte()); r._insertSampleInOrder(r._txtTrack.samples, { type: 3, pts: e.pts, bytes: y }) } } else if (5 === c && 0 !== d.bytesAvailable) { if (f = !0, h > 16) { for (var b = [], w = 0; w < 16; w++) b.push(d.readUByte().toString(16)), 3 !== w && 5 !== w && 7 !== w && 9 !== w || b.push("-"); for (var E = h - 16, T = new Uint8Array(E), A = 0; A < E; A++) T[A] = d.readUByte() } } else if (h < d.bytesAvailable) for (var k = 0; k < h; k++) d.readUByte() } break; case 7: r.findKeyframe = !1, r.tagPosition = r.filePosition, r._AVC_Config = m.parseSPS(t.data); var R = r._AVC_Config, M = "avc1."; if (R) for (var O = t.data.subarray(1, 4), C = 0; C < 3; C++) { var D = O[C].toString(16); D.length < 2 && (D = "0" + D), M += D } if (!r._initVideoMetadata) { null == r._AVC_SPS && (r._AVC_SPS = new Uint8Array(t.data.length + 4), r._AVC_SPS.set(r ._StartCode, 0), r._AVC_SPS.set(t.data, 4)); var I = r._videoMetadata, L = r._videoTrack; if (I ? void 0 !== I.avcc && a.a.w(r.TAG, "Found another AVCDecoderConfigurationRecord!") : (!1 === r._hasVideo && !1 === r ._hasVideoFlagOverrided && (r._hasVideo = !0, r._mediaInfo.hasVideo = !0), (I = r ._videoMetadata = {}).type = "video", I.id = L.id, I.timescale = r._timescale, I .duration = r._duration), I.codecWidth = R.codec_size.width, I.codecHeight = R .codec_size.height, I.presentWidth = R.present_size.width, I.presentHeight = R .present_size.height, I.profile = R.profile_string, I.level = R.level_string, I .bitDepth = R.bit_depth, I.chromaFormat = R.chroma_format, I.sarRatio = R.sar_ratio, I .frameRate = R.frame_rate, !1 !== R.frame_rate.fixed && 0 !== R.frame_rate.fps_num && 0 !== R.frame_rate.fps_den || (I.frameRate = r._referenceFrameRate), void 0 !== I .frameRate) { var x = I.frameRate.fps_den, P = I.frameRate.fps_num; I.refSampleDuration = I.timescale * (x / P) } I.codec = M; var U = r._mediaInfo; U.width = I.codecWidth, U.height = I.codecHeight, void 0 !== I.frameRate && (U.fps = I .frameRate.fps), U.profile = I.profile, U.level = I.level, U.refFrames = R .ref_frames, U.chromaFormat = R.chroma_format_string, U.sarNum = I.sarRatio.width, U .sarDen = I.sarRatio.height, U.videoCodec = M, U.hasAudio ? null != U.audioCodec && (U .mimeType = 'video/x-flv; codecs="' + U.videoCodec + "," + U.audioCodec + '"') : U .mimeType = 'video/x-flv; codecs="' + U.videoCodec + '"', U.isComplete() && r ._onMediaInfo(U) } break; case 8: if (r.findKeyframe = !1, null == r._AVC_PPS && (r._AVC_PPS = new Uint8Array(t.data .length + 4), r._AVC_PPS.set(r._StartCode, 0), r._AVC_PPS.set(t.data, 4)), !r ._initVideoMetadata) { r._initVideoMetadata = !0; var N = r._videoMetadata; if (null == N.avcc) { var B = 0, F = r._AVC_SPS.length - 4 + 8 + 1 + 2 + (r._AVC_PPS.length - 4); N.avcc = new Uint8Array(F + 1), N.avcc[0] = 1, N.avcc[1] = r._AVC_SPS[5], N.avcc[2] = r._AVC_SPS[6], N.avcc[3] = r._AVC_SPS[7], N.avcc[4] = 255, N.avcc[5] = 225, B = 6, new Uint8Array, N.avcc[B++] = r._AVC_SPS.length - 4 >> 8, N.avcc[B++] = r._AVC_SPS .length - 4 & 255; var j = r._AVC_SPS.subarray(4, r._AVC_SPS.length); N.avcc.set(j, B), B += j.length, N.avcc[B++] = 1, N.avcc[B++] = r._AVC_PPS.length - 4 >> 8, N.avcc[B++] = r._AVC_PPS.length - 4 & 255; var H = r._AVC_PPS.subarray(4, r._AVC_PPS.length); N.avcc.set(H, B), B += H.length, N.avcc[F] = 1 } r._onTrackMetadata("video", N) } } }); var d = (e.pts - this.startVideoPts) / 90; l && this.syncVideoPts < 1 && (this.syncVideoPts = this.startVideoPts); var c = this._videoTrack, h = { units: o, length: u, isKeyframe: l, dts: d, cts: 0, pts: d }; l && (h.fileposition = this.tagPosition), 0 !== this.reset || this.findKeyframe || (c.samples.push( h), c.length += u), this.filePosition += u, this.accurateTimeOffset = h.pts, this.lastVideoPts = e.pts, 1 === n && (this.seekVideoHistoryPts = d), t && 0 === this.reset && (console.log( "this._config", this._config, this._config.decodeType), "auto" === this._config.decodeType || "hard" === this._config.decodeType ? (this._onDataAvailable(this._audioTrack, this._videoTrack), console.log("_onDataAvailable", this._audioTrack, this._videoTrack)) : (this._videoTrack .samples.length > 0 && this._onDataAvailableToSoftwareDecodeVideo(27, this._videoTrack), this ._audioTrack.samples.length > 0 && this._onDataAvailableToSoftwareDecodeAudio(86018, this ._audioTrack))) }, r.parseHEVCPES = function(e, t, i) { (0 === this.startVideoPts || e.pts < this.startVideoPts) && (this.startVideoPts = e.pts); var r = [], n = 0, a = { type: 1, data: e.data }, s = 0; if ((n += e.data.length) > 32) for (var o = 0; o < 256 && o < e.data.length; o++) if (0 === e.data[o] && 0 === e.data[o + 1] && 0 === e.data[o + 2] && 1 === e.data[o + 3] && 64 === e.data[o + 4]) { s = 1, this.findKeyframe = !1; break } r.push(a); var u = (e.pts - this.startVideoPts) / 90; s && this.syncVideoPts < 1 && (this.syncVideoPts = this.startVideoPts); var l = this._videoTrack, d = { units: r, length: n, isKeyframe: s, dts: u, cts: 0, pts: u }; s && (d.fileposition = this.tagPosition), l.samples.push(d), l.length += n, this._videoTrack.samples .length > 0 && this._onDataAvailableToSoftwareDecodeVideo(173, this._videoTrack), this._audioTrack .samples.length > 0 && this._onDataAvailableToSoftwareDecodeAudio(86018, this._audioTrack) }, r._insertSampleInOrder = function(e, t) { var i = e.length; if (i > 0) { if (t.pts >= e[i - 1].pts) e.push(t); else for (var r = i - 1; r >= 0; r--) if (t.pts < e[r].pts) { e.splice(r, 0, t); break } } else e.push(t) }, r._getLastNalUnit = function() { var e, t = this.avcSample; if (!t || 0 === t.units.length) { var i = this._avcTrack.samples; t = i[i.length - 1] } if (t) { var r = t.units; e = r[r.length - 1] } return e }, r._parseAVCNALu = function(e) { var t, i, r, n = 0, a = e.byteLength, s = 0, o = [], u = -1; for (-1 === s && (u = 0, r = 31 & e[0], s = 0, n = 1); n < a;) t = e[n++], s ? 1 !== s ? t ? 1 === t ? (u >= 0 && 9 != (i = { data: e.subarray(u, n - s - 1), type: r }).type && o.push(i), n < a ? (u = n, r = 31 & e[n], s = 0) : s = -1) : s = 0 : s = 3 : s = t ? 0 : 2 : s = t ? 0 : 1; if (u >= 0 && s >= 0 && (i = { data: e.subarray(u, a), type: r, state: s }, o.push(i)), 0 === o.length) { var l = this._getLastNalUnit(); if (l) { var d = new Uint8Array(l.data.byteLength + e.byteLength); d.set(l.data, 0), d.set(e, l.data.byteLength), l.data = d } } return o }, r.discardEPB = function(e) { for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[ a + 2] ? (n.push(a + 2), a += 2) : a++; if (0 === n.length) return e; t = r - n.length, i = new Uint8Array(t); var s = 0; for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s]; return i }, r.parseAACPES = function(e, t) { 0 === this.startAudioPts && (this.startAudioPts = e.pts); var i, r, n, s, o, u, l, d = this._audioTrack, c = e.data, h = e.pts, f = this.aacOverFlow, p = this.aacLastPTS; if (f) { var m = new Uint8Array(f.byteLength + c.byteLength); m.set(f, 0), m.set(c, f.byteLength), c = m } for (n = 0, o = c.length; n < o - 1 && !b(c, n); n++); if (!n || (n < o - 1 ? (u = "AAC PES did not start with ADTS header,offset:" + n, l = !1) : (u = "no ADTS header found in AAC PES", l = !0), logger.warn("parsing error:" + u), this.observer .trigger(Event.ERROR, { type: ErrorTypes.MEDIA_ERROR, details: ErrorDetails.FRAG_PARSING_ERROR, fatal: l, reason: u }), !l)) { if (this.audioSampleRate < 1) { var g = w(c, n, this.audioCodec); if (g && (this.audioSampleRate = g.samplerate, this.audioChannel = g.channelCount, this .audioBitPerSample = 16, !this._initAudioMetadata)) { this._initAudioMetadata = !0; var v = this._audioMetadata, y = this._audioTrack; v || ((v = this._audioMetadata = {}).type = "audio", v.id = y.id, v.timescale = 1e3, v .duration = 0, v.audioSampleRate = this.audioSampleRate, v.channelCount = this .audioChannel), v.config && a.a.w(this.TAG, "Found another AudioSpecificConfig!"), g .config, v.audioSampleRate = g.samplerate, v.channelCount = g.channelCount, v.codec = g .codec, v.originalCodec = g.originalCodec, v.config = g.config, v.refSampleDuration = 1024 / v.audioSampleRate * v.timescale, this._SampleRate = g.samplerate, this._ChannelNum = g .channelCount, this._onDataAvailable(this._audioTrack, this._videoTrack), this ._onTrackMetadata("audio", v); var _ = this._mediaInfo; _.audioCodec = v.originalCodec, _.audioSampleRate = v.audioSampleRate, _.audioChannelCount = v .channelCount, _.hasVideo ? null != _.videoCodec && (_.mimeType = 'video/x-flv; codecs="' + _.videoCodec + "," + _.audioCodec + '"') : _.mimeType = 'video/x-flv; codecs="' + _ .audioCodec + '"', _.isComplete() && this._onMediaInfo(_) } } if (r = 0, i = E(this.audioSampleRate), f && p) { var S = p + i; Math.abs(S - h) > 1 && (console.log("AAC: align PTS for overlapping frames by " + Math.round(( S - h) / 90)), h = S) } for (; n < o;) if (b(c, n) && n + 5 < o) { var A = T(this.audioSampleRate, c, n, h, r); if (!A) break; var k = Math.round((A.sample.pts - this.startAudioPts) / 90), R = { unit: A.sample.unit, length: A.length, dts: k, pts: k }; 0 !== this.reset || this.findKeyframe || (this.syncAudioPts < 1 && this.syncVideoPts > 0 && ( this.syncAudioPts = this.syncVideoPts), this.syncAudioPts > 0 && (d.samples.push(R), d .length += A.length)), n += A.length, s = A.sample.pts, r++ } else n++; f = n < o ? c.subarray(n, o) : null, this.aacOverFlow = f, this.aacLastPTS = s } }, r.parseMPEGPES = function(e) { for (var t = e.data, i = t.length, r = 0, n = 0, a = e.pts; n < i;) if (MpegAudio.isHeader(t, n)) { var s = MpegAudio.appendFrame(this._audioTrack, t, n, a, r); if (!s) break; n += s.length, r++ } else n++ }, r.append = function(t, i, r) { if (null != t && 1 !== this.reset) { var n, a, s, o, u, l, d = t.length, c = !1, h = -1, f = -1, p = -1, m = this.avcTrackPesData, g = this.audioTrackPesData, v = this.id3TrackPesData, y = !1, _ = e._syncOffset(t); for (d -= (d + _) % 188, n = _; n < d; n += 188) if (71 === t[n]) { if (a = !!(64 & t[n + 1]), s = ((31 & t[n + 1]) << 8) + t[n + 2], (48 & t[n + 3]) >> 4 > 1) { if ((o = n + 5 + t[n + 4]) === n + 188) continue } else o = n + 4; switch (s) { case h: a && (m && (u = this.parsePES(m)) && (1 === this.isHEVC ? this.parseHEVCPES(u, !1, r) : this.parseAVCPES(u, !1, r)), m = { data: [], size: 0 }), m && (m.data.push(t.subarray(o, n + 188)), m.size += n + 188 - o); break; case f: a && (g && (u = this.parsePES(g)) && (this.isAAC ? this.parseAACPES(u, !1) : this .parseMPEGPES(u)), g = { data: [], size: 0 }), g && (g.data.push(t.subarray(o, n + 188)), g.size += n + 188 - o); break; case p: a && (v && (u = this.parsePES(v)) && parseID3PES(u), v = { data: [], size: 0 }), v && (v.data.push(t.subarray(o, n + 188)), v.size += n + 188 - o); break; case 0: a && (o += t[o] + 1), l = this.parsePAT(t, o); break; case l: a && (o += t[o] + 1); var b = this.parsePMT(t, o, !1, !1); h = b.avc, b.hevc > 0 && (h = b.hevc, this.isHEVC = 1), h > 0 && (this.avcTrackPid = h), ! this._callbackInitFlag && this._callbackMediaDataFunc && (this._callbackInitFlag = !0, 1 === this.isHEVC || "auto" !== this._config.decodeType && "hard" !== this._config .decodeType || this._callbackMediaDataFunc(this._callbackMediaDataUserPtr, !1, 1, 0, 0, null, 0, 0, 0, 0)), (f = b.audio) > 0 && (this.audioTrackPid = f, this.isAAC = b .isAAC), (p = b.id3) > 0 && (this.id3TrackPid = p), c && !y && (console.log( "reparse from beginning"), c = !1, n = _ - 188), y = !0; break; case 17: case 8191: break; default: c = !0 } } else console.log("parse error... reason: 'TS packet did not start with 0x47'"); m && (u = this.parsePES(m)) ? (1 == this.isHEVC ? this.parseHEVCPES(u, !0, r) : this.parseAVCPES( u, !0, r), this.avcTrackPesData = null) : this.avcTrackPesData = m, g && (u = this.parsePES( g)) ? (this.isAAC ? this.parseAACPES(u, !0) : this.parseMPEGPES(u), this.audioTrackPesData = null) : (g && g.size && logger.log( "last AAC PES packet truncated,might overlap between fragments"), this.audioTrackPesData = g), v && (u = this.parsePES(v)) ? (parseID3PES(u), this.id3TrackPesData = null) : this .id3TrackPesData = v } }, t = e, (i = [{ key: "onReceiveH265MediaHLSFrame", get: function() { return this._onReceiveH265MediaHLSFrame }, set: function(e) { this._onReceiveH265MediaHLSFrame = e } }, { key: "onTrackMetadata", get: function() { return this._onTrackMetadata }, set: function(e) { this._onTrackMetadata = e } }, { key: "onMediaInfo", get: function() { return this._onMediaInfo }, set: function(e) { this._onMediaInfo = e } }, { key: "onMetaDataArrived", get: function() { return this._onMetaDataArrived }, set: function(e) { this._onMetaDataArrived = e } }, { key: "onScriptDataArrived", get: function() { return this._onScriptDataArrived }, set: function(e) { this._onScriptDataArrived = e } }, { key: "onError", get: function() { return this._onError }, set: function(e) { this._onError = e } }, { key: "onDataAvailable", get: function() { return this._onDataAvailable }, set: function(e) { this._onDataAvailable = e } }, { key: "timestampBase", get: function() { return this._timestampBase }, set: function(e) { this._timestampBase = e } }, { key: "overridedDuration", get: function() { return this._duration }, set: function(e) { this._durationOverrided = !0, this._duration = e, this._mediaInfo.duration = e } }, { key: "overridedHasAudio", set: function(e) { this._hasAudioFlagOverrided = !0, this._hasAudio = e, this._mediaInfo.hasAudio = e } }, { key: "overridedHasVideo", set: function(e) { this._hasVideoFlagOverrided = !0, this._hasVideo = e, this._mediaInfo.hasVideo = e } }]) && A(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }(), R = function() { function e() {} return e.init = function() { for (var t in e.types = { avc1: [], avcC: [], btrt: [], dinf: [], dref: [], esds: [], ftyp: [], hdlr: [], mdat: [], mdhd: [], mdia: [], mfhd: [], minf: [], moof: [], moov: [], mp4a: [], mvex: [], mvhd: [], sdtp: [], stbl: [], stco: [], stsc: [], stsd: [], stsz: [], stts: [], tfdt: [], tfhd: [], traf: [], trak: [], trun: [], trex: [], tkhd: [], vmhd: [], smhd: [], ".mp3": [] }, e.types) e.types.hasOwnProperty(t) && (e.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t .charCodeAt(2), t.charCodeAt(3) ]); var i = e.constants = {}; i.FTYP = new Uint8Array([105, 115, 111, 109, 0, 0, 0, 1, 105, 115, 111, 109, 97, 118, 99, 49]), i .STSD_PREFIX = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), i.STTS = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0 ]), i.STSC = i.STCO = i.STTS, i.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), i .HDLR_VIDEO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0 ]), i.HDLR_AUDIO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0 ]), i.DREF = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), i.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), i.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]) }, e.box = function(e) { for (var t = 8, i = null, r = Array.prototype.slice.call(arguments, 1), n = r.length, a = 0; a < n; a++) t += r[a].byteLength; (i = new Uint8Array(t))[0] = t >>> 24 & 255, i[1] = t >>> 16 & 255, i[2] = t >>> 8 & 255, i[3] = 255 & t, i.set(e, 4); for (var s = 8, o = 0; o < n; o++) i.set(r[o], s), s += r[o].byteLength; return i }, e.generateInitSegment = function(t) { var i = e.box(e.types.ftyp, e.constants.FTYP), r = e.moov(t), n = new Uint8Array(i.byteLength + r.byteLength); return n.set(i, 0), n.set(r, i.byteLength), n }, e.moov = function(t) { var i = e.mvhd(t.timescale, t.duration), r = e.trak(t), n = e.mvex(t); return e.box(e.types.moov, i, r, n) }, e.mvhd = function(t, i) { return e.box(e.types.mvhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 ])) }, e.trak = function(t) { return e.box(e.types.trak, e.tkhd(t), e.mdia(t)) }, e.tkhd = function(t) { var i = t.id, r = t.duration, n = t.presentWidth, a = t.presentHeight; return e.box(e.types.tkhd, new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0, 0, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, n >>> 8 & 255, 255 & n, 0, 0, a >>> 8 & 255, 255 & a, 0, 0 ])) }, e.mdia = function(t) { return e.box(e.types.mdia, e.mdhd(t), e.hdlr(t), e.minf(t)) }, e.mdhd = function(t) { var i = t.timescale, r = t.duration; return e.box(e.types.mdhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r, 85, 196, 0, 0 ])) }, e.hdlr = function(t) { var i; return i = "audio" === t.type ? e.constants.HDLR_AUDIO : e.constants.HDLR_VIDEO, e.box(e.types.hdlr, i) }, e.minf = function(t) { var i; return i = "audio" === t.type ? e.box(e.types.smhd, e.constants.SMHD) : e.box(e.types.vmhd, e .constants.VMHD), e.box(e.types.minf, i, e.dinf(), e.stbl(t)) }, e.dinf = function() { return e.box(e.types.dinf, e.box(e.types.dref, e.constants.DREF)) }, e.stbl = function(t) { return e.box(e.types.stbl, e.stsd(t), e.box(e.types.stts, e.constants.STTS), e.box(e.types.stsc, e .constants.STSC), e.box(e.types.stsz, e.constants.STSZ), e.box(e.types.stco, e.constants .STCO)) }, e.stsd = function(t) { return "audio" === t.type ? "mp3" === t.codec ? e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp3( t)) : e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp4a(t)) : e.box(e.types.stsd, e.constants .STSD_PREFIX, e.avc1(t)) }, e.mp3 = function(t) { var i = t.channelCount, r = t.audioSampleRate, n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, r >>> 8 & 255, 255 & r, 0, 0 ]); return e.box(e.types[".mp3"], n) }, e.mp4a = function(t) { var i = t.channelCount, r = t.audioSampleRate, n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, r >>> 8 & 255, 255 & r, 0, 0 ]); return e.box(e.types.mp4a, n, e.esds(t)) }, e.esds = function(t) { var i = t.config || [], r = i.length, n = new Uint8Array([0, 0, 0, 0, 3, 23 + r, 0, 1, 0, 4, 15 + r, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5 ].concat([r]).concat(i).concat([6, 1, 2])); return e.box(e.types.esds, n) }, e.avc1 = function(t) { var i = t.avcc, r = t.codecWidth, n = t.codecHeight, a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, r >>> 8 & 255, 255 & r, n >>> 8 & 255, 255 & n, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 10, 120, 113, 113, 47, 102, 108, 118, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 255, 255 ]); return e.box(e.types.avc1, a, e.box(e.types.avcC, i)) }, e.mvex = function(t) { return e.box(e.types.mvex, e.trex(t)) }, e.trex = function(t) { var i = t.id, r = new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 ]); return e.box(e.types.trex, r) }, e.moof = function(t, i) { return e.box(e.types.moof, e.mfhd(t.sequenceNumber), e.traf(t, i)) }, e.mfhd = function(t) { var i = new Uint8Array([0, 0, 0, 0, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t]); return e.box(e.types.mfhd, i) }, e.traf = function(t, i) { var r = t.id, n = e.box(e.types.tfhd, new Uint8Array([0, 0, 0, 0, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r ])), a = e.box(e.types.tfdt, new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i ])), s = e.sdtp(t), o = e.trun(t, s.byteLength + 16 + 16 + 8 + 16 + 8 + 8); return e.box(e.types.traf, n, a, o, s) }, e.sdtp = function(t) { for (var i = t.samples || [], r = i.length, n = new Uint8Array(4 + r), a = 0; a < r; a++) { var s = i[a].flags; n[a + 4] = s.isLeading << 6 | s.dependsOn << 4 | s.isDependedOn << 2 | s.hasRedundancy } return e.box(e.types.sdtp, n) }, e.trun = function(t, i) { var r = t.samples || [], n = r.length, a = 12 + 16 * n, s = new Uint8Array(a); i += 8 + a, s.set([0, 0, 15, 1, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i ], 0); for (var o = 0; o < n; o++) { var u = r[o].duration, l = r[o].size, d = r[o].flags, c = r[o].cts; s.set([u >>> 24 & 255, u >>> 16 & 255, u >>> 8 & 255, 255 & u, l >>> 24 & 255, l >>> 16 & 255, l >>> 8 & 255, 255 & l, d.isLeading << 2 | d.dependsOn, d.isDependedOn << 6 | d .hasRedundancy << 4 | d.isNonSync, 0, 0, c >>> 24 & 255, c >>> 16 & 255, c >>> 8 & 255, 255 & c ], 12 + 16 * o) } return e.box(e.types.trun, s) }, e.mdat = function(t) { return e.box(e.types.mdat, t) }, e }(); R.init(); var M = R, O = function() { function e() {} return e.getSilentFrame = function(e, t) { if ("mp4a.40.2" === e) { if (1 === t) return new Uint8Array([0, 200, 0, 128, 35, 128]); if (2 === t) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]); if (3 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]); if (4 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56 ]); if (5 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56 ]); if (6 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224 ]) } else { if (1 === t) return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]); if (2 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]); if (3 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]) } return null }, e }(), C = i(21), D = i(16); function I(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var L = function() { function e(e) { this.TAG = "MP4Remuxer", this._config = e, this._isLive = !0 === e.isLive, this._dtsBase = -1, this ._dtsBaseInited = !1, this._audioDtsBase = 1 / 0, this._videoDtsBase = 1 / 0, this._audioNextDts = void 0, this._videoNextDts = void 0, this._audioStashedLastSample = null, this ._videoStashedLastSample = null, this._audioMeta = null, this._videoMeta = null, this ._audioSegmentInfoList = new D.c("audio"), this._videoSegmentInfoList = new D.c("video"), this ._onInitSegment = null, this._onMediaSegment = null, this._forceFirstIDR = !(!s.a.chrome || !(s.a .version.major < 50 || 50 === s.a.version.major && s.a.version.build < 2661)), this ._fillSilentAfterSeek = s.a.msedge || s.a.msie, this._mp3UseMpegAudio = !s.a.firefox, this ._fillAudioTimestampGap = this._config.fixAudioTimestampGap, this._recordWorker = null, this ._findKeyframe = !0, this._initRecordFlag = !1, this._recordFileName = "record.mp4" } var t, i, r = e.prototype; return r.destroy = function() { this._dtsBase = -1, this._dtsBaseInited = !1, this._audioMeta = null, this._videoMeta = null, this ._audioSegmentInfoList.clear(), this._audioSegmentInfoList = null, this._videoSegmentInfoList .clear(), this._videoSegmentInfoList = null, this._onInitSegment = null, this._onMediaSegment = null, this._recordWorker && (this._recordWorker.terminate(), this._recordWorker = null) }, r.bindDataSource = function(e) { return e.onDataAvailable = this.remux.bind(this), e.onTrackMetadata = this._onTrackMetadataReceived .bind(this), this }, r.insertDiscontinuity = function() { this._audioNextDts = this._videoNextDts = void 0 }, r.seek = function(e) { this._audioStashedLastSample = null, this._videoStashedLastSample = null, this._videoSegmentInfoList .clear(), this._audioSegmentInfoList.clear() }, r.remux = function(e, t) { if (!this._onMediaSegment) throw new c.a("MP4Remuxer: onMediaSegment callback must be specificed!"); this._dtsBaseInited || this._calculateDtsBase(e, t), this._remuxVideo(t), this._remuxAudio(e) }, r._onTrackMetadataReceived = function(e, t) { var i = null, r = "mp4", n = t.codec; if ("audio" === e) this._audioMeta = t, "mp3" === t.codec && this._mp3UseMpegAudio ? (r = "mpeg", n = "", i = new Uint8Array) : i = M.generateInitSegment(t); else { if ("video" !== e) return; this._videoMeta = t, i = M.generateInitSegment(t) } if (!this._onInitSegment) throw new c.a("MP4Remuxer: onInitSegment callback must be specified!"); this._onInitSegment(e, { type: e, data: i.buffer, codec: n, container: e + "/" + r, mediaDuration: t.duration }) }, r._calculateDtsBase = function(e, t) { this._dtsBaseInited || (e.samples && e.samples.length && (this._audioDtsBase = e.samples[0].dts), t .samples && t.samples.length && (this._videoDtsBase = t.samples[0].dts), this._dtsBase = Math .min(this._audioDtsBase, this._videoDtsBase), this._dtsBaseInited = !0) }, r.flushStashedSamples = function() { var e = this._videoStashedLastSample, t = this._audioStashedLastSample, i = { type: "video", id: 1, sequenceNumber: 0, samples: [], length: 0 }; null != e && (i.samples.push(e), i.length = e.length); var r = { type: "audio", id: 2, sequenceNumber: 0, samples: [], length: 0 }; null != t && (r.samples.push(t), r.length = t.length), this._videoStashedLastSample = null, this ._audioStashedLastSample = null, this._remuxVideo(i, !0), this._remuxAudio(r, !0) }, r._remuxAudio = function(e, t) { if (null != this._audioMeta) { var i, r = e, n = r.samples, o = void 0, u = -1, l = this._audioMeta.refSampleDuration, d = "mp3" === this._audioMeta.codec && this._mp3UseMpegAudio, c = this._dtsBaseInited && void 0 === this._audioNextDts, h = !1; if (n && 0 !== n.length && (1 !== n.length || t)) { if (!g.c()) for (var f = 0; f < n.length; f++) n.shift(); var p = 0, m = null, v = 0; d ? (p = 0, v = r.length) : (p = 8, v = 8 + r.length); var y = null; if (n.length > 1 && (v -= (y = n.pop()).length), null != this._audioStashedLastSample) { var _ = this._audioStashedLastSample; this._audioStashedLastSample = null, n.unshift(_), v += _.length } null != y && (this._audioStashedLastSample = y); var b = n[0].dts - this._dtsBase; if (this._audioNextDts) o = b - this._audioNextDts; else if (this._audioSegmentInfoList.isEmpty()) o = 0, this._fillSilentAfterSeek && !this ._videoSegmentInfoList.isEmpty() && "mp3" !== this._audioMeta.originalCodec && (h = !0); else { var w = this._audioSegmentInfoList.getLastSampleBefore(b); if (null != w) { var E = b - (w.originalDts + w.duration); E <= 3 && (E = 0), o = b - (w.dts + w.duration + E) } else o = 0 } if (h) { var T = b - o, S = this._videoSegmentInfoList.getLastSegmentBefore(b); if (null != S && S.beginDts < T) { var A = O.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount); if (A) { var k = S.beginDts, R = T - S.beginDts; a.a.v(this.TAG, "InsertPrefixSilentAudio: dts: " + k + ", duration: " + R), n.unshift({ unit: A, dts: k, pts: k }), v += A.byteLength } } else h = !1 } for (var C = [], I = 0; I < n.length; I++) { var L = n[I], x = L.unit, P = L.dts - this._dtsBase, U = P, N = !1, B = null, F = 0; if (!(P < -.001)) { if ("mp3" !== this._audioMeta.codec) { var j = P; if (this._audioNextDts && (j = this._audioNextDts), (o = P - j) <= -3 * l) { a.a.w(this.TAG, "Dropping 1 audio frame (originalDts: " + P + " ms ,curRefDts: " + j + " ms) due to dtsCorrection: " + o + " ms overlap."); continue } if (o >= 3 * l && this._fillAudioTimestampGap && !s.a.safari) { N = !0; var H = Math.floor(o / l); a.a.w(this.TAG, "Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: " + P + " ms, curRefDts: " + j + " ms, dtsCorrection: " + Math.round(o) + " ms, generate: " + H + " frames"), U = Math.floor(j), F = Math.floor(j + l) - U; var G = O.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount); null == G && (a.a.w(this.TAG, "Unable to generate silent frame for " + this._audioMeta .originalCodec + " with " + this._audioMeta.channelCount + " channels, repeat last frame"), G = x), B = []; for (var V = 0; V < H; V++) { j += l; var W = Math.floor(j), q = Math.floor(j + l) - W, X = { dts: W, pts: W, cts: 0, unit: G, size: G.byteLength, duration: q, originalDts: P, flags: { isLeading: 0, dependsOn: 1, isDependedOn: 0, hasRedundancy: 0 } }; B.push(X), v += X.size } this._audioNextDts = j + l } else U = Math.floor(j), F = Math.floor(j + l) - U, this._audioNextDts = j + l } else U = P - o, F = I !== n.length - 1 ? n[I + 1].dts - this._dtsBase - o - U : null != y ? y.dts - this._dtsBase - o - U : C.length >= 1 ? C[C.length - 1].duration : Math.floor( l), this._audioNextDts = U + F; if (-1 === u && (u = U), this._initRecordFlag && this._recordWorker && !this ._findKeyframe) { var z = new Uint8Array(L.unit), K = { cmd: g.q, mediaType: "audio", dat: z, pts: U }; this._recordWorker.postMessage(K, [K.dat.buffer]) } C.push({ dts: U, pts: U, cts: 0, unit: L.unit, size: L.unit.byteLength, duration: F, originalDts: P, flags: { isLeading: 0, dependsOn: 1, isDependedOn: 0, hasRedundancy: 0 } }), N && C.push.apply(C, B) } } if (0 === C.length) return r.samples = [], void(r.length = 0); d ? m = new Uint8Array(v) : ((m = new Uint8Array(v))[0] = v >>> 24 & 255, m[1] = v >>> 16 & 255, m[2] = v >>> 8 & 255, m[3] = 255 & v, m.set(M.types.mdat, 4)); for (var Y = 0; Y < C.length; Y++) { var Q = C[Y].unit; m.set(Q, p), p += Q.byteLength } var J = C[C.length - 1]; i = J.dts + J.duration; var Z = new D.b; Z.beginDts = u, Z.endDts = i, Z.beginPts = u, Z.endPts = i, Z.originalBeginDts = C[0] .originalDts, Z.originalEndDts = J.originalDts + J.duration, Z.firstSample = new D.d(C[0].dts, C[0].pts, C[0].duration, C[0].originalDts, !1), Z.lastSample = new D.d(J.dts, J.pts, J .duration, J.originalDts, !1), this._isLive || this._audioSegmentInfoList.append(Z), r .samples = C, r.sequenceNumber++; var $; $ = d ? new Uint8Array : M.moof(r, u), r.samples = [], r.length = 0; var ee = { type: "audio", data: this._mergeBoxes($, m).buffer, sampleCount: C.length, info: Z }; d && c && (ee.timestampOffset = u), this._onMediaSegment("audio", ee) } } }, r._remuxVideo = function(e, t) { if (null != this._videoMeta) { var i, r, n = e, a = n.samples, s = void 0, o = -1, u = -1; if (a && 0 !== a.length && (1 !== a.length || t)) { var l = 8, d = null, c = 8 + e.length, h = null; if (a.length > 1 && (c -= (h = a.pop()).length), null != this._videoStashedLastSample) { var f = this._videoStashedLastSample; this._videoStashedLastSample = null, a.unshift(f), c += f.length } null != h && (this._videoStashedLastSample = h); var p = a[0].dts - this._dtsBase; if (this._videoNextDts) s = p - this._videoNextDts; else if (this._videoSegmentInfoList.isEmpty()) s = 0; else { var m = this._videoSegmentInfoList.getLastSampleBefore(p); if (null != m) { var v = p - (m.originalDts + m.duration); v <= 3 && (v = 0), s = p - (m.dts + m.duration + v) } else s = 0 } for (var y = new D.b, _ = [], b = 0; b < a.length; b++) { var w = a[b], E = w.dts - this._dtsBase, T = w.isKeyframe, S = E - s, A = w.cts, k = S + A; - 1 === o && (o = S, u = k); var R = 0; if (R = b !== a.length - 1 ? a[b + 1].dts - this._dtsBase - s - S : null != h ? h.dts - this ._dtsBase - s - S : _.length >= 1 ? _[_.length - 1].duration : Math.floor(this._videoMeta .refSampleDuration), T) { var O = new D.d(S, k, R, w.dts, !0); O.fileposition = w.fileposition, y.appendSyncPoint(O), this._findKeyframe = !1 } _.push({ dts: S, pts: k, cts: A, units: w.units, size: w.length, isKeyframe: T, duration: R, originalDts: E, flags: { isLeading: 0, dependsOn: T ? 2 : 1, isDependedOn: T ? 1 : 0, hasRedundancy: 0, isNonSync: T ? 0 : 1 } }) } if (this._initRecordFlag && this._recordWorker && !this._findKeyframe) for (var C = !1, I = 0; I < a.length; I++) { var L = a[I], x = L.units[0].data.length; if (L.units.length >= 3) for (var P = 1; P < L.units.length; P++) { if (6 === L.units.length) { if (P < 4) continue; if (5 === L.units.length && P < 3) continue } x += L.units[P].data.length } C = L.isKeyframe; var U = new Uint8Array(L.units[0].data), N = 0, B = new Uint8Array(x); if (B.set(U, 0), B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, N += U.length, L.units.length >= 3) for (var F = 1; F < L.units.length; F++) if (!(6 === L.units.length && F < 4 || 5 === L.units.length && F < 3)) { var j = new Uint8Array(L.units[F].data); B.set(j, N), B[N + 0] = 0, B[N + 1] = 0, B[N + 2] = 0, B[N + 3] = 1, N += j.length } var H = { cmd: g.q, mediaType: "video", codecId: 28, type: C, dat: B, pts: L.dts }; this._recordWorker.postMessage(H, [H.dat.buffer]) }(d = new Uint8Array(c))[0] = c >>> 24 & 255, d[1] = c >>> 16 & 255, d[2] = c >>> 8 & 255, d[ 3] = 255 & c, d.set(M.types.mdat, 4); for (var G = 0; G < _.length; G++) for (var V = _[G].units; V.length;) { var W = V.shift().data; d.set(W, l), l += W.byteLength } var q = _[_.length - 1]; if (i = q.dts + q.duration, r = q.pts + q.duration, this._videoNextDts = i, y.beginDts = o, y .endDts = i, y.beginPts = u, y.endPts = r, y.originalBeginDts = _[0].originalDts, y .originalEndDts = q.originalDts + q.duration, y.firstSample = new D.d(_[0].dts, _[0].pts, _[0] .duration, _[0].originalDts, _[0].isKeyframe), y.lastSample = new D.d(q.dts, q.pts, q .duration, q.originalDts, q.isKeyframe), this._isLive || this._videoSegmentInfoList.append( y), n.samples = _, n.sequenceNumber++, this._forceFirstIDR) { var X = _[0].flags; X.dependsOn = 2, X.isNonSync = 0 } var z = M.moof(n, o); n.samples = [], n.length = 0, this._onMediaSegment("video", { type: "video", data: this._mergeBoxes(z, d).buffer, sampleCount: _.length, info: y }) } } }, r._mergeBoxes = function(e, t) { var i = new Uint8Array(e.byteLength + t.byteLength); return i.set(e, 0), i.set(t, e.byteLength), i }, r.videoRecording = function(e, t, i, r, stop) { r && (this._wasmRecordingCb = r); this.stopRecoeding = stop; if (1 === i) { this._recordFileName = e; this._recordWorker = null; if (this._recordFileName = e, null != this._recordWorker) return -1e3; this._findKeyframe = !0; try { this._recordWorker = C(67), this.onwmsg = this._onRecordingWorkerMessage.bind(this); var n = { cmd: g.w, url: g.g(), filesize: t, audioSamplerate: this._audioMeta ? this._audioMeta.audioSampleRate : 0, channelCount: this._audioMeta ? this._audioMeta.channelCount : 1 }; this._recordWorker.postMessage(n), this._recordWorker.addEventListener("message", this.onwmsg) } catch (e) { this.recordWorker = null } } else this._initRecordFlag = !1, this._recordWorker && (this._recordWorker.postMessage({ cmd: g.C }), this._findKeyframe = !0) }, r._onRecordingWorkerMessage = function(e) { var t = e.data; switch (t.cmd) { case g.w: this._findKeyframe = !0, this._initRecordFlag = !0, this._wasmRecordingCb(1); break; case g.p: this._initRecordFlag = !1; if(this.stopRecoeding) { this._findKeyframe = !1, this._recordWorker.terminate(), this._recordWorker = null, this._wasmRecordingCb = null return false; } if(!window.isVideoWatermark) { var i = document.createElement("a"); i.style.display = "none", i.href = t.dat, i.download = this._recordFileName, document.body .appendChild(i), i.click(), window.URL.revokeObjectURL(i.href), document.body.removeChild(i), this._findKeyframe = !1, this._recordWorker.terminate(), this._recordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null return false; } fetch(t.dat).then(response => response.blob()).then(blob => { const file = new File([blob], this._recordFileName, { type: blob.type }) console.log('=============视频加水印============1==', file) this._findKeyframe = !1, this._recordWorker.terminate(), this._recordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null const formData = new FormData() formData.append('file', file) fetch('/apiserver/export/alarm/order/downloadVideoByFlush', { method: 'POST', headers: { 'Authorization': 'Bearer ' + (window.$videoStoreData?.userInfo?.token || sessionStorage.getItem('Admin-Token')), 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || '' }, body: formData }).then(response =>response.blob()).then(blob => { console.log('=============视频加水印============1=返回=', blob) var i = document.createElement("a"); i.style.display = "none", i.href = window.URL.createObjectURL(new Blob([blob], { type: 'video/mp4' })), i.download = this._recordFileName, document.body .appendChild(i), i.click(), window.URL.revokeObjectURL(i.href), document.body.removeChild(i) }) }) } }, t = e, (i = [{ key: "onInitSegment", get: function() { return this._onInitSegment }, set: function(e) { this._onInitSegment = e } }, { key: "onMediaSegment", get: function() { return this._onMediaSegment }, set: function(e) { this._onMediaSegment = e } }]) && I(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }(), x = i(37), P = i(2), U = (i(3), function() { function e(e, t) { this.TAG = "TransmuxingController", this._emitter = new n.a, this._config = t, e.segments || (e .segments = [{ duration: e.duration, filesize: e.filesize, url: e.url }]), "boolean" != typeof e.cors && (e.cors = !0), "boolean" != typeof e.withCredentials && (e .withCredentials = !1), this._mediaDataSource = e, this._currentSegmentIndex = 0; var i = 0; this._mediaDataSource.segments.forEach(function(r) { r.timestampBase = i, i += r.duration, r.cors = e.cors, r.withCredentials = e.withCredentials, t.referrerPolicy && (r.referrerPolicy = t.referrerPolicy) }), isNaN(i) || this._mediaDataSource.duration === i || (this._mediaDataSource.duration = i), this ._mediaInfo = null, this._demuxer = null, this._remuxer = null, this._ioctl = null, this ._pendingSeekTime = null, this._pendingResolveSeekPoint = null, this._statisticsReporter = null, this._onReceiveH265MediaFrameFuc = null, this._mediaTypeIsHLS = e.url.includes(".m3u8") } var t = e.prototype; return t.destroy = function() { this._mediaInfo = null, this._mediaDataSource = null, this._statisticsReporter && this ._disableStatisticsReporter(), this._ioctl && (this._ioctl.destroy(), this._ioctl = null), this ._demuxer && (this._demuxer.destroy(), this._demuxer = null), this._remuxer && (this._remuxer .destroy(), this._remuxer = null), this._emitter.removeAllListeners(), this._emitter = null }, t.on = function(e, t) { this._emitter.addListener(e, t) }, t.off = function(e, t) { this._emitter.removeListener(e, t) }, t.start = function() { this._loadSegment(0), this._enableStatisticsReporter() }, t._loadSegment = function(e, t) { this._currentSegmentIndex = e; var i = this._mediaDataSource.segments[e], r = this._ioctl = new x.a(i, this._config, e); r.onError = this._onIOException.bind(this), r.onSeeked = this._onIOSeeked.bind(this), r .onComplete = this._onIOComplete.bind(this), r.onRedirect = this._onIORedirect.bind(this), r .onRecoveredEarlyEof = this._onIORecoveredEarlyEof.bind(this), t ? this._demuxer.bindDataSource( this._ioctl) : r.onDataArrival = this._onInitChunkArrival.bind(this), r.open(t), r .loaderChunkArrival = this._loaderChunkArrival.bind(this), r.loaderHLSError = this ._loaderHLSError.bind(this) }, t._loaderChunkArrival = function(e) { this._emitter.emit("loaderChunkArrival", e) }, t._loaderHLSError = function() { this._emitter.emit("hls_error") }, t.stop = function() { this._internalAbort(), this._disableStatisticsReporter() }, t._internalAbort = function() { this._ioctl && (this._ioctl.destroy(), this._ioctl = null) }, t.pause = function() { this._ioctl && this._ioctl.isWorking() && (this._ioctl.pause(), this._disableStatisticsReporter()) }, t.resume = function() { this._ioctl && this._ioctl.isPaused() && (this._ioctl.resume(), this._enableStatisticsReporter()) }, t.seek = function(e) { if (null != this._mediaInfo && this._mediaInfo.isSeekable()) { var t = this._searchSegmentIndexContains(e); if (t === this._currentSegmentIndex) { var i = this._mediaInfo.segments[t]; if (null == i) this._pendingSeekTime = e; else { var r = i.getNearestKeyframe(e); this._remuxer.seek(r.milliseconds), this._ioctl.seek(r.fileposition), this ._pendingResolveSeekPoint = r.milliseconds } } else { var n = this._mediaInfo.segments[t]; if (null == n) this._pendingSeekTime = e, this._internalAbort(), this._remuxer.seek(), this ._remuxer.insertDiscontinuity(), this._loadSegment(t); else { var a = n.getNearestKeyframe(e); this._internalAbort(), this._remuxer.seek(e), this._remuxer.insertDiscontinuity(), this ._demuxer.resetMediaInfo(), this._demuxer.timestampBase = this._mediaDataSource.segments[ t].timestampBase, this._loadSegment(t, a.fileposition), this._pendingResolveSeekPoint = a.milliseconds, this._reportSegmentMediaInfo(t) } } this._enableStatisticsReporter() } }, t._searchSegmentIndexContains = function(e) { for (var t = this._mediaDataSource.segments, i = t.length - 1, r = 0; r < t.length; r++) if (e < t[r].timestampBase) { i = r - 1; break } return i }, t._onInitChunkArrival = function(e, t) { var i = this; this._emitter.emit(P.a.RECORDING, e); var r = null, n = 0; if (this._mediaTypeIsHLS) { if (null == e && t < 0) return void this._emitter.emit(P.a.RECONNECT_ING, t); if (null == e && t > 0) return; if (t > 0) this._demuxer.bindDataSource(this._ioctl), this._demuxer.timestampBase = this ._mediaDataSource.segments[this._currentSegmentIndex].timestampBase, this._demuxer.append(e, t, 0), n = e.length; else { this._demuxer = new k(this._config), this._remuxer || (this._remuxer = new L(this._config)); var s = this._mediaDataSource; null == s.duration || isNaN(s.duration) || (this._demuxer.overridedDuration = s.duration), "boolean" == typeof s.hasAudio && (this._demuxer.overridedHasAudio = s.hasAudio), "boolean" == typeof s.hasVideo && (this._demuxer.overridedHasVideo = s.hasVideo), this ._demuxer.timestampBase = s.segments[this._currentSegmentIndex].timestampBase, this._demuxer .onError = this._onDemuxException.bind(this), this._demuxer.onMediaInfo = this._onMediaInfo .bind(this), this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this), this ._demuxer.onReceiveH265MediaHLSFrame = this._onReceiveH265MediaFrameFuc, this._demuxer .onScriptDataArrived = this._onScriptDataArrived.bind(this), this._remuxer.bindDataSource( this._demuxer.bindDataSource(this._ioctl)), this._remuxer.onInitSegment = this ._onRemuxerInitSegmentArrival.bind(this), this._remuxer.onMediaSegment = this ._onRemuxerMediaSegmentArrival.bind(this), this._demuxer.append(e, t, 0), n = e.length } } else if (t > 0) this._demuxer.bindDataSource(this._ioctl), this._demuxer.timestampBase = this ._mediaDataSource.segments[this._currentSegmentIndex].timestampBase, n = this._demuxer .parseChunks(e, t); else if ((r = _.probe(e)).match) { this._demuxer = new _(r, this._config), this._remuxer || (this._remuxer = new L(this._config)); var o = this._mediaDataSource; null == o.duration || isNaN(o.duration) || (this._demuxer.overridedDuration = o.duration), "boolean" == typeof o.hasAudio && (this._demuxer.overridedHasAudio = o.hasAudio), "boolean" == typeof o.hasVideo && (this._demuxer.overridedHasVideo = o.hasVideo), this._mediaDataSource .hasAudio = !1, this._demuxer.timestampBase = o.segments[this._currentSegmentIndex] .timestampBase, this._demuxer.onError = this._onDemuxException.bind(this), this._demuxer .onMediaInfo = this._onMediaInfo.bind(this), this._demuxer.onMetaDataArrived = this ._onMetaDataArrived.bind(this), this._demuxer.onReceiveSEIData = this._onReceiveSEIData.bind( this), this._demuxer.onAudioError = this._onAudioError.bind(this), this._demuxer .onReceiveH265MediaFLVFrame = this._onReceiveH265MediaFrameFuc, this._demuxer .onScriptDataArrived = this._onScriptDataArrived.bind(this), this._remuxer.bindDataSource(this ._demuxer.bindDataSource(this._ioctl)), this._remuxer.onInitSegment = this ._onRemuxerInitSegmentArrival.bind(this), this._remuxer.onMediaSegment = this ._onRemuxerMediaSegmentArrival.bind(this), n = this._demuxer.parseChunks(e, t) } else r = null, a.a.e(this.TAG, "Non-FLV, Unsupported media type!"), Promise.resolve().then( function() { i._internalAbort() }), this._emitter.emit(P.a.DEMUX_ERROR, v.a.FORMAT_UNSUPPORTED, "Non-FLV, Unsupported media type"), n = 0; return n }, t._onMediaInfo = function(e) { var t = this; null == this._mediaInfo && (this._mediaInfo = Object.assign({}, e), this._mediaInfo .keyframesIndex = null, this._mediaInfo.segments = [], this._mediaInfo.segmentCount = this ._mediaDataSource.segments.length, Object.setPrototypeOf(this._mediaInfo, o.a.prototype)); var i = Object.assign({}, e); Object.setPrototypeOf(i, o.a.prototype), this._mediaInfo.segments[this._currentSegmentIndex] = i, this._reportSegmentMediaInfo(this._currentSegmentIndex), null != this._pendingSeekTime && Promise.resolve().then(function() { var e = t._pendingSeekTime; t._pendingSeekTime = null, t.seek(e) }) }, t._onMetaDataArrived = function(e) { this._emitter.emit(P.a.METADATA_ARRIVED, e) }, t._onAudioError = function() { this._emitter.emit(P.a.AUDIO_ERROR) }, t._onReceiveSEIData = function(e) { this._emitter.emit(P.a.SEI_DATA, e) }, t._onScriptDataArrived = function(e) { this._emitter.emit(P.a.SCRIPTDATA_ARRIVED, e) }, t._onIOSeeked = function() { this._remuxer.insertDiscontinuity() }, t._onIOComplete = function(e, t) { var i = e + 1; i < this._mediaDataSource.segments.length ? (this._internalAbort(), this._remuxer .flushStashedSamples(), this._loadSegment(i)) : (t && "socket-close" === t && this._emitter .emit(P.a.SOCKET_CLOSE), this._remuxer.flushStashedSamples(), this._emitter.emit(P.a .LOADING_COMPLETE), this._disableStatisticsReporter()) }, t._onIORedirect = function(e) { var t = this._ioctl.extraData; this._mediaDataSource.segments[t].redirectedURL = e }, t._onIORecoveredEarlyEof = function() { this._emitter.emit(P.a.RECOVERED_EARLY_EOF) }, t._onIOException = function(e, t) { a.a.e(this.TAG, "IOException: type = " + e + ", code = " + t.code + ", msg = " + t.msg), this ._emitter.emit(P.a.IO_ERROR, e, t), this._disableStatisticsReporter() }, t._onDemuxException = function(e, t) { a.a.e(this.TAG, "DemuxException: type = " + e + ", info = " + t), this._emitter.emit(P.a .DEMUX_ERROR, e, t) }, t._onRemuxerInitSegmentArrival = function(e, t) { this._emitter.emit(P.a.INIT_SEGMENT, e, t) }, t._onRemuxerMediaSegmentArrival = function(e, t) { if (null == this._pendingSeekTime && (this._emitter.emit(P.a.MEDIA_SEGMENT, e, t), null != this ._pendingResolveSeekPoint && "video" === e)) { var i = t.info.syncPoints, r = this._pendingResolveSeekPoint; this._pendingResolveSeekPoint = null, s.a.safari && i.length > 0 && i[0].originalDts === r && ( r = i[0].pts), this._emitter.emit(P.a.RECOMMEND_SEEKPOINT, r) } }, t._enableStatisticsReporter = function() { null == this._statisticsReporter && (this._statisticsReporter = self.setInterval(this ._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval)) }, t._disableStatisticsReporter = function() { this._statisticsReporter && (self.clearInterval(this._statisticsReporter), this ._statisticsReporter = null) }, t._reportSegmentMediaInfo = function(e) { var t = this._mediaInfo.segments[e], i = Object.assign({}, t); i.duration = this._mediaInfo.duration, i.segmentCount = this._mediaInfo.segmentCount, delete i .segments, delete i.keyframesIndex, this._emitter.emit(P.a.MEDIA_INFO, i) }, t._reportStatisticsInfo = function() { var e = {}; e.url = this._ioctl.currentURL, e.hasRedirect = this._ioctl.hasRedirect, e.hasRedirect && (e .redirectedURL = this._ioctl.currentRedirectedURL), e.speed = this._ioctl.currentSpeed, e .loaderType = this._ioctl.loaderType, e.currentSegmentIndex = this._currentSegmentIndex, e .totalSegmentCount = this._mediaDataSource.segments.length, this._emitter.emit(P.a .STATISTICS_INFO, e) }, t.setReceiveH265MediaFrame = function(e) { this._onReceiveH265MediaFrameFuc = e }, t._getHLSTotalDuration = function() { if (null == this._ioctl) return 0; var e = this._ioctl._getM3u8Loader(); return e ? e._getM3u8TotalDuration() : 0 }, t._seekToSecs = function(e, t) { var i = this._ioctl._getM3u8Loader(); i && (i.seek(e, t), this._demuxer && this._demuxer.resetMediaPts(1)), this._remuxer && this ._remuxer.seek(0), i && this._demuxer && this._demuxer.resetMediaPts(0) }, t.videoRecording = function(e, t, i, r, stop) { if(this._remuxer) { this._remuxer.videoRecording(e, t, i, r, stop) } }, e }()); t.a = U }, function(e, t, i) { "use strict"; var r = i(0); function n(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var a = function() { function e() { this._firstCheckpoint = 0, this._lastCheckpoint = 0, this._intervalBytes = 0, this._totalBytes = 0, this._lastSecondBytes = 0, self.performance && self.performance.now ? this._now = self.performance .now.bind(self.performance) : this._now = Date.now } var t, i, r = e.prototype; return r.reset = function() { this._firstCheckpoint = this._lastCheckpoint = 0, this._totalBytes = this._intervalBytes = 0, this ._lastSecondBytes = 0 }, r.addBytes = function(e) { 0 === this._firstCheckpoint ? (this._firstCheckpoint = this._now(), this._lastCheckpoint = this ._firstCheckpoint, this._intervalBytes += e, this._totalBytes += e) : this._now() - this ._lastCheckpoint < 1e3 ? (this._intervalBytes += e, this._totalBytes += e) : (this ._lastSecondBytes = this._intervalBytes, this._intervalBytes = e, this._totalBytes += e, this ._lastCheckpoint = this._now()) }, t = e, (i = [{ key: "currentKBps", get: function() { this.addBytes(0); var e = (this._now() - this._lastCheckpoint) / 1e3; return 0 == e && (e = 1), this._intervalBytes / e / 1024 } }, { key: "lastSecondKBps", get: function() { return this.addBytes(0), 0 !== this._lastSecondBytes ? this._lastSecondBytes / 1024 : this ._now() - this._lastCheckpoint >= 500 ? this.currentKBps : 0 } }, { key: "averageKBps", get: function() { var e = (this._now() - this._firstCheckpoint) / 1e3; return this._totalBytes / e / 1024 } }]) && n(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }(), s = i(3), o = i(7), u = i(4); function l(e, t) { return (l = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } var d = function(e) { var t, i; function r(t, i) { var r; return (r = e.call(this, "fetch-stream-loader") || this).TAG = "FetchStreamLoader", r._seekHandler = t, r._config = i, r._needStash = !0, r._requestAbort = !1, r._contentLength = null, r ._receivedLength = 0, r } i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, l(t, i), r .isSupported = function() { try { var e = o.a.msedge && o.a.version.minor >= 15048, t = !o.a.msedge || e; return self.fetch && self.ReadableStream && t } catch (e) { return !1 } }; var n = r.prototype; return n.destroy = function() { this.isWorking() && this.abort(), e.prototype.destroy.call(this) }, n.open = function(e, t) { var i = this; this._dataSource = e, this._range = t; var r = e.url; this._config.reuseRedirectedURL && null != e.redirectedURL && (r = e.redirectedURL); var n = this._seekHandler.getConfig(r, t), a = new self.Headers; if ("object" == typeof n.headers) { var o = n.headers; for (var l in o) o.hasOwnProperty(l) && a.append(l, o[l]) } var d = { method: "GET", headers: a, mode: "cors", cache: "default", referrerPolicy: "no-referrer-when-downgrade" }; if ("object" == typeof this._config.headers) for (var c in this._config.headers) a.append(c, this._config.headers[c]); !1 === e.cors && (d.mode = "same-origin"), e.withCredentials && (d.credentials = "include"), e .referrerPolicy && (d.referrerPolicy = e.referrerPolicy), self.AbortController && (this ._abortController = new self.AbortController, d.signal = this._abortController.signal), this ._status = s.c.kConnecting, self.fetch(n.url, d).then(function(e) { if (i._requestAbort) return i._status = s.c.kIdle, void e.body.cancel(); if (e.ok && e.status >= 200 && e.status <= 299) { if (e.url !== n.url && i._onURLRedirect) { var t = i._seekHandler.removeURLParameters(e.url); i._onURLRedirect(t) } var r = e.headers.get("Content-Length"); return null != r && (i._contentLength = parseInt(r), 0 !== i._contentLength && i ._onContentLengthKnown && i._onContentLengthKnown(i._contentLength)), i._pump.call(i, e .body.getReader()) } if (i._status = s.c.kError, !i._onError) throw new u.d( "FetchStreamLoader: Http code invalid, " + e.status + " " + e.statusText); i._onError(s.b.HTTP_STATUS_CODE_INVALID, { code: e.status, msg: e.statusText }) }).catch(function(e) { if (!i._abortController || !i._abortController.signal.aborted) { if (i._status = s.c.kError, !i._onError) throw e; i._onError(s.b.EXCEPTION, { code: -1, msg: e.message }) } }) }, n.abort = function() { if (this._requestAbort = !0, (this._status !== s.c.kBuffering || !o.a.chrome) && this ._abortController) try { this._abortController.abort() } catch (e) {} }, n._pump = function(e) { var t = this; return e.read().then(function(i) { if (i.done) if (null !== t._contentLength && t._receivedLength < t._contentLength) { t._status = s.c.kError; var r = s.b.EARLY_EOF, n = { code: -1, msg: "Fetch stream meet Early-EOF" }; if (!t._onError) throw new u.d(n.msg); t._onError(r, n) } else t._status = s.c.kComplete, t._onComplete && t._onComplete(t._range.from, t._range .from + t._receivedLength - 1); else { if (t._abortController && t._abortController.signal.aborted) return void(t._status = s.c .kComplete); if (!0 === t._requestAbort) return t._status = s.c.kComplete, e.cancel(); t._status = s.c.kBuffering; var a = i.value.buffer, o = t._range.from + t._receivedLength; t._receivedLength += a.byteLength, t._onDataArrival && t._onDataArrival(a, o, t ._receivedLength), t._pump(e) } }).catch(function(e) { if (t._abortController && t._abortController.signal.aborted) t._status = s.c.kComplete; else if (11 !== e.code || !o.a.msedge) { t._status = s.c.kError; var i = 0, r = null; if (19 !== e.code && "network error" !== e.message || !(null === t._contentLength || null !== t._contentLength && t._receivedLength < t._contentLength) ? (i = s.b.EXCEPTION, r = { code: e.code, msg: e.message }) : (i = s.b.EARLY_EOF, r = { code: e.code, msg: "Fetch stream meet Early-EOF" }), !t._onError) throw new u.d(r.msg); t._onError(i, r) } }) }, r }(s.a), c = i(21), h = i(1); function f(e, t) { return (f = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } var p = function(e) { var t, i; function r() { var t; return (t = e.call(this, "m3u8-loader") || this).TAG = "M3U8Loader", t._needStash = !0, t.url = "", t .startPlayTime = 0, t._requestAbort = !1, t._receivedLength = 0, t.getNextFileFlag = !0, t .pauseDisplay = !1, t.totalDuration = 0, t.seeking = !1, t.downloadWorker = null, t } i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, f(t, i), r .isSupported = function() { return !0 }; var n = r.prototype; return n.destroy = function() { this.abort(), e.prototype.destroy.call(this), this.downloadWorker && this.downloadWorker .terminate(), this.downloadWorker = null }, n.createDownloadWorker = function() { if (!this.downloadWorker) if ("undefined" != typeof Worker) try { this.downloadWorker = c(231), this.onwmsg = this.onWorkerMessage.bind(this); var e = { cmd: h.w, url: this.url, time: this.startPlayTime }; this.downloadWorker.postMessage(e), this.downloadWorker.addEventListener("message", this .onwmsg), this.downloadWorker.onerror = function(e) {} } catch (e) { this.downloadWorker && this.downloadWorker.terminate(), this.downloadWorker = null } else console.log("Unsupport worker...") }, n.setStartPlaySecs = function(e) { this.startPlayTime = e }, n.open = function(e) { try { this.url = e.url, this.createDownloadWorker(), this._status = s.c.kConnecting } catch (e) { this._status = s.c.kError; var t = { code: e.code, msg: e.message }; if (!this._onError) throw new u.d(t.msg); this._onError(s.b.EXCEPTION, t) } }, n.abort = function() { var e = { cmd: h.l }; this.downloadWorker && void 0 !== this.downloadWorker && this.downloadWorker.postMessage(e), this ._status = s.c.kComplete }, n._onWebSocketOpen = function(e) { this._status = s.c.kBuffering }, n._onWebSocketClose = function(e) { !0 !== this._requestAbort ? (this._status = s.c.kComplete, this._onComplete && this._onComplete(0, this._receivedLength - 1)) : this._requestAbort = !1 }, n.seek = function(e, t) { this.pauseDisplay = !1; var i = { cmd: h.B, type: t, time: e }; this.downloadWorker && void 0 !== this.downloadWorker && (this.downloadWorker.postMessage(i), this .seeking = !0) }, n.pause = function() { this.pauseDisplay = !0; var e = { cmd: h.x }; this.downloadWorker && void 0 !== this.downloadWorker && this.downloadWorker.postMessage(e) }, n.resume = function() { this.pauseDisplay = !1; var e = { cmd: h.A }; this.downloadWorker && void 0 !== this.downloadWorker && this.downloadWorker.postMessage(e) }, n.onWorkerMessage = function(e) { var t = e.data; switch (t.cmd) { case h.w: var i = { cmd: h.s, t: 0 }; this.downloadWorker.postMessage(i); break; case h.t: this.getNextFileFlag = !0; break; case h.r: this.playComplete = !0; break; case h.o: i = { cmd: h.y }, this.downloadWorker.postMessage(i); break; case h.l: t.workerId == h.b ? (this.downloadWorker && this.downloadWorker.terminate(), this .downloadWorker = null) : t.workerId == h.a ? (this.decodeWorker && this.decodeWorker .terminate(), this.decodeWorker = null, this.soundPlayer && (this.soundPlayer.destroy(), delete this.soundPlayer, this.soundPlayer = null), this.webGLPlayer && this.webGLPlayer .renderVideoFrame(null, 0, 0)) : t.workerId == h.f && (this.renderWorker.terminate(), this .renderWorker = null); break; case h.q: if (t.workerId == h.b) { var r = t.dat, n = this._receivedLength; this._receivedLength += r.byteLength, this._onDataArrival && this._onDataArrival(r, n, this ._receivedLength); break } if (t.workerId == h.a) { if (this.pauseDisplay) break; 1 == t.mediaType ? (this.canvas.width = t.width, this.canvas.height = t.height, this .webGLPlayer.renderVideoFrame(t.dat, t.width, t.height), this.OnUpdatePlayInfo(t .playTimeSec, t.frameNum)) : 2 == t.mediaType && (null == this.soundPlayer && this .OpenAudioPlayer(t.fmt, t.ch, t.samplerate), null != this.soundPlayer && this.soundPlayer .play(t.dat)) } break; case h.u: this.totalDuration = t.duration, h.i(t.live); break; case h.s: this.pauseDisplay || this.getNextFileFlag && (this.downloadWorker.postMessage(t), this .getNextFileFlag = !1); break; case h.B: this.seeking = !1; break; case h.z: this._onDataArrival && (this._receivedLength = 0, this._onDataArrival(null, t.fileSequence, 0)); break; case 404: this._onHLSError() } }, n._dispatchArrayBuffer = function(e) { var t = e, i = this._receivedLength; this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this ._receivedLength) }, n._onWebSocketError = function(e) { this._status = s.c.kError; var t = { code: e.code, msg: e.message }; if (!this._onError) throw new u.d(t.msg); this._onError(s.b.EXCEPTION, t) }, n._getM3u8TotalDuration = function() { return this.totalDuration }, r }(s.a); function m(e, t) { return (m = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } var g = function(e) { var t, i; function n(t, i) { var r; return (r = e.call(this, "xhr-moz-chunked-loader") || this).TAG = "MozChunkedLoader", r._seekHandler = t, r._config = i, r._needStash = !0, r._xhr = null, r._requestAbort = !1, r._contentLength = null, r ._receivedLength = 0, r } i = e, (t = n).prototype = Object.create(i.prototype), t.prototype.constructor = t, m(t, i), n .isSupported = function() { try { var e = new XMLHttpRequest; return e.open("GET", "https://example.com", !0), e.responseType = "moz-chunked-arraybuffer", "moz-chunked-arraybuffer" === e.responseType } catch (e) { return r.a.w("MozChunkedLoader", e.message), !1 } }; var a = n.prototype; return a.destroy = function() { this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr .onprogress = null, this._xhr.onloadend = null, this._xhr.onerror = null, this._xhr = null), e .prototype.destroy.call(this) }, a.open = function(e, t) { this._dataSource = e, this._range = t; var i = e.url; this._config.reuseRedirectedURL && null != e.redirectedURL && (i = e.redirectedURL); var r = this._seekHandler.getConfig(i, t); this._requestURL = r.url; var n = this._xhr = new XMLHttpRequest; if (n.open("GET", r.url, !0), n.responseType = "moz-chunked-arraybuffer", n.onreadystatechange = this._onReadyStateChange.bind(this), n.onprogress = this._onProgress.bind(this), n.onloadend = this._onLoadEnd.bind(this), n.onerror = this._onXhrError.bind(this), e.withCredentials && (n .withCredentials = !0), "object" == typeof r.headers) { var a = r.headers; for (var o in a) a.hasOwnProperty(o) && n.setRequestHeader(o, a[o]) } if ("object" == typeof this._config.headers) { var u = this._config.headers; for (var l in u) u.hasOwnProperty(l) && n.setRequestHeader(l, u[l]) } this._status = s.c.kConnecting, n.send() }, a.abort = function() { this._requestAbort = !0, this._xhr && this._xhr.abort(), this._status = s.c.kComplete }, a._onReadyStateChange = function(e) { var t = e.target; if (2 === t.readyState) { if (null != t.responseURL && t.responseURL !== this._requestURL && this._onURLRedirect) { var i = this._seekHandler.removeURLParameters(t.responseURL); this._onURLRedirect(i) } if (0 !== t.status && (t.status < 200 || t.status > 299)) { if (this._status = s.c.kError, !this._onError) throw new u.d( "MozChunkedLoader: Http code invalid, " + t.status + " " + t.statusText); this._onError(s.b.HTTP_STATUS_CODE_INVALID, { code: t.status, msg: t.statusText }) } else this._status = s.c.kBuffering } }, a._onProgress = function(e) { if (this._status !== s.c.kError) { null === this._contentLength && null !== e.total && 0 !== e.total && (this._contentLength = e .total, this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength)); var t = e.target.response, i = this._range.from + this._receivedLength; this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this ._receivedLength) } }, a._onLoadEnd = function(e) { !0 !== this._requestAbort ? this._status !== s.c.kError && (this._status = s.c.kComplete, this ._onComplete && this._onComplete(this._range.from, this._range.from + this._receivedLength - 1) ) : this._requestAbort = !1 }, a._onXhrError = function(e) { this._status = s.c.kError; var t = 0, i = null; if (this._contentLength && e.loaded < this._contentLength ? (t = s.b.EARLY_EOF, i = { code: -1, msg: "Moz-Chunked stream meet Early-Eof" }) : (t = s.b.EXCEPTION, i = { code: -1, msg: e.constructor.name + " " + e.type }), !this._onError) throw new u.d(i.msg); this._onError(t, i) }, n }(s.a); function v(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function y(e, t) { return (y = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } s.a; var _ = function(e) { var t, i; function n(t, i) { var r; return (r = e.call(this, "xhr-range-loader") || this).TAG = "RangeLoader", r._seekHandler = t, r ._config = i, r._needStash = !1, r._chunkSizeKBList = [128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 5120, 6144, 7168, 8192 ], r._currentChunkSizeKB = 384, r._currentSpeedNormalized = 0, r._zeroSpeedChunkCount = 0, r._xhr = null, r._speedSampler = new a, r._requestAbort = !1, r._waitForTotalLength = !1, r ._totalLengthReceived = !1, r._currentRequestURL = null, r._currentRedirectedURL = null, r ._currentRequestRange = null, r._totalLength = null, r._contentLength = null, r._receivedLength = 0, r._lastTimeLoaded = 0, r } i = e, (t = n).prototype = Object.create(i.prototype), t.prototype.constructor = t, y(t, i), n .isSupported = function() { try { var e = new XMLHttpRequest; return e.open("GET", "https://example.com", !0), e.responseType = "arraybuffer", "arraybuffer" === e.responseType } catch (e) { return r.a.w("RangeLoader", e.message), !1 } }; var o, l, d = n.prototype; return d.destroy = function() { this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr .onprogress = null, this._xhr.onload = null, this._xhr.onerror = null, this._xhr = null), e .prototype.destroy.call(this) }, d.open = function(e, t) { this._dataSource = e, this._range = t, this._status = s.c.kConnecting; var i = !1; null != this._dataSource.filesize && 0 !== this._dataSource.filesize && (i = !0, this._totalLength = this._dataSource.filesize), this._totalLengthReceived || i ? this._openSubRange() : (this ._waitForTotalLength = !0, this._internalOpen(this._dataSource, { from: 0, to: -1 })) }, d._openSubRange = function() { var e = 1024 * this._currentChunkSizeKB, t = this._range.from + this._receivedLength, i = t + e; null != this._contentLength && i - this._range.from >= this._contentLength && (i = this._range .from + this._contentLength - 1), this._currentRequestRange = { from: t, to: i }, this._internalOpen(this._dataSource, this._currentRequestRange) }, d._internalOpen = function(e, t) { this._lastTimeLoaded = 0; var i = e.url; this._config.reuseRedirectedURL && (null != this._currentRedirectedURL ? i = this ._currentRedirectedURL : null != e.redirectedURL && (i = e.redirectedURL)); var r = this._seekHandler.getConfig(i, t); this._currentRequestURL = r.url; var n = this._xhr = new XMLHttpRequest; if (n.open("GET", r.url, !0), n.responseType = "arraybuffer", n.onreadystatechange = this ._onReadyStateChange.bind(this), n.onprogress = this._onProgress.bind(this), n.onload = this ._onLoad.bind(this), n.onerror = this._onXhrError.bind(this), e.withCredentials && (n .withCredentials = !0), "object" == typeof r.headers) { var a = r.headers; for (var s in a) a.hasOwnProperty(s) && n.setRequestHeader(s, a[s]) } if ("object" == typeof this._config.headers) { var o = this._config.headers; for (var u in o) o.hasOwnProperty(u) && n.setRequestHeader(u, o[u]) } n.send() }, d.abort = function() { this._requestAbort = !0, this._internalAbort(), this._status = s.c.kComplete }, d._internalAbort = function() { this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onload = null, this._xhr.onerror = null, this._xhr.abort(), this._xhr = null) }, d._onReadyStateChange = function(e) { var t = e.target; if (2 === t.readyState) { if (null != t.responseURL) { var i = this._seekHandler.removeURLParameters(t.responseURL); t.responseURL !== this._currentRequestURL && i !== this._currentRedirectedURL && (this ._currentRedirectedURL = i, this._onURLRedirect && this._onURLRedirect(i)) } if (t.status >= 200 && t.status <= 299) { if (this._waitForTotalLength) return; this._status = s.c.kBuffering } else { if (this._status = s.c.kError, !this._onError) throw new u.d( "RangeLoader: Http code invalid, " + t.status + " " + t.statusText); this._onError(s.b.HTTP_STATUS_CODE_INVALID, { code: t.status, msg: t.statusText }) } } }, d._onProgress = function(e) { if (this._status !== s.c.kError) { if (null === this._contentLength) { var t = !1; if (this._waitForTotalLength) { this._waitForTotalLength = !1, this._totalLengthReceived = !0, t = !0; var i = e.total; this._internalAbort(), null != i & 0 !== i && (this._totalLength = i) } if (-1 === this._range.to ? this._contentLength = this._totalLength - this._range.from : this ._contentLength = this._range.to - this._range.from + 1, t) return void this._openSubRange(); this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength) } var r = e.loaded - this._lastTimeLoaded; this._lastTimeLoaded = e.loaded, this._speedSampler.addBytes(r) } }, d._normalizeSpeed = function(e) { var t = this._chunkSizeKBList, i = t.length - 1, r = 0, n = 0, a = i; if (e < t[0]) return t[0]; for (; n <= a;) { if ((r = n + Math.floor((a - n) / 2)) === i || e >= t[r] && e < t[r + 1]) return t[r]; t[r] < e ? n = r + 1 : a = r - 1 } }, d._onLoad = function(e) { if (this._status !== s.c.kError) if (this._waitForTotalLength) this._waitForTotalLength = !1; else { this._lastTimeLoaded = 0; var t = this._speedSampler.lastSecondKBps; if (0 === t && (this._zeroSpeedChunkCount++, this._zeroSpeedChunkCount >= 3 && (t = this ._speedSampler.currentKBps)), 0 !== t) { var i = this._normalizeSpeed(t); this._currentSpeedNormalized !== i && (this._currentSpeedNormalized = i, this ._currentChunkSizeKB = i) } var r = e.target.response, n = this._range.from + this._receivedLength; this._receivedLength += r.byteLength; var a = !1; null != this._contentLength && this._receivedLength < this._contentLength ? this ._openSubRange() : a = !0, this._onDataArrival && this._onDataArrival(r, n, this ._receivedLength), a && (this._status = s.c.kComplete, this._onComplete && this._onComplete( this._range.from, this._range.from + this._receivedLength - 1)) } }, d._onXhrError = function(e) { this._status = s.c.kError; var t = 0, i = null; if (this._contentLength && this._receivedLength > 0 && this._receivedLength < this._contentLength ? (t = s.b.EARLY_EOF, i = { code: -1, msg: "RangeLoader meet Early-Eof" }) : (t = s.b.EXCEPTION, i = { code: -1, msg: e.constructor.name + " " + e.type }), !this._onError) throw new u.d(i.msg); this._onError(t, i) }, o = n, (l = [{ key: "currentSpeed", get: function() { return this._speedSampler.lastSecondKBps } }]) && v(o.prototype, l), Object.defineProperty(o, "prototype", { writable: !1 }), n }(s.a); function b(e, t) { return (b = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } var w = function(e) { var t, i; function r() { var t; return (t = e.call(this, "websocket-loader") || this).TAG = "WebSocketLoader", t._needStash = !0, t ._ws = null, t._requestAbort = !1, t._receivedLength = 0, t } i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, b(t, i), r .isSupported = function() { try { return void 0 !== self.WebSocket } catch (e) { return !1 } }; var n = r.prototype; return n.destroy = function() { this._ws && this.abort(), e.prototype.destroy.call(this) }, n.open = function(e) { try { var t = this._ws = new self.WebSocket(e.url); t.binaryType = "arraybuffer", t.onopen = this._onWebSocketOpen.bind(this), t.onclose = this ._onWebSocketClose.bind(this), t.onmessage = this._onWebSocketMessage.bind(this), t.onerror = this._onWebSocketError.bind(this), this._status = s.c.kConnecting } catch (e) { this._status = s.c.kError; var i = { code: e.code, msg: e.message }; if (!this._onError) throw new u.d(i.msg); this._onError(s.b.EXCEPTION, i) } }, n.abort = function() { var e = this._ws; !e || 0 !== e.readyState && 1 !== e.readyState || (this._requestAbort = !0, e.close()), this._ws = null, this._status = s.c.kComplete }, n._onWebSocketOpen = function(e) { this._status = s.c.kBuffering }, n._onWebSocketClose = function(e) { !0 !== this._requestAbort ? (this._status = s.c.kComplete, this._onComplete && this._onComplete(0, this._receivedLength - 1, "socket-close")) : this._requestAbort = !1 }, n._onWebSocketMessage = function(e) { var t = this; if (e.data instanceof ArrayBuffer) this._dispatchArrayBuffer(e.data); else if (e.data instanceof Blob) { var i = new FileReader; i.onload = function() { t._dispatchArrayBuffer(i.result) }, i.readAsArrayBuffer(e.data) } else { this._status = s.c.kError; var r = { code: -1, msg: "Unsupported WebSocket message type: " + e.data.constructor.name }; if (!this._onError) throw new u.d(r.msg); this._onError(s.b.EXCEPTION, r) } }, n._dispatchArrayBuffer = function(e) { var t = e, i = this._receivedLength; this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this ._receivedLength) }, n._onWebSocketError = function(e) { this._status = s.c.kError; var t = { code: e.code, msg: e.message }; if (!this._onError) throw new u.d(t.msg); this._onError(s.b.EXCEPTION, t) }, r }(s.a), E = function() { function e(e) { this._zeroStart = e || !1 } var t = e.prototype; return t.getConfig = function(e, t) { var i, r = {}; return 0 !== t.from || -1 !== t.to ? (i = -1 !== t.to ? "bytes=" + t.from.toString() + "-" + t.to .toString() : "bytes=" + t.from.toString() + "-", r.Range = i) : this._zeroStart && (r.Range = "bytes=0-"), { url: e, headers: r } }, t.removeURLParameters = function(e) { return e }, e }(), T = function() { function e(e, t) { this._startName = e, this._endName = t } var t = e.prototype; return t.getConfig = function(e, t) { var i = e; if (0 !== t.from || -1 !== t.to) { var r = !0; - 1 === i.indexOf("?") && (i += "?", r = !1), r && (i += "&"), i += this._startName + "=" + t.from.toString(), -1 !== t.to && (i += "&" + this._endName + "=" + t.to.toString()) } return { url: i, headers: {} } }, t.removeURLParameters = function(e) { var t = e.split("?")[0], i = void 0, r = e.indexOf("?"); - 1 !== r && (i = e.substring(r + 1)); var n = ""; if (null != i && i.length > 0) for (var a = i.split("&"), s = 0; s < a.length; s++) { var o = a[s].split("="), u = s > 0; o[0] !== this._startName && o[0] !== this._endName && (u && (n += "&"), n += a[s]) } return 0 === n.length ? t : t + "?" + n }, e }(), S = i(8), A = i.n(S); function k(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var R = function() { function e(e, t, i) { this.TAG = "IOController", this._emitter = new A.a, this._config = t, this._extraData = i, this ._stashInitialSize = 393216, null != t.stashInitialSize && t.stashInitialSize > 0 && (this ._stashInitialSize = t.stashInitialSize), this._stashUsed = 0, this._stashSize = this ._stashInitialSize, this._bufferSize = 3145728, this._stashBuffer = new ArrayBuffer(this ._bufferSize), this._stashByteStart = 0, this._enableStash = !0, !1 === t.enableStashBuffer && ( this._enableStash = !1), this._loader = null, this._loaderClass = null, this._seekHandler = null, this._dataSource = e, this._isWebSocketURL = /wss?:\/\/(.+?)/.test(e.url), this._isHLSURL = e.url && e.url.includes(".m3u8"), this._refTotalLength = e.filesize ? e.filesize : null, this._totalLength = this._refTotalLength, this._fullRequestFlag = !1, this._currentRange = null, this._redirectedURL = null, this._speedNormalized = 0, this._speedSampler = new a, this._speedNormalizeList = [64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096 ], this._isEarlyEofReconnecting = !1, this._paused = !1, this._resumeFrom = 0, this._onDataArrival = null, this._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null, this._onRecoveredEarlyEof = null, this._loaderChunkArrival = null, this._loaderHLSError = null, this ._selectSeekHandler(), this._selectLoader(), this._createLoader() } var t, i, n = e.prototype; return n.destroy = function() { this._loader.isWorking() && this._loader.abort(), this._loader.destroy(), this._loader = null, this ._loaderClass = null, this._dataSource = null, this._stashBuffer = null, this._stashUsed = this ._stashSize = this._bufferSize = this._stashByteStart = 0, this._currentRange = null, this ._speedSampler = null, this._isEarlyEofReconnecting = !1, this._onDataArrival = null, this ._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null, this ._onRecoveredEarlyEof = null, this._loaderChunkArrival = null, this._loaderHLSError = null, this ._extraData = null }, n.isWorking = function() { return this._loader && this._loader.isWorking() && !this._paused }, n.isPaused = function() { return this._paused }, n._selectSeekHandler = function() { var e = this._config; if ("range" === e.seekType) this._seekHandler = new E(this._config.rangeLoadZeroStart); else if ("param" === e.seekType) { var t = e.seekParamStart || "bstart", i = e.seekParamEnd || "bend"; this._seekHandler = new T(t, i) } else { if ("custom" !== e.seekType) throw new u.b("Invalid seekType in config: " + e.seekType); if ("function" != typeof e.customSeekHandler) throw new u.b( "Custom seekType specified in config but invalid customSeekHandler!"); this._seekHandler = new e.customSeekHandler } }, n._selectLoader = function() { if (null != this._config.customLoader) this._loaderClass = this._config.customLoader; else if (this._isHLSURL) this._loaderClass = p; else if (this._isWebSocketURL) this._loaderClass = w; else if (d.isSupported()) this._loaderClass = d; else if (g.isSupported()) this._loaderClass = g; else { if (!_.isSupported()) throw new u.d( "Your browser doesn't support xhr with arraybuffer responseType!"); this._loaderClass = _ } }, n._createLoader = function() { this._loader = new this._loaderClass(this._seekHandler, this._config), !1 === this._loader .needStashBuffer && (this._enableStash = !1), this._loader.onContentLengthKnown = this ._onContentLengthKnown.bind(this), this._loader.onURLRedirect = this._onURLRedirect.bind(this), this._loader.onDataArrival = this._onLoaderChunkArrival.bind(this), this._loader.onComplete = this ._onLoaderComplete.bind(this), this._loader.onError = this._onLoaderError.bind(this), this._loader .onHLSError = this._onLoaderHLSError.bind(this) }, n.open = function(e) { this._currentRange = { from: 0, to: -1 }, e && (this._currentRange.from = e), this._speedSampler.reset(), e || (this._fullRequestFlag = ! 0), this._loader.open(this._dataSource, Object.assign({}, this._currentRange)) }, n.abort = function() { this._loader.abort(), this._paused && (this._paused = !1, this._resumeFrom = 0) }, n.pause = function() { this.isWorking() && (this._loader.abort(), 0 !== this._stashUsed ? (this._resumeFrom = this ._stashByteStart, this._currentRange.to = this._stashByteStart - 1) : this._resumeFrom = this ._currentRange.to + 1, this._stashUsed = 0, this._stashByteStart = 0, this._paused = !0) }, n.resume = function() { if (this._paused) { this._paused = !1; var e = this._resumeFrom; this._resumeFrom = 0, this._internalSeek(e, !0) } }, n.seek = function(e) { this._paused = !1, this._stashUsed = 0, this._stashByteStart = 0, this._internalSeek(e, !0) }, n._internalSeek = function(e, t) { this._loader.isWorking() && this._loader.abort(), this._flushStashBuffer(t), this._loader.destroy(), this._loader = null; var i = { from: e, to: -1 }; this._currentRange = { from: i.from, to: -1 }, this._speedSampler.reset(), this._stashSize = this._stashInitialSize, this._createLoader(), this._loader.open(this._dataSource, i), this._onSeeked && this._onSeeked() }, n.updateUrl = function(e) { if (!e || "string" != typeof e || 0 === e.length) throw new u.b("Url must be a non-empty string!"); this._dataSource.url = e }, n._expandBuffer = function(e) { for (var t = this._stashSize; t + 1048576 < e;) t *= 2; if ((t += 1048576) !== this._bufferSize) { var i = new ArrayBuffer(t); if (this._stashUsed > 0) { var r = new Uint8Array(this._stashBuffer, 0, this._stashUsed); new Uint8Array(i, 0, t).set(r, 0) } this._stashBuffer = i, this._bufferSize = t } }, n._normalizeSpeed = function(e) { var t = this._speedNormalizeList, i = t.length - 1, r = 0, n = 0, a = i; if (e < t[0]) return t[0]; for (; n <= a;) { if ((r = n + Math.floor((a - n) / 2)) === i || e >= t[r] && e < t[r + 1]) return t[r]; t[r] < e ? n = r + 1 : a = r - 1 } }, n._adjustStashSize = function(e) { var t = 0; (t = this._config.isLive || e < 512 ? e : e >= 512 && e <= 1024 ? Math.floor(1.5 * e) : 2 * e) > 8192 && (t = 8192); var i = 1024 * t + 1048576; this._bufferSize < i && this._expandBuffer(i), this._stashSize = 1024 * t }, n._dispatchChunks = function(e, t) { return this._currentRange.to = t + e.byteLength - 1, this._onDataArrival(e, t) }, n._onURLRedirect = function(e) { this._redirectedURL = e, this._onRedirect && this._onRedirect(e) }, n._onContentLengthKnown = function(e) { e && this._fullRequestFlag && (this._totalLength = e, this._fullRequestFlag = !1) }, n._onLoaderChunkArrival = function(e, t, i) { if (this._loaderChunkArrival && this._loaderChunkArrival(e), !this._onDataArrival) throw new u.a( "IOController: No existing consumer (onDataArrival) callback!"); if (!this._paused && (this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, this ._onRecoveredEarlyEof && this._onRecoveredEarlyEof()), e)) { this._speedSampler.addBytes(e.byteLength); var r = this._speedSampler.lastSecondKBps; if (0 !== r) { var n = this._normalizeSpeed(r); this._speedNormalized !== n && (this._speedNormalized = n, this._adjustStashSize(n)) } if (this._isHLSURL && (this._enableStash = !1), this._enableStash) if (0 === this._stashUsed && 0 === this._stashByteStart && (this._stashByteStart = t), this ._stashUsed + e.byteLength <= this._stashSize) new Uint8Array(this._stashBuffer, 0, this ._stashSize).set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength; else { var a = new Uint8Array(this._stashBuffer, 0, this._bufferSize); if (this._stashUsed > 0) { var s = this._stashBuffer.slice(0, this._stashUsed), o = this._dispatchChunks(s, this._stashByteStart); if (o < s.byteLength) { if (o > 0) { var l = new Uint8Array(s, o); a.set(l, 0), this._stashUsed = l.byteLength, this._stashByteStart += o } } else this._stashUsed = 0, this._stashByteStart += o; this._stashUsed + e.byteLength > this._bufferSize && (this._expandBuffer(this._stashUsed + e .byteLength), a = new Uint8Array(this._stashBuffer, 0, this._bufferSize)), a.set( new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength } else { var d = this._dispatchChunks(e, t); if (d < e.byteLength) { var c = e.byteLength - d; c > this._bufferSize && (this._expandBuffer(c), a = new Uint8Array(this._stashBuffer, 0, this._bufferSize)), a.set(new Uint8Array(e, d), 0), this._stashUsed += c, this ._stashByteStart = t + d } } } else if (0 === this._stashUsed) { var h = this._dispatchChunks(e, t); if (h < e.byteLength) { var f = e.byteLength - h; f > this._bufferSize && this._expandBuffer(f), new Uint8Array(this._stashBuffer, 0, this ._bufferSize).set(new Uint8Array(e, h), 0), this._stashUsed += f, this._stashByteStart = t + h } } else { this._stashUsed + e.byteLength > this._bufferSize && this._expandBuffer(this._stashUsed + e .byteLength); var p = new Uint8Array(this._stashBuffer, 0, this._bufferSize); p.set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength; var m = this._dispatchChunks(this._stashBuffer.slice(0, this._stashUsed), this._stashByteStart); if (m < this._stashUsed && m > 0) { var g = new Uint8Array(this._stashBuffer, m); p.set(g, 0) } this._stashUsed -= m, this._stashByteStart += m } } }, n._flushStashBuffer = function(e) { if (this._stashUsed > 0) { var t = this._stashBuffer.slice(0, this._stashUsed), i = this._dispatchChunks(t, this._stashByteStart), n = t.byteLength - i; if (i < t.byteLength) { if (!e) { if (i > 0) { var a = new Uint8Array(this._stashBuffer, 0, this._bufferSize), s = new Uint8Array(t, i); a.set(s, 0), this._stashUsed = s.byteLength, this._stashByteStart += i } return 0 } r.a.w(this.TAG, n + " bytes unconsumed data remain when flush buffer, dropped") } return this._stashUsed = 0, this._stashByteStart = 0, n } return 0 }, n._onLoaderComplete = function(e, t, i) { this._flushStashBuffer(!0), this._onComplete && this._onComplete(this._extraData, i) }, n._onLoaderHLSError = function() { this._loaderHLSError() }, n._onLoaderError = function(e, t) { switch (r.a.e(this.TAG, "Loader error, code = " + t.code + ", msg = " + t.msg), this ._flushStashBuffer(!1), this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, e = s .b.UNRECOVERABLE_EARLY_EOF), e) { case s.b.EARLY_EOF: if (!this._config.isLive && this._totalLength) { var i = this._currentRange.to + 1; return void(i < this._totalLength && (r.a.w(this.TAG, "Connection lost, trying reconnect..."), this._isEarlyEofReconnecting = !0, this._internalSeek(i, !1))) } e = s.b.UNRECOVERABLE_EARLY_EOF; break; case s.b.UNRECOVERABLE_EARLY_EOF: case s.b.CONNECTING_TIMEOUT: case s.b.HTTP_STATUS_CODE_INVALID: case s.b.EXCEPTION: } if (!this._onError) throw new u.d("IOException: " + t.msg); this._onError(e, t) }, n._getM3u8Loader = function() { return this._isHLSURL ? this._loader : null }, t = e, (i = [{ key: "status", get: function() { return this._loader.status } }, { key: "extraData", get: function() { return this._extraData }, set: function(e) { this._extraData = e } }, { key: "onDataArrival", get: function() { return this._onDataArrival }, set: function(e) { this._onDataArrival = e } }, { key: "loaderChunkArrival", get: function() { return this._loaderChunkArrival }, set: function(e) { this._loaderChunkArrival = e } }, { key: "loaderHLSError", get: function() { return this._loaderHLSError }, set: function(e) { this._loaderHLSError = e } }, { key: "onSeeked", get: function() { return this._onSeeked }, set: function(e) { this._onSeeked = e } }, { key: "onError", get: function() { return this._onError }, set: function(e) { this._onError = e } }, { key: "onComplete", get: function() { return this._onComplete }, set: function(e) { this._onComplete = e } }, { key: "onRedirect", get: function() { return this._onRedirect }, set: function(e) { this._onRedirect = e } }, { key: "onRecoveredEarlyEof", get: function() { return this._onRecoveredEarlyEof }, set: function(e) { this._onRecoveredEarlyEof = e } }, { key: "currentURL", get: function() { return this._dataSource.url } }, { key: "hasRedirect", get: function() { return null != this._redirectedURL || null != this._dataSource.redirectedURL } }, { key: "currentRedirectedURL", get: function() { return this._redirectedURL || this._dataSource.redirectedURL } }, { key: "currentSpeed", get: function() { return this._loaderClass === _ ? this._loader.currentSpeed : this._speedSampler .lastSecondKBps } }, { key: "averageKBps", get: function() { return this._speedSampler.averageKBps } }, { key: "loaderType", get: function() { return this._loader.type } }]) && k(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); t.a = R }, function(e, t, i) { "use strict"; (function(t) { void 0 === t || !t.version || 0 === t.version.indexOf("v0.") || 0 === t.version.indexOf("v1.") && 0 !== t.version.indexOf("v1.8.") ? e.exports = { nextTick: function(e, i, r, n) { if ("function" != typeof e) throw new TypeError('"callback" argument must be a function'); var a, s, o = arguments.length; switch (o) { case 0: case 1: return t.nextTick(e); case 2: return t.nextTick(function() { e.call(null, i) }); case 3: return t.nextTick(function() { e.call(null, i, r) }); case 4: return t.nextTick(function() { e.call(null, i, r, n) }); default: for (a = new Array(o - 1), s = 0; s < a.length;) a[s++] = arguments[s]; return t.nextTick(function() { e.apply(null, a) }) } } } : e.exports = t }).call(this, i(9)) }, function(e, t, i) { var r = i(6).Buffer; function n(e) { r.isBuffer(e) || (e = r.from(e)); for (var t = e.length / 4 | 0, i = new Array(t), n = 0; n < t; n++) i[n] = e.readUInt32BE(4 * n); return i } function a(e) { for (; 0 < e.length; e++) e[0] = 0 } function s(e, t, i, r, n) { for (var a, s, o, u, l = i[0], d = i[1], c = i[2], h = i[3], f = e[0] ^ t[0], p = e[1] ^ t[1], m = e[2] ^ t[2], g = e[3] ^ t[3], v = 4, y = 1; y < n; y++) a = l[f >>> 24] ^ d[p >>> 16 & 255] ^ c[m >>> 8 & 255] ^ h[255 & g] ^ t[v++], s = l[p >>> 24] ^ d[m >>> 16 & 255] ^ c[g >>> 8 & 255] ^ h[255 & f] ^ t[ v++], o = l[m >>> 24] ^ d[g >>> 16 & 255] ^ c[f >>> 8 & 255] ^ h[255 & p] ^ t[v++], u = l[g >>> 24] ^ d[f >>> 16 & 255] ^ c[p >>> 8 & 255] ^ h[255 & m] ^ t[v++], f = a, p = s, m = o, g = u; return a = (r[f >>> 24] << 24 | r[p >>> 16 & 255] << 16 | r[m >>> 8 & 255] << 8 | r[255 & g]) ^ t[v++], s = (r[p >>> 24] << 24 | r[m >>> 16 & 255] << 16 | r[g >>> 8 & 255] << 8 | r[255 & f]) ^ t[v++], o = (r[ m >>> 24] << 24 | r[g >>> 16 & 255] << 16 | r[f >>> 8 & 255] << 8 | r[255 & p]) ^ t[v++], u = (r[g >>> 24] << 24 | r[f >>> 16 & 255] << 16 | r[p >>> 8 & 255] << 8 | r[255 & m]) ^ t[v++], [a >>>= 0, s >>>= 0, o >>>= 0, u >>>= 0 ] } var o = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], u = function() { for (var e = new Array(256), t = 0; t < 256; t++) e[t] = t < 128 ? t << 1 : t << 1 ^ 283; for (var i = [], r = [], n = [ [], [], [], [] ], a = [ [], [], [], [] ], s = 0, o = 0, u = 0; u < 256; ++u) { var l = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4; l = l >>> 8 ^ 255 & l ^ 99, i[s] = l, r[l] = s; var d = e[s], c = e[d], h = e[c], f = 257 * e[l] ^ 16843008 * l; n[0][s] = f << 24 | f >>> 8, n[1][s] = f << 16 | f >>> 16, n[2][s] = f << 8 | f >>> 24, n[3][s] = f, f = 16843009 * h ^ 65537 * c ^ 257 * d ^ 16843008 * s, a[0][l] = f << 24 | f >>> 8, a[1][l] = f << 16 | f >>> 16, a[2][l] = f << 8 | f >>> 24, a[3][l] = f, 0 === s ? s = o = 1 : (s = d ^ e[e[e[h ^ d]]], o ^= e[e[o]]) } return { SBOX: i, INV_SBOX: r, SUB_MIX: n, INV_SUB_MIX: a } }(); function l(e) { this._key = n(e), this._reset() } l.blockSize = 16, l.keySize = 32, l.prototype.blockSize = l.blockSize, l.prototype.keySize = l.keySize, l .prototype._reset = function() { for (var e = this._key, t = e.length, i = t + 6, r = 4 * (i + 1), n = [], a = 0; a < t; a++) n[a] = e[ a]; for (a = t; a < r; a++) { var s = n[a - 1]; a % t == 0 ? (s = s << 8 | s >>> 24, s = u.SBOX[s >>> 24] << 24 | u.SBOX[s >>> 16 & 255] << 16 | u .SBOX[s >>> 8 & 255] << 8 | u.SBOX[255 & s], s ^= o[a / t | 0] << 24) : t > 6 && a % t == 4 && ( s = u.SBOX[s >>> 24] << 24 | u.SBOX[s >>> 16 & 255] << 16 | u.SBOX[s >>> 8 & 255] << 8 | u.SBOX[ 255 & s]), n[a] = n[a - t] ^ s } for (var l = [], d = 0; d < r; d++) { var c = r - d, h = n[c - (d % 4 ? 0 : 4)]; l[d] = d < 4 || c <= 4 ? h : u.INV_SUB_MIX[0][u.SBOX[h >>> 24]] ^ u.INV_SUB_MIX[1][u.SBOX[h >>> 16 & 255]] ^ u.INV_SUB_MIX[2][u.SBOX[h >>> 8 & 255]] ^ u.INV_SUB_MIX[3][u.SBOX[255 & h]] } this._nRounds = i, this._keySchedule = n, this._invKeySchedule = l }, l.prototype.encryptBlockRaw = function(e) { return s(e = n(e), this._keySchedule, u.SUB_MIX, u.SBOX, this._nRounds) }, l.prototype.encryptBlock = function(e) { var t = this.encryptBlockRaw(e), i = r.allocUnsafe(16); return i.writeUInt32BE(t[0], 0), i.writeUInt32BE(t[1], 4), i.writeUInt32BE(t[2], 8), i.writeUInt32BE(t[ 3], 12), i }, l.prototype.decryptBlock = function(e) { var t = (e = n(e))[1]; e[1] = e[3], e[3] = t; var i = s(e, this._invKeySchedule, u.INV_SUB_MIX, u.INV_SBOX, this._nRounds), a = r.allocUnsafe(16); return a.writeUInt32BE(i[0], 0), a.writeUInt32BE(i[3], 4), a.writeUInt32BE(i[2], 8), a.writeUInt32BE(i[ 1], 12), a }, l.prototype.scrub = function() { a(this._keySchedule), a(this._invKeySchedule), a(this._key) }, e.exports.AES = l }, function(e, t, i) { var r = i(6).Buffer, n = i(44); e.exports = function(e, t, i, a) { if (r.isBuffer(e) || (e = r.from(e, "binary")), t && (r.isBuffer(t) || (t = r.from(t, "binary")), 8 !== t.length)) throw new RangeError("salt should be Buffer with 8 byte length"); for (var s = i / 8, o = r.alloc(s), u = r.alloc(a || 0), l = r.alloc(0); s > 0 || a > 0;) { var d = new n; d.update(l), d.update(e), t && d.update(t), l = d.digest(); var c = 0; if (s > 0) { var h = o.length - s; c = Math.min(s, l.length), l.copy(o, h, 0, c), s -= c } if (c < l.length && a > 0) { var f = u.length - a, p = Math.min(a, l.length - c); l.copy(u, f, c, c + p), a -= p } } return l.fill(0), { key: o, iv: u } } }, function(e, t, i) { "use strict"; var r = i(11), n = i(15), a = n.getNAF, s = n.getJSF, o = n.assert; function u(e, t) { this.type = e, this.p = new r(t.p, 16), this.red = t.prime ? r.red(t.prime) : r.mont(this.p), this.zero = new r(0).toRed(this.red), this.one = new r(1).toRed(this.red), this.two = new r(2).toRed(this.red), this .n = t.n && new r(t.n, 16), this.g = t.g && this.pointFromJSON(t.g, t.gRed), this._wnafT1 = new Array( 4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this ._bitLength = this.n ? this.n.bitLength() : 0; var i = this.n && this.p.div(this.n); !i || i.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red)) } function l(e, t) { this.curve = e, this.type = t, this.precomputed = null } e.exports = u, u.prototype.point = function() { throw new Error("Not implemented") }, u.prototype.validate = function() { throw new Error("Not implemented") }, u.prototype._fixedNafMul = function(e, t) { o(e.precomputed); var i = e._getDoubles(), r = a(t, 1, this._bitLength), n = (1 << i.step + 1) - (i.step % 2 == 0 ? 2 : 1); n /= 3; var s, u, l = []; for (s = 0; s < r.length; s += i.step) { u = 0; for (var d = s + i.step - 1; d >= s; d--) u = (u << 1) + r[d]; l.push(u) } for (var c = this.jpoint(null, null, null), h = this.jpoint(null, null, null), f = n; f > 0; f--) { for (s = 0; s < l.length; s++)(u = l[s]) === f ? h = h.mixedAdd(i.points[s]) : u === -f && (h = h .mixedAdd(i.points[s].neg())); c = c.add(h) } return c.toP() }, u.prototype._wnafMul = function(e, t) { var i = 4, r = e._getNAFPoints(i); i = r.wnd; for (var n = r.points, s = a(t, i, this._bitLength), u = this.jpoint(null, null, null), l = s.length - 1; l >= 0; l--) { for (var d = 0; l >= 0 && 0 === s[l]; l--) d++; if (l >= 0 && d++, u = u.dblp(d), l < 0) break; var c = s[l]; o(0 !== c), u = "affine" === e.type ? c > 0 ? u.mixedAdd(n[c - 1 >> 1]) : u.mixedAdd(n[-c - 1 >> 1] .neg()) : c > 0 ? u.add(n[c - 1 >> 1]) : u.add(n[-c - 1 >> 1].neg()) } return "affine" === e.type ? u.toP() : u }, u.prototype._wnafMulAdd = function(e, t, i, r, n) { var o, u, l, d = this._wnafT1, c = this._wnafT2, h = this._wnafT3, f = 0; for (o = 0; o < r; o++) { var p = (l = t[o])._getNAFPoints(e); d[o] = p.wnd, c[o] = p.points } for (o = r - 1; o >= 1; o -= 2) { var m = o - 1, g = o; if (1 === d[m] && 1 === d[g]) { var v = [t[m], null, null, t[g]]; 0 === t[m].y.cmp(t[g].y) ? (v[1] = t[m].add(t[g]), v[2] = t[m].toJ().mixedAdd(t[g].neg())) : 0 === t[m].y.cmp(t[g].y.redNeg()) ? (v[1] = t[m].toJ().mixedAdd(t[g]), v[2] = t[m].add(t[g].neg())) : ( v[1] = t[m].toJ().mixedAdd(t[g]), v[2] = t[m].toJ().mixedAdd(t[g].neg())); var y = [-3, -1, -5, -7, 0, 7, 5, 1, 3], _ = s(i[m], i[g]); for (f = Math.max(_[0].length, f), h[m] = new Array(f), h[g] = new Array(f), u = 0; u < f; u++) { var b = 0 | _[0][u], w = 0 | _[1][u]; h[m][u] = y[3 * (b + 1) + (w + 1)], h[g][u] = 0, c[m] = v } } else h[m] = a(i[m], d[m], this._bitLength), h[g] = a(i[g], d[g], this._bitLength), f = Math.max(h[m] .length, f), f = Math.max(h[g].length, f) } var E = this.jpoint(null, null, null), T = this._wnafT4; for (o = f; o >= 0; o--) { for (var S = 0; o >= 0;) { var A = !0; for (u = 0; u < r; u++) T[u] = 0 | h[u][o], 0 !== T[u] && (A = !1); if (!A) break; S++, o-- } if (o >= 0 && S++, E = E.dblp(S), o < 0) break; for (u = 0; u < r; u++) { var k = T[u]; 0 !== k && (k > 0 ? l = c[u][k - 1 >> 1] : k < 0 && (l = c[u][-k - 1 >> 1].neg()), E = "affine" === l.type ? E.mixedAdd(l) : E.add(l)) } } for (o = 0; o < r; o++) c[o] = null; return n ? E : E.toP() }, u.BasePoint = l, l.prototype.eq = function() { throw new Error("Not implemented") }, l.prototype.validate = function() { return this.curve.validate(this) }, u.prototype.decodePoint = function(e, t) { e = n.toArray(e, t); var i = this.p.byteLength(); if ((4 === e[0] || 6 === e[0] || 7 === e[0]) && e.length - 1 == 2 * i) return 6 === e[0] ? o(e[e .length - 1] % 2 == 0) : 7 === e[0] && o(e[e.length - 1] % 2 == 1), this.point(e.slice(1, 1 + i), e.slice(1 + i, 1 + 2 * i)); if ((2 === e[0] || 3 === e[0]) && e.length - 1 === i) return this.pointFromX(e.slice(1, 1 + i), 3 === e[ 0]); throw new Error("Unknown point format") }, l.prototype.encodeCompressed = function(e) { return this.encode(e, !0) }, l.prototype._encode = function(e) { var t = this.curve.p.byteLength(), i = this.getX().toArray("be", t); return e ? [this.getY().isEven() ? 2 : 3].concat(i) : [4].concat(i, this.getY().toArray("be", t)) }, l.prototype.encode = function(e, t) { return n.encode(this._encode(t), e) }, l.prototype.precompute = function(e) { if (this.precomputed) return this; var t = { doubles: null, naf: null, beta: null }; return t.naf = this._getNAFPoints(8), t.doubles = this._getDoubles(4, e), t.beta = this._getBeta(), this .precomputed = t, this }, l.prototype._hasDoubles = function(e) { if (!this.precomputed) return !1; var t = this.precomputed.doubles; return !!t && t.points.length >= Math.ceil((e.bitLength() + 1) / t.step) }, l.prototype._getDoubles = function(e, t) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var i = [this], r = this, n = 0; n < t; n += e) { for (var a = 0; a < e; a++) r = r.dbl(); i.push(r) } return { step: e, points: i } }, l.prototype._getNAFPoints = function(e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for (var t = [this], i = (1 << e) - 1, r = 1 === i ? null : this.dbl(), n = 1; n < i; n++) t[n] = t[n - 1].add(r); return { wnd: e, points: t } }, l.prototype._getBeta = function() { return null }, l.prototype.dblp = function(e) { for (var t = this, i = 0; i < e; i++) t = t.dbl(); return t } }, function(e, t, i) { var r = i(213), n = i(220), a = i(221), s = i(53), o = i(88), u = i(6).Buffer; function l(e) { var t; "object" != typeof e || u.isBuffer(e) || (t = e.passphrase, e = e.key), "string" == typeof e && (e = u .from(e)); var i, l, d = a(e, t), c = d.tag, h = d.data; switch (c) { case "CERTIFICATE": l = r.certificate.decode(h, "der").tbsCertificate.subjectPublicKeyInfo; case "PUBLIC KEY": switch (l || (l = r.PublicKey.decode(h, "der")), i = l.algorithm.algorithm.join(".")) { case "1.2.840.113549.1.1.1": return r.RSAPublicKey.decode(l.subjectPublicKey.data, "der"); case "1.2.840.10045.2.1": return l.subjectPrivateKey = l.subjectPublicKey, { type: "ec", data: l }; case "1.2.840.10040.4.1": return l.algorithm.params.pub_key = r.DSAparam.decode(l.subjectPublicKey.data, "der"), { type: "dsa", data: l.algorithm.params }; default: throw new Error("unknown key id " + i) } case "ENCRYPTED PRIVATE KEY": h = function(e, t) { var i = e.algorithm.decrypt.kde.kdeparams.salt, r = parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(), 10), a = n[e.algorithm.decrypt.cipher.algo.join(".")], l = e.algorithm.decrypt.cipher.iv, d = e.subjectPrivateKey, c = parseInt(a.split("-")[1], 10) / 8, h = o.pbkdf2Sync(t, i, r, c, "sha1"), f = s.createDecipheriv(a, h, l), p = []; return p.push(f.update(d)), p.push(f.final()), u.concat(p) }(h = r.EncryptedPrivateKey.decode(h, "der"), t); case "PRIVATE KEY": switch (i = (l = r.PrivateKey.decode(h, "der")).algorithm.algorithm.join(".")) { case "1.2.840.113549.1.1.1": return r.RSAPrivateKey.decode(l.subjectPrivateKey, "der"); case "1.2.840.10045.2.1": return { curve: l.algorithm.curve, privateKey: r.ECPrivateKey.decode(l.subjectPrivateKey, "der") .privateKey }; case "1.2.840.10040.4.1": return l.algorithm.params.priv_key = r.DSAparam.decode(l.subjectPrivateKey, "der"), { type: "dsa", params: l.algorithm.params }; default: throw new Error("unknown key id " + i) } case "RSA PUBLIC KEY": return r.RSAPublicKey.decode(h, "der"); case "RSA PRIVATE KEY": return r.RSAPrivateKey.decode(h, "der"); case "DSA PRIVATE KEY": return { type: "dsa", params: r.DSAPrivateKey.decode(h, "der") }; case "EC PRIVATE KEY": return { curve: (h = r.ECPrivateKey.decode(h, "der")).parameters.value, privateKey: h.privateKey }; default: throw new Error("unknown key type " + c) } } e.exports = l, l.signature = r.signature }, function(e, t, i) { "use strict"; var r = function() { function e() {} return e.install = function() { Object.setPrototypeOf = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e }, Object.assign = Object.assign || function(e) { if (null == e) throw new TypeError("Cannot convert undefined or null to object"); for (var t = Object(e), i = 1; i < arguments.length; i++) { var r = arguments[i]; if (null != r) for (var n in r) r.hasOwnProperty(n) && (t[n] = r[n]) } return t }, "function" != typeof self.Promise && i(124).polyfill() }, e }(); r.install(), t.a = r }, function(e, t, i) { "use strict"; var r = i(5), n = i(72), a = i(6).Buffer, s = new Array(16); function o() { n.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878 } function u(e, t) { return e << t | e >>> 32 - t } function l(e, t, i, r, n, a, s) { return u(e + (t & i | ~t & r) + n + a | 0, s) + t | 0 } function d(e, t, i, r, n, a, s) { return u(e + (t & r | i & ~r) + n + a | 0, s) + t | 0 } function c(e, t, i, r, n, a, s) { return u(e + (t ^ i ^ r) + n + a | 0, s) + t | 0 } function h(e, t, i, r, n, a, s) { return u(e + (i ^ (t | ~r)) + n + a | 0, s) + t | 0 } r(o, n), o.prototype._update = function() { for (var e = s, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t); var i = this._a, r = this._b, n = this._c, a = this._d; i = h(i = c(i = c(i = c(i = c(i = d(i = d(i = d(i = d(i = l(i = l(i = l(i = l(i, r, n, a, e[0], 3614090360, 7), r = l(r, n = l(n, a = l(a, i, r, n, e[1], 3905402710, 12), i, r, e[2], 606105819, 17), a, i, e[3], 3250441966, 22), n, a, e[4], 4118548399, 7), r = l(r, n = l(n, a = l(a, i, r, n, e[5], 1200080426, 12), i, r, e[6], 2821735955, 17), a, i, e[7], 4249261313, 22), n, a, e[8], 1770035416, 7), r = l(r, n = l(n, a = l(a, i, r, n, e[9], 2336552879, 12), i, r, e[10], 4294925233, 17), a, i, e[11], 2304563134, 22), n, a, e[12], 1804603682, 7), r = l( r, n = l(n, a = l(a, i, r, n, e[13], 4254626195, 12), i, r, e[14], 2792965006, 17), a, i, e[15], 1236535329, 22), n, a, e[1], 4129170786, 5), r = d(r, n = d(n, a = d(a, i, r, n, e[6], 3225465664, 9), i, r, e[11], 643717713, 14), a, i, e[0], 3921069994, 20), n, a, e[5], 3593408605, 5), r = d(r, n = d(n, a = d(a, i, r, n, e[ 10], 38016083, 9), i, r, e[15], 3634488961, 14), a, i, e[4], 3889429448, 20), n, a, e[ 9], 568446438, 5), r = d(r, n = d(n, a = d(a, i, r, n, e[14], 3275163606, 9), i, r, e[ 3], 4107603335, 14), a, i, e[8], 1163531501, 20), n, a, e[13], 2850285829, 5), r = d(r, n = d(n, a = d(a, i, r, n, e[2], 4243563512, 9), i, r, e[7], 1735328473, 14), a, i, e[12], 2368359562, 20), n, a, e[5], 4294588738, 4), r = c(r, n = c(n, a = c(a, i, r, n, e[8], 2272392833, 11), i, r, e[11], 1839030562, 16), a, i, e[14], 4259657740, 23), n, a, e[1], 2763975236, 4), r = c(r, n = c(n, a = c(a, i, r, n, e[4], 1272893353, 11), i, r, e[7], 4139469664, 16), a, i, e[10], 3200236656, 23), n, a, e[13], 681279174, 4), r = c(r, n = c(n, a = c(a, i, r, n, e[0], 3936430074, 11), i, r, e[3], 3572445317, 16), a, i, e[6], 76029189, 23), n, a, e[9], 3654602809, 4), r = c(r, n = c(n, a = c(a, i, r, n, e[12], 3873151461, 11), i, r, e[15], 530742520, 16), a, i, e[2], 3299628645, 23), n, a, e[0], 4096336452, 6), r = h(r = h(r = h(r = h(r, n = h(n, a = h(a, i, r, n, e[7], 1126891415, 10), i, r, e[14], 2878612391, 15), a, i, e[5], 4237533241, 21), n = h(n, a = h(a, i = h(i, r, n, a, e[12], 1700485571, 6), r, n, e[3], 2399980690, 10), i, r, e[10], 4293915773, 15), a, i, e[1], 2240044497, 21), n = h(n, a = h(a, i = h(i, r, n, a, e[8], 1873313359, 6), r, n, e[15], 4264355552, 10), i, r, e[6], 2734768916, 15), a, i, e[13], 1309151649, 21), n = h(n, a = h(a, i = h(i, r, n, a, e[4], 4149444226, 6), r, n, e[11], 3174756917, 10), i, r, e[2], 718787259, 15), a, i, e[9], 3951481745, 21), this._a = this._a + i | 0, this._b = this._b + r | 0, this._c = this._c + n | 0, this._d = this._d + a | 0 }, o.prototype._digest = function() { this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this ._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update(); var e = a.allocUnsafe(16); return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e .writeInt32LE(this._d, 12), e }, e.exports = o }, function(e, t, i) { (function(t) { function i(e) { try { if (!t.localStorage) return !1 } catch (e) { return !1 } var i = t.localStorage[e]; return null != i && "true" === String(i).toLowerCase() } e.exports = function(e, t) { if (i("noDeprecation")) return e; var r = !1; return function() { if (!r) { if (i("throwDeprecation")) throw new Error(t); i("traceDeprecation") ? console.trace(t) : console.warn(t), r = !0 } return e.apply(this, arguments) } } }).call(this, i(13)) }, function(e, t, i) { "use strict"; var r = i(25).codes.ERR_STREAM_PREMATURE_CLOSE; function n() {} e.exports = function e(t, i, a) { if ("function" == typeof i) return e(t, null, i); i || (i = {}), a = function(e) { var t = !1; return function() { if (!t) { t = !0; for (var i = arguments.length, r = new Array(i), n = 0; n < i; n++) r[n] = arguments[n]; e.apply(this, r) } } }(a || n); var s = i.readable || !1 !== i.readable && t.readable, o = i.writable || !1 !== i.writable && t.writable, u = function() { t.writable || d() }, l = t._writableState && t._writableState.finished, d = function() { o = !1, l = !0, s || a.call(t) }, c = t._readableState && t._readableState.endEmitted, h = function() { s = !1, c = !0, o || a.call(t) }, f = function(e) { a.call(t, e) }, p = function() { var e; return s && !c ? (t._readableState && t._readableState.ended || (e = new r), a.call(t, e)) : o && ! l ? (t._writableState && t._writableState.ended || (e = new r), a.call(t, e)) : void 0 }, m = function() { t.req.on("finish", d) }; return function(e) { return e.setHeader && "function" == typeof e.abort }(t) ? (t.on("complete", d), t.on("abort", p), t.req ? m() : t.on("request", m)) : o && !t ._writableState && (t.on("end", u), t.on("close", u)), t.on("end", h), t.on("finish", d), !1 !== i .error && t.on("error", f), t.on("close", p), function() { t.removeListener("complete", d), t.removeListener("abort", p), t.removeListener("request", m), t .req && t.req.removeListener("finish", d), t.removeListener("end", u), t.removeListener("close", u), t.removeListener("finish", d), t.removeListener("end", h), t.removeListener("error", f), t .removeListener("close", p) } } }, function(e, t, i) { "use strict"; var r = i(10).Buffer, n = i(5), a = i(72), s = new Array(16), o = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 ], u = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 ], l = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ], d = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ], c = [0, 1518500249, 1859775393, 2400959708, 2840853838], h = [1352829926, 1548603684, 1836072691, 2053994217, 0]; function f() { a.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520 } function p(e, t) { return e << t | e >>> 32 - t } function m(e, t, i, r, n, a, s, o) { return p(e + (t ^ i ^ r) + a + s | 0, o) + n | 0 } function g(e, t, i, r, n, a, s, o) { return p(e + (t & i | ~t & r) + a + s | 0, o) + n | 0 } function v(e, t, i, r, n, a, s, o) { return p(e + ((t | ~i) ^ r) + a + s | 0, o) + n | 0 } function y(e, t, i, r, n, a, s, o) { return p(e + (t & r | i & ~r) + a + s | 0, o) + n | 0 } function _(e, t, i, r, n, a, s, o) { return p(e + (t ^ (i | ~r)) + a + s | 0, o) + n | 0 } n(f, a), f.prototype._update = function() { for (var e = s, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t); for (var i = 0 | this._a, r = 0 | this._b, n = 0 | this._c, a = 0 | this._d, f = 0 | this._e, b = 0 | this._a, w = 0 | this._b, E = 0 | this._c, T = 0 | this._d, S = 0 | this._e, A = 0; A < 80; A += 1) { var k, R; A < 16 ? (k = m(i, r, n, a, f, e[o[A]], c[0], l[A]), R = _(b, w, E, T, S, e[u[A]], h[0], d[A])) : A < 32 ? (k = g(i, r, n, a, f, e[o[A]], c[1], l[A]), R = y(b, w, E, T, S, e[u[A]], h[1], d[A])) : A < 48 ? (k = v(i, r, n, a, f, e[o[A]], c[2], l[A]), R = v(b, w, E, T, S, e[u[A]], h[2], d[A])) : A < 64 ? (k = y(i, r, n, a, f, e[o[A]], c[3], l[A]), R = g(b, w, E, T, S, e[u[A]], h[3], d[A])) : (k = _(i, r, n, a, f, e[o[A]], c[4], l[A]), R = m(b, w, E, T, S, e[u[A]], h[4], d[A])), i = f, f = a, a = p(n, 10), n = r, r = k, b = S, S = T, T = p(E, 10), E = w, w = R } var M = this._b + n + T | 0; this._b = this._c + a + S | 0, this._c = this._d + f + b | 0, this._d = this._e + i + w | 0, this._e = this._a + r + E | 0, this._a = M }, f.prototype._digest = function() { this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this ._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update(); var e = r.alloc ? r.alloc(20) : new r(20); return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e .writeInt32LE(this._d, 12), e.writeInt32LE(this._e, 16), e }, e.exports = f }, function(e, t, i) { (t = e.exports = function(e) { e = e.toLowerCase(); var i = t[e]; if (!i) throw new Error(e + " is not supported (we accept pull requests)"); return new i }).sha = i(144), t.sha1 = i(145), t.sha224 = i(146), t.sha256 = i(79), t.sha384 = i(147), t.sha512 = i(80) }, function(e, t, i) { (t = e.exports = i(81)).Stream = t, t.Readable = t, t.Writable = i(51), t.Duplex = i(23), t.Transform = i( 84), t.PassThrough = i(154) }, function(e, t, i) { var r = i(10), n = r.Buffer; function a(e, t) { for (var i in e) t[i] = e[i] } function s(e, t, i) { return n(e, t, i) } n.from && n.alloc && n.allocUnsafe && n.allocUnsafeSlow ? e.exports = r : (a(r, t), t.Buffer = s), a(n, s), s.from = function(e, t, i) { if ("number" == typeof e) throw new TypeError("Argument must not be a number"); return n(e, t, i) }, s.alloc = function(e, t, i) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); var r = n(e); return void 0 !== t ? "string" == typeof i ? r.fill(t, i) : r.fill(t) : r.fill(0), r }, s.allocUnsafe = function(e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return n(e) }, s.allocUnsafeSlow = function(e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return r.SlowBuffer(e) } }, function(e, t, i) { "use strict"; (function(t, r, n) { var a = i(38); function s(e) { var t = this; this.next = null, this.entry = null, this.finish = function() { ! function(e, t, i) { var r = e.entry; for (e.entry = null; r;) { var n = r.callback; t.pendingcb--, n(void 0), r = r.next } t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e }(t, e) } } e.exports = y; var o, u = !t.browser && ["v0.10", "v0.9."].indexOf(t.version.slice(0, 5)) > -1 ? r : a.nextTick; y.WritableState = v; var l = Object.create(i(32)); l.inherits = i(5); var d, c = { deprecate: i(45) }, h = i(82), f = i(50).Buffer, p = n.Uint8Array || function() {}, m = i(83); function g() {} function v(e, t) { o = o || i(23), e = e || {}; var r = t instanceof o; this.objectMode = !!e.objectMode, r && (this.objectMode = this.objectMode || !!e.writableObjectMode); var n = e.highWaterMark, l = e.writableHighWaterMark, d = this.objectMode ? 16 : 16384; this.highWaterMark = n || 0 === n ? n : r && (l || 0 === l) ? l : d, this.highWaterMark = Math.floor( this.highWaterMark), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = ! 1, this.finished = !1, this.destroyed = !1; var c = !1 === e.decodeStrings; this.decodeStrings = !c, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this .writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function( e) { ! function(e, t) { var i = e._writableState, r = i.sync, n = i.writecb; if (function(e) { e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0 }(i), t) ! function(e, t, i, r, n) { --t.pendingcb, i ? (a.nextTick(n, r), a.nextTick(S, e, t), e._writableState.errorEmitted = ! 0, e.emit("error", r)) : (n(r), e._writableState.errorEmitted = !0, e.emit("error", r), S(e, t)) }(e, i, r, t, n); else { var s = E(i); s || i.corked || i.bufferProcessing || !i.bufferedRequest || w(e, i), r ? u(b, e, i, s, n) : b(e, i, s, n) } }(t, e) }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new s(this) } function y(e) { if (o = o || i(23), !(d.call(y, this) || this instanceof o)) return new y(e); this._writableState = new v(e, this), this.writable = !0, e && ("function" == typeof e.write && (this ._write = e.write), "function" == typeof e.writev && (this._writev = e.writev), "function" == typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && (this._final = e .final)), h.call(this) } function _(e, t, i, r, n, a, s) { t.writelen = r, t.writecb = s, t.writing = !0, t.sync = !0, i ? e._writev(n, t.onwrite) : e._write(n, a, t.onwrite), t.sync = !1 } function b(e, t, i, r) { i || function(e, t) { 0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain")) }(e, t), t.pendingcb--, r(), S(e, t) } function w(e, t) { t.bufferProcessing = !0; var i = t.bufferedRequest; if (e._writev && i && i.next) { var r = t.bufferedRequestCount, n = new Array(r), a = t.corkedRequestsFree; a.entry = i; for (var o = 0, u = !0; i;) n[o] = i, i.isBuf || (u = !1), i = i.next, o += 1; n.allBuffers = u, _(e, t, !0, t.length, n, "", a.finish), t.pendingcb++, t.lastBufferedRequest = null, a.next ? (t.corkedRequestsFree = a.next, a.next = null) : t.corkedRequestsFree = new s(t), t .bufferedRequestCount = 0 } else { for (; i;) { var l = i.chunk, d = i.encoding, c = i.callback; if (_(e, t, !1, t.objectMode ? 1 : l.length, l, d, c), i = i.next, t.bufferedRequestCount--, t .writing) break } null === i && (t.lastBufferedRequest = null) } t.bufferedRequest = i, t.bufferProcessing = !1 } function E(e) { return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing } function T(e, t) { e._final(function(i) { t.pendingcb--, i && e.emit("error", i), t.prefinished = !0, e.emit("prefinish"), S(e, t) }) } function S(e, t) { var i = E(t); return i && (function(e, t) { t.prefinished || t.finalCalled || ("function" == typeof e._final ? (t.pendingcb++, t .finalCalled = !0, a.nextTick(T, e, t)) : (t.prefinished = !0, e.emit("prefinish"))) }(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"))), i } l.inherits(y, h), v.prototype.getBuffer = function() { for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next; return t }, function() { try { Object.defineProperty(v.prototype, "buffer", { get: c.deprecate(function() { return this.getBuffer() }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }) } catch (e) {} }(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[ Symbol.hasInstance] ? (d = Function.prototype[Symbol.hasInstance], Object.defineProperty(y, Symbol .hasInstance, { value: function(e) { return !!d.call(this, e) || this === y && e && e._writableState instanceof v } })) : d = function(e) { return e instanceof this }, y.prototype.pipe = function() { this.emit("error", new Error("Cannot pipe, not readable")) }, y.prototype.write = function(e, t, i) { var r, n = this._writableState, s = !1, o = !n.objectMode && (r = e, f.isBuffer(r) || r instanceof p); return o && !f.isBuffer(e) && (e = function(e) { return f.from(e) }(e)), "function" == typeof t && (i = t, t = null), o ? t = "buffer" : t || (t = n .defaultEncoding), "function" != typeof i && (i = g), n.ended ? function(e, t) { var i = new Error("write after end"); e.emit("error", i), a.nextTick(t, i) }(this, i) : (o || function(e, t, i, r) { var n = !0, s = !1; return null === i ? s = new TypeError("May not write null values to stream") : "string" == typeof i || void 0 === i || t.objectMode || (s = new TypeError( "Invalid non-string/buffer chunk")), s && (e.emit("error", s), a.nextTick(r, s), n = !1), n }(this, n, e, i)) && (n.pendingcb++, s = function(e, t, i, r, n, a) { if (!i) { var s = function(e, t, i) { return e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = f.from(t, i)), t }(t, r, n); r !== s && (i = !0, n = "buffer", r = s) } var o = t.objectMode ? 1 : r.length; t.length += o; var u = t.length < t.highWaterMark; if (u || (t.needDrain = !0), t.writing || t.corked) { var l = t.lastBufferedRequest; t.lastBufferedRequest = { chunk: r, encoding: n, isBuf: i, callback: a, next: null }, l ? l.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t .bufferedRequestCount += 1 } else _(e, t, !1, o, r, n, a); return u }(this, n, o, e, t, i)), s }, y.prototype.cork = function() { this._writableState.corked++ }, y.prototype.uncork = function() { var e = this._writableState; e.corked && (e.corked--, e.writing || e.corked || e.finished || e.bufferProcessing || !e .bufferedRequest || w(this, e)) }, y.prototype.setDefaultEncoding = function(e) { if ("string" == typeof e && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw" ].indexOf((e + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + e); return this._writableState.defaultEncoding = e, this }, Object.defineProperty(y.prototype, "writableHighWaterMark", { enumerable: !1, get: function() { return this._writableState.highWaterMark } }), y.prototype._write = function(e, t, i) { i(new Error("_write() is not implemented")) }, y.prototype._writev = null, y.prototype.end = function(e, t, i) { var r = this._writableState; "function" == typeof e ? (i = e, e = null, t = null) : "function" == typeof t && (i = t, t = null), null != e && this.write(e, t), r.corked && (r.corked = 1, this.uncork()), r.ending || r .finished || function(e, t, i) { t.ending = !0, S(e, t), i && (t.finished ? a.nextTick(i) : e.once("finish", i)), t.ended = !0, e .writable = !1 }(this, r, i) }, Object.defineProperty(y.prototype, "destroyed", { get: function() { return void 0 !== this._writableState && this._writableState.destroyed }, set: function(e) { this._writableState && (this._writableState.destroyed = e) } }), y.prototype.destroy = m.destroy, y.prototype._undestroy = m.undestroy, y.prototype._destroy = function(e, t) { this.end(), t(e) } }).call(this, i(9), i(152).setImmediate, i(13)) }, function(e, t, i) { "use strict"; var r = i(14); function n(e) { this.options = e, this.type = this.options.type, this.blockSize = 8, this._init(), this.buffer = new Array(this.blockSize), this.bufferOff = 0 } e.exports = n, n.prototype._init = function() {}, n.prototype.update = function(e) { return 0 === e.length ? [] : "decrypt" === this.type ? this._updateDecrypt(e) : this._updateEncrypt(e) }, n.prototype._buffer = function(e, t) { for (var i = Math.min(this.buffer.length - this.bufferOff, e.length - t), r = 0; r < i; r++) this .buffer[this.bufferOff + r] = e[t + r]; return this.bufferOff += i, i }, n.prototype._flushBuffer = function(e, t) { return this._update(this.buffer, 0, e, t), this.bufferOff = 0, this.blockSize }, n.prototype._updateEncrypt = function(e) { var t = 0, i = 0, r = (this.bufferOff + e.length) / this.blockSize | 0, n = new Array(r * this.blockSize); 0 !== this.bufferOff && (t += this._buffer(e, t), this.bufferOff === this.buffer.length && (i += this ._flushBuffer(n, i))); for (var a = e.length - (e.length - t) % this.blockSize; t < a; t += this.blockSize) this._update(e, t, n, i), i += this.blockSize; for (; t < e.length; t++, this.bufferOff++) this.buffer[this.bufferOff] = e[t]; return n }, n.prototype._updateDecrypt = function(e) { for (var t = 0, i = 0, r = Math.ceil((this.bufferOff + e.length) / this.blockSize) - 1, n = new Array( r * this.blockSize); r > 0; r--) t += this._buffer(e, t), i += this._flushBuffer(n, i); return t += this._buffer(e, t), n }, n.prototype.final = function(e) { var t, i; return e && (t = this.update(e)), i = "encrypt" === this.type ? this._finalEncrypt() : this ._finalDecrypt(), t ? t.concat(i) : i }, n.prototype._pad = function(e, t) { if (0 === t) return !1; for (; t < e.length;) e[t++] = 0; return !0 }, n.prototype._finalEncrypt = function() { if (!this._pad(this.buffer, this.bufferOff)) return []; var e = new Array(this.blockSize); return this._update(this.buffer, 0, e, 0), e }, n.prototype._unpad = function(e) { return e }, n.prototype._finalDecrypt = function() { r.equal(this.bufferOff, this.blockSize, "Not enough data to decrypt"); var e = new Array(this.blockSize); return this._flushBuffer(e, 0), this._unpad(e) } }, function(e, t, i) { var r = i(167), n = i(175), a = i(97); t.createCipher = t.Cipher = r.createCipher, t.createCipheriv = t.Cipheriv = r.createCipheriv, t .createDecipher = t.Decipher = n.createDecipher, t.createDecipheriv = t.Decipheriv = n.createDecipheriv, t .listCiphers = t.getCiphers = function() { return Object.keys(a) } }, function(e, t, i) { var r = { ECB: i(168), CBC: i(169), CFB: i(170), CFB8: i(171), CFB1: i(172), OFB: i(173), CTR: i(95), GCM: i(95) }, n = i(97); for (var a in n) n[a].module = r[n[a].mode]; e.exports = n }, function(e, t) { e.exports = function(e) { return e.webpackPolyfill || (e.deprecate = function() {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", { enumerable: !0, get: function() { return e.l } }), Object.defineProperty(e, "id", { enumerable: !0, get: function() { return e.i } }), e.webpackPolyfill = 1), e } }, function(e, t, i) { var r; function n(e) { this.rand = e } if (e.exports = function(e) { return r || (r = new n(null)), r.generate(e) }, e.exports.Rand = n, n.prototype.generate = function(e) { return this._rand(e) }, n.prototype._rand = function(e) { if (this.rand.getBytes) return this.rand.getBytes(e); for (var t = new Uint8Array(e), i = 0; i < t.length; i++) t[i] = this.rand.getByte(); return t }, "object" == typeof self) self.crypto && self.crypto.getRandomValues ? n.prototype._rand = function(e) { var t = new Uint8Array(e); return self.crypto.getRandomValues(t), t } : self.msCrypto && self.msCrypto.getRandomValues ? n.prototype._rand = function(e) { var t = new Uint8Array(e); return self.msCrypto.getRandomValues(t), t } : "object" == typeof window && (n.prototype._rand = function() { throw new Error("Not implemented yet") }); else try { var a = i(179); if ("function" != typeof a.randomBytes) throw new Error("Not supported"); n.prototype._rand = function(e) { return a.randomBytes(e) } } catch (e) {} }, function(e, t, i) { "use strict"; var r = i(28).codes.ERR_STREAM_PREMATURE_CLOSE; function n() {} e.exports = function e(t, i, a) { if ("function" == typeof i) return e(t, null, i); i || (i = {}), a = function(e) { var t = !1; return function() { if (!t) { t = !0; for (var i = arguments.length, r = new Array(i), n = 0; n < i; n++) r[n] = arguments[n]; e.apply(this, r) } } }(a || n); var s = i.readable || !1 !== i.readable && t.readable, o = i.writable || !1 !== i.writable && t.writable, u = function() { t.writable || d() }, l = t._writableState && t._writableState.finished, d = function() { o = !1, l = !0, s || a.call(t) }, c = t._readableState && t._readableState.endEmitted, h = function() { s = !1, c = !0, o || a.call(t) }, f = function(e) { a.call(t, e) }, p = function() { var e; return s && !c ? (t._readableState && t._readableState.ended || (e = new r), a.call(t, e)) : o && ! l ? (t._writableState && t._writableState.ended || (e = new r), a.call(t, e)) : void 0 }, m = function() { t.req.on("finish", d) }; return function(e) { return e.setHeader && "function" == typeof e.abort }(t) ? (t.on("complete", d), t.on("abort", p), t.req ? m() : t.on("request", m)) : o && !t ._writableState && (t.on("end", u), t.on("close", u)), t.on("end", h), t.on("finish", d), !1 !== i .error && t.on("error", f), t.on("close", p), function() { t.removeListener("complete", d), t.removeListener("abort", p), t.removeListener("request", m), t .req && t.req.removeListener("finish", d), t.removeListener("end", u), t.removeListener("close", u), t.removeListener("finish", d), t.removeListener("end", h), t.removeListener("error", f), t .removeListener("close", p) } } }, function(e, t, i) { (function(t) { var r = i(192), n = i(24); function a(e) { var t, i = e.modulus.byteLength(); do { t = new r(n(i)) } while (t.cmp(e.modulus) >= 0 || !t.umod(e.prime1) || !t.umod(e.prime2)); return t } function s(e, i) { var n = function(e) { var t = a(e); return { blinder: t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed(), unblinder: t.invm(e.modulus) } }(i), s = i.modulus.byteLength(), o = new r(e).mul(n.blinder).umod(i.modulus), u = o.toRed(r.mont(i.prime1)), l = o.toRed(r.mont(i.prime2)), d = i.coefficient, c = i.prime1, h = i.prime2, f = u.redPow(i.exponent1).fromRed(), p = l.redPow(i.exponent2).fromRed(), m = f.isub(p).imul(d).umod(c).imul(h); return p.iadd(m).imul(n.unblinder).umod(i.modulus).toArrayLike(t, "be", s) } s.getr = a, e.exports = s }).call(this, i(10).Buffer) }, function(e, t, i) { "use strict"; var r = t; r.version = i(194).version, r.utils = i(15), r.rand = i(56), r.curve = i(109), r.curves = i(60), r.ec = i( 205), r.eddsa = i(209) }, function(e, t, i) { "use strict"; var r, n = t, a = i(61), s = i(109), o = i(15).assert; function u(e) { "short" === e.type ? this.curve = new s.short(e) : "edwards" === e.type ? this.curve = new s.edwards(e) : this.curve = new s.mont(e), this.g = this.curve.g, this.n = this.curve.n, this.hash = e.hash, o(this.g .validate(), "Invalid curve"), o(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O") } function l(e, t) { Object.defineProperty(n, e, { configurable: !0, enumerable: !0, get: function() { var i = new u(t); return Object.defineProperty(n, e, { configurable: !0, enumerable: !0, value: i }), i } }) } n.PresetCurve = u, l("p192", { type: "short", prime: "p192", p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", hash: a.sha256, gRed: !1, g: ["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811" ] }), l("p224", { type: "short", prime: "p224", p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", hash: a.sha256, gRed: !1, g: ["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34" ] }), l("p256", { type: "short", prime: null, p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", hash: a.sha256, gRed: !1, g: ["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" ] }), l("p384", { type: "short", prime: null, p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", hash: a.sha384, gRed: !1, g: ["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" ] }), l("p521", { type: "short", prime: null, p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", hash: a.sha512, gRed: !1, g: ["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" ] }), l("curve25519", { type: "mont", prime: "p25519", p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", a: "76d06", b: "1", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", hash: a.sha256, gRed: !1, g: ["9"] }), l("ed25519", { type: "edwards", prime: "p25519", p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", a: "-1", c: "1", d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", hash: a.sha256, gRed: !1, g: ["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", "6666666666666666666666666666666666666666666666666666666666666658" ] }); try { r = i(204) } catch (e) { r = void 0 } l("secp256k1", { type: "short", prime: "k256", p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", a: "0", b: "7", n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", h: "1", hash: a.sha256, beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", basis: [{ a: "3086d221a7d46bcde86c90e49284eb15", b: "-e4437ed6010e88286f547fa90abfe4c3" }, { a: "114ca50f7a8e2f3f657c1108d9d44cfd8", b: "3086d221a7d46bcde86c90e49284eb15" }], gRed: !1, g: ["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", r ] }) }, function(e, t, i) { var r = t; r.utils = i(18), r.common = i(34), r.sha = i(198), r.ripemd = i(202), r.hmac = i(203), r.sha1 = r.sha.sha1, r.sha256 = r.sha.sha256, r.sha224 = r.sha.sha224, r.sha384 = r.sha.sha384, r.sha512 = r.sha.sha512, r .ripemd160 = r.ripemd.ripemd160 }, function(e, t, i) { "use strict"; (function(t) { var r, n = i(10), a = n.Buffer, s = {}; for (r in n) n.hasOwnProperty(r) && "SlowBuffer" !== r && "Buffer" !== r && (s[r] = n[r]); var o = s.Buffer = {}; for (r in a) a.hasOwnProperty(r) && "allocUnsafe" !== r && "allocUnsafeSlow" !== r && (o[r] = a[r]); if (s.Buffer.prototype = a.prototype, o.from && o.from !== Uint8Array.from || (o.from = function(e, t, i) { if ("number" == typeof e) throw new TypeError( 'The "value" argument must not be of type number. Received type ' + typeof e); if (e && void 0 === e.length) throw new TypeError( "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e); return a(e, t, i) }), o.alloc || (o.alloc = function(e, t, i) { if ("number" != typeof e) throw new TypeError( 'The "size" argument must be of type number. Received type ' + typeof e); if (e < 0 || e >= 2 * (1 << 30)) throw new RangeError('The value "' + e + '" is invalid for option "size"'); var r = a(e); return t && 0 !== t.length ? "string" == typeof i ? r.fill(t, i) : r.fill(t) : r.fill(0), r }), !s.kStringMaxLength) try { s.kStringMaxLength = t.binding("buffer").kStringMaxLength } catch (e) {} s.constants || (s.constants = { MAX_LENGTH: s.kMaxLength }, s.kStringMaxLength && (s.constants.MAX_STRING_LENGTH = s.kStringMaxLength)), e.exports = s }).call(this, i(9)) }, function(e, t, i) { "use strict"; var r = i(64).Reporter, n = i(35).EncoderBuffer, a = i(35).DecoderBuffer, s = i(14), o = ["seq", "seqof", "set", "setof", "objid", "bool", "gentime", "utctime", "null_", "enum", "int", "objDesc", "bitstr", "bmpstr", "charstr", "genstr", "graphstr", "ia5str", "iso646str", "numstr", "octstr", "printstr", "t61str", "unistr", "utf8str", "videostr" ], u = ["key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains"].concat( o); function l(e, t, i) { var r = {}; this._baseState = r, r.name = i, r.enc = e, r.parent = t || null, r.children = null, r.tag = null, r .args = null, r.reverseArgs = null, r.choice = null, r.optional = !1, r.any = !1, r.obj = !1, r.use = null, r.useDecoder = null, r.key = null, r.default = null, r.explicit = null, r.implicit = null, r .contains = null, r.parent || (r.children = [], this._wrap()) } e.exports = l; var d = ["enc", "parent", "children", "tag", "args", "reverseArgs", "choice", "optional", "any", "obj", "use", "alteredUse", "key", "default", "explicit", "implicit", "contains" ]; l.prototype.clone = function() { var e = this._baseState, t = {}; d.forEach(function(i) { t[i] = e[i] }); var i = new this.constructor(t.parent); return i._baseState = t, i }, l.prototype._wrap = function() { var e = this._baseState; u.forEach(function(t) { this[t] = function() { var i = new this.constructor(this); return e.children.push(i), i[t].apply(i, arguments) } }, this) }, l.prototype._init = function(e) { var t = this._baseState; s(null === t.parent), e.call(this), t.children = t.children.filter(function(e) { return e._baseState.parent === this }, this), s.equal(t.children.length, 1, "Root node can have only one child") }, l.prototype._useArgs = function(e) { var t = this._baseState, i = e.filter(function(e) { return e instanceof this.constructor }, this); e = e.filter(function(e) { return !(e instanceof this.constructor) }, this), 0 !== i.length && (s(null === t.children), t.children = i, i.forEach(function(e) { e._baseState.parent = this }, this)), 0 !== e.length && (s(null === t.args), t.args = e, t.reverseArgs = e.map(function(e) { if ("object" != typeof e || e.constructor !== Object) return e; var t = {}; return Object.keys(e).forEach(function(i) { i == (0 | i) && (i |= 0); var r = e[i]; t[r] = i }), t })) }, ["_peekTag", "_decodeTag", "_use", "_decodeStr", "_decodeObjid", "_decodeTime", "_decodeNull", "_decodeInt", "_decodeBool", "_decodeList", "_encodeComposite", "_encodeStr", "_encodeObjid", "_encodeTime", "_encodeNull", "_encodeInt", "_encodeBool" ].forEach(function(e) { l.prototype[e] = function() { var t = this._baseState; throw new Error(e + " not implemented for encoding: " + t.enc) } }), o.forEach(function(e) { l.prototype[e] = function() { var t = this._baseState, i = Array.prototype.slice.call(arguments); return s(null === t.tag), t.tag = e, this._useArgs(i), this } }), l.prototype.use = function(e) { s(e); var t = this._baseState; return s(null === t.use), t.use = e, this }, l.prototype.optional = function() { return this._baseState.optional = !0, this }, l.prototype.def = function(e) { var t = this._baseState; return s(null === t.default), t.default = e, t.optional = !0, this }, l.prototype.explicit = function(e) { var t = this._baseState; return s(null === t.explicit && null === t.implicit), t.explicit = e, this }, l.prototype.implicit = function(e) { var t = this._baseState; return s(null === t.explicit && null === t.implicit), t.implicit = e, this }, l.prototype.obj = function() { var e = this._baseState, t = Array.prototype.slice.call(arguments); return e.obj = !0, 0 !== t.length && this._useArgs(t), this }, l.prototype.key = function(e) { var t = this._baseState; return s(null === t.key), t.key = e, this }, l.prototype.any = function() { return this._baseState.any = !0, this }, l.prototype.choice = function(e) { var t = this._baseState; return s(null === t.choice), t.choice = e, this._useArgs(Object.keys(e).map(function(t) { return e[t] })), this }, l.prototype.contains = function(e) { var t = this._baseState; return s(null === t.use), t.contains = e, this }, l.prototype._decode = function(e, t) { var i = this._baseState; if (null === i.parent) return e.wrapResult(i.children[0]._decode(e, t)); var r, n = i.default, s = !0, o = null; if (null !== i.key && (o = e.enterKey(i.key)), i.optional) { var u = null; if (null !== i.explicit ? u = i.explicit : null !== i.implicit ? u = i.implicit : null !== i.tag && ( u = i.tag), null !== u || i.any) { if (s = this._peekTag(e, u, i.any), e.isError(s)) return s } else { var l = e.save(); try { null === i.choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t), s = !0 } catch (e) { s = !1 } e.restore(l) } } if (i.obj && s && (r = e.enterObject()), s) { if (null !== i.explicit) { var d = this._decodeTag(e, i.explicit); if (e.isError(d)) return d; e = d } var c = e.offset; if (null === i.use && null === i.choice) { var h; i.any && (h = e.save()); var f = this._decodeTag(e, null !== i.implicit ? i.implicit : i.tag, i.any); if (e.isError(f)) return f; i.any ? n = e.raw(h) : e = f } if (t && t.track && null !== i.tag && t.track(e.path(), c, e.length, "tagged"), t && t.track && null !== i.tag && t.track(e.path(), e.offset, e.length, "content"), i.any || (n = null === i .choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t)), e.isError(n)) return n; if (i.any || null !== i.choice || null === i.children || i.children.forEach(function(i) { i._decode(e, t) }), i.contains && ("octstr" === i.tag || "bitstr" === i.tag)) { var p = new a(n); n = this._getUse(i.contains, e._reporterState.obj)._decode(p, t) } } return i.obj && s && (n = e.leaveObject(r)), null === i.key || null === n && !0 !== s ? null !== o && e .exitKey(o) : e.leaveKey(o, i.key, n), n }, l.prototype._decodeGeneric = function(e, t, i) { var r = this._baseState; return "seq" === e || "set" === e ? null : "seqof" === e || "setof" === e ? this._decodeList(t, e, r .args[0], i) : /str$/.test(e) ? this._decodeStr(t, e, i) : "objid" === e && r.args ? this ._decodeObjid(t, r.args[0], r.args[1], i) : "objid" === e ? this._decodeObjid(t, null, null, i) : "gentime" === e || "utctime" === e ? this._decodeTime(t, e, i) : "null_" === e ? this._decodeNull(t, i) : "bool" === e ? this._decodeBool(t, i) : "objDesc" === e ? this._decodeStr(t, e, i) : "int" === e || "enum" === e ? this._decodeInt(t, r.args && r.args[0], i) : null !== r.use ? this._getUse(r.use, t._reporterState.obj)._decode(t, i) : t.error("unknown tag: " + e) }, l.prototype._getUse = function(e, t) { var i = this._baseState; return i.useDecoder = this._use(e, t), s(null === i.useDecoder._baseState.parent), i.useDecoder = i .useDecoder._baseState.children[0], i.implicit !== i.useDecoder._baseState.implicit && (i.useDecoder = i.useDecoder.clone(), i.useDecoder._baseState.implicit = i.implicit), i.useDecoder }, l.prototype._decodeChoice = function(e, t) { var i = this._baseState, r = null, n = !1; return Object.keys(i.choice).some(function(a) { var s = e.save(), o = i.choice[a]; try { var u = o._decode(e, t); if (e.isError(u)) return !1; r = { type: a, value: u }, n = !0 } catch (t) { return e.restore(s), !1 } return !0 }, this), n ? r : e.error("Choice not matched") }, l.prototype._createEncoderBuffer = function(e) { return new n(e, this.reporter) }, l.prototype._encode = function(e, t, i) { var r = this._baseState; if (null === r.default || r.default !== e) { var n = this._encodeValue(e, t, i); if (void 0 !== n && !this._skipDefault(n, t, i)) return n } }, l.prototype._encodeValue = function(e, t, i) { var n = this._baseState; if (null === n.parent) return n.children[0]._encode(e, t || new r); var a = null; if (this.reporter = t, n.optional && void 0 === e) { if (null === n.default) return; e = n.default } var s = null, o = !1; if (n.any) a = this._createEncoderBuffer(e); else if (n.choice) a = this._encodeChoice(e, t); else if (n.contains) s = this._getUse(n.contains, i)._encode(e, t), o = !0; else if (n.children) s = n.children.map(function(i) { if ("null_" === i._baseState.tag) return i._encode(null, t, e); if (null === i._baseState.key) return t.error("Child should have a key"); var r = t.enterKey(i._baseState.key); if ("object" != typeof e) return t.error("Child expected, but input is not object"); var n = i._encode(e[i._baseState.key], t, e); return t.leaveKey(r), n }, this).filter(function(e) { return e }), s = this._createEncoderBuffer(s); else if ("seqof" === n.tag || "setof" === n.tag) { if (!n.args || 1 !== n.args.length) return t.error("Too many args for : " + n.tag); if (!Array.isArray(e)) return t.error("seqof/setof, but data is not Array"); var u = this.clone(); u._baseState.implicit = null, s = this._createEncoderBuffer(e.map(function(i) { var r = this._baseState; return this._getUse(r.args[0], e)._encode(i, t) }, u)) } else null !== n.use ? a = this._getUse(n.use, i)._encode(e, t) : (s = this._encodePrimitive(n.tag, e), o = !0); if (!n.any && null === n.choice) { var l = null !== n.implicit ? n.implicit : n.tag, d = null === n.implicit ? "universal" : "context"; null === l ? null === n.use && t.error("Tag could be omitted only for .use()") : null === n.use && ( a = this._encodeComposite(l, o, d, s)) } return null !== n.explicit && (a = this._encodeComposite(n.explicit, !1, "context", a)), a }, l.prototype._encodeChoice = function(e, t) { var i = this._baseState, r = i.choice[e.type]; return r || s(!1, e.type + " not found in " + JSON.stringify(Object.keys(i.choice))), r._encode(e.value, t) }, l.prototype._encodePrimitive = function(e, t) { var i = this._baseState; if (/str$/.test(e)) return this._encodeStr(t, e); if ("objid" === e && i.args) return this._encodeObjid(t, i.reverseArgs[0], i.args[1]); if ("objid" === e) return this._encodeObjid(t, null, null); if ("gentime" === e || "utctime" === e) return this._encodeTime(t, e); if ("null_" === e) return this._encodeNull(); if ("int" === e || "enum" === e) return this._encodeInt(t, i.args && i.reverseArgs[0]); if ("bool" === e) return this._encodeBool(t); if ("objDesc" === e) return this._encodeStr(t, e); throw new Error("Unsupported tag: " + e) }, l.prototype._isNumstr = function(e) { return /^[0-9 ]*$/.test(e) }, l.prototype._isPrintstr = function(e) { return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(e) } }, function(e, t, i) { "use strict"; var r = i(5); function n(e) { this._reporterState = { obj: null, path: [], options: e || {}, errors: [] } } function a(e, t) { this.path = e, this.rethrow(t) } t.Reporter = n, n.prototype.isError = function(e) { return e instanceof a }, n.prototype.save = function() { var e = this._reporterState; return { obj: e.obj, pathLen: e.path.length } }, n.prototype.restore = function(e) { var t = this._reporterState; t.obj = e.obj, t.path = t.path.slice(0, e.pathLen) }, n.prototype.enterKey = function(e) { return this._reporterState.path.push(e) }, n.prototype.exitKey = function(e) { var t = this._reporterState; t.path = t.path.slice(0, e - 1) }, n.prototype.leaveKey = function(e, t, i) { var r = this._reporterState; this.exitKey(e), null !== r.obj && (r.obj[t] = i) }, n.prototype.path = function() { return this._reporterState.path.join("/") }, n.prototype.enterObject = function() { var e = this._reporterState, t = e.obj; return e.obj = {}, t }, n.prototype.leaveObject = function(e) { var t = this._reporterState, i = t.obj; return t.obj = e, i }, n.prototype.error = function(e) { var t, i = this._reporterState, r = e instanceof a; if (t = r ? e : new a(i.path.map(function(e) { return "[" + JSON.stringify(e) + "]" }).join(""), e.message || e, e.stack), !i.options.partial) throw t; return r || i.errors.push(t), t }, n.prototype.wrapResult = function(e) { var t = this._reporterState; return t.options.partial ? { result: this.isError(e) ? null : e, errors: t.errors } : e }, r(a, Error), a.prototype.rethrow = function(e) { if (this.message = e + " at: " + (this.path || "(shallow)"), Error.captureStackTrace && Error .captureStackTrace(this, a), !this.stack) try { throw new Error(this.message) } catch (e) { this.stack = e.stack } return this } }, function(e, t, i) { "use strict"; function r(e) { var t = {}; return Object.keys(e).forEach(function(i) { (0 | i) == i && (i |= 0); var r = e[i]; t[r] = i }), t } t.tagClass = { 0: "universal", 1: "application", 2: "context", 3: "private" }, t.tagClassByName = r(t.tagClass), t.tag = { 0: "end", 1: "bool", 2: "int", 3: "bitstr", 4: "octstr", 5: "null_", 6: "objid", 7: "objDesc", 8: "external", 9: "real", 10: "enum", 11: "embed", 12: "utf8str", 13: "relativeOid", 16: "seq", 17: "set", 18: "numstr", 19: "printstr", 20: "t61str", 21: "videostr", 22: "ia5str", 23: "utctime", 24: "gentime", 25: "graphstr", 26: "iso646str", 27: "genstr", 28: "unistr", 29: "charstr", 30: "bmpstr" }, t.tagByName = r(t.tag) }, function(e, t) { var i = {}.toString; e.exports = Array.isArray || function(e) { return "[object Array]" == i.call(e) } }, function(e, t, i) { "use strict"; i.r(t), function(e, r, n, a) { var s, o = i(1), u = !1, l = "", d = void 0 !== d ? d : {}; function c() { var t, o = {}; for (t in d) d.hasOwnProperty(t) && (o[t] = d[t]); var u, c, h, f = [], p = "./this.program", m = function(e, t) { throw t }, g = !1, v = !1; if (g = "object" == typeof window, v = "function" == typeof importScripts, c = "object" == typeof e && "object" == typeof e.versions && "string" == typeof e.versions.node, u = c && !g && !v, h = !g && ! u && !v, d.ENVIRONMENT) throw new Error( "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)" ); var y, _, b, w, E = ""; if (u) E = r + "/", y = function(e, t) { var r; return b || (b = i(69)), w || (w = i(70)), e = w.normalize(e), r = b.readFileSync(e), t ? r : r .toString() }, _ = function(e) { var t = y(e, !0); return t.buffer || (t = new Uint8Array(t)), I(t.buffer), t }, e.argv.length > 1 && (p = e.argv[1].replace(/\\/g, "/")), f = e.argv.slice(2), n.exports = d, e .on("uncaughtException", function(e) { if (!(e instanceof ui)) throw e }), e.on("unhandledRejection", ve), m = function(t) { e.exit(t) }, d.inspect = function() { return "[Emscripten Module object]" }; else if (h) "undefined" != typeof read && (y = function(e) { return read(e) }), _ = function(e) { var t; return "function" == typeof readbuffer ? new Uint8Array(readbuffer(e)) : (I("object" == typeof(t = read(e, "binary"))), t) }, "undefined" != typeof scriptArgs ? f = scriptArgs : void 0 !== arguments && (f = arguments), "function" == typeof quit && (m = function(e) { quit(e) }), "undefined" != typeof print && ("undefined" == typeof console && (console = {}), console.log = print, console.warn = console.error = "undefined" != typeof printErr ? printErr : print); else { if (!g && !v) throw new Error("environment detection error"); v ? E = self.location.href : document.currentScript && (E = document.currentScript.src), E = 0 !== E .indexOf("blob:") ? E.substr(0, E.lastIndexOf("/") + 1) : "", y = function(e) { var t = new XMLHttpRequest; return t.open("GET", e, !1), t.send(null), t.responseText }, v && (_ = function(e) { var t = new XMLHttpRequest; return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t .response) }) } var T = d.print || console.log.bind(console), S = d.printErr || console.warn.bind(console); for (t in o) o.hasOwnProperty(t) && (d[t] = o[t]); function A(e) { A.shown || (A.shown = {}), A.shown[e] || (A.shown[e] = 1, S(e)) } function k(e, t) { var i = C, r = i.length; try { i.grow(1) } catch (e) { if (!e instanceof RangeError) throw e; throw "Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH." } try { i.set(r, e) } catch (a) { if (!a instanceof TypeError) throw a; I(void 0 !== t, "Missing signature argument to addFunction"); var n = function(e, t) { var i = [1, 0, 1, 96], r = t.slice(0, 1), n = t.slice(1), a = { i: 127, j: 126, f: 125, d: 124 }; i.push(n.length); for (var s = 0; s < n.length; ++s) i.push(a[n[s]]); "v" == r ? i.push(0) : i = i.concat([1, a[r]]), i[1] = i.length - 2; var o = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0].concat(i, [2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])), u = new WebAssembly.Module(o); return new WebAssembly.Instance(u, { e: { f: e } }).exports.f }(e, t); i.set(r, n) } return r } o = null, d.arguments && (f = d.arguments), Object.getOwnPropertyDescriptor(d, "arguments") || Object .defineProperty(d, "arguments", { configurable: !0, get: function() { ve("Module.arguments has been replaced with plain arguments_") } }), d.thisProgram && (p = d.thisProgram), Object.getOwnPropertyDescriptor(d, "thisProgram") || Object.defineProperty(d, "thisProgram", { configurable: !0, get: function() { ve("Module.thisProgram has been replaced with plain thisProgram") } }), d.quit && (m = d.quit), Object.getOwnPropertyDescriptor(d, "quit") || Object.defineProperty(d, "quit", { configurable: !0, get: function() { ve("Module.quit has been replaced with plain quit_") } }), I(void 0 === d.memoryInitializerPrefixURL, "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), I( void 0 === d.pthreadMainPrefixURL, "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d .cdInitializerPrefixURL, "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d .filePackagePrefixURL, "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d .read, "Module.read option was removed (modify read_ in JS)"), I(void 0 === d.readAsync, "Module.readAsync option was removed (modify readAsync in JS)"), I(void 0 === d.readBinary, "Module.readBinary option was removed (modify readBinary in JS)"), I(void 0 === d.setWindowTitle, "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"), Object .getOwnPropertyDescriptor(d, "read") || Object.defineProperty(d, "read", { configurable: !0, get: function() { ve("Module.read has been replaced with plain read_") } }), Object.getOwnPropertyDescriptor(d, "readAsync") || Object.defineProperty(d, "readAsync", { configurable: !0, get: function() { ve("Module.readAsync has been replaced with plain readAsync") } }), Object.getOwnPropertyDescriptor(d, "readBinary") || Object.defineProperty(d, "readBinary", { configurable: !0, get: function() { ve("Module.readBinary has been replaced with plain readBinary") } }), ai = oi = si = function() { ve("cannot use the stack before compiled code is ready to run, and has provided stack access") }; var R, M, O = function(e) {}; d.wasmBinary && (R = d.wasmBinary), Object.getOwnPropertyDescriptor(d, "wasmBinary") || Object .defineProperty(d, "wasmBinary", { configurable: !0, get: function() { ve("Module.wasmBinary has been replaced with plain wasmBinary") } }), d.noExitRuntime && (s = d.noExitRuntime), Object.getOwnPropertyDescriptor(d, "noExitRuntime") || Object.defineProperty(d, "noExitRuntime", { configurable: !0, get: function() { ve("Module.noExitRuntime has been replaced with plain noExitRuntime") } }), "object" != typeof WebAssembly && ve( "No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead."); var C = new WebAssembly.Table({ initial: 2542, maximum: 2552, element: "anyfunc" }), D = !1; function I(e, t) { e || ve("Assertion failed: " + t) } function L(e) { var t = d["_" + e]; return I(t, "Cannot call unknown function " + e + ", make sure it is exported"), t } function x(e, t, i, r, n) { var a = { string: function(e) { var t = 0; if (null != e && 0 !== e) { var i = 1 + (e.length << 2); F(e, t = si(i), i) } return t }, array: function(e) { var t = si(e.length); return function(e, t) { I(e.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"), G.set(e, t) }(e, t), t } }, s = L(e), o = [], u = 0; if (I("array" !== t, 'Return type should not be "array".'), r) for (var l = 0; l < r.length; l++) { var d = a[i[l]]; d ? (0 === u && (u = ai()), o[l] = d(r[l])) : o[l] = r[l] } var c = s.apply(null, o); return c = function(e) { return "string" === t ? N(e) : "boolean" === t ? Boolean(e) : e }(c), 0 !== u && oi(u), c } var P = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0; function U(e, t, i) { for (var r = t + i, n = t; e[n] && !(n >= r);) ++n; if (n - t > 16 && e.subarray && P) return P.decode(e.subarray(t, n)); for (var a = ""; t < n;) { var s = e[t++]; if (128 & s) { var o = 63 & e[t++]; if (192 != (224 & s)) { var u = 63 & e[t++]; if (224 == (240 & s) ? s = (15 & s) << 12 | o << 6 | u : (240 != (248 & s) && A( "Invalid UTF-8 leading byte 0x" + s.toString(16) + " encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!" ), s = (7 & s) << 18 | o << 12 | u << 6 | 63 & e[t++]), s < 65536) a += String .fromCharCode(s); else { var l = s - 65536; a += String.fromCharCode(55296 | l >> 10, 56320 | 1023 & l) } } else a += String.fromCharCode((31 & s) << 6 | o) } else a += String.fromCharCode(s) } return a } function N(e, t) { return e ? U(V, e, t) : "" } function B(e, t, i, r) { if (!(r > 0)) return 0; for (var n = i, a = i + r - 1, s = 0; s < e.length; ++s) { var o = e.charCodeAt(s); if (o >= 55296 && o <= 57343 && (o = 65536 + ((1023 & o) << 10) | 1023 & e.charCodeAt(++s)), o <= 127) { if (i >= a) break; t[i++] = o } else if (o <= 2047) { if (i + 1 >= a) break; t[i++] = 192 | o >> 6, t[i++] = 128 | 63 & o } else if (o <= 65535) { if (i + 2 >= a) break; t[i++] = 224 | o >> 12, t[i++] = 128 | o >> 6 & 63, t[i++] = 128 | 63 & o } else { if (i + 3 >= a) break; o >= 2097152 && A("Invalid Unicode code point 0x" + o.toString(16) + " encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)." ), t[i++] = 240 | o >> 18, t[i++] = 128 | o >> 12 & 63, t[i++] = 128 | o >> 6 & 63, t[i++] = 128 | 63 & o } } return t[i] = 0, i - n } function F(e, t, i) { return I("number" == typeof i, "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!" ), B(e, V, t, i) } function j(e) { for (var t = 0, i = 0; i < e.length; ++i) { var r = e.charCodeAt(i); r >= 55296 && r <= 57343 && (r = 65536 + ((1023 & r) << 10) | 1023 & e.charCodeAt(++i)), r <= 127 ? ++t : t += r <= 2047 ? 2 : r <= 65535 ? 3 : 4 } return t } "undefined" != typeof TextDecoder && new TextDecoder("utf-16le"); var H, G, V, W, q, X; function z(e, t) { return e % t > 0 && (e += t - e % t), e } function K(e) { H = e, d.HEAP8 = G = new Int8Array(e), d.HEAP16 = W = new Int16Array(e), d.HEAP32 = q = new Int32Array(e), d.HEAPU8 = V = new Uint8Array(e), d.HEAPU16 = new Uint16Array(e), d.HEAPU32 = X = new Uint32Array(e), d.HEAPF32 = new Float32Array(e), d.HEAPF64 = new Float64Array(e) } var Y = 1341328; I(!0, "stack must start aligned"), I(!0, "heap must start aligned"); var Q = 5242880; d.TOTAL_STACK && I(Q === d.TOTAL_STACK, "the stack size can no longer be determined at runtime"); var J = d.TOTAL_MEMORY || 67108864; function Z() { I(0 == (3 & Y)), X[1 + (Y >> 2)] = 34821223, X[2 + (Y >> 2)] = 2310721022, q[0] = 1668509029 } function $() { var e = X[1 + (Y >> 2)], t = X[2 + (Y >> 2)]; 34821223 == e && 2310721022 == t || ve( "Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x" + t.toString(16) + " " + e.toString(16)), 1668509029 !== q[0] && ve( "Runtime error: The application has corrupted its heap memory area (address zero)!") } function ee(e) { for (; e.length > 0;) { var t = e.shift(); if ("function" != typeof t) { var i = t.func; "number" == typeof i ? void 0 === t.arg ? d.dynCall_v(i) : d.dynCall_vi(i, t.arg) : i(void 0 === t.arg ? null : t.arg) } else t() } } Object.getOwnPropertyDescriptor(d, "TOTAL_MEMORY") || Object.defineProperty(d, "TOTAL_MEMORY", { configurable: !0, get: function() { ve("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY") } }), I(J >= Q, "TOTAL_MEMORY should be larger than TOTAL_STACK, was " + J + "! (TOTAL_STACK=" + Q + ")"), I("undefined" != typeof Int32Array && "undefined" != typeof Float64Array && void 0 !== Int32Array.prototype.subarray && void 0 !== Int32Array.prototype.set, "JS engine does not provide full typed array support"), (M = d.wasmMemory ? d.wasmMemory : new WebAssembly.Memory({ initial: J / 65536 })) && (H = M.buffer), I((J = H.byteLength) % 65536 == 0), K(H), q[335292] = 6584208, function() { var e = new Int16Array(1), t = new Int8Array(e.buffer); if (e[0] = 25459, 115 !== t[0] || 99 !== t[1]) throw "Runtime error: expected the system to be little-endian!" }(); var te = [], ie = [], re = [], ne = [], ae = !1, se = !1; I(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ), I(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ), I(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ), I(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ); var oe = Math.abs, ue = Math.ceil, le = Math.floor, de = Math.min, ce = 0, he = null, fe = null, pe = {}; function me(e) { ce++, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(!pe[e]), pe[e] = 1, null === he && "undefined" != typeof setInterval && (he = setInterval(function() { if (D) return clearInterval(he), void(he = null); var e = !1; for (var t in pe) e || (e = !0, S("still waiting on run dependencies:")), S( "dependency: " + t); e && S("(end of list)") }, 1e4))) : S("warning: run dependency added without ID") } function ge(e) { if (ce--, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(pe[e]), delete pe[e]) : S("warning: run dependency removed without ID"), 0 == ce && (null !== he && (clearInterval(he), he = null), fe)) { var t = fe; fe = null, t() } } function ve(e) { throw d.onAbort && d.onAbort(e), T(e += ""), S(e), D = !0, e = "abort(" + e + ") at " + Ae(), new WebAssembly.RuntimeError(e) } d.preloadedImages = {}, d.preloadedAudios = {}; var ye = "data:application/octet-stream;base64,"; function _e(e) { return String.prototype.startsWith ? e.startsWith(ye) : 0 === e.indexOf(ye) } // var be, we, Ee = l + "bigScreen/monitorWarn/EasyPlayer.wasm"; var be, we, Ee = l + "EasyPlayer.wasm"; function Te() { try { if (R) return new Uint8Array(R); if (_) return _(Ee); throw "both async and sync fetching of the wasm failed" } catch (e) { ve(e) } } function Se(e) { return e.replace(/\b_Z[\w\d_]+/g, function(e) { var t = function(e) { return A("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"), e }(e); return e === t ? e : t + " [" + e + "]" }) } function Ae() { var e = function() { var e = new Error; if (!e.stack) { try { throw new Error(0) } catch (t) { e = t } if (!e.stack) return "(no stack trace available)" } return e.stack.toString() }(); return d.extraStackTrace && (e += "\n" + d.extraStackTrace()), Se(e) } _e(Ee) || (Ee = function(e) { return d.locateFile ? d.locateFile(e, E) : E + e }(Ee)), ie.push({ func: function() { ii() } }); var ke = {}; function Re(e) { return d.___errno_location ? q[d.___errno_location() >> 2] = e : S("failed to set errno from JS"), e } var Me = { splitPath: function(e) { return /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1) }, normalizeArray: function(e, t) { for (var i = 0, r = e.length - 1; r >= 0; r--) { var n = e[r]; "." === n ? e.splice(r, 1) : ".." === n ? (e.splice(r, 1), i++) : i && (e.splice(r, 1), i--) } if (t) for (; i; i--) e.unshift(".."); return e }, normalize: function(e) { var t = "/" === e.charAt(0), i = "/" === e.substr(-1); return (e = Me.normalizeArray(e.split("/").filter(function(e) { return !!e }), !t).join("/")) || t || (e = "."), e && i && (e += "/"), (t ? "/" : "") + e }, dirname: function(e) { var t = Me.splitPath(e), i = t[0], r = t[1]; return i || r ? (r && (r = r.substr(0, r.length - 1)), i + r) : "." }, basename: function(e) { if ("/" === e) return "/"; var t = e.lastIndexOf("/"); return -1 === t ? e : e.substr(t + 1) }, extname: function(e) { return Me.splitPath(e)[3] }, join: function() { var e = Array.prototype.slice.call(arguments, 0); return Me.normalize(e.join("/")) }, join2: function(e, t) { return Me.normalize(e + "/" + t) } }, Oe = { resolve: function() { for (var e = "", t = !1, i = arguments.length - 1; i >= -1 && !t; i--) { var r = i >= 0 ? arguments[i] : xe.cwd(); if ("string" != typeof r) throw new TypeError("Arguments to path.resolve must be strings"); if (!r) return ""; e = r + "/" + e, t = "/" === r.charAt(0) } return (t ? "/" : "") + (e = Me.normalizeArray(e.split("/").filter(function(e) { return !!e }), !t).join("/")) || "." }, relative: function(e, t) { function i(e) { for (var t = 0; t < e.length && "" === e[t]; t++); for (var i = e.length - 1; i >= 0 && "" === e[i]; i--); return t > i ? [] : e.slice(t, i - t + 1) } e = Oe.resolve(e).substr(1), t = Oe.resolve(t).substr(1); for (var r = i(e.split("/")), n = i(t.split("/")), a = Math.min(r.length, n.length), s = a, o = 0; o < a; o++) if (r[o] !== n[o]) { s = o; break } var u = []; for (o = s; o < r.length; o++) u.push(".."); return (u = u.concat(n.slice(s))).join("/") } }, Ce = { ttys: [], init: function() {}, shutdown: function() {}, register: function(e, t) { Ce.ttys[e] = { input: [], output: [], ops: t }, xe.registerDevice(e, Ce.stream_ops) }, stream_ops: { open: function(e) { var t = Ce.ttys[e.node.rdev]; if (!t) throw new xe.ErrnoError(43); e.tty = t, e.seekable = !1 }, close: function(e) { e.tty.ops.flush(e.tty) }, flush: function(e) { e.tty.ops.flush(e.tty) }, read: function(e, t, i, r, n) { if (!e.tty || !e.tty.ops.get_char) throw new xe.ErrnoError(60); for (var a = 0, s = 0; s < r; s++) { var o; try { o = e.tty.ops.get_char(e.tty) } catch (e) { throw new xe.ErrnoError(29) } if (void 0 === o && 0 === a) throw new xe.ErrnoError(6); if (null == o) break; a++, t[i + s] = o } return a && (e.node.timestamp = Date.now()), a }, write: function(e, t, i, r, n) { if (!e.tty || !e.tty.ops.put_char) throw new xe.ErrnoError(60); try { for (var a = 0; a < r; a++) e.tty.ops.put_char(e.tty, t[i + a]) } catch (e) { throw new xe.ErrnoError(29) } return r && (e.node.timestamp = Date.now()), a } }, default_tty_ops: { get_char: function(t) { if (!t.input.length) { var i = null; if (u) { var r = a.alloc ? a.alloc(256) : new a(256), n = 0; try { n = b.readSync(e.stdin.fd, r, 0, 256, null) } catch (e) { if (-1 == e.toString().indexOf("EOF")) throw e; n = 0 } i = n > 0 ? r.slice(0, n).toString("utf-8") : null } else "undefined" != typeof window && "function" == typeof window.prompt ? null !== (i = window.prompt("Input: ")) && (i += "\n") : "function" == typeof readline && null !== ( i = readline()) && (i += "\n"); if (!i) return null; t.input = Be(i, !0) } return t.input.shift() }, put_char: function(e, t) { null === t || 10 === t ? e.output = [] : 0 != t && e.output.push(t) }, flush: function(e) { e.output && e.output.length > 0 && (e.output = []) } }, default_tty1_ops: { put_char: function(e, t) { null === t || 10 === t ? (S(U(e.output, 0)), e.output = []) : 0 != t && e.output.push(t) }, flush: function(e) { e.output && e.output.length > 0 && (S(U(e.output, 0)), e.output = []) } } }, De = { ops_table: null, mount: function(e) { return De.createNode(null, "/", 16895, 0) }, createNode: function(e, t, i, r) { if (xe.isBlkdev(i) || xe.isFIFO(i)) throw new xe.ErrnoError(63); De.ops_table || (De.ops_table = { dir: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr, lookup: De.node_ops.lookup, mknod: De.node_ops.mknod, rename: De.node_ops.rename, unlink: De.node_ops.unlink, rmdir: De.node_ops.rmdir, readdir: De.node_ops.readdir, symlink: De.node_ops.symlink }, stream: { llseek: De.stream_ops.llseek } }, file: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr }, stream: { llseek: De.stream_ops.llseek, read: De.stream_ops.read, write: De.stream_ops.write, allocate: De.stream_ops.allocate, mmap: De.stream_ops.mmap, msync: De.stream_ops.msync } }, link: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr, readlink: De.node_ops.readlink }, stream: {} }, chrdev: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr }, stream: xe.chrdev_stream_ops } }); var n = xe.createNode(e, t, i, r); return xe.isDir(n.mode) ? (n.node_ops = De.ops_table.dir.node, n.stream_ops = De.ops_table.dir .stream, n.contents = {}) : xe.isFile(n.mode) ? (n.node_ops = De.ops_table.file.node, n .stream_ops = De.ops_table.file.stream, n.usedBytes = 0, n.contents = null) : xe.isLink(n .mode) ? (n.node_ops = De.ops_table.link.node, n.stream_ops = De.ops_table.link.stream) : xe.isChrdev(n.mode) && (n.node_ops = De.ops_table.chrdev.node, n.stream_ops = De.ops_table .chrdev.stream), n.timestamp = Date.now(), e && (e.contents[t] = n), n }, getFileDataAsRegularArray: function(e) { if (e.contents && e.contents.subarray) { for (var t = [], i = 0; i < e.usedBytes; ++i) t.push(e.contents[i]); return t } return e.contents }, getFileDataAsTypedArray: function(e) { return e.contents ? e.contents.subarray ? e.contents.subarray(0, e.usedBytes) : new Uint8Array(e.contents) : new Uint8Array }, expandFileStorage: function(e, t) { var i = e.contents ? e.contents.length : 0; if (!(i >= t)) { t = Math.max(t, i * (i < 1048576 ? 2 : 1.125) | 0), 0 != i && (t = Math.max(t, 256)); var r = e.contents; e.contents = new Uint8Array(t), e.usedBytes > 0 && e.contents.set(r.subarray(0, e .usedBytes), 0) } }, resizeFileStorage: function(e, t) { if (e.usedBytes != t) { if (0 == t) return e.contents = null, void(e.usedBytes = 0); if (!e.contents || e.contents.subarray) { var i = e.contents; return e.contents = new Uint8Array(new ArrayBuffer(t)), i && e.contents.set(i.subarray(0, Math.min(t, e.usedBytes))), void(e.usedBytes = t) } if (e.contents || (e.contents = []), e.contents.length > t) e.contents.length = t; else for (; e.contents.length < t;) e.contents.push(0); e.usedBytes = t } }, node_ops: { getattr: function(e) { var t = {}; return t.dev = xe.isChrdev(e.mode) ? e.id : 1, t.ino = e.id, t.mode = e.mode, t.nlink = 1, t .uid = 0, t.gid = 0, t.rdev = e.rdev, xe.isDir(e.mode) ? t.size = 4096 : xe.isFile(e .mode) ? t.size = e.usedBytes : xe.isLink(e.mode) ? t.size = e.link.length : t.size = 0, t .atime = new Date(e.timestamp), t.mtime = new Date(e.timestamp), t.ctime = new Date(e .timestamp), t.blksize = 4096, t.blocks = Math.ceil(t.size / t.blksize), t }, setattr: function(e, t) { void 0 !== t.mode && (e.mode = t.mode), void 0 !== t.timestamp && (e.timestamp = t .timestamp), void 0 !== t.size && De.resizeFileStorage(e, t.size) }, lookup: function(e, t) { throw xe.genericErrors[44] }, mknod: function(e, t, i, r) { return De.createNode(e, t, i, r) }, rename: function(e, t, i) { if (xe.isDir(e.mode)) { var r; try { r = xe.lookupNode(t, i) } catch (e) {} if (r) for (var n in r.contents) throw new xe.ErrnoError(55) } delete e.parent.contents[e.name], e.name = i, t.contents[i] = e, e.parent = t }, unlink: function(e, t) { delete e.contents[t] }, rmdir: function(e, t) { var i = xe.lookupNode(e, t); for (var r in i.contents) throw new xe.ErrnoError(55); delete e.contents[t] }, readdir: function(e) { var t = [".", ".."]; for (var i in e.contents) e.contents.hasOwnProperty(i) && t.push(i); return t }, symlink: function(e, t, i) { var r = De.createNode(e, t, 41471, 0); return r.link = i, r }, readlink: function(e) { if (!xe.isLink(e.mode)) throw new xe.ErrnoError(28); return e.link } }, stream_ops: { read: function(e, t, i, r, n) { var a = e.node.contents; if (n >= e.node.usedBytes) return 0; var s = Math.min(e.node.usedBytes - n, r); if (I(s >= 0), s > 8 && a.subarray) t.set(a.subarray(n, n + s), i); else for (var o = 0; o < s; o++) t[i + o] = a[n + o]; return s }, write: function(e, t, i, r, n, a) { if (a && A( "file packager has copied file data into memory, but in memory growth we are forced to copy it again (see --no-heap-copy)" ), a = !1, !r) return 0; var s = e.node; if (s.timestamp = Date.now(), t.subarray && (!s.contents || s.contents.subarray)) { if (a) return I(0 === n, "canOwn must imply no weird position inside the file"), s .contents = t.subarray(i, i + r), s.usedBytes = r, r; if (0 === s.usedBytes && 0 === n) return s.contents = new Uint8Array(t.subarray(i, i + r)), s.usedBytes = r, r; if (n + r <= s.usedBytes) return s.contents.set(t.subarray(i, i + r), n), r } if (De.expandFileStorage(s, n + r), s.contents.subarray && t.subarray) s.contents.set(t .subarray(i, i + r), n); else for (var o = 0; o < r; o++) s.contents[n + o] = t[i + o]; return s.usedBytes = Math.max(s.usedBytes, n + r), r }, llseek: function(e, t, i) { var r = t; if (1 === i ? r += e.position : 2 === i && xe.isFile(e.node.mode) && (r += e.node .usedBytes), r < 0) throw new xe.ErrnoError(28); return r }, allocate: function(e, t, i) { De.expandFileStorage(e.node, t + i), e.node.usedBytes = Math.max(e.node.usedBytes, t + i) }, mmap: function(e, t, i, r, n, a, s) { if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43); var o, u, l = e.node.contents; if (2 & s || l.buffer !== t && l.buffer !== t.buffer) { (n > 0 || n + r < e.node.usedBytes) && (l = l.subarray ? l.subarray(n, n + r) : Array .prototype.slice.call(l, n, n + r)), u = !0; var d = t.buffer == G.buffer; if (!(o = ri(r))) throw new xe.ErrnoError(48); (d ? G : t).set(l, o) } else u = !1, o = l.byteOffset; return { ptr: o, allocated: u } }, msync: function(e, t, i, r, n) { if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43); return 2 & n ? 0 : (De.stream_ops.write(e, t, 0, r, i, !1), 0) } } }, Ie = { 0: "Success", 1: "Arg list too long", 2: "Permission denied", 3: "Address already in use", 4: "Address not available", 5: "Address family not supported by protocol family", 6: "No more processes", 7: "Socket already connected", 8: "Bad file number", 9: "Trying to read unreadable message", 10: "Mount device busy", 11: "Operation canceled", 12: "No children", 13: "Connection aborted", 14: "Connection refused", 15: "Connection reset by peer", 16: "File locking deadlock error", 17: "Destination address required", 18: "Math arg out of domain of func", 19: "Quota exceeded", 20: "File exists", 21: "Bad address", 22: "File too large", 23: "Host is unreachable", 24: "Identifier removed", 25: "Illegal byte sequence", 26: "Connection already in progress", 27: "Interrupted system call", 28: "Invalid argument", 29: "I/O error", 30: "Socket is already connected", 31: "Is a directory", 32: "Too many symbolic links", 33: "Too many open files", 34: "Too many links", 35: "Message too long", 36: "Multihop attempted", 37: "File or path name too long", 38: "Network interface is not configured", 39: "Connection reset by network", 40: "Network is unreachable", 41: "Too many open files in system", 42: "No buffer space available", 43: "No such device", 44: "No such file or directory", 45: "Exec format error", 46: "No record locks available", 47: "The link has been severed", 48: "Not enough core", 49: "No message of desired type", 50: "Protocol not available", 51: "No space left on device", 52: "Function not implemented", 53: "Socket is not connected", 54: "Not a directory", 55: "Directory not empty", 56: "State not recoverable", 57: "Socket operation on non-socket", 59: "Not a typewriter", 60: "No such device or address", 61: "Value too large for defined data type", 62: "Previous owner died", 63: "Not super-user", 64: "Broken pipe", 65: "Protocol error", 66: "Unknown protocol", 67: "Protocol wrong type for socket", 68: "Math result not representable", 69: "Read only file system", 70: "Illegal seek", 71: "No such process", 72: "Stale file handle", 73: "Connection timed out", 74: "Text file busy", 75: "Cross-device link", 100: "Device not a stream", 101: "Bad font file fmt", 102: "Invalid slot", 103: "Invalid request code", 104: "No anode", 105: "Block device required", 106: "Channel number out of range", 107: "Level 3 halted", 108: "Level 3 reset", 109: "Link number out of range", 110: "Protocol driver not attached", 111: "No CSI structure available", 112: "Level 2 halted", 113: "Invalid exchange", 114: "Invalid request descriptor", 115: "Exchange full", 116: "No data (for no delay io)", 117: "Timer expired", 118: "Out of streams resources", 119: "Machine is not on the network", 120: "Package not installed", 121: "The object is remote", 122: "Advertise error", 123: "Srmount error", 124: "Communication error on send", 125: "Cross mount point (not really error)", 126: "Given log. name not unique", 127: "f.d. invalid for this operation", 128: "Remote address changed", 129: "Can access a needed shared lib", 130: "Accessing a corrupted shared lib", 131: ".lib section in a.out corrupted", 132: "Attempting to link in too many libs", 133: "Attempting to exec a shared library", 135: "Streams pipe error", 136: "Too many users", 137: "Socket type not supported", 138: "Not supported", 139: "Protocol family not supported", 140: "Can't send after socket shutdown", 141: "Too many references", 142: "Host is down", 148: "No medium (in tape drive)", 156: "Level 2 not synchronized" }, Le = { EPERM: 63, ENOENT: 44, ESRCH: 71, EINTR: 27, EIO: 29, ENXIO: 60, E2BIG: 1, ENOEXEC: 45, EBADF: 8, ECHILD: 12, EAGAIN: 6, EWOULDBLOCK: 6, ENOMEM: 48, EACCES: 2, EFAULT: 21, ENOTBLK: 105, EBUSY: 10, EEXIST: 20, EXDEV: 75, ENODEV: 43, ENOTDIR: 54, EISDIR: 31, EINVAL: 28, ENFILE: 41, EMFILE: 33, ENOTTY: 59, ETXTBSY: 74, EFBIG: 22, ENOSPC: 51, ESPIPE: 70, EROFS: 69, EMLINK: 34, EPIPE: 64, EDOM: 18, ERANGE: 68, ENOMSG: 49, EIDRM: 24, ECHRNG: 106, EL2NSYNC: 156, EL3HLT: 107, EL3RST: 108, ELNRNG: 109, EUNATCH: 110, ENOCSI: 111, EL2HLT: 112, EDEADLK: 16, ENOLCK: 46, EBADE: 113, EBADR: 114, EXFULL: 115, ENOANO: 104, EBADRQC: 103, EBADSLT: 102, EDEADLOCK: 16, EBFONT: 101, ENOSTR: 100, ENODATA: 116, ETIME: 117, ENOSR: 118, ENONET: 119, ENOPKG: 120, EREMOTE: 121, ENOLINK: 47, EADV: 122, ESRMNT: 123, ECOMM: 124, EPROTO: 65, EMULTIHOP: 36, EDOTDOT: 125, EBADMSG: 9, ENOTUNIQ: 126, EBADFD: 127, EREMCHG: 128, ELIBACC: 129, ELIBBAD: 130, ELIBSCN: 131, ELIBMAX: 132, ELIBEXEC: 133, ENOSYS: 52, ENOTEMPTY: 55, ENAMETOOLONG: 37, ELOOP: 32, EOPNOTSUPP: 138, EPFNOSUPPORT: 139, ECONNRESET: 15, ENOBUFS: 42, EAFNOSUPPORT: 5, EPROTOTYPE: 67, ENOTSOCK: 57, ENOPROTOOPT: 50, ESHUTDOWN: 140, ECONNREFUSED: 14, EADDRINUSE: 3, ECONNABORTED: 13, ENETUNREACH: 40, ENETDOWN: 38, ETIMEDOUT: 73, EHOSTDOWN: 142, EHOSTUNREACH: 23, EINPROGRESS: 26, EALREADY: 7, EDESTADDRREQ: 17, EMSGSIZE: 35, EPROTONOSUPPORT: 66, ESOCKTNOSUPPORT: 137, EADDRNOTAVAIL: 4, ENETRESET: 39, EISCONN: 30, ENOTCONN: 53, ETOOMANYREFS: 141, EUSERS: 136, EDQUOT: 19, ESTALE: 72, ENOTSUP: 138, ENOMEDIUM: 148, EILSEQ: 25, EOVERFLOW: 61, ECANCELED: 11, ENOTRECOVERABLE: 56, EOWNERDEAD: 62, ESTRPIPE: 135 }, xe = { root: null, mounts: [], devices: {}, streams: [], nextInode: 1, nameTable: null, currentPath: "/", initialized: !1, ignorePermissions: !0, trackingDelegate: {}, tracking: { openFlags: { READ: 1, WRITE: 2 } }, ErrnoError: null, genericErrors: {}, filesystems: null, syncFSRequests: 0, handleFSError: function(e) { if (!(e instanceof xe.ErrnoError)) throw e + " : " + Ae(); return Re(e.errno) }, lookupPath: function(e, t) { if (t = t || {}, !(e = Oe.resolve(xe.cwd(), e))) return { path: "", node: null }; var i = { follow_mount: !0, recurse_count: 0 }; for (var r in i) void 0 === t[r] && (t[r] = i[r]); if (t.recurse_count > 8) throw new xe.ErrnoError(32); for (var n = Me.normalizeArray(e.split("/").filter(function(e) { return !!e }), !1), a = xe.root, s = "/", o = 0; o < n.length; o++) { var u = o === n.length - 1; if (u && t.parent) break; if (a = xe.lookupNode(a, n[o]), s = Me.join2(s, n[o]), xe.isMountpoint(a) && (!u || u && t .follow_mount) && (a = a.mounted.root), !u || t.follow) for (var l = 0; xe.isLink(a.mode);) { var d = xe.readlink(s); if (s = Oe.resolve(Me.dirname(s), d), a = xe.lookupPath(s, { recurse_count: t.recurse_count }).node, l++ > 40) throw new xe.ErrnoError(32) } } return { path: s, node: a } }, getPath: function(e) { for (var t;;) { if (xe.isRoot(e)) { var i = e.mount.mountpoint; return t ? "/" !== i[i.length - 1] ? i + "/" + t : i + t : i } t = t ? e.name + "/" + t : e.name, e = e.parent } }, hashName: function(e, t) { for (var i = 0, r = 0; r < t.length; r++) i = (i << 5) - i + t.charCodeAt(r) | 0; return (e + i >>> 0) % xe.nameTable.length }, hashAddNode: function(e) { var t = xe.hashName(e.parent.id, e.name); e.name_next = xe.nameTable[t], xe.nameTable[t] = e }, hashRemoveNode: function(e) { var t = xe.hashName(e.parent.id, e.name); if (xe.nameTable[t] === e) xe.nameTable[t] = e.name_next; else for (var i = xe.nameTable[t]; i;) { if (i.name_next === e) { i.name_next = e.name_next; break } i = i.name_next } }, lookupNode: function(e, t) { var i = xe.mayLookup(e); if (i) throw new xe.ErrnoError(i, e); for (var r = xe.hashName(e.id, t), n = xe.nameTable[r]; n; n = n.name_next) { var a = n.name; if (n.parent.id === e.id && a === t) return n } return xe.lookup(e, t) }, createNode: function(e, t, i, r) { xe.FSNode || (xe.FSNode = function(e, t, i, r) { e || (e = this), this.parent = e, this.mount = e.mount, this.mounted = null, this.id = xe.nextInode++, this.name = t, this.mode = i, this.node_ops = {}, this .stream_ops = {}, this.rdev = r }, xe.FSNode.prototype = {}, Object.defineProperties(xe.FSNode.prototype, { read: { get: function() { return 365 == (365 & this.mode) }, set: function(e) { e ? this.mode |= 365 : this.mode &= -366 } }, write: { get: function() { return 146 == (146 & this.mode) }, set: function(e) { e ? this.mode |= 146 : this.mode &= -147 } }, isFolder: { get: function() { return xe.isDir(this.mode) } }, isDevice: { get: function() { return xe.isChrdev(this.mode) } } })); var n = new xe.FSNode(e, t, i, r); return xe.hashAddNode(n), n }, destroyNode: function(e) { xe.hashRemoveNode(e) }, isRoot: function(e) { return e === e.parent }, isMountpoint: function(e) { return !!e.mounted }, isFile: function(e) { return 32768 == (61440 & e) }, isDir: function(e) { return 16384 == (61440 & e) }, isLink: function(e) { return 40960 == (61440 & e) }, isChrdev: function(e) { return 8192 == (61440 & e) }, isBlkdev: function(e) { return 24576 == (61440 & e) }, isFIFO: function(e) { return 4096 == (61440 & e) }, isSocket: function(e) { return 49152 == (49152 & e) }, flagModes: { r: 0, rs: 1052672, "r+": 2, w: 577, wx: 705, xw: 705, "w+": 578, "wx+": 706, "xw+": 706, a: 1089, ax: 1217, xa: 1217, "a+": 1090, "ax+": 1218, "xa+": 1218 }, modeStringToFlags: function(e) { var t = xe.flagModes[e]; if (void 0 === t) throw new Error("Unknown file open mode: " + e); return t }, flagsToPermissionString: function(e) { var t = ["r", "w", "rw"][3 & e]; return 512 & e && (t += "w"), t }, nodePermissions: function(e, t) { return xe.ignorePermissions || (-1 === t.indexOf("r") || 292 & e.mode) && (-1 === t.indexOf( "w") || 146 & e.mode) && (-1 === t.indexOf("x") || 73 & e.mode) ? 0 : 2 }, mayLookup: function(e) { return xe.nodePermissions(e, "x") || (e.node_ops.lookup ? 0 : 2) }, mayCreate: function(e, t) { try { return xe.lookupNode(e, t), 20 } catch (e) {} return xe.nodePermissions(e, "wx") }, mayDelete: function(e, t, i) { var r; try { r = xe.lookupNode(e, t) } catch (e) { return e.errno } var n = xe.nodePermissions(e, "wx"); if (n) return n; if (i) { if (!xe.isDir(r.mode)) return 54; if (xe.isRoot(r) || xe.getPath(r) === xe.cwd()) return 10 } else if (xe.isDir(r.mode)) return 31; return 0 }, mayOpen: function(e, t) { return e ? xe.isLink(e.mode) ? 32 : xe.isDir(e.mode) && ("r" !== xe.flagsToPermissionString( t) || 512 & t) ? 31 : xe.nodePermissions(e, xe.flagsToPermissionString(t)) : 44 }, MAX_OPEN_FDS: 4096, nextfd: function(e, t) { e = e || 0, t = t || xe.MAX_OPEN_FDS; for (var i = e; i <= t; i++) if (!xe.streams[i]) return i; throw new xe.ErrnoError(33) }, getStream: function(e) { return xe.streams[e] }, createStream: function(e, t, i) { xe.FSStream || (xe.FSStream = function() {}, xe.FSStream.prototype = {}, Object .defineProperties(xe.FSStream.prototype, { object: { get: function() { return this.node }, set: function(e) { this.node = e } }, isRead: { get: function() { return 1 != (2097155 & this.flags) } }, isWrite: { get: function() { return 0 != (2097155 & this.flags) } }, isAppend: { get: function() { return 1024 & this.flags } } })); var r = new xe.FSStream; for (var n in e) r[n] = e[n]; e = r; var a = xe.nextfd(t, i); return e.fd = a, xe.streams[a] = e, e }, closeStream: function(e) { xe.streams[e] = null }, chrdev_stream_ops: { open: function(e) { var t = xe.getDevice(e.node.rdev); e.stream_ops = t.stream_ops, e.stream_ops.open && e.stream_ops.open(e) }, llseek: function() { throw new xe.ErrnoError(70) } }, major: function(e) { return e >> 8 }, minor: function(e) { return 255 & e }, makedev: function(e, t) { return e << 8 | t }, registerDevice: function(e, t) { xe.devices[e] = { stream_ops: t } }, getDevice: function(e) { return xe.devices[e] }, getMounts: function(e) { for (var t = [], i = [e]; i.length;) { var r = i.pop(); t.push(r), i.push.apply(i, r.mounts) } return t }, syncfs: function(e, t) { "function" == typeof e && (t = e, e = !1), xe.syncFSRequests++, xe.syncFSRequests > 1 && console.log("warning: " + xe.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); var i = xe.getMounts(xe.root.mount), r = 0; function n(e) { return I(xe.syncFSRequests > 0), xe.syncFSRequests--, t(e) } function a(e) { if (e) return a.errored ? void 0 : (a.errored = !0, n(e)); ++r >= i.length && n(null) } i.forEach(function(t) { if (!t.type.syncfs) return a(null); t.type.syncfs(t, e, a) }) }, mount: function(e, t, i) { if ("string" == typeof e) throw e; var r, n = "/" === i, a = !i; if (n && xe.root) throw new xe.ErrnoError(10); if (!n && !a) { var s = xe.lookupPath(i, { follow_mount: !1 }); if (i = s.path, r = s.node, xe.isMountpoint(r)) throw new xe.ErrnoError(10); if (!xe.isDir(r.mode)) throw new xe.ErrnoError(54) } var o = { type: e, opts: t, mountpoint: i, mounts: [] }, u = e.mount(o); return u.mount = o, o.root = u, n ? xe.root = u : r && (r.mounted = o, r.mount && r.mount .mounts.push(o)), u }, unmount: function(e) { var t = xe.lookupPath(e, { follow_mount: !1 }); if (!xe.isMountpoint(t.node)) throw new xe.ErrnoError(28); var i = t.node, r = i.mounted, n = xe.getMounts(r); Object.keys(xe.nameTable).forEach(function(e) { for (var t = xe.nameTable[e]; t;) { var i = t.name_next; - 1 !== n.indexOf(t.mount) && xe.destroyNode(t), t = i } }), i.mounted = null; var a = i.mount.mounts.indexOf(r); I(-1 !== a), i.mount.mounts.splice(a, 1) }, lookup: function(e, t) { return e.node_ops.lookup(e, t) }, mknod: function(e, t, i) { var r = xe.lookupPath(e, { parent: !0 }).node, n = Me.basename(e); if (!n || "." === n || ".." === n) throw new xe.ErrnoError(28); var a = xe.mayCreate(r, n); if (a) throw new xe.ErrnoError(a); if (!r.node_ops.mknod) throw new xe.ErrnoError(63); return r.node_ops.mknod(r, n, t, i) }, create: function(e, t) { return t = void 0 !== t ? t : 438, t &= 4095, t |= 32768, xe.mknod(e, t, 0) }, mkdir: function(e, t) { return t = void 0 !== t ? t : 511, t &= 1023, t |= 16384, xe.mknod(e, t, 0) }, mkdirTree: function(e, t) { for (var i = e.split("/"), r = "", n = 0; n < i.length; ++n) if (i[n]) { r += "/" + i[n]; try { xe.mkdir(r, t) } catch (e) { if (20 != e.errno) throw e } } }, mkdev: function(e, t, i) { return void 0 === i && (i = t, t = 438), t |= 8192, xe.mknod(e, t, i) }, symlink: function(e, t) { if (!Oe.resolve(e)) throw new xe.ErrnoError(44); var i = xe.lookupPath(t, { parent: !0 }).node; if (!i) throw new xe.ErrnoError(44); var r = Me.basename(t), n = xe.mayCreate(i, r); if (n) throw new xe.ErrnoError(n); if (!i.node_ops.symlink) throw new xe.ErrnoError(63); return i.node_ops.symlink(i, r, e) }, rename: function(e, t) { var i, r, n = Me.dirname(e), a = Me.dirname(t), s = Me.basename(e), o = Me.basename(t); try { i = xe.lookupPath(e, { parent: !0 }).node, r = xe.lookupPath(t, { parent: !0 }).node } catch (e) { throw new xe.ErrnoError(10) } if (!i || !r) throw new xe.ErrnoError(44); if (i.mount !== r.mount) throw new xe.ErrnoError(75); var u, l = xe.lookupNode(i, s), d = Oe.relative(e, a); if ("." !== d.charAt(0)) throw new xe.ErrnoError(28); if ("." !== (d = Oe.relative(t, n)).charAt(0)) throw new xe.ErrnoError(55); try { u = xe.lookupNode(r, o) } catch (e) {} if (l !== u) { var c = xe.isDir(l.mode), h = xe.mayDelete(i, s, c); if (h) throw new xe.ErrnoError(h); if (h = u ? xe.mayDelete(r, o, c) : xe.mayCreate(r, o)) throw new xe.ErrnoError(h); if (!i.node_ops.rename) throw new xe.ErrnoError(63); if (xe.isMountpoint(l) || u && xe.isMountpoint(u)) throw new xe.ErrnoError(10); if (r !== i && (h = xe.nodePermissions(i, "w"))) throw new xe.ErrnoError(h); try { xe.trackingDelegate.willMovePath && xe.trackingDelegate.willMovePath(e, t) } catch (i) { console.log("FS.trackingDelegate['willMovePath']('" + e + "', '" + t + "') threw an exception: " + i.message) } xe.hashRemoveNode(l); try { i.node_ops.rename(l, r, o) } catch (e) { throw e } finally { xe.hashAddNode(l) } try { xe.trackingDelegate.onMovePath && xe.trackingDelegate.onMovePath(e, t) } catch (i) { console.log("FS.trackingDelegate['onMovePath']('" + e + "', '" + t + "') threw an exception: " + i.message) } } }, rmdir: function(e) { var t = xe.lookupPath(e, { parent: !0 }).node, i = Me.basename(e), r = xe.lookupNode(t, i), n = xe.mayDelete(t, i, !0); if (n) throw new xe.ErrnoError(n); if (!t.node_ops.rmdir) throw new xe.ErrnoError(63); if (xe.isMountpoint(r)) throw new xe.ErrnoError(10); try { xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t .message) } t.node_ops.rmdir(t, i), xe.destroyNode(r); try { xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t .message) } }, readdir: function(e) { var t = xe.lookupPath(e, { follow: !0 }).node; if (!t.node_ops.readdir) throw new xe.ErrnoError(54); return t.node_ops.readdir(t) }, unlink: function(e) { var t = xe.lookupPath(e, { parent: !0 }).node, i = Me.basename(e), r = xe.lookupNode(t, i), n = xe.mayDelete(t, i, !1); if (n) throw new xe.ErrnoError(n); if (!t.node_ops.unlink) throw new xe.ErrnoError(63); if (xe.isMountpoint(r)) throw new xe.ErrnoError(10); try { xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t .message) } t.node_ops.unlink(t, i), xe.destroyNode(r); try { xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t .message) } }, readlink: function(e) { var t = xe.lookupPath(e).node; if (!t) throw new xe.ErrnoError(44); if (!t.node_ops.readlink) throw new xe.ErrnoError(28); return Oe.resolve(xe.getPath(t.parent), t.node_ops.readlink(t)) }, stat: function(e, t) { var i = xe.lookupPath(e, { follow: !t }).node; if (!i) throw new xe.ErrnoError(44); if (!i.node_ops.getattr) throw new xe.ErrnoError(63); return i.node_ops.getattr(i) }, lstat: function(e) { return xe.stat(e, !0) }, chmod: function(e, t, i) { var r; if (!(r = "string" == typeof e ? xe.lookupPath(e, { follow: !i }).node : e).node_ops.setattr) throw new xe.ErrnoError(63); r.node_ops.setattr(r, { mode: 4095 & t | -4096 & r.mode, timestamp: Date.now() }) }, lchmod: function(e, t) { xe.chmod(e, t, !0) }, fchmod: function(e, t) { var i = xe.getStream(e); if (!i) throw new xe.ErrnoError(8); xe.chmod(i.node, t) }, chown: function(e, t, i, r) { var n; if (!(n = "string" == typeof e ? xe.lookupPath(e, { follow: !r }).node : e).node_ops.setattr) throw new xe.ErrnoError(63); n.node_ops.setattr(n, { timestamp: Date.now() }) }, lchown: function(e, t, i) { xe.chown(e, t, i, !0) }, fchown: function(e, t, i) { var r = xe.getStream(e); if (!r) throw new xe.ErrnoError(8); xe.chown(r.node, t, i) }, truncate: function(e, t) { if (t < 0) throw new xe.ErrnoError(28); var i; if (!(i = "string" == typeof e ? xe.lookupPath(e, { follow: !0 }).node : e).node_ops.setattr) throw new xe.ErrnoError(63); if (xe.isDir(i.mode)) throw new xe.ErrnoError(31); if (!xe.isFile(i.mode)) throw new xe.ErrnoError(28); var r = xe.nodePermissions(i, "w"); if (r) throw new xe.ErrnoError(r); i.node_ops.setattr(i, { size: t, timestamp: Date.now() }) }, ftruncate: function(e, t) { var i = xe.getStream(e); if (!i) throw new xe.ErrnoError(8); if (0 == (2097155 & i.flags)) throw new xe.ErrnoError(28); xe.truncate(i.node, t) }, utime: function(e, t, i) { var r = xe.lookupPath(e, { follow: !0 }).node; r.node_ops.setattr(r, { timestamp: Math.max(t, i) }) }, open: function(e, t, i, r, n) { if ("" === e) throw new xe.ErrnoError(44); var a; if (i = void 0 === i ? 438 : i, i = 64 & (t = "string" == typeof t ? xe.modeStringToFlags(t) : t) ? 4095 & i | 32768 : 0, "object" == typeof e) a = e; else { e = Me.normalize(e); try { a = xe.lookupPath(e, { follow: !(131072 & t) }).node } catch (e) {} } var s = !1; if (64 & t) if (a) { if (128 & t) throw new xe.ErrnoError(20) } else a = xe.mknod(e, i, 0), s = !0; if (!a) throw new xe.ErrnoError(44); if (xe.isChrdev(a.mode) && (t &= -513), 65536 & t && !xe.isDir(a.mode)) throw new xe .ErrnoError(54); if (!s) { var o = xe.mayOpen(a, t); if (o) throw new xe.ErrnoError(o) } 512 & t && xe.truncate(a, 0), t &= -641; var u = xe.createStream({ node: a, path: xe.getPath(a), flags: t, seekable: !0, position: 0, stream_ops: a.stream_ops, ungotten: [], error: !1 }, r, n); u.stream_ops.open && u.stream_ops.open(u), !d.logReadFiles || 1 & t || (xe.readFiles || (xe .readFiles = {}), e in xe.readFiles || (xe.readFiles[e] = 1, console.log( "FS.trackingDelegate error on read file: " + e))); try { if (xe.trackingDelegate.onOpenFile) { var l = 0; 1 != (2097155 & t) && (l |= xe.tracking.openFlags.READ), 0 != (2097155 & t) && (l |= xe .tracking.openFlags.WRITE), xe.trackingDelegate.onOpenFile(e, l) } } catch (t) { console.log("FS.trackingDelegate['onOpenFile']('" + e + "', flags) threw an exception: " + t .message) } return u }, close: function(e) { if (xe.isClosed(e)) throw new xe.ErrnoError(8); e.getdents && (e.getdents = null); try { e.stream_ops.close && e.stream_ops.close(e) } catch (e) { throw e } finally { xe.closeStream(e.fd) } e.fd = null }, isClosed: function(e) { return null === e.fd }, llseek: function(e, t, i) { if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (!e.seekable || !e.stream_ops.llseek) throw new xe.ErrnoError(70); if (0 != i && 1 != i && 2 != i) throw new xe.ErrnoError(28); return e.position = e.stream_ops.llseek(e, t, i), e.ungotten = [], e.position }, read: function(e, t, i, r, n) { if (r < 0 || n < 0) throw new xe.ErrnoError(28); if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(8); if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31); if (!e.stream_ops.read) throw new xe.ErrnoError(28); var a = void 0 !== n; if (a) { if (!e.seekable) throw new xe.ErrnoError(70) } else n = e.position; var s = e.stream_ops.read(e, t, i, r, n); return a || (e.position += s), s }, write: function(e, t, i, r, n, a) { if (r < 0 || n < 0) throw new xe.ErrnoError(28); if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8); if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31); if (!e.stream_ops.write) throw new xe.ErrnoError(28); 1024 & e.flags && xe.llseek(e, 0, 2); var s = void 0 !== n; if (s) { if (!e.seekable) throw new xe.ErrnoError(70) } else n = e.position; var o = e.stream_ops.write(e, t, i, r, n, a); s || (e.position += o); try { e.path && xe.trackingDelegate.onWriteToFile && xe.trackingDelegate.onWriteToFile(e.path) } catch (t) { console.log("FS.trackingDelegate['onWriteToFile']('" + e.path + "') threw an exception: " + t.message) } return o }, allocate: function(e, t, i) { if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (t < 0 || i <= 0) throw new xe.ErrnoError(28); if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8); if (!xe.isFile(e.node.mode) && !xe.isDir(e.node.mode)) throw new xe.ErrnoError(43); if (!e.stream_ops.allocate) throw new xe.ErrnoError(138); e.stream_ops.allocate(e, t, i) }, mmap: function(e, t, i, r, n, a, s) { if (0 != (2 & a) && 0 == (2 & s) && 2 != (2097155 & e.flags)) throw new xe.ErrnoError(2); if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(2); if (!e.stream_ops.mmap) throw new xe.ErrnoError(43); return e.stream_ops.mmap(e, t, i, r, n, a, s) }, msync: function(e, t, i, r, n) { return e && e.stream_ops.msync ? e.stream_ops.msync(e, t, i, r, n) : 0 }, munmap: function(e) { return 0 }, ioctl: function(e, t, i) { if (!e.stream_ops.ioctl) throw new xe.ErrnoError(59); return e.stream_ops.ioctl(e, t, i) }, readFile: function(e, t) { if ((t = t || {}).flags = t.flags || "r", t.encoding = t.encoding || "binary", "utf8" !== t .encoding && "binary" !== t.encoding) throw new Error('Invalid encoding type "' + t .encoding + '"'); var i, r = xe.open(e, t.flags), n = xe.stat(e).size, a = new Uint8Array(n); return xe.read(r, a, 0, n, 0), "utf8" === t.encoding ? i = U(a, 0) : "binary" === t .encoding && (i = a), xe.close(r), i }, writeFile: function(e, t, i) { (i = i || {}).flags = i.flags || "w"; var r = xe.open(e, i.flags, i.mode); if ("string" == typeof t) { var n = new Uint8Array(j(t) + 1), a = B(t, n, 0, n.length); xe.write(r, n, 0, a, void 0, i.canOwn) } else { if (!ArrayBuffer.isView(t)) throw new Error("Unsupported data type"); xe.write(r, t, 0, t.byteLength, void 0, i.canOwn) } xe.close(r) }, cwd: function() { return xe.currentPath }, chdir: function(e) { var t = xe.lookupPath(e, { follow: !0 }); if (null === t.node) throw new xe.ErrnoError(44); if (!xe.isDir(t.node.mode)) throw new xe.ErrnoError(54); var i = xe.nodePermissions(t.node, "x"); if (i) throw new xe.ErrnoError(i); xe.currentPath = t.path }, createDefaultDirectories: function() { xe.mkdir("/tmp"), xe.mkdir("/home"), xe.mkdir("/home/web_user") }, createDefaultDevices: function() { var e; if (xe.mkdir("/dev"), xe.registerDevice(xe.makedev(1, 3), { read: function() { return 0 }, write: function(e, t, i, r, n) { return r } }), xe.mkdev("/dev/null", xe.makedev(1, 3)), Ce.register(xe.makedev(5, 0), Ce .default_tty_ops), Ce.register(xe.makedev(6, 0), Ce.default_tty1_ops), xe.mkdev( "/dev/tty", xe.makedev(5, 0)), xe.mkdev("/dev/tty1", xe.makedev(6, 0)), "object" == typeof crypto && "function" == typeof crypto.getRandomValues) { var t = new Uint8Array(1); e = function() { return crypto.getRandomValues(t), t[0] } } else if (u) try { var r = i(71); e = function() { return r.randomBytes(1)[0] } } catch (e) {} e || (e = function() { ve( "no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };") }), xe.createDevice("/dev", "random", e), xe.createDevice("/dev", "urandom", e), xe.mkdir( "/dev/shm"), xe.mkdir("/dev/shm/tmp") }, createSpecialDirectories: function() { xe.mkdir("/proc"), xe.mkdir("/proc/self"), xe.mkdir("/proc/self/fd"), xe.mount({ mount: function() { var e = xe.createNode("/proc/self", "fd", 16895, 73); return e.node_ops = { lookup: function(e, t) { var i = +t, r = xe.getStream(i); if (!r) throw new xe.ErrnoError(8); var n = { parent: null, mount: { mountpoint: "fake" }, node_ops: { readlink: function() { return r.path } } }; return n.parent = n, n } }, e } }, {}, "/proc/self/fd") }, createStandardStreams: function() { d.stdin ? xe.createDevice("/dev", "stdin", d.stdin) : xe.symlink("/dev/tty", "/dev/stdin"), d .stdout ? xe.createDevice("/dev", "stdout", null, d.stdout) : xe.symlink("/dev/tty", "/dev/stdout"), d.stderr ? xe.createDevice("/dev", "stderr", null, d.stderr) : xe.symlink( "/dev/tty1", "/dev/stderr"); var e = xe.open("/dev/stdin", "r"), t = xe.open("/dev/stdout", "w"), i = xe.open("/dev/stderr", "w"); I(0 === e.fd, "invalid handle for stdin (" + e.fd + ")"), I(1 === t.fd, "invalid handle for stdout (" + t.fd + ")"), I(2 === i.fd, "invalid handle for stderr (" + i.fd + ")") }, ensureErrnoError: function() { xe.ErrnoError || (xe.ErrnoError = function(e, t) { this.node = t, this.setErrno = function(e) { for (var t in this.errno = e, Le) if (Le[t] === e) { this.code = t; break } }, this.setErrno(e), this.message = Ie[e], this.stack && (Object.defineProperty(this, "stack", { value: (new Error).stack, writable: !0 }), this.stack = Se(this.stack)) }, xe.ErrnoError.prototype = new Error, xe.ErrnoError.prototype.constructor = xe .ErrnoError, [44].forEach(function(e) { xe.genericErrors[e] = new xe.ErrnoError(e), xe.genericErrors[e].stack = "" })) }, staticInit: function() { xe.ensureErrnoError(), xe.nameTable = new Array(4096), xe.mount(De, {}, "/"), xe .createDefaultDirectories(), xe.createDefaultDevices(), xe.createSpecialDirectories(), xe .filesystems = { MEMFS: De } }, init: function(e, t, i) { I(!xe.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)" ), xe.init.initialized = !0, xe.ensureErrnoError(), d.stdin = e || d.stdin, d.stdout = t || d.stdout, d.stderr = i || d.stderr, xe.createStandardStreams() }, quit: function() { xe.init.initialized = !1; var e = d._fflush; e && e(0); for (var t = 0; t < xe.streams.length; t++) { var i = xe.streams[t]; i && xe.close(i) } }, getMode: function(e, t) { var i = 0; return e && (i |= 365), t && (i |= 146), i }, joinPath: function(e, t) { var i = Me.join.apply(null, e); return t && "/" == i[0] && (i = i.substr(1)), i }, absolutePath: function(e, t) { return Oe.resolve(t, e) }, standardizePath: function(e) { return Me.normalize(e) }, findObject: function(e, t) { var i = xe.analyzePath(e, t); return i.exists ? i.object : (Re(i.error), null) }, analyzePath: function(e, t) { try { e = (r = xe.lookupPath(e, { follow: !t })).path } catch (e) {} var i = { isRoot: !1, exists: !1, error: 0, name: null, path: null, object: null, parentExists: !1, parentPath: null, parentObject: null }; try { var r = xe.lookupPath(e, { parent: !0 }); i.parentExists = !0, i.parentPath = r.path, i.parentObject = r.node, i.name = Me.basename( e), r = xe.lookupPath(e, { follow: !t }), i.exists = !0, i.path = r.path, i.object = r.node, i.name = r.node.name, i.isRoot = "/" === r.path } catch (e) { i.error = e.errno } return i }, createFolder: function(e, t, i, r) { var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t), a = xe.getMode(i, r); return xe.mkdir(n, a) }, createPath: function(e, t, i, r) { e = "string" == typeof e ? e : xe.getPath(e); for (var n = t.split("/").reverse(); n.length;) { var a = n.pop(); if (a) { var s = Me.join2(e, a); try { xe.mkdir(s) } catch (e) {} e = s } } return s }, createFile: function(e, t, i, r, n) { var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t), s = xe.getMode(r, n); return xe.create(a, s) }, createDataFile: function(e, t, i, r, n, a) { var s = t ? Me.join2("string" == typeof e ? e : xe.getPath(e), t) : e, o = xe.getMode(r, n), u = xe.create(s, o); if (i) { if ("string" == typeof i) { for (var l = new Array(i.length), d = 0, c = i.length; d < c; ++d) l[d] = i.charCodeAt(d); i = l } xe.chmod(u, 146 | o); var h = xe.open(u, "w"); xe.write(h, i, 0, i.length, 0, a), xe.close(h), xe.chmod(u, o) } return u }, createDevice: function(e, t, i, r) { var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t), a = xe.getMode(!!i, !!r); xe.createDevice.major || (xe.createDevice.major = 64); var s = xe.makedev(xe.createDevice.major++, 0); return xe.registerDevice(s, { open: function(e) { e.seekable = !1 }, close: function(e) { r && r.buffer && r.buffer.length && r(10) }, read: function(e, t, r, n, a) { for (var s = 0, o = 0; o < n; o++) { var u; try { u = i() } catch (e) { throw new xe.ErrnoError(29) } if (void 0 === u && 0 === s) throw new xe.ErrnoError(6); if (null == u) break; s++, t[r + o] = u } return s && (e.node.timestamp = Date.now()), s }, write: function(e, t, i, n, a) { for (var s = 0; s < n; s++) try { r(t[i + s]) } catch (e) { throw new xe.ErrnoError(29) } return n && (e.node.timestamp = Date.now()), s } }), xe.mkdev(n, a, s) }, createLink: function(e, t, i, r, n) { var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t); return xe.symlink(i, a) }, forceLoadFile: function(e) { if (e.isDevice || e.isFolder || e.link || e.contents) return !0; var t = !0; if ("undefined" != typeof XMLHttpRequest) throw new Error( "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread." ); if (!y) throw new Error("Cannot load without read() or XMLHttpRequest."); try { e.contents = Be(y(e.url), !0), e.usedBytes = e.contents.length } catch (e) { t = !1 } return t || Re(29), t }, createLazyFile: function(e, t, i, r, n) { function a() { this.lengthKnown = !1, this.chunks = [] } if (a.prototype.get = function(e) { if (!(e > this.length - 1 || e < 0)) { var t = e % this.chunkSize, i = e / this.chunkSize | 0; return this.getter(i)[t] } }, a.prototype.setDataGetter = function(e) { this.getter = e }, a.prototype.cacheLength = function() { var e = new XMLHttpRequest; if (e.open("HEAD", i, !1), e.send(null), !(e.status >= 200 && e.status < 300 || 304 === e .status)) throw new Error("Couldn't load " + i + ". Status: " + e.status); var t, r = Number(e.getResponseHeader("Content-length")), n = (t = e.getResponseHeader("Accept-Ranges")) && "bytes" === t, a = (t = e.getResponseHeader("Content-Encoding")) && "gzip" === t, s = 1048576; n || (s = r); var o = this; o.setDataGetter(function(e) { var t = e * s, n = (e + 1) * s - 1; if (n = Math.min(n, r - 1), void 0 === o.chunks[e] && (o.chunks[e] = function(e, t) { if (e > t) throw new Error("invalid range (" + e + ", " + t + ") or no bytes requested!"); if (t > r - 1) throw new Error("only " + r + " bytes available! programmer error!"); var n = new XMLHttpRequest; if (n.open("GET", i, !1), r !== s && n.setRequestHeader("Range", "bytes=" + e + "-" + t), "undefined" != typeof Uint8Array && (n.responseType = "arraybuffer"), n.overrideMimeType && n.overrideMimeType( "text/plain; charset=x-user-defined"), n.send(null), !(n.status >= 200 && n.status < 300 || 304 === n.status)) throw new Error("Couldn't load " + i + ". Status: " + n.status); return void 0 !== n.response ? new Uint8Array(n.response || []) : Be(n .responseText || "", !0) }(t, n)), void 0 === o.chunks[e]) throw new Error("doXHR failed!"); return o.chunks[e] }), !a && r || (s = r = 1, r = this.getter(0).length, s = r, console.log( "LazyFiles on gzip forces download of the whole file when length is accessed")), this ._length = r, this._chunkSize = s, this.lengthKnown = !0 }, "undefined" != typeof XMLHttpRequest) { if (!v) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; var s = new a; Object.defineProperties(s, { length: { get: function() { return this.lengthKnown || this.cacheLength(), this._length } }, chunkSize: { get: function() { return this.lengthKnown || this.cacheLength(), this._chunkSize } } }); var o = { isDevice: !1, contents: s } } else o = { isDevice: !1, url: i }; var u = xe.createFile(e, t, o, r, n); o.contents ? u.contents = o.contents : o.url && (u.contents = null, u.url = o.url), Object .defineProperties(u, { usedBytes: { get: function() { return this.contents.length } } }); var l = {}; return Object.keys(u.stream_ops).forEach(function(e) { var t = u.stream_ops[e]; l[e] = function() { if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29); return t.apply(null, arguments) } }), l.read = function(e, t, i, r, n) { if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29); var a = e.node.contents; if (n >= a.length) return 0; var s = Math.min(a.length - n, r); if (I(s >= 0), a.slice) for (var o = 0; o < s; o++) t[i + o] = a[n + o]; else for (o = 0; o < s; o++) t[i + o] = a.get(n + o); return s }, u.stream_ops = l, u }, createPreloadedFile: function(e, t, i, r, n, a, s, o, u, l) { Browser.init(); var c = t ? Oe.resolve(Me.join2(e, t)) : e, h = function(e) { for (var t = e;;) { if (!pe[e]) return e; e = t + Math.random() } return e }("cp " + c); function f(i) { function f(i) { l && l(), o || xe.createDataFile(e, t, i, r, n, u), a && a(), ge(h) } var p = !1; d.preloadPlugins.forEach(function(e) { p || e.canHandle(c) && (e.handle(i, c, f, function() { s && s(), ge(h) }), p = !0) }), p || f(i) } me(h), "string" == typeof i ? Browser.asyncLoad(i, function(e) { f(e) }, s) : f(i) }, indexedDB: function() { return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB }, DB_NAME: function() { return "EM_FS_" + window.location.pathname }, DB_VERSION: 20, DB_STORE_NAME: "FILE_DATA", saveFilesToDB: function(e, t, i) { t = t || function() {}, i = i || function() {}; var r = xe.indexedDB(); try { var n = r.open(xe.DB_NAME(), xe.DB_VERSION) } catch (e) { return i(e) } n.onupgradeneeded = function() { console.log("creating db"), n.result.createObjectStore(xe.DB_STORE_NAME) }, n.onsuccess = function() { var r = n.result.transaction([xe.DB_STORE_NAME], "readwrite"), a = r.objectStore(xe.DB_STORE_NAME), s = 0, o = 0, u = e.length; function l() { 0 == o ? t() : i() } e.forEach(function(e) { var t = a.put(xe.analyzePath(e).object.contents, e); t.onsuccess = function() { ++s + o == u && l() }, t.onerror = function() { s + ++o == u && l() } }), r.onerror = i }, n.onerror = i }, loadFilesFromDB: function(e, t, i) { t = t || function() {}, i = i || function() {}; var r = xe.indexedDB(); try { var n = r.open(xe.DB_NAME(), xe.DB_VERSION) } catch (e) { return i(e) } n.onupgradeneeded = i, n.onsuccess = function() { var r = n.result; try { var a = r.transaction([xe.DB_STORE_NAME], "readonly") } catch (e) { return void i(e) } var s = a.objectStore(xe.DB_STORE_NAME), o = 0, u = 0, l = e.length; function d() { 0 == u ? t() : i() } e.forEach(function(e) { var t = s.get(e); t.onsuccess = function() { xe.analyzePath(e).exists && xe.unlink(e), xe.createDataFile(Me.dirname(e), Me .basename(e), t.result, !0, !0, !0), ++o + u == l && d() }, t.onerror = function() { o + ++u == l && d() } }), a.onerror = i }, n.onerror = i } }, Pe = { DEFAULT_POLLMASK: 5, mappings: {}, umask: 511, calculateAt: function(e, t) { if ("/" !== t[0]) { var i; if (-100 === e) i = xe.cwd(); else { var r = xe.getStream(e); if (!r) throw new xe.ErrnoError(8); i = r.path } t = Me.join2(i, t) } return t }, doStat: function(e, t, i) { try { var r = e(t) } catch (e) { if (e && e.node && Me.normalize(t) !== Me.normalize(xe.getPath(e.node))) return -54; throw e } return q[i >> 2] = r.dev, q[i + 4 >> 2] = 0, q[i + 8 >> 2] = r.ino, q[i + 12 >> 2] = r.mode, q[i + 16 >> 2] = r.nlink, q[i + 20 >> 2] = r.uid, q[i + 24 >> 2] = r.gid, q[i + 28 >> 2] = r .rdev, q[i + 32 >> 2] = 0, we = [r.size >>> 0, (be = r.size, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 : 0)], q[i + 40 >> 2] = we[0], q[i + 44 >> 2] = we[1], q[i + 48 >> 2] = 4096, q[i + 52 >> 2] = r.blocks, q[i + 56 >> 2] = r.atime.getTime() / 1e3 | 0, q[i + 60 >> 2] = 0, q[i + 64 >> 2] = r.mtime.getTime() / 1e3 | 0, q[i + 68 >> 2] = 0, q[i + 72 >> 2] = r.ctime.getTime() / 1e3 | 0, q[i + 76 >> 2] = 0, we = [r.ino >>> 0, (be = r.ino, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 : 0)], q[i + 80 >> 2] = we[0], q[i + 84 >> 2] = we[1], 0 }, doMsync: function(e, t, i, r) { var n = new Uint8Array(V.subarray(e, e + i)); xe.msync(t, n, 0, i, r) }, doMkdir: function(e, t) { return "/" === (e = Me.normalize(e))[e.length - 1] && (e = e.substr(0, e.length - 1)), xe .mkdir(e, t, 0), 0 }, doMknod: function(e, t, i) { switch (61440 & t) { case 32768: case 8192: case 24576: case 4096: case 49152: break; default: return -28 } return xe.mknod(e, t, i), 0 }, doReadlink: function(e, t, i) { if (i <= 0) return -28; var r = xe.readlink(e), n = Math.min(i, j(r)), a = G[t + n]; return F(r, t, i + 1), G[t + n] = a, n }, doAccess: function(e, t) { if (-8 & t) return -28; var i; if (!(i = xe.lookupPath(e, { follow: !0 }).node)) return -44; var r = ""; return 4 & t && (r += "r"), 2 & t && (r += "w"), 1 & t && (r += "x"), r && xe.nodePermissions( i, r) ? -2 : 0 }, doDup: function(e, t, i) { var r = xe.getStream(i); return r && xe.close(r), xe.open(e, t, 0, i, i).fd }, doReadv: function(e, t, i, r) { for (var n = 0, a = 0; a < i; a++) { var s = q[t + 8 * a >> 2], o = q[t + (8 * a + 4) >> 2], u = xe.read(e, G, s, o, r); if (u < 0) return -1; if (n += u, u < o) break } return n }, doWritev: function(e, t, i, r) { for (var n = 0, a = 0; a < i; a++) { var s = q[t + 8 * a >> 2], o = q[t + (8 * a + 4) >> 2], u = xe.write(e, G, s, o, r); if (u < 0) return -1; n += u } return n }, varargs: 0, get: function(e) { return Pe.varargs += 4, q[Pe.varargs - 4 >> 2] }, getStr: function() { return N(Pe.get()) }, getStreamFromFD: function(e) { void 0 === e && (e = Pe.get()); var t = xe.getStream(e); if (!t) throw new xe.ErrnoError(8); return t }, get64: function() { var e = Pe.get(), t = Pe.get(); return I(e >= 0 ? 0 === t : -1 === t), e }, getZero: function() { I(0 === Pe.get()) } }; var Ue = {}; function Ne() { if (!Ne.strings) { var e = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: ("object" == typeof navigator && navigator.languages && navigator.languages[0] || "C") .replace("-", "_") + ".UTF-8", _: p }; for (var t in Ue) e[t] = Ue[t]; var i = []; for (var t in e) i.push(t + "=" + e[t]); Ne.strings = i } return Ne.strings } function Be(e, t, i) { var r = i > 0 ? i : j(e) + 1, n = new Array(r), a = B(e, n, 0, n.length); return t && (n.length = a), n } F("GMT", 1341232, 4), xe.staticInit(); var Fe = { __cxa_allocate_exception: function(e) { return ri(e) }, __cxa_throw: function(e, t, i) { throw ke[e] = { ptr: e, adjusted: [e], type: t, destructor: i, refcount: 0, caught: !1, rethrown: !1 }, "uncaught_exception" in ni ? ni.uncaught_exceptions++ : ni.uncaught_exceptions = 1, e + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch." }, __lock: function() {}, __syscall221: function(e, t) { Pe.varargs = t; try { var i = Pe.getStreamFromFD(); switch (Pe.get()) { case 0: return (r = Pe.get()) < 0 ? -28 : xe.open(i.path, i.flags, 0, r).fd; case 1: case 2: return 0; case 3: return i.flags; case 4: var r = Pe.get(); return i.flags |= r, 0; case 12: return r = Pe.get(), W[r + 0 >> 1] = 2, 0; case 13: case 14: return 0; case 16: case 8: return -28; case 9: return Re(28), -1; default: return -28 } } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno } }, __syscall3: function(e, t) { Pe.varargs = t; try { var i = Pe.getStreamFromFD(), r = Pe.get(), n = Pe.get(); return xe.read(i, G, r, n) } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno } }, __syscall5: function(e, t) { Pe.varargs = t; try { var i = Pe.getStr(), r = Pe.get(), n = Pe.get(); return xe.open(i, r, n).fd } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno } }, __unlock: function() {}, abort: function() { ve() }, clock: function e() { return void 0 === e.start && (e.start = Date.now()), 1e3 * (Date.now() - e.start) | 0 }, emscripten_memcpy_big: function(e, t, i) { V.set(V.subarray(t, t + i), e) }, emscripten_resize_heap: function(e) { var t = G.length; if (I(e > t), e > 2147418112) return S("Cannot enlarge memory, asked to go up to " + e + " bytes, but the limit is 2147418112 bytes!"), !1; for (var i = Math.max(t, 16777216); i < e;)(i = i <= 536870912 ? z(2 * i, 65536) : Math.min(z( (3 * i + 2147483648) / 4, 65536), 2147418112)) === t && A( "Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only " + G.length); return !! function(e) { try { return M.grow(e - H.byteLength + 65535 >> 16), K(M.buffer), 1 } catch (t) { console.error("emscripten_realloc_buffer: Attempted to grow heap from " + H.byteLength + " bytes to " + e + " bytes, but got error: " + t) } }(i) || (S("Failed to grow the heap from " + t + " bytes to " + i + " bytes, not enough memory!"), !1) }, environ_get: function(e, t) { var i = 0; return Ne().forEach(function(r, n) { var a = t + i; q[e + 4 * n >> 2] = a, function(e, t, i) { for (var r = 0; r < e.length; ++r) I(e.charCodeAt(r) == e.charCodeAt(r) & 255), G[ t++ >> 0] = e.charCodeAt(r); i || (G[t >> 0] = 0) }(r, a), i += r.length + 1 }), 0 }, environ_sizes_get: function(e, t) { var i = Ne(); q[e >> 2] = i.length; var r = 0; return i.forEach(function(e) { r += e.length + 1 }), q[t >> 2] = r, 0 }, fd_close: function(e) { try { var t = Pe.getStreamFromFD(e); return xe.close(t), 0 } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, fd_fdstat_get: function(e, t) { try { var i = Pe.getStreamFromFD(e), r = i.tty ? 2 : xe.isDir(i.mode) ? 3 : xe.isLink(i.mode) ? 7 : 4; return G[t >> 0] = r, 0 } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, fd_seek: function(e, t, i, r, n) { try { var a = Pe.getStreamFromFD(e), s = 4294967296 * i + (t >>> 0); return s <= -9007199254740992 || s >= 9007199254740992 ? -61 : (xe.llseek(a, s, r), we = [a .position >>> 0, (be = a.position, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 : 0) ], q[n >> 2] = we[0], q[n + 4 >> 2] = we[1], a.getdents && 0 === s && 0 === r && (a .getdents = null), 0) } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, fd_write: function(e, t, i, r) { try { var n = Pe.getStreamFromFD(e), a = Pe.doWritev(n, t, i); return q[r >> 2] = a, 0 } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, gettimeofday: function(e) { var t = Date.now(); return q[e >> 2] = t / 1e3 | 0, q[e + 4 >> 2] = t % 1e3 * 1e3 | 0, 0 }, memory: M, round: function(e) { return (e = +e) >= 0 ? +le(e + .5) : +ue(e - .5) }, setTempRet0: function(e) { O(0 | e) }, table: C, time: function(e) { var t = Date.now() / 1e3 | 0; return e && (q[e >> 2] = t), t } }, je = function() { var e = { env: Fe, wasi_unstable: Fe }; function t(e, t) { var i = e.exports; d.asm = i, ge("wasm-instantiate") } me("wasm-instantiate"); var i = d; function r(e) { I(d === i, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?" ), i = null, t(e.instance) } function n(t) { return (R || !g && !v || "function" != typeof fetch ? new Promise(function(e, t) { e(Te()) }) : fetch(Ee, { credentials: "same-origin" }).then(function(e) { if (!e.ok) throw "failed to load wasm binary file at '" + Ee + "'"; return e.arrayBuffer() }).catch(function() { return Te() })).then(function(t) { return WebAssembly.instantiate(t, e) }).then(t, function(e) { S("failed to asynchronously prepare wasm: " + e), ve(e) }) } if (d.instantiateWasm) try { return d.instantiateWasm(e, t) } catch (e) { return S("Module.instantiateWasm callback failed with error: " + e), !1 } return function() { if (R || "function" != typeof WebAssembly.instantiateStreaming || _e(Ee) || "function" != typeof fetch) return n(r); fetch(Ee, { credentials: "same-origin" }).then(function(t) { return WebAssembly.instantiateStreaming(t, e).then(r, function(e) { S("wasm streaming compile failed: " + e), S( "falling back to ArrayBuffer instantiation"), n(r) }) }) }(), {} }(), He = je.__wasm_call_ctors; je.__wasm_call_ctors = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), He .apply(null, arguments) }; var Ge = je.WasmDecoder_Check; je.WasmDecoder_Check = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ge .apply(null, arguments) }; var Ve = je.WasmDecoder_Init; je.WasmDecoder_Init = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ve .apply(null, arguments) }; var We = je.WasmDecoder_Deinit; je.WasmDecoder_Deinit = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), We .apply(null, arguments) }; var qe = je.WasmDecoder_OpenChannel; je.WasmDecoder_OpenChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qe .apply(null, arguments) }; var Xe = je.WasmDecoder_InputFlvStream; je.WasmDecoder_InputFlvStream = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xe .apply(null, arguments) }; var ze = je.WasmDecoder_GetFlvDecodeData; je.WasmDecoder_GetFlvDecodeData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ze .apply(null, arguments) }; var Ke = je.WasmDecoder_InputFlvStreamAndDecode; je.WasmDecoder_InputFlvStreamAndDecode = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ke .apply(null, arguments) }; var Ye = je.WasmDecoder_OpenVideoDecoder; je.WasmDecoder_OpenVideoDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ye .apply(null, arguments) }; var Qe = je.WasmDecoder_OpenAudioDecoder; je.WasmDecoder_OpenAudioDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qe .apply(null, arguments) }; var Je = je.WasmDecoder_DecodeVideoFrame; je.WasmDecoder_DecodeVideoFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Je .apply(null, arguments) }; var Ze = je.WasmDecoder_DecodeAudioFrame; je.WasmDecoder_DecodeAudioFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ze .apply(null, arguments) }; var $e = je.WasmDecoder_CloseChannel; je.WasmDecoder_CloseChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $e .apply(null, arguments) }; var et = je.WasmDecoder_ConvertFrame2Image; je.WasmDecoder_ConvertFrame2Image = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), et .apply(null, arguments) }; var tt = je.WasmDecoder_ReleaseImageData; je.WasmDecoder_ReleaseImageData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), tt .apply(null, arguments) }; var it = je.WasmDecoder_CreateMP4File; je.WasmDecoder_CreateMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), it .apply(null, arguments) }; var rt = je.WasmDecoder_WriteData; je.WasmDecoder_WriteData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), rt .apply(null, arguments) }; var nt = je.WasmDecoder_ReleaseMP4File; je.WasmDecoder_ReleaseMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), nt .apply(null, arguments) }; var at = je.main; je.main = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), at .apply(null, arguments) }; var st = je.free; je.free = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), st .apply(null, arguments) }; var ot = je.malloc; je.malloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ot .apply(null, arguments) }; var ut = je.__errno_location; je.__errno_location = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ut .apply(null, arguments) }; var lt = je.fflush; je.fflush = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), lt .apply(null, arguments) }; var dt = je._get_tzname; je._get_tzname = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), dt .apply(null, arguments) }; var ct = je._get_daylight; je._get_daylight = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ct .apply(null, arguments) }; var ht = je._get_timezone; je._get_timezone = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ht .apply(null, arguments) }; var ft = je.setThrew; je.setThrew = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ft .apply(null, arguments) }; var pt = je._ZSt18uncaught_exceptionv; je._ZSt18uncaught_exceptionv = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), pt .apply(null, arguments) }; var mt = je.stackSave; je.stackSave = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), mt .apply(null, arguments) }; var gt = je.stackAlloc; je.stackAlloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), gt .apply(null, arguments) }; var vt = je.stackRestore; je.stackRestore = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), vt .apply(null, arguments) }; var yt = je.__growWasmMemory; je.__growWasmMemory = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), yt .apply(null, arguments) }; var _t = je.dynCall_ii; je.dynCall_ii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), _t .apply(null, arguments) }; var bt = je.dynCall_viiiii; je.dynCall_viiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), bt .apply(null, arguments) }; var wt = je.dynCall_viiiiiifi; je.dynCall_viiiiiifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), wt .apply(null, arguments) }; var Et = je.dynCall_viiii; je.dynCall_viiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Et .apply(null, arguments) }; var Tt = je.dynCall_viii; je.dynCall_viii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Tt .apply(null, arguments) }; var St = je.dynCall_iiiiiii; je.dynCall_iiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), St .apply(null, arguments) }; var At = je.dynCall_iiiiii; je.dynCall_iiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), At .apply(null, arguments) }; var kt = je.dynCall_vii; je.dynCall_vii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), kt .apply(null, arguments) }; var Rt = je.dynCall_iii; je.dynCall_iii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Rt .apply(null, arguments) }; var Mt = je.dynCall_iiii; je.dynCall_iiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Mt .apply(null, arguments) }; var Ot = je.dynCall_viiiiii; je.dynCall_viiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ot .apply(null, arguments) }; var Ct = je.dynCall_viiiiiiiii; je.dynCall_viiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ct .apply(null, arguments) }; var Dt = je.dynCall_viiiiiiii; je.dynCall_viiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Dt .apply(null, arguments) }; var It = je.dynCall_iiiii; je.dynCall_iiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), It .apply(null, arguments) }; var Lt = je.dynCall_viiiiiiiiiiiiii; je.dynCall_viiiiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Lt .apply(null, arguments) }; var xt = je.dynCall_viiiiiiiiiii; je.dynCall_viiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), xt .apply(null, arguments) }; var Pt = je.dynCall_viiiiiii; je.dynCall_viiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Pt .apply(null, arguments) }; var Ut = je.dynCall_viiiiiiiiiiii; je.dynCall_viiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ut .apply(null, arguments) }; var Nt = je.dynCall_vi; je.dynCall_vi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Nt .apply(null, arguments) }; var Bt = je.dynCall_iiiiiiiii; je.dynCall_iiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Bt .apply(null, arguments) }; var Ft = je.dynCall_viiiifii; je.dynCall_viiiifii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ft .apply(null, arguments) }; var jt = je.dynCall_fii; je.dynCall_fii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), jt .apply(null, arguments) }; var Ht = je.dynCall_viiiiiiiiii; je.dynCall_viiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ht .apply(null, arguments) }; var Gt = je.dynCall_dd; je.dynCall_dd = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Gt .apply(null, arguments) }; var Vt = je.dynCall_viifi; je.dynCall_viifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Vt .apply(null, arguments) }; var Wt = je.dynCall_fiii; je.dynCall_fiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Wt .apply(null, arguments) }; var qt = je.dynCall_viidi; je.dynCall_viidi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qt .apply(null, arguments) }; var Xt = je.dynCall_iiiiiiii; je.dynCall_iiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xt .apply(null, arguments) }; var zt = je.dynCall_did; je.dynCall_did = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), zt .apply(null, arguments) }; var Kt = je.dynCall_v; je.dynCall_v = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Kt .apply(null, arguments) }; var Yt = je.dynCall_viiijj; je.dynCall_viiijj = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Yt .apply(null, arguments) }; var Qt = je.dynCall_iiiiiiidiiddii; je.dynCall_iiiiiiidiiddii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qt .apply(null, arguments) }; var Jt = je.dynCall_jij; je.dynCall_jij = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Jt .apply(null, arguments) }; var Zt = je.dynCall_jii; je.dynCall_jii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Zt .apply(null, arguments) }; var $t = je.dynCall_jiji; je.dynCall_jiji = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $t .apply(null, arguments) }; var ei = je.dynCall_iidiiii; je.dynCall_iidiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ei .apply(null, arguments) }, d.asm = je; var ti, ii = d.___wasm_call_ctors = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.__wasm_call_ctors.apply(null, arguments) }, ri = (d._WasmDecoder_Check = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_Check.apply(null, arguments) }, d._WasmDecoder_Init = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_Init.apply(null, arguments) }, d._WasmDecoder_Deinit = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_Deinit.apply(null, arguments) }, d._WasmDecoder_OpenChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_OpenChannel.apply(null, arguments) }, d._WasmDecoder_InputFlvStream = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_InputFlvStream.apply(null, arguments) }, d._WasmDecoder_GetFlvDecodeData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_GetFlvDecodeData.apply(null, arguments) }, d._WasmDecoder_InputFlvStreamAndDecode = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_InputFlvStreamAndDecode.apply(null, arguments) }, d._WasmDecoder_OpenVideoDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_OpenVideoDecoder.apply(null, arguments) }, d._WasmDecoder_OpenAudioDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_OpenAudioDecoder.apply(null, arguments) }, d._WasmDecoder_DecodeVideoFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_DecodeVideoFrame.apply(null, arguments) }, d._WasmDecoder_DecodeAudioFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_DecodeAudioFrame.apply(null, arguments) }, d._WasmDecoder_CloseChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_CloseChannel.apply(null, arguments) }, d._WasmDecoder_ConvertFrame2Image = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_ConvertFrame2Image.apply(null, arguments) }, d._WasmDecoder_ReleaseImageData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_ReleaseImageData.apply(null, arguments) }, d._WasmDecoder_CreateMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_CreateMP4File.apply(null, arguments) }, d._WasmDecoder_WriteData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_WriteData.apply(null, arguments) }, d._WasmDecoder_ReleaseMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_ReleaseMP4File.apply(null, arguments) }, d._main = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .main.apply(null, arguments) }, d._free = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .free.apply(null, arguments) }, d._malloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .malloc.apply(null, arguments) }), ni = (d.___errno_location = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .__errno_location.apply(null, arguments) }, d._fflush = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .fflush.apply(null, arguments) }, d.__get_tzname = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._get_tzname.apply(null, arguments) }, d.__get_daylight = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._get_daylight.apply(null, arguments) }, d.__get_timezone = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._get_timezone.apply(null, arguments) }, d._setThrew = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .setThrew.apply(null, arguments) }, d.__ZSt18uncaught_exceptionv = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._ZSt18uncaught_exceptionv.apply(null, arguments) }), ai = d.stackSave = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.stackSave.apply(null, arguments) }, si = d.stackAlloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.stackAlloc.apply(null, arguments) }, oi = d.stackRestore = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.stackRestore.apply(null, arguments) }; function ui(e) { this.name = "ExitStatus", this.message = "Program terminated with exit(" + e + ")", this.status = e } function li(e) { I(0 == ce, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'), I(0 == te.length, "cannot call main when preRun functions remain to be called"); var t = d._main; try { ! function(e, t) { (function() { var e = T, t = S, i = !1; T = S = function(e) { i = !0 }; try { var r = d._fflush; r && r(0), ["stdout", "stderr"].forEach(function(e) { var t = xe.analyzePath("/dev/" + e); if (t) { var r = t.object.rdev, n = Ce.ttys[r]; n && n.output && n.output.length && (i = !0) } }) } catch (e) {} T = e, S = t, i && A( "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc." ) })(), t && s && 0 === e || (s ? t || S("program exited (with status: " + e + "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)" ) : (D = !0, $(), se = !0, d.onExit && d.onExit(e)), m(e, new ui(e))) }(t(0, 0), !0) } catch (e) { if (e instanceof ui) return; if ("SimulateInfiniteLoop" == e) return void(s = !0); var i = e; e && "object" == typeof e && e.stack && (i = [e, e.stack]), S("exception thrown: " + i), m(1, e) } } function di(e) { function t() { ti || (ti = !0, D || ($(), I(!ae), ae = !0, d.noFSInit || xe.init.initialized || xe.init(), Ce .init(), ee(ie), $(), xe.ignorePermissions = !1, ee(re), d.onRuntimeInitialized && d .onRuntimeInitialized(), ci && li(), function() { if ($(), d.postRun) for ("function" == typeof d.postRun && (d.postRun = [d.postRun]); d.postRun.length;) e = d.postRun.shift(), ne.unshift(e); var e; ee(ne) }())) } e = e || f, ce > 0 || (Z(), function() { if (d.preRun) for ("function" == typeof d.preRun && (d.preRun = [d.preRun]); d.preRun.length;) e = d .preRun.shift(), te.unshift(e); var e; ee(te) }(), ce > 0 || (d.setStatus ? (d.setStatus("Running..."), setTimeout(function() { setTimeout(function() { d.setStatus("") }, 1), t() }, 1)) : t(), $())) } if (d.__growWasmMemory = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.__growWasmMemory.apply(null, arguments) }, d.dynCall_ii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_ii.apply(null, arguments) }, d.dynCall_viiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiii.apply(null, arguments) }, d.dynCall_viiiiiifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiifi.apply(null, arguments) }, d.dynCall_viiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiii.apply(null, arguments) }, d.dynCall_viii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viii.apply(null, arguments) }, d.dynCall_iiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiii.apply(null, arguments) }, d.dynCall_iiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiii.apply(null, arguments) }, d.dynCall_vii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_vii.apply(null, arguments) }, d.dynCall_iii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iii.apply(null, arguments) }, d.dynCall_iiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiii.apply(null, arguments) }, d.dynCall_viiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiii.apply(null, arguments) }, d.dynCall_viiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiii.apply(null, arguments) }, d.dynCall_viiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiii.apply(null, arguments) }, d.dynCall_iiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiii.apply(null, arguments) }, d.dynCall_viiiiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiiiiiii.apply(null, arguments) }, d.dynCall_viiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiiii.apply(null, arguments) }, d.dynCall_viiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiii.apply(null, arguments) }, d.dynCall_viiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiiiii.apply(null, arguments) }, d.dynCall_vi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_vi.apply(null, arguments) }, d.dynCall_iiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiiiii.apply(null, arguments) }, d.dynCall_viiiifii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiifii.apply(null, arguments) }, d.dynCall_fii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_fii.apply(null, arguments) }, d.dynCall_viiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiii.apply(null, arguments) }, d.dynCall_dd = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_dd.apply(null, arguments) }, d.dynCall_viifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viifi.apply(null, arguments) }, d.dynCall_fiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_fiii.apply(null, arguments) }, d.dynCall_viidi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viidi.apply(null, arguments) }, d.dynCall_iiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiiii.apply(null, arguments) }, d.dynCall_did = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_did.apply(null, arguments) }, d.dynCall_v = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_v.apply(null, arguments) }, d.dynCall_viiijj = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiijj.apply(null, arguments) }, d.dynCall_iiiiiiidiiddii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiiidiiddii.apply(null, arguments) }, d.dynCall_jij = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_jij.apply(null, arguments) }, d.dynCall_jii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_jii.apply(null, arguments) }, d.dynCall_jiji = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_jiji.apply(null, arguments) }, d.dynCall_iidiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iidiiii.apply(null, arguments) }, d.asm = je, Object.getOwnPropertyDescriptor(d, "intArrayFromString") || (d.intArrayFromString = function() { ve( "'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "intArrayToString") || (d.intArrayToString = function() { ve( "'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.ccall = x, d.cwrap = function(e, t, i, r) { return function() { return x(e, t, i, arguments) } }, Object.getOwnPropertyDescriptor(d, "setValue") || (d.setValue = function() { ve("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getValue") || (d.getValue = function() { ve("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "allocate") || (d.allocate = function() { ve("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getMemory") || (d.getMemory = function() { ve( "'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "AsciiToString") || (d.AsciiToString = function() { ve("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToAscii") || (d.stringToAscii = function() { ve("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF8ArrayToString") || (d.UTF8ArrayToString = function() { ve( "'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF8ToString") || (d.UTF8ToString = function() { ve("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF8Array") || (d.stringToUTF8Array = function() { ve( "'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF8") || (d.stringToUTF8 = function() { ve("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF8") || (d.lengthBytesUTF8 = function() { ve("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF16ToString") || (d.UTF16ToString = function() { ve("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF16") || (d.stringToUTF16 = function() { ve("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF16") || (d.lengthBytesUTF16 = function() { ve( "'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF32ToString") || (d.UTF32ToString = function() { ve("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF32") || (d.stringToUTF32 = function() { ve("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF32") || (d.lengthBytesUTF32 = function() { ve( "'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "allocateUTF8") || (d.allocateUTF8 = function() { ve("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackTrace") || (d.stackTrace = function() { ve("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnPreRun") || (d.addOnPreRun = function() { ve("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnInit") || (d.addOnInit = function() { ve("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnPreMain") || (d.addOnPreMain = function() { ve("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnExit") || (d.addOnExit = function() { ve("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnPostRun") || (d.addOnPostRun = function() { ve("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "writeStringToMemory") || (d.writeStringToMemory = function() { ve( "'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "writeArrayToMemory") || (d.writeArrayToMemory = function() { ve( "'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "writeAsciiToMemory") || (d.writeAsciiToMemory = function() { ve( "'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addRunDependency") || (d.addRunDependency = function() { ve( "'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "removeRunDependency") || (d.removeRunDependency = function() { ve( "'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "ENV") || (d.ENV = function() { ve("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "FS") || (d.FS = function() { ve("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "FS_createFolder") || (d.FS_createFolder = function() { ve( "'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createPath") || (d.FS_createPath = function() { ve( "'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createDataFile") || (d.FS_createDataFile = function() { ve( "'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createPreloadedFile") || (d.FS_createPreloadedFile = function() { ve( "'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createLazyFile") || (d.FS_createLazyFile = function() { ve( "'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createLink") || (d.FS_createLink = function() { ve( "'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createDevice") || (d.FS_createDevice = function() { ve( "'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_unlink") || (d.FS_unlink = function() { ve( "'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "GL") || (d.GL = function() { ve("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "dynamicAlloc") || (d.dynamicAlloc = function() { ve("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "loadDynamicLibrary") || (d.loadDynamicLibrary = function() { ve( "'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "loadWebAssemblyModule") || (d.loadWebAssemblyModule = function() { ve( "'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getLEB") || (d.getLEB = function() { ve("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getFunctionTables") || (d.getFunctionTables = function() { ve( "'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "alignFunctionTables") || (d.alignFunctionTables = function() { ve( "'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "registerFunctions") || (d.registerFunctions = function() { ve( "'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.addFunction = function(e, t) { return I(void 0 !== e), k(e, t) }, Object.getOwnPropertyDescriptor(d, "removeFunction") || (d.removeFunction = function() { ve("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getFuncWrapper") || (d.getFuncWrapper = function() { ve("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "prettyPrint") || (d.prettyPrint = function() { ve("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "makeBigInt") || (d.makeBigInt = function() { ve("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "dynCall") || (d.dynCall = function() { ve("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getCompilerSetting") || (d.getCompilerSetting = function() { ve( "'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackSave") || (d.stackSave = function() { ve("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackRestore") || (d.stackRestore = function() { ve("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackAlloc") || (d.stackAlloc = function() { ve("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "establishStackSpace") || (d.establishStackSpace = function() { ve( "'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "print") || (d.print = function() { ve("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "printErr") || (d.printErr = function() { ve("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getTempRet0") || (d.getTempRet0 = function() { ve("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "setTempRet0") || (d.setTempRet0 = function() { ve("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.callMain = li, Object.getOwnPropertyDescriptor(d, "abort") || (d.abort = function() { ve("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "Pointer_stringify") || (d.Pointer_stringify = function() { ve( "'Pointer_stringify' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "warnOnce") || (d.warnOnce = function() { ve("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.writeStackCookie = Z, d.checkStackCookie = $, d.abortStackOverflow = function(e) { ve("Stack overflow! Attempted to allocate " + e + " bytes on the stack, but stack has only " + ( Y - ai() + e) + " bytes available!") }, Object.getOwnPropertyDescriptor(d, "ALLOC_NORMAL") || Object.defineProperty(d, "ALLOC_NORMAL", { configurable: !0, get: function() { ve( "'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "ALLOC_STACK") || Object.defineProperty(d, "ALLOC_STACK", { configurable: !0, get: function() { ve("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "ALLOC_DYNAMIC") || Object.defineProperty(d, "ALLOC_DYNAMIC", { configurable: !0, get: function() { ve( "'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "ALLOC_NONE") || Object.defineProperty(d, "ALLOC_NONE", { configurable: !0, get: function() { ve("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "calledRun") || Object.defineProperty(d, "calledRun", { configurable: !0, get: function() { ve( "'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") } }), fe = function e() { ti || di(), ti || (fe = e) }, d.run = di, d.preInit) for ("function" == typeof d.preInit && (d.preInit = [d.preInit]); d.preInit.length > 0;) d.preInit .pop()(); var ci = !0; d.noInitialRun && (ci = !1), s = !0, di() } t.default = function(e) { e.recordChunkData = null, e.recordChunkSize = 0, e.recordChunkPos = 0, e.exitFlag = !1, e .audioCodecId = 0, e.audioSamplerate = 8e3, e.audioChannelCount = 1, e.videoRawData = null, e .videoPTS = 0, e.audioPTS = 0, e.videoLastPts = 0, e.audioLastPts = 0, e.audioRawData = null, e .mp4CallbackFunc = null, d.onRuntimeInitialized = function() { u = !0 }, e.addEventListener("message", function(t) { var i = t.data; switch (i.cmd) { case o.w: l = i.url, e.audioSamplerate = i.audioSamplerate, e.audioChannelCount = i.channelCount, parseInt(e.audioSamplerate) >= 8e3 && (e.audioCodecId = 86018), u || c(), null == e .recordChunkData && (e.recordChunkData = new Uint8Array(i.filesize + 8388608), e .recordChunkSize = i.filesize), e.recordChunkPos = 0, e.exitFlag = !1; var r = { cmd: o.w }; e.postMessage(r); break; case o.l: e.exitFlag = !0, e.recordChunkData && (delete e.recordChunkData, e.recordChunkData = null), null != e.videoRawData && (d._free(e.videoRawData), e.videoRawData = null), null != e.audioRawData && (d._free(e.audioRawData), e.audioRawData = null); break; case o.C: if (null == e.recordChunkData) break; if (e.recordChunkData.byteLength < 1) break; e.exitFlag = !0, u && d._WasmDecoder_ReleaseMP4File(); break; case o.q: if (e.exitFlag) break; if (u && (null == e.videoRawData && (null == e.videoRawData && (e.videoRawData = d ._malloc(8294400)), null == e.audioRawData && (e.audioRawData = d._malloc(16384)), e.videoPTS = 0, e.videoLastPts = 0, e.audioPTS = 0, e.audioLastPts = 0, e .mp4CallbackFunc = d.addFunction(function(t, i, r, n) { if (3 == i) { var a = d.HEAPU8.subarray(r, r + 4); if (e.recordChunkData.set(a, n), e.recordChunkPos > e.recordChunkSize) { e.blob = URL.createObjectURL(new Blob([e.recordChunkData], { type: "video/mp4" })); var s = { cmd: o.p, type: "auto", dat: e.blob }; e.postMessage(s) } else { var u = e.recordChunkData.subarray(0, e.recordChunkPos), l = new Uint8Array(u); delete e.recordChunkData, e.recordChunkData = null, e.blob = URL .createObjectURL(new Blob([l], { type: "video/mp4" })), s = { cmd: o.p, type: "manual", dat: e.blob }, e.postMessage(s) } } else a = d.HEAPU8.subarray(r, r + n), e.recordChunkData.set(a, e .recordChunkPos), e.recordChunkPos += a.length }, "iiiii"), d._WasmDecoder_CreateMP4File(i.codecId, 0, 0, e.audioCodecId, e .audioSamplerate, e.audioChannelCount, e.mp4CallbackFunc, e)), e.recordChunkPos > 0 || i.type)) { i.type; var n = 1, a = e.videoPTS; if ("video" == i.mediaType) { if (e.videoLastPts < 1) e.videoPTS = 0; else { var s = i.pts - e.videoLastPts; e.videoPTS += s } e.videoLastPts = i.pts, a = e.videoPTS } else { if (n = 2, e.audioLastPts < 1) e.audioPTS = 0; else { var h = i.pts - e.audioLastPts; e.audioPTS += h } e.audioLastPts = i.pts, a = e.audioPTS } d.HEAPU8.set(i.dat, e.videoRawData), d._WasmDecoder_WriteData(n, e.videoRawData, i.dat .length, i.type, a), e.recordChunkPos + i.dat.byteLength > e.recordChunkSize && (e .exitFlag = !0, d._WasmDecoder_ReleaseMP4File()) } } }) } }.call(this, i(9), "/", i(68)(e), i(10).Buffer) }, function(e, t) { e.exports = function(e) { if (!e.webpackPolyfill) { var t = Object.create(e); t.children || (t.children = []), Object.defineProperty(t, "loaded", { enumerable: !0, get: function() { return t.l } }), Object.defineProperty(t, "id", { enumerable: !0, get: function() { return t.i } }), Object.defineProperty(t, "exports", { enumerable: !0 }), t.webpackPolyfill = 1 } return t } }, function(e, t) {}, function(e, t, i) { (function(e) { function i(e, t) { for (var i = 0, r = e.length - 1; r >= 0; r--) { var n = e[r]; "." === n ? e.splice(r, 1) : ".." === n ? (e.splice(r, 1), i++) : i && (e.splice(r, 1), i--) } if (t) for (; i--; i) e.unshift(".."); return e } function r(e, t) { if (e.filter) return e.filter(t); for (var i = [], r = 0; r < e.length; r++) t(e[r], r, e) && i.push(e[r]); return i } t.resolve = function() { for (var t = "", n = !1, a = arguments.length - 1; a >= -1 && !n; a--) { var s = a >= 0 ? arguments[a] : e.cwd(); if ("string" != typeof s) throw new TypeError("Arguments to path.resolve must be strings"); s && (t = s + "/" + t, n = "/" === s.charAt(0)) } return (n ? "/" : "") + (t = i(r(t.split("/"), function(e) { return !!e }), !n).join("/")) || "." }, t.normalize = function(e) { var a = t.isAbsolute(e), s = "/" === n(e, -1); return (e = i(r(e.split("/"), function(e) { return !!e }), !a).join("/")) || a || (e = "."), e && s && (e += "/"), (a ? "/" : "") + e }, t.isAbsolute = function(e) { return "/" === e.charAt(0) }, t.join = function() { var e = Array.prototype.slice.call(arguments, 0); return t.normalize(r(e, function(e, t) { if ("string" != typeof e) throw new TypeError("Arguments to path.join must be strings"); return e }).join("/")) }, t.relative = function(e, i) { function r(e) { for (var t = 0; t < e.length && "" === e[t]; t++); for (var i = e.length - 1; i >= 0 && "" === e[i]; i--); return t > i ? [] : e.slice(t, i - t + 1) } e = t.resolve(e).substr(1), i = t.resolve(i).substr(1); for (var n = r(e.split("/")), a = r(i.split("/")), s = Math.min(n.length, a.length), o = s, u = 0; u < s; u++) if (n[u] !== a[u]) { o = u; break } var l = []; for (u = o; u < n.length; u++) l.push(".."); return (l = l.concat(a.slice(o))).join("/") }, t.sep = "/", t.delimiter = ":", t.dirname = function(e) { if ("string" != typeof e && (e += ""), 0 === e.length) return "."; for (var t = e.charCodeAt(0), i = 47 === t, r = -1, n = !0, a = e.length - 1; a >= 1; --a) if (47 === (t = e.charCodeAt(a))) { if (!n) { r = a; break } } else n = !1; return -1 === r ? i ? "/" : "." : i && 1 === r ? "/" : e.slice(0, r) }, t.basename = function(e, t) { var i = function(e) { "string" != typeof e && (e += ""); var t, i = 0, r = -1, n = !0; for (t = e.length - 1; t >= 0; --t) if (47 === e.charCodeAt(t)) { if (!n) { i = t + 1; break } } else -1 === r && (n = !1, r = t + 1); return -1 === r ? "" : e.slice(i, r) }(e); return t && i.substr(-1 * t.length) === t && (i = i.substr(0, i.length - t.length)), i }, t.extname = function(e) { "string" != typeof e && (e += ""); for (var t = -1, i = 0, r = -1, n = !0, a = 0, s = e.length - 1; s >= 0; --s) { var o = e.charCodeAt(s); if (47 !== o) - 1 === r && (n = !1, r = s + 1), 46 === o ? -1 === t ? t = s : 1 !== a && (a = 1) : -1 !== t && (a = -1); else if (!n) { i = s + 1; break } } return -1 === t || -1 === r || 0 === a || 1 === a && t === r - 1 && t === i + 1 ? "" : e.slice(t, r) }; var n = "b" === "ab".substr(-1) ? function(e, t, i) { return e.substr(t, i) } : function(e, t, i) { return t < 0 && (t = e.length + t), e.substr(t, i) } }).call(this, i(9)) }, function(e, t, i) { "use strict"; t.randomBytes = t.rng = t.pseudoRandomBytes = t.prng = i(24), t.createHash = t.Hash = i(31), t.createHmac = t.Hmac = i(85); var r = i(160), n = Object.keys(r), a = ["sha1", "sha224", "sha256", "sha384", "sha512", "md5", "rmd160"].concat(n); t.getHashes = function() { return a }; var s = i(88); t.pbkdf2 = s.pbkdf2, t.pbkdf2Sync = s.pbkdf2Sync; var o = i(162); t.Cipher = o.Cipher, t.createCipher = o.createCipher, t.Cipheriv = o.Cipheriv, t.createCipheriv = o .createCipheriv, t.Decipher = o.Decipher, t.createDecipher = o.createDecipher, t.Decipheriv = o .Decipheriv, t.createDecipheriv = o.createDecipheriv, t.getCiphers = o.getCiphers, t.listCiphers = o .listCiphers; var u = i(177); t.DiffieHellmanGroup = u.DiffieHellmanGroup, t.createDiffieHellmanGroup = u.createDiffieHellmanGroup, t .getDiffieHellman = u.getDiffieHellman, t.createDiffieHellman = u.createDiffieHellman, t.DiffieHellman = u .DiffieHellman; var l = i(182); t.createSign = l.createSign, t.Sign = l.Sign, t.createVerify = l.createVerify, t.Verify = l.Verify, t .createECDH = i(223); var d = i(224); t.publicEncrypt = d.publicEncrypt, t.privateEncrypt = d.privateEncrypt, t.publicDecrypt = d.publicDecrypt, t .privateDecrypt = d.privateDecrypt; var c = i(227); t.randomFill = c.randomFill, t.randomFillSync = c.randomFillSync, t.createCredentials = function() { throw new Error(["sorry, createCredentials is not implemented yet", "we accept pull requests", "https://github.com/crypto-browserify/crypto-browserify" ].join("\n")) }, t.constants = { DH_CHECK_P_NOT_SAFE_PRIME: 2, DH_CHECK_P_NOT_PRIME: 1, DH_UNABLE_TO_CHECK_GENERATOR: 4, DH_NOT_SUITABLE_GENERATOR: 8, NPN_ENABLED: 1, ALPN_ENABLED: 1, RSA_PKCS1_PADDING: 1, RSA_SSLV23_PADDING: 2, RSA_NO_PADDING: 3, RSA_PKCS1_OAEP_PADDING: 4, RSA_X931_PADDING: 5, RSA_PKCS1_PSS_PADDING: 6, POINT_CONVERSION_COMPRESSED: 2, POINT_CONVERSION_UNCOMPRESSED: 4, POINT_CONVERSION_HYBRID: 6 } }, function(e, t, i) { "use strict"; var r = i(6).Buffer, n = i(136).Transform; function a(e) { n.call(this), this._block = r.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [ 0, 0, 0, 0 ], this._finalized = !1 } i(5)(a, n), a.prototype._transform = function(e, t, i) { var r = null; try { this.update(e, t) } catch (e) { r = e } i(r) }, a.prototype._flush = function(e) { var t = null; try { this.push(this.digest()) } catch (e) { t = e } e(t) }, a.prototype.update = function(e, t) { if (function(e, t) { if (!r.isBuffer(e) && "string" != typeof e) throw new TypeError("Data must be a string or a buffer") }(e), this._finalized) throw new Error("Digest already called"); r.isBuffer(e) || (e = r.from(e, t)); for (var i = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize;) { for (var a = this._blockOffset; a < this._blockSize;) i[a++] = e[n++]; this._update(), this._blockOffset = 0 } for (; n < e.length;) i[this._blockOffset++] = e[n++]; for (var s = 0, o = 8 * e.length; o > 0; ++s) this._length[s] += o, (o = this._length[s] / 4294967296 | 0) > 0 && (this._length[s] -= 4294967296 * o); return this }, a.prototype._update = function() { throw new Error("_update is not implemented") }, a.prototype.digest = function(e) { if (this._finalized) throw new Error("Digest already called"); this._finalized = !0; var t = this._digest(); void 0 !== e && (t = t.toString(e)), this._block.fill(0), this._blockOffset = 0; for (var i = 0; i < 4; ++i) this._length[i] = 0; return t }, a.prototype._digest = function() { throw new Error("_digest is not implemented") }, e.exports = a }, function(e, t, i) { "use strict"; (function(t, r) { var n; e.exports = A, A.ReadableState = S, i(8).EventEmitter; var a, s = function(e, t) { return e.listeners(t).length }, o = i(74), u = i(10).Buffer, l = t.Uint8Array || function() {}, d = i(137); a = d && d.debuglog ? d.debuglog("stream") : function() {}; var c, h, f, p = i(138), m = i(75), g = i(76).getHighWaterMark, v = i(25).codes, y = v.ERR_INVALID_ARG_TYPE, _ = v.ERR_STREAM_PUSH_AFTER_EOF, b = v.ERR_METHOD_NOT_IMPLEMENTED, w = v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; i(5)(A, o); var E = m.errorOrDestroy, T = ["error", "close", "destroy", "pause", "resume"]; function S(e, t, r) { n = n || i(26), e = e || {}, "boolean" != typeof r && (r = t instanceof n), this.objectMode = !!e .objectMode, r && (this.objectMode = this.objectMode || !!e.readableObjectMode), this .highWaterMark = g(this, e, "readableHighWaterMark", r), this.buffer = new p, this.length = 0, this .pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this .reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this .readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = !1 !== e .emitClose, this.autoDestroy = !!e.autoDestroy, this.destroyed = !1, this.defaultEncoding = e .defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this .encoding = null, e.encoding && (c || (c = i(22).StringDecoder), this.decoder = new c(e.encoding), this.encoding = e.encoding) } function A(e) { if (n = n || i(26), !(this instanceof A)) return new A(e); var t = this instanceof n; this._readableState = new S(e, this, t), this.readable = !0, e && ("function" == typeof e.read && ( this._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), o.call(this) } function k(e, t, i, r, n) { a("readableAddChunk", t); var s, o = e._readableState; if (null === t) o.reading = !1, function(e, t) { if (a("onEofChunk"), !t.ended) { if (t.decoder) { var i = t.decoder.end(); i && i.length && (t.buffer.push(i), t.length += t.objectMode ? 1 : i.length) } t.ended = !0, t.sync ? O(e) : (t.needReadable = !1, t.emittedReadable || (t.emittedReadable = ! 0, C(e))) } }(e, o); else if (n || (s = function(e, t) { var i, r; return r = t, u.isBuffer(r) || r instanceof l || "string" == typeof t || void 0 === t || e .objectMode || (i = new y("chunk", ["string", "Buffer", "Uint8Array"], t)), i }(o, t)), s) E(e, s); else if (o.objectMode || t && t.length > 0) if ("string" == typeof t || o.objectMode || Object.getPrototypeOf(t) === u.prototype || (t = function(e) { return u.from(e) }(t)), r) o.endEmitted ? E(e, new w) : R(e, o, t, !0); else if (o.ended) E(e, new _); else { if (o.destroyed) return !1; o.reading = !1, o.decoder && !i ? (t = o.decoder.write(t), o.objectMode || 0 !== t.length ? R(e, o, t, !1) : D(e, o)) : R(e, o, t, !1) } else r || (o.reading = !1, D(e, o)); return !o.ended && (o.length < o.highWaterMark || 0 === o.length) } function R(e, t, i, r) { t.flowing && 0 === t.length && !t.sync ? (t.awaitDrain = 0, e.emit("data", i)) : (t.length += t .objectMode ? 1 : i.length, r ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && O(e)), D(e, t) } function M(e, t) { return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t .buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function(e) { return e >= 1073741824 ? e = 1073741824 : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>> 8, e |= e >>> 16, e++), e }(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0)) } function O(e) { var t = e._readableState; a("emitReadable", t.needReadable, t.emittedReadable), t.needReadable = !1, t.emittedReadable || (a( "emitReadable", t.flowing), t.emittedReadable = !0, r.nextTick(C, e)) } function C(e) { var t = e._readableState; a("emitReadable_", t.destroyed, t.length, t.ended), t.destroyed || !t.length && !t.ended || (e.emit( "readable"), t.emittedReadable = !1), t.needReadable = !t.flowing && !t.ended && t.length <= t .highWaterMark, U(e) } function D(e, t) { t.readingMore || (t.readingMore = !0, r.nextTick(I, e, t)) } function I(e, t) { for (; !t.reading && !t.ended && (t.length < t.highWaterMark || t.flowing && 0 === t.length);) { var i = t.length; if (a("maybeReadMore read 0"), e.read(0), i === t.length) break } t.readingMore = !1 } function L(e) { var t = e._readableState; t.readableListening = e.listenerCount("readable") > 0, t.resumeScheduled && !t.paused ? t.flowing = ! 0 : e.listenerCount("data") > 0 && e.resume() } function x(e) { a("readable nexttick read 0"), e.read(0) } function P(e, t) { a("resume", t.reading), t.reading || e.read(0), t.resumeScheduled = !1, e.emit("resume"), U(e), t .flowing && !t.reading && e.read(0) } function U(e) { var t = e._readableState; for (a("flow", t.flowing); t.flowing && null !== e.read();); } function N(e, t) { return 0 === t.length ? null : (t.objectMode ? i = t.buffer.shift() : !e || e >= t.length ? (i = t .decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.first() : t.buffer.concat(t .length), t.buffer.clear()) : i = t.buffer.consume(e, t.decoder), i); var i } function B(e) { var t = e._readableState; a("endReadable", t.endEmitted), t.endEmitted || (t.ended = !0, r.nextTick(F, t, e)) } function F(e, t) { if (a("endReadableNT", e.endEmitted, e.length), !e.endEmitted && 0 === e.length && (e.endEmitted = !0, t.readable = !1, t.emit("end"), e.autoDestroy)) { var i = t._writableState; (!i || i.autoDestroy && i.finished) && t.destroy() } } function j(e, t) { for (var i = 0, r = e.length; i < r; i++) if (e[i] === t) return i; return -1 } Object.defineProperty(A.prototype, "destroyed", { enumerable: !1, get: function() { return void 0 !== this._readableState && this._readableState.destroyed }, set: function(e) { this._readableState && (this._readableState.destroyed = e) } }), A.prototype.destroy = m.destroy, A.prototype._undestroy = m.undestroy, A.prototype._destroy = function(e, t) { t(e) }, A.prototype.push = function(e, t) { var i, r = this._readableState; return r.objectMode ? i = !0 : "string" == typeof e && ((t = t || r.defaultEncoding) !== r .encoding && (e = u.from(e, t), t = ""), i = !0), k(this, e, t, !1, i) }, A.prototype.unshift = function(e) { return k(this, e, null, !0, !1) }, A.prototype.isPaused = function() { return !1 === this._readableState.flowing }, A.prototype.setEncoding = function(e) { c || (c = i(22).StringDecoder); var t = new c(e); this._readableState.decoder = t, this._readableState.encoding = this._readableState.decoder .encoding; for (var r = this._readableState.buffer.head, n = ""; null !== r;) n += t.write(r.data), r = r.next; return this._readableState.buffer.clear(), "" !== n && this._readableState.buffer.push(n), this ._readableState.length = n.length, this }, A.prototype.read = function(e) { a("read", e), e = parseInt(e, 10); var t = this._readableState, i = e; if (0 !== e && (t.emittedReadable = !1), 0 === e && t.needReadable && ((0 !== t.highWaterMark ? t .length >= t.highWaterMark : t.length > 0) || t.ended)) return a("read: emitReadable", t.length, t.ended), 0 === t.length && t.ended ? B(this) : O(this), null; if (0 === (e = M(e, t)) && t.ended) return 0 === t.length && B(this), null; var r, n = t.needReadable; return a("need readable", n), (0 === t.length || t.length - e < t.highWaterMark) && a( "length less than watermark", n = !0), t.ended || t.reading ? a("reading or ended", n = !1) : n && (a("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this ._read(t.highWaterMark), t.sync = !1, t.reading || (e = M(i, t))), null === (r = e > 0 ? N(e, t) : null) ? (t.needReadable = t.length <= t.highWaterMark, e = 0) : (t.length -= e, t .awaitDrain = 0), 0 === t.length && (t.ended || (t.needReadable = !0), i !== e && t.ended && B( this)), null !== r && this.emit("data", r), r }, A.prototype._read = function(e) { E(this, new b("_read()")) }, A.prototype.pipe = function(e, t) { var i = this, n = this._readableState; switch (n.pipesCount) { case 0: n.pipes = e; break; case 1: n.pipes = [n.pipes, e]; break; default: n.pipes.push(e) } n.pipesCount += 1, a("pipe count=%d opts=%j", n.pipesCount, t); var o = t && !1 === t.end || e === r.stdout || e === r.stderr ? m : u; function u() { a("onend"), e.end() } n.endEmitted ? r.nextTick(o) : i.once("end", o), e.on("unpipe", function t(r, s) { a("onunpipe"), r === i && s && !1 === s.hasUnpiped && (s.hasUnpiped = !0, a("cleanup"), e .removeListener("close", f), e.removeListener("finish", p), e.removeListener("drain", l), e.removeListener("error", h), e.removeListener("unpipe", t), i.removeListener("end", u), i .removeListener("end", m), i.removeListener("data", c), d = !0, !n.awaitDrain || e ._writableState && !e._writableState.needDrain || l()) }); var l = function(e) { return function() { var t = e._readableState; a("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && s(e, "data") && (t.flowing = !0, U(e)) } }(i); e.on("drain", l); var d = !1; function c(t) { a("ondata"); var r = e.write(t); a("dest.write", r), !1 === r && ((1 === n.pipesCount && n.pipes === e || n.pipesCount > 1 && - 1 !== j(n.pipes, e)) && !d && (a("false write response, pause", n.awaitDrain), n .awaitDrain++), i.pause()) } function h(t) { a("onerror", t), m(), e.removeListener("error", h), 0 === s(e, "error") && E(e, t) } function f() { e.removeListener("finish", p), m() } function p() { a("onfinish"), e.removeListener("close", f), m() } function m() { a("unpipe"), i.unpipe(e) } return i.on("data", c), function(e, t, i) { if ("function" == typeof e.prependListener) return e.prependListener(t, i); e._events && e._events[t] ? Array.isArray(e._events[t]) ? e._events[t].unshift(i) : e._events[ t] = [i, e._events[t]] : e.on(t, i) }(e, "error", h), e.once("close", f), e.once("finish", p), e.emit("pipe", i), n.flowing || (a( "pipe resume"), i.resume()), e }, A.prototype.unpipe = function(e) { var t = this._readableState, i = { hasUnpiped: !1 }; if (0 === t.pipesCount) return this; if (1 === t.pipesCount) return e && e !== t.pipes || (e || (e = t.pipes), t.pipes = null, t .pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this, i)), this; if (!e) { var r = t.pipes, n = t.pipesCount; t.pipes = null, t.pipesCount = 0, t.flowing = !1; for (var a = 0; a < n; a++) r[a].emit("unpipe", this, { hasUnpiped: !1 }); return this } var s = j(t.pipes, e); return -1 === s || (t.pipes.splice(s, 1), t.pipesCount -= 1, 1 === t.pipesCount && (t.pipes = t .pipes[0]), e.emit("unpipe", this, i)), this }, A.prototype.on = function(e, t) { var i = o.prototype.on.call(this, e, t), n = this._readableState; return "data" === e ? (n.readableListening = this.listenerCount("readable") > 0, !1 !== n.flowing && this.resume()) : "readable" === e && (n.endEmitted || n.readableListening || (n .readableListening = n.needReadable = !0, n.flowing = !1, n.emittedReadable = !1, a( "on readable", n.length, n.reading), n.length ? O(this) : n.reading || r.nextTick(x, this))), i }, A.prototype.addListener = A.prototype.on, A.prototype.removeListener = function(e, t) { var i = o.prototype.removeListener.call(this, e, t); return "readable" === e && r.nextTick(L, this), i }, A.prototype.removeAllListeners = function(e) { var t = o.prototype.removeAllListeners.apply(this, arguments); return "readable" !== e && void 0 !== e || r.nextTick(L, this), t }, A.prototype.resume = function() { var e = this._readableState; return e.flowing || (a("resume"), e.flowing = !e.readableListening, function(e, t) { t.resumeScheduled || (t.resumeScheduled = !0, r.nextTick(P, e, t)) }(this, e)), e.paused = !1, this }, A.prototype.pause = function() { return a("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState .flowing && (a("pause"), this._readableState.flowing = !1, this.emit("pause")), this ._readableState.paused = !0, this }, A.prototype.wrap = function(e) { var t = this, i = this._readableState, r = !1; for (var n in e.on("end", function() { if (a("wrapped end"), i.decoder && !i.ended) { var e = i.decoder.end(); e && e.length && t.push(e) } t.push(null) }), e.on("data", function(n) { a("wrapped data"), i.decoder && (n = i.decoder.write(n)), i.objectMode && null == n || (i .objectMode || n && n.length) && (t.push(n) || (r = !0, e.pause())) }), e) void 0 === this[n] && "function" == typeof e[n] && (this[n] = function(t) { return function() { return e[t].apply(e, arguments) } }(n)); for (var s = 0; s < T.length; s++) e.on(T[s], this.emit.bind(this, T[s])); return this._read = function(t) { a("wrapped _read", t), r && (r = !1, e.resume()) }, this }, "function" == typeof Symbol && (A.prototype[Symbol.asyncIterator] = function() { return void 0 === h && (h = i(140)), h(this) }), Object.defineProperty(A.prototype, "readableHighWaterMark", { enumerable: !1, get: function() { return this._readableState.highWaterMark } }), Object.defineProperty(A.prototype, "readableBuffer", { enumerable: !1, get: function() { return this._readableState && this._readableState.buffer } }), Object.defineProperty(A.prototype, "readableFlowing", { enumerable: !1, get: function() { return this._readableState.flowing }, set: function(e) { this._readableState && (this._readableState.flowing = e) } }), A._fromList = N, Object.defineProperty(A.prototype, "readableLength", { enumerable: !1, get: function() { return this._readableState.length } }), "function" == typeof Symbol && (A.from = function(e, t) { return void 0 === f && (f = i(141)), f(A, e, t) }) }).call(this, i(13), i(9)) }, function(e, t, i) { e.exports = i(8).EventEmitter }, function(e, t, i) { "use strict"; (function(t) { function i(e, t) { n(e, t), r(e) } function r(e) { e._writableState && !e._writableState.emitClose || e._readableState && !e._readableState.emitClose || e.emit("close") } function n(e, t) { e.emit("error", t) } e.exports = { destroy: function(e, a) { var s = this, o = this._readableState && this._readableState.destroyed, u = this._writableState && this._writableState.destroyed; return o || u ? (a ? a(e) : e && (this._writableState ? this._writableState.errorEmitted || ( this._writableState.errorEmitted = !0, t.nextTick(n, this, e)) : t.nextTick(n, this, e)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(e || null, function(e) { !a && e ? s._writableState ? s._writableState.errorEmitted ? t.nextTick(r, s) : (s ._writableState.errorEmitted = !0, t.nextTick(i, s, e)) : t.nextTick(i, s, e) : a ? (t.nextTick(r, s), a(e)) : t.nextTick(r, s) }), this) }, undestroy: function() { this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState .ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1) }, errorOrDestroy: function(e, t) { var i = e._readableState, r = e._writableState; i && i.autoDestroy || r && r.autoDestroy ? e.destroy(t) : e.emit("error", t) } } }).call(this, i(9)) }, function(e, t, i) { "use strict"; var r = i(25).codes.ERR_INVALID_OPT_VALUE; e.exports = { getHighWaterMark: function(e, t, i, n) { var a = function(e, t, i) { return null != e.highWaterMark ? e.highWaterMark : t ? e[i] : null }(t, n, i); if (null != a) { if (!isFinite(a) || Math.floor(a) !== a || a < 0) throw new r(n ? i : "highWaterMark", a); return Math.floor(a) } return e.objectMode ? 16 : 16384 } } }, function(e, t, i) { "use strict"; (function(t, r) { function n(e) { var t = this; this.next = null, this.entry = null, this.finish = function() { ! function(e, t, i) { var r = e.entry; for (e.entry = null; r;) { var n = r.callback; t.pendingcb--, n(void 0), r = r.next } t.corkedRequestsFree.next = e }(t, e) } } var a; e.exports = A, A.WritableState = S; var s, o = { deprecate: i(45) }, u = i(74), l = i(10).Buffer, d = t.Uint8Array || function() {}, c = i(75), h = i(76).getHighWaterMark, f = i(25).codes, p = f.ERR_INVALID_ARG_TYPE, m = f.ERR_METHOD_NOT_IMPLEMENTED, g = f.ERR_MULTIPLE_CALLBACK, v = f.ERR_STREAM_CANNOT_PIPE, y = f.ERR_STREAM_DESTROYED, _ = f.ERR_STREAM_NULL_VALUES, b = f.ERR_STREAM_WRITE_AFTER_END, w = f.ERR_UNKNOWN_ENCODING, E = c.errorOrDestroy; function T() {} function S(e, t, s) { a = a || i(26), e = e || {}, "boolean" != typeof s && (s = t instanceof a), this.objectMode = !!e .objectMode, s && (this.objectMode = this.objectMode || !!e.writableObjectMode), this .highWaterMark = h(this, e, "writableHighWaterMark", s), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1; var o = !1 === e.decodeStrings; this.decodeStrings = !o, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this .writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function( e) { ! function(e, t) { var i = e._writableState, n = i.sync, a = i.writecb; if ("function" != typeof a) throw new g; if (function(e) { e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0 }(i), t) ! function(e, t, i, n, a) { --t.pendingcb, i ? (r.nextTick(a, n), r.nextTick(D, e, t), e._writableState.errorEmitted = ! 0, E(e, n)) : (a(n), e._writableState.errorEmitted = !0, E(e, n), D(e, t)) }(e, i, n, t, a); else { var s = O(i) || e.destroyed; s || i.corked || i.bufferProcessing || !i.bufferedRequest || M(e, i), n ? r.nextTick(R, e, i, s, a) : R(e, i, s, a) } }(t, e) }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !1 !== e .emitClose, this.autoDestroy = !!e.autoDestroy, this.bufferedRequestCount = 0, this .corkedRequestsFree = new n(this) } function A(e) { var t = this instanceof(a = a || i(26)); if (!t && !s.call(A, this)) return new A(e); this._writableState = new S(e, this, t), this.writable = !0, e && ("function" == typeof e.write && ( this._write = e.write), "function" == typeof e.writev && (this._writev = e.writev), "function" == typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && ( this._final = e.final)), u.call(this) } function k(e, t, i, r, n, a, s) { t.writelen = r, t.writecb = s, t.writing = !0, t.sync = !0, t.destroyed ? t.onwrite(new y("write")) : i ? e._writev(n, t.onwrite) : e._write(n, a, t.onwrite), t.sync = !1 } function R(e, t, i, r) { i || function(e, t) { 0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain")) }(e, t), t.pendingcb--, r(), D(e, t) } function M(e, t) { t.bufferProcessing = !0; var i = t.bufferedRequest; if (e._writev && i && i.next) { var r = t.bufferedRequestCount, a = new Array(r), s = t.corkedRequestsFree; s.entry = i; for (var o = 0, u = !0; i;) a[o] = i, i.isBuf || (u = !1), i = i.next, o += 1; a.allBuffers = u, k(e, t, !0, t.length, a, "", s.finish), t.pendingcb++, t.lastBufferedRequest = null, s.next ? (t.corkedRequestsFree = s.next, s.next = null) : t.corkedRequestsFree = new n(t), t .bufferedRequestCount = 0 } else { for (; i;) { var l = i.chunk, d = i.encoding, c = i.callback; if (k(e, t, !1, t.objectMode ? 1 : l.length, l, d, c), i = i.next, t.bufferedRequestCount--, t .writing) break } null === i && (t.lastBufferedRequest = null) } t.bufferedRequest = i, t.bufferProcessing = !1 } function O(e) { return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing } function C(e, t) { e._final(function(i) { t.pendingcb--, i && E(e, i), t.prefinished = !0, e.emit("prefinish"), D(e, t) }) } function D(e, t) { var i = O(t); if (i && (function(e, t) { t.prefinished || t.finalCalled || ("function" != typeof e._final || t.destroyed ? (t .prefinished = !0, e.emit("prefinish")) : (t.pendingcb++, t.finalCalled = !0, r.nextTick( C, e, t))) }(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"), t.autoDestroy))) { var n = e._readableState; (!n || n.autoDestroy && n.endEmitted) && e.destroy() } return i } i(5)(A, u), S.prototype.getBuffer = function() { for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next; return t }, function() { try { Object.defineProperty(S.prototype, "buffer", { get: o.deprecate(function() { return this.getBuffer() }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }) } catch (e) {} }(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[ Symbol.hasInstance] ? (s = Function.prototype[Symbol.hasInstance], Object.defineProperty(A, Symbol .hasInstance, { value: function(e) { return !!s.call(this, e) || this === A && e && e._writableState instanceof S } })) : s = function(e) { return e instanceof this }, A.prototype.pipe = function() { E(this, new v) }, A.prototype.write = function(e, t, i) { var n, a = this._writableState, s = !1, o = !a.objectMode && (n = e, l.isBuffer(n) || n instanceof d); return o && !l.isBuffer(e) && (e = function(e) { return l.from(e) }(e)), "function" == typeof t && (i = t, t = null), o ? t = "buffer" : t || (t = a .defaultEncoding), "function" != typeof i && (i = T), a.ending ? function(e, t) { var i = new b; E(e, i), r.nextTick(t, i) }(this, i) : (o || function(e, t, i, n) { var a; return null === i ? a = new _ : "string" == typeof i || t.objectMode || (a = new p("chunk", [ "string", "Buffer" ], i)), !a || (E(e, a), r.nextTick(n, a), !1) }(this, a, e, i)) && (a.pendingcb++, s = function(e, t, i, r, n, a) { if (!i) { var s = function(e, t, i) { return e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = l.from(t, i)), t }(t, r, n); r !== s && (i = !0, n = "buffer", r = s) } var o = t.objectMode ? 1 : r.length; t.length += o; var u = t.length < t.highWaterMark; if (u || (t.needDrain = !0), t.writing || t.corked) { var d = t.lastBufferedRequest; t.lastBufferedRequest = { chunk: r, encoding: n, isBuf: i, callback: a, next: null }, d ? d.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t .bufferedRequestCount += 1 } else k(e, t, !1, o, r, n, a); return u }(this, a, o, e, t, i)), s }, A.prototype.cork = function() { this._writableState.corked++ }, A.prototype.uncork = function() { var e = this._writableState; e.corked && (e.corked--, e.writing || e.corked || e.bufferProcessing || !e.bufferedRequest || M( this, e)) }, A.prototype.setDefaultEncoding = function(e) { if ("string" == typeof e && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw" ].indexOf((e + "").toLowerCase()) > -1)) throw new w(e); return this._writableState.defaultEncoding = e, this }, Object.defineProperty(A.prototype, "writableBuffer", { enumerable: !1, get: function() { return this._writableState && this._writableState.getBuffer() } }), Object.defineProperty(A.prototype, "writableHighWaterMark", { enumerable: !1, get: function() { return this._writableState.highWaterMark } }), A.prototype._write = function(e, t, i) { i(new m("_write()")) }, A.prototype._writev = null, A.prototype.end = function(e, t, i) { var n = this._writableState; return "function" == typeof e ? (i = e, e = null, t = null) : "function" == typeof t && (i = t, t = null), null != e && this.write(e, t), n.corked && (n.corked = 1, this.uncork()), n.ending || function(e, t, i) { t.ending = !0, D(e, t), i && (t.finished ? r.nextTick(i) : e.once("finish", i)), t.ended = !0, e .writable = !1 }(this, n, i), this }, Object.defineProperty(A.prototype, "writableLength", { enumerable: !1, get: function() { return this._writableState.length } }), Object.defineProperty(A.prototype, "destroyed", { enumerable: !1, get: function() { return void 0 !== this._writableState && this._writableState.destroyed }, set: function(e) { this._writableState && (this._writableState.destroyed = e) } }), A.prototype.destroy = c.destroy, A.prototype._undestroy = c.undestroy, A.prototype._destroy = function(e, t) { t(e) } }).call(this, i(13), i(9)) }, function(e, t, i) { "use strict"; e.exports = l; var r = i(25).codes, n = r.ERR_METHOD_NOT_IMPLEMENTED, a = r.ERR_MULTIPLE_CALLBACK, s = r.ERR_TRANSFORM_ALREADY_TRANSFORMING, o = r.ERR_TRANSFORM_WITH_LENGTH_0, u = i(26); function l(e) { if (!(this instanceof l)) return new l(e); u.call(this, e), this._transformState = { afterTransform: function(e, t) { var i = this._transformState; i.transforming = !1; var r = i.writecb; if (null === r) return this.emit("error", new a); i.writechunk = null, i.writecb = null, null != t && this.push(t), r(e); var n = this._readableState; n.reading = !1, (n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark) }.bind(this), needTransform: !1, transforming: !1, writecb: null, writechunk: null, writeencoding: null }, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e .transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush) ), this.on("prefinish", d) } function d() { var e = this; "function" != typeof this._flush || this._readableState.destroyed ? c(this, null, null) : this._flush( function(t, i) { c(e, t, i) }) } function c(e, t, i) { if (t) return e.emit("error", t); if (null != i && e.push(i), e._writableState.length) throw new o; if (e._transformState.transforming) throw new s; return e.push(null) } i(5)(l, u), l.prototype.push = function(e, t) { return this._transformState.needTransform = !1, u.prototype.push.call(this, e, t) }, l.prototype._transform = function(e, t, i) { i(new n("_transform()")) }, l.prototype._write = function(e, t, i) { var r = this._transformState; if (r.writecb = i, r.writechunk = e, r.writeencoding = t, !r.transforming) { var n = this._readableState; (r.needTransform || n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark) } }, l.prototype._read = function(e) { var t = this._transformState; null === t.writechunk || t.transforming ? t.needTransform = !0 : (t.transforming = !0, this._transform(t .writechunk, t.writeencoding, t.afterTransform)) }, l.prototype._destroy = function(e, t) { u.prototype._destroy.call(this, e, function(e) { t(e) }) } }, function(e, t, i) { var r = i(5), n = i(27), a = i(6).Buffer, s = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ], o = new Array(64); function u() { this.init(), this._w = o, n.call(this, 64, 56) } function l(e, t, i) { return i ^ e & (t ^ i) } function d(e, t, i) { return e & t | i & (e | t) } function c(e) { return (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10) } function h(e) { return (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7) } function f(e) { return (e >>> 7 | e << 25) ^ (e >>> 18 | e << 14) ^ e >>> 3 } r(u, n), u.prototype.init = function() { return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this }, u.prototype._update = function(e) { for (var t, i = this._w, r = 0 | this._a, n = 0 | this._b, a = 0 | this._c, o = 0 | this._d, u = 0 | this._e, p = 0 | this._f, m = 0 | this._g, g = 0 | this._h, v = 0; v < 16; ++v) i[v] = e .readInt32BE(4 * v); for (; v < 64; ++v) i[v] = 0 | (((t = i[v - 2]) >>> 17 | t << 15) ^ (t >>> 19 | t << 13) ^ t >>> 10) + i[v - 7] + f(i[v - 15]) + i[v - 16]; for (var y = 0; y < 64; ++y) { var _ = g + h(u) + l(u, p, m) + s[y] + i[y] | 0, b = c(r) + d(r, n, a) | 0; g = m, m = p, p = u, u = o + _ | 0, o = a, a = n, n = r, r = _ + b | 0 } this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = a + this._c | 0, this._d = o + this._d | 0, this._e = u + this._e | 0, this._f = p + this._f | 0, this._g = m + this._g | 0, this._h = g + this ._h | 0 }, u.prototype._hash = function() { var e = a.allocUnsafe(32); return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e .writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE( this._g, 24), e.writeInt32BE(this._h, 28), e }, e.exports = u }, function(e, t, i) { var r = i(5), n = i(27), a = i(6).Buffer, s = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591 ], o = new Array(160); function u() { this.init(), this._w = o, n.call(this, 128, 112) } function l(e, t, i) { return i ^ e & (t ^ i) } function d(e, t, i) { return e & t | i & (e | t) } function c(e, t) { return (e >>> 28 | t << 4) ^ (t >>> 2 | e << 30) ^ (t >>> 7 | e << 25) } function h(e, t) { return (e >>> 14 | t << 18) ^ (e >>> 18 | t << 14) ^ (t >>> 9 | e << 23) } function f(e, t) { return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ e >>> 7 } function p(e, t) { return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ (e >>> 7 | t << 25) } function m(e, t) { return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ e >>> 6 } function g(e, t) { return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ (e >>> 6 | t << 26) } function v(e, t) { return e >>> 0 < t >>> 0 ? 1 : 0 } r(u, n), u.prototype.init = function() { return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this ._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this }, u.prototype._update = function(e) { for (var t = this._w, i = 0 | this._ah, r = 0 | this._bh, n = 0 | this._ch, a = 0 | this._dh, o = 0 | this._eh, u = 0 | this._fh, y = 0 | this._gh, _ = 0 | this._hh, b = 0 | this._al, w = 0 | this._bl, E = 0 | this._cl, T = 0 | this._dl, S = 0 | this._el, A = 0 | this._fl, k = 0 | this._gl, R = 0 | this._hl, M = 0; M < 32; M += 2) t[M] = e.readInt32BE(4 * M), t[M + 1] = e.readInt32BE(4 * M + 4); for (; M < 160; M += 2) { var O = t[M - 30], C = t[M - 30 + 1], D = f(O, C), I = p(C, O), L = m(O = t[M - 4], C = t[M - 4 + 1]), x = g(C, O), P = t[M - 14], U = t[M - 14 + 1], N = t[M - 32], B = t[M - 32 + 1], F = I + U | 0, j = D + P + v(F, I) | 0; j = (j = j + L + v(F = F + x | 0, x) | 0) + N + v(F = F + B | 0, B) | 0, t[M] = j, t[M + 1] = F } for (var H = 0; H < 160; H += 2) { j = t[H], F = t[H + 1]; var G = d(i, r, n), V = d(b, w, E), W = c(i, b), q = c(b, i), X = h(o, S), z = h(S, o), K = s[H], Y = s[H + 1], Q = l(o, u, y), J = l(S, A, k), Z = R + z | 0, $ = _ + X + v(Z, R) | 0; $ = ($ = ($ = $ + Q + v(Z = Z + J | 0, J) | 0) + K + v(Z = Z + Y | 0, Y) | 0) + j + v(Z = Z + F | 0, F) | 0; var ee = q + V | 0, te = W + G + v(ee, q) | 0; _ = y, R = k, y = u, k = A, u = o, A = S, o = a + $ + v(S = T + Z | 0, T) | 0, a = n, T = E, n = r, E = w, r = i, w = b, i = $ + te + v(b = Z + ee | 0, Z) | 0 } this._al = this._al + b | 0, this._bl = this._bl + w | 0, this._cl = this._cl + E | 0, this._dl = this ._dl + T | 0, this._el = this._el + S | 0, this._fl = this._fl + A | 0, this._gl = this._gl + k | 0, this._hl = this._hl + R | 0, this._ah = this._ah + i + v(this._al, b) | 0, this._bh = this._bh + r + v(this._bl, w) | 0, this._ch = this._ch + n + v(this._cl, E) | 0, this._dh = this._dh + a + v(this ._dl, T) | 0, this._eh = this._eh + o + v(this._el, S) | 0, this._fh = this._fh + u + v(this._fl, A) | 0, this._gh = this._gh + y + v(this._gl, k) | 0, this._hh = this._hh + _ + v(this._hl, R) | 0 }, u.prototype._hash = function() { var e = a.allocUnsafe(64); function t(t, i, r) { e.writeInt32BE(t, r), e.writeInt32BE(i, r + 4) } return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this ._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), t(this._gh, this._gl, 48), t(this ._hh, this._hl, 56), e }, e.exports = u }, function(e, t, i) { "use strict"; (function(t, r) { var n = i(38); e.exports = _; var a, s = i(66); _.ReadableState = y, i(8).EventEmitter; var o = function(e, t) { return e.listeners(t).length }, u = i(82), l = i(50).Buffer, d = t.Uint8Array || function() {}, c = Object.create(i(32)); c.inherits = i(5); var h = i(149), f = void 0; f = h && h.debuglog ? h.debuglog("stream") : function() {}; var p, m = i(150), g = i(83); c.inherits(_, u); var v = ["error", "close", "destroy", "pause", "resume"]; function y(e, t) { e = e || {}; var r = t instanceof(a = a || i(23)); this.objectMode = !!e.objectMode, r && (this.objectMode = this.objectMode || !!e.readableObjectMode); var n = e.highWaterMark, s = e.readableHighWaterMark, o = this.objectMode ? 16 : 16384; this.highWaterMark = n || 0 === n ? n : r && (s || 0 === s) ? s : o, this.highWaterMark = Math.floor( this.highWaterMark), this.buffer = new m, this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this .needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = ! 1, this.destroyed = !1, this.defaultEncoding = e.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, e.encoding && (p || (p = i(22) .StringDecoder), this.decoder = new p(e.encoding), this.encoding = e.encoding) } function _(e) { if (a = a || i(23), !(this instanceof _)) return new _(e); this._readableState = new y(e, this), this.readable = !0, e && ("function" == typeof e.read && (this ._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), u.call(this) } function b(e, t, i, r, n) { var a, s = e._readableState; return null === t ? (s.reading = !1, function(e, t) { if (!t.ended) { if (t.decoder) { var i = t.decoder.end(); i && i.length && (t.buffer.push(i), t.length += t.objectMode ? 1 : i.length) } t.ended = !0, T(e) } }(e, s)) : (n || (a = function(e, t) { var i, r; return r = t, l.isBuffer(r) || r instanceof d || "string" == typeof t || void 0 === t || e .objectMode || (i = new TypeError("Invalid non-string/buffer chunk")), i }(s, t)), a ? e.emit("error", a) : s.objectMode || t && t.length > 0 ? ("string" == typeof t || s .objectMode || Object.getPrototypeOf(t) === l.prototype || (t = function(e) { return l.from(e) }(t)), r ? s.endEmitted ? e.emit("error", new Error("stream.unshift() after end event")) : w(e, s, t, !0) : s.ended ? e.emit("error", new Error("stream.push() after EOF")) : (s.reading = !1, s.decoder && !i ? (t = s.decoder.write(t), s.objectMode || 0 !== t.length ? w(e, s, t, !1) : A(e, s)) : w(e, s, t, !1))) : r || (s.reading = !1)), function(e) { return !e.ended && (e.needReadable || e.length < e.highWaterMark || 0 === e.length) }(s) } function w(e, t, i, r) { t.flowing && 0 === t.length && !t.sync ? (e.emit("data", i), e.read(0)) : (t.length += t.objectMode ? 1 : i.length, r ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && T(e)), A(e, t) } function E(e, t) { return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t .buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function(e) { return e >= 8388608 ? e = 8388608 : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>> 8, e |= e >>> 16, e++), e }(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0)) } function T(e) { var t = e._readableState; t.needReadable = !1, t.emittedReadable || (f("emitReadable", t.flowing), t.emittedReadable = !0, t .sync ? n.nextTick(S, e) : S(e)) } function S(e) { f("emit readable"), e.emit("readable"), O(e) } function A(e, t) { t.readingMore || (t.readingMore = !0, n.nextTick(k, e, t)) } function k(e, t) { for (var i = t.length; !t.reading && !t.flowing && !t.ended && t.length < t.highWaterMark && (f( "maybeReadMore read 0"), e.read(0), i !== t.length);) i = t.length; t.readingMore = !1 } function R(e) { f("readable nexttick read 0"), e.read(0) } function M(e, t) { t.reading || (f("resume read 0"), e.read(0)), t.resumeScheduled = !1, t.awaitDrain = 0, e.emit( "resume"), O(e), t.flowing && !t.reading && e.read(0) } function O(e) { var t = e._readableState; for (f("flow", t.flowing); t.flowing && null !== e.read();); } function C(e, t) { return 0 === t.length ? null : (t.objectMode ? i = t.buffer.shift() : !e || e >= t.length ? (i = t .decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.head.data : t.buffer.concat(t .length), t.buffer.clear()) : i = function(e, t, i) { var r; return e < t.head.data.length ? (r = t.head.data.slice(0, e), t.head.data = t.head.data.slice( e)) : r = e === t.head.data.length ? t.shift() : i ? function(e, t) { var i = t.head, r = 1, n = i.data; for (e -= n.length; i = i.next;) { var a = i.data, s = e > a.length ? a.length : e; if (s === a.length ? n += a : n += a.slice(0, e), 0 == (e -= s)) { s === a.length ? (++r, i.next ? t.head = i.next : t.head = t.tail = null) : (t.head = i, i.data = a.slice(s)); break }++r } return t.length -= r, n }(e, t) : function(e, t) { var i = l.allocUnsafe(e), r = t.head, n = 1; for (r.data.copy(i), e -= r.data.length; r = r.next;) { var a = r.data, s = e > a.length ? a.length : e; if (a.copy(i, i.length - e, 0, s), 0 == (e -= s)) { s === a.length ? (++n, r.next ? t.head = r.next : t.head = t.tail = null) : (t.head = r, r.data = a.slice(s)); break }++n } return t.length -= n, i }(e, t), r }(e, t.buffer, t.decoder), i); var i } function D(e) { var t = e._readableState; if (t.length > 0) throw new Error('"endReadable()" called on non-empty stream'); t.endEmitted || (t.ended = !0, n.nextTick(I, t, e)) } function I(e, t) { e.endEmitted || 0 !== e.length || (e.endEmitted = !0, t.readable = !1, t.emit("end")) } function L(e, t) { for (var i = 0, r = e.length; i < r; i++) if (e[i] === t) return i; return -1 } Object.defineProperty(_.prototype, "destroyed", { get: function() { return void 0 !== this._readableState && this._readableState.destroyed }, set: function(e) { this._readableState && (this._readableState.destroyed = e) } }), _.prototype.destroy = g.destroy, _.prototype._undestroy = g.undestroy, _.prototype._destroy = function(e, t) { this.push(null), t(e) }, _.prototype.push = function(e, t) { var i, r = this._readableState; return r.objectMode ? i = !0 : "string" == typeof e && ((t = t || r.defaultEncoding) !== r .encoding && (e = l.from(e, t), t = ""), i = !0), b(this, e, t, !1, i) }, _.prototype.unshift = function(e) { return b(this, e, null, !0, !1) }, _.prototype.isPaused = function() { return !1 === this._readableState.flowing }, _.prototype.setEncoding = function(e) { return p || (p = i(22).StringDecoder), this._readableState.decoder = new p(e), this._readableState .encoding = e, this }, _.prototype.read = function(e) { f("read", e), e = parseInt(e, 10); var t = this._readableState, i = e; if (0 !== e && (t.emittedReadable = !1), 0 === e && t.needReadable && (t.length >= t .highWaterMark || t.ended)) return f("read: emitReadable", t.length, t.ended), 0 === t.length && t.ended ? D(this) : T(this), null; if (0 === (e = E(e, t)) && t.ended) return 0 === t.length && D(this), null; var r, n = t.needReadable; return f("need readable", n), (0 === t.length || t.length - e < t.highWaterMark) && f( "length less than watermark", n = !0), t.ended || t.reading ? f("reading or ended", n = !1) : n && (f("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this ._read(t.highWaterMark), t.sync = !1, t.reading || (e = E(i, t))), null === (r = e > 0 ? C(e, t) : null) ? (t.needReadable = !0, e = 0) : t.length -= e, 0 === t.length && (t.ended || (t .needReadable = !0), i !== e && t.ended && D(this)), null !== r && this.emit("data", r), r }, _.prototype._read = function(e) { this.emit("error", new Error("_read() is not implemented")) }, _.prototype.pipe = function(e, t) { var i = this, a = this._readableState; switch (a.pipesCount) { case 0: a.pipes = e; break; case 1: a.pipes = [a.pipes, e]; break; default: a.pipes.push(e) } a.pipesCount += 1, f("pipe count=%d opts=%j", a.pipesCount, t); var u = t && !1 === t.end || e === r.stdout || e === r.stderr ? y : l; function l() { f("onend"), e.end() } a.endEmitted ? n.nextTick(u) : i.once("end", u), e.on("unpipe", function t(r, n) { f("onunpipe"), r === i && n && !1 === n.hasUnpiped && (n.hasUnpiped = !0, f("cleanup"), e .removeListener("close", g), e.removeListener("finish", v), e.removeListener("drain", d), e.removeListener("error", m), e.removeListener("unpipe", t), i.removeListener("end", l), i .removeListener("end", y), i.removeListener("data", p), c = !0, !a.awaitDrain || e ._writableState && !e._writableState.needDrain || d()) }); var d = function(e) { return function() { var t = e._readableState; f("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && o(e, "data") && (t.flowing = !0, O(e)) } }(i); e.on("drain", d); var c = !1, h = !1; function p(t) { f("ondata"), h = !1, !1 !== e.write(t) || h || ((1 === a.pipesCount && a.pipes === e || a .pipesCount > 1 && -1 !== L(a.pipes, e)) && !c && (f("false write response, pause", i ._readableState.awaitDrain), i._readableState.awaitDrain++, h = !0), i.pause()) } function m(t) { f("onerror", t), y(), e.removeListener("error", m), 0 === o(e, "error") && e.emit("error", t) } function g() { e.removeListener("finish", v), y() } function v() { f("onfinish"), e.removeListener("close", g), y() } function y() { f("unpipe"), i.unpipe(e) } return i.on("data", p), function(e, t, i) { if ("function" == typeof e.prependListener) return e.prependListener(t, i); e._events && e._events[t] ? s(e._events[t]) ? e._events[t].unshift(i) : e._events[t] = [i, e ._events[t] ] : e.on(t, i) }(e, "error", m), e.once("close", g), e.once("finish", v), e.emit("pipe", i), a.flowing || (f( "pipe resume"), i.resume()), e }, _.prototype.unpipe = function(e) { var t = this._readableState, i = { hasUnpiped: !1 }; if (0 === t.pipesCount) return this; if (1 === t.pipesCount) return e && e !== t.pipes || (e || (e = t.pipes), t.pipes = null, t .pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this, i)), this; if (!e) { var r = t.pipes, n = t.pipesCount; t.pipes = null, t.pipesCount = 0, t.flowing = !1; for (var a = 0; a < n; a++) r[a].emit("unpipe", this, i); return this } var s = L(t.pipes, e); return -1 === s || (t.pipes.splice(s, 1), t.pipesCount -= 1, 1 === t.pipesCount && (t.pipes = t .pipes[0]), e.emit("unpipe", this, i)), this }, _.prototype.on = function(e, t) { var i = u.prototype.on.call(this, e, t); if ("data" === e) !1 !== this._readableState.flowing && this.resume(); else if ("readable" === e) { var r = this._readableState; r.endEmitted || r.readableListening || (r.readableListening = r.needReadable = !0, r .emittedReadable = !1, r.reading ? r.length && T(this) : n.nextTick(R, this)) } return i }, _.prototype.addListener = _.prototype.on, _.prototype.resume = function() { var e = this._readableState; return e.flowing || (f("resume"), e.flowing = !0, function(e, t) { t.resumeScheduled || (t.resumeScheduled = !0, n.nextTick(M, e, t)) }(this, e)), this }, _.prototype.pause = function() { return f("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState .flowing && (f("pause"), this._readableState.flowing = !1, this.emit("pause")), this }, _.prototype.wrap = function(e) { var t = this, i = this._readableState, r = !1; for (var n in e.on("end", function() { if (f("wrapped end"), i.decoder && !i.ended) { var e = i.decoder.end(); e && e.length && t.push(e) } t.push(null) }), e.on("data", function(n) { f("wrapped data"), i.decoder && (n = i.decoder.write(n)), i.objectMode && null == n || (i .objectMode || n && n.length) && (t.push(n) || (r = !0, e.pause())) }), e) void 0 === this[n] && "function" == typeof e[n] && (this[n] = function(t) { return function() { return e[t].apply(e, arguments) } }(n)); for (var a = 0; a < v.length; a++) e.on(v[a], this.emit.bind(this, v[a])); return this._read = function(t) { f("wrapped _read", t), r && (r = !1, e.resume()) }, this }, Object.defineProperty(_.prototype, "readableHighWaterMark", { enumerable: !1, get: function() { return this._readableState.highWaterMark } }), _._fromList = C }).call(this, i(13), i(9)) }, function(e, t, i) { e.exports = i(8).EventEmitter }, function(e, t, i) { "use strict"; var r = i(38); function n(e, t) { e.emit("error", t) } e.exports = { destroy: function(e, t) { var i = this, a = this._readableState && this._readableState.destroyed, s = this._writableState && this._writableState.destroyed; return a || s ? (t ? t(e) : !e || this._writableState && this._writableState.errorEmitted || r .nextTick(n, this, e), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(e || null, function( e) { !t && e ? (r.nextTick(n, i, e), i._writableState && (i._writableState.errorEmitted = !0)) : t && t(e) }), this) }, undestroy: function() { this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this ._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this ._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1) } } }, function(e, t, i) { "use strict"; e.exports = a; var r = i(23), n = Object.create(i(32)); function a(e) { if (!(this instanceof a)) return new a(e); r.call(this, e), this._transformState = { afterTransform: function(e, t) { var i = this._transformState; i.transforming = !1; var r = i.writecb; if (!r) return this.emit("error", new Error("write callback called multiple times")); i.writechunk = null, i.writecb = null, null != t && this.push(t), r(e); var n = this._readableState; n.reading = !1, (n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark) }.bind(this), needTransform: !1, transforming: !1, writecb: null, writechunk: null, writeencoding: null }, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e .transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush) ), this.on("prefinish", s) } function s() { var e = this; "function" == typeof this._flush ? this._flush(function(t, i) { o(e, t, i) }) : o(this, null, null) } function o(e, t, i) { if (t) return e.emit("error", t); if (null != i && e.push(i), e._writableState.length) throw new Error( "Calling transform done when ws.length != 0"); if (e._transformState.transforming) throw new Error("Calling transform done when still transforming"); return e.push(null) } n.inherits = i(5), n.inherits(a, r), a.prototype.push = function(e, t) { return this._transformState.needTransform = !1, r.prototype.push.call(this, e, t) }, a.prototype._transform = function(e, t, i) { throw new Error("_transform() is not implemented") }, a.prototype._write = function(e, t, i) { var r = this._transformState; if (r.writecb = i, r.writechunk = e, r.writeencoding = t, !r.transforming) { var n = this._readableState; (r.needTransform || n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark) } }, a.prototype._read = function(e) { var t = this._transformState; null !== t.writechunk && t.writecb && !t.transforming ? (t.transforming = !0, this._transform(t .writechunk, t.writeencoding, t.afterTransform)) : t.needTransform = !0 }, a.prototype._destroy = function(e, t) { var i = this; r.prototype._destroy.call(this, e, function(e) { t(e), i.emit("close") }) } }, function(e, t, i) { "use strict"; var r = i(5), n = i(159), a = i(20), s = i(6).Buffer, o = i(86), u = i(47), l = i(48), d = s.alloc(128); function c(e, t) { a.call(this, "digest"), "string" == typeof t && (t = s.from(t)); var i = "sha512" === e || "sha384" === e ? 128 : 64; this._alg = e, this._key = t, t.length > i ? t = ("rmd160" === e ? new u : l(e)).update(t).digest() : t .length < i && (t = s.concat([t, d], i)); for (var r = this._ipad = s.allocUnsafe(i), n = this._opad = s.allocUnsafe(i), o = 0; o < i; o++) r[o] = 54 ^ t[o], n[o] = 92 ^ t[o]; this._hash = "rmd160" === e ? new u : l(e), this._hash.update(r) } r(c, a), c.prototype._update = function(e) { this._hash.update(e) }, c.prototype._final = function() { var e = this._hash.digest(); return ("rmd160" === this._alg ? new u : l(this._alg)).update(this._opad).update(e).digest() }, e.exports = function(e, t) { return "rmd160" === (e = e.toLowerCase()) || "ripemd160" === e ? new c("rmd160", t) : "md5" === e ? new n(o, t) : new c(e, t) } }, function(e, t, i) { var r = i(44); e.exports = function(e) { return (new r).update(e).digest() } }, function(e) { e.exports = JSON.parse( '{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}' ) }, function(e, t, i) { t.pbkdf2 = i(161), t.pbkdf2Sync = i(91) }, function(e, t) { var i = Math.pow(2, 30) - 1; e.exports = function(e, t) { if ("number" != typeof e) throw new TypeError("Iterations not a number"); if (e < 0) throw new TypeError("Bad iterations"); if ("number" != typeof t) throw new TypeError("Key length not a number"); if (t < 0 || t > i || t != t) throw new TypeError("Bad key length") } }, function(e, t, i) { (function(t, i) { var r; r = t.process && t.process.browser ? "utf-8" : t.process && t.process.version ? parseInt(i.version .split(".")[0].slice(1), 10) >= 6 ? "utf-8" : "binary" : "utf-8", e.exports = r }).call(this, i(13), i(9)) }, function(e, t, i) { var r = i(86), n = i(47), a = i(48), s = i(6).Buffer, o = i(89), u = i(90), l = i(92), d = s.alloc(128), c = { md5: 16, sha1: 20, sha224: 28, sha256: 32, sha384: 48, sha512: 64, rmd160: 20, ripemd160: 20 }; function h(e, t, i) { var o = function(e) { return "rmd160" === e || "ripemd160" === e ? function(e) { return (new n).update(e).digest() } : "md5" === e ? r : function(t) { return a(e).update(t).digest() } }(e), u = "sha512" === e || "sha384" === e ? 128 : 64; t.length > u ? t = o(t) : t.length < u && (t = s.concat([t, d], u)); for (var l = s.allocUnsafe(u + c[e]), h = s.allocUnsafe(u + c[e]), f = 0; f < u; f++) l[f] = 54 ^ t[f], h[ f] = 92 ^ t[f]; var p = s.allocUnsafe(u + i + 4); l.copy(p, 0, 0, u), this.ipad1 = p, this.ipad2 = l, this.opad = h, this.alg = e, this.blocksize = u, this .hash = o, this.size = c[e] } h.prototype.run = function(e, t) { return e.copy(t, this.blocksize), this.hash(t).copy(this.opad, this.blocksize), this.hash(this.opad) }, e.exports = function(e, t, i, r, n) { o(i, r); var a = new h(n = n || "sha1", e = l(e, u, "Password"), (t = l(t, u, "Salt")).length), d = s.allocUnsafe(r), f = s.allocUnsafe(t.length + 4); t.copy(f, 0, 0, t.length); for (var p = 0, m = c[n], g = Math.ceil(r / m), v = 1; v <= g; v++) { f.writeUInt32BE(v, t.length); for (var y = a.run(f, a.ipad1), _ = y, b = 1; b < i; b++) { _ = a.run(_, a.ipad2); for (var w = 0; w < m; w++) y[w] ^= _[w] } y.copy(d, p), p += m } return d } }, function(e, t, i) { var r = i(6).Buffer; e.exports = function(e, t, i) { if (r.isBuffer(e)) return e; if ("string" == typeof e) return r.from(e, t); if (ArrayBuffer.isView(e)) return r.from(e.buffer); throw new TypeError(i + " must be a string, a Buffer, a typed array or a DataView") } }, function(e, t, i) { "use strict"; t.readUInt32BE = function(e, t) { return (e[0 + t] << 24 | e[1 + t] << 16 | e[2 + t] << 8 | e[3 + t]) >>> 0 }, t.writeUInt32BE = function(e, t, i) { e[0 + i] = t >>> 24, e[1 + i] = t >>> 16 & 255, e[2 + i] = t >>> 8 & 255, e[3 + i] = 255 & t }, t.ip = function(e, t, i, r) { for (var n = 0, a = 0, s = 6; s >= 0; s -= 2) { for (var o = 0; o <= 24; o += 8) n <<= 1, n |= t >>> o + s & 1; for (o = 0; o <= 24; o += 8) n <<= 1, n |= e >>> o + s & 1 } for (s = 6; s >= 0; s -= 2) { for (o = 1; o <= 25; o += 8) a <<= 1, a |= t >>> o + s & 1; for (o = 1; o <= 25; o += 8) a <<= 1, a |= e >>> o + s & 1 } i[r + 0] = n >>> 0, i[r + 1] = a >>> 0 }, t.rip = function(e, t, i, r) { for (var n = 0, a = 0, s = 0; s < 4; s++) for (var o = 24; o >= 0; o -= 8) n <<= 1, n |= t >>> o + s & 1, n <<= 1, n |= e >>> o + s & 1; for (s = 4; s < 8; s++) for (o = 24; o >= 0; o -= 8) a <<= 1, a |= t >>> o + s & 1, a <<= 1, a |= e >>> o + s & 1; i[r + 0] = n >>> 0, i[r + 1] = a >>> 0 }, t.pc1 = function(e, t, i, r) { for (var n = 0, a = 0, s = 7; s >= 5; s--) { for (var o = 0; o <= 24; o += 8) n <<= 1, n |= t >> o + s & 1; for (o = 0; o <= 24; o += 8) n <<= 1, n |= e >> o + s & 1 } for (o = 0; o <= 24; o += 8) n <<= 1, n |= t >> o + s & 1; for (s = 1; s <= 3; s++) { for (o = 0; o <= 24; o += 8) a <<= 1, a |= t >> o + s & 1; for (o = 0; o <= 24; o += 8) a <<= 1, a |= e >> o + s & 1 } for (o = 0; o <= 24; o += 8) a <<= 1, a |= e >> o + s & 1; i[r + 0] = n >>> 0, i[r + 1] = a >>> 0 }, t.r28shl = function(e, t) { return e << t & 268435455 | e >>> 28 - t }; var r = [14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, 15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24 ]; t.pc2 = function(e, t, i, n) { for (var a = 0, s = 0, o = r.length >>> 1, u = 0; u < o; u++) a <<= 1, a |= e >>> r[u] & 1; for (u = o; u < r.length; u++) s <<= 1, s |= t >>> r[u] & 1; i[n + 0] = a >>> 0, i[n + 1] = s >>> 0 }, t.expand = function(e, t, i) { var r = 0, n = 0; r = (1 & e) << 5 | e >>> 27; for (var a = 23; a >= 15; a -= 4) r <<= 6, r |= e >>> a & 63; for (a = 11; a >= 3; a -= 4) n |= e >>> a & 63, n <<= 6; n |= (31 & e) << 1 | e >>> 31, t[i + 0] = r >>> 0, t[i + 1] = n >>> 0 }; var n = [14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 ]; t.substitute = function(e, t) { for (var i = 0, r = 0; r < 4; r++) i <<= 4, i |= n[64 * r + (e >>> 18 - 6 * r & 63)]; for (r = 0; r < 4; r++) i <<= 4, i |= n[256 + 64 * r + (t >>> 18 - 6 * r & 63)]; return i >>> 0 }; var a = [16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7 ]; t.permute = function(e) { for (var t = 0, i = 0; i < a.length; i++) t <<= 1, t |= e >>> a[i] & 1; return t >>> 0 }, t.padSplit = function(e, t, i) { for (var r = e.toString(2); r.length < t;) r = "0" + r; for (var n = [], a = 0; a < t; a += i) n.push(r.slice(a, a + i)); return n.join(" ") } }, function(e, t, i) { "use strict"; var r = i(14), n = i(5), a = i(93), s = i(52); function o(e) { s.call(this, e); var t = new function() { this.tmp = new Array(2), this.keys = null }; this._desState = t, this.deriveKeys(t, e.key) } n(o, s), e.exports = o, o.create = function(e) { return new o(e) }; var u = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1]; o.prototype.deriveKeys = function(e, t) { e.keys = new Array(32), r.equal(t.length, this.blockSize, "Invalid key length"); var i = a.readUInt32BE(t, 0), n = a.readUInt32BE(t, 4); a.pc1(i, n, e.tmp, 0), i = e.tmp[0], n = e.tmp[1]; for (var s = 0; s < e.keys.length; s += 2) { var o = u[s >>> 1]; i = a.r28shl(i, o), n = a.r28shl(n, o), a.pc2(i, n, e.keys, s) } }, o.prototype._update = function(e, t, i, r) { var n = this._desState, s = a.readUInt32BE(e, t), o = a.readUInt32BE(e, t + 4); a.ip(s, o, n.tmp, 0), s = n.tmp[0], o = n.tmp[1], "encrypt" === this.type ? this._encrypt(n, s, o, n .tmp, 0) : this._decrypt(n, s, o, n.tmp, 0), s = n.tmp[0], o = n.tmp[1], a.writeUInt32BE(i, s, r), a .writeUInt32BE(i, o, r + 4) }, o.prototype._pad = function(e, t) { for (var i = e.length - t, r = t; r < e.length; r++) e[r] = i; return !0 }, o.prototype._unpad = function(e) { for (var t = e[e.length - 1], i = e.length - t; i < e.length; i++) r.equal(e[i], t); return e.slice(0, e.length - t) }, o.prototype._encrypt = function(e, t, i, r, n) { for (var s = t, o = i, u = 0; u < e.keys.length; u += 2) { var l = e.keys[u], d = e.keys[u + 1]; a.expand(o, e.tmp, 0), l ^= e.tmp[0], d ^= e.tmp[1]; var c = a.substitute(l, d), h = o; o = (s ^ a.permute(c)) >>> 0, s = h } a.rip(o, s, r, n) }, o.prototype._decrypt = function(e, t, i, r, n) { for (var s = i, o = t, u = e.keys.length - 2; u >= 0; u -= 2) { var l = e.keys[u], d = e.keys[u + 1]; a.expand(s, e.tmp, 0), l ^= e.tmp[0], d ^= e.tmp[1]; var c = a.substitute(l, d), h = s; s = (o ^ a.permute(c)) >>> 0, o = h } a.rip(s, o, r, n) } }, function(e, t, i) { var r = i(33), n = i(6).Buffer, a = i(96); function s(e) { var t = e._cipher.encryptBlockRaw(e._prev); return a(e._prev), t } t.encrypt = function(e, t) { var i = Math.ceil(t.length / 16), a = e._cache.length; e._cache = n.concat([e._cache, n.allocUnsafe(16 * i)]); for (var o = 0; o < i; o++) { var u = s(e), l = a + 16 * o; e._cache.writeUInt32BE(u[0], l + 0), e._cache.writeUInt32BE(u[1], l + 4), e._cache.writeUInt32BE(u[2], l + 8), e._cache.writeUInt32BE(u[3], l + 12) } var d = e._cache.slice(0, t.length); return e._cache = e._cache.slice(t.length), r(t, d) } }, function(e, t) { e.exports = function(e) { for (var t, i = e.length; i--;) { if (255 !== (t = e.readUInt8(i))) { t++, e.writeUInt8(t, i); break } e.writeUInt8(0, i) } } }, function(e) { e.exports = JSON.parse( '{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}' ) }, function(e, t, i) { var r = i(39), n = i(6).Buffer, a = i(20), s = i(5), o = i(174), u = i(33), l = i(96); function d(e, t, i, s) { a.call(this); var u = n.alloc(4, 0); this._cipher = new r.AES(t); var d = this._cipher.encryptBlock(u); this._ghash = new o(d), i = function(e, t, i) { if (12 === t.length) return e._finID = n.concat([t, n.from([0, 0, 0, 1])]), n.concat([t, n.from([0, 0, 0, 2 ])]); var r = new o(i), a = t.length, s = a % 16; r.update(t), s && (s = 16 - s, r.update(n.alloc(s, 0))), r.update(n.alloc(8, 0)); var u = 8 * a, d = n.alloc(8); d.writeUIntBE(u, 0, 8), r.update(d), e._finID = r.state; var c = n.from(e._finID); return l(c), c }(this, i, d), this._prev = n.from(i), this._cache = n.allocUnsafe(0), this._secCache = n.allocUnsafe( 0), this._decrypt = s, this._alen = 0, this._len = 0, this._mode = e, this._authTag = null, this ._called = !1 } s(d, a), d.prototype._update = function(e) { if (!this._called && this._alen) { var t = 16 - this._alen % 16; t < 16 && (t = n.alloc(t, 0), this._ghash.update(t)) } this._called = !0; var i = this._mode.encrypt(this, e); return this._decrypt ? this._ghash.update(e) : this._ghash.update(i), this._len += e.length, i }, d.prototype._final = function() { if (this._decrypt && !this._authTag) throw new Error( "Unsupported state or unable to authenticate data"); var e = u(this._ghash.final(8 * this._alen, 8 * this._len), this._cipher.encryptBlock(this._finID)); if (this._decrypt && function(e, t) { var i = 0; e.length !== t.length && i++; for (var r = Math.min(e.length, t.length), n = 0; n < r; ++n) i += e[n] ^ t[n]; return i }(e, this._authTag)) throw new Error("Unsupported state or unable to authenticate data"); this._authTag = e, this._cipher.scrub() }, d.prototype.getAuthTag = function() { if (this._decrypt || !n.isBuffer(this._authTag)) throw new Error( "Attempting to get auth tag in unsupported state"); return this._authTag }, d.prototype.setAuthTag = function(e) { if (!this._decrypt) throw new Error("Attempting to set auth tag in unsupported state"); this._authTag = e }, d.prototype.setAAD = function(e) { if (this._called) throw new Error("Attempting to set AAD in unsupported state"); this._ghash.update(e), this._alen += e.length }, e.exports = d }, function(e, t, i) { var r = i(39), n = i(6).Buffer, a = i(20); function s(e, t, i, s) { a.call(this), this._cipher = new r.AES(t), this._prev = n.from(i), this._cache = n.allocUnsafe(0), this ._secCache = n.allocUnsafe(0), this._decrypt = s, this._mode = e } i(5)(s, a), s.prototype._update = function(e) { return this._mode.encrypt(this, e, this._decrypt) }, s.prototype._final = function() { this._cipher.scrub() }, e.exports = s }, function(e, t, i) { var r = i(24); e.exports = v, v.simpleSieve = m, v.fermatTest = g; var n = i(11), a = new n(24), s = new(i(101)), o = new n(1), u = new n(2), l = new n(5), d = (new n(16), new n(8), new n(10)), c = new n(3), h = (new n(7), new n(11)), f = new n(4), p = (new n(12), null); function m(e) { for (var t = function() { if (null !== p) return p; var e = []; e[0] = 2; for (var t = 1, i = 3; i < 1048576; i += 2) { for (var r = Math.ceil(Math.sqrt(i)), n = 0; n < t && e[n] <= r && i % e[n] != 0; n++); t !== n && e[n] <= r || (e[t++] = i) } return p = e, e }(), i = 0; i < t.length; i++) if (0 === e.modn(t[i])) return 0 === e.cmpn(t[i]); return !0 } function g(e) { var t = n.mont(e); return 0 === u.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1) } function v(e, t) { if (e < 16) return new n(2 === t || 5 === t ? [140, 123] : [140, 39]); var i, p; for (t = new n(t);;) { for (i = new n(r(Math.ceil(e / 8))); i.bitLength() > e;) i.ishrn(1); if (i.isEven() && i.iadd(o), i.testn(1) || i.iadd(u), t.cmp(u)) { if (!t.cmp(l)) for (; i.mod(d).cmp(c);) i.iadd(f) } else for (; i.mod(a).cmp(h);) i.iadd(f); if (m(p = i.shrn(1)) && m(i) && g(p) && g(i) && s.test(p) && s.test(i)) return i } } }, function(e, t, i) { var r = i(11), n = i(56); function a(e) { this.rand = e || new n.Rand } e.exports = a, a.create = function(e) { return new a(e) }, a.prototype._randbelow = function(e) { var t = e.bitLength(), i = Math.ceil(t / 8); do { var n = new r(this.rand.generate(i)) } while (n.cmp(e) >= 0); return n }, a.prototype._randrange = function(e, t) { var i = t.sub(e); return e.add(this._randbelow(i)) }, a.prototype.test = function(e, t, i) { var n = e.bitLength(), a = r.mont(e), s = new r(1).toRed(a); t || (t = Math.max(1, n / 48 | 0)); for (var o = e.subn(1), u = 0; !o.testn(u); u++); for (var l = e.shrn(u), d = o.toRed(a); t > 0; t--) { var c = this._randrange(new r(2), o); i && i(c); var h = c.toRed(a).redPow(l); if (0 !== h.cmp(s) && 0 !== h.cmp(d)) { for (var f = 1; f < u; f++) { if (0 === (h = h.redSqr()).cmp(s)) return !1; if (0 === h.cmp(d)) break } if (f === u) return !1 } } return !0 }, a.prototype.getDivisor = function(e, t) { var i = e.bitLength(), n = r.mont(e), a = new r(1).toRed(n); t || (t = Math.max(1, i / 48 | 0)); for (var s = e.subn(1), o = 0; !s.testn(o); o++); for (var u = e.shrn(o), l = s.toRed(n); t > 0; t--) { var d = this._randrange(new r(2), s), c = e.gcd(d); if (0 !== c.cmpn(1)) return c; var h = d.toRed(n).redPow(u); if (0 !== h.cmp(a) && 0 !== h.cmp(l)) { for (var f = 1; f < o; f++) { if (0 === (h = h.redSqr()).cmp(a)) return h.fromRed().subn(1).gcd(e); if (0 === h.cmp(l)) break } if (f === o) return (h = h.redSqr()).fromRed().subn(1).gcd(e) } } return !1 } }, function(e, t, i) { "use strict"; (function(t, r) { var n; e.exports = A, A.ReadableState = S, i(8).EventEmitter; var a, s = function(e, t) { return e.listeners(t).length }, o = i(103), u = i(10).Buffer, l = t.Uint8Array || function() {}, d = i(184); a = d && d.debuglog ? d.debuglog("stream") : function() {}; var c, h, f, p = i(185), m = i(104), g = i(105).getHighWaterMark, v = i(28).codes, y = v.ERR_INVALID_ARG_TYPE, _ = v.ERR_STREAM_PUSH_AFTER_EOF, b = v.ERR_METHOD_NOT_IMPLEMENTED, w = v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; i(5)(A, o); var E = m.errorOrDestroy, T = ["error", "close", "destroy", "pause", "resume"]; function S(e, t, r) { n = n || i(29), e = e || {}, "boolean" != typeof r && (r = t instanceof n), this.objectMode = !!e .objectMode, r && (this.objectMode = this.objectMode || !!e.readableObjectMode), this .highWaterMark = g(this, e, "readableHighWaterMark", r), this.buffer = new p, this.length = 0, this .pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this .reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this .readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = !1 !== e .emitClose, this.autoDestroy = !!e.autoDestroy, this.destroyed = !1, this.defaultEncoding = e .defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this .encoding = null, e.encoding && (c || (c = i(22).StringDecoder), this.decoder = new c(e.encoding), this.encoding = e.encoding) } function A(e) { if (n = n || i(29), !(this instanceof A)) return new A(e); var t = this instanceof n; this._readableState = new S(e, this, t), this.readable = !0, e && ("function" == typeof e.read && ( this._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), o.call(this) } function k(e, t, i, r, n) { a("readableAddChunk", t); var s, o = e._readableState; if (null === t) o.reading = !1, function(e, t) { if (a("onEofChunk"), !t.ended) { if (t.decoder) { var i = t.decoder.end(); i && i.length && (t.buffer.push(i), t.length += t.objectMode ? 1 : i.length) } t.ended = !0, t.sync ? O(e) : (t.needReadable = !1, t.emittedReadable || (t.emittedReadable = ! 0, C(e))) } }(e, o); else if (n || (s = function(e, t) { var i, r; return r = t, u.isBuffer(r) || r instanceof l || "string" == typeof t || void 0 === t || e .objectMode || (i = new y("chunk", ["string", "Buffer", "Uint8Array"], t)), i }(o, t)), s) E(e, s); else if (o.objectMode || t && t.length > 0) if ("string" == typeof t || o.objectMode || Object.getPrototypeOf(t) === u.prototype || (t = function(e) { return u.from(e) }(t)), r) o.endEmitted ? E(e, new w) : R(e, o, t, !0); else if (o.ended) E(e, new _); else { if (o.destroyed) return !1; o.reading = !1, o.decoder && !i ? (t = o.decoder.write(t), o.objectMode || 0 !== t.length ? R(e, o, t, !1) : D(e, o)) : R(e, o, t, !1) } else r || (o.reading = !1, D(e, o)); return !o.ended && (o.length < o.highWaterMark || 0 === o.length) } function R(e, t, i, r) { t.flowing && 0 === t.length && !t.sync ? (t.awaitDrain = 0, e.emit("data", i)) : (t.length += t .objectMode ? 1 : i.length, r ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && O(e)), D(e, t) } function M(e, t) { return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t .buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function(e) { return e >= 1073741824 ? e = 1073741824 : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>> 8, e |= e >>> 16, e++), e }(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0)) } function O(e) { var t = e._readableState; a("emitReadable", t.needReadable, t.emittedReadable), t.needReadable = !1, t.emittedReadable || (a( "emitReadable", t.flowing), t.emittedReadable = !0, r.nextTick(C, e)) } function C(e) { var t = e._readableState; a("emitReadable_", t.destroyed, t.length, t.ended), t.destroyed || !t.length && !t.ended || (e.emit( "readable"), t.emittedReadable = !1), t.needReadable = !t.flowing && !t.ended && t.length <= t .highWaterMark, U(e) } function D(e, t) { t.readingMore || (t.readingMore = !0, r.nextTick(I, e, t)) } function I(e, t) { for (; !t.reading && !t.ended && (t.length < t.highWaterMark || t.flowing && 0 === t.length);) { var i = t.length; if (a("maybeReadMore read 0"), e.read(0), i === t.length) break } t.readingMore = !1 } function L(e) { var t = e._readableState; t.readableListening = e.listenerCount("readable") > 0, t.resumeScheduled && !t.paused ? t.flowing = ! 0 : e.listenerCount("data") > 0 && e.resume() } function x(e) { a("readable nexttick read 0"), e.read(0) } function P(e, t) { a("resume", t.reading), t.reading || e.read(0), t.resumeScheduled = !1, e.emit("resume"), U(e), t .flowing && !t.reading && e.read(0) } function U(e) { var t = e._readableState; for (a("flow", t.flowing); t.flowing && null !== e.read();); } function N(e, t) { return 0 === t.length ? null : (t.objectMode ? i = t.buffer.shift() : !e || e >= t.length ? (i = t .decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.first() : t.buffer.concat(t .length), t.buffer.clear()) : i = t.buffer.consume(e, t.decoder), i); var i } function B(e) { var t = e._readableState; a("endReadable", t.endEmitted), t.endEmitted || (t.ended = !0, r.nextTick(F, t, e)) } function F(e, t) { if (a("endReadableNT", e.endEmitted, e.length), !e.endEmitted && 0 === e.length && (e.endEmitted = !0, t.readable = !1, t.emit("end"), e.autoDestroy)) { var i = t._writableState; (!i || i.autoDestroy && i.finished) && t.destroy() } } function j(e, t) { for (var i = 0, r = e.length; i < r; i++) if (e[i] === t) return i; return -1 } Object.defineProperty(A.prototype, "destroyed", { enumerable: !1, get: function() { return void 0 !== this._readableState && this._readableState.destroyed }, set: function(e) { this._readableState && (this._readableState.destroyed = e) } }), A.prototype.destroy = m.destroy, A.prototype._undestroy = m.undestroy, A.prototype._destroy = function(e, t) { t(e) }, A.prototype.push = function(e, t) { var i, r = this._readableState; return r.objectMode ? i = !0 : "string" == typeof e && ((t = t || r.defaultEncoding) !== r .encoding && (e = u.from(e, t), t = ""), i = !0), k(this, e, t, !1, i) }, A.prototype.unshift = function(e) { return k(this, e, null, !0, !1) }, A.prototype.isPaused = function() { return !1 === this._readableState.flowing }, A.prototype.setEncoding = function(e) { c || (c = i(22).StringDecoder); var t = new c(e); this._readableState.decoder = t, this._readableState.encoding = this._readableState.decoder .encoding; for (var r = this._readableState.buffer.head, n = ""; null !== r;) n += t.write(r.data), r = r.next; return this._readableState.buffer.clear(), "" !== n && this._readableState.buffer.push(n), this ._readableState.length = n.length, this }, A.prototype.read = function(e) { a("read", e), e = parseInt(e, 10); var t = this._readableState, i = e; if (0 !== e && (t.emittedReadable = !1), 0 === e && t.needReadable && ((0 !== t.highWaterMark ? t .length >= t.highWaterMark : t.length > 0) || t.ended)) return a("read: emitReadable", t.length, t.ended), 0 === t.length && t.ended ? B(this) : O(this), null; if (0 === (e = M(e, t)) && t.ended) return 0 === t.length && B(this), null; var r, n = t.needReadable; return a("need readable", n), (0 === t.length || t.length - e < t.highWaterMark) && a( "length less than watermark", n = !0), t.ended || t.reading ? a("reading or ended", n = !1) : n && (a("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this ._read(t.highWaterMark), t.sync = !1, t.reading || (e = M(i, t))), null === (r = e > 0 ? N(e, t) : null) ? (t.needReadable = t.length <= t.highWaterMark, e = 0) : (t.length -= e, t .awaitDrain = 0), 0 === t.length && (t.ended || (t.needReadable = !0), i !== e && t.ended && B( this)), null !== r && this.emit("data", r), r }, A.prototype._read = function(e) { E(this, new b("_read()")) }, A.prototype.pipe = function(e, t) { var i = this, n = this._readableState; switch (n.pipesCount) { case 0: n.pipes = e; break; case 1: n.pipes = [n.pipes, e]; break; default: n.pipes.push(e) } n.pipesCount += 1, a("pipe count=%d opts=%j", n.pipesCount, t); var o = t && !1 === t.end || e === r.stdout || e === r.stderr ? m : u; function u() { a("onend"), e.end() } n.endEmitted ? r.nextTick(o) : i.once("end", o), e.on("unpipe", function t(r, s) { a("onunpipe"), r === i && s && !1 === s.hasUnpiped && (s.hasUnpiped = !0, a("cleanup"), e .removeListener("close", f), e.removeListener("finish", p), e.removeListener("drain", l), e.removeListener("error", h), e.removeListener("unpipe", t), i.removeListener("end", u), i .removeListener("end", m), i.removeListener("data", c), d = !0, !n.awaitDrain || e ._writableState && !e._writableState.needDrain || l()) }); var l = function(e) { return function() { var t = e._readableState; a("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && s(e, "data") && (t.flowing = !0, U(e)) } }(i); e.on("drain", l); var d = !1; function c(t) { a("ondata"); var r = e.write(t); a("dest.write", r), !1 === r && ((1 === n.pipesCount && n.pipes === e || n.pipesCount > 1 && - 1 !== j(n.pipes, e)) && !d && (a("false write response, pause", n.awaitDrain), n .awaitDrain++), i.pause()) } function h(t) { a("onerror", t), m(), e.removeListener("error", h), 0 === s(e, "error") && E(e, t) } function f() { e.removeListener("finish", p), m() } function p() { a("onfinish"), e.removeListener("close", f), m() } function m() { a("unpipe"), i.unpipe(e) } return i.on("data", c), function(e, t, i) { if ("function" == typeof e.prependListener) return e.prependListener(t, i); e._events && e._events[t] ? Array.isArray(e._events[t]) ? e._events[t].unshift(i) : e._events[ t] = [i, e._events[t]] : e.on(t, i) }(e, "error", h), e.once("close", f), e.once("finish", p), e.emit("pipe", i), n.flowing || (a( "pipe resume"), i.resume()), e }, A.prototype.unpipe = function(e) { var t = this._readableState, i = { hasUnpiped: !1 }; if (0 === t.pipesCount) return this; if (1 === t.pipesCount) return e && e !== t.pipes || (e || (e = t.pipes), t.pipes = null, t .pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this, i)), this; if (!e) { var r = t.pipes, n = t.pipesCount; t.pipes = null, t.pipesCount = 0, t.flowing = !1; for (var a = 0; a < n; a++) r[a].emit("unpipe", this, { hasUnpiped: !1 }); return this } var s = j(t.pipes, e); return -1 === s || (t.pipes.splice(s, 1), t.pipesCount -= 1, 1 === t.pipesCount && (t.pipes = t .pipes[0]), e.emit("unpipe", this, i)), this }, A.prototype.on = function(e, t) { var i = o.prototype.on.call(this, e, t), n = this._readableState; return "data" === e ? (n.readableListening = this.listenerCount("readable") > 0, !1 !== n.flowing && this.resume()) : "readable" === e && (n.endEmitted || n.readableListening || (n .readableListening = n.needReadable = !0, n.flowing = !1, n.emittedReadable = !1, a( "on readable", n.length, n.reading), n.length ? O(this) : n.reading || r.nextTick(x, this))), i }, A.prototype.addListener = A.prototype.on, A.prototype.removeListener = function(e, t) { var i = o.prototype.removeListener.call(this, e, t); return "readable" === e && r.nextTick(L, this), i }, A.prototype.removeAllListeners = function(e) { var t = o.prototype.removeAllListeners.apply(this, arguments); return "readable" !== e && void 0 !== e || r.nextTick(L, this), t }, A.prototype.resume = function() { var e = this._readableState; return e.flowing || (a("resume"), e.flowing = !e.readableListening, function(e, t) { t.resumeScheduled || (t.resumeScheduled = !0, r.nextTick(P, e, t)) }(this, e)), e.paused = !1, this }, A.prototype.pause = function() { return a("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState .flowing && (a("pause"), this._readableState.flowing = !1, this.emit("pause")), this ._readableState.paused = !0, this }, A.prototype.wrap = function(e) { var t = this, i = this._readableState, r = !1; for (var n in e.on("end", function() { if (a("wrapped end"), i.decoder && !i.ended) { var e = i.decoder.end(); e && e.length && t.push(e) } t.push(null) }), e.on("data", function(n) { a("wrapped data"), i.decoder && (n = i.decoder.write(n)), i.objectMode && null == n || (i .objectMode || n && n.length) && (t.push(n) || (r = !0, e.pause())) }), e) void 0 === this[n] && "function" == typeof e[n] && (this[n] = function(t) { return function() { return e[t].apply(e, arguments) } }(n)); for (var s = 0; s < T.length; s++) e.on(T[s], this.emit.bind(this, T[s])); return this._read = function(t) { a("wrapped _read", t), r && (r = !1, e.resume()) }, this }, "function" == typeof Symbol && (A.prototype[Symbol.asyncIterator] = function() { return void 0 === h && (h = i(187)), h(this) }), Object.defineProperty(A.prototype, "readableHighWaterMark", { enumerable: !1, get: function() { return this._readableState.highWaterMark } }), Object.defineProperty(A.prototype, "readableBuffer", { enumerable: !1, get: function() { return this._readableState && this._readableState.buffer } }), Object.defineProperty(A.prototype, "readableFlowing", { enumerable: !1, get: function() { return this._readableState.flowing }, set: function(e) { this._readableState && (this._readableState.flowing = e) } }), A._fromList = N, Object.defineProperty(A.prototype, "readableLength", { enumerable: !1, get: function() { return this._readableState.length } }), "function" == typeof Symbol && (A.from = function(e, t) { return void 0 === f && (f = i(188)), f(A, e, t) }) }).call(this, i(13), i(9)) }, function(e, t, i) { e.exports = i(8).EventEmitter }, function(e, t, i) { "use strict"; (function(t) { function i(e, t) { n(e, t), r(e) } function r(e) { e._writableState && !e._writableState.emitClose || e._readableState && !e._readableState.emitClose || e.emit("close") } function n(e, t) { e.emit("error", t) } e.exports = { destroy: function(e, a) { var s = this, o = this._readableState && this._readableState.destroyed, u = this._writableState && this._writableState.destroyed; return o || u ? (a ? a(e) : e && (this._writableState ? this._writableState.errorEmitted || ( this._writableState.errorEmitted = !0, t.nextTick(n, this, e)) : t.nextTick(n, this, e)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(e || null, function(e) { !a && e ? s._writableState ? s._writableState.errorEmitted ? t.nextTick(r, s) : (s ._writableState.errorEmitted = !0, t.nextTick(i, s, e)) : t.nextTick(i, s, e) : a ? (t.nextTick(r, s), a(e)) : t.nextTick(r, s) }), this) }, undestroy: function() { this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState .ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1) }, errorOrDestroy: function(e, t) { var i = e._readableState, r = e._writableState; i && i.autoDestroy || r && r.autoDestroy ? e.destroy(t) : e.emit("error", t) } } }).call(this, i(9)) }, function(e, t, i) { "use strict"; var r = i(28).codes.ERR_INVALID_OPT_VALUE; e.exports = { getHighWaterMark: function(e, t, i, n) { var a = function(e, t, i) { return null != e.highWaterMark ? e.highWaterMark : t ? e[i] : null }(t, n, i); if (null != a) { if (!isFinite(a) || Math.floor(a) !== a || a < 0) throw new r(n ? i : "highWaterMark", a); return Math.floor(a) } return e.objectMode ? 16 : 16384 } } }, function(e, t, i) { "use strict"; (function(t, r) { function n(e) { var t = this; this.next = null, this.entry = null, this.finish = function() { ! function(e, t, i) { var r = e.entry; for (e.entry = null; r;) { var n = r.callback; t.pendingcb--, n(void 0), r = r.next } t.corkedRequestsFree.next = e }(t, e) } } var a; e.exports = A, A.WritableState = S; var s, o = { deprecate: i(45) }, u = i(103), l = i(10).Buffer, d = t.Uint8Array || function() {}, c = i(104), h = i(105).getHighWaterMark, f = i(28).codes, p = f.ERR_INVALID_ARG_TYPE, m = f.ERR_METHOD_NOT_IMPLEMENTED, g = f.ERR_MULTIPLE_CALLBACK, v = f.ERR_STREAM_CANNOT_PIPE, y = f.ERR_STREAM_DESTROYED, _ = f.ERR_STREAM_NULL_VALUES, b = f.ERR_STREAM_WRITE_AFTER_END, w = f.ERR_UNKNOWN_ENCODING, E = c.errorOrDestroy; function T() {} function S(e, t, s) { a = a || i(29), e = e || {}, "boolean" != typeof s && (s = t instanceof a), this.objectMode = !!e .objectMode, s && (this.objectMode = this.objectMode || !!e.writableObjectMode), this .highWaterMark = h(this, e, "writableHighWaterMark", s), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1; var o = !1 === e.decodeStrings; this.decodeStrings = !o, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this .writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function( e) { ! function(e, t) { var i = e._writableState, n = i.sync, a = i.writecb; if ("function" != typeof a) throw new g; if (function(e) { e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0 }(i), t) ! function(e, t, i, n, a) { --t.pendingcb, i ? (r.nextTick(a, n), r.nextTick(D, e, t), e._writableState.errorEmitted = ! 0, E(e, n)) : (a(n), e._writableState.errorEmitted = !0, E(e, n), D(e, t)) }(e, i, n, t, a); else { var s = O(i) || e.destroyed; s || i.corked || i.bufferProcessing || !i.bufferedRequest || M(e, i), n ? r.nextTick(R, e, i, s, a) : R(e, i, s, a) } }(t, e) }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !1 !== e .emitClose, this.autoDestroy = !!e.autoDestroy, this.bufferedRequestCount = 0, this .corkedRequestsFree = new n(this) } function A(e) { var t = this instanceof(a = a || i(29)); if (!t && !s.call(A, this)) return new A(e); this._writableState = new S(e, this, t), this.writable = !0, e && ("function" == typeof e.write && ( this._write = e.write), "function" == typeof e.writev && (this._writev = e.writev), "function" == typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && ( this._final = e.final)), u.call(this) } function k(e, t, i, r, n, a, s) { t.writelen = r, t.writecb = s, t.writing = !0, t.sync = !0, t.destroyed ? t.onwrite(new y("write")) : i ? e._writev(n, t.onwrite) : e._write(n, a, t.onwrite), t.sync = !1 } function R(e, t, i, r) { i || function(e, t) { 0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain")) }(e, t), t.pendingcb--, r(), D(e, t) } function M(e, t) { t.bufferProcessing = !0; var i = t.bufferedRequest; if (e._writev && i && i.next) { var r = t.bufferedRequestCount, a = new Array(r), s = t.corkedRequestsFree; s.entry = i; for (var o = 0, u = !0; i;) a[o] = i, i.isBuf || (u = !1), i = i.next, o += 1; a.allBuffers = u, k(e, t, !0, t.length, a, "", s.finish), t.pendingcb++, t.lastBufferedRequest = null, s.next ? (t.corkedRequestsFree = s.next, s.next = null) : t.corkedRequestsFree = new n(t), t .bufferedRequestCount = 0 } else { for (; i;) { var l = i.chunk, d = i.encoding, c = i.callback; if (k(e, t, !1, t.objectMode ? 1 : l.length, l, d, c), i = i.next, t.bufferedRequestCount--, t .writing) break } null === i && (t.lastBufferedRequest = null) } t.bufferedRequest = i, t.bufferProcessing = !1 } function O(e) { return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing } function C(e, t) { e._final(function(i) { t.pendingcb--, i && E(e, i), t.prefinished = !0, e.emit("prefinish"), D(e, t) }) } function D(e, t) { var i = O(t); if (i && (function(e, t) { t.prefinished || t.finalCalled || ("function" != typeof e._final || t.destroyed ? (t .prefinished = !0, e.emit("prefinish")) : (t.pendingcb++, t.finalCalled = !0, r.nextTick( C, e, t))) }(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"), t.autoDestroy))) { var n = e._readableState; (!n || n.autoDestroy && n.endEmitted) && e.destroy() } return i } i(5)(A, u), S.prototype.getBuffer = function() { for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next; return t }, function() { try { Object.defineProperty(S.prototype, "buffer", { get: o.deprecate(function() { return this.getBuffer() }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }) } catch (e) {} }(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[ Symbol.hasInstance] ? (s = Function.prototype[Symbol.hasInstance], Object.defineProperty(A, Symbol .hasInstance, { value: function(e) { return !!s.call(this, e) || this === A && e && e._writableState instanceof S } })) : s = function(e) { return e instanceof this }, A.prototype.pipe = function() { E(this, new v) }, A.prototype.write = function(e, t, i) { var n, a = this._writableState, s = !1, o = !a.objectMode && (n = e, l.isBuffer(n) || n instanceof d); return o && !l.isBuffer(e) && (e = function(e) { return l.from(e) }(e)), "function" == typeof t && (i = t, t = null), o ? t = "buffer" : t || (t = a .defaultEncoding), "function" != typeof i && (i = T), a.ending ? function(e, t) { var i = new b; E(e, i), r.nextTick(t, i) }(this, i) : (o || function(e, t, i, n) { var a; return null === i ? a = new _ : "string" == typeof i || t.objectMode || (a = new p("chunk", [ "string", "Buffer" ], i)), !a || (E(e, a), r.nextTick(n, a), !1) }(this, a, e, i)) && (a.pendingcb++, s = function(e, t, i, r, n, a) { if (!i) { var s = function(e, t, i) { return e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = l.from(t, i)), t }(t, r, n); r !== s && (i = !0, n = "buffer", r = s) } var o = t.objectMode ? 1 : r.length; t.length += o; var u = t.length < t.highWaterMark; if (u || (t.needDrain = !0), t.writing || t.corked) { var d = t.lastBufferedRequest; t.lastBufferedRequest = { chunk: r, encoding: n, isBuf: i, callback: a, next: null }, d ? d.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t .bufferedRequestCount += 1 } else k(e, t, !1, o, r, n, a); return u }(this, a, o, e, t, i)), s }, A.prototype.cork = function() { this._writableState.corked++ }, A.prototype.uncork = function() { var e = this._writableState; e.corked && (e.corked--, e.writing || e.corked || e.bufferProcessing || !e.bufferedRequest || M( this, e)) }, A.prototype.setDefaultEncoding = function(e) { if ("string" == typeof e && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw" ].indexOf((e + "").toLowerCase()) > -1)) throw new w(e); return this._writableState.defaultEncoding = e, this }, Object.defineProperty(A.prototype, "writableBuffer", { enumerable: !1, get: function() { return this._writableState && this._writableState.getBuffer() } }), Object.defineProperty(A.prototype, "writableHighWaterMark", { enumerable: !1, get: function() { return this._writableState.highWaterMark } }), A.prototype._write = function(e, t, i) { i(new m("_write()")) }, A.prototype._writev = null, A.prototype.end = function(e, t, i) { var n = this._writableState; return "function" == typeof e ? (i = e, e = null, t = null) : "function" == typeof t && (i = t, t = null), null != e && this.write(e, t), n.corked && (n.corked = 1, this.uncork()), n.ending || function(e, t, i) { t.ending = !0, D(e, t), i && (t.finished ? r.nextTick(i) : e.once("finish", i)), t.ended = !0, e .writable = !1 }(this, n, i), this }, Object.defineProperty(A.prototype, "writableLength", { enumerable: !1, get: function() { return this._writableState.length } }), Object.defineProperty(A.prototype, "destroyed", { enumerable: !1, get: function() { return void 0 !== this._writableState && this._writableState.destroyed }, set: function(e) { this._writableState && (this._writableState.destroyed = e) } }), A.prototype.destroy = c.destroy, A.prototype._undestroy = c.undestroy, A.prototype._destroy = function(e, t) { t(e) } }).call(this, i(13), i(9)) }, function(e, t, i) { "use strict"; e.exports = l; var r = i(28).codes, n = r.ERR_METHOD_NOT_IMPLEMENTED, a = r.ERR_MULTIPLE_CALLBACK, s = r.ERR_TRANSFORM_ALREADY_TRANSFORMING, o = r.ERR_TRANSFORM_WITH_LENGTH_0, u = i(29); function l(e) { if (!(this instanceof l)) return new l(e); u.call(this, e), this._transformState = { afterTransform: function(e, t) { var i = this._transformState; i.transforming = !1; var r = i.writecb; if (null === r) return this.emit("error", new a); i.writechunk = null, i.writecb = null, null != t && this.push(t), r(e); var n = this._readableState; n.reading = !1, (n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark) }.bind(this), needTransform: !1, transforming: !1, writecb: null, writechunk: null, writeencoding: null }, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e .transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush) ), this.on("prefinish", d) } function d() { var e = this; "function" != typeof this._flush || this._readableState.destroyed ? c(this, null, null) : this._flush( function(t, i) { c(e, t, i) }) } function c(e, t, i) { if (t) return e.emit("error", t); if (null != i && e.push(i), e._writableState.length) throw new o; if (e._transformState.transforming) throw new s; return e.push(null) } i(5)(l, u), l.prototype.push = function(e, t) { return this._transformState.needTransform = !1, u.prototype.push.call(this, e, t) }, l.prototype._transform = function(e, t, i) { i(new n("_transform()")) }, l.prototype._write = function(e, t, i) { var r = this._transformState; if (r.writecb = i, r.writechunk = e, r.writeencoding = t, !r.transforming) { var n = this._readableState; (r.needTransform || n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark) } }, l.prototype._read = function(e) { var t = this._transformState; null === t.writechunk || t.transforming ? t.needTransform = !0 : (t.transforming = !0, this._transform(t .writechunk, t.writeencoding, t.afterTransform)) }, l.prototype._destroy = function(e, t) { u.prototype._destroy.call(this, e, function(e) { t(e) }) } }, function(e, t, i) { "use strict"; var r = t; function n(e) { return 1 === e.length ? "0" + e : e } function a(e) { for (var t = "", i = 0; i < e.length; i++) t += n(e[i].toString(16)); return t } r.toArray = function(e, t) { if (Array.isArray(e)) return e.slice(); if (!e) return []; var i = []; if ("string" != typeof e) { for (var r = 0; r < e.length; r++) i[r] = 0 | e[r]; return i } if ("hex" === t) for ((e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), r = 0; r < e.length; r += 2) i.push(parseInt(e[r] + e[r + 1], 16)); else for (r = 0; r < e.length; r++) { var n = e.charCodeAt(r), a = n >> 8, s = 255 & n; a ? i.push(a, s) : i.push(s) } return i }, r.zero2 = n, r.toHex = a, r.encode = function(e, t) { return "hex" === t ? a(e) : e } }, function(e, t, i) { "use strict"; var r = t; r.base = i(41), r.short = i(195), r.mont = i(196), r.edwards = i(197) }, function(e, t, i) { "use strict"; var r = i(18).rotr32; function n(e, t, i) { return e & t ^ ~e & i } function a(e, t, i) { return e & t ^ e & i ^ t & i } function s(e, t, i) { return e ^ t ^ i } t.ft_1 = function(e, t, i, r) { return 0 === e ? n(t, i, r) : 1 === e || 3 === e ? s(t, i, r) : 2 === e ? a(t, i, r) : void 0 }, t.ch32 = n, t.maj32 = a, t.p32 = s, t.s0_256 = function(e) { return r(e, 2) ^ r(e, 13) ^ r(e, 22) }, t.s1_256 = function(e) { return r(e, 6) ^ r(e, 11) ^ r(e, 25) }, t.g0_256 = function(e) { return r(e, 7) ^ r(e, 18) ^ e >>> 3 }, t.g1_256 = function(e) { return r(e, 17) ^ r(e, 19) ^ e >>> 10 } }, function(e, t, i) { "use strict"; var r = i(18), n = i(34), a = i(110), s = i(14), o = r.sum32, u = r.sum32_4, l = r.sum32_5, d = a.ch32, c = a.maj32, h = a.s0_256, f = a.s1_256, p = a.g0_256, m = a.g1_256, g = n.BlockHash, v = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ]; function y() { if (!(this instanceof y)) return new y; g.call(this), this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ], this.k = v, this.W = new Array(64) } r.inherits(y, g), e.exports = y, y.blockSize = 512, y.outSize = 256, y.hmacStrength = 192, y.padLength = 64, y.prototype._update = function(e, t) { for (var i = this.W, r = 0; r < 16; r++) i[r] = e[t + r]; for (; r < i.length; r++) i[r] = u(m(i[r - 2]), i[r - 7], p(i[r - 15]), i[r - 16]); var n = this.h[0], a = this.h[1], g = this.h[2], v = this.h[3], y = this.h[4], _ = this.h[5], b = this.h[6], w = this.h[7]; for (s(this.k.length === i.length), r = 0; r < i.length; r++) { var E = l(w, f(y), d(y, _, b), this.k[r], i[r]), T = o(h(n), c(n, a, g)); w = b, b = _, _ = y, y = o(v, E), v = g, g = a, a = n, n = o(E, T) } this.h[0] = o(this.h[0], n), this.h[1] = o(this.h[1], a), this.h[2] = o(this.h[2], g), this.h[3] = o( this.h[3], v), this.h[4] = o(this.h[4], y), this.h[5] = o(this.h[5], _), this.h[6] = o(this.h[6], b), this.h[7] = o(this.h[7], w) }, y.prototype._digest = function(e) { return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big") } }, function(e, t, i) { "use strict"; var r = i(18), n = i(34), a = i(14), s = r.rotr64_hi, o = r.rotr64_lo, u = r.shr64_hi, l = r.shr64_lo, d = r.sum64, c = r.sum64_hi, h = r.sum64_lo, f = r.sum64_4_hi, p = r.sum64_4_lo, m = r.sum64_5_hi, g = r.sum64_5_lo, v = n.BlockHash, y = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591 ]; function _() { if (!(this instanceof _)) return new _; v.call(this), this.h = [1779033703, 4089235720, 3144134277, 2227873595, 1013904242, 4271175723, 2773480762, 1595750129, 1359893119, 2917565137, 2600822924, 725511199, 528734635, 4215389547, 1541459225, 327033209 ], this.k = y, this.W = new Array(160) } function b(e, t, i, r, n) { var a = e & i ^ ~e & n; return a < 0 && (a += 4294967296), a } function w(e, t, i, r, n, a) { var s = t & r ^ ~t & a; return s < 0 && (s += 4294967296), s } function E(e, t, i, r, n) { var a = e & i ^ e & n ^ i & n; return a < 0 && (a += 4294967296), a } function T(e, t, i, r, n, a) { var s = t & r ^ t & a ^ r & a; return s < 0 && (s += 4294967296), s } function S(e, t) { var i = s(e, t, 28) ^ s(t, e, 2) ^ s(t, e, 7); return i < 0 && (i += 4294967296), i } function A(e, t) { var i = o(e, t, 28) ^ o(t, e, 2) ^ o(t, e, 7); return i < 0 && (i += 4294967296), i } function k(e, t) { var i = s(e, t, 14) ^ s(e, t, 18) ^ s(t, e, 9); return i < 0 && (i += 4294967296), i } function R(e, t) { var i = o(e, t, 14) ^ o(e, t, 18) ^ o(t, e, 9); return i < 0 && (i += 4294967296), i } function M(e, t) { var i = s(e, t, 1) ^ s(e, t, 8) ^ u(e, t, 7); return i < 0 && (i += 4294967296), i } function O(e, t) { var i = o(e, t, 1) ^ o(e, t, 8) ^ l(e, t, 7); return i < 0 && (i += 4294967296), i } function C(e, t) { var i = s(e, t, 19) ^ s(t, e, 29) ^ u(e, t, 6); return i < 0 && (i += 4294967296), i } function D(e, t) { var i = o(e, t, 19) ^ o(t, e, 29) ^ l(e, t, 6); return i < 0 && (i += 4294967296), i } r.inherits(_, v), e.exports = _, _.blockSize = 1024, _.outSize = 512, _.hmacStrength = 192, _.padLength = 128, _.prototype._prepareBlock = function(e, t) { for (var i = this.W, r = 0; r < 32; r++) i[r] = e[t + r]; for (; r < i.length; r += 2) { var n = C(i[r - 4], i[r - 3]), a = D(i[r - 4], i[r - 3]), s = i[r - 14], o = i[r - 13], u = M(i[r - 30], i[r - 29]), l = O(i[r - 30], i[r - 29]), d = i[r - 32], c = i[r - 31]; i[r] = f(n, a, s, o, u, l, d, c), i[r + 1] = p(n, a, s, o, u, l, d, c) } }, _.prototype._update = function(e, t) { this._prepareBlock(e, t); var i = this.W, r = this.h[0], n = this.h[1], s = this.h[2], o = this.h[3], u = this.h[4], l = this.h[5], f = this.h[6], p = this.h[7], v = this.h[8], y = this.h[9], _ = this.h[10], M = this.h[11], O = this.h[12], C = this.h[13], D = this.h[14], I = this.h[15]; a(this.k.length === i.length); for (var L = 0; L < i.length; L += 2) { var x = D, P = I, U = k(v, y), N = R(v, y), B = b(v, 0, _, 0, O), F = w(0, y, 0, M, 0, C), j = this.k[L], H = this.k[L + 1], G = i[L], V = i[L + 1], W = m(x, P, U, N, B, F, j, H, G, V), q = g(x, P, U, N, B, F, j, H, G, V); x = S(r, n), P = A(r, n), U = E(r, 0, s, 0, u), N = T(0, n, 0, o, 0, l); var X = c(x, P, U, N), z = h(x, P, U, N); D = O, I = C, O = _, C = M, _ = v, M = y, v = c(f, p, W, q), y = h(p, p, W, q), f = u, p = l, u = s, l = o, s = r, o = n, r = c(W, q, X, z), n = h(W, q, X, z) } d(this.h, 0, r, n), d(this.h, 2, s, o), d(this.h, 4, u, l), d(this.h, 6, f, p), d(this.h, 8, v, y), d( this.h, 10, _, M), d(this.h, 12, O, C), d(this.h, 14, D, I) }, _.prototype._digest = function(e) { return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big") } }, function(e, t, i) { (function(e) { ! function(e, t) { "use strict"; function r(e, t) { if (!e) throw new Error(t || "Assertion failed") } function n(e, t) { e.super_ = t; var i = function() {}; i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e } function a(e, t, i) { if (a.isBN(e)) return e; this.negative = 0, this.words = null, this.length = 0, this.red = null, null !== e && ("le" !== t && "be" !== t || (i = t, t = 10), this._init(e || 0, t || 10, i || "be")) } var s; "object" == typeof e ? e.exports = a : t.BN = a, a.BN = a, a.wordSize = 26; try { s = "undefined" != typeof window && void 0 !== window.Buffer ? window.Buffer : i(212).Buffer } catch (e) {} function o(e, t) { var i = e.charCodeAt(t); return i >= 48 && i <= 57 ? i - 48 : i >= 65 && i <= 70 ? i - 55 : i >= 97 && i <= 102 ? i - 87 : void r(!1, "Invalid character in " + e) } function u(e, t, i) { var r = o(e, i); return i - 1 >= t && (r |= o(e, i - 1) << 4), r } function l(e, t, i, n) { for (var a = 0, s = 0, o = Math.min(e.length, i), u = t; u < o; u++) { var l = e.charCodeAt(u) - 48; a *= n, s = l >= 49 ? l - 49 + 10 : l >= 17 ? l - 17 + 10 : l, r(l >= 0 && s < n, "Invalid character"), a += s } return a } function d(e, t) { e.words = t.words, e.length = t.length, e.negative = t.negative, e.red = t.red } if (a.isBN = function(e) { return e instanceof a || null !== e && "object" == typeof e && e.constructor.wordSize === a .wordSize && Array.isArray(e.words) }, a.max = function(e, t) { return e.cmp(t) > 0 ? e : t }, a.min = function(e, t) { return e.cmp(t) < 0 ? e : t }, a.prototype._init = function(e, t, i) { if ("number" == typeof e) return this._initNumber(e, t, i); if ("object" == typeof e) return this._initArray(e, t, i); "hex" === t && (t = 16), r(t === (0 | t) && t >= 2 && t <= 36); var n = 0; "-" === (e = e.toString().replace(/\s+/g, ""))[0] && (n++, this.negative = 1), n < e.length && ( 16 === t ? this._parseHex(e, n, i) : (this._parseBase(e, t, n), "le" === i && this._initArray( this.toArray(), t, i))) }, a.prototype._initNumber = function(e, t, i) { e < 0 && (this.negative = 1, e = -e), e < 67108864 ? (this.words = [67108863 & e], this.length = 1) : e < 4503599627370496 ? (this.words = [67108863 & e, e / 67108864 & 67108863], this .length = 2) : (r(e < 9007199254740992), this.words = [67108863 & e, e / 67108864 & 67108863, 1 ], this.length = 3), "le" === i && this._initArray(this.toArray(), t, i) }, a.prototype._initArray = function(e, t, i) { if (r("number" == typeof e.length), e.length <= 0) return this.words = [0], this.length = 1, this; this.length = Math.ceil(e.length / 3), this.words = new Array(this.length); for (var n = 0; n < this.length; n++) this.words[n] = 0; var a, s, o = 0; if ("be" === i) for (n = e.length - 1, a = 0; n >= 0; n -= 3) s = e[n] | e[n - 1] << 8 | e[n - 2] << 16, this .words[a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && (o -= 26, a++); else if ("le" === i) for (n = 0, a = 0; n < e.length; n += 3) s = e[n] | e[n + 1] << 8 | e[n + 2] << 16, this.words[ a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && ( o -= 26, a++); return this._strip() }, a.prototype._parseHex = function(e, t, i) { this.length = Math.ceil((e.length - t) / 6), this.words = new Array(this.length); for (var r = 0; r < this.length; r++) this.words[r] = 0; var n, a = 0, s = 0; if ("be" === i) for (r = e.length - 1; r >= t; r -= 2) n = u(e, t, r) << a, this.words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8; else for (r = (e.length - t) % 2 == 0 ? t + 1 : t; r < e.length; r += 2) n = u(e, t, r) << a, this .words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8; this._strip() }, a.prototype._parseBase = function(e, t, i) { this.words = [0], this.length = 1; for (var r = 0, n = 1; n <= 67108863; n *= t) r++; r--, n = n / t | 0; for (var a = e.length - i, s = a % r, o = Math.min(a, a - s) + i, u = 0, d = i; d < o; d += r) u = l(e, d, d + r, t), this.imuln(n), this.words[0] + u < 67108864 ? this.words[0] += u : this ._iaddn(u); if (0 !== s) { var c = 1; for (u = l(e, d, e.length, t), d = 0; d < s; d++) c *= t; this.imuln(c), this.words[0] + u < 67108864 ? this.words[0] += u : this._iaddn(u) } this._strip() }, a.prototype.copy = function(e) { e.words = new Array(this.length); for (var t = 0; t < this.length; t++) e.words[t] = this.words[t]; e.length = this.length, e.negative = this.negative, e.red = this.red }, a.prototype._move = function(e) { d(e, this) }, a.prototype.clone = function() { var e = new a(null); return this.copy(e), e }, a.prototype._expand = function(e) { for (; this.length < e;) this.words[this.length++] = 0; return this }, a.prototype._strip = function() { for (; this.length > 1 && 0 === this.words[this.length - 1];) this.length--; return this._normSign() }, a.prototype._normSign = function() { return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this }, "undefined" != typeof Symbol && "function" == typeof Symbol.for) try { a.prototype[Symbol.for("nodejs.util.inspect.custom")] = c } catch (e) { a.prototype.inspect = c } else a.prototype.inspect = c; function c() { return (this.red ? "" } var h = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000", "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000", "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000", "00000000000000000000", "000000000000000000000", "0000000000000000000000", "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000" ], f = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ], p = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 ]; function m(e, t, i) { i.negative = t.negative ^ e.negative; var r = e.length + t.length | 0; i.length = r, r = r - 1 | 0; var n = 0 | e.words[0], a = 0 | t.words[0], s = n * a, o = 67108863 & s, u = s / 67108864 | 0; i.words[0] = o; for (var l = 1; l < r; l++) { for (var d = u >>> 26, c = 67108863 & u, h = Math.min(l, t.length - 1), f = Math.max(0, l - e .length + 1); f <= h; f++) { var p = l - f | 0; d += (s = (n = 0 | e.words[p]) * (a = 0 | t.words[f]) + c) / 67108864 | 0, c = 67108863 & s } i.words[l] = 0 | c, u = 0 | d } return 0 !== u ? i.words[l] = 0 | u : i.length--, i._strip() } a.prototype.toString = function(e, t) { var i; if (t = 0 | t || 1, 16 === (e = e || 10) || "hex" === e) { i = ""; for (var n = 0, a = 0, s = 0; s < this.length; s++) { var o = this.words[s], u = (16777215 & (o << n | a)).toString(16); a = o >>> 24 - n & 16777215, (n += 2) >= 26 && (n -= 26, s--), i = 0 !== a || s !== this .length - 1 ? h[6 - u.length] + u + i : u + i } for (0 !== a && (i = a.toString(16) + i); i.length % t != 0;) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i } if (e === (0 | e) && e >= 2 && e <= 36) { var l = f[e], d = p[e]; i = ""; var c = this.clone(); for (c.negative = 0; !c.isZero();) { var m = c.modrn(d).toString(e); i = (c = c.idivn(d)).isZero() ? m + i : h[l - m.length] + m + i } for (this.isZero() && (i = "0" + i); i.length % t != 0;) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i } r(!1, "Base should be between 2 and 36") }, a.prototype.toNumber = function() { var e = this.words[0]; return 2 === this.length ? e += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[ 2] ? e += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && r(!1, "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e }, a.prototype.toJSON = function() { return this.toString(16, 2) }, s && (a.prototype.toBuffer = function(e, t) { return this.toArrayLike(s, e, t) }), a.prototype.toArray = function(e, t) { return this.toArrayLike(Array, e, t) }, a.prototype.toArrayLike = function(e, t, i) { this._strip(); var n = this.byteLength(), a = i || Math.max(1, n); r(n <= a, "byte array longer than desired length"), r(a > 0, "Requested array length <= 0"); var s = function(e, t) { return e.allocUnsafe ? e.allocUnsafe(t) : new e(t) }(e, a); return this["_toArrayLike" + ("le" === t ? "LE" : "BE")](s, n), s }, a.prototype._toArrayLikeLE = function(e, t) { for (var i = 0, r = 0, n = 0, a = 0; n < this.length; n++) { var s = this.words[n] << a | r; e[i++] = 255 & s, i < e.length && (e[i++] = s >> 8 & 255), i < e.length && (e[i++] = s >> 16 & 255), 6 === a ? (i < e.length && (e[i++] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24, a += 2) } if (i < e.length) for (e[i++] = r; i < e.length;) e[i++] = 0 }, a.prototype._toArrayLikeBE = function(e, t) { for (var i = e.length - 1, r = 0, n = 0, a = 0; n < this.length; n++) { var s = this.words[n] << a | r; e[i--] = 255 & s, i >= 0 && (e[i--] = s >> 8 & 255), i >= 0 && (e[i--] = s >> 16 & 255), 6 === a ? (i >= 0 && (e[i--] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24, a += 2) } if (i >= 0) for (e[i--] = r; i >= 0;) e[i--] = 0 }, Math.clz32 ? a.prototype._countBits = function(e) { return 32 - Math.clz32(e) } : a.prototype._countBits = function(e) { var t = e, i = 0; return t >= 4096 && (i += 13, t >>>= 13), t >= 64 && (i += 7, t >>>= 7), t >= 8 && (i += 4, t >>>= 4), t >= 2 && (i += 2, t >>>= 2), i + t }, a.prototype._zeroBits = function(e) { if (0 === e) return 26; var t = e, i = 0; return 0 == (8191 & t) && (i += 13, t >>>= 13), 0 == (127 & t) && (i += 7, t >>>= 7), 0 == (15 & t) && (i += 4, t >>>= 4), 0 == (3 & t) && (i += 2, t >>>= 2), 0 == (1 & t) && i++, i }, a.prototype.bitLength = function() { var e = this.words[this.length - 1], t = this._countBits(e); return 26 * (this.length - 1) + t }, a.prototype.zeroBits = function() { if (this.isZero()) return 0; for (var e = 0, t = 0; t < this.length; t++) { var i = this._zeroBits(this.words[t]); if (e += i, 26 !== i) break } return e }, a.prototype.byteLength = function() { return Math.ceil(this.bitLength() / 8) }, a.prototype.toTwos = function(e) { return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone() }, a.prototype.fromTwos = function(e) { return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone() }, a.prototype.isNeg = function() { return 0 !== this.negative }, a.prototype.neg = function() { return this.clone().ineg() }, a.prototype.ineg = function() { return this.isZero() || (this.negative ^= 1), this }, a.prototype.iuor = function(e) { for (; this.length < e.length;) this.words[this.length++] = 0; for (var t = 0; t < e.length; t++) this.words[t] = this.words[t] | e.words[t]; return this._strip() }, a.prototype.ior = function(e) { return r(0 == (this.negative | e.negative)), this.iuor(e) }, a.prototype.or = function(e) { return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this) }, a.prototype.uor = function(e) { return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this) }, a.prototype.iuand = function(e) { var t; t = this.length > e.length ? e : this; for (var i = 0; i < t.length; i++) this.words[i] = this.words[i] & e.words[i]; return this.length = t.length, this._strip() }, a.prototype.iand = function(e) { return r(0 == (this.negative | e.negative)), this.iuand(e) }, a.prototype.and = function(e) { return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this) }, a.prototype.uand = function(e) { return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this) }, a.prototype.iuxor = function(e) { var t, i; this.length > e.length ? (t = this, i = e) : (t = e, i = this); for (var r = 0; r < i.length; r++) this.words[r] = t.words[r] ^ i.words[r]; if (this !== t) for (; r < t.length; r++) this.words[r] = t.words[r]; return this.length = t.length, this._strip() }, a.prototype.ixor = function(e) { return r(0 == (this.negative | e.negative)), this.iuxor(e) }, a.prototype.xor = function(e) { return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this) }, a.prototype.uxor = function(e) { return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this) }, a.prototype.inotn = function(e) { r("number" == typeof e && e >= 0); var t = 0 | Math.ceil(e / 26), i = e % 26; this._expand(t), i > 0 && t--; for (var n = 0; n < t; n++) this.words[n] = 67108863 & ~this.words[n]; return i > 0 && (this.words[n] = ~this.words[n] & 67108863 >> 26 - i), this._strip() }, a.prototype.notn = function(e) { return this.clone().inotn(e) }, a.prototype.setn = function(e, t) { r("number" == typeof e && e >= 0); var i = e / 26 | 0, n = e % 26; return this._expand(i + 1), this.words[i] = t ? this.words[i] | 1 << n : this.words[i] & ~(1 << n), this._strip() }, a.prototype.iadd = function(e) { var t, i, r; if (0 !== this.negative && 0 === e.negative) return this.negative = 0, t = this.isub(e), this .negative ^= 1, this._normSign(); if (0 === this.negative && 0 !== e.negative) return e.negative = 0, t = this.isub(e), e.negative = 1, t._normSign(); this.length > e.length ? (i = this, r = e) : (i = e, r = this); for (var n = 0, a = 0; a < r.length; a++) t = (0 | i.words[a]) + (0 | r.words[a]) + n, this.words[ a] = 67108863 & t, n = t >>> 26; for (; 0 !== n && a < i.length; a++) t = (0 | i.words[a]) + n, this.words[a] = 67108863 & t, n = t >>> 26; if (this.length = i.length, 0 !== n) this.words[this.length] = n, this.length++; else if (i !== this) for (; a < i.length; a++) this.words[a] = i.words[a]; return this }, a.prototype.add = function(e) { var t; return 0 !== e.negative && 0 === this.negative ? (e.negative = 0, t = this.sub(e), e.negative ^= 1, t) : 0 === e.negative && 0 !== this.negative ? (this.negative = 0, t = e.sub(this), this .negative = 1, t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this) }, a.prototype.isub = function(e) { if (0 !== e.negative) { e.negative = 0; var t = this.iadd(e); return e.negative = 1, t._normSign() } if (0 !== this.negative) return this.negative = 0, this.iadd(e), this.negative = 1, this ._normSign(); var i, r, n = this.cmp(e); if (0 === n) return this.negative = 0, this.length = 1, this.words[0] = 0, this; n > 0 ? (i = this, r = e) : (i = e, r = this); for (var a = 0, s = 0; s < r.length; s++) a = (t = (0 | i.words[s]) - (0 | r.words[s]) + a) >> 26, this.words[s] = 67108863 & t; for (; 0 !== a && s < i.length; s++) a = (t = (0 | i.words[s]) + a) >> 26, this.words[s] = 67108863 & t; if (0 === a && s < i.length && i !== this) for (; s < i.length; s++) this.words[s] = i.words[s]; return this.length = Math.max(this.length, s), i !== this && (this.negative = 1), this._strip() }, a.prototype.sub = function(e) { return this.clone().isub(e) }; var g = function(e, t, i) { var r, n, a, s = e.words, o = t.words, u = i.words, l = 0, d = 0 | s[0], c = 8191 & d, h = d >>> 13, f = 0 | s[1], p = 8191 & f, m = f >>> 13, g = 0 | s[2], v = 8191 & g, y = g >>> 13, _ = 0 | s[3], b = 8191 & _, w = _ >>> 13, E = 0 | s[4], T = 8191 & E, S = E >>> 13, A = 0 | s[5], k = 8191 & A, R = A >>> 13, M = 0 | s[6], O = 8191 & M, C = M >>> 13, D = 0 | s[7], I = 8191 & D, L = D >>> 13, x = 0 | s[8], P = 8191 & x, U = x >>> 13, N = 0 | s[9], B = 8191 & N, F = N >>> 13, j = 0 | o[0], H = 8191 & j, G = j >>> 13, V = 0 | o[1], W = 8191 & V, q = V >>> 13, X = 0 | o[2], z = 8191 & X, K = X >>> 13, Y = 0 | o[3], Q = 8191 & Y, J = Y >>> 13, Z = 0 | o[4], $ = 8191 & Z, ee = Z >>> 13, te = 0 | o[5], ie = 8191 & te, re = te >>> 13, ne = 0 | o[6], ae = 8191 & ne, se = ne >>> 13, oe = 0 | o[7], ue = 8191 & oe, le = oe >>> 13, de = 0 | o[8], ce = 8191 & de, he = de >>> 13, fe = 0 | o[9], pe = 8191 & fe, me = fe >>> 13; i.negative = e.negative ^ t.negative, i.length = 19; var ge = (l + (r = Math.imul(c, H)) | 0) + ((8191 & (n = (n = Math.imul(c, G)) + Math.imul(h, H) | 0)) << 13) | 0; l = ((a = Math.imul(h, G)) + (n >>> 13) | 0) + (ge >>> 26) | 0, ge &= 67108863, r = Math.imul(p, H), n = (n = Math.imul(p, G)) + Math.imul(m, H) | 0, a = Math.imul(m, G); var ve = (l + (r = r + Math.imul(c, W) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, q) | 0) + Math.imul(h, W) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, q) | 0) + (n >>> 13) | 0) + (ve >>> 26) | 0, ve &= 67108863, r = Math .imul(v, H), n = (n = Math.imul(v, G)) + Math.imul(y, H) | 0, a = Math.imul(y, G), r = r + Math .imul(p, W) | 0, n = (n = n + Math.imul(p, q) | 0) + Math.imul(m, W) | 0, a = a + Math.imul(m, q) | 0; var ye = (l + (r = r + Math.imul(c, z) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, K) | 0) + Math.imul(h, z) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, K) | 0) + (n >>> 13) | 0) + (ye >>> 26) | 0, ye &= 67108863, r = Math .imul(b, H), n = (n = Math.imul(b, G)) + Math.imul(w, H) | 0, a = Math.imul(w, G), r = r + Math .imul(v, W) | 0, n = (n = n + Math.imul(v, q) | 0) + Math.imul(y, W) | 0, a = a + Math.imul(y, q) | 0, r = r + Math.imul(p, z) | 0, n = (n = n + Math.imul(p, K) | 0) + Math.imul(m, z) | 0, a = a + Math.imul(m, K) | 0; var _e = (l + (r = r + Math.imul(c, Q) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, J) | 0) + Math.imul(h, Q) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, J) | 0) + (n >>> 13) | 0) + (_e >>> 26) | 0, _e &= 67108863, r = Math .imul(T, H), n = (n = Math.imul(T, G)) + Math.imul(S, H) | 0, a = Math.imul(S, G), r = r + Math .imul(b, W) | 0, n = (n = n + Math.imul(b, q) | 0) + Math.imul(w, W) | 0, a = a + Math.imul(w, q) | 0, r = r + Math.imul(v, z) | 0, n = (n = n + Math.imul(v, K) | 0) + Math.imul(y, z) | 0, a = a + Math.imul(y, K) | 0, r = r + Math.imul(p, Q) | 0, n = (n = n + Math.imul(p, J) | 0) + Math.imul(m, Q) | 0, a = a + Math.imul(m, J) | 0; var be = (l + (r = r + Math.imul(c, $) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, ee) | 0) + Math.imul(h, $) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, ee) | 0) + (n >>> 13) | 0) + (be >>> 26) | 0, be &= 67108863, r = Math .imul(k, H), n = (n = Math.imul(k, G)) + Math.imul(R, H) | 0, a = Math.imul(R, G), r = r + Math .imul(T, W) | 0, n = (n = n + Math.imul(T, q) | 0) + Math.imul(S, W) | 0, a = a + Math.imul(S, q) | 0, r = r + Math.imul(b, z) | 0, n = (n = n + Math.imul(b, K) | 0) + Math.imul(w, z) | 0, a = a + Math.imul(w, K) | 0, r = r + Math.imul(v, Q) | 0, n = (n = n + Math.imul(v, J) | 0) + Math.imul(y, Q) | 0, a = a + Math.imul(y, J) | 0, r = r + Math.imul(p, $) | 0, n = (n = n + Math .imul(p, ee) | 0) + Math.imul(m, $) | 0, a = a + Math.imul(m, ee) | 0; var we = (l + (r = r + Math.imul(c, ie) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, re) | 0) + Math.imul(h, ie) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, re) | 0) + (n >>> 13) | 0) + (we >>> 26) | 0, we &= 67108863, r = Math .imul(O, H), n = (n = Math.imul(O, G)) + Math.imul(C, H) | 0, a = Math.imul(C, G), r = r + Math .imul(k, W) | 0, n = (n = n + Math.imul(k, q) | 0) + Math.imul(R, W) | 0, a = a + Math.imul(R, q) | 0, r = r + Math.imul(T, z) | 0, n = (n = n + Math.imul(T, K) | 0) + Math.imul(S, z) | 0, a = a + Math.imul(S, K) | 0, r = r + Math.imul(b, Q) | 0, n = (n = n + Math.imul(b, J) | 0) + Math.imul(w, Q) | 0, a = a + Math.imul(w, J) | 0, r = r + Math.imul(v, $) | 0, n = (n = n + Math .imul(v, ee) | 0) + Math.imul(y, $) | 0, a = a + Math.imul(y, ee) | 0, r = r + Math.imul(p, ie) | 0, n = (n = n + Math.imul(p, re) | 0) + Math.imul(m, ie) | 0, a = a + Math.imul(m, re) | 0; var Ee = (l + (r = r + Math.imul(c, ae) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, se) | 0) + Math.imul(h, ae) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, se) | 0) + (n >>> 13) | 0) + (Ee >>> 26) | 0, Ee &= 67108863, r = Math .imul(I, H), n = (n = Math.imul(I, G)) + Math.imul(L, H) | 0, a = Math.imul(L, G), r = r + Math .imul(O, W) | 0, n = (n = n + Math.imul(O, q) | 0) + Math.imul(C, W) | 0, a = a + Math.imul(C, q) | 0, r = r + Math.imul(k, z) | 0, n = (n = n + Math.imul(k, K) | 0) + Math.imul(R, z) | 0, a = a + Math.imul(R, K) | 0, r = r + Math.imul(T, Q) | 0, n = (n = n + Math.imul(T, J) | 0) + Math.imul(S, Q) | 0, a = a + Math.imul(S, J) | 0, r = r + Math.imul(b, $) | 0, n = (n = n + Math .imul(b, ee) | 0) + Math.imul(w, $) | 0, a = a + Math.imul(w, ee) | 0, r = r + Math.imul(v, ie) | 0, n = (n = n + Math.imul(v, re) | 0) + Math.imul(y, ie) | 0, a = a + Math.imul(y, re) | 0, r = r + Math.imul(p, ae) | 0, n = (n = n + Math.imul(p, se) | 0) + Math.imul(m, ae) | 0, a = a + Math.imul(m, se) | 0; var Te = (l + (r = r + Math.imul(c, ue) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, le) | 0) + Math.imul(h, ue) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, le) | 0) + (n >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, r = Math .imul(P, H), n = (n = Math.imul(P, G)) + Math.imul(U, H) | 0, a = Math.imul(U, G), r = r + Math .imul(I, W) | 0, n = (n = n + Math.imul(I, q) | 0) + Math.imul(L, W) | 0, a = a + Math.imul(L, q) | 0, r = r + Math.imul(O, z) | 0, n = (n = n + Math.imul(O, K) | 0) + Math.imul(C, z) | 0, a = a + Math.imul(C, K) | 0, r = r + Math.imul(k, Q) | 0, n = (n = n + Math.imul(k, J) | 0) + Math.imul(R, Q) | 0, a = a + Math.imul(R, J) | 0, r = r + Math.imul(T, $) | 0, n = (n = n + Math .imul(T, ee) | 0) + Math.imul(S, $) | 0, a = a + Math.imul(S, ee) | 0, r = r + Math.imul(b, ie) | 0, n = (n = n + Math.imul(b, re) | 0) + Math.imul(w, ie) | 0, a = a + Math.imul(w, re) | 0, r = r + Math.imul(v, ae) | 0, n = (n = n + Math.imul(v, se) | 0) + Math.imul(y, ae) | 0, a = a + Math.imul(y, se) | 0, r = r + Math.imul(p, ue) | 0, n = (n = n + Math.imul(p, le) | 0) + Math.imul(m, ue) | 0, a = a + Math.imul(m, le) | 0; var Se = (l + (r = r + Math.imul(c, ce) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, he) | 0) + Math.imul(h, ce) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, he) | 0) + (n >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, r = Math .imul(B, H), n = (n = Math.imul(B, G)) + Math.imul(F, H) | 0, a = Math.imul(F, G), r = r + Math .imul(P, W) | 0, n = (n = n + Math.imul(P, q) | 0) + Math.imul(U, W) | 0, a = a + Math.imul(U, q) | 0, r = r + Math.imul(I, z) | 0, n = (n = n + Math.imul(I, K) | 0) + Math.imul(L, z) | 0, a = a + Math.imul(L, K) | 0, r = r + Math.imul(O, Q) | 0, n = (n = n + Math.imul(O, J) | 0) + Math.imul(C, Q) | 0, a = a + Math.imul(C, J) | 0, r = r + Math.imul(k, $) | 0, n = (n = n + Math .imul(k, ee) | 0) + Math.imul(R, $) | 0, a = a + Math.imul(R, ee) | 0, r = r + Math.imul(T, ie) | 0, n = (n = n + Math.imul(T, re) | 0) + Math.imul(S, ie) | 0, a = a + Math.imul(S, re) | 0, r = r + Math.imul(b, ae) | 0, n = (n = n + Math.imul(b, se) | 0) + Math.imul(w, ae) | 0, a = a + Math.imul(w, se) | 0, r = r + Math.imul(v, ue) | 0, n = (n = n + Math.imul(v, le) | 0) + Math.imul(y, ue) | 0, a = a + Math.imul(y, le) | 0, r = r + Math.imul(p, ce) | 0, n = (n = n + Math.imul(p, he) | 0) + Math.imul(m, ce) | 0, a = a + Math.imul(m, he) | 0; var Ae = (l + (r = r + Math.imul(c, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, me) | 0) + Math.imul(h, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, me) | 0) + (n >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, r = Math .imul(B, W), n = (n = Math.imul(B, q)) + Math.imul(F, W) | 0, a = Math.imul(F, q), r = r + Math .imul(P, z) | 0, n = (n = n + Math.imul(P, K) | 0) + Math.imul(U, z) | 0, a = a + Math.imul(U, K) | 0, r = r + Math.imul(I, Q) | 0, n = (n = n + Math.imul(I, J) | 0) + Math.imul(L, Q) | 0, a = a + Math.imul(L, J) | 0, r = r + Math.imul(O, $) | 0, n = (n = n + Math.imul(O, ee) | 0) + Math.imul(C, $) | 0, a = a + Math.imul(C, ee) | 0, r = r + Math.imul(k, ie) | 0, n = (n = n + Math.imul(k, re) | 0) + Math.imul(R, ie) | 0, a = a + Math.imul(R, re) | 0, r = r + Math.imul( T, ae) | 0, n = (n = n + Math.imul(T, se) | 0) + Math.imul(S, ae) | 0, a = a + Math.imul(S, se) | 0, r = r + Math.imul(b, ue) | 0, n = (n = n + Math.imul(b, le) | 0) + Math.imul(w, ue) | 0, a = a + Math.imul(w, le) | 0, r = r + Math.imul(v, ce) | 0, n = (n = n + Math.imul(v, he) | 0) + Math.imul(y, ce) | 0, a = a + Math.imul(y, he) | 0; var ke = (l + (r = r + Math.imul(p, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(p, me) | 0) + Math.imul(m, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(m, me) | 0) + (n >>> 13) | 0) + (ke >>> 26) | 0, ke &= 67108863, r = Math .imul(B, z), n = (n = Math.imul(B, K)) + Math.imul(F, z) | 0, a = Math.imul(F, K), r = r + Math .imul(P, Q) | 0, n = (n = n + Math.imul(P, J) | 0) + Math.imul(U, Q) | 0, a = a + Math.imul(U, J) | 0, r = r + Math.imul(I, $) | 0, n = (n = n + Math.imul(I, ee) | 0) + Math.imul(L, $) | 0, a = a + Math.imul(L, ee) | 0, r = r + Math.imul(O, ie) | 0, n = (n = n + Math.imul(O, re) | 0) + Math.imul(C, ie) | 0, a = a + Math.imul(C, re) | 0, r = r + Math.imul(k, ae) | 0, n = (n = n + Math.imul(k, se) | 0) + Math.imul(R, ae) | 0, a = a + Math.imul(R, se) | 0, r = r + Math.imul( T, ue) | 0, n = (n = n + Math.imul(T, le) | 0) + Math.imul(S, ue) | 0, a = a + Math.imul(S, le) | 0, r = r + Math.imul(b, ce) | 0, n = (n = n + Math.imul(b, he) | 0) + Math.imul(w, ce) | 0, a = a + Math.imul(w, he) | 0; var Re = (l + (r = r + Math.imul(v, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(v, me) | 0) + Math.imul(y, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(y, me) | 0) + (n >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, r = Math .imul(B, Q), n = (n = Math.imul(B, J)) + Math.imul(F, Q) | 0, a = Math.imul(F, J), r = r + Math .imul(P, $) | 0, n = (n = n + Math.imul(P, ee) | 0) + Math.imul(U, $) | 0, a = a + Math.imul(U, ee) | 0, r = r + Math.imul(I, ie) | 0, n = (n = n + Math.imul(I, re) | 0) + Math.imul(L, ie) | 0, a = a + Math.imul(L, re) | 0, r = r + Math.imul(O, ae) | 0, n = (n = n + Math.imul(O, se) | 0) + Math.imul(C, ae) | 0, a = a + Math.imul(C, se) | 0, r = r + Math.imul(k, ue) | 0, n = ( n = n + Math.imul(k, le) | 0) + Math.imul(R, ue) | 0, a = a + Math.imul(R, le) | 0, r = r + Math.imul(T, ce) | 0, n = (n = n + Math.imul(T, he) | 0) + Math.imul(S, ce) | 0, a = a + Math .imul(S, he) | 0; var Me = (l + (r = r + Math.imul(b, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(b, me) | 0) + Math.imul(w, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(w, me) | 0) + (n >>> 13) | 0) + (Me >>> 26) | 0, Me &= 67108863, r = Math .imul(B, $), n = (n = Math.imul(B, ee)) + Math.imul(F, $) | 0, a = Math.imul(F, ee), r = r + Math.imul(P, ie) | 0, n = (n = n + Math.imul(P, re) | 0) + Math.imul(U, ie) | 0, a = a + Math .imul(U, re) | 0, r = r + Math.imul(I, ae) | 0, n = (n = n + Math.imul(I, se) | 0) + Math.imul( L, ae) | 0, a = a + Math.imul(L, se) | 0, r = r + Math.imul(O, ue) | 0, n = (n = n + Math .imul(O, le) | 0) + Math.imul(C, ue) | 0, a = a + Math.imul(C, le) | 0, r = r + Math.imul(k, ce) | 0, n = (n = n + Math.imul(k, he) | 0) + Math.imul(R, ce) | 0, a = a + Math.imul(R, he) | 0; var Oe = (l + (r = r + Math.imul(T, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(T, me) | 0) + Math.imul(S, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(S, me) | 0) + (n >>> 13) | 0) + (Oe >>> 26) | 0, Oe &= 67108863, r = Math .imul(B, ie), n = (n = Math.imul(B, re)) + Math.imul(F, ie) | 0, a = Math.imul(F, re), r = r + Math.imul(P, ae) | 0, n = (n = n + Math.imul(P, se) | 0) + Math.imul(U, ae) | 0, a = a + Math .imul(U, se) | 0, r = r + Math.imul(I, ue) | 0, n = (n = n + Math.imul(I, le) | 0) + Math.imul( L, ue) | 0, a = a + Math.imul(L, le) | 0, r = r + Math.imul(O, ce) | 0, n = (n = n + Math .imul(O, he) | 0) + Math.imul(C, ce) | 0, a = a + Math.imul(C, he) | 0; var Ce = (l + (r = r + Math.imul(k, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(k, me) | 0) + Math.imul(R, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(R, me) | 0) + (n >>> 13) | 0) + (Ce >>> 26) | 0, Ce &= 67108863, r = Math .imul(B, ae), n = (n = Math.imul(B, se)) + Math.imul(F, ae) | 0, a = Math.imul(F, se), r = r + Math.imul(P, ue) | 0, n = (n = n + Math.imul(P, le) | 0) + Math.imul(U, ue) | 0, a = a + Math .imul(U, le) | 0, r = r + Math.imul(I, ce) | 0, n = (n = n + Math.imul(I, he) | 0) + Math.imul( L, ce) | 0, a = a + Math.imul(L, he) | 0; var De = (l + (r = r + Math.imul(O, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(O, me) | 0) + Math.imul(C, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(C, me) | 0) + (n >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, r = Math .imul(B, ue), n = (n = Math.imul(B, le)) + Math.imul(F, ue) | 0, a = Math.imul(F, le), r = r + Math.imul(P, ce) | 0, n = (n = n + Math.imul(P, he) | 0) + Math.imul(U, ce) | 0, a = a + Math .imul(U, he) | 0; var Ie = (l + (r = r + Math.imul(I, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(I, me) | 0) + Math.imul(L, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(L, me) | 0) + (n >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, r = Math .imul(B, ce), n = (n = Math.imul(B, he)) + Math.imul(F, ce) | 0, a = Math.imul(F, he); var Le = (l + (r = r + Math.imul(P, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(P, me) | 0) + Math.imul(U, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(U, me) | 0) + (n >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863; var xe = (l + (r = Math.imul(B, pe)) | 0) + ((8191 & (n = (n = Math.imul(B, me)) + Math.imul(F, pe) | 0)) << 13) | 0; return l = ((a = Math.imul(F, me)) + (n >>> 13) | 0) + (xe >>> 26) | 0, xe &= 67108863, u[0] = ge, u[1] = ve, u[2] = ye, u[3] = _e, u[4] = be, u[5] = we, u[6] = Ee, u[7] = Te, u[8] = Se, u[9] = Ae, u[10] = ke, u[11] = Re, u[12] = Me, u[13] = Oe, u[14] = Ce, u[15] = De, u[16] = Ie, u[17] = Le, u[18] = xe, 0 !== l && (u[19] = l, i.length++), i }; function v(e, t, i) { i.negative = t.negative ^ e.negative, i.length = e.length + t.length; for (var r = 0, n = 0, a = 0; a < i.length - 1; a++) { var s = n; n = 0; for (var o = 67108863 & r, u = Math.min(a, t.length - 1), l = Math.max(0, a - e.length + 1); l <= u; l++) { var d = a - l, c = (0 | e.words[d]) * (0 | t.words[l]), h = 67108863 & c; o = 67108863 & (h = h + o | 0), n += (s = (s = s + (c / 67108864 | 0) | 0) + (h >>> 26) | 0) >>> 26, s &= 67108863 } i.words[a] = o, r = s, s = n } return 0 !== r ? i.words[a] = r : i.length--, i._strip() } function y(e, t, i) { return v(e, t, i) } function _(e, t) { this.x = e, this.y = t } Math.imul || (g = m), a.prototype.mulTo = function(e, t) { var i = this.length + e.length; return 10 === this.length && 10 === e.length ? g(this, e, t) : i < 63 ? m(this, e, t) : i < 1024 ? v(this, e, t) : y(this, e, t) }, _.prototype.makeRBT = function(e) { for (var t = new Array(e), i = a.prototype._countBits(e) - 1, r = 0; r < e; r++) t[r] = this .revBin(r, i, e); return t }, _.prototype.revBin = function(e, t, i) { if (0 === e || e === i - 1) return e; for (var r = 0, n = 0; n < t; n++) r |= (1 & e) << t - n - 1, e >>= 1; return r }, _.prototype.permute = function(e, t, i, r, n, a) { for (var s = 0; s < a; s++) r[s] = t[e[s]], n[s] = i[e[s]] }, _.prototype.transform = function(e, t, i, r, n, a) { this.permute(a, e, t, i, r, n); for (var s = 1; s < n; s <<= 1) for (var o = s << 1, u = Math.cos(2 * Math.PI / o), l = Math.sin(2 * Math.PI / o), d = 0; d < n; d += o) for (var c = u, h = l, f = 0; f < s; f++) { var p = i[d + f], m = r[d + f], g = i[d + f + s], v = r[d + f + s], y = c * g - h * v; v = c * v + h * g, g = y, i[d + f] = p + g, r[d + f] = m + v, i[d + f + s] = p - g, r[d + f + s] = m - v, f !== o && (y = u * c - l * h, h = u * h + l * c, c = y) } }, _.prototype.guessLen13b = function(e, t) { var i = 1 | Math.max(t, e), r = 1 & i, n = 0; for (i = i / 2 | 0; i; i >>>= 1) n++; return 1 << n + 1 + r }, _.prototype.conjugate = function(e, t, i) { if (!(i <= 1)) for (var r = 0; r < i / 2; r++) { var n = e[r]; e[r] = e[i - r - 1], e[i - r - 1] = n, n = t[r], t[r] = -t[i - r - 1], t[i - r - 1] = -n } }, _.prototype.normalize13b = function(e, t) { for (var i = 0, r = 0; r < t / 2; r++) { var n = 8192 * Math.round(e[2 * r + 1] / t) + Math.round(e[2 * r] / t) + i; e[r] = 67108863 & n, i = n < 67108864 ? 0 : n / 67108864 | 0 } return e }, _.prototype.convert13b = function(e, t, i, n) { for (var a = 0, s = 0; s < t; s++) a += 0 | e[s], i[2 * s] = 8191 & a, a >>>= 13, i[2 * s + 1] = 8191 & a, a >>>= 13; for (s = 2 * t; s < n; ++s) i[s] = 0; r(0 === a), r(0 == (-8192 & a)) }, _.prototype.stub = function(e) { for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0; return t }, _.prototype.mulp = function(e, t, i) { var r = 2 * this.guessLen13b(e.length, t.length), n = this.makeRBT(r), a = this.stub(r), s = new Array(r), o = new Array(r), u = new Array(r), l = new Array(r), d = new Array(r), c = new Array(r), h = i.words; h.length = r, this.convert13b(e.words, e.length, s, r), this.convert13b(t.words, t.length, l, r), this.transform(s, a, o, u, r, n), this.transform(l, a, d, c, r, n); for (var f = 0; f < r; f++) { var p = o[f] * d[f] - u[f] * c[f]; u[f] = o[f] * c[f] + u[f] * d[f], o[f] = p } return this.conjugate(o, u, r), this.transform(o, u, h, a, r, n), this.conjugate(h, a, r), this .normalize13b(h, r), i.negative = e.negative ^ t.negative, i.length = e.length + t.length, i ._strip() }, a.prototype.mul = function(e) { var t = new a(null); return t.words = new Array(this.length + e.length), this.mulTo(e, t) }, a.prototype.mulf = function(e) { var t = new a(null); return t.words = new Array(this.length + e.length), y(this, e, t) }, a.prototype.imul = function(e) { return this.clone().mulTo(e, this) }, a.prototype.imuln = function(e) { var t = e < 0; t && (e = -e), r("number" == typeof e), r(e < 67108864); for (var i = 0, n = 0; n < this.length; n++) { var a = (0 | this.words[n]) * e, s = (67108863 & a) + (67108863 & i); i >>= 26, i += a / 67108864 | 0, i += s >>> 26, this.words[n] = 67108863 & s } return 0 !== i && (this.words[n] = i, this.length++), t ? this.ineg() : this }, a.prototype.muln = function(e) { return this.clone().imuln(e) }, a.prototype.sqr = function() { return this.mul(this) }, a.prototype.isqr = function() { return this.imul(this.clone()) }, a.prototype.pow = function(e) { var t = function(e) { for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) { var r = i / 26 | 0, n = i % 26; t[i] = e.words[r] >>> n & 1 } return t }(e); if (0 === t.length) return new a(1); for (var i = this, r = 0; r < t.length && 0 === t[r]; r++, i = i.sqr()); if (++r < t.length) for (var n = i.sqr(); r < t.length; r++, n = n.sqr()) 0 !== t[r] && (i = i.mul(n)); return i }, a.prototype.iushln = function(e) { r("number" == typeof e && e >= 0); var t, i = e % 26, n = (e - i) / 26, a = 67108863 >>> 26 - i << 26 - i; if (0 !== i) { var s = 0; for (t = 0; t < this.length; t++) { var o = this.words[t] & a, u = (0 | this.words[t]) - o << i; this.words[t] = u | s, s = o >>> 26 - i } s && (this.words[t] = s, this.length++) } if (0 !== n) { for (t = this.length - 1; t >= 0; t--) this.words[t + n] = this.words[t]; for (t = 0; t < n; t++) this.words[t] = 0; this.length += n } return this._strip() }, a.prototype.ishln = function(e) { return r(0 === this.negative), this.iushln(e) }, a.prototype.iushrn = function(e, t, i) { var n; r("number" == typeof e && e >= 0), n = t ? (t - t % 26) / 26 : 0; var a = e % 26, s = Math.min((e - a) / 26, this.length), o = 67108863 ^ 67108863 >>> a << a, u = i; if (n -= s, n = Math.max(0, n), u) { for (var l = 0; l < s; l++) u.words[l] = this.words[l]; u.length = s } if (0 === s); else if (this.length > s) for (this.length -= s, l = 0; l < this.length; l++) this.words[l] = this.words[l + s]; else this.words[0] = 0, this.length = 1; var d = 0; for (l = this.length - 1; l >= 0 && (0 !== d || l >= n); l--) { var c = 0 | this.words[l]; this.words[l] = d << 26 - a | c >>> a, d = c & o } return u && 0 !== d && (u.words[u.length++] = d), 0 === this.length && (this.words[0] = 0, this .length = 1), this._strip() }, a.prototype.ishrn = function(e, t, i) { return r(0 === this.negative), this.iushrn(e, t, i) }, a.prototype.shln = function(e) { return this.clone().ishln(e) }, a.prototype.ushln = function(e) { return this.clone().iushln(e) }, a.prototype.shrn = function(e) { return this.clone().ishrn(e) }, a.prototype.ushrn = function(e) { return this.clone().iushrn(e) }, a.prototype.testn = function(e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26, n = 1 << t; return !(this.length <= i || !(this.words[i] & n)) }, a.prototype.imaskn = function(e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26; if (r(0 === this.negative, "imaskn works only with positive numbers"), this.length <= i) return this; if (0 !== t && i++, this.length = Math.min(i, this.length), 0 !== t) { var n = 67108863 ^ 67108863 >>> t << t; this.words[this.length - 1] &= n } return this._strip() }, a.prototype.maskn = function(e) { return this.clone().imaskn(e) }, a.prototype.iaddn = function(e) { return r("number" == typeof e), r(e < 67108864), e < 0 ? this.isubn(-e) : 0 !== this.negative ? 1 === this.length && (0 | this.words[0]) <= e ? (this.words[0] = e - (0 | this.words[0]), this .negative = 0, this) : (this.negative = 0, this.isubn(e), this.negative = 1, this) : this ._iaddn(e) }, a.prototype._iaddn = function(e) { this.words[0] += e; for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) this.words[t] -= 67108864, t === this.length - 1 ? this.words[t + 1] = 1 : this.words[t + 1]++; return this.length = Math.max(this.length, t + 1), this }, a.prototype.isubn = function(e) { if (r("number" == typeof e), r(e < 67108864), e < 0) return this.iaddn(-e); if (0 !== this.negative) return this.negative = 0, this.iaddn(e), this.negative = 1, this; if (this.words[0] -= e, 1 === this.length && this.words[0] < 0) this.words[0] = -this.words[0], this.negative = 1; else for (var t = 0; t < this.length && this.words[t] < 0; t++) this.words[t] += 67108864, this .words[t + 1] -= 1; return this._strip() }, a.prototype.addn = function(e) { return this.clone().iaddn(e) }, a.prototype.subn = function(e) { return this.clone().isubn(e) }, a.prototype.iabs = function() { return this.negative = 0, this }, a.prototype.abs = function() { return this.clone().iabs() }, a.prototype._ishlnsubmul = function(e, t, i) { var n, a, s = e.length + i; this._expand(s); var o = 0; for (n = 0; n < e.length; n++) { a = (0 | this.words[n + i]) + o; var u = (0 | e.words[n]) * t; o = ((a -= 67108863 & u) >> 26) - (u / 67108864 | 0), this.words[n + i] = 67108863 & a } for (; n < this.length - i; n++) o = (a = (0 | this.words[n + i]) + o) >> 26, this.words[n + i] = 67108863 & a; if (0 === o) return this._strip(); for (r(-1 === o), o = 0, n = 0; n < this.length; n++) o = (a = -(0 | this.words[n]) + o) >> 26, this.words[n] = 67108863 & a; return this.negative = 1, this._strip() }, a.prototype._wordDiv = function(e, t) { var i = (this.length, e.length), r = this.clone(), n = e, s = 0 | n.words[n.length - 1]; 0 != (i = 26 - this._countBits(s)) && (n = n.ushln(i), r.iushln(i), s = 0 | n.words[n.length - 1]); var o, u = r.length - n.length; if ("mod" !== t) { (o = new a(null)).length = u + 1, o.words = new Array(o.length); for (var l = 0; l < o.length; l++) o.words[l] = 0 } var d = r.clone()._ishlnsubmul(n, 1, u); 0 === d.negative && (r = d, o && (o.words[u] = 1)); for (var c = u - 1; c >= 0; c--) { var h = 67108864 * (0 | r.words[n.length + c]) + (0 | r.words[n.length + c - 1]); for (h = Math.min(h / s | 0, 67108863), r._ishlnsubmul(n, h, c); 0 !== r.negative;) h--, r .negative = 0, r._ishlnsubmul(n, 1, c), r.isZero() || (r.negative ^= 1); o && (o.words[c] = h) } return o && o._strip(), r._strip(), "div" !== t && 0 !== i && r.iushrn(i), { div: o || null, mod: r } }, a.prototype.divmod = function(e, t, i) { return r(!e.isZero()), this.isZero() ? { div: new a(0), mod: new a(0) } : 0 !== this.negative && 0 === e.negative ? (o = this.neg().divmod(e, t), "mod" !== t && (n = o.div.neg()), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.iadd(e)), { div: n, mod: s }) : 0 === this.negative && 0 !== e.negative ? (o = this.divmod(e.neg(), t), "mod" !== t && (n = o.div.neg()), { div: n, mod: o.mod }) : 0 != (this.negative & e.negative) ? (o = this.neg().divmod(e.neg(), t), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.isub(e)), { div: o.div, mod: s }) : e.length > this.length || this.cmp(e) < 0 ? { div: new a(0), mod: this } : 1 === e.length ? "div" === t ? { div: this.divn(e.words[0]), mod: null } : "mod" === t ? { div: null, mod: new a(this.modrn(e.words[0])) } : { div: this.divn(e.words[0]), mod: new a(this.modrn(e.words[0])) } : this._wordDiv(e, t); var n, s, o }, a.prototype.div = function(e) { return this.divmod(e, "div", !1).div }, a.prototype.mod = function(e) { return this.divmod(e, "mod", !1).mod }, a.prototype.umod = function(e) { return this.divmod(e, "mod", !0).mod }, a.prototype.divRound = function(e) { var t = this.divmod(e); if (t.mod.isZero()) return t.div; var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod, r = e.ushrn(1), n = e.andln(1), a = i.cmp(r); return a < 0 || 1 === n && 0 === a ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn( 1) }, a.prototype.modrn = function(e) { var t = e < 0; t && (e = -e), r(e <= 67108863); for (var i = (1 << 26) % e, n = 0, a = this.length - 1; a >= 0; a--) n = (i * n + (0 | this.words[ a])) % e; return t ? -n : n }, a.prototype.modn = function(e) { return this.modrn(e) }, a.prototype.idivn = function(e) { var t = e < 0; t && (e = -e), r(e <= 67108863); for (var i = 0, n = this.length - 1; n >= 0; n--) { var a = (0 | this.words[n]) + 67108864 * i; this.words[n] = a / e | 0, i = a % e } return this._strip(), t ? this.ineg() : this }, a.prototype.divn = function(e) { return this.clone().idivn(e) }, a.prototype.egcd = function(e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for (var n = new a(1), s = new a(0), o = new a(0), u = new a(1), l = 0; t.isEven() && i.isEven();) t.iushrn(1), i.iushrn(1), ++l; for (var d = i.clone(), c = t.clone(); !t.isZero();) { for (var h = 0, f = 1; 0 == (t.words[0] & f) && h < 26; ++h, f <<= 1); if (h > 0) for (t.iushrn(h); h-- > 0;)(n.isOdd() || s.isOdd()) && (n.iadd(d), s.isub(c)), n.iushrn(1), s .iushrn(1); for (var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, m <<= 1); if (p > 0) for (i.iushrn(p); p-- > 0;)(o.isOdd() || u.isOdd()) && (o.iadd(d), u.isub(c)), o.iushrn(1), u .iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), n.isub(o), s.isub(u)) : (i.isub(t), o.isub(n), u.isub(s)) } return { a: o, b: u, gcd: i.iushln(l) } }, a.prototype._invmp = function(e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for (var n, s = new a(1), o = new a(0), u = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0;) { for (var l = 0, d = 1; 0 == (t.words[0] & d) && l < 26; ++l, d <<= 1); if (l > 0) for (t.iushrn(l); l-- > 0;) s.isOdd() && s.iadd(u), s.iushrn(1); for (var c = 0, h = 1; 0 == (i.words[0] & h) && c < 26; ++c, h <<= 1); if (c > 0) for (i.iushrn(c); c-- > 0;) o.isOdd() && o.iadd(u), o.iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), s.isub(o)) : (i.isub(t), o.isub(s)) } return (n = 0 === t.cmpn(1) ? s : o).cmpn(0) < 0 && n.iadd(e), n }, a.prototype.gcd = function(e) { if (this.isZero()) return e.abs(); if (e.isZero()) return this.abs(); var t = this.clone(), i = e.clone(); t.negative = 0, i.negative = 0; for (var r = 0; t.isEven() && i.isEven(); r++) t.iushrn(1), i.iushrn(1); for (;;) { for (; t.isEven();) t.iushrn(1); for (; i.isEven();) i.iushrn(1); var n = t.cmp(i); if (n < 0) { var a = t; t = i, i = a } else if (0 === n || 0 === i.cmpn(1)) break; t.isub(i) } return i.iushln(r) }, a.prototype.invm = function(e) { return this.egcd(e).a.umod(e) }, a.prototype.isEven = function() { return 0 == (1 & this.words[0]) }, a.prototype.isOdd = function() { return 1 == (1 & this.words[0]) }, a.prototype.andln = function(e) { return this.words[0] & e }, a.prototype.bincn = function(e) { r("number" == typeof e); var t = e % 26, i = (e - t) / 26, n = 1 << t; if (this.length <= i) return this._expand(i + 1), this.words[i] |= n, this; for (var a = n, s = i; 0 !== a && s < this.length; s++) { var o = 0 | this.words[s]; a = (o += a) >>> 26, o &= 67108863, this.words[s] = o } return 0 !== a && (this.words[s] = a, this.length++), this }, a.prototype.isZero = function() { return 1 === this.length && 0 === this.words[0] }, a.prototype.cmpn = function(e) { var t, i = e < 0; if (0 !== this.negative && !i) return -1; if (0 === this.negative && i) return 1; if (this._strip(), this.length > 1) t = 1; else { i && (e = -e), r(e <= 67108863, "Number is too big"); var n = 0 | this.words[0]; t = n === e ? 0 : n < e ? -1 : 1 } return 0 !== this.negative ? 0 | -t : t }, a.prototype.cmp = function(e) { if (0 !== this.negative && 0 === e.negative) return -1; if (0 === this.negative && 0 !== e.negative) return 1; var t = this.ucmp(e); return 0 !== this.negative ? 0 | -t : t }, a.prototype.ucmp = function(e) { if (this.length > e.length) return 1; if (this.length < e.length) return -1; for (var t = 0, i = this.length - 1; i >= 0; i--) { var r = 0 | this.words[i], n = 0 | e.words[i]; if (r !== n) { r < n ? t = -1 : r > n && (t = 1); break } } return t }, a.prototype.gtn = function(e) { return 1 === this.cmpn(e) }, a.prototype.gt = function(e) { return 1 === this.cmp(e) }, a.prototype.gten = function(e) { return this.cmpn(e) >= 0 }, a.prototype.gte = function(e) { return this.cmp(e) >= 0 }, a.prototype.ltn = function(e) { return -1 === this.cmpn(e) }, a.prototype.lt = function(e) { return -1 === this.cmp(e) }, a.prototype.lten = function(e) { return this.cmpn(e) <= 0 }, a.prototype.lte = function(e) { return this.cmp(e) <= 0 }, a.prototype.eqn = function(e) { return 0 === this.cmpn(e) }, a.prototype.eq = function(e) { return 0 === this.cmp(e) }, a.red = function(e) { return new k(e) }, a.prototype.toRed = function(e) { return r(!this.red, "Already a number in reduction context"), r(0 === this.negative, "red works only with positives"), e.convertTo(this)._forceRed(e) }, a.prototype.fromRed = function() { return r(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom( this) }, a.prototype._forceRed = function(e) { return this.red = e, this }, a.prototype.forceRed = function(e) { return r(!this.red, "Already a number in reduction context"), this._forceRed(e) }, a.prototype.redAdd = function(e) { return r(this.red, "redAdd works only with red numbers"), this.red.add(this, e) }, a.prototype.redIAdd = function(e) { return r(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e) }, a.prototype.redSub = function(e) { return r(this.red, "redSub works only with red numbers"), this.red.sub(this, e) }, a.prototype.redISub = function(e) { return r(this.red, "redISub works only with red numbers"), this.red.isub(this, e) }, a.prototype.redShl = function(e) { return r(this.red, "redShl works only with red numbers"), this.red.shl(this, e) }, a.prototype.redMul = function(e) { return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red .mul(this, e) }, a.prototype.redIMul = function(e) { return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red .imul(this, e) }, a.prototype.redSqr = function() { return r(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr( this) }, a.prototype.redISqr = function() { return r(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr( this) }, a.prototype.redSqrt = function() { return r(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt( this) }, a.prototype.redInvm = function() { return r(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm( this) }, a.prototype.redNeg = function() { return r(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg( this) }, a.prototype.redPow = function(e) { return r(this.red && !e.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, e) }; var b = { k256: null, p224: null, p192: null, p25519: null }; function w(e, t) { this.name = e, this.p = new a(t, 16), this.n = this.p.bitLength(), this.k = new a(1).iushln(this.n) .isub(this.p), this.tmp = this._tmp() } function E() { w.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f") } function T() { w.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001") } function S() { w.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff") } function A() { w.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed") } function k(e) { if ("string" == typeof e) { var t = a._prime(e); this.m = t.p, this.prime = t } else r(e.gtn(1), "modulus must be greater than 1"), this.m = e, this.prime = null } function R(e) { k.call(this, e), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this .shift % 26), this.r = new a(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this .rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv) } w.prototype._tmp = function() { var e = new a(null); return e.words = new Array(Math.ceil(this.n / 13)), e }, w.prototype.ireduce = function(e) { var t, i = e; do { this.split(i, this.tmp), t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength() } while (t > this.n); var r = t < this.n ? -1 : i.ucmp(this.p); return 0 === r ? (i.words[0] = 0, i.length = 1) : r > 0 ? i.isub(this.p) : void 0 !== i.strip ? i .strip() : i._strip(), i }, w.prototype.split = function(e, t) { e.iushrn(this.n, 0, t) }, w.prototype.imulK = function(e) { return e.imul(this.k) }, n(E, w), E.prototype.split = function(e, t) { for (var i = Math.min(e.length, 9), r = 0; r < i; r++) t.words[r] = e.words[r]; if (t.length = i, e.length <= 9) return e.words[0] = 0, void(e.length = 1); var n = e.words[9]; for (t.words[t.length++] = 4194303 & n, r = 10; r < e.length; r++) { var a = 0 | e.words[r]; e.words[r - 10] = (4194303 & a) << 4 | n >>> 22, n = a } n >>>= 22, e.words[r - 10] = n, 0 === n && e.length > 10 ? e.length -= 10 : e.length -= 9 }, E.prototype.imulK = function(e) { e.words[e.length] = 0, e.words[e.length + 1] = 0, e.length += 2; for (var t = 0, i = 0; i < e.length; i++) { var r = 0 | e.words[i]; t += 977 * r, e.words[i] = 67108863 & t, t = 64 * r + (t / 67108864 | 0) } return 0 === e.words[e.length - 1] && (e.length--, 0 === e.words[e.length - 1] && e.length--), e }, n(T, w), n(S, w), n(A, w), A.prototype.imulK = function(e) { for (var t = 0, i = 0; i < e.length; i++) { var r = 19 * (0 | e.words[i]) + t, n = 67108863 & r; r >>>= 26, e.words[i] = n, t = r } return 0 !== t && (e.words[e.length++] = t), e }, a._prime = function(e) { if (b[e]) return b[e]; var t; if ("k256" === e) t = new E; else if ("p224" === e) t = new T; else if ("p192" === e) t = new S; else { if ("p25519" !== e) throw new Error("Unknown prime " + e); t = new A } return b[e] = t, t }, k.prototype._verify1 = function(e) { r(0 === e.negative, "red works only with positives"), r(e.red, "red works only with red numbers") }, k.prototype._verify2 = function(e, t) { r(0 == (e.negative | t.negative), "red works only with positives"), r(e.red && e.red === t.red, "red works only with red numbers") }, k.prototype.imod = function(e) { return this.prime ? this.prime.ireduce(e)._forceRed(this) : (d(e, e.umod(this.m)._forceRed(this)), e) }, k.prototype.neg = function(e) { return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this) }, k.prototype.add = function(e, t) { this._verify2(e, t); var i = e.add(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this) }, k.prototype.iadd = function(e, t) { this._verify2(e, t); var i = e.iadd(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i }, k.prototype.sub = function(e, t) { this._verify2(e, t); var i = e.sub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this) }, k.prototype.isub = function(e, t) { this._verify2(e, t); var i = e.isub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i }, k.prototype.shl = function(e, t) { return this._verify1(e), this.imod(e.ushln(t)) }, k.prototype.imul = function(e, t) { return this._verify2(e, t), this.imod(e.imul(t)) }, k.prototype.mul = function(e, t) { return this._verify2(e, t), this.imod(e.mul(t)) }, k.prototype.isqr = function(e) { return this.imul(e, e.clone()) }, k.prototype.sqr = function(e) { return this.mul(e, e) }, k.prototype.sqrt = function(e) { if (e.isZero()) return e.clone(); var t = this.m.andln(3); if (r(t % 2 == 1), 3 === t) { var i = this.m.add(new a(1)).iushrn(2); return this.pow(e, i) } for (var n = this.m.subn(1), s = 0; !n.isZero() && 0 === n.andln(1);) s++, n.iushrn(1); r(!n.isZero()); var o = new a(1).toRed(this), u = o.redNeg(), l = this.m.subn(1).iushrn(1), d = this.m.bitLength(); for (d = new a(2 * d * d).toRed(this); 0 !== this.pow(d, l).cmp(u);) d.redIAdd(u); for (var c = this.pow(d, n), h = this.pow(e, n.addn(1).iushrn(1)), f = this.pow(e, n), p = s; 0 !== f.cmp(o);) { for (var m = f, g = 0; 0 !== m.cmp(o); g++) m = m.redSqr(); r(g < p); var v = this.pow(c, new a(1).iushln(p - g - 1)); h = h.redMul(v), c = v.redSqr(), f = f.redMul(c), p = g } return h }, k.prototype.invm = function(e) { var t = e._invmp(this.m); return 0 !== t.negative ? (t.negative = 0, this.imod(t).redNeg()) : this.imod(t) }, k.prototype.pow = function(e, t) { if (t.isZero()) return new a(1).toRed(this); if (0 === t.cmpn(1)) return e.clone(); var i = new Array(16); i[0] = new a(1).toRed(this), i[1] = e; for (var r = 2; r < i.length; r++) i[r] = this.mul(i[r - 1], e); var n = i[0], s = 0, o = 0, u = t.bitLength() % 26; for (0 === u && (u = 26), r = t.length - 1; r >= 0; r--) { for (var l = t.words[r], d = u - 1; d >= 0; d--) { var c = l >> d & 1; n !== i[0] && (n = this.sqr(n)), 0 !== c || 0 !== s ? (s <<= 1, s |= c, (4 == ++o || 0 === r && 0 === d) && (n = this.mul(n, i[s]), o = 0, s = 0)) : o = 0 } u = 26 } return n }, k.prototype.convertTo = function(e) { var t = e.umod(this.m); return t === e ? t.clone() : t }, k.prototype.convertFrom = function(e) { var t = e.clone(); return t.red = null, t }, a.mont = function(e) { return new R(e) }, n(R, k), R.prototype.convertTo = function(e) { return this.imod(e.ushln(this.shift)) }, R.prototype.convertFrom = function(e) { var t = this.imod(e.mul(this.rinv)); return t.red = null, t }, R.prototype.imul = function(e, t) { if (e.isZero() || t.isZero()) return e.words[0] = 0, e.length = 1, e; var i = e.imul(t), r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), n = i.isub(r).iushrn(this.shift), a = n; return n.cmp(this.m) >= 0 ? a = n.isub(this.m) : n.cmpn(0) < 0 && (a = n.iadd(this.m)), a ._forceRed(this) }, R.prototype.mul = function(e, t) { if (e.isZero() || t.isZero()) return new a(0)._forceRed(this); var i = e.mul(t), r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), n = i.isub(r).iushrn(this.shift), s = n; return n.cmp(this.m) >= 0 ? s = n.isub(this.m) : n.cmpn(0) < 0 && (s = n.iadd(this.m)), s ._forceRed(this) }, R.prototype.invm = function(e) { return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this) } }(e, this) }).call(this, i(55)(e)) }, function(e, t, i) { "use strict"; var r = t; r.bignum = i(11), r.define = i(214).define, r.base = i(217), r.constants = i(218), r.decoders = i(117), r .encoders = i(115) }, function(e, t, i) { "use strict"; var r = t; r.der = i(116), r.pem = i(215) }, function(e, t, i) { "use strict"; var r = i(5), n = i(62).Buffer, a = i(63), s = i(65); function o(e) { this.enc = "der", this.name = e.name, this.entity = e, this.tree = new u, this.tree._init(e.body) } function u(e) { a.call(this, "der", e) } function l(e) { return e < 10 ? "0" + e : e } e.exports = o, o.prototype.encode = function(e, t) { return this.tree._encode(e, t).join() }, r(u, a), u.prototype._encodeComposite = function(e, t, i, r) { var a = function(e, t, i, r) { var n; if ("seqof" === e ? e = "seq" : "setof" === e && (e = "set"), s.tagByName.hasOwnProperty(e)) n = s .tagByName[e]; else { if ("number" != typeof e || (0 | e) !== e) return r.error("Unknown tag: " + e); n = e } return n >= 31 ? r.error("Multi-octet tag encoding unsupported") : (t || (n |= 32), n | s .tagClassByName[i || "universal"] << 6) }(e, t, i, this.reporter); if (r.length < 128) { var o = n.alloc(2); return o[0] = a, o[1] = r.length, this._createEncoderBuffer([o, r]) } for (var u = 1, l = r.length; l >= 256; l >>= 8) u++; var d = n.alloc(2 + u); d[0] = a, d[1] = 128 | u; for (var c = 1 + u, h = r.length; h > 0; c--, h >>= 8) d[c] = 255 & h; return this._createEncoderBuffer([d, r]) }, u.prototype._encodeStr = function(e, t) { if ("bitstr" === t) return this._createEncoderBuffer([0 | e.unused, e.data]); if ("bmpstr" === t) { for (var i = n.alloc(2 * e.length), r = 0; r < e.length; r++) i.writeUInt16BE(e.charCodeAt(r), 2 * r); return this._createEncoderBuffer(i) } return "numstr" === t ? this._isNumstr(e) ? this._createEncoderBuffer(e) : this.reporter.error( "Encoding of string type: numstr supports only digits and space") : "printstr" === t ? this ._isPrintstr(e) ? this._createEncoderBuffer(e) : this.reporter.error( "Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark" ) : /str$/.test(t) || "objDesc" === t ? this._createEncoderBuffer(e) : this.reporter.error( "Encoding of string type: " + t + " unsupported") }, u.prototype._encodeObjid = function(e, t, i) { if ("string" == typeof e) { if (!t) return this.reporter.error("string objid given, but no values map found"); if (!t.hasOwnProperty(e)) return this.reporter.error("objid not found in values map"); e = t[e].split(/[\s.]+/g); for (var r = 0; r < e.length; r++) e[r] |= 0 } else if (Array.isArray(e)) { e = e.slice(); for (var a = 0; a < e.length; a++) e[a] |= 0 } if (!Array.isArray(e)) return this.reporter.error("objid() should be either array or string, got: " + JSON.stringify(e)); if (!i) { if (e[1] >= 40) return this.reporter.error("Second objid identifier OOB"); e.splice(0, 2, 40 * e[0] + e[1]) } for (var s = 0, o = 0; o < e.length; o++) { var u = e[o]; for (s++; u >= 128; u >>= 7) s++ } for (var l = n.alloc(s), d = l.length - 1, c = e.length - 1; c >= 0; c--) { var h = e[c]; for (l[d--] = 127 & h; (h >>= 7) > 0;) l[d--] = 128 | 127 & h } return this._createEncoderBuffer(l) }, u.prototype._encodeTime = function(e, t) { var i, r = new Date(e); return "gentime" === t ? i = [l(r.getUTCFullYear()), l(r.getUTCMonth() + 1), l(r.getUTCDate()), l(r .getUTCHours()), l(r.getUTCMinutes()), l(r.getUTCSeconds()), "Z"].join("") : "utctime" === t ? i = [ l(r.getUTCFullYear() % 100), l(r.getUTCMonth() + 1), l(r.getUTCDate()), l(r.getUTCHours()), l(r .getUTCMinutes()), l(r.getUTCSeconds()), "Z" ].join("") : this.reporter.error("Encoding " + t + " time is not supported yet"), this._encodeStr(i, "octstr") }, u.prototype._encodeNull = function() { return this._createEncoderBuffer("") }, u.prototype._encodeInt = function(e, t) { if ("string" == typeof e) { if (!t) return this.reporter.error("String int or enum given, but no values map"); if (!t.hasOwnProperty(e)) return this.reporter.error("Values map doesn't contain: " + JSON.stringify( e)); e = t[e] } if ("number" != typeof e && !n.isBuffer(e)) { var i = e.toArray(); !e.sign && 128 & i[0] && i.unshift(0), e = n.from(i) } if (n.isBuffer(e)) { var r = e.length; 0 === e.length && r++; var a = n.alloc(r); return e.copy(a), 0 === e.length && (a[0] = 0), this._createEncoderBuffer(a) } if (e < 128) return this._createEncoderBuffer(e); if (e < 256) return this._createEncoderBuffer([0, e]); for (var s = 1, o = e; o >= 256; o >>= 8) s++; for (var u = new Array(s), l = u.length - 1; l >= 0; l--) u[l] = 255 & e, e >>= 8; return 128 & u[0] && u.unshift(0), this._createEncoderBuffer(n.from(u)) }, u.prototype._encodeBool = function(e) { return this._createEncoderBuffer(e ? 255 : 0) }, u.prototype._use = function(e, t) { return "function" == typeof e && (e = e(t)), e._getEncoder("der").tree }, u.prototype._skipDefault = function(e, t, i) { var r, n = this._baseState; if (null === n.default) return !1; var a = e.join(); if (void 0 === n.defaultBuffer && (n.defaultBuffer = this._encodeValue(n.default, t, i).join()), a .length !== n.defaultBuffer.length) return !1; for (r = 0; r < a.length; r++) if (a[r] !== n.defaultBuffer[r]) return !1; return !0 } }, function(e, t, i) { "use strict"; var r = t; r.der = i(118), r.pem = i(216) }, function(e, t, i) { "use strict"; var r = i(5), n = i(11), a = i(35).DecoderBuffer, s = i(63), o = i(65); function u(e) { this.enc = "der", this.name = e.name, this.entity = e, this.tree = new l, this.tree._init(e.body) } function l(e) { s.call(this, "der", e) } function d(e, t) { var i = e.readUInt8(t); if (e.isError(i)) return i; var r = o.tagClass[i >> 6], n = 0 == (32 & i); if (31 == (31 & i)) { var a = i; for (i = 0; 128 == (128 & a);) { if (a = e.readUInt8(t), e.isError(a)) return a; i <<= 7, i |= 127 & a } } else i &= 31; return { cls: r, primitive: n, tag: i, tagStr: o.tag[i] } } function c(e, t, i) { var r = e.readUInt8(i); if (e.isError(r)) return r; if (!t && 128 === r) return null; if (0 == (128 & r)) return r; var n = 127 & r; if (n > 4) return e.error("length octect is too long"); r = 0; for (var a = 0; a < n; a++) { r <<= 8; var s = e.readUInt8(i); if (e.isError(s)) return s; r |= s } return r } e.exports = u, u.prototype.decode = function(e, t) { return a.isDecoderBuffer(e) || (e = new a(e, t)), this.tree._decode(e, t) }, r(l, s), l.prototype._peekTag = function(e, t, i) { if (e.isEmpty()) return !1; var r = e.save(), n = d(e, 'Failed to peek tag: "' + t + '"'); return e.isError(n) ? n : (e.restore(r), n.tag === t || n.tagStr === t || n.tagStr + "of" === t || i) }, l.prototype._decodeTag = function(e, t, i) { var r = d(e, 'Failed to decode tag of "' + t + '"'); if (e.isError(r)) return r; var n = c(e, r.primitive, 'Failed to get length of "' + t + '"'); if (e.isError(n)) return n; if (!i && r.tag !== t && r.tagStr !== t && r.tagStr + "of" !== t) return e.error( 'Failed to match tag: "' + t + '"'); if (r.primitive || null !== n) return e.skip(n, 'Failed to match body of: "' + t + '"'); var a = e.save(), s = this._skipUntilEnd(e, 'Failed to skip indefinite length body: "' + this.tag + '"'); return e.isError(s) ? s : (n = e.offset - a.offset, e.restore(a), e.skip(n, 'Failed to match body of: "' + t + '"')) }, l.prototype._skipUntilEnd = function(e, t) { for (;;) { var i = d(e, t); if (e.isError(i)) return i; var r = c(e, i.primitive, t); if (e.isError(r)) return r; var n; if (n = i.primitive || null !== r ? e.skip(r) : this._skipUntilEnd(e, t), e.isError(n)) return n; if ("end" === i.tagStr) break } }, l.prototype._decodeList = function(e, t, i, r) { for (var n = []; !e.isEmpty();) { var a = this._peekTag(e, "end"); if (e.isError(a)) return a; var s = i.decode(e, "der", r); if (e.isError(s) && a) break; n.push(s) } return n }, l.prototype._decodeStr = function(e, t) { if ("bitstr" === t) { var i = e.readUInt8(); return e.isError(i) ? i : { unused: i, data: e.raw() } } if ("bmpstr" === t) { var r = e.raw(); if (r.length % 2 == 1) return e.error("Decoding of string type: bmpstr length mismatch"); for (var n = "", a = 0; a < r.length / 2; a++) n += String.fromCharCode(r.readUInt16BE(2 * a)); return n } if ("numstr" === t) { var s = e.raw().toString("ascii"); return this._isNumstr(s) ? s : e.error("Decoding of string type: numstr unsupported characters") } if ("octstr" === t) return e.raw(); if ("objDesc" === t) return e.raw(); if ("printstr" === t) { var o = e.raw().toString("ascii"); return this._isPrintstr(o) ? o : e.error("Decoding of string type: printstr unsupported characters") } return /str$/.test(t) ? e.raw().toString() : e.error("Decoding of string type: " + t + " unsupported") }, l.prototype._decodeObjid = function(e, t, i) { for (var r, n = [], a = 0, s = 0; !e.isEmpty();) a <<= 7, a |= 127 & (s = e.readUInt8()), 0 == (128 & s) && (n.push(a), a = 0); 128 & s && n.push(a); var o = n[0] / 40 | 0, u = n[0] % 40; if (r = i ? n : [o, u].concat(n.slice(1)), t) { var l = t[r.join(" ")]; void 0 === l && (l = t[r.join(".")]), void 0 !== l && (r = l) } return r }, l.prototype._decodeTime = function(e, t) { var i, r, n, a, s, o, u = e.raw().toString(); if ("gentime" === t) i = 0 | u.slice(0, 4), r = 0 | u.slice(4, 6), n = 0 | u.slice(6, 8), a = 0 | u .slice(8, 10), s = 0 | u.slice(10, 12), o = 0 | u.slice(12, 14); else { if ("utctime" !== t) return e.error("Decoding " + t + " time is not supported yet"); i = 0 | u.slice(0, 2), r = 0 | u.slice(2, 4), n = 0 | u.slice(4, 6), a = 0 | u.slice(6, 8), s = 0 | u .slice(8, 10), o = 0 | u.slice(10, 12), i = i < 70 ? 2e3 + i : 1900 + i } return Date.UTC(i, r - 1, n, a, s, o, 0) }, l.prototype._decodeNull = function() { return null }, l.prototype._decodeBool = function(e) { var t = e.readUInt8(); return e.isError(t) ? t : 0 !== t }, l.prototype._decodeInt = function(e, t) { var i = e.raw(), r = new n(i); return t && (r = t[r.toString(10)] || r), r }, l.prototype._use = function(e, t) { return "function" == typeof e && (e = e(t)), e._getDecoder("der").tree } }, function(e) { e.exports = JSON.parse( '{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}' ) }, function(e, t, i) { var r = i(31), n = i(6).Buffer; function a(e) { var t = n.allocUnsafe(4); return t.writeUInt32BE(e, 0), t } e.exports = function(e, t) { for (var i, s = n.alloc(0), o = 0; s.length < t;) i = a(o++), s = n.concat([s, r("sha1").update(e) .update(i).digest() ]); return s.slice(0, t) } }, function(e, t) { e.exports = function(e, t) { for (var i = e.length, r = -1; ++r < i;) e[r] ^= t[r]; return e } }, function(e, t, i) { var r = i(11), n = i(6).Buffer; e.exports = function(e, t) { return n.from(e.toRed(r.mont(t.modulus)).redPow(new r(t.publicExponent)).fromRed().toArray()) } }, function(e, t, i) { "use strict"; (function(t) { var r, n = (r = i(127)) && "object" == typeof r && "default" in r ? r.default : r; e.exports = function(e) { for (var i, r = (i = e, n.atob ? n.atob(i) : t.from(i, "base64").toString("binary")), a = new Uint8Array(r.length), s = 0; s < r.length; s++) a[s] = r.charCodeAt(s); return a } }).call(this, i(10).Buffer) }, function(e, t, i) { (function(t, i) { var r; r = function() { "use strict"; function e(e) { return "function" == typeof e } var r = Array.isArray ? Array.isArray : function(e) { return "[object Array]" === Object.prototype.toString.call(e) }, n = 0, a = void 0, s = void 0, o = function(e, t) { p[n] = e, p[n + 1] = t, 2 === (n += 2) && (s ? s(m) : v()) }, u = "undefined" != typeof window ? window : void 0, l = u || {}, d = l.MutationObserver || l.WebKitMutationObserver, c = "undefined" == typeof self && void 0 !== t && "[object process]" === {}.toString.call(t), h = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel; function f() { var e = setTimeout; return function() { return e(m, 1) } } var p = new Array(1e3); function m() { for (var e = 0; e < n; e += 2)(0, p[e])(p[e + 1]), p[e] = void 0, p[e + 1] = void 0; n = 0 } var g, v = void 0; function y(e, t) { var i = this, r = new this.constructor(w); void 0 === r[b] && D(r); var n = i._state; if (n) { var a = arguments[n - 1]; o(function() { return O(n, r, a, i._result) }) } else R(i, r, e, t); return r } function _(e) { if (e && "object" == typeof e && e.constructor === this) return e; var t = new this(w); return T(t, e), t } c ? v = function() { return t.nextTick(m) } : d ? v = function() { var e = 0, t = new d(m), i = document.createTextNode(""); return t.observe(i, { characterData: !0 }), function() { i.data = e = ++e % 2 } }() : h ? ((g = new MessageChannel).port1.onmessage = m, v = function() { return g.port2.postMessage(0) }) : v = void 0 === u ? function() { try { var e = Function("return this")().require("vertx"); return void 0 !== (a = e.runOnLoop || e.runOnContext) ? function() { a(m) } : f() } catch (e) { return f() } }() : f(); var b = Math.random().toString(36).substring(2); function w() {} function E(t, i, r) { i.constructor === t.constructor && r === y && i.constructor.resolve === _ ? function(e, t) { 1 === t._state ? A(e, t._result) : 2 === t._state ? k(e, t._result) : R(t, void 0, function( t) { return T(e, t) }, function(t) { return k(e, t) }) }(t, i) : void 0 === r ? A(t, i) : e(r) ? function(e, t, i) { o(function(e) { var r = !1, n = function(e, t, i, r) { try { e.call(t, i, r) } catch (e) { return e } }(i, t, function(i) { r || (r = !0, t !== i ? T(e, i) : A(e, i)) }, function(t) { r || (r = !0, k(e, t)) }, e._label); !r && n && (r = !0, k(e, n)) }, e) }(t, i, r) : A(t, i) } function T(e, t) { if (e === t) k(e, new TypeError("You cannot resolve a promise with itself")); else if (n = typeof(r = t), null === r || "object" !== n && "function" !== n) A(e, t); else { var i = void 0; try { i = t.then } catch (t) { return void k(e, t) } E(e, t, i) } var r, n } function S(e) { e._onerror && e._onerror(e._result), M(e) } function A(e, t) { void 0 === e._state && (e._result = t, e._state = 1, 0 !== e._subscribers.length && o(M, e)) } function k(e, t) { void 0 === e._state && (e._state = 2, e._result = t, o(S, e)) } function R(e, t, i, r) { var n = e._subscribers, a = n.length; e._onerror = null, n[a] = t, n[a + 1] = i, n[a + 2] = r, 0 === a && e._state && o(M, e) } function M(e) { var t = e._subscribers, i = e._state; if (0 !== t.length) { for (var r = void 0, n = void 0, a = e._result, s = 0; s < t.length; s += 3) r = t[s], n = t[s + i], r ? O(i, r, n, a) : n(a); e._subscribers.length = 0 } } function O(t, i, r, n) { var a = e(r), s = void 0, o = void 0, u = !0; if (a) { try { s = r(n) } catch (e) { u = !1, o = e } if (i === s) return void k(i, new TypeError( "A promises callback cannot return that same promise.")) } else s = n; void 0 !== i._state || (a && u ? T(i, s) : !1 === u ? k(i, o) : 1 === t ? A(i, s) : 2 === t && k( i, s)) } var C = 0; function D(e) { e[b] = C++, e._state = void 0, e._result = void 0, e._subscribers = [] } var I = function() { function e(e, t) { this._instanceConstructor = e, this.promise = new e(w), this.promise[b] || D(this.promise), r( t) ? (this.length = t.length, this._remaining = t.length, this._result = new Array(this .length), 0 === this.length ? A(this.promise, this._result) : (this.length = this .length || 0, this._enumerate(t), 0 === this._remaining && A(this.promise, this._result) )) : k(this.promise, new Error("Array Methods must be provided an Array")) } return e.prototype._enumerate = function(e) { for (var t = 0; void 0 === this._state && t < e.length; t++) this._eachEntry(e[t], t) }, e.prototype._eachEntry = function(e, t) { var i = this._instanceConstructor, r = i.resolve; if (r === _) { var n = void 0, a = void 0, s = !1; try { n = e.then } catch (e) { s = !0, a = e } if (n === y && void 0 !== e._state) this._settledAt(e._state, t, e._result); else if ("function" != typeof n) this._remaining--, this._result[t] = e; else if (i === L) { var o = new i(w); s ? k(o, a) : E(o, e, n), this._willSettleAt(o, t) } else this._willSettleAt(new i(function(t) { return t(e) }), t) } else this._willSettleAt(r(e), t) }, e.prototype._settledAt = function(e, t, i) { var r = this.promise; void 0 === r._state && (this._remaining--, 2 === e ? k(r, i) : this._result[t] = i), 0 === this._remaining && A(r, this._result) }, e.prototype._willSettleAt = function(e, t) { var i = this; R(e, void 0, function(e) { return i._settledAt(1, t, e) }, function(e) { return i._settledAt(2, t, e) }) }, e }(), L = function() { function t(e) { this[b] = C++, this._result = this._state = void 0, this._subscribers = [], w !== e && ( "function" != typeof e && function() { throw new TypeError( "You must pass a resolver function as the first argument to the promise constructor" ) }(), this instanceof t ? function(e, t) { try { t(function(t) { T(e, t) }, function(t) { k(e, t) }) } catch (t) { k(e, t) } }(this, e) : function() { throw new TypeError( "Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function." ) }()) } return t.prototype.catch = function(e) { return this.then(null, e) }, t.prototype.finally = function(t) { var i = this.constructor; return e(t) ? this.then(function(e) { return i.resolve(t()).then(function() { return e }) }, function(e) { return i.resolve(t()).then(function() { throw e }) }) : this.then(t, t) }, t }(); return L.prototype.then = y, L.all = function(e) { return new I(this, e).promise }, L.race = function(e) { var t = this; return r(e) ? new t(function(i, r) { for (var n = e.length, a = 0; a < n; a++) t.resolve(e[a]).then(i, r) }) : new t(function(e, t) { return t(new TypeError("You must pass an array to race.")) }) }, L.resolve = _, L.reject = function(e) { var t = new this(w); return k(t, e), t }, L._setScheduler = function(e) { s = e }, L._setAsap = function(e) { o = e }, L._asap = o, L.polyfill = function() { var e = void 0; if (void 0 !== i) e = i; else if ("undefined" != typeof self) e = self; else try { e = Function("return this")() } catch (e) { throw new Error("polyfill failed because global object is unavailable in this environment") } var t = e.Promise; if (t) { var r = null; try { r = Object.prototype.toString.call(t.resolve()) } catch (e) {} if ("[object Promise]" === r && !t.cast) return } e.Promise = L }, L.Promise = L, L }, e.exports = r() }).call(this, i(9), i(13)) }, function(e, t, i) { "use strict"; t.byteLength = function(e) { var t = l(e), i = t[0], r = t[1]; return 3 * (i + r) / 4 - r }, t.toByteArray = function(e) { var t, i, r = l(e), s = r[0], o = r[1], u = new a(3 * (s + o) / 4 - o), d = 0, c = o > 0 ? s - 4 : s; for (i = 0; i < c; i += 4) t = n[e.charCodeAt(i)] << 18 | n[e.charCodeAt(i + 1)] << 12 | n[e.charCodeAt( i + 2)] << 6 | n[e.charCodeAt(i + 3)], u[d++] = t >> 16 & 255, u[d++] = t >> 8 & 255, u[d++] = 255 & t; return 2 === o && (t = n[e.charCodeAt(i)] << 2 | n[e.charCodeAt(i + 1)] >> 4, u[d++] = 255 & t), 1 === o && (t = n[e.charCodeAt(i)] << 10 | n[e.charCodeAt(i + 1)] << 4 | n[e.charCodeAt(i + 2)] >> 2, u[ d++] = t >> 8 & 255, u[d++] = 255 & t), u }, t.fromByteArray = function(e) { for (var t, i = e.length, n = i % 3, a = [], s = 0, o = i - n; s < o; s += 16383) a.push(d(e, s, s + 16383 > o ? o : s + 16383)); return 1 === n ? (t = e[i - 1], a.push(r[t >> 2] + r[t << 4 & 63] + "==")) : 2 === n && (t = (e[i - 2] << 8) + e[i - 1], a.push(r[t >> 10] + r[t >> 4 & 63] + r[t << 2 & 63] + "=")), a.join("") }; for (var r = [], n = [], a = "undefined" != typeof Uint8Array ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = 0, u = s.length; o < u; ++o) r[ o] = s[o], n[s.charCodeAt(o)] = o; function l(e) { var t = e.length; if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); var i = e.indexOf("="); return -1 === i && (i = t), [i, i === t ? 0 : 4 - i % 4] } function d(e, t, i) { for (var n, a, s = [], o = t; o < i; o += 3) n = (e[o] << 16 & 16711680) + (e[o + 1] << 8 & 65280) + ( 255 & e[o + 2]), s.push(r[(a = n) >> 18 & 63] + r[a >> 12 & 63] + r[a >> 6 & 63] + r[63 & a]); return s.join("") } n["-".charCodeAt(0)] = 62, n["_".charCodeAt(0)] = 63 }, function(e, t) { t.read = function(e, t, i, r, n) { var a, s, o = 8 * n - r - 1, u = (1 << o) - 1, l = u >> 1, d = -7, c = i ? n - 1 : 0, h = i ? -1 : 1, f = e[t + c]; for (c += h, a = f & (1 << -d) - 1, f >>= -d, d += o; d > 0; a = 256 * a + e[t + c], c += h, d -= 8); for (s = a & (1 << -d) - 1, a >>= -d, d += r; d > 0; s = 256 * s + e[t + c], c += h, d -= 8); if (0 === a) a = 1 - l; else { if (a === u) return s ? NaN : 1 / 0 * (f ? -1 : 1); s += Math.pow(2, r), a -= l } return (f ? -1 : 1) * s * Math.pow(2, a - r) }, t.write = function(e, t, i, r, n, a) { var s, o, u, l = 8 * a - n - 1, d = (1 << l) - 1, c = d >> 1, h = 23 === n ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f = r ? 0 : a - 1, p = r ? 1 : -1, m = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0; for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (o = isNaN(t) ? 1 : 0, s = d) : (s = Math.floor(Math .log(t) / Math.LN2), t * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), (t += s + c >= 1 ? h / u : h * Math.pow(2, 1 - c)) * u >= 2 && (s++, u /= 2), s + c >= d ? (o = 0, s = d) : s + c >= 1 ? (o = (t * u - 1) * Math.pow(2, n), s += c) : (o = t * Math.pow(2, c - 1) * Math.pow(2, n), s = 0)); n >= 8; e[i + f] = 255 & o, f += p, o /= 256, n -= 8); for (s = s << n | o, l += n; l > 0; e[i + f] = 255 & s, f += p, s /= 256, l -= 8); e[i + f - p] |= 128 * m } }, function(e, t, i) { (function(t) { var i; i = "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {}, e .exports = i }).call(this, i(13)) }, function(e, t, i) { var r = i(129), n = i(130); "string" == typeof(n = n.__esModule ? n.default : n) && (n = [ [e.i, n, ""] ]); r(n, { insert: "head", singleton: !1 }), e.exports = n.locals || {} }, function(e, t, i) { "use strict"; var r, n = function() { var e = {}; return function(t) { if (void 0 === e[t]) { var i = document.querySelector(t); if (window.HTMLIFrameElement && i instanceof window.HTMLIFrameElement) try { i = i.contentDocument.head } catch (e) { i = null } e[t] = i } return e[t] } }(), a = []; function s(e) { for (var t = -1, i = 0; i < a.length; i++) if (a[i].identifier === e) { t = i; break } return t } function o(e, t) { for (var i = {}, r = [], n = 0; n < e.length; n++) { var o = e[n], u = t.base ? o[0] + t.base : o[0], l = i[u] || 0, d = "".concat(u, " ").concat(l); i[u] = l + 1; var c = s(d), h = { css: o[1], media: o[2], sourceMap: o[3] }; - 1 !== c ? (a[c].references++, a[c].updater(h)) : a.push({ identifier: d, updater: p(h, t), references: 1 }), r.push(d) } return r } function u(e) { var t = document.createElement("style"), r = e.attributes || {}; if (void 0 === r.nonce) { var a = i.nc; a && (r.nonce = a) } if (Object.keys(r).forEach(function(e) { t.setAttribute(e, r[e]) }), "function" == typeof e.insert) e.insert(t); else { var s = n(e.insert || "head"); if (!s) throw new Error( "Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid." ); s.appendChild(t) } return t } var l, d = (l = [], function(e, t) { return l[e] = t, l.filter(Boolean).join("\n") }); function c(e, t, i, r) { var n = i ? "" : r.media ? "@media ".concat(r.media, " {").concat(r.css, "}") : r.css; if (e.styleSheet) e.styleSheet.cssText = d(t, n); else { var a = document.createTextNode(n), s = e.childNodes; s[t] && e.removeChild(s[t]), s.length ? e.insertBefore(a, s[t]) : e.appendChild(a) } } var h = null, f = 0; function p(e, t) { var i, r, n; if (t.singleton) { var a = f++; i = h || (h = u(t)), r = c.bind(null, i, a, !1), n = c.bind(null, i, a, !0) } else i = u(t), r = function(e, t, i) { var r = i.css, n = i.media, a = i.sourceMap; if (n ? e.setAttribute("media", n) : e.removeAttribute("media"), a && "undefined" != typeof btoa && ( r += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape( encodeURIComponent(JSON.stringify(a)))), " */")), e.styleSheet) e.styleSheet.cssText = r; else { for (; e.firstChild;) e.removeChild(e.firstChild); e.appendChild(document.createTextNode(r)) } }.bind(null, i, t), n = function() { ! function(e) { if (null === e.parentNode) return !1; e.parentNode.removeChild(e) }(i) }; return r(e), function(t) { if (t) { if (t.css === e.css && t.media === e.media && t.sourceMap === e.sourceMap) return; r(e = t) } else n() } } e.exports = function(e, t) { (t = t || {}).singleton || "boolean" == typeof t.singleton || (t.singleton = (void 0 === r && (r = Boolean(window && document && document.all && !window.atob)), r)); var i = o(e = e || [], t); return function(e) { if (e = e || [], "[object Array]" === Object.prototype.toString.call(e)) { for (var r = 0; r < i.length; r++) { var n = s(i[r]); a[n].references-- } for (var u = o(e, t), l = 0; l < i.length; l++) { var d = s(i[l]); 0 === a[d].references && (a[d].updater(), a.splice(d, 1)) } i = u } } } }, function(e, t, i) { var r = i(131), n = i(132), a = i(133), s = i(134), o = i(135); t = r(!1); var u = n(a), l = n(s), d = n(o); t.push([e.i, '@font-face {\n font-family: "iconfontep"; /* Project id 3440216 */\n src: url(' + u + ") format('woff2'),\n url(" + l + ") format('woff'),\n url(" + d + ') format(\'truetype\');\n}\n\n.iconfontep {\n font-family: "iconfontep" !important;\n font-size: 16px;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.icon-xiangji:before {\n content: "\\e62e";\n}\n\n.icon-luxiang2:before {\n content: "\\e777";\n}\n\n.icon-xiangji1:before {\n content: "\\e6e5";\n}\n\n.icon-luxiang:before {\n content: "\\e62c";\n}\n\n.icon-snapshot:before {\n content: "\\e9f2";\n}\n\n.icon-shengyin1:before {\n content: "\\e8c0";\n}\n\n.icon-xiaoping:before {\n content: "\\e8bf";\n}\n\n.icon-jingyin:before {\n content: "\\e8bb";\n}\n\n.icon-quanping1:before {\n content: "\\e8ba";\n}\n\n.icon-bofang:before {\n content: "\\e8ad";\n}\n\n.icon-zanting:before {\n content: "\\e8ab";\n}\n\n', "" ]), e.exports = t }, function(e, t, i) { "use strict"; e.exports = function(e) { var t = []; return t.toString = function() { return this.map(function(t) { var i = function(e, t) { var i, r, n, a = e[1] || "", s = e[3]; if (!s) return a; if (t && "function" == typeof btoa) { var o = (i = s, r = btoa(unescape(encodeURIComponent(JSON.stringify(i)))), n = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r), "/*# " .concat(n, " */")), u = s.sources.map(function(e) { return "/*# sourceURL=".concat(s.sourceRoot || "").concat(e, " */") }); return [a].concat(u).concat([o]).join("\n") } return [a].join("\n") }(t, e); return t[2] ? "@media ".concat(t[2], " {").concat(i, "}") : i }).join("") }, t.i = function(e, i, r) { "string" == typeof e && (e = [ [null, e, ""] ]); var n = {}; if (r) for (var a = 0; a < this.length; a++) { var s = this[a][0]; null != s && (n[s] = !0) } for (var o = 0; o < e.length; o++) { var u = [].concat(e[o]); r && n[u[0]] || (i && (u[2] ? u[2] = "".concat(i, " and ").concat(u[2]) : u[2] = i), t.push(u)) } }, t } }, function(e, t, i) { "use strict"; e.exports = function(e, t) { return t || (t = {}), "string" != typeof(e = e && e.__esModule ? e.default : e) ? e : (/^['"].*['"]$/ .test(e) && (e = e.slice(1, -1)), t.hash && (e += t.hash), /["'() \t\n]/.test(e) || t.needQuotes ? '"'.concat(e.replace(/"/g, '\\"').replace(/\n/g, "\\n"), '"') : e) } }, function(e, t, i) { "use strict"; i.r(t), t.default = "data:font/woff2;base64,d09GMgABAAAAAAlMAAsAAAAAEOAAAAj+AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACEPAqSaI80ATYCJAMwCxoABCAFhGcHgRwbUA4RFazfI/viwDz9UwQQaoWtoxI6Bg55+g1tP7RnvwfPf/u1+2bmi2LWVJvZ6XgjtG1I/hWTrIlQaRs6YhbiDuGmXdA1ghR8XlGgbrB5NUDFqClVKpPk35N/p0yNwUwMmAq8awBQ1G5/7pVjClADbnNLFNuMi1B8cvb1rw/9KFeSLg37Do6lfi0D5GNrm8tH3Vf2KinaBvxAi0ywjYdRNuANSAbAM7FNLsykdcwCM31tXAUBfFrJhDE8bQ4O4pSpvwuUwkLMFEhjJdXabALuXIxpqRBcns3d0gBZB2xQC4wrALDmn1++QayMAygsDcR+Rpp0DSD9WuX7KeJ/AtA3wFKO14GWVoAFaKDxyqRy2K4+AMwYGj3br0tmMQ8gH8H8u82b6rXm9as3Fq/Tu9V72HvC99P/f1N9yHu8azFTyJdqKfIz/5snaBQBPh4uDjYWiA2IHSJnmxU8ZaoWYjxHAyECzis0Q8O7pRkKPpxCAnC2QogPziEI8cA5DCEuOMchxAHnBJphw+dPlG+Gfk3JxQAGAFqT5AGI4gkAJnRbBLgx2OGaEcodh6GBApbfFB6G+SkBT4i5hKoQCSrjYrAfF06FWApxRAjKF3O5/rGECclHikEoCgkEFj3CErARownFYQafCeO0y0XcuUO53aTHo6cObCG2HkTo2+S1UdseMQ6Rp67BPOrKCcBITl5F+PT10xCkH9vrdEJM0lFKHGmAYwkc3wQeBWUGyNjl72LNEeoYeXyUDpfoEfqgQiJhEVuCxALqkFLKJreHyhDjMvNVMj1uXQ8bWEI2TG2UGi5hszt3CJeL9nhIt7uePkocjNPcQO30uy6nLuwgdl6kL+8md13CKRsEkYsWjY2JxYR1MmWzyZYdRugxwgpT68VWU68utsYqlLp2K2tuP4xg9MGtQHxesAmhJWNyn4CRiBfDEEKFSN2zFCQJETd6KXsNbGDtxwkFkIsQOvigXsIkpVbxnTviQ4UvhQJJB1x7XZLtyPHng6nFACRWI0zZ2JSyctRtkAV38AKXvsBjXAUiDSgVb3S5Sh8I6dKDy2lJqX2CoW2N2rIl4WMS1O0pw+gkPAg2UdIK52T98M3ry5dG2KSY645l48rxy/YHu+54P/j6fdtWhXo8kMfgxm2kc7/kaNUG6dZ9UtvSZTIPaaYObbvEMx5GEOOmvZsBK7HvkRpgIwICjbbDwCeaRiCZjFZAMAODhkeG75eWDI8RdqrNBQixfnfAOnembY+dMF6+Eydw/enpvt1uw8Y98sUrqtYv37o3NLQaIh37gnAc/sJEAMxTEP3YficEGY8nhssPLuKD80HlIljDNay+XkQjjfn6SjDwQ+jD28lthwav3EPdIG4mbDi8HSJvmVPmuvpkeBSm7ICTbH62WTkhLunA8gHH/s9eeIIQASeyFs4o8zeCFVeQuOJCQFS+RpNfrYiOXx3fXlMmbTSoDI3SAKDjg56nt/8Q+KpSkgOUnwdmBH6uDPgvYCZXreMTPMWEi4XYv08Rq5iquc+94+z6vmmPVcKFKKWWhSdo5ZFB3XHklMpEdcVh6Xg9h2OQvXjbTMg1KfFdHFZXXDjfY0bx+JZZc9DjIHIq4gQSXprY8enCaf1abT+tHXDwERADiP75dbgmX63Or1AX5KsqA8HcKkWkvQgjxusStInaBB0w/+pZkZGzSkEEvyyeJ1I4SX0r/ZYqfYL9kSY2jbItbCZL8e7nLSwOu9nIaogI2lkiZVsQC5u/gk5Yf1Q1HKFCTqyYkK4KUpeVsPqVAwoknKfK4W0dTZj22BtaHWRUrHTKvfIltAKbG3YiWSB6uCRKzm+U0zvkAAoHYwzqmRIAUTWA3eV/LDTyq/29giJ+FvI9yqXrBjPW1nOZU3LKomeHnO1jo0/RJGEL37uWbeHkis+IujnNcDOnm/sSzuU0X+3Csg8EY1tgC+hSSerOipll03ukfdIXumK8sGhqV4A5yje7fGZpq6pT9Y3UlFuTndiQ1GKpMdbOD0LpHxsEa4cPKsJCtdrQQkV0/ML4tta30B2HdVl66oe0GSVhxnDmicPaC3FNA7KAasmlyfjA8eZ/xlkT7L6mOGta06YoCB0kstfsUkRHTM6iaCvZHWJSd+3qYnYnVySWrvrcF37Z9NWr2I5huoNXj9Zte7ux6b281I2ZfOVFh/KI0nFRWeLbhcR+KLGKNufdx3lKwCB982KfTpsX33f9xmDej/EjFy/N0w43Xh/5QP480NFflPBl+ZWAJQFXEtaVXQlcEhjcoU3FeRPmzqkfh8Z1vvrKfCU8f79Jk1iWXMkw16mKp00rDXlLV569zkIWhirb1/S44D2c9cVtivDvk/aIqRw4P/2qJVB5b5nymHLZXSX+9d77JQ7RanDkzWhI8DzHiHt0i2N+cPl8+5aR8OH/7TcgZATs/OLT9Gn6o3zqPnV/zVxvrDl2EFoOeaOy6Z/lKyh7rJ2KtfejoGWh+rm46TP7qCK0Ee8LaZrTWGi2L2VQdiXwn8nGJY8lck3zQ/2YN4PuH4DQ6DST5suo/8lc7zgzKcCuys1sxN7My4zCnuooMxO7tp8qgZMcZBZ2ax8yi70nMjGzR5lLscz5MKKGn/6ri/yNzrpz/XVCU2bVguO6cFEItcAIklPJHNJsLRCaur7RlMH4kHOAORXgy2EwVtTn8vgc3Dw2dWzMzUtrFA5loOtyysEgp77GIqAdbOT01Pg0oNs+IA8z0IjxA1DN26gRstlco4g5Ao2c82CQ46mxKOQN2Mj5t8ZnCsL2FlCtGXMQh+osjD+Ihskrnvpsry6sCaXK8XRSImzQN13Rd3Hk5BDrlHcYVD144QXO0+O5lBiy8OyMNpNq3retr1unMbxUB3GotqEF469lNEx+aM2/vqsLa0JhIp9KKSGZsge9RsdAXtjE6vJKkss7DJSUHjQIwRJzz1ulS9LNINcvNjujjWmAM++1NJTnspvzc5ePm81n1604SAgp0WLEElscccUT/9e+iURwhyJSmOM2rbF02Bak/WY6x7YQ5jKx7kyoo/CL1LencY4UNnMk1+61Ik2C+npkj5XGP5IuRVUFAA==" }, function(e, t, i) { "use strict"; i.r(t), t.default = "data:font/woff;base64,d09GRgABAAAAAAu8AAsAAAAAEOAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAARAAAAGA8QUzCY21hcAAAAYgAAACxAAACPClWH55nbHlmAAACPAAABzUAAAloxhXGamhlYWQAAAl0AAAALwAAADYgyzh9aGhlYQAACaQAAAAcAAAAJAfeA41obXR4AAAJwAAAAA8AAAAwMAAAAGxvY2EAAAnQAAAAGgAAABoQiA60bWF4cAAACewAAAAfAAAAIAEjAONuYW1lAAAKDAAAAUAAAAJnEKM8sHBvc3QAAAtMAAAAbQAAAJwZ7sqZeJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGFhYJzAwMrAwNTJdIaBgaEfQjO+ZjBi5ACKMrAyM2AFAWmuKQwHnum8/MTc8L+BgYH5DgOQZGBEUcQEAINZDYF4nOWRSw6CQBBEa+TjBxcuDPEQhOPJRTyBKxPCBWABl2FotlwAq6ddaPQG9uRN0pVM96QKQAIgIgWJAfeAg9adqgt6hEPQY1zZn3GiEvvCl36cKqmlkU6GeVlX4ENtpTf1qxynvJ8cl7DdcfIGGfftscMWqf7OpT8m/Fsdw317dZk6bWhmvjQ0Lz8amulUGfQUUhv6VhpDc5XWoOOQzqD3kN5gCpDBYB6YFwPJE/6/RgEAAAB4nH0WbWwU1/HNe3e7e7f3wd7H7u2aO3O7vl2bs+/wfewajD/4ONwEYhtsAhiHJES0SlWgNBhSA5JTfkVYalO1UqUKJSL9SEkqVSWtquAkppUqkaShREqqplIqVVXlorYiSP3HrTvvjlIURb3bN2/2zbx5M/PmY0mA4I8tM0JEEidrSTchoFWVvFL1gnnRQsQSKzlIxcAsQW0YNDMGqRxUK27Npm9vWb67sDwKD/n/Gr1I37t4vTxRLk8c4qCsOio+Zn8/IwvNBbqwMLPg1+A96x4dwYzq9Dpqf2MDV6GtxypdJSapEJeMoB62EId6rQRWHg9NK/zYfGUYhkDLwTDUlZrNUgISbURdJKnppFP3CqiuYNo1l32yxowfMjdZzd9Ym0yc6RDOh+Jmp6L4XXrzz3pXl07zetdvT55sekYB7HqhQM+HILxpwBw08fFpex7YFAYlp8D3lJyf0C1Lh79w6B8c+2RsQwF31Qtc/SAhqx8GCCuSTtJHNpExMolWVDpptaJ2UiWF5qCyZUBtR6DquSNUE2NgOdzJfP3zHI32ogcKFTXVsoleXKcGSldVUwDo1KW7CxkrwJGrpWhWkqL1YDqyzB5dlpOC960dc43G3CIHO0oTpdLELAeQ6CgU3EKBFbPi7FpVFJuXtS4UYYj0UY7M6hKFvU/LUWh+SNeHQ0cXGnMXTjUapy7MNfaWJg5O9pXGHxsvFbmv6jYhMtp8g73NPBIhOnHIAGmQPeQp8k3yC/IO+Qjtb5vTNo09aJRo2kOclIM4pAQP+bxhDCy01DIFUQj+n42fYU22Y2CYx0cO0qLrudWKpmoqBo0oWP1Vswy2o22o9acEMAVcVZHTrTu1Fl8n3ogj4FUgLwryarYVbOnmDgI/o4h7slxFi19Bew2CfTt7e3ce4KA3V83lqpsruVzlS0GJhsIioKiAyFjEVoOSFIwboQD8sPf+hr4c593Md80EJIpsaUGShFiHFBjzM45rFDOwklmvw/hQak0yFmY0FMlAJBPYV6f15p24riZgZY0aiEdE3TktAwvO7IpKwUg8oMV9LShlk8cFURSOi3Hx/SjHoqgF3O7duZ+fjgASqG81m0WQOysFWSAs0FBQDErdQTmYSEmyFIsIb30+//QDLM18uQv26eW1Rq8e68mHouE1obj//UxEEWnJUDFu4Y85xf9JPJ6Ij8prIslhBk+JAaD9jhBQIgOK/rIkbE0VpLCUDm8VpOOI4IO5hGP1RfYRO0JUkiXrSY0Mke1knOzjdcHBP167KKj8kvG2Pbdec/Km6OWA3c8gDAVW0ZggOkgPJjlv3naT+YonliBoOknX01BGgXF5eVVgPyvNznzt5F+ndpvWhl0Pf/nYPw8/4Q3s98935RePvPxGd2Oy0d0C341EllLChc3T+/27S9GUKPl/t9R1cK7FBxP3qRBoUUGzVOode/gLmrZj757jJ24dPNDXp23bcuTp048/Gb2jzPt/674nubsB58F/Y5396UM966/5V3UM38ff9V/lXC8A7LhHgEab0K6bqzfZCiuTDOklW8k29E8rO7QcTfGILoGLb3XXsUWblxVMJzTadvi6W+OuaiXhIHhujhfZGJTBoq8noqLsJCZPb9lyejLhqJHk4eOBjd5L8awTL1er5VhRDoliaHvzmtHX0dFnTN1SuvSOQuzWFL0RthMJOdz93KWfX3quOyx3dYmlK8e+Onvg2+GetVS2j379qB0LxAOqJg7+yL9tFI0lHFcizEg3v5I0AvKVe/1g9dfsTTaMVVUmCtEI8appbExgpa10PlmtV+v5ZB0bVH3bzWf8Jdj+zO9h2535d/yl+XnYvngdGrR+41Tz3etn4Ys3/KU5lCmgzEvsDptCiQYpkTrZjBFFgoBZXdGAl1hQ0ylRcx0XYwIrjodBI+LCcKsPtYJOTcawYo0A4ytxamFhyvLSNAiaynsT+87dH0cNM8pmooblf9yg4xpArRzvzk4c9jayvjHb2fLs7oSD+SMrsuokkrf1gjLxvmWUDHym/xGzO3bjZtOIoiDLoEcHp2PRR2obh47ZMmR7flWeeezE4amxjecbMz/4RrccSSTs5k6xYMnhMB14PdVB5aFnjV7jLUzJX8qBjuRLLV9ewxo98oAvueMsxr3YA2nuWIZeVaw3z0Dh8pkzl/0/0ZlX5udfAXN+xf/4LPzhtXPnXoOeJjkLNomivJ+y59keQglDr4okjHJjre+HLOlBv7qEJJUQVHF4ODQWAud++ebNHCtqSuUOq9fs/+IUO/2LtNy8Waal5gdP0Grzd5TSDc0PXtCLlaLeAnTRcV0H66PXfNX2PDtTNEAvGvTfTQ1OwlwbjjczcAJOX2y/Tej39uLsr7iP1Cnovbrj+oveLhdwd7WoE7SErC6zJ9koWtGJOWS12wQWe5d/aOQ/8w7OdDqXS3MAn95H2Whn+u5KurMzzTIc/g//D3HDy8cAAAB4nGNgZGBgAOI5bJ1a8fw2Xxm4WRhA4N7VX3YI+v98FgbmVCCXg4EJJAoALh4K8AB4nGNgZGBgbvjfwBDDwgACQJKRARXwAABHEgJ1eJxjYWBgYCEBAwAFEAAxAAAAAAAARACmASACTALgA0wDdgPyBBoEhAS0AAB4nGNgZGBg4GG4zsDLAAJMQMwFhAwM/8F8BgAfuAIHAHichZE9bsJAEIWfwZAElChKpDRpVikoEsn8lEipUKCnoAez5ke211ovSNQ5TY6QE+QI6Whzikh52EMDRbza2W/evpkdyQDusIeH8rvnLtnDJbOSK7jAo3CV+pOwT34WrqGJnnCd+qtwAy94E26yY8YOnn/FrIV3YQ+3+BCu4AafwlXqX8I++Vu4hgf8CNep/wo3MPGuhZtoeeHA6qnTczXbqVVo0sik7niO9WITT+2pPNE2X5lUdYPOURrpVNtjm3y76DkXqciaRA15q+PYqMyatQ5dsHQu67fbkehBaBIMYKExhWOcQ2GGHeMKIQxSREV0Z/mY7gU2iFlp/3VP6LbIqR9yhS4CdM5cI7rSwnk6TY4tX+tRdXQrbsuahDSUWs1JYrLiDzzcramE1AMsi6oMfbS5ohN/UMyQ/AHYk29XeJxti0sOgzAQQ8dQmAToYdIbBYmGQdWEKiBRTs932beyn2zK6KKi/zTIkOOBAiUYBhYVajR4Ei/iNQxiPvOZXuYWjm9jkvox9XGyqe80/ETdsYmjaOBBTmO/s9dDuLKN7/3Eq9dp70Qb9Y0jUwAAAA==" }, function(e, t, i) { "use strict"; i.r(t), t.default = "data:font/ttf;base64,AAEAAAALAIAAAwAwR1NVQiCLJXoAAAE4AAAAVE9TLzI8QUzCAAABjAAAAGBjbWFwKVYfngAAAhwAAAI8Z2x5ZsYVxmoAAAR0AAAJaGhlYWQgyzh9AAAA4AAAADZoaGVhB94DjQAAALwAAAAkaG10eDAAAAAAAAHsAAAAMGxvY2EQiA60AAAEWAAAABptYXhwASMA4wAAARgAAAAgbmFtZRCjPLAAAA3cAAACZ3Bvc3QZ7sqZAAAQRAAAAJwAAQAAA4D/gABcBAAAAAAABAAAAQAAAAAAAAAAAAAAAAAAAAwAAQAAAAEAAJwGiSpfDzz1AAsEAAAAAADe1fo+AAAAAN7V+j4AAP+fBAADZQAAAAgAAgAAAAAAAAABAAAADADXAA0AAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAQEAAGQAAUAAAKJAswAAACPAokCzAAAAesAMgEIAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAwOYs6fIDgP+AAAAD3ACAAAAAAQAAAAAAAAAAAAAAAAACBAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAABQAAAAMAAAAsAAAABAAAAagAAQAAAAAAogADAAEAAAAsAAMACgAAAagABAB2AAAAFAAQAAMABOYs5i7m5ed36Kvorei76MDp8v//AADmLOYu5uXnd+ir6K3ouui/6fL//wAAAAAAAAAAAAAAAAAAAAAAAAABABQAFAAUABQAFAAUABQAFgAYAAAABAABAAMAAgALAAoACQAIAAcABgAFAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAACUAAAAAAAAAAsAAOYsAADmLAAAAAQAAOYuAADmLgAAAAEAAOblAADm5QAAAAMAAOd3AADndwAAAAIAAOirAADoqwAAAAsAAOitAADorQAAAAoAAOi6AADougAAAAkAAOi7AADouwAAAAgAAOi/AADovwAAAAcAAOjAAADowAAAAAYAAOnyAADp8gAAAAUAAAAAAEQApgEgAkwC4ANMA3YD8gQaBIQEtAAAAAQAAAAAA8ADAAAHAA8AHAAoAAABFzMRIREzNwUhByMRIREjBzIeARQOASIuATQ+ARciDgEUHgEzMjY0JgK/QcD8gMBAAUn+7kCdAsydyS9PLy9PXk8vL08vFicWFicWIjExAwCA/YACgIBagP40AcwjL09eTy8vT15PL1oWJywnFjFFMAAAAAAEAAAAAAP/Av8AIgAyADYAPwAAASYGDwE1NC4BIyEiDgEVERQeATMhMj4BPQEXHgE+ATURNCYDFAYjISImNRE0NjMhMhYVEyc1NyUyHgEGIiY0NgPeECIPXiI6I/3DIzoiIjojAj0jOiJeDyIfERH+JBn93xkkJBkCIRkkxnR0/TcaJQEmNSUlAoMJAQo6OCI7IiI7Iv4CIjsiIjsiODoKAREeEQGYER7+EhkjIxkB4hkjIxn+W0feRzAlNSUlNSUAAAAABQAA/9UEAAMrAB8ALQA6AEcAUAAAATIfAjMyFh8CERQGDwEhIiYvARE0Nj8BMzc2PwIXBw4BIycRIREjIiYvAQcyHgEUDgEiLgE0PgEXIg4BFB4BMj4BNC4BJTIWFAYiJjQ2Ap0gFgQuuxYiBgEBHxkI/IAYIwQBHxkIuy4NHQgIDTUFFQzAA1bACxMGN5BGdUVFdYx1RUV1Ri5PLi5PXE8uLk8BEhslJTYlJQMrHQdcHBYHB/2qFyQEAR8aBwJWFyQEAVwZCAIBVWkLDQH91QIqCgltgEV1i3ZFRXaLdUVVLk9bUC0uTl1OLismNSUlNSYAAAsAAP/PA78DNwAMABkAJwA4AEUAUgBjAI8AtQDKANYAAAEiLgE0PgEyHgEUDgEDIg4BFB4BMj4BNC4BByImPQE0PgEeAQ8BFAY3Ii4BNz4BMzIWFAYjIgYHBgUiLgE0PgEyHgEUDgEDIg4BFB4BMj4BNC4BByIuATc+ATMyFhQGIyIGBwYTISImNRE0PgEzITIeARUHNjc2MzIXFhcWFREUBwYjMTMiLwEmJxcwNDEUBgEiBhURFBYzITI2NSc0NjMyFxYfARE0JwYHDgEHBiMiJjU3NCYjBSImPQE0NjsBMhYUBisBIgYdARQGNyMiJjQ2OwEyFhQGAQUtSywsS1lLLCxLLB4zHh4zPDIeHjJnBQgCCQoHAQEHBgQHAwMMJhYFCAgFDxoJBAGlLEssLEtZSywsSy0eMh4eMjwzHh4zWgQIAgMMJhUGCAgGDhsIBEf+GCc2GisYAegYKhkBTj0UEBMOCgMCCQwYAQwYBFc1AjX98g8ZFhIB6BAWBA8MBxkndwsBAwVaTA0IBQwPBBcP/hcFCB0TbwYHBwZvBw8Hzg0GBwcGDQUICAHwLEtYSywsS1hLLAESHjM8Mx0dMzwzHnwIBQMECgYCCQUHBQgoBQsFEhQICwgODAa+LEtYSywsS1hLLAESHjM8Mx0dMzwzHlQFCwUSFAgLCA4MBv0hLyQBVxkvHBosGQ4pIQkNChAJD/6bGAwRBwIuGhYBJTIB2R4R/qkPDxIPQAsQDBM+AwFjBwQBAjEnBgQRDDgRGaMIBkIUJQgKCBUKQgYIbwgKCAgKCAAAAAgAAP+fA9YDZQAWAB0AKgA0AD0ARABOAFcAAAEmJyYnJgYHBgcGFhcWFxY2NzY3NjU0JyEiBzceAQMUDgEiLgE0PgEyHgEDMhcDBgcnNjc2BRMWFxYXISY2EyEyNwcuAQUiJxM2NxcGBwYlAyYnJichFgYDsC5cWnJ05FNRIiMwTEpqbu1iYDc4WP6DJCGMZaO6KEVQRSgoRVBFKJUMDLwUBos8VFj+/LwNFAcI/ukjFiABfSQhjGWjAU8MDLwUBos8VFgBBLwNFAcIARcjFgI3bkpIFxdGVVJvcepbWS0tF0NBZWl3X2EN8hF6/uYoRSgoRVBFKChFAYMB/rogJvFJKSrB/rsZFAcGX8v+qw3yEXqRAQFGICbxSSkqwQFFGRQHBl/LAAAABAAA/9ED6AMvABgALABCAEMAAAEuATc+ARceAhQOAQcGLgE2Nz4BNTYnJgcmND4BFx4BFAYHBiYnLgE2NzY0ASIuAT0BND4BOwE3Nh4BFREUDgEvASMCtBINBwsnElB3QUF3UBInFgwTYm8EOTegDx0nDy8zMy8OKwsJBwcJRP3BGi0bGy0aU+oRJBkbJQ7qUwLPCiYSEgsKKIGisqKBKAoLJCQHLrNucFxZkgopHAILJm15bSYOBA8EFhcHO6b+8BorGrwaKxqzDAMaFf1sExoEC7MAAAAABAAA/8IDvQM+AAUACwARABcAADczFTMRIQEjFSMVIRMzNTM1IRM1IxEhNUPRc/68AURz0AFD8nrK/rx6egFEjMkBRQI1z3b9y8l8AWbP/rx1AAAABgAA/6ID8gNTAAsAGgAuADUAPABOAAAFASY0NjIXARYUBiIBFhUUBxc2JzYmJyYOARQ3FhcWBxQHFz4BNTQuAScmBgcGFhMOAR4BPwEDNTQuAQ8CIyIOAR0BFB4BOwEXFj4BPQEDlPynDRoiDQNaDRoj/tpFAk4XAQE0Lw8oHU9iNzkDLUcmJ0F4URInCwgOCxELFicSE/AZJRFPziMaLhoaLhpU7A4mG1EDWg0iGg38pw0jGgJtO1QODU00OT1uJgsBHSm4L1pdcWJTRzmDRVqkgigLDBISJv1LByUjCwoKAji0FBsCCz14GiwavhosGbYLBBsToAAEAAD/wQO/Az8ABQALABEAFwAANyMRITUjAzM1MzUpARUzFTMRAyMVIREjvXsBJap7e6r+2wJaqHp6qAEieuj+2nwB16x9fawBKf0AfAEmAA0AAP+tA4kDUgACAAMABgAHAAoACwAOAA8AHAAdACkANQA2AAATEQkBMxEJATcRCQEXAwkBJxQeATI+ATQuASIOARUBIgYUFhcWPgE1NCYBIgYUFhcWPgIuASOfAi/90S8CLv3SYAIz/c0CAgIw/dKRGSsyKxkZKzIrGQKMJzY2JxorGDf9qyY3NyYYKxoBGSsaAvX9FwF0AXX9FwF0AXVO/RgBcQF3nf0XAXQBdU8ZKxkZKzIrGRkrGf7oNk01AgEZLBknNv6MN0w2AQEZKzMrGQAAAgAA/8ADYQNAAA8AHwAAASMiBhURFBY7ATI2NRE0JiEjIgYVERQWOwEyNjURNCYBJ1QVHh4VVBUeHgHxVBUeHhVUFR4eA0AfFfzoFR8fFQMYFR8fFfzoFR8fFQMYFR8AAAASAN4AAQAAAAAAAAATAAAAAQAAAAAAAQAIABMAAQAAAAAAAgAHABsAAQAAAAAAAwAIACIAAQAAAAAABAAIACoAAQAAAAAABQALADIAAQAAAAAABgAIAD0AAQAAAAAACgArAEUAAQAAAAAACwATAHAAAwABBAkAAAAmAIMAAwABBAkAAQAQAKkAAwABBAkAAgAOALkAAwABBAkAAwAQAMcAAwABBAkABAAQANcAAwABBAkABQAWAOcAAwABBAkABgAQAP0AAwABBAkACgBWAQ0AAwABBAkACwAmAWNDcmVhdGVkIGJ5IGljb25mb250aWNvbmZvbnRSZWd1bGFyaWNvbmZvbnRpY29uZm9udFZlcnNpb24gMS4waWNvbmZvbnRHZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AGkAYwBvAG4AZgBvAG4AdABSAGUAZwB1AGwAYQByAGkAYwBvAG4AZgBvAG4AdABpAGMAbwBuAGYAbwBuAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG4AZgBvAG4AdABHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAECAQMBBAEFAQYBBwEIAQkBCgELAQwBDQAHeGlhbmdqaQhsdXhpYW5nMgh4aWFuZ2ppMQdsdXhpYW5nCHNuYXBzaG90CXNoZW5neWluMQh4aWFvcGluZwdqaW5neWluCXF1YW5waW5nMQZib2ZhbmcHemFudGluZwAA" }, function(e, t, i) { (t = e.exports = i(73)).Stream = t, t.Readable = t, t.Writable = i(77), t.Duplex = i(26), t.Transform = i( 78), t.PassThrough = i(142), t.finished = i(46), t.pipeline = i(143) }, function(e, t) {}, function(e, t, i) { "use strict"; function r(e, t) { var i = Object.keys(e); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(e); t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), i.push.apply(i, r) } return i } function n(e, t, i) { return t in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e } function a(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var s = i(10).Buffer, o = i(139).inspect, u = o && o.custom || "inspect"; e.exports = function() { function e() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.head = null, this.tail = null, this.length = 0 } var t, i; return t = e, (i = [{ key: "push", value: function(e) { var t = { data: e, next: null }; this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length } }, { key: "unshift", value: function(e) { var t = { data: e, next: this.head }; 0 === this.length && (this.tail = t), this.head = t, ++this.length } }, { key: "shift", value: function() { if (0 !== this.length) { var e = this.head.data; return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, -- this.length, e } } }, { key: "clear", value: function() { this.head = this.tail = null, this.length = 0 } }, { key: "join", value: function(e) { if (0 === this.length) return ""; for (var t = this.head, i = "" + t.data; t = t.next;) i += e + t.data; return i } }, { key: "concat", value: function(e) { if (0 === this.length) return s.alloc(0); for (var t, i, r, n = s.allocUnsafe(e >>> 0), a = this.head, o = 0; a;) t = a.data, i = n, r = o, s.prototype.copy.call(t, i, r), o += a.data.length, a = a.next; return n } }, { key: "consume", value: function(e, t) { var i; return e < this.head.data.length ? (i = this.head.data.slice(0, e), this.head.data = this .head.data.slice(e)) : i = e === this.head.data.length ? this.shift() : t ? this ._getString(e) : this._getBuffer(e), i } }, { key: "first", value: function() { return this.head.data } }, { key: "_getString", value: function(e) { var t = this.head, i = 1, r = t.data; for (e -= r.length; t = t.next;) { var n = t.data, a = e > n.length ? n.length : e; if (a === n.length ? r += n : r += n.slice(0, e), 0 == (e -= a)) { a === n.length ? (++i, t.next ? this.head = t.next : this.head = this.tail = null) : ( this.head = t, t.data = n.slice(a)); break }++i } return this.length -= i, r } }, { key: "_getBuffer", value: function(e) { var t = s.allocUnsafe(e), i = this.head, r = 1; for (i.data.copy(t), e -= i.data.length; i = i.next;) { var n = i.data, a = e > n.length ? n.length : e; if (n.copy(t, t.length - e, 0, a), 0 == (e -= a)) { a === n.length ? (++r, i.next ? this.head = i.next : this.head = this.tail = null) : ( this.head = i, i.data = n.slice(a)); break }++r } return this.length -= r, t } }, { key: u, value: function(e, t) { return o(this, function(e) { for (var t = 1; t < arguments.length; t++) { var i = null != arguments[t] ? arguments[t] : {}; t % 2 ? r(Object(i), !0).forEach(function(t) { n(e, t, i[t]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object .getOwnPropertyDescriptors(i)) : r(Object(i)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t)) }) } return e }({}, t, { depth: 0, customInspect: !1 })) } }]) && a(t.prototype, i), e }() }, function(e, t) {}, function(e, t, i) { "use strict"; (function(t) { var r; function n(e, t, i) { return t in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e } var a = i(46), s = Symbol("lastResolve"), o = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), d = Symbol("lastPromise"), c = Symbol("handlePromise"), h = Symbol("stream"); function f(e, t) { return { value: e, done: t } } function p(e) { var t = e[s]; if (null !== t) { var i = e[h].read(); null !== i && (e[d] = null, e[s] = null, e[o] = null, t(f(i, !1))) } } function m(e) { t.nextTick(p, e) } var g = Object.getPrototypeOf(function() {}), v = Object.setPrototypeOf((n(r = { get stream() { return this[h] }, next: function() { var e = this, i = this[u]; if (null !== i) return Promise.reject(i); if (this[l]) return Promise.resolve(f(void 0, !0)); if (this[h].destroyed) return new Promise(function(i, r) { t.nextTick(function() { e[u] ? r(e[u]) : i(f(void 0, !0)) }) }); var r, n = this[d]; if (n) r = new Promise(function(e, t) { return function(i, r) { e.then(function() { t[l] ? i(f(void 0, !0)) : t[c](i, r) }, r) } }(n, this)); else { var a = this[h].read(); if (null !== a) return Promise.resolve(f(a, !1)); r = new Promise(this[c]) } return this[d] = r, r } }, Symbol.asyncIterator, function() { return this }), n(r, "return", function() { var e = this; return new Promise(function(t, i) { e[h].destroy(null, function(e) { e ? i(e) : t(f(void 0, !0)) }) }) }), r), g); e.exports = function(e) { var t, i = Object.create(v, (n(t = {}, h, { value: e, writable: !0 }), n(t, s, { value: null, writable: !0 }), n(t, o, { value: null, writable: !0 }), n(t, u, { value: null, writable: !0 }), n(t, l, { value: e._readableState.endEmitted, writable: !0 }), n(t, c, { value: function(e, t) { var r = i[h].read(); r ? (i[d] = null, i[s] = null, i[o] = null, e(f(r, !1))) : (i[s] = e, i[o] = t) }, writable: !0 }), t)); return i[d] = null, a(e, function(e) { if (e && "ERR_STREAM_PREMATURE_CLOSE" !== e.code) { var t = i[o]; return null !== t && (i[d] = null, i[s] = null, i[o] = null, t(e)), void(i[u] = e) } var r = i[s]; null !== r && (i[d] = null, i[s] = null, i[o] = null, r(f(void 0, !0))), i[l] = !0 }), e.on("readable", m.bind(null, i)), i } }).call(this, i(9)) }, function(e, t) { e.exports = function() { throw new Error("Readable.from is not available in the browser") } }, function(e, t, i) { "use strict"; e.exports = n; var r = i(78); function n(e) { if (!(this instanceof n)) return new n(e); r.call(this, e) } i(5)(n, r), n.prototype._transform = function(e, t, i) { i(null, e) } }, function(e, t, i) { "use strict"; var r, n = i(25).codes, a = n.ERR_MISSING_ARGS, s = n.ERR_STREAM_DESTROYED; function o(e) { if (e) throw e } function u(e, t, n, a) { a = function(e) { var t = !1; return function() { t || (t = !0, e.apply(void 0, arguments)) } }(a); var o = !1; e.on("close", function() { o = !0 }), void 0 === r && (r = i(46)), r(e, { readable: t, writable: n }, function(e) { if (e) return a(e); o = !0, a() }); var u = !1; return function(t) { if (!o && !u) return u = !0, function(e) { return e.setHeader && "function" == typeof e.abort }(e) ? e.abort() : "function" == typeof e.destroy ? e.destroy() : void a(t || new s("pipe")) } } function l(e) { e() } function d(e, t) { return e.pipe(t) } e.exports = function() { for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i]; var r, n = function(e) { return e.length ? "function" != typeof e[e.length - 1] ? o : e.pop() : o }(t); if (Array.isArray(t[0]) && (t = t[0]), t.length < 2) throw new a("streams"); var s = t.map(function(e, i) { var a = i < t.length - 1; return u(e, a, i > 0, function(e) { r || (r = e), e && s.forEach(l), a || (s.forEach(l), n(r)) }) }); return t.reduce(d) } }, function(e, t, i) { var r = i(5), n = i(27), a = i(6).Buffer, s = [1518500249, 1859775393, -1894007588, -899497514], o = new Array(80); function u() { this.init(), this._w = o, n.call(this, 64, 56) } function l(e) { return e << 30 | e >>> 2 } function d(e, t, i, r) { return 0 === e ? t & i | ~t & r : 2 === e ? t & i | t & r | i & r : t ^ i ^ r } r(u, n), u.prototype.init = function() { return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this }, u.prototype._update = function(e) { for (var t, i = this._w, r = 0 | this._a, n = 0 | this._b, a = 0 | this._c, o = 0 | this._d, u = 0 | this._e, c = 0; c < 16; ++c) i[c] = e.readInt32BE(4 * c); for (; c < 80; ++c) i[c] = i[c - 3] ^ i[c - 8] ^ i[c - 14] ^ i[c - 16]; for (var h = 0; h < 80; ++h) { var f = ~~(h / 20), p = 0 | ((t = r) << 5 | t >>> 27) + d(f, n, a, o) + u + i[h] + s[f]; u = o, o = a, a = l(n), n = r, r = p } this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = a + this._c | 0, this._d = o + this._d | 0, this._e = u + this._e | 0 }, u.prototype._hash = function() { var e = a.allocUnsafe(20); return e.writeInt32BE(0 | this._a, 0), e.writeInt32BE(0 | this._b, 4), e.writeInt32BE(0 | this._c, 8), e .writeInt32BE(0 | this._d, 12), e.writeInt32BE(0 | this._e, 16), e }, e.exports = u }, function(e, t, i) { var r = i(5), n = i(27), a = i(6).Buffer, s = [1518500249, 1859775393, -1894007588, -899497514], o = new Array(80); function u() { this.init(), this._w = o, n.call(this, 64, 56) } function l(e) { return e << 5 | e >>> 27 } function d(e) { return e << 30 | e >>> 2 } function c(e, t, i, r) { return 0 === e ? t & i | ~t & r : 2 === e ? t & i | t & r | i & r : t ^ i ^ r } r(u, n), u.prototype.init = function() { return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this }, u.prototype._update = function(e) { for (var t, i = this._w, r = 0 | this._a, n = 0 | this._b, a = 0 | this._c, o = 0 | this._d, u = 0 | this._e, h = 0; h < 16; ++h) i[h] = e.readInt32BE(4 * h); for (; h < 80; ++h) i[h] = (t = i[h - 3] ^ i[h - 8] ^ i[h - 14] ^ i[h - 16]) << 1 | t >>> 31; for (var f = 0; f < 80; ++f) { var p = ~~(f / 20), m = l(r) + c(p, n, a, o) + u + i[f] + s[p] | 0; u = o, o = a, a = d(n), n = r, r = m } this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = a + this._c | 0, this._d = o + this._d | 0, this._e = u + this._e | 0 }, u.prototype._hash = function() { var e = a.allocUnsafe(20); return e.writeInt32BE(0 | this._a, 0), e.writeInt32BE(0 | this._b, 4), e.writeInt32BE(0 | this._c, 8), e .writeInt32BE(0 | this._d, 12), e.writeInt32BE(0 | this._e, 16), e }, e.exports = u }, function(e, t, i) { var r = i(5), n = i(79), a = i(27), s = i(6).Buffer, o = new Array(64); function u() { this.init(), this._w = o, a.call(this, 64, 56) } r(u, n), u.prototype.init = function() { return this._a = 3238371032, this._b = 914150663, this._c = 812702999, this._d = 4144912697, this._e = 4290775857, this._f = 1750603025, this._g = 1694076839, this._h = 3204075428, this }, u.prototype._hash = function() { var e = s.allocUnsafe(28); return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e .writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE( this._g, 24), e }, e.exports = u }, function(e, t, i) { var r = i(5), n = i(80), a = i(27), s = i(6).Buffer, o = new Array(160); function u() { this.init(), this._w = o, a.call(this, 128, 112) } r(u, n), u.prototype.init = function() { return this._ah = 3418070365, this._bh = 1654270250, this._ch = 2438529370, this._dh = 355462360, this ._eh = 1731405415, this._fh = 2394180231, this._gh = 3675008525, this._hh = 1203062813, this._al = 3238371032, this._bl = 914150663, this._cl = 812702999, this._dl = 4144912697, this._el = 4290775857, this._fl = 1750603025, this._gl = 1694076839, this._hl = 3204075428, this }, u.prototype._hash = function() { var e = s.allocUnsafe(48); function t(t, i, r) { e.writeInt32BE(t, r), e.writeInt32BE(i, r + 4) } return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this ._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), e }, e.exports = u }, function(e, t, i) { e.exports = n; var r = i(8).EventEmitter; function n() { r.call(this) } i(5)(n, r), n.Readable = i(49), n.Writable = i(155), n.Duplex = i(156), n.Transform = i(157), n .PassThrough = i(158), n.Stream = n, n.prototype.pipe = function(e, t) { var i = this; function n(t) { e.writable && !1 === e.write(t) && i.pause && i.pause() } function a() { i.readable && i.resume && i.resume() } i.on("data", n), e.on("drain", a), e._isStdio || t && !1 === t.end || (i.on("end", o), i.on("close", u)); var s = !1; function o() { s || (s = !0, e.end()) } function u() { s || (s = !0, "function" == typeof e.destroy && e.destroy()) } function l(e) { if (d(), 0 === r.listenerCount(this, "error")) throw e } function d() { i.removeListener("data", n), e.removeListener("drain", a), i.removeListener("end", o), i .removeListener("close", u), i.removeListener("error", l), e.removeListener("error", l), i .removeListener("end", d), i.removeListener("close", d), e.removeListener("close", d) } return i.on("error", l), e.on("error", l), i.on("end", d), i.on("close", d), e.on("close", d), e.emit( "pipe", i), e } }, function(e, t) {}, function(e, t, i) { "use strict"; var r = i(50).Buffer, n = i(151); e.exports = function() { function e() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.head = null, this.tail = null, this.length = 0 } return e.prototype.push = function(e) { var t = { data: e, next: null }; this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length }, e.prototype.unshift = function(e) { var t = { data: e, next: this.head }; 0 === this.length && (this.tail = t), this.head = t, ++this.length }, e.prototype.shift = function() { if (0 !== this.length) { var e = this.head.data; return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, --this .length, e } }, e.prototype.clear = function() { this.head = this.tail = null, this.length = 0 }, e.prototype.join = function(e) { if (0 === this.length) return ""; for (var t = this.head, i = "" + t.data; t = t.next;) i += e + t.data; return i }, e.prototype.concat = function(e) { if (0 === this.length) return r.alloc(0); if (1 === this.length) return this.head.data; for (var t, i, n = r.allocUnsafe(e >>> 0), a = this.head, s = 0; a;) t = n, i = s, a.data.copy(t, i), s += a.data.length, a = a.next; return n }, e }(), n && n.inspect && n.inspect.custom && (e.exports.prototype[n.inspect.custom] = function() { var e = n.inspect({ length: this.length }); return this.constructor.name + " " + e }) }, function(e, t) {}, function(e, t, i) { (function(e) { var r = void 0 !== e && e || "undefined" != typeof self && self || window, n = Function.prototype.apply; function a(e, t) { this._id = e, this._clearFn = t } t.setTimeout = function() { return new a(n.call(setTimeout, r, arguments), clearTimeout) }, t.setInterval = function() { return new a(n.call(setInterval, r, arguments), clearInterval) }, t.clearTimeout = t.clearInterval = function(e) { e && e.close() }, a.prototype.unref = a.prototype.ref = function() {}, a.prototype.close = function() { this._clearFn.call(r, this._id) }, t.enroll = function(e, t) { clearTimeout(e._idleTimeoutId), e._idleTimeout = t }, t.unenroll = function(e) { clearTimeout(e._idleTimeoutId), e._idleTimeout = -1 }, t._unrefActive = t.active = function(e) { clearTimeout(e._idleTimeoutId); var t = e._idleTimeout; t >= 0 && (e._idleTimeoutId = setTimeout(function() { e._onTimeout && e._onTimeout() }, t)) }, i(153), t.setImmediate = "undefined" != typeof self && self.setImmediate || void 0 !== e && e .setImmediate || this && this.setImmediate, t.clearImmediate = "undefined" != typeof self && self .clearImmediate || void 0 !== e && e.clearImmediate || this && this.clearImmediate }).call(this, i(13)) }, function(e, t, i) { (function(e, t) { ! function(e, i) { "use strict"; if (!e.setImmediate) { var r, n, a, s, o, u = 1, l = {}, d = !1, c = e.document, h = Object.getPrototypeOf && Object.getPrototypeOf(e); h = h && h.setTimeout ? h : e, "[object process]" === {}.toString.call(e.process) ? r = function( e) { t.nextTick(function() { p(e) }) } : function() { if (e.postMessage && !e.importScripts) { var t = !0, i = e.onmessage; return e.onmessage = function() { t = !1 }, e.postMessage("", "*"), e.onmessage = i, t } }() ? (s = "setImmediate$" + Math.random() + "$", o = function(t) { t.source === e && "string" == typeof t.data && 0 === t.data.indexOf(s) && p(+t.data.slice(s .length)) }, e.addEventListener ? e.addEventListener("message", o, !1) : e.attachEvent("onmessage", o), r = function(t) { e.postMessage(s + t, "*") }) : e.MessageChannel ? ((a = new MessageChannel).port1.onmessage = function(e) { p(e.data) }, r = function(e) { a.port2.postMessage(e) }) : c && "onreadystatechange" in c.createElement("script") ? (n = c.documentElement, r = function(e) { var t = c.createElement("script"); t.onreadystatechange = function() { p(e), t.onreadystatechange = null, n.removeChild(t), t = null }, n.appendChild(t) }) : r = function(e) { setTimeout(p, 0, e) }, h.setImmediate = function(e) { "function" != typeof e && (e = new Function("" + e)); for (var t = new Array(arguments.length - 1), i = 0; i < t.length; i++) t[i] = arguments[i + 1]; var n = { callback: e, args: t }; return l[u] = n, r(u), u++ }, h.clearImmediate = f } function f(e) { delete l[e] } function p(e) { if (d) setTimeout(p, 0, e); else { var t = l[e]; if (t) { d = !0; try { ! function(e) { var t = e.callback, i = e.args; switch (i.length) { case 0: t(); break; case 1: t(i[0]); break; case 2: t(i[0], i[1]); break; case 3: t(i[0], i[1], i[2]); break; default: t.apply(void 0, i) } }(t) } finally { f(e), d = !1 } } } } }("undefined" == typeof self ? void 0 === e ? this : e : self) }).call(this, i(13), i(9)) }, function(e, t, i) { "use strict"; e.exports = a; var r = i(84), n = Object.create(i(32)); function a(e) { if (!(this instanceof a)) return new a(e); r.call(this, e) } n.inherits = i(5), n.inherits(a, r), a.prototype._transform = function(e, t, i) { i(null, e) } }, function(e, t, i) { e.exports = i(51) }, function(e, t, i) { e.exports = i(23) }, function(e, t, i) { e.exports = i(49).Transform }, function(e, t, i) { e.exports = i(49).PassThrough }, function(e, t, i) { "use strict"; var r = i(5), n = i(6).Buffer, a = i(20), s = n.alloc(128); function o(e, t) { a.call(this, "digest"), "string" == typeof t && (t = n.from(t)), this._alg = e, this._key = t, t.length > 64 ? t = e(t) : t.length < 64 && (t = n.concat([t, s], 64)); for (var i = this._ipad = n.allocUnsafe(64), r = this._opad = n.allocUnsafe(64), o = 0; o < 64; o++) i[ o] = 54 ^ t[o], r[o] = 92 ^ t[o]; this._hash = [i] } r(o, a), o.prototype._update = function(e) { this._hash.push(e) }, o.prototype._final = function() { var e = this._alg(n.concat(this._hash)); return this._alg(n.concat([this._opad, e])) }, e.exports = o }, function(e, t, i) { e.exports = i(87) }, function(e, t, i) { (function(t) { var r, n, a = i(6).Buffer, s = i(89), o = i(90), u = i(91), l = i(92), d = t.crypto && t.crypto.subtle, c = { sha: "SHA-1", "sha-1": "SHA-1", sha1: "SHA-1", sha256: "SHA-256", "sha-256": "SHA-256", sha384: "SHA-384", "sha-384": "SHA-384", "sha-512": "SHA-512", sha512: "SHA-512" }, h = []; function f() { return n || (n = t.process && t.process.nextTick ? t.process.nextTick : t.queueMicrotask ? t .queueMicrotask : t.setImmediate ? t.setImmediate : t.setTimeout) } function p(e, t, i, r, n) { return d.importKey("raw", e, { name: "PBKDF2" }, !1, ["deriveBits"]).then(function(e) { return d.deriveBits({ name: "PBKDF2", salt: t, iterations: i, hash: { name: n } }, e, r << 3) }).then(function(e) { return a.from(e) }) } e.exports = function(e, i, n, m, g, v) { "function" == typeof g && (v = g, g = void 0); var y = c[(g = g || "sha1").toLowerCase()]; if (y && "function" == typeof t.Promise) { if (s(n, m), e = l(e, o, "Password"), i = l(i, o, "Salt"), "function" != typeof v) throw new Error("No callback provided to pbkdf2"); ! function(e, t) { e.then(function(e) { f()(function() { t(null, e) }) }, function(e) { f()(function() { t(e) }) }) }(function(e) { if (t.process && !t.process.browser) return Promise.resolve(!1); if (!d || !d.importKey || !d.deriveBits) return Promise.resolve(!1); if (void 0 !== h[e]) return h[e]; var i = p(r = r || a.alloc(8), r, 10, 128, e).then(function() { return !0 }).catch(function() { return !1 }); return h[e] = i, i }(y).then(function(t) { return t ? p(e, i, n, m, y) : u(e, i, n, m, g) }), v) } else f()(function() { var t; try { t = u(e, i, n, m, g) } catch (e) { return v(e) } v(null, t) }) } }).call(this, i(13)) }, function(e, t, i) { var r = i(163), n = i(53), a = i(54), s = i(176), o = i(40); function u(e, t, i) { if (e = e.toLowerCase(), a[e]) return n.createCipheriv(e, t, i); if (s[e]) return new r({ key: t, iv: i, mode: e }); throw new TypeError("invalid suite type") } function l(e, t, i) { if (e = e.toLowerCase(), a[e]) return n.createDecipheriv(e, t, i); if (s[e]) return new r({ key: t, iv: i, mode: e, decrypt: !0 }); throw new TypeError("invalid suite type") } t.createCipher = t.Cipher = function(e, t) { var i, r; if (e = e.toLowerCase(), a[e]) i = a[e].key, r = a[e].iv; else { if (!s[e]) throw new TypeError("invalid suite type"); i = 8 * s[e].key, r = s[e].iv } var n = o(t, !1, i, r); return u(e, n.key, n.iv) }, t.createCipheriv = t.Cipheriv = u, t.createDecipher = t.Decipher = function(e, t) { var i, r; if (e = e.toLowerCase(), a[e]) i = a[e].key, r = a[e].iv; else { if (!s[e]) throw new TypeError("invalid suite type"); i = 8 * s[e].key, r = s[e].iv } var n = o(t, !1, i, r); return l(e, n.key, n.iv) }, t.createDecipheriv = t.Decipheriv = l, t.listCiphers = t.getCiphers = function() { return Object.keys(s).concat(n.getCiphers()) } }, function(e, t, i) { var r = i(20), n = i(164), a = i(5), s = i(6).Buffer, o = { "des-ede3-cbc": n.CBC.instantiate(n.EDE), "des-ede3": n.EDE, "des-ede-cbc": n.CBC.instantiate(n.EDE), "des-ede": n.EDE, "des-cbc": n.CBC.instantiate(n.DES), "des-ecb": n.DES }; function u(e) { r.call(this); var t, i = e.mode.toLowerCase(), n = o[i]; t = e.decrypt ? "decrypt" : "encrypt"; var a = e.key; s.isBuffer(a) || (a = s.from(a)), "des-ede" !== i && "des-ede-cbc" !== i || (a = s.concat([a, a.slice(0, 8)])); var u = e.iv; s.isBuffer(u) || (u = s.from(u)), this._des = n.create({ key: a, iv: u, type: t }) } o.des = o["des-cbc"], o.des3 = o["des-ede3-cbc"], e.exports = u, a(u, r), u.prototype._update = function( e) { return s.from(this._des.update(e)) }, u.prototype._final = function() { return s.from(this._des.final()) } }, function(e, t, i) { "use strict"; t.utils = i(93), t.Cipher = i(52), t.DES = i(94), t.CBC = i(165), t.EDE = i(166) }, function(e, t, i) { "use strict"; var r = i(14), n = i(5), a = {}; t.instantiate = function(e) { function t(t) { e.call(this, t), this._cbcInit() } n(t, e); for (var i = Object.keys(a), r = 0; r < i.length; r++) { var s = i[r]; t.prototype[s] = a[s] } return t.create = function(e) { return new t(e) }, t }, a._cbcInit = function() { var e = new function(e) { r.equal(e.length, 8, "Invalid IV length"), this.iv = new Array(8); for (var t = 0; t < this.iv.length; t++) this.iv[t] = e[t] }(this.options.iv); this._cbcState = e }, a._update = function(e, t, i, r) { var n = this._cbcState, a = this.constructor.super_.prototype, s = n.iv; if ("encrypt" === this.type) { for (var o = 0; o < this.blockSize; o++) s[o] ^= e[t + o]; for (a._update.call(this, s, 0, i, r), o = 0; o < this.blockSize; o++) s[o] = i[r + o] } else { for (a._update.call(this, e, t, i, r), o = 0; o < this.blockSize; o++) i[r + o] ^= s[o]; for (o = 0; o < this.blockSize; o++) s[o] = e[t + o] } } }, function(e, t, i) { "use strict"; var r = i(14), n = i(5), a = i(52), s = i(94); function o(e) { a.call(this, e); var t = new function(e, t) { r.equal(t.length, 24, "Invalid key length"); var i = t.slice(0, 8), n = t.slice(8, 16), a = t.slice(16, 24); this.ciphers = "encrypt" === e ? [s.create({ type: "encrypt", key: i }), s.create({ type: "decrypt", key: n }), s.create({ type: "encrypt", key: a })] : [s.create({ type: "decrypt", key: a }), s.create({ type: "encrypt", key: n }), s.create({ type: "decrypt", key: i })] }(this.type, this.options.key); this._edeState = t } n(o, a), e.exports = o, o.create = function(e) { return new o(e) }, o.prototype._update = function(e, t, i, r) { var n = this._edeState; n.ciphers[0]._update(e, t, i, r), n.ciphers[1]._update(i, r, i, r), n.ciphers[2]._update(i, r, i, r) }, o.prototype._pad = s.prototype._pad, o.prototype._unpad = s.prototype._unpad }, function(e, t, i) { var r = i(54), n = i(98), a = i(6).Buffer, s = i(99), o = i(20), u = i(39), l = i(40); function d(e, t, i) { o.call(this), this._cache = new h, this._cipher = new u.AES(t), this._prev = a.from(i), this._mode = e, this._autopadding = !0 } i(5)(d, o), d.prototype._update = function(e) { var t, i; this._cache.add(e); for (var r = []; t = this._cache.get();) i = this._mode.encrypt(this, t), r.push(i); return a.concat(r) }; var c = a.alloc(16, 16); function h() { this.cache = a.allocUnsafe(0) } function f(e, t, i) { var o = r[e.toLowerCase()]; if (!o) throw new TypeError("invalid suite type"); if ("string" == typeof t && (t = a.from(t)), t.length !== o.key / 8) throw new TypeError( "invalid key length " + t.length); if ("string" == typeof i && (i = a.from(i)), "GCM" !== o.mode && i.length !== o.iv) throw new TypeError( "invalid iv length " + i.length); return "stream" === o.type ? new s(o.module, t, i) : "auth" === o.type ? new n(o.module, t, i) : new d(o .module, t, i) } d.prototype._final = function() { var e = this._cache.flush(); if (this._autopadding) return e = this._mode.encrypt(this, e), this._cipher.scrub(), e; if (!e.equals(c)) throw this._cipher.scrub(), new Error("data not multiple of block length") }, d.prototype.setAutoPadding = function(e) { return this._autopadding = !!e, this }, h.prototype.add = function(e) { this.cache = a.concat([this.cache, e]) }, h.prototype.get = function() { if (this.cache.length > 15) { var e = this.cache.slice(0, 16); return this.cache = this.cache.slice(16), e } return null }, h.prototype.flush = function() { for (var e = 16 - this.cache.length, t = a.allocUnsafe(e), i = -1; ++i < e;) t.writeUInt8(e, i); return a.concat([this.cache, t]) }, t.createCipheriv = f, t.createCipher = function(e, t) { var i = r[e.toLowerCase()]; if (!i) throw new TypeError("invalid suite type"); var n = l(t, !1, i.key, i.iv); return f(e, n.key, n.iv) } }, function(e, t) { t.encrypt = function(e, t) { return e._cipher.encryptBlock(t) }, t.decrypt = function(e, t) { return e._cipher.decryptBlock(t) } }, function(e, t, i) { var r = i(33); t.encrypt = function(e, t) { var i = r(t, e._prev); return e._prev = e._cipher.encryptBlock(i), e._prev }, t.decrypt = function(e, t) { var i = e._prev; e._prev = t; var n = e._cipher.decryptBlock(t); return r(n, i) } }, function(e, t, i) { var r = i(6).Buffer, n = i(33); function a(e, t, i) { var a = t.length, s = n(t, e._cache); return e._cache = e._cache.slice(a), e._prev = r.concat([e._prev, i ? t : s]), s } t.encrypt = function(e, t, i) { for (var n, s = r.allocUnsafe(0); t.length;) { if (0 === e._cache.length && (e._cache = e._cipher.encryptBlock(e._prev), e._prev = r.allocUnsafe(0)), !(e._cache.length <= t.length)) { s = r.concat([s, a(e, t, i)]); break } n = e._cache.length, s = r.concat([s, a(e, t.slice(0, n), i)]), t = t.slice(n) } return s } }, function(e, t, i) { var r = i(6).Buffer; function n(e, t, i) { var n = e._cipher.encryptBlock(e._prev)[0] ^ t; return e._prev = r.concat([e._prev.slice(1), r.from([i ? t : n])]), n } t.encrypt = function(e, t, i) { for (var a = t.length, s = r.allocUnsafe(a), o = -1; ++o < a;) s[o] = n(e, t[o], i); return s } }, function(e, t, i) { var r = i(6).Buffer; function n(e, t, i) { for (var r, n, s = -1, o = 0; ++s < 8;) r = t & 1 << 7 - s ? 128 : 0, o += (128 & (n = e._cipher .encryptBlock(e._prev)[0] ^ r)) >> s % 8, e._prev = a(e._prev, i ? r : n); return o } function a(e, t) { var i = e.length, n = -1, a = r.allocUnsafe(e.length); for (e = r.concat([e, r.from([t])]); ++n < i;) a[n] = e[n] << 1 | e[n + 1] >> 7; return a } t.encrypt = function(e, t, i) { for (var a = t.length, s = r.allocUnsafe(a), o = -1; ++o < a;) s[o] = n(e, t[o], i); return s } }, function(e, t, i) { (function(e) { var r = i(33); function n(e) { return e._prev = e._cipher.encryptBlock(e._prev), e._prev } t.encrypt = function(t, i) { for (; t._cache.length < i.length;) t._cache = e.concat([t._cache, n(t)]); var a = t._cache.slice(0, i.length); return t._cache = t._cache.slice(i.length), r(i, a) } }).call(this, i(10).Buffer) }, function(e, t, i) { var r = i(6).Buffer, n = r.alloc(16, 0); function a(e) { var t = r.allocUnsafe(16); return t.writeUInt32BE(e[0] >>> 0, 0), t.writeUInt32BE(e[1] >>> 0, 4), t.writeUInt32BE(e[2] >>> 0, 8), t .writeUInt32BE(e[3] >>> 0, 12), t } function s(e) { this.h = e, this.state = r.alloc(16, 0), this.cache = r.allocUnsafe(0) } s.prototype.ghash = function(e) { for (var t = -1; ++t < e.length;) this.state[t] ^= e[t]; this._multiply() }, s.prototype._multiply = function() { for (var e, t, i, r = [(e = this.h).readUInt32BE(0), e.readUInt32BE(4), e.readUInt32BE(8), e .readUInt32BE(12) ], n = [0, 0, 0, 0], s = -1; ++s < 128;) { for (0 != (this.state[~~(s / 8)] & 1 << 7 - s % 8) && (n[0] ^= r[0], n[1] ^= r[1], n[2] ^= r[2], n[ 3] ^= r[3]), i = 0 != (1 & r[3]), t = 3; t > 0; t--) r[t] = r[t] >>> 1 | (1 & r[t - 1]) << 31; r[0] = r[0] >>> 1, i && (r[0] = r[0] ^ 225 << 24) } this.state = a(n) }, s.prototype.update = function(e) { var t; for (this.cache = r.concat([this.cache, e]); this.cache.length >= 16;) t = this.cache.slice(0, 16), this .cache = this.cache.slice(16), this.ghash(t) }, s.prototype.final = function(e, t) { return this.cache.length && this.ghash(r.concat([this.cache, n], 16)), this.ghash(a([0, e, 0, t])), this .state }, e.exports = s }, function(e, t, i) { var r = i(98), n = i(6).Buffer, a = i(54), s = i(99), o = i(20), u = i(39), l = i(40); function d(e, t, i) { o.call(this), this._cache = new c, this._last = void 0, this._cipher = new u.AES(t), this._prev = n.from( i), this._mode = e, this._autopadding = !0 } function c() { this.cache = n.allocUnsafe(0) } function h(e, t, i) { var o = a[e.toLowerCase()]; if (!o) throw new TypeError("invalid suite type"); if ("string" == typeof i && (i = n.from(i)), "GCM" !== o.mode && i.length !== o.iv) throw new TypeError( "invalid iv length " + i.length); if ("string" == typeof t && (t = n.from(t)), t.length !== o.key / 8) throw new TypeError( "invalid key length " + t.length); return "stream" === o.type ? new s(o.module, t, i, !0) : "auth" === o.type ? new r(o.module, t, i, !0) : new d(o.module, t, i) } i(5)(d, o), d.prototype._update = function(e) { var t, i; this._cache.add(e); for (var r = []; t = this._cache.get(this._autopadding);) i = this._mode.decrypt(this, t), r.push(i); return n.concat(r) }, d.prototype._final = function() { var e = this._cache.flush(); if (this._autopadding) return function(e) { var t = e[15]; if (t < 1 || t > 16) throw new Error("unable to decrypt data"); for (var i = -1; ++i < t;) if (e[i + (16 - t)] !== t) throw new Error("unable to decrypt data"); if (16 !== t) return e.slice(0, 16 - t) }(this._mode.decrypt(this, e)); if (e) throw new Error("data not multiple of block length") }, d.prototype.setAutoPadding = function(e) { return this._autopadding = !!e, this }, c.prototype.add = function(e) { this.cache = n.concat([this.cache, e]) }, c.prototype.get = function(e) { var t; if (e) { if (this.cache.length > 16) return t = this.cache.slice(0, 16), this.cache = this.cache.slice(16), t } else if (this.cache.length >= 16) return t = this.cache.slice(0, 16), this.cache = this.cache.slice( 16), t; return null }, c.prototype.flush = function() { if (this.cache.length) return this.cache }, t.createDecipher = function(e, t) { var i = a[e.toLowerCase()]; if (!i) throw new TypeError("invalid suite type"); var r = l(t, !1, i.key, i.iv); return h(e, r.key, r.iv) }, t.createDecipheriv = h }, function(e, t) { t["des-ecb"] = { key: 8, iv: 0 }, t["des-cbc"] = t.des = { key: 8, iv: 8 }, t["des-ede3-cbc"] = t.des3 = { key: 24, iv: 8 }, t["des-ede3"] = { key: 24, iv: 0 }, t["des-ede-cbc"] = { key: 16, iv: 8 }, t["des-ede"] = { key: 16, iv: 0 } }, function(e, t, i) { (function(e) { var r = i(100), n = i(180), a = i(181), s = { binary: !0, hex: !0, base64: !0 }; t.DiffieHellmanGroup = t.createDiffieHellmanGroup = t.getDiffieHellman = function(t) { var i = new e(n[t].prime, "hex"), r = new e(n[t].gen, "hex"); return new a(i, r) }, t.createDiffieHellman = t.DiffieHellman = function t(i, n, o, u) { return e.isBuffer(n) || void 0 === s[n] ? t(i, "binary", n, o) : (n = n || "binary", u = u || "binary", o = o || new e([2]), e.isBuffer(o) || (o = new e(o, u)), "number" == typeof i ? new a( r(i, o), o, !0) : (e.isBuffer(i) || (i = new e(i, n)), new a(i, o, !0))) } }).call(this, i(10).Buffer) }, function(e, t) {}, function(e, t) {}, function(e) { e.exports = JSON.parse( '{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}' ) }, function(e, t, i) { (function(t) { var r = i(11), n = new(i(101)), a = new r(24), s = new r(11), o = new r(10), u = new r(3), l = new r(7), d = i(100), c = i(24); function h(e, i) { return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this._pub = new r(e), this } function f(e, i) { return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this._priv = new r(e), this } e.exports = m; var p = {}; function m(e, t, i) { this.setGenerator(t), this.__prime = new r(e), this._prime = r.mont(this.__prime), this._primeLen = e .length, this._pub = void 0, this._priv = void 0, this._primeCode = void 0, i ? (this.setPublicKey = h, this.setPrivateKey = f) : this._primeCode = 8 } function g(e, i) { var r = new t(e.toArray()); return i ? r.toString(i) : r } Object.defineProperty(m.prototype, "verifyError", { enumerable: !0, get: function() { return "number" != typeof this._primeCode && (this._primeCode = function(e, t) { var i = t.toString("hex"), r = [i, e.toString(16)].join("_"); if (r in p) return p[r]; var c, h = 0; if (e.isEven() || !d.simpleSieve || !d.fermatTest(e) || !n.test(e)) return h += 1, h += "02" === i || "05" === i ? 8 : 4, p[r] = h, h; switch (n.test(e.shrn(1)) || (h += 2), i) { case "02": e.mod(a).cmp(s) && (h += 8); break; case "05": (c = e.mod(o)).cmp(u) && c.cmp(l) && (h += 8); break; default: h += 4 } return p[r] = h, h }(this.__prime, this.__gen)), this._primeCode } }), m.prototype.generateKeys = function() { return this._priv || (this._priv = new r(c(this._primeLen))), this._pub = this._gen.toRed(this ._prime).redPow(this._priv).fromRed(), this.getPublicKey() }, m.prototype.computeSecret = function(e) { var i = (e = (e = new r(e)).toRed(this._prime)).redPow(this._priv).fromRed(), n = new t(i.toArray()), a = this.getPrime(); if (n.length < a.length) { var s = new t(a.length - n.length); s.fill(0), n = t.concat([s, n]) } return n }, m.prototype.getPublicKey = function(e) { return g(this._pub, e) }, m.prototype.getPrivateKey = function(e) { return g(this._priv, e) }, m.prototype.getPrime = function(e) { return g(this.__prime, e) }, m.prototype.getGenerator = function(e) { return g(this._gen, e) }, m.prototype.setGenerator = function(e, i) { return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this.__gen = e, this._gen = new r(e), this } }).call(this, i(10).Buffer) }, function(e, t, i) { var r = i(6).Buffer, n = i(31), a = i(183), s = i(5), o = i(191), u = i(222), l = i(87); function d(e) { a.Writable.call(this); var t = l[e]; if (!t) throw new Error("Unknown message digest"); this._hashType = t.hash, this._hash = n(t.hash), this._tag = t.id, this._signType = t.sign } function c(e) { a.Writable.call(this); var t = l[e]; if (!t) throw new Error("Unknown message digest"); this._hash = n(t.hash), this._tag = t.id, this._signType = t.sign } function h(e) { return new d(e) } function f(e) { return new c(e) } Object.keys(l).forEach(function(e) { l[e].id = r.from(l[e].id, "hex"), l[e.toLowerCase()] = l[e] }), s(d, a.Writable), d.prototype._write = function(e, t, i) { this._hash.update(e), i() }, d.prototype.update = function(e, t) { return "string" == typeof e && (e = r.from(e, t)), this._hash.update(e), this }, d.prototype.sign = function(e, t) { this.end(); var i = this._hash.digest(), r = o(i, e, this._hashType, this._signType, this._tag); return t ? r.toString(t) : r }, s(c, a.Writable), c.prototype._write = function(e, t, i) { this._hash.update(e), i() }, c.prototype.update = function(e, t) { return "string" == typeof e && (e = r.from(e, t)), this._hash.update(e), this }, c.prototype.verify = function(e, t, i) { "string" == typeof t && (t = r.from(t, i)), this.end(); var n = this._hash.digest(); return u(t, n, e, this._signType, this._tag) }, e.exports = { Sign: h, Verify: f, createSign: h, createVerify: f } }, function(e, t, i) { (t = e.exports = i(102)).Stream = t, t.Readable = t, t.Writable = i(106), t.Duplex = i(29), t.Transform = i( 107), t.PassThrough = i(189), t.finished = i(57), t.pipeline = i(190) }, function(e, t) {}, function(e, t, i) { "use strict"; function r(e, t) { var i = Object.keys(e); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(e); t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), i.push.apply(i, r) } return i } function n(e, t, i) { return t in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e } function a(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var s = i(10).Buffer, o = i(186).inspect, u = o && o.custom || "inspect"; e.exports = function() { function e() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.head = null, this.tail = null, this.length = 0 } var t, i; return t = e, (i = [{ key: "push", value: function(e) { var t = { data: e, next: null }; this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length } }, { key: "unshift", value: function(e) { var t = { data: e, next: this.head }; 0 === this.length && (this.tail = t), this.head = t, ++this.length } }, { key: "shift", value: function() { if (0 !== this.length) { var e = this.head.data; return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, -- this.length, e } } }, { key: "clear", value: function() { this.head = this.tail = null, this.length = 0 } }, { key: "join", value: function(e) { if (0 === this.length) return ""; for (var t = this.head, i = "" + t.data; t = t.next;) i += e + t.data; return i } }, { key: "concat", value: function(e) { if (0 === this.length) return s.alloc(0); for (var t, i, r, n = s.allocUnsafe(e >>> 0), a = this.head, o = 0; a;) t = a.data, i = n, r = o, s.prototype.copy.call(t, i, r), o += a.data.length, a = a.next; return n } }, { key: "consume", value: function(e, t) { var i; return e < this.head.data.length ? (i = this.head.data.slice(0, e), this.head.data = this .head.data.slice(e)) : i = e === this.head.data.length ? this.shift() : t ? this ._getString(e) : this._getBuffer(e), i } }, { key: "first", value: function() { return this.head.data } }, { key: "_getString", value: function(e) { var t = this.head, i = 1, r = t.data; for (e -= r.length; t = t.next;) { var n = t.data, a = e > n.length ? n.length : e; if (a === n.length ? r += n : r += n.slice(0, e), 0 == (e -= a)) { a === n.length ? (++i, t.next ? this.head = t.next : this.head = this.tail = null) : ( this.head = t, t.data = n.slice(a)); break }++i } return this.length -= i, r } }, { key: "_getBuffer", value: function(e) { var t = s.allocUnsafe(e), i = this.head, r = 1; for (i.data.copy(t), e -= i.data.length; i = i.next;) { var n = i.data, a = e > n.length ? n.length : e; if (n.copy(t, t.length - e, 0, a), 0 == (e -= a)) { a === n.length ? (++r, i.next ? this.head = i.next : this.head = this.tail = null) : ( this.head = i, i.data = n.slice(a)); break }++r } return this.length -= r, t } }, { key: u, value: function(e, t) { return o(this, function(e) { for (var t = 1; t < arguments.length; t++) { var i = null != arguments[t] ? arguments[t] : {}; t % 2 ? r(Object(i), !0).forEach(function(t) { n(e, t, i[t]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object .getOwnPropertyDescriptors(i)) : r(Object(i)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t)) }) } return e }({}, t, { depth: 0, customInspect: !1 })) } }]) && a(t.prototype, i), e }() }, function(e, t) {}, function(e, t, i) { "use strict"; (function(t) { var r; function n(e, t, i) { return t in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e } var a = i(57), s = Symbol("lastResolve"), o = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), d = Symbol("lastPromise"), c = Symbol("handlePromise"), h = Symbol("stream"); function f(e, t) { return { value: e, done: t } } function p(e) { var t = e[s]; if (null !== t) { var i = e[h].read(); null !== i && (e[d] = null, e[s] = null, e[o] = null, t(f(i, !1))) } } function m(e) { t.nextTick(p, e) } var g = Object.getPrototypeOf(function() {}), v = Object.setPrototypeOf((n(r = { get stream() { return this[h] }, next: function() { var e = this, i = this[u]; if (null !== i) return Promise.reject(i); if (this[l]) return Promise.resolve(f(void 0, !0)); if (this[h].destroyed) return new Promise(function(i, r) { t.nextTick(function() { e[u] ? r(e[u]) : i(f(void 0, !0)) }) }); var r, n = this[d]; if (n) r = new Promise(function(e, t) { return function(i, r) { e.then(function() { t[l] ? i(f(void 0, !0)) : t[c](i, r) }, r) } }(n, this)); else { var a = this[h].read(); if (null !== a) return Promise.resolve(f(a, !1)); r = new Promise(this[c]) } return this[d] = r, r } }, Symbol.asyncIterator, function() { return this }), n(r, "return", function() { var e = this; return new Promise(function(t, i) { e[h].destroy(null, function(e) { e ? i(e) : t(f(void 0, !0)) }) }) }), r), g); e.exports = function(e) { var t, i = Object.create(v, (n(t = {}, h, { value: e, writable: !0 }), n(t, s, { value: null, writable: !0 }), n(t, o, { value: null, writable: !0 }), n(t, u, { value: null, writable: !0 }), n(t, l, { value: e._readableState.endEmitted, writable: !0 }), n(t, c, { value: function(e, t) { var r = i[h].read(); r ? (i[d] = null, i[s] = null, i[o] = null, e(f(r, !1))) : (i[s] = e, i[o] = t) }, writable: !0 }), t)); return i[d] = null, a(e, function(e) { if (e && "ERR_STREAM_PREMATURE_CLOSE" !== e.code) { var t = i[o]; return null !== t && (i[d] = null, i[s] = null, i[o] = null, t(e)), void(i[u] = e) } var r = i[s]; null !== r && (i[d] = null, i[s] = null, i[o] = null, r(f(void 0, !0))), i[l] = !0 }), e.on("readable", m.bind(null, i)), i } }).call(this, i(9)) }, function(e, t) { e.exports = function() { throw new Error("Readable.from is not available in the browser") } }, function(e, t, i) { "use strict"; e.exports = n; var r = i(107); function n(e) { if (!(this instanceof n)) return new n(e); r.call(this, e) } i(5)(n, r), n.prototype._transform = function(e, t, i) { i(null, e) } }, function(e, t, i) { "use strict"; var r, n = i(28).codes, a = n.ERR_MISSING_ARGS, s = n.ERR_STREAM_DESTROYED; function o(e) { if (e) throw e } function u(e, t, n, a) { a = function(e) { var t = !1; return function() { t || (t = !0, e.apply(void 0, arguments)) } }(a); var o = !1; e.on("close", function() { o = !0 }), void 0 === r && (r = i(57)), r(e, { readable: t, writable: n }, function(e) { if (e) return a(e); o = !0, a() }); var u = !1; return function(t) { if (!o && !u) return u = !0, function(e) { return e.setHeader && "function" == typeof e.abort }(e) ? e.abort() : "function" == typeof e.destroy ? e.destroy() : void a(t || new s("pipe")) } } function l(e) { e() } function d(e, t) { return e.pipe(t) } e.exports = function() { for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i]; var r, n = function(e) { return e.length ? "function" != typeof e[e.length - 1] ? o : e.pop() : o }(t); if (Array.isArray(t[0]) && (t = t[0]), t.length < 2) throw new a("streams"); var s = t.map(function(e, i) { var a = i < t.length - 1; return u(e, a, i > 0, function(e) { r || (r = e), e && s.forEach(l), a || (s.forEach(l), n(r)) }) }); return t.reduce(d) } }, function(e, t, i) { var r = i(6).Buffer, n = i(85), a = i(58), s = i(59).ec, o = i(113), u = i(42), l = i(119); function d(e, t, i, a) { if ((e = r.from(e.toArray())).length < t.byteLength()) { var s = r.alloc(t.byteLength() - e.length); e = r.concat([s, e]) } var o = i.length, u = function(e, t) { e = (e = c(e, t)).mod(t); var i = r.from(e.toArray()); if (i.length < t.byteLength()) { var n = r.alloc(t.byteLength() - i.length); i = r.concat([n, i]) } return i }(i, t), l = r.alloc(o); l.fill(1); var d = r.alloc(o); return d = n(a, d).update(l).update(r.from([0])).update(e).update(u).digest(), l = n(a, d).update(l) .digest(), { k: d = n(a, d).update(l).update(r.from([1])).update(e).update(u).digest(), v: l = n(a, d).update(l).digest() } } function c(e, t) { var i = new o(e), r = (e.length << 3) - t.bitLength(); return r > 0 && i.ishrn(r), i } function h(e, t, i) { var a, s; do { for (a = r.alloc(0); 8 * a.length < e.bitLength();) t.v = n(i, t.k).update(t.v).digest(), a = r.concat([ a, t.v ]); s = c(a, e), t.k = n(i, t.k).update(t.v).update(r.from([0])).digest(), t.v = n(i, t.k).update(t.v) .digest() } while (-1 !== s.cmp(e)); return s } function f(e, t, i, r) { return e.toRed(o.mont(i)).redPow(t).fromRed().mod(r) } e.exports = function(e, t, i, n, p) { var m = u(t); if (m.curve) { if ("ecdsa" !== n && "ecdsa/rsa" !== n) throw new Error("wrong private key type"); return function(e, t) { var i = l[t.curve.join(".")]; if (!i) throw new Error("unknown curve " + t.curve.join(".")); var n = new s(i).keyFromPrivate(t.privateKey).sign(e); return r.from(n.toDER()) }(e, m) } if ("dsa" === m.type) { if ("dsa" !== n) throw new Error("wrong private key type"); return function(e, t, i) { for (var n, a = t.params.priv_key, s = t.params.p, u = t.params.q, l = t.params.g, p = new o(0), m = c(e, u).mod(u), g = !1, v = d(a, u, e, i); !1 === g;) p = f(l, n = h(u, v, i), s, u), 0 === (g = n.invm(u).imul(m.add(a.mul(p))).mod(u)).cmpn(0) && (g = !1, p = new o(0)); return function(e, t) { e = e.toArray(), t = t.toArray(), 128 & e[0] && (e = [0].concat(e)), 128 & t[0] && (t = [0] .concat(t)); var i = [48, e.length + t.length + 4, 2, e.length]; return i = i.concat(e, [2, t.length], t), r.from(i) }(p, g) }(e, m, i) } if ("rsa" !== n && "ecdsa/rsa" !== n) throw new Error("wrong private key type"); e = r.concat([p, e]); for (var g = m.modulus.byteLength(), v = [0, 1]; e.length + v.length + 1 < g;) v.push(255); v.push(0); for (var y = -1; ++y < e.length;) v.push(e[y]); return a(v, m) }, e.exports.getKey = d, e.exports.makeKey = h }, function(e, t, i) { (function(e) { ! function(e, t) { "use strict"; function r(e, t) { if (!e) throw new Error(t || "Assertion failed") } function n(e, t) { e.super_ = t; var i = function() {}; i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e } function a(e, t, i) { if (a.isBN(e)) return e; this.negative = 0, this.words = null, this.length = 0, this.red = null, null !== e && ("le" !== t && "be" !== t || (i = t, t = 10), this._init(e || 0, t || 10, i || "be")) } var s; "object" == typeof e ? e.exports = a : t.BN = a, a.BN = a, a.wordSize = 26; try { s = "undefined" != typeof window && void 0 !== window.Buffer ? window.Buffer : i(193).Buffer } catch (e) {} function o(e, t) { var i = e.charCodeAt(t); return i >= 48 && i <= 57 ? i - 48 : i >= 65 && i <= 70 ? i - 55 : i >= 97 && i <= 102 ? i - 87 : void r(!1, "Invalid character in " + e) } function u(e, t, i) { var r = o(e, i); return i - 1 >= t && (r |= o(e, i - 1) << 4), r } function l(e, t, i, n) { for (var a = 0, s = 0, o = Math.min(e.length, i), u = t; u < o; u++) { var l = e.charCodeAt(u) - 48; a *= n, s = l >= 49 ? l - 49 + 10 : l >= 17 ? l - 17 + 10 : l, r(l >= 0 && s < n, "Invalid character"), a += s } return a } function d(e, t) { e.words = t.words, e.length = t.length, e.negative = t.negative, e.red = t.red } if (a.isBN = function(e) { return e instanceof a || null !== e && "object" == typeof e && e.constructor.wordSize === a .wordSize && Array.isArray(e.words) }, a.max = function(e, t) { return e.cmp(t) > 0 ? e : t }, a.min = function(e, t) { return e.cmp(t) < 0 ? e : t }, a.prototype._init = function(e, t, i) { if ("number" == typeof e) return this._initNumber(e, t, i); if ("object" == typeof e) return this._initArray(e, t, i); "hex" === t && (t = 16), r(t === (0 | t) && t >= 2 && t <= 36); var n = 0; "-" === (e = e.toString().replace(/\s+/g, ""))[0] && (n++, this.negative = 1), n < e.length && ( 16 === t ? this._parseHex(e, n, i) : (this._parseBase(e, t, n), "le" === i && this._initArray( this.toArray(), t, i))) }, a.prototype._initNumber = function(e, t, i) { e < 0 && (this.negative = 1, e = -e), e < 67108864 ? (this.words = [67108863 & e], this.length = 1) : e < 4503599627370496 ? (this.words = [67108863 & e, e / 67108864 & 67108863], this .length = 2) : (r(e < 9007199254740992), this.words = [67108863 & e, e / 67108864 & 67108863, 1 ], this.length = 3), "le" === i && this._initArray(this.toArray(), t, i) }, a.prototype._initArray = function(e, t, i) { if (r("number" == typeof e.length), e.length <= 0) return this.words = [0], this.length = 1, this; this.length = Math.ceil(e.length / 3), this.words = new Array(this.length); for (var n = 0; n < this.length; n++) this.words[n] = 0; var a, s, o = 0; if ("be" === i) for (n = e.length - 1, a = 0; n >= 0; n -= 3) s = e[n] | e[n - 1] << 8 | e[n - 2] << 16, this .words[a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && (o -= 26, a++); else if ("le" === i) for (n = 0, a = 0; n < e.length; n += 3) s = e[n] | e[n + 1] << 8 | e[n + 2] << 16, this.words[ a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && ( o -= 26, a++); return this._strip() }, a.prototype._parseHex = function(e, t, i) { this.length = Math.ceil((e.length - t) / 6), this.words = new Array(this.length); for (var r = 0; r < this.length; r++) this.words[r] = 0; var n, a = 0, s = 0; if ("be" === i) for (r = e.length - 1; r >= t; r -= 2) n = u(e, t, r) << a, this.words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8; else for (r = (e.length - t) % 2 == 0 ? t + 1 : t; r < e.length; r += 2) n = u(e, t, r) << a, this .words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8; this._strip() }, a.prototype._parseBase = function(e, t, i) { this.words = [0], this.length = 1; for (var r = 0, n = 1; n <= 67108863; n *= t) r++; r--, n = n / t | 0; for (var a = e.length - i, s = a % r, o = Math.min(a, a - s) + i, u = 0, d = i; d < o; d += r) u = l(e, d, d + r, t), this.imuln(n), this.words[0] + u < 67108864 ? this.words[0] += u : this ._iaddn(u); if (0 !== s) { var c = 1; for (u = l(e, d, e.length, t), d = 0; d < s; d++) c *= t; this.imuln(c), this.words[0] + u < 67108864 ? this.words[0] += u : this._iaddn(u) } this._strip() }, a.prototype.copy = function(e) { e.words = new Array(this.length); for (var t = 0; t < this.length; t++) e.words[t] = this.words[t]; e.length = this.length, e.negative = this.negative, e.red = this.red }, a.prototype._move = function(e) { d(e, this) }, a.prototype.clone = function() { var e = new a(null); return this.copy(e), e }, a.prototype._expand = function(e) { for (; this.length < e;) this.words[this.length++] = 0; return this }, a.prototype._strip = function() { for (; this.length > 1 && 0 === this.words[this.length - 1];) this.length--; return this._normSign() }, a.prototype._normSign = function() { return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this }, "undefined" != typeof Symbol && "function" == typeof Symbol.for) try { a.prototype[Symbol.for("nodejs.util.inspect.custom")] = c } catch (e) { a.prototype.inspect = c } else a.prototype.inspect = c; function c() { return (this.red ? "" } var h = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000", "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000", "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000", "00000000000000000000", "000000000000000000000", "0000000000000000000000", "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000" ], f = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ], p = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 ]; function m(e, t, i) { i.negative = t.negative ^ e.negative; var r = e.length + t.length | 0; i.length = r, r = r - 1 | 0; var n = 0 | e.words[0], a = 0 | t.words[0], s = n * a, o = 67108863 & s, u = s / 67108864 | 0; i.words[0] = o; for (var l = 1; l < r; l++) { for (var d = u >>> 26, c = 67108863 & u, h = Math.min(l, t.length - 1), f = Math.max(0, l - e .length + 1); f <= h; f++) { var p = l - f | 0; d += (s = (n = 0 | e.words[p]) * (a = 0 | t.words[f]) + c) / 67108864 | 0, c = 67108863 & s } i.words[l] = 0 | c, u = 0 | d } return 0 !== u ? i.words[l] = 0 | u : i.length--, i._strip() } a.prototype.toString = function(e, t) { var i; if (t = 0 | t || 1, 16 === (e = e || 10) || "hex" === e) { i = ""; for (var n = 0, a = 0, s = 0; s < this.length; s++) { var o = this.words[s], u = (16777215 & (o << n | a)).toString(16); a = o >>> 24 - n & 16777215, (n += 2) >= 26 && (n -= 26, s--), i = 0 !== a || s !== this .length - 1 ? h[6 - u.length] + u + i : u + i } for (0 !== a && (i = a.toString(16) + i); i.length % t != 0;) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i } if (e === (0 | e) && e >= 2 && e <= 36) { var l = f[e], d = p[e]; i = ""; var c = this.clone(); for (c.negative = 0; !c.isZero();) { var m = c.modrn(d).toString(e); i = (c = c.idivn(d)).isZero() ? m + i : h[l - m.length] + m + i } for (this.isZero() && (i = "0" + i); i.length % t != 0;) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i } r(!1, "Base should be between 2 and 36") }, a.prototype.toNumber = function() { var e = this.words[0]; return 2 === this.length ? e += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[ 2] ? e += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && r(!1, "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e }, a.prototype.toJSON = function() { return this.toString(16, 2) }, s && (a.prototype.toBuffer = function(e, t) { return this.toArrayLike(s, e, t) }), a.prototype.toArray = function(e, t) { return this.toArrayLike(Array, e, t) }, a.prototype.toArrayLike = function(e, t, i) { this._strip(); var n = this.byteLength(), a = i || Math.max(1, n); r(n <= a, "byte array longer than desired length"), r(a > 0, "Requested array length <= 0"); var s = function(e, t) { return e.allocUnsafe ? e.allocUnsafe(t) : new e(t) }(e, a); return this["_toArrayLike" + ("le" === t ? "LE" : "BE")](s, n), s }, a.prototype._toArrayLikeLE = function(e, t) { for (var i = 0, r = 0, n = 0, a = 0; n < this.length; n++) { var s = this.words[n] << a | r; e[i++] = 255 & s, i < e.length && (e[i++] = s >> 8 & 255), i < e.length && (e[i++] = s >> 16 & 255), 6 === a ? (i < e.length && (e[i++] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24, a += 2) } if (i < e.length) for (e[i++] = r; i < e.length;) e[i++] = 0 }, a.prototype._toArrayLikeBE = function(e, t) { for (var i = e.length - 1, r = 0, n = 0, a = 0; n < this.length; n++) { var s = this.words[n] << a | r; e[i--] = 255 & s, i >= 0 && (e[i--] = s >> 8 & 255), i >= 0 && (e[i--] = s >> 16 & 255), 6 === a ? (i >= 0 && (e[i--] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24, a += 2) } if (i >= 0) for (e[i--] = r; i >= 0;) e[i--] = 0 }, Math.clz32 ? a.prototype._countBits = function(e) { return 32 - Math.clz32(e) } : a.prototype._countBits = function(e) { var t = e, i = 0; return t >= 4096 && (i += 13, t >>>= 13), t >= 64 && (i += 7, t >>>= 7), t >= 8 && (i += 4, t >>>= 4), t >= 2 && (i += 2, t >>>= 2), i + t }, a.prototype._zeroBits = function(e) { if (0 === e) return 26; var t = e, i = 0; return 0 == (8191 & t) && (i += 13, t >>>= 13), 0 == (127 & t) && (i += 7, t >>>= 7), 0 == (15 & t) && (i += 4, t >>>= 4), 0 == (3 & t) && (i += 2, t >>>= 2), 0 == (1 & t) && i++, i }, a.prototype.bitLength = function() { var e = this.words[this.length - 1], t = this._countBits(e); return 26 * (this.length - 1) + t }, a.prototype.zeroBits = function() { if (this.isZero()) return 0; for (var e = 0, t = 0; t < this.length; t++) { var i = this._zeroBits(this.words[t]); if (e += i, 26 !== i) break } return e }, a.prototype.byteLength = function() { return Math.ceil(this.bitLength() / 8) }, a.prototype.toTwos = function(e) { return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone() }, a.prototype.fromTwos = function(e) { return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone() }, a.prototype.isNeg = function() { return 0 !== this.negative }, a.prototype.neg = function() { return this.clone().ineg() }, a.prototype.ineg = function() { return this.isZero() || (this.negative ^= 1), this }, a.prototype.iuor = function(e) { for (; this.length < e.length;) this.words[this.length++] = 0; for (var t = 0; t < e.length; t++) this.words[t] = this.words[t] | e.words[t]; return this._strip() }, a.prototype.ior = function(e) { return r(0 == (this.negative | e.negative)), this.iuor(e) }, a.prototype.or = function(e) { return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this) }, a.prototype.uor = function(e) { return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this) }, a.prototype.iuand = function(e) { var t; t = this.length > e.length ? e : this; for (var i = 0; i < t.length; i++) this.words[i] = this.words[i] & e.words[i]; return this.length = t.length, this._strip() }, a.prototype.iand = function(e) { return r(0 == (this.negative | e.negative)), this.iuand(e) }, a.prototype.and = function(e) { return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this) }, a.prototype.uand = function(e) { return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this) }, a.prototype.iuxor = function(e) { var t, i; this.length > e.length ? (t = this, i = e) : (t = e, i = this); for (var r = 0; r < i.length; r++) this.words[r] = t.words[r] ^ i.words[r]; if (this !== t) for (; r < t.length; r++) this.words[r] = t.words[r]; return this.length = t.length, this._strip() }, a.prototype.ixor = function(e) { return r(0 == (this.negative | e.negative)), this.iuxor(e) }, a.prototype.xor = function(e) { return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this) }, a.prototype.uxor = function(e) { return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this) }, a.prototype.inotn = function(e) { r("number" == typeof e && e >= 0); var t = 0 | Math.ceil(e / 26), i = e % 26; this._expand(t), i > 0 && t--; for (var n = 0; n < t; n++) this.words[n] = 67108863 & ~this.words[n]; return i > 0 && (this.words[n] = ~this.words[n] & 67108863 >> 26 - i), this._strip() }, a.prototype.notn = function(e) { return this.clone().inotn(e) }, a.prototype.setn = function(e, t) { r("number" == typeof e && e >= 0); var i = e / 26 | 0, n = e % 26; return this._expand(i + 1), this.words[i] = t ? this.words[i] | 1 << n : this.words[i] & ~(1 << n), this._strip() }, a.prototype.iadd = function(e) { var t, i, r; if (0 !== this.negative && 0 === e.negative) return this.negative = 0, t = this.isub(e), this .negative ^= 1, this._normSign(); if (0 === this.negative && 0 !== e.negative) return e.negative = 0, t = this.isub(e), e.negative = 1, t._normSign(); this.length > e.length ? (i = this, r = e) : (i = e, r = this); for (var n = 0, a = 0; a < r.length; a++) t = (0 | i.words[a]) + (0 | r.words[a]) + n, this.words[ a] = 67108863 & t, n = t >>> 26; for (; 0 !== n && a < i.length; a++) t = (0 | i.words[a]) + n, this.words[a] = 67108863 & t, n = t >>> 26; if (this.length = i.length, 0 !== n) this.words[this.length] = n, this.length++; else if (i !== this) for (; a < i.length; a++) this.words[a] = i.words[a]; return this }, a.prototype.add = function(e) { var t; return 0 !== e.negative && 0 === this.negative ? (e.negative = 0, t = this.sub(e), e.negative ^= 1, t) : 0 === e.negative && 0 !== this.negative ? (this.negative = 0, t = e.sub(this), this .negative = 1, t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this) }, a.prototype.isub = function(e) { if (0 !== e.negative) { e.negative = 0; var t = this.iadd(e); return e.negative = 1, t._normSign() } if (0 !== this.negative) return this.negative = 0, this.iadd(e), this.negative = 1, this ._normSign(); var i, r, n = this.cmp(e); if (0 === n) return this.negative = 0, this.length = 1, this.words[0] = 0, this; n > 0 ? (i = this, r = e) : (i = e, r = this); for (var a = 0, s = 0; s < r.length; s++) a = (t = (0 | i.words[s]) - (0 | r.words[s]) + a) >> 26, this.words[s] = 67108863 & t; for (; 0 !== a && s < i.length; s++) a = (t = (0 | i.words[s]) + a) >> 26, this.words[s] = 67108863 & t; if (0 === a && s < i.length && i !== this) for (; s < i.length; s++) this.words[s] = i.words[s]; return this.length = Math.max(this.length, s), i !== this && (this.negative = 1), this._strip() }, a.prototype.sub = function(e) { return this.clone().isub(e) }; var g = function(e, t, i) { var r, n, a, s = e.words, o = t.words, u = i.words, l = 0, d = 0 | s[0], c = 8191 & d, h = d >>> 13, f = 0 | s[1], p = 8191 & f, m = f >>> 13, g = 0 | s[2], v = 8191 & g, y = g >>> 13, _ = 0 | s[3], b = 8191 & _, w = _ >>> 13, E = 0 | s[4], T = 8191 & E, S = E >>> 13, A = 0 | s[5], k = 8191 & A, R = A >>> 13, M = 0 | s[6], O = 8191 & M, C = M >>> 13, D = 0 | s[7], I = 8191 & D, L = D >>> 13, x = 0 | s[8], P = 8191 & x, U = x >>> 13, N = 0 | s[9], B = 8191 & N, F = N >>> 13, j = 0 | o[0], H = 8191 & j, G = j >>> 13, V = 0 | o[1], W = 8191 & V, q = V >>> 13, X = 0 | o[2], z = 8191 & X, K = X >>> 13, Y = 0 | o[3], Q = 8191 & Y, J = Y >>> 13, Z = 0 | o[4], $ = 8191 & Z, ee = Z >>> 13, te = 0 | o[5], ie = 8191 & te, re = te >>> 13, ne = 0 | o[6], ae = 8191 & ne, se = ne >>> 13, oe = 0 | o[7], ue = 8191 & oe, le = oe >>> 13, de = 0 | o[8], ce = 8191 & de, he = de >>> 13, fe = 0 | o[9], pe = 8191 & fe, me = fe >>> 13; i.negative = e.negative ^ t.negative, i.length = 19; var ge = (l + (r = Math.imul(c, H)) | 0) + ((8191 & (n = (n = Math.imul(c, G)) + Math.imul(h, H) | 0)) << 13) | 0; l = ((a = Math.imul(h, G)) + (n >>> 13) | 0) + (ge >>> 26) | 0, ge &= 67108863, r = Math.imul(p, H), n = (n = Math.imul(p, G)) + Math.imul(m, H) | 0, a = Math.imul(m, G); var ve = (l + (r = r + Math.imul(c, W) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, q) | 0) + Math.imul(h, W) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, q) | 0) + (n >>> 13) | 0) + (ve >>> 26) | 0, ve &= 67108863, r = Math .imul(v, H), n = (n = Math.imul(v, G)) + Math.imul(y, H) | 0, a = Math.imul(y, G), r = r + Math .imul(p, W) | 0, n = (n = n + Math.imul(p, q) | 0) + Math.imul(m, W) | 0, a = a + Math.imul(m, q) | 0; var ye = (l + (r = r + Math.imul(c, z) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, K) | 0) + Math.imul(h, z) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, K) | 0) + (n >>> 13) | 0) + (ye >>> 26) | 0, ye &= 67108863, r = Math .imul(b, H), n = (n = Math.imul(b, G)) + Math.imul(w, H) | 0, a = Math.imul(w, G), r = r + Math .imul(v, W) | 0, n = (n = n + Math.imul(v, q) | 0) + Math.imul(y, W) | 0, a = a + Math.imul(y, q) | 0, r = r + Math.imul(p, z) | 0, n = (n = n + Math.imul(p, K) | 0) + Math.imul(m, z) | 0, a = a + Math.imul(m, K) | 0; var _e = (l + (r = r + Math.imul(c, Q) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, J) | 0) + Math.imul(h, Q) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, J) | 0) + (n >>> 13) | 0) + (_e >>> 26) | 0, _e &= 67108863, r = Math .imul(T, H), n = (n = Math.imul(T, G)) + Math.imul(S, H) | 0, a = Math.imul(S, G), r = r + Math .imul(b, W) | 0, n = (n = n + Math.imul(b, q) | 0) + Math.imul(w, W) | 0, a = a + Math.imul(w, q) | 0, r = r + Math.imul(v, z) | 0, n = (n = n + Math.imul(v, K) | 0) + Math.imul(y, z) | 0, a = a + Math.imul(y, K) | 0, r = r + Math.imul(p, Q) | 0, n = (n = n + Math.imul(p, J) | 0) + Math.imul(m, Q) | 0, a = a + Math.imul(m, J) | 0; var be = (l + (r = r + Math.imul(c, $) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, ee) | 0) + Math.imul(h, $) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, ee) | 0) + (n >>> 13) | 0) + (be >>> 26) | 0, be &= 67108863, r = Math .imul(k, H), n = (n = Math.imul(k, G)) + Math.imul(R, H) | 0, a = Math.imul(R, G), r = r + Math .imul(T, W) | 0, n = (n = n + Math.imul(T, q) | 0) + Math.imul(S, W) | 0, a = a + Math.imul(S, q) | 0, r = r + Math.imul(b, z) | 0, n = (n = n + Math.imul(b, K) | 0) + Math.imul(w, z) | 0, a = a + Math.imul(w, K) | 0, r = r + Math.imul(v, Q) | 0, n = (n = n + Math.imul(v, J) | 0) + Math.imul(y, Q) | 0, a = a + Math.imul(y, J) | 0, r = r + Math.imul(p, $) | 0, n = (n = n + Math .imul(p, ee) | 0) + Math.imul(m, $) | 0, a = a + Math.imul(m, ee) | 0; var we = (l + (r = r + Math.imul(c, ie) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, re) | 0) + Math.imul(h, ie) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, re) | 0) + (n >>> 13) | 0) + (we >>> 26) | 0, we &= 67108863, r = Math .imul(O, H), n = (n = Math.imul(O, G)) + Math.imul(C, H) | 0, a = Math.imul(C, G), r = r + Math .imul(k, W) | 0, n = (n = n + Math.imul(k, q) | 0) + Math.imul(R, W) | 0, a = a + Math.imul(R, q) | 0, r = r + Math.imul(T, z) | 0, n = (n = n + Math.imul(T, K) | 0) + Math.imul(S, z) | 0, a = a + Math.imul(S, K) | 0, r = r + Math.imul(b, Q) | 0, n = (n = n + Math.imul(b, J) | 0) + Math.imul(w, Q) | 0, a = a + Math.imul(w, J) | 0, r = r + Math.imul(v, $) | 0, n = (n = n + Math .imul(v, ee) | 0) + Math.imul(y, $) | 0, a = a + Math.imul(y, ee) | 0, r = r + Math.imul(p, ie) | 0, n = (n = n + Math.imul(p, re) | 0) + Math.imul(m, ie) | 0, a = a + Math.imul(m, re) | 0; var Ee = (l + (r = r + Math.imul(c, ae) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, se) | 0) + Math.imul(h, ae) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, se) | 0) + (n >>> 13) | 0) + (Ee >>> 26) | 0, Ee &= 67108863, r = Math .imul(I, H), n = (n = Math.imul(I, G)) + Math.imul(L, H) | 0, a = Math.imul(L, G), r = r + Math .imul(O, W) | 0, n = (n = n + Math.imul(O, q) | 0) + Math.imul(C, W) | 0, a = a + Math.imul(C, q) | 0, r = r + Math.imul(k, z) | 0, n = (n = n + Math.imul(k, K) | 0) + Math.imul(R, z) | 0, a = a + Math.imul(R, K) | 0, r = r + Math.imul(T, Q) | 0, n = (n = n + Math.imul(T, J) | 0) + Math.imul(S, Q) | 0, a = a + Math.imul(S, J) | 0, r = r + Math.imul(b, $) | 0, n = (n = n + Math .imul(b, ee) | 0) + Math.imul(w, $) | 0, a = a + Math.imul(w, ee) | 0, r = r + Math.imul(v, ie) | 0, n = (n = n + Math.imul(v, re) | 0) + Math.imul(y, ie) | 0, a = a + Math.imul(y, re) | 0, r = r + Math.imul(p, ae) | 0, n = (n = n + Math.imul(p, se) | 0) + Math.imul(m, ae) | 0, a = a + Math.imul(m, se) | 0; var Te = (l + (r = r + Math.imul(c, ue) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, le) | 0) + Math.imul(h, ue) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, le) | 0) + (n >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, r = Math .imul(P, H), n = (n = Math.imul(P, G)) + Math.imul(U, H) | 0, a = Math.imul(U, G), r = r + Math .imul(I, W) | 0, n = (n = n + Math.imul(I, q) | 0) + Math.imul(L, W) | 0, a = a + Math.imul(L, q) | 0, r = r + Math.imul(O, z) | 0, n = (n = n + Math.imul(O, K) | 0) + Math.imul(C, z) | 0, a = a + Math.imul(C, K) | 0, r = r + Math.imul(k, Q) | 0, n = (n = n + Math.imul(k, J) | 0) + Math.imul(R, Q) | 0, a = a + Math.imul(R, J) | 0, r = r + Math.imul(T, $) | 0, n = (n = n + Math .imul(T, ee) | 0) + Math.imul(S, $) | 0, a = a + Math.imul(S, ee) | 0, r = r + Math.imul(b, ie) | 0, n = (n = n + Math.imul(b, re) | 0) + Math.imul(w, ie) | 0, a = a + Math.imul(w, re) | 0, r = r + Math.imul(v, ae) | 0, n = (n = n + Math.imul(v, se) | 0) + Math.imul(y, ae) | 0, a = a + Math.imul(y, se) | 0, r = r + Math.imul(p, ue) | 0, n = (n = n + Math.imul(p, le) | 0) + Math.imul(m, ue) | 0, a = a + Math.imul(m, le) | 0; var Se = (l + (r = r + Math.imul(c, ce) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, he) | 0) + Math.imul(h, ce) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, he) | 0) + (n >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, r = Math .imul(B, H), n = (n = Math.imul(B, G)) + Math.imul(F, H) | 0, a = Math.imul(F, G), r = r + Math .imul(P, W) | 0, n = (n = n + Math.imul(P, q) | 0) + Math.imul(U, W) | 0, a = a + Math.imul(U, q) | 0, r = r + Math.imul(I, z) | 0, n = (n = n + Math.imul(I, K) | 0) + Math.imul(L, z) | 0, a = a + Math.imul(L, K) | 0, r = r + Math.imul(O, Q) | 0, n = (n = n + Math.imul(O, J) | 0) + Math.imul(C, Q) | 0, a = a + Math.imul(C, J) | 0, r = r + Math.imul(k, $) | 0, n = (n = n + Math .imul(k, ee) | 0) + Math.imul(R, $) | 0, a = a + Math.imul(R, ee) | 0, r = r + Math.imul(T, ie) | 0, n = (n = n + Math.imul(T, re) | 0) + Math.imul(S, ie) | 0, a = a + Math.imul(S, re) | 0, r = r + Math.imul(b, ae) | 0, n = (n = n + Math.imul(b, se) | 0) + Math.imul(w, ae) | 0, a = a + Math.imul(w, se) | 0, r = r + Math.imul(v, ue) | 0, n = (n = n + Math.imul(v, le) | 0) + Math.imul(y, ue) | 0, a = a + Math.imul(y, le) | 0, r = r + Math.imul(p, ce) | 0, n = (n = n + Math.imul(p, he) | 0) + Math.imul(m, ce) | 0, a = a + Math.imul(m, he) | 0; var Ae = (l + (r = r + Math.imul(c, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, me) | 0) + Math.imul(h, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(h, me) | 0) + (n >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, r = Math .imul(B, W), n = (n = Math.imul(B, q)) + Math.imul(F, W) | 0, a = Math.imul(F, q), r = r + Math .imul(P, z) | 0, n = (n = n + Math.imul(P, K) | 0) + Math.imul(U, z) | 0, a = a + Math.imul(U, K) | 0, r = r + Math.imul(I, Q) | 0, n = (n = n + Math.imul(I, J) | 0) + Math.imul(L, Q) | 0, a = a + Math.imul(L, J) | 0, r = r + Math.imul(O, $) | 0, n = (n = n + Math.imul(O, ee) | 0) + Math.imul(C, $) | 0, a = a + Math.imul(C, ee) | 0, r = r + Math.imul(k, ie) | 0, n = (n = n + Math.imul(k, re) | 0) + Math.imul(R, ie) | 0, a = a + Math.imul(R, re) | 0, r = r + Math.imul( T, ae) | 0, n = (n = n + Math.imul(T, se) | 0) + Math.imul(S, ae) | 0, a = a + Math.imul(S, se) | 0, r = r + Math.imul(b, ue) | 0, n = (n = n + Math.imul(b, le) | 0) + Math.imul(w, ue) | 0, a = a + Math.imul(w, le) | 0, r = r + Math.imul(v, ce) | 0, n = (n = n + Math.imul(v, he) | 0) + Math.imul(y, ce) | 0, a = a + Math.imul(y, he) | 0; var ke = (l + (r = r + Math.imul(p, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(p, me) | 0) + Math.imul(m, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(m, me) | 0) + (n >>> 13) | 0) + (ke >>> 26) | 0, ke &= 67108863, r = Math .imul(B, z), n = (n = Math.imul(B, K)) + Math.imul(F, z) | 0, a = Math.imul(F, K), r = r + Math .imul(P, Q) | 0, n = (n = n + Math.imul(P, J) | 0) + Math.imul(U, Q) | 0, a = a + Math.imul(U, J) | 0, r = r + Math.imul(I, $) | 0, n = (n = n + Math.imul(I, ee) | 0) + Math.imul(L, $) | 0, a = a + Math.imul(L, ee) | 0, r = r + Math.imul(O, ie) | 0, n = (n = n + Math.imul(O, re) | 0) + Math.imul(C, ie) | 0, a = a + Math.imul(C, re) | 0, r = r + Math.imul(k, ae) | 0, n = (n = n + Math.imul(k, se) | 0) + Math.imul(R, ae) | 0, a = a + Math.imul(R, se) | 0, r = r + Math.imul( T, ue) | 0, n = (n = n + Math.imul(T, le) | 0) + Math.imul(S, ue) | 0, a = a + Math.imul(S, le) | 0, r = r + Math.imul(b, ce) | 0, n = (n = n + Math.imul(b, he) | 0) + Math.imul(w, ce) | 0, a = a + Math.imul(w, he) | 0; var Re = (l + (r = r + Math.imul(v, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(v, me) | 0) + Math.imul(y, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(y, me) | 0) + (n >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, r = Math .imul(B, Q), n = (n = Math.imul(B, J)) + Math.imul(F, Q) | 0, a = Math.imul(F, J), r = r + Math .imul(P, $) | 0, n = (n = n + Math.imul(P, ee) | 0) + Math.imul(U, $) | 0, a = a + Math.imul(U, ee) | 0, r = r + Math.imul(I, ie) | 0, n = (n = n + Math.imul(I, re) | 0) + Math.imul(L, ie) | 0, a = a + Math.imul(L, re) | 0, r = r + Math.imul(O, ae) | 0, n = (n = n + Math.imul(O, se) | 0) + Math.imul(C, ae) | 0, a = a + Math.imul(C, se) | 0, r = r + Math.imul(k, ue) | 0, n = ( n = n + Math.imul(k, le) | 0) + Math.imul(R, ue) | 0, a = a + Math.imul(R, le) | 0, r = r + Math.imul(T, ce) | 0, n = (n = n + Math.imul(T, he) | 0) + Math.imul(S, ce) | 0, a = a + Math .imul(S, he) | 0; var Me = (l + (r = r + Math.imul(b, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(b, me) | 0) + Math.imul(w, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(w, me) | 0) + (n >>> 13) | 0) + (Me >>> 26) | 0, Me &= 67108863, r = Math .imul(B, $), n = (n = Math.imul(B, ee)) + Math.imul(F, $) | 0, a = Math.imul(F, ee), r = r + Math.imul(P, ie) | 0, n = (n = n + Math.imul(P, re) | 0) + Math.imul(U, ie) | 0, a = a + Math .imul(U, re) | 0, r = r + Math.imul(I, ae) | 0, n = (n = n + Math.imul(I, se) | 0) + Math.imul( L, ae) | 0, a = a + Math.imul(L, se) | 0, r = r + Math.imul(O, ue) | 0, n = (n = n + Math .imul(O, le) | 0) + Math.imul(C, ue) | 0, a = a + Math.imul(C, le) | 0, r = r + Math.imul(k, ce) | 0, n = (n = n + Math.imul(k, he) | 0) + Math.imul(R, ce) | 0, a = a + Math.imul(R, he) | 0; var Oe = (l + (r = r + Math.imul(T, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(T, me) | 0) + Math.imul(S, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(S, me) | 0) + (n >>> 13) | 0) + (Oe >>> 26) | 0, Oe &= 67108863, r = Math .imul(B, ie), n = (n = Math.imul(B, re)) + Math.imul(F, ie) | 0, a = Math.imul(F, re), r = r + Math.imul(P, ae) | 0, n = (n = n + Math.imul(P, se) | 0) + Math.imul(U, ae) | 0, a = a + Math .imul(U, se) | 0, r = r + Math.imul(I, ue) | 0, n = (n = n + Math.imul(I, le) | 0) + Math.imul( L, ue) | 0, a = a + Math.imul(L, le) | 0, r = r + Math.imul(O, ce) | 0, n = (n = n + Math .imul(O, he) | 0) + Math.imul(C, ce) | 0, a = a + Math.imul(C, he) | 0; var Ce = (l + (r = r + Math.imul(k, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(k, me) | 0) + Math.imul(R, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(R, me) | 0) + (n >>> 13) | 0) + (Ce >>> 26) | 0, Ce &= 67108863, r = Math .imul(B, ae), n = (n = Math.imul(B, se)) + Math.imul(F, ae) | 0, a = Math.imul(F, se), r = r + Math.imul(P, ue) | 0, n = (n = n + Math.imul(P, le) | 0) + Math.imul(U, ue) | 0, a = a + Math .imul(U, le) | 0, r = r + Math.imul(I, ce) | 0, n = (n = n + Math.imul(I, he) | 0) + Math.imul( L, ce) | 0, a = a + Math.imul(L, he) | 0; var De = (l + (r = r + Math.imul(O, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(O, me) | 0) + Math.imul(C, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(C, me) | 0) + (n >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, r = Math .imul(B, ue), n = (n = Math.imul(B, le)) + Math.imul(F, ue) | 0, a = Math.imul(F, le), r = r + Math.imul(P, ce) | 0, n = (n = n + Math.imul(P, he) | 0) + Math.imul(U, ce) | 0, a = a + Math .imul(U, he) | 0; var Ie = (l + (r = r + Math.imul(I, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(I, me) | 0) + Math.imul(L, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(L, me) | 0) + (n >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, r = Math .imul(B, ce), n = (n = Math.imul(B, he)) + Math.imul(F, ce) | 0, a = Math.imul(F, he); var Le = (l + (r = r + Math.imul(P, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(P, me) | 0) + Math.imul(U, pe) | 0)) << 13) | 0; l = ((a = a + Math.imul(U, me) | 0) + (n >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863; var xe = (l + (r = Math.imul(B, pe)) | 0) + ((8191 & (n = (n = Math.imul(B, me)) + Math.imul(F, pe) | 0)) << 13) | 0; return l = ((a = Math.imul(F, me)) + (n >>> 13) | 0) + (xe >>> 26) | 0, xe &= 67108863, u[0] = ge, u[1] = ve, u[2] = ye, u[3] = _e, u[4] = be, u[5] = we, u[6] = Ee, u[7] = Te, u[8] = Se, u[9] = Ae, u[10] = ke, u[11] = Re, u[12] = Me, u[13] = Oe, u[14] = Ce, u[15] = De, u[16] = Ie, u[17] = Le, u[18] = xe, 0 !== l && (u[19] = l, i.length++), i }; function v(e, t, i) { i.negative = t.negative ^ e.negative, i.length = e.length + t.length; for (var r = 0, n = 0, a = 0; a < i.length - 1; a++) { var s = n; n = 0; for (var o = 67108863 & r, u = Math.min(a, t.length - 1), l = Math.max(0, a - e.length + 1); l <= u; l++) { var d = a - l, c = (0 | e.words[d]) * (0 | t.words[l]), h = 67108863 & c; o = 67108863 & (h = h + o | 0), n += (s = (s = s + (c / 67108864 | 0) | 0) + (h >>> 26) | 0) >>> 26, s &= 67108863 } i.words[a] = o, r = s, s = n } return 0 !== r ? i.words[a] = r : i.length--, i._strip() } function y(e, t, i) { return v(e, t, i) } function _(e, t) { this.x = e, this.y = t } Math.imul || (g = m), a.prototype.mulTo = function(e, t) { var i = this.length + e.length; return 10 === this.length && 10 === e.length ? g(this, e, t) : i < 63 ? m(this, e, t) : i < 1024 ? v(this, e, t) : y(this, e, t) }, _.prototype.makeRBT = function(e) { for (var t = new Array(e), i = a.prototype._countBits(e) - 1, r = 0; r < e; r++) t[r] = this .revBin(r, i, e); return t }, _.prototype.revBin = function(e, t, i) { if (0 === e || e === i - 1) return e; for (var r = 0, n = 0; n < t; n++) r |= (1 & e) << t - n - 1, e >>= 1; return r }, _.prototype.permute = function(e, t, i, r, n, a) { for (var s = 0; s < a; s++) r[s] = t[e[s]], n[s] = i[e[s]] }, _.prototype.transform = function(e, t, i, r, n, a) { this.permute(a, e, t, i, r, n); for (var s = 1; s < n; s <<= 1) for (var o = s << 1, u = Math.cos(2 * Math.PI / o), l = Math.sin(2 * Math.PI / o), d = 0; d < n; d += o) for (var c = u, h = l, f = 0; f < s; f++) { var p = i[d + f], m = r[d + f], g = i[d + f + s], v = r[d + f + s], y = c * g - h * v; v = c * v + h * g, g = y, i[d + f] = p + g, r[d + f] = m + v, i[d + f + s] = p - g, r[d + f + s] = m - v, f !== o && (y = u * c - l * h, h = u * h + l * c, c = y) } }, _.prototype.guessLen13b = function(e, t) { var i = 1 | Math.max(t, e), r = 1 & i, n = 0; for (i = i / 2 | 0; i; i >>>= 1) n++; return 1 << n + 1 + r }, _.prototype.conjugate = function(e, t, i) { if (!(i <= 1)) for (var r = 0; r < i / 2; r++) { var n = e[r]; e[r] = e[i - r - 1], e[i - r - 1] = n, n = t[r], t[r] = -t[i - r - 1], t[i - r - 1] = -n } }, _.prototype.normalize13b = function(e, t) { for (var i = 0, r = 0; r < t / 2; r++) { var n = 8192 * Math.round(e[2 * r + 1] / t) + Math.round(e[2 * r] / t) + i; e[r] = 67108863 & n, i = n < 67108864 ? 0 : n / 67108864 | 0 } return e }, _.prototype.convert13b = function(e, t, i, n) { for (var a = 0, s = 0; s < t; s++) a += 0 | e[s], i[2 * s] = 8191 & a, a >>>= 13, i[2 * s + 1] = 8191 & a, a >>>= 13; for (s = 2 * t; s < n; ++s) i[s] = 0; r(0 === a), r(0 == (-8192 & a)) }, _.prototype.stub = function(e) { for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0; return t }, _.prototype.mulp = function(e, t, i) { var r = 2 * this.guessLen13b(e.length, t.length), n = this.makeRBT(r), a = this.stub(r), s = new Array(r), o = new Array(r), u = new Array(r), l = new Array(r), d = new Array(r), c = new Array(r), h = i.words; h.length = r, this.convert13b(e.words, e.length, s, r), this.convert13b(t.words, t.length, l, r), this.transform(s, a, o, u, r, n), this.transform(l, a, d, c, r, n); for (var f = 0; f < r; f++) { var p = o[f] * d[f] - u[f] * c[f]; u[f] = o[f] * c[f] + u[f] * d[f], o[f] = p } return this.conjugate(o, u, r), this.transform(o, u, h, a, r, n), this.conjugate(h, a, r), this .normalize13b(h, r), i.negative = e.negative ^ t.negative, i.length = e.length + t.length, i ._strip() }, a.prototype.mul = function(e) { var t = new a(null); return t.words = new Array(this.length + e.length), this.mulTo(e, t) }, a.prototype.mulf = function(e) { var t = new a(null); return t.words = new Array(this.length + e.length), y(this, e, t) }, a.prototype.imul = function(e) { return this.clone().mulTo(e, this) }, a.prototype.imuln = function(e) { var t = e < 0; t && (e = -e), r("number" == typeof e), r(e < 67108864); for (var i = 0, n = 0; n < this.length; n++) { var a = (0 | this.words[n]) * e, s = (67108863 & a) + (67108863 & i); i >>= 26, i += a / 67108864 | 0, i += s >>> 26, this.words[n] = 67108863 & s } return 0 !== i && (this.words[n] = i, this.length++), t ? this.ineg() : this }, a.prototype.muln = function(e) { return this.clone().imuln(e) }, a.prototype.sqr = function() { return this.mul(this) }, a.prototype.isqr = function() { return this.imul(this.clone()) }, a.prototype.pow = function(e) { var t = function(e) { for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) { var r = i / 26 | 0, n = i % 26; t[i] = e.words[r] >>> n & 1 } return t }(e); if (0 === t.length) return new a(1); for (var i = this, r = 0; r < t.length && 0 === t[r]; r++, i = i.sqr()); if (++r < t.length) for (var n = i.sqr(); r < t.length; r++, n = n.sqr()) 0 !== t[r] && (i = i.mul(n)); return i }, a.prototype.iushln = function(e) { r("number" == typeof e && e >= 0); var t, i = e % 26, n = (e - i) / 26, a = 67108863 >>> 26 - i << 26 - i; if (0 !== i) { var s = 0; for (t = 0; t < this.length; t++) { var o = this.words[t] & a, u = (0 | this.words[t]) - o << i; this.words[t] = u | s, s = o >>> 26 - i } s && (this.words[t] = s, this.length++) } if (0 !== n) { for (t = this.length - 1; t >= 0; t--) this.words[t + n] = this.words[t]; for (t = 0; t < n; t++) this.words[t] = 0; this.length += n } return this._strip() }, a.prototype.ishln = function(e) { return r(0 === this.negative), this.iushln(e) }, a.prototype.iushrn = function(e, t, i) { var n; r("number" == typeof e && e >= 0), n = t ? (t - t % 26) / 26 : 0; var a = e % 26, s = Math.min((e - a) / 26, this.length), o = 67108863 ^ 67108863 >>> a << a, u = i; if (n -= s, n = Math.max(0, n), u) { for (var l = 0; l < s; l++) u.words[l] = this.words[l]; u.length = s } if (0 === s); else if (this.length > s) for (this.length -= s, l = 0; l < this.length; l++) this.words[l] = this.words[l + s]; else this.words[0] = 0, this.length = 1; var d = 0; for (l = this.length - 1; l >= 0 && (0 !== d || l >= n); l--) { var c = 0 | this.words[l]; this.words[l] = d << 26 - a | c >>> a, d = c & o } return u && 0 !== d && (u.words[u.length++] = d), 0 === this.length && (this.words[0] = 0, this .length = 1), this._strip() }, a.prototype.ishrn = function(e, t, i) { return r(0 === this.negative), this.iushrn(e, t, i) }, a.prototype.shln = function(e) { return this.clone().ishln(e) }, a.prototype.ushln = function(e) { return this.clone().iushln(e) }, a.prototype.shrn = function(e) { return this.clone().ishrn(e) }, a.prototype.ushrn = function(e) { return this.clone().iushrn(e) }, a.prototype.testn = function(e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26, n = 1 << t; return !(this.length <= i || !(this.words[i] & n)) }, a.prototype.imaskn = function(e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26; if (r(0 === this.negative, "imaskn works only with positive numbers"), this.length <= i) return this; if (0 !== t && i++, this.length = Math.min(i, this.length), 0 !== t) { var n = 67108863 ^ 67108863 >>> t << t; this.words[this.length - 1] &= n } return this._strip() }, a.prototype.maskn = function(e) { return this.clone().imaskn(e) }, a.prototype.iaddn = function(e) { return r("number" == typeof e), r(e < 67108864), e < 0 ? this.isubn(-e) : 0 !== this.negative ? 1 === this.length && (0 | this.words[0]) <= e ? (this.words[0] = e - (0 | this.words[0]), this .negative = 0, this) : (this.negative = 0, this.isubn(e), this.negative = 1, this) : this ._iaddn(e) }, a.prototype._iaddn = function(e) { this.words[0] += e; for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) this.words[t] -= 67108864, t === this.length - 1 ? this.words[t + 1] = 1 : this.words[t + 1]++; return this.length = Math.max(this.length, t + 1), this }, a.prototype.isubn = function(e) { if (r("number" == typeof e), r(e < 67108864), e < 0) return this.iaddn(-e); if (0 !== this.negative) return this.negative = 0, this.iaddn(e), this.negative = 1, this; if (this.words[0] -= e, 1 === this.length && this.words[0] < 0) this.words[0] = -this.words[0], this.negative = 1; else for (var t = 0; t < this.length && this.words[t] < 0; t++) this.words[t] += 67108864, this .words[t + 1] -= 1; return this._strip() }, a.prototype.addn = function(e) { return this.clone().iaddn(e) }, a.prototype.subn = function(e) { return this.clone().isubn(e) }, a.prototype.iabs = function() { return this.negative = 0, this }, a.prototype.abs = function() { return this.clone().iabs() }, a.prototype._ishlnsubmul = function(e, t, i) { var n, a, s = e.length + i; this._expand(s); var o = 0; for (n = 0; n < e.length; n++) { a = (0 | this.words[n + i]) + o; var u = (0 | e.words[n]) * t; o = ((a -= 67108863 & u) >> 26) - (u / 67108864 | 0), this.words[n + i] = 67108863 & a } for (; n < this.length - i; n++) o = (a = (0 | this.words[n + i]) + o) >> 26, this.words[n + i] = 67108863 & a; if (0 === o) return this._strip(); for (r(-1 === o), o = 0, n = 0; n < this.length; n++) o = (a = -(0 | this.words[n]) + o) >> 26, this.words[n] = 67108863 & a; return this.negative = 1, this._strip() }, a.prototype._wordDiv = function(e, t) { var i = (this.length, e.length), r = this.clone(), n = e, s = 0 | n.words[n.length - 1]; 0 != (i = 26 - this._countBits(s)) && (n = n.ushln(i), r.iushln(i), s = 0 | n.words[n.length - 1]); var o, u = r.length - n.length; if ("mod" !== t) { (o = new a(null)).length = u + 1, o.words = new Array(o.length); for (var l = 0; l < o.length; l++) o.words[l] = 0 } var d = r.clone()._ishlnsubmul(n, 1, u); 0 === d.negative && (r = d, o && (o.words[u] = 1)); for (var c = u - 1; c >= 0; c--) { var h = 67108864 * (0 | r.words[n.length + c]) + (0 | r.words[n.length + c - 1]); for (h = Math.min(h / s | 0, 67108863), r._ishlnsubmul(n, h, c); 0 !== r.negative;) h--, r .negative = 0, r._ishlnsubmul(n, 1, c), r.isZero() || (r.negative ^= 1); o && (o.words[c] = h) } return o && o._strip(), r._strip(), "div" !== t && 0 !== i && r.iushrn(i), { div: o || null, mod: r } }, a.prototype.divmod = function(e, t, i) { return r(!e.isZero()), this.isZero() ? { div: new a(0), mod: new a(0) } : 0 !== this.negative && 0 === e.negative ? (o = this.neg().divmod(e, t), "mod" !== t && (n = o.div.neg()), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.iadd(e)), { div: n, mod: s }) : 0 === this.negative && 0 !== e.negative ? (o = this.divmod(e.neg(), t), "mod" !== t && (n = o.div.neg()), { div: n, mod: o.mod }) : 0 != (this.negative & e.negative) ? (o = this.neg().divmod(e.neg(), t), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.isub(e)), { div: o.div, mod: s }) : e.length > this.length || this.cmp(e) < 0 ? { div: new a(0), mod: this } : 1 === e.length ? "div" === t ? { div: this.divn(e.words[0]), mod: null } : "mod" === t ? { div: null, mod: new a(this.modrn(e.words[0])) } : { div: this.divn(e.words[0]), mod: new a(this.modrn(e.words[0])) } : this._wordDiv(e, t); var n, s, o }, a.prototype.div = function(e) { return this.divmod(e, "div", !1).div }, a.prototype.mod = function(e) { return this.divmod(e, "mod", !1).mod }, a.prototype.umod = function(e) { return this.divmod(e, "mod", !0).mod }, a.prototype.divRound = function(e) { var t = this.divmod(e); if (t.mod.isZero()) return t.div; var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod, r = e.ushrn(1), n = e.andln(1), a = i.cmp(r); return a < 0 || 1 === n && 0 === a ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn( 1) }, a.prototype.modrn = function(e) { var t = e < 0; t && (e = -e), r(e <= 67108863); for (var i = (1 << 26) % e, n = 0, a = this.length - 1; a >= 0; a--) n = (i * n + (0 | this.words[ a])) % e; return t ? -n : n }, a.prototype.modn = function(e) { return this.modrn(e) }, a.prototype.idivn = function(e) { var t = e < 0; t && (e = -e), r(e <= 67108863); for (var i = 0, n = this.length - 1; n >= 0; n--) { var a = (0 | this.words[n]) + 67108864 * i; this.words[n] = a / e | 0, i = a % e } return this._strip(), t ? this.ineg() : this }, a.prototype.divn = function(e) { return this.clone().idivn(e) }, a.prototype.egcd = function(e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for (var n = new a(1), s = new a(0), o = new a(0), u = new a(1), l = 0; t.isEven() && i.isEven();) t.iushrn(1), i.iushrn(1), ++l; for (var d = i.clone(), c = t.clone(); !t.isZero();) { for (var h = 0, f = 1; 0 == (t.words[0] & f) && h < 26; ++h, f <<= 1); if (h > 0) for (t.iushrn(h); h-- > 0;)(n.isOdd() || s.isOdd()) && (n.iadd(d), s.isub(c)), n.iushrn(1), s .iushrn(1); for (var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, m <<= 1); if (p > 0) for (i.iushrn(p); p-- > 0;)(o.isOdd() || u.isOdd()) && (o.iadd(d), u.isub(c)), o.iushrn(1), u .iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), n.isub(o), s.isub(u)) : (i.isub(t), o.isub(n), u.isub(s)) } return { a: o, b: u, gcd: i.iushln(l) } }, a.prototype._invmp = function(e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for (var n, s = new a(1), o = new a(0), u = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0;) { for (var l = 0, d = 1; 0 == (t.words[0] & d) && l < 26; ++l, d <<= 1); if (l > 0) for (t.iushrn(l); l-- > 0;) s.isOdd() && s.iadd(u), s.iushrn(1); for (var c = 0, h = 1; 0 == (i.words[0] & h) && c < 26; ++c, h <<= 1); if (c > 0) for (i.iushrn(c); c-- > 0;) o.isOdd() && o.iadd(u), o.iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), s.isub(o)) : (i.isub(t), o.isub(s)) } return (n = 0 === t.cmpn(1) ? s : o).cmpn(0) < 0 && n.iadd(e), n }, a.prototype.gcd = function(e) { if (this.isZero()) return e.abs(); if (e.isZero()) return this.abs(); var t = this.clone(), i = e.clone(); t.negative = 0, i.negative = 0; for (var r = 0; t.isEven() && i.isEven(); r++) t.iushrn(1), i.iushrn(1); for (;;) { for (; t.isEven();) t.iushrn(1); for (; i.isEven();) i.iushrn(1); var n = t.cmp(i); if (n < 0) { var a = t; t = i, i = a } else if (0 === n || 0 === i.cmpn(1)) break; t.isub(i) } return i.iushln(r) }, a.prototype.invm = function(e) { return this.egcd(e).a.umod(e) }, a.prototype.isEven = function() { return 0 == (1 & this.words[0]) }, a.prototype.isOdd = function() { return 1 == (1 & this.words[0]) }, a.prototype.andln = function(e) { return this.words[0] & e }, a.prototype.bincn = function(e) { r("number" == typeof e); var t = e % 26, i = (e - t) / 26, n = 1 << t; if (this.length <= i) return this._expand(i + 1), this.words[i] |= n, this; for (var a = n, s = i; 0 !== a && s < this.length; s++) { var o = 0 | this.words[s]; a = (o += a) >>> 26, o &= 67108863, this.words[s] = o } return 0 !== a && (this.words[s] = a, this.length++), this }, a.prototype.isZero = function() { return 1 === this.length && 0 === this.words[0] }, a.prototype.cmpn = function(e) { var t, i = e < 0; if (0 !== this.negative && !i) return -1; if (0 === this.negative && i) return 1; if (this._strip(), this.length > 1) t = 1; else { i && (e = -e), r(e <= 67108863, "Number is too big"); var n = 0 | this.words[0]; t = n === e ? 0 : n < e ? -1 : 1 } return 0 !== this.negative ? 0 | -t : t }, a.prototype.cmp = function(e) { if (0 !== this.negative && 0 === e.negative) return -1; if (0 === this.negative && 0 !== e.negative) return 1; var t = this.ucmp(e); return 0 !== this.negative ? 0 | -t : t }, a.prototype.ucmp = function(e) { if (this.length > e.length) return 1; if (this.length < e.length) return -1; for (var t = 0, i = this.length - 1; i >= 0; i--) { var r = 0 | this.words[i], n = 0 | e.words[i]; if (r !== n) { r < n ? t = -1 : r > n && (t = 1); break } } return t }, a.prototype.gtn = function(e) { return 1 === this.cmpn(e) }, a.prototype.gt = function(e) { return 1 === this.cmp(e) }, a.prototype.gten = function(e) { return this.cmpn(e) >= 0 }, a.prototype.gte = function(e) { return this.cmp(e) >= 0 }, a.prototype.ltn = function(e) { return -1 === this.cmpn(e) }, a.prototype.lt = function(e) { return -1 === this.cmp(e) }, a.prototype.lten = function(e) { return this.cmpn(e) <= 0 }, a.prototype.lte = function(e) { return this.cmp(e) <= 0 }, a.prototype.eqn = function(e) { return 0 === this.cmpn(e) }, a.prototype.eq = function(e) { return 0 === this.cmp(e) }, a.red = function(e) { return new k(e) }, a.prototype.toRed = function(e) { return r(!this.red, "Already a number in reduction context"), r(0 === this.negative, "red works only with positives"), e.convertTo(this)._forceRed(e) }, a.prototype.fromRed = function() { return r(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom( this) }, a.prototype._forceRed = function(e) { return this.red = e, this }, a.prototype.forceRed = function(e) { return r(!this.red, "Already a number in reduction context"), this._forceRed(e) }, a.prototype.redAdd = function(e) { return r(this.red, "redAdd works only with red numbers"), this.red.add(this, e) }, a.prototype.redIAdd = function(e) { return r(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e) }, a.prototype.redSub = function(e) { return r(this.red, "redSub works only with red numbers"), this.red.sub(this, e) }, a.prototype.redISub = function(e) { return r(this.red, "redISub works only with red numbers"), this.red.isub(this, e) }, a.prototype.redShl = function(e) { return r(this.red, "redShl works only with red numbers"), this.red.shl(this, e) }, a.prototype.redMul = function(e) { return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red .mul(this, e) }, a.prototype.redIMul = function(e) { return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red .imul(this, e) }, a.prototype.redSqr = function() { return r(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr( this) }, a.prototype.redISqr = function() { return r(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr( this) }, a.prototype.redSqrt = function() { return r(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt( this) }, a.prototype.redInvm = function() { return r(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm( this) }, a.prototype.redNeg = function() { return r(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg( this) }, a.prototype.redPow = function(e) { return r(this.red && !e.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, e) }; var b = { k256: null, p224: null, p192: null, p25519: null }; function w(e, t) { this.name = e, this.p = new a(t, 16), this.n = this.p.bitLength(), this.k = new a(1).iushln(this.n) .isub(this.p), this.tmp = this._tmp() } function E() { w.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f") } function T() { w.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001") } function S() { w.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff") } function A() { w.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed") } function k(e) { if ("string" == typeof e) { var t = a._prime(e); this.m = t.p, this.prime = t } else r(e.gtn(1), "modulus must be greater than 1"), this.m = e, this.prime = null } function R(e) { k.call(this, e), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this .shift % 26), this.r = new a(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this .rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), this.minv = this.r.sub(this.minv) } w.prototype._tmp = function() { var e = new a(null); return e.words = new Array(Math.ceil(this.n / 13)), e }, w.prototype.ireduce = function(e) { var t, i = e; do { this.split(i, this.tmp), t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength() } while (t > this.n); var r = t < this.n ? -1 : i.ucmp(this.p); return 0 === r ? (i.words[0] = 0, i.length = 1) : r > 0 ? i.isub(this.p) : void 0 !== i.strip ? i .strip() : i._strip(), i }, w.prototype.split = function(e, t) { e.iushrn(this.n, 0, t) }, w.prototype.imulK = function(e) { return e.imul(this.k) }, n(E, w), E.prototype.split = function(e, t) { for (var i = Math.min(e.length, 9), r = 0; r < i; r++) t.words[r] = e.words[r]; if (t.length = i, e.length <= 9) return e.words[0] = 0, void(e.length = 1); var n = e.words[9]; for (t.words[t.length++] = 4194303 & n, r = 10; r < e.length; r++) { var a = 0 | e.words[r]; e.words[r - 10] = (4194303 & a) << 4 | n >>> 22, n = a } n >>>= 22, e.words[r - 10] = n, 0 === n && e.length > 10 ? e.length -= 10 : e.length -= 9 }, E.prototype.imulK = function(e) { e.words[e.length] = 0, e.words[e.length + 1] = 0, e.length += 2; for (var t = 0, i = 0; i < e.length; i++) { var r = 0 | e.words[i]; t += 977 * r, e.words[i] = 67108863 & t, t = 64 * r + (t / 67108864 | 0) } return 0 === e.words[e.length - 1] && (e.length--, 0 === e.words[e.length - 1] && e.length--), e }, n(T, w), n(S, w), n(A, w), A.prototype.imulK = function(e) { for (var t = 0, i = 0; i < e.length; i++) { var r = 19 * (0 | e.words[i]) + t, n = 67108863 & r; r >>>= 26, e.words[i] = n, t = r } return 0 !== t && (e.words[e.length++] = t), e }, a._prime = function(e) { if (b[e]) return b[e]; var t; if ("k256" === e) t = new E; else if ("p224" === e) t = new T; else if ("p192" === e) t = new S; else { if ("p25519" !== e) throw new Error("Unknown prime " + e); t = new A } return b[e] = t, t }, k.prototype._verify1 = function(e) { r(0 === e.negative, "red works only with positives"), r(e.red, "red works only with red numbers") }, k.prototype._verify2 = function(e, t) { r(0 == (e.negative | t.negative), "red works only with positives"), r(e.red && e.red === t.red, "red works only with red numbers") }, k.prototype.imod = function(e) { return this.prime ? this.prime.ireduce(e)._forceRed(this) : (d(e, e.umod(this.m)._forceRed(this)), e) }, k.prototype.neg = function(e) { return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this) }, k.prototype.add = function(e, t) { this._verify2(e, t); var i = e.add(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this) }, k.prototype.iadd = function(e, t) { this._verify2(e, t); var i = e.iadd(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i }, k.prototype.sub = function(e, t) { this._verify2(e, t); var i = e.sub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this) }, k.prototype.isub = function(e, t) { this._verify2(e, t); var i = e.isub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i }, k.prototype.shl = function(e, t) { return this._verify1(e), this.imod(e.ushln(t)) }, k.prototype.imul = function(e, t) { return this._verify2(e, t), this.imod(e.imul(t)) }, k.prototype.mul = function(e, t) { return this._verify2(e, t), this.imod(e.mul(t)) }, k.prototype.isqr = function(e) { return this.imul(e, e.clone()) }, k.prototype.sqr = function(e) { return this.mul(e, e) }, k.prototype.sqrt = function(e) { if (e.isZero()) return e.clone(); var t = this.m.andln(3); if (r(t % 2 == 1), 3 === t) { var i = this.m.add(new a(1)).iushrn(2); return this.pow(e, i) } for (var n = this.m.subn(1), s = 0; !n.isZero() && 0 === n.andln(1);) s++, n.iushrn(1); r(!n.isZero()); var o = new a(1).toRed(this), u = o.redNeg(), l = this.m.subn(1).iushrn(1), d = this.m.bitLength(); for (d = new a(2 * d * d).toRed(this); 0 !== this.pow(d, l).cmp(u);) d.redIAdd(u); for (var c = this.pow(d, n), h = this.pow(e, n.addn(1).iushrn(1)), f = this.pow(e, n), p = s; 0 !== f.cmp(o);) { for (var m = f, g = 0; 0 !== m.cmp(o); g++) m = m.redSqr(); r(g < p); var v = this.pow(c, new a(1).iushln(p - g - 1)); h = h.redMul(v), c = v.redSqr(), f = f.redMul(c), p = g } return h }, k.prototype.invm = function(e) { var t = e._invmp(this.m); return 0 !== t.negative ? (t.negative = 0, this.imod(t).redNeg()) : this.imod(t) }, k.prototype.pow = function(e, t) { if (t.isZero()) return new a(1).toRed(this); if (0 === t.cmpn(1)) return e.clone(); var i = new Array(16); i[0] = new a(1).toRed(this), i[1] = e; for (var r = 2; r < i.length; r++) i[r] = this.mul(i[r - 1], e); var n = i[0], s = 0, o = 0, u = t.bitLength() % 26; for (0 === u && (u = 26), r = t.length - 1; r >= 0; r--) { for (var l = t.words[r], d = u - 1; d >= 0; d--) { var c = l >> d & 1; n !== i[0] && (n = this.sqr(n)), 0 !== c || 0 !== s ? (s <<= 1, s |= c, (4 == ++o || 0 === r && 0 === d) && (n = this.mul(n, i[s]), o = 0, s = 0)) : o = 0 } u = 26 } return n }, k.prototype.convertTo = function(e) { var t = e.umod(this.m); return t === e ? t.clone() : t }, k.prototype.convertFrom = function(e) { var t = e.clone(); return t.red = null, t }, a.mont = function(e) { return new R(e) }, n(R, k), R.prototype.convertTo = function(e) { return this.imod(e.ushln(this.shift)) }, R.prototype.convertFrom = function(e) { var t = this.imod(e.mul(this.rinv)); return t.red = null, t }, R.prototype.imul = function(e, t) { if (e.isZero() || t.isZero()) return e.words[0] = 0, e.length = 1, e; var i = e.imul(t), r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), n = i.isub(r).iushrn(this.shift), a = n; return n.cmp(this.m) >= 0 ? a = n.isub(this.m) : n.cmpn(0) < 0 && (a = n.iadd(this.m)), a ._forceRed(this) }, R.prototype.mul = function(e, t) { if (e.isZero() || t.isZero()) return new a(0)._forceRed(this); var i = e.mul(t), r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), n = i.isub(r).iushrn(this.shift), s = n; return n.cmp(this.m) >= 0 ? s = n.isub(this.m) : n.cmpn(0) < 0 && (s = n.iadd(this.m)), s ._forceRed(this) }, R.prototype.invm = function(e) { return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this) } }(e, this) }).call(this, i(55)(e)) }, function(e, t) {}, function(e) { e.exports = JSON.parse( '{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}' ) }, function(e, t, i) { "use strict"; var r = i(15), n = i(11), a = i(5), s = i(41), o = r.assert; function u(e) { s.call(this, "short", e), this.a = new n(e.a, 16).toRed(this.red), this.b = new n(e.b, 16).toRed(this .red), this.tinv = this.two.redInvm(), this.zeroA = 0 === this.a.fromRed().cmpn(0), this.threeA = 0 === this.a.fromRed().sub(this.p).cmpn(-3), this.endo = this._getEndomorphism(e), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4) } function l(e, t, i, r) { s.BasePoint.call(this, e, "affine"), null === t && null === i ? (this.x = null, this.y = null, this .inf = !0) : (this.x = new n(t, 16), this.y = new n(i, 16), r && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y .red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1) } function d(e, t, i, r) { s.BasePoint.call(this, e, "jacobian"), null === t && null === i && null === r ? (this.x = this.curve.one, this.y = this.curve.one, this.z = new n(0)) : (this.x = new n(t, 16), this.y = new n(i, 16), this.z = new n(r, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y .toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z === this.curve.one } a(u, s), e.exports = u, u.prototype._getEndomorphism = function(e) { if (this.zeroA && this.g && this.n && 1 === this.p.modn(3)) { var t, i; if (e.beta) t = new n(e.beta, 16).toRed(this.red); else { var r = this._getEndoRoots(this.p); t = (t = r[0].cmp(r[1]) < 0 ? r[0] : r[1]).toRed(this.red) } if (e.lambda) i = new n(e.lambda, 16); else { var a = this._getEndoRoots(this.n); 0 === this.g.mul(a[0]).x.cmp(this.g.x.redMul(t)) ? i = a[0] : (i = a[1], o(0 === this.g.mul(i).x .cmp(this.g.x.redMul(t)))) } return { beta: t, lambda: i, basis: e.basis ? e.basis.map(function(e) { return { a: new n(e.a, 16), b: new n(e.b, 16) } }) : this._getEndoBasis(i) } } }, u.prototype._getEndoRoots = function(e) { var t = e === this.p ? this.red : n.mont(e), i = new n(2).toRed(t).redInvm(), r = i.redNeg(), a = new n(3).toRed(t).redNeg().redSqrt().redMul(i); return [r.redAdd(a).fromRed(), r.redSub(a).fromRed()] }, u.prototype._getEndoBasis = function(e) { for (var t, i, r, a, s, o, u, l, d, c = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), h = e, f = this.n.clone(), p = new n(1), m = new n(0), g = new n(0), v = new n(1), y = 0; 0 !== h.cmpn(0);) { var _ = f.div(h); l = f.sub(_.mul(h)), d = g.sub(_.mul(p)); var b = v.sub(_.mul(m)); if (!r && l.cmp(c) < 0) t = u.neg(), i = p, r = l.neg(), a = d; else if (r && 2 == ++y) break; u = l, f = h, h = l, g = p, p = d, v = m, m = b } s = l.neg(), o = d; var w = r.sqr().add(a.sqr()); return s.sqr().add(o.sqr()).cmp(w) >= 0 && (s = t, o = i), r.negative && (r = r.neg(), a = a.neg()), s .negative && (s = s.neg(), o = o.neg()), [{ a: r, b: a }, { a: s, b: o }] }, u.prototype._endoSplit = function(e) { var t = this.endo.basis, i = t[0], r = t[1], n = r.b.mul(e).divRound(this.n), a = i.b.neg().mul(e).divRound(this.n), s = n.mul(i.a), o = a.mul(r.a), u = n.mul(i.b), l = a.mul(r.b); return { k1: e.sub(s).sub(o), k2: u.add(l).neg() } }, u.prototype.pointFromX = function(e, t) { (e = new n(e, 16)).red || (e = e.toRed(this.red)); var i = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), r = i.redSqrt(); if (0 !== r.redSqr().redSub(i).cmp(this.zero)) throw new Error("invalid point"); var a = r.fromRed().isOdd(); return (t && !a || !t && a) && (r = r.redNeg()), this.point(e, r) }, u.prototype.validate = function(e) { if (e.inf) return !0; var t = e.x, i = e.y, r = this.a.redMul(t), n = t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b); return 0 === i.redSqr().redISub(n).cmpn(0) }, u.prototype._endoWnafMulAdd = function(e, t, i) { for (var r = this._endoWnafT1, n = this._endoWnafT2, a = 0; a < e.length; a++) { var s = this._endoSplit(t[a]), o = e[a], u = o._getBeta(); s.k1.negative && (s.k1.ineg(), o = o.neg(!0)), s.k2.negative && (s.k2.ineg(), u = u.neg(!0)), r[2 * a] = o, r[2 * a + 1] = u, n[2 * a] = s.k1, n[2 * a + 1] = s.k2 } for (var l = this._wnafMulAdd(1, r, n, 2 * a, i), d = 0; d < 2 * a; d++) r[d] = null, n[d] = null; return l }, a(l, s.BasePoint), u.prototype.point = function(e, t, i) { return new l(this, e, t, i) }, u.prototype.pointFromJSON = function(e, t) { return l.fromJSON(this, e, t) }, l.prototype._getBeta = function() { if (this.curve.endo) { var e = this.precomputed; if (e && e.beta) return e.beta; var t = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); if (e) { var i = this.curve, r = function(e) { return i.point(e.x.redMul(i.endo.beta), e.y) }; e.beta = t, t.precomputed = { beta: null, naf: e.naf && { wnd: e.naf.wnd, points: e.naf.points.map(r) }, doubles: e.doubles && { step: e.doubles.step, points: e.doubles.points.map(r) } } } return t } }, l.prototype.toJSON = function() { return this.precomputed ? [this.x, this.y, this.precomputed && { doubles: this.precomputed.doubles && { step: this.precomputed.doubles.step, points: this.precomputed.doubles.points.slice(1) }, naf: this.precomputed.naf && { wnd: this.precomputed.naf.wnd, points: this.precomputed.naf.points.slice(1) } }] : [this.x, this.y] }, l.fromJSON = function(e, t, i) { "string" == typeof t && (t = JSON.parse(t)); var r = e.point(t[0], t[1], i); if (!t[2]) return r; function n(t) { return e.point(t[0], t[1], i) } var a = t[2]; return r.precomputed = { beta: null, doubles: a.doubles && { step: a.doubles.step, points: [r].concat(a.doubles.points.map(n)) }, naf: a.naf && { wnd: a.naf.wnd, points: [r].concat(a.naf.points.map(n)) } }, r }, l.prototype.inspect = function() { return this.isInfinity() ? "" : "" }, l.prototype.isInfinity = function() { return this.inf }, l.prototype.add = function(e) { if (this.inf) return e; if (e.inf) return this; if (this.eq(e)) return this.dbl(); if (this.neg().eq(e)) return this.curve.point(null, null); if (0 === this.x.cmp(e.x)) return this.curve.point(null, null); var t = this.y.redSub(e.y); 0 !== t.cmpn(0) && (t = t.redMul(this.x.redSub(e.x).redInvm())); var i = t.redSqr().redISub(this.x).redISub(e.x), r = t.redMul(this.x.redSub(i)).redISub(this.y); return this.curve.point(i, r) }, l.prototype.dbl = function() { if (this.inf) return this; var e = this.y.redAdd(this.y); if (0 === e.cmpn(0)) return this.curve.point(null, null); var t = this.curve.a, i = this.x.redSqr(), r = e.redInvm(), n = i.redAdd(i).redIAdd(i).redIAdd(t).redMul(r), a = n.redSqr().redISub(this.x.redAdd(this.x)), s = n.redMul(this.x.redSub(a)).redISub(this.y); return this.curve.point(a, s) }, l.prototype.getX = function() { return this.x.fromRed() }, l.prototype.getY = function() { return this.y.fromRed() }, l.prototype.mul = function(e) { return e = new n(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e) }, l.prototype.mulAdd = function(e, t, i) { var r = [this, t], n = [e, i]; return this.curve.endo ? this.curve._endoWnafMulAdd(r, n) : this.curve._wnafMulAdd(1, r, n, 2) }, l.prototype.jmulAdd = function(e, t, i) { var r = [this, t], n = [e, i]; return this.curve.endo ? this.curve._endoWnafMulAdd(r, n, !0) : this.curve._wnafMulAdd(1, r, n, 2, !0) }, l.prototype.eq = function(e) { return this === e || this.inf === e.inf && (this.inf || 0 === this.x.cmp(e.x) && 0 === this.y.cmp(e.y)) }, l.prototype.neg = function(e) { if (this.inf) return this; var t = this.curve.point(this.x, this.y.redNeg()); if (e && this.precomputed) { var i = this.precomputed, r = function(e) { return e.neg() }; t.precomputed = { naf: i.naf && { wnd: i.naf.wnd, points: i.naf.points.map(r) }, doubles: i.doubles && { step: i.doubles.step, points: i.doubles.points.map(r) } } } return t }, l.prototype.toJ = function() { return this.inf ? this.curve.jpoint(null, null, null) : this.curve.jpoint(this.x, this.y, this.curve .one) }, a(d, s.BasePoint), u.prototype.jpoint = function(e, t, i) { return new d(this, e, t, i) }, d.prototype.toP = function() { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), t = e.redSqr(), i = this.x.redMul(t), r = this.y.redMul(t).redMul(e); return this.curve.point(i, r) }, d.prototype.neg = function() { return this.curve.jpoint(this.x, this.y.redNeg(), this.z) }, d.prototype.add = function(e) { if (this.isInfinity()) return e; if (e.isInfinity()) return this; var t = e.z.redSqr(), i = this.z.redSqr(), r = this.x.redMul(t), n = e.x.redMul(i), a = this.y.redMul(t.redMul(e.z)), s = e.y.redMul(i.redMul(this.z)), o = r.redSub(n), u = a.redSub(s); if (0 === o.cmpn(0)) return 0 !== u.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl(); var l = o.redSqr(), d = l.redMul(o), c = r.redMul(l), h = u.redSqr().redIAdd(d).redISub(c).redISub(c), f = u.redMul(c.redISub(h)).redISub(a.redMul(d)), p = this.z.redMul(e.z).redMul(o); return this.curve.jpoint(h, f, p) }, d.prototype.mixedAdd = function(e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) return this; var t = this.z.redSqr(), i = this.x, r = e.x.redMul(t), n = this.y, a = e.y.redMul(t).redMul(this.z), s = i.redSub(r), o = n.redSub(a); if (0 === s.cmpn(0)) return 0 !== o.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl(); var u = s.redSqr(), l = u.redMul(s), d = i.redMul(u), c = o.redSqr().redIAdd(l).redISub(d).redISub(d), h = o.redMul(d.redISub(c)).redISub(n.redMul(l)), f = this.z.redMul(s); return this.curve.jpoint(c, h, f) }, d.prototype.dblp = function(e) { if (0 === e) return this; if (this.isInfinity()) return this; if (!e) return this.dbl(); var t; if (this.curve.zeroA || this.curve.threeA) { var i = this; for (t = 0; t < e; t++) i = i.dbl(); return i } var r = this.curve.a, n = this.curve.tinv, a = this.x, s = this.y, o = this.z, u = o.redSqr().redSqr(), l = s.redAdd(s); for (t = 0; t < e; t++) { var d = a.redSqr(), c = l.redSqr(), h = c.redSqr(), f = d.redAdd(d).redIAdd(d).redIAdd(r.redMul(u)), p = a.redMul(c), m = f.redSqr().redISub(p.redAdd(p)), g = p.redISub(m), v = f.redMul(g); v = v.redIAdd(v).redISub(h); var y = l.redMul(o); t + 1 < e && (u = u.redMul(h)), a = m, o = y, l = v } return this.curve.jpoint(a, l.redMul(n), o) }, d.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this ._threeDbl() : this._dbl() }, d.prototype._zeroDbl = function() { var e, t, i; if (this.zOne) { var r = this.x.redSqr(), n = this.y.redSqr(), a = n.redSqr(), s = this.x.redAdd(n).redSqr().redISub(r).redISub(a); s = s.redIAdd(s); var o = r.redAdd(r).redIAdd(r), u = o.redSqr().redISub(s).redISub(s), l = a.redIAdd(a); l = (l = l.redIAdd(l)).redIAdd(l), e = u, t = o.redMul(s.redISub(u)).redISub(l), i = this.y.redAdd( this.y) } else { var d = this.x.redSqr(), c = this.y.redSqr(), h = c.redSqr(), f = this.x.redAdd(c).redSqr().redISub(d).redISub(h); f = f.redIAdd(f); var p = d.redAdd(d).redIAdd(d), m = p.redSqr(), g = h.redIAdd(h); g = (g = g.redIAdd(g)).redIAdd(g), e = m.redISub(f).redISub(f), t = p.redMul(f.redISub(e)).redISub(g), i = (i = this.y.redMul(this.z)).redIAdd(i) } return this.curve.jpoint(e, t, i) }, d.prototype._threeDbl = function() { var e, t, i; if (this.zOne) { var r = this.x.redSqr(), n = this.y.redSqr(), a = n.redSqr(), s = this.x.redAdd(n).redSqr().redISub(r).redISub(a); s = s.redIAdd(s); var o = r.redAdd(r).redIAdd(r).redIAdd(this.curve.a), u = o.redSqr().redISub(s).redISub(s); e = u; var l = a.redIAdd(a); l = (l = l.redIAdd(l)).redIAdd(l), t = o.redMul(s.redISub(u)).redISub(l), i = this.y.redAdd(this.y) } else { var d = this.z.redSqr(), c = this.y.redSqr(), h = this.x.redMul(c), f = this.x.redSub(d).redMul(this.x.redAdd(d)); f = f.redAdd(f).redIAdd(f); var p = h.redIAdd(h), m = (p = p.redIAdd(p)).redAdd(p); e = f.redSqr().redISub(m), i = this.y.redAdd(this.z).redSqr().redISub(c).redISub(d); var g = c.redSqr(); g = (g = (g = g.redIAdd(g)).redIAdd(g)).redIAdd(g), t = f.redMul(p.redISub(e)).redISub(g) } return this.curve.jpoint(e, t, i) }, d.prototype._dbl = function() { var e = this.curve.a, t = this.x, i = this.y, r = this.z, n = r.redSqr().redSqr(), a = t.redSqr(), s = i.redSqr(), o = a.redAdd(a).redIAdd(a).redIAdd(e.redMul(n)), u = t.redAdd(t), l = (u = u.redIAdd(u)).redMul(s), d = o.redSqr().redISub(l.redAdd(l)), c = l.redISub(d), h = s.redSqr(); h = (h = (h = h.redIAdd(h)).redIAdd(h)).redIAdd(h); var f = o.redMul(c).redISub(h), p = i.redAdd(i).redMul(r); return this.curve.jpoint(d, f, p) }, d.prototype.trpl = function() { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), t = this.y.redSqr(), i = this.z.redSqr(), r = t.redSqr(), n = e.redAdd(e).redIAdd(e), a = n.redSqr(), s = this.x.redAdd(t).redSqr().redISub(e).redISub(r), o = (s = (s = (s = s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(a)).redSqr(), u = r.redIAdd(r); u = (u = (u = u.redIAdd(u)).redIAdd(u)).redIAdd(u); var l = n.redIAdd(s).redSqr().redISub(a).redISub(o).redISub(u), d = t.redMul(l); d = (d = d.redIAdd(d)).redIAdd(d); var c = this.x.redMul(o).redISub(d); c = (c = c.redIAdd(c)).redIAdd(c); var h = this.y.redMul(l.redMul(u.redISub(l)).redISub(s.redMul(o))); h = (h = (h = h.redIAdd(h)).redIAdd(h)).redIAdd(h); var f = this.z.redAdd(s).redSqr().redISub(i).redISub(o); return this.curve.jpoint(c, h, f) }, d.prototype.mul = function(e, t) { return e = new n(e, t), this.curve._wnafMul(this, e) }, d.prototype.eq = function(e) { if ("affine" === e.type) return this.eq(e.toJ()); if (this === e) return !0; var t = this.z.redSqr(), i = e.z.redSqr(); if (0 !== this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)) return !1; var r = t.redMul(this.z), n = i.redMul(e.z); return 0 === this.y.redMul(n).redISub(e.y.redMul(r)).cmpn(0) }, d.prototype.eqXToP = function(e) { var t = this.z.redSqr(), i = e.toRed(this.curve.red).redMul(t); if (0 === this.x.cmp(i)) return !0; for (var r = e.clone(), n = this.curve.redN.redMul(t);;) { if (r.iadd(this.curve.n), r.cmp(this.curve.p) >= 0) return !1; if (i.redIAdd(n), 0 === this.x.cmp(i)) return !0 } }, d.prototype.inspect = function() { return this.isInfinity() ? "" : "" }, d.prototype.isInfinity = function() { return 0 === this.z.cmpn(0) } }, function(e, t, i) { "use strict"; var r = i(11), n = i(5), a = i(41), s = i(15); function o(e) { a.call(this, "mont", e), this.a = new r(e.a, 16).toRed(this.red), this.b = new r(e.b, 16).toRed(this.red), this.i4 = new r(4).toRed(this.red).redInvm(), this.two = new r(2).toRed(this.red), this.a24 = this.i4 .redMul(this.a.redAdd(this.two)) } function u(e, t, i) { a.BasePoint.call(this, e, "projective"), null === t && null === i ? (this.x = this.curve.one, this.z = this.curve.zero) : (this.x = new r(t, 16), this.z = new r(i, 16), this.x.red || (this.x = this.x .toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))) } n(o, a), e.exports = o, o.prototype.validate = function(e) { var t = e.normalize().x, i = t.redSqr(), r = i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t); return 0 === r.redSqrt().redSqr().cmp(r) }, n(u, a.BasePoint), o.prototype.decodePoint = function(e, t) { return this.point(s.toArray(e, t), 1) }, o.prototype.point = function(e, t) { return new u(this, e, t) }, o.prototype.pointFromJSON = function(e) { return u.fromJSON(this, e) }, u.prototype.precompute = function() {}, u.prototype._encode = function() { return this.getX().toArray("be", this.curve.p.byteLength()) }, u.fromJSON = function(e, t) { return new u(e, t[0], t[1] || e.one) }, u.prototype.inspect = function() { return this.isInfinity() ? "" : "" }, u.prototype.isInfinity = function() { return 0 === this.z.cmpn(0) }, u.prototype.dbl = function() { var e = this.x.redAdd(this.z).redSqr(), t = this.x.redSub(this.z).redSqr(), i = e.redSub(t), r = e.redMul(t), n = i.redMul(t.redAdd(this.curve.a24.redMul(i))); return this.curve.point(r, n) }, u.prototype.add = function() { throw new Error("Not supported on Montgomery curve") }, u.prototype.diffAdd = function(e, t) { var i = this.x.redAdd(this.z), r = this.x.redSub(this.z), n = e.x.redAdd(e.z), a = e.x.redSub(e.z).redMul(i), s = n.redMul(r), o = t.z.redMul(a.redAdd(s).redSqr()), u = t.x.redMul(a.redISub(s).redSqr()); return this.curve.point(o, u) }, u.prototype.mul = function(e) { for (var t = e.clone(), i = this, r = this.curve.point(null, null), n = []; 0 !== t.cmpn(0); t.iushrn( 1)) n.push(t.andln(1)); for (var a = n.length - 1; a >= 0; a--) 0 === n[a] ? (i = i.diffAdd(r, this), r = r.dbl()) : (r = i .diffAdd(r, this), i = i.dbl()); return r }, u.prototype.mulAdd = function() { throw new Error("Not supported on Montgomery curve") }, u.prototype.jumlAdd = function() { throw new Error("Not supported on Montgomery curve") }, u.prototype.eq = function(e) { return 0 === this.getX().cmp(e.getX()) }, u.prototype.normalize = function() { return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this }, u.prototype.getX = function() { return this.normalize(), this.x.fromRed() } }, function(e, t, i) { "use strict"; var r = i(15), n = i(11), a = i(5), s = i(41), o = r.assert; function u(e) { this.twisted = 1 != (0 | e.a), this.mOneA = this.twisted && -1 == (0 | e.a), this.extended = this.mOneA, s .call(this, "edwards", e), this.a = new n(e.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red), this.c = new n(e.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new n(e.d, 16).toRed(this .red), this.dd = this.d.redAdd(this.d), o(!this.twisted || 0 === this.c.fromRed().cmpn(1)), this .oneC = 1 == (0 | e.c) } function l(e, t, i, r, a) { s.BasePoint.call(this, e, "projective"), null === t && null === i && null === r ? (this.x = this.curve .zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : ( this.x = new n(t, 16), this.y = new n(i, 16), this.z = r ? new n(r, 16) : this.curve.one, this.t = a && new n(a, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this .y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t .red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve .extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z .redInvm())))) } a(u, s), e.exports = u, u.prototype._mulA = function(e) { return this.mOneA ? e.redNeg() : this.a.redMul(e) }, u.prototype._mulC = function(e) { return this.oneC ? e : this.c.redMul(e) }, u.prototype.jpoint = function(e, t, i, r) { return this.point(e, t, i, r) }, u.prototype.pointFromX = function(e, t) { (e = new n(e, 16)).red || (e = e.toRed(this.red)); var i = e.redSqr(), r = this.c2.redSub(this.a.redMul(i)), a = this.one.redSub(this.c2.redMul(this.d).redMul(i)), s = r.redMul(a.redInvm()), o = s.redSqrt(); if (0 !== o.redSqr().redSub(s).cmp(this.zero)) throw new Error("invalid point"); var u = o.fromRed().isOdd(); return (t && !u || !t && u) && (o = o.redNeg()), this.point(e, o) }, u.prototype.pointFromY = function(e, t) { (e = new n(e, 16)).red || (e = e.toRed(this.red)); var i = e.redSqr(), r = i.redSub(this.c2), a = i.redMul(this.d).redMul(this.c2).redSub(this.a), s = r.redMul(a.redInvm()); if (0 === s.cmp(this.zero)) { if (t) throw new Error("invalid point"); return this.point(this.zero, e) } var o = s.redSqrt(); if (0 !== o.redSqr().redSub(s).cmp(this.zero)) throw new Error("invalid point"); return o.fromRed().isOdd() !== t && (o = o.redNeg()), this.point(o, e) }, u.prototype.validate = function(e) { if (e.isInfinity()) return !0; e.normalize(); var t = e.x.redSqr(), i = e.y.redSqr(), r = t.redMul(this.a).redAdd(i), n = this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i))); return 0 === r.cmp(n) }, a(l, s.BasePoint), u.prototype.pointFromJSON = function(e) { return l.fromJSON(this, e) }, u.prototype.point = function(e, t, i, r) { return new l(this, e, t, i, r) }, l.fromJSON = function(e, t) { return new l(e, t[0], t[1], t[2]) }, l.prototype.inspect = function() { return this.isInfinity() ? "" : "" }, l.prototype.isInfinity = function() { return 0 === this.x.cmpn(0) && (0 === this.y.cmp(this.z) || this.zOne && 0 === this.y.cmp(this.curve.c)) }, l.prototype._extDbl = function() { var e = this.x.redSqr(), t = this.y.redSqr(), i = this.z.redSqr(); i = i.redIAdd(i); var r = this.curve._mulA(e), n = this.x.redAdd(this.y).redSqr().redISub(e).redISub(t), a = r.redAdd(t), s = a.redSub(i), o = r.redSub(t), u = n.redMul(s), l = a.redMul(o), d = n.redMul(o), c = s.redMul(a); return this.curve.point(u, l, c, d) }, l.prototype._projDbl = function() { var e, t, i, r, n, a, s = this.x.redAdd(this.y).redSqr(), o = this.x.redSqr(), u = this.y.redSqr(); if (this.curve.twisted) { var l = (r = this.curve._mulA(o)).redAdd(u); this.zOne ? (e = s.redSub(o).redSub(u).redMul(l.redSub(this.curve.two)), t = l.redMul(r.redSub(u)), i = l.redSqr().redSub(l).redSub(l)) : (n = this.z.redSqr(), a = l.redSub(n).redISub(n), e = s .redSub(o).redISub(u).redMul(a), t = l.redMul(r.redSub(u)), i = l.redMul(a)) } else r = o.redAdd(u), n = this.curve._mulC(this.z).redSqr(), a = r.redSub(n).redSub(n), e = this.curve ._mulC(s.redISub(r)).redMul(a), t = this.curve._mulC(r).redMul(o.redISub(u)), i = r.redMul(a); return this.curve.point(e, t, i) }, l.prototype.dbl = function() { return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl() }, l.prototype._extAdd = function(e) { var t = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), i = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), r = this.t.redMul(this.curve.dd).redMul(e.t), n = this.z.redMul(e.z.redAdd(e.z)), a = i.redSub(t), s = n.redSub(r), o = n.redAdd(r), u = i.redAdd(t), l = a.redMul(s), d = o.redMul(u), c = a.redMul(u), h = s.redMul(o); return this.curve.point(l, d, h, c) }, l.prototype._projAdd = function(e) { var t, i, r = this.z.redMul(e.z), n = r.redSqr(), a = this.x.redMul(e.x), s = this.y.redMul(e.y), o = this.curve.d.redMul(a).redMul(s), u = n.redSub(o), l = n.redAdd(o), d = this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(s), c = r.redMul(u).redMul(d); return this.curve.twisted ? (t = r.redMul(l).redMul(s.redSub(this.curve._mulA(a))), i = u.redMul(l)) : ( t = r.redMul(l).redMul(s.redSub(a)), i = this.curve._mulC(u).redMul(l)), this.curve.point(c, t, i) }, l.prototype.add = function(e) { return this.isInfinity() ? e : e.isInfinity() ? this : this.curve.extended ? this._extAdd(e) : this ._projAdd(e) }, l.prototype.mul = function(e) { return this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve._wnafMul(this, e) }, l.prototype.mulAdd = function(e, t, i) { return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, !1) }, l.prototype.jmulAdd = function(e, t, i) { return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, !0) }, l.prototype.normalize = function() { if (this.zOne) return this; var e = this.z.redInvm(); return this.x = this.x.redMul(e), this.y = this.y.redMul(e), this.t && (this.t = this.t.redMul(e)), this .z = this.curve.one, this.zOne = !0, this }, l.prototype.neg = function() { return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg()) }, l.prototype.getX = function() { return this.normalize(), this.x.fromRed() }, l.prototype.getY = function() { return this.normalize(), this.y.fromRed() }, l.prototype.eq = function(e) { return this === e || 0 === this.getX().cmp(e.getX()) && 0 === this.getY().cmp(e.getY()) }, l.prototype.eqXToP = function(e) { var t = e.toRed(this.curve.red).redMul(this.z); if (0 === this.x.cmp(t)) return !0; for (var i = e.clone(), r = this.curve.redN.redMul(this.z);;) { if (i.iadd(this.curve.n), i.cmp(this.curve.p) >= 0) return !1; if (t.redIAdd(r), 0 === this.x.cmp(t)) return !0 } }, l.prototype.toP = l.prototype.normalize, l.prototype.mixedAdd = l.prototype.add }, function(e, t, i) { "use strict"; t.sha1 = i(199), t.sha224 = i(200), t.sha256 = i(111), t.sha384 = i(201), t.sha512 = i(112) }, function(e, t, i) { "use strict"; var r = i(18), n = i(34), a = i(110), s = r.rotl32, o = r.sum32, u = r.sum32_5, l = a.ft_1, d = n.BlockHash, c = [1518500249, 1859775393, 2400959708, 3395469782]; function h() { if (!(this instanceof h)) return new h; d.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.W = new Array(80) } r.inherits(h, d), e.exports = h, h.blockSize = 512, h.outSize = 160, h.hmacStrength = 80, h.padLength = 64, h.prototype._update = function(e, t) { for (var i = this.W, r = 0; r < 16; r++) i[r] = e[t + r]; for (; r < i.length; r++) i[r] = s(i[r - 3] ^ i[r - 8] ^ i[r - 14] ^ i[r - 16], 1); var n = this.h[0], a = this.h[1], d = this.h[2], h = this.h[3], f = this.h[4]; for (r = 0; r < i.length; r++) { var p = ~~(r / 20), m = u(s(n, 5), l(p, a, d, h), f, i[r], c[p]); f = h, h = d, d = s(a, 30), a = n, n = m } this.h[0] = o(this.h[0], n), this.h[1] = o(this.h[1], a), this.h[2] = o(this.h[2], d), this.h[3] = o( this.h[3], h), this.h[4] = o(this.h[4], f) }, h.prototype._digest = function(e) { return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big") } }, function(e, t, i) { "use strict"; var r = i(18), n = i(111); function a() { if (!(this instanceof a)) return new a; n.call(this), this.h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428 ] } r.inherits(a, n), e.exports = a, a.blockSize = 512, a.outSize = 224, a.hmacStrength = 192, a.padLength = 64, a.prototype._digest = function(e) { return "hex" === e ? r.toHex32(this.h.slice(0, 7), "big") : r.split32(this.h.slice(0, 7), "big") } }, function(e, t, i) { "use strict"; var r = i(18), n = i(112); function a() { if (!(this instanceof a)) return new a; n.call(this), this.h = [3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999, 355462360, 4144912697, 1731405415, 4290775857, 2394180231, 1750603025, 3675008525, 1694076839, 1203062813, 3204075428 ] } r.inherits(a, n), e.exports = a, a.blockSize = 1024, a.outSize = 384, a.hmacStrength = 192, a.padLength = 128, a.prototype._digest = function(e) { return "hex" === e ? r.toHex32(this.h.slice(0, 12), "big") : r.split32(this.h.slice(0, 12), "big") } }, function(e, t, i) { "use strict"; var r = i(18), n = i(34), a = r.rotl32, s = r.sum32, o = r.sum32_3, u = r.sum32_4, l = n.BlockHash; function d() { if (!(this instanceof d)) return new d; l.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little" } function c(e, t, i, r) { return e <= 15 ? t ^ i ^ r : e <= 31 ? t & i | ~t & r : e <= 47 ? (t | ~i) ^ r : e <= 63 ? t & r | i & ~ r : t ^ (i | ~r) } function h(e) { return e <= 15 ? 0 : e <= 31 ? 1518500249 : e <= 47 ? 1859775393 : e <= 63 ? 2400959708 : 2840853838 } function f(e) { return e <= 15 ? 1352829926 : e <= 31 ? 1548603684 : e <= 47 ? 1836072691 : e <= 63 ? 2053994217 : 0 } r.inherits(d, l), t.ripemd160 = d, d.blockSize = 512, d.outSize = 160, d.hmacStrength = 192, d.padLength = 64, d.prototype._update = function(e, t) { for (var i = this.h[0], r = this.h[1], n = this.h[2], l = this.h[3], d = this.h[4], y = i, _ = r, b = n, w = l, E = d, T = 0; T < 80; T++) { var S = s(a(u(i, c(T, r, n, l), e[p[T] + t], h(T)), g[T]), d); i = d, d = l, l = a(n, 10), n = r, r = S, S = s(a(u(y, c(79 - T, _, b, w), e[m[T] + t], f(T)), v[T]), E), y = E, E = w, w = a(b, 10), b = _, _ = S } S = o(this.h[1], n, w), this.h[1] = o(this.h[2], l, E), this.h[2] = o(this.h[3], d, y), this.h[3] = o( this.h[4], i, _), this.h[4] = o(this.h[0], r, b), this.h[0] = S }, d.prototype._digest = function(e) { return "hex" === e ? r.toHex32(this.h, "little") : r.split32(this.h, "little") }; var p = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 ], m = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 ], g = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ], v = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ] }, function(e, t, i) { "use strict"; var r = i(18), n = i(14); function a(e, t, i) { if (!(this instanceof a)) return new a(e, t, i); this.Hash = e, this.blockSize = e.blockSize / 8, this.outSize = e.outSize / 8, this.inner = null, this .outer = null, this._init(r.toArray(t, i)) } e.exports = a, a.prototype._init = function(e) { e.length > this.blockSize && (e = (new this.Hash).update(e).digest()), n(e.length <= this.blockSize); for (var t = e.length; t < this.blockSize; t++) e.push(0); for (t = 0; t < e.length; t++) e[t] ^= 54; for (this.inner = (new this.Hash).update(e), t = 0; t < e.length; t++) e[t] ^= 106; this.outer = (new this.Hash).update(e) }, a.prototype.update = function(e, t) { return this.inner.update(e, t), this }, a.prototype.digest = function(e) { return this.outer.update(this.inner.digest()), this.outer.digest(e) } }, function(e, t) { e.exports = { doubles: { step: 4, points: [ ["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821" ], ["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf" ], ["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695" ], ["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9" ], ["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36" ], ["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f" ], ["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999" ], ["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09" ], ["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d" ], ["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088" ], ["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d" ], ["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8" ], ["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a" ], ["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453" ], ["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160" ], ["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0" ], ["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6" ], ["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589" ], ["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17" ], ["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda" ], ["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd" ], ["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2" ], ["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6" ], ["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f" ], ["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01" ], ["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3" ], ["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f" ], ["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7" ], ["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78" ], ["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1" ], ["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150" ], ["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82" ], ["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc" ], ["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b" ], ["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51" ], ["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45" ], ["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120" ], ["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84" ], ["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d" ], ["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d" ], ["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8" ], ["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8" ], ["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac" ], ["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f" ], ["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962" ], ["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907" ], ["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec" ], ["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d" ], ["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414" ], ["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd" ], ["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0" ], ["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811" ], ["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1" ], ["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c" ], ["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73" ], ["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd" ], ["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405" ], ["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589" ], ["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e" ], ["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27" ], ["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1" ], ["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482" ], ["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945" ], ["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573" ], ["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82" ] ] }, naf: { wnd: 7, points: [ ["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672" ], ["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6" ], ["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da" ], ["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37" ], ["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b" ], ["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81" ], ["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58" ], ["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77" ], ["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a" ], ["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c" ], ["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67" ], ["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402" ], ["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55" ], ["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482" ], ["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82" ], ["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396" ], ["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49" ], ["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf" ], ["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a" ], ["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7" ], ["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933" ], ["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a" ], ["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6" ], ["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37" ], ["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e" ], ["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6" ], ["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476" ], ["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40" ], ["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61" ], ["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683" ], ["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5" ], ["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b" ], ["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417" ], ["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868" ], ["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a" ], ["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6" ], ["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996" ], ["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e" ], ["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d" ], ["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2" ], ["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e" ], ["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437" ], ["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311" ], ["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4" ], ["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575" ], ["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d" ], ["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d" ], ["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629" ], ["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06" ], ["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374" ], ["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee" ], ["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1" ], ["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b" ], ["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661" ], ["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6" ], ["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e" ], ["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d" ], ["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc" ], ["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4" ], ["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c" ], ["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b" ], ["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913" ], ["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154" ], ["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865" ], ["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc" ], ["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224" ], ["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e" ], ["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6" ], ["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511" ], ["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b" ], ["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2" ], ["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c" ], ["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3" ], ["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d" ], ["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700" ], ["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4" ], ["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196" ], ["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4" ], ["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257" ], ["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13" ], ["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096" ], ["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38" ], ["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f" ], ["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448" ], ["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a" ], ["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4" ], ["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437" ], ["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7" ], ["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d" ], ["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a" ], ["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54" ], ["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77" ], ["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517" ], ["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10" ], ["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125" ], ["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e" ], ["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1" ], ["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2" ], ["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423" ], ["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8" ], ["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758" ], ["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375" ], ["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d" ], ["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec" ], ["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0" ], ["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c" ], ["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4" ], ["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f" ], ["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649" ], ["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826" ], ["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5" ], ["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87" ], ["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b" ], ["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc" ], ["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c" ], ["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f" ], ["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a" ], ["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46" ], ["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f" ], ["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03" ], ["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08" ], ["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8" ], ["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373" ], ["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3" ], ["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8" ], ["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1" ], ["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9" ] ] } } }, function(e, t, i) { "use strict"; var r = i(11), n = i(206), a = i(15), s = i(60), o = i(56), u = a.assert, l = i(207), d = i(208); function c(e) { if (!(this instanceof c)) return new c(e); "string" == typeof e && (u(Object.prototype.hasOwnProperty.call(s, e), "Unknown curve " + e), e = s[e]), e instanceof s.PresetCurve && (e = { curve: e }), this.curve = e.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g, this.g = e.curve.g, this.g.precompute(e.curve.n.bitLength() + 1), this.hash = e.hash || e.curve.hash } e.exports = c, c.prototype.keyPair = function(e) { return new l(this, e) }, c.prototype.keyFromPrivate = function(e, t) { return l.fromPrivate(this, e, t) }, c.prototype.keyFromPublic = function(e, t) { return l.fromPublic(this, e, t) }, c.prototype.genKeyPair = function(e) { e || (e = {}); for (var t = new n({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", entropy: e.entropy || o(this.hash.hmacStrength), entropyEnc: e.entropy && e.entropyEnc || "utf8", nonce: this.n.toArray() }), i = this.n.byteLength(), a = this.n.sub(new r(2));;) { var s = new r(t.generate(i)); if (!(s.cmp(a) > 0)) return s.iaddn(1), this.keyFromPrivate(s) } }, c.prototype._truncateToN = function(e, t) { var i = 8 * e.byteLength() - this.n.bitLength(); return i > 0 && (e = e.ushrn(i)), !t && e.cmp(this.n) >= 0 ? e.sub(this.n) : e }, c.prototype.sign = function(e, t, i, a) { "object" == typeof i && (a = i, i = null), a || (a = {}), t = this.keyFromPrivate(t, i), e = this ._truncateToN(new r(e, 16)); for (var s = this.n.byteLength(), o = t.getPrivate().toArray("be", s), u = e.toArray("be", s), l = new n({ hash: this.hash, entropy: o, nonce: u, pers: a.pers, persEnc: a.persEnc || "utf8" }), c = this.n.sub(new r(1)), h = 0;; h++) { var f = a.k ? a.k(h) : new r(l.generate(this.n.byteLength())); if (!((f = this._truncateToN(f, !0)).cmpn(1) <= 0 || f.cmp(c) >= 0)) { var p = this.g.mul(f); if (!p.isInfinity()) { var m = p.getX(), g = m.umod(this.n); if (0 !== g.cmpn(0)) { var v = f.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e)); if (0 !== (v = v.umod(this.n)).cmpn(0)) { var y = (p.getY().isOdd() ? 1 : 0) | (0 !== m.cmp(g) ? 2 : 0); return a.canonical && v.cmp(this.nh) > 0 && (v = this.n.sub(v), y ^= 1), new d({ r: g, s: v, recoveryParam: y }) } } } } } }, c.prototype.verify = function(e, t, i, n) { e = this._truncateToN(new r(e, 16)), i = this.keyFromPublic(i, n); var a = (t = new d(t, "hex")).r, s = t.s; if (a.cmpn(1) < 0 || a.cmp(this.n) >= 0) return !1; if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) return !1; var o, u = s.invm(this.n), l = u.mul(e).umod(this.n), c = u.mul(a).umod(this.n); return this.curve._maxwellTrick ? !(o = this.g.jmulAdd(l, i.getPublic(), c)).isInfinity() && o.eqXToP( a) : !(o = this.g.mulAdd(l, i.getPublic(), c)).isInfinity() && 0 === o.getX().umod(this.n).cmp(a) }, c.prototype.recoverPubKey = function(e, t, i, n) { u((3 & i) === i, "The recovery param is more than two bits"), t = new d(t, n); var a = this.n, s = new r(e), o = t.r, l = t.s, c = 1 & i, h = i >> 1; if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && h) throw new Error( "Unable to find sencond key candinate"); o = h ? this.curve.pointFromX(o.add(this.curve.n), c) : this.curve.pointFromX(o, c); var f = t.r.invm(a), p = a.sub(s).mul(f).umod(a), m = l.mul(f).umod(a); return this.g.mulAdd(p, o, m) }, c.prototype.getKeyRecoveryParam = function(e, t, i, r) { if (null !== (t = new d(t, r)).recoveryParam) return t.recoveryParam; for (var n = 0; n < 4; n++) { var a; try { a = this.recoverPubKey(e, t, n) } catch (e) { continue } if (a.eq(i)) return n } throw new Error("Unable to find valid recovery factor") } }, function(e, t, i) { "use strict"; var r = i(61), n = i(108), a = i(14); function s(e) { if (!(this instanceof s)) return new s(e); this.hash = e.hash, this.predResist = !!e.predResist, this.outLen = this.hash.outSize, this.minEntropy = e .minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null, this.V = null; var t = n.toArray(e.entropy, e.entropyEnc || "hex"), i = n.toArray(e.nonce, e.nonceEnc || "hex"), r = n.toArray(e.pers, e.persEnc || "hex"); a(t.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"), this ._init(t, i, r) } e.exports = s, s.prototype._init = function(e, t, i) { var r = e.concat(t).concat(i); this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8); for (var n = 0; n < this.V.length; n++) this.K[n] = 0, this.V[n] = 1; this._update(r), this._reseed = 1, this.reseedInterval = 281474976710656 }, s.prototype._hmac = function() { return new r.hmac(this.hash, this.K) }, s.prototype._update = function(e) { var t = this._hmac().update(this.V).update([0]); e && (t = t.update(e)), this.K = t.digest(), this.V = this._hmac().update(this.V).digest(), e && (this .K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this .V).digest()) }, s.prototype.reseed = function(e, t, i, r) { "string" != typeof t && (r = i, i = t, t = null), e = n.toArray(e, t), i = n.toArray(i, r), a(e .length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"), this._update(e.concat(i || [])), this._reseed = 1 }, s.prototype.generate = function(e, t, i, r) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); "string" != typeof t && (r = i, i = t, t = null), i && (i = n.toArray(i, r || "hex"), this._update(i)); for (var a = []; a.length < e;) this.V = this._hmac().update(this.V).digest(), a = a.concat(this.V); var s = a.slice(0, e); return this._update(i), this._reseed++, n.encode(s, t) } }, function(e, t, i) { "use strict"; var r = i(11), n = i(15).assert; function a(e, t) { this.ec = e, this.priv = null, this.pub = null, t.priv && this._importPrivate(t.priv, t.privEnc), t.pub && this._importPublic(t.pub, t.pubEnc) } e.exports = a, a.fromPublic = function(e, t, i) { return t instanceof a ? t : new a(e, { pub: t, pubEnc: i }) }, a.fromPrivate = function(e, t, i) { return t instanceof a ? t : new a(e, { priv: t, privEnc: i }) }, a.prototype.validate = function() { var e = this.getPublic(); return e.isInfinity() ? { result: !1, reason: "Invalid public key" } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: !0, reason: null } : { result: !1, reason: "Public key * N != O" } : { result: !1, reason: "Public key is not a point" } }, a.prototype.getPublic = function(e, t) { return "string" == typeof e && (t = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), t ? this.pub.encode(t, e) : this.pub }, a.prototype.getPrivate = function(e) { return "hex" === e ? this.priv.toString(16, 2) : this.priv }, a.prototype._importPrivate = function(e, t) { this.priv = new r(e, t || 16), this.priv = this.priv.umod(this.ec.curve.n) }, a.prototype._importPublic = function(e, t) { if (e.x || e.y) return "mont" === this.ec.curve.type ? n(e.x, "Need x coordinate") : "short" !== this.ec .curve.type && "edwards" !== this.ec.curve.type || n(e.x && e.y, "Need both x and y coordinate"), void(this.pub = this.ec.curve.point(e.x, e.y)); this.pub = this.ec.curve.decodePoint(e, t) }, a.prototype.derive = function(e) { return e.validate() || n(e.validate(), "public point not validated"), e.mul(this.priv).getX() }, a.prototype.sign = function(e, t, i) { return this.ec.sign(e, this, t, i) }, a.prototype.verify = function(e, t) { return this.ec.verify(e, t, this) }, a.prototype.inspect = function() { return "" } }, function(e, t, i) { "use strict"; var r = i(11), n = i(15), a = n.assert; function s(e, t) { if (e instanceof s) return e; this._importDER(e, t) || (a(e.r && e.s, "Signature without r or s"), this.r = new r(e.r, 16), this.s = new r(e.s, 16), void 0 === e.recoveryParam ? this.recoveryParam = null : this.recoveryParam = e .recoveryParam) } function o(e, t) { var i = e[t.place++]; if (!(128 & i)) return i; var r = 15 & i; if (0 === r || r > 4) return !1; for (var n = 0, a = 0, s = t.place; a < r; a++, s++) n <<= 8, n |= e[s], n >>>= 0; return !(n <= 127) && (t.place = s, n) } function u(e) { for (var t = 0, i = e.length - 1; !e[t] && !(128 & e[t + 1]) && t < i;) t++; return 0 === t ? e : e.slice(t) } function l(e, t) { if (t < 128) e.push(t); else { var i = 1 + (Math.log(t) / Math.LN2 >>> 3); for (e.push(128 | i); --i;) e.push(t >>> (i << 3) & 255); e.push(t) } } e.exports = s, s.prototype._importDER = function(e, t) { e = n.toArray(e, t); var i = new function() { this.place = 0 }; if (48 !== e[i.place++]) return !1; var a = o(e, i); if (!1 === a) return !1; if (a + i.place !== e.length) return !1; if (2 !== e[i.place++]) return !1; var s = o(e, i); if (!1 === s) return !1; var u = e.slice(i.place, s + i.place); if (i.place += s, 2 !== e[i.place++]) return !1; var l = o(e, i); if (!1 === l) return !1; if (e.length !== l + i.place) return !1; var d = e.slice(i.place, l + i.place); if (0 === u[0]) { if (!(128 & u[1])) return !1; u = u.slice(1) } if (0 === d[0]) { if (!(128 & d[1])) return !1; d = d.slice(1) } return this.r = new r(u), this.s = new r(d), this.recoveryParam = null, !0 }, s.prototype.toDER = function(e) { var t = this.r.toArray(), i = this.s.toArray(); for (128 & t[0] && (t = [0].concat(t)), 128 & i[0] && (i = [0].concat(i)), t = u(t), i = u(i); !(i[0] || 128 & i[1]);) i = i.slice(1); var r = [2]; l(r, t.length), (r = r.concat(t)).push(2), l(r, i.length); var a = r.concat(i), s = [48]; return l(s, a.length), s = s.concat(a), n.encode(s, e) } }, function(e, t, i) { "use strict"; var r = i(61), n = i(60), a = i(15), s = a.assert, o = a.parseBytes, u = i(210), l = i(211); function d(e) { if (s("ed25519" === e, "only tested with ed25519 so far"), !(this instanceof d)) return new d(e); e = n[e].curve, this.curve = e, this.g = e.g, this.g.precompute(e.n.bitLength() + 1), this.pointClass = e .point().constructor, this.encodingLength = Math.ceil(e.n.bitLength() / 8), this.hash = r.sha512 } e.exports = d, d.prototype.sign = function(e, t) { e = o(e); var i = this.keyFromSecret(t), r = this.hashInt(i.messagePrefix(), e), n = this.g.mul(r), a = this.encodePoint(n), s = this.hashInt(a, i.pubBytes(), e).mul(i.priv()), u = r.add(s).umod(this.curve.n); return this.makeSignature({ R: n, S: u, Rencoded: a }) }, d.prototype.verify = function(e, t, i) { e = o(e), t = this.makeSignature(t); var r = this.keyFromPublic(i), n = this.hashInt(t.Rencoded(), r.pubBytes(), e), a = this.g.mul(t.S()); return t.R().add(r.pub().mul(n)).eq(a) }, d.prototype.hashInt = function() { for (var e = this.hash(), t = 0; t < arguments.length; t++) e.update(arguments[t]); return a.intFromLE(e.digest()).umod(this.curve.n) }, d.prototype.keyFromPublic = function(e) { return u.fromPublic(this, e) }, d.prototype.keyFromSecret = function(e) { return u.fromSecret(this, e) }, d.prototype.makeSignature = function(e) { return e instanceof l ? e : new l(this, e) }, d.prototype.encodePoint = function(e) { var t = e.getY().toArray("le", this.encodingLength); return t[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, t }, d.prototype.decodePoint = function(e) { var t = (e = a.parseBytes(e)).length - 1, i = e.slice(0, t).concat(-129 & e[t]), r = 0 != (128 & e[t]), n = a.intFromLE(i); return this.curve.pointFromY(n, r) }, d.prototype.encodeInt = function(e) { return e.toArray("le", this.encodingLength) }, d.prototype.decodeInt = function(e) { return a.intFromLE(e) }, d.prototype.isPoint = function(e) { return e instanceof this.pointClass } }, function(e, t, i) { "use strict"; var r = i(15), n = r.assert, a = r.parseBytes, s = r.cachedProperty; function o(e, t) { this.eddsa = e, this._secret = a(t.secret), e.isPoint(t.pub) ? this._pub = t.pub : this._pubBytes = a(t .pub) } o.fromPublic = function(e, t) { return t instanceof o ? t : new o(e, { pub: t }) }, o.fromSecret = function(e, t) { return t instanceof o ? t : new o(e, { secret: t }) }, o.prototype.secret = function() { return this._secret }, s(o, "pubBytes", function() { return this.eddsa.encodePoint(this.pub()) }), s(o, "pub", function() { return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()) }), s(o, "privBytes", function() { var e = this.eddsa, t = this.hash(), i = e.encodingLength - 1, r = t.slice(0, e.encodingLength); return r[0] &= 248, r[i] &= 127, r[i] |= 64, r }), s(o, "priv", function() { return this.eddsa.decodeInt(this.privBytes()) }), s(o, "hash", function() { return this.eddsa.hash().update(this.secret()).digest() }), s(o, "messagePrefix", function() { return this.hash().slice(this.eddsa.encodingLength) }), o.prototype.sign = function(e) { return n(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this) }, o.prototype.verify = function(e, t) { return this.eddsa.verify(e, t, this) }, o.prototype.getSecret = function(e) { return n(this._secret, "KeyPair is public only"), r.encode(this.secret(), e) }, o.prototype.getPublic = function(e) { return r.encode(this.pubBytes(), e) }, e.exports = o }, function(e, t, i) { "use strict"; var r = i(11), n = i(15), a = n.assert, s = n.cachedProperty, o = n.parseBytes; function u(e, t) { this.eddsa = e, "object" != typeof t && (t = o(t)), Array.isArray(t) && (t = { R: t.slice(0, e.encodingLength), S: t.slice(e.encodingLength) }), a(t.R && t.S, "Signature without R or S"), e.isPoint(t.R) && (this._R = t.R), t.S instanceof r && ( this._S = t.S), this._Rencoded = Array.isArray(t.R) ? t.R : t.Rencoded, this._Sencoded = Array .isArray(t.S) ? t.S : t.Sencoded } s(u, "S", function() { return this.eddsa.decodeInt(this.Sencoded()) }), s(u, "R", function() { return this.eddsa.decodePoint(this.Rencoded()) }), s(u, "Rencoded", function() { return this.eddsa.encodePoint(this.R()) }), s(u, "Sencoded", function() { return this.eddsa.encodeInt(this.S()) }), u.prototype.toBytes = function() { return this.Rencoded().concat(this.Sencoded()) }, u.prototype.toHex = function() { return n.encode(this.toBytes(), "hex").toUpperCase() }, e.exports = u }, function(e, t) {}, function(e, t, i) { "use strict"; var r = i(114); t.certificate = i(219); var n = r.define("RSAPrivateKey", function() { this.seq().obj(this.key("version").int(), this.key("modulus").int(), this.key("publicExponent").int(), this.key("privateExponent").int(), this.key("prime1").int(), this.key("prime2").int(), this.key( "exponent1").int(), this.key("exponent2").int(), this.key("coefficient").int()) }); t.RSAPrivateKey = n; var a = r.define("RSAPublicKey", function() { this.seq().obj(this.key("modulus").int(), this.key("publicExponent").int()) }); t.RSAPublicKey = a; var s = r.define("SubjectPublicKeyInfo", function() { this.seq().obj(this.key("algorithm").use(o), this.key("subjectPublicKey").bitstr()) }); t.PublicKey = s; var o = r.define("AlgorithmIdentifier", function() { this.seq().obj(this.key("algorithm").objid(), this.key("none").null_().optional(), this.key("curve") .objid().optional(), this.key("params").seq().obj(this.key("p").int(), this.key("q").int(), this .key("g").int()).optional()) }), u = r.define("PrivateKeyInfo", function() { this.seq().obj(this.key("version").int(), this.key("algorithm").use(o), this.key("subjectPrivateKey") .octstr()) }); t.PrivateKey = u; var l = r.define("EncryptedPrivateKeyInfo", function() { this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(), this.key("decrypt").seq().obj( this.key("kde").seq().obj(this.key("id").objid(), this.key("kdeparams").seq().obj(this.key( "salt").octstr(), this.key("iters").int())), this.key("cipher").seq().obj(this.key("algo") .objid(), this.key("iv").octstr()))), this.key("subjectPrivateKey").octstr()) }); t.EncryptedPrivateKey = l; var d = r.define("DSAPrivateKey", function() { this.seq().obj(this.key("version").int(), this.key("p").int(), this.key("q").int(), this.key("g") .int(), this.key("pub_key").int(), this.key("priv_key").int()) }); t.DSAPrivateKey = d, t.DSAparam = r.define("DSAparam", function() { this.int() }); var c = r.define("ECPrivateKey", function() { this.seq().obj(this.key("version").int(), this.key("privateKey").octstr(), this.key("parameters") .optional().explicit(0).use(h), this.key("publicKey").optional().explicit(1).bitstr()) }); t.ECPrivateKey = c; var h = r.define("ECParameters", function() { this.choice({ namedCurve: this.objid() }) }); t.signature = r.define("signature", function() { this.seq().obj(this.key("r").int(), this.key("s").int()) }) }, function(e, t, i) { "use strict"; var r = i(115), n = i(117), a = i(5); function s(e, t) { this.name = e, this.body = t, this.decoders = {}, this.encoders = {} } t.define = function(e, t) { return new s(e, t) }, s.prototype._createNamed = function(e) { var t = this.name; function i(e) { this._initNamed(e, t) } return a(i, e), i.prototype._initNamed = function(t, i) { e.call(this, t, i) }, new i(this) }, s.prototype._getDecoder = function(e) { return e = e || "der", this.decoders.hasOwnProperty(e) || (this.decoders[e] = this._createNamed(n[e])), this.decoders[e] }, s.prototype.decode = function(e, t, i) { return this._getDecoder(t).decode(e, i) }, s.prototype._getEncoder = function(e) { return e = e || "der", this.encoders.hasOwnProperty(e) || (this.encoders[e] = this._createNamed(r[e])), this.encoders[e] }, s.prototype.encode = function(e, t, i) { return this._getEncoder(t).encode(e, i) } }, function(e, t, i) { "use strict"; var r = i(5), n = i(116); function a(e) { n.call(this, e), this.enc = "pem" } r(a, n), e.exports = a, a.prototype.encode = function(e, t) { for (var i = n.prototype.encode.call(this, e).toString("base64"), r = ["-----BEGIN " + t.label + "-----"], a = 0; a < i.length; a += 64) r.push(i.slice(a, a + 64)); return r.push("-----END " + t.label + "-----"), r.join("\n") } }, function(e, t, i) { "use strict"; var r = i(5), n = i(62).Buffer, a = i(118); function s(e) { a.call(this, e), this.enc = "pem" } r(s, a), e.exports = s, s.prototype.decode = function(e, t) { for (var i = e.toString().split(/[\r\n]+/g), r = t.label.toUpperCase(), s = /^-----(BEGIN|END) ([^-]+)-----$/, o = -1, u = -1, l = 0; l < i.length; l++) { var d = i[l].match(s); if (null !== d && d[2] === r) { if (-1 !== o) { if ("END" !== d[1]) break; u = l; break } if ("BEGIN" !== d[1]) break; o = l } } if (-1 === o || -1 === u) throw new Error("PEM section not found for: " + r); var c = i.slice(o + 1, u).join(""); c.replace(/[^a-z0-9+/=]+/gi, ""); var h = n.from(c, "base64"); return a.prototype.decode.call(this, h, t) } }, function(e, t, i) { "use strict"; var r = t; r.Reporter = i(64).Reporter, r.DecoderBuffer = i(35).DecoderBuffer, r.EncoderBuffer = i(35).EncoderBuffer, r .Node = i(63) }, function(e, t, i) { "use strict"; var r = t; r._reverse = function(e) { var t = {}; return Object.keys(e).forEach(function(i) { (0 | i) == i && (i |= 0); var r = e[i]; t[r] = i }), t }, r.der = i(65) }, function(e, t, i) { "use strict"; var r = i(114), n = r.define("Time", function() { this.choice({ utcTime: this.utctime(), generalTime: this.gentime() }) }), a = r.define("AttributeTypeValue", function() { this.seq().obj(this.key("type").objid(), this.key("value").any()) }), s = r.define("AlgorithmIdentifier", function() { this.seq().obj(this.key("algorithm").objid(), this.key("parameters").optional(), this.key("curve") .objid().optional()) }), o = r.define("SubjectPublicKeyInfo", function() { this.seq().obj(this.key("algorithm").use(s), this.key("subjectPublicKey").bitstr()) }), u = r.define("RelativeDistinguishedName", function() { this.setof(a) }), l = r.define("RDNSequence", function() { this.seqof(u) }), d = r.define("Name", function() { this.choice({ rdnSequence: this.use(l) }) }), c = r.define("Validity", function() { this.seq().obj(this.key("notBefore").use(n), this.key("notAfter").use(n)) }), h = r.define("Extension", function() { this.seq().obj(this.key("extnID").objid(), this.key("critical").bool().def(!1), this.key("extnValue") .octstr()) }), f = r.define("TBSCertificate", function() { this.seq().obj(this.key("version").explicit(0).int().optional(), this.key("serialNumber").int(), this .key("signature").use(s), this.key("issuer").use(d), this.key("validity").use(c), this.key( "subject").use(d), this.key("subjectPublicKeyInfo").use(o), this.key("issuerUniqueID").implicit( 1).bitstr().optional(), this.key("subjectUniqueID").implicit(2).bitstr().optional(), this.key( "extensions").explicit(3).seqof(h).optional()) }), p = r.define("X509Certificate", function() { this.seq().obj(this.key("tbsCertificate").use(f), this.key("signatureAlgorithm").use(s), this.key( "signatureValue").bitstr()) }); e.exports = p }, function(e) { e.exports = JSON.parse( '{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}' ) }, function(e, t, i) { var r = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m, n = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m, a = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m, s = i(40), o = i(53), u = i(6).Buffer; e.exports = function(e, t) { var i, l = e.toString(), d = l.match(r); if (d) { var c = "aes" + d[1], h = u.from(d[2], "hex"), f = u.from(d[3].replace(/[\r\n]/g, ""), "base64"), p = s(t, h.slice(0, 8), parseInt(d[1], 10)).key, m = [], g = o.createDecipheriv(c, p, h); m.push(g.update(f)), m.push(g.final()), i = u.concat(m) } else { var v = l.match(a); i = u.from(v[2].replace(/[\r\n]/g, ""), "base64") } return { tag: l.match(n)[1], data: i } } }, function(e, t, i) { var r = i(6).Buffer, n = i(113), a = i(59).ec, s = i(42), o = i(119); function u(e, t) { if (e.cmpn(0) <= 0) throw new Error("invalid sig"); if (e.cmp(t) >= t) throw new Error("invalid sig") } e.exports = function(e, t, i, l, d) { var c = s(i); if ("ec" === c.type) { if ("ecdsa" !== l && "ecdsa/rsa" !== l) throw new Error("wrong public key type"); return function(e, t, i) { var r = o[i.data.algorithm.curve.join(".")]; if (!r) throw new Error("unknown curve " + i.data.algorithm.curve.join(".")); var n = new a(r), s = i.data.subjectPrivateKey.data; return n.verify(t, e, s) }(e, t, c) } if ("dsa" === c.type) { if ("dsa" !== l) throw new Error("wrong public key type"); return function(e, t, i) { var r = i.data.p, a = i.data.q, o = i.data.g, l = i.data.pub_key, d = s.signature.decode(e, "der"), c = d.s, h = d.r; u(c, a), u(h, a); var f = n.mont(r), p = c.invm(a); return 0 === o.toRed(f).redPow(new n(t).mul(p).mod(a)).fromRed().mul(l.toRed(f).redPow(h.mul(p) .mod(a)).fromRed()).mod(r).mod(a).cmp(h) }(e, t, c) } if ("rsa" !== l && "ecdsa/rsa" !== l) throw new Error("wrong public key type"); t = r.concat([d, t]); for (var h = c.modulus.byteLength(), f = [1], p = 0; t.length + f.length + 2 < h;) f.push(255), p++; f.push(0); for (var m = -1; ++m < t.length;) f.push(t[m]); f = r.from(f); var g = n.mont(c.modulus); e = (e = new n(e).toRed(g)).redPow(new n(c.publicExponent)), e = r.from(e.fromRed().toArray()); var v = p < 8 ? 1 : 0; for (h = Math.min(e.length, f.length), e.length !== f.length && (v = 1), m = -1; ++m < h;) v |= e[m] ^ f[m]; return 0 === v } }, function(e, t, i) { (function(t) { var r = i(59), n = i(11); e.exports = function(e) { return new s(e) }; var a = { secp256k1: { name: "secp256k1", byteLength: 32 }, secp224r1: { name: "p224", byteLength: 28 }, prime256v1: { name: "p256", byteLength: 32 }, prime192v1: { name: "p192", byteLength: 24 }, ed25519: { name: "ed25519", byteLength: 32 }, secp384r1: { name: "p384", byteLength: 48 }, secp521r1: { name: "p521", byteLength: 66 } }; function s(e) { this.curveType = a[e], this.curveType || (this.curveType = { name: e }), this.curve = new r.ec(this.curveType.name), this.keys = void 0 } function o(e, i, r) { Array.isArray(e) || (e = e.toArray()); var n = new t(e); if (r && n.length < r) { var a = new t(r - n.length); a.fill(0), n = t.concat([a, n]) } return i ? n.toString(i) : n } a.p224 = a.secp224r1, a.p256 = a.secp256r1 = a.prime256v1, a.p192 = a.secp192r1 = a.prime192v1, a.p384 = a.secp384r1, a.p521 = a.secp521r1, s.prototype.generateKeys = function(e, t) { return this.keys = this.curve.genKeyPair(), this.getPublicKey(e, t) }, s.prototype.computeSecret = function(e, i, r) { return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), o(this.curve.keyFromPublic(e) .getPublic().mul(this.keys.getPrivate()).getX(), r, this.curveType.byteLength) }, s.prototype.getPublicKey = function(e, t) { var i = this.keys.getPublic("compressed" === t, !0); return "hybrid" === t && (i[i.length - 1] % 2 ? i[0] = 7 : i[0] = 6), o(i, e) }, s.prototype.getPrivateKey = function(e) { return o(this.keys.getPrivate(), e) }, s.prototype.setPublicKey = function(e, i) { return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this.keys._importPublic(e), this }, s.prototype.setPrivateKey = function(e, i) { i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)); var r = new n(e); return r = r.toString(16), this.keys = this.curve.genKeyPair(), this.keys._importPrivate(r), this } }).call(this, i(10).Buffer) }, function(e, t, i) { t.publicEncrypt = i(225), t.privateDecrypt = i(226), t.privateEncrypt = function(e, i) { return t.publicEncrypt(e, i, !0) }, t.publicDecrypt = function(e, i) { return t.privateDecrypt(e, i, !0) } }, function(e, t, i) { var r = i(42), n = i(24), a = i(31), s = i(120), o = i(121), u = i(11), l = i(122), d = i(58), c = i(6).Buffer; e.exports = function(e, t, i) { var h; h = e.padding ? e.padding : i ? 1 : 4; var f, p = r(e); if (4 === h) f = function(e, t) { var i = e.modulus.byteLength(), r = t.length, l = a("sha1").update(c.alloc(0)).digest(), d = l.length, h = 2 * d; if (r > i - h - 2) throw new Error("message too long"); var f = c.alloc(i - r - h - 2), p = i - d - 1, m = n(d), g = o(c.concat([l, f, c.alloc(1, 1), t], p), s(m, p)), v = o(m, s(g, d)); return new u(c.concat([c.alloc(1), v, g], i)) }(p, t); else if (1 === h) f = function(e, t, i) { var r, a = t.length, s = e.modulus.byteLength(); if (a > s - 11) throw new Error("message too long"); return r = i ? c.alloc(s - a - 3, 255) : function(e) { for (var t, i = c.allocUnsafe(e), r = 0, a = n(2 * e), s = 0; r < e;) s === a.length && (a = n( 2 * e), s = 0), (t = a[s++]) && (i[r++] = t); return i }(s - a - 3), new u(c.concat([c.from([0, i ? 1 : 2]), r, c.alloc(1), t], s)) }(p, t, i); else { if (3 !== h) throw new Error("unknown padding"); if ((f = new u(t)).cmp(p.modulus) >= 0) throw new Error("data too long for modulus") } return i ? d(f, p) : l(f, p) } }, function(e, t, i) { var r = i(42), n = i(120), a = i(121), s = i(11), o = i(58), u = i(31), l = i(122), d = i(6).Buffer; e.exports = function(e, t, i) { var c; c = e.padding ? e.padding : i ? 1 : 4; var h, f = r(e), p = f.modulus.byteLength(); if (t.length > p || new s(t).cmp(f.modulus) >= 0) throw new Error("decryption error"); h = i ? l(new s(t), f) : o(t, f); var m = d.alloc(p - h.length); if (h = d.concat([m, h], p), 4 === c) return function(e, t) { var i = e.modulus.byteLength(), r = u("sha1").update(d.alloc(0)).digest(), s = r.length; if (0 !== t[0]) throw new Error("decryption error"); var o = t.slice(1, s + 1), l = t.slice(s + 1), c = a(o, n(l, s)), h = a(l, n(c, i - s - 1)); if (function(e, t) { e = d.from(e), t = d.from(t); var i = 0, r = e.length; e.length !== t.length && (i++, r = Math.min(e.length, t.length)); for (var n = -1; ++n < r;) i += e[n] ^ t[n]; return i }(r, h.slice(0, s))) throw new Error("decryption error"); for (var f = s; 0 === h[f];) f++; if (1 !== h[f++]) throw new Error("decryption error"); return h.slice(f) }(f, h); if (1 === c) return function(e, t, i) { for (var r = t.slice(0, 2), n = 2, a = 0; 0 !== t[n++];) if (n >= t.length) { a++; break } var s = t.slice(2, n - 1); if (("0002" !== r.toString("hex") && !i || "0001" !== r.toString("hex") && i) && a++, s.length < 8 && a++, a) throw new Error("decryption error"); return t.slice(n) }(0, h, i); if (3 === c) return h; throw new Error("unknown padding") } }, function(e, t, i) { "use strict"; (function(e, r) { function n() { throw new Error( "secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11" ) } var a = i(6), s = i(24), o = a.Buffer, u = a.kMaxLength, l = e.crypto || e.msCrypto, d = Math.pow(2, 32) - 1; function c(e, t) { if ("number" != typeof e || e != e) throw new TypeError("offset must be a number"); if (e > d || e < 0) throw new TypeError("offset must be a uint32"); if (e > u || e > t) throw new RangeError("offset out of range") } function h(e, t, i) { if ("number" != typeof e || e != e) throw new TypeError("size must be a number"); if (e > d || e < 0) throw new TypeError("size must be a uint32"); if (e + t > i || e > u) throw new RangeError("buffer too small") } function f(e, t, i, n) { if (r.browser) { var a = e.buffer, o = new Uint8Array(a, t, i); return l.getRandomValues(o), n ? void r.nextTick(function() { n(null, e) }) : e } if (!n) return s(i).copy(e, t), e; s(i, function(i, r) { if (i) return n(i); r.copy(e, t), n(null, e) }) } l && l.getRandomValues || !r.browser ? (t.randomFill = function(t, i, r, n) { if (!(o.isBuffer(t) || t instanceof e.Uint8Array)) throw new TypeError( '"buf" argument must be a Buffer or Uint8Array'); if ("function" == typeof i) n = i, i = 0, r = t.length; else if ("function" == typeof r) n = r, r = t.length - i; else if ("function" != typeof n) throw new TypeError('"cb" argument must be a function'); return c(i, t.length), h(r, i, t.length), f(t, i, r, n) }, t.randomFillSync = function(t, i, r) { if (void 0 === i && (i = 0), !(o.isBuffer(t) || t instanceof e.Uint8Array)) throw new TypeError( '"buf" argument must be a Buffer or Uint8Array'); return c(i, t.length), void 0 === r && (r = t.length - i), h(r, i, t.length), f(t, i, r) }) : (t.randomFill = n, t.randomFillSync = n) }).call(this, i(13), i(9)) }, function(e, t, i) { "use strict"; i.r(t), i(0); var r = i(19), n = i(43), a = i(36), s = i(2); t.default = function(e) { var t = null, i = function(t, i) { e.postMessage({ msg: "logcat_callback", data: { type: t, logcat: i } }) }.bind(this); n.a.install(), e.addEventListener("message", function(n) { switch (n.data.cmd) { case "init": (t = new a.a(n.data.param[0], n.data.param[1])).on(s.a.IO_ERROR, function(t, i) { e.postMessage({ msg: s.a.IO_ERROR, data: { type: t, info: i } }) }.bind(this)), t.on(s.a.DEMUX_ERROR, function(t, i) { e.postMessage({ msg: s.a.DEMUX_ERROR, data: { type: t, info: i } }) }.bind(this)), t.on(s.a.INIT_SEGMENT, function(t, i) { var r = { msg: s.a.INIT_SEGMENT, data: { type: t, data: i } }; e.postMessage(r, [i.data]) }.bind(this)), t.on(s.a.MEDIA_SEGMENT, function(t, i) { var r = { msg: s.a.MEDIA_SEGMENT, data: { type: t, data: i } }; e.postMessage(r, [i.data]) }.bind(this)), t.on(s.a.LOADING_COMPLETE, function() { var t = { msg: s.a.LOADING_COMPLETE }; e.postMessage(t) }.bind(this)), t.on(s.a.RECOVERED_EARLY_EOF, function() { var t = { msg: s.a.RECOVERED_EARLY_EOF }; e.postMessage(t) }.bind(this)), t.on(s.a.MEDIA_INFO, function(t) { var i = { msg: s.a.MEDIA_INFO, data: t }; e.postMessage(i) }.bind(this)), t.on(s.a.METADATA_ARRIVED, function(t) { var i = { msg: s.a.METADATA_ARRIVED, data: t }; e.postMessage(i) }.bind(this)), t.on(s.a.SCRIPTDATA_ARRIVED, function(t) { var i = { msg: s.a.SCRIPTDATA_ARRIVED, data: t }; e.postMessage(i) }.bind(this)), t.on(s.a.STATISTICS_INFO, function(t) { var i = { msg: s.a.STATISTICS_INFO, data: t }; e.postMessage(i) }.bind(this)), t.on(s.a.RECOMMEND_SEEKPOINT, function(t) { e.postMessage({ msg: s.a.RECOMMEND_SEEKPOINT, data: t }) }.bind(this)); break; case "destroy": t && (t.destroy(), t = null), e.postMessage({ msg: "destroyed" }); break; case "start": t.start(); break; case "stop": t.stop(); break; case "seek": t.seek(n.data.param); break; case "pause": t.pause(); break; case "resume": t.resume(); break; case "logging_config": var o = n.data.param; r.a.applyConfig(o), !0 === o.enableCallback ? r.a.addLogListener(i) : r.a.removeLogListener(i) } }) } }, function(e, t, i) { "use strict"; i.r(t), function(e, r, n, a) { i.d(t, "EasyPlayerWasmModule", function() { return f }), i.d(t, "EasyLoadWasmModule", function() { return p }), i.d(t, "EasyModuleInitialized", function() { return m }); var s, o = i(1), u = !1, l = "", d = void 0 !== d ? d : {}; function c() { var t, o = {}; for (t in d) d.hasOwnProperty(t) && (o[t] = d[t]); var u, c, h, f = [], p = "./this.program", m = function(e, t) { throw t }, g = !1, v = !1; if (g = "object" == typeof window, v = "function" == typeof importScripts, c = "object" == typeof e && "object" == typeof e.versions && "string" == typeof e.versions.node, u = c && !g && !v, h = !g && ! u && !v, d.ENVIRONMENT) throw new Error( "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)" ); var y, _, b, w, E = ""; if (u) E = r + "/", y = function(e, t) { var r; return b || (b = i(69)), w || (w = i(70)), e = w.normalize(e), r = b.readFileSync(e), t ? r : r .toString() }, _ = function(e) { var t = y(e, !0); return t.buffer || (t = new Uint8Array(t)), I(t.buffer), t }, e.argv.length > 1 && (p = e.argv[1].replace(/\\/g, "/")), f = e.argv.slice(2), n.exports = d, e .on("uncaughtException", function(e) { if (!(e instanceof ui)) throw e }), e.on("unhandledRejection", ve), m = function(t) { e.exit(t) }, d.inspect = function() { return "[Emscripten Module object]" }; else if (h) "undefined" != typeof read && (y = function(e) { return read(e) }), _ = function(e) { var t; return "function" == typeof readbuffer ? new Uint8Array(readbuffer(e)) : (I("object" == typeof(t = read(e, "binary"))), t) }, "undefined" != typeof scriptArgs ? f = scriptArgs : void 0 !== arguments && (f = arguments), "function" == typeof quit && (m = function(e) { quit(e) }), "undefined" != typeof print && ("undefined" == typeof console && (console = {}), console.log = print, console.warn = console.error = "undefined" != typeof printErr ? printErr : print); else { if (!g && !v) throw new Error("environment detection error"); v ? E = self.location.href : document.currentScript && (E = document.currentScript.src), E = 0 !== E .indexOf("blob:") ? E.substr(0, E.lastIndexOf("/") + 1) : "", y = function(e) { var t = new XMLHttpRequest; return t.open("GET", e, !1), t.send(null), t.responseText }, v && (_ = function(e) { var t = new XMLHttpRequest; return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t .response) }) } var T = d.print || console.log.bind(console), S = d.printErr || console.warn.bind(console); for (t in o) o.hasOwnProperty(t) && (d[t] = o[t]); function A(e) { A.shown || (A.shown = {}), A.shown[e] || (A.shown[e] = 1, S(e)) } function k(e, t) { var i = C, r = i.length; try { i.grow(1) } catch (e) { if (!e instanceof RangeError) throw e; throw "Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH." } try { i.set(r, e) } catch (a) { if (!a instanceof TypeError) throw a; I(void 0 !== t, "Missing signature argument to addFunction"); var n = function(e, t) { var i = [1, 0, 1, 96], r = t.slice(0, 1), n = t.slice(1), a = { i: 127, j: 126, f: 125, d: 124 }; i.push(n.length); for (var s = 0; s < n.length; ++s) i.push(a[n[s]]); "v" == r ? i.push(0) : i = i.concat([1, a[r]]), i[1] = i.length - 2; var o = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0].concat(i, [2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])), u = new WebAssembly.Module(o); return new WebAssembly.Instance(u, { e: { f: e } }).exports.f }(e, t); i.set(r, n) } return r } o = null, d.arguments && (f = d.arguments), Object.getOwnPropertyDescriptor(d, "arguments") || Object .defineProperty(d, "arguments", { configurable: !0, get: function() { ve("Module.arguments has been replaced with plain arguments_") } }), d.thisProgram && (p = d.thisProgram), Object.getOwnPropertyDescriptor(d, "thisProgram") || Object.defineProperty(d, "thisProgram", { configurable: !0, get: function() { ve("Module.thisProgram has been replaced with plain thisProgram") } }), d.quit && (m = d.quit), Object.getOwnPropertyDescriptor(d, "quit") || Object.defineProperty(d, "quit", { configurable: !0, get: function() { ve("Module.quit has been replaced with plain quit_") } }), I(void 0 === d.memoryInitializerPrefixURL, "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), I( void 0 === d.pthreadMainPrefixURL, "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d .cdInitializerPrefixURL, "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d .filePackagePrefixURL, "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d .read, "Module.read option was removed (modify read_ in JS)"), I(void 0 === d.readAsync, "Module.readAsync option was removed (modify readAsync in JS)"), I(void 0 === d.readBinary, "Module.readBinary option was removed (modify readBinary in JS)"), I(void 0 === d.setWindowTitle, "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"), Object .getOwnPropertyDescriptor(d, "read") || Object.defineProperty(d, "read", { configurable: !0, get: function() { ve("Module.read has been replaced with plain read_") } }), Object.getOwnPropertyDescriptor(d, "readAsync") || Object.defineProperty(d, "readAsync", { configurable: !0, get: function() { ve("Module.readAsync has been replaced with plain readAsync") } }), Object.getOwnPropertyDescriptor(d, "readBinary") || Object.defineProperty(d, "readBinary", { configurable: !0, get: function() { ve("Module.readBinary has been replaced with plain readBinary") } }), ai = oi = si = function() { ve("cannot use the stack before compiled code is ready to run, and has provided stack access") }; var R, M, O = function(e) {}; d.wasmBinary && (R = d.wasmBinary), Object.getOwnPropertyDescriptor(d, "wasmBinary") || Object .defineProperty(d, "wasmBinary", { configurable: !0, get: function() { ve("Module.wasmBinary has been replaced with plain wasmBinary") } }), d.noExitRuntime && (s = d.noExitRuntime), Object.getOwnPropertyDescriptor(d, "noExitRuntime") || Object.defineProperty(d, "noExitRuntime", { configurable: !0, get: function() { ve("Module.noExitRuntime has been replaced with plain noExitRuntime") } }), "object" != typeof WebAssembly && ve( "No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead."); var C = new WebAssembly.Table({ initial: 2542, maximum: 2552, element: "anyfunc" }), D = !1; function I(e, t) { e || ve("Assertion failed: " + t) } function L(e) { var t = d["_" + e]; return I(t, "Cannot call unknown function " + e + ", make sure it is exported"), t } function x(e, t, i, r, n) { var a = { string: function(e) { var t = 0; if (null != e && 0 !== e) { var i = 1 + (e.length << 2); F(e, t = si(i), i) } return t }, array: function(e) { var t = si(e.length); return function(e, t) { I(e.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"), G.set(e, t) }(e, t), t } }, s = L(e), o = [], u = 0; if (I("array" !== t, 'Return type should not be "array".'), r) for (var l = 0; l < r.length; l++) { var d = a[i[l]]; d ? (0 === u && (u = ai()), o[l] = d(r[l])) : o[l] = r[l] } var c = s.apply(null, o); return c = function(e) { return "string" === t ? N(e) : "boolean" === t ? Boolean(e) : e }(c), 0 !== u && oi(u), c } var P = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0; function U(e, t, i) { for (var r = t + i, n = t; e[n] && !(n >= r);) ++n; if (n - t > 16 && e.subarray && P) return P.decode(e.subarray(t, n)); for (var a = ""; t < n;) { var s = e[t++]; if (128 & s) { var o = 63 & e[t++]; if (192 != (224 & s)) { var u = 63 & e[t++]; if (224 == (240 & s) ? s = (15 & s) << 12 | o << 6 | u : (240 != (248 & s) && A( "Invalid UTF-8 leading byte 0x" + s.toString(16) + " encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!" ), s = (7 & s) << 18 | o << 12 | u << 6 | 63 & e[t++]), s < 65536) a += String .fromCharCode(s); else { var l = s - 65536; a += String.fromCharCode(55296 | l >> 10, 56320 | 1023 & l) } } else a += String.fromCharCode((31 & s) << 6 | o) } else a += String.fromCharCode(s) } return a } function N(e, t) { return e ? U(V, e, t) : "" } function B(e, t, i, r) { if (!(r > 0)) return 0; for (var n = i, a = i + r - 1, s = 0; s < e.length; ++s) { var o = e.charCodeAt(s); if (o >= 55296 && o <= 57343 && (o = 65536 + ((1023 & o) << 10) | 1023 & e.charCodeAt(++s)), o <= 127) { if (i >= a) break; t[i++] = o } else if (o <= 2047) { if (i + 1 >= a) break; t[i++] = 192 | o >> 6, t[i++] = 128 | 63 & o } else if (o <= 65535) { if (i + 2 >= a) break; t[i++] = 224 | o >> 12, t[i++] = 128 | o >> 6 & 63, t[i++] = 128 | 63 & o } else { if (i + 3 >= a) break; o >= 2097152 && A("Invalid Unicode code point 0x" + o.toString(16) + " encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)." ), t[i++] = 240 | o >> 18, t[i++] = 128 | o >> 12 & 63, t[i++] = 128 | o >> 6 & 63, t[i++] = 128 | 63 & o } } return t[i] = 0, i - n } function F(e, t, i) { return I("number" == typeof i, "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!" ), B(e, V, t, i) } function j(e) { for (var t = 0, i = 0; i < e.length; ++i) { var r = e.charCodeAt(i); r >= 55296 && r <= 57343 && (r = 65536 + ((1023 & r) << 10) | 1023 & e.charCodeAt(++i)), r <= 127 ? ++t : t += r <= 2047 ? 2 : r <= 65535 ? 3 : 4 } return t } "undefined" != typeof TextDecoder && new TextDecoder("utf-16le"); var H, G, V, W, q, X; function z(e, t) { return e % t > 0 && (e += t - e % t), e } function K(e) { H = e, d.HEAP8 = G = new Int8Array(e), d.HEAP16 = W = new Int16Array(e), d.HEAP32 = q = new Int32Array(e), d.HEAPU8 = V = new Uint8Array(e), d.HEAPU16 = new Uint16Array(e), d.HEAPU32 = X = new Uint32Array(e), d.HEAPF32 = new Float32Array(e), d.HEAPF64 = new Float64Array(e) } var Y = 1341328; I(!0, "stack must start aligned"), I(!0, "heap must start aligned"); var Q = 5242880; d.TOTAL_STACK && I(Q === d.TOTAL_STACK, "the stack size can no longer be determined at runtime"); var J = d.TOTAL_MEMORY || 67108864; function Z() { I(0 == (3 & Y)), X[1 + (Y >> 2)] = 34821223, X[2 + (Y >> 2)] = 2310721022, q[0] = 1668509029 } function $() { var e = X[1 + (Y >> 2)], t = X[2 + (Y >> 2)]; 34821223 == e && 2310721022 == t || ve( "Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x" + t.toString(16) + " " + e.toString(16)), 1668509029 !== q[0] && ve( "Runtime error: The application has corrupted its heap memory area (address zero)!") } function ee(e) { for (; e.length > 0;) { var t = e.shift(); if ("function" != typeof t) { var i = t.func; "number" == typeof i ? void 0 === t.arg ? d.dynCall_v(i) : d.dynCall_vi(i, t.arg) : i(void 0 === t.arg ? null : t.arg) } else t() } } Object.getOwnPropertyDescriptor(d, "TOTAL_MEMORY") || Object.defineProperty(d, "TOTAL_MEMORY", { configurable: !0, get: function() { ve("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY") } }), I(J >= Q, "TOTAL_MEMORY should be larger than TOTAL_STACK, was " + J + "! (TOTAL_STACK=" + Q + ")"), I("undefined" != typeof Int32Array && "undefined" != typeof Float64Array && void 0 !== Int32Array.prototype.subarray && void 0 !== Int32Array.prototype.set, "JS engine does not provide full typed array support"), (M = d.wasmMemory ? d.wasmMemory : new WebAssembly.Memory({ initial: J / 65536 })) && (H = M.buffer), I((J = H.byteLength) % 65536 == 0), K(H), q[335292] = 6584208, function() { var e = new Int16Array(1), t = new Int8Array(e.buffer); if (e[0] = 25459, 115 !== t[0] || 99 !== t[1]) throw "Runtime error: expected the system to be little-endian!" }(); var te = [], ie = [], re = [], ne = [], ae = !1, se = !1; I(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ), I(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ), I(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ), I(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill" ); var oe = Math.abs, ue = Math.ceil, le = Math.floor, de = Math.min, ce = 0, he = null, fe = null, pe = {}; function me(e) { ce++, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(!pe[e]), pe[e] = 1, null === he && "undefined" != typeof setInterval && (he = setInterval(function() { if (D) return clearInterval(he), void(he = null); var e = !1; for (var t in pe) e || (e = !0, S("still waiting on run dependencies:")), S( "dependency: " + t); e && S("(end of list)") }, 1e4))) : S("warning: run dependency added without ID") } function ge(e) { if (ce--, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(pe[e]), delete pe[e]) : S("warning: run dependency removed without ID"), 0 == ce && (null !== he && (clearInterval(he), he = null), fe)) { var t = fe; fe = null, t() } } function ve(e) { throw d.onAbort && d.onAbort(e), T(e += ""), S(e), D = !0, e = "abort(" + e + ") at " + Ae(), new WebAssembly.RuntimeError(e) } d.preloadedImages = {}, d.preloadedAudios = {}; var ye = "data:application/octet-stream;base64,"; function _e(e) { return String.prototype.startsWith ? e.startsWith(ye) : 0 === e.indexOf(ye) } // var be, we, Ee = l + "bigScreen/monitorWarn/EasyPlayer.wasm" var be, we, Ee = l + "EasyPlayer.wasm"; function Te() { try { if (R) return new Uint8Array(R); if (_) return _(Ee); throw "both async and sync fetching of the wasm failed" } catch (e) { ve(e) } } function Se(e) { return e.replace(/\b_Z[\w\d_]+/g, function(e) { var t = function(e) { return A("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"), e }(e); return e === t ? e : t + " [" + e + "]" }) } function Ae() { var e = function() { var e = new Error; if (!e.stack) { try { throw new Error(0) } catch (t) { e = t } if (!e.stack) return "(no stack trace available)" } return e.stack.toString() }(); return d.extraStackTrace && (e += "\n" + d.extraStackTrace()), Se(e) } _e(Ee) || (Ee = function(e) { return d.locateFile ? d.locateFile(e, E) : E + e }(Ee)), ie.push({ func: function() { ii() } }); var ke = {}; function Re(e) { return d.___errno_location ? q[d.___errno_location() >> 2] = e : S("failed to set errno from JS"), e } var Me = { splitPath: function(e) { return /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1) }, normalizeArray: function(e, t) { for (var i = 0, r = e.length - 1; r >= 0; r--) { var n = e[r]; "." === n ? e.splice(r, 1) : ".." === n ? (e.splice(r, 1), i++) : i && (e.splice(r, 1), i--) } if (t) for (; i; i--) e.unshift(".."); return e }, normalize: function(e) { var t = "/" === e.charAt(0), i = "/" === e.substr(-1); return (e = Me.normalizeArray(e.split("/").filter(function(e) { return !!e }), !t).join("/")) || t || (e = "."), e && i && (e += "/"), (t ? "/" : "") + e }, dirname: function(e) { var t = Me.splitPath(e), i = t[0], r = t[1]; return i || r ? (r && (r = r.substr(0, r.length - 1)), i + r) : "." }, basename: function(e) { if ("/" === e) return "/"; var t = e.lastIndexOf("/"); return -1 === t ? e : e.substr(t + 1) }, extname: function(e) { return Me.splitPath(e)[3] }, join: function() { var e = Array.prototype.slice.call(arguments, 0); return Me.normalize(e.join("/")) }, join2: function(e, t) { return Me.normalize(e + "/" + t) } }, Oe = { resolve: function() { for (var e = "", t = !1, i = arguments.length - 1; i >= -1 && !t; i--) { var r = i >= 0 ? arguments[i] : xe.cwd(); if ("string" != typeof r) throw new TypeError("Arguments to path.resolve must be strings"); if (!r) return ""; e = r + "/" + e, t = "/" === r.charAt(0) } return (t ? "/" : "") + (e = Me.normalizeArray(e.split("/").filter(function(e) { return !!e }), !t).join("/")) || "." }, relative: function(e, t) { function i(e) { for (var t = 0; t < e.length && "" === e[t]; t++); for (var i = e.length - 1; i >= 0 && "" === e[i]; i--); return t > i ? [] : e.slice(t, i - t + 1) } e = Oe.resolve(e).substr(1), t = Oe.resolve(t).substr(1); for (var r = i(e.split("/")), n = i(t.split("/")), a = Math.min(r.length, n.length), s = a, o = 0; o < a; o++) if (r[o] !== n[o]) { s = o; break } var u = []; for (o = s; o < r.length; o++) u.push(".."); return (u = u.concat(n.slice(s))).join("/") } }, Ce = { ttys: [], init: function() {}, shutdown: function() {}, register: function(e, t) { Ce.ttys[e] = { input: [], output: [], ops: t }, xe.registerDevice(e, Ce.stream_ops) }, stream_ops: { open: function(e) { var t = Ce.ttys[e.node.rdev]; if (!t) throw new xe.ErrnoError(43); e.tty = t, e.seekable = !1 }, close: function(e) { e.tty.ops.flush(e.tty) }, flush: function(e) { e.tty.ops.flush(e.tty) }, read: function(e, t, i, r, n) { if (!e.tty || !e.tty.ops.get_char) throw new xe.ErrnoError(60); for (var a = 0, s = 0; s < r; s++) { var o; try { o = e.tty.ops.get_char(e.tty) } catch (e) { throw new xe.ErrnoError(29) } if (void 0 === o && 0 === a) throw new xe.ErrnoError(6); if (null == o) break; a++, t[i + s] = o } return a && (e.node.timestamp = Date.now()), a }, write: function(e, t, i, r, n) { if (!e.tty || !e.tty.ops.put_char) throw new xe.ErrnoError(60); try { for (var a = 0; a < r; a++) e.tty.ops.put_char(e.tty, t[i + a]) } catch (e) { throw new xe.ErrnoError(29) } return r && (e.node.timestamp = Date.now()), a } }, default_tty_ops: { get_char: function(t) { if (!t.input.length) { var i = null; if (u) { var r = a.alloc ? a.alloc(256) : new a(256), n = 0; try { n = b.readSync(e.stdin.fd, r, 0, 256, null) } catch (e) { if (-1 == e.toString().indexOf("EOF")) throw e; n = 0 } i = n > 0 ? r.slice(0, n).toString("utf-8") : null } else "undefined" != typeof window && "function" == typeof window.prompt ? null !== (i = window.prompt("Input: ")) && (i += "\n") : "function" == typeof readline && null !== ( i = readline()) && (i += "\n"); if (!i) return null; t.input = Be(i, !0) } return t.input.shift() }, put_char: function(e, t) { null === t || 10 === t ? e.output = [] : 0 != t && e.output.push(t) }, flush: function(e) { e.output && e.output.length > 0 && (e.output = []) } }, default_tty1_ops: { put_char: function(e, t) { null === t || 10 === t ? (S(U(e.output, 0)), e.output = []) : 0 != t && e.output.push(t) }, flush: function(e) { e.output && e.output.length > 0 && (S(U(e.output, 0)), e.output = []) } } }, De = { ops_table: null, mount: function(e) { return De.createNode(null, "/", 16895, 0) }, createNode: function(e, t, i, r) { if (xe.isBlkdev(i) || xe.isFIFO(i)) throw new xe.ErrnoError(63); De.ops_table || (De.ops_table = { dir: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr, lookup: De.node_ops.lookup, mknod: De.node_ops.mknod, rename: De.node_ops.rename, unlink: De.node_ops.unlink, rmdir: De.node_ops.rmdir, readdir: De.node_ops.readdir, symlink: De.node_ops.symlink }, stream: { llseek: De.stream_ops.llseek } }, file: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr }, stream: { llseek: De.stream_ops.llseek, read: De.stream_ops.read, write: De.stream_ops.write, allocate: De.stream_ops.allocate, mmap: De.stream_ops.mmap, msync: De.stream_ops.msync } }, link: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr, readlink: De.node_ops.readlink }, stream: {} }, chrdev: { node: { getattr: De.node_ops.getattr, setattr: De.node_ops.setattr }, stream: xe.chrdev_stream_ops } }); var n = xe.createNode(e, t, i, r); return xe.isDir(n.mode) ? (n.node_ops = De.ops_table.dir.node, n.stream_ops = De.ops_table.dir .stream, n.contents = {}) : xe.isFile(n.mode) ? (n.node_ops = De.ops_table.file.node, n .stream_ops = De.ops_table.file.stream, n.usedBytes = 0, n.contents = null) : xe.isLink(n .mode) ? (n.node_ops = De.ops_table.link.node, n.stream_ops = De.ops_table.link.stream) : xe.isChrdev(n.mode) && (n.node_ops = De.ops_table.chrdev.node, n.stream_ops = De.ops_table .chrdev.stream), n.timestamp = Date.now(), e && (e.contents[t] = n), n }, getFileDataAsRegularArray: function(e) { if (e.contents && e.contents.subarray) { for (var t = [], i = 0; i < e.usedBytes; ++i) t.push(e.contents[i]); return t } return e.contents }, getFileDataAsTypedArray: function(e) { return e.contents ? e.contents.subarray ? e.contents.subarray(0, e.usedBytes) : new Uint8Array(e.contents) : new Uint8Array }, expandFileStorage: function(e, t) { var i = e.contents ? e.contents.length : 0; if (!(i >= t)) { t = Math.max(t, i * (i < 1048576 ? 2 : 1.125) | 0), 0 != i && (t = Math.max(t, 256)); var r = e.contents; e.contents = new Uint8Array(t), e.usedBytes > 0 && e.contents.set(r.subarray(0, e .usedBytes), 0) } }, resizeFileStorage: function(e, t) { if (e.usedBytes != t) { if (0 == t) return e.contents = null, void(e.usedBytes = 0); if (!e.contents || e.contents.subarray) { var i = e.contents; return e.contents = new Uint8Array(new ArrayBuffer(t)), i && e.contents.set(i.subarray(0, Math.min(t, e.usedBytes))), void(e.usedBytes = t) } if (e.contents || (e.contents = []), e.contents.length > t) e.contents.length = t; else for (; e.contents.length < t;) e.contents.push(0); e.usedBytes = t } }, node_ops: { getattr: function(e) { var t = {}; return t.dev = xe.isChrdev(e.mode) ? e.id : 1, t.ino = e.id, t.mode = e.mode, t.nlink = 1, t .uid = 0, t.gid = 0, t.rdev = e.rdev, xe.isDir(e.mode) ? t.size = 4096 : xe.isFile(e .mode) ? t.size = e.usedBytes : xe.isLink(e.mode) ? t.size = e.link.length : t.size = 0, t .atime = new Date(e.timestamp), t.mtime = new Date(e.timestamp), t.ctime = new Date(e .timestamp), t.blksize = 4096, t.blocks = Math.ceil(t.size / t.blksize), t }, setattr: function(e, t) { void 0 !== t.mode && (e.mode = t.mode), void 0 !== t.timestamp && (e.timestamp = t .timestamp), void 0 !== t.size && De.resizeFileStorage(e, t.size) }, lookup: function(e, t) { throw xe.genericErrors[44] }, mknod: function(e, t, i, r) { return De.createNode(e, t, i, r) }, rename: function(e, t, i) { if (xe.isDir(e.mode)) { var r; try { r = xe.lookupNode(t, i) } catch (e) {} if (r) for (var n in r.contents) throw new xe.ErrnoError(55) } delete e.parent.contents[e.name], e.name = i, t.contents[i] = e, e.parent = t }, unlink: function(e, t) { delete e.contents[t] }, rmdir: function(e, t) { var i = xe.lookupNode(e, t); for (var r in i.contents) throw new xe.ErrnoError(55); delete e.contents[t] }, readdir: function(e) { var t = [".", ".."]; for (var i in e.contents) e.contents.hasOwnProperty(i) && t.push(i); return t }, symlink: function(e, t, i) { var r = De.createNode(e, t, 41471, 0); return r.link = i, r }, readlink: function(e) { if (!xe.isLink(e.mode)) throw new xe.ErrnoError(28); return e.link } }, stream_ops: { read: function(e, t, i, r, n) { var a = e.node.contents; if (n >= e.node.usedBytes) return 0; var s = Math.min(e.node.usedBytes - n, r); if (I(s >= 0), s > 8 && a.subarray) t.set(a.subarray(n, n + s), i); else for (var o = 0; o < s; o++) t[i + o] = a[n + o]; return s }, write: function(e, t, i, r, n, a) { if (a && A( "file packager has copied file data into memory, but in memory growth we are forced to copy it again (see --no-heap-copy)" ), a = !1, !r) return 0; var s = e.node; if (s.timestamp = Date.now(), t.subarray && (!s.contents || s.contents.subarray)) { if (a) return I(0 === n, "canOwn must imply no weird position inside the file"), s .contents = t.subarray(i, i + r), s.usedBytes = r, r; if (0 === s.usedBytes && 0 === n) return s.contents = new Uint8Array(t.subarray(i, i + r)), s.usedBytes = r, r; if (n + r <= s.usedBytes) return s.contents.set(t.subarray(i, i + r), n), r } if (De.expandFileStorage(s, n + r), s.contents.subarray && t.subarray) s.contents.set(t .subarray(i, i + r), n); else for (var o = 0; o < r; o++) s.contents[n + o] = t[i + o]; return s.usedBytes = Math.max(s.usedBytes, n + r), r }, llseek: function(e, t, i) { var r = t; if (1 === i ? r += e.position : 2 === i && xe.isFile(e.node.mode) && (r += e.node .usedBytes), r < 0) throw new xe.ErrnoError(28); return r }, allocate: function(e, t, i) { De.expandFileStorage(e.node, t + i), e.node.usedBytes = Math.max(e.node.usedBytes, t + i) }, mmap: function(e, t, i, r, n, a, s) { if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43); var o, u, l = e.node.contents; if (2 & s || l.buffer !== t && l.buffer !== t.buffer) { (n > 0 || n + r < e.node.usedBytes) && (l = l.subarray ? l.subarray(n, n + r) : Array .prototype.slice.call(l, n, n + r)), u = !0; var d = t.buffer == G.buffer; if (!(o = ri(r))) throw new xe.ErrnoError(48); (d ? G : t).set(l, o) } else u = !1, o = l.byteOffset; return { ptr: o, allocated: u } }, msync: function(e, t, i, r, n) { if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43); return 2 & n ? 0 : (De.stream_ops.write(e, t, 0, r, i, !1), 0) } } }, Ie = { 0: "Success", 1: "Arg list too long", 2: "Permission denied", 3: "Address already in use", 4: "Address not available", 5: "Address family not supported by protocol family", 6: "No more processes", 7: "Socket already connected", 8: "Bad file number", 9: "Trying to read unreadable message", 10: "Mount device busy", 11: "Operation canceled", 12: "No children", 13: "Connection aborted", 14: "Connection refused", 15: "Connection reset by peer", 16: "File locking deadlock error", 17: "Destination address required", 18: "Math arg out of domain of func", 19: "Quota exceeded", 20: "File exists", 21: "Bad address", 22: "File too large", 23: "Host is unreachable", 24: "Identifier removed", 25: "Illegal byte sequence", 26: "Connection already in progress", 27: "Interrupted system call", 28: "Invalid argument", 29: "I/O error", 30: "Socket is already connected", 31: "Is a directory", 32: "Too many symbolic links", 33: "Too many open files", 34: "Too many links", 35: "Message too long", 36: "Multihop attempted", 37: "File or path name too long", 38: "Network interface is not configured", 39: "Connection reset by network", 40: "Network is unreachable", 41: "Too many open files in system", 42: "No buffer space available", 43: "No such device", 44: "No such file or directory", 45: "Exec format error", 46: "No record locks available", 47: "The link has been severed", 48: "Not enough core", 49: "No message of desired type", 50: "Protocol not available", 51: "No space left on device", 52: "Function not implemented", 53: "Socket is not connected", 54: "Not a directory", 55: "Directory not empty", 56: "State not recoverable", 57: "Socket operation on non-socket", 59: "Not a typewriter", 60: "No such device or address", 61: "Value too large for defined data type", 62: "Previous owner died", 63: "Not super-user", 64: "Broken pipe", 65: "Protocol error", 66: "Unknown protocol", 67: "Protocol wrong type for socket", 68: "Math result not representable", 69: "Read only file system", 70: "Illegal seek", 71: "No such process", 72: "Stale file handle", 73: "Connection timed out", 74: "Text file busy", 75: "Cross-device link", 100: "Device not a stream", 101: "Bad font file fmt", 102: "Invalid slot", 103: "Invalid request code", 104: "No anode", 105: "Block device required", 106: "Channel number out of range", 107: "Level 3 halted", 108: "Level 3 reset", 109: "Link number out of range", 110: "Protocol driver not attached", 111: "No CSI structure available", 112: "Level 2 halted", 113: "Invalid exchange", 114: "Invalid request descriptor", 115: "Exchange full", 116: "No data (for no delay io)", 117: "Timer expired", 118: "Out of streams resources", 119: "Machine is not on the network", 120: "Package not installed", 121: "The object is remote", 122: "Advertise error", 123: "Srmount error", 124: "Communication error on send", 125: "Cross mount point (not really error)", 126: "Given log. name not unique", 127: "f.d. invalid for this operation", 128: "Remote address changed", 129: "Can access a needed shared lib", 130: "Accessing a corrupted shared lib", 131: ".lib section in a.out corrupted", 132: "Attempting to link in too many libs", 133: "Attempting to exec a shared library", 135: "Streams pipe error", 136: "Too many users", 137: "Socket type not supported", 138: "Not supported", 139: "Protocol family not supported", 140: "Can't send after socket shutdown", 141: "Too many references", 142: "Host is down", 148: "No medium (in tape drive)", 156: "Level 2 not synchronized" }, Le = { EPERM: 63, ENOENT: 44, ESRCH: 71, EINTR: 27, EIO: 29, ENXIO: 60, E2BIG: 1, ENOEXEC: 45, EBADF: 8, ECHILD: 12, EAGAIN: 6, EWOULDBLOCK: 6, ENOMEM: 48, EACCES: 2, EFAULT: 21, ENOTBLK: 105, EBUSY: 10, EEXIST: 20, EXDEV: 75, ENODEV: 43, ENOTDIR: 54, EISDIR: 31, EINVAL: 28, ENFILE: 41, EMFILE: 33, ENOTTY: 59, ETXTBSY: 74, EFBIG: 22, ENOSPC: 51, ESPIPE: 70, EROFS: 69, EMLINK: 34, EPIPE: 64, EDOM: 18, ERANGE: 68, ENOMSG: 49, EIDRM: 24, ECHRNG: 106, EL2NSYNC: 156, EL3HLT: 107, EL3RST: 108, ELNRNG: 109, EUNATCH: 110, ENOCSI: 111, EL2HLT: 112, EDEADLK: 16, ENOLCK: 46, EBADE: 113, EBADR: 114, EXFULL: 115, ENOANO: 104, EBADRQC: 103, EBADSLT: 102, EDEADLOCK: 16, EBFONT: 101, ENOSTR: 100, ENODATA: 116, ETIME: 117, ENOSR: 118, ENONET: 119, ENOPKG: 120, EREMOTE: 121, ENOLINK: 47, EADV: 122, ESRMNT: 123, ECOMM: 124, EPROTO: 65, EMULTIHOP: 36, EDOTDOT: 125, EBADMSG: 9, ENOTUNIQ: 126, EBADFD: 127, EREMCHG: 128, ELIBACC: 129, ELIBBAD: 130, ELIBSCN: 131, ELIBMAX: 132, ELIBEXEC: 133, ENOSYS: 52, ENOTEMPTY: 55, ENAMETOOLONG: 37, ELOOP: 32, EOPNOTSUPP: 138, EPFNOSUPPORT: 139, ECONNRESET: 15, ENOBUFS: 42, EAFNOSUPPORT: 5, EPROTOTYPE: 67, ENOTSOCK: 57, ENOPROTOOPT: 50, ESHUTDOWN: 140, ECONNREFUSED: 14, EADDRINUSE: 3, ECONNABORTED: 13, ENETUNREACH: 40, ENETDOWN: 38, ETIMEDOUT: 73, EHOSTDOWN: 142, EHOSTUNREACH: 23, EINPROGRESS: 26, EALREADY: 7, EDESTADDRREQ: 17, EMSGSIZE: 35, EPROTONOSUPPORT: 66, ESOCKTNOSUPPORT: 137, EADDRNOTAVAIL: 4, ENETRESET: 39, EISCONN: 30, ENOTCONN: 53, ETOOMANYREFS: 141, EUSERS: 136, EDQUOT: 19, ESTALE: 72, ENOTSUP: 138, ENOMEDIUM: 148, EILSEQ: 25, EOVERFLOW: 61, ECANCELED: 11, ENOTRECOVERABLE: 56, EOWNERDEAD: 62, ESTRPIPE: 135 }, xe = { root: null, mounts: [], devices: {}, streams: [], nextInode: 1, nameTable: null, currentPath: "/", initialized: !1, ignorePermissions: !0, trackingDelegate: {}, tracking: { openFlags: { READ: 1, WRITE: 2 } }, ErrnoError: null, genericErrors: {}, filesystems: null, syncFSRequests: 0, handleFSError: function(e) { if (!(e instanceof xe.ErrnoError)) throw e + " : " + Ae(); return Re(e.errno) }, lookupPath: function(e, t) { if (t = t || {}, !(e = Oe.resolve(xe.cwd(), e))) return { path: "", node: null }; var i = { follow_mount: !0, recurse_count: 0 }; for (var r in i) void 0 === t[r] && (t[r] = i[r]); if (t.recurse_count > 8) throw new xe.ErrnoError(32); for (var n = Me.normalizeArray(e.split("/").filter(function(e) { return !!e }), !1), a = xe.root, s = "/", o = 0; o < n.length; o++) { var u = o === n.length - 1; if (u && t.parent) break; if (a = xe.lookupNode(a, n[o]), s = Me.join2(s, n[o]), xe.isMountpoint(a) && (!u || u && t .follow_mount) && (a = a.mounted.root), !u || t.follow) for (var l = 0; xe.isLink(a.mode);) { var d = xe.readlink(s); if (s = Oe.resolve(Me.dirname(s), d), a = xe.lookupPath(s, { recurse_count: t.recurse_count }).node, l++ > 40) throw new xe.ErrnoError(32) } } return { path: s, node: a } }, getPath: function(e) { for (var t;;) { if (xe.isRoot(e)) { var i = e.mount.mountpoint; return t ? "/" !== i[i.length - 1] ? i + "/" + t : i + t : i } t = t ? e.name + "/" + t : e.name, e = e.parent } }, hashName: function(e, t) { for (var i = 0, r = 0; r < t.length; r++) i = (i << 5) - i + t.charCodeAt(r) | 0; return (e + i >>> 0) % xe.nameTable.length }, hashAddNode: function(e) { var t = xe.hashName(e.parent.id, e.name); e.name_next = xe.nameTable[t], xe.nameTable[t] = e }, hashRemoveNode: function(e) { var t = xe.hashName(e.parent.id, e.name); if (xe.nameTable[t] === e) xe.nameTable[t] = e.name_next; else for (var i = xe.nameTable[t]; i;) { if (i.name_next === e) { i.name_next = e.name_next; break } i = i.name_next } }, lookupNode: function(e, t) { var i = xe.mayLookup(e); if (i) throw new xe.ErrnoError(i, e); for (var r = xe.hashName(e.id, t), n = xe.nameTable[r]; n; n = n.name_next) { var a = n.name; if (n.parent.id === e.id && a === t) return n } return xe.lookup(e, t) }, createNode: function(e, t, i, r) { xe.FSNode || (xe.FSNode = function(e, t, i, r) { e || (e = this), this.parent = e, this.mount = e.mount, this.mounted = null, this.id = xe.nextInode++, this.name = t, this.mode = i, this.node_ops = {}, this .stream_ops = {}, this.rdev = r }, xe.FSNode.prototype = {}, Object.defineProperties(xe.FSNode.prototype, { read: { get: function() { return 365 == (365 & this.mode) }, set: function(e) { e ? this.mode |= 365 : this.mode &= -366 } }, write: { get: function() { return 146 == (146 & this.mode) }, set: function(e) { e ? this.mode |= 146 : this.mode &= -147 } }, isFolder: { get: function() { return xe.isDir(this.mode) } }, isDevice: { get: function() { return xe.isChrdev(this.mode) } } })); var n = new xe.FSNode(e, t, i, r); return xe.hashAddNode(n), n }, destroyNode: function(e) { xe.hashRemoveNode(e) }, isRoot: function(e) { return e === e.parent }, isMountpoint: function(e) { return !!e.mounted }, isFile: function(e) { return 32768 == (61440 & e) }, isDir: function(e) { return 16384 == (61440 & e) }, isLink: function(e) { return 40960 == (61440 & e) }, isChrdev: function(e) { return 8192 == (61440 & e) }, isBlkdev: function(e) { return 24576 == (61440 & e) }, isFIFO: function(e) { return 4096 == (61440 & e) }, isSocket: function(e) { return 49152 == (49152 & e) }, flagModes: { r: 0, rs: 1052672, "r+": 2, w: 577, wx: 705, xw: 705, "w+": 578, "wx+": 706, "xw+": 706, a: 1089, ax: 1217, xa: 1217, "a+": 1090, "ax+": 1218, "xa+": 1218 }, modeStringToFlags: function(e) { var t = xe.flagModes[e]; if (void 0 === t) throw new Error("Unknown file open mode: " + e); return t }, flagsToPermissionString: function(e) { var t = ["r", "w", "rw"][3 & e]; return 512 & e && (t += "w"), t }, nodePermissions: function(e, t) { return xe.ignorePermissions || (-1 === t.indexOf("r") || 292 & e.mode) && (-1 === t.indexOf( "w") || 146 & e.mode) && (-1 === t.indexOf("x") || 73 & e.mode) ? 0 : 2 }, mayLookup: function(e) { return xe.nodePermissions(e, "x") || (e.node_ops.lookup ? 0 : 2) }, mayCreate: function(e, t) { try { return xe.lookupNode(e, t), 20 } catch (e) {} return xe.nodePermissions(e, "wx") }, mayDelete: function(e, t, i) { var r; try { r = xe.lookupNode(e, t) } catch (e) { return e.errno } var n = xe.nodePermissions(e, "wx"); if (n) return n; if (i) { if (!xe.isDir(r.mode)) return 54; if (xe.isRoot(r) || xe.getPath(r) === xe.cwd()) return 10 } else if (xe.isDir(r.mode)) return 31; return 0 }, mayOpen: function(e, t) { return e ? xe.isLink(e.mode) ? 32 : xe.isDir(e.mode) && ("r" !== xe.flagsToPermissionString( t) || 512 & t) ? 31 : xe.nodePermissions(e, xe.flagsToPermissionString(t)) : 44 }, MAX_OPEN_FDS: 4096, nextfd: function(e, t) { e = e || 0, t = t || xe.MAX_OPEN_FDS; for (var i = e; i <= t; i++) if (!xe.streams[i]) return i; throw new xe.ErrnoError(33) }, getStream: function(e) { return xe.streams[e] }, createStream: function(e, t, i) { xe.FSStream || (xe.FSStream = function() {}, xe.FSStream.prototype = {}, Object .defineProperties(xe.FSStream.prototype, { object: { get: function() { return this.node }, set: function(e) { this.node = e } }, isRead: { get: function() { return 1 != (2097155 & this.flags) } }, isWrite: { get: function() { return 0 != (2097155 & this.flags) } }, isAppend: { get: function() { return 1024 & this.flags } } })); var r = new xe.FSStream; for (var n in e) r[n] = e[n]; e = r; var a = xe.nextfd(t, i); return e.fd = a, xe.streams[a] = e, e }, closeStream: function(e) { xe.streams[e] = null }, chrdev_stream_ops: { open: function(e) { var t = xe.getDevice(e.node.rdev); e.stream_ops = t.stream_ops, e.stream_ops.open && e.stream_ops.open(e) }, llseek: function() { throw new xe.ErrnoError(70) } }, major: function(e) { return e >> 8 }, minor: function(e) { return 255 & e }, makedev: function(e, t) { return e << 8 | t }, registerDevice: function(e, t) { xe.devices[e] = { stream_ops: t } }, getDevice: function(e) { return xe.devices[e] }, getMounts: function(e) { for (var t = [], i = [e]; i.length;) { var r = i.pop(); t.push(r), i.push.apply(i, r.mounts) } return t }, syncfs: function(e, t) { "function" == typeof e && (t = e, e = !1), xe.syncFSRequests++, xe.syncFSRequests > 1 && console.log("warning: " + xe.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work"); var i = xe.getMounts(xe.root.mount), r = 0; function n(e) { return I(xe.syncFSRequests > 0), xe.syncFSRequests--, t(e) } function a(e) { if (e) return a.errored ? void 0 : (a.errored = !0, n(e)); ++r >= i.length && n(null) } i.forEach(function(t) { if (!t.type.syncfs) return a(null); t.type.syncfs(t, e, a) }) }, mount: function(e, t, i) { if ("string" == typeof e) throw e; var r, n = "/" === i, a = !i; if (n && xe.root) throw new xe.ErrnoError(10); if (!n && !a) { var s = xe.lookupPath(i, { follow_mount: !1 }); if (i = s.path, r = s.node, xe.isMountpoint(r)) throw new xe.ErrnoError(10); if (!xe.isDir(r.mode)) throw new xe.ErrnoError(54) } var o = { type: e, opts: t, mountpoint: i, mounts: [] }, u = e.mount(o); return u.mount = o, o.root = u, n ? xe.root = u : r && (r.mounted = o, r.mount && r.mount .mounts.push(o)), u }, unmount: function(e) { var t = xe.lookupPath(e, { follow_mount: !1 }); if (!xe.isMountpoint(t.node)) throw new xe.ErrnoError(28); var i = t.node, r = i.mounted, n = xe.getMounts(r); Object.keys(xe.nameTable).forEach(function(e) { for (var t = xe.nameTable[e]; t;) { var i = t.name_next; - 1 !== n.indexOf(t.mount) && xe.destroyNode(t), t = i } }), i.mounted = null; var a = i.mount.mounts.indexOf(r); I(-1 !== a), i.mount.mounts.splice(a, 1) }, lookup: function(e, t) { return e.node_ops.lookup(e, t) }, mknod: function(e, t, i) { var r = xe.lookupPath(e, { parent: !0 }).node, n = Me.basename(e); if (!n || "." === n || ".." === n) throw new xe.ErrnoError(28); var a = xe.mayCreate(r, n); if (a) throw new xe.ErrnoError(a); if (!r.node_ops.mknod) throw new xe.ErrnoError(63); return r.node_ops.mknod(r, n, t, i) }, create: function(e, t) { return t = void 0 !== t ? t : 438, t &= 4095, t |= 32768, xe.mknod(e, t, 0) }, mkdir: function(e, t) { return t = void 0 !== t ? t : 511, t &= 1023, t |= 16384, xe.mknod(e, t, 0) }, mkdirTree: function(e, t) { for (var i = e.split("/"), r = "", n = 0; n < i.length; ++n) if (i[n]) { r += "/" + i[n]; try { xe.mkdir(r, t) } catch (e) { if (20 != e.errno) throw e } } }, mkdev: function(e, t, i) { return void 0 === i && (i = t, t = 438), t |= 8192, xe.mknod(e, t, i) }, symlink: function(e, t) { if (!Oe.resolve(e)) throw new xe.ErrnoError(44); var i = xe.lookupPath(t, { parent: !0 }).node; if (!i) throw new xe.ErrnoError(44); var r = Me.basename(t), n = xe.mayCreate(i, r); if (n) throw new xe.ErrnoError(n); if (!i.node_ops.symlink) throw new xe.ErrnoError(63); return i.node_ops.symlink(i, r, e) }, rename: function(e, t) { var i, r, n = Me.dirname(e), a = Me.dirname(t), s = Me.basename(e), o = Me.basename(t); try { i = xe.lookupPath(e, { parent: !0 }).node, r = xe.lookupPath(t, { parent: !0 }).node } catch (e) { throw new xe.ErrnoError(10) } if (!i || !r) throw new xe.ErrnoError(44); if (i.mount !== r.mount) throw new xe.ErrnoError(75); var u, l = xe.lookupNode(i, s), d = Oe.relative(e, a); if ("." !== d.charAt(0)) throw new xe.ErrnoError(28); if ("." !== (d = Oe.relative(t, n)).charAt(0)) throw new xe.ErrnoError(55); try { u = xe.lookupNode(r, o) } catch (e) {} if (l !== u) { var c = xe.isDir(l.mode), h = xe.mayDelete(i, s, c); if (h) throw new xe.ErrnoError(h); if (h = u ? xe.mayDelete(r, o, c) : xe.mayCreate(r, o)) throw new xe.ErrnoError(h); if (!i.node_ops.rename) throw new xe.ErrnoError(63); if (xe.isMountpoint(l) || u && xe.isMountpoint(u)) throw new xe.ErrnoError(10); if (r !== i && (h = xe.nodePermissions(i, "w"))) throw new xe.ErrnoError(h); try { xe.trackingDelegate.willMovePath && xe.trackingDelegate.willMovePath(e, t) } catch (i) { console.log("FS.trackingDelegate['willMovePath']('" + e + "', '" + t + "') threw an exception: " + i.message) } xe.hashRemoveNode(l); try { i.node_ops.rename(l, r, o) } catch (e) { throw e } finally { xe.hashAddNode(l) } try { xe.trackingDelegate.onMovePath && xe.trackingDelegate.onMovePath(e, t) } catch (i) { console.log("FS.trackingDelegate['onMovePath']('" + e + "', '" + t + "') threw an exception: " + i.message) } } }, rmdir: function(e) { var t = xe.lookupPath(e, { parent: !0 }).node, i = Me.basename(e), r = xe.lookupNode(t, i), n = xe.mayDelete(t, i, !0); if (n) throw new xe.ErrnoError(n); if (!t.node_ops.rmdir) throw new xe.ErrnoError(63); if (xe.isMountpoint(r)) throw new xe.ErrnoError(10); try { xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t .message) } t.node_ops.rmdir(t, i), xe.destroyNode(r); try { xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t .message) } }, readdir: function(e) { var t = xe.lookupPath(e, { follow: !0 }).node; if (!t.node_ops.readdir) throw new xe.ErrnoError(54); return t.node_ops.readdir(t) }, unlink: function(e) { var t = xe.lookupPath(e, { parent: !0 }).node, i = Me.basename(e), r = xe.lookupNode(t, i), n = xe.mayDelete(t, i, !1); if (n) throw new xe.ErrnoError(n); if (!t.node_ops.unlink) throw new xe.ErrnoError(63); if (xe.isMountpoint(r)) throw new xe.ErrnoError(10); try { xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t .message) } t.node_ops.unlink(t, i), xe.destroyNode(r); try { xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e) } catch (t) { console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t .message) } }, readlink: function(e) { var t = xe.lookupPath(e).node; if (!t) throw new xe.ErrnoError(44); if (!t.node_ops.readlink) throw new xe.ErrnoError(28); return Oe.resolve(xe.getPath(t.parent), t.node_ops.readlink(t)) }, stat: function(e, t) { var i = xe.lookupPath(e, { follow: !t }).node; if (!i) throw new xe.ErrnoError(44); if (!i.node_ops.getattr) throw new xe.ErrnoError(63); return i.node_ops.getattr(i) }, lstat: function(e) { return xe.stat(e, !0) }, chmod: function(e, t, i) { var r; if (!(r = "string" == typeof e ? xe.lookupPath(e, { follow: !i }).node : e).node_ops.setattr) throw new xe.ErrnoError(63); r.node_ops.setattr(r, { mode: 4095 & t | -4096 & r.mode, timestamp: Date.now() }) }, lchmod: function(e, t) { xe.chmod(e, t, !0) }, fchmod: function(e, t) { var i = xe.getStream(e); if (!i) throw new xe.ErrnoError(8); xe.chmod(i.node, t) }, chown: function(e, t, i, r) { var n; if (!(n = "string" == typeof e ? xe.lookupPath(e, { follow: !r }).node : e).node_ops.setattr) throw new xe.ErrnoError(63); n.node_ops.setattr(n, { timestamp: Date.now() }) }, lchown: function(e, t, i) { xe.chown(e, t, i, !0) }, fchown: function(e, t, i) { var r = xe.getStream(e); if (!r) throw new xe.ErrnoError(8); xe.chown(r.node, t, i) }, truncate: function(e, t) { if (t < 0) throw new xe.ErrnoError(28); var i; if (!(i = "string" == typeof e ? xe.lookupPath(e, { follow: !0 }).node : e).node_ops.setattr) throw new xe.ErrnoError(63); if (xe.isDir(i.mode)) throw new xe.ErrnoError(31); if (!xe.isFile(i.mode)) throw new xe.ErrnoError(28); var r = xe.nodePermissions(i, "w"); if (r) throw new xe.ErrnoError(r); i.node_ops.setattr(i, { size: t, timestamp: Date.now() }) }, ftruncate: function(e, t) { var i = xe.getStream(e); if (!i) throw new xe.ErrnoError(8); if (0 == (2097155 & i.flags)) throw new xe.ErrnoError(28); xe.truncate(i.node, t) }, utime: function(e, t, i) { var r = xe.lookupPath(e, { follow: !0 }).node; r.node_ops.setattr(r, { timestamp: Math.max(t, i) }) }, open: function(e, t, i, r, n) { if ("" === e) throw new xe.ErrnoError(44); var a; if (i = void 0 === i ? 438 : i, i = 64 & (t = "string" == typeof t ? xe.modeStringToFlags(t) : t) ? 4095 & i | 32768 : 0, "object" == typeof e) a = e; else { e = Me.normalize(e); try { a = xe.lookupPath(e, { follow: !(131072 & t) }).node } catch (e) {} } var s = !1; if (64 & t) if (a) { if (128 & t) throw new xe.ErrnoError(20) } else a = xe.mknod(e, i, 0), s = !0; if (!a) throw new xe.ErrnoError(44); if (xe.isChrdev(a.mode) && (t &= -513), 65536 & t && !xe.isDir(a.mode)) throw new xe .ErrnoError(54); if (!s) { var o = xe.mayOpen(a, t); if (o) throw new xe.ErrnoError(o) } 512 & t && xe.truncate(a, 0), t &= -641; var u = xe.createStream({ node: a, path: xe.getPath(a), flags: t, seekable: !0, position: 0, stream_ops: a.stream_ops, ungotten: [], error: !1 }, r, n); u.stream_ops.open && u.stream_ops.open(u), !d.logReadFiles || 1 & t || (xe.readFiles || (xe .readFiles = {}), e in xe.readFiles || (xe.readFiles[e] = 1, console.log( "FS.trackingDelegate error on read file: " + e))); try { if (xe.trackingDelegate.onOpenFile) { var l = 0; 1 != (2097155 & t) && (l |= xe.tracking.openFlags.READ), 0 != (2097155 & t) && (l |= xe .tracking.openFlags.WRITE), xe.trackingDelegate.onOpenFile(e, l) } } catch (t) { console.log("FS.trackingDelegate['onOpenFile']('" + e + "', flags) threw an exception: " + t .message) } return u }, close: function(e) { if (xe.isClosed(e)) throw new xe.ErrnoError(8); e.getdents && (e.getdents = null); try { e.stream_ops.close && e.stream_ops.close(e) } catch (e) { throw e } finally { xe.closeStream(e.fd) } e.fd = null }, isClosed: function(e) { return null === e.fd }, llseek: function(e, t, i) { if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (!e.seekable || !e.stream_ops.llseek) throw new xe.ErrnoError(70); if (0 != i && 1 != i && 2 != i) throw new xe.ErrnoError(28); return e.position = e.stream_ops.llseek(e, t, i), e.ungotten = [], e.position }, read: function(e, t, i, r, n) { if (r < 0 || n < 0) throw new xe.ErrnoError(28); if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(8); if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31); if (!e.stream_ops.read) throw new xe.ErrnoError(28); var a = void 0 !== n; if (a) { if (!e.seekable) throw new xe.ErrnoError(70) } else n = e.position; var s = e.stream_ops.read(e, t, i, r, n); return a || (e.position += s), s }, write: function(e, t, i, r, n, a) { if (r < 0 || n < 0) throw new xe.ErrnoError(28); if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8); if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31); if (!e.stream_ops.write) throw new xe.ErrnoError(28); 1024 & e.flags && xe.llseek(e, 0, 2); var s = void 0 !== n; if (s) { if (!e.seekable) throw new xe.ErrnoError(70) } else n = e.position; var o = e.stream_ops.write(e, t, i, r, n, a); s || (e.position += o); try { e.path && xe.trackingDelegate.onWriteToFile && xe.trackingDelegate.onWriteToFile(e.path) } catch (t) { console.log("FS.trackingDelegate['onWriteToFile']('" + e.path + "') threw an exception: " + t.message) } return o }, allocate: function(e, t, i) { if (xe.isClosed(e)) throw new xe.ErrnoError(8); if (t < 0 || i <= 0) throw new xe.ErrnoError(28); if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8); if (!xe.isFile(e.node.mode) && !xe.isDir(e.node.mode)) throw new xe.ErrnoError(43); if (!e.stream_ops.allocate) throw new xe.ErrnoError(138); e.stream_ops.allocate(e, t, i) }, mmap: function(e, t, i, r, n, a, s) { if (0 != (2 & a) && 0 == (2 & s) && 2 != (2097155 & e.flags)) throw new xe.ErrnoError(2); if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(2); if (!e.stream_ops.mmap) throw new xe.ErrnoError(43); return e.stream_ops.mmap(e, t, i, r, n, a, s) }, msync: function(e, t, i, r, n) { return e && e.stream_ops.msync ? e.stream_ops.msync(e, t, i, r, n) : 0 }, munmap: function(e) { return 0 }, ioctl: function(e, t, i) { if (!e.stream_ops.ioctl) throw new xe.ErrnoError(59); return e.stream_ops.ioctl(e, t, i) }, readFile: function(e, t) { if ((t = t || {}).flags = t.flags || "r", t.encoding = t.encoding || "binary", "utf8" !== t .encoding && "binary" !== t.encoding) throw new Error('Invalid encoding type "' + t .encoding + '"'); var i, r = xe.open(e, t.flags), n = xe.stat(e).size, a = new Uint8Array(n); return xe.read(r, a, 0, n, 0), "utf8" === t.encoding ? i = U(a, 0) : "binary" === t .encoding && (i = a), xe.close(r), i }, writeFile: function(e, t, i) { (i = i || {}).flags = i.flags || "w"; var r = xe.open(e, i.flags, i.mode); if ("string" == typeof t) { var n = new Uint8Array(j(t) + 1), a = B(t, n, 0, n.length); xe.write(r, n, 0, a, void 0, i.canOwn) } else { if (!ArrayBuffer.isView(t)) throw new Error("Unsupported data type"); xe.write(r, t, 0, t.byteLength, void 0, i.canOwn) } xe.close(r) }, cwd: function() { return xe.currentPath }, chdir: function(e) { var t = xe.lookupPath(e, { follow: !0 }); if (null === t.node) throw new xe.ErrnoError(44); if (!xe.isDir(t.node.mode)) throw new xe.ErrnoError(54); var i = xe.nodePermissions(t.node, "x"); if (i) throw new xe.ErrnoError(i); xe.currentPath = t.path }, createDefaultDirectories: function() { xe.mkdir("/tmp"), xe.mkdir("/home"), xe.mkdir("/home/web_user") }, createDefaultDevices: function() { var e; if (xe.mkdir("/dev"), xe.registerDevice(xe.makedev(1, 3), { read: function() { return 0 }, write: function(e, t, i, r, n) { return r } }), xe.mkdev("/dev/null", xe.makedev(1, 3)), Ce.register(xe.makedev(5, 0), Ce .default_tty_ops), Ce.register(xe.makedev(6, 0), Ce.default_tty1_ops), xe.mkdev( "/dev/tty", xe.makedev(5, 0)), xe.mkdev("/dev/tty1", xe.makedev(6, 0)), "object" == typeof crypto && "function" == typeof crypto.getRandomValues) { var t = new Uint8Array(1); e = function() { return crypto.getRandomValues(t), t[0] } } else if (u) try { var r = i(71); e = function() { return r.randomBytes(1)[0] } } catch (e) {} e || (e = function() { ve( "no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };") }), xe.createDevice("/dev", "random", e), xe.createDevice("/dev", "urandom", e), xe.mkdir( "/dev/shm"), xe.mkdir("/dev/shm/tmp") }, createSpecialDirectories: function() { xe.mkdir("/proc"), xe.mkdir("/proc/self"), xe.mkdir("/proc/self/fd"), xe.mount({ mount: function() { var e = xe.createNode("/proc/self", "fd", 16895, 73); return e.node_ops = { lookup: function(e, t) { var i = +t, r = xe.getStream(i); if (!r) throw new xe.ErrnoError(8); var n = { parent: null, mount: { mountpoint: "fake" }, node_ops: { readlink: function() { return r.path } } }; return n.parent = n, n } }, e } }, {}, "/proc/self/fd") }, createStandardStreams: function() { d.stdin ? xe.createDevice("/dev", "stdin", d.stdin) : xe.symlink("/dev/tty", "/dev/stdin"), d .stdout ? xe.createDevice("/dev", "stdout", null, d.stdout) : xe.symlink("/dev/tty", "/dev/stdout"), d.stderr ? xe.createDevice("/dev", "stderr", null, d.stderr) : xe.symlink( "/dev/tty1", "/dev/stderr"); var e = xe.open("/dev/stdin", "r"), t = xe.open("/dev/stdout", "w"), i = xe.open("/dev/stderr", "w"); I(0 === e.fd, "invalid handle for stdin (" + e.fd + ")"), I(1 === t.fd, "invalid handle for stdout (" + t.fd + ")"), I(2 === i.fd, "invalid handle for stderr (" + i.fd + ")") }, ensureErrnoError: function() { xe.ErrnoError || (xe.ErrnoError = function(e, t) { this.node = t, this.setErrno = function(e) { for (var t in this.errno = e, Le) if (Le[t] === e) { this.code = t; break } }, this.setErrno(e), this.message = Ie[e], this.stack && (Object.defineProperty(this, "stack", { value: (new Error).stack, writable: !0 }), this.stack = Se(this.stack)) }, xe.ErrnoError.prototype = new Error, xe.ErrnoError.prototype.constructor = xe .ErrnoError, [44].forEach(function(e) { xe.genericErrors[e] = new xe.ErrnoError(e), xe.genericErrors[e].stack = "" })) }, staticInit: function() { xe.ensureErrnoError(), xe.nameTable = new Array(4096), xe.mount(De, {}, "/"), xe .createDefaultDirectories(), xe.createDefaultDevices(), xe.createSpecialDirectories(), xe .filesystems = { MEMFS: De } }, init: function(e, t, i) { I(!xe.init.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)" ), xe.init.initialized = !0, xe.ensureErrnoError(), d.stdin = e || d.stdin, d.stdout = t || d.stdout, d.stderr = i || d.stderr, xe.createStandardStreams() }, quit: function() { xe.init.initialized = !1; var e = d._fflush; e && e(0); for (var t = 0; t < xe.streams.length; t++) { var i = xe.streams[t]; i && xe.close(i) } }, getMode: function(e, t) { var i = 0; return e && (i |= 365), t && (i |= 146), i }, joinPath: function(e, t) { var i = Me.join.apply(null, e); return t && "/" == i[0] && (i = i.substr(1)), i }, absolutePath: function(e, t) { return Oe.resolve(t, e) }, standardizePath: function(e) { return Me.normalize(e) }, findObject: function(e, t) { var i = xe.analyzePath(e, t); return i.exists ? i.object : (Re(i.error), null) }, analyzePath: function(e, t) { try { e = (r = xe.lookupPath(e, { follow: !t })).path } catch (e) {} var i = { isRoot: !1, exists: !1, error: 0, name: null, path: null, object: null, parentExists: !1, parentPath: null, parentObject: null }; try { var r = xe.lookupPath(e, { parent: !0 }); i.parentExists = !0, i.parentPath = r.path, i.parentObject = r.node, i.name = Me.basename( e), r = xe.lookupPath(e, { follow: !t }), i.exists = !0, i.path = r.path, i.object = r.node, i.name = r.node.name, i.isRoot = "/" === r.path } catch (e) { i.error = e.errno } return i }, createFolder: function(e, t, i, r) { var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t), a = xe.getMode(i, r); return xe.mkdir(n, a) }, createPath: function(e, t, i, r) { e = "string" == typeof e ? e : xe.getPath(e); for (var n = t.split("/").reverse(); n.length;) { var a = n.pop(); if (a) { var s = Me.join2(e, a); try { xe.mkdir(s) } catch (e) {} e = s } } return s }, createFile: function(e, t, i, r, n) { var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t), s = xe.getMode(r, n); return xe.create(a, s) }, createDataFile: function(e, t, i, r, n, a) { var s = t ? Me.join2("string" == typeof e ? e : xe.getPath(e), t) : e, o = xe.getMode(r, n), u = xe.create(s, o); if (i) { if ("string" == typeof i) { for (var l = new Array(i.length), d = 0, c = i.length; d < c; ++d) l[d] = i.charCodeAt(d); i = l } xe.chmod(u, 146 | o); var h = xe.open(u, "w"); xe.write(h, i, 0, i.length, 0, a), xe.close(h), xe.chmod(u, o) } return u }, createDevice: function(e, t, i, r) { var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t), a = xe.getMode(!!i, !!r); xe.createDevice.major || (xe.createDevice.major = 64); var s = xe.makedev(xe.createDevice.major++, 0); return xe.registerDevice(s, { open: function(e) { e.seekable = !1 }, close: function(e) { r && r.buffer && r.buffer.length && r(10) }, read: function(e, t, r, n, a) { for (var s = 0, o = 0; o < n; o++) { var u; try { u = i() } catch (e) { throw new xe.ErrnoError(29) } if (void 0 === u && 0 === s) throw new xe.ErrnoError(6); if (null == u) break; s++, t[r + o] = u } return s && (e.node.timestamp = Date.now()), s }, write: function(e, t, i, n, a) { for (var s = 0; s < n; s++) try { r(t[i + s]) } catch (e) { throw new xe.ErrnoError(29) } return n && (e.node.timestamp = Date.now()), s } }), xe.mkdev(n, a, s) }, createLink: function(e, t, i, r, n) { var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t); return xe.symlink(i, a) }, forceLoadFile: function(e) { if (e.isDevice || e.isFolder || e.link || e.contents) return !0; var t = !0; if ("undefined" != typeof XMLHttpRequest) throw new Error( "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread." ); if (!y) throw new Error("Cannot load without read() or XMLHttpRequest."); try { e.contents = Be(y(e.url), !0), e.usedBytes = e.contents.length } catch (e) { t = !1 } return t || Re(29), t }, createLazyFile: function(e, t, i, r, n) { function a() { this.lengthKnown = !1, this.chunks = [] } if (a.prototype.get = function(e) { if (!(e > this.length - 1 || e < 0)) { var t = e % this.chunkSize, i = e / this.chunkSize | 0; return this.getter(i)[t] } }, a.prototype.setDataGetter = function(e) { this.getter = e }, a.prototype.cacheLength = function() { var e = new XMLHttpRequest; if (e.open("HEAD", i, !1), e.send(null), !(e.status >= 200 && e.status < 300 || 304 === e .status)) throw new Error("Couldn't load " + i + ". Status: " + e.status); var t, r = Number(e.getResponseHeader("Content-length")), n = (t = e.getResponseHeader("Accept-Ranges")) && "bytes" === t, a = (t = e.getResponseHeader("Content-Encoding")) && "gzip" === t, s = 1048576; n || (s = r); var o = this; o.setDataGetter(function(e) { var t = e * s, n = (e + 1) * s - 1; if (n = Math.min(n, r - 1), void 0 === o.chunks[e] && (o.chunks[e] = function(e, t) { if (e > t) throw new Error("invalid range (" + e + ", " + t + ") or no bytes requested!"); if (t > r - 1) throw new Error("only " + r + " bytes available! programmer error!"); var n = new XMLHttpRequest; if (n.open("GET", i, !1), r !== s && n.setRequestHeader("Range", "bytes=" + e + "-" + t), "undefined" != typeof Uint8Array && (n.responseType = "arraybuffer"), n.overrideMimeType && n.overrideMimeType( "text/plain; charset=x-user-defined"), n.send(null), !(n.status >= 200 && n.status < 300 || 304 === n.status)) throw new Error("Couldn't load " + i + ". Status: " + n.status); return void 0 !== n.response ? new Uint8Array(n.response || []) : Be(n .responseText || "", !0) }(t, n)), void 0 === o.chunks[e]) throw new Error("doXHR failed!"); return o.chunks[e] }), !a && r || (s = r = 1, r = this.getter(0).length, s = r, console.log( "LazyFiles on gzip forces download of the whole file when length is accessed")), this ._length = r, this._chunkSize = s, this.lengthKnown = !0 }, "undefined" != typeof XMLHttpRequest) { if (!v) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc"; var s = new a; Object.defineProperties(s, { length: { get: function() { return this.lengthKnown || this.cacheLength(), this._length } }, chunkSize: { get: function() { return this.lengthKnown || this.cacheLength(), this._chunkSize } } }); var o = { isDevice: !1, contents: s } } else o = { isDevice: !1, url: i }; var u = xe.createFile(e, t, o, r, n); o.contents ? u.contents = o.contents : o.url && (u.contents = null, u.url = o.url), Object .defineProperties(u, { usedBytes: { get: function() { return this.contents.length } } }); var l = {}; return Object.keys(u.stream_ops).forEach(function(e) { var t = u.stream_ops[e]; l[e] = function() { if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29); return t.apply(null, arguments) } }), l.read = function(e, t, i, r, n) { if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29); var a = e.node.contents; if (n >= a.length) return 0; var s = Math.min(a.length - n, r); if (I(s >= 0), a.slice) for (var o = 0; o < s; o++) t[i + o] = a[n + o]; else for (o = 0; o < s; o++) t[i + o] = a.get(n + o); return s }, u.stream_ops = l, u }, createPreloadedFile: function(e, t, i, r, n, a, s, o, u, l) { Browser.init(); var c = t ? Oe.resolve(Me.join2(e, t)) : e, h = function(e) { for (var t = e;;) { if (!pe[e]) return e; e = t + Math.random() } return e }("cp " + c); function f(i) { function f(i) { l && l(), o || xe.createDataFile(e, t, i, r, n, u), a && a(), ge(h) } var p = !1; d.preloadPlugins.forEach(function(e) { p || e.canHandle(c) && (e.handle(i, c, f, function() { s && s(), ge(h) }), p = !0) }), p || f(i) } me(h), "string" == typeof i ? Browser.asyncLoad(i, function(e) { f(e) }, s) : f(i) }, indexedDB: function() { return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB }, DB_NAME: function() { return "EM_FS_" + window.location.pathname }, DB_VERSION: 20, DB_STORE_NAME: "FILE_DATA", saveFilesToDB: function(e, t, i) { t = t || function() {}, i = i || function() {}; var r = xe.indexedDB(); try { var n = r.open(xe.DB_NAME(), xe.DB_VERSION) } catch (e) { return i(e) } n.onupgradeneeded = function() { console.log("creating db"), n.result.createObjectStore(xe.DB_STORE_NAME) }, n.onsuccess = function() { var r = n.result.transaction([xe.DB_STORE_NAME], "readwrite"), a = r.objectStore(xe.DB_STORE_NAME), s = 0, o = 0, u = e.length; function l() { 0 == o ? t() : i() } e.forEach(function(e) { var t = a.put(xe.analyzePath(e).object.contents, e); t.onsuccess = function() { ++s + o == u && l() }, t.onerror = function() { s + ++o == u && l() } }), r.onerror = i }, n.onerror = i }, loadFilesFromDB: function(e, t, i) { t = t || function() {}, i = i || function() {}; var r = xe.indexedDB(); try { var n = r.open(xe.DB_NAME(), xe.DB_VERSION) } catch (e) { return i(e) } n.onupgradeneeded = i, n.onsuccess = function() { var r = n.result; try { var a = r.transaction([xe.DB_STORE_NAME], "readonly") } catch (e) { return void i(e) } var s = a.objectStore(xe.DB_STORE_NAME), o = 0, u = 0, l = e.length; function d() { 0 == u ? t() : i() } e.forEach(function(e) { var t = s.get(e); t.onsuccess = function() { xe.analyzePath(e).exists && xe.unlink(e), xe.createDataFile(Me.dirname(e), Me .basename(e), t.result, !0, !0, !0), ++o + u == l && d() }, t.onerror = function() { o + ++u == l && d() } }), a.onerror = i }, n.onerror = i } }, Pe = { DEFAULT_POLLMASK: 5, mappings: {}, umask: 511, calculateAt: function(e, t) { if ("/" !== t[0]) { var i; if (-100 === e) i = xe.cwd(); else { var r = xe.getStream(e); if (!r) throw new xe.ErrnoError(8); i = r.path } t = Me.join2(i, t) } return t }, doStat: function(e, t, i) { try { var r = e(t) } catch (e) { if (e && e.node && Me.normalize(t) !== Me.normalize(xe.getPath(e.node))) return -54; throw e } return q[i >> 2] = r.dev, q[i + 4 >> 2] = 0, q[i + 8 >> 2] = r.ino, q[i + 12 >> 2] = r.mode, q[i + 16 >> 2] = r.nlink, q[i + 20 >> 2] = r.uid, q[i + 24 >> 2] = r.gid, q[i + 28 >> 2] = r .rdev, q[i + 32 >> 2] = 0, we = [r.size >>> 0, (be = r.size, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 : 0)], q[i + 40 >> 2] = we[0], q[i + 44 >> 2] = we[1], q[i + 48 >> 2] = 4096, q[i + 52 >> 2] = r.blocks, q[i + 56 >> 2] = r.atime.getTime() / 1e3 | 0, q[i + 60 >> 2] = 0, q[i + 64 >> 2] = r.mtime.getTime() / 1e3 | 0, q[i + 68 >> 2] = 0, q[i + 72 >> 2] = r.ctime.getTime() / 1e3 | 0, q[i + 76 >> 2] = 0, we = [r.ino >>> 0, (be = r.ino, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 : 0)], q[i + 80 >> 2] = we[0], q[i + 84 >> 2] = we[1], 0 }, doMsync: function(e, t, i, r) { var n = new Uint8Array(V.subarray(e, e + i)); xe.msync(t, n, 0, i, r) }, doMkdir: function(e, t) { return "/" === (e = Me.normalize(e))[e.length - 1] && (e = e.substr(0, e.length - 1)), xe .mkdir(e, t, 0), 0 }, doMknod: function(e, t, i) { switch (61440 & t) { case 32768: case 8192: case 24576: case 4096: case 49152: break; default: return -28 } return xe.mknod(e, t, i), 0 }, doReadlink: function(e, t, i) { if (i <= 0) return -28; var r = xe.readlink(e), n = Math.min(i, j(r)), a = G[t + n]; return F(r, t, i + 1), G[t + n] = a, n }, doAccess: function(e, t) { if (-8 & t) return -28; var i; if (!(i = xe.lookupPath(e, { follow: !0 }).node)) return -44; var r = ""; return 4 & t && (r += "r"), 2 & t && (r += "w"), 1 & t && (r += "x"), r && xe.nodePermissions( i, r) ? -2 : 0 }, doDup: function(e, t, i) { var r = xe.getStream(i); return r && xe.close(r), xe.open(e, t, 0, i, i).fd }, doReadv: function(e, t, i, r) { for (var n = 0, a = 0; a < i; a++) { var s = q[t + 8 * a >> 2], o = q[t + (8 * a + 4) >> 2], u = xe.read(e, G, s, o, r); if (u < 0) return -1; if (n += u, u < o) break } return n }, doWritev: function(e, t, i, r) { for (var n = 0, a = 0; a < i; a++) { var s = q[t + 8 * a >> 2], o = q[t + (8 * a + 4) >> 2], u = xe.write(e, G, s, o, r); if (u < 0) return -1; n += u } return n }, varargs: 0, get: function(e) { return Pe.varargs += 4, q[Pe.varargs - 4 >> 2] }, getStr: function() { return N(Pe.get()) }, getStreamFromFD: function(e) { void 0 === e && (e = Pe.get()); var t = xe.getStream(e); if (!t) throw new xe.ErrnoError(8); return t }, get64: function() { var e = Pe.get(), t = Pe.get(); return I(e >= 0 ? 0 === t : -1 === t), e }, getZero: function() { I(0 === Pe.get()) } }; var Ue = {}; function Ne() { if (!Ne.strings) { var e = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: ("object" == typeof navigator && navigator.languages && navigator.languages[0] || "C") .replace("-", "_") + ".UTF-8", _: p }; for (var t in Ue) e[t] = Ue[t]; var i = []; for (var t in e) i.push(t + "=" + e[t]); Ne.strings = i } return Ne.strings } function Be(e, t, i) { var r = i > 0 ? i : j(e) + 1, n = new Array(r), a = B(e, n, 0, n.length); return t && (n.length = a), n } F("GMT", 1341232, 4), xe.staticInit(); var Fe = { __cxa_allocate_exception: function(e) { return ri(e) }, __cxa_throw: function(e, t, i) { throw ke[e] = { ptr: e, adjusted: [e], type: t, destructor: i, refcount: 0, caught: !1, rethrown: !1 }, "uncaught_exception" in ni ? ni.uncaught_exceptions++ : ni.uncaught_exceptions = 1, e + " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch." }, __lock: function() {}, __syscall221: function(e, t) { Pe.varargs = t; try { var i = Pe.getStreamFromFD(); switch (Pe.get()) { case 0: return (r = Pe.get()) < 0 ? -28 : xe.open(i.path, i.flags, 0, r).fd; case 1: case 2: return 0; case 3: return i.flags; case 4: var r = Pe.get(); return i.flags |= r, 0; case 12: return r = Pe.get(), W[r + 0 >> 1] = 2, 0; case 13: case 14: return 0; case 16: case 8: return -28; case 9: return Re(28), -1; default: return -28 } } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno } }, __syscall3: function(e, t) { Pe.varargs = t; try { var i = Pe.getStreamFromFD(), r = Pe.get(), n = Pe.get(); return xe.read(i, G, r, n) } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno } }, __syscall5: function(e, t) { Pe.varargs = t; try { var i = Pe.getStr(), r = Pe.get(), n = Pe.get(); return xe.open(i, r, n).fd } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno } }, __unlock: function() {}, abort: function() { ve() }, clock: function e() { return void 0 === e.start && (e.start = Date.now()), 1e3 * (Date.now() - e.start) | 0 }, emscripten_memcpy_big: function(e, t, i) { V.set(V.subarray(t, t + i), e) }, emscripten_resize_heap: function(e) { var t = G.length; if (I(e > t), e > 2147418112) return S("Cannot enlarge memory, asked to go up to " + e + " bytes, but the limit is 2147418112 bytes!"), !1; for (var i = Math.max(t, 16777216); i < e;)(i = i <= 536870912 ? z(2 * i, 65536) : Math.min(z( (3 * i + 2147483648) / 4, 65536), 2147418112)) === t && A( "Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only " + G.length); return !! function(e) { try { return M.grow(e - H.byteLength + 65535 >> 16), K(M.buffer), 1 } catch (t) { console.error("emscripten_realloc_buffer: Attempted to grow heap from " + H.byteLength + " bytes to " + e + " bytes, but got error: " + t) } }(i) || (S("Failed to grow the heap from " + t + " bytes to " + i + " bytes, not enough memory!"), !1) }, environ_get: function(e, t) { var i = 0; return Ne().forEach(function(r, n) { var a = t + i; q[e + 4 * n >> 2] = a, function(e, t, i) { for (var r = 0; r < e.length; ++r) I(e.charCodeAt(r) == e.charCodeAt(r) & 255), G[ t++ >> 0] = e.charCodeAt(r); i || (G[t >> 0] = 0) }(r, a), i += r.length + 1 }), 0 }, environ_sizes_get: function(e, t) { var i = Ne(); q[e >> 2] = i.length; var r = 0; return i.forEach(function(e) { r += e.length + 1 }), q[t >> 2] = r, 0 }, fd_close: function(e) { try { var t = Pe.getStreamFromFD(e); return xe.close(t), 0 } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, fd_fdstat_get: function(e, t) { try { var i = Pe.getStreamFromFD(e), r = i.tty ? 2 : xe.isDir(i.mode) ? 3 : xe.isLink(i.mode) ? 7 : 4; return G[t >> 0] = r, 0 } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, fd_seek: function(e, t, i, r, n) { try { var a = Pe.getStreamFromFD(e), s = 4294967296 * i + (t >>> 0); return s <= -9007199254740992 || s >= 9007199254740992 ? -61 : (xe.llseek(a, s, r), we = [a .position >>> 0, (be = a.position, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 : 0) ], q[n >> 2] = we[0], q[n + 4 >> 2] = we[1], a.getdents && 0 === s && 0 === r && (a .getdents = null), 0) } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, fd_write: function(e, t, i, r) { try { var n = Pe.getStreamFromFD(e), a = Pe.doWritev(n, t, i); return q[r >> 2] = a, 0 } catch (e) { return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno } }, gettimeofday: function(e) { var t = Date.now(); return q[e >> 2] = t / 1e3 | 0, q[e + 4 >> 2] = t % 1e3 * 1e3 | 0, 0 }, memory: M, round: function(e) { return (e = +e) >= 0 ? +le(e + .5) : +ue(e - .5) }, setTempRet0: function(e) { O(0 | e) }, table: C, time: function(e) { var t = Date.now() / 1e3 | 0; return e && (q[e >> 2] = t), t } }, je = function() { var e = { env: Fe, wasi_unstable: Fe }; function t(e, t) { var i = e.exports; d.asm = i, ge("wasm-instantiate") } me("wasm-instantiate"); var i = d; function r(e) { I(d === i, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?" ), i = null, t(e.instance) } function n(t) { return (R || !g && !v || "function" != typeof fetch ? new Promise(function(e, t) { e(Te()) }) : fetch(Ee, { credentials: "same-origin" }).then(function(e) { if (!e.ok) throw "failed to load wasm binary file at '" + Ee + "'"; return e.arrayBuffer() }).catch(function() { return Te() })).then(function(t) { return WebAssembly.instantiate(t, e) }).then(t, function(e) { S("failed to asynchronously prepare wasm: " + e), ve(e) }) } if (d.instantiateWasm) try { return d.instantiateWasm(e, t) } catch (e) { return S("Module.instantiateWasm callback failed with error: " + e), !1 } return function() { if (R || "function" != typeof WebAssembly.instantiateStreaming || _e(Ee) || "function" != typeof fetch) return n(r); fetch(Ee, { credentials: "same-origin" }).then(function(t) { return WebAssembly.instantiateStreaming(t, e).then(r, function(e) { S("wasm streaming compile failed: " + e), S( "falling back to ArrayBuffer instantiation"), n(r) }) }) }(), {} }(), He = je.__wasm_call_ctors; je.__wasm_call_ctors = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), He .apply(null, arguments) }; var Ge = je.WasmDecoder_Check; je.WasmDecoder_Check = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ge .apply(null, arguments) }; var Ve = je.WasmDecoder_Init; je.WasmDecoder_Init = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ve .apply(null, arguments) }; var We = je.WasmDecoder_Deinit; je.WasmDecoder_Deinit = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), We .apply(null, arguments) }; var qe = je.WasmDecoder_OpenChannel; je.WasmDecoder_OpenChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qe .apply(null, arguments) }; var Xe = je.WasmDecoder_InputFlvStream; je.WasmDecoder_InputFlvStream = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xe .apply(null, arguments) }; var ze = je.WasmDecoder_GetFlvDecodeData; je.WasmDecoder_GetFlvDecodeData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ze .apply(null, arguments) }; var Ke = je.WasmDecoder_InputFlvStreamAndDecode; je.WasmDecoder_InputFlvStreamAndDecode = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ke .apply(null, arguments) }; var Ye = je.WasmDecoder_OpenVideoDecoder; je.WasmDecoder_OpenVideoDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ye .apply(null, arguments) }; var Qe = je.WasmDecoder_OpenAudioDecoder; je.WasmDecoder_OpenAudioDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qe .apply(null, arguments) }; var Je = je.WasmDecoder_DecodeVideoFrame; je.WasmDecoder_DecodeVideoFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Je .apply(null, arguments) }; var Ze = je.WasmDecoder_DecodeAudioFrame; je.WasmDecoder_DecodeAudioFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ze .apply(null, arguments) }; var $e = je.WasmDecoder_CloseChannel; je.WasmDecoder_CloseChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $e .apply(null, arguments) }; var et = je.WasmDecoder_ConvertFrame2Image; je.WasmDecoder_ConvertFrame2Image = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), et .apply(null, arguments) }; var tt = je.WasmDecoder_ReleaseImageData; je.WasmDecoder_ReleaseImageData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), tt .apply(null, arguments) }; var it = je.WasmDecoder_CreateMP4File; je.WasmDecoder_CreateMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), it .apply(null, arguments) }; var rt = je.WasmDecoder_WriteData; je.WasmDecoder_WriteData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), rt .apply(null, arguments) }; var nt = je.WasmDecoder_ReleaseMP4File; je.WasmDecoder_ReleaseMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), nt .apply(null, arguments) }; var at = je.main; je.main = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), at .apply(null, arguments) }; var st = je.free; je.free = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), st .apply(null, arguments) }; var ot = je.malloc; je.malloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ot .apply(null, arguments) }; var ut = je.__errno_location; je.__errno_location = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ut .apply(null, arguments) }; var lt = je.fflush; je.fflush = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), lt .apply(null, arguments) }; var dt = je._get_tzname; je._get_tzname = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), dt .apply(null, arguments) }; var ct = je._get_daylight; je._get_daylight = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ct .apply(null, arguments) }; var ht = je._get_timezone; je._get_timezone = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ht .apply(null, arguments) }; var ft = je.setThrew; je.setThrew = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ft .apply(null, arguments) }; var pt = je._ZSt18uncaught_exceptionv; je._ZSt18uncaught_exceptionv = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), pt .apply(null, arguments) }; var mt = je.stackSave; je.stackSave = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), mt .apply(null, arguments) }; var gt = je.stackAlloc; je.stackAlloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), gt .apply(null, arguments) }; var vt = je.stackRestore; je.stackRestore = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), vt .apply(null, arguments) }; var yt = je.__growWasmMemory; je.__growWasmMemory = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), yt .apply(null, arguments) }; var _t = je.dynCall_ii; je.dynCall_ii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), _t .apply(null, arguments) }; var bt = je.dynCall_viiiii; je.dynCall_viiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), bt .apply(null, arguments) }; var wt = je.dynCall_viiiiiifi; je.dynCall_viiiiiifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), wt .apply(null, arguments) }; var Et = je.dynCall_viiii; je.dynCall_viiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Et .apply(null, arguments) }; var Tt = je.dynCall_viii; je.dynCall_viii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Tt .apply(null, arguments) }; var St = je.dynCall_iiiiiii; je.dynCall_iiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), St .apply(null, arguments) }; var At = je.dynCall_iiiiii; je.dynCall_iiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), At .apply(null, arguments) }; var kt = je.dynCall_vii; je.dynCall_vii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), kt .apply(null, arguments) }; var Rt = je.dynCall_iii; je.dynCall_iii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Rt .apply(null, arguments) }; var Mt = je.dynCall_iiii; je.dynCall_iiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Mt .apply(null, arguments) }; var Ot = je.dynCall_viiiiii; je.dynCall_viiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ot .apply(null, arguments) }; var Ct = je.dynCall_viiiiiiiii; je.dynCall_viiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ct .apply(null, arguments) }; var Dt = je.dynCall_viiiiiiii; je.dynCall_viiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Dt .apply(null, arguments) }; var It = je.dynCall_iiiii; je.dynCall_iiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), It .apply(null, arguments) }; var Lt = je.dynCall_viiiiiiiiiiiiii; je.dynCall_viiiiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Lt .apply(null, arguments) }; var xt = je.dynCall_viiiiiiiiiii; je.dynCall_viiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), xt .apply(null, arguments) }; var Pt = je.dynCall_viiiiiii; je.dynCall_viiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Pt .apply(null, arguments) }; var Ut = je.dynCall_viiiiiiiiiiii; je.dynCall_viiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ut .apply(null, arguments) }; var Nt = je.dynCall_vi; je.dynCall_vi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Nt .apply(null, arguments) }; var Bt = je.dynCall_iiiiiiiii; je.dynCall_iiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Bt .apply(null, arguments) }; var Ft = je.dynCall_viiiifii; je.dynCall_viiiifii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ft .apply(null, arguments) }; var jt = je.dynCall_fii; je.dynCall_fii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), jt .apply(null, arguments) }; var Ht = je.dynCall_viiiiiiiiii; je.dynCall_viiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ht .apply(null, arguments) }; var Gt = je.dynCall_dd; je.dynCall_dd = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Gt .apply(null, arguments) }; var Vt = je.dynCall_viifi; je.dynCall_viifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Vt .apply(null, arguments) }; var Wt = je.dynCall_fiii; je.dynCall_fiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Wt .apply(null, arguments) }; var qt = je.dynCall_viidi; je.dynCall_viidi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qt .apply(null, arguments) }; var Xt = je.dynCall_iiiiiiii; je.dynCall_iiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xt .apply(null, arguments) }; var zt = je.dynCall_did; je.dynCall_did = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), zt .apply(null, arguments) }; var Kt = je.dynCall_v; je.dynCall_v = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Kt .apply(null, arguments) }; var Yt = je.dynCall_viiijj; je.dynCall_viiijj = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Yt .apply(null, arguments) }; var Qt = je.dynCall_iiiiiiidiiddii; je.dynCall_iiiiiiidiiddii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qt .apply(null, arguments) }; var Jt = je.dynCall_jij; je.dynCall_jij = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Jt .apply(null, arguments) }; var Zt = je.dynCall_jii; je.dynCall_jii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Zt .apply(null, arguments) }; var $t = je.dynCall_jiji; je.dynCall_jiji = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $t .apply(null, arguments) }; var ei = je.dynCall_iidiiii; je.dynCall_iidiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ei .apply(null, arguments) }, d.asm = je; var ti, ii = d.___wasm_call_ctors = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.__wasm_call_ctors.apply(null, arguments) }, ri = (d._WasmDecoder_Check = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_Check.apply(null, arguments) }, d._WasmDecoder_Init = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_Init.apply(null, arguments) }, d._WasmDecoder_Deinit = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_Deinit.apply(null, arguments) }, d._WasmDecoder_OpenChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_OpenChannel.apply(null, arguments) }, d._WasmDecoder_InputFlvStream = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_InputFlvStream.apply(null, arguments) }, d._WasmDecoder_GetFlvDecodeData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_GetFlvDecodeData.apply(null, arguments) }, d._WasmDecoder_InputFlvStreamAndDecode = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_InputFlvStreamAndDecode.apply(null, arguments) }, d._WasmDecoder_OpenVideoDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_OpenVideoDecoder.apply(null, arguments) }, d._WasmDecoder_OpenAudioDecoder = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_OpenAudioDecoder.apply(null, arguments) }, d._WasmDecoder_DecodeVideoFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_DecodeVideoFrame.apply(null, arguments) }, d._WasmDecoder_DecodeAudioFrame = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_DecodeAudioFrame.apply(null, arguments) }, d._WasmDecoder_CloseChannel = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_CloseChannel.apply(null, arguments) }, d._WasmDecoder_ConvertFrame2Image = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_ConvertFrame2Image.apply(null, arguments) }, d._WasmDecoder_ReleaseImageData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_ReleaseImageData.apply(null, arguments) }, d._WasmDecoder_CreateMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_CreateMP4File.apply(null, arguments) }, d._WasmDecoder_WriteData = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_WriteData.apply(null, arguments) }, d._WasmDecoder_ReleaseMP4File = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .WasmDecoder_ReleaseMP4File.apply(null, arguments) }, d._main = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .main.apply(null, arguments) }, d._free = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .free.apply(null, arguments) }, d._malloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .malloc.apply(null, arguments) }), ni = (d.___errno_location = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .__errno_location.apply(null, arguments) }, d._fflush = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .fflush.apply(null, arguments) }, d.__get_tzname = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._get_tzname.apply(null, arguments) }, d.__get_daylight = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._get_daylight.apply(null, arguments) }, d.__get_timezone = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._get_timezone.apply(null, arguments) }, d._setThrew = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm .setThrew.apply(null, arguments) }, d.__ZSt18uncaught_exceptionv = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm ._ZSt18uncaught_exceptionv.apply(null, arguments) }), ai = d.stackSave = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.stackSave.apply(null, arguments) }, si = d.stackAlloc = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.stackAlloc.apply(null, arguments) }, oi = d.stackRestore = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.stackRestore.apply(null, arguments) }; function ui(e) { this.name = "ExitStatus", this.message = "Program terminated with exit(" + e + ")", this.status = e } function li(e) { I(0 == ce, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'), I(0 == te.length, "cannot call main when preRun functions remain to be called"); var t = d._main; try { ! function(e, t) { (function() { var e = T, t = S, i = !1; T = S = function(e) { i = !0 }; try { var r = d._fflush; r && r(0), ["stdout", "stderr"].forEach(function(e) { var t = xe.analyzePath("/dev/" + e); if (t) { var r = t.object.rdev, n = Ce.ttys[r]; n && n.output && n.output.length && (i = !0) } }) } catch (e) {} T = e, S = t, i && A( "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc." ) })(), t && s && 0 === e || (s ? t || S("program exited (with status: " + e + "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)" ) : (D = !0, $(), se = !0, d.onExit && d.onExit(e)), m(e, new ui(e))) }(t(0, 0), !0) } catch (e) { if (e instanceof ui) return; if ("SimulateInfiniteLoop" == e) return void(s = !0); var i = e; e && "object" == typeof e && e.stack && (i = [e, e.stack]), S("exception thrown: " + i), m(1, e) } } function di(e) { function t() { ti || (ti = !0, D || ($(), I(!ae), ae = !0, d.noFSInit || xe.init.initialized || xe.init(), Ce .init(), ee(ie), $(), xe.ignorePermissions = !1, ee(re), d.onRuntimeInitialized && d .onRuntimeInitialized(), ci && li(), function() { if ($(), d.postRun) for ("function" == typeof d.postRun && (d.postRun = [d.postRun]); d.postRun.length;) e = d.postRun.shift(), ne.unshift(e); var e; ee(ne) }())) } e = e || f, ce > 0 || (Z(), function() { if (d.preRun) for ("function" == typeof d.preRun && (d.preRun = [d.preRun]); d.preRun.length;) e = d .preRun.shift(), te.unshift(e); var e; ee(te) }(), ce > 0 || (d.setStatus ? (d.setStatus("Running..."), setTimeout(function() { setTimeout(function() { d.setStatus("") }, 1), t() }, 1)) : t(), $())) } if (d.__growWasmMemory = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.__growWasmMemory.apply(null, arguments) }, d.dynCall_ii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_ii.apply(null, arguments) }, d.dynCall_viiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiii.apply(null, arguments) }, d.dynCall_viiiiiifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiifi.apply(null, arguments) }, d.dynCall_viiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiii.apply(null, arguments) }, d.dynCall_viii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viii.apply(null, arguments) }, d.dynCall_iiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiii.apply(null, arguments) }, d.dynCall_iiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiii.apply(null, arguments) }, d.dynCall_vii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_vii.apply(null, arguments) }, d.dynCall_iii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iii.apply(null, arguments) }, d.dynCall_iiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiii.apply(null, arguments) }, d.dynCall_viiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiii.apply(null, arguments) }, d.dynCall_viiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiii.apply(null, arguments) }, d.dynCall_viiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiii.apply(null, arguments) }, d.dynCall_iiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiii.apply(null, arguments) }, d.dynCall_viiiiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiiiiiii.apply(null, arguments) }, d.dynCall_viiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiiii.apply(null, arguments) }, d.dynCall_viiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiii.apply(null, arguments) }, d.dynCall_viiiiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiiiii.apply(null, arguments) }, d.dynCall_vi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_vi.apply(null, arguments) }, d.dynCall_iiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiiiii.apply(null, arguments) }, d.dynCall_viiiifii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiifii.apply(null, arguments) }, d.dynCall_fii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_fii.apply(null, arguments) }, d.dynCall_viiiiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiiiiiiiii.apply(null, arguments) }, d.dynCall_dd = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_dd.apply(null, arguments) }, d.dynCall_viifi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viifi.apply(null, arguments) }, d.dynCall_fiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_fiii.apply(null, arguments) }, d.dynCall_viidi = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viidi.apply(null, arguments) }, d.dynCall_iiiiiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiiii.apply(null, arguments) }, d.dynCall_did = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_did.apply(null, arguments) }, d.dynCall_v = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_v.apply(null, arguments) }, d.dynCall_viiijj = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_viiijj.apply(null, arguments) }, d.dynCall_iiiiiiidiiddii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iiiiiiidiiddii.apply(null, arguments) }, d.dynCall_jij = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_jij.apply(null, arguments) }, d.dynCall_jii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_jii.apply(null, arguments) }, d.dynCall_jiji = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_jiji.apply(null, arguments) }, d.dynCall_iidiiii = function() { return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d .asm.dynCall_iidiiii.apply(null, arguments) }, d.asm = je, Object.getOwnPropertyDescriptor(d, "intArrayFromString") || (d.intArrayFromString = function() { ve( "'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "intArrayToString") || (d.intArrayToString = function() { ve( "'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.ccall = x, d.cwrap = function(e, t, i, r) { return function() { return x(e, t, i, arguments) } }, Object.getOwnPropertyDescriptor(d, "setValue") || (d.setValue = function() { ve("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getValue") || (d.getValue = function() { ve("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "allocate") || (d.allocate = function() { ve("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getMemory") || (d.getMemory = function() { ve( "'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "AsciiToString") || (d.AsciiToString = function() { ve("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToAscii") || (d.stringToAscii = function() { ve("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF8ArrayToString") || (d.UTF8ArrayToString = function() { ve( "'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF8ToString") || (d.UTF8ToString = function() { ve("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF8Array") || (d.stringToUTF8Array = function() { ve( "'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF8") || (d.stringToUTF8 = function() { ve("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF8") || (d.lengthBytesUTF8 = function() { ve("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF16ToString") || (d.UTF16ToString = function() { ve("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF16") || (d.stringToUTF16 = function() { ve("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF16") || (d.lengthBytesUTF16 = function() { ve( "'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "UTF32ToString") || (d.UTF32ToString = function() { ve("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stringToUTF32") || (d.stringToUTF32 = function() { ve("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF32") || (d.lengthBytesUTF32 = function() { ve( "'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "allocateUTF8") || (d.allocateUTF8 = function() { ve("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackTrace") || (d.stackTrace = function() { ve("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnPreRun") || (d.addOnPreRun = function() { ve("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnInit") || (d.addOnInit = function() { ve("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnPreMain") || (d.addOnPreMain = function() { ve("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnExit") || (d.addOnExit = function() { ve("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addOnPostRun") || (d.addOnPostRun = function() { ve("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "writeStringToMemory") || (d.writeStringToMemory = function() { ve( "'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "writeArrayToMemory") || (d.writeArrayToMemory = function() { ve( "'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "writeAsciiToMemory") || (d.writeAsciiToMemory = function() { ve( "'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "addRunDependency") || (d.addRunDependency = function() { ve( "'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "removeRunDependency") || (d.removeRunDependency = function() { ve( "'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "ENV") || (d.ENV = function() { ve("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "FS") || (d.FS = function() { ve("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "FS_createFolder") || (d.FS_createFolder = function() { ve( "'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createPath") || (d.FS_createPath = function() { ve( "'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createDataFile") || (d.FS_createDataFile = function() { ve( "'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createPreloadedFile") || (d.FS_createPreloadedFile = function() { ve( "'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createLazyFile") || (d.FS_createLazyFile = function() { ve( "'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createLink") || (d.FS_createLink = function() { ve( "'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_createDevice") || (d.FS_createDevice = function() { ve( "'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "FS_unlink") || (d.FS_unlink = function() { ve( "'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") }), Object.getOwnPropertyDescriptor(d, "GL") || (d.GL = function() { ve("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "dynamicAlloc") || (d.dynamicAlloc = function() { ve("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "loadDynamicLibrary") || (d.loadDynamicLibrary = function() { ve( "'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "loadWebAssemblyModule") || (d.loadWebAssemblyModule = function() { ve( "'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getLEB") || (d.getLEB = function() { ve("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getFunctionTables") || (d.getFunctionTables = function() { ve( "'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "alignFunctionTables") || (d.alignFunctionTables = function() { ve( "'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "registerFunctions") || (d.registerFunctions = function() { ve( "'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.addFunction = function(e, t) { return I(void 0 !== e), k(e, t) }, Object.getOwnPropertyDescriptor(d, "removeFunction") || (d.removeFunction = function() { ve("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getFuncWrapper") || (d.getFuncWrapper = function() { ve("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "prettyPrint") || (d.prettyPrint = function() { ve("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "makeBigInt") || (d.makeBigInt = function() { ve("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "dynCall") || (d.dynCall = function() { ve("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getCompilerSetting") || (d.getCompilerSetting = function() { ve( "'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackSave") || (d.stackSave = function() { ve("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackRestore") || (d.stackRestore = function() { ve("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "stackAlloc") || (d.stackAlloc = function() { ve("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "establishStackSpace") || (d.establishStackSpace = function() { ve( "'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "print") || (d.print = function() { ve("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "printErr") || (d.printErr = function() { ve("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "getTempRet0") || (d.getTempRet0 = function() { ve("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "setTempRet0") || (d.setTempRet0 = function() { ve("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.callMain = li, Object.getOwnPropertyDescriptor(d, "abort") || (d.abort = function() { ve("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "Pointer_stringify") || (d.Pointer_stringify = function() { ve( "'Pointer_stringify' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), Object.getOwnPropertyDescriptor(d, "warnOnce") || (d.warnOnce = function() { ve("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") }), d.writeStackCookie = Z, d.checkStackCookie = $, d.abortStackOverflow = function(e) { ve("Stack overflow! Attempted to allocate " + e + " bytes on the stack, but stack has only " + ( Y - ai() + e) + " bytes available!") }, Object.getOwnPropertyDescriptor(d, "ALLOC_NORMAL") || Object.defineProperty(d, "ALLOC_NORMAL", { configurable: !0, get: function() { ve( "'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "ALLOC_STACK") || Object.defineProperty(d, "ALLOC_STACK", { configurable: !0, get: function() { ve("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "ALLOC_DYNAMIC") || Object.defineProperty(d, "ALLOC_DYNAMIC", { configurable: !0, get: function() { ve( "'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "ALLOC_NONE") || Object.defineProperty(d, "ALLOC_NONE", { configurable: !0, get: function() { ve("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)") } }), Object.getOwnPropertyDescriptor(d, "calledRun") || Object.defineProperty(d, "calledRun", { configurable: !0, get: function() { ve( "'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you") } }), fe = function e() { ti || di(), ti || (fe = e) }, d.run = di, d.preInit) for ("function" == typeof d.preInit && (d.preInit = [d.preInit]); d.preInit.length > 0;) d.preInit .pop()(); var ci = !0; d.noInitialRun && (ci = !1), s = !0, di() } var h = function(e) { e.isFlvStream = !0, e.enableAudio = !1, e.pause = !1, e.exitFlag = !1, e.needMoreData = !1, e .wasmDecoderId = -1, e.wasmInitVideoDecoder = !1, e.wasmInitAudioDecoder = !1, e.videoQueue = [], e.audioQueue = [], e.videoFrameNum = 0, e.videoRawData = null, e.audioRawData = null, e .videoPacketData = null, e.audioPacketData = null, e.findKeyFrame = !0, e.videoIntervalHandle = - 1, e.videoIntervalValue = 39, e.audioIntervalHandle = -1, e.audioIntervalValue = 80, e.lastPTS = 0, e.ptsCount = 0, e.maxCacheFrameNum = 0, e.calcDelayFlag = !0, e.procVideoFlag = !1, e .procAudioFlag = !1; var t = function() { null == e.videoRawData && (e.videoRawData = d._malloc(16588800)), null == e.audioRawData && (e .audioRawData = d._malloc(16384)), null == e.videoPacketData && (e.videoPacketData = d ._malloc(1048576)), null == e.audioPacketData && (e.audioPacketData = d._malloc(2048)), e .wasmDecoderId < 0 && (e.wasmDecoderId = d._WasmDecoder_OpenChannel()) }, i = function(t, i, r, n, a, s, u, l, c, h) { if (e.procVideoFlag) return -1; e.procVideoFlag = !0, d.HEAPU8.set(l, e.videoPacketData); var f, p = o.G, m = 0; p == o.G ? m = 0 : p == o.E ? m = 2 : p == o.F && (m = 26), 1 == t && e.videoFrameNum > 0 && (e .videoFrameNum -= 1), 1 == t && !e.wasmInitVideoDecoder && r ? 0 == d ._WasmDecoder_OpenVideoDecoder(e.wasmDecoderId, i, 0, 0, m) && (e.wasmInitVideoDecoder = !0) : 2 != t || e.wasmInitAudioDecoder || 0 == d._WasmDecoder_OpenAudioDecoder(e.wasmDecoderId, i, a, u, s) && (e.wasmInitAudioDecoder = !0); var g = null; if (1 == t && e.wasmInitVideoDecoder ? g = d._WasmDecoder_DecodeVideoFrame(e.wasmDecoderId, e .videoPacketData, c, 0, 0, e.videoRawData, 0) : 2 == t && e.wasmInitAudioDecoder && e .enableAudio && (g = d._WasmDecoder_DecodeAudioFrame(e.wasmDecoderId, e.videoPacketData, c, e .audioRawData, 0)), 0 != g && null != g) { var v = d.HEAPU32[g / 4], y = (d.HEAPU32[g / 4 + 1], d.HEAPU32[g / 4 + 2]), _ = (d.HEAPU32[g / 4 + 3], d.HEAPU32[g / 4 + 4]), b = d.HEAPU32[g / 4 + 5], w = (d.HEAPU32[g / 4 + 6], d.HEAPU32[g / 4 + 7]), E = d.HEAPU32[g / 4 + 8], T = d.HEAPU32[g / 4 + 9], S = d.HEAPU32[g / 4 + 10], A = d.HEAPU32[g / 4 + 11], k = (d.HEAPU32[g / 4 + 12], d.HEAPU32[g / 4 + 13]); if (y < 1) return void(e.procVideoFlag = !1); if (1 == v) { 0 == m ? f = _ * b * 3 / 2 : 2 == m ? f = _ * b * 3 : (25 == m || 26 == m) && (f = _ * b * 4); var R = d.HEAPU8.subarray(e.videoRawData, e.videoRawData + f), M = new Uint8Array(R), O = { cmd: o.q, workerId: o.a, mediaType: 1, ts: k, width: _, height: b, framesize: c, rawsize: f, fps: w, interval: E, playTimeSec: n, frameNum: e.videoFrameNum, dat: M, sei: h }; if (e.postMessage(O, [O.dat.buffer]), _ >= 1920 && b >= 720) return e.procVideoFlag = !1, 1 } else if (2 == v) { R = d.HEAPU8.subarray(e.audioRawData, e.audioRawData + y), M = new Uint8Array(R); var C = 0; 8 == A ? C = 0 : 16 == A ? C = 1 : 32 == A && (C = 2), O = { cmd: o.q, workerId: o.a, mediaType: 2, fmt: C, ch: T, samplerate: S, ts: k, framesize: y, dat: M }, e.postMessage(O, [O.dat.buffer]) } } return e.procVideoFlag = !1, 0 }, r = function(t, i, r, n, a, s) { d.HEAPU8.set(a, e.audioPacketData), e.wasmInitAudioDecoder || 0 == d ._WasmDecoder_OpenAudioDecoder(e.wasmDecoderId, t, i, n, r) && (e.wasmInitAudioDecoder = !0); var u = null; if (e.wasmInitAudioDecoder && e.enableAudio && (u = d._WasmDecoder_DecodeAudioFrame(e .wasmDecoderId, e.audioPacketData, s, e.audioRawData, 0)), 0 != u && null != u) { d.HEAPU32[u / 4], d.HEAPU32[u / 4 + 1]; var l = d.HEAPU32[u / 4 + 2], c = (d.HEAPU32[u / 4 + 3], d.HEAPU32[u / 4 + 4], d.HEAPU32[u / 4 + 5], d.HEAPU32[u / 4 + 6], d.HEAPU32[u / 4 + 7], d.HEAPU32[u / 4 + 8], d.HEAPU32[u / 4 + 9]), h = d.HEAPU32[u / 4 + 10], f = d.HEAPU32[u / 4 + 11], p = (d.HEAPU32[u / 4 + 12], d.HEAPU32[u / 4 + 13]); if (l < 1) return; var m = d.HEAPU8.subarray(e.audioRawData, e.audioRawData + l), g = new Uint8Array(m), v = 0; 8 == f ? v = 0 : 16 == f ? v = 1 : 32 == f && (v = 2); var y = { cmd: o.q, workerId: o.a, mediaType: 2, fmt: v, ch: c, samplerate: h, ts: p, framesize: l, dat: g }; e.postMessage(y, [y.dat.buffer]) } }, n = function() { if (e.wasmDecoderId < 0 && t(), e.wasmDecoderId > 0 && e.videoQueue.length > 0 && !e.pause) { var r = null, n = -1; if (e.isFlvStream) { if (e.findKeyFrame) for (; e.videoQueue.length > 0;) { if ((r = e.videoQueue[0]).frameType && e.videoQueue.length < 120) { e.findKeyFrame = !1; break } e.videoQueue.shift() } else e.videoQueue.length > 120 && (console.log("videoQueue.length: " + e.videoQueue .length), e.findKeyFrame = !0); e.videoQueue.length > 0 && (null == r && (r = e.videoQueue[0]), n = i(r.mediaType, r .codecId, r.frameType, r.playTimeSec, r.samplerate, r.channelNum, r.bitPerSample, r .dat, r.dat.length, r.sei)) } else r = e.videoQueue[0], n = i(r.mediaType, r.codecId, r.frameType, r.playTimeSec, r .samplerate, r.channelNum, r.bitPerSample, r.dat, r.dat.length); n >= 0 && e.videoQueue.shift(), e.videoQueue.length > e.maxCacheFrameNum && e.videoQueue .length } }, a = function() { if (!(e.wasmDecoderId < 0) && e.wasmDecoderId > 0) for (; e.audioQueue.length > 0 && !e.pause;) if (!e.pause) { var t = e.audioQueue[0]; e.enableAudio && r(t.codecId, t.samplerate, t.channelNum, t.bitPerSample, t.dat, t.dat .length), e.audioQueue.shift() } }; d.onRuntimeInitialized = function() { e.videoIntervalHandle < 0 && (e.videoIntervalHandle = setInterval(n, e.videoIntervalValue)), e .audioIntervalHandle < 0 && (e.audioIntervalHandle = setInterval(a, e.audioIntervalValue)); var t = { cmd: o.n }; e.postMessage(t), u = !0 }, d.onExit = function() {}; var f = function(t) { if (t > e.lastPTS) if (e.lastPTS > 0) { if (e.videoQueue.length % 5 == 0) { var i = e.ptsCount / 5; e.videoQueue.length <= e.maxCacheFrameNum && function(t) { if (u) { var i = t; (i < 5 || i > 500) && (i = 40), i != e.videoIntervalValue && (e .videoIntervalHandle >= 0 && (clearInterval(e.videoIntervalHandle), e .videoIntervalHandle = -1), e.videoIntervalValue = Math.floor(i), e .videoIntervalHandle = setInterval(n, e.videoIntervalValue)) } }(i), e.ptsCount = t - e.lastPTS } else e.ptsCount += t - e.lastPTS; e.lastPTS = t } else e.lastPTS = t, e.ptsCount = 40; else e.lastPTS = t, e.ptsCount = 40 }; e.addEventListener("message", function(i) { var r = i.data; switch (r.cmd) { case o.w: l = r.url, e.isFlvStream = r.isFlv, u || c(); break; case o.l: e.exitFlag = !0, h = null, e.videoIntervalHandle >= 0 && (clearInterval(e .videoIntervalHandle), e.videoIntervalHandle = -1), e.audioIntervalHandle >= 0 && ( clearInterval(e.audioIntervalHandle), e.audioIntervalHandle = -1), e.wasmDecoderId > 0 && (d._WasmDecoder_CloseChannel(e.wasmDecoderId), e.wasmDecoderId = -1), null != e .videoRawData && (d._free(e.videoRawData), e.videoRawData = null), null != e .audioRawData && (d._free(e.audioRawData), e.audioRawData = null), null != e .videoPacketData && (d._free(e.videoPacketData), e.videoPacketData = null), null != e .audioPacketData && (d._free(e.audioPacketData), e.audioPacketData = null), e.videoQueue .clear, e.videoQueue = [], e.videoQueue.length = 0, e.videoFrameNum = 0, e.audioQueue .clear, e.audioQueue = [], e.audioQueue.length = 0, delete d.HEAP8, delete d.HEAP16, delete d.HEAP32, delete d.HEAPF32, delete d.HEAPF64, delete d.HEAPU8, delete d.HEAPU16, delete d.HEAPU32, delete d.buffer, d.HEAP8 = null, d.HEAP16 = null, d.HEAP32 = null, d .HEAPF32 = null, d.HEAPF64 = null, d.HEAPU8 = null, d.HEAPU16 = null, d.HEAPU32 = null, d.buffer = null, s = !1, d.callMain("exit"), d = null; var n = { cmd: o.l, workerId: o.a }; e.postMessage(n), close(); break; case o.v: e.enableAudio = !0; break; case o.k: e.enableAudio = !1; break; case o.x: e.pause = !0; break; case o.A: e.pause = !1; break; case o.B: e.videoQueue.clear, e.videoQueue = [], e.videoQueue.length = 0, e.videoFrameNum = 0, e .audioQueue.clear, e.audioQueue = [], e.audioQueue.length = 0; break; case o.D: e.updateIntervalTime(r.interval); break; case o.q: if (e.exitFlag) break; u ? e.isFlvStream ? (e.wasmDecoderId < 0 && t(), e.wasmDecoderId > 0 ? 1 == r.mediaType ? e.videoIntervalHandle >= 0 && (e.videoQueue.push(r), e.maxCacheFrameNum = 5) : 2 == r .mediaType && e.audioIntervalHandle >= 0 && !e.findKeyFrame && e.audioQueue.push(r) : e.videoQueue.length < 100 && 1 == r.mediaType && r.frameType && e .videoIntervalHandle >= 0 && (e.videoQueue.push(r), e.videoQueue.length >= 5 && e .videoQueue.shift())) : (1 == r.mediaType ? e.videoIntervalHandle >= 0 && (e .videoQueue.push(r), f(r.samplerate), e.videoFrameNum += 1, e.calcDelayFlag && e .maxCacheFrameNum < e.videoQueue.length ? e.maxCacheFrameNum = e.videoQueue.length : e.calcDelayFlag && (e.calcDelayFlag = !1)) : 2 == r.mediaType && e .audioIntervalHandle >= 0 && e.audioQueue.push(r), e.needMoreData = !1) : e .isFlvStream && e.videoQueue.length < 5 ? 1 == r.mediaType && r.frameType && e .videoIntervalHandle >= 0 && (e.videoQueue.push(r), e.videoQueue.length >= 5 && e .videoQueue.shift()) : !e.isFlvStream && e.videoQueue.length < 1e3 && (1 == r .mediaType ? e.videoIntervalHandle >= 0 && (e.videoQueue.push(r), f(r.samplerate), e .videoFrameNum += 1, e.calcDelayFlag && e.maxCacheFrameNum < e.videoQueue.length ? e .maxCacheFrameNum = e.videoQueue.length : e.calcDelayFlag && (e.calcDelayFlag = !1) ) : 2 == r.mediaType && e.audioIntervalHandle >= 0 && e.audioQueue.push(r)) } }) }; t.default = h; var f = d, p = c, m = u }.call(this, i(9), "/", i(68)(e), i(10).Buffer) }, function(e, t, i) { "use strict"; i.r(t); var r = i(43), n = i(37), a = { enableWorker: !1, enableStashBuffer: !0, stashInitialSize: void 0, isLive: !1, lazyLoad: !0, lazyLoadMaxDuration: 180, lazyLoadRecoverDuration: 30, deferLoadAfterSourceOpen: !0, autoCleanupMaxBackwardDuration: 180, autoCleanupMinBackwardDuration: 120, statisticsInfoReportInterval: 600, fixAudioTimestampGap: !0, accurateSeek: !1, seekType: "range", seekParamStart: "bstart", seekParamEnd: "bend", rangeLoadZeroStart: !1, customSeekHandler: void 0, reuseRedirectedURL: !1, headers: void 0, customLoader: void 0 }; function s() { return Object.assign({}, a) } var o = function() { function e() {} return e.supportMSEH264Playback = function() { return window.MediaSource && window.MediaSource.isTypeSupported( 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"') }, e.supportNetworkStreamIO = function() { var e = new n.a({}, s()), t = e.loaderType; return e.destroy(), "fetch-stream-loader" == t || "xhr-moz-chunked-loader" == t }, e.getNetworkLoaderTypeName = function() { var e = new n.a({}, s()), t = e.loaderType; return e.destroy(), t }, e.supportNativeMediaPlayback = function(t) { null == e.videoElement && (e.videoElement = window.document.createElement("video")); var i = e.videoElement.canPlayType(t); return "probably" === i || "maybe" == i }, e.getFeatureList = function() { var t = { mseFlvPlayback: !1, mseLiveFlvPlayback: !1, networkStreamIO: !1, networkLoaderName: "", nativeMP4H264Playback: !1, nativeWebmVP8Playback: !1, nativeWebmVP9Playback: !1 }; return t.mseFlvPlayback = e.supportMSEH264Playback(), t.networkStreamIO = e .supportNetworkStreamIO(), t.networkLoaderName = e.getNetworkLoaderTypeName(), t .mseLiveFlvPlayback = t.mseFlvPlayback && t.networkStreamIO, t.nativeMP4H264Playback = e .supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'), t .nativeWebmVP8Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'), t .nativeWebmVP9Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp9"'), t }, e }(), u = i(3), l = (i(128), i(8)), d = i.n(l), c = i(0), h = i(7), f = { ERROR: "error", LOADING_COMPLETE: "loading_complete", RECOVERED_EARLY_EOF: "recovered_early_eof", MEDIA_INFO: "media_info", METADATA_ARRIVED: "metadata_arrived", SCRIPTDATA_ARRIVED: "scriptdata_arrived", STATISTICS_INFO: "statistics_info" }, p = i(21), m = i.n(p), g = i(19), v = i(36), y = i(2), _ = i(17), b = i(1), w = { ERROR: "error", SOURCE_OPEN: "source_open", UPDATE_END: "update_end", BUFFER_FULL: "buffer_full", UPDATE_PLAY_INFO: "update_play_info", CHANGE_SPEED: "change_speed", SOURCE_ENDED: "source_ended", RECORDING_END: "recording_end" }, E = function() { function e(e) { this.gl = e, this.texture = null } var t = e.prototype; return t.create = function() { var e = this.gl; this.texture = e.createTexture(), this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture), this.gl .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR), this.gl .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR), this.gl .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE), this.gl .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE) }, t.bind = function(e, t, i) { this.gl.activeTexture([this.gl.TEXTURE0, this.gl.TEXTURE1, this.gl.TEXTURE2, this.gl.TEXTURE3][e]), this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture), this.gl.uniform1i(this.gl .getUniformLocation(t, i), e) }, t.fill = function(e, t, i) { this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture), this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.LUMINANCE, e, t, 0, this.gl.LUMINANCE, this.gl.UNSIGNED_BYTE, i) }, e }(), T = function() { function e(e) { this.enableTextTexture = 0, this.canvas = e, this.gl = null, this.program = null, this.gl = e .getContext("webgl") || e.getContext("experimental-webgl"), this.yuv_vertex_shader_source = [ "attribute highp vec4 aVertexPosition;", "attribute vec2 aTextureCoord;", "varying highp vec2 vTextureCoord;", "void main(void) {", " gl_Position = aVertexPosition;", " vTextureCoord = aTextureCoord;", "}" ], this.yuv_fragment_shader_source = ["precision highp float;", "varying lowp vec2 vTextureCoord;", "uniform sampler2D YTexture;", "uniform sampler2D UTexture;", "uniform sampler2D VTexture;", "uniform sampler2D TTexture;", "const mat4 YUV2RGB = mat4", "(", " 1.1643828125, 0, 1.59602734375, -.87078515625,", " 1.1643828125, -.39176171875, -.81296875, .52959375,", " 1.1643828125, 2.017234375, 0, -1.081390625,", " 0, 0, 0, 1", ");", "void main(void) {", " gl_FragColor = mix(vec4( texture2D(YTexture, vTextureCoord).x, texture2D(UTexture, vTextureCoord).x, texture2D(VTexture, vTextureCoord).x, 1) * YUV2RGB, texture2D(TTexture, vTextureCoord), 0.1);", "}" ], this.vertex_shader_source = "\n attribute vec4 apos;\n void main(){\n gl_Position = apos;\n }", this.frag_shader_source = "\n void main(){\n gl_FragColor = vec4(0,0,1,1);\n }", this .yuv_program = null, this.sei_program = null, this.index = 0 } var t = e.prototype; return t.initSEIProgram = function() { var e = this.gl, t = e.createShader(e.VERTEX_SHADER), i = e.createShader(e.FRAGMENT_SHADER); e.shaderSource(t, this.vertex_shader_source), e.shaderSource(i, this.frag_shader_source), e .compileShader(t), e.compileShader(i), this.sei_program = e.createProgram(), e.attachShader(this .sei_program, t), e.attachShader(this.sei_program, i), e.linkProgram(this.sei_program) }, t.drawSEI = function(e) { var t = this.gl, i = []; if ("string" == typeof e && (e = JSON.parse(e)), e && e.length) { e.forEach(function(e) { var t = parseFloat((2 * e.x1 - 1).toFixed(2)), r = parseFloat((1 - 2 * e.y1).toFixed(2)), n = parseFloat((2 * e.x2 - 1).toFixed(2)), a = parseFloat((1 - 2 * e.y2).toFixed(2)); i = [].concat(i, [t, r, t, a, n, a, n, r]) }); var r = new Float32Array(i); if (r.length) { t.useProgram(this.sei_program); var n = t.getAttribLocation(this.sei_program, "apos"), a = t.createBuffer(); t.bindBuffer(t.ARRAY_BUFFER, a), t.bufferData(t.ARRAY_BUFFER, r, t.STATIC_DRAW), t .vertexAttribPointer(n, 2, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(n); for (var s = 0; s < r.length / 2; s += 4) t.drawArrays(t.LINE_LOOP, s, 4) } } }, t.initYUVProgram = function() { var e = this.gl; if (!this.gl) return console.log("[ER] WebGL not supported."); e.pixelStorei(e.UNPACK_ALIGNMENT, 1), this.yuv_program = e.createProgram(); var t = e.createShader(e.VERTEX_SHADER), i = e.createShader(e.FRAGMENT_SHADER); e.shaderSource(t, this.yuv_vertex_shader_source.join("\n")), e.shaderSource(i, this .yuv_fragment_shader_source.join("\n")), e.compileShader(t), e.compileShader(i), e.attachShader( this.yuv_program, t), e.attachShader(this.yuv_program, i), e.linkProgram(this.yuv_program) }, t.drawYUV = function(e, t, i, r, n) { var a = this.gl; if (a.useProgram(this.yuv_program), !a.getProgramParameter(this.yuv_program, a.LINK_STATUS)) return console.log("[ER] Shader link failed."); var s = a.getAttribLocation(this.yuv_program, "aVertexPosition"); a.enableVertexAttribArray(s); var o = a.getAttribLocation(this.yuv_program, "aTextureCoord"); a.enableVertexAttribArray(o); var u = a.createBuffer(); a.bindBuffer(a.ARRAY_BUFFER, u), a.bufferData(a.ARRAY_BUFFER, new Float32Array([1, 1, 0, -1, 1, 0, 1, -1, 0, -1, -1, 0 ]), a.STATIC_DRAW), a.vertexAttribPointer(s, 3, a.FLOAT, !1, 0, 0); var l = a.createBuffer(); a.bindBuffer(a.ARRAY_BUFFER, l), a.bufferData(a.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1 ]), a.STATIC_DRAW), a.vertexAttribPointer(o, 2, a.FLOAT, !1, 0, 0), a.y = new E(a), a.y.create(0, null), a.u = new E(a), a.u.create(0, null), a.v = new E(a), a.v.create(0, null), a.y.bind(0, this.yuv_program, "YTexture"), a.u.bind(1, this.yuv_program, "UTexture"), a.v.bind(2, this .yuv_program, "VTexture"), a.y.fill(t, i, e.subarray(0, r)), a.u.fill(t >> 1, i >> 1, e .subarray(r, r + n)), a.v.fill(t >> 1, i >> 1, e.subarray(r + n, e.length)), a.drawArrays(a .TRIANGLE_STRIP, 0, 4) }, t.initGL = function() { this.initYUVProgram(), this.initSEIProgram() }, t.renderFrame = function(e, t, i, r, n, a) { if (!this.gl) return console.log("[ER] Render frame failed due to WebGL not supported."); var s = this.gl; s.viewport(0, 0, s.canvas.width, s.canvas.height), s.clearColor(0, 0, 0, 0), s.clear(s .COLOR_BUFFER_BIT), e && (this.drawYUV(e, t, i, r, n), this.drawSEI(a)) }, t.renderVideoFrame = function(e, t, i, r) { if (this.gl && e) if (t < 1 || i < 1) { var n = this.gl, a = new Uint8Array(n.canvas.width * n.canvas.height * 3 / 2), s = 0, o = n.canvas.width * n.canvas.height, u = n.canvas.width * n.canvas.height * 5 / 4, l = a.byteLength; for (s = o; s < u; s++) a[s] = 128; for (s = u; s < l; s++) a[s] = 128; var d = n.canvas.width * n.canvas.height, c = n.canvas.width / 2 * (n.canvas.height / 2); this.renderFrame(a, n.canvas.width, n.canvas.height, d, c, r) } else { var h = t * i, f = t / 2 * (i / 2); this.renderFrame(e, t, i, h, f, r) } }, t.destroy = function() { this.gl && (this.gl.deleteTexture(this.gl.y.texture), this.gl.deleteTexture(this.gl.u.texture), this .gl.deleteTexture(this.gl.v.texture), this.yuv_program = null, this.sei_program = null, this .gl = null) }, e }(), S = function() { function e() { this._pause = !1, this.stopFlag = !1, this.bufferSourcePtr = null } var t = e.prototype; return t.destroy = function() { this.interval && clearInterval(this.interval), this.samples = null, this.audioCtx.close(), this .audioCtx = null }, t.init = function(e) { this.option = Object.assign({}, { encoding: "16bitInt", channels: 2, sampleRate: 8e3, flushingTime: 1e3 }, e, { sampleRate: 8e3 === e.sampleRate ? 16e3 : e.sampleRate }), this.samples = new Float32Array, this.flush = this.flush.bind(this), this.interval = setInterval(this.flush, this.option.flushingTime), this.maxValue = this.getMaxValue(), this .typedArray = this.getTypedArray(), this.createContext() }, t.getMaxValue = function() { var e = { "8bitInt": 128, "16bitInt": 32768, "32bitInt": 2147483648, "32bitFloat": 1 }; return e[this.option.encoding] ? e[this.option.encoding] : e["16bitInt"] }, t.getTypedArray = function() { var e = { "8bitInt": Int8Array, "16bitInt": Int16Array, "32bitInt": Int32Array, "32bitFloat": Float32Array }; return e[this.option.encoding] ? e[this.option.encoding] : e["16bitInt"] }, t.createContext = function() { this.audioCtx = new(window.AudioContext || window.webkitAudioContext), this.gainNode = this.audioCtx .createGain(), this.gainNode.gain.value = 1, this.gainNode.connect(this.audioCtx.destination), this.startTime = this.audioCtx.currentTime }, t.isTypedArray = function(e) { return e.byteLength && e.buffer && e.buffer.constructor == ArrayBuffer }, t.feed = function(e) { if (this.isTypedArray(e)) { e = this.getFormatedValue(e); var t = new Float32Array(this.samples.length + e.length); t.set(this.samples, 0), t.set(e, this.samples.length), this.samples = t } }, t.getFormatedValue = function(e) { e = new this.typedArray(e.buffer); var t, i = new Float32Array(e.length); for (t = 0; t < e.length; t++) i[t] = e[t] / this.maxValue; return i }, t.volume = function(e) { this.gainNode.gain.value = e }, t.flush = function() { if (null != this.samples && this.samples.length) { var e, t, i, r, n, a = this.audioCtx.createBufferSource(), s = this.samples.length / this.option.channels, o = this.audioCtx.createBuffer(this.option.channels, s, this.option.sampleRate); for (t = 0; t < this.option.channels; t++) for (e = o.getChannelData(t), i = t, n = 50, r = 0; r < s; r++) e[r] = this.samples[i], r < 50 && (e[r] = e[r] * r / 50), r >= s - 51 && (e[r] = e[r] * n-- /50),i+=this.option.channels;this.startTime= u - 51 && (i[a] = i[a] * s-- /50),n+=this.option.channels;this.startTime=0;--n){var a=this.tryEntries[n],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(o&&u){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),E(i),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var r=i.completion;if("throw"===r.type){var n=r.arg;E(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:S(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),d}},e}function k(e,t,i,r,n,a,s){try{var o=e[a](s),u=o.value}catch(e){return void i(e)}o.done?t(u):Promise.resolve(u).then(r,n)}var R=function(){function e(e,t,i){var r=this;if(this.TAG="Transmuxer",this._emitter=new d.a,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=m()(228),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},g.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:g.a.getConfig()})}catch(i){c.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new v.a(e,t)}else this._controller=new v.a(e,t);if(this._controller){var n=this._controller;n.on(y.a.IO_ERROR,this._onIOError.bind(this)),n.on(y.a.DEMUX_ERROR,this._onDemuxError.bind(this)),n.on(y.a.INIT_SEGMENT,this._onInitSegment.bind(this)),n.on(y.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),n.on(y.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),n.on(y.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),n.on(y.a.MEDIA_INFO,this._onMediaInfo.bind(this)),n.on(y.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),n.on(y.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),n.on(y.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),n.on(y.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this)),n.on(y.a.SEI_DATA,this._onReceiveSEIData.bind(this)),n.on(y.a.AUDIO_ERROR,this._onAudioError.bind(this)),n.on(y.a.SOCKET_CLOSE,function(){return r._emitter.emit(w.SOURCE_ENDED)}),n.on(y.a.RECORDING,function(e){r._emitter.emit(y.a.RECORDING,e)}),n.on("loaderChunkArrival",function(e){return r._emitter.emit("loaderChunkArrival",e)}),n.on("hls_error",function(){return r._emitter.emit("hls_error")})}this._wasmDecodeWoker=null,this._wasmRecordingWoker=null,this._mediaCanvas=null,this._mediaElement=i,this._webGLPlayer=null,this._isH265=!1,this._totalDuration=0,this._initDuration=0,this._currentPlayTime=0,this.snapshotTimer=null,this.loadingCompleteTimer=null,this._wasmMuted=!1,this._isFlv=e.url.includes(".flv"),this._videoRecordFindKeyframe=!0,this._videoRecordFileName="record.mp4",this._wasmVideoRecordWorker=null,this._videoRecordiInitFlag=!1,this._wasmAudioPlayer=null,this._wasmAudioFmt=0,this._wasmAudioSamplerate=0,this._wasmAudioChannelNum=1,this._wasmInitAudioPlayer=!1,this._wasmRecordingCb=null}var t=e.prototype;return t.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),g.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._wasmDecodeWoker&&(this._wasmDecodeWoker.removeAllListeners&&this._wasmDecodeWoker.removeAllListeners(),this._wasmDecodeWoker.postMessage({cmd:b.l}),this._wasmDecodeWoker&&this._wasmDecodeWoker.terminate(),this._wasmDecodeWoker=null),this._wasmRecordingWoker&&(this._wasmRecordingWoker.removeAllListeners&&this._wasmRecordingWoker.removeAllListeners(),this._wasmRecordingWoker.postMessage({cmd:b.l}),this._wasmRecordingWoker&&this._wasmRecordingWoker.terminate(),this._wasmRecordingWoker=null),this._emitter.removeAllListeners(),this._emitter=null,this._mediaCanvas&&this._mediaCanvas.parentNode.removeChild(this._mediaCanvas),this._mediaCanvas=null,this._mediaElement=null,this._webGLPlayer=null,this.snapshotTimer&&clearTimeout(this.snapshotTimer),this.loadingCompleteTimer&&clearTimeout(this.loadingCompleteTimer),this.snapshotTimer=null,this.loadingCompleteTimer=null,this._wasmAudioPlayer=null,this._wasmRecordingCb=null},t.on=function(e,t){this._emitter.addListener(e,t)},t.off=function(e,t){this._emitter.removeListener(e,t)},t.hasWorker=function(){return null!=this._worker},t.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):(this._controller.setReceiveH265MediaFrame(this._onReceiveH265MediaFrame.bind(this)),this._controller.start())},t.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},t.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},t.pause=function(){if(this._isH265){var e={cmd:b.x};this._wasmDecodeWoker&&void 0!==this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage(e)}else this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},t.resume=function(){if(this._isH265){var e={cmd:b.A};this._wasmDecodeWoker&&void 0!==this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage(e)}else this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},t._onInitSegment=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.INIT_SEGMENT,e,t)})},t._onMediaSegment=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.MEDIA_SEGMENT,e,t)})},t._onLoadingComplete=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(y.a.LOADING_COMPLETE)})},t._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(y.a.RECOVERED_EARLY_EOF)})},t._onMediaInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.MEDIA_INFO,e)})},t._onMetaDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.METADATA_ARRIVED,e)})},t._onScriptDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.SCRIPTDATA_ARRIVED,e)})},t._onStatisticsInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.STATISTICS_INFO,e)})},t._onIOError=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.IO_ERROR,e,t)})},t._onDemuxError=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.DEMUX_ERROR,e,t)})},t._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.RECOMMEND_SEEKPOINT,e)})},t._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.RECOMMEND_SEEKPOINT,e)})},t._encodedH265=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(y.a.IS_ENCODED_H265,e._isH265)})},t._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},t._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case y.a.INIT_SEGMENT:case y.a.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case y.a.LOADING_COMPLETE:case y.a.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case y.a.MEDIA_INFO:Object.setPrototypeOf(i,_.a.prototype),this._emitter.emit(t.msg,i);break;case y.a.METADATA_ARRIVED:case y.a.SCRIPTDATA_ARRIVED:case y.a.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case y.a.IO_ERROR:case y.a.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case y.a.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":c.a.emitter.emit("log",i.type,i.logcat)}},t._onReceiveSEIData=function(e){this._emitter.emit(y.a.SEI_DATA,e)},t._onAudioError=function(){this._emitter.emit(y.a.AUDIO_ERROR)},t._creatCanvas=function(){var e=this;this._mediaElement.parentNode.style.position="relative";var t=document.createElement("canvas");t.style="width:100%;height:100%;position:absolute;top:0px;left:0px;display:none",this._mediaCanvas=t,this._mediaElement.parentNode.appendChild(this._mediaCanvas),this._mediaCanvas.ondblclick=function(){return e._emitter.emit(y.a.ON_DBL_CLICK)}},t._onReceiveH265MediaFrame=function(){var e,t=(e=A().mark(function e(t,i,r,n,a,s,o,u,l,d,c,h){var f,p,m,g;return A().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isH265||(this._isH265=!0,this._encodedH265(),this._creatCanvas()),!(n<1)||i||1!==o){e.next=3;break}return e.abrupt("return");case 3:if(2===r&&(this._wasmAudioSamplerate=l||0,this._wasmAudioChannelNum=d),null!==this._wasmDecodeWoker){e.next=7;break}return e.next=7,this._createWasmDecodeWorker();case 7:if(!this._wasmDecodeWoker){e.next=15;break}if(f=new Uint8Array(s),p={cmd:b.q,mediaType:r,codecId:n,frameType:a,samplerate:l,channelNum:d,bitPerSample:c,playTimeSec:u,dat:f,sei:h},this._wasmDecodeWoker.postMessage(p,[p.dat.buffer]),this._videoRecordiInitFlag){e.next=13;break}return e.abrupt("return");case 13:1==a&&(this._videoRecordFindKeyframe=!1),this._wasmVideoRecordWorker&&!this._videoRecordFindKeyframe&&(m=new Uint8Array(s),g={cmd:b.q,mediaType:"video",type:1==a,dat:m,pts:u},1===r?(g.mediaType="video",g.codecId="0xAE"):2===r&&(g.mediaType="audio"),this._wasmVideoRecordWorker.postMessage(g,[g.dat.buffer]));case 15:case"end":return e.stop()}},e,this)}),function(){var t=this,i=arguments;return new Promise(function(r,n){var a=e.apply(t,i);function s(e){k(a,r,n,s,o,"next",e)}function o(e){k(a,r,n,s,o,"throw",e)}s(void 0)})});return function(e,i,r,n,a,s,o,u,l,d,c,h){return t.apply(this,arguments)}}(),t._createWasmDecodeWorker=function(){if("undefined"!=typeof Worker)try{"none"===this._mediaCanvas.style.display&&(this._mediaCanvas.style.display="block"),this._wasmDecodeWoker=m()(229);var e={cmd:b.w,url:b.g(),isFlv:this._isFlv};this._wasmDecodeWoker.postMessage(e),this._wasmDecodeWoker.addEventListener("message",this._onWasmWorkerMessage.bind(this)),this._wasmDecodeWoker.onerror=function(e){}}catch(e){this._wasmDecodeWoker=null}else this._wasmDecodeWoker=null;this._wasmDecodeWoker&&null==this._webGLPlayer&&(this._webGLPlayer=new T(this._mediaCanvas),this._webGLPlayer&&this._webGLPlayer.initGL({preserveDrawingBuffer:!1}))},t._onWasmWorkerMessage=function(e){var t=e.data;switch(t.cmd){case b.o:case b.l:break;case b.n:this._wasmMuted&&this._openWasmAudio();break;case b.q:if(t.workerId===b.a)if(1===t.mediaType){if(this._mediaCanvas&&(this._mediaCanvas.width=t.width),this._mediaCanvas&&(this._mediaCanvas.height=t.height),t.playTimeSec>0){var i=Math.floor((t.playTimeSec+1e3)/ 1e3); this._currentPlayTime !== i && (this._initDuration > 0 && (this ._currentPlayTime += i - this._initDuration), this._initDuration !== i && (this ._initDuration = i, this._emitter && this._emitter.emit(w.UPDATE_PLAY_INFO))) } this._webGLPlayer && this._webGLPlayer.renderVideoFrame(t.dat, t.width, t.height, t.sei) } else 2 === t.mediaType && (null === this._wasmAudioPlayer ? this._creatWasmAudioPlayer(t.fmt, t .samplerate >= 16e3 ? 2 : t.ch, t.samplerate) : (this._wasmAudioFmt = t.fmt, this ._wasmAudioSamplerate = t.samplerate, this._wasmAudioChannelNum = t.ch, 44100 == this ._wasmAudioSamplerate && (this._wasmAudioFmt = 1)), this._wasmMuted && this ._wasmAudioPlayer && this._wasmInitAudioPlayer && this._wasmAudioPlayer.play(t.dat)); break; case b.m: break; case b.w: this._videoRecordiInitFlag = !0, this._videoRecordFindKeyframe = !0, this._wasmRecordingCb(1); break; case b.p: this._videoRecordiInitFlag = !1; if(this.stopRecoeding) { this._videoRecordFindKeyframe = !1, this._wasmVideoRecordWorker.terminate(), this._wasmVideoRecordWorker = null, this._wasmRecordingCb = null return false; } if(!window.isVideoWatermark) { var r = document.createElement("a"); r.style.display = 'none', r.href = t.dat, r.download = this._videoRecordFileName, document.body .appendChild(r), r.click(), window.URL.revokeObjectURL(r.href), document.body.removeChild(r), this._videoRecordFindKeyframe = !1, this._wasmVideoRecordWorker.terminate(), this._wasmVideoRecordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null return false; } fetch(t.dat).then(response => response.blob()).then(blob => { const file = new File([blob], this._videoRecordFileName, { type: blob.type }) console.log('=============视频加水印============2==', file) this._videoRecordFindKeyframe = !1, this._wasmVideoRecordWorker.terminate(), this._wasmVideoRecordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null const formData = new FormData() formData.append('file', file) fetch('/apiserver/export/alarm/order/downloadVideoByFlush', { method: 'POST', headers: { 'Authorization': 'Bearer ' + (window.$videoStoreData?.userInfo?.token || sessionStorage.getItem('Admin-Token')), 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || '' }, body: formData }).then(response => response.blob()).then(blob => { console.log('=============视频加水印============2=返回=', blob) var r = document.createElement("a"); r.style.display = 'none', r.href = window.URL.createObjectURL(new Blob([blob], { type: 'video/mp4' })), r.download = this._videoRecordFileName, document.body .appendChild(r), r.click(), window.URL.revokeObjectURL(r.href), document.body.removeChild(r) }) }) } }, t._creatWasmAudioPlayer = function(e, t, i) { if (null === this._wasmAudioPlayer) { var r; r = "16bitInt", this._wasmAudioPlayer = new S, this._wasmAudioPlayer.init({ encoding: r, channels: t, sampleRate: i, flushingTime: 1e3 }), this._wasmInitAudioPlayer = !0 } }, t._getCurrentPlayTime = function() { return this._currentPlayTime }, t._getTotalDuration = function() { if (this._controller) return this._controller._getHLSTotalDuration() }, t._seekToSecs = function(e, t) { var i = { cmd: b.B, type: t, time: e }; this._wasmDecodeWoker && this._wasmDecodeWoker.postMessage(i), this._controller._seekToSecs(e, t) }, t.saveLocalSnapshot = function(fn, name = '图片', count) { if(!count) { count = 0; } if(count > 100) { return false; } count ++; var e = this, t = void 0, m = new Date, n = name + "-" + m.getFullYear() + ('0' + (m.getMonth() + 1)).substr(-2) + ('0' + m.getDate()).substr(-2) + ('0' + m.getHours()).substr(-2) + ('0' + m.getMinutes()).substr(-2) + ('0' + m.getSeconds()).substr(-2) + ".png"; if (t.length < 786432) return this.snapshotTimer = setTimeout(function() { return e.saveLocalSnapshot(fn, name, count) }, 40); this.snapshotTimer && clearTimeout(this.snapshotTimer), this.snapshotTimer = null; for (var s = t.split(","), a = s[0].match(/:(.*?);/)[1], h = atob(s[1]), u = h.length, c = new Uint8Array(u); u--;) c[u] = h.charCodeAt(u); var g = new Blob([c], { type: a }), f = new File([c], n, { type: a }); const formData = new FormData() formData.append('file', f) console.log('=============图片加水印============1=请求=', f) fetch('/apiserver/export/alarm/order/downloadPhotoByFlush', { method: 'POST', headers: { 'Authorization': 'Bearer ' + sessionStorage.getItem('Admin-Token'), 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || '' }, body: formData }).then(response => response.blob()).then(blob => { console.log('=============图片加水印============1=返回=', blob) if(fn) { fn({ base64: t, blob, file: new File([blob], n, { type: a }) }); return; } var i = document.createElement("a"); i.download = n, i.href = window.URL.createObjectURL(blob), document.body.appendChild(i), i.click(), i.remove(), window.URL.revokeObjectURL(i.href) }) }, t.videoRecording = function(e, t, i, r, stop) { this.stopRecoeding = stop; if (r && (this._wasmRecordingCb = r), this._wasmDecodeWoker) if (1 === i) { this._wasmVideoRecordWorker = null; if (this._videoRecordFileName = e, this._videoRecordingCB = r, null === this ._wasmVideoRecordWorker) { this._videoRecordFindKeyframe = !0; try { this._wasmVideoRecordWorker = m()(67), this.onwmsg = this._onWasmWorkerMessage.bind(this); var n = { cmd: b.w, url: b.g(), filesize: t, audioSamplerate: this._wasmAudioSamplerate, channelCount: this._wasmAudioChannelNum }; this._wasmVideoRecordWorker.postMessage(n), this._wasmVideoRecordWorker.addEventListener( "message", this.onwmsg) } catch (e) { this._wasmVideoRecordWorker && this._wasmVideoRecordWorker.terminate(), this ._wasmVideoRecordWorker = null } } } else this._videoRecordiInitFlag = !1, this._wasmVideoRecordWorker && (this._wasmVideoRecordWorker .postMessage({ cmd: b.C }), this._videoRecordFindKeyframe = !0); else { if (!this._controller) return; this._controller.videoRecording(e, t, i, r, stop) } }, t._openWasmAudio = function() { this._wasmDecodeWoker && (this._wasmDecodeWoker.postMessage({ cmd: b.v }), this._wasmMuted = !0, null === this._wasmAudioPlayer && (this._wasmAudioSamplerate > 0 ? this ._creatWasmAudioPlayer(this._wasmAudioFmt, this._wasmAudioSamplerate >= 16e3 ? 2 : this ._wasmAudioChannelNum, this._wasmAudioSamplerate) : console.log("采样率无效"))) }, t._closeWasmAudio = function() { this._wasmAudioPlayer && this._wasmInitAudioPlayer && this._wasmAudioPlayer.clearAudioBuffer(), this ._wasmAudioPlayer && this._wasmInitAudioPlayer && this._wasmAudioPlayer.pause(), this._wasmMuted = !1 }, e }(), M = i(16), O = i(4), C = function() { function e(e) { this.TAG = "MSEController", this._config = e, this._emitter = new d.a, this._config.isLive && null == this ._config.autoCleanupSourceBuffer && (this._config.autoCleanupSourceBuffer = !0), this.e = { onSourceOpen: this._onSourceOpen.bind(this), onSourceEnded: this._onSourceEnded.bind(this), onSourceClose: this._onSourceClose.bind(this), onSourceBufferError: this._onSourceBufferError.bind(this), onSourceBufferUpdateEnd: this._onSourceBufferUpdateEnd.bind(this) }, this._mediaSource = null, this._mediaSourceObjectURL = null, this._mediaElement = null, this ._isBufferFull = !1, this._hasPendingEos = !1, this._requireSetMediaDuration = !1, this ._pendingMediaDuration = 0, this._pendingSourceBufferInit = [], this._mimeTypes = { video: null, audio: null }, this._sourceBuffers = { video: null, audio: null }, this._lastInitSegments = { video: null, audio: null }, this._pendingSegments = { video: [], audio: [] }, this._pendingRemoveRanges = { video: [], audio: [] }, this._idrList = new M.a, this._pause = !1, this._hlsSeekTime = 0, this._lastPlayTime = 0, this ._currentPlayTime = 0, this._audioError = !1 } var t = e.prototype; return t.destroy = function() { (this._mediaElement || this._mediaSource) && this.detachMediaElement(), this.e = null, this._emitter .removeAllListeners(), this._emitter = null }, t.on = function(e, t) { this._emitter.addListener(e, t) }, t.off = function(e, t) { this._emitter.removeListener(e, t) }, t.attachMediaElement = function(e) { var t = this; if (this._mediaSource) throw new O.a("MediaSource has been attached to an HTMLMediaElement!"); var i = this._mediaSource = new window.MediaSource; i.addEventListener("sourceopen", this.e.onSourceOpen), i.addEventListener("sourceended", this.e .onSourceEnded), i.addEventListener("sourceclose", this.e.onSourceClose), this._mediaElement = e, this._mediaSourceObjectURL = window.URL.createObjectURL(this._mediaSource), this._mediaElement.src = this._mediaSourceObjectURL, e.addEventListener("timeupdate", function() { var i = Math.floor(e.currentTime); t._hlsSeekTime > 0 && (i = i - self._lastPlayTime + self._hlsSeekTime), t._currentPlayTime !== i && (t._currentPlayTime = i, t._emitter && t._emitter.emit(w.UPDATE_PLAY_INFO, { currentTime: t._currentPlayTime, duration: t._mediaElement.duration })) }, !1) }, t.getCurrentPlayTime = function() { return this._currentPlayTime }, t.getTotalDuration = function() { return this._mediaElement.duration }, t.detachMediaElement = function() { if (this._mediaSource) { var e = this._mediaSource; for (var t in this._sourceBuffers) { var i = this._pendingSegments[t]; i.splice(0, i.length), this._pendingSegments[t] = null, this._pendingRemoveRanges[t] = null, this ._lastInitSegments[t] = null; var r = this._sourceBuffers[t]; if (r) { if ("closed" !== e.readyState) { try { e.removeSourceBuffer(r) } catch (e) { c.a.e(this.TAG, e.message) } r.removeEventListener("error", this.e.onSourceBufferError), r.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd) } this._mimeTypes[t] = null, this._sourceBuffers[t] = null } } if ("open" === e.readyState) try { e.endOfStream() } catch (e) { c.a.e(this.TAG, e.message) } e.removeEventListener("sourceopen", this.e.onSourceOpen), e.removeEventListener("sourceended", this.e .onSourceEnded), e.removeEventListener("sourceclose", this.e.onSourceClose), this ._pendingSourceBufferInit = [], this._isBufferFull = !1, this._idrList.clear(), this._mediaSource = null } this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this ._mediaElement = null), this._mediaSourceObjectURL && (window.URL.revokeObjectURL(this ._mediaSourceObjectURL), this._mediaSourceObjectURL = null) }, t.appendInitSegment = function(e, t) { if (!this._mediaSource || "open" !== this._mediaSource.readyState) return this._pendingSourceBufferInit .push(e), void this._pendingSegments[e.type].push(e); var i = e, r = "" + i.container; i.codec && i.codec.length > 0 && (r += ";codecs=" + i.codec); var n = !1; if (this._lastInitSegments[i.type] = i, r !== this._mimeTypes[i.type]) { if (this._mimeTypes[i.type]) c.a.v(this.TAG, "Notice: " + i.type + " mimeType changed, origin: " + this._mimeTypes[i.type] + ", target: " + r); else { n = !0; try { var a = this._sourceBuffers[i.type] = this._mediaSource.addSourceBuffer(r); a.addEventListener("error", this.e.onSourceBufferError), a.addEventListener("updateend", this.e .onSourceBufferUpdateEnd) } catch (e) { return c.a.e(this.TAG, e.message), void this._emitter.emit(w.ERROR, { code: e.code, msg: e.message }) } } this._mimeTypes[i.type] = r } t || this._pendingSegments[i.type].push(i), n || this._sourceBuffers[i.type] && !this._sourceBuffers[i .type].updating && this._doAppendSegments(), h.a.safari && "audio/mpeg" === i.container && i .mediaDuration > 0 && (this._requireSetMediaDuration = !0, this._pendingMediaDuration = i .mediaDuration / 1e3, this._updateMediaSourceDuration()) }, t.appendMediaSegment = function(e) { if ("audio" !== e.type || !this._audioError) { var t = e; this._pendingSegments[t.type].push(t), this._config.autoCleanupSourceBuffer && this ._needCleanupSourceBuffer() && this._doCleanupSourceBuffer(); var i = this._sourceBuffers[t.type]; !i || i.updating || this._hasPendingRemoveRanges() || this._doAppendSegments() } }, t.seek = function(e) { for (var t in this._sourceBuffers) if (this._sourceBuffers[t]) { var i = this._sourceBuffers[t]; if ("open" === this._mediaSource.readyState) try { i.abort() } catch (e) { c.a.e(this.TAG, e.message) } this._idrList.clear(); var r = this._pendingSegments[t]; if (r.splice(0, r.length), "closed" !== this._mediaSource.readyState) { for (var n = 0; n < i.buffered.length; n++) { var a = i.buffered.start(n), s = i.buffered.end(n); this._pendingRemoveRanges[t].push({ start: a, end: s }) } if (i.updating || this._doRemoveRanges(), h.a.safari) { var o = this._lastInitSegments[t]; o && (this._pendingSegments[t].push(o), i.updating || this._doAppendSegments()) } } } }, t.endOfStream = function() { var e = this._mediaSource, t = this._sourceBuffers; e && "open" === e.readyState ? t.video && t.video.updating || t.audio && t.audio.updating ? this ._hasPendingEos = !0 : (this._hasPendingEos = !1, e.endOfStream()) : e && "closed" === e.readyState && this._hasPendingSegments() && (this._hasPendingEos = !0) }, t.getNearestKeyframe = function(e) { return this._idrList.getLastSyncPointBeforeDts(e) }, t._needCleanupSourceBuffer = function() { if (!this._config.autoCleanupSourceBuffer) return !1; var e = this._mediaElement.currentTime; for (var t in this._sourceBuffers) { var i = this._sourceBuffers[t]; if (i) { var r = i.buffered; if (r.length >= 1 && e - r.start(0) >= this._config.autoCleanupMaxBackwardDuration) return !0 } } return !1 }, t._doCleanupSourceBuffer = function() { var e = this._mediaElement.currentTime; for (var t in this._sourceBuffers) { var i = this._sourceBuffers[t]; if (i) { for (var r = i.buffered, n = !1, a = 0; a < r.length; a++) { var s = r.start(a), o = r.end(a); if (s <= e && e < o + 3) { if (e - s >= this._config.autoCleanupMaxBackwardDuration) { n = !0; var u = e - this._config.autoCleanupMinBackwardDuration; this._pendingRemoveRanges[t].push({ start: s, end: u }) } } else o < e && (n = !0, this._pendingRemoveRanges[t].push({ start: s, end: o })) } n && !i.updating && this._doRemoveRanges() } } }, t._updateMediaSourceDuration = function() { var e = this._sourceBuffers; if (0 !== this._mediaElement.readyState && "open" === this._mediaSource.readyState && !(e.video && e .video.updating || e.audio && e.audio.updating)) { var t = this._mediaSource.duration, i = this._pendingMediaDuration; i > 0 && (isNaN(t) || i > t) && (c.a.v(this.TAG, "Update MediaSource duration from " + t + " to " + i), this._mediaSource.duration = i), this._requireSetMediaDuration = !1, this ._pendingMediaDuration = 0 } }, t._doRemoveRanges = function() { for (var e in this._pendingRemoveRanges) if (this._sourceBuffers[e] && !this._sourceBuffers[e].updating) for (var t = this._sourceBuffers[e], i = this._pendingRemoveRanges[e]; i.length && !t.updating;) { var r = i.shift(); t.remove(r.start, r.end) } }, t._removerAudioSourceBuffer = function() { this._audioError = !0; var e = this._sourceBuffers.audio; e && (this._mediaSource.removeSourceBuffer(e), e.removeEventListener("error", this.e .onSourceBufferError), e.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd), this ._sourceBuffers.audio = null) }, t._doAppendSegments = function() { var e = this._pendingSegments; for (var t in b.d() && !this._pause && "flv" === this._config.streamType && this.AdjustPlayTimeToEnd(), e) if (this._sourceBuffers[t] && !this._sourceBuffers[t].updating && e[t].length > 0) { var i = e[t].shift(); if (i.timestampOffset) { var r = this._sourceBuffers[t].timestampOffset, n = i.timestampOffset / 1e3; Math.abs(r - n) > .1 && (c.a.v(this.TAG, "Update MPEG audio timestampOffset from " + r + " to " + n), this._sourceBuffers[t].timestampOffset = n), delete i.timestampOffset } if (!i.data || 0 === i.data.byteLength) continue; try { this._sourceBuffers[t].appendBuffer(i.data), this._isBufferFull = !1, "video" === t && i .hasOwnProperty("info") && this._idrList.appendArray(i.info.syncPoints) } catch (e) { if (this._pendingSegments[t].unshift(i), 22 === e.code) this._isBufferFull || this._emitter.emit(w .BUFFER_FULL), this._isBufferFull = !0; else try { this._emitter.emit(w.ERROR, { code: 11, msg: e.message }) } catch (e) {} } } }, t._onSourceOpen = function() { if (c.a.v(this.TAG, "MediaSource onSourceOpen"), this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen), this._pendingSourceBufferInit.length > 0) for (var e = this._pendingSourceBufferInit; e.length;) { var t = e.shift(); this.appendInitSegment(t, !0) } this._hasPendingSegments() && this._doAppendSegments(), this._emitter.emit(w.SOURCE_OPEN) }, t._onSourceEnded = function() { this._emitter.emit(w.SOURCE_ENDED), c.a.v(this.TAG, "MediaSource onSourceEnded") }, t._onSourceClose = function() { c.a.v(this.TAG, "MediaSource onSourceClose"), this._mediaSource && null != this.e && (this._mediaSource .removeEventListener("sourceopen", this.e.onSourceOpen), this._mediaSource.removeEventListener( "sourceended", this.e.onSourceEnded), this._mediaSource.removeEventListener("sourceclose", this.e .onSourceClose)) }, t._hasPendingSegments = function() { var e = this._pendingSegments; return e.video.length > 0 || e.audio.length > 0 }, t._hasPendingRemoveRanges = function() { var e = this._pendingRemoveRanges; return e.video.length > 0 || e.audio.length > 0 }, t._onSourceBufferUpdateEnd = function() { this._requireSetMediaDuration ? this._updateMediaSourceDuration() : this._hasPendingRemoveRanges() ? this._doRemoveRanges() : this._hasPendingSegments() ? this._doAppendSegments() : this ._hasPendingEos && this.endOfStream(), this._emitter.emit(w.UPDATE_END) }, t._onSourceBufferError = function(e) { c.a.e(this.TAG, "SourceBuffer Error: " + e) }, t.pause = function() { this._pause = !0 }, t.resume = function() { this._pause = !1 }, t.AdjustPlayTimeToEnd = function() { if (null != this._emitter && null != this._emitter) { var e = this._mediaElement.currentTime; for (var t in this._sourceBuffers) if ("video" === t) { var i = this._sourceBuffers[t]; if (i && !i.updating) { var r = i.buffered; if (r.length > 0) { var n = r.end(r.length - 1); n - e > 2 ? this._mediaElement.currentTime = n : this._lastSpeed > 0 && (this._lastSpeed = 0, this._emitter.emit(w.CHANGE_SPEED, { speed: 0 })) } } } } }, e }(), D = i(12), I = { NETWORK_ERROR: "NetworkError", MEDIA_ERROR: "MediaError", OTHER_ERROR: "OtherError" }, L = { NETWORK_EXCEPTION: u.b.EXCEPTION, NETWORK_STATUS_CODE_INVALID: u.b.HTTP_STATUS_CODE_INVALID, NETWORK_TIMEOUT: u.b.CONNECTING_TIMEOUT, NETWORK_UNRECOVERABLE_EARLY_EOF: u.b.UNRECOVERABLE_EARLY_EOF, MEDIA_MSE_ERROR: "MediaMSEError", MEDIA_FORMAT_ERROR: D.a.FORMAT_ERROR, MEDIA_FORMAT_UNSUPPORTED: D.a.FORMAT_UNSUPPORTED, MEDIA_CODEC_UNSUPPORTED: D.a.CODEC_UNSUPPORTED }; function x(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var P = function() { function e(e, t) { this.TAG = "FlvPlayer", this._type = "FlvPlayer", this._emitter = new d.a; var i = e.url, r = e.muted, n = e.recordMaxFileSize; i.includes(".flv") && (this._type = "flv"), i.includes(".m3u8") && (this._type = "hls"), this._config = s(), o.supportMSEH264Playback() ? t.decodeType = t.decodeType ? t.decodeType : "auto" : t.decodeType = "soft", "object" == typeof t && (this._config = Object.assign(this._config, t)), !0 === e.isLive && ( this._config.isLive = !0), this.e = { onvLoadedMetadata: this._onvLoadedMetadata.bind(this), onvSeeking: this._onvSeeking.bind(this), onvCanPlay: this._onvCanPlay.bind(this), onvStalled: this._onvStalled.bind(this), onvProgress: this._onvProgress.bind(this) }, self.performance && self.performance.now ? this._now = self.performance.now.bind(self .performance) : this._now = Date.now, this._pendingSeekTime = null, this._requestSetTime = !1, this ._seekpointRecord = null, this._progressChecker = null, this._mediaDataSource = Object.assign(e, { type: this.type }), this._mediaElement = null, this._msectl = null, this._transmuxer = null, this._mseSourceOpened = ! 1, this._hasPendingLoad = !1, this._receivedCanPlay = !1, this._mediaInfo = null, this ._statisticsInfo = null; var a = h.a.chrome && (h.a.version.major < 50 || 50 === h.a.version.major && h.a.version.build < 2661); this._alwaysSeekKeyframe = !!(a || h.a.msedge || h.a.msie), this._alwaysSeekKeyframe && (this._config .accurateSeek = !1), this.videoToolsTimer = null, this.playing = !0, this.mute = !0, this.kbpsEle = null, this.audioBtnEle = null, this.playBtnEle = null, this.luXiangEle = null, this.timeTrackEle = null, this.isFullScreen = !1, this.progressBarEle = null, this.progressBarLabelEle = null, this ._webRecording = { enable: 0 }, this._recording = !1, this._fullScreenBtnEle = null, this._muted = r, this._recordHlsOffset = 0, this._recordMaxFileSize = n ? 1024 * n * 1024 : 209715200, this._recordHlsArrayBuffer = [], this ._isEncodedH265 = !o.supportMSEH264Playback(), this._mobile = this._isMobile(), this.isiOS = !! navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), this.switchPlay = this._switchPlay, this .switchAudio = this._switchAudio, this.recordSwitch = this._recordSwitch, this.saveLocalSnapshot = this._saveLocalSnapshot } var t, i, r = e.prototype; return r.destroy = function() { null != this._progressChecker && (window.clearInterval(this._progressChecker), this._progressChecker = null), this._transmuxer && this.unload(), this._mediaElement && this.detachMediaElement(), this .e = null, this._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null, this.videoToolsTimer && clearTimeout(this.videoToolsTimer), this.kbpsEle = null, this.timeTrackEle = null, this.audioBtnEle = null, this.playBtnEle = null, this.progressBarEle = null, this .videoToolsTimer = null, this.progressBarLabelEle = null, this._fullScreenBtnEle = null; var e = document.getElementsByClassName("video-tools")[0]; e && e.parentNode && e.parentNode.removeChild(e), this._recordHlsOffset = 0, this ._recordHlsArrayBuffer = [], this._isEncodedH265 = !1, this.switchAudio = null, this .saveLocalSnapshot = null, this.recordSwitch = null }, r.on = function(e, t) { var i = this; e === f.MEDIA_INFO ? null != this._mediaInfo && Promise.resolve().then(function() { i._emitter.emit(f.MEDIA_INFO, i.mediaInfo) }) : e === f.STATISTICS_INFO && null != this._statisticsInfo && Promise.resolve().then(function() { i._emitter.emit(f.STATISTICS_INFO, i.statisticsInfo) }), this._emitter.addListener(e, t) }, r.off = function(e, t) { this._emitter.removeListener(e, t) }, r.attachMediaElement = function(e) { var t = this; if (this._mediaElement = e, o.supportMSEH264Playback()) { if (e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), e.addEventListener("seeking", this.e.onvSeeking), e.addEventListener("canplay", this.e.onvCanPlay), e.addEventListener( "stalled", this.e.onvStalled), e.addEventListener("progress", this.e.onvProgress), this ._msectl = new C(this._config), this._msectl.on(w.UPDATE_PLAY_INFO, this._onmseUpdatePlayInfo .bind(this)), this._msectl.on(w.UPDATE_END, this._onmseUpdateEnd.bind(this)), this._msectl.on(w .BUFFER_FULL, this._onmseBufferFull.bind(this)), this._msectl.on(w.SOURCE_ENDED, function() { 1 === t._webRecording.enable && (t._webRecording.enable = 0, t.startWebVideoRecord(0), setTimeout(function() { return t._emitter.emit(w.SOURCE_ENDED) }, 1e3)) }), this._msectl.on(w.SOURCE_OPEN, function() { t._mseSourceOpened = !0, t._hasPendingLoad && (t._hasPendingLoad = !1, t.load()) }), this._msectl.on(w.ERROR, function(e) { t._emitter.emit(f.ERROR, I.MEDIA_ERROR, L.MEDIA_MSE_ERROR, e) }), this._msectl.attachMediaElement(e), null != this._pendingSeekTime) try { e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null } catch (e) {} this._mediaElement.muted = this._muted } else console.log("ios 设备") }, r.detachMediaElement = function() { this._mediaElement && (this._msectl.detachMediaElement(), this._mediaElement.removeEventListener( "loadedmetadata", this.e.onvLoadedMetadata), this._mediaElement.removeEventListener("seeking", this.e.onvSeeking), this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay), this ._mediaElement.removeEventListener("stalled", this.e.onvStalled), this._mediaElement .removeEventListener("progress", this.e.onvProgress), this._mediaElement = null), this._msectl && (this._msectl.destroy(), this._msectl = null) }, r.load = function() { var e = this; if (o.supportMSEH264Playback()) { if (!this._mediaElement) throw new O.a("HTMLMediaElement must be attached before load()!"); if (this._transmuxer) throw new O.a( "FlvPlayer.load() has been called, please call unload() first!"); if (this._hasPendingLoad) return; if (this._config.deferLoadAfterSourceOpen && !1 === this._mseSourceOpened) return void(this ._hasPendingLoad = !0); this._mediaElement.readyState > 0 && (this._requestSetTime = !0, this._mediaElement.currentTime = 0) } this._transmuxer = new R(this._mediaDataSource, this._config, this._mediaElement), this._transmuxer .on(y.a.INIT_SEGMENT, function(t, i) { e._msectl.appendInitSegment(i) }), this._transmuxer.on(y.a.ON_DBL_CLICK, function() { return e._requestFullScreen() }), this._transmuxer.on(y.a.MEDIA_SEGMENT, function(t, i) { if (e._msectl.appendMediaSegment(i), e._config.lazyLoad && !e._config.isLive) { var r = e._mediaElement.currentTime; i.info.endDts >= 1e3 * (r + e._config.lazyLoadMaxDuration) && null == e._progressChecker && (c .a.v(e.TAG, "Maximum buffering duration exceeded, suspend transmuxing task"), e ._suspendTransmuxer()) } }), this._transmuxer.on(y.a.IS_ENCODED_H265, function(t) { e._isEncodedH265 = t, setTimeout(function() { return e._emitter.emit(y.a.IS_ENCODED_H265) }, 1500), e._render265VideoTools() }), this._transmuxer.on(y.a.LOADING_COMPLETE, function() { e._msectl.endOfStream(), e._emitter.emit(f.LOADING_COMPLETE) }), this._transmuxer.on(y.a.RECOVERED_EARLY_EOF, function() { e._emitter.emit(f.RECOVERED_EARLY_EOF) }), this._transmuxer.on(y.a.IO_ERROR, function(t, i) { e._emitter.emit(f.ERROR, I.NETWORK_ERROR, t, i) }), this._transmuxer.on(y.a.DEMUX_ERROR, function(t, i) { e._emitter.emit(f.ERROR, I.MEDIA_ERROR, t, { code: -1, msg: i }) }), this._transmuxer.on(y.a.MEDIA_INFO, function(t) { e._mediaInfo = t, e._emitter.emit(f.MEDIA_INFO, Object.assign({}, t)) }), this._transmuxer.on(y.a.METADATA_ARRIVED, function(t) { e._emitter.emit(f.METADATA_ARRIVED, t) }), this._transmuxer.on(y.a.SCRIPTDATA_ARRIVED, function(t) { e._emitter.emit(f.SCRIPTDATA_ARRIVED, t) }), this._transmuxer.on(y.a.STATISTICS_INFO, function(t) { e._statisticsInfo = e._fillStatisticsInfo(t), e._emitter.emit(f.STATISTICS_INFO, Object .assign({}, e._statisticsInfo)) }), this._transmuxer.on(y.a.RECOMMEND_SEEKPOINT, function(t) { e._mediaElement && !e._config.accurateSeek && (e._requestSetTime = !0, e._mediaElement .currentTime = t / 1e3) }), this._transmuxer.on(w.SOURCE_ENDED, function() { return e._emitter.emit(w.SOURCE_ENDED) }), this._transmuxer.on(w.UPDATE_PLAY_INFO, this._onmseUpdatePlayInfo.bind(this)), this._transmuxer .on(y.a.AUDIO_ERROR, this._onAudioError.bind(this)), this._transmuxer.on("loaderChunkArrival", function(t) { if (null !== t) { var i = e._mediaDataSource.url; if (i && i.includes(".m3u8")) if (e._recording) { if (0 === e._recordHlsArrayBuffer.length && (e._recordHlsArrayBuffer = new Uint8Array(e ._recordMaxFileSize)), e._recordHlsOffset + t.byteLength > e._recordMaxFileSize) return e.downRecord(), e._recording = !1, void(e.luXiangEle.style.color = e._recording ? "red" : "white"); e._recordHlsArrayBuffer.set(new Int8Array(t), e._recordHlsOffset), e._recordHlsOffset += t .byteLength } else { if (0 === e._recordHlsArrayBuffer.length || 0 === e._recordHlsArrayBuffer.byteLength){ e._emitter.emit('recordEnd', false); }else { if(this.stopRecoeding) { this._recordHlsOffset = 0, this._recordHlsArrayBuffer = [] return false; } e._emitter.emit('recordEnd', true); e.downRecord() } } } }), this._transmuxer.on("hls_error", function() { 1 === e._webRecording.enable && (e._webRecording.enable = 0, e.downRecord()), setTimeout( function() { return e._emitter.emit(y.a.SOURCE_ENDED) }, 1500) }), this._transmuxer.open() }, r.downRecord = function() { var e = this.dateFormat(new Date, "YYYYMMDDhhmmss"), t = this._recordHlsArrayBuffer.slice(0, this._recordHlsOffset), i = document.createElement("a"), n = this.playerName + '-' + e; var b = new Blob([t], { type: "video/mp4" }) if(!window.isVideoWatermark) { i.style.display = "none", i.href = window.URL.createObjectURL(new Blob([b], { type: 'video/mp4' })), i.download = n, document.body.appendChild(i), i.click(), window.URL.revokeObjectURL(i .href), document.body.removeChild(i), this._recordHlsOffset = 0, this._recordHlsArrayBuffer = [] return false; } const file = new File([b], n, { type: b.type }) console.log('=============视频加水印============3==', file) this._recordHlsOffset = 0, this._recordHlsArrayBuffer = [] const formData = new FormData() formData.append('file', file) fetch('/apiserver/export/alarm/order/downloadVideoByFlush', { method: 'POST', headers: { 'Authorization': 'Bearer ' + (window.$videoStoreData?.userInfo?.token || sessionStorage.getItem('Admin-Token')), 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || '' }, body: formData }).then(response => response.blob()).then(blob => { console.log('=============视频加水印============3=返回=', blob) i.style.display = "none", i.href = window.URL.createObjectURL(new Blob([blob], { type: 'video/mp4' })), i.download = n, document.body.appendChild(i), i.click(), window.URL.revokeObjectURL(i .href), document.body.removeChild(i) }) }, r.dateFormat = function(e, t) { var i, r = { "Y+": e.getFullYear().toString(), "M+": (e.getMonth() + 1).toString(), "D+": e.getDate().toString(), "h+": e.getHours().toString(), "m+": e.getMinutes().toString(), "s+": e.getSeconds().toString() }; for (var n in r)(i = new RegExp("(" + n + ")").exec(t)) && (t = t.replace(i[1], 1 === i[1].length ? r[ n] : r[n].padStart(i[1].length, "0"))); return t }, r.unload = function() { this._mediaElement && this._mediaElement.pause(), this._msectl && this._msectl.seek(0), this ._transmuxer && (this._transmuxer.close(), this._transmuxer.destroy(), this._transmuxer = null) }, r.play = function() { return this._mediaElement.play() }, r.resume = function() { this._mediaElement && this._mediaElement.play(), this._isEncodedH265 && this._transmuxer && this ._transmuxer.resume() }, r.pause = function() { var e = this._mediaElement; e.offsetWidth, e.offsetHeight, this._mediaElement && this._mediaElement.pause(), this ._isEncodedH265 && this._transmuxer && this._transmuxer.pause() }, r._fillStatisticsInfo = function(e) { if (e.playerType = this._type, !(this._mediaElement instanceof HTMLVideoElement)) return e; var t = !0, i = 0, r = 0; if (this._mediaElement.getVideoPlaybackQuality) { var n = this._mediaElement.getVideoPlaybackQuality(); i = n.totalVideoFrames, r = n.droppedVideoFrames } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement .webkitDecodedFrameCount, r = this._mediaElement.webkitDroppedFrameCount) : t = !1; return t && (e.decodedFrames = i, e.droppedFrames = r), e }, r._onmseUpdateEnd = function() { if (this._config.lazyLoad && !this._config.isLive) { for (var e = this._mediaElement.buffered, t = this._mediaElement.currentTime, i = 0, r = 0; r < e .length; r++) { var n = e.start(r), a = e.end(r); if (n <= t && t < a) { i = a; break } } i >= t + this._config.lazyLoadMaxDuration && null == this._progressChecker && (c.a.v(this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task"), this._suspendTransmuxer()) } }, r._onmseUpdatePlayInfo = function() { if (this._transmuxer) { var e = 0, t = 0; this._isEncodedH265 && this._mediaDataSource.url.includes(".m3u8") && ((e = this._transmuxer ._getCurrentPlayTime()) < 0 && (e = 0), t = this._transmuxer._getTotalDuration(), this ._updateDuration({ currentTime: e, duration: t })); var i = this._transmuxer._controller._ioctl.currentSpeed, r = this._transmuxer._controller._ioctl.averageKBps; this._updateKbps({ currentSpeed: i, averageKBps: r }) } }, r._onmseBufferFull = function() { c.a.v(this.TAG, "MSE SourceBuffer is full, suspend transmuxing task"), null == this ._progressChecker && this._suspendTransmuxer() }, r._suspendTransmuxer = function() { this._transmuxer && (this._transmuxer.pause(), null == this._progressChecker && (this ._progressChecker = window.setInterval(this._checkProgressAndResume.bind(this), 1e3))) }, r._checkProgressAndResume = function() { for (var e = this._mediaElement.currentTime, t = this._mediaElement.buffered, i = !1, r = 0; r < t .length; r++) { var n = t.start(r), a = t.end(r); if (e >= n && e < a) { e >= a - this._config.lazyLoadRecoverDuration && (i = !0); break } } i && (window.clearInterval(this._progressChecker), this._progressChecker = null, i && (c.a.v(this.TAG, "Continue loading from paused position"), this._transmuxer.resume())) }, r._isTimepointBuffered = function(e) { for (var t = this._mediaElement.buffered, i = 0; i < t.length; i++) { var r = t.start(i), n = t.end(i); if (e >= r && e < n) return !0 } return !1 }, r._internalSeek = function(e) { var t = this._isTimepointBuffered(e), i = !1, r = 0; if (e < 1 && this._mediaElement.buffered.length > 0) { var n = this._mediaElement.buffered.start(0); (n < 1 && e < n || h.a.safari) && (i = !0, r = h.a.safari ? .1 : n) } if (i) this._requestSetTime = !0, this._mediaElement.currentTime = r; else if (t) { if (this._alwaysSeekKeyframe) { var a = this._msectl.getNearestKeyframe(Math.floor(1e3 * e)); this._requestSetTime = !0, this._mediaElement.currentTime = null != a ? a.dts / 1e3 : e } else this._requestSetTime = !0, this._mediaElement.currentTime = e; null != this._progressChecker && this._checkProgressAndResume() } else null != this._progressChecker && (window.clearInterval(this._progressChecker), this ._progressChecker = null), this._msectl.seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this ._config.accurateSeek && (this._requestSetTime = !0, this._mediaElement.currentTime = e) }, r._checkAndApplyUnbufferedSeekpoint = function() { if (this._seekpointRecord) if (this._seekpointRecord.recordTime <= this._now() - 100) { var e = this._mediaElement.currentTime; this._seekpointRecord = null, this._isTimepointBuffered(e) || (null != this._progressChecker && ( window.clearTimeout(this._progressChecker), this._progressChecker = null), this._msectl .seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this._config.accurateSeek && (this ._requestSetTime = !0, this._mediaElement.currentTime = e)) } else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50) }, r._checkAndResumeStuckPlayback = function(e) { var t = this._mediaElement; if (e || !this._receivedCanPlay || t.readyState < 2) { var i = t.buffered; i.length > 0 && t.currentTime < i.start(0) && (c.a.w(this.TAG, "Playback seems stuck at " + t .currentTime + ", seek to " + i.start(0)), this._requestSetTime = !0, this._mediaElement .currentTime = i.start(0), this._mediaElement.removeEventListener("progress", this.e .onvProgress)) } else this._mediaElement.removeEventListener("progress", this.e.onvProgress) }, r._onvLoadedMetadata = function(e) { null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this ._pendingSeekTime = null) }, r._onvSeeking = function(e) { var t = this._mediaElement.currentTime, i = this._mediaElement.buffered; if (this._requestSetTime) this._requestSetTime = !1; else { if (t < 1 && i.length > 0) { var r = i.start(0); if (r < 1 && t < r || h.a.safari) return this._requestSetTime = !0, void(this._mediaElement .currentTime = h.a.safari ? .1 : r) } if (this._isTimepointBuffered(t)) { if (this._alwaysSeekKeyframe) { var n = this._msectl.getNearestKeyframe(Math.floor(1e3 * t)); null != n && (this._requestSetTime = !0, this._mediaElement.currentTime = n.dts / 1e3) } null != this._progressChecker && this._checkProgressAndResume() } else this._seekpointRecord = { seekPoint: t, recordTime: this._now() }, window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50) } }, r._onvCanPlay = function(e) { this._receivedCanPlay = !0, this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay) }, r._onvStalled = function(e) { this._checkAndResumeStuckPlayback(!0) }, r._onvProgress = function(e) { this._checkAndResumeStuckPlayback() }, r.seek = function(e, t) { if (this._isEncodedH265 && this._transmuxer && this._mediaDataSource.url.includes(".m3u8")) { var i = Math.floor(e / 100 * this._transmuxer._getTotalDuration()); if (this._msectl && this._msectl.getCurrentPlayTime() === i) return !0; this._transmuxer._seekToSecs(e, t) } }, r._render265VideoTools = function() { var e = this, t = document.createElement("span"); t.style = "width:100%;height:30px;position:absolute;bottom:0;left:0;background-color:rgba(43, 51, 63, 0.7);;z-index: 10;opacity:0;display: flex;flex-direction: row;justify-content: space-between;", t.classList = "video-tools", this.videoTools = t; var i = document.createElement("div"); i.style = "display: flex;flex-direction: row;", this.playBtnEle = document.createElement("span"), this .playBtnEle.style = "font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center", this.playBtnEle.classList = "iconfontep " + (this.playing ? "icon-zanting" : "icon-bofang"), this .audioBtnEle = document.createElement("span"), this.audioBtnEle.style = "font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center", this.audioBtnEle.classList = "iconfontep " + (this._muted ? "icon-jingyin" : "icon-shengyin1") + " icon-wasm-audio", this._mediaDataSource.url.includes(".m3u8") && (this.progressBarEle = document .createElement("div"), this.progressBarEle.style = "display:flex;flex:1;opacity: 0", this .timeTrackEle = document.createElement("input"), this.timeTrackEle.classList = "timeTrack", this .timeTrackEle.id = "timeTrack", this.timeTrackEle.type = "range", this.timeTrackEle.style = "width:100%;-webkit-appearance: none;height:3px;border-radius:3px;cursor:pointer;margin:auto;display:block;color: #FFF", this.timeTrackEle.value = 0, this.timeTrackEle.oninput = function() { e.seekToPercent(e.timeTrackEle.value, 1) }, this.progressBarEle.appendChild(this.timeTrackEle), this.progressBarLabelEle = document .createElement("label"), this.progressBarLabelEle.style = "color: #fff;padding-left: 10px;line-height:30px;font-size: 12px;min-width: 115px", this .progressBarLabelEle.innerHTML = "00:00:00/00:00:00", this.progressBarEle.appendChild(this .progressBarLabelEle)), this.playBtnEle.onclick = function(ee) { return e._switchPlay(ee) }, this.audioBtnEle.onclick = function() { return e._switchAudio() }; var r = document.createElement("div"); r.style = "display: flex;flex-direction: row;", this.kbpsEle = document.createElement("div"), this .kbpsEle.style = "font-size:12px;min-width:60px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;padding-right: 10px;", this.luXiangEle = document.createElement("span"), this.luXiangEle.title = "录像", this.luXiangEle .style = "font-size:16px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;", this.luXiangEle.classList = "iconfontep icon-luxiang2", this.luXiangEle.onclick = function() { return e._recordSwitch() }; var n = document.createElement("span"); n.title = "快照", n.style = "font-size:16px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;", n.classList = "iconfontep icon-xiangji", n.onclick = function() { return e._saveLocalSnapshot() }, this._fullScreenBtnEle = document.createElement("span"), this._fullScreenBtnEle.title = "全屏", this._fullScreenBtnEle.style = "font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center", this._fullScreenBtnEle.classList = "iconfontep " + (this.isFullScreen ? "icon-xiaoping" : "icon-quanping1"), this._fullScreenBtnEle.onclick = function() { return e._requestFullScreen() }, this._mediaElement.parentNode.onmousemove = function() { e.videoToolsTimer && clearTimeout(e.videoToolsTimer), e.videoTools.style.opacity = "1", e .videoToolsTimer = setTimeout(function() { e.videoTools.style.opacity = "0" }, 1e4) }, this._mediaElement.parentNode.onmouseout = function() { e.videoTools.style.opacity = "0", e.videoToolsTimer && clearTimeout(e.videoToolsTimer), e .videoToolsTimer = null }, i.appendChild(this.playBtnEle), i.appendChild(this.audioBtnEle), r.appendChild(this.kbpsEle), this.isiOS || (r.appendChild(this.luXiangEle), r.appendChild(n)), r.appendChild(this ._fullScreenBtnEle), t.appendChild(i), this.progressBarEle && !this._mobile && t.appendChild(this .progressBarEle), t.appendChild(r), this._mediaElement.parentNode.appendChild(t), window .onresize = function() { !document.fullscreenElement && e.isFullScreen && (e.isFullScreen = !1, e._fullScreenBtnEle .classList = "iconfontep " + (e.isFullScreen ? "icon-xiaoping" : "icon-quanping1")) } }, r._recordingUIChange = function() { this._recording = !this._recording, this.luXiangEle.title = this._recording ? "关闭录像" : "录像", this .luXiangEle.style.color = this._recording ? "red" : "white" }, r._requestFullScreen = function() { this.isFullScreen = !this.isFullScreen, this._fullScreenBtnEle.title = this.isFullScreen ? "退出全屏" : "全屏", this._fullScreenBtnEle.classList = "iconfontep " + (this.isFullScreen ? "icon-xiaoping" : "icon-quanping1"), this._emitter.emit("changeFullScreen", this.isFullScreen) }, r._updateDuration = function(e) { var t = e.currentTime, i = e.duration; if (!i) return this.progressBarEle.style.opacity = 0; "0" === this.progressBarEle.style.opacity && (this.progressBarEle.style.opacity = 1); var r = parseInt((t + 1) / i * 100); r !== parseInt(this.timeTrackEle.value) && (this.timeTrackEle.value = r), this.progressBarLabelEle && (t < 1 ? t = 0 : t > i && (t = i), this.progressBarLabelEle.innerHTML = this._formatTime(t) + " / " + this._formatTime(i)), this._emitter.emit("timeupdate", t) }, r._updateKbps = function(e) { e.currentSpeed; var t = e.averageKBps; this.kbpsEle && (this.kbpsEle.innerText = 8 * t >= 1024 ? (8 * t / 1024).toFixed(2) + " Mb/s" : parseInt(8 * t + "") + " Kb/s") }, r._saveLocalSnapshot = function(fn, name) { this._transmuxer.saveLocalSnapshot(fn, name) }, r._formatTime = function(e) { return (Math.floor(e / 3600) < 10 ? "0" + Math.floor(e / 3600) : Math.floor(e / 3600)) + ":" + (Math .floor(e / 60 % 60) < 10 ? "0" + Math.floor(e / 60 % 60) : Math.floor(e / 60 % 60)) + ":" + (Math .floor(e % 60) < 10 ? "0" + Math.floor(e % 60) : Math.floor(e % 60)) }, r._onAudioError = function() { this._msectl && this._msectl._removerAudioSourceBuffer() }, r.getClass = function(e) { return 0 === e ? "blue" : 1 === e ? "black" : 2 === e ? "white" : 3 === e ? "green" : 4 === e ? "red" : 5 === e ? "yellow" : "red" }, r.seekToPercent = function(e) { this.seek(e, 1) }, r.startWebVideoRecord = function(e, t, i, r, stop) { if(this._transmuxer) { if(this._mediaDataSource.url.includes(".flv")) { r = (e) => { console.log('============recordEndCB===========', e) clearTimeout(this.recordError); if(e === 0) { this._emitter.emit('recordEnd', true); } }; this.recordError = setTimeout(() => { console.log('============recordError===========') this._emitter.emit('recordEnd', false); }, 500); this._transmuxer.videoRecording(t, i || this._recordMaxFileSize, e, r, stop); } this._webRecording.enable = e; return; } if(this._mediaDataSource.url.includes(".flv")) { this._emitter.emit('recordEnd', false); } }, r._isMobile = function() { try { return document.createEvent("TouchEvent"), !0 } catch (e) { return !1 } }, r._recordSwitch = function(playerName, stop) { this.playerName = playerName; this.stopRecoeding = stop; var e = this; this._recordingUIChange(), this.startWebVideoRecord(this._recording ? 1 : 0, playerName + '-' + this.dateFormat(new Date, "YYYYMMDDhhmmss"), "", function() { e._emitter.emit(w.RECORDING_END) }, stop) }, r._switchAudio = function() { this._muted = !this._muted, this.audioBtnEle.title = this._muted ? "取消静音" : "静音", this.audioBtnEle .classList = "iconfontep " + (this._muted ? "icon-jingyin" : "icon-shengyin1") + " ", this ._mediaElement.muted = this._muted, this._transmuxer && (this._transmuxer._wasmInitAudioPlayer ? this._muted ? this._transmuxer._wasmAudioPlayer.pause() : this._transmuxer._wasmAudioPlayer .resume() : this._muted || this._transmuxer._openWasmAudio()) }, r._switchPlay = function(ee) { ee.stopPropagation(); this.playing ? this.pause() : this.resume(), this.playing = !this.playing, this.playBtnEle.title = this.playing ? "暂停" : "播放", this.playBtnEle.classList = "iconfontep " + (this.playing ? "icon-zanting" : "icon-bofang") }, t = e, (i = [{ key: "type", get: function() { return this._type } }, { key: "buffered", get: function() { return this._mediaElement.buffered } }, { key: "duration", get: function() { return this._mediaElement.duration } }, { key: "volume", get: function() { return this._mediaElement.volume }, set: function(e) { this._mediaElement.volume = e } }, { key: "muted", get: function() { return this._mediaElement.muted }, set: function(e) { this._mediaElement.muted = e } }, { key: "currentTime", get: function() { return this._mediaElement ? this._mediaElement.currentTime : 0 }, set: function(e) { this._mediaElement ? this._internalSeek(e) : this._pendingSeekTime = e } }, { key: "mediaInfo", get: function() { return Object.assign({}, this._mediaInfo) } }, { key: "statisticsInfo", get: function() { return null == this._statisticsInfo && (this._statisticsInfo = {}), this._statisticsInfo = this._fillStatisticsInfo(this._statisticsInfo), Object.assign({}, this._statisticsInfo) } }]) && x(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); function U(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var N = function() { function e(e, t) { if (this.TAG = "NativePlayer", this._type = "NativePlayer", this._emitter = new d.a, this._config = s(), "object" == typeof t && Object.assign(this._config, t), "flv" === e.type.toLowerCase()) throw new O.b( "NativePlayer does't support flv MediaDataSource input!"); if (e.hasOwnProperty("segments")) throw new O.b("NativePlayer(" + e.type + ") doesn't support multipart playback!"); this.e = { onvLoadedMetadata: this._onvLoadedMetadata.bind(this) }, this._pendingSeekTime = null, this._statisticsReporter = null, this._mediaDataSource = e, this ._mediaElement = null } var t, i, r = e.prototype; return r.destroy = function() { this._mediaElement && (this.unload(), this.detachMediaElement()), this.e = null, this ._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null }, r.on = function(e, t) { var i = this; e === f.MEDIA_INFO ? null != this._mediaElement && 0 !== this._mediaElement.readyState && Promise .resolve().then(function() { i._emitter.emit(f.MEDIA_INFO, i.mediaInfo) }) : e === f.STATISTICS_INFO && null != this._mediaElement && 0 !== this._mediaElement.readyState && Promise.resolve().then(function() { i._emitter.emit(f.STATISTICS_INFO, i.statisticsInfo) }), this._emitter.addListener(e, t) }, r.off = function(e, t) { this._emitter.removeListener(e, t) }, r.attachMediaElement = function(e) { if (this._mediaElement = e, e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), null != this._pendingSeekTime) try { e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null } catch (e) {} }, r.detachMediaElement = function() { this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this ._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata), this ._mediaElement = null), null != this._statisticsReporter && (window.clearInterval(this ._statisticsReporter), this._statisticsReporter = null) }, r.load = function() { if (!this._mediaElement) throw new O.a("HTMLMediaElement must be attached before load()!"); this._mediaElement.src = this._mediaDataSource.url, this._mediaElement.readyState > 0 && (this ._mediaElement.currentTime = 0), this._mediaElement.preload = "auto", this._mediaElement.load(), this._statisticsReporter = window.setInterval(this._reportStatisticsInfo.bind(this), this._config .statisticsInfoReportInterval) }, r.unload = function() { this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src")), null != this._statisticsReporter && (window.clearInterval(this._statisticsReporter), this ._statisticsReporter = null) }, r.play = function() { return this._mediaElement.play() }, r.pause = function() { this._mediaElement.pause() }, r._onvLoadedMetadata = function(e) { null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this ._pendingSeekTime = null), this._emitter.emit(f.MEDIA_INFO, this.mediaInfo) }, r._reportStatisticsInfo = function() { this._emitter.emit(f.STATISTICS_INFO, this.statisticsInfo) }, t = e, (i = [{ key: "type", get: function() { return this._type } }, { key: "buffered", get: function() { return this._mediaElement.buffered } }, { key: "duration", get: function() { return this._mediaElement.duration } }, { key: "volume", get: function() { return this._mediaElement.volume }, set: function(e) { this._mediaElement.volume = e } }, { key: "muted", get: function() { return this._mediaElement.muted }, set: function(e) { this._mediaElement.muted = e } }, { key: "currentTime", get: function() { return this._mediaElement ? this._mediaElement.currentTime : 0 }, set: function(e) { this._mediaElement ? this._mediaElement.currentTime = e : this._pendingSeekTime = e } }, { key: "mediaInfo", get: function() { var e = { mimeType: (this._mediaElement instanceof HTMLAudioElement ? "audio/" : "video/") + this ._mediaDataSource.type }; return this._mediaElement && (e.duration = Math.floor(1e3 * this._mediaElement.duration), this ._mediaElement instanceof HTMLVideoElement && (e.width = this._mediaElement.videoWidth, e .height = this._mediaElement.videoHeight)), e } }, { key: "statisticsInfo", get: function() { var e = { playerType: this._type, url: this._mediaDataSource.url }; if (!(this._mediaElement instanceof HTMLVideoElement)) return e; var t = !0, i = 0, r = 0; if (this._mediaElement.getVideoPlaybackQuality) { var n = this._mediaElement.getVideoPlaybackQuality(); i = n.totalVideoFrames, r = n.droppedVideoFrames } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement .webkitDecodedFrameCount, r = this._mediaElement.webkitDroppedFrameCount) : t = !1; return t && (e.decodedFrames = i, e.droppedFrames = r), e } }]) && U(t.prototype, i), Object.defineProperty(t, "prototype", { writable: !1 }), e }();r.a.install(); var B = { createPlayer: function(e, t) { var i = e; if (null == i || "object" != typeof i) throw new O.b("MediaDataSource must be an javascript object!"); return new P(i, t) }, isSupported: function() { return o.supportMSEH264Playback() }, getFeatureList: function() { return o.getFeatureList() } };B.BaseLoader = u.a, B.LoaderStatus = u.c, B.LoaderErrors = u.b, B.Events = f, B.ErrorTypes = I, B .ErrorDetails = L, B.FlvPlayer = P, B.NativePlayer = N, B.LoggingControl = g.a, Object.defineProperty(B, "version", { enumerable: !0, get: function() { return __VERSION__ } }); var F = B;t.default = F }, function(e, t, i) { "use strict"; i.r(t); var r = i(30), n = i.n(r), a = i(123), s = i.n(a); function o(e, t) { return (o = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } var u = function(e) { var t, i; function r() { var t; return (t = e.call(this) || this).buffer = "", t } return i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, o(t, i), r .prototype.push = function(e) { var t; for (this.buffer += e, t = this.buffer.indexOf("\n"); t > -1; t = this.buffer.indexOf("\n")) this .trigger("data", this.buffer.substring(0, t)), this.buffer = this.buffer.substring(t + 1) }, r }(n.a); function l(e, t) { return (l = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } var d = function(e) { for (var t, i = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), r = {}, n = i.length; n--;) "" !== i[n] && ((t = /([^=]*)=(.*)/.exec(i[n]).slice(1))[0] = t[0].replace(/^\s+|\s+$/g, ""), t[1] = t[ 1].replace(/^\s+|\s+$/g, ""), t[1] = t[1].replace(/^['"](.*)['"]$/g, "$1"), r[t[0]] = t[1]); return r }, c = function(e) { var t, i; function r() { var t; return (t = e.call(this) || this).customParsers = [], t.tagMappers = [], t } i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, l(t, i); var n = r.prototype; return n.push = function(e) { var t, i, r = this; 0 !== (e = e.trim()).length && ("#" === e[0] ? this.tagMappers.reduce(function(t, i) { var r = i(e); return r === e ? t : t.concat([r]) }, [e]).forEach(function(e) { for (var n = 0; n < r.customParsers.length; n++) if (r.customParsers[n].call(r, e)) return; if (0 === e.indexOf("#EXT")) if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e)) r.trigger("data", { type: "tag", tagType: "m3u" }); else { if (t = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "inf" }, t[1] && (i.duration = parseFloat(t[1])), t[2] && (i.title = t[2]), void r.trigger( "data", i); if (t = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "targetduration" }, t[1] && (i.duration = parseInt(t[1], 10)), void r.trigger("data", i); if (t = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "totalduration" }, t[1] && (i.duration = parseInt(t[1], 10)), void r.trigger("data", i); if (t = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "version" }, t[1] && (i.version = parseInt(t[1], 10)), void r.trigger("data", i); if (t = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "media-sequence" }, t[1] && (i.number = parseInt(t[1], 10)), void r.trigger("data", i); if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "discontinuity-sequence" }, t[1] && (i.number = parseInt(t[1], 10)), void r.trigger("data", i); if (t = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "playlist-type" }, t[1] && (i.playlistType = t[1]), void r.trigger("data", i); if (t = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "byterange" }, t[1] && (i.length = parseInt(t[1], 10)), t[2] && (i.offset = parseInt(t[2], 10)), void r.trigger("data", i); if (t = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return i = { type: "tag", tagType: "allow-cache" }, t[1] && (i.allowed = !/NO/.test(t[1])), void r.trigger("data", i); if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) { if (i = { type: "tag", tagType: "map" }, t[1]) { var a = d(t[1]); if (a.URI && (i.uri = a.URI), a.BYTERANGE) { var s = a.BYTERANGE.split("@"), o = s[0], u = s[1]; i.byterange = {}, o && (i.byterange.length = parseInt(o, 10)), u && (i.byterange .offset = parseInt(u, 10)) } } r.trigger("data", i) } else if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) { if (i = { type: "tag", tagType: "stream-inf" }, t[1]) { if (i.attributes = d(t[1]), i.attributes.RESOLUTION) { var l = i.attributes.RESOLUTION.split("x"), c = {}; l[0] && (c.width = parseInt(l[0], 10)), l[1] && (c.height = parseInt(l[1], 10)), i .attributes.RESOLUTION = c } i.attributes.BANDWIDTH && (i.attributes.BANDWIDTH = parseInt(i.attributes.BANDWIDTH, 10)), i.attributes["PROGRAM-ID"] && (i.attributes["PROGRAM-ID"] = parseInt(i .attributes["PROGRAM-ID"], 10)) } r.trigger("data", i) } else { if (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "media" }, t[1] && (i.attributes = d(t[1])), void r.trigger("data", i); if (t = /^#EXT-X-ENDLIST/.exec(e)) r.trigger("data", { type: "tag", tagType: "endlist" }); else if (t = /^#EXT-X-DISCONTINUITY/.exec(e)) r.trigger("data", { type: "tag", tagType: "discontinuity" }); else { if (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "program-date-time" }, t[1] && (i.dateTimeString = t[1], i.dateTimeObject = new Date(t[1])), void r .trigger("data", i); if (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "key" }, t[1] && (i.attributes = d(t[1]), i.attributes.IV && ("0x" === i.attributes.IV .substring(0, 2).toLowerCase() && (i.attributes.IV = i.attributes.IV .substring(2)), i.attributes.IV = i.attributes.IV.match(/.{8}/g), i .attributes.IV[0] = parseInt(i.attributes.IV[0], 16), i.attributes.IV[1] = parseInt(i.attributes.IV[1], 16), i.attributes.IV[2] = parseInt(i.attributes .IV[2], 16), i.attributes.IV[3] = parseInt(i.attributes.IV[3], 16), i .attributes.IV = new Uint32Array(i.attributes.IV))), void r.trigger("data", i); if (t = /^#EXT-X-START:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "start" }, t[1] && (i.attributes = d(t[1]), i.attributes["TIME-OFFSET"] = parseFloat(i .attributes["TIME-OFFSET"]), i.attributes.PRECISE = /YES/.test(i.attributes .PRECISE)), void r.trigger("data", i); if (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-out-cont" }, t[1] ? i.data = t[1] : i.data = "", void r.trigger("data", i); if (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-out" }, t[1] ? i.data = t[1] : i.data = "", void r.trigger("data", i); if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-in" }, t[1] ? i.data = t[1] : i.data = "", void r.trigger("data", i); r.trigger("data", { type: "tag", data: e.slice(4) }) } } } else r.trigger("data", { type: "comment", text: e.slice(1) }) }) : this.trigger("data", { type: "uri", uri: e })) }, n.addParser = function(e) { var t = this, i = e.expression, r = e.customType, n = e.dataParser, a = e.segment; "function" != typeof n && (n = function(e) { return e }), this.customParsers.push(function(e) { if (i.exec(e)) return t.trigger("data", { type: "custom", data: n(e), customType: r, segment: a }), !0 }) }, n.addTagMapper = function(e) { var t = e.expression, i = e.map; this.tagMappers.push(function(e) { return t.test(e) ? i(e) : e }) }, r }(n.a); function h(e, t) { return (h = Object.setPrototypeOf || function(e, t) { return e.__proto__ = t, e })(e, t) } var f = function(e) { var t, i; function r() { var t; (t = e.call(this) || this).lineStream = new u, t.parseStream = new c, t.lineStream.pipe(t.parseStream); var i, r, n = function(e) { if (void 0 === e) throw new ReferenceError( "this hasn't been initialised - super() hasn't been called"); return e }(t), a = [], o = {}, l = { AUDIO: {}, VIDEO: {}, "CLOSED-CAPTIONS": {}, SUBTITLES: {} }, d = 0; return t.manifest = { allowCache: !0, discontinuityStarts: [], segments: [] }, t.parseStream.on("data", function(e) { var t, u; ({ tag: function() { (({ "allow-cache": function() { this.manifest.allowCache = e.allowed, "allowed" in e || (this.trigger("info", { message: "defaulting allowCache to YES" }), this.manifest.allowCache = !0) }, byterange: function() { var t = {}; "length" in e && (o.byterange = t, t.length = e.length, "offset" in e || (this .trigger("info", { message: "defaulting offset to zero" }), e.offset = 0)), "offset" in e && (o.byterange = t, t.offset = e.offset) }, endlist: function() { this.manifest.endList = !0 }, inf: function() { "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this .trigger("info", { message: "defaulting media sequence to zero" })), "discontinuitySequence" in this.manifest || (this.manifest .discontinuitySequence = 0, this.trigger("info", { message: "defaulting discontinuity sequence to zero" })), e.duration > 0 && (o.duration = e.duration), 0 === e.duration && (o .duration = .01, this.trigger("info", { message: "updating zero segment duration to a small value" })), this.manifest.segments = a }, key: function() { if (e.attributes) if ("NONE" !== e.attributes.METHOD) if (e.attributes.URI) { if ("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" === e.attributes .KEYFORMAT) return -1 === ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC" ].indexOf(e.attributes.METHOD) ? void this.trigger("warn", { message: "invalid key method provided for Widevine" }) : ("SAMPLE-AES-CENC" === e.attributes.METHOD && this.trigger( "warn", { message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead" }), "data:text/plain;base64," !== e.attributes.URI.substring(0, 23) ? void this.trigger("warn", { message: "invalid key URI provided for Widevine" }) : e.attributes.KEYID && "0x" === e.attributes.KEYID.substring(0, 2) ? void(this.manifest.contentProtection = { "com.widevine.alpha": { attributes: { schemeIdUri: e.attributes.KEYFORMAT, keyId: e.attributes.KEYID.substring(2) }, pssh: s()(e.attributes.URI.split(",")[1]) } }) : void this.trigger("warn", { message: "invalid key ID provided for Widevine" })); e.attributes.METHOD || this.trigger("warn", { message: "defaulting key method to AES-128" }), r = { method: e.attributes.METHOD || "AES-128", uri: e.attributes.URI }, void 0 !== e.attributes.IV && (r.iv = e.attributes.IV) } else this.trigger("warn", { message: "ignoring key declaration without URI" }); else r = null; else this.trigger("warn", { message: "ignoring key declaration without attribute list" }) }, "media-sequence": function() { isFinite(e.number) ? this.manifest.mediaSequence = e.number : this.trigger( "warn", { message: "ignoring invalid media sequence: " + e.number }) }, "discontinuity-sequence": function() { isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, d = e .number) : this.trigger("warn", { message: "ignoring invalid discontinuity sequence: " + e.number }) }, "playlist-type": function() { /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e.playlistType : this.trigger("warn", { message: "ignoring unknown playlist type: " + e.playlist }) }, map: function() { i = {}, e.uri && (i.uri = e.uri), e.byterange && (i.byterange = e.byterange) }, "stream-inf": function() { this.manifest.playlists = a, this.manifest.mediaGroups = this.manifest .mediaGroups || l, e.attributes ? (o.attributes || (o.attributes = {}), Object .assign(o.attributes, e.attributes)) : this.trigger("warn", { message: "ignoring empty stream-inf attributes" }) }, media: function() { if (this.manifest.mediaGroups = this.manifest.mediaGroups || l, e.attributes && e.attributes.TYPE && e.attributes["GROUP-ID"] && e.attributes.NAME) { var i = this.manifest.mediaGroups[e.attributes.TYPE]; i[e.attributes["GROUP-ID"]] = i[e.attributes["GROUP-ID"]] || {}, t = i[e .attributes["GROUP-ID"]], (u = { default: /yes/i.test(e.attributes.DEFAULT) }).default ? u.autoselect = !0 : u.autoselect = /yes/i.test(e.attributes .AUTOSELECT), e.attributes.LANGUAGE && (u.language = e.attributes .LANGUAGE), e.attributes.URI && (u.uri = e.attributes.URI), e.attributes[ "INSTREAM-ID"] && (u.instreamId = e.attributes["INSTREAM-ID"]), e .attributes.CHARACTERISTICS && (u.characteristics = e.attributes .CHARACTERISTICS), e.attributes.FORCED && (u.forced = /yes/i.test(e .attributes.FORCED)), t[e.attributes.NAME] = u } else this.trigger("warn", { message: "ignoring incomplete or missing media group" }) }, discontinuity: function() { d += 1, o.discontinuity = !0, this.manifest.discontinuityStarts.push(a.length) }, "program-date-time": function() { void 0 === this.manifest.dateTimeString && (this.manifest.dateTimeString = e .dateTimeString, this.manifest.dateTimeObject = e.dateTimeObject), o .dateTimeString = e.dateTimeString, o.dateTimeObject = e.dateTimeObject }, targetduration: function() { !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", { message: "ignoring invalid target duration: " + e.duration }) : this.manifest.targetDuration = e.duration }, totalduration: function() { !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", { message: "ignoring invalid total duration: " + e.duration }) : this.manifest.totalDuration = e.duration }, start: function() { e.attributes && !isNaN(e.attributes["TIME-OFFSET"]) ? this.manifest.start = { timeOffset: e.attributes["TIME-OFFSET"], precise: e.attributes.PRECISE } : this.trigger("warn", { message: "ignoring start declaration without appropriate attribute list" }) }, "cue-out": function() { o.cueOut = e.data }, "cue-out-cont": function() { o.cueOutCont = e.data }, "cue-in": function() { o.cueIn = e.data } })[e.tagType] || function() {}).call(n) }, uri: function() { o.uri = e.uri, a.push(o), this.manifest.targetDuration && !("duration" in o) && (this .trigger("warn", { message: "defaulting segment duration to the target duration" }), o.duration = this.manifest.targetDuration), r && (o.key = r), o.timeline = d, i && (o.map = i), o = {} }, comment: function() {}, custom: function() { e.segment ? (o.custom = o.custom || {}, o.custom[e.customType] = e.data) : (this.manifest .custom = this.manifest.custom || {}, this.manifest.custom[e.customType] = e.data) } })[e.type].call(n) }), t } i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, h(t, i); var n = r.prototype; return n.push = function(e) { this.lineStream.push(e) }, n.end = function() { this.lineStream.push("\n") }, n.addParser = function(e) { this.parseStream.addParser(e) }, n.addTagMapper = function(e) { this.parseStream.addTagMapper(e) }, r }(n.a), p = i(1), m = new WebAssembly.Memory({ initial: 256, maximum: 256 }); new WebAssembly.Table({ initial: 0, maximum: 0, element: "anyfunc" }), m.buffer.byteLength, t.default = function(e) { e.url = "", e.canvas = null, e.webGLPlayer = null, e.videoSampleQueue = [], e.audioSampleQueue = [], e .videoInterval = 40, e.lastRenderTime = 0, e.intervalVal = 0, e.renderFrameCount = 0, e.requestAbort = ! 1, e.pause = !1, e.cbStreamData = !0, e.reConnect = !0, e.isLiveStream = !0, e.seekTime = 0, e .totalDuration = 0, e.playDuration = 0, e.startVideoPts = 0, e.startAudioPts = 0, e.tsFileList = [], e .getFileIndex = 0, e.lastTsFile = "", e.isFirstFile = !0, e.lastTsFileSequence = 0, e .sequenceExceptNum = 0, e.hlsTsPlaybackFileNo = -1, e.tsDemuxer = null, e.getFileCount = 100, e .intervalHandle = -1, e.intervalValue = 40, e.startDownloadTimeSecs = 0; var t = function(e, t) { if (e.indexOf("http") >= 0) return e; for (var i = t, r = 0, n = 0; n >= 0;)(n = i.indexOf("/")) >= 0 ? (i = i.substring(n + 1), r += n + 1) : i = t.substring(0, r); return "" !== e ? i + e : i }, i = function() { var t = { cmd: p.l, workerId: p.b }; e.postMessage(t), e.getFileIndex = 0, e.hlsTsPlaybackFileNo = -1 }, r = function r(n, a) { if (e.url = n, 1 != e._requestAbort) { if (!e.pause && (!(e.totalDuration > 0) || e.isLiveStream)) { var s = new XMLHttpRequest; s.open("get", n, !0), s.responseType = "text", s.onreadystatechange = function() { if (4 != s.readyState || 200 != s.status && 304 != s.status) 4 === s.readyState && 404 === s .status && e.postMessage({ cmd: 404 }); else { var i = new f; i.push(s.responseText), i.end(); var n = i.manifest; if ("undefined" !== i.manifest.endList && 1 == i.manifest.endList ? e.isLiveStream = !1 : e .isLiveStream = !0, n.segments.length < 1) { var o = e; return void p.j(3e3).then(function() { r(o.url, 1) }) } var u = 0, l = 0; if (e.isLiveStream) if ("" == e.lastTsFile) { for (u = 0; u < n.segments.length; u++) g = { filename: h = t(n.segments[u].uri, e.url), duration: n.segments[u].duration }, e.tsFileList.push(g); var d = 0; n.segments.length > 2 && (d = n.segments.length - 1 - 1), e.getFileIndex = d, e .lastTsFile = n.segments[d].uri } else { d = -1; var c = !1; for (u = 0; u < n.segments.length; u++) h = t(n.segments[u].uri, e.url), n.segments[u] .uri !== e.lastTsFile ? d >= 0 && (g = { filename: h, duration: n.segments[u].duration }, e.totalDuration += n.segments[u].duration, e.tsFileList.push(g), c || (e .lastTsFile = n.segments[u].uri, c = !0)) : (d = u, e.tsFileList.length = 0, e .tsFileList = [], e.getFileIndex = 0); if (d < 0) for (e.tsFileList.length = 0, e.tsFileList = [], e.getFileIndex = 0, u = 0; u < n .segments.length; u++) g = { filename: h = t(n.segments[u].uri, e.url), duration: n.segments[u].duration }, e.totalDuration += n.segments[u].duration, e.tsFileList.push(g), e.lastTsFile = n .segments[u].uri; if (1 === a) return } else { for (e.seekTime > 0 && (e.getFileIndex = -1), u = 0; u < n.segments.length; u++) { var h = t(n.segments[u].uri, e.url), m = 0; for (l = 0; l < e.tsFileList.length; l++) if (e.tsFileList[l].filename === h) { m = 1; break } if (0 == m) { e.seekTime > 0 && e.totalDuration >= e.seekTime && e.getFileIndex < 0 && (e .getFileIndex = u); var g = { filename: h, duration: n.segments[u].duration }; e.totalDuration += n.segments[u].duration, e.tsFileList.push(g) } } e.getFileIndex < 0 && (e.getFileIndex = 0); var v = { cmd: p.u, duration: e.totalDuration, live: e.isLiveStream, workerId: p.b }; e.postMessage(v) } e.tsFileList.length > 0 && 1 == a && (v = { cmd: p.w, workerId: p.b }, e.postMessage(v)) } }, s.send() } } else i() }, n = function t() { if (!(e.getFileCount++ < 1)) { var n = !1; if (!e.pause) if (1 != e._requestAbort) { if (e.isLiveStream) { if (e.getFileCount = 0, e.getFileIndex >= e.tsFileList.length || 3 == e.getFileCount) return void r(e.url, 1); n = !0 } else if (e.getFileIndex >= e.tsFileList.length) { e.getFileIndex++; var a = { cmd: p.r, workerId: p.b }; return void e.postMessage(a) } var s = e.tsFileList[e.getFileIndex].filename; if (e.isLiveStream) { var o = function(e) { var t = s.split("-"), i = t.length; if (i > 0) { var r = t[i - 1].split("."); if (r.length > 0) return r[0] } return "" }(), u = parseInt(o); u > 0 && u > e.lastTsFileSequence + 1 && (e.sequenceExceptNum++, a = { cmd: p.z, workerId: p.b, fileSequence: e.sequenceExceptNum }, e.postMessage(a)), e.lastTsFileSequence = u } else if (e.hlsTsPlaybackFileNo == e.getFileIndex) return; var l = new XMLHttpRequest; l.open("get", s, !0), l.responseType = "arraybuffer", l.onreadystatechange = function() { if (404 == l.status) return p.e("current file not found. refresh list..."), void r(e.url, 1); if (4 == l.readyState && (200 == l.status || 304 == l.status)) { var i = new Uint8Array(l.response), a = 0; for (a = 0; a < e.getFileIndex; a++) e.tsFileList[a].duration; var s = { cmd: p.q, workerId: p.b, mediaType: 1, codecId: 27, flag: 0, pts: 0, playTimeSec: 0, dat: i }; if (e.postMessage(s, [s.dat.buffer]), e.intervalHandle >= 0 && (clearInterval(e .intervalHandle), e.intervalHandle = -1), !e.pause) { var o = e.getFileIndex; o >= 0 && o < e.tsFileList.length ? e.intervalValue = 1e3 * e.tsFileList[o].duration - 600 : e.intervalValue = 2e3, e.isFirstFile && (e.isFirstFile = !1, e.intervalValue > 900 && (e.intervalValue -= 900)), e.intervalValue = 1e3 * e.tsFileList[o].duration, e.intervalHandle = setInterval(t, e.intervalValue) } if (e.getFileCount = 100, e.getFileIndex++, e.getFileIndex >= 0 && (e.getFileIndex, e .tsFileList.length), s = { cmd: p.t, workerId: p.b }, e.postMessage(s), n) return r(e.url, 0) } }, l.send(), e.hlsTsPlaybackFileNo = e.getFileIndex } else i() } }; e.addEventListener("message", function(t) { var a = t.data; switch (a.cmd) { case p.w: e.url = a.url, e.seekTime = a.time, r(a.url, 1); break; case p.s: 0 == a.t && n(); break; case p.y: r(e.url, 1); break; case p.B: var s = a.time; 1 == a.type && (s = a.time / 100 * e.totalDuration); var o = !1, u = 0, l = 0; for (l = 0; l < e.tsFileList.length; l++) if ((u += e.tsFileList[l].duration) > s) { e.getFileIndex = l, n(); var d = { cmd: p.B, type: a.type, time: s }; e.postMessage(d), o = !0; break } o || (d = { cmd: p.B, type: a.type, time: s }, e.postMessage(d)); break; case p.x: e.pause = !0; break; case p.A: e.pause = !1, r(e.url, 1); break; case p.l: e._requestAbort = !0, e.seekTime = 0, i() } }) } }]).default }), function(e, t) { "object" == typeof exports && "undefined" != typeof module ? module.exports = t(require("video.js")) : "function" == typeof define && define.amd ? define(["video.js"], t) : e.videojsFlash = t(e.videojs) }(this, function(e) { "use strict"; e = e && e.hasOwnProperty("default") ? e.default : e; var t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, i = "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {}, r = function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }, n = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t }, a = e.getComponent("Tech"), s = e.dom, o = e.url, u = e.createTimeRange, l = e.mergeOptions, d = i && i.navigator || {}, c = function(e) { function t(a, s) { r(this, t); var o = n(this, e.call(this, a, s)); return a.source && o.ready(function() { this.setSource(a.source) }, !0), a.startTime && o.ready(function() { this.load(), this.play(), this.currentTime(a.startTime) }, !0), i.videojs = i.videojs || {}, i.videojs.Flash = i.videojs.Flash || {}, i.videojs.Flash.onReady = t .onReady, i.videojs.Flash.onEvent = t.onEvent, i.videojs.Flash.onError = t.onError, o.on("seeked", function() { this.lastSeekTarget_ = void 0 }), o } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, e), t.prototype.createEl = function() { var e = this.options_; e.swf || (e.swf = "https://vjs.zencdn.net/swf/5.4.2/video-js.swf"); var i = e.techId, r = l({ readyFunction: "videojs.Flash.onReady", eventProxyFunction: "videojs.Flash.onEvent", errorEventProxyFunction: "videojs.Flash.onError", autoplay: e.autoplay, stretch: e.stretch || !1, fluent: e.fluent || !1, preload: e.preload, loop: e.loop, muted: e.muted }, e.flashVars), n = l({ wmode: "opaque", bgcolor: "#000000" }, e.params), a = l({ id: i, name: i, class: "vjs-tech" }, e.attributes); return this.el_ = t.embed(e.swf, r, n, a), this.el_.tech = this, this.el_ }, t.prototype.play = function() { this.ended() && this.setCurrentTime(0), this.el_.vjs_play() }, t.prototype.pause = function() { this.el_.vjs_pause() }, t.prototype.src = function(e) { return void 0 === e ? this.currentSrc() : this.setSrc(e) }, t.prototype.setSrc = function(e) { var t = this; e = o.getAbsoluteURL(e), this.el_.vjs_src(e), this.autoplay() && this.setTimeout(function() { return t.play() }, 0) }, t.prototype.seeking = function() { return void 0 !== this.lastSeekTarget_ }, t.prototype.setCurrentTime = function(t) { var i = this.seekable(); i.length && (t = (t = t > i.start(0) ? t : i.start(0)) < i.end(i.length - 1) ? t : i.end(i.length - 1), this .lastSeekTarget_ = t, this.trigger("seeking"), this.el_.vjs_setProperty("currentTime", t), e.prototype .setCurrentTime.call(this)) }, t.prototype.currentTime = function() { return this.seeking() ? this.lastSeekTarget_ || 0 : this.el_.vjs_getProperty("currentTime") }, t.prototype.currentSrc = function() { return this.currentSource_ ? this.currentSource_.src : this.el_.vjs_getProperty("currentSrc") }, t.prototype.duration = function() { if (0 === this.readyState()) return NaN; var e = this.el_.vjs_getProperty("duration"); return e >= 0 ? e : 1 / 0 }, t.prototype.load = function() { this.el_.vjs_load() }, t.prototype.poster = function() { this.el_.vjs_getProperty("poster") }, t.prototype.setPoster = function() {}, t.prototype.seekable = function() { var e = this.duration(); return 0 === e ? u() : u(0, e) }, t.prototype.buffered = function() { var e = this.el_.vjs_getProperty("buffered"); return 0 === e.length ? u() : u(e[0][0], e[0][1]) }, t.prototype.supportsFullScreen = function() { return !1 }, t.prototype.enterFullScreen = function() { return !1 }, t.prototype.getVideoPlaybackQuality = function() { var e = this.el_.vjs_getProperty("getVideoPlaybackQuality"); return i.performance && "function" == typeof i.performance.now ? e.creationTime = i.performance.now() : i .performance && i.performance.timing && "number" == typeof i.performance.timing.navigationStart && (e .creationTime = i.Date.now() - i.performance.timing.navigationStart), e }, t }(a), h = ["rtmpConnection", "rtmpStream", "preload", "defaultPlaybackRate", "playbackRate", "autoplay", "stretch", "fluent", "loop", "controls", "volume", "muted", "defaultMuted" ], f = ["networkState", "readyState", "initialTime", "startOffsetTime", "paused", "ended", "videoWidth", "videoHeight" ], p = c.prototype; function m(e) { var t = e.charAt(0).toUpperCase() + e.slice(1); p["set" + t] = function(t) { return this.el_.vjs_setProperty(e, t) } } function g(e) { p[e] = function() { return this.el_.vjs_getProperty(e) } } for (var v = 0; v < h.length; v++) g(h[v]), m(h[v]); for (var y = 0; y < f.length; y++) g(f[y]); return c.isSupported = function() { return !!(e.browser.IS_CHROME && !e.browser.IS_ANDROID || e.browser.IS_SAFARI && !e.browser.IS_IOS) || c .version()[0] >= 10 }, a.withSourceHandlers(c), c.nativeSourceHandler = {}, c.nativeSourceHandler.canPlayType = function(e) { return e in c.formats ? "maybe" : "" }, c.nativeSourceHandler.canHandleSource = function(e, t) { var i, r, n = void 0; return e.type ? n = e.type.replace(/;.*/, "").toLowerCase() : (i = e.src, n = (r = o.getFileExtension(i)) ? "video/" + r : ""), c.nativeSourceHandler.canPlayType(n) }, c.nativeSourceHandler.handleSource = function(e, t, i) { t.setSrc(e.src) }, c.nativeSourceHandler.dispose = function() {}, c.registerSourceHandler(c.nativeSourceHandler), c.formats = { "video/flv": "FLV", "video/x-flv": "FLV", "video/mp4": "MP4", "video/m4v": "MP4" }, c.onReady = function(e) { var t = s.$("#" + e), i = t && t.tech; i && i.el() && c.checkReady(i) }, c.checkReady = function(e) { e.el() && (e.el().vjs_getProperty ? e.triggerReady() : this.setTimeout(function() { c.checkReady(e) }, 50)) }, c.onEvent = function(e, t) { var i = s.$("#" + e).tech, r = Array.prototype.slice.call(arguments, 2); i.setTimeout(function() { i.trigger(t, r) }, 1) }, c.onError = function(e, t) { var i = s.$("#" + e).tech; if ("srcnotfound" === t) return i.error(4); "string" == typeof t ? i.error("FLASH: " + t) : (t.origin = "flash", i.error(t)) }, c.version = function() { var e = "0,0,0"; try { e = new i.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match( /^,?(.+),?$/)[1] } catch (t) { try { d.mimeTypes["application/x-shockwave-flash"].enabledPlugin && (e = (d.plugins["Shockwave Flash 2.0"] || d .plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1]) } catch (e) {} } return e.split(",") }, c.embed = function(e, t, i, r) { var n = c.getEmbedCode(e, t, i, r); return s.createEl("div", { innerHTML: n }).childNodes[0] }, c.getEmbedCode = function(e, t, i, r) { var n = "", a = "", s = ""; return t && Object.getOwnPropertyNames(t).forEach(function(e) { n += e + "=" + t[e] + "&" }), i = l({ movie: e, flashvars: n, allowScriptAccess: "always", allowNetworking: "all" }, i), Object.getOwnPropertyNames(i).forEach(function(e) { a += '' }), r = l({ data: e, width: "100%", height: "100%" }, r), Object.getOwnPropertyNames(r).forEach(function(e) { s += e + '="' + r[e] + '" ' }), '" + a + "" }, function(e) { e.streamingFormats = { "rtmp/mp4": "MP4", "rtmp/flv": "FLV" }, e.streamFromParts = function(e, t) { return e + "&" + t }, e.streamToParts = function(e) { var t = { connection: "", stream: "" }; if (!e) return t; var i = e.search(/&(?![\w-]+=)/), r = void 0; return -1 !== i ? r = i + 1 : 0 === (i = r = e.lastIndexOf("/") + 1) && (i = r = e.length), t.connection = e .substring(0, i), t.stream = e.substring(r, e.length), t }, e.isStreamingType = function(t) { return t in e.streamingFormats }, e.RTMP_RE = /^rtmp[set]?:\/\//i, e.isStreamingSrc = function(t) { return e.RTMP_RE.test(t) }, e.rtmpSourceHandler = {}, e.rtmpSourceHandler.canPlayType = function(t) { return e.isStreamingType(t) ? "maybe" : "" }, e.rtmpSourceHandler.canHandleSource = function(t, i) { var r = e.rtmpSourceHandler.canPlayType(t.type); return r || (e.isStreamingSrc(t.src) ? "maybe" : "") }, e.rtmpSourceHandler.handleSource = function(t, i, r) { var n = e.streamToParts(t.src); i.setRtmpConnection(n.connection), i.setRtmpStream(n.stream) }, e.registerSourceHandler(e.rtmpSourceHandler) }(c), a.getTech("Flash") ? (e.log.warn("Not using videojs-flash as it appears to already be registered"), e.log .warn("videojs-flash should only be used with video.js@6 and above")) : e.registerTech("Flash", c), c.VERSION = "2.1.2", c }), function(e) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = e(); else if ("function" == typeof define && define.amd) define([], e); else { ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).videojsContribHls = e() } }(function() { return function e(t, i, r) { function n(s, o) { if (!i[s]) { if (!t[s]) { var u = "function" == typeof require && require; if (!o && u) return u(s, !0); if (a) return a(s, !0); var l = new Error("Cannot find module '" + s + "'"); throw l.code = "MODULE_NOT_FOUND", l } var d = i[s] = { exports: {} }; t[s][0].call(d.exports, function(e) { var i = t[s][1][e]; return n(i || e) }, d, d.exports, e, t, i, r) } return i[s].exports } for (var a = "function" == typeof require && require, s = 0; s < r.length; s++) n(r[s]); return n }({ 1: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { return function(e, t) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return function(e, t) { var i = [], r = !0, n = !1, a = void 0; try { for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s.value), ! t || i.length !== t); r = !0); } catch (e) { n = !0, a = e } finally { try { !r && o.return && o.return() } finally { if (n) throw a } } return i }(e, t); throw new TypeError("Invalid attempt to destructure non-iterable instance") } }(); var n, a = e("global/window"), s = (n = a) && n.__esModule ? n : { default: n }, o = function(e, t) { for (var i = e.cues, r = 0; r < i.length; r++) { var n = i[r]; if (t >= n.adStartTime && t <= n.adEndTime) return n } return null }; i.default = { updateAdCues: function(e, t) { var i = arguments.length <= 2 || void 0 === arguments[2] ? 0 : arguments[2]; if (e.segments) for (var n = i, a = void 0, u = 0; u < e.segments.length; u++) { var l = e.segments[u]; if (a || (a = o(t, n + l.duration / 2)), a) { if ("cueIn" in l) { a.endTime = n, a.adEndTime = n, n += l.duration, a = null; continue } if (n < a.endTime) { n += l.duration; continue } a.endTime += l.duration } else if ("cueOut" in l && ((a = new s.default.VTTCue(n, n + l.duration, l.cueOut)) .adStartTime = n, a.adEndTime = n + parseFloat(l.cueOut), t.addCue(a)), "cueOutCont" in l) { var d, c, h = l.cueOutCont.split("/").map(parseFloat), f = r(h, 2); d = f[0], c = f[1], (a = new s.default.VTTCue(n, n + l.duration, "")).adStartTime = n - d, a.adEndTime = a.adStartTime + c, t.addCue(a) } n += l.duration } }, findAdCue: o }, t.exports = i.default }, { "global/window": 32 }], 2: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function(e, t) { return e.start(t) + "-" + e.end(t) }, n = function(e, t) { var i = e.toString(16); return "00".substring(0, 2 - i.length) + i + (t % 2 ? " " : "") }, a = function(e) { return e >= 32 && e < 126 ? String.fromCharCode(e) : "." }, s = { hexDump: function(e) { for (var t = Array.prototype.slice.call(e), i = "", r = 0; r < t.length / 16; r++) i += t.slice( 16 * r, 16 * r + 16).map(n).join("") + " " + t.slice(16 * r, 16 * r + 16).map(a).join("") + "\n"; return i }, tagDump: function(e) { return s.hexDump(e.bytes) }, textRanges: function(e) { var t = "", i = void 0; for (i = 0; i < e.length; i++) t += r(e, i) + " "; return t }, createTransferableMessage: function(e) { var t = {}; return Object.keys(e).forEach(function(i) { var r = e[i]; ArrayBuffer.isView(r) ? t[i] = { bytes: r.buffer, byteOffset: r.byteOffset, byteLength: r.byteLength } : t[i] = r }), t }, initSegmentId: function(e) { var t = e.byterange || { length: 1 / 0, offset: 0 }; return [t.length, t.offset, e.resolvedUri].join(",") } }; i.default = s, t.exports = i.default }, {}], 3: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }), i.default = { GOAL_BUFFER_LENGTH: 30, MAX_GOAL_BUFFER_LENGTH: 60, GOAL_BUFFER_LENGTH_RATE: 1, BANDWIDTH_VARIANCE: 1.2, BUFFER_LOW_WATER_LINE: 0, MAX_BUFFER_LOW_WATER_LINE: 30, BUFFER_LOW_WATER_LINE_RATE: 1 }, t.exports = i.default }, {}], 4: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = e("global/window"), a = (r = n) && r.__esModule ? r : { default: r }, s = e("aes-decrypter"), o = e("./bin-utils"); i.default = function(e) { return new function(e) { e.onmessage = function(e) { var t = e.data, i = new Uint8Array(t.encrypted.bytes, t.encrypted.byteOffset, t.encrypted.byteLength), r = new Uint32Array(t.key.bytes, t.key.byteOffset, t.key.byteLength / 4), n = new Uint32Array(t.iv.bytes, t.iv.byteOffset, t.iv.byteLength / 4); new s.Decrypter(i, r, n, function(e, i) { a.default.postMessage((0, o.createTransferableMessage)({ source: t.source, decrypted: i }), [i.buffer]) }) } }(e) }, t.exports = i.default }, { "./bin-utils": 2, "aes-decrypter": 25, "global/window": 32 }], 5: [function(e, t, i) { (function(t) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function a(e) { return e && e.__esModule ? e : { default: e } } var s = a(e("./playlist-loader")), o = e("./playlist.js"), u = a(e("./segment-loader")), l = a(e("./vtt-segment-loader")), d = a(e("./ranges")), c = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null), h = a(e("./ad-cue-tags")), f = a(e("./sync-controller")), p = e("videojs-contrib-media-sources/es5/codec-utils"), m = a(e("webwackify")), g = a(e("./decrypter-worker")), v = a(e("./config")), y = e("./util/codecs.js"), _ = e("./media-groups"), b = void 0, w = { videoCodec: "avc1", videoObjectTypeIndicator: ".4d400d", audioProfile: "2" }, E = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred" ], T = function(e) { return this.audioSegmentLoader_[e] + this.mainSegmentLoader_[e] }, S = function() { var t = void 0; try { t = e.resolve("./decrypter-worker") } catch (e) {} return t }, A = function(e) { return e.replace(/avc1\.(\d+)\.(\d+)/i, function(e) { return (0, p.translateLegacyCodecs)([e])[0] }) }; i.mapLegacyAvcCodecs_ = A; var k = function(e, t, i) { return e + "/" + t + '; codecs="' + i.filter(function(e) { return !!e }).join(", ") + '"' }, R = function(e, t) { var i = function(e) { return e.segments && e.segments.length && e.segments[0].map ? "mp4" : "mp2t" }(t), r = function(e) { var t = e.attributes || {}; return t.CODECS ? (0, y.parseCodecs)(t.CODECS) : w }(t), n = t.attributes || {}, a = !0, s = !1; if (!t) return []; if (e.mediaGroups.AUDIO && n.AUDIO) { var o = e.mediaGroups.AUDIO[n.AUDIO]; if (o) for (var u in s = !0, a = !1, o) if (!o[u].uri) { a = !0; break } } s && !r.audioProfile && (c.default.log.warn( "Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)" ), r.audioProfile = w.audioProfile); var l = {}; r.videoCodec && (l.video = "" + r.videoCodec + r.videoObjectTypeIndicator), r.audioProfile && (l .audio = "mp4a.40." + r.audioProfile); var d = k("audio", i, [l.audio]), h = k("video", i, [l.video]), f = k("video", i, [l.video, l.audio]); return s ? !a && l.video ? [h, d] : [f, d] : l.video ? [f] : [d] }; i.mimeTypesForPlaylist_ = R; var M = function(e) { function t(e) { var i = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this); var r = e.url, a = e.handleManifestRedirects, o = e.withCredentials, d = e.mode, h = e.tech, p = e.bandwidth, v = e.externHls, y = e.useCueTags, w = e.blacklistDuration, A = e.enableLowInitialPlaylist; if (!r) throw new Error("A non-empty playlist URL is required"); b = v, this.tech_ = h, this.hls_ = h.hls, this.mode_ = d, this.useCueTags_ = y, this .blacklistDuration = w, this.enableLowInitialPlaylist = A, this.useCueTags_ && (this .cueTagsTrack_ = this.tech_.addTextTrack("metadata", "ad-cues"), this.cueTagsTrack_ .inBandMetadataTrackDispatchType = ""), this.requestOptions_ = { withCredentials: o, handleManifestRedirects: a, timeout: null }, this.mediaTypes_ = (0, _.createMediaTypes)(), this.mediaSource = new c.default .MediaSource({ mode: d }), this.mediaSource.addEventListener("sourceopen", this.handleSourceOpen_.bind(this)), this .seekable_ = c.default.createTimeRanges(), this.hasPlayed_ = function() { return !1 }, this.syncController_ = new f.default(e), this.segmentMetadataTrack_ = h .addRemoteTextTrack({ kind: "metadata", label: "segment-metadata" }, !1).track, this.decrypter_ = (0, m.default)(g.default, S()); var k = { hls: this.hls_, mediaSource: this.mediaSource, currentTime: this.tech_.currentTime.bind(this.tech_), seekable: function() { return i.seekable() }, seeking: function() { return i.tech_.seeking() }, duration: function() { return i.mediaSource.duration }, hasPlayed: function() { return i.hasPlayed_() }, goalBufferLength: function() { return i.goalBufferLength() }, bandwidth: p, syncController: this.syncController_, decrypter: this.decrypter_ }; this.masterPlaylistLoader_ = new s.default(r, this.hls_, this.requestOptions_), this .setupMasterPlaylistLoaderListeners_(), this.mainSegmentLoader_ = new u.default(c.default .mergeOptions(k, { segmentMetadataTrack: this.segmentMetadataTrack_, loaderType: "main" }), e), this.audioSegmentLoader_ = new u.default(c.default.mergeOptions(k, { loaderType: "audio" }), e), this.subtitleSegmentLoader_ = new l.default(c.default.mergeOptions(k, { loaderType: "vtt" }), e), this.setupSegmentLoaderListeners_(), E.forEach(function(e) { i[e + "_"] = T.bind(i, e) }), this.masterPlaylistLoader_.load() } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, c["default"].EventTarget), r(t, [{ key: "setupMasterPlaylistLoaderListeners_", value: function() { var e = this; this.masterPlaylistLoader_.on("loadedmetadata", function() { var t = e.masterPlaylistLoader_.media(), i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3; (0, o.isLowestEnabledRendition)(e.masterPlaylistLoader_.master, e .masterPlaylistLoader_.media()) ? e.requestOptions_.timeout = 0: e .requestOptions_.timeout = i, t.endList && "none" !== e.tech_.preload() && ( e.mainSegmentLoader_.playlist(t, e.requestOptions_), e.mainSegmentLoader_ .load()), (0, _.setupMediaGroups)({ segmentLoaders: { AUDIO: e.audioSegmentLoader_, SUBTITLES: e.subtitleSegmentLoader_, main: e.mainSegmentLoader_ }, tech: e.tech_, requestOptions: e.requestOptions_, masterPlaylistLoader: e.masterPlaylistLoader_, mode: e.mode_, hls: e.hls_, master: e.master(), mediaTypes: e.mediaTypes_, blacklistCurrentPlaylist: e.blacklistCurrentPlaylist.bind(e) }), e.triggerPresenceUsage_(e.master(), t); try { e.setupSourceBuffers_() } catch (t) { return c.default.log.warn("Failed to create SourceBuffers", t), e .mediaSource.endOfStream("decode") } e.setupFirstPlay(), e.trigger("selectedinitialmedia") }), this.masterPlaylistLoader_.on("loadedplaylist", function() { var t, i = e.masterPlaylistLoader_.media(); if (!i) { var r = void 0; return e.enableLowInitialPlaylist && (r = e.selectInitialPlaylist()), r || ( r = e.selectPlaylist()), e.initialMedia_ = r, void e .masterPlaylistLoader_.media(e.initialMedia_) } e.useCueTags_ && e.updateAdCues_(i), e.mainSegmentLoader_.playlist(i, e .requestOptions_), e.updateDuration(), e.tech_.paused() || e .mainSegmentLoader_.load(), i.endList || (t = function() { var t = e.seekable(); 0 !== t.length && e.mediaSource.addSeekableRange_(t.start(0), t.end(0)) }, e.duration() !== 1 / 0 ? e.tech_.one("durationchange", function i() { e.duration() === 1 / 0 ? t() : e.tech_.one("durationchange", i) }) : t()) }), this.masterPlaylistLoader_.on("error", function() { e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error) }), this.masterPlaylistLoader_.on("mediachanging", function() { e.mainSegmentLoader_.abort(), e.mainSegmentLoader_.pause() }), this.masterPlaylistLoader_.on("mediachange", function() { var t = e.masterPlaylistLoader_.media(), i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3; (0, o.isLowestEnabledRendition)(e.masterPlaylistLoader_.master, e .masterPlaylistLoader_.media()) ? e.requestOptions_.timeout = 0: e .requestOptions_.timeout = i, e.mainSegmentLoader_.playlist(t, e .requestOptions_), e.mainSegmentLoader_.load(), e.tech_.trigger({ type: "mediachange", bubbles: !0 }) }), this.masterPlaylistLoader_.on("playlistunchanged", function() { var t = e.masterPlaylistLoader_.media(); e.stuckAtPlaylistEnd_(t) && (e.blacklistCurrentPlaylist({ message: "Playlist no longer updating." }), e.tech_.trigger("playliststuck")) }), this.masterPlaylistLoader_.on("renditiondisabled", function() { e.tech_.trigger({ type: "usage", name: "hls-rendition-disabled" }) }), this.masterPlaylistLoader_.on("renditionenabled", function() { e.tech_.trigger({ type: "usage", name: "hls-rendition-enabled" }) }) } }, { key: "triggerPresenceUsage_", value: function(e, t) { var i = e.mediaGroups || {}, r = !0, n = Object.keys(i.AUDIO); for (var a in i.AUDIO) for (var s in i.AUDIO[a]) { i.AUDIO[a][s].uri || (r = !1) } r && this.tech_.trigger({ type: "usage", name: "hls-demuxed" }), Object.keys(i.SUBTITLES).length && this.tech_.trigger({ type: "usage", name: "hls-webvtt" }), b.Playlist.isAes(t) && this.tech_.trigger({ type: "usage", name: "hls-aes" }), b.Playlist.isFmp4(t) && this.tech_.trigger({ type: "usage", name: "hls-fmp4" }), n.length && Object.keys(i.AUDIO[n[0]]).length > 1 && this.tech_.trigger({ type: "usage", name: "hls-alternate-audio" }), this.useCueTags_ && this.tech_.trigger({ type: "usage", name: "hls-playlist-cue-tags" }) } }, { key: "setupSegmentLoaderListeners_", value: function() { var e = this; this.mainSegmentLoader_.on("bandwidthupdate", function() { var t = e.selectPlaylist(), i = e.masterPlaylistLoader_.media(), r = e.tech_.buffered(), n = r.length ? r.end(r.length - 1) - e.tech_.currentTime() : 0, a = e.bufferLowWaterLine(); (!i.endList || e.duration() < v.default.MAX_BUFFER_LOW_WATER_LINE || t .attributes.BANDWIDTH < i.attributes.BANDWIDTH || n >= a) && e .masterPlaylistLoader_.media(t), e.tech_.trigger("bandwidthupdate") }), this.mainSegmentLoader_.on("progress", function() { e.trigger("progress") }), this.mainSegmentLoader_.on("error", function() { e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error()) }), this.mainSegmentLoader_.on("syncinfoupdate", function() { e.onSyncInfoUpdate_() }), this.mainSegmentLoader_.on("timestampoffset", function() { e.tech_.trigger({ type: "usage", name: "hls-timestamp-offset" }) }), this.audioSegmentLoader_.on("syncinfoupdate", function() { e.onSyncInfoUpdate_() }), this.mainSegmentLoader_.on("ended", function() { e.onEndOfStream() }), this.mainSegmentLoader_.on("earlyabort", function() { e.blacklistCurrentPlaylist({ message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering." }, 120) }), this.mainSegmentLoader_.on("reseteverything", function() { e.tech_.trigger("hls-reset") }), this.mainSegmentLoader_.on("segmenttimemapping", function(t) { e.tech_.trigger({ type: "hls-segment-time-mapping", mapping: t.mapping }) }), this.audioSegmentLoader_.on("ended", function() { e.onEndOfStream() }) } }, { key: "mediaSecondsLoaded_", value: function() { return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this .mainSegmentLoader_.mediaSecondsLoaded) } }, { key: "load", value: function() { this.mainSegmentLoader_.load(), this.mediaTypes_.AUDIO.activePlaylistLoader && this .audioSegmentLoader_.load(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this.subtitleSegmentLoader_.load() } }, { key: "fastQualityChange_", value: function() { var e = this.selectPlaylist(); e !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(e), this.mainSegmentLoader_.resetLoader()) } }, { key: "play", value: function() { if (!this.setupFirstPlay()) { this.tech_.ended() && this.tech_.setCurrentTime(0), this.hasPlayed_() && this .load(); var e = this.tech_.seekable(); return this.tech_.duration() === 1 / 0 && this.tech_.currentTime() < e.start(0) ? this.tech_.setCurrentTime(e.end(e.length - 1)) : void 0 } } }, { key: "setupFirstPlay", value: function() { var e, t = this, i = this.masterPlaylistLoader_.media(); if (!i || this.tech_.paused() || this.hasPlayed_()) return !1; if (!i.endList) { var r = (e = t.seekable()).length ? c.default.browser.IE_VERSION && "html5" === t .mode_ && 0 === t.tech_.readyState() ? (t.tech_.one("loadedmetadata", function() { t.trigger("firstplay"), t.tech_.setCurrentTime(e.end(0)), t.hasPlayed_ = function() { return !0 } }), { v: !1 }) : (t.trigger("firstplay"), void t.tech_.setCurrentTime(e.end(0))) : { v: !1 }; if ("object" == typeof r) return r.v } return this.hasPlayed_ = function() { return !0 }, this.load(), !0 } }, { key: "handleSourceOpen_", value: function() { try { this.setupSourceBuffers_() } catch (e) { return c.default.log.warn("Failed to create Source Buffers", e), this.mediaSource .endOfStream("decode") } if (this.tech_.autoplay()) { var e = this.tech_.play(); void 0 !== e && "function" == typeof e.then && e.then(null, function(e) {}) } this.trigger("sourceopen") } }, { key: "onEndOfStream", value: function() { var e = this.mainSegmentLoader_.ended_; this.mediaTypes_.AUDIO.activePlaylistLoader && (e = e && this.audioSegmentLoader_ .ended_), e && this.mediaSource.endOfStream() } }, { key: "stuckAtPlaylistEnd_", value: function(e) { if (!this.seekable().length) return !1; var t = this.syncController_.getExpiredTime(e, this.mediaSource.duration); if (null === t) return !1; var i = b.Playlist.playlistEnd(e, t), r = this.tech_.currentTime(), n = this.tech_.buffered(); if (!n.length) return i - r <= d.default.SAFE_TIME_DELTA; var a = n.end(n.length - 1); return a - r <= d.default.SAFE_TIME_DELTA && i - a <= d.default.SAFE_TIME_DELTA } }, { key: "blacklistCurrentPlaylist", value: function(e, t) { void 0 === e && (e = {}); var i, r = void 0; if (r = e.playlist || this.masterPlaylistLoader_.media(), t = t || e .blacklistDuration || this.blacklistDuration, !r) { this.error = e; try { return this.mediaSource.endOfStream("network") } catch (e) { return this.trigger("error") } } var n = 1 === this.masterPlaylistLoader_.master.playlists.filter(o.isEnabled) .length; return n ? (c.default.log.warn( "Problem encountered with the current HLS playlist. Trying again since it is the final playlist." ), this.tech_.trigger("retryplaylist"), this.masterPlaylistLoader_.load(n)) : (r .excludeUntil = Date.now() + 1e3 * t, this.tech_.trigger("blacklistplaylist"), this.tech_.trigger({ type: "usage", name: "hls-rendition-blacklisted" }), i = this.selectPlaylist(), c.default.log.warn( "Problem encountered with the current HLS playlist." + (e.message ? " " + e .message : "") + " Switching to another playlist."), this .masterPlaylistLoader_.media(i)) } }, { key: "pauseLoading", value: function() { this.mainSegmentLoader_.pause(), this.mediaTypes_.AUDIO.activePlaylistLoader && this .audioSegmentLoader_.pause(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this.subtitleSegmentLoader_.pause() } }, { key: "setCurrentTime", value: function(e) { var t = d.default.findRange(this.tech_.buffered(), e); return this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media() && this .masterPlaylistLoader_.media().segments ? t && t.length && "flash" !== this .mode_ ? e : (this.mainSegmentLoader_.resetEverything(), this.mainSegmentLoader_ .abort(), this.mediaTypes_.AUDIO.activePlaylistLoader && (this .audioSegmentLoader_.resetEverything(), this.audioSegmentLoader_.abort()), this.mediaTypes_.SUBTITLES.activePlaylistLoader && (this.subtitleSegmentLoader_ .resetEverything(), this.subtitleSegmentLoader_.abort()), void this.load()) : 0 } }, { key: "duration", value: function() { return this.masterPlaylistLoader_ ? this.mediaSource ? this.mediaSource.duration : b .Playlist.duration(this.masterPlaylistLoader_.media()) : 0 } }, { key: "seekable", value: function() { return this.seekable_ } }, { key: "onSyncInfoUpdate_", value: function() { var e = void 0, t = void 0; if (this.masterPlaylistLoader_) { var i = this.masterPlaylistLoader_.media(); if (i) { var r = this.syncController_.getExpiredTime(i, this.mediaSource.duration); if (null !== r && 0 !== (e = b.Playlist.seekable(i, r)).length) { if (this.mediaTypes_.AUDIO.activePlaylistLoader) { if (i = this.mediaTypes_.AUDIO.activePlaylistLoader.media(), null === (r = this.syncController_.getExpiredTime(i, this.mediaSource.duration))) return; if (0 === (t = b.Playlist.seekable(i, r)).length) return } t ? t.start(0) > e.end(0) || e.start(0) > t.end(0) ? this.seekable_ = e : this .seekable_ = c.default.createTimeRanges([ [t.start(0) > e.start(0) ? t.start(0) : e.start(0), t.end(0) < e.end( 0) ? t.end(0) : e.end(0) ] ]) : this.seekable_ = e, this.tech_.trigger("seekablechanged") } } } } }, { key: "updateDuration", value: function() { var e = this, t = this.mediaSource.duration, i = b.Playlist.duration(this.masterPlaylistLoader_.media()), r = this.tech_.buffered(), n = function t() { e.mediaSource.duration = i, e.tech_.trigger("durationchange"), e.mediaSource .removeEventListener("sourceopen", t) }; r.length > 0 && (i = Math.max(i, r.end(r.length - 1))), t !== i && ("open" !== this .mediaSource.readyState ? this.mediaSource.addEventListener("sourceopen", n) : n()) } }, { key: "dispose", value: function() { var e = this; this.decrypter_.terminate(), this.masterPlaylistLoader_.dispose(), this .mainSegmentLoader_.dispose(), ["AUDIO", "SUBTITLES"].forEach(function(t) { var i = e.mediaTypes_[t].groups; for (var r in i) i[r].forEach(function(e) { e.playlistLoader && e.playlistLoader.dispose() }) }), this.audioSegmentLoader_.dispose(), this.subtitleSegmentLoader_.dispose() } }, { key: "master", value: function() { return this.masterPlaylistLoader_.master } }, { key: "media", value: function() { return this.masterPlaylistLoader_.media() || this.initialMedia_ } }, { key: "setupSourceBuffers_", value: function() { var e, t = this.masterPlaylistLoader_.media(); if (t && "open" === this.mediaSource.readyState) { if ((e = R(this.masterPlaylistLoader_.master, t)).length < 1) return this.error = "No compatible SourceBuffer configuration for the variant stream:" + t .resolvedUri, this.mediaSource.endOfStream("decode"); this.mainSegmentLoader_.mimeType(e[0]), e[1] && this.audioSegmentLoader_.mimeType( e[1]), this.excludeIncompatibleVariants_(t) } } }, { key: "excludeIncompatibleVariants_", value: function(e) { var t = this.masterPlaylistLoader_.master, i = 2, r = null, n = void 0; e.attributes.CODECS && (n = (0, y.parseCodecs)(e.attributes.CODECS), r = n .videoCodec, i = n.codecCount), t.playlists.forEach(function(e) { var t = { codecCount: 2, videoCodec: null }; if (e.attributes.CODECS) { var n = e.attributes.CODECS; t = (0, y.parseCodecs)(n), window.MediaSource && window.MediaSource .isTypeSupported && !window.MediaSource.isTypeSupported( 'video/mp4; codecs="' + A(n) + '"') && (e.excludeUntil = 1 / 0) } t.codecCount !== i && (e.excludeUntil = 1 / 0), t.videoCodec !== r && (e .excludeUntil = 1 / 0) }) } }, { key: "updateAdCues_", value: function(e) { var t = 0, i = this.seekable(); i.length && (t = i.start(0)), h.default.updateAdCues(e, this.cueTagsTrack_, t) } }, { key: "goalBufferLength", value: function() { var e = this.tech_.currentTime(), t = v.default.GOAL_BUFFER_LENGTH, i = v.default.GOAL_BUFFER_LENGTH_RATE, r = Math.max(t, v.default.MAX_GOAL_BUFFER_LENGTH); return Math.min(t + e * i, r) } }, { key: "bufferLowWaterLine", value: function() { var e = this.tech_.currentTime(), t = v.default.BUFFER_LOW_WATER_LINE, i = v.default.BUFFER_LOW_WATER_LINE_RATE, r = Math.max(t, v.default.MAX_BUFFER_LOW_WATER_LINE); return Math.min(t + e * i, r) } }]), t }(); i.MasterPlaylistController = M }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./ad-cue-tags": 1, "./config": 3, "./decrypter-worker": 4, "./media-groups": 6, "./playlist-loader": 9, "./playlist.js": 11, "./ranges": 12, "./segment-loader": 16, "./sync-controller": 18, "./util/codecs.js": 19, "./vtt-segment-loader": 20, "videojs-contrib-media-sources/es5/codec-utils": 65, webwackify: 76 }], 6: [function(e, t, i) { (function(t) { "use strict"; function r(e) { return e && e.__esModule ? e : { default: e } } Object.defineProperty(i, "__esModule", { value: !0 }); var n = r("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null), a = r(e("./playlist-loader")), s = function() {}, o = function(e) { var t = e.default ? "main" : "alternative"; return e.characteristics && e.characteristics.indexOf("public.accessibility.describes-video") >= 0 && (t = "main-desc"), t }, u = function(e, t) { e.abort(), e.pause(), t && t.activePlaylistLoader && (t.activePlaylistLoader.pause(), t .activePlaylistLoader = null) }; i.stopLoaders = u; var l = function(e, t) { t.activePlaylistLoader = e, e.load() }; i.startLoaders = l; var d = function(e, t) { return function() { var i = t.segmentLoaders, r = i[e], n = i.main, a = t.mediaTypes[e], s = a.activeTrack(), o = a.activeGroup(s), d = a.activePlaylistLoader; u(r, a), o && (o.playlistLoader ? (r.resyncLoader(), l(o.playlistLoader, a)) : d && n .resetEverything()) } }; i.onGroupChanged = d; var c = function(e, t) { return function() { var i = t.segmentLoaders, r = i[e], n = i.main, a = t.mediaTypes[e], s = a.activeTrack(), o = a.activeGroup(s), d = a.activePlaylistLoader; u(r, a), o && (o.playlistLoader ? d !== o.playlistLoader ? (r.track && r.track(s), r .resetEverything(), l(o.playlistLoader, a)) : l(o.playlistLoader, a) : n .resetEverything()) } }; i.onTrackChanged = c; var h = { AUDIO: function(e, t) { return function() { var i = t.segmentLoaders[e], r = t.mediaTypes[e], a = t.blacklistCurrentPlaylist; u(i, r); var s = r.activeTrack(), o = r.activeGroup(), l = (o.filter(function(e) { return e.default })[0] || o[0]).id, d = r.tracks[l]; if (s !== d) { for (var c in n.default.log.warn( "Problem encountered loading the alternate audio track.Switching back to default." ), r.tracks) r.tracks[c].enabled = r.tracks[c] === d; r.onTrackChanged() } else a({ message: "Problem encountered loading the default audio track." }) } }, SUBTITLES: function(e, t) { return function() { var i = t.segmentLoaders[e], r = t.mediaTypes[e]; n.default.log.warn( "Problem encountered loading the subtitle track.Disabling subtitle track."), u(i, r); var a = r.activeTrack(); a && (a.mode = "disabled"), r.onTrackChanged() } } }; i.onError = h; var f = { AUDIO: function(e, t, i) { if (t) { var r = i.tech, n = i.requestOptions, a = i.segmentLoaders[e]; t.on("loadedmetadata", function() { var e = t.media(); a.playlist(e, n), (!r.paused() || e.endList && "none" !== r.preload()) && a.load() }), t.on("loadedplaylist", function() { a.playlist(t.media(), n), r.paused() || a.load() }), t.on("error", h[e](e, i)) } }, SUBTITLES: function(e, t, i) { var r = i.tech, n = i.requestOptions, a = i.segmentLoaders[e], s = i.mediaTypes[e]; t.on("loadedmetadata", function() { var e = t.media(); a.playlist(e, n), a.track(s.activeTrack()), (!r.paused() || e.endList && "none" !== r .preload()) && a.load() }), t.on("loadedplaylist", function() { a.playlist(t.media(), n), r.paused() || a.load() }), t.on("error", h[e](e, i)) } }; i.setupListeners = f; var p = { AUDIO: function(e, t) { var i = t.mode, r = t.hls, s = t.segmentLoaders[e], u = t.requestOptions, l = t.master.mediaGroups, d = t.mediaTypes[e], c = d.groups, p = d.tracks; for (var m in l[e] && 0 !== Object.keys(l[e]).length && "html5" === i || (l[e] = { main: { default: { default: !0 } } }), l[e]) for (var g in c[m] || (c[m] = []), l[e][m]) { var v = l[e][m][g], y = void 0; if (y = v.resolvedUri ? new a.default(v.resolvedUri, r, u) : null, v = n.default .mergeOptions({ id: g, playlistLoader: y }, v), f[e](e, v.playlistLoader, t), c[m].push(v), void 0 === p[g]) { var _ = new n.default.AudioTrack({ id: g, kind: o(v), enabled: !1, language: v.language, default: v.default, label: g }); p[g] = _ } } s.on("error", h[e](e, t)) }, SUBTITLES: function(e, t) { var i = t.tech, r = t.hls, s = t.segmentLoaders[e], o = t.requestOptions, u = t.master.mediaGroups, l = t.mediaTypes[e], d = l.groups, c = l.tracks; for (var p in u[e]) for (var m in d[p] || (d[p] = []), u[e][p]) if (!u[e][p][m].forced) { var g = u[e][p][m]; if (g = n.default.mergeOptions({ id: m, playlistLoader: new a.default(g.resolvedUri, r, o) }, g), f[e](e, g.playlistLoader, t), d[p].push(g), void 0 === c[m]) { var v = i.addRemoteTextTrack({ id: m, kind: "subtitles", enabled: !1, language: g.language, label: m }, !1).track; c[m] = v } } s.on("error", h[e](e, t)) }, "CLOSED-CAPTIONS": function(e, t) { var i = t.tech, r = t.master.mediaGroups, a = t.mediaTypes[e], s = a.groups, o = a.tracks; for (var u in r[e]) for (var l in s[u] || (s[u] = []), r[e][u]) { var d = r[e][u][l]; if (d.instreamId.match(/CC\d/) && (s[u].push(n.default.mergeOptions({ id: l }, d)), void 0 === o[l])) { var c = i.addRemoteTextTrack({ id: d.instreamId, kind: "captions", enabled: !1, language: d.language, label: l }, !1).track; o[l] = c } } } }; i.initialize = p; var m = function(e, t) { return function(i) { var r = t.masterPlaylistLoader, n = t.mediaTypes[e].groups, a = r.media(); if (!a) return null; var s = null; return a.attributes[e] && (s = n[a.attributes[e]]), s = s || n.main, void 0 === i ? s : null === i ? null : s.filter(function(e) { return e.id === i.id })[0] || null } }; i.activeGroup = m; var g = { AUDIO: function(e, t) { return function() { var i = t.mediaTypes[e].tracks; for (var r in i) if (i[r].enabled) return i[r]; return null } }, SUBTITLES: function(e, t) { return function() { var i = t.mediaTypes[e].tracks; for (var r in i) if ("showing" === i[r].mode) return i[r]; return null } } }; i.activeTrack = g; i.setupMediaGroups = function(e) { ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) { p[t](t, e) }); var t = e.mediaTypes, i = e.masterPlaylistLoader, r = e.tech, n = e.hls; ["AUDIO", "SUBTITLES"].forEach(function(i) { t[i].activeGroup = m(i, e), t[i].activeTrack = g[i](i, e), t[i].onGroupChanged = d(i, e), t[i].onTrackChanged = c(i, e) }); var a = t.AUDIO.activeGroup(), s = (a.filter(function(e) { return e.default })[0] || a[0]).id; t.AUDIO.tracks[s].enabled = !0, t.AUDIO.onTrackChanged(), i.on("mediachange", function() { ["AUDIO", "SUBTITLES"].forEach(function(e) { return t[e].onGroupChanged() }) }); var o = function() { t.AUDIO.onTrackChanged(), r.trigger({ type: "usage", name: "hls-audio-change" }) }; for (var u in r.audioTracks().addEventListener("change", o), r.remoteTextTracks() .addEventListener("change", t.SUBTITLES.onTrackChanged), n.on("dispose", function() { r.audioTracks().removeEventListener("change", o), r.remoteTextTracks() .removeEventListener("change", t.SUBTITLES.onTrackChanged) }), r.clearTracks("audio"), t.AUDIO.tracks) r.audioTracks().addTrack(t.AUDIO.tracks[u]) }; i.createMediaTypes = function() { var e = {}; return ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) { e[t] = { groups: {}, tracks: {}, activePlaylistLoader: null, activeGroup: s, activeTrack: s, onGroupChanged: s, onTrackChanged: s } }), e } }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./playlist-loader": 9 }], 7: [function(e, t, i) { (function(t) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = "undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null, a = (r = n) && r.__esModule ? r : { default: r }, s = e("./bin-utils"), o = { FAILURE: 2, TIMEOUT: -101, ABORTED: -102 }; i.REQUEST_ERRORS = o; var u = function(e) { var t, i, r = {}; return e.byterange && (r.Range = (t = e.byterange, i = t.offset + t.length - 1, "bytes=" + t .offset + "-" + i)), r }, l = function(e) { e.forEach(function(e) { e.abort() }) }, d = function(e, t) { return t.timedout ? { status: t.status, message: "HLS request timed-out at URL: " + t.uri, code: o.TIMEOUT, xhr: t } : t.aborted ? { status: t.status, message: "HLS request aborted at URL: " + t.uri, code: o.ABORTED, xhr: t } : e ? { status: t.status, message: "HLS request errored at URL: " + t.uri, code: o.FAILURE, xhr: t } : null }, c = function(e, t, i) { var r = [], n = 0; return function(a, o) { if (a && (l(e), r.push(a)), (n += 1) === e.length) { if (o.endOfAllRequests = Date.now(), r.length > 0) { var u = function(e) { return e.reduce(function(e, t) { return t.code > e.code ? t : e }) }(r); return i(u, o) } return o.encryptedBytes ? function(e, t, i) { e.addEventListener("message", function r(n) { if (n.data.source === t.requestId) { e.removeEventListener("message", r); var a = n.data.decrypted; return t.bytes = new Uint8Array(a.bytes, a.byteOffset, a.byteLength), i(null, t) } }), e.postMessage((0, s.createTransferableMessage)({ source: t.requestId, encrypted: t.encryptedBytes, key: t.key.bytes, iv: t.key.iv }), [t.encryptedBytes.buffer, t.key.bytes.buffer]) }(t, o, i) : i(null, o) } } }, h = function(e, t) { return function(i) { var r, n, s; return e.stats = a.default.mergeOptions(e.stats, (n = (r = i).target, (s = { bandwidth: 1 / 0, bytesReceived: 0, roundTripTime: Date.now() - n.requestTime || 0 }).bytesReceived = r.loaded, s.bandwidth = Math.floor(s.bytesReceived / s .roundTripTime * 8 * 1e3), s)), !e.stats.firstBytesReceivedAt && e.stats .bytesReceived && (e.stats.firstBytesReceivedAt = Date.now()), t(i, e) } }; i.mediaSegmentRequest = function(e, t, i, r, n, s) { var f = [], p = c(f, i, s); if (r.key) { var m = e(a.default.mergeOptions(t, { uri: r.key.resolvedUri, responseType: "arraybuffer" }), function(e, t) { return function(i, r) { var n = r.response, a = d(i, r); if (a) return t(a, e); if (16 !== n.byteLength) return t({ status: r.status, message: "Invalid HLS key at URL: " + r.uri, code: o.FAILURE, xhr: r }, e); var s = new DataView(n); return e.key.bytes = new Uint32Array([s.getUint32(0), s.getUint32(4), s.getUint32( 8), s.getUint32(12) ]), t(null, e) } }(r, p)); f.push(m) } if (r.map && !r.map.bytes) { var g = e(a.default.mergeOptions(t, { uri: r.map.resolvedUri, responseType: "arraybuffer", headers: u(r.map) }), function(e, t) { return function(i, r) { var n = r.response, a = d(i, r); return a ? t(a, e) : 0 === n.byteLength ? t({ status: r.status, message: "Empty HLS segment content at URL: " + r.uri, code: o.FAILURE, xhr: r }, e) : (e.map.bytes = new Uint8Array(r.response), t(null, e)) } }(r, p)); f.push(g) } var v = e(a.default.mergeOptions(t, { uri: r.resolvedUri, responseType: "arraybuffer", headers: u(r) }), function(e, t) { return function(i, r) { var n = r.response, a = d(i, r); return a ? t(a, e) : 0 === n.byteLength ? t({ status: r.status, message: "Empty HLS segment content at URL: " + r.uri, code: o.FAILURE, xhr: r }, e) : (e.stats = function(e) { return { bandwidth: e.bandwidth, bytesReceived: e.bytesReceived || 0, roundTripTime: e.roundTripTime || 0 } }(r), e.key ? e.encryptedBytes = new Uint8Array(r.response) : e.bytes = new Uint8Array(r.response), t(null, e)) } }(r, p)); return v.addEventListener("progress", h(r, n)), f.push(v), function() { return l(f) } } }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./bin-utils": 2 }], 8: [function(e, t, i) { (function(r) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var n = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); function a(e) { return e && e.__esModule ? e : { default: e } } var s = a(e("global/window")), o = a(e("./ranges")), u = a("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null), l = ["seeking", "seeked", "pause", "playing", "error"], d = function() { function e(t) { var i = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.tech_ = t.tech, this.seekable = t.seekable, this.consecutiveUpdates = 0, this .lastRecordedTime = null, this.timer_ = null, this.checkCurrentTimeTimeout_ = null, t .debug && (this.logger_ = u.default.log.bind(u.default, "playback-watcher ->")), this .logger_("initialize"); var r = function() { return i.monitorCurrentTime_() }, n = function() { return i.techWaiting_() }, a = function() { return i.cancelTimer_() }, o = function() { return i.fixesBadSeeks_() }; this.tech_.on("seekablechanged", o), this.tech_.on("waiting", n), this.tech_.on(l, a), this .tech_.on("canplay", r), this.dispose = function() { i.logger_("dispose"), i.tech_.off("seekablechanged", o), i.tech_.off("waiting", n), i .tech_.off(l, a), i.tech_.off("canplay", r), i.checkCurrentTimeTimeout_ && s.default .clearTimeout(i.checkCurrentTimeTimeout_), i.cancelTimer_() } } return n(e, [{ key: "monitorCurrentTime_", value: function() { this.checkCurrentTime_(), this.checkCurrentTimeTimeout_ && s.default.clearTimeout( this.checkCurrentTimeTimeout_), this.checkCurrentTimeTimeout_ = s.default .setTimeout(this.monitorCurrentTime_.bind(this), 250) } }, { key: "checkCurrentTime_", value: function() { if (this.tech_.seeking() && this.fixesBadSeeks_()) return this.consecutiveUpdates = 0, void(this.lastRecordedTime = this.tech_.currentTime()); if (!this.tech_.paused() && !this.tech_.seeking()) { var e = this.tech_.currentTime(), t = this.tech_.buffered(); if (this.lastRecordedTime === e && (!t.length || e + o.default.SAFE_TIME_DELTA >= t.end(t.length - 1))) return this.techWaiting_(); this.consecutiveUpdates >= 5 && e === this.lastRecordedTime ? (this .consecutiveUpdates++, this.waiting_()) : e === this.lastRecordedTime ? this .consecutiveUpdates++ : (this.consecutiveUpdates = 0, this.lastRecordedTime = e) } } }, { key: "cancelTimer_", value: function() { this.consecutiveUpdates = 0, this.timer_ && (this.logger_("cancelTimer_"), clearTimeout(this.timer_)), this.timer_ = null } }, { key: "fixesBadSeeks_", value: function() { var e = this.tech_.seeking(), t = this.seekable(), i = this.tech_.currentTime(), r = void 0; e && this.afterSeekableWindow_(t, i) && (r = t.end(t.length - 1)); e && this.beforeSeekableWindow_(t, i) && (r = t.start(0) + o.default .SAFE_TIME_DELTA); return void 0 !== r && (this.logger_("Trying to seek outside of seekable at time " + i + " with seekable range " + o.default.printableRange(t) + ". Seeking to " + r + "."), this.tech_.setCurrentTime(r), !0) } }, { key: "waiting_", value: function() { if (!this.techWaiting_()) { var e = this.tech_.currentTime(), t = this.tech_.buffered(), i = o.default.findRange(t, e); return i.length && e + 3 <= i.end(0) ? (this.cancelTimer_(), this.tech_ .setCurrentTime(e), this.logger_("Stopped at " + e + " while inside a buffered region [" + i.start(0) + " -> " + i.end(0) + "]. Attempting to resume playback by seeking to the current time."), void this.tech_.trigger({ type: "usage", name: "hls-unknown-waiting" })) : void 0 } } }, { key: "techWaiting_", value: function() { var e = this.seekable(), t = this.tech_.currentTime(); if (this.tech_.seeking() && this.fixesBadSeeks_()) return !0; if (this.tech_.seeking() || null !== this.timer_) return !0; if (this.beforeSeekableWindow_(e, t)) { var i = e.end(e.length - 1); return this.logger_("Fell out of live window at time " + t + ". Seeking to live point (seekable end) " + i), this.cancelTimer_(), this .tech_.setCurrentTime(i), this.tech_.trigger({ type: "usage", name: "hls-live-resync" }), !0 } var r = this.tech_.buffered(), n = o.default.findNextRange(r, t); if (this.videoUnderflow_(n, r, t)) return this.cancelTimer_(), this.tech_ .setCurrentTime(t), this.tech_.trigger({ type: "usage", name: "hls-video-underflow" }), !0; if (n.length > 0) { var a = n.start(0) - t; return this.logger_("Stopped at " + t + ", setting timer for " + a + ", seeking to " + n.start(0)), this.timer_ = setTimeout(this.skipTheGap_.bind( this), 1e3 * a, t), !0 } return !1 } }, { key: "afterSeekableWindow_", value: function(e, t) { return !!e.length && t > e.end(e.length - 1) + o.default.SAFE_TIME_DELTA } }, { key: "beforeSeekableWindow_", value: function(e, t) { return !!(e.length && e.start(0) > 0 && t < e.start(0) - o.default.SAFE_TIME_DELTA) } }, { key: "videoUnderflow_", value: function(e, t, i) { if (0 === e.length) { var r = this.gapFromVideoUnderflow_(t, i); if (r) return this.logger_("Encountered a gap in video from " + r.start + " to " + r.end + ". Seeking to current time " + i), !0 } return !1 } }, { key: "skipTheGap_", value: function(e) { var t = this.tech_.buffered(), i = this.tech_.currentTime(), r = o.default.findNextRange(t, i); this.cancelTimer_(), 0 !== r.length && i === e && (this.logger_("skipTheGap_:", "currentTime:", i, "scheduled currentTime:", e, "nextRange start:", r.start(0) ), this.tech_.setCurrentTime(r.start(0) + o.default.TIME_FUDGE_FACTOR), this .tech_.trigger({ type: "usage", name: "hls-gap-skip" })) } }, { key: "gapFromVideoUnderflow_", value: function(e, t) { for (var i = o.default.findGaps(e), r = 0; r < i.length; r++) { var n = i.start(r), a = i.end(r); if (t - n < 4 && t - n > 2) return { start: n, end: a } } return null } }, { key: "logger_", value: function() {} }]), e }(); i.default = d, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./ranges": 12, "global/window": 32 }], 9: [function(e, t, i) { (function(t) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function a(e) { return e && e.__esModule ? e : { default: e } } var s = a(e("./resolve-url")), o = "undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null, u = a(e("m3u8-parser")), l = a(e("global/window")), d = function(e, t, i) { var r = t.slice(); i = i || 0; for (var n = Math.min(e.length, t.length + i), a = i; a < n; a++) r[a - i] = (0, o.mergeOptions) (e[a], r[a - i]); return r }; i.updateSegments = d; var c = function(e, t) { e.resolvedUri || (e.resolvedUri = (0, s.default)(t, e.uri)), e.key && !e.key.resolvedUri && (e .key.resolvedUri = (0, s.default)(t, e.key.uri)), e.map && !e.map.resolvedUri && (e.map .resolvedUri = (0, s.default)(t, e.map.uri)) }; i.resolveSegmentUris = c; var h = function(e, t) { var i = (0, o.mergeOptions)(e, {}), r = i.playlists.filter(function(e) { return e.uri === t.uri })[0]; if (!r) return null; if (r.segments && t.segments && r.segments.length === t.segments.length && r.mediaSequence === t .mediaSequence) return null; var n = (0, o.mergeOptions)(r, t); r.segments && (n.segments = d(r.segments, t.segments, t.mediaSequence - r.mediaSequence)), n .segments.forEach(function(e) { c(e, n.resolvedUri) }); for (var a = 0; a < i.playlists.length; a++) i.playlists[a].uri === t.uri && (i.playlists[a] = n); return i.playlists[t.uri] = n, i }; i.updateMaster = h; var f = function(e) { for (var t = e.playlists.length; t--;) { var i = e.playlists[t]; e.playlists[i.uri] = i, i.resolvedUri = (0, s.default)(e.uri, i.uri), i.attributes || (i .attributes = {}, o.log.warn( "Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")) } }; i.setupMediaPlaylists = f; var p = function(e) { ["AUDIO", "SUBTITLES"].forEach(function(t) { for (var i in e.mediaGroups[t]) for (var r in e.mediaGroups[t][i]) { var n = e.mediaGroups[t][i][r]; n.uri && (n.resolvedUri = (0, s.default)(e.uri, n.uri)) } }) }; i.resolveMediaGroupUris = p; var m = function(e, t) { var i = e.segments[e.segments.length - 1]; return t && i && i.duration ? 1e3 * i.duration : 500 * (e.targetDuration || 10) }; i.refreshDelay = m; var g = function(e) { function t(e, i, r) { var a = this; if (function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), r = r || {}, this.srcUrl = e, this.hls_ = i, this.withCredentials = !!r.withCredentials, this .handleManifestRedirects = !!r.handleManifestRedirects, !this.srcUrl) throw new Error( "A non-empty playlist URL is required"); this.state = "HAVE_NOTHING", this.on("mediaupdatetimeout", function() { "HAVE_METADATA" === a.state && (a.state = "HAVE_CURRENT_METADATA", a.request = a.hls_ .xhr({ uri: (0, s.default)(a.master.uri, a.media().uri), withCredentials: a.withCredentials }, function(e, t) { if (a.request) return e ? a.playlistRequestError(a.request, a.media().uri, "HAVE_METADATA") : void a.haveMetadata(a.request, a.media().uri) })) }) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, o.EventTarget), r(t, [{ key: "playlistRequestError", value: function(e, t, i) { this.request = null, i && (this.state = i), this.error = { playlist: this.master.playlists[t], status: e.status, message: "HLS playlist request error at URL: " + t, responseText: e.responseText, code: e.status >= 500 ? 4 : 2 }, this.trigger("error") } }, { key: "haveMetadata", value: function(e, t) { var i = this; this.request = null, this.state = "HAVE_METADATA"; var r = new u.default.Parser; r.push(e.responseText), r.end(), r.manifest.uri = t, r.manifest.attributes = r .manifest.attributes || {}; var n = h(this.master, r.manifest); this.targetDuration = r.manifest.targetDuration, n ? (this.master = n, this.media_ = this.master.playlists[r.manifest.uri]) : this.trigger("playlistunchanged"), this .media().endList || (l.default.clearTimeout(this.mediaUpdateTimeout), this .mediaUpdateTimeout = l.default.setTimeout(function() { i.trigger("mediaupdatetimeout") }, m(this.media(), !!n))), this.trigger("loadedplaylist") } }, { key: "dispose", value: function() { this.stopRequest(), l.default.clearTimeout(this.mediaUpdateTimeout) } }, { key: "stopRequest", value: function() { if (this.request) { var e = this.request; this.request = null, e.onreadystatechange = null, e.abort() } } }, { key: "media", value: function(e) { var t = this; if (!e) return this.media_; if ("HAVE_NOTHING" === this.state) throw new Error( "Cannot switch media playlist from " + this.state); var i = this.state; if ("string" == typeof e) { if (!this.master.playlists[e]) throw new Error("Unknown playlist URI: " + e); e = this.master.playlists[e] } var r = !this.media_ || e.uri !== this.media_.uri; if (this.master.playlists[e.uri].endList) return this.request && (this.request .onreadystatechange = null, this.request.abort(), this.request = null), this .state = "HAVE_METADATA", this.media_ = e, void(r && (this.trigger( "mediachanging"), this.trigger("mediachange"))); if (r) { if (this.state = "SWITCHING_MEDIA", this.request) { if (e.resolvedUri === this.request.url) return; this.request.onreadystatechange = null, this.request.abort(), this.request = null } this.media_ && this.trigger("mediachanging"), this.request = this.hls_.xhr({ uri: e.resolvedUri, withCredentials: this.withCredentials }, function(r, n) { if (t.request) { if (e.resolvedUri = t.resolveManifestRedirect(e.resolvedUri, n), r) return t.playlistRequestError(t.request, e.uri, i); t.haveMetadata(n, e.uri), "HAVE_MASTER" === i ? t.trigger( "loadedmetadata") : t.trigger("mediachange") } }) } } }, { key: "resolveManifestRedirect", value: function(e, t) { return this.handleManifestRedirects && t.responseURL && e !== t.responseURL ? t .responseURL : e } }, { key: "pause", value: function() { this.stopRequest(), l.default.clearTimeout(this.mediaUpdateTimeout), "HAVE_NOTHING" === this.state && (this.started = !1), "SWITCHING_MEDIA" === this .state ? this.media_ ? this.state = "HAVE_METADATA" : this.state = "HAVE_MASTER" : "HAVE_CURRENT_METADATA" === this.state && (this.state = "HAVE_METADATA") } }, { key: "load", value: function(e) { var t = this; l.default.clearTimeout(this.mediaUpdateTimeout); var i = this.media(); if (e) { var r = i ? i.targetDuration / 2 * 1e3 : 5e3; this.mediaUpdateTimeout = l.default.setTimeout(function() { return t.load() }, r) } else this.started ? i && !i.endList ? this.trigger("mediaupdatetimeout") : this .trigger("loadedplaylist") : this.start() } }, { key: "start", value: function() { var e = this; this.started = !0, this.request = this.hls_.xhr({ uri: this.srcUrl, withCredentials: this.withCredentials }, function(t, i) { if (e.request) { if (e.request = null, t) return e.error = { status: i.status, message: "HLS playlist request error at URL: " + e.srcUrl, responseText: i.responseText, code: 2 }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error"); var r = new u.default.Parser; return r.push(i.responseText), r.end(), e.state = "HAVE_MASTER", e.srcUrl = e.resolveManifestRedirect(e.srcUrl, i), r.manifest.uri = e.srcUrl, r .manifest.playlists ? (e.master = r.manifest, f(e.master), p(e.master), e .trigger("loadedplaylist"), void(e.request || e.media(r.manifest .playlists[0]))) : (e.master = { mediaGroups: { AUDIO: {}, VIDEO: {}, "CLOSED-CAPTIONS": {}, SUBTITLES: {} }, uri: l.default.location.href, playlists: [{ uri: e.srcUrl, resolvedUri: e.srcUrl, attributes: {} }] }, e.master.playlists[e.srcUrl] = e.master.playlists[0], e.haveMetadata( i, e.srcUrl), e.trigger("loadedmetadata")) } }) } }]), t }(); i.default = g }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./resolve-url": 15, "global/window": 32, "m3u8-parser": 33 }], 10: [function(e, t, i) { "use strict"; function r(e) { return e && e.__esModule ? e : { default: e } } Object.defineProperty(i, "__esModule", { value: !0 }); var n = r(e("./config")), a = r(e("./playlist")), s = e("./util/codecs.js"), o = function(e, t) { var i; return e && (i = window.getComputedStyle(e)) ? i[t] : "" }, u = function(e, t) { var i = e.slice(); e.sort(function(e, r) { var n = t(e, r); return 0 === n ? i.indexOf(e) - i.indexOf(r) : n }) }, l = function(e, t) { var i = void 0, r = void 0; return e.attributes.BANDWIDTH && (i = e.attributes.BANDWIDTH), i = i || window.Number.MAX_VALUE, t .attributes.BANDWIDTH && (r = t.attributes.BANDWIDTH), i - (r = r || window.Number.MAX_VALUE) }; i.comparePlaylistBandwidth = l; i.comparePlaylistResolution = function(e, t) { var i = void 0, r = void 0; return e.attributes.RESOLUTION && e.attributes.RESOLUTION.width && (i = e.attributes.RESOLUTION .width), i = i || window.Number.MAX_VALUE, t.attributes.RESOLUTION && t.attributes.RESOLUTION .width && (r = t.attributes.RESOLUTION.width), i === (r = r || window.Number.MAX_VALUE) && e .attributes.BANDWIDTH && t.attributes.BANDWIDTH ? e.attributes.BANDWIDTH - t.attributes .BANDWIDTH : i - r }; var d = function(e, t, i, r) { var s = e.playlists.map(function(e) { var t, i; return t = e.attributes.RESOLUTION && e.attributes.RESOLUTION.width, i = e.attributes .RESOLUTION && e.attributes.RESOLUTION.height, { bandwidth: e.attributes.BANDWIDTH || window.Number.MAX_VALUE, width: t, height: i, playlist: e } }); u(s, function(e, t) { return e.bandwidth - t.bandwidth }); var o = (s = s.filter(function(e) { return !a.default.isIncompatible(e.playlist) })).filter(function(e) { return a.default.isEnabled(e.playlist) }); o.length || (o = s.filter(function(e) { return !a.default.isDisabled(e.playlist) })); var l = o.filter(function(e) { return e.bandwidth * n.default.BANDWIDTH_VARIANCE < t }), d = l[l.length - 1], c = l.filter(function(e) { return e.bandwidth === d.bandwidth })[0], h = l.filter(function(e) { return e.width && e.height }); u(h, function(e, t) { return e.width - t.width }); var f = h.filter(function(e) { return e.width === i && e.height === r }); d = f[f.length - 1]; var p = f.filter(function(e) { return e.bandwidth === d.bandwidth })[0], m = void 0, g = void 0, v = void 0; p || (g = (m = h.filter(function(e) { return e.width > i || e.height > r })).filter(function(e) { return e.width === m[0].width && e.height === m[0].height }), d = g[g.length - 1], v = g.filter(function(e) { return e.bandwidth === d.bandwidth })[0]); var y = v || p || c || o[0] || s[0]; return y ? y.playlist : null }; i.simpleSelector = d; i.lastBandwidthSelector = function() { return d(this.playlists.master, this.systemBandwidth, parseInt(o(this.tech_.el(), "width"), 10), parseInt(o(this.tech_.el(), "height"), 10)) }; i.movingAverageBandwidthSelector = function(e) { var t = -1; if (e < 0 || e > 1) throw new Error("Moving average bandwidth decay must be between 0 and 1."); return function() { return t < 0 && (t = this.systemBandwidth), t = e * this.systemBandwidth + (1 - e) * t, d(this .playlists.master, t, parseInt(o(this.tech_.el(), "width"), 10), parseInt(o(this.tech_.el(), "height"), 10)) } }; i.minRebufferMaxBandwidthSelector = function(e) { var t = e.master, i = e.currentTime, r = e.bandwidth, n = e.duration, s = e.segmentDuration, o = e.timeUntilRebuffer, d = e.currentTimeline, c = e.syncController, h = t.playlists.filter(function(e) { return !a.default.isIncompatible(e) }), f = h.filter(a.default.isEnabled); f.length || (f = h.filter(function(e) { return !a.default.isDisabled(e) })); var p = f.filter(a.default.hasAttribute.bind(null, "BANDWIDTH")).map(function(e) { var t = c.getSyncPoint(e, n, d, i) ? 1 : 2; return { playlist: e, rebufferingImpact: a.default.estimateSegmentRequestTime(s, r, e) * t - o } }), m = p.filter(function(e) { return e.rebufferingImpact <= 0 }); return u(m, function(e, t) { return l(t.playlist, e.playlist) }), m.length ? m[0] : (u(p, function(e, t) { return e.rebufferingImpact - t.rebufferingImpact }), p[0] || null) }; i.lowestBitrateCompatibleVariantSelector = function() { var e = this.playlists.master.playlists.filter(a.default.isEnabled); return u(e, function(e, t) { return l(e, t) }), e.filter(function(e) { return (0, s.parseCodecs)(e.attributes.CODECS).videoCodec })[0] || null } }, { "./config": 3, "./playlist": 11, "./util/codecs.js": 19 }], 11: [function(e, t, i) { (function(t) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = "undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null, a = e("global/window"), s = (r = a) && r.__esModule ? r : { default: r }, o = function(e, t, i) { var r, n; return void 0 === t && (t = e.mediaSequence + e.segments.length), t < e.mediaSequence ? 0 : (r = function(e, t) { var i = 0, r = t - e.mediaSequence, n = e.segments[r]; if (n) { if (void 0 !== n.start) return { result: n.start, precise: !0 }; if (void 0 !== n.end) return { result: n.end - n.duration, precise: !0 } } for (; r--;) { if (void 0 !== (n = e.segments[r]).end) return { result: i + n.end, precise: !0 }; if (i += n.duration, void 0 !== n.start) return { result: i + n.start, precise: !0 } } return { result: i, precise: !1 } }(e, t)).precise ? r.result : (n = function(e, t) { for (var i = 0, r = void 0, n = t - e.mediaSequence; n < e.segments.length; n++) { if (void 0 !== (r = e.segments[n]).start) return { result: r.start - i, precise: !0 }; if (i += r.duration, void 0 !== r.end) return { result: r.end - i, precise: !0 } } return { result: -1, precise: !1 } }(e, t)).precise ? n.result : r.result + i }, u = function(e, t, i) { if (!e) return 0; if ("number" != typeof i && (i = 0), void 0 === t) { if (e.totalDuration) return e.totalDuration; if (!e.endList) return s.default.Infinity } return o(e, t, i) }; i.duration = u; var l = function(e, t, i) { var r = 0; if (t > i) { var n = [i, t]; t = n[0], i = n[1] } if (t < 0) { for (var a = t; a < Math.min(0, i); a++) r += e.targetDuration; t = 0 } for (a = t; a < i; a++) r += e.segments[a].duration; return r }; i.sumDurations = l; var d = function(e) { if (!e.segments.length) return 0; for (var t = e.segments.length - 1, i = e.segments[t].duration || e.targetDuration, r = i + 2 * e.targetDuration; t-- && !((i += e.segments[t].duration) >= r);); return Math.max(0, t) }; i.safeLiveIndex = d; var c = function(e, t, i) { if (!e || !e.segments) return null; if (e.endList) return u(e); if (null === t) return null; t = t || 0; var r = i ? d(e) : e.segments.length; return o(e, e.mediaSequence + r, t) }; i.playlistEnd = c; var h = function(e, t) { var i = t || 0, r = c(e, t, !0); return null === r ? (0, n.createTimeRange)() : (0, n.createTimeRange)(i, r) }; i.seekable = h; var f = function(e) { return e - Math.floor(e) == 0 }, p = function(e, t) { if (f(t)) return t + .1 * e; for (var i = t.toString().split(".")[1].length, r = 1; r <= i; r++) { var n = Math.pow(10, r), a = t * n; if (f(a) || r === i) return (a + e) / n } }, m = p.bind(null, 1), g = p.bind(null, -1), v = function(e, t, i, r) { var n = void 0, a = void 0, s = e.segments.length, o = t - r; if (o < 0) { if (i > 0) for (n = i - 1; n >= 0; n--) if (a = e.segments[n], (o += g(a.duration)) > 0) return { mediaIndex: n, startTime: r - l(e, i, n) }; return { mediaIndex: 0, startTime: t } } if (i < 0) { for (n = i; n < 0; n++) if ((o -= e.targetDuration) < 0) return { mediaIndex: 0, startTime: t }; i = 0 } for (n = i; n < s; n++) if (a = e.segments[n], (o -= m(a.duration)) < 0) return { mediaIndex: n, startTime: r + l(e, i, n) }; return { mediaIndex: s - 1, startTime: t } }; i.getMediaInfoForTime = v; var y = function(e) { return e.excludeUntil && e.excludeUntil > Date.now() }; i.isBlacklisted = y; var _ = function(e) { return e.excludeUntil && e.excludeUntil === 1 / 0 }; i.isIncompatible = _; var b = function(e) { var t = y(e); return !e.disabled && !t }; i.isEnabled = b; var w = function(e) { return e.disabled }; i.isDisabled = w; var E = function(e) { for (var t = 0; t < e.segments.length; t++) if (e.segments[t].key) return !0; return !1 }; i.isAes = E; var T = function(e) { for (var t = 0; t < e.segments.length; t++) if (e.segments[t].map) return !0; return !1 }; i.isFmp4 = T; var S = function(e, t) { return t.attributes && t.attributes[e] }; i.hasAttribute = S; var A = function(e, t, i) { var r = arguments.length <= 3 || void 0 === arguments[3] ? 0 : arguments[3]; return S("BANDWIDTH", i) ? (e * i.attributes.BANDWIDTH - 8 * r) / t : NaN }; i.estimateSegmentRequestTime = A; var k = function(e, t) { if (1 === e.playlists.length) return !0; var i = t.attributes.BANDWIDTH || Number.MAX_VALUE; return 0 === e.playlists.filter(function(e) { return !!b(e) && (e.attributes.BANDWIDTH || 0) < i }).length }; i.isLowestEnabledRendition = k, i.default = { duration: u, seekable: h, safeLiveIndex: d, getMediaInfoForTime: v, isEnabled: b, isDisabled: w, isBlacklisted: y, isIncompatible: _, playlistEnd: c, isAes: E, isFmp4: T, hasAttribute: S, estimateSegmentRequestTime: A, isLowestEnabledRendition: k } }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "global/window": 32 }], 12: [function(e, t, i) { (function(e) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { return function(e, t) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return function(e, t) { var i = [], r = !0, n = !1, a = void 0; try { for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s .value), !t || i.length !== t); r = !0); } catch (e) { n = !0, a = e } finally { try { !r && o.return && o.return() } finally { if (n) throw a } } return i }(e, t); throw new TypeError("Invalid attempt to destructure non-iterable instance") } }(); var n, a = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null, s = (n = a) && n.__esModule ? n : { default: n }, o = function(e, t) { var i = [], r = void 0; if (e && e.length) for (r = 0; r < e.length; r++) t(e.start(r), e.end(r)) && i.push([e.start(r), e.end(r)]); return s.default.createTimeRanges(i) }, u = function(e, t) { var i = null, r = null, n = 0, a = [], o = []; if (!(e && e.length && t && t.length)) return s.default.createTimeRange(); for (var u = e.length; u--;) a.push({ time: e.start(u), type: "start" }), a.push({ time: e.end(u), type: "end" }); for (u = t.length; u--;) a.push({ time: t.start(u), type: "start" }), a.push({ time: t.end(u), type: "end" }); for (a.sort(function(e, t) { return e.time - t.time }), u = 0; u < a.length; u++) "start" === a[u].type ? 2 === ++n && (i = a[u].time) : "end" === a[u].type && 1 === --n && (r = a[u].time), null !== i && null !== r && (o.push([i, r]), i = null, r = null); return s.default.createTimeRanges(o) }; i.default = { findRange: function(e, t) { return o(e, function(e, i) { return e - 1 / 30 <= t && i + 1 / 30 >= t }) }, findNextRange: function(e, t) { return o(e, function(e) { return e - 1 / 30 >= t }) }, findGaps: function(e) { if (e.length < 2) return s.default.createTimeRanges(); for (var t = [], i = 1; i < e.length; i++) { var r = e.end(i - 1), n = e.start(i); t.push([r, n]) } return s.default.createTimeRanges(t) }, findSoleUncommonTimeRangesEnd: function(e, t) { var i = void 0, r = void 0, n = void 0, a = [], s = [], o = function(e) { return e[0] <= n && e[1] >= n }; if (e) for (i = 0; i < e.length; i++) r = e.start(i), n = e.end(i), s.push([r, n]); if (t) for (i = 0; i < t.length; i++) r = t.start(i), n = t.end(i), s.some(o) || a.push(n); return 1 !== a.length ? null : a[0] }, getSegmentBufferedPercent: function(e, t, i, n) { var a, o, l, d, c, h = e + t, f = s.default.createTimeRanges([ [e, h] ]), p = s.default.createTimeRanges([ [(a = e, o = [i, h], l = r(o, 2), d = l[0], c = l[1], Math.min(Math.max(d, a), c)), h] ]); if (p.start(0) === p.end(0)) return 0; var m = function(e, t, i, r) { for (var n = t.end(0) - t.start(0), a = n - (e.end(0) - e.start(0)), s = u(e, r), o = u( t, r), l = 0, d = 0, c = s.length; c--;) l += s.end(c) - s.start(c), s.start(c) === i && (l += a); for (c = o.length; c--;) d += o.end(c) - o.start(c); return Math.max(l, d) / n * 100 }(p, f, i, n); return isNaN(m) || m === 1 / 0 || m === -1 / 0 ? 0 : m }, TIME_FUDGE_FACTOR: 1 / 30, SAFE_TIME_DELTA: .1, printableRange: function(e) { var t = []; if (!e || !e.length) return ""; for (var i = 0; i < e.length; i++) t.push(e.start(i) + " => " + e.end(i)); return t.join(", ") }, timeUntilRebuffer: function(e, t) { var i = arguments.length <= 2 || void 0 === arguments[2] ? 1 : arguments[2]; return ((e.length ? e.end(e.length - 1) : 0) - t) / i } }, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}], 13: [function(e, t, i) { (function(e) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null, a = (r = n) && r.__esModule ? r : { default: r }, s = { errorInterval: 30, getSource: function(e) { return e(this.tech({ IWillNotUseThisInPlugins: !0 }).currentSource_) } }; i.default = function(e) { ! function e(t, i) { var r = 0, n = 0, o = a.default.mergeOptions(s, i); t.ready(function() { t.trigger({ type: "usage", name: "hls-error-reload-initialized" }) }); var u = function() { n && t.currentTime(n) }, l = function(e) { null !== e && void 0 !== e && (n = t.duration() !== 1 / 0 && t.currentTime() || 0, t.one( "loadedmetadata", u), t.src(e), t.trigger({ type: "usage", name: "hls-error-reload" }), t.play()) }, d = function() { if (Date.now() - r < 1e3 * o.errorInterval) t.trigger({ type: "usage", name: "hls-error-reload-canceled" }); else { if (o.getSource && "function" == typeof o.getSource) return r = Date.now(), o.getSource .call(t, l); a.default.log.error( "ERROR: reloadSourceOnError - The option getSource must be a function!") } }, c = function e() { t.off("loadedmetadata", u), t.off("error", d), t.off("dispose", e) }; t.on("error", d), t.on("dispose", c), t.reloadSourceOnError = function(i) { c(), e(t, i) } }(this, e) }, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}], 14: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = e("./playlist.js"), n = function e(t, i, n) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e); var a, s, o, u = t.masterPlaylistController_.fastQualityChange_.bind(t.masterPlaylistController_); if (i.attributes.RESOLUTION) { var l = i.attributes.RESOLUTION; this.width = l.width, this.height = l.height } this.bandwidth = i.attributes.BANDWIDTH, this.id = n, this.enabled = (a = t.playlists, s = i.uri, o = u, function(e) { var t = a.master.playlists[s], i = (0, r.isIncompatible)(t), n = (0, r.isEnabled)(t); return void 0 === e ? n : (e ? delete t.disabled : t.disabled = !0, e === n || i || (o(), e ? a.trigger("renditionenabled") : a.trigger("renditiondisabled")), e) }) }; i.default = function(e) { var t = e.playlists; e.representations = function() { return t.master.playlists.filter(function(e) { return !(0, r.isIncompatible)(e) }).map(function(t, i) { return new n(e, t, t.uri) }) } }, t.exports = i.default }, { "./playlist.js": 11 }], 15: [function(e, t, i) { "use strict"; function r(e) { return e && e.__esModule ? e : { default: e } } Object.defineProperty(i, "__esModule", { value: !0 }); var n = r(e("url-toolkit")), a = r(e("global/window")); i.default = function(e, t) { return /^[a-z]+:/i.test(t) ? t : (/\/\//i.test(e) || (e = n.default.buildAbsoluteURL(a.default .location.href, e)), n.default.buildAbsoluteURL(e, t)) }, t.exports = i.default }, { "global/window": 32, "url-toolkit": 63 }], 16: [function(e, t, i) { (function(t) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function a(e) { return e && e.__esModule ? e : { default: e } } var s = a(e("./playlist")), o = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null), u = a(e("./source-updater")), l = a(e("./config")), d = a(e("global/window")), c = a(e("videojs-contrib-media-sources/es5/remove-cues-from-track.js")), h = e("./bin-utils"), f = e("./media-segment-request"), p = e("./ranges"), m = e("./playlist-selectors"), g = function(e, t, i) { if (!e || !t) return !1; var r = i === e.segments.length; return e.endList && "open" === t.readyState && r }, v = function(e) { return "number" == typeof e && isFinite(e) }, y = function(e, t, i) { return "main" === e && t && i ? i.containsAudio || i.containsVideo ? t.containsVideo && !i .containsVideo ? "Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest." : !t.containsVideo && i.containsVideo ? "Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest." : null : "Neither audio nor video found in segment." : null }; i.illegalMediaSwitch = y; var _ = function(e, t, i) { var r = void 0; return r = e.length && e.start(0) > 0 && e.start(0) < t ? e.start(0) : t - 30, Math.min(r, t - i) }; i.safeBackBufferTrimTime = _; var b = function(e) { function t(e) { var i = this, r = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; if (function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), !e) throw new TypeError("Initialization settings are required"); if ("function" != typeof e.currentTime) throw new TypeError( "No currentTime getter specified"); if (!e.mediaSource) throw new TypeError("No MediaSource specified"); this.state = "INIT", this.bandwidth = e.bandwidth, this.throughput = { rate: 0, count: 0 }, this.roundTrip = NaN, this.resetStats_(), this.mediaIndex = null, this.hasPlayed_ = e .hasPlayed, this.currentTime_ = e.currentTime, this.seekable_ = e.seekable, this.seeking_ = e.seeking, this.duration_ = e.duration, this.mediaSource_ = e.mediaSource, this.hls_ = e .hls, this.loaderType_ = e.loaderType, this.startingMedia_ = void 0, this .segmentMetadataTrack_ = e.segmentMetadataTrack, this.goalBufferLength_ = e .goalBufferLength, this.checkBufferTimeout_ = null, this.error_ = void 0, this .currentTimeline_ = -1, this.pendingSegment_ = null, this.mimeType_ = null, this .sourceUpdater_ = null, this.xhrOptions_ = null, this.activeInitSegmentId_ = null, this .initSegments_ = {}, this.decrypter_ = e.decrypter, this.syncController_ = e.syncController, this.syncPoint_ = { segmentIndex: 0, time: 0 }, this.syncController_.on("syncinfoupdate", function() { return i.trigger("syncinfoupdate") }), this.mediaSource_.addEventListener("sourceopen", function() { return i.ended_ = !1 }), this.fetchAtBuffer_ = !1, r.debug && (this.logger_ = o.default.log.bind(o.default, "segment-loader", this.loaderType_, "->")) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, o["default"].EventTarget), r(t, [{ key: "resetStats_", value: function() { this.mediaBytesTransferred = 0, this.mediaRequests = 0, this.mediaRequestsAborted = 0, this.mediaRequestsTimedout = 0, this.mediaRequestsErrored = 0, this .mediaTransferDuration = 0, this.mediaSecondsLoaded = 0 } }, { key: "dispose", value: function() { this.state = "DISPOSED", this.pause(), this.abort_(), this.sourceUpdater_ && this .sourceUpdater_.dispose(), this.resetStats_() } }, { key: "abort", value: function() { "WAITING" === this.state ? (this.abort_(), this.state = "READY", this.paused() || this.monitorBuffer_()) : this.pendingSegment_ && (this.pendingSegment_ = null) } }, { key: "abort_", value: function() { this.pendingSegment_ && this.pendingSegment_.abortRequests(), this.pendingSegment_ = null } }, { key: "error", value: function(e) { return void 0 !== e && (this.error_ = e), this.pendingSegment_ = null, this.error_ } }, { key: "endOfStream", value: function() { this.ended_ = !0, this.pause(), this.trigger("ended") } }, { key: "buffered_", value: function() { return this.sourceUpdater_ ? this.sourceUpdater_.buffered() : o.default .createTimeRanges() } }, { key: "initSegment", value: function(e) { var t = !(arguments.length <= 1 || void 0 === arguments[1]) && arguments[1]; if (!e) return null; var i = (0, h.initSegmentId)(e), r = this.initSegments_[i]; return t && !r && e.bytes && (this.initSegments_[i] = r = { resolvedUri: e.resolvedUri, byterange: e.byterange, bytes: e.bytes }), r || e } }, { key: "couldBeginLoading_", value: function() { return this.playlist_ && (this.sourceUpdater_ || this.mimeType_ && "INIT" === this .state) && !this.paused() } }, { key: "load", value: function() { if (this.monitorBuffer_(), this.playlist_) { if (this.syncController_.setDateTimeMapping(this.playlist_), "INIT" === this .state && this.couldBeginLoading_()) return this.init_(); !this.couldBeginLoading_() || "READY" !== this.state && "INIT" !== this.state || ( this.state = "READY") } } }, { key: "init_", value: function() { return this.state = "READY", this.sourceUpdater_ = new u.default(this.mediaSource_, this.mimeType_), this.resetEverything(), this.monitorBuffer_() } }, { key: "playlist", value: function(e) { var t = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; if (e) { var i = this.playlist_, r = this.pendingSegment_; if (this.playlist_ = e, this.xhrOptions_ = t, this.hasPlayed_() || (e.syncInfo = { mediaSequence: e.mediaSequence, time: 0 }), this.trigger("syncinfoupdate"), "INIT" === this.state && this .couldBeginLoading_()) return this.init_(); if (i && i.uri === e.uri) { var n = e.mediaSequence - i.mediaSequence; this.logger_("mediaSequenceDiff", n), null !== this.mediaIndex && (this .mediaIndex -= n), r && (r.mediaIndex -= n, r.mediaIndex >= 0 && (r .segment = e.segments[r.mediaIndex])), this.syncController_ .saveExpiredSegmentInfo(i, e) } else null !== this.mediaIndex && this.resyncLoader() } } }, { key: "pause", value: function() { this.checkBufferTimeout_ && (d.default.clearTimeout(this.checkBufferTimeout_), this .checkBufferTimeout_ = null) } }, { key: "paused", value: function() { return null === this.checkBufferTimeout_ } }, { key: "mimeType", value: function(e) { this.mimeType_ || (this.mimeType_ = e, "INIT" === this.state && this .couldBeginLoading_() && this.init_()) } }, { key: "resetEverything", value: function() { this.ended_ = !1, this.resetLoader(), this.remove(0, this.duration_()), this .trigger("reseteverything") } }, { key: "resetLoader", value: function() { this.fetchAtBuffer_ = !1, this.resyncLoader() } }, { key: "resyncLoader", value: function() { this.mediaIndex = null, this.syncPoint_ = null, this.abort() } }, { key: "remove", value: function(e, t) { this.sourceUpdater_ && this.sourceUpdater_.remove(e, t), (0, c.default)(e, t, this .segmentMetadataTrack_) } }, { key: "monitorBuffer_", value: function() { this.checkBufferTimeout_ && d.default.clearTimeout(this.checkBufferTimeout_), this .checkBufferTimeout_ = d.default.setTimeout(this.monitorBufferTick_.bind(this), 1) } }, { key: "monitorBufferTick_", value: function() { "READY" === this.state && this.fillBuffer_(), this.checkBufferTimeout_ && d.default .clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = d.default .setTimeout(this.monitorBufferTick_.bind(this), 500) } }, { key: "fillBuffer_", value: function() { if (!this.sourceUpdater_.updating()) { this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this .playlist_, this.duration_(), this.currentTimeline_, this.currentTime_())); var e = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this .hasPlayed_(), this.currentTime_(), this.syncPoint_); if (e) g(this.playlist_, this.mediaSource_, e.mediaIndex) ? this.endOfStream() : ( e.mediaIndex !== this.playlist_.segments.length - 1 || "ended" !== this .mediaSource_.readyState || this.seeking_()) && ((e.timeline !== this .currentTimeline_ || null !== e.startOfSegment && e.startOfSegment < this .sourceUpdater_.timestampOffset()) && (this.syncController_.reset(), e .timestampOffset = e.startOfSegment), this.loadSegment_(e)) } } }, { key: "checkBuffer_", value: function(e, t, i, r, n, a) { var o = 0, u = void 0; e.length && (o = e.end(e.length - 1)); var l, d = Math.max(0, o - n); if (!t.segments.length) return null; if (d >= this.goalBufferLength_()) return null; if (!r && d >= 1) return null; if (this.logger_("checkBuffer_", "mediaIndex:", i, "hasPlayed:", r, "currentTime:", n, "syncPoint:", a, "fetchAtBuffer:", this.fetchAtBuffer_, "bufferedTime:", d), null === a) return i = this.getSyncSegmentCandidate_(t), this.logger_("getSync", "mediaIndex:", i), this.generateSegmentInfo_(t, i, null, !0); if (null !== i) { this.logger_("walkForward", "mediaIndex:", i + 1); var c = t.segments[i]; return u = c && c.end ? c.end : o, this.generateSegmentInfo_(t, i + 1, u, !1) } this.fetchAtBuffer_ ? (i = (l = s.default.getMediaInfoForTime(t, o, a.segmentIndex, a.time)).mediaIndex, u = l.startTime) : (i = (l = s.default.getMediaInfoForTime( t, n, a.segmentIndex, a.time)).mediaIndex, u = l.startTime); return this.logger_("getMediaIndexForTime", "mediaIndex:", i, "startOfSegment:", u), this.generateSegmentInfo_(t, i, u, !1) } }, { key: "getSyncSegmentCandidate_", value: function(e) { var t = this; if (-1 === this.currentTimeline_) return 0; var i = e.segments.map(function(e, t) { return { timeline: e.timeline, segmentIndex: t } }).filter(function(e) { return e.timeline === t.currentTimeline_ }); return i.length ? i[Math.min(i.length - 1, 1)].segmentIndex : Math.max(e.segments .length - 1, 0) } }, { key: "generateSegmentInfo_", value: function(e, t, i, r) { if (t < 0 || t >= e.segments.length) return null; var n = e.segments[t]; return { requestId: "segment-loader-" + Math.random(), uri: n.resolvedUri, mediaIndex: t, isSyncRequest: r, startOfSegment: i, playlist: e, bytes: null, encryptedBytes: null, timestampOffset: null, timeline: n.timeline, duration: n.duration, segment: n } } }, { key: "abortRequestEarly_", value: function(e) { if (this.hls_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_ .attributes.BANDWIDTH) return !1; if (Date.now() - (e.firstBytesReceivedAt || Date.now()) < 1e3) return !1; var t = this.currentTime_(), i = e.bandwidth, r = this.pendingSegment_.duration, n = s.default.estimateSegmentRequestTime(r, i, this.playlist_, e.bytesReceived), a = (0, p.timeUntilRebuffer)(this.buffered_(), t, this.hls_.tech_ .playbackRate()) - 1; if (n <= a) return !1; var o = (0, m.minRebufferMaxBandwidthSelector)({ master: this.hls_.playlists.master, currentTime: t, bandwidth: i, duration: this.duration_(), segmentDuration: r, timeUntilRebuffer: a, currentTimeline: this.currentTimeline_, syncController: this.syncController_ }); if (o) { var u = n - a - o.rebufferingImpact, d = .5; return a <= p.TIME_FUDGE_FACTOR && (d = 1), !o.playlist || o.playlist.uri === this .playlist_.uri || u < d ? !1 : (this.bandwidth = o.playlist.attributes .BANDWIDTH * l.default.BANDWIDTH_VARIANCE + 1, this.abort(), this.trigger( "earlyabort"), !0) } } }, { key: "handleProgress_", value: function(e, t) { this.pendingSegment_ && t.requestId === this.pendingSegment_.requestId && !this .abortRequestEarly_(t.stats) && this.trigger("progress") } }, { key: "loadSegment_", value: function(e) { this.state = "WAITING", this.pendingSegment_ = e, this.trimBackBuffer_(e), e .abortRequests = (0, f.mediaSegmentRequest)(this.hls_.xhr, this.xhrOptions_, this .decrypter_, this.createSimplifiedSegmentObj_(e), this.handleProgress_.bind( this), this.segmentRequestFinished_.bind(this)) } }, { key: "trimBackBuffer_", value: function(e) { var t = _(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); t > 0 && this.remove(0, t) } }, { key: "createSimplifiedSegmentObj_", value: function(e) { var t = e.segment, i = { resolvedUri: t.resolvedUri, byterange: t.byterange, requestId: e.requestId }; if (t.key) { var r = t.key.iv || new Uint32Array([0, 0, 0, e.mediaIndex + e.playlist .mediaSequence ]); i.key = { resolvedUri: t.key.resolvedUri, iv: r } } return t.map && (i.map = this.initSegment(t.map)), i } }, { key: "segmentRequestFinished_", value: function(e, t) { if (this.mediaRequests += 1, t.stats && (this.mediaBytesTransferred += t.stats .bytesReceived, this.mediaTransferDuration += t.stats.roundTripTime), this .pendingSegment_) { if (t.requestId === this.pendingSegment_.requestId) { if (e) return this.pendingSegment_ = null, this.state = "READY", e.code === f .REQUEST_ERRORS.ABORTED ? void(this.mediaRequestsAborted += 1) : (this .pause(), e.code === f.REQUEST_ERRORS.TIMEOUT ? (this .mediaRequestsTimedout += 1, this.bandwidth = 1, this.roundTrip = NaN, void this.trigger("bandwidthupdate")) : (this.mediaRequestsErrored += 1, this.error(e), void this.trigger("error"))); this.bandwidth = t.stats.bandwidth, this.roundTrip = t.stats.roundTripTime, t .map && (t.map = this.initSegment(t.map, !0)), this.processSegmentResponse_(t) } } else this.mediaRequestsAborted += 1 } }, { key: "processSegmentResponse_", value: function(e) { var t = this.pendingSegment_; t.bytes = e.bytes, e.map && (t.segment.map.bytes = e.map.bytes), t .endOfAllRequests = e.endOfAllRequests, this.handleSegment_() } }, { key: "handleSegment_", value: function() { var e = this; if (this.pendingSegment_) { var t = this.pendingSegment_, i = t.segment, r = this.syncController_.probeSegmentInfo(t); void 0 === this.startingMedia_ && r && (r.containsAudio || r.containsVideo) && ( this.startingMedia_ = { containsAudio: r.containsAudio, containsVideo: r.containsVideo }); var n = y(this.loaderType_, this.startingMedia_, r); if (n) return this.error({ message: n, blacklistDuration: 1 / 0 }), void this.trigger("error"); if (t.isSyncRequest) return this.trigger("syncinfoupdate"), this.pendingSegment_ = null, void(this.state = "READY"); null !== t.timestampOffset && t.timestampOffset !== this.sourceUpdater_ .timestampOffset() && (this.sourceUpdater_.timestampOffset(t.timestampOffset), this.trigger("timestampoffset")); var a = this.syncController_.mappingForTimeline(t.timeline); null !== a && this.trigger({ type: "segmenttimemapping", mapping: a }), this.state = "APPENDING", i.map && function() { var t = (0, h.initSegmentId)(i.map); if (!e.activeInitSegmentId_ || e.activeInitSegmentId_ !== t) { var r = e.initSegment(i.map); e.sourceUpdater_.appendBuffer(r.bytes, function() { e.activeInitSegmentId_ = t }) } }(), t.byteLength = t.bytes.byteLength, "number" == typeof i.start && "number" == typeof i.end ? this.mediaSecondsLoaded += i.end - i.start : this .mediaSecondsLoaded += i.duration, this.sourceUpdater_.appendBuffer(t.bytes, this.handleUpdateEnd_.bind(this)) } else this.state = "READY" } }, { key: "handleUpdateEnd_", value: function() { if (this.logger_("handleUpdateEnd_", "segmentInfo:", this.pendingSegment_), !this .pendingSegment_) return this.state = "READY", void(this.paused() || this .monitorBuffer_()); var e = this.pendingSegment_, t = e.segment, i = null !== this.mediaIndex; (this.pendingSegment_ = null, this.recordThroughput_(e), this .addSegmentMetadataCue_(e), this.state = "READY", this.mediaIndex = e.mediaIndex, this.fetchAtBuffer_ = !0, this.currentTimeline_ = e.timeline, this.trigger( "syncinfoupdate"), t.end && this.currentTime_() - t.end > 3 * e.playlist .targetDuration) ? this.resetEverything(): (i && this.trigger("bandwidthupdate"), this.trigger("progress"), g(e.playlist, this.mediaSource_, e.mediaIndex + 1) && this.endOfStream(), this.paused() || this.monitorBuffer_()) } }, { key: "recordThroughput_", value: function(e) { var t = this.throughput.rate, i = Date.now() - e.endOfAllRequests + 1, r = Math.floor(e.byteLength / i * 8 * 1e3); this.throughput.rate += (r - t) / ++this.throughput.count } }, { key: "logger_", value: function() {} }, { key: "addSegmentMetadataCue_", value: function(e) { if (this.segmentMetadataTrack_) { var t = e.segment, i = t.start, r = t.end; if (v(i) && v(r)) { (0, c.default)(i, r, this.segmentMetadataTrack_); var n = d.default.WebKitDataCue || d.default.VTTCue, a = { bandwidth: e.playlist.attributes.BANDWIDTH, resolution: e.playlist.attributes.RESOLUTION, codecs: e.playlist.attributes.CODECS, byteLength: e.byteLength, uri: e.uri, timeline: e.timeline, playlist: e.playlist.uri, start: i, end: r }, s = new n(i, r, JSON.stringify(a)); s.value = a, this.segmentMetadataTrack_.addCue(s) } } } }]), t }(); i.default = b }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./bin-utils": 2, "./config": 3, "./media-segment-request": 7, "./playlist": 11, "./playlist-selectors": 10, "./ranges": 12, "./source-updater": 17, "global/window": 32, "videojs-contrib-media-sources/es5/remove-cues-from-track.js": 72 }], 17: [function(e, t, i) { (function(e) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); var n, a = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null, s = (n = a) && n.__esModule ? n : { default: n }, o = function() {}, u = function() { function e(t, i) { var r = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e); var n = function() { r.sourceBuffer_ = t.addSourceBuffer(i), r.onUpdateendCallback_ = function() { var e = r.pendingCallback_; r.pendingCallback_ = null, e && e(), r.runCallback_() }, r.sourceBuffer_.addEventListener("updateend", r.onUpdateendCallback_), r .runCallback_() }; this.callbacks_ = [], this.pendingCallback_ = null, this.timestampOffset_ = 0, this .mediaSource = t, this.processedAppend_ = !1, "closed" === t.readyState ? t .addEventListener("sourceopen", n) : n() } return r(e, [{ key: "abort", value: function(e) { var t = this; this.processedAppend_ && this.queueCallback_(function() { t.sourceBuffer_.abort() }, e) } }, { key: "appendBuffer", value: function(e, t) { var i = this; this.processedAppend_ = !0, this.queueCallback_(function() { i.sourceBuffer_.appendBuffer(e) }, t) } }, { key: "buffered", value: function() { return this.sourceBuffer_ ? this.sourceBuffer_.buffered : s.default .createTimeRanges() } }, { key: "remove", value: function(e, t) { var i = this; this.processedAppend_ && this.queueCallback_(function() { i.sourceBuffer_.remove(e, t) }, o) } }, { key: "updating", value: function() { return !this.sourceBuffer_ || this.sourceBuffer_.updating || this.pendingCallback_ } }, { key: "timestampOffset", value: function(e) { var t = this; return void 0 !== e && (this.queueCallback_(function() { t.sourceBuffer_.timestampOffset = e }), this.timestampOffset_ = e), this.timestampOffset_ } }, { key: "queueCallback_", value: function(e, t) { this.callbacks_.push([e.bind(this), t]), this.runCallback_() } }, { key: "runCallback_", value: function() { var e = void 0; !this.updating() && this.callbacks_.length && (e = this.callbacks_.shift(), this .pendingCallback_ = e[1], e[0]()) } }, { key: "dispose", value: function() { this.sourceBuffer_.removeEventListener("updateend", this.onUpdateendCallback_), this .sourceBuffer_ && "open" === this.mediaSource.readyState && this.sourceBuffer_ .abort() } }]), e }(); i.default = u, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}], 18: [function(e, t, i) { (function(t) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function a(e) { return e && e.__esModule ? e : { default: e } } var s = a(e("mux.js/lib/mp4/probe")), o = e("mux.js/lib/tools/ts-inspector.js"), u = e("./playlist"), l = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null), d = [{ name: "VOD", run: function(e, t, i, r, n) { if (i !== 1 / 0) { return { time: 0, segmentIndex: 0 } } return null } }, { name: "ProgramDateTime", run: function(e, t, i, r, n) { return e.datetimeToDisplayTime && t.dateTimeObject ? { time: t.dateTimeObject.getTime() / 1e3 + e.datetimeToDisplayTime, segmentIndex: 0 } : null } }, { name: "Segment", run: function(e, t, i, r, n) { var a = t.segments || [], s = null, o = null; n = n || 0; for (var u = 0; u < a.length; u++) { var l = a[u]; if (l.timeline === r && void 0 !== l.start) { var d = Math.abs(n - l.start); if (null !== o && o < d) break; (!s || null === o || o >= d) && (o = d, s = { time: l.start, segmentIndex: u }) } } return s } }, { name: "Discontinuity", run: function(e, t, i, r, n) { var a = null; if (n = n || 0, t.discontinuityStarts && t.discontinuityStarts.length) for (var s = null, o = 0; o < t.discontinuityStarts.length; o++) { var u = t.discontinuityStarts[o], l = t.discontinuitySequence + o + 1, d = e.discontinuities[l]; if (d) { var c = Math.abs(n - d.time); if (null !== s && s < c) break; (!a || null === s || s >= c) && (s = c, a = { time: d.time, segmentIndex: u }) } } return a } }, { name: "Playlist", run: function(e, t, i, r, n) { return t.syncInfo ? { time: t.syncInfo.time, segmentIndex: t.syncInfo.mediaSequence - t.mediaSequence } : null } }]; i.syncPointStrategies = d; var c = function(e) { function t() { var e = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0]; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), this .inspectCache_ = void 0, this.timelines = [], this.discontinuities = [], this .datetimeToDisplayTime = null, e.debug && (this.logger_ = l.default.log.bind(l.default, "sync-controller ->")) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, l["default"].EventTarget), r(t, [{ key: "getSyncPoint", value: function(e, t, i, r) { var n = this.runStrategies_(e, t, i, r); return n.length ? this.selectSyncPoint_(n, { key: "time", value: r }) : null } }, { key: "getExpiredTime", value: function(e, t) { if (!e || !e.segments) return null; var i = this.runStrategies_(e, t, e.discontinuitySequence, 0); if (!i.length) return null; var r = this.selectSyncPoint_(i, { key: "segmentIndex", value: 0 }); return r.segmentIndex > 0 && (r.time *= -1), Math.abs(r.time + (0, u.sumDurations)( e, r.segmentIndex, 0)) } }, { key: "runStrategies_", value: function(e, t, i, r) { for (var n = [], a = 0; a < d.length; a++) { var s = d[a], o = s.run(this, e, t, i, r); o && (o.strategy = s.name, n.push({ strategy: s.name, syncPoint: o }), this.logger_("syncPoint found via <" + s.name + ">:", o)) } return n } }, { key: "selectSyncPoint_", value: function(e, t) { for (var i = e[0].syncPoint, r = Math.abs(e[0].syncPoint[t.key] - t.value), n = e[0] .strategy, a = 1; a < e.length; a++) { var s = Math.abs(e[a].syncPoint[t.key] - t.value); s < r && (r = s, i = e[a].syncPoint, n = e[a].strategy) } return this.logger_("syncPoint with strategy <" + n + "> chosen: ", i), i } }, { key: "saveExpiredSegmentInfo", value: function(e, t) { for (var i = t.mediaSequence - e.mediaSequence - 1; i >= 0; i--) { var r = e.segments[i]; if (r && void 0 !== r.start) { t.syncInfo = { mediaSequence: e.mediaSequence + i, time: r.start }, this.logger_("playlist sync:", t.syncInfo), this.trigger("syncinfoupdate"); break } } } }, { key: "setDateTimeMapping", value: function(e) { if (!this.datetimeToDisplayTime && e.dateTimeObject) { var t = e.dateTimeObject.getTime() / 1e3; this.datetimeToDisplayTime = -t } } }, { key: "reset", value: function() { this.inspectCache_ = void 0 } }, { key: "probeSegmentInfo", value: function(e) { var t = e.segment, i = e.playlist, r = void 0; return (r = t.map ? this.probeMp4Segment_(e) : this.probeTsSegment_(e)) && this .calculateSegmentTimeMapping_(e, r) && (this.saveDiscontinuitySyncInfo_(e), i .syncInfo || (i.syncInfo = { mediaSequence: i.mediaSequence + e.mediaIndex, time: t.start })), r } }, { key: "probeMp4Segment_", value: function(e) { var t = e.segment, i = s.default.timescale(t.map.bytes), r = s.default.startTime(i, e.bytes); return null !== e.timestampOffset && (e.timestampOffset -= r), { start: r, end: r + t.duration } } }, { key: "probeTsSegment_", value: function(e) { var t = (0, o.inspect)(e.bytes, this.inspectCache_), i = void 0, r = void 0; return t ? (t.video && 2 === t.video.length ? (this.inspectCache_ = t.video[1].dts, i = t.video[0].dtsTime, r = t.video[1].dtsTime) : t.audio && 2 === t.audio .length && (this.inspectCache_ = t.audio[1].dts, i = t.audio[0].dtsTime, r = t .audio[1].dtsTime), { start: i, end: r, containsVideo: t.video && 2 === t.video.length, containsAudio: t.audio && 2 === t.audio.length }) : null } }, { key: "timestampOffsetForTimeline", value: function(e) { return void 0 === this.timelines[e] ? null : this.timelines[e].time } }, { key: "mappingForTimeline", value: function(e) { return void 0 === this.timelines[e] ? null : this.timelines[e].mapping } }, { key: "calculateSegmentTimeMapping_", value: function(e, t) { var i = e.segment, r = this.timelines[e.timeline]; if (null !== e.timestampOffset) this.logger_("tsO:", e.timestampOffset), r = { time: e.startOfSegment, mapping: e.startOfSegment - t.start }, this.timelines[e.timeline] = r, this.trigger("timestampoffset"), i.start = e .startOfSegment, i.end = t.end + r.mapping; else { if (!r) return !1; i.start = t.start + r.mapping, i.end = t.end + r.mapping } return !0 } }, { key: "saveDiscontinuitySyncInfo_", value: function(e) { var t = e.playlist, i = e.segment; if (i.discontinuity) this.discontinuities[i.timeline] = { time: i.start, accuracy: 0 }; else if (t.discontinuityStarts.length) for (var r = 0; r < t.discontinuityStarts.length; r++) { var n = t.discontinuityStarts[r], a = t.discontinuitySequence + r + 1, s = n - e.mediaIndex, o = Math.abs(s); if (!this.discontinuities[a] || this.discontinuities[a].accuracy > o) { var l = void 0; l = s < 0 ? i.start - (0, u.sumDurations)(t, e.mediaIndex, n) : i.end + (0, u .sumDurations)(t, e.mediaIndex + 1, n), this.discontinuities[a] = { time: l, accuracy: o } } } } }, { key: "logger_", value: function() {} }]), t }(); i.default = c }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./playlist": 11, "mux.js/lib/mp4/probe": 57, "mux.js/lib/tools/ts-inspector.js": 59 }], 19: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); i.parseCodecs = function() { var e, t = arguments.length <= 0 || void 0 === arguments[0] ? "" : arguments[0], i = { codecCount: 0 }; return i.codecCount = t.split(",").length, i.codecCount = i.codecCount || 2, (e = /(^|\s|,)+(avc1)([^ ,]*)/i.exec(t)) && (i.videoCodec = e[2], i.videoObjectTypeIndicator = e[3]), i.audioProfile = /(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t), i.audioProfile = i .audioProfile && i.audioProfile[2], i } }, {}], 20: [function(e, t, i) { (function(r) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var n = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), a = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function s(e) { return e && e.__esModule ? e : { default: e } } var o = s(e("./segment-loader")), u = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null), l = s(e("global/window")), d = s(e("videojs-contrib-media-sources/es5/remove-cues-from-track.js")), c = e("./bin-utils"), h = new Uint8Array("\n\n".split("").map(function(e) { return e.charCodeAt(0) })), f = function(e) { return String.fromCharCode.apply(null, e) }, p = function(e) { function t(e) { var i = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, e, i), this .mediaSource_ = null, this.subtitlesTrack_ = null } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, o["default"]), n(t, [{ key: "buffered_", value: function() { if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues.length) return u.default .createTimeRanges(); var e = this.subtitlesTrack_.cues, t = e[0].startTime, i = e[e.length - 1].startTime; return u.default.createTimeRanges([ [t, i] ]) } }, { key: "initSegment", value: function(e) { var t = !(arguments.length <= 1 || void 0 === arguments[1]) && arguments[1]; if (!e) return null; var i = (0, c.initSegmentId)(e), r = this.initSegments_[i]; if (t && !r && e.bytes) { var n = h.byteLength + e.bytes.byteLength, a = new Uint8Array(n); a.set(e.bytes), a.set(h, e.bytes.byteLength), this.initSegments_[i] = r = { resolvedUri: e.resolvedUri, byterange: e.byterange, bytes: a } } return r || e } }, { key: "couldBeginLoading_", value: function() { return this.playlist_ && this.subtitlesTrack_ && !this.paused() } }, { key: "init_", value: function() { return this.state = "READY", this.resetEverything(), this.monitorBuffer_() } }, { key: "track", value: function(e) { return void 0 === e ? this.subtitlesTrack_ : (this.subtitlesTrack_ = e, "INIT" === this.state && this.couldBeginLoading_() && this.init_(), this.subtitlesTrack_) } }, { key: "remove", value: function(e, t) { (0, d.default)(e, t, this.subtitlesTrack_) } }, { key: "fillBuffer_", value: function() { var e = this; this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this .playlist_, this.duration_(), this.currentTimeline_, this.currentTime_())); var t = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this .hasPlayed_(), this.currentTime_(), this.syncPoint_); if (t = this.skipEmptySegments_(t)) { if (null === this.syncController_.timestampOffsetForTimeline(t.timeline)) { return this.syncController_.one("timestampoffset", function() { e.state = "READY", e.paused() || e.monitorBuffer_() }), void(this.state = "WAITING_ON_TIMELINE") } this.loadSegment_(t) } } }, { key: "skipEmptySegments_", value: function(e) { for (; e && e.segment.empty;) e = this.generateSegmentInfo_(e.playlist, e .mediaIndex + 1, e.startOfSegment + e.duration, e.isSyncRequest); return e } }, { key: "handleSegment_", value: function() { var e = this; if (this.pendingSegment_ && this.subtitlesTrack_) { this.state = "APPENDING"; var t, i = this.pendingSegment_, r = i.segment; if ("function" != typeof l.default.WebVTT && this.subtitlesTrack_ && this .subtitlesTrack_.tech_) { var n = (t = function() { e.handleSegment_() }, e.state = "WAITING_ON_VTTJS", e.subtitlesTrack_.tech_.one("vttjsloaded", t), e.subtitlesTrack_.tech_.one("vttjserror", function() { e.subtitlesTrack_.tech_.off("vttjsloaded", t), e.error({ message: "Error loading vtt.js" }), e.state = "READY", e.pause(), e.trigger("error") }), { v: void 0 }); if ("object" == typeof n) return n.v } r.requested = !0; try { this.parseVTTCues_(i) } catch (e) { return this.error({ message: e.message }), this.state = "READY", this.pause(), this.trigger("error") } if (this.updateTimeMapping_(i, this.syncController_.timelines[i.timeline], this .playlist_), i.isSyncRequest) return this.trigger("syncinfoupdate"), this .pendingSegment_ = null, void(this.state = "READY"); i.byteLength = i.bytes.byteLength, this.mediaSecondsLoaded += r.duration, i.cues .length && this.remove(i.cues[0].endTime, i.cues[i.cues.length - 1].endTime), i .cues.forEach(function(t) { e.subtitlesTrack_.addCue(t) }), this.handleUpdateEnd_() } else this.state = "READY" } }, { key: "parseVTTCues_", value: function(e) { var t = void 0, i = !1; "function" == typeof l.default.TextDecoder ? t = new l.default.TextDecoder("utf8") : (t = l.default.WebVTT.StringDecoder(), i = !0); var r = new l.default.WebVTT.Parser(l.default, l.default.vttjs, t); if (e.cues = [], e.timestampmap = { MPEGTS: 0, LOCAL: 0 }, r.oncue = e.cues.push.bind(e.cues), r.ontimestampmap = function(t) { return e.timestampmap = t }, r.onparsingerror = function(e) { u.default.log.warn("Error encountered when parsing cues: " + e.message) }, e.segment.map) { var n = e.segment.map.bytes; i && (n = f(n)), r.parse(n) } var a = e.bytes; i && (a = f(a)), r.parse(a), r.flush() } }, { key: "updateTimeMapping_", value: function(e, t, i) { var r = e.segment; if (t) if (e.cues.length) { var n = e.timestampmap, a = n.MPEGTS / 9e4 - n.LOCAL + t.mapping; if (e.cues.forEach(function(e) { e.startTime += a, e.endTime += a }), !i.syncInfo) { var s = e.cues[0].startTime, o = e.cues[e.cues.length - 1].startTime; i.syncInfo = { mediaSequence: i.mediaSequence + e.mediaIndex, time: Math.min(s, o - r.duration) } } } else r.empty = !0 } }]), t }(); i.default = p, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./bin-utils": 2, "./segment-loader": 16, "global/window": 32, "videojs-contrib-media-sources/es5/remove-cues-from-track.js": 72 }], 21: [function(e, t, i) { (function(e) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null, a = (r = n) && r.__esModule ? r : { default: r }; i.default = function() { return function e(t, i) { t = (0, n.mergeOptions)({ timeout: 45e3 }, t); var r = e.beforeRequest || a.default.Hls.xhr.beforeRequest; if (r && "function" == typeof r) { var s = r(t); s && (t = s) } var o = (0, n.xhr)(t, function(e, t) { var r = o.response; !e && r && (o.responseTime = Date.now(), o.roundTripTime = o.responseTime - o .requestTime, o.bytesReceived = r.byteLength || r.length, o.bandwidth || (o .bandwidth = Math.floor(o.bytesReceived / o.roundTripTime * 8 * 1e3))), e && "ETIMEDOUT" === e.code && (o.timedout = !0), e || o.aborted || 200 === t .statusCode || 206 === t.statusCode || 0 === t.statusCode || (e = new Error( "XHR Failed with a response of: " + (o && (r || o.responseText)))), i(e, o) }), u = o.abort; return o.abort = function() { return o.aborted = !0, u.apply(o, arguments) }, o.uri = t.uri, o.requestTime = Date.now(), o } }, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}], 22: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); var n = function() { var e = [ [ [], [], [], [], [] ], [ [], [], [], [], [] ] ], t = e[0], i = e[1], r = t[4], n = i[4], a = void 0, s = void 0, o = void 0, u = [], l = [], d = void 0, c = void 0, h = void 0, f = void 0, p = void 0; for (a = 0; a < 256; a++) l[(u[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a; for (s = o = 0; !r[s]; s ^= d || 1, o = l[o] || 1) for (h = (h = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4) >> 8 ^ 255 & h ^ 99, r[s] = h, n[h] = s, p = 16843009 * u[c = u[d = u[s]]] ^ 65537 * c ^ 257 * d ^ 16843008 * s, f = 257 * u[h] ^ 16843008 * h, a = 0; a < 4; a++) t[a][s] = f = f << 24 ^ f >>> 8, i[a][h] = p = p << 24 ^ p >>> 8; for (a = 0; a < 5; a++) t[a] = t[a].slice(0), i[a] = i[a].slice(0); return e }, a = null, s = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), a || (a = n()), this._tables = [ [a[0][0].slice(), a[0][1].slice(), a[0][2].slice(), a[0][3].slice(), a[0][4].slice()], [a[1][0].slice(), a[1][1].slice(), a[1][2].slice(), a[1][3].slice(), a[1][4].slice()] ]; var i = void 0, r = void 0, s = void 0, o = void 0, u = void 0, l = this._tables[0][4], d = this._tables[1], c = t.length, h = 1; if (4 !== c && 6 !== c && 8 !== c) throw new Error("Invalid aes key size"); for (o = t.slice(0), u = [], this._key = [o, u], i = c; i < 4 * c + 28; i++) s = o[i - 1], (i % c == 0 || 8 === c && i % c == 4) && (s = l[s >>> 24] << 24 ^ l[s >> 16 & 255] << 16 ^ l[s >> 8 & 255] << 8 ^ l[255 & s], i % c == 0 && (s = s << 8 ^ s >>> 24 ^ h << 24, h = h << 1 ^ 283 * (h >> 7))), o[i] = o[i - c] ^ s; for (r = 0; i; r++, i--) s = o[3 & r ? i : i - 4], u[r] = i <= 4 || r < 4 ? s : d[0][l[s >>> 24]] ^ d[1][l[s >> 16 & 255]] ^ d[2][l[s >> 8 & 255]] ^ d[3][l[255 & s]] } return r(e, [{ key: "decrypt", value: function(e, t, i, r, n, a) { var s = this._key[1], o = e ^ s[0], u = r ^ s[1], l = i ^ s[2], d = t ^ s[3], c = void 0, h = void 0, f = void 0, p = s.length / 4 - 2, m = void 0, g = 4, v = this._tables[1], y = v[0], _ = v[1], b = v[2], w = v[3], E = v[4]; for (m = 0; m < p; m++) c = y[o >>> 24] ^ _[u >> 16 & 255] ^ b[l >> 8 & 255] ^ w[255 & d] ^ s[g], h = y[u >>> 24] ^ _[l >> 16 & 255] ^ b[d >> 8 & 255] ^ w[255 & o] ^ s[g + 1], f = y[l >>> 24] ^ _[d >> 16 & 255] ^ b[o >> 8 & 255] ^ w[255 & u] ^ s[g + 2], d = y[d >>> 24] ^ _[o >> 16 & 255] ^ b[u >> 8 & 255] ^ w[255 & l] ^ s[g + 3], g += 4, o = c, u = h, l = f; for (m = 0; m < 4; m++) n[(3 & -m) + a] = E[o >>> 24] << 24 ^ E[u >> 16 & 255] << 16 ^ E[l >> 8 & 255] << 8 ^ E[255 & d] ^ s[g++], c = o, o = u, u = l, l = d, d = c } }]), e }(); i.default = s, t.exports = i.default }, {}], 23: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; var a, s = e("./stream"), o = (a = s) && a.__esModule ? a : { default: a }, u = function(e) { function t() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, o.default), this .jobs = [], this.delay = 1, this.timeout_ = null } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, o["default"]), r(t, [{ key: "processJob_", value: function() { this.jobs.shift()(), this.jobs.length ? this.timeout_ = setTimeout(this.processJob_ .bind(this), this.delay) : this.timeout_ = null } }, { key: "push", value: function(e) { this.jobs.push(e), this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind( this), this.delay)) } }]), t }(); i.default = u, t.exports = i.default }, { "./stream": 26 }], 24: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); function n(e) { return e && e.__esModule ? e : { default: e } } var a = n(e("./aes")), s = n(e("./async-stream")), o = e("pkcs7"), u = function(e) { return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24 }, l = function(e, t, i) { var r = new Int32Array(e.buffer, e.byteOffset, e.byteLength >> 2), n = new a.default(Array.prototype.slice.call(t)), s = new Uint8Array(e.byteLength), o = new Int32Array(s.buffer), l = void 0, d = void 0, c = void 0, h = void 0, f = void 0, p = void 0, m = void 0, g = void 0, v = void 0; for (l = i[0], d = i[1], c = i[2], h = i[3], v = 0; v < r.length; v += 4) f = u(r[v]), p = u(r[v + 1]), m = u(r[v + 2]), g = u(r[v + 3]), n.decrypt(f, p, m, g, o, v), o[v] = u(o[v] ^ l), o[v + 1] = u(o[v + 1] ^ d), o[v + 2] = u(o[v + 2] ^ c), o[v + 3] = u(o[v + 3] ^ h), l = f, d = p, c = m, h = g; return s }; i.decrypt = l; var d = function() { function e(t, i, r, n) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e); var a = e.STEP, l = new Int32Array(t.buffer), d = new Uint8Array(t.byteLength), c = 0; for (this.asyncStream_ = new s.default, this.asyncStream_.push(this.decryptChunk_(l.subarray(c, c + a), i, r, d)), c = a; c < l.length; c += a) r = new Uint32Array([u(l[c - 4]), u(l[c - 3]), u(l[c - 2]), u(l[c - 1]) ]), this.asyncStream_.push(this.decryptChunk_(l.subarray(c, c + a), i, r, d)); this.asyncStream_.push(function() { n(null, (0, o.unpad)(d)) }) } return r(e, [{ key: "decryptChunk_", value: function(e, t, i, r) { return function() { var n = l(e, t, i); r.set(n, e.byteOffset) } } }], [{ key: "STEP", get: function() { return 32e3 } }]), e }(); i.Decrypter = d, i.default = { Decrypter: d, decrypt: l } }, { "./aes": 22, "./async-stream": 23, pkcs7: 28 }], 25: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = e("./decrypter"), a = e("./async-stream"), s = (r = a) && r.__esModule ? r : { default: r }; i.default = { decrypt: n.decrypt, Decrypter: n.Decrypter, AsyncStream: s.default }, t.exports = i.default }, { "./async-stream": 23, "./decrypter": 24 }], 26: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); var n = function() { function e() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.listeners = {} } return r(e, [{ key: "on", value: function(e, t) { this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t) } }, { key: "off", value: function(e, t) { var i; return !!this.listeners[e] && (i = this.listeners[e].indexOf(t), this.listeners[e] .splice(i, 1), i > -1) } }, { key: "trigger", value: function(e) { var t = void 0, i = void 0, r = void 0, n = void 0; if (t = this.listeners[e]) if (2 === arguments.length) for (r = t.length, i = 0; i < r; ++i) t[i].call(this, arguments[1]); else for (n = Array.prototype.slice.call(arguments, 1), r = t.length, i = 0; i < r; ++i) t[i].apply(this, n) } }, { key: "dispose", value: function() { this.listeners = {} } }, { key: "pipe", value: function(e) { this.on("data", function(t) { e.push(t) }) } }]), e }(); i.default = n, t.exports = i.default }, {}], 27: [function(e, t, i) { "use strict"; var r; t.exports = function(e) { var t = r[e.byteLength % 16 || 0], i = new Uint8Array(e.byteLength + t.length); return i.set(e), i.set(t, e.byteLength), i }, r = [ [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15], [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14], [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [9, 9, 9, 9, 9, 9, 9, 9, 9], [8, 8, 8, 8, 8, 8, 8, 8], [7, 7, 7, 7, 7, 7, 7], [6, 6, 6, 6, 6, 6], [5, 5, 5, 5, 5], [4, 4, 4, 4], [3, 3, 3], [2, 2], [1] ] }, {}], 28: [function(e, t, i) { "use strict"; i.pad = e("./pad.js"), i.unpad = e("./unpad.js") }, { "./pad.js": 27, "./unpad.js": 29 }], 29: [function(e, t, i) { "use strict"; t.exports = function(e) { return e.subarray(0, e.byteLength - e[e.byteLength - 1]) } }, {}], 30: [function(e, t, i) {}, {}], 31: [function(e, t, i) { (function(i) { var r, n = void 0 !== i ? i : "undefined" != typeof window ? window : {}, a = e("min-document"); "undefined" != typeof document ? r = document : (r = n["__GLOBAL_DOCUMENT_CACHE@4"]) || (r = n[ "__GLOBAL_DOCUMENT_CACHE@4"] = a), t.exports = r }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "min-document": 30 }], 32: [function(e, t, i) { (function(e) { var i; i = "undefined" != typeof window ? window : void 0 !== e ? e : "undefined" != typeof self ? self : {}, t.exports = i }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}], 33: [function(e, t, i) { "use strict"; var r = s(e("./line-stream")), n = s(e("./parse-stream")), a = s(e("./parser")); function s(e) { return e && e.__esModule ? e : { default: e } } t.exports = { LineStream: r.default, ParseStream: n.default, Parser: a.default } }, { "./line-stream": 34, "./parse-stream": 35, "./parser": 36 }], 34: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), a = e("./stream"), s = (r = a) && r.__esModule ? r : { default: r }; var o = function(e) { function t() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t); var e = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); return e.buffer = "", e } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, s["default"]), n(t, [{ key: "push", value: function(e) { var t = void 0; for (this.buffer += e, t = this.buffer.indexOf("\n"); t > -1; t = this.buffer.indexOf( "\n")) this.trigger("data", this.buffer.substring(0, t)), this.buffer = this.buffer .substring(t + 1) } }]), t }(); i.default = o }, { "./stream": 37 }], 35: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r, n = function() { return function(e, t) { if (Array.isArray(e)) return e; if (Symbol.iterator in Object(e)) return function(e, t) { var i = [], r = !0, n = !1, a = void 0; try { for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s.value), ! t || i.length !== t); r = !0); } catch (e) { n = !0, a = e } finally { try { !r && o.return && o.return() } finally { if (n) throw a } } return i }(e, t); throw new TypeError("Invalid attempt to destructure non-iterable instance") } }(), a = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), s = e("./stream"), o = (r = s) && r.__esModule ? r : { default: r }; var u = function(e) { for (var t = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), i = {}, r = t.length, n = void 0; r--;) "" !== t[r] && ((n = /([^=]*)=(.*)/.exec(t[r]).slice(1))[0] = n[0].replace( /^\s+|\s+$/g, ""), n[1] = n[1].replace(/^\s+|\s+$/g, ""), n[1] = n[1].replace( /^['"](.*)['"]$/g, "$1"), i[n[0]] = n[1]); return i }, l = function(e) { function t() { return function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, o["default"]), a(t, [{ key: "push", value: function(e) { var t = void 0, i = void 0; if (0 !== (e = e.replace(/^[\u0000\s]+|[\u0000\s]+$/g, "")).length) if ("#" === e[0]) if (0 === e.indexOf("#EXT")) if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e)) this.trigger("data", { type: "tag", tagType: "m3u" }); else { if (t = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "inf" }, t[1] && (i.duration = parseFloat(t[1])), t[2] && (i.title = t[2]), void this.trigger("data", i); if (t = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "targetduration" }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "totalduration" }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "version" }, t[1] && (i.version = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "media-sequence" }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "discontinuity-sequence" }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i); if (t = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "playlist-type" }, t[1] && (i.playlistType = t[1]), void this.trigger("data", i); if (t = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e)) return i = { type: "tag", tagType: "byterange" }, t[1] && (i.length = parseInt(t[1], 10)), t[2] && (i.offset = parseInt(t[ 2], 10)), void this.trigger("data", i); if (t = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return i = { type: "tag", tagType: "allow-cache" }, t[1] && (i.allowed = !/NO/.test(t[1])), void this.trigger("data", i); if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) { if (i = { type: "tag", tagType: "map" }, t[1]) { var r = u(t[1]); if (r.URI && (i.uri = r.URI), r.BYTERANGE) { var a = r.BYTERANGE.split("@"), s = n(a, 2), o = s[0], l = s[1]; i.byterange = {}, o && (i.byterange.length = parseInt(o, 10)), l && (i .byterange.offset = parseInt(l, 10)) } } this.trigger("data", i) } else if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) { if (i = { type: "tag", tagType: "stream-inf" }, t[1]) { if (i.attributes = u(t[1]), i.attributes.RESOLUTION) { var d = i.attributes.RESOLUTION.split("x"), c = {}; d[0] && (c.width = parseInt(d[0], 10)), d[1] && (c.height = parseInt(d[1], 10)), i.attributes.RESOLUTION = c } i.attributes.BANDWIDTH && (i.attributes.BANDWIDTH = parseInt(i.attributes .BANDWIDTH, 10)), i.attributes["PROGRAM-ID"] && (i.attributes[ "PROGRAM-ID"] = parseInt(i.attributes["PROGRAM-ID"], 10)) } this.trigger("data", i) } else { if (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "media" }, t[1] && (i.attributes = u(t[1])), void this.trigger("data", i); if (t = /^#EXT-X-ENDLIST/.exec(e)) this.trigger("data", { type: "tag", tagType: "endlist" }); else if (t = /^#EXT-X-DISCONTINUITY/.exec(e)) this.trigger("data", { type: "tag", tagType: "discontinuity" }); else { if (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "program-date-time" }, t[1] && (i.dateTimeString = t[1], i.dateTimeObject = new Date(t[1])), void this.trigger("data", i); if (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) return i = { type: "tag", tagType: "key" }, t[1] && (i.attributes = u(t[1]), i.attributes.IV && ("0x" === i .attributes.IV.substring(0, 2).toLowerCase() && (i.attributes.IV = i .attributes.IV.substring(2)), i.attributes.IV = i.attributes.IV .match(/.{8}/g), i.attributes.IV[0] = parseInt(i.attributes.IV[0], 16), i.attributes.IV[1] = parseInt(i.attributes.IV[1], 16), i .attributes.IV[2] = parseInt(i.attributes.IV[2], 16), i.attributes .IV[3] = parseInt(i.attributes.IV[3], 16), i.attributes.IV = new Uint32Array(i.attributes.IV))), void this.trigger("data", i); if (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-out-cont" }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i); if (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-out" }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i); if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) return i = { type: "tag", tagType: "cue-in" }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i); this.trigger("data", { type: "tag", data: e.slice(4) }) } } } else this.trigger("data", { type: "comment", text: e.slice(1) }); else this.trigger("data", { type: "uri", uri: e }) } }]), t }(); i.default = l }, { "./stream": 37 }], 36: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = Object.assign || function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }, n = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), a = u(e("./stream")), s = u(e("./line-stream")), o = u(e("./parse-stream")); function u(e) { return e && e.__esModule ? e : { default: e } } var l = function(e) { function t() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t); var e = function(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); e.lineStream = new s.default, e.parseStream = new o.default, e.lineStream.pipe(e.parseStream); var i = e, n = [], a = {}, u = void 0, l = void 0, d = { AUDIO: {}, VIDEO: {}, "CLOSED-CAPTIONS": {}, SUBTITLES: {} }, c = 0; return e.manifest = { allowCache: !0, discontinuityStarts: [], segments: [] }, e.parseStream.on("data", function(e) { var t = void 0, s = void 0; ({ tag: function() { (({ "allow-cache": function() { this.manifest.allowCache = e.allowed, "allowed" in e || (this.trigger( "info", { message: "defaulting allowCache to YES" }), this.manifest.allowCache = !0) }, byterange: function() { var t = {}; "length" in e && (a.byterange = t, t.length = e.length, "offset" in e || ( this.trigger("info", { message: "defaulting offset to zero" }), e.offset = 0)), "offset" in e && (a.byterange = t, t.offset = e .offset) }, endlist: function() { this.manifest.endList = !0 }, inf: function() { "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this .trigger("info", { message: "defaulting media sequence to zero" })), "discontinuitySequence" in this.manifest || (this.manifest .discontinuitySequence = 0, this.trigger("info", { message: "defaulting discontinuity sequence to zero" })), e.duration > 0 && (a.duration = e.duration), 0 === e.duration && (a.duration = .01, this.trigger("info", { message: "updating zero segment duration to a small value" })), this.manifest.segments = n }, key: function() { e.attributes ? "NONE" !== e.attributes.METHOD ? e.attributes.URI ? (e .attributes.METHOD || this.trigger("warn", { message: "defaulting key method to AES-128" }), l = { method: e.attributes.METHOD || "AES-128", uri: e.attributes.URI }, void 0 !== e.attributes.IV && (l.iv = e.attributes.IV)) : this .trigger("warn", { message: "ignoring key declaration without URI" }) : l = null : this.trigger("warn", { message: "ignoring key declaration without attribute list" }) }, "media-sequence": function() { isFinite(e.number) ? this.manifest.mediaSequence = e.number : this .trigger("warn", { message: "ignoring invalid media sequence: " + e.number }) }, "discontinuity-sequence": function() { isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, c = e.number) : this.trigger("warn", { message: "ignoring invalid discontinuity sequence: " + e.number }) }, "playlist-type": function() { /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e .playlistType : this.trigger("warn", { message: "ignoring unknown playlist type: " + e.playlist }) }, map: function() { u = {}, e.uri && (u.uri = e.uri), e.byterange && (u.byterange = e .byterange) }, "stream-inf": function() { this.manifest.playlists = n, this.manifest.mediaGroups = this.manifest .mediaGroups || d, e.attributes ? (a.attributes || (a.attributes = {}), r(a.attributes, e.attributes)) : this.trigger("warn", { message: "ignoring empty stream-inf attributes" }) }, media: function() { if (this.manifest.mediaGroups = this.manifest.mediaGroups || d, e .attributes && e.attributes.TYPE && e.attributes["GROUP-ID"] && e .attributes.NAME) { var i = this.manifest.mediaGroups[e.attributes.TYPE]; i[e.attributes["GROUP-ID"]] = i[e.attributes["GROUP-ID"]] || {}, t = i[e .attributes["GROUP-ID"]], (s = { default: /yes/i.test(e.attributes.DEFAULT) }).default ? s.autoselect = !0 : s.autoselect = /yes/i.test(e .attributes.AUTOSELECT), e.attributes.LANGUAGE && (s.language = e .attributes.LANGUAGE), e.attributes.URI && (s.uri = e.attributes .URI), e.attributes["INSTREAM-ID"] && (s.instreamId = e.attributes[ "INSTREAM-ID"]), e.attributes.CHARACTERISTICS && (s .characteristics = e.attributes.CHARACTERISTICS), e.attributes .FORCED && (s.forced = /yes/i.test(e.attributes.FORCED)), t[e .attributes.NAME] = s } else this.trigger("warn", { message: "ignoring incomplete or missing media group" }) }, discontinuity: function() { c += 1, a.discontinuity = !0, this.manifest.discontinuityStarts.push(n .length) }, "program-date-time": function() { this.manifest.dateTimeString = e.dateTimeString, this.manifest .dateTimeObject = e.dateTimeObject }, targetduration: function() { !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", { message: "ignoring invalid target duration: " + e.duration }) : this.manifest.targetDuration = e.duration }, totalduration: function() { !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", { message: "ignoring invalid total duration: " + e.duration }) : this.manifest.totalDuration = e.duration }, "cue-out": function() { a.cueOut = e.data }, "cue-out-cont": function() { a.cueOutCont = e.data }, "cue-in": function() { a.cueIn = e.data } })[e.tagType] || function() {}).call(i) }, uri: function() { a.uri = e.uri, n.push(a), !this.manifest.targetDuration || "duration" in a || (this .trigger("warn", { message: "defaulting segment duration to the target duration" }), a.duration = this.manifest.targetDuration), l && (a.key = l), a.timeline = c, u && (a.map = u), a = {} }, comment: function() {} })[e.type].call(i) }), e } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, a["default"]), n(t, [{ key: "push", value: function(e) { this.lineStream.push(e) } }, { key: "end", value: function() { this.lineStream.push("\n") } }]), t }(); i.default = l }, { "./line-stream": 34, "./parse-stream": 35, "./stream": 37 }], 37: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); var n = function() { function e() { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.listeners = {} } return r(e, [{ key: "on", value: function(e, t) { this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t) } }, { key: "off", value: function(e, t) { if (!this.listeners[e]) return !1; var i = this.listeners[e].indexOf(t); return this.listeners[e].splice(i, 1), i > -1 } }, { key: "trigger", value: function(e) { var t = this.listeners[e], i = void 0, r = void 0, n = void 0; if (t) if (2 === arguments.length) for (r = t.length, i = 0; i < r; ++i) t[i].call(this, arguments[1]); else for (n = Array.prototype.slice.call(arguments, 1), r = t.length, i = 0; i < r; ++i) t[i].apply(this, n) } }, { key: "dispose", value: function() { this.listeners = {} } }, { key: "pipe", value: function(e) { this.on("data", function(t) { e.push(t) }) } }]), e }(); i.default = n }, {}], 38: [function(e, t, i) { "use strict"; var r, n = e("../utils/stream.js"); (r = function() { var e = new Uint8Array, t = 0; r.prototype.init.call(this), this.setTimestamp = function(e) { t = e }, this.parseId3TagSize = function(e, t) { var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]; return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10 }, this.parseAdtsSize = function(e, t) { var i = (224 & e[t + 5]) >> 5, r = e[t + 4] << 3; return 6144 & e[t + 3] | r | i }, this.push = function(i) { var r, n, a, s, o = 0, u = 0; for (e.length ? (s = e.length, (e = new Uint8Array(i.byteLength + s)).set(e.subarray(0, s)), e .set(i, s)) : e = i; e.length - u >= 3;) if (e[u] !== "I".charCodeAt(0) || e[u + 1] !== "D".charCodeAt(0) || e[u + 2] !== "3" .charCodeAt(0)) if (!0 & e[u] && 240 == (240 & e[u + 1])) { if (e.length - u < 7) break; if ((o = this.parseAdtsSize(e, u)) > e.length) break; a = { type: "audio", data: e.subarray(u, u + o), pts: t, dts: t }, this.trigger("data", a), u += o } else u++; else { if (e.length - u < 10) break; if ((o = this.parseId3TagSize(e, u)) > e.length) break; n = { type: "timed-metadata", data: e.subarray(u, u + o) }, this.trigger("data", n), u += o } r = e.length - u, e = r > 0 ? e.subarray(u) : new Uint8Array } }).prototype = new n, t.exports = r }, { "../utils/stream.js": 62 }], 39: [function(e, t, i) { "use strict"; var r = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350], n = function(e) { return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3] }; t.exports = { parseId3TagSize: function(e, t) { var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9]; return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10 }, parseAdtsSize: function(e, t) { var i = (224 & e[t + 5]) >> 5, r = e[t + 4] << 3; return 6144 & e[t + 3] | r | i }, parseType: function(e, t) { return e[t] === "I".charCodeAt(0) && e[t + 1] === "D".charCodeAt(0) && e[t + 2] === "3" .charCodeAt(0) ? "timed-metadata" : !0 & e[t] && 240 == (240 & e[t + 1]) ? "audio" : null }, parseSampleRate: function(e) { for (var t = 0; t + 5 < e.length;) { if (255 === e[t] && 240 == (246 & e[t + 1])) return r[(60 & e[t + 2]) >>> 2]; t++ } return null }, parseAacTimestamp: function(e) { var t, i, r; t = 10, 64 & e[5] && (t += 4, t += n(e.subarray(10, 14))); do { if ((i = n(e.subarray(t + 4, t + 8))) < 1) return null; if ("PRIV" === String.fromCharCode(e[t], e[t + 1], e[t + 2], e[t + 3])) { r = e.subarray(t + 10, t + i + 10); for (var a = 0; a < r.byteLength; a++) if (0 === r[a]) { if ("com.apple.streaming.transportStreamTimestamp" === unescape(function(e, t, i) { var r, n = ""; for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2); return n }(r, 0, a))) { var s = r.subarray(a + 1), o = (1 & s[3]) << 30 | s[4] << 22 | s[5] << 14 | s[6] << 6 | s[7] >>> 2; return o *= 4, o += 3 & s[7] } break } } t += 10, t += i } while (t < e.byteLength); return null } } }, {}], 40: [function(e, t, i) { "use strict"; var r, n = e("../utils/stream.js"), a = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]; (r = function() { var e; r.prototype.init.call(this), this.push = function(t) { var i, r, n, s, o, u, l = 0, d = 0; if ("audio" === t.type) for (e ? (s = e, (e = new Uint8Array(s.byteLength + t.data.byteLength)).set(s), e.set(t.data, s.byteLength)) : e = t.data; l + 5 < e.length;) if (255 === e[l] && 240 == (246 & e[l + 1])) { if (r = 2 * (1 & ~e[l + 1]), i = (3 & e[l + 3]) << 11 | e[l + 4] << 3 | (224 & e[l + 5]) >> 5, u = 9e4 * (o = 1024 * (1 + (3 & e[l + 6]))) / a[(60 & e[l + 2]) >>> 2], n = l + i, e.byteLength < n) return; if (this.trigger("data", { pts: t.pts + d * u, dts: t.dts + d * u, sampleCount: o, audioobjecttype: 1 + (e[l + 2] >>> 6 & 3), channelcount: (1 & e[l + 2]) << 2 | (192 & e[l + 3]) >>> 6, samplerate: a[(60 & e[l + 2]) >>> 2], samplingfrequencyindex: (60 & e[l + 2]) >>> 2, samplesize: 16, data: e.subarray(l + 7 + r, n) }), e.byteLength === n) return void(e = void 0); d++, e = e.subarray(n) } else l++ }, this.flush = function() { this.trigger("done") } }).prototype = new n, t.exports = r }, { "../utils/stream.js": 62 }], 41: [function(e, t, i) { "use strict"; var r, n, a, s = e("../utils/stream.js"), o = e("../utils/exp-golomb.js"); (n = function() { var e, t, i = 0; n.prototype.init.call(this), this.push = function(r) { var n; for (t ? ((n = new Uint8Array(t.byteLength + r.data.byteLength)).set(t), n.set(r.data, t .byteLength), t = n) : t = r.data; i < t.byteLength - 3; i++) if (1 === t[i + 2]) { e = i + 5; break } for (; e < t.byteLength;) switch (t[e]) { case 0: if (0 !== t[e - 1]) { e += 2; break } if (0 !== t[e - 2]) { e++; break } i + 3 !== e - 2 && this.trigger("data", t.subarray(i + 3, e - 2)); do { e++ } while (1 !== t[e] && e < t.length); i = e - 2, e += 3; break; case 1: if (0 !== t[e - 1] || 0 !== t[e - 2]) { e += 3; break } this.trigger("data", t.subarray(i + 3, e - 2)), i = e - 2, e += 3; break; default: e += 3 } t = t.subarray(i), e -= i, i = 0 }, this.flush = function() { t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)), t = null, i = 0, this.trigger( "done") } }).prototype = new s, a = { 100: !0, 110: !0, 122: !0, 244: !0, 44: !0, 83: !0, 86: !0, 118: !0, 128: !0, 138: !0, 139: !0, 134: !0 }, (r = function() { var e, t, i, s, u, l, d, c = new n; r.prototype.init.call(this), e = this, this.push = function(e) { "video" === e.type && (t = e.trackId, i = e.pts, s = e.dts, c.push(e)) }, c.on("data", function(r) { var n = { trackId: t, pts: i, dts: s, data: r }; switch (31 & r[0]) { case 5: n.nalUnitType = "slice_layer_without_partitioning_rbsp_idr"; break; case 6: n.nalUnitType = "sei_rbsp", n.escapedRBSP = u(r.subarray(1)); break; case 7: n.nalUnitType = "seq_parameter_set_rbsp", n.escapedRBSP = u(r.subarray(1)), n.config = l(n.escapedRBSP); break; case 8: n.nalUnitType = "pic_parameter_set_rbsp"; break; case 9: n.nalUnitType = "access_unit_delimiter_rbsp" } e.trigger("data", n) }), c.on("done", function() { e.trigger("done") }), this.flush = function() { c.flush() }, d = function(e, t) { var i, r = 8, n = 8; for (i = 0; i < e; i++) 0 !== n && (n = (r + t.readExpGolomb() + 256) % 256), r = 0 === n ? r : n }, u = function(e) { for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ? (n.push(a + 2), a += 2) : a++; if (0 === n.length) return e; t = r - n.length, i = new Uint8Array(t); var s = 0; for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s]; return i }, l = function(e) { var t, i, r, n, s, u, l, c, h, f, p, m, g, v = 0, y = 0, _ = 0, b = 0, w = 1; if (i = (t = new o(e)).readUnsignedByte(), n = t.readUnsignedByte(), r = t.readUnsignedByte(), t.skipUnsignedExpGolomb(), a[i] && (3 === (s = t.readUnsignedExpGolomb()) && t.skipBits(1), t.skipUnsignedExpGolomb(), t.skipUnsignedExpGolomb(), t.skipBits(1), t.readBoolean())) for (p = 3 !== s ? 8 : 12, g = 0; g < p; g++) t.readBoolean() && d(g < 6 ? 16 : 64, t); if (t.skipUnsignedExpGolomb(), 0 === (u = t.readUnsignedExpGolomb())) t .readUnsignedExpGolomb(); else if (1 === u) for (t.skipBits(1), t.skipExpGolomb(), t.skipExpGolomb(), l = t.readUnsignedExpGolomb(), g = 0; g < l; g++) t.skipExpGolomb(); if (t.skipUnsignedExpGolomb(), t.skipBits(1), c = t.readUnsignedExpGolomb(), h = t .readUnsignedExpGolomb(), 0 === (f = t.readBits(1)) && t.skipBits(1), t.skipBits(1), t .readBoolean() && (v = t.readUnsignedExpGolomb(), y = t.readUnsignedExpGolomb(), _ = t .readUnsignedExpGolomb(), b = t.readUnsignedExpGolomb()), t.readBoolean() && t .readBoolean()) { switch (t.readUnsignedByte()) { case 1: m = [1, 1]; break; case 2: m = [12, 11]; break; case 3: m = [10, 11]; break; case 4: m = [16, 11]; break; case 5: m = [40, 33]; break; case 6: m = [24, 11]; break; case 7: m = [20, 11]; break; case 8: m = [32, 11]; break; case 9: m = [80, 33]; break; case 10: m = [18, 11]; break; case 11: m = [15, 11]; break; case 12: m = [64, 33]; break; case 13: m = [160, 99]; break; case 14: m = [4, 3]; break; case 15: m = [3, 2]; break; case 16: m = [2, 1]; break; case 255: m = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t .readUnsignedByte() ] } m && (w = m[0] / m[1]) } return { profileIdc: i, levelIdc: r, profileCompatibility: n, width: Math.ceil((16 * (c + 1) - 2 * v - 2 * y) * w), height: (2 - f) * (h + 1) * 16 - 2 * _ - 2 * b } } }).prototype = new s, t.exports = { H264Stream: r, NalByteStream: n } }, { "../utils/exp-golomb.js": 61, "../utils/stream.js": 62 }], 42: [function(e, t, i) { var r, n = [33, 16, 5, 32, 164, 27], a = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252], s = function(e) { for (var t = []; e--;) t.push(0); return t }, o = { 96000: [n, [227, 64], s(154), [56]], 88200: [n, [231], s(170), [56]], 64000: [n, [248, 192], s(240), [56]], 48000: [n, [255, 192], s(268), [55, 148, 128], s(54), [112]], 44100: [n, [255, 192], s(268), [55, 163, 128], s(84), [112]], 32000: [n, [255, 192], s(268), [55, 234], s(226), [112]], 24000: [n, [255, 192], s(268), [55, 255, 128], s(268), [111, 112], s(126), [224]], 16000: [n, [255, 192], s(268), [55, 255, 128], s(268), [111, 255], s(269), [223, 108], s(195), [1, 192 ]], 12000: [a, s(268), [3, 127, 248], s(268), [6, 255, 240], s(268), [13, 255, 224], s(268), [27, 253, 128 ], s(259), [56]], 11025: [a, s(268), [3, 127, 248], s(268), [6, 255, 240], s(268), [13, 255, 224], s(268), [27, 255, 192 ], s(268), [55, 175, 128], s(108), [112]], 8000: [a, s(268), [3, 121, 16], s(47), [7]] }; t.exports = (r = o, Object.keys(r).reduce(function(e, t) { return e[t] = new Uint8Array(r[t].reduce(function(e, t) { return e.concat(t) }, [])), e }, {})) }, {}], 43: [function(e, t, i) { "use strict"; var r = e("../utils/stream.js"), n = function(e) { this.numberOfTracks = 0, this.metadataStream = e.metadataStream, this.videoTags = [], this .audioTags = [], this.videoTrack = null, this.audioTrack = null, this.pendingCaptions = [], this .pendingMetadata = [], this.pendingTracks = 0, this.processedTracks = 0, n.prototype.init.call( this), this.push = function(e) { return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : ( "video" === e.track.type && (this.videoTrack = e.track, this.videoTags = e.tags, this .pendingTracks++), void("audio" === e.track.type && (this.audioTrack = e.track, this .audioTags = e.tags, this.pendingTracks++))) } }; n.prototype = new r, n.prototype.flush = function(e) { var t, i, r, n, a = { tags: {}, captions: [], captionStreams: {}, metadata: [] }; if (this.pendingTracks < this.numberOfTracks) { if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return; if (0 === this.pendingTracks && (this.processedTracks++, this.processedTracks < this .numberOfTracks)) return } if (this.processedTracks += this.pendingTracks, this.pendingTracks = 0, !(this.processedTracks < this.numberOfTracks)) { for (this.videoTrack ? n = this.videoTrack.timelineStartInfo.pts : this.audioTrack && (n = this .audioTrack.timelineStartInfo.pts), a.tags.videoTags = this.videoTags, a.tags.audioTags = this .audioTags, r = 0; r < this.pendingCaptions.length; r++)(i = this.pendingCaptions[r]) .startTime = i.startPts - n, i.startTime /= 9e4, i.endTime = i.endPts - n, i.endTime /= 9e4, a .captionStreams[i.stream] = !0, a.captions.push(i); for (r = 0; r < this.pendingMetadata.length; r++)(t = this.pendingMetadata[r]).cueTime = t.pts - n, t.cueTime /= 9e4, a.metadata.push(t); a.metadata.dispatchType = this.metadataStream.dispatchType, this.videoTrack = null, this .audioTrack = null, this.videoTags = [], this.audioTags = [], this.pendingCaptions.length = 0, this.pendingMetadata.length = 0, this.pendingTracks = 0, this.processedTracks = 0, this.trigger( "data", a), this.trigger("done") } }, t.exports = n }, { "../utils/stream.js": 62 }], 44: [function(e, t, i) { "use strict"; var r = e("./flv-tag.js"); t.exports = function(e, t, i) { var n, a, s, o = new Uint8Array(9), u = new DataView(o.buffer); return e = e || 0, t = void 0 === t || t, i = void 0 === i || i, u.setUint8(0, 70), u.setUint8(1, 76), u.setUint8(2, 86), u.setUint8(3, 1), u.setUint8(4, (t ? 4 : 0) | (i ? 1 : 0)), u.setUint32( 5, o.byteLength), e <= 0 ? ((a = new Uint8Array(o.byteLength + 4)).set(o), a.set([0, 0, 0, 0], o .byteLength), a) : ((n = new r(r.METADATA_TAG)).pts = n.dts = 0, n.writeMetaDataDouble( "duration", e), s = n.finalize().length, (a = new Uint8Array(o.byteLength + s)).set(o), a.set( u.byteLength, s), a) } }, { "./flv-tag.js": 45 }], 45: [function(e, t, i) { "use strict"; var r; (r = function(e, t) { var i, n = 0, a = 16384, s = function(e, t) { var i, r = e.position + t; r < e.bytes.byteLength || ((i = new Uint8Array(2 * r)).set(e.bytes.subarray(0, e.position), 0), e.bytes = i, e.view = new DataView(e.bytes.buffer)) }, o = r.widthBytes || new Uint8Array("width".length), u = r.heightBytes || new Uint8Array("height".length), l = r.videocodecidBytes || new Uint8Array("videocodecid".length); if (!r.widthBytes) { for (i = 0; i < "width".length; i++) o[i] = "width".charCodeAt(i); for (i = 0; i < "height".length; i++) u[i] = "height".charCodeAt(i); for (i = 0; i < "videocodecid".length; i++) l[i] = "videocodecid".charCodeAt(i); r.widthBytes = o, r.heightBytes = u, r.videocodecidBytes = l } switch (this.keyFrame = !1, e) { case r.VIDEO_TAG: this.length = 16, a *= 6; break; case r.AUDIO_TAG: this.length = 13, this.keyFrame = !0; break; case r.METADATA_TAG: this.length = 29, this.keyFrame = !0; break; default: throw new Error("Unknown FLV tag type") } this.bytes = new Uint8Array(a), this.view = new DataView(this.bytes.buffer), this.bytes[0] = e, this .position = this.length, this.keyFrame = t, this.pts = 0, this.dts = 0, this.writeBytes = function(e, t, i) { var r, n = t || 0; r = n + (i = i || e.byteLength), s(this, i), this.bytes.set(e.subarray(n, r), this.position), this.position += i, this.length = Math.max(this.length, this.position) }, this.writeByte = function(e) { s(this, 1), this.bytes[this.position] = e, this.position++, this.length = Math.max(this.length, this.position) }, this.writeShort = function(e) { s(this, 2), this.view.setUint16(this.position, e), this.position += 2, this.length = Math.max( this.length, this.position) }, this.negIndex = function(e) { return this.bytes[this.length - e] }, this.nalUnitSize = function() { return 0 === n ? 0 : this.length - (n + 4) }, this.startNalUnit = function() { if (n > 0) throw new Error("Attempted to create new NAL wihout closing the old one"); n = this.length, this.length += 4, this.position = this.length }, this.endNalUnit = function(e) { var t, i; this.length === n + 4 ? this.length -= 4 : n > 0 && (t = n + 4, i = this.length - t, this .position = n, this.view.setUint32(this.position, i), this.position = this.length, e && e .push(this.bytes.subarray(t, t + i))), n = 0 }, this.writeMetaDataDouble = function(e, t) { var i; if (s(this, 2 + e.length + 9), this.view.setUint16(this.position, e.length), this.position += 2, "width" === e) this.bytes.set(o, this.position), this.position += 5; else if ("height" === e) this.bytes.set(u, this.position), this.position += 6; else if ("videocodecid" === e) this.bytes.set(l, this.position), this.position += 12; else for (i = 0; i < e.length; i++) this.bytes[this.position] = e.charCodeAt(i), this.position++; this.position++, this.view.setFloat64(this.position, t), this.position += 8, this.length = Math .max(this.length, this.position), ++n }, this.writeMetaDataBoolean = function(e, t) { var i; for (s(this, 2), this.view.setUint16(this.position, e.length), this.position += 2, i = 0; i < e .length; i++) s(this, 1), this.bytes[this.position] = e.charCodeAt(i), this.position++; s(this, 2), this.view.setUint8(this.position, 1), this.position++, this.view.setUint8(this .position, t ? 1 : 0), this.position++, this.length = Math.max(this.length, this.position), ++n }, this.finalize = function() { var e, i; switch (this.bytes[0]) { case r.VIDEO_TAG: this.bytes[11] = 7 | (this.keyFrame || t ? 16 : 32), this.bytes[12] = t ? 0 : 1, e = this .pts - this.dts, this.bytes[13] = (16711680 & e) >>> 16, this.bytes[14] = (65280 & e) >>> 8, this.bytes[15] = (255 & e) >>> 0; break; case r.AUDIO_TAG: this.bytes[11] = 175, this.bytes[12] = t ? 0 : 1; break; case r.METADATA_TAG: this.position = 11, this.view.setUint8(this.position, 2), this.position++, this.view .setUint16(this.position, 10), this.position += 2, this.bytes.set([111, 110, 77, 101, 116, 97, 68, 97, 116, 97 ], this.position), this.position += 10, this.bytes[this.position] = 8, this.position++, this.view.setUint32(this.position, n), this.position = this.length, this.bytes.set([0, 0, 9 ], this.position), this.position += 3, this.length = this.position } return i = this.length - 11, this.bytes[1] = (16711680 & i) >>> 16, this.bytes[2] = (65280 & i) >>> 8, this.bytes[3] = (255 & i) >>> 0, this.bytes[4] = (16711680 & this.dts) >>> 16, this .bytes[5] = (65280 & this.dts) >>> 8, this.bytes[6] = (255 & this.dts) >>> 0, this.bytes[7] = (4278190080 & this.dts) >>> 24, this.bytes[8] = 0, this.bytes[9] = 0, this.bytes[10] = 0, s( this, 4), this.view.setUint32(this.length, this.length), this.length += 4, this.position += 4, this.bytes = this.bytes.subarray(0, this.length), this.frameTime = r.frameTime(this.bytes), this } }).AUDIO_TAG = 8, r.VIDEO_TAG = 9, r.METADATA_TAG = 18, r.isAudioFrame = function(e) { return r.AUDIO_TAG === e[0] }, r.isVideoFrame = function(e) { return r.VIDEO_TAG === e[0] }, r.isMetaData = function(e) { return r.METADATA_TAG === e[0] }, r.isKeyFrame = function(e) { return r.isVideoFrame(e) ? 23 === e[11] : !!r.isAudioFrame(e) || !!r.isMetaData(e) }, r.frameTime = function(e) { var t = e[4] << 16; return t |= e[5] << 8, t |= e[6] << 0, t |= e[7] << 24 }, t.exports = r }, {}], 46: [function(e, t, i) { t.exports = { tag: e("./flv-tag"), Transmuxer: e("./transmuxer"), getFlvHeader: e("./flv-header") } }, { "./flv-header": 44, "./flv-tag": 45, "./transmuxer": 48 }], 47: [function(e, t, i) { "use strict"; t.exports = function() { var e = this; this.list = [], this.push = function(e) { this.list.push({ bytes: e.bytes, dts: e.dts, pts: e.pts, keyFrame: e.keyFrame, metaDataTag: e.metaDataTag }) }, Object.defineProperty(this, "length", { get: function() { return e.list.length } }) } }, {}], 48: [function(e, t, i) { "use strict"; var r, n, a, s, o, u, l = e("../utils/stream.js"), d = e("./flv-tag.js"), c = e("../m2ts/m2ts.js"), h = e("../codecs/adts.js"), f = e("../codecs/h264").H264Stream, p = e("./coalesce-stream.js"), m = e("./tag-list.js"); s = function(e, t) { "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts ? e.timelineStartInfo.pts = t.pts : e.timelineStartInfo.pts = Math.min(e.timelineStartInfo.pts, t.pts)), "number" == typeof t.dts && (void 0 === e.timelineStartInfo.dts ? e.timelineStartInfo.dts = t.dts : e.timelineStartInfo.dts = Math.min(e.timelineStartInfo.dts, t.dts)) }, o = function(e, t) { var i = new d(d.METADATA_TAG); return i.dts = t, i.pts = t, i.writeMetaDataDouble("videocodecid", 7), i.writeMetaDataDouble( "width", e.width), i.writeMetaDataDouble("height", e.height), i }, u = function(e, t) { var i, r = new d(d.VIDEO_TAG, !0); for (r.dts = t, r.pts = t, r.writeByte(1), r.writeByte(e.profileIdc), r.writeByte(e .profileCompatibility), r.writeByte(e.levelIdc), r.writeByte(255), r.writeByte(225), r .writeShort(e.sps[0].length), r.writeBytes(e.sps[0]), r.writeByte(e.pps.length), i = 0; i < e.pps .length; ++i) r.writeShort(e.pps[i].length), r.writeBytes(e.pps[i]); return r }, (a = function(e) { var t, i = [], r = []; a.prototype.init.call(this), this.push = function(t) { s(e, t), e && (e.audioobjecttype = t.audioobjecttype, e.channelcount = t.channelcount, e .samplerate = t.samplerate, e.samplingfrequencyindex = t.samplingfrequencyindex, e .samplesize = t.samplesize, e.extraData = e.audioobjecttype << 11 | e .samplingfrequencyindex << 7 | e.channelcount << 3), t.pts = Math.round(t.pts / 90), t .dts = Math.round(t.dts / 90), i.push(t) }, this.flush = function() { var n, a, s, o = new m; if (0 !== i.length) { for (s = -1 / 0; i.length;) n = i.shift(), r.length && n.pts >= r[0] && (s = r.shift(), this .writeMetaDataTags(o, s)), (e.extraData !== t || n.pts - s >= 1e3) && (this .writeMetaDataTags(o, n.pts), t = e.extraData, s = n.pts), (a = new d(d.AUDIO_TAG)) .pts = n.pts, a.dts = n.dts, a.writeBytes(n.data), o.push(a.finalize()); r.length = 0, t = null, this.trigger("data", { track: e, tags: o.list }), this.trigger("done", "AudioSegmentStream") } else this.trigger("done", "AudioSegmentStream") }, this.writeMetaDataTags = function(t, i) { var r; (r = new d(d.METADATA_TAG)).pts = i, r.dts = i, r.writeMetaDataDouble("audiocodecid", 10), r .writeMetaDataBoolean("stereo", 2 === e.channelcount), r.writeMetaDataDouble( "audiosamplerate", e.samplerate), r.writeMetaDataDouble("audiosamplesize", 16), t.push(r .finalize()), (r = new d(d.AUDIO_TAG, !0)).pts = i, r.dts = i, r.view.setUint16(r .position, e.extraData), r.position += 2, r.length = Math.max(r.length, r.position), t .push(r.finalize()) }, this.onVideoKeyFrame = function(e) { r.push(e) } }).prototype = new l, (n = function(e) { var t, i, r = []; n.prototype.init.call(this), this.finishFrame = function(r, n) { if (n) { if (t && e && e.newMetadata && (n.keyFrame || 0 === r.length)) { var a = o(t, n.dts).finalize(), s = u(e, n.dts).finalize(); a.metaDataTag = s.metaDataTag = !0, r.push(a), r.push(s), e.newMetadata = !1, this .trigger("keyframe", n.dts) } n.endNalUnit(), r.push(n.finalize()), i = null } }, this.push = function(t) { s(e, t), t.pts = Math.round(t.pts / 90), t.dts = Math.round(t.dts / 90), r.push(t) }, this.flush = function() { for (var n, a = new m; r.length && "access_unit_delimiter_rbsp" !== r[0].nalUnitType;) r .shift(); if (0 !== r.length) { for (; r.length;) "seq_parameter_set_rbsp" === (n = r.shift()).nalUnitType ? (e .newMetadata = !0, t = n.config, e.width = t.width, e.height = t.height, e.sps = [n .data], e.profileIdc = t.profileIdc, e.levelIdc = t.levelIdc, e.profileCompatibility = t.profileCompatibility, i.endNalUnit()) : "pic_parameter_set_rbsp" === n.nalUnitType ? ( e.newMetadata = !0, e.pps = [n.data], i.endNalUnit()) : "access_unit_delimiter_rbsp" === n.nalUnitType ? (i && this.finishFrame(a, i), (i = new d(d.VIDEO_TAG)).pts = n.pts, i .dts = n.dts) : ("slice_layer_without_partitioning_rbsp_idr" === n.nalUnitType && (i .keyFrame = !0), i.endNalUnit()), i.startNalUnit(), i.writeBytes(n.data); i && this.finishFrame(a, i), this.trigger("data", { track: e, tags: a.list }), this.trigger("done", "VideoSegmentStream") } else this.trigger("done", "VideoSegmentStream") } }).prototype = new l, (r = function(e) { var t, i, s, o, u, l, d, m, g, v, y, _, b = this; r.prototype.init.call(this), e = e || {}, this.metadataStream = new c.MetadataStream, e .metadataStream = this.metadataStream, t = new c.TransportPacketStream, i = new c .TransportParseStream, s = new c.ElementaryStream, o = new c.TimestampRolloverStream("video"), u = new c.TimestampRolloverStream("audio"), l = new c.TimestampRolloverStream("timed-metadata"), d = new h, m = new f, _ = new p(e), t.pipe(i).pipe(s), s.pipe(o).pipe(m), s.pipe(u).pipe(d), s .pipe(l).pipe(this.metadataStream).pipe(_), y = new c.CaptionStream, m.pipe(y).pipe(_), s.on( "data", function(e) { var t, i, r; if ("metadata" === e.type) { for (t = e.tracks.length; t--;) "video" === e.tracks[t].type ? i = e.tracks[t] : "audio" === e.tracks[t].type && (r = e.tracks[t]); i && !g && (_.numberOfTracks++, g = new n(i), m.pipe(g).pipe(_)), r && !v && (_ .numberOfTracks++, v = new a(r), d.pipe(v).pipe(_), g && g.on("keyframe", v .onVideoKeyFrame)) } }), this.push = function(e) { t.push(e) }, this.flush = function() { t.flush() }, this.resetCaptions = function() { y.reset() }, _.on("data", function(e) { b.trigger("data", e) }), _.on("done", function() { b.trigger("done") }) }).prototype = new l, t.exports = r }, { "../codecs/adts.js": 40, "../codecs/h264": 41, "../m2ts/m2ts.js": 50, "../utils/stream.js": 62, "./coalesce-stream.js": 43, "./flv-tag.js": 45, "./tag-list.js": 47 }], 49: [function(e, t, i) { "use strict"; var r = e("../utils/stream"), n = function() { n.prototype.init.call(this), this.captionPackets_ = [], this.ccStreams_ = [new l(0, 0), new l(0, 1), new l(1, 0), new l(1, 1) ], this.reset(), this.ccStreams_.forEach(function(e) { e.on("data", this.trigger.bind(this, "data")), e.on("done", this.trigger.bind(this, "done")) }, this) }; n.prototype = new r, n.prototype.push = function(e) { var t, i; "sei_rbsp" === e.nalUnitType && 4 === (t = function(e) { for (var t = 0, i = { payloadType: -1, payloadSize: 0 }, r = 0, n = 0; t < e.byteLength && 128 !== e[t];) { for (; 255 === e[t];) r += 255, t++; for (r += e[t++]; 255 === e[t];) n += 255, t++; if (n += e[t++], !i.payload && 4 === r) { i.payloadType = r, i.payloadSize = n, i.payload = e.subarray(t, t + n); break } t += n, r = 0, n = 0 } return i }(e.escapedRBSP)).payloadType && (i = function(e) { return 181 !== e.payload[0] ? null : 49 != (e.payload[1] << 8 | e.payload[2]) ? null : "GA94" !== String.fromCharCode(e.payload[3], e.payload[4], e.payload[5], e.payload[6]) ? null : 3 !== e.payload[7] ? null : e.payload.subarray(8, e.payload.length - 1) }(t)) && (e.dts < this.latestDts_ ? this.ignoreNextEqualDts_ = !0 : e.dts === this.latestDts_ && this.ignoreNextEqualDts_ ? this.ignoreNextEqualDts_ = !1 : (this.captionPackets_ = this .captionPackets_.concat(function(e, t) { var i, r, n, a, s = []; if (!(64 & t[0])) return s; for (r = 31 & t[0], i = 0; i < r; i++) a = { type: 3 & t[2 + (n = 3 * i)], pts: e }, 4 & t[n + 2] && (a.ccData = t[n + 3] << 8 | t[n + 4], s.push(a)); return s }(e.pts, i)), this.latestDts_ = e.dts)) }, n.prototype.flush = function() { this.captionPackets_.length ? (this.captionPackets_.forEach(function(e, t) { e.presortIndex = t }), this.captionPackets_.sort(function(e, t) { return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts }), this.captionPackets_.forEach(function(e) { e.type < 2 && this.dispatchCea608Packet(e) }, this), this.captionPackets_.length = 0, this.ccStreams_.forEach(function(e) { e.flush() }, this)) : this.ccStreams_.forEach(function(e) { e.flush() }, this) }, n.prototype.reset = function() { this.latestDts_ = null, this.ignoreNextEqualDts_ = !1, this.activeCea608Channel_ = [null, null], this.ccStreams_.forEach(function(e) { e.reset() }) }, n.prototype.dispatchCea608Packet = function(e) { this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && ( this.activeCea608Channel_[e.type] = 1), null !== this.activeCea608Channel_[e.type] && this .ccStreams_[(e.type << 1) + this.activeCea608Channel_[e.type]].push(e) }, n.prototype.setsChannel1Active = function(e) { return 4096 == (30720 & e.ccData) }, n.prototype.setsChannel2Active = function(e) { return 6144 == (30720 & e.ccData) }; var a = { 42: 225, 92: 233, 94: 237, 95: 243, 96: 250, 123: 231, 124: 247, 125: 209, 126: 241, 127: 9608, 304: 174, 305: 176, 306: 189, 307: 191, 308: 8482, 309: 162, 310: 163, 311: 9834, 312: 224, 313: 160, 314: 232, 315: 226, 316: 234, 317: 238, 318: 244, 319: 251, 544: 193, 545: 201, 546: 211, 547: 218, 548: 220, 549: 252, 550: 8216, 551: 161, 552: 42, 553: 39, 554: 8212, 555: 169, 556: 8480, 557: 8226, 558: 8220, 559: 8221, 560: 192, 561: 194, 562: 199, 563: 200, 564: 202, 565: 203, 566: 235, 567: 206, 568: 207, 569: 239, 570: 212, 571: 217, 572: 249, 573: 219, 574: 171, 575: 187, 800: 195, 801: 227, 802: 205, 803: 204, 804: 236, 805: 210, 806: 242, 807: 213, 808: 245, 809: 123, 810: 125, 811: 92, 812: 94, 813: 95, 814: 124, 815: 126, 816: 196, 817: 228, 818: 214, 819: 246, 820: 223, 821: 165, 822: 164, 823: 9474, 824: 197, 825: 229, 826: 216, 827: 248, 828: 9484, 829: 9488, 830: 9492, 831: 9496 }, s = function(e) { return null === e ? "" : (e = a[e] || e, String.fromCharCode(e)) }, o = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152], u = function() { for (var e = [], t = 15; t--;) e.push(""); return e }, l = function(e, t) { l.prototype.init.call(this), this.field_ = e || 0, this.dataChannel_ = t || 0, this.name_ = "CC" + ( 1 + (this.field_ << 1 | this.dataChannel_)), this.setConstants(), this.reset(), this.push = function(e) { var t, i, r, n, a; if ((t = 32639 & e.ccData) !== this.lastControlCode_) { if (4096 == (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this .lastControlCode_ = null), r = t >>> 8, n = 255 & t, t !== this.PADDING_) if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn"; else if (t === this.END_OF_CAPTION_) this.clearFormatting(e.pts), this.flushDisplayed(e .pts), i = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ = i, this.startPts_ = e.pts; else if (t === this.ROLL_UP_2_ROWS_) this.topRow_ = 13, this.mode_ = "rollUp"; else if (t === this.ROLL_UP_3_ROWS_) this.topRow_ = 12, this.mode_ = "rollUp"; else if (t === this.ROLL_UP_4_ROWS_) this.topRow_ = 11, this.mode_ = "rollUp"; else if (t === this.CARRIAGE_RETURN_) this.clearFormatting(e.pts), this.flushDisplayed(e.pts), this.shiftRowsUp_(), this.startPts_ = e.pts; else if (t === this.BACKSPACE_) "popOn" === this.mode_ ? this.nonDisplayed_[14] = this .nonDisplayed_[14].slice(0, -1) : this.displayed_[14] = this.displayed_[14].slice(0, -1); else if (t === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(e.pts), this.displayed_ = u(); else if (t === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = u(); else if (t === this.RESUME_DIRECT_CAPTIONING_) this.mode_ = "paintOn"; else if (this.isSpecialCharacter(r, n)) a = s((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++; else if (this.isExtCharacter(r, n)) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[14] = this.displayed_[14] .slice(0, -1), a = s((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++; else if (this.isMidRowCode(r, n)) this.clearFormatting(e.pts), this[this.mode_](e.pts, " "), this.column_++, 14 == (14 & n) && this.addFormatting(e.pts, ["i"]), 1 == (1 & n) && this .addFormatting(e.pts, ["u"]); else if (this.isOffsetControlCode(r, n)) this.column_ += 3 & n; else if (this.isPAC(r, n)) { var l = o.indexOf(7968 & t); l !== this.row_ && (this.clearFormatting(e.pts), this.row_ = l), 1 & n && -1 === this .formatting_.indexOf("u") && this.addFormatting(e.pts, ["u"]), 16 == (16 & t) && (this .column_ = 4 * ((14 & t) >> 1)), this.isColorPAC(n) && 14 == (14 & n) && this .addFormatting(e.pts, ["i"]) } else this.isNormalChar(r) && (0 === n && (n = null), a = s(r), a += s(n), this[this.mode_](e .pts, a), this.column_ += a.length) } else this.lastControlCode_ = null } }; l.prototype = new r, l.prototype.flushDisplayed = function(e) { var t = this.displayed_.map(function(e) { return e.trim() }).join("\n").replace(/^\n+|\n+$/g, ""); t.length && this.trigger("data", { startPts: this.startPts_, endPts: e, text: t, stream: this.name_ }) }, l.prototype.reset = function() { this.mode_ = "popOn", this.topRow_ = 0, this.startPts_ = 0, this.displayed_ = u(), this .nonDisplayed_ = u(), this.lastControlCode_ = null, this.column_ = 0, this.row_ = 14, this .formatting_ = [] }, l.prototype.setConstants = function() { 0 === this.dataChannel_ ? (this.BASE_ = 16, this.EXT_ = 17, this.CONTROL_ = (20 | this.field_) << 8, this.OFFSET_ = 23) : 1 === this.dataChannel_ && (this.BASE_ = 24, this.EXT_ = 25, this .CONTROL_ = (28 | this.field_) << 8, this.OFFSET_ = 31), this.PADDING_ = 0, this .RESUME_CAPTION_LOADING_ = 32 | this.CONTROL_, this.END_OF_CAPTION_ = 47 | this.CONTROL_, this .ROLL_UP_2_ROWS_ = 37 | this.CONTROL_, this.ROLL_UP_3_ROWS_ = 38 | this.CONTROL_, this .ROLL_UP_4_ROWS_ = 39 | this.CONTROL_, this.CARRIAGE_RETURN_ = 45 | this.CONTROL_, this .RESUME_DIRECT_CAPTIONING_ = 41 | this.CONTROL_, this.BACKSPACE_ = 33 | this.CONTROL_, this .ERASE_DISPLAYED_MEMORY_ = 44 | this.CONTROL_, this.ERASE_NON_DISPLAYED_MEMORY_ = 46 | this .CONTROL_ }, l.prototype.isSpecialCharacter = function(e, t) { return e === this.EXT_ && t >= 48 && t <= 63 }, l.prototype.isExtCharacter = function(e, t) { return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && t <= 63 }, l.prototype.isMidRowCode = function(e, t) { return e === this.EXT_ && t >= 32 && t <= 47 }, l.prototype.isOffsetControlCode = function(e, t) { return e === this.OFFSET_ && t >= 33 && t <= 35 }, l.prototype.isPAC = function(e, t) { return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && t <= 127 }, l.prototype.isColorPAC = function(e) { return e >= 64 && e <= 79 || e >= 96 && e <= 127 }, l.prototype.isNormalChar = function(e) { return e >= 32 && e <= 127 }, l.prototype.addFormatting = function(e, t) { this.formatting_ = this.formatting_.concat(t); var i = t.reduce(function(e, t) { return e + "<" + t + ">" }, ""); this[this.mode_](e, i) }, l.prototype.clearFormatting = function(e) { if (this.formatting_.length) { var t = this.formatting_.reverse().reduce(function(e, t) { return e + "" }, ""); this.formatting_ = [], this[this.mode_](e, t) } }, l.prototype.popOn = function(e, t) { var i = this.nonDisplayed_[this.row_]; i += t, this.nonDisplayed_[this.row_] = i }, l.prototype.rollUp = function(e, t) { var i = this.displayed_[14]; i += t, this.displayed_[14] = i }, l.prototype.shiftRowsUp_ = function() { var e; for (e = 0; e < this.topRow_; e++) this.displayed_[e] = ""; for (e = this.topRow_; e < 14; e++) this.displayed_[e] = this.displayed_[e + 1]; this.displayed_[14] = "" }, l.prototype.paintOn = function() {}, t.exports = { CaptionStream: n, Cea608Stream: l } }, { "../utils/stream": 62 }], 50: [function(e, t, i) { "use strict"; var r, n, a, s = e("../utils/stream.js"), o = e("./caption-stream"), u = e("./stream-types"), l = e("./timestamp-rollover-stream").TimestampRolloverStream, d = e("./stream-types.js"); (r = function() { var e = new Uint8Array(188), t = 0; r.prototype.init.call(this), this.push = function(i) { var r, n = 0, a = 188; for (t ? ((r = new Uint8Array(i.byteLength + t)).set(e.subarray(0, t)), r.set(i, t), t = 0) : r = i; a < r.byteLength;) 71 !== r[n] || 71 !== r[a] ? (n++, a++) : (this.trigger("data", r .subarray(n, a)), n += 188, a += 188); n < r.byteLength && (e.set(r.subarray(n), 0), t = r.byteLength - n) }, this.flush = function() { 188 === t && 71 === e[0] && (this.trigger("data", e), t = 0), this.trigger("done") } }).prototype = new s, (n = function() { var e, t, i, r; n.prototype.init.call(this), r = this, this.packetsWaitingForPmt = [], this.programMapTable = void 0, e = function(e, r) { var n = 0; r.payloadUnitStartIndicator && (n += e[n] + 1), "pat" === r.type ? t(e.subarray(n), r) : i(e .subarray(n), r) }, t = function(e, t) { t.section_number = e[7], t.last_section_number = e[8], r.pmtPid = (31 & e[10]) << 8 | e[11], t .pmtPid = r.pmtPid }, i = function(e, t) { var i, n; if (1 & e[5]) { for (r.programMapTable = { video: null, audio: null, "timed-metadata": {} }, i = 3 + ((15 & e[1]) << 8 | e[2]) - 4, n = 12 + ((15 & e[10]) << 8 | e[11]); n < i;) { var a = e[n], s = (31 & e[n + 1]) << 8 | e[n + 2]; a === u.H264_STREAM_TYPE && null === r.programMapTable.video ? r.programMapTable.video = s : a === u.ADTS_STREAM_TYPE && null === r.programMapTable.audio ? r.programMapTable .audio = s : a === u.METADATA_STREAM_TYPE && (r.programMapTable["timed-metadata"][s] = a), n += 5 + ((15 & e[n + 3]) << 8 | e[n + 4]) } t.programMapTable = r.programMapTable } }, this.push = function(t) { var i = {}, r = 4; if (i.payloadUnitStartIndicator = !!(64 & t[1]), i.pid = 31 & t[1], i.pid <<= 8, i.pid |= t[ 2], (48 & t[3]) >>> 4 > 1 && (r += t[r] + 1), 0 === i.pid) i.type = "pat", e(t.subarray(r), i), this.trigger("data", i); else if (i.pid === this.pmtPid) for (i.type = "pmt", e(t.subarray(r), i), this.trigger("data", i); this.packetsWaitingForPmt .length;) this.processPes_.apply(this, this.packetsWaitingForPmt.shift()); else void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, r, i]) : this .processPes_(t, r, i) }, this.processPes_ = function(e, t, i) { i.pid === this.programMapTable.video ? i.streamType = u.H264_STREAM_TYPE : i.pid === this .programMapTable.audio ? i.streamType = u.ADTS_STREAM_TYPE : i.streamType = this .programMapTable["timed-metadata"][i.pid], i.type = "pes", i.data = e.subarray(t), this .trigger("data", i) } }).prototype = new s, n.STREAM_TYPES = { h264: 27, adts: 15 }, (a = function() { var e = this, t = { data: [], size: 0 }, i = { data: [], size: 0 }, r = { data: [], size: 0 }, n = function(t, i, r) { var n, a, s = new Uint8Array(t.size), o = { type: i }, u = 0, l = 0; if (t.data.length && !(t.size < 9)) { for (o.trackId = t.data[0].pid, u = 0; u < t.data.length; u++) a = t.data[u], s.set(a.data, l), l += a.data.byteLength; var d, c, h; d = s, (c = o).packetLength = 6 + (d[4] << 8 | d[5]), c.dataAlignmentIndicator = 0 != (4 & d[6]), 192 & (h = d[7]) && (c.pts = (14 & d[9]) << 27 | (255 & d[10]) << 20 | (254 & d[ 11]) << 12 | (255 & d[12]) << 5 | (254 & d[13]) >>> 3, c.pts *= 4, c.pts += (6 & d[ 13]) >>> 1, c.dts = c.pts, 64 & h && (c.dts = (14 & d[14]) << 27 | (255 & d[15]) << 20 | (254 & d[16]) << 12 | (255 & d[17]) << 5 | (254 & d[18]) >>> 3, c.dts *= 4, c .dts += (6 & d[18]) >>> 1)), c.data = d.subarray(9 + d[8]), n = "video" === i || o .packetLength <= t.size, (r || n) && (t.size = 0, t.data.length = 0), n && e.trigger( "data", o) } }; a.prototype.init.call(this), this.push = function(a) { ({ pat: function() {}, pes: function() { var e, s; switch (a.streamType) { case u.H264_STREAM_TYPE: case d.H264_STREAM_TYPE: e = t, s = "video"; break; case u.ADTS_STREAM_TYPE: e = i, s = "audio"; break; case u.METADATA_STREAM_TYPE: e = r, s = "timed-metadata"; break; default: return } a.payloadUnitStartIndicator && n(e, s, !0), e.data.push(a), e.size += a.data .byteLength }, pmt: function() { var t = { type: "metadata", tracks: [] }, i = a.programMapTable; null !== i.video && t.tracks.push({ timelineStartInfo: { baseMediaDecodeTime: 0 }, id: +i.video, codec: "avc", type: "video" }), null !== i.audio && t.tracks.push({ timelineStartInfo: { baseMediaDecodeTime: 0 }, id: +i.audio, codec: "adts", type: "audio" }), e.trigger("data", t) } })[a.type]() }, this.flush = function() { n(t, "video"), n(i, "audio"), n(r, "timed-metadata"), this.trigger("done") } }).prototype = new s; var c = { PAT_PID: 0, MP2T_PACKET_LENGTH: 188, TransportPacketStream: r, TransportParseStream: n, ElementaryStream: a, TimestampRolloverStream: l, CaptionStream: o.CaptionStream, Cea608Stream: o.Cea608Stream, MetadataStream: e("./metadata-stream") }; for (var h in u) u.hasOwnProperty(h) && (c[h] = u[h]); t.exports = c }, { "../utils/stream.js": 62, "./caption-stream": 49, "./metadata-stream": 51, "./stream-types": 53, "./stream-types.js": 53, "./timestamp-rollover-stream": 54 }], 51: [function(e, t, i) { "use strict"; var r, n = e("../utils/stream"), a = e("./stream-types"), s = function(e, t, i) { var r, n = ""; for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2); return n }, o = function(e, t, i) { return decodeURIComponent(s(e, t, i)) }, u = function(e) { return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3] }, l = { TXXX: function(e) { var t; if (3 === e.data[0]) { for (t = 1; t < e.data.length; t++) if (0 === e.data[t]) { e.description = o(e.data, 1, t), e.value = o(e.data, t + 1, e.data.length).replace(/\0*$/, ""); break } e.data = e.value } }, WXXX: function(e) { var t; if (3 === e.data[0]) for (t = 1; t < e.data.length; t++) if (0 === e.data[t]) { e.description = o(e.data, 1, t), e.url = o(e.data, t + 1, e.data.length); break } }, PRIV: function(e) { var t, i; for (t = 0; t < e.data.length; t++) if (0 === e.data[t]) { e.owner = (i = e.data, unescape(s(i, 0, t))); break } e.privateData = e.data.subarray(t + 1), e.data = e.privateData } }; (r = function(e) { var t, i = { debug: !(!e || !e.debug), descriptor: e && e.descriptor }, n = 0, s = [], o = 0; if (r.prototype.init.call(this), this.dispatchType = a.METADATA_STREAM_TYPE.toString(16), i .descriptor) for (t = 0; t < i.descriptor.length; t++) this.dispatchType += ("00" + i.descriptor[t].toString( 16)).slice(-2); this.push = function(e) { var t, r, a, d, c; if ("timed-metadata" === e.type) if (e.dataAlignmentIndicator && (o = 0, s.length = 0), 0 === s.length && (e.data.length < 10 || e.data[0] !== "I".charCodeAt(0) || e.data[1] !== "D".charCodeAt(0) || e.data[2] !== "3".charCodeAt(0))) i.debug && console.log("Skipping unrecognized metadata packet"); else if (s.push(e), o += e.data.byteLength, 1 === s.length && (n = u(e.data.subarray(6, 10)), n += 10), !(o < n)) { for (t = { data: new Uint8Array(n), frames: [], pts: s[0].pts, dts: s[0].dts }, c = 0; c < n;) t.data.set(s[0].data.subarray(0, n - c), c), c += s[0].data.byteLength, o -= s[0].data.byteLength, s.shift(); r = 10, 64 & t.data[5] && (r += 4, r += u(t.data.subarray(10, 14)), n -= u(t.data.subarray(16, 20))); do { if ((a = u(t.data.subarray(r + 4, r + 8))) < 1) return console.log( "Malformed ID3 frame encountered. Skipping metadata parsing."); if ((d = { id: String.fromCharCode(t.data[r], t.data[r + 1], t.data[r + 2], t.data[r + 3]), data: t.data.subarray(r + 10, r + a + 10) }).key = d.id, l[d.id] && (l[d.id](d), "com.apple.streaming.transportStreamTimestamp" === d.owner)) { var h = d.data, f = (1 & h[3]) << 30 | h[4] << 22 | h[5] << 14 | h[6] << 6 | h[7] >>> 2; f *= 4, f += 3 & h[7], d.timeStamp = f, void 0 === t.pts && void 0 === t.dts && (t.pts = d .timeStamp, t.dts = d.timeStamp), this.trigger("timestamp", d) } t.frames.push(d), r += 10, r += a } while (r < n); this.trigger("data", t) } } }).prototype = new n, t.exports = r }, { "../utils/stream": 62, "./stream-types": 53 }], 52: [function(e, t, i) { "use strict"; var r = e("./stream-types.js"), n = function(e) { var t = 31 & e[1]; return t <<= 8, t |= e[2] }, a = function(e) { return !!(64 & e[1]) }, s = function(e) { var t = 0; return (48 & e[3]) >>> 4 > 1 && (t += e[4] + 1), t }, o = function(e) { switch (e) { case 5: return "slice_layer_without_partitioning_rbsp_idr"; case 6: return "sei_rbsp"; case 7: return "seq_parameter_set_rbsp"; case 8: return "pic_parameter_set_rbsp"; case 9: return "access_unit_delimiter_rbsp"; default: return null } }; t.exports = { parseType: function(e, t) { var i = n(e); return 0 === i ? "pat" : i === t ? "pmt" : t ? "pes" : null }, parsePat: function(e) { var t = a(e), i = 4 + s(e); return t && (i += e[i] + 1), (31 & e[i + 10]) << 8 | e[i + 11] }, parsePmt: function(e) { var t = {}, i = a(e), r = 4 + s(e); if (i && (r += e[r] + 1), 1 & e[r + 5]) { var n; n = 3 + ((15 & e[r + 1]) << 8 | e[r + 2]) - 4; for (var o = 12 + ((15 & e[r + 10]) << 8 | e[r + 11]); o < n;) { var u = r + o; t[(31 & e[u + 1]) << 8 | e[u + 2]] = e[u], o += 5 + ((15 & e[u + 3]) << 8 | e[u + 4]) } return t } }, parsePayloadUnitStartIndicator: a, parsePesType: function(e, t) { switch (t[n(e)]) { case r.H264_STREAM_TYPE: return "video"; case r.ADTS_STREAM_TYPE: return "audio"; case r.METADATA_STREAM_TYPE: return "timed-metadata"; default: return null } }, parsePesTime: function(e) { if (!a(e)) return null; var t = 4 + s(e); if (t >= e.byteLength) return null; var i, r = null; return 192 & (i = e[t + 7]) && ((r = {}).pts = (14 & e[t + 9]) << 27 | (255 & e[t + 10]) << 20 | (254 & e[t + 11]) << 12 | (255 & e[t + 12]) << 5 | (254 & e[t + 13]) >>> 3, r.pts *= 4, r .pts += (6 & e[t + 13]) >>> 1, r.dts = r.pts, 64 & i && (r.dts = (14 & e[t + 14]) << 27 | ( 255 & e[t + 15]) << 20 | (254 & e[t + 16]) << 12 | (255 & e[t + 17]) << 5 | (254 & e[t + 18]) >>> 3, r.dts *= 4, r.dts += (6 & e[t + 18]) >>> 1)), r }, videoPacketContainsKeyFrame: function(e) { for (var t = 4 + s(e), i = e.subarray(t), r = 0, n = 0, a = !1; n < i.byteLength - 3; n++) if (1 === i[n + 2]) { r = n + 5; break } for (; r < i.byteLength;) switch (i[r]) { case 0: if (0 !== i[r - 1]) { r += 2; break } if (0 !== i[r - 2]) { r++; break } n + 3 !== r - 2 && "slice_layer_without_partitioning_rbsp_idr" === o(31 & i[n + 3]) && ( a = !0); do { r++ } while (1 !== i[r] && r < i.length); n = r - 2, r += 3; break; case 1: if (0 !== i[r - 1] || 0 !== i[r - 2]) { r += 3; break } "slice_layer_without_partitioning_rbsp_idr" === o(31 & i[n + 3]) && (a = !0), n = r - 2, r += 3; break; default: r += 3 } return i = i.subarray(n), r -= n, n = 0, i && i.byteLength > 3 && "slice_layer_without_partitioning_rbsp_idr" === o(31 & i[n + 3]) && (a = !0), a } } }, { "./stream-types.js": 53 }], 53: [function(e, t, i) { "use strict"; t.exports = { H264_STREAM_TYPE: 27, ADTS_STREAM_TYPE: 15, METADATA_STREAM_TYPE: 21 } }, {}], 54: [function(e, t, i) { "use strict"; var r = e("../utils/stream"), n = function(e, t) { var i = 1; for (e > t && (i = -1); Math.abs(t - e) > 4294967296;) e += 8589934592 * i; return e }, a = function(e) { var t, i; a.prototype.init.call(this), this.type_ = e, this.push = function(e) { e.type === this.type_ && (void 0 === i && (i = e.dts), e.dts = n(e.dts, i), e.pts = n(e.pts, i), t = e.dts, this.trigger("data", e)) }, this.flush = function() { i = t, this.trigger("done") }, this.discontinuity = function() { i = void 0, t = void 0 } }; a.prototype = new r, t.exports = { TimestampRolloverStream: a, handleRollover: n } }, { "../utils/stream": 62 }], 55: [function(e, t, i) { t.exports = { generator: e("./mp4-generator"), Transmuxer: e("./transmuxer").Transmuxer, AudioSegmentStream: e("./transmuxer").AudioSegmentStream, VideoSegmentStream: e("./transmuxer").VideoSegmentStream } }, { "./mp4-generator": 56, "./transmuxer": 58 }], 56: [function(e, t, i) { "use strict"; var r, n, a, s, o, u, l, d, c, h, f, p, m, g, v, y, _, b, w, E, T, S, A, k, R, M, O, C, D, I, L, x, P, U, N, B, F, j, H, G, V, W = Math.pow(2, 32) - 1; ! function() { var e; if (A = { avc1: [], avcC: [], btrt: [], dinf: [], dref: [], esds: [], ftyp: [], hdlr: [], mdat: [], mdhd: [], mdia: [], mfhd: [], minf: [], moof: [], moov: [], mp4a: [], mvex: [], mvhd: [], sdtp: [], smhd: [], stbl: [], stco: [], stsc: [], stsd: [], stsz: [], stts: [], styp: [], tfdt: [], tfhd: [], traf: [], trak: [], trun: [], trex: [], tkhd: [], vmhd: [] }, "undefined" != typeof Uint8Array) { for (e in A) A.hasOwnProperty(e) && (A[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e .charCodeAt(3) ]); k = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]), M = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]), R = new Uint8Array([0, 0, 0, 1]), O = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0 ]), C = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0 ]), D = { video: O, audio: C }, x = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), L = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), P = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), U = P, N = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), B = P, I = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]) } }(), r = function(e) { var t, i, r = [], n = 0; for (t = 1; t < arguments.length; t++) r.push(arguments[t]); for (t = r.length; t--;) n += r[t].byteLength; for (i = new Uint8Array(n + 8), new DataView(i.buffer, i.byteOffset, i.byteLength).setUint32(0, i .byteLength), i.set(e, 4), t = 0, n = 8; t < r.length; t++) i.set(r[t], n), n += r[t] .byteLength; return i }, n = function() { return r(A.dinf, r(A.dref, x)) }, a = function(e) { return r(A.esds, new Uint8Array([0, 0, 0, 0, 3, 25, 0, 0, 0, 4, 17, 64, 21, 0, 6, 0, 0, 0, 218, 192, 0, 0, 218, 192, 5, 2, e.audioobjecttype << 3 | e.samplingfrequencyindex >>> 1, e .samplingfrequencyindex << 7 | e.channelcount << 3, 6, 1, 2 ])) }, s = function() { return r(A.ftyp, k, R, k, M) }, y = function(e) { return r(A.hdlr, D[e]) }, o = function(e) { return r(A.mdat, e) }, v = function(e) { var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 1, 95, 144, e.duration >>> 24 & 255, e.duration >>> 16 & 255, e.duration >>> 8 & 255, 255 & e.duration, 85, 196, 0, 0 ]); return e.samplerate && (t[12] = e.samplerate >>> 24 & 255, t[13] = e.samplerate >>> 16 & 255, t[ 14] = e.samplerate >>> 8 & 255, t[15] = 255 & e.samplerate), r(A.mdhd, t) }, g = function(e) { return r(A.mdia, v(e), y(e.type), l(e)) }, u = function(e) { return r(A.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 & e) >> 8, 255 & e])) }, l = function(e) { return r(A.minf, "video" === e.type ? r(A.vmhd, I) : r(A.smhd, L), n(), b(e)) }, d = function(e, t) { for (var i = [], n = t.length; n--;) i[n] = E(t[n]); return r.apply(null, [A.moof, u(e)].concat(i)) }, c = function(e) { for (var t = e.length, i = []; t--;) i[t] = p(e[t]); return r.apply(null, [A.moov, f(4294967295)].concat(i).concat(h(e))) }, h = function(e) { for (var t = e.length, i = []; t--;) i[t] = T(e[t]); return r.apply(null, [A.mvex].concat(i)) }, f = function(e) { var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 95, 144, (4278190080 & e) >> 24, ( 16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 ]); return r(A.mvhd, t) }, _ = function(e) { var t, i, n = e.samples || [], a = new Uint8Array(4 + n.length); for (i = 0; i < n.length; i++) t = n[i].flags, a[i + 4] = t.dependsOn << 4 | t.isDependedOn << 2 | t .hasRedundancy; return r(A.sdtp, a) }, b = function(e) { return r(A.stbl, w(e), r(A.stts, B), r(A.stsc, U), r(A.stsz, N), r(A.stco, P)) }, w = function(e) { return r(A.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === e.type ? F(e) : j(e)) }, F = function(e) { var t, i = e.sps || [], n = e.pps || [], a = [], s = []; for (t = 0; t < i.length; t++) a.push((65280 & i[t].byteLength) >>> 8), a.push(255 & i[t] .byteLength), a = a.concat(Array.prototype.slice.call(i[t])); for (t = 0; t < n.length; t++) s.push((65280 & n[t].byteLength) >>> 8), s.push(255 & n[t] .byteLength), s = s.concat(Array.prototype.slice.call(n[t])); return r(A.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & e.width) >> 8, 255 & e.width, (65280 & e.height) >> 8, 255 & e.height, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 19, 118, 105, 100, 101, 111, 106, 115, 45, 99, 111, 110, 116, 114, 105, 98, 45, 104, 108, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17 ]), r(A.avcC, new Uint8Array([1, e.profileIdc, e.profileCompatibility, e.levelIdc, 255].concat([ i.length ]).concat(a).concat([n.length]).concat(s))), r(A.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192 ]))) }, j = function(e) { return r(A.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & e .channelcount) >> 8, 255 & e.channelcount, (65280 & e.samplesize) >> 8, 255 & e .samplesize, 0, 0, 0, 0, (65280 & e.samplerate) >> 8, 255 & e.samplerate, 0, 0 ]), a(e)) }, m = function(e) { var t = new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e .id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 0, (4278190080 & e.duration) >> 24, ( 16711680 & e.duration) >> 16, (65280 & e.duration) >> 8, 255 & e.duration, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, (65280 & e.width) >> 8, 255 & e.width, 0, 0, ( 65280 & e.height) >> 8, 255 & e.height, 0, 0 ]); return r(A.tkhd, t) }, E = function(e) { var t, i, n, a, s, o; return t = r(A.tfhd, new Uint8Array([0, 0, 0, 58, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ])), s = Math.floor(e.baseMediaDecodeTime / (W + 1)), o = Math.floor(e.baseMediaDecodeTime % (W + 1)), i = r(A.tfdt, new Uint8Array([1, 0, 0, 0, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s, o >>> 24 & 255, o >>> 16 & 255, o >>> 8 & 255, 255 & o ])), 92, "audio" === e.type ? (n = S(e, 92), r(A.traf, t, i, n)) : (a = _(e), n = S(e, a.length + 92), r(A.traf, t, i, n, a)) }, p = function(e) { return e.duration = e.duration || 4294967295, r(A.trak, m(e), g(e)) }, T = function(e) { var t = new Uint8Array([0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e .id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]); return "video" !== e.type && (t[t.length - 1] = 0), r(A.trex, t) }, V = function(e, t) { var i = 0, r = 0, n = 0, a = 0; return e.length && (void 0 !== e[0].duration && (i = 1), void 0 !== e[0].size && (r = 2), void 0 !== e[0].flags && (n = 4), void 0 !== e[0].compositionTimeOffset && (a = 8)), [0, 0, i | r | n | a, 1, (4278190080 & e.length) >>> 24, (16711680 & e.length) >>> 16, (65280 & e.length) >>> 8, 255 & e.length, (4278190080 & t) >>> 24, (16711680 & t) >>> 16, (65280 & t) >>> 8, 255 & t ] }, G = function(e, t) { var i, n, a, s; for (t += 20 + 16 * (n = e.samples || []).length, i = V(n, t), s = 0; s < n.length; s++) a = n[s], i = i.concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a .duration) >>> 8, 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>> 16, (65280 & a.size) >>> 8, 255 & a.size, a.flags.isLeading << 2 | a.flags.dependsOn, a.flags .isDependedOn << 6 | a.flags.hasRedundancy << 4 | a.flags.paddingValue << 1 | a.flags .isNonSyncSample, 61440 & a.flags.degradationPriority, 15 & a.flags.degradationPriority, ( 4278190080 & a.compositionTimeOffset) >>> 24, (16711680 & a.compositionTimeOffset) >>> 16, ( 65280 & a.compositionTimeOffset) >>> 8, 255 & a.compositionTimeOffset ]); return r(A.trun, new Uint8Array(i)) }, H = function(e, t) { var i, n, a, s; for (t += 20 + 8 * (n = e.samples || []).length, i = V(n, t), s = 0; s < n.length; s++) a = n[s], i = i.concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a .duration) >>> 8, 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>> 16, (65280 & a.size) >>> 8, 255 & a.size ]); return r(A.trun, new Uint8Array(i)) }, S = function(e, t) { return "audio" === e.type ? H(e, t) : G(e, t) }, t.exports = { ftyp: s, mdat: o, moof: d, moov: c, initSegment: function(e) { var t, i = s(), r = c(e); return (t = new Uint8Array(i.byteLength + r.byteLength)).set(i), t.set(r, i.byteLength), t } } }, {}], 57: [function(e, t, i) { "use strict"; var r, n, a, s; r = function(e, t) { var i, a, s, o, u, l = []; if (!t.length) return null; for (i = 0; i < e.byteLength;) a = e[i] << 24, a |= e[i + 1] << 16, a |= e[i + 2] << 8, a |= e[i + 3], s = n(e.subarray(i + 4, i + 8)), o = a > 1 ? i + a : e.byteLength, s === t[0] && (1 === t .length ? l.push(e.subarray(i + 8, o)) : (u = r(e.subarray(i + 8, o), t.slice(1))).length && ( l = l.concat(u))), i = o; return l }, n = function(e) { var t = ""; return t += String.fromCharCode(e[0]), t += String.fromCharCode(e[1]), t += String.fromCharCode(e[ 2]), t += String.fromCharCode(e[3]) }, a = function(e) { return r(e, ["moov", "trak"]).reduce(function(e, t) { var i, n, a, s; return (i = r(t, ["tkhd"])[0]) ? (a = i[n = 0 === i[0] ? 12 : 20] << 24 | i[n + 1] << 16 | i[ n + 2] << 8 | i[n + 3], (s = r(t, ["mdia", "mdhd"])[0]) ? (n = 0 === s[0] ? 12 : 20, e[ a] = s[n] << 24 | s[n + 1] << 16 | s[n + 2] << 8 | s[n + 3], e) : null) : null }, {}) }, s = function(e, t) { var i, n, a; return i = r(t, ["moof", "traf"]), n = [].concat.apply([], i.map(function(t) { return r(t, ["tfhd"]).map(function(i) { var n, a; return n = i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7], a = e[n] || 9e4, (r(t, [ "tfdt"]).map(function(e) { var t, i; return t = e[0], i = e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7], 1 === t && ( i *= Math.pow(2, 32), i += e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11]), i })[0] || 1 / 0) / a }) })), a = Math.min.apply(null, n), isFinite(a) ? a : 0 }, t.exports = { parseType: n, timescale: a, startTime: s } }, {}], 58: [function(e, t, i) { "use strict"; var r, n, a, s, o, u, l, d, c, h, f = e("../utils/stream.js"), p = e("./mp4-generator.js"), m = e("../m2ts/m2ts.js"), g = e("../codecs/adts.js"), v = e("../codecs/h264").H264Stream, y = e("../aac"), _ = e("../data/silence"), b = e("../utils/clock"), w = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"], E = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility"]; o = function(e) { return e[0] === "I".charCodeAt(0) && e[1] === "D".charCodeAt(0) && e[2] === "3".charCodeAt(0) }, c = function(e, t) { var i; if (e.length !== t.length) return !1; for (i = 0; i < e.length; i++) if (e[i] !== t[i]) return !1; return !0 }, h = function(e) { var t, i = 0; for (t = 0; t < e.length; t++) i += e[t].data.byteLength; return i }, (n = function(e) { var t = [], i = 0, r = 0, a = 0, s = 1 / 0; n.prototype.init.call(this), this.push = function(i) { u(e, i), e && w.forEach(function(t) { e[t] = i[t] }), t.push(i) }, this.setEarliestDts = function(t) { r = t - e.timelineStartInfo.baseMediaDecodeTime }, this.setVideoBaseMediaDecodeTime = function(e) { s = e }, this.setAudioAppendStart = function(e) { a = e }, this.flush = function() { var r, n, a, s; 0 !== t.length ? (r = this.trimAdtsFramesByEarliestDts_(t), e.baseMediaDecodeTime = d(e), this .prefixWithSilence_(e, r), e.samples = this.generateSampleTable_(r), a = p.mdat(this .concatenateFrameData_(r)), t = [], n = p.moof(i, [e]), s = new Uint8Array(n .byteLength + a.byteLength), i++, s.set(n), s.set(a, n.byteLength), l(e), this.trigger( "data", { track: e, boxes: s }), this.trigger("done", "AudioSegmentStream")) : this.trigger("done", "AudioSegmentStream") }, this.prefixWithSilence_ = function(e, t) { var i, r, n, o, u = 0, l = 0, d = 0; if (t.length && (i = b.audioTsToVideoTs(e.baseMediaDecodeTime, e.samplerate), r = Math.ceil( 9e4 / (e.samplerate / 1024)), a && s && (u = i - Math.max(a, s), d = (l = Math.floor(u / r)) * r), !(l < 1 || d > 45e3))) { for ((n = _[e.samplerate]) || (n = t[0].data), o = 0; o < l; o++) t.splice(o, 0, { data: n }); e.baseMediaDecodeTime -= Math.floor(b.videoTsToAudioTs(d, e.samplerate)) } }, this.trimAdtsFramesByEarliestDts_ = function(t) { return e.minSegmentDts >= r ? t : (e.minSegmentDts = 1 / 0, t.filter(function(t) { return t.dts >= r && (e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), e .minSegmentPts = e.minSegmentDts, !0) })) }, this.generateSampleTable_ = function(e) { var t, i, r = []; for (t = 0; t < e.length; t++) i = e[t], r.push({ size: i.data.byteLength, duration: 1024 }); return r }, this.concatenateFrameData_ = function(e) { var t, i, r = 0, n = new Uint8Array(h(e)); for (t = 0; t < e.length; t++) i = e[t], n.set(i.data, r), r += i.data.byteLength; return n } }).prototype = new f, (r = function(e, t) { var i, n, a = 0, s = [], o = []; t = t || {}, r.prototype.init.call(this), delete e.minPTS, this.gopCache_ = [], this.push = function(t) { u(e, t), "seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config, e.sps = [t.data], E .forEach(function(t) { e[t] = i[t] }, this)), "pic_parameter_set_rbsp" !== t.nalUnitType || n || (n = t.data, e.pps = [t .data]), s.push(t) }, this.flush = function() { for (var i, r, n, c, h, f; s.length && "access_unit_delimiter_rbsp" !== s[0].nalUnitType;) s .shift(); if (0 === s.length) return this.resetStream_(), void this.trigger("done", "VideoSegmentStream"); if (i = this.groupNalsIntoFrames_(s), (n = this.groupFramesIntoGops_(i))[0][0].keyFrame || (( r = this.getGopForFusion_(s[0], e)) ? (n.unshift(r), n.byteLength += r.byteLength, n .nalCount += r.nalCount, n.pts = r.pts, n.dts = r.dts, n.duration += r.duration) : n = this.extendFirstKeyFrame_(n)), o.length) { var m; if (!(m = t.alignGopsAtEnd ? this.alignGopsAtEnd_(n) : this.alignGopsAtStart_(n))) return this.gopCache_.unshift({ gop: n.pop(), pps: e.pps, sps: e.sps }), this.gopCache_.length = Math.min(6, this.gopCache_.length), s = [], this .resetStream_(), void this.trigger("done", "VideoSegmentStream"); l(e), n = m } u(e, n), e.samples = this.generateSampleTable_(n), h = p.mdat(this.concatenateNalData_(n)), e .baseMediaDecodeTime = d(e), this.trigger("processedGopsInfo", n.map(function(e) { return { pts: e.pts, dts: e.dts, byteLength: e.byteLength } })), this.gopCache_.unshift({ gop: n.pop(), pps: e.pps, sps: e.sps }), this.gopCache_.length = Math.min(6, this.gopCache_.length), s = [], this.trigger( "baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e .timelineStartInfo), c = p.moof(a, [e]), f = new Uint8Array(c.byteLength + h.byteLength), a++, f.set(c), f.set(h, c.byteLength), this.trigger("data", { track: e, boxes: f }), this.resetStream_(), this.trigger("done", "VideoSegmentStream") }, this.resetStream_ = function() { l(e), i = void 0, n = void 0 }, this.getGopForFusion_ = function(t) { var i, r, n, a, s, o = 1 / 0; for (s = 0; s < this.gopCache_.length; s++) n = (a = this.gopCache_[s]).gop, e.pps && c(e.pps[ 0], a.pps[0]) && e.sps && c(e.sps[0], a.sps[0]) && (n.dts < e.timelineStartInfo.dts || ( i = t.dts - n.dts - n.duration) >= -1e4 && i <= 45e3 && (!r || o > i) && (r = a, o = i)); return r ? r.gop : null }, this.extendFirstKeyFrame_ = function(e) { var t; return !e[0][0].keyFrame && e.length > 1 && (t = e.shift(), e.byteLength -= t.byteLength, e .nalCount -= t.nalCount, e[0][0].dts = t.dts, e[0][0].pts = t.pts, e[0][0].duration += t .duration), e }, this.groupNalsIntoFrames_ = function(e) { var t, i, r = [], n = []; for (r.byteLength = 0, t = 0; t < e.length; t++) "access_unit_delimiter_rbsp" === (i = e[t]) .nalUnitType ? (r.length && (r.duration = i.dts - r.dts, n.push(r)), (r = [i]).byteLength = i.data.byteLength, r.pts = i.pts, r.dts = i.dts) : ( "slice_layer_without_partitioning_rbsp_idr" === i.nalUnitType && (r.keyFrame = !0), r .duration = i.dts - r.dts, r.byteLength += i.data.byteLength, r.push(i)); return n.length && (!r.duration || r.duration <= 0) && (r.duration = n[n.length - 1] .duration), n.push(r), n }, this.groupFramesIntoGops_ = function(e) { var t, i, r = [], n = []; for (r.byteLength = 0, r.nalCount = 0, r.duration = 0, r.pts = e[0].pts, r.dts = e[0].dts, n .byteLength = 0, n.nalCount = 0, n.duration = 0, n.pts = e[0].pts, n.dts = e[0].dts, t = 0; t < e.length; t++)(i = e[t]).keyFrame ? (r.length && (n.push(r), n.byteLength += r .byteLength, n.nalCount += r.nalCount, n.duration += r.duration), (r = [i]).nalCount = i .length, r.byteLength = i.byteLength, r.pts = i.pts, r.dts = i.dts, r.duration = i .duration) : (r.duration += i.duration, r.nalCount += i.length, r.byteLength += i .byteLength, r.push(i)); return n.length && r.duration <= 0 && (r.duration = n[n.length - 1].duration), n.byteLength += r.byteLength, n.nalCount += r.nalCount, n.duration += r.duration, n.push(r), n }, this.generateSampleTable_ = function(e, t) { var i, r, n, a, s, o = t || 0, u = []; for (i = 0; i < e.length; i++) for (a = e[i], r = 0; r < a.length; r++) s = a[r], (n = { size: 0, flags: { isLeading: 0, dependsOn: 1, isDependedOn: 0, hasRedundancy: 0, degradationPriority: 0 } }).dataOffset = o, n.compositionTimeOffset = s.pts - s.dts, n.duration = s.duration, n .size = 4 * s.length, n.size += s.byteLength, s.keyFrame && (n.flags.dependsOn = 2), o += n.size, u.push(n); return u }, this.concatenateNalData_ = function(e) { var t, i, r, n, a, s, o = 0, u = e.byteLength, l = e.nalCount, d = new Uint8Array(u + 4 * l), c = new DataView(d.buffer); for (t = 0; t < e.length; t++) for (n = e[t], i = 0; i < n.length; i++) for (a = n[i], r = 0; r < a.length; r++) s = a[r], c.setUint32(o, s.data.byteLength), o += 4, d.set(s.data, o), o += s.data.byteLength; return d }, this.alignGopsAtStart_ = function(e) { var t, i, r, n, a, s, u, l; for (a = e.byteLength, s = e.nalCount, u = e.duration, t = i = 0; t < o.length && i < e .length && (r = o[t], n = e[i], r.pts !== n.pts);) n.pts > r.pts ? t++ : (i++, a -= n .byteLength, s -= n.nalCount, u -= n.duration); return 0 === i ? e : i === e.length ? null : ((l = e.slice(i)).byteLength = a, l.duration = u, l.nalCount = s, l.pts = l[0].pts, l.dts = l[0].dts, l) }, this.alignGopsAtEnd_ = function(e) { var t, i, r, n, a, s, u; for (t = o.length - 1, i = e.length - 1, a = null, s = !1; t >= 0 && i >= 0;) { if (r = o[t], n = e[i], r.pts === n.pts) { s = !0; break } r.pts > n.pts ? t-- : (t === o.length - 1 && (a = i), i--) } if (!s && null === a) return null; if (0 === (u = s ? i : a)) return e; var l = e.slice(u), d = l.reduce(function(e, t) { return e.byteLength += t.byteLength, e.duration += t.duration, e.nalCount += t.nalCount, e }, { byteLength: 0, duration: 0, nalCount: 0 }); return l.byteLength = d.byteLength, l.duration = d.duration, l.nalCount = d.nalCount, l.pts = l[0].pts, l.dts = l[0].dts, l }, this.alignGopsWith = function(e) { o = e } }).prototype = new f, u = function(e, t) { "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t .pts), void 0 === e.minSegmentPts ? e.minSegmentPts = t.pts : e.minSegmentPts = Math.min(e .minSegmentPts, t.pts), void 0 === e.maxSegmentPts ? e.maxSegmentPts = t.pts : e .maxSegmentPts = Math.max(e.maxSegmentPts, t.pts)), "number" == typeof t.dts && (void 0 === e .timelineStartInfo.dts && (e.timelineStartInfo.dts = t.dts), void 0 === e.minSegmentDts ? e .minSegmentDts = t.dts : e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), void 0 === e .maxSegmentDts ? e.maxSegmentDts = t.dts : e.maxSegmentDts = Math.max(e.maxSegmentDts, t.dts)) }, l = function(e) { delete e.minSegmentDts, delete e.maxSegmentDts, delete e.minSegmentPts, delete e.maxSegmentPts }, d = function(e) { var t, i = e.minSegmentDts - e.timelineStartInfo.dts; return t = e.timelineStartInfo.baseMediaDecodeTime, t += i, t = Math.max(0, t), "audio" === e .type && (t *= e.samplerate / 9e4, t = Math.floor(t)), t }, (s = function(e, t) { this.numberOfTracks = 0, this.metadataStream = t, void 0 !== e.remux ? this.remuxTracks = !!e .remux : this.remuxTracks = !0, this.pendingTracks = [], this.videoTrack = null, this .pendingBoxes = [], this.pendingCaptions = [], this.pendingMetadata = [], this.pendingBytes = 0, this.emittedTracks = 0, s.prototype.init.call(this), this.push = function(e) { return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (this .pendingTracks.push(e.track), this.pendingBoxes.push(e.boxes), this.pendingBytes += e .boxes.byteLength, "video" === e.track.type && (this.videoTrack = e.track), void( "audio" === e.track.type && (this.audioTrack = e.track))) } }).prototype = new f, s.prototype.flush = function(e) { var t, i, r, n, a = 0, s = { captions: [], captionStreams: {}, metadata: [], info: {} }, o = 0; if (this.pendingTracks.length < this.numberOfTracks) { if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return; if (this.remuxTracks) return; if (0 === this.pendingTracks.length) return this.emittedTracks++, void(this.emittedTracks >= this .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0)) } for (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts, E.forEach(function(e) { s.info[e] = this.videoTrack[e] }, this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts, w.forEach(function(e) { s.info[e] = this.audioTrack[e] }, this)), 1 === this.pendingTracks.length ? s.type = this.pendingTracks[0].type : s.type = "combined", this.emittedTracks += this.pendingTracks.length, r = p.initSegment(this .pendingTracks), s.initSegment = new Uint8Array(r.byteLength), s.initSegment.set(r), s.data = new Uint8Array(this.pendingBytes), n = 0; n < this.pendingBoxes.length; n++) s.data.set(this .pendingBoxes[n], a), a += this.pendingBoxes[n].byteLength; for (n = 0; n < this.pendingCaptions.length; n++)(t = this.pendingCaptions[n]).startTime = t .startPts - o, t.startTime /= 9e4, t.endTime = t.endPts - o, t.endTime /= 9e4, s.captionStreams[t .stream] = !0, s.captions.push(t); for (n = 0; n < this.pendingMetadata.length; n++)(i = this.pendingMetadata[n]).cueTime = i.pts - o, i.cueTime /= 9e4, s.metadata.push(i); s.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this .videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this .pendingBytes = 0, this.pendingMetadata.length = 0, this.trigger("data", s), this.emittedTracks >= this.numberOfTracks && (this.trigger("done"), this.emittedTracks = 0) }, (a = function(e) { var t, i, u = this, d = !0; a.prototype.init.call(this), e = e || {}, this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0, this.transmuxPipeline_ = {}, this.setupAacPipeline = function() { var t = {}; this.transmuxPipeline_ = t, t.type = "aac", t.metadataStream = new m.MetadataStream, t .aacStream = new y, t.audioTimestampRolloverStream = new m.TimestampRolloverStream("audio"), t.timedMetadataTimestampRolloverStream = new m.TimestampRolloverStream("timed-metadata"), t .adtsStream = new g, t.coalesceStream = new s(e, t.metadataStream), t.headOfPipeline = t .aacStream, t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream), t.aacStream .pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream), t.metadataStream.on("timestamp", function(e) { t.aacStream.setTimestamp(e.timeStamp) }), t.aacStream.on("data", function(e) { "timed-metadata" !== e.type || t.audioSegmentStream || (i = i || { timelineStartInfo: { baseMediaDecodeTime: u.baseMediaDecodeTime }, codec: "adts", type: "audio" }, t.coalesceStream.numberOfTracks++, t.audioSegmentStream = new n(i), t.adtsStream .pipe(t.audioSegmentStream).pipe(t.coalesceStream)) }), t.coalesceStream.on("data", this.trigger.bind(this, "data")), t.coalesceStream.on( "done", this.trigger.bind(this, "done")) }, this.setupTsPipeline = function() { var a = {}; this.transmuxPipeline_ = a, a.type = "ts", a.metadataStream = new m.MetadataStream, a .packetStream = new m.TransportPacketStream, a.parseStream = new m.TransportParseStream, a .elementaryStream = new m.ElementaryStream, a.videoTimestampRolloverStream = new m .TimestampRolloverStream("video"), a.audioTimestampRolloverStream = new m .TimestampRolloverStream("audio"), a.timedMetadataTimestampRolloverStream = new m .TimestampRolloverStream("timed-metadata"), a.adtsStream = new g, a.h264Stream = new v, a .captionStream = new m.CaptionStream, a.coalesceStream = new s(e, a.metadataStream), a .headOfPipeline = a.packetStream, a.packetStream.pipe(a.parseStream).pipe(a .elementaryStream), a.elementaryStream.pipe(a.videoTimestampRolloverStream).pipe(a .h264Stream), a.elementaryStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream), a.elementaryStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe( a.coalesceStream), a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream), a .elementaryStream.on("data", function(s) { var o; if ("metadata" === s.type) { for (o = s.tracks.length; o--;) t || "video" !== s.tracks[o].type ? i || "audio" !== s .tracks[o].type || ((i = s.tracks[o]).timelineStartInfo.baseMediaDecodeTime = u .baseMediaDecodeTime) : (t = s.tracks[o]).timelineStartInfo.baseMediaDecodeTime = u.baseMediaDecodeTime; t && !a.videoSegmentStream && (a.coalesceStream.numberOfTracks++, a .videoSegmentStream = new r(t, e), a.videoSegmentStream.on("timelineStartInfo", function(e) { i && (i.timelineStartInfo = e, a.audioSegmentStream.setEarliestDts(e.dts)) }), a.videoSegmentStream.on("processedGopsInfo", u.trigger.bind(u, "gopInfo")), a.videoSegmentStream.on("baseMediaDecodeTime", function(e) { i && a.audioSegmentStream.setVideoBaseMediaDecodeTime(e) }), a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)), i && !a .audioSegmentStream && (a.coalesceStream.numberOfTracks++, a.audioSegmentStream = new n(i), a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream)) } }), a.coalesceStream.on("data", this.trigger.bind(this, "data")), a.coalesceStream.on( "done", this.trigger.bind(this, "done")) }, this.setBaseMediaDecodeTime = function(e) { var r = this.transmuxPipeline_; this.baseMediaDecodeTime = e, i && (i.timelineStartInfo.dts = void 0, i.timelineStartInfo .pts = void 0, l(i), i.timelineStartInfo.baseMediaDecodeTime = e, r .audioTimestampRolloverStream && r.audioTimestampRolloverStream.discontinuity()), t && (r .videoSegmentStream && (r.videoSegmentStream.gopCache_ = [], r .videoTimestampRolloverStream.discontinuity()), t.timelineStartInfo.dts = void 0, t .timelineStartInfo.pts = void 0, l(t), r.captionStream.reset(), t.timelineStartInfo .baseMediaDecodeTime = e), r.timedMetadataTimestampRolloverStream && r .timedMetadataTimestampRolloverStream.discontinuity() }, this.setAudioAppendStart = function(e) { i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e) }, this.alignGopsWith = function(e) { t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream .alignGopsWith(e) }, this.push = function(e) { if (d) { var t = o(e); t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this .transmuxPipeline_.type || this.setupTsPipeline(), d = !1 } this.transmuxPipeline_.headOfPipeline.push(e) }, this.flush = function() { d = !0, this.transmuxPipeline_.headOfPipeline.flush() }, this.resetCaptions = function() { this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset() } }).prototype = new f, t.exports = { Transmuxer: a, VideoSegmentStream: r, AudioSegmentStream: n, AUDIO_PROPERTIES: w, VIDEO_PROPERTIES: E } }, { "../aac": 38, "../codecs/adts.js": 40, "../codecs/h264": 41, "../data/silence": 42, "../m2ts/m2ts.js": 50, "../utils/clock": 60, "../utils/stream.js": 62, "./mp4-generator.js": 56 }], 59: [function(e, t, i) { "use strict"; var r = e("../m2ts/stream-types.js"), n = e("../m2ts/timestamp-rollover-stream.js").handleRollover, a = {}; a.ts = e("../m2ts/probe.js"), a.aac = e("../aac/probe.js"); var s = function(e, t, i) { for (var r, n, s, o, u = 0, l = 188, d = !1; l < e.byteLength;) if (71 !== e[u] || 71 !== e[l]) u++, l++; else { switch (r = e.subarray(u, l), a.ts.parseType(r, t.pid)) { case "pes": n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r), "audio" === n && s && (o = a.ts.parsePesTime(r)) && (o.type = "audio", i.audio.push(o), d = !0) } if (d) break; u += 188, l += 188 } for (u = (l = e.byteLength) - 188, d = !1; u >= 0;) if (71 !== e[u] || 71 !== e[l]) u--, l--; else { switch (r = e.subarray(u, l), a.ts.parseType(r, t.pid)) { case "pes": n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r), "audio" === n && s && (o = a.ts.parsePesTime(r)) && (o.type = "audio", i.audio.push(o), d = !0) } if (d) break; u -= 188, l -= 188 } }, o = function(e, t, i) { for (var r, n, s, o, u, l, d, c = 0, h = 188, f = !1, p = { data: [], size: 0 }; h < e.byteLength;) if (71 !== e[c] || 71 !== e[h]) c++, h++; else { switch (r = e.subarray(c, h), a.ts.parseType(r, t.pid)) { case "pes": if (n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r), "video" === n && (s && !f && (o = a.ts.parsePesTime(r)) && (o.type = "video", i.video .push(o), f = !0), !i.firstKeyFrame)) { if (s && 0 !== p.size) { for (u = new Uint8Array(p.size), l = 0; p.data.length;) d = p.data.shift(), u.set(d, l), l += d.byteLength; a.ts.videoPacketContainsKeyFrame(u) && (i.firstKeyFrame = a.ts.parsePesTime(u), i .firstKeyFrame.type = "video"), p.size = 0 } p.data.push(r), p.size += r.byteLength } } if (f && i.firstKeyFrame) break; c += 188, h += 188 } for (c = (h = e.byteLength) - 188, f = !1; c >= 0;) if (71 !== e[c] || 71 !== e[h]) c--, h--; else { switch (r = e.subarray(c, h), a.ts.parseType(r, t.pid)) { case "pes": n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r), "video" === n && s && (o = a.ts.parsePesTime(r)) && (o.type = "video", i.video.push(o), f = !0) } if (f) break; c -= 188, h -= 188 } }, u = function(e) { var t = { pid: null, table: null }, i = {}; for (var n in function(e, t) { for (var i, r = 0, n = 188; n < e.byteLength;) if (71 !== e[r] || 71 !== e[n]) r++, n++; else { switch (i = e.subarray(r, n), a.ts.parseType(i, t.pid)) { case "pat": t.pid || (t.pid = a.ts.parsePat(i)); break; case "pmt": t.table || (t.table = a.ts.parsePmt(i)) } if (t.pid && t.table) return; r += 188, n += 188 } }(e, t), t.table) { if (t.table.hasOwnProperty(n)) switch (t.table[n]) { case r.H264_STREAM_TYPE: i.video = [], o(e, t, i), 0 === i.video.length && delete i.video; break; case r.ADTS_STREAM_TYPE: i.audio = [], s(e, t, i), 0 === i.audio.length && delete i.audio } } return i }; t.exports = { inspect: function(e, t) { var i, r; return (r = (i = e)[0] === "I".charCodeAt(0) && i[1] === "D".charCodeAt(0) && i[2] === "3" .charCodeAt(0) ? function(e) { for (var t, i = !1, r = 0, n = null, s = null, o = 0, u = 0; e.length - u >= 3;) { switch (a.aac.parseType(e, u)) { case "timed-metadata": if (e.length - u < 10) { i = !0; break } if ((o = a.aac.parseId3TagSize(e, u)) > e.length) { i = !0; break } null === s && (t = e.subarray(u, u + o), s = a.aac.parseAacTimestamp(t)), u += o; break; case "audio": if (e.length - u < 7) { i = !0; break } if ((o = a.aac.parseAdtsSize(e, u)) > e.length) { i = !0; break } null === n && (t = e.subarray(u, u + o), n = a.aac.parseSampleRate(t)), r++, u += o; break; default: u++ } if (i) return null } if (null === n || null === s) return null; var l = 9e4 / n; return { audio: [{ type: "audio", dts: s, pts: s }, { type: "audio", dts: s + 1024 * r * l, pts: s + 1024 * r * l }] } }(e) : u(e)) && (r.audio || r.video) ? (function(e, t) { if (e.audio && e.audio.length) { var i = t; void 0 === i && (i = e.audio[0].dts), e.audio.forEach(function(e) { e.dts = n(e.dts, i), e.pts = n(e.pts, i), e.dtsTime = e.dts / 9e4, e.ptsTime = e .pts / 9e4 }) } if (e.video && e.video.length) { var r = t; if (void 0 === r && (r = e.video[0].dts), e.video.forEach(function(e) { e.dts = n(e.dts, r), e.pts = n(e.pts, r), e.dtsTime = e.dts / 9e4, e.ptsTime = e .pts / 9e4 }), e.firstKeyFrame) { var a = e.firstKeyFrame; a.dts = n(a.dts, r), a.pts = n(a.pts, r), a.dtsTime = a.dts / 9e4, a.ptsTime = a.dts / 9e4 } } }(r, t), r) : null } } }, { "../aac/probe.js": 39, "../m2ts/probe.js": 52, "../m2ts/stream-types.js": 53, "../m2ts/timestamp-rollover-stream.js": 54 }], 60: [function(e, t, i) { var r, n, a, s, o, u; r = function(e) { return 9e4 * e }, n = function(e, t) { return e * t }, a = function(e) { return e / 9e4 }, s = function(e, t) { return e / t }, o = function(e, t) { return r(s(e, t)) }, u = function(e, t) { return n(a(e), t) }, t.exports = { secondsToVideoTs: r, secondsToAudioTs: n, videoTsToSeconds: a, audioTsToSeconds: s, audioTsToVideoTs: o, videoTsToAudioTs: u } }, {}], 61: [function(e, t, i) { "use strict"; var r; r = function(e) { var t = e.byteLength, i = 0, r = 0; this.length = function() { return 8 * t }, this.bitsAvailable = function() { return 8 * t + r }, this.loadWord = function() { var n = e.byteLength - t, a = new Uint8Array(4), s = Math.min(4, t); if (0 === s) throw new Error("no bytes available"); a.set(e.subarray(n, n + s)), i = new DataView(a.buffer).getUint32(0), r = 8 * s, t -= s }, this.skipBits = function(e) { var n; r > e ? (i <<= e, r -= e) : (e -= r, e -= 8 * (n = Math.floor(e / 8)), t -= n, this.loadWord(), i <<= e, r -= e) }, this.readBits = function(e) { var n = Math.min(r, e), a = i >>> 32 - n; return (r -= n) > 0 ? i <<= n : t > 0 && this.loadWord(), (n = e - n) > 0 ? a << n | this .readBits(n) : a }, this.skipLeadingZeros = function() { var e; for (e = 0; e < r; ++e) if (0 != (i & 2147483648 >>> e)) return i <<= e, r -= e, e; return this.loadWord(), e + this.skipLeadingZeros() }, this.skipUnsignedExpGolomb = function() { this.skipBits(1 + this.skipLeadingZeros()) }, this.skipExpGolomb = function() { this.skipBits(1 + this.skipLeadingZeros()) }, this.readUnsignedExpGolomb = function() { var e = this.skipLeadingZeros(); return this.readBits(e + 1) - 1 }, this.readExpGolomb = function() { var e = this.readUnsignedExpGolomb(); return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1) }, this.readBoolean = function() { return 1 === this.readBits(1) }, this.readUnsignedByte = function() { return this.readBits(8) }, this.loadWord() }, t.exports = r }, {}], 62: [function(e, t, i) { "use strict"; var r = function() { this.init = function() { var e = {}; this.on = function(t, i) { e[t] || (e[t] = []), e[t] = e[t].concat(i) }, this.off = function(t, i) { var r; return !!e[t] && (r = e[t].indexOf(i), e[t] = e[t].slice(), e[t].splice(r, 1), r > -1) }, this.trigger = function(t) { var i, r, n, a; if (i = e[t]) if (2 === arguments.length) for (n = i.length, r = 0; r < n; ++r) i[r].call(this, arguments[1]); else { for (a = [], r = arguments.length, r = 1; r < arguments.length; ++r) a.push(arguments[ r]); for (n = i.length, r = 0; r < n; ++r) i[r].apply(this, a) } }, this.dispose = function() { e = {} } } }; r.prototype.pipe = function(e) { return this.on("data", function(t) { e.push(t) }), this.on("done", function(t) { e.flush(t) }), e }, r.prototype.push = function(e) { this.trigger("data", e) }, r.prototype.flush = function(e) { this.trigger("done", e) }, t.exports = r }, {}], 63: [function(e, t, i) { var r, n, a, s, o, u; r = this, n = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/, a = /^([^\/;?#]*)(.*)$/, s = /(?:\/|^)\.(?=\/)/g, o = /(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g, u = { buildAbsoluteURL: function(e, t, i) { if (i = i || {}, e = e.trim(), !(t = t.trim())) { if (!i.alwaysNormalize) return e; var r = this.parseURL(e); if (!r) throw new Error("Error trying to parse base URL."); return r.path = u.normalizePath(r.path), u.buildURLFromParts(r) } var n = this.parseURL(t); if (!n) throw new Error("Error trying to parse relative URL."); if (n.scheme) return i.alwaysNormalize ? (n.path = u.normalizePath(n.path), u.buildURLFromParts( n)) : t; var s = this.parseURL(e); if (!s) throw new Error("Error trying to parse base URL."); if (!s.netLoc && s.path && "/" !== s.path[0]) { var o = a.exec(s.path); s.netLoc = o[1], s.path = o[2] } s.netLoc && !s.path && (s.path = "/"); var l = { scheme: s.scheme, netLoc: n.netLoc, path: null, params: n.params, query: n.query, fragment: n.fragment }; if (!n.netLoc && (l.netLoc = s.netLoc, "/" !== n.path[0])) if (n.path) { var d = s.path, c = d.substring(0, d.lastIndexOf("/") + 1) + n.path; l.path = u.normalizePath(c) } else l.path = s.path, n.params || (l.params = s.params, n.query || (l.query = s.query)); return null === l.path && (l.path = i.alwaysNormalize ? u.normalizePath(n.path) : n.path), u .buildURLFromParts(l) }, parseURL: function(e) { var t = n.exec(e); return t ? { scheme: t[1] || "", netLoc: t[2] || "", path: t[3] || "", params: t[4] || "", query: t[5] || "", fragment: t[6] || "" } : null }, normalizePath: function(e) { for (e = e.split("").reverse().join("").replace(s, ""); e.length !== (e = e.replace(o, "")) .length;); return e.split("").reverse().join("") }, buildURLFromParts: function(e) { return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment } }, "object" == typeof i && "object" == typeof t ? t.exports = u : "object" == typeof i ? i .URLToolkit = u : r.URLToolkit = u }, {}], 64: [function(e, t, i) { (function(r) { "use strict"; function n(e) { return e && e.__esModule ? e : { default: e } } Object.defineProperty(i, "__esModule", { value: !0 }); var a = n(e("global/window")), s = n("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null), o = function(e) { return isNaN(e) || Math.abs(e) === 1 / 0 ? Number.MAX_VALUE : e }; i.default = { addTextTrackData: function(e, t, i) { var r, n = a.default.WebKitDataCue || a.default.VTTCue; t && t.forEach(function(e) { var t = e.stream; this.inbandTextTracks_[t].addCue(new n(e.startTime + this.timestampOffset, e.endTime + this.timestampOffset, e.text)) }, e), i && (r = o(e.mediaSource_.duration), i.forEach(function(e) { var t = e.cueTime + this.timestampOffset; e.frames.forEach(function(e) { var i = new n(t, t, e.value || e.url || e.data || ""); i.frame = e, i.value = e, function(e) { Object.defineProperties(e.frame, { id: { get: function() { return s.default.log.warn( "cue.frame.id is deprecated. Use cue.value.key instead."), e.value.key } }, value: { get: function() { return s.default.log.warn( "cue.frame.value is deprecated. Use cue.value.data instead." ), e.value.data } }, privateData: { get: function() { return s.default.log.warn( "cue.frame.privateData is deprecated. Use cue.value.data instead." ), e.value.data } } }) }(i), this.metadataTrack_.addCue(i) }, this) }, e), e.metadataTrack_ && e.metadataTrack_.cues && e.metadataTrack_.cues.length && function() { for (var t = e.metadataTrack_.cues, i = [], n = 0; n < t.length; n++) t[n] && i.push( t[n]); var a = i.reduce(function(e, t) { var i = e[t.startTime] || []; return i.push(t), e[t.startTime] = i, e }, {}), s = Object.keys(a).sort(function(e, t) { return Number(e) - Number(t) }); s.forEach(function(e, t) { var i = a[e], n = Number(s[t + 1]) || r; i.forEach(function(e) { e.endTime = n }) }) }()) }, durationOfVideo: o }, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "global/window": 32 }], 65: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); i.default = { isAudioCodec: function(e) { return /mp4a\.\d+.\d+/i.test(e) }, parseContentType: function(e) { var t = { type: "", parameters: {} }, i = e.trim().split(";"); return t.type = i.shift().trim(), i.forEach(function(e) { var i = e.trim().split("="); if (i.length > 1) { var r = i[0].replace(/"/g, "").trim(), n = i[1].replace(/"/g, "").trim(); t.parameters[r] = n } }), t }, isVideoCodec: function(e) { return /avc1\.[\da-f]+/i.test(e) }, translateLegacyCodecs: function(e) { return e.map(function(e) { return e.replace(/avc1\.(\d+)\.(\d+)/i, function(e, t, i) { return "avc1." + ("00" + Number(t).toString(16)).slice(-2) + "00" + ("00" + Number( i).toString(16)).slice(-2) }) }) } }, t.exports = i.default }, {}], 66: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); i.default = function(e, t, i) { var r = t.player_; if (i.captions && i.captions.length) for (var n in e.inbandTextTracks_ || (e.inbandTextTracks_ = {}), i.captionStreams) if (!e.inbandTextTracks_[n]) { r.tech_.trigger({ type: "usage", name: "hls-608" }); var a = r.textTracks().getTrackById(n); e.inbandTextTracks_[n] = a || r.addRemoteTextTrack({ kind: "captions", id: n, label: n }, !1).track } i.metadata && i.metadata.length && !e.metadataTrack_ && (e.metadataTrack_ = r .addRemoteTextTrack({ kind: "metadata", label: "Timed Metadata" }, !1).track, e.metadataTrack_.inBandMetadataTrackDispatchType = i.metadata.dispatchType) }, t.exports = i.default }, {}], 67: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); i.default = { TIME_BETWEEN_CHUNKS: 1, BYTES_PER_CHUNK: 32768 }, t.exports = i.default }, {}], 68: [function(e, t, i) { (function(r) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var n = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), a = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function s(e) { return e && e.__esModule ? e : { default: e } } var o = s(e("global/document")), u = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null), l = s(e("./flash-source-buffer")), d = s(e("./flash-constants")), c = e("./codec-utils"), h = function(e) { function t() { var e = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), this .sourceBuffers = [], this.readyState = "closed", this.on(["sourceopen", "webkitsourceopen"], function(t) { e.swfObj = o.default.getElementById(t.swfId), e.player_ = (0, u.default)(e.swfObj .parentNode), e.tech_ = e.swfObj.tech, e.readyState = "open", e.tech_.on("seeking", function() { for (var t = e.sourceBuffers.length; t--;) e.sourceBuffers[t].abort() }), e.swfObj && e.swfObj.vjs_load() }) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, u["default"].EventTarget), n(t, [{ key: "addSeekableRange_", value: function() {} }, { key: "addSourceBuffer", value: function(e) { var t = (0, c.parseContentType)(e), i = void 0; if ("video/mp2t" !== t.type && "audio/mp2t" !== t.type) throw new Error( "NotSupportedError (Video.js)"); return i = new l.default(this), this.sourceBuffers.push(i), i } }, { key: "endOfStream", value: function(e) { "network" === e ? this.tech_.error(2) : "decode" === e && this.tech_.error(3), "ended" !== this.readyState && (this.readyState = "ended", this.swfObj .vjs_endOfStream()) } }]), t }(); i.default = h; try { Object.defineProperty(h.prototype, "duration", { get: function() { return this.swfObj ? this.swfObj.vjs_getProperty("duration") : NaN }, set: function(e) { var t = void 0, i = this.swfObj.vjs_getProperty("duration"); if (this.swfObj.vjs_setProperty("duration", e), e < i) for (t = 0; t < this.sourceBuffers.length; t++) this.sourceBuffers[t].remove(e, i); return e } }) } catch (e) { h.prototype.duration = NaN } for (var f in d.default) h[f] = d.default[f]; t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./codec-utils": 65, "./flash-constants": 67, "./flash-source-buffer": 69, "global/document": 31 }], 69: [function(e, t, i) { (function(r) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var n = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), a = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function s(e) { return e && e.__esModule ? e : { default: e } } var o = s(e("global/window")), u = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null), l = s(e("mux.js/lib/flv")), d = s(e("./remove-cues-from-track")), c = s(e("./create-text-tracks-if-necessary")), h = e("./add-text-track-data"), f = s(e("./flash-transmuxer-worker")), p = s(e("webwackify")), m = s(e("./flash-constants")), g = function() { var t = void 0; try { t = e.resolve("./flash-transmuxer-worker") } catch (e) {} return t }, v = function(e) { o.default.setTimeout(e, m.default.TIME_BETWEEN_CHUNKS) }, y = function() { return Math.random().toString(36).slice(2, 8) }, _ = function(e, t) { ("number" != typeof t || t < 0) && (t = 0); var i = Math.pow(10, t); return Math.round(e * i) / i }, b = function(e) { function t(e) { var i = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this); var r; this.chunkSize_ = m.default.BYTES_PER_CHUNK, this.buffer_ = [], this.bufferSize_ = 0, this .basePtsOffset_ = NaN, this.mediaSource_ = e, this.audioBufferEnd_ = NaN, this .videoBufferEnd_ = NaN, this.updating = !1, this.timestampOffset_ = 0, r = o.default.btoa( String.fromCharCode.apply(null, Array.prototype.slice.call(l.default.getFlvHeader()))); var n = this.mediaSource_.player_.id().replace(/[^a-zA-Z0-9]/g, "_"); this.flashEncodedHeaderName_ = "vjs_flashEncodedHeader_" + n + y(), this .flashEncodedDataName_ = "vjs_flashEncodedData_" + n + y(), o.default[this .flashEncodedHeaderName_] = function() { return delete o.default[i.flashEncodedHeaderName_], r }, this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedHeaderName_), this .transmuxer_ = (0, p.default)(f.default, g()), this.transmuxer_.postMessage({ action: "init", options: {} }), this.transmuxer_.onmessage = function(e) { "data" === e.data.action && i.receiveBuffer_(e.data.segment) }, this.one("updateend", function() { i.mediaSource_.tech_.trigger("loadedmetadata") }), Object.defineProperty(this, "timestampOffset", { get: function() { return this.timestampOffset_ }, set: function(e) { "number" == typeof e && e >= 0 && (this.timestampOffset_ = e, this.mediaSource_ .swfObj.vjs_discontinuity(), this.basePtsOffset_ = NaN, this.audioBufferEnd_ = NaN, this.videoBufferEnd_ = NaN, this.transmuxer_.postMessage({ action: "reset" })) } }), Object.defineProperty(this, "buffered", { get: function() { if (!(this.mediaSource_ && this.mediaSource_.swfObj && "vjs_getProperty" in this .mediaSource_.swfObj)) return u.default.createTimeRange(); var e = this.mediaSource_.swfObj.vjs_getProperty("buffered"); return e && e.length && (e[0][0] = _(e[0][0], 3), e[0][1] = _(e[0][1], 3)), u .default.createTimeRanges(e) } }), this.mediaSource_.player_.on("seeked", function() { if ((0, d.default)(0, 1 / 0, i.metadataTrack_), i.inbandTextTracks_) for (var e in i.inbandTextTracks_)(0, d.default)(0, 1 / 0, i.inbandTextTracks_[e]) }); var s = this.onHlsReset_.bind(this); this.mediaSource_.player_.tech_.on("hls-reset", s), this.mediaSource_.player_.tech_.hls.on( "dispose", function() { i.transmuxer_.terminate(), i.mediaSource_.player_.tech_.off("hls-reset", s) }) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, u["default"].EventTarget), n(t, [{ key: "appendBuffer", value: function(e) { var t = void 0; if (this.updating) throw (t = new Error( "SourceBuffer.append() cannot be called while an update is in progress")) .name = "InvalidStateError", t.code = 11, t; this.updating = !0, this.mediaSource_.readyState = "open", this.trigger({ type: "update" }), this.transmuxer_.postMessage({ action: "push", data: e.buffer, byteOffset: e.byteOffset, byteLength: e.byteLength }, [e.buffer]), this.transmuxer_.postMessage({ action: "flush" }) } }, { key: "abort", value: function() { this.buffer_ = [], this.bufferSize_ = 0, this.mediaSource_.swfObj.vjs_abort(), this .updating && (this.updating = !1, this.trigger({ type: "updateend" })) } }, { key: "remove", value: function(e, t) { if ((0, d.default)(e, t, this.metadataTrack_), this.inbandTextTracks_) for (var i in this.inbandTextTracks_)(0, d.default)(e, t, this.inbandTextTracks_[ i]); this.trigger({ type: "update" }), this.trigger({ type: "updateend" }) } }, { key: "receiveBuffer_", value: function(e) { var t = this; (0, c.default)(this, this.mediaSource_, e), (0, h.addTextTrackData)(this, e .captions, e.metadata), v(function() { var i = t.convertTagsToData_(e); 0 === t.buffer_.length && v(t.processBuffer_.bind(t)), i && (t.buffer_.push( i), t.bufferSize_ += i.byteLength) }) } }, { key: "processBuffer_", value: function() { var e = this, t = m.default.BYTES_PER_CHUNK; if (this.buffer_.length) { var i = this.buffer_[0].subarray(0, t); i.byteLength < t || this.buffer_[0].byteLength === t ? this.buffer_.shift() : this .buffer_[0] = this.buffer_[0].subarray(t), this.bufferSize_ -= i.byteLength; for (var r = [], n = i.byteLength, a = 0; a < n; a++) r.push(String.fromCharCode( i[a])); var s = o.default.btoa(r.join("")); o.default[this.flashEncodedDataName_] = function() { return v(e.processBuffer_.bind(e)), delete o.default[e.flashEncodedDataName_], s }, this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedDataName_) } else !1 !== this.updating && (this.updating = !1, this.trigger({ type: "updateend" })) } }, { key: "convertTagsToData_", value: function(e) { var t = 0, i = this.mediaSource_.tech_, r = 0, n = void 0, a = e.tags.videoTags, s = e.tags.audioTags; if (isNaN(this.basePtsOffset_) && (a.length || s.length)) { var o = a[0] || { pts: 1 / 0 }, u = s[0] || { pts: 1 / 0 }; this.basePtsOffset_ = Math.min(u.pts, o.pts) } i.seeking() && (this.videoBufferEnd_ = NaN, this.audioBufferEnd_ = NaN), isNaN(this .videoBufferEnd_) ? (i.buffered().length && (r = i.buffered().end(0) - this .timestampOffset), i.seeking() && (r = Math.max(r, i.currentTime() - this .timestampOffset)), r *= 1e3, r += this.basePtsOffset_) : r = this .videoBufferEnd_ + .1; var l = a.length; if (l && a[l - 1].pts >= r) { for (; --l;) { var d = a[l]; if (!(d.pts > r) && (d.keyFrame || d.metaDataTag)) break } for (; l;) { if (!a[l - 1].metaDataTag) break; l-- } } var c = a.slice(l), h = void 0; for (h = isNaN(this.audioBufferEnd_) ? r : this.audioBufferEnd_ + .1, c.length && ( h = Math.min(h, c[0].pts)), l = 0; l < s.length && !(s[l].pts >= h);) l++; var f = s.slice(l); f.length && (this.audioBufferEnd_ = f[f.length - 1].pts), c.length && (this .videoBufferEnd_ = c[c.length - 1].pts); var p = this.getOrderedTags_(c, f); if (0 !== p.length) { if (p[0].pts < r && i.seeking()) { var m = i.currentTime() - (r - p[0].pts) / 1e3; m < 1 / 30 && (m = 0); try { this.mediaSource_.swfObj.vjs_adjustCurrentTime(m) } catch (e) {} } for (var g = 0; g < p.length; g++) t += p[g].bytes.byteLength; n = new Uint8Array(t); g = 0; for (var v = 0; g < p.length; g++) n.set(p[g].bytes, v), v += p[g].bytes .byteLength; return n } } }, { key: "getOrderedTags_", value: function(e, t) { for (var i = void 0, r = []; e.length || t.length;) i = e.length ? t.length && t[0] .dts < e[0].dts ? t.shift() : e.shift() : t.shift(), r.push(i); return r } }, { key: "onHlsReset_", value: function() { this.transmuxer_.postMessage({ action: "resetCaptions" }) } }]), t }(); i.default = b, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./add-text-track-data": 64, "./create-text-tracks-if-necessary": 66, "./flash-constants": 67, "./flash-transmuxer-worker": 70, "./remove-cues-from-track": 72, "global/window": 32, "mux.js/lib/flv": 46, webwackify: 76 }], 70: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); function n(e) { return e && e.__esModule ? e : { default: e } } var a = n(e("global/window")), s = n(e("mux.js/lib/flv")), o = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.options = t || {}, this.init() } return r(e, [{ key: "init", value: function() { var e; this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new s.default .Transmuxer(this.options), (e = this.transmuxer).on("data", function(e) { a.default.postMessage({ action: "data", segment: e }) }), e.on("done", function(e) { a.default.postMessage({ action: "done" }) }) } }, { key: "push", value: function(e) { var t = new Uint8Array(e.data, e.byteOffset, e.byteLength); this.transmuxer.push(t) } }, { key: "reset", value: function() { this.init() } }, { key: "flush", value: function() { this.transmuxer.flush() } }, { key: "resetCaptions", value: function() { this.transmuxer.resetCaptions() } }]), e }(); i.default = function(e) { return new function(e) { e.onmessage = function(e) { "init" === e.data.action && e.data.options ? this.messageHandlers = new o(e.data.options) : (this.messageHandlers || (this.messageHandlers = new o), e.data && e.data.action && "init" !== e.data.action && this.messageHandlers[e.data.action] && this.messageHandlers[ e.data.action](e.data)) } }(e) }, t.exports = i.default }, { "global/window": 32, "mux.js/lib/flv": 46 }], 71: [function(e, t, i) { (function(r) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var n = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), a = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function s(e) { return e && e.__esModule ? e : { default: e } } var o = s(e("global/window")), u = s(e("global/document")), l = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null), d = s(e("./virtual-source-buffer")), c = e("./add-text-track-data"), h = e("./codec-utils"), f = function(e) { function t() { var e = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this); var i = void 0; for (i in this.nativeMediaSource_ = new o.default.MediaSource, this.nativeMediaSource_) i in t .prototype || "function" != typeof this.nativeMediaSource_[i] || (this[i] = this .nativeMediaSource_[i].bind(this.nativeMediaSource_)); this.duration_ = NaN, Object.defineProperty(this, "duration", { get: function() { return this.duration_ === 1 / 0 ? this.duration_ : this.nativeMediaSource_.duration }, set: function(e) { this.duration_ = e, e === 1 / 0 || (this.nativeMediaSource_.duration = e) } }), Object.defineProperty(this, "seekable", { get: function() { return this.duration_ === 1 / 0 ? l.default.createTimeRanges([ [0, this.nativeMediaSource_.duration] ]) : this.nativeMediaSource_.seekable } }), Object.defineProperty(this, "readyState", { get: function() { return this.nativeMediaSource_.readyState } }), Object.defineProperty(this, "activeSourceBuffers", { get: function() { return this.activeSourceBuffers_ } }), this.sourceBuffers = [], this.activeSourceBuffers_ = [], this .updateActiveSourceBuffers_ = function() { if (e.activeSourceBuffers_.length = 0, 1 === e.sourceBuffers.length) { var t = e.sourceBuffers[0]; return t.appendAudioInitSegment_ = !0, t.audioDisabled_ = !t.audioCodec_, void e .activeSourceBuffers_.push(t) } for (var i = !1, r = !0, n = 0; n < e.player_.audioTracks().length; n++) { var a = e.player_.audioTracks()[n]; if (a.enabled && "main" !== a.kind) { i = !0, r = !1; break } } e.sourceBuffers.forEach(function(t) { if (t.appendAudioInitSegment_ = !0, t.videoCodec_ && t.audioCodec_) t .audioDisabled_ = i; else if (t.videoCodec_ && !t.audioCodec_) t.audioDisabled_ = !0, r = !1; else if (!t.videoCodec_ && t.audioCodec_ && (t.audioDisabled_ = r, r)) return; e.activeSourceBuffers_.push(t) }) }, this.onPlayerMediachange_ = function() { e.sourceBuffers.forEach(function(e) { e.appendAudioInitSegment_ = !0 }) }, this.onHlsReset_ = function() { e.sourceBuffers.forEach(function(e) { e.transmuxer_ && e.transmuxer_.postMessage({ action: "resetCaptions" }) }) }, this.onHlsSegmentTimeMapping_ = function(t) { e.sourceBuffers.forEach(function(e) { return e.timeMapping_ = t.mapping }) }, ["sourceopen", "sourceclose", "sourceended"].forEach(function(e) { this.nativeMediaSource_.addEventListener(e, this.trigger.bind(this)) }, this), this.on("sourceopen", function(t) { var i = u.default.querySelector('[src="' + e.url_ + '"]'); i && (e.player_ = (0, l.default)(i.parentNode), e.player_.tech_.on("hls-reset", e .onHlsReset_), e.player_.tech_.on("hls-segment-time-mapping", e .onHlsSegmentTimeMapping_), e.player_.audioTracks && e.player_.audioTracks() && (e .player_.audioTracks().on("change", e.updateActiveSourceBuffers_), e.player_ .audioTracks().on("addtrack", e.updateActiveSourceBuffers_), e.player_ .audioTracks().on("removetrack", e.updateActiveSourceBuffers_)), e.player_.on( "mediachange", e.onPlayerMediachange_)) }), this.on("sourceended", function(t) { for (var i = (0, c.durationOfVideo)(e.duration), r = 0; r < e.sourceBuffers .length; r++) { var n = e.sourceBuffers[r], a = n.metadataTrack_ && n.metadataTrack_.cues; a && a.length && (a[a.length - 1].endTime = i) } }), this.on("sourceclose", function(e) { this.sourceBuffers.forEach(function(e) { e.transmuxer_ && e.transmuxer_.terminate() }), this.sourceBuffers.length = 0, this.player_ && (this.player_.audioTracks && this .player_.audioTracks() && (this.player_.audioTracks().off("change", this .updateActiveSourceBuffers_), this.player_.audioTracks().off("addtrack", this .updateActiveSourceBuffers_), this.player_.audioTracks().off("removetrack", this .updateActiveSourceBuffers_)), this.player_.el_ && (this.player_.off( "mediachange", this.onPlayerMediachange_), this.player_.tech_.off("hls-reset", this.onHlsReset_), this.player_.tech_.off("hls-segment-time-mapping", this .onHlsSegmentTimeMapping_))) }) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, l["default"].EventTarget), n(t, [{ key: "addSeekableRange_", value: function(e, t) { var i = void 0; if (this.duration !== 1 / 0) throw (i = new Error( "MediaSource.addSeekableRange() can only be invoked when the duration is Infinity" )).name = "InvalidStateError", i.code = 11, i; (t > this.nativeMediaSource_.duration || isNaN(this.nativeMediaSource_.duration)) && (this.nativeMediaSource_.duration = t) } }, { key: "addSourceBuffer", value: function(e) { var t = void 0, i = (0, h.parseContentType)(e); if (/^(video|audio)\/mp2t$/i.test(i.type)) { var r = []; i.parameters && i.parameters.codecs && (r = i.parameters.codecs.split(","), r = ( r = (0, h.translateLegacyCodecs)(r)).filter(function(e) { return (0, h.isAudioCodec)(e) || (0, h.isVideoCodec)(e) })), 0 === r.length && (r = ["avc1.4d400d", "mp4a.40.2"]), t = new d.default( this, r), 0 !== this.sourceBuffers.length && (this.sourceBuffers[0] .createRealSourceBuffers_(), t.createRealSourceBuffers_(), this.sourceBuffers[ 0].audioDisabled_ = !0) } else t = this.nativeMediaSource_.addSourceBuffer(e); return this.sourceBuffers.push(t), t } }]), t }(); i.default = f, t.exports = i.default }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./add-text-track-data": 64, "./codec-utils": 65, "./virtual-source-buffer": 75, "global/document": 31, "global/window": 32 }], 72: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); i.default = function(e, t, i) { var r = void 0, n = void 0; if (i && i.cues) for (r = i.cues.length; r--;)(n = i.cues[r]).startTime <= t && n.endTime >= e && i.removeCue(n) }, t.exports = i.default }, {}], 73: [function(e, t, i) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(); function n(e) { return e && e.__esModule ? e : { default: e } } var a = n(e("global/window")), s = n(e("mux.js/lib/mp4")), o = function() { function e(t) { ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, e), this.options = t || {}, this.init() } return r(e, [{ key: "init", value: function() { var e; this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new s.default .Transmuxer(this.options), (e = this.transmuxer).on("data", function(e) { var t = e.initSegment; e.initSegment = { data: t.buffer, byteOffset: t.byteOffset, byteLength: t.byteLength }; var i = e.data; e.data = i.buffer, a.default.postMessage({ action: "data", segment: e, byteOffset: i.byteOffset, byteLength: i.byteLength }, [e.data]) }), e.captionStream && e.captionStream.on("data", function(e) { a.default.postMessage({ action: "caption", data: e }) }), e.on("done", function(e) { a.default.postMessage({ action: "done" }) }), e.on("gopInfo", function(e) { a.default.postMessage({ action: "gopInfo", gopInfo: e }) }) } }, { key: "push", value: function(e) { var t = new Uint8Array(e.data, e.byteOffset, e.byteLength); this.transmuxer.push(t) } }, { key: "reset", value: function() { this.init() } }, { key: "setTimestampOffset", value: function(e) { var t = e.timestampOffset || 0; this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4 * t)) } }, { key: "setAudioAppendStart", value: function(e) { this.transmuxer.setAudioAppendStart(Math.ceil(9e4 * e.appendStart)) } }, { key: "flush", value: function(e) { this.transmuxer.flush() } }, { key: "resetCaptions", value: function() { this.transmuxer.resetCaptions() } }, { key: "alignGopsWith", value: function(e) { this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice()) } }]), e }(); i.default = function(e) { return new function(e) { e.onmessage = function(e) { "init" === e.data.action && e.data.options ? this.messageHandlers = new o(e.data.options) : (this.messageHandlers || (this.messageHandlers = new o), e.data && e.data.action && "init" !== e.data.action && this.messageHandlers[e.data.action] && this.messageHandlers[ e.data.action](e.data)) } }(e) }, t.exports = i.default }, { "global/window": 32, "mux.js/lib/mp4": 55 }], 74: [function(e, t, i) { (function(t) { "use strict"; function r(e) { return e && e.__esModule ? e : { default: e } } Object.defineProperty(i, "__esModule", { value: !0 }); var n = r(e("global/window")), a = r(e("./flash-media-source")), s = r(e("./html-media-source")), o = r("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null), u = 0, l = { mode: "auto" }; o.default.mediaSources = {}; var d = function(e, t) { var i = o.default.mediaSources[e]; if (!i) throw new Error("Media Source not found (Video.js)"); i.trigger({ type: "sourceopen", swfId: t }) }, c = function() { return !!n.default.MediaSource && !!n.default.MediaSource.isTypeSupported && n.default .MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"') }, h = function(e) { var t = o.default.mergeOptions(l, e); if (this.MediaSource = { open: d, supportsNativeMediaSources: c }, "html5" === t.mode || "auto" === t.mode && c()) return new s.default; if (o.default.getTech("Flash")) return new a.default; throw new Error("Cannot use Flash or Html5 to create a MediaSource for this video") }; i.MediaSource = h, h.open = d, h.supportsNativeMediaSources = c; var f = { createObjectURL: function(e) { var t = void 0; return e instanceof s.default ? (t = n.default.URL.createObjectURL(e.nativeMediaSource_), e .url_ = t, t) : e instanceof a.default ? (t = "blob:vjs-media-source/" + u, u++, o .default.mediaSources[t] = e, t) : (t = n.default.URL.createObjectURL(e), e.url_ = t, t) } }; i.URL = f, o.default.MediaSource = h, o.default.URL = f }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./flash-media-source": 68, "./html-media-source": 71, "global/window": 32 }], 75: [function(e, t, i) { (function(t) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function a(e) { return e && e.__esModule ? e : { default: e } } var s = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null), o = a(e("./create-text-tracks-if-necessary")), u = a(e("./remove-cues-from-track")), l = e("./add-text-track-data"), d = a(e("webwackify")), c = a(e("./transmuxer-worker")), h = e("./codec-utils"), f = function() { var t = void 0; try { t = e.resolve("./transmuxer-worker") } catch (e) {} return t }, p = function(e, t, i) { if (!t || !e.length) return []; var r = Math.ceil(9e4 * (t.currentTime() - i + 3)), n = void 0; for (n = 0; n < e.length && !(e[n].pts > r); n++); return e.slice(n) }; i.gopsSafeToAlignWith = p; var m = function(e, t, i) { if (!t.length) return e; if (i) return t.slice(); for (var r = t[0].pts, n = 0; n < e.length && !(e[n].pts >= r); n++); return e.slice(0, n).concat(t) }; i.updateGopBuffer = m; var g = function(e, t, i, r) { for (var n = Math.ceil(9e4 * (t - r)), a = Math.ceil(9e4 * (i - r)), s = e.slice(), o = e .length; o-- && !(e[o].pts <= a);); if (-1 === o) return s; for (var u = o + 1; u-- && !(e[u].pts <= n);); return u = Math.max(u, 0), s.splice(u, o - u + 1), s }; i.removeGopBuffer = g; var v = function(e) { function t(e, i) { var r = this; ! function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, s.default .EventTarget), this.timestampOffset_ = 0, this.pendingBuffers_ = [], this .bufferUpdating_ = !1, this.mediaSource_ = e, this.codecs_ = i, this.audioCodec_ = null, this.videoCodec_ = null, this.audioDisabled_ = !1, this.appendAudioInitSegment_ = !0, this .gopBuffer_ = [], this.timeMapping_ = 0, this.safeAppend_ = s.default.browser.IE_VERSION >= 11; var a = { remux: !1, alignGopsAtEnd: this.safeAppend_ }; this.codecs_.forEach(function(e) { (0, h.isAudioCodec)(e) ? r.audioCodec_ = e: (0, h.isVideoCodec)(e) && (r.videoCodec_ = e) }), this.transmuxer_ = (0, d.default)(c.default, f()), this.transmuxer_.postMessage({ action: "init", options: a }), this.transmuxer_.onmessage = function(e) { return "data" === e.data.action ? r.data_(e) : "done" === e.data.action ? r.done_(e) : "gopInfo" === e.data.action ? r.appendGopInfo_(e) : void 0 }, Object.defineProperty(this, "timestampOffset", { get: function() { return this.timestampOffset_ }, set: function(e) { "number" == typeof e && e >= 0 && (this.timestampOffset_ = e, this .appendAudioInitSegment_ = !0, this.gopBuffer_.length = 0, this.timeMapping_ = 0, this.transmuxer_.postMessage({ action: "setTimestampOffset", timestampOffset: e })) } }), Object.defineProperty(this, "appendWindowStart", { get: function() { return (this.videoBuffer_ || this.audioBuffer_).appendWindowStart }, set: function(e) { this.videoBuffer_ && (this.videoBuffer_.appendWindowStart = e), this.audioBuffer_ && (this.audioBuffer_.appendWindowStart = e) } }), Object.defineProperty(this, "updating", { get: function() { return !!(this.bufferUpdating_ || !this.audioDisabled_ && this.audioBuffer_ && this .audioBuffer_.updating || this.videoBuffer_ && this.videoBuffer_.updating) } }), Object.defineProperty(this, "buffered", { get: function() { var e = null, t = null, i = 0, r = [], n = []; if (!this.videoBuffer_ && !this.audioBuffer_) return s.default.createTimeRange(); if (!this.videoBuffer_) return this.audioBuffer_.buffered; if (!this.audioBuffer_) return this.videoBuffer_.buffered; if (this.audioDisabled_) return this.videoBuffer_.buffered; if (0 === this.videoBuffer_.buffered.length && 0 === this.audioBuffer_.buffered .length) return s.default.createTimeRange(); for (var a = this.videoBuffer_.buffered, o = this.audioBuffer_.buffered, u = a .length; u--;) r.push({ time: a.start(u), type: "start" }), r.push({ time: a.end(u), type: "end" }); for (u = o.length; u--;) r.push({ time: o.start(u), type: "start" }), r.push({ time: o.end(u), type: "end" }); for (r.sort(function(e, t) { return e.time - t.time }), u = 0; u < r.length; u++) "start" === r[u].type ? 2 === ++i && (e = r[u] .time) : "end" === r[u].type && 1 === --i && (t = r[u].time), null !== e && null !== t && (n.push([e, t]), e = null, t = null); return s.default.createTimeRanges(n) } }) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, s["default"].EventTarget), r(t, [{ key: "data_", value: function(e) { var t = e.data.segment; t.data = new Uint8Array(t.data, e.data.byteOffset, e.data.byteLength), t .initSegment = new Uint8Array(t.initSegment.data, t.initSegment.byteOffset, t .initSegment.byteLength), (0, o.default)(this, this.mediaSource_, t), this .pendingBuffers_.push(t) } }, { key: "done_", value: function(e) { "closed" !== this.mediaSource_.readyState ? this.processPendingSegments_() : this .pendingBuffers_.length = 0 } }, { key: "createRealSourceBuffers_", value: function() { var e = this, t = ["audio", "video"]; t.forEach(function(i) { if (e[i + "Codec_"] && !e[i + "Buffer_"]) { var r = null; if (e.mediaSource_[i + "Buffer_"])(r = e.mediaSource_[i + "Buffer_"]) .updating = !1; else { var n = i + '/mp4;codecs="' + e[i + "Codec_"] + '"'; r = function(e, t) { var i = e.addSourceBuffer(t), r = Object.create(null); r.updating = !1, r.realBuffer_ = i; var n = function(e) { "function" == typeof i[e] ? r[e] = function() { return i[e].apply(i, arguments) } : void 0 === r[e] && Object.defineProperty(r, e, { get: function() { return i[e] }, set: function(t) { return i[e] = t } }) }; for (var a in i) n(a); return r }(e.mediaSource_.nativeMediaSource_, n), e.mediaSource_[i + "Buffer_"] = r } e[i + "Buffer_"] = r, ["update", "updatestart", "updateend"].forEach( function(n) { r.addEventListener(n, function() { if ("audio" !== i || !e.audioDisabled_) return "updateend" === n && (e[i + "Buffer_"].updating = !1), t.every(function(t) { return !("audio" !== t || !e.audioDisabled_) || (i === t || !e[t + "Buffer_"] || !e[t + "Buffer_"].updating ) }) ? e.trigger(n) : void 0 }) }) } }) } }, { key: "appendBuffer", value: function(e) { if (this.bufferUpdating_ = !0, this.audioBuffer_ && this.audioBuffer_.buffered .length) { var t = this.audioBuffer_.buffered; this.transmuxer_.postMessage({ action: "setAudioAppendStart", appendStart: t.end(t.length - 1) }) } this.videoBuffer_ && this.transmuxer_.postMessage({ action: "alignGopsWith", gopsToAlignWith: p(this.gopBuffer_, this.mediaSource_.player_, this .timeMapping_) }), this.transmuxer_.postMessage({ action: "push", data: e.buffer, byteOffset: e.byteOffset, byteLength: e.byteLength }, [e.buffer]), this.transmuxer_.postMessage({ action: "flush" }) } }, { key: "appendGopInfo_", value: function(e) { this.gopBuffer_ = m(this.gopBuffer_, e.data.gopInfo, this.safeAppend_) } }, { key: "remove", value: function(e, t) { if (this.videoBuffer_ && (this.videoBuffer_.updating = !0, this.videoBuffer_.remove( e, t), this.gopBuffer_ = g(this.gopBuffer_, e, t, this.timeMapping_)), !this .audioDisabled_ && this.audioBuffer_ && (this.audioBuffer_.updating = !0, this .audioBuffer_.remove(e, t)), (0, u.default)(e, t, this.metadataTrack_), this .inbandTextTracks_) for (var i in this.inbandTextTracks_)(0, u.default)(e, t, this.inbandTextTracks_[ i]) } }, { key: "processPendingSegments_", value: function() { var e = { video: { segments: [], bytes: 0 }, audio: { segments: [], bytes: 0 }, captions: [], metadata: [] }; e = this.pendingBuffers_.reduce(function(e, t) { var i = t.type, r = t.data, n = t.initSegment; return e[i].segments.push(r), e[i].bytes += r.byteLength, e[i].initSegment = n, t.captions && (e.captions = e.captions.concat(t.captions)), t.info && (e[ i].info = t.info), t.metadata && (e.metadata = e.metadata.concat(t .metadata)), e }, e), this.videoBuffer_ || this.audioBuffer_ || (0 === e.video.bytes && (this .videoCodec_ = null), 0 === e.audio.bytes && (this.audioCodec_ = null), this .createRealSourceBuffers_()), e.audio.info && this.mediaSource_.trigger({ type: "audioinfo", info: e.audio.info }), e.video.info && this.mediaSource_.trigger({ type: "videoinfo", info: e.video.info }), this.appendAudioInitSegment_ && (!this.audioDisabled_ && this.audioBuffer_ && (e.audio.segments.unshift(e.audio.initSegment), e.audio.bytes += e.audio .initSegment.byteLength), this.appendAudioInitSegment_ = !1); var t = !1; this.videoBuffer_ && e.video.bytes ? (e.video.segments.unshift(e.video.initSegment), e.video.bytes += e.video.initSegment.byteLength, this.concatAndAppendSegments_(e .video, this.videoBuffer_), (0, l.addTextTrackData)(this, e.captions, e .metadata)) : !this.videoBuffer_ || !this.audioDisabled_ && this .audioBuffer_ || (t = !0), !this.audioDisabled_ && this.audioBuffer_ && this .concatAndAppendSegments_(e.audio, this.audioBuffer_), this.pendingBuffers_ .length = 0, t && this.trigger("updateend"), this.bufferUpdating_ = !1 } }, { key: "concatAndAppendSegments_", value: function(e, t) { var i = 0, r = void 0; if (e.bytes) { r = new Uint8Array(e.bytes), e.segments.forEach(function(e) { r.set(e, i), i += e.byteLength }); try { t.updating = !0, t.appendBuffer(r) } catch (e) { this.mediaSource_.player_ && this.mediaSource_.player_.error({ code: -3, type: "APPEND_BUFFER_ERR", message: e.message, originalError: e }) } } } }, { key: "abort", value: function() { this.videoBuffer_ && this.videoBuffer_.abort(), !this.audioDisabled_ && this .audioBuffer_ && this.audioBuffer_.abort(), this.transmuxer_ && this.transmuxer_ .postMessage({ action: "reset" }), this.pendingBuffers_.length = 0, this.bufferUpdating_ = !1 } }]), t }(); i.default = v }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./add-text-track-data": 64, "./codec-utils": 65, "./create-text-tracks-if-necessary": 66, "./remove-cues-from-track": 72, "./transmuxer-worker": 73, webwackify: 76 }], 76: [function(e, t, i) { var r = arguments[3], n = arguments[4], a = arguments[5], s = JSON.stringify, o = !1; void 0 === r && (o = !0, r = function(e) { var t = {}; function i(r) { if (t[r]) return t[r].exports; var n = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports } return i.m = e, i.c = t, i.d = function(e, t, r) { i.o(e, t) || Object.defineProperty(e, t, { configurable: !1, enumerable: !0, get: r }) }, i.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e }; return i.d(t, "a", t), t }, i.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, i.p = "", i(i.s = entryModule) }, n = __webpack_modules__); t.exports = function(e, t) { var i; i = o ? function(e, t) { var i, a = "string" == typeof t; i = a ? {} : [], Object.keys(n).forEach(function(e) { n[e] && (i[e] = n[e].toString()) }); var o, u = __webpack_require__(t); if (!u || u !== e && u.default !== e) { var l = i[t]; i[t] = l.substring(0, l.length - 1) + "\n" + e.name + "();\n}" } a ? (t = s(t), o = "{" + Object.keys(i).map(function(e) { return s(e) + ":" + i[e] }).join(",") + "}") : o = "[" + i.join(",") + "]"; return "var fn = (" + r.toString().replace("entryModule", t) + ")(" + o + ');\n(typeof fn === "function") && fn(self);' }(e, t) : function(e) { for (var t, i = Object.keys(a), o = 0; o < i.length; o++) { var u = i[o], l = a[u].exports; if (l === e || l && l.default === e) { t = u; break } } if (!t) { t = Math.floor(Math.pow(16, 8) * Math.random()).toString(16); var d = {}; for (o = 0; o < i.length; o++) d[u = i[o]] = u; n[t] = ["function(require,module,exports){" + e + "(self); }", d] } var c = Math.floor(Math.pow(16, 8) * Math.random()).toString(16), h = {}; return h[t] = t, n[c] = ["function(require,module,exports){var f = require(" + s(t) + ");(f.default ? f.default : f)(self);}", h ], "(" + r + ")({" + Object.keys(n).map(function(e) { return s(e) + ":[" + n[e][0] + "," + s(n[e][1]) + "]" }).join(",") + "},{},[" + s(c) + "])" }(e); var u = new Blob([i], { type: "text/javascript" }), l = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(u), d = new Worker(l); return d.objectURL = l, d } }, {}], 77: [function(e, t, i) { (function(i) { "use strict"; var r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = function(e, t, i) { for (var r = !0; r;) { var n = e, a = t, s = i; r = !1, null === n && (n = Function.prototype); var o = Object.getOwnPropertyDescriptor(n, a); if (void 0 !== o) { if ("value" in o) return o.value; var u = o.get; if (void 0 === u) return; return u.call(s) } var l = Object.getPrototypeOf(n); if (null === l) return; e = l, t = a, i = s, r = !0, o = l = void 0 } }; function a(e) { return e && e.__esModule ? e : { default: e } } var s = a(e("global/document")), o = a(e("./playlist-loader")), u = a(e("./playlist")), l = a(e("./xhr")), d = e("aes-decrypter"), c = a(e("./bin-utils")), h = e("videojs-contrib-media-sources"), f = a(e("m3u8-parser")), p = a("undefined" != typeof window ? window.videojs : void 0 !== i ? i.videojs : null), m = e("./master-playlist-controller"), g = a(e("./config")), v = a(e("./rendition-mixin")), y = a(e("global/window")), _ = a(e("./playback-watcher")), b = a(e("./reload-source-on-error")), w = e("./playlist-selectors.js"), E = { PlaylistLoader: o.default, Playlist: u.default, Decrypter: d.Decrypter, AsyncStream: d.AsyncStream, decrypt: d.decrypt, utils: c.default, STANDARD_PLAYLIST_SELECTOR: w.lastBandwidthSelector, INITIAL_PLAYLIST_SELECTOR: w.lowestBitrateCompatibleVariantSelector, comparePlaylistBandwidth: w.comparePlaylistBandwidth, comparePlaylistResolution: w.comparePlaylistResolution, xhr: (0, l.default)() }; ["GOAL_BUFFER_LENGTH", "MAX_GOAL_BUFFER_LENGTH", "GOAL_BUFFER_LENGTH_RATE", "BUFFER_LOW_WATER_LINE", "MAX_BUFFER_LOW_WATER_LINE", "BUFFER_LOW_WATER_LINE_RATE", "BANDWIDTH_VARIANCE" ].forEach(function(e) { Object.defineProperty(E, e, { get: function() { return p.default.log.warn("using Hls." + e + " is UNSAFE be sure you know what you are doing"), g.default[e] }, set: function(t) { p.default.log.warn("using Hls." + e + " is UNSAFE be sure you know what you are doing"), "number" != typeof t || t < 0 ? p.default.log.warn("value of Hls." + e + " must be greater than or equal to 0") : g.default[e] = t } }) }); var T = function(e, t) { for (var i = t.media(), r = -1, n = 0; n < e.length; n++) if (e[n].id === i.uri) { r = n; break } e.selectedIndex_ = r, e.trigger({ selectedIndex: r, type: "change" }) }; E.canPlaySource = function() { return p.default.log.warn( "HLS is no longer a tech. Please remove it from your player's techOrder.") }, E.supportsNativeHls = function() { var e = s.default.createElement("video"); if (!p.default.getTech("Html5").isSupported()) return !1; return ["application/vnd.apple.mpegurl", "audio/mpegurl", "audio/x-mpegurl", "application/x-mpegurl", "video/x-mpegurl", "video/mpegurl", "application/mpegurl" ].some(function(t) { return /maybe|probably/i.test(e.canPlayType(t)) }) }(), E.isSupported = function() { return p.default.log.warn( "HLS is no longer a tech. Please remove it from your player's techOrder.") }; var S = p.default.getComponent("Component"), A = function(e) { function t(e, i, r) { var a = this; if (function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, i, r.hls), i.options_ && i.options_.playerId) { var o = (0, p.default)(i.options_.playerId); o.hasOwnProperty("hls") || Object.defineProperty(o, "hls", { get: function() { return p.default.log.warn( "player.hls is deprecated. Use player.tech_.hls instead."), i.trigger({ type: "usage", name: "hls-player-access" }), a } }) } if (this.tech_ = i, this.source_ = e, this.stats = {}, this.ignoreNextSeekingEvent_ = !1, this .setOptions_(), this.options_.overrideNative && (i.featuresNativeVideoTracks || i .featuresNativeAudioTracks)) throw new Error( "Overriding native HLS requires emulated tracks. See https://git.io/vMpjB"); this.on(s.default, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange" ], function(e) { var t = s.default.fullscreenElement || s.default.webkitFullscreenElement || s.default .mozFullScreenElement || s.default.msFullscreenElement; t && t.contains(a.tech_.el()) && a.masterPlaylistController_.fastQualityChange_() }), this.on(this.tech_, "seeking", function() { this.ignoreNextSeekingEvent_ ? this.ignoreNextSeekingEvent_ = !1 : this.setCurrentTime( this.tech_.currentTime()) }), this.on(this.tech_, "error", function() { this.masterPlaylistController_ && this.masterPlaylistController_.pauseLoading() }), this.on(this.tech_, "play", this.play) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, S), r(t, [{ key: "setOptions_", value: function() { var e = this; this.options_.withCredentials = this.options_.withCredentials || !1, "number" != typeof this.options_.blacklistDuration && (this.options_.blacklistDuration = 300), "number" != typeof this.options_.bandwidth && (this.options_.bandwidth = 4194304), this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && 4194304 === this.options_.bandwidth, ["withCredentials", "bandwidth", "handleManifestRedirects" ].forEach(function(t) { void 0 !== e.source_[t] && (e.options_[t] = e.source_[t]) }), this.bandwidth = this.options_.bandwidth } }, { key: "src", value: function(e) { var t = this; e && (this.setOptions_(), this.options_.url = this.source_.src, this.options_.tech = this.tech_, this.options_.externHls = E, this.masterPlaylistController_ = new m .MasterPlaylistController(this.options_), this.playbackWatcher_ = new _.default( p.default.mergeOptions(this.options_, { seekable: function() { return t.seekable() } })), this.masterPlaylistController_.on("error", function() { p.default.players[t.tech_.options_.playerId].error(t .masterPlaylistController_.error) }), this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this .selectPlaylist.bind(this) : E.STANDARD_PLAYLIST_SELECTOR.bind(this), this .masterPlaylistController_.selectInitialPlaylist = E.INITIAL_PLAYLIST_SELECTOR .bind(this), this.playlists = this.masterPlaylistController_ .masterPlaylistLoader_, this.mediaSource = this.masterPlaylistController_ .mediaSource, Object.defineProperties(this, { selectPlaylist: { get: function() { return this.masterPlaylistController_.selectPlaylist }, set: function(e) { this.masterPlaylistController_.selectPlaylist = e.bind(this) } }, throughput: { get: function() { return this.masterPlaylistController_.mainSegmentLoader_.throughput .rate }, set: function(e) { this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = e, this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1 } }, bandwidth: { get: function() { return this.masterPlaylistController_.mainSegmentLoader_.bandwidth }, set: function(e) { this.masterPlaylistController_.mainSegmentLoader_.bandwidth = e, this .masterPlaylistController_.mainSegmentLoader_.throughput = { rate: 0, count: 0 } } }, systemBandwidth: { get: function() { var e = 1 / (this.bandwidth || 1), t = void 0; return t = this.throughput > 0 ? 1 / this.throughput : 0, Math.floor( 1 / (e + t)) }, set: function() { p.default.log.error('The "systemBandwidth" property is read-only') } } }), Object.defineProperties(this.stats, { bandwidth: { get: function() { return t.bandwidth || 0 }, enumerable: !0 }, mediaRequests: { get: function() { return t.masterPlaylistController_.mediaRequests_() || 0 }, enumerable: !0 }, mediaRequestsAborted: { get: function() { return t.masterPlaylistController_.mediaRequestsAborted_() || 0 }, enumerable: !0 }, mediaRequestsTimedout: { get: function() { return t.masterPlaylistController_.mediaRequestsTimedout_() || 0 }, enumerable: !0 }, mediaRequestsErrored: { get: function() { return t.masterPlaylistController_.mediaRequestsErrored_() || 0 }, enumerable: !0 }, mediaTransferDuration: { get: function() { return t.masterPlaylistController_.mediaTransferDuration_() || 0 }, enumerable: !0 }, mediaBytesTransferred: { get: function() { return t.masterPlaylistController_.mediaBytesTransferred_() || 0 }, enumerable: !0 }, mediaSecondsLoaded: { get: function() { return t.masterPlaylistController_.mediaSecondsLoaded_() || 0 }, enumerable: !0 } }), this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay .bind(this.masterPlaylistController_)), this.masterPlaylistController_.on( "selectedinitialmedia", function() { (0, v.default)(t) }), this.on(this.masterPlaylistController_, "progress", function() { this.tech_.trigger("progress") }), this.on(this.masterPlaylistController_, "firstplay", function() { this.ignoreNextSeekingEvent_ = !0 }), this.tech_.ready(function() { return t.setupQualityLevels_() }), this.tech_.el() && this.tech_.src(p.default.URL.createObjectURL(this .masterPlaylistController_.mediaSource))) } }, { key: "setupQualityLevels_", value: function() { var e = this, t = p.default.players[this.tech_.options_.playerId]; t && t.qualityLevels && (this.qualityLevels_ = t.qualityLevels(), this .masterPlaylistController_.on("selectedinitialmedia", function() { var t, i; t = e.qualityLevels_, (i = e).representations().forEach(function(e) { t.addQualityLevel(e) }), T(t, i.playlists) }), this.playlists.on("mediachange", function() { T(e.qualityLevels_, e.playlists) })) } }, { key: "play", value: function() { this.masterPlaylistController_.play() } }, { key: "setCurrentTime", value: function(e) { this.masterPlaylistController_.setCurrentTime(e) } }, { key: "duration", value: function() { return this.masterPlaylistController_.duration() } }, { key: "seekable", value: function() { return this.masterPlaylistController_.seekable() } }, { key: "dispose", value: function() { this.playbackWatcher_ && this.playbackWatcher_.dispose(), this .masterPlaylistController_ && this.masterPlaylistController_.dispose(), this .qualityLevels_ && this.qualityLevels_.dispose(), n(Object.getPrototypeOf(t .prototype), "dispose", this).call(this) } }]), t }(), k = function e(t) { return { canHandleSource: function(i) { var r = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], n = p.default.mergeOptions(p.default.options, r); return (!n.hls || !n.hls.mode || n.hls.mode === t) && e.canPlayType(i.type, n) }, handleSource: function(e, i) { var r = arguments.length <= 2 || void 0 === arguments[2] ? {} : arguments[2], n = p.default.mergeOptions(p.default.options, r, { hls: { mode: t } }); return "flash" === t && i.setTimeout(function() { i.trigger("loadstart") }, 1), i.hls = new A(e, i, n), i.hls.xhr = (0, l.default)(), i.hls.src(e.src), i.hls }, canPlayType: function(t) { var i = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1], r = p.default.mergeOptions(p.default.options, i); return e.canPlayType(t, r) ? "maybe" : "" } } }; k.canPlayType = function(e, t) { if (p.default.browser.IE_VERSION && p.default.browser.IE_VERSION <= 10) return !1; return !(!t.hls.overrideNative && E.supportsNativeHls) && /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e) }, void 0 !== p.default.MediaSource && void 0 !== p.default.URL || (p.default.MediaSource = h .MediaSource, p.default.URL = h.URL); var R = p.default.getTech("Flash"); h.MediaSource.supportsNativeMediaSources() && p.default.getTech("Html5").registerSourceHandler(k( "html5"), 0), y.default.Uint8Array && R && R.registerSourceHandler(k("flash")), p.default .HlsHandler = A, p.default.HlsSourceHandler = k, p.default.Hls = E, p.default.use || p.default .registerComponent("Hls", E), p.default.m3u8 = f.default, p.default.options.hls = p.default .options.hls || {}, p.default.registerPlugin ? p.default.registerPlugin("reloadSourceOnError", b .default) : p.default.plugin("reloadSourceOnError", b.default), t.exports = { Hls: E, HlsHandler: A, HlsSourceHandler: k } }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, { "./bin-utils": 2, "./config": 3, "./master-playlist-controller": 5, "./playback-watcher": 8, "./playlist": 11, "./playlist-loader": 9, "./playlist-selectors.js": 10, "./reload-source-on-error": 13, "./rendition-mixin": 14, "./xhr": 21, "aes-decrypter": 25, "global/document": 31, "global/window": 32, "m3u8-parser": 33, "videojs-contrib-media-sources": 74 }] }, {}, [77])(77) }), function(e) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = e(); else if ("function" == typeof define && define.amd) define([], e); else { ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).videojsFlvjs = e() } }(function() { return function e(t, i, r) { function n(s, o) { if (!i[s]) { if (!t[s]) { var u = "function" == typeof require && require; if (!o && u) return u(s, !0); if (a) return a(s, !0); var l = new Error("Cannot find module '" + s + "'"); throw l.code = "MODULE_NOT_FOUND", l } var d = i[s] = { exports: {} }; t[s][0].call(d.exports, function(e) { var i = t[s][1][e]; return n(i || e) }, d, d.exports, e, t, i, r) } return i[s].exports } for (var a = "function" == typeof require && require, s = 0; s < r.length; s++) n(r[s]); return n }({ 1: [function(e, t, i) { (function(e) { "use strict"; Object.defineProperty(i, "__esModule", { value: !0 }); var t, r = function() { function e(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r) } } return function(t, i, r) { return i && e(t.prototype, i), r && e(t, r), t } }(), n = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null, a = (t = n) && t.__esModule ? t : { default: t }; var s = a.default.getTech("Html5"), o = a.default.mergeOptions || a.default.util.mergeOptions, u = { mediaDataSource: {}, config: {} }, l = function(e) { function t(e, i) { return function(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") }(this, t), e = o(u, e), function(e, t) { if (!e) throw new ReferenceError( "this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, i)) } return function(e, t) { if ("function" != typeof t && null !== t) throw new TypeError( "Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) }(t, s), r(t, [{ key: "setSrc", value: function(e) { this.flvPlayer && (this.flvPlayer.detachMediaElement(), this.flvPlayer.destroy()); var t = this.options_.mediaDataSource, i = this.options_.config; t.type = void 0 === t.type ? "flv" : t.type, t.url = e, this.flvPlayer = window .flvjs.createPlayer(t, i), this.flvPlayer.attachMediaElement(this.el_), this .flvPlayer.load() } }, { key: "dispose", value: function() { this.flvPlayer && (this.flvPlayer.detachMediaElement(), this.flvPlayer.destroy()), function e(t, i, r) { null === t && (t = Function.prototype); var n = Object.getOwnPropertyDescriptor(t, i); if (void 0 === n) { var a = Object.getPrototypeOf(t); return null === a ? void 0 : e(a, i, r) } if ("value" in n) return n.value; var s = n.get; return void 0 !== s ? s.call(r) : void 0 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "dispose", this) .call(this) } }]), t }(); l.isSupported = function() { return window.flvjs && window.flvjs.isSupported() }, l.formats = { "video/flv": "FLV", "video/x-flv": "FLV" }, l.canPlayType = function(e) { return l.isSupported() && e in l.formats ? "maybe" : "" }, l.canPlaySource = function(e, t) { return l.canPlayType(e.type) }, l.VERSION = "0.2.0", a.default.registerTech("Flvjs", l), i.default = l }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) }, {}] }, {}, [1])(1) }), function() { "use strict"; var e = null; e = void 0 === window.videojs && "function" == typeof require ? require("video.js") : window.videojs, function(e, t) { var i, r = {}, n = {}, a = {}; function s(e, t, i, r) { return n = { label: i, sources: t }, "function" == typeof r ? r(e, t, i) : e.src(t.map(function(e) { return { src: e.src, type: e.type, res: e.res } })) } var o = t.getComponent("MenuItem"), u = t.extend(o, { constructor: function(e, t, i, r) { this.onClickListener = i, this.label = r, o.call(this, e, t), this.src = t.src, this.on("click", this .onClick), this.on("touchstart", this.onClick), t.initialySelected && (this.showAsLabel(), this .selected(!0), this.addClass("vjs-selected")) }, showAsLabel: function() { this.label && (this.label.innerHTML = this.options_.label) }, onClick: function(e) { this.onClickListener(this); var t = this.player_.currentTime(), i = this.player_.paused(); this.showAsLabel(), this.addClass("vjs-selected"), i || this.player_.bigPlayButton.hide(), "function" != typeof e && "function" == typeof this.options_.customSourcePicker && (e = this.options_ .customSourcePicker); var r = "loadeddata"; "Youtube" !== this.player_.techName_ && "none" === this.player_.preload() && "Flash" !== this.player_ .techName_ && (r = "timeupdate"), s(this.player_, this.src, this.options_.label, e), this.player_.one( r, function() { this.player_.currentTime(t), this.player_.handleTechSeeked_(), this.player_.trigger( "resolutionchange") }) } }), l = t.getComponent("MenuButton"), d = t.extend(l, { constructor: function(e, i, r, n) { if (this.sources = i.sources, this.label = n, this.label.innerHTML = i.initialySelectedLabel, l.call( this, e, i, r), this.controlText("Quality"), r.dynamicLabel) this.el().appendChild(n); else { var a = document.createElement("span"); t.dom.addClass(a, "vjs-resolution-button-staticlabel"), this.el().appendChild(a) } }, createItems: function() { var e = [], t = this.sources && this.sources.label || {}, i = function(t) { e.map(function(e) { e.selected(e === t), e.removeClass("vjs-selected") }) }; for (var r in t) t.hasOwnProperty(r) && (e.push(new u(this.player_, { label: r, src: t[r], initialySelected: r === this.options_.initialySelectedLabel, customSourcePicker: this.options_.customSourcePicker }, i, this.label)), a[r] = e[e.length - 1]); return e } }); i = function(e) { var i = t.mergeOptions(r, e), o = this, u = document.createElement("span"), l = {}; function c(e, t) { return e.res && t.res ? +t.res - +e.res : 0 } function h(e) { var t = { label: {}, res: {}, type: {} }; return e.map(function(e) { f(t, "label", e), f(t, "res", e), f(t, "type", e), p(t, "label", e), p(t, "res", e), p(t, "type", e) }), t } function f(e, t, i) { null == e[t][i[t]] && (e[t][i[t]] = []) } function p(e, t, i) { e[t][i[t]].push(i) } t.dom.addClass(u, "vjs-resolution-button-label"), o.updateSrc = function(e) { if (!e) return o.src(); o.controlBar.resolutionSwitcher && (o.controlBar.resolutionSwitcher.dispose(), delete o.controlBar .resolutionSwitcher), e = e.sort(c); var r = function(e, t) { var r = i.default, n = ""; "high" === r ? (r = t[0].res, n = t[0].label) : "low" !== r && null != r && e.res[r] ? e.res[r] && ( n = e.res[r][0].label) : (r = t[t.length - 1].res, n = t[t.length - 1].label); return { res: r, label: n, sources: e.res[r] } }(l = h(e), e), n = new d(o, { sources: l, initialySelectedLabel: r.label, initialySelectedRes: r.res, customSourcePicker: i.customSourcePicker }, i, u); return t.dom.addClass(n.el(), "vjs-resolution-button"), o.controlBar.resolutionSwitcher = o.controlBar.el_ .insertBefore(n.el_, o.controlBar.getChild("fullscreenToggle").el_), o.controlBar.resolutionSwitcher .dispose = function() { this.parentNode.removeChild(this) }, s(o, r.sources, r.label) }, o.currentResolution = function(e, t) { return null == e ? n : (null != a[e] && a[e].onClick(t), o) }, o.getGroupedSrc = function() { return l }, o.ready(function() { o.options_.sources.length > 1 && o.updateSrc(o.options_.sources), "Youtube" === o.techName_ && function( e) { e.tech_.ytPlayer.setPlaybackQuality("default"), e.tech_.ytPlayer.addEventListener( "onPlaybackQualityChange", function() { e.trigger("resolutionchange") }), e.one("play", function() { var t = { highres: { res: 1080, label: "1080", yt: "highres" }, hd1080: { res: 1080, label: "1080", yt: "hd1080" }, hd720: { res: 720, label: "720", yt: "hd720" }, large: { res: 480, label: "480", yt: "large" }, medium: { res: 360, label: "360", yt: "medium" }, small: { res: 240, label: "240", yt: "small" }, tiny: { res: 144, label: "144", yt: "tiny" }, auto: { res: 0, label: "auto", yt: "default" } }, r = []; e.tech_.ytPlayer.getAvailableQualityLevels().map(function(i) { r.push({ src: e.src().src, type: e.src().type, label: t[i].label, res: t[i].res, _yt: t[i].yt }) }); var n = "auto", a = 0, s = ((l = h(r)).label.auto, new d(e, { sources: l, initialySelectedLabel: n, initialySelectedRes: a, customSourcePicker: function(t, i, r) { return e.tech_.ytPlayer.setPlaybackQuality(i[0]._yt), e } }, i, u)); s.el().classList.add("vjs-resolution-button"), e.controlBar.resolutionSwitcher = e.controlBar .addChild(s) }) }(o) }) }, t.registerPlugin("videoJsResolutionSwitcher", i) }(window, e) }(), function(e, t) { "undefined" != typeof window && window.videojs ? t(window.videojs) : "function" == typeof define && define.amd ? define("videojs-hotkeys", ["video.js"], function(e) { return t(e.default || e) }) : "undefined" != typeof module && module.exports && (module.exports = t(require("video.js"))) }(0, function(e) { "use strict"; "undefined" != typeof window && (window.videojs_hotkeys = { version: "0.2.22" }); (e.registerPlugin || e.plugin)("hotkeys", function(t) { var i = this, r = i.el(), n = document, a = { volumeStep: .1, seekStep: 5, enableMute: !0, enableVolumeScroll: !0, enableFullscreen: !0, enableNumbers: !0, enableJogStyle: !1, alwaysCaptureHotkeys: !1, enableModifiersForNumbers: !0, enableInactiveFocus: !0, skipInitialFocus: !1, playPauseKey: function(e) { return 32 === e.which || 179 === e.which }, rewindKey: function(e) { return 37 === e.which || 177 === e.which }, forwardKey: function(e) { return 39 === e.which || 176 === e.which }, volumeUpKey: function(e) { return 38 === e.which }, volumeDownKey: function(e) { return 40 === e.which }, muteKey: function(e) { return 77 === e.which }, fullscreenKey: function(e) { return 70 === e.which }, customKeys: {} }, s = e.mergeOptions || e.util.mergeOptions, o = (t = s(a, t || {})).volumeStep, u = t.seekStep, l = t.enableMute, d = t.enableVolumeScroll, c = t.enableFullscreen, h = t.enableNumbers, f = t.enableJogStyle, p = t.alwaysCaptureHotkeys, m = t.enableModifiersForNumbers, g = t.enableInactiveFocus, v = t.skipInitialFocus; r.hasAttribute("tabIndex") || r.setAttribute("tabIndex", "-1"), r.style.outline = "none", !p && i.autoplay() || v || i.one("play", function() { r.focus() }), g && i.on("userinactive", function() { var e = function() { clearTimeout(t) }, t = setTimeout(function() { i.off("useractive", e); var t = n.activeElement, a = r.querySelector(".vjs-control-bar"); t && t.parentElement == a && r.focus() }, 10); i.one("useractive", e) }), i.on("play", function() { var e = r.querySelector(".iframeblocker"); e && "" === e.style.display && (e.style.display = "block", e.style.bottom = "39px") }); var y = function(e) { if (i.controls()) { var t = n.activeElement; if ((p || t == r || t == r.querySelector(".vjs-tech") || t == r.querySelector(".iframeblocker") || t == r .querySelector(".vjs-control-bar")) && d) { e = window.event || e; var a = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail)); e.preventDefault(), 1 == a ? i.volume(i.volume() + o) : -1 == a && i.volume(i.volume() - o) } } }, _ = function(e, i) { return t.playPauseKey(e, i) ? 1 : t.rewindKey(e, i) ? 2 : t.forwardKey(e, i) ? 3 : t.volumeUpKey(e, i) ? 4 : t.volumeDownKey(e, i) ? 5 : t.muteKey(e, i) ? 6 : t.fullscreenKey(e, i) ? 7 : void 0 }; function b(e) { return "function" == typeof u ? u(e) : u } return i.on("keydown", function(e) { var a, s, u = e.which, d = e.preventDefault, g = i.duration(); if (i.controls()) { var v = n.activeElement; if (p || v == r || v == r.querySelector(".vjs-tech") || v == r.querySelector(".vjs-control-bar") || v == r.querySelector(".iframeblocker")) switch (_(e, i)) { case 1: d(), p && e.stopPropagation(), i.paused() ? i.play() : i.pause(); break; case 2: a = !i.paused(), d(), a && i.pause(), (s = i.currentTime() - b(e)) <= 0 && (s = 0), i.currentTime( s), a && i.play(); break; case 3: a = !i.paused(), d(), a && i.pause(), (s = i.currentTime() + b(e)) >= g && (s = a ? g - .001 : g), i.currentTime(s), a && i.play(); break; case 5: d(), f ? (s = i.currentTime() - 1, i.currentTime() <= 1 && (s = 0), i.currentTime(s)) : i.volume(i .volume() - o); break; case 4: d(), f ? ((s = i.currentTime() + 1) >= g && (s = g), i.currentTime(s)) : i.volume(i.volume() + o); break; case 6: l && i.muted(!i.muted()); break; case 7: c && (i.isFullscreen() ? i.exitFullscreen() : i.requestFullscreen()); break; default: if ((u > 47 && u < 59 || u > 95 && u < 106) && (m || !(e.metaKey || e.ctrlKey || e.altKey)) && h) { var y = 48; u > 95 && (y = 96); var w = u - y; d(), i.currentTime(i.duration() * w * .1) } for (var E in t.customKeys) { var T = t.customKeys[E]; T && T.key && T.handler && T.key(e) && (d(), T.handler(i, t, e)) } } } }), i.on("dblclick", function(e) { if (i.controls()) { var t = e.relatedTarget || e.toElement || n.activeElement; t != r && t != r.querySelector(".vjs-tech") && t != r.querySelector(".iframeblocker") || c && (i .isFullscreen() ? i.exitFullscreen() : i.requestFullscreen()) } }), i.on("mousewheel", y), i.on("DOMMouseScroll", y), this }) }), "undefined" != typeof window && function(e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.Hls = t() : e.Hls = t() }(this, function() { return function(e) { var t = {}; function i(r) { if (t[r]) return t[r].exports; var n = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports } return i.m = e, i.c = t, i.d = function(e, t, r) { i.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }) }, i.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) }, i.t = function(e, t) { if (1 & t && (e = i(e)), 8 & t) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var r = Object.create(null); if (i.r(r), Object.defineProperty(r, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var n in e) i.d(r, n, function(t) { return e[t] }.bind(null, n)); return r }, i.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e }; return i.d(t, "a", t), t }, i.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, i.p = "/dist/", i(i.s = "./src/hls.ts") }({ "./node_modules/eventemitter3/index.js": function(e, t, i) { "use strict"; var r = Object.prototype.hasOwnProperty, n = "~"; function a() {} function s(e, t, i, r, a) { if ("function" != typeof i) throw new TypeError("The listener must be a function"); var s = new function(e, t, i) { this.fn = e, this.context = t, this.once = i || !1 }(i, r || e, a), o = n ? n + t : t; return e._events[o] ? e._events[o].fn ? e._events[o] = [e._events[o], s] : e._events[o].push(s) : (e ._events[o] = s, e._eventsCount++), e } function o(e, t) { 0 == --e._eventsCount ? e._events = new a : delete e._events[t] } function u() { this._events = new a, this._eventsCount = 0 } Object.create && (a.prototype = Object.create(null), (new a).__proto__ || (n = !1)), u.prototype .eventNames = function() { var e, t, i = []; if (0 === this._eventsCount) return i; for (t in e = this._events) r.call(e, t) && i.push(n ? t.slice(1) : t); return Object.getOwnPropertySymbols ? i.concat(Object.getOwnPropertySymbols(e)) : i }, u.prototype.listeners = function(e) { var t = n ? n + e : e, i = this._events[t]; if (!i) return []; if (i.fn) return [i.fn]; for (var r = 0, a = i.length, s = new Array(a); r < a; r++) s[r] = i[r].fn; return s }, u.prototype.listenerCount = function(e) { var t = n ? n + e : e, i = this._events[t]; return i ? i.fn ? 1 : i.length : 0 }, u.prototype.emit = function(e, t, i, r, a, s) { var o = n ? n + e : e; if (!this._events[o]) return !1; var u, l, d = this._events[o], c = arguments.length; if (d.fn) { switch (d.once && this.removeListener(e, d.fn, void 0, !0), c) { case 1: return d.fn.call(d.context), !0; case 2: return d.fn.call(d.context, t), !0; case 3: return d.fn.call(d.context, t, i), !0; case 4: return d.fn.call(d.context, t, i, r), !0; case 5: return d.fn.call(d.context, t, i, r, a), !0; case 6: return d.fn.call(d.context, t, i, r, a, s), !0 } for (l = 1, u = new Array(c - 1); l < c; l++) u[l - 1] = arguments[l]; d.fn.apply(d.context, u) } else { var h, f = d.length; for (l = 0; l < f; l++) switch (d[l].once && this.removeListener(e, d[l].fn, void 0, !0), c) { case 1: d[l].fn.call(d[l].context); break; case 2: d[l].fn.call(d[l].context, t); break; case 3: d[l].fn.call(d[l].context, t, i); break; case 4: d[l].fn.call(d[l].context, t, i, r); break; default: if (!u) for (h = 1, u = new Array(c - 1); h < c; h++) u[h - 1] = arguments[h]; d[l].fn.apply(d[l].context, u) } } return !0 }, u.prototype.on = function(e, t, i) { return s(this, e, t, i, !1) }, u.prototype.once = function(e, t, i) { return s(this, e, t, i, !0) }, u.prototype.removeListener = function(e, t, i, r) { var a = n ? n + e : e; if (!this._events[a]) return this; if (!t) return o(this, a), this; var s = this._events[a]; if (s.fn) s.fn !== t || r && !s.once || i && s.context !== i || o(this, a); else { for (var u = 0, l = [], d = s.length; u < d; u++)(s[u].fn !== t || r && !s[u].once || i && s[u] .context !== i) && l.push(s[u]); l.length ? this._events[a] = 1 === l.length ? l[0] : l : o(this, a) } return this }, u.prototype.removeAllListeners = function(e) { var t; return e ? (t = n ? n + e : e, this._events[t] && o(this, t)) : (this._events = new a, this ._eventsCount = 0), this }, u.prototype.off = u.prototype.removeListener, u.prototype.addListener = u.prototype.on, u .prefixed = n, u.EventEmitter = u, e.exports = u }, "./node_modules/url-toolkit/src/url-toolkit.js": function(e, t, i) { var r, n, a, s, o; r = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, n = /^(?=([^\/?#]*))\1([^]*)$/, a = /(?:\/|^)\.(?=\/)/g, s = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, o = { buildAbsoluteURL: function(e, t, i) { if (i = i || {}, e = e.trim(), !(t = t.trim())) { if (!i.alwaysNormalize) return e; var r = o.parseURL(e); if (!r) throw new Error("Error trying to parse base URL."); return r.path = o.normalizePath(r.path), o.buildURLFromParts(r) } var a = o.parseURL(t); if (!a) throw new Error("Error trying to parse relative URL."); if (a.scheme) return i.alwaysNormalize ? (a.path = o.normalizePath(a.path), o.buildURLFromParts( a)) : t; var s = o.parseURL(e); if (!s) throw new Error("Error trying to parse base URL."); if (!s.netLoc && s.path && "/" !== s.path[0]) { var u = n.exec(s.path); s.netLoc = u[1], s.path = u[2] } s.netLoc && !s.path && (s.path = "/"); var l = { scheme: s.scheme, netLoc: a.netLoc, path: null, params: a.params, query: a.query, fragment: a.fragment }; if (!a.netLoc && (l.netLoc = s.netLoc, "/" !== a.path[0])) if (a.path) { var d = s.path, c = d.substring(0, d.lastIndexOf("/") + 1) + a.path; l.path = o.normalizePath(c) } else l.path = s.path, a.params || (l.params = s.params, a.query || (l.query = s.query)); return null === l.path && (l.path = i.alwaysNormalize ? o.normalizePath(a.path) : a.path), o .buildURLFromParts(l) }, parseURL: function(e) { var t = r.exec(e); return t ? { scheme: t[1] || "", netLoc: t[2] || "", path: t[3] || "", params: t[4] || "", query: t[5] || "", fragment: t[6] || "" } : null }, normalizePath: function(e) { for (e = e.split("").reverse().join("").replace(a, ""); e.length !== (e = e.replace(s, "")) .length;); return e.split("").reverse().join("") }, buildURLFromParts: function(e) { return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment } }, e.exports = o }, "./node_modules/webworkify-webpack/index.js": function(e, t, i) { function r(e) { var t = {}; function i(r) { if (t[r]) return t[r].exports; var n = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports } i.m = e, i.c = t, i.i = function(e) { return e }, i.d = function(e, t, r) { i.o(e, t) || Object.defineProperty(e, t, { configurable: !1, enumerable: !0, get: r }) }, i.r = function(e) { Object.defineProperty(e, "__esModule", { value: !0 }) }, i.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e }; return i.d(t, "a", t), t }, i.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, i.p = "/", i.oe = function(e) { throw console.error(e), e }; var r = i(i.s = ENTRY_MODULE); return r.default || r } var n = "[\\.|\\-|\\+|\\w|/|@]+", a = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + n + ").*?\\)"; function s(e) { return (e + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&") } function o(e, t, r) { var o = {}; o[r] = []; var u = t.toString(), l = u.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/); if (!l) return o; for (var d, c = l[1], h = new RegExp("(\\\\n|\\W)" + s(c) + a, "g"); d = h.exec(u);) "dll-reference" !== d[3] && o[r].push(d[3]); for (h = new RegExp("\\(" + s(c) + '\\("(dll-reference\\s(' + n + '))"\\)\\)' + a, "g"); d = h.exec( u);) e[d[2]] || (o[r].push(d[1]), e[d[2]] = i(d[1]).m), o[d[2]] = o[d[2]] || [], o[d[2]].push(d[4]); for (var f, p = Object.keys(o), m = 0; m < p.length; m++) for (var g = 0; g < o[p[m]].length; g++) f = o[p[m]][g], isNaN(1 * f) || (o[p[m]][g] = 1 * o[p[m]][ g]); return o } function u(e) { return Object.keys(e).reduce(function(t, i) { return t || e[i].length > 0 }, !1) } e.exports = function(e, t) { t = t || {}; var n = { main: i.m }, a = t.all ? { main: Object.keys(n.main) } : function(e, t) { for (var i = { main: [t] }, r = { main: [] }, n = { main: {} }; u(i);) for (var a = Object.keys(i), s = 0; s < a.length; s++) { var l = a[s], d = i[l].pop(); if (n[l] = n[l] || {}, !n[l][d] && e[l][d]) { n[l][d] = !0, r[l] = r[l] || [], r[l].push(d); for (var c = o(e, e[l][d], l), h = Object.keys(c), f = 0; f < h.length; f++) i[h[f]] = i[ h[f]] || [], i[h[f]] = i[h[f]].concat(c[h[f]]) } } return r }(n, e), s = ""; Object.keys(a).filter(function(e) { return "main" !== e }).forEach(function(e) { for (var t = 0; a[e][t];) t++; a[e].push(t), n[e][t] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })", s = s + "var " + e + " = (" + r.toString().replace("ENTRY_MODULE", JSON.stringify(t)) + ")({" + a[e].map(function(t) { return JSON.stringify(t) + ": " + n[e][t].toString() }).join(",") + "});\n" }), s = s + "new ((" + r.toString().replace("ENTRY_MODULE", JSON.stringify(e)) + ")({" + a.main .map(function(e) { return JSON.stringify(e) + ": " + n.main[e].toString() }).join(",") + "}))(self);"; var l = new window.Blob([s], { type: "text/javascript" }); if (t.bare) return l; var d = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(l), c = new window.Worker(d); return c.objectURL = d, c } }, "./src/config.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "hlsDefaultConfig", function() { return T }), i.d(t, "mergeConfig", function() { return S }), i.d(t, "enableStreamingMode", function() { return A }); var r = i("./src/controller/abr-controller.ts"), n = i("./src/controller/audio-stream-controller.ts"), a = i("./src/controller/audio-track-controller.ts"), s = i("./src/controller/subtitle-stream-controller.ts"), o = i("./src/controller/subtitle-track-controller.ts"), u = i("./src/controller/buffer-controller.ts"), l = i("./src/controller/timeline-controller.ts"), d = i("./src/controller/cap-level-controller.ts"), c = i("./src/controller/fps-controller.ts"), h = i("./src/controller/eme-controller.ts"), f = i("./src/controller/cmcd-controller.ts"), p = i("./src/utils/xhr-loader.ts"), m = i("./src/utils/fetch-loader.ts"), g = i("./src/utils/cues.ts"), v = i("./src/utils/mediakeys-helper.ts"), y = i("./src/utils/logger.ts"); function _() { return (_ = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }).apply(this, arguments) } function b(e, t) { var i = Object.keys(e); if (Object.getOwnPropertySymbols) { var r = Object.getOwnPropertySymbols(e); t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), i.push.apply(i, r) } return i } function w(e) { for (var t = 1; t < arguments.length; t++) { var i = null != arguments[t] ? arguments[t] : {}; t % 2 ? b(Object(i), !0).forEach(function(t) { E(e, t, i[t]) }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object .getOwnPropertyDescriptors(i)) : b(Object(i)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t)) }) } return e } function E(e, t, i) { return t in e ? Object.defineProperty(e, t, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = i, e } var T = w(w({ autoStartLoad: !0, startPosition: -1, defaultAudioCodec: void 0, debug: !1, capLevelOnFPSDrop: !1, capLevelToPlayerSize: !1, ignoreDevicePixelRatio: !1, initialLiveManifestSize: 1, maxBufferLength: 30, backBufferLength: 1 / 0, maxBufferSize: 6e7, maxBufferHole: .1, highBufferWatchdogPeriod: 2, nudgeOffset: .1, nudgeMaxRetry: 3, maxFragLookUpTolerance: .25, liveSyncDurationCount: 3, liveMaxLatencyDurationCount: 1 / 0, liveSyncDuration: void 0, liveMaxLatencyDuration: void 0, maxLiveSyncPlaybackRate: 1, liveDurationInfinity: !1, liveBackBufferLength: null, maxMaxBufferLength: 600, enableWorker: !0, enableSoftwareAES: !0, manifestLoadingTimeOut: 1e4, manifestLoadingMaxRetry: 1, manifestLoadingRetryDelay: 1e3, manifestLoadingMaxRetryTimeout: 64e3, startLevel: void 0, levelLoadingTimeOut: 1e4, levelLoadingMaxRetry: 4, levelLoadingRetryDelay: 1e3, levelLoadingMaxRetryTimeout: 64e3, fragLoadingTimeOut: 2e4, fragLoadingMaxRetry: 6, fragLoadingRetryDelay: 1e3, fragLoadingMaxRetryTimeout: 64e3, startFragPrefetch: !1, fpsDroppedMonitoringPeriod: 5e3, fpsDroppedMonitoringThreshold: .2, appendErrorMaxRetry: 3, loader: p.default, fLoader: void 0, pLoader: void 0, xhrSetup: void 0, licenseXhrSetup: void 0, licenseResponseCallback: void 0, abrController: r.default, bufferController: u.default, capLevelController: d.default, fpsController: c.default, stretchShortVideoTrack: !1, maxAudioFramesDrift: 1, forceKeyFrameOnDiscontinuity: !0, abrEwmaFastLive: 3, abrEwmaSlowLive: 9, abrEwmaFastVoD: 3, abrEwmaSlowVoD: 9, abrEwmaDefaultEstimate: 5e5, abrBandWidthFactor: .95, abrBandWidthUpFactor: .7, abrMaxWithRealBitrate: !1, maxStarvationDelay: 4, maxLoadingDelay: 4, minAutoBitrate: 0, emeEnabled: !1, widevineLicenseUrl: void 0, drmSystemOptions: {}, requestMediaKeySystemAccessFunc: v.requestMediaKeySystemAccess, testBandwidth: !0, progressive: !1, lowLatencyMode: !0, cmcd: void 0 }, { cueHandler: g.default, enableCEA708Captions: !0, enableWebVTT: !0, enableIMSC1: !0, captionsTextTrack1Label: "English", captionsTextTrack1LanguageCode: "en", captionsTextTrack2Label: "Spanish", captionsTextTrack2LanguageCode: "es", captionsTextTrack3Label: "Unknown CC", captionsTextTrack3LanguageCode: "", captionsTextTrack4Label: "Unknown CC", captionsTextTrack4LanguageCode: "", renderTextTracksNatively: !0 }), {}, { subtitleStreamController: s.SubtitleStreamController, subtitleTrackController: o.default, timelineController: l.TimelineController, audioStreamController: n.default, audioTrackController: a.default, emeController: h.default, cmcdController: f.default }); function S(e, t) { if ((t.liveSyncDurationCount || t.liveMaxLatencyDurationCount) && (t.liveSyncDuration || t .liveMaxLatencyDuration)) throw new Error( "Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration" ); if (void 0 !== t.liveMaxLatencyDurationCount && (void 0 === t.liveSyncDurationCount || t .liveMaxLatencyDurationCount <= t.liveSyncDurationCount)) throw new Error( 'Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"' ); if (void 0 !== t.liveMaxLatencyDuration && (void 0 === t.liveSyncDuration || t .liveMaxLatencyDuration <= t.liveSyncDuration)) throw new Error( 'Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"'); return _({}, e, t) } function A(e) { var t = e.loader; t !== m.default && t !== p.default ? (y.logger.log( "[config]: Custom loader detected, cannot enable progressive streaming"), e.progressive = !1) : Object(m.fetchSupported)() && (e.loader = m.default, e.progressive = !0, e.enableSoftwareAES = !0, y .logger.log("[config]: Progressive streaming enabled, using FetchLoader")) } }, "./src/controller/abr-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/polyfills/number.ts"), n = i("./src/utils/ewma-bandwidth-estimator.ts"), a = i("./src/events.ts"), s = i("./src/utils/buffer-helper.ts"), o = i("./src/errors.ts"), u = i("./src/types/loader.ts"), l = i("./src/utils/logger.ts"); function d(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var c = function() { function e(e) { this.hls = void 0, this.lastLoadedFragLevel = 0, this._nextAutoLevel = -1, this.timer = void 0, this.onCheck = this._abandonRulesCheck.bind(this), this.fragCurrent = null, this.partCurrent = null, this.bitrateTestDelay = 0, this.bwEstimator = void 0, this.hls = e; var t = e.config; this.bwEstimator = new n.default(t.abrEwmaSlowVoD, t.abrEwmaFastVoD, t.abrEwmaDefaultEstimate), this.registerListeners() } var t, i, c, h = e.prototype; return h.registerListeners = function() { var e = this.hls; e.on(a.Events.FRAG_LOADING, this.onFragLoading, this), e.on(a.Events.FRAG_LOADED, this .onFragLoaded, this), e.on(a.Events.FRAG_BUFFERED, this.onFragBuffered, this), e.on(a.Events .LEVEL_LOADED, this.onLevelLoaded, this), e.on(a.Events.ERROR, this.onError, this) }, h.unregisterListeners = function() { var e = this.hls; e.off(a.Events.FRAG_LOADING, this.onFragLoading, this), e.off(a.Events.FRAG_LOADED, this .onFragLoaded, this), e.off(a.Events.FRAG_BUFFERED, this.onFragBuffered, this), e.off(a .Events.LEVEL_LOADED, this.onLevelLoaded, this), e.off(a.Events.ERROR, this.onError, this) }, h.destroy = function() { this.unregisterListeners(), this.clearTimer(), this.hls = this.onCheck = null, this .fragCurrent = this.partCurrent = null }, h.onFragLoading = function(e, t) { var i, r = t.frag; r.type === u.PlaylistLevelType.MAIN && (this.timer || (this.fragCurrent = r, this.partCurrent = null != (i = t.part) ? i : null, this.timer = self.setInterval(this.onCheck, 100))) }, h.onLevelLoaded = function(e, t) { var i = this.hls.config; t.details.live ? this.bwEstimator.update(i.abrEwmaSlowLive, i.abrEwmaFastLive) : this .bwEstimator.update(i.abrEwmaSlowVoD, i.abrEwmaFastVoD) }, h._abandonRulesCheck = function() { var e = this.fragCurrent, t = this.partCurrent, i = this.hls, n = i.autoLevelEnabled, o = i.config, u = i.media; if (e && u) { var d = t ? t.stats : e.stats, c = t ? t.duration : e.duration; if (d.aborted) return l.logger.warn("frag loader destroy or aborted, disarm abandonRules"), this.clearTimer(), void(this._nextAutoLevel = -1); if (n && !u.paused && u.playbackRate && u.readyState) { var h = performance.now() - d.loading.start, f = Math.abs(u.playbackRate); if (!(h <= 500 * c / f)) { var p = i.levels, m = i.minAutoLevel, g = p[e.level], v = d.total || Math.max(d.loaded, Math.round(c * g.maxBitrate / 8)), y = Math.max(1, d.bwEstimate ? d.bwEstimate / 8 : 1e3 * d.loaded / h), _ = (v - d.loaded) / y, b = u.currentTime, w = (s.BufferHelper.bufferInfo(u, b, o.maxBufferHole).end - b) / f; if (!(w >= 2 * c / f || _ <= w)) { var E, T = Number.POSITIVE_INFINITY; for (E = e.level - 1; E > m; E--) { if ((T = c * p[E].maxBitrate / (6.4 * y)) < w) break } if (!(T >= _)) { var S = this.bwEstimator.getEstimate(); l.logger.warn("Fragment " + e.sn + (t ? " part " + t.index : "") + " of level " + e .level + " is loading too slowly and will cause an underbuffer; aborting and switching to level " + E + "\n Current BW estimate: " + (Object(r.isFiniteNumber)(S) ? (S / 1024) .toFixed(3) : "Unknown") + " Kb/s\n Estimated load time for current fragment: " + _.toFixed(3) + " s\n Estimated load time for the next fragment: " + T.toFixed(3) + " s\n Time to underbuffer: " + w.toFixed(3) + " s"), i.nextLoadLevel = E, this.bwEstimator.sample(h, d.loaded), this.clearTimer(), e.loader && (this .fragCurrent = this.partCurrent = null, e.loader.abort()), i.trigger(a.Events .FRAG_LOAD_EMERGENCY_ABORTED, { frag: e, part: t, stats: d }) } } } } } }, h.onFragLoaded = function(e, t) { var i = t.frag, n = t.part; if (i.type === u.PlaylistLevelType.MAIN && Object(r.isFiniteNumber)(i.sn)) { var s = n ? n.stats : i.stats, o = n ? n.duration : i.duration; if (this.clearTimer(), this.lastLoadedFragLevel = i.level, this._nextAutoLevel = -1, this.hls .config.abrMaxWithRealBitrate) { var l = this.hls.levels[i.level], d = (l.loaded ? l.loaded.bytes : 0) + s.loaded, c = (l.loaded ? l.loaded.duration : 0) + o; l.loaded = { bytes: d, duration: c }, l.realBitrate = Math.round(8 * d / c) } if (i.bitrateTest) { var h = { stats: s, frag: i, part: n, id: i.type }; this.onFragBuffered(a.Events.FRAG_BUFFERED, h), i.bitrateTest = !1 } } }, h.onFragBuffered = function(e, t) { var i = t.frag, r = t.part, n = r ? r.stats : i.stats; if (!n.aborted && i.type === u.PlaylistLevelType.MAIN && "initSegment" !== i.sn) { var a = n.parsing.end - n.loading.start; this.bwEstimator.sample(a, n.loaded), n.bwEstimate = this.bwEstimator.getEstimate(), i .bitrateTest ? this.bitrateTestDelay = a / 1e3 : this.bitrateTestDelay = 0 } }, h.onError = function(e, t) { switch (t.details) { case o.ErrorDetails.FRAG_LOAD_ERROR: case o.ErrorDetails.FRAG_LOAD_TIMEOUT: this.clearTimer() } }, h.clearTimer = function() { self.clearInterval(this.timer), this.timer = void 0 }, h.getNextABRAutoLevel = function() { var e = this.fragCurrent, t = this.partCurrent, i = this.hls, r = i.maxAutoLevel, n = i.config, a = i.minAutoLevel, o = i.media, u = t ? t.duration : e ? e.duration : 0, d = o ? o.currentTime : 0, c = o && 0 !== o.playbackRate ? Math.abs(o.playbackRate) : 1, h = this.bwEstimator ? this.bwEstimator.getEstimate() : n.abrEwmaDefaultEstimate, f = (s.BufferHelper.bufferInfo(o, d, n.maxBufferHole).end - d) / c, p = this.findBestLevel(h, a, r, f, n.abrBandWidthFactor, n.abrBandWidthUpFactor); if (p >= 0) return p; l.logger.trace((f ? "rebuffering expected" : "buffer is empty") + ", finding optimal quality level"); var m = u ? Math.min(u, n.maxStarvationDelay) : n.maxStarvationDelay, g = n.abrBandWidthFactor, v = n.abrBandWidthUpFactor; if (!f) { var y = this.bitrateTestDelay; if (y) m = (u ? Math.min(u, n.maxLoadingDelay) : n.maxLoadingDelay) - y, l.logger.trace( "bitrate test took " + Math.round(1e3 * y) + "ms, set first fragment max fetchDuration to " + Math.round(1e3 * m) + " ms"), g = v = 1 } return p = this.findBestLevel(h, a, r, f + m, g, v), Math.max(p, 0) }, h.findBestLevel = function(e, t, i, r, n, a) { for (var s, o = this.fragCurrent, u = this.partCurrent, d = this.lastLoadedFragLevel, c = this .hls.levels, h = c[d], f = !(null === h || void 0 === h || null === (s = h.details) || void 0 === s || !s.live), p = null === h || void 0 === h ? void 0 : h.codecSet, m = u ? u .duration : o ? o.duration : 0, g = i; g >= t; g--) { var v = c[g]; if (v && (!p || v.codecSet === p)) { var y = v.details, _ = (u ? null === y || void 0 === y ? void 0 : y.partTarget : null === y || void 0 === y ? void 0 : y.averagetargetduration) || m, b = void 0; b = g <= d ? n * e : a * e; var w = c[g].maxBitrate, E = w * _ / b; if (l.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: " + g + "/" + Math.round(b) + "/" + w + "/" + _ + "/" + r + "/" + E), b > w && (!E || f && ! this.bitrateTestDelay || E < r)) return g } } return -1 }, t = e, (i = [{ key: "nextAutoLevel", get: function() { var e = this._nextAutoLevel, t = this.bwEstimator; if (!(-1 === e || t && t.canEstimate())) return e; var i = this.getNextABRAutoLevel(); return -1 !== e && (i = Math.min(e, i)), i }, set: function(e) { this._nextAutoLevel = e } }]) && d(t.prototype, i), c && d(t, c), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); t.default = c }, "./src/controller/audio-stream-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/polyfills/number.ts"), n = i("./src/controller/base-stream-controller.ts"), a = i("./src/events.ts"), s = i("./src/utils/buffer-helper.ts"), o = i("./src/controller/fragment-tracker.ts"), u = i("./src/types/level.ts"), l = i("./src/types/loader.ts"), d = i("./src/loader/fragment.ts"), c = i("./src/demux/chunk-cache.ts"), h = i("./src/demux/transmuxer-interface.ts"), f = i("./src/types/transmuxer.ts"), p = i("./src/controller/fragment-finders.ts"), m = i("./src/utils/discontinuities.ts"), g = i("./src/errors.ts"), v = i("./src/utils/logger.ts"); function y() { return (y = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }).apply(this, arguments) } function _(e, t) { return (_ = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var b = function(e) { var t, i; function b(t, i) { var r; return (r = e.call(this, t, i, "[audio-stream-controller]") || this).videoBuffer = null, r .videoTrackCC = -1, r.waitingVideoCC = -1, r.audioSwitch = !1, r.trackId = -1, r.waitingData = null, r.mainDetails = null, r.bufferFlushed = !1, r.cachedTrackLoadedData = null, r ._registerListeners(), r } i = e, (t = b).prototype = Object.create(i.prototype), t.prototype.constructor = t, _(t, i); var w = b.prototype; return w.onHandlerDestroying = function() { this._unregisterListeners(), this.mainDetails = null }, w._registerListeners = function() { var e = this.hls; e.on(a.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(a.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.on(a.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .on(a.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.on(a.Events.AUDIO_TRACKS_UPDATED, this .onAudioTracksUpdated, this), e.on(a.Events.AUDIO_TRACK_SWITCHING, this .onAudioTrackSwitching, this), e.on(a.Events.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), e.on(a.Events.ERROR, this.onError, this), e.on(a.Events.BUFFER_RESET, this .onBufferReset, this), e.on(a.Events.BUFFER_CREATED, this.onBufferCreated, this), e.on(a .Events.BUFFER_FLUSHED, this.onBufferFlushed, this), e.on(a.Events.INIT_PTS_FOUND, this .onInitPtsFound, this), e.on(a.Events.FRAG_BUFFERED, this.onFragBuffered, this) }, w._unregisterListeners = function() { var e = this.hls; e.off(a.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(a.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.off(a.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .off(a.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.off(a.Events.AUDIO_TRACKS_UPDATED, this.onAudioTracksUpdated, this), e.off(a.Events.AUDIO_TRACK_SWITCHING, this .onAudioTrackSwitching, this), e.off(a.Events.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), e.off(a.Events.ERROR, this.onError, this), e.off(a.Events.BUFFER_RESET, this .onBufferReset, this), e.off(a.Events.BUFFER_CREATED, this.onBufferCreated, this), e.off(a .Events.BUFFER_FLUSHED, this.onBufferFlushed, this), e.off(a.Events.INIT_PTS_FOUND, this .onInitPtsFound, this), e.off(a.Events.FRAG_BUFFERED, this.onFragBuffered, this) }, w.onInitPtsFound = function(e, t) { var i = t.frag, r = t.id, a = t.initPTS; if ("main" === r) { var s = i.cc; this.initPTS[i.cc] = a, this.log("InitPTS for cc: " + s + " found from main: " + a), this .videoTrackCC = s, this.state === n.State.WAITING_INIT_PTS && this.tick() } }, w.startLoad = function(e) { if (!this.levels) return this.startPosition = e, void(this.state = n.State.STOPPED); var t = this.lastCurrentTime; this.stopLoad(), this.setInterval(100), this.fragLoadError = 0, t > 0 && -1 === e ? (this.log( "Override startPosition with lastCurrentTime @" + t.toFixed(3)), this.state = n.State .IDLE) : (this.loadedmetadata = !1, this.state = n.State.WAITING_TRACK), this .nextLoadPosition = this.startPosition = this.lastCurrentTime = e, this.tick() }, w.doTick = function() { switch (this.state) { case n.State.IDLE: this.doTickIdle(); break; case n.State.WAITING_TRACK: var t, i = this.levels, r = this.trackId, a = null === i || void 0 === i ? void 0 : null === (t = i[r]) || void 0 === t ? void 0 : t .details; if (a) { if (this.waitForCdnTuneIn(a)) break; this.state = n.State.WAITING_INIT_PTS } break; case n.State.FRAG_LOADING_WAITING_RETRY: var o, u = performance.now(), l = this.retryDate; (!l || u >= l || null !== (o = this.media) && void 0 !== o && o.seeking) && (this.log( "RetryDate reached, switch back to IDLE state"), this.state = n.State.IDLE); break; case n.State.WAITING_INIT_PTS: var d = this.waitingData; if (d) { var c = d.frag, h = d.part, f = d.cache, m = d.complete; if (void 0 !== this.initPTS[c.cc]) { this.waitingData = null, this.waitingVideoCC = -1, this.state = n.State.FRAG_LOADING; var g = { frag: c, part: h, payload: f.flush(), networkDetails: null }; this._handleFragmentLoadProgress(g), m && e.prototype._handleFragmentLoadComplete.call( this, g) } else if (this.videoTrackCC !== this.waitingVideoCC) v.logger.log( "Waiting fragment cc (" + c.cc + ") cancelled because video is at cc " + this .videoTrackCC), this.clearWaitingFragment(); else { var y = this.getLoadPosition(), _ = s.BufferHelper.bufferInfo(this.mediaBuffer, y, this.config.maxBufferHole); Object(p.fragmentWithinToleranceTest)(_.end, this.config.maxFragLookUpTolerance, c) < 0 && (v.logger.log("Waiting fragment cc (" + c.cc + ") @ " + c.start + " cancelled because another fragment at " + _.end + " is needed"), this .clearWaitingFragment()) } } else this.state = n.State.IDLE } this.onTickEnd() }, w.clearWaitingFragment = function() { var e = this.waitingData; e && (this.fragmentTracker.removeFragment(e.frag), this.waitingData = null, this .waitingVideoCC = -1, this.state = n.State.IDLE) }, w.onTickEnd = function() { var e = this.media; if (e && e.readyState) { var t = (this.mediaBuffer ? this.mediaBuffer : e).buffered; !this.loadedmetadata && t.length && (this.loadedmetadata = !0), this.lastCurrentTime = e .currentTime } }, w.doTickIdle = function() { var e, t, i = this.hls, r = this.levels, s = this.media, o = this.trackId, u = i.config; if (r && r[o] && (s || !this.startFragRequested && u.startFragPrefetch)) { var c = r[o].details; if (!c || c.live && this.levelLastLoaded !== o || this.waitForCdnTuneIn(c)) this.state = n .State.WAITING_TRACK; else { this.bufferFlushed && (this.bufferFlushed = !1, this.afterBufferFlushed(this.mediaBuffer ? this.mediaBuffer : this.media, d.ElementaryStreamTypes.AUDIO, l.PlaylistLevelType .AUDIO)); var h = this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : this.media, l .PlaylistLevelType.AUDIO); if (null !== h) { var f = h.len, p = this.getMaxBufferLength(), m = this.audioSwitch; if (!(f >= p) || m) { if (!m && this._streamEnded(h, c)) return i.trigger(a.Events.BUFFER_EOS, { type: "audio" }), void(this.state = n.State.ENDED); var g = c.fragments[0].start, v = h.end; if (m) { var y = this.getLoadPosition(); v = y, c.PTSKnown && y < g && (h.end > g || h.nextStart) && (this.log( "Alt audio track ahead of main track, seek to start of alt audio track"), s .currentTime = g + .05) } var _ = this.getNextFragment(v, c); _ ? "identity" !== (null === (e = _.decryptdata) || void 0 === e ? void 0 : e .keyFormat) || null !== (t = _.decryptdata) && void 0 !== t && t.key ? this .loadFragment(_, c, v) : this.loadKey(_, c) : this.bufferFlushed = !0 } } } } }, w.getMaxBufferLength = function() { var t = e.prototype.getMaxBufferLength.call(this), i = this.getFwdBufferInfo(this.videoBuffer ? this.videoBuffer : this.media, l .PlaylistLevelType.MAIN); return null === i ? t : Math.max(t, i.len) }, w.onMediaDetaching = function() { this.videoBuffer = null, e.prototype.onMediaDetaching.call(this) }, w.onAudioTracksUpdated = function(e, t) { var i = t.audioTracks; this.resetTransmuxer(), this.levels = i.map(function(e) { return new u.Level(e) }) }, w.onAudioTrackSwitching = function(e, t) { var i = !!t.url; this.trackId = t.id; var r = this.fragCurrent; null !== r && void 0 !== r && r.loader && r.loader.abort(), this.fragCurrent = null, this .clearWaitingFragment(), i ? this.setInterval(100) : this.resetTransmuxer(), i ? (this .audioSwitch = !0, this.state = n.State.IDLE) : this.state = n.State.STOPPED, this.tick() }, w.onManifestLoading = function() { this.mainDetails = null, this.fragmentTracker.removeAllFragments(), this.startPosition = this .lastCurrentTime = 0, this.bufferFlushed = !1 }, w.onLevelLoaded = function(e, t) { this.mainDetails = t.details, null !== this.cachedTrackLoadedData && (this.hls.trigger(a.Events .AUDIO_TRACK_LOADED, this.cachedTrackLoadedData), this.cachedTrackLoadedData = null) }, w.onAudioTrackLoaded = function(e, t) { var i; if (null != this.mainDetails) { var r = this.levels, a = t.details, s = t.id; if (r) { this.log("Track " + s + " loaded [" + a.startSN + "," + a.endSN + "],duration:" + a .totalduration); var o = r[s], u = 0; if (a.live || null !== (i = o.details) && void 0 !== i && i.live) { var l = this.mainDetails; if (a.fragments[0] || (a.deltaUpdateFailed = !0), a.deltaUpdateFailed || !l) return; !o.details && a.hasProgramDateTime && l.hasProgramDateTime ? (Object(m .alignMediaPlaylistByPDT)(a, l), u = a.fragments[0].start) : u = this.alignPlaylists( a, o.details) } o.details = a, this.levelLastLoaded = s, this.startFragRequested || !this.mainDetails && a .live || this.setStartPosition(o.details, u), this.state !== n.State.WAITING_TRACK || this .waitForCdnTuneIn(a) || (this.state = n.State.IDLE), this.tick() } else this.warn("Audio tracks were reset while loading level " + s) } else this.cachedTrackLoadedData = t }, w._handleFragmentLoadProgress = function(e) { var t, i = e.frag, r = e.part, a = e.payload, s = this.config, o = this.trackId, u = this.levels; if (u) { var d = u[o]; console.assert(d, "Audio track is defined on fragment load progress"); var p = d.details; console.assert(p, "Audio track details are defined on fragment load progress"); var m = s.defaultAudioCodec || d.audioCodec || "mp4a.40.2", g = this.transmuxer; g || (g = this.transmuxer = new h.default(this.hls, l.PlaylistLevelType.AUDIO, this ._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this))); var y = this.initPTS[i.cc], _ = null === (t = i.initSegment) || void 0 === t ? void 0 : t.data; if (void 0 !== y) { var b = r ? r.index : -1, w = -1 !== b, E = new f.ChunkMetadata(i.level, i.sn, i.stats.chunkCount, a.byteLength, b, w); g.push(a, _, m, "", i, r, p.totalduration, !1, E, y) } else { v.logger.log("Unknown video PTS for cc " + i.cc + ", waiting for video PTS before demuxing audio frag " + i.sn + " of [" + p.startSN + " ," + p.endSN + "],track " + o), (this.waitingData = this.waitingData || { frag: i, part: r, cache: new c.default, complete: !1 }).cache.push(new Uint8Array(a)), this.waitingVideoCC = this.videoTrackCC, this.state = n .State.WAITING_INIT_PTS } } else this.warn("Audio tracks were reset while fragment load was in progress. Fragment " + i .sn + " of level " + i.level + " will not be buffered") }, w._handleFragmentLoadComplete = function(t) { this.waitingData ? this.waitingData.complete = !0 : e.prototype._handleFragmentLoadComplete .call(this, t) }, w.onBufferReset = function() { this.mediaBuffer = this.videoBuffer = null, this.loadedmetadata = !1 }, w.onBufferCreated = function(e, t) { var i = t.tracks.audio; i && (this.mediaBuffer = i.buffer), t.tracks.video && (this.videoBuffer = t.tracks.video.buffer) }, w.onFragBuffered = function(e, t) { var i = t.frag, r = t.part; i.type === l.PlaylistLevelType.AUDIO && (this.fragContextChanged(i) ? this.warn("Fragment " + i .sn + (r ? " p: " + r.index : "") + " of level " + i.level + " finished buffering, but was aborted. state: " + this.state + ", audioSwitch: " + this .audioSwitch) : ("initSegment" !== i.sn && (this.fragPrevious = i, this.audioSwitch && ( this.audioSwitch = !1, this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED, { id: this.trackId }))), this.fragBufferedComplete(i, r))) }, w.onError = function(t, i) { switch (i.details) { case g.ErrorDetails.FRAG_LOAD_ERROR: case g.ErrorDetails.FRAG_LOAD_TIMEOUT: case g.ErrorDetails.KEY_LOAD_ERROR: case g.ErrorDetails.KEY_LOAD_TIMEOUT: this.onFragmentOrKeyLoadError(l.PlaylistLevelType.AUDIO, i); break; case g.ErrorDetails.AUDIO_TRACK_LOAD_ERROR: case g.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT: this.state !== n.State.ERROR && this.state !== n.State.STOPPED && (this.state = i.fatal ? n .State.ERROR : n.State.IDLE, this.warn(i.details + " while loading frag, switching to " + this.state + " state")); break; case g.ErrorDetails.BUFFER_FULL_ERROR: if ("audio" === i.parent && (this.state === n.State.PARSING || this.state === n.State .PARSED)) { var r = !0, a = this.getFwdBufferInfo(this.mediaBuffer, l.PlaylistLevelType.AUDIO); a && a.len > .5 && (r = !this.reduceMaxBufferLength(a.len)), r && (this.warn( "Buffer full error also media.currentTime is not buffered, flush audio buffer"), this.fragCurrent = null, e.prototype.flushMainBuffer.call(this, 0, Number .POSITIVE_INFINITY, "audio")), this.resetLoadingState() } } }, w.onBufferFlushed = function(e, t) { t.type === d.ElementaryStreamTypes.AUDIO && (this.bufferFlushed = !0) }, w._handleTransmuxComplete = function(e) { var t, i = "audio", r = this.hls, s = e.remuxResult, o = e.chunkMeta, u = this.getCurrentContext(o); if (!u) return this.warn("The loading context changed while buffering fragment " + o.sn + " of level " + o.level + ". This chunk will not be buffered."), void this .resetLiveStartWhenNotLoaded(o.level); var l = u.frag, c = u.part, h = s.audio, f = s.text, p = s.id3, m = s.initSegment; if (!this.fragContextChanged(l)) { if (this.state = n.State.PARSING, this.audioSwitch && h && this.completeAudioSwitch(), null !== m && void 0 !== m && m.tracks && (this._bufferInitSegment(m.tracks, l, o), r .trigger(a.Events.FRAG_PARSING_INIT_SEGMENT, { frag: l, id: i, tracks: m.tracks })), h) { var g = h.startPTS, v = h.endPTS, _ = h.startDTS, b = h.endDTS; c && (c.elementaryStreams[d.ElementaryStreamTypes.AUDIO] = { startPTS: g, endPTS: v, startDTS: _, endDTS: b }), l.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO, g, v, _, b), this .bufferFragmentData(h, l, c, o) } if (null !== p && void 0 !== p && null !== (t = p.samples) && void 0 !== t && t.length) { var w = y({ frag: l, id: i }, p); r.trigger(a.Events.FRAG_PARSING_METADATA, w) } if (f) { var E = y({ frag: l, id: i }, f); r.trigger(a.Events.FRAG_PARSING_USERDATA, E) } } }, w._bufferInitSegment = function(e, t, i) { if (this.state === n.State.PARSING) { e.video && delete e.video; var r = e.audio; if (r) { r.levelCodec = r.codec, r.id = "audio", this.log("Init audio buffer, container:" + r .container + ", codecs[parsed]=[" + r.codec + "]"), this.hls.trigger(a.Events .BUFFER_CODECS, e); var s = r.initSegment; if (null !== s && void 0 !== s && s.byteLength) { var o = { type: "audio", frag: t, part: null, chunkMeta: i, parent: t.type, data: s }; this.hls.trigger(a.Events.BUFFER_APPENDING, o) } this.tick() } } }, w.loadFragment = function(t, i, a) { var s = this.fragmentTracker.getState(t); this.fragCurrent = t, (this.audioSwitch || s === o.FragmentState.NOT_LOADED || s === o .FragmentState.PARTIAL) && ("initSegment" === t.sn ? this._loadInitSegment(t) : i.live && ! Object(r.isFiniteNumber)(this.initPTS[t.cc]) ? (this.log( "Waiting for video PTS in continuity counter " + t.cc + " of live stream before loading audio fragment " + t.sn + " of level " + this.trackId), this.state = n.State.WAITING_INIT_PTS) : (this.startFragRequested = !0, e.prototype .loadFragment.call(this, t, i, a))) }, w.completeAudioSwitch = function() { var t = this.hls, i = this.media, r = this.trackId; i && (this.log("Switching audio track : flushing all audio"), e.prototype.flushMainBuffer.call( this, 0, Number.POSITIVE_INFINITY, "audio")), this.audioSwitch = !1, t.trigger(a.Events .AUDIO_TRACK_SWITCHED, { id: r }) }, b }(n.default); t.default = b }, "./src/controller/audio-track-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/events.ts"), n = i("./src/errors.ts"), a = i("./src/controller/base-playlist-controller.ts"), s = i("./src/types/loader.ts"); function o(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function u(e, t) { return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var l = function(e) { var t, i; function a(t) { var i; return (i = e.call(this, t, "[audio-track-controller]") || this).tracks = [], i.groupId = null, i .tracksInGroup = [], i.trackId = -1, i.trackName = "", i.selectDefaultTrack = !0, i .registerListeners(), i } i = e, (t = a).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i); var l, d, c, h = a.prototype; return h.registerListeners = function() { var e = this.hls; e.on(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.on(r.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.on(r.Events.LEVEL_LOADING, this.onLevelLoading, this), e.on( r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e.on(r.Events.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), e.on(r.Events.ERROR, this.onError, this) }, h.unregisterListeners = function() { var e = this.hls; e.off(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.off(r.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.off(r.Events.LEVEL_LOADING, this.onLevelLoading, this), e .off(r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e.off(r.Events .AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), e.off(r.Events.ERROR, this.onError, this) }, h.destroy = function() { this.unregisterListeners(), this.tracks.length = 0, this.tracksInGroup.length = 0, e.prototype .destroy.call(this) }, h.onManifestLoading = function() { this.tracks = [], this.groupId = null, this.tracksInGroup = [], this.trackId = -1, this .trackName = "", this.selectDefaultTrack = !0 }, h.onManifestParsed = function(e, t) { this.tracks = t.audioTracks || [] }, h.onAudioTrackLoaded = function(e, t) { var i = t.id, r = t.details, n = this.tracksInGroup[i]; if (n) { var a = n.details; n.details = t.details, this.log("audioTrack " + i + " loaded [" + r.startSN + "-" + r.endSN + "]"), i === this.trackId && (this.retryCount = 0, this.playlistLoaded(i, t, a)) } else this.warn("Invalid audio track id " + i) }, h.onLevelLoading = function(e, t) { this.switchLevel(t.level) }, h.onLevelSwitching = function(e, t) { this.switchLevel(t.level) }, h.switchLevel = function(e) { var t = this.hls.levels[e]; if (null !== t && void 0 !== t && t.audioGroupIds) { var i = t.audioGroupIds[t.urlId]; if (this.groupId !== i) { this.groupId = i; var n = this.tracks.filter(function(e) { return !i || e.groupId === i }); this.selectDefaultTrack && !n.some(function(e) { return e.default }) && (this.selectDefaultTrack = !1), this.tracksInGroup = n; var a = { audioTracks: n }; this.log("Updating audio tracks, " + n.length + ' track(s) found in "' + i + '" group-id'), this.hls.trigger(r.Events.AUDIO_TRACKS_UPDATED, a), this.selectInitialTrack() } } }, h.onError = function(t, i) { e.prototype.onError.call(this, t, i), !i.fatal && i.context && i.context.type === s .PlaylistContextType.AUDIO_TRACK && i.context.id === this.trackId && i.context.groupId === this.groupId && this.retryLoadingOrFail(i) }, h.setAudioTrack = function(e) { var t = this.tracksInGroup; if (e < 0 || e >= t.length) this.warn("Invalid id passed to audio-track controller"); else { this.clearTimer(); var i = t[this.trackId]; this.log("Now switching to audio-track index " + e); var n = t[e], a = n.id, s = n.groupId, o = void 0 === s ? "" : s, u = n.name, l = n.type, d = n.url; if (this.trackId = e, this.trackName = u, this.selectDefaultTrack = !1, this.hls.trigger(r .Events.AUDIO_TRACK_SWITCHING, { id: a, groupId: o, name: u, type: l, url: d }), !n.details || n.details.live) { var c = this.switchParams(n.url, null === i || void 0 === i ? void 0 : i.details); this.loadPlaylist(c) } } }, h.selectInitialTrack = function() { var e = this.tracksInGroup; console.assert(e.length, "Initial audio track should be selected when tracks are known"); var t = this.trackName, i = this.findTrackId(t) || this.findTrackId(); - 1 !== i ? this.setAudioTrack(i) : (this.warn( "No track found for running audio group-ID: " + this.groupId), this.hls.trigger(r.Events .ERROR, { type: n.ErrorTypes.MEDIA_ERROR, details: n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, fatal: !0 })) }, h.findTrackId = function(e) { for (var t = this.tracksInGroup, i = 0; i < t.length; i++) { var r = t[i]; if ((!this.selectDefaultTrack || r.default) && (!e || e === r.name)) return r.id } return -1 }, h.loadPlaylist = function(e) { var t = this.tracksInGroup[this.trackId]; if (this.shouldLoadTrack(t)) { var i = t.id, n = t.groupId, a = t.url; if (e) try { a = e.addDirectives(a) } catch (e) { this.warn("Could not construct new URL with HLS Delivery Directives: " + e) } this.log("loading audio-track playlist for id: " + i), this.clearTimer(), this.hls.trigger(r .Events.AUDIO_TRACK_LOADING, { url: a, id: i, groupId: n, deliveryDirectives: e || null }) } }, l = a, (d = [{ key: "audioTracks", get: function() { return this.tracksInGroup } }, { key: "audioTrack", get: function() { return this.trackId }, set: function(e) { this.selectDefaultTrack = !1, this.setAudioTrack(e) } }]) && o(l.prototype, d), c && o(l, c), Object.defineProperty(l, "prototype", { writable: !1 }), a }(a.default); t.default = l }, "./src/controller/base-playlist-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return u }); var r = i("./src/polyfills/number.ts"), n = i("./src/types/level.ts"), a = i("./src/controller/level-helper.ts"), s = i("./src/utils/logger.ts"), o = i("./src/errors.ts"), u = function() { function e(e, t) { this.hls = void 0, this.timer = -1, this.canLoad = !1, this.retryCount = 0, this.log = void 0, this.warn = void 0, this.log = s.logger.log.bind(s.logger, t + ":"), this.warn = s.logger.warn .bind(s.logger, t + ":"), this.hls = e } var t = e.prototype; return t.destroy = function() { this.clearTimer(), this.hls = this.log = this.warn = null }, t.onError = function(e, t) { t.fatal && t.type === o.ErrorTypes.NETWORK_ERROR && this.clearTimer() }, t.clearTimer = function() { clearTimeout(this.timer), this.timer = -1 }, t.startLoad = function() { this.canLoad = !0, this.retryCount = 0, this.loadPlaylist() }, t.stopLoad = function() { this.canLoad = !1, this.clearTimer() }, t.switchParams = function(e, t) { var i = null === t || void 0 === t ? void 0 : t.renditionReports; if (i) for (var a = 0; a < i.length; a++) { var s = i[a], o = "" + s.URI; if (o === e.slice(-o.length)) { var u = parseInt(s["LAST-MSN"]), l = parseInt(s["LAST-PART"]); if (t && this.hls.config.lowLatencyMode) { var d = Math.min(t.age - t.partTarget, t.targetduration); void 0 !== l && d > t.partTarget && (l += 1) } if (Object(r.isFiniteNumber)(u)) return new n.HlsUrlParameters(u, Object(r.isFiniteNumber) (l) ? l : void 0, n.HlsSkip.No) } } }, t.loadPlaylist = function(e) {}, t.shouldLoadTrack = function(e) { return this.canLoad && e && !!e.url && (!e.details || e.details.live) }, t.playlistLoaded = function(e, t, i) { var r = this, n = t.details, s = t.stats, o = s.loading.end ? Math.max(0, self.performance.now() - s.loading.end) : 0; if (n.advancedDateTime = Date.now() - o, n.live || null !== i && void 0 !== i && i.live) { if (n.reloaded(i), i && this.log("live playlist " + e + " " + (n.advanced ? "REFRESHED " + n .lastPartSn + "-" + n.lastPartIndex : "MISSED")), i && n.fragments.length > 0 && Object(a .mergeDetails)(i, n), !this.canLoad || !n.live) return; var u, l = void 0, d = void 0; if (n.canBlockReload && n.endSN && n.advanced) { var c = this.hls.config.lowLatencyMode, h = n.lastPartSn, f = n.endSN, p = n.lastPartIndex, m = h === f; - 1 !== p ? (l = m ? f + 1 : h, d = m ? c ? 0 : p : p + 1) : l = f + 1; var g = n.age, v = g + n.ageHeader, y = Math.min(v - n.partTarget, 1.5 * n.targetduration); if (y > 0) { if (i && y > i.tuneInGoal) this.warn("CDN Tune-in goal increased from: " + i.tuneInGoal + " to: " + y + " with playlist age: " + n.age), y = 0; else { var _ = Math.floor(y / n.targetduration); if (l += _, void 0 !== d) d += Math.round(y % n.targetduration / n.partTarget); this.log("CDN Tune-in age: " + n.ageHeader + "s last advanced " + g.toFixed(2) + "s goal: " + y + " skip sn " + _ + " to part " + d) } n.tuneInGoal = y } if (u = this.getDeliveryDirectives(n, t.deliveryDirectives, l, d), c || !m) return void this .loadPlaylist(u) } else u = this.getDeliveryDirectives(n, t.deliveryDirectives, l, d); var b = Object(a.computeReloadInterval)(n, s); void 0 !== l && n.canBlockReload && (b -= n.partTarget || 1), this.log( "reload live playlist " + e + " in " + Math.round(b) + " ms"), this.timer = self .setTimeout(function() { return r.loadPlaylist(u) }, b) } else this.clearTimer() }, t.getDeliveryDirectives = function(e, t, i, r) { var a = Object(n.getSkipValue)(e, i); return null !== t && void 0 !== t && t.skip && e.deltaUpdateFailed && (i = t.msn, r = t.part, a = n.HlsSkip.No), new n.HlsUrlParameters(i, r, a) }, t.retryLoadingOrFail = function(e) { var t, i = this, r = this.hls.config, n = this.retryCount < r.levelLoadingMaxRetry; if (n) if (this.retryCount++, e.details.indexOf("LoadTimeOut") > -1 && null !== (t = e.context) && void 0 !== t && t.deliveryDirectives) this.warn("retry playlist loading #" + this .retryCount + ' after "' + e.details + '"'), this.loadPlaylist(); else { var a = Math.min(Math.pow(2, this.retryCount) * r.levelLoadingRetryDelay, r .levelLoadingMaxRetryTimeout); this.timer = self.setTimeout(function() { return i.loadPlaylist() }, a), this.warn("retry playlist loading #" + this.retryCount + " in " + a + ' ms after "' + e.details + '"') } else this.warn('cannot recover from error "' + e.details + '"'), this.clearTimer(), e.fatal = ! 0; return n }, e }() }, "./src/controller/base-stream-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "State", function() { return w }), i.d(t, "default", function() { return E }); var r = i("./src/polyfills/number.ts"), n = i("./src/task-loop.ts"), a = i("./src/controller/fragment-tracker.ts"), s = i("./src/utils/buffer-helper.ts"), o = i("./src/utils/logger.ts"), u = i("./src/events.ts"), l = i("./src/errors.ts"), d = i("./src/types/transmuxer.ts"), c = i("./src/utils/mp4-tools.ts"), h = i("./src/utils/discontinuities.ts"), f = i("./src/controller/fragment-finders.ts"), p = i("./src/controller/level-helper.ts"), m = i("./src/loader/fragment-loader.ts"), g = i("./src/crypt/decrypter.ts"), v = i("./src/utils/time-ranges.ts"), y = i("./src/types/loader.ts"); function _(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function b(e, t) { return (b = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var w = { STOPPED: "STOPPED", IDLE: "IDLE", KEY_LOADING: "KEY_LOADING", FRAG_LOADING: "FRAG_LOADING", FRAG_LOADING_WAITING_RETRY: "FRAG_LOADING_WAITING_RETRY", WAITING_TRACK: "WAITING_TRACK", PARSING: "PARSING", PARSED: "PARSED", BACKTRACKING: "BACKTRACKING", ENDED: "ENDED", ERROR: "ERROR", WAITING_INIT_PTS: "WAITING_INIT_PTS", WAITING_LEVEL: "WAITING_LEVEL" }, E = function(e) { var t, i; function n(t, i, r) { var n; return (n = e.call(this) || this).hls = void 0, n.fragPrevious = null, n.fragCurrent = null, n .fragmentTracker = void 0, n.transmuxer = null, n._state = w.STOPPED, n.media = void 0, n .mediaBuffer = void 0, n.config = void 0, n.bitrateTest = !1, n.lastCurrentTime = 0, n .nextLoadPosition = 0, n.startPosition = 0, n.loadedmetadata = !1, n.fragLoadError = 0, n .retryDate = 0, n.levels = null, n.fragmentLoader = void 0, n.levelLastLoaded = null, n .startFragRequested = !1, n.decrypter = void 0, n.initPTS = [], n.onvseeking = null, n .onvended = null, n.logPrefix = "", n.log = void 0, n.warn = void 0, n.logPrefix = r, n.log = o .logger.log.bind(o.logger, r + ":"), n.warn = o.logger.warn.bind(o.logger, r + ":"), n.hls = t, n.fragmentLoader = new m.default(t.config, t), n.fragmentTracker = i, n.config = t.config, n .decrypter = new g.default(t, t.config), t.on(u.Events.KEY_LOADED, n.onKeyLoaded, function(e) { if (void 0 === e) throw new ReferenceError( "this hasn't been initialised - super() hasn't been called"); return e }(n)), n } i = e, (t = n).prototype = Object.create(i.prototype), t.prototype.constructor = t, b(t, i); var E, T, S, A = n.prototype; return A.doTick = function() { this.onTickEnd() }, A.onTickEnd = function() {}, A.startLoad = function(e) {}, A.stopLoad = function() { this.fragmentLoader.abort(); var e = this.fragCurrent; e && this.fragmentTracker.removeFragment(e), this.resetTransmuxer(), this.fragCurrent = null, this.fragPrevious = null, this.clearInterval(), this.clearNextTick(), this.state = w.STOPPED }, A._streamEnded = function(e, t) { var i = this.fragCurrent, r = this.fragmentTracker; if (!t.live && i && i.sn >= t.endSN && !e.nextStart) { var n = t.partList; if (null !== n && void 0 !== n && n.length) { var o = n[n.length - 1]; return s.BufferHelper.isBuffered(this.media, o.start + o.duration / 2) } var u = r.getState(i); return u === a.FragmentState.PARTIAL || u === a.FragmentState.OK } return !1 }, A.onMediaAttached = function(e, t) { var i = this.media = this.mediaBuffer = t.media; this.onvseeking = this.onMediaSeeking.bind(this), this.onvended = this.onMediaEnded.bind(this), i.addEventListener("seeking", this.onvseeking), i.addEventListener("ended", this.onvended); var r = this.config; this.levels && r.autoStartLoad && this.state === w.STOPPED && this.startLoad(r.startPosition) }, A.onMediaDetaching = function() { var e = this.media; null !== e && void 0 !== e && e.ended && (this.log( "MSE detaching and video ended, reset startPosition"), this.startPosition = this .lastCurrentTime = 0), e && (e.removeEventListener("seeking", this.onvseeking), e .removeEventListener("ended", this.onvended), this.onvseeking = this.onvended = null), this .media = this.mediaBuffer = null, this.loadedmetadata = !1, this.fragmentTracker .removeAllFragments(), this.stopLoad() }, A.onMediaSeeking = function() { var e = this.config, t = this.fragCurrent, i = this.media, n = this.mediaBuffer, a = this.state, o = i ? i.currentTime : 0, u = s.BufferHelper.bufferInfo(n || i, o, e.maxBufferHole); if (this.log("media seeking to " + (Object(r.isFiniteNumber)(o) ? o.toFixed(3) : o) + ", state: " + a), a === w.ENDED) this.resetLoadingState(); else if (t && !u.len) { var l = e.maxFragLookUpTolerance, d = t.start - l, c = o > t.start + t.duration + l; (o < d || c) && (c && t.loader && (this.log( "seeking outside of buffer while fragment load in progress, cancel fragment load"), t .loader.abort()), this.resetLoadingState()) } i && (this.lastCurrentTime = o), this.loadedmetadata || u.len || (this.nextLoadPosition = this .startPosition = o), this.tickImmediate() }, A.onMediaEnded = function() { this.startPosition = this.lastCurrentTime = 0 }, A.onKeyLoaded = function(e, t) { if (this.state === w.KEY_LOADING && t.frag === this.fragCurrent && this.levels) { this.state = w.IDLE; var i = this.levels[t.frag.level].details; i && this.loadFragment(t.frag, i, t.frag.start) } }, A.onHandlerDestroying = function() { this.stopLoad(), e.prototype.onHandlerDestroying.call(this) }, A.onHandlerDestroyed = function() { this.state = w.STOPPED, this.hls.off(u.Events.KEY_LOADED, this.onKeyLoaded, this), this .fragmentLoader && this.fragmentLoader.destroy(), this.decrypter && this.decrypter.destroy(), this.hls = this.log = this.warn = this.decrypter = this.fragmentLoader = this .fragmentTracker = null, e.prototype.onHandlerDestroyed.call(this) }, A.loadKey = function(e, t) { this.log("Loading key for " + e.sn + " of [" + t.startSN + "-" + t.endSN + "], " + ( "[stream-controller]" === this.logPrefix ? "level" : "track") + " " + e.level), this.state = w.KEY_LOADING, this.fragCurrent = e, this.hls.trigger(u.Events.KEY_LOADING, { frag: e }) }, A.loadFragment = function(e, t, i) { this._loadFragForPlayback(e, t, i) }, A._loadFragForPlayback = function(e, t, i) { var r = this; this._doFragLoad(e, t, i, function(t) { if (r.fragContextChanged(e)) return r.warn("Fragment " + e.sn + (t.part ? " p: " + t.part .index : "") + " of level " + e.level + " was dropped during download."), void r .fragmentTracker.removeFragment(e); e.stats.chunkCount++, r._handleFragmentLoadProgress(t) }).then(function(t) { if (t) { r.fragLoadError = 0; var i = r.state; if (!r.fragContextChanged(e)) return "payload" in t && (r.log("Loaded fragment " + e .sn + " of level " + e.level), r.hls.trigger(u.Events.FRAG_LOADED, t), r .state === w.BACKTRACKING) ? (r.fragmentTracker.backtrack(e, t), void r .resetFragmentLoading(e)) : void r._handleFragmentLoadComplete(t); (i === w.FRAG_LOADING || i === w.BACKTRACKING || !r.fragCurrent && i === w.PARSING) && ( r.fragmentTracker.removeFragment(e), r.state = w.IDLE) } }).catch(function(t) { r.state !== w.STOPPED && (r.warn(t), r.resetFragmentLoading(e)) }) }, A.flushMainBuffer = function(e, t, i) { if (void 0 === i && (i = null), e - t) { var r = { startOffset: e, endOffset: t, type: i }; this.fragLoadError = 0, this.hls.trigger(u.Events.BUFFER_FLUSHING, r) } }, A._loadInitSegment = function(e) { var t = this; this._doFragLoad(e).then(function(i) { if (!i || t.fragContextChanged(e) || !t.levels) throw new Error("init load aborted"); return i }).then(function(i) { var r = t.hls, n = i.payload, a = e.decryptdata; if (n && n.byteLength > 0 && a && a.key && a.iv && "AES-128" === a.method) { var s = self.performance.now(); return t.decrypter.webCryptoDecrypt(new Uint8Array(n), a.key.buffer, a.iv.buffer).then( function(t) { var n = self.performance.now(); return r.trigger(u.Events.FRAG_DECRYPTED, { frag: e, payload: t, stats: { tstart: s, tdecrypt: n } }), i.payload = t, i }) } return i }).then(function(i) { var r = t.fragCurrent, n = t.hls, a = t.levels; if (!a) throw new Error("init load aborted, missing levels"); var s = a[e.level].details; console.assert(s, "Level details are defined when init segment is loaded"); var o = e.stats; t.state = w.IDLE, t.fragLoadError = 0, e.data = new Uint8Array(i.payload), o.parsing .start = o.buffering.start = self.performance.now(), o.parsing.end = o.buffering.end = self.performance.now(), i.frag === r && n.trigger(u.Events.FRAG_BUFFERED, { stats: o, frag: r, part: null, id: e.type }), t.tick() }).catch(function(i) { t.warn(i), t.resetFragmentLoading(e) }) }, A.fragContextChanged = function(e) { var t = this.fragCurrent; return !e || !t || e.level !== t.level || e.sn !== t.sn || e.urlId !== t.urlId }, A.fragBufferedComplete = function(e, t) { var i = this.mediaBuffer ? this.mediaBuffer : this.media; this.log("Buffered " + e.type + " sn: " + e.sn + (t ? " part: " + t.index : "") + " of " + ( "[stream-controller]" === this.logPrefix ? "level" : "track") + " " + e.level + " " + v .default.toString(s.BufferHelper.getBuffered(i))), this.state = w.IDLE, this.tick() }, A._handleFragmentLoadComplete = function(e) { var t = this.transmuxer; if (t) { var i = e.frag, r = e.part, n = e.partsLoaded, a = !n || 0 === n.length || n.some(function(e) { return !e }), s = new d.ChunkMetadata(i.level, i.sn, i.stats.chunkCount + 1, 0, r ? r.index : -1, !a); t.flush(s) } }, A._handleFragmentLoadProgress = function(e) {}, A._doFragLoad = function(e, t, i, n) { var a = this; if (void 0 === i && (i = null), !this.levels) throw new Error( "frag load aborted, missing levels"); if (i = Math.max(e.start, i || 0), this.config.lowLatencyMode && t) { var s = t.partList; if (s && n) { i > e.end && t.fragmentHint && (e = t.fragmentHint); var o = this.getNextPart(s, e, i); if (o > -1) { var l = s[o]; return this.log("Loading part sn: " + e.sn + " p: " + l.index + " cc: " + e.cc + " of playlist [" + t.startSN + "-" + t.endSN + "] parts [0-" + o + "-" + (s.length - 1) + "] " + ("[stream-controller]" === this.logPrefix ? "level" : "track") + ": " + e.level + ", target: " + parseFloat(i.toFixed(3))), this.nextLoadPosition = l.start + l.duration, this.state = w.FRAG_LOADING, this.hls.trigger(u.Events.FRAG_LOADING, { frag: e, part: s[o], targetBufferTime: i }), this.doFragPartsLoad(e, s, o, n).catch(function(e) { return a.handleFragLoadError(e) }) } if (!e.url || this.loadedEndOfParts(s, i)) return Promise.resolve(null) } } return this.log("Loading fragment " + e.sn + " cc: " + e.cc + " " + (t ? "of [" + t.startSN + "-" + t.endSN + "] " : "") + ("[stream-controller]" === this.logPrefix ? "level" : "track") + ": " + e.level + ", target: " + parseFloat(i.toFixed(3))), Object(r .isFiniteNumber)(e.sn) && !this.bitrateTest && (this.nextLoadPosition = e.start + e .duration), this.state = w.FRAG_LOADING, this.hls.trigger(u.Events.FRAG_LOADING, { frag: e, targetBufferTime: i }), this.fragmentLoader.load(e, n).catch(function(e) { return a.handleFragLoadError(e) }) }, A.doFragPartsLoad = function(e, t, i, r) { var n = this; return new Promise(function(a, s) { var o = []; ! function i(l) { var d = t[l]; n.fragmentLoader.loadPart(e, d, r).then(function(r) { o[d.index] = r; var s = r.part; n.hls.trigger(u.Events.FRAG_LOADED, r); var c = t[l + 1]; if (!c || c.fragment !== e) return a({ frag: e, part: s, partsLoaded: o }); i(l + 1) }).catch(s) }(i) }) }, A.handleFragLoadError = function(e) { var t = e.data; return t && t.details === l.ErrorDetails.INTERNAL_ABORTED ? this.handleFragLoadAborted(t.frag, t .part) : this.hls.trigger(u.Events.ERROR, t), null }, A._handleTransmuxerFlush = function(e) { var t = this.getCurrentContext(e); if (t && this.state === w.PARSING) { var i = t.frag, r = t.part, n = t.level, a = self.performance.now(); i.stats.parsing.end = a, r && (r.stats.parsing.end = a), this.updateLevelTiming(i, r, n, e .partial) } else this.fragCurrent || (this.state = w.IDLE) }, A.getCurrentContext = function(e) { var t = this.levels, i = e.level, r = e.sn, n = e.part; if (!t || !t[i]) return this.warn("Levels object was unset while buffering fragment " + r + " of level " + i + ". The current chunk will not be buffered."), null; var a = t[i], s = n > -1 ? Object(p.getPartWith)(a, r, n) : null, o = s ? s.fragment : Object(p.getFragmentWithSN)(a, r, this.fragCurrent); return o ? { frag: o, part: s, level: a } : null }, A.bufferFragmentData = function(e, t, i, r) { if (e && this.state === w.PARSING) { var n = e.data1, a = e.data2, s = n; if (n && a && (s = Object(c.appendUint8Array)(n, a)), s && s.length) { var o = { type: e.type, frag: t, part: i, chunkMeta: r, parent: t.type, data: s }; this.hls.trigger(u.Events.BUFFER_APPENDING, o), e.dropped && e.independent && !i && this .flushBufferGap(t) } } }, A.flushBufferGap = function(e) { var t = this.media; if (t) if (s.BufferHelper.isBuffered(t, t.currentTime)) { var i = t.currentTime, r = s.BufferHelper.bufferInfo(t, i, 0), n = e.duration, a = Math.min(2 * this.config.maxFragLookUpTolerance, .25 * n), o = Math.max(Math.min(e.start - a, r.end - a), i + a); e.start - o > a && this.flushMainBuffer(o, e.start) } else this.flushMainBuffer(0, e.start) }, A.getFwdBufferInfo = function(e, t) { var i = this.config, n = this.getLoadPosition(); if (!Object(r.isFiniteNumber)(n)) return null; var a = s.BufferHelper.bufferInfo(e, n, i.maxBufferHole); if (0 === a.len && void 0 !== a.nextStart) { var o = this.fragmentTracker.getBufferedFrag(n, t); if (o && a.nextStart < o.end) return s.BufferHelper.bufferInfo(e, n, Math.max(a.nextStart, i .maxBufferHole)) } return a }, A.getMaxBufferLength = function(e) { var t, i = this.config; return t = e ? Math.max(8 * i.maxBufferSize / e, i.maxBufferLength) : i.maxBufferLength, Math .min(t, i.maxMaxBufferLength) }, A.reduceMaxBufferLength = function(e) { var t = this.config, i = e || t.maxBufferLength; return t.maxMaxBufferLength >= i && (t.maxMaxBufferLength /= 2, this.warn( "Reduce max buffer length to " + t.maxMaxBufferLength + "s"), !0) }, A.getNextFragment = function(e, t) { var i, r, n = t.fragments, a = n.length; if (!a) return null; var s, o = this.config, u = n[0].start; if (t.live) { var l = o.initialLiveManifestSize; if (a < l) return this.warn("Not enough fragments to start playback (have: " + a + ", need: " + l + ")"), null; t.PTSKnown || this.startFragRequested || -1 !== this.startPosition || (s = this .getInitialLiveFragment(t, n), this.startPosition = s ? this.hls.liveSyncPosition || s .start : e) } else e <= u && (s = n[0]); if (!s) { var d = o.lowLatencyMode ? t.partEnd : t.fragmentEnd; s = this.getFragmentAtPosition(e, d, t) } return null === (i = s) || void 0 === i || !i.initSegment || null !== (r = s) && void 0 !== r && r.initSegment.data || this.bitrateTest || (s = s.initSegment), s }, A.getNextPart = function(e, t, i) { for (var r = -1, n = !1, a = !0, s = 0, o = e.length; s < o; s++) { var u = e[s]; if (a = a && !u.independent, r > -1 && i < u.start) break; var l = u.loaded; !l && (n || u.independent || a) && u.fragment === t && (r = s), n = l } return r }, A.loadedEndOfParts = function(e, t) { var i = e[e.length - 1]; return i && t > i.start && i.loaded }, A.getInitialLiveFragment = function(e, t) { var i = this.fragPrevious, r = null; if (i) { if (e.hasProgramDateTime && (this.log( "Live playlist, switching playlist, load frag with same PDT: " + i.programDateTime), r = Object(f.findFragmentByPDT)(t, i.endProgramDateTime, this.config.maxFragLookUpTolerance)), !r) { var n = i.sn + 1; if (n >= e.startSN && n <= e.endSN) { var a = t[n - e.startSN]; i.cc === a.cc && (r = a, this.log( "Live playlist, switching playlist, load frag with next SN: " + r.sn)) } r || (r = Object(f.findFragWithCC)(t, i.cc)) && this.log( "Live playlist, switching playlist, load frag with same CC: " + r.sn) } } else { var s = this.hls.liveSyncPosition; null !== s && (r = this.getFragmentAtPosition(s, this.bitrateTest ? e.fragmentEnd : e.edge, e)) } return r }, A.getFragmentAtPosition = function(e, t, i) { var r, n = this.config, s = this.fragPrevious, o = i.fragments, u = i.endSN, l = i.fragmentHint, d = n.maxFragLookUpTolerance, c = !!(n.lowLatencyMode && i.partList && l); if (c && l && !this.bitrateTest && (o = o.concat(l), u = l.sn), e < t) { var h = e > t - d ? 0 : d; r = Object(f.findFragmentByPTS)(s, o, e, h) } else r = o[o.length - 1]; if (r) { var p = r.sn - i.startSN, m = s && r.level === s.level, g = o[p + 1]; if (this.fragmentTracker.getState(r) === a.FragmentState.BACKTRACKED) { r = null; for (var v = p; o[v] && this.fragmentTracker.getState(o[v]) === a.FragmentState .BACKTRACKED;) r = s ? o[v--] : o[--v]; r || (r = g) } else s && r.sn === s.sn && !c && m && (r.sn < u && this.fragmentTracker.getState(g) !== a .FragmentState.OK ? (this.log("SN " + r.sn + " just loaded, load next one: " + g.sn), r = g) : r = null) } return r }, A.synchronizeToLiveEdge = function(e) { var t = this.config, i = this.media; if (i) { var r = this.hls.liveSyncPosition, n = i.currentTime, a = e.fragments[0].start, s = e.edge, o = n >= a - t.maxFragLookUpTolerance && n <= s; if (null !== r && i.duration > r && (n < r || !o)) { var u = void 0 !== t.liveMaxLatencyDuration ? t.liveMaxLatencyDuration : t .liveMaxLatencyDurationCount * e.targetduration; (!o && i.readyState < 4 || n < s - u) && (this.loadedmetadata || (this.nextLoadPosition = r), i.readyState && (this.warn("Playback: " + n.toFixed(3) + " is located too far from the end of live sliding playlist: " + s + ", reset currentTime to : " + r.toFixed(3)), i.currentTime = r)) } } }, A.alignPlaylists = function(e, t) { var i = this.levels, n = this.levelLastLoaded, a = this.fragPrevious, s = null !== n ? i[n] : null, o = e.fragments.length; if (!o) return this.warn("No fragments in live playlist"), 0; var u = e.fragments[0].start, l = !t, d = e.alignedSliding && Object(r.isFiniteNumber)(u); if (l || !d && !u) { Object(h.alignStream)(a, s, e); var c = e.fragments[0].start; return this.log("Live playlist sliding: " + c.toFixed(2) + " start-sn: " + (t ? t.startSN : "na") + "->" + e.startSN + " prev-sn: " + (a ? a.sn : "na") + " fragments: " + o), c } return u }, A.waitForCdnTuneIn = function(e) { return e.live && e.canBlockReload && e.tuneInGoal > Math.max(e.partHoldBack, 3 * e.partTarget) }, A.setStartPosition = function(e, t) { var i = this.startPosition; if (i < t && (i = -1), -1 === i || -1 === this.lastCurrentTime) { var n = e.startTimeOffset; Object(r.isFiniteNumber)(n) ? (i = t + n, n < 0 && (i += e.totalduration), i = Math.min(Math .max(t, i), t + e.totalduration), this.log("Start time offset " + n + " found in playlist, adjust startPosition to " + i), this.startPosition = i) : e.live ? i = this.hls.liveSyncPosition || t : this.startPosition = i = 0, this.lastCurrentTime = i } this.nextLoadPosition = i }, A.getLoadPosition = function() { var e = this.media, t = 0; return this.loadedmetadata && e ? t = e.currentTime : this.nextLoadPosition && (t = this .nextLoadPosition), t }, A.handleFragLoadAborted = function(e, t) { this.transmuxer && "initSegment" !== e.sn && e.stats.aborted && (this.warn("Fragment " + e.sn + (t ? " part" + t.index : "") + " of level " + e.level + " was aborted"), this .resetFragmentLoading(e)) }, A.resetFragmentLoading = function(e) { this.fragCurrent && this.fragContextChanged(e) || (this.state = w.IDLE) }, A.onFragmentOrKeyLoadError = function(e, t) { if (!t.fatal) { var i = t.frag; if (i && i.type === e) { var r = this.fragCurrent; console.assert(r && i.sn === r.sn && i.level === r.level && i.urlId === r.urlId, "Frag load error must match current frag to retry"); var n = this.config; if (this.fragLoadError + 1 <= n.fragLoadingMaxRetry) { if (this.resetLiveStartWhenNotLoaded(i.level)) return; var a = Math.min(Math.pow(2, this.fragLoadError) * n.fragLoadingRetryDelay, n .fragLoadingMaxRetryTimeout); this.warn("Fragment " + i.sn + " of " + e + " " + i.level + " failed to load, retrying in " + a + "ms"), this.retryDate = self.performance.now() + a, this.fragLoadError++, this.state = w.FRAG_LOADING_WAITING_RETRY } else t.levelRetry ? (e === y.PlaylistLevelType.AUDIO && (this.fragCurrent = null), this .fragLoadError = 0, this.state = w.IDLE) : (o.logger.error(t.details + " reaches max retry, redispatch as fatal ..."), t.fatal = !0, this.hls.stopLoad(), this.state = w.ERROR) } } }, A.afterBufferFlushed = function(e, t, i) { if (e) { var r = s.BufferHelper.getBuffered(e); this.fragmentTracker.detectEvictedFragments(t, r, i), this.state === w.ENDED && this .resetLoadingState() } }, A.resetLoadingState = function() { this.fragCurrent = null, this.fragPrevious = null, this.state = w.IDLE }, A.resetLiveStartWhenNotLoaded = function(e) { if (!this.loadedmetadata) { this.startFragRequested = !1; var t = this.levels ? this.levels[e].details : null; if (null !== t && void 0 !== t && t.live) return this.startPosition = -1, this .setStartPosition(t, 0), this.resetLoadingState(), !0; this.nextLoadPosition = this.startPosition } return !1 }, A.updateLevelTiming = function(e, t, i, r) { var n = this, a = i.details; console.assert(!!a, "level.details must be defined"), Object.keys(e.elementaryStreams).reduce( function(t, s) { var o = e.elementaryStreams[s]; if (o) { var l = o.endPTS - o.startPTS; if (l <= 0) return n.warn("Could not parse fragment " + e.sn + " " + s + " duration reliably (" + l + ") resetting transmuxer to fallback to playlist timing"), n.resetTransmuxer(), t || !1; var d = r ? 0 : Object(p.updateFragPTSDTS)(a, e, o.startPTS, o.endPTS, o.startDTS, o .endDTS); return n.hls.trigger(u.Events.LEVEL_PTS_UPDATED, { details: a, level: i, drift: d, type: s, frag: e, start: o.startPTS, end: o.endPTS }), !0 } return t }, !1) ? (this.state = w.PARSED, this.hls.trigger(u.Events.FRAG_PARSED, { frag: e, part: t })) : this.resetLoadingState() }, A.resetTransmuxer = function() { this.transmuxer && (this.transmuxer.destroy(), this.transmuxer = null) }, E = n, (T = [{ key: "state", get: function() { return this._state }, set: function(e) { var t = this._state; t !== e && (this._state = e, this.log(t + "->" + e)) } }]) && _(E.prototype, T), S && _(E, S), Object.defineProperty(E, "prototype", { writable: !1 }), n }(n.default) }, "./src/controller/buffer-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return f }); var r = i("./src/polyfills/number.ts"), n = i("./src/events.ts"), a = i("./src/utils/logger.ts"), s = i("./src/errors.ts"), o = i("./src/utils/buffer-helper.ts"), u = i("./src/utils/mediasource-helper.ts"), l = i("./src/loader/fragment.ts"), d = i("./src/controller/buffer-operation-queue.ts"), c = Object(u.getMediaSource)(), h = /([ha]vc.)(?:\.[^.,]+)+/, f = function() { function e(e) { var t = this; this.details = null, this._objectUrl = null, this.operationQueue = void 0, this.listeners = void 0, this.hls = void 0, this.bufferCodecEventsExpected = 0, this._bufferCodecEventsTotal = 0, this.media = null, this.mediaSource = null, this.appendError = 0, this.tracks = {}, this .pendingTracks = {}, this.sourceBuffer = void 0, this._onMediaSourceOpen = function() { var e = t.hls, i = t.media, r = t.mediaSource; a.logger.log("[buffer-controller]: Media source opened"), i && (t .updateMediaElementDuration(), e.trigger(n.Events.MEDIA_ATTACHED, { media: i })), r && r.removeEventListener("sourceopen", t._onMediaSourceOpen), t .checkPendingTracks() }, this._onMediaSourceClose = function() { a.logger.log("[buffer-controller]: Media source closed") }, this._onMediaSourceEnded = function() { a.logger.log("[buffer-controller]: Media source ended") }, this.hls = e, this._initSourceBuffer(), this.registerListeners() } var t = e.prototype; return t.hasSourceTypes = function() { return this.getSourceBufferTypes().length > 0 || Object.keys(this.pendingTracks).length > 0 }, t.destroy = function() { this.unregisterListeners(), this.details = null }, t.registerListeners = function() { var e = this.hls; e.on(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.on(n.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.on(n.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.on( n.Events.BUFFER_RESET, this.onBufferReset, this), e.on(n.Events.BUFFER_APPENDING, this .onBufferAppending, this), e.on(n.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.on(n .Events.BUFFER_EOS, this.onBufferEos, this), e.on(n.Events.BUFFER_FLUSHING, this .onBufferFlushing, this), e.on(n.Events.LEVEL_UPDATED, this.onLevelUpdated, this), e.on(n .Events.FRAG_PARSED, this.onFragParsed, this), e.on(n.Events.FRAG_CHANGED, this .onFragChanged, this) }, t.unregisterListeners = function() { var e = this.hls; e.off(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.off(n.Events.MEDIA_DETACHING, this.onMediaDetaching, this), e.off(n.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.off(n.Events.BUFFER_RESET, this.onBufferReset, this), e.off(n.Events.BUFFER_APPENDING, this .onBufferAppending, this), e.off(n.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.off(n .Events.BUFFER_EOS, this.onBufferEos, this), e.off(n.Events.BUFFER_FLUSHING, this .onBufferFlushing, this), e.off(n.Events.LEVEL_UPDATED, this.onLevelUpdated, this), e.off(n .Events.FRAG_PARSED, this.onFragParsed, this), e.off(n.Events.FRAG_CHANGED, this .onFragChanged, this) }, t._initSourceBuffer = function() { this.sourceBuffer = {}, this.operationQueue = new d.default(this.sourceBuffer), this .listeners = { audio: [], video: [], audiovideo: [] } }, t.onManifestParsed = function(e, t) { var i = 2; (t.audio && !t.video || !t.altAudio) && (i = 1), this.bufferCodecEventsExpected = this ._bufferCodecEventsTotal = i, this.details = null, a.logger.log(this .bufferCodecEventsExpected + " bufferCodec event(s) expected") }, t.onMediaAttaching = function(e, t) { var i = this.media = t.media; if (i && c) { var r = this.mediaSource = new c; r.addEventListener("sourceopen", this._onMediaSourceOpen), r.addEventListener("sourceended", this._onMediaSourceEnded), r.addEventListener("sourceclose", this._onMediaSourceClose), i .src = self.URL.createObjectURL(r), this._objectUrl = i.src } }, t.onMediaDetaching = function() { var e = this.media, t = this.mediaSource, i = this._objectUrl; if (t) { if (a.logger.log("[buffer-controller]: media source detaching"), "open" === t.readyState) try { t.endOfStream() } catch (e) { a.logger.warn("[buffer-controller]: onMediaDetaching: " + e.message + " while calling endOfStream") } this.onBufferReset(), t.removeEventListener("sourceopen", this._onMediaSourceOpen), t .removeEventListener("sourceended", this._onMediaSourceEnded), t.removeEventListener( "sourceclose", this._onMediaSourceClose), e && (i && self.URL.revokeObjectURL(i), e .src === i ? (e.removeAttribute("src"), e.load()) : a.logger.warn( "[buffer-controller]: media.src was changed by a third party - skip cleanup")), this .mediaSource = null, this.media = null, this._objectUrl = null, this .bufferCodecEventsExpected = this._bufferCodecEventsTotal, this.pendingTracks = {}, this .tracks = {} } this.hls.trigger(n.Events.MEDIA_DETACHED, void 0) }, t.onBufferReset = function() { var e = this; this.getSourceBufferTypes().forEach(function(t) { var i = e.sourceBuffer[t]; try { i && (e.removeBufferListeners(t), e.mediaSource && e.mediaSource.removeSourceBuffer(i), e.sourceBuffer[t] = void 0) } catch (e) { a.logger.warn("[buffer-controller]: Failed to reset the " + t + " buffer", e) } }), this._initSourceBuffer() }, t.onBufferCodecs = function(e, t) { var i = this, r = this.getSourceBufferTypes().length; Object.keys(t).forEach(function(e) { if (r) { var n = i.tracks[e]; if (n && "function" == typeof n.buffer.changeType) { var s = t[e], o = s.id, u = s.codec, l = s.levelCodec, d = s.container, c = s.metadata, f = (n.levelCodec || n.codec).replace(h, "$1"), p = (l || u).replace(h, "$1"); if (f !== p) { var m = d + ";codecs=" + (l || u); i.appendChangeType(e, m), a.logger.log("[buffer-controller]: switching codec " + f + " to " + p), i.tracks[e] = { buffer: n.buffer, codec: u, container: d, levelCodec: l, metadata: c, id: o } } } } else i.pendingTracks[e] = t[e] }), r || (this.bufferCodecEventsExpected = Math.max(this.bufferCodecEventsExpected - 1, 0), this.mediaSource && "open" === this.mediaSource.readyState && this.checkPendingTracks()) }, t.appendChangeType = function(e, t) { var i = this, r = this.operationQueue, n = { execute: function() { var n = i.sourceBuffer[e]; n && (a.logger.log("[buffer-controller]: changing " + e + " sourceBuffer type to " + t), n.changeType(t)), r.shiftAndExecuteNext(e) }, onStart: function() {}, onComplete: function() {}, onError: function(t) { a.logger.warn("[buffer-controller]: Failed to change " + e + " SourceBuffer type", t) } }; r.append(n, e) }, t.onBufferAppending = function(e, t) { var i = this, r = this.hls, u = this.operationQueue, l = this.tracks, d = t.data, c = t.type, h = t.frag, f = t.part, p = t.chunkMeta, m = p.buffering[c], g = self.performance.now(); m.start = g; var v = h.stats.buffering, y = f ? f.stats.buffering : null; 0 === v.start && (v.start = g), y && 0 === y.start && (y.start = g); var _ = l.audio, b = "audio" === c && 1 === p.id && "audio/mpeg" === (null === _ || void 0 === _ ? void 0 : _ .container), w = { execute: function() { if (m.executeStart = self.performance.now(), b) { var e = i.sourceBuffer[c]; if (e) { var t = h.start - e.timestampOffset; Math.abs(t) >= .1 && (a.logger.log( "[buffer-controller]: Updating audio SourceBuffer timestampOffset to " + h .start + " (delta: " + t + ") sn: " + h.sn + ")"), e.timestampOffset = h .start) } } i.appendExecutor(d, c) }, onStart: function() {}, onComplete: function() { var e = self.performance.now(); m.executeEnd = m.end = e, 0 === v.first && (v.first = e), y && 0 === y.first && (y .first = e); var t = i.sourceBuffer, r = {}; for (var a in t) r[a] = o.BufferHelper.getBuffered(t[a]); i.appendError = 0, i.hls.trigger(n.Events.BUFFER_APPENDED, { type: c, frag: h, part: f, chunkMeta: p, parent: h.type, timeRanges: r }) }, onError: function(e) { a.logger.error("[buffer-controller]: Error encountered while trying to append to the " + c + " SourceBuffer", e); var t = { type: s.ErrorTypes.MEDIA_ERROR, parent: h.type, details: s.ErrorDetails.BUFFER_APPEND_ERROR, err: e, fatal: !1 }; e.code === DOMException.QUOTA_EXCEEDED_ERR ? t.details = s.ErrorDetails .BUFFER_FULL_ERROR : (i.appendError++, t.details = s.ErrorDetails.BUFFER_APPEND_ERROR, i.appendError > r.config.appendErrorMaxRetry && (a.logger.error( "[buffer-controller]: Failed " + r.config.appendErrorMaxRetry + " times to append segment in sourceBuffer"), t.fatal = !0)), r.trigger(n.Events .ERROR, t) } }; u.append(w, c) }, t.onBufferFlushing = function(e, t) { var i = this, r = this.operationQueue, s = function(e) { return { execute: i.removeExecutor.bind(i, e, t.startOffset, t.endOffset), onStart: function() {}, onComplete: function() { i.hls.trigger(n.Events.BUFFER_FLUSHED, { type: e }) }, onError: function(t) { a.logger.warn("[buffer-controller]: Failed to remove from " + e + " SourceBuffer", t) } } }; t.type ? r.append(s(t.type), t.type) : this.getSourceBufferTypes().forEach(function(e) { r.append(s(e), e) }) }, t.onFragParsed = function(e, t) { var i = this, r = t.frag, s = t.part, o = [], u = s ? s.elementaryStreams : r.elementaryStreams; u[l.ElementaryStreamTypes.AUDIOVIDEO] ? o.push("audiovideo") : (u[l.ElementaryStreamTypes .AUDIO] && o.push("audio"), u[l.ElementaryStreamTypes.VIDEO] && o.push("video")); 0 === o.length && a.logger.warn( "Fragments must have at least one ElementaryStreamType set. type: " + r.type + " level: " + r.level + " sn: " + r.sn), this.blockBuffers(function() { var e = self.performance.now(); r.stats.buffering.end = e, s && (s.stats.buffering.end = e); var t = s ? s.stats : r.stats; i.hls.trigger(n.Events.FRAG_BUFFERED, { frag: r, part: s, stats: t, id: r.type }) }, o) }, t.onFragChanged = function(e, t) { this.flushBackBuffer() }, t.onBufferEos = function(e, t) { var i = this; this.getSourceBufferTypes().reduce(function(e, r) { var n = i.sourceBuffer[r]; return t.type && t.type !== r || n && !n.ended && (n.ended = !0, a.logger.log( "[buffer-controller]: " + r + " sourceBuffer now EOS")), e && !(n && !n.ended) }, !0) && this.blockBuffers(function() { var e = i.mediaSource; e && "open" === e.readyState && e.endOfStream() }) }, t.onLevelUpdated = function(e, t) { var i = t.details; i.fragments.length && (this.details = i, this.getSourceBufferTypes().length ? this.blockBuffers( this.updateMediaElementDuration.bind(this)) : this.updateMediaElementDuration()) }, t.flushBackBuffer = function() { var e = this.hls, t = this.details, i = this.media, a = this.sourceBuffer; if (i && null !== t) { var s = this.getSourceBufferTypes(); if (s.length) { var u = t.live && null !== e.config.liveBackBufferLength ? e.config.liveBackBufferLength : e .config.backBufferLength; if (Object(r.isFiniteNumber)(u) && !(u < 0)) { var l = i.currentTime, d = t.levelTargetDuration, c = Math.max(u, d), h = Math.floor(l / d) * d - c; s.forEach(function(i) { var r = a[i]; if (r) { var s = o.BufferHelper.getBuffered(r); s.length > 0 && h > s.start(0) && (e.trigger(n.Events.BACK_BUFFER_REACHED, { bufferEnd: h }), t.live && e.trigger(n.Events.LIVE_BACK_BUFFER_REACHED, { bufferEnd: h }), e.trigger(n.Events.BUFFER_FLUSHING, { startOffset: 0, endOffset: h, type: i })) } }) } } } }, t.updateMediaElementDuration = function() { if (this.details && this.media && this.mediaSource && "open" === this.mediaSource.readyState) { var e = this.details, t = this.hls, i = this.media, n = this.mediaSource, s = e.fragments[0].start + e.totalduration, o = i.duration, u = Object(r.isFiniteNumber)(n.duration) ? n.duration : 0; e.live && t.config.liveDurationInfinity ? (a.logger.log( "[buffer-controller]: Media Source duration is set to Infinity"), n.duration = 1 / 0, this.updateSeekableRange(e)) : (s > u && s > o || !Object(r.isFiniteNumber)(o)) && (a .logger.log("[buffer-controller]: Updating Media Source duration to " + s.toFixed(3)), n .duration = s) } }, t.updateSeekableRange = function(e) { var t = this.mediaSource, i = e.fragments; if (i.length && e.live && null !== t && void 0 !== t && t.setLiveSeekableRange) { var r = Math.max(0, i[0].start), n = Math.max(r, r + e.totalduration); t.setLiveSeekableRange(r, n) } }, t.checkPendingTracks = function() { var e = this.bufferCodecEventsExpected, t = this.operationQueue, i = this.pendingTracks, r = Object.keys(i).length; if (r && !e || 2 === r) { this.createSourceBuffers(i), this.pendingTracks = {}; var a = this.getSourceBufferTypes(); if (0 === a.length) return void this.hls.trigger(n.Events.ERROR, { type: s.ErrorTypes.MEDIA_ERROR, details: s.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR, fatal: !0, reason: "could not create source buffer for media codec(s)" }); a.forEach(function(e) { t.executeNext(e) }) } }, t.createSourceBuffers = function(e) { var t = this.sourceBuffer, i = this.mediaSource; if (!i) throw Error("createSourceBuffers called when mediaSource was null"); var r = 0; for (var o in e) if (!t[o]) { var u = e[o]; if (!u) throw Error("source buffer exists for track " + o + ", however track does not"); console.log("track.levelCodec = ", o, u.levelCodec, u.codec); var l = u.levelCodec || u.codec; "video" === o ? "avc1.420128" === (l = u.levelCodec || u.codec) && (l = "avc1.4d002a") : l = u.levelCodec || u.codec; var d = u.container + ";codecs=" + l; a.logger.log("[buffer-controller]: creating sourceBuffer(" + d + ")"); try { var c = t[o] = i.addSourceBuffer(d), h = o; this.addBufferListener(h, "updatestart", this._onSBUpdateStart), this.addBufferListener(h, "updateend", this._onSBUpdateEnd), this.addBufferListener(h, "error", this ._onSBUpdateError), this.tracks[o] = { buffer: c, codec: l, container: u.container, levelCodec: u.levelCodec, metadata: u.metadata, id: u.id }, r++ } catch (e) { a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: " + e .message), this.hls.trigger(n.Events.ERROR, { type: s.ErrorTypes.MEDIA_ERROR, details: s.ErrorDetails.BUFFER_ADD_CODEC_ERROR, fatal: !1, error: e, mimeType: d }) } } r && this.hls.trigger(n.Events.BUFFER_CREATED, { tracks: this.tracks }) }, t._onSBUpdateStart = function(e) { this.operationQueue.current(e).onStart() }, t._onSBUpdateEnd = function(e) { var t = this.operationQueue; t.current(e).onComplete(), t.shiftAndExecuteNext(e) }, t._onSBUpdateError = function(e, t) { a.logger.error("[buffer-controller]: " + e + " SourceBuffer error", t), this.hls.trigger(n .Events.ERROR, { type: s.ErrorTypes.MEDIA_ERROR, details: s.ErrorDetails.BUFFER_APPENDING_ERROR, fatal: !1 }); var i = this.operationQueue.current(e); i && i.onError(t) }, t.removeExecutor = function(e, t, i) { var n = this.media, s = this.mediaSource, o = this.operationQueue, u = this.sourceBuffer[e]; if (!n || !s || !u) return a.logger.warn("[buffer-controller]: Attempting to remove from the " + e + " SourceBuffer, but it does not exist"), void o.shiftAndExecuteNext(e); var l = Object(r.isFiniteNumber)(n.duration) ? n.duration : 1 / 0, d = Object(r.isFiniteNumber)(s.duration) ? s.duration : 1 / 0, c = Math.max(0, t), h = Math.min(i, l, d); h > c ? (a.logger.log("[buffer-controller]: Removing [" + c + "," + h + "] from the " + e + " SourceBuffer"), console.assert(!u.updating, e + " sourceBuffer must not be updating"), u .remove(c, h)) : o.shiftAndExecuteNext(e) }, t.appendExecutor = function(e, t) { var i = this.operationQueue, r = this.sourceBuffer[t]; if (!r) return a.logger.warn("[buffer-controller]: Attempting to append to the " + t + " SourceBuffer, but it does not exist"), void i.shiftAndExecuteNext(t); r.ended = !1, console.assert(!r.updating, t + " sourceBuffer must not be updating"), r .appendBuffer(e) }, t.blockBuffers = function(e, t) { var i = this; if (void 0 === t && (t = this.getSourceBufferTypes()), !t.length) return a.logger.log( "[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"), void Promise.resolve(e); var r = this.operationQueue, n = t.map(function(e) { return r.appendBlocker(e) }); Promise.all(n).then(function() { e(), t.forEach(function(e) { var t = i.sourceBuffer[e]; t && t.updating || r.shiftAndExecuteNext(e) }) }) }, t.getSourceBufferTypes = function() { return Object.keys(this.sourceBuffer) }, t.addBufferListener = function(e, t, i) { var r = this.sourceBuffer[e]; if (r) { var n = i.bind(this, e); this.listeners[e].push({ event: t, listener: n }), r.addEventListener(t, n) } }, t.removeBufferListeners = function(e) { var t = this.sourceBuffer[e]; t && this.listeners[e].forEach(function(e) { t.removeEventListener(e.event, e.listener) }) }, e }() }, "./src/controller/buffer-operation-queue.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return n }); var r = i("./src/utils/logger.ts"), n = function() { function e(e) { this.buffers = void 0, this.queues = { video: [], audio: [], audiovideo: [] }, this.buffers = e } var t = e.prototype; return t.append = function(e, t) { var i = this.queues[t]; i.push(e), 1 === i.length && this.buffers[t] && this.executeNext(t) }, t.insertAbort = function(e, t) { this.queues[t].unshift(e), this.executeNext(t) }, t.appendBlocker = function(e) { var t, i = new Promise(function(e) { t = e }), r = { execute: t, onStart: function() {}, onComplete: function() {}, onError: function() {} }; return this.append(r, e), i }, t.executeNext = function(e) { var t = this.buffers, i = this.queues, n = t[e], a = i[e]; if (a.length) { var s = a[0]; try { s.execute() } catch (t) { r.logger.warn( "[buffer-operation-queue]: Unhandled exception executing the current operation"), s .onError(t), n && n.updating || (a.shift(), this.executeNext(e)) } } }, t.shiftAndExecuteNext = function(e) { this.queues[e].shift(), this.executeNext(e) }, t.current = function(e) { return this.queues[e][0] }, e }() }, "./src/controller/cap-level-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/events.ts"); function n(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var a = function() { function e(e) { this.autoLevelCapping = void 0, this.firstLevel = void 0, this.media = void 0, this .restrictedLevels = void 0, this.timer = void 0, this.hls = void 0, this.streamController = void 0, this.clientRect = void 0, this.hls = e, this.autoLevelCapping = Number .POSITIVE_INFINITY, this.firstLevel = -1, this.media = null, this.restrictedLevels = [], this .timer = void 0, this.clientRect = null, this.registerListeners() } var t, i, a, s = e.prototype; return s.setStreamController = function(e) { this.streamController = e }, s.destroy = function() { this.unregisterListener(), this.hls.config.capLevelToPlayerSize && this.stopCapping(), this .media = null, this.clientRect = null, this.hls = this.streamController = null }, s.registerListeners = function() { var e = this.hls; e.on(r.Events.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), e.on(r.Events .MEDIA_ATTACHING, this.onMediaAttaching, this), e.on(r.Events.MANIFEST_PARSED, this .onManifestParsed, this), e.on(r.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.on(r .Events.MEDIA_DETACHING, this.onMediaDetaching, this) }, s.unregisterListener = function() { var e = this.hls; e.off(r.Events.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), e.off(r.Events .MEDIA_ATTACHING, this.onMediaAttaching, this), e.off(r.Events.MANIFEST_PARSED, this .onManifestParsed, this), e.off(r.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.off(r .Events.MEDIA_DETACHING, this.onMediaDetaching, this) }, s.onFpsDropLevelCapping = function(t, i) { e.isLevelAllowed(i.droppedLevel, this.restrictedLevels) && this.restrictedLevels.push(i .droppedLevel) }, s.onMediaAttaching = function(e, t) { this.media = t.media instanceof HTMLVideoElement ? t.media : null }, s.onManifestParsed = function(e, t) { var i = this.hls; this.restrictedLevels = [], this.firstLevel = t.firstLevel, i.config.capLevelToPlayerSize && t .video && this.startCapping() }, s.onBufferCodecs = function(e, t) { this.hls.config.capLevelToPlayerSize && t.video && this.startCapping() }, s.onMediaDetaching = function() { this.stopCapping() }, s.detectPlayerSize = function() { if (this.media && this.mediaHeight > 0 && this.mediaWidth > 0) { var e = this.hls.levels; if (e.length) { var t = this.hls; t.autoLevelCapping = this.getMaxLevel(e.length - 1), t.autoLevelCapping > this .autoLevelCapping && this.streamController && this.streamController.nextLevelSwitch(), this.autoLevelCapping = t.autoLevelCapping } } }, s.getMaxLevel = function(t) { var i = this, r = this.hls.levels; if (!r.length) return -1; var n = r.filter(function(r, n) { return e.isLevelAllowed(n, i.restrictedLevels) && n <= t }); return this.clientRect = null, e.getMaxLevelByMediaSize(n, this.mediaWidth, this.mediaHeight) }, s.startCapping = function() { this.timer || (this.autoLevelCapping = Number.POSITIVE_INFINITY, this.hls.firstLevel = this .getMaxLevel(this.firstLevel), self.clearInterval(this.timer), this.timer = self .setInterval(this.detectPlayerSize.bind(this), 1e3), this.detectPlayerSize()) }, s.stopCapping = function() { this.restrictedLevels = [], this.firstLevel = -1, this.autoLevelCapping = Number .POSITIVE_INFINITY, this.timer && (self.clearInterval(this.timer), this.timer = void 0) }, s.getDimensions = function() { if (this.clientRect) return this.clientRect; var e = this.media, t = { width: 0, height: 0 }; if (e) { var i = e.getBoundingClientRect(); t.width = i.width, t.height = i.height, t.width || t.height || (t.width = i.right - i.left || e.width || 0, t.height = i.bottom - i.top || e.height || 0) } return this.clientRect = t, t }, e.isLevelAllowed = function(e, t) { return void 0 === t && (t = []), -1 === t.indexOf(e) }, e.getMaxLevelByMediaSize = function(e, t, i) { if (!e || !e.length) return -1; for (var r, n, a = e.length - 1, s = 0; s < e.length; s += 1) { var o = e[s]; if ((o.width >= t || o.height >= i) && (r = o, !(n = e[s + 1]) || r.width !== n.width || r .height !== n.height)) { a = s; break } } return a }, t = e, (i = [{ key: "mediaWidth", get: function() { return this.getDimensions().width * this.contentScaleFactor } }, { key: "mediaHeight", get: function() { return this.getDimensions().height * this.contentScaleFactor } }, { key: "contentScaleFactor", get: function() { var e = 1; if (!this.hls.config.ignoreDevicePixelRatio) try { e = self.devicePixelRatio } catch (e) {} return e } }]) && n(t.prototype, i), a && n(t, a), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); t.default = a }, "./src/controller/cmcd-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return h }); var r = i("./src/events.ts"), n = i("./src/types/cmcd.ts"), a = i("./src/utils/buffer-helper.ts"), s = i("./src/utils/logger.ts"); function o(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function u(e, t, i) { return t && o(e.prototype, t), i && o(e, i), Object.defineProperty(e, "prototype", { writable: !1 }), e } function l(e, t) { var i = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (i) return (i = i.call(e)).next.bind(i); if (Array.isArray(e) || (i = function(e, t) { if (!e) return; if ("string" == typeof e) return d(e, t); var i = Object.prototype.toString.call(e).slice(8, -1); "Object" === i && e.constructor && (i = e.constructor.name); if ("Map" === i || "Set" === i) return Array.from(e); if ("Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) return d(e, t) }(e)) || t && e && "number" == typeof e.length) { i && (e = i); var r = 0; return function() { return r >= e.length ? { done: !0 } : { done: !1, value: e[r++] } } } throw new TypeError( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) } function d(e, t) { (null == t || t > e.length) && (t = e.length); for (var i = 0, r = new Array(t); i < t; i++) r[i] = e[i]; return r } function c() { return (c = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }).apply(this, arguments) } var h = function() { function e(t) { var i = this; this.hls = void 0, this.config = void 0, this.media = void 0, this.sid = void 0, this.cid = void 0, this.useHeaders = !1, this.initialized = !1, this.starved = !1, this.buffering = !0, this.audioBuffer = void 0, this.videoBuffer = void 0, this.onWaiting = function() { i.initialized && (i.starved = !0), i.buffering = !0 }, this.onPlaying = function() { i.initialized || (i.initialized = !0), i.buffering = !1 }, this.applyPlaylistData = function(e) { try { i.apply(e, { ot: n.CMCDObjectType.MANIFEST, su: !i.initialized }) } catch (e) { s.logger.warn("Could not generate manifest CMCD data.", e) } }, this.applyFragmentData = function(e) { try { var t = e.frag, r = i.hls.levels[t.level], a = i.getObjectType(t), o = { d: 1e3 * t.duration, ot: a }; a !== n.CMCDObjectType.VIDEO && a !== n.CMCDObjectType.AUDIO && a != n.CMCDObjectType .MUXED || (o.br = r.bitrate / 1e3, o.tb = i.getTopBandwidth(a) / 1e3, o.bl = i .getBufferLength(a)), i.apply(e, o) } catch (e) { s.logger.warn("Could not generate segment CMCD data.", e) } }, this.hls = t; var r = this.config = t.config, a = r.cmcd; null != a && (r.pLoader = this.createPlaylistLoader(), r.fLoader = this.createFragmentLoader(), this.sid = a.sessionId || e.uuid(), this.cid = a.contentId, this.useHeaders = !0 === a .useHeaders, this.registerListeners()) } var t = e.prototype; return t.registerListeners = function() { var e = this.hls; e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHED, this .onMediaDetached, this), e.on(r.Events.BUFFER_CREATED, this.onBufferCreated, this) }, t.unregisterListeners = function() { var e = this.hls; e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHED, this .onMediaDetached, this), e.off(r.Events.BUFFER_CREATED, this.onBufferCreated, this), this .onMediaDetached() }, t.destroy = function() { this.unregisterListeners(), this.hls = this.config = this.audioBuffer = this.videoBuffer = null }, t.onMediaAttached = function(e, t) { this.media = t.media, this.media.addEventListener("waiting", this.onWaiting), this.media .addEventListener("playing", this.onPlaying) }, t.onMediaDetached = function() { this.media && (this.media.removeEventListener("waiting", this.onWaiting), this.media .removeEventListener("playing", this.onPlaying), this.media = null) }, t.onBufferCreated = function(e, t) { var i, r; this.audioBuffer = null === (i = t.tracks.audio) || void 0 === i ? void 0 : i.buffer, this .videoBuffer = null === (r = t.tracks.video) || void 0 === r ? void 0 : r.buffer }, t.createData = function() { var e; return { v: n.CMCDVersion, sf: n.CMCDStreamingFormat.HLS, sid: this.sid, cid: this.cid, pr: null === (e = this.media) || void 0 === e ? void 0 : e.playbackRate, mtp: this.hls.bandwidthEstimate / 1e3 } }, t.apply = function(t, i) { void 0 === i && (i = {}), c(i, this.createData()); var r = i.ot === n.CMCDObjectType.INIT || i.ot === n.CMCDObjectType.VIDEO || i.ot === n .CMCDObjectType.MUXED; if (this.starved && r && (i.bs = !0, i.su = !0, this.starved = !1), null == i.su && (i.su = this .buffering), this.useHeaders) { var a = e.toHeaders(i); if (!Object.keys(a).length) return; t.headers || (t.headers = {}), c(t.headers, a) } else { var s = e.toQuery(i); if (!s) return; t.url = e.appendQueryToUri(t.url, s) } }, t.getObjectType = function(e) { var t = e.type; return "subtitle" === t ? n.CMCDObjectType.TIMED_TEXT : "initSegment" === e.sn ? n .CMCDObjectType.INIT : "audio" === t ? n.CMCDObjectType.AUDIO : "main" === t ? this.hls .audioTracks.length ? n.CMCDObjectType.VIDEO : n.CMCDObjectType.MUXED : void 0 }, t.getTopBandwidth = function(e) { var t, i = 0, r = this.hls; if (e === n.CMCDObjectType.AUDIO) t = r.audioTracks; else { var a = r.maxAutoLevel, s = a > -1 ? a + 1 : r.levels.length; t = r.levels.slice(0, s) } for (var o, u = l(t); !(o = u()).done;) { var d = o.value; d.bitrate > i && (i = d.bitrate) } return i > 0 ? i : NaN }, t.getBufferLength = function(e) { var t = this.hls.media, i = e === n.CMCDObjectType.AUDIO ? this.audioBuffer : this.videoBuffer; return i && t ? 1e3 * a.BufferHelper.bufferInfo(i, t.currentTime, this.config.maxBufferHole) .len : NaN }, t.createPlaylistLoader = function() { var e = this.config.pLoader, t = this.applyPlaylistData, i = e || this.config.loader; return function() { function e(e) { this.loader = void 0, this.loader = new i(e) } var r = e.prototype; return r.destroy = function() { this.loader.destroy() }, r.abort = function() { this.loader.abort() }, r.load = function(e, i, r) { t(e), this.loader.load(e, i, r) }, u(e, [{ key: "stats", get: function() { return this.loader.stats } }, { key: "context", get: function() { return this.loader.context } }]), e }() }, t.createFragmentLoader = function() { var e = this.config.fLoader, t = this.applyFragmentData, i = e || this.config.loader; return function() { function e(e) { this.loader = void 0, this.loader = new i(e) } var r = e.prototype; return r.destroy = function() { this.loader.destroy() }, r.abort = function() { this.loader.abort() }, r.load = function(e, i, r) { t(e), this.loader.load(e, i, r) }, u(e, [{ key: "stats", get: function() { return this.loader.stats } }, { key: "context", get: function() { return this.loader.context } }]), e }() }, e.uuid = function() { var e = URL.createObjectURL(new Blob), t = e.toString(); return URL.revokeObjectURL(e), t.slice(t.lastIndexOf("/") + 1) }, e.serialize = function(e) { for (var t, i = [], r = function(e) { return !Number.isNaN(e) && null != e && "" !== e && !1 !== e }, n = function(e) { return Math.round(e) }, a = function(e) { return 100 * n(e / 100) }, s = { br: n, d: n, bl: a, dl: a, mtp: a, nor: function(e) { return encodeURIComponent(e) }, rtp: a, tb: n }, o = l(Object.keys(e || {}).sort()); !(t = o()).done;) { var u = t.value, d = e[u]; if (r(d) && !("v" === u && 1 === d || "pr" == u && 1 === d)) { var c = s[u]; c && (d = c(d)); var h = typeof d, f = void 0; f = "ot" === u || "sf" === u || "st" === u ? u + "=" + d : "boolean" === h ? u : "number" === h ? u + "=" + d : u + "=" + JSON.stringify(d), i.push(f) } } return i.join(",") }, e.toHeaders = function(t) { for (var i = {}, r = ["Object", "Request", "Session", "Status"], n = [{}, {}, {}, {}], a = { br: 0, d: 0, ot: 0, tb: 0, bl: 1, dl: 1, mtp: 1, nor: 1, nrr: 1, su: 1, cid: 2, pr: 2, sf: 2, sid: 2, st: 2, v: 2, bs: 3, rtp: 3 }, s = 0, o = Object.keys(t); s < o.length; s++) { var u = o[s]; n[null != a[u] ? a[u] : 1][u] = t[u] } for (var l = 0; l < n.length; l++) { var d = e.serialize(n[l]); d && (i["CMCD-" + r[l]] = d) } return i }, e.toQuery = function(t) { return "CMCD=" + encodeURIComponent(e.serialize(t)) }, e.appendQueryToUri = function(e, t) { return t ? "" + e + (e.includes("?") ? "&" : "?") + t : e }, e }() }, "./src/controller/eme-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/events.ts"), n = i("./src/errors.ts"), a = i("./src/utils/logger.ts"), s = i("./src/utils/mediakeys-helper.ts"); function o(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var u = function() { function e(e) { this.hls = void 0, this._widevineLicenseUrl = void 0, this._licenseXhrSetup = void 0, this ._licenseResponseCallback = void 0, this._emeEnabled = void 0, this ._requestMediaKeySystemAccess = void 0, this._drmSystemOptions = void 0, this._config = void 0, this._mediaKeysList = [], this._media = null, this._hasSetMediaKeys = !1, this ._requestLicenseFailureCount = 0, this.mediaKeysPromise = null, this._onMediaEncrypted = this .onMediaEncrypted.bind(this), this.hls = e, this._config = e.config, this._widevineLicenseUrl = this._config.widevineLicenseUrl, this._licenseXhrSetup = this._config.licenseXhrSetup, this ._licenseResponseCallback = this._config.licenseResponseCallback, this._emeEnabled = this ._config.emeEnabled, this._requestMediaKeySystemAccess = this._config .requestMediaKeySystemAccessFunc, this._drmSystemOptions = this._config.drmSystemOptions, this ._registerListeners() } var t, i, u, l = e.prototype; return l.destroy = function() { this._unregisterListeners(), this.hls = this._onMediaEncrypted = null, this ._requestMediaKeySystemAccess = null }, l._registerListeners = function() { this.hls.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(r.Events .MEDIA_DETACHED, this.onMediaDetached, this), this.hls.on(r.Events.MANIFEST_PARSED, this .onManifestParsed, this) }, l._unregisterListeners = function() { this.hls.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.off(r.Events .MEDIA_DETACHED, this.onMediaDetached, this), this.hls.off(r.Events.MANIFEST_PARSED, this .onManifestParsed, this) }, l.getLicenseServerUrl = function(e) { switch (e) { case s.KeySystems.WIDEVINE: if (!this._widevineLicenseUrl) break; return this._widevineLicenseUrl } throw new Error('no license server URL configured for key-system "' + e + '"') }, l._attemptKeySystemAccess = function(e, t, i) { var r = this, n = function(e, t, i, r) { switch (e) { case s.KeySystems.WIDEVINE: return function(e, t, i) { var r = { audioCapabilities: [], videoCapabilities: [] }; return e.forEach(function(e) { r.audioCapabilities.push({ contentType: 'audio/mp4; codecs="' + e + '"', robustness: i.audioRobustness || "" }) }), t.forEach(function(e) { r.videoCapabilities.push({ contentType: 'video/mp4; codecs="' + e + '"', robustness: i.videoRobustness || "" }) }), [r] }(t, i, r); default: throw new Error("Unknown key-system: " + e) } }(e, t, i, this._drmSystemOptions); a.logger.log("Requesting encrypted media key-system access"); var o = this.requestMediaKeySystemAccess(e, n); this.mediaKeysPromise = o.then(function(t) { return r._onMediaKeySystemAccessObtained(e, t) }), o.catch(function(t) { a.logger.error('Failed to obtain key-system "' + e + '" access:', t) }) }, l._onMediaKeySystemAccessObtained = function(e, t) { var i = this; a.logger.log('Access for key-system "' + e + '" obtained'); var r = { mediaKeysSessionInitialized: !1, mediaKeySystemAccess: t, mediaKeySystemDomain: e }; this._mediaKeysList.push(r); var n = Promise.resolve().then(function() { return t.createMediaKeys() }).then(function(t) { return r.mediaKeys = t, a.logger.log('Media-keys created for key-system "' + e + '"'), i ._onMediaKeysCreated(), t }); return n.catch(function(e) { a.logger.error("Failed to create media-keys:", e) }), n }, l._onMediaKeysCreated = function() { var e = this; this._mediaKeysList.forEach(function(t) { t.mediaKeysSession || (t.mediaKeysSession = t.mediaKeys.createSession(), e ._onNewMediaKeySession(t.mediaKeysSession)) }) }, l._onNewMediaKeySession = function(e) { var t = this; a.logger.log("New key-system session " + e.sessionId), e.addEventListener("message", function( i) { t._onKeySessionMessage(e, i.message) }, !1) }, l._onKeySessionMessage = function(e, t) { a.logger.log("Got EME message event, creating license request"), this._requestLicense(t, function(t) { a.logger.log("Received license data (length: " + (t ? t.byteLength : t) + "), updating key-session"), e.update(t).catch(function(e) { a.logger.warn("Updating key-session failed: " + e) }) }) }, l.onMediaEncrypted = function(e) { var t = this; if (a.logger.log('Media is encrypted using "' + e.initDataType + '" init data type'), !this .mediaKeysPromise) return a.logger.error( "Fatal: Media is encrypted but no CDM access or no keys have been requested"), void this .hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_NO_KEYS, fatal: !0 }); var i = function(i) { t._media && (t._attemptSetMediaKeys(i), t._generateRequestWithPreferredKeySession(e .initDataType, e.initData)) }; this.mediaKeysPromise.then(i).catch(i) }, l._attemptSetMediaKeys = function(e) { if (!this._media) throw new Error( "Attempted to set mediaKeys without first attaching a media element"); if (!this._hasSetMediaKeys) { var t = this._mediaKeysList[0]; if (!t || !t.mediaKeys) return a.logger.error( "Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"), void this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_NO_KEYS, fatal: !0 }); a.logger.log("Setting keys for encrypted media"), this._media.setMediaKeys(t.mediaKeys), this ._hasSetMediaKeys = !0 } }, l._generateRequestWithPreferredKeySession = function(e, t) { var i = this, s = this._mediaKeysList[0]; if (!s) return a.logger.error( "Fatal: Media is encrypted but not any key-system access has been obtained yet"), void this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_NO_ACCESS, fatal: !0 }); if (s.mediaKeysSessionInitialized) a.logger.warn( "Key-Session already initialized but requested again"); else { var o = s.mediaKeysSession; if (!o) return a.logger.error("Fatal: Media is encrypted but no key-session existing"), void this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_NO_SESSION, fatal: !0 }); if (!t) return a.logger.warn("Fatal: initData required for generating a key session is null"), void this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA, fatal: !0 }); a.logger.log('Generating key-session request for "' + e + '" init data type'), s .mediaKeysSessionInitialized = !0, o.generateRequest(e, t).then(function() { a.logger.debug("Key-session generation succeeded") }).catch(function(e) { a.logger.error("Error generating key-session request:", e), i.hls.trigger(r.Events .ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_NO_SESSION, fatal: !1 }) }) } }, l._createLicenseXhr = function(e, t, i) { var r = new XMLHttpRequest; r.responseType = "arraybuffer", r.onreadystatechange = this._onLicenseRequestReadyStageChange .bind(this, r, e, t, i); var n = this._licenseXhrSetup; if (n) try { n.call(this.hls, r, e), n = void 0 } catch (e) { a.logger.error(e) } try { r.readyState || r.open("POST", e, !0), n && n.call(this.hls, r, e) } catch (e) { throw new Error("issue setting up KeySystem license XHR " + e) } return r }, l._onLicenseRequestReadyStageChange = function(e, t, i, s) { switch (e.readyState) { case 4: if (200 === e.status) { this._requestLicenseFailureCount = 0, a.logger.log("License request succeeded"); var o = e.response, u = this._licenseResponseCallback; if (u) try { o = u.call(this.hls, e, t) } catch (e) { a.logger.error(e) } s(o) } else { if (a.logger.error("License Request XHR failed (" + t + "). Status: " + e.status + " (" + e.statusText + ")"), this._requestLicenseFailureCount++, this ._requestLicenseFailureCount > 3) return void this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED, fatal: !0 }); var l = 3 - this._requestLicenseFailureCount + 1; a.logger.warn("Retrying license request, " + l + " attempts left"), this._requestLicense( i, s) } } }, l._generateLicenseRequestChallenge = function(e, t) { switch (e.mediaKeySystemDomain) { case s.KeySystems.WIDEVINE: return t } throw new Error("unsupported key-system: " + e.mediaKeySystemDomain) }, l._requestLicense = function(e, t) { a.logger.log("Requesting content license for key-system"); var i = this._mediaKeysList[0]; if (!i) return a.logger.error( "Fatal error: Media is encrypted but no key-system access has been obtained yet"), void this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_NO_ACCESS, fatal: !0 }); try { var s = this.getLicenseServerUrl(i.mediaKeySystemDomain), o = this._createLicenseXhr(s, e, t); a.logger.log("Sending license request to URL: " + s); var u = this._generateLicenseRequestChallenge(i, e); o.send(u) } catch (e) { a.logger.error("Failure requesting DRM license: " + e), this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.KEY_SYSTEM_ERROR, details: n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED, fatal: !0 }) } }, l.onMediaAttached = function(e, t) { if (this._emeEnabled) { var i = t.media; this._media = i, i.addEventListener("encrypted", this._onMediaEncrypted) } }, l.onMediaDetached = function() { var e = this._media, t = this._mediaKeysList; e && (e.removeEventListener("encrypted", this._onMediaEncrypted), this._media = null, this ._mediaKeysList = [], Promise.all(t.map(function(e) { if (e.mediaKeysSession) return e.mediaKeysSession.close().catch(function() {}) })).then(function() { return e.setMediaKeys(null) }).catch(function() {})) }, l.onManifestParsed = function(e, t) { if (this._emeEnabled) { var i = t.levels.map(function(e) { return e.audioCodec }).filter(function(e) { return !!e }), r = t.levels.map(function(e) { return e.videoCodec }).filter(function(e) { return !!e }); this._attemptKeySystemAccess(s.KeySystems.WIDEVINE, i, r) } }, t = e, (i = [{ key: "requestMediaKeySystemAccess", get: function() { if (!this._requestMediaKeySystemAccess) throw new Error( "No requestMediaKeySystemAccess function configured"); return this._requestMediaKeySystemAccess } }]) && o(t.prototype, i), u && o(t, u), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); t.default = u }, "./src/controller/fps-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/events.ts"), n = i("./src/utils/logger.ts"), a = function() { function e(e) { this.hls = void 0, this.isVideoPlaybackQualityAvailable = !1, this.timer = void 0, this.media = null, this.lastTime = void 0, this.lastDroppedFrames = 0, this.lastDecodedFrames = 0, this .streamController = void 0, this.hls = e, this.registerListeners() } var t = e.prototype; return t.setStreamController = function(e) { this.streamController = e }, t.registerListeners = function() { this.hls.on(r.Events.MEDIA_ATTACHING, this.onMediaAttaching, this) }, t.unregisterListeners = function() { this.hls.off(r.Events.MEDIA_ATTACHING, this.onMediaAttaching) }, t.destroy = function() { this.timer && clearInterval(this.timer), this.unregisterListeners(), this .isVideoPlaybackQualityAvailable = !1, this.media = null }, t.onMediaAttaching = function(e, t) { var i = this.hls.config; if (i.capLevelOnFPSDrop) { var r = t.media instanceof self.HTMLVideoElement ? t.media : null; this.media = r, r && "function" == typeof r.getVideoPlaybackQuality && (this .isVideoPlaybackQualityAvailable = !0), self.clearInterval(this.timer), this.timer = self .setInterval(this.checkFPSInterval.bind(this), i.fpsDroppedMonitoringPeriod) } }, t.checkFPS = function(e, t, i) { var a = performance.now(); if (t) { if (this.lastTime) { var s = a - this.lastTime, o = i - this.lastDroppedFrames, u = t - this.lastDecodedFrames, l = 1e3 * o / s, d = this.hls; if (d.trigger(r.Events.FPS_DROP, { currentDropped: o, currentDecoded: u, totalDroppedFrames: i }), l > 0 && o > d.config.fpsDroppedMonitoringThreshold * u) { var c = d.currentLevel; n.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: " + c), c > 0 && (-1 === d.autoLevelCapping || d.autoLevelCapping >= c) && (c -= 1, d.trigger(r .Events.FPS_DROP_LEVEL_CAPPING, { level: c, droppedLevel: d.currentLevel }), d.autoLevelCapping = c, this.streamController.nextLevelSwitch()) } } this.lastTime = a, this.lastDroppedFrames = i, this.lastDecodedFrames = t } }, t.checkFPSInterval = function() { var e = this.media; if (e) if (this.isVideoPlaybackQualityAvailable) { var t = e.getVideoPlaybackQuality(); this.checkFPS(e, t.totalVideoFrames, t.droppedVideoFrames) } else this.checkFPS(e, e.webkitDecodedFrameCount, e.webkitDroppedFrameCount) }, e }(); t.default = a }, "./src/controller/fragment-finders.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "findFragmentByPDT", function() { return a }), i.d(t, "findFragmentByPTS", function() { return s }), i.d(t, "fragmentWithinToleranceTest", function() { return o }), i.d(t, "pdtWithinToleranceTest", function() { return u }), i.d(t, "findFragWithCC", function() { return l }); var r = i("./src/polyfills/number.ts"), n = i("./src/utils/binary-search.ts"); function a(e, t, i) { if (null === t || !Array.isArray(e) || !e.length || !Object(r.isFiniteNumber)(t)) return null; if (t < (e[0].programDateTime || 0)) return null; if (t >= (e[e.length - 1].endProgramDateTime || 0)) return null; i = i || 0; for (var n = 0; n < e.length; ++n) { var a = e[n]; if (u(t, i, a)) return a } return null } function s(e, t, i, r) { void 0 === i && (i = 0), void 0 === r && (r = 0); var a = null; if (e ? a = t[e.sn - t[0].sn + 1] || null : 0 === i && 0 === t[0].start && (a = t[0]), a && 0 === o(i, r, a)) return a; var s = n.default.search(t, o.bind(null, i, r)); return s || a } function o(e, t, i) { void 0 === e && (e = 0), void 0 === t && (t = 0); var r = Math.min(t, i.duration + (i.deltaPTS ? i.deltaPTS : 0)); return i.start + i.duration - r <= e ? 1 : i.start - r > e && i.start ? -1 : 0 } function u(e, t, i) { var r = 1e3 * Math.min(t, i.duration + (i.deltaPTS ? i.deltaPTS : 0)); return (i.endProgramDateTime || 0) - r > e } function l(e, t) { return n.default.search(e, function(e) { return e.cc < t ? 1 : e.cc > t ? -1 : 0 }) } }, "./src/controller/fragment-tracker.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "FragmentState", function() { return r }), i.d(t, "FragmentTracker", function() { return s }); var r, n = i("./src/events.ts"), a = i("./src/types/loader.ts"); ! function(e) { e.NOT_LOADED = "NOT_LOADED", e.BACKTRACKED = "BACKTRACKED", e.APPENDING = "APPENDING", e.PARTIAL = "PARTIAL", e.OK = "OK" }(r || (r = {})); var s = function() { function e(e) { this.activeFragment = null, this.activeParts = null, this.fragments = Object.create(null), this .timeRanges = Object.create(null), this.bufferPadding = .2, this.hls = void 0, this.hls = e, this._registerListeners() } var t = e.prototype; return t._registerListeners = function() { var e = this.hls; e.on(n.Events.BUFFER_APPENDED, this.onBufferAppended, this), e.on(n.Events.FRAG_BUFFERED, this .onFragBuffered, this), e.on(n.Events.FRAG_LOADED, this.onFragLoaded, this) }, t._unregisterListeners = function() { var e = this.hls; e.off(n.Events.BUFFER_APPENDED, this.onBufferAppended, this), e.off(n.Events.FRAG_BUFFERED, this .onFragBuffered, this), e.off(n.Events.FRAG_LOADED, this.onFragLoaded, this) }, t.destroy = function() { this._unregisterListeners(), this.fragments = this.timeRanges = null }, t.getAppendedFrag = function(e, t) { if (t === a.PlaylistLevelType.MAIN) { var i = this.activeFragment, r = this.activeParts; if (!i) return null; if (r) for (var n = r.length; n--;) { var s = r[n], o = s ? s.end : i.appendedPTS; if (s.start <= e && void 0 !== o && e <= o) return n > 9 && (this.activeParts = r.slice( n - 9)), s } else if (i.start <= e && void 0 !== i.appendedPTS && e <= i.appendedPTS) return i } return this.getBufferedFrag(e, t) }, t.getBufferedFrag = function(e, t) { for (var i = this.fragments, r = Object.keys(i), n = r.length; n--;) { var a = i[r[n]]; if ((null === a || void 0 === a ? void 0 : a.body.type) === t && a.buffered) { var s = a.body; if (s.start <= e && e <= s.end) return s } } return null }, t.detectEvictedFragments = function(e, t, i) { var r = this; Object.keys(this.fragments).forEach(function(n) { var a = r.fragments[n]; if (a) if (a.buffered) { var s = a.range[e]; s && s.time.some(function(e) { var i = !r.isTimeBuffered(e.startPTS, e.endPTS, t); return i && r.removeFragment(a.body), i }) } else a.body.type === i && r.removeFragment(a.body) }) }, t.detectPartialFragments = function(e) { var t = this, i = this.timeRanges, r = e.frag, n = e.part; if (i && "initSegment" !== r.sn) { var a = u(r), s = this.fragments[a]; s && (Object.keys(i).forEach(function(e) { var a = r.elementaryStreams[e]; if (a) { var o = i[e], u = null !== n || !0 === a.partial; s.range[e] = t.getBufferedTimes(r, n, u, o) } }), s.backtrack = s.loaded = null, Object.keys(s.range).length ? s.buffered = !0 : this .removeFragment(s.body)) } }, t.fragBuffered = function(e) { var t = u(e), i = this.fragments[t]; i && (i.backtrack = i.loaded = null, i.buffered = !0) }, t.getBufferedTimes = function(e, t, i, r) { for (var n = { time: [], partial: i }, a = t ? t.start : e.start, s = t ? t.end : e.end, o = e.minEndPTS || s, u = e .maxStartPTS || a, l = 0; l < r.length; l++) { var d = r.start(l) - this.bufferPadding, c = r.end(l) + this.bufferPadding; if (u >= d && o <= c) { n.time.push({ startPTS: Math.max(a, r.start(l)), endPTS: Math.min(s, r.end(l)) }); break } if (a < c && s > d) n.partial = !0, n.time.push({ startPTS: Math.max(a, r.start(l)), endPTS: Math.min(s, r.end(l)) }); else if (s <= d) break } return n }, t.getPartialFragment = function(e) { var t, i, r, n = null, a = 0, s = this.bufferPadding, u = this.fragments; return Object.keys(u).forEach(function(l) { var d = u[l]; d && o(d) && (i = d.body.start - s, r = d.body.end + s, e >= i && e <= r && (t = Math.min( e - i, r - e), a <= t && (n = d.body, a = t))) }), n }, t.getState = function(e) { var t = u(e), i = this.fragments[t]; return i ? i.buffered ? o(i) ? r.PARTIAL : r.OK : i.backtrack ? r.BACKTRACKED : r.APPENDING : r .NOT_LOADED }, t.backtrack = function(e, t) { var i = u(e), r = this.fragments[i]; if (!r || r.backtrack) return null; var n = r.backtrack = t || r.loaded; return r.loaded = null, n }, t.getBacktrackData = function(e) { var t = u(e), i = this.fragments[t]; if (i) { var r, n = i.backtrack; if (null !== n && void 0 !== n && null !== (r = n.payload) && void 0 !== r && r.byteLength) return n; this.removeFragment(e) } return null }, t.isTimeBuffered = function(e, t, i) { for (var r, n, a = 0; a < i.length; a++) { if (r = i.start(a) - this.bufferPadding, n = i.end(a) + this.bufferPadding, e >= r && t <= n) return !0; if (t <= r) return !1 } return !1 }, t.onFragLoaded = function(e, t) { var i = t.frag, r = t.part; if ("initSegment" !== i.sn && !i.bitrateTest && !r) { var n = u(i); this.fragments[n] = { body: i, loaded: t, backtrack: null, buffered: !1, range: Object.create(null) } } }, t.onBufferAppended = function(e, t) { var i = this, r = t.frag, n = t.part, s = t.timeRanges; if (r.type === a.PlaylistLevelType.MAIN) if (this.activeFragment = r, n) { var o = this.activeParts; o || (this.activeParts = o = []), o.push(n) } else this.activeParts = null; this.timeRanges = s, Object.keys(s).forEach(function(e) { var t = s[e]; if (i.detectEvictedFragments(e, t), !n) for (var a = 0; a < t.length; a++) r.appendedPTS = Math.max(t.end(a), r.appendedPTS || 0) }) }, t.onFragBuffered = function(e, t) { this.detectPartialFragments(t) }, t.hasFragment = function(e) { var t = u(e); return !!this.fragments[t] }, t.removeFragmentsInRange = function(e, t, i) { var r = this; Object.keys(this.fragments).forEach(function(n) { var a = r.fragments[n]; if (a && a.buffered) { var s = a.body; s.type === i && s.start < t && s.end > e && r.removeFragment(s) } }) }, t.removeFragment = function(e) { var t = u(e); e.stats.loaded = 0, e.clearElementaryStreamInfo(), delete this.fragments[t] }, t.removeAllFragments = function() { this.fragments = Object.create(null), this.activeFragment = null, this.activeParts = null }, e }(); function o(e) { var t, i; return e.buffered && ((null === (t = e.range.video) || void 0 === t ? void 0 : t.partial) || (null === (i = e.range.audio) || void 0 === i ? void 0 : i.partial)) } function u(e) { return e.type + "_" + e.level + "_" + e.urlId + "_" + e.sn } }, "./src/controller/gap-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "STALL_MINIMUM_DURATION_MS", function() { return o }), i.d(t, "MAX_START_GAP_JUMP", function() { return u }), i.d(t, "SKIP_BUFFER_HOLE_STEP_SECONDS", function() { return l }), i.d(t, "SKIP_BUFFER_RANGE_START", function() { return d }), i.d(t, "default", function() { return c }); var r = i("./src/utils/buffer-helper.ts"), n = i("./src/errors.ts"), a = i("./src/events.ts"), s = i("./src/utils/logger.ts"), o = 250, u = 2, l = .1, d = .05, c = function() { function e(e, t, i, r) { this.config = void 0, this.media = void 0, this.fragmentTracker = void 0, this.hls = void 0, this .nudgeRetry = 0, this.stallReported = !1, this.stalled = null, this.moved = !1, this.seeking = ! 1, this.config = e, this.media = t, this.fragmentTracker = i, this.hls = r } var t = e.prototype; return t.destroy = function() { this.hls = this.fragmentTracker = this.media = null }, t.poll = function(e) { var t = this.config, i = this.media, n = this.stalled, a = i.currentTime, l = i.seeking, d = this.seeking && !l, c = !this.seeking && l; if (this.seeking = l, a === e) { if ((c || d) && (this.stalled = null), !i.paused && !i.ended && 0 !== i.playbackRate && r .BufferHelper.getBuffered(i).length) { var h = r.BufferHelper.bufferInfo(i, a, 0), f = h.len > 0, p = h.nextStart || 0; if (f || p) { if (l) { var m = h.len > u, g = !p || p - a > u && !this.fragmentTracker.getPartialFragment(a); if (m || g) return; this.moved = !1 } if (!this.moved && null !== this.stalled) { var v, y = Math.max(p, h.start || 0) - a, _ = this.hls.levels ? this.hls.levels[this.hls.currentLevel] : null, b = (null === _ || void 0 === _ ? void 0 : null === (v = _.details) || void 0 === v ? void 0 : v.live) ? 2 * _.details.targetduration : u; if (y > 0 && y <= b) return void this._trySkipBufferHole(null) } var w = self.performance.now(); if (null !== n) { var E = w - n; !l && E >= o && this._reportStall(h.len); var T = r.BufferHelper.bufferInfo(i, a, t.maxBufferHole); this._tryFixBufferStall(T, E) } else this.stalled = w } } } else if (this.moved = !0, null !== n) { if (this.stallReported) { var S = self.performance.now() - n; s.logger.warn("playback not stuck anymore @" + a + ", after " + Math.round(S) + "ms"), this .stallReported = !1 } this.stalled = null, this.nudgeRetry = 0 } }, t._tryFixBufferStall = function(e, t) { var i = this.config, r = this.fragmentTracker, n = this.media.currentTime, a = r.getPartialFragment(n); if (a && this._trySkipBufferHole(a)) return; e.len > i.maxBufferHole && t > 1e3 * i.highBufferWatchdogPeriod && (s.logger.warn( "Trying to nudge playhead over buffer-hole"), this.stalled = null, this._tryNudgeBuffer()) }, t._reportStall = function(e) { var t = this.hls, i = this.media; this.stallReported || (this.stallReported = !0, s.logger.warn("Playback stalling at @" + i .currentTime + " due to low buffer (buffer=" + e + ")"), t.trigger(a.Events.ERROR, { type: n.ErrorTypes.MEDIA_ERROR, details: n.ErrorDetails.BUFFER_STALLED_ERROR, fatal: !1, buffer: e })) }, t._trySkipBufferHole = function(e) { for (var t = this.config, i = this.hls, o = this.media, u = o.currentTime, c = 0, h = r .BufferHelper.getBuffered(o), f = 0; f < h.length; f++) { var p = h.start(f); if (u + t.maxBufferHole >= c && u < p) { var m = Math.max(p + d, o.currentTime + l); return s.logger.warn("skipping hole, adjusting currentTime from " + u + " to " + m), this .moved = !0, this.stalled = null, o.currentTime = m, e && i.trigger(a.Events.ERROR, { type: n.ErrorTypes.MEDIA_ERROR, details: n.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal: !1, reason: "fragment loaded with buffer holes, seeking from " + u + " to " + m, frag: e }), m } c = h.end(f) } return 0 }, t._tryNudgeBuffer = function() { var e = this.config, t = this.hls, i = this.media, r = this.nudgeRetry, o = i.currentTime; if (this.nudgeRetry++, r < e.nudgeMaxRetry) { var u = o + (r + 1) * e.nudgeOffset; s.logger.warn("Nudging 'currentTime' from " + o + " to " + u), i.currentTime = u, t.trigger(a .Events.ERROR, { type: n.ErrorTypes.MEDIA_ERROR, details: n.ErrorDetails.BUFFER_NUDGE_ON_STALL, fatal: !1 }) } else s.logger.error("Playhead still not moving while enough data buffered @" + o + " after " + e.nudgeMaxRetry + " nudges"), t.trigger(a.Events.ERROR, { type: n.ErrorTypes.MEDIA_ERROR, details: n.ErrorDetails.BUFFER_STALLED_ERROR, fatal: !0 }) }, e }() }, "./src/controller/id3-track-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/events.ts"), n = i("./src/utils/texttrack-utils.ts"), a = i("./src/demux/id3.ts"), s = function() { function e(e) { this.hls = void 0, this.id3Track = null, this.media = null, this.hls = e, this ._registerListeners() } var t = e.prototype; return t.destroy = function() { this._unregisterListeners() }, t._registerListeners = function() { var e = this.hls; e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.on(r.Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), e.on(r.Events.BUFFER_FLUSHING, this.onBufferFlushing, this) }, t._unregisterListeners = function() { var e = this.hls; e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.off(r.Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), e.off(r.Events.BUFFER_FLUSHING, this.onBufferFlushing, this) }, t.onMediaAttached = function(e, t) { this.media = t.media }, t.onMediaDetaching = function() { this.id3Track && (Object(n.clearCurrentCues)(this.id3Track), this.id3Track = null, this.media = null) }, t.getID3Track = function(e) { if (this.media) { for (var t = 0; t < e.length; t++) { var i = e[t]; if ("metadata" === i.kind && "id3" === i.label) return Object(n.sendAddTrackEvent)(i, this .media), i } return this.media.addTextTrack("metadata", "id3") } }, t.onFragParsingMetadata = function(e, t) { if (this.media) { var i = t.frag, r = t.samples; this.id3Track || (this.id3Track = this.getID3Track(this.media.textTracks), this.id3Track .mode = "hidden"); for (var n = self.WebKitDataCue || self.VTTCue || self.TextTrackCue, s = 0; s < r .length; s++) { var o = a.getID3Frames(r[s].data); if (o) { var u = r[s].pts, l = s < r.length - 1 ? r[s + 1].pts : i.end; l - u <= 0 && (l = u + .25); for (var d = 0; d < o.length; d++) { var c = o[d]; if (!a.isTimeStampFrame(c)) { var h = new n(u, l, ""); h.value = c, this.id3Track.addCue(h) } } } } } }, t.onBufferFlushing = function(e, t) { var i = t.startOffset, r = t.endOffset, a = t.type; if (!a || "audio" === a) { var s = this.id3Track; s && Object(n.removeCuesInRange)(s, i, r) } }, e }(); t.default = s }, "./src/controller/latency-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return o }); var r = i("./src/errors.ts"), n = i("./src/events.ts"), a = i("./src/utils/logger.ts"); function s(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var o = function() { function e(e) { var t = this; this.hls = void 0, this.config = void 0, this.media = null, this.levelDetails = null, this .currentTime = 0, this.stallCount = 0, this._latency = null, this.timeupdateHandler = function() { return t.timeupdate() }, this.hls = e, this.config = e.config, this.registerListeners() } var t, i, o, u = e.prototype; return u.destroy = function() { this.unregisterListeners(), this.onMediaDetaching(), this.levelDetails = null, this.hls = this .timeupdateHandler = null }, u.registerListeners = function() { this.hls.on(n.Events.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(n.Events .MEDIA_DETACHING, this.onMediaDetaching, this), this.hls.on(n.Events.MANIFEST_LOADING, this .onManifestLoading, this), this.hls.on(n.Events.LEVEL_UPDATED, this.onLevelUpdated, this), this.hls.on(n.Events.ERROR, this.onError, this) }, u.unregisterListeners = function() { this.hls.off(n.Events.MEDIA_ATTACHED, this.onMediaAttached), this.hls.off(n.Events .MEDIA_DETACHING, this.onMediaDetaching), this.hls.off(n.Events.MANIFEST_LOADING, this .onManifestLoading), this.hls.off(n.Events.LEVEL_UPDATED, this.onLevelUpdated), this.hls .off(n.Events.ERROR, this.onError) }, u.onMediaAttached = function(e, t) { this.media = t.media, this.media.addEventListener("timeupdate", this.timeupdateHandler) }, u.onMediaDetaching = function() { this.media && (this.media.removeEventListener("timeupdate", this.timeupdateHandler), this .media = null) }, u.onManifestLoading = function() { this.levelDetails = null, this._latency = null, this.stallCount = 0 }, u.onLevelUpdated = function(e, t) { var i = t.details; this.levelDetails = i, i.advanced && this.timeupdate(), !i.live && this.media && this.media .removeEventListener("timeupdate", this.timeupdateHandler) }, u.onError = function(e, t) { t.details === r.ErrorDetails.BUFFER_STALLED_ERROR && (this.stallCount++, a.logger.warn( "[playback-rate-controller]: Stall detected, adjusting target latency")) }, u.timeupdate = function() { var e = this.media, t = this.levelDetails; if (e && t) { this.currentTime = e.currentTime; var i = this.computeLatency(); if (null !== i) { this._latency = i; var r = this.config, n = r.lowLatencyMode, a = r.maxLiveSyncPlaybackRate; if (n && 1 !== a) { var s = this.targetLatency; if (null !== s) { var o = i - s, u = o < Math.min(this.maxLatency, s + t.targetduration); if (t.live && u && o > .05 && this.forwardBufferLength > 1) { var l = Math.min(2, Math.max(1, a)), d = Math.round(2 / (1 + Math.exp(-.75 * o - this.edgeStalled)) * 20) / 20; e.playbackRate = Math.min(l, Math.max(1, d)) } else 1 !== e.playbackRate && 0 !== e.playbackRate && (e.playbackRate = 1) } } } } }, u.estimateLiveEdge = function() { var e = this.levelDetails; return null === e ? null : e.edge + e.age }, u.computeLatency = function() { var e = this.estimateLiveEdge(); return null === e ? null : e - this.currentTime }, t = e, (i = [{ key: "latency", get: function() { return this._latency || 0 } }, { key: "maxLatency", get: function() { var e = this.config, t = this.levelDetails; return void 0 !== e.liveMaxLatencyDuration ? e.liveMaxLatencyDuration : t ? e .liveMaxLatencyDurationCount * t.targetduration : 0 } }, { key: "targetLatency", get: function() { var e = this.levelDetails; if (null === e) return null; var t = e.holdBack, i = e.partHoldBack, r = e.targetduration, n = this.config, a = n.liveSyncDuration, s = n.liveSyncDurationCount, o = n.lowLatencyMode, u = this.hls.userConfig, l = o && i || t; (u.liveSyncDuration || u.liveSyncDurationCount || 0 === l) && (l = void 0 !== a ? a : s * r); var d = r; return l + Math.min(1 * this.stallCount, d) } }, { key: "liveSyncPosition", get: function() { var e = this.estimateLiveEdge(), t = this.targetLatency, i = this.levelDetails; if (null === e || null === t || null === i) return null; var r = i.edge, n = e - t - this.edgeStalled, a = r - i.totalduration, s = r - (this.config.lowLatencyMode && i.partTarget || i.targetduration); return Math.min(Math.max(a, n), s) } }, { key: "drift", get: function() { var e = this.levelDetails; return null === e ? 1 : e.drift } }, { key: "edgeStalled", get: function() { var e = this.levelDetails; if (null === e) return 0; var t = 3 * (this.config.lowLatencyMode && e.partTarget || e.targetduration); return Math.max(e.age - t, 0) } }, { key: "forwardBufferLength", get: function() { var e = this.media, t = this.levelDetails; if (!e || !t) return 0; var i = e.buffered.length; return (i ? e.buffered.end(i - 1) : t.edge) - this.currentTime } }]) && s(t.prototype, i), o && s(t, o), Object.defineProperty(t, "prototype", { writable: !1 }), e }() }, "./src/controller/level-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return p }); var r = i("./src/types/level.ts"), n = i("./src/events.ts"), a = i("./src/errors.ts"), s = i("./src/utils/codecs.ts"), o = i("./src/controller/level-helper.ts"), u = i("./src/controller/base-playlist-controller.ts"), l = i("./src/types/loader.ts"); function d() { return (d = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }).apply(this, arguments) } function c(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function h(e, t) { return (h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var f = /chrome|firefox/.test(navigator.userAgent.toLowerCase()), p = function(e) { var t, i; function u(t) { var i; return (i = e.call(this, t, "[level-controller]") || this)._levels = [], i._firstLevel = -1, i ._startLevel = void 0, i.currentLevelIndex = -1, i.manualLevelIndex = -1, i.onParsedComplete = void 0, i._registerListeners(), i } i = e, (t = u).prototype = Object.create(i.prototype), t.prototype.constructor = t, h(t, i); var p, m, g, v = u.prototype; return v._registerListeners = function() { var e = this.hls; e.on(n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.on(n.Events.LEVEL_LOADED, this .onLevelLoaded, this), e.on(n.Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), e.on(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.on(n.Events.ERROR, this.onError, this) }, v._unregisterListeners = function() { var e = this.hls; e.off(n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.off(n.Events.LEVEL_LOADED, this .onLevelLoaded, this), e.off(n.Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), e.off(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.off(n.Events.ERROR, this .onError, this) }, v.destroy = function() { this._unregisterListeners(), this.manualLevelIndex = -1, this._levels.length = 0, e.prototype .destroy.call(this) }, v.startLoad = function() { this._levels.forEach(function(e) { e.loadError = 0 }), e.prototype.startLoad.call(this) }, v.onManifestLoaded = function(e, t) { var i, u, l = [], d = [], c = [], h = {}, p = !1, m = !1, g = !1; if (t.levels.forEach(function(e) { var t = e.attrs; p = p || !(!e.width || !e.height), m = m || !!e.videoCodec, g = g || !!e.audioCodec, f && e.audioCodec && -1 !== e.audioCodec.indexOf("mp4a.40.34") && (e.audioCodec = void 0); var i = e.bitrate + "-" + e.attrs.RESOLUTION + "-" + e.attrs.CODECS; (u = h[i]) ? u.url.push(e.url): (u = new r.Level(e), h[i] = u, l.push(u)), t && (t .AUDIO && Object(o.addGroupId)(u, "audio", t.AUDIO), t.SUBTITLES && Object(o .addGroupId)(u, "text", t.SUBTITLES)) }), (p || m) && g && (l = l.filter(function(e) { var t = e.videoCodec, i = e.width, r = e.height; return !!t || !(!i || !r) })), l = l.filter(function(e) { var t = e.audioCodec, i = e.videoCodec; return (!t || Object(s.isCodecSupportedInMp4)(t, "audio")) && (!i || Object(s .isCodecSupportedInMp4)(i, "video")) }), t.audioTracks && (d = t.audioTracks.filter(function(e) { return !e.audioCodec || Object(s.isCodecSupportedInMp4)(e.audioCodec, "audio") }), Object(o.assignTrackIdsByGroup)(d)), t.subtitles && (c = t.subtitles, Object(o .assignTrackIdsByGroup)(c)), l.length > 0) { i = l[0].bitrate, l.sort(function(e, t) { return e.bitrate - t.bitrate }), this._levels = l; for (var v = 0; v < l.length; v++) if (l[v].bitrate === i) { this._firstLevel = v, this.log("manifest loaded, " + l.length + " level(s) found, first bitrate: " + i); break } var y = g && !m, _ = { levels: l, audioTracks: d, subtitleTracks: c, firstLevel: this._firstLevel, stats: t.stats, audio: g, video: m, altAudio: !y && d.some(function(e) { return !!e.url }) }; this.hls.trigger(n.Events.MANIFEST_PARSED, _), (this.hls.config.autoStartLoad || this.hls .forceStartLoad) && this.hls.startLoad(this.hls.config.startPosition) } else this.hls.trigger(n.Events.ERROR, { type: a.ErrorTypes.MEDIA_ERROR, details: a.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal: !0, url: t.url, reason: "no level with compatible codecs found in manifest" }) }, v.onError = function(t, i) { if (e.prototype.onError.call(this, t, i), !i.fatal) { var r = i.context, n = this._levels[this.currentLevelIndex]; if (r && (r.type === l.PlaylistContextType.AUDIO_TRACK && n.audioGroupIds && r.groupId === n .audioGroupIds[n.urlId] || r.type === l.PlaylistContextType.SUBTITLE_TRACK && n .textGroupIds && r.groupId === n.textGroupIds[n.urlId])) this.redundantFailover(this .currentLevelIndex); else { var s, o = !1, u = !0; switch (i.details) { case a.ErrorDetails.FRAG_LOAD_ERROR: case a.ErrorDetails.FRAG_LOAD_TIMEOUT: case a.ErrorDetails.KEY_LOAD_ERROR: case a.ErrorDetails.KEY_LOAD_TIMEOUT: if (i.frag) { var d = this._levels[i.frag.level]; d ? (d.fragmentError++, d.fragmentError > this.hls.config.fragLoadingMaxRetry && (s = i.frag.level)) : s = i.frag.level } break; case a.ErrorDetails.LEVEL_LOAD_ERROR: case a.ErrorDetails.LEVEL_LOAD_TIMEOUT: r && (r.deliveryDirectives && (u = !1), s = r.level), o = !0; break; case a.ErrorDetails.REMUX_ALLOC_ERROR: s = i.level, o = !0 } void 0 !== s && this.recoverLevel(i, s, o, u) } } }, v.recoverLevel = function(e, t, i, r) { var n = e.details, a = this._levels[t]; if (a.loadError++, i) { if (!this.retryLoadingOrFail(e)) return void(this.currentLevelIndex = -1); e.levelRetry = !0 } if (r) { var s = a.url.length; if (s > 1 && a.loadError < s) e.levelRetry = !0, this.redundantFailover(t); else if (-1 === this.manualLevelIndex) { var o = 0 === t ? this._levels.length - 1 : t - 1; this.currentLevelIndex !== o && 0 === this._levels[o].loadError && (this.warn(n + ": switch to " + o), e.levelRetry = !0, this.hls.nextAutoLevel = o) } } }, v.redundantFailover = function(e) { var t = this._levels[e], i = t.url.length; if (i > 1) { var r = (t.urlId + 1) % i; this.warn("Switching to redundant URL-id " + r), this._levels.forEach(function(e) { e.urlId = r }), this.level = e } }, v.onFragLoaded = function(e, t) { var i = t.frag; if (void 0 !== i && i.type === l.PlaylistLevelType.MAIN) { var r = this._levels[i.level]; void 0 !== r && (r.fragmentError = 0, r.loadError = 0) } }, v.onLevelLoaded = function(e, t) { var i, r, n = t.level, a = t.details, s = this._levels[n]; if (!s) return this.warn("Invalid level index " + n), void(null !== (r = t .deliveryDirectives) && void 0 !== r && r.skip && (a.deltaUpdateFailed = !0)); n === this.currentLevelIndex ? (0 === s.fragmentError && (s.loadError = 0, this.retryCount = 0), this.playlistLoaded(n, t, s.details)) : null !== (i = t.deliveryDirectives) && void 0 !== i && i.skip && (a.deltaUpdateFailed = !0) }, v.onAudioTrackSwitched = function(e, t) { var i = this.hls.levels[this.currentLevelIndex]; if (i && i.audioGroupIds) { for (var r = -1, n = this.hls.audioTracks[t.id].groupId, a = 0; a < i.audioGroupIds .length; a++) if (i.audioGroupIds[a] === n) { r = a; break } r !== i.urlId && (i.urlId = r, this.startLoad()) } }, v.loadPlaylist = function(e) { var t = this.currentLevelIndex, i = this._levels[t]; if (this.canLoad && i && i.url.length > 0) { var r = i.urlId, a = i.url[r]; if (e) try { a = e.addDirectives(a) } catch (e) { this.warn("Could not construct new URL with HLS Delivery Directives: " + e) } this.log("Attempt loading level index " + t + (e ? " at sn " + e.msn + " part " + e.part : "") + " with URL-id " + r + " " + a), this.clearTimer(), this.hls.trigger(n.Events .LEVEL_LOADING, { url: a, level: t, id: r, deliveryDirectives: e || null }) } }, v.removeLevel = function(e, t) { var i = function(e, i) { return i !== t }, r = this._levels.filter(function(r, n) { return n !== e || r.url.length > 1 && void 0 !== t && (r.url = r.url.filter(i), r .audioGroupIds && (r.audioGroupIds = r.audioGroupIds.filter(i)), r.textGroupIds && (r .textGroupIds = r.textGroupIds.filter(i)), r.urlId = 0, !0) }).map(function(e, t) { var i = e.details; return null !== i && void 0 !== i && i.fragments && i.fragments.forEach(function(e) { e.level = t }), e }); this._levels = r, this.hls.trigger(n.Events.LEVELS_UPDATED, { levels: r }) }, p = u, (m = [{ key: "levels", get: function() { return 0 === this._levels.length ? null : this._levels } }, { key: "level", get: function() { return this.currentLevelIndex }, set: function(e) { var t, i = this._levels; if (0 !== i.length && (this.currentLevelIndex !== e || null === (t = i[e]) || void 0 === t || !t.details)) { if (e < 0 || e >= i.length) { var r = e < 0; if (this.hls.trigger(n.Events.ERROR, { type: a.ErrorTypes.OTHER_ERROR, details: a.ErrorDetails.LEVEL_SWITCH_ERROR, level: e, fatal: r, reason: "invalid level idx" }), r) return; e = Math.min(e, i.length - 1) } this.clearTimer(); var s = this.currentLevelIndex, o = i[s], u = i[e]; this.log("switching to level " + e + " from " + s), this.currentLevelIndex = e; var l = d({}, u, { level: e, maxBitrate: u.maxBitrate, uri: u.uri, urlId: u.urlId }); delete l._urlId, this.hls.trigger(n.Events.LEVEL_SWITCHING, l); var c = u.details; if (!c || c.live) { var h = this.switchParams(u.uri, null === o || void 0 === o ? void 0 : o.details); this.loadPlaylist(h) } } } }, { key: "manualLevel", get: function() { return this.manualLevelIndex }, set: function(e) { this.manualLevelIndex = e, void 0 === this._startLevel && (this._startLevel = e), -1 !== e && (this.level = e) } }, { key: "firstLevel", get: function() { return this._firstLevel }, set: function(e) { this._firstLevel = e } }, { key: "startLevel", get: function() { if (void 0 === this._startLevel) { var e = this.hls.config.startLevel; return void 0 !== e ? e : this._firstLevel } return this._startLevel }, set: function(e) { this._startLevel = e } }, { key: "nextLoadLevel", get: function() { return -1 !== this.manualLevelIndex ? this.manualLevelIndex : this.hls.nextAutoLevel }, set: function(e) { this.level = e, -1 === this.manualLevelIndex && (this.hls.nextAutoLevel = e) } }]) && c(p.prototype, m), g && c(p, g), Object.defineProperty(p, "prototype", { writable: !1 }), u }(u.default) }, "./src/controller/level-helper.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "addGroupId", function() { return a }), i.d(t, "assignTrackIdsByGroup", function() { return s }), i.d(t, "updatePTS", function() { return o }), i.d(t, "updateFragPTSDTS", function() { return l }), i.d(t, "mergeDetails", function() { return d }), i.d(t, "mapPartIntersection", function() { return c }), i.d(t, "mapFragmentIntersection", function() { return h }), i.d(t, "adjustSliding", function() { return f }), i.d(t, "addSliding", function() { return p }), i.d(t, "computeReloadInterval", function() { return m }), i.d(t, "getFragmentWithSN", function() { return g }), i.d(t, "getPartWith", function() { return v }); var r = i("./src/polyfills/number.ts"), n = i("./src/utils/logger.ts"); function a(e, t, i) { switch (t) { case "audio": e.audioGroupIds || (e.audioGroupIds = []), e.audioGroupIds.push(i); break; case "text": e.textGroupIds || (e.textGroupIds = []), e.textGroupIds.push(i) } } function s(e) { var t = {}; e.forEach(function(e) { var i = e.groupId || ""; e.id = t[i] = t[i] || 0, t[i]++ }) } function o(e, t, i) { u(e[t], e[i]) } function u(e, t) { var i = t.startPTS; if (Object(r.isFiniteNumber)(i)) { var n, a = 0; t.sn > e.sn ? (a = i - e.start, n = e) : (a = e.start - i, n = t), n.duration !== a && (n.duration = a) } else if (t.sn > e.sn) { e.cc === t.cc && e.minEndPTS ? t.start = e.start + (e.minEndPTS - e.start) : t.start = e.start + e .duration } else t.start = Math.max(e.start - t.duration, 0) } function l(e, t, i, a, s, o) { a - i <= 0 && (n.logger.warn("Fragment should have a positive duration", t), a = i + t.duration, o = s + t.duration); var l = i, d = a, c = t.startPTS, h = t.endPTS; if (Object(r.isFiniteNumber)(c)) { var f = Math.abs(c - i); Object(r.isFiniteNumber)(t.deltaPTS) ? t.deltaPTS = Math.max(f, t.deltaPTS) : t.deltaPTS = f, l = Math.max(i, c), i = Math.min(i, c), s = Math.min(s, t.startDTS), d = Math.min(a, h), a = Math.max( a, h), o = Math.max(o, t.endDTS) } t.duration = a - i; var p = i - t.start; t.appendedPTS = a, t.start = t.startPTS = i, t.maxStartPTS = l, t.startDTS = s, t.endPTS = a, t .minEndPTS = d, t.endDTS = o; var m, g = t.sn; if (!e || g < e.startSN || g > e.endSN) return 0; var v = g - e.startSN, y = e.fragments; for (y[v] = t, m = v; m > 0; m--) u(y[m], y[m - 1]); for (m = v; m < y.length - 1; m++) u(y[m], y[m + 1]); return e.fragmentHint && u(y[y.length - 1], e.fragmentHint), e.PTSKnown = e.alignedSliding = !0, p } function d(e, t) { for (var i = null, a = e.fragments, s = a.length - 1; s >= 0; s--) { var o = a[s].initSegment; if (o) { i = o; break } } e.fragmentHint && delete e.fragmentHint.endPTS; var u, d = 0; (h(e, t, function(e, n) { e.relurl && (d = e.cc - n.cc), Object(r.isFiniteNumber)(e.startPTS) && Object(r.isFiniteNumber)( e.endPTS) && (n.start = n.startPTS = e.startPTS, n.startDTS = e.startDTS, n.appendedPTS = e .appendedPTS, n.maxStartPTS = e.maxStartPTS, n.endPTS = e.endPTS, n.endDTS = e.endDTS, n .minEndPTS = e.minEndPTS, n.duration = e.endPTS - e.startPTS, n.duration && (u = n), t .PTSKnown = t.alignedSliding = !0), n.elementaryStreams = e.elementaryStreams, n.loader = e .loader, n.stats = e.stats, n.urlId = e.urlId, e.initSegment && (n.initSegment = e .initSegment, i = e.initSegment) }), i) && (t.fragmentHint ? t.fragments.concat(t.fragmentHint) : t.fragments).forEach(function(e) { var t; e.initSegment && e.initSegment.relurl !== (null === (t = i) || void 0 === t ? void 0 : t .relurl) || (e.initSegment = i) }); if (t.skippedSegments && (t.deltaUpdateFailed = t.fragments.some(function(e) { return !e }), t.deltaUpdateFailed)) { n.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist"); for (var p = t.skippedSegments; p--;) t.fragments.shift(); t.startSN = t.fragments[0].sn, t.startCC = t.fragments[0].cc } var m = t.fragments; if (d) { n.logger.warn("discontinuity sliding from playlist, take drift into account"); for (var g = 0; g < m.length; g++) m[g].cc += d } t.skippedSegments && (t.startCC = t.fragments[0].cc), c(e.partList, t.partList, function(e, t) { t.elementaryStreams = e.elementaryStreams, t.stats = e.stats }), u ? l(t, u, u.startPTS, u.endPTS, u.startDTS, u.endDTS) : f(e, t), m.length && (t .totalduration = t.edge - m[0].start), t.driftStartTime = e.driftStartTime, t.driftStart = e .driftStart; var v = t.advancedDateTime; if (t.advanced && v) { var y = t.edge; t.driftStart || (t.driftStartTime = v, t.driftStart = y), t.driftEndTime = v, t.driftEnd = y } else t.driftEndTime = e.driftEndTime, t.driftEnd = e.driftEnd, t.advancedDateTime = e .advancedDateTime } function c(e, t, i) { if (e && t) for (var r = 0, n = 0, a = e.length; n <= a; n++) { var s = e[n], o = t[n + r]; s && o && s.index === o.index && s.fragment.sn === o.fragment.sn ? i(s, o) : r-- } } function h(e, t, i) { for (var r = t.skippedSegments, n = Math.max(e.startSN, t.startSN) - t.startSN, a = (e.fragmentHint ? 1 : 0) + (r ? t.endSN : Math.min(e.endSN, t.endSN)) - t.startSN, s = t.startSN - e.startSN, o = t.fragmentHint ? t.fragments.concat(t.fragmentHint) : t.fragments, u = e.fragmentHint ? e .fragments.concat(e.fragmentHint) : e.fragments, l = n; l <= a; l++) { var d = u[s + l], c = o[l]; r && !c && l < r && (c = t.fragments[l] = d), d && c && i(d, c) } } function f(e, t) { var i = t.startSN + t.skippedSegments - e.startSN, r = e.fragments; i < 0 || i >= r.length || p(t, r[i].start) } function p(e, t) { if (t) { for (var i = e.fragments, r = e.skippedSegments; r < i.length; r++) i[r].start += t; e.fragmentHint && (e.fragmentHint.start += t) } } function m(e, t) { var i, r = 1e3 * e.levelTargetDuration, n = r / 2, a = e.age, s = a > 0 && a < 3 * r, o = t.loading.end - t.loading.start, u = e.availabilityDelay; if (!1 === e.updated) if (s) { var l = 333 * e.misses; i = Math.max(Math.min(n, 2 * o), l), e.availabilityDelay = (e.availabilityDelay || 0) + i } else i = n; else s ? (u = Math.min(u || r / 2, a), e.availabilityDelay = u, i = u + r - a) : i = r - o; return Math.round(i) } function g(e, t, i) { if (!e || !e.details) return null; var r = e.details, n = r.fragments[t - r.startSN]; return n || ((n = r.fragmentHint) && n.sn === t ? n : t < r.startSN && i && i.sn === t ? i : null) } function v(e, t, i) { if (!e || !e.details) return null; var r = e.details.partList; if (r) for (var n = r.length; n--;) { var a = r[n]; if (a.index === i && a.fragment.sn === t) return a } return null } }, "./src/controller/stream-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return y }); var r = i("./src/polyfills/number.ts"), n = i("./src/controller/base-stream-controller.ts"), a = i("./src/is-supported.ts"), s = i("./src/events.ts"), o = i("./src/utils/buffer-helper.ts"), u = i("./src/controller/fragment-tracker.ts"), l = i("./src/types/loader.ts"), d = i("./src/loader/fragment.ts"), c = i("./src/demux/transmuxer-interface.ts"), h = i("./src/types/transmuxer.ts"), f = i("./src/controller/gap-controller.ts"), p = i("./src/errors.ts"), m = i("./src/utils/logger.ts"); function g(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function v(e, t) { return (v = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var y = function(e) { var t, i; function y(t, i) { var r; return (r = e.call(this, t, i, "[stream-controller]") || this).audioCodecSwap = !1, r .gapController = null, r.level = -1, r._forceStartLoad = !1, r.altAudio = !1, r.audioOnly = !1, r.fragPlaying = null, r.onvplaying = null, r.onvseeked = null, r.fragLastKbps = 0, r.stalled = ! 1, r.couldBacktrack = !1, r.audioCodecSwitch = !1, r.videoBuffer = null, r._registerListeners(), r } i = e, (t = y).prototype = Object.create(i.prototype), t.prototype.constructor = t, v(t, i); var _, b, w, E = y.prototype; return E._registerListeners = function() { var e = this.hls; e.on(s.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(s.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.on(s.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .on(s.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.on(s.Events.LEVEL_LOADING, this .onLevelLoading, this), e.on(s.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.on(s.Events .FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this), e.on(s.Events.ERROR, this.onError, this), e.on(s.Events.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), e.on(s.Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), e.on(s.Events .BUFFER_CREATED, this.onBufferCreated, this), e.on(s.Events.BUFFER_FLUSHED, this .onBufferFlushed, this), e.on(s.Events.LEVELS_UPDATED, this.onLevelsUpdated, this), e.on(s .Events.FRAG_BUFFERED, this.onFragBuffered, this) }, E._unregisterListeners = function() { var e = this.hls; e.off(s.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(s.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.off(s.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .off(s.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.off(s.Events.LEVEL_LOADED, this .onLevelLoaded, this), e.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED, this .onFragLoadEmergencyAborted, this), e.off(s.Events.ERROR, this.onError, this), e.off(s .Events.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), e.off(s.Events .AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), e.off(s.Events.BUFFER_CREATED, this .onBufferCreated, this), e.off(s.Events.BUFFER_FLUSHED, this.onBufferFlushed, this), e.off(s .Events.LEVELS_UPDATED, this.onLevelsUpdated, this), e.off(s.Events.FRAG_BUFFERED, this .onFragBuffered, this) }, E.onHandlerDestroying = function() { this._unregisterListeners(), this.onMediaDetaching() }, E.startLoad = function(e) { if (this.levels) { var t = this.lastCurrentTime, i = this.hls; if (this.stopLoad(), this.setInterval(100), this.level = -1, this.fragLoadError = 0, !this .startFragRequested) { var r = i.startLevel; - 1 === r && (i.config.testBandwidth ? (r = 0, this.bitrateTest = ! 0) : r = i.nextAutoLevel), this.level = i.nextLoadLevel = r, this.loadedmetadata = !1 } t > 0 && -1 === e && (this.log("Override startPosition with lastCurrentTime @" + t.toFixed( 3)), e = t), this.state = n.State.IDLE, this.nextLoadPosition = this.startPosition = this .lastCurrentTime = e, this.tick() } else this._forceStartLoad = !0, this.state = n.State.STOPPED }, E.stopLoad = function() { this._forceStartLoad = !1, e.prototype.stopLoad.call(this) }, E.doTick = function() { switch (this.state) { case n.State.IDLE: this.doTickIdle(); break; case n.State.WAITING_LEVEL: var e, t = this.levels, i = this.level, r = null === t || void 0 === t ? void 0 : null === (e = t[i]) || void 0 === e ? void 0 : e .details; if (r && (!r.live || this.levelLastLoaded === this.level)) { if (this.waitForCdnTuneIn(r)) break; this.state = n.State.IDLE; break } break; case n.State.FRAG_LOADING_WAITING_RETRY: var a, s = self.performance.now(), o = this.retryDate; (!o || s >= o || null !== (a = this.media) && void 0 !== a && a.seeking) && (this.log( "retryDate reached, switch back to IDLE state"), this.state = n.State.IDLE) } this.onTickEnd() }, E.onTickEnd = function() { e.prototype.onTickEnd.call(this), this.checkBuffer(), this.checkFragmentChanged() }, E.doTickIdle = function() { var e, t, i = this.hls, r = this.levelLastLoaded, a = this.levels, o = this.media, c = i.config, h = i.nextLoadLevel; if (null !== r && (o || !this.startFragRequested && c.startFragPrefetch) && (!this.altAudio || ! this.audioOnly) && a && a[h]) { var f = a[h]; this.level = i.nextLoadLevel = h; var p = f.details; if (!p || this.state === n.State.WAITING_LEVEL || p.live && this.levelLastLoaded !== h) this .state = n.State.WAITING_LEVEL; else { var m = this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : o, l.PlaylistLevelType .MAIN); if (null !== m) if (!(m.len >= this.getMaxBufferLength(f.maxBitrate))) { if (this._streamEnded(m, p)) { var g = {}; return this.altAudio && (g.type = "video"), this.hls.trigger(s.Events.BUFFER_EOS, g), void(this.state = n.State.ENDED) } var v = m.end, y = this.getNextFragment(v, p); if (this.couldBacktrack && !this.fragPrevious && y && "initSegment" !== y.sn) { var _ = y.sn - p.startSN; _ > 1 && (y = p.fragments[_ - 1], this.fragmentTracker.removeFragment(y)) } if (y && this.fragmentTracker.getState(y) === u.FragmentState.OK && this .nextLoadPosition > v) { var b = this.audioOnly && !this.altAudio ? d.ElementaryStreamTypes.AUDIO : d .ElementaryStreamTypes.VIDEO; this.afterBufferFlushed(o, b, l.PlaylistLevelType.MAIN), y = this.getNextFragment(this .nextLoadPosition, p) } y && (!y.initSegment || y.initSegment.data || this.bitrateTest || (y = y.initSegment), "identity" !== (null === (e = y.decryptdata) || void 0 === e ? void 0 : e .keyFormat) || null !== (t = y.decryptdata) && void 0 !== t && t.key ? this .loadFragment(y, p, v) : this.loadKey(y, p)) } } } }, E.loadFragment = function(t, i, r) { var n, a = this.fragmentTracker.getState(t); if (this.fragCurrent = t, a === u.FragmentState.BACKTRACKED) { var s = this.fragmentTracker.getBacktrackData(t); if (s) return this._handleFragmentLoadProgress(s), void this._handleFragmentLoadComplete(s); a = u.FragmentState.NOT_LOADED } a === u.FragmentState.NOT_LOADED || a === u.FragmentState.PARTIAL ? "initSegment" === t.sn ? this._loadInitSegment(t) : this.bitrateTest ? (t.bitrateTest = !0, this.log("Fragment " + t .sn + " of level " + t.level + " is being downloaded to test bitrate and will not be buffered"), this ._loadBitrateTestFrag(t)) : (this.startFragRequested = !0, e.prototype.loadFragment.call( this, t, i, r)) : a === u.FragmentState.APPENDING ? this.reduceMaxBufferLength(t .duration) && this.fragmentTracker.removeFragment(t) : 0 === (null === (n = this.media) || void 0 === n ? void 0 : n.buffered.length) && this.fragmentTracker.removeAllFragments() }, E.getAppendedFrag = function(e) { var t = this.fragmentTracker.getAppendedFrag(e, l.PlaylistLevelType.MAIN); return t && "fragment" in t ? t.fragment : t }, E.getBufferedFrag = function(e) { return this.fragmentTracker.getBufferedFrag(e, l.PlaylistLevelType.MAIN) }, E.followingBufferedFrag = function(e) { return e ? this.getBufferedFrag(e.end + .5) : null }, E.immediateLevelSwitch = function() { this.abortCurrentFrag(), this.flushMainBuffer(0, Number.POSITIVE_INFINITY) }, E.nextLevelSwitch = function() { var e = this.levels, t = this.media; if (null !== t && void 0 !== t && t.readyState) { var i, r = this.getAppendedFrag(t.currentTime); if (r && r.start > 1 && this.flushMainBuffer(0, r.start - 1), !t.paused && e) { var n = e[this.hls.nextLoadLevel], a = this.fragLastKbps; i = a && this.fragCurrent ? this.fragCurrent.duration * n.maxBitrate / (1e3 * a) + 1 : 0 } else i = 0; var s = this.getBufferedFrag(t.currentTime + i); if (s) { var o = this.followingBufferedFrag(s); if (o) { this.abortCurrentFrag(); var u = o.maxStartPTS ? o.maxStartPTS : o.start, l = o.duration, d = Math.max(s.end, u + Math.min(Math.max(l - this.config.maxFragLookUpTolerance, .5 * l), .75 * l)); this.flushMainBuffer(d, Number.POSITIVE_INFINITY) } } } }, E.abortCurrentFrag = function() { var e = this.fragCurrent; switch (this.fragCurrent = null, null !== e && void 0 !== e && e.loader && e.loader.abort(), this.state) { case n.State.KEY_LOADING: case n.State.FRAG_LOADING: case n.State.FRAG_LOADING_WAITING_RETRY: case n.State.PARSING: case n.State.PARSED: case n.State.BACKTRACKING: this.state = n.State.IDLE } this.nextLoadPosition = this.getLoadPosition() }, E.flushMainBuffer = function(t, i) { e.prototype.flushMainBuffer.call(this, t, i, this.altAudio ? "video" : null) }, E.onMediaAttached = function(t, i) { e.prototype.onMediaAttached.call(this, t, i); var r = i.media; this.onvplaying = this.onMediaPlaying.bind(this), this.onvseeked = this.onMediaSeeked.bind( this), r.addEventListener("playing", this.onvplaying), r.addEventListener("seeked", this .onvseeked), this.gapController = new f.default(this.config, r, this.fragmentTracker, this .hls) }, E.onMediaDetaching = function() { var t = this.media; t && (t.removeEventListener("playing", this.onvplaying), t.removeEventListener("seeked", this .onvseeked), this.onvplaying = this.onvseeked = null, this.videoBuffer = null), this .fragPlaying = null, this.gapController && (this.gapController.destroy(), this.gapController = null), e.prototype.onMediaDetaching.call(this) }, E.onMediaPlaying = function() { this.tick() }, E.onMediaSeeked = function() { var e = this.media, t = e ? e.currentTime : null; Object(r.isFiniteNumber)(t) && this.log("Media seeked to " + t.toFixed(3)), this.tick() }, E.onManifestLoading = function() { this.log("Trigger BUFFER_RESET"), this.hls.trigger(s.Events.BUFFER_RESET, void 0), this .fragmentTracker.removeAllFragments(), this.couldBacktrack = this.stalled = !1, this .startPosition = this.lastCurrentTime = 0, this.fragPlaying = null }, E.onManifestParsed = function(e, t) { var i, r = !1, n = !1; t.levels.forEach(function(e) { (i = e.audioCodec) && (-1 !== i.indexOf("mp4a.40.2") && (r = !0), -1 !== i.indexOf( "mp4a.40.5") && (n = !0)) }), this.audioCodecSwitch = r && n && !Object(a.changeTypeSupported)(), this .audioCodecSwitch && this.log( "Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"), this.levels = t .levels, this.startFragRequested = !1 }, E.onLevelLoading = function(e, t) { var i = this.levels; if (i && this.state === n.State.IDLE) { var r = i[t.level]; (!r.details || r.details.live && this.levelLastLoaded !== t.level || this.waitForCdnTuneIn(r .details)) && (this.state = n.State.WAITING_LEVEL) } }, E.onLevelLoaded = function(e, t) { var i, r = this.levels, a = t.level, o = t.details, u = o.totalduration; if (r) { this.log("Level " + a + " loaded [" + o.startSN + "," + o.endSN + "], cc [" + o.startCC + ", " + o.endCC + "] duration:" + u); var l = this.fragCurrent; !l || this.state !== n.State.FRAG_LOADING && this.state !== n.State .FRAG_LOADING_WAITING_RETRY || l.level !== t.level && l.loader && (this.state = n.State .IDLE, l.loader.abort()); var d = r[a], c = 0; if (o.live || null !== (i = d.details) && void 0 !== i && i.live) { if (o.fragments[0] || (o.deltaUpdateFailed = !0), o.deltaUpdateFailed) return; c = this.alignPlaylists(o, d.details) } if (d.details = o, this.levelLastLoaded = a, this.hls.trigger(s.Events.LEVEL_UPDATED, { details: o, level: a }), this.state === n.State.WAITING_LEVEL) { if (this.waitForCdnTuneIn(o)) return; this.state = n.State.IDLE } this.startFragRequested ? o.live && this.synchronizeToLiveEdge(o) : this.setStartPosition(o, c), this.tick() } else this.warn("Levels were reset while loading level " + a) }, E._handleFragmentLoadProgress = function(e) { var t, i = e.frag, r = e.part, n = e.payload, a = this.levels; if (a) { var s = a[i.level], o = s.details; if (o) { var u = s.videoCodec, d = o.PTSKnown || !o.live, f = null === (t = i.initSegment) || void 0 === t ? void 0 : t.data, p = this._getAudioCodec(s), m = this.transmuxer = this.transmuxer || new c.default(this.hls, l.PlaylistLevelType.MAIN, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this)), g = r ? r.index : -1, v = -1 !== g, y = new h.ChunkMetadata(i.level, i.sn, i.stats.chunkCount, n.byteLength, g, v), _ = this.initPTS[i.cc]; m.push(n, f, p, u, i, r, o.totalduration, d, y, _) } else this.warn("Dropping fragment " + i.sn + " of level " + i.level + " after level details were reset") } else this.warn("Levels were reset while fragment load was in progress. Fragment " + i.sn + " of level " + i.level + " will not be buffered") }, E.onAudioTrackSwitching = function(e, t) { var i = this.altAudio, r = !!t.url, n = t.id; if (!r) { if (this.mediaBuffer !== this.media) { this.log("Switching on main audio, use media.buffered to schedule main fragment loading"), this.mediaBuffer = this.media; var a = this.fragCurrent; null !== a && void 0 !== a && a.loader && (this.log( "Switching to main audio track, cancel main fragment load"), a.loader.abort()), this .resetTransmuxer(), this.resetLoadingState() } else this.audioOnly && this.resetTransmuxer(); var o = this.hls; i && o.trigger(s.Events.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: "audio" }), o.trigger(s.Events.AUDIO_TRACK_SWITCHED, { id: n }) } }, E.onAudioTrackSwitched = function(e, t) { var i = t.id, r = !!this.hls.audioTracks[i].url; if (r) { var n = this.videoBuffer; n && this.mediaBuffer !== n && (this.log( "Switching on alternate audio, use video.buffered to schedule main fragment loading"), this.mediaBuffer = n) } this.altAudio = r, this.tick() }, E.onBufferCreated = function(e, t) { var i, r, n = t.tracks, a = !1; for (var s in n) { var o = n[s]; if ("main" === o.id) { if (r = s, i = o, "video" === s) { var u = n[s]; u && (this.videoBuffer = u.buffer) } } else a = !0 } a && i ? (this.log("Alternate track found, use " + r + ".buffered to schedule main fragment loading"), this.mediaBuffer = i.buffer) : this .mediaBuffer = this.media }, E.onFragBuffered = function(e, t) { var i = t.frag, r = t.part; if (!i || i.type === l.PlaylistLevelType.MAIN) { if (this.fragContextChanged(i)) return this.warn("Fragment " + i.sn + (r ? " p: " + r.index : "") + " of level " + i.level + " finished buffering, but was aborted. state: " + this .state), void(this.state === n.State.PARSED && (this.state = n.State.IDLE)); var a = r ? r.stats : i.stats; this.fragLastKbps = Math.round(8 * a.total / (a.buffering.end - a.loading.first)), "initSegment" !== i.sn && (this.fragPrevious = i), this.fragBufferedComplete(i, r) } }, E.onError = function(e, t) { switch (t.details) { case p.ErrorDetails.FRAG_LOAD_ERROR: case p.ErrorDetails.FRAG_LOAD_TIMEOUT: case p.ErrorDetails.KEY_LOAD_ERROR: case p.ErrorDetails.KEY_LOAD_TIMEOUT: this.onFragmentOrKeyLoadError(l.PlaylistLevelType.MAIN, t); break; case p.ErrorDetails.LEVEL_LOAD_ERROR: case p.ErrorDetails.LEVEL_LOAD_TIMEOUT: this.state !== n.State.ERROR && (t.fatal ? (this.warn("" + t.details), this.state = n.State .ERROR) : t.levelRetry || this.state !== n.State.WAITING_LEVEL || (this.state = n .State.IDLE)); break; case p.ErrorDetails.BUFFER_FULL_ERROR: if ("main" === t.parent && (this.state === n.State.PARSING || this.state === n.State .PARSED)) { var i = !0, r = this.getFwdBufferInfo(this.media, l.PlaylistLevelType.MAIN); r && r.len > .5 && (i = !this.reduceMaxBufferLength(r.len)), i && (this.warn( "buffer full error also media.currentTime is not buffered, flush main"), this .immediateLevelSwitch()), this.resetLoadingState() } } }, E.checkBuffer = function() { var e = this.media, t = this.gapController; if (e && t && e.readyState) { var i = o.BufferHelper.getBuffered(e); !this.loadedmetadata && i.length ? (this.loadedmetadata = !0, this.seekToStartPos()) : t.poll( this.lastCurrentTime), this.lastCurrentTime = e.currentTime } }, E.onFragLoadEmergencyAborted = function() { this.state = n.State.IDLE, this.loadedmetadata || (this.startFragRequested = !1, this .nextLoadPosition = this.startPosition), this.tickImmediate() }, E.onBufferFlushed = function(e, t) { var i = t.type; if (i !== d.ElementaryStreamTypes.AUDIO || this.audioOnly && !this.altAudio) { var r = (i === d.ElementaryStreamTypes.VIDEO ? this.videoBuffer : this.mediaBuffer) || this .media; this.afterBufferFlushed(r, i, l.PlaylistLevelType.MAIN) } }, E.onLevelsUpdated = function(e, t) { this.levels = t.levels }, E.swapAudioCodec = function() { this.audioCodecSwap = !this.audioCodecSwap }, E.seekToStartPos = function() { var e = this.media, t = e.currentTime, i = this.startPosition; if (i >= 0 && t < i) { if (e.seeking) return void m.logger.log("could not seek to " + i + ", already seeking at " + t); var r = o.BufferHelper.getBuffered(e), n = (r.length ? r.start(0) : 0) - i; n > 0 && (n < this.config.maxBufferHole || n < this.config.maxFragLookUpTolerance) && (m .logger.log("adjusting start position by " + n + " to match buffer start"), i += n, this .startPosition = i), this.log("seek to target start position " + i + " from current time " + t), e.currentTime = i } }, E._getAudioCodec = function(e) { var t = this.config.defaultAudioCodec || e.audioCodec; return this.audioCodecSwap && t && (this.log("Swapping audio codec"), t = -1 !== t.indexOf( "mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5"), t }, E._loadBitrateTestFrag = function(e) { var t = this; this._doFragLoad(e).then(function(i) { var r = t.hls; if (i && !r.nextLoadLevel && !t.fragContextChanged(e)) { t.fragLoadError = 0, t.state = n.State.IDLE, t.startFragRequested = !1, t .bitrateTest = !1; var a = e.stats; a.parsing.start = a.parsing.end = a.buffering.start = a.buffering.end = self.performance .now(), r.trigger(s.Events.FRAG_LOADED, i) } }) }, E._handleTransmuxComplete = function(e) { var t, i = "main", a = this.hls, o = e.remuxResult, u = e.chunkMeta, l = this.getCurrentContext(u); if (!l) return this.warn("The loading context changed while buffering fragment " + u.sn + " of level " + u.level + ". This chunk will not be buffered."), void this .resetLiveStartWhenNotLoaded(u.level); var c = l.frag, h = l.part, f = l.level, p = o.video, m = o.text, g = o.id3, v = o.initSegment, y = this.altAudio ? void 0 : o.audio; if (!this.fragContextChanged(c)) { if (this.state = n.State.PARSING, v) { v.tracks && (this._bufferInitSegment(f, v.tracks, c, u), a.trigger(s.Events .FRAG_PARSING_INIT_SEGMENT, { frag: c, id: i, tracks: v.tracks })); var _ = v.initPTS, b = v.timescale; Object(r.isFiniteNumber)(_) && (this.initPTS[c.cc] = _, a.trigger(s.Events.INIT_PTS_FOUND, { frag: c, id: i, initPTS: _, timescale: b })) } if (p && !1 !== o.independent) { if (f.details) { var w = p.startPTS, E = p.endPTS, T = p.startDTS, S = p.endDTS; if (h) h.elementaryStreams[p.type] = { startPTS: w, endPTS: E, startDTS: T, endDTS: S }; else if (p.firstKeyFrame && p.independent && (this.couldBacktrack = !0), p.dropped && p .independent) { if (this.getLoadPosition() + this.config.maxBufferHole < w) return void this.backtrack( c); c.setElementaryStreamInfo(p.type, c.start, E, c.start, S, !0) } c.setElementaryStreamInfo(p.type, w, E, T, S), this.bufferFragmentData(p, c, h, u) } } else if (!1 === o.independent) return void this.backtrack(c); if (y) { var A = y.startPTS, k = y.endPTS, R = y.startDTS, M = y.endDTS; h && (h.elementaryStreams[d.ElementaryStreamTypes.AUDIO] = { startPTS: A, endPTS: k, startDTS: R, endDTS: M }), c.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO, A, k, R, M), this .bufferFragmentData(y, c, h, u) } if (null !== g && void 0 !== g && null !== (t = g.samples) && void 0 !== t && t.length) { var O = { frag: c, id: i, samples: g.samples }; a.trigger(s.Events.FRAG_PARSING_METADATA, O) } if (m) { var C = { frag: c, id: i, samples: m.samples }; a.trigger(s.Events.FRAG_PARSING_USERDATA, C) } } }, E._bufferInitSegment = function(e, t, i, r) { var a = this; if (this.state === n.State.PARSING) { this.audioOnly = !!t.audio && !t.video, this.altAudio && !this.audioOnly && delete t.audio; var o = t.audio, u = t.video, l = t.audiovideo; if (o) { var d = e.audioCodec, c = navigator.userAgent.toLowerCase(); this.audioCodecSwitch && (d && (d = -1 !== d.indexOf("mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5"), 1 !== o.metadata.channelCount && -1 === c.indexOf("firefox") && (d = "mp4a.40.5")), -1 !== c.indexOf("android") && "audio/mpeg" !== o.container && (d = "mp4a.40.2", this.log("Android: force audio codec to " + d)), e.audioCodec && e .audioCodec !== d && this.log('Swapping manifest audio codec "' + e.audioCodec + '" for "' + d + '"'), o.levelCodec = d, o.id = "main", this.log( "Init audio buffer, container:" + o.container + ", codecs[selected/level/parsed]=[" + ( d || "") + "/" + (e.audioCodec || "") + "/" + o.codec + "]") } u && (u.levelCodec = e.videoCodec, u.id = "main", this.log("Init video buffer, container:" + u .container + ", codecs[level/parsed]=[" + (e.videoCodec || "") + "/" + u.codec + "]")), l && this.log("Init audiovideo buffer, container:" + l.container + ", codecs[level/parsed]=[" + (e.attrs.CODECS || "") + "/" + l.codec + "]"), this.hls .trigger(s.Events.BUFFER_CODECS, t), Object.keys(t).forEach(function(e) { var n = t[e].initSegment; null !== n && void 0 !== n && n.byteLength && a.hls.trigger(s.Events.BUFFER_APPENDING, { type: e, data: n, frag: i, part: null, chunkMeta: r, parent: i.type }) }), this.tick() } }, E.backtrack = function(e) { this.couldBacktrack = !0, this.resetTransmuxer(), this.flushBufferGap(e); var t = this.fragmentTracker.backtrack(e); this.fragPrevious = null, this.nextLoadPosition = e.start, t ? this.resetFragmentLoading(e) : this.state = n.State.BACKTRACKING }, E.checkFragmentChanged = function() { var e = this.media, t = null; if (e && e.readyState > 1 && !1 === e.seeking) { var i = e.currentTime; if (o.BufferHelper.isBuffered(e, i) ? t = this.getAppendedFrag(i) : o.BufferHelper.isBuffered( e, i + .1) && (t = this.getAppendedFrag(i + .1)), t) { var r = this.fragPlaying, n = t.level; r && t.sn === r.sn && r.level === n && t.urlId === r.urlId || (this.hls.trigger(s.Events .FRAG_CHANGED, { frag: t }), r && r.level === n || this.hls.trigger(s.Events.LEVEL_SWITCHED, { level: n }), this.fragPlaying = t) } } }, _ = y, (b = [{ key: "nextLevel", get: function() { var e = this.nextBufferedFrag; return e ? e.level : -1 } }, { key: "currentLevel", get: function() { var e = this.media; if (e) { var t = this.getAppendedFrag(e.currentTime); if (t) return t.level } return -1 } }, { key: "nextBufferedFrag", get: function() { var e = this.media; if (e) { var t = this.getAppendedFrag(e.currentTime); return this.followingBufferedFrag(t) } return null } }, { key: "forceStartLoad", get: function() { return this._forceStartLoad } }]) && g(_.prototype, b), w && g(_, w), Object.defineProperty(_, "prototype", { writable: !1 }), y }(n.default) }, "./src/controller/subtitle-stream-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "SubtitleStreamController", function() { return p }); var r = i("./src/events.ts"), n = i("./src/utils/buffer-helper.ts"), a = i("./src/controller/fragment-finders.ts"), s = i("./src/utils/discontinuities.ts"), o = i("./src/controller/level-helper.ts"), u = i("./src/controller/fragment-tracker.ts"), l = i("./src/controller/base-stream-controller.ts"), d = i("./src/types/loader.ts"), c = i("./src/types/level.ts"); function h(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function f(e, t) { return (f = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var p = function(e) { var t, i; function p(t, i) { var r; return (r = e.call(this, t, i, "[subtitle-stream-controller]") || this).levels = [], r .currentTrackId = -1, r.tracksBuffered = [], r.mainDetails = null, r._registerListeners(), r } i = e, (t = p).prototype = Object.create(i.prototype), t.prototype.constructor = t, f(t, i); var m, g, v, y = p.prototype; return y.onHandlerDestroying = function() { this._unregisterListeners(), this.mainDetails = null }, y._registerListeners = function() { var e = this.hls; e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.on(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .on(r.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.on(r.Events.ERROR, this.onError, this), e.on(r.Events.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), e.on(r .Events.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), e.on(r.Events .SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.on(r.Events .SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), e.on(r.Events .BUFFER_FLUSHING, this.onBufferFlushing, this) }, y._unregisterListeners = function() { var e = this.hls; e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.off(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .off(r.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.off(r.Events.ERROR, this.onError, this), e.off(r.Events.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), e.off(r .Events.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), e.off(r.Events .SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.off(r.Events .SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), e.off(r.Events .BUFFER_FLUSHING, this.onBufferFlushing, this) }, y.startLoad = function() { this.stopLoad(), this.state = l.State.IDLE, this.setInterval(500), this.tick() }, y.onManifestLoading = function() { this.mainDetails = null, this.fragmentTracker.removeAllFragments() }, y.onLevelLoaded = function(e, t) { this.mainDetails = t.details }, y.onSubtitleFragProcessed = function(e, t) { var i = t.frag, r = t.success; if (this.fragPrevious = i, this.state = l.State.IDLE, r) { var n = this.tracksBuffered[this.currentTrackId]; if (n) { for (var a, s = i.start, o = 0; o < n.length; o++) if (s >= n[o].start && s <= n[o].end) { a = n[o]; break } var u = i.start + i.duration; a ? a.end = u : (a = { start: s, end: u }, n.push(a)), this.fragmentTracker.fragBuffered(i) } } }, y.onBufferFlushing = function(e, t) { var i = t.startOffset, r = t.endOffset; if (0 === i && r !== Number.POSITIVE_INFINITY) { var n = this.currentTrackId, a = this.levels; if (!a.length || !a[n] || !a[n].details) return; var s = r - a[n].details.targetduration; if (s <= 0) return; t.endOffsetSubtitles = Math.max(0, s), this.tracksBuffered.forEach(function(e) { for (var t = 0; t < e.length;) if (e[t].end <= s) e.shift(); else { if (!(e[t].start < s)) break; e[t].start = s, t++ } }), this.fragmentTracker.removeFragmentsInRange(i, s, d.PlaylistLevelType.SUBTITLE) } }, y.onError = function(e, t) { var i, r = t.frag; r && r.type === d.PlaylistLevelType.SUBTITLE && (null !== (i = this.fragCurrent) && void 0 !== i && i.loader && this.fragCurrent.loader.abort(), this.state = l.State.IDLE) }, y.onSubtitleTracksUpdated = function(e, t) { var i = this, r = t.subtitleTracks; this.tracksBuffered = [], this.levels = r.map(function(e) { return new c.Level(e) }), this.fragmentTracker.removeAllFragments(), this.fragPrevious = null, this.levels.forEach( function(e) { i.tracksBuffered[e.id] = [] }), this.mediaBuffer = null }, y.onSubtitleTrackSwitch = function(e, t) { if (this.currentTrackId = t.id, this.levels.length && -1 !== this.currentTrackId) { var i = this.levels[this.currentTrackId]; null !== i && void 0 !== i && i.details ? this.mediaBuffer = this.mediaBufferTimeRanges : this .mediaBuffer = null, i && this.setInterval(500) } else this.clearInterval() }, y.onSubtitleTrackLoaded = function(e, t) { var i, r = t.details, n = t.id, u = this.currentTrackId, d = this.levels; if (d.length) { var c = d[u]; if (!(n >= d.length || n !== u) && c) { if (this.mediaBuffer = this.mediaBufferTimeRanges, r.live || null !== (i = c.details) && void 0 !== i && i.live) { var h = this.mainDetails; if (r.deltaUpdateFailed || !h) return; var f = h.fragments[0]; if (c.details) 0 === this.alignPlaylists(r, c.details) && f && Object(o.addSliding)(r, f .start); else r.hasProgramDateTime && h.hasProgramDateTime ? Object(s.alignMediaPlaylistByPDT)(r, h) : f && Object(o.addSliding)(r, f.start) } if (c.details = r, this.levelLastLoaded = n, this.tick(), r.live && !this.fragCurrent && this.media && this.state === l.State.IDLE) Object(a.findFragmentByPTS)(null, r.fragments, this.media.currentTime, 0) || (this.warn("Subtitle playlist not aligned with playback"), c.details = void 0) } } }, y._handleFragmentLoadComplete = function(e) { var t = e.frag, i = e.payload, n = t.decryptdata, a = this.hls; if (!this.fragContextChanged(t) && i && i.byteLength > 0 && n && n.key && n.iv && "AES-128" === n.method) { var s = performance.now(); this.decrypter.webCryptoDecrypt(new Uint8Array(i), n.key.buffer, n.iv.buffer).then(function( e) { var i = performance.now(); a.trigger(r.Events.FRAG_DECRYPTED, { frag: t, payload: e, stats: { tstart: s, tdecrypt: i } }) }) } }, y.doTick = function() { if (this.media) { if (this.state === l.State.IDLE) { var e, t = this.currentTrackId, i = this.levels; if (!i.length || !i[t] || !i[t].details) return; var r = i[t].details, s = r.targetduration, o = this.config, d = this.media, c = n.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges, d.currentTime - s, o .maxBufferHole), h = c.end; if (c.len > this.getMaxBufferLength() + s) return; console.assert(r, "Subtitle track details are defined on idle subtitle stream controller tick"); var f, p = r.fragments, m = p.length, g = r.edge, v = this.fragPrevious; if (h < g) { var y = o.maxFragLookUpTolerance; !(f = Object(a.findFragmentByPTS)(v, p, Math.max(p[0].start, h), y)) && v && v.start < p[ 0].start && (f = p[0]) } else f = p[m - 1]; null !== (e = f) && void 0 !== e && e.encrypted ? this.loadKey(f, r) : f && this .fragmentTracker.getState(f) === u.FragmentState.NOT_LOADED && this.loadFragment(f, r, h) } } else this.state = l.State.IDLE }, y.loadFragment = function(t, i, r) { this.fragCurrent = t, e.prototype.loadFragment.call(this, t, i, r) }, m = p, (g = [{ key: "mediaBufferTimeRanges", get: function() { return this.tracksBuffered[this.currentTrackId] || [] } }]) && h(m.prototype, g), v && h(m, v), Object.defineProperty(m, "prototype", { writable: !1 }), p }(l.default) }, "./src/controller/subtitle-track-controller.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/events.ts"), n = i("./src/utils/texttrack-utils.ts"), a = i("./src/controller/base-playlist-controller.ts"), s = i("./src/types/loader.ts"); function o(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function u(e, t) { return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var l = function(e) { var t, i; function a(t) { var i; return (i = e.call(this, t, "[subtitle-track-controller]") || this).media = null, i.tracks = [], i .groupId = null, i.tracksInGroup = [], i.trackId = -1, i.selectDefaultTrack = !0, i .queuedDefaultTrack = -1, i.trackChangeListener = function() { return i.onTextTracksChanged() }, i.asyncPollTrackChange = function() { return i.pollTrackChange(0) }, i.useTextTrackPolling = !1, i.subtitlePollingInterval = -1, i.subtitleDisplay = !0, i .registerListeners(), i } i = e, (t = a).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i); var l, c, h, f = a.prototype; return f.destroy = function() { this.unregisterListeners(), this.tracks.length = 0, this.tracksInGroup.length = 0, this .trackChangeListener = this.asyncPollTrackChange = null, e.prototype.destroy.call(this) }, f.registerListeners = function() { var e = this.hls; e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.on(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .on(r.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.on(r.Events.LEVEL_LOADING, this .onLevelLoading, this), e.on(r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e.on(r .Events.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.on(r.Events.ERROR, this .onError, this) }, f.unregisterListeners = function() { var e = this.hls; e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.off(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e .off(r.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.off(r.Events.LEVEL_LOADING, this.onLevelLoading, this), e.off(r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e .off(r.Events.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.off(r.Events.ERROR, this.onError, this) }, f.onMediaAttached = function(e, t) { this.media = t.media, this.media && (this.queuedDefaultTrack > -1 && (this.subtitleTrack = this .queuedDefaultTrack, this.queuedDefaultTrack = -1), this.useTextTrackPolling = !(this .media.textTracks && "onchange" in this.media.textTracks), this.useTextTrackPolling ? this .pollTrackChange(500) : this.media.textTracks.addEventListener("change", this .asyncPollTrackChange)) }, f.pollTrackChange = function(e) { self.clearInterval(this.subtitlePollingInterval), this.subtitlePollingInterval = self .setInterval(this.trackChangeListener, e) }, f.onMediaDetaching = function() { this.media && (self.clearInterval(this.subtitlePollingInterval), this.useTextTrackPolling || this.media.textTracks.removeEventListener("change", this.asyncPollTrackChange), this .trackId > -1 && (this.queuedDefaultTrack = this.trackId), d(this.media.textTracks).forEach( function(e) { Object(n.clearCurrentCues)(e) }), this.subtitleTrack = -1, this.media = null) }, f.onManifestLoading = function() { this.tracks = [], this.groupId = null, this.tracksInGroup = [], this.trackId = -1, this .selectDefaultTrack = !0 }, f.onManifestParsed = function(e, t) { this.tracks = t.subtitleTracks }, f.onSubtitleTrackLoaded = function(e, t) { var i = t.id, r = t.details, n = this.trackId, a = this.tracksInGroup[n]; if (a) { var s = a.details; a.details = t.details, this.log("subtitle track " + i + " loaded [" + r.startSN + "-" + r .endSN + "]"), i === this.trackId && (this.retryCount = 0, this.playlistLoaded(i, t, s)) } else this.warn("Invalid subtitle track id " + i) }, f.onLevelLoading = function(e, t) { this.switchLevel(t.level) }, f.onLevelSwitching = function(e, t) { this.switchLevel(t.level) }, f.switchLevel = function(e) { var t = this.hls.levels[e]; if (null !== t && void 0 !== t && t.textGroupIds) { var i = t.textGroupIds[t.urlId]; if (this.groupId !== i) { var n = this.tracksInGroup ? this.tracksInGroup[this.trackId] : void 0, a = this.tracks.filter(function(e) { return !i || e.groupId === i }); this.tracksInGroup = a; var s = this.findTrackId(null === n || void 0 === n ? void 0 : n.name) || this .findTrackId(); this.groupId = i; var o = { subtitleTracks: a }; this.log("Updating subtitle tracks, " + a.length + ' track(s) found in "' + i + '" group-id'), this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED, o), -1 !== s && this .setSubtitleTrack(s, n) } } }, f.findTrackId = function(e) { for (var t = this.tracksInGroup, i = 0; i < t.length; i++) { var r = t[i]; if ((!this.selectDefaultTrack || r.default) && (!e || e === r.name)) return r.id } return -1 }, f.onError = function(t, i) { e.prototype.onError.call(this, t, i), !i.fatal && i.context && i.context.type === s .PlaylistContextType.SUBTITLE_TRACK && i.context.id === this.trackId && i.context.groupId === this.groupId && this.retryLoadingOrFail(i) }, f.loadPlaylist = function(e) { var t = this.tracksInGroup[this.trackId]; if (this.shouldLoadTrack(t)) { var i = t.id, n = t.groupId, a = t.url; if (e) try { a = e.addDirectives(a) } catch (e) { this.warn("Could not construct new URL with HLS Delivery Directives: " + e) } this.log("Loading subtitle playlist for id " + i), this.hls.trigger(r.Events .SUBTITLE_TRACK_LOADING, { url: a, id: i, groupId: n, deliveryDirectives: e || null }) } }, f.toggleTrackModes = function(e) { var t = this, i = this.media, r = this.subtitleDisplay, n = this.trackId; if (i) { var a = d(i.textTracks), s = a.filter(function(e) { return e.groupId === t.groupId }); if (-1 === e)[].slice.call(a).forEach(function(e) { e.mode = "disabled" }); else { var o = s[n]; o && (o.mode = "disabled") } var u = s[e]; u && (u.mode = r ? "showing" : "hidden") } }, f.setSubtitleTrack = function(e, t) { var i, n = this.tracksInGroup; if (this.media) { if (this.trackId !== e && this.toggleTrackModes(e), !(this.trackId === e && (-1 === e || null !== (i = n[e]) && void 0 !== i && i.details) || e < -1 || e >= n.length)) { this.clearTimer(); var a = n[e]; if (this.log("Switching to subtitle track " + e), this.trackId = e, a) { var s = a.id, o = a.groupId, u = void 0 === o ? "" : o, l = a.name, d = a.type, c = a.url; this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH, { id: s, groupId: u, name: l, type: d, url: c }); var h = this.switchParams(a.url, null === t || void 0 === t ? void 0 : t.details); this.loadPlaylist(h) } else this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH, { id: e }) } } else this.queuedDefaultTrack = e }, f.onTextTracksChanged = function() { if (this.useTextTrackPolling || self.clearInterval(this.subtitlePollingInterval), this.media && this.hls.config.renderTextTracksNatively) { for (var e = -1, t = d(this.media.textTracks), i = 0; i < t.length; i++) if ("hidden" === t[i].mode) e = i; else if ("showing" === t[i].mode) { e = i; break } this.subtitleTrack !== e && (this.subtitleTrack = e) } }, l = a, (c = [{ key: "subtitleTracks", get: function() { return this.tracksInGroup } }, { key: "subtitleTrack", get: function() { return this.trackId }, set: function(e) { this.selectDefaultTrack = !1; var t = this.tracksInGroup ? this.tracksInGroup[this.trackId] : void 0; this.setSubtitleTrack(e, t) } }]) && o(l.prototype, c), h && o(l, h), Object.defineProperty(l, "prototype", { writable: !1 }), a }(a.default); function d(e) { for (var t = [], i = 0; i < e.length; i++) { var r = e[i]; "subtitles" === r.kind && r.label && t.push(e[i]) } return t } t.default = l }, "./src/controller/timeline-controller.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "TimelineController", function() { return h }); var r = i("./src/polyfills/number.ts"), n = i("./src/events.ts"), a = i("./src/utils/cea-608-parser.ts"), s = i("./src/utils/output-filter.ts"), o = i("./src/utils/webvtt-parser.ts"), u = i("./src/utils/texttrack-utils.ts"), l = i("./src/utils/imsc1-ttml-parser.ts"), d = i("./src/types/loader.ts"), c = i("./src/utils/logger.ts"), h = function() { function e(e) { if (this.hls = void 0, this.media = null, this.config = void 0, this.enabled = !0, this.Cues = void 0, this.textTracks = [], this.tracks = [], this.initPTS = [], this.timescale = [], this .unparsedVttFrags = [], this.captionsTracks = {}, this.nonNativeCaptionsTracks = {}, this .cea608Parser1 = void 0, this.cea608Parser2 = void 0, this.lastSn = -1, this.lastPartIndex = -1, this.prevCC = -1, this.vttCCs = { ccOffset: 0, presentationOffset: 0, 0: { start: 0, prevCC: -1, new: !1 } }, this.captionsProperties = void 0, this.hls = e, this.config = e.config, this.Cues = e.config .cueHandler, this.captionsProperties = { textTrack1: { label: this.config.captionsTextTrack1Label, languageCode: this.config.captionsTextTrack1LanguageCode }, textTrack2: { label: this.config.captionsTextTrack2Label, languageCode: this.config.captionsTextTrack2LanguageCode }, textTrack3: { label: this.config.captionsTextTrack3Label, languageCode: this.config.captionsTextTrack3LanguageCode }, textTrack4: { label: this.config.captionsTextTrack4Label, languageCode: this.config.captionsTextTrack4LanguageCode } }, this.config.enableCEA708Captions) { var t = new s.default(this, "textTrack1"), i = new s.default(this, "textTrack2"), r = new s.default(this, "textTrack3"), o = new s.default(this, "textTrack4"); this.cea608Parser1 = new a.default(1, t, i), this.cea608Parser2 = new a.default(3, r, o) } e.on(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.on(n.Events.MEDIA_DETACHING, this .onMediaDetaching, this), e.on(n.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.on( n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.on(n.Events.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), e.on(n.Events.FRAG_LOADING, this.onFragLoading, this), e .on(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.on(n.Events.FRAG_PARSING_USERDATA, this .onFragParsingUserdata, this), e.on(n.Events.FRAG_DECRYPTED, this.onFragDecrypted, this), e .on(n.Events.INIT_PTS_FOUND, this.onInitPtsFound, this), e.on(n.Events.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this), e.on(n.Events.BUFFER_FLUSHING, this.onBufferFlushing, this) } var t = e.prototype; return t.destroy = function() { var e = this.hls; e.off(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.off(n.Events.MEDIA_DETACHING, this.onMediaDetaching, this), e.off(n.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.off(n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.off(n.Events .SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), e.off(n.Events.FRAG_LOADING, this.onFragLoading, this), e.off(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.off(n .Events.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), e.off(n.Events .FRAG_DECRYPTED, this.onFragDecrypted, this), e.off(n.Events.INIT_PTS_FOUND, this .onInitPtsFound, this), e.off(n.Events.SUBTITLE_TRACKS_CLEARED, this .onSubtitleTracksCleared, this), e.off(n.Events.BUFFER_FLUSHING, this.onBufferFlushing, this), this.hls = this.config = this.cea608Parser1 = this.cea608Parser2 = null }, t.addCues = function(e, t, i, r, a) { for (var s, o, u, l, d = !1, c = a.length; c--;) { var h = a[c], f = (s = h[0], o = h[1], u = t, l = i, Math.min(o, l) - Math.max(s, u)); if (f >= 0 && (h[0] = Math.min(h[0], t), h[1] = Math.max(h[1], i), d = !0, f / (i - t) > .5)) return } if (d || a.push([t, i]), this.config.renderTextTracksNatively) { var p = this.captionsTracks[e]; this.Cues.newCue(p, t, i, r) } else { var m = this.Cues.newCue(null, t, i, r); this.hls.trigger(n.Events.CUES_PARSED, { type: "captions", cues: m, track: e }) } }, t.onInitPtsFound = function(e, t) { var i = this, r = t.frag, a = t.id, s = t.initPTS, o = t.timescale, u = this.unparsedVttFrags; "main" === a && (this.initPTS[r.cc] = s, this.timescale[r.cc] = o), u.length && (this .unparsedVttFrags = [], u.forEach(function(e) { i.onFragLoaded(n.Events.FRAG_LOADED, e) })) }, t.getExistingTrack = function(e) { var t = this.media; if (t) for (var i = 0; i < t.textTracks.length; i++) { var r = t.textTracks[i]; if (r[e]) return r } return null }, t.createCaptionsTrack = function(e) { this.config.renderTextTracksNatively ? this.createNativeTrack(e) : this.createNonNativeTrack(e) }, t.createNativeTrack = function(e) { if (!this.captionsTracks[e]) { var t = this.captionsProperties, i = this.captionsTracks, r = this.media, n = t[e], a = n.label, s = n.languageCode, o = this.getExistingTrack(e); if (o) i[e] = o, Object(u.clearCurrentCues)(i[e]), Object(u.sendAddTrackEvent)(i[e], r); else { var l = this.createTextTrack("captions", a, s); l && (l[e] = !0, i[e] = l) } } }, t.createNonNativeTrack = function(e) { if (!this.nonNativeCaptionsTracks[e]) { var t = this.captionsProperties[e]; if (t) { var i = { _id: e, label: t.label, kind: "captions", default: !!t.media && !!t.media.default, closedCaptions: t.media }; this.nonNativeCaptionsTracks[e] = i, this.hls.trigger(n.Events .NON_NATIVE_TEXT_TRACKS_FOUND, { tracks: [i] }) } } }, t.createTextTrack = function(e, t, i) { var r = this.media; if (r) return r.addTextTrack(e, t, i) }, t.onMediaAttaching = function(e, t) { this.media = t.media, this._cleanTracks() }, t.onMediaDetaching = function() { var e = this.captionsTracks; Object.keys(e).forEach(function(t) { Object(u.clearCurrentCues)(e[t]), delete e[t] }), this.nonNativeCaptionsTracks = {} }, t.onManifestLoading = function() { this.lastSn = -1, this.lastPartIndex = -1, this.prevCC = -1, this.vttCCs = { ccOffset: 0, presentationOffset: 0, 0: { start: 0, prevCC: -1, new: !1 } }, this._cleanTracks(), this.tracks = [], this.captionsTracks = {}, this .nonNativeCaptionsTracks = {}, this.textTracks = [], this.unparsedVttFrags = this .unparsedVttFrags || [], this.initPTS = [], this.timescale = [], this.cea608Parser1 && this .cea608Parser2 && (this.cea608Parser1.reset(), this.cea608Parser2.reset()) }, t._cleanTracks = function() { var e = this.media; if (e) { var t = e.textTracks; if (t) for (var i = 0; i < t.length; i++) Object(u.clearCurrentCues)(t[i]) } }, t.onSubtitleTracksUpdated = function(e, t) { var i = this; this.textTracks = []; var r = t.subtitleTracks || [], a = r.some(function(e) { return e.textCodec === l.IMSC1_CODEC }); if (this.config.enableWebVTT || a && this.config.enableIMSC1) { var s = this.tracks && r && this.tracks.length === r.length; if (this.tracks = r || [], this.config.renderTextTracksNatively) { var o = this.media ? this.media.textTracks : []; this.tracks.forEach(function(e, t) { var r; if (t < o.length) { for (var n = null, a = 0; a < o.length; a++) if (f(o[a], e)) { n = o[a]; break } n && (r = n) } r ? Object(u.clearCurrentCues)(r) : (r = i.createTextTrack("subtitles", e.name, e .lang)) && (r.mode = "disabled"), r && (r.groupId = e.groupId, i.textTracks.push( r)) }) } else if (!s && this.tracks && this.tracks.length) { var d = this.tracks.map(function(e) { return { label: e.name, kind: e.type.toLowerCase(), default: e.default, subtitleTrack: e } }); this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND, { tracks: d }) } } }, t.onManifestLoaded = function(e, t) { var i = this; this.config.enableCEA708Captions && t.captions && t.captions.forEach(function(e) { var t = /(?:CC|SERVICE)([1-4])/.exec(e.instreamId); if (t) { var r = "textTrack" + t[1], n = i.captionsProperties[r]; n && (n.label = e.name, e.lang && (n.languageCode = e.lang), n.media = e) } }) }, t.onFragLoading = function(e, t) { var i = this.cea608Parser1, r = this.cea608Parser2, n = this.lastSn, a = this.lastPartIndex; if (this.enabled && i && r && t.frag.type === d.PlaylistLevelType.MAIN) { var s, o, u = t.frag.sn, l = null != (s = null === t || void 0 === t ? void 0 : null === (o = t.part) || void 0 === o ? void 0 : o.index) ? s : -1; u === n + 1 || u === n && l === a + 1 || (i.reset(), r.reset()), this.lastSn = u, this .lastPartIndex = l } }, t.onFragLoaded = function(e, t) { var i = t.frag, a = t.payload, s = this.initPTS, o = this.unparsedVttFrags; if (i.type === d.PlaylistLevelType.SUBTITLE) if (a.byteLength) { if (!Object(r.isFiniteNumber)(s[i.cc])) return o.push(t), void(s.length && this.hls.trigger( n.Events.SUBTITLE_FRAG_PROCESSED, { success: !1, frag: i, error: new Error("Missing initial subtitle PTS") })); var u = i.decryptdata, c = "stats" in t; if (null == u || null == u.key || "AES-128" !== u.method || c) { var h = this.tracks[i.level], f = this.vttCCs; f[i.cc] || (f[i.cc] = { start: i.start, prevCC: this.prevCC, new: !0 }, this.prevCC = i.cc), h && h.textCodec === l.IMSC1_CODEC ? this._parseIMSC1(i, a) : this._parseVTTs(i, a, f) } } else this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, { success: !1, frag: i, error: new Error("Empty subtitle payload") }) }, t._parseIMSC1 = function(e, t) { var i = this, r = this.hls; Object(l.parseIMSC1)(t, this.initPTS[e.cc], this.timescale[e.cc], function(t) { i._appendCues(t, e.level), r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, { success: !0, frag: e }) }, function(t) { c.logger.log("Failed to parse IMSC1: " + t), r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, { success: !1, frag: e, error: t }) }) }, t._parseVTTs = function(e, t, i) { var r = this, a = this.hls; Object(o.parseWebVTT)(t, this.initPTS[e.cc], this.timescale[e.cc], i, e.cc, e.start, function( t) { r._appendCues(t, e.level), a.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, { success: !0, frag: e }) }, function(i) { r._fallbackToIMSC1(e, t), c.logger.log("Failed to parse VTT cue: " + i), a.trigger(n .Events.SUBTITLE_FRAG_PROCESSED, { success: !1, frag: e, error: i }) }) }, t._fallbackToIMSC1 = function(e, t) { var i = this, r = this.tracks[e.level]; r.textCodec || Object(l.parseIMSC1)(t, this.initPTS[e.cc], this.timescale[e.cc], function() { r.textCodec = l.IMSC1_CODEC, i._parseIMSC1(e, t) }, function() { r.textCodec = "wvtt" }) }, t._appendCues = function(e, t) { var i = this.hls; if (this.config.renderTextTracksNatively) { var r = this.textTracks[t]; if ("disabled" === r.mode) return; e.forEach(function(e) { return Object(u.addCueToTrack)(r, e) }) } else { var a = this.tracks[t].default ? "default" : "subtitles" + t; i.trigger(n.Events.CUES_PARSED, { type: "subtitles", cues: e, track: a }) } }, t.onFragDecrypted = function(e, t) { var i = t.frag; if (i.type === d.PlaylistLevelType.SUBTITLE) { if (!Object(r.isFiniteNumber)(this.initPTS[i.cc])) return void this.unparsedVttFrags.push(t); this.onFragLoaded(n.Events.FRAG_LOADED, t) } }, t.onSubtitleTracksCleared = function() { this.tracks = [], this.captionsTracks = {} }, t.onFragParsingUserdata = function(e, t) { var i = this.cea608Parser1, r = this.cea608Parser2; if (this.enabled && i && r) for (var n = 0; n < t.samples.length; n++) { var a = t.samples[n].bytes; if (a) { var s = this.extractCea608Data(a); i.addData(t.samples[n].pts, s[0]), r.addData(t.samples[n].pts, s[1]) } } }, t.onBufferFlushing = function(e, t) { var i = t.startOffset, r = t.endOffset, n = t.endOffsetSubtitles, a = t.type, s = this.media; if (s && !(s.currentTime < r)) { if (!a || "video" === a) { var o = this.captionsTracks; Object.keys(o).forEach(function(e) { return Object(u.removeCuesInRange)(o[e], i, r) }) } if (this.config.renderTextTracksNatively && 0 === i && void 0 !== n) { var l = this.textTracks; Object.keys(l).forEach(function(e) { return Object(u.removeCuesInRange)(l[e], i, n) }) } } }, t.extractCea608Data = function(e) { for (var t = [ [], [] ], i = 31 & e[0], r = 2, n = 0; n < i; n++) { var a = e[r++], s = 127 & e[r++], o = 127 & e[r++]; if (0 !== s || 0 !== o) if (0 != (4 & a)) { var u = 3 & a; 0 !== u && 1 !== u || (t[u].push(s), t[u].push(o)) } } return t }, e }(); function f(e, t) { return e && e.label === t.name && !(e.textTrack1 || e.textTrack2) } }, "./src/crypt/aes-crypto.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return r }); var r = function() { function e(e, t) { this.subtle = void 0, this.aesIV = void 0, this.subtle = e, this.aesIV = t } return e.prototype.decrypt = function(e, t) { return this.subtle.decrypt({ name: "AES-CBC", iv: this.aesIV }, t, e) }, e }() }, "./src/crypt/aes-decryptor.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "removePadding", function() { return n }), i.d(t, "default", function() { return a }); var r = i("./src/utils/typed-array.ts"); function n(e) { var t = e.byteLength, i = t && new DataView(e.buffer).getUint8(t - 1); return i ? Object(r.sliceUint8)(e, 0, t - i) : e } var a = function() { function e() { this.rcon = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], this.subMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256) ], this.invSubMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256) ], this.sBox = new Uint32Array(256), this.invSBox = new Uint32Array(256), this.key = new Uint32Array(0), this.ksRows = 0, this.keySize = 0, this.keySchedule = void 0, this .invKeySchedule = void 0, this.initTable() } var t = e.prototype; return t.uint8ArrayToUint32Array_ = function(e) { for (var t = new DataView(e), i = new Uint32Array(4), r = 0; r < 4; r++) i[r] = t.getUint32(4 * r); return i }, t.initTable = function() { var e = this.sBox, t = this.invSBox, i = this.subMix, r = i[0], n = i[1], a = i[2], s = i[3], o = this.invSubMix, u = o[0], l = o[1], d = o[2], c = o[3], h = new Uint32Array(256), f = 0, p = 0, m = 0; for (m = 0; m < 256; m++) h[m] = m < 128 ? m << 1 : m << 1 ^ 283; for (m = 0; m < 256; m++) { var g = p ^ p << 1 ^ p << 2 ^ p << 3 ^ p << 4; g = g >>> 8 ^ 255 & g ^ 99, e[f] = g, t[g] = f; var v = h[f], y = h[v], _ = h[y], b = 257 * h[g] ^ 16843008 * g; r[f] = b << 24 | b >>> 8, n[f] = b << 16 | b >>> 16, a[f] = b << 8 | b >>> 24, s[f] = b, b = 16843009 * _ ^ 65537 * y ^ 257 * v ^ 16843008 * f, u[g] = b << 24 | b >>> 8, l[g] = b << 16 | b >>> 16, d[g] = b << 8 | b >>> 24, c[g] = b, f ? (f = v ^ h[h[h[_ ^ v]]], p ^= h[h[ p]]) : f = p = 1 } }, t.expandKey = function(e) { for (var t = this.uint8ArrayToUint32Array_(e), i = !0, r = 0; r < t.length && i;) i = t[r] === this.key[r], r++; if (!i) { this.key = t; var n = this.keySize = t.length; if (4 !== n && 6 !== n && 8 !== n) throw new Error("Invalid aes key size=" + n); var a, s, o, u, l = this.ksRows = 4 * (n + 6 + 1), d = this.keySchedule = new Uint32Array(l), c = this.invKeySchedule = new Uint32Array(l), h = this.sBox, f = this.rcon, p = this.invSubMix, m = p[0], g = p[1], v = p[2], y = p[3]; for (a = 0; a < l; a++) a < n ? o = d[a] = t[a] : (u = o, a % n == 0 ? (u = h[(u = u << 8 | u >>> 24) >>> 24] << 24 | h[u >>> 16 & 255] << 16 | h[u >>> 8 & 255] << 8 | h[255 & u], u ^= f[a / n | 0] << 24) : n > 6 && a % n == 4 && (u = h[u >>> 24] << 24 | h[u >>> 16 & 255] << 16 | h[u >>> 8 & 255] << 8 | h[255 & u]), d[a] = o = (d[a - n] ^ u) >>> 0); for (s = 0; s < l; s++) a = l - s, u = 3 & s ? d[a] : d[a - 4], c[s] = s < 4 || a <= 4 ? u : m[h[u >>> 24]] ^ g[h[u >>> 16 & 255]] ^ v[h[u >>> 8 & 255]] ^ y[h[255 & u]], c[s] = c[s] >>> 0 } }, t.networkToHostOrderSwap = function(e) { return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24 }, t.decrypt = function(e, t, i) { for (var r, n, a, s, o, u, l, d, c, h, f, p, m, g, v = this.keySize + 6, y = this .invKeySchedule, _ = this.invSBox, b = this.invSubMix, w = b[0], E = b[1], T = b[2], S = b[ 3], A = this.uint8ArrayToUint32Array_(i), k = A[0], R = A[1], M = A[2], O = A[3], C = new Int32Array(e), D = new Int32Array(C.length), I = this.networkToHostOrderSwap; t < C .length;) { for (c = I(C[t]), h = I(C[t + 1]), f = I(C[t + 2]), p = I(C[t + 3]), o = c ^ y[0], u = p ^ y[ 1], l = f ^ y[2], d = h ^ y[3], m = 4, g = 1; g < v; g++) r = w[o >>> 24] ^ E[u >> 16 & 255] ^ T[l >> 8 & 255] ^ S[255 & d] ^ y[m], n = w[u >>> 24] ^ E[l >> 16 & 255] ^ T[d >> 8 & 255] ^ S[255 & o] ^ y[m + 1], a = w[l >>> 24] ^ E[d >> 16 & 255] ^ T[o >> 8 & 255] ^ S[255 & u] ^ y[m + 2], s = w[d >>> 24] ^ E[o >> 16 & 255] ^ T[u >> 8 & 255] ^ S[255 & l] ^ y[m + 3], o = r, u = n, l = a, d = s, m += 4; r = _[o >>> 24] << 24 ^ _[u >> 16 & 255] << 16 ^ _[l >> 8 & 255] << 8 ^ _[255 & d] ^ y[m], n = _[u >>> 24] << 24 ^ _[l >> 16 & 255] << 16 ^ _[d >> 8 & 255] << 8 ^ _[255 & o] ^ y[m + 1], a = _[l >>> 24] << 24 ^ _[d >> 16 & 255] << 16 ^ _[o >> 8 & 255] << 8 ^ _[255 & u] ^ y[m + 2], s = _[d >>> 24] << 24 ^ _[o >> 16 & 255] << 16 ^ _[u >> 8 & 255] << 8 ^ _[255 & l] ^ y[m + 3], D[t] = I(r ^ k), D[t + 1] = I(s ^ R), D[t + 2] = I(a ^ M), D[t + 3] = I(n ^ O), k = c, R = h, M = f, O = p, t += 4 } return D.buffer }, e }() }, "./src/crypt/decrypter.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return l }); var r = i("./src/crypt/aes-crypto.ts"), n = i("./src/crypt/fast-aes-key.ts"), a = i("./src/crypt/aes-decryptor.ts"), s = i("./src/utils/logger.ts"), o = i("./src/utils/mp4-tools.ts"), u = i("./src/utils/typed-array.ts"), l = function() { function e(e, t, i) { var r = (void 0 === i ? {} : i).removePKCS7Padding, n = void 0 === r || r; if (this.logEnabled = !0, this.observer = void 0, this.config = void 0, this.removePKCS7Padding = void 0, this.subtle = null, this.softwareDecrypter = null, this.key = null, this.fastAesKey = null, this.remainderData = null, this.currentIV = null, this.currentResult = null, this .observer = e, this.config = t, this.removePKCS7Padding = n, n) try { var a = self.crypto; a && (this.subtle = a.subtle || a.webkitSubtle) } catch (e) {} null === this.subtle && (this.config.enableSoftwareAES = !0) } var t = e.prototype; return t.destroy = function() { this.observer = null }, t.isSync = function() { return this.config.enableSoftwareAES }, t.flush = function() { var e = this.currentResult; if (e) { var t = new Uint8Array(e); return this.reset(), this.removePKCS7Padding ? Object(a.removePadding)(t) : t } this.reset() }, t.reset = function() { this.currentResult = null, this.currentIV = null, this.remainderData = null, this .softwareDecrypter && (this.softwareDecrypter = null) }, t.decrypt = function(e, t, i, r) { if (this.config.enableSoftwareAES) { this.softwareDecrypt(new Uint8Array(e), t, i); var n = this.flush(); n && r(n.buffer) } else this.webCryptoDecrypt(new Uint8Array(e), t, i).then(r) }, t.softwareDecrypt = function(e, t, i) { var r = this.currentIV, n = this.currentResult, s = this.remainderData; this.logOnce("JS AES decrypt"), s && (e = Object(o.appendUint8Array)(s, e), this.remainderData = null); var l = this.getValidChunk(e); if (!l.length) return null; r && (i = r); var d = this.softwareDecrypter; d || (d = this.softwareDecrypter = new a.default), d.expandKey(t); var c = n; return this.currentResult = d.decrypt(l.buffer, 0, i), this.currentIV = Object(u.sliceUint8)(l, -16).buffer, c || null }, t.webCryptoDecrypt = function(e, t, i) { var a = this, s = this.subtle; return this.key === t && this.fastAesKey || (this.key = t, this.fastAesKey = new n.default(s, t)), this.fastAesKey.expandKey().then(function(t) { return s ? new r.default(s, i).decrypt(e.buffer, t) : Promise.reject(new Error( "web crypto not initialized")) }).catch(function(r) { return a.onWebCryptoError(r, e, t, i) }) }, t.onWebCryptoError = function(e, t, i, r) { return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:", e), this.config .enableSoftwareAES = !0, this.logEnabled = !0, this.softwareDecrypt(t, i, r) }, t.getValidChunk = function(e) { var t = e, i = e.length - e.length % 16; return i !== e.length && (t = Object(u.sliceUint8)(e, 0, i), this.remainderData = Object(u .sliceUint8)(e, i)), t }, t.logOnce = function(e) { this.logEnabled && (s.logger.log("[decrypter.ts]: " + e), this.logEnabled = !1) }, e }() }, "./src/crypt/fast-aes-key.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return r }); var r = function() { function e(e, t) { this.subtle = void 0, this.key = void 0, this.subtle = e, this.key = t } return e.prototype.expandKey = function() { return this.subtle.importKey("raw", this.key, { name: "AES-CBC" }, !1, ["encrypt", "decrypt"]) }, e }() }, "./src/demux/aacdemuxer.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/demux/base-audio-demuxer.ts"), n = i("./src/demux/adts.ts"), a = i("./src/utils/logger.ts"), s = i("./src/demux/id3.ts"); function o(e, t) { return (o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var u = function(e) { var t, i; function r(t, i) { var r; return (r = e.call(this) || this).observer = void 0, r.config = void 0, r.observer = t, r.config = i, r } i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, o(t, i); var u = r.prototype; return u.resetInitSegment = function(t, i, r, n) { e.prototype.resetInitSegment.call(this, t, i, r, n), this._audioTrack = { container: "audio/adts", type: "audio", id: 2, pid: -1, sequenceNumber: 0, segmentCodec: "aac", samples: [], manifestCodec: i, duration: n, inputTimeScale: 9e4, dropped: 0 } }, r.probe = function(e) { if (!e) return !1; for (var t = (s.getID3Data(e, 0) || []).length, i = e.length; t < i; t++) if (n.probe(e, t)) return a.logger.log("ADTS sync word found !"), !0; return !1 }, u.canParse = function(e, t) { return n.canParse(e, t) }, u.appendFrame = function(e, t, i) { n.initTrackConfig(e, this.observer, t, i, e.manifestCodec); var r = n.appendFrame(e, t, i, this.initPTS, this.frameIndex); if (r && 0 === r.missing) return r }, r }(r.default); u.minProbeByteLength = 9, t.default = u }, "./src/demux/adts.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "getAudioConfig", function() { return s }), i.d(t, "isHeaderPattern", function() { return o }), i.d(t, "getHeaderLength", function() { return u }), i.d(t, "getFullFrameLength", function() { return l }), i.d(t, "canGetFrameLength", function() { return d }), i.d(t, "isHeader", function() { return c }), i.d(t, "canParse", function() { return h }), i.d(t, "probe", function() { return f }), i.d(t, "initTrackConfig", function() { return p }), i.d(t, "getFrameDuration", function() { return m }), i.d(t, "parseFrameHeader", function() { return g }), i.d(t, "appendFrame", function() { return v }); var r = i("./src/utils/logger.ts"), n = i("./src/errors.ts"), a = i("./src/events.ts"); function s(e, t, i, s) { var o, u, l, d, c = navigator.userAgent.toLowerCase(), h = s, f = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]; o = 1 + ((192 & t[i + 2]) >>> 6); var p = (60 & t[i + 2]) >>> 2; if (!(p > f.length - 1)) return l = (1 & t[i + 2]) << 2, l |= (192 & t[i + 3]) >>> 6, r.logger.log( "manifest codec:" + s + ", ADTS type:" + o + ", samplingIndex:" + p), /firefox/i.test(c) ? p >= 6 ? (o = 5, d = new Array(4), u = p - 3) : (o = 2, d = new Array(2), u = p) : -1 !== c.indexOf( "android") ? (o = 2, d = new Array(2), u = p) : (o = 5, d = new Array(4), s && (-1 !== s .indexOf("mp4a.40.29") || -1 !== s.indexOf("mp4a.40.5")) || !s && p >= 6 ? u = p - 3 : ((s && -1 !== s.indexOf("mp4a.40.2") && (p >= 6 && 1 === l || /vivaldi/i.test(c)) || !s && 1 === l ) && (o = 2, d = new Array(2)), u = p)), d[0] = o << 3, d[0] |= (14 & p) >> 1, d[1] |= (1 & p) << 7, d[1] |= l << 3, 5 === o && (d[1] |= (14 & u) >> 1, d[2] = (1 & u) << 7, d[2] |= 8, d[3] = 0), { config: d, samplerate: f[p], channelCount: l, codec: "mp4a.40." + o, manifestCodec: h }; e.trigger(a.Events.ERROR, { type: n.ErrorTypes.MEDIA_ERROR, details: n.ErrorDetails.FRAG_PARSING_ERROR, fatal: !0, reason: "invalid ADTS sampling index:" + p }) } function o(e, t) { return 255 === e[t] && 240 == (246 & e[t + 1]) } function u(e, t) { return 1 & e[t + 1] ? 7 : 9 } function l(e, t) { return (3 & e[t + 3]) << 11 | e[t + 4] << 3 | (224 & e[t + 5]) >>> 5 } function d(e, t) { return t + 5 < e.length } function c(e, t) { return t + 1 < e.length && o(e, t) } function h(e, t) { return d(e, t) && o(e, t) && l(e, t) <= e.length - t } function f(e, t) { if (c(e, t)) { var i = u(e, t); if (t + i >= e.length) return !1; var r = l(e, t); if (r <= i) return !1; var n = t + r; return n === e.length || c(e, n) } return !1 } function p(e, t, i, n, a) { if (!e.samplerate) { var o = s(t, i, n, a); if (!o) return; e.config = o.config, e.samplerate = o.samplerate, e.channelCount = o.channelCount, e.codec = o .codec, e.manifestCodec = o.manifestCodec, r.logger.log("parsed codec:" + e.codec + ", rate:" + o .samplerate + ", channels:" + o.channelCount) } } function m(e) { return 9216e4 / e } function g(e, t, i, r, n) { var a = u(e, t), s = l(e, t); if ((s -= a) > 0) return { headerLength: a, frameLength: s, stamp: i + r * n } } function v(e, t, i, r, n) { var a = g(t, i, r, n, m(e.samplerate)); if (a) { var s, o = a.frameLength, u = a.headerLength, l = a.stamp, d = u + o, c = Math.max(0, i + d - t.length); c ? (s = new Uint8Array(d - u)).set(t.subarray(i + u, t.length), 0) : s = t.subarray(i + u, i + d); var h = { unit: s, pts: l }; return c || e.samples.push(h), { sample: h, length: d, missing: c } } } }, "./src/demux/base-audio-demuxer.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "initPTSFn", function() { return l }); var r = i("./src/polyfills/number.ts"), n = i("./src/demux/id3.ts"), a = i("./src/demux/dummy-demuxed-track.ts"), s = i("./src/utils/mp4-tools.ts"), o = i("./src/utils/typed-array.ts"), u = function() { function e() { this._audioTrack = void 0, this._id3Track = void 0, this.frameIndex = 0, this.cachedData = null, this.initPTS = null } var t = e.prototype; return t.resetInitSegment = function(e, t, i, r) { this._id3Track = { type: "id3", id: 3, pid: -1, inputTimeScale: 9e4, sequenceNumber: 0, samples: [], dropped: 0 } }, t.resetTimeStamp = function() {}, t.resetContiguity = function() {}, t.canParse = function(e, t) { return !1 }, t.appendFrame = function(e, t, i) {}, t.demux = function(e, t) { this.cachedData && (e = Object(s.appendUint8Array)(this.cachedData, e), this.cachedData = null); var i, r, u = n.getID3Data(e, 0), d = u ? u.length : 0, c = this._audioTrack, h = this._id3Track, f = u ? n.getTimeStamp(u) : void 0, p = e.length; for (0 !== this.frameIndex && null !== this.initPTS || (this.initPTS = l(f, t)), u && u.length > 0 && h.samples.push({ pts: this.initPTS, dts: this.initPTS, data: u }), r = this.initPTS; d < p;) { if (this.canParse(e, d)) { var m = this.appendFrame(c, e, d); m ? (this.frameIndex++, r = m.sample.pts, i = d += m.length) : d = p } else n.canParse(e, d) ? (u = n.getID3Data(e, d), h.samples.push({ pts: r, dts: r, data: u }), i = d += u.length) : d++; if (d === p && i !== p) { var g = Object(o.sliceUint8)(e, i); this.cachedData ? this.cachedData = Object(s.appendUint8Array)(this.cachedData, g) : this .cachedData = g } } return { audioTrack: c, videoTrack: Object(a.dummyTrack)(), id3Track: h, textTrack: Object(a.dummyTrack)() } }, t.demuxSampleAes = function(e, t, i) { return Promise.reject(new Error("[" + this + "] This demuxer does not support Sample-AES decryption")) }, t.flush = function(e) { var t = this.cachedData; return t && (this.cachedData = null, this.demux(t, 0)), this.frameIndex = 0, { audioTrack: this._audioTrack, videoTrack: Object(a.dummyTrack)(), id3Track: this._id3Track, textTrack: Object(a.dummyTrack)() } }, t.destroy = function() {}, e }(), l = function(e, t) { return Object(r.isFiniteNumber)(e) ? 90 * e : 9e4 * t }; t.default = u }, "./src/demux/chunk-cache.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return r }); var r = function() { function e() { this.chunks = [], this.dataLength = 0 } var t = e.prototype; return t.push = function(e) { this.chunks.push(e), this.dataLength += e.length }, t.flush = function() { var e, t = this.chunks, i = this.dataLength; return t.length ? (e = 1 === t.length ? t[0] : function(e, t) { for (var i = new Uint8Array(t), r = 0, n = 0; n < e.length; n++) { var a = e[n]; i.set(a, r), r += a.length } return i }(t, i), this.reset(), e) : new Uint8Array(0) }, t.reset = function() { this.chunks.length = 0, this.dataLength = 0 }, e }() }, "./src/demux/dummy-demuxed-track.ts": function(e, t, i) { "use strict"; function r(e, t) { return void 0 === e && (e = ""), void 0 === t && (t = 9e4), { type: e, id: -1, pid: -1, inputTimeScale: t, sequenceNumber: -1, samples: [], dropped: 0 } } i.r(t), i.d(t, "dummyTrack", function() { return r }) }, "./src/demux/exp-golomb.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/utils/logger.ts"), n = function() { function e(e) { this.data = void 0, this.bytesAvailable = void 0, this.word = void 0, this.bitsAvailable = void 0, this.data = e, this.bytesAvailable = e.byteLength, this.word = 0, this.bitsAvailable = 0 } var t = e.prototype; return t.loadWord = function() { var e = this.data, t = this.bytesAvailable, i = e.byteLength - t, r = new Uint8Array(4), n = Math.min(4, t); if (0 === n) throw new Error("no bytes available"); r.set(e.subarray(i, i + n)), this.word = new DataView(r.buffer).getUint32(0), this .bitsAvailable = 8 * n, this.bytesAvailable -= n }, t.skipBits = function(e) { var t; this.bitsAvailable > e ? (this.word <<= e, this.bitsAvailable -= e) : (e -= this.bitsAvailable, e -= (t = e >> 3) >> 3, this.bytesAvailable -= t, this.loadWord(), this.word <<= e, this .bitsAvailable -= e) }, t.readBits = function(e) { var t = Math.min(this.bitsAvailable, e), i = this.word >>> 32 - t; return e > 32 && r.logger.error("Cannot read more than 32 bits at a time"), this .bitsAvailable -= t, this.bitsAvailable > 0 ? this.word <<= t : this.bytesAvailable > 0 && this.loadWord(), (t = e - t) > 0 && this.bitsAvailable ? i << t | this.readBits(t) : i }, t.skipLZ = function() { var e; for (e = 0; e < this.bitsAvailable; ++e) if (0 != (this.word & 2147483648 >>> e)) return this.word <<= e, this.bitsAvailable -= e, e; return this.loadWord(), e + this.skipLZ() }, t.skipUEG = function() { this.skipBits(1 + this.skipLZ()) }, t.skipEG = function() { this.skipBits(1 + this.skipLZ()) }, t.readUEG = function() { var e = this.skipLZ(); return this.readBits(e + 1) - 1 }, t.readEG = function() { var e = this.readUEG(); return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1) }, t.readBoolean = function() { return 1 === this.readBits(1) }, t.readUByte = function() { return this.readBits(8) }, t.readUShort = function() { return this.readBits(16) }, t.readUInt = function() { return this.readBits(32) }, t.skipScalingList = function(e) { for (var t = 8, i = 8, r = 0; r < e; r++) 0 !== i && (i = (t + this.readEG() + 256) % 256), t = 0 === i ? t : i }, t.readSPS = function() { var e, t, i, r = 0, n = 0, a = 0, s = 0, o = this.readUByte.bind(this), u = this.readBits.bind(this), l = this.readUEG.bind(this), d = this.readBoolean.bind(this), c = this.skipBits.bind(this), h = this.skipEG.bind(this), f = this.skipUEG.bind(this), p = this.skipScalingList.bind(this); o(); var m = o(); if (u(5), c(3), o(), f(), 100 === m || 110 === m || 122 === m || 244 === m || 44 === m || 83 === m || 86 === m || 118 === m || 128 === m) { var g = l(); if (3 === g && c(1), f(), f(), c(1), d()) for (t = 3 !== g ? 8 : 12, i = 0; i < t; i++) d() && p(i < 6 ? 16 : 64) } f(); var v = l(); if (0 === v) l(); else if (1 === v) for (c(1), h(), h(), e = l(), i = 0; i < e; i++) h(); f(), c(1); var y = l(), _ = l(), b = u(1); 0 === b && c(1), c(1), d() && (r = l(), n = l(), a = l(), s = l()); var w = [1, 1]; if (d() && d()) switch (o()) { case 1: w = [1, 1]; break; case 2: w = [12, 11]; break; case 3: w = [10, 11]; break; case 4: w = [16, 11]; break; case 5: w = [40, 33]; break; case 6: w = [24, 11]; break; case 7: w = [20, 11]; break; case 8: w = [32, 11]; break; case 9: w = [80, 33]; break; case 10: w = [18, 11]; break; case 11: w = [15, 11]; break; case 12: w = [64, 33]; break; case 13: w = [160, 99]; break; case 14: w = [4, 3]; break; case 15: w = [3, 2]; break; case 16: w = [2, 1]; break; case 255: w = [o() << 8 | o(), o() << 8 | o()] } return { width: Math.ceil(16 * (y + 1) - 2 * r - 2 * n), height: (2 - b) * (_ + 1) * 16 - (b ? 2 : 4) * (a + s), pixelRatio: w } }, t.readSliceType = function() { return this.readUByte(), this.readUEG(), this.readUEG() }, e }(); t.default = n }, "./src/demux/id3.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "isHeader", function() { return n }), i.d(t, "isFooter", function() { return a }), i.d(t, "getID3Data", function() { return s }), i.d(t, "canParse", function() { return u }), i.d(t, "getTimeStamp", function() { return l }), i.d(t, "isTimeStampFrame", function() { return d }), i.d(t, "getID3Frames", function() { return h }), i.d(t, "decodeFrame", function() { return f }), i.d(t, "utf8ArrayToStr", function() { return y }), i.d(t, "testables", function() { return _ }); var r, n = function(e, t) { return t + 10 <= e.length && 73 === e[t] && 68 === e[t + 1] && 51 === e[t + 2] && e[t + 3] < 255 && e[t + 4] < 255 && e[t + 6] < 128 && e[t + 7] < 128 && e[t + 8] < 128 && e[t + 9] < 128 }, a = function(e, t) { return t + 10 <= e.length && 51 === e[t] && 68 === e[t + 1] && 73 === e[t + 2] && e[t + 3] < 255 && e[t + 4] < 255 && e[t + 6] < 128 && e[t + 7] < 128 && e[t + 8] < 128 && e[t + 9] < 128 }, s = function(e, t) { for (var i = t, r = 0; n(e, t);) { r += 10, r += o(e, t + 6), a(e, t + 10) && (r += 10), t += r } if (r > 0) return e.subarray(i, i + r) }, o = function(e, t) { var i = 0; return i = (127 & e[t]) << 21, i |= (127 & e[t + 1]) << 14, i |= (127 & e[t + 2]) << 7, i |= 127 & e[t + 3] }, u = function(e, t) { return n(e, t) && o(e, t + 6) + 10 <= e.length - t }, l = function(e) { for (var t = h(e), i = 0; i < t.length; i++) { var r = t[i]; if (d(r)) return v(r) } }, d = function(e) { return e && "PRIV" === e.key && "com.apple.streaming.transportStreamTimestamp" === e.info }, c = function(e) { var t = String.fromCharCode(e[0], e[1], e[2], e[3]), i = o(e, 4); return { type: t, size: i, data: e.subarray(10, 10 + i) } }, h = function(e) { for (var t = 0, i = []; n(e, t);) { for (var r = o(e, t + 6), s = (t += 10) + r; t + 8 < s;) { var u = c(e.subarray(t)), l = f(u); l && i.push(l), t += u.size + 10 } a(e, t) && (t += 10) } return i }, f = function(e) { return "PRIV" === e.type ? p(e) : "W" === e.type[0] ? g(e) : m(e) }, p = function(e) { if (!(e.size < 2)) { var t = y(e.data, !0), i = new Uint8Array(e.data.subarray(t.length + 1)); return { key: e.type, info: t, data: i.buffer } } }, m = function(e) { if (!(e.size < 2)) { if ("TXXX" === e.type) { var t = 1, i = y(e.data.subarray(t), !0); t += i.length + 1; var r = y(e.data.subarray(t)); return { key: e.type, info: i, data: r } } var n = y(e.data.subarray(1)); return { key: e.type, data: n } } }, g = function(e) { if ("WXXX" === e.type) { if (e.size < 2) return; var t = 1, i = y(e.data.subarray(t), !0); t += i.length + 1; var r = y(e.data.subarray(t)); return { key: e.type, info: i, data: r } } var n = y(e.data); return { key: e.type, data: n } }, v = function(e) { if (8 === e.data.byteLength) { var t = new Uint8Array(e.data), i = 1 & t[3], r = (t[4] << 23) + (t[5] << 15) + (t[6] << 7) + t[7]; return r /= 45, i && (r += 47721858.84), Math.round(r) } }, y = function(e, t) { void 0 === t && (t = !1); var i = b(); if (i) { var r = i.decode(e); if (t) { var n = r.indexOf("\0"); return -1 !== n ? r.substring(0, n) : r } return r.replace(/\0/g, "") } for (var a, s, o, u = e.length, l = "", d = 0; d < u;) { if (0 === (a = e[d++]) && t) return l; if (0 !== a && 3 !== a) switch (a >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: l += String.fromCharCode(a); break; case 12: case 13: s = e[d++], l += String.fromCharCode((31 & a) << 6 | 63 & s); break; case 14: s = e[d++], o = e[d++], l += String.fromCharCode((15 & a) << 12 | (63 & s) << 6 | (63 & o) << 0) } } return l }, _ = { decodeTextFrame: m }; function b() { return r || void 0 === self.TextDecoder || (r = new self.TextDecoder("utf-8")), r } }, "./src/demux/mp3demuxer.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/demux/base-audio-demuxer.ts"), n = i("./src/demux/id3.ts"), a = i("./src/utils/logger.ts"), s = i("./src/demux/mpegaudio.ts"); function o(e, t) { return (o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } var u = function(e) { var t, i; function r() { return e.apply(this, arguments) || this } i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, o(t, i); var u = r.prototype; return u.resetInitSegment = function(t, i, r, n) { e.prototype.resetInitSegment.call(this, t, i, r, n), this._audioTrack = { container: "audio/mpeg", type: "audio", id: 2, pid: -1, sequenceNumber: 0, segmentCodec: "mp3", samples: [], manifestCodec: i, duration: n, inputTimeScale: 9e4, dropped: 0 } }, r.probe = function(e) { if (!e) return !1; for (var t = (n.getID3Data(e, 0) || []).length, i = e.length; t < i; t++) if (s.probe(e, t)) return a.logger.log("MPEG Audio sync word found !"), !0; return !1 }, u.canParse = function(e, t) { return s.canParse(e, t) }, u.appendFrame = function(e, t, i) { if (null !== this.initPTS) return s.appendFrame(e, t, i, this.initPTS, this.frameIndex) }, r }(r.default); u.minProbeByteLength = 4, t.default = u }, "./src/demux/mp4demuxer.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/polyfills/number.ts"), n = i("./src/utils/mp4-tools.ts"), a = i("./src/demux/dummy-demuxed-track.ts"), s = /\/emsg[-/]ID3/i, o = function() { function e(e, t) { this.remainderData = null, this.timeOffset = 0, this.config = void 0, this.videoTrack = void 0, this.audioTrack = void 0, this.id3Track = void 0, this.txtTrack = void 0, this.config = t } var t = e.prototype; return t.resetTimeStamp = function() {}, t.resetInitSegment = function(e, t, i, r) { var s = Object(n.parseInitSegment)(e), o = this.videoTrack = Object(a.dummyTrack)("video", 1), u = this.audioTrack = Object(a.dummyTrack)("audio", 1), l = this.txtTrack = Object(a.dummyTrack)("text", 1); if (this.id3Track = Object(a.dummyTrack)("id3", 1), this.timeOffset = 0, s.video) { var d = s.video, c = d.id, h = d.timescale, f = d.codec; o.id = c, o.timescale = l.timescale = h, o.codec = f } if (s.audio) { var p = s.audio, m = p.id, g = p.timescale, v = p.codec; u.id = m, u.timescale = g, u.codec = v } l.id = n.RemuxerTrackIdConfig.text, o.sampleDuration = 0, o.duration = u.duration = r }, t.resetContiguity = function() {}, e.probe = function(e) { return e = e.length > 16384 ? e.subarray(0, 16384) : e, Object(n.findBox)(e, ["moof"]).length > 0 }, t.demux = function(e, t) { this.timeOffset = t; var i = e, r = this.videoTrack, a = this.txtTrack; if (this.config.progressive) { this.remainderData && (i = Object(n.appendUint8Array)(this.remainderData, e)); var s = Object(n.segmentValidRange)(i); this.remainderData = s.remainder, r.samples = s.valid || new Uint8Array } else r.samples = i; var o = this.extractID3Track(r, t); return a.samples = Object(n.parseSamples)(t, r), { videoTrack: r, audioTrack: this.audioTrack, id3Track: o, textTrack: this.txtTrack } }, t.flush = function() { var e = this.timeOffset, t = this.videoTrack, i = this.txtTrack; t.samples = this.remainderData || new Uint8Array, this.remainderData = null; var r = this.extractID3Track(t, this.timeOffset); return i.samples = Object(n.parseSamples)(e, t), { videoTrack: t, audioTrack: Object(a.dummyTrack)(), id3Track: r, textTrack: Object(a.dummyTrack)() } }, t.extractID3Track = function(e, t) { var i = this.id3Track; if (e.samples.length) { var a = Object(n.findBox)(e.samples, ["emsg"]); a && a.forEach(function(e) { var a = Object(n.parseEmsg)(e); if (s.test(a.schemeIdUri)) { var o = Object(r.isFiniteNumber)(a.presentationTime) ? a.presentationTime / a .timeScale : t + a.presentationTimeDelta / a.timeScale, u = a.payload; i.samples.push({ data: u, len: u.byteLength, dts: o, pts: o }) } }) } return i }, t.demuxSampleAes = function(e, t, i) { return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption")) }, t.destroy = function() {}, e }(); o.minProbeByteLength = 1024, t.default = o }, "./src/demux/mpegaudio.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "appendFrame", function() { return u }), i.d(t, "parseHeader", function() { return l }), i.d(t, "isHeaderPattern", function() { return d }), i.d(t, "isHeader", function() { return c }), i.d(t, "canParse", function() { return h }), i.d(t, "probe", function() { return f }); var r = null, n = [32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 ], a = [44100, 48e3, 32e3, 22050, 24e3, 16e3, 11025, 12e3, 8e3], s = [ [0, 72, 144, 12], [0, 0, 0, 0], [0, 72, 144, 12], [0, 144, 144, 12] ], o = [0, 1, 1, 4]; function u(e, t, i, r, n) { if (!(i + 24 > t.length)) { var a = l(t, i); if (a && i + a.frameLength <= t.length) { var s = r + n * (9e4 * a.samplesPerFrame / a.sampleRate), o = { unit: t.subarray(i, i + a.frameLength), pts: s, dts: s }; return e.config = [], e.channelCount = a.channelCount, e.samplerate = a.sampleRate, e.samples .push(o), { sample: o, length: a.frameLength, missing: 0 } } } } function l(e, t) { var i = e[t + 1] >> 3 & 3, u = e[t + 1] >> 1 & 3, l = e[t + 2] >> 4 & 15, d = e[t + 2] >> 2 & 3; if (1 !== i && 0 !== l && 15 !== l && 3 !== d) { var c = e[t + 2] >> 1 & 1, h = e[t + 3] >> 6, f = 1e3 * n[14 * (3 === i ? 3 - u : 3 === u ? 3 : 4) + l - 1], p = a[3 * (3 === i ? 0 : 2 === i ? 1 : 2) + d], m = 3 === h ? 1 : 2, g = s[i][u], v = o[u], y = 8 * g * v, _ = Math.floor(g * f / p + c) * v; if (null === r) { var b = (navigator.userAgent || "").match(/Chrome\/(\d+)/i); r = b ? parseInt(b[1]) : 0 } return !!r && r <= 87 && 2 === u && f >= 224e3 && 0 === h && (e[t + 3] = 128 | e[t + 3]), { sampleRate: p, channelCount: m, frameLength: _, samplesPerFrame: y } } } function d(e, t) { return 255 === e[t] && 224 == (224 & e[t + 1]) && 0 != (6 & e[t + 1]) } function c(e, t) { return t + 1 < e.length && d(e, t) } function h(e, t) { return d(e, t) && 4 <= e.length - t } function f(e, t) { if (t + 1 < e.length && d(e, t)) { var i = l(e, t), r = 4; null !== i && void 0 !== i && i.frameLength && (r = i.frameLength); var n = t + r; return n === e.length || c(e, n) } return !1 } }, "./src/demux/sample-aes.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/crypt/decrypter.ts"), n = i("./src/demux/tsdemuxer.ts"), a = function() { function e(e, t, i) { this.keyData = void 0, this.decrypter = void 0, this.keyData = i, this.decrypter = new r.default( e, t, { removePKCS7Padding: !1 }) } var t = e.prototype; return t.decryptBuffer = function(e, t) { this.decrypter.decrypt(e, this.keyData.key.buffer, this.keyData.iv.buffer, t) }, t.decryptAacSample = function(e, t, i, r) { var n = e[t].unit; if (!(n.length <= 16)) { var a = n.subarray(16, n.length - n.length % 16), s = a.buffer.slice(a.byteOffset, a.byteOffset + a.length), o = this; this.decryptBuffer(s, function(a) { var s = new Uint8Array(a); n.set(s, 16), r || o.decryptAacSamples(e, t + 1, i) }) } }, t.decryptAacSamples = function(e, t, i) { for (;; t++) { if (t >= e.length) return void i(); if (!(e[t].unit.length < 32)) { var r = this.decrypter.isSync(); if (this.decryptAacSample(e, t, i, r), !r) return } } }, t.getAvcEncryptedData = function(e) { for (var t = 16 * Math.floor((e.length - 48) / 160) + 16, i = new Int8Array(t), r = 0, n = 32; n < e.length - 16; n += 160, r += 16) i.set(e.subarray(n, n + 16), r); return i }, t.getAvcDecryptedUnit = function(e, t) { for (var i = new Uint8Array(t), r = 0, n = 32; n < e.length - 16; n += 160, r += 16) e.set(i .subarray(r, r + 16), n); return e }, t.decryptAvcSample = function(e, t, i, r, a, s) { var o = Object(n.discardEPB)(a.data), u = this.getAvcEncryptedData(o), l = this; this.decryptBuffer(u.buffer, function(n) { a.data = l.getAvcDecryptedUnit(o, n), s || l.decryptAvcSamples(e, t, i + 1, r) }) }, t.decryptAvcSamples = function(e, t, i, r) { if (e instanceof Uint8Array) throw new Error("Cannot decrypt samples of type Uint8Array"); for (;; t++, i = 0) { if (t >= e.length) return void r(); for (var n = e[t].units; !(i >= n.length); i++) { var a = n[i]; if (!(a.data.length <= 48 || 1 !== a.type && 5 !== a.type)) { var s = this.decrypter.isSync(); if (this.decryptAvcSample(e, t, i, r, a, s), !s) return } } } }, e }(); t.default = a }, "./src/demux/transmuxer-interface.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return c }); var r = i("./node_modules/webworkify-webpack/index.js"), n = i("./src/events.ts"), a = i("./src/demux/transmuxer.ts"), s = i("./src/utils/logger.ts"), o = i("./src/errors.ts"), u = i("./src/utils/mediasource-helper.ts"), l = i("./node_modules/eventemitter3/index.js"), d = Object(u.getMediaSource)() || { isTypeSupported: function() { return !1 } }, c = function() { function e(e, t, i, u) { var c = this; this.hls = void 0, this.id = void 0, this.observer = void 0, this.frag = null, this.part = null, this.worker = void 0, this.onwmsg = void 0, this.transmuxer = null, this.onTransmuxComplete = void 0, this.onFlush = void 0, this.hls = e, this.id = t, this.onTransmuxComplete = i, this .onFlush = u; var h = e.config, f = function(t, i) { (i = i || {}).frag = c.frag, i.id = c.id, e.trigger(t, i) }; this.observer = new l.EventEmitter, this.observer.on(n.Events.FRAG_DECRYPTED, f), this.observer .on(n.Events.ERROR, f); var p = { mp4: d.isTypeSupported("video/mp4"), mpeg: d.isTypeSupported("audio/mpeg"), mp3: d.isTypeSupported('audio/mp4; codecs="mp3"') }, m = navigator.vendor; if (h.enableWorker && "undefined" != typeof Worker) { var g; s.logger.log("demuxing in webworker"); try { g = this.worker = r("./src/demux/transmuxer-worker.ts"), this.onwmsg = this.onWorkerMessage .bind(this), g.addEventListener("message", this.onwmsg), g.onerror = function(t) { e.trigger(n.Events.ERROR, { type: o.ErrorTypes.OTHER_ERROR, details: o.ErrorDetails.INTERNAL_EXCEPTION, fatal: !0, event: "demuxerWorker", error: new Error(t.message + " (" + t.filename + ":" + t.lineno + ")") }) }, g.postMessage({ cmd: "init", typeSupported: p, vendor: m, id: t, config: JSON.stringify(h) }) } catch (e) { s.logger.warn("Error in worker:", e), s.logger.error( "Error while initializing DemuxerWorker, fallback to inline"), g && self.URL .revokeObjectURL(g.objectURL), this.transmuxer = new a.default(this.observer, p, h, m, t), this.worker = null } } else this.transmuxer = new a.default(this.observer, p, h, m, t) } var t = e.prototype; return t.destroy = function() { var e = this.worker; if (e) e.removeEventListener("message", this.onwmsg), e.terminate(), this.worker = null; else { var t = this.transmuxer; t && (t.destroy(), this.transmuxer = null) } var i = this.observer; i && i.removeAllListeners(), this.observer = null }, t.push = function(e, t, i, r, n, o, u, l, d, c) { var h, f, p = this; d.transmuxing.start = self.performance.now(); var m = this.transmuxer, g = this.worker, v = o ? o.start : n.start, y = n.decryptdata, _ = this.frag, b = !(_ && n.cc === _.cc), w = !(_ && d.level === _.level), E = _ ? d.sn - _.sn : -1, T = this.part ? d.part - this.part.index : 1, S = !w && (1 === E || 0 === E && 1 === T), A = self.performance.now(); (w || E || 0 === n.stats.parsing.start) && (n.stats.parsing.start = A), !o || !T && S || (o .stats.parsing.start = A); var k = !(_ && (null === (h = n.initSegment) || void 0 === h ? void 0 : h.url) === (null === ( f = _.initSegment) || void 0 === f ? void 0 : f.url)), R = new a.TransmuxState(b, S, l, w, v, k); if (!S || b || k) { s.logger.log("[transmuxer-interface, " + n.type + "]: Starting new transmux session for sn: " + d.sn + " p: " + d.part + " level: " + d .level + " id: " + d.id + "\n discontinuity: " + b + "\n trackSwitch: " + w + "\n contiguous: " + S + "\n accurateTimeOffset: " + l + "\n timeOffset: " + v + "\n initSegmentChange: " + k); var M = new a.TransmuxConfig(i, r, t, u, c); this.configureTransmuxer(M) } if (this.frag = n, this.part = o, g) g.postMessage({ cmd: "demux", data: e, decryptdata: y, chunkMeta: d, state: R }, e instanceof ArrayBuffer ? [e] : []); else if (m) { var O = m.push(e, y, d, R); Object(a.isPromise)(O) ? O.then(function(e) { p.handleTransmuxComplete(e) }) : this.handleTransmuxComplete(O) } }, t.flush = function(e) { var t = this; e.transmuxing.start = self.performance.now(); var i = this.transmuxer, r = this.worker; if (r) r.postMessage({ cmd: "flush", chunkMeta: e }); else if (i) { var n = i.flush(e); Object(a.isPromise)(n) ? n.then(function(i) { t.handleFlushResult(i, e) }) : this.handleFlushResult(n, e) } }, t.handleFlushResult = function(e, t) { var i = this; e.forEach(function(e) { i.handleTransmuxComplete(e) }), this.onFlush(t) }, t.onWorkerMessage = function(e) { var t = e.data, i = this.hls; switch (t.event) { case "init": self.URL.revokeObjectURL(this.worker.objectURL); break; case "transmuxComplete": this.handleTransmuxComplete(t.data); break; case "flush": this.onFlush(t.data); break; default: t.data = t.data || {}, t.data.frag = this.frag, t.data.id = this.id, i.trigger(t.event, t .data) } }, t.configureTransmuxer = function(e) { var t = this.worker, i = this.transmuxer; t ? t.postMessage({ cmd: "configure", config: e }) : i && i.configure(e) }, t.handleTransmuxComplete = function(e) { e.chunkMeta.transmuxing.end = self.performance.now(), this.onTransmuxComplete(e) }, e }() }, "./src/demux/transmuxer-worker.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return o }); var r = i("./src/demux/transmuxer.ts"), n = i("./src/events.ts"), a = i("./src/utils/logger.ts"), s = i("./node_modules/eventemitter3/index.js"); function o(e) { var t = new s.EventEmitter, i = function(t, i) { e.postMessage({ event: t, data: i }) }; t.on(n.Events.FRAG_DECRYPTED, i), t.on(n.Events.ERROR, i), e.addEventListener("message", function(n) { var s = n.data; switch (s.cmd) { case "init": var o = JSON.parse(s.config); e.transmuxer = new r.default(t, s.typeSupported, o, s.vendor, s.id), Object(a.enableLogs)(o .debug), i("init", null); break; case "configure": e.transmuxer.configure(s.config); break; case "demux": var l = e.transmuxer.push(s.data, s.decryptdata, s.chunkMeta, s.state); Object(r.isPromise)(l) ? l.then(function(t) { u(e, t) }) : u(e, l); break; case "flush": var c = s.chunkMeta, h = e.transmuxer.flush(c); Object(r.isPromise)(h) ? h.then(function(t) { d(e, t, c) }) : d(e, h, c) } }) } function u(e, t) { if ((i = t.remuxResult).audio || i.video || i.text || i.id3 || i.initSegment) { var i, r = [], n = t.remuxResult, a = n.audio, s = n.video; a && l(r, a), s && l(r, s), e.postMessage({ event: "transmuxComplete", data: t }, r) } } function l(e, t) { t.data1 && e.push(t.data1.buffer), t.data2 && e.push(t.data2.buffer) } function d(e, t, i) { t.forEach(function(t) { u(e, t) }), e.postMessage({ event: "flush", data: i }) } }, "./src/demux/transmuxer.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return y }), i.d(t, "isPromise", function() { return b }), i.d(t, "TransmuxConfig", function() { return w }), i.d(t, "TransmuxState", function() { return E }); var r, n = i("./src/events.ts"), a = i("./src/errors.ts"), s = i("./src/crypt/decrypter.ts"), o = i("./src/demux/aacdemuxer.ts"), u = i("./src/demux/mp4demuxer.ts"), l = i("./src/demux/tsdemuxer.ts"), d = i("./src/demux/mp3demuxer.ts"), c = i("./src/remux/mp4-remuxer.ts"), h = i("./src/remux/passthrough-remuxer.ts"), f = i("./src/demux/chunk-cache.ts"), p = i("./src/utils/mp4-tools.ts"), m = i("./src/utils/logger.ts"); try { r = self.performance.now.bind(self.performance) } catch (e) { m.logger.debug("Unable to use Performance API on this environment"), r = self.Date.now } var g = [{ demux: l.default, remux: c.default }, { demux: u.default, remux: h.default }, { demux: o.default, remux: c.default }, { demux: d.default, remux: c.default }], v = 1024; g.forEach(function(e) { var t = e.demux; v = Math.max(v, t.minProbeByteLength) }); var y = function() { function e(e, t, i, r, n) { this.observer = void 0, this.typeSupported = void 0, this.config = void 0, this.vendor = void 0, this.id = void 0, this.demuxer = void 0, this.remuxer = void 0, this.decrypter = void 0, this .probe = void 0, this.decryptionPromise = null, this.transmuxConfig = void 0, this .currentTransmuxState = void 0, this.cache = new f.default, this.observer = e, this .typeSupported = t, this.config = i, this.vendor = r, this.id = n } var t = e.prototype; return t.configure = function(e) { this.transmuxConfig = e, this.decrypter && this.decrypter.reset() }, t.push = function(e, t, i, n) { var a = this, s = i.transmuxing; s.executeStart = r(); var o = new Uint8Array(e), u = this.cache, l = this.config, d = this.currentTransmuxState, c = this.transmuxConfig; n && (this.currentTransmuxState = n); var h = function(e, t) { var i = null; e.byteLength > 0 && null != t && null != t.key && null !== t.iv && null != t.method && (i = t); return i }(o, t); if (h && "AES-128" === h.method) { var f = this.getDecrypter(); if (!l.enableSoftwareAES) return this.decryptionPromise = f.webCryptoDecrypt(o, h.key.buffer, h.iv.buffer).then(function(e) { var t = a.push(e, null, i); return a.decryptionPromise = null, t }), this.decryptionPromise; var m = f.softwareDecrypt(o, h.key.buffer, h.iv.buffer); if (!m) return s.executeEnd = r(), _(i); o = new Uint8Array(m) } var g = n || d, v = g.contiguous, y = g.discontinuity, b = g.trackSwitch, w = g.accurateTimeOffset, E = g.timeOffset, T = g.initSegmentChange, S = c.audioCodec, A = c.videoCodec, k = c.defaultInitPts, R = c.duration, M = c.initSegmentData; if ((y || b || T) && this.resetInitSegment(M, S, A, R), (y || T) && this.resetInitialTimestamp( k), v || this.resetContiguity(), this.needsProbing(o, y, b)) { if (u.dataLength) { var O = u.flush(); o = Object(p.appendUint8Array)(O, o) } this.configureTransmuxer(o, c) } var C = this.transmux(o, h, E, w, i), D = this.currentTransmuxState; return D.contiguous = !0, D.discontinuity = !1, D.trackSwitch = !1, s.executeEnd = r(), C }, t.flush = function(e) { var t = this, i = e.transmuxing; i.executeStart = r(); var s = this.decrypter, o = this.cache, u = this.currentTransmuxState, l = this.decryptionPromise; if (l) return l.then(function() { return t.flush(e) }); var d = [], c = u.timeOffset; if (s) { var h = s.flush(); h && d.push(this.push(h, null, e)) } var f = o.dataLength; o.reset(); var p = this.demuxer, m = this.remuxer; if (!p || !m) return f >= v && this.observer.emit(n.Events.ERROR, n.Events.ERROR, { type: a.ErrorTypes.MEDIA_ERROR, details: a.ErrorDetails.FRAG_PARSING_ERROR, fatal: !0, reason: "no demux matching with content found" }), i.executeEnd = r(), [_(e)]; var g = p.flush(c); return b(g) ? g.then(function(i) { return t.flushRemux(d, i, e), d }) : (this.flushRemux(d, g, e), d) }, t.flushRemux = function(e, t, i) { var n = t.audioTrack, a = t.videoTrack, s = t.id3Track, o = t.textTrack, u = this.currentTransmuxState, l = u.accurateTimeOffset, d = u.timeOffset; m.logger.log("[transmuxer.ts]: Flushed fragment " + i.sn + (i.part > -1 ? " p: " + i.part : "") + " of level " + i.level); var c = this.remuxer.remux(n, a, s, o, d, l, !0, this.id); e.push({ remuxResult: c, chunkMeta: i }), i.transmuxing.executeEnd = r() }, t.resetInitialTimestamp = function(e) { var t = this.demuxer, i = this.remuxer; t && i && (t.resetTimeStamp(e), i.resetTimeStamp(e)) }, t.resetContiguity = function() { var e = this.demuxer, t = this.remuxer; e && t && (e.resetContiguity(), t.resetNextTimestamp()) }, t.resetInitSegment = function(e, t, i, r) { var n = this.demuxer, a = this.remuxer; n && a && (n.resetInitSegment(e, t, i, r), a.resetInitSegment(e, t, i)) }, t.destroy = function() { this.demuxer && (this.demuxer.destroy(), this.demuxer = void 0), this.remuxer && (this.remuxer .destroy(), this.remuxer = void 0) }, t.transmux = function(e, t, i, r, n) { return t && "SAMPLE-AES" === t.method ? this.transmuxSampleAes(e, t, i, r, n) : this .transmuxUnencrypted(e, i, r, n) }, t.transmuxUnencrypted = function(e, t, i, r) { var n = this.demuxer.demux(e, t, !1, !this.config.progressive), a = n.audioTrack, s = n.videoTrack, o = n.id3Track, u = n.textTrack; return { remuxResult: this.remuxer.remux(a, s, o, u, t, i, !1, this.id), chunkMeta: r } }, t.transmuxSampleAes = function(e, t, i, r, n) { var a = this; return this.demuxer.demuxSampleAes(e, t, i).then(function(e) { return { remuxResult: a.remuxer.remux(e.audioTrack, e.videoTrack, e.id3Track, e.textTrack, i, r, !1, a.id), chunkMeta: n } }) }, t.configureTransmuxer = function(e, t) { for (var i, r = this.config, n = this.observer, a = this.typeSupported, s = this.vendor, o = t .audioCodec, l = t.defaultInitPts, d = t.duration, c = t.initSegmentData, f = t.videoCodec, p = 0, v = g.length; p < v; p++) if (g[p].demux.probe(e)) { i = g[p]; break } i || (m.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"), i = { demux: u.default, remux: h.default }); var y = this.demuxer, _ = this.remuxer, b = i.remux, w = i.demux; _ && _ instanceof b || (this.remuxer = new b(n, r, a, s)), y && y instanceof w || (this .demuxer = new w(n, r, a), this.probe = w.probe), this.resetInitSegment(c, o, f, d), this .resetInitialTimestamp(l) }, t.needsProbing = function(e, t, i) { return !this.demuxer || !this.remuxer || t || i }, t.getDecrypter = function() { var e = this.decrypter; return e || (e = this.decrypter = new s.default(this.observer, this.config)), e }, e }(); var _ = function(e) { return { remuxResult: {}, chunkMeta: e } }; function b(e) { return "then" in e && e.then instanceof Function } var w = function(e, t, i, r, n) { this.audioCodec = void 0, this.videoCodec = void 0, this.initSegmentData = void 0, this.duration = void 0, this.defaultInitPts = void 0, this.audioCodec = e, this.videoCodec = t, this .initSegmentData = i, this.duration = r, this.defaultInitPts = n }, E = function(e, t, i, r, n, a) { this.discontinuity = void 0, this.contiguous = void 0, this.accurateTimeOffset = void 0, this .trackSwitch = void 0, this.timeOffset = void 0, this.initSegmentChange = void 0, this .discontinuity = e, this.contiguous = t, this.accurateTimeOffset = i, this.trackSwitch = r, this .timeOffset = n, this.initSegmentChange = a } }, "./src/demux/tsdemuxer.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "discardEPB", function() { return v }); var r = i("./src/demux/adts.ts"), n = i("./src/demux/mpegaudio.ts"), a = i("./src/demux/exp-golomb.ts"), s = i("./src/demux/sample-aes.ts"), o = i("./src/events.ts"), u = i("./src/utils/mp4-tools.ts"), l = i("./src/utils/logger.ts"), d = i("./src/errors.ts"), c = function() { function e(e, t, i) { this.observer = void 0, this.config = void 0, this.typeSupported = void 0, this.sampleAes = null, this.pmtParsed = !1, this.audioCodec = void 0, this.videoCodec = void 0, this._duration = 0, this._pmtId = -1, this._avcTrack = void 0, this._audioTrack = void 0, this._id3Track = void 0, this._txtTrack = void 0, this.aacOverFlow = null, this.avcSample = null, this.remainderData = null, this.observer = e, this.config = t, this.typeSupported = i } e.probe = function(t) { var i = e.syncOffset(t); return !(i < 0) && (i && l.logger.warn("MPEG2-TS detected but first sync word found @ offset " + i + ", junk ahead ?"), !0) }, e.syncOffset = function(e) { for (var t = Math.min(1e3, e.length - 564), i = 0; i < t;) { if (71 === e[i] && 71 === e[i + 188] && 71 === e[i + 376]) return i; i++ } return -1 }, e.createTrack = function(e, t) { return { container: "video" === e || "audio" === e ? "video/mp2t" : void 0, type: e, id: u.RemuxerTrackIdConfig[e], pid: -1, inputTimeScale: 9e4, sequenceNumber: 0, samples: [], dropped: 0, duration: "audio" === e ? t : void 0 } }; var t = e.prototype; return t.resetInitSegment = function(t, i, r, n) { this.pmtParsed = !1, this._pmtId = -1, this._avcTrack = e.createTrack("video"), this ._audioTrack = e.createTrack("audio", n), this._id3Track = e.createTrack("id3"), this ._txtTrack = e.createTrack("text"), this._audioTrack.segmentCodec = "aac", this.aacOverFlow = null, this.avcSample = null, this.audioCodec = i, this.videoCodec = r, this._duration = n }, t.resetTimeStamp = function() {}, t.resetContiguity = function() { var e = this._audioTrack, t = this._avcTrack, i = this._id3Track; e && (e.pesData = null), t && (t.pesData = null), i && (i.pesData = null), this.aacOverFlow = null }, t.demux = function(t, i, r, n) { var a; void 0 === r && (r = !1), void 0 === n && (n = !1), r || (this.sampleAes = null); var s = this._avcTrack, c = this._audioTrack, h = this._id3Track, g = this._txtTrack, v = s.pid, y = s.pesData, _ = c.pid, b = h.pid, w = c.pesData, E = h.pesData, T = !1, S = this.pmtParsed, A = this._pmtId, k = t.length; if (this.remainderData && (k = (t = Object(u.appendUint8Array)(this.remainderData, t)).length, this.remainderData = null), k < 188 && !n) return this.remainderData = t, { audioTrack: c, videoTrack: s, id3Track: h, textTrack: g }; var R = Math.max(0, e.syncOffset(t)); (k -= (k + R) % 188) < t.byteLength && !n && (this.remainderData = new Uint8Array(t.buffer, k, t .buffer.byteLength - k)); for (var M = 0, O = R; O < k; O += 188) if (71 === t[O]) { var C = !!(64 & t[O + 1]), D = ((31 & t[O + 1]) << 8) + t[O + 2], I = void 0; if ((48 & t[O + 3]) >> 4 > 1) { if ((I = O + 5 + t[O + 4]) === O + 188) continue } else I = O + 4; switch (D) { case v: C && (y && (a = m(y)) && this.parseAVCPES(s, g, a, !1), y = { data: [], size: 0 }), y && (y.data.push(t.subarray(I, O + 188)), y.size += O + 188 - I); break; case _: if (C) { if (w && (a = m(w))) switch (c.segmentCodec) { case "aac": this.parseAACPES(c, a); break; case "mp3": this.parseMPEGPES(c, a) } w = { data: [], size: 0 } } w && (w.data.push(t.subarray(I, O + 188)), w.size += O + 188 - I); break; case b: C && (E && (a = m(E)) && this.parseID3PES(h, a), E = { data: [], size: 0 }), E && (E.data.push(t.subarray(I, O + 188)), E.size += O + 188 - I); break; case 0: C && (I += t[I] + 1), A = this._pmtId = f(t, I); break; case A: C && (I += t[I] + 1); var L = p(t, I, this.typeSupported, r, this.observer); (v = L.avc) > 0 && (s.pid = v), (_ = L.audio) > 0 && (c.pid = _, c.segmentCodec = L .segmentCodec), (b = L.id3) > 0 && (h.pid = b), T && !S && (l.logger.log( "reparse from beginning"), T = !1, O = R - 188), S = this.pmtParsed = !0; break; case 17: case 8191: break; default: T = !0 } } else M++; M > 0 && this.observer.emit(o.Events.ERROR, o.Events.ERROR, { type: d.ErrorTypes.MEDIA_ERROR, details: d.ErrorDetails.FRAG_PARSING_ERROR, fatal: !1, reason: "Found " + M + " TS packet/s that do not start with 0x47" }), s.pesData = y, c.pesData = w, h.pesData = E; var x = { audioTrack: c, videoTrack: s, id3Track: h, textTrack: g }; return n && this.extractRemainingSamples(x), x }, t.flush = function() { var e, t = this.remainderData; return this.remainderData = null, e = t ? this.demux(t, -1, !1, !0) : { videoTrack: this._avcTrack, audioTrack: this._audioTrack, id3Track: this._id3Track, textTrack: this._txtTrack }, this.extractRemainingSamples(e), this.sampleAes ? this.decrypt(e, this.sampleAes) : e }, t.extractRemainingSamples = function(e) { var t, i = e.audioTrack, r = e.videoTrack, n = e.id3Track, a = e.textTrack, s = r.pesData, o = i.pesData, u = n.pesData; if (s && (t = m(s)) ? (this.parseAVCPES(r, a, t, !0), r.pesData = null) : r.pesData = s, o && ( t = m(o))) { switch (i.segmentCodec) { case "aac": this.parseAACPES(i, t); break; case "mp3": this.parseMPEGPES(i, t) } i.pesData = null } else null !== o && void 0 !== o && o.size && l.logger.log( "last AAC PES packet truncated,might overlap between fragments"), i.pesData = o; u && (t = m(u)) ? (this.parseID3PES(n, t), n.pesData = null) : n.pesData = u }, t.demuxSampleAes = function(e, t, i) { var r = this.demux(e, i, !0, !this.config.progressive), n = this.sampleAes = new s.default(this.observer, this.config, t); return this.decrypt(r, n) }, t.decrypt = function(e, t) { return new Promise(function(i) { var r = e.audioTrack, n = e.videoTrack; r.samples && "aac" === r.segmentCodec ? t.decryptAacSamples(r.samples, 0, function() { n.samples ? t.decryptAvcSamples(n.samples, 0, 0, function() { i(e) }) : i(e) }) : n.samples && t.decryptAvcSamples(n.samples, 0, 0, function() { i(e) }) }) }, t.destroy = function() { this._duration = 0 }, t.parseAVCPES = function(e, t, i, r) { var n, s = this, o = this.parseAVCNALu(e, i.data), l = this.avcSample, d = !1; i.data = null, l && o.length && !e.audFound && (g(l, e), l = this.avcSample = h(!1, i.pts, i .dts, "")), o.forEach(function(r) { switch (r.type) { case 1: n = !0, l || (l = s.avcSample = h(!0, i.pts, i.dts, "")), l.frame = !0; var o = r.data; if (d && o.length > 4) { var c = new a.default(o).readSliceType(); 2 !== c && 4 !== c && 7 !== c && 9 !== c || (l.key = !0) } break; case 5: n = !0, l || (l = s.avcSample = h(!0, i.pts, i.dts, "")), l.key = !0, l.frame = !0; break; case 6: n = !0, Object(u.parseSEIMessageFromNALu)(v(r.data), i.pts, t.samples); break; case 7: if (n = !0, d = !0, !e.sps) { var f = new a.default(r.data).readSPS(); e.width = f.width, e.height = f.height, e.pixelRatio = f.pixelRatio, e.sps = [r .data], e.duration = s._duration; for (var p = r.data.subarray(1, 4), m = "avc1.", y = 0; y < 3; y++) { var _ = p[y].toString(16); _.length < 2 && (_ = "0" + _), m += _ } e.codec = m } break; case 8: n = !0, e.pps || (e.pps = [r.data]); break; case 9: n = !1, e.audFound = !0, l && g(l, e), l = s.avcSample = h(!1, i.pts, i.dts, ""); break; case 12: n = !1; break; default: n = !1, l && (l.debug += "unknown NAL " + r.type + " ") } l && n && l.units.push(r) }), r && l && (g(l, e), this.avcSample = null) }, t.getLastNalUnit = function(e) { var t, i, r = this.avcSample; if (r && 0 !== r.units.length || (r = e[e.length - 1]), null !== (t = r) && void 0 !== t && t .units) { var n = r.units; i = n[n.length - 1] } return i }, t.parseAVCNALu = function(e, t) { var i, r, n = t.byteLength, a = e.naluState || 0, s = a, o = [], u = 0, l = -1, d = 0; for (-1 === a && (l = 0, d = 31 & t[0], a = 0, u = 1); u < n;) if (i = t[u++], a) if (1 !== a) if (i) if (1 === i) { if (l >= 0) { var c = { data: t.subarray(l, u - a - 1), type: d }; o.push(c) } else { var h = this.getLastNalUnit(e.samples); if (h && (s && u <= 4 - s && h.state && (h.data = h.data.subarray(0, h.data .byteLength - s)), (r = u - a - 1) > 0)) { var f = new Uint8Array(h.data.byteLength + r); f.set(h.data, 0), f.set(t.subarray(0, r), h.data.byteLength), h.data = f, h .state = 0 } } u < n ? (l = u, d = 31 & t[u], a = 0) : a = -1 } else a = 0; else a = 3; else a = i ? 0 : 2; else a = i ? 0 : 1; if (l >= 0 && a >= 0) { var p = { data: t.subarray(l, n), type: d, state: a }; o.push(p) } if (0 === o.length) { var m = this.getLastNalUnit(e.samples); if (m) { var g = new Uint8Array(m.data.byteLength + t.byteLength); g.set(m.data, 0), g.set(t, m.data.byteLength), m.data = g } } return e.naluState = a, o }, t.parseAACPES = function(e, t) { var i, n, a, s, u, c = 0, h = this.aacOverFlow, f = t.data; if (h) { this.aacOverFlow = null; var p = h.sample.unit.byteLength, m = Math.min(h.missing, p), g = p - m; h.sample.unit.set(f.subarray(0, m), g), e.samples.push(h.sample), c = h.missing } for (i = c, n = f.length; i < n - 1 && !r.isHeader(f, i); i++); if (i !== c && (i < n - 1 ? (a = "AAC PES did not start with ADTS header,offset:" + i, s = !1) : (a = "no ADTS header found in AAC PES", s = !0), l.logger.warn("parsing error:" + a), this .observer.emit(o.Events.ERROR, o.Events.ERROR, { type: d.ErrorTypes.MEDIA_ERROR, details: d.ErrorDetails.FRAG_PARSING_ERROR, fatal: s, reason: a }), s)) return; if (r.initTrackConfig(e, this.observer, f, i, this.audioCodec), void 0 !== t.pts) u = t.pts; else { if (!h) return void l.logger.warn("[tsdemuxer]: AAC PES unknown PTS"); var v = r.getFrameDuration(e.samplerate); u = h.sample.pts + v } for (var y = 0; i < n;) { if (r.isHeader(f, i)) { if (i + 5 < n) { var _ = r.appendFrame(e, f, i, u, y); if (_) { if (!_.missing) { i += _.length, y++; continue } this.aacOverFlow = _ } } break } i++ } }, t.parseMPEGPES = function(e, t) { var i = t.data, r = i.length, a = 0, s = 0, o = t.pts; if (void 0 !== o) for (; s < r;) if (n.isHeader(i, s)) { var u = n.appendFrame(e, i, s, o, a); if (!u) break; s += u.length, a++ } else s++; else l.logger.warn("[tsdemuxer]: MPEG PES unknown PTS") }, t.parseID3PES = function(e, t) { void 0 !== t.pts ? e.samples.push(t) : l.logger.warn("[tsdemuxer]: ID3 PES unknown PTS") }, e }(); function h(e, t, i, r) { return { key: e, frame: !1, pts: t, dts: i, units: [], debug: r, length: 0 } } function f(e, t) { return (31 & e[t + 10]) << 8 | e[t + 11] } function p(e, t, i, r, n) { var a = { audio: -1, avc: -1, id3: -1, segmentCodec: "aac" }, s = t + 3 + ((15 & e[t + 1]) << 8 | e[t + 2]) - 4; for (t += 12 + ((15 & e[t + 10]) << 8 | e[t + 11]); t < s;) { var u = (31 & e[t + 1]) << 8 | e[t + 2]; switch (e[t]) { case 207: if (!r) { l.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream"); break } case 15: -1 === a.audio && (a.audio = u); break; case 21: -1 === a.id3 && (a.id3 = u); break; case 219: if (!r) { l.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream"); break } case 27: -1 === a.avc && (a.avc = u); break; case 3: case 4: !0 !== i.mpeg && !0 !== i.mp3 ? l.logger.log( "MPEG audio found, not supported in this browser") : -1 === a.audio && (a.audio = u, a .segmentCodec = "mp3"); break; case 36: n.emit(o.Events.ERROR, o.Events.ERROR, { type: d.ErrorTypes.MEDIA_ERROR, details: d.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal: !1, reason: "Unsupported HEVC stream type found 0x24" }), l.logger.warn("Unsupported HEVC stream type found") } t += 5 + ((15 & e[t + 3]) << 8 | e[t + 4]) } return a } function m(e) { var t, i, r, n, a, s = 0, o = e.data; if (!e || 0 === e.size) return null; for (; o[0].length < 19 && o.length > 1;) { var u = new Uint8Array(o[0].length + o[1].length); u.set(o[0]), u.set(o[1], o[0].length), o[0] = u, o.splice(1, 1) } if (1 === ((t = o[0])[0] << 16) + (t[1] << 8) + t[2]) { if ((i = (t[4] << 8) + t[5]) && i > e.size - 6) return null; var d = t[7]; 192 & d && (n = 536870912 * (14 & t[9]) + 4194304 * (255 & t[10]) + 16384 * (254 & t[11]) + 128 * ( 255 & t[12]) + (254 & t[13]) / 2, 64 & d ? n - (a = 536870912 * (14 & t[14]) + 4194304 * ( 255 & t[15]) + 16384 * (254 & t[16]) + 128 * (255 & t[17]) + (254 & t[18]) / 2) > 54e5 && (l .logger.warn(Math.round((n - a) / 9e4) + "s delta between PTS and DTS, align them"), n = a) : a = n); var c = (r = t[8]) + 9; if (e.size <= c) return null; e.size -= c; for (var h = new Uint8Array(e.size), f = 0, p = o.length; f < p; f++) { var m = (t = o[f]).byteLength; if (c) { if (c > m) { c -= m; continue } t = t.subarray(c), m -= c, c = 0 } h.set(t, s), s += m } return i && (i -= r + 3), { data: h, pts: n, dts: a, len: i } } return null } function g(e, t) { if (e.units.length && e.frame) { if (void 0 === e.pts) { var i = t.samples, r = i.length; if (!r) return void t.dropped++; var n = i[r - 1]; e.pts = n.pts, e.dts = n.dts } t.samples.push(e) } e.debug.length && l.logger.log(e.pts + "/" + e.dts + ":" + e.debug) } function v(e) { for (var t = e.byteLength, i = [], r = 1; r < t - 2;) 0 === e[r] && 0 === e[r + 1] && 3 === e[r + 2] ? (i.push(r + 2), r += 2) : r++; if (0 === i.length) return e; var n = t - i.length, a = new Uint8Array(n), s = 0; for (r = 0; r < n; s++, r++) s === i[0] && (s++, i.shift()), a[r] = e[s]; return a } c.minProbeByteLength = 188, t.default = c }, "./src/errors.ts": function(e, t, i) { "use strict"; var r, n; i.r(t), i.d(t, "ErrorTypes", function() { return r }), i.d(t, "ErrorDetails", function() { return n }), function(e) { e.NETWORK_ERROR = "networkError", e.MEDIA_ERROR = "mediaError", e.KEY_SYSTEM_ERROR = "keySystemError", e.MUX_ERROR = "muxError", e.OTHER_ERROR = "otherError" }(r || (r = {})), function(e) { e.KEY_SYSTEM_NO_KEYS = "keySystemNoKeys", e.KEY_SYSTEM_NO_ACCESS = "keySystemNoAccess", e .KEY_SYSTEM_NO_SESSION = "keySystemNoSession", e.KEY_SYSTEM_LICENSE_REQUEST_FAILED = "keySystemLicenseRequestFailed", e.KEY_SYSTEM_NO_INIT_DATA = "keySystemNoInitData", e .MANIFEST_LOAD_ERROR = "manifestLoadError", e.MANIFEST_LOAD_TIMEOUT = "manifestLoadTimeOut", e .MANIFEST_PARSING_ERROR = "manifestParsingError", e.MANIFEST_INCOMPATIBLE_CODECS_ERROR = "manifestIncompatibleCodecsError", e.LEVEL_EMPTY_ERROR = "levelEmptyError", e.LEVEL_LOAD_ERROR = "levelLoadError", e.LEVEL_LOAD_TIMEOUT = "levelLoadTimeOut", e.LEVEL_SWITCH_ERROR = "levelSwitchError", e.AUDIO_TRACK_LOAD_ERROR = "audioTrackLoadError", e.AUDIO_TRACK_LOAD_TIMEOUT = "audioTrackLoadTimeOut", e.SUBTITLE_LOAD_ERROR = "subtitleTrackLoadError", e .SUBTITLE_TRACK_LOAD_TIMEOUT = "subtitleTrackLoadTimeOut", e.FRAG_LOAD_ERROR = "fragLoadError", e .FRAG_LOAD_TIMEOUT = "fragLoadTimeOut", e.FRAG_DECRYPT_ERROR = "fragDecryptError", e .FRAG_PARSING_ERROR = "fragParsingError", e.REMUX_ALLOC_ERROR = "remuxAllocError", e .KEY_LOAD_ERROR = "keyLoadError", e.KEY_LOAD_TIMEOUT = "keyLoadTimeOut", e .BUFFER_ADD_CODEC_ERROR = "bufferAddCodecError", e.BUFFER_INCOMPATIBLE_CODECS_ERROR = "bufferIncompatibleCodecsError", e.BUFFER_APPEND_ERROR = "bufferAppendError", e .BUFFER_APPENDING_ERROR = "bufferAppendingError", e.BUFFER_STALLED_ERROR = "bufferStalledError", e .BUFFER_FULL_ERROR = "bufferFullError", e.BUFFER_SEEK_OVER_HOLE = "bufferSeekOverHole", e .BUFFER_NUDGE_ON_STALL = "bufferNudgeOnStall", e.INTERNAL_EXCEPTION = "internalException", e .INTERNAL_ABORTED = "aborted", e.UNKNOWN = "unknown" }(n || (n = {})) }, "./src/events.ts": function(e, t, i) { "use strict"; var r; i.r(t), i.d(t, "Events", function() { return r }), function(e) { e.MEDIA_ATTACHING = "hlsMediaAttaching", e.MEDIA_ATTACHED = "hlsMediaAttached", e.MEDIA_DETACHING = "hlsMediaDetaching", e.MEDIA_DETACHED = "hlsMediaDetached", e.BUFFER_RESET = "hlsBufferReset", e .BUFFER_CODECS = "hlsBufferCodecs", e.BUFFER_CREATED = "hlsBufferCreated", e.BUFFER_APPENDING = "hlsBufferAppending", e.BUFFER_APPENDED = "hlsBufferAppended", e.BUFFER_EOS = "hlsBufferEos", e .BUFFER_FLUSHING = "hlsBufferFlushing", e.BUFFER_FLUSHED = "hlsBufferFlushed", e .MANIFEST_LOADING = "hlsManifestLoading", e.MANIFEST_LOADED = "hlsManifestLoaded", e .MANIFEST_PARSED = "hlsManifestParsed", e.LEVEL_SWITCHING = "hlsLevelSwitching", e .LEVEL_SWITCHED = "hlsLevelSwitched", e.LEVEL_LOADING = "hlsLevelLoading", e.LEVEL_LOADED = "hlsLevelLoaded", e.LEVEL_UPDATED = "hlsLevelUpdated", e.LEVEL_PTS_UPDATED = "hlsLevelPtsUpdated", e.LEVELS_UPDATED = "hlsLevelsUpdated", e.AUDIO_TRACKS_UPDATED = "hlsAudioTracksUpdated", e .AUDIO_TRACK_SWITCHING = "hlsAudioTrackSwitching", e.AUDIO_TRACK_SWITCHED = "hlsAudioTrackSwitched", e.AUDIO_TRACK_LOADING = "hlsAudioTrackLoading", e.AUDIO_TRACK_LOADED = "hlsAudioTrackLoaded", e.SUBTITLE_TRACKS_UPDATED = "hlsSubtitleTracksUpdated", e .SUBTITLE_TRACKS_CLEARED = "hlsSubtitleTracksCleared", e.SUBTITLE_TRACK_SWITCH = "hlsSubtitleTrackSwitch", e.SUBTITLE_TRACK_LOADING = "hlsSubtitleTrackLoading", e .SUBTITLE_TRACK_LOADED = "hlsSubtitleTrackLoaded", e.SUBTITLE_FRAG_PROCESSED = "hlsSubtitleFragProcessed", e.CUES_PARSED = "hlsCuesParsed", e.NON_NATIVE_TEXT_TRACKS_FOUND = "hlsNonNativeTextTracksFound", e.INIT_PTS_FOUND = "hlsInitPtsFound", e.FRAG_LOADING = "hlsFragLoading", e.FRAG_LOAD_EMERGENCY_ABORTED = "hlsFragLoadEmergencyAborted", e.FRAG_LOADED = "hlsFragLoaded", e.FRAG_DECRYPTED = "hlsFragDecrypted", e.FRAG_PARSING_INIT_SEGMENT = "hlsFragParsingInitSegment", e.FRAG_PARSING_USERDATA = "hlsFragParsingUserdata", e .FRAG_PARSING_METADATA = "hlsFragParsingMetadata", e.FRAG_PARSED = "hlsFragParsed", e .FRAG_BUFFERED = "hlsFragBuffered", e.FRAG_CHANGED = "hlsFragChanged", e.FPS_DROP = "hlsFpsDrop", e.FPS_DROP_LEVEL_CAPPING = "hlsFpsDropLevelCapping", e.ERROR = "hlsError", e.DESTROYING = "hlsDestroying", e.KEY_LOADING = "hlsKeyLoading", e.KEY_LOADED = "hlsKeyLoaded", e .LIVE_BACK_BUFFER_REACHED = "hlsLiveBackBufferReached", e.BACK_BUFFER_REACHED = "hlsBackBufferReached", e.RECORDING = "recording" }(r || (r = {})) }, "./src/hls.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return y }); var r = i("./node_modules/url-toolkit/src/url-toolkit.js"), n = i("./src/loader/playlist-loader.ts"), a = i("./src/loader/key-loader.ts"), s = i("./src/controller/id3-track-controller.ts"), o = i("./src/controller/latency-controller.ts"), u = i("./src/controller/level-controller.ts"), l = i("./src/controller/fragment-tracker.ts"), d = i("./src/controller/stream-controller.ts"), c = i("./src/is-supported.ts"), h = i("./src/utils/logger.ts"), f = i("./src/config.ts"), p = i("./node_modules/eventemitter3/index.js"), m = i("./src/events.ts"), g = i("./src/errors.ts"); function v(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var y = function() { function e(t) { void 0 === t && (t = {}), this.config = void 0, this.userConfig = void 0, this.coreComponents = void 0, this.networkControllers = void 0, this._emitter = new p.EventEmitter, this ._autoLevelCapping = void 0, this.abrController = void 0, this.bufferController = void 0, this .capLevelController = void 0, this.latencyController = void 0, this.levelController = void 0, this.streamController = void 0, this.audioTrackController = void 0, this .subtitleTrackController = void 0, this.emeController = void 0, this.cmcdController = void 0, this._media = null, this.url = null; var i = this.config = Object(f.mergeConfig)(e.DefaultConfig, t); this.userConfig = t, Object(h.enableLogs)(i.debug), this._autoLevelCapping = -1, i.progressive && Object(f.enableStreamingMode)(i); var r = i.abrController, c = i.bufferController, m = i.capLevelController, g = i.fpsController, v = this.abrController = new r(this), y = this.bufferController = new c(this), _ = this.capLevelController = new m(this), b = new g(this), w = new n.default(this), E = new a.default(this), T = new s.default(this), S = this.levelController = new u.default(this), A = new l.FragmentTracker(this), k = this.streamController = new d.default(this, A); _.setStreamController(k), b.setStreamController(k); var R = [S, k]; this.networkControllers = R; var M = [w, E, v, y, _, b, T, A]; this.audioTrackController = this.createController(i.audioTrackController, null, R), this .createController(i.audioStreamController, A, R), this.subtitleTrackController = this .createController(i.subtitleTrackController, null, R), this.createController(i .subtitleStreamController, A, R), this.createController(i.timelineController, null, M), this .emeController = this.createController(i.emeController, null, M), this.cmcdController = this .createController(i.cmcdController, null, M), this.latencyController = this.createController(o .default, null, M), this.coreComponents = M } e.isSupported = function() { return Object(c.isSupported)() }; var t, i, y, _ = e.prototype; return _.createController = function(e, t, i) { if (e) { var r = t ? new e(this, t) : new e(this); return i && i.push(r), r } return null }, _.on = function(e, t, i) { void 0 === i && (i = this), this._emitter.on(e, t, i) }, _.once = function(e, t, i) { void 0 === i && (i = this), this._emitter.once(e, t, i) }, _.removeAllListeners = function(e) { this._emitter.removeAllListeners(e) }, _.off = function(e, t, i, r) { void 0 === i && (i = this), this._emitter.off(e, t, i, r) }, _.listeners = function(e) { return this._emitter.listeners(e) }, _.emit = function(e, t, i) { return this._emitter.emit(e, t, i) }, _.trigger = function(e, t) { if (this.config.debug) return this.emit(e, e, t); try { return this.emit(e, e, t) } catch (t) { h.logger.error("An internal error happened while handling event " + e + '. Error message: "' + t.message + '". Here is a stacktrace:', t), this.trigger(m.Events.ERROR, { type: g.ErrorTypes.OTHER_ERROR, details: g.ErrorDetails.INTERNAL_EXCEPTION, fatal: !1, event: e, error: t }) } return !1 }, _.listenerCount = function(e) { return this._emitter.listenerCount(e) }, _.destroy = function() { h.logger.log("destroy"), this.trigger(m.Events.DESTROYING, void 0), this.detachMedia(), this .removeAllListeners(), this._autoLevelCapping = -1, this.url = null, this.networkControllers .forEach(function(e) { return e.destroy() }), this.networkControllers.length = 0, this.coreComponents.forEach(function(e) { return e.destroy() }), this.coreComponents.length = 0 }, _.attachMedia = function(e) { h.logger.log("attachMedia"), this._media = e, this.trigger(m.Events.MEDIA_ATTACHING, { media: e }) }, _.detachMedia = function() { h.logger.log("detachMedia"), this.trigger(m.Events.MEDIA_DETACHING, void 0), this._media = null }, _.loadSource = function(e) { this.stopLoad(); var t = this.media, i = this.url, n = this.url = r.buildAbsoluteURL(self.location.href, e, { alwaysNormalize: !0 }); h.logger.log("loadSource:" + n), t && i && i !== n && this.bufferController.hasSourceTypes() && (this.detachMedia(), this.attachMedia(t)), this.trigger(m.Events.MANIFEST_LOADING, { url: e }) }, _.startLoad = function(e) { void 0 === e && (e = -1), h.logger.log("startLoad(" + e + ")"), this.networkControllers.forEach( function(t) { t.startLoad(e) }) }, _.stopLoad = function() { h.logger.log("stopLoad"), this.networkControllers.forEach(function(e) { e.stopLoad() }) }, _.swapAudioCodec = function() { h.logger.log("swapAudioCodec"), this.streamController.swapAudioCodec() }, _.recoverMediaError = function() { h.logger.log("recoverMediaError"); var e = this._media; this.detachMedia(), e && this.attachMedia(e) }, _.removeLevel = function(e, t) { void 0 === t && (t = 0), this.levelController.removeLevel(e, t) }, t = e, y = [{ key: "version", get: function() {} }, { key: "Events", get: function() { return m.Events } }, { key: "ErrorTypes", get: function() { return g.ErrorTypes } }, { key: "ErrorDetails", get: function() { return g.ErrorDetails } }, { key: "DefaultConfig", get: function() { return e.defaultConfig ? e.defaultConfig : f.hlsDefaultConfig }, set: function(t) { e.defaultConfig = t } }], (i = [{ key: "levels", get: function() { var e = this.levelController.levels; return e || [] } }, { key: "currentLevel", get: function() { return this.streamController.currentLevel }, set: function(e) { h.logger.log("set currentLevel:" + e), this.loadLevel = e, this.abrController .clearTimer(), this.streamController.immediateLevelSwitch() } }, { key: "nextLevel", get: function() { return this.streamController.nextLevel }, set: function(e) { h.logger.log("set nextLevel:" + e), this.levelController.manualLevel = e, this .streamController.nextLevelSwitch() } }, { key: "loadLevel", get: function() { return this.levelController.level }, set: function(e) { h.logger.log("set loadLevel:" + e), this.levelController.manualLevel = e } }, { key: "nextLoadLevel", get: function() { return this.levelController.nextLoadLevel }, set: function(e) { this.levelController.nextLoadLevel = e } }, { key: "firstLevel", get: function() { return Math.max(this.levelController.firstLevel, this.minAutoLevel) }, set: function(e) { h.logger.log("set firstLevel:" + e), this.levelController.firstLevel = e } }, { key: "startLevel", get: function() { return this.levelController.startLevel }, set: function(e) { h.logger.log("set startLevel:" + e), -1 !== e && (e = Math.max(e, this.minAutoLevel)), this.levelController.startLevel = e } }, { key: "capLevelToPlayerSize", get: function() { return this.config.capLevelToPlayerSize }, set: function(e) { var t = !!e; t !== this.config.capLevelToPlayerSize && (t ? this.capLevelController.startCapping() : (this.capLevelController.stopCapping(), this.autoLevelCapping = -1, this .streamController.nextLevelSwitch()), this.config.capLevelToPlayerSize = t) } }, { key: "autoLevelCapping", get: function() { return this._autoLevelCapping }, set: function(e) { this._autoLevelCapping !== e && (h.logger.log("set autoLevelCapping:" + e), this ._autoLevelCapping = e) } }, { key: "bandwidthEstimate", get: function() { var e = this.abrController.bwEstimator; return e ? e.getEstimate() : NaN } }, { key: "autoLevelEnabled", get: function() { return -1 === this.levelController.manualLevel } }, { key: "manualLevel", get: function() { return this.levelController.manualLevel } }, { key: "minAutoLevel", get: function() { var e = this.levels, t = this.config.minAutoBitrate; if (!e) return 0; for (var i = e.length, r = 0; r < i; r++) if (e[r].maxBitrate >= t) return r; return 0 } }, { key: "maxAutoLevel", get: function() { var e = this.levels, t = this.autoLevelCapping; return -1 === t && e && e.length ? e.length - 1 : t } }, { key: "nextAutoLevel", get: function() { return Math.min(Math.max(this.abrController.nextAutoLevel, this.minAutoLevel), this .maxAutoLevel) }, set: function(e) { this.abrController.nextAutoLevel = Math.max(this.minAutoLevel, e) } }, { key: "audioTracks", get: function() { var e = this.audioTrackController; return e ? e.audioTracks : [] } }, { key: "audioTrack", get: function() { var e = this.audioTrackController; return e ? e.audioTrack : -1 }, set: function(e) { var t = this.audioTrackController; t && (t.audioTrack = e) } }, { key: "subtitleTracks", get: function() { var e = this.subtitleTrackController; return e ? e.subtitleTracks : [] } }, { key: "subtitleTrack", get: function() { var e = this.subtitleTrackController; return e ? e.subtitleTrack : -1 }, set: function(e) { var t = this.subtitleTrackController; t && (t.subtitleTrack = e) } }, { key: "media", get: function() { return this._media } }, { key: "subtitleDisplay", get: function() { var e = this.subtitleTrackController; return !!e && e.subtitleDisplay }, set: function(e) { var t = this.subtitleTrackController; t && (t.subtitleDisplay = e) } }, { key: "lowLatencyMode", get: function() { return this.config.lowLatencyMode }, set: function(e) { this.config.lowLatencyMode = e } }, { key: "liveSyncPosition", get: function() { return this.latencyController.liveSyncPosition } }, { key: "latency", get: function() { return this.latencyController.latency } }, { key: "maxLatency", get: function() { return this.latencyController.maxLatency } }, { key: "targetLatency", get: function() { return this.latencyController.targetLatency } }, { key: "drift", get: function() { return this.latencyController.drift } }, { key: "forceStartLoad", get: function() { return this.streamController.forceStartLoad } }]) && v(t.prototype, i), y && v(t, y), Object.defineProperty(t, "prototype", { writable: !1 }), e }(); y.defaultConfig = void 0 }, "./src/is-supported.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "isSupported", function() { return a }), i.d(t, "changeTypeSupported", function() { return s }); var r = i("./src/utils/mediasource-helper.ts"); function n() { return self.SourceBuffer || self.WebKitSourceBuffer } function a() { var e = Object(r.getMediaSource)(); if (!e) return !1; var t = n(), i = e && "function" == typeof e.isTypeSupported && e.isTypeSupported( 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"'), a = !t || t.prototype && "function" == typeof t.prototype.appendBuffer && "function" == typeof t .prototype.remove; return !!i && !!a } function s() { var e, t = n(); return "function" == typeof(null === t || void 0 === t ? void 0 : null === (e = t.prototype) || void 0 === e ? void 0 : e.changeType) } }, "./src/loader/fragment-loader.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return c }), i.d(t, "LoadError", function() { return f }); var r = i("./src/polyfills/number.ts"), n = i("./src/errors.ts"), a = i("./src/events.ts"); function s(e) { var t = "function" == typeof Map ? new Map : void 0; return (s = function(e) { if (null === e || (i = e, -1 === Function.toString.call(i).indexOf("[native code]"))) return e; var i; if ("function" != typeof e) throw new TypeError( "Super expression must either be null or a function"); if (void 0 !== t) { if (t.has(e)) return t.get(e); t.set(e, r) } function r() { return o(e, arguments, l(this).constructor) } return r.prototype = Object.create(e.prototype, { constructor: { value: r, enumerable: !1, writable: !0, configurable: !0 } }), u(r, e) })(e) } function o(e, t, i) { return (o = function() { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }() ? Reflect.construct.bind() : function(e, t, i) { var r = [null]; r.push.apply(r, t); var n = new(Function.bind.apply(e, r)); return i && u(n, i.prototype), n }).apply(null, arguments) } function u(e, t) { return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } function l(e) { return (l = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) })(e) } var d = Math.pow(2, 17), c = function() { function e(e, t) { this.config = void 0, this.loader = null, this.partLoadTimeout = -1, this.magic = void 0, this .index = void 0, this.hls = void 0, this.hls = t, this.config = e, this.magic = [], this.index = 0 } var t = e.prototype; return t.destroy = function() { this.loader && (this.loader.destroy(), this.loader = null) }, t.abort = function() { this.loader && this.loader.abort() }, t.load = function(e, t) { var i = this, r = e.url; if (!r) return Promise.reject(new f({ type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.FRAG_LOAD_ERROR, fatal: !1, frag: e, networkDetails: null }, "Fragment does not have a " + (r ? "part list" : "url"))); this.abort(); var s = this.config, o = s.fLoader, u = s.loader; return new Promise(function(r, l) { i.loader && i.loader.destroy(); var c = i.loader = e.loader = o ? new o(s) : new u(s), p = h(e), m = { timeout: s.fragLoadingTimeOut, maxRetry: 0, retryDelay: 0, maxRetryDelay: s.fragLoadingMaxRetryTimeout, highWaterMark: "initSegment" === e.sn ? 1 / 0 : d }; e.stats = c.stats, c.load(p, m, { onSuccess: function(t, n, s, o) { i.hls.trigger(a.Events.RECORDING, { data: t.data }), r({ frag: e, part: null, payload: t.data, networkDetails: o }) }, onError: function(t, r, a) { i.resetLoader(e, c), l(new f({ type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.FRAG_LOAD_ERROR, fatal: !1, frag: e, response: t, networkDetails: a })) }, onAbort: function(t, r, a) { i.resetLoader(e, c), l(new f({ type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.INTERNAL_ABORTED, fatal: !1, frag: e, networkDetails: a })) }, onTimeout: function(t, r, a) { i.resetLoader(e, c), l(new f({ type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal: !1, frag: e, networkDetails: a })) }, onProgress: function(i, r, n, a) { t && t({ frag: e, part: null, payload: n, networkDetails: a }) } }) }) }, t.loadPart = function(e, t, i) { var r = this; this.abort(); var a = this.config, s = a.fLoader, o = a.loader; return new Promise(function(u, l) { r.loader && r.loader.destroy(); var c = r.loader = e.loader = s ? new s(a) : new o(a), p = h(e, t), m = { timeout: a.fragLoadingTimeOut, maxRetry: 0, retryDelay: 0, maxRetryDelay: a.fragLoadingMaxRetryTimeout, highWaterMark: d }; t.stats = c.stats, c.load(p, m, { onSuccess: function(n, a, s, o) { r.resetLoader(e, c), r.updateStatsFromPart(e, t); var l = { frag: e, part: t, payload: n.data, networkDetails: o }; i(l), u(l) }, onError: function(i, a, s) { r.resetLoader(e, c), l(new f({ type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.FRAG_LOAD_ERROR, fatal: !1, frag: e, part: t, response: i, networkDetails: s })) }, onAbort: function(i, a, s) { e.stats.aborted = t.stats.aborted, r.resetLoader(e, c), l(new f({ type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.INTERNAL_ABORTED, fatal: !1, frag: e, part: t, networkDetails: s })) }, onTimeout: function(i, a, s) { r.resetLoader(e, c), l(new f({ type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal: !1, frag: e, part: t, networkDetails: s })) } }) }) }, t.updateStatsFromPart = function(e, t) { var i = e.stats, r = t.stats, n = r.total; if (i.loaded += r.loaded, n) { var a = Math.round(e.duration / t.duration), s = Math.min(Math.round(i.loaded / n), a), o = (a - s) * Math.round(i.loaded / s); i.total = i.loaded + o } else i.total = Math.max(i.loaded, i.total); var u = i.loading, l = r.loading; u.start ? u.first += l.first - l.start : (u.start = l.start, u.first = l.first), u.end = l.end }, t.resetLoader = function(e, t) { e.loader = null, this.loader === t && (self.clearTimeout(this.partLoadTimeout), this.loader = null), t.destroy() }, e }(); function h(e, t) { void 0 === t && (t = null); var i = t || e, n = { frag: e, part: t, responseType: "arraybuffer", url: i.url, headers: {}, rangeStart: 0, rangeEnd: 0 }, a = i.byteRangeStartOffset, s = i.byteRangeEndOffset; return Object(r.isFiniteNumber)(a) && Object(r.isFiniteNumber)(s) && (n.rangeStart = a, n.rangeEnd = s), n } var f = function(e) { var t, i; function r(t) { for (var i, r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++) n[a - 1] = arguments[a]; return (i = e.call.apply(e, [this].concat(n)) || this).data = void 0, i.data = t, i } return i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i), r }(s(Error)) }, "./src/loader/fragment.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "ElementaryStreamTypes", function() { return r }), i.d(t, "BaseSegment", function() { return f }), i.d(t, "Fragment", function() { return p }), i.d(t, "Part", function() { return m }); var r, n = i("./src/polyfills/number.ts"), a = i("./node_modules/url-toolkit/src/url-toolkit.js"), s = i("./src/utils/logger.ts"), o = i("./src/loader/level-key.ts"), u = i("./src/loader/load-stats.ts"); function l(e, t) { e.prototype = Object.create(t.prototype), e.prototype.constructor = e, d(e, t) } function d(e, t) { return (d = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } function c(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } function h(e, t, i) { return t && c(e.prototype, t), i && c(e, i), Object.defineProperty(e, "prototype", { writable: !1 }), e }! function(e) { e.AUDIO = "audio", e.VIDEO = "video", e.AUDIOVIDEO = "audiovideo" }(r || (r = {})); var f = function() { function e(e) { var t; this._byteRange = null, this._url = null, this.baseurl = void 0, this.relurl = void 0, this .elementaryStreams = ((t = {})[r.AUDIO] = null, t[r.VIDEO] = null, t[r.AUDIOVIDEO] = null, t), this.baseurl = e } return e.prototype.setByteRange = function(e, t) { var i = e.split("@", 2), r = []; 1 === i.length ? r[0] = t ? t.byteRangeEndOffset : 0 : r[0] = parseInt(i[1]), r[1] = parseInt(i[ 0]) + r[0], this._byteRange = r }, h(e, [{ key: "byteRange", get: function() { return this._byteRange ? this._byteRange : [] } }, { key: "byteRangeStartOffset", get: function() { return this.byteRange[0] } }, { key: "byteRangeEndOffset", get: function() { return this.byteRange[1] } }, { key: "url", get: function() { return !this._url && this.baseurl && this.relurl && (this._url = Object(a .buildAbsoluteURL)(this.baseurl, this.relurl, { alwaysNormalize: !0 })), this._url || "" }, set: function(e) { this._url = e } }]), e }(), p = function(e) { function t(t, i) { var r; return (r = e.call(this, i) || this)._decryptdata = null, r.rawProgramDateTime = null, r .programDateTime = null, r.tagList = [], r.duration = 0, r.sn = 0, r.levelkey = void 0, r.type = void 0, r.loader = null, r.level = -1, r.cc = 0, r.startPTS = void 0, r.endPTS = void 0, r .appendedPTS = void 0, r.startDTS = void 0, r.endDTS = void 0, r.start = 0, r.deltaPTS = void 0, r.maxStartPTS = void 0, r.minEndPTS = void 0, r.stats = new u.LoadStats, r.urlId = 0, r.data = void 0, r.bitrateTest = !1, r.title = null, r.initSegment = null, r.type = t, r } l(t, e); var i = t.prototype; return i.createInitializationVector = function(e) { for (var t = new Uint8Array(16), i = 12; i < 16; i++) t[i] = e >> 8 * (15 - i) & 255; return t }, i.setDecryptDataFromLevelKey = function(e, t) { var i = e; return "AES-128" === (null === e || void 0 === e ? void 0 : e.method) && e.uri && !e.iv && ((i = o.LevelKey.fromURI(e.uri)).method = e.method, i.iv = this.createInitializationVector(t), i .keyFormat = "identity"), i }, i.setElementaryStreamInfo = function(e, t, i, r, n, a) { void 0 === a && (a = !1); var s = this.elementaryStreams, o = s[e]; o ? (o.startPTS = Math.min(o.startPTS, t), o.endPTS = Math.max(o.endPTS, i), o.startDTS = Math .min(o.startDTS, r), o.endDTS = Math.max(o.endDTS, n)) : s[e] = { startPTS: t, endPTS: i, startDTS: r, endDTS: n, partial: a } }, i.clearElementaryStreamInfo = function() { var e = this.elementaryStreams; e[r.AUDIO] = null, e[r.VIDEO] = null, e[r.AUDIOVIDEO] = null }, h(t, [{ key: "decryptdata", get: function() { if (!this.levelkey && !this._decryptdata) return null; if (!this._decryptdata && this.levelkey) { var e = this.sn; "number" != typeof e && (this.levelkey && "AES-128" === this.levelkey.method && !this .levelkey.iv && s.logger.warn( 'missing IV for initialization segment with method="' + this.levelkey.method + '" - compliance issue'), e = 0), this._decryptdata = this .setDecryptDataFromLevelKey(this.levelkey, e) } return this._decryptdata } }, { key: "end", get: function() { return this.start + this.duration } }, { key: "endProgramDateTime", get: function() { if (null === this.programDateTime) return null; if (!Object(n.isFiniteNumber)(this.programDateTime)) return null; var e = Object(n.isFiniteNumber)(this.duration) ? this.duration : 0; return this.programDateTime + 1e3 * e } }, { key: "encrypted", get: function() { var e; return !(null === (e = this.decryptdata) || void 0 === e || !e.keyFormat || !this .decryptdata.uri) } }]), t }(f), m = function(e) { function t(t, i, r, n, a) { var s; (s = e.call(this, r) || this).fragOffset = 0, s.duration = 0, s.gap = !1, s.independent = !1, s .relurl = void 0, s.fragment = void 0, s.index = void 0, s.stats = new u.LoadStats, s.duration = t.decimalFloatingPoint("DURATION"), s.gap = t.bool("GAP"), s.independent = t.bool( "INDEPENDENT"), s.relurl = t.enumeratedString("URI"), s.fragment = i, s.index = n; var o = t.enumeratedString("BYTERANGE"); return o && s.setByteRange(o, a), a && (s.fragOffset = a.fragOffset + a.duration), s } return l(t, e), h(t, [{ key: "start", get: function() { return this.fragment.start + this.fragOffset } }, { key: "end", get: function() { return this.start + this.duration } }, { key: "loaded", get: function() { var e = this.elementaryStreams; return !!(e.audio || e.video || e.audiovideo) } }]), t }(f) }, "./src/loader/key-loader.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return s }); var r = i("./src/events.ts"), n = i("./src/errors.ts"), a = i("./src/utils/logger.ts"), s = function() { function e(e) { this.hls = void 0, this.loaders = {}, this.decryptkey = null, this.decrypturl = null, this.hls = e, this._registerListeners() } var t = e.prototype; return t._registerListeners = function() { this.hls.on(r.Events.KEY_LOADING, this.onKeyLoading, this) }, t._unregisterListeners = function() { this.hls.off(r.Events.KEY_LOADING, this.onKeyLoading) }, t.destroy = function() { for (var e in this._unregisterListeners(), this.loaders) { var t = this.loaders[e]; t && t.destroy() } this.loaders = {} }, t.onKeyLoading = function(e, t) { var i = t.frag, n = i.type, s = this.loaders[n]; if (i.decryptdata) { var o = i.decryptdata.uri; if (o !== this.decrypturl || null === this.decryptkey) { var u = this.hls.config; if (s && (a.logger.warn("abort previous key loader for type:" + n), s.abort()), !o) return void a.logger.warn("key uri is falsy"); var l = u.loader, d = i.loader = this.loaders[n] = new l(u); this.decrypturl = o, this.decryptkey = null; var c = { url: o, frag: i, responseType: "arraybuffer" }, h = { timeout: u.fragLoadingTimeOut, maxRetry: 0, retryDelay: u.fragLoadingRetryDelay, maxRetryDelay: u.fragLoadingMaxRetryTimeout, highWaterMark: 0 }, f = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this) }; d.load(c, h, f) } else this.decryptkey && (i.decryptdata.key = this.decryptkey, this.hls.trigger(r.Events .KEY_LOADED, { frag: i })) } else a.logger.warn("Missing decryption data on fragment in onKeyLoading") }, t.loadsuccess = function(e, t, i) { var n = i.frag; n.decryptdata ? (this.decryptkey = n.decryptdata.key = new Uint8Array(e.data), n.loader = null, delete this.loaders[n.type], this.hls.trigger(r.Events.KEY_LOADED, { frag: n })) : a.logger.error("after key load, decryptdata unset") }, t.loaderror = function(e, t) { var i = t.frag, a = i.loader; a && a.abort(), delete this.loaders[i.type], this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.KEY_LOAD_ERROR, fatal: !1, frag: i, response: e }) }, t.loadtimeout = function(e, t) { var i = t.frag, a = i.loader; a && a.abort(), delete this.loaders[i.type], this.hls.trigger(r.Events.ERROR, { type: n.ErrorTypes.NETWORK_ERROR, details: n.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: !1, frag: i }) }, e }() }, "./src/loader/level-details.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "LevelDetails", function() { return a }); var r = i("./src/polyfills/number.ts"); function n(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var a = function() { function e(e) { this.PTSKnown = !1, this.alignedSliding = !1, this.averagetargetduration = void 0, this.endCC = 0, this.endSN = 0, this.fragments = void 0, this.fragmentHint = void 0, this.partList = null, this .live = !0, this.ageHeader = 0, this.advancedDateTime = void 0, this.updated = !0, this .advanced = !0, this.availabilityDelay = void 0, this.misses = 0, this.needSidxRanges = !1, this .startCC = 0, this.startSN = 0, this.startTimeOffset = null, this.targetduration = 0, this .totalduration = 0, this.type = null, this.url = void 0, this.m3u8 = "", this.version = null, this.canBlockReload = !1, this.canSkipUntil = 0, this.canSkipDateRanges = !1, this .skippedSegments = 0, this.recentlyRemovedDateranges = void 0, this.partHoldBack = 0, this .holdBack = 0, this.partTarget = 0, this.preloadHint = void 0, this.renditionReports = void 0, this.tuneInGoal = 0, this.deltaUpdateFailed = void 0, this.driftStartTime = 0, this .driftEndTime = 0, this.driftStart = 0, this.driftEnd = 0, this.fragments = [], this.url = e } var t, i, a; return e.prototype.reloaded = function(e) { if (!e) return this.advanced = !0, void(this.updated = !0); var t = this.lastPartSn - e.lastPartSn, i = this.lastPartIndex - e.lastPartIndex; this.updated = this.endSN !== e.endSN || !!i || !!t, this.advanced = this.endSN > e.endSN || t > 0 || 0 === t && i > 0, this.updated || this.advanced ? this.misses = Math.floor(.6 * e .misses) : this.misses = e.misses + 1, this.availabilityDelay = e.availabilityDelay }, t = e, (i = [{ key: "hasProgramDateTime", get: function() { return !!this.fragments.length && Object(r.isFiniteNumber)(this.fragments[this.fragments .length - 1].programDateTime) } }, { key: "levelTargetDuration", get: function() { return this.averagetargetduration || this.targetduration || 10 } }, { key: "drift", get: function() { var e = this.driftEndTime - this.driftStartTime; return e > 0 ? 1e3 * (this.driftEnd - this.driftStart) / e : 1 } }, { key: "edge", get: function() { return this.partEnd || this.fragmentEnd } }, { key: "partEnd", get: function() { var e; return null !== (e = this.partList) && void 0 !== e && e.length ? this.partList[this .partList.length - 1].end : this.fragmentEnd } }, { key: "fragmentEnd", get: function() { var e; return null !== (e = this.fragments) && void 0 !== e && e.length ? this.fragments[this .fragments.length - 1].end : 0 } }, { key: "age", get: function() { return this.advancedDateTime ? Math.max(Date.now() - this.advancedDateTime, 0) / 1e3 : 0 } }, { key: "lastPartIndex", get: function() { var e; return null !== (e = this.partList) && void 0 !== e && e.length ? this.partList[this .partList.length - 1].index : -1 } }, { key: "lastPartSn", get: function() { var e; return null !== (e = this.partList) && void 0 !== e && e.length ? this.partList[this .partList.length - 1].fragment.sn : this.endSN } }]) && n(t.prototype, i), a && n(t, a), Object.defineProperty(t, "prototype", { writable: !1 }), e }() }, "./src/loader/level-key.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "LevelKey", function() { return a }); var r = i("./node_modules/url-toolkit/src/url-toolkit.js"); function n(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var a = function() { function e(e, t) { this._uri = null, this.method = null, this.keyFormat = null, this.keyFormatVersions = null, this .keyID = null, this.key = null, this.iv = null, this._uri = t ? Object(r.buildAbsoluteURL)(e, t, { alwaysNormalize: !0 }) : e } var t, i, a; return e.fromURL = function(t, i) { return new e(t, i) }, e.fromURI = function(t) { return new e(t) }, t = e, (i = [{ key: "uri", get: function() { return this._uri } }]) && n(t.prototype, i), a && n(t, a), Object.defineProperty(t, "prototype", { writable: !1 }), e }() }, "./src/loader/load-stats.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "LoadStats", function() { return r }); var r = function() { this.aborted = !1, this.loaded = 0, this.retry = 0, this.total = 0, this.chunkCount = 0, this .bwEstimate = 0, this.loading = { start: 0, first: 0, end: 0 }, this.parsing = { start: 0, end: 0 }, this.buffering = { start: 0, first: 0, end: 0 } } }, "./src/loader/m3u8-parser.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return g }); var r = i("./src/polyfills/number.ts"), n = i("./node_modules/url-toolkit/src/url-toolkit.js"), a = i("./src/loader/fragment.ts"), s = i("./src/loader/level-details.ts"), o = i("./src/loader/level-key.ts"), u = i("./src/utils/attr-list.ts"), l = i("./src/utils/logger.ts"), d = i("./src/utils/codecs.ts"), c = /#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g, h = /#EXT-X-MEDIA:(.*)/g, f = new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source, /(?!#) *(\S[\S ]*)/.source, /#EXT-X-BYTERANGE:*(.+)/.source, /#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, /#.*/.source ].join("|"), "g"), p = new RegExp([/#(EXTM3U)/.source, /#EXT-X-(PLAYLIST-TYPE):(.+)/.source, /#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source, /#EXT-X-(SKIP):(.+)/.source, /#EXT-X-(TARGETDURATION): *(\d+)/.source, /#EXT-X-(KEY):(.+)/.source, /#EXT-X-(START):(.+)/ .source, /#EXT-X-(ENDLIST)/.source, /#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source, /#EXT-X-(DIS)CONTINUITY/.source, /#EXT-X-(VERSION):(\d+)/.source, /#EXT-X-(MAP):(.+)/.source, /#EXT-X-(SERVER-CONTROL):(.+)/.source, /#EXT-X-(PART-INF):(.+)/.source, /#EXT-X-(GAP)/.source, /#EXT-X-(BITRATE):\s*(\d+)/.source, /#EXT-X-(PART):(.+)/.source, /#EXT-X-(PRELOAD-HINT):(.+)/ .source, /#EXT-X-(RENDITION-REPORT):(.+)/.source, /(#)([^:]*):(.*)/.source, /(#)(.*)(?:.*)\r?\n?/ .source ].join("|")), m = /\.(mp4|m4s|m4v|m4a)$/i; var g = function() { function e() {} return e.findGroup = function(e, t) { for (var i = 0; i < e.length; i++) { var r = e[i]; if (r.id === t) return r } }, e.convertAVC1ToAVCOTI = function(e) { var t = e.split("."); if (t.length > 2) { var i = t.shift() + "."; return i += parseInt(t.shift()).toString(16), i += ("000" + parseInt(t.shift()).toString(16)) .slice(-4) } return e }, e.resolve = function(e, t) { return n.buildAbsoluteURL(t, e, { alwaysNormalize: !0 }) }, e.parseMasterPlaylist = function(t, i) { var r, n = [], a = {}, s = !1; for (c.lastIndex = 0; null != (r = c.exec(t));) if (r[1]) { var o = new u.AttrList(r[1]), l = { attrs: o, bitrate: o.decimalInteger("AVERAGE-BANDWIDTH") || o.decimalInteger("BANDWIDTH"), name: o.NAME, url: e.resolve(r[2], i) }, d = o.decimalResolution("RESOLUTION"); d && (l.width = d.width, l.height = d.height), v((o.CODECS || "").split(/[ ,]+/).filter( function(e) { return e }), l), l.videoCodec && -1 !== l.videoCodec.indexOf("avc1") && (l.videoCodec = e .convertAVC1ToAVCOTI(l.videoCodec)), n.push(l) } else if (r[3]) { var h = new u.AttrList(r[3]); h["DATA-ID"] && (s = !0, a[h["DATA-ID"]] = h) } return { levels: n, sessionData: s ? a : null } }, e.parseMasterPlaylistMedia = function(t, i, r, n) { var a; void 0 === n && (n = []); var s = [], o = 0; for (h.lastIndex = 0; null !== (a = h.exec(t));) { var l = new u.AttrList(a[1]); if (l.TYPE === r) { var d = { attrs: l, bitrate: 0, id: o++, groupId: l["GROUP-ID"], instreamId: l["INSTREAM-ID"], name: l.NAME || l.LANGUAGE || "", type: r, default: l.bool("DEFAULT"), autoselect: l.bool("AUTOSELECT"), forced: l.bool("FORCED"), lang: l.LANGUAGE, url: l.URI ? e.resolve(l.URI, i) : "" }; if (n.length) { var c = e.findGroup(n, d.groupId) || n[0]; y(d, c, "audioCodec"), y(d, c, "textCodec") } s.push(d) } } return s }, e.parseLevelPlaylist = function(e, t, i, d, c) { var h, g, v, y = new s.LevelDetails(t), b = y.fragments, w = null, E = 0, T = 0, S = 0, A = 0, k = null, R = new a.Fragment(d, t), M = -1, O = !1; for (f.lastIndex = 0, y.m3u8 = e; null !== (h = f.exec(e));) { O && (O = !1, (R = new a.Fragment(d, t)).start = S, R.sn = E, R.cc = A, R.level = i, w && (R .initSegment = w, R.rawProgramDateTime = w.rawProgramDateTime, w.rawProgramDateTime = null)); var C = h[1]; if (C) { R.duration = parseFloat(C); var D = (" " + h[2]).slice(1); R.title = D || null, R.tagList.push(D ? ["INF", C, D] : ["INF", C]) } else if (h[3]) Object(r.isFiniteNumber)(R.duration) && (R.start = S, v && (R.levelkey = v), R.sn = E, R.level = i, R.cc = A, R.urlId = c, b.push(R), R.relurl = (" " + h[3]).slice(1), _(R, k), k = R, S += R.duration, E++, T = 0, O = !0); else if (h[4]) { var I = (" " + h[4]).slice(1); k ? R.setByteRange(I, k) : R.setByteRange(I) } else if (h[5]) R.rawProgramDateTime = (" " + h[5]).slice(1), R.tagList.push([ "PROGRAM-DATE-TIME", R.rawProgramDateTime ]), -1 === M && (M = b.length); else { if (!(h = h[0].match(p))) { l.logger.warn("No matches on slow regex match for level playlist!"); continue } for (g = 1; g < h.length && void 0 === h[g]; g++); var L = (" " + h[g]).slice(1), x = (" " + h[g + 1]).slice(1), P = h[g + 2] ? (" " + h[g + 2]).slice(1) : ""; switch (L) { case "PLAYLIST-TYPE": y.type = x.toUpperCase(); break; case "MEDIA-SEQUENCE": E = y.startSN = parseInt(x); break; case "SKIP": var U = new u.AttrList(x), N = U.decimalInteger("SKIPPED-SEGMENTS"); if (Object(r.isFiniteNumber)(N)) { y.skippedSegments = N; for (var B = N; B--;) b.unshift(null); E += N } var F = U.enumeratedString("RECENTLY-REMOVED-DATERANGES"); F && (y.recentlyRemovedDateranges = F.split("\t")); break; case "TARGETDURATION": y.targetduration = parseFloat(x); break; case "VERSION": y.version = parseInt(x); break; case "EXTM3U": break; case "ENDLIST": y.live = !1; break; case "#": (x || P) && R.tagList.push(P ? [x, P] : [x]); break; case "DIS": A++; case "GAP": R.tagList.push([L]); break; case "BITRATE": R.tagList.push([L, x]); break; case "DISCONTINUITY-SEQ": A = parseInt(x); break; case "KEY": var j, H = new u.AttrList(x), G = H.enumeratedString("METHOD"), V = H.URI, W = H.hexadecimalInteger("IV"), q = H.enumeratedString("KEYFORMATVERSIONS"), X = H.enumeratedString("KEYID"), z = null != (j = H.enumeratedString("KEYFORMAT")) ? j : "identity"; if (["com.apple.streamingkeydelivery", "com.microsoft.playready", "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", "com.widevine" ].indexOf(z) > -1) { l.logger.warn("Keyformat " + z + " is not supported from the manifest"); continue } if ("identity" !== z) continue; G && (v = o.LevelKey.fromURL(t, V), V && ["AES-128", "SAMPLE-AES", "SAMPLE-AES-CENC"] .indexOf(G) >= 0 && (v.method = G, v.keyFormat = z, X && (v.keyID = X), q && (v .keyFormatVersions = q), v.iv = W)); break; case "START": var K = new u.AttrList(x).decimalFloatingPoint("TIME-OFFSET"); Object(r.isFiniteNumber)(K) && (y.startTimeOffset = K); break; case "MAP": var Y = new u.AttrList(x); R.relurl = Y.URI, Y.BYTERANGE && R.setByteRange(Y.BYTERANGE), R.level = i, R.sn = "initSegment", v && (R.levelkey = v), R.initSegment = null, w = R, O = !0; break; case "SERVER-CONTROL": var Q = new u.AttrList(x); y.canBlockReload = Q.bool("CAN-BLOCK-RELOAD"), y.canSkipUntil = Q.optionalFloat( "CAN-SKIP-UNTIL", 0), y.canSkipDateRanges = y.canSkipUntil > 0 && Q.bool( "CAN-SKIP-DATERANGES"), y.partHoldBack = Q.optionalFloat("PART-HOLD-BACK", 0), y .holdBack = Q.optionalFloat("HOLD-BACK", 0); break; case "PART-INF": var J = new u.AttrList(x); y.partTarget = J.decimalFloatingPoint("PART-TARGET"); break; case "PART": var Z = y.partList; Z || (Z = y.partList = []); var $ = T > 0 ? Z[Z.length - 1] : void 0, ee = T++, te = new a.Part(new u.AttrList(x), R, t, ee, $); Z.push(te), R.duration += te.duration; break; case "PRELOAD-HINT": var ie = new u.AttrList(x); y.preloadHint = ie; break; case "RENDITION-REPORT": var re = new u.AttrList(x); y.renditionReports = y.renditionReports || [], y.renditionReports.push(re); break; default: l.logger.warn("line parsed but not handled: " + h) } } } k && !k.relurl ? (b.pop(), S -= k.duration, y.partList && (y.fragmentHint = k)) : y.partList && (_(R, k), R.cc = A, y.fragmentHint = R); var ne = b.length, ae = b[0], se = b[ne - 1]; if ((S += y.skippedSegments * y.targetduration) > 0 && ne && se) { y.averagetargetduration = S / ne; var oe = se.sn; y.endSN = "initSegment" !== oe ? oe : 0, ae && (y.startCC = ae.cc, ae.initSegment || y .fragments.every(function(e) { return e.relurl && (t = e.relurl, m.test(null != (i = null === (r = n.parseURL(t)) || void 0 === r ? void 0 : r.path) ? i : "")); var t, i, r }) && (l.logger.warn( "MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX" ), (R = new a.Fragment(d, t)).relurl = se.relurl, R.level = i, R.sn = "initSegment", ae.initSegment = R, y.needSidxRanges = !0)) } else y.endSN = 0, y.startCC = 0; return y.fragmentHint && (S += y.fragmentHint.duration), y.totalduration = S, y.endCC = A, M > 0 && function(e, t) { for (var i = e[t], r = t; r--;) { var n = e[r]; if (!n) return; n.programDateTime = i.programDateTime - 1e3 * n.duration, i = n } }(b, M), y }, e }(); function v(e, t) { ["video", "audio", "text"].forEach(function(i) { var r = e.filter(function(e) { return Object(d.isCodecType)(e, i) }); if (r.length) { var n = r.filter(function(e) { return 0 === e.lastIndexOf("avc1", 0) || 0 === e.lastIndexOf("mp4a", 0) }); t[i + "Codec"] = n.length > 0 ? n[0] : r[0], e = e.filter(function(e) { return -1 === r.indexOf(e) }) } }), t.unknownCodecs = e } function y(e, t, i) { var r = t[i]; r && (e[i] = r) } function _(e, t) { e.rawProgramDateTime ? e.programDateTime = Date.parse(e.rawProgramDateTime) : null !== t && void 0 !== t && t.programDateTime && (e.programDateTime = t.endProgramDateTime), Object(r.isFiniteNumber)(e .programDateTime) || (e.programDateTime = null, e.rawProgramDateTime = null) } }, "./src/loader/playlist-loader.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/polyfills/number.ts"), n = i("./src/events.ts"), a = i("./src/errors.ts"), s = i("./src/utils/logger.ts"), o = i("./src/utils/mp4-tools.ts"), u = i("./src/loader/m3u8-parser.ts"), l = i("./src/types/loader.ts"), d = i("./src/utils/attr-list.ts"); function c(e, t) { var i = e.url; return void 0 !== i && 0 !== i.indexOf("data:") || (i = t.url), i } var h = function() { function e(e) { this.hls = void 0, this.loaders = Object.create(null), this.hls = e, this.registerListeners() } var t = e.prototype; return t.registerListeners = function() { var e = this.hls; e.on(n.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.on(n.Events.LEVEL_LOADING, this .onLevelLoading, this), e.on(n.Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), e.on(n.Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this) }, t.unregisterListeners = function() { var e = this.hls; e.off(n.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.off(n.Events.LEVEL_LOADING, this.onLevelLoading, this), e.off(n.Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), e.off(n.Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this) }, t.createInternalLoader = function(e) { var t = this.hls.config, i = t.pLoader, r = t.loader, n = new(i || r)(t); return e.loader = n, this.loaders[e.type] = n, n }, t.getInternalLoader = function(e) { return this.loaders[e.type] }, t.resetInternalLoader = function(e) { this.loaders[e] && delete this.loaders[e] }, t.destroyInternalLoaders = function() { for (var e in this.loaders) { var t = this.loaders[e]; t && t.destroy(), this.resetInternalLoader(e) } }, t.destroy = function() { this.unregisterListeners(), this.destroyInternalLoaders() }, t.onManifestLoading = function(e, t) { var i = t.url; this.load({ id: null, groupId: null, level: 0, responseType: "text", type: l.PlaylistContextType.MANIFEST, url: i, deliveryDirectives: null }) }, t.onLevelLoading = function(e, t) { var i = t.id, r = t.level, n = t.url, a = t.deliveryDirectives; this.load({ id: i, groupId: null, level: r, responseType: "text", type: l.PlaylistContextType.LEVEL, url: n, deliveryDirectives: a }) }, t.onAudioTrackLoading = function(e, t) { var i = t.id, r = t.groupId, n = t.url, a = t.deliveryDirectives; this.load({ id: i, groupId: r, level: null, responseType: "text", type: l.PlaylistContextType.AUDIO_TRACK, url: n, deliveryDirectives: a }) }, t.onSubtitleTrackLoading = function(e, t) { var i = t.id, r = t.groupId, n = t.url, a = t.deliveryDirectives; this.load({ id: i, groupId: r, level: null, responseType: "text", type: l.PlaylistContextType.SUBTITLE_TRACK, url: n, deliveryDirectives: a }) }, t.load = function(e) { var t, i, r, n, a, o, u = this.hls.config, d = this.getInternalLoader(e); if (d) { var c = d.context; if (c && c.url === e.url) return void s.logger.trace( "[playlist-loader]: playlist request ongoing"); s.logger.log("[playlist-loader]: aborting previous loader for type: " + e.type), d.abort() } switch (e.type) { case l.PlaylistContextType.MANIFEST: i = u.manifestLoadingMaxRetry, r = u.manifestLoadingTimeOut, n = u .manifestLoadingRetryDelay, a = u.manifestLoadingMaxRetryTimeout; break; case l.PlaylistContextType.LEVEL: case l.PlaylistContextType.AUDIO_TRACK: case l.PlaylistContextType.SUBTITLE_TRACK: i = 0, r = u.levelLoadingTimeOut; break; default: i = u.levelLoadingMaxRetry, r = u.levelLoadingTimeOut, n = u.levelLoadingRetryDelay, a = u .levelLoadingMaxRetryTimeout } if ((d = this.createInternalLoader(e), null !== (t = e.deliveryDirectives) && void 0 !== t && t .part) && (e.type === l.PlaylistContextType.LEVEL && null !== e.level ? o = this.hls.levels[ e.level].details : e.type === l.PlaylistContextType.AUDIO_TRACK && null !== e.id ? o = this.hls.audioTracks[e.id].details : e.type === l.PlaylistContextType.SUBTITLE_TRACK && null !== e.id && (o = this.hls.subtitleTracks[e.id].details), o)) { var h = o.partTarget, f = o.targetduration; h && f && (r = Math.min(1e3 * Math.max(3 * h, .8 * f), r)) } var p = { timeout: r, maxRetry: i, retryDelay: n, maxRetryDelay: a, highWaterMark: 0 }, m = { onSuccess: this.loadsuccess.bind(this), onError: this.loaderror.bind(this), onTimeout: this.loadtimeout.bind(this) }; d.load(e, p, m) }, t.loadsuccess = function(e, t, i, r) { if (void 0 === r && (r = null), i.isSidxRequest) return this.handleSidxRequest(e, i), void this .handlePlaylistLoaded(e, t, i, r); this.resetInternalLoader(i.type); var n = e.data; 0 === n.indexOf("#EXTM3U") ? (t.parsing.start = performance.now(), n.indexOf("#EXTINF:") > 0 || n.indexOf("#EXT-X-TARGETDURATION:") > 0 ? this.handleTrackOrLevelPlaylist(e, t, i, r) : this .handleMasterPlaylist(e, t, i, r)) : this.handleManifestParsingError(e, i, "no EXTM3U delimiter", r) }, t.loaderror = function(e, t, i) { void 0 === i && (i = null), this.handleNetworkError(t, i, !1, e) }, t.loadtimeout = function(e, t, i) { void 0 === i && (i = null), this.handleNetworkError(t, i, !0) }, t.handleMasterPlaylist = function(e, t, i, r) { var a = this.hls, o = e.data, l = c(e, i), h = u.default.parseMasterPlaylist(o, l), f = h.levels, p = h.sessionData; if (f.length) { var m = f.map(function(e) { return { id: e.attrs.AUDIO, audioCodec: e.audioCodec } }), g = f.map(function(e) { return { id: e.attrs.SUBTITLES, textCodec: e.textCodec } }), v = u.default.parseMasterPlaylistMedia(o, l, "AUDIO", m), y = u.default.parseMasterPlaylistMedia(o, l, "SUBTITLES", g), _ = u.default.parseMasterPlaylistMedia(o, l, "CLOSED-CAPTIONS"); if (v.length) v.some(function(e) { return !e.url }) || !f[0].audioCodec || f[0].attrs.AUDIO || (s.logger.log( "[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one" ), v.unshift({ type: "main", name: "main", default: !1, autoselect: !1, forced: !1, id: -1, attrs: new d.AttrList({}), bitrate: 0, url: "" })); a.trigger(n.Events.MANIFEST_LOADED, { levels: f, audioTracks: v, subtitles: y, captions: _, url: l, stats: t, networkDetails: r, sessionData: p }) } else this.handleManifestParsingError(e, i, "no level found in manifest", r) }, t.handleTrackOrLevelPlaylist = function(e, t, i, s) { var o = this.hls, h = i.id, f = i.level, p = i.type, m = c(e, i), g = Object(r.isFiniteNumber)(h) ? h : 0, v = Object(r.isFiniteNumber)(f) ? f : g, y = function(e) { switch (e.type) { case l.PlaylistContextType.AUDIO_TRACK: return l.PlaylistLevelType.AUDIO; case l.PlaylistContextType.SUBTITLE_TRACK: return l.PlaylistLevelType.SUBTITLE; default: return l.PlaylistLevelType.MAIN } }(i), _ = u.default.parseLevelPlaylist(e.data, m, v, y, g); if (_.fragments.length) { if (p === l.PlaylistContextType.MANIFEST) { var b = { attrs: new d.AttrList({}), bitrate: 0, details: _, name: "", url: m }; o.trigger(n.Events.MANIFEST_LOADED, { levels: [b], audioTracks: [], url: m, stats: t, networkDetails: s, sessionData: null }) } if (t.parsing.end = performance.now(), _.needSidxRanges) { var w, E = null === (w = _.fragments[0].initSegment) || void 0 === w ? void 0 : w.url; this.load({ url: E, isSidxRequest: !0, type: p, level: f, levelDetails: _, id: h, groupId: null, rangeStart: 0, rangeEnd: 2048, responseType: "arraybuffer", deliveryDirectives: null }) } else i.levelDetails = _, this.handlePlaylistLoaded(e, t, i, s) } else o.trigger(n.Events.ERROR, { type: a.ErrorTypes.NETWORK_ERROR, details: a.ErrorDetails.LEVEL_EMPTY_ERROR, fatal: !1, url: m, reason: "no fragments found in level", level: "number" == typeof i.level ? i.level : void 0 }) }, t.handleSidxRequest = function(e, t) { var i = Object(o.parseSegmentIndex)(new Uint8Array(e.data)); if (i) { var r = i.references, n = t.levelDetails; r.forEach(function(e, t) { var r = e.info, a = n.fragments[t]; 0 === a.byteRange.length && a.setByteRange(String(1 + r.end - r.start) + "@" + String(r .start)), a.initSegment && a.initSegment.setByteRange(String(i.moovEndOffset) + "@0") }) } }, t.handleManifestParsingError = function(e, t, i, r) { this.hls.trigger(n.Events.ERROR, { type: a.ErrorTypes.NETWORK_ERROR, details: a.ErrorDetails.MANIFEST_PARSING_ERROR, fatal: t.type === l.PlaylistContextType.MANIFEST, url: e.url, reason: i, response: e, context: t, networkDetails: r }) }, t.handleNetworkError = function(e, t, i, r) { void 0 === i && (i = !1), s.logger.warn("[playlist-loader]: A network " + (i ? "timeout" : "error") + " occurred while loading " + e.type + " level: " + e.level + " id: " + e.id + ' group-id: "' + e.groupId + '"'); var o = a.ErrorDetails.UNKNOWN, u = !1, d = this.getInternalLoader(e); switch (e.type) { case l.PlaylistContextType.MANIFEST: o = i ? a.ErrorDetails.MANIFEST_LOAD_TIMEOUT : a.ErrorDetails.MANIFEST_LOAD_ERROR, u = !0; break; case l.PlaylistContextType.LEVEL: o = i ? a.ErrorDetails.LEVEL_LOAD_TIMEOUT : a.ErrorDetails.LEVEL_LOAD_ERROR, u = !1; break; case l.PlaylistContextType.AUDIO_TRACK: o = i ? a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT : a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, u = !1; break; case l.PlaylistContextType.SUBTITLE_TRACK: o = i ? a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT : a.ErrorDetails.SUBTITLE_LOAD_ERROR, u = !1 } d && this.resetInternalLoader(e.type); var c = { type: a.ErrorTypes.NETWORK_ERROR, details: o, fatal: u, url: e.url, loader: d, context: e, networkDetails: t }; r && (c.response = r), this.hls.trigger(n.Events.ERROR, c) }, t.handlePlaylistLoaded = function(e, t, i, r) { var a = i.type, s = i.level, o = i.id, u = i.groupId, d = i.loader, c = i.levelDetails, h = i.deliveryDirectives; if (null !== c && void 0 !== c && c.targetduration) { if (d) switch (c.live && (d.getCacheAge && (c.ageHeader = d.getCacheAge() || 0), d .getCacheAge && !isNaN(c.ageHeader) || (c.ageHeader = 0)), a) { case l.PlaylistContextType.MANIFEST: case l.PlaylistContextType.LEVEL: this.hls.trigger(n.Events.LEVEL_LOADED, { details: c, level: s || 0, id: o || 0, stats: t, networkDetails: r, deliveryDirectives: h }); break; case l.PlaylistContextType.AUDIO_TRACK: this.hls.trigger(n.Events.AUDIO_TRACK_LOADED, { details: c, id: o || 0, groupId: u || "", stats: t, networkDetails: r, deliveryDirectives: h }); break; case l.PlaylistContextType.SUBTITLE_TRACK: this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADED, { details: c, id: o || 0, groupId: u || "", stats: t, networkDetails: r, deliveryDirectives: h }) } } else this.handleManifestParsingError(e, i, "invalid target duration", r) }, e }(); t.default = h }, "./src/polyfills/number.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "isFiniteNumber", function() { return r }), i.d(t, "MAX_SAFE_INTEGER", function() { return n }); var r = Number.isFinite || function(e) { return "number" == typeof e && isFinite(e) }, n = Number.MAX_SAFE_INTEGER || 9007199254740991 }, "./src/remux/aac-helper.ts": function(e, t, i) { "use strict"; i.r(t); var r = function() { function e() {} return e.getSilentFrame = function(e, t) { switch (e) { case "mp4a.40.2": if (1 === t) return new Uint8Array([0, 200, 0, 128, 35, 128]); if (2 === t) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]); if (3 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]); if (4 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56 ]); if (5 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56 ]); if (6 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224 ]); break; default: if (1 === t) return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]); if (2 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]); if (3 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]) } }, e }(); t.default = r }, "./src/remux/mp4-generator.ts": function(e, t, i) { "use strict"; i.r(t); var r = Math.pow(2, 32) - 1, n = function() { function e() {} return e.init = function() { var t; for (t in e.types = { avc1: [], avcC: [], btrt: [], dinf: [], dref: [], esds: [], ftyp: [], hdlr: [], mdat: [], mdhd: [], mdia: [], mfhd: [], minf: [], moof: [], moov: [], mp4a: [], ".mp3": [], mvex: [], mvhd: [], pasp: [], sdtp: [], stbl: [], stco: [], stsc: [], stsd: [], stsz: [], stts: [], tfdt: [], tfhd: [], traf: [], trak: [], trun: [], trex: [], tkhd: [], vmhd: [], smhd: [] }, e.types) e.types.hasOwnProperty(t) && (e.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t .charCodeAt(2), t.charCodeAt(3) ]); var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0 ]), r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0 ]); e.HDLR_TYPES = { video: i, audio: r }; var n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]); e.STTS = e.STSC = e.STCO = a, e.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), e .VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), e.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0 ]), e.STSD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]); var s = new Uint8Array([105, 115, 111, 109]), o = new Uint8Array([97, 118, 99, 49]), u = new Uint8Array([0, 0, 0, 1]); e.FTYP = e.box(e.types.ftyp, s, u, s, o), e.DINF = e.box(e.types.dinf, e.box(e.types.dref, n)) }, e.box = function(e) { for (var t = 8, i = arguments.length, r = new Array(i > 1 ? i - 1 : 0), n = 1; n < i; n++) r[n - 1] = arguments[n]; for (var a = r.length, s = a; a--;) t += r[a].byteLength; var o = new Uint8Array(t); for (o[0] = t >> 24 & 255, o[1] = t >> 16 & 255, o[2] = t >> 8 & 255, o[3] = 255 & t, o.set(e, 4), a = 0, t = 8; a < s; a++) o.set(r[a], t), t += r[a].byteLength; return o }, e.hdlr = function(t) { return e.box(e.types.hdlr, e.HDLR_TYPES[t]) }, e.mdat = function(t) { return e.box(e.types.mdat, t) }, e.mdhd = function(t, i) { i *= t; var n = Math.floor(i / (r + 1)), a = Math.floor(i % (r + 1)); return e.box(e.types.mdhd, new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, n >> 24, n >> 16 & 255, n >> 8 & 255, 255 & n, a >> 24, a >> 16 & 255, a >> 8 & 255, 255 & a, 85, 196, 0, 0 ])) }, e.mdia = function(t) { return e.box(e.types.mdia, e.mdhd(t.timescale, t.duration), e.hdlr(t.type), e.minf(t)) }, e.mfhd = function(t) { return e.box(e.types.mfhd, new Uint8Array([0, 0, 0, 0, t >> 24, t >> 16 & 255, t >> 8 & 255, 255 & t ])) }, e.minf = function(t) { return "audio" === t.type ? e.box(e.types.minf, e.box(e.types.smhd, e.SMHD), e.DINF, e.stbl( t)) : e.box(e.types.minf, e.box(e.types.vmhd, e.VMHD), e.DINF, e.stbl(t)) }, e.moof = function(t, i, r) { return e.box(e.types.moof, e.mfhd(t), e.traf(r, i)) }, e.moov = function(t) { for (var i = t.length, r = []; i--;) r[i] = e.trak(t[i]); return e.box.apply(null, [e.types.moov, e.mvhd(t[0].timescale, t[0].duration)].concat(r).concat( e.mvex(t))) }, e.mvex = function(t) { for (var i = t.length, r = []; i--;) r[i] = e.trex(t[i]); return e.box.apply(null, [e.types.mvex].concat(r)) }, e.mvhd = function(t, i) { i *= t; var n = Math.floor(i / (r + 1)), a = Math.floor(i % (r + 1)), s = new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, n >> 24, n >> 16 & 255, n >> 8 & 255, 255 & n, a >> 24, a >> 16 & 255, a >> 8 & 255, 255 & a, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 ]); return e.box(e.types.mvhd, s) }, e.sdtp = function(t) { var i, r, n = t.samples || [], a = new Uint8Array(4 + n.length); for (i = 0; i < n.length; i++) r = n[i].flags, a[i + 4] = r.dependsOn << 4 | r.isDependedOn << 2 | r.hasRedundancy; return e.box(e.types.sdtp, a) }, e.stbl = function(t) { return e.box(e.types.stbl, e.stsd(t), e.box(e.types.stts, e.STTS), e.box(e.types.stsc, e.STSC), e.box(e.types.stsz, e.STSZ), e.box(e.types.stco, e.STCO)) }, e.avc1 = function(t) { var i, r, n, a = [], s = []; for (i = 0; i < t.sps.length; i++) n = (r = t.sps[i]).byteLength, a.push(n >>> 8 & 255), a.push( 255 & n), a = a.concat(Array.prototype.slice.call(r)); for (i = 0; i < t.pps.length; i++) n = (r = t.pps[i]).byteLength, s.push(n >>> 8 & 255), s.push( 255 & n), s = s.concat(Array.prototype.slice.call(r)); var o = e.box(e.types.avcC, new Uint8Array([1, a[3], a[4], a[5], 255, 224 | t.sps.length] .concat(a).concat([t.pps.length]).concat(s))), u = t.width, l = t.height, d = t.pixelRatio[0], c = t.pixelRatio[1]; return e.box(e.types.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, u >> 8 & 255, 255 & u, l >> 8 & 255, 255 & l, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 18, 100, 97, 105, 108, 121, 109, 111, 116, 105, 111, 110, 47, 104, 108, 115, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17 ]), o, e.box(e.types.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192])), e.box(e.types.pasp, new Uint8Array([d >> 24, d >> 16 & 255, d >> 8 & 255, 255 & d, c >> 24, c >> 16 & 255, c >> 8 & 255, 255 & c ]))) }, e.esds = function(e) { var t = e.config.length; return new Uint8Array([0, 0, 0, 0, 3, 23 + t, 0, 1, 0, 4, 15 + t, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5 ].concat([t]).concat(e.config).concat([6, 1, 2])) }, e.mp4a = function(t) { var i = t.samplerate; return e.box(e.types.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, t .channelCount, 0, 16, 0, 0, 0, 0, i >> 8 & 255, 255 & i, 0, 0 ]), e.box(e.types.esds, e.esds(t))) }, e.mp3 = function(t) { var i = t.samplerate; return e.box(e.types[".mp3"], new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, t.channelCount, 0, 16, 0, 0, 0, 0, i >> 8 & 255, 255 & i, 0, 0 ])) }, e.stsd = function(t) { return "audio" === t.type ? "mp3" === t.segmentCodec && "mp3" === t.codec ? e.box(e.types.stsd, e.STSD, e.mp3(t)) : e.box(e.types.stsd, e.STSD, e.mp4a(t)) : e.box(e.types.stsd, e.STSD, e .avc1(t)) }, e.tkhd = function(t) { var i = t.id, n = t.duration * t.timescale, a = t.width, s = t.height, o = Math.floor(n / (r + 1)), u = Math.floor(n % (r + 1)); return e.box(e.types.tkhd, new Uint8Array([1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, i >> 24 & 255, i >> 16 & 255, i >> 8 & 255, 255 & i, 0, 0, 0, 0, o >> 24, o >> 16 & 255, o >> 8 & 255, 255 & o, u >> 24, u >> 16 & 255, u >> 8 & 255, 255 & u, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, a >> 8 & 255, 255 & a, 0, 0, s >> 8 & 255, 255 & s, 0, 0 ])) }, e.traf = function(t, i) { var n = e.sdtp(t), a = t.id, s = Math.floor(i / (r + 1)), o = Math.floor(i % (r + 1)); return e.box(e.types.traf, e.box(e.types.tfhd, new Uint8Array([0, 0, 0, 0, a >> 24, a >> 16 & 255, a >> 8 & 255, 255 & a ])), e.box(e.types.tfdt, new Uint8Array([1, 0, 0, 0, s >> 24, s >> 16 & 255, s >> 8 & 255, 255 & s, o >> 24, o >> 16 & 255, o >> 8 & 255, 255 & o ])), e.trun(t, n.length + 16 + 20 + 8 + 16 + 8 + 8), n) }, e.trak = function(t) { return t.duration = t.duration || 4294967295, e.box(e.types.trak, e.tkhd(t), e.mdia(t)) }, e.trex = function(t) { var i = t.id; return e.box(e.types.trex, new Uint8Array([0, 0, 0, 0, i >> 24, i >> 16 & 255, i >> 8 & 255, 255 & i, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 ])) }, e.trun = function(t, i) { var r, n, a, s, o, u, l = t.samples || [], d = l.length, c = 12 + 16 * d, h = new Uint8Array(c); for (i += 8 + c, h.set([0, 0, 15, 1, d >>> 24 & 255, d >>> 16 & 255, d >>> 8 & 255, 255 & d, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i ], 0), r = 0; r < d; r++) a = (n = l[r]).duration, s = n.size, o = n.flags, u = n.cts, h.set([ a >>> 24 & 255, a >>> 16 & 255, a >>> 8 & 255, 255 & a, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s, o.isLeading << 2 | o.dependsOn, o.isDependedOn << 6 | o .hasRedundancy << 4 | o.paddingValue << 1 | o.isNonSync, 61440 & o.degradPrio, 15 & o .degradPrio, u >>> 24 & 255, u >>> 16 & 255, u >>> 8 & 255, 255 & u ], 12 + 16 * r); return e.box(e.types.trun, h) }, e.initSegment = function(t) { e.types || e.init(); var i = e.moov(t), r = new Uint8Array(e.FTYP.byteLength + i.byteLength); return r.set(e.FTYP), r.set(i, e.FTYP.byteLength), r }, e }(); n.types = void 0, n.HDLR_TYPES = void 0, n.STTS = void 0, n.STSC = void 0, n.STCO = void 0, n.STSZ = void 0, n.VMHD = void 0, n.SMHD = void 0, n.STSD = void 0, n.FTYP = void 0, n.DINF = void 0, t .default = n }, "./src/remux/mp4-remuxer.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return m }), i.d(t, "normalizePts", function() { return g }), i.d(t, "flushTextTrackMetadataCueSamples", function() { return v }), i.d(t, "flushTextTrackUserdataCueSamples", function() { return y }); var r = i("./src/polyfills/number.ts"), n = i("./src/remux/aac-helper.ts"), a = i("./src/remux/mp4-generator.ts"), s = i("./src/events.ts"), o = i("./src/errors.ts"), u = i("./src/utils/logger.ts"), l = i("./src/types/loader.ts"), d = i("./src/utils/timescale-conversion.ts"); function c() { return (c = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }).apply(this, arguments) } var h = null, f = null, p = !1, m = function() { function e(e, t, i, r) { if (void 0 === r && (r = ""), this.observer = void 0, this.config = void 0, this.typeSupported = void 0, this.ISGenerated = !1, this._initPTS = void 0, this._initDTS = void 0, this.nextAvcDts = null, this.nextAudioPts = null, this.isAudioContiguous = !1, this.isVideoContiguous = !1, this .observer = e, this.config = t, this.typeSupported = i, this.ISGenerated = !1, null === h) { var n = (navigator.userAgent || "").match(/Chrome\/(\d+)/i); h = n ? parseInt(n[1]) : 0 } if (null === f) { var a = navigator.userAgent.match(/Safari\/(\d+)/i); f = a ? parseInt(a[1]) : 0 } p = !!h && h < 75 || !!f && f < 600 } var t = e.prototype; return t.destroy = function() {}, t.resetTimeStamp = function(e) { u.logger.log("[mp4-remuxer]: initPTS & initDTS reset"), this._initPTS = this._initDTS = e }, t.resetNextTimestamp = function() { u.logger.log("[mp4-remuxer]: reset next timestamp"), this.isVideoContiguous = !1, this .isAudioContiguous = !1 }, t.resetInitSegment = function() { u.logger.log("[mp4-remuxer]: ISGenerated flag reset"), this.ISGenerated = !1 }, t.getVideoStartPts = function(e) { var t = !1, i = e.reduce(function(e, i) { var r = i.pts - e; return r < -4294967296 ? (t = !0, g(e, i.pts)) : r > 0 ? e : i.pts }, e[0].pts); return t && u.logger.debug("PTS rollover detected"), i }, t.remux = function(e, t, i, r, n, a, s, o) { var d, c, h, f, p, m, _ = n, b = n, w = e.pid > -1, E = t.pid > -1, T = t.samples.length, S = e.samples.length > 0, A = T > 1; if ((!w || S) && (!E || A) || this.ISGenerated || s) { this.ISGenerated || (h = this.generateIS(e, t, n)); var k = this.isVideoContiguous, R = -1; if (A && (R = function(e) { for (var t = 0; t < e.length; t++) if (e[t].key) return t; return -1 }(t.samples), !k && this.config.forceKeyFrameOnDiscontinuity)) if (m = !0, R > 0) { u.logger.warn("[mp4-remuxer]: Dropped " + R + " out of " + T + " video samples due to a missing keyframe"); var M = this.getVideoStartPts(t.samples); t.samples = t.samples.slice(R), t.dropped += R, b += (t.samples[0].pts - M) / (t .timescale || 9e4) } else -1 === R && (u.logger.warn("[mp4-remuxer]: No keyframe found out of " + T + " video samples"), m = !1); if (this.ISGenerated) { if (S && A) { var O = this.getVideoStartPts(t.samples), C = (g(e.samples[0].pts, O) - O) / t.inputTimeScale; _ += Math.max(0, C), b += Math.max(0, -C) } if (S) { if (e.samplerate || (u.logger.warn( "[mp4-remuxer]: regenerate InitSegment as audio detected"), h = this.generateIS(e, t, n)), c = this.remuxAudio(e, _, this.isAudioContiguous, a, E || A || o === l .PlaylistLevelType.AUDIO ? b : void 0), A) { var D = c ? c.endPTS - c.startPTS : 0; t.inputTimeScale || (u.logger.warn( "[mp4-remuxer]: regenerate InitSegment as video detected"), h = this.generateIS(e, t, n)), d = this.remuxVideo(t, b, k, D) } } else A && (d = this.remuxVideo(t, b, k, 0)); d && (d.firstKeyFrame = R, d.independent = -1 !== R) } } return this.ISGenerated && (i.samples.length && (p = v(i, n, this._initPTS, this._initDTS)), r .samples.length && (f = y(r, n, this._initPTS))), { audio: c, video: d, initSegment: h, independent: m, text: f, id3: p } }, t.generateIS = function(e, t, i) { var n, s, o, u = e.samples, l = t.samples, d = this.typeSupported, c = {}, h = !Object(r.isFiniteNumber)(this._initPTS), f = "audio/mp4"; if (h && (n = s = 1 / 0), e.config && u.length) { switch (e.timescale = e.samplerate, e.segmentCodec) { case "mp3": d.mpeg ? (f = "audio/mpeg", e.codec = "") : d.mp3 && (e.codec = "mp3") } c.audio = { id: "audio", container: f, codec: e.codec, initSegment: "mp3" === e.segmentCodec && d.mpeg ? new Uint8Array(0) : a.default .initSegment([e]), metadata: { channelCount: e.channelCount } }, h && (o = e.inputTimeScale, n = s = u[0].pts - Math.round(o * i)) } if (t.sps && t.pps && l.length && (t.timescale = t.inputTimeScale, c.video = { id: "main", container: "video/mp4", codec: t.codec, initSegment: a.default.initSegment([t]), metadata: { width: t.width, height: t.height } }, h)) { o = t.inputTimeScale; var p = this.getVideoStartPts(l), m = Math.round(o * i); s = Math.min(s, g(l[0].dts, p) - m), n = Math.min(n, p - m) } if (Object.keys(c).length) return this.ISGenerated = !0, h && (this._initPTS = n, this ._initDTS = s), { tracks: c, initPTS: n, timescale: o } }, t.remuxVideo = function(e, t, i, r) { var n, l, f, m = e.inputTimeScale, v = e.samples, y = [], b = v.length, w = this._initPTS, E = this.nextAvcDts, T = 8, S = Number.POSITIVE_INFINITY, A = Number.NEGATIVE_INFINITY, k = 0, R = !1; i && null !== E || (E = t * m - (v[0].pts - g(v[0].dts, v[0].pts))); for (var M = 0; M < b; M++) { var O = v[M]; if (O.pts = g(O.pts - w, E), O.dts = g(O.dts - w, E), O.dts > O.pts) { k = Math.max(Math.min(k, O.pts - O.dts), -18e3) } O.dts < v[M > 0 ? M - 1 : M].dts && (R = !0) } R && v.sort(function(e, t) { var i = e.dts - t.dts, r = e.pts - t.pts; return i || r }), l = v[0].dts, f = v[v.length - 1].dts; var C = Math.round((f - l) / (b - 1)); if (k < 0) { if (k < -2 * C) { u.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by " + Object(d .toMsFromMpegTsClock)(-C, !0) + " ms"); for (var D = k, I = 0; I < b; I++) v[I].dts = D = Math.max(D, v[I].pts - C), v[I].pts = Math .max(D, v[I].pts) } else { u.logger.warn("PTS < DTS detected in video samples, shifting DTS by " + Object(d .toMsFromMpegTsClock)(k, !0) + " ms to overcome this issue"); for (var L = 0; L < b; L++) v[L].dts = v[L].dts + k } l = v[0].dts } if (i) { var x = l - E, P = x > C; if (P || x < -1) { P ? u.logger.warn("AVC: " + Object(d.toMsFromMpegTsClock)(x, !0) + " ms (" + x + "dts) hole between fragments detected, filling it") : u.logger.warn("AVC: " + Object(d .toMsFromMpegTsClock)(-x, !0) + " ms (" + x + "dts) overlapping between fragments detected"), l = E; var U = v[0].pts - x; v[0].dts = l, v[0].pts = U, u.logger.log("Video: First PTS/DTS adjusted: " + Object(d .toMsFromMpegTsClock)(U, !0) + "/" + Object(d.toMsFromMpegTsClock)(l, !0) + ", delta: " + Object(d.toMsFromMpegTsClock)(x, !0) + " ms") } } p && (l = Math.max(0, l)); for (var N = 0, B = 0, F = 0; F < b; F++) { for (var j = v[F], H = j.units, G = H.length, V = 0, W = 0; W < G; W++) V += H[W].data.length; B += V, N += G, j.length = V, j.dts = Math.max(j.dts, l), j.pts = Math.max(j.pts, j.dts, 0), S = Math.min(j.pts, S), A = Math.max(j.pts, A) } f = v[b - 1].dts; var q, X = B + 4 * N + 8; try { q = new Uint8Array(X) } catch (e) { return void this.observer.emit(s.Events.ERROR, s.Events.ERROR, { type: o.ErrorTypes.MUX_ERROR, details: o.ErrorDetails.REMUX_ALLOC_ERROR, fatal: !1, bytes: X, reason: "fail allocating video mdat " + X }) } var z = new DataView(q.buffer); z.setUint32(0, X), q.set(a.default.types.mdat, 4); for (var K = 0; K < b; K++) { for (var Y = v[K], Q = Y.units, J = 0, Z = 0, $ = Q.length; Z < $; Z++) { var ee = Q[Z], te = ee.data, ie = ee.data.byteLength; z.setUint32(T, ie), T += 4, q.set(te, T), T += ie, J += 4 + ie } if (K < b - 1) n = v[K + 1].dts - Y.dts; else { var re = this.config, ne = Y.dts - v[K > 0 ? K - 1 : K].dts; if (re.stretchShortVideoTrack && null !== this.nextAudioPts) { var ae = Math.floor(re.maxBufferHole * m), se = (r ? S + r * m : this.nextAudioPts) - Y.pts; se > ae ? ((n = se - ne) < 0 && (n = ne), u.logger.log( "[mp4-remuxer]: It is approximately " + se / 90 + " ms to the next segment; using duration " + n / 90 + " ms for the last video frame.")) : n = ne } else n = ne } var oe = Math.round(Y.pts - Y.dts); y.push(new _(Y.key, n, J, oe)) } if (y.length && h && h < 70) { var ue = y[0].flags; ue.dependsOn = 2, ue.isNonSync = 0 } console.assert(void 0 !== n, "mp4SampleDuration must be computed"), this.nextAvcDts = E = f + n, this.isVideoContiguous = !0; var le = { data1: a.default.moof(e.sequenceNumber++, l, c({}, e, { samples: y })), data2: q, startPTS: S / m, endPTS: (A + n) / m, startDTS: l / m, endDTS: E / m, type: "video", hasAudio: !1, hasVideo: !0, nb: y.length, dropped: e.dropped }; return e.samples = [], e.dropped = 0, console.assert(q.length, "MDAT length must not be zero"), le }, t.remuxAudio = function(e, t, i, r, l) { var d = e.inputTimeScale, h = d / (e.samplerate ? e.samplerate : d), f = "aac" === e.segmentCodec ? 1024 : 1152, p = f * h, m = this._initPTS, v = "mp3" === e.segmentCodec && this.typeSupported.mpeg, y = [], b = e.samples, w = v ? 0 : 8, E = this.nextAudioPts || -1, T = t * d; if (this.isAudioContiguous = i = i || b.length && E > 0 && (r && Math.abs(T - E) < 9e3 || Math .abs(g(b[0].pts - m, T) - E) < 20 * p), b.forEach(function(e) { e.pts = g(e.pts - m, T) }), !i || E < 0) { if (!(b = b.filter(function(e) { return e.pts >= 0 })).length) return; E = 0 === l ? 0 : r ? Math.max(0, T) : b[0].pts } if ("aac" === e.segmentCodec) for (var S = void 0 !== l, A = this.config.maxAudioFramesDrift, k = 0, R = E; k < b .length; k++) { var M = b[k], O = M.pts, C = O - R, D = Math.abs(1e3 * C / d); if (C <= -A * p && S) 0 === k && (u.logger.warn("Audio frame @ " + (O / d).toFixed(3) + "s overlaps nextAudioPts by " + Math.round(1e3 * C / d) + " ms."), this.nextAudioPts = E = R = O); else if (C >= A * p && D < 1e4 && S) { var I = Math.round(C / p); (R = O - I * p) < 0 && (I--, R += p), 0 === k && (this.nextAudioPts = E = R), u.logger .warn("[mp4-remuxer]: Injecting " + I + " audio frame @ " + (R / d).toFixed(3) + "s due to " + Math.round(1e3 * C / d) + " ms gap."); for (var L = 0; L < I; L++) { var x = Math.max(R, 0), P = n.default.getSilentFrame(e.manifestCodec || e.codec, e.channelCount); P || (u.logger.log( "[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead." ), P = M.unit.subarray()), b.splice(k, 0, { unit: P, pts: x }), R += p, k++ } } M.pts = R, R += p } for (var U, N = null, B = null, F = 0, j = b.length; j--;) F += b[j].unit.byteLength; for (var H = 0, G = b.length; H < G; H++) { var V = b[H], W = V.unit, q = V.pts; if (null !== B) { y[H - 1].duration = Math.round((q - B) / h) } else { if (i && "aac" === e.segmentCodec && (q = E), N = q, !(F > 0)) return; F += w; try { U = new Uint8Array(F) } catch (e) { return void this.observer.emit(s.Events.ERROR, s.Events.ERROR, { type: o.ErrorTypes.MUX_ERROR, details: o.ErrorDetails.REMUX_ALLOC_ERROR, fatal: !1, bytes: F, reason: "fail allocating audio mdat " + F }) } v || (new DataView(U.buffer).setUint32(0, F), U.set(a.default.types.mdat, 4)) } U.set(W, w); var X = W.byteLength; w += X, y.push(new _(!0, f, X, 0)), B = q } var z = y.length; if (z) { var K = y[y.length - 1]; this.nextAudioPts = E = B + h * K.duration; var Y = v ? new Uint8Array(0) : a.default.moof(e.sequenceNumber++, N / h, c({}, e, { samples: y })); e.samples = []; var Q = N / d, J = E / d, Z = { data1: Y, data2: U, startPTS: Q, endPTS: J, startDTS: Q, endDTS: J, type: "audio", hasAudio: !0, hasVideo: !1, nb: z }; return this.isAudioContiguous = !0, console.assert(U.length, "MDAT length must not be zero"), Z } }, t.remuxEmptyAudio = function(e, t, i, r) { var a = e.inputTimeScale, s = a / (e.samplerate ? e.samplerate : a), o = this.nextAudioPts, l = (null !== o ? o : r.startDTS * a) + this._initDTS, d = r.endDTS * a + this._initDTS, c = 1024 * s, h = Math.ceil((d - l) / c), f = n.default.getSilentFrame(e.manifestCodec || e.codec, e.channelCount); if (u.logger.warn("[mp4-remuxer]: remux empty Audio"), f) { for (var p = [], m = 0; m < h; m++) { var g = l + m * c; p.push({ unit: f, pts: g, dts: g }) } return e.samples = p, this.remuxAudio(e, t, i, !1) } u.logger.trace( "[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec" ) }, e }(); function g(e, t) { var i; if (null === t) return e; for (i = t < e ? -8589934592 : 8589934592; Math.abs(e - t) > 4294967296;) e += i; return e } function v(e, t, i, r) { var n = e.samples.length; if (n) { for (var a = e.inputTimeScale, s = 0; s < n; s++) { var o = e.samples[s]; o.pts = g(o.pts - i, t * a) / a, o.dts = g(o.dts - r, t * a) / a } var u = e.samples; return e.samples = [], { samples: u } } } function y(e, t, i) { var r = e.samples.length; if (r) { for (var n = e.inputTimeScale, a = 0; a < r; a++) { var s = e.samples[a]; s.pts = g(s.pts - i, t * n) / n } e.samples.sort(function(e, t) { return e.pts - t.pts }); var o = e.samples; return e.samples = [], { samples: o } } } var _ = function(e, t, i, r) { this.size = void 0, this.duration = void 0, this.cts = void 0, this.flags = void 0, this.duration = t, this.size = i, this.cts = r, this.flags = new b(e) }, b = function(e) { this.isLeading = 0, this.isDependedOn = 0, this.hasRedundancy = 0, this.degradPrio = 0, this .dependsOn = 1, this.isNonSync = 1, this.dependsOn = e ? 2 : 1, this.isNonSync = e ? 0 : 1 } }, "./src/remux/passthrough-remuxer.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/polyfills/number.ts"), n = i("./src/remux/mp4-remuxer.ts"), a = i("./src/utils/mp4-tools.ts"), s = i("./src/loader/fragment.ts"), o = i("./src/utils/logger.ts"), u = function() { function e() { this.emitInitSegment = !1, this.audioCodec = void 0, this.videoCodec = void 0, this.initData = void 0, this.initPTS = void 0, this.initTracks = void 0, this.lastEndDTS = null } var t = e.prototype; return t.destroy = function() {}, t.resetTimeStamp = function(e) { this.initPTS = e, this.lastEndDTS = null }, t.resetNextTimestamp = function() { this.lastEndDTS = null }, t.resetInitSegment = function(e, t, i) { this.audioCodec = t, this.videoCodec = i, this.generateInitSegment(e), this.emitInitSegment = !0 }, t.generateInitSegment = function(e) { var t = this.audioCodec, i = this.videoCodec; if (!e || !e.byteLength) return this.initTracks = void 0, void(this.initData = void 0); var r = this.initData = Object(a.parseInitSegment)(e); t || (t = d(r.audio, s.ElementaryStreamTypes.AUDIO)), i || (i = d(r.video, s .ElementaryStreamTypes.VIDEO)); var n = {}; r.audio && r.video ? n.audiovideo = { container: "video/mp4", codec: t + "," + i, initSegment: e, id: "main" } : r.audio ? n.audio = { container: "audio/mp4", codec: t, initSegment: e, id: "audio" } : r.video ? n.video = { container: "video/mp4", codec: i, initSegment: e, id: "main" } : o.logger.warn( "[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."), this .initTracks = n }, t.remux = function(e, t, i, s, u) { var d, c = this.initPTS, h = this.lastEndDTS, f = { audio: void 0, video: void 0, text: s, id3: i, initSegment: void 0 }; Object(r.isFiniteNumber)(h) || (h = this.lastEndDTS = u || 0); var p = t.samples; if (!p || !p.length) return f; var m = { initPTS: void 0, timescale: 1 }, g = this.initData; if (g && g.length || (this.generateInitSegment(p), g = this.initData), !g || !g.length) return o .logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."), f; this.emitInitSegment && (m.tracks = this.initTracks, this.emitInitSegment = !1), Object(r .isFiniteNumber)(c) || (this.initPTS = m.initPTS = c = l(g, p, h)); var v = Object(a.getDuration)(p, g), y = h, _ = v + y; Object(a.offsetStartDTS)(g, p, c), v > 0 ? this.lastEndDTS = _ : (o.logger.warn( "Duration parsed from mp4 should be greater than zero"), this.resetNextTimestamp()); var b = !!g.audio, w = !!g.video, E = ""; b && (E += "audio"), w && (E += "video"); var T = { data1: p, startPTS: y, startDTS: y, endPTS: _, endDTS: _, type: E, hasAudio: b, hasVideo: w, nb: 1, dropped: 0 }; f.audio = "audio" === T.type ? T : void 0, f.video = "audio" !== T.type ? T : void 0, f .initSegment = m; var S = null != (d = this.initPTS) ? d : 0; return f.id3 = Object(n.flushTextTrackMetadataCueSamples)(i, u, S, S), s.samples.length && (f .text = Object(n.flushTextTrackUserdataCueSamples)(s, u, S)), f }, e }(), l = function(e, t, i) { return Object(a.getStartDTS)(e, t) - i }; function d(e, t) { var i = null === e || void 0 === e ? void 0 : e.codec; return i && i.length > 4 ? i : "hvc1" === i ? "hvc1.1.c.L120.90" : "av01" === i ? "av01.0.04M.08" : "avc1" === i || t === s.ElementaryStreamTypes.VIDEO ? "avc1.42e01e" : "mp4a.40.5" } t.default = u }, "./src/task-loop.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return r }); var r = function() { function e() { this._boundTick = void 0, this._tickTimer = null, this._tickInterval = null, this._tickCallCount = 0, this._boundTick = this.tick.bind(this) } var t = e.prototype; return t.destroy = function() { this.onHandlerDestroying(), this.onHandlerDestroyed() }, t.onHandlerDestroying = function() { this.clearNextTick(), this.clearInterval() }, t.onHandlerDestroyed = function() {}, t.hasInterval = function() { return !!this._tickInterval }, t.hasNextTick = function() { return !!this._tickTimer }, t.setInterval = function(e) { return !this._tickInterval && (this._tickInterval = self.setInterval(this._boundTick, e), !0) }, t.clearInterval = function() { return !!this._tickInterval && (self.clearInterval(this._tickInterval), this._tickInterval = null, !0) }, t.clearNextTick = function() { return !!this._tickTimer && (self.clearTimeout(this._tickTimer), this._tickTimer = null, !0) }, t.tick = function() { this._tickCallCount++, 1 === this._tickCallCount && (this.doTick(), this._tickCallCount > 1 && this.tickImmediate(), this._tickCallCount = 0) }, t.tickImmediate = function() { this.clearNextTick(), this._tickTimer = self.setTimeout(this._boundTick, 0) }, t.doTick = function() {}, e }() }, "./src/types/cmcd.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "CMCDVersion", function() { return s }), i.d(t, "CMCDObjectType", function() { return r }), i.d(t, "CMCDStreamingFormat", function() { return n }), i.d(t, "CMCDStreamType", function() { return a }); var r, n, a, s = 1; ! function(e) { e.MANIFEST = "m", e.AUDIO = "a", e.VIDEO = "v", e.MUXED = "av", e.INIT = "i", e.CAPTION = "c", e .TIMED_TEXT = "tt", e.KEY = "k", e.OTHER = "o" }(r || (r = {})), function(e) { e.DASH = "d", e.HLS = "h", e.SMOOTH = "s", e.OTHER = "o" }(n || (n = {})), function(e) { e.VOD = "v", e.LIVE = "l" }(a || (a = {})) }, "./src/types/level.ts": function(e, t, i) { "use strict"; function r(e, t) { for (var i = 0; i < t.length; i++) { var r = t[i]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object .defineProperty(e, r.key, r) } } var n; function a(e, t) { var i = e.canSkipUntil, r = e.canSkipDateRanges, a = e.endSN; return i && (void 0 !== t ? t - a : 0) < i ? r ? n.v2 : n.Yes : n.No } i.r(t), i.d(t, "HlsSkip", function() { return n }), i.d(t, "getSkipValue", function() { return a }), i.d(t, "HlsUrlParameters", function() { return s }), i.d(t, "Level", function() { return o }), function(e) { e.No = "", e.Yes = "YES", e.v2 = "v2" }(n || (n = {})); var s = function() { function e(e, t, i) { this.msn = void 0, this.part = void 0, this.skip = void 0, this.msn = e, this.part = t, this .skip = i } return e.prototype.addDirectives = function(e) { var t = new self.URL(e); return void 0 !== this.msn && t.searchParams.set("_HLS_msn", this.msn.toString()), void 0 !== this.part && t.searchParams.set("_HLS_part", this.part.toString()), this.skip && t .searchParams.set("_HLS_skip", this.skip), t.toString() }, e }(), o = function() { function e(e) { this.attrs = void 0, this.audioCodec = void 0, this.bitrate = void 0, this.codecSet = void 0, this .height = void 0, this.id = void 0, this.name = void 0, this.videoCodec = void 0, this.width = void 0, this.unknownCodecs = void 0, this.audioGroupIds = void 0, this.details = void 0, this .fragmentError = 0, this.loadError = 0, this.loaded = void 0, this.realBitrate = 0, this .textGroupIds = void 0, this.url = void 0, this._urlId = 0, this.url = [e.url], this.attrs = e .attrs, this.bitrate = e.bitrate, e.details && (this.details = e.details), this.id = e.id || 0, this.name = e.name, this.width = e.width || 0, this.height = e.height || 0, this.audioCodec = e .audioCodec, this.videoCodec = e.videoCodec, this.unknownCodecs = e.unknownCodecs, this .codecSet = [e.videoCodec, e.audioCodec].filter(function(e) { return e }).join(",").replace(/\.[^.,]+/g, "") } var t, i, n; return t = e, (i = [{ key: "maxBitrate", get: function() { return Math.max(this.realBitrate, this.bitrate) } }, { key: "uri", get: function() { return this.url[this._urlId] || "" } }, { key: "urlId", get: function() { return this._urlId }, set: function(e) { var t = e % this.url.length; this._urlId !== t && (this.details = void 0, this._urlId = t) } }]) && r(t.prototype, i), n && r(t, n), Object.defineProperty(t, "prototype", { writable: !1 }), e }() }, "./src/types/loader.ts": function(e, t, i) { "use strict"; var r, n; i.r(t), i.d(t, "PlaylistContextType", function() { return r }), i.d(t, "PlaylistLevelType", function() { return n }), function(e) { e.MANIFEST = "manifest", e.LEVEL = "level", e.AUDIO_TRACK = "audioTrack", e.SUBTITLE_TRACK = "subtitleTrack" }(r || (r = {})), function(e) { e.MAIN = "main", e.AUDIO = "audio", e.SUBTITLE = "subtitle" }(n || (n = {})) }, "./src/types/transmuxer.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "ChunkMetadata", function() { return r }); var r = function(e, t, i, r, n, a) { void 0 === r && (r = 0), void 0 === n && (n = -1), void 0 === a && (a = !1), this.level = void 0, this.sn = void 0, this.part = void 0, this.id = void 0, this.size = void 0, this.partial = void 0, this.transmuxing = { start: 0, executeStart: 0, executeEnd: 0, end: 0 }, this.buffering = { audio: { start: 0, executeStart: 0, executeEnd: 0, end: 0 }, video: { start: 0, executeStart: 0, executeEnd: 0, end: 0 }, audiovideo: { start: 0, executeStart: 0, executeEnd: 0, end: 0 } }, this.level = e, this.sn = t, this.id = i, this.size = r, this.part = n, this.partial = a } }, "./src/utils/attr-list.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "AttrList", function() { return a }); var r = /^(\d+)x(\d+)$/, n = /\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g, a = function() { function e(t) { for (var i in "string" == typeof t && (t = e.parseAttrList(t)), t) t.hasOwnProperty(i) && (this[ i] = t[i]) } var t = e.prototype; return t.decimalInteger = function(e) { var t = parseInt(this[e], 10); return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t }, t.hexadecimalInteger = function(e) { if (this[e]) { var t = (this[e] || "0x").slice(2); t = (1 & t.length ? "0" : "") + t; for (var i = new Uint8Array(t.length / 2), r = 0; r < t.length / 2; r++) i[r] = parseInt(t .slice(2 * r, 2 * r + 2), 16); return i } return null }, t.hexadecimalIntegerAsNumber = function(e) { var t = parseInt(this[e], 16); return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t }, t.decimalFloatingPoint = function(e) { return parseFloat(this[e]) }, t.optionalFloat = function(e, t) { var i = this[e]; return i ? parseFloat(i) : t }, t.enumeratedString = function(e) { return this[e] }, t.bool = function(e) { return "YES" === this[e] }, t.decimalResolution = function(e) { var t = r.exec(this[e]); if (null !== t) return { width: parseInt(t[1], 10), height: parseInt(t[2], 10) } }, e.parseAttrList = function(e) { var t, i = {}; for (n.lastIndex = 0; null !== (t = n.exec(e));) { var r = t[2]; 0 === r.indexOf('"') && r.lastIndexOf('"') === r.length - 1 && (r = r.slice(1, -1)), i[t[1]] = r } return i }, e }() }, "./src/utils/binary-search.ts": function(e, t, i) { "use strict"; i.r(t); t.default = { search: function(e, t) { for (var i = 0, r = e.length - 1, n = null, a = null; i <= r;) { var s = t(a = e[n = (i + r) / 2 | 0]); if (s > 0) i = n + 1; else { if (!(s < 0)) return a; r = n - 1 } } return null } } }, "./src/utils/buffer-helper.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "BufferHelper", function() { return a }); var r = i("./src/utils/logger.ts"), n = { length: 0, start: function() { return 0 }, end: function() { return 0 } }, a = function() { function e() {} return e.isBuffered = function(t, i) { try { if (t) for (var r = e.getBuffered(t), n = 0; n < r.length; n++) if (i >= r.start(n) && i <= r.end(n)) return !0 } catch (e) {} return !1 }, e.bufferInfo = function(t, i, r) { try { if (t) { var n, a = e.getBuffered(t), s = []; for (n = 0; n < a.length; n++) s.push({ start: a.start(n), end: a.end(n) }); return this.bufferedInfo(s, i, r) } } catch (e) {} return { len: 0, start: i, end: i, nextStart: void 0 } }, e.bufferedInfo = function(e, t, i) { t = Math.max(0, t), e.sort(function(e, t) { var i = e.start - t.start; return i || t.end - e.end }); var r = []; if (i) for (var n = 0; n < e.length; n++) { var a = r.length; if (a) { var s = r[a - 1].end; e[n].start - s < i ? e[n].end > s && (r[a - 1].end = e[n].end) : r.push(e[n]) } else r.push(e[n]) } else r = e; for (var o, u = 0, l = t, d = t, c = 0; c < r.length; c++) { var h = r[c].start, f = r[c].end; if (t + i >= h && t < f) l = h, u = (d = f) - t; else if (t + i < h) { o = h; break } } return { len: u, start: l || 0, end: d || 0, nextStart: o } }, e.getBuffered = function(e) { try { return e.buffered } catch (e) { return r.logger.log("failed to get media.buffered", e), n } }, e }() }, "./src/utils/cea-608-parser.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "Row", function() { return y }), i.d(t, "CaptionScreen", function() { return _ }); var r, n = i("./src/utils/logger.ts"), a = { 42: 225, 92: 233, 94: 237, 95: 243, 96: 250, 123: 231, 124: 247, 125: 209, 126: 241, 127: 9608, 128: 174, 129: 176, 130: 189, 131: 191, 132: 8482, 133: 162, 134: 163, 135: 9834, 136: 224, 137: 32, 138: 232, 139: 226, 140: 234, 141: 238, 142: 244, 143: 251, 144: 193, 145: 201, 146: 211, 147: 218, 148: 220, 149: 252, 150: 8216, 151: 161, 152: 42, 153: 8217, 154: 9473, 155: 169, 156: 8480, 157: 8226, 158: 8220, 159: 8221, 160: 192, 161: 194, 162: 199, 163: 200, 164: 202, 165: 203, 166: 235, 167: 206, 168: 207, 169: 239, 170: 212, 171: 217, 172: 249, 173: 219, 174: 171, 175: 187, 176: 195, 177: 227, 178: 205, 179: 204, 180: 236, 181: 210, 182: 242, 183: 213, 184: 245, 185: 123, 186: 125, 187: 92, 188: 94, 189: 95, 190: 124, 191: 8764, 192: 196, 193: 228, 194: 214, 195: 246, 196: 223, 197: 165, 198: 164, 199: 9475, 200: 197, 201: 229, 202: 216, 203: 248, 204: 9487, 205: 9491, 206: 9495, 207: 9499 }, s = function(e) { var t = e; return a.hasOwnProperty(e) && (t = a[e]), String.fromCharCode(t) }, o = 15, u = 100, l = { 17: 1, 18: 3, 21: 5, 22: 7, 23: 9, 16: 11, 19: 12, 20: 14 }, d = { 17: 2, 18: 4, 21: 6, 22: 8, 23: 10, 19: 13, 20: 15 }, c = { 25: 1, 26: 3, 29: 5, 30: 7, 31: 9, 24: 11, 27: 12, 28: 14 }, h = { 25: 2, 26: 4, 29: 6, 30: 8, 31: 10, 27: 13, 28: 15 }, f = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "black", "transparent"]; ! function(e) { e[e.ERROR = 0] = "ERROR", e[e.TEXT = 1] = "TEXT", e[e.WARNING = 2] = "WARNING", e[e.INFO = 2] = "INFO", e[e.DEBUG = 3] = "DEBUG", e[e.DATA = 3] = "DATA" }(r || (r = {})); var p = function() { function e() { this.time = null, this.verboseLevel = r.ERROR } return e.prototype.log = function(e, t) { this.verboseLevel >= e && n.logger.log(this.time + " [" + e + "] " + t) }, e }(), m = function(e) { for (var t = [], i = 0; i < e.length; i++) t.push(e[i].toString(16)); return t }, g = function() { function e(e, t, i, r, n) { this.foreground = void 0, this.underline = void 0, this.italics = void 0, this.background = void 0, this.flash = void 0, this.foreground = e || "white", this.underline = t || !1, this .italics = i || !1, this.background = r || "black", this.flash = n || !1 } var t = e.prototype; return t.reset = function() { this.foreground = "white", this.underline = !1, this.italics = !1, this.background = "black", this.flash = !1 }, t.setStyles = function(e) { for (var t = ["foreground", "underline", "italics", "background", "flash"], i = 0; i < t .length; i++) { var r = t[i]; e.hasOwnProperty(r) && (this[r] = e[r]) } }, t.isDefault = function() { return "white" === this.foreground && !this.underline && !this.italics && "black" === this .background && !this.flash }, t.equals = function(e) { return this.foreground === e.foreground && this.underline === e.underline && this.italics === e .italics && this.background === e.background && this.flash === e.flash }, t.copy = function(e) { this.foreground = e.foreground, this.underline = e.underline, this.italics = e.italics, this .background = e.background, this.flash = e.flash }, t.toString = function() { return "color=" + this.foreground + ", underline=" + this.underline + ", italics=" + this .italics + ", background=" + this.background + ", flash=" + this.flash }, e }(), v = function() { function e(e, t, i, r, n, a) { this.uchar = void 0, this.penState = void 0, this.uchar = e || " ", this.penState = new g(t, i, r, n, a) } var t = e.prototype; return t.reset = function() { this.uchar = " ", this.penState.reset() }, t.setChar = function(e, t) { this.uchar = e, this.penState.copy(t) }, t.setPenState = function(e) { this.penState.copy(e) }, t.equals = function(e) { return this.uchar === e.uchar && this.penState.equals(e.penState) }, t.copy = function(e) { this.uchar = e.uchar, this.penState.copy(e.penState) }, t.isEmpty = function() { return " " === this.uchar && this.penState.isDefault() }, e }(), y = function() { function e(e) { this.chars = void 0, this.pos = void 0, this.currPenState = void 0, this.cueStartTime = void 0, this.logger = void 0, this.chars = []; for (var t = 0; t < u; t++) this.chars.push(new v); this.logger = e, this.pos = 0, this.currPenState = new g } var t = e.prototype; return t.equals = function(e) { for (var t = !0, i = 0; i < u; i++) if (!this.chars[i].equals(e.chars[i])) { t = !1; break } return t }, t.copy = function(e) { for (var t = 0; t < u; t++) this.chars[t].copy(e.chars[t]) }, t.isEmpty = function() { for (var e = !0, t = 0; t < u; t++) if (!this.chars[t].isEmpty()) { e = !1; break } return e }, t.setCursor = function(e) { this.pos !== e && (this.pos = e), this.pos < 0 ? (this.logger.log(r.DEBUG, "Negative cursor position " + this.pos), this.pos = 0) : this.pos > u && (this.logger.log(r .DEBUG, "Too large cursor position " + this.pos), this.pos = u) }, t.moveCursor = function(e) { var t = this.pos + e; if (e > 1) for (var i = this.pos + 1; i < t + 1; i++) this.chars[i].setPenState(this.currPenState); this.setCursor(t) }, t.backSpace = function() { this.moveCursor(-1), this.chars[this.pos].setChar(" ", this.currPenState) }, t.insertChar = function(e) { e >= 144 && this.backSpace(); var t = s(e); this.pos >= u ? this.logger.log(r.ERROR, "Cannot insert " + e.toString(16) + " (" + t + ") at position " + this.pos + ". Skipping it!") : (this.chars[this.pos].setChar(t, this .currPenState), this.moveCursor(1)) }, t.clearFromPos = function(e) { var t; for (t = e; t < u; t++) this.chars[t].reset() }, t.clear = function() { this.clearFromPos(0), this.pos = 0, this.currPenState.reset() }, t.clearToEndOfRow = function() { this.clearFromPos(this.pos) }, t.getTextString = function() { for (var e = [], t = !0, i = 0; i < u; i++) { var r = this.chars[i].uchar; " " !== r && (t = !1), e.push(r) } return t ? "" : e.join("") }, t.setPenStyles = function(e) { this.currPenState.setStyles(e), this.chars[this.pos].setPenState(this.currPenState) }, e }(), _ = function() { function e(e) { this.rows = void 0, this.currRow = void 0, this.nrRollUpRows = void 0, this.lastOutputScreen = void 0, this.logger = void 0, this.rows = []; for (var t = 0; t < o; t++) this.rows.push(new y(e)); this.logger = e, this.currRow = o - 1, this.nrRollUpRows = null, this.lastOutputScreen = null, this.reset() } var t = e.prototype; return t.reset = function() { for (var e = 0; e < o; e++) this.rows[e].clear(); this.currRow = o - 1 }, t.equals = function(e) { for (var t = !0, i = 0; i < o; i++) if (!this.rows[i].equals(e.rows[i])) { t = !1; break } return t }, t.copy = function(e) { for (var t = 0; t < o; t++) this.rows[t].copy(e.rows[t]) }, t.isEmpty = function() { for (var e = !0, t = 0; t < o; t++) if (!this.rows[t].isEmpty()) { e = !1; break } return e }, t.backSpace = function() { this.rows[this.currRow].backSpace() }, t.clearToEndOfRow = function() { this.rows[this.currRow].clearToEndOfRow() }, t.insertChar = function(e) { this.rows[this.currRow].insertChar(e) }, t.setPen = function(e) { this.rows[this.currRow].setPenStyles(e) }, t.moveCursor = function(e) { this.rows[this.currRow].moveCursor(e) }, t.setCursor = function(e) { this.logger.log(r.INFO, "setCursor: " + e), this.rows[this.currRow].setCursor(e) }, t.setPAC = function(e) { this.logger.log(r.INFO, "pacData = " + JSON.stringify(e)); var t = e.row - 1; if (this.nrRollUpRows && t < this.nrRollUpRows - 1 && (t = this.nrRollUpRows - 1), this .nrRollUpRows && this.currRow !== t) { for (var i = 0; i < o; i++) this.rows[i].clear(); var n = this.currRow + 1 - this.nrRollUpRows, a = this.lastOutputScreen; if (a) { var s = a.rows[n].cueStartTime, u = this.logger.time; if (s && null !== u && s < u) for (var l = 0; l < this.nrRollUpRows; l++) this.rows[t - this.nrRollUpRows + l + 1].copy( a.rows[n + l]) } } this.currRow = t; var d = this.rows[this.currRow]; if (null !== e.indent) { var c = e.indent, h = Math.max(c - 1, 0); d.setCursor(e.indent), e.color = d.chars[h].penState.foreground } var f = { foreground: e.color, underline: e.underline, italics: e.italics, background: "black", flash: !1 }; this.setPen(f) }, t.setBkgData = function(e) { this.logger.log(r.INFO, "bkgData = " + JSON.stringify(e)), this.backSpace(), this.setPen(e), this.insertChar(32) }, t.setRollUpRows = function(e) { this.nrRollUpRows = e }, t.rollUp = function() { if (null !== this.nrRollUpRows) { this.logger.log(r.TEXT, this.getDisplayText()); var e = this.currRow + 1 - this.nrRollUpRows, t = this.rows.splice(e, 1)[0]; t.clear(), this.rows.splice(this.currRow, 0, t), this.logger.log(r.INFO, "Rolling up") } else this.logger.log(r.DEBUG, "roll_up but nrRollUpRows not set yet") }, t.getDisplayText = function(e) { e = e || !1; for (var t = [], i = "", r = -1, n = 0; n < o; n++) { var a = this.rows[n].getTextString(); a && (r = n + 1, e ? t.push("Row " + r + ": '" + a + "'") : t.push(a.trim())) } return t.length > 0 && (i = e ? "[" + t.join(" | ") + "]" : t.join("\n")), i }, t.getTextAndFormat = function() { return this.rows }, e }(), b = function() { function e(e, t, i) { this.chNr = void 0, this.outputFilter = void 0, this.mode = void 0, this.verbose = void 0, this .displayedMemory = void 0, this.nonDisplayedMemory = void 0, this.lastOutputScreen = void 0, this.currRollUpRow = void 0, this.writeScreen = void 0, this.cueStartTime = void 0, this .logger = void 0, this.chNr = e, this.outputFilter = t, this.mode = null, this.verbose = 0, this .displayedMemory = new _(i), this.nonDisplayedMemory = new _(i), this.lastOutputScreen = new _( i), this.currRollUpRow = this.displayedMemory.rows[o - 1], this.writeScreen = this .displayedMemory, this.mode = null, this.cueStartTime = null, this.logger = i } var t = e.prototype; return t.reset = function() { this.mode = null, this.displayedMemory.reset(), this.nonDisplayedMemory.reset(), this .lastOutputScreen.reset(), this.outputFilter.reset(), this.currRollUpRow = this .displayedMemory.rows[o - 1], this.writeScreen = this.displayedMemory, this.mode = null, this .cueStartTime = null }, t.getHandler = function() { return this.outputFilter }, t.setHandler = function(e) { this.outputFilter = e }, t.setPAC = function(e) { this.writeScreen.setPAC(e) }, t.setBkgData = function(e) { this.writeScreen.setBkgData(e) }, t.setMode = function(e) { e !== this.mode && (this.mode = e, this.logger.log(r.INFO, "MODE=" + e), "MODE_POP-ON" === this .mode ? this.writeScreen = this.nonDisplayedMemory : (this.writeScreen = this .displayedMemory, this.writeScreen.reset()), "MODE_ROLL-UP" !== this.mode && (this .displayedMemory.nrRollUpRows = null, this.nonDisplayedMemory.nrRollUpRows = null), this .mode = e) }, t.insertChars = function(e) { for (var t = 0; t < e.length; t++) this.writeScreen.insertChar(e[t]); var i = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP"; this.logger.log(r.INFO, i + ": " + this.writeScreen.getDisplayText(!0)), "MODE_PAINT-ON" !== this.mode && "MODE_ROLL-UP" !== this.mode || (this.logger.log(r.TEXT, "DISPLAYED: " + this .displayedMemory.getDisplayText(!0)), this.outputDataUpdate()) }, t.ccRCL = function() { this.logger.log(r.INFO, "RCL - Resume Caption Loading"), this.setMode("MODE_POP-ON") }, t.ccBS = function() { this.logger.log(r.INFO, "BS - BackSpace"), "MODE_TEXT" !== this.mode && (this.writeScreen .backSpace(), this.writeScreen === this.displayedMemory && this.outputDataUpdate()) }, t.ccAOF = function() {}, t.ccAON = function() {}, t.ccDER = function() { this.logger.log(r.INFO, "DER- Delete to End of Row"), this.writeScreen.clearToEndOfRow(), this .outputDataUpdate() }, t.ccRU = function(e) { this.logger.log(r.INFO, "RU(" + e + ") - Roll Up"), this.writeScreen = this.displayedMemory, this.setMode("MODE_ROLL-UP"), this.writeScreen.setRollUpRows(e) }, t.ccFON = function() { this.logger.log(r.INFO, "FON - Flash On"), this.writeScreen.setPen({ flash: !0 }) }, t.ccRDC = function() { this.logger.log(r.INFO, "RDC - Resume Direct Captioning"), this.setMode("MODE_PAINT-ON") }, t.ccTR = function() { this.logger.log(r.INFO, "TR"), this.setMode("MODE_TEXT") }, t.ccRTD = function() { this.logger.log(r.INFO, "RTD"), this.setMode("MODE_TEXT") }, t.ccEDM = function() { this.logger.log(r.INFO, "EDM - Erase Displayed Memory"), this.displayedMemory.reset(), this .outputDataUpdate(!0) }, t.ccCR = function() { this.logger.log(r.INFO, "CR - Carriage Return"), this.writeScreen.rollUp(), this .outputDataUpdate(!0) }, t.ccENM = function() { this.logger.log(r.INFO, "ENM - Erase Non-displayed Memory"), this.nonDisplayedMemory.reset() }, t.ccEOC = function() { if (this.logger.log(r.INFO, "EOC - End Of Caption"), "MODE_POP-ON" === this.mode) { var e = this.displayedMemory; this.displayedMemory = this.nonDisplayedMemory, this.nonDisplayedMemory = e, this .writeScreen = this.nonDisplayedMemory, this.logger.log(r.TEXT, "DISP: " + this .displayedMemory.getDisplayText()) } this.outputDataUpdate(!0) }, t.ccTO = function(e) { this.logger.log(r.INFO, "TO(" + e + ") - Tab Offset"), this.writeScreen.moveCursor(e) }, t.ccMIDROW = function(e) { var t = { flash: !1 }; if (t.underline = e % 2 == 1, t.italics = e >= 46, t.italics) t.foreground = "white"; else { var i = Math.floor(e / 2) - 16; t.foreground = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"][i] } this.logger.log(r.INFO, "MIDROW: " + JSON.stringify(t)), this.writeScreen.setPen(t) }, t.outputDataUpdate = function(e) { void 0 === e && (e = !1); var t = this.logger.time; null !== t && this.outputFilter && (null !== this.cueStartTime || this.displayedMemory .isEmpty() ? this.displayedMemory.equals(this.lastOutputScreen) || (this.outputFilter.newCue( this.cueStartTime, t, this.lastOutputScreen), e && this.outputFilter.dispatchCue && this .outputFilter.dispatchCue(), this.cueStartTime = this.displayedMemory.isEmpty() ? null : t ) : this.cueStartTime = t, this.lastOutputScreen.copy(this.displayedMemory)) }, t.cueSplitAtTime = function(e) { this.outputFilter && (this.displayedMemory.isEmpty() || (this.outputFilter.newCue && this .outputFilter.newCue(this.cueStartTime, e, this.displayedMemory), this.cueStartTime = e)) }, e }(), w = function() { function e(e, t, i) { this.channels = void 0, this.currentChannel = 0, this.cmdHistory = void 0, this.logger = void 0; var r = new p; this.channels = [null, new b(e, t, r), new b(e + 1, i, r)], this.cmdHistory = { a: null, b: null }, this.logger = r } var t = e.prototype; return t.getHandler = function(e) { return this.channels[e].getHandler() }, t.setHandler = function(e, t) { this.channels[e].setHandler(t) }, t.addData = function(e, t) { var i, n, a, s = !1; this.logger.time = e; for (var o = 0; o < t.length; o += 2) if (n = 127 & t[o], a = 127 & t[o + 1], 0 !== n || 0 !== a) { if (this.logger.log(r.DATA, "[" + m([t[o], t[o + 1]]) + "] -> (" + m([n, a]) + ")"), (i = this.parseCmd(n, a)) || (i = this.parseMidrow(n, a)), i || (i = this.parsePAC(n, a)), i || (i = this.parseBackgroundAttributes(n, a)), !i && (s = this.parseChars(n, a))) { var u = this.currentChannel; if (u && u > 0) this.channels[u].insertChars(s); else this.logger.log(r.WARNING, "No channel found yet. TEXT-MODE?") } i || s || this.logger.log(r.WARNING, "Couldn't parse cleaned data " + m([n, a]) + " orig: " + m([t[o], t[o + 1]])) } }, t.parseCmd = function(e, t) { var i = this.cmdHistory; if (!((20 === e || 28 === e || 21 === e || 29 === e) && t >= 32 && t <= 47) && !((23 === e || 31 === e) && t >= 33 && t <= 35)) return !1; if (T(e, t, i)) return E(null, null, i), this.logger.log(r.DEBUG, "Repeated command (" + m([e, t]) + ") is dropped"), !0; var n = 20 === e || 21 === e || 23 === e ? 1 : 2, a = this.channels[n]; return 20 === e || 21 === e || 28 === e || 29 === e ? 32 === t ? a.ccRCL() : 33 === t ? a .ccBS() : 34 === t ? a.ccAOF() : 35 === t ? a.ccAON() : 36 === t ? a.ccDER() : 37 === t ? a .ccRU(2) : 38 === t ? a.ccRU(3) : 39 === t ? a.ccRU(4) : 40 === t ? a.ccFON() : 41 === t ? a .ccRDC() : 42 === t ? a.ccTR() : 43 === t ? a.ccRTD() : 44 === t ? a.ccEDM() : 45 === t ? a .ccCR() : 46 === t ? a.ccENM() : 47 === t && a.ccEOC() : a.ccTO(t - 32), E(e, t, i), this .currentChannel = n, !0 }, t.parseMidrow = function(e, t) { var i = 0; if ((17 === e || 25 === e) && t >= 32 && t <= 47) { if ((i = 17 === e ? 1 : 2) !== this.currentChannel) return this.logger.log(r.ERROR, "Mismatch channel in midrow parsing"), !1; var n = this.channels[i]; return !!n && (n.ccMIDROW(t), this.logger.log(r.DEBUG, "MIDROW (" + m([e, t]) + ")"), !0) } return !1 }, t.parsePAC = function(e, t) { var i, r = this.cmdHistory; if (!((e >= 17 && e <= 23 || e >= 25 && e <= 31) && t >= 64 && t <= 127) && !((16 === e || 24 === e) && t >= 64 && t <= 95)) return !1; if (T(e, t, r)) return E(null, null, r), !0; var n = e <= 23 ? 1 : 2; i = t >= 64 && t <= 95 ? 1 === n ? l[e] : c[e] : 1 === n ? d[e] : h[e]; var a = this.channels[n]; return !!a && (a.setPAC(this.interpretPAC(i, t)), E(e, t, r), this.currentChannel = n, !0) }, t.interpretPAC = function(e, t) { var i, r = { color: null, italics: !1, indent: null, underline: !1, row: e }; return i = t > 95 ? t - 96 : t - 64, r.underline = 1 == (1 & i), i <= 13 ? r.color = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "white" ][Math.floor(i / 2)] : i <= 15 ? (r.italics = !0, r.color = "white") : r.indent = 4 * Math .floor((i - 16) / 2), r }, t.parseChars = function(e, t) { var i, n, a = null, o = null; (e >= 25 ? (i = 2, o = e - 8) : (i = 1, o = e), o >= 17 && o <= 19) ? (n = 17 === o ? t + 80 : 18 === o ? t + 112 : t + 144, this.logger.log(r.INFO, "Special char '" + s(n) + "' in channel " + i), a = [n]) : e >= 32 && e <= 127 && (a = 0 === t ? [e] : [e, t]); if (a) { var u = m(a); this.logger.log(r.DEBUG, "Char codes = " + u.join(",")), E(e, t, this.cmdHistory) } return a }, t.parseBackgroundAttributes = function(e, t) { var i; if (!((16 === e || 24 === e) && t >= 32 && t <= 47) && !((23 === e || 31 === e) && t >= 45 && t <= 47)) return !1; var r = {}; 16 === e || 24 === e ? (i = Math.floor((t - 32) / 2), r.background = f[i], t % 2 == 1 && (r .background = r.background + "_semi")) : 45 === t ? r.background = "transparent" : (r .foreground = "black", 47 === t && (r.underline = !0)); var n = e <= 23 ? 1 : 2; return this.channels[n].setBkgData(r), E(e, t, this.cmdHistory), !0 }, t.reset = function() { for (var e = 0; e < Object.keys(this.channels).length; e++) { var t = this.channels[e]; t && t.reset() } this.cmdHistory = { a: null, b: null } }, t.cueSplitAtTime = function(e) { for (var t = 0; t < this.channels.length; t++) { var i = this.channels[t]; i && i.cueSplitAtTime(e) } }, e }(); function E(e, t, i) { i.a = e, i.b = t } function T(e, t, i) { return i.a === e && i.b === t } t.default = w }, "./src/utils/codecs.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "isCodecType", function() { return n }), i.d(t, "isCodecSupportedInMp4", function() { return a }); var r = { audio: { a3ds: !0, "ac-3": !0, "ac-4": !0, alac: !0, alaw: !0, dra1: !0, "dts+": !0, "dts-": !0, dtsc: !0, dtse: !0, dtsh: !0, "ec-3": !0, enca: !0, g719: !0, g726: !0, m4ae: !0, mha1: !0, mha2: !0, mhm1: !0, mhm2: !0, mlpa: !0, mp4a: !0, "raw ": !0, Opus: !0, samr: !0, sawb: !0, sawp: !0, sevc: !0, sqcp: !0, ssmv: !0, twos: !0, ulaw: !0 }, video: { avc1: !0, avc2: !0, avc3: !0, avc4: !0, avcp: !0, av01: !0, drac: !0, dvav: !0, dvhe: !0, encv: !0, hev1: !0, hvc1: !0, mjp2: !0, mp4v: !0, mvc1: !0, mvc2: !0, mvc3: !0, mvc4: !0, resv: !0, rv60: !0, s263: !0, svc1: !0, svc2: !0, "vc-1": !0, vp08: !0, vp09: !0 }, text: { stpp: !0, wvtt: !0 } }; function n(e, t) { var i = r[t]; return !!i && !0 === i[e.slice(0, 4)] } function a(e, t) { return MediaSource.isTypeSupported((t || "video") + '/mp4;codecs="' + e + '"') } }, "./src/utils/cues.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/utils/vttparser.ts"), n = i("./src/utils/webvtt-parser.ts"), a = i("./src/utils/texttrack-utils.ts"), s = /\s/, o = { newCue: function(e, t, i, o) { for (var u, l, d, c, h, f = [], p = self.VTTCue || self.TextTrackCue, m = 0; m < o.rows .length; m++) if (d = !0, c = 0, h = "", !(u = o.rows[m]).isEmpty()) { for (var g = 0; g < u.chars.length; g++) s.test(u.chars[g].uchar) && d ? c++ : (h += u .chars[g].uchar, d = !1); u.cueStartTime = t, t === i && (i += 1e-4), c >= 16 ? c-- : c++; var v = Object(r.fixLineBreaks)(h.trim()), y = Object(n.generateCueId)(t, i, v); e && e.cues && e.cues.getCueById(y) || ((l = new p(t, i, v)).id = y, l.line = m + 1, l .align = "left", l.position = 10 + Math.min(80, 10 * Math.floor(8 * c / 32)), f.push(l)) } return e && f.length && (f.sort(function(e, t) { return "auto" === e.line || "auto" === t.line ? 0 : e.line > 8 && t.line > 8 ? t.line - e.line : e.line - t.line }), f.forEach(function(t) { return Object(a.addCueToTrack)(e, t) })), f } }; t.default = o }, "./src/utils/discontinuities.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "findFirstFragWithCC", function() { return s }), i.d(t, "shouldAlignOnDiscontinuities", function() { return o }), i.d(t, "findDiscontinuousReferenceFrag", function() { return u }), i.d(t, "adjustSlidingStart", function() { return d }), i.d(t, "alignStream", function() { return c }), i.d(t, "alignPDT", function() { return h }), i.d(t, "alignFragmentByPDTDelta", function() { return f }), i.d(t, "alignMediaPlaylistByPDT", function() { return p }); var r = i("./src/polyfills/number.ts"), n = i("./src/utils/logger.ts"), a = i("./src/controller/level-helper.ts"); function s(e, t) { for (var i = null, r = 0, n = e.length; r < n; r++) { var a = e[r]; if (a && a.cc === t) { i = a; break } } return i } function o(e, t, i) { return !(!t.details || !(i.endCC > i.startCC || e && e.cc < i.startCC)) } function u(e, t) { var i = e.fragments, r = t.fragments; if (r.length && i.length) { var a = s(i, r[0].cc); if (a && (!a || a.startPTS)) return a; n.logger.log("No frag in previous level to align on") } else n.logger.log("No fragments to align") } function l(e, t) { if (e) { var i = e.start + t; e.start = e.startPTS = i, e.endPTS = i + e.duration } } function d(e, t) { for (var i = t.fragments, r = 0, n = i.length; r < n; r++) l(i[r], e); t.fragmentHint && l(t.fragmentHint, e), t.alignedSliding = !0 } function c(e, t, i) { t && (! function(e, t, i) { if (o(e, i, t)) { var a = u(i.details, t); a && Object(r.isFiniteNumber)(a.start) && (n.logger.log( "Adjusting PTS using last level due to CC increase within current level " + t.url), d(a .start, t)) } }(e, i, t), !i.alignedSliding && t.details && h(i, t.details), i.alignedSliding || !t.details || i .skippedSegments || Object(a.adjustSliding)(t.details, i)) } function h(e, t) { if (t.fragments.length && e.hasProgramDateTime && t.hasProgramDateTime) { var i = t.fragments[0].programDateTime, a = e.fragments[0].programDateTime, s = (a - i) / 1e3 + t.fragments[0].start; s && Object(r.isFiniteNumber)(s) && (n.logger.log("Adjusting PTS using programDateTime delta " + ( a - i) + "ms, sliding:" + s.toFixed(3) + " " + e.url + " "), d(s, e)) } } function f(e, t) { var i = e.programDateTime; if (i) { var r = (i - t) / 1e3; e.start = e.startPTS = r, e.endPTS = r + e.duration } } function p(e, t) { if (t.fragments.length && e.hasProgramDateTime && t.hasProgramDateTime) { var i = t.fragments[0].programDateTime - 1e3 * t.fragments[0].start; e.fragments.forEach(function(e) { f(e, i) }), e.fragmentHint && f(e.fragmentHint, i), e.alignedSliding = !0 } } }, "./src/utils/ewma-bandwidth-estimator.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/utils/ewma.ts"), n = function() { function e(e, t, i) { this.defaultEstimate_ = void 0, this.minWeight_ = void 0, this.minDelayMs_ = void 0, this.slow_ = void 0, this.fast_ = void 0, this.defaultEstimate_ = i, this.minWeight_ = .001, this .minDelayMs_ = 50, this.slow_ = new r.default(e), this.fast_ = new r.default(t) } var t = e.prototype; return t.update = function(e, t) { var i = this.slow_, n = this.fast_; this.slow_.halfLife !== e && (this.slow_ = new r.default(e, i.getEstimate(), i .getTotalWeight())), this.fast_.halfLife !== t && (this.fast_ = new r.default(t, n .getEstimate(), n.getTotalWeight())) }, t.sample = function(e, t) { var i = (e = Math.max(e, this.minDelayMs_)) / 1e3, r = 8 * t / i; this.fast_.sample(i, r), this.slow_.sample(i, r) }, t.canEstimate = function() { var e = this.fast_; return e && e.getTotalWeight() >= this.minWeight_ }, t.getEstimate = function() { return this.canEstimate() ? Math.min(this.fast_.getEstimate(), this.slow_.getEstimate()) : this .defaultEstimate_ }, t.destroy = function() {}, e }(); t.default = n }, "./src/utils/ewma.ts": function(e, t, i) { "use strict"; i.r(t); var r = function() { function e(e, t, i) { void 0 === t && (t = 0), void 0 === i && (i = 0), this.halfLife = void 0, this.alpha_ = void 0, this.estimate_ = void 0, this.totalWeight_ = void 0, this.halfLife = e, this.alpha_ = e ? Math .exp(Math.log(.5) / e) : 0, this.estimate_ = t, this.totalWeight_ = i } var t = e.prototype; return t.sample = function(e, t) { var i = Math.pow(this.alpha_, e); this.estimate_ = t * (1 - i) + i * this.estimate_, this.totalWeight_ += e }, t.getTotalWeight = function() { return this.totalWeight_ }, t.getEstimate = function() { if (this.alpha_) { var e = 1 - Math.pow(this.alpha_, this.totalWeight_); if (e) return this.estimate_ / e } return this.estimate_ }, e }(); t.default = r }, "./src/utils/fetch-loader.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "fetchSupported", function() { return c }); var r = i("./src/polyfills/number.ts"), n = i("./src/loader/load-stats.ts"), a = i("./src/demux/chunk-cache.ts"); function s(e) { var t = "function" == typeof Map ? new Map : void 0; return (s = function(e) { if (null === e || (i = e, -1 === Function.toString.call(i).indexOf("[native code]"))) return e; var i; if ("function" != typeof e) throw new TypeError( "Super expression must either be null or a function"); if (void 0 !== t) { if (t.has(e)) return t.get(e); t.set(e, r) } function r() { return o(e, arguments, l(this).constructor) } return r.prototype = Object.create(e.prototype, { constructor: { value: r, enumerable: !1, writable: !0, configurable: !0 } }), u(r, e) })(e) } function o(e, t, i) { return (o = function() { if ("undefined" == typeof Reflect || !Reflect.construct) return !1; if (Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }() ? Reflect.construct.bind() : function(e, t, i) { var r = [null]; r.push.apply(r, t); var n = new(Function.bind.apply(e, r)); return i && u(n, i.prototype), n }).apply(null, arguments) } function u(e, t) { return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e })(e, t) } function l(e) { return (l = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) })(e) } function d() { return (d = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }).apply(this, arguments) } function c() { if (self.fetch && self.AbortController && self.ReadableStream && self.Request) try { return new self.ReadableStream({}), !0 } catch (e) {} return !1 } var h = function() { function e(e) { this.fetchSetup = void 0, this.requestTimeout = void 0, this.request = void 0, this.response = void 0, this.controller = void 0, this.context = void 0, this.config = null, this.callbacks = null, this.stats = void 0, this.loader = null, this.fetchSetup = e.fetchSetup || f, this .controller = new self.AbortController, this.stats = new n.LoadStats } var t = e.prototype; return t.destroy = function() { this.loader = this.callbacks = null, this.abortInternal() }, t.abortInternal = function() { var e = this.response; e && e.ok || (this.stats.aborted = !0, this.controller.abort()) }, t.abort = function() { var e; this.abortInternal(), null !== (e = this.callbacks) && void 0 !== e && e.onAbort && this .callbacks.onAbort(this.stats, this.context, this.response) }, t.load = function(e, t, i) { var n = this, a = this.stats; if (a.loading.start) throw new Error("Loader can only be used once."); a.loading.start = self.performance.now(); var s = function(e, t) { var i = { method: "GET", mode: "cors", credentials: "same-origin", signal: t, headers: new self.Headers(d({}, e.headers)) }; e.rangeEnd && i.headers.set("Range", "bytes=" + e.rangeStart + "-" + String(e.rangeEnd - 1)); return i }(e, this.controller.signal), o = i.onProgress, u = "arraybuffer" === e.responseType, l = u ? "byteLength" : "length"; this.context = e, this.config = t, this.callbacks = i, this.request = this.fetchSetup(e, s), self.clearTimeout(this.requestTimeout), this.requestTimeout = self.setTimeout(function() { n.abortInternal(), i.onTimeout(a, e, n.response) }, t.timeout), self.fetch(this.request).then(function(i) { if (n.response = n.loader = i, !i.ok) { var s = i.status, l = i.statusText; throw new p(l || "fetch, bad network response", s, i) } return a.loading.first = Math.max(self.performance.now(), a.loading.start), a.total = parseInt(i.headers.get("Content-Length") || "0"), o && Object(r.isFiniteNumber)(t .highWaterMark) ? n.loadProgressively(i, a, e, t.highWaterMark, o) : u ? i .arrayBuffer() : i.text() }).then(function(s) { var u = n.response; self.clearTimeout(n.requestTimeout), a.loading.end = Math.max(self.performance.now(), a .loading.first), a.loaded = a.total = s[l]; var d = { url: u.url, data: s }; o && !Object(r.isFiniteNumber)(t.highWaterMark) && o(a, e, s, u), i.onSuccess(d, a, e, u) }).catch(function(t) { if (self.clearTimeout(n.requestTimeout), !a.aborted) { var r = t && t.code || 0, s = t ? t.message : null; i.onError({ code: r, text: s }, e, t ? t.details : null) } }) }, t.getCacheAge = function() { var e = null; if (this.response) { var t = this.response.headers.get("age"); e = t ? parseFloat(t) : null } return e }, t.loadProgressively = function(e, t, i, r, n) { void 0 === r && (r = 0); var s = new a.default, o = e.body.getReader(); return function a() { return o.read().then(function(o) { if (o.done) return s.dataLength && n(t, i, s.flush(), e), Promise.resolve( new ArrayBuffer(0)); var u = o.value, l = u.length; return t.loaded += l, l < r || s.dataLength ? (s.push(u), s.dataLength >= r && n(t, i, s.flush(), e)) : n(t, i, u, e), a() }).catch(function() { return Promise.reject() }) }() }, e }(); function f(e, t) { return new self.Request(e.url, t) } var p = function(e) { var t, i; function r(t, i, r) { var n; return (n = e.call(this, t) || this).code = void 0, n.details = void 0, n.code = i, n.details = r, n } return i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i), r }(s(Error)); t.default = h }, "./src/utils/imsc1-ttml-parser.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "IMSC1_CODEC", function() { return d }), i.d(t, "parseIMSC1", function() { return p }); var r = i("./src/utils/mp4-tools.ts"), n = i("./src/utils/vttparser.ts"), a = i("./src/utils/vttcue.ts"), s = i("./src/demux/id3.ts"), o = i("./src/utils/timescale-conversion.ts"), u = i("./src/utils/webvtt-parser.ts"); function l() { return (l = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var i = arguments[t]; for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) } return e }).apply(this, arguments) } var d = "stpp.ttml.im1t", c = /^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/, h = /^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/, f = { left: "start", center: "center", right: "end", start: "start", end: "end" }; function p(e, t, i, n, d) { var c = Object(r.findBox)(new Uint8Array(e), ["mdat"]); if (0 !== c.length) { var h = c.map(function(e) { return Object(s.utf8ArrayToStr)(e) }), p = Object(o.toTimescaleFromScale)(t, 1, i); try { h.forEach(function(e) { return n(function(e, t) { var i = (new DOMParser).parseFromString(e, "text/xml").getElementsByTagName("tt")[0]; if (!i) throw new Error("Invalid ttml"); var r = { frameRate: 30, subFrameRate: 1, frameRateMultiplier: 0, tickRate: 0 }, n = Object.keys(r).reduce(function(e, t) { return e[t] = i.getAttribute("ttp:" + t) || r[t], e }, {}), s = "preserve" !== i.getAttribute("xml:space"), o = g(m(i, "styling", "style")), d = g(m(i, "layout", "region")), c = m(i, "body", "[begin]"); return [].map.call(c, function(e) { var i = function e(t, i) { return [].slice.call(t.childNodes).reduce(function(t, r, n) { var a; return "br" === r.nodeName && n ? t + "\n" : null !== (a = r .childNodes) && void 0 !== a && a.length ? e(r, i) : i ? t + r .textContent.trim().replace(/\s+/g, " ") : t + r.textContent }, "") }(e, s); if (!i || !e.hasAttribute("begin")) return null; var r = _(e.getAttribute("begin"), n), c = _(e.getAttribute("dur"), n), h = _(e.getAttribute("end"), n); if (null === r) throw y(e); if (null === h) { if (null === c) throw y(e); h = r + c } var p = new a.default(r - t, h - t, i); p.id = Object(u.generateCueId)(p.startTime, p.endTime, p.text); var m = d[e.getAttribute("region")], g = o[e.getAttribute("style")]; p.position = 10, p.size = 80; var b = function(e, t, i) { var r = "http://www.w3.org/ns/ttml#styling", n = null, a = null !== e && void 0 !== e && e.hasAttribute("style") ? e .getAttribute("style") : null; a && i.hasOwnProperty(a) && (n = i[a]); return ["displayAlign", "textAlign", "color", "backgroundColor", "fontSize", "fontFamily" ].reduce(function(i, a) { var s = v(t, r, a) || v(e, r, a) || v(n, r, a); return s && (i[a] = s), i }, {}) }(m, g, o), w = b.textAlign; if (w) { var E = f[w]; E && (p.lineAlign = E), p.align = w } return l(p, b), p }).filter(function(e) { return null !== e }) }(e, p)) }) } catch (e) { d(e) } } else d(new Error("Could not parse IMSC1 mdat")) } function m(e, t, i) { var r = e.getElementsByTagName(t)[0]; return r ? [].slice.call(r.querySelectorAll(i)) : [] } function g(e) { return e.reduce(function(e, t) { var i = t.getAttribute("xml:id"); return i && (e[i] = t), e }, {}) } function v(e, t, i) { return e && e.hasAttributeNS(t, i) ? e.getAttributeNS(t, i) : null } function y(e) { return new Error("Could not parse ttml timestamp " + e) } function _(e, t) { if (!e) return null; var i = Object(n.parseTimeStamp)(e); return null === i && (c.test(e) ? i = function(e, t) { var i = c.exec(e), r = (0 | i[4]) + (0 | i[5]) / t.subFrameRate; return 3600 * (0 | i[1]) + 60 * (0 | i[2]) + (0 | i[3]) + r / t.frameRate }(e, t) : h.test(e) && (i = function(e, t) { var i = h.exec(e), r = Number(i[1]); switch (i[2]) { case "h": return 3600 * r; case "m": return 60 * r; case "ms": return 1e3 * r; case "f": return r / t.frameRate; case "t": return r / t.tickRate } return r }(e, t))), i } }, "./src/utils/logger.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "enableLogs", function() { return o }), i.d(t, "logger", function() { return u }); var r = function() {}, n = { trace: r, debug: r, log: r, warn: r, info: r, error: r }, a = n; function s(e) { for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++) i[n - 1] = arguments[n]; i.forEach(function(t) { a[t] = e[t] ? e[t].bind(e) : function(e) { var t = self.console[e]; return t ? t.bind(self.console, "[" + e + "] >") : r }(t) }) } function o(e) { if (self.console && !0 === e || "object" == typeof e) { s(e, "debug", "log", "info", "warn", "error"); try { a.log() } catch (e) { a = n } } else a = n } var u = n }, "./src/utils/mediakeys-helper.ts": function(e, t, i) { "use strict"; var r; i.r(t), i.d(t, "KeySystems", function() { return r }), i.d(t, "requestMediaKeySystemAccess", function() { return n }), function(e) { e.WIDEVINE = "com.widevine.alpha", e.PLAYREADY = "com.microsoft.playready" }(r || (r = {})); var n = "undefined" != typeof self && self.navigator && self.navigator.requestMediaKeySystemAccess ? self.navigator.requestMediaKeySystemAccess.bind(self.navigator) : null }, "./src/utils/mediasource-helper.ts": function(e, t, i) { "use strict"; function r() { return self.MediaSource || self.WebKitMediaSource } i.r(t), i.d(t, "getMediaSource", function() { return r }) }, "./src/utils/mp4-tools.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "RemuxerTrackIdConfig", function() { return u }), i.d(t, "bin2str", function() { return l }), i.d(t, "readUint16", function() { return d }), i.d(t, "readUint32", function() { return c }), i.d(t, "readSint32", function() { return h }), i.d(t, "writeUint32", function() { return f }), i.d(t, "findBox", function() { return p }), i.d(t, "parseSegmentIndex", function() { return m }), i.d(t, "parseInitSegment", function() { return g }), i.d(t, "getStartDTS", function() { return v }), i.d(t, "getDuration", function() { return y }), i.d(t, "computeRawDurationFromSamples", function() { return _ }), i.d(t, "offsetStartDTS", function() { return b }), i.d(t, "segmentValidRange", function() { return w }), i.d(t, "appendUint8Array", function() { return E }), i.d(t, "parseSamples", function() { return T }), i.d(t, "parseSEIMessageFromNALu", function() { return A }), i.d(t, "parseEmsg", function() { return k }); var r = i("./src/utils/typed-array.ts"), n = i("./src/loader/fragment.ts"), a = i("./src/demux/id3.ts"), s = Math.pow(2, 32) - 1, o = [].push, u = { video: 1, audio: 2, id3: 3, text: 4 }; function l(e) { return String.fromCharCode.apply(null, e) } function d(e, t) { var i = e[t] << 8 | e[t + 1]; return i < 0 ? 65536 + i : i } function c(e, t) { var i = h(e, t); return i < 0 ? 4294967296 + i : i } function h(e, t) { return e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3] } function f(e, t, i) { e[t] = i >> 24, e[t + 1] = i >> 16 & 255, e[t + 2] = i >> 8 & 255, e[t + 3] = 255 & i } function p(e, t) { var i = []; if (!t.length) return i; for (var r = e.byteLength, n = 0; n < r;) { var a = c(e, n), s = l(e.subarray(n + 4, n + 8)), u = a > 1 ? n + a : r; if (s === t[0]) if (1 === t.length) i.push(e.subarray(n + 8, u)); else { var d = p(e.subarray(n + 8, u), t.slice(1)); d.length && o.apply(i, d) } n = u } return i } function m(e) { var t = p(e, ["moov"])[0], i = t ? t.length : null, r = p(e, ["sidx"]); if (!r || !r[0]) return null; var n = [], a = r[0], s = a[0], o = 0 === s ? 8 : 16, u = c(a, o); o += 4; o += 0 === s ? 8 : 16, o += 2; var l = a.length + 0, h = d(a, o); o += 2; for (var f = 0; f < h; f++) { var m = o, g = c(a, m); m += 4; var v = 2147483647 & g; if (1 === (2147483648 & g) >>> 31) return console.warn( "SIDX has hierarchical references (not supported)"), null; var y = c(a, m); m += 4, n.push({ referenceSize: v, subsegmentDuration: y, info: { duration: y / u, start: l, end: l + v - 1 } }), l += v, o = m += 4 } return { earliestPresentationTime: 0, timescale: u, version: s, referencesCount: h, references: n, moovEndOffset: i } } function g(e) { for (var t = [], i = p(e, ["moov", "trak"]), r = 0; r < i.length; r++) { var a = i[r], s = p(a, ["tkhd"])[0]; if (s) { var o = s[0], u = 0 === o ? 12 : 20, d = c(s, u), h = p(a, ["mdia", "mdhd"])[0]; if (h) { var f = c(h, u = 0 === (o = h[0]) ? 12 : 20), m = p(a, ["mdia", "hdlr"])[0]; if (m) { var g = l(m.subarray(8, 12)), v = { soun: n.ElementaryStreamTypes.AUDIO, vide: n.ElementaryStreamTypes.VIDEO } [g]; if (v) { var y = p(a, ["mdia", "minf", "stbl", "stsd"])[0], _ = void 0; y && (_ = l(y.subarray(12, 16))), t[d] = { timescale: f, type: v }, t[v] = { timescale: f, id: d, codec: _ } } } } } } return p(e, ["moov", "mvex", "trex"]).forEach(function(e) { var i = c(e, 4), r = t[i]; r && (r.default = { duration: c(e, 12), flags: c(e, 20) }) }), t } function v(e, t) { return p(t, ["moof", "traf"]).reduce(function(t, i) { var r = p(i, ["tfdt"])[0], n = r[0], a = p(i, ["tfhd"]).reduce(function(t, i) { var a = c(i, 4), s = e[a]; if (s) { var o = c(r, 4); 1 === n && (o *= Math.pow(2, 32), o += c(r, 8)); var u = o / (s.timescale || 9e4); if (isFinite(u) && (null === t || u < t)) return u } return t }, null); return null !== a && isFinite(a) && (null === t || a < t) ? a : t }, null) || 0 } function y(e, t) { for (var i = 0, r = 0, a = 0, s = p(e, ["moof", "traf"]), o = 0; o < s.length; o++) { var u = s[o], l = p(u, ["tfhd"])[0], d = t[c(l, 4)]; if (d) { var h = d.default, f = c(l, 0) | (null === h || void 0 === h ? void 0 : h.flags), g = null === h || void 0 === h ? void 0 : h.duration; 8 & f && (g = c(l, 2 & f ? 12 : 8)); for (var v = d.timescale || 9e4, y = p(u, ["trun"]), b = 0; b < y.length; b++) { if (!(i = _(y[b])) && g) i = g * c(y[b], 4); d.type === n.ElementaryStreamTypes.VIDEO ? r += i / v : d.type === n.ElementaryStreamTypes .AUDIO && (a += i / v) } } } if (0 === r && 0 === a) { var w = m(e); if (null !== w && void 0 !== w && w.references) return w.references.reduce(function(e, t) { return e + t.info.duration || 0 }, 0) } return r || a } function _(e) { var t = c(e, 0), i = 8; 1 & t && (i += 4), 4 & t && (i += 4); for (var r = 0, n = c(e, 4), a = 0; a < n; a++) { if (256 & t) r += c(e, i), i += 4; 512 & t && (i += 4), 1024 & t && (i += 4), 2048 & t && (i += 4) } return r } function b(e, t, i) { p(t, ["moof", "traf"]).forEach(function(t) { p(t, ["tfhd"]).forEach(function(r) { var n = c(r, 4), a = e[n]; if (a) { var o = a.timescale || 9e4; p(t, ["tfdt"]).forEach(function(e) { var t = e[0], r = c(e, 4); if (0 === t) r -= i * o, f(e, 4, r = Math.max(r, 0)); else { r *= Math.pow(2, 32), r += c(e, 8), r -= i * o, r = Math.max(r, 0); var n = Math.floor(r / (s + 1)), a = Math.floor(r % (s + 1)); f(e, 4, n), f(e, 8, a) } }) } }) }) } function w(e) { var t = { valid: null, remainder: null }, i = p(e, ["moof"]); if (!i) return t; if (i.length < 2) return t.remainder = e, t; var n = i[i.length - 1]; return t.valid = Object(r.sliceUint8)(e, 0, n.byteOffset - 8), t.remainder = Object(r.sliceUint8)(e, n .byteOffset - 8), t } function E(e, t) { var i = new Uint8Array(e.length + t.length); return i.set(e), i.set(t, e.length), i } function T(e, t) { var i = [], r = t.samples, a = t.timescale, s = t.id, o = !1; return p(r, ["moof"]).map(function(u) { var l = u.byteOffset - 8; p(u, ["traf"]).map(function(u) { var d = p(u, ["tfdt"]).map(function(e) { var t = e[0], i = c(e, 4); return 1 === t && (i *= Math.pow(2, 32), i += c(e, 8)), i / a })[0]; return void 0 !== d && (e = d), p(u, ["tfhd"]).map(function(d) { var f = c(d, 4), m = 16777215 & c(d, 0), g = 0, v = 0 != (16 & m), y = 0, _ = 0 != (32 & m), b = 8; f === s && (0 != (1 & m) && (b += 8), 0 != (2 & m) && (b += 4), 0 != (8 & m) && (g = c(d, b), b += 4), v && (y = c(d, b), b += 4), _ && (b += 4), "video" === t .type && (o = function(e) { if (!e) return !1; var t = e.indexOf("."), i = t < 0 ? e : e.substring(0, t); return "hvc1" === i || "hev1" === i || "dvh1" === i || "dvhe" === i }(t.codec)), p(u, ["trun"]).map(function(s) { var u = s[0], d = 16777215 & c(s, 0), f = 0 != (1 & d), p = 0, m = 0 != (4 & d), v = 0 != (256 & d), _ = 0, b = 0 != (512 & d), w = 0, E = 0 != (1024 & d), T = 0 != (2048 & d), k = 0, R = c(s, 4), M = 8; f && (p = c(s, M), M += 4), m && (M += 4); for (var O = p + l, C = 0; C < R; C++) { if (v ? (_ = c(s, M), M += 4) : _ = g, b ? (w = c(s, M), M += 4) : w = y, E && (M += 4), T && (k = 0 === u ? c(s, M) : h(s, M), M += 4), t .type === n.ElementaryStreamTypes.VIDEO) for (var D = 0; D < w;) { var I = c(r, O), L = 31 & r[O += 4]; if (S(o, L)) A(r.subarray(O, O + I), e + k / a, i); O += I, D += I + 4 } e += _ / a } })) }) }) }), i } function S(e, t) { return e ? 39 === t || 40 === t : 6 === t } function A(e, t, i) { var r = function(e) { var t = e.byteLength, i = [], r = 1; for (; r < t - 2;) 0 === e[r] && 0 === e[r + 1] && 3 === e[r + 2] ? (i.push(r + 2), r += 2) : r++; if (0 === i.length) return e; var n = t - i.length, a = new Uint8Array(n), s = 0; for (r = 0; r < n; s++, r++) s === i[0] && (s++, i.shift()), a[r] = e[s]; return a }(e), n = 0; n++; for (var s = 0, o = 0, u = !1, l = 0; n < r.length;) { s = 0; do { if (n >= r.length) break; s += l = r[n++] } while (255 === l); o = 0; do { if (n >= r.length) break; o += l = r[n++] } while (255 === l); var h = r.length - n; if (!u && 4 === s && n < r.length) { if (u = !0, 181 === r[n++]) { var f = d(r, n); if (n += 2, 49 === f) { var p = c(r, n); if (n += 4, 1195456820 === p) { var m = r[n++]; if (3 === m) { var g = r[n++], v = 64 & g, y = v ? 2 + 3 * (31 & g) : 0, _ = new Uint8Array(y); if (v) { _[0] = g; for (var b = 1; b < y; b++) _[b] = r[n++] } i.push({ type: m, payloadType: s, pts: t, bytes: _ }) } } } } } else if (5 === s && o < h) { if (u = !0, o > 16) { for (var w = [], E = 0; E < 16; E++) { var T = r[n++].toString(16); w.push(1 == T.length ? "0" + T : T), 3 !== E && 5 !== E && 7 !== E && 9 !== E || w.push("-") } for (var S = o - 16, A = new Uint8Array(S), k = 0; k < S; k++) A[k] = r[n++]; i.push({ payloadType: s, pts: t, uuid: w.join(""), userData: Object(a.utf8ArrayToStr)(A), userDataBytes: A }) } } else if (o < h) n += o; else if (o > h) break } } function k(e) { var t = e[0], i = "", r = "", n = 0, a = 0, s = 0, o = 0, u = 0, d = 0; if (0 === t) { for (; "\0" !== l(e.subarray(d, d + 1));) i += l(e.subarray(d, d + 1)), d += 1; for (i += l(e.subarray(d, d + 1)), d += 1; "\0" !== l(e.subarray(d, d + 1));) r += l(e.subarray(d, d + 1)), d += 1; r += l(e.subarray(d, d + 1)), d += 1, n = c(e, 12), a = c(e, 16), o = c(e, 20), u = c(e, 24), d = 28 } else if (1 === t) { n = c(e, d += 4); var h = c(e, d += 4), f = c(e, d += 4); for (d += 4, s = Math.pow(2, 32) * h + f, Number.isSafeInteger(s) || (s = Number.MAX_SAFE_INTEGER, console.warn( "Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box" )), o = c(e, d), u = c(e, d += 4), d += 4; "\0" !== l(e.subarray(d, d + 1));) i += l(e.subarray(d, d + 1)), d += 1; for (i += l(e.subarray(d, d + 1)), d += 1; "\0" !== l(e.subarray(d, d + 1));) r += l(e.subarray(d, d + 1)), d += 1; r += l(e.subarray(d, d + 1)), d += 1 } return { schemeIdUri: i, value: r, timeScale: n, presentationTime: s, presentationTimeDelta: a, eventDuration: o, id: u, payload: e.subarray(d, e.byteLength) } } }, "./src/utils/output-filter.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "default", function() { return r }); var r = function() { function e(e, t) { this.timelineController = void 0, this.cueRanges = [], this.trackName = void 0, this.startTime = null, this.endTime = null, this.screen = null, this.timelineController = e, this.trackName = t } var t = e.prototype; return t.dispatchCue = function() { null !== this.startTime && (this.timelineController.addCues(this.trackName, this.startTime, this .endTime, this.screen, this.cueRanges), this.startTime = null) }, t.newCue = function(e, t, i) { (null === this.startTime || this.startTime > e) && (this.startTime = e), this.endTime = t, this .screen = i, this.timelineController.createCaptionsTrack(this.trackName) }, t.reset = function() { this.cueRanges = [], this.startTime = null }, e }() }, "./src/utils/texttrack-utils.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "sendAddTrackEvent", function() { return n }), i.d(t, "addCueToTrack", function() { return a }), i.d(t, "clearCurrentCues", function() { return s }), i.d(t, "removeCuesInRange", function() { return o }), i.d(t, "getCuesInRange", function() { return u }); var r = i("./src/utils/logger.ts"); function n(e, t) { var i; try { i = new Event("addtrack") } catch (e) { (i = document.createEvent("Event")).initEvent("addtrack", !1, !1) } i.track = e, t.dispatchEvent(i) } function a(e, t) { var i = e.mode; if ("disabled" === i && (e.mode = "hidden"), e.cues && !e.cues.getCueById(t.id)) try { if (e.addCue(t), !e.cues.getCueById(t.id)) throw new Error("addCue is failed for: " + t) } catch (i) { r.logger.debug("[texttrack-utils]: " + i); var n = new self.TextTrackCue(t.startTime, t.endTime, t.text); n.id = t.id, e.addCue(n) } "disabled" === i && (e.mode = i) } function s(e) { var t = e.mode; if ("disabled" === t && (e.mode = "hidden"), e.cues) for (var i = e.cues.length; i--;) e.removeCue(e.cues[i]); "disabled" === t && (e.mode = t) } function o(e, t, i) { var r = e.mode; if ("disabled" === r && (e.mode = "hidden"), e.cues && e.cues.length > 0) for (var n = u(e.cues, t, i), a = 0; a < n.length; a++) e.removeCue(n[a]); "disabled" === r && (e.mode = r) } function u(e, t, i) { var r = [], n = function(e, t) { if (t < e[0].startTime) return 0; var i = e.length - 1; if (t > e[i].endTime) return -1; for (var r = 0, n = i; r <= n;) { var a = Math.floor((n + r) / 2); if (t < e[a].startTime) n = a - 1; else { if (!(t > e[a].startTime && r < i)) return a; r = a + 1 } } return e[r].startTime - t < t - e[n].startTime ? r : n }(e, t); if (n > -1) for (var a = n, s = e.length; a < s; a++) { var o = e[a]; if (o.startTime >= t && o.endTime <= i) r.push(o); else if (o.startTime > i) return r } return r } }, "./src/utils/time-ranges.ts": function(e, t, i) { "use strict"; i.r(t); t.default = { toString: function(e) { for (var t = "", i = e.length, r = 0; r < i; r++) t += "[" + e.start(r).toFixed(3) + "," + e .end(r).toFixed(3) + "]"; return t } } }, "./src/utils/timescale-conversion.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "toTimescaleFromBase", function() { return n }), i.d(t, "toTimescaleFromScale", function() { return a }), i.d(t, "toMsFromMpegTsClock", function() { return s }), i.d(t, "toMpegTsClockFromTimescale", function() { return o }); var r = 9e4; function n(e, t, i, r) { void 0 === i && (i = 1), void 0 === r && (r = !1); var n = e * t * i; return r ? Math.round(n) : n } function a(e, t, i, r) { return void 0 === i && (i = 1), void 0 === r && (r = !1), n(e, t, 1 / i, r) } function s(e, t) { return void 0 === t && (t = !1), n(e, 1e3, 1 / r, t) } function o(e, t) { return void 0 === t && (t = 1), n(e, r, 1 / t) } }, "./src/utils/typed-array.ts": function(e, t, i) { "use strict"; function r(e, t, i) { return Uint8Array.prototype.slice ? e.slice(t, i) : new Uint8Array(Array.prototype.slice.call(e, t, i)) } i.r(t), i.d(t, "sliceUint8", function() { return r }) }, "./src/utils/vttcue.ts": function(e, t, i) { "use strict"; i.r(t), t.default = function() { if ("undefined" != typeof self && self.VTTCue) return self.VTTCue; var e = ["", "lr", "rl"], t = ["start", "middle", "end", "left", "right"]; function i(e, t) { if ("string" != typeof t) return !1; if (!Array.isArray(e)) return !1; var i = t.toLowerCase(); return !!~e.indexOf(i) && i } function r(e) { return i(t, e) } function n(e) { for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) i[r - 1] = arguments[r]; for (var n = 1; n < arguments.length; n++) { var a = arguments[n]; for (var s in a) e[s] = a[s] } return e } function a(t, a, s) { var o = this, u = { enumerable: !0 }; o.hasBeenReset = !1; var l = "", d = !1, c = t, h = a, f = s, p = null, m = "", g = !0, v = "auto", y = "start", _ = 50, b = "middle", w = 50, E = "middle"; Object.defineProperty(o, "id", n({}, u, { get: function() { return l }, set: function(e) { l = "" + e } })), Object.defineProperty(o, "pauseOnExit", n({}, u, { get: function() { return d }, set: function(e) { d = !!e } })), Object.defineProperty(o, "startTime", n({}, u, { get: function() { return c }, set: function(e) { if ("number" != typeof e) throw new TypeError("Start time must be set to a number."); c = e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "endTime", n({}, u, { get: function() { return h }, set: function(e) { if ("number" != typeof e) throw new TypeError("End time must be set to a number."); h = e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "text", n({}, u, { get: function() { return f }, set: function(e) { f = "" + e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "region", n({}, u, { get: function() { return p }, set: function(e) { p = e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "vertical", n({}, u, { get: function() { return m }, set: function(t) { var r = function(t) { return i(e, t) }(t); if (!1 === r) throw new SyntaxError("An invalid or illegal string was specified."); m = r, this.hasBeenReset = !0 } })), Object.defineProperty(o, "snapToLines", n({}, u, { get: function() { return g }, set: function(e) { g = !!e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "line", n({}, u, { get: function() { return v }, set: function(e) { if ("number" != typeof e && "auto" !== e) throw new SyntaxError( "An invalid number or illegal string was specified."); v = e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "lineAlign", n({}, u, { get: function() { return y }, set: function(e) { var t = r(e); if (!t) throw new SyntaxError("An invalid or illegal string was specified."); y = t, this.hasBeenReset = !0 } })), Object.defineProperty(o, "position", n({}, u, { get: function() { return _ }, set: function(e) { if (e < 0 || e > 100) throw new Error("Position must be between 0 and 100."); _ = e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "positionAlign", n({}, u, { get: function() { return b }, set: function(e) { var t = r(e); if (!t) throw new SyntaxError("An invalid or illegal string was specified."); b = t, this.hasBeenReset = !0 } })), Object.defineProperty(o, "size", n({}, u, { get: function() { return w }, set: function(e) { if (e < 0 || e > 100) throw new Error("Size must be between 0 and 100."); w = e, this.hasBeenReset = !0 } })), Object.defineProperty(o, "align", n({}, u, { get: function() { return E }, set: function(e) { var t = r(e); if (!t) throw new SyntaxError("An invalid or illegal string was specified."); E = t, this.hasBeenReset = !0 } })), o.displayState = void 0 } return a.prototype.getCueAsHTML = function() { return self.WebVTT.convertCueToDOMTree(self, this.text) }, a }() }, "./src/utils/vttparser.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "parseTimeStamp", function() { return a }), i.d(t, "fixLineBreaks", function() { return c }), i.d(t, "VTTParser", function() { return h }); var r = i("./src/utils/vttcue.ts"), n = function() { function e() {} return e.prototype.decode = function(e, t) { if (!e) return ""; if ("string" != typeof e) throw new Error("Error - expected string data."); return decodeURIComponent(encodeURIComponent(e)) }, e }(); function a(e) { function t(e, t, i, r) { return 3600 * (0 | e) + 60 * (0 | t) + (0 | i) + parseFloat(r || 0) } var i = e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/); return i ? parseFloat(i[2]) > 59 ? t(i[2], i[3], 0, i[4]) : t(i[1], i[2], i[3], i[4]) : null } var s = function() { function e() { this.values = Object.create(null) } var t = e.prototype; return t.set = function(e, t) { this.get(e) || "" === t || (this.values[e] = t) }, t.get = function(e, t, i) { return i ? this.has(e) ? this.values[e] : t[i] : this.has(e) ? this.values[e] : t }, t.has = function(e) { return e in this.values }, t.alt = function(e, t, i) { for (var r = 0; r < i.length; ++r) if (t === i[r]) { this.set(e, t); break } }, t.integer = function(e, t) { /^-?\d+$/.test(t) && this.set(e, parseInt(t, 10)) }, t.percent = function(e, t) { if (/^([\d]{1,3})(\.[\d]*)?%$/.test(t)) { var i = parseFloat(t); if (i >= 0 && i <= 100) return this.set(e, i), !0 } return !1 }, e }(); function o(e, t, i, r) { var n = r ? e.split(r) : [e]; for (var a in n) if ("string" == typeof n[a]) { var s = n[a].split(i); if (2 === s.length) t(s[0], s[1]) } } var u = new r.default(0, 0, ""), l = "middle" === u.align ? "middle" : "center"; function d(e, t, i) { var r = e; function n() { var t = a(e); if (null === t) throw new Error("Malformed timestamp: " + r); return e = e.replace(/^[^\sa-zA-Z-]+/, ""), t } function d() { e = e.replace(/^\s+/, "") } if (d(), t.startTime = n(), d(), "--\x3e" !== e.slice(0, 3)) throw new Error( "Malformed time stamp (time stamps must be separated by '--\x3e'): " + r); e = e.slice(3), d(), t.endTime = n(), d(), function(e, t) { var r = new s; o(e, function(e, t) { var n; switch (e) { case "region": for (var a = i.length - 1; a >= 0; a--) if (i[a].id === t) { r.set(e, i[a].region); break } break; case "vertical": r.alt(e, t, ["rl", "lr"]); break; case "line": n = t.split(","), r.integer(e, n[0]), r.percent(e, n[0]) && r.set("snapToLines", !1), r .alt(e, n[0], ["auto"]), 2 === n.length && r.alt("lineAlign", n[1], ["start", l, "end"]); break; case "position": n = t.split(","), r.percent(e, n[0]), 2 === n.length && r.alt("positionAlign", n[1], [ "start", l, "end", "line-left", "line-right", "auto" ]); break; case "size": r.percent(e, t); break; case "align": r.alt(e, t, ["start", l, "end", "left", "right"]) } }, /:/, /\s/), t.region = r.get("region", null), t.vertical = r.get("vertical", ""); var n = r.get("line", "auto"); "auto" === n && -1 === u.line && (n = -1), t.line = n, t.lineAlign = r.get("lineAlign", "start"), t.snapToLines = r.get("snapToLines", !0), t.size = r.get("size", 100), t.align = r.get("align", l); var a = r.get("position", "auto"); "auto" === a && 50 === u.position && (a = "start" === t.align || "left" === t.align ? 0 : "end" === t.align || "right" === t.align ? 100 : 50), t.position = a }(e, t) } function c(e) { return e.replace(//gi, "\n") } var h = function() { function e() { this.state = "INITIAL", this.buffer = "", this.decoder = new n, this.regionList = [], this.cue = null, this.oncue = void 0, this.onparsingerror = void 0, this.onflush = void 0 } var t = e.prototype; return t.parse = function(e) { var t = this; function i() { var e = t.buffer, i = 0; for (e = c(e); i < e.length && "\r" !== e[i] && "\n" !== e[i];) ++i; var r = e.slice(0, i); return "\r" === e[i] && ++i, "\n" === e[i] && ++i, t.buffer = e.slice(i), r } e && (t.buffer += t.decoder.decode(e, { stream: !0 })); try { var n = ""; if ("INITIAL" === t.state) { if (!/\r\n|\n/.test(t.buffer)) return this; var a = (n = i()).match(/^()?WEBVTT([ \t].*)?$/); if (!a || !a[0]) throw new Error("Malformed WebVTT signature."); t.state = "HEADER" } for (var s = !1; t.buffer;) { if (!/\r\n|\n/.test(t.buffer)) return this; switch (s ? s = !1 : n = i(), t.state) { case "HEADER": /:/.test(n) ? o(n, function(e, t) {}, /:/) : n || (t.state = "ID"); continue; case "NOTE": n || (t.state = "ID"); continue; case "ID": if (/^NOTE($|[ \t])/.test(n)) { t.state = "NOTE"; break } if (!n) continue; if (t.cue = new r.default(0, 0, ""), t.state = "CUE", -1 === n.indexOf("--\x3e")) { t.cue.id = n; continue } case "CUE": if (!t.cue) { t.state = "BADCUE"; continue } try { d(n, t.cue, t.regionList) } catch (e) { t.cue = null, t.state = "BADCUE"; continue } t.state = "CUETEXT"; continue; case "CUETEXT": var u = -1 !== n.indexOf("--\x3e"); if (!n || u && (s = !0)) { t.oncue && t.cue && t.oncue(t.cue), t.cue = null, t.state = "ID"; continue } if (null === t.cue) continue; t.cue.text && (t.cue.text += "\n"), t.cue.text += n; continue; case "BADCUE": n || (t.state = "ID") } } } catch (e) { "CUETEXT" === t.state && t.cue && t.oncue && t.oncue(t.cue), t.cue = null, t.state = "INITIAL" === t.state ? "BADWEBVTT" : "BADCUE" } return this }, t.flush = function() { try { if ((this.cue || "HEADER" === this.state) && (this.buffer += "\n\n", this.parse()), "INITIAL" === this.state || "BADWEBVTT" === this.state) throw new Error( "Malformed WebVTT signature.") } catch (e) { this.onparsingerror && this.onparsingerror(e) } return this.onflush && this.onflush(), this }, e }() }, "./src/utils/webvtt-parser.ts": function(e, t, i) { "use strict"; i.r(t), i.d(t, "generateCueId", function() { return h }), i.d(t, "parseWebVTT", function() { return p }); var r = i("./src/polyfills/number.ts"), n = i("./src/utils/vttparser.ts"), a = i("./src/demux/id3.ts"), s = i("./src/utils/timescale-conversion.ts"), o = i("./src/remux/mp4-remuxer.ts"), u = /\r\n|\n\r|\n|\r/g, l = function(e, t, i) { return void 0 === i && (i = 0), e.slice(i, i + t.length) === t }, d = function(e) { var t = parseInt(e.slice(-3)), i = parseInt(e.slice(-6, -4)), n = parseInt(e.slice(-9, -7)), a = e.length > 9 ? parseInt(e.substring(0, e.indexOf(":"))) : 0; if (!(Object(r.isFiniteNumber)(t) && Object(r.isFiniteNumber)(i) && Object(r.isFiniteNumber)(n) && Object(r.isFiniteNumber)(a))) throw Error("Malformed X-TIMESTAMP-MAP: Local:" + e); return t += 1e3 * i, t += 6e4 * n, t += 36e5 * a }, c = function(e) { for (var t = 5381, i = e.length; i;) t = 33 * t ^ e.charCodeAt(--i); return (t >>> 0).toString() }; function h(e, t, i) { return c(e.toString()) + c(t.toString()) + c(i) } var f = function(e, t, i) { var r = e[t], n = e[r.prevCC]; if (!n || !n.new && r.new) return e.ccOffset = e.presentationOffset = r.start, void(r.new = !1); for (; null !== (a = n) && void 0 !== a && a.new;) { var a; e.ccOffset += r.start - n.start, r.new = !1, n = e[(r = n).prevCC] } e.presentationOffset = i }; function p(e, t, i, r, c, p, m, g) { var v, y = new n.VTTParser, _ = Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(u, "\n").split("\n"), b = [], w = Object(s.toMpegTsClockFromTimescale)(t, i), E = "00:00.000", T = 0, S = 0, A = !0; y.oncue = function(e) { var t = r[c], i = r.ccOffset, n = (T - w) / 9e4; null !== t && void 0 !== t && t.new && (void 0 !== S ? i = r.ccOffset = t.start : f(r, c, n)), n && (i = n - r.presentationOffset); var a = e.endTime - e.startTime, s = Object(o.normalizePts)(9e4 * (e.startTime + i - S), 9e4 * p) / 9e4; e.startTime = s, e.endTime = s + a; var u = e.text.trim(); e.text = decodeURIComponent(encodeURIComponent(u)), e.id || (e.id = h(e.startTime, e.endTime, u)), e.endTime > 0 && b.push(e) }, y.onparsingerror = function(e) { v = e }, y.onflush = function() { v ? g(v) : m(b) }, _.forEach(function(e) { if (A) { if (l(e, "X-TIMESTAMP-MAP=")) { A = !1, e.slice(16).split(",").forEach(function(e) { l(e, "LOCAL:") ? E = e.slice(6) : l(e, "MPEGTS:") && (T = parseInt(e.slice(7))) }); try { S = d(E) / 1e3 } catch (e) { v = e } return } "" === e && (A = !1) } y.parse(e + "\n") }), y.flush() } }, "./src/utils/xhr-loader.ts": function(e, t, i) { "use strict"; i.r(t); var r = i("./src/utils/logger.ts"), n = i("./src/loader/load-stats.ts"), a = /^age:\s*[\d.]+\s*$/m, s = function() { function e(e) { this.xhrSetup = void 0, this.requestTimeout = void 0, this.retryTimeout = void 0, this .retryDelay = void 0, this.config = null, this.callbacks = null, this.context = void 0, this .loader = null, this.stats = void 0, this.xhrSetup = e ? e.xhrSetup : null, this.stats = new n .LoadStats, this.retryDelay = 0 } var t = e.prototype; return t.destroy = function() { this.callbacks = null, this.abortInternal(), this.loader = null, this.config = null }, t.abortInternal = function() { var e = this.loader; self.clearTimeout(this.requestTimeout), self.clearTimeout(this.retryTimeout), e && (e .onreadystatechange = null, e.onprogress = null, 4 !== e.readyState && (this.stats .aborted = !0, e.abort())) }, t.abort = function() { var e; this.abortInternal(), null !== (e = this.callbacks) && void 0 !== e && e.onAbort && this .callbacks.onAbort(this.stats, this.context, this.loader) }, t.load = function(e, t, i) { if (this.stats.loading.start) throw new Error("Loader can only be used once."); this.stats.loading.start = self.performance.now(), this.context = e, this.config = t, this .callbacks = i, this.retryDelay = t.retryDelay, this.loadInternal() }, t.loadInternal = function() { var e = this.config, t = this.context; if (e) { var i = this.loader = new self.XMLHttpRequest, r = this.stats; r.loading.first = 0, r.loaded = 0; var n = this.xhrSetup; try { if (n) try { n(i, t.url) } catch (e) { i.open("GET", t.url, !0), n(i, t.url) } i.readyState || i.open("GET", t.url, !0); var a = this.context.headers; if (a) for (var s in a) i.setRequestHeader(s, a[s]) } catch (e) { return void this.callbacks.onError({ code: i.status, text: e.message }, t, i) } t.rangeEnd && i.setRequestHeader("Range", "bytes=" + t.rangeStart + "-" + (t.rangeEnd - 1)), i .onreadystatechange = this.readystatechange.bind(this), i.onprogress = this.loadprogress .bind(this), i.responseType = t.responseType, self.clearTimeout(this.requestTimeout), this .requestTimeout = self.setTimeout(this.loadtimeout.bind(this), e.timeout), i.send() } }, t.readystatechange = function() { var e = this.context, t = this.loader, i = this.stats; if (e && t) { var n = t.readyState, a = this.config; if (!i.aborted && n >= 2) if (self.clearTimeout(this.requestTimeout), 0 === i.loading.first && (i.loading.first = Math .max(self.performance.now(), i.loading.start)), 4 === n) { t.onreadystatechange = null, t.onprogress = null; var s = t.status; if (s >= 200 && s < 300) { var o, u, l; if (i.loading.end = Math.max(self.performance.now(), i.loading.first), "arraybuffer" === e.responseType ? (l = (o = t.response).byteLength, u = o.slice(0)) : (o = t .responseText, u = t.responseText, l = o.length), i.loaded = i.total = l, !this .callbacks) return; var d = this.callbacks.onProgress; if (d && d(i, e, o, t), !this.callbacks) return; var c = { url: t.responseURL, data: u }; this.callbacks.onSuccess(c, i, e, t) } else i.retry >= a.maxRetry || s >= 400 && s < 499 ? (r.logger.error(s + " while loading " + e.url), console.log("this.callbacks", this.callbacks.onError), this.callbacks.onError({ code: s, text: t.statusText }, e, t)) : (r.logger.warn(s + " while loading " + e.url + ", retrying in " + this .retryDelay + "..."), this.abortInternal(), this.loader = null, self.clearTimeout( this.retryTimeout), this.retryTimeout = self.setTimeout(this.loadInternal.bind( this), this.retryDelay), this.retryDelay = Math.min(2 * this.retryDelay, a .maxRetryDelay), i.retry++) } else self.clearTimeout(this.requestTimeout), this.requestTimeout = self.setTimeout(this .loadtimeout.bind(this), a.timeout) } }, t.loadtimeout = function() { r.logger.warn("timeout while loading " + this.context.url); var e = this.callbacks; e && (this.abortInternal(), e.onTimeout(this.stats, this.context, this.loader)) }, t.loadprogress = function(e) { var t = this.stats; t.loaded = e.loaded, e.lengthComputable && (t.total = e.total) }, t.getCacheAge = function() { var e = null; if (this.loader && a.test(this.loader.getAllResponseHeaders())) { var t = this.loader.getResponseHeader("age"); e = t ? parseFloat(t) : null } return e }, t.deepClone = function(e) { var t = Object.prototype.toString; if (!e || "object" != typeof e) return e; if (e.nodeType && "cloneNode" in e) return e.cloneNode(!0); if ("[object Date]" === t.call(e)) return new Date(e.getTime()); if ("[object RegExp]" === t.call(e)) { var i = []; return e.global && i.push("g"), e.multiline && i.push("m"), e.ignoreCase && i.push("i"), new RegExp(e.source, i.join("")) } var r = Array.isArray(e) ? [] : e.constructor ? new e.constructor : {}; for (var n in e) r[n] = this.deepClone(e[n]); return r }, e }(); t.default = s } }).default }), function(e, t, i) { if (t && i && i.isSupported()) { var r = function(e, r) { var n, a, s, o = this, u = {}, l = !1, d = !1, c = !1, h = r.el(), f = r.hls = new i(r.options_.hlsJs || {}), p = 0, m = function() { d && (!c || c && 0 === o.duration() && !1 === f.config.autoStartLoad) && f.startLoad(), c = !0 }; return f.isHlsJs = !0, !1 === f.config.autoStartLoad && h.addEventListener("play", m), f.on(i.Events .MANIFEST_LOADED, function() { d = !0, c && !1 === f.config.autoStartLoad && m() }), f.on(i.Events.LEVEL_LOADED, function(e, t) { n = t.details.live ? 1 / 0 : t.details.totalduration, p = t.details.fragments && t.details.fragments[ 0] && t.details.fragments[0].start || p }), f.on(i.Events.ERROR, function(t, n) { var o = function() { l = !0, r.error = function() { return n }, r.trigger("error") }; if (!l && n.fatal) switch (u[n.type] = u[n.type] || 0, ++u[n.type], n.type) { case i.ErrorTypes.NETWORK_ERROR: if (2 < u[n.type]) return void o(); if ([i.ErrorDetails.MANIFEST_LOAD_ERROR, i.ErrorDetails.MANIFEST_LOAD_TIMEOUT, i.ErrorDetails .MANIFEST_PARSING_ERROR ].some(function(e) { return e === n.details })) return void f.loadSource(e.src); f.startLoad(); break; case i.ErrorTypes.MEDIA_ERROR: ! function(e) { var t = Date.now(); if (!a || 3e3 < t - a) a = t, f.recoverMediaError(); else if (!s || 3e3 < t - s) s = t, f.swapAudioCodec(), f.recoverMediaError(); else { if (l) return; l = !0, r.error = function() { return e }, r.trigger("error") } }(); break; default: o() } }), f.attachMedia(h), f.loadSource(e.src), o.dispose = function() { h.removeEventListener("play", m), f.destroy() }, o.duration = function() { return n || h.duration || 0 }, o.seekable = function() { return t.createTimeRange(p, h.seekable.length && h.seekable.end(0) || h.duration) }, o }; (t.getTech && t.getTech("Html5") || t.getComponent && t.getComponent("Html5")).registerSourceHandler({ canHandleSource: function(e, t) { return /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e.type) && !1 !== (t.hlsJs || {}) .shouldHandle ? "probably" : "" }, handleSource: function(e, t) { return new r(e, t) } }, 0) } }(window, window.videojs, window.Hls);