import{u as w,c$ as E,bI as f,q as u,bH as L,bo as $,r as l,o as d,bw as k,bx as N,j as c,D as G,ee as R,bS as y}from"./index-46ma1THH.js";import{P as H}from"./Panel-CnxQ3Lqy.js";import{S as q}from"./StatisticsContent-CpSklm6W.js";import{u as O}from"./useUserPermissions-DiAMkzC6.js";import{u as U}from"./useFeatureGroupView-BGqRdiCP.js";import{u as Y}from"./useFeatureGroupVersions-BlKa4CNF.js";import"./Deprecated-CcWZugSq.js";import"./index-Dp4ot73A.js";import"./StatisticsTables-C8cLXJBs.js";import"./randomArrayString---X8tfjV.js";import"./generateCategoricalChart-ysjj5Swo.js";import"./bump-BmRQ39WQ.js";import"./linear-Fo8SwKqx.js";import"./string-CFFdVFMV.js";import"./max-DBeXZoyG.js";import"./TdFeatureGroupHandle-DNdFQDy0.js";import"./FeatureGroupTypeBadge-DK0B-B3q.js";import"./useFeatureFilters-DTSd2vm9.js";import"./FeaturesLayout-C2iMigz-.js";import"./FilterResult-CWV4237e.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-BE0wmtut.js";import"./min-C0KmOMTA.js";import"./project-DhxCVD8Q.js";const lt=()=>{const{id:e,fsId:s,fgId:r,computationTime:a}=w(),[n]=E(),{canEdit:j,isLoading:I,isDataScientist:h}=O(),g=f(i=>{var p;return(p=i.featureGroupStatistics)==null?void 0:p.entities.statistics}),C=f(i=>i.featureGroupStatisticsCommits),S=f(i=>i.loading.effects.featureGroupStatistics.fetch),{data:t,isLoading:x}=U(+e,+r,+s),{currentData:b=[t],isFetching:v,handleVersionChange:D}=Y(t==null?void 0:t.name,u.project.featureGroup.statistics),o=L(),m=$(),P=l.useCallback(()=>{o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r,computationTime:a})},[o.featureGroupStatisticsCommits,o.featureGroupStatistics,e,s,r,a]),F=l.useCallback((i,p=r)=>{if(i&&a!==i){const T=u.project.featureGroup.statisticsViewCommit,V={id:e,fsId:s,fgId:p,computationTime:i};m(d(T,u.project.value,V)+(n?`?${n}`:""));return}m(d(u.project.featureGroup.statistics,u.project.value,{id:e,fsId:s,fgId:p})+(n?`?${n}`:""))},[e,s,m,r,a,n]);return l.useEffect(()=>(o.featureGroupStatisticsCommits.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r}),o.featureGroupStatistics.fetch({projectId:+e,featureStoreId:+s,featureGroupId:+r,computationTime:a}),()=>{o.featureGroupDataPreview.clear()}),[e,r,o,s,a]),k(`${N.statistics} ${t!=null&&t.name?` - ${t.name}`:""}`),x?c.jsx(G,{}):c.jsxs(c.Fragment,{children:[c.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:!j||h||I,onClickEdit:()=>m(d(u.project.featureGroup.edit,u.project.value,{id:e,fsId:s,fgId:r})),onClickRefresh:P,version:t==null?void 0:t.version,versions:b,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}),S&&c.jsx(G,{}),!S&&(!(t!=null&&t.features.length)||!g?c.jsx(y,{mainText:"No data available"}):c.jsx(q,{data:t,statistics:g}))]})};export{lt as default};
