1import{r as n,a as I,j as e,S as F,a5 as M,a6 as L,a7 as P,a8 as B,a9 as $,aa as N,B as g,J as A,s as w,ab as o}from"./index-BvsqCpEz.js";import{I as c}from"./input-BedoGODD.js";import{L as m}from"./label-Csx6IcxK.js";import{u as W}from"./use-auth-4OwtEfAA.js";import{A as q}from"./arrow-left-DasGo8Zs.js";import{E as D}from"./eye-off-S3HqrStz.js";import{E as R}from"./eye-C3LPJZA8.js";import{K as O}from"./key-round-Box5SVhW.js";const G=()=>{const[u,l]=n.useState("email"),[s,b]=n.useState(""),[d,j]=n.useState(""),[x,v]=n.useState(""),[i,r]=n.useState(!1),[h,S]=n.useState(!1),{signIn:C}=W(),p=I(),y=async t=>{if(t.preventDefault(),!s)return;r(!0);const{error:a}=await w.auth.signInWithOtp({email:s,options:{shouldCreateUser:!1,emailRedirectTo:`${window.location.origin}/member`}});r(!1),a?o.error("Couldn't send code",{description:a.message}):(o.success("Code sent - check your inbox"),l("code"))},k=async t=>{if(t.preventDefault(),!d)return;r(!0);const{error:a}=await w.auth.verifyOtp({email:s,token:d.trim(),type:"email"});r(!1),a?o.error("Invalid code",{description:a.message}):(o.success("Welcome back!"),p("/member"))},E=async t=>{if(t.preventDefault(),!s||!x)return;r(!0);try{const{data:f}=await w.functions.invoke("check-login-method",{body:{email:s}});if(!(f!=null&&f.password_allowed)){r(!1),o.error("Password login is disabled for this account",{description:"Please use the email code option instead, or ask an admin to enable password login."});return}}catch{}const{error:a}=await C(s,x);r(!1),a?o.error("Login failed",{description:a.message}):(o.success("Welcome back!"),p("/member"))};return e.jsxs("div",{className:"relative min-h-screen flex items-center overflow-hidden",children:[e.jsx(F,{title:"Member Login - 88.3 Southern FM",description:"Sign in to the 88.3 Southern FM member hub.",path:"/member-login"}),e.jsx("div",{className:"absolute inset-0 overflow-hidden",children:e.jsxs("picture",{children:[e.jsx("source",{type:"image/avif",srcSet:`${M} 768w, ${L} 1280w, ${P} 1920w`,sizes:"100vw"}),e.jsx("source",{type:"image/webp",srcSet:`${B} 768w, ${$} 1280w, ${N} 1920w`,sizes:"100vw"}),e.jsx("img",{src:N,alt:"Brighton Beach, Melbourne's Bayside",className:"w-full h-[120%] object-cover",loading:"eager",fetchpriority:"high",decoding:"async",width:1920,height:1080})]})}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-sfm-navy/90 via-sfm-dark-blue/75 to-sfm-blue/35"}),e.jsx("div",{className:"relative w-full page-content pt-6 pb-6 md:py-0",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 md:gap-12 items-start md:items-center md:min-h-screen",children:[e.jsxs("div",{className:"flex flex-col items-center text-center md:items-start md:text-left text-white space-y-2 md:space-y-6",children:[e.jsxs("button",{onClick:()=>p("/"),className:"flex items-center gap-1.5 text-sm text-white/75 hover:text-white transition-colors",children:[e.jsx(q,{className:"h-4 w-4"}),"Back to website"]}),e.jsxs("div",{className:"space-y-2 md:space-y-3 max-w-md",children:[e.jsx("p",{className:"font-display text-2xl md:text-3xl lg:text-4xl font-bold text-white leading-tight",children:"Welcome Back"}),e.jsx("p",{className:"text-sm md:text-base text-white/80 leading-relaxed",children:"Sign in to manage your show, view your schedule, and access member-only resources."})]})]}),e.jsx("div",{className:"flex justify-center md:justify-end",children:e.jsxs("div",{className:"w-full max-w-md bg-white/95 backdrop-blur-sm rounded-3xl shadow-2xl p-5 md:p-10",children:[e.jsxs("div",{className:"text-center mb-4 md:mb-6",children:[e.jsx("h1",{className:"font-display text-xl md:text-2xl font-bold text-foreground",children:"Member Login"}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1",children:"Sign in to your Southern FM account"})]}),u==="email"&&e.jsxs(e.Fragment,{children:[e.jsxs("form",{onSubmit:y,method:"post",action:"/member",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"email",children:"Email"}),e.jsx(c,{id:"email",name:"email",type:"email",placeholder:"[email protected]",value:s,onChange:t=>b(t.target.value),required:!0,autoComplete:"email"})]}),e.jsxs(g,{type:"submit",className:"w-full",disabled:i,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),i?"Sendingâ¦":"Email me a sign-in code"]})]}),e.jsx("div",{className:"mt-4 text-center",children:e.jsx("button",{type:"button",onClick:()=>l("password"),className:"text-xs text-muted-foreground hover:text-foreground underline-offset-4 hover:underline transition-colors",children:"Sign in with password instead"})})]}),u==="code"&&e.jsxs(e.Fragment,{children:[e.jsxs("form",{onSubmit:k,className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["We've sent a one-time code to ",e.jsx("strong",{className:"text-foreground",children:s}),". Enter it below - or click the link in the email."]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"code",children:"Sign-in code"}),e.jsx(c,{id:"code",type:"text",inputMode:"numeric",placeholder:"123456",value:d,onChange:t=>j(t.target.value.replace(/\D/g,"").slice(0,6)),required:!0,autoComplete:"one-time-code",className:"text-center tracking-widest text-lg"})]}),e.jsx(g,{type:"submit",className:"w-full",disabled:i||d.length<6,children:i?"Verifyingâ¦":"Verify and sign in"})]}),e.jsxs("div",{className:"mt-4 text-center space-x-3",children:[e.jsx("button",{type:"button",onClick:()=>{l("email"),j("")},className:"text-xs text-muted-foreground hover:text-foreground underline-offset-4 hover:underline transition-colors",children:"Use a different email"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),e.jsx("button",{type:"button",onClick:y,className:"text-xs text-muted-foreground hover:text-foreground underline-offset-4 hover:underline transition-colors",children:"Resend code"})]})]}),u==="password"&&e.jsxs(e.Fragment,{children:[e.jsxs("form",{onSubmit:E,method:"post",action:"/member",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{htmlFor:"email-pw",children:"Email"}),e.jsx(c,{id:"email-pw",name:"email",type:"email",placeholder:"[email protected]",value:s,onChange:t=>b(t.target.value),required:!0,autoComplete:"email"})]}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(c,{id:"password",name:"password",type:h?"text":"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:x,onChange:t=>v(t.target.value),required:!0,autoComplete:"current-password",className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>S(t=>
1!t),className:"absolute inset-y-0 right-0 flex items-center px-3 text-muted-foreground hover:text-foreground","aria-label":h?"Hide password":"Show password",tabIndex:-1,children:h?e.jsx(D,{className:"h-4 w-4"}):e.jsx(R,{className:"h-4 w-4"})})]})]}),e.jsxs(g,{type:"submit",className:"w-full",disabled:i,children:[e.jsx(O,{className:"h-4 w-4 mr-2"}),i?"Signing inâ¦":"Sign in with password"]})]}),e.jsx("div",{className:"mt-4 text-center",children:e.jsx("button",{type:"button",onClick:()=>{l("email"),v("")},className:"text-xs text-muted-foreground hover:text-foreground underline-offset-4 hover:underline transition-colors",children:"Email me a code instead"})}),e.jsx("p",{className:"text-center text-[11px] text-muted-foreground mt-3",children:"Password login must be enabled by an admin for your account."})]}),e.jsx("p",{className:"text-center text-xs text-muted-foreground mt-6",children:"Contact your station admin if you need an account."})]})})]})})]})};export{G 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.