import{j as e,r as o,d as p,N as h}from"./vendor-tanstack-DE4ALVGD.js";import{l as g,C as j,m as v,n as L,o as w,p as C,q as b,R as N,r as R,P as S}from"./index-CNL5pSma.js";import"./vendor-react-HBv6Kpyp.js";import"./vendor-radix-K8EF6rBE.js";import"./vendor-recharts-B3wzJa9e.js";import"./vendor-forms-BvpM0AtX.js";import"./vendor-date-Bck8LDfw.js";function P({className:t="size-11"}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 76 76",className:t,"aria-label":"Prefect Logo",children:[e.jsx("title",{children:"Prefect Logo"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.89 15.07 38 26.543v22.935l22.104-11.47.007.004V15.068l-.003.001L38 3.598z",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.89 15.07 38 26.543v22.935l22.104-11.47.007.004V15.068l-.003.001L38 3.598z",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M37.987 49.464 15.89 38v22.944l.013-.006L38 72.402V49.457z",clipRule:"evenodd"})]})}function d({redirectTo:t="/dashboard"}){const[s,u]=o.useState(""),[i,n]=o.useState(""),[r,l]=o.useState(!1),{login:f}=g(),m=p(),x=a=>{a.preventDefault(),!(r||!s.trim())&&(l(!0),n(""),f(s).then(c=>{c.success?m({to:t}):(n(c.error??"Authentication failed"),l(!1))}))};return e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsxs(j,{className:"w-full max-w-[400px]",children:[e.jsxs(v,{className:"flex flex-col items-center gap-4",children:[e.jsx(P,{className:"size-16"}),e.jsx(L,{children:"Login"})]}),e.jsx(w,{children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",children:[e.jsx(C,{type:"password",placeholder:"admin:pass",value:s,onChange:a=>u(a.target.value),autoFocus:!0,disabled:r}),i&&e.jsx("p",{className:"text-sm text-destructive",children:i}),e.jsx(b,{type:"submit",disabled:r,className:"w-full",children:r?"Logging in...":"Login"})]})})]})})}function I(){const{redirectTo:t}=N.useSearch(),s=R();return s?s.isLoading?e.jsx(S,{}):s.isAuthenticated?e.jsx(h,{to:t??"/dashboard",replace:!0}):e.jsx(d,{redirectTo:t}):e.jsx(d,{redirectTo:t})}export{I as component};
//# sourceMappingURL=login-IWjDgi_j.js.map
