1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3759],{7236:(e,s,a)=>{"use strict";a.d(s,{U:()=>t});var r=a(93734);function t(){return(0,r.createBrowserClient)("https://zmzazaakbgheflkewvrb.supabase.co","sb_publishable_4tlgIIB2gZ14LZn97i7CJA_gzR3cm1U")}},15090:(e,s,a)=>{"use strict";a.d(s,{FirstAccessForm:()=>g});var r=a(95155),t=a(12115),n=a(73321),l=a(52484),i=a(35756),o=a(13545),d=a(25777),c=a(15411),m=a(7915),x=a(6296),u=a(55559),h=a(7236);function g({userName:e,isStudent:s=!1}){let a=(0,n.useRouter)(),[g,p]=(0,t.useState)(""),[b,f]=(0,t.useState)(""),[j,y]=(0,t.useState)(!1),[N,v]=(0,t.useState)(!1),[w,A]=(0,t.useState)(!1),[S,C]=(0,t.useState)(!1),[k,_]=(0,t.useState)(!1),[F,E]=(0,t.useState)(!1),[P,T]=(0,t.useState)(""),$={length:g.length>=8,uppercase:/[A-Z]/.test(g),lowercase:/[a-z]/.test(g),number:/[0-9]/.test(g)},q=Object.values($).every(Boolean),O=async e=>{if(e.preventDefault(),T(""),g!==b)return void T("As senhas n\xe3o coincidem");if(!q)return void T("A senha n\xe3o atende aos requisitos m\xednimos");A(!0);try{let e=(0,h.U)(),{error:s}=await e.auth.updateUser({password:g});if(s){T("Erro ao definir nova senha. Tente novamente."),A(!1);return}let{error:r}=await e.auth.updateUser({data:{must_change_password:null}});r&&console.error("Error removing must_change_password flag:",r),_(!0),setTimeout(()=>{a.push("/"),a.refresh()},2e3)}catch(e){T("Ocorreu um erro. Tente novamente mais tarde."),A(!1)}},z=async()=>{T(""),C(!0);try{let e=await fetch("/api/auth/keep-cpf-password",{method:"POST"});if(!e.ok){let s=await e.json().catch(()=>null);T(s?.error||"Erro ao manter a senha. Tente novamente."),C(!1);return}E(!0),_(!0),setTimeout(()=>{a.push("/"),a.refresh()},2e3)}catch(e){T("Ocorreu um erro. Tente novamente mais tarde."),C(!1)}};return k?(0,r.jsxs)("div",{className:"w-full max-w-md",children:[(0,r.jsxs)("div",{className:"text-center mb-8",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-green-100 mb-4",children:(0,r.jsx)(l.A,{className:"w-9 h-9 text-green-600"})}),(0,r.jsx)("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:F?"Tudo Certo!":"Senha Definida!"}),(0,r.jsx)("p",{className:"text-gray-500",children:F?"Sua senha continuar\xe1 sendo o seu CPF":"Seu acesso est\xe1 configurado"})]}),(0,r.jsx)("div",{className:"bg-white rounded-2xl shadow-xl shadow-gray-200/50 p-8 border border-gray-100",children:(0,r.jsx)("p",{className:"text-gray-600 text-center",children:"Redirecionando para o portal..."})})]}):(0,r.jsxs)("div",{className:"w-full max-w-md",children:[(0,r.jsxs)("div",{className:"text-center mb-8",children:[(0,r.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary shadow-lg shadow-primary/30 mb-4",children:(0,r.jsx)(i.A,{className:"w-9 h-9 text-primary-foreground"})}),(0,r.jsxs)("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:["Bem-vindo, ",e.split(" ")[0],"!"]}),(0,r.jsx)("p",{className:"text-gray-500",children:s?"Este \xe9 seu primeiro acesso. Defina uma nova senha ou continue usando o CPF.":"Este \xe9 seu primeiro acesso. Por favor, defina uma nova senha."})]}),(0,r.jsxs)("div",{className:"bg-white rounded-2xl shadow-xl shadow-gray-200/50 p-8 border border-gray-100",children:[(0,r.jsxs)("form",{onSubmit:O,className:"space-y-6",children:[P&&(0,r.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 flex items-start gap-3",children:[(0,r.jsx)(o.A,{className:"w-5 h-5 text-red-600 shrink-0 mt-0.5"}),(0,r.jsx)("p",{className:"text-sm text-red-800",children:P})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 mb-2",children:"Nova Senha"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(d.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),(0,r.jsx)("input",{id:"password",type:j?"text":"password",value:g,onChange:e=>p(e.target.value),required:!0,className:"w-full pl-10 pr-12 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",disabled:w}),(0,r.jsx)("button",{type:"button",onClick:()=>y(!j),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:j?(0,r.jsx)(c.A,{className:"w-5 h-5"}):(0,r.jsx)(m.A,{className:"w-5 h-5"})})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-gray-500",children:"Requisitos da senha:"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,r.jsxs)("div",{className:`flex items-center gap-2 text-xs ${$.length?"text-green-600":"text-gray-400"}`,children:[(0,r.jsx)("div",{className:`w-1.5 h-1.5 rounded-full ${$.length?"bg-green-600":"bg-gray-300"}`}),"M\xednimo 8 caracteres"]}),(0,r.jsxs)("div",{className:`flex items-center gap-2 text-xs ${$.uppercase?"text-green-600":"text-gray-400"}`,children:[(0,r.jsx)("div",{className:`w-1.5 h-1.5 rounded-full ${$.uppercase?"bg-green-600":"bg-gray-300"}`}),"Letra mai\xfascula"]}),(0,r.jsxs)("div",{className:`flex items-center gap-2 text-xs ${$.lowercase?"text-green-600":"text-gray-400"}`,children:[(0,r.jsx)("div",{className:`w-1.5 h-1.5 rounded-full ${$.lowercase?"bg-green-600":"bg-gray-300"}`}),"Letra min\xfascula"]}),(0,r.jsxs)("div",{className:`flex items-center gap-2 text-xs ${$.number?"text-green-600":"text-gray-400"}`,children:[(0,r.jsx)("div",{className:`w-1.5 h-1.5 rounded-full ${$.number?"bg-green-600":"bg-gray-300"}`}),"N\xfamero"]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-gray-700 mb-2",children:"Confirmar Nova Senha"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(d.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),(0,r.jsx)("input",{id:"confirmPassword",type:N?"text":"password",value:b,onChange:e=>f(e.target.value),required:!0,className:"w-full pl-10 pr-12 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent outline-none transition-all",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",disabled:w}),(0,r.jsx)("button",{type:"button",onClick:()=>v(!N),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:N?(0,r.jsx)(c.A,{className:"w-5 h-5"}):(0,r.jsx)(m.A,{className:"w-5 h-5"})})]}),b&&g!==b&&(0,r.jsx)("p",{className:"mt-1 text-xs text-red-500",children:"As senhas n\xe3o coincidem"})]}),(0,r.jsx)("button",{type:"submit",disabled:w||S||!q||g!==b,className:"w-full bg-primary text-primary-foreground font-semibold py-3 rounded-lg hover:shadow-lg hover:shadow-
1primary/30 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:w?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.A,{className:"w-5 h-5 animate-spin"}),"Salvando..."]}):"Definir Senha e Acessar"})]}),s&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"my-6 flex items-center gap-3",children:[(0,r.jsx)("div",{className:"flex-1 h-px bg-gray-200"}),(0,r.jsx)("span",{className:"text-xs text-gray-400 uppercase",children:"ou"}),(0,r.jsx)("div",{className:"flex-1 h-px bg-gray-200"})]}),(0,r.jsx)("button",{type:"button",onClick:z,disabled:w||S,className:"w-full border border-gray-300 text-gray-700 font-semibold py-3 rounded-lg hover:bg-gray-50 transition-all disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",children:S?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.A,{className:"w-5 h-5 animate-spin"}),"Confirmando..."]}):"Continuar usando o CPF como senha"}),(0,r.jsx)("p",{className:"mt-2 text-xs text-gray-400 text-center",children:"Voc\xea poder\xe1 alterar sua senha a qualquer momento na p\xe1gina de perfil."})]}),(0,r.jsx)("div",{className:"mt-6 p-4 bg-amber-50 border border-amber-200 rounded-lg",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)(u.A,{className:"w-5 h-5 text-amber-600 shrink-0 mt-0.5"}),(0,r.jsxs)("div",{className:"text-sm text-amber-800",children:[(0,r.jsx)("p",{className:"font-medium",children:"Dica de seguran\xe7a"}),(0,r.jsx)("p",{className:"mt-1",children:"Escolha uma senha que voc\xea n\xe3o use em outros sites. N\xe3o compartilhe sua senha com ningu\xe9m."})]})]})})]})]})}},25160:(e,s,a)=>{Promise.resolve().then(a.bind(a,15090))}},e=>{e.O(0,[5730,2619,8384,9708,8441,5838,7358],()=>e(e.s=25160)),_N_E=e.O()}]);
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.