import{u as P,dZ as R,aq as l,r as m,bX as s,j as i,am as p,b6 as x}from"./index-CK33qGU_.js";const D=()=>{var c,d,f;const{id:o}=P(),t=R(+o,{skip:!o}),{data:{email:r}={}}=l(),j=m.useMemo(()=>{var a;const e=(a=t.currentData)==null?void 0:a.projectTeam.find(u=>u.projectTeamPK.teamMember===r);return e!=null&&e.teamRole?e==null?void 0:e.teamRole:s.ALL},[r,(c=t.currentData)==null?void 0:c.projectTeam]),T=m.useMemo(()=>{var a;const e=(a=t.currentData)==null?void 0:a.projectTeam.find(u=>u.projectTeamPK.teamMember===r);return(e==null?void 0:e.teamRole)===s.DATA_OWNER},[r,(d=t.currentData)==null?void 0:d.projectTeam]),n=m.useMemo(()=>{var a;const e=(a=t.currentData)==null?void 0:a.projectTeam.find(u=>u.projectTeamPK.teamMember===r);return(e==null?void 0:e.teamRole)===s.OBSERVER},[r,(f=t.currentData)==null?void 0:f.projectTeam]);return{userProjectRole:j,isDataOwner:T,isObserver:n}},E=({children:o,sx:t,allowedRoles:r=[s.DATA_OWNER,s.DATA_SCIENTIST],tooltip:j,tooltipProps:T,...n})=>{const{userProjectRole:c}=D();return m.useMemo(()=>r.indexOf(s.ALL)>-1?!1:r.indexOf(c)<0,[r,c])?i.jsx(p,{containerProps:{width:"fit-content"},mainText:"Your role is not allowed to perform this action.",children:i.jsx(x,{...n,sx:{...t},disabled:!0,children:o})}):j?i.jsx(p,{...T,mainText:j,children:i.jsx(x,{...n,sx:{...t},children:o})}):i.jsx(x,{...n,sx:{...t},children:o})};export{E as B,D as u};
