import{u as P,c9 as M,aR as k,cj as y,r as s,gn as I,go as L}from"./index-d6499a22.js";import{u as j,p as N}from"./index-da50fbe6.js";const v=()=>{const{id:u,fsId:m}=P(),h=M(),l=k(),{data:r,isLoading:p}=j(u),{data:i,isFetching:g}=y(+u),d=s.useCallback(a=>{if(!a)return"";const t=I("/p/:id/fs/:fsId/*",h.pathname);return t?L(t.pattern.path,{...t.params,fsId:String(a)}):""},[h.pathname]),n=s.useMemo(()=>r==null?void 0:r.filter(a=>a.accepted),[r]),e=s.useMemo(()=>i==null?void 0:i.map(a=>{var o;const t=(o=n==null?void 0:n.find(c=>c.projectName===a.projectName))==null?void 0:o.permission;return{label:`${a.projectName} (${t?N[t]:"current"})`,key:a.featurestoreId}}),[i,n]),S=s.useMemo(()=>{const a=e==null?void 0:e.find(t=>t.key===+m);return[(a==null?void 0:a.label)||""]},[e,m]),f=s.useMemo(()=>(e==null?void 0:e.map(a=>a.label))??[],[e]),b=s.useCallback(([a])=>{var c;const t=(c=e==null?void 0:e.find(F=>F.label===a))==null?void 0:c.key,o=d(t);l(o)},[d,l,e]);return{selectFSValue:S,selectFSOptions:f,handleFSSelectionChange:b,isLoading:g,hasSharedFS:!!n&&n.length>0,isSharedLoading:p}};export{v as u};
