import{U as h,r as f,u as g,x,j as e,N as y,e as b,B as t,l as i,t as d}from"./index-57016b76.js";import{u as v}from"./useForm-55429ca1.js";import{b as F,p as B}from"./env-198ff0f3.js";import{C}from"./Container-fe1ab53f.js";import{T as l}from"./Typography-5c6b5f62.js";import{C as T,D as j}from"./Divider-296ec6e8.js";import{F as D}from"./FormLabel-dee15d1f.js";import{I}from"./Input-16c32ed1.js";import{B as S}from"./Button-49c53082.js";import"./createContainer-80c97b9d.js";import"./useThemeProps-dc4c84f8.js";import"./useSlot-7545b28c.js";import"./ThemeProvider-af6b3ec5.js";const $=async o=>{const{data:a}=await h.post(`${F}/${B}/rest/firma/login`,{dni:o});return a},J=()=>{const[o,a]=f.useState(!1),{authenticateSignature:c,authFirma:s}=g(),n=x();if(s)return e(y,{to:`/firma/${s.idFirma}`});const{dni:m,codigo:w,handleChange:p}=v({dni:"",codigo:""});return b({typography:{fontFamily:["Poppins","sans-serif"].join(",")}}),e(T,{children:e(t,{children:e(C,{maxWidth:"xl",children:e(t,{sx:{},children:i(t,{sx:{paddingTop:"2em"},children:[e(l,{level:"h1",gutterBottom:!0,component:"h1",children:"Verificación de acceso"}),e(j,{}),e(t,{width:"100%",sx:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1em",marginTop:"2em"},children:i("div",{style:{backgroundColor:"#FFF",padding:"2rem",borderRadius:"8px"},children:[e(l,{level:"h2",gutterBottom:!0,component:"h2",children:"Ingresá los datos solicitados."}),i("form",{style:{marginTop:"1em"},onSubmit:async u=>{a(!0),u.preventDefault();const r=await $(m);r.success?(d.success("Verificado!"),c(r),r.firmado?n("/firmados",{replace:!0}):n(`/firma/${r.idFirma}`,{replace:!0})):d.error(r.msg)},children:[e(D,{children:"Documento"}),e(I,{sx:{marginTop:"5px"},type:"number",fullWidth:!0,name:"dni",required:!0,value:m,onChange:p,placeholder:"Ingresa tu numero de documento"}),e(S,{sx:{marginTop:"1em"},fullWidth:!0,variant:"solid",type:"submit",children:"Ingresar"})]})]})})]})})})})})};export{J as default};
