import i from"prop-types";import{useMemo as o}from"react";import n from"./Tooltip.css.js";import{getUnitDisplay as l}from"../../../../utils/convert.js";import{jsxs as r,jsx as e}from"react/jsx-runtime";var t={Dash:"dashed",Solid:"solid",Dot:"dotted"},s=function(i){var s,d,a,u,c=i.points,p=o((function(){for(var i=0;i<c.length;i+=1){var o,n;if(null!==(o=c[i])&&void 0!==o&&null!==(n=o[0])&&void 0!==n&&n.plotX)return i}return 0}),[c]);return r("div",{className:n.container,style:{transform:"translate(".concat(null===(s=c[p])||void 0===s||null===(d=s[0])||void 0===d?void 0:d.plotX,"px, 0)")},children:[r("div",{className:n.indexTooltip,children:[null===(a=c[p])||void 0===a||null===(u=a[0])||void 0===u?void 0:u.x," ’"]}),c.map((function(i,o){return e("div",{className:n.tooltipContainer,children:!!i.length&&e("table",{className:n.content,children:e("tbody",{children:i.map((function(i){var o,s,d,a,u,c,p,v=i.id,m=i.y,h=i.series;return r("tr",{children:[e("td",{children:e("div",{className:n.line,style:{borderBottom:"1px ".concat(t[null==h||null===(o=h.userOptions)||void 0===o?void 0:o.dashStyle]," ").concat((null==h||null===(s=h.userOptions)||void 0===s?void 0:s.color)||(null==h||null===(d=h.userOptions)||void 0===d?void 0:d.lineColor))}})}),e("td",{className:n.name,children:null==h||null===(a=h.userOptions)||void 0===a?void 0:a.name}),e("td",{className:n.value,children:(p=m,Number.isFinite(p)?Math.round(1e5*p)/1e5:"-")}),e("td",{className:n.units,children:l(null==h||null===(u=h.userOptions)||void 0===u?void 0:u.unitType)||(null==h||null===(c=h.userOptions)||void 0===c?void 0:c.unit)})]},v)}))})})},"points_from_track_".concat(o))}))]})};s.propTypes={points:i.arrayOf(i.arrayOf(i.shape({plotX:i.number.isRequired,x:i.number.isRequired}))).isRequired};export{s as default};
