PageSourceSearch

https://videotranscription.ai/_nuxt/jn0-kUZ3.js

js videotranscription.ai collected 2026-10-05 00:47:01 UTC 8,736 bytes, 1 lines download raw bytes

1import{l as t}from"./DK4VA623.js";import{f as e}from"./BWkiYbo0.js";import{c as r}from"./BPTfH13T.js";import{C as n}from"#entry";import{g as s,o as a}from"./zJQOa3Li.js";const i=/(?:^|[\r\n]+)\s*((?:\d{2}:)?\d{2}:\d{2})\s*/g,o=t=>t.replaceAll("&#39;","'").replaceAll("&amp;","&").replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&quot;",'"'),u=t=>String(t??"").replace(/\r\n/g,"\n").replace(/\u00a0/g," ").split("\n").map(t=>t.trim()).filter(Boolean).join(" ").trim(),c=t=>{if("number"==typeof t&&Number.isFinite(t))return t;if("string"!=typeof t)return null;const e=t.trim().replace(",",".");if(!e)return null;const r=Number(e);if(Number.isFinite(r))return r;if(!e.includes(":"))return null;const n=e.split(":").map(t=>Number(t));if(n.some(t=>!Number.isFinite(t)))return null;let s=0;for(const a of n)s=60*s+a;return s},l=t=>{const e=Math.max(0,Math.floor(t)),r=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return r>0?[r,n,s].map(t=>String(t).padStart(2,"0")).join(":"):[n,s].map(t=>String(t).padStart(2,"0")).join(":")},p=t=>{if(!t||"object"!=typeof t)return null;const e=t,r=(t=>{const e=[t.text,t.content,t.message,t.summary];for(const r of e)if("string"==typeof r){const t=u(r);if(t)return t}return""})(e);if(!r)return null;const n=e.start??e.time??e.timestamp,s=Math.max(0,c(n)??0),a=(t=>{const e=[t.speaker,t.speaker_id,t.speakerId,t.speaker_label,t.speakerLabel].find(t=>"string"==typeof t&&t.trim());return"string"==typeof e?e.trim():""})(e);return{time:l(s),text:o(r),...a?{speaker:a}:{}}},f=t=>{if(Array.isArray(t))return t.flatMap(f);if(!t||"object"!=typeof t)return[];const e=t,r=p(e);return r?[r]:[e.items,e.rows,e.result,e.data].flatMap(f)},m=t=>{const e=String(t||"").replace(/\r\n/g,"\n").replace(/\u00a0/g," ").trim();if(!e.trim())return[];const r=e.replace(/^```(?:json)?\s*/i,"").replace(/\s*```$/i,"").trim();try{const t=f(JSON.parse(r));if(t.length)return t}catch{}const n=function(t){const e=[],r=[];let n=!1,s=!1;for(let a=0;a<t.length;a++){const i=t[a];if(n){s?s=!1:"\\"===i?s=!0:'"'===i&&(n=!1);continue}if('"'===i){n=!0;continue}if("{"===i){r.push(a);continue}if("}"!==i||!r.length)continue;const o=r.pop();try{const r=p(JSON.parse(t.slice(o,a+1)));r&&e.push(r)}catch{}}return e}(r);if(n.length)return n;const s=/^(?:\d{2}:)?\d{2}:\d{2}\b/.test(e)?e:`\n${e}`,a=Array.from(s.matchAll(i));if(!a.length)return[];const m=[];for(let i=0;i<a.length;i++){const t=a[i],e=t[1],r=(t.index??0)+t[0].length,n=a[i+1],p=n?.index??s.length,f=u(o(s.slice(r,p)));f&&m.push({time:l(Math.max(0,c(e)??0)),text:f})}return m},d=(t,e)=>e?t:t.map(({speaker:t,...e})=>e);const g=(t={})=>{const r=e({initialData:[],onUpdate:e=>{t.onUpdate?.({transcript:e.data,started:e.started,completed:e.completed})}});let n="";return{consumeMessage(e){const s=(t=>{if(!t||"object"!=typeof t)return"";const e=t;if("text_chunk"!==e.event)return"";const r=e.data;if(!r||"object"!=typeof r)return"";const n=r.text;return"string"==typeof n?o(n):""})(e.payload);if(s){n=((t,e)=>{if(!e)return t;if(!t)return e;if(e.startsWith(t))return e;if(t.endsWith(e))return t;for(let r=Math.min(t.length,e.length);r>0;r--)if(t.slice(-r)===e.slice(0,r))return t+e.slice(r);return`${t}${e}`})(n,s);const e=m(n);e.length&&r.update({data:d(e,!0===t.speakerEnabled),started:!0})}},complete(e){const s=d(m(n),!0===t.speakerEnabled);return r.complete(s),s},fail:()=>(r.complete([]),[]),getSnapshot(){const t=r.getSnapshot();return{transcript:t.data,started:t.started,completed:t.completed}}}},h=t=>{if("number"==typeof t&&Number.isFinite(t))return t;if("string"!=typeof t)return null;const e=t.trim().replace(",",".");if(!e)return null;const r=Number(e);if(Number.isFinite(r))return r;if(!e.includes(":"))return null;const n=e.split(":").map(t=>Number(t));if(n.some(t=>!Number.isFinite(t)))return null;let s=0;for(const a of n)s=60*s+a;return s},y=t=>{const e=Math.max(0,Math.floor(t)),r=Math.floor(e/3600),n=Math.floor(e%3600/60),s=e%60;return r>0?[r,n,s].map(t=>String(t).padStart(2,"0")).join(":"):[n,s].map(t=>String(t).padStart(2,"0")).join(":")},k=(t,e)=>{const r=t.start,n=h(r);return Math.max(0,n??5*e)},b=t=>{const e=document.createElement("textarea");return e.innerHTML=t,e.value}
1,x=/[.!?]["')\]]*$/,S=t=>{const e=[];let r=0,n="",s=[];return t.forEach((a,i)=>{s.length||(r=a.seconds,n=a.speaker||""),s.push(a.text);const o=t[i+1],u=s.join(" "),c=(o?.seconds??a.seconds)-r,l=Boolean(n&&o?.speaker&&o.speaker!==n),p=x.test(a.text);(!o||l||u.length>=420||c>=45||u.length>=180&&p)&&((()=>{const t=s.join(" ").trim();t&&e.push({time:y(r),text:t,...n?{speaker:n}:{}})})(),s=[],n="")}),e},M=t=>t.map((e,r)=>{const n=t[r+1],s=n?Math.max(0,n.seconds-e.seconds):0;return{text:e.text,start:e.seconds,dur:s,...e.speaker?{speaker:e.speaker}:{}}}),w=t=>Array.isArray(t.subtitles)&&t.subtitles.length?t.subtitles.map((t,e,r)=>{const n=Math.max(0,h(t.time)??5*e),s=h(r[e+1]?.time);return{text:String(t.text||"").trim(),start:n,dur:null==s?0:Math.max(0,s-n),..."string"==typeof t.speaker&&t.speaker.trim()?{speaker:t.speaker.trim()}:{}}}).filter(t=>t.text):(t=>{const e="string"==typeof t?t.trim():"";return e?[{text:e,start:0,dur:0}]:[]})(t.content),j=async(e,r,n="",s="",a=!1)=>{if(!e.length)return[];const i=g({speakerEnabled:a,onUpdate:t=>{r?.({transcript:t.transcript,transcriptStarted:t.started})}}),o=await t({chunks:M(e),url:n,title:s,speaker:a},{initialData:[],onMessage:t=>{i.consumeMessage(t)}});return i.complete(o?.data)},A=async(t,e,r={})=>{const n=(t=>{if("string"==typeof t)return t.trim();if(!t||"object"!=typeof t)return"";const e=t,r=[e.content,e.data,e.text];for(const n of r)if("string"==typeof n&&n.trim())return n.trim();return""})(t);if(n)return e?.({content:n,subtitles:[],transcript:[]}),{content:n,subtitles:[],transcript:[]};const s=(t=>{if(Array.isArray(t))return t;if(!t||"object"!=typeof t)return[];const e=t,r=[e.data,e.subtitles,e.captions,e.list,e.items];for(const n of r)if(Array.isArray(n))return n;return[]})(t);if(!s.length)return{content:"",subtitles:[],transcript:[]};const a=(t=>t.map((t,e)=>{if(!t||"object"!=typeof t)return null;const r=t,n=(t=>{const e=t.text;return"string"==typeof e?(t=>t.replace(/\s+/g," ").trim())(e):""})(r);if(!n)return null;const s=(t=>{const e=[t.speaker,t.speaker_id,t.speakerId,t.speaker_label,t.speakerLabel].find(t=>"string"==typeof t&&t.trim());return"string"==typeof e?e.trim():""})(r);return{seconds:k(r,e),text:b(n),...s?{speaker:s}:{}}}).filter(t=>null!==t).sort((t,e)=>t.seconds-e.seconds))(s);if(!a.length)return{content:"",subtitles:[],transcript:[]};const i=a.map(t=>({time:y(t.seconds),text:t.text,...t.speaker?{speaker:t.speaker}:{}}));const o=r.useSourceAsTranscript?S(a):[];return e?.({content:"",subtitles:i,transcript:o}),!1===r.requestTranscript?{content:"",subtitles:i,transcript:o}:{content:"",subtitles:i,transcript:await j(a,e,"string"==typeof r.requestUrl?r.requestUrl.trim():"","string"==typeof r.title?r.title.trim():"",!0===r.speakerDiarization)}},v=t=>{const e=t,r=e?.data?.task_id??e?.task_id??("string"==typeof e?.data?e.data:"");return"string"==typeof r?r:String(r??"")},E=(t={})=>{let e=null,i=0,o=null;const u=()=>{e&&(clearTimeout(e),e=null)},c=()=>{i+=1;o?o():u()},l=async(s,a={})=>{const l=a.interval??t.interval??3e3;let p=a.maxAttempts??t.maxAttempts;const f=a.request??t.request??r,m=a.pendingStatuses??t.pendingStatuses??[0,1],d=a.successStatus??t.successStatus??2,g=a.errorStatus??t.errorStatus??3,h=a.resolveStatus??t.resolveStatus??(t=>Number(t?.status)),y=a.resolveMessage??t.resolveMessage??(t=>{const e=t?.message;return"string"==typeof e?e:"Task failed"}),k=a.resolveResult??t.resolveResult??(t=>t?.data??null),b=a.onError??t.onError??(async(t,e)=>{await n({title:t,icon:"warning",confirmButtonClass:"btn btn-primary",error:e})});if(!s)throw new Error("task_id is required");c();const x=++i;return await new Promise((t,r)=>{let n=!1;const a=()=>!n&&(n=!0,o=null,u(),!0),c=()=>{a()&&r(new Error("Polling cancelled"))};o=c;const S=()=>x!==i&&(c(),!0),M=async()=>{if(!S())try{const n=await f(s);if(S())return;const i=n?.data??{},o=h(i);if(o===d){const e=k(i);if(!a())return;return void t(e)}if(o===g){if(!a())return;const t=y(i);return await b(t,i),void r(new Error(t))}if(!m.includes(o)){if(!a())return;return void r(new Error(`Unexpected polling status: ${o}`))}if("number"==typeof p&&(p-=1,p<=0)){if(!a())return;return void r(new Error("Polling timed out"))}
1e=setTimeout(M,l)}catch(n){if(S())return;if(!a())return;r(n)}};M()})};return s()&&a(()=>{c()}),{checkStatus:l,clearCheckStatus:u,cancelCheckStatus:c,submitTaskWithPolling:async(t,e,r={})=>{const n=await t(e),s=(r.resolveTaskId??v)(n);if(!s)throw new Error("task_id is required");await(r.onTaskIdResolved?.(s,n));return{response:n,task_id:s,data:await l(s,r)}}}};export{w as a,A as b,E as u};

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.