Add settings page for managing forecasting API key and URL via UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-20 14:37:36 +00:00
parent cae411eae7
commit 1c411e402e
19809 changed files with 1962608 additions and 97 deletions

50
frontend/node_modules/recharts/es6/shape/Cross.js generated vendored Normal file
View file

@ -0,0 +1,50 @@
var _excluded = ["x", "y", "top", "left", "width", "height", "className"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, 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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
/**
* @fileOverview Cross
*/
import * as React from 'react';
import { clsx } from 'clsx';
import { isNumber } from '../util/DataUtils';
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
var getPath = (x, y, width, height, top, left) => {
return "M".concat(x, ",").concat(top, "v").concat(height, "M").concat(left, ",").concat(y, "h").concat(width);
};
export var 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,
y,
top,
left,
width,
height
}, rest);
if (!isNumber(x) || !isNumber(y) || !isNumber(width) || !isNumber(height) || !isNumber(top) || !isNumber(left)) {
return null;
}
return /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(props), {
className: clsx('recharts-cross', className),
d: getPath(x, y, width, height, top, left)
}));
};

146
frontend/node_modules/recharts/es6/shape/Curve.js generated vendored Normal file
View file

@ -0,0 +1,146 @@
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, 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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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
*/
import * as React from 'react';
import { area as shapeArea, curveBasis, curveBasisClosed, curveBasisOpen, curveBumpX, curveBumpY, curveLinear, curveLinearClosed, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore, line as shapeLine } from 'victory-vendor/d3-shape';
import { clsx } from 'clsx';
import { adaptEventHandlers } from '../util/types';
import { isNumber, upperFirst } from '../util/DataUtils';
import { isWellBehavedNumber } from '../util/isWellBehavedNumber';
import { svgPropertiesNoEvents } from '../util/svgPropertiesNoEvents';
import { useChartLayout } from '../context/chartLayoutContext';
var CURVE_FACTORIES = {
curveBasisClosed,
curveBasisOpen,
curveBasis,
curveBumpX,
curveBumpY,
curveLinearClosed,
curveLinear,
curveMonotoneX,
curveMonotoneY,
curveNatural,
curveStep,
curveStepAfter,
curveStepBefore
};
/**
* @inline
*/
/**
* @inline
*/
var defined = p => isWellBehavedNumber(p.x) && isWellBehavedNumber(p.y);
var areaDefined = d => d.base != null && defined(d.base) && defined(d);
var getX = p => p.x;
var getY = p => p.y;
var getCurveFactory = (type, layout) => {
if (typeof type === 'function') {
return type;
}
var name = "curve".concat(upperFirst(type));
if ((name === 'curveMonotone' || name === 'curveBump') && layout) {
var factory = CURVE_FACTORIES["".concat(name).concat(layout === 'vertical' ? 'Y' : 'X')];
if (factory) {
return factory;
}
}
return CURVE_FACTORIES[name] || curveLinear;
};
// Mouse event handlers receive the full Props, including the event handlers themselves.
export var defaultCurveProps = {
connectNulls: false,
type: 'linear'
};
/**
* Calculate the path of curve. Returns null if points is an empty array.
* @return path or null
*/
export var getPath = _ref => {
var _ref$type = _ref.type,
type = _ref$type === void 0 ? defaultCurveProps.type : _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 ? defaultCurveProps.connectNulls : _ref$connectNulls;
var curveFactory = getCurveFactory(type, layout);
var formatPoints = connectNulls ? points.filter(defined) : points;
// When dealing with an area chart (where `baseLine` is an array),
// we need to pair points with their corresponding `baseLine` points first.
// This is to ensure that we filter points and their baseline counterparts together,
// preventing errors from mismatched array lengths and ensuring `defined` checks both.
if (Array.isArray(baseLine)) {
var _lineFunction;
var areaPoints = points.map((entry, index) => _objectSpread(_objectSpread({}, entry), {}, {
base: baseLine[index]
}));
if (layout === 'vertical') {
_lineFunction = shapeArea().y(getY).x1(getX).x0(d => d.base.x);
} else {
_lineFunction = shapeArea().x(getX).y1(getY).y0(d => d.base.y);
}
/*
* What happens here is that the `.defined()` call will make it so that this function can accept
* nullable points, and internally it will filter them out and skip when generating the path.
* So on the input it accepts NullableCoordinate, but it never calls getX/getY on null points because of the defined() filter.
*
* The d3 type definition has only one generic so it doesn't allow to describe this properly.
* However. d3 types are mutable, but we can pretend that they are not, and we can pretend
* that calling defined() returns a new function with a different generic type.
*/
// @ts-expect-error the defined call changes the generic type internally but d3 types don't reflect that
var _nullableLineFunction = _lineFunction.defined(areaDefined).curve(curveFactory);
var finalPoints = connectNulls ? areaPoints.filter(areaDefined) : areaPoints;
return _nullableLineFunction(finalPoints);
}
var lineFunction;
if (layout === 'vertical' && isNumber(baseLine)) {
lineFunction = shapeArea().y(getY).x1(getX).x0(baseLine);
} else if (isNumber(baseLine)) {
lineFunction = shapeArea().x(getX).y1(getY).y0(baseLine);
} else {
lineFunction = shapeLine().x(getX).y(getY);
}
// @ts-expect-error the defined call changes the generic type internally but d3 types don't reflect that
var nullableLineFunction = lineFunction.defined(defined).curve(curveFactory);
return nullableLineFunction(formatPoints);
};
export var Curve = props => {
var className = props.className,
points = props.points,
path = props.path,
pathRef = props.pathRef;
var layout = useChartLayout();
if ((!points || !points.length) && !path) {
return null;
}
var getPathInput = {
type: props.type,
points: props.points,
baseLine: props.baseLine,
layout: props.layout || layout,
connectNulls: props.connectNulls
};
var realPath = points && points.length ? getPath(getPathInput) : path;
return /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesNoEvents(props), adaptEventHandlers(props), {
className: clsx('recharts-curve', className),
d: realPath === null ? undefined : realPath,
ref: pathRef
}));
};

32
frontend/node_modules/recharts/es6/shape/Dot.js generated vendored Normal file
View file

@ -0,0 +1,32 @@
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import * as React from 'react';
import { clsx } from 'clsx';
import { adaptEventHandlers } from '../util/types';
import { svgPropertiesNoEvents } from '../util/svgPropertiesNoEvents';
import { isNumber } from '../util/DataUtils';
/**
* Renders a dot in the chart.
*
* This component accepts X and Y coordinates in pixels.
* If you need to position the rectangle based on your chart's data,
* consider using the {@link ReferenceDot} component instead.
*
* @param props
* @constructor
*/
export var Dot = props => {
var cx = props.cx,
cy = props.cy,
r = props.r,
className = props.className;
var layerClass = clsx('recharts-dot', className);
if (isNumber(cx) && isNumber(cy) && isNumber(r)) {
return /*#__PURE__*/React.createElement("circle", _extends({}, svgPropertiesNoEvents(props), adaptEventHandlers(props), {
className: layerClass,
cx: cx,
cy: cy,
r: r
}));
}
return null;
};

93
frontend/node_modules/recharts/es6/shape/Polygon.js generated vendored Normal file
View file

@ -0,0 +1,93 @@
var _excluded = ["points", "className", "baseLinePoints", "connectNulls"];
var _templateObject;
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
/**
* @fileOverview Polygon
*/
import * as React from 'react';
import { clsx } from 'clsx';
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
import { roundTemplateLiteral } from '../util/round';
var isValidatePoint = point => {
return point != null && 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(entry => {
var lastLink = segmentPoints[segmentPoints.length - 1];
if (isValidatePoint(entry)) {
if (lastLink) {
lastLink.push(entry);
}
} else if (lastLink && lastLink.length > 0) {
// add another path
segmentPoints.push([]);
}
});
var firstPoint = points[0];
var lastLink = segmentPoints[segmentPoints.length - 1];
if (isValidatePoint(firstPoint) && lastLink) {
lastLink.push(firstPoint);
}
var finalLink = segmentPoints[segmentPoints.length - 1];
if (finalLink && finalLink.length <= 0) {
segmentPoints = segmentPoints.slice(0, -1);
}
return segmentPoints;
};
var getSinglePolygonPath = (points, connectNulls) => {
var segmentPoints = getParsedPoints(points);
if (connectNulls) {
segmentPoints = [segmentPoints.reduce((res, segPoints) => {
return [...res, ...segPoints];
}, [])];
}
var polygonPath = segmentPoints.map(segPoints => {
return segPoints.reduce((path, point, index) => {
return roundTemplateLiteral(_templateObject || (_templateObject = _taggedTemplateLiteral(["", "", "", ",", ""])), path, index === 0 ? 'M' : 'L', point.x, point.y);
}, '');
}).join('');
return segmentPoints.length === 1 ? "".concat(polygonPath, "Z") : polygonPath;
};
var getRanglePath = (points, baseLinePoints, connectNulls) => {
var outerPath = getSinglePolygonPath(points, connectNulls);
return "".concat(outerPath.slice(-1) === 'Z' ? outerPath.slice(0, -1) : outerPath, "L").concat(getSinglePolygonPath(Array.from(baseLinePoints).reverse(), connectNulls).slice(1));
};
export var 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 = clsx('recharts-polygon', className);
if (baseLinePoints && baseLinePoints.length) {
var hasStroke = others.stroke && others.stroke !== 'none';
var rangePath = getRanglePath(points, baseLinePoints, connectNulls);
return /*#__PURE__*/React.createElement("g", {
className: layerClass
}, /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(others), {
fill: rangePath.slice(-1) === 'Z' ? others.fill : 'none',
stroke: "none",
d: rangePath
})), hasStroke ? /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(others), {
fill: "none",
d: getSinglePolygonPath(points, connectNulls)
})) : null, hasStroke ? /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(others), {
fill: "none",
d: getSinglePolygonPath(baseLinePoints, connectNulls)
})) : null);
}
var singlePath = getSinglePolygonPath(points, connectNulls);
return /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(others), {
fill: singlePath.slice(-1) === 'Z' ? others.fill : 'none',
className: layerClass,
d: singlePath
}));
};

213
frontend/node_modules/recharts/es6/shape/Rectangle.js generated vendored Normal file
View file

@ -0,0 +1,213 @@
var _excluded = ["radius"],
_excluded2 = ["radius"];
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject0;
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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 _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
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(r) { if (Array.isArray(r)) return r; }
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
/**
* @fileOverview Rectangle
*/
import * as React from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
import { clsx } from 'clsx';
import { resolveDefaultProps } from '../util/resolveDefaultProps';
import { JavascriptAnimate } from '../animation/JavascriptAnimate';
import { interpolate } from '../util/DataUtils';
import { useAnimationId } from '../util/useAnimationId';
import { getTransitionVal } from '../animation/util';
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
import { round, roundTemplateLiteral } from '../util/round';
/**
* @inline
*/
var getRectanglePath = (x, y, width, height, radius) => {
var roundedWidth = round(width);
var roundedHeight = round(height);
var maxRadius = Math.min(Math.abs(roundedWidth) / 2, Math.abs(roundedHeight) / 2);
var ySign = roundedHeight >= 0 ? 1 : -1;
var xSign = roundedWidth >= 0 ? 1 : -1;
var clockWise = roundedHeight >= 0 && roundedWidth >= 0 || roundedHeight < 0 && roundedWidth < 0 ? 1 : 0;
var path;
if (maxRadius > 0 && Array.isArray(radius)) {
var newRadius = [0, 0, 0, 0];
for (var i = 0, len = 4; i < len; i++) {
var _radius$i;
var r = (_radius$i = radius[i]) !== null && _radius$i !== void 0 ? _radius$i : 0;
newRadius[i] = r > maxRadius ? maxRadius : r;
}
path = roundTemplateLiteral(_templateObject || (_templateObject = _taggedTemplateLiteral(["M", ",", ""])), x, y + ySign * newRadius[0]);
if (newRadius[0] > 0) {
path += roundTemplateLiteral(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["A ", ",", ",0,0,", ",", ",", ""])), newRadius[0], newRadius[0], clockWise, x + xSign * newRadius[0], y);
}
path += roundTemplateLiteral(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["L ", ",", ""])), x + width - xSign * newRadius[1], y);
if (newRadius[1] > 0) {
path += roundTemplateLiteral(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["A ", ",", ",0,0,", ",\n ", ",", ""])), newRadius[1], newRadius[1], clockWise, x + width, y + ySign * newRadius[1]);
}
path += roundTemplateLiteral(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["L ", ",", ""])), x + width, y + height - ySign * newRadius[2]);
if (newRadius[2] > 0) {
path += roundTemplateLiteral(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["A ", ",", ",0,0,", ",\n ", ",", ""])), newRadius[2], newRadius[2], clockWise, x + width - xSign * newRadius[2], y + height);
}
path += roundTemplateLiteral(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["L ", ",", ""])), x + xSign * newRadius[3], y + height);
if (newRadius[3] > 0) {
path += roundTemplateLiteral(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["A ", ",", ",0,0,", ",\n ", ",", ""])), newRadius[3], newRadius[3], clockWise, x, y + height - ySign * newRadius[3]);
}
path += 'Z';
} else if (maxRadius > 0 && radius === +radius && radius > 0) {
var _newRadius = Math.min(maxRadius, radius);
path = roundTemplateLiteral(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["M ", ",", "\n A ", ",", ",0,0,", ",", ",", "\n L ", ",", "\n A ", ",", ",0,0,", ",", ",", "\n L ", ",", "\n A ", ",", ",0,0,", ",", ",", "\n L ", ",", "\n A ", ",", ",0,0,", ",", ",", " Z"])), x, y + ySign * _newRadius, _newRadius, _newRadius, clockWise, x + xSign * _newRadius, y, x + width - xSign * _newRadius, y, _newRadius, _newRadius, clockWise, x + width, y + ySign * _newRadius, x + width, y + height - ySign * _newRadius, _newRadius, _newRadius, clockWise, x + width - xSign * _newRadius, y + height, x + xSign * _newRadius, y + height, _newRadius, _newRadius, clockWise, x, y + height - ySign * _newRadius);
} else {
path = roundTemplateLiteral(_templateObject0 || (_templateObject0 = _taggedTemplateLiteral(["M ", ",", " h ", " v ", " h ", " Z"])), x, y, width, height, -width);
}
return path;
};
export var defaultRectangleProps = {
x: 0,
y: 0,
width: 0,
height: 0,
radius: 0,
isAnimationActive: false,
isUpdateAnimationActive: false,
animationBegin: 0,
animationDuration: 1500,
animationEasing: 'ease'
};
/**
* Renders a rectangle element. Unlike the {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/Element/rect rect SVG element}, this component supports rounded corners
* and animation.
*
* This component accepts X and Y coordinates in pixels.
* If you need to position the rectangle based on your chart's data,
* consider using the {@link ReferenceArea} component instead.
*
* @param rectangleProps
* @constructor
*/
export var Rectangle = rectangleProps => {
var props = resolveDefaultProps(rectangleProps, defaultRectangleProps);
var pathRef = useRef(null);
var _useState = useState(-1),
_useState2 = _slicedToArray(_useState, 2),
totalLength = _useState2[0],
setTotalLength = _useState2[1];
useEffect(() => {
if (pathRef.current && pathRef.current.getTotalLength) {
try {
var pathTotalLength = pathRef.current.getTotalLength();
if (pathTotalLength) {
setTotalLength(pathTotalLength);
}
} catch (_unused) {
// 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;
var prevWidthRef = useRef(width);
var prevHeightRef = useRef(height);
var prevXRef = useRef(x);
var prevYRef = useRef(y);
var animationIdInput = useMemo(() => ({
x,
y,
width,
height,
radius
}), [x, y, width, height, radius]);
var animationId = useAnimationId(animationIdInput, 'rectangle-');
if (x !== +x || y !== +y || width !== +width || height !== +height || width === 0 || height === 0) {
return null;
}
var layerClass = clsx('recharts-rectangle', className);
if (!isUpdateAnimationActive) {
var _svgPropertiesAndEven = svgPropertiesAndEvents(props),
_ = _svgPropertiesAndEven.radius,
otherPathProps = _objectWithoutProperties(_svgPropertiesAndEven, _excluded);
return /*#__PURE__*/React.createElement("path", _extends({}, otherPathProps, {
x: round(x),
y: round(y),
width: round(width),
height: round(height),
radius: typeof radius === 'number' ? radius : undefined,
className: layerClass,
d: getRectanglePath(x, y, width, height, radius)
}));
}
var prevWidth = prevWidthRef.current;
var prevHeight = prevHeightRef.current;
var prevX = prevXRef.current;
var prevY = prevYRef.current;
var from = "0px ".concat(totalLength === -1 ? 1 : totalLength, "px");
var to = "".concat(totalLength, "px ").concat(totalLength, "px");
var transition = getTransitionVal(['strokeDasharray'], animationDuration, typeof animationEasing === 'string' ? animationEasing : defaultRectangleProps.animationEasing);
return /*#__PURE__*/React.createElement(JavascriptAnimate, {
animationId: animationId,
key: animationId,
canBegin: totalLength > 0,
duration: animationDuration,
easing: animationEasing,
isActive: isUpdateAnimationActive,
begin: animationBegin
}, animationElapsedTime => {
var currWidth = interpolate(prevWidth, width, animationElapsedTime);
var currHeight = interpolate(prevHeight, height, animationElapsedTime);
var currX = interpolate(prevX, x, animationElapsedTime);
var currY = interpolate(prevY, y, animationElapsedTime);
if (pathRef.current) {
prevWidthRef.current = currWidth;
prevHeightRef.current = currHeight;
prevXRef.current = currX;
prevYRef.current = currY;
}
var animationStyle;
if (!isAnimationActive) {
animationStyle = {
strokeDasharray: to
};
} else if (animationElapsedTime > 0) {
animationStyle = {
transition,
strokeDasharray: to
};
} else {
animationStyle = {
strokeDasharray: from
};
}
var _svgPropertiesAndEven2 = svgPropertiesAndEvents(props),
_ = _svgPropertiesAndEven2.radius,
otherPathProps = _objectWithoutProperties(_svgPropertiesAndEven2, _excluded2);
return /*#__PURE__*/React.createElement("path", _extends({}, otherPathProps, {
radius: typeof radius === 'number' ? radius : undefined,
className: layerClass,
d: getRectanglePath(currX, currY, currWidth, currHeight, radius),
ref: pathRef,
style: _objectSpread(_objectSpread({}, animationStyle), props.style)
}));
});
};

213
frontend/node_modules/recharts/es6/shape/Sector.js generated vendored Normal file
View file

@ -0,0 +1,213 @@
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
import * as React from 'react';
import { clsx } from 'clsx';
import { polarToCartesian, RADIAN } from '../util/PolarUtils';
import { getPercentValue, mathSign } from '../util/DataUtils';
import { resolveDefaultProps } from '../util/resolveDefaultProps';
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
import { roundTemplateLiteral } from '../util/round';
var getDeltaAngle = (startAngle, endAngle) => {
var sign = mathSign(endAngle - startAngle);
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 359.999);
return sign * deltaAngle;
};
var 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) / RADIAN;
var centerAngle = cornerIsExternal ? angle : angle + sign * theta;
var center = polarToCartesian(cx, cy, centerRadius, centerAngle);
// The coordinate of point which is tangent to the circle
var circleTangency = 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 = polarToCartesian(cx, cy, centerRadius * Math.cos(theta * RADIAN), lineTangencyAngle);
return {
center,
circleTangency,
lineTangency,
theta
};
};
var 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 = polarToCartesian(cx, cy, outerRadius, startAngle);
var outerEndPoint = polarToCartesian(cx, cy, outerRadius, tempEndAngle);
var path = roundTemplateLiteral(_templateObject || (_templateObject = _taggedTemplateLiteral(["M ", ",", "\n A ", ",", ",0,\n ", ",", ",\n ", ",", "\n "])), outerStartPoint.x, outerStartPoint.y, outerRadius, outerRadius, +(Math.abs(angle) > 180), +(startAngle > tempEndAngle), outerEndPoint.x, outerEndPoint.y);
if (innerRadius > 0) {
var innerStartPoint = polarToCartesian(cx, cy, innerRadius, startAngle);
var innerEndPoint = polarToCartesian(cx, cy, innerRadius, tempEndAngle);
path += roundTemplateLiteral(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["L ", ",", "\n A ", ",", ",0,\n ", ",", ",\n ", ",", " Z"])), innerEndPoint.x, innerEndPoint.y, innerRadius, innerRadius, +(Math.abs(angle) > 180), +(startAngle <= tempEndAngle), innerStartPoint.x, innerStartPoint.y);
} else {
path += roundTemplateLiteral(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["L ", ",", " Z"])), cx, cy);
}
return path;
};
var 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 = mathSign(endAngle - startAngle);
var _getTangentCircle = getTangentCircle({
cx,
cy,
radius: outerRadius,
angle: startAngle,
sign,
cornerRadius,
cornerIsExternal
}),
soct = _getTangentCircle.circleTangency,
solt = _getTangentCircle.lineTangency,
sot = _getTangentCircle.theta;
var _getTangentCircle2 = getTangentCircle({
cx,
cy,
radius: outerRadius,
angle: endAngle,
sign: -sign,
cornerRadius,
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 roundTemplateLiteral(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["M ", ",", "\n a", ",", ",0,0,1,", ",0\n a", ",", ",0,0,1,", ",0\n "])), solt.x, solt.y, cornerRadius, cornerRadius, cornerRadius * 2, cornerRadius, cornerRadius, -cornerRadius * 2);
}
return getSectorPath({
cx,
cy,
innerRadius,
outerRadius,
startAngle,
endAngle
});
}
var path = roundTemplateLiteral(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["M ", ",", "\n A", ",", ",0,0,", ",", ",", "\n A", ",", ",0,", ",", ",", ",", "\n A", ",", ",0,0,", ",", ",", "\n "])), solt.x, solt.y, cornerRadius, cornerRadius, +(sign < 0), soct.x, soct.y, outerRadius, outerRadius, +(outerArcAngle > 180), +(sign < 0), eoct.x, eoct.y, cornerRadius, cornerRadius, +(sign < 0), eolt.x, eolt.y);
if (innerRadius > 0) {
var _getTangentCircle3 = getTangentCircle({
cx,
cy,
radius: innerRadius,
angle: startAngle,
sign,
isExternal: true,
cornerRadius,
cornerIsExternal
}),
sict = _getTangentCircle3.circleTangency,
silt = _getTangentCircle3.lineTangency,
sit = _getTangentCircle3.theta;
var _getTangentCircle4 = getTangentCircle({
cx,
cy,
radius: innerRadius,
angle: endAngle,
sign: -sign,
isExternal: true,
cornerRadius,
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 += roundTemplateLiteral(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["L", ",", "\n A", ",", ",0,0,", ",", ",", "\n A", ",", ",0,", ",", ",", ",", "\n A", ",", ",0,0,", ",", ",", "Z"])), eilt.x, eilt.y, cornerRadius, cornerRadius, +(sign < 0), eict.x, eict.y, innerRadius, innerRadius, +(innerArcAngle > 180), +(sign > 0), sict.x, sict.y, cornerRadius, cornerRadius, +(sign < 0), silt.x, silt.y);
} else {
path += roundTemplateLiteral(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["L", ",", "Z"])), cx, cy);
}
return path;
};
/**
* SVG cx, cy are `string | number | undefined`, but internally we use `number` so let's
* override the types here.
*/
export var defaultSectorProps = {
cx: 0,
cy: 0,
innerRadius: 0,
outerRadius: 0,
startAngle: 0,
endAngle: 0,
cornerRadius: 0,
forceCornerRadius: false,
cornerIsExternal: false
};
export var Sector = sectorProps => {
var props = resolveDefaultProps(sectorProps, defaultSectorProps);
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 = clsx('recharts-sector', className);
var deltaRadius = outerRadius - innerRadius;
var cr = getPercentValue(cornerRadius, deltaRadius, 0, true);
var path;
if (cr > 0 && Math.abs(startAngle - endAngle) < 360) {
path = getSectorWithCorner({
cx,
cy,
innerRadius,
outerRadius,
cornerRadius: Math.min(cr, deltaRadius / 2),
forceCornerRadius,
cornerIsExternal,
startAngle,
endAngle
});
} else {
path = getSectorPath({
cx,
cy,
innerRadius,
outerRadius,
startAngle,
endAngle
});
}
return /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(props), {
className: layerClass,
d: path
}));
};

111
frontend/node_modules/recharts/es6/shape/Symbols.js generated vendored Normal file
View file

@ -0,0 +1,111 @@
var _excluded = ["type", "size", "sizeType"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, 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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import * as React from 'react';
import { symbol as shapeSymbol, symbolCircle, symbolCross, symbolDiamond, symbolSquare, symbolStar, symbolTriangle, symbolWye } from 'victory-vendor/d3-shape';
import { clsx } from 'clsx';
import { isNumber, upperFirst } from '../util/DataUtils';
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
var symbolFactories = {
symbolCircle,
symbolCross,
symbolDiamond,
symbolSquare,
symbolStar,
symbolTriangle,
symbolWye
};
var RADIAN = Math.PI / 180;
var getSymbolFactory = type => {
var name = "symbol".concat(upperFirst(type));
return symbolFactories[name] || symbolCircle;
};
var 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.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 = (key, factory) => {
symbolFactories["symbol".concat(upperFirst(key))] = factory;
};
/**
* Renders a symbol from a set of predefined shapes.
*/
export var 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,
size,
sizeType
});
var realType = 'circle';
if (typeof type === 'string') {
/*
* Our type guard is not as strong as it could be (i.e. non-existent),
* and so despite the typescript type saying that `type` is a `SymbolType`,
* we can get numbers or really anything, so let's have a runtime check here to fix the exception.
*
* https://github.com/recharts/recharts/issues/6197
*/
realType = type;
}
/**
* Calculate the path of curve
* @return {String} path
*/
var getPath = () => {
var symbolFactory = getSymbolFactory(realType);
var symbol = shapeSymbol().type(symbolFactory).size(calculateAreaSize(size, sizeType, realType));
var s = symbol();
if (s === null) {
return undefined;
}
return s;
};
var className = props.className,
cx = props.cx,
cy = props.cy;
var filteredProps = svgPropertiesAndEvents(props);
if (isNumber(cx) && isNumber(cy) && isNumber(size)) {
return /*#__PURE__*/React.createElement("path", _extends({}, filteredProps, {
className: clsx('recharts-symbols', className),
transform: "translate(".concat(cx, ", ").concat(cy, ")"),
d: getPath()
}));
}
return null;
};
Symbols.registerSymbol = registerSymbol;

136
frontend/node_modules/recharts/es6/shape/Trapezoid.js generated vendored Normal file
View file

@ -0,0 +1,136 @@
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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 _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
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(r) { if (Array.isArray(r)) return r; }
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
/**
* @fileOverview Rectangle
*/
import * as React from 'react';
import { useEffect, useRef, useState } from 'react';
import { clsx } from 'clsx';
import { resolveDefaultProps } from '../util/resolveDefaultProps';
import { JavascriptAnimate } from '../animation/JavascriptAnimate';
import { useAnimationId } from '../util/useAnimationId';
import { interpolate } from '../util/DataUtils';
import { getTransitionVal } from '../animation/util';
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
import { roundTemplateLiteral } from '../util/round';
var getTrapezoidPath = (x, y, upperWidth, lowerWidth, height) => {
var widthGap = upperWidth - lowerWidth;
var path;
path = roundTemplateLiteral(_templateObject || (_templateObject = _taggedTemplateLiteral(["M ", ",", ""])), x, y);
path += roundTemplateLiteral(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["L ", ",", ""])), x + upperWidth, y);
path += roundTemplateLiteral(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["L ", ",", ""])), x + upperWidth - widthGap / 2, y + height);
path += roundTemplateLiteral(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["L ", ",", ""])), x + upperWidth - widthGap / 2 - lowerWidth, y + height);
path += roundTemplateLiteral(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["L ", ",", " Z"])), x, y);
return path;
};
export var defaultTrapezoidProps = {
x: 0,
y: 0,
upperWidth: 0,
lowerWidth: 0,
height: 0,
isUpdateAnimationActive: false,
animationBegin: 0,
animationDuration: 1500,
animationEasing: 'ease'
};
export var Trapezoid = outsideProps => {
var trapezoidProps = resolveDefaultProps(outsideProps, defaultTrapezoidProps);
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;
var pathRef = useRef(null);
var _useState = useState(-1),
_useState2 = _slicedToArray(_useState, 2),
totalLength = _useState2[0],
setTotalLength = _useState2[1];
var prevUpperWidthRef = useRef(upperWidth);
var prevLowerWidthRef = useRef(lowerWidth);
var prevHeightRef = useRef(height);
var prevXRef = useRef(x);
var prevYRef = useRef(y);
var animationId = useAnimationId(outsideProps, 'trapezoid-');
useEffect(() => {
if (pathRef.current && pathRef.current.getTotalLength) {
try {
var pathTotalLength = pathRef.current.getTotalLength();
if (pathTotalLength) {
setTotalLength(pathTotalLength);
}
} catch (_unused) {
// calculate total length error
}
}
}, []);
if (x !== +x || y !== +y || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || upperWidth === 0 && lowerWidth === 0 || height === 0) {
return null;
}
var layerClass = clsx('recharts-trapezoid', className);
if (!isUpdateAnimationActive) {
return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(trapezoidProps), {
className: layerClass,
d: getTrapezoidPath(x, y, upperWidth, lowerWidth, height)
})));
}
var prevUpperWidth = prevUpperWidthRef.current;
var prevLowerWidth = prevLowerWidthRef.current;
var prevHeight = prevHeightRef.current;
var prevX = prevXRef.current;
var prevY = prevYRef.current;
var from = "0px ".concat(totalLength === -1 ? 1 : totalLength, "px");
var to = "".concat(totalLength, "px ").concat(totalLength, "px");
var transition = getTransitionVal(['strokeDasharray'], animationDuration, typeof animationEasing === 'string' ? animationEasing : 'ease');
return /*#__PURE__*/React.createElement(JavascriptAnimate, {
animationId: animationId,
key: animationId,
canBegin: totalLength > 0,
duration: animationDuration,
easing: animationEasing,
isActive: isUpdateAnimationActive,
begin: animationBegin
}, animationElapsedTime => {
var currUpperWidth = interpolate(prevUpperWidth, upperWidth, animationElapsedTime);
var currLowerWidth = interpolate(prevLowerWidth, lowerWidth, animationElapsedTime);
var currHeight = interpolate(prevHeight, height, animationElapsedTime);
var currX = interpolate(prevX, x, animationElapsedTime);
var currY = interpolate(prevY, y, animationElapsedTime);
if (pathRef.current) {
prevUpperWidthRef.current = currUpperWidth;
prevLowerWidthRef.current = currLowerWidth;
prevHeightRef.current = currHeight;
prevXRef.current = currX;
prevYRef.current = currY;
}
var animationStyle = animationElapsedTime > 0 ? {
transition,
strokeDasharray: to
} : {
strokeDasharray: from
};
return /*#__PURE__*/React.createElement("path", _extends({}, svgPropertiesAndEvents(trapezoidProps), {
className: layerClass,
d: getTrapezoidPath(currX, currY, currUpperWidth, currLowerWidth, currHeight),
ref: pathRef,
style: _objectSpread(_objectSpread({}, animationStyle), trapezoidProps.style)
}));
});
};