import{u as F,eK as L,aq as P,r as T,ew as m,bX as u}from"./index-CK33qGU_.js";import{f as A}from"./FileUploaderButton-Bppadu35.js";import{u as N}from"./useDownload-hrjXceJg.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 c;let i=!0,d=!1;const a=(c=s==null?void 0:s.projectTeam)==null?void 0:c.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);d=!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:d,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};
