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; }

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

var _symbolsView2 = _interopRequireDefault(_symbolsView);

'use babel';

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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9idWlsZC9hdG9tL3NyYy9hdG9tLTEuMTQuMy9vdXQvYXBwL25vZGVfbW9kdWxlcy9zeW1ib2xzLXZpZXcvbGliL2dvLWJhY2stdmlldy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7OzsyQkFFd0IsZ0JBQWdCOzs7O0FBRnhDLFdBQVcsQ0FBQzs7SUFJUyxVQUFVO1lBQVYsVUFBVTs7V0FBVixVQUFVOzBCQUFWLFVBQVU7OytCQUFWLFVBQVU7OztlQUFWLFVBQVU7O1dBQ3ZCLGtCQUFHOzs7QUFDUCxVQUFNLFdBQVcsR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQ3JDLFVBQUksQ0FBQyxXQUFXLEVBQUU7QUFDaEIsZUFBTztPQUNSOztBQUVELFVBQU0sZUFBZSxHQUFHLFNBQWxCLGVBQWUsR0FBUztBQUM1QixZQUFJLFdBQVcsQ0FBQyxRQUFRLEVBQUU7QUFDeEIsZ0JBQUssY0FBYyxDQUFDLFdBQVcsQ0FBQyxRQUFRLEVBQUUsS0FBSyxDQUFDLENBQUM7U0FDbEQ7T0FDRixDQUFDOztBQUVGLFVBQU0sY0FBYyxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsY0FBYyxFQUFFLENBQUMsSUFBSSxDQUF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