1import{j as e}from"./vendor-motion-CPxq9Xvn.js";import{r}from"./vendor-i18n-CO3kK2bH.js";import{n as Ze,a3 as Ct,ai as St,u as V,a6 as S,a7 as g,C as ne,a9 as p,T as Se,b0 as He,S as se,Y as Vs,as as Ge,Z as me,aG as ie,ap as qs,e as Es,U as pe,a as Q,X as he,$ as Ea,k as Oa,_ as Ia,f as At,aK as Us,K as Fa,ao as Tt,an as Va}from"./index-CFAvyuXu.js";import{V as Ps,R as ke,T as te}from"./videos-shell-Dt9iLSCb.js";import{R as It,A as Ra,T as Rt,O as Ua,b as Pt,s as $t}from"./moneyModeling-DaOS755u.js";import{G as we}from"./globe-D0MKCb1Y.js";import{E as Te}from"./eye-BcGCsLne.js";import{L as Da}from"./layers-B-zOJ8Vr.js";import{F as Ae}from"./flask-conical-BNHqZQpQ.js";import{F as Os}from"./film-5Ww7nMCK.js";import{T as le}from"./trash-2-BF2rPJAw.js";import{K as Mt}from"./key-round-CBIBEIGQ.js";import{S as We}from"./smartphone-B4uVuS8T.js";import{L as $s}from"./lightbulb-BvSG_Icx.js";import{W as Fs}from"./wand-sparkles-BFRdHggN.js";import{Y as Ce}from"./youtube-C3-YPqKU.js";import{R as Ke}from"./rotate-ccw-yv6DhBa4.js";import{T as Ms}from"./target-CjPWrUoS.js";import{C as Je}from"./circle-play-BeGABqqs.js";import{B as _a}from"./brain-circuit-BiacJsPX.js";import{D as Lt}from"./download-B7FtiUYJ.js";import{T as Pa}from"./trophy-Bk4C1tet.js";import{T as qt}from"./trending-down-CfcKlIud.js";import"./vendor-react-CQmBMThG.js";import"./layout-dashboard-pnVssBCT.js";const Et=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Ls=Ze("chart-line",Et);const Ot=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Qe=Ze("compass",Ot);const Ft=[["path",{d:"m13.5 6.5-3.148-3.148a1.205 1.205 0 0 0-1.704 0L6.352 5.648a1.205 1.205 0 0 0 0 1.704L9.5 10.5",key:"dzhfyz"}],["path",{d:"M16.5 7.5 19 5",key:"1ltcjm"}],["path",{d:"m17.5 10.5 3.148 3.148a1.205 1.205 0 0 1 0 1.704l-2.296 2.296a1.205 1.205 0 0 1-1.704 0L13.5 14.5",key:"nfoymv"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}],["path",{d:"M9.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l4.296-4.296a1.205 1.205 0 0 0 0-1.704l-2.296-2.296a1.205 1.205 0 0 0-1.704 0z",key:"nv9zqy"}]],Vt=Ze("satellite",Ft);const Ut=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]],Ba=Ze("scan-search",Ut),Dt=[{id:"radar",label:"Radar",icon:ke},{id:"validadas",label:"Oportunidades Validadas",icon:ne},{id:"monitorados",label:"Canais Monitorados",icon:Te},{id:"clusters",label:"Termos e Clusters",icon:Da},{id:"modelados",label:"Canais Modelados",icon:te},{id:"lotes",label:"Lotes de Teste",icon:Ae},{id:"nichos",label:"Descoberta de Nichos",icon:Qe},{id:"produzidos",label:"Produzidos",icon:Os},{id:"descartados",label:"Descartados",icon:le}];function E(a){return a==null||a<0?"â":a>=1e6?`${(a/1e6).toFixed(1).replace(".",",")}M`:a>=1e3?`${(a/1e3).toFixed(1).replace(".",",")}k`:a.toLocaleString("pt-BR")}function ze(a){if(!a)return"";try{return new Date(a).toLocaleDateString("pt-BR",{day:"2-digit",month:"short",hour:"2-digit",minute:"2-digit"})}catch{return""}}function Ga(a){if(a==null||a<=0)return"â";const l=Math.floor(a/60),c=Math.round(a%60);return`${l}min${c?` ${c}s`:""}`}function Ka(a){return a==null||a<0||a>=9e3?"â":a===0?"hoje":a<30?`${a}d`:a<365?`${Math.round(a/30)} mês${a>=60?"es":""}`:`${Math.round(a/365)} ano${a>=730?"s":""}`}function $a(a){return Array.isArray(a)?a.map(l=>typeof l=="string"?l:l?.label||l?.title||JSON.stringify(l)).filter(Boolean):[]}async function A(a,l){return(await Va("POST",a,l)).json()}const _t={opportunity:"Oportunidade (0â100): atratividade geral do vÃdeo como ideia a adaptar â combina viral, gap de idioma e viabilidade de produção.",outlier:"Outlier (0â100): o quão viral foi o vÃdeo de referência em relação à média do canal. Zero = vÃdeo sem dados reais (tema investigado).",gap:"Gap de Idioma (0â100): quão escasso/fraco é o conteúdo equivalente no idioma-alvo. Alto = poucos concorrentes no mercado que você quer entrar.",roi:"ROI (0â100): retorno esperado versus esforç
1o e custo de produção. Alto = boa relação entre resultado potencial e trabalho necessário.",title:"Força do TÃtulo (0â100): potencial do tÃtulo sugerido â clareza, gatilho emocional, originalidade e aderência à fórmula vencedora.",compliance:"Compliance (0â100): segurança para publicar â quanto mais alto, menor o risco de demonetização, copyright ou sensibilidade temática."};function U({gateKey:a,score:l,label:c}){const n=Number(l??0),o=$t(n),u=a?Pt[a]:void 0,j=u!=null?n>=u:o==="alto",T=[a?_t[a]:void 0,u!=null?`Meta mÃnima: ${u}`:null].filter(Boolean).join(` 2`);return e.jsxs("div",{className:p("flex items-center gap-1.5 rounded-lg border px-2 py-1 text-[11px] font-medium cursor-help",o==="alto"?"border-cyan-400/40 bg-cyan-500/10 text-cyan-100":o==="médio"?"border-amber-400/30 bg-amber-500/10 text-amber-100":"border-white/10 bg-white/[0.03] text-zinc-400"),title:T||void 0,"data-testid":`chip-score-${c.toLowerCase()}`,children:[e.jsx("span",{className:"uppercase tracking-wide opacity-70",children:c}),e.jsx("span",{className:"tabular-nums font-bold",children:n}),u!=null&&e.jsx("span",{className:p("ml-0.5",j?"text-cyan-300":"text-zinc-600"),children:j?"â":""})]})}function Y({icon:a,title:l,hint:c}){return e.jsxs("div",{className:"flex flex-col items-center justify-center text-center py-16 px-6","data-testid":"empty-state",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-cyan-500/[0.06] border border-cyan-400/15 flex items-center justify-center mb-4",children:e.jsx(a,{className:"w-7 h-7 text-cyan-400/70"})}),e.jsx("h3",{className:"text-zinc-200 font-medium",children:l}),c&&e.jsx("p",{className:"text-zinc-500 text-sm mt-1.5 max-w-md",children:c})]})}function ae({label:a,tone:l="default"}){return e.jsx("span",{className:p("inline-flex items-center rounded-full px-2.5 py-0.5 text-[11px] font-medium border",l==="good"?"border-cyan-400/30 bg-cyan-500/10 text-cyan-200":l==="warn"?"border-amber-400/30 bg-amber-500/10 text-amber-200":l==="bad"?"border-red-400/30 bg-red-500/10 text-red-200":"border-white/10 bg-white/[0.04] text-zinc-300"),children:a})}const k="rounded-2xl border border-white/10 bg-white/[0.025] p-4 md:p-5",q="inline-flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-blue-500 to-cyan-400 px-4 py-2.5 text-sm font-semibold text-white shadow-lg shadow-blue-900/30 hover:opacity-95 transition disabled:opacity-50 disabled:cursor-not-allowed",b="inline-flex items-center justify-center gap-1.5 rounded-lg border border-white/10 bg-white/[0.03] px-3 py-2 text-xs font-medium text-zinc-300 hover:text-white hover:border-cyan-300/30 hover:bg-white/5 transition disabled:opacity-50",h="w-full rounded-xl bg-white/[0.03] border border-white/10 px-3.5 py-2.5 text-sm text-white placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400/40 focus:ring-1 focus:ring-cyan-400/20 transition";function Bt(a){return a?a.status==="failed"?"failed":a.status==="completed"?"done":(a.opportunitiesCreated??0)>0?"enriching":(a.resultsScanned??0)>0?"auditing":"searching":"searching"}const Ye={searching:{icon:Vt,label:"Buscando outliers no YouTube",hint:"Fazendo buscas no YouTube Data API e filtrando por razão views/inscritos.",color:"text-cyan-300"},auditing:{icon:Ba,label:"Auditando vÃdeos encontrados",hint:"Analisando estatÃsticas de canal, velocidade de views e pontuação de outlier.",color:"text-sky-300"},enriching:{icon:_a,label:"Enriquecendo com IA",hint:"Gemini está montando fórmulas de tÃtulo, motor emocional e gap de idioma.",color:"text-indigo-300"},done:{icon:ne,label:"Radar concluÃdo!",hint:"As oportunidades estão na aba 'Oportunidades Validadas'.",color:"text-cyan-300"},failed:{icon:he,label:"Erro no Radar",hint:"",color:"text-red-300"}};function Gt({color:a="bg-cyan-400"}){return e.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[e.jsx("span",{className:p("animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",a)}),e.jsx("span",{className:p("relative inline-flex rounded-full h-2.5 w-2.5",a)})]})}function Kt({runId:a,onClose:l}){const n=V({queryKey:[`/api/modeling/radar/runs/${a}`],queryFn:async()=>{const O=await(await Va("GET",`/api/modeling/radar/runs/${a}`)).json();return O?.run??O},refetchInterval:y=>{const O=y.state.data;return O?O.status==="running"?3e3:!1:3e3},retry:3,staleTime:0}).data,o=Bt(n),u=Ye[o],j=u.icon,z=!n||n.status==="running";r.useEffect(()=>{if(o==="done"){const y=setTimeout(l,8e3);return()=>clearTimeout(y)}},[o,l]);const T=n?.startedAt?Math.round((Date.now()-new Date(n.startedAt).getTime())/1e3):0,m=T>=60?`${Math.floor(T/60)}m ${T%60}s`:`${T}s`,f=Array.isArray(n?.queries)?n.queries:[];return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-black/40 backdrop-blur-[2px]",onClick:l,"aria-hidden":!0}),e.jsx("div",{className:"fixed z-50 bottom-0 left-0 right-0 md:inset-0 md:flex md:items-center md:justify-center md:p-6","data-testid":"radar-live-drawer",children:e.jsxs("div",{className:"relative w-full md:max-w-md rounded-t-3xl md:rounded-2xl bg-[#070c18] border border-white/10 shadow-2xl shadow-black/60 overflow-hidden",children:[e.jsx("div",{className:p("h-1 w-full",o==="done"?"bg-gradient-to-r from-cyan-400 to-sky-400":o==="failed"?"bg-gradient-to-r from-red-500 to-rose-400":"bg-gradient-to-r from-blue-500 via-cyan-400 to-sky-400 animate-[shimmer_2s_linear_infinite]")}),e.jsxs("div",{className:"p-5 md:p-6",children:[e.jsxs("div",{className:"flex items-start justify-between mb-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:p("w-10 h-10 rounded-xl flex items-center justify-center shrink-0",o==="done"?"bg-cyan-500/15 border border-cyan-400/30":o==="failed"?"bg-red-500/15 border border-red-400/30":"bg-blue-500/15 border border-blue-400/20"),children:z?e.jsx(g,{className:"w-5 h-5 animate-spin text-cyan-300"}):e.jsx(j,{className:p("w-5 h-5",u.color)})}),e.jsxs("div",{children:[e.jsx("p",{className:p("font-semibold text-sm leading-tight",u.color),children:u.label}),e.jsxs("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:["Radar em execução ⢠",m]})]})]}),e.jsx("button",{onClick:l,className:"w-7 h-7 rounded-lg flex items-center justify-center text-zinc-500 hover:text-zinc-200 hover:bg-white/10 transition","data-testid":"button-close-radar-drawer",children:e.jsx(Vs,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"space-y-2.5 mb-5",children:["searching","auditing","enriching"].map((y,O)=>{const H=["searching","auditing","enriching","done","failed"].indexOf(o),D=O,M=H>D||o==="done",_=H===D&&z,W=Ye[y].icon;return e.jsxs("div",{className:p("flex items-center gap-3 rounded-xl px-3.5 py-2.5 border transition-all",_?"border-cyan-400/25 bg-cyan-500/[0.07]":M?"border-cyan-400/10 bg-cyan-500/[0.03]":"border-white/5 bg-transparent opacity-40"),children:[e.jsx("div",{className:p("w-7 h-7 rounded-lg flex items-center justify-center shrink-0",_?"bg-cyan-500/20":M?"bg-cyan-500/10":"bg-white/[0.03]"),children:_?e.jsx(g,{className:"w-3.5 h-3.5 animate-spin text-cyan-300"}):M?e.jsx(ne,{className:"w-3.5 h-3.5 text-cyan-400"}):e.jsx(W,{className:"w-3.5 h-3.5 text-zinc-600"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:p("text-xs font-medium leading-tight",_?"text-cyan-100":M?"text-zinc-300":"text-zinc-600"),children:Ye[y].label}),_&&e.jsx("p",{className:"text-[10px] text-zinc-500 mt-0.5 truncate",children:Ye[y].hint})]}),_&&e.jsx(Gt,{}),M&&!_&&e.jsx("span",{className:"text-[10px] text-cyan-500/70 shrink-0",children:"â"})]},y)})}),o!=="failed"&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"rounded-xl bg-white/[0.025] border border-white/[0.07] px-3.5 py-3 text-center",children:[e.jsx("p",{className:"text-xl font-bold tabular-nums text-white","data-testid":"drawer-scanned",children:n?.resultsScanned??0}),e.jsx("p",{className:"text-[10px] text-zinc-500 mt-0.5 uppercase tracking-wide",children:"vÃdeos escaneados"})]}),e.jsxs("div",{className:"rounded-xl bg-white/[0.025] border border-cyan-400/10 px-3.5 py-3 text-center",children:[e.jsx("p",{className:"text-xl font-bold tabular-nums text-cyan-200","data-testid":"drawer-opportunities",children:n?.opportunitiesCreated??0}),e.jsx("p",{className:"text-[10px] text-zinc-500 mt-0.5 uppercase tracking-wide",children:"oportunidades"})]})]}),z&&f.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wider text-zinc-600 mb-1.5",children:"Buscas em andamento"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.slice(0,6).map(y=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/[0.03] px-2 py-0.5 text-[11px] text-zinc-400",children:[e.jsx(He,{className:"w-2.5 h-2.5"})," ",y]},y))})]}),o==="failed"&&n?.error&&e.jsx("div",{className:"rounded-xl border border-red-400/20 bg-red-500/[0.06] px-3.5 py-3 mb-4",children:e.jsx("p",{className:"text-xs text-red-300",children:n.error})}),o==="done"&&n?.metadata?.pipeline&&e.jsxs("div",{className:"mb-3 rounded-xl border border-white/[0.06] bg-white/[0.02] px-3.5 py-2.5 text-[11px] text-zinc-500",children:[e.jsx("p",{className:"uppercase tracking-wider text-[10px] text-zinc-600 mb-1.5",children:"Resumo do pipeline"}),e.jsxs("div",{className:"grid grid-cols-3 gap-x-4 gap-y-1",children:[e.jsx("span",{children:"YouTube encontrou"}),e.jsxs("span",{className:"col-span-2 text-zinc-300 font-medium text-right",children:[n.metadata.pipeline.scannedTotal??n.resultsScanned??0," vÃdeos"]}),(n.metadata.pipeline.filteredByLanguage??0)>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-zinc-500",children:"Idioma divergente"}),e.jsxs("span",{className:"col-span-2 text-zinc-500 font-medium text-right",children:["~",n.metadata.pipeline.filteredByLanguage]})]}),(n.metadata.pipeline.filteredByOutlier??0)>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Score baixo"}),e.jsxs("span",{className:"col-span-2 text-zinc-500 font-medium text-right",children:["â",n.metadata.pipeline.filteredByOutlier]})]}),e.jsx("span",{children:"Passaram no filtro"}),e.jsx("span",{className:"col-span-2 text-sky-300 font-medium text-right",children:n.metadata.pipeline.passed??0}),e.jsx("span",{children:"Enriquecidos pela IA"}),e.jsx("span",{className:"col-span-2 text-indigo-300 font-medium text-right",children:n.metadata.pipeline.enriched??0}),e.jsx("span",{className:"font-semibold text-zinc-400",children:"Oportunidades salvas"}),e.jsx("span",{className:"col-span-2 text-cyan-300 font-bold text-right",children:n.metadata.pipeline.created??n.opportunitiesCreated??0})]})]}),e.jsx("p",{className:p("text-[11px] text-center",o==="done"?"text-cyan-400/80":o==="failed"?"text-red-400/70":"text-zinc-600"),children:o==="done"?`ConcluÃdo em ${m} · ${n?.opportunitiesCreated??0} oportunidade(s) descoberta(s). Esta janela fecha em instantes.`:o==="failed"?"Você pode tentar novamente com outro nicho ou verificar a configuração da chave.":"Isto pode levar de 30 segundos a alguns minutos, dependendo do nicho."})]})]})})]})}function Yt(a){return a==="none"?{text:"Sem concorrência",cls:"text-emerald-400 bg-emerald-500/10 border-emerald-500/20"}:a==="low"?{text:"Concorrência baixa",cls:"text-cyan-400 bg-cyan-500/10 border-cyan-500/20"}:a==="medium"?{text:"Concorrência média",cls:"text-amber-400 bg-amber-500/10 border-amber-500/20"}:{text:"Concorrência alta",cls:"text-red-400 bg-red-500/10 border-red-500/20"}}function Qt({m:a,rank:l,onCreateVideo:c}){const[n,o]=r.useState(!1),u=Yt(a.competition),j=a.opportunityScore>=70?"hot":a.opportunityScore>=45?"warm":"cold",z=j==="hot"?"border-cyan-400/50 bg-gradient-to-b from-cyan-500/10 to-transparent":j==="warm"?"border-amber-400/30 bg-amber-500/5":"border-white/8 bg-white/[0.02]";return e.jsxs("div",{className:`rounded-xl border p-3 flex flex-col gap-2 transition-all ${z}`,"data-testid":`card-market-${a.language}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-2xl leading-none",children:a.flag}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:"text-white text-xs font-semibold truncate",children:a.languageName}),l===1&&e.jsx("span",{className:"text-[9px] font-bold text-amber-300 bg-amber-500/15 border border-amber-400/30 rounded px-1 py-0.5",children:"ð #1"}),l===2&&e.jsx("span",{className:"text-[9px] font-bold text-zinc-300 bg-white/5 border border-white/10 rounded px-1 py-0.5",children:"ð¥ #2"}),l===3&&e.jsx("span",{className:"text-[9px] font-bold text-amber-600 bg-amber-900/20 border border-amber-700/30 rounded px-1 py-0.5",children:"ð¥ #3"})]}),e.jsx("p",{className:"text-[10px] text-zinc-500",children:a.region})]}),e.jsx("div",{className:`flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center border-2 text-xs font-bold 3 ${j==="hot"?"border-cyan-400 text-cyan-300 bg-cyan-500/10":j==="warm"?"border-amber-400 text-amber-300 bg-amber-500/10":"border-zinc-600 text-zinc-400 bg-white/5"}`,children:a.opportunityScore})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-[9px] text-zinc-500 mb-0.5",children:[e.jsx("span",{children:"Oportunidade"}),e.jsx("span",{className:"font-bold text-zinc-300",children:a.opportunityScore})]}),e.jsx("div",{className:"h-1 bg-white/10 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${j==="hot"?"bg-cyan-400":j==="warm"?"bg-amber-400":"bg-zinc-600"}`,style:{width:`${a.opportunityScore}%`}})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-[9px] text-zinc-500 mb-0.5",children:[e.jsx("span",{children:"Gap"}),e.jsx("span",{className:"font-bold text-zinc-300",children:a.gapScore})]}),e.jsx("div",{className:"h-1 bg-white/10 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-emerald-500",style:{width:`${a.gapScore}%`}})})]})]}),e.jsx("div",{className:`self-start text-[9px] font-semibold px-2 py-0.5 rounded-full border ${u.cls}`,children:u.text}),a.suggestedTitle&&e.jsxs("div",{className:"bg-white/[0.03] rounded-lg px-2.5 py-2 border border-white/8",children:[e.jsx("p",{className:"text-[9px] text-zinc-500 mb-1",children:"TÃtulo sugerido:"}),e.jsx("p",{className:"text-xs text-zinc-200 leading-relaxed font-medium",children:a.suggestedTitle})]}),(a.reasoning||a.keyInsight)&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"text-[10px] text-cyan-400/60 hover:text-cyan-300 flex items-center gap-1 self-start transition-colors",onClick:()=>o(!n),children:[n?e.jsx(Ea,{className:"w-3 h-3"}):e.jsx(Oa,{className:"w-3 h-3"}),n?"Menos detalhes":"Ver análise"]}),n&&e.jsxs("div",{className:"space-y-1.5 text-[10px] leading-relaxed text-zinc-400",children:[a.reasoning&&e.jsxs("p",{children:[e.jsx("span",{className:"text-zinc-300 font-medium",children:"Análise: "}),a.reasoning]}),a.keyInsight&&e.jsxs("div",{className:"flex gap-1.5 bg-cyan-500/5 border border-cyan-500/15 rounded-lg px-2 py-1.5",children:[e.jsx(me,{className:"w-3 h-3 text-cyan-400 flex-shrink-0 mt-0.5"}),e.jsx("p",{className:"text-cyan-200/80",children:a.keyInsight})]})]})]}),j!=="cold"&&e.jsxs("button",{className:"mt-auto w-full py-1.5 text-[10px] font-semibold rounded-lg border border-cyan-400/30 text-cyan-300 bg-cyan-500/8 hover:bg-cyan-500/15 transition-colors flex items-center justify-center gap-1.5",onClick:()=>c(a.language),"data-testid":`button-create-${a.language}`,children:[e.jsx(Us,{className:"w-3 h-3"})," Criar vÃdeo em ",a.languageName.split(" ")[0]]})]})}function Ht({analysis:a,onClose:l,onCreateVideo:c}){const[n,o]=r.useState("all"),u=a.publishedAt?Math.max(1,Math.round((Date.now()-new Date(a.publishedAt).getTime())/864e5)):null,j=[...a.markets].sort((m,f)=>f.opportunityScore-m.opportunityScore),z=n==="hot"?j.filter(m=>m.opportunityScore>=70):n==="warm"?j.filter(m=>m.opportunityScore>=45):j,T=j.slice(0,3);return e.jsxs("div",{className:"mt-4 rounded-2xl border border-cyan-500/20 bg-gradient-to-b from-cyan-950/20 to-transparent overflow-hidden","data-testid":"panel-url-analysis",children:[e.jsxs("div",{className:"flex items-start gap-3 p-4 border-b border-white/8 bg-white/[0.02]",children:[a.thumb
3nailUrl&&e.jsx("img",{src:a.thumbnailUrl,alt:a.videoTitle,className:"w-24 h-14 rounded-lg object-cover flex-shrink-0 border border-white/10"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start gap-2 justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold text-white leading-snug line-clamp-2",children:a.videoTitle}),e.jsx("button",{onClick:l,className:"flex-shrink-0 text-zinc-500 hover:text-zinc-300 transition-colors ml-2","data-testid":"button-close-url-analysis",children:e.jsx(Vs,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-[11px] text-zinc-400 mt-0.5",children:a.channelTitle}),e.jsxs("div",{className:"flex items-center gap-3 mt-1.5 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-zinc-400",children:[e.jsx(Te,{className:"w-3 h-3"}),e.jsx("span",{className:"font-medium text-white",children:E(a.viewCount)})," views"]}),e.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-zinc-400",children:[e.jsx(pe,{className:"w-3 h-3"}),e.jsx("span",{className:"font-medium text-white",children:E(a.subscriberCount)})," inscritos"]}),u!==null&&e.jsx("span",{className:"text-[11px] text-zinc-500",children:u<1?"hoje":u===1?"há 1 dia":`há ${u} dias`}),e.jsxs("a",{href:a.videoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] text-cyan-400/70 hover:text-cyan-300 flex items-center gap-0.5",children:[e.jsx(ie,{className:"w-3 h-3"})," Ver no YouTube"]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-1 bg-cyan-500/15 border border-cyan-400/30 rounded-full px-2 py-0.5",children:[e.jsx(Se,{className:"w-3 h-3 text-cyan-400"}),e.jsxs("span",{className:"text-[10px] font-bold text-cyan-300",children:["Outlier ",a.outlierScore]})]}),e.jsxs("span",{className:"text-[10px] text-zinc-500",children:[Math.round(a.outlierRatio),"à views/inscritos ·"," ",a.outlierVelocityPerDay>=1e3?`${E(Math.round(a.outlierVelocityPerDay))}/dia`:`${Math.round(a.outlierVelocityPerDay)} views/dia`]})]})]})]}),e.jsxs("div",{className:"px-4 py-3 border-b border-white/8 bg-white/[0.015]",children:[e.jsxs("p",{className:"text-[10px] text-zinc-500 mb-2 flex items-center gap-1.5",children:[e.jsx(Es,{className:"w-3 h-3 text-amber-400"})," Mercados mais quentes para você publicar agora:"]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:T.map(m=>e.jsxs("div",{className:"flex items-center gap-1.5 bg-white/5 border border-white/10 rounded-full px-2.5 py-1",children:[e.jsx("span",{children:m.flag}),e.jsx("span",{className:"text-[10px] font-medium text-zinc-200",children:m.languageName.split(" ")[0]}),e.jsx("span",{className:"text-[10px] font-bold text-cyan-300",children:m.opportunityScore})]},m.language))})]}),e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("p",{className:"text-xs font-semibold text-zinc-300",children:[a.markets.length," mercados analisados"]}),e.jsx("div",{className:"flex gap-1",children:["all","hot","warm"].map(m=>e.jsx("button",{onClick:()=>o(m),className:p("text-[10px] px-2.5 py-1 rounded-full border transition-colors",n===m?"bg-cyan-500/20 border-cyan-400/40 text-cyan-200":"border-white/10 text-zinc-500 hover:text-zinc-300"),children:m==="all"?"Todos":m==="hot"?"ð¥ Top (â¥70)":"ð¡ Bom (â¥45)"},m))})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[z.map((m,f)=>e.jsx(Qt,{m,rank:f+1,onCreateVideo:c},m.language)),z.length===0&&e.jsx("div",{className:"col-span-full text-center py-6 text-zinc-500 text-sm",children:"Nenhum mercado no filtro selecionado."})]}),a.sources.length>0&&e.jsxs("div",{className:"mt-4 pt-3 border-t border-white/8",children:[e.jsx("p",{className:"text-[10px] text-zinc-600 mb-2",children:"Fontes pesquisadas pela IA:"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.sources.map((m,f)=>e.jsxs("a",{href:m.uri,target:"_blank",rel:"noopener noreferrer",className:"text-[9px] text-zinc-500 hover:text-cyan-400 flex items-center gap-1 bg-white/[0.03] border border-white/8 rounded px-1.5 py-0.5 transition-colors",children:[e.jsx(ie,{className:"w-2.5 h-2.5"}),m.title.slice(0,40),m.title.length>40?"â¦":""]},f))})]})]})]})}function zi(){const{toast:a}=Ct(),l=St(),[c,n]=r.useState("radar"),o=V({queryKey:["/api/modeling/features"],retry:!1,staleTime:3e5}),u=!!o.data?.flags?.moneyModeling,j=!!o.data?.flags?.moneyAnalytics,z=!!o.data?.flags?.moneyArabic,T=!!o.data?.flags?.producedDedup,m=!!o.data?.reelsMo
3delingEnabled,f=V({queryKey:["/api/modeling/radar/runs"],enabled:u,retry:!1}),y=(f.data?.runs||[]).some(s=>s.status==="running"),O=r.useMemo(()=>{const s=Date.now()-864e5;return(f.data?.runs??[]).filter(t=>t.createdAt&&new Date(t.createdAt).getTime()>=s).length},[f.data]),G=V({queryKey:["/api/modeling/opportunities"],enabled:u,retry:!1,refetchInterval:y?6e3:!1}),H=V({queryKey:["/api/modeling/terms-clusters"],enabled:u&&c==="clusters",retry:!1}),D=V({queryKey:["/api/modeling/channels"],enabled:u,retry:!1}),M=V({queryKey:["/api/modeling/test-batches"],enabled:u&&c==="lotes",retry:!1}),_=V({queryKey:["/api/modeling/produced"],enabled:u&&T,retry:!1}),W=_.data?.produced??[],Ie=r.useMemo(()=>{const s=new Set;for(const t of W)t.externalVideoId&&s.add(t.externalVideoId),t.opportunityId&&s.add(t.opportunityId);return s},[W]),Ds=s=>!!s.externalVideoId&&Ie.has(s.externalVideoId)||Ie.has(s.id),es=j&&c==="analytics",ss=V({queryKey:["/api/money/performance-snapshots"],enabled:es,retry:!1}),ge=V({queryKey:["/api/money/patterns"],enabled:es,retry:!1}),Qa=V({queryKey:["/api/money/risk-profiles"],enabled:es,retry:!1}),_s=f.refetch;r.useMemo(()=>{if(!y)return;const s=setInterval(()=>{_s()},4e3);return()=>clearInterval(s)},[y,_s]);const R=(...s)=>s.forEach(t=>l.invalidateQueries({queryKey:[t]})),[Bs,Gs]=r.useState(null),[as,Ks]=r.useState(""),[Re,Ha]=r.useState(""),[ts,Wa]=r.useState("pt"),[Ys,Ja]=r.useState("en"),[Qs,Xa]=r.useState(""),[Hs,Za]=r.useState("90"),[is,et]=r.useState("any"),[Pe,Ws]=r.useState("video"),[ns,st]=r.useState("0"),[Js,at]=r.useState(""),[Xs,tt]=r.useState(""),[Zs,it]=r.useState(""),[ea,nt]=r.useState(!1),[rs,sa]=r.useState(""),[aa,rt]=r.useState("en"),[ta,lt]=r.useState("pt"),[ls,dt]=r.useState(!1),[ds,ia]=r.useState(""),[os,na]=r.useState(""),[cs,ot]=r.useState(""),[ra,xs]=r.useState(null),[de,be]=r.useState(""),[P,je]=r.useState([]),[J,ms]=r.useState(""),[re,ct]=r.useState("pt"),[C,ps]=r.useState(null),[xt,$e]=r.useState(""),[I,oe]=r.useState({externalVideoId:"",views:"",ctr:"",rpmCents:"",revenueCents:""}
3),[K,Me]=r.useState({patternType:"winning",category:"title",label:"",description:""}),[la,mt]=r.useState("pt"),[da,pt]=r.useState("dark"),[oa,ut]=r.useState(""),[ca,xa]=r.useState(null),[ht,gt]=r.useState(null),[ma,bt]=r.useState(""),[pa,jt]=r.useState("SA"),[ve,vt]=r.useState(""),[ua,ha]=r.useState(""),[Le,us]=r.useState(null),hs=S({mutationFn:()=>A("/api/modeling/radar/run",{niche:as.trim()||void 0,queries:Re.trim()?Re.split(",").map(s=>s.trim()).filter(Boolean):void 0,targetLanguage:ts,sourceLanguage:Ys,regionCode:Qs.trim()||void 0,publishedWithinDays:Number(Hs)||90,videoDuration:is!=="any"?is:void 0,targetFormat:m&&Pe==="reels"?"reels":void 0,minimumModelingScore:Number(ns)>0?Number(ns):void 0,contentType:Js.trim()||void 0,productionPreference:Xs.trim()||void 0,riskTolerance:Zs.trim()||void 0}),onSuccess:s=>{R("/api/modeling/radar/runs","/api/modeling/opportunities"),s?.run?.id&&Gs(s.run.id),s?.hasYoutubeKey===!1&&a({title:"Radar iniciado (sem chave do YouTube)",description:"A busca pode falhar sem a YouTube Data API. Configure a chave para resultados reais.",variant:"destructive"})},onError:s=>a({title:"Não foi possÃvel iniciar o Radar",description:s?.message,variant:"destructive"})}),gs=S({mutationFn:()=>A("/api/modeling/opportunities/investigate",{theme:rs.trim(),sourceLanguage:aa,targetLanguage:ta,targetFormat:m&&ls?"reels":void 0}),onSuccess:()=>{R("/api/modeling/opportunities"),sa(""),a({title:"Tema investigado ð",description:"A oportunidade enriquecida foi adicionada à sua lista."})},onError:s=>a({title:"Não foi possÃvel investigar",description:s?.message,variant:"destructive"})}),qe=S({mutationFn:()=>A("/api/modeling/arabic/opportunity",{focusArea:ma.trim()||void 0,gulfRegion:pa,nicheId:ve||void 0,subnicheId:ua||void 0}),onSuccess:s=>{if(R("/api/modeling/opportunities"),s?.proof&&s.proof.found===!1){us(null),a({title:"Nenhuma mina COMPROVADA agora ð",description:s?.proof?.reason||"A IA não achou um vÃdeo vencedor real para comprovar essa ideia. Tente outro subnicho ou outra região do Golfo."});return}s?.opportunity&&us(s.opportunity);const t=s?.opportunity?.status==="validated";a({title:"Mina de ouro encontrada ð¸ð¦",description:t?"Oportunidade validada em árabe, pronta para avançar para o Novo VÃdeo.":"Oportunidade árabe criada. Revise e clique em âSalvar em Oportunidades Validadasâ para confirmar."})},onError:s=>a({title:"Não foi possÃvel descobrir",description:s?.message,variant:"destructive"})}),bs=S({mutationFn:()=>A("/api/money/genesis",{sourceNiche:ds.trim(),targetNiche:os.trim(),targetLanguage:ts}),onSuccess:()=>{R("/api/modeling/opportunities"),ia(""),na(""),a({title:"Genesis concluÃda â¨",description:"Ideias de cross-polinização foram adicionadas como oportunidades."})},onError:s=>a({title:"Não foi possÃvel rodar a Genesis",description:s?.message,variant:"destructive"})}),Ee=S({mutationFn:()=>A("/api/modeling/analyze-url",{videoUrl:cs.trim()}),onSuccess:s=>{s?.analysis&&xs(s.analysis),a({title:"Mapeamento concluÃdo ð",description:`${s?.analysis?.markets?.length??0} mercados analisados.`})},onError:s=>a({title:"Não foi possÃvel analisar o vÃdeo",description:s?.message,variant:"destructive"})}),Oe=S({mutationFn:()=>A("/api/money/url-to-narrasync/analyze",{youtubeUrls:P,language:re,...J.trim()?{angleNotes:J.trim()}:{}}),onSuccess:s=>{ps(s),$e(s.winner?.title||""),R("/api/modeling/opportunities");const t=P.length>1?`${P.length} vÃdeos cruzados`:"VÃdeo analisado";a({title:"Oportunidade validada! ð¯",description:`${t} · Confira os tÃtulos e escolha o vencedor.`})},onError:s=>a({title:"Erro ao analisar os vÃdeos",description:s?.message,variant:"destructive"})}),Ne=S({mutationFn:s=>A(`/api/modeling/produced/${s}/release`),onSuccess:()=>{R("/api/modeling/produced","/api/modeling/opportunities"),a({title:"Liberado para gerar de novo â
",description:"A fonte ficou livre para uma nova geração. O vÃdeo já produzido continua salvo no estúdio e disponÃvel para download â nada foi apagado."})},onError:s=>a({title:"Não foi possÃvel liberar",description:s?.message,variant:"destructive"})}),F=S({mutationFn:({id:s,action:t})=>A(`/api/modeling/opportunities/${s}/${t}`),onSuccess:(s,t)=>{R("/api/modeling/opportunities"),us(d=>!d||d.id!==t.id?d:t.action==="discard"?null:t.action==="validate"?{...d,status:"val
3idated"}:d)},onError:s=>a({title:"Erro",description:s?.message,variant:"destructive"})}),ga=S({mutationFn:s=>A("/api/modeling/channels/propose",{opportunityId:s}),onSuccess:()=>{R("/api/modeling/channels"),n("modelados"),a({title:"Canal modelado proposto ð§",description:"Um blueprint estratégico foi criado em Canais Modelados."})},onError:s=>a({title:"Erro ao propor canal",description:s?.message,variant:"destructive"})}),ba=S({mutationFn:s=>A("/api/modeling/test-batches/create",{opportunityId:s}),onSuccess:()=>{R("/api/modeling/test-batches"),n("lotes"),a({title:"Lote de teste montado ð§ª",description:"10 ideias prontas para a Regra do Pulso."})},onError:s=>a({title:"Erro ao montar o lote",description:s?.message,variant:"destructive"})}),fe=S({mutationFn:({id:s,action:t})=>A(`/api/modeling/channels/${s}/${t}`),onSuccess:(s,t)=>{R("/api/modeling/channels"),t.action==="create-channel"&&a({title:s?.reused?"Canal já existia":"Canal real criado ð¬",description:"Você já pode gerar vÃdeos modelados neste canal."})},onError:s=>a({title:"Erro",description:s?.message,variant:"destructive"})}),ce=S({mutationFn:({id:s,decision:t})=>A(`/api/modeling/test-batches/${s}/pulse`,{decision:t}),onSuccess:()=>R("/api/modeling/test-batches"),onError:s=>a({title:"Erro no Pulso",description:s?.message,variant:"destructive"})}),js=S({mutationFn:()=>A("/api/money/performance-snapshots",{externalVideoId:I.externalVideoId.trim()||void 0,views:Number(I.views)||0,ctr:Number(I.ctr)||0,rpmCents:Number(I.rpmCents)||0,revenueCents:Number(I.revenueCents)||0}),onSuccess:()=>{R("/api/money/performance-snapshots"),oe({externalVideoId:"",views:"",ctr:"",rpmCents:"",revenueCents:""}),a({title:"Snapshot registrado ð",description:"A performance entrou no loop de aprendizado."})},onError:s=>a({title:"Não foi possÃvel registrar",description:s?.message,variant:"destructive"})}),[Nt,ft]=r.useState(!1),vs=S({mutationFn:()=>A("/api/money/performance-snapshots/sync",{}),onSuccess:s=>{R("/api/money/performance-snapshots");const t=Number(s?.synced??0),d=Number(s?.skipped??0);ft(!!s?.needsReconnect),s?.needsReconnect&&t===0?a({title:"Reconecte o YouTube",description:"Falta a permissão de Analytics para puxar a performance automaticamente."}):a({title:t>0?"Performance atualizada ð":"Nada novo para puxar",description:t>0?`${t} vÃdeo(s) sincronizado(s)${d?`, ${d} ignorado(s)`:""}.`:"Sem dados novos do YouTube ainda (delay de 48-72h é normal)."})},onError:s=>a({title:"Falha ao sincronizar",description:s?.message,variant:"destructive"})}),Fe=V({queryKey:["/api/modeling/niches/runs"],enabled:u&&c==="nichos",retry:!1,refetchInterval:s=>(s?.state?.data?.runs??[]).some(x=>x.status==="pending"||x.status==="researching")?3e3:!1}),w=V({queryKey:["/api/modeling/niches/runs",ca],enabled:!!ca,refetchInterval:s=>{const t=s?.state?.data?.run?.status;return t==="pending"||t==="researching"?2500:!1},retry:!1}).data?.run;r.useEffect(()=>{w&&(w.status==="completed"||w.status==="failed")&&(l.invalidateQueries({queryKey:["/api/modeling/niches/runs"]}),w.status==="completed"&&a({title:"Investigação concluÃda ð",description:`${w.results?.length??0} nichos descobertos.`}))},[w?.status,w,l,a]);const Ns=S({mutationFn:()=>A("/api/modeling/niches/investigate",{targetLanguage:la,contentType:da,focusArea:oa.trim()||void 0}),onSuccess:s=>{s?.run?.id&&xa(s.run.id),l.invalidateQueries({queryKey:["/api/modeling/niches/runs"]}),a({title:"Investigação iniciada ð",description:"A IA está pesquisando os melhores nichos dark na internetâ¦"})},onError:s=>a({title:"Não foi possÃvel iniciar",description:s?.message,variant:"destructive"})}),fs=S({mutationFn:()=>A("/api/money/patterns",{patternType:K.patternType,category:K.category,label:K.label.trim(),description:K.description.trim()||void 0}),onSuccess:()=>{R("/api/money/patterns"),Me({patternType:"winning",category:"title",label:"",description:""}),a({title:"Padrão salvo ð§ ",description:"Ele agora orienta as próximas modelagens."})},onError:s=>a({title:"Não foi possÃvel salvar o padrão",description:s?.message,variant:"destructive"})}),[Ve,ys]=r.useState(null),Ue=S({mutationFn:s=>A("/api/money/winner-expansion",{patternId:s.patternId}),onSuccess:(s,t)=>{const d=Array.isArray(s?.ideas)?s.ideas:[];ys({title:t.title,ideas:d}),d.length||a({title:"Sem ideias agora",description:"Tente novamente em instantes.",variant:"destructive"})},onError:s=>a({title:"Não foi possÃvel expandir",description:s?.message,variant:"destructive"})}),[L,ws]=r.useState(null),zs=S({mutationFn:s=>A("/api/money/thumbnail-lab",{opportunityId:s.opportunityId}),onSuccess:(s,t)=>{s?.plan&&(ws({title:t.title,plan:s.plan}),R("/api/modeling/opportunities"))},onError:s=>a({title:"Não foi possÃvel gerar o plano",description:s?.message,variant:"destructive"})}),Z=G.data?.opportunities||[],ks=s=>s.source==="arabic"&&s.metadata?.proofStatus==="missing",Cs=Z.filter(s=>s.status==="radar"&&!ks(s)),De=Z.filter(s=>(s.status==="validated"||s.status==="in_production")&&!ks(s)),ja=Z.filter(s=>s.source==="arabic"&&!ks(s)),Ss=Z.filter(s=>s.status==="discarded"),yt=r.useMemo(()=>{const s=new Map;for(const t of Z)t.status!=="in_production"||!t.externalVideoId||s.set(t.externalVideoId,(s.get(t.externalVideoId)||0)+1);return s},[Z]),As=r.useMemo(()=>{const s=new Map;for(const t of Z){if(t.status==="discarded")continue;const d=(t.externalChannelId||t.channelTitle||"").trim();if(!d)continue;const x=s.get(d)||{id:d,title:t.channelTitle||"Canal",niche:t.niche,subscriberCount:0,outliers:0,bestScore:0,sampleTitle:t.videoTitle,videoUrl:t.videoUrl};x.outliers+=1,x.subscriberCount=Math.max(x.subscriberCount,Number(t.subscriberCount||0)),x.bestScore=Math.max(x.bestScore,Number(t.opportunityScore||0)),s.set(d,x)}return Array.from(s.values()).sort((t,d)=>d.bestScore-t.bestScore)},[Z]);if(o.isLoading)return e.jsx(Ps,{children:e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:e.jsx(g,{className:"w-8 h-8 animate-spin text-cyan-400"})})});if(!u)return e.jsx(Ps,{children:e.jsxs("div",{className:"min-h-[60vh] flex flex-col items-center justify-center text-center px-6",children:[e.jsx(ke,{className:"w-12 h-12 text-zinc-700 mb-4"}),e.jsx("h1",{className:"text-xl font-semibold text-zinc-200","data-testid":"text-modeling-disabled",children:"Pesquisa de Modelagem indisponÃvel"}),e.jsx("p",{className:"text-zinc-500 mt-2 max-w-sm",children:"Esta camada estratég
3ica está em acesso restrito. Fale com a equipe Sábhia para ativá-la."})]})});const Ts=o.data.flags,wt=o.data.hasYoutubeKey;return e.jsxs(Ps,{children:[e.jsxs("div",{className:"max-w-6xl mx-auto px-4 md:px-8 py-6 md:py-10",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-1.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-br from-blue-500/20 to-cyan-400/15 border border-cyan-400/20 flex items-center justify-center",children:e.jsx(ke,{className:"w-5 h-5 text-cyan-300"})}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold bg-gradient-to-r from-cyan-100 via-sky-50 to-blue-200 bg-clip-text text-transparent","data-testid":"text-page-title",children:"Pesquisa de Modelagem"})]}),e.jsxs("p",{className:"text-zinc-400 text-sm max-w-2xl",children:["Encontre os ",e.jsx("span",{className:"text-cyan-200",children:"outliers que já provaram funcionar"}),", descubra o gap de idioma e modele canais de alta lucratividade â com auditoria de originalidade e qualidade editorial."]})]}),e.jsx("div",{className:"flex gap-1.5 overflow-x-auto pb-2 mb-6 -mx-1 px-1 scrollbar-none",children:[...Dt.filter(s=>s.id!=="produzidos"||T),...z?[{id:"arabe",label:"Mina de Ouro Ãrabe ð¸ð¦",icon:we}]:[],...j?[{id:"analytics",label:"Aprendizado",icon:Ls}]:[]].map(s=>{const t=c===s.id,d=s.id==="validadas"?De.length:s.id==="monitorados"?As.length:s.id==="modelados"?D.data?.proposals?.filter(x=>x.status!=="discarded").length??0:s.id==="descartados"?Ss.length:s.id==="radar"?Cs.length:s.id==="produzidos"?W.length:void 0;return e.jsxs("button",{onClick:()=>n(s.id),className:p("shrink-0 inline-flex items-center gap-2 rounded-xl px-3.5 py-2 text-sm font-medium transition border",t?"bg-cyan-500/10 text-cyan-100 border-cyan-400/30 shadow-[0_0_15px_-5px_rgba(34,211,238,0.4)]":"text-zinc-400 hover:text-white border-white/5 hover:border-white/10 hover:bg-white/5"),"data-testid":`tab-${s.id}`,children:[e.jsx(s.icon,{className:p("w-4 h-4",t?"text-cyan-300":"text-zinc-500")}),s.label,d!=null&&d>0&&e.jsx("span",{className:p("ml-0.5 rounded-full px-1.5 text-[10px] tabular-nums",t?"bg-cyan-400/20 text-cyan-100":"bg-white/10 text-zinc-400"),children:d})]},s.id)})}),c==="radar"&&e.jsxs("div",{className:"space-y-6",children:[!wt&&e.jsxs("div",{className:"rounded-xl border border-amber-400/25 bg-amber-500/[0.07] px-4 py-3 flex items-start gap-3","data-testid":"banner-no-youtube-key",children:[e.jsx(Mt,{className:"w-5 h-5 text-amber-300 shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-amber-100/90",children:[e.jsx("strong",{className:"font-semibold",children:"Chave do YouTube Data API ausente."})," O Radar precisa dela para achar outliers reais. Configure ",e.jsx("code",{className:"text-amber-200",children:"YOUTUBE_DATA_API_KEY"})," para resultados completos."]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:k,"data-testid":"card-radar-run",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Se,{className:"w-4 h-4 text-cyan-300"}),e.jsx("h2",{className:"font-semibold text-white",children:"Money Modeling â rodar Radar"})]}),e.jsx("p",{className:"text-xs text-zinc-500 mb-4",children:"Busca vÃdeos campeões (alta razão views/inscritos) num nicho, audita e enriquece com a estratégia vencedora."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{className:h,placeholder:"Nicho (ex.: histórias de guerra, finanças pessoais)",value:as,onChange:s=>Ks(s.target.value),"data-testid":"input-radar-niche"}),e.jsx("input",{className:h,placeholder:"Buscas especÃficas (opcional, separadas por vÃrgula)",value:Re,onChange:s=>Ha(s.target.value),"data-testid":"input-radar-queries"}),m&&e.jsxs("div",{className:"grid grid-cols-2 gap-2","data-testid":"toggle-radar-format",children:[e.jsxs("button",{type:"button",onClick:()=>Ws("video"),className:p("flex items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors",Pe==="video"?"border-cyan-400/40 bg-cyan-500/10 text-cyan-200":"border-white/10 bg-white/[0.03] text-zinc-400 hover:text-zinc-200"),"data-testid":"button-radar-format-video",children:[e.jsx(te,{className:"w-3.5 h-3.5"})," VÃdeo longo"]}),e.jsxs("button",{type:"button",onClick:()=>Ws("reels"),className:p("flex items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs font-medium transition-colors",Pe==="reels"?"border-cyan-400/40 bg-cyan-500/10 text-cyan-200":"border-white/10 bg-white/[0.03] text-zinc-400 hover:text-zinc-200"),title:"Garimpar Shorts/Reels virais (9:16, curtos e recentes) em vez de vÃdeos longos","data-testid":"button-radar-format-reels",children:[e.jsx(We,{className:"w-3.5 h-3.5"})," Reels (9:16)"]})]}),m&&Pe==="reels"&&e.jsx("p",{className:"text-[10px] text-cyan-300/60 leading-relaxed","data-testid":"text-radar-reels-hint",children:"Modo Reels: o Radar busca
3Shorts virais curtos e recentes, e a estratégia sai pronta para vÃdeo vertical 9:16 com gancho nos primeiros segundos."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("select",{className:h,value:Ys,onChange:s=>Ja(s.target.value),"data-testid":"select-radar-source-lang",children:[e.jsx("option",{value:"en",children:"Origem: Inglês"}),e.jsx("option",{value:"es",children:"Origem: Espanhol"}),e.jsx("option",{value:"pt",children:"Origem: Português"}),e.jsx("option",{value:"fr",children:"Origem: Francês"}),e.jsx("option",{value:"de",children:"Origem: Alemão"}),e.jsx("option",{value:"it",children:"Origem: Italiano"}),e.jsx("option",{value:"ja",children:"Origem: Japonês"}),e.jsx("option",{value:"ar",children:"Origem: Ãrabe"})]}),e.jsxs("select",{className:h,value:ts,onChange:s=>Wa(s.target.value),"data-testid":"select-radar-target-lang",children:[e.jsx("option",{value:"pt",children:"Alvo: Português"}),e.jsx("option",{value:"es",children:"Alvo: Espanhol"}),e.jsx("option",{value:"en",children:"Alvo: Inglês"}),e.jsx("option",{value:"fr",children:"Alvo: Francês"}),e.jsx("option",{value:"ar",children:"Alvo: Ãrabe"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("select",{className:h,value:Hs,onChange:s=>Za(s.target.value),"data-testid":"select-radar-window",children:[e.jsx("option",{value:"30",children:"Ãltimos 30 dias"}),e.jsx("option",{value:"90",children:"Ãltimos 90 dias"}),e.jsx("option",{value:"180",children:"Ãltimos 6 meses"}),e.jsx("option",{value:"365",children:"Ãltimo ano"})]}),e.jsxs("select",{className:h,value:Qs,onChange:s=>Xa(s.target.value),"data-testid":"select-radar-region",children:[e.jsx("option",{value:"",children:"Região: qualquer"}),e.jsx("option",{value:"US",children:"EUA (US)"}),e.jsx("option",{value:"BR",children:"Brasil (BR)"}),e.jsx("option",{value:"GB",children:"Reino Unido (GB)"}),e.jsx("option",{value:"ES",children:"Espanha (ES)"}),e.jsx("option",{value:"MX",children:"México (MX)"}),e.jsx("option",{value:"PT",children:"Portugal (PT)"})]})]}),e.jsx("button",{type:"button",className:"text-[11px] text-cyan-300/80 hover:text-cyan-200 underline underline-offset-2",onClick:()=>nt(s=>!s),"data-testid":"button-radar-advanced-toggle",children:ea?"Ocultar filtros avançados":"Filtros avançados"}),ea&&e.jsxs("div",{className:"space-y-3 rounded-lg border border-cyan-500/10 bg-cyan-500/[0.03] p-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("select",{className:h,value:is,onChange:s=>et(s.target.value),"data-testid":"select-radar-duration",children:[e.jsx("option",{value:"any",children:"Duração: qualquer"}),e.jsx("option",{value:"short",children:"Curtos (< 4 min)"}),e.jsx("option",{value:"medium",children:"Médios (4â20 min)"}),e.jsx("option",{value:"long",children:"Longos (> 20 min)"})]}),e.jsx("div",{children:e.jsx("input",{type:"number",min:0,max:100,className:h,placeholder:"Score mÃn. (0â100)",value:ns,onChange:s=>st(s.target.value),"data-testid":"input-radar-min-score"})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("select",{className:h,value:Js,onChange:s=>at(s.target.value),"data-testid":"select-radar-content-type",children:[e.jsx("option",{value:"",children:"Tipo: qualquer"}),e.jsx("option",{value:"documentary",children:"Documentário"}),e.jsx("option",{value:"story",children:"História/Ficção"}),e.jsx("option",{value:"educational",children:"Educacional"}),e.jsx("option",{value:"listicle",children:"Lista/Top N"})]}),e.jsxs("select",{className:h,value:Xs,onChange:s=>tt(s.target.value),"data-testid":"select-radar-production",children:[e.jsx("option",{value:"",children:"Produção: qualquer"}),e.jsx("option",{value:"faceless",children:"Faceless"}),e.jsx("option",{value:"narration",children:"Narração"}),e.jsx("option",{value:"slideshow",children:"Slideshow"})]}),e.jsxs("select",{className:h,value:Zs,onChange:s=>it(s.target.value),"data-testid":"select-radar-risk",children:[e.jsx("option",{value:"",children:"Risco: qualquer"}),e.jsx("option",{value:"low",children:"Baixo (seguro)"}),e.jsx("option",{value:"medium",children:"Médio"}),e.jsx("option",{value:"high",children:"Alto (ousado)"})]})]}),e.jsx("p",{className:"text-[10px] text-zinc-500 leading-relaxed",children:"Duração e score mÃnimo afetam a busca de verdade. Tipo, produção e risco orientam o autor e ficam salvos no histórico do run."})]}),e.jsxs("button",{className:q+" w-full",disabled:hs.isPending||!as.trim()&&!Re.trim(),onClick:()=>hs.mutate(),"data-testid":"button-run-radar",children:[hs.isPending?e.jsx(g,{className:"w-4 h-4 animate-spin"}):e.jsx(ke,{className:"w-4 h-4"}),"Rodar Radar"]}),f.isFetched&&O>0&&e.jsxs("p",{className:"text-center text-[10px] text-zinc-500","data-testid":"text-runs-today",children:[O," ",O===1?"execução":"execuções"," nas últimas 24h"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:k,"data-testid":"card-investigate",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(He,{className:"w-4 h-4 text-cyan-300"}),e.jsx("h2",{className:"font-semibold text-white",children:"Investigar um tema agora"})]}),e.jsx("p",{className:"text-xs text-zinc-500 mb-3",children:"A IA pesquisa o tema no mercado de origem, encontra o ângulo vencedor e cria a estratég
3ia no idioma de publicação â vira uma oportunidade na hora."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{className:h,placeholder:"Tema (ex.: animais que mudaram a história)",value:rs,onChange:s=>sa(s.target.value),"data-testid":"input-investigate-theme"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("select",{className:h,value:aa,onChange:s=>rt(s.target.value),"data-testid":"select-investigate-source-lang",children:[e.jsx("option",{value:"en",children:"Pesquisar em: Inglês"}),e.jsx("option",{value:"es",children:"Pesquisar em: Espanhol"}),e.jsx("option",{value:"pt",children:"Pesquisar em: Português"}),e.jsx("option",{value:"fr",children:"Pesquisar em: Francês"}),e.jsx("option",{value:"de",children:"Pesquisar em: Alemão"}),e.jsx("option",{value:"it",children:"Pesquisar em: Italiano"}),e.jsx("option",{value:"ja",children:"Pesquisar em: Japonês"}),e.jsx("option",{value:"ar",children:"Pesquisar em: Ãrabe"})]}),e.jsxs("select",{className:h,value:ta,onChange:s=>lt(s.target.value),"data-testid":"select-investigate-target-lang",children:[e.jsx("option",{value:"pt",children:"Postar em: Português"}),e.jsx("option",{value:"es",children:"Postar em: Espanhol"}),e.jsx("option",{value:"en",children:"Postar em: Inglês"}),e.jsx("option",{value:"fr",children:"Postar em: Francês"}),e.jsx("option",{value:"de",children:"Postar em: Alemão"}),e.jsx("option",{value:"it",children:"Postar em: Italiano"}),e.jsx("option",{value:"ar",children:"Postar em: Ãrabe"})]})]}),m&&e.jsxs("button",{type:"button",onClick:()=>dt(s=>!s),className:p("flex items-center justify-center gap-1.5 w-full rounded-lg border px-3 py-2 text-xs font-medium transition-colors",ls?"border-cyan-400/40 bg-cyan-500/10 text-cyan-200":"border-white/10 bg-white/[0.03] text-zinc-400 hover:text-zinc-200"),title:"Investigar o tema como Reels/Shorts (vertical 9:16, gancho nos primeiros segundos)","data-testid":"button-investigate-format-reels",children:[e.jsx(We,{className:"w-3.5 h-3.5"}),ls?"Formato: Reels (9:16) â":"Investigar como Reels (9:16)"]}),e.jsx("p",{className:"text-[10px] text-zinc-600 leading-relaxed",children:"A IA pesquisa tendências no mercado de origem e gera o tÃtulo e estratégia no idioma de publicação."}),e.jsxs("button",{className:b+" w-full py-2.5",disabled:gs.isPending||!rs.trim(),onClick:()=>gs.mutate(),"data-testid":"button-investigate",children:[gs.isPending?e.jsx(g,{className:"w-4 h-4 animate-spin"}):e.jsx($s,{className:"w-4 h-4"}),"Investigar tema"]})]})]}),Ts.moneyGenesis&&e.jsxs("div",{className:k,"data-testid":"card-genesis",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(se,{className:"w-4 h-4 text-cyan-300"}),e.jsx("h2",{className:"font-semibold text-white",children:"Money Genesis â cross-polinização"})]}),e.jsx("p",{className:"text-xs text-zinc-500 mb-4",children:"Pega uma fórmula provada num nicho e a transplanta, com inovação, para outro."}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[e.jsx("input",{className:h,placeholder:"Nicho de origem",value:ds,onChange:s=>ia(s.target.value),"data-testid":"input-genesis-source"}),e.jsx("input",{className:h,placeholder:"Nicho-alvo",value:os,onChange:s=>na(s.target.value),"data-testid":"input-genesis-target"})]}),e.jsxs("button",{className:b+" w-full py-2.5",disabled:bs.isPending||!ds.trim()||!os.trim(),onClick:()=>bs.mutate(),"data-testid":"button-genesis",children:[bs.isPending?e.jsx(g,{className:"w-4 h-4 animate-spin"}):e.jsx(Fs,{className:"w-4 h-4"}),"Gerar inovações"]})]}),e.jsxs("div",{className:"rounded-2xl border border-violet-500/30 bg-gradient-to-b from-violet-500/[0.07] to-transparent p-4 md:p-5","data-testid":"card-url-to-opp",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ce,{className:"w-4 h-4 text-violet-300"}),e.jsx("h2",{className:"font-semibold text-white",children:"Validar via URL â Oportunidade Direta"}),e.jsx("span",{className:"ml-auto rounded-full bg-violet-500/20 text-violet-300 text-[9px] font-bold px-1.5 py-0.5 border border-violet-400/20",children:"NOVO"})]}),e.jsx("p",{className:"text-xs text-zinc-500 mb-3",children:"Cole 1 a 4 URLs de vÃdeos virais sobre o mesmo tema. A IA cruza os padrões, pesquisa na internet e gera 5 tÃtulos originais pontuados â salvos como oportunidade validada. Sem passar pelo Radar."}),C?e.jsxs("div",{className:"space-y-3",children:[(C.originalVideos?.length??1)>1?e.jsxs("div",{className:"rounded-xl border border-violet-500/20 bg-violet-500/[0.05] p-3",children:[e.jsxs("p",{className:"text-[9px] text-violet-300 font-semibold uppercase tracking-wide mb-2",children:["âï¸ Frankenstein Viral â ",C.originalVideos.length," vÃdeos cruzados"]}),e.jsx("div",{className:"flex flex-col gap-1.5",children:C.originalVideos.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2",children:[s.thumbnailUrl&&e.jsx("img",{src:s.thumbnailUrl,alt:"thumb",className:"w-12 h-7 rounded object-cover shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[10px] font-medium text-white leading-tight truncate",children:s.title}),e.jsxs("p",{className:"text-[9px] text-zinc-500",children:[s.channelTitle," · ",(s.viewCount||0).toLocaleStr
3ing("pt-BR")," views"]})]}),t===0&&e.jsx("span",{className:"shrink-0 text-[8px] font-bold bg-violet-500/20 text-violet-300 rounded-full px-1.5 py-0.5",children:"PRIMÃRIO"})]},s.videoId))}),J.trim()&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-violet-500/10 flex items-center gap-1",children:[e.jsx(me,{className:"h-3 w-3 text-cyan-400 shrink-0"}),e.jsxs("p",{className:"text-[9px] text-cyan-300 truncate",children:["Ãngulo: ",J.slice(0,70),J.length>70?"â¦":""]})]})]}):e.jsxs("div",{className:"rounded-xl border border-white/8 bg-black/20 p-3 flex gap-3 items-start",children:[C.originalVideo.thumbnailUrl&&e.jsx("img",{src:C.originalVideo.thumbnailUrl,alt:"Thumbnail",className:"w-20 h-12 rounded-lg object-cover shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[10px] text-zinc-500 uppercase tracking-wide font-semibold mb-0.5",children:"VÃdeo analisado"}),e.jsx("p",{className:"text-xs font-medium text-white leading-tight line-clamp-2",children:C.originalVideo.title}),e.jsxs("p",{className:"text-[10px] text-zinc-400 mt-0.5",children:[C.originalVideo.channelTitle," · ",(C.originalVideo.viewCount||0).toLocaleString("pt-BR")," views",C.originalVideo.outlierScore>0&&e.jsxs("span",{className:"ml-1 text-amber-300",children:["· Outlier ",C.originalVideo.outlierScore]})]}),C.enrichment.titleFormula&&e.jsxs("p",{className:"text-[10px] text-violet-300 mt-0.5",children:["Fórmula: ",C.enrichment.titleFormula]}),J.trim()&&e.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[e.jsx(me,{className:"h-3 w-3 text-cyan-400 shrink-0"}),e.jsxs("p",{className:"text-[9px] text-cyan-300 truncate",children:["Ãngulo: ",J.slice(0,55),J.length>55?"â¦":""]})]})]}),e.jsx("div",{className:"flex flex-col items-end gap-1 shrink-0",children:e.jsxs("a",{href:C.originalVideo.videoUrl,target:"_blank",rel:"noopener noreferrer",className:b+" !py-1 !px-2 text-[10px]",children:[e.jsx(ie,{className:"w-3 h-3"})," Ver"]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{className:"text-[10px] text-zinc-600 hover:text-zinc-400 transition flex items-center gap-1",onClick:()=>{ps(null),be(""),je([]),ms(""),$e("")},"data-testid":"button-url-opp-reset",children:[e.jsx(Ke,{className:"h-3 w-3"})," Nova análise"]})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] text-zinc-400 font-semibold uppercase tracking-wide mb-1.5 flex items-center gap-1.5",children:[e.jsx(se,{className:"w-3 h-3 text-violet-300"})," Nossa versão em ",re==="pt"?"Português":re==="es"?"Espanhol":re==="en"?"Inglês":re==="fr"?"Francês":re," â escolha o tÃtulo"]}),e.jsx("div",{className:"space-y-1.5",children:C.titleCandidates.map((s,t)=>{const d=s.title===C.winner.title,x=xt===s.title,i=s.score>=85?"alto":s.score>=70?"médio":"baixo";return e.jsx("button",{type:"button",onClick:()=>$e(s.title),"data-testid":`button-url-opp-title-${t}`,className:`w-full text-left rounded-xl border px-3 py-2 transition ${x?"border-violet-400/50 bg-violet-500/[0.08] ring-1 ring-violet-500/20":"border-white/8 bg-black/20 hover:border-violet-400/25"}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[x&&e.jsx(qs,{className:"h-3 w-3 text-violet-300 shrink-0"}),d&&!x&&e.jsx("span",{className:"text-[8px] font-bold text-amber-300 bg-amber-500/15 rounded-full px-1.5 py-0.5 shrink-0",children:"⨠TOP"}),e.jsx("p",{className:"text-xs font-medium text-white leading-snug",children:s.title})]}),s.formula&&e.jsx("p",{className:"text-[9px] text-zinc-500",children:s.formula})]}),e.jsxs("span",{className:`shrink-0 rounded-full text-[9px] font-bold px-1.5 py-0.5 ${i==="alto"?"bg-emerald-500/15 text-emerald-300":i==="médio"?"bg-amber-500/15 text-amber-300":"bg-zinc-700/60 text-zinc-400"}`,children:[s.score,"/100"]})]})},t)})})]}),C.enrichment.emotionalEngine&&e.jsxs("div",{className:"rounded-lg border border-violet-500/10 bg-violet-500/[0.04] px-2.5 py-1.5",children:[e.jsx("p",{className:"text-[9px] text-violet-400 font-semibold uppercase tracking-wide mb-0.5",children:"Motor emocional"}),e.jsx("p",{className:"text-[10px] text-zinc-400",children:C.enrichment.emotionalEngine})]}),e.jsxs("div",{className:"flex gap-2 pt-0.5",children:[e.jsxs("button",{className:q+" flex-1 !py-2 text-xs",onClick:()=>n("validadas"),"data-testid":"button-url-opp-goto-validadas",children:[e.jsx(ne,{className:"w-3.5 h-3.5"})," Ver em Oportunidades Validadas"]}),e.jsxs("button",{className:b+" !py-2 text-xs",onClick:()=>{ps(null),be(""),je([]),ms(""),$e("")},"data-testid":"button-url-opp-new",children:[e.jsx(Ke,{className:"w-3 h-3"})," Nova"]})]})]}):e.jsxs("div",{className:"space-y-2.5",children:[P.length>0&&e.jsx("div",{className:"flex flex-col gap-1.5",children:P.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-violet-400/20 bg-black/20 px-3 py-1.5",children:[e.jsx(Ce,{className:"h-3 w-3 text-violet-400 shrink-0"}),e.jsx("span",{className:"flex-1 text-[11px] text-zinc-300 truncate",children:s}),e.jsx("button",{type:"button",onClick:()=>je(d=>d.filter((x,i)=>i!==t)),className:"shrink-0 text-zinc-600 hover:text-zinc-300 transition","data-testid":`button-remove-url-opp-${t}`,children:e.jsx(Vs,{className:"h-3 w-3"})})]},t))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-zinc-500 mb-1 block flex items-center gap-1",children:["URL do vÃdeo viral",e.jsxs("span",{className:"ml-auto text-zinc-600",children:[P.length,"/4"]})]}),P.length<4?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{className:h+" border-violet-500/20 focus:border-violet-400/40 focu
3s:ring-violet-400/20 flex-1",placeholder:"https://youtube.com/watch?v=...",value:de,onChange:s=>be(s.target.value),onKeyDown:s=>{s.key==="Enter"&&de.trim()&&(je(t=>[...t,de.trim()].slice(0,4)),be(""))},"data-testid":"input-url-opp"}),e.jsx("button",{type:"button",disabled:!de.trim(),onClick:()=>{de.trim()&&(je(s=>[...s,de.trim()].slice(0,4)),be(""))},className:"rounded-lg px-2 py-1 bg-violet-800/60 hover:bg-violet-700/60 disabled:opacity-40 text-white transition shrink-0","data-testid":"button-add-url-opp",title:"Adicionar URL",children:e.jsx(Ge,{className:"h-3.5 w-3.5"})})]}):e.jsx("p",{className:"text-[10px] text-violet-400 py-2",children:"Máximo de 4 URLs atingido"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] text-zinc-500 mb-1 block",children:"Publicar em (idioma)"}),e.jsxs("select",{className:h+" border-violet-500/20 focus:border-violet-400/40",value:re,onChange:s=>ct(s.target.value),"data-testid":"select-url-opp-lang",children:[e.jsx("option",{value:"pt",children:"ð§ð· Português"}),e.jsx("option",{value:"es",children:"ðªð¸ Espanhol"}),e.jsx("option",{value:"en",children:"ðºð¸ Inglês"}),e.jsx("option",{value:"fr",children:"ð«ð· Francês"}),e.jsx("option",{value:"de",children:"ð©ðª Alemão"}),e.jsx("option",{value:"it",children:"ð®ð¹ Italiano"}),e.jsx("option",{value:"ja",children:"ð¯ðµ Japonês"}),e.jsx("option",{value:"ko",children:"ð°ð· Coreano"}),e.jsx("option",{value:"zh",children:"ð¨ð³ Mandarim"}),e.jsx("option",{value:"hi",children:"ð®ð³ Hindi"}),e.jsx("option",{value:"ar",children:"ð¸ð¦ Ãrabe"})]})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] text-zinc-500 mb-1 block flex items-center gap-1",children:[e.jsx(me,{className:"h-3 w-3 text-violet-400"})," Ãngulo Viral ",e.jsx("span",{className:"text-zinc-600",children:"(opcional)"})]}),e.jsx("textarea",{className:h+" border-violet-500/20 focus:border-violet-400/40 resize-none text-[11px]",placeholder:"Ex: focar no lado sombrio, ângulo de traição e segredos, usar o mesmo gancho retórico do vÃdeo viral...",rows:2,maxLength:2e3,value:J,onChange:s=>ms(s.target.value),"data-testid":"textarea-url-opp-angle"})]}),e.jsx("button",{className:"inline-flex items-center justify-center gap-2 w-full rounded-xl bg-gradient-to-r from-violet-600 to-purple-500 px-4 py-2.5 text-sm font-semibold text-white shadow-lg shadow-violet-900/30 hover:opacity-95 transition disabled:opacity-50 disabled:cursor-not-allowed",disabled:Oe.isPending||P.length===0,onClick:()=>Oe.mutate(),"data-testid":"button-url-opp-analyze",children:Oe.isPending?e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"w-4 h-4 animate-spin"})," ",P.length>1?`Cruzando ${P.length} vÃdeosâ¦`:"Pesquisando e gerando tÃtulosâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"w-4 h-4"})," ",P.length>1?`Analisar ${P.length} vÃdeos virais`:"Analisar e Validar Oportunidade"]})}),Oe.isPending&&e.jsxs("div",{className:"rounded-xl border border-violet-500/20 bg-violet-500/[0.05] px-3 py-2.5",children:[e.jsx("p",{className:"text-xs text-violet-300 font-semibold",children:P.length>1?"Cruzando padrõesâ¦":"Investigandoâ¦"}),e.jsx("p",{className:"text-[10px] text-zinc-500 mt-0.5",children:P.length>1?`Analisa ${P.length} vÃdeos â cruza padrões â pesquisa na internet â gera tÃtulos â salva oportunidade. Pode levar 30â90s.`:"Busca stats â pesquisa grounded na internet â gera 5 tÃtulos pontuados â salva oportunidade. Pode levar 30â60s."})]})]})]}),e.jsxs("div",{className:k,"data-testid":"card-analyze-url",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(we,{className:"w-4 h-4 text-cyan-300"}),e.jsx("h2",{className:"font-semibold text-white",children:"Analisar URL â Mapear Mercados"})]}),e.jsx("p",{className:"text-xs text-zinc-500 mb-3",children:"Cole a URL de qualquer vÃdeo incrÃvel do YouTube e descubra em quais idiomas/paÃses ainda não existe uma versão local do conteúdo â e onde você deve publicar primeiro."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{className:h,placeholder:"https://youtube.com/watch?v=...",value:cs,onChange:s=>{ot(s.target.value),xs(null)},"data-testid":"input-analyze-video-url"}),e.jsx("button",{className:b+" w-full py-2.5",disabled:Ee.isPending||!cs.trim(),onClick:()=>Ee.mutate(),"data-testid":"button-analyze-url",children:Ee.isPending?e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"w-4 h-4 animate-spin"})," Pesquisando nos 15 mercadosâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ba,{className:"w-4 h-4"})," Mapear Mercados Globais"]})}),Ee.isPending&&e.jsx("p",{className:"text-[10px] text-zinc-600 text-center leading-relaxed",children:"A IA pesquisa ativamente no YouTube de cada paÃs â isso leva ~60s."})]})]})]})]}),ra&&e.jsx(Ht,{analysis:ra,onClose:()=>xs(null),onCreateVideo:s=>{window.location.href=`/videos/novo?lang=${s}`}}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-zinc-300 mb-3 flex items-center gap-2",children:[e.jsx(ke,{className:"w-4 h-4 text-cyan-400/70"})," Execuções recentes",y&&e.jsx(g,{className:"w-3.5 h-3.5 animate-spin text-cyan-400"})]}),f.isLoading?e.jsx("div",{className:"py-8 flex justify-center",children:e.jsx(g,{className:"w-5 h-5 animate-spin text-cyan-400"})}):(f.data?.runs?.length??0)===0?e.jsx("div",{className:k,children:e.jsx("p",{className:"text-sm text-zinc-500",children:"Nenhuma execução ainda. Rode o Radar acima para começar."})}):e.jsx("div",{className:"space-y-2",children:f.data.runs.slice(0,8).map(s=>e.jsxs("div",{className:"rounded-xl border border-white/10 bg-white/[0.025] px-4 py-3 flex items-center justify-between gap-3","data-testid":`run-${s.id}`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{label:It[s.status]||s.status,tone:s.status==="completed"?"good":s.status==="failed"?"bad":"warn"}),e.jsx("span",{className:"text-xs text-zinc-500",children:ze(s.createdAt||s.startedAt)})]}),s.error&&e.jsx("p",{className:"text-xs text-red-300/80 mt-1 truncate",children:s.error})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-zinc-400 shrink-0",children:[e.jsxs("span",{title:"VÃdeos escaneados",children:[E(s.resultsScanned)," ",e.jsx("span",{className:"text-zinc-600",children:"scan"})]}),e.jsxs("span",{title:"Oportunidades criadas",className:"text-cyan-200",children:[E(s.opportunitiesCreated)," ",e.jsx("span",{className:"text-cyan-500/60",children:"oport."})]})]})]},s.id))})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-zinc-300 mb-3 flex items-center gap-2",children:[e.jsx(Ms,{className:"w-4 h-4 text-cyan-400/70"})," Oportunidades descobertas"]}),Cs.length===0?e.jsx(Y,{icon:Ms,title:"Nenhuma oportunidade nova",hint:"Rode o Radar ou investigue um tema para descobrir outliers prontos para modelar."}):e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:Cs.map(s=>e.jsx(qa,{o:s,produced:Ds(s),onValidate:()=>F.mutate({id:s.id,action:"validate"}),onDiscard:()=>F.mutate({id:s.id,action:"discard"}),busy:F.isPending},s.id))})]})]}),c==="validadas"&&e.jsx("div",{children:G.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}):De.length===0?e.jsx(Y,{icon:ne,title:"Nenhuma oportunidade validada",hint:"Valide oportunidades no Radar para construir seu funil de produção modelada."}):e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:De.map(s=>e.jsx(qa,{o:s,validated:!0,produced:Ds(s),moneyStyleEnabled:Ts.moneyStyle,siblingsInProduction:s.externalVideoId&&yt.get(s.externalVideoId)||0,onPropose:()=>ga.mutate(s.id),onCreateBatch:()=>ba.mutate(s.id),onDiscard:()=>F.mutate({id:s.id,action:"discard"}),onThumbnailLab:()=>zs.mutate({opportunityId:s.id,title:s.suggestedTitle||s.videoTitle||s.niche||"Oportunidade"}),thumbBusy:zs.isPending&&zs.variables?.opportunityId===s.id,busy:F.isPending||ga.isPending||ba.isPending},s.id))})}),c==="arabe"&&z&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:p(k,"relative overflow-hidden border-amber-400/15"),children:[e.jsx("div",{className:"absolute -top-16 -right-10 w-56 h-56 rounded-full bg-amber-500/10 blur-3xl pointer-events-none"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[e.jsx("span",{className:"text-2xl",children:"ð¸ð¦"}),e.jsx("h2",{className:"text-lg font-semibold text-white",children:"Mina de Ouro Ãrabe"}),e.jsx("span",{className:"rounded-md bg-amber-500/10 border border-amber-400/25 px-1.5 py-0.5 text-[10px] text-amber-300",children:"quase 1 clique"})]}),e.jsxs("p",{className:"text-sm text-zinc-400 leading-relaxed max-w-2xl",children:["A IA investiga o que a audiência árabe afluente do Golfo consome em massa, encontra o que ainda falta em árabe e ",e.jsx("span",{className:"text-cyan-200",children:"modela um viral comprovado do Ocidente"})," â entregando uma oportunidade ",e.jsx("span",{className:"text-cyan-200",children:"val
3idada em árabe"})," pronta para avançar para o Novo VÃdeo, já pré-preenchida. Nada é publicado automaticamente."]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 mt-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1.5",children:"Nicho dark (opcional)"}),e.jsxs("select",{className:h,value:ve,onChange:s=>{vt(s.target.value),ha("")},"data-testid":"select-arabic-niche",children:[e.jsx("option",{value:"",children:"⨠A IA escolhe por mim (automático)"}),Ra.map(s=>e.jsxs("option",{value:s.id,children:[s.emoji," ",s.label]},s.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1.5",children:"Subnicho"}),e.jsx("select",{className:h,value:ua,onChange:s=>ha(s.target.value),disabled:!ve,"data-testid":"select-arabic-subniche",children:ve?e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"",children:"ð¯ Automático (1º do nicho)"}),(Ra.find(s=>s.id===ve)?.subniches||[]).map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]}):e.jsx("option",{value:"",children:"Escolha um nicho primeiro"})})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 mt-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1.5",children:"Foco (opcional)"}),e.jsx("input",{className:h,value:ma,onChange:s=>bt(s.target.value),placeholder:"Ex.: riqueza & negócios, mistérios, históriaâ¦",maxLength:300,"data-testid":"input-arabic-focus"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-zinc-400 mb-1.5",children:"Região do Golfo"}),e.jsxs("select",{className:h,value:pa,onChange:s=>jt(s.target.value),"data-testid":"select-arabic-region",children:[e.jsx("option",{value:"SA",children:"ð¸ð¦ Arábia Saudita"}),e.jsx("option",{value:"AE",children:"ð¦ðª Emirados Ãrabes"}),e.jsx("option",{value:"QA",children:"ð¶ð¦ Catar"}),e.jsx("option",{value:"KW",children:"ð°ð¼ Kuwait"}),e.jsx("option",{value:"GCC",children:"ð Golfo (geral)"})]})]})]}),e.jsxs("button",{className:p(q,"mt-4"),onClick:()=>qe.mutate(),disabled:qe.isPending,"data-testid":"button-discover-arabic",children:[qe.isPending?e.jsx(g,{className:"w-4 h-4 animate-spin"}):e.jsx(se,{className:"w-4 h-4"}),qe.isPending?"Investigando o mercado árabeâ¦":"Descobrir oportunidade árabe agora"]})]})]}),Le&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-zinc-300 mb-3 flex items-center gap-2",children:[e.jsx(Es,{className:"w-4 h-4 text-amber-300"})," Pronta para avançar"]}),e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:e.jsx(La,{o:Le,busy:F.isPending,onValidate:()=>F.mutate({id:Le.id,action:"validate"}),onDiscard:()=>F.mutate({id:Le.id,action:"discard"})})})]}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-zinc-300 mb-3 flex items-center gap-2",children:[e.jsx(we,{className:"w-4 h-4 text-cyan-400/70"})," Suas oportunidades árabes"]}),G.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}):ja.length===0?e.jsx(Y,{icon:we,title:"Nenhuma oportunidade árabe ainda",hint:"Clique em âDescobrir oportunidade árabe agoraâ para a IA achar a próxima mina de ouro."}):e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:ja.map(s=>e.jsx(La,{o:s,busy:F.isPending,onValidate:()=>F.mutate({id:s.id,action:"validate"}),onDiscard:()=>F.mutate({id:s.id,action:"discard"})},s.id))})]})]}),c==="monitorados"&&e.jsx("div",{children:G.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}):As.length===0?e.jsx(Y,{icon:Te,title:"Nenhum canal monitorado ainda",hint:"Os canais-fonte dos outliers que o Radar descobrir aparecem aqui automaticamente."}):e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:As.map(s=>e.jsxs("div",{className:k,"data-testid":`monitored-${s.id}`,children:[e.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[e.jsx(te,{className:"w-4 h-4 text-cyan-300 mt-0.5 shrink-0"}),e.jsx("h3",{className:"font-semibold text-white text-sm leading-snug",children:s.title})]}),s.niche&&e.jsx("p",{className:"text-[11px] text-cyan-300/70 mb
3-2",children:s.niche}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-zinc-400 mb-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-zinc-500"}),E(s.subscriberCount)]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Ms,{className:"w-3.5 h-3.5 text-zinc-500"}),s.outliers," outlier",s.outliers>1?"s":""]})]}),s.sampleTitle&&e.jsxs("p",{className:"text-[11px] text-zinc-500 line-clamp-2",children:['"',s.sampleTitle,'"']}),e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsx(U,{score:s.bestScore,label:"Op",gateKey:"opportunity"}),s.videoUrl&&e.jsxs("a",{href:s.videoUrl,target:"_blank",rel:"noopener noreferrer",className:b,"data-testid":`link-monitored-video-${s.id}`,children:[e.jsx(ie,{className:"w-3.5 h-3.5"})," Ver"]})]})]},s.id))})}),c==="clusters"&&e.jsx("div",{children:H.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}):(H.data?.clusters?.length??0)===0?e.jsx(Y,{icon:Da,title:"Sem clusters ainda",hint:"Conforme você acumula oportunidades, destilamos aqui os nichos, fórmulas de tÃtulo e motores emocionais que mais se repetem."}):e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:H.data.clusters.map((s,t)=>e.jsxs("div",{className:k,"data-testid":`cluster-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-white capitalize",children:s.niche}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{score:s.avgOpportunityScore,label:"Méd",gateKey:"opportunity"}),e.jsx(ae,{label:`${s.count} ideia${s.count>1?"s":""}`})]})]}),s.titleFormulas.length>0&&e.jsxs("div",{className:"mb-2",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1",children:"Fórmulas de tÃtulo"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.titleFormulas.slice(0,5).map((d,x)=>e.jsx("span",{className:"rounded-md bg-cyan-500/[0.07] border border-cyan-400/15 px-2 py-0.5 text-[11px] text-cyan-100/90",children:d},x))})]}),s.emotionalEngines.length>0&&e.jsxs("div",{className:"mb-2",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1",children:"Motores emocionais"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.emotionalEngines.slice(0,5).map((d,x)=>e.jsx("span",{className:"rounded-md bg-white/[0.04] border border-white/10 px-2 py-0.5 text-[11px] text-zinc-300",children:d},x))})]}),s.samples.length>0&&e.jsx("ul",{className:"mt-2 space-y-1",children:s.samples.slice(0,3).map((d,x)=>e.jsxs("li",{className:"text-[11px] text-zinc-500 truncate",children:["⢠",d]},x))})]},t))})}),c==="modelados"&&e.jsx("div",{children:D.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}):(D.data?.proposals?.filter(s=>s.status!=="discarded").length??0)===0?e.jsx(Y,{icon:te,title:"Nenhum canal modelado",hint:"A partir de uma oportunidade validada, gere um blueprint estratégico de canal â pilares, fórmulas de tÃtulo e identidade."}):e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:D.data.proposals.filter(s=>s.status!=="discarded").map(s=>e.jsxs("div",{className:k,"data-testid":`proposal-${s.id}`,children:[e.jsx("div",{className:"flex items-start justify-between gap-2 mb-2",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.language&&e.jsx(Xe,{lang:s.language}),e.jsx(U,{score:s.modelingScore,label:"Mod"})]}),e.jsx("h3",{className:"font-semibold text-white leading-snug",children:s.name}),s.niche&&e.jsx("p",{className:"text-[11px] text-cyan-300/70 mt-0.5 capitalize",children:s.niche})]})}),s.positioning&&e.jsx("p",{className:"text-xs text-zinc-400 mb-3 line-clamp-3",children:s.positioning}),$a(s.contentPillars).length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mb-1",children:"Pilares de conteúdo"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:$a(s.contentPillars).slice(0,6).map((t,d)=>e.jsx("span",{className:"rounded-md bg-cyan-500/[0.07] border border-cyan-400/15 px-2 py-0.5 text-[11px] text-cyan-100/90",children:t},d))})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-3 pt-3 border-t border-white/5",children:[s.channelId?e.jsxs(Q,{href:`/videos/canais/${s.channelId}`,className:b,"data-testid":`link-proposal-channel-${s.id}`,children:[e.jsx(te,{className:"w-3.5 h-3.5"})," Abrir canal"]}):e.jsxs("button",{className:q+" !py-2 !px-3 text-xs",disabled:fe.isPending,onClick:()=>fe.mutate({id:s.id,action:"create-channel"}),"data-testid":`button-create-channel-${s.id}`,children:[fe.isPending?e.jsx(g,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ge,{className:"w-3.5 h-3.5"})," Criar canal real"]}),e.jsxs("button",{className:b,disabled:fe.isPending,onClick:()=>fe.mutate({id:s.id,action:"discard"}),"data-testid":`button-discard-proposal-${s.id}`,children:[e.jsx(le,{className:"w-3.5 h-3.5"})," Descartar"]})]})]},s.id))})}),c==="lotes"&&e.jsx("div",{children:M.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}
3):(M.data?.batches?.length??0)===0?e.jsx(Y,{icon:Ae,title:"Nenhum lote de teste",hint:"Monte um lote de 10 ideias a partir de uma oportunidade validada e aplique a Regra do Pulso para decidir o que escalar."}):e.jsx("div",{className:"space-y-4",children:M.data.batches.map(s=>{const t=Array.isArray(s.items)?s.items:[],d=s.status==="completed"?"good":s.status==="discarded"?"bad":s.status==="pulse_review"?"warn":"default";return e.jsxs("div",{className:k,"data-testid":`batch-${s.id}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-white",children:s.title}),e.jsxs("p",{className:"text-[11px] text-zinc-500 mt-0.5",children:["Meta ",s.targetCount," vÃdeos · Pulso a cada ",s.pulseThreshold]})]}),e.jsx(ae,{label:Rt[s.status]||s.status,tone:d})]}),t.length>0&&e.jsx("ul",{className:"space-y-1.5 mb-3",children:t.slice(0,10).map((x,i)=>e.jsxs("li",{className:"flex items-center gap-2 text-xs text-zinc-300",children:[e.jsx("span",{className:"w-5 h-5 rounded-md bg-white/[0.04] border border-white/10 flex items-center justify-center text-[10px] text-zinc-500 shrink-0",children:i+1}),e.jsx("span",{className:"truncate",children:x.title||x.idea||"Ideia"}),x.projectId&&e.jsx(Q,{href:`/videos/projetos/${x.projectId}`,className:"ml-auto text-cyan-400 hover:text-cyan-300 shrink-0",children:e.jsx(Je,{className:"w-4 h-4"})})]},i))}),e.jsxs("div",{className:"flex items-center gap-2 pt-3 border-t border-white/5",children:[e.jsxs("button",{className:q+" !py-2 !px-3 text-xs",disabled:ce.isPending,onClick:()=>ce.mutate({id:s.id,decision:"promote"}),"data-testid":`button-pulse-promote-${s.id}`,children:[e.jsx(Se,{className:"w-3.5 h-3.5"})," Promover (escalar)"]}),e.jsx("button",{className:b,disabled:ce.isPending,onClick:()=>ce.mutate({id:s.id,decision:"review"}),"data-testid":`button-pulse-review-${s.id}`,children:"Revisar"}),e.jsxs("button",{className:b,disabled:ce.isPending,onClick:()=>ce.mutate({id:s.id,decision:"discard"}),"data-testid":`button-pulse-discard-${s.id}`,children:[e.jsx(le,{className:"w-3.5 h-3.5"})," Descartar"]})]})]},s.id)})})}),c==="nichos"&&e.jsxs("div",{className:"space-y-6","data-testid":"tab-content-nichos",children:[e.jsxs("div",{className:k,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Qe,{className:"w-5 h-5 text-cyan-300"}),e.jsx("h2",{className:"text-base font-semibold text-cyan-100",children:"Investigador de Nichos Dark"}),e.jsx("span",{className:"ml-auto text-[11px] text-zinc-500 bg-white/[0.03] border border-white/10 rounded-full px-2.5 py-0.5",children:"IA + Internet"})]}),e.jsxs("p",{className:"text-sm text-zinc-400 mb-5",children:["A IA pesquisa a internet em tempo real para encontrar os ",e.jsx("span",{className:"text-cyan-200",children:"nichos dark/faceless mais lucrativos"})," do YouTube â canais reais, receita estimada, exemplos virais e sugestões de nome prontas para criar."]}),e.jsxs("div",{className:"grid sm:grid-cols-3 gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] uppercase tracking-wide text-zinc-500 mb-1.5 block",children:"Idioma do canal"}),e.jsxs("select",{value:la,onChange:s=>mt(s.target.value),className:"w-full rounded-xl bg-white/[0.04] border border-white/10 text-sm text-zinc-200 px-3 py-2 focus:outline-none focus:border-cyan-400/40","data-testid":"select-niche-lang",children:[e.jsx("option",{value:"pt",children:"ð§ð· Português"}),e.jsx("option",{value:"en",children:"ðºð¸ Inglês"}),e.jsx("option",{value:"es",children:"ðªð¸ Espanhol"}),e.jsx("option",{value:"fr",children:"ð«ð· Francês"}),e.jsx("option",{value:"de",children:"ð©ðª Alemão"}),e.jsx("option",{value:"it",children:"ð®ð¹ Italiano"}),e.jsx("option",{value:"ar",children:"ð¸ð¦ Ãrabe"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[11px] uppercase tracking-wide text-zinc-500 mb-1.5 block",children:"Tipo de conteúdo"}),e.jsxs("select",{value:da,onChange:s=>pt(s.target.value),className:"w-full rounded-xl bg-white/[0.04] border border-white/10 text-sm text-zinc-200 px-3 py-2 focus:outline-none focus:border-cyan-400/40","data-testid":"select-niche-type",children:[e.jsx("option",{value:"dark",children:"ð Dark / Faceless"}),e.jsx("option",{value:"educational",children:"ð Educacional"}),e.jsx("option",{value:"entertainment",children:"ð¬ Entretenimento"}),e.jsx("option",{value:"any",children:"ð² Qualquer"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[11px] uppercase tracking-wide text-zinc-500 mb-1.5 block",children:["Ãrea de foco ",e.jsx("span",{className:"text-zinc-600",children:"(opcional)"})]}),e.jsx("input",{type:"text",value:oa,onChange:s=>ut(s.target.value),placeholder:"ex: crimes reais, meditação, finançasâ¦",className:"w-full rounded-xl bg-white/[0.04] border border-white/10 text-sm text-zinc-200 placeholder-zinc-600 px-3 py-2 focus:outline-none focus:border-cyan-400/40","data-testid":"input-niche-focus"})]})]}),e.jsx("button",{className:p(q,"w-full sm:w-auto"),disabled:Ns.isPending||w?.status==="pending"||w?.status==="researching",onClick:()=>Ns.mutate(),"data-testid":"button-investigate-niches",children:Ns.isPending||w?.status==="pending"||w?.status==="researching"?e.jsxs(e.Fragment,{children:[e.jsx(g,{className:"w-4 h-4 animate-spin"})," Investigandoâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(Qe,{className:"w-4 h-4"})," Investigar Nichos"]})})]}),(()=>{const s=Fe.data?.runs??[],t=s.some($=>$.status==="pending"||$.status==="researching");if(!(w?.status==="pending"||w?.status==="researching"||t&&!w))return null;const N=(w||s.find($=>$.status==="pending"||$.status==="researching"))?.metadata?.phase??"",ye=N==="discovery"?"ð Mapeando o mercado e descobrindo nichos candidatosâ¦":N==="deep_research"?"ð¬ Pesquisando canais reais, CPMs e vÃdeos viraisâ¦":N==="synthesis"?"⨠Sintetizando todos os dados em estrutura finalâ¦":N==="youtube"?"ðº Verificando canais no YouTubeâ¦":"ð Pesquisando na internet com IAâ¦",X=N==="discovery"?1:N==="deep_research"?2:N==="synthesis"?3:N==="youtube"?4:0;return e.jsxs("div",{className:"rounded-xl border border-cyan-400/20 bg-cyan-500/[0.05] p-5","data-testid":"banner-niche-loading",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx(g,{className:"w-5 h-5 text-cyan-300 animate-spin shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm text-cyan-100 font-medium mb-0.5",children:ye}),e.jsx("p",{className:"text-xs text-zinc-400",children:"Investigação profunda com Gemini + grounding web. Isso leva 1â3 minutos para máxima qualidade."})]})]}),X>0&&e.jsx("div",{className:"flex gap-1.5 mt-2",children:[1,2,3,4].map($=>e.jsx("div",{className:p("h-1 flex-1 rounded-full transition-all",$<X?"bg-cyan-400":$===X?"bg-cyan-300 animate-pulse":"bg-white/10")},$))}),e.jsxs("p",{className:"text-[10px] text-zinc-500 mt-2",children:["Fase ",X>0?X:"?","/4 â não feche esta aba"]})]})})(),(()=>{const s=Fe.data?.runs??[],t=w?.status==="failed"?w:!w&&s.find(d=>d.status==="failed"&&!s.some(x=>x.status==="completed"));return t?e.jsxs("div",{className:"rounded-xl border border-rose-400/20 bg-rose-500/[0.05] p-4 flex items-start gap-3","data-testid":"banner-niche-error",children:[e.jsx(he,{className:"w-4 h-4 text-rose-300 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-rose-200 font-medium mb-0.5",children:"Investigação falhou"}),e.jsx("p",{className:"text-xs text-zinc-400",children:t.error||"Erro desconhecido. Tente novamente."})]})]}):null})(),(()=>{const s=Fe.data?.runs??[],t=s.filter(i=>i.status==="completed"&&Array.isArray(i.results)&&i.results.length>0);if(t.length===0&&!Fe.isLoading)return s.some(N=>N.status==="pending"||N.status==="researching")||w?.status==="pending"||w?.status==="researching"?null:e.jsxs("div",{className:"py-10 text-center text-zinc-500 text-sm","data-testid":"nichos-empty",children:[e.jsx(Qe,{className:"w-10 h-10 mx-auto mb-3 opacity-20"}),e.jsxs("p",{children:["Nenhuma investigação ainda. Clique em ",e.jsx("strong",{className:"text-zinc-300",children:"Investigar Nichos"})," para começar."]}),e.jsx("p",{className:"text-[11px] mt-1.5 text-zinc-600",children:"A IA pesquisa a internet por ~2 minutos para trazer dados reais."})]});const d=t[0],x=d?.results??[];return e.jsxs("div",{className:"space-y-4","data-testid":"nichos-results",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"w-4 h-4 text-emerald-400"}),e.jsxs("span",{className:"text-sm text-zinc-300 font-medium",children:[x.length," nichos investigados"]}),d?.completedAt&&e.jsx("span",{className:"text-[11px] text-zinc-600",children:ze(d.completedAt)})]}),d?.sources?.length>0&&e.jsxs("span",{className:"text-[11px] text-zinc-600 flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"})," ",d.sources.length," fontes web consultadas"]})]}),e.jsx("div",{className:"space-y-4",children:x.map((i,N)=>{const ye=ht===N,X=Number(i.opportunityScore??0),$=String(i.competition??"").toLowerCase(),ee=String(i.growthTrend??"").toLowerCase(),Is=Array.isArray(i.titleSuggestions)?i.titleSuggestions:[],va=Array.isArray(i.contentPillars)?i.contentPillars:[],Na=Array.isArray(i.keywords)?i.keywords:[],fa=Array.isArray(i.exampleChannels)?i.exampleChannels:[],ya=Array.isArray(i.exampleVideos)?i.exampleVideos:[],wa=Array.isArray(i.monetizationBeyondAds)?i.monetizationBeyondAds:[],_e=i.establishedChannelMonthlyRevBrl??{},Be=i.newChannelMonth6RevBrl??{},za=Number(i.cpmUsd??0),ka=Number(i.timeToMonetizationMonths??0),xe=String(i.productionDifficulty??"").toLowerCase(),Ca=$==="low"?"emerald":$==="medium"?"amber":"rose",zt=ee==="rising"?"â":ee==="stable"?"â":ee==="declining"?"â":"",kt=ee==="rising"?"text-emerald-300":ee==="declining"?"text-rose-300":"text-amber-300",Sa=ee==="rising"?"Em alta":ee==="stable"?"Estável":ee==="declining"?"Em queda":"",Aa=xe==="low"?"emerald":xe==="medium"?"amber":"rose",Ta=xe==="low"?"Produção fácil":xe==="medium"?"Produção média":xe==="high"?"Produção difÃcil":"",Rs=String(i.name??`Nicho ${N+1}`);return e.jsxs("div",{className:p(k,"overflow-hidden"),"data-testid":`niche-card-${N}`,children:[e.jsxs("div",{className:"flex items-start gap-3 cursor-pointer",onClick:()=>gt(ye?null:N),children:[e.jsxs("div",{className:p("shrink-0 w-14 h-14 roun
3ded-xl flex flex-col items-center justify-center border text-center",X>=80?"bg-emerald-500/10 border-emerald-400/25 text-emerald-300":X>=60?"bg-amber-500/10 border-amber-400/25 text-amber-300":"bg-zinc-500/10 border-zinc-400/20 text-zinc-400"),children:[e.jsx("span",{className:"text-lg font-bold leading-none",children:X}),e.jsx("span",{className:"text-[9px] uppercase tracking-wide opacity-70 mt-0.5",children:"score"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx("h3",{className:"font-semibold text-zinc-100 text-sm leading-snug",children:Rs}),za>0&&e.jsxs("span",{className:"text-[10px] rounded-full px-2 py-0.5 border bg-amber-500/10 border-amber-400/20 text-amber-300 font-mono",children:["CPM $",za.toFixed(2)]}),$&&e.jsx("span",{className:p("text-[10px] rounded-full px-2 py-0.5 border",Ca==="emerald"?"bg-emerald-500/10 border-emerald-400/20 text-emerald-300":Ca==="amber"?"bg-amber-500/10 border-amber-400/20 text-amber-300":"bg-rose-500/10 border-rose-400/20 text-rose-300"),children:$==="low"?"Baixa concorrência":$==="medium"?"Média concorrência":"Alta concorrência"}),Sa&&e.jsxs("span",{className:p("text-[10px] font-mono",kt),children:[zt," ",Sa]})]}),i.whyItWorks?e.jsx("p",{className:"text-xs text-zinc-400 line-clamp-2",children:i.whyItWorks}):i.description?e.jsx("p",{className:"text-xs text-zinc-400 line-clamp-2",children:i.description}):null]}),e.jsx("div",{className:"shrink-0 text-zinc-500 mt-1",children:ye?e.jsx(Ea,{className:"w-4 h-4"}):e.jsx(Oa,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3 mt-4",children:[e.jsxs("div",{className:"rounded-xl bg-emerald-500/[0.06] border border-emerald-400/15 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(Ia,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-emerald-300 font-medium",children:"Canal estabelecido / mês"})]}),e.jsx("p",{className:"text-sm font-bold text-emerald-100",children:_e.min&&_e.max?`R$ ${Number(_e.min).toLocaleString("pt-BR")} â R$ ${Number(_e.max).toLocaleString("pt-BR")}`:"â"}),ka>0&&e.jsxs("p",{className:"text-[10px] text-zinc-500 mt-0.5",children:["â± Monetização em ~",ka," meses"]})]}),e.jsxs("div",{className:"rounded-xl bg-cyan-500/[0.06] border border-cyan-400/15 p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(me,{className:"w-3.5 h-3.5 text-cyan-400"}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-cyan-300 font-medium",children:"Canal novo em 6 meses"})]}),e.jsx("p",{className:"text-sm font-bold text-cyan-100",children:Be.min&&Be.max?`R$ ${Number(Be.min).toLocaleString("pt-BR")} â R$ ${Number(Be.max).toLocaleString("pt-BR")}`:"â"}),xe&&Ta&&e.jsx("p",{className:p("text-[10px] mt-0.5",Aa==="emerald"?"text-emerald-400":Aa==="amber"?"text-amber-400":"text-rose-400"),children:Ta})]})]}),Na.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3",children:Na.map((v,B)=>e.jsx("span",{className:"text-[10px] rounded-full px-2 py-0.5 bg-white/[0.04] border border-white/10 text-zinc-400",children:v},B))}),ye&&e.jsxs("div",{className:"mt-4 space-y-4 border-t border-white/[0.06] pt-4",children:[i.description&&e.jsx("p",{className:"text-xs text-zinc-300 leading-relaxed",children:i.description}),i.uniqueAngle&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx($s,{className:"w-3.5 h-3.5 text-amber-400"}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-amber-300",children:"Ãngulo único"})]}),e.jsx("p",{className:"text-xs text-zinc-300",children:i.uniqueAngle})]}),i.audiencePsychology&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(_a,{className:"w-3.5 h-3.5 text-violet-400"}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-violet-300",children:"Psicologia da audiência"})]}),e.jsx("p",{className:"text-xs text-zinc-300",children:i.audiencePsychology})]}),va.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(At,{className:"w-3.5 h-3.5 text-sky-400"}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-sky-300",children:"Pilares de conteúdo"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:va.map((v,B)=>e.jsx("span",{className:"text-[11px] rounded-full px-2.5 py-0.5 bg-sky-500/10 border border-sky-400/20 text-sky-200",children:v},B))})]}),wa.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(Ia,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-emerald-300",children:"Monetização além do AdSense"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:wa.map((v,B)=>e.jsx("span",{className:"text-[11px] rounded-full px-2.5 py-0.5 bg-emerald-500/10 border border-emerald-400/20 text-emerald-200",children:v},B))})]}),fa.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-purple-400"}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-purple-300",children:"Canais de referência"})]}),e.jsx("div",{className:"space-y-2",children:fa.map((v,B)=>e.jsxs("div",{className:"rounded-xl bg-white/[0.03] border border-white/[0.06] p-2.5 flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-500/15 border border-purple-400/20 flex items-center justify-center shrink-0",children:e.jsx(pe,{className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-zinc-200",children:v.name??"Canal"}),v.subs>0&&e.jsxs("span",{className:"text-[10px] text-zinc-500",children:[E(v.subs)," inscritos"]}),v.avgMonthlyViews>0&&e.jsxs("span",{className:"text-[10px] text-sky-400",children:[E(v.avgMonthlyViews)," views/mês"]})]}),v.url&&e.jsxs("a",{href:v.url,target:"_blank",rel:"noreferrer",className:"text-[10px] text-cyan-400 hover:underline flex items-center gap-0.5 mt-0.5",children:[e.jsx(ie,{className:"w-3 h-3"})," Ver canal"]})]})]},B))})]}),ya.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(Us,{className:"w-3.5 h-3.5 text-rose-400"}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-rose-300",children:"Exemplos virais"})]}),e.jsx("div",{className:"space-y-2",children:ya.map((v,B)=>e.jsxs("div",{className:"rounded-xl bg-white/[0.03] border border-white/[0.06] p-2.5 flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-rose-500/15 border border-rose-400/20 flex items-center justify-center shrink-0",children:e.jsx(Je,{className:"w-4 h-4 text-rose-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm text-zinc-200 leading-snug",children:v.title??"VÃdeo"}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[v.views>0&&e.jsxs("span",{className:"text-[10px] font-mono text-zinc-400",children:[E(v.views)," views"]}),v.channelName&&e.jsxs("span",{className:"text-[10px] text-zinc-600",children:["⢠",v.channelName]})]}),v.whyViral&&e.jsxs("p",{className:"text-[10px] text-violet-300 mt-1 italic",children:["ð¡ ",v.whyViral]}
3),v.url&&e.jsxs("a",{href:v.url,target:"_blank",rel:"noreferrer",className:"text-[10px] text-cyan-400 hover:underline flex items-center gap-0.5 mt-0.5",children:[e.jsx(ie,{className:"w-3 h-3"})," Assistir"]})]})]},B))})]}),Is.length>0&&e.jsxs("div",{className:"rounded-xl border border-cyan-400/20 bg-cyan-500/[0.05] p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[e.jsx(Es,{className:"w-3.5 h-3.5 text-cyan-300"}),e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cyan-300 font-medium",children:"Sugestões de nome para o canal"})]}),e.jsx("div",{className:"space-y-2 mb-3",children:Is.map((v,B)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[10px] text-zinc-600 tabular-nums w-4",children:[B+1,"."]}),e.jsx("span",{className:"text-sm text-cyan-100 font-medium",children:v})]},B))}),e.jsxs(Q,{href:`/videos/novo?niche=${encodeURIComponent(Rs)}&name=${encodeURIComponent(Is[0]??"")}`,className:p(q,"inline-flex"),"data-testid":`button-create-channel-${N}`,children:[e.jsx(se,{className:"w-4 h-4"})," Criar canal neste nicho"]})]}),e.jsxs("button",{className:p(b,"text-[11px]"),onClick:()=>{Ks(Rs),n("radar")},"data-testid":`button-search-outliers-${N}`,children:[e.jsx(He,{className:"w-3.5 h-3.5"})," Buscar outliers deste nicho no Radar"]})]})]},N)})}),t.length>1&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-white/[0.05]",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-zinc-600 mb-2",children:"Investigações anteriores"}),e.jsx("div",{className:"space-y-1.5",children:t.slice(1).map(i=>e.jsxs("div",{className:"flex items-center justify-between rounded-xl bg-white/[0.02] border border-white/[0.05] px-3 py-2",children:[e.jsxs("span",{className:"text-xs text-zinc-400",children:[Array.isArray(i.results)?i.results.length:0," nichos â ",ze(i.completedAt)]}),e.jsx("button",{className:"text-[11px] text-cyan-400 hover:underline",onClick:()=>xa(i.id),"data-testid":`button-load-run-${i.id}`,children:"Ver resultados"})]},i.id))})]})]})})()]}),c==="descartados"&&e.jsx("div",{children:G.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}):Ss.length===0?e.jsx(Y,{icon:le,title:"Nada descartado",hint:"Oportunidades descartadas ficam aqui â nada é apagado. Você pode restaurá-las a qualquer momento."}):e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:Ss.map(s=>e.jsxs("div",{className:p(k,"opacity-75"),"data-testid":`discarded-${s.id}`,children:[e.jsx("h3",{className:"font-medium text-zinc-300 text-sm leading-snug mb-1",children:s.suggestedTitle||s.videoTitle||s.niche}),s.niche&&e.jsx("p",{className:"text-[11px] text-zinc-600 mb-3 capitalize",children:s.niche}),e.jsxs("button",{className:b,disabled:F.isPending,onClick:()=>F.mutate({id:s.id,action:"restore"}),"data-testid":`button-restore-${s.id}`,children:[e.jsx(Ke,{className:"w-3.5 h-3.5"})," Restaurar"]})]},s.id))})}),c==="produzidos"&&e.jsxs("div",{"data-testid":"tab-content-produzidos",children:[e.jsxs("div",{className:"mb-4 rounded-lg border border-emerald-400/15 bg-emerald-500/[0.04] px-4 py-3",children:[e.jsxs("p",{className:"text-sm text-emerald-200 font-medium flex items-center gap-2",children:[e.jsx(Os,{className:"w-4 h-4"})," Histórico de produção"]}),e.jsx("p",{className:"text-xs text-zinc-400 mt-1",children:"VÃdeos Money que você já produziu até o fim (render concluÃdo). A partir daqui o radar evita re-sugerir o que você já fez â sem desperdÃcio."})]}),_.isLoading?e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx(g,{className:"w-6 h-6 animate-spin text-cyan-400"})}):W.length===0?e.jsx(Y,{icon:Os,title:"Nenhum vÃdeo produzido ainda",hint:"Quando você gerar e renderizar um vÃdeo modelado até o fim, ele aparece aqui â e deixa de ser sugerido de novo."}):e.jsx("div",{className:"grid md:grid-cols-2 gap-4",children:W.map(s=>e.jsxs("div",{className:k,"data-testid":`produced-${s.projectId}`,children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[s.thumbnailUrl&&e.jsx("img",{src:s.thumbnailUrl,alt:"",className:"w-16 h-10 rounded object-cover border border-white/10 shrink-0 mt-0.5",loading:"lazy"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[e.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-emerald-500/15 border border-emerald-400/30 px-1.5 py-0.5 text-[10px] text-emerald-300",children:[e.jsx(qs,{className:"w-3 h-3"})," Produzido"]}),s.targetLanguage&&e.jsx(Xe,{lang:String(s.targetLanguage).toLowerCase().slice(0,2)}),s.createdAt&&e.jsx("span",{className:"text-[10px] text-zinc-600",children:ze(s.createdAt)})]}),e.jsx("h3",{className:"font-semibold text-white text-sm leading-snug","data-testid":`produced-title-${s.projectId}`,children:s.title||s.videoTitle||"VÃdeo produzido"}),s.channelTitle&&e.jsxs("p",{className:"text-[11px] text-zinc-500 mt-0.5 truncate",children:["Origem: ",s.channelTitle]})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-3 mt-3 border-t border-white/5",children:[s.renderUrl&&e.jsxs("a",{href:s.renderUrl,target:"_blank",rel:"noopener noreferrer",className:q+" !py-2 !px-3 text-xs","data-testid":`link-download-produced-${s.projectId}`,children:[e.jsx(Lt,{className:"w-3.5 h-3.5"})," Baixar vÃdeo"]}),e.jsxs(Q,{href:"/videos",className:b+" !py-2 !px-3 text-xs","data-testid":`link-studio-produced-${s.projectId}`,children:[e.jsx(te,{className:"w-3.5 h-3.5"})," Ver no estúdio"]}),s.videoUrl&&e.jsxs("a",{href:s.videoUrl,target:"_blank",rel:"noopener noreferrer",className:b+" !py-2 !px-3 text-xs","data-testid":`link-original-produced-${s.projectId}`,children:[e.jsx(Ce,{className:"w-3.5 h-3.5"})," Original"]}),e.jsxs("button",{type:"button",onClick:()=>{window.confirm(`Liberar este vÃdeo para gerar de novo a partir da MESMA fonte? 4 5O vÃdeo já produzido continua salvo no estúdio e disponÃvel para download â nada é apagado. Ele apenas sai desta lista de Produzidos e a fonte fica livre para uma nova geração.`)&&Ne.mutate(s.projectId)},disabled:Ne.isPending&&Ne.variables===s.projectId,className:b+" !py-2 !px-3 text-xs !border-amber-400/30 !text-amber-300 ml-auto","data-testid":`button-release-produced-${s.projectId}`,title:"Libera esta fonte para você gerar um novo vÃdeo a partir dela. Nada é apagado â o vÃdeo produzido continua no estúdio.",children:[Ne.isPending&&Ne.variables===s.projectId?e.jsx(g,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ke,{className:"w-3.5 h-3.5"})," Liberar p/ gerar de novo"]})]})]},s.projectId))})]}),c==="analytics"&&j&&e.jsxs("div",{className:"space-y-6","data-testid":"tab-content-analytics",children:[(()=>{const s=Qa.data?.profiles||[],t=De.map(i=>Number(i.complianceScore||0)).filter(i=>i>0),d=t.length?Math.round(t.reduce((i,N)=>i+N,0)/t.length):null,x=i=>s.filter(N=>N.riskLevel===i).length;return e.jsxs("div",{className:k,"data-testid":"panel-portfolio-compliance",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Fa,{className:"w-4.5 h-4.5 text-cyan-300"}),e.jsx("h3",{className:"font-semibold text-white text-sm",children:"Conformidade do portfólio"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsxs("div",{className:"rounded-xl bg-white/[0.03] border border-white/10 p-3",children:[e.jsx("p",{className:"text-[11px] text-zinc-500 mb-1",children:"Conformidade média"}),e.jsx("p",{className:"text-2xl font-bold tabular-nums text-white","data-testid":"text-avg-compliance",children:d!=null?`${d}`:"â"})]}),e.jsxs("div",{className:"rounded-xl bg-emerald-500/[0.06] border border-emerald-400/15 p-3",children:[e.jsx("p",{className:"text-[11px] text-emerald-300/80 mb-1",children:"Risco baixo"}),e.jsx("p",{className:"text-2xl font-bold tabular-nums text-emerald-200","data-testid":"text-risk-low",children:x("low")})]}),e.jsxs("div",{className:"rounded-xl bg-amber-500/[0.06] border border-amber-400/15 p-3",children:[e.jsx("p",{className:"text-[11px] text-amber-300/80 mb-1",children:"Risco médio"}),e.jsx("p",{className:"text-2xl font-bold tabular-nums text-amber-200","data-testid":"text-risk-medium",children:x("medium")})]}),e.jsxs("div",{className:"rounded-xl bg-rose-500/[0.06] border border-rose-400/15 p-3",children:[e.jsx("p",{className:"text-[11px] text-rose-300/80 mb-1",children:"Risco alto"}),e.jsx("p",{className:"text-2xl font-bold tabular-nums text-rose-200","data-testid":"text-risk-high",children:x("high")})]})]}),e.jsx("p",{className:"text-[11px] text-zinc-600 mt-3",children:"Conformidade legÃtima: auditoria de originalidade, recomendação de aviso de IA e revisão humana. Nada de evasão de polÃticas."})]})})(),e.jsxs("div",{className:k,"data-testid":"panel-performance-snapshots",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ls,{className:"w-4.5 h-4.5 text-cyan-300"}),e.jsx("h3",{className:"font-semibold text-white text-sm",children:"Loop de aprendizado â performance real"})]}),e.jsxs("button",{className:b,disabled:vs.isPending,onClick:()=>vs.mutate(),"data-testid":"button-sync-youtube-analytics",children:[vs.isPending?e.jsx(g,{className:"w-4 h-4 animate-spin"}):e.jsx(Tt,{className:"w-4 h-4"})," Puxar do YouTube"]})]}),e.jsx("p",{className:"text-[11px] text-zinc-500 mb-4",children:"Puxe a performance real direto do YouTube Analytics com um clique â ou registre os números manualmente abaixo. Cada dado alimenta a inteligência de modelagem."}),Nt&&e.jsxs("div",{className:"mb-4 rounded-lg border border-amber-400/30 bg-amber-400/[0.06] px-3 py-2.5 text-[11px] text-amber-200 flex items-start gap-2","data-testid":"alert-analytics-rec
5onnect",children:[e.jsx(he,{className:"w-4 h-4 shrink-0 mt-0.5"}),e.jsxs("span",{children:["Falta a permissão de ",e.jsx("strong",{children:"YouTube Analytics"})," em um ou mais canais â por isso a performance não pôde ser puxada."," ",e.jsx("a",{href:"/videos/canais",className:"underline underline-offset-2 hover:text-amber-100","data-testid":"link-reconnect-youtube",children:"Reconecte o canal"})," concedendo o acesso de Analytics para habilitar o puxe automático."]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-5 gap-2.5 mb-3",children:[e.jsx("input",{className:h,placeholder:"ID do vÃdeo (YouTube)",value:I.externalVideoId,onChange:s=>oe({...I,externalVideoId:s.target.value}),"data-testid":"input-snapshot-video"}),e.jsx("input",{className:h,type:"number",placeholder:"Views",value:I.views,onChange:s=>oe({...I,views:s.target.value}),"data-testid":"input-snapshot-views"}),e.jsx("input",{className:h,type:"number",step:"0.1",placeholder:"CTR %",value:I.ctr,onChange:s=>oe({...I,ctr:s.target.value}),"data-testid":"input-snapshot-ctr"}),e.jsx("input",{className:h,type:"number",placeholder:"RPM (centavos)",value:I.rpmCents,onChange:s=>oe({...I,rpmCents:s.target.value}),"data-testid":"input-snapshot-rpm"}),e.jsx("input",{className:h,type:"number",placeholder:"Receita (centavos)",value:I.revenueCents,onChange:s=>oe({...I,revenueCents:s.target.value}),"data-testid":"input-snapshot-revenue"})]}),e.jsxs("button",{className:q,disabled:js.isPending||!I.externalVideoId.trim()&&!I.views,onClick:()=>js.mutate(),"data-testid":"button-add-snapshot",children:[js.isPending?e.jsx(g,{className:"w-4 h-4 animate-spin"}):e.jsx(Ge,{className:"w-4 h-4"})," Registrar snapshot"]}),e.jsx("div",{className:"mt-5",children:ss.isLoading?e.jsx("div",{className:"py-8 flex justify-center",children:e.jsx(g,{className:"w-5 h-5 animate-spin text-cyan-400"})}):(ss.data?.snapshots||[]).length===0?e.jsx(Y,{icon:Ls,title:"Sem dados de performance ainda",hint:"Registre o primeiro snapshot acima â cada número torna a próxima modelagem mais precisa."}):e.jsx("div",{className:"overflow-x-auto -mx-1 px-1",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-wide text-zinc-500 border-b border-white/10",children:[e.jsx("th",{className:"py-2 pr-3 font-medium",children:"VÃdeo"}),e.jsx("th",{className:"py-2 px-3 font-medium text-right",children:"Views"}),e.jsx("th",{className:"py-2 px-3 font-medium text-right",children:"CTR"}),e.jsx("th",{className:"py-2 px-3 font-medium text-right",children:"RPM"}),e.jsx("th",{className:"py-2 px-3 font-medium text-right",children:"Receita"}),e.jsx("th",{className:"py-2 pl-3 font-medium text-right",children:"Quando"})]})}),e.jsx("tbody",{children:(ss.data?.snapshots||[]).map(s=>e.jsxs("tr",{className:"border-b border-white/[0.04]","data-testid":`row-snapshot-${s.id}`,children:[e.jsx("td",{className:"py-2 pr-3 text-zinc-300 truncate max-w-[160px]",children:s.externalVideoId||s.projectId||"â"}),e.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-white",children:E(s.views)}),e.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-zinc-300",children:s.ctr?`${Number(s.ctr).toFixed(1)}%`:"â"}),e.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-zinc-300",children:s.rpmCents?`R$ ${(s.rpmCents/100).toFixed(2)}`:"â"}),e.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-emerald-200",children:s.revenueCents?`R$ ${(s.revenueCents/100).toFixed(2)}`:"â"}),e.jsx("td",{className:"py-2 pl-3 text-right text-[11px] text-zinc-500",children:ze(s.capturedAt||s.createdAt)})]},s.id))})]})})})]}),e.jsxs("div",{className:k,"data-testid":"panel-money-patterns",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Pa,{className:"w-4.5 h-4.5 text-cyan-300"}),e.jsx("h3",{className:"font-semibold text-white text-sm",children:"Padrões vencedores e perdedores"})]}),e.jsx("p",{className:"text-[11px] text-zinc-500 mb-4",children:"O que repetir e o que evitar â destilado da performance real do seu portfólio."}),e.jsxs("div",{className:"grid sm:grid-cols-[1fr_auto_auto] gap-2.5 mb-4",children:[e.jsx("input",{className:h,placeholder:"Padrão (ex.: tÃtulo com número + emoção)",value:K.label,onChange:s=>Me({...K,label:s.target.value}),"data-testid":"input-pattern-label"}),e.jsxs("select",{className:h,value:K.category,onChange:s=>Me({...K,category:s.target.value}),"data-testid":"select-pattern-category",children:[e.jsx("option",{value:"title",children:"TÃtulo"}),e.jsx("option",{value:"thumbnail",children:"Thumbnail"}),e.jsx("option",{value:"topic",children:"Tema"}),e.jsx("option",{value:"format",children:"Formato"}),e.jsx("option",{value:"hook",children:"Gancho"}),e.jsx("option",{value:"length",children:"Duração"})]}
5),e.jsxs("select",{className:h,value:K.patternType,onChange:s=>Me({...K,patternType:s.target.value}),"data-testid":"select-pattern-type",children:[e.jsx("option",{value:"winning",children:"Vencedor"}),e.jsx("option",{value:"losing",children:"Perdedor"})]})]}),e.jsx("div",{className:"mb-5",children:e.jsxs("button",{className:b,disabled:fs.isPending||!K.label.trim(),onClick:()=>fs.mutate(),"data-testid":"button-add-pattern",children:[fs.isPending?e.jsx(g,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ge,{className:"w-3.5 h-3.5"})," Salvar padrão"]})}),ge.isLoading?e.jsx("div",{className:"py-8 flex justify-center",children:e.jsx(g,{className:"w-5 h-5 animate-spin text-cyan-400"})}):e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2 text-emerald-300",children:[e.jsx(Pa,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:"Vencedores"})]}),(ge.data?.patterns||[]).filter(s=>s.patternType==="winning").length===0?e.jsx("p",{className:"text-[11px] text-zinc-600 py-3",children:"Nenhum padrão vencedor registrado ainda."}):e.jsx("div",{className:"space-y-2",children:(ge.data?.patterns||[]).filter(s=>s.patternType==="winning").map(s=>e.jsxs("div",{className:"rounded-xl bg-emerald-500/[0.05] border border-emerald-400/15 p-3","data-testid":`pattern-winning-${s.id}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm text-emerald-100 font-medium",children:s.label}),e.jsx(ae,{label:s.category,tone:"good"})]}),s.description&&e.jsx("p",{className:"text-[11px] text-zinc-400 mt-1",children:s.description}),e.jsxs("button",{className:b+" mt-2 !py-1.5 !px-2.5 !text-[11px]",disabled:Ue.isPending,onClick:()=>Ue.mutate({patternId:s.id,title:s.label}),"data-testid":`button-expand-winner-${s.id}`,children:[Ue.isPending&&Ue.variables?.patternId===s.id?e.jsx(g,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(se,{className:"w-3.5 h-3.5"})," Expandir vencedor"]})]},s.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2 text-rose-300",children:[e.jsx(qt,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:"Perdedores"})]}),(ge.data?.patterns||[]).filter(s=>s.patternType==="losing").length===0?e.jsx("p",{className:"text-[11px] text-zinc-600 py-3",children:"Nenhum padrão perdedor registrado ainda."}):e.jsx("div",{className:"space-y-2",children:(ge.data?.patterns||[]).filter(s=>s.patternType==="losing").map(s=>e.jsxs("div",{className:"rounded-xl bg-rose-500/[0.05] border border-rose-400/15 p-3","data-testid":`pattern-losing-${s.id}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-sm text-rose-100 font-medium",children:s.label}),e.jsx(ae,{label:s.category,tone:"bad"})]}),s.description&&e.jsx("p",{className:"text-[11px] text-zinc-400 mt-1",children:s.description})]},s.id))})]})]})]})]})]}),Ve&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",onClick:()=>ys(null),"data-testid":"modal-winner-expansion",children:e.jsxs("div",{className:"w-full max-w-2xl max-h-[85vh] overflow-y-auto rounded-2xl border border-cyan-400/20 bg-[#0a0f1c] p-5 md:p-6 shadow-2xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-cyan-200",children:[e.jsx(se,{className:"w-5 h-5"}),e.jsx("h2",{className:"text-lg font-semibold",children:"Expansão de Vencedor"})]}),e.jsx("button",{className:b+" !px-2 !py-1",onClick:()=>ys(null),"data-testid":"button-close-expansion",children:"Fechar"})]}),e.jsxs("p",{className:"text-xs text-zinc-500 mb-4",children:["Derivado de ",e.jsx("span",{className:"text-cyan-300",children:Ve.title}),'. São apenas ideias â nada é criado até você clicar em "Gerar versão modelada".']}),Ve.ideas.length===0?e.jsx(Y,{icon:$s,title:"Sem ideias agora",hint:"Tente novamente em instantes."}):e.jsx("div",{className:"space-y-3",children:Ve.ideas.map((s,t)=>e.jsxs("div",{className:"rounded-xl border border-white/10 bg-white/[0.03] p-4","data-testid":`expansion-idea-${t}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-white leading-snug",children:s.title}),e.jsx(U,{score:s.score,label:"Score"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mb-2",children:[e.jsx(ae,{label:s.sequenceType,tone:"good"}),s.angle&&e.jsx("span",{className:"text-[11px] text-cyan-300/70",children:s.angle})]}),s.rationale&&e.jsx("p",{className:"text-[11px] text-zinc-400 mb-3",children:s.rationale}),Ts.moneyStyle&&e.jsxs(Q,{href:`/videos/novo?style=money&theme=${encodeURIComponent(s.title)}`,className:q+" !py-2 !px-3 text-xs","data-testid":`link-create-from-idea-${t}`,children:[e.jsx(Fs,{className:"w-3.5 h-3.5"})," Gerar versão modelada"]})]},t))})]})}),L&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",onClick:()=>ws(null),"data-testid":"modal-thumbnail-lab",children:e.jsxs("div",{className:"w-full max-w-xl max-h-[85vh] overflow-y-auto rounded-2xl border border-cyan-400/20 bg-[#0a0f1c] p-5 md:p-6 shadow-2xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 text-cyan-200",children:[e.jsx(Ae,{className:"w-5 h-5"}),e.jsx("h2",{className:"text-lg font-semibold",children:"Plano de Thumbn
5ail"})]}),e.jsx("button",{className:b+" !px-2 !py-1",onClick:()=>ws(null),"data-testid":"button-close-thumbnail",children:"Fechar"})]}),e.jsxs("p",{className:"text-xs text-zinc-500 mb-4",children:["Consultivo para ",e.jsx("span",{className:"text-cyan-300",children:L.title}),". Guia a arte da capa â não altera a renderização do vÃdeo."]}),e.jsxs("div",{className:"space-y-3 text-sm",children:[[["Conceito",L.plan.concept],["Sujeito focal",L.plan.focalSubject],["Texto na capa",L.plan.textOverlay],["Emoção",L.plan.emotion],["Contraste de cor",L.plan.colorContrast],["Composição",L.plan.composition]].filter(([,s])=>!!s).map(([s,t])=>e.jsxs("div",{className:"rounded-xl border border-white/10 bg-white/[0.03] p-3","data-testid":`thumbnail-field-${s}`,children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cyan-300/70",children:s}),e.jsx("p",{className:"text-zinc-200 mt-0.5",children:t})]},s)),(L.plan.doList?.length>0||L.plan.avoidList?.length>0)&&e.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[L.plan.doList?.length>0&&e.jsxs("div",{className:"rounded-xl border border-emerald-400/15 bg-emerald-500/[0.05] p-3",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-emerald-300",children:"Fazer"}),e.jsx("ul",{className:"mt-1 space-y-1 text-[12px] text-zinc-300 list-disc list-inside",children:L.plan.doList.map((s,t)=>e.jsx("li",{children:s},t))})]}),L.plan.avoidList?.length>0&&e.jsxs("div",{className:"rounded-xl border border-rose-400/15 bg-rose-500/[0.05] p-3",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-wide text-rose-300",children:"Evitar"}),e.jsx("ul",{className:"mt-1 space-y-1 text-[12px] text-zinc-300 list-disc list-inside",children:L.plan.avoidList.map((s,t)=>e.jsx("li",{children:s},t))})]})]})]})]})}),Bs&&e.jsx(Kt,{runId:Bs,onClose:()=>Gs(null)})]})}const ue={pt:"ð§ð·",en:"ðºð¸",es:"ðªð¸",fr:"ð«ð·",de:"ð©ðª",it:"ð®ð¹",ja:"ð¯ðµ"},Wt={pt:"PT",en:"EN",es:"ES",fr:"FR",de:"DE",it:"IT",ja:"JA"},Ma={pt:"Português",en:"Inglês",es:"Espanhol",fr:"Francês",de:"Alemão",it:"Italiano",ja:"Japonês"};function Xe({lang:a,dim:l}){const c=String(a||"").toLowerCase().slice(0,2),n=ue[c]||"ð",o=Wt[c]||c.toUpperCase();return e.jsxs("span",{className:p("inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] font-mono font-medium leading-none",l?"bg-white/[0.03] border border-white/[0.07] text-zinc-500":"bg-cyan-500/10 border border-cyan-400/20 text-cyan-200"),children:[e.jsx("span",{children:n})," ",e.jsx("span",{children:o})]})}function La({o:a,onValidate:l,onDiscard:c,busy:n}){const o=y=>`/videos/novo?style=money&opportunityId=${encodeURIComponent(a.id)}&language=ar&visualShieldMode=${y}&complianceProfile=reinforced`,u=a.metadata||{},j=u.winningVideo||null,z=u.nicheLabel,T=u.subnicheLabel,m=a.status==="validated",f=a.status==="validated"||a.status==="in_production"?"good":a.status==="discarded"?"bad":"default";return e.jsxs("div",{className:k,"data-testid":`arabic-opportunity-${a.id}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[e.jsx("span",{className:"rounded-md bg-amber-500/10 border border-amber-400/25 px-1.5 py-0.5 text-[10px] text-amber-300",children:"ð¸ð¦ Mina de Ouro"}),e.jsx(ae,{label:Ua[a.status]||a.status,tone:f}),e.jsx(Ya,{o:a}),e.jsxs("span",{className:"ml-auto text-[11px] text-zinc-500 inline-flex items-center gap-1",children:[e.jsx("span",{children:ue[a.sourceLanguage]||"ð"})," â ",e.jsx("span",{children:ue[a.targetLanguage]||"ð"})]})]}),(z||T)&&e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[z&&e.jsx("span",{className:"rounded-md bg-white/[0.04] border border-white/10 px-1.5 py-0.5 text-[10px] text-zinc-400",children:z}),T&&e.jsx("span",{className:"rounded-md bg-cyan-500/10 border border-cyan-400/20 px-1.5 py-0.5 text-[10px] text-cyan-200",children:T})]}),e.jsxs("div",{className:"rounded-lg border border-cyan-400/15 bg-cyan-500/[0.04] px-3 py-2.5 mb-3",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-cyan-300/70 mb
5-1",children:"ð¸ð¦ Sua versão em árabe"}),a.suggestedTitle?e.jsx("h3",{dir:"rtl",className:"text-base font-semibold text-white leading-snug",children:a.suggestedTitle}):e.jsx("p",{className:"text-sm text-zinc-400",children:"Análise pendenteâ¦"}),a.niche&&e.jsx("p",{className:"text-xs text-zinc-400 mt-1.5",children:a.niche})]}),e.jsxs("div",{className:"flex items-start gap-2.5 mb-3 rounded-lg border border-white/[0.06] bg-white/[0.02] px-2.5 py-2",children:[a.thumbnailUrl?e.jsx("img",{src:a.thumbnailUrl,alt:"",className:"w-16 h-10 rounded object-cover border border-white/10 shrink-0 mt-0.5",loading:"lazy"}):e.jsx("div",{className:"w-16 h-10 rounded border border-white/10 bg-white/[0.03] shrink-0 mt-0.5 flex items-center justify-center",children:e.jsx(Us,{className:"w-4 h-4 text-zinc-600"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-zinc-600 mb-0.5 flex items-center gap-1",children:[e.jsx("span",{children:ue[a.sourceLanguage]||"ð"}),e.jsx("span",{children:"VÃdeo original â Inglês"})]}),a.videoTitle?e.jsx("p",{className:"text-xs text-zinc-400 line-clamp-2 leading-snug",children:a.videoTitle}):e.jsx("p",{className:"text-xs text-zinc-500 italic leading-snug",children:"Sem vÃdeo de referência ainda â a IA não ancorou um vencedor real para esta ideia."}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-zinc-600 flex-wrap",children:[a.viewCount!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Views do vÃdeo original",children:[e.jsx(Te,{className:"w-3 h-3"}),E(a.viewCount)]}),a.subscriberCount!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Inscritos do canal de origem",children:[e.jsx(pe,{className:"w-3 h-3"}),E(a.subscriberCount)]}),j?.durationSec!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Duração do vÃdeo original",children:[e.jsx(Je,{className:"w-3 h-3"}),Ga(j.durationSec)]}),j?.ageDays!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Há quanto tempo foi publicado",children:[e.jsx(Se,{className:"w-3 h-3"}),Ka(j.ageDays)]}),a.channelTitle&&e.jsx("span",{className:"truncate max-w-[8rem]",children:a.channelTitle})]})]})]}),a.videoUrl&&e.jsxs("a",{href:a.videoUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 w-full mb-3 rounded-lg bg-red-600/90 hover:bg-red-600 text-white text-xs font-semibold py-2 px-3 transition-colors",title:"Abrir o vÃdeo vencedor original no YouTube","data-testid":`link-arabic-original-video-${a.id}`,children:[e.jsx(Ce,{className:"w-4 h-4"})," Ver vÃdeo original no YouTube ",e.jsx(ie,{className:"w-3 h-3 opacity-70"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[e.jsx(U,{gateKey:"opportunity",score:a.opportunityScore,label:"Oport."}),e.jsx(U,{gateKey:"gap",score:a.gapScore,label:"Gap"}),a.roiScore!=null&&e.jsx(U,{gateKey:"roi",score:a.roiScore,label:"ROI"}),a.titleScore!=null&&e.jsx(U,{gateKey:"title",score:a.titleScore,label:"TÃtulo"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-3 border-t border-white/5",children:[e.jsxs(Q,{href:o("chaos"),className:p(q,"!py-2 !px-3 text-xs"),"data-testid":`link-arabic-chaos-${a.id}`,children:[e.jsx(me,{className:"w-3.5 h-3.5"})," Avançar â Caos Organizado"]}),e.jsxs(Q,{href:o("narrasync"),className:p(b,"!py-2 !px-3 !border-cyan-400/30 !text-cyan-200"),"data-testid":`link-arabic-cartoon-${a.id}`,children:[e.jsx(se,{className:"w-3.5 h-3.5"})," Cartoon (personagem)"]}),!m&&l&&e.jsxs("button",{className:p(b,"!border-emerald-400/30 !text-emerald-300"),disabled:n,onClick:l,"data-testid":`button-arabic-validate-${a.id}`,children:[e.jsx(ne,{className:"w-3.5 h-3.5"})," Salvar em Oportunidades Validadas"]}),a.status!=="discarded"&&c&&e.jsxs("button",{className:b,disabled:n,onClick:c,"data-testid":`button-arabic-discard-${a.id}`,children:[e.jsx(le,{className:"w-3.5 h-3.5"})," Descartar"]})]})]})}function Jt(a){const l=a.metadata||{},c=l.winningVideo||null;return l.proofStatus==="verified"||c?.passes?"verified":l.proofStatus==="weak"?"weak":l.proofStatus==="missing"?"missing":null}function Ya({o:a}){const l=Jt(a);return l==="verified"?e.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-emerald-500/10 border border-emerald-400/30 px-1.5 py-0.5 text-[10px] text-emerald-300",title:"Ancorado em um vÃdeo vencedor REAL que passou na régua: canal pequeno, publicado há pouco, muitas views e duração monetizável.","data-testid":`proof-verified-${a.id}`,children:[e.jsx(Fa,{className:"w-3 h-3"})," Comprovado"]}):l==="weak"?e.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-amber-500/10 border border-amber-400/25 px-1.5 py-0.5 text-[10px] text-amber-300",title:"Tem um vÃdeo de origem real, mas fora da régua ideal (canal grande, antigo ou curto).","data-testid":`proof-weak-${a.id}`,children:[e.jsx(he,{className:"w-3 h-3"})," Fonte fraca"]}):l==="missing"?e.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-zinc-500/10 border border-zinc-400/20 px-1.5 py-0.5 text-[10px] text-zinc-400",title:"Ainda sem um vÃdeo vencedor real comprovando esta ideia â use com cautela.","data-testid":`proof-missing-${a.id}`,children:[e.jsx(He,{className:"w-3 h-3"})," Sem fonte comprovada"]}):null}function qa({o:a,validated:l,moneyStyleEnabled:c,busy:n,siblingsInProduction:o,produced:u,onValidate:j,onDiscard:z,onPropose:T,onCreateBatch:m,onThumbnailLab:f,thumbBusy:y}){const O=!!a.suggestedTitle,G=(a.metadata||{}).winningVideo||null,H=(a.metadata||{}).targetFormat==="reels",D=String(a.targetLanguage||"pt").toLowerCase().slice(0,2),M=String(a.sourceLanguage||"en").toLowerCase().slice(0,2),_=Ma[D]||D.toUpperCase(),W=Ma[M]||M.toUpperCase(),Ie=(o||0)>=2;return e.jsxs("div",{className:k,"data-testid":`opportunity-${a.id}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3 flex-wrap",children:[a.source==="genesis"&&e.jsx("span",{className:"rounded-md bg-fuchsia-500/10 border border-fuchsia-400/20 px-1.5 py-0.5 text-[10px] text-fuchsia-200",children:"Genesis"}),H&&e.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-cyan-500/10 border border-cyan-400/30 px-1.5 py-0.5 text-[10px] text-cyan-300",title:"Oportunidade garimpada no modo Reels â vÃdeo vertical 9:16 curto","data-testid":`badge-reels-${a.id}`,children:[e.jsx(We,{className:"w-3 h-3"})," Reels 9:16"]}),e.jsx(ae,{label:Ua[a.status]||a.status,tone:a.status==="in_production"?"good":"default"}),e.jsx(Ya,{o:a}),u&&e.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-emerald-500/15 border border-emerald-400/30 px-1.5 py-0.5 text-[10px] text-emerald-300",title:"Você já produziu este vÃdeo até o fim â não precisa produzir de novo.","data-testid":`badge-produced-${a.id}`,children:[e.jsx(qs,{className:"w-3 h-3"})," Já produzido"]}),Ie&&e.jsxs("span",{className:"flex items-center gap-1 rounded-md bg-amber-500/10 border border-amber-400/25 px-1.5 py-0.5 text-[10px] text-amber-300",title:`${o} versões deste mesmo viral já estão em produção`,children:[e.jsx(he,{className:"w-3 h-3"}),o," versões deste viral em produção"]}),e.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.jsx(Xe,{lang:M,dim:!0}),e.jsx("span",{className:"text-zinc-600 text-[10px]",children:"â"}),e.jsx(Xe,{lang:D})]})]}),e.jsxs("div",{className:"rounded-lg border border-cyan-400/15 bg-cyan-500/[0.04] px-3 py-2.5 mb-3",children:[e.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-cyan-400/60 mb-1 flex items-center gap-1",children:[e.jsx("span",{children:ue[D]||"ð"}),e.jsxs("span",{children:["Sua versão a produzir â em ",_]})]}),O?e.jsx("h3",{className:"font-semibold text-white leading-snug text-sm","data-testid":`opportunity-title-${a.id}`,children:a.suggestedTitle}):e.jsx("p",{className:"text-xs text-zinc-500 italic",children:"Análise de IA pendenteâ¦"}),a.niche&&e.jsx("p",{className:"text-[11px] text-cyan-300/60 mt-1 capitalize",children:a.niche})]}),e.jsxs("div",{className:"flex items-start gap-2.5 mb-3 rounded-lg border border-white/[0.06] bg-white/[0.02] px-2.5 py-2",children:[a.thumbnailUrl&&e.jsx("img",{src:a.thumbnailUrl,alt:"",className:"w-16 h-10 rounded object-cover border border-white/10 shrink-0 mt-0.5",loading:"lazy"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-zinc-600 mb-0.5 flex items-center gap-1",children:[e.jsx("span",{children:ue[M]||"ð"}),e.jsxs("span",{children:["Referência â ",W]})]}),e.jsx("p",{className:"text-xs text-zinc-400 line-clamp-2 leading-snug",children:a.videoTitle||"â"}),e.jsxs("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-zinc-600 flex-wrap",children:[a.viewCount!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Views do vÃdeo original",children:[e.jsx(Te,{className:"w-3 h-3"}),E(a.viewCount)]}),a.subscriberCount!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Inscritos do canal de origem",children:[e.jsx(pe,{className:"w-3 h-3"}),E(a.subscriberCount)]}),G?.durationSec!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Duração do vÃdeo original",children:[e.jsx(Je,{className:"w-3 h-3"}),Ga(G.durationSec)]}),G?.ageDays!=null&&e.jsxs("span",{className:"inline-flex items-center gap-0.5",title:"Há quanto tempo o vÃdeo foi publicado",children:[e.jsx(Se,{className:"w-3 h-3"}),Ka(G.ageDays)]}),a.channelTitle&&e.jsx("span",{className:"truncate max-w-[8rem]",children:a.channelTitle})]})]})]}),a.videoUrl&&e.jsxs("a",{href:a.videoUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 w-full mb-3 rounded-lg bg-red-600/90 hover:bg-red-600 text-white text-xs font-semibold py-2 px-3 transition-colors",title:"Abrir o vÃdeo vencedor original no YouTube","data-testid":`link-original-video-${a.id}`,children:[e.jsx(Ce,{className:"w-4 h-4"})," Ver vÃdeo original no YouTube ",e.jsx(ie,{className:"w-3 h-3 opacity-70"})]}),(a.titleFormula||a.emotionalEngine)&&e.jsxs("div",{className:"mb-3 space-y-0.5",children:[a.titleFormula&&e.jsxs("p",{className:"text-xs text-zinc-400",children:[e.jsx("span",{className:"text-zinc-600",children:"Fórmula:"})," ",a.titleFormula]}),a.emotionalEngine&&e.jsxs("p",{className:"text-xs text-zinc-400",children:[e.jsx("span",{className:"text-zinc-600",children:"Motor:"})," ",a.emotionalEngine]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-3",children:[e.jsx(U,{score:a.opportunityScore,label:"Oport",gateKey:"opportunity"}),e.jsx(U,{score:a.outlierScore,label:"Outlier",gateKey:"outlier"}),e.jsx(U,{score:a.gapScore,label:"Gap",gateKey:"gap"}),a.roiScore!=null&&e.jsx(U,{score:a.roiScore,label:"ROI",gateKey:"roi"}),a.titleScore!=null&&e.jsx(U,{score:a.titleScore,label:"TÃtulo",gateKey:"title"})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-3 border-t border-white/5",children:l?e.jsxs(e.Fragment,{children:[c&&(a.status==="in_production"?e.jsxs(Q,{href:H?"/videos/reels":"/videos",className:b+" !py-2 !px-3 text-xs !border-cyan-400/30 !text-cyan-300","data-testid":`link-view-project-${a.id}`,children:[e.jsx(te,{className:"w-3.5 h-3.5"})," Ver no estúdio"]}):H?e.jsxs(Q,{href:`/videos/reels/novo?opp=${a.id}`,className:q+" !py-2 !px-3 text-xs","data-testid":`link-generate-reel-${a.id}`,children:[e.jsx(We,{className:"w-3.5 h-3.5"})," Gerar nosso Reel"]}):(o||0)>=3?e.jsxs(Q,{href:`/videos/novo?style=money&opportunityId=${a.id}&language=${encodeURIComponent(a.targetLanguage||"pt")}`,className:b+" !py-2 !px-3 text-xs !border-amber-400/30 !text-amber-300","data-testid":`link-generate-modeled-${a.id}`,title:`Atenção: ${o} versões deste viral já em produção. O servidor bloqueará se o limite for atingido.`,children:[e.jsx(he,{className:"w-3.5 h-3.5"})," Gerar versão modelada"]}):e.jsxs(Q,{href:`/videos/novo?style=money&opportunityId=${a.id}&language=${encodeURIComponent(a.targetLanguage||"pt")}`,className:q+" !py-2 !px-3 text-xs","data-testid":`link-generate-modeled-${a.id}`,children:[e.jsx(Fs,{className:"w-3.5 h-3.5"})," Gerar versão modelada"]})),e.jsxs("button",{className:b,disabled:n,onClick:T,"data-testid":`button-propose-${a.id}`,children:[e.jsx(te,{className:"w-3.5 h-3.5"})," Modelar canal"]}),e.jsxs("button",{className:b,disabled:n,onClick:m,"data-testid":`button-create-batch-${a.id}`,children:[e.jsx(Ae,{className:"w-3.5 h-3.5"})," Lote de teste"]}),c&&f&&e.jsxs("button",{className:b,disabled:y,onClick:f,"data-testid":`button-thumbnail-lab-${a.id}`,children:[y?e.jsx(g,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ae,{className:"w-3.5 h-3.5"})," Plano de thumbnail"]}),e.jsx("button",{className:b,disabled:n,onClick:z,"data-testid":`button-discard-${a.id}`,children:e.jsx(le,{className:"w-3.5 h-3.5"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:q+" !py-2 !px-3 text-xs",disabled:n,onClick:j,"data-testid":`button-validate-${a.id}`,children:[e.jsx(ne,{className:"w-3.5 h-3.5"})," Validar"]}),e.jsxs("button",{className:b,disabled:n,onClick:z,"data-testid":`button-discard-${a.id}`,children:[e.jsx(le,{className:"w-3.5 h-3.5"})," Descartar"]})]})})]})}export{zi 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.