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