"use strict";

require("core-js/modules/es.object.define-property.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.themeMode = exports.setThemeMode = exports.generateTheme = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
require("core-js/modules/es.array.for-each.js");
require("core-js/modules/es.object.entries.js");
require("core-js/modules/es.object.to-string.js");
require("core-js/modules/es.regexp.exec.js");
require("core-js/modules/es.string.replace.js");
require("core-js/modules/esnext.iterator.constructor.js");
require("core-js/modules/esnext.iterator.for-each.js");
require("core-js/modules/web.dom-collections.for-each.js");
var _fcrUiConfig = require("./fcr-ui-config");
var themeMode = exports.themeMode = 'light';
var setThemeMode = exports.setThemeMode = function setThemeMode(mode) {
  exports.themeMode = themeMode = mode;
};
var generateTheme = exports.generateTheme = function generateTheme() {
  var theme = new _fcrUiConfig.FcrUIConfig();
  var colors = theme.colors,
    radius = theme.radius,
    font = theme.font;
  // add css variables to the root element
  var root = document.documentElement;
  // insert colors by theme
  Object.entries(colors[themeMode]).forEach(function (_ref) {
    var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
      key = _ref2[0],
      value = _ref2[1];
    // console.log('root', key, document.documentElement);

    root.style.setProperty("--".concat(camelTounderline(key)), value);
  });
  // insert radius
  Object.entries(radius).forEach(function (_ref3) {
    var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
      key = _ref4[0],
      value = _ref4[1];
    root.style.setProperty("--".concat(camelTounderline(key)), value + 'px');
  });
  // insert font
  Object.entries(font).forEach(function (_ref5) {
    var _ref6 = (0, _slicedToArray2["default"])(_ref5, 2),
      key = _ref6[0],
      value = _ref6[1];
    root.style.setProperty("--".concat(camelTounderline(key)), value);
  });
};
var camelTounderline = function camelTounderline(str) {
  return str.replace(/([A-Z])/g, '_$1').toLowerCase();
};