text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  exports.__esModule = true;
  exports["default"] = selfHosted;
  
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
  
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
  
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  
  var _postcss = _interopRequireDefault(require("postcss"));
  
  var _postcssJs = _interopRequireDefault(require("postcss-js"));
  
  var defaultFontOptions = {
    fontDisplay: "swap"
  };
  
  var getFontFace =
  /*#__PURE__*/
  function () {
    var _ref = (0, _asyncToGenerator2["default"])(
    /*#__PURE__*/
    _regenerator["default"].mark(function _callee(font) {
      var _createFontOptions, family, urls, cssProperties, _ref2, css, src;
  
      return _regenerator["default"].wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              _createFontOptions = createFontOptions(font), family = _createFontOptions.family, urls = _createFontOptions.urls, cssProperties = (0, _objectWithoutPropertiesLoose2["default"])(_createFontOptions, ["family", "urls"]);
              _context.next = 3;
              return (0, _postcss["default"])().process(cssProperties, {
                parser: _postcssJs["default"],
                from: undefined
              });
  
            case 3:
              _ref2 = _context.sent;
              css = _ref2.css;
              src = Object.entries(urls).map(function (_ref3) {
                var format = _ref3[0],
                    url = _ref3[1];
                return "url(\"" + url + "\") format(\"" + format + "\")";
              }).join();
              return _context.abrupt("return", "\n    @font-face {\n      font-family: \"" + family + "\";\n      src: " + src + ";\n      " + css + "\n    }\n  ");
  
            case 7:
            case "end":
              return _context.stop();
          }
        }
      }, _callee);
    }));
  
    return function getFontFace(_x) {
      return _ref.apply(this, arguments);
    };
  }();
  
  function selfHosted() {
    return function (fonts) {
      return Promise.all(fonts.map(getFontFace));
    };
  }
  
  function createFontOptions(options) {
    return (0, _extends2["default"])({}, defaultFontOptions, {}, options);
  }