"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var FormattedNumber = function FormattedNumber(props) {
  var formattedNumber = String(props.number);
  if (props.languageSettings) {
    var parts = formattedNumber.split('.');
    formattedNumber = addThousandsseparator(parts[0], props.languageSettings.thousandsseparator);
    if (parts[1] !== undefined) {
      formattedNumber += props.languageSettings.decimalpoint + parts[1];
    }
  }
  return /*#__PURE__*/_react["default"].createElement("span", null, formattedNumber);
};
var addThousandsseparator = function addThousandsseparator(nStr, separator) {
  nStr += '';
  var rgx = /(\d+)(\d{3})/;
  while (rgx.test(nStr)) {
    nStr = nStr.replace(rgx, '$1' + separator + '$2');
  }
  return nStr;
};
var _default = exports["default"] = FormattedNumber;