import{i as e,a4 as H,a7 as V,a5 as w,s as L,v as A,P as N,k as T,n as z}from"./app-JmgyQoR0.js";import{M as E}from"./MkPagination-urywMrXv.js";import{l as I}from"./lookup-user-3DZKI4Ns.js";import{M as W}from"./MkUserCardMini-zBoyIzWP.js";import{b as j,a as u,c,D as m,g as q,h as x,t as C,l as i,j as l,u as a,K as r,E as t,z as s,F as G,G as K,q as J,i as Q}from"./vue-y3KLWBaS.js";import"./MkMiniChart.vue_vue_type_script_setup_true_lang-pO1kuPAx.js";import"./v4-U7xWZqn4.js";const R={class:"lknzcolw"},X={class:"users"},Y={class:"inputs"},Z={value:"-createdAt"},ee={value:"+createdAt"},te={value:"-updatedAt"},se={value:"+updatedAt"},ae={value:"all"},oe={value:"available"},le={value:"admin"},ne={value:"moderator"},ie={value:"silenced"},de={value:"suspended"},re={value:"combined"},ue={value:"local"},pe={value:"remote"},ce={class:"inputs"},me=j({__name:"users",setup(_e){let y=u(),_=u("+createdAt"),v=u("all"),f=u("local"),h=u(""),g=u("");const M={endpoint:"admin/show-users",limit:10,params:c(()=>({sort:_.value,state:v.value,origin:f.value,username:h.value,hostname:g.value})),offsetMode:!0};function D(){L().then(d=>{$(d)})}async function S(){const{canceled:d,result:o}=await A({title:e.ts.username});if(d)return;const{canceled:k,result:b}=await A({title:e.ts.password,type:"password"});k||N("admin/accounts/create",{username:o,password:b}).then(U=>{y.value.reload()})}function $(d){T(`/user-info/${d.id}`)}const B=c(()=>[{icon:"ph-magnifying-glass ph-bold ph-lg",text:e.ts.search,handler:D},{asFullButton:!0,icon:"ph-plus ph-bold ph-lg",text:e.ts.addUser,handler:S},{asFullButton:!0,icon:"ph-magnifying-glass ph-bold ph-lg",text:e.ts.lookup,handler:I}]),P=c(()=>[]);return H(c(()=>({title:e.ts.users,icon:"ph-users ph-bold ph-lg"}))),(d,o)=>{const k=m("MkPageHeader"),b=m("MkA"),U=m("MkSpacer"),F=m("MkStickyContainer"),O=q("tooltip");return x(),C("div",null,[i(F,null,{header:l(()=>[i(k,{actions:B.value,tabs:P.value,"display-back-button":!0},null,8,["actions","tabs"])]),default:l(()=>[i(U,{"content-max":900},{default:l(()=>[a("div",R,[a("div",X,[a("div",Y,[i(V,{modelValue:_.value,"onUpdate:modelValue":o[0]||(o[0]=n=>_.value=n),style:{flex:"1"}},{label:l(()=>[r(t(s(e).ts.sort),1)]),default:l(()=>[a("option",Z,t(s(e).ts.registeredDate)+" ("+t(s(e).ts.ascendingOrder)+") ",1),a("option",ee,t(s(e).ts.registeredDate)+" ("+t(s(e).ts.descendingOrder)+") ",1),a("option",te,t(s(e).ts.lastUsed)+" ("+t(s(e).ts.ascendingOrder)+") ",1),a("option",se,t(s(e).ts.lastUsed)+" ("+t(s(e).ts.descendingOrder)+") ",1)]),_:1},8,["modelValue"]),i(V,{modelValue:v.value,"onUpdate:modelValue":o[1]||(o[1]=n=>v.value=n),style:{flex:"1"}},{label:l(()=>[r(t(s(e).ts.state),1)]),default:l(()=>[a("option",ae,t(s(e).ts.all),1),a("option",oe,t(s(e).ts.normal),1),a("option",le,t(s(e).ts.administrator),1),a("option",ne,t(s(e).ts.moderator),1),a("option",ie,t(s(e).ts.silence),1),a("option",de,t(s(e).ts.suspend),1)]),_:1},8,["modelValue"]),i(V,{modelValue:f.value,"onUpdate:modelValue":o[2]||(o[2]=n=>f.value=n),style:{flex:"1"}},{label:l(()=>[r(t(s(e).ts.instance),1)]),default:l(()=>[a("option",re,t(s(e).ts.all),1),a("option",ue,t(s(e).ts.local),1),a("option",pe,t(s(e).ts.remote),1)]),_:1},8,["modelValue"])]),a("div",ce,[i(w,{modelValue:h.value,"onUpdate:modelValue":[o[3]||(o[3]=n=>h.value=n),o[4]||(o[4]=n=>d.$refs.users.reload())],style:{flex:"1"},type:"text",spellcheck:!1},{prefix:l(()=>[r("@")]),label:l(()=>[r(t(s(e).ts.username),1)]),_:1},8,["modelValue"]),i(w,{modelValue:g.value,"onUpdate:modelValue":[o[5]||(o[5]=n=>g.value=n),o[6]||(o[6]=n=>d.$refs.users.reload())],style:{flex:"1"},type:"text",spellcheck:!1,disabled:M.params.origin==="local"},{prefix:l(()=>[r("@")]),label:l(()=>[r(t(s(e).ts.host),1)]),_:1},8,["modelValue","disabled"])]),i(E,{ref_key:"paginationComponent",ref:y,pagination:M,class:"users"},{default:l(({items:n})=>[(x(!0),C(G,null,K(n,p=>J((x(),Q(b,{key:p.id,class:"user",to:`/user-info/${p.id}`},{default:l(()=>[i(W,{user:p},null,8,["user"])]),_:2},1032,["to"])),[[O,`Last posted: ${new Date(p.updatedAt).toLocaleString()}`,void 0,{mfm:!0}]])),128))]),_:1},512)])])]),_:1})]),_:1})])}}}),xe=z(me,[["__scopeId","data-v-c26e82fa"]]);export{xe as default};
