main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

58
node_modules/recharts/lib/shape/Cross.js generated vendored Normal file
View File

@@ -0,0 +1,58 @@
"use strict";
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Cross = void 0;
var _react = _interopRequireDefault(require("react"));
var _clsx = _interopRequireDefault(require("clsx"));
var _DataUtils = require("../util/DataUtils");
var _ReactUtils = require("../util/ReactUtils");
var _excluded = ["x", "y", "top", "left", "width", "height", "className"];
/**
* @fileOverview Cross
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _extends() { _extends = 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 _extends.apply(this, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(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 _objectWithoutPropertiesLoose(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; }
var getPath = function getPath(x, y, width, height, top, left) {
return "M".concat(x, ",").concat(top, "v").concat(height, "M").concat(left, ",").concat(y, "h").concat(width);
};
var Cross = exports.Cross = function Cross(_ref) {
var _ref$x = _ref.x,
x = _ref$x === void 0 ? 0 : _ref$x,
_ref$y = _ref.y,
y = _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 = _objectWithoutProperties(_ref, _excluded);
var props = _objectSpread({
x: x,
y: y,
top: top,
left: left,
width: width,
height: height
}, rest);
if (!(0, _DataUtils.isNumber)(x) || !(0, _DataUtils.isNumber)(y) || !(0, _DataUtils.isNumber)(width) || !(0, _DataUtils.isNumber)(height) || !(0, _DataUtils.isNumber)(top) || !(0, _DataUtils.isNumber)(left)) {
return null;
}
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
className: (0, _clsx["default"])('recharts-cross', className),
d: getPath(x, y, width, height, top, left)
}));
};

122
node_modules/recharts/lib/shape/Curve.js generated vendored Normal file
View File

@@ -0,0 +1,122 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPath = exports.Curve = void 0;
var _react = _interopRequireDefault(require("react"));
var _d3Shape = require("victory-vendor/d3-shape");
var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
var _clsx = _interopRequireDefault(require("clsx"));
var _types = require("../util/types");
var _ReactUtils = require("../util/ReactUtils");
var _DataUtils = require("../util/DataUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { _extends = 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 _extends.apply(this, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
* @fileOverview Curve
*/
var CURVE_FACTORIES = {
curveBasisClosed: _d3Shape.curveBasisClosed,
curveBasisOpen: _d3Shape.curveBasisOpen,
curveBasis: _d3Shape.curveBasis,
curveBumpX: _d3Shape.curveBumpX,
curveBumpY: _d3Shape.curveBumpY,
curveLinearClosed: _d3Shape.curveLinearClosed,
curveLinear: _d3Shape.curveLinear,
curveMonotoneX: _d3Shape.curveMonotoneX,
curveMonotoneY: _d3Shape.curveMonotoneY,
curveNatural: _d3Shape.curveNatural,
curveStep: _d3Shape.curveStep,
curveStepAfter: _d3Shape.curveStepAfter,
curveStepBefore: _d3Shape.curveStepBefore
};
var defined = function defined(p) {
return p.x === +p.x && p.y === +p.y;
};
var getX = function getX(p) {
return p.x;
};
var getY = function getY(p) {
return p.y;
};
var getCurveFactory = function getCurveFactory(type, layout) {
if ((0, _isFunction["default"])(type)) {
return type;
}
var name = "curve".concat((0, _upperFirst["default"])(type));
if ((name === 'curveMonotone' || name === 'curveBump') && layout) {
return CURVE_FACTORIES["".concat(name).concat(layout === 'vertical' ? 'Y' : 'X')];
}
return CURVE_FACTORIES[name] || _d3Shape.curveLinear;
};
/**
* Calculate the path of curve. Returns null if points is an empty array.
* @return path or null
*/
var getPath = exports.getPath = function getPath(_ref) {
var _ref$type = _ref.type,
type = _ref$type === void 0 ? 'linear' : _ref$type,
_ref$points = _ref.points,
points = _ref$points === void 0 ? [] : _ref$points,
baseLine = _ref.baseLine,
layout = _ref.layout,
_ref$connectNulls = _ref.connectNulls,
connectNulls = _ref$connectNulls === void 0 ? false : _ref$connectNulls;
var curveFactory = getCurveFactory(type, layout);
var formatPoints = connectNulls ? points.filter(function (entry) {
return defined(entry);
}) : points;
var lineFunction;
if (Array.isArray(baseLine)) {
var formatBaseLine = connectNulls ? baseLine.filter(function (base) {
return defined(base);
}) : baseLine;
var areaPoints = formatPoints.map(function (entry, index) {
return _objectSpread(_objectSpread({}, entry), {}, {
base: formatBaseLine[index]
});
});
if (layout === 'vertical') {
lineFunction = (0, _d3Shape.area)().y(getY).x1(getX).x0(function (d) {
return d.base.x;
});
} else {
lineFunction = (0, _d3Shape.area)().x(getX).y1(getY).y0(function (d) {
return d.base.y;
});
}
lineFunction.defined(defined).curve(curveFactory);
return lineFunction(areaPoints);
}
if (layout === 'vertical' && (0, _DataUtils.isNumber)(baseLine)) {
lineFunction = (0, _d3Shape.area)().y(getY).x1(getX).x0(baseLine);
} else if ((0, _DataUtils.isNumber)(baseLine)) {
lineFunction = (0, _d3Shape.area)().x(getX).y1(getY).y0(baseLine);
} else {
lineFunction = (0, _d3Shape.line)().x(getX).y(getY);
}
lineFunction.defined(defined).curve(curveFactory);
return lineFunction(formatPoints);
};
var Curve = exports.Curve = function Curve(props) {
var className = props.className,
points = props.points,
path = props.path,
pathRef = props.pathRef;
if ((!points || !points.length) && !path) {
return null;
}
var realPath = points && points.length ? getPath(props) : path;
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, false), (0, _types.adaptEventHandlers)(props), {
className: (0, _clsx["default"])('recharts-curve', className),
d: realPath,
ref: pathRef
}));
};

30
node_modules/recharts/lib/shape/Dot.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Dot = void 0;
var _react = _interopRequireDefault(require("react"));
var _clsx = _interopRequireDefault(require("clsx"));
var _types = require("../util/types");
var _ReactUtils = require("../util/ReactUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _extends() { _extends = 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 _extends.apply(this, arguments); } /**
* @fileOverview Dot
*/
var Dot = exports.Dot = function Dot(props) {
var cx = props.cx,
cy = props.cy,
r = props.r,
className = props.className;
var layerClass = (0, _clsx["default"])('recharts-dot', className);
if (cx === +cx && cy === +cy && r === +r) {
return /*#__PURE__*/_react["default"].createElement("circle", _extends({}, (0, _ReactUtils.filterProps)(props, false), (0, _types.adaptEventHandlers)(props), {
className: layerClass,
cx: cx,
cy: cy,
r: r
}));
}
return null;
};

96
node_modules/recharts/lib/shape/Polygon.js generated vendored Normal file
View File

@@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Polygon = void 0;
var _react = _interopRequireDefault(require("react"));
var _clsx = _interopRequireDefault(require("clsx"));
var _ReactUtils = require("../util/ReactUtils");
var _excluded = ["points", "className", "baseLinePoints", "connectNulls"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _extends() { _extends = 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 _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(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 _objectWithoutPropertiesLoose(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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { 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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(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 _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(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; } /**
* @fileOverview Polygon
*/
var isValidatePoint = function isValidatePoint(point) {
return point && point.x === +point.x && point.y === +point.y;
};
var getParsedPoints = function getParsedPoints() {
var points = arguments.length > 0 && arguments[0] !== undefined ? 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) {
// add another path
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 getSinglePolygonPath(points, connectNulls) {
var segmentPoints = getParsedPoints(points);
if (connectNulls) {
segmentPoints = [segmentPoints.reduce(function (res, segPoints) {
return [].concat(_toConsumableArray(res), _toConsumableArray(segPoints));
}, [])];
}
var polygonPath = segmentPoints.map(function (segPoints) {
return segPoints.reduce(function (path, point, index) {
return "".concat(path).concat(index === 0 ? 'M' : 'L').concat(point.x, ",").concat(point.y);
}, '');
}).join('');
return segmentPoints.length === 1 ? "".concat(polygonPath, "Z") : polygonPath;
};
var getRanglePath = function getRanglePath(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 = exports.Polygon = function Polygon(props) {
var points = props.points,
className = props.className,
baseLinePoints = props.baseLinePoints,
connectNulls = props.connectNulls,
others = _objectWithoutProperties(props, _excluded);
if (!points || !points.length) {
return null;
}
var layerClass = (0, _clsx["default"])('recharts-polygon', className);
if (baseLinePoints && baseLinePoints.length) {
var hasStroke = others.stroke && others.stroke !== 'none';
var rangePath = getRanglePath(points, baseLinePoints, connectNulls);
return /*#__PURE__*/_react["default"].createElement("g", {
className: layerClass
}, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
fill: rangePath.slice(-1) === 'Z' ? others.fill : 'none',
stroke: "none",
d: rangePath
})), hasStroke ? /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
fill: "none",
d: getSinglePolygonPath(points, connectNulls)
})) : null, hasStroke ? /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
fill: "none",
d: getSinglePolygonPath(baseLinePoints, connectNulls)
})) : null);
}
var singlePath = getSinglePolygonPath(points, connectNulls);
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
fill: singlePath.slice(-1) === 'Z' ? others.fill : 'none',
className: layerClass,
d: singlePath
}));
};

176
node_modules/recharts/lib/shape/Rectangle.js generated vendored Normal file
View File

@@ -0,0 +1,176 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isInRectangle = exports.Rectangle = void 0;
var _react = _interopRequireWildcard(require("react"));
var _clsx = _interopRequireDefault(require("clsx"));
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
var _ReactUtils = require("../util/ReactUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { _extends = 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 _extends.apply(this, arguments); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { 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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(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 _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(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 _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
* @fileOverview Rectangle
*/
var getRectanglePath = function getRectanglePath(x, y, 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 path;
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];
}
path = "M".concat(x, ",").concat(y + ySign * newRadius[0]);
if (newRadius[0] > 0) {
path += "A ".concat(newRadius[0], ",").concat(newRadius[0], ",0,0,").concat(clockWise, ",").concat(x + xSign * newRadius[0], ",").concat(y);
}
path += "L ".concat(x + width - xSign * newRadius[1], ",").concat(y);
if (newRadius[1] > 0) {
path += "A ".concat(newRadius[1], ",").concat(newRadius[1], ",0,0,").concat(clockWise, ",\n ").concat(x + width, ",").concat(y + ySign * newRadius[1]);
}
path += "L ".concat(x + width, ",").concat(y + height - ySign * newRadius[2]);
if (newRadius[2] > 0) {
path += "A ".concat(newRadius[2], ",").concat(newRadius[2], ",0,0,").concat(clockWise, ",\n ").concat(x + width - xSign * newRadius[2], ",").concat(y + height);
}
path += "L ".concat(x + xSign * newRadius[3], ",").concat(y + height);
if (newRadius[3] > 0) {
path += "A ".concat(newRadius[3], ",").concat(newRadius[3], ",0,0,").concat(clockWise, ",\n ").concat(x, ",").concat(y + height - ySign * newRadius[3]);
}
path += 'Z';
} else if (maxRadius > 0 && radius === +radius && radius > 0) {
var _newRadius = Math.min(maxRadius, radius);
path = "M ".concat(x, ",").concat(y + ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + xSign * _newRadius, ",").concat(y, "\n L ").concat(x + width - xSign * _newRadius, ",").concat(y, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + width, ",").concat(y + ySign * _newRadius, "\n L ").concat(x + width, ",").concat(y + height - ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + width - xSign * _newRadius, ",").concat(y + height, "\n L ").concat(x + xSign * _newRadius, ",").concat(y + height, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x, ",").concat(y + height - ySign * _newRadius, " Z");
} else {
path = "M ".concat(x, ",").concat(y, " h ").concat(width, " v ").concat(height, " h ").concat(-width, " Z");
}
return path;
};
var isInRectangle = exports.isInRectangle = function isInRectangle(point, rect) {
if (!point || !rect) {
return false;
}
var px = point.x,
py = point.y;
var x = rect.x,
y = rect.y,
width = rect.width,
height = rect.height;
if (Math.abs(width) > 0 && Math.abs(height) > 0) {
var minX = Math.min(x, x + width);
var maxX = Math.max(x, x + width);
var minY = Math.min(y, y + height);
var maxY = Math.max(y, y + height);
return px >= minX && px <= maxX && py >= minY && py <= maxY;
}
return false;
};
var defaultProps = {
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 = exports.Rectangle = function Rectangle(rectangleProps) {
var props = _objectSpread(_objectSpread({}, defaultProps), rectangleProps);
var pathRef = (0, _react.useRef)();
var _useState = (0, _react.useState)(-1),
_useState2 = _slicedToArray(_useState, 2),
totalLength = _useState2[0],
setTotalLength = _useState2[1];
(0, _react.useEffect)(function () {
if (pathRef.current && pathRef.current.getTotalLength) {
try {
var pathTotalLength = pathRef.current.getTotalLength();
if (pathTotalLength) {
setTotalLength(pathTotalLength);
}
} catch (err) {
// calculate total length error
}
}
}, []);
var x = props.x,
y = 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 (x !== +x || y !== +y || width !== +width || height !== +height || width === 0 || height === 0) {
return null;
}
var layerClass = (0, _clsx["default"])('recharts-rectangle', className);
if (!isUpdateAnimationActive) {
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
className: layerClass,
d: getRectanglePath(x, y, width, height, radius)
}));
}
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
canBegin: totalLength > 0,
from: {
width: width,
height: height,
x: x,
y: y
},
to: {
width: width,
height: height,
x: x,
y: y
},
duration: animationDuration,
animationEasing: animationEasing,
isActive: isUpdateAnimationActive
}, function (_ref) {
var currWidth = _ref.width,
currHeight = _ref.height,
currX = _ref.x,
currY = _ref.y;
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["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
}, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
className: layerClass,
d: getRectanglePath(currX, currY, currWidth, currHeight, radius),
ref: pathRef
})));
});
};

219
node_modules/recharts/lib/shape/Sector.js generated vendored Normal file
View File

@@ -0,0 +1,219 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Sector = void 0;
var _react = _interopRequireDefault(require("react"));
var _clsx = _interopRequireDefault(require("clsx"));
var _ReactUtils = require("../util/ReactUtils");
var _PolarUtils = require("../util/PolarUtils");
var _DataUtils = require("../util/DataUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { _extends = 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 _extends.apply(this, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
* @fileOverview Sector
*/
var getDeltaAngle = function getDeltaAngle(startAngle, endAngle) {
var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 359.999);
return sign * deltaAngle;
};
var getTangentCircle = function getTangentCircle(_ref) {
var cx = _ref.cx,
cy = _ref.cy,
radius = _ref.radius,
angle = _ref.angle,
sign = _ref.sign,
isExternal = _ref.isExternal,
cornerRadius = _ref.cornerRadius,
cornerIsExternal = _ref.cornerIsExternal;
var centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius;
var theta = Math.asin(cornerRadius / centerRadius) / _PolarUtils.RADIAN;
var centerAngle = cornerIsExternal ? angle : angle + sign * theta;
var center = (0, _PolarUtils.polarToCartesian)(cx, cy, centerRadius, centerAngle);
// The coordinate of point which is tangent to the circle
var circleTangency = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, centerAngle);
// The coordinate of point which is tangent to the radius line
var lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle;
var lineTangency = (0, _PolarUtils.polarToCartesian)(cx, cy, centerRadius * Math.cos(theta * _PolarUtils.RADIAN), lineTangencyAngle);
return {
center: center,
circleTangency: circleTangency,
lineTangency: lineTangency,
theta: theta
};
};
var getSectorPath = function getSectorPath(_ref2) {
var cx = _ref2.cx,
cy = _ref2.cy,
innerRadius = _ref2.innerRadius,
outerRadius = _ref2.outerRadius,
startAngle = _ref2.startAngle,
endAngle = _ref2.endAngle;
var angle = getDeltaAngle(startAngle, endAngle);
// When the angle of sector equals to 360, star point and end point coincide
var tempEndAngle = startAngle + angle;
var outerStartPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius, startAngle);
var outerEndPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius, tempEndAngle);
var path = "M ".concat(outerStartPoint.x, ",").concat(outerStartPoint.y, "\n A ").concat(outerRadius, ",").concat(outerRadius, ",0,\n ").concat(+(Math.abs(angle) > 180), ",").concat(+(startAngle > tempEndAngle), ",\n ").concat(outerEndPoint.x, ",").concat(outerEndPoint.y, "\n ");
if (innerRadius > 0) {
var innerStartPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, innerRadius, startAngle);
var innerEndPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, innerRadius, tempEndAngle);
path += "L ".concat(innerEndPoint.x, ",").concat(innerEndPoint.y, "\n A ").concat(innerRadius, ",").concat(innerRadius, ",0,\n ").concat(+(Math.abs(angle) > 180), ",").concat(+(startAngle <= tempEndAngle), ",\n ").concat(innerStartPoint.x, ",").concat(innerStartPoint.y, " Z");
} else {
path += "L ".concat(cx, ",").concat(cy, " Z");
}
return path;
};
var getSectorWithCorner = function getSectorWithCorner(_ref3) {
var cx = _ref3.cx,
cy = _ref3.cy,
innerRadius = _ref3.innerRadius,
outerRadius = _ref3.outerRadius,
cornerRadius = _ref3.cornerRadius,
forceCornerRadius = _ref3.forceCornerRadius,
cornerIsExternal = _ref3.cornerIsExternal,
startAngle = _ref3.startAngle,
endAngle = _ref3.endAngle;
var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
var _getTangentCircle = getTangentCircle({
cx: cx,
cy: cy,
radius: outerRadius,
angle: startAngle,
sign: sign,
cornerRadius: cornerRadius,
cornerIsExternal: cornerIsExternal
}),
soct = _getTangentCircle.circleTangency,
solt = _getTangentCircle.lineTangency,
sot = _getTangentCircle.theta;
var _getTangentCircle2 = getTangentCircle({
cx: cx,
cy: cy,
radius: outerRadius,
angle: endAngle,
sign: -sign,
cornerRadius: cornerRadius,
cornerIsExternal: cornerIsExternal
}),
eoct = _getTangentCircle2.circleTangency,
eolt = _getTangentCircle2.lineTangency,
eot = _getTangentCircle2.theta;
var outerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sot - eot;
if (outerArcAngle < 0) {
if (forceCornerRadius) {
return "M ".concat(solt.x, ",").concat(solt.y, "\n a").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,1,").concat(cornerRadius * 2, ",0\n a").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,1,").concat(-cornerRadius * 2, ",0\n ");
}
return getSectorPath({
cx: cx,
cy: cy,
innerRadius: innerRadius,
outerRadius: outerRadius,
startAngle: startAngle,
endAngle: endAngle
});
}
var path = "M ".concat(solt.x, ",").concat(solt.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(soct.x, ",").concat(soct.y, "\n A").concat(outerRadius, ",").concat(outerRadius, ",0,").concat(+(outerArcAngle > 180), ",").concat(+(sign < 0), ",").concat(eoct.x, ",").concat(eoct.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(eolt.x, ",").concat(eolt.y, "\n ");
if (innerRadius > 0) {
var _getTangentCircle3 = getTangentCircle({
cx: cx,
cy: cy,
radius: innerRadius,
angle: startAngle,
sign: sign,
isExternal: true,
cornerRadius: cornerRadius,
cornerIsExternal: cornerIsExternal
}),
sict = _getTangentCircle3.circleTangency,
silt = _getTangentCircle3.lineTangency,
sit = _getTangentCircle3.theta;
var _getTangentCircle4 = getTangentCircle({
cx: cx,
cy: cy,
radius: innerRadius,
angle: endAngle,
sign: -sign,
isExternal: true,
cornerRadius: cornerRadius,
cornerIsExternal: cornerIsExternal
}),
eict = _getTangentCircle4.circleTangency,
eilt = _getTangentCircle4.lineTangency,
eit = _getTangentCircle4.theta;
var innerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sit - eit;
if (innerArcAngle < 0 && cornerRadius === 0) {
return "".concat(path, "L").concat(cx, ",").concat(cy, "Z");
}
path += "L".concat(eilt.x, ",").concat(eilt.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(eict.x, ",").concat(eict.y, "\n A").concat(innerRadius, ",").concat(innerRadius, ",0,").concat(+(innerArcAngle > 180), ",").concat(+(sign > 0), ",").concat(sict.x, ",").concat(sict.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(silt.x, ",").concat(silt.y, "Z");
} else {
path += "L".concat(cx, ",").concat(cy, "Z");
}
return path;
};
var defaultProps = {
cx: 0,
cy: 0,
innerRadius: 0,
outerRadius: 0,
startAngle: 0,
endAngle: 0,
cornerRadius: 0,
forceCornerRadius: false,
cornerIsExternal: false
};
var Sector = exports.Sector = function Sector(sectorProps) {
var props = _objectSpread(_objectSpread({}, defaultProps), sectorProps);
var cx = props.cx,
cy = props.cy,
innerRadius = props.innerRadius,
outerRadius = props.outerRadius,
cornerRadius = props.cornerRadius,
forceCornerRadius = props.forceCornerRadius,
cornerIsExternal = props.cornerIsExternal,
startAngle = props.startAngle,
endAngle = props.endAngle,
className = props.className;
if (outerRadius < innerRadius || startAngle === endAngle) {
return null;
}
var layerClass = (0, _clsx["default"])('recharts-sector', className);
var deltaRadius = outerRadius - innerRadius;
var cr = (0, _DataUtils.getPercentValue)(cornerRadius, deltaRadius, 0, true);
var path;
if (cr > 0 && Math.abs(startAngle - endAngle) < 360) {
path = getSectorWithCorner({
cx: cx,
cy: cy,
innerRadius: innerRadius,
outerRadius: outerRadius,
cornerRadius: Math.min(cr, deltaRadius / 2),
forceCornerRadius: forceCornerRadius,
cornerIsExternal: cornerIsExternal,
startAngle: startAngle,
endAngle: endAngle
});
} else {
path = getSectorPath({
cx: cx,
cy: cy,
innerRadius: innerRadius,
outerRadius: outerRadius,
startAngle: startAngle,
endAngle: endAngle
});
}
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
className: layerClass,
d: path,
role: "img"
}));
};

103
node_modules/recharts/lib/shape/Symbols.js generated vendored Normal file
View File

@@ -0,0 +1,103 @@
"use strict";
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Symbols = void 0;
var _react = _interopRequireDefault(require("react"));
var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
var _d3Shape = require("victory-vendor/d3-shape");
var _clsx = _interopRequireDefault(require("clsx"));
var _ReactUtils = require("../util/ReactUtils");
var _excluded = ["type", "size", "sizeType"];
/**
* @fileOverview Curve
*/
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _extends() { _extends = 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 _extends.apply(this, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(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 _objectWithoutPropertiesLoose(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; }
var symbolFactories = {
symbolCircle: _d3Shape.symbolCircle,
symbolCross: _d3Shape.symbolCross,
symbolDiamond: _d3Shape.symbolDiamond,
symbolSquare: _d3Shape.symbolSquare,
symbolStar: _d3Shape.symbolStar,
symbolTriangle: _d3Shape.symbolTriangle,
symbolWye: _d3Shape.symbolWye
};
var RADIAN = Math.PI / 180;
var getSymbolFactory = function getSymbolFactory(type) {
var name = "symbol".concat((0, _upperFirst["default"])(type));
return symbolFactories[name] || _d3Shape.symbolCircle;
};
var calculateAreaSize = function calculateAreaSize(size, sizeType, type) {
if (sizeType === 'area') {
return size;
}
switch (type) {
case 'cross':
return 5 * size * size / 9;
case 'diamond':
return 0.5 * size * size / Math.sqrt(3);
case 'square':
return size * size;
case 'star':
{
var angle = 18 * RADIAN;
return 1.25 * size * size * (Math.tan(angle) - Math.tan(angle * 2) * Math.pow(Math.tan(angle), 2));
}
case 'triangle':
return Math.sqrt(3) * size * size / 4;
case 'wye':
return (21 - 10 * Math.sqrt(3)) * size * size / 8;
default:
return Math.PI * size * size / 4;
}
};
var registerSymbol = function registerSymbol(key, factory) {
symbolFactories["symbol".concat((0, _upperFirst["default"])(key))] = factory;
};
var Symbols = exports.Symbols = function Symbols(_ref) {
var _ref$type = _ref.type,
type = _ref$type === void 0 ? 'circle' : _ref$type,
_ref$size = _ref.size,
size = _ref$size === void 0 ? 64 : _ref$size,
_ref$sizeType = _ref.sizeType,
sizeType = _ref$sizeType === void 0 ? 'area' : _ref$sizeType,
rest = _objectWithoutProperties(_ref, _excluded);
var props = _objectSpread(_objectSpread({}, rest), {}, {
type: type,
size: size,
sizeType: sizeType
});
/**
* Calculate the path of curve
* @return {String} path
*/
var getPath = function getPath() {
var symbolFactory = getSymbolFactory(type);
var symbol = (0, _d3Shape.symbol)().type(symbolFactory).size(calculateAreaSize(size, sizeType, type));
return symbol();
};
var className = props.className,
cx = props.cx,
cy = props.cy;
var filteredProps = (0, _ReactUtils.filterProps)(props, true);
if (cx === +cx && cy === +cy && size === +size) {
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, filteredProps, {
className: (0, _clsx["default"])('recharts-symbols', className),
transform: "translate(".concat(cx, ", ").concat(cy, ")"),
d: getPath()
}));
}
return null;
};
Symbols.registerSymbol = registerSymbol;

128
node_modules/recharts/lib/shape/Trapezoid.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Trapezoid = void 0;
var _react = _interopRequireWildcard(require("react"));
var _clsx = _interopRequireDefault(require("clsx"));
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
var _ReactUtils = require("../util/ReactUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { _extends = 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 _extends.apply(this, arguments); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { 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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(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 _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(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 _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
* @fileOverview Rectangle
*/
var getTrapezoidPath = function getTrapezoidPath(x, y, upperWidth, lowerWidth, height) {
var widthGap = upperWidth - lowerWidth;
var path;
path = "M ".concat(x, ",").concat(y);
path += "L ".concat(x + upperWidth, ",").concat(y);
path += "L ".concat(x + upperWidth - widthGap / 2, ",").concat(y + height);
path += "L ".concat(x + upperWidth - widthGap / 2 - lowerWidth, ",").concat(y + height);
path += "L ".concat(x, ",").concat(y, " Z");
return path;
};
var defaultProps = {
x: 0,
y: 0,
upperWidth: 0,
lowerWidth: 0,
height: 0,
isUpdateAnimationActive: false,
animationBegin: 0,
animationDuration: 1500,
animationEasing: 'ease'
};
var Trapezoid = exports.Trapezoid = function Trapezoid(props) {
var trapezoidProps = _objectSpread(_objectSpread({}, defaultProps), props);
var pathRef = (0, _react.useRef)();
var _useState = (0, _react.useState)(-1),
_useState2 = _slicedToArray(_useState, 2),
totalLength = _useState2[0],
setTotalLength = _useState2[1];
(0, _react.useEffect)(function () {
if (pathRef.current && pathRef.current.getTotalLength) {
try {
var pathTotalLength = pathRef.current.getTotalLength();
if (pathTotalLength) {
setTotalLength(pathTotalLength);
}
} catch (err) {
// calculate total length error
}
}
}, []);
var x = trapezoidProps.x,
y = 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 (x !== +x || y !== +y || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || upperWidth === 0 && lowerWidth === 0 || height === 0) {
return null;
}
var layerClass = (0, _clsx["default"])('recharts-trapezoid', className);
if (!isUpdateAnimationActive) {
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(trapezoidProps, true), {
className: layerClass,
d: getTrapezoidPath(x, y, upperWidth, lowerWidth, height)
})));
}
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
canBegin: totalLength > 0,
from: {
upperWidth: 0,
lowerWidth: 0,
height: height,
x: x,
y: y
},
to: {
upperWidth: upperWidth,
lowerWidth: lowerWidth,
height: height,
x: x,
y: y
},
duration: animationDuration,
animationEasing: animationEasing,
isActive: isUpdateAnimationActive
}, function (_ref) {
var currUpperWidth = _ref.upperWidth,
currLowerWidth = _ref.lowerWidth,
currHeight = _ref.height,
currX = _ref.x,
currY = _ref.y;
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["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
}, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(trapezoidProps, true), {
className: layerClass,
d: getTrapezoidPath(currX, currY, currUpperWidth, currLowerWidth, currHeight),
ref: pathRef
})));
});
};