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-ljTaFLaB.js";import{P as q}from"./Panel-mILL570q.js";import{S as H}from"./StatisticsContent-BU3Y49A4.js";import{u as J}from"./useUserPermissions-Di54216O.js";import{u as O}from"./useFeatureGroupView-BLXBUhtb.js";import{u as U}from"./useFeatureGroupVersions-BloDi2jp.js";import"./Deprecated-D_iwBiXP.js";import"./index-Dchy0RpL.js";import"./StatisticsTables-BKh0n-_K.js";import"./randomArrayString---X8tfjV.js";import"./generateCategoricalChart-dPjI1_Ki.js";import"./bump-BmRQ39WQ.js";import"./linear-Fo8SwKqx.js";import"./string-CFFdVFMV.js";import"./max-DBeXZoyG.js";import"./TdFeatureGroupHandle-DxWALHuI.js";import"./FeatureGroupTypeBadge-BQglSjeF.js";import"./useFeatureFilters-B1CH9vRL.js";import"./FeaturesLayout-B4roF-PA.js";import"./FilterResult-PK0SAale.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-CVSS3b-b.js";import"./min-7VfMNbY3.js";import"./project-FezsFbBI.js";const dt=()=>{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{dt as default};
