1import{f as Ye,c as Be,r as n,q as u,W as L,F as h,j as e,C,K as R,a$ as d,N as A,aa as Se,a as D,B as r,O as E,L as p,n as ne,a7 as F,an as Ce,aA as O,af as ce,p as We,z as oe,a9 as ke,I as Je,b5 as _e,au as Xe,a6 as Pe,bZ as Ze,$ as q,a0 as z,a1 as K,a2 as H,a3 as Q,a4 as de,a5 as me,Q as m}from"./index-tc5-nNLC.js";import{T as es}from"./textarea-DN2rY_yY.js";import{T as ss,a as ts,b as xe,c as he}from"./tabs-D2OfY7RH.js";import{S as V,a as G,b as Y,c as B,d as o}from"./select-Bsa-6vNv.js";import{P as as}from"./progress-CJIgvptw.js";import{d as is,f as rs}from"./index-CA8G2zMx.js";import{R as ls}from"./index-CJAmMy_E.js";import{L as ns}from"./log-in-DrADV0ef.js";import{E as ue}from"./eye-7YOw3q0i.js";import{C as cs}from"./crown-BaX0qJx5.js";import{T as pe}from"./type-CI5hK1ZH.js";import{I as os}from"./image-CUhS0kqX.js";import{G as ds}from"./grip-vertical-wW0VvTEo.js";import{P as Te}from"./play-DZhwD__F.js";import{C as Ie}from"./copy-Bquar6tk.js";import"./index-C-y5wYFI.js";import"./chevron-down-DOFZ7rzv.js";import"./chevron-up-1gTexUQn.js";function Ms(){const{user:k,isLoading:Me}=Ye(),{toast:l}=Be(),[$e,Ue]=n.useState("my-reels"),[t,w]=n.useState(null),[Le,y]=n.useState(!1),[Re,je]=n.useState(!1),[Ae,P]=n.useState(!1),[De,T]=n.useState(!1),[Ee,ge]=n.useState(!1),[j,W]=n.useState(null),[I,be]=n.useState({progress:0,step:null}),[x,J]=n.useState(null),[M,_]=n.useState(""),[X,$]=n.useState(!1),[ve,Z]=n.useState(null),S={current:null},[g,b]=n.useState({title:"",description:"",templateId:"",sourceType:"trip",aspectRatio:"9:16"});n.useEffect(()=>{document.title="Highlight Reel Studio | Slant"},[]),n.useEffect(()=>{if(!j)return;const s=setInterval(async()=>{try{const a=await fetch(`/api/premium/render-jobs/${j}`,{credentials:"include"});if(!a.ok)throw new Error("Failed to fetch render status");const i=await a.json();be({progress:i.progress,step:i.currentStep}),i.status==="completed"?(clearInterval(s),W(null),u.invalidateQueries({queryKey:["/api/premium/reels"]}),l({title:"Render complete!",description:"Your highlight reel is ready to view and share."})):i.status==="failed"&&(clearInterval(s),W(null),l({title:"Render failed",description:i.errorMessage||"An error occurred during rendering",variant:"destructive"}))}catch(a){console.error("Error polling render status:",a)}},2e3);return()=>clearInterval(s)},[j,l]);const{data:ee,isLoading:Fe}=L({queryKey:["/api/premium/reels/templates"],enabled:!!k}),{data:v,isLoading:Oe}=L({queryKey:["/api/premium/reels"],enabled:!!k}),{data:c,isLoading:qe}=L({queryKey:["/api/premium/reels",t==null?void 0:t.id,"segments"],enabled:!!t}),se=h({mutationFn:async s=>(await m("POST","/api/premium/reels",s)).json(),onSuccess:s=>{u.invalidateQueries({queryKey:["/api/premium/reels"]}),w(s),y(!1),b({title:"",description:"",templateId:"",sourceType:"trip",aspectRatio:"9:16"}),l({title:"Reel created!",description:"Start adding media to your highlight reel."})},onError:s=>{l({title:"Error",description:s.message,variant:"destructive"})}}),ze=h({mutationFn:async s=>(await m("DELETE",`/api/premium/reels/${s}`)).json(),onSuccess:()=>{u.invalidateQueries({queryKey:["/api/premium/reels"]}),w(null),l({title:"Reel deleted"})}}),te=h({mutationFn:async s=>(await m("POST",`/api/premium/reels/${s}/render`)).json(),onSuccess:s=>{W(s.renderJobId),be({progress:s.progress||0,step:s.currentStep||"preparing"}),u.invalidateQueries({queryKey:["/api/premium/reels"]}),l({title:"Rendering started!",description:"Your video is being processed. This may take a few minutes."})},onError:s=>{l({title:"Render failed",description:s.message,variant:"destructive"})}}),ae=h({mutationFn:async s=>(await m("POST",`/api/premium/reels/${s}/publish`)).json(),onSuccess:s=>{u.invalidateQueries({queryKey:["/api/premium/reels"]}),w(s),l({title:"Reel published!",description:"Your reel is now live."})},onError:s=>{l({title:"Publish failed",description:s.message,variant:"destructive"})}}),Ne=h({mutationFn:async({reelId:s,platform:a})=>(await m("POST",`/api/premium/reels/${s}/share`,{platform:a})).json(),onSuccess:()=>{u.invalidateQueries({queryKey:["/api/premium/reels"]})}}),ie=h({mutationFn:async({reelId:s,sourceType:a,sourceId:i})=>(await m("POST",`/api/premium/reels/${s}/ai-generate`,{sourceType:a,sourceId:i})).json(),onSuccess:()=>
1{u.invalidateQueries({queryKey:["/api/premium/reels",t==null?void 0:t.id,"segments"]}),l({title:"AI generation complete!",description:"Your reel has been populated with content."})},onError:s=>{l({title:"AI generation failed",description:s.message,variant:"destructive"})}}),{data:re,isLoading:Ke,refetch:ms}=L({queryKey:["/api/premium/studio-projects"],enabled:!!k}),N=h({mutationFn:async s=>x?(await m("PATCH",`/api/premium/studio-projects/${x.id}`,s)).json():(await m("POST","/api/premium/studio-projects",s)).json(),onSuccess:s=>{u.invalidateQueries({queryKey:["/api/premium/studio-projects"]}),J(s),$(!1),Z(new Date),T(!1),l({title:"Project saved!",description:`"${s.name}" has been saved.`})},onError:s=>{l({title:"Save failed",description:s.message,variant:"destructive"})}}),He=h({mutationFn:async s=>x?(await m("PATCH",`/api/premium/studio-projects/${x.id}/auto-save`,s)).json():null,onSuccess:s=>{s&&($(!1),Z(new Date(s.savedAt)))}}),le=h({mutationFn:async s=>(await m("GET",`/api/premium/studio-projects/${s}`)).json(),onSuccess:s=>{var a;if(J(s),$(!1),Z(s.lastAutoSaveAt?new Date(s.lastAutoSaveAt):new Date(s.updatedAt)),P(!1),s.reelId){const i=(a=v==null?void 0:v.reels)==null?void 0:a.find(f=>f.id===s.reelId);i&&w(i)}l({title:"Project loaded!",description:`"${s.name}" is now active.`})},onError:s=>{l({title:"Load failed",description:s.message,variant:"destructive"})}}),fe=h({mutationFn:async s=>(await m("DELETE",`/api/premium/studio-projects/${s}`)).json(),onSuccess:()=>{u.invalidateQueries({queryKey:["/api/premium/studio-projects"]}),x&&(J(null),$(!1)),l({title:"Project deleted"})}}),we=h({mutationFn:async({projectId:s,newName:a})=>(await m("POST",`/api/premium/studio-projects/${s}/duplicate`,{newName:a})).json(),onSuccess:s=>{u.invalidateQueries({queryKey:["/api/premium/studio-projects"]}),l({title:"Project duplicated!",description:`Created "${s.name}"`})}});n.useEffect(()=>{if(!(!x||!X))return S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{const s=c?{segments:c.map((a,i)=>({id:a.id,position:a.position||i,mediaType:a.mediaType,mediaUrl:a.mediaUrl,thumbnailUrl:a.thumbnailUrl,durationMs:a.durationMs,startTimeMs:0,transitionIn:a.transitionIn,transitionOut:a.transitionOut,transitionDurationMs:500,caption:a.caption,effects:a.effects,locationName:a.locationName})),totalDurationMs:c.reduce((a,i)=>a+i.durationMs,0),aspectRatio:(t==null?void 0:t.aspectRatio)||"9:16",playheadPosition:0,zoom:1}:null;He.mutate({timelineState:s})},3e3),()=>{S.current&&clearTimeout(S.current)}},[x,X,c,t]);const Qe=()=>{if(!x)T(!0);else{const s=c?{segments:c.map((a,i)=>({id:a.id,position:a.position||i,mediaType:a.mediaType,mediaUrl:a.mediaUrl,thumbnailUrl:a.thumbnailUrl,durationMs:a.durationMs,startTimeMs:0,transitionIn:a.transitionIn,transitionOut:a.transitionOut,transitionDurationMs:500,caption:a.caption,effects:a.effects,locationName:a.locationName})),totalDurationMs:c.reduce((a,i)=>a+i.durationMs,0),aspectRatio:(t==null?void 0:t.aspectRatio)||"9:16",playheadPosition:0,zoom:1}:null;N.mutate({name:x.name,timelineState:s,reelId:t==null?void 0:t.id})}},Ve=s=>{const a=c?{segments:c.map((i,f)=>({id:i.id,position:i.position||f,mediaType:i.mediaType,mediaUrl:i.mediaUrl,thumbnailUrl:i.thumbnailUrl,durationMs:i.durationMs,startTimeMs:0,transitionIn:i.transitionIn,transitionOut:i.transitionOut,transitionDurationMs:500,caption:i.caption,effects:i.effects,locationName:i.locationName})),totalDurationMs:c.reduce((i,f)=>i+f.durationMs,0),aspectRatio:(t==null?void 0:t.aspectRatio)||"9:16",playheadPosition:0,zoom:1}:null;N.mutate({name:s,timelineState:a,reelId:t==null?void 0:t.id})},U=async s=>{if(!(t!=null&&t.shareSlug))return;const a=`${window.location.origin}/reel/${t.shareSlug}`;await Ne.mutateAsync({reelId:t.id,platform:s});const i={twitter:`https://twitter.com/intent/tweet?url=${encodeURIComponent(a)}&text=${encodeURIComponent(`Check out my travel highlight reel: ${t.title}`)}`,facebook:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(a)}`,linkedin:`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(a)}`,whatsapp:`https://wa.me/?text=${encodeURIComponent(`Check out my travel highlight reel: ${t.title} - ${a}`)}`};i[s]&&window.open(i[s],"_blank","width=600,height=400")},Ge=async()=>
1{if(!(t!=null&&t.shareSlug))return;const s=`${window.location.origin}/reel/${t.shareSlug}`;await navigator.clipboard.writeText(s),ge(!0),setTimeout(()=>ge(!1),2e3),await Ne.mutateAsync({reelId:t.id,platform:"copy_link"})};if(Me)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-2 border-cyan-500 border-t-transparent"})});if(!k)return e.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-slate-900 to-slate-800",children:e.jsxs(C,{className:"max-w-md w-full bg-slate-900/60 backdrop-blur-xl border-slate-700/50","data-testid":"studio-login-prompt",children:[e.jsxs(R,{className:"text-center",children:[e.jsx(d,{className:"h-16 w-16 mx-auto text-cyan-400 mb-4"}),e.jsx(A,{className:"text-2xl text-white",children:"Highlight Reel Studio"}),e.jsx(Se,{className:"text-slate-400",children:"Create stunning shareable highlight reels from your trips. Sign in to get started."})]}),e.jsx(D,{children:e.jsxs(r,{className:"w-full gap-2 bg-gradient-to-r from-cyan-500 to-blue-600 hover:brightness-110",onClick:()=>window.location.href="/api/login","data-testid":"studio-login-btn",children:[e.jsx(ns,{className:"h-4 w-4"}),"Sign In to Continue"]})})]})});const ye=(v==null?void 0:v.reels)||[];return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900",children:[e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-white flex items-center gap-3","data-testid":"studio-title",children:[e.jsx(d,{className:"h-8 w-8 text-cyan-400"}),"Highlight Reel Studio"]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[e.jsx("p",{className:"text-slate-400",children:"Create and share stunning video reels from your travel memories"}),x&&e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(E,{variant:"outline",className:"border-cyan-500/50 text-cyan-400",children:x.name}),ve&&e.jsxs("span",{className:"text-slate-500 text-xs",children:["Saved ",ve.toLocaleTimeString()]}),X&&e.jsxs("span",{className:"text-yellow-400 text-xs flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-400 animate-pulse"}),"Unsaved"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",onClick:()=>P(!0),className:"gap-2 border-slate-600 text-slate-300 hover:bg-slate-800","data-testid":"btn-open-project",children:[e.jsx(d,{className:"h-4 w-4"}),"Projects"]}),e.jsxs(r,{variant:"outline",onClick:Qe,disabled:N.isPending,className:"gap-2 border-slate-600 text-slate-300 hover:bg-slate-800","data-testid":"btn-save-project",children:[N.isPending?e.jsx(p,{className:"h-4 w-4 animate-spin"}):e.jsx(ne,{className:"h-4 w-4"}),"Save"]}),e.jsxs(r,{onClick:()=>y(!0),className:"gap-2 bg-gradient-to-r from-cyan-500 to-blue-600 hover:brightness-110","data-testid":"btn-create-reel",children:[e.jsx(F,{className:"h-4 w-4"}),"Slant It"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-1",children:[e.jsxs(C,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(R,{className:"pb-3",children:e.jsxs(A,{className:"text-lg text-white flex items-center gap-2",children:[e.jsx(Ce,{className:"h-5 w-5 text-cyan-400"}),"My Reels"]})}),e.jsx(D,{children:Oe?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(s=>e.jsx(O,{className:"h-20 w-full bg-slate-800"},s))}):ye.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(d,{className:"h-12 w-12 mx-auto text-slate-600 mb-3"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"No reels yet. Create your first one!"})]}):e.jsx(ce,{className:"h-[400px]",children:e.jsx("div",{className:"space-y-2",children:ye.map(s=>e.jsx("div",{onClick:()=>w(s),className:`p-3 rounded-lg cursor-pointer transition-all ${(t==null?void 0:t.id)===s.id?"bg-cyan-500/20 border border-cyan-500/40":"bg-slate-800/60 hover:bg-slate-800 border border-transparent"}`,"data-testid":`reel-item-${s.id}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-16 h-12 rounded bg-slate-700 flex items-center justify-center flex-shrink-0",children:s.thumbnailUrl?e.jsx("img",{src:s.thumbnailUrl,alt:"",className:"w-full h-full object-cover rounded"}):e.jsx(d,{className:"h-5 w-5 text-slate-500"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-white truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx(E,{variant:"outline",className:`text-xs ${s.status==="published"?"border-green-500 text-green-400":s.status==="rendering"?"border-yellow-500 text-yellow-400":"border-slate-500 text-slate-400"}`,children:s.status}),s.viewCount>0&&e.jsxs("span",{className:"text-xs text-slate-500 flex items-center gap-1",children:[e.jsx(ue,{className:"h-3 w-3"})," ",s.viewCount]})]})]})]})},s.id))})})})]}),e.jsxs(C,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 mt-6",children:[e.jsx(R,{className:"pb-3",children:e.jsxs(A,{className:"text-lg text-white flex items-center gap-2",children:[e.jsx(We,{className:"h-5 w-5 text-cyan-400"}),"Templates"]})}),e.jsx(D,{children:Fe?e.jsx("div",{className:"grid grid-cols-2 gap-2",children:[1,2,3,4].map(s=>e.jsx(O,{className:"h-24 w-full bg-slate-800"},s))}):e.jsx(ce,{className:"h-[200px]",children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ee==null?void 0:ee.map(s=>e.jsxs("div",{className:"relative rounded-lg overflow-hidden cursor-pointer group",onClick:()=>{t&&b(a=>({...a,templateId:s.id}))},"data-testid":`template-${s.id}`,children:[e.jsx("div",{className:"aspect-video bg-slate-700",children:s.thumbnailUrl?e.jsx("img",{src:s.thumbnailUrl,alt:s.name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(d,{className:"h-6 w-6 text-slate-500"})})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 to-transparent flex items-end p-2",children:e.jsx("span",{className:"text-xs font-medium text-white truncate",children:s.name})}),s.isPremium&&e.jsx("div",{className:"absolute top-1 right-1",children:e.jsx(cs,{className:"h-4 w-4 text-yellow-400"})})]},s.id))})})})]})]}),e.jsx("div",{className:"lg:col-span-2",children:t?e.jsxs(C,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50",children:[e.jsx(R,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-xl text-white","data-testid":"selected-reel-title",children:t.title}),e.jsx(Se,{className:"text-slate-400",children:t.description||"No description"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.status==="published"&&e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>je(!0),className:"gap-2 border-slate-600 text-slate-300 hover:bg-slate-800","data-testid":"btn-share-reel",children:[e.jsx(oe,{className:"h-4 w-4"}),"Share"]}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>ze.mutate(t.id),className:"gap-2 border-red-600/50 text-red-400 hover:bg-red-900/20","data-testid":"btn-delete-reel",children:e.jsx(ke,{className:"h-4 w-4"})})]})]})}),e.jsxs(D,{children:[e.jsxs("div",{className:"aspect-video bg-slate-800 rounded-lg mb-6 flex items-center justify-center relative overflow-hidden",children:[t.outputUrl?e.jsx("video",{src:t.outputUrl,controls:!0,className:"w-full h-full object-contain","data-testid":"reel-video-player"}):t.thumbnailUrl?e.jsx("img",{src:t.thumbnailUrl,alt:"",className:"w-full h-full object-cover"}):e.jsxs("div",{className:"text-center",children:[e.jsx(d,{className:"h-16 w-16 mx-auto text-slate-600 mb-4"}),e.jsx("p",{className:"text-slate-400",children:"Preview will appear here"})]}),(t.status==="rendering"||j)&&e.jsxs("div",{className:"absolute inset-0 bg-black/60 flex flex-col items-center justify-center",children:[e.jsx(p,{className:"h-12 w-12 text-cyan-400 animate-spin mb
1-4"}),e.jsx(as,{value:j?I.progress:t.renderProgress,className:"w-48 h-2"}),e.jsxs("p",{className:"text-white mt-2",children:[j?I.progress:t.renderProgress,"% complete"]}),I.step&&e.jsx("p",{className:"text-cyan-300 text-sm mt-1 capitalize",children:I.step.replace(/_/g," ")})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h3",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-cyan-400"}),"Timeline"]}),e.jsxs(r,{variant:"outline",size:"sm",onClick:()=>{t.sourceId&&ie.mutate({reelId:t.id,sourceType:t.sourceType,sourceId:t.sourceId})},disabled:ie.isPending||!t.sourceId,className:"gap-2 border-slate-600 text-slate-300 hover:bg-slate-800","data-testid":"btn-ai-generate",children:[ie.isPending?e.jsx(p,{className:"h-4 w-4 animate-spin"}):e.jsx(_e,{className:"h-4 w-4"}),"AI Generate"]})]}),qe?e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[1,2,3,4].map(s=>e.jsx(O,{className:"w-24 h-16 flex-shrink-0 bg-slate-800"},s))}):c&&c.length>0?e.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[c.map((s,a)=>e.jsxs("div",{className:"flex-shrink-0 w-24 bg-slate-800 rounded-lg overflow-hidden cursor-move group relative","data-testid":`segment-${s.id}`,children:[e.jsxs("div",{className:"aspect-video relative",children:[s.thumbnailUrl?e.jsx("img",{src:s.thumbnailUrl,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:s.mediaType==="video"?e.jsx(Ce,{className:"h-5 w-5 text-slate-500"}):s.mediaType==="text"?e.jsx(pe,{className:"h-5 w-5 text-slate-500"}):e.jsx(os,{className:"h-5 w-5 text-slate-500"})}),e.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-1",children:e.jsx(ds,{className:"h-4 w-4 text-white"})})]}),e.jsx("div",{className:"p-1.5",children:e.jsxs("p",{className:"text-xs text-slate-400 truncate",children:[(s.durationMs/1e3).toFixed(1),"s"]})})]},s.id)),e.jsx("button",{className:"flex-shrink-0 w-24 aspect-video bg-slate-800 rounded-lg border-2 border-dashed border-slate-600 flex items-center justify-center hover:border-cyan-500 hover:bg-slate-800/80 transition-colors","data-testid":"btn-add-segment",children:e.jsx(F,{className:"h-6 w-6 text-slate-500"})})]}):e.jsxs("div",{className:"text-center py-8 bg-slate-800/40 rounded-lg border border-dashed border-slate-600",children:[e.jsx(d,{className:"h-10 w-10 mx-auto text-slate-600 mb-2"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"No segments yet"}),e.jsx("p",{className:"text-slate-500 text-xs mt-1",children:"Use AI Generate or add clips manually"})]})]}),e.jsxs(ss,{value:$e,onValueChange:Ue,className:"w-full",children:[e.jsxs(ts,{className:"bg-slate-800/60 border border-slate-700",children:[e.jsxs(xe,{value:"settings",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400",children:[e.jsx(Xe,{className:"h-4 w-4 mr-2"}),"Settings"]}),e.jsxs(xe,{value:"music",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400",children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"}),"Music"]}),e.jsxs(xe,{value:"captions",className:"data-[state=active]:bg-cyan-500/20 data-[state=active]:text-cyan-400",children:[e.jsx(pe,{className:"h-4 w-4 mr-2"}),"Captions"]})]}),e.jsx(he,{value:"settings",className:"mt-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Aspect Ratio"}),e.jsxs(V,{value:t.aspectRatio,disabled:!0,children:[e.jsx(G,{className:"bg-slate-800 border-slate-700 text-white",children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"9:16",children:"9:16 (Vertical)"}),e.jsx(o,{value:"16:9",children:"16:9 (Landscape)"}),e.jsx(o,{value:"1:1",children:"1:1 (Square)"}),e.jsx(o,{value:"4:5",children:"4:5 (Portrait)"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Visibility"}),e.jsxs(V,{value:t.visibility,disabled:!0,children:[e.jsx(G,{className:"bg-slate-800 border-slate-700 text-white",children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"public",children:"Public"}),e.jsx(o,{value:"unlisted",children:"Unlisted"}),e.jsx(o,{value:"private",children:"Private"})]})]})]})]})}),e.jsx(he,{value:"music",className:"mt-4",children:e.jsxs("div",{className:"text-center py-8 bg-slate-800/40 rounded-lg",children:[e.jsx(Pe,{className:"h-10 w-10 mx-auto text-slate-600 mb-2"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"Music library coming soon"})]})}),e.jsx(he,{value:"captions",className:"mt-4",children:e.jsxs("div",{className:"text-center py-8 bg-slate-800/40 rounded-lg",children:[e.jsx(pe,{className:"h-10 w-10 mx-auto text-slate-600 mb-2"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"Auto-captions coming soon"})]})})]})]}),e.jsxs(Ze,{className:"flex justify-between border-t border-slate-700 pt-6",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{className:"h-4 w-4"}),t.viewCount," views"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(oe,{className:"h-4 w-4"}),t.shareCount," shares"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t.status==="draft"&&e.jsxs(r,{onClick:()=>te.mutate(t.id),disabled:te.isPending||!(c!=null&&c.length),className:"gap-2 bg-gradient-to-r from-cyan-500 to-blue-600 hover:brightness-110","data-testid":"btn-render-reel",children:[te.isPending?e.jsx(p,{className:"h-4 w-4 animate-spin"}):e.jsx(Te,{className:"h-4 w-4"}),"Render"]}),t.status==="ready"&&e.jsxs(r,{onClick:()=>ae.mutate(t.id),disabled:ae.isPending,className:"gap-2 bg-gradient-to-r from-green-500 to-emerald-600 hover:brightness-110","data-testid":"btn-publish-reel",children:[ae.isPending?e.jsx(p,{className:"h-4 w-4 animate-spin"}):e.jsx(ue,{className:"h-4 w-4"}),"Publish"]})]})]})]}):e.jsx(C,{className:"bg-slate-900/60 backdrop-blur-xl border-slate-700/50 h-full min-h-[500px] flex items-center justify-center",children:e.jsxs("div",{className:"text-center p-8",children:[e.jsx(d,{className:"h-20 w-20 mx-auto text-slate-600 mb-6"}),e.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:"Select or Create a Reel"}),e.jsx("p",{className:"text-slate-400 mb-6 max-w-md",children:"Choose an existing reel from the sidebar or create a new one to get started"}),e.jsxs(r,{onClick:()=>y(!0),className:"gap-2 bg-gradient-to-r from-cyan-500 to-blue-600 hover:brightness-110","data-testid":"btn-create-reel-empty",children:[e.jsx(F,{className:"h-4 w-4"}),"Create New Reel"]})]})})})]})]}),e.jsx(q,{open:Le,onOpenChange:y,children:e.jsxs(z,{className:"bg-slate-900 border-slate-700 max-w-md","data-testid":"create-reel-modal",children:[e.jsxs(K,{children:[e.jsxs(H,{
1className:"text-white flex items-center gap-2",children:[e.jsx(d,{className:"h-5 w-5 text-cyan-400"}),"Create New Reel"]}),e.jsx(Q,{className:"text-slate-400",children:"Set up your highlight reel and start adding content"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Title"}),e.jsx(de,{value:g.title,onChange:s=>b(a=>({...a,title:s.target.value})),placeholder:"My Amazing Trip",className:"bg-slate-800 border-slate-700 text-white","data-testid":"input-reel-title"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Description (optional)"}),e.jsx(es,{value:g.description,onChange:s=>b(a=>({...a,description:s.target.value})),placeholder:"Describe your travel experience...",className:"bg-slate-800 border-slate-700 text-white resize-none",rows:3,"data-testid":"input-reel-description"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Source Type"}),e.jsxs(V,{value:g.sourceType,onValueChange:s=>b(a=>({...a,sourceType:s})),children:[e.jsx(G,{className:"bg-slate-800 border-slate-700 text-white","data-testid":"select-source-type",children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"trip",children:"Trip"}),e.jsx(o,{value:"route",children:"Route"}),e.jsx(o,{value:"chain",children:"Slant Chain"}),e.jsx(o,{value:"custom",children:"Custom"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Aspect Ratio"}),e.jsxs(V,{value:g.aspectRatio,onValueChange:s=>b(a=>({...a,aspectRatio:s})),children:[e.jsx(G,{className:"bg-slate-800 border-slate-700 text-white","data-testid":"select-aspect-ratio",children:e.jsx(Y,{})}),e.jsxs(B,{children:[e.jsx(o,{value:"9:16",children:"9:16 (Reels, Stories)"}),e.jsx(o,{value:"16:9",children:"16:9 (YouTube)"}),e.jsx(o,{value:"1:1",children:"1:1 (Instagram)"}),e.jsx(o,{value:"4:5",children:"4:5 (Instagram Post)"})]})]})]})]}),e.jsxs(me,{children:[e.jsx(r,{variant:"ghost",onClick:()=>y(!1),className:"text-slate-400 hover:text-white","data-testid":"btn-cancel-create",children:"Cancel"}),e.jsxs(r,{onClick:()=>se.mutate(g),disabled:!g.title||se.isPending,className:"gap-2 bg-gradient-to-r from-cyan-500 to-blue-600 hover:brightness-110","data-testid":"btn-confirm-create",children:[se.isPending?e.jsx(p,{className:"h-4 w-4 animate-spin"}):e.jsx(F,{className:"h-4 w-4"}),"Create"]})]})]})}),e.jsx(q,{open:Re,onOpenChange:je,children:e.jsxs(z,{className:"bg-slate-900 border-slate-700 max-w-sm","data-testid":"share-reel-modal",children:[e.jsxs(K,{children:[e.jsxs(H,{
1className:"text-white flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5 text-cyan-400"}),"Share Reel"]}),e.jsxs(Q,{className:"text-slate-400",children:['Share "',t==null?void 0:t.title,'" with your audience']})]}),e.jsxs("div",{className:"py-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-slate-800 rounded-lg mb-4",children:[e.jsx(de,{readOnly:!0,value:t!=null&&t.shareSlug?`${window.location.origin}/reel/${t.shareSlug}`:"",className:"bg-transparent border-none text-slate-300 text-sm","data-testid":"share-link-input"}),e.jsx(r,{variant:"ghost",size:"sm",onClick:Ge,className:"shrink-0","data-testid":"btn-copy-link",children:Ee?e.jsx(ne,{className:"h-4 w-4 text-green-400"}):e.jsx(Ie,{className:"h-4 w-4 text-slate-400"})})]}),e.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[e.jsxs(r,{variant:"outline",className:"flex flex-col gap-2 h-auto py-3 border-slate-700 hover:bg-slate-800",onClick:()=>U("twitter"),"data-testid":"btn-share-twitter",children:[e.jsx("svg",{className:"h-5 w-5",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),e.jsx("span",{className:"text-xs",children:"X"})]}),e.jsxs(r,{variant:"outline",className:"flex flex-col gap-2 h-auto py-3 border-slate-700 hover:bg-slate-800",onClick:()=>U("facebook"),"data-testid":"btn-share-facebook",children:[e.jsx(is,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{className:"text-xs",children:"Facebook"})]}),e.jsxs(r,{variant:"outline",className:"flex flex-col gap-2 h-auto py-3 border-slate-700 hover:bg-slate-800",onClick:()=>U("linkedin"),"data-testid":"btn-share-linkedin",children:[e.jsx(ls,{className:"h-5 w-5 text-blue-600"}),e.jsx("span",{className:"text-xs",children:"LinkedIn"})]}),e.jsxs(r,{variant:"outline",className:"flex flex-col gap-2 h-auto py-3 border-slate-700 hover:bg-slate-800",onClick:()=>U("whatsapp"),"data-testid":"btn-share-whatsapp",children:[e.jsx(rs,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{className:"text-xs",children:"WhatsApp"})]})]})]})]})}),e.jsx(q,{open:Ae,onOpenChange:P,children:e.jsxs(z,{className:"bg-slate-900 border-slate-700 max-w-lg","data-testid":"projects-modal",children:[e.jsxs(K,{children:[e.jsxs(H,{
1className:"text-white flex items-center gap-2",children:[e.jsx(d,{className:"h-5 w-5 text-cyan-400"}),"My Projects"]}),e.jsx(Q,{className:"text-slate-400",children:"Load a saved project or start a new one"})]}),e.jsx("div",{className:"py-4",children:Ke?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(s=>e.jsx(O,{className:"h-16 w-full bg-slate-800"},s))}):!re||re.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(d,{className:"h-12 w-12 mx-auto text-slate-600 mb-3"}),e.jsx("p",{className:"text-slate-400 text-sm",children:"No saved projects yet. Start creating!"})]}):e.jsx(ce,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-2",children:re.map(s=>e.jsx("div",{className:"p-4 rounded-lg bg-slate-800/60 border border-slate-700 hover:border-cyan-500/50 transition-all","data-testid":`project-item-${s.id}`,children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-white truncate",children:s.name}),e.jsxs("p",{className:"text-xs text-slate-400 mt-1",children:["Last saved: ",new Date(s.updatedAt).toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsxs(E,{variant:"outline",className:"text-xs border-slate-600 text-slate-400",children:["v",s.version]}),e.jsx(E,{variant:"outline",className:`text-xs ${s.status==="draft"?"border-slate-500 text-slate-400":s.status==="published"?"border-green-500 text-green-400":"border-yellow-500 text-yellow-400"}`,children:s.status})]})]}),e.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>le.mutate(s.id),disabled:le.isPending,className:"h-8 w-8 p-0 text-cyan-400 hover:text-cyan-300 hover:bg-cyan-500/10","data-testid":`btn-load-project-${s.id}`,children:le.isPending?e.jsx(p,{className:"h-4 w-4 animate-spin"}):e.jsx(Te,{className:"h-4 w-4"})}),e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>we.mutate({projectId:s.id}),disabled:we.isPending,className:"h-8 w-8 p-0 text-slate-400 hover:text-white hover:bg-slate-700","data-testid":`btn-duplicate-project-${s.id}`,children:e.jsx(Ie,{className:"h-4 w-4"})}),e.jsx(r,{variant:"ghost",size:"sm",onClick:()=>{confirm("Are you sure you want to delete this project?")&&fe.mutate(s.id)},disabled:fe.isPending,className:"h-8 w-8 p-0 text-red-400 hover:text-red-300 hover:bg-red-500/10","data-testid":`btn-delete-project-${s.id}`,children:e.jsx(ke,{className:"h-4 w-4"})})]})]})},s.id))})})}),e.jsx(me,{children:e.jsx(r,{variant:"ghost",onClick:()=>P(!1),className:"text-slate-400 hover:text-white",children:"Close"})})]})}),e.jsx(q,{open:De,onOpenChange:T,children:e.jsxs(z,{className:"bg-slate-900 border-slate-700 max-w-md","data-testid":"save-project-modal",children:[e.jsxs(K,{children:[e.jsxs(H,{
1className:"text-white flex items-center gap-2",children:[e.jsx(d,{className:"h-5 w-5 text-cyan-400"}),"Save Project"]}),e.jsx(Q,{className:"text-slate-400",children:"Give your project a name to save it"})]}),e.jsx("div",{className:"py-4",children:e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-slate-300 mb-2 block",children:"Project Name"}),e.jsx(de,{value:M,onChange:s=>_(s.target.value),placeholder:"My Travel Reel Project",className:"bg-slate-800 border-slate-700 text-white","data-testid":"input-project-name"})]})}),e.jsxs(me,{children:[e.jsx(r,{variant:"ghost",onClick:()=>{T(!1),_("")},className:"text-slate-400 hover:text-white",children:"Cancel"}),e.jsxs(r,{onClick:()=>{M.trim()&&(Ve(M.trim()),_(""))},disabled:!M.trim()||N.isPending,className:"gap-2 bg-gradient-to-r from-cyan-500 to-blue-600 hover:brightness-110","data-testid":"btn-confirm-save-project",children:[N.isPending?e.jsx(p,{className:"h-4 w-4 animate-spin"}):e.jsx(ne,{className:"h-4 w-4"}),"Save Project"]})]})]})})]})}export{Ms 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.