1import{r as n,j as e}from"./react-vendor-eUQHqTr8.js";import{e as D,U as I,T as i,B as u,D as W,b as E,l as P}from"./index-Wm-ehMmj.js";function R(){if(typeof window>"u")return"";try{return new URLSearchParams(window.location.search).get("invite")||""}catch{return""}}function M({onClose:r}){const{login:c,signup:g}=D(),s=I(),a=R(),[t,j]=n.useState(a?"signup":"login"),[p,w]=n.useState(""),[l,C]=n.useState(""),[m,h]=n.useState(""),[x,k]=n.useState(""),[y,B]=n.useState(a),[S,b]=n.useState(!1),[v,d]=n.useState(null);async function F(f){if(f.preventDefault(),d(null),t==="signup"&&l!==m){d(new Error("Passwords do not match."));return}b(!0);try{t==="login"?await c(p,l):await g({email:p,password:l,firstName:x,inviteCode:y.trim()})}catch(z){d(z)}finally{b(!1)}}return e.jsx("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"rgba(0,0,0,0.72)",zIndex:500},children:e.jsxs("div",{style:{position:"relative",width:"100%",maxWidth:420,background:i.panel,border:`1px solid ${i.ruleSoft}`,borderRadius:14,padding:"32px 28px"},children:[r&&e.jsx("button",{onClick:r,"aria-label":"Close",style:{position:"absolute",top:14,right:14,background:"none",border:"none",cursor:"pointer",color:i.textMute,fontSize:20,lineHeight:1,padding:4,borderRadius:4},children:"â"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:22},children:[e.jsx("img",{src:"/logo.png",alt:"Bird Society of Singapore",style:{width:40,height:40,objectFit:"contain",flexShrink:0}}),e.jsxs("div",{children:[e.jsx("div",{style:{fontFamily:u,fontSize:26,fontWeight:700,letterSpacing:-1,position:"relative",left:-10,lineHeight:1,fontStyle:"italic"},children:"Birds of Singapore"}),e.jsx("div",{style:{fontFamily:u,fontSize:16,color:"var(--th-wordmark-sub)",letterSpacing:-.8},children:"by the Bird Society of Singapore"})]})]}),e.jsx("h1",{style:{margin:"6px 0 4px",fontFamily:W,fontSize:28,fontWeight:500,letterSpacing:-.7},children:t==="login"?"Welcome back.":"Make an account."}),e.jsx("div",{style:{fontSize:13,color:i.textDim,marginBottom:22},children:t==="login"?"Sign in to look for your targets.":"We'll keep your wishlist and your eBird list private."}),e.jsxs("form",{onSubmit:F,style:{display:"flex",flexDirection:"column",gap:12},children:[t==="signup"&&e.jsx(o,{label:"First name",value:x,onChange:k,type:"text",autoFocus:!0,required:!0}),e.jsx(o,{label:"Email",value:p,onChange:w,type:"email",autoComplete:"email",autoFocus:t==="login",required:!0}),e.jsx(o,{label:"Password",value:l,onChange:C,type:"password",autoComplete:t==="login"?"current-password":"new-password",minLength:t==="signup"?8:void 0,required:!0,hint:t==="signup"?"8 characters or more.":null}),t==="signup"&&e.jsx(o,{label:"Confirm password",value:m,onChange:h,type:"password",autoComplete:"new-password",required:!0}),t==="signup"&&s.gateEnabled&&e.jsx(o,{label:"Invite code",value:y,onChange:f=>B(f.toUpperCase()),type:"text",autoComplete:"off",required:!0,hint:"We're in private beta â ask a Bird Society admin for an invite."}),v&&e.jsx("div",{style:{padding:"8px 10px",borderRadius:6,background:i.coralSoft,border:`1px solid ${i.coral}`,fontSize:12,color:i.pillCoralFg},children:v.message}),e.jsx(E,{primary:!0,fullWidth:!0,size:"lg",type:"submit",disabled:S,style:{marginTop:4},children:S?"â¦":t==="login"?"Sign in":"Create account"})]}),e.jsxs("div",{style:{marginTop:16,textAlign:"center",fontSize:12.5,color:i.textDim},children:[t==="login"?"Don't have an account? ":"Already have one? ",e.jsx("button",{onClick:()=>{j(t==="login"?"signup":"login"),d(null),h("")},style:{...P,fontStyle:"normal",fontFamily:u,fontSize:12.5},children:t==="login"?"Create one":"Sign in"})]})]})})}function o({label:r,value:c,onChange:g,hint:s,...a}){return e.jsxs("label",{style:{display:"block"},children:[e.jsx("div",{style:{fontSize:11.5,color:i.textMute,fontWeight:600,letterSpacing:.2,marginBottom:4},children:r}),e.jsx("input",{value:c,onChange:t=>g(t.target.value),style:{width:"100%",height:40,padding:"0 12px",background:i.ink,border:`1px solid ${i.rule}`,borderRadius:8,fontFamily:u,fontSize:14,color:i.text,outline:"none"},onFocus:t=>t.target.style.borderColor=i.amber,onBlur:t=>t.target.style.borderColor=i.rule,...a}),s&&e.jsx("div",{style:{fontSize:11,color:i.textMute,marginTop:4},children:s})]})}export{M as AuthScreen};
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.