PageSourceSearch

https://surviveaccounting.com/assets/ceq-takes-2pHeHkO_.js

js surviveaccounting.com collected 2026-10-09 03:04:32 UTC 4,385 bytes, 1 lines download raw bytes

1import{aE as d}from"./index-B-VekllG.js";const m="ceq-takes",f={hook:"Hook",explain:"Explain",echo:"Echo",frontBumper:"Front bumper",backBumper:"Back bumper"},b=["hook","explain","echo"];function g(r,t,o="mp4"){return r==="backBumper"?`back-bumper-${String(1e3+t).padStart(4,"0")}.${o}`:r==="frontBumper"?`front-bumper-${String(t).padStart(2,"0")}.${o}`:`${r??"clip"}-${String(t).padStart(2,"0")}.${o}`}function l(r){return new Promise(t=>{try{const o=document.createElement("video");o.preload="metadata";const s=URL.createObjectURL(r),e=n=>{try{URL.revokeObjectURL(s)}catch{}t(Number.isFinite(n)&&n>0?n:0)};o.onloadedmetadata=()=>e(o.duration),o.onerror=()=>e(0),o.src=s,window.setTimeout(()=>e(0),8e3)}catch{t(0)}})}function h(r,t,o,s){const e="https://unvxagsledbsdoremqeb.supabase.co".replace(/\/+$/,"");return new Promise(n=>{const a=new XMLHttpRequest;a.open("PUT",`${e}/storage/v1/object/upload/sign/canvas-media/${r}?token=${encodeURIComponent(t)}`),a.setRequestHeader("content-type",o.type||"video/mp4"),a.upload.onprogress=i=>{i.lengthComputable&&i.total>0&&s?.(i.loaded/i.total)},a.onload=()=>{if(a.status>=200&&a.status<300)return n(null);let i=`upload rejected (HTTP ${a.status})`;try{const c=JSON.parse(a.responseText);i=c.message||c.error||i}catch{}n(a.status===413?`Payload too large — ${i}`:i)},a.onerror=()=>n("network error mid-upload — the connection dropped (or the server cut a too-large body short)"),a.ontimeout=()=>n("upload timed out"),a.send(o)})}async function S(r,t){const o=r.name.includes(".")?r.name.split(".").pop():"mp4",s=t?.knownDurationS&&t.knownDurationS>0?t.knownDurationS:await l(r),{path:e,token:n,publicUrl:a}=await d({data:{ext:o,folder:m}}),i=await h(e,n,r,t?.onProgress);if(i){if(/maximum allowed size|exceeded|too large|payload/i.test(i)){const c=(r.size/1048576).toFixed(0);throw new Error(`Take is ${c}MB — over the Supabase upload limit. Raise it: Storage → Settings → Upload file size limit (project), and the canvas-media bucket's file_size_limit. Then retry — the local file is untouched.`)}throw new Error(i)}return{url:a,path:e,name:r.name,duration:Math.round(s*10)/10}}const w=(r,t)=>t?{...r,prev:{url:t.url,path:t.path,name:t.name,duration:t.duration}}:r;function $(r){return Array.from(r.dataTransfer.files).filter(o=>o.type.startsWith("video/")||/\.(mp4|mov|mkv|webm|m4v)$/i.test(o.name))[0]??null}function v(r){return Array.from(r.dataTransfer.files).filter(t=>t.type.startsWith("video/")||/\.(mp4|mov|mkv|webm|m4v)$/i.test(t.name))}const E=r=>{const t=Math.max(0,Math.round(r??0));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`};function y(r,t){const o=[],s=[];t.intro&&o.push({kind:"intro",take:t.intro,label:"Intro"}),(t.frontBumpers??[]).forEach((e,n)=>o.push({kind:"frontBumper",clip:n,take:e,label:`Front bumper ${n+1}`})),t.hook&&o.push({kind:"hook",take:t.hook,label:"Set intro"});for(const e of t.ceqs){if(r==="free"&&!e.free)continue;const n=e.stitched?[e.stitched]:e.takes&&e.takes.length?e.takes:e.take?[e.take]:[];if(n.length===0){s.push({id:e.id,prompt:e.prompt});continue}n.forEach((a,i)=>o.push({kind:"ceq",ceqId:e.id,clip:i,take:a,label:i===0?e.prompt:`${e.prompt} — lookback ${i}`}))}return(t.wrap??[]).forEach((e,n)=>o.push({kind:"wrap",clip:n,take:e,label:`Wrap ${n+1}`})),(t.backBumpers??[]).forEach((e,n)=>o.push({kind:"backBumper",clip:n,take:e,label:`Back bumper ${n+1}`})),t.outro&&o.push({kind:"outro",take:t.outro,label:"Outro"}),{items:o,missing:s}}const q=r=>r.reduce((t,o)=>t+(o.take.duration??0),0);function R(r,t){const o=Math.max(0,t)/1e3,s=a=>Math.round(a*1e3)/1e3,e=[];let n=0;return r.forEach((a,i)=>{const c=Math.max(0,n-i*o),u=a.take.duration??0;a.kind==="ceq"&&a.ceqId?e.push({ceqId:a.ceqId,clip:a.clip??0,kind:"ceq",start:s(c),end:s(c+u)}):a.kind==="wrap"?e.push({kind:"wrap",clip:a.clip??0,start:s(c),end:s(c+u)}):a.kind==="hook"&&e.push({kind:"intro",clip:0,start:s(c),end:s(c+u)}),n+=u}),e}const p="sa-ceq-studio-prefs";function B(){try{return JSON.parse(localStorage.getItem(p)||"{}")}catch{return{}}}function P(r){try{localStorage.setItem(p,JSON.stringify(r))}catch{}}export{m as CEQ_TAKES_FOLDER,b as CLIP_ROLES,f as ROLE_LABEL,g as autoClipName,y as buildStitch,E as fmtDur,B as loadPrefs,h as putSignedUpload,l as readDuration,P as savePrefs,S as stageTake,R as stitchManifest,q as stitchRuntime,$ as videoFromDrop,v as videosFromDrop,w as withPrev};

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.