` by default. You can change this
* behavior by providing a `component` prop.
* If you use React v16+ and would like to avoid a wrapping `
` element
* you can pass in `component={null}`. This is useful if the wrapping div
* borks your css styles.
*/
component: import_prop_types5.default.any,
/**
* A set of `` components, that are toggled `in` and out as they
* leave. the `` will inject specific transition props, so
* remember to spread them through if you are wrapping the `` as
* with our `` example.
*
* While this component is meant for multiple `Transition` or `CSSTransition`
* children, sometimes you may want to have a single transition child with
* content that you want to be transitioned out and in when you change it
* (e.g. routes, images etc.) In that case you can change the `key` prop of
* the transition child as you change its content, this will cause
* `TransitionGroup` to transition the child out and back in.
*/
children: import_prop_types5.default.node,
/**
* A convenience prop that enables or disables appear animations
* for all children. Note that specifying this will override any defaults set
* on individual children Transitions.
*/
appear: import_prop_types5.default.bool,
/**
* A convenience prop that enables or disables enter animations
* for all children. Note that specifying this will override any defaults set
* on individual children Transitions.
*/
enter: import_prop_types5.default.bool,
/**
* A convenience prop that enables or disables exit animations
* for all children. Note that specifying this will override any defaults set
* on individual children Transitions.
*/
exit: import_prop_types5.default.bool,
/**
* You may need to apply reactive updates to a child as it is exiting.
* This is generally done by using `cloneElement` however in the case of an exiting
* child the element has already been removed and not accessible to the consumer.
*
* If you do need to update a child as it leaves you can provide a `childFactory`
* to wrap every child, even the ones that are leaving.
*
* @type Function(child: ReactElement) -> ReactElement
*/
childFactory: import_prop_types5.default.func
} : {};
TransitionGroup.defaultProps = defaultProps2;
var TransitionGroup_default = TransitionGroup;
// node_modules/react-transition-group/esm/ReplaceTransition.js
var ReplaceTransition = function(_React$Component) {
_inheritsLoose(ReplaceTransition2, _React$Component);
function ReplaceTransition2() {
var _this;
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
_this.handleEnter = function() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return _this.handleLifecycle("onEnter", 0, args);
};
_this.handleEntering = function() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return _this.handleLifecycle("onEntering", 0, args);
};
_this.handleEntered = function() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return _this.handleLifecycle("onEntered", 0, args);
};
_this.handleExit = function() {
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
return _this.handleLifecycle("onExit", 1, args);
};
_this.handleExiting = function() {
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}
return _this.handleLifecycle("onExiting", 1, args);
};
_this.handleExited = function() {
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
args[_key7] = arguments[_key7];
}
return _this.handleLifecycle("onExited", 1, args);
};
return _this;
}
var _proto = ReplaceTransition2.prototype;
_proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
var _child$props;
var children2 = this.props.children;
var child = import_react26.default.Children.toArray(children2)[idx];
if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
if (this.props[handler]) {
var maybeNode = child.props.nodeRef ? void 0 : import_react_dom2.default.findDOMNode(this);
this.props[handler](maybeNode);
}
};
_proto.render = function render() {
var _this$props = this.props, children2 = _this$props.children, inProp = _this$props.in, props = _objectWithoutPropertiesLoose12(_this$props, ["children", "in"]);
var _React$Children$toArr = import_react26.default.Children.toArray(children2), first2 = _React$Children$toArr[0], second3 = _React$Children$toArr[1];
delete props.onEnter;
delete props.onEntering;
delete props.onEntered;
delete props.onExit;
delete props.onExiting;
delete props.onExited;
return import_react26.default.createElement(TransitionGroup_default, props, inProp ? import_react26.default.cloneElement(first2, {
key: "first",
onEnter: this.handleEnter,
onEntering: this.handleEntering,
onEntered: this.handleEntered
}) : import_react26.default.cloneElement(second3, {
key: "second",
onEnter: this.handleExit,
onEntering: this.handleExiting,
onEntered: this.handleExited
}));
};
return ReplaceTransition2;
}(import_react26.default.Component);
ReplaceTransition.propTypes = true ? {
in: import_prop_types6.default.bool.isRequired,
children: function children(props, propName) {
if (import_react26.default.Children.count(props[propName]) !== 2) return new Error('"' + propName + '" must be exactly two transition components.');
return null;
}
} : {};
// node_modules/react-transition-group/esm/SwitchTransition.js
var import_react27 = __toESM(require_react());
var import_prop_types7 = __toESM(require_prop_types());
var _leaveRenders;
var _enterRenders;
function areChildrenDifferent(oldChildren, newChildren) {
if (oldChildren === newChildren) return false;
if (import_react27.default.isValidElement(oldChildren) && import_react27.default.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
return false;
}
return true;
}
var modes = {
out: "out-in",
in: "in-out"
};
var callHook = function callHook2(element, name, cb) {
return function() {
var _element$props;
element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
cb();
};
};
var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function(_ref) {
var current = _ref.current, changeState = _ref.changeState;
return import_react27.default.cloneElement(current, {
in: false,
onExited: callHook(current, "onExited", function() {
changeState(ENTERING, null);
})
});
}, _leaveRenders[modes.in] = function(_ref2) {
var current = _ref2.current, changeState = _ref2.changeState, children2 = _ref2.children;
return [current, import_react27.default.cloneElement(children2, {
in: true,
onEntered: callHook(children2, "onEntered", function() {
changeState(ENTERING);
})
})];
}, _leaveRenders);
var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function(_ref3) {
var children2 = _ref3.children, changeState = _ref3.changeState;
return import_react27.default.cloneElement(children2, {
in: true,
onEntered: callHook(children2, "onEntered", function() {
changeState(ENTERED, import_react27.default.cloneElement(children2, {
in: true
}));
})
});
}, _enterRenders[modes.in] = function(_ref4) {
var current = _ref4.current, children2 = _ref4.children, changeState = _ref4.changeState;
return [import_react27.default.cloneElement(current, {
in: false,
onExited: callHook(current, "onExited", function() {
changeState(ENTERED, import_react27.default.cloneElement(children2, {
in: true
}));
})
}), import_react27.default.cloneElement(children2, {
in: true
})];
}, _enterRenders);
var SwitchTransition = function(_React$Component) {
_inheritsLoose(SwitchTransition2, _React$Component);
function SwitchTransition2() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_this.state = {
status: ENTERED,
current: null
};
_this.appeared = false;
_this.changeState = function(status, current) {
if (current === void 0) {
current = _this.state.current;
}
_this.setState({
status,
current
});
};
return _this;
}
var _proto = SwitchTransition2.prototype;
_proto.componentDidMount = function componentDidMount() {
this.appeared = true;
};
SwitchTransition2.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
if (props.children == null) {
return {
current: null
};
}
if (state.status === ENTERING && props.mode === modes.in) {
return {
status: ENTERING
};
}
if (state.current && areChildrenDifferent(state.current, props.children)) {
return {
status: EXITING
};
}
return {
current: import_react27.default.cloneElement(props.children, {
in: true
})
};
};
_proto.render = function render() {
var _this$props = this.props, children2 = _this$props.children, mode2 = _this$props.mode, _this$state = this.state, status = _this$state.status, current = _this$state.current;
var data = {
children: children2,
current,
changeState: this.changeState,
status
};
var component;
switch (status) {
case ENTERING:
component = enterRenders[mode2](data);
break;
case EXITING:
component = leaveRenders[mode2](data);
break;
case ENTERED:
component = current;
}
return import_react27.default.createElement(TransitionGroupContext_default.Provider, {
value: {
isMounting: !this.appeared
}
}, component);
};
return SwitchTransition2;
}(import_react27.default.Component);
SwitchTransition.propTypes = true ? {
/**
* Transition modes.
* `out-in`: Current element transitions out first, then when complete, the new element transitions in.
* `in-out`: New element transitions in first, then when complete, the current element transitions out.
*
* @type {'out-in'|'in-out'}
*/
mode: import_prop_types7.default.oneOf([modes.in, modes.out]),
/**
* Any `Transition` or `CSSTransition` component.
*/
children: import_prop_types7.default.oneOfType([import_prop_types7.default.element.isRequired])
} : {};
SwitchTransition.defaultProps = {
mode: modes.out
};
// node_modules/react-smooth/es6/AnimateGroup.js
var import_prop_types9 = __toESM(require_prop_types());
// node_modules/react-smooth/es6/AnimateGroupChild.js
var import_react28 = __toESM(require_react());
var import_prop_types8 = __toESM(require_prop_types());
var _excluded13 = ["children", "appearOptions", "enterOptions", "leaveOptions"];
function _typeof26(o) {
"@babel/helpers - typeof";
return _typeof26 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof26(o);
}
function _extends13() {
_extends13 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends13.apply(this, arguments);
}
function _objectWithoutProperties12(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose13(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose13(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function ownKeys19(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread19(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys19(Object(t), true).forEach(function(r2) {
_defineProperty21(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys19(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck8(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties8(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey22(descriptor.key), descriptor);
}
}
function _createClass8(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties8(Constructor.prototype, protoProps);
if (staticProps) _defineProperties8(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _inherits7(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf8(subClass, superClass);
}
function _setPrototypeOf8(o, p) {
_setPrototypeOf8 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf8(o, p);
}
function _createSuper2(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct7();
return function _createSuperInternal() {
var Super = _getPrototypeOf7(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf7(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn7(this, result);
};
}
function _possibleConstructorReturn7(self2, call) {
if (call && (_typeof26(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized8(self2);
}
function _assertThisInitialized8(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct7() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
return true;
} catch (e) {
return false;
}
}
function _getPrototypeOf7(o) {
_getPrototypeOf7 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf7(o);
}
function _defineProperty21(obj, key, value) {
key = _toPropertyKey22(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey22(arg) {
var key = _toPrimitive22(arg, "string");
return _typeof26(key) === "symbol" ? key : String(key);
}
function _toPrimitive22(input, hint) {
if (_typeof26(input) !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== void 0) {
var res = prim.call(input, hint || "default");
if (_typeof26(res) !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var parseDurationOfSingleTransition = function parseDurationOfSingleTransition2() {
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
var steps = options.steps, duration = options.duration;
if (steps && steps.length) {
return steps.reduce(function(result, entry) {
return result + (Number.isFinite(entry.duration) && entry.duration > 0 ? entry.duration : 0);
}, 0);
}
if (Number.isFinite(duration)) {
return duration;
}
return 0;
};
var AnimateGroupChild = function(_Component) {
_inherits7(AnimateGroupChild2, _Component);
var _super = _createSuper2(AnimateGroupChild2);
function AnimateGroupChild2() {
var _this;
_classCallCheck8(this, AnimateGroupChild2);
_this = _super.call(this);
_defineProperty21(_assertThisInitialized8(_this), "handleEnter", function(node, isAppearing) {
var _this$props = _this.props, appearOptions = _this$props.appearOptions, enterOptions = _this$props.enterOptions;
_this.handleStyleActive(isAppearing ? appearOptions : enterOptions);
});
_defineProperty21(_assertThisInitialized8(_this), "handleExit", function() {
var leaveOptions = _this.props.leaveOptions;
_this.handleStyleActive(leaveOptions);
});
_this.state = {
isActive: false
};
return _this;
}
_createClass8(AnimateGroupChild2, [{
key: "handleStyleActive",
value: function handleStyleActive(style) {
if (style) {
var onAnimationEnd2 = style.onAnimationEnd ? function() {
style.onAnimationEnd();
} : null;
this.setState(_objectSpread19(_objectSpread19({}, style), {}, {
onAnimationEnd: onAnimationEnd2,
isActive: true
}));
}
}
}, {
key: "parseTimeout",
value: function parseTimeout() {
var _this$props2 = this.props, appearOptions = _this$props2.appearOptions, enterOptions = _this$props2.enterOptions, leaveOptions = _this$props2.leaveOptions;
return parseDurationOfSingleTransition(appearOptions) + parseDurationOfSingleTransition(enterOptions) + parseDurationOfSingleTransition(leaveOptions);
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props3 = this.props, children2 = _this$props3.children, appearOptions = _this$props3.appearOptions, enterOptions = _this$props3.enterOptions, leaveOptions = _this$props3.leaveOptions, props = _objectWithoutProperties12(_this$props3, _excluded13);
return import_react28.default.createElement(Transition_default, _extends13({}, props, {
onEnter: this.handleEnter,
onExit: this.handleExit,
timeout: this.parseTimeout()
}), function() {
return import_react28.default.createElement(Animate_default, _this2.state, import_react28.Children.only(children2));
});
}
}]);
return AnimateGroupChild2;
}(import_react28.Component);
AnimateGroupChild.propTypes = {
appearOptions: import_prop_types8.default.object,
enterOptions: import_prop_types8.default.object,
leaveOptions: import_prop_types8.default.object,
children: import_prop_types8.default.element
};
var AnimateGroupChild_default = AnimateGroupChild;
// node_modules/react-smooth/es6/AnimateGroup.js
function AnimateGroup(props) {
var component = props.component, children2 = props.children, appear = props.appear, enter = props.enter, leave = props.leave;
return import_react29.default.createElement(TransitionGroup_default, {
component
}, import_react29.Children.map(children2, function(child, index3) {
return import_react29.default.createElement(AnimateGroupChild_default, {
appearOptions: appear,
enterOptions: enter,
leaveOptions: leave,
key: "child-".concat(index3)
// eslint-disable-line
}, child);
}));
}
AnimateGroup.propTypes = {
appear: import_prop_types9.default.object,
enter: import_prop_types9.default.object,
leave: import_prop_types9.default.object,
children: import_prop_types9.default.oneOfType([import_prop_types9.default.array, import_prop_types9.default.element]),
component: import_prop_types9.default.any
};
AnimateGroup.defaultProps = {
component: "span"
};
// node_modules/react-smooth/es6/index.js
var es6_default = Animate_default;
// node_modules/recharts/es6/shape/Rectangle.js
function _typeof27(o) {
"@babel/helpers - typeof";
return _typeof27 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof27(o);
}
function _extends14() {
_extends14 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends14.apply(this, arguments);
}
function _slicedToArray10(arr, i) {
return _arrayWithHoles11(arr) || _iterableToArrayLimit10(arr, i) || _unsupportedIterableToArray16(arr, i) || _nonIterableRest11();
}
function _nonIterableRest11() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray16(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray16(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray16(o, minLen);
}
function _arrayLikeToArray16(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _iterableToArrayLimit10(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e, n, i, u, a2 = [], f = true, o = false;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = false;
} else for (; !(f = (e = i.call(t)).done) && (a2.push(e.value), a2.length !== l); f = true) ;
} catch (r2) {
o = true, n = r2;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a2;
}
}
function _arrayWithHoles11(arr) {
if (Array.isArray(arr)) return arr;
}
function ownKeys20(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread20(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys20(Object(t), true).forEach(function(r2) {
_defineProperty22(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys20(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty22(obj, key, value) {
key = _toPropertyKey23(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey23(t) {
var i = _toPrimitive23(t, "string");
return "symbol" == _typeof27(i) ? i : i + "";
}
function _toPrimitive23(t, r) {
if ("object" != _typeof27(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof27(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var getRectanglePath = function getRectanglePath2(x2, y2, width, height, radius) {
var maxRadius = Math.min(Math.abs(width) / 2, Math.abs(height) / 2);
var ySign = height >= 0 ? 1 : -1;
var xSign = width >= 0 ? 1 : -1;
var clockWise = height >= 0 && width >= 0 || height < 0 && width < 0 ? 1 : 0;
var path2;
if (maxRadius > 0 && radius instanceof Array) {
var newRadius = [0, 0, 0, 0];
for (var i = 0, len = 4; i < len; i++) {
newRadius[i] = radius[i] > maxRadius ? maxRadius : radius[i];
}
path2 = "M".concat(x2, ",").concat(y2 + ySign * newRadius[0]);
if (newRadius[0] > 0) {
path2 += "A ".concat(newRadius[0], ",").concat(newRadius[0], ",0,0,").concat(clockWise, ",").concat(x2 + xSign * newRadius[0], ",").concat(y2);
}
path2 += "L ".concat(x2 + width - xSign * newRadius[1], ",").concat(y2);
if (newRadius[1] > 0) {
path2 += "A ".concat(newRadius[1], ",").concat(newRadius[1], ",0,0,").concat(clockWise, ",\n ").concat(x2 + width, ",").concat(y2 + ySign * newRadius[1]);
}
path2 += "L ".concat(x2 + width, ",").concat(y2 + height - ySign * newRadius[2]);
if (newRadius[2] > 0) {
path2 += "A ".concat(newRadius[2], ",").concat(newRadius[2], ",0,0,").concat(clockWise, ",\n ").concat(x2 + width - xSign * newRadius[2], ",").concat(y2 + height);
}
path2 += "L ".concat(x2 + xSign * newRadius[3], ",").concat(y2 + height);
if (newRadius[3] > 0) {
path2 += "A ".concat(newRadius[3], ",").concat(newRadius[3], ",0,0,").concat(clockWise, ",\n ").concat(x2, ",").concat(y2 + height - ySign * newRadius[3]);
}
path2 += "Z";
} else if (maxRadius > 0 && radius === +radius && radius > 0) {
var _newRadius = Math.min(maxRadius, radius);
path2 = "M ".concat(x2, ",").concat(y2 + ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x2 + xSign * _newRadius, ",").concat(y2, "\n L ").concat(x2 + width - xSign * _newRadius, ",").concat(y2, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x2 + width, ",").concat(y2 + ySign * _newRadius, "\n L ").concat(x2 + width, ",").concat(y2 + height - ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x2 + width - xSign * _newRadius, ",").concat(y2 + height, "\n L ").concat(x2 + xSign * _newRadius, ",").concat(y2 + height, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x2, ",").concat(y2 + height - ySign * _newRadius, " Z");
} else {
path2 = "M ".concat(x2, ",").concat(y2, " h ").concat(width, " v ").concat(height, " h ").concat(-width, " Z");
}
return path2;
};
var isInRectangle = function isInRectangle2(point6, rect) {
if (!point6 || !rect) {
return false;
}
var px = point6.x, py = point6.y;
var x2 = rect.x, y2 = rect.y, width = rect.width, height = rect.height;
if (Math.abs(width) > 0 && Math.abs(height) > 0) {
var minX = Math.min(x2, x2 + width);
var maxX = Math.max(x2, x2 + width);
var minY = Math.min(y2, y2 + height);
var maxY = Math.max(y2, y2 + height);
return px >= minX && px <= maxX && py >= minY && py <= maxY;
}
return false;
};
var defaultProps3 = {
x: 0,
y: 0,
width: 0,
height: 0,
// The radius of border
// The radius of four corners when radius is a number
// The radius of left-top, right-top, right-bottom, left-bottom when radius is an array
radius: 0,
isAnimationActive: false,
isUpdateAnimationActive: false,
animationBegin: 0,
animationDuration: 1500,
animationEasing: "ease"
};
var Rectangle = function Rectangle2(rectangleProps) {
var props = _objectSpread20(_objectSpread20({}, defaultProps3), rectangleProps);
var pathRef = (0, import_react30.useRef)();
var _useState = (0, import_react30.useState)(-1), _useState2 = _slicedToArray10(_useState, 2), totalLength = _useState2[0], setTotalLength = _useState2[1];
(0, import_react30.useEffect)(function() {
if (pathRef.current && pathRef.current.getTotalLength) {
try {
var pathTotalLength = pathRef.current.getTotalLength();
if (pathTotalLength) {
setTotalLength(pathTotalLength);
}
} catch (err) {
}
}
}, []);
var x2 = props.x, y2 = props.y, width = props.width, height = props.height, radius = props.radius, className = props.className;
var animationEasing = props.animationEasing, animationDuration = props.animationDuration, animationBegin = props.animationBegin, isAnimationActive = props.isAnimationActive, isUpdateAnimationActive = props.isUpdateAnimationActive;
if (x2 !== +x2 || y2 !== +y2 || width !== +width || height !== +height || width === 0 || height === 0) {
return null;
}
var layerClass = clsx_default("recharts-rectangle", className);
if (!isUpdateAnimationActive) {
return import_react30.default.createElement("path", _extends14({}, filterProps(props, true), {
className: layerClass,
d: getRectanglePath(x2, y2, width, height, radius)
}));
}
return import_react30.default.createElement(es6_default, {
canBegin: totalLength > 0,
from: {
width,
height,
x: x2,
y: y2
},
to: {
width,
height,
x: x2,
y: y2
},
duration: animationDuration,
animationEasing,
isActive: isUpdateAnimationActive
}, function(_ref) {
var currWidth = _ref.width, currHeight = _ref.height, currX = _ref.x, currY = _ref.y;
return import_react30.default.createElement(es6_default, {
canBegin: totalLength > 0,
from: "0px ".concat(totalLength === -1 ? 1 : totalLength, "px"),
to: "".concat(totalLength, "px 0px"),
attributeName: "strokeDasharray",
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing
}, import_react30.default.createElement("path", _extends14({}, filterProps(props, true), {
className: layerClass,
d: getRectanglePath(currX, currY, currWidth, currHeight, radius),
ref: pathRef
})));
});
};
// node_modules/recharts/es6/shape/Polygon.js
var import_react31 = __toESM(require_react());
var _excluded14 = ["points", "className", "baseLinePoints", "connectNulls"];
function _extends15() {
_extends15 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends15.apply(this, arguments);
}
function _objectWithoutProperties13(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose14(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose14(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _toConsumableArray9(arr) {
return _arrayWithoutHoles9(arr) || _iterableToArray10(arr) || _unsupportedIterableToArray17(arr) || _nonIterableSpread9();
}
function _nonIterableSpread9() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray17(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray17(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray17(o, minLen);
}
function _iterableToArray10(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles9(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray17(arr);
}
function _arrayLikeToArray17(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
var isValidatePoint = function isValidatePoint2(point6) {
return point6 && point6.x === +point6.x && point6.y === +point6.y;
};
var getParsedPoints = function getParsedPoints2() {
var points = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
var segmentPoints = [[]];
points.forEach(function(entry) {
if (isValidatePoint(entry)) {
segmentPoints[segmentPoints.length - 1].push(entry);
} else if (segmentPoints[segmentPoints.length - 1].length > 0) {
segmentPoints.push([]);
}
});
if (isValidatePoint(points[0])) {
segmentPoints[segmentPoints.length - 1].push(points[0]);
}
if (segmentPoints[segmentPoints.length - 1].length <= 0) {
segmentPoints = segmentPoints.slice(0, -1);
}
return segmentPoints;
};
var getSinglePolygonPath = function getSinglePolygonPath2(points, connectNulls) {
var segmentPoints = getParsedPoints(points);
if (connectNulls) {
segmentPoints = [segmentPoints.reduce(function(res, segPoints) {
return [].concat(_toConsumableArray9(res), _toConsumableArray9(segPoints));
}, [])];
}
var polygonPath = segmentPoints.map(function(segPoints) {
return segPoints.reduce(function(path2, point6, index3) {
return "".concat(path2).concat(index3 === 0 ? "M" : "L").concat(point6.x, ",").concat(point6.y);
}, "");
}).join("");
return segmentPoints.length === 1 ? "".concat(polygonPath, "Z") : polygonPath;
};
var getRanglePath = function getRanglePath2(points, baseLinePoints, connectNulls) {
var outerPath = getSinglePolygonPath(points, connectNulls);
return "".concat(outerPath.slice(-1) === "Z" ? outerPath.slice(0, -1) : outerPath, "L").concat(getSinglePolygonPath(baseLinePoints.reverse(), connectNulls).slice(1));
};
var Polygon = function Polygon2(props) {
var points = props.points, className = props.className, baseLinePoints = props.baseLinePoints, connectNulls = props.connectNulls, others = _objectWithoutProperties13(props, _excluded14);
if (!points || !points.length) {
return null;
}
var layerClass = clsx_default("recharts-polygon", className);
if (baseLinePoints && baseLinePoints.length) {
var hasStroke = others.stroke && others.stroke !== "none";
var rangePath = getRanglePath(points, baseLinePoints, connectNulls);
return import_react31.default.createElement("g", {
className: layerClass
}, import_react31.default.createElement("path", _extends15({}, filterProps(others, true), {
fill: rangePath.slice(-1) === "Z" ? others.fill : "none",
stroke: "none",
d: rangePath
})), hasStroke ? import_react31.default.createElement("path", _extends15({}, filterProps(others, true), {
fill: "none",
d: getSinglePolygonPath(points, connectNulls)
})) : null, hasStroke ? import_react31.default.createElement("path", _extends15({}, filterProps(others, true), {
fill: "none",
d: getSinglePolygonPath(baseLinePoints, connectNulls)
})) : null);
}
var singlePath = getSinglePolygonPath(points, connectNulls);
return import_react31.default.createElement("path", _extends15({}, filterProps(others, true), {
fill: singlePath.slice(-1) === "Z" ? others.fill : "none",
className: layerClass,
d: singlePath
}));
};
// node_modules/recharts/es6/shape/Dot.js
var import_react32 = __toESM(require_react());
function _extends16() {
_extends16 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends16.apply(this, arguments);
}
var Dot = function Dot2(props) {
var cx = props.cx, cy = props.cy, r = props.r, className = props.className;
var layerClass = clsx_default("recharts-dot", className);
if (cx === +cx && cy === +cy && r === +r) {
return import_react32.default.createElement("circle", _extends16({}, filterProps(props, false), adaptEventHandlers(props), {
className: layerClass,
cx,
cy,
r
}));
}
return null;
};
// node_modules/recharts/es6/shape/Cross.js
var import_react33 = __toESM(require_react());
function _typeof28(o) {
"@babel/helpers - typeof";
return _typeof28 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof28(o);
}
var _excluded15 = ["x", "y", "top", "left", "width", "height", "className"];
function _extends17() {
_extends17 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends17.apply(this, arguments);
}
function ownKeys21(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread21(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys21(Object(t), true).forEach(function(r2) {
_defineProperty23(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys21(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty23(obj, key, value) {
key = _toPropertyKey24(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey24(t) {
var i = _toPrimitive24(t, "string");
return "symbol" == _typeof28(i) ? i : i + "";
}
function _toPrimitive24(t, r) {
if ("object" != _typeof28(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof28(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _objectWithoutProperties14(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose15(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose15(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
var getPath3 = function getPath4(x2, y2, width, height, top, left) {
return "M".concat(x2, ",").concat(top, "v").concat(height, "M").concat(left, ",").concat(y2, "h").concat(width);
};
var Cross = function Cross2(_ref) {
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, _ref$top = _ref.top, top = _ref$top === void 0 ? 0 : _ref$top, _ref$left = _ref.left, left = _ref$left === void 0 ? 0 : _ref$left, _ref$width = _ref.width, width = _ref$width === void 0 ? 0 : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? 0 : _ref$height, className = _ref.className, rest = _objectWithoutProperties14(_ref, _excluded15);
var props = _objectSpread21({
x: x2,
y: y2,
top,
left,
width,
height
}, rest);
if (!isNumber(x2) || !isNumber(y2) || !isNumber(width) || !isNumber(height) || !isNumber(top) || !isNumber(left)) {
return null;
}
return import_react33.default.createElement("path", _extends17({}, filterProps(props, true), {
className: clsx_default("recharts-cross", className),
d: getPath3(x2, y2, width, height, top, left)
}));
};
// node_modules/recharts/es6/polar/PolarGrid.js
var import_react34 = __toESM(require_react());
var _excluded16 = ["cx", "cy", "innerRadius", "outerRadius", "gridType", "radialLines"];
function _typeof29(o) {
"@babel/helpers - typeof";
return _typeof29 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof29(o);
}
function _objectWithoutProperties15(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose16(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose16(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _extends18() {
_extends18 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends18.apply(this, arguments);
}
function ownKeys22(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread22(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys22(Object(t), true).forEach(function(r2) {
_defineProperty24(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys22(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty24(obj, key, value) {
key = _toPropertyKey25(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey25(t) {
var i = _toPrimitive25(t, "string");
return "symbol" == _typeof29(i) ? i : i + "";
}
function _toPrimitive25(t, r) {
if ("object" != _typeof29(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof29(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var getPolygonPath = function getPolygonPath2(radius, cx, cy, polarAngles) {
var path2 = "";
polarAngles.forEach(function(angle, i) {
var point6 = polarToCartesian(cx, cy, radius, angle);
if (i) {
path2 += "L ".concat(point6.x, ",").concat(point6.y);
} else {
path2 += "M ".concat(point6.x, ",").concat(point6.y);
}
});
path2 += "Z";
return path2;
};
var PolarAngles = function PolarAngles2(props) {
var cx = props.cx, cy = props.cy, innerRadius = props.innerRadius, outerRadius = props.outerRadius, polarAngles = props.polarAngles, radialLines = props.radialLines;
if (!polarAngles || !polarAngles.length || !radialLines) {
return null;
}
var polarAnglesProps = _objectSpread22({
stroke: "#ccc"
}, filterProps(props, false));
return import_react34.default.createElement("g", {
className: "recharts-polar-grid-angle"
}, polarAngles.map(function(entry) {
var start = polarToCartesian(cx, cy, innerRadius, entry);
var end = polarToCartesian(cx, cy, outerRadius, entry);
return import_react34.default.createElement("line", _extends18({}, polarAnglesProps, {
key: "line-".concat(entry),
x1: start.x,
y1: start.y,
x2: end.x,
y2: end.y
}));
}));
};
var ConcentricCircle = function ConcentricCircle2(props) {
var cx = props.cx, cy = props.cy, radius = props.radius, index3 = props.index;
var concentricCircleProps = _objectSpread22(_objectSpread22({
stroke: "#ccc"
}, filterProps(props, false)), {}, {
fill: "none"
});
return import_react34.default.createElement("circle", _extends18({}, concentricCircleProps, {
className: clsx_default("recharts-polar-grid-concentric-circle", props.className),
key: "circle-".concat(index3),
cx,
cy,
r: radius
}));
};
var ConcentricPolygon = function ConcentricPolygon2(props) {
var radius = props.radius, index3 = props.index;
var concentricPolygonProps = _objectSpread22(_objectSpread22({
stroke: "#ccc"
}, filterProps(props, false)), {}, {
fill: "none"
});
return import_react34.default.createElement("path", _extends18({}, concentricPolygonProps, {
className: clsx_default("recharts-polar-grid-concentric-polygon", props.className),
key: "path-".concat(index3),
d: getPolygonPath(radius, props.cx, props.cy, props.polarAngles)
}));
};
var ConcentricPath = function ConcentricPath2(props) {
var polarRadius = props.polarRadius, gridType = props.gridType;
if (!polarRadius || !polarRadius.length) {
return null;
}
return import_react34.default.createElement("g", {
className: "recharts-polar-grid-concentric"
}, polarRadius.map(function(entry, i) {
var key = i;
if (gridType === "circle") return import_react34.default.createElement(ConcentricCircle, _extends18({
key
}, props, {
radius: entry,
index: i
}));
return import_react34.default.createElement(ConcentricPolygon, _extends18({
key
}, props, {
radius: entry,
index: i
}));
}));
};
var PolarGrid = function PolarGrid2(_ref) {
var _ref$cx = _ref.cx, cx = _ref$cx === void 0 ? 0 : _ref$cx, _ref$cy = _ref.cy, cy = _ref$cy === void 0 ? 0 : _ref$cy, _ref$innerRadius = _ref.innerRadius, innerRadius = _ref$innerRadius === void 0 ? 0 : _ref$innerRadius, _ref$outerRadius = _ref.outerRadius, outerRadius = _ref$outerRadius === void 0 ? 0 : _ref$outerRadius, _ref$gridType = _ref.gridType, gridType = _ref$gridType === void 0 ? "polygon" : _ref$gridType, _ref$radialLines = _ref.radialLines, radialLines = _ref$radialLines === void 0 ? true : _ref$radialLines, props = _objectWithoutProperties15(_ref, _excluded16);
if (outerRadius <= 0) {
return null;
}
return import_react34.default.createElement("g", {
className: "recharts-polar-grid"
}, import_react34.default.createElement(PolarAngles, _extends18({
cx,
cy,
innerRadius,
outerRadius,
gridType,
radialLines
}, props)), import_react34.default.createElement(ConcentricPath, _extends18({
cx,
cy,
innerRadius,
outerRadius,
gridType,
radialLines
}, props)));
};
PolarGrid.displayName = "PolarGrid";
// node_modules/recharts/es6/polar/PolarRadiusAxis.js
var import_react35 = __toESM(require_react());
var import_maxBy = __toESM(require_maxBy());
var import_minBy = __toESM(require_minBy());
var import_isFunction10 = __toESM(require_isFunction());
var _excluded17 = ["cx", "cy", "angle", "ticks", "axisLine"];
var _excluded24 = ["ticks", "tick", "angle", "tickFormatter", "stroke"];
function _typeof30(o) {
"@babel/helpers - typeof";
return _typeof30 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof30(o);
}
function _extends19() {
_extends19 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends19.apply(this, arguments);
}
function ownKeys23(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread23(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys23(Object(t), true).forEach(function(r2) {
_defineProperty25(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys23(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _objectWithoutProperties16(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose17(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose17(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck9(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties9(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey26(descriptor.key), descriptor);
}
}
function _createClass9(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties9(Constructor.prototype, protoProps);
if (staticProps) _defineProperties9(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper6(t, o, e) {
return o = _getPrototypeOf8(o), _possibleConstructorReturn8(t, _isNativeReflectConstruct8() ? Reflect.construct(o, e || [], _getPrototypeOf8(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn8(self2, call) {
if (call && (_typeof30(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized9(self2);
}
function _assertThisInitialized9(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct8() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct8 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf8(o) {
_getPrototypeOf8 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf8(o);
}
function _inherits8(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf9(subClass, superClass);
}
function _setPrototypeOf9(o, p) {
_setPrototypeOf9 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf9(o, p);
}
function _defineProperty25(obj, key, value) {
key = _toPropertyKey26(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey26(t) {
var i = _toPrimitive26(t, "string");
return "symbol" == _typeof30(i) ? i : i + "";
}
function _toPrimitive26(t, r) {
if ("object" != _typeof30(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof30(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var PolarRadiusAxis = function(_PureComponent) {
function PolarRadiusAxis2() {
_classCallCheck9(this, PolarRadiusAxis2);
return _callSuper6(this, PolarRadiusAxis2, arguments);
}
_inherits8(PolarRadiusAxis2, _PureComponent);
return _createClass9(PolarRadiusAxis2, [{
key: "getTickValueCoord",
value: (
/**
* Calculate the coordinate of tick
* @param {Number} coordinate The radius of tick
* @return {Object} (x, y)
*/
function getTickValueCoord(_ref) {
var coordinate = _ref.coordinate;
var _this$props = this.props, angle = _this$props.angle, cx = _this$props.cx, cy = _this$props.cy;
return polarToCartesian(cx, cy, coordinate, angle);
}
)
}, {
key: "getTickTextAnchor",
value: function getTickTextAnchor() {
var orientation = this.props.orientation;
var textAnchor;
switch (orientation) {
case "left":
textAnchor = "end";
break;
case "right":
textAnchor = "start";
break;
default:
textAnchor = "middle";
break;
}
return textAnchor;
}
}, {
key: "getViewBox",
value: function getViewBox() {
var _this$props2 = this.props, cx = _this$props2.cx, cy = _this$props2.cy, angle = _this$props2.angle, ticks2 = _this$props2.ticks;
var maxRadiusTick = (0, import_maxBy.default)(ticks2, function(entry) {
return entry.coordinate || 0;
});
var minRadiusTick = (0, import_minBy.default)(ticks2, function(entry) {
return entry.coordinate || 0;
});
return {
cx,
cy,
startAngle: angle,
endAngle: angle,
innerRadius: minRadiusTick.coordinate || 0,
outerRadius: maxRadiusTick.coordinate || 0
};
}
}, {
key: "renderAxisLine",
value: function renderAxisLine() {
var _this$props3 = this.props, cx = _this$props3.cx, cy = _this$props3.cy, angle = _this$props3.angle, ticks2 = _this$props3.ticks, axisLine = _this$props3.axisLine, others = _objectWithoutProperties16(_this$props3, _excluded17);
var extent2 = ticks2.reduce(function(result, entry) {
return [Math.min(result[0], entry.coordinate), Math.max(result[1], entry.coordinate)];
}, [Infinity, -Infinity]);
var point0 = polarToCartesian(cx, cy, extent2[0], angle);
var point1 = polarToCartesian(cx, cy, extent2[1], angle);
var props = _objectSpread23(_objectSpread23(_objectSpread23({}, filterProps(others, false)), {}, {
fill: "none"
}, filterProps(axisLine, false)), {}, {
x1: point0.x,
y1: point0.y,
x2: point1.x,
y2: point1.y
});
return import_react35.default.createElement("line", _extends19({
className: "recharts-polar-radius-axis-line"
}, props));
}
}, {
key: "renderTicks",
value: function renderTicks() {
var _this = this;
var _this$props4 = this.props, ticks2 = _this$props4.ticks, tick = _this$props4.tick, angle = _this$props4.angle, tickFormatter = _this$props4.tickFormatter, stroke = _this$props4.stroke, others = _objectWithoutProperties16(_this$props4, _excluded24);
var textAnchor = this.getTickTextAnchor();
var axisProps = filterProps(others, false);
var customTickProps = filterProps(tick, false);
var items = ticks2.map(function(entry, i) {
var coord = _this.getTickValueCoord(entry);
var tickProps = _objectSpread23(_objectSpread23(_objectSpread23(_objectSpread23({
textAnchor,
transform: "rotate(".concat(90 - angle, ", ").concat(coord.x, ", ").concat(coord.y, ")")
}, axisProps), {}, {
stroke: "none",
fill: stroke
}, customTickProps), {}, {
index: i
}, coord), {}, {
payload: entry
});
return import_react35.default.createElement(Layer, _extends19({
className: clsx_default("recharts-polar-radius-axis-tick", getTickClassName(tick)),
key: "tick-".concat(entry.coordinate)
}, adaptEventsOfChild(_this.props, entry, i)), PolarRadiusAxis2.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value));
});
return import_react35.default.createElement(Layer, {
className: "recharts-polar-radius-axis-ticks"
}, items);
}
}, {
key: "render",
value: function render() {
var _this$props5 = this.props, ticks2 = _this$props5.ticks, axisLine = _this$props5.axisLine, tick = _this$props5.tick;
if (!ticks2 || !ticks2.length) {
return null;
}
return import_react35.default.createElement(Layer, {
className: clsx_default("recharts-polar-radius-axis", this.props.className)
}, axisLine && this.renderAxisLine(), tick && this.renderTicks(), Label.renderCallByParent(this.props, this.getViewBox()));
}
}], [{
key: "renderTickItem",
value: function renderTickItem(option, props, value) {
var tickItem;
if (import_react35.default.isValidElement(option)) {
tickItem = import_react35.default.cloneElement(option, props);
} else if ((0, import_isFunction10.default)(option)) {
tickItem = option(props);
} else {
tickItem = import_react35.default.createElement(Text, _extends19({}, props, {
className: "recharts-polar-radius-axis-tick-value"
}), value);
}
return tickItem;
}
}]);
}(import_react35.PureComponent);
_defineProperty25(PolarRadiusAxis, "displayName", "PolarRadiusAxis");
_defineProperty25(PolarRadiusAxis, "axisType", "radiusAxis");
_defineProperty25(PolarRadiusAxis, "defaultProps", {
type: "number",
radiusAxisId: 0,
cx: 0,
cy: 0,
angle: 0,
orientation: "right",
stroke: "#ccc",
axisLine: true,
tick: true,
tickCount: 5,
allowDataOverflow: false,
scale: "auto",
allowDuplicatedCategory: true
});
// node_modules/recharts/es6/polar/PolarAngleAxis.js
var import_react36 = __toESM(require_react());
var import_isFunction11 = __toESM(require_isFunction());
function _typeof31(o) {
"@babel/helpers - typeof";
return _typeof31 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof31(o);
}
function _extends20() {
_extends20 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends20.apply(this, arguments);
}
function ownKeys24(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread24(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys24(Object(t), true).forEach(function(r2) {
_defineProperty26(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys24(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck10(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties10(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey27(descriptor.key), descriptor);
}
}
function _createClass10(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties10(Constructor.prototype, protoProps);
if (staticProps) _defineProperties10(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper7(t, o, e) {
return o = _getPrototypeOf9(o), _possibleConstructorReturn9(t, _isNativeReflectConstruct9() ? Reflect.construct(o, e || [], _getPrototypeOf9(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn9(self2, call) {
if (call && (_typeof31(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized10(self2);
}
function _assertThisInitialized10(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct9() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct9 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf9(o) {
_getPrototypeOf9 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf9(o);
}
function _inherits9(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf10(subClass, superClass);
}
function _setPrototypeOf10(o, p) {
_setPrototypeOf10 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf10(o, p);
}
function _defineProperty26(obj, key, value) {
key = _toPropertyKey27(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey27(t) {
var i = _toPrimitive27(t, "string");
return "symbol" == _typeof31(i) ? i : i + "";
}
function _toPrimitive27(t, r) {
if ("object" != _typeof31(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof31(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var RADIAN3 = Math.PI / 180;
var eps = 1e-5;
var PolarAngleAxis = function(_PureComponent) {
function PolarAngleAxis2() {
_classCallCheck10(this, PolarAngleAxis2);
return _callSuper7(this, PolarAngleAxis2, arguments);
}
_inherits9(PolarAngleAxis2, _PureComponent);
return _createClass10(PolarAngleAxis2, [{
key: "getTickLineCoord",
value: (
/**
* Calculate the coordinate of line endpoint
* @param {Object} data The Data if ticks
* @return {Object} (x0, y0): The start point of text,
* (x1, y1): The end point close to text,
* (x2, y2): The end point close to axis
*/
function getTickLineCoord(data) {
var _this$props = this.props, cx = _this$props.cx, cy = _this$props.cy, radius = _this$props.radius, orientation = _this$props.orientation, tickSize = _this$props.tickSize;
var tickLineSize = tickSize || 8;
var p1 = polarToCartesian(cx, cy, radius, data.coordinate);
var p2 = polarToCartesian(cx, cy, radius + (orientation === "inner" ? -1 : 1) * tickLineSize, data.coordinate);
return {
x1: p1.x,
y1: p1.y,
x2: p2.x,
y2: p2.y
};
}
)
/**
* Get the text-anchor of each tick
* @param {Object} data Data of ticks
* @return {String} text-anchor
*/
}, {
key: "getTickTextAnchor",
value: function getTickTextAnchor(data) {
var orientation = this.props.orientation;
var cos2 = Math.cos(-data.coordinate * RADIAN3);
var textAnchor;
if (cos2 > eps) {
textAnchor = orientation === "outer" ? "start" : "end";
} else if (cos2 < -eps) {
textAnchor = orientation === "outer" ? "end" : "start";
} else {
textAnchor = "middle";
}
return textAnchor;
}
}, {
key: "renderAxisLine",
value: function renderAxisLine() {
var _this$props2 = this.props, cx = _this$props2.cx, cy = _this$props2.cy, radius = _this$props2.radius, axisLine = _this$props2.axisLine, axisLineType = _this$props2.axisLineType;
var props = _objectSpread24(_objectSpread24({}, filterProps(this.props, false)), {}, {
fill: "none"
}, filterProps(axisLine, false));
if (axisLineType === "circle") {
return import_react36.default.createElement(Dot, _extends20({
className: "recharts-polar-angle-axis-line"
}, props, {
cx,
cy,
r: radius
}));
}
var ticks2 = this.props.ticks;
var points = ticks2.map(function(entry) {
return polarToCartesian(cx, cy, radius, entry.coordinate);
});
return import_react36.default.createElement(Polygon, _extends20({
className: "recharts-polar-angle-axis-line"
}, props, {
points
}));
}
}, {
key: "renderTicks",
value: function renderTicks() {
var _this = this;
var _this$props3 = this.props, ticks2 = _this$props3.ticks, tick = _this$props3.tick, tickLine = _this$props3.tickLine, tickFormatter = _this$props3.tickFormatter, stroke = _this$props3.stroke;
var axisProps = filterProps(this.props, false);
var customTickProps = filterProps(tick, false);
var tickLineProps = _objectSpread24(_objectSpread24({}, axisProps), {}, {
fill: "none"
}, filterProps(tickLine, false));
var items = ticks2.map(function(entry, i) {
var lineCoord = _this.getTickLineCoord(entry);
var textAnchor = _this.getTickTextAnchor(entry);
var tickProps = _objectSpread24(_objectSpread24(_objectSpread24({
textAnchor
}, axisProps), {}, {
stroke: "none",
fill: stroke
}, customTickProps), {}, {
index: i,
payload: entry,
x: lineCoord.x2,
y: lineCoord.y2
});
return import_react36.default.createElement(Layer, _extends20({
className: clsx_default("recharts-polar-angle-axis-tick", getTickClassName(tick)),
key: "tick-".concat(entry.coordinate)
}, adaptEventsOfChild(_this.props, entry, i)), tickLine && import_react36.default.createElement("line", _extends20({
className: "recharts-polar-angle-axis-tick-line"
}, tickLineProps, lineCoord)), tick && PolarAngleAxis2.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value));
});
return import_react36.default.createElement(Layer, {
className: "recharts-polar-angle-axis-ticks"
}, items);
}
}, {
key: "render",
value: function render() {
var _this$props4 = this.props, ticks2 = _this$props4.ticks, radius = _this$props4.radius, axisLine = _this$props4.axisLine;
if (radius <= 0 || !ticks2 || !ticks2.length) {
return null;
}
return import_react36.default.createElement(Layer, {
className: clsx_default("recharts-polar-angle-axis", this.props.className)
}, axisLine && this.renderAxisLine(), this.renderTicks());
}
}], [{
key: "renderTickItem",
value: function renderTickItem(option, props, value) {
var tickItem;
if (import_react36.default.isValidElement(option)) {
tickItem = import_react36.default.cloneElement(option, props);
} else if ((0, import_isFunction11.default)(option)) {
tickItem = option(props);
} else {
tickItem = import_react36.default.createElement(Text, _extends20({}, props, {
className: "recharts-polar-angle-axis-tick-value"
}), value);
}
return tickItem;
}
}]);
}(import_react36.PureComponent);
_defineProperty26(PolarAngleAxis, "displayName", "PolarAngleAxis");
_defineProperty26(PolarAngleAxis, "axisType", "angleAxis");
_defineProperty26(PolarAngleAxis, "defaultProps", {
type: "category",
angleAxisId: 0,
scale: "auto",
cx: 0,
cy: 0,
orientation: "outer",
axisLine: true,
tickLine: true,
tickSize: 8,
tick: true,
hide: false,
allowDuplicatedCategory: true
});
// node_modules/recharts/es6/polar/Pie.js
var import_react39 = __toESM(require_react());
var import_get4 = __toESM(require_get());
var import_isEqual3 = __toESM(require_isEqual());
var import_isNil8 = __toESM(require_isNil());
var import_isFunction13 = __toESM(require_isFunction());
// node_modules/recharts/es6/util/ActiveShapeUtils.js
var import_react38 = __toESM(require_react());
var import_isFunction12 = __toESM(require_isFunction());
var import_isPlainObject = __toESM(require_isPlainObject());
var import_isBoolean = __toESM(require_isBoolean());
var import_isEqual2 = __toESM(require_isEqual());
// node_modules/recharts/es6/shape/Trapezoid.js
var import_react37 = __toESM(require_react());
function _typeof32(o) {
"@babel/helpers - typeof";
return _typeof32 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof32(o);
}
function _extends21() {
_extends21 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends21.apply(this, arguments);
}
function _slicedToArray11(arr, i) {
return _arrayWithHoles12(arr) || _iterableToArrayLimit11(arr, i) || _unsupportedIterableToArray18(arr, i) || _nonIterableRest12();
}
function _nonIterableRest12() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray18(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray18(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray18(o, minLen);
}
function _arrayLikeToArray18(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _iterableToArrayLimit11(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e, n, i, u, a2 = [], f = true, o = false;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = false;
} else for (; !(f = (e = i.call(t)).done) && (a2.push(e.value), a2.length !== l); f = true) ;
} catch (r2) {
o = true, n = r2;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a2;
}
}
function _arrayWithHoles12(arr) {
if (Array.isArray(arr)) return arr;
}
function ownKeys25(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread25(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys25(Object(t), true).forEach(function(r2) {
_defineProperty27(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys25(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty27(obj, key, value) {
key = _toPropertyKey28(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey28(t) {
var i = _toPrimitive28(t, "string");
return "symbol" == _typeof32(i) ? i : i + "";
}
function _toPrimitive28(t, r) {
if ("object" != _typeof32(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof32(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var getTrapezoidPath = function getTrapezoidPath2(x2, y2, upperWidth, lowerWidth, height) {
var widthGap = upperWidth - lowerWidth;
var path2;
path2 = "M ".concat(x2, ",").concat(y2);
path2 += "L ".concat(x2 + upperWidth, ",").concat(y2);
path2 += "L ".concat(x2 + upperWidth - widthGap / 2, ",").concat(y2 + height);
path2 += "L ".concat(x2 + upperWidth - widthGap / 2 - lowerWidth, ",").concat(y2 + height);
path2 += "L ".concat(x2, ",").concat(y2, " Z");
return path2;
};
var defaultProps4 = {
x: 0,
y: 0,
upperWidth: 0,
lowerWidth: 0,
height: 0,
isUpdateAnimationActive: false,
animationBegin: 0,
animationDuration: 1500,
animationEasing: "ease"
};
var Trapezoid = function Trapezoid2(props) {
var trapezoidProps = _objectSpread25(_objectSpread25({}, defaultProps4), props);
var pathRef = (0, import_react37.useRef)();
var _useState = (0, import_react37.useState)(-1), _useState2 = _slicedToArray11(_useState, 2), totalLength = _useState2[0], setTotalLength = _useState2[1];
(0, import_react37.useEffect)(function() {
if (pathRef.current && pathRef.current.getTotalLength) {
try {
var pathTotalLength = pathRef.current.getTotalLength();
if (pathTotalLength) {
setTotalLength(pathTotalLength);
}
} catch (err) {
}
}
}, []);
var x2 = trapezoidProps.x, y2 = trapezoidProps.y, upperWidth = trapezoidProps.upperWidth, lowerWidth = trapezoidProps.lowerWidth, height = trapezoidProps.height, className = trapezoidProps.className;
var animationEasing = trapezoidProps.animationEasing, animationDuration = trapezoidProps.animationDuration, animationBegin = trapezoidProps.animationBegin, isUpdateAnimationActive = trapezoidProps.isUpdateAnimationActive;
if (x2 !== +x2 || y2 !== +y2 || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || upperWidth === 0 && lowerWidth === 0 || height === 0) {
return null;
}
var layerClass = clsx_default("recharts-trapezoid", className);
if (!isUpdateAnimationActive) {
return import_react37.default.createElement("g", null, import_react37.default.createElement("path", _extends21({}, filterProps(trapezoidProps, true), {
className: layerClass,
d: getTrapezoidPath(x2, y2, upperWidth, lowerWidth, height)
})));
}
return import_react37.default.createElement(es6_default, {
canBegin: totalLength > 0,
from: {
upperWidth: 0,
lowerWidth: 0,
height,
x: x2,
y: y2
},
to: {
upperWidth,
lowerWidth,
height,
x: x2,
y: y2
},
duration: animationDuration,
animationEasing,
isActive: isUpdateAnimationActive
}, function(_ref) {
var currUpperWidth = _ref.upperWidth, currLowerWidth = _ref.lowerWidth, currHeight = _ref.height, currX = _ref.x, currY = _ref.y;
return import_react37.default.createElement(es6_default, {
canBegin: totalLength > 0,
from: "0px ".concat(totalLength === -1 ? 1 : totalLength, "px"),
to: "".concat(totalLength, "px 0px"),
attributeName: "strokeDasharray",
begin: animationBegin,
duration: animationDuration,
easing: animationEasing
}, import_react37.default.createElement("path", _extends21({}, filterProps(trapezoidProps, true), {
className: layerClass,
d: getTrapezoidPath(currX, currY, currUpperWidth, currLowerWidth, currHeight),
ref: pathRef
})));
});
};
// node_modules/recharts/es6/util/ActiveShapeUtils.js
var _excluded18 = ["option", "shapeType", "propTransformer", "activeClassName", "isActive"];
function _typeof33(o) {
"@babel/helpers - typeof";
return _typeof33 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof33(o);
}
function _objectWithoutProperties17(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose18(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose18(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function ownKeys26(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread26(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys26(Object(t), true).forEach(function(r2) {
_defineProperty28(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys26(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty28(obj, key, value) {
key = _toPropertyKey29(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey29(t) {
var i = _toPrimitive29(t, "string");
return "symbol" == _typeof33(i) ? i : i + "";
}
function _toPrimitive29(t, r) {
if ("object" != _typeof33(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof33(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function defaultPropTransformer(option, props) {
return _objectSpread26(_objectSpread26({}, props), option);
}
function isSymbolsProps(shapeType, _elementProps) {
return shapeType === "symbols";
}
function ShapeSelector(_ref) {
var shapeType = _ref.shapeType, elementProps = _ref.elementProps;
switch (shapeType) {
case "rectangle":
return import_react38.default.createElement(Rectangle, elementProps);
case "trapezoid":
return import_react38.default.createElement(Trapezoid, elementProps);
case "sector":
return import_react38.default.createElement(Sector, elementProps);
case "symbols":
if (isSymbolsProps(shapeType, elementProps)) {
return import_react38.default.createElement(Symbols, elementProps);
}
break;
default:
return null;
}
}
function getPropsFromShapeOption(option) {
if ((0, import_react38.isValidElement)(option)) {
return option.props;
}
return option;
}
function Shape(_ref2) {
var option = _ref2.option, shapeType = _ref2.shapeType, _ref2$propTransformer = _ref2.propTransformer, propTransformer = _ref2$propTransformer === void 0 ? defaultPropTransformer : _ref2$propTransformer, _ref2$activeClassName = _ref2.activeClassName, activeClassName = _ref2$activeClassName === void 0 ? "recharts-active-shape" : _ref2$activeClassName, isActive = _ref2.isActive, props = _objectWithoutProperties17(_ref2, _excluded18);
var shape;
if ((0, import_react38.isValidElement)(option)) {
shape = (0, import_react38.cloneElement)(option, _objectSpread26(_objectSpread26({}, props), getPropsFromShapeOption(option)));
} else if ((0, import_isFunction12.default)(option)) {
shape = option(props);
} else if ((0, import_isPlainObject.default)(option) && !(0, import_isBoolean.default)(option)) {
var nextProps = propTransformer(option, props);
shape = import_react38.default.createElement(ShapeSelector, {
shapeType,
elementProps: nextProps
});
} else {
var elementProps = props;
shape = import_react38.default.createElement(ShapeSelector, {
shapeType,
elementProps
});
}
if (isActive) {
return import_react38.default.createElement(Layer, {
className: activeClassName
}, shape);
}
return shape;
}
function isFunnel(graphicalItem, _item) {
return _item != null && "trapezoids" in graphicalItem.props;
}
function isPie(graphicalItem, _item) {
return _item != null && "sectors" in graphicalItem.props;
}
function isScatter(graphicalItem, _item) {
return _item != null && "points" in graphicalItem.props;
}
function compareFunnel(shapeData, activeTooltipItem) {
var _activeTooltipItem$la, _activeTooltipItem$la2;
var xMatches = shapeData.x === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la === void 0 ? void 0 : _activeTooltipItem$la.x) || shapeData.x === activeTooltipItem.x;
var yMatches = shapeData.y === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la2 = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la2 === void 0 ? void 0 : _activeTooltipItem$la2.y) || shapeData.y === activeTooltipItem.y;
return xMatches && yMatches;
}
function comparePie(shapeData, activeTooltipItem) {
var startAngleMatches = shapeData.endAngle === activeTooltipItem.endAngle;
var endAngleMatches = shapeData.startAngle === activeTooltipItem.startAngle;
return startAngleMatches && endAngleMatches;
}
function compareScatter(shapeData, activeTooltipItem) {
var xMatches = shapeData.x === activeTooltipItem.x;
var yMatches = shapeData.y === activeTooltipItem.y;
var zMatches = shapeData.z === activeTooltipItem.z;
return xMatches && yMatches && zMatches;
}
function getComparisonFn(graphicalItem, activeItem) {
var comparison;
if (isFunnel(graphicalItem, activeItem)) {
comparison = compareFunnel;
} else if (isPie(graphicalItem, activeItem)) {
comparison = comparePie;
} else if (isScatter(graphicalItem, activeItem)) {
comparison = compareScatter;
}
return comparison;
}
function getShapeDataKey(graphicalItem, activeItem) {
var shapeKey;
if (isFunnel(graphicalItem, activeItem)) {
shapeKey = "trapezoids";
} else if (isPie(graphicalItem, activeItem)) {
shapeKey = "sectors";
} else if (isScatter(graphicalItem, activeItem)) {
shapeKey = "points";
}
return shapeKey;
}
function getActiveShapeTooltipPayload(graphicalItem, activeItem) {
if (isFunnel(graphicalItem, activeItem)) {
var _activeItem$tooltipPa;
return (_activeItem$tooltipPa = activeItem.tooltipPayload) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa[0]) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa.payload) === null || _activeItem$tooltipPa === void 0 ? void 0 : _activeItem$tooltipPa.payload;
}
if (isPie(graphicalItem, activeItem)) {
var _activeItem$tooltipPa2;
return (_activeItem$tooltipPa2 = activeItem.tooltipPayload) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2[0]) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2.payload) === null || _activeItem$tooltipPa2 === void 0 ? void 0 : _activeItem$tooltipPa2.payload;
}
if (isScatter(graphicalItem, activeItem)) {
return activeItem.payload;
}
return {};
}
function getActiveShapeIndexForTooltip(_ref3) {
var activeTooltipItem = _ref3.activeTooltipItem, graphicalItem = _ref3.graphicalItem, itemData = _ref3.itemData;
var shapeKey = getShapeDataKey(graphicalItem, activeTooltipItem);
var tooltipPayload = getActiveShapeTooltipPayload(graphicalItem, activeTooltipItem);
var activeItemMatches = itemData.filter(function(datum, dataIndex) {
var valuesMatch = (0, import_isEqual2.default)(tooltipPayload, datum);
var mouseCoordinateMatches = graphicalItem.props[shapeKey].filter(function(shapeData) {
var comparison = getComparisonFn(graphicalItem, activeTooltipItem);
return comparison(shapeData, activeTooltipItem);
});
var indexOfMouseCoordinates = graphicalItem.props[shapeKey].indexOf(mouseCoordinateMatches[mouseCoordinateMatches.length - 1]);
var coordinatesMatch = dataIndex === indexOfMouseCoordinates;
return valuesMatch && coordinatesMatch;
});
var activeIndex = itemData.indexOf(activeItemMatches[activeItemMatches.length - 1]);
return activeIndex;
}
// node_modules/recharts/es6/polar/Pie.js
var _Pie;
function _typeof34(o) {
"@babel/helpers - typeof";
return _typeof34 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof34(o);
}
function _extends22() {
_extends22 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends22.apply(this, arguments);
}
function ownKeys27(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread27(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys27(Object(t), true).forEach(function(r2) {
_defineProperty29(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys27(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck11(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties11(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey30(descriptor.key), descriptor);
}
}
function _createClass11(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties11(Constructor.prototype, protoProps);
if (staticProps) _defineProperties11(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper8(t, o, e) {
return o = _getPrototypeOf10(o), _possibleConstructorReturn10(t, _isNativeReflectConstruct10() ? Reflect.construct(o, e || [], _getPrototypeOf10(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn10(self2, call) {
if (call && (_typeof34(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized11(self2);
}
function _assertThisInitialized11(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct10() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct10 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf10(o) {
_getPrototypeOf10 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf10(o);
}
function _inherits10(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf11(subClass, superClass);
}
function _setPrototypeOf11(o, p) {
_setPrototypeOf11 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf11(o, p);
}
function _defineProperty29(obj, key, value) {
key = _toPropertyKey30(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey30(t) {
var i = _toPrimitive30(t, "string");
return "symbol" == _typeof34(i) ? i : i + "";
}
function _toPrimitive30(t, r) {
if ("object" != _typeof34(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof34(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Pie = function(_PureComponent) {
function Pie2(props) {
var _this;
_classCallCheck11(this, Pie2);
_this = _callSuper8(this, Pie2, [props]);
_defineProperty29(_this, "pieRef", null);
_defineProperty29(_this, "sectorRefs", []);
_defineProperty29(_this, "id", uniqueId("recharts-pie-"));
_defineProperty29(_this, "handleAnimationEnd", function() {
var onAnimationEnd2 = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if ((0, import_isFunction13.default)(onAnimationEnd2)) {
onAnimationEnd2();
}
});
_defineProperty29(_this, "handleAnimationStart", function() {
var onAnimationStart2 = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if ((0, import_isFunction13.default)(onAnimationStart2)) {
onAnimationStart2();
}
});
_this.state = {
isAnimationFinished: !props.isAnimationActive,
prevIsAnimationActive: props.isAnimationActive,
prevAnimationId: props.animationId,
sectorToFocus: 0
};
return _this;
}
_inherits10(Pie2, _PureComponent);
return _createClass11(Pie2, [{
key: "isActiveIndex",
value: function isActiveIndex(i) {
var activeIndex = this.props.activeIndex;
if (Array.isArray(activeIndex)) {
return activeIndex.indexOf(i) !== -1;
}
return i === activeIndex;
}
}, {
key: "hasActiveIndex",
value: function hasActiveIndex() {
var activeIndex = this.props.activeIndex;
return Array.isArray(activeIndex) ? activeIndex.length !== 0 : activeIndex || activeIndex === 0;
}
}, {
key: "renderLabels",
value: function renderLabels(sectors) {
var isAnimationActive = this.props.isAnimationActive;
if (isAnimationActive && !this.state.isAnimationFinished) {
return null;
}
var _this$props = this.props, label = _this$props.label, labelLine = _this$props.labelLine, dataKey = _this$props.dataKey, valueKey = _this$props.valueKey;
var pieProps = filterProps(this.props, false);
var customLabelProps = filterProps(label, false);
var customLabelLineProps = filterProps(labelLine, false);
var offsetRadius = label && label.offsetRadius || 20;
var labels = sectors.map(function(entry, i) {
var midAngle = (entry.startAngle + entry.endAngle) / 2;
var endPoint = polarToCartesian(entry.cx, entry.cy, entry.outerRadius + offsetRadius, midAngle);
var labelProps = _objectSpread27(_objectSpread27(_objectSpread27(_objectSpread27({}, pieProps), entry), {}, {
stroke: "none"
}, customLabelProps), {}, {
index: i,
textAnchor: Pie2.getTextAnchor(endPoint.x, entry.cx)
}, endPoint);
var lineProps = _objectSpread27(_objectSpread27(_objectSpread27(_objectSpread27({}, pieProps), entry), {}, {
fill: "none",
stroke: entry.fill
}, customLabelLineProps), {}, {
index: i,
points: [polarToCartesian(entry.cx, entry.cy, entry.outerRadius, midAngle), endPoint]
});
var realDataKey = dataKey;
if ((0, import_isNil8.default)(dataKey) && (0, import_isNil8.default)(valueKey)) {
realDataKey = "value";
} else if ((0, import_isNil8.default)(dataKey)) {
realDataKey = valueKey;
}
return (
// eslint-disable-next-line react/no-array-index-key
import_react39.default.createElement(Layer, {
key: "label-".concat(entry.startAngle, "-").concat(entry.endAngle, "-").concat(entry.midAngle, "-").concat(i)
}, labelLine && Pie2.renderLabelLineItem(labelLine, lineProps, "line"), Pie2.renderLabelItem(label, labelProps, getValueByDataKey(entry, realDataKey)))
);
});
return import_react39.default.createElement(Layer, {
className: "recharts-pie-labels"
}, labels);
}
}, {
key: "renderSectorsStatically",
value: function renderSectorsStatically(sectors) {
var _this2 = this;
var _this$props2 = this.props, activeShape = _this$props2.activeShape, blendStroke = _this$props2.blendStroke, inactiveShapeProp = _this$props2.inactiveShape;
return sectors.map(function(entry, i) {
if ((entry === null || entry === void 0 ? void 0 : entry.startAngle) === 0 && (entry === null || entry === void 0 ? void 0 : entry.endAngle) === 0 && sectors.length !== 1) return null;
var isActive = _this2.isActiveIndex(i);
var inactiveShape = inactiveShapeProp && _this2.hasActiveIndex() ? inactiveShapeProp : null;
var sectorOptions = isActive ? activeShape : inactiveShape;
var sectorProps = _objectSpread27(_objectSpread27({}, entry), {}, {
stroke: blendStroke ? entry.fill : entry.stroke,
tabIndex: -1
});
return import_react39.default.createElement(Layer, _extends22({
ref: function ref(_ref) {
if (_ref && !_this2.sectorRefs.includes(_ref)) {
_this2.sectorRefs.push(_ref);
}
},
tabIndex: -1,
className: "recharts-pie-sector"
}, adaptEventsOfChild(_this2.props, entry, i), {
// eslint-disable-next-line react/no-array-index-key
key: "sector-".concat(entry === null || entry === void 0 ? void 0 : entry.startAngle, "-").concat(entry === null || entry === void 0 ? void 0 : entry.endAngle, "-").concat(entry.midAngle, "-").concat(i)
}), import_react39.default.createElement(Shape, _extends22({
option: sectorOptions,
isActive,
shapeType: "sector"
}, sectorProps)));
});
}
}, {
key: "renderSectorsWithAnimation",
value: function renderSectorsWithAnimation() {
var _this3 = this;
var _this$props3 = this.props, sectors = _this$props3.sectors, isAnimationActive = _this$props3.isAnimationActive, animationBegin = _this$props3.animationBegin, animationDuration = _this$props3.animationDuration, animationEasing = _this$props3.animationEasing, animationId = _this$props3.animationId;
var _this$state = this.state, prevSectors = _this$state.prevSectors, prevIsAnimationActive = _this$state.prevIsAnimationActive;
return import_react39.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "pie-".concat(animationId, "-").concat(prevIsAnimationActive),
onAnimationStart: this.handleAnimationStart,
onAnimationEnd: this.handleAnimationEnd
}, function(_ref2) {
var t = _ref2.t;
var stepData = [];
var first2 = sectors && sectors[0];
var curAngle = first2.startAngle;
sectors.forEach(function(entry, index3) {
var prev = prevSectors && prevSectors[index3];
var paddingAngle = index3 > 0 ? (0, import_get4.default)(entry, "paddingAngle", 0) : 0;
if (prev) {
var angleIp = interpolateNumber(prev.endAngle - prev.startAngle, entry.endAngle - entry.startAngle);
var latest = _objectSpread27(_objectSpread27({}, entry), {}, {
startAngle: curAngle + paddingAngle,
endAngle: curAngle + angleIp(t) + paddingAngle
});
stepData.push(latest);
curAngle = latest.endAngle;
} else {
var endAngle = entry.endAngle, startAngle = entry.startAngle;
var interpolatorAngle = interpolateNumber(0, endAngle - startAngle);
var deltaAngle = interpolatorAngle(t);
var _latest = _objectSpread27(_objectSpread27({}, entry), {}, {
startAngle: curAngle + paddingAngle,
endAngle: curAngle + deltaAngle + paddingAngle
});
stepData.push(_latest);
curAngle = _latest.endAngle;
}
});
return import_react39.default.createElement(Layer, null, _this3.renderSectorsStatically(stepData));
});
}
}, {
key: "attachKeyboardHandlers",
value: function attachKeyboardHandlers(pieRef) {
var _this4 = this;
pieRef.onkeydown = function(e) {
if (!e.altKey) {
switch (e.key) {
case "ArrowLeft": {
var next = ++_this4.state.sectorToFocus % _this4.sectorRefs.length;
_this4.sectorRefs[next].focus();
_this4.setState({
sectorToFocus: next
});
break;
}
case "ArrowRight": {
var _next = --_this4.state.sectorToFocus < 0 ? _this4.sectorRefs.length - 1 : _this4.state.sectorToFocus % _this4.sectorRefs.length;
_this4.sectorRefs[_next].focus();
_this4.setState({
sectorToFocus: _next
});
break;
}
case "Escape": {
_this4.sectorRefs[_this4.state.sectorToFocus].blur();
_this4.setState({
sectorToFocus: 0
});
break;
}
default: {
}
}
}
};
}
}, {
key: "renderSectors",
value: function renderSectors() {
var _this$props4 = this.props, sectors = _this$props4.sectors, isAnimationActive = _this$props4.isAnimationActive;
var prevSectors = this.state.prevSectors;
if (isAnimationActive && sectors && sectors.length && (!prevSectors || !(0, import_isEqual3.default)(prevSectors, sectors))) {
return this.renderSectorsWithAnimation();
}
return this.renderSectorsStatically(sectors);
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
if (this.pieRef) {
this.attachKeyboardHandlers(this.pieRef);
}
}
}, {
key: "render",
value: function render() {
var _this5 = this;
var _this$props5 = this.props, hide = _this$props5.hide, sectors = _this$props5.sectors, className = _this$props5.className, label = _this$props5.label, cx = _this$props5.cx, cy = _this$props5.cy, innerRadius = _this$props5.innerRadius, outerRadius = _this$props5.outerRadius, isAnimationActive = _this$props5.isAnimationActive;
var isAnimationFinished = this.state.isAnimationFinished;
if (hide || !sectors || !sectors.length || !isNumber(cx) || !isNumber(cy) || !isNumber(innerRadius) || !isNumber(outerRadius)) {
return null;
}
var layerClass = clsx_default("recharts-pie", className);
return import_react39.default.createElement(Layer, {
tabIndex: this.props.rootTabIndex,
className: layerClass,
ref: function ref(_ref3) {
_this5.pieRef = _ref3;
}
}, this.renderSectors(), label && this.renderLabels(sectors), Label.renderCallByParent(this.props, null, false), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, sectors, false));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (prevState.prevIsAnimationActive !== nextProps.isAnimationActive) {
return {
prevIsAnimationActive: nextProps.isAnimationActive,
prevAnimationId: nextProps.animationId,
curSectors: nextProps.sectors,
prevSectors: [],
isAnimationFinished: true
};
}
if (nextProps.isAnimationActive && nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curSectors: nextProps.sectors,
prevSectors: prevState.curSectors,
isAnimationFinished: true
};
}
if (nextProps.sectors !== prevState.curSectors) {
return {
curSectors: nextProps.sectors,
isAnimationFinished: true
};
}
return null;
}
}, {
key: "getTextAnchor",
value: function getTextAnchor(x2, cx) {
if (x2 > cx) {
return "start";
}
if (x2 < cx) {
return "end";
}
return "middle";
}
}, {
key: "renderLabelLineItem",
value: function renderLabelLineItem(option, props, key) {
if (import_react39.default.isValidElement(option)) {
return import_react39.default.cloneElement(option, props);
}
if ((0, import_isFunction13.default)(option)) {
return option(props);
}
var className = clsx_default("recharts-pie-label-line", typeof option !== "boolean" ? option.className : "");
return import_react39.default.createElement(Curve, _extends22({}, props, {
key,
type: "linear",
className
}));
}
}, {
key: "renderLabelItem",
value: function renderLabelItem(option, props, value) {
if (import_react39.default.isValidElement(option)) {
return import_react39.default.cloneElement(option, props);
}
var label = value;
if ((0, import_isFunction13.default)(option)) {
label = option(props);
if (import_react39.default.isValidElement(label)) {
return label;
}
}
var className = clsx_default("recharts-pie-label-text", typeof option !== "boolean" && !(0, import_isFunction13.default)(option) ? option.className : "");
return import_react39.default.createElement(Text, _extends22({}, props, {
alignmentBaseline: "middle",
className
}), label);
}
}]);
}(import_react39.PureComponent);
_Pie = Pie;
_defineProperty29(Pie, "displayName", "Pie");
_defineProperty29(Pie, "defaultProps", {
stroke: "#fff",
fill: "#808080",
legendType: "rect",
cx: "50%",
cy: "50%",
startAngle: 0,
endAngle: 360,
innerRadius: 0,
outerRadius: "80%",
paddingAngle: 0,
labelLine: true,
hide: false,
minAngle: 0,
isAnimationActive: !Global.isSsr,
animationBegin: 400,
animationDuration: 1500,
animationEasing: "ease",
nameKey: "name",
blendStroke: false,
rootTabIndex: 0
});
_defineProperty29(Pie, "parseDeltaAngle", function(startAngle, endAngle) {
var sign2 = mathSign(endAngle - startAngle);
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
return sign2 * deltaAngle;
});
_defineProperty29(Pie, "getRealPieData", function(itemProps) {
var data = itemProps.data, children2 = itemProps.children;
var presentationProps = filterProps(itemProps, false);
var cells = findAllByType(children2, Cell);
if (data && data.length) {
return data.map(function(entry, index3) {
return _objectSpread27(_objectSpread27(_objectSpread27({
payload: entry
}, presentationProps), entry), cells && cells[index3] && cells[index3].props);
});
}
if (cells && cells.length) {
return cells.map(function(cell) {
return _objectSpread27(_objectSpread27({}, presentationProps), cell.props);
});
}
return [];
});
_defineProperty29(Pie, "parseCoordinateOfPie", function(itemProps, offset) {
var top = offset.top, left = offset.left, width = offset.width, height = offset.height;
var maxPieRadius = getMaxRadius(width, height);
var cx = left + getPercentValue(itemProps.cx, width, width / 2);
var cy = top + getPercentValue(itemProps.cy, height, height / 2);
var innerRadius = getPercentValue(itemProps.innerRadius, maxPieRadius, 0);
var outerRadius = getPercentValue(itemProps.outerRadius, maxPieRadius, maxPieRadius * 0.8);
var maxRadius = itemProps.maxRadius || Math.sqrt(width * width + height * height) / 2;
return {
cx,
cy,
innerRadius,
outerRadius,
maxRadius
};
});
_defineProperty29(Pie, "getComposedData", function(_ref4) {
var item = _ref4.item, offset = _ref4.offset;
var itemProps = item.type.defaultProps !== void 0 ? _objectSpread27(_objectSpread27({}, item.type.defaultProps), item.props) : item.props;
var pieData = _Pie.getRealPieData(itemProps);
if (!pieData || !pieData.length) {
return null;
}
var cornerRadius = itemProps.cornerRadius, startAngle = itemProps.startAngle, endAngle = itemProps.endAngle, paddingAngle = itemProps.paddingAngle, dataKey = itemProps.dataKey, nameKey = itemProps.nameKey, valueKey = itemProps.valueKey, tooltipType = itemProps.tooltipType;
var minAngle = Math.abs(itemProps.minAngle);
var coordinate = _Pie.parseCoordinateOfPie(itemProps, offset);
var deltaAngle = _Pie.parseDeltaAngle(startAngle, endAngle);
var absDeltaAngle = Math.abs(deltaAngle);
var realDataKey = dataKey;
if ((0, import_isNil8.default)(dataKey) && (0, import_isNil8.default)(valueKey)) {
warn(false, 'Use "dataKey" to specify the value of pie,\n the props "valueKey" will be deprecated in 1.1.0');
realDataKey = "value";
} else if ((0, import_isNil8.default)(dataKey)) {
warn(false, 'Use "dataKey" to specify the value of pie,\n the props "valueKey" will be deprecated in 1.1.0');
realDataKey = valueKey;
}
var notZeroItemCount = pieData.filter(function(entry) {
return getValueByDataKey(entry, realDataKey, 0) !== 0;
}).length;
var totalPadingAngle = (absDeltaAngle >= 360 ? notZeroItemCount : notZeroItemCount - 1) * paddingAngle;
var realTotalAngle = absDeltaAngle - notZeroItemCount * minAngle - totalPadingAngle;
var sum4 = pieData.reduce(function(result, entry) {
var val = getValueByDataKey(entry, realDataKey, 0);
return result + (isNumber(val) ? val : 0);
}, 0);
var sectors;
if (sum4 > 0) {
var prev;
sectors = pieData.map(function(entry, i) {
var val = getValueByDataKey(entry, realDataKey, 0);
var name = getValueByDataKey(entry, nameKey, i);
var percent = (isNumber(val) ? val : 0) / sum4;
var tempStartAngle;
if (i) {
tempStartAngle = prev.endAngle + mathSign(deltaAngle) * paddingAngle * (val !== 0 ? 1 : 0);
} else {
tempStartAngle = startAngle;
}
var tempEndAngle = tempStartAngle + mathSign(deltaAngle) * ((val !== 0 ? minAngle : 0) + percent * realTotalAngle);
var midAngle = (tempStartAngle + tempEndAngle) / 2;
var middleRadius = (coordinate.innerRadius + coordinate.outerRadius) / 2;
var tooltipPayload = [{
name,
value: val,
payload: entry,
dataKey: realDataKey,
type: tooltipType
}];
var tooltipPosition = polarToCartesian(coordinate.cx, coordinate.cy, middleRadius, midAngle);
prev = _objectSpread27(_objectSpread27(_objectSpread27({
percent,
cornerRadius,
name,
tooltipPayload,
midAngle,
middleRadius,
tooltipPosition
}, entry), coordinate), {}, {
value: getValueByDataKey(entry, realDataKey),
startAngle: tempStartAngle,
endAngle: tempEndAngle,
payload: entry,
paddingAngle: mathSign(deltaAngle) * paddingAngle
});
return prev;
});
}
return _objectSpread27(_objectSpread27({}, coordinate), {}, {
sectors,
data: pieData
});
});
// node_modules/recharts/es6/polar/Radar.js
var import_react40 = __toESM(require_react());
var import_isNil9 = __toESM(require_isNil());
var import_last2 = __toESM(require_last());
var import_first = __toESM(require_first());
var import_isEqual4 = __toESM(require_isEqual());
var import_isFunction14 = __toESM(require_isFunction());
var _excluded19 = ["key"];
function _typeof35(o) {
"@babel/helpers - typeof";
return _typeof35 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof35(o);
}
function _objectWithoutProperties18(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose19(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose19(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _extends23() {
_extends23 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends23.apply(this, arguments);
}
function ownKeys28(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread28(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys28(Object(t), true).forEach(function(r2) {
_defineProperty30(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys28(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck12(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties12(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey31(descriptor.key), descriptor);
}
}
function _createClass12(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties12(Constructor.prototype, protoProps);
if (staticProps) _defineProperties12(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper9(t, o, e) {
return o = _getPrototypeOf11(o), _possibleConstructorReturn11(t, _isNativeReflectConstruct11() ? Reflect.construct(o, e || [], _getPrototypeOf11(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn11(self2, call) {
if (call && (_typeof35(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized12(self2);
}
function _assertThisInitialized12(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct11() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct11 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf11(o) {
_getPrototypeOf11 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf11(o);
}
function _inherits11(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf12(subClass, superClass);
}
function _setPrototypeOf12(o, p) {
_setPrototypeOf12 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf12(o, p);
}
function _defineProperty30(obj, key, value) {
key = _toPropertyKey31(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey31(t) {
var i = _toPrimitive31(t, "string");
return "symbol" == _typeof35(i) ? i : i + "";
}
function _toPrimitive31(t, r) {
if ("object" != _typeof35(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof35(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Radar = function(_PureComponent) {
function Radar2() {
var _this;
_classCallCheck12(this, Radar2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper9(this, Radar2, [].concat(args));
_defineProperty30(_this, "state", {
isAnimationFinished: false
});
_defineProperty30(_this, "handleAnimationEnd", function() {
var onAnimationEnd2 = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if ((0, import_isFunction14.default)(onAnimationEnd2)) {
onAnimationEnd2();
}
});
_defineProperty30(_this, "handleAnimationStart", function() {
var onAnimationStart2 = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if ((0, import_isFunction14.default)(onAnimationStart2)) {
onAnimationStart2();
}
});
_defineProperty30(_this, "handleMouseEnter", function(e) {
var onMouseEnter = _this.props.onMouseEnter;
if (onMouseEnter) {
onMouseEnter(_this.props, e);
}
});
_defineProperty30(_this, "handleMouseLeave", function(e) {
var onMouseLeave = _this.props.onMouseLeave;
if (onMouseLeave) {
onMouseLeave(_this.props, e);
}
});
return _this;
}
_inherits11(Radar2, _PureComponent);
return _createClass12(Radar2, [{
key: "renderDots",
value: function renderDots(points) {
var _this$props = this.props, dot = _this$props.dot, dataKey = _this$props.dataKey;
var baseProps = filterProps(this.props, false);
var customDotProps = filterProps(dot, true);
var dots = points.map(function(entry, i) {
var dotProps = _objectSpread28(_objectSpread28(_objectSpread28({
key: "dot-".concat(i),
r: 3
}, baseProps), customDotProps), {}, {
dataKey,
cx: entry.x,
cy: entry.y,
index: i,
payload: entry
});
return Radar2.renderDotItem(dot, dotProps);
});
return import_react40.default.createElement(Layer, {
className: "recharts-radar-dots"
}, dots);
}
}, {
key: "renderPolygonStatically",
value: function renderPolygonStatically(points) {
var _this$props2 = this.props, shape = _this$props2.shape, dot = _this$props2.dot, isRange = _this$props2.isRange, baseLinePoints = _this$props2.baseLinePoints, connectNulls = _this$props2.connectNulls;
var radar;
if (import_react40.default.isValidElement(shape)) {
radar = import_react40.default.cloneElement(shape, _objectSpread28(_objectSpread28({}, this.props), {}, {
points
}));
} else if ((0, import_isFunction14.default)(shape)) {
radar = shape(_objectSpread28(_objectSpread28({}, this.props), {}, {
points
}));
} else {
radar = import_react40.default.createElement(Polygon, _extends23({}, filterProps(this.props, true), {
onMouseEnter: this.handleMouseEnter,
onMouseLeave: this.handleMouseLeave,
points,
baseLinePoints: isRange ? baseLinePoints : null,
connectNulls
}));
}
return import_react40.default.createElement(Layer, {
className: "recharts-radar-polygon"
}, radar, dot ? this.renderDots(points) : null);
}
}, {
key: "renderPolygonWithAnimation",
value: function renderPolygonWithAnimation() {
var _this2 = this;
var _this$props3 = this.props, points = _this$props3.points, isAnimationActive = _this$props3.isAnimationActive, animationBegin = _this$props3.animationBegin, animationDuration = _this$props3.animationDuration, animationEasing = _this$props3.animationEasing, animationId = _this$props3.animationId;
var prevPoints = this.state.prevPoints;
return import_react40.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "radar-".concat(animationId),
onAnimationEnd: this.handleAnimationEnd,
onAnimationStart: this.handleAnimationStart
}, function(_ref) {
var t = _ref.t;
var prevPointsDiffFactor = prevPoints && prevPoints.length / points.length;
var stepData = points.map(function(entry, index3) {
var prev = prevPoints && prevPoints[Math.floor(index3 * prevPointsDiffFactor)];
if (prev) {
var _interpolatorX = interpolateNumber(prev.x, entry.x);
var _interpolatorY = interpolateNumber(prev.y, entry.y);
return _objectSpread28(_objectSpread28({}, entry), {}, {
x: _interpolatorX(t),
y: _interpolatorY(t)
});
}
var interpolatorX = interpolateNumber(entry.cx, entry.x);
var interpolatorY = interpolateNumber(entry.cy, entry.y);
return _objectSpread28(_objectSpread28({}, entry), {}, {
x: interpolatorX(t),
y: interpolatorY(t)
});
});
return _this2.renderPolygonStatically(stepData);
});
}
}, {
key: "renderPolygon",
value: function renderPolygon() {
var _this$props4 = this.props, points = _this$props4.points, isAnimationActive = _this$props4.isAnimationActive, isRange = _this$props4.isRange;
var prevPoints = this.state.prevPoints;
if (isAnimationActive && points && points.length && !isRange && (!prevPoints || !(0, import_isEqual4.default)(prevPoints, points))) {
return this.renderPolygonWithAnimation();
}
return this.renderPolygonStatically(points);
}
}, {
key: "render",
value: function render() {
var _this$props5 = this.props, hide = _this$props5.hide, className = _this$props5.className, points = _this$props5.points, isAnimationActive = _this$props5.isAnimationActive;
if (hide || !points || !points.length) {
return null;
}
var isAnimationFinished = this.state.isAnimationFinished;
var layerClass = clsx_default("recharts-radar", className);
return import_react40.default.createElement(Layer, {
className: layerClass
}, this.renderPolygon(), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, points));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curPoints: nextProps.points,
prevPoints: prevState.curPoints
};
}
if (nextProps.points !== prevState.curPoints) {
return {
curPoints: nextProps.points
};
}
return null;
}
}, {
key: "renderDotItem",
value: function renderDotItem(option, props) {
var dotItem;
if (import_react40.default.isValidElement(option)) {
dotItem = import_react40.default.cloneElement(option, props);
} else if ((0, import_isFunction14.default)(option)) {
dotItem = option(props);
} else {
var key = props.key, dotProps = _objectWithoutProperties18(props, _excluded19);
dotItem = import_react40.default.createElement(Dot, _extends23({}, dotProps, {
key,
className: clsx_default("recharts-radar-dot", typeof option !== "boolean" ? option.className : "")
}));
}
return dotItem;
}
}]);
}(import_react40.PureComponent);
_defineProperty30(Radar, "displayName", "Radar");
_defineProperty30(Radar, "defaultProps", {
angleAxisId: 0,
radiusAxisId: 0,
hide: false,
activeDot: true,
dot: false,
legendType: "rect",
isAnimationActive: !Global.isSsr,
animationBegin: 0,
animationDuration: 1500,
animationEasing: "ease"
});
_defineProperty30(Radar, "getComposedData", function(_ref2) {
var radiusAxis = _ref2.radiusAxis, angleAxis = _ref2.angleAxis, displayedData = _ref2.displayedData, dataKey = _ref2.dataKey, bandSize = _ref2.bandSize;
var cx = angleAxis.cx, cy = angleAxis.cy;
var isRange = false;
var points = [];
var angleBandSize = angleAxis.type !== "number" ? bandSize !== null && bandSize !== void 0 ? bandSize : 0 : 0;
displayedData.forEach(function(entry, i) {
var name = getValueByDataKey(entry, angleAxis.dataKey, i);
var value = getValueByDataKey(entry, dataKey);
var angle = angleAxis.scale(name) + angleBandSize;
var pointValue = Array.isArray(value) ? (0, import_last2.default)(value) : value;
var radius = (0, import_isNil9.default)(pointValue) ? void 0 : radiusAxis.scale(pointValue);
if (Array.isArray(value) && value.length >= 2) {
isRange = true;
}
points.push(_objectSpread28(_objectSpread28({}, polarToCartesian(cx, cy, radius, angle)), {}, {
name,
value,
cx,
cy,
radius,
angle,
payload: entry
}));
});
var baseLinePoints = [];
if (isRange) {
points.forEach(function(point6) {
if (Array.isArray(point6.value)) {
var baseValue = (0, import_first.default)(point6.value);
var radius = (0, import_isNil9.default)(baseValue) ? void 0 : radiusAxis.scale(baseValue);
baseLinePoints.push(_objectSpread28(_objectSpread28({}, point6), {}, {
radius
}, polarToCartesian(cx, cy, radius, point6.angle)));
} else {
baseLinePoints.push(point6);
}
});
}
return {
points,
isRange,
baseLinePoints
};
});
// node_modules/recharts/es6/polar/RadialBar.js
var import_react42 = __toESM(require_react());
var import_isEqual5 = __toESM(require_isEqual());
var import_isFunction15 = __toESM(require_isFunction());
// node_modules/recharts/es6/util/RadialBarUtils.js
var import_react41 = __toESM(require_react());
function _typeof36(o) {
"@babel/helpers - typeof";
return _typeof36 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof36(o);
}
function _extends24() {
_extends24 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends24.apply(this, arguments);
}
function ownKeys29(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread29(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys29(Object(t), true).forEach(function(r2) {
_defineProperty31(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys29(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty31(obj, key, value) {
key = _toPropertyKey32(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey32(t) {
var i = _toPrimitive32(t, "string");
return "symbol" == _typeof36(i) ? i : i + "";
}
function _toPrimitive32(t, r) {
if ("object" != _typeof36(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof36(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function parseCornerRadius(cornerRadius) {
if (typeof cornerRadius === "string") {
return parseInt(cornerRadius, 10);
}
return cornerRadius;
}
function typeGuardSectorProps(option, props) {
var cxValue = "".concat(props.cx || option.cx);
var cx = Number(cxValue);
var cyValue = "".concat(props.cy || option.cy);
var cy = Number(cyValue);
return _objectSpread29(_objectSpread29(_objectSpread29({}, props), option), {}, {
cx,
cy
});
}
function RadialBarSector(props) {
return import_react41.default.createElement(Shape, _extends24({
shapeType: "sector",
propTransformer: typeGuardSectorProps
}, props));
}
// node_modules/recharts/es6/polar/RadialBar.js
var _excluded20 = ["shape", "activeShape", "activeIndex", "cornerRadius"];
var _excluded25 = ["value", "background"];
function _typeof37(o) {
"@babel/helpers - typeof";
return _typeof37 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof37(o);
}
function _extends25() {
_extends25 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends25.apply(this, arguments);
}
function ownKeys30(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread30(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys30(Object(t), true).forEach(function(r2) {
_defineProperty32(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys30(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _objectWithoutProperties19(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose20(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose20(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck13(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties13(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey33(descriptor.key), descriptor);
}
}
function _createClass13(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties13(Constructor.prototype, protoProps);
if (staticProps) _defineProperties13(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper10(t, o, e) {
return o = _getPrototypeOf12(o), _possibleConstructorReturn12(t, _isNativeReflectConstruct12() ? Reflect.construct(o, e || [], _getPrototypeOf12(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn12(self2, call) {
if (call && (_typeof37(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized13(self2);
}
function _assertThisInitialized13(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct12() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct12 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf12(o) {
_getPrototypeOf12 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf12(o);
}
function _inherits12(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf13(subClass, superClass);
}
function _setPrototypeOf13(o, p) {
_setPrototypeOf13 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf13(o, p);
}
function _defineProperty32(obj, key, value) {
key = _toPropertyKey33(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey33(t) {
var i = _toPrimitive33(t, "string");
return "symbol" == _typeof37(i) ? i : i + "";
}
function _toPrimitive33(t, r) {
if ("object" != _typeof37(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof37(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var RadialBar = function(_PureComponent) {
function RadialBar2() {
var _this;
_classCallCheck13(this, RadialBar2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper10(this, RadialBar2, [].concat(args));
_defineProperty32(_this, "state", {
isAnimationFinished: false
});
_defineProperty32(_this, "handleAnimationEnd", function() {
var onAnimationEnd2 = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if ((0, import_isFunction15.default)(onAnimationEnd2)) {
onAnimationEnd2();
}
});
_defineProperty32(_this, "handleAnimationStart", function() {
var onAnimationStart2 = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if ((0, import_isFunction15.default)(onAnimationStart2)) {
onAnimationStart2();
}
});
return _this;
}
_inherits12(RadialBar2, _PureComponent);
return _createClass13(RadialBar2, [{
key: "getDeltaAngle",
value: function getDeltaAngle5() {
var _this$props = this.props, startAngle = _this$props.startAngle, endAngle = _this$props.endAngle;
var sign2 = mathSign(endAngle - startAngle);
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
return sign2 * deltaAngle;
}
}, {
key: "renderSectorsStatically",
value: function renderSectorsStatically(sectors) {
var _this2 = this;
var _this$props2 = this.props, shape = _this$props2.shape, activeShape = _this$props2.activeShape, activeIndex = _this$props2.activeIndex, cornerRadius = _this$props2.cornerRadius, others = _objectWithoutProperties19(_this$props2, _excluded20);
var baseProps = filterProps(others, false);
return sectors.map(function(entry, i) {
var isActive = i === activeIndex;
var props = _objectSpread30(_objectSpread30(_objectSpread30(_objectSpread30({}, baseProps), {}, {
cornerRadius: parseCornerRadius(cornerRadius)
}, entry), adaptEventsOfChild(_this2.props, entry, i)), {}, {
className: "recharts-radial-bar-sector ".concat(entry.className),
forceCornerRadius: others.forceCornerRadius,
cornerIsExternal: others.cornerIsExternal,
isActive,
option: isActive ? activeShape : shape
});
return import_react42.default.createElement(RadialBarSector, _extends25({}, props, {
key: "sector-".concat(i)
}));
});
}
}, {
key: "renderSectorsWithAnimation",
value: function renderSectorsWithAnimation() {
var _this3 = this;
var _this$props3 = this.props, data = _this$props3.data, isAnimationActive = _this$props3.isAnimationActive, animationBegin = _this$props3.animationBegin, animationDuration = _this$props3.animationDuration, animationEasing = _this$props3.animationEasing, animationId = _this$props3.animationId;
var prevData = this.state.prevData;
return import_react42.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "radialBar-".concat(animationId),
onAnimationStart: this.handleAnimationStart,
onAnimationEnd: this.handleAnimationEnd
}, function(_ref) {
var t = _ref.t;
var stepData = data.map(function(entry, index3) {
var prev = prevData && prevData[index3];
if (prev) {
var interpolatorStartAngle = interpolateNumber(prev.startAngle, entry.startAngle);
var interpolatorEndAngle = interpolateNumber(prev.endAngle, entry.endAngle);
return _objectSpread30(_objectSpread30({}, entry), {}, {
startAngle: interpolatorStartAngle(t),
endAngle: interpolatorEndAngle(t)
});
}
var endAngle = entry.endAngle, startAngle = entry.startAngle;
var interpolator = interpolateNumber(startAngle, endAngle);
return _objectSpread30(_objectSpread30({}, entry), {}, {
endAngle: interpolator(t)
});
});
return import_react42.default.createElement(Layer, null, _this3.renderSectorsStatically(stepData));
});
}
}, {
key: "renderSectors",
value: function renderSectors() {
var _this$props4 = this.props, data = _this$props4.data, isAnimationActive = _this$props4.isAnimationActive;
var prevData = this.state.prevData;
if (isAnimationActive && data && data.length && (!prevData || !(0, import_isEqual5.default)(prevData, data))) {
return this.renderSectorsWithAnimation();
}
return this.renderSectorsStatically(data);
}
}, {
key: "renderBackground",
value: function renderBackground(sectors) {
var _this4 = this;
var cornerRadius = this.props.cornerRadius;
var backgroundProps = filterProps(this.props.background, false);
return sectors.map(function(entry, i) {
var value = entry.value, background = entry.background, rest = _objectWithoutProperties19(entry, _excluded25);
if (!background) {
return null;
}
var props = _objectSpread30(_objectSpread30(_objectSpread30(_objectSpread30(_objectSpread30({
cornerRadius: parseCornerRadius(cornerRadius)
}, rest), {}, {
fill: "#eee"
}, background), backgroundProps), adaptEventsOfChild(_this4.props, entry, i)), {}, {
index: i,
className: clsx_default("recharts-radial-bar-background-sector", backgroundProps === null || backgroundProps === void 0 ? void 0 : backgroundProps.className),
option: background,
isActive: false
});
return import_react42.default.createElement(RadialBarSector, _extends25({}, props, {
key: "sector-".concat(i)
}));
});
}
}, {
key: "render",
value: function render() {
var _this$props5 = this.props, hide = _this$props5.hide, data = _this$props5.data, className = _this$props5.className, background = _this$props5.background, isAnimationActive = _this$props5.isAnimationActive;
if (hide || !data || !data.length) {
return null;
}
var isAnimationFinished = this.state.isAnimationFinished;
var layerClass = clsx_default("recharts-area", className);
return import_react42.default.createElement(Layer, {
className: layerClass
}, background && import_react42.default.createElement(Layer, {
className: "recharts-radial-bar-background"
}, this.renderBackground(data)), import_react42.default.createElement(Layer, {
className: "recharts-radial-bar-sectors"
}, this.renderSectors()), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(_objectSpread30({}, this.props), data));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curData: nextProps.data,
prevData: prevState.curData
};
}
if (nextProps.data !== prevState.curData) {
return {
curData: nextProps.data
};
}
return null;
}
}]);
}(import_react42.PureComponent);
_defineProperty32(RadialBar, "displayName", "RadialBar");
_defineProperty32(RadialBar, "defaultProps", {
angleAxisId: 0,
radiusAxisId: 0,
minPointSize: 0,
hide: false,
legendType: "rect",
data: [],
isAnimationActive: !Global.isSsr,
animationBegin: 0,
animationDuration: 1500,
animationEasing: "ease",
forceCornerRadius: false,
cornerIsExternal: false
});
_defineProperty32(RadialBar, "getComposedData", function(_ref2) {
var item = _ref2.item, props = _ref2.props, radiusAxis = _ref2.radiusAxis, radiusAxisTicks = _ref2.radiusAxisTicks, angleAxis = _ref2.angleAxis, angleAxisTicks = _ref2.angleAxisTicks, displayedData = _ref2.displayedData, dataKey = _ref2.dataKey, stackedData = _ref2.stackedData, barPosition = _ref2.barPosition, bandSize = _ref2.bandSize, dataStartIndex = _ref2.dataStartIndex;
var pos = findPositionOfBar(barPosition, item);
if (!pos) {
return null;
}
var cx = angleAxis.cx, cy = angleAxis.cy;
var layout = props.layout;
var _item$props = item.props, children2 = _item$props.children, minPointSize = _item$props.minPointSize;
var numericAxis = layout === "radial" ? angleAxis : radiusAxis;
var stackedDomain = stackedData ? numericAxis.scale.domain() : null;
var baseValue = getBaseValueOfBar({
numericAxis
});
var cells = findAllByType(children2, Cell);
var sectors = displayedData.map(function(entry, index3) {
var value, innerRadius, outerRadius, startAngle, endAngle, backgroundSector;
if (stackedData) {
value = truncateByDomain(stackedData[dataStartIndex + index3], stackedDomain);
} else {
value = getValueByDataKey(entry, dataKey);
if (!Array.isArray(value)) {
value = [baseValue, value];
}
}
if (layout === "radial") {
innerRadius = getCateCoordinateOfBar({
axis: radiusAxis,
ticks: radiusAxisTicks,
bandSize,
offset: pos.offset,
entry,
index: index3
});
endAngle = angleAxis.scale(value[1]);
startAngle = angleAxis.scale(value[0]);
outerRadius = innerRadius + pos.size;
var deltaAngle = endAngle - startAngle;
if (Math.abs(minPointSize) > 0 && Math.abs(deltaAngle) < Math.abs(minPointSize)) {
var delta = mathSign(deltaAngle || minPointSize) * (Math.abs(minPointSize) - Math.abs(deltaAngle));
endAngle += delta;
}
backgroundSector = {
background: {
cx,
cy,
innerRadius,
outerRadius,
startAngle: props.startAngle,
endAngle: props.endAngle
}
};
} else {
innerRadius = radiusAxis.scale(value[0]);
outerRadius = radiusAxis.scale(value[1]);
startAngle = getCateCoordinateOfBar({
axis: angleAxis,
ticks: angleAxisTicks,
bandSize,
offset: pos.offset,
entry,
index: index3
});
endAngle = startAngle + pos.size;
var deltaRadius = outerRadius - innerRadius;
if (Math.abs(minPointSize) > 0 && Math.abs(deltaRadius) < Math.abs(minPointSize)) {
var _delta = mathSign(deltaRadius || minPointSize) * (Math.abs(minPointSize) - Math.abs(deltaRadius));
outerRadius += _delta;
}
}
return _objectSpread30(_objectSpread30(_objectSpread30(_objectSpread30({}, entry), backgroundSector), {}, {
payload: entry,
value: stackedData ? value : value[1],
cx,
cy,
innerRadius,
outerRadius,
startAngle,
endAngle
}, cells && cells[index3] && cells[index3].props), {}, {
tooltipPayload: [getTooltipItem(item, entry)],
tooltipPosition: polarToCartesian(cx, cy, (innerRadius + outerRadius) / 2, (startAngle + endAngle) / 2)
});
});
return {
data: sectors,
layout
};
});
// node_modules/recharts/es6/cartesian/Brush.js
var import_react43 = __toESM(require_react());
var import_isFunction16 = __toESM(require_isFunction());
var import_range3 = __toESM(require_range());
// node_modules/recharts/es6/util/CssPrefixUtils.js
function _typeof38(o) {
"@babel/helpers - typeof";
return _typeof38 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof38(o);
}
function ownKeys31(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread31(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys31(Object(t), true).forEach(function(r2) {
_defineProperty33(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys31(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty33(obj, key, value) {
key = _toPropertyKey34(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey34(t) {
var i = _toPrimitive34(t, "string");
return "symbol" == _typeof38(i) ? i : i + "";
}
function _toPrimitive34(t, r) {
if ("object" != _typeof38(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof38(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var PREFIX_LIST = ["Webkit", "Moz", "O", "ms"];
var generatePrefixStyle = function generatePrefixStyle2(name, value) {
if (!name) {
return null;
}
var camelName = name.replace(/(\w)/, function(v) {
return v.toUpperCase();
});
var result = PREFIX_LIST.reduce(function(res, entry) {
return _objectSpread31(_objectSpread31({}, res), {}, _defineProperty33({}, entry + camelName, value));
}, {});
result[name] = value;
return result;
};
// node_modules/recharts/es6/cartesian/Brush.js
function _typeof39(o) {
"@babel/helpers - typeof";
return _typeof39 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof39(o);
}
function _extends26() {
_extends26 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends26.apply(this, arguments);
}
function ownKeys32(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread32(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys32(Object(t), true).forEach(function(r2) {
_defineProperty34(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys32(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck14(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties14(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey35(descriptor.key), descriptor);
}
}
function _createClass14(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties14(Constructor.prototype, protoProps);
if (staticProps) _defineProperties14(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper11(t, o, e) {
return o = _getPrototypeOf13(o), _possibleConstructorReturn13(t, _isNativeReflectConstruct13() ? Reflect.construct(o, e || [], _getPrototypeOf13(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn13(self2, call) {
if (call && (_typeof39(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized14(self2);
}
function _assertThisInitialized14(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct13() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct13 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf13(o) {
_getPrototypeOf13 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf13(o);
}
function _inherits13(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf14(subClass, superClass);
}
function _setPrototypeOf14(o, p) {
_setPrototypeOf14 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf14(o, p);
}
function _defineProperty34(obj, key, value) {
key = _toPropertyKey35(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey35(t) {
var i = _toPrimitive35(t, "string");
return "symbol" == _typeof39(i) ? i : i + "";
}
function _toPrimitive35(t, r) {
if ("object" != _typeof39(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof39(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var createScale = function createScale2(_ref) {
var data = _ref.data, startIndex = _ref.startIndex, endIndex = _ref.endIndex, x2 = _ref.x, width = _ref.width, travellerWidth = _ref.travellerWidth;
if (!data || !data.length) {
return {};
}
var len = data.length;
var scale = point5().domain((0, import_range3.default)(0, len)).range([x2, x2 + width - travellerWidth]);
var scaleValues = scale.domain().map(function(entry) {
return scale(entry);
});
return {
isTextActive: false,
isSlideMoving: false,
isTravellerMoving: false,
isTravellerFocused: false,
startX: scale(startIndex),
endX: scale(endIndex),
scale,
scaleValues
};
};
var isTouch = function isTouch2(e) {
return e.changedTouches && !!e.changedTouches.length;
};
var Brush = function(_PureComponent) {
function Brush2(props) {
var _this;
_classCallCheck14(this, Brush2);
_this = _callSuper11(this, Brush2, [props]);
_defineProperty34(_this, "handleDrag", function(e) {
if (_this.leaveTimer) {
clearTimeout(_this.leaveTimer);
_this.leaveTimer = null;
}
if (_this.state.isTravellerMoving) {
_this.handleTravellerMove(e);
} else if (_this.state.isSlideMoving) {
_this.handleSlideDrag(e);
}
});
_defineProperty34(_this, "handleTouchMove", function(e) {
if (e.changedTouches != null && e.changedTouches.length > 0) {
_this.handleDrag(e.changedTouches[0]);
}
});
_defineProperty34(_this, "handleDragEnd", function() {
_this.setState({
isTravellerMoving: false,
isSlideMoving: false
}, function() {
var _this$props = _this.props, endIndex = _this$props.endIndex, onDragEnd = _this$props.onDragEnd, startIndex = _this$props.startIndex;
onDragEnd === null || onDragEnd === void 0 || onDragEnd({
endIndex,
startIndex
});
});
_this.detachDragEndListener();
});
_defineProperty34(_this, "handleLeaveWrapper", function() {
if (_this.state.isTravellerMoving || _this.state.isSlideMoving) {
_this.leaveTimer = window.setTimeout(_this.handleDragEnd, _this.props.leaveTimeOut);
}
});
_defineProperty34(_this, "handleEnterSlideOrTraveller", function() {
_this.setState({
isTextActive: true
});
});
_defineProperty34(_this, "handleLeaveSlideOrTraveller", function() {
_this.setState({
isTextActive: false
});
});
_defineProperty34(_this, "handleSlideDragStart", function(e) {
var event = isTouch(e) ? e.changedTouches[0] : e;
_this.setState({
isTravellerMoving: false,
isSlideMoving: true,
slideMoveStartX: event.pageX
});
_this.attachDragEndListener();
});
_this.travellerDragStartHandlers = {
startX: _this.handleTravellerDragStart.bind(_this, "startX"),
endX: _this.handleTravellerDragStart.bind(_this, "endX")
};
_this.state = {};
return _this;
}
_inherits13(Brush2, _PureComponent);
return _createClass14(Brush2, [{
key: "componentWillUnmount",
value: function componentWillUnmount() {
if (this.leaveTimer) {
clearTimeout(this.leaveTimer);
this.leaveTimer = null;
}
this.detachDragEndListener();
}
}, {
key: "getIndex",
value: function getIndex(_ref2) {
var startX = _ref2.startX, endX = _ref2.endX;
var scaleValues = this.state.scaleValues;
var _this$props2 = this.props, gap = _this$props2.gap, data = _this$props2.data;
var lastIndex = data.length - 1;
var min6 = Math.min(startX, endX);
var max6 = Math.max(startX, endX);
var minIndex3 = Brush2.getIndexInRange(scaleValues, min6);
var maxIndex3 = Brush2.getIndexInRange(scaleValues, max6);
return {
startIndex: minIndex3 - minIndex3 % gap,
endIndex: maxIndex3 === lastIndex ? lastIndex : maxIndex3 - maxIndex3 % gap
};
}
}, {
key: "getTextOfTick",
value: function getTextOfTick(index3) {
var _this$props3 = this.props, data = _this$props3.data, tickFormatter = _this$props3.tickFormatter, dataKey = _this$props3.dataKey;
var text = getValueByDataKey(data[index3], dataKey, index3);
return (0, import_isFunction16.default)(tickFormatter) ? tickFormatter(text, index3) : text;
}
}, {
key: "attachDragEndListener",
value: function attachDragEndListener() {
window.addEventListener("mouseup", this.handleDragEnd, true);
window.addEventListener("touchend", this.handleDragEnd, true);
window.addEventListener("mousemove", this.handleDrag, true);
}
}, {
key: "detachDragEndListener",
value: function detachDragEndListener() {
window.removeEventListener("mouseup", this.handleDragEnd, true);
window.removeEventListener("touchend", this.handleDragEnd, true);
window.removeEventListener("mousemove", this.handleDrag, true);
}
}, {
key: "handleSlideDrag",
value: function handleSlideDrag(e) {
var _this$state = this.state, slideMoveStartX = _this$state.slideMoveStartX, startX = _this$state.startX, endX = _this$state.endX;
var _this$props4 = this.props, x2 = _this$props4.x, width = _this$props4.width, travellerWidth = _this$props4.travellerWidth, startIndex = _this$props4.startIndex, endIndex = _this$props4.endIndex, onChange = _this$props4.onChange;
var delta = e.pageX - slideMoveStartX;
if (delta > 0) {
delta = Math.min(delta, x2 + width - travellerWidth - endX, x2 + width - travellerWidth - startX);
} else if (delta < 0) {
delta = Math.max(delta, x2 - startX, x2 - endX);
}
var newIndex = this.getIndex({
startX: startX + delta,
endX: endX + delta
});
if ((newIndex.startIndex !== startIndex || newIndex.endIndex !== endIndex) && onChange) {
onChange(newIndex);
}
this.setState({
startX: startX + delta,
endX: endX + delta,
slideMoveStartX: e.pageX
});
}
}, {
key: "handleTravellerDragStart",
value: function handleTravellerDragStart(id, e) {
var event = isTouch(e) ? e.changedTouches[0] : e;
this.setState({
isSlideMoving: false,
isTravellerMoving: true,
movingTravellerId: id,
brushMoveStartX: event.pageX
});
this.attachDragEndListener();
}
}, {
key: "handleTravellerMove",
value: function handleTravellerMove(e) {
var _this$state2 = this.state, brushMoveStartX = _this$state2.brushMoveStartX, movingTravellerId = _this$state2.movingTravellerId, endX = _this$state2.endX, startX = _this$state2.startX;
var prevValue = this.state[movingTravellerId];
var _this$props5 = this.props, x2 = _this$props5.x, width = _this$props5.width, travellerWidth = _this$props5.travellerWidth, onChange = _this$props5.onChange, gap = _this$props5.gap, data = _this$props5.data;
var params = {
startX: this.state.startX,
endX: this.state.endX
};
var delta = e.pageX - brushMoveStartX;
if (delta > 0) {
delta = Math.min(delta, x2 + width - travellerWidth - prevValue);
} else if (delta < 0) {
delta = Math.max(delta, x2 - prevValue);
}
params[movingTravellerId] = prevValue + delta;
var newIndex = this.getIndex(params);
var startIndex = newIndex.startIndex, endIndex = newIndex.endIndex;
var isFullGap = function isFullGap2() {
var lastIndex = data.length - 1;
if (movingTravellerId === "startX" && (endX > startX ? startIndex % gap === 0 : endIndex % gap === 0) || endX < startX && endIndex === lastIndex || movingTravellerId === "endX" && (endX > startX ? endIndex % gap === 0 : startIndex % gap === 0) || endX > startX && endIndex === lastIndex) {
return true;
}
return false;
};
this.setState(_defineProperty34(_defineProperty34({}, movingTravellerId, prevValue + delta), "brushMoveStartX", e.pageX), function() {
if (onChange) {
if (isFullGap()) {
onChange(newIndex);
}
}
});
}
}, {
key: "handleTravellerMoveKeyboard",
value: function handleTravellerMoveKeyboard(direction, id) {
var _this2 = this;
var _this$state3 = this.state, scaleValues = _this$state3.scaleValues, startX = _this$state3.startX, endX = _this$state3.endX;
var currentScaleValue = this.state[id];
var currentIndex = scaleValues.indexOf(currentScaleValue);
if (currentIndex === -1) {
return;
}
var newIndex = currentIndex + direction;
if (newIndex === -1 || newIndex >= scaleValues.length) {
return;
}
var newScaleValue = scaleValues[newIndex];
if (id === "startX" && newScaleValue >= endX || id === "endX" && newScaleValue <= startX) {
return;
}
this.setState(_defineProperty34({}, id, newScaleValue), function() {
_this2.props.onChange(_this2.getIndex({
startX: _this2.state.startX,
endX: _this2.state.endX
}));
});
}
}, {
key: "renderBackground",
value: function renderBackground() {
var _this$props6 = this.props, x2 = _this$props6.x, y2 = _this$props6.y, width = _this$props6.width, height = _this$props6.height, fill = _this$props6.fill, stroke = _this$props6.stroke;
return import_react43.default.createElement("rect", {
stroke,
fill,
x: x2,
y: y2,
width,
height
});
}
}, {
key: "renderPanorama",
value: function renderPanorama() {
var _this$props7 = this.props, x2 = _this$props7.x, y2 = _this$props7.y, width = _this$props7.width, height = _this$props7.height, data = _this$props7.data, children2 = _this$props7.children, padding = _this$props7.padding;
var chartElement = import_react43.Children.only(children2);
if (!chartElement) {
return null;
}
return import_react43.default.cloneElement(chartElement, {
x: x2,
y: y2,
width,
height,
margin: padding,
compact: true,
data
});
}
}, {
key: "renderTravellerLayer",
value: function renderTravellerLayer(travellerX, id) {
var _data$startIndex, _data$endIndex, _this3 = this;
var _this$props8 = this.props, y2 = _this$props8.y, travellerWidth = _this$props8.travellerWidth, height = _this$props8.height, traveller = _this$props8.traveller, ariaLabel = _this$props8.ariaLabel, data = _this$props8.data, startIndex = _this$props8.startIndex, endIndex = _this$props8.endIndex;
var x2 = Math.max(travellerX, this.props.x);
var travellerProps = _objectSpread32(_objectSpread32({}, filterProps(this.props, false)), {}, {
x: x2,
y: y2,
width: travellerWidth,
height
});
var ariaLabelBrush = ariaLabel || "Min value: ".concat((_data$startIndex = data[startIndex]) === null || _data$startIndex === void 0 ? void 0 : _data$startIndex.name, ", Max value: ").concat((_data$endIndex = data[endIndex]) === null || _data$endIndex === void 0 ? void 0 : _data$endIndex.name);
return import_react43.default.createElement(Layer, {
tabIndex: 0,
role: "slider",
"aria-label": ariaLabelBrush,
"aria-valuenow": travellerX,
className: "recharts-brush-traveller",
onMouseEnter: this.handleEnterSlideOrTraveller,
onMouseLeave: this.handleLeaveSlideOrTraveller,
onMouseDown: this.travellerDragStartHandlers[id],
onTouchStart: this.travellerDragStartHandlers[id],
onKeyDown: function onKeyDown(e) {
if (!["ArrowLeft", "ArrowRight"].includes(e.key)) {
return;
}
e.preventDefault();
e.stopPropagation();
_this3.handleTravellerMoveKeyboard(e.key === "ArrowRight" ? 1 : -1, id);
},
onFocus: function onFocus() {
_this3.setState({
isTravellerFocused: true
});
},
onBlur: function onBlur() {
_this3.setState({
isTravellerFocused: false
});
},
style: {
cursor: "col-resize"
}
}, Brush2.renderTraveller(traveller, travellerProps));
}
}, {
key: "renderSlide",
value: function renderSlide(startX, endX) {
var _this$props9 = this.props, y2 = _this$props9.y, height = _this$props9.height, stroke = _this$props9.stroke, travellerWidth = _this$props9.travellerWidth;
var x2 = Math.min(startX, endX) + travellerWidth;
var width = Math.max(Math.abs(endX - startX) - travellerWidth, 0);
return import_react43.default.createElement("rect", {
className: "recharts-brush-slide",
onMouseEnter: this.handleEnterSlideOrTraveller,
onMouseLeave: this.handleLeaveSlideOrTraveller,
onMouseDown: this.handleSlideDragStart,
onTouchStart: this.handleSlideDragStart,
style: {
cursor: "move"
},
stroke: "none",
fill: stroke,
fillOpacity: 0.2,
x: x2,
y: y2,
width,
height
});
}
}, {
key: "renderText",
value: function renderText() {
var _this$props10 = this.props, startIndex = _this$props10.startIndex, endIndex = _this$props10.endIndex, y2 = _this$props10.y, height = _this$props10.height, travellerWidth = _this$props10.travellerWidth, stroke = _this$props10.stroke;
var _this$state4 = this.state, startX = _this$state4.startX, endX = _this$state4.endX;
var offset = 5;
var attrs = {
pointerEvents: "none",
fill: stroke
};
return import_react43.default.createElement(Layer, {
className: "recharts-brush-texts"
}, import_react43.default.createElement(Text, _extends26({
textAnchor: "end",
verticalAnchor: "middle",
x: Math.min(startX, endX) - offset,
y: y2 + height / 2
}, attrs), this.getTextOfTick(startIndex)), import_react43.default.createElement(Text, _extends26({
textAnchor: "start",
verticalAnchor: "middle",
x: Math.max(startX, endX) + travellerWidth + offset,
y: y2 + height / 2
}, attrs), this.getTextOfTick(endIndex)));
}
}, {
key: "render",
value: function render() {
var _this$props11 = this.props, data = _this$props11.data, className = _this$props11.className, children2 = _this$props11.children, x2 = _this$props11.x, y2 = _this$props11.y, width = _this$props11.width, height = _this$props11.height, alwaysShowText = _this$props11.alwaysShowText;
var _this$state5 = this.state, startX = _this$state5.startX, endX = _this$state5.endX, isTextActive = _this$state5.isTextActive, isSlideMoving = _this$state5.isSlideMoving, isTravellerMoving = _this$state5.isTravellerMoving, isTravellerFocused = _this$state5.isTravellerFocused;
if (!data || !data.length || !isNumber(x2) || !isNumber(y2) || !isNumber(width) || !isNumber(height) || width <= 0 || height <= 0) {
return null;
}
var layerClass = clsx_default("recharts-brush", className);
var isPanoramic = import_react43.default.Children.count(children2) === 1;
var style = generatePrefixStyle("userSelect", "none");
return import_react43.default.createElement(Layer, {
className: layerClass,
onMouseLeave: this.handleLeaveWrapper,
onTouchMove: this.handleTouchMove,
style
}, this.renderBackground(), isPanoramic && this.renderPanorama(), this.renderSlide(startX, endX), this.renderTravellerLayer(startX, "startX"), this.renderTravellerLayer(endX, "endX"), (isTextActive || isSlideMoving || isTravellerMoving || isTravellerFocused || alwaysShowText) && this.renderText());
}
}], [{
key: "renderDefaultTraveller",
value: function renderDefaultTraveller(props) {
var x2 = props.x, y2 = props.y, width = props.width, height = props.height, stroke = props.stroke;
var lineY = Math.floor(y2 + height / 2) - 1;
return import_react43.default.createElement(import_react43.default.Fragment, null, import_react43.default.createElement("rect", {
x: x2,
y: y2,
width,
height,
fill: stroke,
stroke: "none"
}), import_react43.default.createElement("line", {
x1: x2 + 1,
y1: lineY,
x2: x2 + width - 1,
y2: lineY,
fill: "none",
stroke: "#fff"
}), import_react43.default.createElement("line", {
x1: x2 + 1,
y1: lineY + 2,
x2: x2 + width - 1,
y2: lineY + 2,
fill: "none",
stroke: "#fff"
}));
}
}, {
key: "renderTraveller",
value: function renderTraveller(option, props) {
var rectangle;
if (import_react43.default.isValidElement(option)) {
rectangle = import_react43.default.cloneElement(option, props);
} else if ((0, import_isFunction16.default)(option)) {
rectangle = option(props);
} else {
rectangle = Brush2.renderDefaultTraveller(props);
}
return rectangle;
}
}, {
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
var data = nextProps.data, width = nextProps.width, x2 = nextProps.x, travellerWidth = nextProps.travellerWidth, updateId = nextProps.updateId, startIndex = nextProps.startIndex, endIndex = nextProps.endIndex;
if (data !== prevState.prevData || updateId !== prevState.prevUpdateId) {
return _objectSpread32({
prevData: data,
prevTravellerWidth: travellerWidth,
prevUpdateId: updateId,
prevX: x2,
prevWidth: width
}, data && data.length ? createScale({
data,
width,
x: x2,
travellerWidth,
startIndex,
endIndex
}) : {
scale: null,
scaleValues: null
});
}
if (prevState.scale && (width !== prevState.prevWidth || x2 !== prevState.prevX || travellerWidth !== prevState.prevTravellerWidth)) {
prevState.scale.range([x2, x2 + width - travellerWidth]);
var scaleValues = prevState.scale.domain().map(function(entry) {
return prevState.scale(entry);
});
return {
prevData: data,
prevTravellerWidth: travellerWidth,
prevUpdateId: updateId,
prevX: x2,
prevWidth: width,
startX: prevState.scale(nextProps.startIndex),
endX: prevState.scale(nextProps.endIndex),
scaleValues
};
}
return null;
}
}, {
key: "getIndexInRange",
value: function getIndexInRange(valueRange, x2) {
var len = valueRange.length;
var start = 0;
var end = len - 1;
while (end - start > 1) {
var middle = Math.floor((start + end) / 2);
if (valueRange[middle] > x2) {
end = middle;
} else {
start = middle;
}
}
return x2 >= valueRange[end] ? end : start;
}
}]);
}(import_react43.PureComponent);
_defineProperty34(Brush, "displayName", "Brush");
_defineProperty34(Brush, "defaultProps", {
height: 40,
travellerWidth: 5,
gap: 1,
fill: "#fff",
stroke: "#666",
padding: {
top: 1,
right: 1,
bottom: 1,
left: 1
},
leaveTimeOut: 1e3,
alwaysShowText: false
});
// node_modules/recharts/es6/cartesian/ReferenceLine.js
var import_react47 = __toESM(require_react());
var import_isFunction17 = __toESM(require_isFunction());
var import_some3 = __toESM(require_some());
// node_modules/recharts/es6/util/IfOverflowMatches.js
var ifOverflowMatches = function ifOverflowMatches2(props, value) {
var alwaysShow = props.alwaysShow;
var ifOverflow = props.ifOverflow;
if (alwaysShow) {
ifOverflow = "extendDomain";
}
return ifOverflow === value;
};
// node_modules/recharts/es6/util/CartesianUtils.js
var import_mapValues = __toESM(require_mapValues());
var import_every3 = __toESM(require_every());
// node_modules/recharts/es6/cartesian/Bar.js
var import_react45 = __toESM(require_react());
var import_isEqual6 = __toESM(require_isEqual());
var import_isNil10 = __toESM(require_isNil());
// node_modules/recharts/es6/util/BarUtils.js
var import_react44 = __toESM(require_react());
var _excluded21 = ["x", "y"];
function _typeof40(o) {
"@babel/helpers - typeof";
return _typeof40 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof40(o);
}
function _extends27() {
_extends27 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends27.apply(this, arguments);
}
function ownKeys33(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread33(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys33(Object(t), true).forEach(function(r2) {
_defineProperty35(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys33(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty35(obj, key, value) {
key = _toPropertyKey36(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey36(t) {
var i = _toPrimitive36(t, "string");
return "symbol" == _typeof40(i) ? i : i + "";
}
function _toPrimitive36(t, r) {
if ("object" != _typeof40(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof40(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _objectWithoutProperties20(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose21(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose21(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function typeguardBarRectangleProps(_ref, props) {
var xProp = _ref.x, yProp = _ref.y, option = _objectWithoutProperties20(_ref, _excluded21);
var xValue = "".concat(xProp);
var x2 = parseInt(xValue, 10);
var yValue = "".concat(yProp);
var y2 = parseInt(yValue, 10);
var heightValue = "".concat(props.height || option.height);
var height = parseInt(heightValue, 10);
var widthValue = "".concat(props.width || option.width);
var width = parseInt(widthValue, 10);
return _objectSpread33(_objectSpread33(_objectSpread33(_objectSpread33(_objectSpread33({}, props), option), x2 ? {
x: x2
} : {}), y2 ? {
y: y2
} : {}), {}, {
height,
width,
name: props.name,
radius: props.radius
});
}
function BarRectangle(props) {
return import_react44.default.createElement(Shape, _extends27({
shapeType: "rectangle",
propTransformer: typeguardBarRectangleProps,
activeClassName: "recharts-active-bar"
}, props));
}
var minPointSizeCallback = function minPointSizeCallback2(minPointSize) {
var defaultValue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
return function(value, index3) {
if (typeof minPointSize === "number") return minPointSize;
var isValueNumber = typeof value === "number";
if (isValueNumber) {
return minPointSize(value, index3);
}
!isValueNumber ? true ? invariant(false, "minPointSize callback function received a value with type of ".concat(_typeof40(value), ". Currently only numbers are supported.")) : invariant(false) : void 0;
return defaultValue;
};
};
// node_modules/recharts/es6/cartesian/Bar.js
var _excluded26 = ["value", "background"];
var _Bar;
function _typeof41(o) {
"@babel/helpers - typeof";
return _typeof41 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof41(o);
}
function _objectWithoutProperties21(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose22(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose22(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _extends28() {
_extends28 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends28.apply(this, arguments);
}
function ownKeys34(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread34(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys34(Object(t), true).forEach(function(r2) {
_defineProperty36(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys34(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck15(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties15(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey37(descriptor.key), descriptor);
}
}
function _createClass15(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties15(Constructor.prototype, protoProps);
if (staticProps) _defineProperties15(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper12(t, o, e) {
return o = _getPrototypeOf14(o), _possibleConstructorReturn14(t, _isNativeReflectConstruct14() ? Reflect.construct(o, e || [], _getPrototypeOf14(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn14(self2, call) {
if (call && (_typeof41(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized15(self2);
}
function _assertThisInitialized15(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct14() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct14 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf14(o) {
_getPrototypeOf14 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf14(o);
}
function _inherits14(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf15(subClass, superClass);
}
function _setPrototypeOf15(o, p) {
_setPrototypeOf15 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf15(o, p);
}
function _defineProperty36(obj, key, value) {
key = _toPropertyKey37(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey37(t) {
var i = _toPrimitive37(t, "string");
return "symbol" == _typeof41(i) ? i : i + "";
}
function _toPrimitive37(t, r) {
if ("object" != _typeof41(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof41(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Bar = function(_PureComponent) {
function Bar2() {
var _this;
_classCallCheck15(this, Bar2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper12(this, Bar2, [].concat(args));
_defineProperty36(_this, "state", {
isAnimationFinished: false
});
_defineProperty36(_this, "id", uniqueId("recharts-bar-"));
_defineProperty36(_this, "handleAnimationEnd", function() {
var onAnimationEnd2 = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if (onAnimationEnd2) {
onAnimationEnd2();
}
});
_defineProperty36(_this, "handleAnimationStart", function() {
var onAnimationStart2 = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if (onAnimationStart2) {
onAnimationStart2();
}
});
return _this;
}
_inherits14(Bar2, _PureComponent);
return _createClass15(Bar2, [{
key: "renderRectanglesStatically",
value: function renderRectanglesStatically(data) {
var _this2 = this;
var _this$props = this.props, shape = _this$props.shape, dataKey = _this$props.dataKey, activeIndex = _this$props.activeIndex, activeBar = _this$props.activeBar;
var baseProps = filterProps(this.props, false);
return data && data.map(function(entry, i) {
var isActive = i === activeIndex;
var option = isActive ? activeBar : shape;
var props = _objectSpread34(_objectSpread34(_objectSpread34({}, baseProps), entry), {}, {
isActive,
option,
index: i,
dataKey,
onAnimationStart: _this2.handleAnimationStart,
onAnimationEnd: _this2.handleAnimationEnd
});
return import_react45.default.createElement(Layer, _extends28({
className: "recharts-bar-rectangle"
}, adaptEventsOfChild(_this2.props, entry, i), {
key: "rectangle-".concat(entry === null || entry === void 0 ? void 0 : entry.x, "-").concat(entry === null || entry === void 0 ? void 0 : entry.y, "-").concat(entry === null || entry === void 0 ? void 0 : entry.value)
}), import_react45.default.createElement(BarRectangle, props));
});
}
}, {
key: "renderRectanglesWithAnimation",
value: function renderRectanglesWithAnimation() {
var _this3 = this;
var _this$props2 = this.props, data = _this$props2.data, layout = _this$props2.layout, isAnimationActive = _this$props2.isAnimationActive, animationBegin = _this$props2.animationBegin, animationDuration = _this$props2.animationDuration, animationEasing = _this$props2.animationEasing, animationId = _this$props2.animationId;
var prevData = this.state.prevData;
return import_react45.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "bar-".concat(animationId),
onAnimationEnd: this.handleAnimationEnd,
onAnimationStart: this.handleAnimationStart
}, function(_ref) {
var t = _ref.t;
var stepData = data.map(function(entry, index3) {
var prev = prevData && prevData[index3];
if (prev) {
var interpolatorX = interpolateNumber(prev.x, entry.x);
var interpolatorY = interpolateNumber(prev.y, entry.y);
var interpolatorWidth = interpolateNumber(prev.width, entry.width);
var interpolatorHeight = interpolateNumber(prev.height, entry.height);
return _objectSpread34(_objectSpread34({}, entry), {}, {
x: interpolatorX(t),
y: interpolatorY(t),
width: interpolatorWidth(t),
height: interpolatorHeight(t)
});
}
if (layout === "horizontal") {
var _interpolatorHeight = interpolateNumber(0, entry.height);
var h = _interpolatorHeight(t);
return _objectSpread34(_objectSpread34({}, entry), {}, {
y: entry.y + entry.height - h,
height: h
});
}
var interpolator = interpolateNumber(0, entry.width);
var w = interpolator(t);
return _objectSpread34(_objectSpread34({}, entry), {}, {
width: w
});
});
return import_react45.default.createElement(Layer, null, _this3.renderRectanglesStatically(stepData));
});
}
}, {
key: "renderRectangles",
value: function renderRectangles() {
var _this$props3 = this.props, data = _this$props3.data, isAnimationActive = _this$props3.isAnimationActive;
var prevData = this.state.prevData;
if (isAnimationActive && data && data.length && (!prevData || !(0, import_isEqual6.default)(prevData, data))) {
return this.renderRectanglesWithAnimation();
}
return this.renderRectanglesStatically(data);
}
}, {
key: "renderBackground",
value: function renderBackground() {
var _this4 = this;
var _this$props4 = this.props, data = _this$props4.data, dataKey = _this$props4.dataKey, activeIndex = _this$props4.activeIndex;
var backgroundProps = filterProps(this.props.background, false);
return data.map(function(entry, i) {
var value = entry.value, background = entry.background, rest = _objectWithoutProperties21(entry, _excluded26);
if (!background) {
return null;
}
var props = _objectSpread34(_objectSpread34(_objectSpread34(_objectSpread34(_objectSpread34({}, rest), {}, {
fill: "#eee"
}, background), backgroundProps), adaptEventsOfChild(_this4.props, entry, i)), {}, {
onAnimationStart: _this4.handleAnimationStart,
onAnimationEnd: _this4.handleAnimationEnd,
dataKey,
index: i,
className: "recharts-bar-background-rectangle"
});
return import_react45.default.createElement(BarRectangle, _extends28({
key: "background-bar-".concat(i),
option: _this4.props.background,
isActive: i === activeIndex
}, props));
});
}
}, {
key: "renderErrorBar",
value: function renderErrorBar(needClip, clipPathId) {
if (this.props.isAnimationActive && !this.state.isAnimationFinished) {
return null;
}
var _this$props5 = this.props, data = _this$props5.data, xAxis = _this$props5.xAxis, yAxis = _this$props5.yAxis, layout = _this$props5.layout, children2 = _this$props5.children;
var errorBarItems = findAllByType(children2, ErrorBar);
if (!errorBarItems) {
return null;
}
var offset = layout === "vertical" ? data[0].height / 2 : data[0].width / 2;
var dataPointFormatter = function dataPointFormatter2(dataPoint, dataKey) {
var value = Array.isArray(dataPoint.value) ? dataPoint.value[1] : dataPoint.value;
return {
x: dataPoint.x,
y: dataPoint.y,
value,
errorVal: getValueByDataKey(dataPoint, dataKey)
};
};
var errorBarProps = {
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
};
return import_react45.default.createElement(Layer, errorBarProps, errorBarItems.map(function(item) {
return import_react45.default.cloneElement(item, {
key: "error-bar-".concat(clipPathId, "-").concat(item.props.dataKey),
data,
xAxis,
yAxis,
layout,
offset,
dataPointFormatter
});
}));
}
}, {
key: "render",
value: function render() {
var _this$props6 = this.props, hide = _this$props6.hide, data = _this$props6.data, className = _this$props6.className, xAxis = _this$props6.xAxis, yAxis = _this$props6.yAxis, left = _this$props6.left, top = _this$props6.top, width = _this$props6.width, height = _this$props6.height, isAnimationActive = _this$props6.isAnimationActive, background = _this$props6.background, id = _this$props6.id;
if (hide || !data || !data.length) {
return null;
}
var isAnimationFinished = this.state.isAnimationFinished;
var layerClass = clsx_default("recharts-bar", className);
var needClipX = xAxis && xAxis.allowDataOverflow;
var needClipY = yAxis && yAxis.allowDataOverflow;
var needClip = needClipX || needClipY;
var clipPathId = (0, import_isNil10.default)(id) ? this.id : id;
return import_react45.default.createElement(Layer, {
className: layerClass
}, needClipX || needClipY ? import_react45.default.createElement("defs", null, import_react45.default.createElement("clipPath", {
id: "clipPath-".concat(clipPathId)
}, import_react45.default.createElement("rect", {
x: needClipX ? left : left - width / 2,
y: needClipY ? top : top - height / 2,
width: needClipX ? width : width * 2,
height: needClipY ? height : height * 2
}))) : null, import_react45.default.createElement(Layer, {
className: "recharts-bar-rectangles",
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
}, background ? this.renderBackground() : null, this.renderRectangles()), this.renderErrorBar(needClip, clipPathId), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, data));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curData: nextProps.data,
prevData: prevState.curData
};
}
if (nextProps.data !== prevState.curData) {
return {
curData: nextProps.data
};
}
return null;
}
}]);
}(import_react45.PureComponent);
_Bar = Bar;
_defineProperty36(Bar, "displayName", "Bar");
_defineProperty36(Bar, "defaultProps", {
xAxisId: 0,
yAxisId: 0,
legendType: "rect",
minPointSize: 0,
hide: false,
data: [],
layout: "vertical",
activeBar: false,
isAnimationActive: !Global.isSsr,
animationBegin: 0,
animationDuration: 400,
animationEasing: "ease"
});
_defineProperty36(Bar, "getComposedData", function(_ref2) {
var props = _ref2.props, item = _ref2.item, barPosition = _ref2.barPosition, bandSize = _ref2.bandSize, xAxis = _ref2.xAxis, yAxis = _ref2.yAxis, xAxisTicks = _ref2.xAxisTicks, yAxisTicks = _ref2.yAxisTicks, stackedData = _ref2.stackedData, dataStartIndex = _ref2.dataStartIndex, displayedData = _ref2.displayedData, offset = _ref2.offset;
var pos = findPositionOfBar(barPosition, item);
if (!pos) {
return null;
}
var layout = props.layout;
var itemDefaultProps = item.type.defaultProps;
var itemProps = itemDefaultProps !== void 0 ? _objectSpread34(_objectSpread34({}, itemDefaultProps), item.props) : item.props;
var dataKey = itemProps.dataKey, children2 = itemProps.children, minPointSizeProp = itemProps.minPointSize;
var numericAxis = layout === "horizontal" ? yAxis : xAxis;
var stackedDomain = stackedData ? numericAxis.scale.domain() : null;
var baseValue = getBaseValueOfBar({
numericAxis
});
var cells = findAllByType(children2, Cell);
var rects = displayedData.map(function(entry, index3) {
var value, x2, y2, width, height, background;
if (stackedData) {
value = truncateByDomain(stackedData[dataStartIndex + index3], stackedDomain);
} else {
value = getValueByDataKey(entry, dataKey);
if (!Array.isArray(value)) {
value = [baseValue, value];
}
}
var minPointSize = minPointSizeCallback(minPointSizeProp, _Bar.defaultProps.minPointSize)(value[1], index3);
if (layout === "horizontal") {
var _ref4;
var _ref3 = [yAxis.scale(value[0]), yAxis.scale(value[1])], baseValueScale = _ref3[0], currentValueScale = _ref3[1];
x2 = getCateCoordinateOfBar({
axis: xAxis,
ticks: xAxisTicks,
bandSize,
offset: pos.offset,
entry,
index: index3
});
y2 = (_ref4 = currentValueScale !== null && currentValueScale !== void 0 ? currentValueScale : baseValueScale) !== null && _ref4 !== void 0 ? _ref4 : void 0;
width = pos.size;
var computedHeight = baseValueScale - currentValueScale;
height = Number.isNaN(computedHeight) ? 0 : computedHeight;
background = {
x: x2,
y: yAxis.y,
width,
height: yAxis.height
};
if (Math.abs(minPointSize) > 0 && Math.abs(height) < Math.abs(minPointSize)) {
var delta = mathSign(height || minPointSize) * (Math.abs(minPointSize) - Math.abs(height));
y2 -= delta;
height += delta;
}
} else {
var _ref5 = [xAxis.scale(value[0]), xAxis.scale(value[1])], _baseValueScale = _ref5[0], _currentValueScale = _ref5[1];
x2 = _baseValueScale;
y2 = getCateCoordinateOfBar({
axis: yAxis,
ticks: yAxisTicks,
bandSize,
offset: pos.offset,
entry,
index: index3
});
width = _currentValueScale - _baseValueScale;
height = pos.size;
background = {
x: xAxis.x,
y: y2,
width: xAxis.width,
height
};
if (Math.abs(minPointSize) > 0 && Math.abs(width) < Math.abs(minPointSize)) {
var _delta = mathSign(width || minPointSize) * (Math.abs(minPointSize) - Math.abs(width));
width += _delta;
}
}
return _objectSpread34(_objectSpread34(_objectSpread34({}, entry), {}, {
x: x2,
y: y2,
width,
height,
value: stackedData ? value : value[1],
payload: entry,
background
}, cells && cells[index3] && cells[index3].props), {}, {
tooltipPayload: [getTooltipItem(item, entry)],
tooltipPosition: {
x: x2 + width / 2,
y: y2 + height / 2
}
});
});
return _objectSpread34({
data: rects,
layout
}, offset);
});
// node_modules/recharts/es6/util/CartesianUtils.js
function _typeof42(o) {
"@babel/helpers - typeof";
return _typeof42 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof42(o);
}
function _classCallCheck16(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties16(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey38(descriptor.key), descriptor);
}
}
function _createClass16(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties16(Constructor.prototype, protoProps);
if (staticProps) _defineProperties16(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function ownKeys35(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread35(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys35(Object(t), true).forEach(function(r2) {
_defineProperty37(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys35(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty37(obj, key, value) {
key = _toPropertyKey38(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey38(t) {
var i = _toPrimitive38(t, "string");
return "symbol" == _typeof42(i) ? i : i + "";
}
function _toPrimitive38(t, r) {
if ("object" != _typeof42(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof42(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var formatAxisMap3 = function formatAxisMap4(props, axisMap, offset, axisType, chartName) {
var width = props.width, height = props.height, layout = props.layout, children2 = props.children;
var ids = Object.keys(axisMap);
var steps = {
left: offset.left,
leftMirror: offset.left,
right: width - offset.right,
rightMirror: width - offset.right,
top: offset.top,
topMirror: offset.top,
bottom: height - offset.bottom,
bottomMirror: height - offset.bottom
};
var hasBar = !!findChildByType(children2, Bar);
return ids.reduce(function(result, id) {
var axis = axisMap[id];
var orientation = axis.orientation, domain = axis.domain, _axis$padding = axis.padding, padding = _axis$padding === void 0 ? {} : _axis$padding, mirror = axis.mirror, reversed = axis.reversed;
var offsetKey = "".concat(orientation).concat(mirror ? "Mirror" : "");
var calculatedPadding, range6, x2, y2, needSpace;
if (axis.type === "number" && (axis.padding === "gap" || axis.padding === "no-gap")) {
var diff = domain[1] - domain[0];
var smallestDistanceBetweenValues = Infinity;
var sortedValues = axis.categoricalDomain.sort();
sortedValues.forEach(function(value, index3) {
if (index3 > 0) {
smallestDistanceBetweenValues = Math.min((value || 0) - (sortedValues[index3 - 1] || 0), smallestDistanceBetweenValues);
}
});
if (Number.isFinite(smallestDistanceBetweenValues)) {
var smallestDistanceInPercent = smallestDistanceBetweenValues / diff;
var rangeWidth = axis.layout === "vertical" ? offset.height : offset.width;
if (axis.padding === "gap") {
calculatedPadding = smallestDistanceInPercent * rangeWidth / 2;
}
if (axis.padding === "no-gap") {
var gap = getPercentValue(props.barCategoryGap, smallestDistanceInPercent * rangeWidth);
var halfBand = smallestDistanceInPercent * rangeWidth / 2;
calculatedPadding = halfBand - gap - (halfBand - gap) / rangeWidth * gap;
}
}
}
if (axisType === "xAxis") {
range6 = [offset.left + (padding.left || 0) + (calculatedPadding || 0), offset.left + offset.width - (padding.right || 0) - (calculatedPadding || 0)];
} else if (axisType === "yAxis") {
range6 = layout === "horizontal" ? [offset.top + offset.height - (padding.bottom || 0), offset.top + (padding.top || 0)] : [offset.top + (padding.top || 0) + (calculatedPadding || 0), offset.top + offset.height - (padding.bottom || 0) - (calculatedPadding || 0)];
} else {
range6 = axis.range;
}
if (reversed) {
range6 = [range6[1], range6[0]];
}
var _parseScale = parseScale(axis, chartName, hasBar), scale = _parseScale.scale, realScaleType = _parseScale.realScaleType;
scale.domain(domain).range(range6);
checkDomainOfScale(scale);
var ticks2 = getTicksOfScale(scale, _objectSpread35(_objectSpread35({}, axis), {}, {
realScaleType
}));
if (axisType === "xAxis") {
needSpace = orientation === "top" && !mirror || orientation === "bottom" && mirror;
x2 = offset.left;
y2 = steps[offsetKey] - needSpace * axis.height;
} else if (axisType === "yAxis") {
needSpace = orientation === "left" && !mirror || orientation === "right" && mirror;
x2 = steps[offsetKey] - needSpace * axis.width;
y2 = offset.top;
}
var finalAxis = _objectSpread35(_objectSpread35(_objectSpread35({}, axis), ticks2), {}, {
realScaleType,
x: x2,
y: y2,
scale,
width: axisType === "xAxis" ? offset.width : axis.width,
height: axisType === "yAxis" ? offset.height : axis.height
});
finalAxis.bandSize = getBandSizeOfAxis(finalAxis, ticks2);
if (!axis.hide && axisType === "xAxis") {
steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.height;
} else if (!axis.hide) {
steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.width;
}
return _objectSpread35(_objectSpread35({}, result), {}, _defineProperty37({}, id, finalAxis));
}, {});
};
var rectWithPoints = function rectWithPoints2(_ref, _ref2) {
var x1 = _ref.x, y1 = _ref.y;
var x2 = _ref2.x, y2 = _ref2.y;
return {
x: Math.min(x1, x2),
y: Math.min(y1, y2),
width: Math.abs(x2 - x1),
height: Math.abs(y2 - y1)
};
};
var rectWithCoords = function rectWithCoords2(_ref3) {
var x1 = _ref3.x1, y1 = _ref3.y1, x2 = _ref3.x2, y2 = _ref3.y2;
return rectWithPoints({
x: x1,
y: y1
}, {
x: x2,
y: y2
});
};
var ScaleHelper = function() {
function ScaleHelper2(scale) {
_classCallCheck16(this, ScaleHelper2);
this.scale = scale;
}
return _createClass16(ScaleHelper2, [{
key: "domain",
get: function get10() {
return this.scale.domain;
}
}, {
key: "range",
get: function get10() {
return this.scale.range;
}
}, {
key: "rangeMin",
get: function get10() {
return this.range()[0];
}
}, {
key: "rangeMax",
get: function get10() {
return this.range()[1];
}
}, {
key: "bandwidth",
get: function get10() {
return this.scale.bandwidth;
}
}, {
key: "apply",
value: function apply(value) {
var _ref4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, bandAware = _ref4.bandAware, position3 = _ref4.position;
if (value === void 0) {
return void 0;
}
if (position3) {
switch (position3) {
case "start": {
return this.scale(value);
}
case "middle": {
var offset = this.bandwidth ? this.bandwidth() / 2 : 0;
return this.scale(value) + offset;
}
case "end": {
var _offset = this.bandwidth ? this.bandwidth() : 0;
return this.scale(value) + _offset;
}
default: {
return this.scale(value);
}
}
}
if (bandAware) {
var _offset2 = this.bandwidth ? this.bandwidth() / 2 : 0;
return this.scale(value) + _offset2;
}
return this.scale(value);
}
}, {
key: "isInRange",
value: function isInRange(value) {
var range6 = this.range();
var first2 = range6[0];
var last3 = range6[range6.length - 1];
return first2 <= last3 ? value >= first2 && value <= last3 : value >= last3 && value <= first2;
}
}], [{
key: "create",
value: function create(obj) {
return new ScaleHelper2(obj);
}
}]);
}();
_defineProperty37(ScaleHelper, "EPS", 1e-4);
var createLabeledScales = function createLabeledScales2(options) {
var scales = Object.keys(options).reduce(function(res, key) {
return _objectSpread35(_objectSpread35({}, res), {}, _defineProperty37({}, key, ScaleHelper.create(options[key])));
}, {});
return _objectSpread35(_objectSpread35({}, scales), {}, {
apply: function apply(coord) {
var _ref5 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, bandAware = _ref5.bandAware, position3 = _ref5.position;
return (0, import_mapValues.default)(coord, function(value, label) {
return scales[label].apply(value, {
bandAware,
position: position3
});
});
},
isInRange: function isInRange(coord) {
return (0, import_every3.default)(coord, function(value, label) {
return scales[label].isInRange(value);
});
}
});
};
function normalizeAngle(angle) {
return (angle % 180 + 180) % 180;
}
var getAngledRectangleWidth = function getAngledRectangleWidth2(_ref6) {
var width = _ref6.width, height = _ref6.height;
var angle = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
var normalizedAngle = normalizeAngle(angle);
var angleRadians = normalizedAngle * Math.PI / 180;
var angleThreshold = Math.atan(height / width);
var angledWidth = angleRadians > angleThreshold && angleRadians < Math.PI - angleThreshold ? height / Math.sin(angleRadians) : width / Math.cos(angleRadians);
return Math.abs(angledWidth);
};
// node_modules/recharts/es6/context/chartLayoutContext.js
var import_react46 = __toESM(require_react());
var import_find = __toESM(require_find());
var import_every4 = __toESM(require_every());
// node_modules/recharts/es6/util/calculateViewBox.js
var import_memoize = __toESM(require_memoize());
var calculateViewBox = (0, import_memoize.default)(function(offset) {
return {
x: offset.left,
y: offset.top,
width: offset.width,
height: offset.height
};
}, function(offset) {
return ["l", offset.left, "t", offset.top, "w", offset.width, "h", offset.height].join("");
});
// node_modules/recharts/es6/context/chartLayoutContext.js
function _typeof43(o) {
"@babel/helpers - typeof";
return _typeof43 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof43(o);
}
var XAxisContext = (0, import_react46.createContext)(void 0);
var YAxisContext = (0, import_react46.createContext)(void 0);
var ViewBoxContext = (0, import_react46.createContext)(void 0);
var OffsetContext = (0, import_react46.createContext)({});
var ClipPathIdContext = (0, import_react46.createContext)(void 0);
var ChartHeightContext = (0, import_react46.createContext)(0);
var ChartWidthContext = (0, import_react46.createContext)(0);
var ChartLayoutContextProvider = function ChartLayoutContextProvider2(props) {
var _props$state = props.state, xAxisMap = _props$state.xAxisMap, yAxisMap = _props$state.yAxisMap, offset = _props$state.offset, clipPathId = props.clipPathId, children2 = props.children, width = props.width, height = props.height;
var viewBox = calculateViewBox(offset);
return import_react46.default.createElement(XAxisContext.Provider, {
value: xAxisMap
}, import_react46.default.createElement(YAxisContext.Provider, {
value: yAxisMap
}, import_react46.default.createElement(OffsetContext.Provider, {
value: offset
}, import_react46.default.createElement(ViewBoxContext.Provider, {
value: viewBox
}, import_react46.default.createElement(ClipPathIdContext.Provider, {
value: clipPathId
}, import_react46.default.createElement(ChartHeightContext.Provider, {
value: height
}, import_react46.default.createElement(ChartWidthContext.Provider, {
value: width
}, children2)))))));
};
var useClipPathId = function useClipPathId2() {
return (0, import_react46.useContext)(ClipPathIdContext);
};
function getKeysForDebug(object) {
var keys2 = Object.keys(object);
if (keys2.length === 0) {
return "There are no available ids.";
}
return "Available ids are: ".concat(keys2, ".");
}
var useXAxisOrThrow = function useXAxisOrThrow2(xAxisId) {
var xAxisMap = (0, import_react46.useContext)(XAxisContext);
!(xAxisMap != null) ? true ? invariant(false, "Could not find Recharts context; are you sure this is rendered inside a Recharts wrapper component?") : invariant(false) : void 0;
var xAxis = xAxisMap[xAxisId];
!(xAxis != null) ? true ? invariant(false, 'Could not find xAxis by id "'.concat(xAxisId, '" [').concat(_typeof43(xAxisId), "]. ").concat(getKeysForDebug(xAxisMap))) : invariant(false) : void 0;
return xAxis;
};
var useArbitraryXAxis = function useArbitraryXAxis2() {
var xAxisMap = (0, import_react46.useContext)(XAxisContext);
return getAnyElementOfObject(xAxisMap);
};
var useYAxisWithFiniteDomainOrRandom = function useYAxisWithFiniteDomainOrRandom2() {
var yAxisMap = (0, import_react46.useContext)(YAxisContext);
var yAxisWithFiniteDomain = (0, import_find.default)(yAxisMap, function(axis) {
return (0, import_every4.default)(axis.domain, Number.isFinite);
});
return yAxisWithFiniteDomain || getAnyElementOfObject(yAxisMap);
};
var useYAxisOrThrow = function useYAxisOrThrow2(yAxisId) {
var yAxisMap = (0, import_react46.useContext)(YAxisContext);
!(yAxisMap != null) ? true ? invariant(false, "Could not find Recharts context; are you sure this is rendered inside a Recharts wrapper component?") : invariant(false) : void 0;
var yAxis = yAxisMap[yAxisId];
!(yAxis != null) ? true ? invariant(false, 'Could not find yAxis by id "'.concat(yAxisId, '" [').concat(_typeof43(yAxisId), "]. ").concat(getKeysForDebug(yAxisMap))) : invariant(false) : void 0;
return yAxis;
};
var useViewBox = function useViewBox2() {
var viewBox = (0, import_react46.useContext)(ViewBoxContext);
return viewBox;
};
var useOffset = function useOffset2() {
return (0, import_react46.useContext)(OffsetContext);
};
var useChartWidth = function useChartWidth2() {
return (0, import_react46.useContext)(ChartWidthContext);
};
var useChartHeight = function useChartHeight2() {
return (0, import_react46.useContext)(ChartHeightContext);
};
// node_modules/recharts/es6/cartesian/ReferenceLine.js
function _typeof44(o) {
"@babel/helpers - typeof";
return _typeof44 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof44(o);
}
function _classCallCheck17(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties17(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey39(descriptor.key), descriptor);
}
}
function _createClass17(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties17(Constructor.prototype, protoProps);
if (staticProps) _defineProperties17(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper13(t, o, e) {
return o = _getPrototypeOf15(o), _possibleConstructorReturn15(t, _isNativeReflectConstruct15() ? Reflect.construct(o, e || [], _getPrototypeOf15(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn15(self2, call) {
if (call && (_typeof44(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized16(self2);
}
function _assertThisInitialized16(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct15() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct15 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf15(o) {
_getPrototypeOf15 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf15(o);
}
function _inherits15(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf16(subClass, superClass);
}
function _setPrototypeOf16(o, p) {
_setPrototypeOf16 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf16(o, p);
}
function ownKeys36(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread36(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys36(Object(t), true).forEach(function(r2) {
_defineProperty38(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys36(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty38(obj, key, value) {
key = _toPropertyKey39(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey39(t) {
var i = _toPrimitive39(t, "string");
return "symbol" == _typeof44(i) ? i : i + "";
}
function _toPrimitive39(t, r) {
if ("object" != _typeof44(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof44(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _slicedToArray12(arr, i) {
return _arrayWithHoles13(arr) || _iterableToArrayLimit12(arr, i) || _unsupportedIterableToArray19(arr, i) || _nonIterableRest13();
}
function _nonIterableRest13() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray19(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray19(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray19(o, minLen);
}
function _arrayLikeToArray19(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _iterableToArrayLimit12(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e, n, i, u, a2 = [], f = true, o = false;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = false;
} else for (; !(f = (e = i.call(t)).done) && (a2.push(e.value), a2.length !== l); f = true) ;
} catch (r2) {
o = true, n = r2;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a2;
}
}
function _arrayWithHoles13(arr) {
if (Array.isArray(arr)) return arr;
}
function _extends29() {
_extends29 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends29.apply(this, arguments);
}
var renderLine = function renderLine2(option, props) {
var line;
if (import_react47.default.isValidElement(option)) {
line = import_react47.default.cloneElement(option, props);
} else if ((0, import_isFunction17.default)(option)) {
line = option(props);
} else {
line = import_react47.default.createElement("line", _extends29({}, props, {
className: "recharts-reference-line-line"
}));
}
return line;
};
var getEndPoints = function getEndPoints2(scales, isFixedX, isFixedY, isSegment, viewBox, position3, xAxisOrientation, yAxisOrientation, props) {
var x2 = viewBox.x, y2 = viewBox.y, width = viewBox.width, height = viewBox.height;
if (isFixedY) {
var yCoord = props.y;
var coord = scales.y.apply(yCoord, {
position: position3
});
if (ifOverflowMatches(props, "discard") && !scales.y.isInRange(coord)) {
return null;
}
var points = [{
x: x2 + width,
y: coord
}, {
x: x2,
y: coord
}];
return yAxisOrientation === "left" ? points.reverse() : points;
}
if (isFixedX) {
var xCoord = props.x;
var _coord = scales.x.apply(xCoord, {
position: position3
});
if (ifOverflowMatches(props, "discard") && !scales.x.isInRange(_coord)) {
return null;
}
var _points = [{
x: _coord,
y: y2 + height
}, {
x: _coord,
y: y2
}];
return xAxisOrientation === "top" ? _points.reverse() : _points;
}
if (isSegment) {
var segment = props.segment;
var _points2 = segment.map(function(p) {
return scales.apply(p, {
position: position3
});
});
if (ifOverflowMatches(props, "discard") && (0, import_some3.default)(_points2, function(p) {
return !scales.isInRange(p);
})) {
return null;
}
return _points2;
}
return null;
};
function ReferenceLineImpl(props) {
var fixedX = props.x, fixedY = props.y, segment = props.segment, xAxisId = props.xAxisId, yAxisId = props.yAxisId, shape = props.shape, className = props.className, alwaysShow = props.alwaysShow;
var clipPathId = useClipPathId();
var xAxis = useXAxisOrThrow(xAxisId);
var yAxis = useYAxisOrThrow(yAxisId);
var viewBox = useViewBox();
if (!clipPathId || !viewBox) {
return null;
}
warn(alwaysShow === void 0, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');
var scales = createLabeledScales({
x: xAxis.scale,
y: yAxis.scale
});
var isX = isNumOrStr(fixedX);
var isY = isNumOrStr(fixedY);
var isSegment = segment && segment.length === 2;
var endPoints = getEndPoints(scales, isX, isY, isSegment, viewBox, props.position, xAxis.orientation, yAxis.orientation, props);
if (!endPoints) {
return null;
}
var _endPoints = _slicedToArray12(endPoints, 2), _endPoints$ = _endPoints[0], x1 = _endPoints$.x, y1 = _endPoints$.y, _endPoints$2 = _endPoints[1], x2 = _endPoints$2.x, y2 = _endPoints$2.y;
var clipPath = ifOverflowMatches(props, "hidden") ? "url(#".concat(clipPathId, ")") : void 0;
var lineProps = _objectSpread36(_objectSpread36({
clipPath
}, filterProps(props, true)), {}, {
x1,
y1,
x2,
y2
});
return import_react47.default.createElement(Layer, {
className: clsx_default("recharts-reference-line", className)
}, renderLine(shape, lineProps), Label.renderCallByParent(props, rectWithCoords({
x1,
y1,
x2,
y2
})));
}
var ReferenceLine = function(_React$Component) {
function ReferenceLine2() {
_classCallCheck17(this, ReferenceLine2);
return _callSuper13(this, ReferenceLine2, arguments);
}
_inherits15(ReferenceLine2, _React$Component);
return _createClass17(ReferenceLine2, [{
key: "render",
value: function render() {
return import_react47.default.createElement(ReferenceLineImpl, this.props);
}
}]);
}(import_react47.default.Component);
_defineProperty38(ReferenceLine, "displayName", "ReferenceLine");
_defineProperty38(ReferenceLine, "defaultProps", {
isFront: false,
ifOverflow: "discard",
xAxisId: 0,
yAxisId: 0,
fill: "none",
stroke: "#ccc",
fillOpacity: 1,
strokeWidth: 1,
position: "middle"
});
// node_modules/recharts/es6/cartesian/ReferenceDot.js
var import_react48 = __toESM(require_react());
var import_isFunction18 = __toESM(require_isFunction());
function _extends30() {
_extends30 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends30.apply(this, arguments);
}
function _typeof45(o) {
"@babel/helpers - typeof";
return _typeof45 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof45(o);
}
function ownKeys37(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread37(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys37(Object(t), true).forEach(function(r2) {
_defineProperty39(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys37(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck18(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties18(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey40(descriptor.key), descriptor);
}
}
function _createClass18(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties18(Constructor.prototype, protoProps);
if (staticProps) _defineProperties18(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper14(t, o, e) {
return o = _getPrototypeOf16(o), _possibleConstructorReturn16(t, _isNativeReflectConstruct16() ? Reflect.construct(o, e || [], _getPrototypeOf16(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn16(self2, call) {
if (call && (_typeof45(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized17(self2);
}
function _assertThisInitialized17(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct16() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct16 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf16(o) {
_getPrototypeOf16 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf16(o);
}
function _inherits16(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf17(subClass, superClass);
}
function _setPrototypeOf17(o, p) {
_setPrototypeOf17 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf17(o, p);
}
function _defineProperty39(obj, key, value) {
key = _toPropertyKey40(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey40(t) {
var i = _toPrimitive40(t, "string");
return "symbol" == _typeof45(i) ? i : i + "";
}
function _toPrimitive40(t, r) {
if ("object" != _typeof45(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof45(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var getCoordinate = function getCoordinate2(props) {
var x2 = props.x, y2 = props.y, xAxis = props.xAxis, yAxis = props.yAxis;
var scales = createLabeledScales({
x: xAxis.scale,
y: yAxis.scale
});
var result = scales.apply({
x: x2,
y: y2
}, {
bandAware: true
});
if (ifOverflowMatches(props, "discard") && !scales.isInRange(result)) {
return null;
}
return result;
};
var ReferenceDot = function(_React$Component) {
function ReferenceDot2() {
_classCallCheck18(this, ReferenceDot2);
return _callSuper14(this, ReferenceDot2, arguments);
}
_inherits16(ReferenceDot2, _React$Component);
return _createClass18(ReferenceDot2, [{
key: "render",
value: function render() {
var _this$props = this.props, x2 = _this$props.x, y2 = _this$props.y, r = _this$props.r, alwaysShow = _this$props.alwaysShow, clipPathId = _this$props.clipPathId;
var isX = isNumOrStr(x2);
var isY = isNumOrStr(y2);
warn(alwaysShow === void 0, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');
if (!isX || !isY) {
return null;
}
var coordinate = getCoordinate(this.props);
if (!coordinate) {
return null;
}
var cx = coordinate.x, cy = coordinate.y;
var _this$props2 = this.props, shape = _this$props2.shape, className = _this$props2.className;
var clipPath = ifOverflowMatches(this.props, "hidden") ? "url(#".concat(clipPathId, ")") : void 0;
var dotProps = _objectSpread37(_objectSpread37({
clipPath
}, filterProps(this.props, true)), {}, {
cx,
cy
});
return import_react48.default.createElement(Layer, {
className: clsx_default("recharts-reference-dot", className)
}, ReferenceDot2.renderDot(shape, dotProps), Label.renderCallByParent(this.props, {
x: cx - r,
y: cy - r,
width: 2 * r,
height: 2 * r
}));
}
}]);
}(import_react48.default.Component);
_defineProperty39(ReferenceDot, "displayName", "ReferenceDot");
_defineProperty39(ReferenceDot, "defaultProps", {
isFront: false,
ifOverflow: "discard",
xAxisId: 0,
yAxisId: 0,
r: 10,
fill: "#fff",
stroke: "#ccc",
fillOpacity: 1,
strokeWidth: 1
});
_defineProperty39(ReferenceDot, "renderDot", function(option, props) {
var dot;
if (import_react48.default.isValidElement(option)) {
dot = import_react48.default.cloneElement(option, props);
} else if ((0, import_isFunction18.default)(option)) {
dot = option(props);
} else {
dot = import_react48.default.createElement(Dot, _extends30({}, props, {
cx: props.cx,
cy: props.cy,
className: "recharts-reference-dot-dot"
}));
}
return dot;
});
// node_modules/recharts/es6/cartesian/ReferenceArea.js
var import_react49 = __toESM(require_react());
var import_isFunction19 = __toESM(require_isFunction());
function _extends31() {
_extends31 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends31.apply(this, arguments);
}
function _typeof46(o) {
"@babel/helpers - typeof";
return _typeof46 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof46(o);
}
function ownKeys38(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread38(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys38(Object(t), true).forEach(function(r2) {
_defineProperty40(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys38(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck19(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties19(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey41(descriptor.key), descriptor);
}
}
function _createClass19(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties19(Constructor.prototype, protoProps);
if (staticProps) _defineProperties19(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper15(t, o, e) {
return o = _getPrototypeOf17(o), _possibleConstructorReturn17(t, _isNativeReflectConstruct17() ? Reflect.construct(o, e || [], _getPrototypeOf17(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn17(self2, call) {
if (call && (_typeof46(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized18(self2);
}
function _assertThisInitialized18(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct17() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct17 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf17(o) {
_getPrototypeOf17 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf17(o);
}
function _inherits17(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf18(subClass, superClass);
}
function _setPrototypeOf18(o, p) {
_setPrototypeOf18 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf18(o, p);
}
function _defineProperty40(obj, key, value) {
key = _toPropertyKey41(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey41(t) {
var i = _toPrimitive41(t, "string");
return "symbol" == _typeof46(i) ? i : i + "";
}
function _toPrimitive41(t, r) {
if ("object" != _typeof46(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof46(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var getRect = function getRect2(hasX1, hasX2, hasY1, hasY2, props) {
var xValue1 = props.x1, xValue2 = props.x2, yValue1 = props.y1, yValue2 = props.y2, xAxis = props.xAxis, yAxis = props.yAxis;
if (!xAxis || !yAxis) return null;
var scales = createLabeledScales({
x: xAxis.scale,
y: yAxis.scale
});
var p1 = {
x: hasX1 ? scales.x.apply(xValue1, {
position: "start"
}) : scales.x.rangeMin,
y: hasY1 ? scales.y.apply(yValue1, {
position: "start"
}) : scales.y.rangeMin
};
var p2 = {
x: hasX2 ? scales.x.apply(xValue2, {
position: "end"
}) : scales.x.rangeMax,
y: hasY2 ? scales.y.apply(yValue2, {
position: "end"
}) : scales.y.rangeMax
};
if (ifOverflowMatches(props, "discard") && (!scales.isInRange(p1) || !scales.isInRange(p2))) {
return null;
}
return rectWithPoints(p1, p2);
};
var ReferenceArea = function(_React$Component) {
function ReferenceArea2() {
_classCallCheck19(this, ReferenceArea2);
return _callSuper15(this, ReferenceArea2, arguments);
}
_inherits17(ReferenceArea2, _React$Component);
return _createClass19(ReferenceArea2, [{
key: "render",
value: function render() {
var _this$props = this.props, x1 = _this$props.x1, x2 = _this$props.x2, y1 = _this$props.y1, y2 = _this$props.y2, className = _this$props.className, alwaysShow = _this$props.alwaysShow, clipPathId = _this$props.clipPathId;
warn(alwaysShow === void 0, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');
var hasX1 = isNumOrStr(x1);
var hasX2 = isNumOrStr(x2);
var hasY1 = isNumOrStr(y1);
var hasY2 = isNumOrStr(y2);
var shape = this.props.shape;
if (!hasX1 && !hasX2 && !hasY1 && !hasY2 && !shape) {
return null;
}
var rect = getRect(hasX1, hasX2, hasY1, hasY2, this.props);
if (!rect && !shape) {
return null;
}
var clipPath = ifOverflowMatches(this.props, "hidden") ? "url(#".concat(clipPathId, ")") : void 0;
return import_react49.default.createElement(Layer, {
className: clsx_default("recharts-reference-area", className)
}, ReferenceArea2.renderRect(shape, _objectSpread38(_objectSpread38({
clipPath
}, filterProps(this.props, true)), rect)), Label.renderCallByParent(this.props, rect));
}
}]);
}(import_react49.default.Component);
_defineProperty40(ReferenceArea, "displayName", "ReferenceArea");
_defineProperty40(ReferenceArea, "defaultProps", {
isFront: false,
ifOverflow: "discard",
xAxisId: 0,
yAxisId: 0,
r: 10,
fill: "#ccc",
fillOpacity: 0.5,
stroke: "none",
strokeWidth: 1
});
_defineProperty40(ReferenceArea, "renderRect", function(option, props) {
var rect;
if (import_react49.default.isValidElement(option)) {
rect = import_react49.default.cloneElement(option, props);
} else if ((0, import_isFunction19.default)(option)) {
rect = option(props);
} else {
rect = import_react49.default.createElement(Rectangle, _extends31({}, props, {
className: "recharts-reference-area-rect"
}));
}
return rect;
});
// node_modules/recharts/es6/cartesian/CartesianAxis.js
var import_react50 = __toESM(require_react());
var import_isFunction21 = __toESM(require_isFunction());
var import_get5 = __toESM(require_get());
// node_modules/recharts/es6/cartesian/getTicks.js
var import_isFunction20 = __toESM(require_isFunction());
// node_modules/recharts/es6/util/getEveryNthWithCondition.js
function getEveryNthWithCondition(array3, n, isValid) {
if (n < 1) {
return [];
}
if (n === 1 && isValid === void 0) {
return array3;
}
var result = [];
for (var i = 0; i < array3.length; i += n) {
if (isValid === void 0 || isValid(array3[i]) === true) {
result.push(array3[i]);
} else {
return void 0;
}
}
return result;
}
// node_modules/recharts/es6/util/TickUtils.js
function getAngledTickWidth(contentSize, unitSize, angle) {
var size = {
width: contentSize.width + unitSize.width,
height: contentSize.height + unitSize.height
};
return getAngledRectangleWidth(size, angle);
}
function getTickBoundaries(viewBox, sign2, sizeKey) {
var isWidth = sizeKey === "width";
var x2 = viewBox.x, y2 = viewBox.y, width = viewBox.width, height = viewBox.height;
if (sign2 === 1) {
return {
start: isWidth ? x2 : y2,
end: isWidth ? x2 + width : y2 + height
};
}
return {
start: isWidth ? x2 + width : y2 + height,
end: isWidth ? x2 : y2
};
}
function isVisible(sign2, tickPosition, getSize, start, end) {
if (sign2 * tickPosition < sign2 * start || sign2 * tickPosition > sign2 * end) {
return false;
}
var size = getSize();
return sign2 * (tickPosition - sign2 * size / 2 - start) >= 0 && sign2 * (tickPosition + sign2 * size / 2 - end) <= 0;
}
function getNumberIntervalTicks(ticks2, interval) {
return getEveryNthWithCondition(ticks2, interval + 1);
}
// node_modules/recharts/es6/cartesian/getEquidistantTicks.js
function getEquidistantTicks(sign2, boundaries, getTickSize, ticks2, minTickGap) {
var result = (ticks2 || []).slice();
var initialStart = boundaries.start, end = boundaries.end;
var index3 = 0;
var stepsize = 1;
var start = initialStart;
var _loop = function _loop2() {
var entry = ticks2 === null || ticks2 === void 0 ? void 0 : ticks2[index3];
if (entry === void 0) {
return {
v: getEveryNthWithCondition(ticks2, stepsize)
};
}
var i = index3;
var size;
var getSize = function getSize2() {
if (size === void 0) {
size = getTickSize(entry, i);
}
return size;
};
var tickCoord = entry.coordinate;
var isShow = index3 === 0 || isVisible(sign2, tickCoord, getSize, start, end);
if (!isShow) {
index3 = 0;
start = initialStart;
stepsize += 1;
}
if (isShow) {
start = tickCoord + sign2 * (getSize() / 2 + minTickGap);
index3 += stepsize;
}
}, _ret;
while (stepsize <= result.length) {
_ret = _loop();
if (_ret) return _ret.v;
}
return [];
}
// node_modules/recharts/es6/cartesian/getTicks.js
function _typeof47(o) {
"@babel/helpers - typeof";
return _typeof47 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof47(o);
}
function ownKeys39(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread39(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys39(Object(t), true).forEach(function(r2) {
_defineProperty41(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys39(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty41(obj, key, value) {
key = _toPropertyKey42(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey42(t) {
var i = _toPrimitive42(t, "string");
return "symbol" == _typeof47(i) ? i : i + "";
}
function _toPrimitive42(t, r) {
if ("object" != _typeof47(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof47(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function getTicksEnd(sign2, boundaries, getTickSize, ticks2, minTickGap) {
var result = (ticks2 || []).slice();
var len = result.length;
var start = boundaries.start;
var end = boundaries.end;
var _loop = function _loop2(i2) {
var entry = result[i2];
var size;
var getSize = function getSize2() {
if (size === void 0) {
size = getTickSize(entry, i2);
}
return size;
};
if (i2 === len - 1) {
var gap = sign2 * (entry.coordinate + sign2 * getSize() / 2 - end);
result[i2] = entry = _objectSpread39(_objectSpread39({}, entry), {}, {
tickCoord: gap > 0 ? entry.coordinate - gap * sign2 : entry.coordinate
});
} else {
result[i2] = entry = _objectSpread39(_objectSpread39({}, entry), {}, {
tickCoord: entry.coordinate
});
}
var isShow = isVisible(sign2, entry.tickCoord, getSize, start, end);
if (isShow) {
end = entry.tickCoord - sign2 * (getSize() / 2 + minTickGap);
result[i2] = _objectSpread39(_objectSpread39({}, entry), {}, {
isShow: true
});
}
};
for (var i = len - 1; i >= 0; i--) {
_loop(i);
}
return result;
}
function getTicksStart(sign2, boundaries, getTickSize, ticks2, minTickGap, preserveEnd) {
var result = (ticks2 || []).slice();
var len = result.length;
var start = boundaries.start, end = boundaries.end;
if (preserveEnd) {
var tail = ticks2[len - 1];
var tailSize = getTickSize(tail, len - 1);
var tailGap = sign2 * (tail.coordinate + sign2 * tailSize / 2 - end);
result[len - 1] = tail = _objectSpread39(_objectSpread39({}, tail), {}, {
tickCoord: tailGap > 0 ? tail.coordinate - tailGap * sign2 : tail.coordinate
});
var isTailShow = isVisible(sign2, tail.tickCoord, function() {
return tailSize;
}, start, end);
if (isTailShow) {
end = tail.tickCoord - sign2 * (tailSize / 2 + minTickGap);
result[len - 1] = _objectSpread39(_objectSpread39({}, tail), {}, {
isShow: true
});
}
}
var count3 = preserveEnd ? len - 1 : len;
var _loop2 = function _loop22(i2) {
var entry = result[i2];
var size;
var getSize = function getSize2() {
if (size === void 0) {
size = getTickSize(entry, i2);
}
return size;
};
if (i2 === 0) {
var gap = sign2 * (entry.coordinate - sign2 * getSize() / 2 - start);
result[i2] = entry = _objectSpread39(_objectSpread39({}, entry), {}, {
tickCoord: gap < 0 ? entry.coordinate - gap * sign2 : entry.coordinate
});
} else {
result[i2] = entry = _objectSpread39(_objectSpread39({}, entry), {}, {
tickCoord: entry.coordinate
});
}
var isShow = isVisible(sign2, entry.tickCoord, getSize, start, end);
if (isShow) {
start = entry.tickCoord + sign2 * (getSize() / 2 + minTickGap);
result[i2] = _objectSpread39(_objectSpread39({}, entry), {}, {
isShow: true
});
}
};
for (var i = 0; i < count3; i++) {
_loop2(i);
}
return result;
}
function getTicks(props, fontSize, letterSpacing) {
var tick = props.tick, ticks2 = props.ticks, viewBox = props.viewBox, minTickGap = props.minTickGap, orientation = props.orientation, interval = props.interval, tickFormatter = props.tickFormatter, unit2 = props.unit, angle = props.angle;
if (!ticks2 || !ticks2.length || !tick) {
return [];
}
if (isNumber(interval) || Global.isSsr) {
return getNumberIntervalTicks(ticks2, typeof interval === "number" && isNumber(interval) ? interval : 0);
}
var candidates = [];
var sizeKey = orientation === "top" || orientation === "bottom" ? "width" : "height";
var unitSize = unit2 && sizeKey === "width" ? getStringSize(unit2, {
fontSize,
letterSpacing
}) : {
width: 0,
height: 0
};
var getTickSize = function getTickSize2(content, index3) {
var value = (0, import_isFunction20.default)(tickFormatter) ? tickFormatter(content.value, index3) : content.value;
return sizeKey === "width" ? getAngledTickWidth(getStringSize(value, {
fontSize,
letterSpacing
}), unitSize, angle) : getStringSize(value, {
fontSize,
letterSpacing
})[sizeKey];
};
var sign2 = ticks2.length >= 2 ? mathSign(ticks2[1].coordinate - ticks2[0].coordinate) : 1;
var boundaries = getTickBoundaries(viewBox, sign2, sizeKey);
if (interval === "equidistantPreserveStart") {
return getEquidistantTicks(sign2, boundaries, getTickSize, ticks2, minTickGap);
}
if (interval === "preserveStart" || interval === "preserveStartEnd") {
candidates = getTicksStart(sign2, boundaries, getTickSize, ticks2, minTickGap, interval === "preserveStartEnd");
} else {
candidates = getTicksEnd(sign2, boundaries, getTickSize, ticks2, minTickGap);
}
return candidates.filter(function(entry) {
return entry.isShow;
});
}
// node_modules/recharts/es6/cartesian/CartesianAxis.js
var _excluded27 = ["viewBox"];
var _excluded28 = ["viewBox"];
var _excluded32 = ["ticks"];
function _typeof48(o) {
"@babel/helpers - typeof";
return _typeof48 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof48(o);
}
function _extends32() {
_extends32 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends32.apply(this, arguments);
}
function ownKeys40(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread40(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys40(Object(t), true).forEach(function(r2) {
_defineProperty42(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys40(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _objectWithoutProperties22(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose23(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose23(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck20(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties20(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey43(descriptor.key), descriptor);
}
}
function _createClass20(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties20(Constructor.prototype, protoProps);
if (staticProps) _defineProperties20(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper16(t, o, e) {
return o = _getPrototypeOf18(o), _possibleConstructorReturn18(t, _isNativeReflectConstruct18() ? Reflect.construct(o, e || [], _getPrototypeOf18(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn18(self2, call) {
if (call && (_typeof48(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized19(self2);
}
function _assertThisInitialized19(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct18() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct18 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf18(o) {
_getPrototypeOf18 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf18(o);
}
function _inherits18(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf19(subClass, superClass);
}
function _setPrototypeOf19(o, p) {
_setPrototypeOf19 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf19(o, p);
}
function _defineProperty42(obj, key, value) {
key = _toPropertyKey43(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey43(t) {
var i = _toPrimitive43(t, "string");
return "symbol" == _typeof48(i) ? i : i + "";
}
function _toPrimitive43(t, r) {
if ("object" != _typeof48(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof48(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var CartesianAxis = function(_Component) {
function CartesianAxis2(props) {
var _this;
_classCallCheck20(this, CartesianAxis2);
_this = _callSuper16(this, CartesianAxis2, [props]);
_this.state = {
fontSize: "",
letterSpacing: ""
};
return _this;
}
_inherits18(CartesianAxis2, _Component);
return _createClass20(CartesianAxis2, [{
key: "shouldComponentUpdate",
value: function shouldComponentUpdate(_ref, nextState) {
var viewBox = _ref.viewBox, restProps = _objectWithoutProperties22(_ref, _excluded27);
var _this$props = this.props, viewBoxOld = _this$props.viewBox, restPropsOld = _objectWithoutProperties22(_this$props, _excluded28);
return !shallowEqual(viewBox, viewBoxOld) || !shallowEqual(restProps, restPropsOld) || !shallowEqual(nextState, this.state);
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
var htmlLayer = this.layerReference;
if (!htmlLayer) return;
var tick = htmlLayer.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];
if (tick) {
this.setState({
fontSize: window.getComputedStyle(tick).fontSize,
letterSpacing: window.getComputedStyle(tick).letterSpacing
});
}
}
/**
* Calculate the coordinates of endpoints in ticks
* @param {Object} data The data of a simple tick
* @return {Object} (x1, y1): The coordinate of endpoint close to tick text
* (x2, y2): The coordinate of endpoint close to axis
*/
}, {
key: "getTickLineCoord",
value: function getTickLineCoord(data) {
var _this$props2 = this.props, x2 = _this$props2.x, y2 = _this$props2.y, width = _this$props2.width, height = _this$props2.height, orientation = _this$props2.orientation, tickSize = _this$props2.tickSize, mirror = _this$props2.mirror, tickMargin = _this$props2.tickMargin;
var x1, x22, y1, y22, tx, ty;
var sign2 = mirror ? -1 : 1;
var finalTickSize = data.tickSize || tickSize;
var tickCoord = isNumber(data.tickCoord) ? data.tickCoord : data.coordinate;
switch (orientation) {
case "top":
x1 = x22 = data.coordinate;
y22 = y2 + +!mirror * height;
y1 = y22 - sign2 * finalTickSize;
ty = y1 - sign2 * tickMargin;
tx = tickCoord;
break;
case "left":
y1 = y22 = data.coordinate;
x22 = x2 + +!mirror * width;
x1 = x22 - sign2 * finalTickSize;
tx = x1 - sign2 * tickMargin;
ty = tickCoord;
break;
case "right":
y1 = y22 = data.coordinate;
x22 = x2 + +mirror * width;
x1 = x22 + sign2 * finalTickSize;
tx = x1 + sign2 * tickMargin;
ty = tickCoord;
break;
default:
x1 = x22 = data.coordinate;
y22 = y2 + +mirror * height;
y1 = y22 + sign2 * finalTickSize;
ty = y1 + sign2 * tickMargin;
tx = tickCoord;
break;
}
return {
line: {
x1,
y1,
x2: x22,
y2: y22
},
tick: {
x: tx,
y: ty
}
};
}
}, {
key: "getTickTextAnchor",
value: function getTickTextAnchor() {
var _this$props3 = this.props, orientation = _this$props3.orientation, mirror = _this$props3.mirror;
var textAnchor;
switch (orientation) {
case "left":
textAnchor = mirror ? "start" : "end";
break;
case "right":
textAnchor = mirror ? "end" : "start";
break;
default:
textAnchor = "middle";
break;
}
return textAnchor;
}
}, {
key: "getTickVerticalAnchor",
value: function getTickVerticalAnchor() {
var _this$props4 = this.props, orientation = _this$props4.orientation, mirror = _this$props4.mirror;
var verticalAnchor = "end";
switch (orientation) {
case "left":
case "right":
verticalAnchor = "middle";
break;
case "top":
verticalAnchor = mirror ? "start" : "end";
break;
default:
verticalAnchor = mirror ? "end" : "start";
break;
}
return verticalAnchor;
}
}, {
key: "renderAxisLine",
value: function renderAxisLine() {
var _this$props5 = this.props, x2 = _this$props5.x, y2 = _this$props5.y, width = _this$props5.width, height = _this$props5.height, orientation = _this$props5.orientation, mirror = _this$props5.mirror, axisLine = _this$props5.axisLine;
var props = _objectSpread40(_objectSpread40(_objectSpread40({}, filterProps(this.props, false)), filterProps(axisLine, false)), {}, {
fill: "none"
});
if (orientation === "top" || orientation === "bottom") {
var needHeight = +(orientation === "top" && !mirror || orientation === "bottom" && mirror);
props = _objectSpread40(_objectSpread40({}, props), {}, {
x1: x2,
y1: y2 + needHeight * height,
x2: x2 + width,
y2: y2 + needHeight * height
});
} else {
var needWidth = +(orientation === "left" && !mirror || orientation === "right" && mirror);
props = _objectSpread40(_objectSpread40({}, props), {}, {
x1: x2 + needWidth * width,
y1: y2,
x2: x2 + needWidth * width,
y2: y2 + height
});
}
return import_react50.default.createElement("line", _extends32({}, props, {
className: clsx_default("recharts-cartesian-axis-line", (0, import_get5.default)(axisLine, "className"))
}));
}
}, {
key: "renderTicks",
value: (
/**
* render the ticks
* @param {Array} ticks The ticks to actually render (overrides what was passed in props)
* @param {string} fontSize Fontsize to consider for tick spacing
* @param {string} letterSpacing Letterspacing to consider for tick spacing
* @return {ReactComponent} renderedTicks
*/
function renderTicks(ticks2, fontSize, letterSpacing) {
var _this2 = this;
var _this$props6 = this.props, tickLine = _this$props6.tickLine, stroke = _this$props6.stroke, tick = _this$props6.tick, tickFormatter = _this$props6.tickFormatter, unit2 = _this$props6.unit;
var finalTicks = getTicks(_objectSpread40(_objectSpread40({}, this.props), {}, {
ticks: ticks2
}), fontSize, letterSpacing);
var textAnchor = this.getTickTextAnchor();
var verticalAnchor = this.getTickVerticalAnchor();
var axisProps = filterProps(this.props, false);
var customTickProps = filterProps(tick, false);
var tickLineProps = _objectSpread40(_objectSpread40({}, axisProps), {}, {
fill: "none"
}, filterProps(tickLine, false));
var items = finalTicks.map(function(entry, i) {
var _this2$getTickLineCoo = _this2.getTickLineCoord(entry), lineCoord = _this2$getTickLineCoo.line, tickCoord = _this2$getTickLineCoo.tick;
var tickProps = _objectSpread40(_objectSpread40(_objectSpread40(_objectSpread40({
textAnchor,
verticalAnchor
}, axisProps), {}, {
stroke: "none",
fill: stroke
}, customTickProps), tickCoord), {}, {
index: i,
payload: entry,
visibleTicksCount: finalTicks.length,
tickFormatter
});
return import_react50.default.createElement(Layer, _extends32({
className: "recharts-cartesian-axis-tick",
key: "tick-".concat(entry.value, "-").concat(entry.coordinate, "-").concat(entry.tickCoord)
}, adaptEventsOfChild(_this2.props, entry, i)), tickLine && import_react50.default.createElement("line", _extends32({}, tickLineProps, lineCoord, {
className: clsx_default("recharts-cartesian-axis-tick-line", (0, import_get5.default)(tickLine, "className"))
})), tick && CartesianAxis2.renderTickItem(tick, tickProps, "".concat((0, import_isFunction21.default)(tickFormatter) ? tickFormatter(entry.value, i) : entry.value).concat(unit2 || "")));
});
return import_react50.default.createElement("g", {
className: "recharts-cartesian-axis-ticks"
}, items);
}
)
}, {
key: "render",
value: function render() {
var _this3 = this;
var _this$props7 = this.props, axisLine = _this$props7.axisLine, width = _this$props7.width, height = _this$props7.height, ticksGenerator = _this$props7.ticksGenerator, className = _this$props7.className, hide = _this$props7.hide;
if (hide) {
return null;
}
var _this$props8 = this.props, ticks2 = _this$props8.ticks, noTicksProps = _objectWithoutProperties22(_this$props8, _excluded32);
var finalTicks = ticks2;
if ((0, import_isFunction21.default)(ticksGenerator)) {
finalTicks = ticks2 && ticks2.length > 0 ? ticksGenerator(this.props) : ticksGenerator(noTicksProps);
}
if (width <= 0 || height <= 0 || !finalTicks || !finalTicks.length) {
return null;
}
return import_react50.default.createElement(Layer, {
className: clsx_default("recharts-cartesian-axis", className),
ref: function ref(_ref2) {
_this3.layerReference = _ref2;
}
}, axisLine && this.renderAxisLine(), this.renderTicks(finalTicks, this.state.fontSize, this.state.letterSpacing), Label.renderCallByParent(this.props));
}
}], [{
key: "renderTickItem",
value: function renderTickItem(option, props, value) {
var tickItem;
if (import_react50.default.isValidElement(option)) {
tickItem = import_react50.default.cloneElement(option, props);
} else if ((0, import_isFunction21.default)(option)) {
tickItem = option(props);
} else {
tickItem = import_react50.default.createElement(Text, _extends32({}, props, {
className: "recharts-cartesian-axis-tick-value"
}), value);
}
return tickItem;
}
}]);
}(import_react50.Component);
_defineProperty42(CartesianAxis, "displayName", "CartesianAxis");
_defineProperty42(CartesianAxis, "defaultProps", {
x: 0,
y: 0,
width: 0,
height: 0,
viewBox: {
x: 0,
y: 0,
width: 0,
height: 0
},
// The orientation of axis
orientation: "bottom",
// The ticks
ticks: [],
stroke: "#666",
tickLine: true,
axisLine: true,
tick: true,
mirror: false,
minTickGap: 5,
// The width or height of tick
tickSize: 6,
tickMargin: 2,
interval: "preserveEnd"
});
// node_modules/recharts/es6/cartesian/CartesianGrid.js
var import_react51 = __toESM(require_react());
var import_isFunction22 = __toESM(require_isFunction());
var _excluded29 = ["x1", "y1", "x2", "y2", "key"];
var _excluded210 = ["offset"];
function _typeof49(o) {
"@babel/helpers - typeof";
return _typeof49 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof49(o);
}
function ownKeys41(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread41(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys41(Object(t), true).forEach(function(r2) {
_defineProperty43(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys41(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty43(obj, key, value) {
key = _toPropertyKey44(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey44(t) {
var i = _toPrimitive44(t, "string");
return "symbol" == _typeof49(i) ? i : i + "";
}
function _toPrimitive44(t, r) {
if ("object" != _typeof49(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof49(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _extends33() {
_extends33 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends33.apply(this, arguments);
}
function _objectWithoutProperties23(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose24(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose24(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
var Background = function Background2(props) {
var fill = props.fill;
if (!fill || fill === "none") {
return null;
}
var fillOpacity = props.fillOpacity, x2 = props.x, y2 = props.y, width = props.width, height = props.height, ry = props.ry;
return import_react51.default.createElement("rect", {
x: x2,
y: y2,
ry,
width,
height,
stroke: "none",
fill,
fillOpacity,
className: "recharts-cartesian-grid-bg"
});
};
function renderLineItem(option, props) {
var lineItem;
if (import_react51.default.isValidElement(option)) {
lineItem = import_react51.default.cloneElement(option, props);
} else if ((0, import_isFunction22.default)(option)) {
lineItem = option(props);
} else {
var x1 = props.x1, y1 = props.y1, x2 = props.x2, y2 = props.y2, key = props.key, others = _objectWithoutProperties23(props, _excluded29);
var _filterProps = filterProps(others, false), __ = _filterProps.offset, restOfFilteredProps = _objectWithoutProperties23(_filterProps, _excluded210);
lineItem = import_react51.default.createElement("line", _extends33({}, restOfFilteredProps, {
x1,
y1,
x2,
y2,
fill: "none",
key
}));
}
return lineItem;
}
function HorizontalGridLines(props) {
var x2 = props.x, width = props.width, _props$horizontal = props.horizontal, horizontal = _props$horizontal === void 0 ? true : _props$horizontal, horizontalPoints = props.horizontalPoints;
if (!horizontal || !horizontalPoints || !horizontalPoints.length) {
return null;
}
var items = horizontalPoints.map(function(entry, i) {
var lineItemProps = _objectSpread41(_objectSpread41({}, props), {}, {
x1: x2,
y1: entry,
x2: x2 + width,
y2: entry,
key: "line-".concat(i),
index: i
});
return renderLineItem(horizontal, lineItemProps);
});
return import_react51.default.createElement("g", {
className: "recharts-cartesian-grid-horizontal"
}, items);
}
function VerticalGridLines(props) {
var y2 = props.y, height = props.height, _props$vertical = props.vertical, vertical = _props$vertical === void 0 ? true : _props$vertical, verticalPoints = props.verticalPoints;
if (!vertical || !verticalPoints || !verticalPoints.length) {
return null;
}
var items = verticalPoints.map(function(entry, i) {
var lineItemProps = _objectSpread41(_objectSpread41({}, props), {}, {
x1: entry,
y1: y2,
x2: entry,
y2: y2 + height,
key: "line-".concat(i),
index: i
});
return renderLineItem(vertical, lineItemProps);
});
return import_react51.default.createElement("g", {
className: "recharts-cartesian-grid-vertical"
}, items);
}
function HorizontalStripes(props) {
var horizontalFill = props.horizontalFill, fillOpacity = props.fillOpacity, x2 = props.x, y2 = props.y, width = props.width, height = props.height, horizontalPoints = props.horizontalPoints, _props$horizontal2 = props.horizontal, horizontal = _props$horizontal2 === void 0 ? true : _props$horizontal2;
if (!horizontal || !horizontalFill || !horizontalFill.length) {
return null;
}
var roundedSortedHorizontalPoints = horizontalPoints.map(function(e) {
return Math.round(e + y2 - y2);
}).sort(function(a2, b) {
return a2 - b;
});
if (y2 !== roundedSortedHorizontalPoints[0]) {
roundedSortedHorizontalPoints.unshift(0);
}
var items = roundedSortedHorizontalPoints.map(function(entry, i) {
var lastStripe = !roundedSortedHorizontalPoints[i + 1];
var lineHeight = lastStripe ? y2 + height - entry : roundedSortedHorizontalPoints[i + 1] - entry;
if (lineHeight <= 0) {
return null;
}
var colorIndex = i % horizontalFill.length;
return import_react51.default.createElement("rect", {
key: "react-".concat(i),
y: entry,
x: x2,
height: lineHeight,
width,
stroke: "none",
fill: horizontalFill[colorIndex],
fillOpacity,
className: "recharts-cartesian-grid-bg"
});
});
return import_react51.default.createElement("g", {
className: "recharts-cartesian-gridstripes-horizontal"
}, items);
}
function VerticalStripes(props) {
var _props$vertical2 = props.vertical, vertical = _props$vertical2 === void 0 ? true : _props$vertical2, verticalFill = props.verticalFill, fillOpacity = props.fillOpacity, x2 = props.x, y2 = props.y, width = props.width, height = props.height, verticalPoints = props.verticalPoints;
if (!vertical || !verticalFill || !verticalFill.length) {
return null;
}
var roundedSortedVerticalPoints = verticalPoints.map(function(e) {
return Math.round(e + x2 - x2);
}).sort(function(a2, b) {
return a2 - b;
});
if (x2 !== roundedSortedVerticalPoints[0]) {
roundedSortedVerticalPoints.unshift(0);
}
var items = roundedSortedVerticalPoints.map(function(entry, i) {
var lastStripe = !roundedSortedVerticalPoints[i + 1];
var lineWidth = lastStripe ? x2 + width - entry : roundedSortedVerticalPoints[i + 1] - entry;
if (lineWidth <= 0) {
return null;
}
var colorIndex = i % verticalFill.length;
return import_react51.default.createElement("rect", {
key: "react-".concat(i),
x: entry,
y: y2,
width: lineWidth,
height,
stroke: "none",
fill: verticalFill[colorIndex],
fillOpacity,
className: "recharts-cartesian-grid-bg"
});
});
return import_react51.default.createElement("g", {
className: "recharts-cartesian-gridstripes-vertical"
}, items);
}
var defaultVerticalCoordinatesGenerator = function defaultVerticalCoordinatesGenerator2(_ref, syncWithTicks) {
var xAxis = _ref.xAxis, width = _ref.width, height = _ref.height, offset = _ref.offset;
return getCoordinatesOfGrid(getTicks(_objectSpread41(_objectSpread41(_objectSpread41({}, CartesianAxis.defaultProps), xAxis), {}, {
ticks: getTicksOfAxis(xAxis, true),
viewBox: {
x: 0,
y: 0,
width,
height
}
})), offset.left, offset.left + offset.width, syncWithTicks);
};
var defaultHorizontalCoordinatesGenerator = function defaultHorizontalCoordinatesGenerator2(_ref2, syncWithTicks) {
var yAxis = _ref2.yAxis, width = _ref2.width, height = _ref2.height, offset = _ref2.offset;
return getCoordinatesOfGrid(getTicks(_objectSpread41(_objectSpread41(_objectSpread41({}, CartesianAxis.defaultProps), yAxis), {}, {
ticks: getTicksOfAxis(yAxis, true),
viewBox: {
x: 0,
y: 0,
width,
height
}
})), offset.top, offset.top + offset.height, syncWithTicks);
};
var defaultProps5 = {
horizontal: true,
vertical: true,
// The ordinates of horizontal grid lines
horizontalPoints: [],
// The abscissas of vertical grid lines
verticalPoints: [],
stroke: "#ccc",
fill: "none",
// The fill of colors of grid lines
verticalFill: [],
horizontalFill: []
};
function CartesianGrid(props) {
var _props$stroke, _props$fill, _props$horizontal3, _props$horizontalFill, _props$vertical3, _props$verticalFill;
var chartWidth = useChartWidth();
var chartHeight = useChartHeight();
var offset = useOffset();
var propsIncludingDefaults = _objectSpread41(_objectSpread41({}, props), {}, {
stroke: (_props$stroke = props.stroke) !== null && _props$stroke !== void 0 ? _props$stroke : defaultProps5.stroke,
fill: (_props$fill = props.fill) !== null && _props$fill !== void 0 ? _props$fill : defaultProps5.fill,
horizontal: (_props$horizontal3 = props.horizontal) !== null && _props$horizontal3 !== void 0 ? _props$horizontal3 : defaultProps5.horizontal,
horizontalFill: (_props$horizontalFill = props.horizontalFill) !== null && _props$horizontalFill !== void 0 ? _props$horizontalFill : defaultProps5.horizontalFill,
vertical: (_props$vertical3 = props.vertical) !== null && _props$vertical3 !== void 0 ? _props$vertical3 : defaultProps5.vertical,
verticalFill: (_props$verticalFill = props.verticalFill) !== null && _props$verticalFill !== void 0 ? _props$verticalFill : defaultProps5.verticalFill,
x: isNumber(props.x) ? props.x : offset.left,
y: isNumber(props.y) ? props.y : offset.top,
width: isNumber(props.width) ? props.width : offset.width,
height: isNumber(props.height) ? props.height : offset.height
});
var x2 = propsIncludingDefaults.x, y2 = propsIncludingDefaults.y, width = propsIncludingDefaults.width, height = propsIncludingDefaults.height, syncWithTicks = propsIncludingDefaults.syncWithTicks, horizontalValues = propsIncludingDefaults.horizontalValues, verticalValues = propsIncludingDefaults.verticalValues;
var xAxis = useArbitraryXAxis();
var yAxis = useYAxisWithFiniteDomainOrRandom();
if (!isNumber(width) || width <= 0 || !isNumber(height) || height <= 0 || !isNumber(x2) || x2 !== +x2 || !isNumber(y2) || y2 !== +y2) {
return null;
}
var verticalCoordinatesGenerator = propsIncludingDefaults.verticalCoordinatesGenerator || defaultVerticalCoordinatesGenerator;
var horizontalCoordinatesGenerator = propsIncludingDefaults.horizontalCoordinatesGenerator || defaultHorizontalCoordinatesGenerator;
var horizontalPoints = propsIncludingDefaults.horizontalPoints, verticalPoints = propsIncludingDefaults.verticalPoints;
if ((!horizontalPoints || !horizontalPoints.length) && (0, import_isFunction22.default)(horizontalCoordinatesGenerator)) {
var isHorizontalValues = horizontalValues && horizontalValues.length;
var generatorResult = horizontalCoordinatesGenerator({
yAxis: yAxis ? _objectSpread41(_objectSpread41({}, yAxis), {}, {
ticks: isHorizontalValues ? horizontalValues : yAxis.ticks
}) : void 0,
width: chartWidth,
height: chartHeight,
offset
}, isHorizontalValues ? true : syncWithTicks);
warn(Array.isArray(generatorResult), "horizontalCoordinatesGenerator should return Array but instead it returned [".concat(_typeof49(generatorResult), "]"));
if (Array.isArray(generatorResult)) {
horizontalPoints = generatorResult;
}
}
if ((!verticalPoints || !verticalPoints.length) && (0, import_isFunction22.default)(verticalCoordinatesGenerator)) {
var isVerticalValues = verticalValues && verticalValues.length;
var _generatorResult = verticalCoordinatesGenerator({
xAxis: xAxis ? _objectSpread41(_objectSpread41({}, xAxis), {}, {
ticks: isVerticalValues ? verticalValues : xAxis.ticks
}) : void 0,
width: chartWidth,
height: chartHeight,
offset
}, isVerticalValues ? true : syncWithTicks);
warn(Array.isArray(_generatorResult), "verticalCoordinatesGenerator should return Array but instead it returned [".concat(_typeof49(_generatorResult), "]"));
if (Array.isArray(_generatorResult)) {
verticalPoints = _generatorResult;
}
}
return import_react51.default.createElement("g", {
className: "recharts-cartesian-grid"
}, import_react51.default.createElement(Background, {
fill: propsIncludingDefaults.fill,
fillOpacity: propsIncludingDefaults.fillOpacity,
x: propsIncludingDefaults.x,
y: propsIncludingDefaults.y,
width: propsIncludingDefaults.width,
height: propsIncludingDefaults.height,
ry: propsIncludingDefaults.ry
}), import_react51.default.createElement(HorizontalGridLines, _extends33({}, propsIncludingDefaults, {
offset,
horizontalPoints,
xAxis,
yAxis
})), import_react51.default.createElement(VerticalGridLines, _extends33({}, propsIncludingDefaults, {
offset,
verticalPoints,
xAxis,
yAxis
})), import_react51.default.createElement(HorizontalStripes, _extends33({}, propsIncludingDefaults, {
horizontalPoints
})), import_react51.default.createElement(VerticalStripes, _extends33({}, propsIncludingDefaults, {
verticalPoints
})));
}
CartesianGrid.displayName = "CartesianGrid";
// node_modules/recharts/es6/cartesian/Line.js
var import_react52 = __toESM(require_react());
var import_isFunction23 = __toESM(require_isFunction());
var import_isNil11 = __toESM(require_isNil());
var import_isEqual7 = __toESM(require_isEqual());
var _excluded30 = ["type", "layout", "connectNulls", "ref"];
var _excluded211 = ["key"];
function _typeof50(o) {
"@babel/helpers - typeof";
return _typeof50 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof50(o);
}
function _objectWithoutProperties24(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose25(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose25(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _extends34() {
_extends34 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends34.apply(this, arguments);
}
function ownKeys42(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread42(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys42(Object(t), true).forEach(function(r2) {
_defineProperty44(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys42(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _toConsumableArray10(arr) {
return _arrayWithoutHoles10(arr) || _iterableToArray11(arr) || _unsupportedIterableToArray20(arr) || _nonIterableSpread10();
}
function _nonIterableSpread10() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray20(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray20(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray20(o, minLen);
}
function _iterableToArray11(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles10(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray20(arr);
}
function _arrayLikeToArray20(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _classCallCheck21(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties21(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey45(descriptor.key), descriptor);
}
}
function _createClass21(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties21(Constructor.prototype, protoProps);
if (staticProps) _defineProperties21(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper17(t, o, e) {
return o = _getPrototypeOf19(o), _possibleConstructorReturn19(t, _isNativeReflectConstruct19() ? Reflect.construct(o, e || [], _getPrototypeOf19(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn19(self2, call) {
if (call && (_typeof50(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized20(self2);
}
function _assertThisInitialized20(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct19() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct19 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf19(o) {
_getPrototypeOf19 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf19(o);
}
function _inherits19(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf20(subClass, superClass);
}
function _setPrototypeOf20(o, p) {
_setPrototypeOf20 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf20(o, p);
}
function _defineProperty44(obj, key, value) {
key = _toPropertyKey45(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey45(t) {
var i = _toPrimitive45(t, "string");
return "symbol" == _typeof50(i) ? i : i + "";
}
function _toPrimitive45(t, r) {
if ("object" != _typeof50(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof50(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Line = function(_PureComponent) {
function Line2() {
var _this;
_classCallCheck21(this, Line2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper17(this, Line2, [].concat(args));
_defineProperty44(_this, "state", {
isAnimationFinished: true,
totalLength: 0
});
_defineProperty44(_this, "generateSimpleStrokeDasharray", function(totalLength, length) {
return "".concat(length, "px ").concat(totalLength - length, "px");
});
_defineProperty44(_this, "getStrokeDasharray", function(length, totalLength, lines) {
var lineLength = lines.reduce(function(pre, next) {
return pre + next;
});
if (!lineLength) {
return _this.generateSimpleStrokeDasharray(totalLength, length);
}
var count3 = Math.floor(length / lineLength);
var remainLength = length % lineLength;
var restLength = totalLength - length;
var remainLines = [];
for (var i = 0, sum4 = 0; i < lines.length; sum4 += lines[i], ++i) {
if (sum4 + lines[i] > remainLength) {
remainLines = [].concat(_toConsumableArray10(lines.slice(0, i)), [remainLength - sum4]);
break;
}
}
var emptyLines = remainLines.length % 2 === 0 ? [0, restLength] : [restLength];
return [].concat(_toConsumableArray10(Line2.repeat(lines, count3)), _toConsumableArray10(remainLines), emptyLines).map(function(line) {
return "".concat(line, "px");
}).join(", ");
});
_defineProperty44(_this, "id", uniqueId("recharts-line-"));
_defineProperty44(_this, "pathRef", function(node) {
_this.mainCurve = node;
});
_defineProperty44(_this, "handleAnimationEnd", function() {
_this.setState({
isAnimationFinished: true
});
if (_this.props.onAnimationEnd) {
_this.props.onAnimationEnd();
}
});
_defineProperty44(_this, "handleAnimationStart", function() {
_this.setState({
isAnimationFinished: false
});
if (_this.props.onAnimationStart) {
_this.props.onAnimationStart();
}
});
return _this;
}
_inherits19(Line2, _PureComponent);
return _createClass21(Line2, [{
key: "componentDidMount",
value: function componentDidMount() {
if (!this.props.isAnimationActive) {
return;
}
var totalLength = this.getTotalLength();
this.setState({
totalLength
});
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
if (!this.props.isAnimationActive) {
return;
}
var totalLength = this.getTotalLength();
if (totalLength !== this.state.totalLength) {
this.setState({
totalLength
});
}
}
}, {
key: "getTotalLength",
value: function getTotalLength() {
var curveDom = this.mainCurve;
try {
return curveDom && curveDom.getTotalLength && curveDom.getTotalLength() || 0;
} catch (err) {
return 0;
}
}
}, {
key: "renderErrorBar",
value: function renderErrorBar(needClip, clipPathId) {
if (this.props.isAnimationActive && !this.state.isAnimationFinished) {
return null;
}
var _this$props = this.props, points = _this$props.points, xAxis = _this$props.xAxis, yAxis = _this$props.yAxis, layout = _this$props.layout, children2 = _this$props.children;
var errorBarItems = findAllByType(children2, ErrorBar);
if (!errorBarItems) {
return null;
}
var dataPointFormatter = function dataPointFormatter2(dataPoint, dataKey) {
return {
x: dataPoint.x,
y: dataPoint.y,
value: dataPoint.value,
errorVal: getValueByDataKey(dataPoint.payload, dataKey)
};
};
var errorBarProps = {
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
};
return import_react52.default.createElement(Layer, errorBarProps, errorBarItems.map(function(item) {
return import_react52.default.cloneElement(item, {
key: "bar-".concat(item.props.dataKey),
data: points,
xAxis,
yAxis,
layout,
dataPointFormatter
});
}));
}
}, {
key: "renderDots",
value: function renderDots(needClip, clipDot, clipPathId) {
var isAnimationActive = this.props.isAnimationActive;
if (isAnimationActive && !this.state.isAnimationFinished) {
return null;
}
var _this$props2 = this.props, dot = _this$props2.dot, points = _this$props2.points, dataKey = _this$props2.dataKey;
var lineProps = filterProps(this.props, false);
var customDotProps = filterProps(dot, true);
var dots = points.map(function(entry, i) {
var dotProps = _objectSpread42(_objectSpread42(_objectSpread42({
key: "dot-".concat(i),
r: 3
}, lineProps), customDotProps), {}, {
value: entry.value,
dataKey,
cx: entry.x,
cy: entry.y,
index: i,
payload: entry.payload
});
return Line2.renderDotItem(dot, dotProps);
});
var dotsProps = {
clipPath: needClip ? "url(#clipPath-".concat(clipDot ? "" : "dots-").concat(clipPathId, ")") : null
};
return import_react52.default.createElement(Layer, _extends34({
className: "recharts-line-dots",
key: "dots"
}, dotsProps), dots);
}
}, {
key: "renderCurveStatically",
value: function renderCurveStatically(points, needClip, clipPathId, props) {
var _this$props3 = this.props, type = _this$props3.type, layout = _this$props3.layout, connectNulls = _this$props3.connectNulls, ref = _this$props3.ref, others = _objectWithoutProperties24(_this$props3, _excluded30);
var curveProps = _objectSpread42(_objectSpread42(_objectSpread42({}, filterProps(others, true)), {}, {
fill: "none",
className: "recharts-line-curve",
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null,
points
}, props), {}, {
type,
layout,
connectNulls
});
return import_react52.default.createElement(Curve, _extends34({}, curveProps, {
pathRef: this.pathRef
}));
}
}, {
key: "renderCurveWithAnimation",
value: function renderCurveWithAnimation(needClip, clipPathId) {
var _this2 = this;
var _this$props4 = this.props, points = _this$props4.points, strokeDasharray = _this$props4.strokeDasharray, isAnimationActive = _this$props4.isAnimationActive, animationBegin = _this$props4.animationBegin, animationDuration = _this$props4.animationDuration, animationEasing = _this$props4.animationEasing, animationId = _this$props4.animationId, animateNewValues = _this$props4.animateNewValues, width = _this$props4.width, height = _this$props4.height;
var _this$state = this.state, prevPoints = _this$state.prevPoints, totalLength = _this$state.totalLength;
return import_react52.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "line-".concat(animationId),
onAnimationEnd: this.handleAnimationEnd,
onAnimationStart: this.handleAnimationStart
}, function(_ref) {
var t = _ref.t;
if (prevPoints) {
var prevPointsDiffFactor = prevPoints.length / points.length;
var stepData = points.map(function(entry, index3) {
var prevPointIndex = Math.floor(index3 * prevPointsDiffFactor);
if (prevPoints[prevPointIndex]) {
var prev = prevPoints[prevPointIndex];
var interpolatorX = interpolateNumber(prev.x, entry.x);
var interpolatorY = interpolateNumber(prev.y, entry.y);
return _objectSpread42(_objectSpread42({}, entry), {}, {
x: interpolatorX(t),
y: interpolatorY(t)
});
}
if (animateNewValues) {
var _interpolatorX = interpolateNumber(width * 2, entry.x);
var _interpolatorY = interpolateNumber(height / 2, entry.y);
return _objectSpread42(_objectSpread42({}, entry), {}, {
x: _interpolatorX(t),
y: _interpolatorY(t)
});
}
return _objectSpread42(_objectSpread42({}, entry), {}, {
x: entry.x,
y: entry.y
});
});
return _this2.renderCurveStatically(stepData, needClip, clipPathId);
}
var interpolator = interpolateNumber(0, totalLength);
var curLength = interpolator(t);
var currentStrokeDasharray;
if (strokeDasharray) {
var lines = "".concat(strokeDasharray).split(/[,\s]+/gim).map(function(num) {
return parseFloat(num);
});
currentStrokeDasharray = _this2.getStrokeDasharray(curLength, totalLength, lines);
} else {
currentStrokeDasharray = _this2.generateSimpleStrokeDasharray(totalLength, curLength);
}
return _this2.renderCurveStatically(points, needClip, clipPathId, {
strokeDasharray: currentStrokeDasharray
});
});
}
}, {
key: "renderCurve",
value: function renderCurve(needClip, clipPathId) {
var _this$props5 = this.props, points = _this$props5.points, isAnimationActive = _this$props5.isAnimationActive;
var _this$state2 = this.state, prevPoints = _this$state2.prevPoints, totalLength = _this$state2.totalLength;
if (isAnimationActive && points && points.length && (!prevPoints && totalLength > 0 || !(0, import_isEqual7.default)(prevPoints, points))) {
return this.renderCurveWithAnimation(needClip, clipPathId);
}
return this.renderCurveStatically(points, needClip, clipPathId);
}
}, {
key: "render",
value: function render() {
var _filterProps;
var _this$props6 = this.props, hide = _this$props6.hide, dot = _this$props6.dot, points = _this$props6.points, className = _this$props6.className, xAxis = _this$props6.xAxis, yAxis = _this$props6.yAxis, top = _this$props6.top, left = _this$props6.left, width = _this$props6.width, height = _this$props6.height, isAnimationActive = _this$props6.isAnimationActive, id = _this$props6.id;
if (hide || !points || !points.length) {
return null;
}
var isAnimationFinished = this.state.isAnimationFinished;
var hasSinglePoint = points.length === 1;
var layerClass = clsx_default("recharts-line", className);
var needClipX = xAxis && xAxis.allowDataOverflow;
var needClipY = yAxis && yAxis.allowDataOverflow;
var needClip = needClipX || needClipY;
var clipPathId = (0, import_isNil11.default)(id) ? this.id : id;
var _ref2 = (_filterProps = filterProps(dot, false)) !== null && _filterProps !== void 0 ? _filterProps : {
r: 3,
strokeWidth: 2
}, _ref2$r = _ref2.r, r = _ref2$r === void 0 ? 3 : _ref2$r, _ref2$strokeWidth = _ref2.strokeWidth, strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;
var _ref3 = hasClipDot(dot) ? dot : {}, _ref3$clipDot = _ref3.clipDot, clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;
var dotSize = r * 2 + strokeWidth;
return import_react52.default.createElement(Layer, {
className: layerClass
}, needClipX || needClipY ? import_react52.default.createElement("defs", null, import_react52.default.createElement("clipPath", {
id: "clipPath-".concat(clipPathId)
}, import_react52.default.createElement("rect", {
x: needClipX ? left : left - width / 2,
y: needClipY ? top : top - height / 2,
width: needClipX ? width : width * 2,
height: needClipY ? height : height * 2
})), !clipDot && import_react52.default.createElement("clipPath", {
id: "clipPath-dots-".concat(clipPathId)
}, import_react52.default.createElement("rect", {
x: left - dotSize / 2,
y: top - dotSize / 2,
width: width + dotSize,
height: height + dotSize
}))) : null, !hasSinglePoint && this.renderCurve(needClip, clipPathId), this.renderErrorBar(needClip, clipPathId), (hasSinglePoint || dot) && this.renderDots(needClip, clipDot, clipPathId), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, points));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curPoints: nextProps.points,
prevPoints: prevState.curPoints
};
}
if (nextProps.points !== prevState.curPoints) {
return {
curPoints: nextProps.points
};
}
return null;
}
}, {
key: "repeat",
value: function repeat(lines, count3) {
var linesUnit = lines.length % 2 !== 0 ? [].concat(_toConsumableArray10(lines), [0]) : lines;
var result = [];
for (var i = 0; i < count3; ++i) {
result = [].concat(_toConsumableArray10(result), _toConsumableArray10(linesUnit));
}
return result;
}
}, {
key: "renderDotItem",
value: function renderDotItem(option, props) {
var dotItem;
if (import_react52.default.isValidElement(option)) {
dotItem = import_react52.default.cloneElement(option, props);
} else if ((0, import_isFunction23.default)(option)) {
dotItem = option(props);
} else {
var key = props.key, dotProps = _objectWithoutProperties24(props, _excluded211);
var className = clsx_default("recharts-line-dot", typeof option !== "boolean" ? option.className : "");
dotItem = import_react52.default.createElement(Dot, _extends34({
key
}, dotProps, {
className
}));
}
return dotItem;
}
}]);
}(import_react52.PureComponent);
_defineProperty44(Line, "displayName", "Line");
_defineProperty44(Line, "defaultProps", {
xAxisId: 0,
yAxisId: 0,
connectNulls: false,
activeDot: true,
dot: true,
legendType: "line",
stroke: "#3182bd",
strokeWidth: 1,
fill: "#fff",
points: [],
isAnimationActive: !Global.isSsr,
animateNewValues: true,
animationBegin: 0,
animationDuration: 1500,
animationEasing: "ease",
hide: false,
label: false
});
_defineProperty44(Line, "getComposedData", function(_ref4) {
var props = _ref4.props, xAxis = _ref4.xAxis, yAxis = _ref4.yAxis, xAxisTicks = _ref4.xAxisTicks, yAxisTicks = _ref4.yAxisTicks, dataKey = _ref4.dataKey, bandSize = _ref4.bandSize, displayedData = _ref4.displayedData, offset = _ref4.offset;
var layout = props.layout;
var points = displayedData.map(function(entry, index3) {
var value = getValueByDataKey(entry, dataKey);
if (layout === "horizontal") {
return {
x: getCateCoordinateOfLine({
axis: xAxis,
ticks: xAxisTicks,
bandSize,
entry,
index: index3
}),
y: (0, import_isNil11.default)(value) ? null : yAxis.scale(value),
value,
payload: entry
};
}
return {
x: (0, import_isNil11.default)(value) ? null : xAxis.scale(value),
y: getCateCoordinateOfLine({
axis: yAxis,
ticks: yAxisTicks,
bandSize,
entry,
index: index3
}),
value,
payload: entry
};
});
return _objectSpread42({
points,
layout
}, offset);
});
// node_modules/recharts/es6/cartesian/Area.js
var import_react53 = __toESM(require_react());
var import_isFunction24 = __toESM(require_isFunction());
var import_max6 = __toESM(require_max());
var import_isNil12 = __toESM(require_isNil());
var import_isNaN3 = __toESM(require_isNaN());
var import_isEqual8 = __toESM(require_isEqual());
var _excluded31 = ["layout", "type", "stroke", "connectNulls", "isRange", "ref"];
var _excluded212 = ["key"];
var _Area;
function _typeof51(o) {
"@babel/helpers - typeof";
return _typeof51 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof51(o);
}
function _objectWithoutProperties25(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose26(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose26(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _extends35() {
_extends35 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends35.apply(this, arguments);
}
function ownKeys43(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread43(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys43(Object(t), true).forEach(function(r2) {
_defineProperty45(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys43(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck22(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties22(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey46(descriptor.key), descriptor);
}
}
function _createClass22(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties22(Constructor.prototype, protoProps);
if (staticProps) _defineProperties22(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper18(t, o, e) {
return o = _getPrototypeOf20(o), _possibleConstructorReturn20(t, _isNativeReflectConstruct20() ? Reflect.construct(o, e || [], _getPrototypeOf20(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn20(self2, call) {
if (call && (_typeof51(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized21(self2);
}
function _assertThisInitialized21(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct20() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct20 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf20(o) {
_getPrototypeOf20 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf20(o);
}
function _inherits20(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf21(subClass, superClass);
}
function _setPrototypeOf21(o, p) {
_setPrototypeOf21 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf21(o, p);
}
function _defineProperty45(obj, key, value) {
key = _toPropertyKey46(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey46(t) {
var i = _toPrimitive46(t, "string");
return "symbol" == _typeof51(i) ? i : i + "";
}
function _toPrimitive46(t, r) {
if ("object" != _typeof51(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof51(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Area = function(_PureComponent) {
function Area2() {
var _this;
_classCallCheck22(this, Area2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper18(this, Area2, [].concat(args));
_defineProperty45(_this, "state", {
isAnimationFinished: true
});
_defineProperty45(_this, "id", uniqueId("recharts-area-"));
_defineProperty45(_this, "handleAnimationEnd", function() {
var onAnimationEnd2 = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if ((0, import_isFunction24.default)(onAnimationEnd2)) {
onAnimationEnd2();
}
});
_defineProperty45(_this, "handleAnimationStart", function() {
var onAnimationStart2 = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if ((0, import_isFunction24.default)(onAnimationStart2)) {
onAnimationStart2();
}
});
return _this;
}
_inherits20(Area2, _PureComponent);
return _createClass22(Area2, [{
key: "renderDots",
value: function renderDots(needClip, clipDot, clipPathId) {
var isAnimationActive = this.props.isAnimationActive;
var isAnimationFinished = this.state.isAnimationFinished;
if (isAnimationActive && !isAnimationFinished) {
return null;
}
var _this$props = this.props, dot = _this$props.dot, points = _this$props.points, dataKey = _this$props.dataKey;
var areaProps = filterProps(this.props, false);
var customDotProps = filterProps(dot, true);
var dots = points.map(function(entry, i) {
var dotProps = _objectSpread43(_objectSpread43(_objectSpread43({
key: "dot-".concat(i),
r: 3
}, areaProps), customDotProps), {}, {
index: i,
cx: entry.x,
cy: entry.y,
dataKey,
value: entry.value,
payload: entry.payload,
points
});
return Area2.renderDotItem(dot, dotProps);
});
var dotsProps = {
clipPath: needClip ? "url(#clipPath-".concat(clipDot ? "" : "dots-").concat(clipPathId, ")") : null
};
return import_react53.default.createElement(Layer, _extends35({
className: "recharts-area-dots"
}, dotsProps), dots);
}
}, {
key: "renderHorizontalRect",
value: function renderHorizontalRect(alpha3) {
var _this$props2 = this.props, baseLine = _this$props2.baseLine, points = _this$props2.points, strokeWidth = _this$props2.strokeWidth;
var startX = points[0].x;
var endX = points[points.length - 1].x;
var width = alpha3 * Math.abs(startX - endX);
var maxY = (0, import_max6.default)(points.map(function(entry) {
return entry.y || 0;
}));
if (isNumber(baseLine) && typeof baseLine === "number") {
maxY = Math.max(baseLine, maxY);
} else if (baseLine && Array.isArray(baseLine) && baseLine.length) {
maxY = Math.max((0, import_max6.default)(baseLine.map(function(entry) {
return entry.y || 0;
})), maxY);
}
if (isNumber(maxY)) {
return import_react53.default.createElement("rect", {
x: startX < endX ? startX : startX - width,
y: 0,
width,
height: Math.floor(maxY + (strokeWidth ? parseInt("".concat(strokeWidth), 10) : 1))
});
}
return null;
}
}, {
key: "renderVerticalRect",
value: function renderVerticalRect(alpha3) {
var _this$props3 = this.props, baseLine = _this$props3.baseLine, points = _this$props3.points, strokeWidth = _this$props3.strokeWidth;
var startY = points[0].y;
var endY = points[points.length - 1].y;
var height = alpha3 * Math.abs(startY - endY);
var maxX = (0, import_max6.default)(points.map(function(entry) {
return entry.x || 0;
}));
if (isNumber(baseLine) && typeof baseLine === "number") {
maxX = Math.max(baseLine, maxX);
} else if (baseLine && Array.isArray(baseLine) && baseLine.length) {
maxX = Math.max((0, import_max6.default)(baseLine.map(function(entry) {
return entry.x || 0;
})), maxX);
}
if (isNumber(maxX)) {
return import_react53.default.createElement("rect", {
x: 0,
y: startY < endY ? startY : startY - height,
width: maxX + (strokeWidth ? parseInt("".concat(strokeWidth), 10) : 1),
height: Math.floor(height)
});
}
return null;
}
}, {
key: "renderClipRect",
value: function renderClipRect(alpha3) {
var layout = this.props.layout;
if (layout === "vertical") {
return this.renderVerticalRect(alpha3);
}
return this.renderHorizontalRect(alpha3);
}
}, {
key: "renderAreaStatically",
value: function renderAreaStatically(points, baseLine, needClip, clipPathId) {
var _this$props4 = this.props, layout = _this$props4.layout, type = _this$props4.type, stroke = _this$props4.stroke, connectNulls = _this$props4.connectNulls, isRange = _this$props4.isRange, ref = _this$props4.ref, others = _objectWithoutProperties25(_this$props4, _excluded31);
return import_react53.default.createElement(Layer, {
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
}, import_react53.default.createElement(Curve, _extends35({}, filterProps(others, true), {
points,
connectNulls,
type,
baseLine,
layout,
stroke: "none",
className: "recharts-area-area"
})), stroke !== "none" && import_react53.default.createElement(Curve, _extends35({}, filterProps(this.props, false), {
className: "recharts-area-curve",
layout,
type,
connectNulls,
fill: "none",
points
})), stroke !== "none" && isRange && import_react53.default.createElement(Curve, _extends35({}, filterProps(this.props, false), {
className: "recharts-area-curve",
layout,
type,
connectNulls,
fill: "none",
points: baseLine
})));
}
}, {
key: "renderAreaWithAnimation",
value: function renderAreaWithAnimation(needClip, clipPathId) {
var _this2 = this;
var _this$props5 = this.props, points = _this$props5.points, baseLine = _this$props5.baseLine, isAnimationActive = _this$props5.isAnimationActive, animationBegin = _this$props5.animationBegin, animationDuration = _this$props5.animationDuration, animationEasing = _this$props5.animationEasing, animationId = _this$props5.animationId;
var _this$state = this.state, prevPoints = _this$state.prevPoints, prevBaseLine = _this$state.prevBaseLine;
return import_react53.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "area-".concat(animationId),
onAnimationEnd: this.handleAnimationEnd,
onAnimationStart: this.handleAnimationStart
}, function(_ref) {
var t = _ref.t;
if (prevPoints) {
var prevPointsDiffFactor = prevPoints.length / points.length;
var stepPoints = points.map(function(entry, index3) {
var prevPointIndex = Math.floor(index3 * prevPointsDiffFactor);
if (prevPoints[prevPointIndex]) {
var prev = prevPoints[prevPointIndex];
var interpolatorX = interpolateNumber(prev.x, entry.x);
var interpolatorY = interpolateNumber(prev.y, entry.y);
return _objectSpread43(_objectSpread43({}, entry), {}, {
x: interpolatorX(t),
y: interpolatorY(t)
});
}
return entry;
});
var stepBaseLine;
if (isNumber(baseLine) && typeof baseLine === "number") {
var interpolator = interpolateNumber(prevBaseLine, baseLine);
stepBaseLine = interpolator(t);
} else if ((0, import_isNil12.default)(baseLine) || (0, import_isNaN3.default)(baseLine)) {
var _interpolator = interpolateNumber(prevBaseLine, 0);
stepBaseLine = _interpolator(t);
} else {
stepBaseLine = baseLine.map(function(entry, index3) {
var prevPointIndex = Math.floor(index3 * prevPointsDiffFactor);
if (prevBaseLine[prevPointIndex]) {
var prev = prevBaseLine[prevPointIndex];
var interpolatorX = interpolateNumber(prev.x, entry.x);
var interpolatorY = interpolateNumber(prev.y, entry.y);
return _objectSpread43(_objectSpread43({}, entry), {}, {
x: interpolatorX(t),
y: interpolatorY(t)
});
}
return entry;
});
}
return _this2.renderAreaStatically(stepPoints, stepBaseLine, needClip, clipPathId);
}
return import_react53.default.createElement(Layer, null, import_react53.default.createElement("defs", null, import_react53.default.createElement("clipPath", {
id: "animationClipPath-".concat(clipPathId)
}, _this2.renderClipRect(t))), import_react53.default.createElement(Layer, {
clipPath: "url(#animationClipPath-".concat(clipPathId, ")")
}, _this2.renderAreaStatically(points, baseLine, needClip, clipPathId)));
});
}
}, {
key: "renderArea",
value: function renderArea(needClip, clipPathId) {
var _this$props6 = this.props, points = _this$props6.points, baseLine = _this$props6.baseLine, isAnimationActive = _this$props6.isAnimationActive;
var _this$state2 = this.state, prevPoints = _this$state2.prevPoints, prevBaseLine = _this$state2.prevBaseLine, totalLength = _this$state2.totalLength;
if (isAnimationActive && points && points.length && (!prevPoints && totalLength > 0 || !(0, import_isEqual8.default)(prevPoints, points) || !(0, import_isEqual8.default)(prevBaseLine, baseLine))) {
return this.renderAreaWithAnimation(needClip, clipPathId);
}
return this.renderAreaStatically(points, baseLine, needClip, clipPathId);
}
}, {
key: "render",
value: function render() {
var _filterProps;
var _this$props7 = this.props, hide = _this$props7.hide, dot = _this$props7.dot, points = _this$props7.points, className = _this$props7.className, top = _this$props7.top, left = _this$props7.left, xAxis = _this$props7.xAxis, yAxis = _this$props7.yAxis, width = _this$props7.width, height = _this$props7.height, isAnimationActive = _this$props7.isAnimationActive, id = _this$props7.id;
if (hide || !points || !points.length) {
return null;
}
var isAnimationFinished = this.state.isAnimationFinished;
var hasSinglePoint = points.length === 1;
var layerClass = clsx_default("recharts-area", className);
var needClipX = xAxis && xAxis.allowDataOverflow;
var needClipY = yAxis && yAxis.allowDataOverflow;
var needClip = needClipX || needClipY;
var clipPathId = (0, import_isNil12.default)(id) ? this.id : id;
var _ref2 = (_filterProps = filterProps(dot, false)) !== null && _filterProps !== void 0 ? _filterProps : {
r: 3,
strokeWidth: 2
}, _ref2$r = _ref2.r, r = _ref2$r === void 0 ? 3 : _ref2$r, _ref2$strokeWidth = _ref2.strokeWidth, strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;
var _ref3 = hasClipDot(dot) ? dot : {}, _ref3$clipDot = _ref3.clipDot, clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;
var dotSize = r * 2 + strokeWidth;
return import_react53.default.createElement(Layer, {
className: layerClass
}, needClipX || needClipY ? import_react53.default.createElement("defs", null, import_react53.default.createElement("clipPath", {
id: "clipPath-".concat(clipPathId)
}, import_react53.default.createElement("rect", {
x: needClipX ? left : left - width / 2,
y: needClipY ? top : top - height / 2,
width: needClipX ? width : width * 2,
height: needClipY ? height : height * 2
})), !clipDot && import_react53.default.createElement("clipPath", {
id: "clipPath-dots-".concat(clipPathId)
}, import_react53.default.createElement("rect", {
x: left - dotSize / 2,
y: top - dotSize / 2,
width: width + dotSize,
height: height + dotSize
}))) : null, !hasSinglePoint ? this.renderArea(needClip, clipPathId) : null, (dot || hasSinglePoint) && this.renderDots(needClip, clipDot, clipPathId), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, points));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curPoints: nextProps.points,
curBaseLine: nextProps.baseLine,
prevPoints: prevState.curPoints,
prevBaseLine: prevState.curBaseLine
};
}
if (nextProps.points !== prevState.curPoints || nextProps.baseLine !== prevState.curBaseLine) {
return {
curPoints: nextProps.points,
curBaseLine: nextProps.baseLine
};
}
return null;
}
}]);
}(import_react53.PureComponent);
_Area = Area;
_defineProperty45(Area, "displayName", "Area");
_defineProperty45(Area, "defaultProps", {
stroke: "#3182bd",
fill: "#3182bd",
fillOpacity: 0.6,
xAxisId: 0,
yAxisId: 0,
legendType: "line",
connectNulls: false,
// points of area
points: [],
dot: false,
activeDot: true,
hide: false,
isAnimationActive: !Global.isSsr,
animationBegin: 0,
animationDuration: 1500,
animationEasing: "ease"
});
_defineProperty45(Area, "getBaseValue", function(props, item, xAxis, yAxis) {
var layout = props.layout, chartBaseValue = props.baseValue;
var itemBaseValue = item.props.baseValue;
var baseValue = itemBaseValue !== null && itemBaseValue !== void 0 ? itemBaseValue : chartBaseValue;
if (isNumber(baseValue) && typeof baseValue === "number") {
return baseValue;
}
var numericAxis = layout === "horizontal" ? yAxis : xAxis;
var domain = numericAxis.scale.domain();
if (numericAxis.type === "number") {
var domainMax = Math.max(domain[0], domain[1]);
var domainMin = Math.min(domain[0], domain[1]);
if (baseValue === "dataMin") {
return domainMin;
}
if (baseValue === "dataMax") {
return domainMax;
}
return domainMax < 0 ? domainMax : Math.max(Math.min(domain[0], domain[1]), 0);
}
if (baseValue === "dataMin") {
return domain[0];
}
if (baseValue === "dataMax") {
return domain[1];
}
return domain[0];
});
_defineProperty45(Area, "getComposedData", function(_ref4) {
var props = _ref4.props, item = _ref4.item, xAxis = _ref4.xAxis, yAxis = _ref4.yAxis, xAxisTicks = _ref4.xAxisTicks, yAxisTicks = _ref4.yAxisTicks, bandSize = _ref4.bandSize, dataKey = _ref4.dataKey, stackedData = _ref4.stackedData, dataStartIndex = _ref4.dataStartIndex, displayedData = _ref4.displayedData, offset = _ref4.offset;
var layout = props.layout;
var hasStack = stackedData && stackedData.length;
var baseValue = _Area.getBaseValue(props, item, xAxis, yAxis);
var isHorizontalLayout = layout === "horizontal";
var isRange = false;
var points = displayedData.map(function(entry, index3) {
var value;
if (hasStack) {
value = stackedData[dataStartIndex + index3];
} else {
value = getValueByDataKey(entry, dataKey);
if (!Array.isArray(value)) {
value = [baseValue, value];
} else {
isRange = true;
}
}
var isBreakPoint = value[1] == null || hasStack && getValueByDataKey(entry, dataKey) == null;
if (isHorizontalLayout) {
return {
x: getCateCoordinateOfLine({
axis: xAxis,
ticks: xAxisTicks,
bandSize,
entry,
index: index3
}),
y: isBreakPoint ? null : yAxis.scale(value[1]),
value,
payload: entry
};
}
return {
x: isBreakPoint ? null : xAxis.scale(value[1]),
y: getCateCoordinateOfLine({
axis: yAxis,
ticks: yAxisTicks,
bandSize,
entry,
index: index3
}),
value,
payload: entry
};
});
var baseLine;
if (hasStack || isRange) {
baseLine = points.map(function(entry) {
var x2 = Array.isArray(entry.value) ? entry.value[0] : null;
if (isHorizontalLayout) {
return {
x: entry.x,
y: x2 != null && entry.y != null ? yAxis.scale(x2) : null
};
}
return {
x: x2 != null ? xAxis.scale(x2) : null,
y: entry.y
};
});
} else {
baseLine = isHorizontalLayout ? yAxis.scale(baseValue) : xAxis.scale(baseValue);
}
return _objectSpread43({
points,
baseLine,
layout,
isRange
}, offset);
});
_defineProperty45(Area, "renderDotItem", function(option, props) {
var dotItem;
if (import_react53.default.isValidElement(option)) {
dotItem = import_react53.default.cloneElement(option, props);
} else if ((0, import_isFunction24.default)(option)) {
dotItem = option(props);
} else {
var className = clsx_default("recharts-area-dot", typeof option !== "boolean" ? option.className : "");
var key = props.key, rest = _objectWithoutProperties25(props, _excluded212);
dotItem = import_react53.default.createElement(Dot, _extends35({}, rest, {
key,
className
}));
}
return dotItem;
});
// node_modules/recharts/es6/cartesian/Scatter.js
var import_react56 = __toESM(require_react());
var import_isNil13 = __toESM(require_isNil());
var import_isEqual9 = __toESM(require_isEqual());
var import_isFunction25 = __toESM(require_isFunction());
// node_modules/recharts/es6/cartesian/ZAxis.js
var import_react54 = __toESM(require_react());
function _typeof52(o) {
"@babel/helpers - typeof";
return _typeof52 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof52(o);
}
function _classCallCheck23(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties23(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey47(descriptor.key), descriptor);
}
}
function _createClass23(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties23(Constructor.prototype, protoProps);
if (staticProps) _defineProperties23(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper19(t, o, e) {
return o = _getPrototypeOf21(o), _possibleConstructorReturn21(t, _isNativeReflectConstruct21() ? Reflect.construct(o, e || [], _getPrototypeOf21(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn21(self2, call) {
if (call && (_typeof52(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized22(self2);
}
function _assertThisInitialized22(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct21() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct21 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf21(o) {
_getPrototypeOf21 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf21(o);
}
function _inherits21(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf22(subClass, superClass);
}
function _setPrototypeOf22(o, p) {
_setPrototypeOf22 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf22(o, p);
}
function _defineProperty46(obj, key, value) {
key = _toPropertyKey47(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey47(t) {
var i = _toPrimitive47(t, "string");
return "symbol" == _typeof52(i) ? i : i + "";
}
function _toPrimitive47(t, r) {
if ("object" != _typeof52(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof52(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var ZAxis = function(_React$Component) {
function ZAxis2() {
_classCallCheck23(this, ZAxis2);
return _callSuper19(this, ZAxis2, arguments);
}
_inherits21(ZAxis2, _React$Component);
return _createClass23(ZAxis2, [{
key: "render",
value: function render() {
return null;
}
}]);
}(import_react54.default.Component);
_defineProperty46(ZAxis, "displayName", "ZAxis");
_defineProperty46(ZAxis, "defaultProps", {
zAxisId: 0,
range: [64, 64],
scale: "auto",
type: "number"
});
// node_modules/recharts/es6/util/ScatterUtils.js
var import_react55 = __toESM(require_react());
var _excluded33 = ["option", "isActive"];
function _extends36() {
_extends36 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends36.apply(this, arguments);
}
function _objectWithoutProperties26(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose27(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose27(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function ScatterSymbol(_ref) {
var option = _ref.option, isActive = _ref.isActive, props = _objectWithoutProperties26(_ref, _excluded33);
if (typeof option === "string") {
return import_react55.default.createElement(Shape, _extends36({
option: import_react55.default.createElement(Symbols, _extends36({
type: option
}, props)),
isActive,
shapeType: "symbols"
}, props));
}
return import_react55.default.createElement(Shape, _extends36({
option,
isActive,
shapeType: "symbols"
}, props));
}
// node_modules/recharts/es6/cartesian/Scatter.js
var _Scatter;
function _typeof53(o) {
"@babel/helpers - typeof";
return _typeof53 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof53(o);
}
function _extends37() {
_extends37 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends37.apply(this, arguments);
}
function ownKeys44(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread44(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys44(Object(t), true).forEach(function(r2) {
_defineProperty47(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys44(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck24(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties24(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey48(descriptor.key), descriptor);
}
}
function _createClass24(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties24(Constructor.prototype, protoProps);
if (staticProps) _defineProperties24(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper20(t, o, e) {
return o = _getPrototypeOf22(o), _possibleConstructorReturn22(t, _isNativeReflectConstruct22() ? Reflect.construct(o, e || [], _getPrototypeOf22(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn22(self2, call) {
if (call && (_typeof53(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized23(self2);
}
function _assertThisInitialized23(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct22() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct22 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf22(o) {
_getPrototypeOf22 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf22(o);
}
function _inherits22(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf23(subClass, superClass);
}
function _setPrototypeOf23(o, p) {
_setPrototypeOf23 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf23(o, p);
}
function _defineProperty47(obj, key, value) {
key = _toPropertyKey48(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey48(t) {
var i = _toPrimitive48(t, "string");
return "symbol" == _typeof53(i) ? i : i + "";
}
function _toPrimitive48(t, r) {
if ("object" != _typeof53(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof53(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Scatter = function(_PureComponent) {
function Scatter2() {
var _this;
_classCallCheck24(this, Scatter2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper20(this, Scatter2, [].concat(args));
_defineProperty47(_this, "state", {
isAnimationFinished: false
});
_defineProperty47(_this, "handleAnimationEnd", function() {
_this.setState({
isAnimationFinished: true
});
});
_defineProperty47(_this, "handleAnimationStart", function() {
_this.setState({
isAnimationFinished: false
});
});
_defineProperty47(_this, "id", uniqueId("recharts-scatter-"));
return _this;
}
_inherits22(Scatter2, _PureComponent);
return _createClass24(Scatter2, [{
key: "renderSymbolsStatically",
value: function renderSymbolsStatically(points) {
var _this2 = this;
var _this$props = this.props, shape = _this$props.shape, activeShape = _this$props.activeShape, activeIndex = _this$props.activeIndex;
var baseProps = filterProps(this.props, false);
return points.map(function(entry, i) {
var isActive = activeIndex === i;
var option = isActive ? activeShape : shape;
var props = _objectSpread44(_objectSpread44({}, baseProps), entry);
return import_react56.default.createElement(Layer, _extends37({
className: "recharts-scatter-symbol",
key: "symbol-".concat(entry === null || entry === void 0 ? void 0 : entry.cx, "-").concat(entry === null || entry === void 0 ? void 0 : entry.cy, "-").concat(entry === null || entry === void 0 ? void 0 : entry.size, "-").concat(i)
}, adaptEventsOfChild(_this2.props, entry, i), {
role: "img"
}), import_react56.default.createElement(ScatterSymbol, _extends37({
option,
isActive,
key: "symbol-".concat(i)
}, props)));
});
}
}, {
key: "renderSymbolsWithAnimation",
value: function renderSymbolsWithAnimation() {
var _this3 = this;
var _this$props2 = this.props, points = _this$props2.points, isAnimationActive = _this$props2.isAnimationActive, animationBegin = _this$props2.animationBegin, animationDuration = _this$props2.animationDuration, animationEasing = _this$props2.animationEasing, animationId = _this$props2.animationId;
var prevPoints = this.state.prevPoints;
return import_react56.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "pie-".concat(animationId),
onAnimationEnd: this.handleAnimationEnd,
onAnimationStart: this.handleAnimationStart
}, function(_ref) {
var t = _ref.t;
var stepData = points.map(function(entry, index3) {
var prev = prevPoints && prevPoints[index3];
if (prev) {
var interpolatorCx = interpolateNumber(prev.cx, entry.cx);
var interpolatorCy = interpolateNumber(prev.cy, entry.cy);
var interpolatorSize = interpolateNumber(prev.size, entry.size);
return _objectSpread44(_objectSpread44({}, entry), {}, {
cx: interpolatorCx(t),
cy: interpolatorCy(t),
size: interpolatorSize(t)
});
}
var interpolator = interpolateNumber(0, entry.size);
return _objectSpread44(_objectSpread44({}, entry), {}, {
size: interpolator(t)
});
});
return import_react56.default.createElement(Layer, null, _this3.renderSymbolsStatically(stepData));
});
}
}, {
key: "renderSymbols",
value: function renderSymbols() {
var _this$props3 = this.props, points = _this$props3.points, isAnimationActive = _this$props3.isAnimationActive;
var prevPoints = this.state.prevPoints;
if (isAnimationActive && points && points.length && (!prevPoints || !(0, import_isEqual9.default)(prevPoints, points))) {
return this.renderSymbolsWithAnimation();
}
return this.renderSymbolsStatically(points);
}
}, {
key: "renderErrorBar",
value: function renderErrorBar() {
var isAnimationActive = this.props.isAnimationActive;
if (isAnimationActive && !this.state.isAnimationFinished) {
return null;
}
var _this$props4 = this.props, points = _this$props4.points, xAxis = _this$props4.xAxis, yAxis = _this$props4.yAxis, children2 = _this$props4.children;
var errorBarItems = findAllByType(children2, ErrorBar);
if (!errorBarItems) {
return null;
}
return errorBarItems.map(function(item, i) {
var _item$props = item.props, direction = _item$props.direction, errorDataKey = _item$props.dataKey;
return import_react56.default.cloneElement(item, {
key: "".concat(direction, "-").concat(errorDataKey, "-").concat(points[i]),
data: points,
xAxis,
yAxis,
layout: direction === "x" ? "vertical" : "horizontal",
dataPointFormatter: function dataPointFormatter(dataPoint, dataKey) {
return {
x: dataPoint.cx,
y: dataPoint.cy,
value: direction === "x" ? +dataPoint.node.x : +dataPoint.node.y,
errorVal: getValueByDataKey(dataPoint, dataKey)
};
}
});
});
}
}, {
key: "renderLine",
value: function renderLine3() {
var _this$props5 = this.props, points = _this$props5.points, line = _this$props5.line, lineType = _this$props5.lineType, lineJointType = _this$props5.lineJointType;
var scatterProps = filterProps(this.props, false);
var customLineProps = filterProps(line, false);
var linePoints, lineItem;
if (lineType === "joint") {
linePoints = points.map(function(entry) {
return {
x: entry.cx,
y: entry.cy
};
});
} else if (lineType === "fitting") {
var _getLinearRegression = getLinearRegression(points), xmin = _getLinearRegression.xmin, xmax = _getLinearRegression.xmax, a2 = _getLinearRegression.a, b = _getLinearRegression.b;
var linearExp = function linearExp2(x2) {
return a2 * x2 + b;
};
linePoints = [{
x: xmin,
y: linearExp(xmin)
}, {
x: xmax,
y: linearExp(xmax)
}];
}
var lineProps = _objectSpread44(_objectSpread44(_objectSpread44({}, scatterProps), {}, {
fill: "none",
stroke: scatterProps && scatterProps.fill
}, customLineProps), {}, {
points: linePoints
});
if (import_react56.default.isValidElement(line)) {
lineItem = import_react56.default.cloneElement(line, lineProps);
} else if ((0, import_isFunction25.default)(line)) {
lineItem = line(lineProps);
} else {
lineItem = import_react56.default.createElement(Curve, _extends37({}, lineProps, {
type: lineJointType
}));
}
return import_react56.default.createElement(Layer, {
className: "recharts-scatter-line",
key: "recharts-scatter-line"
}, lineItem);
}
}, {
key: "render",
value: function render() {
var _this$props6 = this.props, hide = _this$props6.hide, points = _this$props6.points, line = _this$props6.line, className = _this$props6.className, xAxis = _this$props6.xAxis, yAxis = _this$props6.yAxis, left = _this$props6.left, top = _this$props6.top, width = _this$props6.width, height = _this$props6.height, id = _this$props6.id, isAnimationActive = _this$props6.isAnimationActive;
if (hide || !points || !points.length) {
return null;
}
var isAnimationFinished = this.state.isAnimationFinished;
var layerClass = clsx_default("recharts-scatter", className);
var needClipX = xAxis && xAxis.allowDataOverflow;
var needClipY = yAxis && yAxis.allowDataOverflow;
var needClip = needClipX || needClipY;
var clipPathId = (0, import_isNil13.default)(id) ? this.id : id;
return import_react56.default.createElement(Layer, {
className: layerClass,
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
}, needClipX || needClipY ? import_react56.default.createElement("defs", null, import_react56.default.createElement("clipPath", {
id: "clipPath-".concat(clipPathId)
}, import_react56.default.createElement("rect", {
x: needClipX ? left : left - width / 2,
y: needClipY ? top : top - height / 2,
width: needClipX ? width : width * 2,
height: needClipY ? height : height * 2
}))) : null, line && this.renderLine(), this.renderErrorBar(), import_react56.default.createElement(Layer, {
key: "recharts-scatter-symbols"
}, this.renderSymbols()), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, points));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curPoints: nextProps.points,
prevPoints: prevState.curPoints
};
}
if (nextProps.points !== prevState.curPoints) {
return {
curPoints: nextProps.points
};
}
return null;
}
}]);
}(import_react56.PureComponent);
_Scatter = Scatter;
_defineProperty47(Scatter, "displayName", "Scatter");
_defineProperty47(Scatter, "defaultProps", {
xAxisId: 0,
yAxisId: 0,
zAxisId: 0,
legendType: "circle",
lineType: "joint",
lineJointType: "linear",
data: [],
shape: "circle",
hide: false,
isAnimationActive: !Global.isSsr,
animationBegin: 0,
animationDuration: 400,
animationEasing: "linear"
});
_defineProperty47(Scatter, "getComposedData", function(_ref2) {
var xAxis = _ref2.xAxis, yAxis = _ref2.yAxis, zAxis = _ref2.zAxis, item = _ref2.item, displayedData = _ref2.displayedData, xAxisTicks = _ref2.xAxisTicks, yAxisTicks = _ref2.yAxisTicks, offset = _ref2.offset;
var tooltipType = item.props.tooltipType;
var cells = findAllByType(item.props.children, Cell);
var xAxisDataKey = (0, import_isNil13.default)(xAxis.dataKey) ? item.props.dataKey : xAxis.dataKey;
var yAxisDataKey = (0, import_isNil13.default)(yAxis.dataKey) ? item.props.dataKey : yAxis.dataKey;
var zAxisDataKey = zAxis && zAxis.dataKey;
var defaultRangeZ = zAxis ? zAxis.range : ZAxis.defaultProps.range;
var defaultZ = defaultRangeZ && defaultRangeZ[0];
var xBandSize = xAxis.scale.bandwidth ? xAxis.scale.bandwidth() : 0;
var yBandSize = yAxis.scale.bandwidth ? yAxis.scale.bandwidth() : 0;
var points = displayedData.map(function(entry, index3) {
var x2 = getValueByDataKey(entry, xAxisDataKey);
var y2 = getValueByDataKey(entry, yAxisDataKey);
var z = !(0, import_isNil13.default)(zAxisDataKey) && getValueByDataKey(entry, zAxisDataKey) || "-";
var tooltipPayload = [{
name: (0, import_isNil13.default)(xAxis.dataKey) ? item.props.name : xAxis.name || xAxis.dataKey,
unit: xAxis.unit || "",
value: x2,
payload: entry,
dataKey: xAxisDataKey,
type: tooltipType
}, {
name: (0, import_isNil13.default)(yAxis.dataKey) ? item.props.name : yAxis.name || yAxis.dataKey,
unit: yAxis.unit || "",
value: y2,
payload: entry,
dataKey: yAxisDataKey,
type: tooltipType
}];
if (z !== "-") {
tooltipPayload.push({
name: zAxis.name || zAxis.dataKey,
unit: zAxis.unit || "",
value: z,
payload: entry,
dataKey: zAxisDataKey,
type: tooltipType
});
}
var cx = getCateCoordinateOfLine({
axis: xAxis,
ticks: xAxisTicks,
bandSize: xBandSize,
entry,
index: index3,
dataKey: xAxisDataKey
});
var cy = getCateCoordinateOfLine({
axis: yAxis,
ticks: yAxisTicks,
bandSize: yBandSize,
entry,
index: index3,
dataKey: yAxisDataKey
});
var size = z !== "-" ? zAxis.scale(z) : defaultZ;
var radius = Math.sqrt(Math.max(size, 0) / Math.PI);
return _objectSpread44(_objectSpread44({}, entry), {}, {
cx,
cy,
x: cx - radius,
y: cy - radius,
xAxis,
yAxis,
zAxis,
width: 2 * radius,
height: 2 * radius,
size,
node: {
x: x2,
y: y2,
z
},
tooltipPayload,
tooltipPosition: {
x: cx,
y: cy
},
payload: entry
}, cells && cells[index3] && cells[index3].props);
});
return _objectSpread44({
points
}, offset);
});
// node_modules/recharts/es6/cartesian/XAxis.js
var import_react57 = __toESM(require_react());
function _typeof54(o) {
"@babel/helpers - typeof";
return _typeof54 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof54(o);
}
function _classCallCheck25(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties25(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey49(descriptor.key), descriptor);
}
}
function _createClass25(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties25(Constructor.prototype, protoProps);
if (staticProps) _defineProperties25(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper21(t, o, e) {
return o = _getPrototypeOf23(o), _possibleConstructorReturn23(t, _isNativeReflectConstruct23() ? Reflect.construct(o, e || [], _getPrototypeOf23(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn23(self2, call) {
if (call && (_typeof54(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized24(self2);
}
function _assertThisInitialized24(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct23() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct23 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf23(o) {
_getPrototypeOf23 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf23(o);
}
function _inherits23(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf24(subClass, superClass);
}
function _setPrototypeOf24(o, p) {
_setPrototypeOf24 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf24(o, p);
}
function _defineProperty48(obj, key, value) {
key = _toPropertyKey49(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey49(t) {
var i = _toPrimitive49(t, "string");
return "symbol" == _typeof54(i) ? i : i + "";
}
function _toPrimitive49(t, r) {
if ("object" != _typeof54(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof54(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _extends38() {
_extends38 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends38.apply(this, arguments);
}
function XAxisImpl(_ref) {
var xAxisId = _ref.xAxisId;
var width = useChartWidth();
var height = useChartHeight();
var axisOptions = useXAxisOrThrow(xAxisId);
if (axisOptions == null) {
return null;
}
return (
// @ts-expect-error the axisOptions type is not exactly what CartesianAxis is expecting.
import_react57.default.createElement(CartesianAxis, _extends38({}, axisOptions, {
className: clsx_default("recharts-".concat(axisOptions.axisType, " ").concat(axisOptions.axisType), axisOptions.className),
viewBox: {
x: 0,
y: 0,
width,
height
},
ticksGenerator: function ticksGenerator(axis) {
return getTicksOfAxis(axis, true);
}
}))
);
}
var XAxis = function(_React$Component) {
function XAxis2() {
_classCallCheck25(this, XAxis2);
return _callSuper21(this, XAxis2, arguments);
}
_inherits23(XAxis2, _React$Component);
return _createClass25(XAxis2, [{
key: "render",
value: function render() {
return import_react57.default.createElement(XAxisImpl, this.props);
}
}]);
}(import_react57.default.Component);
_defineProperty48(XAxis, "displayName", "XAxis");
_defineProperty48(XAxis, "defaultProps", {
allowDecimals: true,
hide: false,
orientation: "bottom",
width: 0,
height: 30,
mirror: false,
xAxisId: 0,
tickCount: 5,
type: "category",
padding: {
left: 0,
right: 0
},
allowDataOverflow: false,
scale: "auto",
reversed: false,
allowDuplicatedCategory: true
});
// node_modules/recharts/es6/cartesian/YAxis.js
var import_react58 = __toESM(require_react());
function _typeof55(o) {
"@babel/helpers - typeof";
return _typeof55 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof55(o);
}
function _classCallCheck26(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties26(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey50(descriptor.key), descriptor);
}
}
function _createClass26(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties26(Constructor.prototype, protoProps);
if (staticProps) _defineProperties26(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper22(t, o, e) {
return o = _getPrototypeOf24(o), _possibleConstructorReturn24(t, _isNativeReflectConstruct24() ? Reflect.construct(o, e || [], _getPrototypeOf24(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn24(self2, call) {
if (call && (_typeof55(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized25(self2);
}
function _assertThisInitialized25(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct24() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct24 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf24(o) {
_getPrototypeOf24 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf24(o);
}
function _inherits24(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf25(subClass, superClass);
}
function _setPrototypeOf25(o, p) {
_setPrototypeOf25 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf25(o, p);
}
function _defineProperty49(obj, key, value) {
key = _toPropertyKey50(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey50(t) {
var i = _toPrimitive50(t, "string");
return "symbol" == _typeof55(i) ? i : i + "";
}
function _toPrimitive50(t, r) {
if ("object" != _typeof55(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof55(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _extends39() {
_extends39 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends39.apply(this, arguments);
}
var YAxisImpl = function YAxisImpl2(_ref) {
var yAxisId = _ref.yAxisId;
var width = useChartWidth();
var height = useChartHeight();
var axisOptions = useYAxisOrThrow(yAxisId);
if (axisOptions == null) {
return null;
}
return (
// @ts-expect-error the axisOptions type is not exactly what CartesianAxis is expecting.
import_react58.default.createElement(CartesianAxis, _extends39({}, axisOptions, {
className: clsx_default("recharts-".concat(axisOptions.axisType, " ").concat(axisOptions.axisType), axisOptions.className),
viewBox: {
x: 0,
y: 0,
width,
height
},
ticksGenerator: function ticksGenerator(axis) {
return getTicksOfAxis(axis, true);
}
}))
);
};
var YAxis = function(_React$Component) {
function YAxis2() {
_classCallCheck26(this, YAxis2);
return _callSuper22(this, YAxis2, arguments);
}
_inherits24(YAxis2, _React$Component);
return _createClass26(YAxis2, [{
key: "render",
value: function render() {
return import_react58.default.createElement(YAxisImpl, this.props);
}
}]);
}(import_react58.default.Component);
_defineProperty49(YAxis, "displayName", "YAxis");
_defineProperty49(YAxis, "defaultProps", {
allowDuplicatedCategory: true,
allowDecimals: true,
hide: false,
orientation: "left",
width: 60,
height: 0,
mirror: false,
yAxisId: 0,
tickCount: 5,
type: "number",
padding: {
top: 0,
bottom: 0
},
allowDataOverflow: false,
scale: "auto",
reversed: false
});
// node_modules/recharts/es6/chart/generateCategoricalChart.js
var import_react60 = __toESM(require_react());
var import_isNil14 = __toESM(require_isNil());
var import_isFunction26 = __toESM(require_isFunction());
var import_range4 = __toESM(require_range());
var import_get6 = __toESM(require_get());
var import_sortBy3 = __toESM(require_sortBy());
var import_throttle2 = __toESM(require_throttle());
// node_modules/recharts/es6/util/DetectReferenceElementsDomain.js
function _toConsumableArray11(arr) {
return _arrayWithoutHoles11(arr) || _iterableToArray12(arr) || _unsupportedIterableToArray21(arr) || _nonIterableSpread11();
}
function _nonIterableSpread11() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray21(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray21(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray21(o, minLen);
}
function _iterableToArray12(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles11(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray21(arr);
}
function _arrayLikeToArray21(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
var detectReferenceElementsDomain = function detectReferenceElementsDomain2(children2, domain, axisId, axisType, specifiedTicks) {
var lines = findAllByType(children2, ReferenceLine);
var dots = findAllByType(children2, ReferenceDot);
var elements = [].concat(_toConsumableArray11(lines), _toConsumableArray11(dots));
var areas = findAllByType(children2, ReferenceArea);
var idKey = "".concat(axisType, "Id");
var valueKey = axisType[0];
var finalDomain = domain;
if (elements.length) {
finalDomain = elements.reduce(function(result, el) {
if (el.props[idKey] === axisId && ifOverflowMatches(el.props, "extendDomain") && isNumber(el.props[valueKey])) {
var value = el.props[valueKey];
return [Math.min(result[0], value), Math.max(result[1], value)];
}
return result;
}, finalDomain);
}
if (areas.length) {
var key1 = "".concat(valueKey, "1");
var key2 = "".concat(valueKey, "2");
finalDomain = areas.reduce(function(result, el) {
if (el.props[idKey] === axisId && ifOverflowMatches(el.props, "extendDomain") && isNumber(el.props[key1]) && isNumber(el.props[key2])) {
var value1 = el.props[key1];
var value2 = el.props[key2];
return [Math.min(result[0], value1, value2), Math.max(result[1], value1, value2)];
}
return result;
}, finalDomain);
}
if (specifiedTicks && specifiedTicks.length) {
finalDomain = specifiedTicks.reduce(function(result, tick) {
if (isNumber(tick)) {
return [Math.min(result[0], tick), Math.max(result[1], tick)];
}
return result;
}, finalDomain);
}
return finalDomain;
};
// node_modules/recharts/es6/util/Events.js
var import_eventemitter3 = __toESM(require_eventemitter3());
var eventCenter = new import_eventemitter3.default();
var SYNC_EVENT = "recharts.syncMouseEvents";
// node_modules/recharts/es6/chart/AccessibilityManager.js
function _typeof56(o) {
"@babel/helpers - typeof";
return _typeof56 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof56(o);
}
function _classCallCheck27(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties27(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey51(descriptor.key), descriptor);
}
}
function _createClass27(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties27(Constructor.prototype, protoProps);
if (staticProps) _defineProperties27(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _defineProperty50(obj, key, value) {
key = _toPropertyKey51(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey51(t) {
var i = _toPrimitive51(t, "string");
return "symbol" == _typeof56(i) ? i : i + "";
}
function _toPrimitive51(t, r) {
if ("object" != _typeof56(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof56(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var AccessibilityManager = function() {
function AccessibilityManager2() {
_classCallCheck27(this, AccessibilityManager2);
_defineProperty50(this, "activeIndex", 0);
_defineProperty50(this, "coordinateList", []);
_defineProperty50(this, "layout", "horizontal");
}
return _createClass27(AccessibilityManager2, [{
key: "setDetails",
value: function setDetails(_ref) {
var _ref2;
var _ref$coordinateList = _ref.coordinateList, coordinateList = _ref$coordinateList === void 0 ? null : _ref$coordinateList, _ref$container = _ref.container, container = _ref$container === void 0 ? null : _ref$container, _ref$layout = _ref.layout, layout = _ref$layout === void 0 ? null : _ref$layout, _ref$offset = _ref.offset, offset = _ref$offset === void 0 ? null : _ref$offset, _ref$mouseHandlerCall = _ref.mouseHandlerCallback, mouseHandlerCallback = _ref$mouseHandlerCall === void 0 ? null : _ref$mouseHandlerCall;
this.coordinateList = (_ref2 = coordinateList !== null && coordinateList !== void 0 ? coordinateList : this.coordinateList) !== null && _ref2 !== void 0 ? _ref2 : [];
this.container = container !== null && container !== void 0 ? container : this.container;
this.layout = layout !== null && layout !== void 0 ? layout : this.layout;
this.offset = offset !== null && offset !== void 0 ? offset : this.offset;
this.mouseHandlerCallback = mouseHandlerCallback !== null && mouseHandlerCallback !== void 0 ? mouseHandlerCallback : this.mouseHandlerCallback;
this.activeIndex = Math.min(Math.max(this.activeIndex, 0), this.coordinateList.length - 1);
}
}, {
key: "focus",
value: function focus() {
this.spoofMouse();
}
}, {
key: "keyboardEvent",
value: function keyboardEvent(e) {
if (this.coordinateList.length === 0) {
return;
}
switch (e.key) {
case "ArrowRight": {
if (this.layout !== "horizontal") {
return;
}
this.activeIndex = Math.min(this.activeIndex + 1, this.coordinateList.length - 1);
this.spoofMouse();
break;
}
case "ArrowLeft": {
if (this.layout !== "horizontal") {
return;
}
this.activeIndex = Math.max(this.activeIndex - 1, 0);
this.spoofMouse();
break;
}
default: {
break;
}
}
}
}, {
key: "setIndex",
value: function setIndex(newIndex) {
this.activeIndex = newIndex;
}
}, {
key: "spoofMouse",
value: function spoofMouse() {
var _window, _window2;
if (this.layout !== "horizontal") {
return;
}
if (this.coordinateList.length === 0) {
return;
}
var _this$container$getBo = this.container.getBoundingClientRect(), x2 = _this$container$getBo.x, y2 = _this$container$getBo.y, height = _this$container$getBo.height;
var coordinate = this.coordinateList[this.activeIndex].coordinate;
var scrollOffsetX = ((_window = window) === null || _window === void 0 ? void 0 : _window.scrollX) || 0;
var scrollOffsetY = ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.scrollY) || 0;
var pageX = x2 + coordinate + scrollOffsetX;
var pageY = y2 + this.offset.top + height / 2 + scrollOffsetY;
this.mouseHandlerCallback({
pageX,
pageY
});
}
}]);
}();
// node_modules/recharts/es6/util/isDomainSpecifiedByUser.js
function isDomainSpecifiedByUser(domain, allowDataOverflow, axisType) {
if (axisType === "number" && allowDataOverflow === true && Array.isArray(domain)) {
var domainStart = domain === null || domain === void 0 ? void 0 : domain[0];
var domainEnd = domain === null || domain === void 0 ? void 0 : domain[1];
if (!!domainStart && !!domainEnd && isNumber(domainStart) && isNumber(domainEnd)) {
return true;
}
}
return false;
}
// node_modules/recharts/es6/component/Cursor.js
var import_react59 = __toESM(require_react());
// node_modules/recharts/es6/util/cursor/getCursorRectangle.js
function getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize) {
var halfSize = tooltipAxisBandSize / 2;
return {
stroke: "none",
fill: "#ccc",
x: layout === "horizontal" ? activeCoordinate.x - halfSize : offset.left + 0.5,
y: layout === "horizontal" ? offset.top + 0.5 : activeCoordinate.y - halfSize,
width: layout === "horizontal" ? tooltipAxisBandSize : offset.width - 1,
height: layout === "horizontal" ? offset.height - 1 : tooltipAxisBandSize
};
}
// node_modules/recharts/es6/util/cursor/getRadialCursorPoints.js
function getRadialCursorPoints(activeCoordinate) {
var cx = activeCoordinate.cx, cy = activeCoordinate.cy, radius = activeCoordinate.radius, startAngle = activeCoordinate.startAngle, endAngle = activeCoordinate.endAngle;
var startPoint = polarToCartesian(cx, cy, radius, startAngle);
var endPoint = polarToCartesian(cx, cy, radius, endAngle);
return {
points: [startPoint, endPoint],
cx,
cy,
radius,
startAngle,
endAngle
};
}
// node_modules/recharts/es6/util/cursor/getCursorPoints.js
function getCursorPoints(layout, activeCoordinate, offset) {
var x1, y1, x2, y2;
if (layout === "horizontal") {
x1 = activeCoordinate.x;
x2 = x1;
y1 = offset.top;
y2 = offset.top + offset.height;
} else if (layout === "vertical") {
y1 = activeCoordinate.y;
y2 = y1;
x1 = offset.left;
x2 = offset.left + offset.width;
} else if (activeCoordinate.cx != null && activeCoordinate.cy != null) {
if (layout === "centric") {
var cx = activeCoordinate.cx, cy = activeCoordinate.cy, innerRadius = activeCoordinate.innerRadius, outerRadius = activeCoordinate.outerRadius, angle = activeCoordinate.angle;
var innerPoint = polarToCartesian(cx, cy, innerRadius, angle);
var outerPoint = polarToCartesian(cx, cy, outerRadius, angle);
x1 = innerPoint.x;
y1 = innerPoint.y;
x2 = outerPoint.x;
y2 = outerPoint.y;
} else {
return getRadialCursorPoints(activeCoordinate);
}
}
return [{
x: x1,
y: y1
}, {
x: x2,
y: y2
}];
}
// node_modules/recharts/es6/component/Cursor.js
function _typeof57(o) {
"@babel/helpers - typeof";
return _typeof57 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof57(o);
}
function ownKeys45(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread45(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys45(Object(t), true).forEach(function(r2) {
_defineProperty51(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys45(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty51(obj, key, value) {
key = _toPropertyKey52(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey52(t) {
var i = _toPrimitive52(t, "string");
return "symbol" == _typeof57(i) ? i : i + "";
}
function _toPrimitive52(t, r) {
if ("object" != _typeof57(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof57(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function Cursor(props) {
var _element$props$cursor, _defaultProps;
var element = props.element, tooltipEventType = props.tooltipEventType, isActive = props.isActive, activeCoordinate = props.activeCoordinate, activePayload = props.activePayload, offset = props.offset, activeTooltipIndex = props.activeTooltipIndex, tooltipAxisBandSize = props.tooltipAxisBandSize, layout = props.layout, chartName = props.chartName;
var elementPropsCursor = (_element$props$cursor = element.props.cursor) !== null && _element$props$cursor !== void 0 ? _element$props$cursor : (_defaultProps = element.type.defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.cursor;
if (!element || !elementPropsCursor || !isActive || !activeCoordinate || chartName !== "ScatterChart" && tooltipEventType !== "axis") {
return null;
}
var restProps;
var cursorComp = Curve;
if (chartName === "ScatterChart") {
restProps = activeCoordinate;
cursorComp = Cross;
} else if (chartName === "BarChart") {
restProps = getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize);
cursorComp = Rectangle;
} else if (layout === "radial") {
var _getRadialCursorPoint = getRadialCursorPoints(activeCoordinate), cx = _getRadialCursorPoint.cx, cy = _getRadialCursorPoint.cy, radius = _getRadialCursorPoint.radius, startAngle = _getRadialCursorPoint.startAngle, endAngle = _getRadialCursorPoint.endAngle;
restProps = {
cx,
cy,
startAngle,
endAngle,
innerRadius: radius,
outerRadius: radius
};
cursorComp = Sector;
} else {
restProps = {
points: getCursorPoints(layout, activeCoordinate, offset)
};
cursorComp = Curve;
}
var cursorProps = _objectSpread45(_objectSpread45(_objectSpread45(_objectSpread45({
stroke: "#ccc",
pointerEvents: "none"
}, offset), restProps), filterProps(elementPropsCursor, false)), {}, {
payload: activePayload,
payloadIndex: activeTooltipIndex,
className: clsx_default("recharts-tooltip-cursor", elementPropsCursor.className)
});
return (0, import_react59.isValidElement)(elementPropsCursor) ? (0, import_react59.cloneElement)(elementPropsCursor, cursorProps) : (0, import_react59.createElement)(cursorComp, cursorProps);
}
// node_modules/recharts/es6/chart/generateCategoricalChart.js
var _excluded34 = ["item"];
var _excluded213 = ["children", "className", "width", "height", "style", "compact", "title", "desc"];
function _typeof58(o) {
"@babel/helpers - typeof";
return _typeof58 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof58(o);
}
function _extends40() {
_extends40 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends40.apply(this, arguments);
}
function _slicedToArray13(arr, i) {
return _arrayWithHoles14(arr) || _iterableToArrayLimit13(arr, i) || _unsupportedIterableToArray22(arr, i) || _nonIterableRest14();
}
function _nonIterableRest14() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _iterableToArrayLimit13(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e, n, i, u, a2 = [], f = true, o = false;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = false;
} else for (; !(f = (e = i.call(t)).done) && (a2.push(e.value), a2.length !== l); f = true) ;
} catch (r2) {
o = true, n = r2;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a2;
}
}
function _arrayWithHoles14(arr) {
if (Array.isArray(arr)) return arr;
}
function _objectWithoutProperties27(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose28(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose28(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck28(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties28(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey53(descriptor.key), descriptor);
}
}
function _createClass28(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties28(Constructor.prototype, protoProps);
if (staticProps) _defineProperties28(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper23(t, o, e) {
return o = _getPrototypeOf25(o), _possibleConstructorReturn25(t, _isNativeReflectConstruct25() ? Reflect.construct(o, e || [], _getPrototypeOf25(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn25(self2, call) {
if (call && (_typeof58(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized26(self2);
}
function _assertThisInitialized26(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct25() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct25 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf25(o) {
_getPrototypeOf25 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf25(o);
}
function _inherits25(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf26(subClass, superClass);
}
function _setPrototypeOf26(o, p) {
_setPrototypeOf26 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf26(o, p);
}
function _toConsumableArray12(arr) {
return _arrayWithoutHoles12(arr) || _iterableToArray13(arr) || _unsupportedIterableToArray22(arr) || _nonIterableSpread12();
}
function _nonIterableSpread12() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray22(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray22(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray22(o, minLen);
}
function _iterableToArray13(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles12(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray22(arr);
}
function _arrayLikeToArray22(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function ownKeys46(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread46(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys46(Object(t), true).forEach(function(r2) {
_defineProperty52(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys46(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty52(obj, key, value) {
key = _toPropertyKey53(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey53(t) {
var i = _toPrimitive53(t, "string");
return "symbol" == _typeof58(i) ? i : i + "";
}
function _toPrimitive53(t, r) {
if ("object" != _typeof58(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof58(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var ORIENT_MAP = {
xAxis: ["bottom", "top"],
yAxis: ["left", "right"]
};
var FULL_WIDTH_AND_HEIGHT = {
width: "100%",
height: "100%"
};
var originCoordinate = {
x: 0,
y: 0
};
function renderAsIs(element) {
return element;
}
var calculateTooltipPos = function calculateTooltipPos2(rangeObj, layout) {
if (layout === "horizontal") {
return rangeObj.x;
}
if (layout === "vertical") {
return rangeObj.y;
}
if (layout === "centric") {
return rangeObj.angle;
}
return rangeObj.radius;
};
var getActiveCoordinate = function getActiveCoordinate2(layout, tooltipTicks, activeIndex, rangeObj) {
var entry = tooltipTicks.find(function(tick) {
return tick && tick.index === activeIndex;
});
if (entry) {
if (layout === "horizontal") {
return {
x: entry.coordinate,
y: rangeObj.y
};
}
if (layout === "vertical") {
return {
x: rangeObj.x,
y: entry.coordinate
};
}
if (layout === "centric") {
var _angle = entry.coordinate;
var _radius = rangeObj.radius;
return _objectSpread46(_objectSpread46(_objectSpread46({}, rangeObj), polarToCartesian(rangeObj.cx, rangeObj.cy, _radius, _angle)), {}, {
angle: _angle,
radius: _radius
});
}
var radius = entry.coordinate;
var angle = rangeObj.angle;
return _objectSpread46(_objectSpread46(_objectSpread46({}, rangeObj), polarToCartesian(rangeObj.cx, rangeObj.cy, radius, angle)), {}, {
angle,
radius
});
}
return originCoordinate;
};
var getDisplayedData = function getDisplayedData2(data, _ref) {
var graphicalItems = _ref.graphicalItems, dataStartIndex = _ref.dataStartIndex, dataEndIndex = _ref.dataEndIndex;
var itemsData = (graphicalItems !== null && graphicalItems !== void 0 ? graphicalItems : []).reduce(function(result, child) {
var itemData = child.props.data;
if (itemData && itemData.length) {
return [].concat(_toConsumableArray12(result), _toConsumableArray12(itemData));
}
return result;
}, []);
if (itemsData.length > 0) {
return itemsData;
}
if (data && data.length && isNumber(dataStartIndex) && isNumber(dataEndIndex)) {
return data.slice(dataStartIndex, dataEndIndex + 1);
}
return [];
};
function getDefaultDomainByAxisType(axisType) {
return axisType === "number" ? [0, "auto"] : void 0;
}
var getTooltipContent = function getTooltipContent2(state, chartData, activeIndex, activeLabel) {
var graphicalItems = state.graphicalItems, tooltipAxis = state.tooltipAxis;
var displayedData = getDisplayedData(chartData, state);
if (activeIndex < 0 || !graphicalItems || !graphicalItems.length || activeIndex >= displayedData.length) {
return null;
}
return graphicalItems.reduce(function(result, child) {
var _child$props$data;
var data = (_child$props$data = child.props.data) !== null && _child$props$data !== void 0 ? _child$props$data : chartData;
if (data && state.dataStartIndex + state.dataEndIndex !== 0 && // https://github.com/recharts/recharts/issues/4717
// The data is sliced only when the active index is within the start/end index range.
state.dataEndIndex - state.dataStartIndex >= activeIndex) {
data = data.slice(state.dataStartIndex, state.dataEndIndex + 1);
}
var payload;
if (tooltipAxis.dataKey && !tooltipAxis.allowDuplicatedCategory) {
var entries = data === void 0 ? displayedData : data;
payload = findEntryInArray(entries, tooltipAxis.dataKey, activeLabel);
} else {
payload = data && data[activeIndex] || displayedData[activeIndex];
}
if (!payload) {
return result;
}
return [].concat(_toConsumableArray12(result), [getTooltipItem(child, payload)]);
}, []);
};
var getTooltipData = function getTooltipData2(state, chartData, layout, rangeObj) {
var rangeData = rangeObj || {
x: state.chartX,
y: state.chartY
};
var pos = calculateTooltipPos(rangeData, layout);
var ticks2 = state.orderedTooltipTicks, axis = state.tooltipAxis, tooltipTicks = state.tooltipTicks;
var activeIndex = calculateActiveTickIndex(pos, ticks2, tooltipTicks, axis);
if (activeIndex >= 0 && tooltipTicks) {
var activeLabel = tooltipTicks[activeIndex] && tooltipTicks[activeIndex].value;
var activePayload = getTooltipContent(state, chartData, activeIndex, activeLabel);
var activeCoordinate = getActiveCoordinate(layout, ticks2, activeIndex, rangeData);
return {
activeTooltipIndex: activeIndex,
activeLabel,
activePayload,
activeCoordinate
};
}
return null;
};
var getAxisMapByAxes = function getAxisMapByAxes2(props, _ref2) {
var axes = _ref2.axes, graphicalItems = _ref2.graphicalItems, axisType = _ref2.axisType, axisIdKey = _ref2.axisIdKey, stackGroups = _ref2.stackGroups, dataStartIndex = _ref2.dataStartIndex, dataEndIndex = _ref2.dataEndIndex;
var layout = props.layout, children2 = props.children, stackOffset = props.stackOffset;
var isCategorical = isCategoricalAxis(layout, axisType);
return axes.reduce(function(result, child) {
var _childProps$domain2;
var childProps = child.type.defaultProps !== void 0 ? _objectSpread46(_objectSpread46({}, child.type.defaultProps), child.props) : child.props;
var type = childProps.type, dataKey = childProps.dataKey, allowDataOverflow = childProps.allowDataOverflow, allowDuplicatedCategory = childProps.allowDuplicatedCategory, scale = childProps.scale, ticks2 = childProps.ticks, includeHidden = childProps.includeHidden;
var axisId = childProps[axisIdKey];
if (result[axisId]) {
return result;
}
var displayedData = getDisplayedData(props.data, {
graphicalItems: graphicalItems.filter(function(item) {
var _defaultProps;
var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps = item.type.defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps[axisIdKey];
return itemAxisId === axisId;
}),
dataStartIndex,
dataEndIndex
});
var len = displayedData.length;
var domain, duplicateDomain, categoricalDomain;
if (isDomainSpecifiedByUser(childProps.domain, allowDataOverflow, type)) {
domain = parseSpecifiedDomain(childProps.domain, null, allowDataOverflow);
if (isCategorical && (type === "number" || scale !== "auto")) {
categoricalDomain = getDomainOfDataByKey(displayedData, dataKey, "category");
}
}
var defaultDomain = getDefaultDomainByAxisType(type);
if (!domain || domain.length === 0) {
var _childProps$domain;
var childDomain = (_childProps$domain = childProps.domain) !== null && _childProps$domain !== void 0 ? _childProps$domain : defaultDomain;
if (dataKey) {
domain = getDomainOfDataByKey(displayedData, dataKey, type);
if (type === "category" && isCategorical) {
var duplicate = hasDuplicate(domain);
if (allowDuplicatedCategory && duplicate) {
duplicateDomain = domain;
domain = (0, import_range4.default)(0, len);
} else if (!allowDuplicatedCategory) {
domain = parseDomainOfCategoryAxis(childDomain, domain, child).reduce(function(finalDomain, entry) {
return finalDomain.indexOf(entry) >= 0 ? finalDomain : [].concat(_toConsumableArray12(finalDomain), [entry]);
}, []);
}
} else if (type === "category") {
if (!allowDuplicatedCategory) {
domain = parseDomainOfCategoryAxis(childDomain, domain, child).reduce(function(finalDomain, entry) {
return finalDomain.indexOf(entry) >= 0 || entry === "" || (0, import_isNil14.default)(entry) ? finalDomain : [].concat(_toConsumableArray12(finalDomain), [entry]);
}, []);
} else {
domain = domain.filter(function(entry) {
return entry !== "" && !(0, import_isNil14.default)(entry);
});
}
} else if (type === "number") {
var errorBarsDomain = parseErrorBarsOfAxis(displayedData, graphicalItems.filter(function(item) {
var _defaultProps2, _defaultProps3;
var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps2 = item.type.defaultProps) === null || _defaultProps2 === void 0 ? void 0 : _defaultProps2[axisIdKey];
var itemHide = "hide" in item.props ? item.props.hide : (_defaultProps3 = item.type.defaultProps) === null || _defaultProps3 === void 0 ? void 0 : _defaultProps3.hide;
return itemAxisId === axisId && (includeHidden || !itemHide);
}), dataKey, axisType, layout);
if (errorBarsDomain) {
domain = errorBarsDomain;
}
}
if (isCategorical && (type === "number" || scale !== "auto")) {
categoricalDomain = getDomainOfDataByKey(displayedData, dataKey, "category");
}
} else if (isCategorical) {
domain = (0, import_range4.default)(0, len);
} else if (stackGroups && stackGroups[axisId] && stackGroups[axisId].hasStack && type === "number") {
domain = stackOffset === "expand" ? [0, 1] : getDomainOfStackGroups(stackGroups[axisId].stackGroups, dataStartIndex, dataEndIndex);
} else {
domain = getDomainOfItemsWithSameAxis(displayedData, graphicalItems.filter(function(item) {
var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : item.type.defaultProps[axisIdKey];
var itemHide = "hide" in item.props ? item.props.hide : item.type.defaultProps.hide;
return itemAxisId === axisId && (includeHidden || !itemHide);
}), type, layout, true);
}
if (type === "number") {
domain = detectReferenceElementsDomain(children2, domain, axisId, axisType, ticks2);
if (childDomain) {
domain = parseSpecifiedDomain(childDomain, domain, allowDataOverflow);
}
} else if (type === "category" && childDomain) {
var axisDomain = childDomain;
var isDomainValid = domain.every(function(entry) {
return axisDomain.indexOf(entry) >= 0;
});
if (isDomainValid) {
domain = axisDomain;
}
}
}
return _objectSpread46(_objectSpread46({}, result), {}, _defineProperty52({}, axisId, _objectSpread46(_objectSpread46({}, childProps), {}, {
axisType,
domain,
categoricalDomain,
duplicateDomain,
originalDomain: (_childProps$domain2 = childProps.domain) !== null && _childProps$domain2 !== void 0 ? _childProps$domain2 : defaultDomain,
isCategorical,
layout
})));
}, {});
};
var getAxisMapByItems = function getAxisMapByItems2(props, _ref3) {
var graphicalItems = _ref3.graphicalItems, Axis = _ref3.Axis, axisType = _ref3.axisType, axisIdKey = _ref3.axisIdKey, stackGroups = _ref3.stackGroups, dataStartIndex = _ref3.dataStartIndex, dataEndIndex = _ref3.dataEndIndex;
var layout = props.layout, children2 = props.children;
var displayedData = getDisplayedData(props.data, {
graphicalItems,
dataStartIndex,
dataEndIndex
});
var len = displayedData.length;
var isCategorical = isCategoricalAxis(layout, axisType);
var index3 = -1;
return graphicalItems.reduce(function(result, child) {
var childProps = child.type.defaultProps !== void 0 ? _objectSpread46(_objectSpread46({}, child.type.defaultProps), child.props) : child.props;
var axisId = childProps[axisIdKey];
var originalDomain = getDefaultDomainByAxisType("number");
if (!result[axisId]) {
index3++;
var domain;
if (isCategorical) {
domain = (0, import_range4.default)(0, len);
} else if (stackGroups && stackGroups[axisId] && stackGroups[axisId].hasStack) {
domain = getDomainOfStackGroups(stackGroups[axisId].stackGroups, dataStartIndex, dataEndIndex);
domain = detectReferenceElementsDomain(children2, domain, axisId, axisType);
} else {
domain = parseSpecifiedDomain(originalDomain, getDomainOfItemsWithSameAxis(displayedData, graphicalItems.filter(function(item) {
var _defaultProps4, _defaultProps5;
var itemAxisId = axisIdKey in item.props ? item.props[axisIdKey] : (_defaultProps4 = item.type.defaultProps) === null || _defaultProps4 === void 0 ? void 0 : _defaultProps4[axisIdKey];
var itemHide = "hide" in item.props ? item.props.hide : (_defaultProps5 = item.type.defaultProps) === null || _defaultProps5 === void 0 ? void 0 : _defaultProps5.hide;
return itemAxisId === axisId && !itemHide;
}), "number", layout), Axis.defaultProps.allowDataOverflow);
domain = detectReferenceElementsDomain(children2, domain, axisId, axisType);
}
return _objectSpread46(_objectSpread46({}, result), {}, _defineProperty52({}, axisId, _objectSpread46(_objectSpread46({
axisType
}, Axis.defaultProps), {}, {
hide: true,
orientation: (0, import_get6.default)(ORIENT_MAP, "".concat(axisType, ".").concat(index3 % 2), null),
domain,
originalDomain,
isCategorical,
layout
// specify scale when no Axis
// scale: isCategorical ? 'band' : 'linear',
})));
}
return result;
}, {});
};
var getAxisMap = function getAxisMap2(props, _ref4) {
var _ref4$axisType = _ref4.axisType, axisType = _ref4$axisType === void 0 ? "xAxis" : _ref4$axisType, AxisComp = _ref4.AxisComp, graphicalItems = _ref4.graphicalItems, stackGroups = _ref4.stackGroups, dataStartIndex = _ref4.dataStartIndex, dataEndIndex = _ref4.dataEndIndex;
var children2 = props.children;
var axisIdKey = "".concat(axisType, "Id");
var axes = findAllByType(children2, AxisComp);
var axisMap = {};
if (axes && axes.length) {
axisMap = getAxisMapByAxes(props, {
axes,
graphicalItems,
axisType,
axisIdKey,
stackGroups,
dataStartIndex,
dataEndIndex
});
} else if (graphicalItems && graphicalItems.length) {
axisMap = getAxisMapByItems(props, {
Axis: AxisComp,
graphicalItems,
axisType,
axisIdKey,
stackGroups,
dataStartIndex,
dataEndIndex
});
}
return axisMap;
};
var tooltipTicksGenerator = function tooltipTicksGenerator2(axisMap) {
var axis = getAnyElementOfObject(axisMap);
var tooltipTicks = getTicksOfAxis(axis, false, true);
return {
tooltipTicks,
orderedTooltipTicks: (0, import_sortBy3.default)(tooltipTicks, function(o) {
return o.coordinate;
}),
tooltipAxis: axis,
tooltipAxisBandSize: getBandSizeOfAxis(axis, tooltipTicks)
};
};
var createDefaultState = function createDefaultState2(props) {
var children2 = props.children, defaultShowTooltip = props.defaultShowTooltip;
var brushItem = findChildByType(children2, Brush);
var startIndex = 0;
var endIndex = 0;
if (props.data && props.data.length !== 0) {
endIndex = props.data.length - 1;
}
if (brushItem && brushItem.props) {
if (brushItem.props.startIndex >= 0) {
startIndex = brushItem.props.startIndex;
}
if (brushItem.props.endIndex >= 0) {
endIndex = brushItem.props.endIndex;
}
}
return {
chartX: 0,
chartY: 0,
dataStartIndex: startIndex,
dataEndIndex: endIndex,
activeTooltipIndex: -1,
isTooltipActive: Boolean(defaultShowTooltip)
};
};
var hasGraphicalBarItem = function hasGraphicalBarItem2(graphicalItems) {
if (!graphicalItems || !graphicalItems.length) {
return false;
}
return graphicalItems.some(function(item) {
var name = getDisplayName(item && item.type);
return name && name.indexOf("Bar") >= 0;
});
};
var getAxisNameByLayout = function getAxisNameByLayout2(layout) {
if (layout === "horizontal") {
return {
numericAxisName: "yAxis",
cateAxisName: "xAxis"
};
}
if (layout === "vertical") {
return {
numericAxisName: "xAxis",
cateAxisName: "yAxis"
};
}
if (layout === "centric") {
return {
numericAxisName: "radiusAxis",
cateAxisName: "angleAxis"
};
}
return {
numericAxisName: "angleAxis",
cateAxisName: "radiusAxis"
};
};
var calculateOffset = function calculateOffset2(_ref5, prevLegendBBox) {
var props = _ref5.props, graphicalItems = _ref5.graphicalItems, _ref5$xAxisMap = _ref5.xAxisMap, xAxisMap = _ref5$xAxisMap === void 0 ? {} : _ref5$xAxisMap, _ref5$yAxisMap = _ref5.yAxisMap, yAxisMap = _ref5$yAxisMap === void 0 ? {} : _ref5$yAxisMap;
var width = props.width, height = props.height, children2 = props.children;
var margin = props.margin || {};
var brushItem = findChildByType(children2, Brush);
var legendItem = findChildByType(children2, Legend);
var offsetH = Object.keys(yAxisMap).reduce(function(result, id) {
var entry = yAxisMap[id];
var orientation = entry.orientation;
if (!entry.mirror && !entry.hide) {
return _objectSpread46(_objectSpread46({}, result), {}, _defineProperty52({}, orientation, result[orientation] + entry.width));
}
return result;
}, {
left: margin.left || 0,
right: margin.right || 0
});
var offsetV = Object.keys(xAxisMap).reduce(function(result, id) {
var entry = xAxisMap[id];
var orientation = entry.orientation;
if (!entry.mirror && !entry.hide) {
return _objectSpread46(_objectSpread46({}, result), {}, _defineProperty52({}, orientation, (0, import_get6.default)(result, "".concat(orientation)) + entry.height));
}
return result;
}, {
top: margin.top || 0,
bottom: margin.bottom || 0
});
var offset = _objectSpread46(_objectSpread46({}, offsetV), offsetH);
var brushBottom = offset.bottom;
if (brushItem) {
offset.bottom += brushItem.props.height || Brush.defaultProps.height;
}
if (legendItem && prevLegendBBox) {
offset = appendOffsetOfLegend(offset, graphicalItems, props, prevLegendBBox);
}
var offsetWidth = width - offset.left - offset.right;
var offsetHeight = height - offset.top - offset.bottom;
return _objectSpread46(_objectSpread46({
brushBottom
}, offset), {}, {
// never return negative values for height and width
width: Math.max(offsetWidth, 0),
height: Math.max(offsetHeight, 0)
});
};
var getCartesianAxisSize = function getCartesianAxisSize2(axisObj, axisName) {
if (axisName === "xAxis") {
return axisObj[axisName].width;
}
if (axisName === "yAxis") {
return axisObj[axisName].height;
}
return void 0;
};
var generateCategoricalChart = function generateCategoricalChart2(_ref6) {
var chartName = _ref6.chartName, GraphicalChild = _ref6.GraphicalChild, _ref6$defaultTooltipE = _ref6.defaultTooltipEventType, defaultTooltipEventType = _ref6$defaultTooltipE === void 0 ? "axis" : _ref6$defaultTooltipE, _ref6$validateTooltip = _ref6.validateTooltipEventTypes, validateTooltipEventTypes = _ref6$validateTooltip === void 0 ? ["axis"] : _ref6$validateTooltip, axisComponents = _ref6.axisComponents, legendContent = _ref6.legendContent, formatAxisMap5 = _ref6.formatAxisMap, defaultProps6 = _ref6.defaultProps;
var getFormatItems = function getFormatItems2(props, currentState) {
var graphicalItems = currentState.graphicalItems, stackGroups = currentState.stackGroups, offset = currentState.offset, updateId = currentState.updateId, dataStartIndex = currentState.dataStartIndex, dataEndIndex = currentState.dataEndIndex;
var barSize = props.barSize, layout = props.layout, barGap = props.barGap, barCategoryGap = props.barCategoryGap, globalMaxBarSize = props.maxBarSize;
var _getAxisNameByLayout = getAxisNameByLayout(layout), numericAxisName = _getAxisNameByLayout.numericAxisName, cateAxisName = _getAxisNameByLayout.cateAxisName;
var hasBar = hasGraphicalBarItem(graphicalItems);
var formattedItems = [];
graphicalItems.forEach(function(item, index3) {
var displayedData = getDisplayedData(props.data, {
graphicalItems: [item],
dataStartIndex,
dataEndIndex
});
var itemProps = item.type.defaultProps !== void 0 ? _objectSpread46(_objectSpread46({}, item.type.defaultProps), item.props) : item.props;
var dataKey = itemProps.dataKey, childMaxBarSize = itemProps.maxBarSize;
var numericAxisId = itemProps["".concat(numericAxisName, "Id")];
var cateAxisId = itemProps["".concat(cateAxisName, "Id")];
var axisObjInitialValue = {};
var axisObj = axisComponents.reduce(function(result, entry) {
var _item$type$displayNam, _item$type;
var axisMap = currentState["".concat(entry.axisType, "Map")];
var id = itemProps["".concat(entry.axisType, "Id")];
!(axisMap && axisMap[id] || entry.axisType === "zAxis") ? true ? invariant(false, "Specifying a(n) ".concat(entry.axisType, "Id requires a corresponding ").concat(
entry.axisType,
"Id on the targeted graphical component "
).concat((_item$type$displayNam = item === null || item === void 0 || (_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.displayName) !== null && _item$type$displayNam !== void 0 ? _item$type$displayNam : "")) : invariant(false) : void 0;
var axis = axisMap[id];
return _objectSpread46(_objectSpread46({}, result), {}, _defineProperty52(_defineProperty52({}, entry.axisType, axis), "".concat(entry.axisType, "Ticks"), getTicksOfAxis(axis)));
}, axisObjInitialValue);
var cateAxis = axisObj[cateAxisName];
var cateTicks = axisObj["".concat(cateAxisName, "Ticks")];
var stackedData = stackGroups && stackGroups[numericAxisId] && stackGroups[numericAxisId].hasStack && getStackedDataOfItem(item, stackGroups[numericAxisId].stackGroups);
var itemIsBar = getDisplayName(item.type).indexOf("Bar") >= 0;
var bandSize = getBandSizeOfAxis(cateAxis, cateTicks);
var barPosition = [];
var sizeList = hasBar && getBarSizeList({
barSize,
stackGroups,
totalSize: getCartesianAxisSize(axisObj, cateAxisName)
});
if (itemIsBar) {
var _ref7, _getBandSizeOfAxis;
var maxBarSize = (0, import_isNil14.default)(childMaxBarSize) ? globalMaxBarSize : childMaxBarSize;
var barBandSize = (_ref7 = (_getBandSizeOfAxis = getBandSizeOfAxis(cateAxis, cateTicks, true)) !== null && _getBandSizeOfAxis !== void 0 ? _getBandSizeOfAxis : maxBarSize) !== null && _ref7 !== void 0 ? _ref7 : 0;
barPosition = getBarPosition({
barGap,
barCategoryGap,
bandSize: barBandSize !== bandSize ? barBandSize : bandSize,
sizeList: sizeList[cateAxisId],
maxBarSize
});
if (barBandSize !== bandSize) {
barPosition = barPosition.map(function(pos) {
return _objectSpread46(_objectSpread46({}, pos), {}, {
position: _objectSpread46(_objectSpread46({}, pos.position), {}, {
offset: pos.position.offset - barBandSize / 2
})
});
});
}
}
var composedFn = item && item.type && item.type.getComposedData;
if (composedFn) {
formattedItems.push({
props: _objectSpread46(_objectSpread46({}, composedFn(_objectSpread46(_objectSpread46({}, axisObj), {}, {
displayedData,
props,
dataKey,
item,
bandSize,
barPosition,
offset,
stackedData,
layout,
dataStartIndex,
dataEndIndex
}))), {}, _defineProperty52(_defineProperty52(_defineProperty52({
key: item.key || "item-".concat(index3)
}, numericAxisName, axisObj[numericAxisName]), cateAxisName, axisObj[cateAxisName]), "animationId", updateId)),
childIndex: parseChildIndex(item, props.children),
item
});
}
});
return formattedItems;
};
var updateStateOfAxisMapsOffsetAndStackGroups = function updateStateOfAxisMapsOffsetAndStackGroups2(_ref8, prevState) {
var props = _ref8.props, dataStartIndex = _ref8.dataStartIndex, dataEndIndex = _ref8.dataEndIndex, updateId = _ref8.updateId;
if (!validateWidthHeight({
props
})) {
return null;
}
var children2 = props.children, layout = props.layout, stackOffset = props.stackOffset, data = props.data, reverseStackOrder = props.reverseStackOrder;
var _getAxisNameByLayout2 = getAxisNameByLayout(layout), numericAxisName = _getAxisNameByLayout2.numericAxisName, cateAxisName = _getAxisNameByLayout2.cateAxisName;
var graphicalItems = findAllByType(children2, GraphicalChild);
var stackGroups = getStackGroupsByAxisId(data, graphicalItems, "".concat(numericAxisName, "Id"), "".concat(cateAxisName, "Id"), stackOffset, reverseStackOrder);
var axisObj = axisComponents.reduce(function(result, entry) {
var name = "".concat(entry.axisType, "Map");
return _objectSpread46(_objectSpread46({}, result), {}, _defineProperty52({}, name, getAxisMap(props, _objectSpread46(_objectSpread46({}, entry), {}, {
graphicalItems,
stackGroups: entry.axisType === numericAxisName && stackGroups,
dataStartIndex,
dataEndIndex
}))));
}, {});
var offset = calculateOffset(_objectSpread46(_objectSpread46({}, axisObj), {}, {
props,
graphicalItems
}), prevState === null || prevState === void 0 ? void 0 : prevState.legendBBox);
Object.keys(axisObj).forEach(function(key) {
axisObj[key] = formatAxisMap5(props, axisObj[key], offset, key.replace("Map", ""), chartName);
});
var cateAxisMap = axisObj["".concat(cateAxisName, "Map")];
var ticksObj = tooltipTicksGenerator(cateAxisMap);
var formattedGraphicalItems = getFormatItems(props, _objectSpread46(_objectSpread46({}, axisObj), {}, {
dataStartIndex,
dataEndIndex,
updateId,
graphicalItems,
stackGroups,
offset
}));
return _objectSpread46(_objectSpread46({
formattedGraphicalItems,
graphicalItems,
offset,
stackGroups
}, ticksObj), axisObj);
};
var CategoricalChartWrapper = function(_Component) {
function CategoricalChartWrapper2(_props) {
var _props$id, _props$throttleDelay;
var _this;
_classCallCheck28(this, CategoricalChartWrapper2);
_this = _callSuper23(this, CategoricalChartWrapper2, [_props]);
_defineProperty52(_this, "eventEmitterSymbol", Symbol("rechartsEventEmitter"));
_defineProperty52(_this, "accessibilityManager", new AccessibilityManager());
_defineProperty52(_this, "handleLegendBBoxUpdate", function(box) {
if (box) {
var _this$state = _this.state, dataStartIndex = _this$state.dataStartIndex, dataEndIndex = _this$state.dataEndIndex, updateId = _this$state.updateId;
_this.setState(_objectSpread46({
legendBBox: box
}, updateStateOfAxisMapsOffsetAndStackGroups({
props: _this.props,
dataStartIndex,
dataEndIndex,
updateId
}, _objectSpread46(_objectSpread46({}, _this.state), {}, {
legendBBox: box
}))));
}
});
_defineProperty52(_this, "handleReceiveSyncEvent", function(cId, data, emitter) {
if (_this.props.syncId === cId) {
if (emitter === _this.eventEmitterSymbol && typeof _this.props.syncMethod !== "function") {
return;
}
_this.applySyncEvent(data);
}
});
_defineProperty52(_this, "handleBrushChange", function(_ref9) {
var startIndex = _ref9.startIndex, endIndex = _ref9.endIndex;
if (startIndex !== _this.state.dataStartIndex || endIndex !== _this.state.dataEndIndex) {
var updateId = _this.state.updateId;
_this.setState(function() {
return _objectSpread46({
dataStartIndex: startIndex,
dataEndIndex: endIndex
}, updateStateOfAxisMapsOffsetAndStackGroups({
props: _this.props,
dataStartIndex: startIndex,
dataEndIndex: endIndex,
updateId
}, _this.state));
});
_this.triggerSyncEvent({
dataStartIndex: startIndex,
dataEndIndex: endIndex
});
}
});
_defineProperty52(_this, "handleMouseEnter", function(e) {
var mouse = _this.getMouseInfo(e);
if (mouse) {
var _nextState = _objectSpread46(_objectSpread46({}, mouse), {}, {
isTooltipActive: true
});
_this.setState(_nextState);
_this.triggerSyncEvent(_nextState);
var onMouseEnter = _this.props.onMouseEnter;
if ((0, import_isFunction26.default)(onMouseEnter)) {
onMouseEnter(_nextState, e);
}
}
});
_defineProperty52(_this, "triggeredAfterMouseMove", function(e) {
var mouse = _this.getMouseInfo(e);
var nextState = mouse ? _objectSpread46(_objectSpread46({}, mouse), {}, {
isTooltipActive: true
}) : {
isTooltipActive: false
};
_this.setState(nextState);
_this.triggerSyncEvent(nextState);
var onMouseMove = _this.props.onMouseMove;
if ((0, import_isFunction26.default)(onMouseMove)) {
onMouseMove(nextState, e);
}
});
_defineProperty52(_this, "handleItemMouseEnter", function(el) {
_this.setState(function() {
return {
isTooltipActive: true,
activeItem: el,
activePayload: el.tooltipPayload,
activeCoordinate: el.tooltipPosition || {
x: el.cx,
y: el.cy
}
};
});
});
_defineProperty52(_this, "handleItemMouseLeave", function() {
_this.setState(function() {
return {
isTooltipActive: false
};
});
});
_defineProperty52(_this, "handleMouseMove", function(e) {
e.persist();
_this.throttleTriggeredAfterMouseMove(e);
});
_defineProperty52(_this, "handleMouseLeave", function(e) {
_this.throttleTriggeredAfterMouseMove.cancel();
var nextState = {
isTooltipActive: false
};
_this.setState(nextState);
_this.triggerSyncEvent(nextState);
var onMouseLeave = _this.props.onMouseLeave;
if ((0, import_isFunction26.default)(onMouseLeave)) {
onMouseLeave(nextState, e);
}
});
_defineProperty52(_this, "handleOuterEvent", function(e) {
var eventName = getReactEventByType(e);
var event = (0, import_get6.default)(_this.props, "".concat(eventName));
if (eventName && (0, import_isFunction26.default)(event)) {
var _mouse;
var mouse;
if (/.*touch.*/i.test(eventName)) {
mouse = _this.getMouseInfo(e.changedTouches[0]);
} else {
mouse = _this.getMouseInfo(e);
}
event((_mouse = mouse) !== null && _mouse !== void 0 ? _mouse : {}, e);
}
});
_defineProperty52(_this, "handleClick", function(e) {
var mouse = _this.getMouseInfo(e);
if (mouse) {
var _nextState2 = _objectSpread46(_objectSpread46({}, mouse), {}, {
isTooltipActive: true
});
_this.setState(_nextState2);
_this.triggerSyncEvent(_nextState2);
var onClick = _this.props.onClick;
if ((0, import_isFunction26.default)(onClick)) {
onClick(_nextState2, e);
}
}
});
_defineProperty52(_this, "handleMouseDown", function(e) {
var onMouseDown = _this.props.onMouseDown;
if ((0, import_isFunction26.default)(onMouseDown)) {
var _nextState3 = _this.getMouseInfo(e);
onMouseDown(_nextState3, e);
}
});
_defineProperty52(_this, "handleMouseUp", function(e) {
var onMouseUp = _this.props.onMouseUp;
if ((0, import_isFunction26.default)(onMouseUp)) {
var _nextState4 = _this.getMouseInfo(e);
onMouseUp(_nextState4, e);
}
});
_defineProperty52(_this, "handleTouchMove", function(e) {
if (e.changedTouches != null && e.changedTouches.length > 0) {
_this.throttleTriggeredAfterMouseMove(e.changedTouches[0]);
}
});
_defineProperty52(_this, "handleTouchStart", function(e) {
if (e.changedTouches != null && e.changedTouches.length > 0) {
_this.handleMouseDown(e.changedTouches[0]);
}
});
_defineProperty52(_this, "handleTouchEnd", function(e) {
if (e.changedTouches != null && e.changedTouches.length > 0) {
_this.handleMouseUp(e.changedTouches[0]);
}
});
_defineProperty52(_this, "handleDoubleClick", function(e) {
var onDoubleClick = _this.props.onDoubleClick;
if ((0, import_isFunction26.default)(onDoubleClick)) {
var _nextState5 = _this.getMouseInfo(e);
onDoubleClick(_nextState5, e);
}
});
_defineProperty52(_this, "handleContextMenu", function(e) {
var onContextMenu = _this.props.onContextMenu;
if ((0, import_isFunction26.default)(onContextMenu)) {
var _nextState6 = _this.getMouseInfo(e);
onContextMenu(_nextState6, e);
}
});
_defineProperty52(_this, "triggerSyncEvent", function(data) {
if (_this.props.syncId !== void 0) {
eventCenter.emit(SYNC_EVENT, _this.props.syncId, data, _this.eventEmitterSymbol);
}
});
_defineProperty52(_this, "applySyncEvent", function(data) {
var _this$props = _this.props, layout = _this$props.layout, syncMethod = _this$props.syncMethod;
var updateId = _this.state.updateId;
var dataStartIndex = data.dataStartIndex, dataEndIndex = data.dataEndIndex;
if (data.dataStartIndex !== void 0 || data.dataEndIndex !== void 0) {
_this.setState(_objectSpread46({
dataStartIndex,
dataEndIndex
}, updateStateOfAxisMapsOffsetAndStackGroups({
props: _this.props,
dataStartIndex,
dataEndIndex,
updateId
}, _this.state)));
} else if (data.activeTooltipIndex !== void 0) {
var chartX = data.chartX, chartY = data.chartY;
var activeTooltipIndex = data.activeTooltipIndex;
var _this$state2 = _this.state, offset = _this$state2.offset, tooltipTicks = _this$state2.tooltipTicks;
if (!offset) {
return;
}
if (typeof syncMethod === "function") {
activeTooltipIndex = syncMethod(tooltipTicks, data);
} else if (syncMethod === "value") {
activeTooltipIndex = -1;
for (var i = 0; i < tooltipTicks.length; i++) {
if (tooltipTicks[i].value === data.activeLabel) {
activeTooltipIndex = i;
break;
}
}
}
var viewBox = _objectSpread46(_objectSpread46({}, offset), {}, {
x: offset.left,
y: offset.top
});
var validateChartX = Math.min(chartX, viewBox.x + viewBox.width);
var validateChartY = Math.min(chartY, viewBox.y + viewBox.height);
var activeLabel = tooltipTicks[activeTooltipIndex] && tooltipTicks[activeTooltipIndex].value;
var activePayload = getTooltipContent(_this.state, _this.props.data, activeTooltipIndex);
var activeCoordinate = tooltipTicks[activeTooltipIndex] ? {
x: layout === "horizontal" ? tooltipTicks[activeTooltipIndex].coordinate : validateChartX,
y: layout === "horizontal" ? validateChartY : tooltipTicks[activeTooltipIndex].coordinate
} : originCoordinate;
_this.setState(_objectSpread46(_objectSpread46({}, data), {}, {
activeLabel,
activeCoordinate,
activePayload,
activeTooltipIndex
}));
} else {
_this.setState(data);
}
});
_defineProperty52(_this, "renderCursor", function(element) {
var _element$props$active;
var _this$state3 = _this.state, isTooltipActive = _this$state3.isTooltipActive, activeCoordinate = _this$state3.activeCoordinate, activePayload = _this$state3.activePayload, offset = _this$state3.offset, activeTooltipIndex = _this$state3.activeTooltipIndex, tooltipAxisBandSize = _this$state3.tooltipAxisBandSize;
var tooltipEventType = _this.getTooltipEventType();
var isActive = (_element$props$active = element.props.active) !== null && _element$props$active !== void 0 ? _element$props$active : isTooltipActive;
var layout = _this.props.layout;
var key = element.key || "_recharts-cursor";
return import_react60.default.createElement(Cursor, {
key,
activeCoordinate,
activePayload,
activeTooltipIndex,
chartName,
element,
isActive,
layout,
offset,
tooltipAxisBandSize,
tooltipEventType
});
});
_defineProperty52(_this, "renderPolarAxis", function(element, displayName, index3) {
var axisType = (0, import_get6.default)(element, "type.axisType");
var axisMap = (0, import_get6.default)(_this.state, "".concat(axisType, "Map"));
var elementDefaultProps = element.type.defaultProps;
var elementProps = elementDefaultProps !== void 0 ? _objectSpread46(_objectSpread46({}, elementDefaultProps), element.props) : element.props;
var axisOption = axisMap && axisMap[elementProps["".concat(axisType, "Id")]];
return (0, import_react60.cloneElement)(element, _objectSpread46(_objectSpread46({}, axisOption), {}, {
className: clsx_default(axisType, axisOption.className),
key: element.key || "".concat(displayName, "-").concat(index3),
ticks: getTicksOfAxis(axisOption, true)
}));
});
_defineProperty52(_this, "renderPolarGrid", function(element) {
var _element$props = element.props, radialLines = _element$props.radialLines, polarAngles = _element$props.polarAngles, polarRadius = _element$props.polarRadius;
var _this$state4 = _this.state, radiusAxisMap = _this$state4.radiusAxisMap, angleAxisMap = _this$state4.angleAxisMap;
var radiusAxis = getAnyElementOfObject(radiusAxisMap);
var angleAxis = getAnyElementOfObject(angleAxisMap);
var cx = angleAxis.cx, cy = angleAxis.cy, innerRadius = angleAxis.innerRadius, outerRadius = angleAxis.outerRadius;
return (0, import_react60.cloneElement)(element, {
polarAngles: Array.isArray(polarAngles) ? polarAngles : getTicksOfAxis(angleAxis, true).map(function(entry) {
return entry.coordinate;
}),
polarRadius: Array.isArray(polarRadius) ? polarRadius : getTicksOfAxis(radiusAxis, true).map(function(entry) {
return entry.coordinate;
}),
cx,
cy,
innerRadius,
outerRadius,
key: element.key || "polar-grid",
radialLines
});
});
_defineProperty52(_this, "renderLegend", function() {
var formattedGraphicalItems = _this.state.formattedGraphicalItems;
var _this$props2 = _this.props, children2 = _this$props2.children, width = _this$props2.width, height = _this$props2.height;
var margin = _this.props.margin || {};
var legendWidth = width - (margin.left || 0) - (margin.right || 0);
var props = getLegendProps({
children: children2,
formattedGraphicalItems,
legendWidth,
legendContent
});
if (!props) {
return null;
}
var item = props.item, otherProps = _objectWithoutProperties27(props, _excluded34);
return (0, import_react60.cloneElement)(item, _objectSpread46(_objectSpread46({}, otherProps), {}, {
chartWidth: width,
chartHeight: height,
margin,
onBBoxUpdate: _this.handleLegendBBoxUpdate
}));
});
_defineProperty52(_this, "renderTooltip", function() {
var _tooltipItem$props$ac;
var _this$props3 = _this.props, children2 = _this$props3.children, accessibilityLayer = _this$props3.accessibilityLayer;
var tooltipItem = findChildByType(children2, Tooltip);
if (!tooltipItem) {
return null;
}
var _this$state5 = _this.state, isTooltipActive = _this$state5.isTooltipActive, activeCoordinate = _this$state5.activeCoordinate, activePayload = _this$state5.activePayload, activeLabel = _this$state5.activeLabel, offset = _this$state5.offset;
var isActive = (_tooltipItem$props$ac = tooltipItem.props.active) !== null && _tooltipItem$props$ac !== void 0 ? _tooltipItem$props$ac : isTooltipActive;
return (0, import_react60.cloneElement)(tooltipItem, {
viewBox: _objectSpread46(_objectSpread46({}, offset), {}, {
x: offset.left,
y: offset.top
}),
active: isActive,
label: activeLabel,
payload: isActive ? activePayload : [],
coordinate: activeCoordinate,
accessibilityLayer
});
});
_defineProperty52(_this, "renderBrush", function(element) {
var _this$props4 = _this.props, margin = _this$props4.margin, data = _this$props4.data;
var _this$state6 = _this.state, offset = _this$state6.offset, dataStartIndex = _this$state6.dataStartIndex, dataEndIndex = _this$state6.dataEndIndex, updateId = _this$state6.updateId;
return (0, import_react60.cloneElement)(element, {
key: element.key || "_recharts-brush",
onChange: combineEventHandlers(_this.handleBrushChange, element.props.onChange),
data,
x: isNumber(element.props.x) ? element.props.x : offset.left,
y: isNumber(element.props.y) ? element.props.y : offset.top + offset.height + offset.brushBottom - (margin.bottom || 0),
width: isNumber(element.props.width) ? element.props.width : offset.width,
startIndex: dataStartIndex,
endIndex: dataEndIndex,
updateId: "brush-".concat(updateId)
});
});
_defineProperty52(_this, "renderReferenceElement", function(element, displayName, index3) {
if (!element) {
return null;
}
var _this2 = _this, clipPathId = _this2.clipPathId;
var _this$state7 = _this.state, xAxisMap = _this$state7.xAxisMap, yAxisMap = _this$state7.yAxisMap, offset = _this$state7.offset;
var elementDefaultProps = element.type.defaultProps || {};
var _element$props2 = element.props, _element$props2$xAxis = _element$props2.xAxisId, xAxisId = _element$props2$xAxis === void 0 ? elementDefaultProps.xAxisId : _element$props2$xAxis, _element$props2$yAxis = _element$props2.yAxisId, yAxisId = _element$props2$yAxis === void 0 ? elementDefaultProps.yAxisId : _element$props2$yAxis;
return (0, import_react60.cloneElement)(element, {
key: element.key || "".concat(displayName, "-").concat(index3),
xAxis: xAxisMap[xAxisId],
yAxis: yAxisMap[yAxisId],
viewBox: {
x: offset.left,
y: offset.top,
width: offset.width,
height: offset.height
},
clipPathId
});
});
_defineProperty52(_this, "renderActivePoints", function(_ref10) {
var item = _ref10.item, activePoint = _ref10.activePoint, basePoint = _ref10.basePoint, childIndex = _ref10.childIndex, isRange = _ref10.isRange;
var result = [];
var key = item.props.key;
var itemItemProps = item.item.type.defaultProps !== void 0 ? _objectSpread46(_objectSpread46({}, item.item.type.defaultProps), item.item.props) : item.item.props;
var activeDot = itemItemProps.activeDot, dataKey = itemItemProps.dataKey;
var dotProps = _objectSpread46(_objectSpread46({
index: childIndex,
dataKey,
cx: activePoint.x,
cy: activePoint.y,
r: 4,
fill: getMainColorOfGraphicItem(item.item),
strokeWidth: 2,
stroke: "#fff",
payload: activePoint.payload,
value: activePoint.value
}, filterProps(activeDot, false)), adaptEventHandlers(activeDot));
result.push(CategoricalChartWrapper2.renderActiveDot(activeDot, dotProps, "".concat(key, "-activePoint-").concat(childIndex)));
if (basePoint) {
result.push(CategoricalChartWrapper2.renderActiveDot(activeDot, _objectSpread46(_objectSpread46({}, dotProps), {}, {
cx: basePoint.x,
cy: basePoint.y
}), "".concat(key, "-basePoint-").concat(childIndex)));
} else if (isRange) {
result.push(null);
}
return result;
});
_defineProperty52(_this, "renderGraphicChild", function(element, displayName, index3) {
var item = _this.filterFormatItem(element, displayName, index3);
if (!item) {
return null;
}
var tooltipEventType = _this.getTooltipEventType();
var _this$state8 = _this.state, isTooltipActive = _this$state8.isTooltipActive, tooltipAxis = _this$state8.tooltipAxis, activeTooltipIndex = _this$state8.activeTooltipIndex, activeLabel = _this$state8.activeLabel;
var children2 = _this.props.children;
var tooltipItem = findChildByType(children2, Tooltip);
var _item$props = item.props, points = _item$props.points, isRange = _item$props.isRange, baseLine = _item$props.baseLine;
var itemItemProps = item.item.type.defaultProps !== void 0 ? _objectSpread46(_objectSpread46({}, item.item.type.defaultProps), item.item.props) : item.item.props;
var activeDot = itemItemProps.activeDot, hide = itemItemProps.hide, activeBar = itemItemProps.activeBar, activeShape = itemItemProps.activeShape;
var hasActive = Boolean(!hide && isTooltipActive && tooltipItem && (activeDot || activeBar || activeShape));
var itemEvents = {};
if (tooltipEventType !== "axis" && tooltipItem && tooltipItem.props.trigger === "click") {
itemEvents = {
onClick: combineEventHandlers(_this.handleItemMouseEnter, element.props.onClick)
};
} else if (tooltipEventType !== "axis") {
itemEvents = {
onMouseLeave: combineEventHandlers(_this.handleItemMouseLeave, element.props.onMouseLeave),
onMouseEnter: combineEventHandlers(_this.handleItemMouseEnter, element.props.onMouseEnter)
};
}
var graphicalItem = (0, import_react60.cloneElement)(element, _objectSpread46(_objectSpread46({}, item.props), itemEvents));
function findWithPayload(entry) {
return typeof tooltipAxis.dataKey === "function" ? tooltipAxis.dataKey(entry.payload) : null;
}
if (hasActive) {
if (activeTooltipIndex >= 0) {
var activePoint, basePoint;
if (tooltipAxis.dataKey && !tooltipAxis.allowDuplicatedCategory) {
var specifiedKey = typeof tooltipAxis.dataKey === "function" ? findWithPayload : "payload.".concat(tooltipAxis.dataKey.toString());
activePoint = findEntryInArray(points, specifiedKey, activeLabel);
basePoint = isRange && baseLine && findEntryInArray(baseLine, specifiedKey, activeLabel);
} else {
activePoint = points === null || points === void 0 ? void 0 : points[activeTooltipIndex];
basePoint = isRange && baseLine && baseLine[activeTooltipIndex];
}
if (activeShape || activeBar) {
var activeIndex = element.props.activeIndex !== void 0 ? element.props.activeIndex : activeTooltipIndex;
return [(0, import_react60.cloneElement)(element, _objectSpread46(_objectSpread46(_objectSpread46({}, item.props), itemEvents), {}, {
activeIndex
})), null, null];
}
if (!(0, import_isNil14.default)(activePoint)) {
return [graphicalItem].concat(_toConsumableArray12(_this.renderActivePoints({
item,
activePoint,
basePoint,
childIndex: activeTooltipIndex,
isRange
})));
}
} else {
var _this$getItemByXY;
var _ref11 = (_this$getItemByXY = _this.getItemByXY(_this.state.activeCoordinate)) !== null && _this$getItemByXY !== void 0 ? _this$getItemByXY : {
graphicalItem
}, _ref11$graphicalItem = _ref11.graphicalItem, _ref11$graphicalItem$ = _ref11$graphicalItem.item, xyItem = _ref11$graphicalItem$ === void 0 ? element : _ref11$graphicalItem$, childIndex = _ref11$graphicalItem.childIndex;
var elementProps = _objectSpread46(_objectSpread46(_objectSpread46({}, item.props), itemEvents), {}, {
activeIndex: childIndex
});
return [(0, import_react60.cloneElement)(xyItem, elementProps), null, null];
}
}
if (isRange) {
return [graphicalItem, null, null];
}
return [graphicalItem, null];
});
_defineProperty52(_this, "renderCustomized", function(element, displayName, index3) {
return (0, import_react60.cloneElement)(element, _objectSpread46(_objectSpread46({
key: "recharts-customized-".concat(index3)
}, _this.props), _this.state));
});
_defineProperty52(_this, "renderMap", {
CartesianGrid: {
handler: renderAsIs,
once: true
},
ReferenceArea: {
handler: _this.renderReferenceElement
},
ReferenceLine: {
handler: renderAsIs
},
ReferenceDot: {
handler: _this.renderReferenceElement
},
XAxis: {
handler: renderAsIs
},
YAxis: {
handler: renderAsIs
},
Brush: {
handler: _this.renderBrush,
once: true
},
Bar: {
handler: _this.renderGraphicChild
},
Line: {
handler: _this.renderGraphicChild
},
Area: {
handler: _this.renderGraphicChild
},
Radar: {
handler: _this.renderGraphicChild
},
RadialBar: {
handler: _this.renderGraphicChild
},
Scatter: {
handler: _this.renderGraphicChild
},
Pie: {
handler: _this.renderGraphicChild
},
Funnel: {
handler: _this.renderGraphicChild
},
Tooltip: {
handler: _this.renderCursor,
once: true
},
PolarGrid: {
handler: _this.renderPolarGrid,
once: true
},
PolarAngleAxis: {
handler: _this.renderPolarAxis
},
PolarRadiusAxis: {
handler: _this.renderPolarAxis
},
Customized: {
handler: _this.renderCustomized
}
});
_this.clipPathId = "".concat((_props$id = _props.id) !== null && _props$id !== void 0 ? _props$id : uniqueId("recharts"), "-clip");
_this.throttleTriggeredAfterMouseMove = (0, import_throttle2.default)(_this.triggeredAfterMouseMove, (_props$throttleDelay = _props.throttleDelay) !== null && _props$throttleDelay !== void 0 ? _props$throttleDelay : 1e3 / 60);
_this.state = {};
return _this;
}
_inherits25(CategoricalChartWrapper2, _Component);
return _createClass28(CategoricalChartWrapper2, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this$props$margin$le, _this$props$margin$to;
this.addListener();
this.accessibilityManager.setDetails({
container: this.container,
offset: {
left: (_this$props$margin$le = this.props.margin.left) !== null && _this$props$margin$le !== void 0 ? _this$props$margin$le : 0,
top: (_this$props$margin$to = this.props.margin.top) !== null && _this$props$margin$to !== void 0 ? _this$props$margin$to : 0
},
coordinateList: this.state.tooltipTicks,
mouseHandlerCallback: this.triggeredAfterMouseMove,
layout: this.props.layout
});
this.displayDefaultTooltip();
}
}, {
key: "displayDefaultTooltip",
value: function displayDefaultTooltip() {
var _this$props5 = this.props, children2 = _this$props5.children, data = _this$props5.data, height = _this$props5.height, layout = _this$props5.layout;
var tooltipElem = findChildByType(children2, Tooltip);
if (!tooltipElem) {
return;
}
var defaultIndex = tooltipElem.props.defaultIndex;
if (typeof defaultIndex !== "number" || defaultIndex < 0 || defaultIndex > this.state.tooltipTicks.length - 1) {
return;
}
var activeLabel = this.state.tooltipTicks[defaultIndex] && this.state.tooltipTicks[defaultIndex].value;
var activePayload = getTooltipContent(this.state, data, defaultIndex, activeLabel);
var independentAxisCoord = this.state.tooltipTicks[defaultIndex].coordinate;
var dependentAxisCoord = (this.state.offset.top + height) / 2;
var isHorizontal = layout === "horizontal";
var activeCoordinate = isHorizontal ? {
x: independentAxisCoord,
y: dependentAxisCoord
} : {
y: independentAxisCoord,
x: dependentAxisCoord
};
var scatterPlotElement = this.state.formattedGraphicalItems.find(function(_ref12) {
var item = _ref12.item;
return item.type.name === "Scatter";
});
if (scatterPlotElement) {
activeCoordinate = _objectSpread46(_objectSpread46({}, activeCoordinate), scatterPlotElement.props.points[defaultIndex].tooltipPosition);
activePayload = scatterPlotElement.props.points[defaultIndex].tooltipPayload;
}
var nextState = {
activeTooltipIndex: defaultIndex,
isTooltipActive: true,
activeLabel,
activePayload,
activeCoordinate
};
this.setState(nextState);
this.renderCursor(tooltipElem);
this.accessibilityManager.setIndex(defaultIndex);
}
}, {
key: "getSnapshotBeforeUpdate",
value: function getSnapshotBeforeUpdate(prevProps, prevState) {
if (!this.props.accessibilityLayer) {
return null;
}
if (this.state.tooltipTicks !== prevState.tooltipTicks) {
this.accessibilityManager.setDetails({
coordinateList: this.state.tooltipTicks
});
}
if (this.props.layout !== prevProps.layout) {
this.accessibilityManager.setDetails({
layout: this.props.layout
});
}
if (this.props.margin !== prevProps.margin) {
var _this$props$margin$le2, _this$props$margin$to2;
this.accessibilityManager.setDetails({
offset: {
left: (_this$props$margin$le2 = this.props.margin.left) !== null && _this$props$margin$le2 !== void 0 ? _this$props$margin$le2 : 0,
top: (_this$props$margin$to2 = this.props.margin.top) !== null && _this$props$margin$to2 !== void 0 ? _this$props$margin$to2 : 0
}
});
}
return null;
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (!isChildrenEqual([findChildByType(prevProps.children, Tooltip)], [findChildByType(this.props.children, Tooltip)])) {
this.displayDefaultTooltip();
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.removeListener();
this.throttleTriggeredAfterMouseMove.cancel();
}
}, {
key: "getTooltipEventType",
value: function getTooltipEventType() {
var tooltipItem = findChildByType(this.props.children, Tooltip);
if (tooltipItem && typeof tooltipItem.props.shared === "boolean") {
var eventType = tooltipItem.props.shared ? "axis" : "item";
return validateTooltipEventTypes.indexOf(eventType) >= 0 ? eventType : defaultTooltipEventType;
}
return defaultTooltipEventType;
}
/**
* Get the information of mouse in chart, return null when the mouse is not in the chart
* @param {MousePointer} event The event object
* @return {Object} Mouse data
*/
}, {
key: "getMouseInfo",
value: function getMouseInfo(event) {
if (!this.container) {
return null;
}
var element = this.container;
var boundingRect = element.getBoundingClientRect();
var containerOffset = getOffset(boundingRect);
var e = {
chartX: Math.round(event.pageX - containerOffset.left),
chartY: Math.round(event.pageY - containerOffset.top)
};
var scale = boundingRect.width / element.offsetWidth || 1;
var rangeObj = this.inRange(e.chartX, e.chartY, scale);
if (!rangeObj) {
return null;
}
var _this$state9 = this.state, xAxisMap = _this$state9.xAxisMap, yAxisMap = _this$state9.yAxisMap;
var tooltipEventType = this.getTooltipEventType();
if (tooltipEventType !== "axis" && xAxisMap && yAxisMap) {
var xScale = getAnyElementOfObject(xAxisMap).scale;
var yScale = getAnyElementOfObject(yAxisMap).scale;
var xValue = xScale && xScale.invert ? xScale.invert(e.chartX) : null;
var yValue = yScale && yScale.invert ? yScale.invert(e.chartY) : null;
return _objectSpread46(_objectSpread46({}, e), {}, {
xValue,
yValue
});
}
var toolTipData = getTooltipData(this.state, this.props.data, this.props.layout, rangeObj);
if (toolTipData) {
return _objectSpread46(_objectSpread46({}, e), toolTipData);
}
return null;
}
}, {
key: "inRange",
value: function inRange(x2, y2) {
var scale = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
var layout = this.props.layout;
var scaledX = x2 / scale, scaledY = y2 / scale;
if (layout === "horizontal" || layout === "vertical") {
var offset = this.state.offset;
var isInRange = scaledX >= offset.left && scaledX <= offset.left + offset.width && scaledY >= offset.top && scaledY <= offset.top + offset.height;
return isInRange ? {
x: scaledX,
y: scaledY
} : null;
}
var _this$state10 = this.state, angleAxisMap = _this$state10.angleAxisMap, radiusAxisMap = _this$state10.radiusAxisMap;
if (angleAxisMap && radiusAxisMap) {
var angleAxis = getAnyElementOfObject(angleAxisMap);
return inRangeOfSector({
x: scaledX,
y: scaledY
}, angleAxis);
}
return null;
}
}, {
key: "parseEventsOfWrapper",
value: function parseEventsOfWrapper() {
var children2 = this.props.children;
var tooltipEventType = this.getTooltipEventType();
var tooltipItem = findChildByType(children2, Tooltip);
var tooltipEvents = {};
if (tooltipItem && tooltipEventType === "axis") {
if (tooltipItem.props.trigger === "click") {
tooltipEvents = {
onClick: this.handleClick
};
} else {
tooltipEvents = {
onMouseEnter: this.handleMouseEnter,
onDoubleClick: this.handleDoubleClick,
onMouseMove: this.handleMouseMove,
onMouseLeave: this.handleMouseLeave,
onTouchMove: this.handleTouchMove,
onTouchStart: this.handleTouchStart,
onTouchEnd: this.handleTouchEnd,
onContextMenu: this.handleContextMenu
};
}
}
var outerEvents = adaptEventHandlers(this.props, this.handleOuterEvent);
return _objectSpread46(_objectSpread46({}, outerEvents), tooltipEvents);
}
}, {
key: "addListener",
value: function addListener() {
eventCenter.on(SYNC_EVENT, this.handleReceiveSyncEvent);
}
}, {
key: "removeListener",
value: function removeListener() {
eventCenter.removeListener(SYNC_EVENT, this.handleReceiveSyncEvent);
}
}, {
key: "filterFormatItem",
value: function filterFormatItem(item, displayName, childIndex) {
var formattedGraphicalItems = this.state.formattedGraphicalItems;
for (var i = 0, len = formattedGraphicalItems.length; i < len; i++) {
var entry = formattedGraphicalItems[i];
if (entry.item === item || entry.props.key === item.key || displayName === getDisplayName(entry.item.type) && childIndex === entry.childIndex) {
return entry;
}
}
return null;
}
}, {
key: "renderClipPath",
value: function renderClipPath() {
var clipPathId = this.clipPathId;
var _this$state$offset = this.state.offset, left = _this$state$offset.left, top = _this$state$offset.top, height = _this$state$offset.height, width = _this$state$offset.width;
return import_react60.default.createElement("defs", null, import_react60.default.createElement("clipPath", {
id: clipPathId
}, import_react60.default.createElement("rect", {
x: left,
y: top,
height,
width
})));
}
}, {
key: "getXScales",
value: function getXScales() {
var xAxisMap = this.state.xAxisMap;
return xAxisMap ? Object.entries(xAxisMap).reduce(function(res, _ref13) {
var _ref14 = _slicedToArray13(_ref13, 2), axisId = _ref14[0], axisProps = _ref14[1];
return _objectSpread46(_objectSpread46({}, res), {}, _defineProperty52({}, axisId, axisProps.scale));
}, {}) : null;
}
}, {
key: "getYScales",
value: function getYScales() {
var yAxisMap = this.state.yAxisMap;
return yAxisMap ? Object.entries(yAxisMap).reduce(function(res, _ref15) {
var _ref16 = _slicedToArray13(_ref15, 2), axisId = _ref16[0], axisProps = _ref16[1];
return _objectSpread46(_objectSpread46({}, res), {}, _defineProperty52({}, axisId, axisProps.scale));
}, {}) : null;
}
}, {
key: "getXScaleByAxisId",
value: function getXScaleByAxisId(axisId) {
var _this$state$xAxisMap;
return (_this$state$xAxisMap = this.state.xAxisMap) === null || _this$state$xAxisMap === void 0 || (_this$state$xAxisMap = _this$state$xAxisMap[axisId]) === null || _this$state$xAxisMap === void 0 ? void 0 : _this$state$xAxisMap.scale;
}
}, {
key: "getYScaleByAxisId",
value: function getYScaleByAxisId(axisId) {
var _this$state$yAxisMap;
return (_this$state$yAxisMap = this.state.yAxisMap) === null || _this$state$yAxisMap === void 0 || (_this$state$yAxisMap = _this$state$yAxisMap[axisId]) === null || _this$state$yAxisMap === void 0 ? void 0 : _this$state$yAxisMap.scale;
}
}, {
key: "getItemByXY",
value: function getItemByXY(chartXY) {
var _this$state11 = this.state, formattedGraphicalItems = _this$state11.formattedGraphicalItems, activeItem = _this$state11.activeItem;
if (formattedGraphicalItems && formattedGraphicalItems.length) {
for (var i = 0, len = formattedGraphicalItems.length; i < len; i++) {
var graphicalItem = formattedGraphicalItems[i];
var props = graphicalItem.props, item = graphicalItem.item;
var itemProps = item.type.defaultProps !== void 0 ? _objectSpread46(_objectSpread46({}, item.type.defaultProps), item.props) : item.props;
var itemDisplayName = getDisplayName(item.type);
if (itemDisplayName === "Bar") {
var activeBarItem = (props.data || []).find(function(entry) {
return isInRectangle(chartXY, entry);
});
if (activeBarItem) {
return {
graphicalItem,
payload: activeBarItem
};
}
} else if (itemDisplayName === "RadialBar") {
var _activeBarItem = (props.data || []).find(function(entry) {
return inRangeOfSector(chartXY, entry);
});
if (_activeBarItem) {
return {
graphicalItem,
payload: _activeBarItem
};
}
} else if (isFunnel(graphicalItem, activeItem) || isPie(graphicalItem, activeItem) || isScatter(graphicalItem, activeItem)) {
var activeIndex = getActiveShapeIndexForTooltip({
graphicalItem,
activeTooltipItem: activeItem,
itemData: itemProps.data
});
var childIndex = itemProps.activeIndex === void 0 ? activeIndex : itemProps.activeIndex;
return {
graphicalItem: _objectSpread46(_objectSpread46({}, graphicalItem), {}, {
childIndex
}),
payload: isScatter(graphicalItem, activeItem) ? itemProps.data[activeIndex] : graphicalItem.props.data[activeIndex]
};
}
}
}
return null;
}
}, {
key: "render",
value: function render() {
var _this3 = this;
if (!validateWidthHeight(this)) {
return null;
}
var _this$props6 = this.props, children2 = _this$props6.children, className = _this$props6.className, width = _this$props6.width, height = _this$props6.height, style = _this$props6.style, compact = _this$props6.compact, title = _this$props6.title, desc = _this$props6.desc, others = _objectWithoutProperties27(_this$props6, _excluded213);
var attrs = filterProps(others, false);
if (compact) {
return import_react60.default.createElement(ChartLayoutContextProvider, {
state: this.state,
width: this.props.width,
height: this.props.height,
clipPathId: this.clipPathId
}, import_react60.default.createElement(Surface, _extends40({}, attrs, {
width,
height,
title,
desc
}), this.renderClipPath(), renderByOrder(children2, this.renderMap)));
}
if (this.props.accessibilityLayer) {
var _this$props$tabIndex, _this$props$role;
attrs.tabIndex = (_this$props$tabIndex = this.props.tabIndex) !== null && _this$props$tabIndex !== void 0 ? _this$props$tabIndex : 0;
attrs.role = (_this$props$role = this.props.role) !== null && _this$props$role !== void 0 ? _this$props$role : "application";
attrs.onKeyDown = function(e) {
_this3.accessibilityManager.keyboardEvent(e);
};
attrs.onFocus = function() {
_this3.accessibilityManager.focus();
};
}
var events = this.parseEventsOfWrapper();
return import_react60.default.createElement(ChartLayoutContextProvider, {
state: this.state,
width: this.props.width,
height: this.props.height,
clipPathId: this.clipPathId
}, import_react60.default.createElement("div", _extends40({
className: clsx_default("recharts-wrapper", className),
style: _objectSpread46({
position: "relative",
cursor: "default",
width,
height
}, style)
}, events, {
ref: function ref(node) {
_this3.container = node;
}
}), import_react60.default.createElement(Surface, _extends40({}, attrs, {
width,
height,
title,
desc,
style: FULL_WIDTH_AND_HEIGHT
}), this.renderClipPath(), renderByOrder(children2, this.renderMap)), this.renderLegend(), this.renderTooltip()));
}
}]);
}(import_react60.Component);
_defineProperty52(CategoricalChartWrapper, "displayName", chartName);
_defineProperty52(CategoricalChartWrapper, "defaultProps", _objectSpread46({
layout: "horizontal",
stackOffset: "none",
barCategoryGap: "10%",
barGap: 4,
margin: {
top: 5,
right: 5,
bottom: 5,
left: 5
},
reverseStackOrder: false,
syncMethod: "index"
}, defaultProps6));
_defineProperty52(CategoricalChartWrapper, "getDerivedStateFromProps", function(nextProps, prevState) {
var dataKey = nextProps.dataKey, data = nextProps.data, children2 = nextProps.children, width = nextProps.width, height = nextProps.height, layout = nextProps.layout, stackOffset = nextProps.stackOffset, margin = nextProps.margin;
var dataStartIndex = prevState.dataStartIndex, dataEndIndex = prevState.dataEndIndex;
if (prevState.updateId === void 0) {
var defaultState2 = createDefaultState(nextProps);
return _objectSpread46(_objectSpread46(_objectSpread46({}, defaultState2), {}, {
updateId: 0
}, updateStateOfAxisMapsOffsetAndStackGroups(_objectSpread46(_objectSpread46({
props: nextProps
}, defaultState2), {}, {
updateId: 0
}), prevState)), {}, {
prevDataKey: dataKey,
prevData: data,
prevWidth: width,
prevHeight: height,
prevLayout: layout,
prevStackOffset: stackOffset,
prevMargin: margin,
prevChildren: children2
});
}
if (dataKey !== prevState.prevDataKey || data !== prevState.prevData || width !== prevState.prevWidth || height !== prevState.prevHeight || layout !== prevState.prevLayout || stackOffset !== prevState.prevStackOffset || !shallowEqual(margin, prevState.prevMargin)) {
var _defaultState = createDefaultState(nextProps);
var keepFromPrevState = {
// (chartX, chartY) are (0,0) in default state, but we want to keep the last mouse position to avoid
// any flickering
chartX: prevState.chartX,
chartY: prevState.chartY,
// The tooltip should stay active when it was active in the previous render. If this is not
// the case, the tooltip disappears and immediately re-appears, causing a flickering effect
isTooltipActive: prevState.isTooltipActive
};
var updatesToState = _objectSpread46(_objectSpread46({}, getTooltipData(prevState, data, layout)), {}, {
updateId: prevState.updateId + 1
});
var newState = _objectSpread46(_objectSpread46(_objectSpread46({}, _defaultState), keepFromPrevState), updatesToState);
return _objectSpread46(_objectSpread46(_objectSpread46({}, newState), updateStateOfAxisMapsOffsetAndStackGroups(_objectSpread46({
props: nextProps
}, newState), prevState)), {}, {
prevDataKey: dataKey,
prevData: data,
prevWidth: width,
prevHeight: height,
prevLayout: layout,
prevStackOffset: stackOffset,
prevMargin: margin,
prevChildren: children2
});
}
if (!isChildrenEqual(children2, prevState.prevChildren)) {
var _brush$props$startInd, _brush$props, _brush$props$endIndex, _brush$props2;
var brush = findChildByType(children2, Brush);
var startIndex = brush ? (_brush$props$startInd = (_brush$props = brush.props) === null || _brush$props === void 0 ? void 0 : _brush$props.startIndex) !== null && _brush$props$startInd !== void 0 ? _brush$props$startInd : dataStartIndex : dataStartIndex;
var endIndex = brush ? (_brush$props$endIndex = (_brush$props2 = brush.props) === null || _brush$props2 === void 0 ? void 0 : _brush$props2.endIndex) !== null && _brush$props$endIndex !== void 0 ? _brush$props$endIndex : dataEndIndex : dataEndIndex;
var hasDifferentStartOrEndIndex = startIndex !== dataStartIndex || endIndex !== dataEndIndex;
var hasGlobalData = !(0, import_isNil14.default)(data);
var newUpdateId = hasGlobalData && !hasDifferentStartOrEndIndex ? prevState.updateId : prevState.updateId + 1;
return _objectSpread46(_objectSpread46({
updateId: newUpdateId
}, updateStateOfAxisMapsOffsetAndStackGroups(_objectSpread46(_objectSpread46({
props: nextProps
}, prevState), {}, {
updateId: newUpdateId,
dataStartIndex: startIndex,
dataEndIndex: endIndex
}), prevState)), {}, {
prevChildren: children2,
dataStartIndex: startIndex,
dataEndIndex: endIndex
});
}
return null;
});
_defineProperty52(CategoricalChartWrapper, "renderActiveDot", function(option, props, key) {
var dot;
if ((0, import_react60.isValidElement)(option)) {
dot = (0, import_react60.cloneElement)(option, props);
} else if ((0, import_isFunction26.default)(option)) {
dot = option(props);
} else {
dot = import_react60.default.createElement(Dot, props);
}
return import_react60.default.createElement(Layer, {
className: "recharts-active-dot",
key
}, dot);
});
var CategoricalChart = (0, import_react60.forwardRef)(function CategoricalChart2(props, ref) {
return import_react60.default.createElement(CategoricalChartWrapper, _extends40({}, props, {
ref
}));
});
CategoricalChart.displayName = CategoricalChartWrapper.displayName;
return CategoricalChart;
};
// node_modules/recharts/es6/chart/LineChart.js
var LineChart = generateCategoricalChart({
chartName: "LineChart",
GraphicalChild: Line,
axisComponents: [{
axisType: "xAxis",
AxisComp: XAxis
}, {
axisType: "yAxis",
AxisComp: YAxis
}],
formatAxisMap: formatAxisMap3
});
// node_modules/recharts/es6/chart/BarChart.js
var BarChart = generateCategoricalChart({
chartName: "BarChart",
GraphicalChild: Bar,
defaultTooltipEventType: "axis",
validateTooltipEventTypes: ["axis", "item"],
axisComponents: [{
axisType: "xAxis",
AxisComp: XAxis
}, {
axisType: "yAxis",
AxisComp: YAxis
}],
formatAxisMap: formatAxisMap3
});
// node_modules/recharts/es6/chart/PieChart.js
var PieChart = generateCategoricalChart({
chartName: "PieChart",
GraphicalChild: Pie,
validateTooltipEventTypes: ["item"],
defaultTooltipEventType: "item",
legendContent: "children",
axisComponents: [{
axisType: "angleAxis",
AxisComp: PolarAngleAxis
}, {
axisType: "radiusAxis",
AxisComp: PolarRadiusAxis
}],
formatAxisMap,
defaultProps: {
layout: "centric",
startAngle: 0,
endAngle: 360,
cx: "50%",
cy: "50%",
innerRadius: 0,
outerRadius: "80%"
}
});
// node_modules/recharts/es6/chart/Treemap.js
var import_isNaN4 = __toESM(require_isNaN());
var import_isFunction27 = __toESM(require_isFunction());
var import_omit = __toESM(require_omit());
var import_get7 = __toESM(require_get());
var import_react61 = __toESM(require_react());
// node_modules/recharts/es6/util/Constants.js
var COLOR_PANEL = ["#1890FF", "#66B5FF", "#41D9C7", "#2FC25B", "#6EDB8F", "#9AE65C", "#FACC14", "#E6965C", "#57AD71", "#223273", "#738AE6", "#7564CC", "#8543E0", "#A877ED", "#5C8EE6", "#13C2C2", "#70E0E0", "#5CA3E6", "#3436C7", "#8082FF", "#DD81E6", "#F04864", "#FA7D92", "#D598D9"];
// node_modules/recharts/es6/chart/Treemap.js
var _excluded35 = ["width", "height", "className", "style", "children", "type"];
function _typeof59(o) {
"@babel/helpers - typeof";
return _typeof59 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof59(o);
}
function _extends41() {
_extends41 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends41.apply(this, arguments);
}
function _objectWithoutProperties28(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose29(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose29(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck29(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties29(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey54(descriptor.key), descriptor);
}
}
function _createClass29(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties29(Constructor.prototype, protoProps);
if (staticProps) _defineProperties29(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper24(t, o, e) {
return o = _getPrototypeOf26(o), _possibleConstructorReturn26(t, _isNativeReflectConstruct26() ? Reflect.construct(o, e || [], _getPrototypeOf26(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn26(self2, call) {
if (call && (_typeof59(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized27(self2);
}
function _assertThisInitialized27(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct26() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct26 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf26(o) {
_getPrototypeOf26 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf26(o);
}
function _inherits26(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf27(subClass, superClass);
}
function _setPrototypeOf27(o, p) {
_setPrototypeOf27 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf27(o, p);
}
function ownKeys47(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread47(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys47(Object(t), true).forEach(function(r2) {
_defineProperty53(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys47(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty53(obj, key, value) {
key = _toPropertyKey54(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey54(t) {
var i = _toPrimitive54(t, "string");
return "symbol" == _typeof59(i) ? i : i + "";
}
function _toPrimitive54(t, r) {
if ("object" != _typeof59(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof59(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var NODE_VALUE_KEY = "value";
var computeNode = function computeNode2(_ref) {
var depth = _ref.depth, node = _ref.node, index3 = _ref.index, valueKey = _ref.valueKey;
var children2 = node.children;
var childDepth = depth + 1;
var computedChildren = children2 && children2.length ? children2.map(function(child, i) {
return computeNode2({
depth: childDepth,
node: child,
index: i,
valueKey
});
}) : null;
var nodeValue;
if (children2 && children2.length) {
nodeValue = computedChildren.reduce(function(result, child) {
return result + child[NODE_VALUE_KEY];
}, 0);
} else {
nodeValue = (0, import_isNaN4.default)(node[valueKey]) || node[valueKey] <= 0 ? 0 : node[valueKey];
}
return _objectSpread47(_objectSpread47({}, node), {}, _defineProperty53(_defineProperty53(_defineProperty53({
children: computedChildren
}, NODE_VALUE_KEY, nodeValue), "depth", depth), "index", index3));
};
var filterRect = function filterRect2(node) {
return {
x: node.x,
y: node.y,
width: node.width,
height: node.height
};
};
var getAreaOfChildren = function getAreaOfChildren2(children2, areaValueRatio) {
var ratio = areaValueRatio < 0 ? 0 : areaValueRatio;
return children2.map(function(child) {
var area = child[NODE_VALUE_KEY] * ratio;
return _objectSpread47(_objectSpread47({}, child), {}, {
area: (0, import_isNaN4.default)(area) || area <= 0 ? 0 : area
});
});
};
var getWorstScore = function getWorstScore2(row, parentSize, aspectRatio) {
var parentArea = parentSize * parentSize;
var rowArea = row.area * row.area;
var _row$reduce = row.reduce(function(result, child) {
return {
min: Math.min(result.min, child.area),
max: Math.max(result.max, child.area)
};
}, {
min: Infinity,
max: 0
}), min6 = _row$reduce.min, max6 = _row$reduce.max;
return rowArea ? Math.max(parentArea * max6 * aspectRatio / rowArea, rowArea / (parentArea * min6 * aspectRatio)) : Infinity;
};
var horizontalPosition = function horizontalPosition2(row, parentSize, parentRect, isFlush) {
var rowHeight = parentSize ? Math.round(row.area / parentSize) : 0;
if (isFlush || rowHeight > parentRect.height) {
rowHeight = parentRect.height;
}
var curX = parentRect.x;
var child;
for (var i = 0, len = row.length; i < len; i++) {
child = row[i];
child.x = curX;
child.y = parentRect.y;
child.height = rowHeight;
child.width = Math.min(rowHeight ? Math.round(child.area / rowHeight) : 0, parentRect.x + parentRect.width - curX);
curX += child.width;
}
child.width += parentRect.x + parentRect.width - curX;
return _objectSpread47(_objectSpread47({}, parentRect), {}, {
y: parentRect.y + rowHeight,
height: parentRect.height - rowHeight
});
};
var verticalPosition = function verticalPosition2(row, parentSize, parentRect, isFlush) {
var rowWidth = parentSize ? Math.round(row.area / parentSize) : 0;
if (isFlush || rowWidth > parentRect.width) {
rowWidth = parentRect.width;
}
var curY = parentRect.y;
var child;
for (var i = 0, len = row.length; i < len; i++) {
child = row[i];
child.x = parentRect.x;
child.y = curY;
child.width = rowWidth;
child.height = Math.min(rowWidth ? Math.round(child.area / rowWidth) : 0, parentRect.y + parentRect.height - curY);
curY += child.height;
}
if (child) {
child.height += parentRect.y + parentRect.height - curY;
}
return _objectSpread47(_objectSpread47({}, parentRect), {}, {
x: parentRect.x + rowWidth,
width: parentRect.width - rowWidth
});
};
var position = function position2(row, parentSize, parentRect, isFlush) {
if (parentSize === parentRect.width) {
return horizontalPosition(row, parentSize, parentRect, isFlush);
}
return verticalPosition(row, parentSize, parentRect, isFlush);
};
var squarify = function squarify2(node, aspectRatio) {
var children2 = node.children;
if (children2 && children2.length) {
var rect = filterRect(node);
var row = [];
var best = Infinity;
var child, score;
var size = Math.min(rect.width, rect.height);
var scaleChildren = getAreaOfChildren(children2, rect.width * rect.height / node[NODE_VALUE_KEY]);
var tempChildren = scaleChildren.slice();
row.area = 0;
while (tempChildren.length > 0) {
row.push(child = tempChildren[0]);
row.area += child.area;
score = getWorstScore(row, size, aspectRatio);
if (score <= best) {
tempChildren.shift();
best = score;
} else {
row.area -= row.pop().area;
rect = position(row, size, rect, false);
size = Math.min(rect.width, rect.height);
row.length = row.area = 0;
best = Infinity;
}
}
if (row.length) {
rect = position(row, size, rect, true);
row.length = row.area = 0;
}
return _objectSpread47(_objectSpread47({}, node), {}, {
children: scaleChildren.map(function(c2) {
return squarify2(c2, aspectRatio);
})
});
}
return node;
};
var defaultState = {
isTooltipActive: false,
isAnimationFinished: false,
activeNode: null,
formatRoot: null,
currentRoot: null,
nestIndex: []
};
var Treemap = function(_PureComponent) {
function Treemap2() {
var _this;
_classCallCheck29(this, Treemap2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper24(this, Treemap2, [].concat(args));
_defineProperty53(_this, "state", _objectSpread47({}, defaultState));
_defineProperty53(_this, "handleAnimationEnd", function() {
var onAnimationEnd2 = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if ((0, import_isFunction27.default)(onAnimationEnd2)) {
onAnimationEnd2();
}
});
_defineProperty53(_this, "handleAnimationStart", function() {
var onAnimationStart2 = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if ((0, import_isFunction27.default)(onAnimationStart2)) {
onAnimationStart2();
}
});
return _this;
}
_inherits26(Treemap2, _PureComponent);
return _createClass29(Treemap2, [{
key: "handleMouseEnter",
value: function handleMouseEnter(node, e) {
e.persist();
var _this$props = this.props, onMouseEnter = _this$props.onMouseEnter, children2 = _this$props.children;
var tooltipItem = findChildByType(children2, Tooltip);
if (tooltipItem) {
this.setState({
isTooltipActive: true,
activeNode: node
}, function() {
if (onMouseEnter) {
onMouseEnter(node, e);
}
});
} else if (onMouseEnter) {
onMouseEnter(node, e);
}
}
}, {
key: "handleMouseLeave",
value: function handleMouseLeave(node, e) {
e.persist();
var _this$props2 = this.props, onMouseLeave = _this$props2.onMouseLeave, children2 = _this$props2.children;
var tooltipItem = findChildByType(children2, Tooltip);
if (tooltipItem) {
this.setState({
isTooltipActive: false,
activeNode: null
}, function() {
if (onMouseLeave) {
onMouseLeave(node, e);
}
});
} else if (onMouseLeave) {
onMouseLeave(node, e);
}
}
}, {
key: "handleClick",
value: function handleClick(node) {
var _this$props3 = this.props, onClick = _this$props3.onClick, type = _this$props3.type;
if (type === "nest" && node.children) {
var _this$props4 = this.props, width = _this$props4.width, height = _this$props4.height, dataKey = _this$props4.dataKey, aspectRatio = _this$props4.aspectRatio;
var root = computeNode({
depth: 0,
node: _objectSpread47(_objectSpread47({}, node), {}, {
x: 0,
y: 0,
width,
height
}),
index: 0,
valueKey: dataKey
});
var formatRoot = squarify(root, aspectRatio);
var nestIndex = this.state.nestIndex;
nestIndex.push(node);
this.setState({
formatRoot,
currentRoot: root,
nestIndex
});
}
if (onClick) {
onClick(node);
}
}
}, {
key: "handleNestIndex",
value: function handleNestIndex(node, i) {
var nestIndex = this.state.nestIndex;
var _this$props5 = this.props, width = _this$props5.width, height = _this$props5.height, dataKey = _this$props5.dataKey, aspectRatio = _this$props5.aspectRatio;
var root = computeNode({
depth: 0,
node: _objectSpread47(_objectSpread47({}, node), {}, {
x: 0,
y: 0,
width,
height
}),
index: 0,
valueKey: dataKey
});
var formatRoot = squarify(root, aspectRatio);
nestIndex = nestIndex.slice(0, i + 1);
this.setState({
formatRoot,
currentRoot: node,
nestIndex
});
}
}, {
key: "renderItem",
value: function renderItem(content, nodeProps, isLeaf) {
var _this2 = this;
var _this$props6 = this.props, isAnimationActive = _this$props6.isAnimationActive, animationBegin = _this$props6.animationBegin, animationDuration = _this$props6.animationDuration, animationEasing = _this$props6.animationEasing, isUpdateAnimationActive = _this$props6.isUpdateAnimationActive, type = _this$props6.type, animationId = _this$props6.animationId, colorPanel = _this$props6.colorPanel;
var isAnimationFinished = this.state.isAnimationFinished;
var width = nodeProps.width, height = nodeProps.height, x2 = nodeProps.x, y2 = nodeProps.y, depth = nodeProps.depth;
var translateX = parseInt("".concat((Math.random() * 2 - 1) * width), 10);
var event = {};
if (isLeaf || type === "nest") {
event = {
onMouseEnter: this.handleMouseEnter.bind(this, nodeProps),
onMouseLeave: this.handleMouseLeave.bind(this, nodeProps),
onClick: this.handleClick.bind(this, nodeProps)
};
}
if (!isAnimationActive) {
return import_react61.default.createElement(Layer, event, this.constructor.renderContentItem(content, _objectSpread47(_objectSpread47({}, nodeProps), {}, {
isAnimationActive: false,
isUpdateAnimationActive: false,
width,
height,
x: x2,
y: y2
}), type, colorPanel));
}
return import_react61.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
key: "treemap-".concat(animationId),
from: {
x: x2,
y: y2,
width,
height
},
to: {
x: x2,
y: y2,
width,
height
},
onAnimationStart: this.handleAnimationStart,
onAnimationEnd: this.handleAnimationEnd
}, function(_ref2) {
var currX = _ref2.x, currY = _ref2.y, currWidth = _ref2.width, currHeight = _ref2.height;
return import_react61.default.createElement(es6_default, {
from: "translate(".concat(translateX, "px, ").concat(translateX, "px)"),
to: "translate(0, 0)",
attributeName: "transform",
begin: animationBegin,
easing: animationEasing,
isActive: isAnimationActive,
duration: animationDuration
}, import_react61.default.createElement(Layer, event, function() {
if (depth > 2 && !isAnimationFinished) {
return null;
}
return _this2.constructor.renderContentItem(content, _objectSpread47(_objectSpread47({}, nodeProps), {}, {
isAnimationActive,
isUpdateAnimationActive: !isUpdateAnimationActive,
width: currWidth,
height: currHeight,
x: currX,
y: currY
}), type, colorPanel);
}()));
});
}
}, {
key: "renderNode",
value: function renderNode(root, node) {
var _this3 = this;
var _this$props7 = this.props, content = _this$props7.content, type = _this$props7.type;
var nodeProps = _objectSpread47(_objectSpread47(_objectSpread47({}, filterProps(this.props, false)), node), {}, {
root
});
var isLeaf = !node.children || !node.children.length;
var currentRoot = this.state.currentRoot;
var isCurrentRootChild = (currentRoot.children || []).filter(function(item) {
return item.depth === node.depth && item.name === node.name;
});
if (!isCurrentRootChild.length && root.depth && type === "nest") {
return null;
}
return import_react61.default.createElement(Layer, {
key: "recharts-treemap-node-".concat(nodeProps.x, "-").concat(nodeProps.y, "-").concat(nodeProps.name),
className: "recharts-treemap-depth-".concat(node.depth)
}, this.renderItem(content, nodeProps, isLeaf), node.children && node.children.length ? node.children.map(function(child) {
return _this3.renderNode(node, child);
}) : null);
}
}, {
key: "renderAllNodes",
value: function renderAllNodes() {
var formatRoot = this.state.formatRoot;
if (!formatRoot) {
return null;
}
return this.renderNode(formatRoot, formatRoot);
}
}, {
key: "renderTooltip",
value: function renderTooltip() {
var _this$props8 = this.props, children2 = _this$props8.children, nameKey = _this$props8.nameKey;
var tooltipItem = findChildByType(children2, Tooltip);
if (!tooltipItem) {
return null;
}
var _this$props9 = this.props, width = _this$props9.width, height = _this$props9.height;
var _this$state = this.state, isTooltipActive = _this$state.isTooltipActive, activeNode = _this$state.activeNode;
var viewBox = {
x: 0,
y: 0,
width,
height
};
var coordinate = activeNode ? {
x: activeNode.x + activeNode.width / 2,
y: activeNode.y + activeNode.height / 2
} : null;
var payload = isTooltipActive && activeNode ? [{
payload: activeNode,
name: getValueByDataKey(activeNode, nameKey, ""),
value: getValueByDataKey(activeNode, NODE_VALUE_KEY)
}] : [];
return import_react61.default.cloneElement(tooltipItem, {
viewBox,
active: isTooltipActive,
coordinate,
label: "",
payload
});
}
// render nest treemap
}, {
key: "renderNestIndex",
value: function renderNestIndex() {
var _this4 = this;
var _this$props10 = this.props, nameKey = _this$props10.nameKey, nestIndexContent = _this$props10.nestIndexContent;
var nestIndex = this.state.nestIndex;
return import_react61.default.createElement("div", {
className: "recharts-treemap-nest-index-wrapper",
style: {
marginTop: "8px",
textAlign: "center"
}
}, nestIndex.map(function(item, i) {
var name = (0, import_get7.default)(item, nameKey, "root");
var content = null;
if (import_react61.default.isValidElement(nestIndexContent)) {
content = import_react61.default.cloneElement(nestIndexContent, item, i);
}
if ((0, import_isFunction27.default)(nestIndexContent)) {
content = nestIndexContent(item, i);
} else {
content = name;
}
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
import_react61.default.createElement("div", {
onClick: _this4.handleNestIndex.bind(_this4, item, i),
key: "nest-index-".concat(uniqueId()),
className: "recharts-treemap-nest-index-box",
style: {
cursor: "pointer",
display: "inline-block",
padding: "0 7px",
background: "#000",
color: "#fff",
marginRight: "3px"
}
}, content)
);
}));
}
}, {
key: "render",
value: function render() {
if (!validateWidthHeight(this)) {
return null;
}
var _this$props11 = this.props, width = _this$props11.width, height = _this$props11.height, className = _this$props11.className, style = _this$props11.style, children2 = _this$props11.children, type = _this$props11.type, others = _objectWithoutProperties28(_this$props11, _excluded35);
var attrs = filterProps(others, false);
return import_react61.default.createElement("div", {
className: clsx_default("recharts-wrapper", className),
style: _objectSpread47(_objectSpread47({}, style), {}, {
position: "relative",
cursor: "default",
width,
height
}),
role: "region"
}, import_react61.default.createElement(Surface, _extends41({}, attrs, {
width,
height: type === "nest" ? height - 30 : height
}), this.renderAllNodes(), filterSvgElements(children2)), this.renderTooltip(), type === "nest" && this.renderNestIndex());
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.data !== prevState.prevData || nextProps.type !== prevState.prevType || nextProps.width !== prevState.prevWidth || nextProps.height !== prevState.prevHeight || nextProps.dataKey !== prevState.prevDataKey || nextProps.aspectRatio !== prevState.prevAspectRatio) {
var root = computeNode({
depth: 0,
node: {
children: nextProps.data,
x: 0,
y: 0,
width: nextProps.width,
height: nextProps.height
},
index: 0,
valueKey: nextProps.dataKey
});
var formatRoot = squarify(root, nextProps.aspectRatio);
return _objectSpread47(_objectSpread47({}, prevState), {}, {
formatRoot,
currentRoot: root,
nestIndex: [root],
prevAspectRatio: nextProps.aspectRatio,
prevData: nextProps.data,
prevWidth: nextProps.width,
prevHeight: nextProps.height,
prevDataKey: nextProps.dataKey,
prevType: nextProps.type
});
}
return null;
}
}, {
key: "renderContentItem",
value: function renderContentItem(content, nodeProps, type, colorPanel) {
if (import_react61.default.isValidElement(content)) {
return import_react61.default.cloneElement(content, nodeProps);
}
if ((0, import_isFunction27.default)(content)) {
return content(nodeProps);
}
var x2 = nodeProps.x, y2 = nodeProps.y, width = nodeProps.width, height = nodeProps.height, index3 = nodeProps.index;
var arrow = null;
if (width > 10 && height > 10 && nodeProps.children && type === "nest") {
arrow = import_react61.default.createElement(Polygon, {
points: [{
x: x2 + 2,
y: y2 + height / 2
}, {
x: x2 + 6,
y: y2 + height / 2 + 3
}, {
x: x2 + 2,
y: y2 + height / 2 + 6
}]
});
}
var text = null;
var nameSize = getStringSize(nodeProps.name);
if (width > 20 && height > 20 && nameSize.width < width && nameSize.height < height) {
text = import_react61.default.createElement("text", {
x: x2 + 8,
y: y2 + height / 2 + 7,
fontSize: 14
}, nodeProps.name);
}
var colors = colorPanel || COLOR_PANEL;
return import_react61.default.createElement("g", null, import_react61.default.createElement(Rectangle, _extends41({
fill: nodeProps.depth < 2 ? colors[index3 % colors.length] : "rgba(255,255,255,0)",
stroke: "#fff"
}, (0, import_omit.default)(nodeProps, "children"), {
role: "img"
})), arrow, text);
}
}]);
}(import_react61.PureComponent);
_defineProperty53(Treemap, "displayName", "Treemap");
_defineProperty53(Treemap, "defaultProps", {
aspectRatio: 0.5 * (1 + Math.sqrt(5)),
dataKey: "value",
type: "flat",
isAnimationActive: !Global.isSsr,
isUpdateAnimationActive: !Global.isSsr,
animationBegin: 0,
animationDuration: 1500,
animationEasing: "linear"
});
// node_modules/recharts/es6/chart/Sankey.js
var import_react62 = __toESM(require_react());
var import_maxBy2 = __toESM(require_maxBy());
var import_min8 = __toESM(require_min());
var import_get8 = __toESM(require_get());
var import_sumBy = __toESM(require_sumBy());
var import_isFunction28 = __toESM(require_isFunction());
var _excluded36 = ["width", "height", "className", "style", "children"];
var _excluded214 = ["sourceX", "sourceY", "sourceControlX", "targetX", "targetY", "targetControlX", "linkWidth"];
function _typeof60(o) {
"@babel/helpers - typeof";
return _typeof60 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof60(o);
}
function _objectWithoutProperties29(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose30(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose30(source, excluded) {
if (source == null) return {};
var target = {};
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
}
function _extends42() {
_extends42 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends42.apply(this, arguments);
}
function _classCallCheck30(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties30(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey55(descriptor.key), descriptor);
}
}
function _createClass30(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties30(Constructor.prototype, protoProps);
if (staticProps) _defineProperties30(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper25(t, o, e) {
return o = _getPrototypeOf27(o), _possibleConstructorReturn27(t, _isNativeReflectConstruct27() ? Reflect.construct(o, e || [], _getPrototypeOf27(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn27(self2, call) {
if (call && (_typeof60(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized28(self2);
}
function _assertThisInitialized28(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct27() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct27 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf27(o) {
_getPrototypeOf27 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf27(o);
}
function _inherits27(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf28(subClass, superClass);
}
function _setPrototypeOf28(o, p) {
_setPrototypeOf28 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf28(o, p);
}
function ownKeys48(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread48(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys48(Object(t), true).forEach(function(r2) {
_defineProperty54(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys48(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty54(obj, key, value) {
key = _toPropertyKey55(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey55(t) {
var i = _toPrimitive55(t, "string");
return "symbol" == _typeof60(i) ? i : i + "";
}
function _toPrimitive55(t, r) {
if ("object" != _typeof60(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof60(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var defaultCoordinateOfTooltip = {
x: 0,
y: 0
};
var interpolationGenerator = function interpolationGenerator2(a2, b) {
var ka2 = +a2;
var kb = b - ka2;
return function(t) {
return ka2 + kb * t;
};
};
var centerY = function centerY2(node) {
return node.y + node.dy / 2;
};
var getValue = function getValue2(entry) {
return entry && entry.value || 0;
};
var getSumOfIds = function getSumOfIds2(links, ids) {
return ids.reduce(function(result, id) {
return result + getValue(links[id]);
}, 0);
};
var getSumWithWeightedSource = function getSumWithWeightedSource2(tree, links, ids) {
return ids.reduce(function(result, id) {
var link2 = links[id];
var sourceNode = tree[link2.source];
return result + centerY(sourceNode) * getValue(links[id]);
}, 0);
};
var getSumWithWeightedTarget = function getSumWithWeightedTarget2(tree, links, ids) {
return ids.reduce(function(result, id) {
var link2 = links[id];
var targetNode = tree[link2.target];
return result + centerY(targetNode) * getValue(links[id]);
}, 0);
};
var ascendingY = function ascendingY2(a2, b) {
return a2.y - b.y;
};
var searchTargetsAndSources = function searchTargetsAndSources2(links, id) {
var sourceNodes = [];
var sourceLinks = [];
var targetNodes = [];
var targetLinks = [];
for (var i = 0, len = links.length; i < len; i++) {
var link2 = links[i];
if (link2.source === id) {
targetNodes.push(link2.target);
targetLinks.push(i);
}
if (link2.target === id) {
sourceNodes.push(link2.source);
sourceLinks.push(i);
}
}
return {
sourceNodes,
sourceLinks,
targetLinks,
targetNodes
};
};
var updateDepthOfTargets = function updateDepthOfTargets2(tree, curNode) {
var targetNodes = curNode.targetNodes;
for (var i = 0, len = targetNodes.length; i < len; i++) {
var target = tree[targetNodes[i]];
if (target) {
target.depth = Math.max(curNode.depth + 1, target.depth);
updateDepthOfTargets2(tree, target);
}
}
};
var getNodesTree = function getNodesTree2(_ref, width, nodeWidth) {
var nodes = _ref.nodes, links = _ref.links;
var tree = nodes.map(function(entry, index3) {
var result = searchTargetsAndSources(links, index3);
return _objectSpread48(_objectSpread48(_objectSpread48({}, entry), result), {}, {
value: Math.max(getSumOfIds(links, result.sourceLinks), getSumOfIds(links, result.targetLinks)),
depth: 0
});
});
for (var i = 0, len = tree.length; i < len; i++) {
var node = tree[i];
if (!node.sourceNodes.length) {
updateDepthOfTargets(tree, node);
}
}
var maxDepth = (0, import_maxBy2.default)(tree, function(entry) {
return entry.depth;
}).depth;
if (maxDepth >= 1) {
var childWidth = (width - nodeWidth) / maxDepth;
for (var _i = 0, _len = tree.length; _i < _len; _i++) {
var _node = tree[_i];
if (!_node.targetNodes.length) {
_node.depth = maxDepth;
}
_node.x = _node.depth * childWidth;
_node.dx = nodeWidth;
}
}
return {
tree,
maxDepth
};
};
var getDepthTree = function getDepthTree2(tree) {
var result = [];
for (var i = 0, len = tree.length; i < len; i++) {
var node = tree[i];
if (!result[node.depth]) {
result[node.depth] = [];
}
result[node.depth].push(node);
}
return result;
};
var updateYOfTree = function updateYOfTree2(depthTree, height, nodePadding, links) {
var yRatio = (0, import_min8.default)(depthTree.map(function(nodes) {
return (height - (nodes.length - 1) * nodePadding) / (0, import_sumBy.default)(nodes, getValue);
}));
for (var d = 0, maxDepth = depthTree.length; d < maxDepth; d++) {
for (var i = 0, len = depthTree[d].length; i < len; i++) {
var node = depthTree[d][i];
node.y = i;
node.dy = node.value * yRatio;
}
}
return links.map(function(link2) {
return _objectSpread48(_objectSpread48({}, link2), {}, {
dy: getValue(link2) * yRatio
});
});
};
var resolveCollisions = function resolveCollisions2(depthTree, height, nodePadding) {
var sort3 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
for (var i = 0, len = depthTree.length; i < len; i++) {
var nodes = depthTree[i];
var n = nodes.length;
if (sort3) {
nodes.sort(ascendingY);
}
var y0 = 0;
for (var j = 0; j < n; j++) {
var node = nodes[j];
var dy = y0 - node.y;
if (dy > 0) {
node.y += dy;
}
y0 = node.y + node.dy + nodePadding;
}
y0 = height + nodePadding;
for (var _j = n - 1; _j >= 0; _j--) {
var _node2 = nodes[_j];
var _dy = _node2.y + _node2.dy + nodePadding - y0;
if (_dy > 0) {
_node2.y -= _dy;
y0 = _node2.y;
} else {
break;
}
}
}
};
var relaxLeftToRight = function relaxLeftToRight2(tree, depthTree, links, alpha3) {
for (var i = 0, maxDepth = depthTree.length; i < maxDepth; i++) {
var nodes = depthTree[i];
for (var j = 0, len = nodes.length; j < len; j++) {
var node = nodes[j];
if (node.sourceLinks.length) {
var sourceSum = getSumOfIds(links, node.sourceLinks);
var weightedSum = getSumWithWeightedSource(tree, links, node.sourceLinks);
var y2 = weightedSum / sourceSum;
node.y += (y2 - centerY(node)) * alpha3;
}
}
}
};
var relaxRightToLeft = function relaxRightToLeft2(tree, depthTree, links, alpha3) {
for (var i = depthTree.length - 1; i >= 0; i--) {
var nodes = depthTree[i];
for (var j = 0, len = nodes.length; j < len; j++) {
var node = nodes[j];
if (node.targetLinks.length) {
var targetSum = getSumOfIds(links, node.targetLinks);
var weightedSum = getSumWithWeightedTarget(tree, links, node.targetLinks);
var y2 = weightedSum / targetSum;
node.y += (y2 - centerY(node)) * alpha3;
}
}
}
};
var updateYOfLinks = function updateYOfLinks2(tree, links) {
for (var i = 0, len = tree.length; i < len; i++) {
var node = tree[i];
var sy = 0;
var ty = 0;
node.targetLinks.sort(function(a2, b) {
return tree[links[a2].target].y - tree[links[b].target].y;
});
node.sourceLinks.sort(function(a2, b) {
return tree[links[a2].source].y - tree[links[b].source].y;
});
for (var j = 0, tLen = node.targetLinks.length; j < tLen; j++) {
var link2 = links[node.targetLinks[j]];
if (link2) {
link2.sy = sy;
sy += link2.dy;
}
}
for (var _j2 = 0, sLen = node.sourceLinks.length; _j2 < sLen; _j2++) {
var _link = links[node.sourceLinks[_j2]];
if (_link) {
_link.ty = ty;
ty += _link.dy;
}
}
}
};
var computeData = function computeData2(_ref2) {
var data = _ref2.data, width = _ref2.width, height = _ref2.height, iterations = _ref2.iterations, nodeWidth = _ref2.nodeWidth, nodePadding = _ref2.nodePadding, sort3 = _ref2.sort;
var links = data.links;
var _getNodesTree = getNodesTree(data, width, nodeWidth), tree = _getNodesTree.tree;
var depthTree = getDepthTree(tree);
var newLinks = updateYOfTree(depthTree, height, nodePadding, links);
resolveCollisions(depthTree, height, nodePadding, sort3);
var alpha3 = 1;
for (var i = 1; i <= iterations; i++) {
relaxRightToLeft(tree, depthTree, newLinks, alpha3 *= 0.99);
resolveCollisions(depthTree, height, nodePadding, sort3);
relaxLeftToRight(tree, depthTree, newLinks, alpha3);
resolveCollisions(depthTree, height, nodePadding, sort3);
}
updateYOfLinks(tree, newLinks);
return {
nodes: tree,
links: newLinks
};
};
var getCoordinateOfTooltip = function getCoordinateOfTooltip2(el, type) {
if (type === "node") {
return {
x: el.x + el.width / 2,
y: el.y + el.height / 2
};
}
return {
x: (el.sourceX + el.targetX) / 2,
y: (el.sourceY + el.targetY) / 2
};
};
var getPayloadOfTooltip = function getPayloadOfTooltip2(el, type, nameKey) {
var payload = el.payload;
if (type === "node") {
return [{
payload: el,
name: getValueByDataKey(payload, nameKey, ""),
value: getValueByDataKey(payload, "value")
}];
}
if (payload.source && payload.target) {
var sourceName = getValueByDataKey(payload.source, nameKey, "");
var targetName = getValueByDataKey(payload.target, nameKey, "");
return [{
payload: el,
name: "".concat(sourceName, " - ").concat(targetName),
value: getValueByDataKey(payload, "value")
}];
}
return [];
};
var Sankey = function(_PureComponent) {
function Sankey2() {
var _this;
_classCallCheck30(this, Sankey2);
for (var _len2 = arguments.length, args = new Array(_len2), _key = 0; _key < _len2; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper25(this, Sankey2, [].concat(args));
_defineProperty54(_this, "state", {
activeElement: null,
activeElementType: null,
isTooltipActive: false,
nodes: [],
links: []
});
return _this;
}
_inherits27(Sankey2, _PureComponent);
return _createClass30(Sankey2, [{
key: "handleMouseEnter",
value: function handleMouseEnter(el, type, e) {
var _this$props = this.props, onMouseEnter = _this$props.onMouseEnter, children2 = _this$props.children;
var tooltipItem = findChildByType(children2, Tooltip);
if (tooltipItem) {
this.setState(function(prev) {
if (tooltipItem.props.trigger === "hover") {
return _objectSpread48(_objectSpread48({}, prev), {}, {
activeElement: el,
activeElementType: type,
isTooltipActive: true
});
}
return prev;
}, function() {
if (onMouseEnter) {
onMouseEnter(el, type, e);
}
});
} else if (onMouseEnter) {
onMouseEnter(el, type, e);
}
}
}, {
key: "handleMouseLeave",
value: function handleMouseLeave(el, type, e) {
var _this$props2 = this.props, onMouseLeave = _this$props2.onMouseLeave, children2 = _this$props2.children;
var tooltipItem = findChildByType(children2, Tooltip);
if (tooltipItem) {
this.setState(function(prev) {
if (tooltipItem.props.trigger === "hover") {
return _objectSpread48(_objectSpread48({}, prev), {}, {
activeElement: void 0,
activeElementType: void 0,
isTooltipActive: false
});
}
return prev;
}, function() {
if (onMouseLeave) {
onMouseLeave(el, type, e);
}
});
} else if (onMouseLeave) {
onMouseLeave(el, type, e);
}
}
}, {
key: "handleClick",
value: function handleClick(el, type, e) {
var _this$props3 = this.props, onClick = _this$props3.onClick, children2 = _this$props3.children;
var tooltipItem = findChildByType(children2, Tooltip);
if (tooltipItem && tooltipItem.props.trigger === "click") {
if (this.state.isTooltipActive) {
this.setState(function(prev) {
return _objectSpread48(_objectSpread48({}, prev), {}, {
activeElement: void 0,
activeElementType: void 0,
isTooltipActive: false
});
});
} else {
this.setState(function(prev) {
return _objectSpread48(_objectSpread48({}, prev), {}, {
activeElement: el,
activeElementType: type,
isTooltipActive: true
});
});
}
}
if (onClick) onClick(el, type, e);
}
}, {
key: "renderLinks",
value: function renderLinks(links, nodes) {
var _this2 = this;
var _this$props4 = this.props, linkCurvature = _this$props4.linkCurvature, linkContent = _this$props4.link, margin = _this$props4.margin;
var top = (0, import_get8.default)(margin, "top") || 0;
var left = (0, import_get8.default)(margin, "left") || 0;
return import_react62.default.createElement(Layer, {
className: "recharts-sankey-links",
key: "recharts-sankey-links"
}, links.map(function(link2, i) {
var sourceRelativeY = link2.sy, targetRelativeY = link2.ty, linkWidth = link2.dy;
var source = nodes[link2.source];
var target = nodes[link2.target];
var sourceX = source.x + source.dx + left;
var targetX = target.x + left;
var interpolationFunc = interpolationGenerator(sourceX, targetX);
var sourceControlX = interpolationFunc(linkCurvature);
var targetControlX = interpolationFunc(1 - linkCurvature);
var sourceY = source.y + sourceRelativeY + linkWidth / 2 + top;
var targetY = target.y + targetRelativeY + linkWidth / 2 + top;
var linkProps = _objectSpread48({
sourceX,
targetX,
sourceY,
targetY,
sourceControlX,
targetControlX,
sourceRelativeY,
targetRelativeY,
linkWidth,
index: i,
payload: _objectSpread48(_objectSpread48({}, link2), {}, {
source,
target
})
}, filterProps(linkContent, false));
var events = {
onMouseEnter: _this2.handleMouseEnter.bind(_this2, linkProps, "link"),
onMouseLeave: _this2.handleMouseLeave.bind(_this2, linkProps, "link"),
onClick: _this2.handleClick.bind(_this2, linkProps, "link")
};
return import_react62.default.createElement(Layer, _extends42({
key: "link-".concat(link2.source, "-").concat(link2.target, "-").concat(link2.value)
}, events), _this2.constructor.renderLinkItem(linkContent, linkProps));
}));
}
}, {
key: "renderNodes",
value: function renderNodes(nodes) {
var _this3 = this;
var _this$props5 = this.props, nodeContent = _this$props5.node, margin = _this$props5.margin;
var top = (0, import_get8.default)(margin, "top") || 0;
var left = (0, import_get8.default)(margin, "left") || 0;
return import_react62.default.createElement(Layer, {
className: "recharts-sankey-nodes",
key: "recharts-sankey-nodes"
}, nodes.map(function(node, i) {
var x2 = node.x, y2 = node.y, dx = node.dx, dy = node.dy;
var nodeProps = _objectSpread48(_objectSpread48({}, filterProps(nodeContent, false)), {}, {
x: x2 + left,
y: y2 + top,
width: dx,
height: dy,
index: i,
payload: node
});
var events = {
onMouseEnter: _this3.handleMouseEnter.bind(_this3, nodeProps, "node"),
onMouseLeave: _this3.handleMouseLeave.bind(_this3, nodeProps, "node"),
onClick: _this3.handleClick.bind(_this3, nodeProps, "node")
};
return import_react62.default.createElement(Layer, _extends42({
key: "node-".concat(node.x, "-").concat(node.y, "-").concat(node.value)
}, events), _this3.constructor.renderNodeItem(nodeContent, nodeProps));
}));
}
}, {
key: "renderTooltip",
value: function renderTooltip() {
var _this$props6 = this.props, children2 = _this$props6.children, width = _this$props6.width, height = _this$props6.height, nameKey = _this$props6.nameKey;
var tooltipItem = findChildByType(children2, Tooltip);
if (!tooltipItem) {
return null;
}
var _this$state = this.state, isTooltipActive = _this$state.isTooltipActive, activeElement = _this$state.activeElement, activeElementType = _this$state.activeElementType;
var viewBox = {
x: 0,
y: 0,
width,
height
};
var coordinate = activeElement ? getCoordinateOfTooltip(activeElement, activeElementType) : defaultCoordinateOfTooltip;
var payload = activeElement ? getPayloadOfTooltip(activeElement, activeElementType, nameKey) : [];
return import_react62.default.cloneElement(tooltipItem, {
viewBox,
active: isTooltipActive,
coordinate,
label: "",
payload
});
}
}, {
key: "render",
value: function render() {
if (!validateWidthHeight(this)) {
return null;
}
var _this$props7 = this.props, width = _this$props7.width, height = _this$props7.height, className = _this$props7.className, style = _this$props7.style, children2 = _this$props7.children, others = _objectWithoutProperties29(_this$props7, _excluded36);
var _this$state2 = this.state, links = _this$state2.links, nodes = _this$state2.nodes;
var attrs = filterProps(others, false);
return import_react62.default.createElement("div", {
className: clsx_default("recharts-wrapper", className),
style: _objectSpread48(_objectSpread48({}, style), {}, {
position: "relative",
cursor: "default",
width,
height
}),
role: "region"
}, import_react62.default.createElement(Surface, _extends42({}, attrs, {
width,
height
}), filterSvgElements(children2), this.renderLinks(links, nodes), this.renderNodes(nodes)), this.renderTooltip());
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
var data = nextProps.data, width = nextProps.width, height = nextProps.height, margin = nextProps.margin, iterations = nextProps.iterations, nodeWidth = nextProps.nodeWidth, nodePadding = nextProps.nodePadding, sort3 = nextProps.sort;
if (data !== prevState.prevData || width !== prevState.prevWidth || height !== prevState.prevHeight || !shallowEqual(margin, prevState.prevMargin) || iterations !== prevState.prevIterations || nodeWidth !== prevState.prevNodeWidth || nodePadding !== prevState.prevNodePadding || sort3 !== prevState.sort) {
var contentWidth = width - (margin && margin.left || 0) - (margin && margin.right || 0);
var contentHeight = height - (margin && margin.top || 0) - (margin && margin.bottom || 0);
var _computeData = computeData({
data,
width: contentWidth,
height: contentHeight,
iterations,
nodeWidth,
nodePadding,
sort: sort3
}), links = _computeData.links, nodes = _computeData.nodes;
return _objectSpread48(_objectSpread48({}, prevState), {}, {
nodes,
links,
prevData: data,
prevWidth: iterations,
prevHeight: height,
prevMargin: margin,
prevNodePadding: nodePadding,
prevNodeWidth: nodeWidth,
prevIterations: iterations,
prevSort: sort3
});
}
return null;
}
}, {
key: "renderLinkItem",
value: function renderLinkItem(option, props) {
if (import_react62.default.isValidElement(option)) {
return import_react62.default.cloneElement(option, props);
}
if ((0, import_isFunction28.default)(option)) {
return option(props);
}
var sourceX = props.sourceX, sourceY = props.sourceY, sourceControlX = props.sourceControlX, targetX = props.targetX, targetY = props.targetY, targetControlX = props.targetControlX, linkWidth = props.linkWidth, others = _objectWithoutProperties29(props, _excluded214);
return import_react62.default.createElement("path", _extends42({
className: "recharts-sankey-link",
d: "\n M".concat(sourceX, ",").concat(sourceY, "\n C").concat(sourceControlX, ",").concat(sourceY, " ").concat(targetControlX, ",").concat(targetY, " ").concat(targetX, ",").concat(targetY, "\n "),
fill: "none",
stroke: "#333",
strokeWidth: linkWidth,
strokeOpacity: "0.2"
}, filterProps(others, false)));
}
}, {
key: "renderNodeItem",
value: function renderNodeItem(option, props) {
if (import_react62.default.isValidElement(option)) {
return import_react62.default.cloneElement(option, props);
}
if ((0, import_isFunction28.default)(option)) {
return option(props);
}
return import_react62.default.createElement(Rectangle, _extends42({
className: "recharts-sankey-node",
fill: "#0088fe",
fillOpacity: "0.8"
}, filterProps(props, false), {
role: "img"
}));
}
}]);
}(import_react62.PureComponent);
_defineProperty54(Sankey, "displayName", "Sankey");
_defineProperty54(Sankey, "defaultProps", {
nameKey: "name",
dataKey: "value",
nodePadding: 10,
nodeWidth: 10,
linkCurvature: 0.5,
iterations: 32,
margin: {
top: 5,
right: 5,
bottom: 5,
left: 5
},
sort: true
});
// node_modules/recharts/es6/chart/RadarChart.js
var RadarChart = generateCategoricalChart({
chartName: "RadarChart",
GraphicalChild: Radar,
axisComponents: [{
axisType: "angleAxis",
AxisComp: PolarAngleAxis
}, {
axisType: "radiusAxis",
AxisComp: PolarRadiusAxis
}],
formatAxisMap,
defaultProps: {
layout: "centric",
startAngle: 90,
endAngle: -270,
cx: "50%",
cy: "50%",
innerRadius: 0,
outerRadius: "80%"
}
});
// node_modules/recharts/es6/chart/ScatterChart.js
var ScatterChart = generateCategoricalChart({
chartName: "ScatterChart",
GraphicalChild: Scatter,
defaultTooltipEventType: "item",
validateTooltipEventTypes: ["item"],
axisComponents: [{
axisType: "xAxis",
AxisComp: XAxis
}, {
axisType: "yAxis",
AxisComp: YAxis
}, {
axisType: "zAxis",
AxisComp: ZAxis
}],
formatAxisMap: formatAxisMap3
});
// node_modules/recharts/es6/chart/AreaChart.js
var AreaChart = generateCategoricalChart({
chartName: "AreaChart",
GraphicalChild: Area,
axisComponents: [{
axisType: "xAxis",
AxisComp: XAxis
}, {
axisType: "yAxis",
AxisComp: YAxis
}],
formatAxisMap: formatAxisMap3
});
// node_modules/recharts/es6/chart/RadialBarChart.js
var RadialBarChart = generateCategoricalChart({
chartName: "RadialBarChart",
GraphicalChild: RadialBar,
legendContent: "children",
defaultTooltipEventType: "axis",
validateTooltipEventTypes: ["axis", "item"],
axisComponents: [{
axisType: "angleAxis",
AxisComp: PolarAngleAxis
}, {
axisType: "radiusAxis",
AxisComp: PolarRadiusAxis
}],
formatAxisMap,
defaultProps: {
layout: "radial",
startAngle: 0,
endAngle: 360,
cx: "50%",
cy: "50%",
innerRadius: 0,
outerRadius: "80%"
}
});
// node_modules/recharts/es6/chart/ComposedChart.js
var ComposedChart = generateCategoricalChart({
chartName: "ComposedChart",
GraphicalChild: [Line, Area, Bar, Scatter],
axisComponents: [{
axisType: "xAxis",
AxisComp: XAxis
}, {
axisType: "yAxis",
AxisComp: YAxis
}, {
axisType: "zAxis",
AxisComp: ZAxis
}],
formatAxisMap: formatAxisMap3
});
// node_modules/recharts/es6/chart/SunburstChart.js
var import_react63 = __toESM(require_react());
function _extends43() {
_extends43 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends43.apply(this, arguments);
}
function _slicedToArray14(arr, i) {
return _arrayWithHoles15(arr) || _iterableToArrayLimit14(arr, i) || _unsupportedIterableToArray23(arr, i) || _nonIterableRest15();
}
function _nonIterableRest15() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _iterableToArrayLimit14(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e, n, i, u, a2 = [], f = true, o = false;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = false;
} else for (; !(f = (e = i.call(t)).done) && (a2.push(e.value), a2.length !== l); f = true) ;
} catch (r2) {
o = true, n = r2;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a2;
}
}
function _arrayWithHoles15(arr) {
if (Array.isArray(arr)) return arr;
}
function _toConsumableArray13(arr) {
return _arrayWithoutHoles13(arr) || _iterableToArray14(arr) || _unsupportedIterableToArray23(arr) || _nonIterableSpread13();
}
function _nonIterableSpread13() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray23(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray23(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray23(o, minLen);
}
function _iterableToArray14(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _arrayWithoutHoles13(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray23(arr);
}
function _arrayLikeToArray23(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
var defaultTextProps = {
fontWeight: "bold",
paintOrder: "stroke fill",
fontSize: ".75rem",
stroke: "#FFF",
fill: "black",
pointerEvents: "none"
};
function getMaxDepthOf(node) {
if (!node.children || node.children.length === 0) return 1;
var childDepths = node.children.map(function(d) {
return getMaxDepthOf(d);
});
return 1 + Math.max.apply(Math, _toConsumableArray13(childDepths));
}
var SunburstChart = function SunburstChart2(_ref) {
var className = _ref.className, data = _ref.data, children2 = _ref.children, width = _ref.width, height = _ref.height, _ref$padding = _ref.padding, padding = _ref$padding === void 0 ? 2 : _ref$padding, _ref$dataKey = _ref.dataKey, dataKey = _ref$dataKey === void 0 ? "value" : _ref$dataKey, _ref$ringPadding = _ref.ringPadding, ringPadding = _ref$ringPadding === void 0 ? 2 : _ref$ringPadding, _ref$innerRadius = _ref.innerRadius, innerRadius = _ref$innerRadius === void 0 ? 50 : _ref$innerRadius, _ref$fill = _ref.fill, fill = _ref$fill === void 0 ? "#333" : _ref$fill, _ref$stroke = _ref.stroke, stroke = _ref$stroke === void 0 ? "#FFF" : _ref$stroke, _ref$textOptions = _ref.textOptions, textOptions = _ref$textOptions === void 0 ? defaultTextProps : _ref$textOptions, _ref$outerRadius = _ref.outerRadius, outerRadius = _ref$outerRadius === void 0 ? Math.min(width, height) / 2 : _ref$outerRadius, _ref$cx = _ref.cx, cx = _ref$cx === void 0 ? width / 2 : _ref$cx, _ref$cy = _ref.cy, cy = _ref$cy === void 0 ? height / 2 : _ref$cy, _ref$startAngle = _ref.startAngle, startAngle = _ref$startAngle === void 0 ? 0 : _ref$startAngle, _ref$endAngle = _ref.endAngle, endAngle = _ref$endAngle === void 0 ? 360 : _ref$endAngle, onClick = _ref.onClick, onMouseEnter = _ref.onMouseEnter, onMouseLeave = _ref.onMouseLeave;
var _useState = (0, import_react63.useState)(false), _useState2 = _slicedToArray14(_useState, 2), isTooltipActive = _useState2[0], setIsTooltipActive = _useState2[1];
var _useState3 = (0, import_react63.useState)(null), _useState4 = _slicedToArray14(_useState3, 2), activeNode = _useState4[0], setActiveNode = _useState4[1];
var rScale = linear2([0, data[dataKey]], [0, endAngle]);
var treeDepth = getMaxDepthOf(data);
var thickness = (outerRadius - innerRadius) / treeDepth;
var sectors = [];
var positions = /* @__PURE__ */ new Map([]);
function handleMouseEnter(node, e) {
if (onMouseEnter) onMouseEnter(node, e);
setActiveNode(node);
setIsTooltipActive(true);
}
function handleMouseLeave(node, e) {
if (onMouseLeave) onMouseLeave(node, e);
setActiveNode(null);
setIsTooltipActive(false);
}
function handleClick(node) {
if (onClick) onClick(node);
}
function drawArcs(childNodes, options) {
var radius = options.radius, innerR = options.innerR, initialAngle = options.initialAngle, childColor = options.childColor;
var currentAngle = initialAngle;
if (!childNodes) return;
childNodes.forEach(function(d) {
var _ref2, _d$fill;
var arcLength = rScale(d[dataKey]);
var start = currentAngle;
var fillColor = (_ref2 = (_d$fill = d === null || d === void 0 ? void 0 : d.fill) !== null && _d$fill !== void 0 ? _d$fill : childColor) !== null && _ref2 !== void 0 ? _ref2 : fill;
var _polarToCartesian = polarToCartesian(0, 0, innerR + radius / 2, -(start + arcLength - arcLength / 2)), textX = _polarToCartesian.x, textY = _polarToCartesian.y;
currentAngle += arcLength;
sectors.push(
// TODO: Missing key warning. Can we use `key={d.name}`?
import_react63.default.createElement("g", {
"aria-label": d.name,
tabIndex: 0
}, import_react63.default.createElement(Sector, {
onClick: function onClick2() {
return handleClick(d);
},
onMouseEnter: function onMouseEnter2(e) {
return handleMouseEnter(d, e);
},
onMouseLeave: function onMouseLeave2(e) {
return handleMouseLeave(d, e);
},
fill: fillColor,
stroke,
strokeWidth: padding,
startAngle: start,
endAngle: start + arcLength,
innerRadius: innerR,
outerRadius: innerR + radius,
cx,
cy
}), import_react63.default.createElement(Text, _extends43({}, textOptions, {
alignmentBaseline: "middle",
textAnchor: "middle",
x: textX + cx,
y: cy - textY
}), d[dataKey]))
);
var _polarToCartesian2 = polarToCartesian(cx, cy, innerR + radius / 2, start), tooltipX = _polarToCartesian2.x, tooltipY = _polarToCartesian2.y;
positions.set(d.name, {
x: tooltipX,
y: tooltipY
});
return drawArcs(d.children, {
radius,
innerR: innerR + radius + ringPadding,
initialAngle: start,
childColor: fillColor
});
});
}
drawArcs(data.children, {
radius: thickness,
innerR: innerRadius,
initialAngle: startAngle
});
var layerClass = clsx_default("recharts-sunburst", className);
function renderTooltip() {
var tooltipComponent = findChildByType([children2], Tooltip);
if (!tooltipComponent || !activeNode) return null;
var viewBox = {
x: 0,
y: 0,
width,
height
};
return import_react63.default.cloneElement(tooltipComponent, {
viewBox,
coordinate: positions.get(activeNode.name),
payload: [activeNode],
active: isTooltipActive
});
}
return import_react63.default.createElement("div", {
className: clsx_default("recharts-wrapper", className),
style: {
position: "relative",
width,
height
},
role: "region"
}, import_react63.default.createElement(Surface, {
width,
height
}, children2, import_react63.default.createElement(Layer, {
className: layerClass
}, sectors)), renderTooltip());
};
// node_modules/recharts/es6/numberAxis/Funnel.js
var import_react65 = __toESM(require_react());
var import_isFunction29 = __toESM(require_isFunction());
var import_isNumber2 = __toESM(require_isNumber());
var import_isString4 = __toESM(require_isString());
var import_omit2 = __toESM(require_omit());
var import_isEqual10 = __toESM(require_isEqual());
// node_modules/recharts/es6/util/FunnelUtils.js
var import_react64 = __toESM(require_react());
function _typeof61(o) {
"@babel/helpers - typeof";
return _typeof61 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof61(o);
}
function _extends44() {
_extends44 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends44.apply(this, arguments);
}
function ownKeys49(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread49(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys49(Object(t), true).forEach(function(r2) {
_defineProperty55(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys49(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _defineProperty55(obj, key, value) {
key = _toPropertyKey56(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey56(t) {
var i = _toPrimitive56(t, "string");
return "symbol" == _typeof61(i) ? i : i + "";
}
function _toPrimitive56(t, r) {
if ("object" != _typeof61(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof61(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function typeGuardTrapezoidProps(option, props) {
var xValue = "".concat(props.x || option.x);
var x2 = parseInt(xValue, 10);
var yValue = "".concat(props.y || option.y);
var y2 = parseInt(yValue, 10);
var heightValue = "".concat((props === null || props === void 0 ? void 0 : props.height) || (option === null || option === void 0 ? void 0 : option.height));
var height = parseInt(heightValue, 10);
return _objectSpread49(_objectSpread49(_objectSpread49({}, props), getPropsFromShapeOption(option)), {}, {
height,
x: x2,
y: y2
});
}
function FunnelTrapezoid(props) {
return import_react64.default.createElement(Shape, _extends44({
shapeType: "trapezoid",
propTransformer: typeGuardTrapezoidProps
}, props));
}
// node_modules/recharts/es6/numberAxis/Funnel.js
var _Funnel;
function _slicedToArray15(arr, i) {
return _arrayWithHoles16(arr) || _iterableToArrayLimit15(arr, i) || _unsupportedIterableToArray24(arr, i) || _nonIterableRest16();
}
function _nonIterableRest16() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray24(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray24(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray24(o, minLen);
}
function _arrayLikeToArray24(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _iterableToArrayLimit15(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e, n, i, u, a2 = [], f = true, o = false;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t) return;
f = false;
} else for (; !(f = (e = i.call(t)).done) && (a2.push(e.value), a2.length !== l); f = true) ;
} catch (r2) {
o = true, n = r2;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
} finally {
if (o) throw n;
}
}
return a2;
}
}
function _arrayWithHoles16(arr) {
if (Array.isArray(arr)) return arr;
}
function _typeof62(o) {
"@babel/helpers - typeof";
return _typeof62 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof62(o);
}
function _extends45() {
_extends45 = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends45.apply(this, arguments);
}
function ownKeys50(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread50(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys50(Object(t), true).forEach(function(r2) {
_defineProperty56(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys50(Object(t)).forEach(function(r2) {
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
});
}
return e;
}
function _classCallCheck31(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties31(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey57(descriptor.key), descriptor);
}
}
function _createClass31(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties31(Constructor.prototype, protoProps);
if (staticProps) _defineProperties31(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _callSuper26(t, o, e) {
return o = _getPrototypeOf28(o), _possibleConstructorReturn28(t, _isNativeReflectConstruct28() ? Reflect.construct(o, e || [], _getPrototypeOf28(t).constructor) : o.apply(t, e));
}
function _possibleConstructorReturn28(self2, call) {
if (call && (_typeof62(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized29(self2);
}
function _assertThisInitialized29(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _isNativeReflectConstruct28() {
try {
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (t4) {
}
return (_isNativeReflectConstruct28 = function _isNativeReflectConstruct29() {
return !!t;
})();
}
function _getPrototypeOf28(o) {
_getPrototypeOf28 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf29(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf28(o);
}
function _inherits28(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
Object.defineProperty(subClass, "prototype", { writable: false });
if (superClass) _setPrototypeOf29(subClass, superClass);
}
function _setPrototypeOf29(o, p) {
_setPrototypeOf29 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf30(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf29(o, p);
}
function _defineProperty56(obj, key, value) {
key = _toPropertyKey57(key);
if (key in obj) {
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey57(t) {
var i = _toPrimitive57(t, "string");
return "symbol" == _typeof62(i) ? i : i + "";
}
function _toPrimitive57(t, r) {
if ("object" != _typeof62(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof62(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var Funnel = function(_PureComponent) {
function Funnel2() {
var _this;
_classCallCheck31(this, Funnel2);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper26(this, Funnel2, [].concat(args));
_defineProperty56(_this, "state", {
isAnimationFinished: false
});
_defineProperty56(_this, "handleAnimationEnd", function() {
var onAnimationEnd2 = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if ((0, import_isFunction29.default)(onAnimationEnd2)) {
onAnimationEnd2();
}
});
_defineProperty56(_this, "handleAnimationStart", function() {
var onAnimationStart2 = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if ((0, import_isFunction29.default)(onAnimationStart2)) {
onAnimationStart2();
}
});
return _this;
}
_inherits28(Funnel2, _PureComponent);
return _createClass31(Funnel2, [{
key: "isActiveIndex",
value: function isActiveIndex(i) {
var activeIndex = this.props.activeIndex;
if (Array.isArray(activeIndex)) {
return activeIndex.indexOf(i) !== -1;
}
return i === activeIndex;
}
}, {
key: "renderTrapezoidsStatically",
value: function renderTrapezoidsStatically(trapezoids) {
var _this2 = this;
var _this$props = this.props, shape = _this$props.shape, activeShape = _this$props.activeShape;
return trapezoids.map(function(entry, i) {
var trapezoidOptions = _this2.isActiveIndex(i) ? activeShape : shape;
var trapezoidProps = _objectSpread50(_objectSpread50({}, entry), {}, {
isActive: _this2.isActiveIndex(i),
stroke: entry.stroke
});
return import_react65.default.createElement(Layer, _extends45({
className: "recharts-funnel-trapezoid"
}, adaptEventsOfChild(_this2.props, entry, i), {
key: "trapezoid-".concat(entry === null || entry === void 0 ? void 0 : entry.x, "-").concat(entry === null || entry === void 0 ? void 0 : entry.y, "-").concat(entry === null || entry === void 0 ? void 0 : entry.name, "-").concat(entry === null || entry === void 0 ? void 0 : entry.value),
role: "img"
}), import_react65.default.createElement(FunnelTrapezoid, _extends45({
option: trapezoidOptions
}, trapezoidProps)));
});
}
}, {
key: "renderTrapezoidsWithAnimation",
value: function renderTrapezoidsWithAnimation() {
var _this3 = this;
var _this$props2 = this.props, trapezoids = _this$props2.trapezoids, isAnimationActive = _this$props2.isAnimationActive, animationBegin = _this$props2.animationBegin, animationDuration = _this$props2.animationDuration, animationEasing = _this$props2.animationEasing, animationId = _this$props2.animationId;
var prevTrapezoids = this.state.prevTrapezoids;
return import_react65.default.createElement(es6_default, {
begin: animationBegin,
duration: animationDuration,
isActive: isAnimationActive,
easing: animationEasing,
from: {
t: 0
},
to: {
t: 1
},
key: "funnel-".concat(animationId),
onAnimationStart: this.handleAnimationStart,
onAnimationEnd: this.handleAnimationEnd
}, function(_ref) {
var t = _ref.t;
var stepData = trapezoids.map(function(entry, index3) {
var prev = prevTrapezoids && prevTrapezoids[index3];
if (prev) {
var _interpolatorX = interpolateNumber(prev.x, entry.x);
var _interpolatorY = interpolateNumber(prev.y, entry.y);
var _interpolatorUpperWidth = interpolateNumber(prev.upperWidth, entry.upperWidth);
var _interpolatorLowerWidth = interpolateNumber(prev.lowerWidth, entry.lowerWidth);
var _interpolatorHeight = interpolateNumber(prev.height, entry.height);
return _objectSpread50(_objectSpread50({}, entry), {}, {
x: _interpolatorX(t),
y: _interpolatorY(t),
upperWidth: _interpolatorUpperWidth(t),
lowerWidth: _interpolatorLowerWidth(t),
height: _interpolatorHeight(t)
});
}
var interpolatorX = interpolateNumber(entry.x + entry.upperWidth / 2, entry.x);
var interpolatorY = interpolateNumber(entry.y + entry.height / 2, entry.y);
var interpolatorUpperWidth = interpolateNumber(0, entry.upperWidth);
var interpolatorLowerWidth = interpolateNumber(0, entry.lowerWidth);
var interpolatorHeight = interpolateNumber(0, entry.height);
return _objectSpread50(_objectSpread50({}, entry), {}, {
x: interpolatorX(t),
y: interpolatorY(t),
upperWidth: interpolatorUpperWidth(t),
lowerWidth: interpolatorLowerWidth(t),
height: interpolatorHeight(t)
});
});
return import_react65.default.createElement(Layer, null, _this3.renderTrapezoidsStatically(stepData));
});
}
}, {
key: "renderTrapezoids",
value: function renderTrapezoids() {
var _this$props3 = this.props, trapezoids = _this$props3.trapezoids, isAnimationActive = _this$props3.isAnimationActive;
var prevTrapezoids = this.state.prevTrapezoids;
if (isAnimationActive && trapezoids && trapezoids.length && (!prevTrapezoids || !(0, import_isEqual10.default)(prevTrapezoids, trapezoids))) {
return this.renderTrapezoidsWithAnimation();
}
return this.renderTrapezoidsStatically(trapezoids);
}
}, {
key: "render",
value: function render() {
var _this$props4 = this.props, hide = _this$props4.hide, trapezoids = _this$props4.trapezoids, className = _this$props4.className, isAnimationActive = _this$props4.isAnimationActive;
var isAnimationFinished = this.state.isAnimationFinished;
if (hide || !trapezoids || !trapezoids.length) {
return null;
}
var layerClass = clsx_default("recharts-trapezoids", className);
return import_react65.default.createElement(Layer, {
className: layerClass
}, this.renderTrapezoids(), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, trapezoids));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.animationId !== prevState.prevAnimationId) {
return {
prevAnimationId: nextProps.animationId,
curTrapezoids: nextProps.trapezoids,
prevTrapezoids: prevState.curTrapezoids
};
}
if (nextProps.trapezoids !== prevState.curTrapezoids) {
return {
curTrapezoids: nextProps.trapezoids
};
}
return null;
}
}]);
}(import_react65.PureComponent);
_Funnel = Funnel;
_defineProperty56(Funnel, "displayName", "Funnel");
_defineProperty56(Funnel, "defaultProps", {
stroke: "#fff",
fill: "#808080",
legendType: "rect",
labelLine: true,
hide: false,
isAnimationActive: !Global.isSsr,
animationBegin: 400,
animationDuration: 1500,
animationEasing: "ease",
nameKey: "name",
lastShapeType: "triangle"
});
_defineProperty56(Funnel, "getRealFunnelData", function(item) {
var _item$props = item.props, data = _item$props.data, children2 = _item$props.children;
var presentationProps = filterProps(item.props, false);
var cells = findAllByType(children2, Cell);
if (data && data.length) {
return data.map(function(entry, index3) {
return _objectSpread50(_objectSpread50(_objectSpread50({
payload: entry
}, presentationProps), entry), cells && cells[index3] && cells[index3].props);
});
}
if (cells && cells.length) {
return cells.map(function(cell) {
return _objectSpread50(_objectSpread50({}, presentationProps), cell.props);
});
}
return [];
});
_defineProperty56(Funnel, "getRealWidthHeight", function(item, offset) {
var customWidth = item.props.width;
var width = offset.width, height = offset.height, left = offset.left, right = offset.right, top = offset.top, bottom = offset.bottom;
var realHeight = height;
var realWidth = width;
if ((0, import_isNumber2.default)(customWidth)) {
realWidth = customWidth;
} else if ((0, import_isString4.default)(customWidth)) {
realWidth = realWidth * parseFloat(customWidth) / 100;
}
return {
realWidth: realWidth - left - right - 50,
realHeight: realHeight - bottom - top,
offsetX: (width - realWidth) / 2,
offsetY: (height - realHeight) / 2
};
});
_defineProperty56(Funnel, "getComposedData", function(_ref2) {
var item = _ref2.item, offset = _ref2.offset;
var funnelData = _Funnel.getRealFunnelData(item);
var _item$props2 = item.props, dataKey = _item$props2.dataKey, nameKey = _item$props2.nameKey, tooltipType = _item$props2.tooltipType, lastShapeType = _item$props2.lastShapeType, reversed = _item$props2.reversed;
var left = offset.left, top = offset.top;
var _Funnel$getRealWidthH = _Funnel.getRealWidthHeight(item, offset), realHeight = _Funnel$getRealWidthH.realHeight, realWidth = _Funnel$getRealWidthH.realWidth, offsetX = _Funnel$getRealWidthH.offsetX, offsetY = _Funnel$getRealWidthH.offsetY;
var maxValue = Math.max.apply(null, funnelData.map(function(entry) {
return getValueByDataKey(entry, dataKey, 0);
}));
var len = funnelData.length;
var rowHeight = realHeight / len;
var parentViewBox = {
x: offset.left,
y: offset.top,
width: offset.width,
height: offset.height
};
var trapezoids = funnelData.map(function(entry, i) {
var rawVal = getValueByDataKey(entry, dataKey, 0);
var name = getValueByDataKey(entry, nameKey, i);
var val = rawVal;
var nextVal;
if (i !== len - 1) {
nextVal = getValueByDataKey(funnelData[i + 1], dataKey, 0);
if (nextVal instanceof Array) {
var _nextVal = nextVal;
var _nextVal2 = _slicedToArray15(_nextVal, 1);
nextVal = _nextVal2[0];
}
} else if (rawVal instanceof Array && rawVal.length === 2) {
var _rawVal = _slicedToArray15(rawVal, 2);
val = _rawVal[0];
nextVal = _rawVal[1];
} else if (lastShapeType === "rectangle") {
nextVal = val;
} else {
nextVal = 0;
}
var x2 = (maxValue - val) * realWidth / (2 * maxValue) + top + 25 + offsetX;
var y2 = rowHeight * i + left + offsetY;
var upperWidth = val / maxValue * realWidth;
var lowerWidth = nextVal / maxValue * realWidth;
var tooltipPayload = [{
name,
value: val,
payload: entry,
dataKey,
type: tooltipType
}];
var tooltipPosition = {
x: x2 + upperWidth / 2,
y: y2 + rowHeight / 2
};
return _objectSpread50(_objectSpread50({
x: x2,
y: y2,
width: Math.max(upperWidth, lowerWidth),
upperWidth,
lowerWidth,
height: rowHeight,
name,
val,
tooltipPayload,
tooltipPosition
}, (0, import_omit2.default)(entry, "width")), {}, {
payload: entry,
parentViewBox,
labelViewBox: {
x: x2 + (upperWidth - lowerWidth) / 4,
y: y2,
width: Math.abs(upperWidth - lowerWidth) / 2 + Math.min(upperWidth, lowerWidth),
height: rowHeight
}
});
});
if (reversed) {
trapezoids = trapezoids.map(function(entry, index3) {
var newY = entry.y - index3 * rowHeight + (len - 1 - index3) * rowHeight;
return _objectSpread50(_objectSpread50({}, entry), {}, {
upperWidth: entry.lowerWidth,
lowerWidth: entry.upperWidth,
x: entry.x - (entry.lowerWidth - entry.upperWidth) / 2,
y: entry.y - index3 * rowHeight + (len - 1 - index3) * rowHeight,
tooltipPosition: _objectSpread50(_objectSpread50({}, entry.tooltipPosition), {}, {
y: newY + rowHeight / 2
}),
labelViewBox: _objectSpread50(_objectSpread50({}, entry.labelViewBox), {}, {
y: newY
})
});
});
}
return {
trapezoids,
data: funnelData
};
});
// node_modules/recharts/es6/chart/FunnelChart.js
var FunnelChart = generateCategoricalChart({
chartName: "FunnelChart",
GraphicalChild: Funnel,
validateTooltipEventTypes: ["item"],
defaultTooltipEventType: "item",
axisComponents: [],
defaultProps: {
layout: "centric"
}
});
export {
Area,
AreaChart,
Bar,
BarChart,
Brush,
CartesianAxis,
CartesianGrid,
Cell,
ComposedChart,
Cross,
Curve,
Customized,
DefaultLegendContent,
DefaultTooltipContent,
Dot,
ErrorBar,
Funnel,
FunnelChart,
Global,
Label,
LabelList,
Layer,
Legend,
Line,
LineChart,
Pie,
PieChart,
PolarAngleAxis,
PolarGrid,
PolarRadiusAxis,
Polygon,
Radar,
RadarChart,
RadialBar,
RadialBarChart,
Rectangle,
ReferenceArea,
ReferenceDot,
ReferenceLine,
ResponsiveContainer,
Sankey,
Scatter,
ScatterChart,
Sector,
SunburstChart,
Surface,
Symbols,
Text,
Tooltip,
Trapezoid,
Treemap,
XAxis,
YAxis,
ZAxis
};
/*! Bundled license information:
react-is/cjs/react-is.development.js:
(**
* @license React
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
*/
//# sourceMappingURL=recharts.js.map