ass-compiler
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -241,6 +241,2 @@ (function (global, factory) { | ||
function parseFormat(text) { | ||
return text.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/); | ||
} | ||
var assign = Object.assign || ( | ||
@@ -304,3 +300,3 @@ /* istanbul ignore next */ | ||
if (/^Format\s*:/i.test(line)) { | ||
tree.styles.format = parseFormat(line); | ||
tree.styles.format = stylesFormat.concat(); | ||
} | ||
@@ -313,3 +309,3 @@ if (/^Style\s*:/i.test(line)) { | ||
if (/^Format\s*:/i.test(line)) { | ||
tree.events.format = parseFormat(line); | ||
tree.events.format = eventsFormat.concat(); | ||
} | ||
@@ -316,0 +312,0 @@ if (/^(?:Comment|Dialogue)\s*:/i.test(line)) { |
@@ -1,1 +0,1 @@ | ||
(function(t,r){typeof exports==="object"&&typeof module!=="undefined"?r(exports):typeof define==="function"&&define.amd?define(["exports"],r):(t=t||self,r(t.assCompiler={}))})(this,function(t){"use strict";function f(t){var r=t.toLowerCase().trim().split(/\s*;\s*/);if(r[0]==="banner"){return{name:r[0],delay:r[1]*1||0,leftToRight:r[2]*1||0,fadeAwayWidth:r[3]*1||0}}if(/^scroll\s/.test(r[0])){return{name:r[0],y1:Math.min(r[1]*1,r[2]*1),y2:Math.max(r[1]*1,r[2]*1),delay:r[3]*1||0,fadeAwayHeight:r[4]*1||0}}return null}function h(t){if(!t){return[]}return t.toLowerCase().replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/g," $1 ").replace(/([mnlbspc])/g," $1 ").trim().replace(/\s+/g," ").split(/\s(?=[mnlbspc])/).map(function(t){return t.split(" ").filter(function(t,r){return!(r&&isNaN(t*1))})})}var r=["b","i","u","s","fsp","k","K","kf","ko","kt","fe","q","p","pbo","a","an","fscx","fscy","fax","fay","frx","fry","frz","fr","be","blur","bord","xbord","ybord","shad","xshad","yshad"];var x=r.map(function(t){return{name:t,regex:new RegExp("^"+t+"-?\\d")}});function S(t){var r;var e={};for(var a=0;a<x.length;a++){var n=x[a];var i=n.name;var s=n.regex;if(s.test(t)){e[i]=t.slice(i.length)*1;return e}}if(/^fn/.test(t)){e.fn=t.slice(2)}else if(/^r/.test(t)){e.r=t.slice(1)}else if(/^fs[\d+-]/.test(t)){e.fs=t.slice(2)}else if(/^\d?c&?H?[0-9a-f]+|^\d?c$/i.test(t)){var o=t.match(/^(\d?)c&?H?(\w*)/);var f=o[1];var l=o[2];e["c"+(f||1)]=l&&("000000"+l).slice(-6)}else if(/^\da&?H?[0-9a-f]+/i.test(t)){var u=t.match(/^(\d)a&?H?(\w\w)/);var c=u[1];var v=u[2];e["a"+c]=v}else if(/^alpha&?H?[0-9a-f]+/i.test(t)){r=t.match(/^alpha&?H?([0-9a-f]+)/i),e.alpha=r[1];e.alpha=("00"+e.alpha).slice(-2)}else if(/^(?:pos|org|move|fad|fade)\([^)]+/.test(t)){var p=t.match(/^(\w+)\((.*?)\)?$/);var d=p[1];var y=p[2];e[d]=y.trim().split(/\s*,\s*/).map(Number)}else if(/^i?clip\([^)]+/.test(t)){var g=t.match(/^i?clip\((.*?)\)?$/)[1].trim().split(/\s*,\s*/);e.clip={inverse:/iclip/.test(t),scale:1,drawing:null,dots:null};if(g.length===1){e.clip.drawing=h(g[0])}if(g.length===2){e.clip.scale=g[0]*1;e.clip.drawing=h(g[1])}if(g.length===4){e.clip.dots=g.map(Number)}}else if(/^t\(/.test(t)){var m=t.match(/^t\((.*?)\)?$/)[1].trim().replace(/\\.*/,function(t){return t.replace(/,/g,"\n")}).split(/\s*,\s*/);if(!m[0]){return e}e.t={t1:0,t2:0,accel:1,tags:m[m.length-1].replace(/\n/g,",").split("\\").slice(1).map(S)};if(m.length===2){e.t.accel=m[0]*1}if(m.length===3){e.t.t1=m[0]*1;e.t.t2=m[1]*1}if(m.length===4){e.t.t1=m[0]*1;e.t.t2=m[1]*1;e.t.accel=m[2]*1}}return e}function s(t){var r=[];var e=0;var a="";var n=t.split("\\").slice(1).concat("").join("\\");for(var i=0;i<n.length;i++){var s=n[i];if(s==="("){e++}if(s===")"){e--}if(e<0){e=0}if(!e&&s==="\\"){if(a){r.push(a)}a=""}else{a+=s}}return r.map(S)}function l(t){var r=t.split(/{([^{}]*?)}/);var e=[];if(r[0].length){e.push({tags:[],text:r[0],drawing:[]})}for(var a=1;a<r.length;a+=2){var n=s(r[a]);var i=n.reduce(function(t,r){return r.p===undefined?t:!!r.p},false);e.push({tags:n,text:i?"":r[a+1],drawing:i?h(r[a+1]):[]})}return{raw:t,combined:e.map(function(t){return t.text}).join(""),parsed:e}}function u(t){var r=t.split(":");return r[0]*3600+r[1]*60+r[2]*1}function v(t,r){var e=t.split(",");if(e.length>r.length){var a=e.slice(r.length-1).join();e=e.slice(0,r.length-1);e.push(a)}var n={};for(var i=0;i<e.length;i++){var s=r[i];var o=e[i].trim();switch(s){case"Layer":case"MarginL":case"MarginR":case"MarginV":n[s]=o*1;break;case"Start":case"End":n[s]=u(o);break;case"Effect":n[s]=f(o);break;case"Text":n[s]=l(o);break;default:n[s]=o}}return n}function p(t){return t.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/)}var I=Object.assign||function t(r){var e=[],a=arguments.length-1;while(a-- >0)e[a]=arguments[a+1];for(var n=0;n<e.length;n++){if(!e[n]){continue}var i=Object.keys(e[n]);for(var s=0;s<i.length;s++){r[i[s]]=e[n][i[s]]}}return r};var o=["Name","Fontname","Fontsize","PrimaryColour","SecondaryColour","OutlineColour","BackColour","Bold","Italic","Underline","StrikeOut","ScaleX","ScaleY","Spacing","Angle","BorderStyle","Outline","Shadow","Alignment","MarginL","MarginR","MarginV","Encoding"];var c=["Layer","Start","End","Style","Name","MarginL","MarginR","MarginV","Effect","Text"];function d(t,r){var a=t.match(/Style\s*:\s*(.*)/i)[1].split(/\s*,\s*/);return I.apply(void 0,[{}].concat(r.map(function(t,r){var e;return e={},e[t]=a[r],e})))}function n(t){var r={info:{},styles:{format:[],style:[]},events:{format:[],comment:[],dialogue:[]}};var e=t.split(/\r?\n/);var a=0;for(var n=0;n<e.length;n++){var i=e[n].trim();if(/^;/.test(i)){continue}if(/^\[Script Info\]/i.test(i)){a=1}else if(/^\[V4\+? Styles\]/i.test(i)){a=2}else if(/^\[Events\]/i.test(i)){a=3}else if(/^\[.*\]/.test(i)){a=0}if(a===0){continue}if(a===1){if(/:/.test(i)){var s=i.match(/(.*?)\s*:\s*(.*)/);var o=s[1];var f=s[2];r.info[o]=f}}if(a===2){if(/^Format\s*:/i.test(i)){r.styles.format=p(i)}if(/^Style\s*:/i.test(i)){r.styles.style.push(d(i,r.styles.format))}}if(a===3){if(/^Format\s*:/i.test(i)){r.events.format=p(i)}if(/^(?:Comment|Dialogue)\s*:/i.test(i)){var l=i.match(/^(\w+?)\s*:\s*(.*)/i);var u=l[1];var c=l[2];r.events[u.toLowerCase()].push(v(c,r.events.format))}}}return r}function y(r){return Object.keys(r).map(function(t){return t+": "+r[t]}).join("\n")}function i(t){return("00"+t).slice(-2)}function e(t){var r=t.toFixed(2).slice(-2);var e=(t|0)%60;var a=(t/60|0)%60;var n=t/3600|0;return n+":"+i(a)+":"+i(e)+"."+r}function a(t){if(!t){return""}if(t.name==="banner"){return"Banner;"+t.delay+";"+t.leftToRight+";"+t.fadeAwayWidth}return t.name.replace(/^\w/,function(t){return t.toUpperCase()})+";"+t.y1+";"+t.y2+";"+t.delay+";"+t.fadeAwayHeight}function g(t){return t.map(function(t){return t.join(" ")}).join(" ")}function m(t){var r=Object.keys(t);var e=r[0];if(!e){return""}var a=t[e];if(["pos","org","move","fad","fade"].some(function(t){return t===e})){return"\\"+e+"("+a+")"}if(/^[ac]\d$/.test(e)){return"\\"+e[1]+e[0]+"&H"+a+"&"}if(e==="alpha"){return"\\alpha&H"+a+"&"}if(e==="clip"){return"\\"+(a.inverse?"i":"")+"clip("+(a.dots||""+(a.scale===1?"":a.scale+",")+g(a.drawing))+")"}if(e==="t"){return"\\t("+[a.t1,a.t2,a.accel,a.tags.map(m).join("")]+")"}return"\\"+e+a}function b(t){return t.parsed.map(function(t){var r=t.tags;var e=t.text;var a=t.drawing;var n=r.map(m).join("");var i=a.length?g(a):e;return""+(n?"{"+n+"}":"")+i}).join("")}function w(t){var r="0000";return[t.Layer,e(t.Start),e(t.End),t.Style,t.Name,t.MarginL||r,t.MarginR||r,t.MarginV||r,a(t.Effect),b(t.Text)].join()}function M(t){var r;var e=t.info;var a=t.styles;var n=t.events;return["[Script Info]",y(e),"","[V4+ Styles]","Format: "+o.join(", ")].concat(a.style.map(function(r){return"Style: "+o.map(function(t){return r[t]}).join()}),[""],["[Events]"],["Format: "+c.join(", ")],(r=[]).concat.apply(r,["Comment","Dialogue"].map(function(r){return n[r.toLowerCase()].map(function(t){return{start:t.Start,end:t.End,string:r+": "+w(t)}})})).sort(function(t,r){return t.start-r.start||t.end-r.end}).map(function(t){return t.string}),[""]).join("\n")}function j(t){var r={type:null,prev:null,next:null,points:[]};if(/[mnlbs]/.test(t[0])){r.type=t[0].toUpperCase().replace("N","L").replace("B","C")}for(var e=t.length-!(t.length&1),a=1;a<e;a+=2){r.points.push({x:t[a]*1,y:t[a+1]*1})}return r}function C(t){if(!t.points.length||!t.type){return false}if(/C|S/.test(t.type)&&t.points.length<3){return false}return true}function k(t){var r;var a=Infinity;var n=Infinity;var i=-Infinity;var s=-Infinity;(r=[]).concat.apply(r,t.map(function(t){var r=t.points;return r})).forEach(function(t){var r=t.x;var e=t.y;a=Math.min(a,r);n=Math.min(n,e);i=Math.max(i,r);s=Math.max(s,e)});return{minX:a,minY:n,width:i-a,height:s-n}}function O(t,r,e){var a=[];var n=[0,2/3,1/3,0];var i=[0,1/3,2/3,0];var s=[0,1/6,2/3,1/6];var o=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]*r[3]};var f=[t[t.length-1].x,t[0].x,t[1].x,t[2].x];var l=[t[t.length-1].y,t[0].y,t[1].y,t[2].y];a.push({type:r==="M"?"M":"L",points:[{x:o(s,f),y:o(s,l)}]});for(var u=3;u<t.length;u++){f=[t[u-3].x,t[u-2].x,t[u-1].x,t[u].x];l=[t[u-3].y,t[u-2].y,t[u-1].y,t[u].y];a.push({type:"C",points:[{x:o(n,f),y:o(n,l)},{x:o(i,f),y:o(i,l)},{x:o(s,f),y:o(s,l)}]})}if(e==="L"||e==="C"){var c=t[t.length-1];a.push({type:"L",points:[{x:c.x,y:c.y}]})}return a}function F(t){return t.map(function(t){var r=t.type;var e=t.points;return r+e.map(function(t){var r=t.x;var e=t.y;return r+","+e}).join(",")}).join("")}function B(t){var r;var e=[];var a=0;while(a<t.length){var n=t[a];var i=j(n);if(C(i)){if(i.type==="S"){var s=(e[a-1]||{points:[{x:0,y:0}]}).points.slice(-1)[0];var o=s.x;var f=s.y;i.points.unshift({x:o,y:f})}if(a){i.prev=e[a-1].type;e[a-1].next=i.type}e.push(i);a++}else{if(a&&e[a-1].type==="S"){var l={p:i.points,c:e[a-1].points.slice(0,3)};e[a-1].points=e[a-1].points.concat((l[n[0]]||[]).map(function(t){var r=t.x;var e=t.y;return{x:r,y:e}}))}t.splice(a,1)}}var u=(r=[]).concat.apply(r,e.map(function(t){var r=t.type;var e=t.points;var a=t.prev;var n=t.next;return r==="S"?O(e,a,n):{type:r,points:e}}));return I({instructions:u,d:F(u)},k(e))}var V=["fs","clip","c1","c2","c3","c4","a1","a2","a3","a4","alpha","fscx","fscy","fax","fay","frx","fry","frz","fr","be","blur","bord","xbord","ybord","shad","xshad","yshad"];function $(t,r,e){var a,n,i;if(e===void 0)e={};var s=t[r];if(s===undefined){return null}if(r==="pos"||r==="org"){return s.length===2?(a={},a[r]={x:s[0],y:s[1]},a):null}if(r==="move"){var o=s[0];var f=s[1];var l=s[2];var u=s[3];var c=s[4];if(c===void 0)c=0;var v=s[5];if(v===void 0)v=0;return s.length===4||s.length===6?{move:{x1:o,y1:f,x2:l,y2:u,t1:c,t2:v}}:null}if(r==="fad"||r==="fade"){if(s.length===2){var p=s[0];var d=s[1];return{fade:{type:"fad",t1:p,t2:d}}}if(s.length===7){var y=s[0];var g=s[1];var m=s[2];var h=s[3];var x=s[4];var S=s[5];var b=s[6];return{fade:{type:"fade",a1:y,a2:g,a3:m,t1:h,t2:x,t3:S,t4:b}}}return null}if(r==="clip"){var w=s.inverse;var M=s.scale;var j=s.drawing;var C=s.dots;if(j){return{clip:{inverse:w,scale:M,drawing:B(j),dots:C}}}if(C){var k=C[0];var O=C[1];var F=C[2];var E=C[3];return{clip:{inverse:w,scale:M,drawing:j,dots:{x1:k,y1:O,x2:F,y2:E}}}}return null}if(/^[xy]?(bord|shad)$/.test(r)){s=Math.max(s,0)}if(r==="bord"){return{xbord:s,ybord:s}}if(r==="shad"){return{xshad:s,yshad:s}}if(/^c\d$/.test(r)){return n={},n[r]=s||e[r],n}if(r==="alpha"){return{a1:s,a2:s,a3:s,a4:s}}if(r==="fr"){return{frz:s}}if(r==="fs"){return{fs:/^\+|-/.test(s)?(s*1>-10?1+s/10:1)*e.fs:s*1}}if(r==="K"){return{kf:s}}if(r==="t"){var H=s.t1;var L=s.accel;var N=s.tags;var R=s.t2||(e.end-e.start)*1e3;var A={};N.forEach(function(t){var r=Object.keys(t)[0];if(~V.indexOf(r)&&!(r==="clip"&&!t[r].dots)){I(A,$(t,r,e))}});return{t:{t1:H,t2:R,accel:L,tag:A}}}return i={},i[r]=s,i}var P=[null,1,2,3,null,7,8,9,null,4,5,6];var D=["r","a","an","pos","org","move","fade","fad","clip"];function z(t){return JSON.parse(JSON.stringify(I({},t,{k:undefined,kf:undefined,ko:undefined,kt:undefined})))}function E(t){var r=t.styles;var e=t.style;var a=t.parsed;var n=t.start;var i=t.end;var s;var o;var f;var l;var u;var c;var v=[];var p={style:e,fragments:[]};var d={};for(var y=0;y<a.length;y++){var g=a[y];var m=g.tags;var h=g.text;var x=g.drawing;var S=void 0;for(var b=0;b<m.length;b++){var w=m[b];S=w.r===undefined?S:w.r}var M={tag:S===undefined?z(d):{},text:h,drawing:x.length?B(x):null};for(var j=0;j<m.length;j++){var C=m[j];s=s||P[C.a||0]||C.an;o=o||$(C,"pos");f=f||$(C,"org");l=l||$(C,"move");u=u||$(C,"fade")||$(C,"fad");c=$(C,"clip")||c;var k=Object.keys(C)[0];if(k&&!~D.indexOf(k)){var O=r[e].tag;var F=O.c1;var E=O.c2;var H=O.c3;var L=O.c4;var N=d.fs||O.fs;var R=$(C,k,{start:n,end:i,c1:F,c2:E,c3:H,c4:L,fs:N});if(k==="t"){M.tag.t=M.tag.t||[];M.tag.t.push(R.t)}else{I(M.tag,R)}}}d=M.tag;if(S!==undefined){v.push(p);p={style:r[S]?S:e,fragments:[]}}if(M.text||M.drawing){var A=p.fragments[p.fragments.length-1]||{};if(A.text&&M.text&&!Object.keys(M.tag).length){A.text+=M.text}else{p.fragments.push(M)}}}v.push(p);return I({alignment:s,slices:v},o,f,l,u,c)}function H(t){var r=t.styles;var e=t.dialogues;var a=Infinity;var n=[];for(var i=0;i<e.length;i++){var s=e[i];if(s.Start>=s.End){continue}if(!r[s.Style]){s.Style="Default"}var o=r[s.Style].style;var f=E({styles:r,style:s.Style,parsed:s.Text.parsed,start:s.Start,end:s.End});var l=f.alignment||o.Alignment;a=Math.min(a,s.Layer);n.push(I({layer:s.Layer,start:s.Start,end:s.End,style:s.Style,name:s.Name,margin:{left:s.MarginL||o.MarginL,right:s.MarginR||o.MarginR,vertical:s.MarginV||o.MarginV},effect:s.Effect},f,{alignment:l}))}for(var u=0;u<n.length;u++){n[u].layer-=a}return n.sort(function(t,r){return t.start-r.start||t.end-r.end})}var L={Name:"Default",Fontname:"Arial",Fontsize:"20",PrimaryColour:"&H00FFFFFF&",SecondaryColour:"&H000000FF&",OutlineColour:"&H00000000&",BackColour:"&H00000000&",Bold:"0",Italic:"0",Underline:"0",StrikeOut:"0",ScaleX:"100",ScaleY:"100",Spacing:"0",Angle:"0",BorderStyle:"1",Outline:"2",Shadow:"2",Alignment:"2",MarginL:"10",MarginR:"10",MarginV:"10",Encoding:"1"};function N(t){if(/^(&|H|&H)[0-9a-f]{6,}/i.test(t)){var r=t.match(/&?H?([0-9a-f]{2})?([0-9a-f]{6})/i);var e=r[1];var a=r[2];return[e||"00",a]}var n=parseInt(t,10);if(!isNaN(n)){var i=-2147483648;var s=2147483647;if(n<i){return["00","000000"]}var o=i<=n&&n<=s?("00000000"+(n<0?n+4294967296:n).toString(16)).slice(-8):String(n).slice(0,8);return[o.slice(0,2),o.slice(2)]}return["00","000000"]}function R(t){var y=t.info;var r=t.style;var e=t.defaultStyle;var g={};var m=[I({},L,e,{Name:"Default"})].concat(r);var a=function(t){var r=m[t];if(/^(\*+)Default$/.test(r.Name)){r.Name="Default"}Object.keys(r).forEach(function(t){if(t!=="Name"&&t!=="Fontname"&&!/Colour/.test(t)){r[t]*=1}});var e=N(r.PrimaryColour);var a=e[0];var n=e[1];var i=N(r.SecondaryColour);var s=i[0];var o=i[1];var f=N(r.OutlineColour);var l=f[0];var u=f[1];var c=N(r.BackColour);var v=c[0];var p=c[1];var d={fn:r.Fontname,fs:r.Fontsize,c1:n,a1:a,c2:o,a2:s,c3:u,a3:l,c4:p,a4:v,b:Math.abs(r.Bold),i:Math.abs(r.Italic),u:Math.abs(r.Underline),s:Math.abs(r.StrikeOut),fscx:r.ScaleX,fscy:r.ScaleY,fsp:r.Spacing,frz:r.Angle,xbord:r.Outline,ybord:r.Outline,xshad:r.Shadow,yshad:r.Shadow,fe:r.Encoding,q:/^[0-3]$/.test(y.WrapStyle)?y.WrapStyle*1:2};g[r.Name]={style:r,tag:d}};for(var n=0;n<m.length;n++)a(n);return g}function A(t,r){if(r===void 0)r={};var e=n(t);var a=R({info:e.info,style:e.styles.style,defaultStyle:r.defaultStyle||{}});return{info:e.info,width:e.info.PlayResX*1||null,height:e.info.PlayResY*1||null,collisions:e.info.Collisions||"Normal",styles:a,dialogues:H({styles:a,dialogues:e.events.dialogue})}}function T(t){var r=t.style;var e=t.tag;var a=I({},r,{PrimaryColour:"&H"+e.a1+e.c1,SecondaryColour:"&H"+e.a2+e.c2,OutlineColour:"&H"+e.a3+e.c3,BackColour:"&H"+e.a4+e.c4});return"Style: "+o.map(function(t){return a[t]}).join()}var X={M:"m",L:"l",C:"b"};function Y(t){var r=t.instructions;return r.map(function(t){var r;var e=t.type;var a=t.points;return(r=[X[e]]).concat.apply(r,a.map(function(t){var r=t.x;var e=t.y;return[r,e]})).join(" ")}).join(" ")}var U=function(e){return function(r){return function(t){return""+r+e+"&H"+t+"&"}}};var J=U("c");var W=U("a");var q={c1:J(1),c2:J(2),c3:J(3),c4:J(4),a1:W(1),a2:W(2),a3:W(3),a4:W(4),pos:function(t){return"pos("+[t.x,t.y]+")"},org:function(t){return"org("+[t.x,t.y]+")"},move:function(t){return"move("+[t.x1,t.y1,t.x2,t.y2,t.t1,t.t2]+")"},fade:function(t){return t.type==="fad"?"fad("+[t.t1,t.t2]+")":"fade("+[t.a1,t.a2,t.a3,t.t1,t.t2,t.t3,t.t4]+")"},clip:function(t){return(t.inverse?"i":"")+"clip("+(t.dots?""+[t.dots.x1,t.dots.y1,t.dots.x2,t.dots.y2]:""+(t.scale===1?"":t.scale+",")+Y(t.drawing))+")"},t:function(t){return t.map(function(t){return"t("+[t.t1,t.t2,t.accel,K(t.tag)]+")"}).join("\\")}};function K(e){return Object.keys(e).map(function(r){var t=q[r]||function(t){return""+r+t};return"\\"+t(e[r])}).join("")}function _(t){return t.fragments.map(function(t){var r=t.tag;var e=t.text;var a=t.drawing;var n=K(r);return""+(n?"{"+n+"}":"")+(a?Y(a):e)}).join("")}function G(i,s){return i.slices.map(function(t,r){var e=JSON.parse(JSON.stringify(t));var a=e.fragments[0];var n=a.tag;if(r){n.r=t.style===i.style?"":t.style}else{if(s.Alignment!==i.alignment){n.an=i.alignment}["pos","org","move","fade","clip"].forEach(function(t){if(i[t]){n[t]=i[t]}})}return e}).map(_).join("")}function Q(t,r){return t===r?"0000":t}function Z(t,r){return"Dialogue: "+[t.layer,e(t.start),e(t.end),t.style,t.name,Q(t.margin.left,r.MarginL),Q(t.margin.right,r.MarginR),Q(t.margin.vertical,r.MarginV),a(t.effect),G(t,r)].join()}function tt(t){var r=t.info;var e=t.width;var a=t.height;var n=t.collisions;var i=t.styles;var s=t.dialogues;return["[Script Info]",y(I({},r,{PlayResX:e,PlayResY:a,Collisions:n})),"","[V4+ Styles]","Format: "+o.join(", ")].concat(Object.keys(i).map(function(t){return T(i[t])}),[""],["[Events]"],["Format: "+c.join(", ")],s.sort(function(t,r){return t.start-r.start||t.end-r.end}).map(function(t){return Z(t,i[t.style].style)}),[""]).join("\n")}t.compile=A;t.decompile=tt;t.parse=n;t.stringify=M;Object.defineProperty(t,"__esModule",{value:true})}); | ||
(function(t,r){typeof exports==="object"&&typeof module!=="undefined"?r(exports):typeof define==="function"&&define.amd?define(["exports"],r):(t=t||self,r(t.assCompiler={}))})(this,function(t){"use strict";function f(t){var r=t.toLowerCase().trim().split(/\s*;\s*/);if(r[0]==="banner"){return{name:r[0],delay:r[1]*1||0,leftToRight:r[2]*1||0,fadeAwayWidth:r[3]*1||0}}if(/^scroll\s/.test(r[0])){return{name:r[0],y1:Math.min(r[1]*1,r[2]*1),y2:Math.max(r[1]*1,r[2]*1),delay:r[3]*1||0,fadeAwayHeight:r[4]*1||0}}return null}function h(t){if(!t){return[]}return t.toLowerCase().replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/g," $1 ").replace(/([mnlbspc])/g," $1 ").trim().replace(/\s+/g," ").split(/\s(?=[mnlbspc])/).map(function(t){return t.split(" ").filter(function(t,r){return!(r&&isNaN(t*1))})})}var r=["b","i","u","s","fsp","k","K","kf","ko","kt","fe","q","p","pbo","a","an","fscx","fscy","fax","fay","frx","fry","frz","fr","be","blur","bord","xbord","ybord","shad","xshad","yshad"];var x=r.map(function(t){return{name:t,regex:new RegExp("^"+t+"-?\\d")}});function S(t){var r;var e={};for(var a=0;a<x.length;a++){var n=x[a];var i=n.name;var s=n.regex;if(s.test(t)){e[i]=t.slice(i.length)*1;return e}}if(/^fn/.test(t)){e.fn=t.slice(2)}else if(/^r/.test(t)){e.r=t.slice(1)}else if(/^fs[\d+-]/.test(t)){e.fs=t.slice(2)}else if(/^\d?c&?H?[0-9a-f]+|^\d?c$/i.test(t)){var o=t.match(/^(\d?)c&?H?(\w*)/);var f=o[1];var l=o[2];e["c"+(f||1)]=l&&("000000"+l).slice(-6)}else if(/^\da&?H?[0-9a-f]+/i.test(t)){var u=t.match(/^(\d)a&?H?(\w\w)/);var c=u[1];var v=u[2];e["a"+c]=v}else if(/^alpha&?H?[0-9a-f]+/i.test(t)){r=t.match(/^alpha&?H?([0-9a-f]+)/i),e.alpha=r[1];e.alpha=("00"+e.alpha).slice(-2)}else if(/^(?:pos|org|move|fad|fade)\([^)]+/.test(t)){var p=t.match(/^(\w+)\((.*?)\)?$/);var d=p[1];var y=p[2];e[d]=y.trim().split(/\s*,\s*/).map(Number)}else if(/^i?clip\([^)]+/.test(t)){var g=t.match(/^i?clip\((.*?)\)?$/)[1].trim().split(/\s*,\s*/);e.clip={inverse:/iclip/.test(t),scale:1,drawing:null,dots:null};if(g.length===1){e.clip.drawing=h(g[0])}if(g.length===2){e.clip.scale=g[0]*1;e.clip.drawing=h(g[1])}if(g.length===4){e.clip.dots=g.map(Number)}}else if(/^t\(/.test(t)){var m=t.match(/^t\((.*?)\)?$/)[1].trim().replace(/\\.*/,function(t){return t.replace(/,/g,"\n")}).split(/\s*,\s*/);if(!m[0]){return e}e.t={t1:0,t2:0,accel:1,tags:m[m.length-1].replace(/\n/g,",").split("\\").slice(1).map(S)};if(m.length===2){e.t.accel=m[0]*1}if(m.length===3){e.t.t1=m[0]*1;e.t.t2=m[1]*1}if(m.length===4){e.t.t1=m[0]*1;e.t.t2=m[1]*1;e.t.accel=m[2]*1}}return e}function s(t){var r=[];var e=0;var a="";var n=t.split("\\").slice(1).concat("").join("\\");for(var i=0;i<n.length;i++){var s=n[i];if(s==="("){e++}if(s===")"){e--}if(e<0){e=0}if(!e&&s==="\\"){if(a){r.push(a)}a=""}else{a+=s}}return r.map(S)}function l(t){var r=t.split(/{([^{}]*?)}/);var e=[];if(r[0].length){e.push({tags:[],text:r[0],drawing:[]})}for(var a=1;a<r.length;a+=2){var n=s(r[a]);var i=n.reduce(function(t,r){return r.p===undefined?t:!!r.p},false);e.push({tags:n,text:i?"":r[a+1],drawing:i?h(r[a+1]):[]})}return{raw:t,combined:e.map(function(t){return t.text}).join(""),parsed:e}}function u(t){var r=t.split(":");return r[0]*3600+r[1]*60+r[2]*1}function v(t,r){var e=t.split(",");if(e.length>r.length){var a=e.slice(r.length-1).join();e=e.slice(0,r.length-1);e.push(a)}var n={};for(var i=0;i<e.length;i++){var s=r[i];var o=e[i].trim();switch(s){case"Layer":case"MarginL":case"MarginR":case"MarginV":n[s]=o*1;break;case"Start":case"End":n[s]=u(o);break;case"Effect":n[s]=f(o);break;case"Text":n[s]=l(o);break;default:n[s]=o}}return n}var I=Object.assign||function t(r){var e=[],a=arguments.length-1;while(a-- >0)e[a]=arguments[a+1];for(var n=0;n<e.length;n++){if(!e[n]){continue}var i=Object.keys(e[n]);for(var s=0;s<i.length;s++){r[i[s]]=e[n][i[s]]}}return r};var p=["Name","Fontname","Fontsize","PrimaryColour","SecondaryColour","OutlineColour","BackColour","Bold","Italic","Underline","StrikeOut","ScaleX","ScaleY","Spacing","Angle","BorderStyle","Outline","Shadow","Alignment","MarginL","MarginR","MarginV","Encoding"];var d=["Layer","Start","End","Style","Name","MarginL","MarginR","MarginV","Effect","Text"];function y(t,r){var a=t.match(/Style\s*:\s*(.*)/i)[1].split(/\s*,\s*/);return I.apply(void 0,[{}].concat(r.map(function(t,r){var e;return e={},e[t]=a[r],e})))}function n(t){var r={info:{},styles:{format:[],style:[]},events:{format:[],comment:[],dialogue:[]}};var e=t.split(/\r?\n/);var a=0;for(var n=0;n<e.length;n++){var i=e[n].trim();if(/^;/.test(i)){continue}if(/^\[Script Info\]/i.test(i)){a=1}else if(/^\[V4\+? Styles\]/i.test(i)){a=2}else if(/^\[Events\]/i.test(i)){a=3}else if(/^\[.*\]/.test(i)){a=0}if(a===0){continue}if(a===1){if(/:/.test(i)){var s=i.match(/(.*?)\s*:\s*(.*)/);var o=s[1];var f=s[2];r.info[o]=f}}if(a===2){if(/^Format\s*:/i.test(i)){r.styles.format=p.concat()}if(/^Style\s*:/i.test(i)){r.styles.style.push(y(i,r.styles.format))}}if(a===3){if(/^Format\s*:/i.test(i)){r.events.format=d.concat()}if(/^(?:Comment|Dialogue)\s*:/i.test(i)){var l=i.match(/^(\w+?)\s*:\s*(.*)/i);var u=l[1];var c=l[2];r.events[u.toLowerCase()].push(v(c,r.events.format))}}}return r}function o(r){return Object.keys(r).map(function(t){return t+": "+r[t]}).join("\n")}function i(t){return("00"+t).slice(-2)}function e(t){var r=t.toFixed(2).slice(-2);var e=(t|0)%60;var a=(t/60|0)%60;var n=t/3600|0;return n+":"+i(a)+":"+i(e)+"."+r}function a(t){if(!t){return""}if(t.name==="banner"){return"Banner;"+t.delay+";"+t.leftToRight+";"+t.fadeAwayWidth}return t.name.replace(/^\w/,function(t){return t.toUpperCase()})+";"+t.y1+";"+t.y2+";"+t.delay+";"+t.fadeAwayHeight}function c(t){return t.map(function(t){return t.join(" ")}).join(" ")}function g(t){var r=Object.keys(t);var e=r[0];if(!e){return""}var a=t[e];if(["pos","org","move","fad","fade"].some(function(t){return t===e})){return"\\"+e+"("+a+")"}if(/^[ac]\d$/.test(e)){return"\\"+e[1]+e[0]+"&H"+a+"&"}if(e==="alpha"){return"\\alpha&H"+a+"&"}if(e==="clip"){return"\\"+(a.inverse?"i":"")+"clip("+(a.dots||""+(a.scale===1?"":a.scale+",")+c(a.drawing))+")"}if(e==="t"){return"\\t("+[a.t1,a.t2,a.accel,a.tags.map(g).join("")]+")"}return"\\"+e+a}function m(t){return t.parsed.map(function(t){var r=t.tags;var e=t.text;var a=t.drawing;var n=r.map(g).join("");var i=a.length?c(a):e;return""+(n?"{"+n+"}":"")+i}).join("")}function b(t){var r="0000";return[t.Layer,e(t.Start),e(t.End),t.Style,t.Name,t.MarginL||r,t.MarginR||r,t.MarginV||r,a(t.Effect),m(t.Text)].join()}function w(t){var r;var e=t.info;var a=t.styles;var n=t.events;return["[Script Info]",o(e),"","[V4+ Styles]","Format: "+p.join(", ")].concat(a.style.map(function(r){return"Style: "+p.map(function(t){return r[t]}).join()}),[""],["[Events]"],["Format: "+d.join(", ")],(r=[]).concat.apply(r,["Comment","Dialogue"].map(function(r){return n[r.toLowerCase()].map(function(t){return{start:t.Start,end:t.End,string:r+": "+b(t)}})})).sort(function(t,r){return t.start-r.start||t.end-r.end}).map(function(t){return t.string}),[""]).join("\n")}function M(t){var r={type:null,prev:null,next:null,points:[]};if(/[mnlbs]/.test(t[0])){r.type=t[0].toUpperCase().replace("N","L").replace("B","C")}for(var e=t.length-!(t.length&1),a=1;a<e;a+=2){r.points.push({x:t[a]*1,y:t[a+1]*1})}return r}function j(t){if(!t.points.length||!t.type){return false}if(/C|S/.test(t.type)&&t.points.length<3){return false}return true}function C(t){var r;var a=Infinity;var n=Infinity;var i=-Infinity;var s=-Infinity;(r=[]).concat.apply(r,t.map(function(t){var r=t.points;return r})).forEach(function(t){var r=t.x;var e=t.y;a=Math.min(a,r);n=Math.min(n,e);i=Math.max(i,r);s=Math.max(s,e)});return{minX:a,minY:n,width:i-a,height:s-n}}function k(t,r,e){var a=[];var n=[0,2/3,1/3,0];var i=[0,1/3,2/3,0];var s=[0,1/6,2/3,1/6];var o=function(t,r){return t[0]*r[0]+t[1]*r[1]+t[2]*r[2]+t[3]*r[3]};var f=[t[t.length-1].x,t[0].x,t[1].x,t[2].x];var l=[t[t.length-1].y,t[0].y,t[1].y,t[2].y];a.push({type:r==="M"?"M":"L",points:[{x:o(s,f),y:o(s,l)}]});for(var u=3;u<t.length;u++){f=[t[u-3].x,t[u-2].x,t[u-1].x,t[u].x];l=[t[u-3].y,t[u-2].y,t[u-1].y,t[u].y];a.push({type:"C",points:[{x:o(n,f),y:o(n,l)},{x:o(i,f),y:o(i,l)},{x:o(s,f),y:o(s,l)}]})}if(e==="L"||e==="C"){var c=t[t.length-1];a.push({type:"L",points:[{x:c.x,y:c.y}]})}return a}function O(t){return t.map(function(t){var r=t.type;var e=t.points;return r+e.map(function(t){var r=t.x;var e=t.y;return r+","+e}).join(",")}).join("")}function B(t){var r;var e=[];var a=0;while(a<t.length){var n=t[a];var i=M(n);if(j(i)){if(i.type==="S"){var s=(e[a-1]||{points:[{x:0,y:0}]}).points.slice(-1)[0];var o=s.x;var f=s.y;i.points.unshift({x:o,y:f})}if(a){i.prev=e[a-1].type;e[a-1].next=i.type}e.push(i);a++}else{if(a&&e[a-1].type==="S"){var l={p:i.points,c:e[a-1].points.slice(0,3)};e[a-1].points=e[a-1].points.concat((l[n[0]]||[]).map(function(t){var r=t.x;var e=t.y;return{x:r,y:e}}))}t.splice(a,1)}}var u=(r=[]).concat.apply(r,e.map(function(t){var r=t.type;var e=t.points;var a=t.prev;var n=t.next;return r==="S"?k(e,a,n):{type:r,points:e}}));return I({instructions:u,d:O(u)},C(e))}var V=["fs","clip","c1","c2","c3","c4","a1","a2","a3","a4","alpha","fscx","fscy","fax","fay","frx","fry","frz","fr","be","blur","bord","xbord","ybord","shad","xshad","yshad"];function $(t,r,e){var a,n,i;if(e===void 0)e={};var s=t[r];if(s===undefined){return null}if(r==="pos"||r==="org"){return s.length===2?(a={},a[r]={x:s[0],y:s[1]},a):null}if(r==="move"){var o=s[0];var f=s[1];var l=s[2];var u=s[3];var c=s[4];if(c===void 0)c=0;var v=s[5];if(v===void 0)v=0;return s.length===4||s.length===6?{move:{x1:o,y1:f,x2:l,y2:u,t1:c,t2:v}}:null}if(r==="fad"||r==="fade"){if(s.length===2){var p=s[0];var d=s[1];return{fade:{type:"fad",t1:p,t2:d}}}if(s.length===7){var y=s[0];var g=s[1];var m=s[2];var h=s[3];var x=s[4];var S=s[5];var b=s[6];return{fade:{type:"fade",a1:y,a2:g,a3:m,t1:h,t2:x,t3:S,t4:b}}}return null}if(r==="clip"){var w=s.inverse;var M=s.scale;var j=s.drawing;var C=s.dots;if(j){return{clip:{inverse:w,scale:M,drawing:B(j),dots:C}}}if(C){var k=C[0];var O=C[1];var E=C[2];var F=C[3];return{clip:{inverse:w,scale:M,drawing:j,dots:{x1:k,y1:O,x2:E,y2:F}}}}return null}if(/^[xy]?(bord|shad)$/.test(r)){s=Math.max(s,0)}if(r==="bord"){return{xbord:s,ybord:s}}if(r==="shad"){return{xshad:s,yshad:s}}if(/^c\d$/.test(r)){return n={},n[r]=s||e[r],n}if(r==="alpha"){return{a1:s,a2:s,a3:s,a4:s}}if(r==="fr"){return{frz:s}}if(r==="fs"){return{fs:/^\+|-/.test(s)?(s*1>-10?1+s/10:1)*e.fs:s*1}}if(r==="K"){return{kf:s}}if(r==="t"){var H=s.t1;var L=s.accel;var N=s.tags;var R=s.t2||(e.end-e.start)*1e3;var A={};N.forEach(function(t){var r=Object.keys(t)[0];if(~V.indexOf(r)&&!(r==="clip"&&!t[r].dots)){I(A,$(t,r,e))}});return{t:{t1:H,t2:R,accel:L,tag:A}}}return i={},i[r]=s,i}var P=[null,1,2,3,null,7,8,9,null,4,5,6];var D=["r","a","an","pos","org","move","fade","fad","clip"];function z(t){return JSON.parse(JSON.stringify(I({},t,{k:undefined,kf:undefined,ko:undefined,kt:undefined})))}function E(t){var r=t.styles;var e=t.style;var a=t.parsed;var n=t.start;var i=t.end;var s;var o;var f;var l;var u;var c;var v=[];var p={style:e,fragments:[]};var d={};for(var y=0;y<a.length;y++){var g=a[y];var m=g.tags;var h=g.text;var x=g.drawing;var S=void 0;for(var b=0;b<m.length;b++){var w=m[b];S=w.r===undefined?S:w.r}var M={tag:S===undefined?z(d):{},text:h,drawing:x.length?B(x):null};for(var j=0;j<m.length;j++){var C=m[j];s=s||P[C.a||0]||C.an;o=o||$(C,"pos");f=f||$(C,"org");l=l||$(C,"move");u=u||$(C,"fade")||$(C,"fad");c=$(C,"clip")||c;var k=Object.keys(C)[0];if(k&&!~D.indexOf(k)){var O=r[e].tag;var E=O.c1;var F=O.c2;var H=O.c3;var L=O.c4;var N=d.fs||O.fs;var R=$(C,k,{start:n,end:i,c1:E,c2:F,c3:H,c4:L,fs:N});if(k==="t"){M.tag.t=M.tag.t||[];M.tag.t.push(R.t)}else{I(M.tag,R)}}}d=M.tag;if(S!==undefined){v.push(p);p={style:r[S]?S:e,fragments:[]}}if(M.text||M.drawing){var A=p.fragments[p.fragments.length-1]||{};if(A.text&&M.text&&!Object.keys(M.tag).length){A.text+=M.text}else{p.fragments.push(M)}}}v.push(p);return I({alignment:s,slices:v},o,f,l,u,c)}function F(t){var r=t.styles;var e=t.dialogues;var a=Infinity;var n=[];for(var i=0;i<e.length;i++){var s=e[i];if(s.Start>=s.End){continue}if(!r[s.Style]){s.Style="Default"}var o=r[s.Style].style;var f=E({styles:r,style:s.Style,parsed:s.Text.parsed,start:s.Start,end:s.End});var l=f.alignment||o.Alignment;a=Math.min(a,s.Layer);n.push(I({layer:s.Layer,start:s.Start,end:s.End,style:s.Style,name:s.Name,margin:{left:s.MarginL||o.MarginL,right:s.MarginR||o.MarginR,vertical:s.MarginV||o.MarginV},effect:s.Effect},f,{alignment:l}))}for(var u=0;u<n.length;u++){n[u].layer-=a}return n.sort(function(t,r){return t.start-r.start||t.end-r.end})}var H={Name:"Default",Fontname:"Arial",Fontsize:"20",PrimaryColour:"&H00FFFFFF&",SecondaryColour:"&H000000FF&",OutlineColour:"&H00000000&",BackColour:"&H00000000&",Bold:"0",Italic:"0",Underline:"0",StrikeOut:"0",ScaleX:"100",ScaleY:"100",Spacing:"0",Angle:"0",BorderStyle:"1",Outline:"2",Shadow:"2",Alignment:"2",MarginL:"10",MarginR:"10",MarginV:"10",Encoding:"1"};function L(t){if(/^(&|H|&H)[0-9a-f]{6,}/i.test(t)){var r=t.match(/&?H?([0-9a-f]{2})?([0-9a-f]{6})/i);var e=r[1];var a=r[2];return[e||"00",a]}var n=parseInt(t,10);if(!isNaN(n)){var i=-2147483648;var s=2147483647;if(n<i){return["00","000000"]}var o=i<=n&&n<=s?("00000000"+(n<0?n+4294967296:n).toString(16)).slice(-8):String(n).slice(0,8);return[o.slice(0,2),o.slice(2)]}return["00","000000"]}function N(t){var y=t.info;var r=t.style;var e=t.defaultStyle;var g={};var m=[I({},H,e,{Name:"Default"})].concat(r);var a=function(t){var r=m[t];if(/^(\*+)Default$/.test(r.Name)){r.Name="Default"}Object.keys(r).forEach(function(t){if(t!=="Name"&&t!=="Fontname"&&!/Colour/.test(t)){r[t]*=1}});var e=L(r.PrimaryColour);var a=e[0];var n=e[1];var i=L(r.SecondaryColour);var s=i[0];var o=i[1];var f=L(r.OutlineColour);var l=f[0];var u=f[1];var c=L(r.BackColour);var v=c[0];var p=c[1];var d={fn:r.Fontname,fs:r.Fontsize,c1:n,a1:a,c2:o,a2:s,c3:u,a3:l,c4:p,a4:v,b:Math.abs(r.Bold),i:Math.abs(r.Italic),u:Math.abs(r.Underline),s:Math.abs(r.StrikeOut),fscx:r.ScaleX,fscy:r.ScaleY,fsp:r.Spacing,frz:r.Angle,xbord:r.Outline,ybord:r.Outline,xshad:r.Shadow,yshad:r.Shadow,fe:r.Encoding,q:/^[0-3]$/.test(y.WrapStyle)?y.WrapStyle*1:2};g[r.Name]={style:r,tag:d}};for(var n=0;n<m.length;n++)a(n);return g}function R(t,r){if(r===void 0)r={};var e=n(t);var a=N({info:e.info,style:e.styles.style,defaultStyle:r.defaultStyle||{}});return{info:e.info,width:e.info.PlayResX*1||null,height:e.info.PlayResY*1||null,collisions:e.info.Collisions||"Normal",styles:a,dialogues:F({styles:a,dialogues:e.events.dialogue})}}function A(t){var r=t.style;var e=t.tag;var a=I({},r,{PrimaryColour:"&H"+e.a1+e.c1,SecondaryColour:"&H"+e.a2+e.c2,OutlineColour:"&H"+e.a3+e.c3,BackColour:"&H"+e.a4+e.c4});return"Style: "+p.map(function(t){return a[t]}).join()}var T={M:"m",L:"l",C:"b"};function X(t){var r=t.instructions;return r.map(function(t){var r;var e=t.type;var a=t.points;return(r=[T[e]]).concat.apply(r,a.map(function(t){var r=t.x;var e=t.y;return[r,e]})).join(" ")}).join(" ")}var Y=function(e){return function(r){return function(t){return""+r+e+"&H"+t+"&"}}};var U=Y("c");var J=Y("a");var W={c1:U(1),c2:U(2),c3:U(3),c4:U(4),a1:J(1),a2:J(2),a3:J(3),a4:J(4),pos:function(t){return"pos("+[t.x,t.y]+")"},org:function(t){return"org("+[t.x,t.y]+")"},move:function(t){return"move("+[t.x1,t.y1,t.x2,t.y2,t.t1,t.t2]+")"},fade:function(t){return t.type==="fad"?"fad("+[t.t1,t.t2]+")":"fade("+[t.a1,t.a2,t.a3,t.t1,t.t2,t.t3,t.t4]+")"},clip:function(t){return(t.inverse?"i":"")+"clip("+(t.dots?""+[t.dots.x1,t.dots.y1,t.dots.x2,t.dots.y2]:""+(t.scale===1?"":t.scale+",")+X(t.drawing))+")"},t:function(t){return t.map(function(t){return"t("+[t.t1,t.t2,t.accel,q(t.tag)]+")"}).join("\\")}};function q(e){return Object.keys(e).map(function(r){var t=W[r]||function(t){return""+r+t};return"\\"+t(e[r])}).join("")}function K(t){return t.fragments.map(function(t){var r=t.tag;var e=t.text;var a=t.drawing;var n=q(r);return""+(n?"{"+n+"}":"")+(a?X(a):e)}).join("")}function _(i,s){return i.slices.map(function(t,r){var e=JSON.parse(JSON.stringify(t));var a=e.fragments[0];var n=a.tag;if(r){n.r=t.style===i.style?"":t.style}else{if(s.Alignment!==i.alignment){n.an=i.alignment}["pos","org","move","fade","clip"].forEach(function(t){if(i[t]){n[t]=i[t]}})}return e}).map(K).join("")}function G(t,r){return t===r?"0000":t}function Q(t,r){return"Dialogue: "+[t.layer,e(t.start),e(t.end),t.style,t.name,G(t.margin.left,r.MarginL),G(t.margin.right,r.MarginR),G(t.margin.vertical,r.MarginV),a(t.effect),_(t,r)].join()}function Z(t){var r=t.info;var e=t.width;var a=t.height;var n=t.collisions;var i=t.styles;var s=t.dialogues;return["[Script Info]",o(I({},r,{PlayResX:e,PlayResY:a,Collisions:n})),"","[V4+ Styles]","Format: "+p.join(", ")].concat(Object.keys(i).map(function(t){return A(i[t])}),[""],["[Events]"],["Format: "+d.join(", ")],s.sort(function(t,r){return t.start-r.start||t.end-r.end}).map(function(t){return Q(t,i[t.style].style)}),[""]).join("\n")}t.compile=R;t.decompile=Z;t.parse=n;t.stringify=w;Object.defineProperty(t,"__esModule",{value:true})}); |
{ | ||
"name": "ass-compiler", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Parses and compiles ASS subtitle format to easy-to-use data structure.", | ||
@@ -5,0 +5,0 @@ "main": "dist/ass-compiler.js", |
import { parseDialogue } from './dialogue.js'; | ||
import { parseFormat } from './format.js'; | ||
import { parseStyle } from './style.js'; | ||
import { stylesFormat, eventsFormat } from '../utils.js'; | ||
@@ -31,3 +31,3 @@ export function parse(text) { | ||
if (/^Format\s*:/i.test(line)) { | ||
tree.styles.format = parseFormat(line); | ||
tree.styles.format = stylesFormat.concat(); | ||
} | ||
@@ -40,3 +40,3 @@ if (/^Style\s*:/i.test(line)) { | ||
if (/^Format\s*:/i.test(line)) { | ||
tree.events.format = parseFormat(line); | ||
tree.events.format = eventsFormat.concat(); | ||
} | ||
@@ -43,0 +43,0 @@ if (/^(?:Comment|Dialogue)\s*:/i.test(line)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92387
26
2362