import{u as F,fb as L,av as P,r as T,eW as m,cn as u}from"./index-dP1W1_bd.js";import{k as A}from"./FileUploaderButton-frSujVRY.js";import{u as N}from"./useDownload-C3yCvYJa.js";const O=()=>{const{fsId:f}=F(),{id:S,project:s,isLoading:l}=N(),{currentData:o,isFetching:p}=L({fsId:+f}),{data:r,isLoading:g}=A(S),{data:e,isLoading:D}=P(),n=T.useMemo(()=>{var d;let i=!0,c=!1;const a=(d=s==null?void 0:s.projectTeam)==null?void 0:d.find(({user:t})=>t.username===(e==null?void 0:e.username));if(!r||!o)i=!1;else{const t=r.find(E=>E.projectName===o.projectName);c=!t,t?(t.permission===m.READ_ONLY||t.permission===m.EDITABLE_BY_OWNERS&&(a==null?void 0:a.teamRole)===u.DATA_SCIENTIST)&&(i=!1):i=!0}return{can:i,isOwnFs:c,isDataScientist:(a==null?void 0:a.teamRole)===u.DATA_SCIENTIST}},[e==null?void 0:e.username,o,s==null?void 0:s.projectTeam,r]);return{canEdit:n.can,isOwnFs:n.isOwnFs,isDataScientist:n.isDataScientist,isLoading:l||g||p||D}};export{O as u};
