import{a as e,i as t,s as n,t as r}from"./api-Duu96wkE.js";import{G as i}from"./index-DyQEyT-0.js";var a=()=>t(r.get(`/roles`)),o=e=>t(r.get(`/roles/${e}`)),s=()=>t(r.get(`/permissions`)),c=e=>t(r.post(`/roles`,e)),l=(e,n)=>t(r.patch(`/roles/${e}`,n)),u=(e,n)=>t(r.post(`/roles/${e}/clone`,{label:n})),d=e=>r.delete(`/roles/${e}`),f={all:[`roles`],detail:e=>[`roles`,e],permissions:[`permissions`]};function p(){return e({queryKey:f.all,queryFn:a})}function m(t){return e({queryKey:f.detail(t??``),queryFn:()=>o(t),enabled:!!t})}function h(){return e({queryKey:f.permissions,queryFn:s,staleTime:36e5})}function g(e){let t=n();return i({mutationFn:t=>e?l(e,t):c(t),onSuccess:e=>{t.invalidateQueries({queryKey:f.all}),t.invalidateQueries({queryKey:f.detail(e.name)})}})}function _(){let e=n();return i({mutationFn:({name:e,label:t})=>u(e,t),onSuccess:()=>e.invalidateQueries({queryKey:f.all})})}function v(){let e=n();return i({mutationFn:e=>d(e),onSuccess:()=>e.invalidateQueries({queryKey:f.all})})}export{p as a,m as i,v as n,g as o,h as r,_ as t};