"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.OS_TYPES = void 0;
var OS_TYPES = {
  MAC_OS: 'Mac OS',
  IOS: 'iOS',
  WINDOWS: 'Windows',
  ANDROID: 'Android',
  LINUX: 'Linux'
};
exports.OS_TYPES = OS_TYPES;

var getOS = function getOS() {
  var userAgent = window.navigator.userAgent;
  var platform = window.navigator.platform;
  var macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
  var windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
  var iosPlatforms = ['iPhone', 'iPad', 'iPod'];
  var os = null;

  if (macosPlatforms.indexOf(platform) !== -1) {
    os = OS_TYPES.MAC_OS;
  } else if (iosPlatforms.indexOf(platform) !== -1) {
    os = OS_TYPES.IOS;
  } else if (windowsPlatforms.indexOf(platform) !== -1) {
    os = OS_TYPES.WINDOWS;
  } else if (/Android/.test(userAgent)) {
    os = OS_TYPES.ANDROID;
  } else if (!os && /Linux/.test(platform)) {
    os = OS_TYPES.LINUX;
  }

  return os;
};

var _default = getOS;
exports.default = _default;