import{b as A,d as I,e as b,f as u,i as d,r as p,g as m,h as f,k as x,p as T,l as v,j as s,F as N,S as P,G as E,m as S,n as L,q as w,B as z,t as C}from"./index-n-59FgrC.js";import F from"./index-D1BbVr6g.js";import"./IconChevronLeft-CyT72r93.js";const h=t=>x.dispatch(C.actions.setWithoutSidebar(t)),W=()=>{const{t}=A(),n=I(),[y]=b(),r=y.get("uid")||"",{data:a,isError:g}=u.useLinkInfoQuery({uid:r}),[o]=u.useApplyLinkMutation(),e=a==null?void 0:a.Entity,c=a==null?void 0:a.Link.AccessType,l=e==null?void 0:e.AccessType,i=d(c)&&d(l)&&c<=l,j=p.useCallback(()=>{if(i){n(m(f.folder,{folderId:(e==null?void 0:e.Id)||0}));return}o({uid:r}).unwrap().then(k=>{x.dispatch(T.util.invalidateTags(["Project"])),n(m(f.folder,{folderId:k.Id}))}).catch(()=>v({message:t("members.links.invalid")}))},[i,r,e==null?void 0:e.Id,o,n,t]);return p.useEffect(()=>(h(!0),()=>{h(!1)}),[]),g?s.jsx(F,{}):e?s.jsx(N,{justify:"center",flex:1,children:s.jsxs(P,{gap:40,align:"center",children:[s.jsxs(E,{children:[s.jsx(S,{name:e.Name,color:e.Color,icon:e.IconId,size:48}),s.jsx(L,{fz:32,fw:500,children:e.Name})]}),s.jsx(w,{maw:260,ta:"center",children:t(`members.links.${i?"alreadyInvited":"invite"}`,{project:e.Name})}),s.jsx(z,{size:"lg",radius:8,onClick:j,children:t(i?"members.action.goToProject":"members.action.join")})]})}):null};export{W as default};
