1import{c as z,r as t,z as M,g as q,u as D,j as e}from"./index-BLKRFDSI.js";import{B as O}from"./button-Ct61uh-i.js";import{I as u}from"./input-CdfGE4AD.js";import{L as x}from"./label-r-bL42Zq.js";import{C as P,b as U,d as V,e as T,a as H}from"./card-BLIFRdVb.js";import{A as v,a as y}from"./alert-DmVbQnm4.js";import{E as J}from"./eye-Cth7zWxo.js";import{L as R}from"./loader-circle-Dt64krhf.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const W=z("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function ae(){var b,N;const[l,C]=t.useState(""),[i,h]=t.useState(""),[p,w]=t.useState(""),[c,S]=t.useState(!1),[g,r]=t.useState(null),[f,d]=t.useState(null),[o,m]=t.useState(!1),[a,j]=t.useState(!1),{signIn:E,signUp:L}=M(),A=q(),F=((N=(b=D().state)==null?void 0:b.from)==null?void 0:N.pathname)||"/blog/admin",k=s=>s.toLowerCase().endsWith("@beinbr.com"),B=async s=>{s.preventDefault(),r(null),d(null),m(!0);try{if(a){if(!k(l)){r("Apenas emails @beinbr.com podem se cadastrar."),m(!1);return}const{error:n}=await L(l,i,p);if(n){r(n.message);return}d("Conta criada com sucesso! Você já pode fazer login."),j(!1),h("")}else{const{error:n}=await E(l,i);if(n){n.message.includes("Invalid login credentials")?r("Email ou senha incorretos."):r(n.message);return}A(F,{replace:!0})}}catch{r("Ocorreu um erro. Tente novamente.")}finally{m(!1)}},I=()=>{j(!a),r(null),d(null)};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-muted/30 px-4",children:e.jsxs(P,{className:"w-full max-w-md",children:[e.jsxs(U,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4",children:e.jsx("img",{src:"/lovable-uploads/5a10c5ab-3993-4a28-9bde-506a3aec2d6c.png",alt:"Be in",className:"h-16 w-auto"})}),e.jsx(V,{className:"text-2xl",children:a?"Criar Conta":"Blog Admin"}),e.jsx(T,{children:a?"Crie sua conta para gerenciar o blog":"Faça login para gerenciar o blog"})]}
6),e.jsxs(H,{children:[e.jsxs("form",{onSubmit:B,className:"space-y-4",children:[g&&e.jsx(v,{variant:"destructive",children:e.jsx(y,{children:g})}),f&&e.jsx(v,{className:"border-green-500 bg-green-50 text-green-700",children:e.jsx(y,{children:f})}),a&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"fullName",children:"Nome completo"}),e.jsx(u,{id:"fullName",type:"text",placeholder:"Seu nome",value:p,onChange:s=>w(s.target.value),required:!0,disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"email",children:"Email"}),e.jsx(u,{id:"email",type:"email",placeholder:"[email protected]",value:l,onChange:s=>C(s.target.value),required:!0,disabled:o}),a&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Apenas emails @beinbr.com são permitidos"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{htmlFor:"password",children:"Senha"}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{id:"password",type:c?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:i,onChange:s=>h(s.target.value),required:!0,disabled:o,minLength:6}),e.jsx("button",{type:"button",onClick:()=>S(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:c?e.jsx(W,{size:18}):e.jsx(J,{size:18})})]})]}),e.jsx(O,{type:"submit",className:"w-full",disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Criando...":"Entrando..."]}):a?"Criar conta":"Entrar"})]}),e.jsx("div",{className:"mt-4 text-center text-sm",children:e.jsx("button",{type:"button",onClick:I,className:"text-primary hover:underline",children:a?"Já tem uma conta? Fazer login":"Não tem conta? Criar conta"})}),e.jsx("div",{className:"mt-4 text-center text-sm text-muted-foreground",children:e.jsx("a",{href:"/",className:"hover:text-foreground",children:"â Voltar para o site"})})]})]})})}export{ae 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.