"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.stylePrice = exports.noFunc = exports.makeId = exports.isPortable = exports.isDisabled = exports.getImg = exports.generateImg = exports.formatPrice = exports.fixContent = exports.drawBalance = exports.defaultContent = exports.defaultChildren = exports.TermsAndConditions = void 0;
require("core-js/modules/es.number.to-fixed.js");
require("core-js/modules/es.parse-float.js");
require("core-js/modules/es.regexp.exec.js");
require("core-js/modules/es.string.replace.js");
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const isPortable = function isPortable() {
  let maxMobRes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 783;
  return window.innerWidth <= maxMobRes;
};
exports.isPortable = isPortable;
const isDisabled = disabled => disabled ? "#C5CCD5" : "#4A90E2";
exports.isDisabled = isDisabled;
const formatter = new Intl.NumberFormat("en-US", {
  style: "currency",
  currency: "USD"
  // These options are needed to round to whole numbers if that's what you want.
  //minimumFractionDigits: 0, // (this suffices for whole numbers, but will print 2500.10 as $2,500.1)
  //maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
});

const formatPrice = qty => /*#__PURE__*/_react.default.createElement("label", null, formatter.format(qty));
exports.formatPrice = formatPrice;
const getImg = function getImg(url, classes) {
  let alt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Recurso no encontrado";
  return /*#__PURE__*/_react.default.createElement("img", {
    src: url,
    alt: alt,
    className: classes
  });
};
exports.getImg = getImg;
const drawBalance = balance => Number(parseFloat(balance).toFixed()).toLocaleString("en");
exports.drawBalance = drawBalance;
const generateImg = (resolution, text) => "https://dummyimage.com/".concat(resolution, "/000/fff&text=").concat(text);
exports.generateImg = generateImg;
const makeId = function makeId(length) {
  let result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  const minus = "abcdefghijklmnopqrstuvwxyz";
  const mayus = minus.toUpperCase();
  const nums = "0123456789";
  const characters = mayus + minus + nums;
  for (var i = 0; i < length; i++) {
    result += characters.charAt(Math.floor(Math.random() * characters.length));
  }
  return result;
};
exports.makeId = makeId;
const noFunc = (c, e) => console.log("(".concat(c, ") function associated ").concat(e));
exports.noFunc = noFunc;
const defaultChildren = function defaultChildren(n) {
  let res = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  timesGen(n).map(i => res.push( /*#__PURE__*/_react.default.createElement("div", {
    key: i
  }, "child ", i, " here")));
  return res;
};
exports.defaultChildren = defaultChildren;
const defaultContent = function defaultContent(n) {
  let c = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Content";
  let res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  timesGen(n).map(_ => res.push("A Really Big ".concat(c, " To Check The Overflow")));
  return res.join(" ");
};
exports.defaultContent = defaultContent;
const timesGen = function timesGen(n) {
  let res = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  for (let index = 0; index < n; index++) res.push(index + 1);
  return res;
};
const fixContent = (content, limit) => content.slice(0, limit);
exports.fixContent = fixContent;
const stylePrice = number => {
  const regex = /(\d[,.])(\d{2})(?!\d)/g;
  const str = formatPrice(number).props.children;
  return str.replace(regex, "$1<sup>$2</sup>");
};
exports.stylePrice = stylePrice;
const TermsAndConditions = _ref => {
  let {
    terms
  } = _ref;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: "content",
    dangerouslySetInnerHTML: {
      __html: terms
    }
  });
};
exports.TermsAndConditions = TermsAndConditions;