1import{u as w,r as d,A as f,a as m,j as e,B as i,L as x}from"./index-BrT3F50e.js";import{A as j}from"./AuthPageLayout-DkODiInx.js";import{F as o}from"./index-DObnsLqY.js";import{I as n}from"./index-BI2D8MSW.js";import"./useForm-BVKnLQxW.js";import"./row-D-CZ3Hqh.js";import"./useBreakpoint-FD8ghq8d.js";import"./getAllowClear-C4A34otO.js";import"./Input-DOcZa3u3.js";import"./TextArea-BpydDq59.js";function C(){const{signin:l}=w(),[p,c]=d.useState(!1),{message:a}=f.useApp(),[h]=o.useForm(),u=d.useCallback(async r=>{try{c(!0);const s=await m.signUp(r),t=await l(s.token);a.success("Account created successfully"),t.length>0?window.location.href=`/workspace/${t[0].id}/create`:window.location.href="/activate"}catch(s){a.error(s?.message||"Failed to register")}finally{c(!1)}},[l,a]),g=()=>{const r=window.GOOGLE_CLIENT_ID,s=window.GOOGLE_REDIRECT_URL;if(!r||!s)return;const t=["openid","email","profile","https://www.googleapis.com/auth/contacts.readonly","https://www.googleapis.com/auth/contacts.other.readonly"].join(" ");window.location.href=`https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=${r}&redirect_uri=${s}&scope=${t}&access_type=offline&prompt=consent`},y=async()=>{try{const r=await m.appleLogin();r.redirectUrl&&(window.location.href=r.redirectUrl.toString())}catch(r){a.error(r?.message||"Failed to start Apple login")}};return e.jsxs(j,{title:"Create your account",subtitle:"Sign up to access AI email generation, save your campaigns, and more.",children:[e.jsxs(o,{form:h,name:"signup",onFinish:u,layout:"vertical",children:[e.jsx(o.Item,{name:"email",label:"Email",rules:[{required:!0,message:"Please enter your email"},{type:"email",message:"Please enter a valid email"}],children:e.jsx(n,{placeholder:"Enter your email",style:{height:44,borderRadius:10}})}),e.jsx(o.Item,{name:"password",label:"Password",rules:[{required:!0,message:"Please enter your password"},{min:8,message:"Password must be at least 8 characters"},{validator:(r,s)=>[...s].length<=32?Promise.resolve():Promise.reject(new Error("Password must be at most 32 characters"))}],children:e.jsx(n.Password,{placeholder:"Enter your password",style:{height:44,borderRadius:10}})}),e.jsx(o.Item,{name:"confirm_password",label:"Confirm Password",dependencies:["password"],rules:[{required:!0,message:"Please confirm your password"},({getFieldValue:r})=>({validator(s,t){return!t||r("password")===t?Promise.resolve():Promise.reject(new Error("Passwords do not match"))}})],children:e.jsx(n.Password,{placeholder:"Confirm your password",style:{height:44,borderRadius:10}})}),e.jsx(o.Item,{style:{marginBottom:12},children:e.jsx(i,{type:"primary",htmlType:"submit",block:!0,loading:p,style:{height:48,borderRadius:10,fontWeight:600,fontSize:16},children:"Create Account"})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,margin:"4px 0 20px"},children:[e.jsx("div",{style:{flex:1,height:1,background:"#E4E4E4"}}),e.jsx("span",{style:{fontSize:12,color:"rgba(28, 29, 31, 0.35)",fontWeight:500},children:"or"}),e.jsx("div",{style:{flex:1,height:1,background:"#E4E4E4"}})]}),e.jsxs("div",{style:{display:"flex",gap:10,marginBottom:20},children:[e.jsx(i,{block:!0,onClick:g,style:{height:44,borderRadius:10,fontWeight:500},children:"Google"}),e.jsx(i,{block:!0,onClick:y,style:{height:44,borderRadius:10,fontWeight:500},children:"Apple"})]}),e.jsx("div",{style:{textAlign:"center"},children:e.jsxs("span",{style:{fontSize:13,color:"rgba(28, 29, 31, 0.5)"},children:["Already have an account?"," ",e.jsx(x,{to:"/signin",style:{color:"#2F6DFB",fontWeight:500},children:"Sign In"})]})})]})}export{C as RegistrationPage};
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.