diff --git a/dist/ass-compiler.js b/dist/ass-compiler.js index 1051be6..7c1f54a 100644 --- a/dist/ass-compiler.js +++ b/dist/ass-compiler.js @@ -241,24 +241,6 @@ return dia; } - var assign = Object.assign || ( - /* istanbul ignore next */ - function assign(target) { - var sources = [], len = arguments.length - 1; - while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ]; - - for (var i = 0; i < sources.length; i++) { - if (!sources[i]) { continue; } - var keys = Object.keys(sources[i]); - for (var j = 0; j < keys.length; j++) { - // eslint-disable-next-line no-param-reassign - target[keys[j]] = sources[i][keys[j]]; - } - } - return target; - } - ); - var stylesFormat = ['Name', 'Fontname', 'Fontsize', 'PrimaryColour', 'SecondaryColour', 'OutlineColour', 'BackColour', 'Bold', 'Italic', 'Underline', 'StrikeOut', 'ScaleX', 'ScaleY', 'Spacing', 'Angle', 'BorderStyle', 'Outline', 'Shadow', 'Alignment', 'MarginL', 'MarginR', 'MarginV', 'Encoding']; var eventsFormat = ['Layer', 'Start', 'End', 'Style', 'Name', 'MarginL', 'MarginR', 'MarginV', 'Effect', 'Text']; @@ -274,7 +256,7 @@ function parseStyle(text, format) { var values = text.match(/Style\s*:\s*(.*)/i)[1].split(/\s*,\s*/); - return assign.apply(void 0, [ {} ].concat( format.map(function (fmt, idx) { + return Object.assign.apply(Object, [ {} ].concat( format.map(function (fmt, idx) { var obj; return (( obj = {}, obj[fmt] = values[idx], obj )); @@ -611,11 +593,11 @@ }) ); - return assign({ instructions: instructions, d: toSVGPath(instructions) }, getViewBox(commands)); + return Object.assign({ instructions: instructions, d: toSVGPath(instructions) }, getViewBox(commands)); } var tTags = [ - 'fs', 'clip', + 'fs', 'fsp', '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' ]; @@ -714,7 +696,7 @@ tags.forEach(function (t) { var k = Object.keys(t)[0]; if (~tTags.indexOf(k) && !(k === 'clip' && !t[k].dots)) { - assign(compiledTag, compileTag(t, k, presets)); + Object.assign(compiledTag, compileTag(t, k, presets)); } }); return { t: { t1: t1$3, t2: t2$3, accel: accel, tag: compiledTag } }; @@ -730,7 +712,7 @@ var globalTags = ['r', 'a', 'an', 'pos', 'org', 'move', 'fade', 'fad', 'clip']; function inheritTag(pTag) { - return JSON.parse(JSON.stringify(assign({}, pTag, { + return JSON.parse(JSON.stringify(Object.assign({}, pTag, { k: undefined, kf: undefined, ko: undefined, @@ -790,7 +772,7 @@ fragment.tag.t = fragment.tag.t || []; fragment.tag.t.push(compiledTag.t); } else { - assign(fragment.tag, compiledTag); + Object.assign(fragment.tag, compiledTag); } } } @@ -811,7 +793,7 @@ } slices.push(slice); - return assign({ alignment: alignment, slices: slices }, pos, org, move, fade, clip); + return Object.assign({ alignment: alignment, slices: slices }, pos, org, move, fade, clip); } function compileDialogues(ref) { @@ -838,7 +820,7 @@ }); var alignment = compiledText.alignment || stl.Alignment; minLayer = Math.min(minLayer, dia.Layer); - results.push(assign({ + results.push(Object.assign({ layer: dia.Layer, start: dia.Start, end: dia.End, @@ -919,9 +901,9 @@ var defaultStyle = ref.defaultStyle; var result = {}; - var styles = [assign({}, defaultStyle, { Name: 'Default' })].concat(style); + var styles = [Object.assign({}, defaultStyle, { Name: 'Default' })].concat(style); var loop = function ( i ) { - var s = assign({}, DEFAULT_STYLE, styles[i]); + var s = Object.assign({}, DEFAULT_STYLE, styles[i]); // this behavior is same as Aegisub by black-box testing if (/^(\*+)Default$/.test(s.Name)) { s.Name = 'Default'; @@ -1002,7 +984,7 @@ var style = ref.style; var tag = ref.tag; - var obj = assign({}, style, { + var obj = Object.assign({}, style, { PrimaryColour: ("&H" + (tag.a1) + (tag.c1)), SecondaryColour: ("&H" + (tag.a2) + (tag.c2)), OutlineColour: ("&H" + (tag.a3) + (tag.c3)), @@ -1138,7 +1120,7 @@ return [ '[Script Info]', - stringifyInfo(assign({}, info, { + stringifyInfo(Object.assign({}, info, { PlayResX: width, PlayResY: height, Collisions: collisions, @@ -1160,6 +1142,4 @@ exports.parse = parse; exports.stringify = stringify; - Object.defineProperty(exports, '__esModule', { value: true }); - })); diff --git a/dist/ass-compiler.min.js b/dist/ass-compiler.min.js index 695bfd2..e548fcf 100644 --- a/dist/ass-compiler.min.js +++ b/dist/ass-compiler.min.js @@ -1 +1 @@ -(function(t,r){typeof exports==="object"&&typeof module!=="undefined"?r(exports):typeof define==="function"&&define.amd?define(["exports"],r):(t=typeof globalThis!=="undefined"?globalThis: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}}if(t!==""){return{name:t}}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;ar.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;i0)e[a]=arguments[a+1];for(var n=0;n-10?1+s/10:1)*e.fs:s*1}}if(r==="K"){return{kf:s}}if(r==="t"){var E=s.t1;var H=s.accel;var N=s.tags;var A=s.t2||(e.end-e.start)*1e3;var R={};N.forEach(function(t){var r=Object.keys(t)[0];if(~P.indexOf(r)&&!(r==="clip"&&!t[r].dots)){I(R,V(t,r,e))}});return{t:{t1:E,t2:A,accel:H,tag:R}}}return i={},i[r]=s,i}var T=[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 X(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 g=0;g=s.End){continue}if(!r[s.Style]){s.Style="Default"}var o=r[s.Style].style;var f=X({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;ur.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-10?1+s/10:1)*e.fs:s*1}}if(r==="K"){return{kf:s}}if(r==="t"){var E=s.t1;var H=s.accel;var N=s.tags;var A=s.t2||(e.end-e.start)*1e3;var R={};N.forEach(function(t){var r=Object.keys(t)[0];if(~$.indexOf(r)&&!(r==="clip"&&!t[r].dots)){Object.assign(R,B(t,r,e))}});return{t:{t1:E,t2:A,accel:H,tag:R}}}return i={},i[r]=s,i}var T=[null,1,2,3,null,7,8,9,null,4,5,6];var D=["r","a","an","pos","org","move","fade","fad","clip"];function P(t){return JSON.parse(JSON.stringify(Object.assign({},t,{k:undefined,kf:undefined,ko:undefined,kt:undefined})))}function z(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 c;var u;var v=[];var p={style:e,fragments:[]};var d={};for(var g=0;g=s.End){continue}if(!r[s.Style]){s.Style="Default"}var o=r[s.Style].style;var f=z({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(Object.assign({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 c=0;c