import{Ga as u,Oa as c,fg as R}from"./chunk-4JM6MIZ5.js";import{a as E,b as I,i as N}from"./chunk-QJQRWPYR.js";var H=(()=>{let n=class n{htmlRenderer;constructor(t){this.htmlRenderer=t}transform(t){return this.htmlRenderer.convertToBr(t)}};N(n,"\u0275fac",function(o){return new(o||n)(u(R,16))}),N(n,"\u0275pipe",c({name:"nl2br",type:n,pure:!0}));let r=n;return r})();var i=r=>typeof r.id=="string"&&typeof r.from=="number"&&typeof r.to=="number"&&typeof r.text=="string",a=r=>!r||/^\s*$/.test(r),p={ID:"ID",TIME_LINE:"TIME_LINE",TEXT:"TEXT",MULTI_LINE_TEXT:"MULTI_LINE_TEXT",FIN_ENTRY:"FIN_ENTRY",FINISH:"FINISH"},O=r=>{let n=r.split(":"),e,t,o;return n.length===2?[t,o]=n:[e,t,o]=n,parseInt(o.replace(",",""),10)+parseInt(t,10)*60*1e3+(e?parseInt(e,10):0)*60*60*1e3},L=()=>({start(r){let n=p.ID,e={tokens:r.split(/\n/),pos:0,result:[],current:{}};for(;n!==p.FINISH;){let t=this[n](e);e=t.params,n=t.next}return e.result},[p.ID](r){let{tokens:n,pos:e,current:t}=r;if(n.length<=e)return{next:p.FINISH,params:r};if(a(n[e]))return{next:p.ID,params:I(E({},r),{pos:e+1})};let o=n[e].includes("-->");return t.id=o?"":n[e],{next:p.TIME_LINE,params:I(E({},r),{current:t,tokens:n,pos:o?e:e+1})}},[p.TIME_LINE](r){let{tokens:n,pos:e,current:t}=r,o=n[e],[T,_]=o.split("-->");return t.from=O(T),t.to=O(_),{next:p.TEXT,params:I(E({},r),{current:t,pos:e+1})}},[p.TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e?{next:p.FINISH,params:r}:(t.text=n[e],{next:p.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[p.MULTI_LINE_TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e||a(n[e])?{next:p.FIN_ENTRY,params:r}:(t.text=`${t.text}
${n[e]}`,{next:p.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[p.FIN_ENTRY](r){let{pos:n,current:e,result:t}=r;if(i(e))t.push(e);else throw new Error(`Parsing error current not complete ${JSON.stringify(e)}`);return{next:p.ID,params:I(E({},r),{current:{},pos:n+1})}},[p.FINISH](r){return{next:p.FINISH,params:r}}}),x=r=>({entries:L().start(r)}),s={HEADER:"HEADER",ID:"ID",TIME_LINE:"TIME_LINE",ID_OR_NOTE_OR_STYLE_OR_REGION:"ID_OR_NOTE_OR_STYLE_OR_REGION",STYLE:"STYLE",NOTE:"NOTE",REGION:"REGION",LEGACY_HEADER:"LEGACY_HEADER",TEXT:"TEXT",MULTI_LINE_TEXT:"MULTI_LINE_TEXT",FIN_ENTRY:"FIN_ENTRY",FINISH:"FINISH"},m=r=>{let n=r.split(":"),e,t,o;return n.length===2?[t,o]=n:[e,t,o]=n,parseInt(o.replace(".",""),10)+parseInt(t,10)*60*1e3+(e?parseInt(e,10):0)*60*60*1e3},l=()=>({start(r){let n=s.HEADER,e={tokens:r.split(/\n/),pos:0,result:[],current:{}};for(;n!==s.FINISH;){let t=this[n](e);e=t.params,n=t.next}return e.result},[s.HEADER](r){return{next:s.LEGACY_HEADER,params:I(E({},r),{pos:r.pos+1})}},[s.LEGACY_HEADER](r){let{tokens:n,pos:e}=r;return n.length<=e?{next:s.FINISH,params:r}:n[e].includes(":")&&!n[e].includes("-->")?{next:s.LEGACY_HEADER,params:I(E({},r),{pos:e+1})}:{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:r}},[s.ID_OR_NOTE_OR_STYLE_OR_REGION](r){let{tokens:n,pos:e}=r;return n.length<=e?{next:s.FINISH,params:r}:a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:n[e].toUpperCase().includes("NOTE")?{next:s.NOTE,params:r}:n[e].toUpperCase().includes("STYLE")?{next:s.STYLE,params:r}:n[e].toUpperCase().includes("REGION")?{next:s.REGION,params:r}:{next:s.ID,params:r}},[s.STYLE](r){let{tokens:n,pos:e}=r;return a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:{next:s.STYLE,params:I(E({},r),{pos:e+1})}},[s.NOTE](r){let{tokens:n,pos:e}=r;return a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:{next:s.STYLE,params:I(E({},r),{pos:e+1})}},[s.REGION](r){let{tokens:n,pos:e}=r;return a(n[e])?{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{pos:e+1})}:{next:s.REGION,params:I(E({},r),{pos:e+1})}},[s.ID](r){let{tokens:n,pos:e,current:t}=r;if(n.length<=e)return{next:s.FINISH,params:r};if(a(n[e]))return{next:s.ID,params:I(E({},r),{pos:e+1})};let o=n[e].includes("-->");return t.id=o?"":n[e],{next:s.TIME_LINE,params:I(E({},r),{current:t,tokens:n,pos:o?e:e+1})}},[s.TIME_LINE](r){let{tokens:n,pos:e,current:t}=r,o=n[e],[T,_]=o.split("-->");return t.from=m(T),t.to=m(_),{next:s.TEXT,params:I(E({},r),{current:t,pos:e+1})}},[s.TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e?{next:s.FINISH,params:r}:(t.text=n[e],{next:s.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[s.MULTI_LINE_TEXT](r){let{tokens:n,pos:e,current:t}=r;return n.length<=e||a(n[e])?{next:s.FIN_ENTRY,params:r}:(t.text=`${t.text}
${n[e]}`,{next:s.MULTI_LINE_TEXT,params:I(E({},r),{current:t,pos:e+1})})},[s.FIN_ENTRY](r){let{pos:n,current:e,result:t}=r;if(i(e))t.push(e);else throw new Error(`Parsing error current not complete ${JSON.stringify(e)}`);return{next:s.ID_OR_NOTE_OR_STYLE_OR_REGION,params:I(E({},r),{current:{},pos:n+1})}},[s.FINISH](r){return{next:s.FINISH,params:r}}}),S=r=>({entries:l().start(r)}),h=r=>r.startsWith("WEBVTT")?S(r):x(r);export{H as a,h as b};
/**i18n:68865f44f2a527c44cf5136a17c76a0ff8308c2bae5c7c8d50070a5fb9847c44*/
//# sourceMappingURL=chunk-QDBI3YIJ.js.map
