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,KAEhD,IAAI,EAAU,iBAAiB,cAG/B,KAAK,mBACH,KAAK,kBAAkB,CACrB,CACE,MAAS,OACT,QAAW,CACT,CACE,MAAS,kCACT,KAAQ,WACR,QAAW,EAAQ,wBACnB,MAAS,SAAU,GACQ,cAAc,gBAAgB,GACpC,YAAY,KAC7B,6DACA,EAAS,SAGX,IAAI,EAAU,iBAAiB,cAC/B,iBAAiB,YACf,OAAO,OACL,EACA,CAAE,wBAA2B,EAAS,UAG5C,GAEF,CACE,MAAS,gCACT,KAAQ,WACR,QAAW,EAAQ,eACnB,MAAS,SAAU,GACQ,cAAc,gBAAgB,GACpC,YAAY,KAC7B,qDACA,EAAS,SAGX,IAAI,EAAU,iBAAiB,cAC/B,iBAAiB,YACf,OAAO,OACL,EACA,CAAE,eAAkB,EAAS,UAGnC,OAKT,GAEL,CAGA,IAAI,WAAa,IAAI,oBAAmB,KAElC,aACE,WAAW,eACb,WAAW,UAGb,WAAW,QACb,IAGE,YACF,IAAI,OAMN,IAAI,GAAG,QAAS,cAGhB,IAAI,GAAG,qBAAqB,WAGD,WAArB,QAAQ,UACV,IAAI,MAER,IAEA,IAAI,GAAG,YAAY,WAGE,OAAf,YACF,cAEJ","file":"/npm/chrome-downloader-gui@1.0.4/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/chrome-downloader-gui@1.0.4/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\r\n\r\n// Imports\r\nconst path = require('path');\r\nconst url = require('url');\r\n\r\nconst { app, BrowserWindow, shell, Menu, ipcMain } = require('electron');\r\nconst windowStateKeeper = require('electron-window-state');\r\n\r\nconst ChromeDownloader = require('./chrome-downloader');\r\nconst Logger = require('./logger');\r\nconst Constants = require('./constants');\r\n\r\n\r\n// Keep a global reference of the window object, if you don't, the window will\r\n// be closed automatically when the JavaScript object is garbage collected.\r\nlet mainWindow;\r\n\r\nfunction createWindow() {\r\n  // Listen some basics events\r\n  process.on('uncaughtException', err => {\r\n    Logger.error(err);\r\n  });\r\n\r\n  process.on('unhandledRejection', (reason, p) => {\r\n    Logger.error('Unhandled Rejection at: Promise', p, 'reason:', reason);\r\n  });\r\n\r\n  process.on('warning', warning => {\r\n    Logger.warn(warning);\r\n  });\r\n\r\n  // Load the previous state with fallback to defaults\r\n  let mainWindowState = windowStateKeeper({\r\n    'defaultWidth': 900,\r\n    'defaultHeight': 800,\r\n    'maximize': true,\r\n    'fullScreen': true,\r\n    'path': Constants.BASE_DIRECTORY_PATH\r\n  });\r\n\r\n  // Setup the application\r\n  ChromeDownloader.initDefaultRcFile();\r\n\r\n  // Create the browser window.\r\n  mainWindow = new BrowserWindow({\r\n    'resizable': true,\r\n    'fullscreenable': true,\r\n\r\n    'minWidth': 450,\r\n    'minHeight': 400,\r\n\r\n    'x': mainWindowState.x,\r\n    'y': mainWindowState.y,\r\n    'width': mainWindowState.width,\r\n    'height': mainWindowState.height,\r\n    'fullscreen': mainWindowState.isFullScreen,\r\n\r\n    'icon': path.resolve(path.join(__dirname, '../app/app.ico'))\r\n  });\r\n\r\n  // Disable menu\r\n  mainWindow.setMenu(null);\r\n\r\n  // Let us register listeners on the window, so we can update the state\r\n  // automatically (the listeners will be removed when the window is closed)\r\n  // and restore the maximized or full screen state\r\n  mainWindowState.manage(mainWindow);\r\n\r\n  // and load the index.html of the app.\r\n  mainWindow.loadURL(url.format({\r\n    'pathname': path.resolve(path.join(__dirname, '../app/index.html')),\r\n    'protocol': 'file:',\r\n    'slashes': true\r\n  }));\r\n\r\n  // Open the DevTools.\r\n  if (process.env.NODE_ENV === 'dev') {\r\n    // We are in development process\r\n    require('devtron').install();\r\n    mainWindow.webContents.openDevTools();\r\n  }\r\n\r\n  // Emitted when the window is closed.\r\n  mainWindow.on('closed', function () {\r\n    // Dereference the window object, usually you would store windows\r\n    // in an array if your app supports multi windows, this is the time\r\n    // when you should delete the corresponding element.\r\n    mainWindow = null;\r\n  });\r\n\r\n  // When a new window should be open\r\n  mainWindow.webContents.on('new-window', (event, externalUrl) => {\r\n    // stop Electron from opening another BrowserWindow\r\n    event.preventDefault();\r\n    // open the url in the default system browser\r\n    shell.openExternal(externalUrl);\r\n  });\r\n\r\n  // Listen IPC events\r\n  ipcMain.on('ipcEventProject--application-loaded', () => {\r\n    // Load context\r\n    let context = ChromeDownloader.loadContext();\r\n\r\n    // Create the menu\r\n    Menu.setApplicationMenu(\r\n      Menu.buildFromTemplate([\r\n        {\r\n          'label': 'View',\r\n          'submenu': [\r\n            {\r\n              'label': 'Display only donwloaded release',\r\n              'type': 'checkbox',\r\n              'checked': context.filterDownloadedRelease,\r\n              'click': function (menuItem) {\r\n                let firstBrowserWindow = BrowserWindow.getAllWindows()[0];\r\n                firstBrowserWindow.webContents.send(\r\n                  'ipcEventProject--menu-view-display-only-downloaded-release',\r\n                  menuItem.checked\r\n                );\r\n\r\n                let context = ChromeDownloader.loadContext();\r\n                ChromeDownloader.saveContext(\r\n                  Object.assign(\r\n                    context,\r\n                    { 'filterDownloadedRelease': menuItem.checked }\r\n                  )\r\n                );\r\n              }\r\n            },\r\n            {\r\n              'label': 'Display filter bar by version',\r\n              'type': 'checkbox',\r\n              'checked': context.filterVersions,\r\n              'click': function (menuItem) {\r\n                let firstBrowserWindow = BrowserWindow.getAllWindows()[0];\r\n                firstBrowserWindow.webContents.send(\r\n                  'ipcEventProject--menu-view-display-filter-versions',\r\n                  menuItem.checked\r\n                );\r\n\r\n                let context = ChromeDownloader.loadContext();\r\n                ChromeDownloader.saveContext(\r\n                  Object.assign(\r\n                    context,\r\n                    { 'filterVersions': menuItem.checked }\r\n                  )\r\n                );\r\n              }\r\n            }\r\n          ]\r\n        }\r\n      ])\r\n    );\r\n  });\r\n}\r\n\r\n// Try to be sure to have only one instance\r\nlet shouldQuit = app.makeSingleInstance(() => {\r\n  // Someone tried to run a second instance, we should focus our window.\r\n  if (mainWindow) {\r\n    if (mainWindow.isMinimized()) {\r\n      mainWindow.restore();\r\n    }\r\n\r\n    mainWindow.focus();\r\n  }\r\n});\r\n\r\nif (shouldQuit) {\r\n  app.quit();\r\n}\r\n\r\n// This method will be called when Electron has finished\r\n// initialization and is ready to create browser windows.\r\n// Some APIs can only be used after this event occurs.\r\napp.on('ready', createWindow);\r\n\r\n// Quit when all windows are closed.\r\napp.on('window-all-closed', function () {\r\n  // On OS X it is common for applications and their menu bar\r\n  // to stay active until the user quits explicitly with Cmd + Q\r\n  if (process.platform !== 'darwin') {\r\n    app.quit();\r\n  }\r\n});\r\n\r\napp.on('activate', function () {\r\n  // On OS X it's common to re-create a window in the app when the\r\n  // dock icon is clicked and there are no other windows open.\r\n  if (mainWindow === null) {\r\n    createWindow();\r\n  }\r\n});\r\n\r\n// In this file you can include the rest of your app's specific main process\r\n// code. You can also put them in separate files and require them here.\r\n"]}