(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{2537:function(e,t,r){Promise.resolve().then(r.bind(r,7340))},7340:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return a}});var o=r(7437),n=r(2265),i=r(9376);function a(){let e=(0,i.useRouter)(),[t,r]=(0,n.useState)(""),[a,l]=(0,n.useState)(""),[d,u]=(0,n.useState)(""),[c,p]=(0,n.useState)(!1);async function h(r){r.preventDefault(),p(!0),u("");try{let r=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({email:t,password:a})}),o=await r.json();if(!r.ok)throw Error(o.message||"Ошибка входа");e.push("/dashboard")}catch(e){u(e instanceof Error?e.message:"Неизвестная ошибка"),p(!1)}}return(0,n.useEffect)(()=>{(async function(){try{(await fetch("/api/auth/me",{credentials:"same-origin"})).ok&&e.push("/dashboard")}catch(e){}})()},[e]),(0,o.jsx)("div",{style:s.container,children:(0,o.jsxs)("div",{style:s.card,children:[(0,o.jsx)("h1",{style:s.title,children:"Uno Click"}),(0,o.jsx)("p",{style:s.subtitle,children:"Войдите для продолжения"}),d&&(0,o.jsx)("div",{style:s.error,children:d}),(0,o.jsxs)("form",{onSubmit:h,children:[(0,o.jsxs)("div",{style:s.formGroup,children:[(0,o.jsx)("label",{htmlFor:"email",style:s.label,children:"Email"}),(0,o.jsx)("input",{type:"email",id:"email",value:t,onChange:e=>r(e.target.value),required:!0,placeholder:"test.user@uno-click.local",style:s.input})]}),(0,o.jsxs)("div",{style:s.formGroup,children:[(0,o.jsx)("label",{htmlFor:"password",style:s.label,children:"Пароль"}),(0,o.jsx)("input",{type:"password",id:"password",value:a,onChange:e=>l(e.target.value),required:!0,placeholder:"test123",style:s.input})]}),(0,o.jsx)("button",{type:"submit",disabled:c,style:{...s.button,...c?s.buttonDisabled:{}},children:c?"Вход...":"Войти"})]})]})})}let s={container:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",background:"#f5f5f5"},card:{background:"white",padding:"40px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)",width:"100%",maxWidth:"400px"},title:{fontSize:"24px",fontWeight:600,marginBottom:"8px",color:"#333"},subtitle:{color:"#666",marginBottom:"32px",fontSize:"14px"},formGroup:{marginBottom:"20px"},label:{display:"block",marginBottom:"6px",fontSize:"14px",color:"#333",fontWeight:500},input:{width:"100%",padding:"12px 14px",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",transition:"border-color 0.2s"},button:{width:"100%",padding:"12px",background:"#007bff",color:"white",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer",transition:"background 0.2s"},buttonDisabled:{background:"#ccc",cursor:"not-allowed"},error:{background:"#fee",color:"#c00",padding:"12px",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"}}},9376:function(e,t,r){"use strict";var o=r(5475);r.o(o,"useRouter")&&r.d(t,{useRouter:function(){return o.useRouter}}),r.o(o,"useSearchParams")&&r.d(t,{useSearchParams:function(){return o.useSearchParams}})}},function(e){e.O(0,[971,117,744],function(){return e(e.s=2537)}),_N_E=e.O()}]);