"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),r=require("lodash"),n=require("../../SettingsContext.js"),i=require("../../ChartsContext.js"),u=require("./Tooltip.js"),o=require("./CursorPositioner.css.js"),s=require("react/jsx-runtime");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(e);module.exports=function(){var e=t.useContext(i).chartsRef,a=t.useContext(n),l=a.settings,h=a.horizontal,f=a.maxTracesCount,v=a.settingsKey,d=t.useState([]),g=c.default(d,2),x=g[0],p=g[1],j=t.useState(!1),q=c.default(j,2),C=q[0],m=q[1],b=t.useCallback(r.throttle((function(t){return function(t){if(m(!0),e&&e.current&&l[v]){var r=[];l[v].forEach((function(n,i){var u=[],o=e.current.get(i);if(o&&o.current&&o.current.chart){var s=o.current.chart,a=s.pointer.normalize(t);s.series.forEach((function(e){var t=e.searchPoint(a,!0);t&&u.push(t)}))}r.push(u)})),p(r)}}(t)}),50,{leading:!0,trailing:!1}),[e]),y=t.useMemo((function(){var e,t=(null==l||null===(e=l[v])||void 0===e?void 0:e.length)||1;return h?{right:"".concat(68*f+32,"px"),height:"".concat(116*t,"px")}:{right:0,height:0}}),[f,h,l]);return s.jsx("div",{className:o.container,style:y,onMouseMove:b,onMouseLeave:function(){m(!1)},children:C&&s.jsx(u,{points:x})})};
