"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var restoreNodes = [];
var restoreFocus = {
  create: function create() {
    if (restoreNodes.indexOf(document.activeElement) == -1) {
      restoreNodes.push(document.activeElement);
    }
  },
  remove: function remove() {
    var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    requestAnimationFrame(function () {
      if (document.body.contains(restoreNodes[index])) {
        restoreNodes[index] && restoreNodes[index].focus();
        restoreNodes.splice(index, 1);
      }
    });
  }
};
var _default = restoreFocus;
exports["default"] = _default;