import{u as E,bJ as l,t as u,bo as V,bI as y,r as m,s as G,aU as L,gn as P,eG as N,bx as k,by as w,j as i,cq as R,D as S,l as U,bT as $,eh as q}from"./index-_eM6l4Nf.js";import{P as H}from"./Panel-BNKhRIJO.js";import{C as J}from"./Correlation-GzfTFsHh.js";import{u as M}from"./useUserPermissions-Dd9YjnbM.js";import{u as O}from"./useFeatureGroupView-BE-wFUIp.js";import{u as Y}from"./useFeatureGroupVersions-D2tWga8L.js";import"./Deprecated-Cn0z8EIY.js";import"./Project-BTH4PZdL.js";import"./alertManagerConfig.selectors-B-zYrdGC.js";import"./complement-CE-nEpWn.js";import"./index-B-5JhFyZ.js";import"./form-CMT9TYED.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./symmetricDifference-BIbwssIf.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-BUvZjse8.js";import"./Anchor-JEsUSbQH.js";import"./transform-Cm7rL0Nj.js";import"./string-cKWu9XK9.js";import"./linear-XCPlS1sw.js";import"./project-CRArgp9U.js";const ft=()=>{const{id:e,fsId:r,fgId:o,computationTime:a}=E(),d=l(s=>{var c;return(c=s.featureGroupStatistics)==null?void 0:c.entities.statistics}),g=l(s=>s.loading.effects.featureGroupStatistics.fetch),C=l(s=>s.featureGroupStatisticsCommits),{isLoading:h,data:t}=O(+e,+o,+r),{currentData:I=[t],isFetching:x,handleVersionChange:b}=Y(t==null?void 0:t.name,u.project.featureGroup.correlation),p=V(),n=y(),{canEdit:v,isLoading:D,isDataScientist:j}=M();m.useEffect(()=>{n.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o}),n.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o,computationTime:a})},[e,o,n,r,a]);const T=m.useCallback(()=>{n.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o}),n.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+r,featureGroupId:+o,computationTime:a})},[n.featureGroupStatisticsCommits,n.featureGroupStatistics,e,r,o,a]),F=m.useCallback((s,c=o)=>{s&&a!==s&&p(G(u.project.featureGroup.correlationViewCommit,u.project.value,{id:e,fsId:r,fgId:c,computationTime:s}))},[e,r,p,o,a]),f=m.useMemo(()=>L(P(N,["extendedStatistics","correlations"]),d??{}),[d]);return k(`${w.correlation} ${t!=null&&t.name?t.name:"Feature group"}`),!h&&!t?i.jsx(R,{}):h?i.jsx(S,{}):i.jsxs(i.Fragment,{children:[i.jsx(H,{title:t.name,data:t,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!v||j||D,onClickEdit:()=>p(G(u.project.featureGroup.edit,u.project.value,{id:e,fsId:r,fgId:o})),onClickRefresh:T,version:t==null?void 0:t.version,versions:I||[],isVersionsLoading:x,onVersionChange:b,hasCommits:!0,commits:C||[],commit:a,handleCommitChange:F,pathnamePostFix:"/correlation",editRightText:j?"Your role is not allowed to perform this action":void 0}),g&&i.jsx(S,{}),!g&&(!f||U(f)?i.jsx($,{mainText:"No feature correlation",secondaryText:""}):i.jsx(J,{item:t,correlation:f,type:q.fg}))]})};export{ft as default};
