1import{P as E,Y as F,cp as O,r as n,J as _,K as p,m as l,j as e,R as b,B as I,w as M,e as H,L as P}from"./main-HVf8ATPQ.js";import{A as T}from"./auth-card-DLfQctxU.js";import{F as G}from"./form-error-Y84_5mtk.js";import{F as V}from"./form-success-CU_JCYv2.js";import{F as J,a as u,b as h,c as x,d as f,e as g}from"./form-BBBry7N8.js";import{I as j}from"./input-ePyCg58M.js";import{S as K,p as W,g as Y}from"./social-login-button-BkEoKK3_.js";import{a as Q}from"./zod-B2Wu2JFI.js";import{u as X}from"./index.esm-Boe4NRES.js";import{I as Z}from"./IconEyeOff-BloCvZc6.js";import{I as $}from"./IconEye-BSVfHcvX.js";import{I as ee}from"./IconLoader2-CRzzoIOT.js";import"./card-wN0xATCv.js";import"./IconCircleCheck-JquG_itO.js";import"./label-AxAuTRIG.js";const se=["qq.com","gmail.com"];function re(c){const a=c.trim().toLowerCase().split("@")[1];return a?se.includes(a):!1}const s=l.auth.register;function ae({callbackUrl:c}){const a=typeof window<"u"?E(window.location.pathname):E(),w=typeof window<"u"?new URLSearchParams(window.location.search).get("callbackUrl"):null,R=F(O,a),y=F(c??(w||R),a),[C,S]=n.useState(void 0),[k,N]=n.useState(void 0),[o,L]=n.useState(!1),[m,U]=n.useState(!1),A=M.auth?.enableCredentialLogin,q=_({email:p().email({message:s.emailRequired}).refine(r=>re(r),{message:s.emailDomainNotSupported}),password:p().min(1,{message:s.passwordRequired}),name:p().min(1,{message:s.nameRequired})}),t=X({resolver:Q(q),defaultValues:{email:"",password:"",name:""}}),z=async r=>{W(Y(a)),await H.signUp.email({email:r.email,password:r.password,name:r.name,callbackURL:y},{onRequest:()=>{L(!0),S(""),N("")},onResponse:()=>L(!1),onSuccess:()=>N(s.checkEmail),onError:v=>{const d=v.error.code,D=d&&l.auth.error.codes[d]?l.auth.error.codes[d]:v.error.message;S(D)}})},B=()=>{U(r=>!r)};return e.jsxs(T,{headerLabel:s.createAccount,bottomButtonLabel:s.signInHint,bottomButtonHref:b.Login,children:[e.jsx(J,{...t,children:e.jsxs("form",{onSubmit:t.handleSubmit(z),className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(u,{control:t.control,name:"name",render:({field:r})=>e.jsxs(h,{children:[e.jsx(x,{children:s.name}),e.jsx(f,{children:e.jsx(j,{...r,disabled:o,placeholder:s.placeholderName})}),e.jsx(g,{})]})}),e.jsx(u,{control:t.control,name:"email",render:({field:r})=>e.jsxs(h,{children:[e.jsx(x,{children:s.email}),e.jsx(f,{children:e.jsx(j,{...r,disabled:o,placeholder:s.placeholderEmail,type:"email"})}),e.jsx(g,{})]})}),e.jsx(u,{control:t.control,name:"password",render:({field:r})=>e.jsxs(h,{children:[e.jsx(x,{children:s.password}),e.jsxs("div",{className:"relative",children:[e.jsx(f,{children:e.jsx(j,{...r,disabled:o,placeholder:s.placeholderPassword,type:m?"text":"password",className:"pr-10"})}),e.jsxs(I,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 border-0 bg-transparent hover:bg-transparent hover:opacity-70 dark:hover:bg-transparent",onClick:B,disabled:o,children:[m?e.jsx(Z,{className:"size-4 text-muted-foreground"}):e.jsx($,{className:"size-4 text-muted-foreground"}),e.jsx("span",{className:"sr-only",children:m?s.hidePassword:s.showPassword})]})]}),e.jsx(g,{})]})})]}),e.jsx(G,{message:C}),e.jsx(V,{message:k}),e.jsxs(I,{disabled:o,size:"lg",type:"submit",className:"w-full flex items-center justify-center gap-2",children:[o&&e.jsx(ee,{className:"size-4 animate-spin"}),e.jsx("span",{children:s.signUp})]})]})}),e.jsx("div",{className:"mt-4",children:e.jsx(K,{callbackUrl:y,showDivider:A})})]})}const i=l.auth.common;function be(){return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ae,{}),e.jsxs("div",{className:"text-balance text-center text-xs text-muted-foreground",children:[i.byClickingContinue,e.jsx(P,{to:b.TermsOfService,className:"underline underline-offset-4 hover:text-primary",children:i.termsOfService}),i.and,e.jsx(P,{to:b.PrivacyPolicy,className:"underline underline-offset-4 hover:text-primary",children:i.privacyPolicy})]})]})}export{be 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.