vendor: 4,468 bytes, lines 1-4
1import{_ as M}from"./app-BXezEdO3.js";import{b as F,p as E}from"./prod-BZm_tq9m.js";const b=/^Format:[\s\t]*/,R=/^Style:[\s\t]*/,y=/^Dialogue:[\s\t]*/,d=/[\s\t]*,[\s\t]*/,O=/\{[^}]+\}/g,w=/\\N/g,I=/^\[(.*)[\s\t]?Styles\]$/,m=/^\[(.*)[\s\t]?Events\]$/;class A{h;O=0;c=null;l=[];m=[];N=null;f;P={};async init(t){this.h=t,t.errors&&(this.f=(await M(async()=>{const{ParseErrorBuilder:r}=await import("./errors-BsLzqLUo.js");return{ParseErrorBuilder:r}},[])).ParseErrorBuilder)}parse(t,r){if(this.O)switch(this.O){case 1:if(t==="")this.O=0;else if(R.test(t))if(this.N){const e=t.replace(R,"").split(d);this.S(e)}else this.g(this.f?.T("Style",r));else b.test(t)?this.N=t.replace(b,"").split(d):m.test(t)&&(this.N=null,this.O=2);break;case 2:if(t==="")this.Q();else if(y.test(t))if(this.Q(),this.N){const e=t.replace(y,"").split(d),s=this.U(e,r);s&&(this.c=s)}else this.g(this.f?.T("Dialogue",r));else this.c?this.c.text+=` 2`+t.replace(O,"").replace(w,` 3`):b.test(t)?this.N=t.replace(b,"").split(d):I.test(t)?(this.N=null,this.O=1):m.test(t)&&(this.N=null)}else t===""||(I.test(t)?(this.N=null,this.O=1):m.test(t)&&(this.N=null,this.O=2))}done(){return{metadata:{},cues:this.l,regions:[],errors:this.m}}Q(){this.c&&(this.l.push(this.c),this.h.onCue?.(this.c),this.c=null)}S(t){let r="Default",e={},s,a="center",l="bottom",g,o=1.2,c,h,n=3,f=[];for(let u=0;u<this.N.length;u++){const x=this.N[u],i=t[u];switch(x){case"Name":r=i;break;case"Fontname":e["font-family"]=i;break;case"Fontsize":e["font-size"]=`calc(${i} / var(--overlay-height))`;break;case"PrimaryColour":const _=k(i);_&&(e["--cue-color"]=_);break;case"BorderStyle":n=parseInt(i,10);break;case"BackColour":h=k(i);break;case"OutlineColour":const N=k(i);N&&(c=N);break;case"Bold":parseInt(i)&&(e["font-weight"]="bold");break;case"Italic":parseInt(i)&&(e["font-style"]="italic");break;case"Underline":parseInt(i)&&(e["text-decoration"]="underline");break;case"StrikeOut":parseInt(i)&&(e["text-decoration"]="line-through");break;case"Spacing":e["letter-spacing"]=i+"px";break;case"AlphaLevel":e.opacity=parseFloat(i);break;case"ScaleX":f.push(`scaleX(${parseFloat(i)/100})`);break;case"ScaleY":f.push(`scaleY(${parseFloat(i)/100})`);break;case"Angle":f.push(`rotate(${i}deg)`);break;case"Shadow":o=parseInt(i,10)*1.2;break;case"MarginL":e["--cue-width"]="auto",e["--cue-left"]=parseFloat(i)+"px";break;case"MarginR":e["--cue-width"]="auto",e["--cue-right"]=parseFloat(i)+"px";break;case"MarginV":g=parseFloat(i);break;case"Outline":s=parseInt(i,10);break;case"Alignment":const S=parseInt(i,10);switch(S>=4&&(l=S>=7?"top":"center"),S%3){case 1:a="start";break;case 2:a="center";break;case 3:a="end";break}}}if(e.R=l,e["--cue-white-space"]="normal",e["--cue-line-height"]="normal",e["--cue-text-align"]=a,l==="center"?(e["--cue-top"]="50%",f.push("translateY(-50%)")):e[`--cue-${l}`]=(g||0)+"px",n===1&&(e["--cue-padding-y"]="0"),(n===1||h)&&(e["--cue-bg-color"]=n===1?"none":h),n===3&&c&&(e["--cue-outline"]=`${s}px solid ${c}`),n===1&&typeof s=="number"){const u=h??"#000";e["--cue-text-shadow"]=[c&&T(s*1.2,o*1.2,c),c?T(s*(s/2),o*(s/2),u):T(s,o,u)].filter(Boolean).join(", ")}f.length&&(e["--cue-transform"]=f.join(" ")),this.P[r]=e}U(t,r){const e=this.V(t),s=this.q(e.Start,e.End,r);if(!s)return;const a=new F(s[0],s[1],""),l={...this.P[e.Style]||{}},g=e.Name?`<v ${e.Name}>`:"",o=l.R,c=e.MarginL&&parseFloat(e.MarginL),h=e.MarginR&&parseFloat(e.MarginR),n=e.MarginV&&parseFloat(e.MarginV);return c&&(l["--cue-width"]="auto",l["--cue-left"]=c+"px"),h&&(l["--cue-width"]="auto",l["--cue-right"]=h+"px"),n&&o!=="center"&&(l[`--cue-${o}`]=n+"px"),a.text=g+t.slice(this.N.length-1).join(", ").replace(O,"").replace(w,` 4`),delete l.R,Object.keys(l).length&&(a.style=l),a}V(t){const r={};for(let e=0;e<this.N.length;e++)r[this.N[e]]=t[e];return r}q(t,r,e){const s=E(t),a=E(r);if(s!==null&&a!==null&&a>s)return[s,a];s===null&&this.g(this.f?.s(t,e)),a===null&&this.g(this.f?.t(r,e)),s!=null&&a!==null&&a>s&&this.g(this.f?.u(s,a,e))}g(t){if(t){if(this.m.push(t),this.h.strict)throw this.h.cancel(),t;this.h.onError?.(t)}}}function k(p){const t=parseInt(p.replace("&H",""),16);if(t>=0){const e=(t>>24&255^255)/255,s=t>>16&255,a=t>>8&255;return"rgba("+[t&255,a,s,e].join(",")+")"}return null}function T(p,t,r){const e=Math.ceil(2*Math.PI*p);let s="";for(let a=0;a<e;a++){const l=2*Math.PI*a/e;s+=p*Math.cos(l)+"px "+t*Math.sin(l)+"px 0 "+r+(a==e-1?"":",")}return s}function V(){return new A}export{A as SSAParser,V as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.