import{c as t}from"./CVq-Ik9t.js";import{e as o}from"./92N1comP.js";async function f(){const e=await t.get("/users/filters");return Array.isArray(e)?{tabs:e,defaultFilter:"all",showAll:!0}:{tabs:e.tabs??[],defaultFilter:e.defaultFilter??"all",showAll:e.showAll??!0}}async function y(){try{const e=await t.get("/users/columns");return Array.isArray(e)?e:e.columns??[]}catch{return[]}}async function p(){try{const e=await t.get("/users/row-actions");return Array.isArray(e)?e:e.actions??[]}catch{return[]}}async function d(e,s){return t.post(`/users/${e}/row-action`,{id:s})}async function g(e=1,s=20,a={}){const r={page:String(e),per_page:String(s)};a.search&&(r.search=a.search),a.access&&(r.access=a.access),a.group&&(r.group=a.group),a.filter&&a.filter!=="all"&&(r.filter=a.filter);const n=await t.getFullBody("/users",r),c=n.data??[],u=n.meta?.pagination??{};return{users:c,total:u.total??c.length,page:u.page??e,perPage:u.per_page??s,totalPages:u.total_pages??1}}async function w(e){const{data:s,headers:a}=await t.requestRaw("GET",`/users/${e}`);return{user:s,etag:o(a)}}async function A(e){return t.post("/users",e)}async function h(e,s,a){const r={};a&&(r["If-Match"]=`"${a}"`);const n=await t.requestRaw("PATCH",`/users/${e}`,{body:s,headers:r});return{user:n.data,etag:o(n.headers)}}async function $(e){await t.delete(`/users/${e}`)}async function b(e,s){return t.uploadFile(`/users/${e}/avatar`,s,{fieldName:"avatar"})}async function m(e){return t.delete(`/users/${e}/avatar`)}async function U(e){return t.post(`/users/${e}/2fa`)}async function F(e,s){return t.post(`/users/${e}/2fa/enable`,{code:s})}async function v(e,s){const a={};return s&&(a.code=s),t.post(`/users/${e}/2fa/disable`,a)}async function k(e){return t.get(`/users/${e}/api-keys`)}async function R(e,s,a){const r={name:s};return a&&a>0&&(r.expiry_days=a),t.post(`/users/${e}/api-keys`,r)}async function _(e,s){await t.delete(`/users/${e}/api-keys/${s}`)}export{k as a,_ as b,A as c,v as d,F as e,R as f,U as g,m as h,h as i,$ as j,w as k,g as l,f as m,y as n,p as o,d as p,b as u};
