import{bx as T,bW as k,ec as A,A as E,B as R,l as q,t as b,x as d,r as O,bX as y,j as t,c4 as o,L as U,d as $,q as m,ee as H,c as I}from"./index-DNBEEyYo.js";import{S as M,a as Q,b as W}from"./StatisticsTables-eKzOr7AN.js";const J=({isOpen:l,handleToggle:f,projectId:c,featurestoreId:r,parentProjectId:G,featuregroup:F,fgName:h,version:D,name:e,feature:L,fgId:B})=>{var S,j,g;const u=T(),v=k(),{data:C}=A({pId:G,fsId:r,fgName:h,version:D},{skip:!h,selectFromResult:E({data:R(q)})}),a=F??C,N=L??(a==null?void 0:a.features.find(n=>n.name===e)),i=B??(a==null?void 0:a.id)??0,p=b(d.project.featureGroup.overview,d.project.value,{id:c,fsId:r,fgId:i}),P=`${b(d.project.featureGroup.preview,d.project.value,{id:c,fsId:r,fgId:i})}?search=${e}`;O.useEffect(()=>{i&&v.featureGroupStatistics.fetch({projectId:c,featureStoreId:r,featureGroupId:i})},[N,v,i,c,r]);const x=y(n=>{var w;return(w=n.featureGroupStatistics)==null?void 0:w.entities.statistics});if(y(n=>n.loading.effects.featureGroupStatistics.fetch))return t.jsx(o,{headerLine:" ",closeOnBackdropClick:!1,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(p)],onClose:f,children:t.jsx(U,{})});if(e&&(!x||!x[e]))return t.jsx(o,{headerLine:e,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(p)],onClose:f,children:t.jsx($,{textAlign:"center",mt:"30px",children:"No Feature Statistics"})});const s=e?x[e]:void 0;return t.jsxs(o,{headerLine:e,isOpen:l,bottomButton:["Open in Feature Groups Page ->",()=>u(p)],onClose:f,children:[s?t.jsx(o.Section,{title:"Data overview",children:t.jsxs(m,{width:"100%",children:[((S=s.extendedStatistics)==null?void 0:S.histogram)&&s.featureType&&t.jsx(m,{width:"100%",justifyContent:"center",children:t.jsx(M,{dataType:H.fg,data:(j=s.extendedStatistics)==null?void 0:j.histogram,type:s.featureType})}),(!((g=s.extendedStatistics)!=null&&g.histogram)||!s.featureType)&&t.jsx(I,{bold:!0,gray:!0,textAlign:"center",children:"No data overview"})]})}):null,t.jsx(o.Section,{title:"Data preview",action:["view data preview table -->",()=>u(P)],children:i&&t.jsx(Q,{projectId:c,featureStoreId:r,fgId:i,isDrawer:!0,featureName:e,featureGroup:a})}),s?t.jsx(o.Section,{title:"Statistics",children:t.jsx(W,{isDrawer:!0,data:s})}):null]})};export{J as F};
