/** * libjass * * https://github.com/Arnavion/libjass * * Copyright 2013 Arnav Singh * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ! function(e, t) { var r = this; "function" == typeof define && define.amd ? define([], function() { return t(r) }) : "object" == typeof exports && "object" == typeof module ? module.exports = t(r) : "object" == typeof exports ? exports.libjass = t(r) : e.libjass = t(r) }(this, function(e) { "use strict"; return function(e) { function t(n) { if (r[n]) return r[n]; var i = r[n] = Object.create(null); return e[n](i, t), i } var r = Object.create(null); return t(0) }([function(e, t) { var r = t(23), n = t(23); e.debugMode = n.debugMode, e.verboseMode = n.verboseMode; var i = t(33), o = t(33); e.Set = o.Set; var a = t(30), l = t(30); e.Map = l.Map; var s = t(32), u = t(32); e.Promise = u.Promise, e.DeferredPromise = u.DeferredPromise; var p = t(37); e.webworker = p; var c = t(8); e.parts = c; var h = t(1); e.parser = h; var f = t(14); e.renderers = f; var d = t(24); e.ASS = d.ASS; var _ = t(25); e.Attachment = _.Attachment, e.AttachmentType = _.AttachmentType; var g = t(26); e.Dialogue = g.Dialogue; var v = t(28); e.ScriptProperties = v.ScriptProperties; var y = t(29); e.Style = y.Style; var m = t(27); e.BorderStyle = m.BorderStyle, e.Format = m.Format, e.WrappingStyle = m.WrappingStyle, Object.defineProperties(e, { debugMode: { get: function() { return r.debugMode }, set: r.setDebugMode }, verboseMode: { get: function() { return r.verboseMode }, set: r.setVerboseMode }, Set: { get: function() { return i.Set }, set: i.setImplementation }, Map: { get: function() { return a.Map }, set: a.setImplementation }, Promise: { get: function() { return s.Promise }, set: s.setImplementation } }) }, function(e, t) { var r = t(3); e.parse = r.parse; var n = t(5); e.BrowserReadableStream = n.BrowserReadableStream, e.StringStream = n.StringStream, e.XhrStream = n.XhrStream; var i = t(4); e.StreamParser = i.StreamParser, e.SrtStreamParser = i.SrtStreamParser }, function(e, t) { function r(e) { var t = e.indexOf(":"); if (-1 === t) return null; var r = e.substr(0, t), n = e.substr(t + 1).replace(/^\s+/, ""); return { name: r, value: n } } function n(e, t) { var n = r(e); if (null === n) return null; var o = n.value.split(","); o.length > t.length && (o[t.length - 1] = o.slice(t.length - 1).join(",")); var a = new i.Map; return t.forEach(function(e, t) { a.set(e, o[t]) }), { type: n.name, template: a } } var i = t(30); e.parseLineIntoProperty = r, e.parseLineIntoTypedTemplate = n }, function(e, t) { function r(e, t) { var r = new s(e, t); if (null === r.result || r.result.end !== e.length) throw o.debugMode && console.error("Parse failed. %s %s %o", t, e, r.result), new Error("Parse failed."); return r.result.value } function n(e, t, r, n) { s.prototype["parse_tag_" + e] = function(i) { var o = this, a = new h(i); if (null === o.read(a, e)) return i.pop(), null; var l = r.call(o, a); if (null !== l) a.value = new t(l.value); else { if (n) return i.pop(), null; a.value = new t(null) } return a } } var i = t(8), o = t(23), a = t(30), l = new a.Map; e.parse = r; var s = function() { function e(e, t) { this.e = e, this.t = new h(null), this.r = l.get(t).call(this, this.t) } return Object.defineProperty(e.prototype, "result", { get: function() { return this.r }, enumerable: !0, configurable: !0 }), e.prototype.parse_dialogueParts = function(e) { var t, n = new h(e); for (n.value = []; this.n();) { var o = this.parse_enclosedTags(n); if (null !== o)(t = n.value).push.apply(t, o.value); else { var a = this.parse_newline(n) || this.parse_hardspace(n) || this.parse_text(n); if (null === a) return e.pop(), null; if (a.value instanceof i.Text && n.value[n.value.length - 1] instanceof i.Text) { var l = n.value[n.value.length - 1]; n.value[n.value.length - 1] = new i.Text(l.value + a.value.value) } else n.value.push(a.value) } } var s = !1; return n.value.forEach(function(e, t) { e instanceof i.DrawingMode ? s = 0 !== e.scale : e instanceof i.Text && s && (n.value[t] = new i.DrawingInstructions(r(e.value, "drawingInstructions"))) }), n }, e.prototype.parse_enclosedTags = function(e) { var t = new h(e); if (t.value = [], null === this.read(t, "{")) return e.pop(), null; for (var r = this.i(); this.n() && "}" !== r; r = this.i()) { var n = null; if (null !== this.read(t, "\\") && (n = this.parse_tag_alpha(t) || this.parse_tag_iclip(t) || this.parse_tag_xbord(t) || this.parse_tag_ybord(t) || this.parse_tag_xshad(t) || this.parse_tag_yshad(t) || this.parse_tag_blur(t) || this.parse_tag_bord(t) || this.parse_tag_clip(t) || this.parse_tag_fade(t) || this.parse_tag_fscx(t) || this.parse_tag_fscy(t) || this.parse_tag_move(t) || this.parse_tag_shad(t) || this.parse_tag_fad(t) || this.parse_tag_fax(t) || this.parse_tag_fay(t) || this.parse_tag_frx(t) || this.parse_tag_fry(t) || this.parse_tag_frz(t) || this.parse_tag_fsp(t) || this.parse_tag_fsplus(t) || this.parse_tag_fsminus(t) || this.parse_tag_org(t) || this.parse_tag_pbo(t) || this.parse_tag_pos(t) || this.parse_tag_an(t) || this.parse_tag_be(t) || this.parse_tag_fn(t) || this.parse_tag_fr(t) || this.parse_tag_fs(t) || this.parse_tag_kf(t) || this.parse_tag_ko(t) || this.parse_tag_1a(t) || this.parse_tag_1c(t) || this.parse_tag_2a(t) || this.parse_tag_2c(t) || this.parse_tag_3a(t) || this.parse_tag_3c(t) || this.parse_tag_4a(t) || this.parse_tag_4c(t) || this.parse_tag_a(t) || this.parse_tag_b(t) || this.parse_tag_c(t) || this.parse_tag_i(t) || this.parse_tag_k(t) || this.parse_tag_K(t) || this.parse_tag_p(t) || this.parse_tag_q(t) || this.parse_tag_r(t) || this.parse_tag_s(t) || this.parse_tag_t(t) || this.parse_tag_u(t), null === n && t.pop()), null === n && (n = this.parse_comment(t)), null === n) return e.pop(), null; n.value instanceof i.Comment && t.value[t.value.length - 1] instanceof i.Comment ? t.value[t.value.length - 1] = new i.Comment(t.value[t.value.length - 1].value + n.value.value) : t.value.push(n.value) } return null === this.read(t, "}") ? (e.pop(), null) : t }, e.prototype.parse_newline = function(e) { var t = new h(e); return null === this.read(t, "\\N") ? (e.pop(), null) : (t.value = new i.NewLine, t) }, e.prototype.parse_hardspace = function(e) { var t = new h(e); return null === this.read(t, "\\h") ? (e.pop(), null) : (t.value = new i.Text(" "), t) }, e.prototype.parse_text = function(e) { var t = this.i(), r = new h(e), n = new h(r, t); return r.value = new i.Text(n.value), r }, e.prototype.parse_comment = function(e) { var t = this.i(), r = new h(e), n = new h(r, t); return r.value = new i.Comment(n.value), r }, e.prototype.parse_tag_a = function(e) { var t = new h(e); if (null === this.read(t, "a")) return e.pop(), null; var r = this.i(); switch (r) { case "1": var n = this.i(2); switch (n) { case "10": case "11": r = n } break; case "2": case "3": case "5": case "6": case "7": case "9": break; default: return e.pop(), null } var o = new h(t, r), a = null; switch (o.value) { case "1": a = 1; break; case "2": a = 2; break; case "3": a = 3; break; case "5": a = 7; break; case "6": a = 8; break; case "7": a = 9; break; case "9": a = 4; break; case "10": a = 5; break; case "11": a = 6 } return t.value = new i.Alignment(a), t }, e.prototype.parse_tag_alpha = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_an = function(e) { var t = new h(e); if (null === this.read(t, "an")) return e.pop(), null; var r = this.i(); if ("1" > r || r > "9") return e.pop(), null; var n = new h(t, r); return t.value = new i.Alignment(parseInt(n.value)), t }, e.prototype.parse_tag_b = function(e) { var t = new h(e); if (null === this.read(t, "b")) return e.pop(), null; var r = null, n = this.i(); return n >= "1" && "9" >= n && (n = this.i(3), "00" === n.substr(1) && (r = new h(t, n), r.value = parseInt(r.value))), null === r && (r = this.parse_enableDisable(t)), null !== r ? t.value = new i.Bold(r.value) : t.value = new i.Bold(null), t }, e.prototype.parse_tag_be = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_blur = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_bord = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_c = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_clip = function(e) { return this.o("clip", e) }, e.prototype.parse_tag_fad = function(e) { var t = new h(e); if (null === this.read(t, "fad")) return e.pop(), null; if (null === this.read(t, "(")) return e.pop(), null; var r = this.parse_decimal(t); if (null === r) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var n = this.parse_decimal(t); return null === n ? (e.pop(), null) : null === this.read(t, ")") ? (e.pop(), null) : (t.value = new i.Fade(r.value / 1e3, n.value / 1e3), t) }, e.prototype.parse_tag_fade = function(e) { var t = new h(e); if (null === this.read(t, "fade")) return e.pop(), null; if (null === this.read(t, "(")) return e.pop(), null; var r = this.parse_decimal(t); if (null === r) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var n = this.parse_decimal(t); if (null === n) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var o = this.parse_decimal(t); if (null === o) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var a = this.parse_decimal(t); if (null === a) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var l = this.parse_decimal(t); if (null === l) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var s = this.parse_decimal(t); if (null === s) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var u = this.parse_decimal(t); return null === u ? (e.pop(), null) : null === this.read(t, ")") ? (e.pop(), null) : (t.value = new i.ComplexFade(1 - r.value / 255, 1 - n.value / 255, 1 - o.value / 255, a.value / 1e3, l.value / 1e3, s.value / 1e3, u.value / 1e3), t) }, e.prototype.parse_tag_fax = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_fay = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_fn = function(e) { var t = new h(e); if (null === this.read(t, "fn")) return e.pop(), null; for (var r = new h(t, ""), n = this.i(); this.n() && "\\" !== n && "}" !== n; n = this.i()) r.value += n; return r.value.length > 0 ? t.value = new i.FontName(r.value) : t.value = new i.FontName(null), t }, e.prototype.parse_tag_fr = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_frx = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_fry = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_frz = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_fs = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_fsplus = function(e) { var t = new h(e); if (null === this.read(t, "fs+")) return e.pop(), null; var r = this.parse_decimal(t); return null === r ? (e.pop(), null) : (t.value = new i.FontSizePlus(r.value), t) }, e.prototype.parse_tag_fsminus = function(e) { var t = new h(e); if (null === this.read(t, "fs-")) return e.pop(), null; var r = this.parse_decimal(t); return null === r ? (e.pop(), null) : (t.value = new i.FontSizeMinus(r.value), t) }, e.prototype.parse_tag_fscx = function(e) { var t = new h(e); if (null === this.read(t, "fscx")) return e.pop(), null; var r = this.parse_decimal(t); return null !== r ? t.value = new i.FontScaleX(r.value / 100) : t.value = new i.FontScaleX(null), t }, e.prototype.parse_tag_fscy = function(e) { var t = new h(e); if (null === this.read(t, "fscy")) return e.pop(), null; var r = this.parse_decimal(t); return null !== r ? t.value = new i.FontScaleY(r.value / 100) : t.value = new i.FontScaleY(null), t }, e.prototype.parse_tag_fsp = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_i = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_iclip = function(e) { return this.o("iclip", e) }, e.prototype.parse_tag_k = function(e) { var t = new h(e); if (null === this.read(t, "k")) return e.pop(), null; var r = this.parse_decimal(t); return null === r ? (e.pop(), null) : (t.value = new i.ColorKaraoke(r.value / 100), t) }, e.prototype.parse_tag_K = function(e) { var t = new h(e); if (null === this.read(t, "K")) return e.pop(), null; var r = this.parse_decimal(t); return null === r ? (e.pop(), null) : (t.value = new i.SweepingColorKaraoke(r.value / 100), t) }, e.prototype.parse_tag_kf = function(e) { var t = new h(e); if (null === this.read(t, "kf")) return e.pop(), null; var r = this.parse_decimal(t); return null === r ? (e.pop(), null) : (t.value = new i.SweepingColorKaraoke(r.value / 100), t) }, e.prototype.parse_tag_ko = function(e) { var t = new h(e); if (null === this.read(t, "ko")) return e.pop(), null; var r = this.parse_decimal(t); return null === r ? (e.pop(), null) : (t.value = new i.OutlineKaraoke(r.value / 100), t) }, e.prototype.parse_tag_move = function(e) { var t = new h(e); if (null === this.read(t, "move")) return e.pop(), null; if (null === this.read(t, "(")) return e.pop(), null; var r = this.parse_decimal(t); if (null === r) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var n = this.parse_decimal(t); if (null === n) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var o = this.parse_decimal(t); if (null === o) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var a = this.parse_decimal(t); if (null === a) return e.pop(), null; var l = null, s = null; if (null !== this.read(t, ",")) { if (l = this.parse_decimal(t), null === l) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; if (s = this.parse_decimal(t), null === s) return e.pop(), null } return null === this.read(t, ")") ? (e.pop(), null) : (t.value = new i.Move(r.value, n.value, o.value, a.value, null !== l ? l.value / 1e3 : null, null !== s ? s.value / 1e3 : null), t) }, e.prototype.parse_tag_org = function(e) { var t = new h(e); if (null === this.read(t, "org")) return e.pop(), null; if (null === this.read(t, "(")) return e.pop(), null; var r = this.parse_decimal(t); if (null === r) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var n = this.parse_decimal(t); return null === n ? (e.pop(), null) : null === this.read(t, ")") ? (e.pop(), null) : (t.value = new i.RotationOrigin(r.value, n.value), t) }, e.prototype.parse_tag_p = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_pbo = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_pos = function(e) { var t = new h(e); if (null === this.read(t, "pos")) return e.pop(), null; if (null === this.read(t, "(")) return e.pop(), null; var r = this.parse_decimal(t); if (null === r) return e.pop(), null; if (null === this.read(t, ",")) return e.pop(), null; var n = this.parse_decimal(t); return null === n ? (e.pop(), null) : null === this.read(t, ")") ? (e.pop(), null) : (t.value = new i.Position(r.value, n.value), t) }, e.prototype.parse_tag_q = function(e) { var t = new h(e); if (null === this.read(t, "q")) return e.pop(), null; var r = this.i(); if ("0" > r || r > "3") return e.pop(), null; var n = new h(t, r); return t.value = new i.WrappingStyle(parseInt(n.value)), t }, e.prototype.parse_tag_r = function(e) { var t = new h(e); if (null === this.read(t, "r")) return e.pop(), null; for (var r = new h(t, ""), n = this.i(); this.n() && "\\" !== n && "}" !== n; n = this.i()) r.value += n; return r.value.length > 0 ? t.value = new i.Reset(r.value) : t.value = new i.Reset(null), t }, e.prototype.parse_tag_s = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_shad = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_t = function(e) { var t = new h(e); if (null === this.read(t, "t")) return e.pop(), null; if (null === this.read(t, "(")) return e.pop(), null; var r = null, n = null, o = null, a = this.parse_decimal(t); if (null !== a) { if (null === this.read(t, ",")) return e.pop(), null; var l = this.parse_decimal(t); if (null !== l) { if (r = a, n = l, null === this.read(t, ",")) return e.pop(), null; var s = this.parse_decimal(t); if (null !== s && (o = s, null === this.read(t, ","))) return e.pop(), null } else if (o = a, null === this.read(t, ",")) return e.pop(), null } for (var u = [], p = this.i(); this.n() && ")" !== p && "}" !== p; p = this.i()) { var c = null; if (null !== this.read(t, "\\") && (c = this.parse_tag_alpha(t) || this.parse_tag_iclip(t) || this.parse_tag_xbord(t) || this.parse_tag_ybord(t) || this.parse_tag_xshad(t) || this.parse_tag_yshad(t) || this.parse_tag_blur(t) || this.parse_tag_bord(t) || this.parse_tag_clip(t) || this.parse_tag_fscx(t) || this.parse_tag_fscy(t) || this.parse_tag_shad(t) || this.parse_tag_fax(t) || this.parse_tag_fay(t) || this.parse_tag_frx(t) || this.parse_tag_fry(t) || this.parse_tag_frz(t) || this.parse_tag_fsp(t) || this.parse_tag_fsplus(t) || this.parse_tag_fsminus(t) || this.parse_tag_be(t) || this.parse_tag_fr(t) || this.parse_tag_fs(t) || this.parse_tag_1a(t) || this.parse_tag_1c(t) || this.parse_tag_2a(t) || this.parse_tag_2c(t) || this.parse_tag_3a(t) || this.parse_tag_3c(t) || this.parse_tag_4a(t) || this.parse_tag_4c(t) || this.parse_tag_c(t), null === c && t.pop()), null === c && (c = this.parse_comment(t)), null === c) return e.pop(), null; c.value instanceof i.Comment && u[u.length - 1] instanceof i.Comment ? u[u.length - 1] = new i.Comment(u[u.length - 1].value + c.value.value) : u.push(c.value) } return this.read(t, ")"), t.value = new i.Transform(null !== r ? r.value / 1e3 : null, null !== n ? n.value / 1e3 : null, null !== o ? o.value / 1e3 : null, u), t }, e.prototype.parse_tag_u = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_xbord = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_xshad = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_ybord = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_yshad = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_1a = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_1c = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_2a = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_2c = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_3a = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_3c = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_4a = function() { throw new Error("Method not implemented.") }, e.prototype.parse_tag_4c = function() { throw new Error("Method not implemented.") }, e.prototype.parse_drawingInstructions = function(e) { var t = new h(e), r = null, n = []; for (t.value = []; this.n();) { for (; null !== this.read(t, " ");); if (!this.n()) break; if (null !== r) { var o = this.parse_decimal(t); if (null !== o) { n.push(o), "m" === r && 2 === n.length ? (t.value.push(new i.drawing.MoveInstruction(n[0].value, n[1].value)), n.splice(0, n.length)) : "l" === r && 2 === n.length ? (t.value.push(new i.drawing.LineInstruction(n[0].value, n[1].value)), n.splice(0, n.length)) : "b" === r && 6 === n.length && (t.value.push(new i.drawing.CubicBezierCurveInstruction(n[0].value, n[1].value, n[2].value, n[3].value, n[4].value, n[5].value)), n.splice(0, n.length)); continue } } var a = this.parse_text(t); if (null === a) break; var l = a.value.value; switch (l) { case "m": case "l": case "b": r = l, n.splice(0, n.length) } } for (; null !== this.read(t, " ");); return t }, e.prototype.parse_decimalInt32 = function(e) { for (var t = new h(e), r = null !== this.read(t, "-"), n = new h(t, ""), i = this.i(); this.n() && i >= "0" && "9" >= i; i = this.i()) n.value += i; if (0 === n.value.length) return e.pop(), null; var o = parseInt(n.value); return o >= 4294967295 ? o = 4294967295 : r && (o = -o), t.value = o, t }, e.prototype.parse_hexInt32 = function(e) { for (var t = new h(e), r = null !== this.read(t, "-"), n = new h(t, ""), i = this.i(); this.n() && (i >= "0" && "9" >= i || i >= "a" && "f" >= i || i >= "A" && "F" >= i); i = this.i()) n.value += i; if (0 === n.value.length) return e.pop(), null; var o = parseInt(n.value, 16); return o >= 4294967295 ? o = 4294967295 : r && (o = -o), t.value = o, t }, e.prototype.parse_decimalOrHexInt32 = function(e) { var t = new h(e), r = null !== this.read(t, "&H") || null !== this.read(t, "&h") ? this.parse_hexInt32(t) : this.parse_decimalInt32(t); return null === r ? (e.pop(), null) : (t.value = r.value, t) }, e.prototype.parse_decimal = function(e) { var t = new h(e), r = null !== this.read(t, "-"), n = this.parse_unsignedDecimal(t); return null === n ? (e.pop(), null) : (t.value = n.value, r && (t.value = -t.value), t) }, e.prototype.parse_unsignedDecimal = function(e) { for (var t = new h(e), r = new h(t, ""), n = null, i = this.i(); this.n() && i >= "0" && "9" >= i; i = this.i()) r.value += i; if (0 === r.value.length) return e.pop(), null; if (null !== this.read(t, ".")) { n = new h(t, ""); for (var i = this.i(); this.n() && i >= "0" && "9" >= i; i = this.i()) n.value += i; if (0 === n.value.length) return e.pop(), null } return t.value = parseFloat(r.value + (null !== n ? "." + n.value : "")), t }, e.prototype.parse_enableDisable = function(e) { var t = this.i(); if ("0" === t || "1" === t) { var r = new h(e, t); return r.value = "1" === r.value, r } return null }, e.prototype.parse_color = function(e) { for (var t = new h(e); null !== this.read(t, "&") || null !== this.read(t, "H");); var r = this.parse_hexInt32(t); if (null === r) return e.pop(), null; var n = r.value; for (t.value = new i.Color(255 & n, n >> 8 & 255, n >> 16 & 255); null !== this.read(t, "&") || null !== this.read(t, "H");); return t }, e.prototype.parse_alpha = function(e) { for (var t = new h(e); null !== this.read(t, "&") || null !== this.read(t, "H");); var r = this.parse_hexInt32(t); if (null === r) return e.pop(), null; var n = r.value; for (t.value = 1 - (255 & n) / 255; null !== this.read(t, "&") || null !== this.read(t, "H");); return t }, e.prototype.parse_colorWithAlpha = function(e) { var t = new h(e), r = this.parse_decimalOrHexInt32(t); if (null === r) return e.pop(), null; var n = r.value; return t.value = new i.Color(255 & n, n >> 8 & 255, n >> 16 & 255, 1 - (n >> 24 & 255) / 255), t }, e.prototype.read = function(e, t) { return this.i(t.length) !== t ? null : new h(e, t) }, e.prototype.i = function(e) { return void 0 === e && (e = 1), 1 === e ? this.e[this.t.end] : this.e.substr(this.t.end, e) }, e.prototype.n = function() { return this.t.end < this.e.length }, e.prototype.o = function(e, t) { var n = new h(t); if (null === this.read(n, e)) return t.pop(), null; if (null === this.read(n, "(")) return t.pop(), null; var o = null, a = null, l = null, s = null, u = null, p = null, c = this.parse_decimal(n); if (null !== c) { if (null === this.read(n, ",")) return t.pop(), null; var f = this.parse_decimal(n); null !== f ? (o = c, l = f) : u = c } if (null !== o && null !== l) { if (null === this.read(n, ",")) return t.pop(), null; if (a = this.parse_decimal(n), null === this.read(n, ",")) return t.pop(), null; s = this.parse_decimal(n), n.value = new i.RectangularClip(o.value, l.value, a.value, s.value, "clip" === e) } else { p = new h(n, ""); for (var d = this.i(); this.n() && ")" !== d && "}" !== d; d = this.i()) p.value += d; n.value = new i.VectorClip(null !== u ? u.value : 1, r(p.value, "drawingInstructions"), "clip" === e) } return null === this.read(n, ")") ? (t.pop(), null) : n }, e }(); n("alpha", i.Alpha, s.prototype.parse_alpha, !1), n("be", i.Blur, s.prototype.parse_decimal, !1), n("blur", i.GaussianBlur, s.prototype.parse_decimal, !1), n("bord", i.Border, s.prototype.parse_decimal, !1), n("c", i.PrimaryColor, s.prototype.parse_color, !1), n("fax", i.SkewX, s.prototype.parse_decimal, !1), n("fay", i.SkewY, s.prototype.parse_decimal, !1), n("fr", i.RotateZ, s.prototype.parse_decimal, !1), n("frx", i.RotateX, s.prototype.parse_decimal, !1), n("fry", i.RotateY, s.prototype.parse_decimal, !1), n("frz", i.RotateZ, s.prototype.parse_decimal, !1), n("fs", i.FontSize, s.prototype.parse_decimal, !1), n("fsp", i.LetterSpacing, s.prototype.parse_decimal, !1), n("i", i.Italic, s.prototype.parse_enableDisable, !1), n("p", i.DrawingMode, s.prototype.parse_decimal, !0), n("pbo", i.DrawingBaselineOffset, s.prototype.parse_decimal, !0), n("s", i.StrikeThrough, s.prototype.parse_enableDisable, !1), n("shad", i.Shadow, s.prototype.parse_decimal, !1), n("u", i.Underline, s.prototype.parse_enableDisable, !1), n("xbord", i.BorderX, s.prototype.parse_decimal, !1), n("xshad", i.ShadowX, s.prototype.parse_decimal, !1), n("ybord", i.BorderY, s.prototype.parse_decimal, !1), n("yshad", i.ShadowY, s.prototype.parse_decimal, !1), n("1a", i.PrimaryAlpha, s.prototype.parse_alpha, !1), n("1c", i.PrimaryColor, s.prototype.parse_color, !1), n("2a", i.SecondaryAlpha, s.prototype.parse_alpha, !1), n("2c", i.SecondaryColor, s.prototype.parse_color, !1), n("3a", i.OutlineAlpha, s.prototype.parse_alpha, !1), n("3c", i.OutlineColor, s.prototype.parse_color, !1), n("4a", i.ShadowAlpha, s.prototype.parse_alpha, !1), n("4c", i.ShadowColor, s.prototype.parse_color, !1); for (var u = 0, p = Object.keys(s.prototype); u < p.length; u++) { var c = p[u]; 0 === c.indexOf("parse_") && "function" == typeof s.prototype[c] && l.set(c.substr("parse_".length), s.prototype[c]) } var h = function() { function e(e, t) { void 0 === t && (t = null), this.a = e, this.l = [], null !== e && e.children.push(this), this.s = null !== e ? e.end : 0, this.u = this.s, this.value = t } return Object.defineProperty(e.prototype, "start", { get: function() { return this.s }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "end", { get: function() { return this.u }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "parent", { get: function() { return this.a }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "children", { get: function() { return this.l }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, set: function(e) { this.p = e, null !== this.p && this.p.constructor === String && 0 === this.l.length && this.c(this.s + this.p.length) }, enumerable: !0, configurable: !0 }), e.prototype.pop = function() { this.l.splice(this.l.length - 1, 1), this.l.length > 0 ? this.c(this.l[this.l.length - 1].end) : this.c(this.start) }, e.prototype.c = function(e) { this.u = e, null !== this.a && this.a.end !== this.u && this.a.c(this.u) }, e }(), f = t(32), d = t(36), _ = t(38); _.registerWorkerCommand(d.WorkerCommands.Parse, function(e) { return new f.Promise(function(t) { t(r(e.input, e.rule)) }) }) }, function(e, t) { function r(e) { for (var t = "", r = 0; r < e.length; r++) { var n = e.charCodeAt(r) - 33; if (0 > n || n > 63) throw new Error("Out-of-range character code " + n + " at index " + r + " in string " + e); t += 26 > n ? String.fromCharCode("A".charCodeAt(0) + n) : 52 > n ? String.fromCharCode("a".charCodeAt(0) + n - 26) : 62 > n ? String.fromCharCode("0".charCodeAt(0) + n - 52) : 62 === n ? "+" : "/" } return t } var n, i = t(23), o = t(24), a = t(29), l = t(26), s = t(25), u = t(30), p = t(32), c = t(2); ! function(e) { e[e.ScriptInfo = 0] = "ScriptInfo", e[e.Styles = 1] = "Styles", e[e.Events = 2] = "Events", e[e.Fonts = 3] = "Fonts", e[e.Graphics = 4] = "Graphics", e[e.Other = 5] = "Other", e[e.EOF = 6] = "EOF" }(n || (n = {})); var h = function() { function e(e) { var t = this; this.h = e, this.f = new o.ASS, this.d = new p.DeferredPromise, this._ = new p.DeferredPromise, this.g = !0, this.v = n.ScriptInfo, this.y = null, this.h.nextLine().then(function(e) { return t.m(e) }, function(e) { t.d.reject(e), t._.reject(e) }) } return Object.defineProperty(e.prototype, "minimalASS", { get: function() { return this.d.promise }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "ass", { get: function() { return this._.promise }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "currentSection", { get: function() { return this.v }, set: function(e) { if (null !== this.y && (this.f.addAttachment(this.y), this.y = null), this.v === n.ScriptInfo && e !== n.ScriptInfo && this.d.resolve(this.f), e === n.EOF) { var t = this.f.properties; void 0 === t.resolutionX || void 0 === t.resolutionY ? (this.d.reject("Malformed ASS script."), this._.reject("Malformed ASS script.")) : (this.d.resolve(this.f), this._.resolve(this.f)) } this.v = e }, enumerable: !0, configurable: !0 }), e.prototype.m = function(e) { var t = this; if (null === e) return void(this.currentSection = n.EOF); if ("\r" === e[e.length - 1] && (e = e.substr(0, e.length - 1)), 65279 === e.charCodeAt(0) && this.g && (e = e.substr(1)), this.g = !1, "" === e); else if (";" === e[0] && null === this.y); else if ("[Script Info]" === e) this.currentSection = n.ScriptInfo; else if ("[V4+ Styles]" === e || "[V4 Styles]" === e) this.currentSection = n.Styles; else if ("[Events]" === e) this.currentSection = n.Events; else if ("[Fonts]" === e) this.currentSection = n.Fonts; else if ("[Graphics]" === e) this.currentSection = n.Graphics; else switch (null === this.y && "[" === e[0] && "]" === e[e.length - 1] && (this.currentSection = n.Other), this.currentSection) { case n.ScriptInfo: var o = c.parseLineIntoProperty(e); if (null !== o) switch (o.name) { case "PlayResX": this.f.properties.resolutionX = parseInt(o.value); break; case "PlayResY": this.f.properties.resolutionY = parseInt(o.value); break; case "WrapStyle": this.f.properties.wrappingStyle = parseInt(o.value); break; case "ScaledBorderAndShadow": this.f.properties.scaleBorderAndShadow = "yes" === o.value } break; case n.Styles: if (null === this.f.stylesFormatSpecifier) { var a = c.parseLineIntoProperty(e); null !== a && "Format" === a.name && (this.f.stylesFormatSpecifier = a.value.split(",").map(function(e) { return e.trim() })) } else try { this.f.addStyle(e) } catch (t) { i.debugMode && console.error("Could not parse style from line " + e + " - " + (t.stack || t)) } break; case n.Events: if (null === this.f.dialoguesFormatSpecifier) { var l = c.parseLineIntoProperty(e); null !== l && "Format" === l.name && (this.f.dialoguesFormatSpecifier = l.value.split(",").map(function(e) { return e.trim() })) } else try { this.f.addEvent(e) } catch (t) { i.debugMode && console.error("Could not parse event from line " + e + " - " + (t.stack || t)) } break; case n.Fonts: case n.Graphics: var u = this.currentSection === n.Fonts ? /^fontname:(.+)/ : /^filename:(.+)/, p = u.exec(e); if (null !== p) null !== this.y && (this.f.addAttachment(this.y), this.y = null), this.y = new s.Attachment(p[1].trim(), this.currentSection === n.Fonts ? s.AttachmentType.Font : s.AttachmentType.Graphic); else if (null !== this.y) try { this.y.contents += r(e) } catch (e) { i.debugMode && console.error("Encountered error while reading font " + this.y.filename + ": %o", e), this.y = null } break; case n.Other: break; default: throw new Error("Unhandled state " + this.currentSection) } this.h.nextLine().then(function(e) { return t.m(e) }, function(e) { t.d.reject(e), t._.reject(e) }) }, e }(); e.StreamParser = h; var f = function() { function e(e) { var t = this; this.h = e, this.f = new o.ASS, this._ = new p.DeferredPromise, this.g = !0, this.b = null, this.w = null, this.S = null, this.O = null, this.h.nextLine().then(function(e) { return t.m(e) }, function(e) { t._.reject(e) }), this.f.properties.resolutionX = 1280, this.f.properties.resolutionY = 720, this.f.properties.wrappingStyle = 1, this.f.properties.scaleBorderAndShadow = !0; var r = new a.Style(new u.Map([ ["Name", "Default"], ["FontSize", "36"] ])); this.f.styles.set(r.name, r) } return Object.defineProperty(e.prototype, "ass", { get: function() { return this._.promise }, enumerable: !0, configurable: !0 }), e.prototype.m = function(e) { var t = this; if (null === e) return null !== this.b && null !== this.w && null !== this.S && null !== this.O && this.f.dialogues.push(new l.Dialogue(new u.Map([ ["Style", "Default"], ["Start", this.w], ["End", this.S], ["Text", this.O] ]), this.f)), void this._.resolve(this.f); if ("\r" === e[e.length - 1] && (e = e.substr(0, e.length - 1)), 65279 === e.charCodeAt(0) && this.g && (e = e.substr(1)), this.g = !1, "" === e) null !== this.b && null !== this.w && null !== this.S && null !== this.O && this.f.dialogues.push(new l.Dialogue(new u.Map([ ["Style", "Default"], ["Start", this.w], ["End", this.S], ["Text", this.O] ]), this.f)), this.b = this.w = this.S = this.O = null; else if (null === this.b) /^\d+$/.test(e) && (this.b = e); else if (null === this.w && null === this.S) { var r = /^(\d\d:\d\d:\d\d,\d\d\d) --> (\d\d:\d\d:\d\d,\d\d\d)/.exec(e); null !== r && (this.w = r[1].replace(",", "."), this.S = r[2].replace(",", ".")) } else e = e.replace(//g, "{\\b1}").replace(/\{b\}/g, "{\\b1}").replace(/<\/b>/g, "{\\b0}").replace(/\{\/b\}/g, "{\\b0}").replace(//g, "{\\i1}").replace(/\{i\}/g, "{\\i1}").replace(/<\/i>/g, "{\\i0}").replace(/\{\/i\}/g, "{\\i0}").replace(//g, "{\\u1}").replace(/\{u\}/g, "{\\u1}").replace(/<\/u>/g, "{\\u0}").replace(/\{\/u\}/g, "{\\u0}").replace(//g, function(e, t, r, n) { return "{c&H" + n + r + t + "&}" }).replace(/<\/font>/g, "{\\c}"), null !== this.O ? this.O += "\\N" + e : this.O = e; this.h.nextLine().then(function(e) { return t.m(e) }, function(e) { t._.reject(e) }) }, e }(); e.SrtStreamParser = f }, function(t, r) { var n = r(32), i = function() { function e(e) { this.P = e, this.C = 0 } return e.prototype.nextLine = function() { var e = null; if (this.C < this.P.length) { var t = this.P.indexOf("\n", this.C); - 1 !== t ? (e = n.Promise.resolve(this.P.substring(this.C, t)), this.C = t + 1) : (e = n.Promise.resolve(this.P.substr(this.C)), this.C = this.P.length) } else e = n.Promise.resolve(null); return e }, e }(); t.StringStream = i; var o = function() { function e(e) { var t = this; this.k = e, this.C = 0, this.x = null, this.j = null, e.addEventListener("progress", function() { return t.A() }, !1), e.addEventListener("load", function() { return t.T() }, !1), e.addEventListener("error", function(e) { return t.D(e) }, !1) } return e.prototype.nextLine = function() { if (null !== this.x) throw new Error("XhrStream only supports one pending unfulfilled read at a time."); var e = this.x = new n.DeferredPromise; return this.F(), e.promise }, e.prototype.A = function() { null !== this.x && this.k.readyState !== XMLHttpRequest.DONE && this.F() }, e.prototype.T = function() { null !== this.x && this.F() }, e.prototype.D = function(e) { this.j = e, null !== this.x && this.F() }, e.prototype.F = function() { if (null !== this.j) return void this.x.reject(this.j); var e = this.k.responseText, t = e.indexOf("\n", this.C); - 1 !== t ? (this.x.resolve(e.substring(this.C, t)), this.C = t + 1, this.x = null) : this.k.readyState === XMLHttpRequest.DONE && (null !== this.j ? this.x.reject(this.j) : this.C < e.length ? (this.x.resolve(e.substr(this.C)), this.C = e.length) : this.x.resolve(null), this.x = null) }, e }(); t.XhrStream = o; var a = function() { function t(t, r) { this.M = "", this.x = null, this.R = t.getReader(), this.N = new e.TextDecoder(r, { ignoreBOM: !0 }) } return t.prototype.nextLine = function() { if (null !== this.x) throw new Error("BrowserReadableStream only supports one pending unfulfilled read at a time."); var e = this.x = new n.DeferredPromise; return this.F(), e.promise }, t.prototype.F = function() { var e = this, t = this.M.indexOf("\n"); - 1 !== t ? (this.x.resolve(this.M.substr(0, t)), this.M = this.M.substr(t + 1), this.x = null) : this.R.read().then(function(t) { var r = t.value, n = t.done; n ? (0 === e.M.length ? e.x.resolve(null) : (e.x.resolve(e.M), e.M = ""), e.x = null) : (e.M += e.N.decode(r, { stream: !0 }), e.F()) }) }, t }(); t.BrowserReadableStream = a }, function(e, t) { function r(e) { for (var t = atob(e.contents), r = new Uint8Array(new ArrayBuffer(t.length)), n = 0; n < t.length; n++) r[n] = t.charCodeAt(n); for (var i = { dataView: new DataView(r.buffer), position: 0 }, o = p.read(i), a = null, n = 0; n < o.numTables; n++) { var l = c.read(i); if (l.c1 + l.c2 + l.c3 + l.c4 === "name") { a = l; break } } i.position = a.offset; for (var u = h.read(i), d = new s.Set, n = 0; n < u.count; n++) { var _ = f.read(i); switch (_.nameId) { case 1: case 4: case 6: var g = a.offset + u.stringOffset + _.offset, v = r.subarray(g, g + _.length); switch (_.platformId) { case 1: for (var y = "", m = 0; m < v.length; m++) y += String.fromCharCode(v[m]); d.add(y); break; case 3: for (var b = "", m = 0; m < v.length; m += 2) b += String.fromCharCode((v[m] << 8) + v[m + 1]); d.add(b) } } } return d } function n(e) { var t = e.W; return e.read = function(r) { for (var n = new e, i = 0; i < t.length; i++) { var a = t[i], l = void 0; switch (a.type) { case o.Char: l = String.fromCharCode(r.dataView.getInt8(r.position)), r.position += 1; break; case o.Uint16: l = r.dataView.getUint16(r.position), r.position += 2; break; case o.Uint32: l = r.dataView.getUint32(r.position), r.position += 4 } n[a.field] = l } return n }, e } function i(e) { var t = u.get(e); return void 0 === t && (t = function(t, r) { var n = t.constructor; void 0 === n.W && (n.W = []), n.W.push({ type: e, field: r }) }, u.set(e, t)), t } var o, a = t(34).L, l = t(30), s = t(33); ! function(e) { e[e.Char = 0] = "Char", e[e.Uint16 = 1] = "Uint16", e[e.Uint32 = 2] = "Uint32" }(o || (o = {})); var u = new l.Map, p = function() { function e() {} return a([i(o.Uint16)], e.prototype, "majorVersion", void 0), a([i(o.Uint16)], e.prototype, "minorVersion", void 0), a([i(o.Uint16)], e.prototype, "numTables", void 0), a([i(o.Uint16)], e.prototype, "searchRange", void 0), a([i(o.Uint16)], e.prototype, "entrySelector", void 0), a([i(o.Uint16)], e.prototype, "rangeShift", void 0), e = a([n], e) }(), c = function() { function e() {} return a([i(o.Char)], e.prototype, "c1", void 0), a([i(o.Char)], e.prototype, "c2", void 0), a([i(o.Char)], e.prototype, "c3", void 0), a([i(o.Char)], e.prototype, "c4", void 0), a([i(o.Uint32)], e.prototype, "checksum", void 0), a([i(o.Uint32)], e.prototype, "offset", void 0), a([i(o.Uint32)], e.prototype, "length", void 0), e = a([n], e) }(), h = function() { function e() {} return a([i(o.Uint16)], e.prototype, "formatSelector", void 0), a([i(o.Uint16)], e.prototype, "count", void 0), a([i(o.Uint16)], e.prototype, "stringOffset", void 0), e = a([n], e) }(), f = function() { function e() {} return a([i(o.Uint16)], e.prototype, "platformId", void 0), a([i(o.Uint16)], e.prototype, "encodingId", void 0), a([i(o.Uint16)], e.prototype, "languageId", void 0), a([i(o.Uint16)], e.prototype, "nameId", void 0), a([i(o.Uint16)], e.prototype, "length", void 0), a([i(o.Uint16)], e.prototype, "offset", void 0), e = a([n], e) }(); e.getTtfNames = r }, function(e) { var t = function() { function e(e, t) { this.I = e, this.X = t } return Object.defineProperty(e.prototype, "x", { get: function() { return this.I }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y", { get: function() { return this.X }, enumerable: !0, configurable: !0 }), e }(); e.MoveInstruction = t; var r = function() { function e(e, t) { this.I = e, this.X = t } return Object.defineProperty(e.prototype, "x", { get: function() { return this.I }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y", { get: function() { return this.X }, enumerable: !0, configurable: !0 }), e }(); e.LineInstruction = r; var n = function() { function e(e, t, r, n, i, o) { this.Y = e, this.V = t, this.B = r, this.z = n, this.G = i, this.q = o } return Object.defineProperty(e.prototype, "x1", { get: function() { return this.Y }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y1", { get: function() { return this.V }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "x2", { get: function() { return this.B }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y2", { get: function() { return this.z }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "x3", { get: function() { return this.G }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y3", { get: function() { return this.q }, enumerable: !0, configurable: !0 }), e }(); e.CubicBezierCurveInstruction = n }, function(e, t) { var r = t(7); e.drawing = r; var n = function() { function e(e, t, r, n) { void 0 === n && (n = 1), this.U = e, this.H = t, this.K = r, this.Z = n } return Object.defineProperty(e.prototype, "red", { get: function() { return this.U }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "green", { get: function() { return this.H }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "blue", { get: function() { return this.K }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "alpha", { get: function() { return this.Z }, enumerable: !0, configurable: !0 }), e.prototype.withAlpha = function(t) { return null !== t ? new e(this.U, this.H, this.K, t) : this }, e.prototype.toString = function() { return "rgba(" + this.U + ", " + this.H + ", " + this.K + ", " + this.Z.toFixed(3) + ")" }, e.prototype.interpolate = function(t, r) { return new e(this.U + r * (t.red - this.U), this.H + r * (t.green - this.H), this.K + r * (t.blue - this.K), this.Z + r * (t.alpha - this.Z)) }, e }(); e.Color = n; var i = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Comment = i; var o = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e.prototype.toString = function() { return "Text { value: " + this.p.replace(/\u00A0/g, "\\h") + " }" }, e }(); e.Text = o; var a = function() { function e() {} return e }(); e.NewLine = a; var l = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Italic = l; var s = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Bold = s; var u = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Underline = u; var p = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.StrikeThrough = p; var c = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Border = c; var h = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.BorderX = h; var f = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.BorderY = f; var d = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Shadow = d; var _ = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.ShadowX = _; var g = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.ShadowY = g; var v = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Blur = v; var y = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.GaussianBlur = y; var m = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.FontName = m; var b = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.FontSize = b; var w = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.FontSizePlus = w; var S = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.FontSizeMinus = S; var O = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.FontScaleX = O; var P = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.FontScaleY = P; var C = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.LetterSpacing = C; var k = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.RotateX = k; var E = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.RotateY = E; var x = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.RotateZ = x; var j = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.SkewX = j; var A = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.SkewY = A; var T = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.PrimaryColor = T; var D = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.SecondaryColor = D; var F = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.OutlineColor = F; var M = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.ShadowColor = M; var R = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Alpha = R; var N = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.PrimaryAlpha = N; var W = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.SecondaryAlpha = W; var L = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.OutlineAlpha = L; var I = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.ShadowAlpha = I; var X = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Alignment = X; var Y = function() { function e(e) { this.J = e } return Object.defineProperty(e.prototype, "duration", { get: function() { return this.J }, enumerable: !0, configurable: !0 }), e }(); e.ColorKaraoke = Y; var V = function() { function e(e) { this.J = e } return Object.defineProperty(e.prototype, "duration", { get: function() { return this.J }, enumerable: !0, configurable: !0 }), e }(); e.SweepingColorKaraoke = V; var B = function() { function e(e) { this.J = e } return Object.defineProperty(e.prototype, "duration", { get: function() { return this.J }, enumerable: !0, configurable: !0 }), e }(); e.OutlineKaraoke = B; var z = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.WrappingStyle = z; var G = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.Reset = G; var q = function() { function e(e, t) { this.I = e, this.X = t } return Object.defineProperty(e.prototype, "x", { get: function() { return this.I }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y", { get: function() { return this.X }, enumerable: !0, configurable: !0 }), e }(); e.Position = q; var U = function() { function e(e, t, r, n, i, o) { this.Y = e, this.V = t, this.B = r, this.z = n, this.$ = i, this.Q = o } return Object.defineProperty(e.prototype, "x1", { get: function() { return this.Y }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y1", { get: function() { return this.V }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "x2", { get: function() { return this.B }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y2", { get: function() { return this.z }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "t1", { get: function() { return this.$ }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "t2", { get: function() { return this.Q }, enumerable: !0, configurable: !0 }), e }(); e.Move = U; var H = function() { function e(e, t) { this.I = e, this.X = t } return Object.defineProperty(e.prototype, "x", { get: function() { return this.I }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y", { get: function() { return this.X }, enumerable: !0, configurable: !0 }), e }(); e.RotationOrigin = H; var K = function() { function e(e, t) { this.s = e, this.u = t } return Object.defineProperty(e.prototype, "start", { get: function() { return this.s }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "end", { get: function() { return this.u }, enumerable: !0, configurable: !0 }), e }(); e.Fade = K; var Z = function() { function e(e, t, r, n, i, o, a) { this.ee = e, this.te = t, this.re = r, this.$ = n, this.Q = i, this.ne = o, this.ie = a } return Object.defineProperty(e.prototype, "a1", { get: function() { return this.ee }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "a2", { get: function() { return this.te }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "a3", { get: function() { return this.re }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "t1", { get: function() { return this.$ }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "t2", { get: function() { return this.Q }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "t3", { get: function() { return this.ne }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "t4", { get: function() { return this.ie }, enumerable: !0, configurable: !0 }), e }(); e.ComplexFade = Z; var J = function() { function e(e, t, r, n) { this.s = e, this.u = t, this.oe = r, this.ae = n } return Object.defineProperty(e.prototype, "start", { get: function() { return this.s }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "end", { get: function() { return this.u }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "accel", { get: function() { return this.oe }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "tags", { get: function() { return this.ae }, enumerable: !0, configurable: !0 }), e }(); e.Transform = J; var $ = function() { function e(e, t, r, n, i) { this.Y = e, this.V = t, this.B = r, this.z = n, this.le = i } return Object.defineProperty(e.prototype, "x1", { get: function() { return this.Y }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y1", { get: function() { return this.V }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "x2", { get: function() { return this.B }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "y2", { get: function() { return this.z }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "inside", { get: function() { return this.le }, enumerable: !0, configurable: !0 }), e }(); e.RectangularClip = $; var Q = function() { function e(e, t, r) { this.se = e, this.ue = t, this.le = r } return Object.defineProperty(e.prototype, "scale", { get: function() { return this.se }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "instructions", { get: function() { return this.ue }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "inside", { get: function() { return this.le }, enumerable: !0, configurable: !0 }), e }(); e.VectorClip = Q; var ee = function() { function e(e) { this.se = e } return Object.defineProperty(e.prototype, "scale", { get: function() { return this.se }, enumerable: !0, configurable: !0 }), e }(); e.DrawingMode = ee; var te = function() { function e(e) { this.p = e } return Object.defineProperty(e.prototype, "value", { get: function() { return this.p }, enumerable: !0, configurable: !0 }), e }(); e.DrawingBaselineOffset = te; var re = function() { function e(e) { this.ue = e } return Object.defineProperty(e.prototype, "instructions", { get: function() { return this.ue }, enumerable: !0, configurable: !0 }), e }(); e.DrawingInstructions = re; for (var ne = function(e, t) { if (!e.prototype.hasOwnProperty("toString")) { var r = Object.getOwnPropertyNames(e.prototype).filter(function(e) { return "constructor" !== e }); e.prototype.toString = function() { var e = this; return t + " { " + r.map(function(t) { return t + ": " + e[t] }).join(", ") + (r.length > 0 ? " " : "") + "}" } } }, ie = t(38), oe = 0, ae = Object.keys(e); oe < ae.length; oe++) { var le = ae[oe], se = e[le]; se instanceof Function && (ne(se, le), ie.registerClassPrototype(se.prototype)) } for (var ue = 0, pe = Object.keys(r); ue < pe.length; ue++) { var le = pe[ue], se = r[le]; se instanceof Function && (ne(se, "Drawing" + le), ie.registerClassPrototype(se.prototype)) } }, function(e, t) { var r = t(23), n = t(11), i = function() { function e(e, t) { this.pe = e, this.ce = t, this.he = new n.ManualClock, this.fe = null, this.de = null, this._e = null } return e.prototype.play = function() { this.he.enabled && (this.ge(), this.he.play()) }, e.prototype.pause = function() { if (this.he.enabled) { if (null === this.fe) return void(r.debugMode && console.warn("AutoClock.pause: Abnormal state detected. AutoClock._nextAnimationFrameRequestId should not have been null.")); this.ve(), this.he.pause() } }, e.prototype.seeking = function() { this.he.seek(this.pe()) }, Object.defineProperty(e.prototype, "currentTime", { get: function() { return this.he.currentTime }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "enabled", { get: function() { return this.he.enabled }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "paused", { get: function() { return this.he.paused }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rate", { get: function() { return this.he.rate }, enumerable: !0, configurable: !0 }), e.prototype.setRate = function(e) { this.he.setRate(e) }, e.prototype.enable = function() { return this.he.enable() ? (this.ge(), !0) : !1 }, e.prototype.disable = function() { return this.he.disable() ? (this.ve(), !0) : !1 }, e.prototype.toggle = function() { this.he.enabled ? this.disable() : this.enable() }, e.prototype.setEnabled = function(e) { return e ? this.enable() : this.disable() }, e.prototype.addEventListener = function(e, t) { this.he.addEventListener(e, t) }, e.prototype.ye = function(e) { var t = this; if (!this.he.enabled) return void(r.debugMode && console.warn("AutoClock._onTimerTick: Called when disabled.")); var n = this.he.currentTime, i = this.pe(); this.he.paused ? n !== i && (this.de = i, this._e = e, this.he.tick(i)) : null !== this.de && i === this.de ? e - this._e > this.ce ? (this._e = null, this.he.pause()) : this.he.tick((e - this._e) / 1e3 * this.he.rate + this.de) : (this.de = i, this._e = e, this.he.tick(i)), this.fe = requestAnimationFrame(function(e) { return t.ye(e) }) }, e.prototype.ge = function() { var e = this; null === this.fe && (this.fe = requestAnimationFrame(function(t) { return e.ye(t) })) }, e.prototype.ve = function() { null !== this.fe && (cancelAnimationFrame(this.fe), this.fe = null) }, e }(); e.AutoClock = i }, function(e) { var t = function() { function e() {} return e.prototype.addEventListener = function(e, t) { var r = this.me.get(e); void 0 === r && this.me.set(e, r = []), r.push(t) }, e.prototype.be = function(e, t) { var r = this.me.get(e); if (void 0 !== r) for (var n = 0; n < r.length; n++) { var i = r[n]; i.apply(this, t) } }, e }(); e.EventSource = t, function(e) { e[e.Play = 0] = "Play", e[e.Tick = 1] = "Tick", e[e.Pause = 2] = "Pause", e[e.Stop = 3] = "Stop", e[e.RateChange = 4] = "RateChange" }(e.ClockEvent || (e.ClockEvent = {})) }, function(e, t) { var r = t(31), n = t(30), i = t(10), o = function() { function e() { this.we = -1, this.Se = 1, this.Oe = !0, this.Pe = !0, this.me = new n.Map } return e.prototype.play = function() { this.Oe && this.Pe && (this.Pe = !1, this.be(i.ClockEvent.Play, [])) }, e.prototype.tick = function(e) { this.Oe && this.we !== e && (this.play(), this.we = e, this.be(i.ClockEvent.Tick, [])) }, e.prototype.seek = function(e) { this.Oe && (this.pause(), this.we !== e && (this.stop(), this.tick(e), this.pause())) }, e.prototype.pause = function() { this.Oe && (this.Pe || (this.Pe = !0, this.be(i.ClockEvent.Pause, []))) }, e.prototype.stop = function() { this.be(i.ClockEvent.Stop, []) }, Object.defineProperty(e.prototype, "currentTime", { get: function() { return this.we }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "enabled", { get: function() { return this.Oe }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "paused", { get: function() { return this.Pe }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rate", { get: function() { return this.Se }, enumerable: !0, configurable: !0 }), e.prototype.setRate = function(e) { this.Se !== e && (this.Se = e, this.be(i.ClockEvent.RateChange, [])) }, e.prototype.enable = function() { return this.Oe ? !1 : (this.Oe = !0, !0) }, e.prototype.disable = function() { return this.Oe ? (this.pause(), this.stop(), this.Oe = !1, !0) : !1 }, e.prototype.toggle = function() { this.Oe ? this.disable() : this.enable() }, e.prototype.setEnabled = function(e) { return e ? this.enable() : this.disable() }, e }(); e.ManualClock = o, r.mixin(o, [i.EventSource]) }, function(e, t) { var r = t(9), n = function() { function e(e) { var t = this; this.Ce = new r.AutoClock(function() { return e.currentTime }, 100), e.addEventListener("playing", function() { return t.Ce.play() }, !1), e.addEventListener("pause", function() { return t.Ce.pause() }, !1), e.addEventListener("seeking", function() { return t.Ce.seeking() }, !1), e.addEventListener("ratechange", function() { return t.Ce.setRate(e.playbackRate) }, !1) } return Object.defineProperty(e.prototype, "currentTime", { get: function() { return this.Ce.currentTime }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "enabled", { get: function() { return this.Ce.enabled }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "paused", { get: function() { return this.Ce.paused }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rate", { get: function() { return this.Ce.rate }, enumerable: !0, configurable: !0 }), e.prototype.enable = function() { return this.Ce.enable() }, e.prototype.disable = function() { return this.Ce.disable() }, e.prototype.toggle = function() { this.Ce.enabled ? this.disable() : this.enable() }, e.prototype.setEnabled = function(e) { return e ? this.enable() : this.disable() }, e.prototype.addEventListener = function(e, t) { this.Ce.addEventListener(e, t) }, e }(); e.VideoClock = n }, function(e, t) { var r = t(34).ke, n = t(12), i = t(21), o = function(e) { function t(t, r, i) { e.call(this, r, new n.VideoClock(t), document.createElement("div"), i), this.Ee = t, this.Ee.parentElement.replaceChild(this.libjassSubsWrapper, this.Ee), this.libjassSubsWrapper.insertBefore(this.Ee, this.libjassSubsWrapper.firstElementChild) } return r(t, e), t.prototype.resize = function() { var t = this.Ee.videoWidth, r = this.Ee.videoHeight, n = this.Ee.offsetWidth, i = this.Ee.offsetHeight, o = Math.min(n / t, i / r), a = t * o, l = r * o, s = (n - a) / 2, u = (i - l) / 2; e.prototype.resize.call(this, a, l, s, u) }, t.prototype.resizeVideo = function() { console.warn("`DefaultRenderer.resizeVideo(width, height)` has been deprecated. Use `DefaultRenderer.resize()` instead."), this.resize() }, t.prototype.xe = function() { this.resize(), e.prototype.xe.call(this) }, t }(i.WebRenderer); e.DefaultRenderer = o }, function(e, t) { var r = t(10); e.ClockEvent = r.ClockEvent, e.EventSource = r.EventSource; var n = t(9); e.AutoClock = n.AutoClock; var i = t(11); e.ManualClock = i.ManualClock; var o = t(12); e.VideoClock = o.VideoClock; var a = t(13); e.DefaultRenderer = a.DefaultRenderer; var l = t(15); e.NullRenderer = l.NullRenderer; var s = t(21); e.WebRenderer = s.WebRenderer; var u = t(16); e.RendererSettings = u.RendererSettings }, function(e, t) { var r = t(10), n = t(16), i = t(23), o = function() { function e(t, i, o) { var a = this; this.f = t, this.je = i, this.Ae = ++e.Te, this.De = n.RendererSettings.from(o), this.je.addEventListener(r.ClockEvent.Play, function() { return a.Fe() }), this.je.addEventListener(r.ClockEvent.Tick, function() { return a.Me() }), this.je.addEventListener(r.ClockEvent.Pause, function() { return a.Re() }), this.je.addEventListener(r.ClockEvent.Stop, function() { return a.Ne() }), this.je.addEventListener(r.ClockEvent.RateChange, function() { return a.We() }) } return Object.defineProperty(e.prototype, "id", { get: function() { return this.Ae }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "ass", { get: function() { return this.f }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "clock", { get: function() { return this.je }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "settings", { get: function() { return this.De }, enumerable: !0, configurable: !0 }), e.prototype.preRender = function() {}, e.prototype.draw = function() {}, e.prototype.enable = function() { return this.je.enable() }, e.prototype.disable = function() { return this.je.disable() }, e.prototype.toggle = function() { this.je.toggle() }, e.prototype.setEnabled = function(e) { return this.je.setEnabled(e) }, Object.defineProperty(e.prototype, "enabled", { get: function() { return this.je.enabled }, enumerable: !0, configurable: !0 }), e.prototype.Fe = function() { i.verboseMode && console.log("NullRenderer._onClockPlay") }, e.prototype.Me = function() { var e = this.je.currentTime; i.verboseMode && console.log("NullRenderer._onClockTick: currentTime = " + e); for (var t = 0, r = this.f.dialogues; t < r.length; t++) { var n = r[t]; n.end > e && (n.start <= e ? this.draw(n) : n.start <= e + this.De.preRenderTime && this.preRender(n)) } }, e.prototype.Re = function() { i.verboseMode && console.log("NullRenderer._onClockPause") }, e.prototype.Ne = function() { i.verboseMode && console.log("NullRenderer._onClockStop") }, e.prototype.We = function() { i.verboseMode && console.log("NullRenderer._onClockRateChange") }, e.Te = -1, e }(); e.NullRenderer = o }, function(e, t) { function r(e) { return e.type === CSSRule.FONT_FACE_RULE } var n = t(30), i = function() { function e() {} return e.makeFontMapFromStyleElement = function(e) { for (var t = new n.Map, i = e.sheet, o = 0; o < i.cssRules.length; o++) { var a = i.cssRules[o]; if (r(a)) { var l = a.style.getPropertyValue("font-family").match(/^["']?(.*?)["']?$/)[1], s = a.style.getPropertyValue("src"); s || (s = a.cssText.split("\n").map(function(e) { return e.match(/src:\s*([^;]+?)\s*;/) }).filter(function(e) { return null !== e }).map(function(e) { return e[1] })[0]), t.set(l, s) } } return t }, e.from = function(t) { (void 0 === t || null === t) && (t = {}); var r = t, n = r.fontMap, i = void 0 === n ? null : n, o = r.preRenderTime, a = void 0 === o ? 5 : o, l = r.preciseOutlines, s = void 0 === l ? !1 : l, u = r.enableSvg, p = void 0 === u ? !0 : u, c = r.fallbackFonts, h = void 0 === c ? 'Arial, Helvetica, sans-serif, "Segoe UI Symbol"' : c, f = r.useAttachedFonts, d = void 0 === f ? !1 : f, _ = new e; return _.fontMap = i, _.preRenderTime = a, _.preciseOutlines = s, _.enableSvg = p, _.fallbackFonts = h, _.useAttachedFonts = d, _ }, e }(); e.RendererSettings = i }, function(e, t) { var r = t(30), n = function() { function e(t, n) { this.Le = n, this.Ie = "", this.Xe = new r.Map, this.Ye = 0, this.Ae = t.id + "-" + e.Ve++, this.Se = t.clock.rate } return Object.defineProperty(e.prototype, "animationStyle", { get: function() { return this.Ie }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "animationDelays", { get: function() { return this.Xe }, enumerable: !0, configurable: !0 }), e.prototype.add = function(e, t) { for (var r = null, n = null, i = 0; i < t.length; i++) { var o = t[i]; null === r && (r = o.time), n = o.time } for (var a = "", l = 0; l < t.length; l++) { var o = t[l]; a += " " + (100 * (n - r === 0 ? 1 : (o.time - r) / (n - r))).toFixed(3) + "% {\n", o.properties.forEach(function(e, t) { a += " " + t + ": " + e + ";\n" }), a += " }\n" } var s = "animation-" + this.Ae + "-" + this.Ye++; this.Le.appendChild(document.createTextNode("@-webkit-keyframes " + s + " {\n" + a + "\n}")), this.Le.appendChild(document.createTextNode("@keyframes " + s + " {\n" + a + "\n}")), "" !== this.Ie && (this.Ie += ","), this.Ie += s + " " + ((n - r) / this.Se).toFixed(3) + "s " + e, this.Xe.set(s, r) }, e.Ve = 0, e }(); e.AnimationCollection = n }, function(e, t) { var r = t(8), n = function() { function e(e, t) { this.Be = e, this.ze = t, this.se = 1, this.Ge = 0 } return Object.defineProperty(e.prototype, "scale", { set: function(e) { this.se = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "baselineOffset", { set: function(e) { this.Ge = e }, enumerable: !0, configurable: !0 }), e.prototype.toSVG = function(e, t) { for (var n = Math.pow(2, this.se - 1), i = this.Be / n, o = this.ze / n, a = document.createElementNS("http://www.w3.org/2000/svg", "path"), l = 0, s = 0, u = 0, p = e.instructions; u < p.length; u++) { var c = p[u]; c instanceof r.drawing.MoveInstruction ? (a.pathSegList.appendItem(a.createSVGPathSegMovetoAbs(c.x, c.y + this.Ge)), l = Math.max(l, c.x), s = Math.max(s, c.y + this.Ge)) : c instanceof r.drawing.LineInstruction ? (a.pathSegList.appendItem(a.createSVGPathSegLinetoAbs(c.x, c.y + this.Ge)), l = Math.max(l, c.x), s = Math.max(s, c.y + this.Ge)) : c instanceof r.drawing.CubicBezierCurveInstruction && (a.pathSegList.appendItem(a.createSVGPathSegCurvetoCubicAbs(c.x3, c.y3 + this.Ge, c.x1, c.y1 + this.Ge, c.x2, c.y2 + this.Ge)), l = Math.max(l, c.x1, c.x2, c.x3), s = Math.max(s, c.y1 + this.Ge, c.y2 + this.Ge, c.y3 + this.Ge)) } var h = document.createElementNS("http://www.w3.org/2000/svg", "svg"); h.setAttribute("version", "1.1"), h.width.baseVal.valueAsString = (l * i).toFixed(3) + "px", h.height.baseVal.valueAsString = (s * o).toFixed(3) + "px"; var f = document.createElementNS("http://www.w3.org/2000/svg", "g"); return h.appendChild(f), f.setAttribute("transform", "scale(" + i.toFixed(3) + " " + o.toFixed(3) + ")"), f.appendChild(a), a.setAttribute("fill", t.toString()), h }, e }(); e.DrawingStyles = n }, function(e, t) { function r(e, t, r, n) { var i = '"' + e + '"'; "" !== r && (i += ", " + r), n.style.fontFamily = i, n.style.fontSize = t + "px" } function n(e, t, n, i) { return r(e, t, n, i), new u.Promise(function(e) { return setTimeout(function() { return e(i.offsetHeight) }, 1e3) }) } function i(e, t, n, i) { return r(e, t, n, i), i.offsetHeight } function o(e, t) { return [e, 180 / (t - e)] } function a(e, t, r) { return n(e, 180, t, r).then(function(i) { return n(e, 360, t, r).then(function(e) { return o(i, e) }) }) } function l(e, t, r) { return 180 + (e - t) * r } function s(e, t, r, n, a) { var s = a.get(e); if (void 0 === s) { var u = i(e, 180, r, n), p = i(e, 360, r, n); a.set(e, s = o(u, p)) } var c = s[0], h = s[1]; return l(t, c, h) } var u = t(32); e.calculateFontMetrics = a, e.fontSizeForLineHeight = s }, function(e) { var t = function() { function e(e, t) { this.qe = e, this.Ue = t } return Object.defineProperty(e.prototype, "time", { get: function() { return this.qe }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "properties", { get: function() { return this.Ue }, enumerable: !0, configurable: !0 }), e }(); e.Keyframe = t }, function(t, r) { var n = r(34).ke, i = r(17), o = r(18), a = r(19), l = r(20), s = r(22), u = r(10), p = r(15), c = r(6), h = r(8), f = r(23), d = r(25), _ = r(27), g = r(31), v = r(30), y = r(32), m = /^(url|local)\(["']?(.+?)["']?\)$/, b = function(t) { function r(r, n, i, o) { var a = this; t.call(this, r, n, function() { if (!(i instanceof HTMLDivElement)) { var e = o; o = i, i = e, console.warn("WebRenderer's constructor now takes libjassSubsWrapper as the third parameter and settings as the fourth parameter. Please update the caller.") } return o }()), this.He = i, this.Ke = [], this.Ze = [], this.Je = new v.Map, this.$e = new v.Map, this.Qe = new v.Map, this.me = new v.Map, this.He.classList.add("libjass-wrapper"), this.et = document.createElement("div"), this.He.appendChild(this.et), this.et.className = "libjass-subs", this.tt = document.createElement("div"), this.He.appendChild(this.tt), this.tt.className = "libjass-font-measure", this.tt.appendChild(document.createTextNode("M")), f.debugMode && console.log("Preloading fonts..."); var l = [], s = new v.Map, u = null === this.settings.fontMap ? new v.Map : this.settings.fontMap, p = new v.Map; this.settings.useAttachedFonts && r.attachments.forEach(function(e) { if (e.type === d.AttachmentType.Font) { var t = null; try { t = c.getTtfNames(e) } catch (e) { return void console.error(e) } var r = "data:application/x-font-ttf;base64," + e.contents; t.forEach(function(e) { var t = u.get(e); if (void 0 !== t) if ("string" != typeof t) t.push(r); else { var n = p.get(e); void 0 === n && p.set(e, n = []), n.push(r) } else u.set(e, [r]) }) } }), u.forEach(function(t, r) { var n; if (e.document.fonts && e.document.fonts.add) { var i = "string" == typeof t ? t : t.map(function(e) { return null !== e.match(m) ? e : 'url("' + e + '")' }).join(", "), o = p.get(r); if (void 0 !== o) for (var u = 0; u < o.length; u++) { var c = o[u]; i += ', url("' + c + '")' } var h = []; e.document.fonts.forEach(function(e) { (e.family === r || e.family === '"' + r + '"') && h.push(e) }); var d; if (0 === h.length) { var _ = new FontFace(r, i), g = new FontFace('"' + r + '"', i); e.document.fonts.add(_), e.document.fonts.add(g), d = y.any([_.load(), g.load()]) } else d = y.any(h.map(function(e) { return e.load() })); n = a.rt(r, d.catch(function(e) { return console.warn("Fetching fonts for " + r + " at " + i + " failed: %o", e), null })) } else { var v = ("string" == typeof t ? t.split(/,/) : t).map(function(e) { return e.trim() }).map(function(e) { var t = e.match(m); return null === t ? e : "local" === t[1] ? null : t[2]; }).filter(function(e) { return null !== e }), o = p.get(r); void 0 !== o && (v = v.concat(o)); var b = v.map(function(e) { var t = s.get(e); return void 0 === t && (t = new y.Promise(function(t, r) { var n = new XMLHttpRequest; n.addEventListener("load", function() { f.debugMode && console.log("Preloaded " + e + "."), t(null) }), n.addEventListener("error", function(e) { r(e) }), n.open("GET", e, !0), n.send() }), s.set(e, t)), t }), w = 0 === b.length ? y.Promise.resolve(null) : y.first(b).catch(function(e) { return console.warn("Fetching fonts for " + r + " at " + v.join(", ") + " failed: %o", e), null }); n = a.rt(r, w) } l.push(n.then(function(e) { return a.Je.set(r, e) })) }), y.Promise.all(l).then(function() { f.debugMode && console.log("All fonts have been preloaded."), a.xe() }) } return n(r, t), Object.defineProperty(r.prototype, "libjassSubsWrapper", { get: function() { return this.He }, enumerable: !0, configurable: !0 }), r.prototype.resize = function(e, t, r, n) { void 0 === r && (r = 0), void 0 === n && (n = 0), this.nt(), this.et.style.width = e.toFixed(3) + "px", this.et.style.height = t.toFixed(3) + "px", this.et.style.left = r.toFixed(3) + "px", this.et.style.top = n.toFixed(3) + "px", this.it = e, this.ot = e / this.ass.properties.resolutionX, this.at = t / this.ass.properties.resolutionY, this.Qe.clear(), -1 !== this.clock.currentTime && this.Me() }, r.prototype.preRender = function(e) { var t = this, n = this.Qe.get(e.id); if (n) return n; var a = this.clock.currentTime - e.start; if (e.containsTransformTag && 0 > a) return null; var u = document.createElement("div"); u.style.marginLeft = (this.ot * e.style.marginLeft).toFixed(3) + "px", u.style.marginRight = (this.ot * e.style.marginRight).toFixed(3) + "px", u.style.marginTop = u.style.marginBottom = (this.at * e.style.marginVertical).toFixed(3) + "px", u.style.minWidth = (this.it - this.ot * (e.style.marginLeft + e.style.marginRight)).toFixed(3) + "px"; var p = document.createElement("style"); p.id = "libjass-animation-styles-" + this.id + "-" + e.id, p.type = "text/css"; var c = new i.AnimationCollection(this, p), d = document.createElementNS("http://www.w3.org/2000/svg", "svg"); d.setAttribute("version", "1.1"), d.setAttribute("class", "libjass-filters"), d.width.baseVal.valueAsString = "0", d.height.baseVal.valueAsString = "0"; var g = document.createElementNS("http://www.w3.org/2000/svg", "defs"); d.appendChild(g); var y = null, m = new s.SpanStyles(this, e, this.ot, this.at, this.settings, this.tt, g, this.Je), b = null, w = !1, S = function(e) { null !== y && y.hasChildNodes() && u.appendChild(m.setStylesOnSpan(y, b)), null !== b && b.animationDelays.forEach(function(e, t) { return c.animationDelays.set(t, e) }), e && (w ? u.appendChild(m.makeNewLine()) : u.appendChild(document.createElement("br"))), y = document.createElement("span"), b = new i.AnimationCollection(t, p), w = e }; S(!1); for (var O = new o.DrawingStyles(this.ot, this.at), P = this.ass.properties.wrappingStyle, C = 0, k = 0, E = e.parts; k < E.length; k++) { var x = E[k]; if (x instanceof h.Italic) m.italic = x.value; else if (x instanceof h.Bold) m.bold = x.value; else if (x instanceof h.Underline) m.underline = x.value; else if (x instanceof h.StrikeThrough) m.strikeThrough = x.value; else if (x instanceof h.Border) m.outlineWidth = x.value, m.outlineHeight = x.value; else if (x instanceof h.BorderX) m.outlineWidth = x.value; else if (x instanceof h.BorderY) m.outlineHeight = x.value; else if (x instanceof h.Shadow) m.shadowDepthX = x.value, m.shadowDepthY = x.value; else if (x instanceof h.ShadowX) m.shadowDepthX = x.value; else if (x instanceof h.ShadowY) m.shadowDepthY = x.value; else if (x instanceof h.Blur) m.blur = x.value; else if (x instanceof h.GaussianBlur) m.gaussianBlur = x.value; else if (x instanceof h.FontName) m.fontName = x.value; else if (x instanceof h.FontSize) m.fontSize = x.value; else if (x instanceof h.FontSizePlus) m.fontSize += x.value; else if (x instanceof h.FontSizeMinus) m.fontSize -= x.value; else if (x instanceof h.FontScaleX) m.fontScaleX = x.value; else if (x instanceof h.FontScaleY) m.fontScaleY = x.value; else if (x instanceof h.LetterSpacing) m.letterSpacing = x.value; else if (x instanceof h.RotateX) m.rotationX = x.value; else if (x instanceof h.RotateY) m.rotationY = x.value; else if (x instanceof h.RotateZ) m.rotationZ = x.value; else if (x instanceof h.SkewX) m.skewX = x.value; else if (x instanceof h.SkewY) m.skewY = x.value; else if (x instanceof h.PrimaryColor) m.primaryColor = x.value; else if (x instanceof h.SecondaryColor) m.secondaryColor = x.value; else if (x instanceof h.OutlineColor) m.outlineColor = x.value; else if (x instanceof h.ShadowColor) m.shadowColor = x.value; else if (x instanceof h.Alpha) m.primaryAlpha = x.value, m.secondaryAlpha = x.value, m.outlineAlpha = x.value, m.shadowAlpha = x.value; else if (x instanceof h.PrimaryAlpha) m.primaryAlpha = x.value; else if (x instanceof h.SecondaryAlpha) m.secondaryAlpha = x.value; else if (x instanceof h.OutlineAlpha) m.outlineAlpha = x.value; else if (x instanceof h.ShadowAlpha) m.shadowAlpha = x.value; else if (x instanceof h.Alignment); else if (x instanceof h.ColorKaraoke) S(!1), b.add("step-end", [new l.Keyframe(0, new v.Map([ ["color", m.secondaryColor.withAlpha(m.secondaryAlpha).toString()] ])), new l.Keyframe(C, new v.Map([ ["color", m.primaryColor.withAlpha(m.primaryAlpha).toString()] ]))]), C += x.duration; else if (x instanceof h.WrappingStyle) P = x.value; else if (x instanceof h.Reset) m.reset(this.ass.styles.get(x.value)); else if (x instanceof h.Position) u.style.position = "absolute", u.style.left = (this.ot * x.x).toFixed(3) + "px", u.style.top = (this.at * x.y).toFixed(3) + "px"; else if (x instanceof h.Move) u.style.position = "absolute", c.add("linear", [new l.Keyframe(0, new v.Map([ ["left", (this.ot * x.x1).toFixed(3) + "px"], ["top", (this.at * x.y1).toFixed(3) + "px"] ])), new l.Keyframe(x.t1, new v.Map([ ["left", (this.ot * x.x1).toFixed(3) + "px"], ["top", (this.at * x.y1).toFixed(3) + "px"] ])), new l.Keyframe(x.t2, new v.Map([ ["left", (this.ot * x.x2).toFixed(3) + "px"], ["top", (this.at * x.y2).toFixed(3) + "px"] ])), new l.Keyframe(e.end - e.start, new v.Map([ ["left", (this.ot * x.x2).toFixed(3) + "px"], ["top", (this.at * x.y2).toFixed(3) + "px"] ]))]); else if (x instanceof h.Fade) c.add("linear", [new l.Keyframe(0, new v.Map([ ["opacity", "0"] ])), new l.Keyframe(x.start, new v.Map([ ["opacity", "1"] ])), new l.Keyframe(e.end - e.start - x.end, new v.Map([ ["opacity", "1"] ])), new l.Keyframe(e.end - e.start, new v.Map([ ["opacity", "0"] ]))]); else if (x instanceof h.ComplexFade) c.add("linear", [new l.Keyframe(0, new v.Map([ ["opacity", x.a1.toFixed(3)] ])), new l.Keyframe(x.t1, new v.Map([ ["opacity", x.a1.toFixed(3)] ])), new l.Keyframe(x.t2, new v.Map([ ["opacity", x.a2.toFixed(3)] ])), new l.Keyframe(x.t3, new v.Map([ ["opacity", x.a2.toFixed(3)] ])), new l.Keyframe(x.t4, new v.Map([ ["opacity", x.a3.toFixed(3)] ])), new l.Keyframe(e.end - e.start, new v.Map([ ["opacity", x.a3.toFixed(3)] ]))]); else if (x instanceof h.Transform) for (var j = a <= x.start ? 0 : a >= x.end ? 1 : Math.pow((a - x.start) / (x.end - x.start), x.accel), A = 0, T = x.tags; A < T.length; A++) { var D = T[A]; D instanceof h.Border ? (m.outlineWidth += j * (D.value - m.outlineWidth), m.outlineHeight += j * (D.value - m.outlineHeight)) : D instanceof h.BorderX ? m.outlineWidth += j * (D.value - m.outlineWidth) : D instanceof h.BorderY ? m.outlineHeight += j * (D.value - m.outlineHeight) : D instanceof h.Shadow ? (m.shadowDepthX += j * (D.value - m.shadowDepthX), m.shadowDepthY += j * (D.value - m.shadowDepthY)) : D instanceof h.ShadowX ? m.shadowDepthX += j * (D.value - m.shadowDepthX) : D instanceof h.ShadowY ? m.shadowDepthY += j * (D.value - m.shadowDepthY) : D instanceof h.Blur ? m.blur += j * (D.value - m.blur) : D instanceof h.GaussianBlur ? m.gaussianBlur += j * (D.value - m.gaussianBlur) : D instanceof h.FontSize ? m.fontSize += j * (D.value - m.fontSize) : D instanceof h.FontSizePlus ? m.fontSize += j * D.value : D instanceof h.FontSizeMinus ? m.fontSize -= j * D.value : D instanceof h.FontScaleX ? m.fontScaleX += j * (D.value - m.fontScaleX) : D instanceof h.FontScaleY ? m.fontScaleY += j * (D.value - m.fontScaleY) : D instanceof h.LetterSpacing ? m.letterSpacing += j * (D.value - m.letterSpacing) : D instanceof h.RotateX ? m.rotationX += j * (D.value - m.rotationX) : D instanceof h.RotateY ? m.rotationY += j * (D.value - m.rotationY) : D instanceof h.RotateZ ? m.rotationZ += j * (D.value - m.rotationZ) : D instanceof h.SkewX ? m.skewX += j * (D.value - m.skewX) : D instanceof h.SkewY ? m.skewY += j * (D.value - m.skewY) : D instanceof h.PrimaryColor ? m.primaryColor = m.primaryColor.interpolate(D.value, j) : D instanceof h.SecondaryColor ? m.secondaryColor = m.secondaryColor.interpolate(D.value, j) : D instanceof h.OutlineColor ? m.outlineColor = m.outlineColor.interpolate(D.value, j) : D instanceof h.ShadowColor ? m.shadowColor = m.shadowColor.interpolate(D.value, j) : D instanceof h.Alpha ? (m.primaryAlpha += j * (D.value - m.primaryAlpha), m.secondaryAlpha += j * (D.value - m.secondaryAlpha), m.outlineAlpha += j * (D.value - m.outlineAlpha), m.shadowAlpha += j * (D.value - m.shadowAlpha)) : D instanceof h.PrimaryAlpha ? m.primaryAlpha += j * (D.value - m.primaryAlpha) : D instanceof h.SecondaryAlpha ? m.secondaryAlpha += j * (D.value - m.secondaryAlpha) : D instanceof h.OutlineAlpha ? m.outlineAlpha += j * (D.value - m.outlineAlpha) : D instanceof h.ShadowAlpha && (m.shadowAlpha += j * (D.value - m.shadowAlpha)) } else x instanceof h.DrawingMode ? 0 !== x.scale && (O.scale = x.scale) : x instanceof h.DrawingBaselineOffset ? O.baselineOffset = x.value : x instanceof h.DrawingInstructions ? (y.appendChild(O.toSVG(x, m.primaryColor.withAlpha(m.primaryAlpha))), S(!1)) : x instanceof h.Text ? (y.appendChild(document.createTextNode(x.value + "‌")), S(!1)) : f.debugMode && x instanceof h.Comment ? (y.appendChild(document.createTextNode(x.value)), S(!1)) : x instanceof h.NewLine && S(!0) } for (var F = 0, M = e.parts; F < M.length; F++) { var x = M[F]; if (x instanceof h.Position || x instanceof h.Move) { var R = r.lt[e.alignment], N = "translate(" + -R[0] + "%, " + -R[1] + "%) translate(-" + u.style.marginLeft + ", -" + u.style.marginTop + ")", W = R[0] + "% " + R[1] + "%"; u.style.webkitTransform = N, u.style.webkitTransformOrigin = W, u.style.transform = N, u.style.transformOrigin = W; break } } switch (P) { case _.WrappingStyle.EndOfLineWrapping: u.style.whiteSpace = "pre-wrap"; break; case _.WrappingStyle.NoLineWrapping: u.style.whiteSpace = "pre"; break; case _.WrappingStyle.SmartWrappingWithWiderTopLine: case _.WrappingStyle.SmartWrappingWithWiderBottomLine: u.style.whiteSpace = "pre-wrap" } if ("" !== u.style.position) switch (e.alignment) { case 1: case 4: case 7: u.style.textAlign = "left"; break; case 2: case 5: case 8: u.style.textAlign = "center"; break; case 3: case 6: case 9: u.style.textAlign = "right" } u.style.webkitAnimation = c.animationStyle, u.style.animation = c.animationStyle, u.setAttribute("data-dialogue-id", this.id + "-" + e.id), "" !== p.textContent && u.appendChild(p), g.hasChildNodes() && u.appendChild(d); var L = { sub: u, animationDelays: c.animationDelays }; return e.containsTransformTag || this.Qe.set(e.id, L), L }, r.prototype.draw = function(e) { var t = this; if (!this.$e.has(e) || e.containsTransformTag) { f.debugMode && console.log(e.toString()); var r = this.Qe.get(e.id); void 0 === r && (r = this.preRender(e), f.debugMode && console.log(e.toString())); var n = r.sub.cloneNode(!0), i = function(n) { var i = n.style.animationName || n.style.webkitAnimationName; if (void 0 !== i && "" !== i) { var o = i.split(",").map(function(n) { n = n.trim(); var i = r.animationDelays.get(n); return ((i + e.start - t.clock.currentTime) / t.clock.rate).toFixed(3) + "s" }).join(", "); n.style.webkitAnimationDelay = o, n.style.animationDelay = o } }; i(n); for (var o = n.querySelectorAll('[style*="animation:"]'), a = 0; a < o.length; a++) i(o[a]); var l = e.layer, s = "absolute" === n.style.position ? 0 : e.alignment; if (void 0 === this.Ke[l]) { var u = document.createElement("div"); u.className = "layer layer" + l; for (var p = null, c = l + 1; c < this.Ke.length && null === p; c++) void 0 !== this.Ke[c] && (p = this.Ke[c]); this.et.insertBefore(u, p), this.Ke[l] = u, this.Ze[l] = [] } if (void 0 === this.Ze[l][s]) { var h = document.createElement("div"); h.className = "an an" + s; for (var u = this.Ke[l], p = null, d = s + 1; d < this.Ze[l].length && null === p; d++) void 0 !== this.Ze[l][d] && (p = this.Ze[l][d]); u.insertBefore(h, p), this.Ze[l][s] = h } this.Ze[l][s].appendChild(n); var _ = n.getElementsByTagName("style")[0]; if (void 0 !== _) { var g = _.sheet; 0 === g.cssRules.length && (g.cssText = _.textContent) } this.$e.set(e, n) } }, r.prototype.Fe = function() { t.prototype.Fe.call(this), this.nt(), this.et.style.display = "", this.et.classList.remove("paused") }, r.prototype.Me = function() { var e = this, r = this.clock.currentTime; this.$e.forEach(function(t, n) { (n.start > r || n.end < r || n.containsTransformTag) && (e.$e.delete(n), e.st(t)) }), t.prototype.Me.call(this) }, r.prototype.Re = function() { t.prototype.Re.call(this), this.et.classList.add("paused") }, r.prototype.Ne = function() { t.prototype.Ne.call(this), this.et.style.display = "none" }, r.prototype.We = function() { t.prototype.We.call(this), this.Qe.clear() }, r.prototype.xe = function() { this.be("ready", []) }, r.prototype.rt = function(e, t) { var r = this; return t.then(function() { var t = r.tt.cloneNode(!0); return r.He.appendChild(t), y.lastly(a.calculateFontMetrics(e, r.settings.fallbackFonts, t), function() { r.He.removeChild(t) }) }) }, r.prototype.st = function(e) { e.parentNode.removeChild(e) }, r.prototype.nt = function() { var e = this; this.$e.forEach(function(t) { return e.st(t) }), this.$e.clear() }, r.lt = [null, [0, 100], [50, 100], [100, 100], [0, 50], [50, 50], [100, 50], [0, 0], [50, 0], [100, 0] ], r }(p.NullRenderer); t.WebRenderer = b, g.mixin(b, [u.EventSource]) }, function(e, t) { var r = t(19), n = function() { function e(e, t, r, n, i, o, a, l) { this.ot = r, this.at = n, this.De = i, this.tt = o, this.ut = a, this.Je = l, this.pt = 0, this.Ae = e.id + "-" + t.id, this.ct = t.style, this.reset(null) } return e.prototype.reset = function(e) { (void 0 === e || null === e) && (e = this.ct), this.italic = e.italic, this.bold = e.bold, this.underline = e.underline, this.strikeThrough = e.strikeThrough, this.outlineWidth = e.outlineThickness, this.outlineHeight = e.outlineThickness, this.shadowDepthX = e.shadowDepth, this.shadowDepthY = e.shadowDepth, this.fontName = e.fontName, this.fontSize = e.fontSize, this.fontScaleX = e.fontScaleX, this.fontScaleY = e.fontScaleY, this.letterSpacing = e.letterSpacing, this.ht = null, this.ft = null, this.dt = e.rotationZ, this._t = null, this.gt = null, this.primaryColor = e.primaryColor, this.secondaryColor = e.secondaryColor, this.outlineColor = e.outlineColor, this.shadowColor = e.shadowColor, this.primaryAlpha = e.primaryColor.alpha, this.secondaryAlpha = e.secondaryColor.alpha, this.outlineAlpha = e.outlineColor.alpha, this.shadowAlpha = e.shadowColor.alpha, this.blur = null, this.gaussianBlur = null }, e.prototype.setStylesOnSpan = function(t, n) { var i = t.childNodes[0] instanceof Text, o = ""; this.vt && (o += "italic "), this.yt === !0 ? o += "bold " : this.yt !== !1 && (o += this.yt + " "); var a = (this.at * r.fontSizeForLineHeight(this.mt, this.bt * (i ? this.wt : 1), this.De.fallbackFonts, this.tt, this.Je)).toFixed(3), l = (this.at * this.bt).toFixed(3), s = this.mt; switch (s) { case "cursive": case "fantasy": case "monospace": case "sans-serif": case "serif": break; default: s = '"' + s + '"' } "" !== this.De.fallbackFonts && (s += ", " + this.De.fallbackFonts), t.style.font = "" + o + a + "px/" + l + "px " + s; var u = ""; this.St && (u = "underline"), this.Ot && (u += " line-through"), t.style.textDecoration = u.trim(); var p = ""; if (i ? this.Pt !== this.wt && (p += "scaleY(" + (this.Pt / this.wt).toFixed(3) + ") ") : (1 !== this.wt && (p += "scaleX(" + this.wt + ") "), 1 !== this.Pt && (p += "scaleY(" + this.Pt + ") ")), null !== this.ft && (p += "rotateY(" + this.ft + "deg) "), null !== this.ht && (p += "rotateX(" + this.ht + "deg) "), 0 !== this.dt && (p += "rotateZ(" + -1 * this.dt + "deg) "), null !== this._t || null !== this.gt) { var c = e.Ct(this._t, 0), h = e.Ct(this.gt, 0); p += "matrix(1, " + h + ", " + c + ", 1, 0, 0) " } "" !== p && (t.style.webkitTransform = p, t.style.webkitTransformOrigin = "50% 50%", t.style.transform = p, t.style.transformOrigin = "50% 50%", t.style.display = "inline-block"), t.style.letterSpacing = (this.ot * this.kt).toFixed(3) + "px"; var f = this.ot * this.Et, d = this.at * this.xt, _ = document.createElement("span"); _.appendChild(t); var g = this.jt.withAlpha(this.At), v = this.Tt.withAlpha(this.Dt), y = this.Ft.withAlpha(this.Mt); if (this.De.enableSvg || (0 !== f || 0 !== d) && v.alpha !== g.alpha || (0 !== this.Rt || 0 !== this.Nt) && y.alpha !== g.alpha || (g = this.jt.withAlpha(1), v = this.Tt.withAlpha(1), y = this.Ft.withAlpha(1), t.style.opacity = this.At.toFixed(3)), t.style.color = g.toString(), this.De.enableSvg ? this.Wt(_, f, d, v, this.At) : this.Lt(t, f, d, v), 0 !== this.Rt || 0 !== this.Nt) { var m = y.toString() + " " + (this.Rt * this.ot).toFixed(3) + "px " + (this.Nt * this.at).toFixed(3) + "px 0px"; "" === t.style.textShadow ? t.style.textShadow = m : t.style.textShadow += ", " + m } return (0 !== this.ht || 0 !== this.ft) && (_.style.display = "inline-block"), t.style.webkitAnimation = n.animationStyle, t.style.animation = n.animationStyle, _ }, e.prototype.Wt = function(e, t, r, n, i) { var o = "svg-filter-" + this.Ae + "-" + this.pt++, a = document.createElementNS("http://www.w3.org/2000/svg", "filter"); if (a.id = o, a.x.baseVal.valueAsString = "-50%", a.width.baseVal.valueAsString = "200%", a.y.baseVal.valueAsString = "-50%", a.height.baseVal.valueAsString = "200%", t > 0 || r > 0) { var l = 0, s = !this.De.preciseOutlines && this.It > 0 ? this.It : 1; ! function(e) { if (r >= t) if (t > 0) { var n; for (n = 0; t >= n; n += s) e(n, r / t * Math.sqrt(t * t - n * n)); n !== t + s && e(t, 0) } else e(0, r); else if (r > 0) { var i; for (i = 0; r >= i; i += s) e(t / r * Math.sqrt(r * r - i * i), i); i !== r + s && e(0, r) } else e(t, 0) }(function(e, t) { var r = document.createElementNS("http://www.w3.org/2000/svg", "feMorphology"); a.appendChild(r), r.in1.baseVal = "source", r.operator.baseVal = SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_DILATE, r.radiusX.baseVal = e, r.radiusY.baseVal = t, r.result.baseVal = "outline" + l, l++ }); var u = document.createElementNS("http://www.w3.org/2000/svg", "feComponentTransfer"); a.insertBefore(u, a.firstElementChild), u.in1.baseVal = "SourceAlpha", u.result.baseVal = "source"; var p = document.createElementNS("http://www.w3.org/2000/svg", "feFuncA"); u.appendChild(p), p.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR, p.slope.baseVal = 0 === i ? 1 : 1 / i, p.intercept.baseVal = 0; var c = document.createElementNS("http://www.w3.org/2000/svg", "feMerge"); a.appendChild(c); for (var h = 0; l > h; h++) { var f = document.createElementNS("http://www.w3.org/2000/svg", "feMergeNode"); c.appendChild(f), f.in1.baseVal = "outline" + h } var d = document.createElementNS("http://www.w3.org/2000/svg", "feComponentTransfer"); a.appendChild(d), d.setAttribute("color-interpolation-filters", "sRGB"); var _ = document.createElementNS("http://www.w3.org/2000/svg", "feFuncR"); d.appendChild(_), _.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR, _.slope.baseVal = 0, _.intercept.baseVal = n.red / 255 * n.alpha; var g = document.createElementNS("http://www.w3.org/2000/svg", "feFuncG"); d.appendChild(g), g.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR, g.slope.baseVal = 0, g.intercept.baseVal = n.green / 255 * n.alpha; var v = document.createElementNS("http://www.w3.org/2000/svg", "feFuncB"); d.appendChild(v), v.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR, v.slope.baseVal = 0, v.intercept.baseVal = n.blue / 255 * n.alpha; var y = document.createElementNS("http://www.w3.org/2000/svg", "feFuncA"); if (d.appendChild(y), y.type.baseVal = SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR, y.slope.baseVal = n.alpha, y.intercept.baseVal = 0, this.It > 0) { var m = document.createElementNS("http://www.w3.org/2000/svg", "feGaussianBlur"); a.appendChild(m), m.stdDeviationX.baseVal = this.It, m.stdDeviationY.baseVal = this.It } for (var h = 0; h < this.Xt; h++) { var b = document.createElementNS("http://www.w3.org/2000/svg", "feConvolveMatrix"); a.appendChild(b), b.setAttribute("kernelMatrix", "1 2 1 2 4 2 1 2 1"), b.edgeMode.baseVal = SVGFEConvolveMatrixElement.SVG_EDGEMODE_NONE } var w = document.createElementNS("http://www.w3.org/2000/svg", "feComposite"); a.appendChild(w), w.in2.baseVal = "source", w.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_OUT; var S = document.createElementNS("http://www.w3.org/2000/svg", "feMerge"); a.appendChild(S); var O = document.createElementNS("http://www.w3.org/2000/svg", "feMergeNode"); S.appendChild(O); var P = document.createElementNS("http://www.w3.org/2000/svg", "feMergeNode"); S.appendChild(P), P.in1.baseVal = "SourceGraphic" } else { if (this.It > 0) { var m = document.createElementNS("http://www.w3.org/2000/svg", "feGaussianBlur"); a.appendChild(m), m.stdDeviationX.baseVal = this.It, m.stdDeviationY.baseVal = this.It } for (var h = 0; h < this.Xt; h++) { var b = document.createElementNS("http://www.w3.org/2000/svg", "feConvolveMatrix"); a.appendChild(b), b.setAttribute("kernelMatrix", "1 2 1 2 4 2 1 2 1"), b.edgeMode.baseVal = SVGFEConvolveMatrixElement.SVG_EDGEMODE_NONE } } a.childElementCount > 0 && (this.ut.appendChild(a), e.style.webkitFilter = 'url("#' + o + '")', e.style.filter = 'url("#' + o + '")') }, e.prototype.Lt = function(e, t, r, n) { var i = this; if (t > 0 || r > 0) { var o = ""; ! function(e) { for (var n = 0; t >= n; n++) for (var i = 0 === t ? r : r * Math.sqrt(1 - n * n / (t * t)), o = 0; i >= o; o++) e(n, o), 0 !== n && e(-n, o), 0 !== o && e(n, -o), 0 !== n && 0 !== o && e(-n, -o) }(function(e, t) { o += ", " + n.toString() + " " + e + "px " + t + "px " + i.It.toFixed(3) + "px" }), e.style.textShadow = o.substr(", ".length) } }, e.prototype.makeNewLine = function() { var e = document.createElement("br"); return e.style.lineHeight = (this.at * this.bt).toFixed(3) + "px", e }, Object.defineProperty(e.prototype, "italic", { set: function(t) { this.vt = e.Ct(t, this.ct.italic) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "bold", { set: function(t) { this.yt = e.Ct(t, this.ct.bold) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "underline", { set: function(t) { this.St = e.Ct(t, this.ct.underline) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "strikeThrough", { set: function(t) { this.Ot = e.Ct(t, this.ct.strikeThrough) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "outlineWidth", { get: function() { return this.Et }, set: function(t) { this.Et = e.Ct(t, this.ct.outlineThickness) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "outlineHeight", { get: function() { return this.Et }, set: function(t) { this.xt = e.Ct(t, this.ct.outlineThickness) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowDepthX", { get: function() { return this.Rt }, set: function(t) { this.Rt = e.Ct(t, this.ct.shadowDepth) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowDepthY", { get: function() { return this.Nt }, set: function(t) { this.Nt = e.Ct(t, this.ct.shadowDepth) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "blur", { get: function() { return this.Xt }, set: function(t) { this.Xt = e.Ct(t, 0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "gaussianBlur", { get: function() { return this.It }, set: function(t) { this.It = e.Ct(t, 0) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontName", { set: function(t) { this.mt = e.Ct(t, this.ct.fontName) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontSize", { get: function() { return this.bt }, set: function(t) { this.bt = e.Ct(t, this.ct.fontSize) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontScaleX", { get: function() { return this.wt }, set: function(t) { this.wt = e.Ct(t, this.ct.fontScaleX) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontScaleY", { get: function() { return this.Pt }, set: function(t) { this.Pt = e.Ct(t, this.ct.fontScaleY) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "letterSpacing", { get: function() { return this.kt }, set: function(t) { this.kt = e.Ct(t, this.ct.letterSpacing) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rotationX", { get: function() { return this.ht }, set: function(e) { this.ht = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rotationY", { get: function() { return this.ft }, set: function(e) { this.ft = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rotationZ", { get: function() { return this.dt }, set: function(t) { this.dt = e.Ct(t, this.ct.rotationZ) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "skewX", { get: function() { return this._t }, set: function(e) { this._t = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "skewY", { get: function() { return this.gt }, set: function(e) { this.gt = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "primaryColor", { get: function() { return this.jt }, set: function(t) { this.jt = e.Ct(t, this.ct.primaryColor) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "secondaryColor", { get: function() { return this.Yt }, set: function(t) { this.Yt = e.Ct(t, this.ct.secondaryColor) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "outlineColor", { get: function() { return this.Tt }, set: function(t) { this.Tt = e.Ct(t, this.ct.outlineColor) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowColor", { get: function() { return this.Ft }, set: function(t) { this.Ft = e.Ct(t, this.ct.shadowColor) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "primaryAlpha", { get: function() { return this.At }, set: function(t) { this.At = e.Ct(t, this.ct.primaryColor.alpha) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "secondaryAlpha", { get: function() { return this.Vt }, set: function(t) { this.Vt = e.Ct(t, this.ct.secondaryColor.alpha) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "outlineAlpha", { get: function() { return this.Dt }, set: function(t) { this.Dt = e.Ct(t, this.ct.outlineColor.alpha) }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowAlpha", { get: function() { return this.Mt }, set: function(t) { this.Mt = e.Ct(t, this.ct.shadowColor.alpha) }, enumerable: !0, configurable: !0 }), e.Ct = function(e, t) { return null !== e ? e : t }, e }(); e.SpanStyles = n }, function(e) { function t(t) { e.debugMode = t } function r(t) { e.verboseMode = t } e.debugMode = !1, e.verboseMode = !1, e.setDebugMode = t, e.setVerboseMode = r }, function(t, r) { var n = r(26), i = r(29), o = r(28), a = r(27), l = r(23), s = r(1), u = r(2), p = r(30), c = r(32), h = function() { function t() { if (this.Ue = new o.ScriptProperties, this.Bt = new p.Map, this.zt = [], this.Gt = [], this.qt = null, this.Ut = null, 1 === arguments.length) throw new Error("Constructor `new ASS(rawASS)` has been deprecated. Use `ASS.fromString(rawASS)` instead."); this.Bt.set("Default", new i.Style(new p.Map([ ["Name", "Default"] ]))) } return Object.defineProperty(t.prototype, "properties", { get: function() { return this.Ue }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "styles", { get: function() { return this.Bt }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dialogues", { get: function() { return this.zt }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "attachments", { get: function() { return this.Gt }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "stylesFormatSpecifier", { get: function() { return this.qt }, set: function(e) { this.qt = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(t.prototype, "dialoguesFormatSpecifier", { get: function() { return this.Ut }, set: function(e) { this.Ut = e }, enumerable: !0, configurable: !0 }), t.prototype.addStyle = function(e) { var t = u.parseLineIntoTypedTemplate(e, this.qt); if (null !== t && "Style" === t.type) { var r = t.template; if (l.verboseMode) { var n = ""; r.forEach(function(e, t) { return n += t + " = " + e + ", " }), console.log("Read style: " + n) } var o = new i.Style(r); this.Bt.set(o.name, o) } }, t.prototype.addEvent = function(e) { var t = u.parseLineIntoTypedTemplate(e, this.Ut); if (null !== t && "Dialogue" === t.type) { var r = t.template; if (l.verboseMode) { var i = ""; r.forEach(function(e, t) { return i += t + " = " + e + ", " }), console.log("Read dialogue: " + i) } this.dialogues.push(new n.Dialogue(r, this)) } }, t.prototype.addAttachment = function(e) { this.Gt.push(e) }, t.fromString = function(e, r) { return void 0 === r && (r = a.Format.ASS), t.fromStream(new s.StringStream(e), r) }, t.fromStream = function(e, t) { switch (void 0 === t && (t = a.Format.ASS), t) { case a.Format.ASS: return new s.StreamParser(e).ass; case a.Format.SRT: return new s.SrtStreamParser(e).ass; default: throw new Error("Illegal value of type: " + t) } }, t.fromUrl = function(r, n) { void 0 === n && (n = a.Format.ASS); var i; return i = "function" == typeof e.fetch && "function" == typeof e.ReadableStream && "function" == typeof e.ReadableStream.prototype.getReader && "function" == typeof e.TextDecoder ? e.fetch(r).then(function(e) { if (e.ok === !1 || void 0 === e.ok && (e.status < 200 || e.status > 299)) throw new Error("HTTP request for " + r + " failed with status code " + e.status); return t.fromReadableStream(e.body, "utf-8", n) }) : c.Promise.reject(new Error("Not supported.")), i.catch(function(e) { console.warn("fetch() failed, falling back to XHR: %o", e); var i = new XMLHttpRequest, o = t.fromStream(new s.XhrStream(i), n); return i.open("GET", r, !0), i.send(), o }) }, t.fromReadableStream = function(e, r, n) { return void 0 === r && (r = "utf-8"), void 0 === n && (n = a.Format.ASS), t.fromStream(new s.BrowserReadableStream(e, r), n) }, t }(); t.ASS = h }, function(e) { ! function(e) { e[e.Font = 0] = "Font", e[e.Graphic = 1] = "Graphic" }(e.AttachmentType || (e.AttachmentType = {})); var t = function() { function e(e, t) { this.Ht = e, this.Kt = t, this.Zt = "" } return Object.defineProperty(e.prototype, "filename", { get: function() { return this.Ht }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "type", { get: function() { return this.Kt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "contents", { get: function() { return this.Zt }, set: function(e) { this.Zt = e }, enumerable: !0, configurable: !0 }), e }(); e.Attachment = t }, function(e, t) { var r = t(27), n = t(3), i = t(8), o = t(23), a = t(30), l = function() { function e(t, n) { this.Jt = null, this.$t = !1; var i = new a.Map; t.forEach(function(e, t) { i.set(t.toLowerCase(), e) }), t = i, this.Ae = ++e.Qt; var l = t.get("style"); if (void 0 !== l && null !== l && l.constructor === String && (l = l.replace(/^\*+/, ""), null !== l.match(/^Default$/i) && (l = "Default")), this.Le = n.styles.get(l), void 0 === this.Le && (o.debugMode && console.warn("Unrecognized style " + l + '. Falling back to "Default"'), this.Le = n.styles.get("Default")), void 0 === this.Le) throw new Error("Unrecognized style " + l); if (this.s = e.er(t.get("start")), this.u = e.er(t.get("end")), this.tr = Math.max(r.valueOrDefault(t, "layer", parseInt, function(e) { return !isNaN(e) }, "0"), 0), this.rr = t.get("text"), void 0 === this.rr || null === this.rr || this.rr.constructor !== String) throw new Error("Dialogue doesn't have any text.") } return Object.defineProperty(e.prototype, "id", { get: function() { return this.Ae }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "start", { get: function() { return this.s }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "end", { get: function() { return this.u }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "style", { get: function() { return this.Le }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "alignment", { get: function() { return null === this.Jt && this.nr(), this.ir }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "layer", { get: function() { return this.tr }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "parts", { get: function() { return null === this.Jt && this.nr(), this.Jt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "containsTransformTag", { get: function() { return null === this.Jt && this.nr(), this.$t }, enumerable: !0, configurable: !0 }), e.prototype.toString = function() { return "#" + this.Ae + " [" + this.s.toFixed(3) + "-" + this.u.toFixed(3) + "] " + (null !== this.Jt ? this.Jt.join(", ") : this.rr) }, e.prototype.nr = function() { var e = this; if (this.Jt = n.parse(this.rr, "dialogueParts"), this.ir = this.Le.alignment, this.Jt.forEach(function(t, r) { t instanceof i.Alignment ? e.ir = t.value : t instanceof i.Move ? (null === t.t1 || null === t.t2) && (e.Jt[r] = new i.Move(t.x1, t.y1, t.x2, t.y2, 0, e.u - e.s)) : t instanceof i.Transform && ((null === t.start || null === t.end || null === t.accel) && (e.Jt[r] = new i.Transform(null === t.start ? 0 : t.start, null === t.end ? e.u - e.s : t.end, null === t.accel ? 1 : t.accel, t.tags)), e.$t = !0) }), o.debugMode) { var t = this.Jt.filter(function(e) { return e instanceof i.Comment && -1 !== e.value.indexOf("\\") }); t.length > 0 && console.warn("Possible incorrect parse:\n" + this.rr + "\nwas parsed as\n" + this.toString() + "\nThe possibly incorrect parses are:\n" + t.join("\n")) } }, e.er = function(e) { return e.split(":").reduce(function(e, t) { return 60 * e + parseFloat(t) }, 0) }, e.Qt = -1, e }(); e.Dialogue = l }, function(e) { function t(e, t, r, n, i) { var o = e.get(t); if (void 0 === o) return r(i); try { var a = r(o); if (null !== n && !n(a)) throw new Error("Validation failed."); return a } catch (e) { throw new Error("Property " + t + " has invalid value " + o + " - " + e.stack) } }! function(e) { e[e.ASS = 0] = "ASS", e[e.SRT = 1] = "SRT" }(e.Format || (e.Format = {})), function(e) { e[e.SmartWrappingWithWiderTopLine = 0] = "SmartWrappingWithWiderTopLine", e[e.SmartWrappingWithWiderBottomLine = 3] = "SmartWrappingWithWiderBottomLine", e[e.EndOfLineWrapping = 1] = "EndOfLineWrapping", e[e.NoLineWrapping = 2] = "NoLineWrapping" }(e.WrappingStyle || (e.WrappingStyle = {})), function(e) { e[e.Outline = 1] = "Outline", e[e.OpaqueBox = 3] = "OpaqueBox" }(e.BorderStyle || (e.BorderStyle = {})), e.valueOrDefault = t }, function(e) { var t = function() { function e() {} return Object.defineProperty(e.prototype, "resolutionX", { get: function() { return this.or }, set: function(e) { this.or = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "resolutionY", { get: function() { return this.ar }, set: function(e) { this.ar = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "wrappingStyle", { get: function() { return this.lr }, set: function(e) { this.lr = e }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "scaleBorderAndShadow", { get: function() { return this.sr }, set: function(e) { this.sr = e }, enumerable: !0, configurable: !0 }), e }(); e.ScriptProperties = t }, function(e, t) { var r = t(27), n = t(3), i = t(30), o = function() { function e(e) { var t = new i.Map; if (e.forEach(function(e, r) { t.set(r.toLowerCase(), e) }), e = t, this.ur = e.get("name"), void 0 === this.ur || null === this.ur || this.ur.constructor !== String) throw new Error("Style doesn't have a name."); this.ur = this.ur.replace(/^\*+/, ""), this.vt = !!r.valueOrDefault(e, "italic", parseFloat, function(e) { return !isNaN(e) }, "0"), this.yt = !!r.valueOrDefault(e, "bold", parseFloat, function(e) { return !isNaN(e) }, "0"), this.St = !!r.valueOrDefault(e, "underline", parseFloat, function(e) { return !isNaN(e) }, "0"), this.Ot = !!r.valueOrDefault(e, "strikeout", parseFloat, function(e) { return !isNaN(e) }, "0"), this.mt = r.valueOrDefault(e, "fontname", function(e) { return e }, function(e) { return e.constructor === String }, "sans-serif"), this.bt = r.valueOrDefault(e, "fontsize", parseFloat, function(e) { return !isNaN(e) }, "18"), this.wt = r.valueOrDefault(e, "scalex", parseFloat, function(e) { return e >= 0 }, "100") / 100, this.Pt = r.valueOrDefault(e, "scaley", parseFloat, function(e) { return e >= 0 }, "100") / 100, this.kt = r.valueOrDefault(e, "spacing", parseFloat, function(e) { return e >= 0 }, "0"), this.dt = r.valueOrDefault(e, "angle", parseFloat, function(e) { return !isNaN(e) }, "0"), this.jt = r.valueOrDefault(e, "primarycolour", function(e) { return n.parse(e, "colorWithAlpha") }, null, "&H00FFFFFF"), this.Yt = r.valueOrDefault(e, "secondarycolour", function(e) { return n.parse(e, "colorWithAlpha") }, null, "&H00FFFF00"), this.Tt = r.valueOrDefault(e, "outlinecolour", function(e) { return n.parse(e, "colorWithAlpha") }, null, "&H00000000"), this.Ft = r.valueOrDefault(e, "backcolour", function(e) { return n.parse(e, "colorWithAlpha") }, null, "&H80000000"), this.pr = r.valueOrDefault(e, "outline", parseFloat, function(e) { return e >= 0 }, "2"), this.cr = r.valueOrDefault(e, "borderstyle", parseInt, function(e) { return r.BorderStyle[r.BorderStyle[e]] === e }, "1"), this.hr = r.valueOrDefault(e, "shadow", parseFloat, function(e) { return e >= 0 }, "3"), this.ir = r.valueOrDefault(e, "alignment", parseInt, function(e) { return e >= 1 && 9 >= e }, "2"), this.fr = r.valueOrDefault(e, "marginl", parseFloat, function(e) { return !isNaN(e) }, "20"), this.dr = r.valueOrDefault(e, "marginr", parseFloat, function(e) { return !isNaN(e) }, "20"), this._r = r.valueOrDefault(e, "marginv", parseFloat, function(e) { return !isNaN(e) }, "20") } return Object.defineProperty(e.prototype, "name", { get: function() { return this.ur }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "italic", { get: function() { return this.vt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "bold", { get: function() { return this.yt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "underline", { get: function() { return this.St }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "strikeThrough", { get: function() { return this.Ot }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontName", { get: function() { return this.mt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontSize", { get: function() { return this.bt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontScaleX", { get: function() { return this.wt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "fontScaleY", { get: function() { return this.Pt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "letterSpacing", { get: function() { return this.kt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "rotationZ", { get: function() { return this.dt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "primaryColor", { get: function() { return this.jt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "secondaryColor", { get: function() { return this.Yt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "outlineColor", { get: function() { return this.Tt }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowColor", { get: function() { return this.Ft }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "outlineThickness", { get: function() { return this.pr }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "borderStyle", { get: function() { return this.cr }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "shadowDepth", { get: function() { return this.hr }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "alignment", { get: function() { return this.ir }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "marginLeft", { get: function() { return this.fr }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "marginRight", { get: function() { return this.dr }, enumerable: !0, configurable: !0 }), Object.defineProperty(e.prototype, "marginVertical", { get: function() { return this._r }, enumerable: !0, configurable: !0 }), e }(); e.Style = o }, function(t) { function r(e) { null !== e ? t.Map = e : t.Map = n } t.Map = e.Map; var n = function() { function e(e) { if (this.clear(), void 0 !== e) { if (!Array.isArray(e)) throw new Error("Non-array iterables are not supported by the SimpleMap constructor."); for (var t = 0; t < e.length; t++) { var r = e[t]; this.set(r[0], r[1]) } } } return e.prototype.get = function(e) { var t = this.gr(e); if (null !== t) return this.vr[t] }, e.prototype.has = function(e) { var t = this.gr(e); return null === t ? !1 : t in this.yr }, e.prototype.set = function(e, t) { var r = this.gr(e); if (null === r) throw new Error("This Map implementation only supports Number and String keys, or keys with an id property."); return r in this.yr || this.mr++, this.yr[r] = e, this.vr[r] = t, this }, e.prototype.delete = function(e) { var t = this.gr(e); if (null === t) return !1; var r = t in this.yr; return r && (delete this.yr[t], delete this.vr[t], this.mr--), r }, e.prototype.clear = function() { this.yr = Object.create(null), this.vr = Object.create(null), this.mr = 0 }, e.prototype.forEach = function(e, t) { for (var r = 0, n = Object.keys(this.yr); r < n.length; r++) { var i = n[r]; e.call(t, this.vr[i], this.yr[i], this) } }, Object.defineProperty(e.prototype, "size", { get: function() { return this.mr }, enumerable: !0, configurable: !0 }), e.prototype.gr = function(e) { return "number" == typeof e ? "#" + e : "string" == typeof e ? "'" + e : void 0 !== e.id ? "!" + e.id : null }, e }(); (void 0 === t.Map || "function" != typeof t.Map.prototype.forEach || function() { try { return 2 !== new t.Map([ [1, "foo"], [2, "bar"] ]).size } catch (e) { return !0 } }()) && (t.Map = n), t.setImplementation = r }, function(e) { function t(e, t) { for (var r = 0; r < t.length; r++) for (var n = t[r], i = 0, o = Object.getOwnPropertyNames(n.prototype); i < o.length; i++) { var a = o[i]; e.prototype[a] = n.prototype[a] } } e.mixin = t }, function(t) { function r(e) { null !== e ? t.Promise = e : t.Promise = s } function n(e) { return i(e, []) } function i(e, r) { if (0 === e.length) return t.Promise.reject(r); var n = e[0], o = e.slice(1); return n.catch(function(e) { return i(o, r.concat(e)) }) } function o(e) { return new t.Promise(function(r, n) { return t.Promise.all(e.map(function(e) { return e.then(r, function(e) { return e }) })).then(n) }) } function a(e, t) { return e.then(function(e) { return t(), e }, function(e) { throw t(), e }) } t.Promise = e.Promise; var l = function() { var t = e.MutationObserver || e.WebkitMutationObserver; if (void 0 !== e.process && "function" == typeof e.process.nextTick) return function(t) { e.process.nextTick(t) }; if (void 0 !== t) { var r = [], n = !1, i = document.createElement("div"), o = new t(function() { for (var e = r.splice(0, r.length), t = 0; t < e.length; t++) { var o = e[t]; o() } n = !1, r.length > 0 && (i.classList.toggle("foo"), n = !0) }); return o.observe(i, { attributes: !0 }), function(e) { r.push(e), n || (i.classList.toggle("foo"), n = !0) } } return function(e) { return setTimeout(e, 0) } }(), s = function() { function e(e) { if (this.br = u.PENDING, this.wr = [], this.Sr = [], this.Or = null, this.Pr = null, "function" != typeof e) throw new TypeError('typeof executor !== "function"'); var t = this.Cr(), r = t.resolve, n = t.reject; try { e(r, n) } catch (e) { n(e) } } return e.prototype.then = function(e, t) { var r = new p; "function" != typeof e && (e = function(e) { return e }), "function" != typeof t && (t = function(e) { throw e }); var n = { capabilities: r, handler: e }, i = { capabilities: r, handler: t }; switch (this.br) { case u.PENDING: this.wr.push(n), this.Sr.push(i); break; case u.FULFILLED: this.kr(n, this.Or); break; case u.REJECTED: this.Er(i, this.Pr) } return r.promise }, e.prototype.catch = function(e) { return this.then(null, e) }, e.resolve = function(r) { return r instanceof e ? r : new t.Promise(function(e) { return e(r) }) }, e.reject = function(e) { return new t.Promise(function(t, r) { return r(e) }) }, e.all = function(e) { return new t.Promise(function(r, n) { var i = [], o = e.length; return 0 === o ? void r(i) : void e.forEach(function(e, a) { return t.Promise.resolve(e).then(function(e) { i[a] = e, o--, 0 === o && r(i) }, n) }) }) }, e.race = function(e) { return new t.Promise(function(r, n) { for (var i = 0; i < e.length; i++) { var o = e[i]; t.Promise.resolve(o).then(r, n) } }) }, e.prototype.Cr = function() { var e = this, t = !1, r = function(r) { if (!t) { if (t = !0, r === e) return void e.xr(new TypeError("resolution === this")); if (null === r || "object" != typeof r && "function" != typeof r) return void e.jr(r); try { var n = r.then } catch (t) { return void e.xr(t) } return "function" != typeof n ? void e.jr(r) : void l(function() { return e.Ar(r, n) }) } }, n = function(r) { t || (t = !0, e.xr(r)) }; return { resolve: r, reject: n } }, e.prototype.Ar = function(e, t) { var r = this.Cr(), n = r.resolve, i = r.reject; try { t.call(e, n, i) } catch (e) { i(e) } }, e.prototype.jr = function(e) { var t = this.wr; this.Or = e, this.wr = void 0, this.Sr = void 0, this.br = u.FULFILLED; for (var r = 0; r < t.length; r++) { var n = t[r]; this.kr(n, e) } }, e.prototype.xr = function(e) { var t = this.Sr; this.Pr = e, this.wr = void 0, this.Sr = void 0, this.br = u.REJECTED; for (var r = 0; r < t.length; r++) { var n = t[r]; this.Er(n, e) } }, e.prototype.kr = function(e, t) { l(function() { var r, n = e.capabilities, i = n.resolve, o = n.reject, a = e.handler; try { r = a(t) } catch (e) { return void o(e) } i(r) }) }, e.prototype.Er = function(e, t) { l(function() { var r, n = e.capabilities, i = n.resolve, o = n.reject, a = e.handler; try { r = a(t) } catch (e) { return void o(e) } i(r) }) }, e }(); void 0 === t.Promise && (t.Promise = s); var u; ! function(e) { e[e.PENDING = 0] = "PENDING", e[e.FULFILLED = 1] = "FULFILLED", e[e.REJECTED = 2] = "REJECTED" }(u || (u = {})), t.setImplementation = r; var p = function() { function e() { var e = this; this.Tr = new t.Promise(function(t, r) { Object.defineProperties(e, { resolve: { value: t, enumerable: !0 }, reject: { value: r, enumerable: !0 } }) }) } return Object.defineProperty(e.prototype, "promise", { get: function() { return this.Tr }, enumerable: !0, configurable: !0 }), e }(); t.DeferredPromise = p, t.first = n, t.any = o, t.lastly = a }, function(t) { function r(e) { null !== e ? t.Set = e : t.Set = n } t.Set = e.Set; var n = function() { function e(e) { if (this.clear(), void 0 !== e) { if (!Array.isArray(e)) throw new Error("Non-array iterables are not supported by the SimpleSet constructor."); for (var t = 0; t < e.length; t++) { var r = e[t]; this.add(r) } } } return e.prototype.add = function(e) { var t = this.Dr(e); if (null === t) throw new Error("This Set implementation only supports Number and String values."); return t in this.Fr || this.mr++, this.Fr[t] = e, this }, e.prototype.clear = function() { this.Fr = Object.create(null), this.mr = 0 }, e.prototype.has = function(e) { var t = this.Dr(e); return null === t ? !1 : t in this.Fr }, e.prototype.forEach = function(e, t) { for (var r = 0, n = Object.keys(this.Fr); r < n.length; r++) { var i = n[r], o = this.Fr[i]; e.call(t, o, o, this) } }, Object.defineProperty(e.prototype, "size", { get: function() { return this.mr }, enumerable: !0, configurable: !0 }), e.prototype.Dr = function(e) { return "number" == typeof e ? "#" + e : "string" == typeof e ? "'" + e : null }, e }(); (void 0 === t.Set || "function" != typeof t.Set.prototype.forEach || function() { try { return 2 !== new t.Set([1, 2]).size } catch (e) { return !0 } }()) && (t.Set = n), t.setImplementation = r }, function(e) { function t(e, t) { function r() { this.constructor = e } for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]); r.prototype = t.prototype, e.prototype = new r } function r(e, t, r) { return arguments.length < 3 ? n(e.reverse(), t) : void i(e.reverse(), t, r) } function n(e, t) { for (var r = 0; r < e.length; r++) { var n = e[r]; t = n(t) || t } return t } function i(e, t, r) { for (var n = 0; n < e.length; n++) { var i = e[n]; i(t, r) } } e.ke = t, e.L = r }, function(e, t) { var r = t(30), n = t(32), i = t(36), o = t(38), a = function() { function e(e) { var t = this; this.Mr = e, this.Rr = new r.Map, this.Mr.addEventListener("message", function(e) { return t.Nr(e.data) }, !1) } return e.prototype.request = function(t, r) { var i = new n.DeferredPromise, a = ++e.Wr; this.Rr.set(a, i); var l = { requestId: a, command: t, parameters: r }; return this.Mr.postMessage(o.serialize(l)), i.promise }, e.prototype.cancelRequest = function(e) { var t = this.Rr.get(e); void 0 !== t && (this.Rr.delete(e), t.reject(new Error("Cancelled."))) }, e.prototype.Lr = function(e) { var t = e.requestId, r = e.error, n = e.result; r instanceof Error && (r = { message: r.message, stack: r.stack }), this.Mr.postMessage(o.serialize({ command: i.WorkerCommands.Response, requestId: t, error: r, result: n })) }, e.prototype.Nr = function(e) { var t = this, r = o.deserialize(e); if (r.command === i.WorkerCommands.Response) { var n = r, a = this.Rr.get(n.requestId); void 0 !== a && (this.Rr.delete(n.requestId), null === n.error ? a.resolve(n.result) : a.reject(n.error)) } else { var l = r, s = l.requestId, u = o.getWorkerCommandHandler(l.command); if (void 0 === u) return void this.Lr({ requestId: s, error: new Error("No handler registered for command " + l.command), result: null }); u(l.parameters).then(function(e) { return { requestId: s, error: null, result: e } }, function(e) { return { requestId: s, error: e, result: null } }).then(function(e) { return t.Lr(e) }) } }, e.Wr = -1, e }(); e.WorkerChannelImpl = a, o.registerWorkerCommand(i.WorkerCommands.Ping, function() { return new n.Promise(function(e) { return e(null) }) }) }, function(e) { ! function(e) { e[e.Response = 0] = "Response", e[e.Parse = 1] = "Parse", e[e.Ping = 2] = "Ping" }(e.WorkerCommands || (e.WorkerCommands = {})) }, function(t, r) { function n(e) { return void 0 === e && (e = a.src), new i.WorkerChannelImpl(new Worker(e)) } var i = r(35), o = r(36); t.WorkerCommands = o.WorkerCommands, t.supported = "undefined" != typeof Worker; var a = "undefined" != typeof document && void 0 !== document.currentScript ? document.currentScript : null; t.createWorker = n, "undefined" != typeof WorkerGlobalScope && e instanceof WorkerGlobalScope && new i.WorkerChannelImpl(e) }, function(e, t) { function r(e, t) { s.set(e, t) } function n(e) { return s.get(e) } function i(e) { e.Ir = u.size, u.set(e.Ir, e) } function o(e) { return JSON.stringify(e, function(e, t) { return t && void 0 !== t.Ir && (t.Ir = t.Ir), t }) } function a(e) { return JSON.parse(e, function(e, t) { if (t && void 0 !== t.Ir) { for (var r = Object.create(u.get(t.Ir)), n = 0, i = Object.keys(t); n < i.length; n++) { var o = i[n]; "_classTag" !== o && (r[o] = t[o]) } t = r } return t }) } var l = t(30), s = new l.Map, u = new l.Map; e.registerWorkerCommand = r, e.getWorkerCommandHandler = n, e.registerClassPrototype = i, e.serialize = o, e.deserialize = a }]) }); //# sourceMappingURL=libjass.min.js.map