PageSourceSearch

https://hob-learning.com/_nuxt/BffLj_qW.js

js hob-learning.com collected 2026-09-24 11:02:08 UTC 9,360 bytes, 9 lines download raw bytes

1import{e as ae,r as c,s as P,x as oe,ak as ie,c as p,a as l,H as y,m as k,I as w,K as re,t as b,F as ue,A as ce,l as de,o as T,v as ve,_ as me}from"./D7pUiA68.js";import{H as _}from"./Cp2x8l1r.js";const pe={class:"subtitle-editor"},Te={class:"input-section"},he={class:"input-group"},fe=["disabled"],be={class:"input-group"},ge={class:"video-section"},_e={class:"video-container"},xe=["src"],ye={key:0,class:"subtitle-overlay"},ke=["innerHTML"],Se={key:0,class:"custom-subtitle-overlay"},Ee=["innerHTML"],we={class:"video-controls"},Ce={class:"time-display"},Le=["max","value"],Re={key:0,class:"subtitle-creation"},Ue={class:"subtitle-form"},Me={class:"form-group"},Ve=["max"],Ie={class:"form-group"},$e=["max"],Fe={class:"form-group"},Ae={class:"form-actions"},He=["disabled"],Pe={key:1,class:"subtitles-list"},Ne={class:"subtitle-items"},De={class:"subtitle-header"},Oe={class:"subtitle-time"},Be={class:"subtitle-actions"},je=["onClick"],We=["onClick"],Ke=["innerHTML"],ze={key:0,class:"word-timing-preview"},Ge=ae({__name:"subtitle-generator",setup(Xe){const d=c(""),S=c(!1),a=c(null),C=c(null),v=c(0),g=c(0),L=c(!1),r=c([]),h=c(null),o=c({startTime:0,endTime:0,text:""}),N=P(()=>o.value.text?o.value.text.split(/\s+/).filter(t=>t.length>0).map((t,e)=>({text:t,startTime:null,endTime:null,index:e})):[]),D=P(()=>o.value.text.trim()&&o.value.startTime<o.value.endTime&&o.value.endTime<=g.value),O=async t=>{if(t)try{const e=await de.get("/api/web/v1/video-player/"+t);if(e.data.data.includes("m3u8"))return e.data.data;console.error("Invalid video link received:",e.data.data)}catch(e){console.error("Error fetching video link:",e)}},B=async()=>{if(!isNaN(parseInt(d.value)))try{const t=await O(d.value);if(t)if(t.includes("m3u8")&&_.isSupported()){const e=new _({enableWorker:!1});e.loadSource(t),a.value&&e.attachMedia(a.value),e.on(_.Events.MANIFEST_PARSED,()=>{S.value=!0}),e.on(_.Events.ERROR,(s,n)=>{if(n.fatal)switch(n.type){case _.ErrorTypes.NETWORK_ERROR:e.startLoad();break;case _.ErrorTypes.MEDIA_ERROR:e.recoverMediaError();break;default:e.destroy();break}}
1),a.value&&(a.value.hls=e)}else d.value=t}catch(t){console.error("Error loading video:",t);return}a.value&&(d.value||a.value.src)&&(a.value.hls||a.value.load(),d.value.includes("m3u8")||(S.value=!0))},j=()=>{a.value&&(g.value=a.value.duration)},W=()=>{a.value&&(v.value=a.value.currentTime,J())},R=()=>{a.value&&(a.value.paused?(a.value.play(),L.value=!0):(a.value.pause(),L.value=!1))},K=t=>{const e=t.target,s=parseFloat(e.value);a.value&&(a.value.currentTime=s,v.value=s)},z=()=>{C.value&&C.value.click()},G=t=>{const e=t.target,s=e.files?.[0];if(!s)return;const n=new FileReader;n.onload=i=>{const u=i.target?.result,f=s.name.split(".").pop()?.toLowerCase();f==="vtt"?X(u):f==="srt"?q(u):alert("Unsupported file format. Please upload .vtt or .srt files.")},n.readAsText(s),e.value=""},X=t=>{const e=t.split(`
2`),s=[];let n=0;for(;n<e.length&&!e[n].includes("-->");)n++;for(;n<e.length;){const i=e[n].trim();if(i.includes("-->")){const u=i.split("-->"),f=U(u[0].trim()),x=U(u[1].trim());n++;let m="";for(;n<e.length&&e[n].trim()!=="";)m&&(m+=" "),m+=e[n].trim(),n++;m&&f!==null&&x!==null&&s.push({startTime:f,endTime:x,text:m,words:[]})}n++}r.value=s,console.log(`Imported ${s.length} subtitles from VTT file`)},q=t=>{const e=t.split(/\n\s*\n/).filter(n=>n.trim()),s=[];e.forEach(n=>{const i=n.trim().split(`
3`);if(i.length>=3){const u=i[1],f=i.slice(2);if(u.includes("-->")){const x=u.split("-->"),m=M(x[0].trim()),A=M(x[1].trim()),H=f.join(" ").trim();H&&m!==null&&A!==null&&s.push({startTime:m,endTime:A,text:H,words:[]})}}}),r.value=s,console.log(`Imported ${s.length} subtitles from SRT file`)},U=t=>{const e=t.split(":");try{if(e.length===3){const s=parseInt(e[0]),n=parseInt(e[1]),i=parseFloat(e[2]);return s*3600+n*60+i}else if(e.length===2){const s=parseInt(e[0]),n=parseFloat(e[1]);return s*60+n}}catch(s){console.error("Error parsing VTT time:",t,s)}return null},M=t=>{try{const s=t.replace(",",".").split(":");if(s.length===3){const n=parseInt(s[0]),i=parseInt(s[1]),u=parseFloat(s[2]);return n*3600+i*60+u}}catch(e){console.error("Error parsing SRT time:",t,e)}return null},J=()=>{const t=r.value.find(e=>v.value>=e.startTime&&v.value<=e.endTime);t?(t.displayText=Q(t,v.value),h.value=t):h.value=null},Q=(t,e)=>{let s=t.text;return s=s.replace(/<c\.highlight>(.*?)<\/c\.highlight>/g,'<span class="orange-highlight">$1</span>'),!t.words||t.words.length===0?s:t.words.map(n=>n.startTime!==null&&n.endTime!==null&&e>=n.startTime&&e<=n.endTime?`<span class="highlight">${n.text}</span>`:n.text).join(" ")},Y=t=>t.replace(/<c\.highlight>(.*?)<\/c\.highlight>/g,'<span class="orange-highlight">$1</span>'),Z=()=>{o.value.startTime=Math.round(v.value*10)/10},ee=()=>{o.value.endTime=Math.round(v.value*10)/10},te=()=>{const t={startTime:o.value.startTime,endTime:o.value.endTime,text:o.value.text.trim(),words:N.value.filter(e=>e.startTime!==null&&e.endTime!==null).map(e=>({...e}))};r.value.push(t),r.value.sort((e,s)=>e.startTime-s.startTime),I()},se=t=>{const e=r.value[t];o.value={startTime:e.startTime,endTime:e.endTime,text:e.text},V(t)},V=t=>{r.value.splice(t,1)},I=()=>{o.value={startTime:0,endTime:0,text:""}},le=()=>{confirm("Are you sure you want to clear all subtitles?")&&(r.value=[])},ne=()=>{let t=`WEBVTT
4
5`;r.value.forEach((i,u)=>{t+=`${u+1}
6`,t+=`${$(i.startTime)} --> ${$(i.endTime)}
7`,t+=`${i.text}
8
9`});const e=new Blob([t],{type:"text/vtt"}),s=URL.createObjectURL(e),n=document.createElement("a");n.href=s,n.download="subtitles.vtt",n.click(),URL.revokeObjectURL(s)},E=t=>{const e=Math.floor(t/60),s=Math.floor(t%60),n=Math.floor(t%1*10);return`${e}:${s.toString().padStart(2,"0")}.${n}`},$=t=>{const e=Math.floor(t/3600),s=Math.floor(t%3600/60),n=t%60;return`${e.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}:${n.toFixed(3).padStart(6,"0")}`},F=t=>{t.code==="Space"&&t.target instanceof HTMLElement&&t.target.tagName!=="INPUT"&&t.target.tagName!=="TEXTAREA"&&(t.preventDefault(),R())};return oe(()=>{document.addEventListener("keydown",F)}),ie(()=>{document.removeEventListener("keydown",F),a.value&&a.value.hls&&a.value.hls.destroy()}),(t,e)=>(T(),p("div",pe,[e[10]||(e[10]=l("div",{class:"header"},[l("h1",null,"Advanced Subtitle Editor")],-1)),l("div",Te,[l("div",he,[e[4]||(e[4]=l("label",null,"Video URL:",-1)),y(l("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>d.value=s),type:"url",placeholder:"Enter video URL (mp4, webm, etc.)",class:"url-input"},null,512),[[w,d.value]]),l("button",{onClick:B,disabled:!d.value,class:"load-btn"}
9,"Load Video",8,fe)]),l("div",be,[e[5]||(e[5]=l("label",null,"Import Subtitles:",-1)),l("input",{ref_key:"fileInput",ref:C,type:"file",accept:".vtt,.srt",onChange:G,class:"file-input"},null,544),l("button",{onClick:z,class:"upload-btn"},"📁 Upload Subtitle File")])]),y(l("div",ge,[l("div",_e,[l("video",{ref_key:"videoPlayer",ref:a,src:d.value,controls:"",onTimeupdate:W,onLoadedmetadata:j,class:"video-player"},[h.value?(T(),p("div",ye,[l("div",{class:"subtitle-text",innerHTML:h.value.displayText},null,8,ke)])):k("",!0)],40,xe),h.value?(T(),p("div",Se,[l("div",{class:"subtitle-text",innerHTML:h.value.displayText},null,8,Ee)])):k("",!0)]),l("div",we,[l("button",{onClick:R,class:"control-btn"},b(L.value?"⏸️":"▶️"),1),l("span",Ce,b(E(v.value))+" / "+b(E(g.value)),1),l("input",{type:"range",min:0,max:g.value,value:v.value,onInput:K,class:"seek-bar"},null,40,Le)])],512),[[re,S.value]]),S.value?(T(),p("div",Re,[e[9]||(e[9]=l("h3",null,"Create Subtitle",-1)),l("div",Ue,[l("div",Me,[e[6]||(e[6]=l("label",null,"Start Time:",-1)),y(l("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>o.value.startTime=s),type:"number",step:"0.1",min:"0",max:g.value,class:"time-input"},null,8,Ve),[[w,o.value.startTime]]),l("button",{onClick:Z,class:"time-btn"},"Use Current Time")]),l("div",Ie,[e[7]||(e[7]=l("label",null,"End Time:",-1)),y(l("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>o.value.endTime=s),type:"number",step:"0.1",min:"0",max:g.value,class:"time-input"},null,8,$e),[[w,o.value.endTime]]),l("button",{onClick:ee,class:"time-btn"},"Use Current Time")]),l("div",Fe,[e[8]||(e[8]=l("label",null,"Subtitle Text:",-1)),y(l("textarea",{"onUpdate:modelValue":e[3]||(e[3]=s=>o.value.text=s),placeholder:"Enter subtitle text",class:"text-input",rows:"2"},null,512),[[w,o.value.text]])]),l("div",Ae,[l("button",{onClick:te,disabled:!D.value,class:"add-btn"},"Add Subtitle",8,He),l("button",{onClick:I,class:"clear-btn"},"Clear")])])])):k("",!0),r.value.length>0?(T(),p("div",Pe,[l("h3",null,"Subtitles ("+b(r.value.length)+")",1),l("div",{class:"list-actions"},[l("button",{onClick:ne,class:"export-btn"},"📥 Export VTT"),l("button",{onClick:le,class:"clear-all-btn"},"🗑️ Clear All")]),l("div",Ne,[(T(!0),p(ue,null,ce(r.value,(s,n)=>(T(),p("div",{key:n,class:ve(["subtitle-item",{active:h.value===s}])},[l("div",De,[l("span",Oe,b(E(s.startTime))+" → "+b(E(s.endTime)),1),l("div",Be,[l("button",{onClick:i=>se(n),class:"edit-btn"},"✏️",8,je),l("button",{onClick:i=>V(n),class:"delete-btn"},"🗑️",8,We)])]),l("div",{class:"subtitle-content",innerHTML:Y(s.text)},null,8,Ke),s.words&&s.words.length>0?(T(),p("div",ze,[l("small",null,"Word timing: "+b(s.words.length)+" words",1)])):k("",!0)],2))),128))])])):k("",!0)]))}}),Qe=me(Ge,[["__scopeId","data-v-01b1257c"]]);export{Qe 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.