1import{j as e}from"./vendor-motion-CPxq9Xvn.js";import{r as i}from"./vendor-i18n-CO3kK2bH.js";import{a3 as j,ai as v,a1 as y,u as w,a6 as N,a as l,aK as S,S as k,C,K as T,X as P,a7 as q,an as z}from"./index-CFAvyuXu.js";import{V as Y}from"./videos-shell-Dt9iLSCb.js";import{e as V,Y as E,C as A,b as F}from"./canal-DH9VlWNH.js";import{A as R}from"./arrow-left-DY50GvQQ.js";import{Y as d}from"./youtube-C3-YPqKU.js";import{P as m}from"./pen-line-CUCmRVJi.js";import{S as L}from"./save-QXxXVhhp.js";import"./vendor-react-CQmBMThG.js";import"./layout-dashboard-pnVssBCT.js";import"./videoStyles-178hiNMB.js";import"./file-up-CUoIUHm5.js";import"./trash-2-BF2rPJAw.js";import"./film-5Ww7nMCK.js";import"./square-play-B4-TDS12.js";import"./pencil-DB7EhnQs.js";import"./wand-sparkles-BFRdHggN.js";import"./target-CjPWrUoS.js";import"./list-checks-EUoF5j-U.js";import"./circle-x-DhBMAj3Y.js";import"./lightbulb-BvSG_Icx.js";import"./calendar-clock-yFtimZeY.js";import"./flame-BHmbROUi.js";import"./circle-play-BeGABqqs.js";function de(){const{toast:s}=j(),x=v(),[,u]=y(),[o,p]=i.useState(V()),[h,b]=i.useState(!1),f=w({queryKey:["/api/videos/youtube/config"]}).data?.available!==!1;i.useEffect(()=>{const a=new URLSearchParams(window.location.search),t=a.get("yt_error");
1if(t){s({title:"Não foi possÃvel conectar o YouTube",description:E[t]||"Tente novamente.",variant:"destructive"}),a.delete("yt_error"),a.delete("yt");const c=a.toString();window.history.replaceState({},"",window.location.pathname+(c?`?${c}`:""))}},[]);const n=N({mutationFn:async()=>(await z("POST","/api/videos/channels",F(o))).json(),onSuccess:a=>{x.invalidateQueries({queryKey:["/api/videos/channels"]}),s({title:"Canal criado",description:"Você já pode conectar o YouTube e ajustar o briefing quando quiser."}),u(`/videos/canais/${a.id}`)},onError:a=>s({title:"Não foi possÃvel criar",description:a?.message,variant:"destructive"})}),r=o.name.trim().length>0,g=()=>{window.location.href="/api/videos/youtube/connect-new"};return e.jsx(Y,{children:e.jsxs("div",{className:"max-w-3xl mx-auto px-4 md:px-6 py-8 pb-28",children:[e.jsx(l,{href:"/videos",children:e.jsxs("button",{className:"flex items-center gap-2 text-sm text-zinc-400 hover:text-zinc-200 mb-6","data-testid":"button-back",children:[e.jsx(R,{className:"h-4 w-4"})," Meus canais"]})}),e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl bg-gradient-to-br from-blue-500 to-cyan-400 flex items-center justify-center",children:e.jsx(S,{className:"h-5 w-5 text-white"})}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold tracking-tight","data-testid":"text-page-title",children:"Novo canal"})]}),e.jsx("p",{className:"text-zinc-400 mb-8",children:"Conecte o seu canal do YouTube e a Sábhia já entende sozinha o nome, o nicho, o idioma e o público â você só ajusta o que faltar."}),e.jsxs("section",{className:"relative overflow-hidden rounded-3xl border border-cyan-500/25 bg-gradient-to-br from-[#10224a]/50 via-[#0c1730]/45 to-[#0a1428]/35 p-6 md:p-8","data-testid":"hero-connect-youtube",children:[e.jsx("div",{className:"pointer-events-none absolute -top-16 -right-16 h-56 w-56 rounded-full bg-cyan-500/20 blur-3xl"}),e.jsx("div",{className:"pointer-events-none absolute -bottom-20 -left-10 h-48 w-48 rounded-full bg-blue-500/20 blur-3xl"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-2xl bg-gradient-to-br from-red-500 to-red-600 flex items-center justify-center shadow-lg shadow-red-900/40 shrink-0",children:e.jsx(d,{className:"h-7 w-7 text-white"})}),e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-blue-500/20 px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wider text-cyan-200",children:[e.jsx(k,{className:"h-3 w-3"})," Recomendado"]}),e.jsx("h2",{className:"mt-1 text-xl md:text-2xl font-bold text-white leading-tight",children:"Conectar canal do YouTube"})]})]}),e.jsx("ul",{className:"space-y-2 mb-6",children:["Importamos automaticamente nome, nicho, idioma, descrição e temas do seu canal.","Você usa o SEU próprio canal â continua dono de tudo.","Pode desconectar quando quiser, com um clique."].map((a,t)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-zinc-200/90",children:[e.jsx(C,{className:"h-4 w-4 text-cyan-300 shrink-0 mt-0.5"})," ",a]},t))}),f?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:g,className:"inline-flex items-center justify-center gap-2 rounded-2xl bg-gradient-to-r from-blue-500 to-cyan-400 px-6 py-3.5 font-semibold text-white shadow-lg shadow-blue-900/40 hover:opacity-95","data-testid":"button-connect-youtube",children:[e.jsx(d,{className:"h-5 w-5"})," Conectar com o YouTube"]}),e.jsxs("p",{className:"mt-3 flex items-center gap-1.5 text-xs text-zinc-400",children:[e.jsx(T,{className:"h-3.5 w-3.5 text-emerald-400"}),"Você autoriza com segurança no Google. A Sábhia nunca vê a sua senha."]}),e.jsxs("p",{className:"mt-2 text-[11px] leading-relaxed text-zinc-500","data-testid":"text-connect-legal",children:["Ao conectar, você concorda com os"," ",e.jsx("a",{href:"https://www.youtube.com/t/terms",target:"_blank",rel:"noopener noreferrer",className:"text-cyan-400 hover:text-cyan-300 underline underline-offset-2","data-testid":"link-novo-canal-yt-tos",children:"Termos do YouTube"})," ","e a"," ",e.jsx("a",{href:"https://policies.google.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-cyan-400 hover:text-cyan-300 underline underline-offset-2","data-testid":"link-novo-canal-google-privacy",children:"PolÃtica de Privacidade do Google"}),". Veja como tratamos seus dados na nossa"," ",e.jsx(l,{href:"/privacidade",className:"text-cyan-400 hover:text-cyan-300 underline underline-offset-2","data-testid":"link-novo-canal-sabhia-privacy",children:"PolÃtica de Privacidade"}),"."]})]}):e.jsxs("div",{className:"flex items-start gap-3 rounded-xl bg-amber-500/[0.07] border border-amber-500/20 px-4 py-3","data-testid":"state-connect-unavailable",children:[e.jsx(P,{className:"h-5 w-5 text-amber-400 shrink-0 mt-0.5"}),e.jsx("span",{className:"text-sm text-amber-100/90",children:"A conexão com o YouTube ainda não foi habilitada nesta plataforma. Fale com o administrador para configurar as credenciais do Google â enquanto isso, você pode criar o canal manualmente abaixo."})]})]})]}),e.jsxs("div",{className:"my-8 flex items-center gap-4",children:[e.jsx("div",{className:"h-px flex-1 bg-white/10"}),e.jsx("span",{className:"text-xs uppercase tracking-[0.18em] text-zinc-600",children:"ou"}),e.jsx("div",{className:"h-px flex-1 bg-white/10"})]}),h?e.jsxs("div",{"data-testid":"section-manual",children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2 text-sm text-zinc-400",children:[e.jsx(m,{className:"h-4 w-4 text-cyan-400"}),e.jsx("span",{children:"Só o nome é obrigatório. Você pode conectar o YouTube depois para importar o resto."})]}),e.jsx(A,{form:o,setForm:p}),e.jsxs("div",{className:"mt-8 flex flex-col sm:flex-row sm:items-center gap-3",children:[e.jsxs("button",{onClick:()=>n.mutate(),disabled:!r||n.isPending,className:"inline-flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-blue-500 to-cyan-400 px-5 py-3 font-semibold text-white shadow-lg shadow-blue-900/40 hover:opacity-95 disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"button-create-channel",children:[n.isPending?e.jsx(q,{className:"h-5 w-5 animate-spin"}):e.jsx(L,{className:"h-5 w-5"}),"Criar canal"]}),!r&&e.jsx("span",{className:"text-sm text-zinc-500","data-testid":"text-need-name",children:"Dê um nome ao canal para continuar."})]})]}):e.jsxs("button",{onClick:()=>b(!0),className:"w-full flex items-center justify-center gap-2 rounded-2xl border border-white/10 px-5 py-4 text-sm font-medium text-zinc-300 hover:border-cyan-500/30 hover:text-white hover:bg-cyan-500/[0.04] transition-colors","data-testid":"button-start-manual",children:[e.jsx(m,{className:"h-4 w-4"})," Começar sem conectar (preencher manualmente)"]})]})})}export{de 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.