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

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

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

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

/** @babel */

var _symbolsView = require('./symbols-view');

var _symbolsView2 = _interopRequireDefault(_symbolsView);

var GoBackView = (function (_SymbolsView) {
  _inherits(GoBackView, _SymbolsView);

  function GoBackView() {
    _classCallCheck(this, GoBackView);

    _get(Object.getPrototypeOf(GoBackView.prototype), 'constructor', this).apply(this, arguments);
  }

  _createClass(GoBackView, [{
    key: 'toggle',
    value: function toggle() {
      var _this = this;

      var previousTag = this.stack.pop();
      if (!previousTag) {
        return;
      }

      var restorePosition = function restorePosition() {
        if (previousTag.position) {
          _this.moveToPosition(previousTag.position, false);
        }
      };

      var previousEditor = atom.workspace.getTextEditors().find(function (e) {
        return e.id === previousTag.editorId;
      });

      if (previousEditor) {
        var pane = atom.workspace.paneForItem(previousEditor);
        pane.setActiveItem(previousEditor);
        restorePosition();
      } else if (previousTag.file) {
        atom.workspace.open(previousTag.file).then(restorePosition);
      }
    }
  }]);

  return GoBackView;
})(_symbolsView2['default']);

exports['default'] = GoBackView;
module.exports = exports['default'];
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi90bXAvU0JvL3NsYWNrcmVwby43R0Q4aHcvYnVpbGRfYXRvbS9hdG9tLTEuMTcuMi9vdXQvYXBwL25vZGVfbW9kdWxlcy9zeW1ib2xzLXZpZXcvbGliL2dvLWJhY2stdmlldy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7OzJCQUV3QixnQkFBZ0I7Ozs7SUFFbkIsVUFBVTtZQUFWLFVBQVU7O1dBQVYsVUFBVTswQkFBVixVQUFVOzsrQkFBVixVQUFVOzs7ZUFBVixVQUFVOztXQUN2QixrQkFBRzs7O0FBQ1AsVUFBTSxXQUFXLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUNyQyxVQUFJLENBQUMsV0FBVyxFQUFFO0FBQ2hCLGVBQU87T0FDUjs7QUFFRCxVQUFNLGVBQWUsR0FBRyxTQUFsQixlQUFlLEdBQVM7QUFDNUIsWUFBSSxXQUFXLENBQUMsUUFBUSxFQUFFO0FBQ3hCLGdCQUFLLGNBQWMsQ0FBQyxXQUFXLENBQUMsUUFBUSxFQUFFLEtBQUssQ0FBQyxDQUFDO1NBQ2xEO09BQ0YsQ0FBQzs7QUFFRixVQUFNLGNBQWMsR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLGNBQWMsRUFBRSxDQUFD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