import { useKitSelector } from '../KitStoreProvider/index.js';
import _ from 'lodash';
import React__default from 'react';

const Pointer = ({ uuid = "", metricWidth }) => {
  const pointers = useKitSelector(
    (state) => _.get(state, "chart.pointers")
  );
  if (!(pointers == null ? void 0 : pointers[uuid])) {
    return null;
  }
  const { left = 0, text } = pointers[uuid];
  let dis = -99999999;
  const threshold = 50;
  if (metricWidth) {
    if (left <= threshold) {
      dis = threshold;
    } else if (left >= metricWidth - threshold) {
      dis = metricWidth - threshold;
    } else {
      dis = left;
    }
  }
  return /* @__PURE__ */ React__default.createElement(
    "div",
    {
      style: {
        transform: `translate(${dis}px)`,
        position: "absolute",
        whiteSpace: "nowrap"
      }
    },
    /* @__PURE__ */ React__default.createElement("div", { className: "pointer-wrapper" }, text)
  );
};
var Pointer$1 = Pointer;

export { Pointer$1 as default };
