import UAParser from "ua-parser-js";

const examShellRegex = [
  [/(electron-exam-shell)\/([\w.]+)/i],
  [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION],
];
export default new UAParser(
  navigator.userAgent,
  // "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) electron-exam-shell/2.0.0 Chrome/77.0.3865.120 Safari/537.36 ",
  { browser: examShellRegex }
);

export const chromeUA = new UAParser(
  navigator.userAgent.replace("electron-exam-shell/", "")
).getBrowser();

// const UA = new UAParser(
//   // null,
//   "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) electron-exam-shell/2.0.0 Chrome/76.0.3809.139 Electron/6.0.7 Safari/537.36",
//   // navigator.userAgent,
//   { browser: examShellRegex }
// );
// console.log(UA.getResult());

// window.UA = new UAParser(
//   // null,
//   navigator.userAgent,
//   // "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) electron-exam-shell/2.0.0 Chrome/77.0.3865.120 Safari/537.36 ",
//   { browser: examShellRegex }
// );
