define(["exports", "core/pubsubhub", "deps/regenerator"], function (exports, _pubsubhub) {
  "use strict";

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.run = exports.name = undefined;

  function _asyncToGenerator(fn) {
    return function () {
      var gen = fn.apply(this, arguments);
      return new Promise(function (resolve, reject) {
        function step(key, arg) {
          try {
            var info = gen[key](arg);
            var value = info.value;
          } catch (error) {
            reject(error);
            return;
          }

          if (info.done) {
            resolve(value);
          } else {
            return Promise.resolve(value).then(function (value) {
              step("next", value);
            }, function (err) {
              step("throw", err);
            });
          }
        }

        return step("next");
      });
    };
  }

  var name = exports.name = "w3c/abstract";

  var run = exports.run = function () {
    var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(conf) {
      var abs, abstractHeading;
      return regeneratorRuntime.wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              abs = document.getElementById("abstract");

              if (abs) {
                _context.next = 4;
                break;
              }

              (0, _pubsubhub.pub)("error", "Document must have one element with `id=\"abstract\"");
              return _context.abrupt("return");

            case 4:
              abs.classList.add("introductory");
              abstractHeading = document.querySelector("#abstract>h2");

              if (!abstractHeading) {
                _context.next = 8;
                break;
              }

              return _context.abrupt("return");

            case 8:
              abstractHeading = document.createElement("h2");
              abstractHeading.innerText = conf.l10n.abstract;
              abs.insertAdjacentElement("afterbegin", abstractHeading);

            case 11:
            case "end":
              return _context.stop();
          }
        }
      }, _callee, this);
    }));

    return function run(_x) {
      return _ref.apply(this, arguments);
    };
  }();
});
//# sourceMappingURL=abstract.js.map