import{w as p,an as c,ap as l,k as d,aH as x,x as f,av as j,cc as y,aA as C,a2 as g,aD as h,j as e,T as a}from"./main-TIUJvpaR.js";import{B as v,a as i}from"./breadcrumb-B7oVkzG6.js";import{C as R}from"./crupdate-resource-layout-CYzZacgj.js";import{Component as S}from"./crupdate-role-settings-panel-DOJHijvT.js";import"./useEffectEvent-Bgk8rSJ3.js";import"./ChevronRight-BaJkMP9s.js";import"./MoreHoriz-Cm8ZCxuL.js";import"./datatable-page-with-header-layout-Bbr3vl7W.js";import"./dashboard-layout-context-DA6Q35rI.js";import"./use-toggle-dashboard-left-sidebar-BuzWlDo2.js";import"./permission-selector-CHlyRAPq.js";import"./accordion-CabB8onw.js";import"./switch-Bj7wwiPq.js";import"./list-DlNGU0yW.js";import"./uc-first-pSl3nM3z.js";import"./section-helper-C7SXMwEZ.js";import"./select-T49HzTXy.js";function T(t){const{trans:o}=p();return c({mutationFn:s=>d.post("roles",s).then(r=>r.data),onSuccess:()=>{x(o(f("Created new role"))),j.invalidateQueries({queryKey:y.roles.invalidateKey})},onError:s=>l(s,t)})}function I(){const[t]=C(),o=t.get("type")??"users",s=g({defaultValues:{type:o}}),r=T(s),n=h();return e.jsx(R,{form:s,onSubmit:m=>{r.mutate(m,{onSuccess:u=>{n(`/admin/roles/${u.role.id}/edit`)}})},title:e.jsxs(v,{size:"xl",children:[e.jsx(i,{to:"/admin/roles",children:e.jsx(a,{message:"Roles"})}),e.jsx(i,{children:e.jsx(a,{message:"New"})})]}),isLoading:r.isPending,children:e.jsx(S,{})})}export{I as Component};
