/**
 * 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 n=this;"function"==typeof define&&define.amd?define([],function(){return t(n)}):"object"==typeof exports&&"object"==typeof module?module.exports=t(n):"object"==typeof exports?exports.libjass=t(n):e.libjass=t(n)}(this,function(e){"use strict";return function(e){function t(r){if(n[r])return n[r];var i=n[r]=Object.create(null);return e[r](i,t),i}var n=Object.create(null);return t(0)}([function(e,t){var n=t(23),r=t(23);e.debugMode=r.debugMode,e.verboseMode=r.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 y=t(28);e.ScriptProperties=y.ScriptProperties;var v=t(29);e.Style=v.Style;var m=t(27);e.BorderStyle=m.BorderStyle,e.Format=m.Format,e.WrappingStyle=m.WrappingStyle,Object.defineProperties(e,{debugMode:{get:function(){return n.debugMode},set:n.setDebugMode},verboseMode:{get:function(){return n.verboseMode},set:n.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 n=t(3);e.parse=n.parse;var r=t(5);e.BrowserReadableStream=r.BrowserReadableStream,e.StringStream=r.StringStream,e.XhrStream=r.XhrStream;var i=t(4);e.StreamParser=i.StreamParser,e.SrtStreamParser=i.SrtStreamParser},function(e,t){function n(e){var t=e.indexOf(":");return-1===t?null:{name:e.substr(0,t),value:e.substr(t+1).replace(/^\s+/,"")}}function r(e,t){var r=n(e);if(null===r)return null;var o=r.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:r.name,template:a}}var i=t(30);e.parseLineIntoProperty=n,e.parseLineIntoTypedTemplate=r},function(e,t){function n(e,t){var n=new s(e,t);if(null===n.result||n.result.end!==e.length)throw o.debugMode&&console.error("Parse failed. %s %s %o",t,e,n.result),new Error("Parse failed.");return n.result.value}function r(e,t,n,r){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=n.call(o,a);if(null!==l)a.value=new t(l.value);else{if(r)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=n;var s=function(){function e(e,t){this.e=e,this.t=new h(null),this.n=l.get(t).call(this,this.t)}return Object.defineProperty(e.prototype,"result",{get:function(){return this.n},enumerable:!0,configurable:!0}),e.prototype.parse_dialogueParts=function(e){var t,r=new h(e);for(r.value=[];this.r();){var o=this.parse_enclosedTags(r);if(null!==o)(t=r.value).push.apply(t,o.value);else{var a=this.parse_newline(r)||this.parse_hardspace(r)||this.parse_text(r);if(null===a)return e.pop(),null;if(a.value instanceof i.Text&&r.value[r.value.length-1]instanceof i.Text){var l=r.value[r.value.length-1];r.value[r.value.length-1]=new i.Text(l.value+a.value.value)}else r.value.push(a.value)}}var s=!1;return r.value.forEach(function(e,t){e instanceof i.DrawingMode?s=0!==e.scale:e instanceof i.Text&&s&&(r.value[t]=new i.DrawingInstructions(n(e.value,"drawingInstructions")))}),r},e.prototype.parse_enclosedTags=function(e){var t=new h(e);if(t.value=[],null===this.read(t,"{"))return e.pop(),null;for(var n=this.i();this.r()&&"}"!==n;n=this.i()){var r=null;if(null!==this.read(t,"\\")&&null===(r=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))&&t.pop(),null===r&&(r=this.parse_comment(t)),null===r)return e.pop(),null;r.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+r.value.value):t.value.push(r.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(),n=new h(e),r=new h(n,t);return n.value=new i.Text(r.value),n},e.prototype.parse_comment=function(e){var t=this.i(),n=new h(e),r=new h(n,t);return n.value=new i.Comment(r.value),n},e.prototype.parse_tag_a=function(e){var t=new h(e);if(null===this.read(t,"a"))return e.pop(),null;var n=this.i();switch(n){case"1":var r=this.i(2);switch(r){case"10":case"11":n=r}break;case"2":case"3":case"5":case"6":case"7":case"9":break;default:return e.pop(),null}var o=new h(t,n),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 n=this.i();if(n<"1"||n>"9")return e.pop(),null;var r=new h(t,n);return t.value=new i.Alignment(parseInt(r.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 n=null,r=this.i();return r>="1"&&r<="9"&&(r=this.i(3),"00"===r.substr(1)&&(n=new h(t,r),n.value=parseInt(n.value))),null===n&&(n=this.parse_enableDisable(t)),t.value=null!==n?new i.Bold(n.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 n=this.parse_decimal(t);if(null===n)return e.pop(),null;if(null===this.read(t,","))return e.pop(),null;var r=this.parse_decimal(t);return null===r?(e.pop(),null):null===this.read(t,")")?(e.pop(),null):(t.value=new i.Fade(n.value/1e3,r.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 n=this.parse_decimal(t);if(null===n)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 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-n.value/255,1-r.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 n=new h(t,""),r=this.i();this.r()&&"\\"!==r&&"}"!==r;r=this.i())n.value+=r;return n.value.length>0?t.value=new i.FontName(n.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 n=this.parse_decimal(t);return null===n?(e.pop(),null):(t.value=new i.FontSizePlus(n.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 n=this.parse_decimal(t);return null===n?(e.pop(),null):(t.value=new i.FontSizeMinus(n.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 n=this.parse_decimal(t);return t.value=null!==n?new i.FontScaleX(n.value/100):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 n=this.parse_decimal(t);return t.value=null!==n?new i.FontScaleY(n.value/100):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 n=this.parse_decimal(t);return null===n?(e.pop(),null):(t.value=new i.ColorKaraoke(n.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 n=this.parse_decimal(t);return null===n?(e.pop(),null):(t.value=new i.SweepingColorKaraoke(n.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 n=this.parse_decimal(t);return null===n?(e.pop(),null):(t.value=new i.SweepingColorKaraoke(n.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 n=this.parse_decimal(t);return null===n?(e.pop(),null):(t.value=new i.OutlineKaraoke(n.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 n=this.parse_decimal(t);if(null===n)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 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(null===(l=this.parse_decimal(t)))return e.pop(),null;if(null===this.read(t,","))return e.pop(),null;if(null===(s=this.parse_decimal(t)))return e.pop(),null}return null===this.read(t,")")?(e.pop(),null):(t.value=new i.Move(n.value,r.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 n=this.parse_decimal(t);if(null===n)return e.pop(),null;if(null===this.read(t,","))return e.pop(),null;var r=this.parse_decimal(t);return null===r?(e.pop(),null):null===this.read(t,")")?(e.pop(),null):(t.value=new i.RotationOrigin(n.value,r.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 n=this.parse_decimal(t);if(null===n)return e.pop(),null;if(null===this.read(t,","))return e.pop(),null;var r=this.parse_decimal(t);return null===r?(e.pop(),null):null===this.read(t,")")?(e.pop(),null):(t.value=new i.Position(n.value,r.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 n=this.i();if(n<"0"||n>"3")return e.pop(),null;var r=new h(t,n);return t.value=new i.WrappingStyle(parseInt(r.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 n=new h(t,""),r=this.i();this.r()&&"\\"!==r&&"}"!==r;r=this.i())n.value+=r;return n.value.length>0?t.value=new i.Reset(n.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 n=null,r=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(n=a,r=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.r()&&")"!==p&&"}"!==p;p=this.i()){var c=null;if(null!==this.read(t,"\\")&&null===(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))&&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!==n?n.value/1e3:null,null!==r?r.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),n=null,r=[];for(t.value=[];this.r();){for(;null!==this.read(t," "););if(!this.r())break;if(null!==n){var o=this.parse_decimal(t);if(null!==o){r.push(o),"m"===n&&2===r.length?(t.value.push(new i.drawing.MoveInstruction(r[0].value,r[1].value)),r.splice(0,r.length)):"l"===n&&2===r.length?(t.value.push(new i.drawing.LineInstruction(r[0].value,r[1].value)),r.splice(0,r.length)):"b"===n&&6===r.length&&(t.value.push(new i.drawing.CubicBezierCurveInstruction(r[0].value,r[1].value,r[2].value,r[3].value,r[4].value,r[5].value)),r.splice(0,r.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":n=l,r.splice(0,r.length)}}for(;null!==this.read(t," "););return t},e.prototype.parse_decimalInt32=function(e){for(var t=new h(e),n=null!==this.read(t,"-"),r=new h(t,""),i=this.i();this.r()&&i>="0"&&i<="9";i=this.i())r.value+=i;if(0===r.value.length)return e.pop(),null;var o=parseInt(r.value);return o>=4294967295?o=4294967295:n&&(o=-o),t.value=o,t},e.prototype.parse_hexInt32=function(e){for(var t=new h(e),n=null!==this.read(t,"-"),r=new h(t,""),i=this.i();this.r()&&(i>="0"&&i<="9"||i>="a"&&i<="f"||i>="A"&&i<="F");i=this.i())r.value+=i;if(0===r.value.length)return e.pop(),null;var o=parseInt(r.value,16);return o>=4294967295?o=4294967295:n&&(o=-o),t.value=o,t},e.prototype.parse_decimalOrHexInt32=function(e){var t=new h(e),n=null!==this.read(t,"&H")||null!==this.read(t,"&h")?this.parse_hexInt32(t):this.parse_decimalInt32(t);return null===n?(e.pop(),null):(t.value=n.value,t)},e.prototype.parse_decimal=function(e){var t=new h(e),n=null!==this.read(t,"-"),r=this.parse_unsignedDecimal(t);return null===r?(e.pop(),null):(t.value=r.value,n&&(t.value=-t.value),t)},e.prototype.parse_unsignedDecimal=function(e){for(var t=new h(e),n=new h(t,""),r=null,i=this.i();this.r()&&i>="0"&&i<="9";i=this.i())n.value+=i;if(0===n.value.length)return e.pop(),null;if(null!==this.read(t,".")){r=new h(t,"");for(var i=this.i();this.r()&&i>="0"&&i<="9";i=this.i())r.value+=i;if(0===r.value.length)return e.pop(),null}return t.value=parseFloat(n.value+(null!==r?"."+r.value:"")),t},e.prototype.parse_enableDisable=function(e){var t=this.i();if("0"===t||"1"===t){var n=new h(e,t);return n.value="1"===n.value,n}return null},e.prototype.parse_color=function(e){for(var t=new h(e);null!==this.read(t,"&")||null!==this.read(t,"H"););var n=this.parse_hexInt32(t);if(null===n)return e.pop(),null;var r=n.value;for(t.value=new i.Color(255&r,r>>8&255,r>>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 n=this.parse_hexInt32(t);if(null===n)return e.pop(),null;var r=n.value;for(t.value=1-(255&r)/255;null!==this.read(t,"&")||null!==this.read(t,"H"););return t},e.prototype.parse_colorWithAlpha=function(e){var t=new h(e),n=this.parse_decimalOrHexInt32(t);if(null===n)return e.pop(),null;var r=n.value;return t.value=new i.Color(255&r,r>>8&255,r>>16&255,1-(r>>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.r=function(){return this.t.end<this.e.length},e.prototype.o=function(e,t){var r=new h(t);if(null===this.read(r,e))return t.pop(),null;if(null===this.read(r,"("))return t.pop(),null;var o=null,a=null,l=null,s=null,u=null,p=null,c=this.parse_decimal(r);if(null!==c){if(null===this.read(r,","))return t.pop(),null;var f=this.parse_decimal(r);null!==f?(o=c,l=f):u=c}if(null!==o&&null!==l){if(null===this.read(r,","))return t.pop(),null;if(a=this.parse_decimal(r),null===this.read(r,","))return t.pop(),null;s=this.parse_decimal(r),r.value=new i.RectangularClip(o.value,l.value,a.value,s.value,"clip"===e)}else{p=new h(r,"");for(var d=this.i();this.r()&&")"!==d&&"}"!==d;d=this.i())p.value+=d;r.value=new i.VectorClip(null!==u?u.value:1,n(p.value,"drawingInstructions"),"clip"===e)}return null===this.read(r,")")?(t.pop(),null):r},e}();r("alpha",i.Alpha,s.prototype.parse_alpha,!1),r("be",i.Blur,s.prototype.parse_decimal,!1),r("blur",i.GaussianBlur,s.prototype.parse_decimal,!1),r("bord",i.Border,s.prototype.parse_decimal,!1),r("c",i.PrimaryColor,s.prototype.parse_color,!1),r("fax",i.SkewX,s.prototype.parse_decimal,!1),r("fay",i.SkewY,s.prototype.parse_decimal,!1),r("fr",i.RotateZ,s.prototype.parse_decimal,!1),r("frx",i.RotateX,s.prototype.parse_decimal,!1),r("fry",i.RotateY,s.prototype.parse_decimal,!1),r("frz",i.RotateZ,s.prototype.parse_decimal,!1),r("fs",i.FontSize,s.prototype.parse_decimal,!1),r("fsp",i.LetterSpacing,s.prototype.parse_decimal,!1),r("i",i.Italic,s.prototype.parse_enableDisable,!1),r("p",i.DrawingMode,s.prototype.parse_decimal,!0),r("pbo",i.DrawingBaselineOffset,s.prototype.parse_decimal,!0),r("s",i.StrikeThrough,s.prototype.parse_enableDisable,!1),r("shad",i.Shadow,s.prototype.parse_decimal,!1),r("u",i.Underline,s.prototype.parse_enableDisable,!1),r("xbord",i.BorderX,s.prototype.parse_decimal,!1),r("xshad",i.ShadowX,s.prototype.parse_decimal,!1),r("ybord",i.BorderY,s.prototype.parse_decimal,!1),r("yshad",i.ShadowY,s.prototype.parse_decimal,!1),r("1a",i.PrimaryAlpha,s.prototype.parse_alpha,!1),r("1c",i.PrimaryColor,s.prototype.parse_color,!1),r("2a",i.SecondaryAlpha,s.prototype.parse_alpha,!1),r("2c",i.SecondaryColor,s.prototype.parse_color,!1),r("3a",i.OutlineAlpha,s.prototype.parse_alpha,!1),r("3c",i.OutlineColor,s.prototype.parse_color,!1),r("4a",i.ShadowAlpha,s.prototype.parse_alpha,!1),r("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(n(e.input,e.rule))})})},function(e,t){function n(e){for(var t="",n=0;n<e.length;n++){var r=e.charCodeAt(n)-33;if(r<0||r>63)throw new Error("Out-of-range character code "+r+" at index "+n+" in string "+e);t+=r<26?String.fromCharCode("A".charCodeAt(0)+r):r<52?String.fromCharCode("a".charCodeAt(0)+r-26):r<62?String.fromCharCode("0".charCodeAt(0)+r-52):62===r?"+":"/"}return t}var r,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"}(r||(r={}));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=r.ScriptInfo,this.m=null,this.h.nextLine().then(function(e){return t.b(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.m&&(this.f.addAttachment(this.m),this.m=null),this.v===r.ScriptInfo&&e!==r.ScriptInfo&&this.d.resolve(this.f),e===r.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.b=function(e){var t=this;if(null===e)return void(this.currentSection=r.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.m);else if("[Script Info]"===e)this.currentSection=r.ScriptInfo;else if("[V4+ Styles]"===e||"[V4 Styles]"===e)this.currentSection=r.Styles;else if("[Events]"===e)this.currentSection=r.Events;else if("[Fonts]"===e)this.currentSection=r.Fonts;else if("[Graphics]"===e)this.currentSection=r.Graphics;else switch(null===this.m&&"["===e[0]&&"]"===e[e.length-1]&&(this.currentSection=r.Other),this.currentSection){case r.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 r.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 r.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 r.Fonts:case r.Graphics:var u=this.currentSection===r.Fonts?/^fontname:(.+)/:/^filename:(.+)/,p=u.exec(e);if(null!==p)null!==this.m&&(this.f.addAttachment(this.m),this.m=null),this.m=new s.Attachment(p[1].trim(),this.currentSection===r.Fonts?s.AttachmentType.Font:s.AttachmentType.Graphic);else if(null!==this.m)try{this.m.contents+=n(e)}catch(e){i.debugMode&&console.error("Encountered error while reading font "+this.m.filename+": %o",e),this.m=null}break;case r.Other:break;default:throw new Error("Unhandled state "+this.currentSection)}this.h.nextLine().then(function(e){return t.b(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.w=null,this.S=null,this.O=null,this.P=null,this.h.nextLine().then(function(e){return t.b(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 n=new a.Style(new u.Map([["Name","Default"],["FontSize","36"]]));this.f.styles.set(n.name,n)}return Object.defineProperty(e.prototype,"ass",{get:function(){return this._.promise},enumerable:!0,configurable:!0}),e.prototype.b=function(e){var t=this;if(null===e)return null!==this.w&&null!==this.S&&null!==this.O&&null!==this.P&&this.f.dialogues.push(new l.Dialogue(new u.Map([["Style","Default"],["Start",this.S],["End",this.O],["Text",this.P]]),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.w&&null!==this.S&&null!==this.O&&null!==this.P&&this.f.dialogues.push(new l.Dialogue(new u.Map([["Style","Default"],["Start",this.S],["End",this.O],["Text",this.P]]),this.f)),this.w=this.S=this.O=this.P=null;else if(null===this.w)/^\d+$/.test(e)&&(this.w=e);else if(null===this.S&&null===this.O){var n=/^(\d\d:\d\d:\d\d,\d\d\d) --> (\d\d:\d\d:\d\d,\d\d\d)/.exec(e);null!==n&&(this.S=n[1].replace(",","."),this.O=n[2].replace(",","."))}else e=e.replace(/<b>/g,"{\\b1}").replace(/\{b\}/g,"{\\b1}").replace(/<\/b>/g,"{\\b0}").replace(/\{\/b\}/g,"{\\b0}").replace(/<i>/g,"{\\i1}").replace(/\{i\}/g,"{\\i1}").replace(/<\/i>/g,"{\\i0}").replace(/\{\/i\}/g,"{\\i0}").replace(/<u>/g,"{\\u1}").replace(/\{u\}/g,"{\\u1}").replace(/<\/u>/g,"{\\u0}").replace(/\{\/u\}/g,"{\\u0}").replace(/<font color="#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})">/g,function(e,t,n,r){return"{c&H"+r+n+t+"&}"}).replace(/<\/font>/g,"{\\c}"),null!==this.P?this.P+="\\N"+e:this.P=e;this.h.nextLine().then(function(e){return t.b(e)},function(e){t._.reject(e)})},e}();e.SrtStreamParser=f},function(t,n){var r=n(32),i=function(){function e(e){this.C=e,this.k=0}return e.prototype.nextLine=function(){var e=null;if(this.k<this.C.length){var t=this.C.indexOf("\n",this.k);-1!==t?(e=r.Promise.resolve(this.C.substring(this.k,t)),this.k=t+1):(e=r.Promise.resolve(this.C.substr(this.k)),this.k=this.C.length)}else e=r.Promise.resolve(null);return e},e}();t.StringStream=i;var o=function(){function e(e){var t=this;this.j=e,this.k=0,this.A=null,this.T=null,e.addEventListener("progress",function(){return t.D()},!1),e.addEventListener("load",function(){return t.F()},!1),e.addEventListener("error",function(e){return t.M(e)},!1)}return e.prototype.nextLine=function(){if(null!==this.A)throw new Error("XhrStream only supports one pending unfulfilled read at a time.");var e=this.A=new r.DeferredPromise;return this.R(),e.promise},e.prototype.D=function(){null!==this.A&&this.j.readyState!==XMLHttpRequest.DONE&&this.R()},e.prototype.F=function(){null!==this.A&&this.R()},e.prototype.M=function(e){this.T=e,null!==this.A&&this.R()},e.prototype.R=function(){if(null!==this.T)return void this.A.reject(this.T);var e=this.j.responseText,t=e.indexOf("\n",this.k);-1!==t?(this.A.resolve(e.substring(this.k,t)),this.k=t+1,this.A=null):this.j.readyState===XMLHttpRequest.DONE&&(null!==this.T?this.A.reject(this.T):this.k<e.length?(this.A.resolve(e.substr(this.k)),this.k=e.length):this.A.resolve(null),this.A=null)},e}();t.XhrStream=o;var a=function(){function t(t,n){this.N="",this.A=null,this.I=t.getReader(),this.W=new e.TextDecoder(n,{ignoreBOM:!0})}return t.prototype.nextLine=function(){if(null!==this.A)throw new Error("BrowserReadableStream only supports one pending unfulfilled read at a time.");var e=this.A=new r.DeferredPromise;return this.R(),e.promise},t.prototype.R=function(){var e=this,t=this.N.indexOf("\n");-1!==t?(this.A.resolve(this.N.substr(0,t)),this.N=this.N.substr(t+1),this.A=null):this.I.read().then(function(t){var n=t.value;t.done?(0===e.N.length?e.A.resolve(null):(e.A.resolve(e.N),e.N=""),e.A=null):(e.N+=e.W.decode(n,{stream:!0}),e.R())})},t}();t.BrowserReadableStream=a},function(e,t){function n(e){for(var t=atob(e.contents),n=new Uint8Array(new ArrayBuffer(t.length)),r=0;r<t.length;r++)n[r]=t.charCodeAt(r);for(var i={dataView:new DataView(n.buffer),position:0},o=p.read(i),a=null,r=0;r<o.numTables;r++){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,r=0;r<u.count;r++){var _=f.read(i);switch(_.nameId){case 1:case 4:case 6:var g=a.offset+u.stringOffset+_.offset,y=n.subarray(g,g+_.length);switch(_.platformId){case 1:for(var v="",m=0;m<y.length;m++)v+=String.fromCharCode(y[m]);d.add(v);break;case 3:for(var b="",m=0;m<y.length;m+=2)b+=String.fromCharCode((y[m]<<8)+y[m+1]);d.add(b)}}}return d}function r(e){var t=e.L;return e.read=function(n){for(var r=new e,i=0;i<t.length;i++){var a=t[i],l=void 0;switch(a.type){case o.Char:l=String.fromCharCode(n.dataView.getInt8(n.position)),n.position+=1;break;case o.Uint16:l=n.dataView.getUint16(n.position),n.position+=2;break;case o.Uint32:l=n.dataView.getUint32(n.position),n.position+=4}r[a.field]=l}return r},e}function i(e){var t=u.get(e);return void 0===t&&(t=function(t,n){var r=t.constructor;void 0===r.L&&(r.L=[]),r.L.push({type:e,field:n})},u.set(e,t)),t}var o,a=t(34).X,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([r],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([r],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([r],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([r],e)}();e.getTtfNames=n},function(e){var t=function(){function e(e,t){this.Y=e,this.V=t}return Object.defineProperty(e.prototype,"x",{get:function(){return this.Y},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.V},enumerable:!0,configurable:!0}),e}();e.MoveInstruction=t;var n=function(){function e(e,t){this.Y=e,this.V=t}return Object.defineProperty(e.prototype,"x",{get:function(){return this.Y},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.V},enumerable:!0,configurable:!0}),e}();e.LineInstruction=n;var r=function(){function e(e,t,n,r,i,o){this.B=e,this.z=t,this.H=n,this.G=r,this.q=i,this.U=o}return Object.defineProperty(e.prototype,"x1",{get:function(){return this.B},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this.z},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this.H},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this.G},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"x3",{get:function(){return this.q},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y3",{get:function(){return this.U},enumerable:!0,configurable:!0}),e}();e.CubicBezierCurveInstruction=r},function(e,t){var n=t(7);e.drawing=n;var r=function(){function e(e,t,n,r){void 0===r&&(r=1),this.K=e,this.Z=t,this.J=n,this.$=r}return Object.defineProperty(e.prototype,"red",{get:function(){return this.K},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"green",{get:function(){return this.Z},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blue",{get:function(){return this.J},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.$},enumerable:!0,configurable:!0}),e.prototype.withAlpha=function(t){return null!==t?new e(this.K,this.Z,this.J,t):this},e.prototype.toString=function(){return"rgba("+this.K+", "+this.Z+", "+this.J+", "+this.$.toFixed(3)+")"},e.prototype.interpolate=function(t,n){return new e(this.K+n*(t.red-this.K),this.Z+n*(t.green-this.Z),this.J+n*(t.blue-this.J),this.$+n*(t.alpha-this.$))},e}();e.Color=r;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 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.Blur=y;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.GaussianBlur=v;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 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.SecondaryAlpha=I;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.OutlineAlpha=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.ShadowAlpha=L;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.Q=e}return Object.defineProperty(e.prototype,"duration",{get:function(){return this.Q},enumerable:!0,configurable:!0}),e}();e.ColorKaraoke=Y;var V=function(){function e(e){this.Q=e}return Object.defineProperty(e.prototype,"duration",{get:function(){return this.Q},enumerable:!0,configurable:!0}),e}();e.SweepingColorKaraoke=V;var B=function(){function e(e){this.Q=e}return Object.defineProperty(e.prototype,"duration",{get:function(){return this.Q},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 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.Reset=H;var G=function(){function e(e,t){this.Y=e,this.V=t}return Object.defineProperty(e.prototype,"x",{get:function(){return this.Y},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.V},enumerable:!0,configurable:!0}),e}();e.Position=G;var q=function(){function e(e,t,n,r,i,o){this.B=e,this.z=t,this.H=n,this.G=r,this.ee=i,this.te=o}return Object.defineProperty(e.prototype,"x1",{get:function(){return this.B},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this.z},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this.H},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this.G},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"t1",{get:function(){return this.ee},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"t2",{get:function(){return this.te},enumerable:!0,configurable:!0}),e}();e.Move=q;var U=function(){function e(e,t){this.Y=e,this.V=t}return Object.defineProperty(e.prototype,"x",{get:function(){return this.Y},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.V},enumerable:!0,configurable:!0}),e}();e.RotationOrigin=U;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,n,r,i,o,a){this.ne=e,this.re=t,this.ie=n,this.ee=r,this.te=i,this.oe=o,this.ae=a}return Object.defineProperty(e.prototype,"a1",{get:function(){return this.ne},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"a2",{get:function(){return this.re},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"a3",{get:function(){return this.ie},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"t1",{get:function(){return this.ee},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"t2",{get:function(){return this.te},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"t3",{get:function(){return this.oe},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"t4",{get:function(){return this.ae},enumerable:!0,configurable:!0}),e}();e.ComplexFade=Z;var J=function(){function e(e,t,n,r){this.s=e,this.u=t,this.le=n,this.se=r}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.le},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tags",{get:function(){return this.se},enumerable:!0,configurable:!0}),e}();e.Transform=J;var $=function(){function e(e,t,n,r,i){this.B=e,this.z=t,this.H=n,this.G=r,this.ue=i}return Object.defineProperty(e.prototype,"x1",{get:function(){return this.B},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this.z},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this.H},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this.G},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inside",{get:function(){return this.ue},enumerable:!0,configurable:!0}),e}();e.RectangularClip=$;var Q=function(){function e(e,t,n){this.pe=e,this.ce=t,this.ue=n}return Object.defineProperty(e.prototype,"scale",{get:function(){return this.pe},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"instructions",{get:function(){return this.ce},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inside",{get:function(){return this.ue},enumerable:!0,configurable:!0}),e}();e.VectorClip=Q;var ee=function(){function e(e){this.pe=e}return Object.defineProperty(e.prototype,"scale",{get:function(){return this.pe},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 ne=function(){function e(e){this.ce=e}return Object.defineProperty(e.prototype,"instructions",{get:function(){return this.ce},enumerable:!0,configurable:!0}),e}();e.DrawingInstructions=ne;for(var re=function(e,t){if(!e.prototype.hasOwnProperty("toString")){var n=Object.getOwnPropertyNames(e.prototype).filter(function(e){return"constructor"!==e});e.prototype.toString=function(){var e=this;return t+" { "+n.map(function(t){return t+": "+e[t]}).join(", ")+(n.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&&(re(se,le),ie.registerClassPrototype(se.prototype))}for(var ue=0,pe=Object.keys(n);ue<pe.length;ue++){var le=pe[ue],se=n[le];se instanceof Function&&(re(se,"Drawing"+le),ie.registerClassPrototype(se.prototype))}},function(e,t){var n=t(23),r=t(11),i=function(){function e(e,t){this.he=e,this.fe=t,this.de=new r.ManualClock,this._e=null,this.ge=null,this.ye=null}return e.prototype.play=function(){this.de.enabled&&(this.ve(),this.de.play())},e.prototype.pause=function(){if(this.de.enabled){if(null===this._e)return void(n.debugMode&&console.warn("AutoClock.pause: Abnormal state detected. AutoClock._nextAnimationFrameRequestId should not have been null."));this.me(),this.de.pause()}},e.prototype.seeking=function(){this.de.seek(this.he())},Object.defineProperty(e.prototype,"currentTime",{get:function(){return this.de.currentTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this.de.enabled},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){return this.de.paused},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rate",{get:function(){return this.de.rate},enumerable:!0,configurable:!0}),e.prototype.setRate=function(e){this.de.setRate(e)},e.prototype.enable=function(){return!!this.de.enable()&&(this.ve(),!0)},e.prototype.disable=function(){return!!this.de.disable()&&(this.me(),!0)},e.prototype.toggle=function(){this.de.enabled?this.disable():this.enable()},e.prototype.setEnabled=function(e){return e?this.enable():this.disable()},e.prototype.addEventListener=function(e,t){this.de.addEventListener(e,t)},e.prototype.be=function(e){var t=this;if(!this.de.enabled)return void(n.debugMode&&console.warn("AutoClock._onTimerTick: Called when disabled."));var r=this.de.currentTime,i=this.he();this.de.paused?r!==i&&(this.ge=i,this.ye=e,this.de.tick(i)):null!==this.ge&&i===this.ge?e-this.ye>this.fe?(this.ye=null,this.de.pause()):this.de.tick((e-this.ye)/1e3*this.de.rate+this.ge):(this.ge=i,this.ye=e,this.de.tick(i)),this._e=requestAnimationFrame(function(e){return t.be(e)})},e.prototype.ve=function(){var e=this;null===this._e&&(this._e=requestAnimationFrame(function(t){return e.be(t)}))},e.prototype.me=function(){null!==this._e&&(cancelAnimationFrame(this._e),this._e=null)},e}();e.AutoClock=i},function(e){var t=function(){function e(){}return e.prototype.addEventListener=function(e,t){var n=this.we.get(e);void 0===n&&this.we.set(e,n=[]),n.push(t)},e.prototype.Se=function(e,t){var n=this.we.get(e);if(void 0!==n)for(var r=0;r<n.length;r++){var i=n[r];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 n=t(31),r=t(30),i=t(10),o=function(){function e(){this.Oe=-1,this.Pe=1,this.Ce=!0,this.ke=!0,this.we=new r.Map}return e.prototype.play=function(){this.Ce&&this.ke&&(this.ke=!1,this.Se(i.ClockEvent.Play,[]))},e.prototype.tick=function(e){this.Ce&&this.Oe!==e&&(this.play(),this.Oe=e,this.Se(i.ClockEvent.Tick,[]))},e.prototype.seek=function(e){this.Ce&&(this.pause(),this.Oe!==e&&(this.stop(),this.tick(e),this.pause()))},e.prototype.pause=function(){this.Ce&&(this.ke||(this.ke=!0,this.Se(i.ClockEvent.Pause,[])))},e.prototype.stop=function(){this.Se(i.ClockEvent.Stop,[])},Object.defineProperty(e.prototype,"currentTime",{get:function(){return this.Oe},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this.Ce},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){return this.ke},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rate",{get:function(){return this.Pe},enumerable:!0,configurable:!0}),e.prototype.setRate=function(e){this.Pe!==e&&(this.Pe=e,this.Se(i.ClockEvent.RateChange,[]))},e.prototype.enable=function(){return!this.Ce&&(this.Ce=!0,!0)},e.prototype.disable=function(){return!!this.Ce&&(this.pause(),this.stop(),this.Ce=!1,!0)},e.prototype.toggle=function(){this.Ce?this.disable():this.enable()},e.prototype.setEnabled=function(e){return e?this.enable():this.disable()},e}();e.ManualClock=o,n.mixin(o,[i.EventSource])},function(e,t){var n=t(9),r=function(){function e(e){var t=this;this.Ee=new n.AutoClock(function(){return e.currentTime},100),e.addEventListener("playing",function(){return t.Ee.play()},!1),e.addEventListener("pause",function(){return t.Ee.pause()},!1),e.addEventListener("seeking",function(){return t.Ee.seeking()},!1),e.addEventListener("ratechange",function(){return t.Ee.setRate(e.playbackRate)},!1)}return Object.defineProperty(e.prototype,"currentTime",{get:function(){return this.Ee.currentTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this.Ee.enabled},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){return this.Ee.paused},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rate",{get:function(){return this.Ee.rate},enumerable:!0,configurable:!0}),e.prototype.enable=function(){return this.Ee.enable()},e.prototype.disable=function(){return this.Ee.disable()},e.prototype.toggle=function(){this.Ee.enabled?this.disable():this.enable()},e.prototype.setEnabled=function(e){return e?this.enable():this.disable()},e.prototype.addEventListener=function(e,t){this.Ee.addEventListener(e,t)},e}();e.VideoClock=r},function(e,t){var n=t(34).xe,r=t(12),i=t(21),o=function(e){function t(t,n,i){e.call(this,n,new r.VideoClock(t),document.createElement("div"),i),this.je=t,this.je.parentElement.replaceChild(this.libjassSubsWrapper,this.je),this.libjassSubsWrapper.insertBefore(this.je,this.libjassSubsWrapper.firstElementChild)}return n(t,e),t.prototype.resize=function(){var t=this.je.videoWidth,n=this.je.videoHeight,r=this.je.offsetWidth,i=this.je.offsetHeight,o=Math.min(r/t,i/n),a=t*o,l=n*o,s=(r-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.Ae=function(){this.resize(),e.prototype.Ae.call(this)},t}(i.WebRenderer);e.DefaultRenderer=o},function(e,t){var n=t(10);e.ClockEvent=n.ClockEvent,e.EventSource=n.EventSource;var r=t(9);e.AutoClock=r.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 n=t(10),r=t(16),i=t(23),o=function(){function e(t,i,o){var a=this;this.f=t,this.Te=i,this.De=++e.Fe,this.Me=r.RendererSettings.from(o),this.Te.addEventListener(n.ClockEvent.Play,function(){return a.Re()}),this.Te.addEventListener(n.ClockEvent.Tick,function(){return a.Ne()}),this.Te.addEventListener(n.ClockEvent.Pause,function(){return a.Ie()}),this.Te.addEventListener(n.ClockEvent.Stop,function(){return a.We()}),this.Te.addEventListener(n.ClockEvent.RateChange,function(){return a.Le()})}return Object.defineProperty(e.prototype,"id",{get:function(){return this.De},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.Te},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"settings",{get:function(){return this.Me},enumerable:!0,configurable:!0}),e.prototype.preRender=function(){},e.prototype.draw=function(){},e.prototype.enable=function(){return this.Te.enable()},e.prototype.disable=function(){return this.Te.disable()},e.prototype.toggle=function(){this.Te.toggle()},e.prototype.setEnabled=function(e){return this.Te.setEnabled(e)},Object.defineProperty(e.prototype,"enabled",{get:function(){return this.Te.enabled},enumerable:!0,configurable:!0}),e.prototype.Re=function(){i.verboseMode&&console.log("NullRenderer._onClockPlay")},e.prototype.Ne=function(){var e=this.Te.currentTime;i.verboseMode&&console.log("NullRenderer._onClockTick: currentTime = "+e);for(var t=0,n=this.f.dialogues;t<n.length;t++){var r=n[t];r.end>e&&(r.start<=e?this.draw(r):r.start<=e+this.Me.preRenderTime&&this.preRender(r))}},e.prototype.Ie=function(){i.verboseMode&&console.log("NullRenderer._onClockPause")},e.prototype.We=function(){i.verboseMode&&console.log("NullRenderer._onClockStop")},e.prototype.Le=function(){i.verboseMode&&console.log("NullRenderer._onClockRateChange")},e.Fe=-1,e}();e.NullRenderer=o},function(e,t){function n(e){return e.type===CSSRule.FONT_FACE_RULE}var r=t(30),i=function(){function e(){}return e.makeFontMapFromStyleElement=function(e){for(var t=new r.Map,i=e.sheet,o=0;o<i.cssRules.length;o++){var a=i.cssRules[o];if(n(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 n=t,r=n.fontMap,i=void 0===r?null:r,o=n.preRenderTime,a=void 0===o?5:o,l=n.preciseOutlines,s=void 0!==l&&l,u=n.enableSvg,p=void 0===u||u,c=n.fallbackFonts,h=void 0===c?'Arial, Helvetica, sans-serif, "Segoe UI Symbol"':c,f=n.useAttachedFonts,d=void 0!==f&&f,_=new e;return _.fontMap=i,_.preRenderTime=a,_.preciseOutlines=s,_.enableSvg=p,_.fallbackFonts=h,_.useAttachedFonts=d,_},e}();e.RendererSettings=i},function(e,t){var n=t(30),r=function(){function e(t,r){this.Xe=r,this.Ye="",this.Ve=new n.Map,this.Be=0,this.De=t.id+"-"+e.ze++,this.Pe=t.clock.rate}return Object.defineProperty(e.prototype,"animationStyle",{get:function(){return this.Ye},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationDelays",{get:function(){return this.Ve},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t){for(var n=null,r=null,i=0;i<t.length;i++){var o=t[i];null===n&&(n=o.time),r=o.time}for(var a="",l=0;l<t.length;l++){var o=t[l];a+="\t"+(100*(r-n==0?1:(o.time-n)/(r-n))).toFixed(3)+"% {\n",o.properties.forEach(function(e,t){a+="\t\t"+t+": "+e+";\n"}),a+="\t}\n"}var s="animation-"+this.De+"-"+this.Be++;this.Xe.appendChild(document.createTextNode("@-webkit-keyframes "+s+" {\n"+a+"\n}")),this.Xe.appendChild(document.createTextNode("@keyframes "+s+" {\n"+a+"\n}")),""!==this.Ye&&(this.Ye+=","),this.Ye+=s+" "+((r-n)/this.Pe).toFixed(3)+"s "+e,this.Ve.set(s,n)},e.ze=0,e}();e.AnimationCollection=r},function(e,t){var n=t(8),r=function(){function e(e,t){this.He=e,this.Ge=t,this.pe=1,this.qe=0}return Object.defineProperty(e.prototype,"scale",{set:function(e){this.pe=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"baselineOffset",{set:function(e){this.qe=e},enumerable:!0,configurable:!0}),e.prototype.toSVG=function(e,t){for(var r=Math.pow(2,this.pe-1),i=this.He/r,o=this.Ge/r,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 n.drawing.MoveInstruction?(a.pathSegList.appendItem(a.createSVGPathSegMovetoAbs(c.x,c.y+this.qe)),l=Math.max(l,c.x),s=Math.max(s,c.y+this.qe)):c instanceof n.drawing.LineInstruction?(a.pathSegList.appendItem(a.createSVGPathSegLinetoAbs(c.x,c.y+this.qe)),l=Math.max(l,c.x),s=Math.max(s,c.y+this.qe)):c instanceof n.drawing.CubicBezierCurveInstruction&&(a.pathSegList.appendItem(a.createSVGPathSegCurvetoCubicAbs(c.x3,c.y3+this.qe,c.x1,c.y1+this.qe,c.x2,c.y2+this.qe)),l=Math.max(l,c.x1,c.x2,c.x3),s=Math.max(s,c.y1+this.qe,c.y2+this.qe,c.y3+this.qe))}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=r},function(e,t){function n(e,t,n,r){var i='"'+e+'"';""!==n&&(i+=", "+n),r.style.fontFamily=i,r.style.fontSize=t+"px"}function r(e,t,r,i){return n(e,t,r,i),new u.Promise(function(e){return setTimeout(function(){return e(i.offsetHeight)},1e3)})}function i(e,t,r,i){return n(e,t,r,i),i.offsetHeight}function o(e,t){return[e,180/(t-e)]}function a(e,t,n){return r(e,180,t,n).then(function(i){return r(e,360,t,n).then(function(e){return o(i,e)})})}function l(e,t,n){return 180+(e-t)*n}function s(e,t,n,r,a){var s=a.get(e);if(void 0===s){var u=i(e,180,n,r),p=i(e,360,n,r);a.set(e,s=o(u,p))}return l(t,s[0],s[1])}var u=t(32);e.calculateFontMetrics=a,e.fontSizeForLineHeight=s},function(e){var t=function(){function e(e,t){this.Ue=e,this.Ke=t}return Object.defineProperty(e.prototype,"time",{get:function(){return this.Ue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"properties",{get:function(){return this.Ke},enumerable:!0,configurable:!0}),e}();e.Keyframe=t},function(t,n){var r=n(34).xe,i=n(17),o=n(18),a=n(19),l=n(20),s=n(22),u=n(10),p=n(15),c=n(6),h=n(8),f=n(23),d=n(25),_=n(27),g=n(31),y=n(30),v=n(32),m=/^(url|local)\(["']?(.+?)["']?\)$/,b=function(t){function n(n,r,i,o){var a=this;t.call(this,n,r,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.Ze=i,this.Je=[],this.$e=[],this.Qe=new y.Map,this.et=new y.Map,this.tt=new y.Map,this.we=new y.Map,this.Ze.classList.add("libjass-wrapper"),this.nt=document.createElement("div"),this.Ze.appendChild(this.nt),this.nt.className="libjass-subs",this.rt=document.createElement("div"),this.Ze.appendChild(this.rt),this.rt.className="libjass-font-measure",this.rt.appendChild(document.createTextNode("M")),f.debugMode&&console.log("Preloading fonts...");var l=[],s=new y.Map,u=null===this.settings.fontMap?new y.Map:this.settings.fontMap,p=new y.Map;this.settings.useAttachedFonts&&n.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 n="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(n);else{var r=p.get(e);void 0===r&&p.set(e,r=[]),r.push(n)}else u.set(e,[n])})}}),u.forEach(function(t,n){var r;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(n);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!==n&&e.family!=='"'+n+'"'||h.push(e)});var d;if(0===h.length){var _=new FontFace(n,i),g=new FontFace('"'+n+'"',i);e.document.fonts.add(_),e.document.fonts.add(g),d=v.any([_.load(),g.load()])}else d=v.any(h.map(function(e){return e.load()}));r=a.it(n,d.catch(function(e){return console.warn("Fetching fonts for "+n+" at "+i+" failed: %o",e),null}))}else{var y=("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(n);void 0!==o&&(y=y.concat(o));var b=y.map(function(e){var t=s.get(e);return void 0===t&&(t=new v.Promise(function(t,n){var r=new XMLHttpRequest;r.addEventListener("load",function(){f.debugMode&&console.log("Preloaded "+e+"."),t(null)}),r.addEventListener("error",function(e){n(e)}),r.open("GET",e,!0),r.send()}),s.set(e,t)),t}),w=0===b.length?v.Promise.resolve(null):v.first(b).catch(function(e){return console.warn("Fetching fonts for "+n+" at "+y.join(", ")+" failed: %o",e),null});r=a.it(n,w)}l.push(r.then(function(e){return a.Qe.set(n,e)}))}),v.Promise.all(l).then(function(){f.debugMode&&console.log("All fonts have been preloaded."),a.Ae()})}return r(n,t),Object.defineProperty(n.prototype,"libjassSubsWrapper",{get:function(){return this.Ze},enumerable:!0,configurable:!0}),n.prototype.resize=function(e,t,n,r){void 0===n&&(n=0),void 0===r&&(r=0),this.ot(),this.nt.style.width=e.toFixed(3)+"px",this.nt.style.height=t.toFixed(3)+"px",this.nt.style.left=n.toFixed(3)+"px",this.nt.style.top=r.toFixed(3)+"px",this.at=e,this.lt=e/this.ass.properties.resolutionX,this.st=t/this.ass.properties.resolutionY,this.tt.clear(),-1!==this.clock.currentTime&&this.Ne()},n.prototype.preRender=function(e){var t=this,r=this.tt.get(e.id);if(r)return r;var a=this.clock.currentTime-e.start;if(e.containsTransformTag&&a<0)return null;var u=document.createElement("div");u.style.marginLeft=(this.lt*e.style.marginLeft).toFixed(3)+"px",u.style.marginRight=(this.lt*e.style.marginRight).toFixed(3)+"px",u.style.marginTop=u.style.marginBottom=(this.st*e.style.marginVertical).toFixed(3)+"px",u.style.minWidth=(this.at-this.lt*(e.style.marginLeft+e.style.marginRight)).toFixed(3)+"px";var p=document.createElement("span");e.style.borderStyle===_.BorderStyle.OpaqueBox&&(p.style.background=e.style.shadowColor.toString(),p.style.display="inline-block"),u.appendChild(p);var c=document.createElement("style");c.id="libjass-animation-styles-"+this.id+"-"+e.id,c.type="text/css";var d=new i.AnimationCollection(this,c),g=document.createElementNS("http://www.w3.org/2000/svg","svg");g.setAttribute("version","1.1"),g.setAttribute("class","libjass-filters"),g.width.baseVal.valueAsString="0",g.height.baseVal.valueAsString="0";var v=document.createElementNS("http://www.w3.org/2000/svg","defs");g.appendChild(v);var m=null,b=new s.SpanStyles(this,e,this.lt,this.st,this.settings,this.rt,v,this.Qe),w=null,S=!1,O=function(e){null!==m&&m.hasChildNodes()&&p.appendChild(b.setStylesOnSpan(m,w)),null!==w&&w.animationDelays.forEach(function(e,t){return d.animationDelays.set(t,e)}),e&&(S?p.appendChild(b.makeNewLine()):p.appendChild(document.createElement("br"))),m=document.createElement("span"),w=new i.AnimationCollection(t,c),S=e};O(!1);for(var P=new o.DrawingStyles(this.lt,this.st),C=this.ass.properties.wrappingStyle,k=0,E=0,x=e.parts;E<x.length;E++){var j=x[E];if(j instanceof h.Italic)b.italic=j.value;else if(j instanceof h.Bold)b.bold=j.value;else if(j instanceof h.Underline)b.underline=j.value;else if(j instanceof h.StrikeThrough)b.strikeThrough=j.value;else if(j instanceof h.Border)b.outlineWidth=j.value,b.outlineHeight=j.value;else if(j instanceof h.BorderX)b.outlineWidth=j.value;else if(j instanceof h.BorderY)b.outlineHeight=j.value;else if(j instanceof h.Shadow)b.shadowDepthX=j.value,b.shadowDepthY=j.value;else if(j instanceof h.ShadowX)b.shadowDepthX=j.value;else if(j instanceof h.ShadowY)b.shadowDepthY=j.value;else if(j instanceof h.Blur)b.blur=j.value;else if(j instanceof h.GaussianBlur)b.gaussianBlur=j.value;else if(j instanceof h.FontName)b.fontName=j.value;else if(j instanceof h.FontSize)b.fontSize=j.value;else if(j instanceof h.FontSizePlus)b.fontSize+=j.value;else if(j instanceof h.FontSizeMinus)b.fontSize-=j.value;else if(j instanceof h.FontScaleX)b.fontScaleX=j.value;else if(j instanceof h.FontScaleY)b.fontScaleY=j.value;else if(j instanceof h.LetterSpacing)b.letterSpacing=j.value;else if(j instanceof h.RotateX)b.rotationX=j.value;else if(j instanceof h.RotateY)b.rotationY=j.value;else if(j instanceof h.RotateZ)b.rotationZ=j.value;else if(j instanceof h.SkewX)b.skewX=j.value;else if(j instanceof h.SkewY)b.skewY=j.value;else if(j instanceof h.PrimaryColor)b.primaryColor=j.value;else if(j instanceof h.SecondaryColor)b.secondaryColor=j.value;else if(j instanceof h.OutlineColor)b.outlineColor=j.value;else if(j instanceof h.ShadowColor)b.shadowColor=j.value;else if(j instanceof h.Alpha)b.primaryAlpha=j.value,b.secondaryAlpha=j.value,b.outlineAlpha=j.value,b.shadowAlpha=j.value;else if(j instanceof h.PrimaryAlpha)b.primaryAlpha=j.value;else if(j instanceof h.SecondaryAlpha)b.secondaryAlpha=j.value;else if(j instanceof h.OutlineAlpha)b.outlineAlpha=j.value;else if(j instanceof h.ShadowAlpha)b.shadowAlpha=j.value;else if(j instanceof h.Alignment);else if(j instanceof h.ColorKaraoke)O(!1),w.add("step-end",[new l.Keyframe(0,new y.Map([["color",b.secondaryColor.withAlpha(b.secondaryAlpha).toString()]])),new l.Keyframe(k,new y.Map([["color",b.primaryColor.withAlpha(b.primaryAlpha).toString()]]))]),k+=j.duration;else if(j instanceof h.WrappingStyle)C=j.value;else if(j instanceof h.Reset)b.reset(this.ass.styles.get(j.value));else if(j instanceof h.Position)u.style.position="absolute",u.style.left=(this.lt*j.x).toFixed(3)+"px",u.style.top=(this.st*j.y).toFixed(3)+"px";else if(j instanceof h.Move)u.style.position="absolute",d.add("linear",[new l.Keyframe(0,new y.Map([["left",(this.lt*j.x1).toFixed(3)+"px"],["top",(this.st*j.y1).toFixed(3)+"px"]])),new l.Keyframe(j.t1,new y.Map([["left",(this.lt*j.x1).toFixed(3)+"px"],["top",(this.st*j.y1).toFixed(3)+"px"]])),new l.Keyframe(j.t2,new y.Map([["left",(this.lt*j.x2).toFixed(3)+"px"],["top",(this.st*j.y2).toFixed(3)+"px"]])),new l.Keyframe(e.end-e.start,new y.Map([["left",(this.lt*j.x2).toFixed(3)+"px"],["top",(this.st*j.y2).toFixed(3)+"px"]]))]);else if(j instanceof h.Fade)d.add("linear",[new l.Keyframe(0,new y.Map([["opacity","0"]])),new l.Keyframe(j.start,new y.Map([["opacity","1"]])),new l.Keyframe(e.end-e.start-j.end,new y.Map([["opacity","1"]])),new l.Keyframe(e.end-e.start,new y.Map([["opacity","0"]]))]);else if(j instanceof h.ComplexFade)d.add("linear",[new l.Keyframe(0,new y.Map([["opacity",j.a1.toFixed(3)]])),new l.Keyframe(j.t1,new y.Map([["opacity",j.a1.toFixed(3)]])),new l.Keyframe(j.t2,new y.Map([["opacity",j.a2.toFixed(3)]])),new l.Keyframe(j.t3,new y.Map([["opacity",j.a2.toFixed(3)]])),new l.Keyframe(j.t4,new y.Map([["opacity",j.a3.toFixed(3)]])),new l.Keyframe(e.end-e.start,new y.Map([["opacity",j.a3.toFixed(3)]]))]);else if(j instanceof h.Transform)for(var A=a<=j.start?0:a>=j.end?1:Math.pow((a-j.start)/(j.end-j.start),j.accel),T=0,D=j.tags;T<D.length;T++){var F=D[T];F instanceof h.Border?(b.outlineWidth+=A*(F.value-b.outlineWidth),b.outlineHeight+=A*(F.value-b.outlineHeight)):F instanceof h.BorderX?b.outlineWidth+=A*(F.value-b.outlineWidth):F instanceof h.BorderY?b.outlineHeight+=A*(F.value-b.outlineHeight):F instanceof h.Shadow?(b.shadowDepthX+=A*(F.value-b.shadowDepthX),b.shadowDepthY+=A*(F.value-b.shadowDepthY)):F instanceof h.ShadowX?b.shadowDepthX+=A*(F.value-b.shadowDepthX):F instanceof h.ShadowY?b.shadowDepthY+=A*(F.value-b.shadowDepthY):F instanceof h.Blur?b.blur+=A*(F.value-b.blur):F instanceof h.GaussianBlur?b.gaussianBlur+=A*(F.value-b.gaussianBlur):F instanceof h.FontSize?b.fontSize+=A*(F.value-b.fontSize):F instanceof h.FontSizePlus?b.fontSize+=A*F.value:F instanceof h.FontSizeMinus?b.fontSize-=A*F.value:F instanceof h.FontScaleX?b.fontScaleX+=A*(F.value-b.fontScaleX):F instanceof h.FontScaleY?b.fontScaleY+=A*(F.value-b.fontScaleY):F instanceof h.LetterSpacing?b.letterSpacing+=A*(F.value-b.letterSpacing):F instanceof h.RotateX?b.rotationX+=A*(F.value-b.rotationX):F instanceof h.RotateY?b.rotationY+=A*(F.value-b.rotationY):F instanceof h.RotateZ?b.rotationZ+=A*(F.value-b.rotationZ):F instanceof h.SkewX?b.skewX+=A*(F.value-b.skewX):F instanceof h.SkewY?b.skewY+=A*(F.value-b.skewY):F instanceof h.PrimaryColor?b.primaryColor=b.primaryColor.interpolate(F.value,A):F instanceof h.SecondaryColor?b.secondaryColor=b.secondaryColor.interpolate(F.value,A):F instanceof h.OutlineColor?b.outlineColor=b.outlineColor.interpolate(F.value,A):F instanceof h.ShadowColor?b.shadowColor=b.shadowColor.interpolate(F.value,A):F instanceof h.Alpha?(b.primaryAlpha+=A*(F.value-b.primaryAlpha),b.secondaryAlpha+=A*(F.value-b.secondaryAlpha),b.outlineAlpha+=A*(F.value-b.outlineAlpha),b.shadowAlpha+=A*(F.value-b.shadowAlpha)):F instanceof h.PrimaryAlpha?b.primaryAlpha+=A*(F.value-b.primaryAlpha):F instanceof h.SecondaryAlpha?b.secondaryAlpha+=A*(F.value-b.secondaryAlpha):F instanceof h.OutlineAlpha?b.outlineAlpha+=A*(F.value-b.outlineAlpha):F instanceof h.ShadowAlpha&&(b.shadowAlpha+=A*(F.value-b.shadowAlpha))}else if(j instanceof h.DrawingMode)0!==j.scale&&(P.scale=j.scale);else if(j instanceof h.DrawingBaselineOffset)P.baselineOffset=j.value;else if(j instanceof h.DrawingInstructions)m.appendChild(P.toSVG(j,b.primaryColor.withAlpha(b.primaryAlpha))),O(!1);else if(j instanceof h.Text){if(j.value.length>0){var M=j.value.charAt(0),R=j.value.slice(1),N=document.createElement("nobr");N.appendChild(document.createTextNode(_.ASS_CAPTION_PADDING_SPACE_CHAR+M)),m.appendChild(N),m.appendChild(document.createTextNode(R+_.ASS_CAPTION_PADDING_SPACE_CHAR))}m.appendChild(document.createTextNode("‌")),O(!1)}else f.debugMode&&j instanceof h.Comment?(m.appendChild(document.createTextNode(j.value)),O(!1)):j instanceof h.NewLine&&O(!0)}for(var I=0,W=e.parts;I<W.length;I++){var j=W[I];if(j instanceof h.Position||j instanceof h.Move){var L=n.ut[e.alignment],X="translate("+-L[0]+"%, "+-L[1]+"%) translate(-"+u.style.marginLeft+", -"+u.style.marginTop+")",Y=L[0]+"% "+L[1]+"%";u.style.webkitTransform=X,u.style.webkitTransformOrigin=Y,u.style.transform=X,u.style.transformOrigin=Y;break}}switch(C){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=d.animationStyle,u.style.animation=d.animationStyle,u.setAttribute("data-dialogue-id",this.id+"-"+e.id),""!==c.textContent&&u.appendChild(c),v.hasChildNodes()&&u.appendChild(g);var V={sub:u,animationDelays:d.animationDelays};return e.containsTransformTag||this.tt.set(e.id,V),V},n.prototype.draw=function(e){var t=this;if(!this.et.has(e)||e.containsTransformTag){f.debugMode&&console.log(e.toString());var n=this.tt.get(e.id);void 0===n&&(n=this.preRender(e),f.debugMode&&console.log(e.toString()));var r=n.sub.cloneNode(!0),i=function(r){var i=r.style.animationName||r.style.webkitAnimationName;if(void 0!==i&&""!==i){var o=i.split(",").map(function(r){return r=r.trim(),((n.animationDelays.get(r)+e.start-t.clock.currentTime)/t.clock.rate).toFixed(3)+"s"}).join(", ");r.style.webkitAnimationDelay=o,r.style.animationDelay=o}};i(r);for(var o=r.querySelectorAll('[style*="animation:"]'),a=0;a<o.length;a++)i(o[a]);var l=e.layer,s="absolute"===r.style.position?0:e.alignment;if(void 0===this.Je[l]){var u=document.createElement("div");u.className="layer layer"+l;for(var p=null,c=l+1;c<this.Je.length&&null===p;c++)void 0!==this.Je[c]&&(p=this.Je[c]);this.nt.insertBefore(u,p),this.Je[l]=u,this.$e[l]=[]}if(void 0===this.$e[l][s]){var h=document.createElement("div");h.className="an an"+s;for(var u=this.Je[l],p=null,d=s+1;d<this.$e[l].length&&null===p;d++)void 0!==this.$e[l][d]&&(p=this.$e[l][d]);u.insertBefore(h,p),this.$e[l][s]=h}this.$e[l][s].appendChild(r);var _=r.getElementsByTagName("style")[0];if(void 0!==_){var g=_.sheet;0===g.cssRules.length&&(g.cssText=_.textContent)}this.et.set(e,r)}},n.prototype.Re=function(){t.prototype.Re.call(this),this.ot(),this.nt.style.display="",this.nt.classList.remove("paused")},n.prototype.Ne=function(){var e=this,n=this.clock.currentTime;this.et.forEach(function(t,r){(r.start>n||r.end<n||r.containsTransformTag)&&(e.et.delete(r),e.pt(t))}),t.prototype.Ne.call(this)},n.prototype.Ie=function(){t.prototype.Ie.call(this),this.nt.classList.add("paused")},n.prototype.We=function(){t.prototype.We.call(this),this.nt.style.display="none"},n.prototype.Le=function(){t.prototype.Le.call(this),this.tt.clear()},n.prototype.Ae=function(){this.Se("ready",[])},n.prototype.it=function(e,t){var n=this;return t.then(function(){var t=n.rt.cloneNode(!0);return n.Ze.appendChild(t),v.lastly(a.calculateFontMetrics(e,n.settings.fallbackFonts,t),function(){n.Ze.removeChild(t)})})},n.prototype.pt=function(e){e.parentNode.removeChild(e)},n.prototype.ot=function(){var e=this;this.et.forEach(function(t){return e.pt(t)}),this.et.clear()},n.ut=[null,[0,100],[50,100],[100,100],[0,50],[50,50],[100,50],[0,0],[50,0],[100,0]],n}(p.NullRenderer);t.WebRenderer=b,g.mixin(b,[u.EventSource])},function(e,t){var n=t(19),r=t(27),i=function(){function e(e,t,n,r,i,o,a,l){this.lt=n,this.st=r,this.Me=i,this.rt=o,this.ct=a,this.Qe=l,this.ht=0,this.De=e.id+"-"+t.id,this.ft=t.style,this.reset(null)}return e.prototype.reset=function(e){void 0!==e&&null!==e||(e=this.ft),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.lineHeightRatio=e.lineHeightRatio,this.fontScaleX=e.fontScaleX,this.fontScaleY=e.fontScaleY,this.letterSpacing=e.letterSpacing,this.dt=null,this._t=null,this.gt=e.rotationZ,this.yt=null,this.vt=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,i){var o=t.childNodes[0]instanceof Text,a="";this.mt&&(a+="italic "),!0===this.bt?a+="bold ":!1!==this.bt&&(a+=this.bt+" ");var l=this.wt*(o?this.St:1),s=this.Ot!=r.ASS_UNDEFINED_LINE_HEIGHT_RATIO&&this.Ot>0?l/this.Ot:n.fontSizeForLineHeight(this.Pt,l,this.Me.fallbackFonts,this.rt,this.Qe),u=(this.st*s).toFixed(3),p=(this.st*this.wt).toFixed(3),c=this.Pt;switch(c){case"cursive":case"fantasy":case"monospace":case"sans-serif":case"serif":break;default:c='"'+c+'"'}""!==this.Me.fallbackFonts&&(c+=", "+this.Me.fallbackFonts),t.style.font=""+a+u+"px/"+p+"px "+c;var h="";this.Ct&&(h="underline"),this.kt&&(h+=" line-through"),t.style.textDecoration=h.trim();var f="";if(o?this.Et!==this.St&&(f+="scaleY("+(this.Et/this.St).toFixed(3)+") "):(1!==this.St&&(f+="scaleX("+this.St+") "),1!==this.Et&&(f+="scaleY("+this.Et+") ")),null!==this._t&&(f+="rotateY("+this._t+"deg) "),null!==this.dt&&(f+="rotateX("+this.dt+"deg) "),0!==this.gt&&(f+="rotateZ("+-1*this.gt+"deg) "),null!==this.yt||null!==this.vt){var d=e.xt(this.yt,0);f+="matrix(1, "+e.xt(this.vt,0)+", "+d+", 1, 0, 0) "}""!==f&&(t.style.webkitTransform=f,t.style.webkitTransformOrigin="50% 50%",t.style.transform=f,t.style.transformOrigin="50% 50%",t.style.display="inline-block"),t.style.letterSpacing=(this.lt*this.jt).toFixed(3)+"px";var _=this.lt*this.At,g=this.st*this.Tt,y=document.createElement("span");y.appendChild(t);var v=this.Dt.withAlpha(this.Ft),m=this.Mt.withAlpha(this.Rt),b=this.Nt.withAlpha(this.It);if(this.Me.enableSvg||(0!==_||0!==g)&&m.alpha!==v.alpha||(0!==this.Wt||0!==this.Lt)&&b.alpha!==v.alpha||(v=this.Dt.withAlpha(1),m=this.Mt.withAlpha(1),b=this.Nt.withAlpha(1),t.style.opacity=this.Ft.toFixed(3)),t.style.color=v.toString(),this.Me.enableSvg?this.Xt(y,_,g,m,this.Ft):this.Yt(t,_,g,m),0!==this.Wt||0!==this.Lt){var w=b.toString()+" "+(this.Wt*this.lt).toFixed(3)+"px "+(this.Lt*this.st).toFixed(3)+"px 0px";""===t.style.textShadow?t.style.textShadow=w:t.style.textShadow+=", "+w}return 0===this.dt&&0===this._t||(y.style.display="inline-block"),t.style.webkitAnimation=i.animationStyle,t.style.animation=i.animationStyle,y},e.prototype.Xt=function(e,t,n,r,i){var o="svg-filter-"+this.De+"-"+this.ht++,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||n>0){var l=0,s=!this.Me.preciseOutlines&&this.Vt>0?this.Vt:1;!function(e){if(t<=n)if(t>0){var r;for(r=0;r<=t;r+=s)e(r,n/t*Math.sqrt(t*t-r*r));r!==t+s&&e(t,0)}else e(0,n);else if(n>0){var i;for(i=0;i<=n;i+=s)e(t/n*Math.sqrt(n*n-i*i),i);i!==n+s&&e(0,n)}else e(t,0)}(function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","feMorphology");a.appendChild(n),n.in1.baseVal="source",n.operator.baseVal=SVGFEMorphologyElement.SVG_MORPHOLOGY_OPERATOR_DILATE,n.radiusX.baseVal=e,n.radiusY.baseVal=t,n.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;h<l;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=r.red/255*r.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=r.green/255*r.alpha;var y=document.createElementNS("http://www.w3.org/2000/svg","feFuncB");d.appendChild(y),y.type.baseVal=SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR,y.slope.baseVal=0,y.intercept.baseVal=r.blue/255*r.alpha;var v=document.createElementNS("http://www.w3.org/2000/svg","feFuncA");if(d.appendChild(v),v.type.baseVal=SVGComponentTransferFunctionElement.SVG_FECOMPONENTTRANSFER_TYPE_LINEAR,v.slope.baseVal=r.alpha,v.intercept.baseVal=0,this.Vt>0){var m=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");a.appendChild(m),m.stdDeviationX.baseVal=this.Vt,m.stdDeviationY.baseVal=this.Vt}for(var h=0;h<this.Bt;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.Vt>0){var m=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");a.appendChild(m),m.stdDeviationX.baseVal=this.Vt,m.stdDeviationY.baseVal=this.Vt}for(var h=0;h<this.Bt;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.ct.appendChild(a),e.style.webkitFilter='url("#'+o+'")',e.style.filter='url("#'+o+'")')},e.prototype.Yt=function(e,t,n,r){var i=this;if(t>0||n>0){var o="";!function(e){for(var r=0;r<=t;r++)for(var i=0===t?n:n*Math.sqrt(1-r*r/(t*t)),o=0;o<=i;o++)e(r,o),0!==r&&e(-r,o),0!==o&&e(r,-o),0!==r&&0!==o&&e(-r,-o)}(function(e,t){o+=", "+r.toString()+" "+e+"px "+t+"px "+i.Vt.toFixed(3)+"px"}),e.style.textShadow=o.substr(", ".length)}},e.prototype.makeNewLine=function(){var e=document.createElement("br");return e.style.lineHeight=(this.st*this.wt).toFixed(3)+"px",e},Object.defineProperty(e.prototype,"italic",{set:function(t){this.mt=e.xt(t,this.ft.italic)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bold",{set:function(t){this.bt=e.xt(t,this.ft.bold)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"underline",{set:function(t){this.Ct=e.xt(t,this.ft.underline)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"strikeThrough",{set:function(t){this.kt=e.xt(t,this.ft.strikeThrough)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this.At},set:function(t){this.At=e.xt(t,this.ft.outlineThickness)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineHeight",{get:function(){return this.At},set:function(t){this.Tt=e.xt(t,this.ft.outlineThickness)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowDepthX",{get:function(){return this.Wt},set:function(t){this.Wt=e.xt(t,this.ft.shadowDepth)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowDepthY",{get:function(){return this.Lt},set:function(t){this.Lt=e.xt(t,this.ft.shadowDepth)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this.Bt},set:function(t){this.Bt=e.xt(t,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gaussianBlur",{get:function(){return this.Vt},set:function(t){this.Vt=e.xt(t,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontName",{set:function(t){this.Pt=e.xt(t,this.ft.fontName)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){return this.wt},set:function(t){this.wt=e.xt(t,this.ft.fontSize)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineHeightRatio",{get:function(){return this.Ot},set:function(t){this.Ot=e.xt(t,this.ft.lineHeightRatio)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontScaleX",{get:function(){return this.St},set:function(t){this.St=e.xt(t,this.ft.fontScaleX)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontScaleY",{get:function(){return this.Et},set:function(t){this.Et=e.xt(t,this.ft.fontScaleY)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"letterSpacing",{get:function(){return this.jt},set:function(t){this.jt=e.xt(t,this.ft.letterSpacing)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationX",{get:function(){return this.dt},set:function(e){this.dt=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationY",{get:function(){return this._t},set:function(e){this._t=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationZ",{get:function(){return this.gt},set:function(t){this.gt=e.xt(t,this.ft.rotationZ)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skewX",{get:function(){return this.yt},set:function(e){this.yt=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skewY",{get:function(){return this.vt},set:function(e){this.vt=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"primaryColor",{get:function(){return this.Dt},set:function(t){this.Dt=e.xt(t,this.ft.primaryColor)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"secondaryColor",{get:function(){return this.zt},set:function(t){this.zt=e.xt(t,this.ft.secondaryColor)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this.Mt},set:function(t){this.Mt=e.xt(t,this.ft.outlineColor)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowColor",{get:function(){return this.Nt},set:function(t){this.Nt=e.xt(t,this.ft.shadowColor)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"primaryAlpha",{get:function(){return this.Ft},set:function(t){this.Ft=e.xt(t,this.ft.primaryColor.alpha)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"secondaryAlpha",{get:function(){return this.Ht},set:function(t){this.Ht=e.xt(t,this.ft.secondaryColor.alpha)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineAlpha",{get:function(){return this.Rt},set:function(t){this.Rt=e.xt(t,this.ft.outlineColor.alpha)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowAlpha",{get:function(){return this.It},set:function(t){this.It=e.xt(t,this.ft.shadowColor.alpha)},enumerable:!0,configurable:!0}),e.xt=function(e,t){return null!==e?e:t},e}();e.SpanStyles=i},function(e){function t(t){e.debugMode=t}function n(t){e.verboseMode=t}e.debugMode=!1,e.verboseMode=!1,e.setDebugMode=t,e.setVerboseMode=n},function(t,n){var r=n(26),i=n(29),o=n(28),a=n(27),l=n(23),s=n(1),u=n(2),p=n(30),c=n(32),h=function(){function t(){if(this.Ke=new o.ScriptProperties,this.Gt=new p.Map,this.qt=[],this.Ut=[],this.Kt=null,this.Zt=null,1===arguments.length)throw new Error("Constructor `new ASS(rawASS)` has been deprecated. Use `ASS.fromString(rawASS)` instead.");this.Gt.set("Default",new i.Style(new p.Map([["Name","Default"]])))}return Object.defineProperty(t.prototype,"properties",{get:function(){return this.Ke},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"styles",{get:function(){return this.Gt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dialogues",{get:function(){return this.qt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"attachments",{get:function(){return this.Ut},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stylesFormatSpecifier",{get:function(){return this.Kt},set:function(e){this.Kt=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dialoguesFormatSpecifier",{get:function(){return this.Zt},set:function(e){this.Zt=e},enumerable:!0,configurable:!0}),t.prototype.addStyle=function(e){var t=u.parseLineIntoTypedTemplate(e,this.Kt);if(null!==t&&"Style"===t.type){var n=t.template;if(l.verboseMode){var r="";n.forEach(function(e,t){return r+=t+" = "+e+", "}),console.log("Read style: "+r)}var o=new i.Style(n);this.Gt.set(o.name,o)}},t.prototype.addEvent=function(e){var t=u.parseLineIntoTypedTemplate(e,this.Zt);if(null!==t&&"Dialogue"===t.type){var n=t.template;if(l.verboseMode){var i="";n.forEach(function(e,t){return i+=t+" = "+e+", "}),console.log("Read dialogue: "+i)}this.dialogues.push(new r.Dialogue(n,this))}},t.prototype.addAttachment=function(e){this.Ut.push(e)},t.fromString=function(e,n){return void 0===n&&(n=a.Format.ASS),t.fromStream(new s.StringStream(e),n)},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(n,r){void 0===r&&(r=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(n).then(function(e){if(!1===e.ok||void 0===e.ok&&(e.status<200||e.status>299))throw new Error("HTTP request for "+n+" failed with status code "+e.status);return t.fromReadableStream(e.body,"utf-8",r)}):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),r);return i.open("GET",n,!0),i.send(),o})},t.fromReadableStream=function(e,n,r){return void 0===n&&(n="utf-8"),void 0===r&&(r=a.Format.ASS),t.fromStream(new s.BrowserReadableStream(e,n),r)},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.Jt=e,this.$t=t,this.Qt=""}return Object.defineProperty(e.prototype,"filename",{get:function(){return this.Jt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this.$t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contents",{get:function(){return this.Qt},set:function(e){this.Qt=e},enumerable:!0,configurable:!0}),e}();e.Attachment=t},function(e,t){var n=t(27),r=t(3),i=t(8),o=t(23),a=t(30),l=function(){function e(t,r){this.en=null,this.tn=!1;var i=new a.Map;t.forEach(function(e,t){i.set(t.toLowerCase(),e)}),t=i,this.De=++e.nn;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.Xe=r.styles.get(l),void 0===this.Xe&&(o.debugMode&&console.warn("Unrecognized style "+l+'. Falling back to "Default"'),this.Xe=r.styles.get("Default")),void 0===this.Xe)throw new Error("Unrecognized style "+l);if(this.s=e.rn(t.get("start")),this.u=e.rn(t.get("end")),this.in=Math.max(n.valueOrDefault(t,"layer",parseInt,function(e){return!isNaN(e)},"0"),0),this.on=t.get("text"),void 0===this.on||null===this.on||this.on.constructor!==String)throw new Error("Dialogue doesn't have any text.")}return Object.defineProperty(e.prototype,"id",{get:function(){return this.De},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.Xe},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return null===this.en&&this.an(),this.ln},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"layer",{get:function(){return this.in},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parts",{get:function(){return null===this.en&&this.an(),this.en},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containsTransformTag",{get:function(){return null===this.en&&this.an(),this.tn},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"#"+this.De+" ["+this.s.toFixed(3)+"-"+this.u.toFixed(3)+"] "+(null!==this.en?this.en.join(", "):this.on)},e.prototype.an=function(){var e=this;if(this.en=r.parse(this.on,"dialogueParts"),this.ln=this.Xe.alignment,this.en.forEach(function(t,n){t instanceof i.Alignment?e.ln=t.value:t instanceof i.Move?null!==t.t1&&null!==t.t2||(e.en[n]=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.en[n]=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.tn=!0)}),o.debugMode){var t=this.en.filter(function(e){return e instanceof i.Comment&&-1!==e.value.indexOf("\\")});t.length>0&&console.warn("Possible incorrect parse:\n"+this.on+"\nwas parsed as\n"+this.toString()+"\nThe possibly incorrect parses are:\n"+t.join("\n"))}},e.rn=function(e){return e.split(":").reduce(function(e,t){return 60*e+parseFloat(t)},0)},e.nn=-1,e}();e.Dialogue=l},function(e){function t(e,t,n,r,i){var o=e.get(t);if(void 0===o)return n(i);try{var a=n(o);if(null!==r&&!r(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=4]="OpaqueBox"}(e.BorderStyle||(e.BorderStyle={})),e.ASS_UNDEFINED_LINE_HEIGHT_RATIO=-1,e.ASS_CAPTION_PADDING_SPACE_CHAR=" ",e.valueOrDefault=t},function(e){var t=function(){function e(){}return Object.defineProperty(e.prototype,"resolutionX",{get:function(){return this.sn},set:function(e){this.sn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"resolutionY",{get:function(){return this.un},set:function(e){this.un=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"wrappingStyle",{get:function(){return this.pn},set:function(e){this.pn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scaleBorderAndShadow",{get:function(){return this.cn},set:function(e){this.cn=e},enumerable:!0,configurable:!0}),e}();e.ScriptProperties=t},function(e,t){var n=t(27),r=t(3),i=t(30),o=function(){function e(e){var t=new i.Map;if(e.forEach(function(e,n){t.set(n.toLowerCase(),e)}),e=t,this.hn=e.get("name"),void 0===this.hn||null===this.hn||this.hn.constructor!==String)throw new Error("Style doesn't have a name.");this.hn=this.hn.replace(/^\*+/,""),this.mt=!!n.valueOrDefault(e,"italic",parseFloat,function(e){return!isNaN(e)},"0"),this.bt=!!n.valueOrDefault(e,"bold",parseFloat,function(e){return!isNaN(e)},"0"),this.Ct=!!n.valueOrDefault(e,"underline",parseFloat,function(e){return!isNaN(e)},"0"),this.kt=!!n.valueOrDefault(e,"strikeout",parseFloat,function(e){return!isNaN(e)},"0"),this.Pt=n.valueOrDefault(e,"fontname",function(e){return e},function(e){return e.constructor===String},"sans-serif"),this.wt=n.valueOrDefault(e,"fontsize",parseFloat,function(e){return!isNaN(e)},"18"),this.St=n.valueOrDefault(e,"scalex",parseFloat,function(e){return e>=0},"100")/100,this.Et=n.valueOrDefault(e,"scaley",parseFloat,function(e){return e>=0},"100")/100,this.jt=n.valueOrDefault(e,"spacing",parseFloat,function(e){return e>=0},"0"),this.gt=n.valueOrDefault(e,"angle",parseFloat,function(e){return!isNaN(e)},"0"),this.Dt=n.valueOrDefault(e,"primarycolour",function(e){return r.parse(e,"colorWithAlpha")},null,"&H00FFFFFF"),this.zt=n.valueOrDefault(e,"secondarycolour",function(e){return r.parse(e,"colorWithAlpha")},null,"&H00FFFF00"),this.Mt=n.valueOrDefault(e,"outlinecolour",function(e){return r.parse(e,"colorWithAlpha")},null,"&H00000000"),this.Nt=n.valueOrDefault(e,"backcolour",function(e){return r.parse(e,"colorWithAlpha")},null,"&H80000000"),this.fn=n.valueOrDefault(e,"outline",parseFloat,function(e){return e>=0},"2"),this.dn=n.valueOrDefault(e,"borderstyle",parseInt,function(e){return n.BorderStyle[n.BorderStyle[e]]===e},"1"),this._n=n.valueOrDefault(e,"shadow",parseFloat,function(e){return e>=0},"3"),this.ln=n.valueOrDefault(e,"alignment",parseInt,function(e){return e>=1&&e<=9},"2"),this.gn=n.valueOrDefault(e,"marginl",parseFloat,function(e){return!isNaN(e)},"20"),this.yn=n.valueOrDefault(e,"marginr",parseFloat,function(e){return!isNaN(e)},"20"),this.vn=n.valueOrDefault(e,"marginv",parseFloat,function(e){return!isNaN(e)},"20"),this.Ot=n.valueOrDefault(e,"lineHeightRatio",parseFloat,function(e){return!isNaN(e)},n.ASS_UNDEFINED_LINE_HEIGHT_RATIO.toString())}return Object.defineProperty(e.prototype,"name",{get:function(){return this.hn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"italic",{get:function(){return this.mt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bold",{get:function(){return this.bt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"underline",{get:function(){return this.Ct},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"strikeThrough",{get:function(){return this.kt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontName",{get:function(){return this.Pt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){return this.wt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontScaleX",{get:function(){return this.St},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontScaleY",{get:function(){return this.Et},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"letterSpacing",{get:function(){return this.jt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationZ",{get:function(){return this.gt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"primaryColor",{get:function(){return this.Dt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"secondaryColor",{get:function(){return this.zt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this.Mt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowColor",{get:function(){return this.Nt},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineThickness",{get:function(){return this.fn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"borderStyle",{get:function(){return this.dn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowDepth",{get:function(){return this._n},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this.ln},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"marginLeft",{get:function(){return this.gn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"marginRight",{get:function(){return this.yn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"marginVertical",{get:function(){return this.vn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineHeightRatio",{get:function(){return this.Ot},enumerable:!0,configurable:!0}),e}();e.Style=o},function(t){function n(e){t.Map=null!==e?e:r}t.Map=e.Map;var r=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 n=e[t];this.set(n[0],n[1])}}}return e.prototype.get=function(e){var t=this.mn(e);if(null!==t)return this.bn[t]},e.prototype.has=function(e){var t=this.mn(e);return null!==t&&t in this.wn},e.prototype.set=function(e,t){var n=this.mn(e);if(null===n)throw new Error("This Map implementation only supports Number and String keys, or keys with an id property.");return n in this.wn||this.Sn++,this.wn[n]=e,this.bn[n]=t,this},e.prototype.delete=function(e){var t=this.mn(e);if(null===t)return!1;var n=t in this.wn;return n&&(delete this.wn[t],delete this.bn[t],this.Sn--),n},e.prototype.clear=function(){this.wn=Object.create(null),this.bn=Object.create(null),this.Sn=0},e.prototype.forEach=function(e,t){for(var n=0,r=Object.keys(this.wn);n<r.length;n++){var i=r[n];e.call(t,this.bn[i],this.wn[i],this)}},Object.defineProperty(e.prototype,"size",{get:function(){return this.Sn},enumerable:!0,configurable:!0}),e.prototype.mn=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=r),t.setImplementation=n},function(e){function t(e,t){for(var n=0;n<t.length;n++)for(var r=t[n],i=0,o=Object.getOwnPropertyNames(r.prototype);i<o.length;i++){var a=o[i];e.prototype[a]=r.prototype[a]}}e.mixin=t},function(t){function n(e){t.Promise=null!==e?e:s}function r(e){return i(e,[])}function i(e,n){if(0===e.length)return t.Promise.reject(n);var r=e[0],o=e.slice(1);return r.catch(function(e){return i(o,n.concat(e))})}function o(e){return new t.Promise(function(n,r){return t.Promise.all(e.map(function(e){return e.then(n,function(e){return e})})).then(r)})}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 n=[],r=!1,i=document.createElement("div");return new t(function(){for(var e=n.splice(0,n.length),t=0;t<e.length;t++){(0,e[t])()}r=!1,n.length>0&&(i.classList.toggle("foo"),r=!0)}).observe(i,{attributes:!0}),function(e){n.push(e),r||(i.classList.toggle("foo"),r=!0)}}return function(e){return setTimeout(e,0)}}(),s=function(){function e(e){if(this.On=u.PENDING,this.Pn=[],this.Cn=[],this.kn=null,this.En=null,"function"!=typeof e)throw new TypeError('typeof executor !== "function"');var t=this.xn(),n=t.resolve,r=t.reject;try{e(n,r)}catch(e){r(e)}}return e.prototype.then=function(e,t){var n=new p;"function"!=typeof e&&(e=function(e){return e}),"function"!=typeof t&&(t=function(e){throw e});var r={capabilities:n,handler:e},i={capabilities:n,handler:t};switch(this.On){case u.PENDING:this.Pn.push(r),this.Cn.push(i);break;case u.FULFILLED:this.jn(r,this.kn);break;case u.REJECTED:this.An(i,this.En)}return n.promise},e.prototype.catch=function(e){return this.then(null,e)},e.resolve=function(n){return n instanceof e?n:new t.Promise(function(e){return e(n)})},e.reject=function(e){return new t.Promise(function(t,n){return n(e)})},e.all=function(e){return new t.Promise(function(n,r){var i=[],o=e.length;if(0===o)return void n(i);e.forEach(function(e,a){return t.Promise.resolve(e).then(function(e){i[a]=e,0===--o&&n(i)},r)})})},e.race=function(e){return new t.Promise(function(n,r){for(var i=0;i<e.length;i++){var o=e[i];t.Promise.resolve(o).then(n,r)}})},e.prototype.xn=function(){var e=this,t=!1;return{resolve:function(n){if(!t){if(t=!0,n===e)return void e.Tn(new TypeError("resolution === this"));if(null===n||"object"!=typeof n&&"function"!=typeof n)return void e.Dn(n);try{var r=n.then}catch(t){return void e.Tn(t)}if("function"!=typeof r)return void e.Dn(n);l(function(){return e.Fn(n,r)})}},reject:function(n){t||(t=!0,e.Tn(n))}}},e.prototype.Fn=function(e,t){var n=this.xn(),r=n.resolve,i=n.reject;try{t.call(e,r,i)}catch(e){i(e)}},e.prototype.Dn=function(e){var t=this.Pn;this.kn=e,this.Pn=void 0,this.Cn=void 0,this.On=u.FULFILLED;for(var n=0;n<t.length;n++){var r=t[n];this.jn(r,e)}},e.prototype.Tn=function(e){var t=this.Cn;this.En=e,this.Pn=void 0,this.Cn=void 0,this.On=u.REJECTED;for(var n=0;n<t.length;n++){var r=t[n];this.An(r,e)}},e.prototype.jn=function(e,t){l(function(){var n,r=e.capabilities,i=r.resolve,o=r.reject,a=e.handler;try{n=a(t)}catch(e){return void o(e)}i(n)})},e.prototype.An=function(e,t){l(function(){var n,r=e.capabilities,i=r.resolve,o=r.reject,a=e.handler;try{n=a(t)}catch(e){return void o(e)}i(n)})},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=n;var p=function(){function e(){var e=this;this.Mn=new t.Promise(function(t,n){Object.defineProperties(e,{resolve:{value:t,enumerable:!0},reject:{value:n,enumerable:!0}})})}return Object.defineProperty(e.prototype,"promise",{get:function(){return this.Mn},enumerable:!0,configurable:!0}),e}();t.DeferredPromise=p,t.first=r,t.any=o,t.lastly=a},function(t){function n(e){t.Set=null!==e?e:r}t.Set=e.Set;var r=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 n=e[t];this.add(n)}}}return e.prototype.add=function(e){var t=this.Rn(e);if(null===t)throw new Error("This Set implementation only supports Number and String values.");return t in this.Nn||this.Sn++,this.Nn[t]=e,this},e.prototype.clear=function(){this.Nn=Object.create(null),this.Sn=0},e.prototype.has=function(e){var t=this.Rn(e);return null!==t&&t in this.Nn},e.prototype.forEach=function(e,t){for(var n=0,r=Object.keys(this.Nn);n<r.length;n++){var i=r[n],o=this.Nn[i];e.call(t,o,o,this)}},Object.defineProperty(e.prototype,"size",{get:function(){return this.Sn},enumerable:!0,configurable:!0}),e.prototype.Rn=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=r),t.setImplementation=n},function(e){function t(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);n.prototype=t.prototype,e.prototype=new n}function n(e,t,n){if(arguments.length<3)return r(e.reverse(),t);i(e.reverse(),t,n)}function r(e,t){for(var n=0;n<e.length;n++){t=(0,e[n])(t)||t}return t}function i(e,t,n){for(var r=0;r<e.length;r++){(0,e[r])(t,n)}}e.xe=t,e.X=n},function(e,t){var n=t(30),r=t(32),i=t(36),o=t(38),a=function(){function e(e){var t=this;this.In=e,this.Wn=new n.Map,this.In.addEventListener("message",function(e){return t.Ln(e.data)},!1)}return e.prototype.request=function(t,n){var i=new r.DeferredPromise,a=++e.Xn;this.Wn.set(a,i);var l={requestId:a,command:t,parameters:n};return this.In.postMessage(o.serialize(l)),i.promise},e.prototype.cancelRequest=function(e){var t=this.Wn.get(e);void 0!==t&&(this.Wn.delete(e),t.reject(new Error("Cancelled.")))},e.prototype.Yn=function(e){var t=e.requestId,n=e.error,r=e.result;n instanceof Error&&(n={message:n.message,stack:n.stack}),this.In.postMessage(o.serialize({command:i.WorkerCommands.Response,requestId:t,error:n,result:r}))},e.prototype.Ln=function(e){var t=this,n=o.deserialize(e);if(n.command===i.WorkerCommands.Response){var r=n,a=this.Wn.get(r.requestId);void 0!==a&&(this.Wn.delete(r.requestId),null===r.error?a.resolve(r.result):a.reject(r.error))}else{var l=n,s=l.requestId,u=o.getWorkerCommandHandler(l.command);if(void 0===u)return void this.Yn({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.Yn(e)})}},e.Xn=-1,e}();e.WorkerChannelImpl=a,o.registerWorkerCommand(i.WorkerCommands.Ping,function(){return new r.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,n){function r(e){return void 0===e&&(e=a.src),new i.WorkerChannelImpl(new Worker(e))}var i=n(35),o=n(36);t.WorkerCommands=o.WorkerCommands,t.supported="undefined"!=typeof Worker;var a="undefined"!=typeof document&&void 0!==document.currentScript?document.currentScript:null;t.createWorker=r,"undefined"!=typeof WorkerGlobalScope&&e instanceof WorkerGlobalScope&&new i.WorkerChannelImpl(e)},function(e,t){function n(e,t){s.set(e,t)}function r(e){return s.get(e)}function i(e){e.Vn=u.size,u.set(e.Vn,e)}function o(e){return JSON.stringify(e,function(e,t){return t&&void 0!==t.Vn&&(t.Vn=t.Vn),t})}function a(e){return JSON.parse(e,function(e,t){if(t&&void 0!==t.Vn){for(var n=Object.create(u.get(t.Vn)),r=0,i=Object.keys(t);r<i.length;r++){var o=i[r];"_classTag"!==o&&(n[o]=t[o])}t=n}return t})}var l=t(30),s=new l.Map,u=new l.Map;e.registerWorkerCommand=n,e.getWorkerCommandHandler=r,e.registerClassPrototype=i,e.serialize=o,e.deserialize=a}])});
//# sourceMappingURL=libjass.min.js.map