PageSourceSearch

https://epicos.ai/assets/index-QS9XXI_T.js

js epicos.ai collected 2026-10-05 13:30:58 UTC 78,761 bytes, 3 lines download raw bytes

1import{j as e,dS as ga,dT as va,c as Qe,dU as fa,i as ee,k as $,t as w,f3 as B,am as W,el as ja,em as ba,hE as Na,hF as ya,aC as Je,p as je,v as H,y as Ae,f6 as Sa,q as Ke,dN as Ze,dO as Ye,a8 as de,n as _,bt as me,b0 as P,dQ as ea,ae as M,aa as ke,ab as De,ac as Ee,ad as Te,af as ue,aI as wa,aJ as _a,aK as Ca,aW as ka,u as Da,R as aa,U as sa,V as ta,W as ra,aG as oa,cn as Ea,H as Ta,I as Pa,J as Ra,K as Aa,L as $a,M as La,N as za,O as Be,hG as Fa,Q as Oa,X as ne,aQ as Pe,_ as Ma,bM as Va,aZ as qa,aE as Ba}from"./index-DdokvTmJ.js";import{r as i,t as Ua,ag as Ia,X as na,q as $e,a2 as Le,ac as Xa,L as ce,a_ as Ga,u as be,br as ia,C as Ne,b4 as ze,as as Ha,ap as la,p as Ue,ca as Wa,ad as ca,N as Fe,P as da,_ as Qa,f as Ja,h as Ka,G as Oe,e as Za,s as Ya,K as es,au as as,bp as ss,g as ts,aF as rs,b as os}from"./lucide-icons-DcjOfOJe.js";import{S as ns}from"./SecondaryTabs-DRys9Sxf.js";import"./cursoService-AIot3Osb.js";import"./agenteService-Du9YDNOt.js";import"./widgetService-BZBmUqx3.js";import"./llmService-qabMXeK8.js";import"./ferramentaService-B0c1xQZh.js";import"./precoService-DV6MZbFy.js";import"./permissoesService-BQ6TojaE.js";import{a as is,b as ls,c as cs,d as ds,e as ms,f as us,g as ps}from"./index-DzSuNYOn.js";function xs(){const[a,s]=i.useState(!1);return e.jsxs(ga,{open:a,onOpenChange:s,children:[e.jsxs(va,{className:"flex w-full items-center gap-2 rounded-lg border border-[var(--n200)] bg-[var(--bg-2)] px-3 py-2 text-left transition-colors hover:bg-[var(--bg-1)]",children:[e.jsx(Ua,{className:"h-4 w-4 shrink-0 text-[var(--brand)]"}),e.jsx("span",{className:"flex-1 text-xs font-medium text-[var(--text-1)]",children:"Como funciona: dois jeitos de enviar com a cara da instituição"}),e.jsx(Ia,{className:Qe("h-4 w-4 shrink-0 text-[var(--text-3)] transition-transform",a&&"rotate-180")})]}),e.jsx(fa,{children:e.jsxs("div",{className:"mt-2 space-y-3 rounded-lg border border-[var(--n200)] bg-white p-4 text-xs leading-relaxed text-[var(--text-2)]",children:[e.jsxs("p",{children:["Sem nenhuma configuração, todo e-mail sai pela Lemear, com o nosso endereço. Para ele chegar com a cara da instituição existem ",e.jsx("strong",{children:"dois caminhos"}),", e a escolha é por tipo de e-mail — dá para usar um para o login e outro para os disparos."]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border border-[var(--n200)] p-3",children:[e.jsx("p",{className:"text-xs font-semibold text-[var(--text-1)]",children:"1. Pelo servidor da instituição"}),e.jsxs("p",{className:"mt-1",children:["O e-mail sai do provedor dela (Google Workspace, Microsoft 365, Zoho, servidor próprio). Você cadastra host, porta, usuário e senha na aba"," ",e.jsx("strong",{children:"Servidores de e-mail"}),"."]}),e.jsx("p",{className:"mt-1.5 text-[var(--text-3)]",children:"Não precisa mexer no DNS por nossa causa: quem assina é o provedor dela."})]}),e.jsxs("div",{className:"rounded-md border border-[var(--n200)] p-3",children:[e.jsx("p",{className:"text-xs font-semibold text-[var(--text-1)]",children:"2. Pela Lemear, com o endereço dela"}),e.jsxs("p",{className:"mt-1",children:["O e-mail continua saindo daqui, mas o remetente é o da instituição. Para isso ela autoriza a assinatura publicando alguns registros no DNS, na aba"," ",e.jsx("strong",{children:"Domínios de envio"}),"."]}),e.jsx("p",{className:"mt-1.5 text-[var(--text-3)]",children:"Não precisa de senha nenhuma — a autorização é o próprio DNS."})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[420px] border-collapse text-[11px]",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--n200)] text-left text-[var(--text-3)]",children:[e.jsx("th",{className:"py-1 pr-2 font-medium",children:" "}),e.jsx("th",{className:"py-1 pr-2 font-medium",children:"Servidor da instituição"}),e.jsx("th",{className:"py-1 font-medium",children:"Lemear com o endereço dela"})]})}),e.jsx("tbody",{children:[["O que configurar","Host, porta, usuário e senha","Registros no DNS"],["Precisa de senha","Sim","Não"],["Sabemos se foi entregue","Não","Sim"],["Sabemos se foi aberto","Não","Sim"],["Serve para envio em massa","Não recomendado","Sim"]].map(([r,t,o])=>e.jsxs("tr",{className:"border-b border-[var(--n100)] last:border-0",children:[e.jsx("td",{className:"py-1.5 pr-2 text-[var(--text-2)]",children:r}),e.jsx("td",{className:"py-1.5 pr-2 text-[var(--text-1)]",children:t}),e.jsx("td",{className:"py-1.5 text-[var(--text-1)]",children:o})]},r))})]})}),e.jsxs("p",{children:["Na aba ",e.jsx("strong",{children:"Quem usa cada servidor"})," você aponta cada tipo de e-mail para um destino. O que ficar sem destino próprio herda do"," ",e.jsx("strong",{children:"Padrão da instituição"}),"; sem ele, sai pela Lemear."]}),e.jsxs("p",{className:"rounded-md bg-[var(--bg-2)] px-2.5 py-2 text-[var(--text-2)]",children:[e.jsx("strong",{children:"Disparos proativos"})," (campanhas e envio em massa) só usam o caminho 2. Sem os avisos de entrega e de endereço inválido, não haveria como parar de enviar para caixas que não existem mais — o que queima a reputação do domínio da instituição."]})]})})]})}ee("/organizacoes",{entityName:"organização",updateMethod:"put",trailingSlash:!0});const hs=ee("/cliente",{entityName:"cliente",updateMethod:"put",trailingSlash:!0}),gs=hs.listar;ee("/disciplinas",{entityName:"disciplina",updateMethod:"put",trailingSlash:!0});ee("/eventos",{entityName:"evento",updateMethod:"put",trailingSlash:!0});ee("/bolsas-financiamentos",{entityName:"bolsa/financiamento",updateMethod:"put",trailingSlash:!0});ee("/institucionais",{entityName:"institucional",updateMethod:"put",trailingSlash:!0});ee("/cestas-servico",{entityName:"cesta de serviço",updateMethod:"put",trailingSlash:!0});ee("/tiposagente",{entityName:"tipo de agente",updateMethod:"put",trailingSlash:!0});ee("/noticias",{entityName:"notícia",updateMethod:"put",trailingSlash:!0});ee("/ofertas",{entityName:"oferta",updateMethod:"put",trailingSlash:!0});const L="/configuracoes/smtp";async function vs(a){const{data:s}=await $.get(`${L}/servidores`,{params:void 0});return s}async function fs(a,s,r){const{data:t}=await $.post(`${L}/servidores`,a,{params:void 0,headers:{"X-Recaptcha-Token":s}});return t}async function js(a,s,r,t){const{data:o}=await $.put(`${L}/servidores/${a}`,s,{params:void 0,headers:{"X-Recaptcha-Token":r}});return o}async function bs(a,s,r){await $.delete(`${L}/servidores/${a}`,{params:void 0,headers:{"X-Recaptcha-Token":s}})}async function Ns(a){const{data:s}=await $.get(`${L}/servidores/${a}/diagnostico`);return s}async function ys(a,s,r,t){const{data:o}=await $.post(`${L}/servidores/${a}/testar`,s,{params:void 0,headers:{"X-Recaptcha-Token":r}});return o}async function Ss(a){const{data:s}=await $.get(`${L}/dominios`,{params:void 0});return s}async function ws(a,s,r){const{data:t}=await $.post(`${L}/dominios`,a,{params:void 0,headers:{"X-Recaptcha-Token":s}});return t}async function _s(a,s,r){await $.delete(`${L}/dominios/${a}`,{params:void 0,headers:{"X-Recaptcha-Token":s}})}async function Cs(a,s,r){const{data:t}=await $.post(`${L}/dominios/${a}/verificar`,{},{params:void 0,headers:{"X-Recaptcha-Token":s}});return t}async function ks(a){const{data:s}=await $.get(`${L}/finalidades`,{params:void 0});return s}async function Ds(a,s,r,t){const{data:o}=await $.put(`${L}/finalidades/${a}`,s,{params:void 0,headers:{"X-Recaptcha-Token":r}});return o}async function Es(a,s,r){await $.delete(`${L}/finalidades/${a}`,{params:void 0,headers:{"X-Recaptcha-Token":s}})}async function Ts(a){const{data:s}=await $.get(`${L}/remetentes-disparo`,{params:void 0});return s}async function Ps(a,s,r){const{data:t}=await $.post(`${L}/remetentes-disparo`,a,{params:void 0,headers:{"X-Recaptcha-Token":s}});return t}async function Rs(a,s,r,t){const{data:o}=await $.put(`${L}/remetentes-disparo/${a}`,s,{params:void 0,headers:{"X-Recaptcha-Token":r}});return o}async function As(a,s,r){await $.delete(`${L}/remetentes-disparo/${a}`,{params:void 0,headers:{"X-Recaptcha-Token":s}})}async function $s(a,s,r){const{data:t}=await $.post(`${L}/remetentes-disparo/${a}/padrao`,{},{params:void 0,headers:{"X-Recaptcha-Token":s}});return t}const R={listarServidores:vs,criarServidor:fs,atualizarServidor:js,removerServidor:bs,testarServidor:ys,diagnosticarServidor:Ns,listarDominios:Ss,criarDominio:ws,removerDominio:_s,verificarDominio:Cs,listarMapa:ks,atualizarFinalidade:Ds,limparFinalidade:Es,listarRemetentesDisparo:Ts,criarRemetenteDisparo:Ps,atualizarRemetenteDisparo:Rs,removerRemetenteDisparo:As,tornarPadraoRemetenteDisparo:$s},re={smtpServidor:{entityType:"smtpServidor",displayName:"Servidor de e-mail",recaptchaAction:"remover_servidor_smtp"},smtpDominio:{entityType:"smtpDominio",displayName:"Domínio de envio",recaptchaAction:"remover_dominio_smtp"},smtpRemetenteDisparo:{entityType:"smtpRemetenteDisparo",displayName:"Remetente de disparo",recaptchaAction:"remover_remetente_disparo_smtp"}};function Ls(a){const[s,r]=i.useState([]),[t,o]=i.useState(!0),[x,m]=i.useState(!1),[n,p]=i.useState(null),c=i.useRef(!0),h=i.useCallback(async()=>{o(!0);try{const d=await R.listarServidores(a);c.current&&r(d)}catch(d){c.current&&w.error(B(d)||"Não foi possível carregar os servidores de e-mail.")}finally{c.current&&o(!1)}},[a]);i.useEffect(()=>(c.current=!0,h(),()=>{c.current=!1}),[h]);const g=i.useCallback(async d=>{m(!0);try{const v=await W("criar_servidor_smtp"),f=await R.criarServidor(d,v,a);return ja("smtpServidor",f.nome),await h(),f}catch(v){return ba("smtpServidor",B(v)),null}finally{c.current&&m(!1)}},[a,h]),j=i.useCallback(async(d,v)=>{m(!0);try{const f=await W("atualizar_servidor_smtp"),N=await R.atualizarServidor(d,v,f,a);return Na("smtpServidor",N.nome),await h(),N}catch(f){return ya("smtpServidor",B(f)),null}finally{c.current&&m(!1)}}
1,[h]),u=i.useCallback(async(d,v)=>{p(d);try{const f=await W("testar_servidor_smtp"),N=await R.testarServidor(d,v,f,a);return N.success?w.success(N.detail):w.error(N.detail),N.success}catch(f){return w.error(B(f)||"Erro ao testar a conexão SMTP."),!1}finally{c.current&&p(null)}},[]);return{servidores:s,carregando:t,salvando:x,testandoId:n,recarregar:h,criar:g,atualizar:j,testar:u}}function zs(a){const[s,r]=i.useState([]),[t,o]=i.useState(!0),[x,m]=i.useState(null),n=i.useRef(!0),p=i.useCallback(async(g=!1)=>{g||o(!0);try{const j=await R.listarMapa(a);n.current&&r(j)}catch(j){n.current&&w.error(B(j)||"Não foi possível carregar quem usa cada servidor.")}finally{n.current&&o(!1)}},[a]);i.useEffect(()=>(n.current=!0,p(),()=>{n.current=!1}),[p]);const c=i.useCallback(async(g,j)=>{m(g);try{const u=await W("definir_finalidade_smtp");return await R.atualizarFinalidade(g,j,u,a),w.success("Configuração salva."),await p(),!0}catch(u){return w.error(B(u)||"Erro ao salvar esta configuração."),!1}finally{n.current&&m(null)}},[a,p]),h=i.useCallback(async g=>{m(g);try{const j=await W("limpar_finalidade_smtp");return await R.limparFinalidade(g,j,a),w.success("Voltou a usar o padrão."),await p(),!0}catch(j){return w.error(B(j)||"Erro ao restaurar o padrão."),!1}finally{n.current&&m(null)}},[a,p]);return{mapa:s,carregando:t,salvandoFinalidade:x,recarregar:p,salvar:c,limpar:h}}function ge(a,s){var t,o;const r=(o=(t=a==null?void 0:a.response)==null?void 0:t.data)==null?void 0:o.detail;return typeof r=="string"&&r.trim()?r:B(a)||s}function Fs(a){const[s,r]=i.useState([]),[t,o]=i.useState(!0),[x,m]=i.useState(!1),[n,p]=i.useState(null),c=i.useRef(!0),h=i.useCallback(async()=>{o(!0);try{const d=await R.listarDominios(a);c.current&&r(d)}catch(d){c.current&&w.error(ge(d,"Não foi possível carregar os domínios de envio."))}finally{c.current&&o(!1)}},[a]);i.useEffect(()=>(c.current=!0,h(),()=>{c.current=!1}),[h]);const g=i.useCallback(async d=>{m(!0);try{const v=await W("criar_dominio_smtp"),f=await R.criarDominio(d,v,a);return w.success(`Domínio ${f.dominio} cadastrado. Copie os registros para o DNS.`),await h(),f}catch(v){return w.error(ge(v,"Não foi possível cadastrar este domínio.")),null}finally{c.current&&m(!1)}},[a,h]),j=i.useCallback(async d=>{try{const v=await W("remover_dominio_smtp");return await R.removerDominio(d,v,a),w.success("Domínio removido."),await h(),!0}catch(v){return w.error(ge(v,"Não foi possível remover este domínio.")),!1}},[a,h]),u=i.useCallback(async d=>{p(d);try{const v=await W("verificar_dominio_smtp"),f=await R.verificarDominio(d,v,a);return f.status==="verificado"?w.success(`${f.dominio} está verificado: o DKIM já está assinando.`):w.info("Ainda não verificado. Registros de DNS podem levar algum tempo para propagar."),r(N=>N.map(z=>z.id===f.id?f:z)),f.status==="verificado"}catch(v){return w.error(ge(v,"Não foi possível verificar este domínio agora.")),!1}finally{c.current&&p(null)}},[a,h]);return{dominios:s,carregando:t,salvando:x,verificandoId:n,recarregar:h,criar:g,remover:j,verificar:u}}function Os(){const{isMasterOrAdmin:a}=Je(),[s,r]=i.useState([]),[t,o]=i.useState(a);i.useEffect(()=>{if(!a){r([]),o(!1);return}let m=!0;return o(!0),gs({status:"ativo",limit:500},void 0,{fetchOpcional:!0}).then(n=>{var p;m&&r(((p=n==null?void 0:n.items)!=null?p:[]).map(c=>({id:c.id,nome:c.nome})))}).catch(()=>{m&&r([])}).finally(()=>{m&&o(!1)}),()=>{m=!1}},[a]);const x=a&&s.length>1;return{clientes:s,carregando:t,mostrarSeletor:x}}const Ms=["transacional","login","convite","redefinicao_senha","confirmacao_identidade_chat","disparo_proativo"],Vs=["pendente","verificado","falhou","temporario"],qs=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/,ma=/^[^@\s]+@[^@\s]+\.[^@\s]+$/,fe=H().trim().max(320).refine(a=>a===""||ma.test(a),"E-mail inválido").optional();Ae(Ms);const Bs=je({nome:H().trim().min(1,"Dê um nome para identificar este servidor").max(120),ativo:Ke(),host:H().trim().min(1,"Host é obrigatório").max(255),porta:Sa({invalid_type_error:"Informe uma porta válida"}).int("Porta deve ser um inteiro").min(1,"Porta inválida").max(65535,"Porta inválida"),seguranca:Ae(["starttls","ssl","none"]),usuario:H().trim().max(320).optional(),senha:H().max(1024).optional(),remetente_email:H().trim().min(1,"Remetente é obrigatório").regex(ma,"E-mail inválido").max(320),remetente_nome:H().trim().max(255).optional(),reply_to:fe,logo_url:H().trim().max(1024).optional()}),Us=je({dominio:H().trim().toLowerCase().min(3,"Informe o domínio da instituição").max(255).regex(qs,"Domínio inválido — informe algo como 'ies.edu.br', sem 'http://', caminho ou '@'.")});Ae(Vs);je({servidor_id:H().trim().optional(),dominio_id:H().trim().optional(),remetente_email:fe,remetente_nome:H().trim().max(255).optional(),reply_to:fe,permitir_fallback_ses:Ke()}).refine(a=>!!a.servidor_id!=!!a.dominio_id,{message:"Escolha um servidor OU um domínio de envio como destino desta finalidade.",path:["servidor_id"]}).refine(a=>!a.dominio_id||!!a.remetente_email,{message:"Informe o e-mail remetente — obrigatório ao enviar por um domínio de envio.",path:["remetente_email"]});je({destinatario:fe});const he="custom",xe=[{value:he,label:"Outro / Personalizado"},{value:"gmail",label:"Google / Gmail",host:"smtp.gmail.com",porta:587,seguranca:"starttls",hint:"Use uma Senha de App (verificação em 2 etapas ativada); usuário = e-mail completo.",cor:"#EA4335",sigla:"G",remetenteDaConta:"reescreve"},{value:"office365",label:"Microsoft 365 / Outlook",host:"smtp.office365.com",porta:587,seguranca:"starttls",cor:"#0078D4",sigla:"O",remetenteDaConta:"recusa"},{value:"ses",label:"Amazon SES",host:"email-smtp.us-east-1.amazonaws.com",porta:587,seguranca:"starttls",hint:"Ajuste a região no host (ex.: email-smtp.us-east-2.amazonaws.com) e use as credenciais SMTP do SES.",cor:"#EC7211",sigla:"S"}
1,{value:"brevo",label:"Brevo (Sendinblue)",host:"smtp-relay.brevo.com",porta:587,seguranca:"starttls",cor:"#0B996E",sigla:"B"},{value:"sendgrid",label:"SendGrid",host:"smtp.sendgrid.net",porta:587,seguranca:"starttls",hint:'Usuário fixo "apikey"; senha = a API key.',cor:"#1A82E2",sigla:"SG"},{value:"mailgun",label:"Mailgun",host:"smtp.mailgun.org",porta:587,seguranca:"starttls",cor:"#C02126",sigla:"MG"},{value:"postmark",label:"Postmark",host:"smtp.postmarkapp.com",porta:587,seguranca:"starttls",cor:"#E0A800",sigla:"P"},{value:"sparkpost",label:"SparkPost",host:"smtp.sparkpostmail.com",porta:587,seguranca:"starttls",cor:"#FA6423",sigla:"SP"},{value:"zoho",label:"Zoho Mail",host:"smtp.zoho.com",porta:587,seguranca:"starttls",cor:"#E42527",sigla:"Z",remetenteDaConta:"recusa"},{value:"smtp2go",label:"SMTP2GO",host:"mail.smtp2go.com",porta:587,seguranca:"starttls",cor:"#0AA5E0",sigla:"2G"},{value:"mailjet",label:"Mailjet",host:"in-v3.mailjet.com",porta:587,seguranca:"starttls",cor:"#E8890B",sigla:"MJ"},{value:"mailersend",label:"MailerSend",host:"smtp.mailersend.net",porta:587,seguranca:"starttls",cor:"#4A44E5",sigla:"MS"},{value:"elasticemail",label:"Elastic Email",host:"smtp.elasticemail.com",porta:2525,seguranca:"starttls",cor:"#1BA0E1",sigla:"EE"},{value:"sendlayer",label:"SendLayer",host:"smtp.sendlayer.net",porta:587,seguranca:"starttls",cor:"#F97316",sigla:"SL"},{value:"smtpcom",label:"SMTP.com",host:"send.smtp.com",porta:587,seguranca:"starttls",cor:"#2B6CB0",sigla:"SC"},{value:"mandrill",label:"Mandrill",host:"smtp.mandrillapp.com",porta:587,seguranca:"starttls",cor:"#CC3333",sigla:"M"},{value:"resend",label:"Resend",host:"smtp.resend.com",porta:587,seguranca:"starttls",hint:'Usuário fixo "resend"; senha = a API key.',cor:"#111827",sigla:"R"}];function Is(a){if(!a)return he;const s=a.trim().toLowerCase();if(/^email-smtp\..+\.amazonaws\.com$/.test(s))return"ses";const r=xe.find(t=>t.host&&t.host.toLowerCase()===s);return r?r.value:he}function Xs(a){const s=(a!=null?a:"").trim().toLowerCase();return/^smtp\.(gmail|googlemail)\.com$/.test(s)?"gmail":/^(smtp\.office365\.com|smtp-mail\.outlook\.com|smtp\.live\.com)$/.test(s)?"office365":/^smtp(pro)?\.zoho\.(com|eu|in|com\.au|com\.cn|jp|sa)$/.test(s)?"zoho":he}function Gs(a,s,r){const t=xe.find(n=>n.value===a),o=(s!=null?s:"").trim().toLowerCase(),x=(r!=null?r:"").trim().toLowerCase();if(!(t!=null&&t.remetenteDaConta)||!o.includes("@")||!x||x===o)return null;const m=`No ${t.label}, o remetente precisa ser a própria conta (${o}) ou um endereço autorizado nela`;return t.remetenteDaConta==="reescreve"?`${m}, cadastrado em "Enviar e-mail como". Se não for, o e-mail chega como ${o}.`:`${m}. Se não for, o provedor recusa o envio.`}const Hs={gmail:ps,brevo:us,mailgun:ms,sparkpost:ds,zoho:cs,mandrill:ls,resend:is},Ws={nome:"",ativo:!0,host:"",porta:587,seguranca:"starttls",usuario:"",senha:"",remetente_email:"",remetente_nome:"",reply_to:"",logo_url:""},pe=a=>{const s=(a!=null?a:"").trim();return s===""?void 0:s};function Qs(a){return{nome:a.nome.trim(),ativo:a.ativo,host:a.host.trim(),porta:a.porta,seguranca:a.seguranca,usuario:pe(a.usuario),senha:pe(a.senha),remetente_email:a.remetente_email.trim(),remetente_nome:pe(a.remetente_nome),reply_to:pe(a.reply_to),logo_url:pe(a.logo_url)}}function ve({children:a}){return e.jsxs(wa,{children:[e.jsx(_a,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Mais informações",className:"inline-flex text-muted-foreground transition-colors hover:text-foreground",children:e.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center rounded-full border border-current text-[9px] font-semibold leading-none",children:"i"})})}),e.jsx(Ca,{className:"max-w-xs text-xs leading-relaxed",children:a})]})}function Js({value:a,cor:s,sigla:r}){if(!s||!r)return e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded bg-muted text-muted-foreground",children:e.jsx(be,{className:"h-3 w-3"})});const t=Hs[a];return e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-[9px] font-bold leading-none text-white",style:{backgroundColor:s}
1,"aria-hidden":!0,children:t?e.jsx("svg",{viewBox:"0 0 24 24",className:"h-3 w-3 fill-current",role:"img",children:e.jsx("path",{d:t.path})}):r})}function Ie({valorInicial:a,salvando:s,onSalvar:r,onCancelar:t,onPreVisualizar:o,finalidadesQueUsam:x}){var te,Y,U,q,I,k,X,G;const[m,n]=i.useState(he),p=i.useRef(null),[c,h]=i.useState(!1),[g,j]=i.useState(null),{register:u,handleSubmit:d,watch:v,setValue:f,formState:{errors:N}}=Ze({resolver:Ye(Bs),defaultValues:a?{nome:a.nome,ativo:a.ativo,host:a.host,porta:a.porta,seguranca:a.seguranca,usuario:(te=a.usuario)!=null?te:"",senha:"",remetente_email:a.remetente_email,remetente_nome:(Y=a.remetente_nome)!=null?Y:"",reply_to:(U=a.reply_to)!=null?U:"",logo_url:(q=a.logo_url)!=null?q:""}:Ws});i.useEffect(()=>{n(Is(a==null?void 0:a.host))},[]);const z=b=>{var K,Z;n(b);const A=xe.find(D=>D.value===b);A!=null&&A.host&&(f("host",A.host,{shouldDirty:!0,shouldValidate:!0}),f("porta",(K=A.porta)!=null?K:587,{shouldDirty:!0}),f("seguranca",(Z=A.seguranca)!=null?Z:"starttls",{shouldDirty:!0}))},O=b=>{f("seguranca",b,{shouldDirty:!0}),b==="starttls"?f("porta",587,{shouldDirty:!0,shouldValidate:!0}):b==="ssl"&&f("porta",465,{shouldDirty:!0,shouldValidate:!0})},T=async b=>{await r(Qs(b))&&t()},S=async b=>{var K;const A=(K=b.target.files)==null?void 0:K[0];if(b.target.value="",!!A){if(!A.type.startsWith("image/")){w.error("Selecione um arquivo de imagem (PNG, JPG, SVG…).");return}h(!0);try{let Z;try{Z=await W("upload_file")}catch{}const D=await ka.uploadPermanente(A,"logo-smtp",null,Z);D!=null&&D.url?(f("logo_url",D.url,{shouldDirty:!0,shouldValidate:!0}),w.success("Logo enviada com sucesso.")):w.error("Não foi possível obter o link da logo enviada.")}catch{w.error("Falha ao enviar a logo. Tente novamente.")}finally{h(!1)}}},C=(I=a==null?void 0:a.senha_configurada)!=null?I:!1,F=v("seguranca"),y=v("logo_url"),Q=!!y&&g===y,V=(k=v("remetente_nome"))!=null?k:"",J=(X=v("remetente_email"))!=null?X:"",ae=(G=xe.find(b=>b.value===m))==null?void 0:G.hint,se=Gs(Xs(v("host")),v("usuario"),J);return e.jsx(de,{className:"border-[var(--brand-20)]",children:e.jsxs("form",{onSubmit:d(T),children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[var(--n200)] px-6 py-3",children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-1)]",children:a?"Editar servidor de e-mail":"Novo servidor de e-mail"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:t,disabled:s,children:[e.jsx(na,{className:"mr-1.5 h-3.5 w-3.5"}),"Cancelar"]}),e.jsxs(_,{type:"submit",size:"sm",disabled:s,children:[e.jsx($e,{className:"mr-1.5 h-3.5 w-3.5"}),s?"Salvando…":"Salvar servidor"]})]})]}),e.jsxs(me,{className:"space-y-4 pt-5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(P,{htmlFor:"nome",className:"text-sm font-medium",children:"Nome deste servidor *"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(P,{className:"text-sm font-medium",children:"Ativo"}),e.jsx(ve,{children:"Servidor inativo continua cadastrado, mas não pode ser atribuído a nenhuma finalidade."}),e.jsx(ea,{checked:v("ativo"),onCheckedChange:b=>f("ativo",b,{shouldDirty:!0}),disabled:s,className:"ml-1"})]})]}),e.jsx(M,{id:"nome",className:"mt-1.5",placeholder:"Ex.: Servidor institucional, Zoho do campus…",disabled:s,...u("nome")}),N.nome&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:N.nome.message})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{className:"sm:col-span-2 lg:col-span-4",children:[e.jsxs("div",{className:"flex h-5 items-center gap-1.5",children:[e.jsx(P,{children:"Provedor"}),e.jsx(ve,{children:"Escolha um provedor para preencher host, porta e segurança automaticamente, ou selecione Personalizado para informar manualmente."})]}),e.jsxs(ke,{value:m,onValueChange:z,disabled:s,children:[e.jsx(De,{children:e.jsx(Ee,{placeholder:"Selecione um provedor"})}),e.jsx(Te,{children:xe.map(b=>e.jsx(ue,{value:b.value,textValue:b.label,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Js,{value:b.value,cor:b.cor,sigla:b.sigla}),b.label]})},b.value))})]}),ae&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:ae})]}),e.jsxs("div",{className:"sm:col-span-2 lg:col-span-2",children:[e.jsx(P,{htmlFor:"host",children:"Host *"}),e.jsx(M,{id:"host",placeholder:"smtp.suaies.edu.br",disabled:s,...u("host")}),N.host&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:N.host.message})]}),e.jsxs("div",{children:[e.jsx(P,{htmlFor:"porta",children:"Porta *"}),e.jsx(M,{id:"porta",type:"number",disabled:s,...u("porta",{valueAsNumber:!0})}),N.porta&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:N.porta.message})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex h-5 items-center gap-1.5",children:[e.jsx(P,{children:"Segurança *"}),e.jsx(ve,{children:'STARTTLS (porta usual 587) conecta e atualiza a conexão para TLS em seguida; SSL/TLS (porta usual 465) usa uma conexão TLS desde o início. "Nenhuma" apenas para servidores internos de confiança.'})]}),e.jsxs(ke,{value:F,onValueChange:b=>O(b),disabled:s,children:[e.jsx(De,{children:e.jsx(Ee,{})}),e.jsxs(Te,{children:[e.jsx(ue,{value:"starttls",children:"STARTTLS"}),e.jsx(ue,{value:"ssl",children:"SSL/TLS"}),e.jsx(ue,{value:"none",children:"Nenhuma"})]})]})]}),e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx(P,{htmlFor:"usuario",children:"Usuário"}),e.jsx(M,{id:"usuario",autoComplete:"off",disabled:s,...u("usuario")})]}),e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx(P,{htmlFor:"senha",children:"Senha"}),e.jsx(M,{id:"senha",type:"password",autoComplete:"new-password",placeholder:C?"•••••••• (mantém a atual)":"",disabled:s,...u("senha")}),C&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Deixe em branco para manter a senha atual. Ao trocar host, usuário ou segurança, digite a senha de novo."}),!!(x!=null&&x.length)&&e.jsxs("p",{className:"mt-1 rounded-md bg-[var(--warning-bg)] px-2 py-1.5 text-xs text-[var(--warning)]",children:["Esta credencial é usada por: ",x.join(", "),"."]})]})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-sm font-medium",children:"Identidade padrão deste servidor"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Cada finalidade pode usar um remetente diferente: isto aqui é só o padrão."})]}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:()=>o({nome:V,email:J,logoUrl:y||void 0}),children:[e.jsx(Le,{className:"mr-2 h-4 w-4"}),"Pré-visualizar"]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{children:[e.jsx(P,{htmlFor:"remetente_nome",children:"Nome exibido"}),e.jsx(M,{id:"remetente_nome",placeholder:"Sua Instituição",disabled:s,...u("remetente_nome")}
1)]}),e.jsxs("div",{children:[e.jsx(P,{htmlFor:"remetente_email",children:"E-mail remetente *"}),e.jsx(M,{id:"remetente_email",placeholder:"[email protected]",disabled:s,...u("remetente_email")}),N.remetente_email&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:N.remetente_email.message}),se&&e.jsx("p",{className:"mt-1 text-xs text-[var(--warning)]",children:se})]}),e.jsxs("div",{className:"sm:col-span-2 lg:col-span-1",children:[e.jsx(P,{htmlFor:"reply_to",children:"Responder para (Reply-To)"}),e.jsx(M,{id:"reply_to",placeholder:"[email protected]",disabled:s,...u("reply_to")}),N.reply_to&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:N.reply_to.message})]}),e.jsxs("div",{className:"sm:col-span-2 lg:col-span-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(P,{htmlFor:"logo_url",children:"Logo (exibido no corpo do e-mail)"}),e.jsx(ve,{children:"Cole a URL de uma imagem pública ou envie um arquivo PNG ou JPG. Evite SVG — não é exibido de forma confiável nos clientes de e-mail."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[y&&!Q?e.jsx("img",{src:y,alt:"Pré-visualização da logo",className:"h-10 w-10 shrink-0 rounded border bg-white object-contain",onError:()=>j(y)}):e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded border bg-muted text-muted-foreground",children:e.jsx(Xa,{className:"h-4 w-4"})}),e.jsx(M,{id:"logo_url",className:"flex-1",placeholder:"https://…/logo.png",disabled:s,...u("logo_url")}),e.jsx("input",{ref:p,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"hidden",onChange:S}),e.jsxs(_,{type:"button",variant:"outline",className:"shrink-0",disabled:s||c,onClick:()=>{var b;return(b=p.current)==null?void 0:b.click()},children:[c?e.jsx(ce,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(Ga,{className:"mr-2 h-4 w-4"}),c?"Enviando…":"Enviar arquivo"]})]})]})]})]})]})]})})}function Ks({resultado:a}){const[s,r]=i.useState(!1),t=async()=>{const o=[`DNS de ${a.dominio} — envio via ${a.host_servidor}`,"",...a.avisos.flatMap(x=>[`- ${x.titulo}: ${x.detalhe}`,`  ${x.como_resolver}`,""])].join(`
2`);try{await navigator.clipboard.writeText(o),r(!0),w.success("Copiado."),setTimeout(()=>r(!1),2e3)}catch{w.error("Não foi possível copiar.")}};return a.avisos.length===0?e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border border-[var(--n200)] bg-[var(--bg-2)] px-3 py-2",children:[e.jsx(ia,{className:"h-4 w-4 shrink-0 text-[var(--success)]"}),e.jsxs("p",{className:"text-[11px] text-[var(--text-2)]",children:["SPF e DMARC de ",e.jsx("span",{className:"font-mono",children:a.dominio})," estão no lugar."]})]}):e.jsxs("div",{className:"mt-2 space-y-1.5 rounded-md border border-[var(--n200)] bg-[var(--bg-2)] p-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("p",{className:"text-[11px] font-medium text-[var(--text-1)]",children:[a.avisos.length," pendência",a.avisos.length>1?"s":""," no DNS de"," ",e.jsx("span",{className:"font-mono",children:a.dominio})]}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",className:"h-7",onClick:t,children:[s?e.jsx(Ne,{className:"mr-1.5 h-3 w-3 text-[var(--success)]"}):e.jsx(ze,{className:"mr-1.5 h-3 w-3"}),"Copiar para o TI"]})]}),a.avisos.map(o=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ha,{className:o.nivel==="alerta"?"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--danger,#c0392b)]":"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--brand)]","aria-label":o.nivel==="alerta"?"Alerta":"Observação"}),e.jsxs("p",{className:"text-[11px] leading-snug text-[var(--text-2)]",children:[e.jsxs("span",{className:"font-medium text-[var(--text-1)]",children:[o.titulo,"."]})," ",o.como_resolver]})]},o.codigo))]})}function Zs(a){const[s,r]=i.useState(!1),[t,o]=i.useState(null);return{conferir:i.useCallback(async()=>{r(!0);try{o(await R.diagnosticarServidor(a))}catch(m){w.error(B(m))}finally{r(!1)}},[a]),carregando:s,resultado:t}}const Re=[{valor:"transacional",rotulo:"Padrão da instituição",descricao:"A base da cascata: toda finalidade sem servidor próprio cai aqui antes de cair na Lemear.",consumidores:["Envio avulso pela API de e-mail","Serve de padrão para as demais finalidades que não têm servidor próprio"],resolveExato:!1},{valor:"login",rotulo:"Acesso e segurança",descricao:"Confirmação de login e avisos de tentativa bloqueada.",consumidores:["Código de confirmação de login (OTP)","Aviso de tentativa de login bloqueada"],resolveExato:!1},{valor:"convite",rotulo:"Convites e boas-vindas",descricao:"Convite de acesso novo e a mensagem de boas-vindas.",consumidores:["Convite de novo usuário","Concessão de novo acesso","E-mail de boas-vindas"],resolveExato:!1},{valor:"redefinicao_senha",rotulo:"Redefinição de senha",descricao:'O link de "esqueci minha senha".',consumidores:["Link de redefinição de senha"],resolveExato:!1},{valor:"confirmacao_identidade_chat",rotulo:"Confirmação de identidade no chat",descricao:"O código que confirma quem está falando com o assistente. Nunca usa o remetente de login.",consumidores:["Código de confirmação de identidade no chat (hub)","Confirmação de posse na jornada da pessoa"],resolveExato:!0},{valor:"disparo_proativo",rotulo:"Disparos proativos",descricao:"Campanha em lote e envio unitário pela ficha da pessoa.",consumidores:["Disparo em lote (campanha)","Envio unitário pela ficha da pessoa"],resolveExato:!0}],Ys=Object.fromEntries(Re.map(a=>[a.valor,a])),et=Ys.disparo_proativo.rotulo;function at({servidor:a,emUsoPor:s,podeEditar:r,testando:t,ativando:o=!1,onEditar:x,onExcluir:m,onAtivar:n,onVerQuemUsa:p,onTestar:c,onPreVisualizar:h}){const{user:g}=Da(),j=Zs(a.id),u=[...new Set(s)],[d,v]=i.useState(!1),[f,N]=i.useState(""),z=()=>{var T;N((T=g==null?void 0:g.email)!=null?T:""),v(!0)},O=()=>{c(f.trim()),v(!1)};return e.jsxs(de,{children:[e.jsxs(me,{className:"p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e.jsx(be,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"truncate text-sm font-medium text-[var(--text-1)]",children:a.nome}),!a.ativo&&e.jsx("span",{className:"rounded-full bg-[var(--n100)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--n700)]",children:"Inativo"}),!a.senha_configurada&&e.jsx("span",{className:"rounded-full bg-[var(--warning-bg)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--warning)]",children:"Sem senha"}),!a.cliente_id&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-[var(--brand-10)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--brand-dark)]",title:r?"Vale para toda a instituição":"Vale para toda a instituição. Só o Master altera.",children:[!r&&e.jsx(la,{className:"h-3 w-3"}),"Da instituição"]})]}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[a.host,":",a.porta," · ",a.remetente_email]}),s.length>0&&e.jsxs("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:["Em uso por: ",u.join(", ")
2]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:j.conferir,disabled:j.carregando,title:"Confere SPF e DMARC do domínio do remetente",children:[j.carregando?e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(ia,{className:"mr-1.5 h-3.5 w-3.5"}),"Conferir DNS"]}),e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:h,children:[e.jsx(Le,{className:"mr-1.5 h-3.5 w-3.5"}),"Pré-visualizar"]}),e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:z,disabled:t||!a.senha_configurada,title:a.senha_configurada?void 0:"Cadastre a senha para poder testar",children:[t?e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(Ue,{className:"mr-1.5 h-3.5 w-3.5"}),"Testar"]}),r&&e.jsxs(e.Fragment,{children:[!a.ativo&&e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:o,children:[e.jsx(Wa,{className:"mr-1.5 h-3.5 w-3.5"}),"Ativar"]}),e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:x,children:[e.jsx(ca,{className:"mr-1.5 h-3.5 w-3.5"}),"Editar"]}),e.jsxs(_,{type:"button",variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700 disabled:text-[var(--text-3)]",onClick:m,disabled:s.length>0,title:s.length>0?"Em uso. Veja abaixo o que desfazer antes de excluir.":"Excluir este servidor",children:[e.jsx(Fe,{className:"mr-1.5 h-3.5 w-3.5"}),"Excluir"]})]})]})]}),r&&s.length>0&&e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 rounded-md bg-[var(--n100)] px-3 py-2 text-xs text-[var(--text-2)]",children:[e.jsxs("p",{children:["Para excluir este servidor, tire-o de"," ",u.map((T,S)=>e.jsxs("span",{children:[S>0&&(S===u.length-1?" e ":", "),e.jsx("strong",{children:T}),T===et&&" (remova o remetente)"]},T))," ",'em "Quem usa cada servidor".']}),e.jsx(_,{type:"button",variant:"outline",size:"sm",onClick:p,children:"Abrir Quem usa cada servidor"})]}),j.resultado&&e.jsx(Ks,{resultado:j.resultado})]}),e.jsx(aa,{open:d,onOpenChange:v,children:e.jsxs(sa,{className:"sm:max-w-sm",children:[e.jsxs(ta,{children:[e.jsxs(ra,{children:["Testar ",a.nome]}),e.jsx(oa,{children:"Envia uma mensagem de teste usando a senha já salva deste servidor, pelo endereço de remetente que está configurado."})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"destinatario-teste",className:"text-sm font-medium",children:"Enviar teste para"}),e.jsx(M,{id:"destinatario-teste",type:"email",className:"mt-1",value:f,onChange:T=>N(T.target.value),placeholder:"[email protected]"})]}),e.jsx("p",{className:"rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:"Um teste bem-sucedido confirma que o servidor aceitou a mensagem, não que ela vai chegar à caixa de entrada. Para melhor entregabilidade, configure SPF e DKIM no domínio do remetente."}),e.jsxs(Ea,{children:[e.jsx(_,{variant:"outline",onClick:()=>v(!1),children:"Cancelar"}),e.jsxs(_,{onClick:O,disabled:!f.trim(),children:[e.jsx(Ue,{className:"mr-2 h-4 w-4"}),"Enviar teste"]})]})]})})]})}function st({salvando:a,onSalvar:s}){const{register:r,handleSubmit:t,reset:o,formState:{errors:x}}=Ze({resolver:Ye(Us),defaultValues:{dominio:""}}),m=async n=>{await s(n.dominio)&&o({dominio:""})};return e.jsxs("form",{onSubmit:t(m),className:"flex flex-wrap items-start gap-2",children:[e.jsxs("div",{className:"min-w-[220px] flex-1",children:[e.jsx(M,{placeholder:"ies.edu.br",disabled:a,autoComplete:"off",...r("dominio")}),x.dominio&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:x.dominio.message})]}),e.jsxs(_,{type:"submit",disabled:a,children:[a?e.jsx(ce,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(da,{className:"mr-2 h-4 w-4"}),"Adicionar domínio"]})]})}function tt(a){const s=a.split(".");if(s.length<=2)return a;const r=s[s.length-2],o=s[s.length-1].length===2&&["com","net","org","gov","edu"].includes(r);return s.slice(o?-3:-2).join(".")}function rt(a){return Array.from(new Set([a,tt(a)]))}function ot(a,s){const r=`.${s}`;if(!a.endsWith(r))return null;const t=a.slice(0,-r.length);return t.length>0?t:null}function Xe(a){return a===!0?"Já encontrado no DNS":a===!1?"Ainda não encontrado no DNS":'Não verificado ainda — use "Verificar agora"'}function nt({valor:a,rotulo:s}){const[r,t]=i.useState(!1),o=async()=>{try{await navigator.clipboard.writeText(a),t(!0),setTimeout(()=>t(!1),2e3)}catch{w.error("Não foi possível copiar. Selecione o texto manualmente.")}};return e.jsx(_,{type:"button",variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5",onClick:o,"aria-label":`Copiar ${s}`,children:r?e.jsx(Ne,{className:"h-3 w-3 text-[var(--success)]"}):e.jsx(ze,{className:"h-3 w-3"})})}function Ge({valor:a,rotulo:s}){return e.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-[11px] leading-snug text-[var(--text-1)]",children:a}),e.jsx(nt,{valor:a,rotulo:s})]})}function He({registro:a,zonaCurta:s}){var r;return e.jsxs("div",{className:"grid grid-cols-[64px_minmax(0,1fr)_minmax(0,1fr)_56px_36px] items-start gap-2 border-t border-[var(--n200)] px-2 py-2 first:border-t-0",children:[e.jsx("span",{className:"mt-0.5 rounded bg-[var(--n100)] px-1.5 py-0.5 text-center text-[10px] font-semibold uppercase tracking-wide text-[var(--n700)]",children:a.tipo}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(Ge,{valor:a.nome,rotulo:"nome"}),s&&e.jsxs("p",{className:"mt-0.5 text-[10px] leading-snug text-muted-foreground",children:["ou ",e.jsx("code",{className:"font-mono",children:s.curto})]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(Ge,{valor:a.valor,rotulo:"valor"}),a.descricao&&e.jsx("p",{className:"mt-0.5 text-[10px] leading-snug text-muted-foreground",children:a.descricao})]}),e.jsx("span",{className:"mt-1 text-right font-mono text-[11px] text-[var(--text-2)]",children:(r=a.ttl)!=null?r:3600}),e.jsx("span",{className:"mt-0.5 flex justify-end",title:Xe(a.publicado),"aria-label":Xe(a.publicado),role:"img",children:a.publicado===!0?e.jsx(Ja,{className:"h-4 w-4 text-[var(--success)]"}):a.publicado===!1?e.jsx(Ka,{className:"h-4 w-4 text-[var(--danger,#c0392b)]"}):e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"—"})})]})}function it({registros:a,dominio:s}){const[r,t]=i.useState(!1);if(a.length===0)return null;const o=a.filter(c=>c.obrigatorio!==!1),x=a.filter(c=>c.obrigatorio===!1),m=rt(s),n=m[m.length-1],p=async()=>{const c=o.map(h=>{var g;return`${h.tipo}	${h.nome}	${h.valor}	${(g=h.ttl)!=null?g:3600}`});try{await navigator.clipboard.writeText(["Tipo	Nome	Valor	TTL",...c].join(`
3`)),t(!0),w.success("Copiado. Cole numa planilha para conferir coluna a coluna."),setTimeout(()=>t(!1),2e3)}catch{w.error("Não foi possível copiar. Copie campo a campo.")}};return e.jsxs("div",{className:"space-y-2 rounded-lg border border-[var(--n200)] bg-[var(--bg-2)] p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("p",{className:"text-xs font-medium text-[var(--text-1)]",children:["Publique no DNS de ",s]}),e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:p,children:[r?e.jsx(Ne,{className:"mr-1.5 h-3.5 w-3.5 text-[var(--success)]"}):e.jsx(ze,{className:"mr-1.5 h-3.5 w-3.5"}),"Copiar tudo"]})]}),e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-[var(--bg-1)] px-2.5 py-2",children:[e.jsx(Qa,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--brand)]"}),e.jsxs("p",{className:"text-[11px] leading-relaxed text-[var(--text-2)]",children:["Não troque ",e.jsx("strong",{children:"nome"})," por ",e.jsx("strong",{children:"valor"}
3),": invertidos, não dá erro — a verificação só nunca conclui. Se o seu provedor já completa"," ",e.jsxs("code",{className:"font-mono",children:[".",n]})," sozinho, use a forma curta indicada abaixo de cada nome."]})]}),e.jsxs("div",{className:"overflow-x-auto rounded-md border border-[var(--n200)] bg-white",children:[e.jsxs("div",{className:"grid min-w-[600px] grid-cols-[64px_minmax(0,1fr)_minmax(0,1fr)_56px_36px] gap-2 border-b border-[var(--n200)] bg-[var(--bg-2)] px-2 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--n700)]",children:[e.jsx("span",{className:"text-center",children:"Tipo"}),e.jsx("span",{children:"Nome (host)"}),e.jsx("span",{children:"Valor (aponta para)"}),e.jsx("span",{className:"text-right",children:"TTL"}),e.jsx("span",{className:"text-right",children:"DNS"})]}),e.jsx("div",{className:"min-w-[600px]",children:o.map((c,h)=>{const g=ot(c.nome,n);return e.jsx(He,{registro:c,zonaCurta:g?{zona:n,curto:g}:null},`${c.tipo}-${c.nome}-${h}`)})})]}),x.length>0&&e.jsxs("div",{className:"overflow-x-auto rounded-md border border-dashed border-[var(--n200)] bg-white",children:[e.jsxs("div",{className:"grid min-w-[600px] grid-cols-[64px_minmax(0,1fr)_minmax(0,1fr)_56px_36px] gap-2 border-b border-dashed border-[var(--n200)] bg-[var(--bg-2)] px-2 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-[var(--n700)]",children:[e.jsx("span",{className:"text-center",children:"Tipo"}),e.jsx("span",{children:"Recomendado, não obrigatório"}),e.jsx("span",{children:"Valor (aponta para)"}),e.jsx("span",{className:"text-right",children:"TTL"}),e.jsx("span",{className:"text-right",children:"DNS"})]}),e.jsx("div",{className:"min-w-[600px]",children:x.map((c,h)=>e.jsx(He,{registro:c,zonaCurta:null},`orientacao-${h}`))})]})]})}const lt={pendente:"Pendente",verificado:"Verificado",falhou:"Falhou",temporario:"Falha temporária"},ct={pendente:"bg-[var(--warning-bg)] text-[var(--warning)]",verificado:"bg-[var(--success-bg)] text-[var(--success)]",falhou:"bg-red-100 text-red-700",temporario:"bg-[var(--warning-bg)] text-[var(--warning)]"};function dt({dominio:a,podeEditar:s,verificando:r,onVerificar:t,onExcluir:o}){return e.jsx(de,{children:e.jsxs(me,{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e.jsx(Oe,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"truncate text-sm font-medium text-[var(--text-1)]",children:a.dominio}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide ${ct[a.status]}`,children:lt[a.status]}),!a.cliente_id&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-[var(--brand-10)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--brand-dark)]",title:s?"Vale para toda a instituição":"Vale para toda a instituição. Só o Master remove.",children:[!s&&e.jsx(la,{className:"h-3 w-3"}),"Da instituição"]})]}),a.em_uso_por.length>0&&e.jsxs("p",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:["Em uso por: ",a.em_uso_por.join(", ")]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:r,children:[r?e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(Za,{className:"mr-1.5 h-3.5 w-3.5"}),"Verificar agora"]}),s&&e.jsxs(_,{type:"button",variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",onClick:o,children:[e.jsx(Fe,{className:"mr-1.5 h-3.5 w-3.5"}),"Excluir"]})]})]}),a.ultimo_erro&&a.status!=="verificado"&&e.jsx("p",{className:"rounded-md bg-red-50 px-3 py-2 text-xs text-red-700",children:a.ultimo_erro}),e.jsx(it,{registros:a.registros_dns,dominio:a.dominio})]})})}const ie="servidor:",le="dominio:",mt=6;function Me(a){return a.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase()}function ut(a,s){return a&&s?`${a} <${s}>`:s||a||""}function pt(a){const s=[!a.cliente_id&&"Da instituição",!a.ativo&&"Inativo"].filter(
3Boolean),r=ut(a.remetente_nome,a.remetente_email);return{valor:`${ie}${a.id}`,titulo:a.nome,detalhe:[r,a.host].filter(Boolean).join(" · "),selos:s,busca:Me([a.nome,r,a.host].join(" "))}}function xt(a){return{valor:`${le}${a.id}`,titulo:a.dominio,detalhe:`Envia como qualquer endereço @${a.dominio}`,selos:a.cliente_id?[]:["Da instituição"],busca:Me(a.dominio)}}function ua({valor:a,onChange:s,servidores:r,dominios:t,disabled:o}){const[x,m]=i.useState(!1),n=r.filter(d=>d.ativo||`${ie}${d.id}`===a).map(pt),p=t.map(xt),c=[...n,...p],h=c.find(d=>d.valor===a),g=c.length>=mt,j=d=>{s(d),m(!1)},u=(d,v)=>e.jsxs(Oa,{value:d.valor,keywords:[d.busca],onSelect:j,className:"items-start gap-2 py-2",children:[e.jsx(v,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:d.titulo}),d.selos.map(f=>e.jsx("span",{className:"rounded-full bg-[var(--n100)] px-1.5 py-px text-[10px] font-medium uppercase tracking-wide text-[var(--n700)]",children:f},f))]}),d.detalhe&&e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:d.detalhe})]}),e.jsx(Ne,{className:Qe("mt-0.5 h-4 w-4 shrink-0",d.valor===a?"opacity-100":"opacity-0")})]},d.valor);return e.jsxs(Ta,{open:x,onOpenChange:m,children:[e.jsx(Pa,{asChild:!0,children:e.jsxs(_,{type:"button",variant:"outline",role:"combobox","aria-expanded":x,disabled:o,className:"h-auto min-h-9 w-full justify-between px-3 py-1.5 text-left text-sm font-normal",children:[h?e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate",children:h.titulo}),h.detalhe&&e.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:h.detalhe})]}):e.jsx("span",{className:"text-muted-foreground",children:"Selecione um destino para esta finalidade"}),e.jsx(Ya,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Ra,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(Aa,{filter:(d,v,f)=>{var N;return(N=f==null?void 0:f[0])!=null&&N.includes(Me(v))?1:0},children:[g&&e.jsx($a,{placeholder:"Buscar por nome, remetente ou domínio..."}),e.jsxs(La,{className:"max-h-80",children:[e.jsx(za,{children:"Nada encontrado."}),e.jsxs(Be,{heading:"Sai do servidor da instituição",children:[n.length===0&&e.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:r.length===0?"Nenhum servidor cadastrado.":'Nenhum servidor ativo. Reative um em "Servidores de e-mail".'}),n.map(d=>u(d,be))]}),e.jsx(Fa,{}),e.jsxs(Be,{heading:"Sai pela Lemear com o seu endereço",children:[p.length===0&&e.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"Nenhum domínio de envio verificado ainda."}),p.map(d=>u(d,Oe))]})]})]})})]})}function pa({nome:a,onNomeChange:s,email:r,onEmailChange:t,replyTo:o,onReplyToChange:x,emailObrigatorio:m,emailFaltando:n,disabled:p,placeholderNome:c,placeholderEmail:h,placeholderReplyTo:g,avisoTravado:j}){return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-xs",children:"Nome exibido"}),e.jsx(M,{value:a,onChange:u=>s(u.target.value),placeholder:c||"Sua Instituição",disabled:p})]}),e.jsxs("div",{children:[e.jsxs(P,{className:"text-xs",children:["Enviar como (e-mail)",m&&" *"]}),e.jsx(M,{type:"email",value:r,onChange:u=>t(u.target.value),placeholder:h||"no-reply@…",disabled:p}),n&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:"Sem servidor para herdar o remetente: informe o e-mail."}),j&&e.jsx("p",{className:"mt-1 text-[11px] leading-snug text-muted-foreground",children:j})]}),e.jsxs("div",{children:[e.jsx(P,{className:"text-xs",children:"Responder para (Reply-To)"}),e.jsx(M,{type:"email",value:o,onChange:u=>x(u.target.value),placeholder:g||"contato@…",disabled:p})]})]})}const ht={propria_cliente:"Própria",propria_assinante:"Própria",padrao_cliente:"Herda do cliente",padrao_assinante:"Herda do assinante",plataforma:"Lemear"},gt={propria_cliente:"bg-[var(--success-bg)] text-[var(--success)]",propria_assinante:"bg-[var(--success-bg)] text-[var(--success)]",padrao_cliente:"bg-[var(--brand-10)] text-[var(--brand-dark)]",padrao_assinante:"bg-[var(--brand-10)] text-[var(--brand-dark)]",plataforma:"bg-[var(--n100)] text-[var(--n700)]"};function vt({definicao:a,linha:s,servidoresDisponiveis:r,dominiosDisponiveis:t,salvando:o,onSalvar:x,onRestaurarPadrao:m,onPreVisualizar:n}){var Y,U,q,I,k,X,G,b,A,K,Z;const p=(Y=s==null?void 0:s.origem)!=null?Y:"plataforma",c=(U=s==null?void 0:s.configurado)!=null?U:!1,h=!!(s!=null&&s.servidor_efetivo_id),[g,j]=i.useState((q=s==null?void 0:s.servidor_id)!=null?q:""),[u,d]=i.useState((I=s==null?void 0:s.dominio_id)!=null?I:""),[v,f]=i.useState((k=s==null?void 0:s.remetente_email)!=null?k:""),[N,z]=i.useState((X=s==null?void 0:s.remetente_nome)!=null?X:""),[O,T]=i.useState((G=s==null?void 0:s.reply_to)!=null?G:""),[S,C]=i.useState((b=s==null?void 0:s.permitir_fallback_ses)!=null?b:!1),F=u?t.find(D=>D.id===u):void 0,y=g?r.find(D=>D.id===g):void 0,Q=!!g,V=!!u,J=V&&!v.trim(),ae=g?`${ie}${g}`:u?`${le}${u}`:"",se=D=>{D.startsWith(ie)?(j(D.slice(ie.length)),d(""),f(""),z(""),T("")):D.startsWith(le)&&(d(D.slice(le.length)),j(""))},te=()=>{if(!g&&!u||J)return;const D={remetente_nome:N.trim()||void 0,reply_to:O.trim()||void 0,permitir_fallback_ses:S};x(g?{servidor_id:g,remetente_email:v.trim()||void 0,...D}:{dominio_id:u,remetente_email:v.trim(),...D})};return e.jsx(de,{children:e.jsxs(me,{className:"space-y-3 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-1)]",children:a.rotulo}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide ${gt[p]}`,children:ht[p]})]}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.descricao}),e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["Usada em: ",a.consumidores.join(" · ")]})]}),e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:n,children:[e.jsx(Le,{className:"mr-1.5 h-3.5 w-3.5"}),"Pré-visualizar"]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsxs("div",{className:"sm:col-span-2 lg:col-span-3",children:[e.jsx(P,{className:"text-xs",children:"Destino"}),e.jsx(ua,{valor:ae,onChange:se,servidores:r,dominios:t,disabled:o})]}),e.jsx(pa,{nome:Q?(A=y==null?void 0:y.remetente_nome)!=null?A:"":N,onNomeChange:z,email:Q?(K=y==null?void 0:y.remetente_email)!=null?K:"":v,onEmailChange:f,replyTo:Q?(Z=y==null?void 0:y.reply_to)!=null?Z:"":O,onReplyToChange:T,emailObrigatorio:V,emailFaltando:J,disabled:o||Q,placeholderNome:s!=null&&s.nome_efetivo?`herda: ${s.nome_efetivo}`:"Sua Instituição",placeholderEmail:V?F?`obrigatório, ex.: contato@${F.dominio}`:"obrigatório para este destino":s!=null&&s.remetente_efetivo?`herda: ${s.remetente_efetivo}`:"no-reply@…",placeholderReplyTo:s!=null&&s.reply_to_efetivo?`herda: ${s.reply_to_efetivo}`:"contato@…",avisoTravado:Q?'Definido no servidor. Para mudar, edite em "Servidores de e-mail".':void 0})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(P,{className:"text-xs font-medium",children:"Permitir fallback pela Lemear"}),e.jsx(ea,{checked:S,onCheckedChange:C,disabled:o})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[c&&e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:o,children:[e.jsx(es,{className:"mr-1.5 h-3.5 w-3.5"}),"Restaurar padrão"]}),e.jsxs(_,{type:"button",size:"sm",onClick:te,disabled:o||!g&&!u||J,children:[o?e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx($e,{className:"mr-1.5 h-3.5 w-3.5"}),"Salvar"]})]})]}),h&&e.jsx("p",{className:"rounded-md bg-[var(--warning-bg)] px-3 py-2 text-xs text-[var(--warning)]",children:"Ao usar um servidor próprio, entrega e abertura deixam de ser rastreadas nesta finalidade."}),a.resolveExato&&e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Esta finalidade não herda o padrão da instituição: sem um destino próprio aqui, ela usa a Lemear diretamente."})]})})}function ft(a){const[s,r]=i.useState([]),[t,o]=i.useState(!0),[x,m]=i.useState(!1),n=i.useRef(!0),p=i.useCallback(async()=>{o(!0);try{const j=await R.listarRemetentesDisparo(a);n.current&&r(j)}catch(j){n.current&&w.error(B(j)||"Não foi possível carregar os remetentes de disparo.")}finally{n.current&&o(!1)}},[a]);i.useEffect(()=>(n.current=!0,p(),()=>{n.current=!1}),[p]);const c=i.useCallback(async j=>{m(!0);try{const u=await W("criar_remetente_disparo_smtp");return await R.criarRemetenteDisparo(j,u,a),w.success("Remetente adicionado."),await p(),!0}catch(u){return w.error(B(u)||"Não foi possível adicionar este remetente."),!1}finally{n.current&&m(!1)}},[a,p]),h=i.useCallback(async(j,u)=>{m(!0);try{const d=await W("atualizar_remetente_disparo_smtp");return await R.atualizarRemetenteDisparo(j,u,d,a),w.success("Remetente atualizado."),await p(),!0}catch(d){return w.error(B(d)||"Não foi possível atualizar este remetente."),!1}finally{n.current&&m(!1)}},[a,p]),g=i.useCallback(async j=>{m(!0);try{const u=await W("tornar_padrao_remetente_disparo_smtp");return await R.tornarPadraoRemetenteDisparo(j,u,a),w.success("Remetente definido como padrão."),await p(),!0}catch(u){return w.error(B(u)||"Não foi possível tornar este remetente o padrão."),!1}finally{n.current&&m(!1)}},[a,p]);return{remetentes:s,carregando:t,salvando:x,recarregar:p,criar:c,atualizar:h,tornarPadrao:g}}const jt=a=>{const s=a.trim();return/[.!?]$/.test(s)?s:`${s}.`};function Se(a){var s,r;if(a.modo==="ver"){const{remetente:t,podeEditar:o,removerBloqueado:x,onEditar:m,onExcluir:n,onTornarPadrao:p}=a,c=(r=(s=t.servidor_nome)!=null?s:t.dominio_nome)!=null?r:"—",h=t.remetente_nome_efetivo?`${t.remetente_nome_efetivo} <${t.remetente_email_efetivo}>`:t.remetente_email_efetivo||c;return e.jsx(de,{children:e.jsxs(me,{className:"flex flex-wrap items-center justify-between gap-3 p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("p",{className:"truncate text-sm font-medium text-[var(--text-1)]",children:h}),t.padrao&&e.jsx("span",{className:"rounded-full bg-[var(--brand-10)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--brand-dark)]",children:"Padrão"}),!t.ativo&&e.jsx("span",{className:"rounded-full bg-[var(--n100)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--n700)]",children:"Inativo"}),t.ativo&&t.motivo_indisponivel&&e.jsx("span",{className:"rounded-full bg-[var(--warning-bg)] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-[var(--warning)]",children:"Indisponível"})]}),e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[c,t.em_uso>0&&` · em uso por ${t.em_uso} disparo${t.em_uso>1?"s":""}`]}),t.ativo&&t.motivo_indisponivel&&e.jsxs("p",{className:"mt-0.5 text-[11px] text-[var(--warning)]",children:[jt(t.motivo_indisponivel)," Disparos novos não saem por ele até isso ser resolvido."]})]}),o&&e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[!t.padrao&&t.ativo&&!t.motivo_indisponivel&&e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:p,children:[e.jsx(as,{className:"mr-1.5 h-3.5 w-3.5"}),"Tornar padrão"]}),e.jsxs(_,{type:"button",variant:"ghost",size:"sm",onClick:m,children:[e.jsx(ca,{className:"mr-1.5 h-3.5 w-3.5"}),"Editar"]}),e.jsxs(_,{type:"button",variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700 disabled:text-[var(--text-3)]",onClick:n,disabled:!!x,title:x||"Remover este remetente",children:[e.jsx(Fe,{className:"mr-1.5 h-3.5 w-3.5"}),"Remover"]})]})]})})}return e.jsx(bt,{...a}
3)}function bt({modo:a,valorInicial:s,servidoresDisponiveis:r,dominiosDisponiveis:t,salvando:o,onSalvar:x,onCancelar:m}){var V,J,ae,se,te,Y,U,q,I;const[n,p]=i.useState((V=s==null?void 0:s.servidor_id)!=null?V:""),[c,h]=i.useState((J=s==null?void 0:s.dominio_id)!=null?J:""),[g,j]=i.useState((ae=s==null?void 0:s.remetente_email)!=null?ae:""),[u,d]=i.useState((se=s==null?void 0:s.remetente_nome)!=null?se:""),[v,f]=i.useState((te=s==null?void 0:s.reply_to)!=null?te:""),N=!!c,z=N&&!g.trim(),O=n?`${ie}${n}`:c?`${le}${c}`:"",T=k=>{k.startsWith(ie)?(p(k.slice(ie.length)),h("")):k.startsWith(le)&&(h(k.slice(le.length)),p(""))},S=c?t.find(k=>k.id===c):void 0,C=n?r.find(k=>k.id===n):void 0,F=!!n,y=s!=null&&s.servidor_id&&s.servidor_id===n?{nome:(Y=s.remetente_nome)!=null?Y:null,email:(U=s.remetente_email)!=null?U:null,replyTo:(q=s.reply_to)!=null?q:null}:null,Q=()=>{var X,G,b;if(!n&&!c||z)return;const k={permitir_fallback_ses:!1};x(n?{servidor_id:n,remetente_email:(X=y==null?void 0:y.email)!=null?X:void 0,remetente_nome:(G=y==null?void 0:y.nome)!=null?G:void 0,reply_to:(b=y==null?void 0:y.replyTo)!=null?b:void 0,...k}:{dominio_id:c,remetente_email:g.trim(),remetente_nome:u.trim()||void 0,reply_to:v.trim()||void 0,...k})};return e.jsx(de,{children:e.jsxs(me,{className:"space-y-3 p-4",children:[e.jsxs("div",{children:[e.jsx(P,{className:"text-xs",children:"Destino"}),e.jsx(ua,{valor:O,onChange:T,servidores:r,dominios:t,disabled:o})]}),e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:e.jsx(pa,{nome:F?(y==null?void 0:y.nome)||(C==null?void 0:C.remetente_nome)||"":u,onNomeChange:d,email:F?(y==null?void 0:y.email)||(C==null?void 0:C.remetente_email)||"":g,onEmailChange:j,replyTo:F?(y==null?void 0:y.replyTo)||(C==null?void 0:C.reply_to)||"":v,onReplyToChange:f,emailObrigatorio:N,emailFaltando:z,disabled:o||F,placeholderEmail:N?`obrigatório, ex.: contato@${(I=S==null?void 0:S.dominio)!=null?I:"seudominio"}`:void 0,avisoTravado:F?'Definido no servidor. Para mudar, edite em "Servidores de e-mail".':void 0})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-3",children:[e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Se este remetente parar de funcionar, o disparo pausa e avisa quem o criou. Nenhum e-mail sai pela Lemear."}),e.jsxs("div",{className:"flex items-center gap-2",children:[m&&e.jsxs(_,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:o,children:[e.jsx(na,{className:"mr-1.5 h-3.5 w-3.5"}),"Cancelar"]}),e.jsxs(_,{type:"button",size:"sm",onClick:Q,disabled:o||!n&&!c||z,children:[o?e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx($e,{className:"mr-1.5 h-3.5 w-3.5"}),a==="criar"?"Adicionar":"Salvar"]})]})]})]})})}const Nt=a=>a>1?`Em uso por ${a}
3 disparos agendados, em andamento ou pausados. Cancele-os ou espere terminarem em Disparos proativos antes de remover.`:"Em uso por 1 disparo agendado, em andamento ou pausado. Cancele ou espere terminar em Disparos proativos antes de remover.";function yt({clienteId:a,servidoresDisponiveis:s,dominiosDisponiveis:r,podeEditar:t,onMudouRemetentes:o}){const{remetentes:x,carregando:m,salvando:n,recarregar:p,criar:c,atualizar:h,tornarPadrao:g}=ft(a),[j,u]=i.useState(null),[d,v]=i.useState(0),[f,N]=i.useState(null),z=x.length>1,O=s.filter(S=>!x.some(C=>C.servidor_id===S.id)),T=S=>{if(S.em_uso>0)return Nt(S.em_uso);if(S.padrao&&z)return"Marque outro remetente como padrão antes de remover este."};return e.jsxs(de,{children:[e.jsxs(me,{className:"space-y-3 p-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[var(--text-1)]",children:"Disparos proativos"}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Campanha em lote e envio unitário pela ficha da pessoa."}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:"Cada remetente aqui pode ser escolhido ao montar um disparo; o padrão é usado quando ninguém escolhe."})]}),m?e.jsxs("div",{className:"space-y-2",children:[e.jsx(ne,{className:"h-16 w-full"}),e.jsx(ne,{className:"h-16 w-full"})]}):e.jsxs("div",{className:"space-y-2",children:[x.map(S=>j===S.id?e.jsx(Se,{modo:"editar",valorInicial:S,servidoresDisponiveis:s,dominiosDisponiveis:r,salvando:n,onSalvar:C=>h(S.id,C).then(F=>{F&&(u(null),o==null||o())}),onCancelar:()=>u(null)},S.id):e.jsx(Se,{modo:"ver",remetente:S,podeEditar:t&&S.editavel,removerBloqueado:T(S),onEditar:()=>u(S.id),onExcluir:()=>N(S),onTornarPadrao:()=>g(S.id)},S.id)),x.length===0&&(t?e.jsx("p",{className:"text-xs text-muted-foreground",children:"Nenhum remetente cadastrado ainda: sem um, os disparos saem pela Lemear."}):e.jsx("div",{className:"rounded-lg border border-dashed border-[var(--n300)] px-4 py-8 text-center text-sm text-muted-foreground",children:"Nenhum remetente cadastrado para disparos. Sem um, os disparos saem pela Lemear."})),t&&e.jsxs("div",{className:"space-y-1.5 pt-1",children:[e.jsx("p",{className:"text-xs font-medium text-[var(--text-2)]",children:x.length===0?"Adicionar remetente":"Adicionar outro remetente"}),e.jsx(Se,{modo:"criar",servidoresDisponiveis:O,dominiosDisponiveis:r,salvando:n,onSalvar:S=>c(S).then(C=>{C&&(v(F=>F+1),o==null||o())})},d)]})]})]}),f&&e.jsx(Pe,{isOpen:!0,onClose:()=>N(null),entityType:re.smtpRemetenteDisparo.entityType,entityId:f.id,entityName:f.remetente_email_efetivo||f.servidor_nome||f.dominio_nome||"",displayName:re.smtpRemetenteDisparo.displayName,onDelete:(S,C)=>R.removerRemetenteDisparo(S,C,a),recaptchaAction:re.smtpRemetenteDisparo.recaptchaAction,onSuccess:()=>{N(null),p(),o==null||o()}})]})}const we=({children:a})=>e.jsx("div",{className:"py-1 text-center",children:e.jsx("span",{className:"inline-block rounded-md bg-brand-600 px-4 py-2 text-xs font-semibold text-white",children:a})}),We=({cor:a,children:s})=>e.jsx("div",{className:a==="amber"?"rounded-md border-l-4 border-amber-400 bg-amber-50 px-3 py-2 text-[12px] text-amber-800":"rounded-md border-l-4 border-red-400 bg-red-50 px-3 py-2 text-[12px] text-red-800",children:s}),_e=[{rotulo:"Código de acesso",titulo:"Código de Confirmação",subtitulo:"Confirme seu login",corpo:({email:a})=>e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-semibold text-gray-900",children:"Olá!"}),e.jsxs("p",{children:["Detectamos uma tentativa de login na sua conta (",e.jsx("span",{className:"font-medium text-blue-700",children:a}),") a partir de um dispositivo que não reconhecemos."]}),e.jsx("p",{children:"Se foi você, use o código abaixo na tela de confirmação para concluir o login:"}),e.jsxs("div",{className:"rounded-lg bg-gray-50 py-4 text-center",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-gray-400",children:"Seu código de confirmação"}),e.jsx("p",{className:"mt-1 text-2xl font-bold tracking-[0.25em] text-gray-900",children:"341876"})]}),e.jsxs(We,{cor:"amber",children:[e.jsx("span",{className:"font-semibold",children:"Importante:"})," este código expira em 15 minutos. Após 5 tentativas incorretas, será necessário iniciar o login novamente."]}),e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsx("p",{className:"mb-1.5 text-xs font-semibold text-gray-700",children:"Detalhes da tentativa"}),e.jsx("dl",{className:"space-y-0.5 text-[11px] text-gray-500",children:[["Quando","22/06/2026 12:06 UTC"],["Endereço IP","2804:9f8:…:d3b2"],["Dispositivo","desktop"],["Navegador","Chrome 146"],["Sistema","Linux"]].map(([s,r])=>e.jsxs("div",{className:"flex justify-between gap-2",children:[e.jsx("dt",{children:s}),e.jsx("dd",{className:"text-gray-700",children:r})]},s))})]}),e.jsxs(We,{cor:"red",children:[e.jsx("span",{className:"font-semibold",children:"Não foi você?"})," Ignore este e-mail e troque sua senha imediatamente. Não informe este código a ninguém; nossa equipe nunca solicitará este código por telefone, chat ou outro canal."]})]})},{rotulo:"Convite",titulo:"Você foi convidado",subtitulo:"Complete seu cadastro",corpo:({nome:a})=>e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-semibold text-gray-900",children:"Olá!"}),e.jsxs("p",{children:["Você foi convidado para fazer parte da instituição no serviço"," ",e.jsx("span",{className:"font-medium",children:a})," com o papel de"," ",e.jsx("span",{className:"font-medium",children:"Administrador"}),"."]}),e.jsx(we,{children:"Aceitar convite"}),e.jsx("p",{className:"text-[12px] text-gray-500",children:"Este convite expira em 29/06/2026 às 12:06."})]})}
3,{rotulo:"Redefinição de senha",titulo:"Redefinição de Senha",subtitulo:"Recupere o acesso à sua conta",corpo:({email:a})=>e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Recebemos uma solicitação para redefinir a senha da sua conta (",e.jsx("span",{className:"font-medium",children:a}),")."]}),e.jsx("p",{children:"Clique no botão abaixo para criar uma nova senha:"}),e.jsx(we,{children:"Redefinir senha"}),e.jsx("p",{className:"text-[12px] text-gray-500",children:"Se você não fez essa solicitação, ignore este e-mail — sua senha permanece inalterada."})]})},{rotulo:"Boas-vindas",titulo:"Bem-vindo!",corpo:({nome:a})=>e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-semibold text-gray-900",children:"Olá!"}),e.jsxs("p",{children:["Sua conta foi criada com sucesso no serviço ",e.jsx("span",{className:"font-medium",children:a}),". Estamos felizes em ter você conosco."]}),e.jsx(we,{children:"Acessar o serviço"})]})}];function St({nome:a,logoUrl:s,logoQuebrada:r,onLogoError:t,titulo:o,subtitulo:x,children:m}){const n=new Date().getFullYear(),p=!!s&&!r;return e.jsxs("div",{className:"mx-auto my-auto w-full max-w-[600px] shrink-0 overflow-hidden rounded-lg border bg-white text-left shadow-sm",children:[e.jsxs("div",{className:"px-6 pb-4 pt-6 text-center",children:[p?e.jsx("img",{src:s,alt:"",className:"mx-auto mb-3 max-h-12 object-contain",onError:t}):e.jsx("div",{className:"mx-auto mb-3 text-sm font-semibold text-gray-700",children:a}),e.jsx("h1",{className:"text-lg font-bold text-gray-900",children:o}),x&&e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:x})]}),e.jsx("div",{className:"space-y-3 border-t px-6 py-5 text-[13px] leading-relaxed text-gray-700",children:m}),e.jsxs("div",{className:"border-t bg-gray-50 px-6 py-4 text-center text-[11px] text-gray-400",children:[e.jsxs("p",{children:["© ",n," ",a,". Todos os direitos reservados."]}),e.jsx("p",{className:"mt-1",children:"Este é um e-mail automático. Por favor, não responda a esta mensagem."})]})]})}const wt={login:0,convite:1,redefinicao_senha:2};function _t({nome:a,email:s,logoUrl:r,logoQuebrada:t,onLogoError:o,finalidadeInicial:x,className:m}){const[n,p]=i.useState(()=>{var d;return(d=wt[x])!=null?d:0}),c=(a||"").trim()||"Sua Instituição",h=(s||"").trim()||"[email protected]",g=_e.length,j=_e[n],u=d=>p(v=>(v+d+g)%g);return e.jsxs("div",{className:`flex flex-col ${m!=null?m:""}`,children:[e.jsxs("div",{className:"mb-2 flex shrink-0 items-center justify-between",children:[e.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Pré-visualização — ",j.rotulo]}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[n+1,"/",g]})]}),e.jsxs("div",{className:"relative min-h-0 flex-1 rounded-lg border bg-muted/30",children:[e.jsx("button",{type:"button",onClick:()=>u(-1),"aria-label":"E-mail anterior",className:"absolute left-1.5 top-1/2 z-10 -translate-y-1/2 rounded-full border bg-white p-1 text-gray-500 shadow-sm transition-colors hover:text-gray-900",children:e.jsx(ss,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>u(1),"aria-label":"Próximo e-mail",className:"absolute right-1.5 top-1/2 z-10 -translate-y-1/2 rounded-full border bg-white p-1 text-gray-500 shadow-sm transition-colors hover:text-gray-900",children:e.jsx(ts,{className:"h-4 w-4"})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-y-auto px-8 py-4",children:e.jsx(St,{nome:c,logoUrl:r,logoQuebrada:t,onLogoError:o,titulo:j.titulo,subtitulo:j.subtitulo,children:j.corpo({nome:c,email:h})})})]}),e.jsx("div",{className:"mt-2 flex shrink-0 items-center justify-center gap-1.5",children:_e.map((d,v)=>e.jsx("button",{type:"button","aria-label":`Ver ${d.rotulo}`,onClick:()=>p(v),className:`h-1.5 rounded-full transition-all ${v===n?"w-4 bg-brand-600":"w-1.5 bg-gray-300 hover:bg-gray-400"}`},d.rotulo))}),e.jsx("p",{className:"mt-1.5 shrink-0 text-center text-[11px] text-muted-foreground",children:"Exemplos ilustrativos com a sua marca. Use as setas para ver outros e-mails."})]})}const Ce="__todos__";function Ct(a){var s,r,t,o;return{nome:a.nome,ativo:!0,host:a.host,porta:a.porta,seguranca:a.seguranca,usuario:(s=a.usuario)!=null?s:void 0,remetente_email:a.remetente_email,remetente_nome:(r=a.remetente_nome)!=null?r:void 0,reply_to:(t=a.reply_to)!=null?t:void 0,logo_url:(o=a.logo_url)!=null?o:void 0}}const kt=["servidores","dominios","mapa"],Dt=[{value:"servidores",label:"Servidores de e-mail",icon:be},{value:"dominios",label:"Domínios de envio",icon:Oe},{value:"mapa",label:"Quem usa cada servidor",icon:rs}];function Vt(){const{canView:a,canEdit:s,isLoading:r}=Ma({permissionPrefix:"smtp_"}),{isMaster:t}=Je(),{activeTab:o,handleTabChange:x}=Va({validTabs:kt,defaultTab:"servidores",urlParamName:"aba"}),m=o,[n,p]=i.useState(null),{clientes:c,mostrarSeletor:h}=Os(),{servidores:g,carregando:j,salvando:u,testandoId:d,recarregar:v,criar:f,atualizar:N,testar:z}
3=Ls(n),{dominios:O,carregando:T,salvando:S,verificandoId:C,recarregar:F,criar:y,verificar:Q}=Fs(n),{mapa:V,carregando:J,salvandoFinalidade:ae,salvar:se,limpar:te,recarregar:Y}=zs(n),[U,q]=i.useState(null),[I,k]=i.useState(null),[X,G]=i.useState(null),[b,A]=i.useState(null),K=i.useMemo(()=>O.filter(l=>l.status==="verificado"),[O]),Z=i.useMemo(()=>{var E;const l=new Map;for(const oe of V){if(!oe.servidor_id)continue;const Ve=Re.find(ha=>ha.valor===oe.finalidade);if(!Ve)continue;const qe=(E=l.get(oe.servidor_id))!=null?E:[];qe.push(Ve.rotulo),l.set(oe.servidor_id,qe)}return l},[V]),D=i.useMemo(()=>{const l=new Map;for(const E of V)l.set(E.finalidade,E);return l},[V]),ye=l=>{A({chave:`servidor:${l.email}`,...l})},xa=l=>{const E=D.get(l);A({chave:`finalidade:${l}`,nome:(E==null?void 0:E.nome_efetivo)||"",email:(E==null?void 0:E.remetente_efetivo)||"",finalidade:l})};return r?e.jsx(qa,{}):a?e.jsxs(Ba,{delayDuration:200,children:[e.jsx("div",{className:"border-b border-[var(--n200)] bg-[var(--bg-3)] px-4 py-[9px] sm:px-6 lg:px-8",children:e.jsx(ns,{tabs:Dt,value:m,onChange:l=>x(l),ariaLabel:"Seções da configuração de e-mail"})}),e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--brand-20)] bg-[var(--bg-3)] px-[22px] py-[18px] shadow-[0_1px_2px_rgba(16,24,40,0.04)]",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-[52px] w-[52px] flex-shrink-0 items-center justify-center rounded-[13px] bg-[var(--brand-10)] text-[var(--brand)]",children:e.jsx(os,{className:"h-6 w-6"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-[19px] font-extrabold tracking-tight text-[var(--text-1)]",children:"E-mail da instituição"}),e.jsx("p",{className:"mt-1 text-sm text-[var(--text-2)]",children:"Cadastre os servidores SMTP da sua instituição e defina qual servidor atende cada tipo de e-mail. Sem configuração, tudo sai pela Lemear."})]})]})}),e.jsx(xs,{}),h&&e.jsx("div",{className:"flex flex-wrap items-center justify-end gap-3",children:e.jsxs(ke,{value:n!=null?n:Ce,onValueChange:l=>p(l===Ce?null:l),children:[e.jsx(De,{className:"w-64",children:e.jsx(Ee,{})}),e.jsxs(Te,{children:[e.jsx(ue,{value:Ce,children:"Todos os clientes (padrão do assinante)"}),c.map(l=>e.jsx(ue,{value:l.id,children:l.nome},l.id))]})]})}),m==="servidores"?e.jsx("div",{className:"space-y-3",children:j?e.jsxs("div",{className:"space-y-3",children:[e.jsx(ne,{className:"h-20 w-full"}),e.jsx(ne,{className:"h-20 w-full"})]}):e.jsxs(e.Fragment,{children:[g.map(l=>{var E;return U===l.id?e.jsx(Ie,{valorInicial:l,salvando:u,onSalvar:oe=>N(l.id,oe).then(Boolean),onCancelar:()=>q(null),onPreVisualizar:ye,finalidadesQueUsam:Z.get(l.id)},l.id):e.jsx(at,{servidor:l,emUsoPor:(E=Z.get(l.id))!=null?E:[],podeEditar:s&&(t||!!l.cliente_id),testando:d===l.id,ativando:u,onEditar:()=>q(l.id),onExcluir:()=>k(l),onAtivar:()=>N(l.id,Ct(l)),onVerQuemUsa:()=>x("mapa"),onTestar:oe=>z(l.id,{destinatario:oe}),onPreVisualizar:()=>ye({nome:l.remetente_nome||"",email:l.remetente_email,logoUrl:l.logo_url||void 0})},l.id)}),g.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-[var(--n300)] px-4 py-8 text-center text-sm text-muted-foreground",children:["Nenhum servidor cadastrado",n?" para este cliente":"",". Os e-mails saem pela Lemear até que um servidor seja configurado."]}),s&&U==="novo"&&e.jsx(Ie,{salvando:u,onSalvar:l=>f(l).then(Boolean),onCancelar:()=>q(null),onPreVisualizar:ye}),s&&U===null&&e.jsxs(_,{type:"button",variant:"outline",onClick:()=>q("novo"),children:[e.jsx(da,{className:"mr-2 h-4 w-4"}),"Adicionar servidor"]})]})}):m==="dominios"?e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs leading-relaxed text-[var(--text-2)]",children:"Envie com o endereço da instituição usando a Lemear. Os registros abaixo são publicados no DNS de quem administra o domínio, e a verificação depende da propagação — pode não ser imediata."}),s&&e.jsx(st,{salvando:S,onSalvar:l=>y({dominio:l}).then(Boolean)}),T?e.jsxs("div",{className:"space-y-3",children:[e.jsx(ne,{className:"h-32 w-full"}),e.jsx(ne,{className:"h-32 w-full"})]}):e.jsxs(e.Fragment,{children:[O.map(l=>e.jsx(dt,{dominio:l,podeEditar:s&&(t||!!l.cliente_id),verificando:C===l.id,onVerificar:()=>Q(l.id),onExcluir:()=>G(l)},l.id)),O.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-[var(--n300)] px-4 py-8 text-center text-sm text-muted-foreground",children:["Nenhum domínio de envio cadastrado",n?" para este cliente":"","."]})]})]}):e.jsx("div",{className:"space-y-3",children:J||j||T?e.jsxs("div",{className:"space-y-3",children:[e.jsx(ne,{className:"h-40 w-full"}),e.jsx(ne,{className:"h-40 w-full"})]}):Re.map(l=>l.valor==="disparo_proativo"?e.jsx(yt,{clienteId:n,servidoresDisponiveis:g,dominiosDisponiveis:K,podeEditar:s,onMudouRemetentes:()=>Y(!0)},l.valor):e.jsx(vt,{definicao:l,linha:D.get(l.valor),servidoresDisponiveis:g,dominiosDisponiveis:K,salvando:ae===l.valor,onSalvar:E=>se(l.valor,E),onRestaurarPadrao:()=>te(l.valor),onPreVisualizar:()=>xa(l.valor)},l.valor))}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:"Para melhor entregabilidade, configure os registros SPF, DKIM e DMARC no domínio de cada remetente. Um teste bem-sucedido confirma que o servidor aceitou a mensagem, não que ela chegou à caixa de entrada."})]}),I&&e.jsx(Pe,{isOpen:!0,onClose:()=>k(null),entityType:re.smtpServidor.entityType,entityId:I.id,entityName:I.nome,displayName:re.smtpServidor.displayName,onDelete:(l,E)=>R.removerServidor(l,E,n),recaptchaAction:re.smtpServidor.recaptchaAction,onSuccess:()=>{k(null),v()}}),X&&e.jsx(Pe,{isOpen:!0,onClose:()=>G(null),entityType:re.smtpDominio.entityType,entityId:X.id,entityName:X.dominio,displayName:re.smtpDominio.displayName,onDelete:(l,E)=>R.removerDominio(l,E,n),recaptchaAction:re.smtpDominio.recaptchaAction,onSuccess:()=>{G(null),F()}}),e.jsx(aa,{open:!!b,onOpenChange:l=>!l&&A(null),children:e.jsxs(sa,{className:"flex h-[88vh] flex-col sm:max-w-3xl",children:[e.jsxs(ta,{className:"shrink-0",children:[e.jsx(ra,{children:"Pré-visualização dos e-mails"}),e.jsx(oa,{children:"Exemplo com a marca aplicada (nome, remetente e logo). Use as setas para ver outros tipos de e-mail."})]}),b&&e.jsx(_t,{className:"min-h-0 flex-1",nome:b.nome,email:b.email,logoUrl:b.logoUrl,logoQuebrada:!1,onLogoError:()=>{},finalidadeInicial:b.finalidade},b.chave)]})})]}):e.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Você não tem permissão para ver a configuração de e-mail."})}export{Vt as SmtpConfigPage};

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.