import{K as b,X as y,P as w,Y as T,A as C,B as o,C as S,E as U,b as a,a6 as B,a8 as R,S as s,G as p,Q as f,c as _,V as k,$ as N,Z as A,a4 as n,an as F}from"#entry";import{V as H,a as M}from"./KZF8CoAo.js";import{V as E}from"./gMmVrYwQ.js";import{V as L,a as O}from"./DlybGOWB.js";import{V as P}from"./DArAxlee.js";import{V}from"./tRJ_cXK7.js";import{V as h}from"./CdIepk1e.js";import{V as j}from"./DSnRMG2T.js";import{V as q}from"./D1vV9CHW.js";import"./xGkJbl6f.js";import"./D_qxKlPu.js";import"./BML-0xFj.js";import"./CIr4U5gS.js";import"./C1aoz2cp.js";import"./LWaCnj-p.js";import"./0VvUL2KS.js";const D=["innerHTML"],re={__name:"register",setup(G){const c=b("settings"),{t:g}=y();w({title:`${c.value.title} - ${g("common.register")}`});const d=n(),v=n(),i=n(!1),r=F({email:"",password:"",description:""}),m=n(!1),{$notify:u}=T(),$=async()=>{if(await d.value.validate()){try{i.value=!0;const e=await $fetch("/api/user/register",{method:"POST",body:r}),l=e&&e.role==="admin"&&e.is_active;u(l?"register.first_user":"register.complete"),N("/")}catch(e){u(e,A.ERROR)}i.value=!1}};return(t,e)=>(U(),C(S,{class:"pa-0 pa-md-3"},{default:o(()=>[a(H,{class:"mt-md-5 ma-0",align:"center",justify:"center"},{default:o(()=>[a(M,{class:"pa-0 pa-md-3",cols:"12",md:"6",lg:"5",xl:"4"},{default:o(()=>[a(E,{ref_key:"form",ref:d,modelValue:s(m),"onUpdate:modelValue":e[3]||(e[3]=l=>R(m)?m.value=l:null),onSubmit:B($,["prevent"])},{default:o(()=>[a(L,null,{default:o(()=>[a(O,null,{default:o(()=>[p(f(t.$t("common.register")),1)]),_:1}),a(P,null,{default:o(()=>[_("p",{innerHTML:t.$t("register.description")},null,8,D),a(V,{ref_key:"email",ref:v,modelValue:s(r).email,"onUpdate:modelValue":e[0]||(e[0]=l=>s(r).email=l),type:"email",rules:t.$valid.email,label:t.$t("common.email"),autocomplete:"email"},null,8,["modelValue","rules","label"]),a(V,{modelValue:s(r).password,"onUpdate:modelValue":e[1]||(e[1]=l=>s(r).password=l),type:"password",rules:[t.$valid.password],label:t.$t("common.password")},null,8,["modelValue","rules","label"]),a(h,{modelValue:s(r).description,"onUpdate:modelValue":e[2]||(e[2]=l=>s(r).description=l),rules:[t.$valid.required(t.$t("common.description"))],label:t.$t("common.description")},null,8,["modelValue","rules","label"])]),_:1}),a(j,null,{default:o(()=>[a(q),a(k,{type:"submit",variant:"outlined","append-icon":"mdi-chevron-right",disabled:!s(m)||s(i),loading:s(i),color:"primary"},{default:o(()=>[p(f(t.$t("common.send")),1)]),_:1},8,["disabled","loading"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}))}};export{re as default};
