"use strict";(self.webpackChunk_mlflow_mlflow=self.webpackChunk_mlflow_mlflow||[]).push([[5910],{25910:function(e,t,o){o.d(t,{ToolUsageChart:function(){return M}});var a=o(68248),i=o(46709),n=o(27757),s=o(82716),r=o(40724),l=o(66774),d=o(39833),m=o(60719),c=o(49960),u=o(858),h=o(13240),p=o(6581),g=o(54313),v=o(23327),f=o(83110),T=o(69983);var y=o(3409),C=o(73408);const M=()=>{const{theme:e}=(0,n.u)(),t=(0,y.zZ)(),o=(0,y.IT)(),M=(0,y.gy)(),{getOpacity:A,handleLegendMouseEnter:N,handleLegendMouseLeave:Y}=(0,f.pH)(),{getChartColor:w}=(0,f.yC)(),{chartData:x,toolNames:D,isLoading:_,error:E,hasData:L}=function(){const{experimentId:e,startTimeMs:t,endTimeMs:o,timeIntervalSeconds:a,timeBuckets:n}=(0,T.W)(),s=(0,i.useMemo)(()=>[(0,g.jm)(g.Mm.TYPE,g.du.TOOL)],[]),{data:r,isLoading:l,error:d}=(0,v.o4)({experimentId:e,startTimeMs:t,endTimeMs:o,viewType:g.mW.SPANS,metricName:g.Ub.SPAN_COUNT,aggregations:[{aggregation_type:g.DF.COUNT}],filters:s,dimensions:[g.it.SPAN_NAME],timeIntervalSeconds:a}),{chartData:m,toolNames:c}=(0,i.useMemo)(()=>{var e;const t=null!==(e=null===r||void 0===r?void 0:r.data_points)&&void 0!==e?e:[],o=new Set,i=new Map;for(const a of t){var s,l,d;const e=null===(s=a.dimensions)||void 0===s?void 0:s[g.it.SPAN_NAME],t=null===(l=a.dimensions)||void 0===l?void 0:l[g.Ad],n=(null===(d=a.values)||void 0===d?void 0:d[g.DF.COUNT])||0;if(!e||!t)continue;o.add(e);const r=new Date(t).getTime();let m=i.get(r);m||(m=new Map,i.set(r,m)),m.set(e,n)}const m=Array.from(o).sort();return{chartData:n.map(e=>{const t=i.get(e),o={timestamp:(0,f.fq)(e,a)};for(const a of m)o[a]=(null===t||void 0===t?void 0:t.get(a))||0;return o}),toolNames:m}},[null===r||void 0===r?void 0:r.data_points,n,a]);return{chartData:m,toolNames:c,isLoading:l,error:d,hasData:c.length>0}}(),k=(0,i.useCallback)((e,t)=>[(0,f.B4)(e),t],[]);return _?(0,C.Y)(y.lh,{}):E?(0,C.Y)(y.nN,{}):(0,C.FD)(y.h,{componentId:"mlflow.charts.tool_usage",children:[(0,C.Y)(y.XQ,{icon:(0,C.Y)(s.ChartLineIcon,{}),title:(0,C.Y)(r.A,{id:"/C16tY",defaultMessage:"Tool Usage Over Time"})}),(0,C.Y)("div",{css:(0,a.AH)({height:y.tz,marginTop:e.spacing.sm},""),children:L?(0,C.Y)(l.u,{width:"100%",height:"100%",children:(0,C.FD)(d.E,{data:x,margin:{top:10,right:10,left:10,bottom:0},children:[(0,C.Y)(m.W,{dataKey:"timestamp",...t}),(0,C.Y)(c.h,{...o}),(0,C.Y)(u.m,{content:(0,C.Y)(y.Vn,{formatter:k}),cursor:{fill:e.colors.actionTertiaryBackgroundHover}}),D.map((e,t)=>(0,C.Y)(h.y,{dataKey:e,stackId:"tools",fill:w(t),fillOpacity:A(e)},e)),(0,C.Y)(p.s,{verticalAlign:"bottom",iconType:"square",onMouseEnter:N,onMouseLeave:Y,...M})]})}):(0,C.Y)(y.iE,{})})]})}},39833:function(e,t,o){o.d(t,{E:function(){return l}});var a=o(90970),i=o(13240),n=o(60719),s=o(49960),r=o(44941),l=(0,a.gu)({chartName:"BarChart",GraphicalChild:i.y,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:n.W},{axisType:"yAxis",AxisComp:s.h}],formatAxisMap:r.pr})}}]);