PageSourceSearch

https://sabhia.ai/assets/personagem-C_H8Cwno.js

js sabhia.ai collected 2026-10-05 12:33:21 UTC 41,953 bytes, 13 lines download raw bytes

1import{j as e}from"./vendor-motion-CPxq9Xvn.js";import{r as i}from"./vendor-i18n-CO3kK2bH.js";import{a3 as ct,ai as dt,u as lt,a6 as m,a as he,S as k,e as mt,a7 as r,as as ut,ap as v,aB as be,X as u,ao as B,W as $e,a$ as xt,an as l}from"./index-CFAvyuXu.js";import{b as Le}from"./videoVoices-BUWm2xwS.js";import{V as De}from"./videos-shell-Dt9iLSCb.js";import{v as U}from"./theme-BrBbZnq5.js";import{U as _}from"./user-round-DdY3fnGY.js";import{A as Ve}from"./arrow-left-DY50GvQQ.js";import{A as pt}from"./archive-iKuFsGl2.js";import{P as ht}from"./pencil-DB7EhnQs.js";import{U as ge}from"./upload-BKNIN1AN.js";import{I as bt}from"./image-plus-DndZpaGr.js";import{M as He}from"./mic-vocal-DbvOzLSZ.js";import{F as gt}from"./film-5Ww7nMCK.js";import{V as Be}from"./volume-2-DLFW1Tgd.js";import"./vendor-react-CQmBMThG.js";import"./layout-dashboard-pnVssBCT.js";const vt=10*6e4;function fe(a,T,O){if(a!==T)return!1;const A=Date.parse(String(O||""))||0;return Date.now()-A<vt}const _e=a=>fe(a?.status,"generating",a?.startedAt),Ke=a=>fe(a?.status,"processing",a?.startedAt),Qe=a=>a?.status==="running"&&Date.now()-(Date.parse(String(a?.startedAt||""))||0)<15*6e4,We=a=>fe(a?.createStatus??void 0,"processing",a?.createStartedAt??void 0),ft="image/jpeg,image/png,image/webp",yt="audio/*",jt="video/mp4,video/webm,video/quicktime",ve=500,Nt=ve*1024*1024,Ue=a=>a.voiceStatus==="cloning"||Ke(a.metadata?.videoIntake)||_e(a.metadata?.testClip)||We(a.metadata?.heygen)||Qe(a.metadata?.heygen?.testRender);function Vt(){const{toast:a}=ct(),T=dt(),O=i.useRef(null),A=i.useRef(null),ye=i.useRef(null),K=i.useRef(null),[Xe,Q]=i.useState(null),[f,y]=i.useState(null),[je,R]=i.useState(!1),[Ne,z]=i.useState(null),[we,W]=i.useState(null),X=i.useRef(null),ke=i.useRef({}),[ze,P]=i.useState(null),[Je,I]=i.useState(!1),[Pe,Se]=i.useState(""),[J,Ce]=i.useState("");i.useEffect(()=>()=>K.current?.pause(),[]),i.useEffect(()=>{const t=new Audio;t.preload="none";const s=()=>z(null);return t.addEventListener("ended",s),X.current=t,()=>{t.removeEventListener("ended",s),t.pause(),X.current=null}},[]);const S=lt({queryKey:["/api/videos/personas"],refetchInterval:t=>(t.state.data?.personas??[]).some(Ue)?4e3:!1}),Ye=S.data?.avatarEnabled??!1,x=S.data?.personas??[],F=S.data?.maxClones??8,n=x.find(t=>t.id===ze)??x.find(t=>t.isActive)??x[0]??null,Ze=n?.id??"none";i.useEffect(()=>{Q(null),I(!1)},[Ze]);const j=n?.voiceStatus??"none",Y=!!n?.photoObjectPath,C=j==="ready",G=Y&&C,N=n?.metadata?.videoIntake,Z=Ke(N),g=n?.metadata?.testClip,Ee=_e(g),c=()=>{T.invalidateQueries({queryKey:["/api/videos/personas"]}
1),T.invalidateQueries({queryKey:["/api/videos/persona"]})},ee=(t={})=>n?{...t,personaId:n.id}:t;async function et(){if(n)return n.id;try{const d=(await(await l("POST","/api/videos/personas",{})).json())?.persona?.id??null;return d&&(P(d),c()),d}catch{return null}}async function te(t,s,d){const h=await et(),E=t==="photo"?"image/jpeg":t==="audio"?"audio/mpeg":"video/mp4",b=await l("POST","/api/videos/persona/upload-url",{kind:t,contentType:s.type||E}),{uploadURL:rt,objectPath:qe}=await b.json();if(!(await fetch(rt,{method:"PUT",body:s,headers:{"Content-Type":s.type||"application/octet-stream"}})).ok)throw new Error("Falha ao enviar o arquivo");return(await l("POST",d,h?{objectPath:qe,personaId:h}:ee({objectPath:qe}))).json()}const ae=m({mutationFn:async()=>(await l("POST","/api/videos/personas",{})).json(),onSuccess:t=>{c(),t?.persona?.id&&P(t.persona.id),a({title:"Novo clone criado!",description:"Agora envie a foto e a voz dele logo abaixo."})},onError:t=>a({title:"Não foi possível criar o clone",description:t?.message,variant:"destructive"})}),Te=m({mutationFn:async t=>(await l("POST",`/api/videos/personas/${t}/activate`,{})).json(),onSuccess:()=>{c(),a({title:"Clone ativado!",description:"Ele agora é o padrão dos seus novos Reels."})},onError:t=>a({title:"Não foi possível ativar",description:t?.message,variant:"destructive"})}),Oe=m({mutationFn:async t=>(await l("POST",`/api/videos/personas/${t}/archive`,{})).json(),onSuccess:(t,s)=>{ze===s&&P(null),c(),a({title:"Clone arquivado",description:"Ele fica salvo para sempre — só sai da sua lista."})},onError:t=>a({title:"Não foi possível arquivar",description:t?.message,variant:"destructive"})}),se=m({mutationFn:async({id:t,name:s})=>(await l("PATCH",`/api/videos/personas/${t}`,{name:s})).json(),onSuccess:()=>{I(!1),c()},onError:t=>a({title:"Não foi possível renomear",description:t?.message,variant:"destructive"})}),tt=m({mutationFn:async t=>(y("photo"),Q(URL.createObjectURL(t)),te("photo",t,"/api/videos/persona/photo")),onSuccess:()=>{c(),a({title:"Foto enviada!",description:"O rosto do seu clone foi salvo."})},onError:t=>{Q(null),a({title:"Não foi possível enviar a foto",description:t?.message,variant:"destructive"})},onSettled:()=>y(null)}),at=m({mutationFn:async t=>(y("voice"),te("audio",t,"/api/videos/persona/voice")),onSuccess:()=>{c(),a({title:"Amostra recebida!",description:"Estamos clonando a voz — leva cerca de 1 minuto."})},onError:t=>{a({title:"Não foi possível enviar a amostra",description:t?.message,variant:"destructive"})},onSettled:()=>y(null)}),st=m({mutationFn:async t=>{if(t.size>Nt)throw new Error(`O vídeo pode ter no máximo ${ve}MB. Grave um trecho mais curto (30–60s bastam).`);return y("video"),te("video",t,"/api/videos/persona/video")},onSuccess:()=>{c(),a({title:"Vídeo recebido! 🎬",description:"Estamos extraindo a foto e a voz do vídeo — leva 1 a 2 minutos."})},onError:t=>{a({title:"Não foi possível enviar o vídeo",description:t?.message,variant:"destructive"})},onSettled:()=>y(null)}),ne=m({mutationFn:async()=>(await l("POST","/api/videos/persona/test-voice",ee())).json(),onSuccess:t=>{K.current?.pause();const s=new Audio(t.audio);K.current=s,R(!0),s.onended=()=>R(!1),s.onerror=()=>R(!1),s.play().catch(()=>R(!1))},onError:t=>{c(),a({title:"Não foi possível tocar a voz",description:t?.message,variant:"destructive"})}}),oe=m({mutationFn:async()=>(await l("POST","/api/videos/persona/test-clip",ee())).json(),onSuccess:()=>{c(),a({title:"Gerando o clipe de teste 🎬",description:"Leva de 1 a 4 minutos. O vídeo aparece aqui embaixo quando ficar pronto."})},onError:t=>{a({title:"Não foi possível iniciar o clipe",description:t?.message,variant:"destructive"})}}),ie=S.data?.heygenEnabled??!1,o=n?.metadata?.heygen,p=o?.testRender,M=Qe(p),q=!!o?.avatarLookId,$=["approved","accepted","not_required","manual"].includes(o?.consentStatus||""),Ae=["ready","completed","success","trained"].includes(o?.trainingStatus||""),L=q&&$,w=We(o),nt=!o?.avatarGroupId&&o?.createStatus==="failed",re=m({mutationFn:async()=>{if(!n)throw new Error("Selecione um clone primeiro.");return(await l("POST",`/api/videos/personas/${n.id}/heygen/create`,{})).json()},onSuccess:()=>{c(),a({title:"Preparando o seu Digital Twin 🧬",description:"A Sábhia está preparando e enviando o seu vídeo pra HeyGen. Leva alguns minutos — o status atualiza aqui sozinho."})},onError:t=>
1a({title:"Não foi possível criar o Digital Twin",description:t?.message,variant:"destructive"})}),ce=m({mutationFn:async()=>{if(!n)throw new Error("Selecione um clone primeiro.");return(await l("POST",`/api/videos/personas/${n.id}/heygen/consent`,{})).json()},onSuccess:t=>{c(),window.open(t.consentUrl,"_blank","noopener")||a({title:"Abra o link de consentimento",description:t.consentUrl})},onError:t=>a({title:"Não foi possível iniciar o consentimento",description:t?.message,variant:"destructive"})}),D=m({mutationFn:async()=>{if(!n)throw new Error("Selecione um clone primeiro.");return(await l("GET",`/api/videos/personas/${n.id}/heygen?refresh=1`)).json()},onSuccess:()=>c(),onError:t=>a({title:"Não foi possível atualizar o status",description:t?.message,variant:"destructive"})}),Re=i.useRef(new Set),Ie=D.mutate;i.useEffect(()=>{!ie||!n?.id||!o?.avatarGroupId||L||Re.current.has(n.id)||(Re.current.add(n.id),Ie())},[ie,n?.id,o?.avatarGroupId,L,Ie]);const de=m({mutationFn:async()=>{if(!n)throw new Error("Selecione um clone primeiro.");return(await l("POST",`/api/videos/personas/${n.id}/heygen/manual-look`,{lookId:J.trim()})).json()},onSuccess:()=>{Ce(""),c(),a({title:"Look vinculado ✅",description:"O Digital Twin vai usar esse look nos próximos Reels."})},onError:t=>a({title:"Look inválido",description:t?.message,variant:"destructive"})}),le=m({mutationFn:async()=>{if(!n)throw new Error("Selecione um clone primeiro.");return(await l("POST",`/api/videos/personas/${n.id}/heygen/unlink`,{})).json()},onSuccess:()=>{c(),a({title:"Digital Twin desvinculado",description:"Agora é só clicar em “Criar meu Digital Twin” pra treinar de novo com o vídeo corrigido. Lembre de apagar o avatar antigo no painel da HeyGen pra liberar o slot."})},onError:t=>a({title:"Não foi possível desvincular",description:t?.message,variant:"destructive"})}),me=o?.previousTwins??[],Fe=new Set(me.filter(t=>t?.avatarGroupId&&t.deletedOnHeygen).map(t=>t.avatarGroupId)),V=[...me].reverse().find(t=>t?.avatarGroupId&&!Fe.has(t.avatarGroupId))?.avatarGroupId??null,ue=q&&o?.trainingStatus==="manual"&&me.some(t=>t?.avatarLookId&&t.avatarLookId===o?.avatarLookId&&!(t.avatarGroupId&&Fe.has(t.avatarGroupId))&&!t.deletedOnHeygen),xe=m({mutationFn:async()=>{if(!n)throw new Error("Selecione um clone primeiro.");if(!V)throw new Error("Nenhum twin antigo pra liberar.");return(await l("POST",`/api/videos/personas/${n.id}/heygen/release-slot`,{groupId:V,confirm:!0})).json()},onSuccess:()=>{c(),a({title:"Vaga liberada na HeyGen ✅",description:"O twin antigo foi apagado. Agora clique em “Criar meu Digital Twin” pra treinar de novo com o vídeo corrigido."})},onError:t=>a({title:"Não foi possível liberar a vaga",description:t?.message,variant:"destructive"})}),pe=m({mutationFn:async()=>{if(!n)throw new Error("Selecione um clone primeiro.");return(await l("POST",`/api/videos/personas/${n.id}/heygen/test-render`,{})).json()},onSuccess:()=>{c(),a({title:"Gerando o teste do twin 🎬",description:"Leva alguns minutos. O vídeo aparece aqui quando ficar pronto."})},onError:t=>a({title:"Não foi possível iniciar o teste",description:t?.message,variant:"destructive"})});async function ot(t){const s=X.current;if(!s||we===t)return;if(Ne===t){s.pause(),z(null);return}s.pause(),z(null);let d=ke.current[t];if(!d){W(t);try{if(d=(await(await l("POST","/api/videos/voice-preview",{voiceId:t})).json())?.url,!d)throw new Error("Resposta sem áudio");ke.current[t]=d}catch(h){W(null),a({title:"Não foi possível ouvir a voz",description:h?.message,variant:"destructive"});return}W(null)}try{s.src=d,s.currentTime=0,await s.play(),z(t)}catch{z(null),a({title:"Não foi possível reproduzir",description:"Toque novamente.",variant:"destructive"})}}if(S.isSuccess&&!Ye)return e.jsx(De,{children:e.jsxs("div",{className:"mx-auto max-w-2xl px-4 py-16 text-center",children:[e.jsx("div",{className:"mx-auto mb-5 flex h-14 w-14 items-center justify-center rounded-2xl bg-white/[0.04]",children:e.jsx(_,{className:"h-7 w-7 text-zinc-500"})}),e.jsx("h1",{className:"text-xl font-semibold text-zinc-200",children:"Meus Clones"}),e.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:"O recurso de avatar clonado ainda não está ativo por aqui."}),e.jsx(he,{href:"/videos",children:e.jsxs("button",{className:"mt-6 inline-flex items-center gap-2 text-sm text-cyan-300 hover:text-cyan-200","data-testid":"link-back-videos",children:[e.jsx(Ve,{className:"h-4 w-4"})," Voltar para os vídeos"]})})]})});const Ge=Xe||(n?.photoObjectPath??null),H=(t,s)=>(t.name||"").trim()||`Clone ${s+1}`,it=n?x.findIndex(t=>t.id===n.id):-1,Me=n?H(n,Math.max(0,it)):"Seu primeiro clone";return e.jsx(De,{children:e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-8",children:[e.jsx(he,{href:"/videos/reels",children:e.jsxs("button",{className:"mb-6 inline-flex items-center gap-2 text-sm text-zinc-400 hover:text-zinc-200","data-testid":"link-back-videos",children:[e.jsx(Ve,{className:"h-4 w-4"})," Central de Reels"]})}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-500/20 to-cyan-400/10 ring-1 ring-cyan-400/20",children:e.jsx(_,{className:"h-5 w-5 text-cyan-300"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-2xl font-bold text-white","data-testid":"text-persona-title",children:"Meus Clones"}),e.jsx("span",{className:"rounded-full border border-cyan-500/30 bg-cyan-500/[0.08] px-2 py-0.5 text-[10px] font-semibold text-cyan-200",children:"Reels · Banco de clones"})]}),e.jsx("p",{className:"mt-1 text-sm text-zinc-400 max-w-xl",children:"Crie um clone uma única vez (vídeo ou foto + áudio) e ele fica salvo para sempre. Você pode ter vários — na hora de criar um Reel, escolhe qual ap
1arece."})]})]}),e.jsxs("section",{className:"mt-5 rounded-2xl border border-white/10 bg-white/[0.02] p-4","data-testid":"section-clone-bank",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(k,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-sm font-semibold text-zinc-200",children:"Seus clones"}),e.jsxs("span",{className:"ml-auto text-[10px] text-zinc-500",children:[x.length,"/",F]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4",children:[x.map((t,s)=>{const d=n?.id===t.id,h=Ue(t),E=!!t.photoObjectPath&&t.voiceStatus==="ready";return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>P(t.id),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&P(t.id)},className:`group relative cursor-pointer overflow-hidden rounded-2xl border text-left transition-all ${d?"border-cyan-400/60 ring-2 ring-cyan-400/30 bg-cyan-500/[0.06]":"border-white/10 bg-black/20 hover:border-cyan-500/30"}`,"data-testid":`card-clone-${t.id}`,children:[e.jsxs("div",{className:"relative aspect-square overflow-hidden bg-black/30",children:[t.photoObjectPath?e.jsx("img",{src:t.photoObjectPath,alt:H(t,s),className:"h-full w-full object-cover","data-testid":`img-clone-${t.id}`}):e.jsx("div",{className:"flex h-full w-full items-center justify-center text-zinc-600",children:e.jsx(_,{className:"h-8 w-8"})}),t.isActive&&e.jsxs("span",{className:"absolute left-1.5 top-1.5 inline-flex items-center gap-1 rounded-full border border-cyan-400/40 bg-black/60 px-1.5 py-0.5 text-[9px] font-bold text-cyan-200 backdrop-blur-sm","data-testid":`badge-clone-active-${t.id}`,children:[e.jsx(mt,{className:"h-2.5 w-2.5 fill-cyan-300 text-cyan-300"})," ATIVO"]}),h&&e.jsx("span",{className:"absolute right-1.5 top-1.5 rounded-full bg-black/60 p-1 backdrop-blur-sm",children:e.jsx(r,{className:"h-3 w-3 animate-spin text-cyan-300"})})]}),e.jsxs("div",{className:"p-2",children:[e.jsx("div",{className:"truncate text-xs font-semibold text-zinc-200","data-testid":`text-clone-name-${t.id}`,children:H(t,s)}),e.jsx("div",{className:`mt-0.5 text-[10px] ${E?"text-emerald-300":"text-zinc-500"}`,children:E?"Pronto para Reels":h?"Processando…":"Incompleto"}),e.jsxs("div",{className:"mt-1.5 flex gap-1",children:[!t.isActive&&e.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),Te.mutate(t.id)},disabled:Te.isPending,className:"flex-1 rounded-lg border border-cyan-500/25 bg-cyan-500/[0.06] px-1.5 py-1 text-[10px] font-semibold text-cyan-200 hover:bg-cyan-500/[0.12] disabled:opacity-50","data-testid":`button-activate-clone-${t.id}`,children:"Ativar"}),e.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),window.confirm(`Arquivar "${H(t,s)}"? Ele fica salvo para sempre — só sai da lista e deixa de ser usado nos Reels.`)&&Oe.mutate(t.id)},disabled:Oe.isPending,className:"rounded-lg border border-white/10 bg-black/20 px-1.5 py-1 text-[10px] text-zinc-400 hover:border-amber-500/30 hover:text-amber-300 disabled:opacity-50","data-testid":`button-archive-clone-${t.id}`,title:"Arquivar (fica salvo para sempre)",children:e.jsx(pt,{className:"h-3 w-3"})})]})]})]},t.id)}),e.jsxs("button",{type:"button",onClick:()=>ae.mutate(),disabled:ae.isPending||x.length>=F,className:"flex aspect-auto min-h-[140px] flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-cyan-500/30 bg-cyan-500/[0.03] text-cyan-300 transition-all hover:border-cyan-400/50 hover:bg-cyan-500/[0.07] disabled:opacity-50","data-testid":"button-new-clone",children:[ae.isPending?e.jsx(r,{className:"h-6 w-6 animate-spin"}):e.jsx(ut,{className:"h-6 w-6"}),e.jsx("span",{className:"text-xs font-semibold",children:"Novo clone"}),x.length>=F&&e.jsxs("span",{className:"px-2 text-center text-[9px] text-zinc-500",children:["Limite de ",F," — arquive um antigo"]})]})]})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-zinc-100","data-testid":"text-editing-clone",children:"Editando:"}),n&&Je?e.jsxs("form",{className:"flex items-center gap-1.5",onSubmit:t=>{t.preventDefault();const s=Pe.trim().slice(0,60);s&&n?se.mutate({id:n.id,name:s}):I(!1)},children:[e.jsx("input",{autoFocus:!0,value:Pe,onChange:t=>Se(t.target.value.slice(0,60)),className:"rounded-lg border border-cyan-400/40 bg-black/40 px-2 py-1 text-sm text-zinc-100 focus:outline-none","data-testid":"input-clone-name"}),e.jsx("button",{type:"submit",disabled:se.isPending,className:"rounded-lg border border-cyan-500/30 bg-cyan-500/[0.08] px-2 py-1 text-xs font-semibold text-cyan-200 disabled:opacity-50","data-testid":"button-save-clone-name",children:se.isPending?e.jsx(r,{className:"h-3 w-3 animate-spin"}):"Salvar"})]}):e.jsxs("button",{type:"button",onClick:()=>{n&&(Se(Me),I(!0))},className:"inline-flex items-center gap-1.5 text-sm font-semibold text-cyan-200 hover:text-cyan-100","data-testid":"button-edit-clone-name",children:[Me,n&&e.jsx(ht,{className:"h-3 w-3 text-zinc-500"})]}),n?.isActive&&e.jsx("span",{className:"rounded-full border border-cyan-500/30 bg-cyan-500/[0.08] px-2 py-0.5 text-[9px] font-bold text-cyan-200",children:"ATIVO"})]}),e.jsx("div",{className:"mt-3 rounded-2xl border border-white/10 bg-white/[0.02] p-4","data-testid":"status-persona",children:G?e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-emerald-300",children:[e.jsx(v,{className:"h-4 w-4"})," Este clone está pronto para os Reels."]}):Z?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-cyan-200",children:[e.jsx(r,{className:"h-4 w-4 animate-spin text-cyan-300"}),"Processando o vídeo: extraindo foto e voz… (1–2 minutos)"]}):e.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[e.jsx(k,{className:"h-4 w-4 text-cyan-300"}),"Complete a foto e a voz para liberar este clone."]})}),e.jsxs("section",{className:"mt-6 rounded-2xl border border-cyan-500/25 bg-cyan-500/[0.04] p-5","data-testid":"section-persona-video",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(be,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-sm font-semibold text-zinc-100",children:"Enviar um vídeo (recomendado)"}),e.jsx("span",{className:"rounded-full border border-cyan-500/30 bg-cyan-500/[0.10] px-2 py-0.5 text-[10px] font-semibold text-cyan-200",children:"Foto + voz de uma vez"})]}),e.jsx("p",{className:"text-xs text-zinc-400",children:"Grave 30–60 segundos falando de frente para a câmera, com boa luz e sem ruído. A Sábhia extrai a foto e clona a voz automaticamente do mesmo vídeo."}),N?.status==="failed"&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-xl border border-amber-500/20 bg-amber-500/[0.05] px-3 py-2 text-xs text-amber-300","data-testid":"status-video-intake-failed",children:[e.jsx(u,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:N.error||"Não conseguimos processar o vídeo. Tente outro arquivo."})]}),N?.status==="done"&&N.voiceCloneError&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-xl border border-amber-500/20 bg-amber-500/[0.05] px-3 py-2 text-xs text-amber-300","data-testid":"status-video-voice-failed",children:[e.jsx(u,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:["A foto foi extraída, mas a clonagem da voz falhou: ",N.voiceCloneError,". Env
1ie uma amostra de áudio abaixo."]})]}),e.jsx("input",{ref:ye,type:"file",accept:jt,className:"hidden","data-testid":"input-persona-video",onChange:t=>{const s=t.target.files?.[0];s&&st.mutate(s),t.target.value=""}}),e.jsx("button",{type:"button",disabled:f==="video"||Z,onClick:()=>ye.current?.click(),className:`mt-3 w-full inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold disabled:opacity-60 ${U.primaryBtn}`,"data-testid":"button-upload-video",children:f==="video"?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"})," Enviando o vídeo…"]}):Z?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"})," Processando… (1–2 min)"]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"h-4 w-4"})," Enviar vídeo"]})}),e.jsxs("p",{className:"mt-2 text-[11px] text-zinc-500",children:["MP4, WebM ou MOV · até ",ve,"MB."]})]}),e.jsxs("div",{className:"mt-6 grid gap-5 md:grid-cols-2",children:[e.jsxs("section",{className:"rounded-2xl border border-white/10 bg-white/[0.02] p-5","data-testid":"section-persona-photo",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(bt,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-sm font-semibold text-zinc-200",children:"Foto"}),Y&&e.jsx(v,{className:"ml-auto h-4 w-4 text-emerald-400"})]}),e.jsx("div",{className:"mb-4 flex items-center justify-center rounded-xl border border-dashed border-white/10 bg-black/20 aspect-square overflow-hidden",children:Ge?e.jsx("img",{src:Ge,alt:"Foto do clone",className:"h-full w-full object-cover","data-testid":"img-persona-photo"}):e.jsxs("div",{className:"text-center text-zinc-600",children:[e.jsx(_,{className:"mx-auto h-10 w-10"}),e.jsx("p",{className:"mt-2 text-xs",children:"Nenhuma foto ainda"})]})}),e.jsx("input",{ref:O,type:"file",accept:ft,className:"hidden","data-testid":"input-persona-photo",onChange:t=>{const s=t.target.files?.[0];s&&tt.mutate(s),t.target.value=""}}),e.jsx("button",{type:"button",disabled:f==="photo",onClick:()=>O.current?.click(),className:`w-full inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold disabled:opacity-60 ${U.primaryBtn}`,"data-testid":"button-upload-photo",children:f==="photo"?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"})," Enviando…"]}):Y?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"h-4 w-4"})," Trocar foto"]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"h-4 w-4"})," Enviar foto"]})}),e.jsx("p",{className:"mt-2 text-[11px] text-zinc-500",children:"Rosto de frente, boa luz. JPG, PNG ou WebP."})]}),e.jsxs("section",{className:"rounded-2xl border border-white/10 bg-white/[0.02] p-5","data-testid":"section-persona-voice",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(He,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-sm font-semibold text-zinc-200",children:"Voz"}),C&&e.jsx(v,{className:"ml-auto h-4 w-4 text-emerald-400"})]}),e.jsx("div",{className:"mb-4 flex min-h-[3.5rem] items-center gap-3 rounded-xl border border-white/10 bg-black/20 px-4 py-3","data-testid":"status-persona-voice",children:j==="cloning"?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 shrink-0 animate-spin text-cyan-300"}),e.jsx("span",{className:"text-sm text-cyan-200",children:"Clonando a voz… (cerca de 1 minuto)"})]}):j==="ready"?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"h-4 w-4 shrink-0 text-emerald-400"}),e.jsx("span",{className:"text-sm text-emerald-300",children:"Voz clonada e pronta."})]}):j==="failed"?e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"h-4 w-4 shrink-0 text-amber-400"}),e.jsx("span",{className:"text-sm text-amber-300",children:"O último clone falhou. Reenvie uma amostra mais limpa."})]}):j==="expired"?e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"h-4 w-4 shrink-0 text-amber-400"}),e.jsx("span",{className:"text-sm text-amber-300",children:"A voz expirou no provedor. Envie uma nova amostra para clonar de novo."})]}):e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"h-4 w-4 shrink-0 text-zinc-500"}),e.jsx("span",{className:"text-sm text-zinc-500",children:"Nenhuma amostra ainda"})]})}),e.jsx("input",{ref:A,type:"file",accept:yt,className:"hidden","data-testid":"input-persona-voice",onChange:t=>{const s=t.target.files?.[0];s&&at.mutate(s),t.target.value=""}}),e.jsx("button",{type:"button",disabled:f==="voice"||j==="cloning",onClick:()=>A.current?.click(),className:`w-full inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold disabled:opacity-60 ${U.primaryBtn}`,"data-testid":"button-upload-voice",children:f==="voice"?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"}
1)," Enviando…"]}):C?e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"h-4 w-4"})," Regravar voz"]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"h-4 w-4"})," Enviar amostra de voz"]})}),e.jsx("p",{className:"mt-2 text-[11px] text-zinc-500",children:"15–60s falando com clareza, sem ruído de fundo. MP3, WAV ou M4A."})]})]}),(C||g)&&e.jsxs("section",{className:"mt-6 rounded-2xl border border-white/10 bg-white/[0.02] p-5","data-testid":"section-persona-test",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(gt,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-sm font-semibold text-zinc-200",children:"Teste este clone"})]}),e.jsx("p",{className:"text-xs text-zinc-400",children:"Antes de usar num Reel, ouça como ficou a voz e, se quiser, gere um clipe curto do avatar falando."}),e.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[e.jsx("button",{type:"button",disabled:!C||ne.isPending||je,onClick:()=>ne.mutate(),className:"inline-flex items-center justify-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/[0.08] px-4 py-2.5 text-sm font-semibold text-cyan-200 hover:bg-cyan-500/[0.14] disabled:opacity-60","data-testid":"button-test-voice",children:ne.isPending?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"})," Gerando o áudio…"]}):je?e.jsxs(e.Fragment,{children:[e.jsx(Be,{className:"h-4 w-4"})," Tocando…"]}):e.jsxs(e.Fragment,{children:[e.jsx($e,{className:"h-4 w-4"})," Ouvir a voz"]})}),e.jsx("button",{type:"button",disabled:!G||Ee||oe.isPending,onClick:()=>oe.mutate(),className:"inline-flex items-center justify-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/[0.08] px-4 py-2.5 text-sm font-semibold text-cyan-200 hover:bg-cyan-500/[0.14] disabled:opacity-60","data-testid":"button-test-clip",children:Ee||oe.isPending?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"})," Gerando o clipe… (1–4 min)"]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-4 w-4"})," Gerar clipe de teste"]})})]}),e.jsx("p",{className:"mt-2 text-[11px] text-zinc-500",children:"Ouvir a voz custa centavos. O clipe de teste custa cerca de US$ 1 por geração — o resultado fica salvo aqui."}),g?.status==="failed"&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-xl border border-amber-500/20 bg-amber-500/[0.05] px-3 py-2 text-xs text-amber-300","data-testid":"status-test-clip-failed",children:[e.jsx(u,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:["O clipe de teste falhou: ",g.error||"tente novamente","."]})]}),g?.status==="ready"&&g.objectPath&&e.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-white/10 bg-black/30",children:e.jsx("video",{src:g.objectPath,controls:!0,playsInline:!0,className:"mx-auto max-h-[420px] w-auto","data-testid":"video-test-clip"})})]}),e.jsxs("section",{className:"mt-6 rounded-2xl border border-white/10 bg-white/[0.02] p-5","data-testid":"section-catalog-voices",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Be,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-sm font-semibold text-zinc-200",children:"Vozes para narração (IA)"})]}),e.jsxs("p",{className:"text-xs text-zinc-400 mb-4",children:["Ouça as ",Le.length," vozes disponíveis e descubra o seu favorito antes de criar um Reel — na hora de criar, é só confirmar a escolha."]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:Le.map(t=>{const s=Ne===t.id,d=we===t.id;return e.jsxs("div",{className:`flex items-center gap-3 rounded-xl border p-3 transition-all ${s?"border-cyan-400/50 bg-cyan-500/[0.07]":"border-white/[0.07] bg-black/20"}`,children:[e.jsx("button",{type:"button",disabled:d,onClick:()=>ot(t.id),className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full transition-colors disabled:cursor-wait ${s?"bg-cyan-400 text-[#06121f]":"bg-white/10 text-cyan-200 hover:bg-cyan-500/30"}`,"aria-label":s?`Pausar ${t.label}`:`Ouvir ${t.label}`,"data-testid":`button-preview-voice-${t.id}`,children:d?e.jsx(r,{className:"h-4 w-4 animate-spin"}):s?e.jsx(xt,{className:"h-4 w-4"}):e.jsx($e,{className:"h-4 w-4 translate-x-[1px]"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-white","data-testid":`text-catalog-voice-name-${t.id}`,children:t.label}),e.jsx("span",{className:`shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-semibold ${t.gender==="female"?"bg-pink-500/10 text-pink-300":"bg-blue-500/10 text-blue-300"}`,children:t.gender==="female"?"Fem":"Masc"}),s&&e.jsxs("span",{className:"flex items-end gap-[2px] h-3 shrink-0","aria-hidden":!0,
1children:[e.jsx("span",{className:"w-[2px] h-1.5 bg-cyan-300 rounded-full animate-pulse"}),e.jsx("span",{className:"w-[2px] h-3 bg-cyan-300 rounded-full animate-pulse"}),e.jsx("span",{className:"w-[2px] h-2 bg-cyan-300 rounded-full animate-pulse"})]})]}),e.jsx("p",{className:"truncate text-xs text-zinc-400",children:t.desc})]})]},t.id)})}),e.jsx("p",{className:"mt-3 text-[11px] text-zinc-500",children:"1º clique gera o áudio (alguns segundos). Os seguintes são instantâneos — cada voz fica em cache."})]}),ie&&n&&e.jsxs("section",{className:"mt-6 rounded-2xl border border-cyan-500/20 bg-cyan-500/[0.03] p-5","data-testid":"section-heygen-twin",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(k,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-sm font-semibold text-zinc-200",children:"Digital Twin (corpo inteiro)"}),L&&e.jsxs("span",{className:"ml-auto inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[11px] font-semibold text-emerald-300","data-testid":"status-heygen-ready",children:[e.jsx(v,{className:"h-3 w-3"})," Pronto"]})]}),e.jsxs("p",{className:"text-xs text-zinc-400",children:["Nível acima do avatar por foto: um clone REAL treinado com o seu vídeo — corpo inteiro, gestos e expressões naturais. Grave ",e.jsx("strong",{children:"1 a 2 minutos em 1080p"}),", de frente, boa luz, falando naturalmente (o mesmo vídeo da seção acima serve). Arquivo grande (4K, direto do celular)? Pode mandar — a Sábhia prepara e envia automaticamente no padrão da HeyGen."]}),!o?.avatarGroupId&&!q&&e.jsxs("div",{className:"mt-3",children:[e.jsx("button",{type:"button",disabled:!n.videoObjectPath||re.isPending||w,onClick:()=>re.mutate(),className:"inline-flex items-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/[0.08] px-4 py-2.5 text-sm font-semibold text-cyan-200 hover:bg-cyan-500/[0.14] disabled:opacity-60","data-testid":"button-heygen-create",children:re.isPending||w?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"})," Preparando e enviando o vídeo…"]}):e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"h-4 w-4"})," Criar meu Digital Twin"]})}),w&&e.jsx("p",{className:"mt-2 text-[11px] text-cyan-200/80","data-testid":"text-heygen-creating",children:"Vídeo grande é preparado automaticamente — leva alguns minutos. Pode continuar navegando; o status atualiza sozinho."}),nt&&!w&&e.jsxs("p",{className:"mt-2 text-[11px] text-red-300/90","data-testid":"text-heygen-create-failed",children:["Não deu certo: ",o?.lastError||"tente novamente","."]}),!n.videoObjectPath&&e.jsx("p",{className:"mt-2 text-[11px] text-amber-300/90",children:"Envie primeiro o vídeo de treino na seção “Vídeo” deste clone."})]}),o?.avatarGroupId&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px]",children:[e.jsxs("span",{className:`rounded-full px-2 py-0.5 font-semibold ${Ae||o.trainingStatus==="manual"?"bg-emerald-500/10 text-emerald-300":o.trainingStatus==="failed"?"bg-red-500/10 text-red-300":"bg-cyan-500/10 text-cyan-300"}`,"data-testid":"status-heygen-training",children:["Treinamento: ",Ae?"pronto":o.trainingStatus==="failed"?"falhou":o.trainingStatus==="manual"?"look manual":"processando…"]}),e.jsxs("span",{className:`rounded-full px-2 py-0.5 font-semibold ${$?"bg-emerald-500/10 text-emerald-300":"bg-amber-500/10 text-amber-300"}`,"data-testid":"status-heygen-consent",children:["Consentimento: ",$?"ok":"pendente"]}),q&&e.jsxs("span",{className:"rounded-full bg-white/[0.06] px-2 py-0.5 text-zinc-300",children:["Look: ",String(o.avatarLookId).slice(0,12),"…"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",disabled:D.isPending,onClick:()=>D.mutate(),className:"inline-flex items-center gap-2 rounded-xl border border-white/10 bg-white/[0.04] px-3 py-2 text-xs font-semibold text-zinc-200 hover:bg-white/[0.08] disabled:opacity-60","data-testid":"button-heygen-refresh",children:[D.isPending?e.jsx(r,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(B,{className:"h-3.5 w-3.5"})," Atualizar status"]}),e.jsxs("button",{type:"button",disabled:le.isPending||w||M,onClick:()=>{window.confirm(`Refazer o Digital Twin?
2
3• O twin atual será desvinculado e um NOVO treinamento começa do zero (com o preparo de vídeo já corrigido).
4• Isso consome 1 slot de avatar na HeyGen e pede um novo consentimento na webcam.
5• Depois, apague o avatar antigo no painel da HeyGen pra liberar o slot.
6
7Continuar?`)&&le.mutate()},className:"inline-flex items-center gap-2 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] px-3 py-2 text-xs font-semibold text-amber-200 hover:bg-amber-500/[0.12] disabled:opacity-60","data-testid":"button-heygen-unlink",children:[le.isPending?e.jsx(r,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(B,{className:"h-3.5 w-3.5"})," Refazer Digital Twin"]})]}),!$&&e.jsxs("div",{className:"rounded-xl border border-cyan-500/25 bg-gradient-to-br from-cyan-500/[0.08] to-transparent p-3.5","data-testid":"card-heygen-consent-info",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-semibold text-cyan-200",children:[e.jsx(k,{className:"h-3.5 w-3.5"})," Falta 1 passo: a verificação de consentimento (~15 segundos)"]}),e.jsxs("p",{className:"mt-1.5 text-[11px] leading-relaxed text-zinc-400",children:["A HeyGen vai abrir uma página chamada ",e.jsx("em",{children:"“Crie seu Avatar em 15 segundos”"})," pedindo uma gravação rápida na webcam. ",e.jsx("strong",{className:"text-zinc-200",children:"Fique tranquilo: isso NÃO recria o seu avatar do zero."}
7)," O seu vídeo de treino já foi enviado e é ele que gera o clone — essa gravação é apenas a ",e.jsx("strong",{className:"text-zinc-200",children:"prova de consentimento"})," exigida pelos protocolos de segurança de IA (confirma que a pessoa clonada autorizou o uso da própria imagem). Basta ler o texto que aparece na tela, olhando pra câmera, com boa luz. Ao terminar você volta pra cá e o status atualiza sozinho."]}),e.jsxs("button",{type:"button",disabled:ce.isPending,onClick:()=>ce.mutate(),className:"mt-2.5 inline-flex items-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/[0.10] px-3.5 py-2 text-xs font-semibold text-cyan-200 hover:bg-cyan-500/[0.16] disabled:opacity-60","data-testid":"button-heygen-consent",children:[ce.isPending?e.jsx(r,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(v,{className:"h-3.5 w-3.5"})," Gravar o consentimento (abre a HeyGen)"]})]}),o.lastError&&e.jsxs("p",{className:"text-[11px] text-amber-300/90","data-testid":"text-heygen-error",children:["Último aviso: ",o.lastError]})]}),(ue||V)&&e.jsxs("div",{className:"mt-3 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-3.5","data-testid":"card-heygen-old-twin",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-semibold text-amber-200",children:[e.jsx(u,{className:"h-3.5 w-3.5 shrink-0"}),ue?"Este clone está usando o twin ANTIGO (treino distorcido)":"Há um twin antigo ocupando a vaga na HeyGen"]}),e.jsxs("p",{className:"mt-1.5 text-[11px] leading-relaxed text-zinc-400",children:[ue?"Ele foi treinado com o vídeo distorcido pelo bug de rotação (já corrigido) — por isso o personagem sai achatado nos Reels. ":"Ele foi desvinculado mas continua na sua conta HeyGen, ocupando a vaga de avatar do plano. ","Pra corrigir de vez: libere a vaga (apaga o twin antigo na HeyGen) e treine um novo Digital Twin com o mesmo vídeo — o preparo agora sai no formato certo."]}),V&&e.jsxs("button",{type:"button",disabled:xe.isPending||w||M,onClick:()=>{window.confirm(`Liberar a vaga na HeyGen?
8
9• O twin ANTIGO (distorcido) será APAGADO DE VEZ na HeyGen — não dá pra desfazer.
10• Este clone deixa de usar o look antigo na hora (os Reels voltam pro avatar por foto até o novo twin ficar pronto).
11• A vaga do plano fica livre pra treinar o novo Digital Twin com o vídeo corrigido.
12
13Continuar?`)&&xe.mutate()},className:"mt-2.5 inline-flex items-center gap-2 rounded-xl border border-amber-500/30 bg-amber-500/[0.10] px-3.5 py-2 text-xs font-semibold text-amber-200 hover:bg-amber-500/[0.16] disabled:opacity-60","data-testid":"button-heygen-release-slot",children:[xe.isPending?e.jsx(r,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(u,{className:"h-3.5 w-3.5"})," Liberar vaga na HeyGen (apaga o twin antigo)"]})]}),e.jsxs("details",{className:"mt-3 group",children:[e.jsx("summary",{className:"cursor-pointer text-[11px] text-zinc-500 hover:text-zinc-300",children:"Já criei o avatar direto no painel da HeyGen (colar o id do look)"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx("input",{type:"text",value:J,onChange:t=>Ce(t.target.value),placeholder:"avatar_id do look (ex.: 3c9a…)",className:"flex-1 rounded-xl border border-white/10 bg-black/30 px-3 py-2 text-xs text-zinc-200 placeholder:text-zinc-600 outline-none focus:border-cyan-500/40","data-testid":"input-heygen-manual-look"}),e.jsxs("button",{type:"button",disabled:!J.trim()||de.isPending,onClick:()=>de.mutate(),className:"inline-flex items-center gap-1 rounded-xl border border-cyan-500/30 bg-cyan-500/[0.08] px-3 py-2 text-xs font-semibold text-cyan-200 hover:bg-cyan-500/[0.14] disabled:opacity-60","data-testid":"button-heygen-manual-look",children:[de.isPending?e.jsx(r,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(v,{className:"h-3.5 w-3.5"})," Vincular"]})]})]}),L&&e.jsxs("div",{className:"mt-4 border-t border-white/5 pt-4",children:[e.jsx("button",{type:"button",disabled:M||pe.isPending,onClick:()=>pe.mutate(),className:"inline-flex items-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/[0.08] px-4 py-2.5 text-sm font-semibold text-cyan-200 hover:bg-cyan-500/[0.14] disabled:opacity-60","data-testid":"button-heygen-test",children:M||pe.isPending?e.jsxs(e.Fragment,{children:[e.jsx(r,{className:"h-4 w-4 animate-spin"})," Gerando o teste… (2–6 min)"]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-4 w-4"})," Gerar teste do twin"]})}),e.jsx("p",{className:"mt-2 text-[11px] text-zinc-500",children:"Teste curto (1 frase, 9:16). Com o twin aprovado, os Reels “Com o meu clone” passam a usar o Digital Twin automaticamente."}),p?.status==="failed"&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-xl border border-amber-500/20 bg-amber-500/[0.05] px-3 py-2 text-xs text-amber-300","data-testid":"status-heygen-test-failed",children:[e.jsx(u,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsxs("span",{children:["O teste falhou: ",p.error||"tente novamente","."]})]}),p?.status==="done"&&p.downgraded&&e.jsxs("div",{className:"mt-3 flex items-start gap-2 rounded-xl border border-amber-500/20 bg-amber-500/[0.05] px-3 py-2 text-xs text-amber-300","data-testid":"status-heygen-test-downgraded",children:[e.jsx(u,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:"Este teste saiu no motor de FOTO (avatar_iv) — qualidade abaixo do Digital Twin real. Gere o teste de novo: o sistema re-verifica os motores do look na hora, direto na HeyGen."})]}),p?.status==="done"&&p.objectPath&&e.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-white/10 bg-black/30",children:e.jsx("video",{src:p.objectPath,controls:!0,playsInl
13ine:!0,className:"mx-auto max-h-[420px] w-auto","data-testid":"video-heygen-test"})})]})]}),e.jsxs("div",{className:"mt-8 flex items-center justify-between rounded-2xl border border-cyan-500/20 bg-cyan-500/[0.03] p-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-zinc-100",children:G?"Tudo pronto!":"Quase lá"}),e.jsx("p",{className:"text-xs text-zinc-400",children:G?"Crie um Reel e escolha este clone em “Com o meu clone”.":"Assim que a foto e a voz estiverem prontas, o clone aparece no criador de Reels."})]}),e.jsx(he,{href:"/videos/reels/novo",children:e.jsxs("button",{className:`inline-flex items-center gap-2 rounded-xl px-4 py-2.5 text-sm font-semibold ${U.primaryBtn}`,"data-testid":"button-create-reel",children:[e.jsx(k,{className:"h-4 w-4"})," Criar um Reel"]})})]})]})})}export{Vt 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.