import{R as n,bE as a,eo as o,d7 as r,ep as u,a as c,aP as p,q as h}from"./index-C88DWJny.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)},G=()=>{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,G as u};
