import{u as V,cH as w,aL as f,s as m,aD as E,bw as N,r as l,q as d,bC as $,bD as k,j as p,L as S,e0 as R}from"./index-dP1W1_bd.js";import{N as y}from"./NoData-DLZ_8GEo.js";import{P as H}from"./Panel-M9AVvYdm.js";import{S as q}from"./StatisticsContent-H-Lr3iFh.js";import{u as O}from"./useUserPermissions-Olw8jjZn.js";import{u as U}from"./useFeatureGroupView-BhSXc6yu.js";import{u as Y}from"./useFeatureGroupVersions-BkufbG6T.js";import"./Deprecated-ClfPkp7s.js";import"./CardActionButton-BtCnEqTK.js";import"./uniqBy-6mvKp2Ip.js";import"./index-BxoddjA3.js";import"./StatisticsTables-vXn70kNI.js";import"./randomArrayString---X8tfjV.js";import"./generateCategoricalChart-HHA2klXX.js";import"./bump-BOZP-SHu.js";import"./linear-DWGfDWoG.js";import"./string-CFFdVFMV.js";import"./max-DBeXZoyG.js";import"./TdFeatureGroupHandle-S_pdFVu5.js";import"./FeatureGroupTypeBadge-BWolRbn-.js";import"./useFeatureFilters-H7_GmsAw.js";import"./uniq-98MdbBvs.js";import"./Project-CsYwwOpN.js";import"./ButtonWithRole-CF64B_Or.js";import"./alertManagerConfig.selectors-B_R5cvew.js";import"./__-BIxbRvwe.js";import"./useDownload-C3yCvYJa.js";import"./useProject-CXVt1xnE.js";import"./length-BzpOfCdE.js";import"./complement-D_Q2yZKt.js";import"./index-MHdXqM53.js";import"./FileUploaderButton-frSujVRY.js";import"./dumbPluralize-CcxDsNiu.js";import"./utils-UGwNsahk.js";import"./useKeyPress-OcDHupLZ.js";import"./zipObj-DEkcXp9d.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./symmetricDifference-mJT60wVA.js";import"./git-C8OLuEaG.js";import"./useCopyToClipboard-DTBM3H3Z.js";import"./Anchor-B_lGyhCa.js";import"./FeaturesLayout-BWknsmf_.js";import"./FilterResult-VfTAUiIy.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-D-g3xjlf.js";import"./storage-connector-BuEuJyVA.js";import"./min-DNV8UA03.js";import"./project-B1Z_dM9_.js";const yt=()=>{const{id:e,fsId:i,fgId:r,computationTime:a}=V(),[u]=w(),{canEdit:I,isLoading:C,isDataScientist:h}=O(),g=f(s=>{var c;return(c=s.featureGroupStatistics)==null?void 0:c.entities.statistics}),j=f(s=>s.featureGroupStatisticsCommits),G=f(s=>s.loading.effects.featureGroupStatistics.fetch),{data:t,isLoading:x}=U(+e,+r,+i),{currentData:v=[t],isFetching:D,handleVersionChange:b}=Y(t==null?void 0:t.name,m.featureGroup.statistics),o=E(),n=N(),P=l.useCallback(()=>{o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+i,featureGroupId:+r}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+i,featureGroupId:+r,computationTime:a})},[o.featureGroupStatisticsCommits,o.featureGroupStatistics,e,i,r,a]),F=l.useCallback((s,c=r)=>{if(s&&a!==s){const L=m.featureGroup.statisticsViewCommit,T={id:e,fsId:i,fgId:c,computationTime:s};n(d(L,m.project.value,T)+(u?`?${u}`:""));return}n(d(m.featureGroup.statistics,m.project.value,{id:e,fsId:i,fgId:c})+(u?`?${u}`:""))},[e,i,n,r,a,u]);return l.useEffect(()=>(o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+i,featureGroupId:+r}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+i,featureGroupId:+r,computationTime:a}),()=>{o.featureGroupDataPreview.clear()}),[e,r,o,i,a]),$(`${k.statistics} ${t!=null&&t.name?` - ${t.name}`:""}`),x?p.jsx(S,{}):p.jsxs(p.Fragment,{children:[p.jsx(H,{type:R.fg,data:t,title:t==null?void 0:t.name,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!I||h||C,onClickEdit:()=>n(d(m.featureGroup.edit,m.project.value,{id:e,fsId:i,fgId:r})),onClickRefresh:P,version:t==null?void 0:t.version,versions:v,isVersionsLoading:D,onVersionChange:b,hasCommits:!0,commits:j||[],commit:a,handleCommitChange:F,pathnamePostFix:"/statistics",editRightText:h?"Your role is not allowed to perform this action":void 0}),G&&p.jsx(S,{}),!G&&(!(t!=null&&t.features.length)||!g?p.jsx(y,{mainText:"No data available"}):p.jsx(q,{data:t,statistics:g}))]})};export{yt as default};
