import{u as E,d0 as L,bJ as f,q as u,bI as w,bo as $,r as d,o as l,bx as k,by as y,j as c,D as S,ef as N,bT as R}from"./index-Cc-6WbPt.js";import{P as q}from"./Panel-BCZwmXoJ.js";import{S as H}from"./StatisticsContent-BtaCsjfF.js";import{u as J}from"./useUserPermissions-BZCaq9wv.js";import{u as O}from"./useFeatureGroupView-c5Pf49JZ.js";import{u as U}from"./useFeatureGroupVersions-BcL23mBJ.js";import"./Deprecated-BleiYoSW.js";import"./index-BPF_whuQ.js";import"./StatisticsTables-rKXkEYeG.js";import"./randomArrayString---X8tfjV.js";import"./generateCategoricalChart-8n_1qaxs.js";import"./bump-BmRQ39WQ.js";import"./linear-Fo8SwKqx.js";import"./string-CFFdVFMV.js";import"./max-DBeXZoyG.js";import"./BarChart-BKh16QjM.js";import"./TdFeatureGroupHandle-CboaakWl.js";import"./FeatureGroupTypeBadge-gEAI1mzE.js";import"./useFeatureFilters-CUzwpXiy.js";import"./FeaturesLayout-RJ74U3un.js";import"./FilterResult-XzfQEEq5.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-B9d45TTA.js";import"./min-CZ7D4Cve.js";import"./project-BdhY6ntx.js";const lt=()=>{const{id:e,fsId:s,fgId:r,computationTime:a}=E(),[n]=L(),{canEdit:j,isLoading:I,isDataScientist:h}=J(),g=f(i=>{var p;return(p=i.featureGroupStatistics)==null?void 0:p.entities.statistics}),C=f(i=>i.featureGroupStatisticsCommits),G=f(i=>i.loading.effects.featureGroupStatistics.fetch),{data:t,isLoading:x}=O(+e,+r,+s),{currentData:b=[t],isFetching:v,handleVersionChange:D}=U(t==null?void 0:t.name,u.project.featureGroup.statistics),o=w(),m=$(),P=d.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]),T=d.useCallback((i,p=r)=>{if(i&&a!==i){const F=u.project.featureGroup.statisticsViewCommit,V={id:e,fsId:s,fgId:p,computationTime:i};m(l(F,u.project.value,V)+(n?`?${n}`:""));return}m(l(u.project.featureGroup.statistics,u.project.value,{id:e,fsId:s,fgId:p})+(n?`?${n}`:""))},[e,s,m,r,a,n]);return d.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(`${y.statistics} ${t!=null&&t.name?` - ${t.name}`:""}`),x?c.jsx(S,{}):c.jsxs(c.Fragment,{children:[c.jsx(q,{type:N.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(l(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:T,pathnamePostFix:"/statistics",editRightText:h?"Your role is not allowed to perform this action":void 0}),G&&c.jsx(S,{}),!G&&(!(t!=null&&t.features.length)||!g?c.jsx(R,{mainText:"No data available"}):c.jsx(H,{data:t,statistics:g}))]})};export{lt as default};
