PageSourceSearch

https://app.zophous.ai/assets/edit._clipRef-B_Gtp0oF.js

js zophous.ai collected 2026-10-05 16:08:25 UTC 8,222 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ZophousEditorApp-CxqiJjo4.js","assets/helpers-Bpr93w1e.js","assets/react-Ux6JKkVi.js","assets/opencut-77hmEi7z.js","assets/index-BuVpVpcd.js","assets/index-D5JSJUL-.css","assets/bootstrap-BdpyyGbg.js","assets/coarsePointer-DRutzzb9.js","assets/brandTheme-Doeqjfx_.js","assets/data-BOruMNSE.js","assets/autoEditRun-DGODPWfC.js","assets/autoEditPrompt-Ek0Gikls.js","assets/TemplateDialog-H62XL2ba.js","assets/RemoveWatermarkButton-BTpFS3Gt.js","assets/Modal-ZqJXXsxV.js","assets/screenWakeLock-B7CdEkJE.js","assets/noEncoderAdvice-hqlc2V90.js","assets/persistEdit-CirjlJwq.js","assets/autosave-66W-eJ96.js","assets/ZophousEditorApp-C9LVVGTq.css"])))=>i.map(i=>d[i]);
2import{_ as q}from"./helpers-Bpr93w1e.js";import{r as d,j as s}from"./react-Ux6JKkVi.js";import{al as Y,y as W,G,am as K,a4 as Q,aa as V,o as I,s as Z,g as u,m as N}from"./opencut-77hmEi7z.js";import{aw as j,ax as H,ay as J,az as C,aA as P,E as X,aB as ee,aC as te,aD as se,aE as ae}from"./index-BuVpVpcd.js";import{loadEditorSession as re}from"./session-BbE_N-SI.js";import{d as A,r as ie,s as oe}from"./saveFlow-DOxZvIzW.js";import{P as ne}from"./PostSheet-bAGWuTgz.js";import{a as de}from"./autoEditPrompt-Ek0Gikls.js";import{s as ce}from"./autosave-66W-eJ96.js";import"./Modal-ZqJXXsxV.js";import"./YouTubeSettings-D-azRNwM.js";import"./oauth-BOXPfhTU.js";import"./returnTo-B4eplrSt.js";import"./clipsList-DX_I3K6n.js";function le({postLocked:t,lazy:a,dirty:n}){return t?"upsell":a?"clip-page":n()?"save-first":"sheet"}const ue=new Set(["/pricing","/workspace/$id/billing"]);async function pe({nextRouteId:t,busy:a,flush:n,dirty:e,confirmDiscard:l}){return ue.has(t)?(await n(),!1):a?!0:(await n(),e()?!l():!1)}function fe(){return J()?"Your latest changes couldn't be saved. Leave anyway?":"You have unsaved edits. Leave and discard them?"}function me({busy:t}){Y({shouldBlockFn:({next:a})=>pe({nextRouteId:a.routeId,busy:t,flush:()=>H({final:!0}),dirty:j,confirmDiscard:()=>window.confirm(fe())}),enableBeforeUnload:!1}),d.useEffect(()=>{const a=n=>{(t||j())&&(n.preventDefault(),n.returnValue="")};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[t])}const ve=d.lazy(()=>q(()=>import("./ZophousEditorApp-CxqiJjo4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.ZophousEditorApp})));function $e(){const{id:t,clipRef:a}=C.useParams(),{post:n}=C.useSearch(),e=P(a),l=W(),h=G(),[$,f]=d.useState(!1),[D,L]=d.useState(0),[m,x]=d.useState(null),[B,F]=d.useState(0),[w,y]=d.useState(n==="1"),_=K(),O=Q(e?.kind==="ace"?e.setId:void 0,e?.kind==="ace"?e.index:0),v=_&&!V(O.status),E=d.useRef(void 0),b=d.useMemo(()=>de(async()=>{const r=P(a);r?.kind==="studio"&&await se(u(),r.variationId)}),[a]);me({busy:$});const i=I({queryKey:["editor-session",a],staleTime:1/0,gcTime:0,retry:!1,enabled:e!==null,queryFn:async()=>{const r=performance.now(),o=await re({ref:e,deps:{supabase:u(),fetchSignedUrl:N,fetchEdit:p=>ae({ref:p,supabase:u()})}});return E.current=performance.now()-r,o}}),S=i.data?.mediaRef,U=I({queryKey:["editor-post-url",a],enabled:w&&!v&&!!S,staleTime:300*1e3,queryFn:()=>N(S)});if(!e)return s.jsx(g,{children:"This edit link is not valid."});const k=()=>{if(e.kind==="ace")l({to:"/workspace/$id/ace-clips",params:{id:t},search:{set:e.setId}});else{const r=i.data?.jobId;l(r?{to:"/workspace/$id/studio/$jobId",params:{id:t,jobId:r}}:{to:"/workspace/$id/studio",params:{id:t}})}},z=()=>{if(e.kind==="ace")l({to:"/workspace/$id/ace-clips",params:{id:t},search:{set:e.setId,post:String(e.index)}});else{const r=i.data?.jobId;l(r?{to:"/workspace/$id/studio/$jobId",params:{id:t,jobId:r},search:{clip:e.variationId,post:e.variationId}}:{to:"/workspace/$id/studio",params:{id:t}})}},R=async(r,o)=>{f(!0);try{const p=A({supabase:u(),queryClient:h}),c=await oe({ref:e,buffer:r,durationMs:o,deps:p});c.ok?(x(null),await b.saved(),k()):(F(o),x(c))}finally{f(!1)}},M=async r=>{await ee({ref:e,project:r.project,mediaAssetId:r.mediaAssetId,supabase:u()}),await b.saved()},T=async r=>{const o=i.data?.usingWindow===!0,p=o?"Restore the AI's original edit? Your saved changes will be discarded.":"Restore the original clip? Your saved edits will be replaced by the original video.";if(window.confirm(p)){f(!0);try{if(o)await ce(r,()=>te({ref:e,supabase:u()})),await h.invalidateQueries({queryKey:["editor-session",a]}),L(c=>c+1);else{const c=A({supabase:u(),queryClient:h});await ie({ref:e,deps:c}),window.alert("Original clip restored."),k()}}catch(c){window.alert(c instanceof Error?c.message:"Restore failed")}finally{f(!1)}}};return i.isPending?s.jsx("div",{className:"flex min-h-[60vh] items-center justify-center",children:s.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-[#7c3aed] border-t-transparent"})}):i.isError?s.jsx(g,{children:i.error instanceof Error?i.error.message:"Failed to load the clip."}):i.data.editable?s.jsxs("div",{className:"zophous-editor-scope dark fixed inset-0 z-50",children:[s.jsx(d.Suspense,{fallback:s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-[#7c3aed] border-t-transparent"})}),children:s.jsx(ve,{session:i.data,clipRef:e,onBack:k,onRestore:T,onPersist:M,onAutoEditApplied:b.applied,onExported:(r,{durationMs:o})=>R(r,o),onPost:()=>{switch(le({postLocked:v,lazy:i.data.usingWindow===!0,dirty:j})){case"upsell":case"sheet":y(!0);return;case"clip-page":z();return;case"save-first":window.alert("Save your edits first (Save to Zophous), then post — posting uses the saved version.");return}},sessionLoadMs:E.current},`${a}:${i.data.savedEdit?.editedAt??"recipe"}:${D}`)}),m&&s.jsx(he,{failure:m,onRetry:()=>{R(m.buffer,B)},onDownload:()=>{const r=URL.createObjectURL(new Blob([m.buffer],{type:"video/mp4"})),o=document.createElement("a");o.href=r,o.download="edited-clip.mp4",o.click()},onDismiss:()=>x(null)}),w&&v&&s.jsx(X,{open:!0,onClose:()=>y(!1),workspaceId:t,lane:e.kind==="studio"?"studio":"clips"}),w&&!v&&s.jsx(ne,{open:!0,onClose:()=>y(!1),workspaceId:t,returnPath:`/workspace/${t}/edit/${a}?post=1`,clip:{mediaRef:e.kind==="ace"?{resource:"ace_clip",id:e.setId,index:e.index}:{resource:"shortform_variation",id:e.variationId},title:i.data.title,durationSec:i.data.durationSeconds,mediaCreatedAt:i.data.createdAt??new Date().toISOString(),previewUrl:U.data??null,lazyClipRef:i.data.usingWindow?e:void 0}})]}):s.jsxs(g,{children:[i.data.blockedReason??"This clip cannot be edited.",s.jsx(xe,{workspaceId:t,kind:e.kind})]})}function he({failure:t,onRetry:a,onDownload:n,onDismiss:e}){return s.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60",children:s.jsxs("div",{className:"mx-4 w-full max-w-96 rounded-lg border border-line bg-surface p-5",children:[s.jsx("p",{className:"text-sm font-medium text-ink",children:t.stage==="reconcile"?"Video replaced, but updating clip details failed":"Saving failed"}),s.jsx("p",{className:"mt-2 break-words text-xs text-muted-foreground",children:t.error}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Your edited video is still here — retry, or download it to your computer."}),s.jsxs("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:e,className:"rounded-md px-3 py-1.5 text-sm text-muted-foreground hover:bg-surface2 hover:text-ink",children:"Dismiss"}),s.jsx("button",{type:"button",onClick:n,className:"rounded-md bg-surface2 px-3 py-1.5 text-sm text-ink hover:opacity-90",children:"Download video"}),s.jsx("button",{type:"button",onClick:a,className:"rounded-md bg-purple px-3 py-1.5 text-sm font-medium text-white hover:opacity-90",children:"Retry"})]})]})})}function g({children:t}){return s.jsx("div",{className:"flex min-h-[60vh] flex-col items-center justify-center gap-3 text-sm text-neutral-400",children:t})}function xe({workspaceId:t,kind:a}){return s.jsxs(Z,{to:a==="ace"?"/workspace/$id/ace-clips":"/workspace/$id/studio",params:{id:t},className:"text-[#7c3aed] underline",children:["Back to ",a==="ace"?"clips":"Studio"]})}export{$e as component};

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.