System.register(["./index-legacy-BGUFxny_.js","./FolderTree-legacy-DAN7i0-E.js","./PublicKeys-legacy-Bs1vMOWk.js","./index-legacy-CwkvHJvM.js"],function(e,r){"use strict";var n,t,s,a,i,l,u,d,c,g,o,p,h,m,f,w,b,y,$,x,I,_,v,C,j;return{setters:[e=>{n=e.j,t=e.bV,s=e.b9,a=e.bq,i=e.D,l=e.ah,u=e.c0,d=e.o,c=e.S,g=e.bR,o=e.bE,p=e.I,h=e.a5,m=e.b$,f=e.R,w=e.aW,b=e.bc,y=e.K,$=e.bt,x=e.r,I=e.a6,_=e.d9,v=e.ao},e=>{C=e.a},e=>{j=e.P},null],execute:function(){const r=e=>{const r=d();return i(g,{display:"inline-flex",flexDirection:"row",alignItems:"center",gap:"$2",rounded:"$md",shadow:"$md",p:"$2",w:"fit-content",get children(){return[i(o,{mb:"0",get children(){return r(`users.permissions.${e.name}`)}}),i(b,{get checked(){return e.can},onChange:()=>e.onChange(!e.can)})]}})};e("default",()=>{const e=d(),{params:k,back:q}=n(),{id:D}=k,[S,T]=t({id:0,username:"",password:"",base_path:"",role:0,permission:0,disabled:!1,sso_id:""}),[F,K]=s(()=>a.get(`/admin/user/get?id=${D}`));D&&(async()=>{const e=await K();$(e,T)})();const[P,R]=s(()=>a.post("/admin/user/"+(D?"update":"create"),S));return i(v,{get loading(){return F()},get children(){return i(l,{w:"$full",alignItems:"start",spacing:"$2",get children(){return[i(u,{get children(){return e("global."+(D?"edit":"add"))}}),i(c,{get when(){return!h.is_guest(S)},get children(){return[i(g,{w:"$full",display:"flex",flexDirection:"column",required:!0,get children(){return[i(o,{for:"username",display:"flex",alignItems:"center",get children(){return e("users.username")}}),i(p,{id:"username",get value(){return S.username},onInput:e=>T("username",e.currentTarget.value)})]}}),i(g,{w:"$full",display:"flex",flexDirection:"column",required:!0,get children(){return[i(o,{for:"password",display:"flex",alignItems:"center",get children(){return e("users.password")}}),i(p,{id:"password",type:"password",placeholder:"********",get value(){return S.password},onInput:e=>T("password",e.currentTarget.value)})]}})]}}),i(g,{w:"$full",display:"flex",flexDirection:"column",required:!0,get children(){return[i(o,{for:"base_path",display:"flex",alignItems:"center",get children(){return e("users.base_path")}}),i(C,{id:"base_path",get value(){return S.base_path},onChange:e=>T("base_path",e),onlyFolder:!0})]}}),i(g,{w:"$full",required:!0,get children(){return[i(o,{display:"flex",alignItems:"center",get children(){return e("users.permission")}}),i(m,{w:"$full",wrap:"wrap",gap:"$2",get children(){return i(f,{each:w,children:(e,n)=>i(r,{name:e,get can(){return h.can(S,n())},onChange:e=>{T("permission",e?S.permission|=1<<n():S.permission&=~(1<<n()))}})})}})]}}),i(g,{w:"fit-content",display:"flex",get children(){return i(b,{css:{whiteSpace:"nowrap"},id:"disabled",onChange:e=>T("disabled",e.currentTarget.checked),color:"$neutral10",fontSize:"$sm",get checked(){return S.disabled},get children(){return e("users.disabled")}})}}),i(y,{get loading(){return P()},onClick:async()=>{const r=await R();$(r,async()=>{x.success(e("global.save_success")),S.username===I().username&&$(await a.get("/me"),_),q()})},get children(){return e("global."+(D?"save":"add"))}}),i(c,{get when(){return D&&!h.is_guest(S)},get children(){return i(j,{isMine:!1,get userId(){return parseInt(D)}})}})]}})}})})}}});
