1import{G as X,aE as Y,aJ as Z,aq as ee,ae as k,o as V,aP as s,A as t,$ as ae,az as n,n as w,au as m,aR as te,z as S,q as ne,F as oe,ao as ie,al as c,aj as le,l as se}from"./vendor-vue-IyrjVwZg.js";import{v as r}from"./vendor-utils-BLTdPet_.js";import{u as re}from"./useAlert-DSD6kk5F.js";import{_ as ue}from"./Alert.vue_vue_type_script_setup_true_lang-DhJjvSE7.js";import{bI as ce,bA as de,bF as j,au as me,aP as pe,a2 as fe,aM as A,K as ve,aC as be,aQ as ke,aB as ye,r as ge,bt as _e}from"./app-DOJvNHTs.js";import{S as he}from"./send-mail-DMI_76Up.js";import{_ as y}from"./WgTextField.vue_vue_type_script_setup_true_lang-dw0Cyw08.js";import{au as Ve,s as we,a8 as g,l as Se,aa as Ce,L as Ne,N as D,j as C,z as Re}from"./vendor-vuetify-BgpDp5oD.js";import{b as E}from"./route-block-B_A1xBdJ.js";const xe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"Register"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UsersPermissionsRegisterInput"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"register"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"jwt"}}]}}]}}]},Ie={class:"text-center mt-2 mb-6"},je={class:"d-flex"},Ae={class:"text-center caption font-weight-light my-3"},M=X({__name:"Register",setup(N){const{t:i}=Y(),U=Z(),{updateReferer:q}=ce(),B=c(null),_=c(),p=re(_,B),f=c(null),R=c(null),u=c(null),h=c(),a=le({count:0,timer:void 0,code:"",email:""}),F=[e=>!r.isEmpty(e??"")||"password required",e=>r.isLength(e,{min:6,max:64})||"length should be between 6 to 64"],L=[e=>r.equals(e??"",f.value??"")||"repeat should be same as password"],O=[e=>r.isEmail(e??"")||"email format should be valid"],x=[e=>r.isLength(e??"",{min:6,max:6})&&r.equals(e??"",a.code)&&r.equals(u.value??"",a.email)||"verify code is't correct"],{smAndDown:P}=Ve(),v=ge(!1,!0),z=[{icon:ve,color:"black",href:`${v}/api/connect/apple`},{icon:be,color:"red",href:`${v}/api/connect/google`},{icon:ke,color:"blue",href:`${v}/api/connect/microsoft`},{icon:ye,color:"black",href:`${v}/api/connect/github`}],{login:T}=de(),{mutate:G,onError:K}=j(xe);async function H(e){var b,I;if(!(await e).valid)return;const d=await G({input:{username:u.value??"",password:f.value??"",email:u.value??""}}),o=(I=(b=d==null?void 0:d.data)==null?void 0:b.register)==null?void 0:I.jwt;o&&(await T(o),await q(),U.replace("/dashboard"))}K(e=>{e.message.includes("error")&&(e.message+=". maybe name duplicate!"),_.value=e});const{mutate:J}=j(he);async function Q(){try{a.timer&&(clearInterval(a.timer),a.timer=void 0),a.count=60,a.timer=setInterval(()=>{a.count=a.count-1,a.count===0&&(clearInterval(a.timer),a.timer=void 0)},1e3),a.email=u.value??"",a.code=_e(6),await J({emailOption:{to:a.email},type:"v-code",data:{code:a.code,user:{name:a.email.split("@")[0],email:a.email}}}),p.msg=i("a-r-email-tip",{email:a.email}),p.type="success",p.show=!0}catch(e){_.value=e}}const W=se(()=>x.map(e=>e(h.value)===!0).reduce((e,l)=>e&&l,!0));return(e,l)=>{const d=ee("router-link");return k(),V(g,{style:{opacity:"1"}},{default:s(()=>[t(we,{cols:"12"},{default:s(()=>[t(g,{justify:"center"},{default:s(()=>[t(Se,ae({width:"400px"},n(P)?{variant:"flat"}:{elevation:5}),{default:s(()=>[t(Ce,{class:"mx-10 my-6"},{default:s(()=>[t(ue),w("h3",Ie,m(n(i)("Sign up My Account")),1),t(Ne,{"validate-on":"submit",onKeydown:l[4]||(l[4]=o=>n(p).show=!1),onSubmit:te(H,["prevent"])},{default:s(()=>[t(y,{modelValue:u.value,"onUpdate:modelValue":l[0]||(l[0]=o=>u.value=o),rules:O,label:n(i)("Email"),"prepend-inner-icon":n(me)},null,8,["modelValue","label","prepend-inner-icon"]),w("div",je,[t(y,{modelValue:h.value,"onUpdate:modelValue":l[1]||(l[1]=o=>h.value=o),rules:x,label:n(i)("Verification Code"),"prepend-inner-icon":n(pe)},null,8,["modelValue","label","prepend-inner-icon"]),W.value?(k(),V(D,{key:0,icon:n(fe),class:"mt-2",color:"green"},null,8,["icon"])):(k(),V(C,{key:1,color:"primary",class:"ml-3",disabled:a.timer!==void 0,onClick:Q},{default:s(()=>[S(m(a.count>0?a.count:n(i)("Send")),1)]),_:1},8,["disabled"]))]),t(y,{modelValue:f.value,"onUpdate:modelValue":l[2]||(l[2]=o=>f.value=o),rules:F,label:n(i)("Password"),type:"password","prepe
1nd-inner-icon":n(A)},null,8,["modelValue","label","prepend-inner-icon"]),t(y,{modelValue:R.value,"onUpdate:modelValue":l[3]||(l[3]=o=>R.value=o),rules:L,label:n(i)("Password repeat"),type:"password","prepend-inner-icon":n(A)},null,8,["modelValue","label","prepend-inner-icon"]),t(C,{block:"",color:"primary",type:"submit"},{default:s(()=>[S(m(n(i)("Sign up")),1)]),_:1})]),_:1}),w("div",Ae,m(n(i)("Or")),1),t(g,{justify:"center"},{default:s(()=>[(k(),ne(oe,null,ie(z,(o,b)=>t(C,{key:b,variant:"flat",icon:"",href:o.href},{default:s(()=>[t(D,{icon:o.icon,color:o.color,size:"24"},null,8,["icon","color"])]),_:2},1032,["href"])),64))]),_:1}),t(Re,{class:"my-6"}),t(g,{justify:"center"},{default:s(()=>[t(d,{class:"robot-link",to:"/auth/login/"},{default:s(()=>[S(m(n(i)("Already have an account? Log In")),1)]),_:1})]),_:1})]),_:1})]),_:1},16)]),_:1})]),_:1})]),_:1})}}});function $(N){const i=N;i.__i18n=i.__i18n||[],i.__i18n.push({locale:"",resource:{en:{"a-r-email-tip":{t:0,b:{t:2,i:[{t:3,v:"The 6-digit verification code has been sent to your email "},{t:4,k:"email"},{t:3,v:". If you donât see it in your inbox, please check your spam or junk folder."}]}}},"zh-Hans":{"Verification Code":{t:0,b:{t:2,i:[{t:3}],s:"é®ç®±éªè¯ç "}},Send:{t:0,b:{t:2,i:[{t:3}],s:"åé"}},"a-r-email-tip":{t:0,b:{t:2,i:[{t:3,v:"6ä½è®¤è¯ç å·²åéè³æ¨çé®ç®± "},{t:4,k:"email"},{t:3,v:"è¯·æ¥æ¶ãå¦ææªæ¶å°ï¼è¯·æ£æ¥åå¾é®ä»¶æä»¶å¤¹ã"}]}}}}})}typeof E=="function"&&E(M);typeof $=="function"&&$(M);export{M 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.