impaktapps-design 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8500,796 +8500,138 @@ var esm$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
8500
8500
  toString,
8501
8501
  scaleCanBeZeroed
8502
8502
  }, Symbol.toStringTag, { value: "Module" }));
8503
- var _excluded$w = ["tooltipOpen"];
8504
- function _objectWithoutPropertiesLoose$w(source, excluded) {
8505
- if (source == null)
8506
- return {};
8507
- var target = {};
8508
- var sourceKeys = Object.keys(source);
8509
- var key, i2;
8510
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
8511
- key = sourceKeys[i2];
8512
- if (excluded.indexOf(key) >= 0)
8513
- continue;
8514
- target[key] = source[key];
8515
- }
8516
- return target;
8517
- }
8518
- function _extends$M() {
8519
- _extends$M = Object.assign ? Object.assign.bind() : function(target) {
8520
- for (var i2 = 1; i2 < arguments.length; i2++) {
8521
- var source = arguments[i2];
8522
- for (var key in source) {
8523
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8524
- target[key] = source[key];
8525
- }
8526
- }
8527
- }
8528
- return target;
8503
+ var balancedMatch$1 = balanced$3;
8504
+ function balanced$3(a2, b10, str) {
8505
+ if (a2 instanceof RegExp)
8506
+ a2 = maybeMatch$1(a2, str);
8507
+ if (b10 instanceof RegExp)
8508
+ b10 = maybeMatch$1(b10, str);
8509
+ var r2 = range$4(a2, b10, str);
8510
+ return r2 && {
8511
+ start: r2[0],
8512
+ end: r2[1],
8513
+ pre: str.slice(0, r2[0]),
8514
+ body: str.slice(r2[0] + a2.length, r2[1]),
8515
+ post: str.slice(r2[1] + b10.length)
8529
8516
  };
8530
- return _extends$M.apply(this, arguments);
8531
8517
  }
8532
- function useTooltip(initialTooltipState) {
8533
- var _useState = useState(_extends$M({
8534
- tooltipOpen: false
8535
- }, initialTooltipState)), tooltipState = _useState[0], setTooltipState = _useState[1];
8536
- var showTooltip = useCallback(function(showArgs) {
8537
- return setTooltipState(typeof showArgs === "function" ? function(_ref) {
8538
- _ref.tooltipOpen;
8539
- var show = _objectWithoutPropertiesLoose$w(_ref, _excluded$w);
8540
- return _extends$M({}, showArgs(show), {
8541
- tooltipOpen: true
8542
- });
8543
- } : {
8544
- tooltipOpen: true,
8545
- tooltipLeft: showArgs.tooltipLeft,
8546
- tooltipTop: showArgs.tooltipTop,
8547
- tooltipData: showArgs.tooltipData
8548
- });
8549
- }, [setTooltipState]);
8550
- var hideTooltip = useCallback(function() {
8551
- return setTooltipState({
8552
- tooltipOpen: false,
8553
- tooltipLeft: void 0,
8554
- tooltipTop: void 0,
8555
- tooltipData: void 0
8556
- });
8557
- }, [setTooltipState]);
8558
- return {
8559
- tooltipOpen: tooltipState.tooltipOpen,
8560
- tooltipLeft: tooltipState.tooltipLeft,
8561
- tooltipTop: tooltipState.tooltipTop,
8562
- tooltipData: tooltipState.tooltipData,
8563
- updateTooltip: setTooltipState,
8564
- showTooltip,
8565
- hideTooltip
8566
- };
8518
+ function maybeMatch$1(reg, str) {
8519
+ var m2 = str.match(reg);
8520
+ return m2 ? m2[0] : null;
8567
8521
  }
8568
- function _extends$L() {
8569
- _extends$L = Object.assign ? Object.assign.bind() : function(target) {
8570
- for (var i2 = 1; i2 < arguments.length; i2++) {
8571
- var source = arguments[i2];
8572
- for (var key in source) {
8573
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8574
- target[key] = source[key];
8522
+ balanced$3.range = range$4;
8523
+ function range$4(a2, b10, str) {
8524
+ var begs, beg, left2, right2, result;
8525
+ var ai = str.indexOf(a2);
8526
+ var bi = str.indexOf(b10, ai + 1);
8527
+ var i2 = ai;
8528
+ if (ai >= 0 && bi > 0) {
8529
+ begs = [];
8530
+ left2 = str.length;
8531
+ while (i2 >= 0 && !result) {
8532
+ if (i2 == ai) {
8533
+ begs.push(i2);
8534
+ ai = str.indexOf(a2, i2 + 1);
8535
+ } else if (begs.length == 1) {
8536
+ result = [begs.pop(), bi];
8537
+ } else {
8538
+ beg = begs.pop();
8539
+ if (beg < left2) {
8540
+ left2 = beg;
8541
+ right2 = bi;
8575
8542
  }
8543
+ bi = str.indexOf(b10, i2 + 1);
8576
8544
  }
8545
+ i2 = ai < bi && ai >= 0 ? ai : bi;
8546
+ }
8547
+ if (begs.length) {
8548
+ result = [left2, right2];
8577
8549
  }
8578
- return target;
8579
- };
8580
- return _extends$L.apply(this, arguments);
8581
- }
8582
- function withTooltip(BaseComponent, containerProps, renderContainer) {
8583
- if (containerProps === void 0) {
8584
- containerProps = {
8585
- style: {
8586
- position: "relative",
8587
- width: "inherit",
8588
- height: "inherit"
8589
- }
8590
- };
8591
- }
8592
- if (renderContainer === void 0) {
8593
- renderContainer = function renderContainer2(children2, props) {
8594
- return /* @__PURE__ */ React__default.createElement("div", props, children2);
8595
- };
8596
8550
  }
8597
- var WrappedComponent = function WrappedComponent2(props) {
8598
- var tooltipProps = useTooltip();
8599
- return renderContainer(/* @__PURE__ */ React__default.createElement(BaseComponent, _extends$L({}, tooltipProps, props)), containerProps);
8551
+ return result;
8552
+ }
8553
+ var balancedMatch = balanced$2;
8554
+ function balanced$2(a2, b10, str) {
8555
+ if (a2 instanceof RegExp)
8556
+ a2 = maybeMatch(a2, str);
8557
+ if (b10 instanceof RegExp)
8558
+ b10 = maybeMatch(b10, str);
8559
+ var r2 = range$3(a2, b10, str);
8560
+ return r2 && {
8561
+ start: r2[0],
8562
+ end: r2[1],
8563
+ pre: str.slice(0, r2[0]),
8564
+ body: str.slice(r2[0] + a2.length, r2[1]),
8565
+ post: str.slice(r2[1] + b10.length)
8600
8566
  };
8601
- return WrappedComponent;
8602
8567
  }
8603
- function debounce$2(func, wait, immediate) {
8604
- var timeout2, args, context, timestamp, result;
8605
- if (null == wait)
8606
- wait = 100;
8607
- function later() {
8608
- var last2 = Date.now() - timestamp;
8609
- if (last2 < wait && last2 >= 0) {
8610
- timeout2 = setTimeout(later, wait - last2);
8611
- } else {
8612
- timeout2 = null;
8613
- if (!immediate) {
8614
- result = func.apply(context, args);
8615
- context = args = null;
8568
+ function maybeMatch(reg, str) {
8569
+ var m2 = str.match(reg);
8570
+ return m2 ? m2[0] : null;
8571
+ }
8572
+ balanced$2.range = range$3;
8573
+ function range$3(a2, b10, str) {
8574
+ var begs, beg, left2, right2, result;
8575
+ var ai = str.indexOf(a2);
8576
+ var bi = str.indexOf(b10, ai + 1);
8577
+ var i2 = ai;
8578
+ if (ai >= 0 && bi > 0) {
8579
+ if (a2 === b10) {
8580
+ return [ai, bi];
8581
+ }
8582
+ begs = [];
8583
+ left2 = str.length;
8584
+ while (i2 >= 0 && !result) {
8585
+ if (i2 == ai) {
8586
+ begs.push(i2);
8587
+ ai = str.indexOf(a2, i2 + 1);
8588
+ } else if (begs.length == 1) {
8589
+ result = [begs.pop(), bi];
8590
+ } else {
8591
+ beg = begs.pop();
8592
+ if (beg < left2) {
8593
+ left2 = beg;
8594
+ right2 = bi;
8595
+ }
8596
+ bi = str.indexOf(b10, i2 + 1);
8616
8597
  }
8598
+ i2 = ai < bi && ai >= 0 ? ai : bi;
8599
+ }
8600
+ if (begs.length) {
8601
+ result = [left2, right2];
8617
8602
  }
8618
8603
  }
8619
- var debounced = function() {
8620
- context = this;
8621
- args = arguments;
8622
- timestamp = Date.now();
8623
- var callNow = immediate && !timeout2;
8624
- if (!timeout2)
8625
- timeout2 = setTimeout(later, wait);
8626
- if (callNow) {
8627
- result = func.apply(context, args);
8628
- context = args = null;
8604
+ return result;
8605
+ }
8606
+ var balanced$1 = balancedMatch;
8607
+ var reduceFunctionCall_1 = reduceFunctionCall$1;
8608
+ function reduceFunctionCall$1(string2, functionRE, callback) {
8609
+ var call = string2;
8610
+ return getFunctionCalls(string2, functionRE).reduce(function(string3, obj) {
8611
+ return string3.replace(obj.functionIdentifier + "(" + obj.matches.body + ")", evalFunctionCall(obj.matches.body, obj.functionIdentifier, callback, call, functionRE));
8612
+ }, string2);
8613
+ }
8614
+ function getFunctionCalls(call, functionRE) {
8615
+ var expressions = [];
8616
+ var fnRE = typeof functionRE === "string" ? new RegExp("\\b(" + functionRE + ")\\(") : functionRE;
8617
+ do {
8618
+ var searchMatch = fnRE.exec(call);
8619
+ if (!searchMatch) {
8620
+ return expressions;
8629
8621
  }
8630
- return result;
8631
- };
8632
- debounced.clear = function() {
8633
- if (timeout2) {
8634
- clearTimeout(timeout2);
8635
- timeout2 = null;
8622
+ if (searchMatch[1] === void 0) {
8623
+ throw new Error("Missing the first couple of parenthesis to get the function identifier in " + functionRE);
8636
8624
  }
8637
- };
8638
- debounced.flush = function() {
8639
- if (timeout2) {
8640
- result = func.apply(context, args);
8641
- context = args = null;
8642
- clearTimeout(timeout2);
8643
- timeout2 = null;
8625
+ var fn = searchMatch[1];
8626
+ var startIndex = searchMatch.index;
8627
+ var matches = balanced$1("(", ")", call.substring(startIndex));
8628
+ if (!matches || matches.start !== searchMatch[0].length - 1) {
8629
+ throw new SyntaxError(fn + "(): missing closing ')' in the value '" + call + "'");
8644
8630
  }
8645
- };
8646
- return debounced;
8647
- }
8648
- debounce$2.debounce = debounce$2;
8649
- var debounce_1$1 = debounce$2;
8650
- function useMeasure(_temp) {
8651
- let {
8652
- debounce: debounce2,
8653
- scroll,
8654
- polyfill,
8655
- offsetSize
8656
- } = _temp === void 0 ? {
8657
- debounce: 0,
8658
- scroll: false,
8659
- offsetSize: false
8660
- } : _temp;
8661
- const ResizeObserver2 = polyfill || (typeof window === "undefined" ? class ResizeObserver {
8662
- } : window.ResizeObserver);
8663
- if (!ResizeObserver2) {
8664
- throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
8665
- }
8666
- const [bounds2, set2] = useState({
8667
- left: 0,
8668
- top: 0,
8669
- width: 0,
8670
- height: 0,
8671
- bottom: 0,
8672
- right: 0,
8673
- x: 0,
8674
- y: 0
8675
- });
8676
- const state = useRef({
8677
- element: null,
8678
- scrollContainers: null,
8679
- resizeObserver: null,
8680
- lastBounds: bounds2
8681
- });
8682
- const scrollDebounce = debounce2 ? typeof debounce2 === "number" ? debounce2 : debounce2.scroll : null;
8683
- const resizeDebounce = debounce2 ? typeof debounce2 === "number" ? debounce2 : debounce2.resize : null;
8684
- const mounted = useRef(false);
8685
- useEffect(() => {
8686
- mounted.current = true;
8687
- return () => void (mounted.current = false);
8688
- });
8689
- const [forceRefresh, resizeChange, scrollChange] = useMemo(() => {
8690
- const callback = () => {
8691
- if (!state.current.element)
8692
- return;
8693
- const {
8694
- left: left2,
8695
- top: top2,
8696
- width,
8697
- height,
8698
- bottom: bottom2,
8699
- right: right2,
8700
- x: x2,
8701
- y: y2
8702
- } = state.current.element.getBoundingClientRect();
8703
- const size = {
8704
- left: left2,
8705
- top: top2,
8706
- width,
8707
- height,
8708
- bottom: bottom2,
8709
- right: right2,
8710
- x: x2,
8711
- y: y2
8712
- };
8713
- if (state.current.element instanceof HTMLElement && offsetSize) {
8714
- size.height = state.current.element.offsetHeight;
8715
- size.width = state.current.element.offsetWidth;
8716
- }
8717
- Object.freeze(size);
8718
- if (mounted.current && !areBoundsEqual(state.current.lastBounds, size))
8719
- set2(state.current.lastBounds = size);
8720
- };
8721
- return [callback, resizeDebounce ? debounce_1$1(callback, resizeDebounce) : callback, scrollDebounce ? debounce_1$1(callback, scrollDebounce) : callback];
8722
- }, [set2, offsetSize, scrollDebounce, resizeDebounce]);
8723
- function removeListeners() {
8724
- if (state.current.scrollContainers) {
8725
- state.current.scrollContainers.forEach((element) => element.removeEventListener("scroll", scrollChange, true));
8726
- state.current.scrollContainers = null;
8727
- }
8728
- if (state.current.resizeObserver) {
8729
- state.current.resizeObserver.disconnect();
8730
- state.current.resizeObserver = null;
8731
- }
8732
- }
8733
- function addListeners() {
8734
- if (!state.current.element)
8735
- return;
8736
- state.current.resizeObserver = new ResizeObserver2(scrollChange);
8737
- state.current.resizeObserver.observe(state.current.element);
8738
- if (scroll && state.current.scrollContainers) {
8739
- state.current.scrollContainers.forEach((scrollContainer) => scrollContainer.addEventListener("scroll", scrollChange, {
8740
- capture: true,
8741
- passive: true
8742
- }));
8743
- }
8744
- }
8745
- const ref = (node) => {
8746
- if (!node || node === state.current.element)
8747
- return;
8748
- removeListeners();
8749
- state.current.element = node;
8750
- state.current.scrollContainers = findScrollContainers(node);
8751
- addListeners();
8752
- };
8753
- useOnWindowScroll(scrollChange, Boolean(scroll));
8754
- useOnWindowResize(resizeChange);
8755
- useEffect(() => {
8756
- removeListeners();
8757
- addListeners();
8758
- }, [scroll, scrollChange, resizeChange]);
8759
- useEffect(() => removeListeners, []);
8760
- return [ref, bounds2, forceRefresh];
8761
- }
8762
- function useOnWindowResize(onWindowResize) {
8763
- useEffect(() => {
8764
- const cb = onWindowResize;
8765
- window.addEventListener("resize", cb);
8766
- return () => void window.removeEventListener("resize", cb);
8767
- }, [onWindowResize]);
8768
- }
8769
- function useOnWindowScroll(onScroll, enabled) {
8770
- useEffect(() => {
8771
- if (enabled) {
8772
- const cb = onScroll;
8773
- window.addEventListener("scroll", cb, {
8774
- capture: true,
8775
- passive: true
8776
- });
8777
- return () => void window.removeEventListener("scroll", cb, true);
8778
- }
8779
- }, [onScroll, enabled]);
8780
- }
8781
- function findScrollContainers(element) {
8782
- const result = [];
8783
- if (!element || element === document.body)
8784
- return result;
8785
- const {
8786
- overflow,
8787
- overflowX,
8788
- overflowY
8789
- } = window.getComputedStyle(element);
8790
- if ([overflow, overflowX, overflowY].some((prop) => prop === "auto" || prop === "scroll"))
8791
- result.push(element);
8792
- return [...result, ...findScrollContainers(element.parentElement)];
8793
- }
8794
- const keys = ["x", "y", "top", "bottom", "left", "right", "width", "height"];
8795
- const areBoundsEqual = (a2, b10) => keys.every((key) => a2[key] === b10[key]);
8796
- function _inheritsLoose$1(subClass, superClass) {
8797
- subClass.prototype = Object.create(superClass.prototype);
8798
- subClass.prototype.constructor = subClass;
8799
- _setPrototypeOf$1(subClass, superClass);
8800
- }
8801
- function _setPrototypeOf$1(o, p2) {
8802
- _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
8803
- o2.__proto__ = p3;
8804
- return o2;
8805
- };
8806
- return _setPrototypeOf$1(o, p2);
8807
- }
8808
- var Portal = /* @__PURE__ */ function(_React$PureComponent) {
8809
- _inheritsLoose$1(Portal2, _React$PureComponent);
8810
- function Portal2() {
8811
- return _React$PureComponent.apply(this, arguments) || this;
8812
- }
8813
- var _proto = Portal2.prototype;
8814
- _proto.componentWillUnmount = function componentWillUnmount() {
8815
- if (this.node && document.body) {
8816
- document.body.removeChild(this.node);
8817
- delete this.node;
8818
- }
8819
- };
8820
- _proto.render = function render2() {
8821
- if (!this.node && typeof document !== "undefined") {
8822
- this.node = document.createElement("div");
8823
- if (this.props.zIndex != null)
8824
- this.node.style.zIndex = "" + this.props.zIndex;
8825
- document.body.append(this.node);
8826
- }
8827
- if (!this.node) {
8828
- return null;
8829
- }
8830
- return /* @__PURE__ */ ReactDOM.createPortal(this.props.children, this.node);
8831
- };
8832
- return Portal2;
8833
- }(React__default.PureComponent);
8834
- Portal.propTypes = {
8835
- zIndex: _pt.oneOfType([_pt.number, _pt.string])
8836
- };
8837
- var _excluded$v = ["className", "top", "left", "offsetLeft", "offsetTop", "style", "children", "unstyled", "applyPositionStyle"];
8838
- function _extends$K() {
8839
- _extends$K = Object.assign ? Object.assign.bind() : function(target) {
8840
- for (var i2 = 1; i2 < arguments.length; i2++) {
8841
- var source = arguments[i2];
8842
- for (var key in source) {
8843
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8844
- target[key] = source[key];
8845
- }
8846
- }
8847
- }
8848
- return target;
8849
- };
8850
- return _extends$K.apply(this, arguments);
8851
- }
8852
- function _objectWithoutPropertiesLoose$v(source, excluded) {
8853
- if (source == null)
8854
- return {};
8855
- var target = {};
8856
- var sourceKeys = Object.keys(source);
8857
- var key, i2;
8858
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
8859
- key = sourceKeys[i2];
8860
- if (excluded.indexOf(key) >= 0)
8861
- continue;
8862
- target[key] = source[key];
8863
- }
8864
- return target;
8865
- }
8866
- var defaultStyles = {
8867
- position: "absolute",
8868
- backgroundColor: "white",
8869
- color: "#666666",
8870
- padding: ".3rem .5rem",
8871
- borderRadius: "3px",
8872
- fontSize: "14px",
8873
- boxShadow: "0 1px 2px rgba(33,33,33,0.2)",
8874
- lineHeight: "1em",
8875
- pointerEvents: "none"
8876
- };
8877
- var Tooltip$1 = /* @__PURE__ */ React__default.forwardRef(function(_ref, ref) {
8878
- var className = _ref.className, top2 = _ref.top, left2 = _ref.left, _ref$offsetLeft = _ref.offsetLeft, offsetLeft = _ref$offsetLeft === void 0 ? 10 : _ref$offsetLeft, _ref$offsetTop = _ref.offsetTop, offsetTop = _ref$offsetTop === void 0 ? 10 : _ref$offsetTop, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyles : _ref$style, children2 = _ref.children, _ref$unstyled = _ref.unstyled, unstyled = _ref$unstyled === void 0 ? false : _ref$unstyled, _ref$applyPositionSty = _ref.applyPositionStyle, applyPositionStyle = _ref$applyPositionSty === void 0 ? false : _ref$applyPositionSty, restProps = _objectWithoutPropertiesLoose$v(_ref, _excluded$v);
8879
- return /* @__PURE__ */ React__default.createElement("div", _extends$K({
8880
- ref,
8881
- className: cx("visx-tooltip", className),
8882
- style: _extends$K({
8883
- top: top2 == null || offsetTop == null ? top2 : top2 + offsetTop,
8884
- left: left2 == null || offsetLeft == null ? left2 : left2 + offsetLeft
8885
- }, applyPositionStyle && {
8886
- position: "absolute"
8887
- }, !unstyled && style2)
8888
- }, restProps), children2);
8889
- });
8890
- Tooltip$1.propTypes = {
8891
- children: _pt.node,
8892
- className: _pt.string,
8893
- left: _pt.number,
8894
- offsetLeft: _pt.number,
8895
- offsetTop: _pt.number,
8896
- top: _pt.number,
8897
- applyPositionStyle: _pt.bool,
8898
- unstyled: _pt.bool
8899
- };
8900
- Tooltip$1.displayName = "Tooltip";
8901
- var Tooltip$2 = Tooltip$1;
8902
- function _extends$J() {
8903
- _extends$J = Object.assign ? Object.assign.bind() : function(target) {
8904
- for (var i2 = 1; i2 < arguments.length; i2++) {
8905
- var source = arguments[i2];
8906
- for (var key in source) {
8907
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8908
- target[key] = source[key];
8909
- }
8910
- }
8911
- }
8912
- return target;
8913
- };
8914
- return _extends$J.apply(this, arguments);
8915
- }
8916
- function _assertThisInitialized(self2) {
8917
- if (self2 === void 0) {
8918
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
8919
- }
8920
- return self2;
8921
- }
8922
- function _inheritsLoose(subClass, superClass) {
8923
- subClass.prototype = Object.create(superClass.prototype);
8924
- subClass.prototype.constructor = subClass;
8925
- _setPrototypeOf(subClass, superClass);
8926
- }
8927
- function _setPrototypeOf(o, p2) {
8928
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
8929
- o2.__proto__ = p3;
8930
- return o2;
8931
- };
8932
- return _setPrototypeOf(o, p2);
8933
- }
8934
- var emptyRect = {
8935
- top: 0,
8936
- right: 0,
8937
- bottom: 0,
8938
- left: 0,
8939
- width: 0,
8940
- height: 0
8941
- };
8942
- function withBoundingRects(BaseComponent) {
8943
- var _class;
8944
- return _class = /* @__PURE__ */ function(_React$PureComponent) {
8945
- _inheritsLoose(WrappedComponent, _React$PureComponent);
8946
- function WrappedComponent(props) {
8947
- var _this;
8948
- _this = _React$PureComponent.call(this, props) || this;
8949
- _this.state = {
8950
- rect: void 0,
8951
- parentRect: void 0
8952
- };
8953
- _this.nodeRef = /* @__PURE__ */ React__default.createRef();
8954
- _this.getRects = _this.getRects.bind(_assertThisInitialized(_this));
8955
- return _this;
8956
- }
8957
- var _proto = WrappedComponent.prototype;
8958
- _proto.componentDidMount = function componentDidMount() {
8959
- var _this$nodeRef, _this2 = this;
8960
- this.node = (_this$nodeRef = this.nodeRef) != null && _this$nodeRef.current ? this.nodeRef.current : ReactDOM.findDOMNode(this);
8961
- this.setState(function() {
8962
- return _this2.getRects();
8963
- });
8964
- };
8965
- _proto.getRects = function getRects() {
8966
- if (!this.node)
8967
- return this.state;
8968
- var node = this.node;
8969
- var parentNode = node.parentNode;
8970
- var rect = node.getBoundingClientRect ? node.getBoundingClientRect() : emptyRect;
8971
- var parentRect = parentNode != null && parentNode.getBoundingClientRect ? parentNode.getBoundingClientRect() : emptyRect;
8972
- return {
8973
- rect,
8974
- parentRect
8975
- };
8976
- };
8977
- _proto.render = function render2() {
8978
- return /* @__PURE__ */ React__default.createElement(BaseComponent, _extends$J({
8979
- nodeRef: this.nodeRef,
8980
- getRects: this.getRects
8981
- }, this.state, this.props));
8982
- };
8983
- return WrappedComponent;
8984
- }(React__default.PureComponent), _class.displayName = "withBoundingRects(" + (BaseComponent.displayName || "") + ")", _class;
8985
- }
8986
- var TooltipPositionContext = /* @__PURE__ */ createContext({
8987
- isFlippedVertically: false,
8988
- isFlippedHorizontally: false
8989
- });
8990
- var TooltipPositionProvider = TooltipPositionContext.Provider;
8991
- TooltipPositionContext.Consumer;
8992
- var _excluded$u = ["children", "getRects", "left", "offsetLeft", "offsetTop", "parentRect", "rect", "style", "top", "unstyled", "nodeRef"];
8993
- function _extends$I() {
8994
- _extends$I = Object.assign ? Object.assign.bind() : function(target) {
8995
- for (var i2 = 1; i2 < arguments.length; i2++) {
8996
- var source = arguments[i2];
8997
- for (var key in source) {
8998
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8999
- target[key] = source[key];
9000
- }
9001
- }
9002
- }
9003
- return target;
9004
- };
9005
- return _extends$I.apply(this, arguments);
9006
- }
9007
- function _objectWithoutPropertiesLoose$u(source, excluded) {
9008
- if (source == null)
9009
- return {};
9010
- var target = {};
9011
- var sourceKeys = Object.keys(source);
9012
- var key, i2;
9013
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
9014
- key = sourceKeys[i2];
9015
- if (excluded.indexOf(key) >= 0)
9016
- continue;
9017
- target[key] = source[key];
9018
- }
9019
- return target;
9020
- }
9021
- function TooltipWithBounds(_ref) {
9022
- var children2 = _ref.children;
9023
- _ref.getRects;
9024
- var _ref$left = _ref.left, initialLeft = _ref$left === void 0 ? 0 : _ref$left, _ref$offsetLeft = _ref.offsetLeft, offsetLeft = _ref$offsetLeft === void 0 ? 10 : _ref$offsetLeft, _ref$offsetTop = _ref.offsetTop, offsetTop = _ref$offsetTop === void 0 ? 10 : _ref$offsetTop, parentBounds = _ref.parentRect, ownBounds = _ref.rect, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyles : _ref$style, _ref$top = _ref.top, initialTop = _ref$top === void 0 ? 0 : _ref$top, _ref$unstyled = _ref.unstyled, unstyled = _ref$unstyled === void 0 ? false : _ref$unstyled, nodeRef = _ref.nodeRef, otherProps = _objectWithoutPropertiesLoose$u(_ref, _excluded$u);
9025
- var transform2;
9026
- var placeTooltipLeft = false;
9027
- var placeTooltipUp = false;
9028
- if (ownBounds && parentBounds) {
9029
- var left2 = initialLeft;
9030
- var top2 = initialTop;
9031
- if (parentBounds.width) {
9032
- var rightPlacementClippedPx = left2 + offsetLeft + ownBounds.width - parentBounds.width;
9033
- var leftPlacementClippedPx = ownBounds.width - left2 - offsetLeft;
9034
- placeTooltipLeft = rightPlacementClippedPx > 0 && rightPlacementClippedPx > leftPlacementClippedPx;
9035
- } else {
9036
- var _rightPlacementClippedPx = left2 + offsetLeft + ownBounds.width - window.innerWidth;
9037
- var _leftPlacementClippedPx = ownBounds.width - left2 - offsetLeft;
9038
- placeTooltipLeft = _rightPlacementClippedPx > 0 && _rightPlacementClippedPx > _leftPlacementClippedPx;
9039
- }
9040
- if (parentBounds.height) {
9041
- var bottomPlacementClippedPx = top2 + offsetTop + ownBounds.height - parentBounds.height;
9042
- var topPlacementClippedPx = ownBounds.height - top2 - offsetTop;
9043
- placeTooltipUp = bottomPlacementClippedPx > 0 && bottomPlacementClippedPx > topPlacementClippedPx;
9044
- } else {
9045
- placeTooltipUp = top2 + offsetTop + ownBounds.height > window.innerHeight;
9046
- }
9047
- left2 = placeTooltipLeft ? left2 - ownBounds.width - offsetLeft : left2 + offsetLeft;
9048
- top2 = placeTooltipUp ? top2 - ownBounds.height - offsetTop : top2 + offsetTop;
9049
- left2 = Math.round(left2);
9050
- top2 = Math.round(top2);
9051
- transform2 = "translate(" + left2 + "px, " + top2 + "px)";
9052
- }
9053
- return /* @__PURE__ */ React__default.createElement(Tooltip$2, _extends$I({
9054
- ref: nodeRef,
9055
- style: _extends$I({
9056
- left: 0,
9057
- top: 0,
9058
- transform: transform2
9059
- }, !unstyled && style2)
9060
- }, otherProps), /* @__PURE__ */ React__default.createElement(TooltipPositionProvider, {
9061
- value: {
9062
- isFlippedVertically: !placeTooltipUp,
9063
- isFlippedHorizontally: !placeTooltipLeft
9064
- }
9065
- }, children2));
9066
- }
9067
- TooltipWithBounds.propTypes = {
9068
- nodeRef: _pt.oneOfType([_pt.string, _pt.func, _pt.object])
9069
- };
9070
- var TooltipWithBounds$1 = withBoundingRects(TooltipWithBounds);
9071
- var _excluded$t = ["detectBounds", "zIndex"], _excluded2$1 = ["left", "top", "detectBounds", "zIndex"];
9072
- function _objectWithoutPropertiesLoose$t(source, excluded) {
9073
- if (source == null)
9074
- return {};
9075
- var target = {};
9076
- var sourceKeys = Object.keys(source);
9077
- var key, i2;
9078
- for (i2 = 0; i2 < sourceKeys.length; i2++) {
9079
- key = sourceKeys[i2];
9080
- if (excluded.indexOf(key) >= 0)
9081
- continue;
9082
- target[key] = source[key];
9083
- }
9084
- return target;
9085
- }
9086
- function useTooltipInPortal(_temp) {
9087
- var _ref = _temp === void 0 ? {} : _temp, _ref$detectBounds = _ref.detectBounds, detectBoundsOption = _ref$detectBounds === void 0 ? true : _ref$detectBounds, zIndexOption = _ref.zIndex, useMeasureOptions = _objectWithoutPropertiesLoose$t(_ref, _excluded$t);
9088
- var _useMeasure = useMeasure(useMeasureOptions), containerRef = _useMeasure[0], containerBounds = _useMeasure[1], forceRefreshBounds = _useMeasure[2];
9089
- var _useState = useState(false), isSsr = _useState[0], setIsSsr = _useState[1];
9090
- useEffect(function() {
9091
- setIsSsr(false);
9092
- }, []);
9093
- var TooltipInPortal = useMemo(function() {
9094
- return function(_ref2) {
9095
- var _ref2$left = _ref2.left, containerLeft = _ref2$left === void 0 ? 0 : _ref2$left, _ref2$top = _ref2.top, containerTop = _ref2$top === void 0 ? 0 : _ref2$top, detectBoundsProp = _ref2.detectBounds, zIndexProp = _ref2.zIndex, tooltipProps = _objectWithoutPropertiesLoose$t(_ref2, _excluded2$1);
9096
- var detectBounds = detectBoundsProp == null ? detectBoundsOption : detectBoundsProp;
9097
- var zIndex = zIndexProp == null ? zIndexOption : zIndexProp;
9098
- var TooltipComponent = detectBounds ? TooltipWithBounds$1 : Tooltip$2;
9099
- var scrollX = isSsr ? 0 : window.scrollX;
9100
- var scrollY = isSsr ? 0 : window.scrollY;
9101
- var portalLeft = containerLeft + (containerBounds.left || 0) + scrollX;
9102
- var portalTop = containerTop + (containerBounds.top || 0) + scrollY;
9103
- return /* @__PURE__ */ jsx(Portal, {
9104
- zIndex,
9105
- children: /* @__PURE__ */ jsx(TooltipComponent, {
9106
- left: portalLeft,
9107
- top: portalTop,
9108
- ...tooltipProps
9109
- })
9110
- });
9111
- };
9112
- }, [detectBoundsOption, zIndexOption, containerBounds.left, containerBounds.top, isSsr]);
9113
- return {
9114
- containerRef,
9115
- containerBounds,
9116
- forceRefreshBounds,
9117
- TooltipInPortal
9118
- };
9119
- }
9120
- const ToolTip = ({
9121
- style: style2,
9122
- top: top2,
9123
- left: left2,
9124
- tooltipData
9125
- }) => {
9126
- const {
9127
- TooltipInPortal
9128
- } = useTooltipInPortal({
9129
- detectBounds: true,
9130
- scroll: true
9131
- });
9132
- return /* @__PURE__ */ jsx(TooltipInPortal, {
9133
- top: top2,
9134
- left: left2,
9135
- children: /* @__PURE__ */ jsxs("div", {
9136
- style: {
9137
- width: "100%",
9138
- height: "auto",
9139
- textAlign: "center",
9140
- background: "black",
9141
- boxShadow: "2px 2px 5px black",
9142
- color: "#6c5efb",
9143
- padding: "15px",
9144
- ...style2 == null ? void 0 : style2.tooltipStyle
9145
- },
9146
- children: [/* @__PURE__ */ jsx("div", {
9147
- style: {
9148
- paddingBottom: "2px",
9149
- color: "white"
9150
- },
9151
- children: tooltipData[0]
9152
- }), /* @__PURE__ */ jsx("div", {
9153
- style: {
9154
- marginTop: "10px"
9155
- },
9156
- children: tooltipData[1]
9157
- })]
9158
- })
9159
- }, Math.random());
9160
- };
9161
- var balancedMatch$1 = balanced$3;
9162
- function balanced$3(a2, b10, str) {
9163
- if (a2 instanceof RegExp)
9164
- a2 = maybeMatch$1(a2, str);
9165
- if (b10 instanceof RegExp)
9166
- b10 = maybeMatch$1(b10, str);
9167
- var r2 = range$4(a2, b10, str);
9168
- return r2 && {
9169
- start: r2[0],
9170
- end: r2[1],
9171
- pre: str.slice(0, r2[0]),
9172
- body: str.slice(r2[0] + a2.length, r2[1]),
9173
- post: str.slice(r2[1] + b10.length)
9174
- };
9175
- }
9176
- function maybeMatch$1(reg, str) {
9177
- var m2 = str.match(reg);
9178
- return m2 ? m2[0] : null;
9179
- }
9180
- balanced$3.range = range$4;
9181
- function range$4(a2, b10, str) {
9182
- var begs, beg, left2, right2, result;
9183
- var ai = str.indexOf(a2);
9184
- var bi = str.indexOf(b10, ai + 1);
9185
- var i2 = ai;
9186
- if (ai >= 0 && bi > 0) {
9187
- begs = [];
9188
- left2 = str.length;
9189
- while (i2 >= 0 && !result) {
9190
- if (i2 == ai) {
9191
- begs.push(i2);
9192
- ai = str.indexOf(a2, i2 + 1);
9193
- } else if (begs.length == 1) {
9194
- result = [begs.pop(), bi];
9195
- } else {
9196
- beg = begs.pop();
9197
- if (beg < left2) {
9198
- left2 = beg;
9199
- right2 = bi;
9200
- }
9201
- bi = str.indexOf(b10, i2 + 1);
9202
- }
9203
- i2 = ai < bi && ai >= 0 ? ai : bi;
9204
- }
9205
- if (begs.length) {
9206
- result = [left2, right2];
9207
- }
9208
- }
9209
- return result;
9210
- }
9211
- var balancedMatch = balanced$2;
9212
- function balanced$2(a2, b10, str) {
9213
- if (a2 instanceof RegExp)
9214
- a2 = maybeMatch(a2, str);
9215
- if (b10 instanceof RegExp)
9216
- b10 = maybeMatch(b10, str);
9217
- var r2 = range$3(a2, b10, str);
9218
- return r2 && {
9219
- start: r2[0],
9220
- end: r2[1],
9221
- pre: str.slice(0, r2[0]),
9222
- body: str.slice(r2[0] + a2.length, r2[1]),
9223
- post: str.slice(r2[1] + b10.length)
9224
- };
9225
- }
9226
- function maybeMatch(reg, str) {
9227
- var m2 = str.match(reg);
9228
- return m2 ? m2[0] : null;
9229
- }
9230
- balanced$2.range = range$3;
9231
- function range$3(a2, b10, str) {
9232
- var begs, beg, left2, right2, result;
9233
- var ai = str.indexOf(a2);
9234
- var bi = str.indexOf(b10, ai + 1);
9235
- var i2 = ai;
9236
- if (ai >= 0 && bi > 0) {
9237
- if (a2 === b10) {
9238
- return [ai, bi];
9239
- }
9240
- begs = [];
9241
- left2 = str.length;
9242
- while (i2 >= 0 && !result) {
9243
- if (i2 == ai) {
9244
- begs.push(i2);
9245
- ai = str.indexOf(a2, i2 + 1);
9246
- } else if (begs.length == 1) {
9247
- result = [begs.pop(), bi];
9248
- } else {
9249
- beg = begs.pop();
9250
- if (beg < left2) {
9251
- left2 = beg;
9252
- right2 = bi;
9253
- }
9254
- bi = str.indexOf(b10, i2 + 1);
9255
- }
9256
- i2 = ai < bi && ai >= 0 ? ai : bi;
9257
- }
9258
- if (begs.length) {
9259
- result = [left2, right2];
9260
- }
9261
- }
9262
- return result;
9263
- }
9264
- var balanced$1 = balancedMatch;
9265
- var reduceFunctionCall_1 = reduceFunctionCall$1;
9266
- function reduceFunctionCall$1(string2, functionRE, callback) {
9267
- var call = string2;
9268
- return getFunctionCalls(string2, functionRE).reduce(function(string3, obj) {
9269
- return string3.replace(obj.functionIdentifier + "(" + obj.matches.body + ")", evalFunctionCall(obj.matches.body, obj.functionIdentifier, callback, call, functionRE));
9270
- }, string2);
9271
- }
9272
- function getFunctionCalls(call, functionRE) {
9273
- var expressions = [];
9274
- var fnRE = typeof functionRE === "string" ? new RegExp("\\b(" + functionRE + ")\\(") : functionRE;
9275
- do {
9276
- var searchMatch = fnRE.exec(call);
9277
- if (!searchMatch) {
9278
- return expressions;
9279
- }
9280
- if (searchMatch[1] === void 0) {
9281
- throw new Error("Missing the first couple of parenthesis to get the function identifier in " + functionRE);
9282
- }
9283
- var fn = searchMatch[1];
9284
- var startIndex = searchMatch.index;
9285
- var matches = balanced$1("(", ")", call.substring(startIndex));
9286
- if (!matches || matches.start !== searchMatch[0].length - 1) {
9287
- throw new SyntaxError(fn + "(): missing closing ')' in the value '" + call + "'");
9288
- }
9289
- expressions.push({ matches, functionIdentifier: fn });
9290
- call = matches.post;
9291
- } while (fnRE.test(call));
9292
- return expressions;
8631
+ expressions.push({ matches, functionIdentifier: fn });
8632
+ call = matches.post;
8633
+ } while (fnRE.test(call));
8634
+ return expressions;
9293
8635
  }
9294
8636
  function evalFunctionCall(string2, functionIdentifier, callback, call, functionRE) {
9295
8637
  return callback(reduceFunctionCall$1(string2, functionRE, callback), functionIdentifier, call);
@@ -10314,212 +9656,616 @@ function hashSet$1(key, value) {
10314
9656
  data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
10315
9657
  return this;
10316
9658
  }
10317
- var _hashSet = hashSet$1;
10318
- var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
10319
- function Hash$1(entries) {
10320
- var index2 = -1, length2 = entries == null ? 0 : entries.length;
10321
- this.clear();
10322
- while (++index2 < length2) {
10323
- var entry = entries[index2];
10324
- this.set(entry[0], entry[1]);
9659
+ var _hashSet = hashSet$1;
9660
+ var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
9661
+ function Hash$1(entries) {
9662
+ var index2 = -1, length2 = entries == null ? 0 : entries.length;
9663
+ this.clear();
9664
+ while (++index2 < length2) {
9665
+ var entry = entries[index2];
9666
+ this.set(entry[0], entry[1]);
9667
+ }
9668
+ }
9669
+ Hash$1.prototype.clear = hashClear;
9670
+ Hash$1.prototype["delete"] = hashDelete;
9671
+ Hash$1.prototype.get = hashGet;
9672
+ Hash$1.prototype.has = hashHas;
9673
+ Hash$1.prototype.set = hashSet;
9674
+ var _Hash = Hash$1;
9675
+ function listCacheClear$1() {
9676
+ this.__data__ = [];
9677
+ this.size = 0;
9678
+ }
9679
+ var _listCacheClear = listCacheClear$1;
9680
+ function eq$1(value, other) {
9681
+ return value === other || value !== value && other !== other;
9682
+ }
9683
+ var eq_1 = eq$1;
9684
+ var eq = eq_1;
9685
+ function assocIndexOf$4(array2, key) {
9686
+ var length2 = array2.length;
9687
+ while (length2--) {
9688
+ if (eq(array2[length2][0], key)) {
9689
+ return length2;
9690
+ }
9691
+ }
9692
+ return -1;
9693
+ }
9694
+ var _assocIndexOf = assocIndexOf$4;
9695
+ var assocIndexOf$3 = _assocIndexOf;
9696
+ var arrayProto = Array.prototype;
9697
+ var splice = arrayProto.splice;
9698
+ function listCacheDelete$1(key) {
9699
+ var data = this.__data__, index2 = assocIndexOf$3(data, key);
9700
+ if (index2 < 0) {
9701
+ return false;
9702
+ }
9703
+ var lastIndex = data.length - 1;
9704
+ if (index2 == lastIndex) {
9705
+ data.pop();
9706
+ } else {
9707
+ splice.call(data, index2, 1);
9708
+ }
9709
+ --this.size;
9710
+ return true;
9711
+ }
9712
+ var _listCacheDelete = listCacheDelete$1;
9713
+ var assocIndexOf$2 = _assocIndexOf;
9714
+ function listCacheGet$1(key) {
9715
+ var data = this.__data__, index2 = assocIndexOf$2(data, key);
9716
+ return index2 < 0 ? void 0 : data[index2][1];
9717
+ }
9718
+ var _listCacheGet = listCacheGet$1;
9719
+ var assocIndexOf$1 = _assocIndexOf;
9720
+ function listCacheHas$1(key) {
9721
+ return assocIndexOf$1(this.__data__, key) > -1;
9722
+ }
9723
+ var _listCacheHas = listCacheHas$1;
9724
+ var assocIndexOf = _assocIndexOf;
9725
+ function listCacheSet$1(key, value) {
9726
+ var data = this.__data__, index2 = assocIndexOf(data, key);
9727
+ if (index2 < 0) {
9728
+ ++this.size;
9729
+ data.push([key, value]);
9730
+ } else {
9731
+ data[index2][1] = value;
9732
+ }
9733
+ return this;
9734
+ }
9735
+ var _listCacheSet = listCacheSet$1;
9736
+ var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
9737
+ function ListCache$1(entries) {
9738
+ var index2 = -1, length2 = entries == null ? 0 : entries.length;
9739
+ this.clear();
9740
+ while (++index2 < length2) {
9741
+ var entry = entries[index2];
9742
+ this.set(entry[0], entry[1]);
9743
+ }
9744
+ }
9745
+ ListCache$1.prototype.clear = listCacheClear;
9746
+ ListCache$1.prototype["delete"] = listCacheDelete;
9747
+ ListCache$1.prototype.get = listCacheGet;
9748
+ ListCache$1.prototype.has = listCacheHas;
9749
+ ListCache$1.prototype.set = listCacheSet;
9750
+ var _ListCache = ListCache$1;
9751
+ var getNative$1 = _getNative, root$5 = _root;
9752
+ var Map$4 = getNative$1(root$5, "Map");
9753
+ var _Map = Map$4;
9754
+ var Hash = _Hash, ListCache = _ListCache, Map$3 = _Map;
9755
+ function mapCacheClear$1() {
9756
+ this.size = 0;
9757
+ this.__data__ = {
9758
+ "hash": new Hash(),
9759
+ "map": new (Map$3 || ListCache)(),
9760
+ "string": new Hash()
9761
+ };
9762
+ }
9763
+ var _mapCacheClear = mapCacheClear$1;
9764
+ function isKeyable$1(value) {
9765
+ var type2 = typeof value;
9766
+ return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9767
+ }
9768
+ var _isKeyable = isKeyable$1;
9769
+ var isKeyable = _isKeyable;
9770
+ function getMapData$4(map2, key) {
9771
+ var data = map2.__data__;
9772
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9773
+ }
9774
+ var _getMapData = getMapData$4;
9775
+ var getMapData$3 = _getMapData;
9776
+ function mapCacheDelete$1(key) {
9777
+ var result = getMapData$3(this, key)["delete"](key);
9778
+ this.size -= result ? 1 : 0;
9779
+ return result;
9780
+ }
9781
+ var _mapCacheDelete = mapCacheDelete$1;
9782
+ var getMapData$2 = _getMapData;
9783
+ function mapCacheGet$1(key) {
9784
+ return getMapData$2(this, key).get(key);
9785
+ }
9786
+ var _mapCacheGet = mapCacheGet$1;
9787
+ var getMapData$1 = _getMapData;
9788
+ function mapCacheHas$1(key) {
9789
+ return getMapData$1(this, key).has(key);
9790
+ }
9791
+ var _mapCacheHas = mapCacheHas$1;
9792
+ var getMapData = _getMapData;
9793
+ function mapCacheSet$1(key, value) {
9794
+ var data = getMapData(this, key), size = data.size;
9795
+ data.set(key, value);
9796
+ this.size += data.size == size ? 0 : 1;
9797
+ return this;
9798
+ }
9799
+ var _mapCacheSet = mapCacheSet$1;
9800
+ var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
9801
+ function MapCache$1(entries) {
9802
+ var index2 = -1, length2 = entries == null ? 0 : entries.length;
9803
+ this.clear();
9804
+ while (++index2 < length2) {
9805
+ var entry = entries[index2];
9806
+ this.set(entry[0], entry[1]);
9807
+ }
9808
+ }
9809
+ MapCache$1.prototype.clear = mapCacheClear;
9810
+ MapCache$1.prototype["delete"] = mapCacheDelete;
9811
+ MapCache$1.prototype.get = mapCacheGet;
9812
+ MapCache$1.prototype.has = mapCacheHas;
9813
+ MapCache$1.prototype.set = mapCacheSet;
9814
+ var _MapCache = MapCache$1;
9815
+ var MapCache = _MapCache;
9816
+ var FUNC_ERROR_TEXT$1 = "Expected a function";
9817
+ function memoize(func, resolver) {
9818
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
9819
+ throw new TypeError(FUNC_ERROR_TEXT$1);
9820
+ }
9821
+ var memoized = function() {
9822
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
9823
+ if (cache.has(key)) {
9824
+ return cache.get(key);
9825
+ }
9826
+ var result = func.apply(this, args);
9827
+ memoized.cache = cache.set(key, result) || cache;
9828
+ return result;
9829
+ };
9830
+ memoized.cache = new (memoize.Cache || MapCache)();
9831
+ return memoized;
9832
+ }
9833
+ memoize.Cache = MapCache;
9834
+ var memoize_1 = memoize;
9835
+ var memoize$1 = memoize_1;
9836
+ var MEASUREMENT_ELEMENT_ID = "__react_svg_text_measurement_id";
9837
+ function getStringWidth(str, style2) {
9838
+ try {
9839
+ var textEl = document.getElementById(MEASUREMENT_ELEMENT_ID);
9840
+ if (!textEl) {
9841
+ var svg2 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
9842
+ svg2.setAttribute("aria-hidden", "true");
9843
+ svg2.style.width = "0";
9844
+ svg2.style.height = "0";
9845
+ svg2.style.position = "absolute";
9846
+ svg2.style.top = "-100%";
9847
+ svg2.style.left = "-100%";
9848
+ textEl = document.createElementNS("http://www.w3.org/2000/svg", "text");
9849
+ textEl.setAttribute("id", MEASUREMENT_ELEMENT_ID);
9850
+ svg2.appendChild(textEl);
9851
+ document.body.appendChild(svg2);
9852
+ }
9853
+ Object.assign(textEl.style, style2);
9854
+ textEl.textContent = str;
9855
+ return textEl.getComputedTextLength();
9856
+ } catch (e3) {
9857
+ return null;
9858
+ }
9859
+ }
9860
+ var getStringWidth$1 = memoize$1(getStringWidth, function(str, style2) {
9861
+ return str + "_" + JSON.stringify(style2);
9862
+ });
9863
+ var _excluded$w = ["verticalAnchor", "scaleToFit", "angle", "width", "lineHeight", "capHeight", "children", "style"];
9864
+ function _objectWithoutPropertiesLoose$w(source, excluded) {
9865
+ if (source == null)
9866
+ return {};
9867
+ var target = {};
9868
+ var sourceKeys = Object.keys(source);
9869
+ var key, i2;
9870
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
9871
+ key = sourceKeys[i2];
9872
+ if (excluded.indexOf(key) >= 0)
9873
+ continue;
9874
+ target[key] = source[key];
10325
9875
  }
9876
+ return target;
10326
9877
  }
10327
- Hash$1.prototype.clear = hashClear;
10328
- Hash$1.prototype["delete"] = hashDelete;
10329
- Hash$1.prototype.get = hashGet;
10330
- Hash$1.prototype.has = hashHas;
10331
- Hash$1.prototype.set = hashSet;
10332
- var _Hash = Hash$1;
10333
- function listCacheClear$1() {
10334
- this.__data__ = [];
10335
- this.size = 0;
9878
+ function isNumber$2(val) {
9879
+ return typeof val === "number";
10336
9880
  }
10337
- var _listCacheClear = listCacheClear$1;
10338
- function eq$1(value, other) {
10339
- return value === other || value !== value && other !== other;
9881
+ function isXOrYInValid(xOrY) {
9882
+ return typeof xOrY === "number" && Number.isFinite(xOrY) || typeof xOrY === "string";
10340
9883
  }
10341
- var eq_1 = eq$1;
10342
- var eq = eq_1;
10343
- function assocIndexOf$4(array2, key) {
10344
- var length2 = array2.length;
10345
- while (length2--) {
10346
- if (eq(array2[length2][0], key)) {
10347
- return length2;
9884
+ function useText(props) {
9885
+ var _props$verticalAnchor = props.verticalAnchor, verticalAnchor = _props$verticalAnchor === void 0 ? "end" : _props$verticalAnchor, _props$scaleToFit = props.scaleToFit, scaleToFit = _props$scaleToFit === void 0 ? false : _props$scaleToFit, angle2 = props.angle, width = props.width, _props$lineHeight = props.lineHeight, lineHeight = _props$lineHeight === void 0 ? "1em" : _props$lineHeight, _props$capHeight = props.capHeight, capHeight = _props$capHeight === void 0 ? "0.71em" : _props$capHeight, children2 = props.children, style2 = props.style, textProps = _objectWithoutPropertiesLoose$w(props, _excluded$w);
9886
+ var _textProps$x = textProps.x, x2 = _textProps$x === void 0 ? 0 : _textProps$x, _textProps$y = textProps.y, y2 = _textProps$y === void 0 ? 0 : _textProps$y;
9887
+ var isXOrYNotValid = !isXOrYInValid(x2) || !isXOrYInValid(y2);
9888
+ var _useMemo = useMemo(function() {
9889
+ var words = children2 == null ? [] : children2.toString().split(/(?:(?!\u00A0+)\s+)/);
9890
+ return {
9891
+ wordsWithWidth: words.map(function(word) {
9892
+ return {
9893
+ word,
9894
+ wordWidth: getStringWidth$1(word, style2) || 0
9895
+ };
9896
+ }),
9897
+ spaceWidth: getStringWidth$1("\xA0", style2) || 0
9898
+ };
9899
+ }, [children2, style2]), wordsWithWidth = _useMemo.wordsWithWidth, spaceWidth = _useMemo.spaceWidth;
9900
+ var wordsByLines = useMemo(function() {
9901
+ if (isXOrYNotValid) {
9902
+ return [];
10348
9903
  }
10349
- }
10350
- return -1;
9904
+ if (width || scaleToFit) {
9905
+ return wordsWithWidth.reduce(function(result, _ref) {
9906
+ var word = _ref.word, wordWidth = _ref.wordWidth;
9907
+ var currentLine = result[result.length - 1];
9908
+ if (currentLine && (width == null || scaleToFit || (currentLine.width || 0) + wordWidth + spaceWidth < width)) {
9909
+ currentLine.words.push(word);
9910
+ currentLine.width = currentLine.width || 0;
9911
+ currentLine.width += wordWidth + spaceWidth;
9912
+ } else {
9913
+ var newLine = {
9914
+ words: [word],
9915
+ width: wordWidth
9916
+ };
9917
+ result.push(newLine);
9918
+ }
9919
+ return result;
9920
+ }, []);
9921
+ }
9922
+ return [{
9923
+ words: children2 == null ? [] : children2.toString().split(/(?:(?!\u00A0+)\s+)/)
9924
+ }];
9925
+ }, [isXOrYNotValid, width, scaleToFit, children2, wordsWithWidth, spaceWidth]);
9926
+ var startDy = useMemo(function() {
9927
+ var startDyStr = isXOrYNotValid ? "" : verticalAnchor === "start" ? reduceCSSCalc$1("calc(" + capHeight + ")") : verticalAnchor === "middle" ? reduceCSSCalc$1("calc(" + (wordsByLines.length - 1) / 2 + " * -" + lineHeight + " + (" + capHeight + " / 2))") : reduceCSSCalc$1("calc(" + (wordsByLines.length - 1) + " * -" + lineHeight + ")");
9928
+ return startDyStr;
9929
+ }, [isXOrYNotValid, verticalAnchor, capHeight, wordsByLines.length, lineHeight]);
9930
+ var transform2 = useMemo(function() {
9931
+ var transforms = [];
9932
+ if (isXOrYNotValid) {
9933
+ return "";
9934
+ }
9935
+ if (isNumber$2(x2) && isNumber$2(y2) && isNumber$2(width) && scaleToFit && wordsByLines.length > 0) {
9936
+ var lineWidth = wordsByLines[0].width || 1;
9937
+ var sx = scaleToFit === "shrink-only" ? Math.min(width / lineWidth, 1) : width / lineWidth;
9938
+ var sy = sx;
9939
+ var originX = x2 - sx * x2;
9940
+ var originY = y2 - sy * y2;
9941
+ transforms.push("matrix(" + sx + ", 0, 0, " + sy + ", " + originX + ", " + originY + ")");
9942
+ }
9943
+ if (angle2) {
9944
+ transforms.push("rotate(" + angle2 + ", " + x2 + ", " + y2 + ")");
9945
+ }
9946
+ return transforms.length > 0 ? transforms.join(" ") : "";
9947
+ }, [isXOrYNotValid, x2, y2, width, scaleToFit, wordsByLines, angle2]);
9948
+ return {
9949
+ wordsByLines,
9950
+ startDy,
9951
+ transform: transform2
9952
+ };
10351
9953
  }
10352
- var _assocIndexOf = assocIndexOf$4;
10353
- var assocIndexOf$3 = _assocIndexOf;
10354
- var arrayProto = Array.prototype;
10355
- var splice = arrayProto.splice;
10356
- function listCacheDelete$1(key) {
10357
- var data = this.__data__, index2 = assocIndexOf$3(data, key);
10358
- if (index2 < 0) {
10359
- return false;
10360
- }
10361
- var lastIndex = data.length - 1;
10362
- if (index2 == lastIndex) {
10363
- data.pop();
10364
- } else {
10365
- splice.call(data, index2, 1);
10366
- }
10367
- --this.size;
10368
- return true;
9954
+ var _excluded$v = ["dx", "dy", "textAnchor", "innerRef", "innerTextRef", "verticalAnchor", "angle", "lineHeight", "scaleToFit", "capHeight", "width"];
9955
+ function _extends$M() {
9956
+ _extends$M = Object.assign ? Object.assign.bind() : function(target) {
9957
+ for (var i2 = 1; i2 < arguments.length; i2++) {
9958
+ var source = arguments[i2];
9959
+ for (var key in source) {
9960
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
9961
+ target[key] = source[key];
9962
+ }
9963
+ }
9964
+ }
9965
+ return target;
9966
+ };
9967
+ return _extends$M.apply(this, arguments);
10369
9968
  }
10370
- var _listCacheDelete = listCacheDelete$1;
10371
- var assocIndexOf$2 = _assocIndexOf;
10372
- function listCacheGet$1(key) {
10373
- var data = this.__data__, index2 = assocIndexOf$2(data, key);
10374
- return index2 < 0 ? void 0 : data[index2][1];
9969
+ function _objectWithoutPropertiesLoose$v(source, excluded) {
9970
+ if (source == null)
9971
+ return {};
9972
+ var target = {};
9973
+ var sourceKeys = Object.keys(source);
9974
+ var key, i2;
9975
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
9976
+ key = sourceKeys[i2];
9977
+ if (excluded.indexOf(key) >= 0)
9978
+ continue;
9979
+ target[key] = source[key];
9980
+ }
9981
+ return target;
10375
9982
  }
10376
- var _listCacheGet = listCacheGet$1;
10377
- var assocIndexOf$1 = _assocIndexOf;
10378
- function listCacheHas$1(key) {
10379
- return assocIndexOf$1(this.__data__, key) > -1;
9983
+ var SVG_STYLE = {
9984
+ overflow: "visible"
9985
+ };
9986
+ function Text(props) {
9987
+ var _props$dx = props.dx, dx = _props$dx === void 0 ? 0 : _props$dx, _props$dy = props.dy, dy = _props$dy === void 0 ? 0 : _props$dy, _props$textAnchor = props.textAnchor, textAnchor = _props$textAnchor === void 0 ? "start" : _props$textAnchor, innerRef = props.innerRef, innerTextRef = props.innerTextRef;
9988
+ props.verticalAnchor;
9989
+ props.angle;
9990
+ var _props$lineHeight = props.lineHeight, lineHeight = _props$lineHeight === void 0 ? "1em" : _props$lineHeight;
9991
+ props.scaleToFit;
9992
+ props.capHeight;
9993
+ props.width;
9994
+ var textProps = _objectWithoutPropertiesLoose$v(props, _excluded$v);
9995
+ var _textProps$x = textProps.x, x2 = _textProps$x === void 0 ? 0 : _textProps$x, fontSize = textProps.fontSize;
9996
+ var _useText = useText(props), wordsByLines = _useText.wordsByLines, startDy = _useText.startDy, transform2 = _useText.transform;
9997
+ return /* @__PURE__ */ React__default.createElement("svg", {
9998
+ ref: innerRef,
9999
+ x: dx,
10000
+ y: dy,
10001
+ fontSize,
10002
+ style: SVG_STYLE
10003
+ }, wordsByLines.length > 0 ? /* @__PURE__ */ React__default.createElement("text", _extends$M({
10004
+ ref: innerTextRef,
10005
+ transform: transform2
10006
+ }, textProps, {
10007
+ textAnchor
10008
+ }), wordsByLines.map(function(line2, index2) {
10009
+ return /* @__PURE__ */ React__default.createElement("tspan", {
10010
+ key: index2,
10011
+ x: x2,
10012
+ dy: index2 === 0 ? startDy : lineHeight
10013
+ }, line2.words.join(" "));
10014
+ })) : null);
10380
10015
  }
10381
- var _listCacheHas = listCacheHas$1;
10382
- var assocIndexOf = _assocIndexOf;
10383
- function listCacheSet$1(key, value) {
10384
- var data = this.__data__, index2 = assocIndexOf(data, key);
10385
- if (index2 < 0) {
10386
- ++this.size;
10387
- data.push([key, value]);
10016
+ var esm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10017
+ __proto__: null,
10018
+ Text,
10019
+ getStringWidth: getStringWidth$1,
10020
+ useText
10021
+ }, Symbol.toStringTag, { value: "Module" }));
10022
+ var Orientation$1 = {
10023
+ top: "top",
10024
+ left: "left",
10025
+ right: "right",
10026
+ bottom: "bottom"
10027
+ };
10028
+ var Orientation$2 = Orientation$1;
10029
+ function getLabelTransform$2(_ref) {
10030
+ var labelOffset = _ref.labelOffset, labelProps = _ref.labelProps, orientation2 = _ref.orientation, range2 = _ref.range, tickLabelFontSize = _ref.tickLabelFontSize, tickLength = _ref.tickLength;
10031
+ var sign2 = orientation2 === Orientation$2.left || orientation2 === Orientation$2.top ? -1 : 1;
10032
+ var x2;
10033
+ var y2;
10034
+ var transform2;
10035
+ if (orientation2 === Orientation$2.top || orientation2 === Orientation$2.bottom) {
10036
+ var yBottomOffset = orientation2 === Orientation$2.bottom && typeof labelProps.fontSize === "number" ? labelProps.fontSize : 0;
10037
+ x2 = (Number(range2[0]) + Number(range2[range2.length - 1])) / 2;
10038
+ y2 = sign2 * (tickLength + labelOffset + tickLabelFontSize + yBottomOffset);
10388
10039
  } else {
10389
- data[index2][1] = value;
10390
- }
10391
- return this;
10392
- }
10393
- var _listCacheSet = listCacheSet$1;
10394
- var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
10395
- function ListCache$1(entries) {
10396
- var index2 = -1, length2 = entries == null ? 0 : entries.length;
10397
- this.clear();
10398
- while (++index2 < length2) {
10399
- var entry = entries[index2];
10400
- this.set(entry[0], entry[1]);
10040
+ x2 = sign2 * ((Number(range2[0]) + Number(range2[range2.length - 1])) / 2);
10041
+ y2 = -(tickLength + labelOffset);
10042
+ transform2 = "rotate(" + sign2 * 90 + ")";
10401
10043
  }
10402
- }
10403
- ListCache$1.prototype.clear = listCacheClear;
10404
- ListCache$1.prototype["delete"] = listCacheDelete;
10405
- ListCache$1.prototype.get = listCacheGet;
10406
- ListCache$1.prototype.has = listCacheHas;
10407
- ListCache$1.prototype.set = listCacheSet;
10408
- var _ListCache = ListCache$1;
10409
- var getNative$1 = _getNative, root$5 = _root;
10410
- var Map$4 = getNative$1(root$5, "Map");
10411
- var _Map = Map$4;
10412
- var Hash = _Hash, ListCache = _ListCache, Map$3 = _Map;
10413
- function mapCacheClear$1() {
10414
- this.size = 0;
10415
- this.__data__ = {
10416
- "hash": new Hash(),
10417
- "map": new (Map$3 || ListCache)(),
10418
- "string": new Hash()
10044
+ return {
10045
+ x: x2,
10046
+ y: y2,
10047
+ transform: transform2
10419
10048
  };
10420
10049
  }
10421
- var _mapCacheClear = mapCacheClear$1;
10422
- function isKeyable$1(value) {
10423
- var type2 = typeof value;
10424
- return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
10425
- }
10426
- var _isKeyable = isKeyable$1;
10427
- var isKeyable = _isKeyable;
10428
- function getMapData$4(map2, key) {
10429
- var data = map2.__data__;
10430
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
10050
+ function _extends$L() {
10051
+ _extends$L = Object.assign ? Object.assign.bind() : function(target) {
10052
+ for (var i2 = 1; i2 < arguments.length; i2++) {
10053
+ var source = arguments[i2];
10054
+ for (var key in source) {
10055
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10056
+ target[key] = source[key];
10057
+ }
10058
+ }
10059
+ }
10060
+ return target;
10061
+ };
10062
+ return _extends$L.apply(this, arguments);
10431
10063
  }
10432
- var _getMapData = getMapData$4;
10433
- var getMapData$3 = _getMapData;
10434
- function mapCacheDelete$1(key) {
10435
- var result = getMapData$3(this, key)["delete"](key);
10436
- this.size -= result ? 1 : 0;
10437
- return result;
10064
+ function Ticks$2(_ref) {
10065
+ var hideTicks = _ref.hideTicks, horizontal = _ref.horizontal, orientation2 = _ref.orientation, tickClassName = _ref.tickClassName, tickComponent = _ref.tickComponent, allTickLabelProps = _ref.tickLabelProps, _ref$tickStroke = _ref.tickStroke, tickStroke = _ref$tickStroke === void 0 ? "#222" : _ref$tickStroke, tickTransform = _ref.tickTransform, ticks2 = _ref.ticks, strokeWidth = _ref.strokeWidth, tickLineProps = _ref.tickLineProps;
10066
+ return ticks2.map(function(_ref2) {
10067
+ var _allTickLabelProps$in;
10068
+ var value = _ref2.value, index2 = _ref2.index, from = _ref2.from, to = _ref2.to, formattedValue = _ref2.formattedValue;
10069
+ var tickLabelProps = (_allTickLabelProps$in = allTickLabelProps[index2]) != null ? _allTickLabelProps$in : {};
10070
+ var tickLabelFontSize = Math.max(10, typeof tickLabelProps.fontSize === "number" && tickLabelProps.fontSize || 0);
10071
+ var tickYCoord = to.y + (horizontal && orientation2 !== Orientation$2.top ? tickLabelFontSize : 0);
10072
+ return /* @__PURE__ */ React__default.createElement(Group, {
10073
+ key: "visx-tick-" + value + "-" + index2,
10074
+ className: cx("visx-axis-tick", tickClassName),
10075
+ transform: tickTransform
10076
+ }, !hideTicks && /* @__PURE__ */ React__default.createElement(Line$2, _extends$L({
10077
+ from,
10078
+ to,
10079
+ stroke: tickStroke,
10080
+ strokeWidth,
10081
+ strokeLinecap: "square"
10082
+ }, tickLineProps)), tickComponent ? tickComponent(_extends$L({}, tickLabelProps, {
10083
+ x: to.x,
10084
+ y: tickYCoord,
10085
+ formattedValue
10086
+ })) : /* @__PURE__ */ React__default.createElement(Text, _extends$L({
10087
+ x: to.x,
10088
+ y: tickYCoord
10089
+ }, tickLabelProps), formattedValue));
10090
+ });
10438
10091
  }
10439
- var _mapCacheDelete = mapCacheDelete$1;
10440
- var getMapData$2 = _getMapData;
10441
- function mapCacheGet$1(key) {
10442
- return getMapData$2(this, key).get(key);
10092
+ function _extends$K() {
10093
+ _extends$K = Object.assign ? Object.assign.bind() : function(target) {
10094
+ for (var i2 = 1; i2 < arguments.length; i2++) {
10095
+ var source = arguments[i2];
10096
+ for (var key in source) {
10097
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10098
+ target[key] = source[key];
10099
+ }
10100
+ }
10101
+ }
10102
+ return target;
10103
+ };
10104
+ return _extends$K.apply(this, arguments);
10443
10105
  }
10444
- var _mapCacheGet = mapCacheGet$1;
10445
- var getMapData$1 = _getMapData;
10446
- function mapCacheHas$1(key) {
10447
- return getMapData$1(this, key).has(key);
10106
+ var defaultTextProps$1 = {
10107
+ textAnchor: "middle",
10108
+ fontFamily: "Arial",
10109
+ fontSize: 10,
10110
+ fill: "#222"
10111
+ };
10112
+ function AxisRenderer$2(_ref) {
10113
+ var axisFromPoint = _ref.axisFromPoint, axisLineClassName = _ref.axisLineClassName, axisToPoint = _ref.axisToPoint, hideAxisLine = _ref.hideAxisLine, hideTicks = _ref.hideTicks, horizontal = _ref.horizontal, _ref$label = _ref.label, label = _ref$label === void 0 ? "" : _ref$label, labelClassName = _ref.labelClassName, _ref$labelOffset = _ref.labelOffset, labelOffset = _ref$labelOffset === void 0 ? 14 : _ref$labelOffset, _ref$labelProps = _ref.labelProps, labelProps = _ref$labelProps === void 0 ? defaultTextProps$1 : _ref$labelProps, _ref$orientation = _ref.orientation, orientation2 = _ref$orientation === void 0 ? Orientation$2.bottom : _ref$orientation, scale = _ref.scale, _ref$stroke = _ref.stroke, stroke = _ref$stroke === void 0 ? "#222" : _ref$stroke, strokeDasharray = _ref.strokeDasharray, _ref$strokeWidth = _ref.strokeWidth, strokeWidth = _ref$strokeWidth === void 0 ? 1 : _ref$strokeWidth, tickClassName = _ref.tickClassName, tickComponent = _ref.tickComponent, tickLineProps = _ref.tickLineProps, tickLabelProps = _ref.tickLabelProps, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, _ref$tickStroke = _ref.tickStroke, tickStroke = _ref$tickStroke === void 0 ? "#222" : _ref$tickStroke, tickTransform = _ref.tickTransform, ticks2 = _ref.ticks, _ref$ticksComponent = _ref.ticksComponent, ticksComponent = _ref$ticksComponent === void 0 ? Ticks$2 : _ref$ticksComponent;
10114
+ var tickLabelPropsDefault = _extends$K({}, defaultTextProps$1, typeof tickLabelProps === "object" ? tickLabelProps : null);
10115
+ var allTickLabelProps = ticks2.map(function(_ref2) {
10116
+ var value = _ref2.value, index2 = _ref2.index;
10117
+ return typeof tickLabelProps === "function" ? tickLabelProps(value, index2, ticks2) : tickLabelPropsDefault;
10118
+ });
10119
+ var maxTickLabelFontSize = Math.max.apply(Math, [10].concat(allTickLabelProps.map(function(props) {
10120
+ return typeof props.fontSize === "number" ? props.fontSize : 0;
10121
+ })));
10122
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, ticksComponent({
10123
+ hideTicks,
10124
+ horizontal,
10125
+ orientation: orientation2,
10126
+ scale,
10127
+ tickClassName,
10128
+ tickComponent,
10129
+ tickLabelProps: allTickLabelProps,
10130
+ tickStroke,
10131
+ tickTransform,
10132
+ ticks: ticks2,
10133
+ strokeWidth,
10134
+ tickLineProps
10135
+ }), !hideAxisLine && /* @__PURE__ */ React__default.createElement(Line$2, {
10136
+ className: cx("visx-axis-line", axisLineClassName),
10137
+ from: axisFromPoint,
10138
+ to: axisToPoint,
10139
+ stroke,
10140
+ strokeWidth,
10141
+ strokeDasharray
10142
+ }), label && /* @__PURE__ */ React__default.createElement(Text, _extends$K({
10143
+ className: cx("visx-axis-label", labelClassName)
10144
+ }, getLabelTransform$2({
10145
+ labelOffset,
10146
+ labelProps,
10147
+ orientation: orientation2,
10148
+ range: scale.range(),
10149
+ tickLabelFontSize: maxTickLabelFontSize,
10150
+ tickLength
10151
+ }), labelProps), label));
10448
10152
  }
10449
- var _mapCacheHas = mapCacheHas$1;
10450
- var getMapData = _getMapData;
10451
- function mapCacheSet$1(key, value) {
10452
- var data = getMapData(this, key), size = data.size;
10453
- data.set(key, value);
10454
- this.size += data.size == size ? 0 : 1;
10455
- return this;
10153
+ function getTickPosition$2(scale, align2) {
10154
+ if (align2 === void 0) {
10155
+ align2 = "center";
10156
+ }
10157
+ var s2 = scale;
10158
+ if (align2 !== "start" && "bandwidth" in s2) {
10159
+ var offset = s2.bandwidth();
10160
+ if (align2 === "center")
10161
+ offset /= 2;
10162
+ if (s2.round())
10163
+ offset = Math.round(offset);
10164
+ return function(d2) {
10165
+ var scaledValue = s2(d2);
10166
+ return typeof scaledValue === "number" ? scaledValue + offset : scaledValue;
10167
+ };
10168
+ }
10169
+ return scale;
10456
10170
  }
10457
- var _mapCacheSet = mapCacheSet$1;
10458
- var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
10459
- function MapCache$1(entries) {
10460
- var index2 = -1, length2 = entries == null ? 0 : entries.length;
10461
- this.clear();
10462
- while (++index2 < length2) {
10463
- var entry = entries[index2];
10464
- this.set(entry[0], entry[1]);
10171
+ function getTickFormatter$2(scale) {
10172
+ var s2 = scale;
10173
+ if ("tickFormat" in s2) {
10174
+ return s2.tickFormat();
10465
10175
  }
10176
+ return toString;
10466
10177
  }
10467
- MapCache$1.prototype.clear = mapCacheClear;
10468
- MapCache$1.prototype["delete"] = mapCacheDelete;
10469
- MapCache$1.prototype.get = mapCacheGet;
10470
- MapCache$1.prototype.has = mapCacheHas;
10471
- MapCache$1.prototype.set = mapCacheSet;
10472
- var _MapCache = MapCache$1;
10473
- var MapCache = _MapCache;
10474
- var FUNC_ERROR_TEXT$1 = "Expected a function";
10475
- function memoize(func, resolver) {
10476
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
10477
- throw new TypeError(FUNC_ERROR_TEXT$1);
10178
+ var Point = /* @__PURE__ */ function() {
10179
+ function Point2(_ref) {
10180
+ var _ref$x = _ref.x, x2 = _ref$x === void 0 ? 0 : _ref$x, _ref$y = _ref.y, y2 = _ref$y === void 0 ? 0 : _ref$y;
10181
+ this.x = 0;
10182
+ this.y = 0;
10183
+ this.x = x2;
10184
+ this.y = y2;
10478
10185
  }
10479
- var memoized = function() {
10480
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
10481
- if (cache.has(key)) {
10482
- return cache.get(key);
10483
- }
10484
- var result = func.apply(this, args);
10485
- memoized.cache = cache.set(key, result) || cache;
10486
- return result;
10186
+ var _proto = Point2.prototype;
10187
+ _proto.value = function value() {
10188
+ return {
10189
+ x: this.x,
10190
+ y: this.y
10191
+ };
10487
10192
  };
10488
- memoized.cache = new (memoize.Cache || MapCache)();
10489
- return memoized;
10193
+ _proto.toArray = function toArray() {
10194
+ return [this.x, this.y];
10195
+ };
10196
+ return Point2;
10197
+ }();
10198
+ function sumPoints(point1, point2) {
10199
+ return new Point({
10200
+ x: point1.x + point2.x,
10201
+ y: point1.y + point2.y
10202
+ });
10490
10203
  }
10491
- memoize.Cache = MapCache;
10492
- var memoize_1 = memoize;
10493
- var memoize$1 = memoize_1;
10494
- var MEASUREMENT_ELEMENT_ID = "__react_svg_text_measurement_id";
10495
- function getStringWidth(str, style2) {
10496
- try {
10497
- var textEl = document.getElementById(MEASUREMENT_ELEMENT_ID);
10498
- if (!textEl) {
10499
- var svg2 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
10500
- svg2.setAttribute("aria-hidden", "true");
10501
- svg2.style.width = "0";
10502
- svg2.style.height = "0";
10503
- svg2.style.position = "absolute";
10504
- svg2.style.top = "-100%";
10505
- svg2.style.left = "-100%";
10506
- textEl = document.createElementNS("http://www.w3.org/2000/svg", "text");
10507
- textEl.setAttribute("id", MEASUREMENT_ELEMENT_ID);
10508
- svg2.appendChild(textEl);
10509
- document.body.appendChild(svg2);
10204
+ function subtractPoints(point1, point2) {
10205
+ return new Point({
10206
+ x: point1.x - point2.x,
10207
+ y: point1.y - point2.y
10208
+ });
10209
+ }
10210
+ var esm$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10211
+ __proto__: null,
10212
+ Point,
10213
+ sumPoints,
10214
+ subtractPoints
10215
+ }, Symbol.toStringTag, { value: "Module" }));
10216
+ function createPoint$2(_ref, horizontal) {
10217
+ var x2 = _ref.x, y2 = _ref.y;
10218
+ return new Point(horizontal ? {
10219
+ x: x2,
10220
+ y: y2
10221
+ } : {
10222
+ x: y2,
10223
+ y: x2
10224
+ });
10225
+ }
10226
+ function _extends$J() {
10227
+ _extends$J = Object.assign ? Object.assign.bind() : function(target) {
10228
+ for (var i2 = 1; i2 < arguments.length; i2++) {
10229
+ var source = arguments[i2];
10230
+ for (var key in source) {
10231
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10232
+ target[key] = source[key];
10233
+ }
10234
+ }
10510
10235
  }
10511
- Object.assign(textEl.style, style2);
10512
- textEl.textContent = str;
10513
- return textEl.getComputedTextLength();
10514
- } catch (e3) {
10515
- return null;
10236
+ return target;
10237
+ };
10238
+ return _extends$J.apply(this, arguments);
10239
+ }
10240
+ var defaultAxisRangePadding$1 = 0;
10241
+ function getAxisRangePaddingConfig$2(originalRangePadding) {
10242
+ if (originalRangePadding === void 0) {
10243
+ originalRangePadding = defaultAxisRangePadding$1;
10516
10244
  }
10245
+ return typeof originalRangePadding === "number" ? {
10246
+ start: originalRangePadding,
10247
+ end: originalRangePadding
10248
+ } : _extends$J({
10249
+ start: defaultAxisRangePadding$1,
10250
+ end: defaultAxisRangePadding$1
10251
+ }, originalRangePadding);
10517
10252
  }
10518
- var getStringWidth$1 = memoize$1(getStringWidth, function(str, style2) {
10519
- return str + "_" + JSON.stringify(style2);
10520
- });
10521
- var _excluded$s = ["verticalAnchor", "scaleToFit", "angle", "width", "lineHeight", "capHeight", "children", "style"];
10522
- function _objectWithoutPropertiesLoose$s(source, excluded) {
10253
+ var _excluded$u = ["children", "axisClassName", "hideAxisLine", "hideTicks", "hideZero", "left", "numTicks", "orientation", "rangePadding", "scale", "tickFormat", "tickLength", "tickValues", "top"];
10254
+ function _extends$I() {
10255
+ _extends$I = Object.assign ? Object.assign.bind() : function(target) {
10256
+ for (var i2 = 1; i2 < arguments.length; i2++) {
10257
+ var source = arguments[i2];
10258
+ for (var key in source) {
10259
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10260
+ target[key] = source[key];
10261
+ }
10262
+ }
10263
+ }
10264
+ return target;
10265
+ };
10266
+ return _extends$I.apply(this, arguments);
10267
+ }
10268
+ function _objectWithoutPropertiesLoose$u(source, excluded) {
10523
10269
  if (source == null)
10524
10270
  return {};
10525
10271
  var target = {};
@@ -10533,83 +10279,72 @@ function _objectWithoutPropertiesLoose$s(source, excluded) {
10533
10279
  }
10534
10280
  return target;
10535
10281
  }
10536
- function isNumber$2(val) {
10537
- return typeof val === "number";
10538
- }
10539
- function isXOrYInValid(xOrY) {
10540
- return typeof xOrY === "number" && Number.isFinite(xOrY) || typeof xOrY === "string";
10541
- }
10542
- function useText(props) {
10543
- var _props$verticalAnchor = props.verticalAnchor, verticalAnchor = _props$verticalAnchor === void 0 ? "end" : _props$verticalAnchor, _props$scaleToFit = props.scaleToFit, scaleToFit = _props$scaleToFit === void 0 ? false : _props$scaleToFit, angle2 = props.angle, width = props.width, _props$lineHeight = props.lineHeight, lineHeight = _props$lineHeight === void 0 ? "1em" : _props$lineHeight, _props$capHeight = props.capHeight, capHeight = _props$capHeight === void 0 ? "0.71em" : _props$capHeight, children2 = props.children, style2 = props.style, textProps = _objectWithoutPropertiesLoose$s(props, _excluded$s);
10544
- var _textProps$x = textProps.x, x2 = _textProps$x === void 0 ? 0 : _textProps$x, _textProps$y = textProps.y, y2 = _textProps$y === void 0 ? 0 : _textProps$y;
10545
- var isXOrYNotValid = !isXOrYInValid(x2) || !isXOrYInValid(y2);
10546
- var _useMemo = useMemo(function() {
10547
- var words = children2 == null ? [] : children2.toString().split(/(?:(?!\u00A0+)\s+)/);
10282
+ function Axis$2(_ref) {
10283
+ var _ref$children = _ref.children, children2 = _ref$children === void 0 ? AxisRenderer$2 : _ref$children, axisClassName = _ref.axisClassName, _ref$hideAxisLine = _ref.hideAxisLine, hideAxisLine = _ref$hideAxisLine === void 0 ? false : _ref$hideAxisLine, _ref$hideTicks = _ref.hideTicks, hideTicks = _ref$hideTicks === void 0 ? false : _ref$hideTicks, _ref$hideZero = _ref.hideZero, hideZero = _ref$hideZero === void 0 ? false : _ref$hideZero, _ref$left = _ref.left, left2 = _ref$left === void 0 ? 0 : _ref$left, _ref$numTicks = _ref.numTicks, numTicks = _ref$numTicks === void 0 ? 10 : _ref$numTicks, _ref$orientation = _ref.orientation, orientation2 = _ref$orientation === void 0 ? Orientation$2.bottom : _ref$orientation, _ref$rangePadding = _ref.rangePadding, rangePadding = _ref$rangePadding === void 0 ? 0 : _ref$rangePadding, scale = _ref.scale, tickFormat2 = _ref.tickFormat, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, tickValues = _ref.tickValues, _ref$top = _ref.top, top2 = _ref$top === void 0 ? 0 : _ref$top, restProps = _objectWithoutPropertiesLoose$u(_ref, _excluded$u);
10284
+ var format2 = tickFormat2 != null ? tickFormat2 : getTickFormatter$2(scale);
10285
+ var isLeft = orientation2 === Orientation$2.left;
10286
+ var isTop = orientation2 === Orientation$2.top;
10287
+ var horizontal = isTop || orientation2 === Orientation$2.bottom;
10288
+ var tickPosition = getTickPosition$2(scale);
10289
+ var tickSign = isLeft || isTop ? -1 : 1;
10290
+ var range2 = scale.range();
10291
+ var rangePaddingConfig = getAxisRangePaddingConfig$2(rangePadding);
10292
+ var axisFromPoint = createPoint$2({
10293
+ x: Number(range2[0]) + 0.5 - rangePaddingConfig.start,
10294
+ y: 0
10295
+ }, horizontal);
10296
+ var axisToPoint = createPoint$2({
10297
+ x: Number(range2[range2.length - 1]) + 0.5 + rangePaddingConfig.end,
10298
+ y: 0
10299
+ }, horizontal);
10300
+ var filteredTickValues = (tickValues != null ? tickValues : getTicks(scale, numTicks)).filter(function(value) {
10301
+ return !hideZero || value !== 0 && value !== "0";
10302
+ }).map(function(value, index2) {
10548
10303
  return {
10549
- wordsWithWidth: words.map(function(word) {
10550
- return {
10551
- word,
10552
- wordWidth: getStringWidth$1(word, style2) || 0
10553
- };
10554
- }),
10555
- spaceWidth: getStringWidth$1("\xA0", style2) || 0
10304
+ value,
10305
+ index: index2
10556
10306
  };
10557
- }, [children2, style2]), wordsWithWidth = _useMemo.wordsWithWidth, spaceWidth = _useMemo.spaceWidth;
10558
- var wordsByLines = useMemo(function() {
10559
- if (isXOrYNotValid) {
10560
- return [];
10561
- }
10562
- if (width || scaleToFit) {
10563
- return wordsWithWidth.reduce(function(result, _ref) {
10564
- var word = _ref.word, wordWidth = _ref.wordWidth;
10565
- var currentLine = result[result.length - 1];
10566
- if (currentLine && (width == null || scaleToFit || (currentLine.width || 0) + wordWidth + spaceWidth < width)) {
10567
- currentLine.words.push(word);
10568
- currentLine.width = currentLine.width || 0;
10569
- currentLine.width += wordWidth + spaceWidth;
10570
- } else {
10571
- var newLine = {
10572
- words: [word],
10573
- width: wordWidth
10574
- };
10575
- result.push(newLine);
10576
- }
10577
- return result;
10578
- }, []);
10579
- }
10580
- return [{
10581
- words: children2 == null ? [] : children2.toString().split(/(?:(?!\u00A0+)\s+)/)
10582
- }];
10583
- }, [isXOrYNotValid, width, scaleToFit, children2, wordsWithWidth, spaceWidth]);
10584
- var startDy = useMemo(function() {
10585
- var startDyStr = isXOrYNotValid ? "" : verticalAnchor === "start" ? reduceCSSCalc$1("calc(" + capHeight + ")") : verticalAnchor === "middle" ? reduceCSSCalc$1("calc(" + (wordsByLines.length - 1) / 2 + " * -" + lineHeight + " + (" + capHeight + " / 2))") : reduceCSSCalc$1("calc(" + (wordsByLines.length - 1) + " * -" + lineHeight + ")");
10586
- return startDyStr;
10587
- }, [isXOrYNotValid, verticalAnchor, capHeight, wordsByLines.length, lineHeight]);
10588
- var transform2 = useMemo(function() {
10589
- var transforms = [];
10590
- if (isXOrYNotValid) {
10591
- return "";
10592
- }
10593
- if (isNumber$2(x2) && isNumber$2(y2) && isNumber$2(width) && scaleToFit && wordsByLines.length > 0) {
10594
- var lineWidth = wordsByLines[0].width || 1;
10595
- var sx = scaleToFit === "shrink-only" ? Math.min(width / lineWidth, 1) : width / lineWidth;
10596
- var sy = sx;
10597
- var originX = x2 - sx * x2;
10598
- var originY = y2 - sy * y2;
10599
- transforms.push("matrix(" + sx + ", 0, 0, " + sy + ", " + originX + ", " + originY + ")");
10600
- }
10601
- if (angle2) {
10602
- transforms.push("rotate(" + angle2 + ", " + x2 + ", " + y2 + ")");
10603
- }
10604
- return transforms.length > 0 ? transforms.join(" ") : "";
10605
- }, [isXOrYNotValid, x2, y2, width, scaleToFit, wordsByLines, angle2]);
10606
- return {
10607
- wordsByLines,
10608
- startDy,
10609
- transform: transform2
10610
- };
10307
+ });
10308
+ var ticks2 = filteredTickValues.map(function(_ref2) {
10309
+ var value = _ref2.value, index2 = _ref2.index;
10310
+ var scaledValue = coerceNumber(tickPosition(value));
10311
+ return {
10312
+ value,
10313
+ index: index2,
10314
+ from: createPoint$2({
10315
+ x: scaledValue,
10316
+ y: 0
10317
+ }, horizontal),
10318
+ to: createPoint$2({
10319
+ x: scaledValue,
10320
+ y: tickLength * tickSign
10321
+ }, horizontal),
10322
+ formattedValue: format2(value, index2, filteredTickValues)
10323
+ };
10324
+ });
10325
+ return /* @__PURE__ */ React__default.createElement(Group, {
10326
+ className: cx("visx-axis", axisClassName),
10327
+ top: top2,
10328
+ left: left2
10329
+ }, children2(_extends$I({}, restProps, {
10330
+ axisFromPoint,
10331
+ axisToPoint,
10332
+ hideAxisLine,
10333
+ hideTicks,
10334
+ hideZero,
10335
+ horizontal,
10336
+ numTicks,
10337
+ orientation: orientation2,
10338
+ rangePadding,
10339
+ scale,
10340
+ tickFormat: format2,
10341
+ tickLength,
10342
+ tickPosition,
10343
+ tickSign,
10344
+ ticks: ticks2
10345
+ })));
10611
10346
  }
10612
- var _excluded$r = ["dx", "dy", "textAnchor", "innerRef", "innerTextRef", "verticalAnchor", "angle", "lineHeight", "scaleToFit", "capHeight", "width"];
10347
+ var _excluded$t = ["axisClassName", "labelOffset", "tickLength", "tickLabelProps"];
10613
10348
  function _extends$H() {
10614
10349
  _extends$H = Object.assign ? Object.assign.bind() : function(target) {
10615
10350
  for (var i2 = 1; i2 < arguments.length; i2++) {
@@ -10624,7 +10359,7 @@ function _extends$H() {
10624
10359
  };
10625
10360
  return _extends$H.apply(this, arguments);
10626
10361
  }
10627
- function _objectWithoutPropertiesLoose$r(source, excluded) {
10362
+ function _objectWithoutPropertiesLoose$t(source, excluded) {
10628
10363
  if (source == null)
10629
10364
  return {};
10630
10365
  var target = {};
@@ -10632,79 +10367,32 @@ function _objectWithoutPropertiesLoose$r(source, excluded) {
10632
10367
  var key, i2;
10633
10368
  for (i2 = 0; i2 < sourceKeys.length; i2++) {
10634
10369
  key = sourceKeys[i2];
10635
- if (excluded.indexOf(key) >= 0)
10636
- continue;
10637
- target[key] = source[key];
10638
- }
10639
- return target;
10640
- }
10641
- var SVG_STYLE = {
10642
- overflow: "visible"
10643
- };
10644
- function Text(props) {
10645
- var _props$dx = props.dx, dx = _props$dx === void 0 ? 0 : _props$dx, _props$dy = props.dy, dy = _props$dy === void 0 ? 0 : _props$dy, _props$textAnchor = props.textAnchor, textAnchor = _props$textAnchor === void 0 ? "start" : _props$textAnchor, innerRef = props.innerRef, innerTextRef = props.innerTextRef;
10646
- props.verticalAnchor;
10647
- props.angle;
10648
- var _props$lineHeight = props.lineHeight, lineHeight = _props$lineHeight === void 0 ? "1em" : _props$lineHeight;
10649
- props.scaleToFit;
10650
- props.capHeight;
10651
- props.width;
10652
- var textProps = _objectWithoutPropertiesLoose$r(props, _excluded$r);
10653
- var _textProps$x = textProps.x, x2 = _textProps$x === void 0 ? 0 : _textProps$x, fontSize = textProps.fontSize;
10654
- var _useText = useText(props), wordsByLines = _useText.wordsByLines, startDy = _useText.startDy, transform2 = _useText.transform;
10655
- return /* @__PURE__ */ React__default.createElement("svg", {
10656
- ref: innerRef,
10657
- x: dx,
10658
- y: dy,
10659
- fontSize,
10660
- style: SVG_STYLE
10661
- }, wordsByLines.length > 0 ? /* @__PURE__ */ React__default.createElement("text", _extends$H({
10662
- ref: innerTextRef,
10663
- transform: transform2
10664
- }, textProps, {
10665
- textAnchor
10666
- }), wordsByLines.map(function(line2, index2) {
10667
- return /* @__PURE__ */ React__default.createElement("tspan", {
10668
- key: index2,
10669
- x: x2,
10670
- dy: index2 === 0 ? startDy : lineHeight
10671
- }, line2.words.join(" "));
10672
- })) : null);
10673
- }
10674
- var esm$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10675
- __proto__: null,
10676
- Text,
10677
- getStringWidth: getStringWidth$1,
10678
- useText
10679
- }, Symbol.toStringTag, { value: "Module" }));
10680
- var Orientation$1 = {
10681
- top: "top",
10682
- left: "left",
10683
- right: "right",
10684
- bottom: "bottom"
10685
- };
10686
- var Orientation$2 = Orientation$1;
10687
- function getLabelTransform$2(_ref) {
10688
- var labelOffset = _ref.labelOffset, labelProps = _ref.labelProps, orientation2 = _ref.orientation, range2 = _ref.range, tickLabelFontSize = _ref.tickLabelFontSize, tickLength = _ref.tickLength;
10689
- var sign2 = orientation2 === Orientation$2.left || orientation2 === Orientation$2.top ? -1 : 1;
10690
- var x2;
10691
- var y2;
10692
- var transform2;
10693
- if (orientation2 === Orientation$2.top || orientation2 === Orientation$2.bottom) {
10694
- var yBottomOffset = orientation2 === Orientation$2.bottom && typeof labelProps.fontSize === "number" ? labelProps.fontSize : 0;
10695
- x2 = (Number(range2[0]) + Number(range2[range2.length - 1])) / 2;
10696
- y2 = sign2 * (tickLength + labelOffset + tickLabelFontSize + yBottomOffset);
10697
- } else {
10698
- x2 = sign2 * ((Number(range2[0]) + Number(range2[range2.length - 1])) / 2);
10699
- y2 = -(tickLength + labelOffset);
10700
- transform2 = "rotate(" + sign2 * 90 + ")";
10701
- }
10702
- return {
10703
- x: x2,
10704
- y: y2,
10705
- transform: transform2
10706
- };
10370
+ if (excluded.indexOf(key) >= 0)
10371
+ continue;
10372
+ target[key] = source[key];
10373
+ }
10374
+ return target;
10375
+ }
10376
+ var leftTickLabelProps$1 = {
10377
+ dx: "-0.25em",
10378
+ dy: "0.25em",
10379
+ fill: "#222",
10380
+ fontFamily: "Arial",
10381
+ fontSize: 10,
10382
+ textAnchor: "end"
10383
+ };
10384
+ function AxisLeft$2(_ref) {
10385
+ var axisClassName = _ref.axisClassName, _ref$labelOffset = _ref.labelOffset, labelOffset = _ref$labelOffset === void 0 ? 36 : _ref$labelOffset, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, tickLabelProps = _ref.tickLabelProps, restProps = _objectWithoutPropertiesLoose$t(_ref, _excluded$t);
10386
+ var tickLabelPropsFinal = typeof tickLabelProps === "function" ? tickLabelProps : _extends$H({}, leftTickLabelProps$1, tickLabelProps);
10387
+ return /* @__PURE__ */ React__default.createElement(Axis$2, _extends$H({
10388
+ axisClassName: cx("visx-axis-left", axisClassName),
10389
+ labelOffset,
10390
+ orientation: Orientation$2.left,
10391
+ tickLabelProps: tickLabelPropsFinal,
10392
+ tickLength
10393
+ }, restProps));
10707
10394
  }
10395
+ var _excluded$s = ["axisClassName", "labelOffset", "tickLength", "tickLabelProps"];
10708
10396
  function _extends$G() {
10709
10397
  _extends$G = Object.assign ? Object.assign.bind() : function(target) {
10710
10398
  for (var i2 = 1; i2 < arguments.length; i2++) {
@@ -10719,33 +10407,120 @@ function _extends$G() {
10719
10407
  };
10720
10408
  return _extends$G.apply(this, arguments);
10721
10409
  }
10722
- function Ticks$2(_ref) {
10723
- var hideTicks = _ref.hideTicks, horizontal = _ref.horizontal, orientation2 = _ref.orientation, tickClassName = _ref.tickClassName, tickComponent = _ref.tickComponent, allTickLabelProps = _ref.tickLabelProps, _ref$tickStroke = _ref.tickStroke, tickStroke = _ref$tickStroke === void 0 ? "#222" : _ref$tickStroke, tickTransform = _ref.tickTransform, ticks2 = _ref.ticks, strokeWidth = _ref.strokeWidth, tickLineProps = _ref.tickLineProps;
10724
- return ticks2.map(function(_ref2) {
10725
- var _allTickLabelProps$in;
10726
- var value = _ref2.value, index2 = _ref2.index, from = _ref2.from, to = _ref2.to, formattedValue = _ref2.formattedValue;
10727
- var tickLabelProps = (_allTickLabelProps$in = allTickLabelProps[index2]) != null ? _allTickLabelProps$in : {};
10728
- var tickLabelFontSize = Math.max(10, typeof tickLabelProps.fontSize === "number" && tickLabelProps.fontSize || 0);
10729
- var tickYCoord = to.y + (horizontal && orientation2 !== Orientation$2.top ? tickLabelFontSize : 0);
10730
- return /* @__PURE__ */ React__default.createElement(Group, {
10731
- key: "visx-tick-" + value + "-" + index2,
10732
- className: cx("visx-axis-tick", tickClassName),
10733
- transform: tickTransform
10734
- }, !hideTicks && /* @__PURE__ */ React__default.createElement(Line$2, _extends$G({
10735
- from,
10736
- to,
10737
- stroke: tickStroke,
10738
- strokeWidth,
10739
- strokeLinecap: "square"
10740
- }, tickLineProps)), tickComponent ? tickComponent(_extends$G({}, tickLabelProps, {
10741
- x: to.x,
10742
- y: tickYCoord,
10743
- formattedValue
10744
- })) : /* @__PURE__ */ React__default.createElement(Text, _extends$G({
10745
- x: to.x,
10746
- y: tickYCoord
10747
- }, tickLabelProps), formattedValue));
10410
+ function _objectWithoutPropertiesLoose$s(source, excluded) {
10411
+ if (source == null)
10412
+ return {};
10413
+ var target = {};
10414
+ var sourceKeys = Object.keys(source);
10415
+ var key, i2;
10416
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
10417
+ key = sourceKeys[i2];
10418
+ if (excluded.indexOf(key) >= 0)
10419
+ continue;
10420
+ target[key] = source[key];
10421
+ }
10422
+ return target;
10423
+ }
10424
+ var bottomTickLabelProps$1 = {
10425
+ dy: "0.25em",
10426
+ fill: "#222",
10427
+ fontFamily: "Arial",
10428
+ fontSize: 10,
10429
+ textAnchor: "middle"
10430
+ };
10431
+ function AxisBottom$2(_ref) {
10432
+ var axisClassName = _ref.axisClassName, _ref$labelOffset = _ref.labelOffset, labelOffset = _ref$labelOffset === void 0 ? 8 : _ref$labelOffset, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, tickLabelProps = _ref.tickLabelProps, restProps = _objectWithoutPropertiesLoose$s(_ref, _excluded$s);
10433
+ var tickLabelPropsFinal = typeof tickLabelProps === "function" ? tickLabelProps : _extends$G({}, bottomTickLabelProps$1, tickLabelProps);
10434
+ return /* @__PURE__ */ React__default.createElement(Axis$2, _extends$G({
10435
+ axisClassName: cx("visx-axis-bottom", axisClassName),
10436
+ labelOffset,
10437
+ orientation: Orientation$2.bottom,
10438
+ tickLabelProps: tickLabelPropsFinal,
10439
+ tickLength
10440
+ }, restProps));
10441
+ }
10442
+ const LeftAxis = ({
10443
+ value,
10444
+ yScale,
10445
+ parentWidth
10446
+ }) => {
10447
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r;
10448
+ return /* @__PURE__ */ jsx(AxisLeft$2, {
10449
+ numTicks: (_a2 = value.main) == null ? void 0 : _a2.numTicks,
10450
+ scale: yScale,
10451
+ top: 0,
10452
+ label: (_b2 = value.main) == null ? void 0 : _b2.leftLabel,
10453
+ tickStroke: (_d = (_c2 = value.style) == null ? void 0 : _c2.labelStyle) == null ? void 0 : _d.tickColor,
10454
+ strokeWidth: (_f = (_e2 = value.style) == null ? void 0 : _e2.labelStyle) == null ? void 0 : _f.rightAxisWidth,
10455
+ hideTicks: (_g = value.main) == null ? void 0 : _g.hideLeftTicks,
10456
+ labelOffset: (_i = (_h = value.style) == null ? void 0 : _h.labelStyle) == null ? void 0 : _i.leftLabelOffset,
10457
+ labelProps: {
10458
+ fill: (_k = (_j = value.style) == null ? void 0 : _j.labelStyle) == null ? void 0 : _k.labelColor,
10459
+ fontSize: (_m = (_l = value.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.fontSize,
10460
+ fontWeight: (_o = (_n2 = value.style) == null ? void 0 : _n2.labelStyle) == null ? void 0 : _o.fontWeight,
10461
+ fontFamily: (_q = (_p = value.style) == null ? void 0 : _p.labelStyle) == null ? void 0 : _q.fontWeight
10462
+ },
10463
+ hideAxisLine: (_r = value.main) == null ? void 0 : _r.hideLeftAxisLine,
10464
+ tickLabelProps: (e3) => {
10465
+ var _a3, _b3;
10466
+ return {
10467
+ fill: (_b3 = (_a3 = value.style) == null ? void 0 : _a3.labelStyle) == null ? void 0 : _b3.tickLabelColor,
10468
+ fontSize: 11,
10469
+ textAnchor: "end",
10470
+ dy: "0.33em"
10471
+ };
10472
+ }
10473
+ });
10474
+ };
10475
+ const BottomAxis = ({
10476
+ data,
10477
+ yMax,
10478
+ value,
10479
+ xScale,
10480
+ parentWidth
10481
+ }) => {
10482
+ var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s;
10483
+ return /* @__PURE__ */ jsx(AxisBottom$2, {
10484
+ numTicks: data.length,
10485
+ top: yMax,
10486
+ hideTicks: (_a2 = value.main) == null ? void 0 : _a2.hideTicks,
10487
+ hideAxisLine: (_b2 = value.main) == null ? void 0 : _b2.hideBottomAxisLine,
10488
+ strokeWidth: (_d = (_c2 = value.style) == null ? void 0 : _c2.labelStyle) == null ? void 0 : _d.bottomAxisWidth,
10489
+ scale: xScale,
10490
+ stroke: (_f = (_e2 = value.style) == null ? void 0 : _e2.labelStyle) == null ? void 0 : _f.tickColor,
10491
+ labelOffset: (_h = (_g = value.style) == null ? void 0 : _g.labelStyle) == null ? void 0 : _h.bottomLabelOffset,
10492
+ label: (_i = value.main) == null ? void 0 : _i.bottomLabel,
10493
+ labelProps: {
10494
+ fill: (_k = (_j = value.style) == null ? void 0 : _j.labelStyle) == null ? void 0 : _k.labelColor,
10495
+ fontSize: (_m = (_l = value.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.fontSize,
10496
+ fontWeight: (_o = (_n2 = value.style) == null ? void 0 : _n2.labelStyle) == null ? void 0 : _o.fontWeight,
10497
+ fontFamily: (_q = (_p = value.style) == null ? void 0 : _p.labelStyle) == null ? void 0 : _q.fontWeight
10498
+ },
10499
+ tickStroke: (_s = (_r = value.style) == null ? void 0 : _r.labelStyle) == null ? void 0 : _s.tickColor,
10500
+ tickLabelProps: () => {
10501
+ var _a3, _b3, _c3, _d2;
10502
+ return {
10503
+ fill: (_b3 = (_a3 = value.style) == null ? void 0 : _a3.labelStyle) == null ? void 0 : _b3.tickLabelColor,
10504
+ fontSize: ((_d2 = (_c3 = value.style) == null ? void 0 : _c3.labelStyle) == null ? void 0 : _d2.tickFontSize) || 11,
10505
+ textAnchor: "middle"
10506
+ };
10507
+ }
10748
10508
  });
10509
+ };
10510
+ var _excluded$r = ["tooltipOpen"];
10511
+ function _objectWithoutPropertiesLoose$r(source, excluded) {
10512
+ if (source == null)
10513
+ return {};
10514
+ var target = {};
10515
+ var sourceKeys = Object.keys(source);
10516
+ var key, i2;
10517
+ for (i2 = 0; i2 < sourceKeys.length; i2++) {
10518
+ key = sourceKeys[i2];
10519
+ if (excluded.indexOf(key) >= 0)
10520
+ continue;
10521
+ target[key] = source[key];
10522
+ }
10523
+ return target;
10749
10524
  }
10750
10525
  function _extends$F() {
10751
10526
  _extends$F = Object.assign ? Object.assign.bind() : function(target) {
@@ -10761,125 +10536,41 @@ function _extends$F() {
10761
10536
  };
10762
10537
  return _extends$F.apply(this, arguments);
10763
10538
  }
10764
- var defaultTextProps$1 = {
10765
- textAnchor: "middle",
10766
- fontFamily: "Arial",
10767
- fontSize: 10,
10768
- fill: "#222"
10769
- };
10770
- function AxisRenderer$2(_ref) {
10771
- var axisFromPoint = _ref.axisFromPoint, axisLineClassName = _ref.axisLineClassName, axisToPoint = _ref.axisToPoint, hideAxisLine = _ref.hideAxisLine, hideTicks = _ref.hideTicks, horizontal = _ref.horizontal, _ref$label = _ref.label, label = _ref$label === void 0 ? "" : _ref$label, labelClassName = _ref.labelClassName, _ref$labelOffset = _ref.labelOffset, labelOffset = _ref$labelOffset === void 0 ? 14 : _ref$labelOffset, _ref$labelProps = _ref.labelProps, labelProps = _ref$labelProps === void 0 ? defaultTextProps$1 : _ref$labelProps, _ref$orientation = _ref.orientation, orientation2 = _ref$orientation === void 0 ? Orientation$2.bottom : _ref$orientation, scale = _ref.scale, _ref$stroke = _ref.stroke, stroke = _ref$stroke === void 0 ? "#222" : _ref$stroke, strokeDasharray = _ref.strokeDasharray, _ref$strokeWidth = _ref.strokeWidth, strokeWidth = _ref$strokeWidth === void 0 ? 1 : _ref$strokeWidth, tickClassName = _ref.tickClassName, tickComponent = _ref.tickComponent, tickLineProps = _ref.tickLineProps, tickLabelProps = _ref.tickLabelProps, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, _ref$tickStroke = _ref.tickStroke, tickStroke = _ref$tickStroke === void 0 ? "#222" : _ref$tickStroke, tickTransform = _ref.tickTransform, ticks2 = _ref.ticks, _ref$ticksComponent = _ref.ticksComponent, ticksComponent = _ref$ticksComponent === void 0 ? Ticks$2 : _ref$ticksComponent;
10772
- var tickLabelPropsDefault = _extends$F({}, defaultTextProps$1, typeof tickLabelProps === "object" ? tickLabelProps : null);
10773
- var allTickLabelProps = ticks2.map(function(_ref2) {
10774
- var value = _ref2.value, index2 = _ref2.index;
10775
- return typeof tickLabelProps === "function" ? tickLabelProps(value, index2, ticks2) : tickLabelPropsDefault;
10776
- });
10777
- var maxTickLabelFontSize = Math.max.apply(Math, [10].concat(allTickLabelProps.map(function(props) {
10778
- return typeof props.fontSize === "number" ? props.fontSize : 0;
10779
- })));
10780
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, ticksComponent({
10781
- hideTicks,
10782
- horizontal,
10783
- orientation: orientation2,
10784
- scale,
10785
- tickClassName,
10786
- tickComponent,
10787
- tickLabelProps: allTickLabelProps,
10788
- tickStroke,
10789
- tickTransform,
10790
- ticks: ticks2,
10791
- strokeWidth,
10792
- tickLineProps
10793
- }), !hideAxisLine && /* @__PURE__ */ React__default.createElement(Line$2, {
10794
- className: cx("visx-axis-line", axisLineClassName),
10795
- from: axisFromPoint,
10796
- to: axisToPoint,
10797
- stroke,
10798
- strokeWidth,
10799
- strokeDasharray
10800
- }), label && /* @__PURE__ */ React__default.createElement(Text, _extends$F({
10801
- className: cx("visx-axis-label", labelClassName)
10802
- }, getLabelTransform$2({
10803
- labelOffset,
10804
- labelProps,
10805
- orientation: orientation2,
10806
- range: scale.range(),
10807
- tickLabelFontSize: maxTickLabelFontSize,
10808
- tickLength
10809
- }), labelProps), label));
10810
- }
10811
- function getTickPosition$2(scale, align2) {
10812
- if (align2 === void 0) {
10813
- align2 = "center";
10814
- }
10815
- var s2 = scale;
10816
- if (align2 !== "start" && "bandwidth" in s2) {
10817
- var offset = s2.bandwidth();
10818
- if (align2 === "center")
10819
- offset /= 2;
10820
- if (s2.round())
10821
- offset = Math.round(offset);
10822
- return function(d2) {
10823
- var scaledValue = s2(d2);
10824
- return typeof scaledValue === "number" ? scaledValue + offset : scaledValue;
10825
- };
10826
- }
10827
- return scale;
10828
- }
10829
- function getTickFormatter$2(scale) {
10830
- var s2 = scale;
10831
- if ("tickFormat" in s2) {
10832
- return s2.tickFormat();
10833
- }
10834
- return toString;
10835
- }
10836
- var Point = /* @__PURE__ */ function() {
10837
- function Point2(_ref) {
10838
- var _ref$x = _ref.x, x2 = _ref$x === void 0 ? 0 : _ref$x, _ref$y = _ref.y, y2 = _ref$y === void 0 ? 0 : _ref$y;
10839
- this.x = 0;
10840
- this.y = 0;
10841
- this.x = x2;
10842
- this.y = y2;
10843
- }
10844
- var _proto = Point2.prototype;
10845
- _proto.value = function value() {
10846
- return {
10847
- x: this.x,
10848
- y: this.y
10849
- };
10850
- };
10851
- _proto.toArray = function toArray() {
10852
- return [this.x, this.y];
10539
+ function useTooltip(initialTooltipState) {
10540
+ var _useState = useState(_extends$F({
10541
+ tooltipOpen: false
10542
+ }, initialTooltipState)), tooltipState = _useState[0], setTooltipState = _useState[1];
10543
+ var showTooltip = useCallback(function(showArgs) {
10544
+ return setTooltipState(typeof showArgs === "function" ? function(_ref) {
10545
+ _ref.tooltipOpen;
10546
+ var show = _objectWithoutPropertiesLoose$r(_ref, _excluded$r);
10547
+ return _extends$F({}, showArgs(show), {
10548
+ tooltipOpen: true
10549
+ });
10550
+ } : {
10551
+ tooltipOpen: true,
10552
+ tooltipLeft: showArgs.tooltipLeft,
10553
+ tooltipTop: showArgs.tooltipTop,
10554
+ tooltipData: showArgs.tooltipData
10555
+ });
10556
+ }, [setTooltipState]);
10557
+ var hideTooltip = useCallback(function() {
10558
+ return setTooltipState({
10559
+ tooltipOpen: false,
10560
+ tooltipLeft: void 0,
10561
+ tooltipTop: void 0,
10562
+ tooltipData: void 0
10563
+ });
10564
+ }, [setTooltipState]);
10565
+ return {
10566
+ tooltipOpen: tooltipState.tooltipOpen,
10567
+ tooltipLeft: tooltipState.tooltipLeft,
10568
+ tooltipTop: tooltipState.tooltipTop,
10569
+ tooltipData: tooltipState.tooltipData,
10570
+ updateTooltip: setTooltipState,
10571
+ showTooltip,
10572
+ hideTooltip
10853
10573
  };
10854
- return Point2;
10855
- }();
10856
- function sumPoints(point1, point2) {
10857
- return new Point({
10858
- x: point1.x + point2.x,
10859
- y: point1.y + point2.y
10860
- });
10861
- }
10862
- function subtractPoints(point1, point2) {
10863
- return new Point({
10864
- x: point1.x - point2.x,
10865
- y: point1.y - point2.y
10866
- });
10867
- }
10868
- var esm$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10869
- __proto__: null,
10870
- Point,
10871
- sumPoints,
10872
- subtractPoints
10873
- }, Symbol.toStringTag, { value: "Module" }));
10874
- function createPoint$2(_ref, horizontal) {
10875
- var x2 = _ref.x, y2 = _ref.y;
10876
- return new Point(horizontal ? {
10877
- x: x2,
10878
- y: y2
10879
- } : {
10880
- x: y2,
10881
- y: x2
10882
- });
10883
10574
  }
10884
10575
  function _extends$E() {
10885
10576
  _extends$E = Object.assign ? Object.assign.bind() : function(target) {
@@ -10893,22 +10584,264 @@ function _extends$E() {
10893
10584
  }
10894
10585
  return target;
10895
10586
  };
10896
- return _extends$E.apply(this, arguments);
10587
+ return _extends$E.apply(this, arguments);
10588
+ }
10589
+ function withTooltip(BaseComponent, containerProps, renderContainer) {
10590
+ if (containerProps === void 0) {
10591
+ containerProps = {
10592
+ style: {
10593
+ position: "relative",
10594
+ width: "inherit",
10595
+ height: "inherit"
10596
+ }
10597
+ };
10598
+ }
10599
+ if (renderContainer === void 0) {
10600
+ renderContainer = function renderContainer2(children2, props) {
10601
+ return /* @__PURE__ */ React__default.createElement("div", props, children2);
10602
+ };
10603
+ }
10604
+ var WrappedComponent = function WrappedComponent2(props) {
10605
+ var tooltipProps = useTooltip();
10606
+ return renderContainer(/* @__PURE__ */ React__default.createElement(BaseComponent, _extends$E({}, tooltipProps, props)), containerProps);
10607
+ };
10608
+ return WrappedComponent;
10609
+ }
10610
+ function debounce$2(func, wait, immediate) {
10611
+ var timeout2, args, context, timestamp, result;
10612
+ if (null == wait)
10613
+ wait = 100;
10614
+ function later() {
10615
+ var last2 = Date.now() - timestamp;
10616
+ if (last2 < wait && last2 >= 0) {
10617
+ timeout2 = setTimeout(later, wait - last2);
10618
+ } else {
10619
+ timeout2 = null;
10620
+ if (!immediate) {
10621
+ result = func.apply(context, args);
10622
+ context = args = null;
10623
+ }
10624
+ }
10625
+ }
10626
+ var debounced = function() {
10627
+ context = this;
10628
+ args = arguments;
10629
+ timestamp = Date.now();
10630
+ var callNow = immediate && !timeout2;
10631
+ if (!timeout2)
10632
+ timeout2 = setTimeout(later, wait);
10633
+ if (callNow) {
10634
+ result = func.apply(context, args);
10635
+ context = args = null;
10636
+ }
10637
+ return result;
10638
+ };
10639
+ debounced.clear = function() {
10640
+ if (timeout2) {
10641
+ clearTimeout(timeout2);
10642
+ timeout2 = null;
10643
+ }
10644
+ };
10645
+ debounced.flush = function() {
10646
+ if (timeout2) {
10647
+ result = func.apply(context, args);
10648
+ context = args = null;
10649
+ clearTimeout(timeout2);
10650
+ timeout2 = null;
10651
+ }
10652
+ };
10653
+ return debounced;
10654
+ }
10655
+ debounce$2.debounce = debounce$2;
10656
+ var debounce_1$1 = debounce$2;
10657
+ function useMeasure(_temp) {
10658
+ let {
10659
+ debounce: debounce2,
10660
+ scroll,
10661
+ polyfill,
10662
+ offsetSize
10663
+ } = _temp === void 0 ? {
10664
+ debounce: 0,
10665
+ scroll: false,
10666
+ offsetSize: false
10667
+ } : _temp;
10668
+ const ResizeObserver2 = polyfill || (typeof window === "undefined" ? class ResizeObserver {
10669
+ } : window.ResizeObserver);
10670
+ if (!ResizeObserver2) {
10671
+ throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");
10672
+ }
10673
+ const [bounds2, set2] = useState({
10674
+ left: 0,
10675
+ top: 0,
10676
+ width: 0,
10677
+ height: 0,
10678
+ bottom: 0,
10679
+ right: 0,
10680
+ x: 0,
10681
+ y: 0
10682
+ });
10683
+ const state = useRef({
10684
+ element: null,
10685
+ scrollContainers: null,
10686
+ resizeObserver: null,
10687
+ lastBounds: bounds2
10688
+ });
10689
+ const scrollDebounce = debounce2 ? typeof debounce2 === "number" ? debounce2 : debounce2.scroll : null;
10690
+ const resizeDebounce = debounce2 ? typeof debounce2 === "number" ? debounce2 : debounce2.resize : null;
10691
+ const mounted = useRef(false);
10692
+ useEffect(() => {
10693
+ mounted.current = true;
10694
+ return () => void (mounted.current = false);
10695
+ });
10696
+ const [forceRefresh, resizeChange, scrollChange] = useMemo(() => {
10697
+ const callback = () => {
10698
+ if (!state.current.element)
10699
+ return;
10700
+ const {
10701
+ left: left2,
10702
+ top: top2,
10703
+ width,
10704
+ height,
10705
+ bottom: bottom2,
10706
+ right: right2,
10707
+ x: x2,
10708
+ y: y2
10709
+ } = state.current.element.getBoundingClientRect();
10710
+ const size = {
10711
+ left: left2,
10712
+ top: top2,
10713
+ width,
10714
+ height,
10715
+ bottom: bottom2,
10716
+ right: right2,
10717
+ x: x2,
10718
+ y: y2
10719
+ };
10720
+ if (state.current.element instanceof HTMLElement && offsetSize) {
10721
+ size.height = state.current.element.offsetHeight;
10722
+ size.width = state.current.element.offsetWidth;
10723
+ }
10724
+ Object.freeze(size);
10725
+ if (mounted.current && !areBoundsEqual(state.current.lastBounds, size))
10726
+ set2(state.current.lastBounds = size);
10727
+ };
10728
+ return [callback, resizeDebounce ? debounce_1$1(callback, resizeDebounce) : callback, scrollDebounce ? debounce_1$1(callback, scrollDebounce) : callback];
10729
+ }, [set2, offsetSize, scrollDebounce, resizeDebounce]);
10730
+ function removeListeners() {
10731
+ if (state.current.scrollContainers) {
10732
+ state.current.scrollContainers.forEach((element) => element.removeEventListener("scroll", scrollChange, true));
10733
+ state.current.scrollContainers = null;
10734
+ }
10735
+ if (state.current.resizeObserver) {
10736
+ state.current.resizeObserver.disconnect();
10737
+ state.current.resizeObserver = null;
10738
+ }
10739
+ }
10740
+ function addListeners() {
10741
+ if (!state.current.element)
10742
+ return;
10743
+ state.current.resizeObserver = new ResizeObserver2(scrollChange);
10744
+ state.current.resizeObserver.observe(state.current.element);
10745
+ if (scroll && state.current.scrollContainers) {
10746
+ state.current.scrollContainers.forEach((scrollContainer) => scrollContainer.addEventListener("scroll", scrollChange, {
10747
+ capture: true,
10748
+ passive: true
10749
+ }));
10750
+ }
10751
+ }
10752
+ const ref = (node) => {
10753
+ if (!node || node === state.current.element)
10754
+ return;
10755
+ removeListeners();
10756
+ state.current.element = node;
10757
+ state.current.scrollContainers = findScrollContainers(node);
10758
+ addListeners();
10759
+ };
10760
+ useOnWindowScroll(scrollChange, Boolean(scroll));
10761
+ useOnWindowResize(resizeChange);
10762
+ useEffect(() => {
10763
+ removeListeners();
10764
+ addListeners();
10765
+ }, [scroll, scrollChange, resizeChange]);
10766
+ useEffect(() => removeListeners, []);
10767
+ return [ref, bounds2, forceRefresh];
10768
+ }
10769
+ function useOnWindowResize(onWindowResize) {
10770
+ useEffect(() => {
10771
+ const cb = onWindowResize;
10772
+ window.addEventListener("resize", cb);
10773
+ return () => void window.removeEventListener("resize", cb);
10774
+ }, [onWindowResize]);
10775
+ }
10776
+ function useOnWindowScroll(onScroll, enabled) {
10777
+ useEffect(() => {
10778
+ if (enabled) {
10779
+ const cb = onScroll;
10780
+ window.addEventListener("scroll", cb, {
10781
+ capture: true,
10782
+ passive: true
10783
+ });
10784
+ return () => void window.removeEventListener("scroll", cb, true);
10785
+ }
10786
+ }, [onScroll, enabled]);
10787
+ }
10788
+ function findScrollContainers(element) {
10789
+ const result = [];
10790
+ if (!element || element === document.body)
10791
+ return result;
10792
+ const {
10793
+ overflow,
10794
+ overflowX,
10795
+ overflowY
10796
+ } = window.getComputedStyle(element);
10797
+ if ([overflow, overflowX, overflowY].some((prop) => prop === "auto" || prop === "scroll"))
10798
+ result.push(element);
10799
+ return [...result, ...findScrollContainers(element.parentElement)];
10800
+ }
10801
+ const keys = ["x", "y", "top", "bottom", "left", "right", "width", "height"];
10802
+ const areBoundsEqual = (a2, b10) => keys.every((key) => a2[key] === b10[key]);
10803
+ function _inheritsLoose$1(subClass, superClass) {
10804
+ subClass.prototype = Object.create(superClass.prototype);
10805
+ subClass.prototype.constructor = subClass;
10806
+ _setPrototypeOf$1(subClass, superClass);
10807
+ }
10808
+ function _setPrototypeOf$1(o, p2) {
10809
+ _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
10810
+ o2.__proto__ = p3;
10811
+ return o2;
10812
+ };
10813
+ return _setPrototypeOf$1(o, p2);
10897
10814
  }
10898
- var defaultAxisRangePadding$1 = 0;
10899
- function getAxisRangePaddingConfig$2(originalRangePadding) {
10900
- if (originalRangePadding === void 0) {
10901
- originalRangePadding = defaultAxisRangePadding$1;
10815
+ var Portal = /* @__PURE__ */ function(_React$PureComponent) {
10816
+ _inheritsLoose$1(Portal2, _React$PureComponent);
10817
+ function Portal2() {
10818
+ return _React$PureComponent.apply(this, arguments) || this;
10902
10819
  }
10903
- return typeof originalRangePadding === "number" ? {
10904
- start: originalRangePadding,
10905
- end: originalRangePadding
10906
- } : _extends$E({
10907
- start: defaultAxisRangePadding$1,
10908
- end: defaultAxisRangePadding$1
10909
- }, originalRangePadding);
10910
- }
10911
- var _excluded$q = ["children", "axisClassName", "hideAxisLine", "hideTicks", "hideZero", "left", "numTicks", "orientation", "rangePadding", "scale", "tickFormat", "tickLength", "tickValues", "top"];
10820
+ var _proto = Portal2.prototype;
10821
+ _proto.componentWillUnmount = function componentWillUnmount() {
10822
+ if (this.node && document.body) {
10823
+ document.body.removeChild(this.node);
10824
+ delete this.node;
10825
+ }
10826
+ };
10827
+ _proto.render = function render2() {
10828
+ if (!this.node && typeof document !== "undefined") {
10829
+ this.node = document.createElement("div");
10830
+ if (this.props.zIndex != null)
10831
+ this.node.style.zIndex = "" + this.props.zIndex;
10832
+ document.body.append(this.node);
10833
+ }
10834
+ if (!this.node) {
10835
+ return null;
10836
+ }
10837
+ return /* @__PURE__ */ ReactDOM.createPortal(this.props.children, this.node);
10838
+ };
10839
+ return Portal2;
10840
+ }(React__default.PureComponent);
10841
+ Portal.propTypes = {
10842
+ zIndex: _pt.oneOfType([_pt.number, _pt.string])
10843
+ };
10844
+ var _excluded$q = ["className", "top", "left", "offsetLeft", "offsetTop", "style", "children", "unstyled", "applyPositionStyle"];
10912
10845
  function _extends$D() {
10913
10846
  _extends$D = Object.assign ? Object.assign.bind() : function(target) {
10914
10847
  for (var i2 = 1; i2 < arguments.length; i2++) {
@@ -10937,72 +10870,42 @@ function _objectWithoutPropertiesLoose$q(source, excluded) {
10937
10870
  }
10938
10871
  return target;
10939
10872
  }
10940
- function Axis$2(_ref) {
10941
- var _ref$children = _ref.children, children2 = _ref$children === void 0 ? AxisRenderer$2 : _ref$children, axisClassName = _ref.axisClassName, _ref$hideAxisLine = _ref.hideAxisLine, hideAxisLine = _ref$hideAxisLine === void 0 ? false : _ref$hideAxisLine, _ref$hideTicks = _ref.hideTicks, hideTicks = _ref$hideTicks === void 0 ? false : _ref$hideTicks, _ref$hideZero = _ref.hideZero, hideZero = _ref$hideZero === void 0 ? false : _ref$hideZero, _ref$left = _ref.left, left2 = _ref$left === void 0 ? 0 : _ref$left, _ref$numTicks = _ref.numTicks, numTicks = _ref$numTicks === void 0 ? 10 : _ref$numTicks, _ref$orientation = _ref.orientation, orientation2 = _ref$orientation === void 0 ? Orientation$2.bottom : _ref$orientation, _ref$rangePadding = _ref.rangePadding, rangePadding = _ref$rangePadding === void 0 ? 0 : _ref$rangePadding, scale = _ref.scale, tickFormat2 = _ref.tickFormat, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, tickValues = _ref.tickValues, _ref$top = _ref.top, top2 = _ref$top === void 0 ? 0 : _ref$top, restProps = _objectWithoutPropertiesLoose$q(_ref, _excluded$q);
10942
- var format2 = tickFormat2 != null ? tickFormat2 : getTickFormatter$2(scale);
10943
- var isLeft = orientation2 === Orientation$2.left;
10944
- var isTop = orientation2 === Orientation$2.top;
10945
- var horizontal = isTop || orientation2 === Orientation$2.bottom;
10946
- var tickPosition = getTickPosition$2(scale);
10947
- var tickSign = isLeft || isTop ? -1 : 1;
10948
- var range2 = scale.range();
10949
- var rangePaddingConfig = getAxisRangePaddingConfig$2(rangePadding);
10950
- var axisFromPoint = createPoint$2({
10951
- x: Number(range2[0]) + 0.5 - rangePaddingConfig.start,
10952
- y: 0
10953
- }, horizontal);
10954
- var axisToPoint = createPoint$2({
10955
- x: Number(range2[range2.length - 1]) + 0.5 + rangePaddingConfig.end,
10956
- y: 0
10957
- }, horizontal);
10958
- var filteredTickValues = (tickValues != null ? tickValues : getTicks(scale, numTicks)).filter(function(value) {
10959
- return !hideZero || value !== 0 && value !== "0";
10960
- }).map(function(value, index2) {
10961
- return {
10962
- value,
10963
- index: index2
10964
- };
10965
- });
10966
- var ticks2 = filteredTickValues.map(function(_ref2) {
10967
- var value = _ref2.value, index2 = _ref2.index;
10968
- var scaledValue = coerceNumber(tickPosition(value));
10969
- return {
10970
- value,
10971
- index: index2,
10972
- from: createPoint$2({
10973
- x: scaledValue,
10974
- y: 0
10975
- }, horizontal),
10976
- to: createPoint$2({
10977
- x: scaledValue,
10978
- y: tickLength * tickSign
10979
- }, horizontal),
10980
- formattedValue: format2(value, index2, filteredTickValues)
10981
- };
10982
- });
10983
- return /* @__PURE__ */ React__default.createElement(Group, {
10984
- className: cx("visx-axis", axisClassName),
10985
- top: top2,
10986
- left: left2
10987
- }, children2(_extends$D({}, restProps, {
10988
- axisFromPoint,
10989
- axisToPoint,
10990
- hideAxisLine,
10991
- hideTicks,
10992
- hideZero,
10993
- horizontal,
10994
- numTicks,
10995
- orientation: orientation2,
10996
- rangePadding,
10997
- scale,
10998
- tickFormat: format2,
10999
- tickLength,
11000
- tickPosition,
11001
- tickSign,
11002
- ticks: ticks2
11003
- })));
11004
- }
11005
- var _excluded$p = ["axisClassName", "labelOffset", "tickLength", "tickLabelProps"];
10873
+ var defaultStyles = {
10874
+ position: "absolute",
10875
+ backgroundColor: "white",
10876
+ color: "#666666",
10877
+ padding: ".3rem .5rem",
10878
+ borderRadius: "3px",
10879
+ fontSize: "14px",
10880
+ boxShadow: "0 1px 2px rgba(33,33,33,0.2)",
10881
+ lineHeight: "1em",
10882
+ pointerEvents: "none"
10883
+ };
10884
+ var Tooltip$1 = /* @__PURE__ */ React__default.forwardRef(function(_ref, ref) {
10885
+ var className = _ref.className, top2 = _ref.top, left2 = _ref.left, _ref$offsetLeft = _ref.offsetLeft, offsetLeft = _ref$offsetLeft === void 0 ? 10 : _ref$offsetLeft, _ref$offsetTop = _ref.offsetTop, offsetTop = _ref$offsetTop === void 0 ? 10 : _ref$offsetTop, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyles : _ref$style, children2 = _ref.children, _ref$unstyled = _ref.unstyled, unstyled = _ref$unstyled === void 0 ? false : _ref$unstyled, _ref$applyPositionSty = _ref.applyPositionStyle, applyPositionStyle = _ref$applyPositionSty === void 0 ? false : _ref$applyPositionSty, restProps = _objectWithoutPropertiesLoose$q(_ref, _excluded$q);
10886
+ return /* @__PURE__ */ React__default.createElement("div", _extends$D({
10887
+ ref,
10888
+ className: cx("visx-tooltip", className),
10889
+ style: _extends$D({
10890
+ top: top2 == null || offsetTop == null ? top2 : top2 + offsetTop,
10891
+ left: left2 == null || offsetLeft == null ? left2 : left2 + offsetLeft
10892
+ }, applyPositionStyle && {
10893
+ position: "absolute"
10894
+ }, !unstyled && style2)
10895
+ }, restProps), children2);
10896
+ });
10897
+ Tooltip$1.propTypes = {
10898
+ children: _pt.node,
10899
+ className: _pt.string,
10900
+ left: _pt.number,
10901
+ offsetLeft: _pt.number,
10902
+ offsetTop: _pt.number,
10903
+ top: _pt.number,
10904
+ applyPositionStyle: _pt.bool,
10905
+ unstyled: _pt.bool
10906
+ };
10907
+ Tooltip$1.displayName = "Tooltip";
10908
+ var Tooltip$2 = Tooltip$1;
11006
10909
  function _extends$C() {
11007
10910
  _extends$C = Object.assign ? Object.assign.bind() : function(target) {
11008
10911
  for (var i2 = 1; i2 < arguments.length; i2++) {
@@ -11017,6 +10920,97 @@ function _extends$C() {
11017
10920
  };
11018
10921
  return _extends$C.apply(this, arguments);
11019
10922
  }
10923
+ function _assertThisInitialized(self2) {
10924
+ if (self2 === void 0) {
10925
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
10926
+ }
10927
+ return self2;
10928
+ }
10929
+ function _inheritsLoose(subClass, superClass) {
10930
+ subClass.prototype = Object.create(superClass.prototype);
10931
+ subClass.prototype.constructor = subClass;
10932
+ _setPrototypeOf(subClass, superClass);
10933
+ }
10934
+ function _setPrototypeOf(o, p2) {
10935
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
10936
+ o2.__proto__ = p3;
10937
+ return o2;
10938
+ };
10939
+ return _setPrototypeOf(o, p2);
10940
+ }
10941
+ var emptyRect = {
10942
+ top: 0,
10943
+ right: 0,
10944
+ bottom: 0,
10945
+ left: 0,
10946
+ width: 0,
10947
+ height: 0
10948
+ };
10949
+ function withBoundingRects(BaseComponent) {
10950
+ var _class;
10951
+ return _class = /* @__PURE__ */ function(_React$PureComponent) {
10952
+ _inheritsLoose(WrappedComponent, _React$PureComponent);
10953
+ function WrappedComponent(props) {
10954
+ var _this;
10955
+ _this = _React$PureComponent.call(this, props) || this;
10956
+ _this.state = {
10957
+ rect: void 0,
10958
+ parentRect: void 0
10959
+ };
10960
+ _this.nodeRef = /* @__PURE__ */ React__default.createRef();
10961
+ _this.getRects = _this.getRects.bind(_assertThisInitialized(_this));
10962
+ return _this;
10963
+ }
10964
+ var _proto = WrappedComponent.prototype;
10965
+ _proto.componentDidMount = function componentDidMount() {
10966
+ var _this$nodeRef, _this2 = this;
10967
+ this.node = (_this$nodeRef = this.nodeRef) != null && _this$nodeRef.current ? this.nodeRef.current : ReactDOM.findDOMNode(this);
10968
+ this.setState(function() {
10969
+ return _this2.getRects();
10970
+ });
10971
+ };
10972
+ _proto.getRects = function getRects() {
10973
+ if (!this.node)
10974
+ return this.state;
10975
+ var node = this.node;
10976
+ var parentNode = node.parentNode;
10977
+ var rect = node.getBoundingClientRect ? node.getBoundingClientRect() : emptyRect;
10978
+ var parentRect = parentNode != null && parentNode.getBoundingClientRect ? parentNode.getBoundingClientRect() : emptyRect;
10979
+ return {
10980
+ rect,
10981
+ parentRect
10982
+ };
10983
+ };
10984
+ _proto.render = function render2() {
10985
+ return /* @__PURE__ */ React__default.createElement(BaseComponent, _extends$C({
10986
+ nodeRef: this.nodeRef,
10987
+ getRects: this.getRects
10988
+ }, this.state, this.props));
10989
+ };
10990
+ return WrappedComponent;
10991
+ }(React__default.PureComponent), _class.displayName = "withBoundingRects(" + (BaseComponent.displayName || "") + ")", _class;
10992
+ }
10993
+ var TooltipPositionContext = /* @__PURE__ */ createContext({
10994
+ isFlippedVertically: false,
10995
+ isFlippedHorizontally: false
10996
+ });
10997
+ var TooltipPositionProvider = TooltipPositionContext.Provider;
10998
+ TooltipPositionContext.Consumer;
10999
+ var _excluded$p = ["children", "getRects", "left", "offsetLeft", "offsetTop", "parentRect", "rect", "style", "top", "unstyled", "nodeRef"];
11000
+ function _extends$B() {
11001
+ _extends$B = Object.assign ? Object.assign.bind() : function(target) {
11002
+ for (var i2 = 1; i2 < arguments.length; i2++) {
11003
+ var source = arguments[i2];
11004
+ for (var key in source) {
11005
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
11006
+ target[key] = source[key];
11007
+ }
11008
+ }
11009
+ }
11010
+ return target;
11011
+ };
11012
+ return _extends$B.apply(this, arguments);
11013
+ }
11020
11014
  function _objectWithoutPropertiesLoose$p(source, excluded) {
11021
11015
  if (source == null)
11022
11016
  return {};
@@ -11029,42 +11023,59 @@ function _objectWithoutPropertiesLoose$p(source, excluded) {
11029
11023
  continue;
11030
11024
  target[key] = source[key];
11031
11025
  }
11032
- return target;
11033
- }
11034
- var leftTickLabelProps$1 = {
11035
- dx: "-0.25em",
11036
- dy: "0.25em",
11037
- fill: "#222",
11038
- fontFamily: "Arial",
11039
- fontSize: 10,
11040
- textAnchor: "end"
11041
- };
11042
- function AxisLeft$2(_ref) {
11043
- var axisClassName = _ref.axisClassName, _ref$labelOffset = _ref.labelOffset, labelOffset = _ref$labelOffset === void 0 ? 36 : _ref$labelOffset, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, tickLabelProps = _ref.tickLabelProps, restProps = _objectWithoutPropertiesLoose$p(_ref, _excluded$p);
11044
- var tickLabelPropsFinal = typeof tickLabelProps === "function" ? tickLabelProps : _extends$C({}, leftTickLabelProps$1, tickLabelProps);
11045
- return /* @__PURE__ */ React__default.createElement(Axis$2, _extends$C({
11046
- axisClassName: cx("visx-axis-left", axisClassName),
11047
- labelOffset,
11048
- orientation: Orientation$2.left,
11049
- tickLabelProps: tickLabelPropsFinal,
11050
- tickLength
11051
- }, restProps));
11026
+ return target;
11052
11027
  }
11053
- var _excluded$o = ["axisClassName", "labelOffset", "tickLength", "tickLabelProps"];
11054
- function _extends$B() {
11055
- _extends$B = Object.assign ? Object.assign.bind() : function(target) {
11056
- for (var i2 = 1; i2 < arguments.length; i2++) {
11057
- var source = arguments[i2];
11058
- for (var key in source) {
11059
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11060
- target[key] = source[key];
11061
- }
11062
- }
11028
+ function TooltipWithBounds(_ref) {
11029
+ var children2 = _ref.children;
11030
+ _ref.getRects;
11031
+ var _ref$left = _ref.left, initialLeft = _ref$left === void 0 ? 0 : _ref$left, _ref$offsetLeft = _ref.offsetLeft, offsetLeft = _ref$offsetLeft === void 0 ? 10 : _ref$offsetLeft, _ref$offsetTop = _ref.offsetTop, offsetTop = _ref$offsetTop === void 0 ? 10 : _ref$offsetTop, parentBounds = _ref.parentRect, ownBounds = _ref.rect, _ref$style = _ref.style, style2 = _ref$style === void 0 ? defaultStyles : _ref$style, _ref$top = _ref.top, initialTop = _ref$top === void 0 ? 0 : _ref$top, _ref$unstyled = _ref.unstyled, unstyled = _ref$unstyled === void 0 ? false : _ref$unstyled, nodeRef = _ref.nodeRef, otherProps = _objectWithoutPropertiesLoose$p(_ref, _excluded$p);
11032
+ var transform2;
11033
+ var placeTooltipLeft = false;
11034
+ var placeTooltipUp = false;
11035
+ if (ownBounds && parentBounds) {
11036
+ var left2 = initialLeft;
11037
+ var top2 = initialTop;
11038
+ if (parentBounds.width) {
11039
+ var rightPlacementClippedPx = left2 + offsetLeft + ownBounds.width - parentBounds.width;
11040
+ var leftPlacementClippedPx = ownBounds.width - left2 - offsetLeft;
11041
+ placeTooltipLeft = rightPlacementClippedPx > 0 && rightPlacementClippedPx > leftPlacementClippedPx;
11042
+ } else {
11043
+ var _rightPlacementClippedPx = left2 + offsetLeft + ownBounds.width - window.innerWidth;
11044
+ var _leftPlacementClippedPx = ownBounds.width - left2 - offsetLeft;
11045
+ placeTooltipLeft = _rightPlacementClippedPx > 0 && _rightPlacementClippedPx > _leftPlacementClippedPx;
11063
11046
  }
11064
- return target;
11065
- };
11066
- return _extends$B.apply(this, arguments);
11047
+ if (parentBounds.height) {
11048
+ var bottomPlacementClippedPx = top2 + offsetTop + ownBounds.height - parentBounds.height;
11049
+ var topPlacementClippedPx = ownBounds.height - top2 - offsetTop;
11050
+ placeTooltipUp = bottomPlacementClippedPx > 0 && bottomPlacementClippedPx > topPlacementClippedPx;
11051
+ } else {
11052
+ placeTooltipUp = top2 + offsetTop + ownBounds.height > window.innerHeight;
11053
+ }
11054
+ left2 = placeTooltipLeft ? left2 - ownBounds.width - offsetLeft : left2 + offsetLeft;
11055
+ top2 = placeTooltipUp ? top2 - ownBounds.height - offsetTop : top2 + offsetTop;
11056
+ left2 = Math.round(left2);
11057
+ top2 = Math.round(top2);
11058
+ transform2 = "translate(" + left2 + "px, " + top2 + "px)";
11059
+ }
11060
+ return /* @__PURE__ */ React__default.createElement(Tooltip$2, _extends$B({
11061
+ ref: nodeRef,
11062
+ style: _extends$B({
11063
+ left: 0,
11064
+ top: 0,
11065
+ transform: transform2
11066
+ }, !unstyled && style2)
11067
+ }, otherProps), /* @__PURE__ */ React__default.createElement(TooltipPositionProvider, {
11068
+ value: {
11069
+ isFlippedVertically: !placeTooltipUp,
11070
+ isFlippedHorizontally: !placeTooltipLeft
11071
+ }
11072
+ }, children2));
11067
11073
  }
11074
+ TooltipWithBounds.propTypes = {
11075
+ nodeRef: _pt.oneOfType([_pt.string, _pt.func, _pt.object])
11076
+ };
11077
+ var TooltipWithBounds$1 = withBoundingRects(TooltipWithBounds);
11078
+ var _excluded$o = ["detectBounds", "zIndex"], _excluded2$1 = ["left", "top", "detectBounds", "zIndex"];
11068
11079
  function _objectWithoutPropertiesLoose$o(source, excluded) {
11069
11080
  if (source == null)
11070
11081
  return {};
@@ -11079,101 +11090,122 @@ function _objectWithoutPropertiesLoose$o(source, excluded) {
11079
11090
  }
11080
11091
  return target;
11081
11092
  }
11082
- var bottomTickLabelProps$1 = {
11083
- dy: "0.25em",
11084
- fill: "#222",
11085
- fontFamily: "Arial",
11086
- fontSize: 10,
11087
- textAnchor: "middle"
11088
- };
11089
- function AxisBottom$2(_ref) {
11090
- var axisClassName = _ref.axisClassName, _ref$labelOffset = _ref.labelOffset, labelOffset = _ref$labelOffset === void 0 ? 8 : _ref$labelOffset, _ref$tickLength = _ref.tickLength, tickLength = _ref$tickLength === void 0 ? 8 : _ref$tickLength, tickLabelProps = _ref.tickLabelProps, restProps = _objectWithoutPropertiesLoose$o(_ref, _excluded$o);
11091
- var tickLabelPropsFinal = typeof tickLabelProps === "function" ? tickLabelProps : _extends$B({}, bottomTickLabelProps$1, tickLabelProps);
11092
- return /* @__PURE__ */ React__default.createElement(Axis$2, _extends$B({
11093
- axisClassName: cx("visx-axis-bottom", axisClassName),
11094
- labelOffset,
11095
- orientation: Orientation$2.bottom,
11096
- tickLabelProps: tickLabelPropsFinal,
11097
- tickLength
11098
- }, restProps));
11093
+ function useTooltipInPortal(_temp) {
11094
+ var _ref = _temp === void 0 ? {} : _temp, _ref$detectBounds = _ref.detectBounds, detectBoundsOption = _ref$detectBounds === void 0 ? true : _ref$detectBounds, zIndexOption = _ref.zIndex, useMeasureOptions = _objectWithoutPropertiesLoose$o(_ref, _excluded$o);
11095
+ var _useMeasure = useMeasure(useMeasureOptions), containerRef = _useMeasure[0], containerBounds = _useMeasure[1], forceRefreshBounds = _useMeasure[2];
11096
+ var _useState = useState(false), isSsr = _useState[0], setIsSsr = _useState[1];
11097
+ useEffect(function() {
11098
+ setIsSsr(false);
11099
+ }, []);
11100
+ var TooltipInPortal = useMemo(function() {
11101
+ return function(_ref2) {
11102
+ var _ref2$left = _ref2.left, containerLeft = _ref2$left === void 0 ? 0 : _ref2$left, _ref2$top = _ref2.top, containerTop = _ref2$top === void 0 ? 0 : _ref2$top, detectBoundsProp = _ref2.detectBounds, zIndexProp = _ref2.zIndex, tooltipProps = _objectWithoutPropertiesLoose$o(_ref2, _excluded2$1);
11103
+ var detectBounds = detectBoundsProp == null ? detectBoundsOption : detectBoundsProp;
11104
+ var zIndex = zIndexProp == null ? zIndexOption : zIndexProp;
11105
+ var TooltipComponent = detectBounds ? TooltipWithBounds$1 : Tooltip$2;
11106
+ var scrollX = isSsr ? 0 : window.scrollX;
11107
+ var scrollY = isSsr ? 0 : window.scrollY;
11108
+ var portalLeft = containerLeft + (containerBounds.left || 0) + scrollX;
11109
+ var portalTop = containerTop + (containerBounds.top || 0) + scrollY;
11110
+ return /* @__PURE__ */ jsx(Portal, {
11111
+ zIndex,
11112
+ children: /* @__PURE__ */ jsx(TooltipComponent, {
11113
+ left: portalLeft,
11114
+ top: portalTop,
11115
+ ...tooltipProps
11116
+ })
11117
+ });
11118
+ };
11119
+ }, [detectBoundsOption, zIndexOption, containerBounds.left, containerBounds.top, isSsr]);
11120
+ return {
11121
+ containerRef,
11122
+ containerBounds,
11123
+ forceRefreshBounds,
11124
+ TooltipInPortal
11125
+ };
11099
11126
  }
11100
- const BottomAxis = ({
11101
- data,
11102
- yMax,
11103
- value,
11104
- xScale,
11105
- parentWidth
11127
+ const ToolTip = ({
11128
+ style: style2,
11129
+ top: top2,
11130
+ left: left2,
11131
+ tooltipData
11106
11132
  }) => {
11107
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r, _s;
11108
- return /* @__PURE__ */ jsx(AxisBottom$2, {
11109
- numTicks: data.length,
11110
- top: yMax,
11111
- hideTicks: (_a2 = value.main) == null ? void 0 : _a2.hideTicks,
11112
- hideAxisLine: (_b2 = value.main) == null ? void 0 : _b2.hideBottomAxisLine,
11113
- strokeWidth: (_d = (_c2 = value.style) == null ? void 0 : _c2.labelStyle) == null ? void 0 : _d.bottomAxisWidth,
11114
- scale: xScale,
11115
- stroke: (_f = (_e2 = value.style) == null ? void 0 : _e2.labelStyle) == null ? void 0 : _f.tickColor,
11116
- labelOffset: (_h = (_g = value.style) == null ? void 0 : _g.labelStyle) == null ? void 0 : _h.bottomLabelOffset,
11117
- label: (_i = value.main) == null ? void 0 : _i.bottomLabel,
11118
- labelProps: {
11119
- fill: (_k = (_j = value.style) == null ? void 0 : _j.labelStyle) == null ? void 0 : _k.labelColor,
11120
- fontSize: (_m = (_l = value.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.fontSize,
11121
- fontWeight: (_o = (_n2 = value.style) == null ? void 0 : _n2.labelStyle) == null ? void 0 : _o.fontWeight,
11122
- fontFamily: (_q = (_p = value.style) == null ? void 0 : _p.labelStyle) == null ? void 0 : _q.fontWeight
11123
- },
11124
- tickStroke: (_s = (_r = value.style) == null ? void 0 : _r.labelStyle) == null ? void 0 : _s.tickColor,
11125
- tickLabelProps: () => {
11126
- var _a3, _b3, _c3, _d2;
11127
- return {
11128
- fill: (_b3 = (_a3 = value.style) == null ? void 0 : _a3.labelStyle) == null ? void 0 : _b3.tickLabelColor,
11129
- fontSize: ((_d2 = (_c3 = value.style) == null ? void 0 : _c3.labelStyle) == null ? void 0 : _d2.tickFontSize) || 11,
11130
- textAnchor: "middle"
11131
- };
11132
- }
11133
+ const {
11134
+ TooltipInPortal
11135
+ } = useTooltipInPortal({
11136
+ detectBounds: true,
11137
+ scroll: true
11133
11138
  });
11139
+ return /* @__PURE__ */ jsx(TooltipInPortal, {
11140
+ top: top2,
11141
+ left: left2,
11142
+ children: /* @__PURE__ */ jsxs("div", {
11143
+ style: {
11144
+ height: "50px",
11145
+ textAlign: "center",
11146
+ background: "black",
11147
+ padding: "10px",
11148
+ boxShadow: "2px 2px 5px black",
11149
+ color: "#6c5efb",
11150
+ backgroundColor: (style2 == null ? void 0 : style2.tooltipbackground) || "black",
11151
+ ...style2 == null ? void 0 : style2.tooltipStyle,
11152
+ margin: "-20px"
11153
+ },
11154
+ children: [/* @__PURE__ */ jsx("div", {
11155
+ style: {
11156
+ padding: "4px 10px",
11157
+ backgroundColor: "black",
11158
+ color: "white",
11159
+ borderRadius: "5px"
11160
+ },
11161
+ children: tooltipData[0]
11162
+ }), /* @__PURE__ */ jsx("div", {
11163
+ style: {
11164
+ marginTop: "10px",
11165
+ fontWeight: 700
11166
+ },
11167
+ children: tooltipData[1]
11168
+ })]
11169
+ })
11170
+ }, Math.random());
11134
11171
  };
11135
- const LeftAxis = ({
11136
- value,
11137
- yScale,
11138
- parentWidth
11139
- }) => {
11140
- var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2, _o, _p, _q, _r;
11141
- return /* @__PURE__ */ jsx(AxisLeft$2, {
11142
- numTicks: (_a2 = value.main) == null ? void 0 : _a2.numTicks,
11143
- scale: yScale,
11144
- top: 0,
11145
- label: (_b2 = value.main) == null ? void 0 : _b2.leftLabel,
11146
- tickStroke: (_d = (_c2 = value.style) == null ? void 0 : _c2.labelStyle) == null ? void 0 : _d.tickColor,
11147
- strokeWidth: (_f = (_e2 = value.style) == null ? void 0 : _e2.labelStyle) == null ? void 0 : _f.rightAxisWidth,
11148
- hideTicks: (_g = value.main) == null ? void 0 : _g.hideLeftTicks,
11149
- labelOffset: (_i = (_h = value.style) == null ? void 0 : _h.labelStyle) == null ? void 0 : _i.leftLabelOffset,
11150
- labelProps: {
11151
- fill: (_k = (_j = value.style) == null ? void 0 : _j.labelStyle) == null ? void 0 : _k.labelColor,
11152
- fontSize: (_m = (_l = value.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.fontSize,
11153
- fontWeight: (_o = (_n2 = value.style) == null ? void 0 : _n2.labelStyle) == null ? void 0 : _o.fontWeight,
11154
- fontFamily: (_q = (_p = value.style) == null ? void 0 : _p.labelStyle) == null ? void 0 : _q.fontWeight
11155
- },
11156
- hideAxisLine: (_r = value.main) == null ? void 0 : _r.hideLeftAxisLine,
11157
- tickLabelProps: (e3) => {
11158
- var _a3, _b3;
11159
- return {
11160
- fill: (_b3 = (_a3 = value.style) == null ? void 0 : _a3.labelStyle) == null ? void 0 : _b3.tickLabelColor,
11161
- fontSize: 11,
11162
- textAnchor: "end",
11163
- dy: "0.33em"
11164
- };
11165
- }
11166
- });
11172
+ const defaultMargin = {
11173
+ top: 20,
11174
+ right: 0,
11175
+ bottom: 40,
11176
+ left: 40
11167
11177
  };
11168
- const DrawBarGraph = ({
11169
- value,
11170
- parentWidth,
11171
- parentHeight,
11172
- margin
11173
- }) => {
11178
+ function DrawBarGraph({
11179
+ width,
11180
+ height,
11181
+ events = false,
11182
+ margin = defaultMargin,
11183
+ value
11184
+ }) {
11174
11185
  var _a2, _b2, _c2, _d, _e2, _f, _g, _h, _i, _j;
11175
- const data = (_a2 = value == null ? void 0 : value.main) == null ? void 0 : _a2.data;
11176
- const arr = ((_b2 = value.main) == null ? void 0 : _b2.xAxisValue) && ((_c2 = value.main) == null ? void 0 : _c2.yAxisValue) ? [value.cosntent.xAxisValue, (_d = value.main) == null ? void 0 : _d.yAxisValue] : Object.keys(data[0]);
11186
+ const data = (_a2 = value.main) == null ? void 0 : _a2.data;
11187
+ const keys2 = Object.keys(data[0]).filter((d2) => d2 !== "label");
11188
+ const getDate = (d2) => d2.label;
11189
+ const dateScale = createBandScale({
11190
+ domain: data.map(getDate),
11191
+ padding: 0.2
11192
+ });
11193
+ const cityScale = createBandScale({
11194
+ domain: keys2,
11195
+ padding: 0.1
11196
+ });
11197
+ const tempScale = createLinearScale({
11198
+ domain: [0, Math.max(...data.map((d2) => Math.max(...keys2.map((key) => Number(d2[key])))))]
11199
+ });
11200
+ const colorScale = createOrdinalScale$1({
11201
+ domain: keys2,
11202
+ range: [((_d = (_c2 = (_b2 = value.style) == null ? void 0 : _b2.barStyle) == null ? void 0 : _c2.color) == null ? void 0 : _d.firstBarColor) || "#aeeef8", ((_g = (_f = (_e2 = value.style) == null ? void 0 : _e2.barStyle) == null ? void 0 : _f.color) == null ? void 0 : _g.secondBarColor) || "e5fd3d", ((_j = (_i = (_h = value.style) == null ? void 0 : _h.barStyle) == null ? void 0 : _i.color) == null ? void 0 : _j.thirdBarColor) || "#9caff6"]
11203
+ });
11204
+ const xMax = width - margin.left - margin.right;
11205
+ const yMax = height - margin.top - margin.bottom;
11206
+ dateScale.rangeRound([0, xMax]);
11207
+ cityScale.rangeRound([0, dateScale.bandwidth()]);
11208
+ tempScale.range([yMax, 0]);
11177
11209
  const {
11178
11210
  tooltipData,
11179
11211
  tooltipLeft,
@@ -11182,89 +11214,85 @@ const DrawBarGraph = ({
11182
11214
  showTooltip,
11183
11215
  hideTooltip
11184
11216
  } = useTooltip();
11185
- const {
11186
- containerRef
11187
- } = useTooltipInPortal({
11188
- detectBounds: true,
11189
- scroll: true
11190
- });
11191
11217
  const handleMouse = (event, datum2) => {
11218
+ console.log(datum2);
11192
11219
  showTooltip({
11193
11220
  tooltipLeft: event.clientX,
11194
11221
  tooltipTop: event.clientY,
11195
- tooltipData: [datum2[arr[0]], datum2[arr[1]]]
11222
+ tooltipData: [datum2.key, datum2.value, datum2.color]
11196
11223
  });
11197
11224
  };
11198
- const xMax = parentWidth - margin.left - margin.right;
11199
- const yMax = parentHeight - margin.top - margin.bottom;
11200
- const x2 = (d2) => d2[arr[0]];
11201
- const y2 = (d2) => +d2[arr[1]];
11202
- const xScale = createBandScale({
11203
- range: [0, xMax],
11204
- round: true,
11205
- domain: data.map(x2),
11206
- padding: 0.4
11207
- });
11208
- const tempValue = data.reduce((total, curValue) => {
11209
- return total + curValue[arr[1]];
11210
- }, 0);
11211
- let averageValue = tempValue / data.length;
11212
- const yScale = createLinearScale({
11213
- range: [yMax, 0],
11214
- round: true,
11215
- domain: [0, Math.max(...data.map(y2))]
11216
- });
11217
- function compose2(scale, accessor) {
11218
- return (data2) => scale(accessor(data2));
11219
- }
11220
- const xPoint = compose2(xScale, x2);
11221
- const yPoint = compose2(yScale, y2);
11222
- return /* @__PURE__ */ jsxs(Fragment, {
11223
- children: [/* @__PURE__ */ jsx("svg", {
11224
- ref: containerRef,
11225
- width: parentWidth,
11226
- height: parentHeight,
11227
- children: /* @__PURE__ */ jsxs(Group, {
11228
- left: (_f = (_e2 = value.style) == null ? void 0 : _e2.labelStyle) == null ? void 0 : _f.leftLabelMargin,
11229
- top: (_h = (_g = value.style) == null ? void 0 : _g.labelStyle) == null ? void 0 : _h.topLabelMargin,
11230
- children: [((_i = value.main) == null ? void 0 : _i.axisLeft) && /* @__PURE__ */ jsx(LeftAxis, {
11225
+ return width < 10 ? null : /* @__PURE__ */ jsxs("div", {
11226
+ children: [/* @__PURE__ */ jsxs("svg", {
11227
+ width,
11228
+ height,
11229
+ children: [/* @__PURE__ */ jsx("rect", {
11230
+ x: 0,
11231
+ y: 0,
11232
+ width,
11233
+ height,
11234
+ fill: value.style.containerStyle.background || "#612efb",
11235
+ rx: 14
11236
+ }), /* @__PURE__ */ jsxs(Group, {
11237
+ top: margin.top,
11238
+ left: margin.left,
11239
+ children: [/* @__PURE__ */ jsx(LeftAxis, {
11231
11240
  value,
11232
- yScale,
11233
- parentWidth
11234
- }), data.map((d2) => {
11235
- var _a3, _b3, _c3, _d2, _e3, _f2, _g2, _h2;
11236
- const barHeight = yMax - yPoint(d2);
11237
- const fillBarColor = averageValue / 2 > d2[arr[1]] ? (_b3 = (_a3 = value.style) == null ? void 0 : _a3.barStyle) == null ? void 0 : _b3.lowValueColor : averageValue < d2[arr[1]] ? (_d2 = (_c3 = value.style) == null ? void 0 : _c3.barStyle) == null ? void 0 : _d2.highValueColor : (_f2 = (_e3 = value.style) == null ? void 0 : _e3.barStyle) == null ? void 0 : _f2.mediumValueColor;
11238
- return /* @__PURE__ */ jsx(Fragment, {
11239
- children: /* @__PURE__ */ jsx(Bar, {
11240
- x: xPoint(d2),
11241
- y: yMax - barHeight,
11242
- radius: ((_h2 = (_g2 = value.style) == null ? void 0 : _g2.barStyle) == null ? void 0 : _h2.barRadius) || 0,
11243
- height: barHeight,
11244
- width: xScale.bandwidth(),
11245
- fill: fillBarColor,
11246
- onMouseOver: (e3) => handleMouse(e3, d2),
11247
- onMouseOut: hideTooltip
11248
- }, `bar-${barHeight}`)
11249
- });
11250
- }), ((_j = value.main) == null ? void 0 : _j.axisBottom) && /* @__PURE__ */ jsx(BottomAxis, {
11241
+ yScale: tempScale,
11242
+ parentWidth: width
11243
+ }), /* @__PURE__ */ jsx(BarGroup, {
11251
11244
  data,
11252
- value,
11253
- yMax,
11254
- xScale,
11255
- parentWidth
11245
+ keys: keys2,
11246
+ height: yMax,
11247
+ x0: getDate,
11248
+ x0Scale: dateScale,
11249
+ x1Scale: cityScale,
11250
+ yScale: tempScale,
11251
+ color: colorScale,
11252
+ children: (barGroups) => barGroups.map((barGroup) => /* @__PURE__ */ jsx(Group, {
11253
+ left: barGroup.x0,
11254
+ children: barGroup.bars.map((bar) => /* @__PURE__ */ jsx("rect", {
11255
+ x: bar.x,
11256
+ y: bar.y,
11257
+ width: bar.width,
11258
+ height: bar.height,
11259
+ fill: bar.color,
11260
+ rx: 4,
11261
+ onMouseOver: (e3) => handleMouse(e3, bar),
11262
+ onMouseOut: hideTooltip,
11263
+ onClick: () => {
11264
+ if (!events)
11265
+ return;
11266
+ const {
11267
+ key,
11268
+ value: value2
11269
+ } = bar;
11270
+ alert(JSON.stringify({
11271
+ key,
11272
+ value: value2
11273
+ }));
11274
+ }
11275
+ }, `bar-group-bar-${barGroup.index}-${bar.index}-${bar.value}-${bar.key}`))
11276
+ }, `bar-group-${barGroup.index}-${barGroup.x0}`))
11256
11277
  })]
11257
- })
11278
+ }), /* @__PURE__ */ jsx(BottomAxis, {
11279
+ yMax: yMax + margin.top,
11280
+ value,
11281
+ left: margin.left,
11282
+ xScale: dateScale,
11283
+ parentWidth: width
11284
+ })]
11258
11285
  }), tooltipOpen && /* @__PURE__ */ jsx(ToolTip, {
11259
11286
  style: {
11260
- ...value == null ? void 0 : value.style
11287
+ ...value == null ? void 0 : value.style,
11288
+ tooltipbackground: tooltipData[2]
11261
11289
  },
11262
11290
  top: tooltipTop,
11263
11291
  left: tooltipLeft,
11264
11292
  tooltipData
11265
11293
  })]
11266
11294
  });
11267
- };
11295
+ }
11268
11296
  var root$4 = _root;
11269
11297
  var now$2 = function() {
11270
11298
  return root$4.Date.now();
@@ -11787,17 +11815,15 @@ const BarGraph = ({
11787
11815
  children: (parent) => {
11788
11816
  var _a3, _b3, _c3, _d2, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n2;
11789
11817
  return /* @__PURE__ */ jsx(DrawBarGraph, {
11790
- parentWidth: parent.width,
11791
- parentHeight: (_b3 = (_a3 = barData == null ? void 0 : barData.style) == null ? void 0 : _a3.containerStyle) == null ? void 0 : _b3.height,
11818
+ width: parent.width || 400,
11819
+ height: ((_b3 = (_a3 = barData == null ? void 0 : barData.style) == null ? void 0 : _a3.containerStyle) == null ? void 0 : _b3.height) | 400,
11792
11820
  margin: {
11793
11821
  top: ((_e2 = (_d2 = (_c3 = barData == null ? void 0 : barData.style) == null ? void 0 : _c3.labelStyle) == null ? void 0 : _d2.margin) == null ? void 0 : _e2.top) || 10,
11794
11822
  right: ((_h = (_g = (_f = barData == null ? void 0 : barData.style) == null ? void 0 : _f.labelStyle) == null ? void 0 : _g.margin) == null ? void 0 : _h.right) || 10,
11795
11823
  bottom: ((_k = (_j = (_i = barData == null ? void 0 : barData.style) == null ? void 0 : _i.labelStyle) == null ? void 0 : _j.margin) == null ? void 0 : _k.bottom) || 20,
11796
11824
  left: ((_n2 = (_m = (_l = barData == null ? void 0 : barData.style) == null ? void 0 : _l.labelStyle) == null ? void 0 : _m.margin) == null ? void 0 : _n2.left) || 60
11797
11825
  },
11798
- value: barData,
11799
- parentRef: parent.ref,
11800
- resizeParent: parent.resize
11826
+ value: barData
11801
11827
  });
11802
11828
  }
11803
11829
  });