import{u as L,bX as d,x as u,bx as V,bW as P,r as m,t as G,aU as y,gX as N,eC as R,bG as k,bH as w,j as i,cE as H,L as C,h as U,c5 as X,ed as $}from"./index-Cox3ZWL0.js";import{P as M}from"./Panel-Cu-mlmB5.js";import{C as O}from"./Correlation-CNZXlSEM.js";import{u as W}from"./useUserPermissions-fOM7-Eik.js";import{u as Y}from"./useFeatureGroupView-_YwfhLQw.js";import{u as q}from"./useFeatureGroupVersions-BUQPzLWH.js";import"./Deprecated-g8R65bmH.js";import"./Project-CBPFwDml.js";import"./alertManagerConfig.selectors-D5v0uPxO.js";import"./defineProperty-Bl0iR0r2.js";import"./HumanizedCronExpression-CCEBWMyY.js";import"./index-CvEisYn5.js";import"./form-_K_-Blw_.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./symmetricDifference-DM6mun8f.js";import"./index-uwkRD1BL.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-C9cjFU4I.js";import"./transform-C2GfmqNu.js";import"./string-cKWu9XK9.js";import"./linear-C3cNlZpH.js";import"./project-BhVxAOrV.js";const lt=()=>{const{id:e,fsId:r,fgId:o,computationTime:a}=L(),l=d(s=>{var c;return(c=s.featureGroupStatistics)==null?void 0:c.entities.statistics}),g=d(s=>s.loading.effects.featureGroupStatistics.fetch),x=d(s=>s.featureGroupStatisticsCommits),{isLoading:h,data:t}=Y(+e,+o,+r),{currentData:I=[t],isFetching:b,handleVersionChange:v}=q(t==null?void 0:t.name,u.project.featureGroup.correlation),p=V(),n=P(),{canEdit:F,isLoading:D,isDataScientist:S,isFeatureStoreRestricted:j}=W();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 E=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]),T=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(()=>y(N(R,["extendedStatistics","correlations"]),l??{}),[l]);return k(`${w.correlation} ${t!=null&&t.name?t.name:"Feature group"}`),!h&&!t?i.jsx(H,{}):h?i.jsx(C,{}):i.jsxs(i.Fragment,{children:[i.jsx(M,{title:t.name,data:t,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!F||S||j||D,onClickEdit:()=>p(G(u.project.featureGroup.edit,u.project.value,{id:e,fsId:r,fgId:o})),onClickRefresh:E,version:t==null?void 0:t.version,versions:I||[],isVersionsLoading:b,onVersionChange:v,hasCommits:!0,commits:x||[],commit:a,handleCommitChange:T,pathnamePostFix:"/correlation",editRightText:S||j?"Your role is not allowed to perform this action":void 0}),g&&i.jsx(C,{}),!g&&(!f||U(f)?i.jsx(X,{mainText:"No feature correlation",secondaryText:""}):i.jsx(O,{item:t,correlation:f,type:$.fg}))]})};export{lt as default};
