import{u as V,ga as E,bh as f,q as u,bf as w,b4 as N,r as d,o as l,bb as $,bc as k,j as m,L as S,dq as R}from"./index-CK33qGU_.js";import{N as y}from"./NoData-CuLyR2Bg.js";import{P as q}from"./Panel-q_vviXAK.js";import{S as H}from"./StatisticsContent-Cni6_-vi.js";import{u as O}from"./useUserPermissions-CGy0I-II.js";import{u as U}from"./useFeatureGroupView-CYNDCcvd.js";import{u as Y}from"./useFeatureGroupVersions-BNoRnFKV.js";import"./Deprecated-D5xZ0QMJ.js";import"./CardActionButton-DcsFpjJz.js";import"./useDownload-hrjXceJg.js";import"./useProject-BzBQtp4J.js";import"./length-fOfC3W0h.js";import"./index-C9fMz2Eh.js";import"./StatisticsTables-CBsa7eUJ.js";import"./randomArrayString---X8tfjV.js";import"./generateCategoricalChart-q6giuYur.js";import"./bump-BOZP-SHu.js";import"./linear-DWGfDWoG.js";import"./string-CFFdVFMV.js";import"./max-DBeXZoyG.js";import"./TdFeatureGroupHandle-VL8F3InA.js";import"./FeatureGroupTypeBadge-CamLRb8D.js";import"./useFeatureFilters-b9dUmI_5.js";import"./FileUploaderButton-Bppadu35.js";import"./dumbPluralize-CcxDsNiu.js";import"./mergeDeepWith-BpZXvEs5.js";import"./FeaturesLayout-DRbyMXg_.js";import"./FilterResult-DPWa8YHE.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-DtwvB_P-.js";import"./storage-connector-BuEuJyVA.js";import"./min-Esn8rYAn.js";import"./project-C-jJLTjn.js";const bt=()=>{const{id:e,fsId:s,fgId:i,computationTime:a}=V(),[p]=E(),{canEdit:I,isLoading:j,isDataScientist:h}=O(),g=f(r=>{var c;return(c=r.featureGroupStatistics)==null?void 0:c.entities.statistics}),C=f(r=>r.featureGroupStatisticsCommits),G=f(r=>r.loading.effects.featureGroupStatistics.fetch),{data:t,isLoading:b}=U(+e,+i,+s),{currentData:x=[t],isFetching:v,handleVersionChange:D}=Y(t==null?void 0:t.name,u.featureGroup.statistics),o=w(),n=N(),P=d.useCallback(()=>{o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+i}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+i,computationTime:a})},[o.featureGroupStatisticsCommits,o.featureGroupStatistics,e,s,i,a]),F=d.useCallback((r,c=i)=>{if(r&&a!==r){const T=u.featureGroup.statisticsViewCommit,L={id:e,fsId:s,fgId:c,computationTime:r};n(l(T,u.project.value,L)+(p?`?${p}`:""));return}n(l(u.featureGroup.statistics,u.project.value,{id:e,fsId:s,fgId:c})+(p?`?${p}`:""))},[e,s,n,i,a,p]);return d.useEffect(()=>(o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+i}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+i,computationTime:a}),()=>{o.featureGroupDataPreview.clear()}),[e,i,o,s,a]),$(`${k.statistics} ${t!=null&&t.name?` - ${t.name}`:""}`),b?m.jsx(S,{}):m.jsxs(m.Fragment,{children:[m.jsx(q,{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||j,onClickEdit:()=>n(l(u.featureGroup.edit,u.project.value,{id:e,fsId:s,fgId:i})),onClickRefresh:P,version:t==null?void 0:t.version,versions:x,isVersionsLoading:v,onVersionChange:D,hasCommits:!0,commits:C||[],commit:a,handleCommitChange:F,pathnamePostFix:"/statistics",editRightText:h?"Your role is not allowed to perform this action":void 0}),G&&m.jsx(S,{}),!G&&(!(t!=null&&t.features.length)||!g?m.jsx(y,{mainText:"No data available"}):m.jsx(H,{data:t,statistics:g}))]})};export{bt as default};
