Liferay.Loader.define("dynamic-data-mapping-form-report-web@1.0.29/js/components/chart/TooltipContent.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', '../../utils/data.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _data = require("../../utils/data.es");

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * This library is free software; you can redistribute it and/or modify it under
     * the terms of the GNU Lesser General Public License as published by the Free
     * Software Foundation; either version 2.1 of the License, or (at your option)
     * any later version.
     *
     * This library is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
     * details.
     */
    var _default = function _default(_ref) {
      var active = _ref.active,
          field = _ref.field,
          label = _ref.label,
          payload = _ref.payload,
          _ref$roundBullet = _ref.roundBullet,
          roundBullet = _ref$roundBullet === void 0 ? true : _ref$roundBullet,
          _ref$showBullet = _ref.showBullet,
          showBullet = _ref$showBullet === void 0 ? true : _ref$showBullet,
          _ref$showHeader = _ref.showHeader,
          showHeader = _ref$showHeader === void 0 ? true : _ref$showHeader,
          _ref$totalEntries = _ref.totalEntries,
          totalEntries = _ref$totalEntries === void 0 ? 0 : _ref$totalEntries;

      if (active) {
        var getPercentage = function getPercentage(count) {
          return count / totalEntries;
        };

        if (!totalEntries) {
          totalEntries = payload.reduce(function (accumulator, payloadItem) {
            return accumulator + payloadItem.value;
          }, 0);
        }

        return (/*#__PURE__*/_react.default.createElement("div", {
            className: "custom-tooltip"
          }, showHeader ? /*#__PURE__*/_react.default.createElement("div", {
            className: "header"
          }, /*#__PURE__*/_react.default.createElement("div", {
            className: "title"
          }, label)) : null, /*#__PURE__*/_react.default.createElement("ul", null, payload.map(function (_ref2, index) {
            var dataKey = _ref2.dataKey,
                fill = _ref2.fill,
                payload = _ref2.payload,
                value = _ref2.value;
            dataKey = !showHeader ? payload.label : (0, _data.getColumnLabel)(dataKey, field);
            fill = fill == undefined ? payload.fill : null;
            return (/*#__PURE__*/_react.default.createElement("li", {
                key: "tooltip-".concat(index)
              }, showBullet ? /*#__PURE__*/_react.default.createElement("svg", {
                height: "12",
                width: "12"
              }, roundBullet ? /*#__PURE__*/_react.default.createElement("circle", {
                cx: "6",
                cy: "6",
                fill: fill,
                r: "6",
                strokeWidth: "0"
              }) : /*#__PURE__*/_react.default.createElement("rect", {
                fill: fill,
                height: "12",
                width: "12"
              })) : null, /*#__PURE__*/_react.default.createElement("div", {
                id: "tooltip-label"
              }, "".concat(dataKey, ": ").concat(value, " "), value == 1 ? "".concat(Liferay.Language.get('entry').toLowerCase(), " ") : "".concat(Liferay.Language.get('entries').toLowerCase(), " "), /*#__PURE__*/_react.default.createElement("b", null, "(", (0, _data.roundPercentage)(getPercentage(value)), ")")))
            );
          })))
        );
      }

      return null;
    };

    exports.default = _default;
    //# sourceMappingURL=TooltipContent.es.js.map
  }
});
//# sourceMappingURL=TooltipContent.es.js.map