import{R as n,bI as a,es as o,db as r,et as u,a as c,aT as p,q as h}from"./index-Dz5JRQhj.js";const d=["can_delete","can_edit"],i=async e=>{const t=new URLSearchParams;return t.set("recursion","1"),r(t,e,d),fetch(`${n}/1.0/auth/groups?${t.toString()}`).then(a).then(s=>(s.metadata.map(u),s.metadata))},l=async e=>{await fetch(`${n}/1.0/auth/groups`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(a)},y=async e=>{await fetch(`${n}/1.0/auth/groups/${encodeURIComponent(e)}`,{method:"DELETE"}).then(a)},S=async e=>Promise.allSettled(e.map(async t=>y(t))).then(o),f=async e=>{await fetch(`${n}/1.0/auth/groups/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(a)},g=async(e,t)=>{await fetch(`${n}/1.0/auth/groups/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})}).then(a)},T=()=>{const{isFineGrained:e}=c();return p({queryKey:[h.authGroups],queryFn:async()=>i(e),enabled:e!==null})};export{f as a,l as c,S as d,g as r,T as u};
