import{d as l,b as f,H as c,J as n}from"./jwt-decode.esm-rEBc1yJt.js";import"./router-BaFu-do7.js";import{M as p}from"./member-qsE1qwIO.js";import"./tables-DdYqLMX_.js";import{u as m}from"./projectsStore-CB4dfD6J.js";import{a as u}from"./ant-design-oMJ_KisO.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[i]="7f652ca2-0bbf-4f10-9d35-3e66842186c5",o._sentryDebugIdIdentifier="sentry-dbid-7f652ca2-0bbf-4f10-9d35-3e66842186c5")}catch{}})();const I=l("members",()=>{const o={member:new p};return{memberOptions:f(()=>{const t=m();return t.fetchedState?.members.map(e=>({label:e.email,value:e.id,disabled:e.id===t.fetchedState?.currentMember?.id})).sort((e,r)=>e.label.localeCompare(r.label))}),inviteMember:async(t,e)=>{try{await o.member.create({organizationId:t,email:e}),await m().fetchState(t)}catch(r){throw c.error(n.translate("i18n_projectsview_invite_member_error")),console.error("Failed to invite member",r),r}},removeMember:async(t,e)=>{const r=m(),a=r.fetchedState?.members.find(s=>s.id===e);if(!a){console.error("Member not found for removal");return}if(await u(n.translate("i18n_projectsview_remove_member_confirm",null,a.email))){r.removeMemberFromState(e);try{await o.member.delete({organizationId:t,authorId:a.authorId})}catch(s){c.error(n.translate("i18n_projectsview_remove_member_error")),console.error("Failed to remove member",s),await r.fetchState(t)}}},updateMemberRole:async(t,e,r)=>{const a=m(),d=e.role;a.updateMemberRoleInState(e.authorId,r);try{await o.member.updateRole(t,e.authorId,r)}catch(s){throw a.updateMemberRoleInState(e.authorId,d),c.error(n.translate("i18n_projectsview_update_member_error")),console.error("Failed to update member role",s),s}}}});export{I as u};
//# sourceMappingURL=membersStore-BNni8w8A.js.map
