"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _css2 = require("@emotion/css");

var _css3 = _interopRequireDefault(_css2);

var _core = require("@emotion/core");

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

var _propTypes = require("prop-types");

var _propTypes2 = _interopRequireDefault(_propTypes);

var _BaseHeading = require("../../skeletons/BaseHeading");

var _heading = require("../../../theme/styles/heading");

var _tones = require("../../../theme/tones");

var _tones2 = _interopRequireDefault(_tones);

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

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(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var baseStyle = _heading.styles.baseStyle,
    variantStyles = _heading.styles.variantStyles;
var VARIANTS = _heading.options.VARIANTS,
    TONES = _heading.options.TONES;

function Heading(_ref) {
  var children = _ref.children,
      css = _ref.css,
      _ref$tone = _ref.tone,
      tone = _ref$tone === void 0 ? "NEUTRAL" : _ref$tone,
      _ref$variant = _ref.variant,
      variant = _ref$variant === void 0 ? "PRIMARY" : _ref$variant,
      _ref$as = _ref.as,
      as = _ref$as === void 0 ? "h2" : _ref$as,
      rest = _objectWithoutProperties(_ref, ["children", "css", "tone", "variant", "as"]);

  return (0, _core.jsx)(_BaseHeading.BaseHeading, Object.assign({
    as: as,
    css:
    /*#__PURE__*/
    (0, _css3["default"])(_objectSpread({}, baseStyle({
      tone: tone
    }), {}, variantStyles({
      tone: tone
    })[variant]), "label:Heading;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL2NvcmUvSGVhZGluZy9IZWFkaW5nLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXVCTSIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMvY29tcG9uZW50cy9jb3JlL0hlYWRpbmcvSGVhZGluZy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qKiBAanN4IGpzeCAqL1xuaW1wb3J0IHsganN4IH0gZnJvbSBcIkBlbW90aW9uL2NvcmVcIlxuaW1wb3J0IFJlYWN0LCB7IEZyYWdtZW50IH0gZnJvbSBcInJlYWN0XCJcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSBcInByb3AtdHlwZXNcIlxuXG5pbXBvcnQgeyBCYXNlSGVhZGluZyB9IGZyb20gXCIuLi8uLi9za2VsZXRvbnMvQmFzZUhlYWRpbmdcIlxuaW1wb3J0IHsgc3R5bGVzLCBvcHRpb25zIH0gZnJvbSBcIi4uLy4uLy4uL3RoZW1lL3N0eWxlcy9oZWFkaW5nXCJcbmltcG9ydCB0b25lcyBmcm9tIFwiLi4vLi4vLi4vdGhlbWUvdG9uZXNcIlxuXG5jb25zdCB7IGJhc2VTdHlsZSwgdmFyaWFudFN0eWxlcyB9ID0gc3R5bGVzXG5jb25zdCB7IFZBUklBTlRTLCBUT05FUyB9ID0gb3B0aW9uc1xuXG5mdW5jdGlvbiBIZWFkaW5nKHtcbiAgY2hpbGRyZW4sXG4gIGNzcyxcbiAgdG9uZSA9IGBORVVUUkFMYCxcbiAgdmFyaWFudCA9IGBQUklNQVJZYCxcbiAgYXMgPSBgaDJgLFxuICAuLi5yZXN0XG59KSB7XG4gIHJldHVybiAoXG4gICAgPEJhc2VIZWFkaW5nXG4gICAgICBhcz17YXN9XG4gICAgICBjc3M9e3tcbiAgICAgICAgLi4uYmFzZVN0eWxlKHsgdG9uZSB9KSxcbiAgICAgICAgLi4udmFyaWFudFN0eWxlcyh7IHRvbmUgfSlbdmFyaWFudF0sXG4gICAgICB9fVxuICAgICAgey4uLnJlc3R9XG4gICAgPlxuICAgICAge2NoaWxkcmVufVxuICAgIDwvQmFzZUhlYWRpbmc+XG4gIClcbn1cblxuSGVhZGluZy5wcm9wVHlwZXMgPSB7XG4gIHZhcmlhbnQ6IFByb3BUeXBlcy5vbmVPZihWQVJJQU5UUyksXG4gIHRvbmU6IFByb3BUeXBlcy5vbmVPZihUT05FUyksXG59XG5cbmV4cG9ydCBkZWZhdWx0IEhlYWRpbmdcbiJdfQ== */"))
  }, rest), children);
}

Heading.propTypes = {
  variant: _propTypes2["default"].oneOf(VARIANTS),
  tone: _propTypes2["default"].oneOf(TONES)
};
exports["default"] = Heading;