if (process.type === 'browser') { try { require('source-map-support').install(); } catch(ignored) {} }var log = require('common/utils/logger').debugLogger(__filename); var logError = require('common/utils/logger').errorLogger(__filename, false); var logFatal = require('common/utils/logger').errorLogger(__filename, true);'use strict';

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

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _get2 = require('babel-runtime/helpers/get');

var _get3 = _interopRequireDefault(_get2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _url = require('url');

var _url2 = _interopRequireDefault(_url);

var _base = require('browser/components/auto-updater/base');

var _base2 = _interopRequireDefault(_base);

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

var AutoUpdater = function (_BaseAutoUpdater) {
  (0, _inherits3.default)(AutoUpdater, _BaseAutoUpdater);

  function AutoUpdater() {
    (0, _classCallCheck3.default)(this, AutoUpdater);
    return (0, _possibleConstructorReturn3.default)(this, (AutoUpdater.__proto__ || (0, _getPrototypeOf2.default)(AutoUpdater)).apply(this, arguments));
  }

  (0, _createClass3.default)(AutoUpdater, [{
    key: 'checkForUpdates',
    value: function checkForUpdates() {
      if (!this.latestReleaseUrl) {
        this.emit('error', new Error('Latest release URL is not set'));
        return;
      }

      var packageType = global.manifest.distrib.split(':')[1];
      var arch = null;

      if (packageType === 'deb') {
        arch = process.arch === 'ia32' ? 'i386' : 'amd64';
      } else {
        arch = process.arch === 'ia32' ? 'i386' : 'x86_64';
      }

      var urlObj = _url2.default.parse(this.latestReleaseUrl);
      urlObj.query = urlObj.query || {};
      urlObj.query.pkg = packageType;
      urlObj.query.arch = arch;

      var url = _url2.default.format(urlObj);
      (0, _get3.default)(AutoUpdater.prototype.__proto__ || (0, _getPrototypeOf2.default)(AutoUpdater.prototype), 'checkForUpdates', this).call(this, url);
    }
  }]);
  return AutoUpdater;
}(_base2.default);

exports.default = new AutoUpdater();
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJyb3dzZXIvY29tcG9uZW50cy9hdXRvLXVwZGF0ZXIvaW1wbC1saW51eC5qcyJdLCJuYW1lcyI6WyJBdXRvVXBkYXRlciIsImxhdGVzdFJlbGVhc2VVcmwiLCJlbWl0IiwiRXJyb3IiLCJwYWNrYWdlVHlwZSIsImdsb2JhbCIsIm1hbmlmZXN0IiwiZGlzdHJpYiIsInNwbGl0IiwiYXJjaCIsInByb2Nlc3MiLCJ1cmxPYmoiLCJwYXJzZSIsInF1ZXJ5IiwicGtnIiwidXJsIiwiZm9ybWF0Il0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQTs7OztBQUVBOzs7Ozs7SUFFTUEsVzs7Ozs7Ozs7OztzQ0FFZTtBQUNqQixVQUFJLENBQUMsS0FBS0MsZ0JBQVYsRUFBNEI7QUFDMUIsYUFBS0MsSUFBTCxDQUFVLE9BQVYsRUFBbUIsSUFBSUMsS0FBSixDQUFVLCtCQUFWLENBQW5CO0FBQ0E7QUFDRDs7QUFFRCxVQUFNQyxjQUFjQyxPQUFPQyxRQUFQLENBQWdCQyxPQUFoQixDQUF3QkMsS0FBeEIsQ0FBOEIsR0FBOUIsRUFBbUMsQ0FBbkMsQ0FBcEI7QUFDQSxVQUFJQyxPQUFPLElBQVg7O0FBRUEsVUFBSUwsZ0JBQWdCLEtBQXBCLEVBQTJCO0FBQ3pCSyxlQUFPQyxRQUFRRCxJQUFSLEtBQWl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