1import{c as v,r as s,j as e,L as y,b as o}from"./index-BEQrjWfG.js";import{B as h}from"./button-CFJ5EHNW.js";import{L as p,I as x}from"./label-49GERNKb.js";import{A as b}from"./AuthLayout-DTKWlk79.js";import{s as N,G as L}from"./authReturnTo-m08E8-vQ.js";import{M as S}from"./mail-VogR4P6G.js";import{L as C}from"./lock-COhxF1Va.js";import{L as E}from"./loader-circle-lk6QtkYv.js";import"./index-BD3jUaEj.js";import"./KnockoutHero-CgBsyyMG.js";import"./portfolioData-B1ZHhp9D.js";import"./use-transform-JEpqlilz.js";/** 2 * @license lucide-react v0.475.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 I=[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]],k=v("LogIn",I);function D(){const[i,f]=s.useState(""),[l,w]=s.useState(""),[n,r]=s.useState(""),[c,d]=s.useState(!1),[m]=s.useState(()=>new URLSearchParams(window.location.search).get("next")),[u]=s.useState(()=>new URLSearchParams(window.location.search).get("returnTo")?N():null);s.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("error");a&&(r(decodeURIComponent(a)),window.history.replaceState({},"",window.location.pathname))},[]);const g=async t=>{t.preventDefault(),r(""),d(!0);try{await o.auth.loginViaEmailPassword(i,l);const a=await o.auth.me();window.location.href=u||m||((a==null?void 0:a.role)==="admin"?"/dashboard":"/portal")}catch(a){r(a.message||"Invalid email or password")}finally{d(!1)}},j=()=>{o.auth.loginWithProvider("google",u||m||"/auth-redirect")};return e.jsxs(b,{icon:k,title:"Welcome back",subtitle:"Log in to your account",footer:e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Access is by official invitation only"}),children:[e.jsxs(h,{variant:"outline",className:"w-full h-12 text-sm font-medium mb-6",onClick:j,children:[e.jsx(L,{className:"w-5 h-5 mr-2"}),"Continue with Google"]}),e.jsxs("div",{className:"relative mb-6",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-card px-3 text-muted-foreground",children:"or"})})]}),n&&e.jsx("div",{className:"mb-4 p-3 rounded-lg bg-destructive/10 text-destructive text-sm",children:n}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(p,{htmlFor:"email",children:"Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(S,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),e.jsx(x,{id:"email",type:"email",autoComplete:"email",autoFocus:!0,placeholder:"[email protected]",value:i,onChange:t=>f(t.target.value),className:"pl-10 h-12",required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(p,{htmlFor:"password",children:"Password"}),e.jsx(y,{to:"/forgot-password",className:"text-xs text-primary hover:underline",children:"Forgot password?"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(C,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground","aria-hidden":"true"}),e.jsx(x,{id:"password",type:"password",autoComplete:"current-password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:l,onChange:t=>w(t.target.value),className:"pl-10 h-12",required:!0})]})]}),e.jsx(h,{type:"submit",className:"w-full h-12 font-medium",disabled:c,children:c?e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"w-4 h-4 mr-2 animate-spin"}),"Logging in..."]}):"Log in"})]})]})}export{D 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.