import{_ as z,hF as H,l1 as K,u as O,ba as U,bp as X,kP as B,ej as J,z as W,D as F,it as Y,p as ee,ay as se,iw as w,bZ as C,b_ as te,Q as P,r as g,x as u,g$ as ae,t as ie,d1 as re,gK as ne,i as oe,fh as ce,er as A,aU as le,gX as de,eC as pe,iu as ue,c2 as he,j as s,L as fe,q as T,ao as S,v as k,be as E,h as me,bl as _}from"./index-C6OVXshM.js";import{P as ge}from"./Panel-Cdyv0nKn.js";var xe=z(function(t,e){return H(K(t),e)});const Q=ue(he.DATE_TIME.DATE),Ve=()=>{var D,b;const{id:n,fsId:t,fvName:e,fvVersion:a,tdVersion:r}=O(),o=U(),{pathname:h}=X(),{currentData:c={items:[]}}=B({pId:+n,fsId:+t,id:e}),{currentData:x,isFetching:f,refetch:m}=J({pId:+n,fsId:+t,id:e,version:+a,params:{expand:["features"]}}),{currentData:d={items:[]},refetch:p}=W({pId:+n,fsId:+t,id:e,version:+a}),$=d.items.find(F("version",+r)),{currentData:i,isFetching:G}=Y({pId:+n,fsId:+t,fvName:e,fvVersion:+a,id:+r,params:{fields:"content"}},{skip:xe(F("version",+r),d.items)}),L=ee(C(te(P("version"))),se(({version:l,eventStartTime:v,eventEndTime:V})=>({value:`${l}`,label:`${l} (${Q(w(v))} -> ${Q(w(V))})`})))(d.items),q=g.useCallback(l=>{o(u.project.featureView.td.statistics,{fsId:t,fvName:e,fvVersion:l,tdVersion:+r})},[t,e,o,r]),M=g.useCallback(l=>{const v=[u.project.featureView.td.statistics,u.project.featureView.td.correlation].find(V=>ae(ie(V,u.project.value),h))??u.project.featureView.td.statistics;o(v,{fsId:t,fvName:e,fvVersion:+a,tdVersion:+l})},[t,e,a,o,h]),[I,R]=re("split"),y=i!=null&&i.entities?[]:C(ne(oe),ce(i)),j=i!=null&&i.entities?i.entities.statistics:(b=(D=P(I??A(y),i))==null?void 0:D.entities)==null?void 0:b.statistics,N=g.useMemo(()=>le(de(pe,["extendedStatistics","correlations"]),j??{}),[j]),Z=g.useCallback(()=>{m(),p()},[p,m]);return{allFvs:c,correlations:N,fv:x,fvName:e,fvVersion:a,handleTdVersionChange:M,handleVersionChange:q,isFetching:f||G,refetchAllData:Z,statistics:j,splitNames:y,setSplit:R,split:I,tdVersion:r,tdVersionOptions:L,trainingDataset:$}},Ie=({isFetching:n,fvName:t,fvVersion:e,allFvs:a,handleVersionChange:r,handleTdVersionChange:o,refetchAllData:h,splitNames:c,setSplit:x,split:f,tdVersion:m,tdVersionOptions:d})=>s.jsxs(s.Fragment,{children:[n&&s.jsx(fe,{}),s.jsx(ge,{title:t,versions:(a==null?void 0:a.items)??[{version:+e}],version:+e,onVersionChange:r,idColor:"labels.purple",onClickRefresh:h,children:s.jsxs(T,{alignItems:"center",ml:"2px",children:[s.jsx(S,{icon:k.arrow_right,color:"grayShade1"}),s.jsx(E,{width:"216px",value:m,options:d,placeholder:"version",onChange:o}),!me(c)&&s.jsxs(s.Fragment,{children:[s.jsx(S,{icon:k.arrow_right,color:"grayShade1"}),c.length>1?s.jsx(E,{width:"140px",value:f||A(c),options:c.map(p=>({value:p,label:p})).reverse(),placeholder:"split",onChange:x}):s.jsxs(T,{alignItems:"flex-end",children:[s.jsx(_,{ml:"5px",color:"gray",children:"split"}),s.jsx(_,{mx:"5px",children:f})]})]})]})})]});export{Ie as T,Ve as u};
