import{u as V,g_ as E,bK as f,s as u,bI as w,bp as N,r as d,q as l,bx as $,by as k,j as c,L as S,dX as y}from"./index-C1DmWO_C.js";import{N as R}from"./NoData-Y_e6mfNf.js";import{P as q}from"./Panel-Z-sMb6LN.js";import{S as H}from"./StatisticsContent-B6H8w5pb.js";import{u as K}from"./useUserPermissions-BiARnwL4.js";import{u as O}from"./useFeatureGroupView-BP_FibV0.js";import{u as U}from"./useFeatureGroupVersions-BgrH6YdJ.js";import"./Deprecated-BQWZLUTP.js";import"./index-BduZzu1m.js";import"./StatisticsTables-gOzf3GUA.js";import"./randomArrayString---X8tfjV.js";import"./generateCategoricalChart-BvxCftXa.js";import"./bump-BOZP-SHu.js";import"./linear-DWGfDWoG.js";import"./string-CFFdVFMV.js";import"./max-DBeXZoyG.js";import"./TdFeatureGroupHandle-BpWo7RRg.js";import"./FeatureGroupTypeBadge-DwrDNbIL.js";import"./useFeatureFilters-DdB4Pg89.js";import"./FeaturesLayout-2WejLh-p.js";import"./FilterResult-BLSGYVa5.js";import"./sort-BOLIcXtz.js";import"./FeatureFilters-DTS9HN8J.js";import"./storage-connector-BuEuJyVA.js";import"./min-BJfYLHXY.js";import"./project-VxxpMOY0.js";const gt=()=>{const{id:e,fsId:s,fgId:i,computationTime:a}=V(),[m]=E(),{canEdit:I,isLoading:j,isDataScientist:g}=K(),h=f(r=>{var n;return(n=r.featureGroupStatistics)==null?void 0:n.entities.statistics}),C=f(r=>r.featureGroupStatisticsCommits),G=f(r=>r.loading.effects.featureGroupStatistics.fetch),{data:t,isLoading:x}=O(+e,+i,+s),{currentData:b=[t],isFetching:v,handleVersionChange:D}=U(t==null?void 0:t.name,u.featureGroup.statistics),o=w(),p=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,n=i)=>{if(r&&a!==r){const T=u.featureGroup.statisticsViewCommit,L={id:e,fsId:s,fgId:n,computationTime:r};p(l(T,u.project.value,L)+(m?`?${m}`:""));return}p(l(u.featureGroup.statistics,u.project.value,{id:e,fsId:s,fgId:n})+(m?`?${m}`:""))},[e,s,p,i,a,m]);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}`:""}`),x?c.jsx(S,{}):c.jsxs(c.Fragment,{children:[c.jsx(q,{type:y.fg,data:t,title:t==null?void 0:t.name,idColor:(t==null?void 0:t.type)==="onDemandFeaturegroupDTO"?"labels.blue":"labels.orange",isEditDisabled:!I||g||j,onClickEdit:()=>p(l(u.featureGroup.edit,u.project.value,{id:e,fsId:s,fgId:i})),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:g?"Your role is not allowed to perform this action":void 0}),G&&c.jsx(S,{}),!G&&(!(t!=null&&t.features.length)||!h?c.jsx(R,{mainText:"No data available"}):c.jsx(H,{data:t,statistics:h}))]})};export{gt as default};
