1import{r as e}from"./rolldown-runtime-hePW80VL.js";import{o as t}from"./useSelector-DoRkm47G.js";import{t as n}from"./jsx-runtime-NZYk81nU.js";import{i as r,o as i}from"./router-compat-DtdT4yU9.js";import{t as a}from"./client-C6SfcO5p.js";import{t as o}from"./button-CdrAMptO.js";import{t as s}from"./arrow-left-DeO3ZLLJ.js";import{t as c}from"./eye-off-aOPih-13.js";import{t as l}from"./eye-CP_z8aLr.js";import{O as u,_ as d}from"./index-CS7phxQ0.js";import{t as f}from"./input-X_P5OwED.js";import{t as p}from"./sanitize-CsylAp55.js";import{t as m}from"./dsl-logo-C5HiAe-F.js";var h=e(t(),1),g=n(),_=()=>{let{toast:e}=u(),t=r(),[n]=i(),_=p(n.get(`email`)||``),v=n.get(`ref`)||``,y=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v)?v:``,[b,x]=(0,h.useState)(_),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(``),[E,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{_&&x(_)},[_]),(0,g.jsxs)(`div`,{className:`min-h-screen bg-background flex items-center justify-center p-4`,children:[(0,g.jsx)(d,{title:`Activate Your Referrer Account`,description:`Set your password and activate your DSL for Care referrer account to start tracking referrals and earning rewards.`,path:`/referrer-signup`,noindex:!0}
1),(0,g.jsxs)(`div`,{className:`w-full max-w-md space-y-6`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,g.jsx)(o,{variant:`ghost`,size:`icon`,onClick:()=>t(`/`),children:(0,g.jsx)(s,{className:`h-5 w-5`})}),(0,g.jsx)(`a`,{href:`https://dslforcare.com`,className:`shrink-0`,children:(0,g.jsx)(`img`,{src:m,alt:`Data Soft Logic`,className:`h-10 w-auto object-contain`})})]}),(0,g.jsxs)(`div`,{className:`p-8 rounded-2xl bg-card border border-border shadow-soft space-y-6`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-2xl font-extrabold text-foreground`,children:`Create Your Referrer Account`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Set up your login to access the Referrer Portal.`})]}),(0,g.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),S.length<8){e({title:`Password too short`,description:`Must be at least 8 characters.`,variant:`destructive`});return}if(S!==w){e({title:`Passwords don't match`,variant:`destructive`});return}let r=p(b);if(!r){e({title:`Check your email address`,description:`Please enter a valid email address.`,variant:`destructive`});return}k(!0);let{data:i,error:o}=await a.auth.signUp({email:r,password:S,options:{emailRedirectTo:window.location.origin+`/referrer-dashboard`}});if(o){e({title:`Error`,description:o.message,variant:`destructive`}),k(!1);return}i.user&&y&&(await a.from(`referrers`).update({user_id:i.user.id}).eq(`id`,y),await a.functions.invoke(`assign-referrer-role`,{body:{userId:i.user.id}})),k(!1),e({title:`Account created!`,description:`Please check your email to verify your account.`}),t(`/login`)},className:`space-y-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-sm font-medium mb-1 block`,children:`Email`}),(0,g.jsx)(f,{type:`email`,value:b,onChange:e=>x(e.target.value),required:!0,disabled:!!_,placeholder:`[email protected]`})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-sm font-medium mb-1 block`,children:`Password`}),(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(f,{type:E?`text`:`password`,value:S,onChange:e=>C(e.target.value),required:!0,minLength:8,placeholder:`Min 8 characters`}),(0,g.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute right-1 top-0 h-full`,onClick:()=>D(!E),children:E?(0,g.jsx)(c,{className:`h-4 w-4`}):(0,g.jsx)(l,{className:`h-4 w-4`})})]})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`text-sm font-medium mb-1 block`,children:`Confirm Password`}),(0,g.jsx)(f,{type:`password`,value:w,onChange:e=>T(e.target.value),required:!0,placeholder:`Re-enter password`})]}),(0,g.jsx)(o,{type:`submit`,className:`w-full gradient-primary text-primary-foreground`,disabled:O,children:O?`Creating Account...`:`Create Account`})]}),(0,g.jsxs)(`p`,{className:`text-xs text-center text-muted-foreground`,children:[`Already have an account?`,` `,(0,g.jsx)(`button`,{onClick:()=>t(`/login`),className:`text-primary underline`,children:`Sign in`})]})]})]})]})};export{_ as component};
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.