System.register(["./index-legacy-BGUFxny_.js","./useTitle-legacy-Ck1as0cr.js","./DeletePopover-legacy-3-H7HjF3.js","./Wether-legacy-CbG7auAA.js"],function(e,r){"use strict";var n,t,c,l,s,a,i,u,d,g,o,h,m,b,$,f,p,y,w,_,v,j,k,C,S,x,D;return{setters:[e=>{n=e.j,t=e.b9,c=e.bq,l=e.B,s=e.dq,a=e.D,i=e.aw,u=e.K,d=e.o,g=e.an,o=e.dr,h=e.ds,m=e.dt,b=e.R,$=e.du,f=e.dv,p=e.dw,y=e.bt,w=e.r,_=e.ah,v=e.cz,j=e.aW,k=e.aV,C=e.a5},e=>{S=e.b},e=>{x=e.D},e=>{D=e.W}],execute:function(){const r=e=>{const r=[{name:"general",color:"info"},{name:"guest",color:"neutral"},{name:"admin",color:"accent"}];return a(v,{get colorScheme(){return r[e.role].color},get children(){return r[e.role].name}})},W=e=>{const r=d();return a(i,{spacing:"$0_5",get children(){return a(b,{each:j,children:(n,t)=>a(k,{get label(){return r(`users.permissions.${n}`)},get children(){return a(g,{boxSize:"$2",rounded:"$full",get bg(){return`$${C.can(e.user,t())?"success":"danger"}9`}})}})})}})};e("default",()=>{const e=d();S("manage.sidemenu.users");const{to:v}=n(),[j,k]=t(()=>c.get("/admin/user/list")),[C,q]=l([]),z=async()=>{const e=await k();y(e,e=>q(e.content))};z();const[B,H]=s(e=>c.post(`/admin/user/delete?id=${e}`)),[I,K]=s(e=>c.post(`/admin/user/cancel_2fa?id=${e}`));return a(_,{spacing:"$2",alignItems:"start",w:"$full",get children(){return[a(i,{spacing:"$2",get children(){return[a(u,{colorScheme:"accent",get loading(){return j()},onClick:z,get children(){return e("global.refresh")}}),a(u,{onClick:()=>{v("/@manage/users/add")},get children(){return e("global.add")}})]}}),a(g,{w:"$full",overflowX:"auto",get children(){return a(o,{highlightOnHover:!0,dense:!0,get children(){return[a(h,{get children(){return a(m,{get children(){return[a(b,{each:["username","base_path","role","permission","available"],children:r=>a($,{get children(){return e(`users.${r}`)}})}),a($,{get children(){return e("global.operations")}})]}})}}),a(f,{get children(){return a(b,{get each(){return C()},children:n=>a(m,{get children(){return[a(p,{get children(){return n.username}}),a(p,{get children(){return n.base_path}}),a(p,{get children(){return a(r,{get role(){return n.role}})}}),a(p,{get children(){return a(W,{user:n})}}),a(p,{get children(){return a(D,{get yes(){return!n.disabled}})}}),a(p,{get children(){return a(i,{spacing:"$2",get children(){return[a(u,{onClick:()=>{v(`/@manage/users/edit/${n.id}`)},get children(){return e("global.edit")}}),a(x,{get name(){return n.username},get loading(){return B()===n.id},onClick:async()=>{const r=await H(n.id);y(r,()=>{w.success(e("global.delete_success")),z()})}}),a(u,{colorScheme:"accent",get loading(){return I()===n.id},onClick:async()=>{const r=await K(n.id);y(r,()=>{w.success(e("users.cancel_2fa_success")),z()})},get children(){return e("users.cancel_2fa")}})]}})}})]}})})}})]}})}})]}})})}}});
