"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _polished = require("polished");

var _constants = require("./constants");

var _font = _interopRequireDefault(require("./font.json"));

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

var fontSize = function fontSize(px) {
  return (0, _polished.rem)(parseFloat(px), _constants.BASE_SIZE);
};

var lineHeight = function lineHeight(px) {
  return (0, _polished.rem)(Math.round(px * _font["default"].lineHeightModifier), _constants.BASE_SIZE);
};

var letterSpacing = function letterSpacing(px) {
  var _Font$tracking = _font["default"].tracking,
      a = _Font$tracking.a,
      b = _Font$tracking.b,
      c = _Font$tracking.c;
  return (0, _polished.rem)(a + b * Math.pow(Math.E, c * px), _constants.BASE_SIZE);
};

var featureSettings = function featureSettings() {
  for (var _len = arguments.length, list = new Array(_len), _key = 0; _key < _len; _key++) {
    list[_key] = arguments[_key];
  }

  return list.concat(_font["default"].defaultFeatures).map(function (feat) {
    return "\"".concat(feat, "\" 1");
  }).join(', ');
};

var _default = _objectSpread({}, _font["default"], {
  fontSize: fontSize,
  lineHeight: lineHeight,
  featureSettings: featureSettings,
  letterSpacing: letterSpacing
});

exports["default"] = _default;
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