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