diff --git a/CHANGELOG.md b/CHANGELOG.md index 02af1415..45259905 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to - Minimise GitHub API calls. +### Fixed + +- Use stricter cache keys. + ## [3.0.3] ### Fixed diff --git a/dist/LICENSE.txt b/dist/LICENSE.txt index dcf1547e..5fcfb702 100644 --- a/dist/LICENSE.txt +++ b/dist/LICENSE.txt @@ -1344,6 +1344,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +systeminformation +MIT +The MIT License (MIT) + +Copyright (c) 2014-2024 Sebastian Hildebrandt + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + tslib 0BSD Copyright (c) Microsoft Corporation. diff --git a/dist/index.js b/dist/index.js index 575ec7ce..355d572b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module"; /******/ var __webpack_modules__ = ({ -/***/ 6930: +/***/ 86930: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -39,11 +39,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.saveCache = exports.restoreCache = exports.isFeatureAvailable = exports.ReserveCacheError = exports.ValidationError = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const path = __importStar(__nccwpck_require__(1017)); -const utils = __importStar(__nccwpck_require__(4812)); -const cacheHttpClient = __importStar(__nccwpck_require__(4304)); -const tar_1 = __nccwpck_require__(917); +const core = __importStar(__nccwpck_require__(37117)); +const path = __importStar(__nccwpck_require__(71017)); +const utils = __importStar(__nccwpck_require__(44812)); +const cacheHttpClient = __importStar(__nccwpck_require__(74304)); +const tar_1 = __nccwpck_require__(60917); class ValidationError extends Error { constructor(message) { super(message); @@ -242,7 +242,7 @@ exports.saveCache = saveCache; /***/ }), -/***/ 4304: +/***/ 74304: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -280,16 +280,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.saveCache = exports.reserveCache = exports.downloadCache = exports.getCacheEntry = exports.getCacheVersion = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const http_client_1 = __nccwpck_require__(7301); -const auth_1 = __nccwpck_require__(9873); +const core = __importStar(__nccwpck_require__(37117)); +const http_client_1 = __nccwpck_require__(87301); +const auth_1 = __nccwpck_require__(99873); const crypto = __importStar(__nccwpck_require__(6113)); -const fs = __importStar(__nccwpck_require__(7147)); -const url_1 = __nccwpck_require__(7310); -const utils = __importStar(__nccwpck_require__(4812)); -const downloadUtils_1 = __nccwpck_require__(5613); +const fs = __importStar(__nccwpck_require__(57147)); +const url_1 = __nccwpck_require__(57310); +const utils = __importStar(__nccwpck_require__(44812)); +const downloadUtils_1 = __nccwpck_require__(55613); const options_1 = __nccwpck_require__(2269); -const requestUtils_1 = __nccwpck_require__(2506); +const requestUtils_1 = __nccwpck_require__(42506); const versionSalt = '1.0'; function getCacheApiUrl(resource) { const baseUrl = process.env['ACTIONS_CACHE_URL'] || ''; @@ -510,7 +510,7 @@ exports.saveCache = saveCache; /***/ }), -/***/ 4812: +/***/ 44812: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -555,16 +555,16 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isGhes = exports.assertDefined = exports.getGnuTarPathOnWindows = exports.getCacheFileName = exports.getCompressionMethod = exports.unlinkFile = exports.resolvePaths = exports.getArchiveFileSizeInBytes = exports.createTempDirectory = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const exec = __importStar(__nccwpck_require__(6473)); -const glob = __importStar(__nccwpck_require__(5256)); -const io = __importStar(__nccwpck_require__(47)); -const fs = __importStar(__nccwpck_require__(7147)); -const path = __importStar(__nccwpck_require__(1017)); -const semver = __importStar(__nccwpck_require__(3113)); -const util = __importStar(__nccwpck_require__(3837)); -const uuid_1 = __nccwpck_require__(3438); -const constants_1 = __nccwpck_require__(648); +const core = __importStar(__nccwpck_require__(37117)); +const exec = __importStar(__nccwpck_require__(66473)); +const glob = __importStar(__nccwpck_require__(95256)); +const io = __importStar(__nccwpck_require__(96890)); +const fs = __importStar(__nccwpck_require__(57147)); +const path = __importStar(__nccwpck_require__(71017)); +const semver = __importStar(__nccwpck_require__(23113)); +const util = __importStar(__nccwpck_require__(73837)); +const uuid_1 = __nccwpck_require__(73438); +const constants_1 = __nccwpck_require__(80648); // From https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L23 function createTempDirectory() { return __awaiter(this, void 0, void 0, function* () { @@ -714,7 +714,7 @@ exports.isGhes = isGhes; /***/ }), -/***/ 648: +/***/ 80648: /***/ ((__unused_webpack_module, exports) => { @@ -756,7 +756,7 @@ exports.ManifestFilename = 'manifest.txt'; /***/ }), -/***/ 5613: +/***/ 55613: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -794,17 +794,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.downloadCacheStorageSDK = exports.downloadCacheHttpClientConcurrent = exports.downloadCacheHttpClient = exports.DownloadProgress = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const http_client_1 = __nccwpck_require__(7301); -const storage_blob_1 = __nccwpck_require__(3625); -const buffer = __importStar(__nccwpck_require__(4300)); -const fs = __importStar(__nccwpck_require__(7147)); -const stream = __importStar(__nccwpck_require__(2781)); -const util = __importStar(__nccwpck_require__(3837)); -const utils = __importStar(__nccwpck_require__(4812)); -const constants_1 = __nccwpck_require__(648); -const requestUtils_1 = __nccwpck_require__(2506); -const abort_controller_1 = __nccwpck_require__(4383); +const core = __importStar(__nccwpck_require__(37117)); +const http_client_1 = __nccwpck_require__(87301); +const storage_blob_1 = __nccwpck_require__(33625); +const buffer = __importStar(__nccwpck_require__(14300)); +const fs = __importStar(__nccwpck_require__(57147)); +const stream = __importStar(__nccwpck_require__(12781)); +const util = __importStar(__nccwpck_require__(73837)); +const utils = __importStar(__nccwpck_require__(44812)); +const constants_1 = __nccwpck_require__(80648); +const requestUtils_1 = __nccwpck_require__(42506); +const abort_controller_1 = __nccwpck_require__(94383); /** * Pipes the body of a HTTP response to a stream * @@ -1140,7 +1140,7 @@ const promiseWithTimeout = (timeoutMs, promise) => __awaiter(void 0, void 0, voi /***/ }), -/***/ 2506: +/***/ 42506: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1178,9 +1178,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.retryHttpClientResponse = exports.retryTypedResponse = exports.retry = exports.isRetryableStatusCode = exports.isServerErrorStatusCode = exports.isSuccessStatusCode = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const http_client_1 = __nccwpck_require__(7301); -const constants_1 = __nccwpck_require__(648); +const core = __importStar(__nccwpck_require__(37117)); +const http_client_1 = __nccwpck_require__(87301); +const constants_1 = __nccwpck_require__(80648); function isSuccessStatusCode(statusCode) { if (!statusCode) { return false; @@ -1283,7 +1283,7 @@ exports.retryHttpClientResponse = retryHttpClientResponse; /***/ }), -/***/ 917: +/***/ 60917: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1321,12 +1321,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createTar = exports.extractTar = exports.listTar = void 0; -const exec_1 = __nccwpck_require__(6473); -const io = __importStar(__nccwpck_require__(47)); -const fs_1 = __nccwpck_require__(7147); -const path = __importStar(__nccwpck_require__(1017)); -const utils = __importStar(__nccwpck_require__(4812)); -const constants_1 = __nccwpck_require__(648); +const exec_1 = __nccwpck_require__(66473); +const io = __importStar(__nccwpck_require__(96890)); +const fs_1 = __nccwpck_require__(57147); +const path = __importStar(__nccwpck_require__(71017)); +const utils = __importStar(__nccwpck_require__(44812)); +const constants_1 = __nccwpck_require__(80648); const IS_WINDOWS = process.platform === 'win32'; // Returns tar path and type: BSD or GNU function getTarPath() { @@ -1590,7 +1590,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getDownloadOptions = exports.getUploadOptions = void 0; -const core = __importStar(__nccwpck_require__(7117)); +const core = __importStar(__nccwpck_require__(37117)); /** * Returns a copy of the upload options with defaults filled in. * @@ -1667,7 +1667,7 @@ exports.getDownloadOptions = getDownloadOptions; /***/ }), -/***/ 5256: +/***/ 95256: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1682,7 +1682,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.create = void 0; -const internal_globber_1 = __nccwpck_require__(9645); +const internal_globber_1 = __nccwpck_require__(79645); /** * Constructs a globber * @@ -1699,7 +1699,7 @@ exports.create = create; /***/ }), -/***/ 9303: +/***/ 39303: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1724,7 +1724,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOptions = void 0; -const core = __importStar(__nccwpck_require__(7117)); +const core = __importStar(__nccwpck_require__(37117)); /** * Returns a copy with defaults filled in. */ @@ -1755,7 +1755,7 @@ exports.getOptions = getOptions; /***/ }), -/***/ 9645: +/***/ 79645: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -1808,14 +1808,14 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DefaultGlobber = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const fs = __importStar(__nccwpck_require__(7147)); -const globOptionsHelper = __importStar(__nccwpck_require__(9303)); -const path = __importStar(__nccwpck_require__(1017)); -const patternHelper = __importStar(__nccwpck_require__(1361)); -const internal_match_kind_1 = __nccwpck_require__(6839); -const internal_pattern_1 = __nccwpck_require__(6372); -const internal_search_state_1 = __nccwpck_require__(8625); +const core = __importStar(__nccwpck_require__(37117)); +const fs = __importStar(__nccwpck_require__(57147)); +const globOptionsHelper = __importStar(__nccwpck_require__(39303)); +const path = __importStar(__nccwpck_require__(71017)); +const patternHelper = __importStar(__nccwpck_require__(71361)); +const internal_match_kind_1 = __nccwpck_require__(46839); +const internal_pattern_1 = __nccwpck_require__(96372); +const internal_search_state_1 = __nccwpck_require__(18625); const IS_WINDOWS = process.platform === 'win32'; class DefaultGlobber { constructor(options) { @@ -1996,7 +1996,7 @@ exports.DefaultGlobber = DefaultGlobber; /***/ }), -/***/ 6839: +/***/ 46839: /***/ ((__unused_webpack_module, exports) => { @@ -2020,7 +2020,7 @@ var MatchKind; /***/ }), -/***/ 8886: +/***/ 88886: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2048,8 +2048,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. @@ -2224,7 +2224,7 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; /***/ }), -/***/ 3851: +/***/ 33851: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2252,9 +2252,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Path = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(8886)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(88886)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Helper class for parsing paths into segments @@ -2343,7 +2343,7 @@ exports.Path = Path; /***/ }), -/***/ 1361: +/***/ 71361: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2368,8 +2368,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.partialMatch = exports.match = exports.getSearchPaths = void 0; -const pathHelper = __importStar(__nccwpck_require__(8886)); -const internal_match_kind_1 = __nccwpck_require__(6839); +const pathHelper = __importStar(__nccwpck_require__(88886)); +const internal_match_kind_1 = __nccwpck_require__(46839); const IS_WINDOWS = process.platform === 'win32'; /** * Given an array of patterns, returns an array of paths to search. @@ -2443,7 +2443,7 @@ exports.partialMatch = partialMatch; /***/ }), -/***/ 6372: +/***/ 96372: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -2471,13 +2471,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Pattern = void 0; -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(8886)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); -const minimatch_1 = __nccwpck_require__(9566); -const internal_match_kind_1 = __nccwpck_require__(6839); -const internal_path_1 = __nccwpck_require__(3851); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(88886)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); +const minimatch_1 = __nccwpck_require__(99566); +const internal_match_kind_1 = __nccwpck_require__(46839); +const internal_path_1 = __nccwpck_require__(33851); const IS_WINDOWS = process.platform === 'win32'; class Pattern { constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) { @@ -2704,7 +2704,7 @@ exports.Pattern = Pattern; /***/ }), -/***/ 8625: +/***/ 18625: /***/ ((__unused_webpack_module, exports) => { @@ -2721,7 +2721,7 @@ exports.SearchState = SearchState; /***/ }), -/***/ 4383: +/***/ 94383: /***/ ((__unused_webpack_module, exports) => { @@ -2967,7 +2967,7 @@ exports.AbortSignal = AbortSignal; /***/ }), -/***/ 3113: +/***/ 23113: /***/ ((module, exports) => { exports = module.exports = SemVer @@ -4617,11 +4617,11 @@ function coerce (version, options) { /***/ }), -/***/ 3438: +/***/ 73438: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var v1 = __nccwpck_require__(2346); -var v4 = __nccwpck_require__(1049); +var v1 = __nccwpck_require__(62346); +var v4 = __nccwpck_require__(71049); var uuid = v4; uuid.v1 = v1; @@ -4632,7 +4632,7 @@ module.exports = uuid; /***/ }), -/***/ 4376: +/***/ 74376: /***/ ((module) => { /** @@ -4680,11 +4680,11 @@ module.exports = function nodeRNG() { /***/ }), -/***/ 2346: +/***/ 62346: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { var rng = __nccwpck_require__(9470); -var bytesToUuid = __nccwpck_require__(4376); +var bytesToUuid = __nccwpck_require__(74376); // **`v1()` - Generate time-based UUID** // @@ -4796,11 +4796,11 @@ module.exports = v1; /***/ }), -/***/ 1049: +/***/ 71049: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { var rng = __nccwpck_require__(9470); -var bytesToUuid = __nccwpck_require__(4376); +var bytesToUuid = __nccwpck_require__(74376); function v4(options, buf, offset) { var i = buf && offset || 0; @@ -4832,7 +4832,7 @@ module.exports = v4; /***/ }), -/***/ 9548: +/***/ 29548: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -4857,8 +4857,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; -const os = __importStar(__nccwpck_require__(2037)); -const utils_1 = __nccwpck_require__(7472); +const os = __importStar(__nccwpck_require__(22037)); +const utils_1 = __nccwpck_require__(87472); /** * Commands * @@ -4930,7 +4930,7 @@ function escapeProperty(s) { /***/ }), -/***/ 7117: +/***/ 37117: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -4964,12 +4964,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(9548); -const file_command_1 = __nccwpck_require__(2469); -const utils_1 = __nccwpck_require__(7472); -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const oidc_utils_1 = __nccwpck_require__(5172); +const command_1 = __nccwpck_require__(29548); +const file_command_1 = __nccwpck_require__(92469); +const utils_1 = __nccwpck_require__(87472); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const oidc_utils_1 = __nccwpck_require__(65172); /** * The code to exit an action */ @@ -5254,17 +5254,17 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(8452); +var summary_1 = __nccwpck_require__(38452); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(8452); +var summary_2 = __nccwpck_require__(38452); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); /** * Path exports */ -var path_utils_1 = __nccwpck_require__(6890); +var path_utils_1 = __nccwpck_require__(66890); Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } })); Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } })); Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } })); @@ -5272,7 +5272,7 @@ Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: funct /***/ }), -/***/ 2469: +/***/ 92469: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -5300,10 +5300,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; // We use any as a valid input type /* eslint-disable @typescript-eslint/no-explicit-any */ -const fs = __importStar(__nccwpck_require__(7147)); -const os = __importStar(__nccwpck_require__(2037)); -const uuid_1 = __nccwpck_require__(1972); -const utils_1 = __nccwpck_require__(7472); +const fs = __importStar(__nccwpck_require__(57147)); +const os = __importStar(__nccwpck_require__(22037)); +const uuid_1 = __nccwpck_require__(91972); +const utils_1 = __nccwpck_require__(87472); function issueFileCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -5336,7 +5336,7 @@ exports.prepareKeyValueMessage = prepareKeyValueMessage; /***/ }), -/***/ 5172: +/***/ 65172: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -5351,9 +5351,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(7301); -const auth_1 = __nccwpck_require__(9873); -const core_1 = __nccwpck_require__(7117); +const http_client_1 = __nccwpck_require__(87301); +const auth_1 = __nccwpck_require__(99873); +const core_1 = __nccwpck_require__(37117); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -5419,7 +5419,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 6890: +/***/ 66890: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -5444,7 +5444,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0; -const path = __importStar(__nccwpck_require__(1017)); +const path = __importStar(__nccwpck_require__(71017)); /** * toPosixPath converts the given path to the posix form. On Windows, \\ will be * replaced with /. @@ -5483,7 +5483,7 @@ exports.toPlatformPath = toPlatformPath; /***/ }), -/***/ 8452: +/***/ 38452: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -5498,8 +5498,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0; -const os_1 = __nccwpck_require__(2037); -const fs_1 = __nccwpck_require__(7147); +const os_1 = __nccwpck_require__(22037); +const fs_1 = __nccwpck_require__(57147); const { access, appendFile, writeFile } = fs_1.promises; exports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY'; exports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary'; @@ -5772,7 +5772,7 @@ exports.summary = _summary; /***/ }), -/***/ 7472: +/***/ 87472: /***/ ((__unused_webpack_module, exports) => { @@ -5818,7 +5818,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 6473: +/***/ 66473: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -5852,8 +5852,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getExecOutput = exports.exec = void 0; -const string_decoder_1 = __nccwpck_require__(1576); -const tr = __importStar(__nccwpck_require__(66)); +const string_decoder_1 = __nccwpck_require__(71576); +const tr = __importStar(__nccwpck_require__(70066)); /** * Exec a command. * Output will be streamed to the live console. @@ -5927,7 +5927,7 @@ exports.getExecOutput = getExecOutput; /***/ }), -/***/ 66: +/***/ 70066: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -5961,13 +5961,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.argStringToArray = exports.ToolRunner = void 0; -const os = __importStar(__nccwpck_require__(2037)); -const events = __importStar(__nccwpck_require__(2361)); -const child = __importStar(__nccwpck_require__(2081)); -const path = __importStar(__nccwpck_require__(1017)); -const io = __importStar(__nccwpck_require__(47)); -const ioUtil = __importStar(__nccwpck_require__(6327)); -const timers_1 = __nccwpck_require__(9512); +const os = __importStar(__nccwpck_require__(22037)); +const events = __importStar(__nccwpck_require__(82361)); +const child = __importStar(__nccwpck_require__(32081)); +const path = __importStar(__nccwpck_require__(71017)); +const io = __importStar(__nccwpck_require__(96890)); +const ioUtil = __importStar(__nccwpck_require__(96327)); +const timers_1 = __nccwpck_require__(39512); /* eslint-disable @typescript-eslint/unbound-method */ const IS_WINDOWS = process.platform === 'win32'; /* @@ -6551,14 +6551,14 @@ class ExecState extends events.EventEmitter { /***/ }), -/***/ 9217: +/***/ 69217: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Context = void 0; -const fs_1 = __nccwpck_require__(7147); -const os_1 = __nccwpck_require__(2037); +const fs_1 = __nccwpck_require__(57147); +const os_1 = __nccwpck_require__(22037); class Context { /** * Hydrate the context from the environment @@ -6612,7 +6612,7 @@ exports.Context = Context; /***/ }), -/***/ 4005: +/***/ 84005: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -6641,8 +6641,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOctokit = exports.context = void 0; -const Context = __importStar(__nccwpck_require__(9217)); -const utils_1 = __nccwpck_require__(8840); +const Context = __importStar(__nccwpck_require__(69217)); +const utils_1 = __nccwpck_require__(48840); exports.context = new Context.Context(); /** * Returns a hydrated octokit ready to use for GitHub Actions @@ -6659,7 +6659,7 @@ exports.getOctokit = getOctokit; /***/ }), -/***/ 2402: +/***/ 92402: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -6697,7 +6697,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getApiBaseUrl = exports.getProxyFetch = exports.getProxyAgentDispatcher = exports.getProxyAgent = exports.getAuthString = void 0; -const httpClient = __importStar(__nccwpck_require__(7301)); +const httpClient = __importStar(__nccwpck_require__(87301)); const undici_1 = __nccwpck_require__(7482); function getAuthString(token, options) { if (!token && !options.auth) { @@ -6735,7 +6735,7 @@ exports.getApiBaseUrl = getApiBaseUrl; /***/ }), -/***/ 8840: +/***/ 48840: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -6764,12 +6764,12 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0; -const Context = __importStar(__nccwpck_require__(9217)); -const Utils = __importStar(__nccwpck_require__(2402)); +const Context = __importStar(__nccwpck_require__(69217)); +const Utils = __importStar(__nccwpck_require__(92402)); // octokit + plugins -const core_1 = __nccwpck_require__(5341); -const plugin_rest_endpoint_methods_1 = __nccwpck_require__(2460); -const plugin_paginate_rest_1 = __nccwpck_require__(8100); +const core_1 = __nccwpck_require__(25341); +const plugin_rest_endpoint_methods_1 = __nccwpck_require__(36690); +const plugin_paginate_rest_1 = __nccwpck_require__(78100); exports.context = new Context.Context(); const baseUrl = Utils.getApiBaseUrl(); exports.defaults = { @@ -6800,7 +6800,7 @@ exports.getOctokitOptions = getOctokitOptions; /***/ }), -/***/ 3553: +/***/ 43553: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -6815,8 +6815,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.hashFiles = exports.create = void 0; -const internal_globber_1 = __nccwpck_require__(2027); -const internal_hash_files_1 = __nccwpck_require__(5719); +const internal_globber_1 = __nccwpck_require__(22027); +const internal_hash_files_1 = __nccwpck_require__(55719); /** * Constructs a globber * @@ -6852,7 +6852,7 @@ exports.hashFiles = hashFiles; /***/ }), -/***/ 1738: +/***/ 21738: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -6877,7 +6877,7 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOptions = void 0; -const core = __importStar(__nccwpck_require__(7117)); +const core = __importStar(__nccwpck_require__(37117)); /** * Returns a copy with defaults filled in. */ @@ -6913,7 +6913,7 @@ exports.getOptions = getOptions; /***/ }), -/***/ 2027: +/***/ 22027: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -6966,14 +6966,14 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DefaultGlobber = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const fs = __importStar(__nccwpck_require__(7147)); -const globOptionsHelper = __importStar(__nccwpck_require__(1738)); -const path = __importStar(__nccwpck_require__(1017)); -const patternHelper = __importStar(__nccwpck_require__(6235)); -const internal_match_kind_1 = __nccwpck_require__(1631); -const internal_pattern_1 = __nccwpck_require__(3976); -const internal_search_state_1 = __nccwpck_require__(8873); +const core = __importStar(__nccwpck_require__(37117)); +const fs = __importStar(__nccwpck_require__(57147)); +const globOptionsHelper = __importStar(__nccwpck_require__(21738)); +const path = __importStar(__nccwpck_require__(71017)); +const patternHelper = __importStar(__nccwpck_require__(16235)); +const internal_match_kind_1 = __nccwpck_require__(21631); +const internal_pattern_1 = __nccwpck_require__(73976); +const internal_search_state_1 = __nccwpck_require__(88873); const IS_WINDOWS = process.platform === 'win32'; class DefaultGlobber { constructor(options) { @@ -7154,7 +7154,7 @@ exports.DefaultGlobber = DefaultGlobber; /***/ }), -/***/ 5719: +/***/ 55719: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -7196,11 +7196,11 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.hashFiles = void 0; const crypto = __importStar(__nccwpck_require__(6113)); -const core = __importStar(__nccwpck_require__(7117)); -const fs = __importStar(__nccwpck_require__(7147)); -const stream = __importStar(__nccwpck_require__(2781)); -const util = __importStar(__nccwpck_require__(3837)); -const path = __importStar(__nccwpck_require__(1017)); +const core = __importStar(__nccwpck_require__(37117)); +const fs = __importStar(__nccwpck_require__(57147)); +const stream = __importStar(__nccwpck_require__(12781)); +const util = __importStar(__nccwpck_require__(73837)); +const path = __importStar(__nccwpck_require__(71017)); function hashFiles(globber, currentWorkspace, verbose = false) { var e_1, _a; var _b; @@ -7257,7 +7257,7 @@ exports.hashFiles = hashFiles; /***/ }), -/***/ 1631: +/***/ 21631: /***/ ((__unused_webpack_module, exports) => { @@ -7281,7 +7281,7 @@ var MatchKind; /***/ }), -/***/ 5372: +/***/ 15372: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -7309,8 +7309,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. @@ -7485,7 +7485,7 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator; /***/ }), -/***/ 826: +/***/ 40826: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -7513,9 +7513,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Path = void 0; -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(5372)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(15372)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); const IS_WINDOWS = process.platform === 'win32'; /** * Helper class for parsing paths into segments @@ -7604,7 +7604,7 @@ exports.Path = Path; /***/ }), -/***/ 6235: +/***/ 16235: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -7629,8 +7629,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.partialMatch = exports.match = exports.getSearchPaths = void 0; -const pathHelper = __importStar(__nccwpck_require__(5372)); -const internal_match_kind_1 = __nccwpck_require__(1631); +const pathHelper = __importStar(__nccwpck_require__(15372)); +const internal_match_kind_1 = __nccwpck_require__(21631); const IS_WINDOWS = process.platform === 'win32'; /** * Given an array of patterns, returns an array of paths to search. @@ -7704,7 +7704,7 @@ exports.partialMatch = partialMatch; /***/ }), -/***/ 3976: +/***/ 73976: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -7732,13 +7732,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Pattern = void 0; -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const pathHelper = __importStar(__nccwpck_require__(5372)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); -const minimatch_1 = __nccwpck_require__(9566); -const internal_match_kind_1 = __nccwpck_require__(1631); -const internal_path_1 = __nccwpck_require__(826); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const pathHelper = __importStar(__nccwpck_require__(15372)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); +const minimatch_1 = __nccwpck_require__(99566); +const internal_match_kind_1 = __nccwpck_require__(21631); +const internal_path_1 = __nccwpck_require__(40826); const IS_WINDOWS = process.platform === 'win32'; class Pattern { constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) { @@ -7965,7 +7965,7 @@ exports.Pattern = Pattern; /***/ }), -/***/ 8873: +/***/ 88873: /***/ ((__unused_webpack_module, exports) => { @@ -7982,7 +7982,7 @@ exports.SearchState = SearchState; /***/ }), -/***/ 9873: +/***/ 99873: /***/ (function(__unused_webpack_module, exports) { @@ -8069,7 +8069,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 7301: +/***/ 87301: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -8108,10 +8108,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; -const http = __importStar(__nccwpck_require__(3685)); -const https = __importStar(__nccwpck_require__(5687)); -const pm = __importStar(__nccwpck_require__(1390)); -const tunnel = __importStar(__nccwpck_require__(9382)); +const http = __importStar(__nccwpck_require__(13685)); +const https = __importStar(__nccwpck_require__(95687)); +const pm = __importStar(__nccwpck_require__(11390)); +const tunnel = __importStar(__nccwpck_require__(89382)); const undici_1 = __nccwpck_require__(7482); var HttpCodes; (function (HttpCodes) { @@ -8727,7 +8727,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 1390: +/***/ 11390: /***/ ((__unused_webpack_module, exports) => { @@ -8815,7 +8815,7 @@ function isLoopbackAddress(host) { /***/ }), -/***/ 6327: +/***/ 96327: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -8850,8 +8850,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge var _a; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0; -const fs = __importStar(__nccwpck_require__(7147)); -const path = __importStar(__nccwpck_require__(1017)); +const fs = __importStar(__nccwpck_require__(57147)); +const path = __importStar(__nccwpck_require__(71017)); _a = fs.promises // export const {open} = 'fs' , exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; @@ -9004,7 +9004,7 @@ exports.getCmdPath = getCmdPath; /***/ }), -/***/ 47: +/***/ 96890: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -9038,9 +9038,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0; -const assert_1 = __nccwpck_require__(9491); -const path = __importStar(__nccwpck_require__(1017)); -const ioUtil = __importStar(__nccwpck_require__(6327)); +const assert_1 = __nccwpck_require__(39491); +const path = __importStar(__nccwpck_require__(71017)); +const ioUtil = __importStar(__nccwpck_require__(96327)); /** * Copies a file or folder. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js @@ -9309,7 +9309,7 @@ function copyFile(srcFile, destFile, force) { /***/ }), -/***/ 3902: +/***/ 97399: /***/ (function(module, exports, __nccwpck_require__) { @@ -9343,13 +9343,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0; -const semver = __importStar(__nccwpck_require__(1408)); -const core_1 = __nccwpck_require__(7117); +const semver = __importStar(__nccwpck_require__(81408)); +const core_1 = __nccwpck_require__(37117); // needs to be require for core node modules to be mocked /* eslint @typescript-eslint/no-require-imports: 0 */ -const os = __nccwpck_require__(2037); -const cp = __nccwpck_require__(2081); -const fs = __nccwpck_require__(7147); +const os = __nccwpck_require__(22037); +const cp = __nccwpck_require__(32081); +const fs = __nccwpck_require__(57147); function _findMatch(versionSpec, stable, candidates, archFilter) { return __awaiter(this, void 0, void 0, function* () { const platFilter = os.platform(); @@ -9477,7 +9477,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RetryHelper = void 0; -const core = __importStar(__nccwpck_require__(7117)); +const core = __importStar(__nccwpck_require__(37117)); /** * Internal class for retries */ @@ -9532,7 +9532,7 @@ exports.RetryHelper = RetryHelper; /***/ }), -/***/ 834: +/***/ 40834: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -9569,19 +9569,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0; -const core = __importStar(__nccwpck_require__(7117)); -const io = __importStar(__nccwpck_require__(47)); -const fs = __importStar(__nccwpck_require__(7147)); -const mm = __importStar(__nccwpck_require__(3902)); -const os = __importStar(__nccwpck_require__(2037)); -const path = __importStar(__nccwpck_require__(1017)); -const httpm = __importStar(__nccwpck_require__(7301)); -const semver = __importStar(__nccwpck_require__(1408)); -const stream = __importStar(__nccwpck_require__(2781)); -const util = __importStar(__nccwpck_require__(3837)); -const assert_1 = __nccwpck_require__(9491); -const v4_1 = __importDefault(__nccwpck_require__(7273)); -const exec_1 = __nccwpck_require__(6473); +const core = __importStar(__nccwpck_require__(37117)); +const io = __importStar(__nccwpck_require__(96890)); +const fs = __importStar(__nccwpck_require__(57147)); +const mm = __importStar(__nccwpck_require__(97399)); +const os = __importStar(__nccwpck_require__(22037)); +const path = __importStar(__nccwpck_require__(71017)); +const httpm = __importStar(__nccwpck_require__(87301)); +const semver = __importStar(__nccwpck_require__(81408)); +const stream = __importStar(__nccwpck_require__(12781)); +const util = __importStar(__nccwpck_require__(73837)); +const assert_1 = __nccwpck_require__(39491); +const v4_1 = __importDefault(__nccwpck_require__(27273)); +const exec_1 = __nccwpck_require__(66473); const retry_helper_1 = __nccwpck_require__(9984); class HTTPError extends Error { constructor(httpStatusCode) { @@ -10203,7 +10203,7 @@ function _unique(values) { /***/ }), -/***/ 1408: +/***/ 81408: /***/ ((module, exports) => { exports = module.exports = SemVer @@ -11853,7 +11853,7 @@ function coerce (version, options) { /***/ }), -/***/ 2827: +/***/ 62827: /***/ ((module) => { /** @@ -11886,7 +11886,7 @@ module.exports = bytesToUuid; /***/ }), -/***/ 6736: +/***/ 16736: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // Unique ID creation requires a high quality random # generator. In node.js @@ -11901,11 +11901,11 @@ module.exports = function nodeRNG() { /***/ }), -/***/ 7273: +/***/ 27273: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var rng = __nccwpck_require__(6736); -var bytesToUuid = __nccwpck_require__(2827); +var rng = __nccwpck_require__(16736); +var bytesToUuid = __nccwpck_require__(62827); function v4(options, buf, offset) { var i = buf && offset || 0; @@ -11937,30 +11937,30 @@ module.exports = v4; /***/ }), -/***/ 3625: +/***/ 33625: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); -var coreRestPipeline = __nccwpck_require__(1547); -var tslib = __nccwpck_require__(36); -var coreAuth = __nccwpck_require__(6411); -var coreUtil = __nccwpck_require__(7409); +var coreRestPipeline = __nccwpck_require__(61547); +var tslib = __nccwpck_require__(30036); +var coreAuth = __nccwpck_require__(36411); +var coreUtil = __nccwpck_require__(77409); var coreHttpCompat = __nccwpck_require__(4338); -var coreClient = __nccwpck_require__(9384); -var coreXml = __nccwpck_require__(8160); -var logger$1 = __nccwpck_require__(865); -var abortController = __nccwpck_require__(2046); +var coreClient = __nccwpck_require__(29384); +var coreXml = __nccwpck_require__(18160); +var logger$1 = __nccwpck_require__(10865); +var abortController = __nccwpck_require__(82046); var crypto = __nccwpck_require__(6113); -var coreTracing = __nccwpck_require__(3099); -var stream = __nccwpck_require__(2781); -var coreLro = __nccwpck_require__(2173); -var events = __nccwpck_require__(2361); -var fs = __nccwpck_require__(7147); -var util = __nccwpck_require__(3837); -var buffer = __nccwpck_require__(4300); +var coreTracing = __nccwpck_require__(23099); +var stream = __nccwpck_require__(12781); +var coreLro = __nccwpck_require__(72173); +var events = __nccwpck_require__(82361); +var fs = __nccwpck_require__(57147); +var util = __nccwpck_require__(73837); +var buffer = __nccwpck_require__(14300); function _interopNamespaceDefault(e) { var n = Object.create(null); @@ -36773,7 +36773,7 @@ exports.newPipeline = newPipeline; /***/ }), -/***/ 2046: +/***/ 82046: /***/ ((__unused_webpack_module, exports) => { @@ -37019,7 +37019,7 @@ exports.AbortSignal = AbortSignal; /***/ }), -/***/ 6258: +/***/ 66258: /***/ ((module) => { @@ -37103,7 +37103,7 @@ var createTokenAuth = function createTokenAuth2(token) { /***/ }), -/***/ 5341: +/***/ 25341: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -37131,11 +37131,11 @@ __export(dist_src_exports, { Octokit: () => Octokit }); module.exports = __toCommonJS(dist_src_exports); -var import_universal_user_agent = __nccwpck_require__(5212); -var import_before_after_hook = __nccwpck_require__(3635); -var import_request = __nccwpck_require__(8410); -var import_graphql = __nccwpck_require__(8559); -var import_auth_token = __nccwpck_require__(6258); +var import_universal_user_agent = __nccwpck_require__(65212); +var import_before_after_hook = __nccwpck_require__(13635); +var import_request = __nccwpck_require__(38410); +var import_graphql = __nccwpck_require__(48559); +var import_auth_token = __nccwpck_require__(66258); // pkg/dist-src/version.js var VERSION = "5.2.0"; @@ -37271,7 +37271,7 @@ var Octokit = class { /***/ }), -/***/ 8773: +/***/ 68773: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -37301,7 +37301,7 @@ __export(dist_src_exports, { module.exports = __toCommonJS(dist_src_exports); // pkg/dist-src/defaults.js -var import_universal_user_agent = __nccwpck_require__(5212); +var import_universal_user_agent = __nccwpck_require__(65212); // pkg/dist-src/version.js var VERSION = "9.0.5"; @@ -37654,7 +37654,7 @@ var endpoint = withDefaults(null, DEFAULTS); /***/ }), -/***/ 8559: +/***/ 48559: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -37684,17 +37684,17 @@ __export(dist_src_exports, { withCustomRequest: () => withCustomRequest }); module.exports = __toCommonJS(dist_src_exports); -var import_request3 = __nccwpck_require__(8410); -var import_universal_user_agent = __nccwpck_require__(5212); +var import_request3 = __nccwpck_require__(38410); +var import_universal_user_agent = __nccwpck_require__(65212); // pkg/dist-src/version.js var VERSION = "7.1.0"; // pkg/dist-src/with-defaults.js -var import_request2 = __nccwpck_require__(8410); +var import_request2 = __nccwpck_require__(38410); // pkg/dist-src/graphql.js -var import_request = __nccwpck_require__(8410); +var import_request = __nccwpck_require__(38410); // pkg/dist-src/error.js function _buildMessageForResponseErrors(data) { @@ -37811,7 +37811,7 @@ function withCustomRequest(customRequest) { /***/ }), -/***/ 8100: +/***/ 78100: /***/ ((module) => { @@ -38211,7 +38211,7 @@ paginateRest.VERSION = VERSION; /***/ }), -/***/ 2460: +/***/ 36690: /***/ ((module) => { @@ -40380,7 +40380,7 @@ legacyRestEndpointMethods.VERSION = VERSION; /***/ }), -/***/ 8696: +/***/ 88696: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -40418,8 +40418,8 @@ __export(dist_src_exports, { RequestError: () => RequestError }); module.exports = __toCommonJS(dist_src_exports); -var import_deprecation = __nccwpck_require__(5297); -var import_once = __toESM(__nccwpck_require__(7197)); +var import_deprecation = __nccwpck_require__(55297); +var import_once = __toESM(__nccwpck_require__(87197)); var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation)); var logOnceHeaders = (0, import_once.default)((deprecation) => console.warn(deprecation)); var RequestError = class extends Error { @@ -40477,7 +40477,7 @@ var RequestError = class extends Error { /***/ }), -/***/ 8410: +/***/ 38410: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -40505,8 +40505,8 @@ __export(dist_src_exports, { request: () => request }); module.exports = __toCommonJS(dist_src_exports); -var import_endpoint = __nccwpck_require__(8773); -var import_universal_user_agent = __nccwpck_require__(5212); +var import_endpoint = __nccwpck_require__(68773); +var import_universal_user_agent = __nccwpck_require__(65212); // pkg/dist-src/version.js var VERSION = "8.4.0"; @@ -40525,7 +40525,7 @@ function isPlainObject(value) { } // pkg/dist-src/fetch-wrapper.js -var import_request_error = __nccwpck_require__(8696); +var import_request_error = __nccwpck_require__(88696); // pkg/dist-src/get-buffer-response.js function getBufferResponse(response) { @@ -40706,7 +40706,7 @@ var request = withDefaults(import_endpoint.endpoint, { /***/ }), -/***/ 3708: +/***/ 93708: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -40735,8 +40735,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.req = exports.json = exports.toBuffer = void 0; -const http = __importStar(__nccwpck_require__(3685)); -const https = __importStar(__nccwpck_require__(5687)); +const http = __importStar(__nccwpck_require__(13685)); +const https = __importStar(__nccwpck_require__(95687)); async function toBuffer(stream) { let length = 0; const chunks = []; @@ -40778,7 +40778,7 @@ exports.req = req; /***/ }), -/***/ 129: +/***/ 80129: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -40810,10 +40810,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Agent = void 0; -const net = __importStar(__nccwpck_require__(1808)); -const http = __importStar(__nccwpck_require__(3685)); -const https_1 = __nccwpck_require__(5687); -__exportStar(__nccwpck_require__(3708), exports); +const net = __importStar(__nccwpck_require__(41808)); +const http = __importStar(__nccwpck_require__(13685)); +const https_1 = __nccwpck_require__(95687); +__exportStar(__nccwpck_require__(93708), exports); const INTERNAL = Symbol('AgentBaseInternalState'); class Agent extends http.Agent { constructor(opts) { @@ -40959,7 +40959,7 @@ exports.Agent = Agent; /***/ }), -/***/ 3353: +/***/ 23353: /***/ ((module) => { @@ -41028,12 +41028,12 @@ function range(a, b, str) { /***/ }), -/***/ 3635: +/***/ 13635: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var register = __nccwpck_require__(8195); -var addHook = __nccwpck_require__(8491); -var removeHook = __nccwpck_require__(48); +var register = __nccwpck_require__(18195); +var addHook = __nccwpck_require__(78491); +var removeHook = __nccwpck_require__(90048); // bind with array of arguments: https://stackoverflow.com/a/21792913 var bind = Function.bind; @@ -41096,7 +41096,7 @@ module.exports.Collection = Hook.Collection; /***/ }), -/***/ 8491: +/***/ 78491: /***/ ((module) => { module.exports = addHook; @@ -41149,7 +41149,7 @@ function addHook(state, kind, name, hook) { /***/ }), -/***/ 8195: +/***/ 18195: /***/ ((module) => { module.exports = register; @@ -41183,7 +41183,7 @@ function register(state, name, method, options) { /***/ }), -/***/ 48: +/***/ 90048: /***/ ((module) => { module.exports = removeHook; @@ -41209,7 +41209,7 @@ function removeHook(state, name, method) { /***/ }), -/***/ 6288: +/***/ 16288: /***/ ((module) => { module.exports = { @@ -41223,11 +41223,11 @@ module.exports = { /***/ }), -/***/ 3197: +/***/ 73197: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var concatMap = __nccwpck_require__(4527); -var balanced = __nccwpck_require__(3353); +var concatMap = __nccwpck_require__(84527); +var balanced = __nccwpck_require__(23353); module.exports = expandTop; @@ -41431,7 +41431,7 @@ function expand(str, isTop) { /***/ }), -/***/ 4527: +/***/ 84527: /***/ ((module) => { module.exports = function (xs, fn) { @@ -41451,7 +41451,7 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/***/ 7191: +/***/ 47191: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -41471,23 +41471,23 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.stringify = exports.parse = exports.isTraversal = void 0; -__exportStar(__nccwpck_require__(3575), exports); -var parse_1 = __nccwpck_require__(9186); +__exportStar(__nccwpck_require__(43575), exports); +var parse_1 = __nccwpck_require__(99186); Object.defineProperty(exports, "isTraversal", ({ enumerable: true, get: function () { return parse_1.isTraversal; } })); Object.defineProperty(exports, "parse", ({ enumerable: true, get: function () { return parse_1.parse; } })); -var stringify_1 = __nccwpck_require__(3416); +var stringify_1 = __nccwpck_require__(23416); Object.defineProperty(exports, "stringify", ({ enumerable: true, get: function () { return stringify_1.stringify; } })); /***/ }), -/***/ 9186: +/***/ 99186: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.parse = exports.isTraversal = void 0; -var types_1 = __nccwpck_require__(3575); +var types_1 = __nccwpck_require__(43575); var reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/; var reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi; var actionTypes = new Map([ @@ -41913,7 +41913,7 @@ function parseSelector(subselects, selector, selectorIndex) { /***/ }), -/***/ 3416: +/***/ 23416: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -41928,7 +41928,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.stringify = void 0; -var types_1 = __nccwpck_require__(3575); +var types_1 = __nccwpck_require__(43575); var attribValChars = ["\\", '"']; var pseudoValChars = __spreadArray(__spreadArray([], attribValChars, true), ["(", ")"], false); var charsToEscapeInAttributeValue = new Set(attribValChars.map(function (c) { return c.charCodeAt(0); })); @@ -42058,7 +42058,7 @@ function escapeName(str, charsToEscape) { /***/ }), -/***/ 3575: +/***/ 43575: /***/ ((__unused_webpack_module, exports) => { @@ -42107,7 +42107,7 @@ var AttributeAction; /***/ }), -/***/ 9851: +/***/ 39851: /***/ ((module, exports, __nccwpck_require__) => { /* eslint-env browser */ @@ -42366,7 +42366,7 @@ function localstorage() { } } -module.exports = __nccwpck_require__(6033)(exports); +module.exports = __nccwpck_require__(36033)(exports); const {formatters} = module.exports; @@ -42385,7 +42385,7 @@ formatters.j = function (v) { /***/ }), -/***/ 6033: +/***/ 36033: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -42401,7 +42401,7 @@ function setup(env) { createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; - createDebug.humanize = __nccwpck_require__(40); + createDebug.humanize = __nccwpck_require__(80040); createDebug.destroy = destroy; Object.keys(env).forEach(key => { @@ -42666,7 +42666,7 @@ module.exports = setup; /***/ }), -/***/ 7984: +/***/ 67984: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { /** @@ -42675,23 +42675,23 @@ module.exports = setup; */ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = __nccwpck_require__(9851); + module.exports = __nccwpck_require__(39851); } else { - module.exports = __nccwpck_require__(3860); + module.exports = __nccwpck_require__(13860); } /***/ }), -/***/ 3860: +/***/ 13860: /***/ ((module, exports, __nccwpck_require__) => { /** * Module dependencies. */ -const tty = __nccwpck_require__(6224); -const util = __nccwpck_require__(3837); +const tty = __nccwpck_require__(76224); +const util = __nccwpck_require__(73837); /** * This is the Node.js implementation of `debug()`. @@ -42717,7 +42717,7 @@ exports.colors = [6, 2, 3, 4, 5, 1]; try { // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) // eslint-disable-next-line import/no-extraneous-dependencies - const supportsColor = __nccwpck_require__(383); + const supportsColor = __nccwpck_require__(30383); if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { exports.colors = [ @@ -42925,7 +42925,7 @@ function init(debug) { } } -module.exports = __nccwpck_require__(6033)(exports); +module.exports = __nccwpck_require__(36033)(exports); const {formatters} = module.exports; @@ -42953,7 +42953,7 @@ formatters.O = function (v) { /***/ }), -/***/ 5297: +/***/ 55297: /***/ ((__unused_webpack_module, exports) => { @@ -42980,14 +42980,14 @@ exports.Deprecation = Deprecation; /***/ }), -/***/ 626: +/***/ 30626: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const validator = __nccwpck_require__(2407); -const XMLParser = __nccwpck_require__(758); -const XMLBuilder = __nccwpck_require__(3280); +const validator = __nccwpck_require__(52407); +const XMLParser = __nccwpck_require__(10758); +const XMLBuilder = __nccwpck_require__(93280); module.exports = { XMLParser: XMLParser, @@ -42997,7 +42997,7 @@ module.exports = { /***/ }), -/***/ 7341: +/***/ 17341: /***/ ((__unused_webpack_module, exports) => { @@ -43076,12 +43076,12 @@ exports.nameRegexp = nameRegexp; /***/ }), -/***/ 2407: +/***/ 52407: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -const util = __nccwpck_require__(7341); +const util = __nccwpck_require__(17341); const defaultOptions = { allowBooleanAttributes: false, //A tag can have attributes without any value @@ -43508,12 +43508,12 @@ function getPositionFromMatch(match) { /***/ }), -/***/ 3280: +/***/ 93280: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { //parse Empty Node as self closing node -const buildFromOrderedJs = __nccwpck_require__(1622); +const buildFromOrderedJs = __nccwpck_require__(51622); const defaultOptions = { attributeNamePrefix: '@_', @@ -43796,7 +43796,7 @@ module.exports = Builder; /***/ }), -/***/ 1622: +/***/ 51622: /***/ ((module) => { const EOL = "\n"; @@ -43938,10 +43938,10 @@ module.exports = toXml; /***/ }), -/***/ 3095: +/***/ 33095: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const util = __nccwpck_require__(7341); +const util = __nccwpck_require__(17341); //TODO: handle comments function readDocType(xmlData, i){ @@ -44097,7 +44097,7 @@ module.exports = readDocType; /***/ }), -/***/ 518: +/***/ 80518: /***/ ((__unused_webpack_module, exports) => { @@ -44151,16 +44151,16 @@ exports.defaultOptions = defaultOptions; /***/ }), -/***/ 693: +/***/ 40693: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { ///@ts-check -const util = __nccwpck_require__(7341); -const xmlNode = __nccwpck_require__(9620); -const readDocType = __nccwpck_require__(3095); -const toNumber = __nccwpck_require__(780); +const util = __nccwpck_require__(17341); +const xmlNode = __nccwpck_require__(49620); +const readDocType = __nccwpck_require__(33095); +const toNumber = __nccwpck_require__(60780); // const regx = // '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)' @@ -44759,13 +44759,13 @@ module.exports = OrderedObjParser; /***/ }), -/***/ 758: +/***/ 10758: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { buildOptions} = __nccwpck_require__(518); -const OrderedObjParser = __nccwpck_require__(693); +const { buildOptions} = __nccwpck_require__(80518); +const OrderedObjParser = __nccwpck_require__(40693); const { prettify} = __nccwpck_require__(5624); -const validator = __nccwpck_require__(2407); +const validator = __nccwpck_require__(52407); class XMLParser{ @@ -44943,7 +44943,7 @@ exports.prettify = prettify; /***/ }), -/***/ 9620: +/***/ 49620: /***/ ((module) => { @@ -44974,7 +44974,7 @@ module.exports = XmlNode; /***/ }), -/***/ 3274: +/***/ 33274: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -45006,12 +45006,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpProxyAgent = void 0; -const net = __importStar(__nccwpck_require__(1808)); -const tls = __importStar(__nccwpck_require__(4404)); -const debug_1 = __importDefault(__nccwpck_require__(7984)); -const events_1 = __nccwpck_require__(2361); -const agent_base_1 = __nccwpck_require__(129); -const url_1 = __nccwpck_require__(7310); +const net = __importStar(__nccwpck_require__(41808)); +const tls = __importStar(__nccwpck_require__(24404)); +const debug_1 = __importDefault(__nccwpck_require__(67984)); +const events_1 = __nccwpck_require__(82361); +const agent_base_1 = __nccwpck_require__(80129); +const url_1 = __nccwpck_require__(57310); const debug = (0, debug_1.default)('http-proxy-agent'); /** * The `HttpProxyAgent` implements an HTTP Agent subclass that connects @@ -45128,7 +45128,7 @@ function omit(obj, ...keys) { /***/ }), -/***/ 4214: +/***/ 54214: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -45160,13 +45160,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpsProxyAgent = void 0; -const net = __importStar(__nccwpck_require__(1808)); -const tls = __importStar(__nccwpck_require__(4404)); -const assert_1 = __importDefault(__nccwpck_require__(9491)); -const debug_1 = __importDefault(__nccwpck_require__(7984)); -const agent_base_1 = __nccwpck_require__(129); -const url_1 = __nccwpck_require__(7310); -const parse_proxy_response_1 = __nccwpck_require__(3876); +const net = __importStar(__nccwpck_require__(41808)); +const tls = __importStar(__nccwpck_require__(24404)); +const assert_1 = __importDefault(__nccwpck_require__(39491)); +const debug_1 = __importDefault(__nccwpck_require__(67984)); +const agent_base_1 = __nccwpck_require__(80129); +const url_1 = __nccwpck_require__(57310); +const parse_proxy_response_1 = __nccwpck_require__(43876); const debug = (0, debug_1.default)('https-proxy-agent'); /** * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to @@ -45309,7 +45309,7 @@ function omit(obj, ...keys) { /***/ }), -/***/ 3876: +/***/ 43876: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -45318,7 +45318,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.parseProxyResponse = void 0; -const debug_1 = __importDefault(__nccwpck_require__(7984)); +const debug_1 = __importDefault(__nccwpck_require__(67984)); const debug = (0, debug_1.default)('https-proxy-agent:parse-proxy-response'); function parseProxyResponse(socket) { return new Promise((resolve, reject) => { @@ -45416,19 +45416,19 @@ exports.parseProxyResponse = parseProxyResponse; /***/ }), -/***/ 9566: +/***/ 99566: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { module.exports = minimatch minimatch.Minimatch = Minimatch -var path = (function () { try { return __nccwpck_require__(1017) } catch (e) {}}()) || { +var path = (function () { try { return __nccwpck_require__(71017) } catch (e) {}}()) || { sep: '/' } minimatch.sep = path.sep var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __nccwpck_require__(3197) +var expand = __nccwpck_require__(73197) var plTypes = { '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, @@ -46370,7 +46370,7 @@ function regExpEscape (s) { /***/ }), -/***/ 40: +/***/ 80040: /***/ ((module) => { /** @@ -46539,10 +46539,10 @@ function plural(ms, msAbs, n, name) { /***/ }), -/***/ 7197: +/***/ 87197: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -var wrappy = __nccwpck_require__(4586) +var wrappy = __nccwpck_require__(84586) module.exports = wrappy(once) module.exports.strict = wrappy(onceStrict) @@ -46588,7 +46588,7 @@ function onceStrict (fn) { /***/ }), -/***/ 1790: +/***/ 71790: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const ANY = Symbol('SemVer ANY') @@ -46726,17 +46726,17 @@ class Comparator { module.exports = Comparator -const parseOptions = __nccwpck_require__(6772) -const { safeRe: re, t } = __nccwpck_require__(4063) -const cmp = __nccwpck_require__(8801) -const debug = __nccwpck_require__(3619) -const SemVer = __nccwpck_require__(1490) -const Range = __nccwpck_require__(5287) +const parseOptions = __nccwpck_require__(36772) +const { safeRe: re, t } = __nccwpck_require__(84063) +const cmp = __nccwpck_require__(48801) +const debug = __nccwpck_require__(53619) +const SemVer = __nccwpck_require__(71490) +const Range = __nccwpck_require__(25287) /***/ }), -/***/ 5287: +/***/ 25287: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const SPACE_CHARACTERS = /\s+/g @@ -46953,20 +46953,20 @@ class Range { module.exports = Range -const LRU = __nccwpck_require__(1191) +const LRU = __nccwpck_require__(91191) const cache = new LRU() -const parseOptions = __nccwpck_require__(6772) -const Comparator = __nccwpck_require__(1790) -const debug = __nccwpck_require__(3619) -const SemVer = __nccwpck_require__(1490) +const parseOptions = __nccwpck_require__(36772) +const Comparator = __nccwpck_require__(71790) +const debug = __nccwpck_require__(53619) +const SemVer = __nccwpck_require__(71490) const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace, -} = __nccwpck_require__(4063) +} = __nccwpck_require__(84063) const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = __nccwpck_require__(9073) const isNullSet = c => c.value === '<0.0.0-0' @@ -47297,15 +47297,15 @@ const testSet = (set, version, options) => { /***/ }), -/***/ 1490: +/***/ 71490: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const debug = __nccwpck_require__(3619) +const debug = __nccwpck_require__(53619) const { MAX_LENGTH, MAX_SAFE_INTEGER } = __nccwpck_require__(9073) -const { safeRe: re, t } = __nccwpck_require__(4063) +const { safeRe: re, t } = __nccwpck_require__(84063) -const parseOptions = __nccwpck_require__(6772) -const { compareIdentifiers } = __nccwpck_require__(8587) +const parseOptions = __nccwpck_require__(36772) +const { compareIdentifiers } = __nccwpck_require__(48587) class SemVer { constructor (version, options) { options = parseOptions(options) @@ -47606,10 +47606,10 @@ module.exports = SemVer /***/ }), -/***/ 7876: +/***/ 57876: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const parse = __nccwpck_require__(8257) +const parse = __nccwpck_require__(58257) const clean = (version, options) => { const s = parse(version.trim().replace(/^[=v]+/, ''), options) return s ? s.version : null @@ -47619,15 +47619,15 @@ module.exports = clean /***/ }), -/***/ 8801: +/***/ 48801: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const eq = __nccwpck_require__(1561) -const neq = __nccwpck_require__(8671) -const gt = __nccwpck_require__(3473) -const gte = __nccwpck_require__(2967) -const lt = __nccwpck_require__(6762) -const lte = __nccwpck_require__(973) +const eq = __nccwpck_require__(41561) +const neq = __nccwpck_require__(18671) +const gt = __nccwpck_require__(93473) +const gte = __nccwpck_require__(42967) +const lt = __nccwpck_require__(86762) +const lte = __nccwpck_require__(80973) const cmp = (a, op, b, loose) => { switch (op) { @@ -47678,12 +47678,12 @@ module.exports = cmp /***/ }), -/***/ 6899: +/***/ 96899: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) -const parse = __nccwpck_require__(8257) -const { safeRe: re, t } = __nccwpck_require__(4063) +const SemVer = __nccwpck_require__(71490) +const parse = __nccwpck_require__(58257) +const { safeRe: re, t } = __nccwpck_require__(84063) const coerce = (version, options) => { if (version instanceof SemVer) { @@ -47745,10 +47745,10 @@ module.exports = coerce /***/ }), -/***/ 7375: +/***/ 77375: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) +const SemVer = __nccwpck_require__(71490) const compareBuild = (a, b, loose) => { const versionA = new SemVer(a, loose) const versionB = new SemVer(b, loose) @@ -47759,20 +47759,20 @@ module.exports = compareBuild /***/ }), -/***/ 8186: +/***/ 68186: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const compareLoose = (a, b) => compare(a, b, true) module.exports = compareLoose /***/ }), -/***/ 4905: +/***/ 84905: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) +const SemVer = __nccwpck_require__(71490) const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)) @@ -47781,10 +47781,10 @@ module.exports = compare /***/ }), -/***/ 3272: +/***/ 83272: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const parse = __nccwpck_require__(8257) +const parse = __nccwpck_require__(58257) const diff = (version1, version2) => { const v1 = parse(version1, null, true) @@ -47853,40 +47853,40 @@ module.exports = diff /***/ }), -/***/ 1561: +/***/ 41561: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const eq = (a, b, loose) => compare(a, b, loose) === 0 module.exports = eq /***/ }), -/***/ 3473: +/***/ 93473: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const gt = (a, b, loose) => compare(a, b, loose) > 0 module.exports = gt /***/ }), -/***/ 2967: +/***/ 42967: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const gte = (a, b, loose) => compare(a, b, loose) >= 0 module.exports = gte /***/ }), -/***/ 5009: +/***/ 25009: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) +const SemVer = __nccwpck_require__(71490) const inc = (version, release, options, identifier, identifierBase) => { if (typeof (options) === 'string') { @@ -47909,60 +47909,60 @@ module.exports = inc /***/ }), -/***/ 6762: +/***/ 86762: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const lt = (a, b, loose) => compare(a, b, loose) < 0 module.exports = lt /***/ }), -/***/ 973: +/***/ 80973: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const lte = (a, b, loose) => compare(a, b, loose) <= 0 module.exports = lte /***/ }), -/***/ 9799: +/***/ 39799: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) +const SemVer = __nccwpck_require__(71490) const major = (a, loose) => new SemVer(a, loose).major module.exports = major /***/ }), -/***/ 7600: +/***/ 27600: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) +const SemVer = __nccwpck_require__(71490) const minor = (a, loose) => new SemVer(a, loose).minor module.exports = minor /***/ }), -/***/ 8671: +/***/ 18671: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const neq = (a, b, loose) => compare(a, b, loose) !== 0 module.exports = neq /***/ }), -/***/ 8257: +/***/ 58257: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) +const SemVer = __nccwpck_require__(71490) const parse = (version, options, throwErrors = false) => { if (version instanceof SemVer) { return version @@ -47982,20 +47982,20 @@ module.exports = parse /***/ }), -/***/ 6646: +/***/ 2112: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) +const SemVer = __nccwpck_require__(71490) const patch = (a, loose) => new SemVer(a, loose).patch module.exports = patch /***/ }), -/***/ 5094: +/***/ 45094: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const parse = __nccwpck_require__(8257) +const parse = __nccwpck_require__(58257) const prerelease = (version, options) => { const parsed = parse(version, options) return (parsed && parsed.prerelease.length) ? parsed.prerelease : null @@ -48005,30 +48005,30 @@ module.exports = prerelease /***/ }), -/***/ 6110: +/***/ 76110: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compare = __nccwpck_require__(4905) +const compare = __nccwpck_require__(84905) const rcompare = (a, b, loose) => compare(b, a, loose) module.exports = rcompare /***/ }), -/***/ 4550: +/***/ 24550: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compareBuild = __nccwpck_require__(7375) +const compareBuild = __nccwpck_require__(77375) const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) module.exports = rsort /***/ }), -/***/ 1495: +/***/ 81495: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(5287) +const Range = __nccwpck_require__(25287) const satisfies = (version, range, options) => { try { range = new Range(range, options) @@ -48042,10 +48042,10 @@ module.exports = satisfies /***/ }), -/***/ 6034: +/***/ 56034: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const compareBuild = __nccwpck_require__(7375) +const compareBuild = __nccwpck_require__(77375) const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) module.exports = sort @@ -48055,7 +48055,7 @@ module.exports = sort /***/ 3863: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const parse = __nccwpck_require__(8257) +const parse = __nccwpck_require__(58257) const valid = (version, options) => { const v = parse(version, options) return v ? v.version : null @@ -48065,51 +48065,51 @@ module.exports = valid /***/ }), -/***/ 7546: +/***/ 77546: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // just pre-load all the stuff that index.js lazily exports -const internalRe = __nccwpck_require__(4063) +const internalRe = __nccwpck_require__(84063) const constants = __nccwpck_require__(9073) -const SemVer = __nccwpck_require__(1490) -const identifiers = __nccwpck_require__(8587) -const parse = __nccwpck_require__(8257) +const SemVer = __nccwpck_require__(71490) +const identifiers = __nccwpck_require__(48587) +const parse = __nccwpck_require__(58257) const valid = __nccwpck_require__(3863) -const clean = __nccwpck_require__(7876) -const inc = __nccwpck_require__(5009) -const diff = __nccwpck_require__(3272) -const major = __nccwpck_require__(9799) -const minor = __nccwpck_require__(7600) -const patch = __nccwpck_require__(6646) -const prerelease = __nccwpck_require__(5094) -const compare = __nccwpck_require__(4905) -const rcompare = __nccwpck_require__(6110) -const compareLoose = __nccwpck_require__(8186) -const compareBuild = __nccwpck_require__(7375) -const sort = __nccwpck_require__(6034) -const rsort = __nccwpck_require__(4550) -const gt = __nccwpck_require__(3473) -const lt = __nccwpck_require__(6762) -const eq = __nccwpck_require__(1561) -const neq = __nccwpck_require__(8671) -const gte = __nccwpck_require__(2967) -const lte = __nccwpck_require__(973) -const cmp = __nccwpck_require__(8801) -const coerce = __nccwpck_require__(6899) -const Comparator = __nccwpck_require__(1790) -const Range = __nccwpck_require__(5287) -const satisfies = __nccwpck_require__(1495) +const clean = __nccwpck_require__(57876) +const inc = __nccwpck_require__(25009) +const diff = __nccwpck_require__(83272) +const major = __nccwpck_require__(39799) +const minor = __nccwpck_require__(27600) +const patch = __nccwpck_require__(2112) +const prerelease = __nccwpck_require__(45094) +const compare = __nccwpck_require__(84905) +const rcompare = __nccwpck_require__(76110) +const compareLoose = __nccwpck_require__(68186) +const compareBuild = __nccwpck_require__(77375) +const sort = __nccwpck_require__(56034) +const rsort = __nccwpck_require__(24550) +const gt = __nccwpck_require__(93473) +const lt = __nccwpck_require__(86762) +const eq = __nccwpck_require__(41561) +const neq = __nccwpck_require__(18671) +const gte = __nccwpck_require__(42967) +const lte = __nccwpck_require__(80973) +const cmp = __nccwpck_require__(48801) +const coerce = __nccwpck_require__(96899) +const Comparator = __nccwpck_require__(71790) +const Range = __nccwpck_require__(25287) +const satisfies = __nccwpck_require__(81495) const toComparators = __nccwpck_require__(382) -const maxSatisfying = __nccwpck_require__(1706) -const minSatisfying = __nccwpck_require__(7095) -const minVersion = __nccwpck_require__(8650) -const validRange = __nccwpck_require__(8029) -const outside = __nccwpck_require__(7714) +const maxSatisfying = __nccwpck_require__(81706) +const minSatisfying = __nccwpck_require__(97095) +const minVersion = __nccwpck_require__(80507) +const validRange = __nccwpck_require__(38029) +const outside = __nccwpck_require__(47714) const gtr = __nccwpck_require__(9104) -const ltr = __nccwpck_require__(5072) -const intersects = __nccwpck_require__(9057) -const simplifyRange = __nccwpck_require__(9550) -const subset = __nccwpck_require__(8693) +const ltr = __nccwpck_require__(15072) +const intersects = __nccwpck_require__(79057) +const simplifyRange = __nccwpck_require__(69550) +const subset = __nccwpck_require__(48693) module.exports = { parse, valid, @@ -48203,7 +48203,7 @@ module.exports = { /***/ }), -/***/ 3619: +/***/ 53619: /***/ ((module) => { const debug = ( @@ -48219,7 +48219,7 @@ module.exports = debug /***/ }), -/***/ 8587: +/***/ 48587: /***/ ((module) => { const numeric = /^[0-9]+$/ @@ -48249,7 +48249,7 @@ module.exports = { /***/ }), -/***/ 1191: +/***/ 91191: /***/ ((module) => { class LRUCache { @@ -48296,7 +48296,7 @@ module.exports = LRUCache /***/ }), -/***/ 6772: +/***/ 36772: /***/ ((module) => { // parse out just the options we care about @@ -48318,7 +48318,7 @@ module.exports = parseOptions /***/ }), -/***/ 4063: +/***/ 84063: /***/ ((module, exports, __nccwpck_require__) => { const { @@ -48326,7 +48326,7 @@ const { MAX_SAFE_BUILD_LENGTH, MAX_LENGTH, } = __nccwpck_require__(9073) -const debug = __nccwpck_require__(3619) +const debug = __nccwpck_require__(53619) exports = module.exports = {} // The actual regexps go on exports.re @@ -48546,17 +48546,17 @@ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // Determine if version is greater than all the versions possible in the range. -const outside = __nccwpck_require__(7714) +const outside = __nccwpck_require__(47714) const gtr = (version, range, options) => outside(version, range, '>', options) module.exports = gtr /***/ }), -/***/ 9057: +/***/ 79057: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(5287) +const Range = __nccwpck_require__(25287) const intersects = (r1, r2, options) => { r1 = new Range(r1, options) r2 = new Range(r2, options) @@ -48567,10 +48567,10 @@ module.exports = intersects /***/ }), -/***/ 5072: +/***/ 15072: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const outside = __nccwpck_require__(7714) +const outside = __nccwpck_require__(47714) // Determine if version is less than all the versions possible in the range const ltr = (version, range, options) => outside(version, range, '<', options) module.exports = ltr @@ -48578,11 +48578,11 @@ module.exports = ltr /***/ }), -/***/ 1706: +/***/ 81706: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) -const Range = __nccwpck_require__(5287) +const SemVer = __nccwpck_require__(71490) +const Range = __nccwpck_require__(25287) const maxSatisfying = (versions, range, options) => { let max = null @@ -48610,11 +48610,11 @@ module.exports = maxSatisfying /***/ }), -/***/ 7095: +/***/ 97095: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) -const Range = __nccwpck_require__(5287) +const SemVer = __nccwpck_require__(71490) +const Range = __nccwpck_require__(25287) const minSatisfying = (versions, range, options) => { let min = null let minSV = null @@ -48641,12 +48641,12 @@ module.exports = minSatisfying /***/ }), -/***/ 8650: +/***/ 80507: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) -const Range = __nccwpck_require__(5287) -const gt = __nccwpck_require__(3473) +const SemVer = __nccwpck_require__(71490) +const Range = __nccwpck_require__(25287) +const gt = __nccwpck_require__(93473) const minVersion = (range, loose) => { range = new Range(range, loose) @@ -48709,18 +48709,18 @@ module.exports = minVersion /***/ }), -/***/ 7714: +/***/ 47714: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const SemVer = __nccwpck_require__(1490) -const Comparator = __nccwpck_require__(1790) +const SemVer = __nccwpck_require__(71490) +const Comparator = __nccwpck_require__(71790) const { ANY } = Comparator -const Range = __nccwpck_require__(5287) -const satisfies = __nccwpck_require__(1495) -const gt = __nccwpck_require__(3473) -const lt = __nccwpck_require__(6762) -const lte = __nccwpck_require__(973) -const gte = __nccwpck_require__(2967) +const Range = __nccwpck_require__(25287) +const satisfies = __nccwpck_require__(81495) +const gt = __nccwpck_require__(93473) +const lt = __nccwpck_require__(86762) +const lte = __nccwpck_require__(80973) +const gte = __nccwpck_require__(42967) const outside = (version, range, hilo, options) => { version = new SemVer(version, options) @@ -48796,14 +48796,14 @@ module.exports = outside /***/ }), -/***/ 9550: +/***/ 69550: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // given a set of versions and a range, create a "simplified" range // that includes the same versions that the original range does // If the original range is shorter than the simplified one, return that. -const satisfies = __nccwpck_require__(1495) -const compare = __nccwpck_require__(4905) +const satisfies = __nccwpck_require__(81495) +const compare = __nccwpck_require__(84905) module.exports = (versions, range, options) => { const set = [] let first = null @@ -48850,14 +48850,14 @@ module.exports = (versions, range, options) => { /***/ }), -/***/ 8693: +/***/ 48693: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(5287) -const Comparator = __nccwpck_require__(1790) +const Range = __nccwpck_require__(25287) +const Comparator = __nccwpck_require__(71790) const { ANY } = Comparator -const satisfies = __nccwpck_require__(1495) -const compare = __nccwpck_require__(4905) +const satisfies = __nccwpck_require__(81495) +const compare = __nccwpck_require__(84905) // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: // - Every simple range `r1, r2, ...` is a null set, OR @@ -48941,334 +48941,16283 @@ const simpleSubset = (sub, dom, options) => { } } - if (dom.length === 1 && dom[0].semver === ANY) { - if (options.includePrerelease) { - return true - } else { - dom = minimumVersion + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = minimumVersion + } + } + + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') { + gt = higherGT(gt, c, options) + } else if (c.operator === '<' || c.operator === '<=') { + lt = lowerLT(lt, c, options) + } else { + eqSet.add(c.semver) + } + } + + if (eqSet.size > 1) { + return null + } + + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) { + return null + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { + return null + } + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null + } + + if (lt && !satisfies(eq, String(lt), options)) { + return null + } + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false + } + } + + return true + } + + let higher, lower + let hasDomLT, hasDomGT + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } + + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + return false + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { + return false + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false + } + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false + } + + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false + } + + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + return false + } + + return true +} + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} + +module.exports = subset + + +/***/ }), + +/***/ 382: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(25287) + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators + + +/***/ }), + +/***/ 38029: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +const Range = __nccwpck_require__(25287) +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange + + +/***/ }), + +/***/ 60780: +/***/ ((module) => { + +const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; +const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/; +// const octRegex = /0x[a-z0-9]+/; +// const binRegex = /0x[a-z0-9]+/; + + +//polyfill +if (!Number.parseInt && window.parseInt) { + Number.parseInt = window.parseInt; +} +if (!Number.parseFloat && window.parseFloat) { + Number.parseFloat = window.parseFloat; +} + + +const consider = { + hex : true, + leadingZeros: true, + decimalPoint: "\.", + eNotation: true + //skipLike: /regex/ +}; + +function toNumber(str, options = {}){ + // const options = Object.assign({}, consider); + // if(opt.leadingZeros === false){ + // options.leadingZeros = false; + // }else if(opt.hex === false){ + // options.hex = false; + // } + + options = Object.assign({}, consider, options ); + if(!str || typeof str !== "string" ) return str; + + let trimmedStr = str.trim(); + // if(trimmedStr === "0.0") return 0; + // else if(trimmedStr === "+0.0") return 0; + // else if(trimmedStr === "-0.0") return -0; + + if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str; + else if (options.hex && hexRegex.test(trimmedStr)) { + return Number.parseInt(trimmedStr, 16); + // } else if (options.parseOct && octRegex.test(str)) { + // return Number.parseInt(val, 8); + // }else if (options.parseBin && binRegex.test(str)) { + // return Number.parseInt(val, 2); + }else{ + //separate negative sign, leading zeros, and rest number + const match = numRegex.exec(trimmedStr); + if(match){ + const sign = match[1]; + const leadingZeros = match[2]; + let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros + //trim ending zeros for floating number + + const eNotation = match[4] || match[6]; + if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123 + else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123 + else{//no leading zeros or leading zeros are allowed + const num = Number(trimmedStr); + const numStr = "" + num; + if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation + if(options.eNotation) return num; + else return str; + }else if(eNotation){ //given number has enotation + if(options.eNotation) return num; + else return str; + }else if(trimmedStr.indexOf(".") !== -1){ //floating number + // const decimalPart = match[5].substr(1); + // const intPart = trimmedStr.substr(0,trimmedStr.indexOf(".")); + + + // const p = numStr.indexOf("."); + // const givenIntPart = numStr.substr(0,p); + // const givenDecPart = numStr.substr(p+1); + if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0 + else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000 + else if( sign && numStr === "-"+numTrimmedByZeros) return num; + else return str; + } + + if(leadingZeros){ + // if(numTrimmedByZeros === numStr){ + // if(options.leadingZeros) return num; + // else return str; + // }else return str; + if(numTrimmedByZeros === numStr) return num; + else if(sign+numTrimmedByZeros === numStr) return num; + else return str; + } + + if(trimmedStr === numStr) return num; + else if(trimmedStr === sign+numStr) return num; + // else{ + // //number with +/- sign + // trimmedStr.test(/[-+][0-9]); + + // } + return str; + } + // else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str; + + }else{ //non-numeric string + return str; + } + } +} + +/** + * + * @param {string} numStr without leading zeros + * @returns + */ +function trimZeros(numStr){ + if(numStr && numStr.indexOf(".") !== -1){//float + numStr = numStr.replace(/0+$/, ""); //remove ending zeros + if(numStr === ".") numStr = "0"; + else if(numStr[0] === ".") numStr = "0"+numStr; + else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1); + return numStr; + } + return numStr; +} +module.exports = toNumber + + +/***/ }), + +/***/ 39238: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// audio.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 16. audio +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseAudioType(str, input, output) { + str = str.toLowerCase(); + let result = ''; + + if (str.indexOf('input') >= 0) { result = 'Microphone'; } + if (str.indexOf('display audio') >= 0) { result = 'Speaker'; } + if (str.indexOf('speak') >= 0) { result = 'Speaker'; } + if (str.indexOf('laut') >= 0) { result = 'Speaker'; } + if (str.indexOf('loud') >= 0) { result = 'Speaker'; } + if (str.indexOf('head') >= 0) { result = 'Headset'; } + if (str.indexOf('mic') >= 0) { result = 'Microphone'; } + if (str.indexOf('mikr') >= 0) { result = 'Microphone'; } + if (str.indexOf('phone') >= 0) { result = 'Phone'; } + if (str.indexOf('controll') >= 0) { result = 'Controller'; } + if (str.indexOf('line o') >= 0) { result = 'Line Out'; } + if (str.indexOf('digital o') >= 0) { result = 'Digital Out'; } + if (str.indexOf('smart sound technology') >= 0) { result = 'Digital Signal Processor'; } + if (str.indexOf('high definition audio') >= 0) { result = 'Sound Driver'; } + + if (!result && output) { + result = 'Speaker'; + } else if (!result && input) { + result = 'Microphone'; + } + return result; +} + + +function getLinuxAudioPci() { + let cmd = 'lspci -v 2>/dev/null'; + let result = []; + try { + const parts = execSync(cmd, util.execOptsLinux).toString().split('\n\n'); + parts.forEach(element => { + const lines = element.split('\n'); + if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) { + const audio = {}; + audio.slotId = lines[0].split(' ')[0]; + audio.driver = util.getValue(lines, 'Kernel driver in use', ':', true) || util.getValue(lines, 'Kernel modules', ':', true); + result.push(audio); + } + }); + return result; + } catch (e) { + return result; + } +} + +function parseLinuxAudioPciMM(lines, audioPCI) { + const result = {}; + const slotId = util.getValue(lines, 'Slot'); + + const pciMatch = audioPCI.filter(function (item) { return item.slotId === slotId; }); + + result.id = slotId; + result.name = util.getValue(lines, 'SDevice'); + result.manufacturer = util.getValue(lines, 'SVendor'); + result.revision = util.getValue(lines, 'Rev'); + result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : ''; + result.default = null; + result.channel = 'PCIe'; + result.type = parseAudioType(result.name, null, null); + result.in = null; + result.out = null; + result.status = 'online'; + + return result; +} + +function parseDarwinChannel(str) { + let result = ''; + + if (str.indexOf('builtin') >= 0) { result = 'Built-In'; } + if (str.indexOf('extern') >= 0) { result = 'Audio-Jack'; } + if (str.indexOf('hdmi') >= 0) { result = 'HDMI'; } + if (str.indexOf('displayport') >= 0) { result = 'Display-Port'; } + if (str.indexOf('usb') >= 0) { result = 'USB'; } + if (str.indexOf('pci') >= 0) { result = 'PCIe'; } + + return result; +} + +function parseDarwinAudio(audioObject, id) { + const result = {}; + const channelStr = ((audioObject.coreaudio_device_transport || '') + ' ' + (audioObject._name || '')).toLowerCase(); + + result.id = id; + result.name = audioObject._name; + result.manufacturer = audioObject.coreaudio_device_manufacturer; + result.revision = null; + result.driver = null; + result.default = !!(audioObject.coreaudio_default_audio_input_device || '') || !!(audioObject.coreaudio_default_audio_output_device || ''); + result.channel = parseDarwinChannel(channelStr); + result.type = parseAudioType(result.name, !!(audioObject.coreaudio_device_input || ''), !!(audioObject.coreaudio_device_output || '')); + result.in = !!(audioObject.coreaudio_device_input || ''); + result.out = !!(audioObject.coreaudio_device_output || ''); + result.status = 'online'; + + return result; +} + +function parseWindowsAudio(lines) { + const result = {}; + const status = util.getValue(lines, 'StatusInfo', ':'); + + result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID?? + result.name = util.getValue(lines, 'name', ':'); + result.manufacturer = util.getValue(lines, 'manufacturer', ':'); + result.revision = null; + result.driver = null; + result.default = null; + result.channel = null; + result.type = parseAudioType(result.name, null, null); + result.in = null; + result.out = null; + result.status = status; + + return result; +} + +function audio(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'lspci -vmm 2>/dev/null'; + exec(cmd, function (error, stdout) { + // PCI + if (!error) { + const audioPCI = getLinuxAudioPci(); + const parts = stdout.toString().split('\n\n'); + parts.forEach(element => { + const lines = element.split('\n'); + if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) { + const audio = parseLinuxAudioPciMM(lines, audioPCI); + result.push(audio); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_darwin) { + let cmd = 'system_profiler SPAudioDataType -json'; + exec(cmd, function (error, stdout) { + if (!error) { + try { + const outObj = JSON.parse(stdout.toString()); + if (outObj.SPAudioDataType && outObj.SPAudioDataType.length && outObj.SPAudioDataType[0] && outObj.SPAudioDataType[0]['_items'] && outObj.SPAudioDataType[0]['_items'].length) { + for (let i = 0; i < outObj.SPAudioDataType[0]['_items'].length; i++) { + const audio = parseDarwinAudio(outObj.SPAudioDataType[0]['_items'][i], i); + result.push(audio); + } + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + util.powerShell('Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + parts.forEach(element => { + const lines = element.split('\n'); + if (util.getValue(lines, 'name', ':')) { + result.push(parseWindowsAudio(lines)); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos) { + resolve(null); + } + }); + }); +} + +exports.audio = audio; + + +/***/ }), + +/***/ 7883: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +// @ts-check; +// ================================================================================== +// battery.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 6. Battery +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(32081).exec); +const fs = __nccwpck_require__(57147); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) { + const result = {}; + let status = util.getValue(lines, 'BatteryStatus', ':').trim(); + // 1 = "Discharging" + // 2 = "On A/C" + // 3 = "Fully Charged" + // 4 = "Low" + // 5 = "Critical" + // 6 = "Charging" + // 7 = "Charging High" + // 8 = "Charging Low" + // 9 = "Charging Critical" + // 10 = "Undefined" + // 11 = "Partially Charged" + if (status >= 0) { + const statusValue = status ? parseInt(status) : 0; + result.status = statusValue; + result.hasBattery = true; + result.maxCapacity = fullChargeCapacity || parseInt(util.getValue(lines, 'DesignCapacity', ':') || 0); + result.designedCapacity = parseInt(util.getValue(lines, 'DesignCapacity', ':') || designedCapacity); + result.voltage = parseInt(util.getValue(lines, 'DesignVoltage', ':') || 0) / 1000.0; + result.capacityUnit = 'mWh'; + result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', ':') || 0); + result.currentCapacity = parseInt(result.maxCapacity * result.percent / 100); + result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || ((statusValue !== 3) && (statusValue !== 1) && result.percent < 100); + result.acConnected = result.isCharging || statusValue === 2; + result.model = util.getValue(lines, 'DeviceID', ':'); + } else { + result.status = -1; + } + + return result; +} + +module.exports = function (callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + hasBattery: false, + cycleCount: 0, + isCharging: false, + designedCapacity: 0, + maxCapacity: 0, + currentCapacity: 0, + voltage: 0, + capacityUnit: '', + percent: 0, + timeRemaining: null, + acConnected: true, + type: '', + model: '', + manufacturer: '', + serial: '' + }; + + if (_linux) { + let battery_path = ''; + if (fs.existsSync('/sys/class/power_supply/BAT1/uevent')) { + battery_path = '/sys/class/power_supply/BAT1/'; + } else if (fs.existsSync('/sys/class/power_supply/BAT0/uevent')) { + battery_path = '/sys/class/power_supply/BAT0/'; + } + + let acConnected = false; + let acPath = ''; + if (fs.existsSync('/sys/class/power_supply/AC/online')) { + acPath = '/sys/class/power_supply/AC/online'; + } else if (fs.existsSync('/sys/class/power_supply/AC0/online')) { + acPath = '/sys/class/power_supply/AC0/online'; + } + + if (acPath) { + const file = fs.readFileSync(acPath); + acConnected = file.toString().trim() === '1'; + } + + if (battery_path) { + fs.readFile(battery_path + 'uevent', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + + result.isCharging = (util.getValue(lines, 'POWER_SUPPLY_STATUS', '=').toLowerCase() === 'charging'); + result.acConnected = acConnected || result.isCharging; + result.voltage = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_VOLTAGE_NOW', '='), 10) / 1000000.0; + result.capacityUnit = result.voltage ? 'mWh' : 'mAh'; + result.cycleCount = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CYCLE_COUNT', '='), 10); + result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL', '=', true, true), 10) / 1000.0 * (result.voltage || 1)); + const desingedMinVoltage = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_VOLTAGE_MIN_DESIGN', '='), 10) / 1000000.0; + result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL_DESIGN', '=', true, true), 10) / 1000.0 * (desingedMinVoltage || result.voltage || 1)); + result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10) / 1000.0 * (result.voltage || 1)); + if (!result.maxCapacity) { + result.maxCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL', '=', true, true), 10) / 1000.0; + result.designedCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL_DESIGN', '=', true, true), 10) / 1000.0 | result.maxCapacity; + result.currentCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10) / 1000.0; + } + const percent = util.getValue(lines, 'POWER_SUPPLY_CAPACITY', '='); + const energy = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10); + const power = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_POWER_NOW', '='), 10); + const current = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CURRENT_NOW', '='), 10); + const charge = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10); + + result.percent = parseInt('0' + percent, 10); + if (result.maxCapacity && result.currentCapacity) { + result.hasBattery = true; + if (!percent) { + result.percent = 100.0 * result.currentCapacity / result.maxCapacity; + } + } + if (result.isCharging) { + result.hasBattery = true; + } + if (energy && power) { + result.timeRemaining = Math.floor(energy / power * 60); + } else if (current && charge) { + result.timeRemaining = Math.floor(charge / current * 60); + } else if (current && result.currentCapacity) { + result.timeRemaining = Math.floor(result.currentCapacity / current * 60); + } + result.type = util.getValue(lines, 'POWER_SUPPLY_TECHNOLOGY', '='); + result.model = util.getValue(lines, 'POWER_SUPPLY_MODEL_NAME', '='); + result.manufacturer = util.getValue(lines, 'POWER_SUPPLY_MANUFACTURER', '='); + result.serial = util.getValue(lines, 'POWER_SUPPLY_SERIAL_NUMBER', '='); + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('sysctl -i hw.acpi.battery hw.acpi.acline', function (error, stdout) { + let lines = stdout.toString().split('\n'); + const batteries = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.units'), 10); + const percent = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.life'), 10); + result.hasBattery = (batteries > 0); + result.cycleCount = null; + result.isCharging = util.getValue(lines, 'hw.acpi.acline') !== '1'; + result.acConnected = result.isCharging; + result.maxCapacity = null; + result.currentCapacity = null; + result.capacityUnit = 'unknown'; + result.percent = batteries ? percent : null; + if (callback) { callback(result); } + resolve(result); + }); + } + + if (_darwin) { + exec('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|BatterySerialNumber|TimeRemaining|Voltage"; pmset -g batt | grep %', function (error, stdout) { + if (stdout) { + let lines = stdout.toString().replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n'); + result.cycleCount = parseInt('0' + util.getValue(lines, 'cyclecount', '='), 10); + result.voltage = parseInt('0' + util.getValue(lines, 'voltage', '='), 10) / 1000.0; + result.capacityUnit = result.voltage ? 'mWh' : 'mAh'; + result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawmaxcapacity', '='), 10) * (result.voltage || 1)); + result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawcurrentcapacity', '='), 10) * (result.voltage || 1)); + result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'DesignCapacity', '='), 10) * (result.voltage || 1)); + result.manufacturer = 'Apple'; + result.serial = util.getValue(lines, 'BatterySerialNumber', '='); + let percent = null; + const line = util.getValue(lines, 'internal', 'Battery'); + let parts = line.split(';'); + if (parts && parts[0]) { + let parts2 = parts[0].split('\t'); + if (parts2 && parts2[1]) { + percent = parseFloat(parts2[1].trim().replace(/%/g, '')); + } + } + if (parts && parts[1]) { + result.isCharging = (parts[1].trim() === 'charging'); + result.acConnected = (parts[1].trim() !== 'discharging'); + } else { + result.isCharging = util.getValue(lines, 'ischarging', '=').toLowerCase() === 'yes'; + result.acConnected = result.isCharging; + } + if (result.maxCapacity && result.currentCapacity) { + result.hasBattery = true; + result.type = 'Li-ion'; + result.percent = percent !== null ? percent : Math.round(100.0 * result.currentCapacity / result.maxCapacity); + if (!result.isCharging) { + result.timeRemaining = parseInt('0' + util.getValue(lines, 'TimeRemaining', '='), 10); + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl')); + workload.push(util.powerShell('(Get-WmiObject -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity')); + workload.push(util.powerShell('(Get-CimInstance -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity')); + util.promiseAll( + workload + ).then((data) => { + if (data) { + let parts = data.results[0].split(/\n\s*\n/); + let batteries = []; + const hasValue = value => /\S/.test(value); + for (let i = 0; i < parts.length; i++) { + if (hasValue(parts[i]) && (!batteries.length || !hasValue(parts[i - 1]))) { + batteries.push([]); + } + if (hasValue(parts[i])) { + batteries[batteries.length - 1].push(parts[i]); + } + } + let designCapacities = data.results[1].split('\r\n').filter(e => e); + let fullChargeCapacities = data.results[2].split('\r\n').filter(e => e); + if (batteries.length) { + let first = false; + let additionalBatteries = []; + for (let i = 0; i < batteries.length; i++) { + let lines = batteries[i][0].split('\r\n'); + const designedCapacity = designCapacities && designCapacities.length >= (i + 1) && designCapacities[i] ? util.toInt(designCapacities[i]) : 0; + const fullChargeCapacity = fullChargeCapacities && fullChargeCapacities.length >= (i + 1) && fullChargeCapacities[i] ? util.toInt(fullChargeCapacities[i]) : 0; + const parsed = parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity); + if (!first && parsed.status > 0 && parsed.status !== 10) { + result.hasBattery = parsed.hasBattery; + result.maxCapacity = parsed.maxCapacity; + result.designedCapacity = parsed.designedCapacity; + result.voltage = parsed.voltage; + result.capacityUnit = parsed.capacityUnit; + result.percent = parsed.percent; + result.currentCapacity = parsed.currentCapacity; + result.isCharging = parsed.isCharging; + result.acConnected = parsed.acConnected; + result.model = parsed.model; + first = true; + } else if (parsed.status !== -1) { + additionalBatteries.push( + { + hasBattery: parsed.hasBattery, + maxCapacity: parsed.maxCapacity, + designedCapacity: parsed.designedCapacity, + voltage: parsed.voltage, + capacityUnit: parsed.capacityUnit, + percent: parsed.percent, + currentCapacity: parsed.currentCapacity, + isCharging: parsed.isCharging, + timeRemaining: null, + acConnected: parsed.acConnected, + model: parsed.model, + type: '', + manufacturer: '', + serial: '' + } + ); + } + } + if (!first && additionalBatteries.length) { + result = additionalBatteries[0]; + additionalBatteries.shift(); + } + if (additionalBatteries.length) { + result.additionalBatteries = additionalBatteries; + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +}; + + +/***/ }), + +/***/ 48155: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// audio.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 17. bluetooth +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const path = __nccwpck_require__(71017); +const util = __nccwpck_require__(19872); +const fs = __nccwpck_require__(57147); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseBluetoothType(str) { + let result = ''; + + if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + if (str.indexOf('mouse') >= 0) { result = 'Mouse'; } + if (str.indexOf('trackpad') >= 0) { result = 'Trackpad'; } + if (str.indexOf('speaker') >= 0) { result = 'Speaker'; } + if (str.indexOf('headset') >= 0) { result = 'Headset'; } + if (str.indexOf('phone') >= 0) { result = 'Phone'; } + if (str.indexOf('macbook') >= 0) { result = 'Computer'; } + if (str.indexOf('imac') >= 0) { result = 'Computer'; } + if (str.indexOf('ipad') >= 0) { result = 'Tablet'; } + if (str.indexOf('watch') >= 0) { result = 'Watch'; } + if (str.indexOf('headphone') >= 0) { result = 'Headset'; } + // to be continued ... + + return result; +} + +function parseBluetoothManufacturer(str) { + let result = str.split(' ')[0]; + str = str.toLowerCase(); + if (str.indexOf('apple') >= 0) { result = 'Apple'; } + if (str.indexOf('ipad') >= 0) { result = 'Apple'; } + if (str.indexOf('imac') >= 0) { result = 'Apple'; } + if (str.indexOf('iphone') >= 0) { result = 'Apple'; } + if (str.indexOf('magic mouse') >= 0) { result = 'Apple'; } + if (str.indexOf('magic track') >= 0) { result = 'Apple'; } + if (str.indexOf('macbook') >= 0) { result = 'Apple'; } + // to be continued ... + + return result; +} + +function parseLinuxBluetoothInfo(lines, macAddr1, macAddr2) { + const result = {}; + + result.device = null; + result.name = util.getValue(lines, 'name', '='); + result.manufacturer = null; + result.macDevice = macAddr1; + result.macHost = macAddr2; + result.batteryPercent = null; + result.type = parseBluetoothType(result.name.toLowerCase()); + result.connected = false; + + return result; +} + +function parseDarwinBluetoothDevices(bluetoothObject, macAddr2) { + const result = {}; + const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || bluetoothObject.device_minorType || '') + (bluetoothObject.device_name || '')).toLowerCase(); + + result.device = bluetoothObject.device_services || ''; + result.name = bluetoothObject.device_name || ''; + result.manufacturer = bluetoothObject.device_manufacturer || parseBluetoothManufacturer(bluetoothObject.device_name || '') || ''; + result.macDevice = (bluetoothObject.device_addr || bluetoothObject.device_address || '').toLowerCase().replace(/-/g, ':'); + result.macHost = macAddr2; + result.batteryPercent = bluetoothObject.device_batteryPercent || null; + result.type = parseBluetoothType(typeStr); + result.connected = bluetoothObject.device_isconnected === 'attrib_Yes' || false; + + return result; +} + +function parseWindowsBluetooth(lines) { + const result = {}; + + result.device = null; + result.name = util.getValue(lines, 'name', ':'); + result.manufacturer = util.getValue(lines, 'manufacturer', ':'); + result.macDevice = null; + result.macHost = null; + result.batteryPercent = null; + result.type = parseBluetoothType(result.name.toLowerCase()); + result.connected = null; + + return result; +} + +function bluetoothDevices(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux) { + // get files in /var/lib/bluetooth/ recursive + const btFiles = util.getFilesInPath('/var/lib/bluetooth/'); + btFiles.forEach((element) => { + const filename = path.basename(element); + const pathParts = element.split('/'); + const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null; + const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null; + if (filename === 'info') { + const infoFile = fs.readFileSync(element, { encoding: 'utf8' }).split('\n'); + result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2)); + } + }); + // determine "connected" with hcitool con + try { + const hdicon = execSync('hcitool con', util.execOptsLinux).toString().toLowerCase(); + for (let i = 0; i < result.length; i++) { + if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) { + result[i].connected = true; + } + } + } catch (e) { + util.noop(); + } + + if (callback) { + callback(result); + } + resolve(result); + } + if (_darwin) { + let cmd = 'system_profiler SPBluetoothDataType -json'; + exec(cmd, function (error, stdout) { + if (!error) { + try { + const outObj = JSON.parse(stdout.toString()); + if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) { + // missing: host BT Adapter macAddr () + let macAddr2 = null; + if (outObj.SPBluetoothDataType[0]['local_device_title'] && outObj.SPBluetoothDataType[0].local_device_title.general_address) { + macAddr2 = outObj.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g, ':'); + } + outObj.SPBluetoothDataType[0]['device_title'].forEach((element) => { + const obj = element; + const objKey = Object.keys(obj); + if (objKey && objKey.length === 1) { + const innerObject = obj[objKey[0]]; + innerObject.device_name = objKey[0]; + const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2); + result.push(bluetoothDevice); + } + }); + } + if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_connected'] && outObj.SPBluetoothDataType[0]['device_connected'].length) { + const macAddr2 = outObj.SPBluetoothDataType[0].controller_properties && outObj.SPBluetoothDataType[0].controller_properties.controller_address ? outObj.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g, ':') : null; + outObj.SPBluetoothDataType[0]['device_connected'].forEach((element) => { + const obj = element; + const objKey = Object.keys(obj); + if (objKey && objKey.length === 1) { + const innerObject = obj[objKey[0]]; + innerObject.device_name = objKey[0]; + innerObject.device_isconnected = 'attrib_Yes'; + const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2); + result.push(bluetoothDevice); + } + }); + } + if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_not_connected'] && outObj.SPBluetoothDataType[0]['device_not_connected'].length) { + const macAddr2 = outObj.SPBluetoothDataType[0].controller_properties && outObj.SPBluetoothDataType[0].controller_properties.controller_address ? outObj.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g, ':') : null; + outObj.SPBluetoothDataType[0]['device_not_connected'].forEach((element) => { + const obj = element; + const objKey = Object.keys(obj); + if (objKey && objKey.length === 1) { + const innerObject = obj[objKey[0]]; + innerObject.device_name = objKey[0]; + innerObject.device_isconnected = 'attrib_No'; + const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2); + result.push(bluetoothDevice); + } + }); + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + util.powerShell('Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + parts.forEach((part) => { + if (util.getValue(part.split('\n'), 'PNPClass', ':') === 'Bluetooth') { + result.push(parseWindowsBluetooth(part.split('\n'))); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_freebsd || _netbsd || _openbsd || _sunos) { + resolve(null); + } + }); + }); +} + +exports.bluetoothDevices = bluetoothDevices; + + +/***/ }), + +/***/ 28993: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// cpu.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 4. CPU +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const fs = __nccwpck_require__(57147); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _cpu_speed = 0; +let _current_cpu = { + user: 0, + nice: 0, + system: 0, + idle: 0, + irq: 0, + steal: 0, + guest: 0, + load: 0, + tick: 0, + ms: 0, + currentLoad: 0, + currentLoadUser: 0, + currentLoadSystem: 0, + currentLoadNice: 0, + currentLoadIdle: 0, + currentLoadIrq: 0, + currentLoadSteal: 0, + currentLoadGuest: 0, + rawCurrentLoad: 0, + rawCurrentLoadUser: 0, + rawCurrentLoadSystem: 0, + rawCurrentLoadNice: 0, + rawCurrentLoadIdle: 0, + rawCurrentLoadIrq: 0, + rawCurrentLoadSteal: 0, + rawCurrentLoadGuest: 0 +}; +let _cpus = []; +let _corecount = 0; + +const AMDBaseFrequencies = { + '8346': '1.8', + '8347': '1.9', + '8350': '2.0', + '8354': '2.2', + '8356|SE': '2.4', + '8356': '2.3', + '8360': '2.5', + '2372': '2.1', + '2373': '2.1', + '2374': '2.2', + '2376': '2.3', + '2377': '2.3', + '2378': '2.4', + '2379': '2.4', + '2380': '2.5', + '2381': '2.5', + '2382': '2.6', + '2384': '2.7', + '2386': '2.8', + '2387': '2.8', + '2389': '2.9', + '2393': '3.1', + '8374': '2.2', + '8376': '2.3', + '8378': '2.4', + '8379': '2.4', + '8380': '2.5', + '8381': '2.5', + '8382': '2.6', + '8384': '2.7', + '8386': '2.8', + '8387': '2.8', + '8389': '2.9', + '8393': '3.1', + '2419EE': '1.8', + '2423HE': '2.0', + '2425HE': '2.1', + '2427': '2.2', + '2431': '2.4', + '2435': '2.6', + '2439SE': '2.8', + '8425HE': '2.1', + '8431': '2.4', + '8435': '2.6', + '8439SE': '2.8', + '4122': '2.2', + '4130': '2.6', + '4162EE': '1.7', + '4164EE': '1.8', + '4170HE': '2.1', + '4174HE': '2.3', + '4176HE': '2.4', + '4180': '2.6', + '4184': '2.8', + '6124HE': '1.8', + '6128HE': '2.0', + '6132HE': '2.2', + '6128': '2.0', + '6134': '2.3', + '6136': '2.4', + '6140': '2.6', + '6164HE': '1.7', + '6166HE': '1.8', + '6168': '1.9', + '6172': '2.1', + '6174': '2.2', + '6176': '2.3', + '6176SE': '2.3', + '6180SE': '2.5', + '3250': '2.5', + '3260': '2.7', + '3280': '2.4', + '4226': '2.7', + '4228': '2.8', + '4230': '2.9', + '4234': '3.1', + '4238': '3.3', + '4240': '3.4', + '4256': '1.6', + '4274': '2.5', + '4276': '2.6', + '4280': '2.8', + '4284': '3.0', + '6204': '3.3', + '6212': '2.6', + '6220': '3.0', + '6234': '2.4', + '6238': '2.6', + '6262HE': '1.6', + '6272': '2.1', + '6274': '2.2', + '6276': '2.3', + '6278': '2.4', + '6282SE': '2.6', + '6284SE': '2.7', + '6308': '3.5', + '6320': '2.8', + '6328': '3.2', + '6338P': '2.3', + '6344': '2.6', + '6348': '2.8', + '6366': '1.8', + '6370P': '2.0', + '6376': '2.3', + '6378': '2.4', + '6380': '2.5', + '6386': '2.8', + 'FX|4100': '3.6', + 'FX|4120': '3.9', + 'FX|4130': '3.8', + 'FX|4150': '3.8', + 'FX|4170': '4.2', + 'FX|6100': '3.3', + 'FX|6120': '3.6', + 'FX|6130': '3.6', + 'FX|6200': '3.8', + 'FX|8100': '2.8', + 'FX|8120': '3.1', + 'FX|8140': '3.2', + 'FX|8150': '3.6', + 'FX|8170': '3.9', + 'FX|4300': '3.8', + 'FX|4320': '4.0', + 'FX|4350': '4.2', + 'FX|6300': '3.5', + 'FX|6350': '3.9', + 'FX|8300': '3.3', + 'FX|8310': '3.4', + 'FX|8320': '3.5', + 'FX|8350': '4.0', + 'FX|8370': '4.0', + 'FX|9370': '4.4', + 'FX|9590': '4.7', + 'FX|8320E': '3.2', + 'FX|8370E': '3.3', + + // ZEN Desktop CPUs + '1200': '3.1', + 'Pro 1200': '3.1', + '1300X': '3.5', + 'Pro 1300': '3.5', + '1400': '3.2', + '1500X': '3.5', + 'Pro 1500': '3.5', + '1600': '3.2', + '1600X': '3.6', + 'Pro 1600': '3.2', + '1700': '3.0', + 'Pro 1700': '3.0', + '1700X': '3.4', + 'Pro 1700X': '3.4', + '1800X': '3.6', + '1900X': '3.8', + '1920': '3.2', + '1920X': '3.5', + '1950X': '3.4', + + // ZEN Desktop APUs + '200GE': '3.2', + 'Pro 200GE': '3.2', + '220GE': '3.4', + '240GE': '3.5', + '3000G': '3.5', + '300GE': '3.4', + '3050GE': '3.4', + '2200G': '3.5', + 'Pro 2200G': '3.5', + '2200GE': '3.2', + 'Pro 2200GE': '3.2', + '2400G': '3.6', + 'Pro 2400G': '3.6', + '2400GE': '3.2', + 'Pro 2400GE': '3.2', + + // ZEN Mobile APUs + 'Pro 200U': '2.3', + '300U': '2.4', + '2200U': '2.5', + '3200U': '2.6', + '2300U': '2.0', + 'Pro 2300U': '2.0', + '2500U': '2.0', + 'Pro 2500U': '2.2', + '2600H': '3.2', + '2700U': '2.0', + 'Pro 2700U': '2.2', + '2800H': '3.3', + + // ZEN Server Processors + '7351': '2.4', + '7351P': '2.4', + '7401': '2.0', + '7401P': '2.0', + '7551P': '2.0', + '7551': '2.0', + '7251': '2.1', + '7261': '2.5', + '7281': '2.1', + '7301': '2.2', + '7371': '3.1', + '7451': '2.3', + '7501': '2.0', + '7571': '2.2', + '7601': '2.2', + + // ZEN Embedded Processors + 'V1500B': '2.2', + 'V1780B': '3.35', + 'V1202B': '2.3', + 'V1404I': '2.0', + 'V1605B': '2.0', + 'V1756B': '3.25', + 'V1807B': '3.35', + + '3101': '2.1', + '3151': '2.7', + '3201': '1.5', + '3251': '2.5', + '3255': '2.5', + '3301': '2.0', + '3351': '1.9', + '3401': '1.85', + '3451': '2.15', + + // ZEN+ Desktop + '1200|AF': '3.1', + '2300X': '3.5', + '2500X': '3.6', + '2600': '3.4', + '2600E': '3.1', + '1600|AF': '3.2', + '2600X': '3.6', + '2700': '3.2', + '2700E': '2.8', + 'Pro 2700': '3.2', + '2700X': '3.7', + 'Pro 2700X': '3.6', + '2920X': '3.5', + '2950X': '3.5', + '2970WX': '3.0', + '2990WX': '3.0', + + // ZEN+ Desktop APU + 'Pro 300GE': '3.4', + 'Pro 3125GE': '3.4', + '3150G': '3.5', + 'Pro 3150G': '3.5', + '3150GE': '3.3', + 'Pro 3150GE': '3.3', + '3200G': '3.6', + 'Pro 3200G': '3.6', + '3200GE': '3.3', + 'Pro 3200GE': '3.3', + '3350G': '3.6', + 'Pro 3350G': '3.6', + '3350GE': '3.3', + 'Pro 3350GE': '3.3', + '3400G': '3.7', + 'Pro 3400G': '3.7', + '3400GE': '3.3', + 'Pro 3400GE': '3.3', + + // ZEN+ Mobile + '3300U': '2.1', + 'PRO 3300U': '2.1', + '3450U': '2.1', + '3500U': '2.1', + 'PRO 3500U': '2.1', + '3500C': '2.1', + '3550H': '2.1', + '3580U': '2.1', + '3700U': '2.3', + 'PRO 3700U': '2.3', + '3700C': '2.3', + '3750H': '2.3', + '3780U': '2.3', + + // ZEN2 Desktop CPUS + '3100': '3.6', + '3300X': '3.8', + '3500': '3.6', + '3500X': '3.6', + '3600': '3.6', + 'Pro 3600': '3.6', + '3600X': '3.8', + '3600XT': '3.8', + 'Pro 3700': '3.6', + '3700X': '3.6', + '3800X': '3.9', + '3800XT': '3.9', + '3900': '3.1', + 'Pro 3900': '3.1', + '3900X': '3.8', + '3900XT': '3.8', + '3950X': '3.5', + '3960X': '3.8', + '3970X': '3.7', + '3990X': '2.9', + '3945WX': '4.0', + '3955WX': '3.9', + '3975WX': '3.5', + '3995WX': '2.7', + + // ZEN2 Desktop APUs + '4300GE': '3.5', + 'Pro 4300GE': '3.5', + '4300G': '3.8', + 'Pro 4300G': '3.8', + '4600GE': '3.3', + 'Pro 4650GE': '3.3', + '4600G': '3.7', + 'Pro 4650G': '3.7', + '4700GE': '3.1', + 'Pro 4750GE': '3.1', + '4700G': '3.6', + 'Pro 4750G': '3.6', + '4300U': '2.7', + '4450U': '2.5', + 'Pro 4450U': '2.5', + '4500U': '2.3', + '4600U': '2.1', + 'PRO 4650U': '2.1', + '4680U': '2.1', + '4600HS': '3.0', + '4600H': '3.0', + '4700U': '2.0', + 'PRO 4750U': '1.7', + '4800U': '1.8', + '4800HS': '2.9', + '4800H': '2.9', + '4900HS': '3.0', + '4900H': '3.3', + '5300U': '2.6', + '5500U': '2.1', + '5700U': '1.8', + + // ZEN2 - EPYC + '7232P': '3.1', + '7302P': '3.0', + '7402P': '2.8', + '7502P': '2.5', + '7702P': '2.0', + '7252': '3.1', + '7262': '3.2', + '7272': '2.9', + '7282': '2.8', + '7302': '3.0', + '7352': '2.3', + '7402': '2.8', + '7452': '2.35', + '7502': '2.5', + '7532': '2.4', + '7542': '2.9', + '7552': '2.2', + '7642': '2.3', + '7662': '2.0', + '7702': '2.0', + '7742': '2.25', + '7H12': '2.6', + '7F32': '3.7', + '7F52': '3.5', + '7F72': '3.2', + + // Epyc (Milan) + + '7773X': '2.2', + '7763': '2.45', + '7713': '2.0', + '7713P': '2.0', + '7663': '2.0', + '7643': '2.3', + '7573X': '2.8', + '75F3': '2.95', + '7543': '2.8', + '7543P': '2.8', + '7513': '2.6', + '7473X': '2.8', + '7453': '2.75', + '74F3': '3.2', + '7443': '2.85', + '7443P': '2.85', + '7413': '2.65', + '7373X': '3.05', + '73F3': '3.5', + '7343': '3.2', + '7313': '3.0', + '7313P': '3.0', + '72F3': '3.7', + + // ZEN3 + '5600X': '3.7', + '5800X': '3.8', + '5900X': '3.7', + '5950X': '3.4', + '5945WX': '4.1', + '5955WX': '4.0', + '5965WX': '3.8', + '5975WX': '3.6', + '5995WX': '2.7', + + '7960X': '4.2', + '7970X': '4.0', + '7980X': '3.2', + + '7965WX': '4.2', + '7975WX': '4.0', + '7985WX': '3.2', + '7995WX': '2.5', + + // ZEN4 + '9754': '2.25', + '9754S': '2.25', + '9734': '2.2', + '9684X': '2.55', + '9384X': '3.1', + '9184X': '3.55', + '9654P': '2.4', + '9654': '2.4', + '9634': '2.25', + '9554P': '3.1', + '9554': '3.1', + '9534': '2.45', + '9474F': '3.6', + '9454P': '2.75', + '9454': '2.75', + '9374F': '3.85', + '9354P': '3.25', + '9354': '3.25', + '9334': '2.7', + '9274F': '4.05', + '9254': '2.9', + '9224': '2.5', + '9174F': '4.1', + '9124': '3.0' +}; + +const socketTypes = { + 1: 'Other', + 2: 'Unknown', + 3: 'Daughter Board', + 4: 'ZIF Socket', + 5: 'Replacement/Piggy Back', + 6: 'None', + 7: 'LIF Socket', + 8: 'Slot 1', + 9: 'Slot 2', + 10: '370 Pin Socket', + 11: 'Slot A', + 12: 'Slot M', + 13: '423', + 14: 'A (Socket 462)', + 15: '478', + 16: '754', + 17: '940', + 18: '939', + 19: 'mPGA604', + 20: 'LGA771', + 21: 'LGA775', + 22: 'S1', + 23: 'AM2', + 24: 'F (1207)', + 25: 'LGA1366', + 26: 'G34', + 27: 'AM3', + 28: 'C32', + 29: 'LGA1156', + 30: 'LGA1567', + 31: 'PGA988A', + 32: 'BGA1288', + 33: 'rPGA988B', + 34: 'BGA1023', + 35: 'BGA1224', + 36: 'LGA1155', + 37: 'LGA1356', + 38: 'LGA2011', + 39: 'FS1', + 40: 'FS2', + 41: 'FM1', + 42: 'FM2', + 43: 'LGA2011-3', + 44: 'LGA1356-3', + 45: 'LGA1150', + 46: 'BGA1168', + 47: 'BGA1234', + 48: 'BGA1364', + 49: 'AM4', + 50: 'LGA1151', + 51: 'BGA1356', + 52: 'BGA1440', + 53: 'BGA1515', + 54: 'LGA3647-1', + 55: 'SP3', + 56: 'SP3r2', + 57: 'LGA2066', + 58: 'BGA1392', + 59: 'BGA1510', + 60: 'BGA1528', + 61: 'LGA4189', + 62: 'LGA1200', + 63: 'LGA4677', + 64: 'LGA1700', + 65: 'BGA1744', + 66: 'BGA1781', + 67: 'BGA1211', + 68: 'BGA2422', + 69: 'LGA1211', + 70: 'LGA2422', + 71: 'LGA5773', + 72: 'BGA5773', +}; + +const socketTypesByName = { + 'LGA1150': 'i7-5775C i3-4340 i3-4170 G3250 i3-4160T i3-4160 E3-1231 G3258 G3240 i7-4790S i7-4790K i7-4790 i5-4690K i5-4690 i5-4590T i5-4590S i5-4590 i5-4460 i3-4360 i3-4150 G1820 G3420 G3220 i7-4771 i5-4440 i3-4330 i3-4130T i3-4130 E3-1230 i7-4770S i7-4770K i7-4770 i5-4670K i5-4670 i5-4570T i5-4570S i5-4570 i5-4430', + 'LGA1151': 'i9-9900KS E-2288G E-2224 G5420 i9-9900T i9-9900 i7-9700T i7-9700F i7-9700E i7-9700 i5-9600 i5-9500T i5-9500F i5-9500 i5-9400T i3-9350K i3-9300 i3-9100T i3-9100F i3-9100 G4930 i9-9900KF i7-9700KF i5-9600KF i5-9400F i5-9400 i3-9350KF i9-9900K i7-9700K i5-9600K G5500 G5400 i7-8700T i7-8086K i5-8600 i5-8500T i5-8500 i5-8400T i3-8300 i3-8100T G4900 i7-8700K i7-8700 i5-8600K i5-8400 i3-8350K i3-8100 E3-1270 G4600 G4560 i7-7700T i7-7700K i7-7700 i5-7600K i5-7600 i5-7500T i5-7500 i5-7400 i3-7350K i3-7300 i3-7100T i3-7100 G3930 G3900 G4400 i7-6700T i7-6700K i7-6700 i5-6600K i5-6600 i5-6500T i5-6500 i5-6400T i5-6400 i3-6300 i3-6100T i3-6100 E3-1270 E3-1270 T4500 T4400', + '1155': 'G440 G460 G465 G470 G530T G540T G550T G1610T G1620T G530 G540 G1610 G550 G1620 G555 G1630 i3-2100T i3-2120T i3-3220T i3-3240T i3-3250T i3-2100 i3-2105 i3-2102 i3-3210 i3-3220 i3-2125 i3-2120 i3-3225 i3-2130 i3-3245 i3-3240 i3-3250 i5-3570T i5-2500T i5-2400S i5-2405S i5-2390T i5-3330S i5-2500S i5-3335S i5-2300 i5-3450S i5-3340S i5-3470S i5-3475S i5-3470T i5-2310 i5-3550S i5-2320 i5-3330 i5-3350P i5-3450 i5-2400 i5-3340 i5-3570S i5-2380P i5-2450P i5-3470 i5-2500K i5-3550 i5-2500 i5-3570 i5-3570K i5-2550K i7-3770T i7-2600S i7-3770S i7-2600K i7-2600 i7-3770 i7-3770K i7-2700K G620T G630T G640T G2020T G645T G2100T G2030T G622 G860T G620 G632 G2120T G630 G640 G2010 G840 G2020 G850 G645 G2030 G860 G2120 G870 G2130 G2140 E3-1220L E3-1220L E3-1260L E3-1265L E3-1220 E3-1225 E3-1220 E3-1235 E3-1225 E3-1230 E3-1230 E3-1240 E3-1245 E3-1270 E3-1275 E3-1240 E3-1245 E3-1270 E3-1280 E3-1275 E3-1290 E3-1280 E3-1290' +}; + +function getSocketTypesByName(str) { + let result = ''; + for (const key in socketTypesByName) { + const names = socketTypesByName[key].split(' '); + names.forEach(element => { + if (str.indexOf(element) >= 0) { + result = key; + } + }); + } + return result; +} + +function cpuManufacturer(str) { + let result = str; + str = str.toLowerCase(); + + if (str.indexOf('intel') >= 0) { result = 'Intel'; } + if (str.indexOf('amd') >= 0) { result = 'AMD'; } + if (str.indexOf('qemu') >= 0) { result = 'QEMU'; } + if (str.indexOf('hygon') >= 0) { result = 'Hygon'; } + if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; } + if (str.indexOf('vmware') >= 0) { result = 'VMware'; } + if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; } + if (str.indexOf('tcg') >= 0) { result = 'QEMU'; } + if (str.indexOf('apple') >= 0) { result = 'Apple'; } + + return result; +} + +function cpuBrandManufacturer(res) { + res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim(); + res.brand = res.brand.replace(/\(TM\)+/g, '™').replace(/\s+/g, ' ').trim(); + res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim(); + res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim(); + res.manufacturer = cpuManufacturer(res.brand); + + let parts = res.brand.split(' '); + parts.shift(); + res.brand = parts.join(' '); + return res; +} + +function getAMDSpeed(brand) { + let result = '0'; + for (let key in AMDBaseFrequencies) { + if ({}.hasOwnProperty.call(AMDBaseFrequencies, key)) { + let parts = key.split('|'); + let found = 0; + parts.forEach(item => { + if (brand.indexOf(item) > -1) { + found++; + } + }); + if (found === parts.length) { + result = AMDBaseFrequencies[key]; + } + } + } + return parseFloat(result); +} + +// -------------------------- +// CPU - brand, speed + +function getCpu() { + + return new Promise((resolve) => { + process.nextTick(() => { + const UNKNOWN = 'unknown'; + let result = { + manufacturer: UNKNOWN, + brand: UNKNOWN, + vendor: '', + family: '', + model: '', + stepping: '', + revision: '', + voltage: '', + speed: 0, + speedMin: 0, + speedMax: 0, + governor: '', + cores: util.cores(), + physicalCores: util.cores(), + performanceCores: util.cores(), + efficiencyCores: 0, + processors: 1, + socket: '', + flags: '', + virtualization: false, + cache: {} + }; + cpuFlags().then(flags => { + result.flags = flags; + result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1; + if (_darwin) { + exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) { + let lines = stdout.toString().split('\n'); + const modelline = util.getValue(lines, 'machdep.cpu.brand_string'); + const modellineParts = modelline.split('@'); + result.brand = modellineParts[0].trim(); + const speed = modellineParts[1] ? modellineParts[1].trim() : '0'; + result.speed = parseFloat(speed.replace(/GHz+/g, '')); + let tbFrequency = util.getValue(lines, 'hw.tbfrequency') / 1000000000.0; + tbFrequency = tbFrequency < 0.1 ? tbFrequency * 100 : tbFrequency; + result.speed = result.speed === 0 ? tbFrequency : result.speed; + + _cpu_speed = result.speed; + result = cpuBrandManufacturer(result); + result.speedMin = util.getValue(lines, 'hw.cpufrequency_min') ? (util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0) : result.speed; + result.speedMax = util.getValue(lines, 'hw.cpufrequency_max') ? (util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0) : result.speed; + result.vendor = util.getValue(lines, 'machdep.cpu.vendor') || 'Apple'; + result.family = util.getValue(lines, 'machdep.cpu.family') || util.getValue(lines, 'hw.cpufamily'); + result.model = util.getValue(lines, 'machdep.cpu.model'); + result.stepping = util.getValue(lines, 'machdep.cpu.stepping') || util.getValue(lines, 'hw.cpusubfamily'); + result.virtualization = true; + const countProcessors = util.getValue(lines, 'hw.packages'); + const countCores = util.getValue(lines, 'hw.physicalcpu_max'); + const countThreads = util.getValue(lines, 'hw.ncpu'); + if (os.arch() === 'arm64') { + result.socket = 'SOC'; + try { + const clusters = execSync('ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type').toString().split('\n'); + const efficiencyCores = clusters.filter(line => line.indexOf('"E"') >= 0).length; + const performanceCores = clusters.filter(line => line.indexOf('"P"') >= 0).length; + result.efficiencyCores = efficiencyCores; + result.performanceCores = performanceCores; + } catch (e) { + util.noop(); + } + } + if (countProcessors) { + result.processors = parseInt(countProcessors) || 1; + } + if (countCores && countThreads) { + result.cores = parseInt(countThreads) || util.cores(); + result.physicalCores = parseInt(countCores) || util.cores(); + } + cpuCache().then((res) => { + result.cache = res; + resolve(result); + }); + }); + } + if (_linux) { + let modelline = ''; + let lines = []; + if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; } + exec('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL', function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + } + modelline = util.getValue(lines, 'model name') || modelline; + modelline = util.getValue(lines, 'bios model name') || modelline; + const modellineParts = modelline.split('@'); + result.brand = modellineParts[0].trim(); + result.speed = modellineParts[1] ? parseFloat(modellineParts[1].trim()) : 0; + if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) { + result.speed = getAMDSpeed(result.brand); + } + if (result.speed === 0) { + const current = getCpuCurrentSpeedSync(); + if (current.avg !== 0) { result.speed = current.avg; } + } + _cpu_speed = result.speed; + result.speedMin = Math.round(parseFloat(util.getValue(lines, 'cpu min mhz').replace(/,/g, '.')) / 10.0) / 100; + result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100; + + result = cpuBrandManufacturer(result); + result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id')); + + result.family = util.getValue(lines, 'cpu family'); + result.model = util.getValue(lines, 'model:'); + result.stepping = util.getValue(lines, 'stepping'); + result.revision = util.getValue(lines, 'cpu revision'); + result.cache.l1d = util.getValue(lines, 'l1d cache'); + if (result.cache.l1d) { result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1)); } + result.cache.l1i = util.getValue(lines, 'l1i cache'); + if (result.cache.l1i) { result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1)); } + result.cache.l2 = util.getValue(lines, 'l2 cache'); + if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l2.indexOf('K') !== -1 ? 1024 : 1)); } + result.cache.l3 = util.getValue(lines, 'l3 cache'); + if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); } + + const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1'; + const processors = util.getValue(lines, 'socket(s)') || '1'; + const threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores) + const processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1) + const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900) + result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt; + result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores; + result.efficiencyCores = threadsPerCoreInt > 1 ? result.cores - (threadsPerCoreInt * result.performanceCores) : 0; + result.processors = processorsInt; + result.governor = util.getValue(lines, 'governor') || ''; + + // Test Raspberry + if (result.vendor === 'ARM') { + const linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n'); + const rPIRevision = util.decodePiCpuinfo(linesRpi); + if (rPIRevision.model.toLowerCase().indexOf('raspberry') >= 0) { + result.family = result.manufacturer; + result.manufacturer = rPIRevision.manufacturer; + result.brand = rPIRevision.processor; + result.revision = rPIRevision.revisionCode; + result.socket = 'SOC'; + } + } + + // socket type + let lines2 = []; + exec('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', function (error2, stdout2) { + lines2 = stdout2.toString().split('\n'); + if (lines2 && lines2.length) { + result.socket = util.getValue(lines2, 'Upgrade').replace('Socket', '').trim() || result.socket; + } + resolve(result); + }); + }); + } + if (_freebsd || _openbsd || _netbsd) { + let modelline = ''; + let lines = []; + if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; } + exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL', function (error, stdout) { + let cache = []; + if (!error) { + const data = stdout.toString().split('# dmidecode'); + const processor = data.length > 1 ? data[1] : ''; + cache = data.length > 2 ? data[2].split('Cache Information') : []; + + lines = processor.split('\n'); + } + result.brand = modelline.split('@')[0].trim(); + result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()) : 0; + if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) { + result.speed = getAMDSpeed(result.brand); + } + if (result.speed === 0) { + const current = getCpuCurrentSpeedSync(); + if (current.avg !== 0) { result.speed = current.avg; } + } + _cpu_speed = result.speed; + result.speedMin = result.speed; + result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100; + + result = cpuBrandManufacturer(result); + result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer')); + let sig = util.getValue(lines, 'signature'); + sig = sig.split(','); + for (let i = 0; i < sig.length; i++) { + sig[i] = sig[i].trim(); + } + result.family = util.getValue(sig, 'Family', ' ', true); + result.model = util.getValue(sig, 'Model', ' ', true); + result.stepping = util.getValue(sig, 'Stepping', ' ', true); + result.revision = ''; + const voltage = parseFloat(util.getValue(lines, 'voltage')); + result.voltage = isNaN(voltage) ? '' : voltage.toFixed(2); + for (let i = 0; i < cache.length; i++) { + lines = cache[i].split('\n'); + let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-'); + cacheType = cacheType.length ? cacheType[0] : ''; + const sizeParts = util.getValue(lines, 'Installed Size').split(' '); + let size = parseInt(sizeParts[0], 10); + const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb'; + size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1))); + if (cacheType) { + if (cacheType === 'l1') { + result.cache[cacheType + 'd'] = size / 2; + result.cache[cacheType + 'i'] = size / 2; + } else { + result.cache[cacheType] = size; + } + } + } + // socket type + result.socket = util.getValue(lines, 'Upgrade').replace('Socket', '').trim(); + // # threads / # cores + const threadCount = util.getValue(lines, 'thread count').trim(); + const coreCount = util.getValue(lines, 'core count').trim(); + if (coreCount && threadCount) { + result.cores = parseInt(threadCount, 10); + result.physicalCores = parseInt(coreCount, 10); + } + resolve(result); + }); + } + if (_sunos) { + resolve(result); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl')); + workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl')); + workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); + + Promise.all( + workload + ).then((data) => { + let lines = data[0].split('\r\n'); + let name = util.getValue(lines, 'name', ':') || ''; + if (name.indexOf('@') >= 0) { + result.brand = name.split('@')[0].trim(); + result.speed = name.split('@')[1] ? parseFloat(name.split('@')[1].trim()) : 0; + _cpu_speed = result.speed; + } else { + result.brand = name.trim(); + result.speed = 0; + } + result = cpuBrandManufacturer(result); + result.revision = util.getValue(lines, 'revision', ':'); + result.vendor = util.getValue(lines, 'manufacturer', ':'); + result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100; + if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) { + result.speed = getAMDSpeed(result.brand); + } + if (result.speed === 0) { + result.speed = result.speedMax; + } + result.speedMin = result.speed; + + let description = util.getValue(lines, 'description', ':').split(' '); + for (let i = 0; i < description.length; i++) { + if (description[i].toLowerCase().startsWith('family') && (i + 1) < description.length && description[i + 1]) { + result.family = description[i + 1]; + } + if (description[i].toLowerCase().startsWith('model') && (i + 1) < description.length && description[i + 1]) { + result.model = description[i + 1]; + } + if (description[i].toLowerCase().startsWith('stepping') && (i + 1) < description.length && description[i + 1]) { + result.stepping = description[i + 1]; + } + } + // socket type + const socketId = util.getValue(lines, 'UpgradeMethod', ':'); + if (socketTypes[socketId]) { + result.socket = socketTypes[socketId]; + } + const socketByName = getSocketTypesByName(name); + if (socketByName) { + result.socket = socketByName; + } + // # threads / # cores + const countProcessors = util.countLines(lines, 'Caption'); + const countThreads = util.getValue(lines, 'NumberOfLogicalProcessors', ':'); + const countCores = util.getValue(lines, 'NumberOfCores', ':'); + if (countProcessors) { + result.processors = parseInt(countProcessors) || 1; + } + if (countCores && countThreads) { + result.cores = parseInt(countThreads) || util.cores(); + result.physicalCores = parseInt(countCores) || util.cores(); + } + if (countProcessors > 1) { + result.cores = result.cores * countProcessors; + result.physicalCores = result.physicalCores * countProcessors; + } + result.cache = parseWinCache(data[0], data[1]); + const hyperv = data[2] ? data[2].toString().toLowerCase() : ''; + result.virtualization = hyperv.indexOf('true') !== -1; + + resolve(result); + }); + } catch (e) { + resolve(result); + } + } + }); + }); + }); +} + +// -------------------------- +// CPU - Processor Data + +function cpu(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + getCpu().then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.cpu = cpu; + +// -------------------------- +// CPU - current speed - in GHz + +function getCpuCurrentSpeedSync() { + + let cpus = os.cpus(); + let minFreq = 999999999; + let maxFreq = 0; + let avgFreq = 0; + let cores = []; + + if (cpus && cpus.length) { + for (let i in cpus) { + if ({}.hasOwnProperty.call(cpus, i)) { + let freq = cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10; + avgFreq = avgFreq + freq; + if (freq > maxFreq) { maxFreq = freq; } + if (freq < minFreq) { minFreq = freq; } + cores.push(parseFloat(freq.toFixed(2))); + } + } + avgFreq = avgFreq / cpus.length; + return { + min: parseFloat(minFreq.toFixed(2)), + max: parseFloat(maxFreq.toFixed(2)), + avg: parseFloat((avgFreq).toFixed(2)), + cores: cores + }; + } else { + return { + min: 0, + max: 0, + avg: 0, + cores: cores + }; + } +} + +function cpuCurrentSpeed(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = getCpuCurrentSpeedSync(); + if (result.avg === 0 && _cpu_speed !== 0) { + const currCpuSpeed = parseFloat(_cpu_speed); + result = { + min: currCpuSpeed, + max: currCpuSpeed, + avg: currCpuSpeed, + cores: [] + }; + } + if (callback) { callback(result); } + resolve(result); + }); + }); +} + +exports.cpuCurrentSpeed = cpuCurrentSpeed; + +// -------------------------- +// CPU - temperature +// if sensors are installed + +function cpuTemperature(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + main: null, + cores: [], + max: null, + socket: [], + chipset: null + }; + if (_linux) { + // CPU Chipset, Socket + try { + const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;'; + const parts = execSync(cmd, util.execOptsLinux).toString().split('-----\n'); + if (parts.length === 2) { + const lines = parts[0].split('\n'); + const lines2 = parts[1].split('\n'); + for (let i = 0; i < lines.length; i++) { + const line = lines[i].trim(); + if (line.startsWith('acpi') && lines2[i]) { + result.socket.push(Math.round(parseInt(lines2[i], 10) / 100) / 10); + } + if (line.startsWith('pch') && lines2[i]) { + result.chipset = Math.round(parseInt(lines2[i], 10) / 100) / 10; + } + } + } + } catch (e) { + util.noop(); + } + + const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;'; + try { + exec(cmd, function (error, stdout) { + stdout = stdout.toString(); + const tdiePos = stdout.toLowerCase().indexOf('tdie'); + if (tdiePos !== -1) { + stdout = stdout.substring(tdiePos); + } + let lines = stdout.split('\n'); + let tctl = 0; + lines.forEach(line => { + const parts = line.split('___'); + const label = parts[0]; + const value = parts.length > 1 && parts[1] ? parts[1] : '0'; + if (value && label && label.toLowerCase() === 'tctl') { + tctl = result.main = Math.round(parseInt(value, 10) / 100) / 10; + } + if (value && (label === undefined || (label && label.toLowerCase().startsWith('core')))) { + result.cores.push(Math.round(parseInt(value, 10) / 100) / 10); + } else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().indexOf('physical') >= 0 || label.toLowerCase() === 'tccd1')) { + result.main = Math.round(parseInt(value, 10) / 100) / 10; + } + }); + if (tctl && result.main === null) { + result.main = tctl; + } + + if (result.cores.length > 0) { + if (result.main === null) { + result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length); + } + let maxtmp = Math.max.apply(Math, result.cores); + result.max = (maxtmp > result.main) ? maxtmp : result.main; + } + if (result.main !== null) { + if (result.max === null) { + result.max = result.main; + } + if (callback) { callback(result); } + resolve(result); + return; + } + exec('sensors', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + let tdieTemp = null; + let newSectionStarts = true; + let section = ''; + lines.forEach(function (line) { + // determine section + if (line.trim() === '') { + newSectionStarts = true; + } else if (newSectionStarts) { + if (line.trim().toLowerCase().startsWith('acpi')) { section = 'acpi'; } + if (line.trim().toLowerCase().startsWith('pch')) { section = 'pch'; } + if (line.trim().toLowerCase().startsWith('core')) { section = 'core'; } + newSectionStarts = false; + } + let regex = /[+-]([^°]*)/g; + let temps = line.match(regex); + let firstPart = line.split(':')[0].toUpperCase(); + if (section === 'acpi') { + // socket temp + if (firstPart.indexOf('TEMP') !== -1) { + result.socket.push(parseFloat(temps)); + } + } else if (section === 'pch') { + // chipset temp + if (firstPart.indexOf('TEMP') !== -1 && !result.chipset) { + result.chipset = parseFloat(temps); + } + } + // cpu temp + if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1) { + result.main = parseFloat(temps); + } + if (firstPart.indexOf('CORE ') !== -1) { + result.cores.push(parseFloat(temps)); + } + if (firstPart.indexOf('TDIE') !== -1 && tdieTemp === null) { + tdieTemp = parseFloat(temps); + } + }); + if (result.cores.length > 0) { + result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length); + let maxtmp = Math.max.apply(Math, result.cores); + result.max = (maxtmp > result.main) ? maxtmp : result.main; + } else { + if (result.main === null && tdieTemp !== null) { + result.main = tdieTemp; + result.max = tdieTemp; + } + } + if (result.main !== null || result.max !== null) { + if (callback) { callback(result); } + resolve(result); + return; + } + } + fs.stat('/sys/class/thermal/thermal_zone0/temp', function (err) { + if (err === null) { + fs.readFile('/sys/class/thermal/thermal_zone0/temp', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0) { + result.main = parseFloat(lines[0]) / 1000.0; + result.max = result.main; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + exec('/opt/vc/bin/vcgencmd measure_temp', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0 && lines[0].indexOf('=')) { + result.main = parseFloat(lines[0].split('=')[1]); + result.max = result.main; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + }); + }); + }); + } catch (er) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('sysctl dev.cpu | grep temp', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + let sum = 0; + lines.forEach(function (line) { + const parts = line.split(':'); + if (parts.length > 1) { + const temp = parseFloat(parts[1].replace(',', '.')); + if (temp > result.max) { result.max = temp; } + sum = sum + temp; + result.cores.push(temp); + } + }); + if (result.cores.length) { + result.main = Math.round(sum / result.cores.length * 100) / 100; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + let osxTemp = null; + try { + osxTemp = __nccwpck_require__(87317); + } catch (er) { + osxTemp = null; + } + if (osxTemp) { + result = osxTemp.cpuTemperature(); + // round to 2 digits + if (result.main) { + result.main = Math.round(result.main * 100) / 100; + } + if (result.max) { + result.max = Math.round(result.max * 100) / 100; + } + if (result.cores && result.cores.length) { + for (let i = 0; i < result.cores.length; i++) { + result.cores[i] = Math.round(result.cores[i] * 100) / 100; + } + } + } + + if (callback) { callback(result); } + resolve(result); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => { + if (!error) { + let sum = 0; + let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); + lines.forEach(function (line) { + let value = (parseInt(line, 10) - 2732) / 10; + if (!isNaN(value)) { + sum = sum + value; + if (value > result.max) { result.max = value; } + result.cores.push(value); + } + }); + if (result.cores.length) { + result.main = sum / result.cores.length; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.cpuTemperature = cpuTemperature; + +// -------------------------- +// CPU Flags + +function cpuFlags(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = ''; + if (_windows) { + try { + exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', util.execOptsWin, function (error, stdout) { + if (!error) { + let flag_hex = stdout.split('0x').pop().trim(); + let flag_bin_unpadded = parseInt(flag_hex, 16).toString(2); + let flag_bin = '0'.repeat(32 - flag_bin_unpadded.length) + flag_bin_unpadded; + // empty flags are the reserved fields in the CPUID feature bit list + // as found on wikipedia: + // https://en.wikipedia.org/wiki/CPUID + let all_flags = [ + 'fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic', + '', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pat', 'pse-36', 'psn', 'clfsh', + '', 'ds', 'acpi', 'mmx', 'fxsr', 'sse', 'sse2', 'ss', 'htt', 'tm', 'ia64', 'pbe' + ]; + for (let f = 0; f < all_flags.length; f++) { + if (flag_bin[f] === '1' && all_flags[f] !== '') { + result += ' ' + all_flags[f]; + } + } + result = result.trim().toLowerCase(); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_linux) { + try { + + exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + if (line.split(':')[0].toUpperCase().indexOf('FLAGS') !== -1) { + result = line.split(':')[1].trim().toLowerCase(); + } + }); + } + if (!result) { + fs.readFile('/proc/cpuinfo', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result = util.getValue(lines, 'features', ':', true).toLowerCase(); + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) { + let flags = []; + if (!error) { + let parts = stdout.toString().split('\tFlags:'); + const lines = parts.length > 1 ? parts[1].split('\tVersion:')[0].split('\n') : []; + lines.forEach(function (line) { + let flag = (line.indexOf('(') ? line.split('(')[0].toLowerCase() : '').trim().replace(/\t/g, ''); + if (flag) { + flags.push(flag); + } + }); + } + result = flags.join(' ').trim().toLowerCase(); + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + exec('sysctl machdep.cpu.features', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0 && lines[0].indexOf('machdep.cpu.features:') !== -1) { + result = lines[0].split(':')[1].trim().toLowerCase(); + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} + +exports.cpuFlags = cpuFlags; + +// -------------------------- +// CPU Cache + +function cpuCache(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + l1d: null, + l1i: null, + l2: null, + l3: null, + }; + if (_linux) { + try { + exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + let parts = line.split(':'); + if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) { + result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + if (parts[0].toUpperCase().indexOf('L1I CACHE') !== -1) { + result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + if (parts[0].toUpperCase().indexOf('L2 CACHE') !== -1) { + result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + if (parts[0].toUpperCase().indexOf('L3 CACHE') !== -1) { + result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) { + let cache = []; + if (!error) { + const data = stdout.toString(); + cache = data.split('Cache Information'); + cache.shift(); + } + for (let i = 0; i < cache.length; i++) { + const lines = cache[i].split('\n'); + let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-'); + cacheType = cacheType.length ? cacheType[0] : ''; + const sizeParts = util.getValue(lines, 'Installed Size').split(' '); + let size = parseInt(sizeParts[0], 10); + const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb'; + size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1))); + if (cacheType) { + if (cacheType === 'l1') { + result.cache[cacheType + 'd'] = size / 2; + result.cache[cacheType + 'i'] = size / 2; + } else { + result.cache[cacheType] = size; + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + let parts = line.split(':'); + if (parts[0].toLowerCase().indexOf('hw.l1icachesize') !== -1) { + result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + if (parts[0].toLowerCase().indexOf('hw.l1dcachesize') !== -1) { + result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + if (parts[0].toLowerCase().indexOf('hw.l2cachesize') !== -1) { + result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + if (parts[0].toLowerCase().indexOf('hw.l3cachesize') !== -1) { + result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl')); + workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl')); + + Promise.all( + workload + ).then((data) => { + result = parseWinCache(data[0], data[1]); + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +function parseWinCache(linesProc, linesCache) { + let result = { + l1d: null, + l1i: null, + l2: null, + l3: null, + }; + + // Win32_processor + let lines = linesProc.split('\r\n'); + result.l1d = 0; + result.l1i = 0; + result.l2 = util.getValue(lines, 'l2cachesize', ':'); + result.l3 = util.getValue(lines, 'l3cachesize', ':'); + if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; } else { result.l2 = 0; } + if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; } else { result.l3 = 0; } + + // Win32_CacheMemory + const parts = linesCache.split(/\n\s*\n/); + let l1i = 0; + let l1d = 0; + let l2 = 0; + parts.forEach(function (part) { + const lines = part.split('\r\n'); + const cacheType = util.getValue(lines, 'CacheType'); + const level = util.getValue(lines, 'Level'); + const installedSize = util.getValue(lines, 'InstalledSize'); + // L1 Instructions + if (level === '3' && cacheType === '3') { + result.l1i = result.l1i + parseInt(installedSize, 10) * 1024; + } + // L1 Data + if (level === '3' && cacheType === '4') { + result.l1d = result.l1d + parseInt(installedSize, 10) * 1024; + } + // L1 all + if (level === '3' && cacheType === '5') { + l1i = parseInt(installedSize, 10) / 2; + l1d = parseInt(installedSize, 10) / 2; + } + // L2 + if (level === '4' && cacheType === '5') { + l2 = l2 + parseInt(installedSize, 10) * 1024; + } + }); + if (!result.l1i && !result.l1d) { + result.l1i = l1i; + result.l1d = l1d; + } + if (l2) { + result.l2 = l2; + } + return result; +} + +exports.cpuCache = cpuCache; + +// -------------------------- +// CPU - current load - in % + +function getLoad() { + + return new Promise((resolve) => { + process.nextTick(() => { + let loads = os.loadavg().map(function (x) { return x / util.cores(); }); + let avgLoad = parseFloat((Math.max.apply(Math, loads)).toFixed(2)); + let result = {}; + + let now = Date.now() - _current_cpu.ms; + if (now >= 200) { + _current_cpu.ms = Date.now(); + const cpus = os.cpus().map(function (cpu) { + cpu.times.steal = 0; + cpu.times.guest = 0; + return cpu; + }); + let totalUser = 0; + let totalSystem = 0; + let totalNice = 0; + let totalIrq = 0; + let totalIdle = 0; + let totalSteal = 0; + let totalGuest = 0; + let cores = []; + _corecount = (cpus && cpus.length) ? cpus.length : 0; + + // linux: try to get other cpu stats + if (_linux) { + try { + const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', util.execOptsLinux).toString().split('\n'); + if (lines.length > 1) { + lines.shift(); + if (lines.length === cpus.length) { + for (let i = 0; i < lines.length; i++) { + let parts = lines[i].split(' '); + if (parts.length >= 10) { + const steal = parseFloat(parts[8]) || 0; + const guest = parseFloat(parts[9]) || 0; + cpus[i].times.steal = steal; + cpus[i].times.guest = guest; + } + } + } + } + } catch (e) { + util.noop(); + } + } + + for (let i = 0; i < _corecount; i++) { + const cpu = cpus[i].times; + totalUser += cpu.user; + totalSystem += cpu.sys; + totalNice += cpu.nice; + totalIdle += cpu.idle; + totalIrq += cpu.irq; + totalSteal += cpu.steal || 0; + totalGuest += cpu.guest || 0; + let tmpTick = (_cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0); + let tmpLoad = (_cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0); + let tmpUser = (_cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0); + let tmpSystem = (_cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0); + let tmpNice = (_cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0); + let tmpIdle = (_cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0); + let tmpIrq = (_cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0); + let tmpSteal = (_cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0); + let tmpGuest = (_cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0); + _cpus[i] = cpu; + _cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest + _cpus[i].idle; + _cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest; + _cpus[i].currentTick = _cpus[i].totalTick - tmpTick; + _cpus[i].load = (_cpus[i].totalLoad - tmpLoad); + _cpus[i].loadUser = (_cpus[i].user - tmpUser); + _cpus[i].loadSystem = (_cpus[i].sys - tmpSystem); + _cpus[i].loadNice = (_cpus[i].nice - tmpNice); + _cpus[i].loadIdle = (_cpus[i].idle - tmpIdle); + _cpus[i].loadIrq = (_cpus[i].irq - tmpIrq); + _cpus[i].loadSteal = (_cpus[i].steal - tmpSteal); + _cpus[i].loadGuest = (_cpus[i].guest - tmpGuest); + cores[i] = {}; + cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100; + cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100; + cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100; + cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100; + cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100; + cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100; + cores[i].loadSteal = _cpus[i].loadSteal / _cpus[i].currentTick * 100; + cores[i].loadGuest = _cpus[i].loadGuest / _cpus[i].currentTick * 100; + cores[i].rawLoad = _cpus[i].load; + cores[i].rawLoadUser = _cpus[i].loadUser; + cores[i].rawLoadSystem = _cpus[i].loadSystem; + cores[i].rawLoadNice = _cpus[i].loadNice; + cores[i].rawLoadIdle = _cpus[i].loadIdle; + cores[i].rawLoadIrq = _cpus[i].loadIrq; + cores[i].rawLoadSteal = _cpus[i].loadSteal; + cores[i].rawLoadGuest = _cpus[i].loadGuest; + } + let totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle; + let totalLoad = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest; + let currentTick = totalTick - _current_cpu.tick; + result = { + avgLoad: avgLoad, + currentLoad: (totalLoad - _current_cpu.load) / currentTick * 100, + currentLoadUser: (totalUser - _current_cpu.user) / currentTick * 100, + currentLoadSystem: (totalSystem - _current_cpu.system) / currentTick * 100, + currentLoadNice: (totalNice - _current_cpu.nice) / currentTick * 100, + currentLoadIdle: (totalIdle - _current_cpu.idle) / currentTick * 100, + currentLoadIrq: (totalIrq - _current_cpu.irq) / currentTick * 100, + currentLoadSteal: (totalSteal - _current_cpu.steal) / currentTick * 100, + currentLoadGuest: (totalGuest - _current_cpu.guest) / currentTick * 100, + rawCurrentLoad: (totalLoad - _current_cpu.load), + rawCurrentLoadUser: (totalUser - _current_cpu.user), + rawCurrentLoadSystem: (totalSystem - _current_cpu.system), + rawCurrentLoadNice: (totalNice - _current_cpu.nice), + rawCurrentLoadIdle: (totalIdle - _current_cpu.idle), + rawCurrentLoadIrq: (totalIrq - _current_cpu.irq), + rawCurrentLoadSteal: (totalSteal - _current_cpu.steal), + rawCurrentLoadGuest: (totalGuest - _current_cpu.guest), + cpus: cores + }; + _current_cpu = { + user: totalUser, + nice: totalNice, + system: totalSystem, + idle: totalIdle, + irq: totalIrq, + steal: totalSteal, + guest: totalGuest, + tick: totalTick, + load: totalLoad, + ms: _current_cpu.ms, + currentLoad: result.currentLoad, + currentLoadUser: result.currentLoadUser, + currentLoadSystem: result.currentLoadSystem, + currentLoadNice: result.currentLoadNice, + currentLoadIdle: result.currentLoadIdle, + currentLoadIrq: result.currentLoadIrq, + currentLoadSteal: result.currentLoadSteal, + currentLoadGuest: result.currentLoadGuest, + rawCurrentLoad: result.rawCurrentLoad, + rawCurrentLoadUser: result.rawCurrentLoadUser, + rawCurrentLoadSystem: result.rawCurrentLoadSystem, + rawCurrentLoadNice: result.rawCurrentLoadNice, + rawCurrentLoadIdle: result.rawCurrentLoadIdle, + rawCurrentLoadIrq: result.rawCurrentLoadIrq, + rawCurrentLoadSteal: result.rawCurrentLoadSteal, + rawCurrentLoadGuest: result.rawCurrentLoadGuest, + }; + } else { + let cores = []; + for (let i = 0; i < _corecount; i++) { + cores[i] = {}; + cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100; + cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100; + cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100; + cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100; + cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100; + cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100; + cores[i].rawLoad = _cpus[i].load; + cores[i].rawLoadUser = _cpus[i].loadUser; + cores[i].rawLoadSystem = _cpus[i].loadSystem; + cores[i].rawLoadNice = _cpus[i].loadNice; + cores[i].rawLoadIdle = _cpus[i].loadIdle; + cores[i].rawLoadIrq = _cpus[i].loadIrq; + cores[i].rawLoadSteal = _cpus[i].loadSteal; + cores[i].rawLoadGuest = _cpus[i].loadGuest; + } + result = { + avgLoad: avgLoad, + currentLoad: _current_cpu.currentLoad, + currentLoadUser: _current_cpu.currentLoadUser, + currentLoadSystem: _current_cpu.currentLoadSystem, + currentLoadNice: _current_cpu.currentLoadNice, + currentLoadIdle: _current_cpu.currentLoadIdle, + currentLoadIrq: _current_cpu.currentLoadIrq, + currentLoadSteal: _current_cpu.currentLoadSteal, + currentLoadGuest: _current_cpu.currentLoadGuest, + rawCurrentLoad: _current_cpu.rawCurrentLoad, + rawCurrentLoadUser: _current_cpu.rawCurrentLoadUser, + rawCurrentLoadSystem: _current_cpu.rawCurrentLoadSystem, + rawCurrentLoadNice: _current_cpu.rawCurrentLoadNice, + rawCurrentLoadIdle: _current_cpu.rawCurrentLoadIdle, + rawCurrentLoadIrq: _current_cpu.rawCurrentLoadIrq, + rawCurrentLoadSteal: _current_cpu.rawCurrentLoadSteal, + rawCurrentLoadGuest: _current_cpu.rawCurrentLoadGuest, + cpus: cores + }; + } + resolve(result); + }); + }); +} + +function currentLoad(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + getLoad().then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.currentLoad = currentLoad; + +// -------------------------- +// PS - full load +// since bootup + +function getFullLoad() { + + return new Promise((resolve) => { + process.nextTick(() => { + + const cpus = os.cpus(); + let totalUser = 0; + let totalSystem = 0; + let totalNice = 0; + let totalIrq = 0; + let totalIdle = 0; + + let result = 0; + + if (cpus && cpus.length) { + for (let i = 0, len = cpus.length; i < len; i++) { + const cpu = cpus[i].times; + totalUser += cpu.user; + totalSystem += cpu.sys; + totalNice += cpu.nice; + totalIrq += cpu.irq; + totalIdle += cpu.idle; + } + let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser; + result = (totalTicks - totalIdle) / totalTicks * 100.0; + + } + resolve(result); + }); + }); +} + +function fullLoad(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + getFullLoad().then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.fullLoad = fullLoad; + + +/***/ }), + +/***/ 88600: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// docker.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 13. Docker +// ---------------------------------------------------------------------------------- + +const util = __nccwpck_require__(19872); +const DockerSocket = __nccwpck_require__(92966); + +let _platform = process.platform; +const _windows = (_platform === 'win32'); + +let _docker_container_stats = {}; +let _docker_socket; +let _docker_last_read = 0; + + +// -------------------------- +// get containers (parameter all: get also inactive/exited containers) + +function dockerInfo(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + const result = {}; + + _docker_socket.getInfo((data) => { + result.id = data.ID; + result.containers = data.Containers; + result.containersRunning = data.ContainersRunning; + result.containersPaused = data.ContainersPaused; + result.containersStopped = data.ContainersStopped; + result.images = data.Images; + result.driver = data.Driver; + result.memoryLimit = data.MemoryLimit; + result.swapLimit = data.SwapLimit; + result.kernelMemory = data.KernelMemory; + result.cpuCfsPeriod = data.CpuCfsPeriod; + result.cpuCfsQuota = data.CpuCfsQuota; + result.cpuShares = data.CPUShares; + result.cpuSet = data.CPUSet; + result.ipv4Forwarding = data.IPv4Forwarding; + result.bridgeNfIptables = data.BridgeNfIptables; + result.bridgeNfIp6tables = data.BridgeNfIp6tables; + result.debug = data.Debug; + result.nfd = data.NFd; + result.oomKillDisable = data.OomKillDisable; + result.ngoroutines = data.NGoroutines; + result.systemTime = data.SystemTime; + result.loggingDriver = data.LoggingDriver; + result.cgroupDriver = data.CgroupDriver; + result.nEventsListener = data.NEventsListener; + result.kernelVersion = data.KernelVersion; + result.operatingSystem = data.OperatingSystem; + result.osType = data.OSType; + result.architecture = data.Architecture; + result.ncpu = data.NCPU; + result.memTotal = data.MemTotal; + result.dockerRootDir = data.DockerRootDir; + result.httpProxy = data.HttpProxy; + result.httpsProxy = data.HttpsProxy; + result.noProxy = data.NoProxy; + result.name = data.Name; + result.labels = data.Labels; + result.experimentalBuild = data.ExperimentalBuild; + result.serverVersion = data.ServerVersion; + result.clusterStore = data.ClusterStore; + result.clusterAdvertise = data.ClusterAdvertise; + result.defaultRuntime = data.DefaultRuntime; + result.liveRestoreEnabled = data.LiveRestoreEnabled; + result.isolation = data.Isolation; + result.initBinary = data.InitBinary; + result.productLicense = data.ProductLicense; + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.dockerInfo = dockerInfo; + +function dockerImages(all, callback) { + + // fallback - if only callback is given + if (util.isFunction(all) && !callback) { + callback = all; + all = false; + } + if (typeof all === 'string' && all === 'true') { + all = true; + } + if (typeof all !== 'boolean' && all !== undefined) { + all = false; + } + + all = all || false; + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + const workload = []; + + _docker_socket.listImages(all, data => { + let dockerImages = {}; + try { + dockerImages = data; + if (dockerImages && Object.prototype.toString.call(dockerImages) === '[object Array]' && dockerImages.length > 0) { + + dockerImages.forEach(function (element) { + + if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) { + element.Name = element.Names[0].replace(/^\/|\/$/g, ''); + } + workload.push(dockerImagesInspect(element.Id.trim(), element)); + }); + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +// -------------------------- +// container inspect (for one container) + +function dockerImagesInspect(imageID, payload) { + return new Promise((resolve) => { + process.nextTick(() => { + imageID = imageID || ''; + if (typeof imageID !== 'string') { + return resolve(); + } + const imageIDSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(imageID, true)).trim(); + if (imageIDSanitized) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.inspectImage(imageIDSanitized.trim(), data => { + try { + resolve({ + id: payload.Id, + container: data.Container, + comment: data.Comment, + os: data.Os, + architecture: data.Architecture, + parent: data.Parent, + dockerVersion: data.DockerVersion, + size: data.Size, + sharedSize: payload.SharedSize, + virtualSize: data.VirtualSize, + author: data.Author, + created: data.Created ? Math.round(new Date(data.Created).getTime() / 1000) : 0, + containerConfig: data.ContainerConfig ? data.ContainerConfig : {}, + graphDriver: data.GraphDriver ? data.GraphDriver : {}, + repoDigests: data.RepoDigests ? data.RepoDigests : {}, + repoTags: data.RepoTags ? data.RepoTags : {}, + config: data.Config ? data.Config : {}, + rootFS: data.RootFS ? data.RootFS : {}, + }); + } catch (err) { + resolve(); + } + }); + } else { + resolve(); + } + }); + }); +} + +exports.dockerImages = dockerImages; + +function dockerContainers(all, callback) { + + function inContainers(containers, id) { + let filtered = containers.filter(obj => { + /** + * @namespace + * @property {string} Id + */ + return (obj.Id && (obj.Id === id)); + }); + return (filtered.length > 0); + } + + // fallback - if only callback is given + if (util.isFunction(all) && !callback) { + callback = all; + all = false; + } + if (typeof all === 'string' && all === 'true') { + all = true; + } + if (typeof all !== 'boolean' && all !== undefined) { + all = false; + } + + all = all || false; + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + const workload = []; + + _docker_socket.listContainers(all, data => { + let docker_containers = {}; + try { + docker_containers = data; + if (docker_containers && Object.prototype.toString.call(docker_containers) === '[object Array]' && docker_containers.length > 0) { + // GC in _docker_container_stats + for (let key in _docker_container_stats) { + if ({}.hasOwnProperty.call(_docker_container_stats, key)) { + if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; } + } + } + + docker_containers.forEach(function (element) { + + if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) { + element.Name = element.Names[0].replace(/^\/|\/$/g, ''); + } + workload.push(dockerContainerInspect(element.Id.trim(), element)); + }); + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + // GC in _docker_container_stats + for (let key in _docker_container_stats) { + if ({}.hasOwnProperty.call(_docker_container_stats, key)) { + if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; } + } + } + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +// -------------------------- +// container inspect (for one container) + +function dockerContainerInspect(containerID, payload) { + return new Promise((resolve) => { + process.nextTick(() => { + containerID = containerID || ''; + if (typeof containerID !== 'string') { + return resolve(); + } + const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim(); + if (containerIdSanitized) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.getInspect(containerIdSanitized.trim(), data => { + try { + resolve({ + id: payload.Id, + name: payload.Name, + image: payload.Image, + imageID: payload.ImageID, + command: payload.Command, + created: payload.Created, + started: data.State && data.State.StartedAt ? Math.round(new Date(data.State.StartedAt).getTime() / 1000) : 0, + finished: data.State && data.State.FinishedAt && !data.State.FinishedAt.startsWith('0001-01-01') ? Math.round(new Date(data.State.FinishedAt).getTime() / 1000) : 0, + createdAt: data.Created ? data.Created : '', + startedAt: data.State && data.State.StartedAt ? data.State.StartedAt : '', + finishedAt: data.State && data.State.FinishedAt && !data.State.FinishedAt.startsWith('0001-01-01') ? data.State.FinishedAt : '', + state: payload.State, + restartCount: data.RestartCount || 0, + platform: data.Platform || '', + driver: data.Driver || '', + ports: payload.Ports, + mounts: payload.Mounts, + // hostconfig: payload.HostConfig, + // network: payload.NetworkSettings + }); + } catch (err) { + resolve(); + } + }); + } else { + resolve(); + } + }); + }); +} + +exports.dockerContainers = dockerContainers; + +// -------------------------- +// helper functions for calculation of docker stats + +function docker_calcCPUPercent(cpu_stats, precpu_stats) { + /** + * @namespace + * @property {object} cpu_usage + * @property {number} cpu_usage.total_usage + * @property {number} system_cpu_usage + * @property {object} cpu_usage + * @property {Array} cpu_usage.percpu_usage + */ + + if (!_windows) { + let cpuPercent = 0.0; + // calculate the change for the cpu usage of the container in between readings + let cpuDelta = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage; + // calculate the change for the entire system between readings + let systemDelta = cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage; + + if (systemDelta > 0.0 && cpuDelta > 0.0) { + // calculate the change for the cpu usage of the container in between readings + if (precpu_stats.online_cpus) { + cpuPercent = (cpuDelta / systemDelta) * precpu_stats.online_cpus * 100.0; + } + else { + cpuPercent = (cpuDelta / systemDelta) * cpu_stats.cpu_usage.percpu_usage.length * 100.0; + } + } + + return cpuPercent; + } else { + let nanoSecNow = util.nanoSeconds(); + let cpuPercent = 0.0; + if (_docker_last_read > 0) { + let possIntervals = (nanoSecNow - _docker_last_read); // / 100 * os.cpus().length; + let intervalsUsed = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage; + if (possIntervals > 0) { + cpuPercent = 100.0 * intervalsUsed / possIntervals; + } + } + _docker_last_read = nanoSecNow; + return cpuPercent; + } +} + +function docker_calcNetworkIO(networks) { + let rx; + let wx; + for (let key in networks) { + // skip loop if the property is from prototype + if (!{}.hasOwnProperty.call(networks, key)) { continue; } + + /** + * @namespace + * @property {number} rx_bytes + * @property {number} tx_bytes + */ + let obj = networks[key]; + rx = +obj.rx_bytes; + wx = +obj.tx_bytes; + } + return { + rx, + wx + }; +} + +function docker_calcBlockIO(blkio_stats) { + let result = { + r: 0, + w: 0 + }; + + /** + * @namespace + * @property {Array} io_service_bytes_recursive + */ + if (blkio_stats && blkio_stats.io_service_bytes_recursive && Object.prototype.toString.call(blkio_stats.io_service_bytes_recursive) === '[object Array]' && blkio_stats.io_service_bytes_recursive.length > 0) { + blkio_stats.io_service_bytes_recursive.forEach(function (element) { + /** + * @namespace + * @property {string} op + * @property {number} value + */ + + if (element.op && element.op.toLowerCase() === 'read' && element.value) { + result.r += element.value; + } + if (element.op && element.op.toLowerCase() === 'write' && element.value) { + result.w += element.value; + } + }); + } + return result; +} + +function dockerContainerStats(containerIDs, callback) { + + let containerArray = []; + return new Promise((resolve) => { + process.nextTick(() => { + + // fallback - if only callback is given + if (util.isFunction(containerIDs) && !callback) { + callback = containerIDs; + containerArray = ['*']; + } else { + containerIDs = containerIDs || '*'; + if (typeof containerIDs !== 'string') { + if (callback) { callback([]); } + return resolve([]); + } + let containerIDsSanitized = ''; + containerIDsSanitized.__proto__.toLowerCase = util.stringToLower; + containerIDsSanitized.__proto__.replace = util.stringReplace; + containerIDsSanitized.__proto__.trim = util.stringTrim; + + containerIDsSanitized = containerIDs; + containerIDsSanitized = containerIDsSanitized.trim(); + if (containerIDsSanitized !== '*') { + containerIDsSanitized = ''; + const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim(); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + s[i].__proto__.toLowerCase = util.stringToLower; + const sl = s[i].toLowerCase(); + if (sl && sl[0] && !sl[1]) { + containerIDsSanitized = containerIDsSanitized + sl[0]; + } + } + } + } + + containerIDsSanitized = containerIDsSanitized.trim().toLowerCase().replace(/,+/g, '|'); + containerArray = containerIDsSanitized.split('|'); + } + + const result = []; + + const workload = []; + if (containerArray.length && containerArray[0].trim() === '*') { + containerArray = []; + dockerContainers().then(allContainers => { + for (let container of allContainers) { + containerArray.push(container.id.substring(0, 12)); + } + if (containerArray.length) { + dockerContainerStats(containerArray.join(',')).then(result => { + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + for (let containerID of containerArray) { + workload.push(dockerContainerStatsSingle(containerID.trim())); + } + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +// -------------------------- +// container stats (for one container) + +function dockerContainerStatsSingle(containerID) { + containerID = containerID || ''; + let result = { + id: containerID, + memUsage: 0, + memLimit: 0, + memPercent: 0, + cpuPercent: 0, + pids: 0, + netIO: { + rx: 0, + wx: 0 + }, + blockIO: { + r: 0, + w: 0 + }, + restartCount: 0, + cpuStats: {}, + precpuStats: {}, + memoryStats: {}, + networks: {}, + }; + return new Promise((resolve) => { + process.nextTick(() => { + if (containerID) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.getInspect(containerID, dataInspect => { + try { + _docker_socket.getStats(containerID, data => { + try { + let stats = data; + if (!stats.message) { + if (data.id) { result.id = data.id; } + result.memUsage = (stats.memory_stats && stats.memory_stats.usage ? stats.memory_stats.usage : 0); + result.memLimit = (stats.memory_stats && stats.memory_stats.limit ? stats.memory_stats.limit : 0); + result.memPercent = (stats.memory_stats && stats.memory_stats.usage && stats.memory_stats.limit ? stats.memory_stats.usage / stats.memory_stats.limit * 100.0 : 0); + result.cpuPercent = (stats.cpu_stats && stats.precpu_stats ? docker_calcCPUPercent(stats.cpu_stats, stats.precpu_stats) : 0); + result.pids = (stats.pids_stats && stats.pids_stats.current ? stats.pids_stats.current : 0); + result.restartCount = (dataInspect.RestartCount ? dataInspect.RestartCount : 0); + if (stats.networks) { result.netIO = docker_calcNetworkIO(stats.networks); } + if (stats.blkio_stats) { result.blockIO = docker_calcBlockIO(stats.blkio_stats); } + result.cpuStats = (stats.cpu_stats ? stats.cpu_stats : {}); + result.precpuStats = (stats.precpu_stats ? stats.precpu_stats : {}); + result.memoryStats = (stats.memory_stats ? stats.memory_stats : {}); + result.networks = (stats.networks ? stats.networks : {}); + } + } catch (err) { + util.noop(); + } + // } + resolve(result); + }); + } catch (err) { + util.noop(); + } + }); + } else { + resolve(result); + } + }); + }); +} + +exports.dockerContainerStats = dockerContainerStats; + +// -------------------------- +// container processes (for one container) + +function dockerContainerProcesses(containerID, callback) { + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + containerID = containerID || ''; + if (typeof containerID !== 'string') { + return resolve(result); + } + const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim(); + + if (containerIdSanitized) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.getProcesses(containerIdSanitized, data => { + /** + * @namespace + * @property {Array} Titles + * @property {Array} Processes + **/ + try { + if (data && data.Titles && data.Processes) { + let titles = data.Titles.map(function (value) { + return value.toUpperCase(); + }); + let pos_pid = titles.indexOf('PID'); + let pos_ppid = titles.indexOf('PPID'); + let pos_pgid = titles.indexOf('PGID'); + let pos_vsz = titles.indexOf('VSZ'); + let pos_time = titles.indexOf('TIME'); + let pos_elapsed = titles.indexOf('ELAPSED'); + let pos_ni = titles.indexOf('NI'); + let pos_ruser = titles.indexOf('RUSER'); + let pos_user = titles.indexOf('USER'); + let pos_rgroup = titles.indexOf('RGROUP'); + let pos_group = titles.indexOf('GROUP'); + let pos_stat = titles.indexOf('STAT'); + let pos_rss = titles.indexOf('RSS'); + let pos_command = titles.indexOf('COMMAND'); + + data.Processes.forEach(process => { + result.push({ + pidHost: (pos_pid >= 0 ? process[pos_pid] : ''), + ppid: (pos_ppid >= 0 ? process[pos_ppid] : ''), + pgid: (pos_pgid >= 0 ? process[pos_pgid] : ''), + user: (pos_user >= 0 ? process[pos_user] : ''), + ruser: (pos_ruser >= 0 ? process[pos_ruser] : ''), + group: (pos_group >= 0 ? process[pos_group] : ''), + rgroup: (pos_rgroup >= 0 ? process[pos_rgroup] : ''), + stat: (pos_stat >= 0 ? process[pos_stat] : ''), + time: (pos_time >= 0 ? process[pos_time] : ''), + elapsed: (pos_elapsed >= 0 ? process[pos_elapsed] : ''), + nice: (pos_ni >= 0 ? process[pos_ni] : ''), + rss: (pos_rss >= 0 ? process[pos_rss] : ''), + vsz: (pos_vsz >= 0 ? process[pos_vsz] : ''), + command: (pos_command >= 0 ? process[pos_command] : '') + }); + }); + } + } catch (err) { + util.noop(); + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} + +exports.dockerContainerProcesses = dockerContainerProcesses; + +function dockerVolumes(callback) { + + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + _docker_socket.listVolumes((data) => { + let dockerVolumes = {}; + try { + dockerVolumes = data; + if (dockerVolumes && dockerVolumes.Volumes && Object.prototype.toString.call(dockerVolumes.Volumes) === '[object Array]' && dockerVolumes.Volumes.length > 0) { + + dockerVolumes.Volumes.forEach(function (element) { + + result.push({ + name: element.Name, + driver: element.Driver, + labels: element.Labels, + mountpoint: element.Mountpoint, + options: element.Options, + scope: element.Scope, + created: element.CreatedAt ? Math.round(new Date(element.CreatedAt).getTime() / 1000) : 0, + }); + }); + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +exports.dockerVolumes = dockerVolumes; + +function dockerAll(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + dockerContainers(true).then(result => { + if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) { + let l = result.length; + result.forEach(function (element) { + dockerContainerStats(element.id).then((res) => { + // include stats in array + element.memUsage = res[0].memUsage; + element.memLimit = res[0].memLimit; + element.memPercent = res[0].memPercent; + element.cpuPercent = res[0].cpuPercent; + element.pids = res[0].pids; + element.netIO = res[0].netIO; + element.blockIO = res[0].blockIO; + element.cpuStats = res[0].cpuStats; + element.precpuStats = res[0].precpuStats; + element.memoryStats = res[0].memoryStats; + element.networks = res[0].networks; + + dockerContainerProcesses(element.id).then(processes => { + element.processes = processes; + + l -= 1; + if (l === 0) { + if (callback) { callback(result); } + resolve(result); + } + }); + // all done?? + }); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +exports.dockerAll = dockerAll; + + +/***/ }), + +/***/ 92966: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// dockerSockets.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 13. DockerSockets +// ---------------------------------------------------------------------------------- + +const net = __nccwpck_require__(41808); +const isWin = (__nccwpck_require__(22037).type)() === 'Windows_NT'; +const socketPath = isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock'; + +class DockerSocket { + + getInfo(callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/info HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } + + listImages(all, callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/images/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } + + inspectImage(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/images/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + listContainers(all, callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } + + getStats(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/' + id + '/stats?stream=0 HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + getInspect(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + getProcesses(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/' + id + '/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + listVolumes(callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/volumes HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } +} + +module.exports = DockerSocket; + + +/***/ }), + +/***/ 39468: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// filesystem.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 8. File System +// ---------------------------------------------------------------------------------- + +const util = __nccwpck_require__(19872); +const fs = __nccwpck_require__(57147); + +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const execPromiseSave = util.promisifySave((__nccwpck_require__(32081).exec)); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _fs_speed = {}; +let _disk_io = {}; + +// -------------------------- +// FS - mounted file systems + +function fsSize(drive, callback) { + + if (util.isFunction(drive)) { + callback = drive; + drive = ''; + } + + let macOsDisks = []; + let osMounts = []; + + function getmacOsFsType(fs) { + if (!fs.startsWith('/')) { return 'NFS'; } + const parts = fs.split('/'); + const fsShort = parts[parts.length - 1]; + const macOsDisksSingle = macOsDisks.filter(item => item.indexOf(fsShort) >= 0); + if (macOsDisksSingle.length === 1 && macOsDisksSingle[0].indexOf('APFS') >= 0) { return 'APFS'; } + return 'HFS'; + } + + function isLinuxTmpFs(fs) { + const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type', 'appimaged']; + let result = false; + linuxTmpFileSystems.forEach(linuxFs => { + if (fs.toLowerCase().indexOf(linuxFs) >= 0) { result = true; } + }); + return result; + } + + function filterLines(stdout) { + let lines = stdout.toString().split('\n'); + lines.shift(); + if (stdout.toString().toLowerCase().indexOf('filesystem')) { + let removeLines = 0; + for (let i = 0; i < lines.length; i++) { + if (lines[i] && lines[i].toLowerCase().startsWith('filesystem')) { + removeLines = i; + } + } + for (let i = 0; i < removeLines; i++) { + lines.shift(); + } + } + return lines; + } + + function parseDf(lines) { + let data = []; + lines.forEach(function (line) { + if (line !== '') { + line = line.replace(/ +/g, ' ').split(' '); + if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1) || !_darwin && !isLinuxTmpFs(line[1]))) { + const fs = line[0]; + const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0])); + const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024; + const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024; + const available = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[4] : line[3])) * 1024; + const use = parseFloat((100.0 * (used / (used + available))).toFixed(2)); + let rw = osMounts && Object.keys(osMounts).length > 0 ? osMounts[fs] || false : null; + line.splice(0, (_linux || _freebsd || _openbsd || _netbsd) ? 6 : 5); + const mount = line.join(' '); + if (!data.find(el => (el.fs === fs && el.type === fsType))) { + data.push({ + fs, + type: fsType, + size, + used, + available, + use, + mount, + rw + }); + } + } + } + }); + return data; + } + + return new Promise((resolve) => { + process.nextTick(() => { + let data = []; + if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { + let cmd = ''; + macOsDisks = []; + osMounts = {}; + if (_darwin) { + cmd = 'df -kP'; + try { + macOsDisks = execSync('diskutil list').toString().split('\n').filter(line => { + return !line.startsWith('/') && line.indexOf(':') > 0; + }); + execSync('mount').toString().split('\n').filter(line => { + return line.startsWith('/'); + }).forEach((line) => { + osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1; + }); + } catch (e) { + util.noop(); + } + } + if (_linux) { + try { + cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL'; + execSync('cat /proc/mounts 2>/dev/null', util.execOptsLinux).toString().split('\n').filter(line => { + return line.startsWith('/'); + }).forEach((line) => { + osMounts[line.split(' ')[0]] = osMounts[line.split(' ')[0]] || false; + if (line.toLowerCase().indexOf('/snap/') === -1) { + osMounts[line.split(' ')[0]] = ((line.toLowerCase().indexOf('rw,') >= 0 || line.toLowerCase().indexOf(' rw ') >= 0)); + } + }); + } catch (e) { + util.noop(); + } + } + if (_freebsd || _openbsd || _netbsd) { + try { + cmd = 'df -lkPT'; + execSync('mount').toString().split('\n').forEach((line) => { + osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1; + }); + } catch (e) { + util.noop(); + } + } + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + let lines = filterLines(stdout); + data = parseDf(lines); + if (drive) { + data = data.filter(item => { + return item.fs.toLowerCase().indexOf(drive.toLowerCase()) >= 0 || item.mount.toLowerCase().indexOf(drive.toLowerCase()) >= 0; + }); + } + if ((!error || data.length) && stdout.toString().trim() !== '') { + if (callback) { + callback(data); + } + resolve(data); + } else { + exec('df -kPT', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = filterLines(stdout); + data = parseDf(lines); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } + }); + } + if (_sunos) { + if (callback) { callback(data); } + resolve(data); + } + if (_windows) { + try { + const cmd = `Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${drive ? '| where -property Caption -eq ' + drive : ''} | fl`; + util.powerShell(cmd).then((stdout, error) => { + if (!error) { + let devices = stdout.toString().split(/\n\s*\n/); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const size = util.toInt(util.getValue(lines, 'size', ':')); + const free = util.toInt(util.getValue(lines, 'freespace', ':')); + const caption = util.getValue(lines, 'caption', ':'); + const rwValue = util.getValue(lines, 'access', ':'); + const rw = rwValue ? (util.toInt(rwValue) !== 1) : null; + if (size) { + data.push({ + fs: caption, + type: util.getValue(lines, 'filesystem', ':'), + size, + used: size - free, + available: free, + use: parseFloat(((100.0 * (size - free)) / size).toFixed(2)), + mount: caption, + rw + }); + } + }); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } catch (e) { + if (callback) { callback(data); } + resolve(data); + } + } + }); + }); +} + +exports.fsSize = fsSize; + +// -------------------------- +// FS - open files count + +function fsOpenFiles(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + const result = { + max: null, + allocated: null, + available: null + }; + if (_freebsd || _openbsd || _netbsd || _darwin) { + let cmd = 'sysctl -i kern.maxfiles kern.num_files kern.open_files'; + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.max = parseInt(util.getValue(lines, 'kern.maxfiles', ':'), 10); + result.allocated = parseInt(util.getValue(lines, 'kern.num_files', ':'), 10) || parseInt(util.getValue(lines, 'kern.open_files', ':'), 10); + result.available = result.max - result.allocated; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_linux) { + fs.readFile('/proc/sys/fs/file-nr', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines[0]) { + const parts = lines[0].replace(/\s+/g, ' ').split(' '); + if (parts.length === 3) { + result.allocated = parseInt(parts[0], 10); + result.available = parseInt(parts[1], 10); + result.max = parseInt(parts[2], 10); + if (!result.available) { result.available = result.max - result.allocated; } + } + } + if (callback) { + callback(result); + } + resolve(result); + } else { + fs.readFile('/proc/sys/fs/file-max', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines[0]) { + result.max = parseInt(lines[0], 10); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + }); + } + if (_sunos) { + if (callback) { callback(null); } + resolve(null); + } + if (_windows) { + if (callback) { callback(null); } + resolve(null); + } + }); + }); +} + +exports.fsOpenFiles = fsOpenFiles; + +// -------------------------- +// disks + +function parseBytes(s) { + return parseInt(s.substr(s.indexOf(' (') + 2, s.indexOf(' Bytes)') - 10)); +} + +function parseDevices(lines) { + let devices = []; + let i = 0; + lines.forEach(line => { + if (line.length > 0) { + if (line[0] === '*') { + i++; + } else { + let parts = line.split(':'); + if (parts.length > 1) { + if (!devices[i]) { + devices[i] = { + name: '', + identifier: '', + type: 'disk', + fsType: '', + mount: '', + size: 0, + physical: 'HDD', + uuid: '', + label: '', + model: '', + serial: '', + removable: false, + protocol: '', + group: '', + device: '' + }; + } + parts[0] = parts[0].trim().toUpperCase().replace(/ +/g, ''); + parts[1] = parts[1].trim(); + if ('DEVICEIDENTIFIER' === parts[0]) { devices[i].identifier = parts[1]; } + if ('DEVICENODE' === parts[0]) { devices[i].name = parts[1]; } + if ('VOLUMENAME' === parts[0]) { + if (parts[1].indexOf('Not applicable') === -1) { devices[i].label = parts[1]; } + } + if ('PROTOCOL' === parts[0]) { devices[i].protocol = parts[1]; } + if ('DISKSIZE' === parts[0]) { devices[i].size = parseBytes(parts[1]); } + if ('FILESYSTEMPERSONALITY' === parts[0]) { devices[i].fsType = parts[1]; } + if ('MOUNTPOINT' === parts[0]) { devices[i].mount = parts[1]; } + if ('VOLUMEUUID' === parts[0]) { devices[i].uuid = parts[1]; } + if ('READ-ONLYMEDIA' === parts[0] && parts[1] === 'Yes') { devices[i].physical = 'CD/DVD'; } + if ('SOLIDSTATE' === parts[0] && parts[1] === 'Yes') { devices[i].physical = 'SSD'; } + if ('VIRTUAL' === parts[0]) { devices[i].type = 'virtual'; } + if ('REMOVABLEMEDIA' === parts[0]) { devices[i].removable = (parts[1] === 'Removable'); } + if ('PARTITIONTYPE' === parts[0]) { devices[i].type = 'part'; } + if ('DEVICE/MEDIANAME' === parts[0]) { devices[i].model = parts[1]; } + } + } + } + }); + return devices; +} + +function parseBlk(lines) { + let data = []; + + lines.filter(line => line !== '').forEach((line) => { + try { + line = decodeURIComponent(line.replace(/\\x/g, '%')); + line = line.replace(/\\/g, '\\\\'); + let disk = JSON.parse(line); + data.push({ + 'name': disk.name, + 'type': disk.type, + 'fsType': disk.fsType, + 'mount': disk.mountpoint, + 'size': parseInt(disk.size), + 'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')), + 'uuid': disk.uuid, + 'label': disk.label, + 'model': (disk.model || '').trim(), + 'serial': disk.serial, + 'removable': disk.rm === '1', + 'protocol': disk.tran, + 'group': disk.group || '', + }); + } catch (e) { + util.noop(); + } + }); + data = util.unique(data); + data = util.sortByKey(data, ['type', 'name']); + return data; +} + +function decodeMdabmData(lines) { + const raid = util.getValue(lines, 'md_level', '='); + const label = util.getValue(lines, 'md_name', '='); // <- get label info + const uuid = util.getValue(lines, 'md_uuid', '='); // <- get uuid info + const members = []; + lines.forEach(line => { + if (line.toLowerCase().startsWith('md_device_dev') && line.toLowerCase().indexOf('/dev/') > 0) { + members.push(line.split('/dev/')[1]); + } + }); + return { + raid, + label, + uuid, + members + }; +} + +function raidMatchLinux(data) { + // for all block devices of type "raid%" + let result = data; + try { + data.forEach(element => { + if (element.type.startsWith('raid')) { + const lines = execSync(`mdadm --export --detail /dev/${element.name}`, util.execOptsLinux).toString().split('\n'); + const mdData = decodeMdabmData(lines); + + element.label = mdData.label; // <- assign label info + element.uuid = mdData.uuid; // <- assign uuid info + + if (mdData.members && mdData.members.length && mdData.raid === element.type) { + result = result.map(blockdevice => { + if (blockdevice.fsType === 'linux_raid_member' && mdData.members.indexOf(blockdevice.name) >= 0) { + blockdevice.group = element.name; + } + return blockdevice; + }); + } + } + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getDevicesLinux(data) { + const result = []; + data.forEach(element => { + if (element.type.startsWith('disk')) { + result.push(element.name); + } + }); + return result; +} + +function matchDevicesLinux(data) { + let result = data; + try { + const devices = getDevicesLinux(data); + result = result.map(blockdevice => { + if (blockdevice.type.startsWith('part') || blockdevice.type.startsWith('disk')) { + devices.forEach(element => { + if (blockdevice.name.startsWith(element)) { + blockdevice.device = '/dev/' + element; + } + }); + } + return blockdevice; + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getDevicesMac(data) { + const result = []; + data.forEach(element => { + if (element.type.startsWith('disk')) { + result.push({ name: element.name, model: element.model, device: element.name }); + } + if (element.type.startsWith('virtual')) { + let device = ''; + result.forEach(e => { + if (e.model === element.model) { + device = e.device; + } + }); + if (device) { + result.push({ name: element.name, model: element.model, device }); + } + } + }); + return result; +} + +function matchDevicesMac(data) { + let result = data; + try { + const devices = getDevicesMac(data); + result = result.map(blockdevice => { + if (blockdevice.type.startsWith('part') || blockdevice.type.startsWith('disk') || blockdevice.type.startsWith('virtual')) { + devices.forEach(element => { + if (blockdevice.name.startsWith(element.name)) { + blockdevice.device = element.device; + } + }); + } + return blockdevice; + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getDevicesWin(diskDrives) { + const result = []; + diskDrives.forEach(element => { + const lines = element.split('\r\n'); + const device = util.getValue(lines, 'DeviceID', ':'); + let partitions = element.split('@{DeviceID='); + if (partitions.length > 1) { + partitions = partitions.slice(1); + partitions.forEach(partition => { + result.push({ name: partition.split(';')[0].toUpperCase(), device }); + }); + } + }); + return result; +} + +function matchDevicesWin(data, diskDrives) { + const devices = getDevicesWin(diskDrives); + data.map(element => { + const filteresDevices = devices.filter((e) => { return e.name === element.name.toUpperCase(); }); + if (filteresDevices.length > 0) { + element.device = filteresDevices[0].device; + } + return element; + }); + return data; +} + +function blkStdoutToObject(stdout) { + return stdout.toString() + .replace(/NAME=/g, '{"name":') + .replace(/FSTYPE=/g, ',"fsType":') + .replace(/TYPE=/g, ',"type":') + .replace(/SIZE=/g, ',"size":') + .replace(/MOUNTPOINT=/g, ',"mountpoint":') + .replace(/UUID=/g, ',"uuid":') + .replace(/ROTA=/g, ',"rota":') + .replace(/RO=/g, ',"ro":') + .replace(/RM=/g, ',"rm":') + .replace(/TRAN=/g, ',"tran":') + .replace(/SERIAL=/g, ',"serial":') + .replace(/LABEL=/g, ',"label":') + .replace(/MODEL=/g, ',"model":') + .replace(/OWNER=/g, ',"owner":') + .replace(/GROUP=/g, ',"group":') + .replace(/\n/g, '}\n'); +} + +function blockDevices(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let data = []; + if (_linux) { + // see https://wiki.ubuntuusers.de/lsblk/ + // exec("lsblk -bo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,TRAN,SERIAL,LABEL,MODEL,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,SCHED,RQ-SIZE,RA,WSAME", function (error, stdout) { + exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = blkStdoutToObject(stdout).split('\n'); + data = parseBlk(lines); + data = raidMatchLinux(data); + data = matchDevicesLinux(data); + if (callback) { + callback(data); + } + resolve(data); + } else { + exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = blkStdoutToObject(stdout).split('\n'); + data = parseBlk(lines); + data = raidMatchLinux(data); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } + }); + } + if (_darwin) { + exec('diskutil info -all', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + // parse lines into temp array of devices + data = parseDevices(lines); + data = matchDevicesMac(data); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } + if (_sunos) { + if (callback) { callback(data); } + resolve(data); + } + if (_windows) { + let drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM']; + try { + // util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => { + // util.powerShell('Get-CimInstance Win32_logicaldisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => { + const workload = []; + workload.push(util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl')); + workload.push(util.powerShell('Get-WmiObject -Class Win32_diskdrive | Select-Object -Property PNPDeviceId,DeviceID, Model, Size, @{L=\'Partitions\'; E={$_.GetRelated(\'Win32_DiskPartition\').GetRelated(\'Win32_LogicalDisk\') | Select-Object -Property DeviceID, VolumeName, Size, FreeSpace}} | fl')); + util.promiseAll( + workload + ).then((res) => { + let logicalDisks = res.results[0].toString().split(/\n\s*\n/); + let diskDrives = res.results[1].toString().split(/\n\s*\n/); + logicalDisks.forEach(function (device) { + let lines = device.split('\r\n'); + let drivetype = util.getValue(lines, 'drivetype', ':'); + if (drivetype) { + data.push({ + name: util.getValue(lines, 'name', ':'), + identifier: util.getValue(lines, 'caption', ':'), + type: 'disk', + fsType: util.getValue(lines, 'filesystem', ':').toLowerCase(), + mount: util.getValue(lines, 'caption', ':'), + size: util.getValue(lines, 'size', ':'), + physical: (drivetype >= 0 && drivetype <= 6) ? drivetypes[drivetype] : drivetypes[0], + uuid: util.getValue(lines, 'volumeserialnumber', ':'), + label: util.getValue(lines, 'volumename', ':'), + model: '', + serial: util.getValue(lines, 'volumeserialnumber', ':'), + removable: drivetype === '2', + protocol: '', + group: '', + device: '' + }); + } + }); + // match devices + data = matchDevicesWin(data, diskDrives); + if (callback) { + callback(data); + } + resolve(data); + }); + } catch (e) { + if (callback) { callback(data); } + resolve(data); + } + } + if (_freebsd || _openbsd || _netbsd) { + // will follow + if (callback) { callback(null); } + resolve(null); + } + + }); + }); +} + +exports.blockDevices = blockDevices; + +// -------------------------- +// FS - speed + +function calcFsSpeed(rx, wx) { + let result = { + rx: 0, + wx: 0, + tx: 0, + rx_sec: null, + wx_sec: null, + tx_sec: null, + ms: 0 + }; + + if (_fs_speed && _fs_speed.ms) { + result.rx = rx; + result.wx = wx; + result.tx = result.rx + result.wx; + result.ms = Date.now() - _fs_speed.ms; + result.rx_sec = (result.rx - _fs_speed.bytes_read) / (result.ms / 1000); + result.wx_sec = (result.wx - _fs_speed.bytes_write) / (result.ms / 1000); + result.tx_sec = result.rx_sec + result.wx_sec; + _fs_speed.rx_sec = result.rx_sec; + _fs_speed.wx_sec = result.wx_sec; + _fs_speed.tx_sec = result.tx_sec; + _fs_speed.bytes_read = result.rx; + _fs_speed.bytes_write = result.wx; + _fs_speed.bytes_overall = result.rx + result.wx; + _fs_speed.ms = Date.now(); + _fs_speed.last_ms = result.ms; + } else { + result.rx = rx; + result.wx = wx; + result.tx = result.rx + result.wx; + _fs_speed.rx_sec = null; + _fs_speed.wx_sec = null; + _fs_speed.tx_sec = null; + _fs_speed.bytes_read = result.rx; + _fs_speed.bytes_write = result.wx; + _fs_speed.bytes_overall = result.rx + result.wx; + _fs_speed.ms = Date.now(); + _fs_speed.last_ms = 0; + } + return result; +} + +function fsStats(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + if (_windows || _freebsd || _openbsd || _netbsd || _sunos) { + return resolve(null); + } + + let result = { + rx: 0, + wx: 0, + tx: 0, + rx_sec: null, + wx_sec: null, + tx_sec: null, + ms: 0 + }; + + let rx = 0; + let wx = 0; + if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) { + if (_linux) { + // exec("df -k | grep /dev/", function(error, stdout) { + exec('lsblk -r 2>/dev/null | grep /', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + let fs_filter = []; + lines.forEach(function (line) { + if (line !== '') { + line = line.trim().split(' '); + if (fs_filter.indexOf(line[0]) === -1) { fs_filter.push(line[0]); } + } + }); + + let output = fs_filter.join('|'); + exec('cat /proc/diskstats | egrep "' + output + '"', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.trim(); + if (line !== '') { + line = line.replace(/ +/g, ' ').split(' '); + + rx += parseInt(line[5]) * 512; + wx += parseInt(line[9]) * 512; + } + }); + result = calcFsSpeed(rx, wx); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } + if (_darwin) { + exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.trim(); + if (line !== '') { + line = line.split(','); + + rx += parseInt(line[2]); + wx += parseInt(line[9]); + } + }); + result = calcFsSpeed(rx, wx); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + } else { + result.ms = _fs_speed.last_ms; + result.rx = _fs_speed.bytes_read; + result.wx = _fs_speed.bytes_write; + result.tx = _fs_speed.bytes_read + _fs_speed.bytes_write; + result.rx_sec = _fs_speed.rx_sec; + result.wx_sec = _fs_speed.wx_sec; + result.tx_sec = _fs_speed.tx_sec; + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} + +exports.fsStats = fsStats; + +function calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime) { + let result = { + rIO: 0, + wIO: 0, + tIO: 0, + rIO_sec: null, + wIO_sec: null, + tIO_sec: null, + rWaitTime: 0, + wWaitTime: 0, + tWaitTime: 0, + rWaitPercent: null, + wWaitPercent: null, + tWaitPercent: null, + ms: 0 + }; + if (_disk_io && _disk_io.ms) { + result.rIO = rIO; + result.wIO = wIO; + result.tIO = rIO + wIO; + result.ms = Date.now() - _disk_io.ms; + result.rIO_sec = (result.rIO - _disk_io.rIO) / (result.ms / 1000); + result.wIO_sec = (result.wIO - _disk_io.wIO) / (result.ms / 1000); + result.tIO_sec = result.rIO_sec + result.wIO_sec; + result.rWaitTime = rWaitTime; + result.wWaitTime = wWaitTime; + result.tWaitTime = tWaitTime; + result.rWaitPercent = (result.rWaitTime - _disk_io.rWaitTime) * 100 / (result.ms); + result.wWaitPercent = (result.wWaitTime - _disk_io.wWaitTime) * 100 / (result.ms); + result.tWaitPercent = (result.tWaitTime - _disk_io.tWaitTime) * 100 / (result.ms); + _disk_io.rIO = rIO; + _disk_io.wIO = wIO; + _disk_io.rIO_sec = result.rIO_sec; + _disk_io.wIO_sec = result.wIO_sec; + _disk_io.tIO_sec = result.tIO_sec; + _disk_io.rWaitTime = rWaitTime; + _disk_io.wWaitTime = wWaitTime; + _disk_io.tWaitTime = tWaitTime; + _disk_io.rWaitPercent = result.rWaitPercent; + _disk_io.wWaitPercent = result.wWaitPercent; + _disk_io.tWaitPercent = result.tWaitPercent; + _disk_io.last_ms = result.ms; + _disk_io.ms = Date.now(); + } else { + result.rIO = rIO; + result.wIO = wIO; + result.tIO = rIO + wIO; + result.rWaitTime = rWaitTime; + result.wWaitTime = wWaitTime; + result.tWaitTime = tWaitTime; + _disk_io.rIO = rIO; + _disk_io.wIO = wIO; + _disk_io.rIO_sec = null; + _disk_io.wIO_sec = null; + _disk_io.tIO_sec = null; + _disk_io.rWaitTime = rWaitTime; + _disk_io.wWaitTime = wWaitTime; + _disk_io.tWaitTime = tWaitTime; + _disk_io.rWaitPercent = null; + _disk_io.wWaitPercent = null; + _disk_io.tWaitPercent = null; + _disk_io.last_ms = 0; + _disk_io.ms = Date.now(); + } + return result; +} + +function disksIO(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + if (_windows) { + return resolve(null); + } + if (_sunos) { + return resolve(null); + } + + let result = { + rIO: 0, + wIO: 0, + tIO: 0, + rIO_sec: null, + wIO_sec: null, + tIO_sec: null, + rWaitTime: 0, + wWaitTime: 0, + tWaitTime: 0, + rWaitPercent: null, + wWaitPercent: null, + tWaitPercent: null, + ms: 0 + }; + let rIO = 0; + let wIO = 0; + let rWaitTime = 0; + let wWaitTime = 0; + let tWaitTime = 0; + + if ((_disk_io && !_disk_io.ms) || (_disk_io && _disk_io.ms && Date.now() - _disk_io.ms >= 500)) { + if (_linux || _freebsd || _openbsd || _netbsd) { + // prints Block layer statistics for all mounted volumes + // var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done"; + // var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done"; + let cmd = 'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done'; + + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.split('\n'); + lines.forEach(function (line) { + // ignore empty lines + if (!line) { return; } + + // sum r/wIO of all disks to compute all disks IO + let stats = line.split(';'); + rIO += parseInt(stats[0]); + wIO += parseInt(stats[4]); + rWaitTime += parseInt(stats[3]); + wWaitTime += parseInt(stats[7]); + tWaitTime += parseInt(stats[10]); + }); + result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime); + + if (callback) { + callback(result); + } + resolve(result); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } + if (_darwin) { + exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.trim(); + if (line !== '') { + line = line.split(','); + + rIO += parseInt(line[10]); + wIO += parseInt(line[0]); + } + }); + result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + } else { + result.rIO = _disk_io.rIO; + result.wIO = _disk_io.wIO; + result.tIO = _disk_io.rIO + _disk_io.wIO; + result.ms = _disk_io.last_ms; + result.rIO_sec = _disk_io.rIO_sec; + result.wIO_sec = _disk_io.wIO_sec; + result.tIO_sec = _disk_io.tIO_sec; + result.rWaitTime = _disk_io.rWaitTime; + result.wWaitTime = _disk_io.wWaitTime; + result.tWaitTime = _disk_io.tWaitTime; + result.rWaitPercent = _disk_io.rWaitPercent; + result.wWaitPercent = _disk_io.wWaitPercent; + result.tWaitPercent = _disk_io.tWaitPercent; + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} + +exports.disksIO = disksIO; + +function diskLayout(callback) { + + function getVendorFromModel(model) { + const diskManufacturers = [ + { pattern: 'WESTERN.*', manufacturer: 'Western Digital' }, + { pattern: '^WDC.*', manufacturer: 'Western Digital' }, + { pattern: 'WD.*', manufacturer: 'Western Digital' }, + { pattern: 'TOSHIBA.*', manufacturer: 'Toshiba' }, + { pattern: 'HITACHI.*', manufacturer: 'Hitachi' }, + { pattern: '^IC.*', manufacturer: 'Hitachi' }, + { pattern: '^HTS.*', manufacturer: 'Hitachi' }, + { pattern: 'SANDISK.*', manufacturer: 'SanDisk' }, + { pattern: 'KINGSTON.*', manufacturer: 'Kingston Technology' }, + { pattern: '^SONY.*', manufacturer: 'Sony' }, + { pattern: 'TRANSCEND.*', manufacturer: 'Transcend' }, + { pattern: 'SAMSUNG.*', manufacturer: 'Samsung' }, + { pattern: '^ST(?!I\\ ).*', manufacturer: 'Seagate' }, + { pattern: '^STI\\ .*', manufacturer: 'SimpleTech' }, + { pattern: '^D...-.*', manufacturer: 'IBM' }, + { pattern: '^IBM.*', manufacturer: 'IBM' }, + { pattern: '^FUJITSU.*', manufacturer: 'Fujitsu' }, + { pattern: '^MP.*', manufacturer: 'Fujitsu' }, + { pattern: '^MK.*', manufacturer: 'Toshiba' }, + { pattern: 'MAXTO.*', manufacturer: 'Maxtor' }, + { pattern: 'PIONEER.*', manufacturer: 'Pioneer' }, + { pattern: 'PHILIPS.*', manufacturer: 'Philips' }, + { pattern: 'QUANTUM.*', manufacturer: 'Quantum Technology' }, + { pattern: 'FIREBALL.*', manufacturer: 'Quantum Technology' }, + { pattern: '^VBOX.*', manufacturer: 'VirtualBox' }, + { pattern: 'CORSAIR.*', manufacturer: 'Corsair Components' }, + { pattern: 'CRUCIAL.*', manufacturer: 'Crucial' }, + { pattern: 'ECM.*', manufacturer: 'ECM' }, + { pattern: 'INTEL.*', manufacturer: 'INTEL' }, + { pattern: 'EVO.*', manufacturer: 'Samsung' }, + { pattern: 'APPLE.*', manufacturer: 'Apple' }, + ]; + + let result = ''; + if (model) { + model = model.toUpperCase(); + diskManufacturers.forEach((manufacturer) => { + const re = RegExp(manufacturer.pattern); + if (re.test(model)) { result = manufacturer.manufacturer; } + }); + } + return result; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + const commitResult = res => { + for (let i = 0; i < res.length; i++) { + delete res[i].BSDName; + } + if (callback) { + callback(res); + } + resolve(res); + }; + + let result = []; + let cmd = ''; + + if (_linux) { + let cmdFullSmart = ''; + + exec('export LC_ALL=C; lsblk -ablJO 2>/dev/null; unset LC_ALL', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + try { + const out = stdout.toString().trim(); + let devices = []; + try { + const outJSON = JSON.parse(out); + if (outJSON && {}.hasOwnProperty.call(outJSON, 'blockdevices')) { + devices = outJSON.blockdevices.filter(item => { return (item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fstype === null && item.parttype === null && item.path && item.path.indexOf('/ram') !== 0 && item.path.indexOf('/loop') !== 0 && item['disc-max'] && item['disc-max'] !== 0)); }); + } + } catch (e) { + // fallback to older version of lsblk + try { + const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString(); + let lines = blkStdoutToObject(out2).split('\n'); + const data = parseBlk(lines); + devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); }); + } catch (e) { + util.noop(); + } + } + devices.forEach((device) => { + let mediumType = ''; + const BSDName = '/dev/' + device.name; + const logical = device.name; + try { + mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null', util.execOptsLinux).toString().split('\n')[0]; + } catch (e) { + util.noop(); + } + let interfaceType = device.tran ? device.tran.toUpperCase().trim() : ''; + if (interfaceType === 'NVME') { + mediumType = '2'; + interfaceType = 'PCIe'; + } + result.push({ + device: BSDName, + type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (mediumType === '2' ? 'NVMe' : (device.model && device.model.indexOf('SSD') > -1 ? 'SSD' : (device.model && device.model.indexOf('NVM') > -1 ? 'NVMe' : 'HD'))))), + name: device.model || '', + vendor: getVendorFromModel(device.model) || (device.vendor ? device.vendor.trim() : ''), + size: device.size || 0, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: device.rev ? device.rev.trim() : '', + serialNum: device.serial ? device.serial.trim() : '', + interfaceType: interfaceType, + smartStatus: 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd += `printf "\n${BSDName}|"; smartctl -H ${BSDName} | grep overall;`; + cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`; + }); + } catch (e) { + util.noop(); + } + } + // check S.M.A.R.T. status + if (cmdFullSmart) { + exec(cmdFullSmart, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + try { + const data = JSON.parse(`[${stdout}]`); + data.forEach(disk => { + const diskBSDName = disk.smartctl.argv[disk.smartctl.argv.length - 1]; + + for (let i = 0; i < result.length; i++) { + if (result[i].BSDName === diskBSDName) { + result[i].smartStatus = (disk.smart_status.passed ? 'Ok' : (disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown')); + if (disk.temperature && disk.temperature.current) { + result[i].temperature = disk.temperature.current; + } + result[i].smartData = disk; + } + } + }); + commitResult(result); + } catch (e) { + if (cmd) { + cmd = cmd + 'printf "\n"'; + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + let lines = stdout.toString().split('\n'); + lines.forEach(line => { + if (line) { + let parts = line.split('|'); + if (parts.length === 2) { + let BSDName = parts[0]; + parts[1] = parts[1].trim(); + let parts2 = parts[1].split(':'); + if (parts2.length === 2) { + parts2[1] = parts2[1].trim(); + let status = parts2[1].toLowerCase(); + for (let i = 0; i < result.length; i++) { + if (result[i].BSDName === BSDName) { + result[i].smartStatus = (status === 'passed' ? 'Ok' : (status === 'failed!' ? 'Predicted Failure' : 'unknown')); + } + } + } + } + } + }); + commitResult(result); + }); + } else { + commitResult(result); + } + } + }); + } else { + commitResult(result); + } + }); + } + if (_freebsd || _openbsd || _netbsd) { + if (callback) { callback(result); } + resolve(result); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_darwin) { + exec('system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + // split by type: + let lines = stdout.toString().split('\n'); + let linesSATA = []; + let linesNVMe = []; + let linesUSB = []; + let dataType = 'SATA'; + lines.forEach(line => { + if (line === 'NVMExpress:') { dataType = 'NVMe'; } + else if (line === 'USB:') { dataType = 'USB'; } + else if (line === 'SATA/SATA Express:') { dataType = 'SATA'; } + else if (dataType === 'SATA') { linesSATA.push(line); } + else if (dataType === 'NVMe') { linesNVMe.push(line); } + else if (dataType === 'USB') { linesUSB.push(line); } + }); + try { + // Serial ATA Drives + let devices = linesSATA.join('\n').split(' Physical Interconnect: '); + devices.shift(); + devices.forEach(function (device) { + device = 'InterfaceType: ' + device; + let lines = device.split('\n'); + const mediumType = util.getValue(lines, 'Medium Type', ':', true).trim(); + const sizeStr = util.getValue(lines, 'capacity', ':', true).trim(); + const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim(); + if (sizeStr) { + let sizeValue = 0; + if (sizeStr.indexOf('(') >= 0) { + sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, '')); + } + if (!sizeValue) { + sizeValue = parseInt(sizeStr); + } + if (sizeValue) { + const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase(); + result.push({ + device: BSDName, + type: mediumType.startsWith('Solid') ? 'SSD' : 'HD', + name: util.getValue(lines, 'Model', ':', true).trim(), + vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()) || util.getValue(lines, 'Manufacturer', ':', true), + size: sizeValue, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(), + serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), + interfaceType: util.getValue(lines, 'InterfaceType', ':', true).trim(), + smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; + } + } + }); + } catch (e) { + util.noop(); + } + + // NVME Drives + try { + let devices = linesNVMe.join('\n').split('\n\n Capacity:'); + devices.shift(); + devices.forEach(function (device) { + device = '!Capacity: ' + device; + let lines = device.split('\n'); + const linkWidth = util.getValue(lines, 'link width', ':', true).trim(); + const sizeStr = util.getValue(lines, '!capacity', ':', true).trim(); + const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim(); + if (sizeStr) { + let sizeValue = 0; + if (sizeStr.indexOf('(') >= 0) { + sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, '')); + } + if (!sizeValue) { + sizeValue = parseInt(sizeStr); + } + if (sizeValue) { + const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase(); + result.push({ + device: BSDName, + type: 'NVMe', + name: util.getValue(lines, 'Model', ':', true).trim(), + vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()), + size: sizeValue, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(), + serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), + interfaceType: ('PCIe ' + linkWidth).trim(), + smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; + } + } + }); + } catch (e) { + util.noop(); + } + // USB Drives + try { + let devices = linesUSB.join('\n').replaceAll('Media:\n ', 'Model:').split('\n\n Product ID:'); + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\n'); + const sizeStr = util.getValue(lines, 'Capacity', ':', true).trim(); + const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim(); + if (sizeStr) { + let sizeValue = 0; + if (sizeStr.indexOf('(') >= 0) { + sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, '')); + } + if (!sizeValue) { + sizeValue = parseInt(sizeStr); + } + if (sizeValue) { + const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase(); + result.push({ + device: BSDName, + type: 'USB', + name: util.getValue(lines, 'Model', ':', true).trim().replaceAll(':', ''), + vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()), + size: sizeValue, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(), + serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), + interfaceType: 'USB', + smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; + } + } + }); + } catch (e) { + util.noop(); + } + if (cmd) { + cmd = cmd + 'printf "\n"'; + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + let lines = stdout.toString().split('\n'); + lines.forEach(line => { + if (line) { + let parts = line.split('|'); + if (parts.length === 2) { + let BSDName = parts[0]; + parts[1] = parts[1].trim(); + let parts2 = parts[1].split(':'); + if (parts2.length === 2) { + parts2[1] = parts2[1].trim(); + let status = parts2[1].toLowerCase(); + for (let i = 0; i < result.length; i++) { + if (result[i].BSDName === BSDName) { + result[i].smartStatus = (status === 'not supported' ? 'not supported' : (status === 'verified' ? 'Ok' : (status === 'failing' ? 'Predicted Failure' : 'unknown'))); + } + } + } + } + } + }); + for (let i = 0; i < result.length; i++) { + delete result[i].BSDName; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + for (let i = 0; i < result.length; i++) { + delete result[i].BSDName; + } + if (callback) { + callback(result); + } + resolve(result); + } + } + }); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,DeviceId,BytesPerSector,TotalCylinders,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder,SectorsPerTrack,FirmwareRevision,SerialNumber,InterfaceType | fl')); + workload.push(util.powerShell('Get-PhysicalDisk | select BusType,MediaType,FriendlyName,Model,SerialNumber,Size | fl')); + if (util.smartMonToolsInstalled()) { + try { + const smartDev = JSON.parse(execSync('smartctl --scan -j').toString()); + if (smartDev && smartDev.devices && smartDev.devices.length > 0) { + smartDev.devices.forEach((dev) => { + workload.push(execPromiseSave(`smartctl -j -a ${dev.name}`, util.execOptsWin)); + }); + } + } catch (e) { + util.noop(); + } + } + util.promiseAll( + workload + ).then((data) => { + let devices = data.results[0].toString().split(/\n\s*\n/); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const size = util.getValue(lines, 'Size', ':').trim(); + const status = util.getValue(lines, 'Status', ':').trim().toLowerCase(); + if (size) { + result.push({ + device: util.getValue(lines, 'DeviceId', ':'), // changed from PNPDeviceId to DeviceID (be be able to match devices) + type: device.indexOf('SSD') > -1 ? 'SSD' : 'HD', // just a starting point ... better: MSFT_PhysicalDisk - Media Type ... see below + name: util.getValue(lines, 'Caption', ':'), + vendor: getVendorFromModel(util.getValue(lines, 'Caption', ':', true).trim()), + size: parseInt(size), + bytesPerSector: parseInt(util.getValue(lines, 'BytesPerSector', ':')), + totalCylinders: parseInt(util.getValue(lines, 'TotalCylinders', ':')), + totalHeads: parseInt(util.getValue(lines, 'TotalHeads', ':')), + totalSectors: parseInt(util.getValue(lines, 'TotalSectors', ':')), + totalTracks: parseInt(util.getValue(lines, 'TotalTracks', ':')), + tracksPerCylinder: parseInt(util.getValue(lines, 'TracksPerCylinder', ':')), + sectorsPerTrack: parseInt(util.getValue(lines, 'SectorsPerTrack', ':')), + firmwareRevision: util.getValue(lines, 'FirmwareRevision', ':').trim(), + serialNum: util.getValue(lines, 'SerialNumber', ':').trim(), + interfaceType: util.getValue(lines, 'InterfaceType', ':').trim(), + smartStatus: (status === 'ok' ? 'Ok' : (status === 'degraded' ? 'Degraded' : (status === 'pred fail' ? 'Predicted Failure' : 'Unknown'))), + temperature: null, + }); + } + }); + devices = data.results[1].split(/\n\s*\n/); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const serialNum = util.getValue(lines, 'SerialNumber', ':').trim(); + const name = util.getValue(lines, 'FriendlyName', ':').trim().replace('Msft ', 'Microsoft'); + const size = util.getValue(lines, 'Size', ':').trim(); + const model = util.getValue(lines, 'Model', ':').trim(); + const interfaceType = util.getValue(lines, 'BusType', ':').trim(); + let mediaType = util.getValue(lines, 'MediaType', ':').trim(); + if (mediaType === '3' || mediaType === 'HDD') { mediaType = 'HD'; } + if (mediaType === '4') { mediaType = 'SSD'; } + if (mediaType === '5') { mediaType = 'SCM'; } + if (mediaType === 'Unspecified' && (model.toLowerCase().indexOf('virtual') > -1 || model.toLowerCase().indexOf('vbox') > -1)) { mediaType = 'Virtual'; } + if (size) { + let i = util.findObjectByKey(result, 'serialNum', serialNum); + if (i === -1 || serialNum === '') { + i = util.findObjectByKey(result, 'name', name); + } + if (i != -1) { + result[i].type = mediaType; + result[i].interfaceType = interfaceType; + } + } + }); + // S.M.A.R.T + data.results.shift(); + data.results.shift(); + if (data.results.length) { + data.results.forEach((smartStr) => { + try { + const smartData = JSON.parse(smartStr); + if (smartData.serial_number) { + const serialNum = smartData.serial_number; + let i = util.findObjectByKey(result, 'serialNum', serialNum); + if (i != -1) { + result[i].smartStatus = (smartData.smart_status && smartData.smart_status.passed ? 'Ok' : (smartData.smart_status && smartData.smart_status.passed === false ? 'Predicted Failure' : 'unknown')); + if (smartData.temperature && smartData.temperature.current) { + result[i].temperature = smartData.temperature.current; + } + result[i].smartData = smartData; + } + } + } catch (e) { + util.noop(); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.diskLayout = diskLayout; + + +/***/ }), + +/***/ 79785: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// graphics.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 7. Graphics (controller, display) +// ---------------------------------------------------------------------------------- + +const fs = __nccwpck_require__(57147); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; +let _nvidiaSmiPath = ''; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _resolutionX = 0; +let _resolutionY = 0; +let _pixelDepth = 0; +let _refreshRate = 0; + +const videoTypes = { + '-2': 'UNINITIALIZED', + '-1': 'OTHER', + '0': 'HD15', + '1': 'SVIDEO', + '2': 'Composite video', + '3': 'Component video', + '4': 'DVI', + '5': 'HDMI', + '6': 'LVDS', + '8': 'D_JPN', + '9': 'SDI', + '10': 'DP', + '11': 'DP embedded', + '12': 'UDI', + '13': 'UDI embedded', + '14': 'SDTVDONGLE', + '15': 'MIRACAST', + '2147483648': 'INTERNAL' +}; + +function getVendorFromModel(model) { + const manufacturers = [ + { pattern: '^LG.+', manufacturer: 'LG' }, + { pattern: '^BENQ.+', manufacturer: 'BenQ' }, + { pattern: '^ASUS.+', manufacturer: 'Asus' }, + { pattern: '^DELL.+', manufacturer: 'Dell' }, + { pattern: '^SAMSUNG.+', manufacturer: 'Samsung' }, + { pattern: '^VIEWSON.+', manufacturer: 'ViewSonic' }, + { pattern: '^SONY.+', manufacturer: 'Sony' }, + { pattern: '^ACER.+', manufacturer: 'Acer' }, + { pattern: '^AOC.+', manufacturer: 'AOC Monitors' }, + { pattern: '^HP.+', manufacturer: 'HP' }, + { pattern: '^EIZO.?', manufacturer: 'Eizo' }, + { pattern: '^PHILIPS.?', manufacturer: 'Philips' }, + { pattern: '^IIYAMA.?', manufacturer: 'Iiyama' }, + { pattern: '^SHARP.?', manufacturer: 'Sharp' }, + { pattern: '^NEC.?', manufacturer: 'NEC' }, + { pattern: '^LENOVO.?', manufacturer: 'Lenovo' }, + { pattern: 'COMPAQ.?', manufacturer: 'Compaq' }, + { pattern: 'APPLE.?', manufacturer: 'Apple' }, + { pattern: 'INTEL.?', manufacturer: 'Intel' }, + { pattern: 'AMD.?', manufacturer: 'AMD' }, + { pattern: 'NVIDIA.?', manufacturer: 'NVDIA' }, + ]; + + let result = ''; + if (model) { + model = model.toUpperCase(); + manufacturers.forEach((manufacturer) => { + const re = RegExp(manufacturer.pattern); + if (re.test(model)) { result = manufacturer.manufacturer; } + }); + } + return result; +} + +function getVendorFromId(id) { + const vendors = { + '610': 'Apple', + '1e6d': 'LG', + '10ac': 'DELL', + '4dd9': 'Sony', + '38a3': 'NEC', + }; + return vendors[id] || ''; +} + +function vendorToId(str) { + let result = ''; + str = (str || '').toLowerCase(); + if (str.indexOf('apple') >= 0) { result = '0x05ac'; } + else if (str.indexOf('nvidia') >= 0) { result = '0x10de'; } + else if (str.indexOf('intel') >= 0) { result = '0x8086'; } + else if (str.indexOf('ati') >= 0 || str.indexOf('amd') >= 0) { result = '0x1002'; } + + return result; +} + +function getMetalVersion(id) { + const families = { + 'spdisplays_mtlgpufamilymac1': 'mac1', + 'spdisplays_mtlgpufamilymac2': 'mac2', + 'spdisplays_mtlgpufamilyapple1': 'apple1', + 'spdisplays_mtlgpufamilyapple2': 'apple2', + 'spdisplays_mtlgpufamilyapple3': 'apple3', + 'spdisplays_mtlgpufamilyapple4': 'apple4', + 'spdisplays_mtlgpufamilyapple5': 'apple5', + 'spdisplays_mtlgpufamilyapple6': 'apple6', + 'spdisplays_mtlgpufamilyapple7': 'apple7', + 'spdisplays_metalfeaturesetfamily11': 'family1_v1', + 'spdisplays_metalfeaturesetfamily12': 'family1_v2', + 'spdisplays_metalfeaturesetfamily13': 'family1_v3', + 'spdisplays_metalfeaturesetfamily14': 'family1_v4', + 'spdisplays_metalfeaturesetfamily21': 'family2_v1' + }; + return families[id] || ''; +} + +function graphics(callback) { + + function parseLinesDarwin(graphicsArr) { + const res = { + controllers: [], + displays: [] + }; + try { + graphicsArr.forEach(function (item) { + // controllers + const bus = ((item.sppci_bus || '').indexOf('builtin') > -1 ? 'Built-In' : ((item.sppci_bus || '').indexOf('pcie') > -1 ? 'PCIe' : '')); + const vram = (parseInt((item.spdisplays_vram || ''), 10) || 0) * (((item.spdisplays_vram || '').indexOf('GB') > -1) ? 1024 : 1); + const vramDyn = (parseInt((item.spdisplays_vram_shared || ''), 10) || 0) * (((item.spdisplays_vram_shared || '').indexOf('GB') > -1) ? 1024 : 1); + let metalVersion = getMetalVersion(item.spdisplays_metal || item.spdisplays_metalfamily || ''); + res.controllers.push({ + vendor: getVendorFromModel(item.spdisplays_vendor || '') || item.spdisplays_vendor || '', + model: item.sppci_model || '', + bus, + vramDynamic: bus === 'Built-In', + vram: vram || vramDyn || null, + deviceId: item['spdisplays_device-id'] || '', + vendorId: item['spdisplays_vendor-id'] || vendorToId((item['spdisplays_vendor'] || '') + (item.sppci_model || '')), + external: (item.sppci_device_type === 'spdisplays_egpu'), + cores: item['sppci_cores'] || null, + metalVersion + }); + + // displays + if (item.spdisplays_ndrvs && item.spdisplays_ndrvs.length) { + item.spdisplays_ndrvs.forEach(function (displayItem) { + const connectionType = displayItem['spdisplays_connection_type'] || ''; + const currentResolutionParts = (displayItem['_spdisplays_resolution'] || '').split('@'); + const currentResolution = currentResolutionParts[0].split('x'); + const pixelParts = (displayItem['_spdisplays_pixels'] || '').split('x'); + const pixelDepthString = displayItem['spdisplays_depth'] || ''; + const serial = displayItem['_spdisplays_display-serial-number'] || displayItem['_spdisplays_display-serial-number2'] || null; + res.displays.push({ + vendor: getVendorFromId(displayItem['_spdisplays_display-vendor-id'] || '') || getVendorFromModel(displayItem['_name'] || ''), + vendorId: displayItem['_spdisplays_display-vendor-id'] || '', + model: displayItem['_name'] || '', + productionYear: displayItem['_spdisplays_display-year'] || null, + serial: serial !== '0' ? serial : null, + displayId: displayItem['_spdisplays_displayID'] || null, + main: displayItem['spdisplays_main'] ? displayItem['spdisplays_main'] === 'spdisplays_yes' : false, + builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') > -1, + connection: ((connectionType.indexOf('_internal') > -1) ? 'Internal' : ((connectionType.indexOf('_displayport') > -1) ? 'Display Port' : ((connectionType.indexOf('_hdmi') > -1) ? 'HDMI' : null))), + sizeX: null, + sizeY: null, + pixelDepth: (pixelDepthString === 'CGSThirtyBitColor' ? 30 : (pixelDepthString === 'CGSThirtytwoBitColor' ? 32 : (pixelDepthString === 'CGSTwentyfourBitColor' ? 24 : null))), + resolutionX: pixelParts.length > 1 ? parseInt(pixelParts[0], 10) : null, + resolutionY: pixelParts.length > 1 ? parseInt(pixelParts[1], 10) : null, + currentResX: currentResolution.length > 1 ? parseInt(currentResolution[0], 10) : null, + currentResY: currentResolution.length > 1 ? parseInt(currentResolution[1], 10) : null, + positionX: 0, + positionY: 0, + currentRefreshRate: currentResolutionParts.length > 1 ? parseInt(currentResolutionParts[1], 10) : null, + + }); + }); + } + }); + return res; + } catch (e) { + return res; + } + } + + function parseLinesLinuxControllers(lines) { + let controllers = []; + let currentController = { + vendor: '', + subVendor: '', + model: '', + bus: '', + busAddress: '', + vram: null, + vramDynamic: false, + pciID: '' + }; + let isGraphicsController = false; + // PCI bus IDs + let pciIDs = []; + try { + pciIDs = execSync('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "', util.execOptsLinux).toString().split('\n'); + for (let i = 0; i < pciIDs.length; i++) { + pciIDs[i] = pciIDs[i].replace('Bus Address:', '').replace('0000:', '').trim(); + } + pciIDs = pciIDs.filter(function (el) { + return el != null && el; + }); + } catch (e) { + util.noop(); + } + let i = 1; + lines.forEach((line) => { + let subsystem = ''; + if (i < lines.length && lines[i]) { // get next line; + subsystem = lines[i]; + if (subsystem.indexOf(':') > 0) { + subsystem = subsystem.split(':')[1]; + } + } + if ('' !== line.trim()) { + if (' ' !== line[0] && '\t' !== line[0]) { // first line of new entry + let isExternal = (pciIDs.indexOf(line.split(' ')[0]) >= 0); + let vgapos = line.toLowerCase().indexOf(' vga '); + let _3dcontrollerpos = line.toLowerCase().indexOf('3d controller'); + if (vgapos !== -1 || _3dcontrollerpos !== -1) { // VGA + if (_3dcontrollerpos !== -1 && vgapos === -1) { + vgapos = _3dcontrollerpos; + } + if (currentController.vendor || currentController.model || currentController.bus || currentController.vram !== null || currentController.vramDynamic) { // already a controller found + controllers.push(currentController); + currentController = { + vendor: '', + model: '', + bus: '', + busAddress: '', + vram: null, + vramDynamic: false, + }; + } + + const pciIDCandidate = line.split(' ')[0]; + if (/[\da-fA-F]{2}:[\da-fA-F]{2}\.[\da-fA-F]/.test(pciIDCandidate)) { + currentController.busAddress = pciIDCandidate; + } + isGraphicsController = true; + let endpos = line.search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/); + let parts = line.substr(vgapos, endpos - vgapos).split(':'); + currentController.busAddress = line.substr(0, vgapos).trim(); + if (parts.length > 1) { + parts[1] = parts[1].trim(); + if (parts[1].toLowerCase().indexOf('corporation') >= 0) { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf('corporation') + 11).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf('corporation') + 11, 200).split('(')[0].trim(); + currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard'; + currentController.vram = null; + currentController.vramDynamic = false; + } else if (parts[1].toLowerCase().indexOf(' inc.') >= 0) { + if ((parts[1].match(/]/g) || []).length > 1) { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(']') + 1).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']') + 1, 200).trim().split('(')[0].trim(); + } else { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' inc.') + 5).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' inc.') + 5, 200).trim().split('(')[0].trim(); + } + currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard'; + currentController.vram = null; + currentController.vramDynamic = false; + } else if (parts[1].toLowerCase().indexOf(' ltd.') >= 0) { + if ((parts[1].match(/]/g) || []).length > 1) { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(']') + 1).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']') + 1, 200).trim().split('(')[0].trim(); + } else { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' ltd.') + 5).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' ltd.') + 5, 200).trim().split('(')[0].trim(); + } + } + if (currentController.model && subsystem.indexOf(currentController.model) !== -1) { + const subVendor = subsystem.split(currentController.model)[0].trim(); + if (subVendor) { + currentController.subVendor = subVendor; + } + } + } + + } else { + isGraphicsController = false; + } + } + if (isGraphicsController) { // within VGA details + let parts = line.split(':'); + if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('devicename') !== -1 && parts[1].toLowerCase().indexOf('onboard') !== -1) { currentController.bus = 'Onboard'; } + if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('region') !== -1 && parts[1].toLowerCase().indexOf('memory') !== -1) { + let memparts = parts[1].split('='); + if (memparts.length > 1) { + currentController.vram = parseInt(memparts[1]); + } + } + } + } + i++; + }); + + if (currentController.vendor || currentController.model || currentController.bus || currentController.busAddress || currentController.vram !== null || currentController.vramDynamic) { // already a controller found + controllers.push(currentController); + } + return (controllers); + } + + function parseLinesLinuxClinfo(controllers, lines) { + const fieldPattern = /\[([^\]]+)\]\s+(\w+)\s+(.*)/; + const devices = lines.reduce((devices, line) => { + const field = fieldPattern.exec(line.trim()); + if (field) { + if (!devices[field[1]]) { + devices[field[1]] = {}; + } + devices[field[1]][field[2]] = field[3]; + } + return devices; + }, {}); + for (let deviceId in devices) { + const device = devices[deviceId]; + if (device['CL_DEVICE_TYPE'] === 'CL_DEVICE_TYPE_GPU') { + let busAddress; + if (device['CL_DEVICE_TOPOLOGY_AMD']) { + const bdf = device['CL_DEVICE_TOPOLOGY_AMD'].match(/[a-zA-Z0-9]+:\d+\.\d+/); + if (bdf) { + busAddress = bdf[0]; + } + } else if (device['CL_DEVICE_PCI_BUS_ID_NV'] && device['CL_DEVICE_PCI_SLOT_ID_NV']) { + const bus = parseInt(device['CL_DEVICE_PCI_BUS_ID_NV']); + const slot = parseInt(device['CL_DEVICE_PCI_SLOT_ID_NV']); + if (!isNaN(bus) && !isNaN(slot)) { + const b = bus & 0xff; + const d = (slot >> 3) & 0xff; + const f = slot & 0x07; + busAddress = `${b.toString().padStart(2, '0')}:${d.toString().padStart(2, '0')}.${f}`; + } + } + if (busAddress) { + let controller = controllers.find(controller => controller.busAddress === busAddress); + if (!controller) { + controller = { + vendor: '', + model: '', + bus: '', + busAddress, + vram: null, + vramDynamic: false + }; + controllers.push(controller); + } + controller.vendor = device['CL_DEVICE_VENDOR']; + if (device['CL_DEVICE_BOARD_NAME_AMD']) { + controller.model = device['CL_DEVICE_BOARD_NAME_AMD']; + } else { + controller.model = device['CL_DEVICE_NAME']; + } + const memory = parseInt(device['CL_DEVICE_GLOBAL_MEM_SIZE']); + if (!isNaN(memory)) { + controller.vram = Math.round(memory / 1024 / 1024); + } + } + } + } + return controllers; + } + + function getNvidiaSmi() { + if (_nvidiaSmiPath) { + return _nvidiaSmiPath; + } + + if (_windows) { + try { + const basePath = util.WINDIR + '\\System32\\DriverStore\\FileRepository'; + // find all directories that have an nvidia-smi.exe file + const candidateDirs = fs.readdirSync(basePath).filter(dir => { + return fs.readdirSync([basePath, dir].join('/')).includes('nvidia-smi.exe'); + }); + // use the directory with the most recently created nvidia-smi.exe file + const targetDir = candidateDirs.reduce((prevDir, currentDir) => { + const previousNvidiaSmi = fs.statSync([basePath, prevDir, 'nvidia-smi.exe'].join('/')); + const currentNvidiaSmi = fs.statSync([basePath, currentDir, 'nvidia-smi.exe'].join('/')); + return (previousNvidiaSmi.ctimeMs > currentNvidiaSmi.ctimeMs) ? prevDir : currentDir; + }); + + if (targetDir) { + _nvidiaSmiPath = [basePath, targetDir, 'nvidia-smi.exe'].join('/'); + } + } catch (e) { + util.noop(); + } + } else if (_linux) { + _nvidiaSmiPath = 'nvidia-smi'; + } + return _nvidiaSmiPath; + } + + function nvidiaSmi(options) { + const nvidiaSmiExe = getNvidiaSmi(); + options = options || util.execOptsWin; + if (nvidiaSmiExe) { + const nvidiaSmiOpts = '--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits'; + const cmd = nvidiaSmiExe + ' ' + nvidiaSmiOpts + (_linux ? ' 2>/dev/null' : ''); + if (_linux) { + options.stdio = ['pipe', 'pipe', 'ignore']; + } + try { + const res = execSync(cmd, options).toString(); + return res; + } catch (e) { + util.noop(); + } + } + return ''; + } + + function nvidiaDevices() { + + function safeParseNumber(value) { + if ([null, undefined].includes(value)) { + return value; + } + return parseFloat(value); + } + + const stdout = nvidiaSmi(); + if (!stdout) { + return []; + } + + const gpus = stdout.split('\n').filter(Boolean); + let results = gpus.map(gpu => { + const splittedData = gpu.split(', ').map(value => value.includes('N/A') ? undefined : value); + if (splittedData.length === 16) { + return { + driverVersion: splittedData[0], + subDeviceId: splittedData[1], + name: splittedData[2], + pciBus: splittedData[3], + fanSpeed: safeParseNumber(splittedData[4]), + memoryTotal: safeParseNumber(splittedData[5]), + memoryUsed: safeParseNumber(splittedData[6]), + memoryFree: safeParseNumber(splittedData[7]), + utilizationGpu: safeParseNumber(splittedData[8]), + utilizationMemory: safeParseNumber(splittedData[9]), + temperatureGpu: safeParseNumber(splittedData[10]), + temperatureMemory: safeParseNumber(splittedData[11]), + powerDraw: safeParseNumber(splittedData[12]), + powerLimit: safeParseNumber(splittedData[13]), + clockCore: safeParseNumber(splittedData[14]), + clockMemory: safeParseNumber(splittedData[15]), + }; + } else { + return {}; + } + }); + results = results.filter((item) => { + return ('pciBus' in item); + }); + return results; + } + + function mergeControllerNvidia(controller, nvidia) { + if (nvidia.driverVersion) { controller.driverVersion = nvidia.driverVersion; } + if (nvidia.subDeviceId) { controller.subDeviceId = nvidia.subDeviceId; } + if (nvidia.name) { controller.name = nvidia.name; } + if (nvidia.pciBus) { controller.pciBus = nvidia.pciBus; } + if (nvidia.fanSpeed) { controller.fanSpeed = nvidia.fanSpeed; } + if (nvidia.memoryTotal) { + controller.memoryTotal = nvidia.memoryTotal; + controller.vram = nvidia.memoryTotal; + controller.vramDynamic = false; + } + if (nvidia.memoryUsed) { controller.memoryUsed = nvidia.memoryUsed; } + if (nvidia.memoryFree) { controller.memoryFree = nvidia.memoryFree; } + if (nvidia.utilizationGpu) { controller.utilizationGpu = nvidia.utilizationGpu; } + if (nvidia.utilizationMemory) { controller.utilizationMemory = nvidia.utilizationMemory; } + if (nvidia.temperatureGpu) { controller.temperatureGpu = nvidia.temperatureGpu; } + if (nvidia.temperatureMemory) { controller.temperatureMemory = nvidia.temperatureMemory; } + if (nvidia.powerDraw) { controller.powerDraw = nvidia.powerDraw; } + if (nvidia.powerLimit) { controller.powerLimit = nvidia.powerLimit; } + if (nvidia.clockCore) { controller.clockCore = nvidia.clockCore; } + if (nvidia.clockMemory) { controller.clockMemory = nvidia.clockMemory; } + return controller; + } + + function parseLinesLinuxEdid(edid) { + // parsen EDID + // --> model + // --> resolutionx + // --> resolutiony + // --> builtin = false + // --> pixeldepth (?) + // --> sizex + // --> sizey + let result = { + vendor: '', + model: '', + deviceName: '', + main: false, + builtin: false, + connection: '', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: null, + resolutionY: null, + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }; + // find first "Detailed Timing Description" + let start = 108; + if (edid.substr(start, 6) === '000000') { + start += 36; + } + if (edid.substr(start, 6) === '000000') { + start += 36; + } + if (edid.substr(start, 6) === '000000') { + start += 36; + } + if (edid.substr(start, 6) === '000000') { + start += 36; + } + result.resolutionX = parseInt('0x0' + edid.substr(start + 8, 1) + edid.substr(start + 4, 2)); + result.resolutionY = parseInt('0x0' + edid.substr(start + 14, 1) + edid.substr(start + 10, 2)); + result.sizeX = parseInt('0x0' + edid.substr(start + 28, 1) + edid.substr(start + 24, 2)); + result.sizeY = parseInt('0x0' + edid.substr(start + 29, 1) + edid.substr(start + 26, 2)); + // monitor name + start = edid.indexOf('000000fc00'); // find first "Monitor Description Data" + if (start >= 0) { + let model_raw = edid.substr(start + 10, 26); + if (model_raw.indexOf('0a') !== -1) { + model_raw = model_raw.substr(0, model_raw.indexOf('0a')); + } + try { + if (model_raw.length > 2) { + result.model = model_raw.match(/.{1,2}/g).map(function (v) { + return String.fromCharCode(parseInt(v, 16)); + }).join(''); + } + } catch (e) { + util.noop(); + } + } else { + result.model = ''; + } + return result; + } + + function parseLinesLinuxDisplays(lines, depth) { + let displays = []; + let currentDisplay = { + vendor: '', + model: '', + deviceName: '', + main: false, + builtin: false, + connection: '', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: null, + resolutionY: null, + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }; + let is_edid = false; + let is_current = false; + let edid_raw = ''; + let start = 0; + for (let i = 1; i < lines.length; i++) { // start with second line + if ('' !== lines[i].trim()) { + if (' ' !== lines[i][0] && '\t' !== lines[i][0] && lines[i].toLowerCase().indexOf(' connected ') !== -1) { // first line of new entry + if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // push last display to array + displays.push(currentDisplay); + currentDisplay = { + vendor: '', + model: '', + main: false, + builtin: false, + connection: '', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: null, + resolutionY: null, + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }; + } + let parts = lines[i].split(' '); + currentDisplay.connection = parts[0]; + currentDisplay.main = lines[i].toLowerCase().indexOf(' primary ') >= 0; + currentDisplay.builtin = (parts[0].toLowerCase().indexOf('edp') >= 0); + } + + // try to read EDID information + if (is_edid) { + if (lines[i].search(/\S|$/) > start) { + edid_raw += lines[i].toLowerCase().trim(); + } else { + // parsen EDID + let edid_decoded = parseLinesLinuxEdid(edid_raw); + currentDisplay.vendor = edid_decoded.vendor; + currentDisplay.model = edid_decoded.model; + currentDisplay.resolutionX = edid_decoded.resolutionX; + currentDisplay.resolutionY = edid_decoded.resolutionY; + currentDisplay.sizeX = edid_decoded.sizeX; + currentDisplay.sizeY = edid_decoded.sizeY; + currentDisplay.pixelDepth = depth; + is_edid = false; + } + } + if (lines[i].toLowerCase().indexOf('edid:') >= 0) { + is_edid = true; + start = lines[i].search(/\S|$/); + } + if (lines[i].toLowerCase().indexOf('*current') >= 0) { + const parts1 = lines[i].split('('); + if (parts1 && parts1.length > 1 && parts1[0].indexOf('x') >= 0) { + const resParts = parts1[0].trim().split('x'); + currentDisplay.currentResX = util.toInt(resParts[0]); + currentDisplay.currentResY = util.toInt(resParts[1]); + } + is_current = true; + } + if (is_current && lines[i].toLowerCase().indexOf('clock') >= 0 && lines[i].toLowerCase().indexOf('hz') >= 0 && lines[i].toLowerCase().indexOf('v: height') >= 0) { + const parts1 = lines[i].split('clock'); + if (parts1 && parts1.length > 1 && parts1[1].toLowerCase().indexOf('hz') >= 0) { + currentDisplay.currentRefreshRate = util.toInt(parts1[1]); + } + is_current = false; + } + } + } + + // pushen displays + if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // still information there + displays.push(currentDisplay); + } + return displays; + } + + // function starts here + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + controllers: [], + displays: [] + }; + if (_darwin) { + let cmd = 'system_profiler -xml -detailLevel full SPDisplaysDataType'; + exec(cmd, function (error, stdout) { + if (!error) { + try { + const output = stdout.toString(); + result = parseLinesDarwin(util.plistParser(output)[0]._items); + } catch (e) { + util.noop(); + } + try { + stdout = execSync('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""', { maxBuffer: 1024 * 20000 }); + const output = (stdout || '').toString(); + const obj = util.plistReader(output); + if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) { + const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']; + let i = 0; + current.forEach((o) => { + if (o['CurrentInfo'] && o['CurrentInfo']['OriginX'] !== undefined && result.displays && result.displays[i]) { + result.displays[i].positionX = o['CurrentInfo']['OriginX']; + } + if (o['CurrentInfo'] && o['CurrentInfo']['OriginY'] !== undefined && result.displays && result.displays[i]) { + result.displays[i].positionY = o['CurrentInfo']['OriginY']; + } + i++; + }); + } + if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets'].length > 0 && obj['DisplayAnyUserSets'][0].length > 0 && obj['DisplayAnyUserSets'][0][0]['DisplayID']) { + const current = obj['DisplayAnyUserSets'][0]; + let i = 0; + current.forEach((o) => { + if ('OriginX' in o && result.displays && result.displays[i]) { + result.displays[i].positionX = o['OriginX']; + } + if ('OriginY' in o && result.displays && result.displays[i]) { + result.displays[i].positionY = o['OriginY']; + } + if (o['Mode'] && o['Mode']['BitsPerPixel'] !== undefined && result.displays && result.displays[i]) { + result.displays[i].pixelDepth = o['Mode']['BitsPerPixel']; + } + i++; + }); + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_linux) { + // Raspberry: https://elinux.org/RPI_vcgencmd_usage + if (util.isRaspberry() && util.isRaspbian()) { + let cmd = 'fbset -s | grep \'mode "\'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;'; + exec(cmd, function (error, stdout) { + let lines = stdout.toString().split('\n'); + if (lines.length > 3 && lines[0].indexOf('mode "') >= -1 && lines[2].indexOf('0x12000a') > -1) { + const parts = lines[0].replace('mode', '').replace(/"/g, '').trim().split('x'); + if (parts.length === 2) { + result.displays.push({ + vendor: '', + model: util.getValue(lines, 'device_name', '='), + main: true, + builtin: false, + connection: 'HDMI', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: parseInt(parts[0], 10), + resolutionY: parseInt(parts[1], 10), + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }); + } + } + if (lines.length > 1 && stdout.toString().indexOf('gpu=') >= -1) { + result.controllers.push({ + vendor: 'Broadcom', + model: util.getRpiGpu(), + bus: '', + vram: util.getValue(lines, 'gpu', '=').replace('M', ''), + vramDynamic: true + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + let cmd = 'lspci -vvv 2>/dev/null'; + exec(cmd, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.controllers = parseLinesLinuxControllers(lines); + const nvidiaData = nvidiaDevices(); + // needs to be rewritten ... using no spread operators + result.controllers = result.controllers.map((controller) => { // match by busAddress + return mergeControllerNvidia(controller, nvidiaData.find((contr) => contr.pciBus.toLowerCase().endsWith(controller.busAddress.toLowerCase())) || {}); + }); + } + let cmd = 'clinfo --raw'; + exec(cmd, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.controllers = parseLinesLinuxClinfo(result.controllers, lines); + } + let cmd = 'xdpyinfo 2>/dev/null | grep \'depth of root window\' | awk \'{ print $5 }\''; + exec(cmd, function (error, stdout) { + let depth = 0; + if (!error) { + let lines = stdout.toString().split('\n'); + depth = parseInt(lines[0]) || 0; + } + let cmd = 'xrandr --verbose 2>/dev/null'; + exec(cmd, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.displays = parseLinesLinuxDisplays(lines, depth); + } + if (callback) { + callback(result); + } + resolve(result); + }); + }); + }); + }); + } + } + if (_freebsd || _openbsd || _netbsd) { + if (callback) { callback(null); } + resolve(null); + } + if (_sunos) { + if (callback) { callback(null); } + resolve(null); + } + if (_windows) { + + // https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/03/use-powershell-to-discover-multi-monitor-information/ + // https://devblogs.microsoft.com/scripting/use-powershell-to-discover-multi-monitor-information/ + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance win32_VideoController | fl *')); + workload.push(util.powerShell('gp "HKLM:\\SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\*" -ErrorAction SilentlyContinue | where MatchingDeviceId $null -NE | select MatchingDeviceId,HardwareInformation.qwMemorySize | fl')); + workload.push(util.powerShell('Get-CimInstance win32_desktopmonitor | fl *')); + workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl')); + workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens')); + workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl')); + workload.push(util.powerShell('gwmi WmiMonitorID -Namespace root\\wmi | ForEach-Object {(($_.ManufacturerName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.ProductCodeID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + $_.InstanceName}')); + + const nvidiaData = nvidiaDevices(); + + Promise.all( + workload + ).then((data) => { + // controller + vram + let csections = data[0].replace(/\r/g, '').split(/\n\s*\n/); + let vsections = data[1].replace(/\r/g, '').split(/\n\s*\n/); + result.controllers = parseLinesWindowsControllers(csections, vsections); + result.controllers = result.controllers.map((controller) => { // match by subDeviceId + if (controller.vendor.toLowerCase() === 'nvidia') { + return mergeControllerNvidia(controller, nvidiaData.find(device => { + let windowsSubDeviceId = (controller.subDeviceId || '').toLowerCase(); + const nvidiaSubDeviceIdParts = device.subDeviceId.split('x'); + let nvidiaSubDeviceId = nvidiaSubDeviceIdParts.length > 1 ? nvidiaSubDeviceIdParts[1].toLowerCase() : nvidiaSubDeviceIdParts[0].toLowerCase(); + const lengthDifference = Math.abs(windowsSubDeviceId.length - nvidiaSubDeviceId.length); + if (windowsSubDeviceId.length > nvidiaSubDeviceId.length) { + for (let i = 0; i < lengthDifference; i++) { + nvidiaSubDeviceId = '0' + nvidiaSubDeviceId; + } + } else if (windowsSubDeviceId.length < nvidiaSubDeviceId.length) { + for (let i = 0; i < lengthDifference; i++) { + windowsSubDeviceId = '0' + windowsSubDeviceId; + } + } + return windowsSubDeviceId === nvidiaSubDeviceId; + }) || {}); + } else { + return controller; + } + }); + + // displays + let dsections = data[2].replace(/\r/g, '').split(/\n\s*\n/); + // result.displays = parseLinesWindowsDisplays(dsections); + if (dsections[0].trim() === '') { dsections.shift(); } + if (dsections.length && dsections[dsections.length - 1].trim() === '') { dsections.pop(); } + + // monitor (powershell) + let msections = data[3].replace(/\r/g, '').split('Active '); + msections.shift(); + + // forms.screens (powershell) + let ssections = data[4].replace(/\r/g, '').split('BitsPerPixel '); + ssections.shift(); + + // connection params (powershell) - video type + let tsections = data[5].replace(/\r/g, '').split(/\n\s*\n/); + tsections.shift(); + + // monitor ID (powershell) - model / vendor + const res = data[6].replace(/\r/g, '').split(/\n/); + let isections = []; + res.forEach(element => { + const parts = element.split('|'); + if (parts.length === 5) { + isections.push({ + vendor: parts[0], + code: parts[1], + model: parts[2], + serial: parts[3], + instanceId: parts[4] + }); + } + }); + + result.displays = parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections); + + if (result.displays.length === 1) { + if (_resolutionX) { + result.displays[0].resolutionX = _resolutionX; + if (!result.displays[0].currentResX) { + result.displays[0].currentResX = _resolutionX; + } + } + if (_resolutionY) { + result.displays[0].resolutionY = _resolutionY; + if (result.displays[0].currentResY === 0) { + result.displays[0].currentResY = _resolutionY; + } + } + if (_pixelDepth) { + result.displays[0].pixelDepth = _pixelDepth; + } + } + result.displays = result.displays.map(element => { + if (_refreshRate && !element.currentRefreshRate) { + element.currentRefreshRate = _refreshRate; + } + return element; + }); + + if (callback) { + callback(result); + } + resolve(result); + }) + .catch(() => { + if (callback) { + callback(result); + } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); + + function parseLinesWindowsControllers(sections, vections) { + const memorySizes = {}; + for (const i in vections) { + if ({}.hasOwnProperty.call(vections, i)) { + if (vections[i].trim() !== '') { + const lines = vections[i].trim().split('\n'); + const matchingDeviceId = util.getValue(lines, 'MatchingDeviceId').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i); + if (matchingDeviceId) { + const quadWordmemorySize = parseInt(util.getValue(lines, 'HardwareInformation.qwMemorySize')); + if (!isNaN(quadWordmemorySize)) { + let deviceId = matchingDeviceId[1].toUpperCase() + '&' + matchingDeviceId[2].toUpperCase(); + if (matchingDeviceId[3]) { + deviceId += '&' + matchingDeviceId[3].toUpperCase(); + } + if (matchingDeviceId[4]) { + deviceId += '&' + matchingDeviceId[4].toUpperCase(); + } + memorySizes[deviceId] = quadWordmemorySize; + } + } + } + } + } + + let controllers = []; + for (let i in sections) { + if ({}.hasOwnProperty.call(sections, i)) { + if (sections[i].trim() !== '') { + let lines = sections[i].trim().split('\n'); + let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', ':').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i); + let subDeviceId = null; + let memorySize = null; + if (pnpDeviceId) { + subDeviceId = pnpDeviceId[3] || ''; + if (subDeviceId) { + subDeviceId = subDeviceId.split('_')[1]; + } + + // Match PCI device identifier (there's an order of increasing generality): + // https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-pci-devices + + // PCI\VEN_v(4)&DEV_d(4)&SUBSYS_s(4)n(4)&REV_r(2) + if (memorySize == null && pnpDeviceId[3] && pnpDeviceId[4]) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[3].toUpperCase() + '&' + pnpDeviceId[4].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + + // PCI\VEN_v(4)&DEV_d(4)&SUBSYS_s(4)n(4) + if (memorySize == null && pnpDeviceId[3]) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[3].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + + // PCI\VEN_v(4)&DEV_d(4)&REV_r(2) + if (memorySize == null && pnpDeviceId[4]) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[4].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + + // PCI\VEN_v(4)&DEV_d(4) + if (memorySize == null) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + } + + controllers.push({ + vendor: util.getValue(lines, 'AdapterCompatibility', ':'), + model: util.getValue(lines, 'name', ':'), + bus: util.getValue(lines, 'PNPDeviceID', ':').startsWith('PCI') ? 'PCI' : '', + vram: (memorySize == null ? util.toInt(util.getValue(lines, 'AdapterRAM', ':')) : memorySize) / 1024 / 1024, + vramDynamic: (util.getValue(lines, 'VideoMemoryType', ':') === '2'), + subDeviceId + }); + _resolutionX = util.toInt(util.getValue(lines, 'CurrentHorizontalResolution', ':')) || _resolutionX; + _resolutionY = util.toInt(util.getValue(lines, 'CurrentVerticalResolution', ':')) || _resolutionY; + _refreshRate = util.toInt(util.getValue(lines, 'CurrentRefreshRate', ':')) || _refreshRate; + _pixelDepth = util.toInt(util.getValue(lines, 'CurrentBitsPerPixel', ':')) || _pixelDepth; + } + } + } + return controllers; + } + + function parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections) { + let displays = []; + let vendor = ''; + let model = ''; + let deviceID = ''; + let resolutionX = 0; + let resolutionY = 0; + if (dsections && dsections.length) { + let linesDisplay = dsections[0].split('\n'); + vendor = util.getValue(linesDisplay, 'MonitorManufacturer', ':'); + model = util.getValue(linesDisplay, 'Name', ':'); + deviceID = util.getValue(linesDisplay, 'PNPDeviceID', ':').replace(/&/g, '&').toLowerCase(); + resolutionX = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', ':')); + resolutionY = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', ':')); + } + for (let i = 0; i < ssections.length; i++) { + if (ssections[i].trim() !== '') { + ssections[i] = 'BitsPerPixel ' + ssections[i]; + msections[i] = 'Active ' + msections[i]; + // tsections can be empty OR undefined on earlier versions of powershell (<=2.0) + // Tag connection type as UNKNOWN by default if this information is missing + if (tsections.length === 0 || tsections[i] === undefined) { + tsections[i] = 'Unknown'; + } + let linesScreen = ssections[i].split('\n'); + let linesMonitor = msections[i].split('\n'); + + let linesConnection = tsections[i].split('\n'); + const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel'); + const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').replace(/=/g, ':').split(','); + const primary = util.getValue(linesScreen, 'Primary'); + const sizeX = util.getValue(linesMonitor, 'MaxHorizontalImageSize'); + const sizeY = util.getValue(linesMonitor, 'MaxVerticalImageSize'); + const instanceName = util.getValue(linesMonitor, 'InstanceName').toLowerCase(); + const videoOutputTechnology = util.getValue(linesConnection, 'VideoOutputTechnology'); + const deviceName = util.getValue(linesScreen, 'DeviceName'); + let displayVendor = ''; + let displayModel = ''; + isections.forEach(element => { + if (element.instanceId.toLowerCase().startsWith(instanceName) && vendor.startsWith('(') && model.startsWith('PnP')) { + displayVendor = element.vendor; + displayModel = element.model; + } + }); + displays.push({ + vendor: instanceName.startsWith(deviceID) && displayVendor === '' ? vendor : displayVendor, + model: instanceName.startsWith(deviceID) && displayModel === '' ? model : displayModel, + deviceName, + main: primary.toLowerCase() === 'true', + builtin: videoOutputTechnology === '2147483648', + connection: videoOutputTechnology && videoTypes[videoOutputTechnology] ? videoTypes[videoOutputTechnology] : '', + resolutionX: util.toInt(util.getValue(bounds, 'Width', ':')), + resolutionY: util.toInt(util.getValue(bounds, 'Height', ':')), + sizeX: sizeX ? parseInt(sizeX, 10) : null, + sizeY: sizeY ? parseInt(sizeY, 10) : null, + pixelDepth: bitsPerPixel, + currentResX: util.toInt(util.getValue(bounds, 'Width', ':')), + currentResY: util.toInt(util.getValue(bounds, 'Height', ':')), + positionX: util.toInt(util.getValue(bounds, 'X', ':')), + positionY: util.toInt(util.getValue(bounds, 'Y', ':')), + }); + } + } + if (ssections.length === 0) { + displays.push({ + vendor, + model, + main: true, + sizeX: null, + sizeY: null, + resolutionX, + resolutionY, + pixelDepth: null, + currentResX: resolutionX, + currentResY: resolutionY, + positionX: 0, + positionY: 0 + }); + } + return displays; + } +} + +exports.graphics = graphics; + + +/***/ }), + +/***/ 19042: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// index.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// Contributors: Guillaume Legrain (https://github.com/glegrain) +// Riccardo Novaglia (https://github.com/richy24) +// Quentin Busuttil (https://github.com/Buzut) +// Lapsio (https://github.com/lapsio) +// csy (https://github.com/csy1983) +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== + +// ---------------------------------------------------------------------------------- +// Dependencies +// ---------------------------------------------------------------------------------- + +const lib_version = (__nccwpck_require__(51927)/* .version */ .i8); +const util = __nccwpck_require__(19872); +const system = __nccwpck_require__(3888); +const osInfo = __nccwpck_require__(51067); +const cpu = __nccwpck_require__(28993); +const memory = __nccwpck_require__(46522); +const battery = __nccwpck_require__(7883); +const graphics = __nccwpck_require__(79785); +const filesystem = __nccwpck_require__(39468); +const network = __nccwpck_require__(66486); +const wifi = __nccwpck_require__(26437); +const processes = __nccwpck_require__(77157); +const users = __nccwpck_require__(19750); +const internet = __nccwpck_require__(11456); +const docker = __nccwpck_require__(88600); +const vbox = __nccwpck_require__(61454); +const printer = __nccwpck_require__(15249); +const usb = __nccwpck_require__(91061); +const audio = __nccwpck_require__(39238); +const bluetooth = __nccwpck_require__(48155); + +let _platform = process.platform; +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +// ---------------------------------------------------------------------------------- +// init +// ---------------------------------------------------------------------------------- + +if (_windows) { + util.getCodepage(); +} + +// ---------------------------------------------------------------------------------- +// General +// ---------------------------------------------------------------------------------- + +function version() { + return lib_version; +} + +// ---------------------------------------------------------------------------------- +// Get static and dynamic data (all) +// ---------------------------------------------------------------------------------- + +// -------------------------- +// get static data - they should not change until restarted + +function getStaticData(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let data = {}; + + data.version = version(); + + Promise.all([ + system.system(), + system.bios(), + system.baseboard(), + system.chassis(), + osInfo.osInfo(), + osInfo.uuid(), + osInfo.versions(), + cpu.cpu(), + cpu.cpuFlags(), + graphics.graphics(), + network.networkInterfaces(), + memory.memLayout(), + filesystem.diskLayout() + ]).then((res) => { + data.system = res[0]; + data.bios = res[1]; + data.baseboard = res[2]; + data.chassis = res[3]; + data.os = res[4]; + data.uuid = res[5]; + data.versions = res[6]; + data.cpu = res[7]; + data.cpu.flags = res[8]; + data.graphics = res[9]; + data.net = res[10]; + data.memLayout = res[11]; + data.diskLayout = res[12]; + if (callback) { callback(data); } + resolve(data); + }); + }); + }); +} + + +// -------------------------- +// get all dynamic data - e.g. for monitoring agents +// may take some seconds to get all data +// -------------------------- +// 2 additional parameters needed +// - srv: comma separated list of services to monitor e.g. "mysql, apache, postgresql" +// - iface: define network interface for which you like to monitor network speed e.g. "eth0" + +function getDynamicData(srv, iface, callback) { + + if (util.isFunction(iface)) { + callback = iface; + iface = ''; + } + if (util.isFunction(srv)) { + callback = srv; + srv = ''; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + iface = iface || network.getDefaultNetworkInterface(); + srv = srv || ''; + + // use closure to track ƒ completion + let functionProcessed = (function () { + let totalFunctions = 15; + if (_windows) { totalFunctions = 13; } + if (_freebsd || _openbsd || _netbsd) { totalFunctions = 11; } + if (_sunos) { totalFunctions = 6; } + + return function () { + if (--totalFunctions === 0) { + if (callback) { + callback(data); + } + resolve(data); + } + }; + })(); + + let data = {}; + + // get time + data.time = osInfo.time(); + + /** + * @namespace + * @property {Object} versions + * @property {string} versions.node + * @property {string} versions.v8 + */ + data.node = process.versions.node; + data.v8 = process.versions.v8; + + cpu.cpuCurrentSpeed().then((res) => { + data.cpuCurrentSpeed = res; + functionProcessed(); + }); + + users.users().then((res) => { + data.users = res; + functionProcessed(); + }); + + processes.processes().then((res) => { + data.processes = res; + functionProcessed(); + }); + + cpu.currentLoad().then((res) => { + data.currentLoad = res; + functionProcessed(); + }); + + if (!_sunos) { + cpu.cpuTemperature().then((res) => { + data.temp = res; + functionProcessed(); + }); + } + + if (!_openbsd && !_freebsd && !_netbsd && !_sunos) { + network.networkStats(iface).then((res) => { + data.networkStats = res; + functionProcessed(); + }); + } + + if (!_sunos) { + network.networkConnections().then((res) => { + data.networkConnections = res; + functionProcessed(); + }); + } + + memory.mem().then((res) => { + data.mem = res; + functionProcessed(); + }); + + if (!_sunos) { + battery().then((res) => { + data.battery = res; + functionProcessed(); + }); + } + + if (!_sunos) { + processes.services(srv).then((res) => { + data.services = res; + functionProcessed(); + }); + } + + if (!_sunos) { + filesystem.fsSize().then((res) => { + data.fsSize = res; + functionProcessed(); + }); + } + + if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) { + filesystem.fsStats().then((res) => { + data.fsStats = res; + functionProcessed(); + }); + } + + if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) { + filesystem.disksIO().then((res) => { + data.disksIO = res; + functionProcessed(); + }); + } + + if (!_openbsd && !_freebsd && !_netbsd && !_sunos) { + wifi.wifiNetworks().then((res) => { + data.wifiNetworks = res; + functionProcessed(); + }); + } + + internet.inetLatency().then((res) => { + data.inetLatency = res; + functionProcessed(); + }); + }); + }); +} + +// -------------------------- +// get all data at once +// -------------------------- +// 2 additional parameters needed +// - srv: comma separated list of services to monitor e.g. "mysql, apache, postgresql" +// - iface: define network interface for which you like to monitor network speed e.g. "eth0" + +function getAllData(srv, iface, callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let data = {}; + + if (iface && util.isFunction(iface) && !callback) { + callback = iface; + iface = ''; + } + + if (srv && util.isFunction(srv) && !iface && !callback) { + callback = srv; + srv = ''; + iface = ''; + } + + getStaticData().then((res) => { + data = res; + getDynamicData(srv, iface).then((res) => { + for (let key in res) { + if ({}.hasOwnProperty.call(res, key)) { + data[key] = res[key]; + } + } + if (callback) { callback(data); } + resolve(data); + }); + }); + }); + }); +} + +function get(valueObject, callback) { + return new Promise((resolve) => { + process.nextTick(() => { + const allPromises = Object.keys(valueObject) + .filter(func => ({}.hasOwnProperty.call(exports, func))) + .map(func => { + const params = valueObject[func].substring(valueObject[func].lastIndexOf('(') + 1, valueObject[func].lastIndexOf(')')); + let funcWithoutParams = func.indexOf(')') >= 0 ? func.split(')')[1].trim() : func; + funcWithoutParams = func.indexOf('|') >= 0 ? func.split('|')[0].trim() : funcWithoutParams; + if (params) { + return exports[funcWithoutParams](params); + } else { + return exports[funcWithoutParams](''); + } + }); + + Promise.all(allPromises).then((data) => { + const result = {}; + let i = 0; + for (let key in valueObject) { + if ({}.hasOwnProperty.call(valueObject, key) && {}.hasOwnProperty.call(exports, key) && data.length > i) { + if (valueObject[key] === '*' || valueObject[key] === 'all') { + result[key] = data[i]; + } else { + let keys = valueObject[key]; + let filter = ''; + let filterParts = []; + // remove params + if (keys.indexOf(')') >= 0) { + keys = keys.split(')')[1].trim(); + } + // extract filter and remove it from keys + if (keys.indexOf('|') >= 0) { + filter = keys.split('|')[1].trim(); + filterParts = filter.split(':'); + + keys = keys.split('|')[0].trim(); + } + keys = keys.replace(/,/g, ' ').replace(/ +/g, ' ').split(' '); + if (data[i]) { + if (Array.isArray(data[i])) { + // result is in an array, go through all elements of array and pick only the right ones + const partialArray = []; + data[i].forEach(element => { + let partialRes = {}; + if (keys.length === 1 && (keys[0] === '*' || keys[0] === 'all')) { + partialRes = element; + } else { + keys.forEach(k => { + if ({}.hasOwnProperty.call(element, k)) { + partialRes[k] = element[k]; + } + }); + } + // if there is a filter, then just take those elements + if (filter && filterParts.length === 2) { + if ({}.hasOwnProperty.call(partialRes, filterParts[0].trim())) { + const val = partialRes[filterParts[0].trim()]; + if (typeof val == 'number') { + if (val === parseFloat(filterParts[1].trim())) { + partialArray.push(partialRes); + } + } else if (typeof val == 'string') { + if (val.toLowerCase() === filterParts[1].trim().toLowerCase()) { + partialArray.push(partialRes); + } + } + } + } else { + partialArray.push(partialRes); + } + + }); + result[key] = partialArray; + } else { + const partialRes = {}; + keys.forEach(k => { + if ({}.hasOwnProperty.call(data[i], k)) { + partialRes[k] = data[i][k]; + } + }); + result[key] = partialRes; + } + } else { + result[key] = {}; + } + } + i++; + } + } + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +function observe(valueObject, interval, callback) { + let _data = null; + + const result = setInterval(() => { + get(valueObject).then((data) => { + if (JSON.stringify(_data) !== JSON.stringify(data)) { + _data = Object.assign({}, data); + callback(data); + } + }); + }, interval); + return result; +} + +// ---------------------------------------------------------------------------------- +// export all libs +// ---------------------------------------------------------------------------------- + +exports.version = version; +exports.system = system.system; +exports.bios = system.bios; +exports.baseboard = system.baseboard; +exports.chassis = system.chassis; + +exports.time = osInfo.time; +exports.osInfo = osInfo.osInfo; +exports.versions = osInfo.versions; +exports.shell = osInfo.shell; +exports.uuid = osInfo.uuid; + +exports.cpu = cpu.cpu; +exports.cpuFlags = cpu.cpuFlags; +exports.cpuCache = cpu.cpuCache; +exports.cpuCurrentSpeed = cpu.cpuCurrentSpeed; +exports.cpuTemperature = cpu.cpuTemperature; +exports.currentLoad = cpu.currentLoad; +exports.fullLoad = cpu.fullLoad; + +exports.mem = memory.mem; +exports.memLayout = memory.memLayout; + +exports.battery = battery; + +exports.graphics = graphics.graphics; + +exports.fsSize = filesystem.fsSize; +exports.fsOpenFiles = filesystem.fsOpenFiles; +exports.blockDevices = filesystem.blockDevices; +exports.fsStats = filesystem.fsStats; +exports.disksIO = filesystem.disksIO; +exports.diskLayout = filesystem.diskLayout; + +exports.networkInterfaceDefault = network.networkInterfaceDefault; +exports.networkGatewayDefault = network.networkGatewayDefault; +exports.networkInterfaces = network.networkInterfaces; +exports.networkStats = network.networkStats; +exports.networkConnections = network.networkConnections; + +exports.wifiNetworks = wifi.wifiNetworks; +exports.wifiInterfaces = wifi.wifiInterfaces; +exports.wifiConnections = wifi.wifiConnections; + +exports.services = processes.services; +exports.processes = processes.processes; +exports.processLoad = processes.processLoad; + +exports.users = users.users; + +exports.inetChecksite = internet.inetChecksite; +exports.inetLatency = internet.inetLatency; + +exports.dockerInfo = docker.dockerInfo; +exports.dockerImages = docker.dockerImages; +exports.dockerContainers = docker.dockerContainers; +exports.dockerContainerStats = docker.dockerContainerStats; +exports.dockerContainerProcesses = docker.dockerContainerProcesses; +exports.dockerVolumes = docker.dockerVolumes; +exports.dockerAll = docker.dockerAll; + +exports.vboxInfo = vbox.vboxInfo; + +exports.printer = printer.printer; + +exports.usb = usb.usb; + +exports.audio = audio.audio; +exports.bluetoothDevices = bluetooth.bluetoothDevices; + +exports.getStaticData = getStaticData; +exports.getDynamicData = getDynamicData; +exports.getAllData = getAllData; +exports.get = get; +exports.observe = observe; + +exports.powerShellStart = util.powerShellStart; +exports.powerShellRelease = util.powerShellRelease; + + +/***/ }), + +/***/ 11456: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// internet.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 12. Internet +// ---------------------------------------------------------------------------------- + +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +// -------------------------- +// check if external site is available + +function inetChecksite(url, callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + url: url, + ok: false, + status: 404, + ms: null + }; + if (typeof url !== 'string') { + if (callback) { callback(result); } + return resolve(result); + } + let urlSanitized = ''; + const s = util.sanitizeShellString(url, true); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + s[i].__proto__.toLowerCase = util.stringToLower; + const sl = s[i].toLowerCase(); + if (sl && sl[0] && !sl[1] && sl[0].length === 1) { + urlSanitized = urlSanitized + sl[0]; + } + } + } + result.url = urlSanitized; + try { + if (urlSanitized && !util.isPrototypePolluted()) { + urlSanitized.__proto__.startsWith = util.stringStartWith; + if (urlSanitized.startsWith('file:') || urlSanitized.startsWith('gopher:') || urlSanitized.startsWith('telnet:') || urlSanitized.startsWith('mailto:') || urlSanitized.startsWith('news:') || urlSanitized.startsWith('nntp:')) { + if (callback) { callback(result); } + return resolve(result); + } + let t = Date.now(); + if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) { + let args = ['-I', '--connect-timeout', '5', '-m', '5']; + args.push(urlSanitized); + let cmd = 'curl'; + util.execSafe(cmd, args).then((stdout) => { + const lines = stdout.split('\n'); + let statusCode = lines[0] && lines[0].indexOf(' ') >= 0 ? parseInt(lines[0].split(' ')[1], 10) : 404; + result.status = statusCode || 404; + result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304); + result.ms = (result.ok ? Date.now() - t : null); + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { // if this is stable, this can be used for all OS types + const http = (urlSanitized.startsWith('https:') ? __nccwpck_require__(95687) : __nccwpck_require__(13685)); + try { + http.get(urlSanitized, (res) => { + const statusCode = res.statusCode; + + result.status = statusCode || 404; + result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304); + + if (statusCode !== 200) { + res.resume(); + result.ms = (result.ok ? Date.now() - t : null); + if (callback) { callback(result); } + resolve(result); + } else { + res.on('data', () => { }); + res.on('end', () => { + result.ms = (result.ok ? Date.now() - t : null); + if (callback) { callback(result); } + resolve(result); + }); + } + }).on('error', () => { + if (callback) { callback(result); } + resolve(result); + }); + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} + +exports.inetChecksite = inetChecksite; + +// -------------------------- +// check inet latency + +function inetLatency(host, callback) { + + // fallback - if only callback is given + if (util.isFunction(host) && !callback) { + callback = host; + host = ''; + } + + host = host || '8.8.8.8'; + + return new Promise((resolve) => { + process.nextTick(() => { + if (typeof host !== 'string') { + if (callback) { callback(null); } + return resolve(null); + } + let hostSanitized = ''; + const s = (util.isPrototypePolluted() ? '8.8.8.8' : util.sanitizeShellString(host, true)).trim(); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (!(s[i] === undefined)) { + s[i].__proto__.toLowerCase = util.stringToLower; + const sl = s[i].toLowerCase(); + if (sl && sl[0] && !sl[1]) { + hostSanitized = hostSanitized + sl[0]; + } + } + } + hostSanitized.__proto__.startsWith = util.stringStartWith; + if (hostSanitized.startsWith('file:') || hostSanitized.startsWith('gopher:') || hostSanitized.startsWith('telnet:') || hostSanitized.startsWith('mailto:') || hostSanitized.startsWith('news:') || hostSanitized.startsWith('nntp:')) { + if (callback) { callback(null); } + return resolve(null); + } + let params; + if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { + if (_linux) { + params = ['-c', '2', '-w', '3', hostSanitized]; + } + if (_freebsd || _openbsd || _netbsd) { + params = ['-c', '2', '-t', '3', hostSanitized]; + } + if (_darwin) { + params = ['-c2', '-t3', hostSanitized]; + } + util.execSafe('ping', params).then((stdout) => { + let result = null; + if (stdout) { + const lines = stdout.split('\n').filter((line) => (line.indexOf('rtt') >= 0 || line.indexOf('round-trip') >= 0 || line.indexOf('avg') >= 0)).join('\n'); + + const line = lines.split('='); + if (line.length > 1) { + const parts = line[1].split('/'); + if (parts.length > 1) { + result = parseFloat(parts[1]); + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + const params = ['-s', '-a', hostSanitized, '56', '2']; + const filt = 'avg'; + util.execSafe('ping', params, { timeout: 3000 }).then((stdout) => { + let result = null; + if (stdout) { + const lines = stdout.split('\n').filter(line => line.indexOf(filt) >= 0).join('\n'); + const line = lines.split('='); + if (line.length > 1) { + const parts = line[1].split('/'); + if (parts.length > 1) { + result = parseFloat(parts[1].replace(',', '.')); + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { + let result = null; + try { + const params = [hostSanitized, '-n', '1']; + util.execSafe('ping', params, util.execOptsWin).then((stdout) => { + if (stdout) { + let lines = stdout.split('\r\n'); + lines.shift(); + lines.forEach(function (line) { + if ((line.toLowerCase().match(/ms/g) || []).length === 3) { + let l = line.replace(/ +/g, ' ').split(' '); + if (l.length > 6) { + result = parseFloat(l[l.length - 1]); + } + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.inetLatency = inetLatency; + + +/***/ }), + +/***/ 46522: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// memory.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 5. Memory +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const util = __nccwpck_require__(19872); +const fs = __nccwpck_require__(57147); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +const OSX_RAM_manufacturers = { + '0x014F': 'Transcend Information', + '0x2C00': 'Micron Technology Inc.', + '0x802C': 'Micron Technology Inc.', + '0x80AD': 'Hynix Semiconductor Inc.', + '0x80CE': 'Samsung Electronics Inc.', + '0xAD00': 'Hynix Semiconductor Inc.', + '0xCE00': 'Samsung Electronics Inc.', + '0x02FE': 'Elpida', + '0x5105': 'Qimonda AG i. In.', + '0x8551': 'Qimonda AG i. In.', + '0x859B': 'Crucial', + '0x04CD': 'G-Skill' +}; + +const LINUX_RAM_manufacturers = { + '017A': 'Apacer', + '0198': 'HyperX', + '029E': 'Corsair', + '04CB': 'A-DATA', + '04CD': 'G-Skill', + '059B': 'Crucial', + '00CE': 'Samsung', + '1315': 'Crucial', + '014F': 'Transcend Information', + '2C00': 'Micron Technology Inc.', + '802C': 'Micron Technology Inc.', + '80AD': 'Hynix Semiconductor Inc.', + '80CE': 'Samsung Electronics Inc.', + 'AD00': 'Hynix Semiconductor Inc.', + 'CE00': 'Samsung Electronics Inc.', + '02FE': 'Elpida', + '5105': 'Qimonda AG i. In.', + '8551': 'Qimonda AG i. In.', + '859B': 'Crucial' +}; + +// _______________________________________________________________________________________ +// | R A M | H D | +// |______________________|_________________________| | | +// | active buffers/cache | | | +// |________________________________________________|___________|_________|______________| +// | used free | used free | +// |____________________________________________________________|________________________| +// | total | swap | +// |____________________________________________________________|________________________| + +// free (older versions) +// ---------------------------------- +// # free +// total used free shared buffers cached +// Mem: 16038 (1) 15653 (2) 384 (3) 0 (4) 236 (5) 14788 (6) +// -/+ buffers/cache: 628 (7) 15409 (8) +// Swap: 16371 83 16288 +// +// |------------------------------------------------------------| +// | R A M | +// |______________________|_____________________________________| +// | active (2-(5+6) = 7) | available (3+5+6 = 8) | +// |______________________|_________________________|___________| +// | active | buffers/cache (5+6) | | +// |________________________________________________|___________| +// | used (2) | free (3) | +// |____________________________________________________________| +// | total (1) | +// |____________________________________________________________| + +// +// free (since free von procps-ng 3.3.10) +// ---------------------------------- +// # free +// total used free shared buffers/cache available +// Mem: 16038 (1) 628 (2) 386 (3) 0 (4) 15024 (5) 14788 (6) +// Swap: 16371 83 16288 +// +// |------------------------------------------------------------| +// | R A M | +// |______________________|_____________________________________| +// | | available (6) estimated | +// |______________________|_________________________|___________| +// | active (2) | buffers/cache (5) | free (3) | +// |________________________________________________|___________| +// | total (1) | +// |____________________________________________________________| +// +// Reference: http://www.software-architect.net/blog/article/date/2015/06/12/-826c6e5052.html + +// /procs/meminfo - sample (all in kB) +// +// MemTotal: 32806380 kB +// MemFree: 17977744 kB +// MemAvailable: 19768972 kB +// Buffers: 517028 kB +// Cached: 2161876 kB +// SwapCached: 456 kB +// Active: 12081176 kB +// Inactive: 2164616 kB +// Active(anon): 10832884 kB +// Inactive(anon): 1477272 kB +// Active(file): 1248292 kB +// Inactive(file): 687344 kB +// Unevictable: 0 kB +// Mlocked: 0 kB +// SwapTotal: 16768892 kB +// SwapFree: 16768304 kB +// Dirty: 268 kB +// Writeback: 0 kB +// AnonPages: 11568832 kB +// Mapped: 719992 kB +// Shmem: 743272 kB +// Slab: 335716 kB +// SReclaimable: 256364 kB +// SUnreclaim: 79352 kB + +function mem(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + total: os.totalmem(), + free: os.freemem(), + used: os.totalmem() - os.freemem(), + + active: os.totalmem() - os.freemem(), // temporarily (fallback) + available: os.freemem(), // temporarily (fallback) + buffers: 0, + cached: 0, + slab: 0, + buffcache: 0, + + swaptotal: 0, + swapused: 0, + swapfree: 0, + writeback: null, + dirty: null + }; + + if (_linux) { + try { + fs.readFile('/proc/meminfo', function (error, stdout) { + if (!error) { + const lines = stdout.toString().split('\n'); + result.total = parseInt(util.getValue(lines, 'memtotal'), 10); + result.total = result.total ? result.total * 1024 : os.totalmem(); + result.free = parseInt(util.getValue(lines, 'memfree'), 10); + result.free = result.free ? result.free * 1024 : os.freemem(); + result.used = result.total - result.free; + + result.buffers = parseInt(util.getValue(lines, 'buffers'), 10); + result.buffers = result.buffers ? result.buffers * 1024 : 0; + result.cached = parseInt(util.getValue(lines, 'cached'), 10); + result.cached = result.cached ? result.cached * 1024 : 0; + result.slab = parseInt(util.getValue(lines, 'slab'), 10); + result.slab = result.slab ? result.slab * 1024 : 0; + result.buffcache = result.buffers + result.cached + result.slab; + + let available = parseInt(util.getValue(lines, 'memavailable'), 10); + result.available = available ? available * 1024 : result.free + result.buffcache; + result.active = result.total - result.available; + + result.swaptotal = parseInt(util.getValue(lines, 'swaptotal'), 10); + result.swaptotal = result.swaptotal ? result.swaptotal * 1024 : 0; + result.swapfree = parseInt(util.getValue(lines, 'swapfree'), 10); + result.swapfree = result.swapfree ? result.swapfree * 1024 : 0; + result.swapused = result.swaptotal - result.swapfree; + result.writeback = parseInt(util.getValue(lines, 'writeback'), 10); + result.writeback = result.writeback ? result.writeback * 1024 : 0; + result.dirty = parseInt(util.getValue(lines, 'dirty'), 10); + result.dirty = result.dirty ? result.dirty * 1024 : 0; + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + try { + exec('/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10); + const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize; + const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize; + + result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10); + if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); } + result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize; + result.buffcache = inactive + cache; + result.available = result.buffcache + result.free; + result.active = result.total - result.free - result.buffcache; + + result.swaptotal = 0; + result.swapfree = 0; + result.swapused = 0; + + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_darwin) { + let pageSize = 4096; + try { + let sysPpageSize = util.toInt(execSync('sysctl -n vm.pagesize').toString()); + pageSize = sysPpageSize || pageSize; + } catch (e) { + util.noop(); + } + try { + exec('vm_stat 2>/dev/null | grep "Pages active"', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + + result.active = parseInt(lines[0].split(':')[1], 10) * pageSize; + result.buffcache = result.used - result.active; + result.available = result.free + result.buffcache; + } + exec('sysctl -n vm.swapusage 2>/dev/null', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0) { + let firstline = lines[0].replace(/,/g, '.').replace(/M/g, ''); + let lineArray = firstline.trim().split(' '); + lineArray.forEach(line => { + if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; } + if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; } + if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; } + }); + } + } + if (callback) { callback(result); } + resolve(result); + }); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + let swaptotal = 0; + let swapused = 0; + try { + util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => { + if (!error) { + let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); + lines.forEach(function (line) { + if (line !== '') { + line = line.trim().split(/\s\s+/); + swaptotal = swaptotal + (parseInt(line[0], 10) || 0); + swapused = swapused + (parseInt(line[1], 10) || 0); + } + }); + } + result.swaptotal = swaptotal * 1024 * 1024; + result.swapused = swapused * 1024 * 1024; + result.swapfree = result.swaptotal - result.swapused; + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.mem = mem; + +function memLayout(callback) { + + function getManufacturerDarwin(manId) { + if ({}.hasOwnProperty.call(OSX_RAM_manufacturers, manId)) { + return (OSX_RAM_manufacturers[manId]); + } + return manId; + } + + function getManufacturerLinux(manId) { + const manIdSearch = manId.replace('0x', '').toUpperCase(); + if (manIdSearch.length === 4 && {}.hasOwnProperty.call(LINUX_RAM_manufacturers, manIdSearch)) { + return (LINUX_RAM_manufacturers[manIdSearch]); + } + return manId; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = []; + + if (_linux || _freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) { + if (!error) { + let devices = stdout.toString().split('Memory Device'); + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\n'); + const sizeString = util.getValue(lines, 'Size'); + const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024; + let bank = util.getValue(lines, 'Bank Locator'); + if (bank.toLowerCase().indexOf('bad') >= 0) { + bank = ''; + } + if (parseInt(util.getValue(lines, 'Size'), 10) > 0) { + const totalWidth = util.toInt(util.getValue(lines, 'Total Width')); + const dataWidth = util.toInt(util.getValue(lines, 'Data Width')); + result.push({ + size, + bank, + type: util.getValue(lines, 'Type:'), + ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false, + clockSpeed: (util.getValue(lines, 'Configured Clock Speed:') ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10) : (util.getValue(lines, 'Speed:') ? parseInt(util.getValue(lines, 'Speed:'), 10) : null)), + formFactor: util.getValue(lines, 'Form Factor:'), + manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')), + partNum: util.getValue(lines, 'Part Number:'), + serialNum: util.getValue(lines, 'Serial Number:'), + voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null, + voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null, + voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null, + }); + } else { + result.push({ + size: 0, + bank, + type: 'Empty', + ecc: null, + clockSpeed: 0, + formFactor: util.getValue(lines, 'Form Factor:'), + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + } + }); + } + if (!result.length) { + result.push({ + size: os.totalmem(), + bank: '', + type: '', + ecc: null, + clockSpeed: 0, + formFactor: '', + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + + // Try Raspberry PI + try { + let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux); + let lines = stdout.toString().split('\n'); + let model = util.getValue(lines, 'hardware', ':', true).toUpperCase(); + let version = util.getValue(lines, 'revision', ':', true).toLowerCase(); + + if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') { + + const clockSpeed = { + '0': 400, + '1': 450, + '2': 450, + '3': 3200 + }; + result[0].type = 'LPDDR2'; + result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type; + result[0].ecc = false; + result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400; + result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed; + result[0].formFactor = 'SoC'; + + stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux); + lines = stdout.toString().split('\n'); + let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0; + if (freq) { + result[0].clockSpeed = freq; + } + + stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux); + lines = stdout.toString().split('\n'); + let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0; + if (voltage) { + result[0].voltageConfigured = voltage; + result[0].voltageMin = voltage; + result[0].voltageMax = voltage; + } + } + } catch (e) { + util.noop(); + } + + } + if (callback) { callback(result); } + resolve(result); + }); + } + + if (_darwin) { + exec('system_profiler SPMemoryDataType', function (error, stdout) { + if (!error) { + const allLines = stdout.toString().split('\n'); + const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase(); + let devices = stdout.toString().split(' BANK '); + let hasBank = true; + if (devices.length === 1) { + devices = stdout.toString().split(' DIMM'); + hasBank = false; + } + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\n'); + const bank = (hasBank ? 'BANK ' : 'DIMM') + lines[0].trim().split('/')[0]; + const size = parseInt(util.getValue(lines, ' Size')); + if (size) { + result.push({ + size: size * 1024 * 1024 * 1024, + bank: bank, + type: util.getValue(lines, ' Type:'), + ecc: eccStatus ? eccStatus === 'enabled' : null, + clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10), + formFactor: '', + manufacturer: getManufacturerDarwin(util.getValue(lines, ' Manufacturer:')), + partNum: util.getValue(lines, ' Part Number:'), + serialNum: util.getValue(lines, ' Serial Number:'), + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + } else { + result.push({ + size: 0, + bank: bank, + type: 'Empty', + ecc: null, + clockSpeed: 0, + formFactor: '', + manufacturer: '', + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + } + }); + } + if (!result.length) { + const lines = stdout.toString().split('\n'); + const size = parseInt(util.getValue(lines, ' Memory:')); + const type = util.getValue(lines, ' Type:'); + if (size && type) { + result.push({ + size: size * 1024 * 1024 * 1024, + bank: '0', + type, + ecc: false, + clockSpeed: 0, + formFactor: '', + manufacturer: 'Apple', + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + // https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0a.pdf + const memoryTypes = 'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4|Logical non-volatile device|HBM|HBM2|DDR5|LPDDR5'.split('|'); + const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|'); + + try { + util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl').then((stdout, error) => { + if (!error) { + let devices = stdout.toString().split(/\n\s*\n/); + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':')); + const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':')); + const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0; + const tag = util.getValue(lines, 'Tag', ':'); + const tagInt = util.splitByNumber(tag); + if (size) { + result.push({ + size, + bank: util.getValue(lines, 'BankLabel', ':') + (tagInt[1] ? '/' + tagInt[1] : ''), // BankLabel + type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)], + ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false, + clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0, + formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0], + manufacturer: util.getValue(lines, 'Manufacturer', ':'), + partNum: util.getValue(lines, 'PartNumber', ':'), + serialNum: util.getValue(lines, 'SerialNumber', ':'), + voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0, + voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0, + voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0, + }); + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.memLayout = memLayout; + + + +/***/ }), + +/***/ 66486: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// network.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 9. Network +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const fs = __nccwpck_require__(57147); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _network = {}; +let _default_iface = ''; +let _ifaces = {}; +let _dhcpNics = []; +let _networkInterfaces = []; +let _mac = {}; +let pathToIp; + +function getDefaultNetworkInterface() { + + let ifacename = ''; + let ifacenameFirst = ''; + try { + let ifaces = os.networkInterfaces(); + + let scopeid = 9999; + + // fallback - "first" external interface (sorted by scopeid) + for (let dev in ifaces) { + if ({}.hasOwnProperty.call(ifaces, dev)) { + ifaces[dev].forEach(function (details) { + if (details && details.internal === false) { + ifacenameFirst = ifacenameFirst || dev; // fallback if no scopeid + if (details.scopeid && details.scopeid < scopeid) { + ifacename = dev; + scopeid = details.scopeid; + } + } + }); + } + } + ifacename = ifacename || ifacenameFirst || ''; + + if (_windows) { + // https://www.inetdaemon.com/tutorials/internet/ip/routing/default_route.shtml + let defaultIp = ''; + const cmd = 'netstat -r'; + const result = execSync(cmd, util.execOptsWin); + const lines = result.toString().split(os.EOL); + lines.forEach(line => { + line = line.replace(/\s+/g, ' ').trim(); + if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) { + const parts = line.split(' '); + if (parts.length >= 5) { + defaultIp = parts[parts.length - 2]; + } + } + }); + if (defaultIp) { + for (let dev in ifaces) { + if ({}.hasOwnProperty.call(ifaces, dev)) { + ifaces[dev].forEach(function (details) { + if (details && details.address && details.address === defaultIp) { + ifacename = dev; + } + }); + } + } + } + } + if (_linux) { + let cmd = 'ip route 2> /dev/null | grep default'; + let result = execSync(cmd, util.execOptsLinux); + let parts = result.toString().split('\n')[0].split(/\s+/); + if (parts[0] === 'none' && parts[5]) { + ifacename = parts[5]; + } else if (parts[4]) { + ifacename = parts[4]; + } + + if (ifacename.indexOf(':') > -1) { + ifacename = ifacename.split(':')[1].trim(); + } + } + if (_darwin || _freebsd || _openbsd || _netbsd || _sunos) { + let cmd = ''; + if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; } + if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; } + if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; } + let result = execSync(cmd); + ifacename = result.toString().split('\n')[0]; + if (ifacename.indexOf(':') > -1) { + ifacename = ifacename.split(':')[1].trim(); + } + } + } catch (e) { + util.noop(); + } + if (ifacename) { _default_iface = ifacename; } + return _default_iface; +} + +exports.getDefaultNetworkInterface = getDefaultNetworkInterface; + +function getMacAddresses() { + let iface = ''; + let mac = ''; + let result = {}; + if (_linux || _freebsd || _openbsd || _netbsd) { + if (typeof pathToIp === 'undefined') { + try { + const lines = execSync('which ip', util.execOptsLinux).toString().split('\n'); + if (lines.length && lines[0].indexOf(':') === -1 && lines[0].indexOf('/') === 0) { + pathToIp = lines[0]; + } else { + pathToIp = ''; + } + } catch (e) { + pathToIp = ''; + } + } + try { + const cmd = 'export LC_ALL=C; ' + ((pathToIp) ? pathToIp + ' link show up' : '/sbin/ifconfig') + '; unset LC_ALL'; + let res = execSync(cmd, util.execOptsLinux); + const lines = res.toString().split('\n'); + for (let i = 0; i < lines.length; i++) { + if (lines[i] && lines[i][0] !== ' ') { + if (pathToIp) { + let nextline = lines[i + 1].trim().split(' '); + if (nextline[0] === 'link/ether') { + iface = lines[i].split(' ')[1]; + iface = iface.slice(0, iface.length - 1); + mac = nextline[1]; + } + } else { + iface = lines[i].split(' ')[0]; + mac = lines[i].split('HWaddr ')[1]; + } + + if (iface && mac) { + result[iface] = mac.trim(); + iface = ''; + mac = ''; + } + } + } + } catch (e) { + util.noop(); + } + } + if (_darwin) { + try { + const cmd = '/sbin/ifconfig'; + let res = execSync(cmd); + const lines = res.toString().split('\n'); + for (let i = 0; i < lines.length; i++) { + if (lines[i] && lines[i][0] !== '\t' && lines[i].indexOf(':') > 0) { + iface = lines[i].split(':')[0]; + } else if (lines[i].indexOf('\tether ') === 0) { + mac = lines[i].split('\tether ')[1]; + if (iface && mac) { + result[iface] = mac.trim(); + iface = ''; + mac = ''; + } + } + } + } catch (e) { + util.noop(); + } + } + return result; +} + +function networkInterfaceDefault(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = getDefaultNetworkInterface(); + if (callback) { callback(result); } + resolve(result); + }); + }); +} + +exports.networkInterfaceDefault = networkInterfaceDefault; + +// -------------------------- +// NET - interfaces + +function parseLinesWindowsNics(sections, nconfigsections) { + let nics = []; + for (let i in sections) { + if ({}.hasOwnProperty.call(sections, i)) { + + if (sections[i].trim() !== '') { + + let lines = sections[i].trim().split('\r\n'); + let linesNicConfig = nconfigsections && nconfigsections[i] ? nconfigsections[i].trim().split('\r\n') : []; + let netEnabled = util.getValue(lines, 'NetEnabled', ':'); + let adapterType = util.getValue(lines, 'AdapterTypeID', ':') === '9' ? 'wireless' : 'wired'; + let ifacename = util.getValue(lines, 'Name', ':').replace(/\]/g, ')').replace(/\[/g, '('); + let iface = util.getValue(lines, 'NetConnectionID', ':').replace(/\]/g, ')').replace(/\[/g, '('); + if (ifacename.toLowerCase().indexOf('wi-fi') >= 0 || ifacename.toLowerCase().indexOf('wireless') >= 0) { + adapterType = 'wireless'; + } + if (netEnabled !== '') { + const speed = parseInt(util.getValue(lines, 'speed', ':').trim(), 10) / 1000000; + nics.push({ + mac: util.getValue(lines, 'MACAddress', ':').toLowerCase(), + dhcp: util.getValue(linesNicConfig, 'dhcpEnabled', ':').toLowerCase() === 'true', + name: ifacename, + iface, + netEnabled: netEnabled === 'TRUE', + speed: isNaN(speed) ? null : speed, + operstate: util.getValue(lines, 'NetConnectionStatus', ':') === '2' ? 'up' : 'down', + type: adapterType + }); + } + } + } + } + return nics; +} + +function getWindowsNics() { + return new Promise((resolve) => { + process.nextTick(() => { + let cmd = 'Get-CimInstance Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';'; + cmd += 'Get-CimInstance Win32_NetworkAdapterConfiguration | fl DHCPEnabled' + ''; + try { + util.powerShell(cmd).then((data) => { + data = data.split('#-#-#-#'); + const nsections = (data[0] || '').split(/\n\s*\n/); + const nconfigsections = (data[1] || '').split(/\n\s*\n/); + resolve(parseLinesWindowsNics(nsections, nconfigsections)); + }); + } catch (e) { + resolve([]); + } + }); + }); +} + +function getWindowsDNSsuffixes() { + + let iface = {}; + + let dnsSuffixes = { + primaryDNS: '', + exitCode: 0, + ifaces: [], + }; + + try { + const ipconfig = execSync('ipconfig /all', util.execOptsWin); + const ipconfigArray = ipconfig.split('\r\n\r\n'); + + ipconfigArray.forEach((element, index) => { + + if (index == 1) { + const longPrimaryDNS = element.split('\r\n').filter((element) => { + return element.toUpperCase().includes('DNS'); + }); + const primaryDNS = longPrimaryDNS[0].substring(longPrimaryDNS[0].lastIndexOf(':') + 1); + dnsSuffixes.primaryDNS = primaryDNS.trim(); + if (!dnsSuffixes.primaryDNS) { dnsSuffixes.primaryDNS = 'Not defined'; } + } + if (index > 1) { + if (index % 2 == 0) { + const name = element.substring(element.lastIndexOf(' ') + 1).replace(':', ''); + iface.name = name; + } else { + const connectionSpecificDNS = element.split('\r\n').filter((element) => { + return element.toUpperCase().includes('DNS'); + }); + const dnsSuffix = connectionSpecificDNS[0].substring(connectionSpecificDNS[0].lastIndexOf(':') + 1); + iface.dnsSuffix = dnsSuffix.trim(); + dnsSuffixes.ifaces.push(iface); + iface = {}; + } + } + }); + + return dnsSuffixes; + } catch (error) { + return { + primaryDNS: '', + exitCode: 0, + ifaces: [], + }; + } +} + +function getWindowsIfaceDNSsuffix(ifaces, ifacename) { + let dnsSuffix = ''; + // Adding (.) to ensure ifacename compatibility when duplicated iface-names + const interfaceName = ifacename + '.'; + try { + const connectionDnsSuffix = ifaces.filter((iface) => { + return interfaceName.includes(iface.name + '.'); + }).map((iface) => iface.dnsSuffix); + if (connectionDnsSuffix[0]) { + dnsSuffix = connectionDnsSuffix[0]; + } + if (!dnsSuffix) { dnsSuffix = ''; } + return dnsSuffix; + } catch (error) { + return 'Unknown'; + } +} + +function getWindowsWiredProfilesInformation() { + try { + const result = execSync('netsh lan show profiles', util.execOptsWin); + const profileList = result.split('\r\nProfile on interface'); + return profileList; + } catch (error) { + if (error.status === 1 && error.stdout.includes('AutoConfig')) { + return 'Disabled'; + } + return []; + } +} + +function getWindowsWirelessIfaceSSID(interfaceName) { + try { + const result = execSync(`netsh wlan show interface name="${interfaceName}" | findstr "SSID"`, util.execOptsWin); + const SSID = result.split('\r\n').shift(); + const parseSSID = SSID.split(':').pop(); + return parseSSID; + } catch (error) { + return 'Unknown'; + } +} +function getWindowsIEEE8021x(connectionType, iface, ifaces) { + let i8021x = { + state: 'Unknown', + protocol: 'Unknown', + }; + + if (ifaces === 'Disabled') { + i8021x.state = 'Disabled'; + i8021x.protocol = 'Not defined'; + return i8021x; + } + + if (connectionType == 'wired' && ifaces.length > 0) { + try { + // Get 802.1x information by interface name + const iface8021xInfo = ifaces.find((element) => { + return element.includes(iface + '\r\n'); + }); + const arrayIface8021xInfo = iface8021xInfo.split('\r\n'); + const state8021x = arrayIface8021xInfo.find((element) => { + return element.includes('802.1x'); + }); + + if (state8021x.includes('Disabled')) { + i8021x.state = 'Disabled'; + i8021x.protocol = 'Not defined'; + } else if (state8021x.includes('Enabled')) { + const protocol8021x = arrayIface8021xInfo.find((element) => { + return element.includes('EAP'); + }); + i8021x.protocol = protocol8021x.split(':').pop(); + i8021x.state = 'Enabled'; + } + } catch (error) { + return i8021x; + } + } else if (connectionType == 'wireless') { + + let i8021xState = ''; + let i8021xProtocol = ''; + + + + try { + const SSID = getWindowsWirelessIfaceSSID(iface); + if (SSID !== 'Unknown') { + i8021xState = execSync(`netsh wlan show profiles "${SSID}" | findstr "802.1X"`, util.execOptsWin); + i8021xProtocol = execSync(`netsh wlan show profiles "${SSID}" | findstr "EAP"`, util.execOptsWin); + } + + if (i8021xState.includes(':') && i8021xProtocol.includes(':')) { + i8021x.state = i8021xState.split(':').pop(); + i8021x.protocol = i8021xProtocol.split(':').pop(); + } + } catch (error) { + if (error.status === 1 && error.stdout.includes('AutoConfig')) { + i8021x.state = 'Disabled'; + i8021x.protocol = 'Not defined'; + } + return i8021x; + } + } + + return i8021x; +} + +function splitSectionsNics(lines) { + const result = []; + let section = []; + lines.forEach(function (line) { + if (!line.startsWith('\t') && !line.startsWith(' ')) { + if (section.length) { + result.push(section); + section = []; + } + } + section.push(line); + }); + if (section.length) { + result.push(section); + } + return result; +} + +function parseLinesDarwinNics(sections) { + let nics = []; + sections.forEach(section => { + let nic = { + iface: '', + mtu: null, + mac: '', + ip6: '', + ip4: '', + speed: null, + type: '', + operstate: '', + duplex: '', + internal: false + }; + const first = section[0]; + nic.iface = first.split(':')[0].trim(); + let parts = first.split('> mtu'); + nic.mtu = parts.length > 1 ? parseInt(parts[1], 10) : null; + if (isNaN(nic.mtu)) { + nic.mtu = null; + } + nic.internal = parts[0].toLowerCase().indexOf('loopback') > -1; + section.forEach(line => { + if (line.trim().startsWith('ether ')) { + nic.mac = line.split('ether ')[1].toLowerCase().trim(); + } + if (line.trim().startsWith('inet6 ') && !nic.ip6) { + nic.ip6 = line.split('inet6 ')[1].toLowerCase().split('%')[0].split(' ')[0]; + } + if (line.trim().startsWith('inet ') && !nic.ip4) { + nic.ip4 = line.split('inet ')[1].toLowerCase().split(' ')[0]; + } + }); + let speed = util.getValue(section, 'link rate'); + nic.speed = speed ? parseFloat(speed) : null; + if (nic.speed === null) { + speed = util.getValue(section, 'uplink rate'); + nic.speed = speed ? parseFloat(speed) : null; + if (nic.speed !== null && speed.toLowerCase().indexOf('gbps') >= 0) { + nic.speed = nic.speed * 1000; + } + } else { + if (speed.toLowerCase().indexOf('gbps') >= 0) { + nic.speed = nic.speed * 1000; + } + } + nic.type = util.getValue(section, 'type').toLowerCase().indexOf('wi-fi') > -1 ? 'wireless' : 'wired'; + const operstate = util.getValue(section, 'status').toLowerCase(); + nic.operstate = (operstate === 'active' ? 'up' : (operstate === 'inactive' ? 'down' : 'unknown')); + nic.duplex = util.getValue(section, 'media').toLowerCase().indexOf('half-duplex') > -1 ? 'half' : 'full'; + if (nic.ip6 || nic.ip4 || nic.mac) { + nics.push(nic); + } + }); + return nics; +} + +function getDarwinNics() { + const cmd = '/sbin/ifconfig -v'; + try { + const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n'); + const nsections = splitSectionsNics(lines); + return (parseLinesDarwinNics(nsections)); + } catch (e) { + return []; + } +} + +function getLinuxIfaceConnectionName(interfaceName) { + const cmd = `nmcli device status 2>/dev/null | grep ${interfaceName}`; + + try { + const result = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = result.replace(/\s+/g, ' ').trim(); + const connectionNameLines = resultFormat.split(' ').slice(3); + const connectionName = connectionNameLines.join(' '); + return connectionName != '--' ? connectionName : ''; + } catch (e) { + return ''; + } +} + +function checkLinuxDCHPInterfaces(file) { + let result = []; + try { + let cmd = `cat ${file} 2> /dev/null | grep 'iface\\|source'`; + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + + lines.forEach(line => { + const parts = line.replace(/\s+/g, ' ').trim().split(' '); + if (parts.length >= 4) { + if (line.toLowerCase().indexOf(' inet ') >= 0 && line.toLowerCase().indexOf('dhcp') >= 0) { + result.push(parts[1]); + } + } + if (line.toLowerCase().includes('source')) { + let file = line.split(' ')[1]; + result = result.concat(checkLinuxDCHPInterfaces(file)); + } + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getLinuxDHCPNics() { + // alternate methods getting interfaces using DHCP + let cmd = 'ip a 2> /dev/null'; + let result = []; + try { + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const nsections = splitSectionsNics(lines); + result = (parseLinuxDHCPNics(nsections)); + } catch (e) { + util.noop(); + } + try { + result = checkLinuxDCHPInterfaces('/etc/network/interfaces'); + } catch (e) { + util.noop(); + } + return result; +} + +function parseLinuxDHCPNics(sections) { + const result = []; + if (sections && sections.length) { + sections.forEach(lines => { + if (lines && lines.length) { + const parts = lines[0].split(':'); + if (parts.length > 2) { + for (let line of lines) { + if (line.indexOf(' inet ') >= 0 && line.indexOf(' dynamic ') >= 0) { + const parts2 = line.split(' '); + const nic = parts2[parts2.length - 1].trim(); + result.push(nic); + break; + } + } + } + } + }); + } + return result; +} + +function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) { + let result = false; + if (connectionName) { + const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.method;`; + try { + const lines = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = lines.replace(/\s+/g, ' ').trim(); + + let dhcStatus = resultFormat.split(' ').slice(1).toString(); + switch (dhcStatus) { + case 'auto': + result = true; + break; + + default: + result = false; + break; + } + return result; + } catch (e) { + return (DHCPNics.indexOf(iface) >= 0); + } + } else { + return (DHCPNics.indexOf(iface) >= 0); + } +} + +function getDarwinIfaceDHCPstatus(iface) { + let result = false; + const cmd = `ipconfig getpacket "${iface}" 2>/dev/null | grep lease_time;`; + try { + const lines = execSync(cmd).toString().split('\n'); + if (lines.length && lines[0].startsWith('lease_time')) { + result = true; + } + } catch (e) { + util.noop(); + } + return result; +} + +function getLinuxIfaceDNSsuffix(connectionName) { + if (connectionName) { + const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.dns-search;`; + try { + const result = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = result.replace(/\s+/g, ' ').trim(); + const dnsSuffix = resultFormat.split(' ').slice(1).toString(); + return dnsSuffix == '--' ? 'Not defined' : dnsSuffix; + } catch (e) { + return 'Unknown'; + } + } else { + return 'Unknown'; + } +} + +function getLinuxIfaceIEEE8021xAuth(connectionName) { + if (connectionName) { + const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep 802-1x.eap;`; + try { + const result = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = result.replace(/\s+/g, ' ').trim(); + const authenticationProtocol = resultFormat.split(' ').slice(1).toString(); + + + return authenticationProtocol == '--' ? '' : authenticationProtocol; + } catch (e) { + return 'Not defined'; + } + } else { + return 'Not defined'; + } +} + +function getLinuxIfaceIEEE8021xState(authenticationProtocol) { + if (authenticationProtocol) { + if (authenticationProtocol == 'Not defined') { + return 'Disabled'; + } + return 'Enabled'; + } else { + return 'Unknown'; + } +} + +function testVirtualNic(iface, ifaceName, mac) { + const virtualMacs = ['00:00:00:00:00:00', '00:03:FF', '00:05:69', '00:0C:29', '00:0F:4B', '00:13:07', '00:13:BE', '00:15:5d', '00:16:3E', '00:1C:42', '00:21:F6', '00:24:0B', '00:50:56', '00:A0:B1', '00:E0:C8', '08:00:27', '0A:00:27', '18:92:2C', '16:DF:49', '3C:F3:92', '54:52:00', 'FC:15:97']; + if (mac) { + return virtualMacs.filter(item => { return mac.toUpperCase().toUpperCase().startsWith(item.substring(0, mac.length)); }).length > 0 || + iface.toLowerCase().indexOf(' virtual ') > -1 || + ifaceName.toLowerCase().indexOf(' virtual ') > -1 || + iface.toLowerCase().indexOf('vethernet ') > -1 || + ifaceName.toLowerCase().indexOf('vethernet ') > -1 || + iface.toLowerCase().startsWith('veth') || + ifaceName.toLowerCase().startsWith('veth') || + iface.toLowerCase().startsWith('vboxnet') || + ifaceName.toLowerCase().startsWith('vboxnet'); + } else { return false; } +} + +function networkInterfaces(callback, rescan, defaultString) { + + if (typeof callback === 'string') { + defaultString = callback; + rescan = true; + callback = null; + } + + if (typeof callback === 'boolean') { + rescan = callback; + callback = null; + defaultString = ''; + } + if (typeof rescan === 'undefined') { + rescan = true; + } + defaultString = defaultString || ''; + defaultString = '' + defaultString; + + return new Promise((resolve) => { + process.nextTick(() => { + + let ifaces = os.networkInterfaces(); + + let result = []; + let nics = []; + let dnsSuffixes = []; + let nics8021xInfo = []; + // seperate handling in OSX + if (_darwin || _freebsd || _openbsd || _netbsd) { + if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) { + // no changes - just return object + result = _networkInterfaces; + + if (callback) { callback(result); } + resolve(result); + } else { + const defaultInterface = getDefaultNetworkInterface(); + _ifaces = JSON.parse(JSON.stringify(ifaces)); + + nics = getDarwinNics(); + + + nics.forEach(nic => { + + if ({}.hasOwnProperty.call(ifaces, nic.iface)) { + ifaces[nic.iface].forEach(function (details) { + if (details.family === 'IPv4' || details.family === 4) { + nic.ip4subnet = details.netmask; + } + if (details.family === 'IPv6' || details.family === 6) { + nic.ip6subnet = details.netmask; + } + }); + } + + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(nic.iface); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + result.push({ + iface: nic.iface, + ifaceName: nic.iface, + default: nic.iface === defaultInterface, + ip4: nic.ip4, + ip4subnet: nic.ip4subnet || '', + ip6: nic.ip6, + ip6subnet: nic.ip6subnet || '', + mac: nic.mac, + internal: nic.internal, + virtual: nic.internal ? false : testVirtualNic(nic.iface, nic.iface, nic.mac), + operstate: nic.operstate, + type: nic.type, + duplex: nic.duplex, + mtu: nic.mtu, + speed: nic.speed, + dhcp: getDarwinIfaceDHCPstatus(ifaceSanitized), + dnsSuffix: '', + ieee8021xAuth: '', + ieee8021xState: '', + carrierChanges: 0 + }); + }); + _networkInterfaces = result; + if (defaultString.toLowerCase().indexOf('default') >= 0) { + result = result.filter(item => item.default); + if (result.length > 0) { + result = result[0]; + } else { + result = []; + } + } + if (callback) { callback(result); } + resolve(result); + } + } + if (_linux) { + if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) { + // no changes - just return object + result = _networkInterfaces; + + if (callback) { callback(result); } + resolve(result); + } else { + _ifaces = JSON.parse(JSON.stringify(ifaces)); + _dhcpNics = getLinuxDHCPNics(); + const defaultInterface = getDefaultNetworkInterface(); + for (let dev in ifaces) { + let ip4 = ''; + let ip4subnet = ''; + let ip6 = ''; + let ip6subnet = ''; + let mac = ''; + let duplex = ''; + let mtu = ''; + let speed = null; + let carrierChanges = 0; + let dhcp = false; + let dnsSuffix = ''; + let ieee8021xAuth = ''; + let ieee8021xState = ''; + let type = ''; + + if ({}.hasOwnProperty.call(ifaces, dev)) { + let ifaceName = dev; + ifaces[dev].forEach(function (details) { + if (details.family === 'IPv4' || details.family === 4) { + ip4 = details.address; + ip4subnet = details.netmask; + } + if (details.family === 'IPv6' || details.family === 6) { + if (!ip6 || ip6.match(/^fe80::/i)) { + ip6 = details.address; + ip6subnet = details.netmask; + } + } + mac = details.mac; + // fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2) + const nodeMainVersion = parseInt(process.versions.node.split('.'), 10); + if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && (!details.internal) && nodeMainVersion >= 8 && nodeMainVersion <= 11) { + if (Object.keys(_mac).length === 0) { + _mac = getMacAddresses(); + } + mac = _mac[dev] || ''; + } + }); + let iface = dev.split(':')[0].trim().toLowerCase(); + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + const cmd = `echo -n "addr_assign_type: "; cat /sys/class/net/${ifaceSanitized}/addr_assign_type 2>/dev/null; echo; + echo -n "address: "; cat /sys/class/net/${ifaceSanitized}/address 2>/dev/null; echo; + echo -n "addr_len: "; cat /sys/class/net/${ifaceSanitized}/addr_len 2>/dev/null; echo; + echo -n "broadcast: "; cat /sys/class/net/${ifaceSanitized}/broadcast 2>/dev/null; echo; + echo -n "carrier: "; cat /sys/class/net/${ifaceSanitized}/carrier 2>/dev/null; echo; + echo -n "carrier_changes: "; cat /sys/class/net/${ifaceSanitized}/carrier_changes 2>/dev/null; echo; + echo -n "dev_id: "; cat /sys/class/net/${ifaceSanitized}/dev_id 2>/dev/null; echo; + echo -n "dev_port: "; cat /sys/class/net/${ifaceSanitized}/dev_port 2>/dev/null; echo; + echo -n "dormant: "; cat /sys/class/net/${ifaceSanitized}/dormant 2>/dev/null; echo; + echo -n "duplex: "; cat /sys/class/net/${ifaceSanitized}/duplex 2>/dev/null; echo; + echo -n "flags: "; cat /sys/class/net/${ifaceSanitized}/flags 2>/dev/null; echo; + echo -n "gro_flush_timeout: "; cat /sys/class/net/${ifaceSanitized}/gro_flush_timeout 2>/dev/null; echo; + echo -n "ifalias: "; cat /sys/class/net/${ifaceSanitized}/ifalias 2>/dev/null; echo; + echo -n "ifindex: "; cat /sys/class/net/${ifaceSanitized}/ifindex 2>/dev/null; echo; + echo -n "iflink: "; cat /sys/class/net/${ifaceSanitized}/iflink 2>/dev/null; echo; + echo -n "link_mode: "; cat /sys/class/net/${ifaceSanitized}/link_mode 2>/dev/null; echo; + echo -n "mtu: "; cat /sys/class/net/${ifaceSanitized}/mtu 2>/dev/null; echo; + echo -n "netdev_group: "; cat /sys/class/net/${ifaceSanitized}/netdev_group 2>/dev/null; echo; + echo -n "operstate: "; cat /sys/class/net/${ifaceSanitized}/operstate 2>/dev/null; echo; + echo -n "proto_down: "; cat /sys/class/net/${ifaceSanitized}/proto_down 2>/dev/null; echo; + echo -n "speed: "; cat /sys/class/net/${ifaceSanitized}/speed 2>/dev/null; echo; + echo -n "tx_queue_len: "; cat /sys/class/net/${ifaceSanitized}/tx_queue_len 2>/dev/null; echo; + echo -n "type: "; cat /sys/class/net/${ifaceSanitized}/type 2>/dev/null; echo; + echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${ifaceSanitized}; echo; + echo -n "wirelessspeed: "; iw dev ${ifaceSanitized} link 2>&1 | grep bitrate; echo;`; + + let lines = []; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const connectionName = getLinuxIfaceConnectionName(ifaceSanitized); + dhcp = getLinuxIfaceDHCPstatus(ifaceSanitized, connectionName, _dhcpNics); + dnsSuffix = getLinuxIfaceDNSsuffix(connectionName); + ieee8021xAuth = getLinuxIfaceIEEE8021xAuth(connectionName); + ieee8021xState = getLinuxIfaceIEEE8021xState(ieee8021xAuth); + } catch (e) { + util.noop(); + } + duplex = util.getValue(lines, 'duplex'); + duplex = duplex.startsWith('cat') ? '' : duplex; + mtu = parseInt(util.getValue(lines, 'mtu'), 10); + let myspeed = parseInt(util.getValue(lines, 'speed'), 10); + speed = isNaN(myspeed) ? null : myspeed; + let wirelessspeed = util.getValue(lines, 'wirelessspeed').split('tx bitrate: '); + if (speed === null && wirelessspeed.length === 2) { + myspeed = parseFloat(wirelessspeed[1]); + speed = isNaN(myspeed) ? null : myspeed; + } + carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10); + const operstate = util.getValue(lines, 'operstate'); + type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown'; + if (ifaceSanitized === 'lo' || ifaceSanitized.startsWith('bond')) { type = 'virtual'; } + + let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false; + if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) { + internal = true; + } + const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac); + result.push({ + iface: ifaceSanitized, + ifaceName, + default: iface === defaultInterface, + ip4, + ip4subnet, + ip6, + ip6subnet, + mac, + internal, + virtual, + operstate, + type, + duplex, + mtu, + speed, + dhcp, + dnsSuffix, + ieee8021xAuth, + ieee8021xState, + carrierChanges, + }); + } + } + _networkInterfaces = result; + if (defaultString.toLowerCase().indexOf('default') >= 0) { + result = result.filter(item => item.default); + if (result.length > 0) { + result = result[0]; + } else { + result = []; + } + } + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) { + // no changes - just return object + result = _networkInterfaces; + + if (callback) { callback(result); } + resolve(result); + } else { + _ifaces = JSON.parse(JSON.stringify(ifaces)); + const defaultInterface = getDefaultNetworkInterface(); + + getWindowsNics().then(function (nics) { + nics.forEach(nic => { + let found = false; + Object.keys(ifaces).forEach(key => { + if (!found) { + ifaces[key].forEach(value => { + if (Object.keys(value).indexOf('mac') >= 0) { + found = value['mac'] === nic.mac; + } + }); + } + }); + + if (!found) { + ifaces[nic.name] = [{ mac: nic.mac }]; + } + }); + nics8021xInfo = getWindowsWiredProfilesInformation(); + dnsSuffixes = getWindowsDNSsuffixes(); + for (let dev in ifaces) { + + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(dev); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + let iface = dev; + let ip4 = ''; + let ip4subnet = ''; + let ip6 = ''; + let ip6subnet = ''; + let mac = ''; + let duplex = ''; + let mtu = ''; + let speed = null; + let carrierChanges = 0; + let operstate = 'down'; + let dhcp = false; + let dnsSuffix = ''; + let ieee8021xAuth = ''; + let ieee8021xState = ''; + let type = ''; + + if ({}.hasOwnProperty.call(ifaces, dev)) { + let ifaceName = dev; + ifaces[dev].forEach(function (details) { + if (details.family === 'IPv4' || details.family === 4) { + ip4 = details.address; + ip4subnet = details.netmask; + } + if (details.family === 'IPv6' || details.family === 6) { + if (!ip6 || ip6.match(/^fe80::/i)) { + ip6 = details.address; + ip6subnet = details.netmask; + } + } + mac = details.mac; + // fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2) + const nodeMainVersion = parseInt(process.versions.node.split('.'), 10); + if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && (!details.internal) && nodeMainVersion >= 8 && nodeMainVersion <= 11) { + if (Object.keys(_mac).length === 0) { + _mac = getMacAddresses(); + } + mac = _mac[dev] || ''; + } + }); + + + + dnsSuffix = getWindowsIfaceDNSsuffix(dnsSuffixes.ifaces, ifaceSanitized); + let foundFirst = false; + nics.forEach(detail => { + if (detail.mac === mac && !foundFirst) { + iface = detail.iface || iface; + ifaceName = detail.name; + dhcp = detail.dhcp; + operstate = detail.operstate; + speed = operstate === 'up' ? detail.speed : 0; + type = detail.type; + foundFirst = true; + } + }); + + if (dev.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('802.11n') >= 0 || ifaceName.toLowerCase().indexOf('wireless') >= 0 || ifaceName.toLowerCase().indexOf('wi-fi') >= 0 || ifaceName.toLowerCase().indexOf('wifi') >= 0) { + type = 'wireless'; + } + + const IEEE8021x = getWindowsIEEE8021x(type, ifaceSanitized, nics8021xInfo); + ieee8021xAuth = IEEE8021x.protocol; + ieee8021xState = IEEE8021x.state; + let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false; + if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) { + internal = true; + } + const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac); + result.push({ + iface, + ifaceName, + default: iface === defaultInterface, + ip4, + ip4subnet, + ip6, + ip6subnet, + mac, + internal, + virtual, + operstate, + type, + duplex, + mtu, + speed, + dhcp, + dnsSuffix, + ieee8021xAuth, + ieee8021xState, + carrierChanges, + }); + } + } + _networkInterfaces = result; + if (defaultString.toLowerCase().indexOf('default') >= 0) { + result = result.filter(item => item.default); + if (result.length > 0) { + result = result[0]; + } else { + result = []; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + } + }); + }); +} + +exports.networkInterfaces = networkInterfaces; + +// -------------------------- +// NET - Speed + +function calcNetworkSpeed(iface, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors) { + let result = { + iface, + operstate, + rx_bytes, + rx_dropped, + rx_errors, + tx_bytes, + tx_dropped, + tx_errors, + rx_sec: null, + tx_sec: null, + ms: 0 + }; + + if (_network[iface] && _network[iface].ms) { + result.ms = Date.now() - _network[iface].ms; + result.rx_sec = (rx_bytes - _network[iface].rx_bytes) >= 0 ? (rx_bytes - _network[iface].rx_bytes) / (result.ms / 1000) : 0; + result.tx_sec = (tx_bytes - _network[iface].tx_bytes) >= 0 ? (tx_bytes - _network[iface].tx_bytes) / (result.ms / 1000) : 0; + _network[iface].rx_bytes = rx_bytes; + _network[iface].tx_bytes = tx_bytes; + _network[iface].rx_sec = result.rx_sec; + _network[iface].tx_sec = result.tx_sec; + _network[iface].ms = Date.now(); + _network[iface].last_ms = result.ms; + _network[iface].operstate = operstate; + } else { + if (!_network[iface]) { _network[iface] = {}; } + _network[iface].rx_bytes = rx_bytes; + _network[iface].tx_bytes = tx_bytes; + _network[iface].rx_sec = null; + _network[iface].tx_sec = null; + _network[iface].ms = Date.now(); + _network[iface].last_ms = 0; + _network[iface].operstate = operstate; + } + return result; +} + +function networkStats(ifaces, callback) { + + let ifacesArray = []; + + return new Promise((resolve) => { + process.nextTick(() => { + + // fallback - if only callback is given + if (util.isFunction(ifaces) && !callback) { + callback = ifaces; + ifacesArray = [getDefaultNetworkInterface()]; + } else { + if (typeof ifaces !== 'string' && ifaces !== undefined) { + if (callback) { callback([]); } + return resolve([]); + } + ifaces = ifaces || getDefaultNetworkInterface(); + + ifaces.__proto__.toLowerCase = util.stringToLower; + ifaces.__proto__.replace = util.stringReplace; + ifaces.__proto__.trim = util.stringTrim; + + ifaces = ifaces.trim().toLowerCase().replace(/,+/g, '|'); + ifacesArray = ifaces.split('|'); + } + + const result = []; + + const workload = []; + if (ifacesArray.length && ifacesArray[0].trim() === '*') { + ifacesArray = []; + networkInterfaces(false).then(allIFaces => { + for (let iface of allIFaces) { + ifacesArray.push(iface.iface); + } + networkStats(ifacesArray.join(',')).then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + } else { + for (let iface of ifacesArray) { + workload.push(networkStatsSingle(iface.trim())); + } + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +function networkStatsSingle(iface) { + + function parseLinesWindowsPerfData(sections) { + let perfData = []; + for (let i in sections) { + if ({}.hasOwnProperty.call(sections, i)) { + if (sections[i].trim() !== '') { + let lines = sections[i].trim().split('\r\n'); + perfData.push({ + name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase(), + rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', ':'), 10), + rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', ':'), 10), + rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', ':'), 10), + tx_bytes: parseInt(util.getValue(lines, 'BytesSentPersec', ':'), 10), + tx_errors: parseInt(util.getValue(lines, 'PacketsOutboundErrors', ':'), 10), + tx_dropped: parseInt(util.getValue(lines, 'PacketsOutboundDiscarded', ':'), 10) + }); + } + } + } + return perfData; + } + + return new Promise((resolve) => { + process.nextTick(() => { + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + let result = { + iface: ifaceSanitized, + operstate: 'unknown', + rx_bytes: 0, + rx_dropped: 0, + rx_errors: 0, + tx_bytes: 0, + tx_dropped: 0, + tx_errors: 0, + rx_sec: null, + tx_sec: null, + ms: 0 + }; + + let operstate = 'unknown'; + let rx_bytes = 0; + let tx_bytes = 0; + let rx_dropped = 0; + let rx_errors = 0; + let tx_dropped = 0; + let tx_errors = 0; + + let cmd, lines, stats; + if (!_network[ifaceSanitized] || (_network[ifaceSanitized] && !_network[ifaceSanitized].ms) || (_network[ifaceSanitized] && _network[ifaceSanitized].ms && Date.now() - _network[ifaceSanitized].ms >= 500)) { + if (_linux) { + if (fs.existsSync('/sys/class/net/' + ifaceSanitized)) { + cmd = + 'cat /sys/class/net/' + ifaceSanitized + '/operstate; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_bytes; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_bytes; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_dropped; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_errors; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_dropped; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_errors; '; + exec(cmd, function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + operstate = lines[0].trim(); + rx_bytes = parseInt(lines[1], 10); + tx_bytes = parseInt(lines[2], 10); + rx_dropped = parseInt(lines[3], 10); + rx_errors = parseInt(lines[4], 10); + tx_dropped = parseInt(lines[5], 10); + tx_errors = parseInt(lines[6], 10); + + result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + + } + resolve(result); + }); + } else { + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + cmd = 'netstat -ibndI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input] + exec(cmd, function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + for (let i = 1; i < lines.length; i++) { + const line = lines[i].replace(/ +/g, ' ').split(' '); + if (line && line[0] && line[7] && line[10]) { + rx_bytes = rx_bytes + parseInt(line[7]); + if (line[6].trim() !== '-') { rx_dropped = rx_dropped + parseInt(line[6]); } + if (line[5].trim() !== '-') { rx_errors = rx_errors + parseInt(line[5]); } + tx_bytes = tx_bytes + parseInt(line[10]); + if (line[12].trim() !== '-') { tx_dropped = tx_dropped + parseInt(line[12]); } + if (line[9].trim() !== '-') { tx_errors = tx_errors + parseInt(line[9]); } + operstate = 'up'; + } + } + result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + } + resolve(result); + }); + } + if (_darwin) { + cmd = 'ifconfig ' + ifaceSanitized + ' | grep "status"'; // lgtm [js/shell-command-constructed-from-input] + exec(cmd, function (error, stdout) { + result.operstate = (stdout.toString().split(':')[1] || '').trim(); + result.operstate = (result.operstate || '').toLowerCase(); + result.operstate = (result.operstate === 'active' ? 'up' : (result.operstate === 'inactive' ? 'down' : 'unknown')); + cmd = 'netstat -bdI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input] + exec(cmd, function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + // if there is less than 2 lines, no information for this interface was found + if (lines.length > 1 && lines[1].trim() !== '') { + // skip header line + // use the second line because it is tied to the NIC instead of the ipv4 or ipv6 address + stats = lines[1].replace(/ +/g, ' ').split(' '); + const offset = stats.length > 11 ? 1 : 0; + rx_bytes = parseInt(stats[offset + 5]); + rx_dropped = parseInt(stats[offset + 10]); + rx_errors = parseInt(stats[offset + 4]); + tx_bytes = parseInt(stats[offset + 8]); + tx_dropped = parseInt(stats[offset + 10]); + tx_errors = parseInt(stats[offset + 7]); + result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, result.operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + } + } + resolve(result); + }); + }); + } + if (_windows) { + let perfData = []; + let ifaceName = ifaceSanitized; + + // Performance Data + util.powerShell('Get-CimInstance Win32_PerfRawData_Tcpip_NetworkInterface | select Name,BytesReceivedPersec,PacketsReceivedErrors,PacketsReceivedDiscarded,BytesSentPersec,PacketsOutboundErrors,PacketsOutboundDiscarded | fl').then((stdout, error) => { + if (!error) { + const psections = stdout.toString().split(/\n\s*\n/); + perfData = parseLinesWindowsPerfData(psections); + } + + // Network Interfaces + networkInterfaces(false).then(interfaces => { + // get bytes sent, received from perfData by name + rx_bytes = 0; + tx_bytes = 0; + perfData.forEach(detail => { + interfaces.forEach(det => { + if ((det.iface.toLowerCase() === ifaceSanitized.toLowerCase() || + det.mac.toLowerCase() === ifaceSanitized.toLowerCase() || + det.ip4.toLowerCase() === ifaceSanitized.toLowerCase() || + det.ip6.toLowerCase() === ifaceSanitized.toLowerCase() || + det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === ifaceSanitized.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase()) && + (det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === detail.name)) { + ifaceName = det.iface; + rx_bytes = detail.rx_bytes; + rx_dropped = detail.rx_dropped; + rx_errors = detail.rx_errors; + tx_bytes = detail.tx_bytes; + tx_dropped = detail.tx_dropped; + tx_errors = detail.tx_errors; + operstate = det.operstate; + } + }); + }); + if (rx_bytes && tx_bytes) { + result = calcNetworkSpeed(ifaceName, parseInt(rx_bytes), parseInt(tx_bytes), operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + } + resolve(result); + }); + }); + } + } else { + result.rx_bytes = _network[ifaceSanitized].rx_bytes; + result.tx_bytes = _network[ifaceSanitized].tx_bytes; + result.rx_sec = _network[ifaceSanitized].rx_sec; + result.tx_sec = _network[ifaceSanitized].tx_sec; + result.ms = _network[ifaceSanitized].last_ms; + result.operstate = _network[ifaceSanitized].operstate; + resolve(result); + } + }); + }); +} + +exports.networkStats = networkStats; + +// -------------------------- +// NET - connections (sockets) + +function getProcessName(processes, pid) { + let cmd = ''; + processes.forEach(line => { + const parts = line.split(' '); + const id = parseInt(parts[0], 10) || -1; + if (id === pid) { + parts.shift(); + cmd = parts.join(' ').split(':')[0]; + } + }); + cmd = cmd.split(' -')[0]; + // return cmd; + const cmdParts = cmd.split('/'); + return cmdParts[cmdParts.length - 1]; +} + +function networkConnections(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'; + if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'; } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let lines = stdout.toString().split('\n'); + if (!error && (lines.length > 1 || lines[0] != '')) { + lines.forEach(function (line) { + line = line.replace(/ +/g, ' ').split(' '); + if (line.length >= 7) { + let localip = line[3]; + let localport = ''; + let localaddress = line[3].split(':'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join(':'); + } + let peerip = line[4]; + let peerport = ''; + let peeraddress = line[4].split(':'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join(':'); + } + let connstate = line[5]; + let proc = line[6].split('/'); + + if (connstate) { + result.push({ + protocol: line[0], + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid: proc[0] && proc[0] !== '-' ? parseInt(proc[0], 10) : null, + process: proc[1] ? proc[1].split(' ')[0].split(':')[0] : '' + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + } else { + cmd = 'ss -tunap | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"'; + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.replace(/ +/g, ' ').split(' '); + if (line.length >= 6) { + let localip = line[4]; + let localport = ''; + let localaddress = line[4].split(':'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join(':'); + } + let peerip = line[5]; + let peerport = ''; + let peeraddress = line[5].split(':'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join(':'); + } + let connstate = line[1]; + if (connstate === 'ESTAB') { connstate = 'ESTABLISHED'; } + if (connstate === 'TIME-WAIT') { connstate = 'TIME_WAIT'; } + let pid = null; + let process = ''; + if (line.length >= 7 && line[6].indexOf('users:') > -1) { + let proc = line[6].replace('users:(("', '').replace(/"/g, '').split(','); + if (proc.length > 2) { + process = proc[0].split(' ')[0].split(':')[0]; + pid = parseInt(proc[1], 10); + } + } + if (connstate) { + result.push({ + protocol: line[0], + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid, + process + }); + } + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + }); + } + if (_darwin) { + // let cmd = 'netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"'; + let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"'; + const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN'; + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) { + let processes = stdout2.toString().split('\n'); + processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); })); + let lines = stdout.toString().split('\n'); + + lines.forEach(function (line) { + line = line.replace(/ +/g, ' ').split(' '); + if (line.length >= 8) { + let localip = line[3]; + let localport = ''; + let localaddress = line[3].split('.'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join('.'); + } + let peerip = line[4]; + let peerport = ''; + let peeraddress = line[4].split('.'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join('.'); + } + const hasState = states.indexOf(line[5]) >= 0; + let connstate = hasState ? line[5] : 'UNKNOWN'; + let pid = parseInt(line[8 + (hasState ? 0 : -1)], 10); + if (connstate) { + result.push({ + protocol: line[0], + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid: pid, + process: getProcessName(processes, pid) + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + }); + + } + }); + } + if (_windows) { + let cmd = 'netstat -nao'; + try { + exec(cmd, util.execOptsWin, function (error, stdout) { + if (!error) { + + let lines = stdout.toString().split('\r\n'); + + lines.forEach(function (line) { + line = line.trim().replace(/ +/g, ' ').split(' '); + if (line.length >= 4) { + let localip = line[1]; + let localport = ''; + let localaddress = line[1].split(':'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join(':'); + } + localip = localip.replace(/\[/g, '').replace(/\]/g, ''); + let peerip = line[2]; + let peerport = ''; + let peeraddress = line[2].split(':'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join(':'); + } + peerip = peerip.replace(/\[/g, '').replace(/\]/g, ''); + let pid = util.toInt(line[4]); + let connstate = line[3]; + if (connstate === 'HERGESTELLT') { connstate = 'ESTABLISHED'; } + if (connstate.startsWith('ABH')) { connstate = 'LISTEN'; } + if (connstate === 'SCHLIESSEN_WARTEN') { connstate = 'CLOSE_WAIT'; } + if (connstate === 'WARTEND') { connstate = 'TIME_WAIT'; } + if (connstate === 'SYN_GESENDET') { connstate = 'SYN_SENT'; } + + if (connstate === 'LISTENING') { connstate = 'LISTEN'; } + if (connstate === 'SYN_RECEIVED') { connstate = 'SYN_RECV'; } + if (connstate === 'FIN_WAIT_1') { connstate = 'FIN_WAIT1'; } + if (connstate === 'FIN_WAIT_2') { connstate = 'FIN_WAIT2'; } + if (line[0].toLowerCase() !== 'udp' && connstate) { + result.push({ + protocol: line[0].toLowerCase(), + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid, + process: '' + }); + } else if (line[0].toLowerCase() === 'udp') { + result.push({ + protocol: line[0].toLowerCase(), + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: '', + pid: parseInt(line[3], 10), + process: '' + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.networkConnections = networkConnections; + +function networkGatewayDefault(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = ''; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'ip route get 1'; + try { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + const line = lines && lines[0] ? lines[0] : ''; + let parts = line.split(' via '); + if (parts && parts[1]) { + parts = parts[1].split(' '); + result = parts[0]; + } + if (callback) { + callback(result); + } + resolve(result); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_darwin) { + let cmd = 'route -n get default'; + try { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + const lines = stdout.toString().split('\n').map(line => line.trim()); + result = util.getValue(lines, 'gateway'); + } + if (!result) { + cmd = 'netstat -rn | awk \'/default/ {print $2}\''; + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + const lines = stdout.toString().split('\n').map(line => line.trim()); + result = lines.find(line => (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(line))); + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + try { + exec('netstat -r', util.execOptsWin, function (error, stdout) { + const lines = stdout.toString().split(os.EOL); + lines.forEach(line => { + line = line.replace(/\s+/g, ' ').trim(); + if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) { + const parts = line.split(' '); + if (parts.length >= 5 && (parts[parts.length - 3]).indexOf('.') > -1) { + result = parts[parts.length - 3]; + } + } + }); + if (!result) { + util.powerShell('Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq \'0.0.0.0\' -and $_.Mask -eq \'0.0.0.0\' }') + .then((data) => { + let lines = data.toString().split('\r\n'); + if (lines.length > 1 && !result) { + result = util.getValue(lines, 'NextHop'); + if (callback) { + callback(result); + } + resolve(result); + // } else { + // exec('ipconfig', util.execOptsWin, function (error, stdout) { + // let lines = stdout.toString().split('\r\n'); + // lines.forEach(function (line) { + // line = line.trim().replace(/\. /g, ''); + // line = line.trim().replace(/ +/g, ''); + // const parts = line.split(':'); + // if ((parts[0].toLowerCase().startsWith('standardgate') || parts[0].toLowerCase().indexOf('gateway') > -1 || parts[0].toLowerCase().indexOf('enlace') > -1) && parts[1]) { + // result = parts[1]; + // } + // }); + // if (callback) { callback(result); } + // resolve(result); + // }); + } + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.networkGatewayDefault = networkGatewayDefault; + + +/***/ }), + +/***/ 51067: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// osinfo.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 3. Operating System +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const fs = __nccwpck_require__(57147); +const util = __nccwpck_require__(19872); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +// -------------------------- +// Get current time and OS uptime + +function time() { + let t = new Date().toString().split(' '); + return { + current: Date.now(), + uptime: os.uptime(), + timezone: (t.length >= 7) ? t[5] : '', + timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : '' + }; +} + +exports.time = time; + +// -------------------------- +// Get logo filename of OS distribution + +function getLogoFile(distro) { + distro = distro || ''; + distro = distro.toLowerCase(); + let result = _platform; + if (_windows) { + result = 'windows'; + } + else if (distro.indexOf('mac os') !== -1) { + result = 'apple'; + } + else if (distro.indexOf('arch') !== -1) { + result = 'arch'; + } + else if (distro.indexOf('centos') !== -1) { + result = 'centos'; + } + else if (distro.indexOf('coreos') !== -1) { + result = 'coreos'; + } + else if (distro.indexOf('debian') !== -1) { + result = 'debian'; + } + else if (distro.indexOf('deepin') !== -1) { + result = 'deepin'; + } + else if (distro.indexOf('elementary') !== -1) { + result = 'elementary'; + } + else if (distro.indexOf('fedora') !== -1) { + result = 'fedora'; + } + else if (distro.indexOf('gentoo') !== -1) { + result = 'gentoo'; + } + else if (distro.indexOf('mageia') !== -1) { + result = 'mageia'; + } + else if (distro.indexOf('mandriva') !== -1) { + result = 'mandriva'; + } + else if (distro.indexOf('manjaro') !== -1) { + result = 'manjaro'; + } + else if (distro.indexOf('mint') !== -1) { + result = 'mint'; + } + else if (distro.indexOf('mx') !== -1) { + result = 'mx'; + } + else if (distro.indexOf('openbsd') !== -1) { + result = 'openbsd'; + } + else if (distro.indexOf('freebsd') !== -1) { + result = 'freebsd'; + } + else if (distro.indexOf('opensuse') !== -1) { + result = 'opensuse'; + } + else if (distro.indexOf('pclinuxos') !== -1) { + result = 'pclinuxos'; + } + else if (distro.indexOf('puppy') !== -1) { + result = 'puppy'; + } + else if (distro.indexOf('raspbian') !== -1) { + result = 'raspbian'; + } + else if (distro.indexOf('reactos') !== -1) { + result = 'reactos'; + } + else if (distro.indexOf('redhat') !== -1) { + result = 'redhat'; + } + else if (distro.indexOf('slackware') !== -1) { + result = 'slackware'; + } + else if (distro.indexOf('sugar') !== -1) { + result = 'sugar'; + } + else if (distro.indexOf('steam') !== -1) { + result = 'steam'; + } + else if (distro.indexOf('suse') !== -1) { + result = 'suse'; + } + else if (distro.indexOf('mate') !== -1) { + result = 'ubuntu-mate'; + } + else if (distro.indexOf('lubuntu') !== -1) { + result = 'lubuntu'; + } + else if (distro.indexOf('xubuntu') !== -1) { + result = 'xubuntu'; + } + else if (distro.indexOf('ubuntu') !== -1) { + result = 'ubuntu'; + } + else if (distro.indexOf('solaris') !== -1) { + result = 'solaris'; + } + else if (distro.indexOf('tails') !== -1) { + result = 'tails'; + } + else if (distro.indexOf('feren') !== -1) { + result = 'ferenos'; + } + else if (distro.indexOf('robolinux') !== -1) { + result = 'robolinux'; + } else if (_linux && distro) { + result = distro.toLowerCase().trim().replace(/\s+/g, '-'); + } + return result; +} + +// -------------------------- +// FQDN + +function getFQDN() { + let fqdn = os.hostname; + if (_linux || _darwin) { + try { + const stdout = execSync('hostnamectl --json short 2>/dev/null', util.execOptsLinux); + const json = JSON.parse(stdout.toString()); + + fqdn = json['StaticHostname']; + } catch (e) { + try { + const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux); + fqdn = stdout.toString().split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + } + if (_freebsd || _openbsd || _netbsd) { + try { + const stdout = execSync('hostname 2>/dev/null'); + fqdn = stdout.toString().split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + if (_windows) { + try { + const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin); + fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + return fqdn; +} + +// -------------------------- +// OS Information + +function osInfo(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + + platform: (_platform === 'win32' ? 'Windows' : _platform), + distro: 'unknown', + release: 'unknown', + codename: '', + kernel: os.release(), + arch: os.arch(), + hostname: os.hostname(), + fqdn: getFQDN(), + codepage: '', + logofile: '', + serial: '', + build: '', + servicepack: '', + uefi: false + }; + + if (_linux) { + + exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) { + /** + * @namespace + * @property {string} DISTRIB_ID + * @property {string} NAME + * @property {string} DISTRIB_RELEASE + * @property {string} VERSION_ID + * @property {string} DISTRIB_CODENAME + */ + let release = {}; + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + if (line.indexOf('=') !== -1) { + release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim(); + } + }); + result.distro = (release.DISTRIB_ID || release.NAME || 'unknown').replace(/"/g, ''); + result.logofile = getLogoFile(result.distro); + let releaseVersion = (release.VERSION || '').replace(/"/g, ''); + let codename = (release.DISTRIB_CODENAME || release.VERSION_CODENAME || '').replace(/"/g, ''); + const prettyName = (release.PRETTY_NAME || '').replace(/"/g, ''); + if (prettyName.indexOf(result.distro + ' ') === 0) { + releaseVersion = prettyName.replace(result.distro + ' ', '').trim(); + } + if (releaseVersion.indexOf('(') >= 0) { + codename = releaseVersion.split('(')[1].replace(/[()]/g, '').trim(); + releaseVersion = releaseVersion.split('(')[0].trim(); + } + result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, ''); + result.codename = codename; + result.codepage = util.getCodepage(); + result.build = (release.BUILD_ID || '').replace(/"/g, '').trim(); + isUefiLinux().then(uefi => { + result.uefi = uefi; + uuid().then((data) => { + result.serial = data.os; + if (callback) { + callback(result); + } + resolve(result); + }); + }); + }); + } + if (_freebsd || _openbsd || _netbsd) { + + exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', function (error, stdout) { + let lines = stdout.toString().split('\n'); + const distro = util.getValue(lines, 'kern.ostype'); + const logofile = getLogoFile(distro); + const release = util.getValue(lines, 'kern.osrelease').split('-')[0]; + const serial = util.getValue(lines, 'kern.uuid'); + const bootmethod = util.getValue(lines, 'machdep.bootmethod'); + const uefiConf = stdout.toString().indexOf('efi') >= 0; + const uefi = bootmethod ? bootmethod.toLowerCase().indexOf('uefi') >= 0 : (uefiConf ? uefiConf : null); + result.distro = distro || result.distro; + result.logofile = logofile || result.logofile; + result.release = release || result.release; + result.serial = serial || result.serial; + result.codename = ''; + result.codepage = util.getCodepage(); + result.uefi = uefi || null; + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_darwin) { + exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.serial = util.getValue(lines, 'kern.uuid'); + result.distro = util.getValue(lines, 'ProductName'); + result.release = (util.getValue(lines, 'ProductVersion', ':', true, true) + ' ' + util.getValue(lines, 'ProductVersionExtra', ':', true, true)).trim(); + result.build = util.getValue(lines, 'BuildVersion'); + result.logofile = getLogoFile(result.distro); + result.codename = 'macOS'; + result.codename = (result.release.indexOf('10.4') > -1 ? 'Mac OS X Tiger' : result.codename); + result.codename = (result.release.indexOf('10.5') > -1 ? 'Mac OS X Leopard' : result.codename); + result.codename = (result.release.indexOf('10.6') > -1 ? 'Mac OS X Snow Leopard' : result.codename); + result.codename = (result.release.indexOf('10.7') > -1 ? 'Mac OS X Lion' : result.codename); + result.codename = (result.release.indexOf('10.8') > -1 ? 'OS X Mountain Lion' : result.codename); + result.codename = (result.release.indexOf('10.9') > -1 ? 'OS X Mavericks' : result.codename); + result.codename = (result.release.indexOf('10.10') > -1 ? 'OS X Yosemite' : result.codename); + result.codename = (result.release.indexOf('10.11') > -1 ? 'OS X El Capitan' : result.codename); + result.codename = (result.release.indexOf('10.12') > -1 ? 'macOS Sierra' : result.codename); + result.codename = (result.release.indexOf('10.13') > -1 ? 'macOS High Sierra' : result.codename); + result.codename = (result.release.indexOf('10.14') > -1 ? 'macOS Mojave' : result.codename); + result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename); + result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename); + result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename); + result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename); + result.codename = (result.release.startsWith('14.') ? 'macOS Sonoma' : result.codename); + result.codename = (result.release.startsWith('15.') ? 'macOS Sequoia' : result.codename); + result.uefi = true; + result.codepage = util.getCodepage(); + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos) { + result.release = result.kernel; + exec('uname -o', function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.distro = lines[0]; + result.logofile = getLogoFile(result.distro); + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { + result.logofile = getLogoFile(); + result.release = result.kernel; + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl')); + workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); + workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession')); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().split('\r\n') : ['']; + result.distro = util.getValue(lines, 'Caption', ':').trim(); + result.serial = util.getValue(lines, 'SerialNumber', ':').trim(); + result.build = util.getValue(lines, 'BuildNumber', ':').trim(); + result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim(); + result.codepage = util.getCodepage(); + const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : ''; + result.hypervisor = hyperv.indexOf('true') !== -1; + const term = data.results[2] ? data.results[2].toString() : ''; + result.remoteSession = (term.toString().toLowerCase().indexOf('true') >= 0); + isUefiWindows().then(uefi => { + result.uefi = uefi; + if (callback) { + callback(result); + } + resolve(result); + }); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.osInfo = osInfo; + +function isUefiLinux() { + return new Promise((resolve) => { + process.nextTick(() => { + fs.stat('/sys/firmware/efi', function (err) { + if (!err) { + return resolve(true); + } else { + exec('dmesg | grep -E "EFI v"', function (error, stdout) { + if (!error) { + const lines = stdout.toString().split('\n'); + return resolve(lines.length > 0); + } + return resolve(false); + }); + } + }); + }); + }); +} + +function isUefiWindows() { + return new Promise((resolve) => { + process.nextTick(() => { + try { + exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n\r')[0]; + return resolve(line.toLowerCase().indexOf('efi') >= 0); + } else { + exec('echo %firmware_type%', util.execOptsWin, function (error, stdout) { + if (!error) { + const line = stdout.toString() || ''; + return resolve(line.toLowerCase().indexOf('efi') >= 0); + } else { + return resolve(false); + } + }); + } + }); + } catch (e) { + return resolve(false); + } + }); + }); +} + +function versions(apps, callback) { + let versionObject = { + kernel: os.release(), + openssl: '', + systemOpenssl: '', + systemOpensslLib: '', + node: process.versions.node, + v8: process.versions.v8, + npm: '', + yarn: '', + pm2: '', + gulp: '', + grunt: '', + git: '', + tsc: '', + mysql: '', + redis: '', + mongodb: '', + apache: '', + nginx: '', + php: '', + docker: '', + postfix: '', + postgresql: '', + perl: '', + python: '', + python3: '', + pip: '', + pip3: '', + java: '', + gcc: '', + virtualbox: '', + bash: '', + zsh: '', + fish: '', + powershell: '', + dotnet: '' + }; + + function checkVersionParam(apps) { + if (apps === '*') { + return { + versions: versionObject, + counter: 30 + }; + } + if (!Array.isArray(apps)) { + apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|'); + apps = apps.split('|'); + const result = { + versions: {}, + counter: 0 + }; + apps.forEach(el => { + if (el) { + for (let key in versionObject) { + if ({}.hasOwnProperty.call(versionObject, key)) { + if (key.toLowerCase() === el.toLowerCase() && !{}.hasOwnProperty.call(result.versions, key)) { + result.versions[key] = versionObject[key]; + if (key === 'openssl') { + result.versions.systemOpenssl = ''; + result.versions.systemOpensslLib = ''; + } + + if (!result.versions[key]) { result.counter++; } + } + } + } + } + }); + return result; + } + } + + return new Promise((resolve) => { + process.nextTick(() => { + if (util.isFunction(apps) && !callback) { + callback = apps; + apps = '*'; + } else { + apps = apps || '*'; + if (typeof apps !== 'string') { + if (callback) { callback({}); } + return resolve({}); + } + } + const appsObj = checkVersionParam(apps); + let totalFunctions = appsObj.counter; + + let functionProcessed = (function () { + return function () { + if (--totalFunctions === 0) { + if (callback) { + callback(appsObj.versions); + } + resolve(appsObj.versions); + } + }; + })(); + + let cmd = ''; + try { + if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) { + appsObj.versions.openssl = process.versions.openssl; + exec('openssl version', function (error, stdout) { + if (!error) { + let openssl_string = stdout.toString().split('\n')[0].trim(); + let openssl = openssl_string.split(' '); + appsObj.versions.systemOpenssl = openssl.length > 0 ? openssl[1] : openssl[0]; + appsObj.versions.systemOpensslLib = openssl.length > 0 ? openssl[0] : 'openssl'; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) { + exec('npm -v', function (error, stdout) { + if (!error) { + appsObj.versions.npm = stdout.toString().split('\n')[0]; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'pm2')) { + cmd = 'pm2'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} -v`, function (error, stdout) { + if (!error) { + let pm2 = stdout.toString().split('\n')[0].trim(); + if (!pm2.startsWith('[PM2]')) { + appsObj.versions.pm2 = pm2; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) { + exec('yarn --version', function (error, stdout) { + if (!error) { + appsObj.versions.yarn = stdout.toString().split('\n')[0]; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'gulp')) { + cmd = 'gulp'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { + if (!error) { + const gulp = stdout.toString().split('\n')[0] || ''; + appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'tsc')) { + cmd = 'tsc'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { + if (!error) { + const tsc = stdout.toString().split('\n')[0] || ''; + appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'grunt')) { + cmd = 'grunt'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { + if (!error) { + const grunt = stdout.toString().split('\n')[0] || ''; + appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'git')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('git --version', function (error, stdout) { + if (!error) { + let git = stdout.toString().split('\n')[0] || ''; + git = (git.toLowerCase().split('version')[1] || '').trim(); + appsObj.versions.git = (git.split(' ')[0] || '').trim(); + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('git --version', function (error, stdout) { + if (!error) { + let git = stdout.toString().split('\n')[0] || ''; + git = (git.toLowerCase().split('version')[1] || '').trim(); + appsObj.versions.git = (git.split(' ')[0] || '').trim(); + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) { + exec('apachectl -v 2>&1', function (error, stdout) { + if (!error) { + const apache = (stdout.toString().split('\n')[0] || '').split(':'); + appsObj.versions.apache = (apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : ''); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) { + exec('nginx -v 2>&1', function (error, stdout) { + if (!error) { + const nginx = stdout.toString().split('\n')[0] || ''; + appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) { + exec('mysql -V', function (error, stdout) { + if (!error) { + let mysql = stdout.toString().split('\n')[0] || ''; + mysql = mysql.toLowerCase(); + if (mysql.indexOf(',') > -1) { + mysql = (mysql.split(',')[0] || '').trim(); + const parts = mysql.split(' '); + appsObj.versions.mysql = (parts[parts.length - 1] || '').trim(); + } else { + if (mysql.indexOf(' ver ') > -1) { + mysql = mysql.split(' ver ')[1]; + appsObj.versions.mysql = mysql.split(' ')[0]; + } + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'php')) { + exec('php -v', function (error, stdout) { + if (!error) { + const php = stdout.toString().split('\n')[0] || ''; + let parts = php.split('('); + if (parts[0].indexOf('-')) { + parts = parts[0].split('-'); + } + appsObj.versions.php = parts[0].replace(/[^0-9.]/g, ''); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) { + exec('redis-server --version', function (error, stdout) { + if (!error) { + const redis = stdout.toString().split('\n')[0] || ''; + const parts = redis.split(' '); + appsObj.versions.redis = util.getValue(parts, 'v', '=', true); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) { + exec('docker --version', function (error, stdout) { + if (!error) { + const docker = stdout.toString().split('\n')[0] || ''; + const parts = docker.split(' '); + appsObj.versions.docker = parts.length > 2 && parts[2].endsWith(',') ? parts[2].slice(0, -1) : ''; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) { + exec('postconf -d | grep mail_version', function (error, stdout) { + if (!error) { + const postfix = stdout.toString().split('\n') || []; + appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) { + exec('mongod --version', function (error, stdout) { + if (!error) { + const mongodb = stdout.toString().split('\n')[0] || ''; + appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, ''); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) { + if (_linux) { + exec('locate bin/postgres', function (error, stdout) { + if (!error) { + const postgresqlBin = stdout.toString().split('\n').sort(); + if (postgresqlBin.length) { + exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', function (error, stdout) { + if (!error) { + const postgresql = stdout.toString().split('\n')[0].split(' ') || []; + appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('psql -V', function (error, stdout) { + if (!error) { + const postgresql = stdout.toString().split('\n')[0].split(' ') || []; + appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : ''; + appsObj.versions.postgresql = appsObj.versions.postgresql.split('-')[0]; + } + functionProcessed(); + }); + } + }); + } else { + if (_windows) { + util.powerShell('Get-CimInstance Win32_Service | select caption | fl').then((stdout) => { + let serviceSections = stdout.split(/\n\s*\n/); + serviceSections.forEach((item) => { + if (item.trim() !== '') { + let lines = item.trim().split('\r\n'); + let srvCaption = util.getValue(lines, 'caption', ':', true).toLowerCase(); + if (srvCaption.indexOf('postgresql') > -1) { + const parts = srvCaption.split(' server '); + if (parts.length > 1) { + appsObj.versions.postgresql = parts[1]; + } + } + } + }); + functionProcessed(); + }); + } else { + exec('postgres -V', function (error, stdout) { + if (!error) { + const postgresql = stdout.toString().split('\n')[0].split(' ') || []; + appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : ''; + } + functionProcessed(); + }); + } + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) { + exec('perl -v', function (error, stdout) { + if (!error) { + const perl = stdout.toString().split('\n') || ''; + while (perl.length > 0 && perl[0].trim() === '') { + perl.shift(); + } + if (perl.length > 0) { + appsObj.versions.perl = perl[0].split('(').pop().split(')')[0].replace('v', ''); + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'python')) { + if (_darwin) { + try { + const stdout = execSync('sw_vers'); + const lines = stdout.toString().split('\n'); + const osVersion = util.getValue(lines, 'ProductVersion', ':'); + const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python'); + const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python'); + if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) { + const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1'); + exec(cmd, function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } catch (e) { + functionProcessed(); + } + + } else { + exec('python -V 2>&1', function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'python3')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('python3 -V 2>&1', function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('python3 -V 2>&1', function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'pip')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('pip -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('pip -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'pip3')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('pip3 -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('pip3 -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'java')) { + if (_darwin) { + // check if any JVM is installed but avoid dialog box that Java needs to be installed + exec('/usr/libexec/java_home -V 2>&1', function (error, stdout) { + if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) { + // now this can be done savely + exec('java -version 2>&1', function (error, stdout) { + if (!error) { + const java = stdout.toString().split('\n')[0] || ''; + const parts = java.split('"'); + appsObj.versions.java = parts.length === 3 ? parts[1].trim() : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + }); + } else { + exec('java -version 2>&1', function (error, stdout) { + if (!error) { + const java = stdout.toString().split('\n')[0] || ''; + const parts = java.split('"'); + appsObj.versions.java = parts.length === 3 ? parts[1].trim() : ''; + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) { + if ((_darwin && util.darwinXcodeExists()) || !_darwin) { + exec('gcc -dumpversion', function (error, stdout) { + if (!error) { + appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || ''; + } + if (appsObj.versions.gcc.indexOf('.') > -1) { + functionProcessed(); + } else { + exec('gcc --version', function (error, stdout) { + if (!error) { + const gcc = stdout.toString().split('\n')[0].trim(); + if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) { + const parts = gcc.split(')'); + appsObj.versions.gcc = parts[1].trim() || appsObj.versions.gcc; + } + } + functionProcessed(); + }); + } + }); + } else { + functionProcessed(); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) { + exec(util.getVboxmanage() + ' -v 2>&1', function (error, stdout) { + if (!error) { + const vbox = stdout.toString().split('\n')[0] || ''; + const parts = vbox.split('r'); + appsObj.versions.virtualbox = parts[0]; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) { + exec('bash --version', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0]; + const parts = line.split(' version '); + if (parts.length > 1) { + appsObj.versions.bash = parts[1].split(' ')[0].split('(')[0]; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) { + exec('zsh --version', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0]; + const parts = line.split('zsh '); + if (parts.length > 1) { + appsObj.versions.zsh = parts[1].split(' ')[0]; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) { + exec('fish --version', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0]; + const parts = line.split(' version '); + if (parts.length > 1) { + appsObj.versions.fish = parts[1].split(' ')[0]; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) { + if (_windows) { + util.powerShell('$PSVersionTable').then(stdout => { + const lines = stdout.toString().split('\n').map(line => line.replace(/ +/g, ' ').replace(/ +/g, ':')); + appsObj.versions.powershell = util.getValue(lines, 'psversion'); + functionProcessed(); + }); + } else { + functionProcessed(); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) { + if (_windows) { + util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => { + const lines = stdout.toString().split('\r\n'); + let dotnet = ''; + lines.forEach(line => { + line = line.replace(/ +/g, ' '); + const parts = line.split(' '); + dotnet = dotnet || (parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : '')); + }); + appsObj.versions.dotnet = dotnet.trim(); + functionProcessed(); + }); + } else { + functionProcessed(); + } + } + } catch (e) { + if (callback) { callback(appsObj.versions); } + resolve(appsObj.versions); + } + }); + }); +} + +exports.versions = versions; + +function shell(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + if (_windows) { + resolve('cmd'); + } else { + let result = ''; + exec('echo $SHELL', function (error, stdout) { + if (!error) { + result = stdout.toString().split('\n')[0]; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + }); + }); +} + +exports.shell = shell; + +function getUniqueMacAdresses() { + let macs = []; + try { + const ifaces = os.networkInterfaces(); + for (let dev in ifaces) { + if ({}.hasOwnProperty.call(ifaces, dev)) { + ifaces[dev].forEach(function (details) { + if (details && details.mac && details.mac !== '00:00:00:00:00:00') { + const mac = details.mac.toLowerCase(); + if (macs.indexOf(mac) === -1) { + macs.push(mac); + } + } + }); + } + } + macs = macs.sort(function (a, b) { + if (a < b) { return -1; } + if (a > b) { return 1; } + return 0; + }); + } catch (e) { + macs.push('00:00:00:00:00:00'); + } + return macs; +} + +function uuid(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + os: '', + hardware: '', + macs: getUniqueMacAdresses() + }; + let parts; + + if (_darwin) { + exec('system_profiler SPHardwareDataType -json', function (error, stdout) { + if (!error) { + try { + const jsonObj = JSON.parse(stdout.toString()); + if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) { + const spHardware = jsonObj.SPHardwareDataType[0]; + result.os = spHardware.platform_UUID.toLowerCase(); + result.hardware = spHardware.serial_number; + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_linux) { + const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null || +cat /etc/machine-id 2> /dev/null; echo; +echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`; + exec(cmd, function (error, stdout) { + const lines = stdout.toString().split('\n'); + result.os = util.getValue(lines, 'os').toLowerCase(); + result.hardware = util.getValue(lines, 'hardware').toLowerCase(); + if (!result.hardware) { + const lines = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n'); + const serial = util.getValue(lines, 'serial'); + result.hardware = serial || ''; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_freebsd || _openbsd || _netbsd) { + exec('sysctl -i kern.hostid kern.hostuuid', function (error, stdout) { + const lines = stdout.toString().split('\n'); + result.os = util.getValue(lines, 'kern.hostid', ':').toLowerCase(); + result.hardware = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase(); + if (result.os.indexOf('unknown') >= 0) { result.os = ''; } + if (result.hardware.indexOf('unknown') >= 0) { result.hardware = ''; } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + let sysdir = '%windir%\\System32'; + if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) { + sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32'; + } + util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => { + let lines = stdout.split('\r\n'); + result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase(); + exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) { + parts = stdout.toString().split('\n\r')[0].split('REG_SZ'); + result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : ''; + if (callback) { + callback(result); + } + resolve(result); + }); + }); + } + }); + }); +} + +exports.uuid = uuid; + + +/***/ }), + +/***/ 15249: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// printers.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 15. printers +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(32081).exec); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +const winPrinterStatus = { + 1: 'Other', + 2: 'Unknown', + 3: 'Idle', + 4: 'Printing', + 5: 'Warmup', + 6: 'Stopped Printing', + 7: 'Offline', +}; + +function parseLinuxCupsHeader(lines) { + const result = {}; + if (lines && lines.length) { + if (lines[0].indexOf(' CUPS v') > 0) { + const parts = lines[0].split(' CUPS v'); + result.cupsVersion = parts[1]; + } + } + return result; +} + +function parseLinuxCupsPrinter(lines) { + const result = {}; + const printerId = util.getValue(lines, 'PrinterId', ' '); + result.id = printerId ? parseInt(printerId, 10) : null; + result.name = util.getValue(lines, 'Info', ' '); + result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : ''; + result.uri = util.getValue(lines, 'DeviceURI', ' '); + result.uuid = util.getValue(lines, 'UUID', ' '); + result.status = util.getValue(lines, 'State', ' '); + result.local = util.getValue(lines, 'Location', ' ').toLowerCase().startsWith('local'); + result.default = null; + result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes'); + + return result; +} + +function parseLinuxLpstatPrinter(lines, id) { + const result = {}; + result.id = id; + result.name = util.getValue(lines, 'Description', ':', true); + result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : ''; + result.uri = null; + result.uuid = null; + result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : (lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown')) : null; + result.local = util.getValue(lines, 'Location', ':', true).toLowerCase().startsWith('local'); + result.default = null; + result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes'); + + return result; +} + +function parseDarwinPrinters(printerObject, id) { + const result = {}; + const uriParts = printerObject.uri.split('/'); + result.id = id; + result.name = printerObject._name; + result.model = uriParts.length ? uriParts[uriParts.length - 1] : ''; + result.uri = printerObject.uri; + result.uuid = null; + result.status = printerObject.status; + result.local = printerObject.printserver === 'local'; + result.default = printerObject.default === 'yes'; + result.shared = printerObject.shared === 'yes'; + + return result; +} + +function parseWindowsPrinters(lines, id) { + const result = {}; + const status = parseInt(util.getValue(lines, 'PrinterStatus', ':'), 10); + + result.id = id; + result.name = util.getValue(lines, 'name', ':'); + result.model = util.getValue(lines, 'DriverName', ':'); + result.uri = null; + result.uuid = null; + result.status = winPrinterStatus[status] ? winPrinterStatus[status] : null; + result.local = util.getValue(lines, 'Local', ':').toUpperCase() === 'TRUE'; + result.default = util.getValue(lines, 'Default', ':').toUpperCase() === 'TRUE'; + result.shared = util.getValue(lines, 'Shared', ':').toUpperCase() === 'TRUE'; + + return result; +} + +function printer(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'cat /etc/cups/printers.conf 2>/dev/null'; + exec(cmd, function (error, stdout) { + // printers.conf + if (!error) { + const parts = stdout.toString().split(' { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + for (let i = 0; i < parts.length; i++) { + const printer = parseWindowsPrinters(parts[i].split('\n'), i); + if (printer.name || printer.model) { + result.push(printer); + } + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos) { + resolve(null); + } + }); + }); +} + +exports.printer = printer; + + +/***/ }), + +/***/ 77157: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// processes.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 10. Processes +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const fs = __nccwpck_require__(57147); +const path = __nccwpck_require__(71017); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); + +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +const _processes_cpu = { + all: 0, + all_utime: 0, + all_stime: 0, + list: {}, + ms: 0, + result: {} +}; +const _services_cpu = { + all: 0, + all_utime: 0, + all_stime: 0, + list: {}, + ms: 0, + result: {} +}; +const _process_cpu = { + all: 0, + all_utime: 0, + all_stime: 0, + list: {}, + ms: 0, + result: {} +}; + +const _winStatusValues = { + '0': 'unknown', + '1': 'other', + '2': 'ready', + '3': 'running', + '4': 'blocked', + '5': 'suspended blocked', + '6': 'suspended ready', + '7': 'terminated', + '8': 'stopped', + '9': 'growing', +}; + +function parseTimeUnix(time) { + let result = time; + let parts = time.replace(/ +/g, ' ').split(' '); + if (parts.length === 5) { + result = parts[4] + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(parts[1].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + parts[2]).slice(-2) + ' ' + parts[3]; + } + return result; +} + +function parseElapsedTime(etime) { + let current = new Date(); + current = new Date(current.getTime() - current.getTimezoneOffset() * 60000); + + const elapsed = etime.split('-'); + + const timeIndex = elapsed.length - 1; + const days = timeIndex > 0 ? parseInt(elapsed[timeIndex - 1]) : 0; + + const timeStr = elapsed[timeIndex].split(':'); + const hours = timeStr.length === 3 ? parseInt(timeStr[0] || 0) : 0; + const mins = parseInt(timeStr[timeStr.length === 3 ? 1 : 0] || 0); + const secs = parseInt(timeStr[timeStr.length === 3 ? 2 : 1] || 0); + const ms = (((((days * 24 + hours) * 60) + mins) * 60 + secs) * 1000); + + let res = new Date(current.getTime()); + let result = res.toISOString().substring(0, 10) + ' ' + res.toISOString().substring(11, 19); + try { + res = new Date(current.getTime() - ms); + result = res.toISOString().substring(0, 10) + ' ' + res.toISOString().substring(11, 19); + } catch (e) { + util.noop(); + } + return result; +} + +// -------------------------- +// PS - services +// pass a comma separated string with services to check (mysql, apache, postgresql, ...) +// this function gives an array back, if the services are running. + +function services(srv, callback) { + + // fallback - if only callback is given + if (util.isFunction(srv) && !callback) { + callback = srv; + srv = ''; + } + + return new Promise((resolve) => { + process.nextTick(() => { + if (typeof srv !== 'string') { + if (callback) { callback([]); } + return resolve([]); + } + + if (srv) { + let srvString = ''; + srvString.__proto__.toLowerCase = util.stringToLower; + srvString.__proto__.replace = util.stringReplace; + srvString.__proto__.trim = util.stringTrim; + + const s = util.sanitizeShellString(srv); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + srvString = srvString + s[i]; + } + } + + srvString = srvString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|'); + if (srvString === '') { + srvString = '*'; + } + if (util.isPrototypePolluted() && srvString !== '*') { + srvString = '------'; + } + let srvs = srvString.split('|'); + let result = []; + let dataSrv = []; + + if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { + if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') { + try { + const tmpsrv = execSync('systemctl --all --type=service --no-legend 2> /dev/null', util.execOptsLinux).toString().split('\n'); + srvs = []; + for (const s of tmpsrv) { + const name = s.split('.service')[0]; + if (name && s.indexOf(' not-found ') === -1) { + srvs.push(name.trim()); + } + } + srvString = srvs.join('|'); + } catch (d) { + try { + srvString = ''; + const tmpsrv = execSync('service --status-all 2> /dev/null', util.execOptsLinux).toString().split('\n'); + for (const s of tmpsrv) { + const parts = s.split(']'); + if (parts.length === 2) { + srvString += (srvString !== '' ? '|' : '') + parts[1].trim(); + } + } + srvs = srvString.split('|'); + } catch (e) { + try { + const srvStr = execSync('ls /etc/init.d/ -m 2> /dev/null', util.execOptsLinux).toString().split('\n').join(''); + srvString = ''; + if (srvStr) { + const tmpsrv = srvStr.split(','); + for (const s of tmpsrv) { + const name = s.trim(); + if (name) { + srvString += (srvString !== '' ? '|' : '') + name; + } + } + srvs = srvString.split('|'); + } + } catch (f) { + srvString = ''; + srvs = []; + } + } + } + } + if ((_darwin) && srvString === '*') { // service enumeration not yet suported on mac OS + if (callback) { callback(result); } + resolve(result); + } + let args = (_darwin) ? ['-caxo', 'pcpu,pmem,pid,command'] : ['-axo', 'pcpu,pmem,pid,command']; + if (srvString !== '' && srvs.length > 0) { + util.execSafe('ps', args).then((stdout) => { + if (stdout) { + let lines = stdout.replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); + srvs.forEach(function (srv) { + let ps; + if (_darwin) { + ps = lines.filter(function (e) { + return (e.toLowerCase().indexOf(srv) !== -1); + }); + + } else { + ps = lines.filter(function (e) { + return (e.toLowerCase().indexOf(' ' + srv.toLowerCase() + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv.toLowerCase()) !== -1); + }); + } + const pids = []; + for (const p of ps) { + const pid = p.trim().split(' ')[2]; + if (pid) { + pids.push(parseInt(pid, 10)); + } + } + result.push({ + name: srv, + running: ps.length > 0, + startmode: '', + pids: pids, + cpu: parseFloat((ps.reduce(function (pv, cv) { + return pv + parseFloat(cv.trim().split(' ')[0]); + }, 0)).toFixed(2)), + mem: parseFloat((ps.reduce(function (pv, cv) { + return pv + parseFloat(cv.trim().split(' ')[1]); + }, 0)).toFixed(2)) + }); + }); + if (_linux) { + // calc process_cpu - ps is not accurate in linux! + let cmd = 'cat /proc/stat | grep "cpu "'; + for (let i in result) { + for (let j in result[i].pids) { + cmd += (';cat /proc/' + result[i].pids[j] + '/stat'); + } + } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let curr_processes = stdout.toString().split('\n'); + + // first line (all - /proc/stat) + let all = parseProcStat(curr_processes.shift()); + + // process + let list_new = {}; + let resultProcess = {}; + curr_processes.forEach((element) => { + resultProcess = calcProcStatLinux(element, all, _services_cpu); + + if (resultProcess.pid) { + let listPos = -1; + for (let i in result) { + for (let j in result[i].pids) { + if (parseInt(result[i].pids[j]) === parseInt(resultProcess.pid)) { + listPos = i; + } + } + } + if (listPos >= 0) { + result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime, + cutime: resultProcess.cutime, + cstime: resultProcess.cstime + }; + } + }); + + // store old values + _services_cpu.all = all; + _services_cpu.list = Object.assign({}, list_new); + _services_cpu.ms = Date.now() - _services_cpu.ms; + _services_cpu.result = Object.assign({}, result); + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + args = ['-o', 'comm']; + util.execSafe('ps', args).then((stdout) => { + if (stdout) { + let lines = stdout.replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); + srvs.forEach(function (srv) { + let ps = lines.filter(function (e) { + return e.indexOf(srv) !== -1; + }); + result.push({ + name: srv, + running: ps.length > 0, + startmode: '', + cpu: 0, + mem: 0 + }); + }); + if (callback) { callback(result); } + resolve(result); + } else { + srvs.forEach(function (srv) { + result.push({ + name: srv, + running: false, + startmode: '', + cpu: 0, + mem: 0 + }); + }); + if (callback) { callback(result); } + resolve(result); + } + }); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + try { + let wincommand = 'Get-CimInstance Win32_Service'; + if (srvs[0] !== '*') { + wincommand += ' -Filter "'; + srvs.forEach((srv) => { + wincommand += `Name='${srv}' or `; + }); + wincommand = `${wincommand.slice(0, -4)}"`; + } + wincommand += ' | select Name,Caption,Started,StartMode,ProcessId | fl'; + util.powerShell(wincommand).then((stdout, error) => { + if (!error) { + let serviceSections = stdout.split(/\n\s*\n/); + serviceSections.forEach((element) => { + if (element.trim() !== '') { + let lines = element.trim().split('\r\n'); + let srvName = util.getValue(lines, 'Name', ':', true).toLowerCase(); + let srvCaption = util.getValue(lines, 'Caption', ':', true).toLowerCase(); + let started = util.getValue(lines, 'Started', ':', true); + let startMode = util.getValue(lines, 'StartMode', ':', true); + let pid = util.getValue(lines, 'ProcessId', ':', true); + if (srvString === '*' || srvs.indexOf(srvName) >= 0 || srvs.indexOf(srvCaption) >= 0) { + result.push({ + name: srvName, + running: (started.toLowerCase() === 'true'), + startmode: startMode, + pids: [pid], + cpu: 0, + mem: 0 + }); + dataSrv.push(srvName); + dataSrv.push(srvCaption); + } + } + + }); + + if (srvString !== '*') { + let srvsMissing = srvs.filter(function (e) { + return dataSrv.indexOf(e) === -1; + }); + srvsMissing.forEach(function (srvName) { + result.push({ + name: srvName, + running: false, + startmode: '', + pids: [], + cpu: 0, + mem: 0 + }); + }); + } + if (callback) { callback(result); } + resolve(result); + } else { + srvs.forEach(function (srvName) { + result.push({ + name: srvName, + running: false, + startmode: '', + cpu: 0, + mem: 0 + }); + }); + if (callback) { callback(result); } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + } else { + if (callback) { callback([]); } + resolve([]); + } + }); + }); +} + +exports.services = services; + +function parseProcStat(line) { + let parts = line.replace(/ +/g, ' ').split(' '); + let user = (parts.length >= 2 ? parseInt(parts[1]) : 0); + let nice = (parts.length >= 3 ? parseInt(parts[2]) : 0); + let system = (parts.length >= 4 ? parseInt(parts[3]) : 0); + let idle = (parts.length >= 5 ? parseInt(parts[4]) : 0); + let iowait = (parts.length >= 6 ? parseInt(parts[5]) : 0); + let irq = (parts.length >= 7 ? parseInt(parts[6]) : 0); + let softirq = (parts.length >= 8 ? parseInt(parts[7]) : 0); + let steal = (parts.length >= 9 ? parseInt(parts[8]) : 0); + let guest = (parts.length >= 10 ? parseInt(parts[9]) : 0); + let guest_nice = (parts.length >= 11 ? parseInt(parts[10]) : 0); + return user + nice + system + idle + iowait + irq + softirq + steal + guest + guest_nice; +} + +function calcProcStatLinux(line, all, _cpu_old) { + let statparts = line.replace(/ +/g, ' ').split(')'); + if (statparts.length >= 2) { + let parts = statparts[1].split(' '); + if (parts.length >= 16) { + let pid = parseInt(statparts[0].split(' ')[0]); + let utime = parseInt(parts[12]); + let stime = parseInt(parts[13]); + let cutime = parseInt(parts[14]); + let cstime = parseInt(parts[15]); + + // calc + let cpuu = 0; + let cpus = 0; + if (_cpu_old.all > 0 && _cpu_old.list[pid]) { + cpuu = (utime + cutime - _cpu_old.list[pid].utime - _cpu_old.list[pid].cutime) / (all - _cpu_old.all) * 100; // user + cpus = (stime + cstime - _cpu_old.list[pid].stime - _cpu_old.list[pid].cstime) / (all - _cpu_old.all) * 100; // system + } else { + cpuu = (utime + cutime) / (all) * 100; // user + cpus = (stime + cstime) / (all) * 100; // system + } + return { + pid: pid, + utime: utime, + stime: stime, + cutime: cutime, + cstime: cstime, + cpuu: cpuu, + cpus: cpus + }; + } else { + return { + pid: 0, + utime: 0, + stime: 0, + cutime: 0, + cstime: 0, + cpuu: 0, + cpus: 0 + }; + } + } else { + return { + pid: 0, + utime: 0, + stime: 0, + cutime: 0, + cstime: 0, + cpuu: 0, + cpus: 0 + }; + } +} + +function calcProcStatWin(procStat, all, _cpu_old) { + // calc + let cpuu = 0; + let cpus = 0; + if (_cpu_old.all > 0 && _cpu_old.list[procStat.pid]) { + cpuu = (procStat.utime - _cpu_old.list[procStat.pid].utime) / (all - _cpu_old.all) * 100; // user + cpus = (procStat.stime - _cpu_old.list[procStat.pid].stime) / (all - _cpu_old.all) * 100; // system + } else { + cpuu = (procStat.utime) / (all) * 100; // user + cpus = (procStat.stime) / (all) * 100; // system + } + return { + pid: procStat.pid, + utime: procStat.utime, + stime: procStat.stime, + cpuu: cpuu > 0 ? cpuu : 0, + cpus: cpus > 0 ? cpus : 0 + }; +} + + + +// -------------------------- +// running processes + +function processes(callback) { + + let parsedhead = []; + + function getName(command) { + command = command || ''; + let result = command.split(' ')[0]; + if (result.substr(-1) === ':') { + result = result.substr(0, result.length - 1); + } + if (result.substr(0, 1) !== '[') { + let parts = result.split('/'); + if (isNaN(parseInt(parts[parts.length - 1]))) { + result = parts[parts.length - 1]; + } else { + result = parts[0]; + } + } + return result; + } + + function parseLine(line) { + + let offset = 0; + let offset2 = 0; + + function checkColumn(i) { + offset = offset2; + if (parsedhead[i]) { + offset2 = line.substring(parsedhead[i].to + offset, 10000).indexOf(' '); + } else { + offset2 = 10000; + } + } + + checkColumn(0); + const pid = parseInt(line.substring(parsedhead[0].from + offset, parsedhead[0].to + offset2)); + checkColumn(1); + const ppid = parseInt(line.substring(parsedhead[1].from + offset, parsedhead[1].to + offset2)); + checkColumn(2); + const cpu = parseFloat(line.substring(parsedhead[2].from + offset, parsedhead[2].to + offset2).replace(/,/g, '.')); + checkColumn(3); + const mem = parseFloat(line.substring(parsedhead[3].from + offset, parsedhead[3].to + offset2).replace(/,/g, '.')); + checkColumn(4); + const priority = parseInt(line.substring(parsedhead[4].from + offset, parsedhead[4].to + offset2)); + checkColumn(5); + const vsz = parseInt(line.substring(parsedhead[5].from + offset, parsedhead[5].to + offset2)); + checkColumn(6); + const rss = parseInt(line.substring(parsedhead[6].from + offset, parsedhead[6].to + offset2)); + checkColumn(7); + const nice = parseInt(line.substring(parsedhead[7].from + offset, parsedhead[7].to + offset2)) || 0; + checkColumn(8); + const started = !_sunos ? parseElapsedTime(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim()) : parseTimeUnix(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim()); + checkColumn(9); + let state = line.substring(parsedhead[9].from + offset, parsedhead[9].to + offset2).trim(); + state = (state[0] === 'R' ? 'running' : (state[0] === 'S' ? 'sleeping' : (state[0] === 'T' ? 'stopped' : (state[0] === 'W' ? 'paging' : (state[0] === 'X' ? 'dead' : (state[0] === 'Z' ? 'zombie' : ((state[0] === 'D' || state[0] === 'U') ? 'blocked' : 'unknown'))))))); + checkColumn(10); + let tty = line.substring(parsedhead[10].from + offset, parsedhead[10].to + offset2).trim(); + if (tty === '?' || tty === '??') { tty = ''; } + checkColumn(11); + const user = line.substring(parsedhead[11].from + offset, parsedhead[11].to + offset2).trim(); + checkColumn(12); + let cmdPath = ''; + let command = ''; + let params = ''; + let fullcommand = line.substring(parsedhead[12].from + offset, parsedhead[12].to + offset2).trim(); + if (fullcommand.substr(fullcommand.length - 1) === ']') { fullcommand = fullcommand.slice(0, -1); } + if (fullcommand.substr(0, 1) === '[') { command = fullcommand.substring(1); } + else { + const p1 = fullcommand.indexOf('('); + const p2 = fullcommand.indexOf(')'); + const p3 = fullcommand.indexOf('/'); + const p4 = fullcommand.indexOf(':'); + if (p1 < p2 && p1 < p3 && p3 < p2) { + command = fullcommand.split(' ')[0]; + command = command.replace(/:/g, ''); + } else { + if (p4 > 0 && (p3 === -1 || p3 > 3)) { + command = fullcommand.split(' ')[0]; + command = command.replace(/:/g, ''); + } else { + // try to figure out where parameter starts + let firstParamPos = fullcommand.indexOf(' -'); + let firstParamPathPos = fullcommand.indexOf(' /'); + firstParamPos = (firstParamPos >= 0 ? firstParamPos : 10000); + firstParamPathPos = (firstParamPathPos >= 0 ? firstParamPathPos : 10000); + const firstPos = Math.min(firstParamPos, firstParamPathPos); + let tmpCommand = fullcommand.substr(0, firstPos); + const tmpParams = fullcommand.substr(firstPos); + const lastSlashPos = tmpCommand.lastIndexOf('/'); + if (lastSlashPos >= 0) { + cmdPath = tmpCommand.substr(0, lastSlashPos); + tmpCommand = tmpCommand.substr(lastSlashPos + 1); + } + + if (firstPos === 10000 && tmpCommand.indexOf(' ') > -1) { + const parts = tmpCommand.split(' '); + if (fs.existsSync(path.join(cmdPath, parts[0]))) { + command = parts.shift(); + params = (parts.join(' ') + ' ' + tmpParams).trim(); + } else { + command = tmpCommand.trim(); + params = tmpParams.trim(); + } + } else { + command = tmpCommand.trim(); + params = tmpParams.trim(); + } + } + } + + } + + return ({ + pid: pid, + parentPid: ppid, + name: _linux ? getName(command) : command, + cpu: cpu, + cpuu: 0, + cpus: 0, + mem: mem, + priority: priority, + memVsz: vsz, + memRss: rss, + nice: nice, + started: started, + state: state, + tty: tty, + user: user, + command: command, + params: params, + path: cmdPath + }); + } + + function parseProcesses(lines) { + let result = []; + if (lines.length > 1) { + let head = lines[0]; + parsedhead = util.parseHead(head, 8); + lines.shift(); + lines.forEach(function (line) { + if (line.trim() !== '') { + result.push(parseLine(line)); + } + }); + } + return result; + } + function parseProcesses2(lines) { + + function formatDateTime(time) { + const month = ('0' + (time.getMonth() + 1).toString()).slice(-2); + const year = time.getFullYear().toString(); + const day = ('0' + time.getDate().toString()).slice(-2); + const hours = ('0' + time.getHours().toString()).slice(-2); + const mins = ('0' + time.getMinutes().toString()).slice(-2); + const secs = ('0' + time.getSeconds().toString()).slice(-2); + + return (year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs); + } + + function parseElapsed(etime) { + let started = ''; + if (etime.indexOf('d') >= 0) { + const elapsed_parts = etime.split('d'); + started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 24 + elapsed_parts[1] * 1) * 60 * 60 * 1000)); + } else if (etime.indexOf('h') >= 0) { + const elapsed_parts = etime.split('h'); + started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 60 + elapsed_parts[1] * 1) * 60 * 1000)); + } else if (etime.indexOf(':') >= 0) { + const elapsed_parts = etime.split(':'); + started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? (elapsed_parts[0] * 60 + elapsed_parts[1]) * 1000 : elapsed_parts[0] * 1000))); + } + return started; + } + + let result = []; + lines.forEach(function (line) { + if (line.trim() !== '') { + line = line.trim().replace(/ +/g, ' ').replace(/,+/g, '.'); + const parts = line.split(' '); + const command = parts.slice(9).join(' '); + const pmem = parseFloat((1.0 * parseInt(parts[3]) * 1024 / os.totalmem()).toFixed(1)); + const started = parseElapsed(parts[5]); + + result.push({ + pid: parseInt(parts[0]), + parentPid: parseInt(parts[1]), + name: getName(command), + cpu: 0, + cpuu: 0, + cpus: 0, + mem: pmem, + priority: 0, + memVsz: parseInt(parts[2]), + memRss: parseInt(parts[3]), + nice: parseInt(parts[4]), + started: started, + state: (parts[6] === 'R' ? 'running' : (parts[6] === 'S' ? 'sleeping' : (parts[6] === 'T' ? 'stopped' : (parts[6] === 'W' ? 'paging' : (parts[6] === 'X' ? 'dead' : (parts[6] === 'Z' ? 'zombie' : ((parts[6] === 'D' || parts[6] === 'U') ? 'blocked' : 'unknown'))))))), + tty: parts[7], + user: parts[8], + command: command + }); + } + }); + return result; + } + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + all: 0, + running: 0, + blocked: 0, + sleeping: 0, + unknown: 0, + list: [] + }; + + let cmd = ''; + + if ((_processes_cpu.ms && Date.now() - _processes_cpu.ms >= 500) || _processes_cpu.ms === 0) { + if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) { + if (_linux) { cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,etime:30,state:5,tty:15,user:20,command; unset LC_ALL'; } + if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,etime,state,tty,user,command; unset LC_ALL'; } + if (_darwin) { cmd = 'ps -axo pid,ppid,pcpu,pmem,pri,vsz=temp_title_1,rss=temp_title_2,nice,etime=temp_title_3,state,tty,user,command -r'; } + if (_sunos) { cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm'; } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error && stdout.toString().trim()) { + result.list = (parseProcesses(stdout.toString().split('\n'))).slice(); + result.all = result.list.length; + result.running = result.list.filter(function (e) { + return e.state === 'running'; + }).length; + result.blocked = result.list.filter(function (e) { + return e.state === 'blocked'; + }).length; + result.sleeping = result.list.filter(function (e) { + return e.state === 'sleeping'; + }).length; + + if (_linux) { + // calc process_cpu - ps is not accurate in linux! + cmd = 'cat /proc/stat | grep "cpu "'; + result.list.forEach((element) => { + cmd += (';cat /proc/' + element.pid + '/stat'); + }); + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let curr_processes = stdout.toString().split('\n'); + + // first line (all - /proc/stat) + let all = parseProcStat(curr_processes.shift()); + + // process + let list_new = {}; + let resultProcess = {}; + curr_processes.forEach((element) => { + resultProcess = calcProcStatLinux(element, all, _processes_cpu); + + if (resultProcess.pid) { + + // store pcpu in outer array + let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid); + if (listPos >= 0) { + result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus; + result.list[listPos].cpuu = resultProcess.cpuu; + result.list[listPos].cpus = resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime, + cutime: resultProcess.cutime, + cstime: resultProcess.cstime + }; + } + }); + + // store old values + _processes_cpu.all = all; + _processes_cpu.list = Object.assign({}, list_new); + _processes_cpu.ms = Date.now() - _processes_cpu.ms; + _processes_cpu.result = Object.assign({}, result); + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,stat,tty,user,comm'; + if (_sunos) { + cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm'; + } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.shift(); + + result.list = parseProcesses2(lines).slice(); + result.all = result.list.length; + result.running = result.list.filter(function (e) { + return e.state === 'running'; + }).length; + result.blocked = result.list.filter(function (e) { + return e.state === 'blocked'; + }).length; + result.sleeping = result.list.filter(function (e) { + return e.state === 'sleeping'; + }).length; + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + }); + } else if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_Process | select-Object ProcessId,ParentProcessId,ExecutionState,Caption,CommandLine,ExecutablePath,UserModeTime,KernelModeTime,WorkingSetSize,Priority,PageFileUsage, @{n="CreationDate";e={$_.CreationDate.ToString("yyyy-MM-dd HH:mm:ss")}} | fl').then((stdout, error) => { + if (!error) { + let processSections = stdout.split(/\n\s*\n/); + let procs = []; + let procStats = []; + let list_new = {}; + let allcpuu = 0; + let allcpus = 0; + processSections.forEach((element) => { + if (element.trim() !== '') { + let lines = element.trim().split('\r\n'); + let pid = parseInt(util.getValue(lines, 'ProcessId', ':', true), 10); + let parentPid = parseInt(util.getValue(lines, 'ParentProcessId', ':', true), 10); + let statusValue = util.getValue(lines, 'ExecutionState', ':'); + let name = util.getValue(lines, 'Caption', ':', true); + let commandLine = util.getValue(lines, 'CommandLine', ':', true); + // get additional command line data + let additionalCommand = false; + lines.forEach((line) => { + if (additionalCommand && line.toLowerCase().startsWith(' ')) { + commandLine += ' ' + line.trim(); + } else { + additionalCommand = false; + } + if (line.toLowerCase().startsWith('commandline')) { + additionalCommand = true; + } + }); + let commandPath = util.getValue(lines, 'ExecutablePath', ':', true); + let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); + let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); + let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); + allcpuu = allcpuu + utime; + allcpus = allcpus + stime; + result.all++; + if (!statusValue) { result.unknown++; } + if (statusValue === '3') { result.running++; } + if (statusValue === '4' || statusValue === '5') { result.blocked++; } + + procStats.push({ + pid: pid, + utime: utime, + stime: stime, + cpu: 0, + cpuu: 0, + cpus: 0, + }); + procs.push({ + pid: pid, + parentPid: parentPid, + name: name, + cpu: 0, + cpuu: 0, + cpus: 0, + mem: memw / os.totalmem() * 100, + priority: parseInt(util.getValue(lines, 'Priority', ':', true), 10), + memVsz: parseInt(util.getValue(lines, 'PageFileUsage', ':', true), 10), + memRss: Math.floor(parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10) / 1024), + nice: 0, + started: util.getValue(lines, 'CreationDate', ':', true), + state: (!statusValue ? _winStatusValues[0] : _winStatusValues[statusValue]), + tty: '', + user: '', + command: commandLine || name, + path: commandPath, + params: '' + }); + } + }); + + result.sleeping = result.all - result.running - result.blocked - result.unknown; + result.list = procs; + procStats.forEach((element) => { + let resultProcess = calcProcStatWin(element, allcpuu + allcpus, _processes_cpu); + + // store pcpu in outer array + let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid); + if (listPos >= 0) { + result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus; + result.list[listPos].cpuu = resultProcess.cpuu; + result.list[listPos].cpus = resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime + }; + }); + + // store old values + _processes_cpu.all = allcpuu + allcpus; + _processes_cpu.all_utime = allcpuu; + _processes_cpu.all_stime = allcpus; + _processes_cpu.list = Object.assign({}, list_new); + _processes_cpu.ms = Date.now() - _processes_cpu.ms; + _processes_cpu.result = Object.assign({}, result); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(_processes_cpu.result); } + resolve(_processes_cpu.result); + } + }); + }); +} + +exports.processes = processes; + +// -------------------------- +// PS - process load +// get detailed information about a certain process +// (PID, CPU-Usage %, Mem-Usage %) + +function processLoad(proc, callback) { + + // fallback - if only callback is given + if (util.isFunction(proc) && !callback) { + callback = proc; + proc = ''; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + proc = proc || ''; + + if (typeof proc !== 'string') { + if (callback) { callback([]); } + return resolve([]); + } + + let processesString = ''; + processesString.__proto__.toLowerCase = util.stringToLower; + processesString.__proto__.replace = util.stringReplace; + processesString.__proto__.trim = util.stringTrim; + + const s = util.sanitizeShellString(proc); + const l = util.mathMin(s.length, 2000); + + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + processesString = processesString + s[i]; + } + } + + processesString = processesString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|'); + if (processesString === '') { + processesString = '*'; + } + if (util.isPrototypePolluted() && processesString !== '*') { + processesString = '------'; + } + let processes = processesString.split('|'); + let result = []; + + const procSanitized = util.isPrototypePolluted() ? '' : util.sanitizeShellString(proc); + + // from here new + // let result = { + // 'proc': procSanitized, + // 'pid': null, + // 'cpu': 0, + // 'mem': 0 + // }; + if (procSanitized && processes.length && processes[0] !== '------') { + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_Process | select ProcessId,Caption,UserModeTime,KernelModeTime,WorkingSetSize | fl').then((stdout, error) => { + if (!error) { + let processSections = stdout.split(/\n\s*\n/); + let procStats = []; + let list_new = {}; + let allcpuu = 0; + let allcpus = 0; + + // go through all processes + processSections.forEach((element) => { + if (element.trim() !== '') { + let lines = element.trim().split('\r\n'); + let pid = parseInt(util.getValue(lines, 'ProcessId', ':', true), 10); + let name = util.getValue(lines, 'Caption', ':', true); + let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); + let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); + let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); + allcpuu = allcpuu + utime; + allcpus = allcpus + stime; + + procStats.push({ + pid: pid, + name, + utime: utime, + stime: stime, + cpu: 0, + cpuu: 0, + cpus: 0, + mem + }); + let pname = ''; + let inList = false; + processes.forEach(function (proc) { + if (name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) { + inList = true; + pname = proc; + } + }); + + if (processesString === '*' || inList) { + let processFound = false; + result.forEach(function (item) { + if (item.proc.toLowerCase() === pname.toLowerCase()) { + item.pids.push(pid); + item.mem += mem / os.totalmem() * 100; + processFound = true; + } + }); + if (!processFound) { + result.push({ + proc: pname, + pid: pid, + pids: [pid], + cpu: 0, + mem: mem / os.totalmem() * 100 + }); + } + } + } + }); + + // add missing processes + if (processesString !== '*') { + let processesMissing = processes.filter(function (name) { + return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0; + + }); + processesMissing.forEach(function (procName) { + result.push({ + proc: procName, + pid: null, + pids: [], + cpu: 0, + mem: 0 + }); + }); + } + + // calculate proc stats for each proc + procStats.forEach((element) => { + let resultProcess = calcProcStatWin(element, allcpuu + allcpus, _process_cpu); + + let listPos = -1; + for (let j = 0; j < result.length; j++) { + if (result[j].pid === resultProcess.pid || result[j].pids.indexOf(resultProcess.pid) >= 0) { listPos = j; } + } + if (listPos >= 0) { + result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime + }; + }); + + // store old values + _process_cpu.all = allcpuu + allcpus; + _process_cpu.all_utime = allcpuu; + _process_cpu.all_stime = allcpus; + _process_cpu.list = Object.assign({}, list_new); + _process_cpu.ms = Date.now() - _process_cpu.ms; + _process_cpu.result = JSON.parse(JSON.stringify(result)); + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + + if (_darwin || _linux || _freebsd || _openbsd || _netbsd) { + const params = ['-axo', 'pid,ppid,pcpu,pmem,comm']; + util.execSafe('ps', params).then((stdout) => { + if (stdout) { + let procStats = []; + let lines = stdout.toString().split('\n').filter(function (line) { + if (processesString === '*') { return true; } + if (line.toLowerCase().indexOf('grep') !== -1) { return false; } // remove this?? + let found = false; + processes.forEach(function (item) { + found = found || (line.toLowerCase().indexOf(item.toLowerCase()) >= 0); + }); + return found; + }); + + lines.forEach(function (line) { + let data = line.trim().replace(/ +/g, ' ').split(' '); + if (data.length > 4) { + procStats.push({ + name: data[4].substring(data[4].lastIndexOf('/') + 1), + pid: parseInt(data[0]) || 0, + ppid: parseInt(data[1]) || 0, + cpu: parseFloat(data[2].replace(',', '.')), + mem: parseFloat(data[3].replace(',', '.')) + }); + } + }); + + procStats.forEach(function (item) { + let listPos = -1; + let inList = false; + let name = ''; + for (let j = 0; j < result.length; j++) { + if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) { + listPos = j; + } + } + processes.forEach(function (proc) { + + if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) { + inList = true; + name = proc; + } + }); + if ((processesString === '*') || inList) { + if (listPos < 0) { + result.push({ + proc: name, + pid: item.pid, + pids: [item.pid], + cpu: item.cpu, + mem: item.mem + }); + } else { + if (item.ppid < 10) { + result[listPos].pid = item.pid; + } + result[listPos].pids.push(item.pid); + result[listPos].cpu += item.cpu; + result[listPos].mem += item.mem; + } + } + }); + + if (processesString !== '*') { + // add missing processes + let processesMissing = processes.filter(function (name) { + return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0; + }); + processesMissing.forEach(function (procName) { + result.push({ + proc: procName, + pid: null, + pids: [], + cpu: 0, + mem: 0 + }); + }); + } + if (_linux) { + // calc process_cpu - ps is not accurate in linux! + result.forEach(function (item) { + item.cpu = 0; + }); + let cmd = 'cat /proc/stat | grep "cpu "'; + for (let i in result) { + for (let j in result[i].pids) { + cmd += (';cat /proc/' + result[i].pids[j] + '/stat'); + } + } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let curr_processes = stdout.toString().split('\n'); + + // first line (all - /proc/stat) + let all = parseProcStat(curr_processes.shift()); + + // process + let list_new = {}; + let resultProcess = {}; + curr_processes.forEach((element) => { + resultProcess = calcProcStatLinux(element, all, _process_cpu); + + if (resultProcess.pid) { + + // find result item + let resultItemId = -1; + for (let i in result) { + if (result[i].pids.indexOf(resultProcess.pid) >= 0) { + resultItemId = i; + } + } + // store pcpu in outer result + if (resultItemId >= 0) { + result[resultItemId].cpu += resultProcess.cpuu + resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime, + cutime: resultProcess.cutime, + cstime: resultProcess.cstime + }; + } + }); + + result.forEach(function (item) { + item.cpu = Math.round(item.cpu * 100) / 100; + }); + + _process_cpu.all = all; + _process_cpu.list = Object.assign({}, list_new); + _process_cpu.ms = Date.now() - _process_cpu.ms; + _process_cpu.result = Object.assign({}, result); + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + } + }); + }); +} + +exports.processLoad = processLoad; + + +/***/ }), + +/***/ 3888: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// system.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 2. System (Hardware, BIOS, Base Board) +// ---------------------------------------------------------------------------------- + +const fs = __nccwpck_require__(57147); +const os = __nccwpck_require__(22037); +const util = __nccwpck_require__(19872); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const execPromise = util.promisify((__nccwpck_require__(32081).exec)); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function system(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + manufacturer: '', + model: 'Computer', + version: '', + serial: '-', + uuid: '-', + sku: '-', + virtual: false + }; + + if (_linux || _freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL', function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.manufacturer = util.getValue(lines, 'manufacturer'); + result.model = util.getValue(lines, 'product name'); + result.version = util.getValue(lines, 'version'); + result.serial = util.getValue(lines, 'serial number'); + result.uuid = util.getValue(lines, 'uuid').toLowerCase(); + result.sku = util.getValue(lines, 'sku number'); + // Non-Root values + const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo; + echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo; + echo -n "product_uuid: "; cat /sys/devices/virtual/dmi/id/product_uuid 2>/dev/null; echo; + echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo; + echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;`; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer; + result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model; + result.version = result.version === '' ? util.getValue(lines, 'product_version') : result.version; + result.serial = result.serial === '' ? util.getValue(lines, 'product_serial') : result.serial; + result.uuid = result.uuid === '' ? util.getValue(lines, 'product_uuid').toLowerCase() : result.uuid; + } catch (e) { + util.noop(); + } + if (!result.serial || result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } + if (!result.manufacturer || result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = ''; } + if (!result.model || result.model.toLowerCase().indexOf('o.e.m.') !== -1) { result.model = 'Computer'; } + if (!result.version || result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = ''; } + if (!result.sku || result.sku.toLowerCase().indexOf('o.e.m.') !== -1) { result.sku = '-'; } + + // detect virtual (1) + if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware') || result.model.toLowerCase().startsWith('droplet')) { + result.virtual = true; + switch (result.model.toLowerCase()) { + case 'virtualbox': + result.virtualHost = 'VirtualBox'; + break; + case 'vmware': + result.virtualHost = 'VMware'; + break; + case 'kvm': + result.virtualHost = 'KVM'; + break; + case 'bochs': + result.virtualHost = 'bochs'; + break; + } + } + if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') { + result.virtual = true; + switch (result.manufacturer.toLowerCase()) { + case 'vmware': + result.virtualHost = 'VMware'; + break; + case 'xen': + result.virtualHost = 'Xen'; + break; + } + } + if (!result.virtual) { + try { + const disksById = execSync('ls -1 /dev/disk/by-id/ 2>/dev/null', util.execOptsLinux).toString(); + if (disksById.indexOf('_QEMU_') >= 0) { + result.virtual = true; + result.virtualHost = 'QEMU'; + } + if (disksById.indexOf('_VBOX_') >= 0) { + result.virtual = true; + result.virtualHost = 'VirtualBox'; + } + } catch (e) { + util.noop(); + } + } + if (!result.virtual && (os.release().toLowerCase().indexOf('microsoft') >= 0 || os.release().toLowerCase().endsWith('wsl2'))) { + const kernelVersion = parseFloat(os.release().toLowerCase()); + result.virtual = true; + result.manufacturer = 'Microsoft'; + result.model = 'WSL'; + result.version = kernelVersion < 4.19 ? '1' : '2'; + } + if ((_freebsd || _openbsd || _netbsd) && !result.virtualHost) { + try { + const procInfo = execSync('dmidecode -t 4', util.execOptsLinux); + const procLines = procInfo.toString().split('\n'); + const procManufacturer = util.getValue(procLines, 'manufacturer', ':', true); + switch (procManufacturer.toLowerCase()) { + case 'virtualbox': + result.virtualHost = 'VirtualBox'; + break; + case 'vmware': + result.virtualHost = 'VMware'; + break; + case 'kvm': + result.virtualHost = 'KVM'; + break; + case 'bochs': + result.virtualHost = 'bochs'; + break; + } + } catch (e) { + util.noop(); + } + } + // detect docker + if (fs.existsSync('/.dockerenv') || fs.existsSync('/.dockerinit')) { + result.model = 'Docker Container'; + } + try { + const stdout = execSync('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen" | grep -viE "Nested Virtualization|/virtual/"'); + // detect virtual machines + let lines = stdout.toString().split('\n'); + if (lines.length > 0) { + if (result.model === 'Computer') { result.model = 'Virtual machine'; } + result.virtual = true; + if (stdout.toString().toLowerCase().indexOf('vmware') >= 0 && !result.virtualHost) { + result.virtualHost = 'VMware'; + } + if (stdout.toString().toLowerCase().indexOf('qemu') >= 0 && !result.virtualHost) { + result.virtualHost = 'QEMU'; + } + if (stdout.toString().toLowerCase().indexOf('xen') >= 0 && !result.virtualHost) { + result.virtualHost = 'Xen'; + } + if (stdout.toString().toLowerCase().indexOf('kvm') >= 0 && !result.virtualHost) { + result.virtualHost = 'KVM'; + } + } + } catch (e) { + util.noop(); + } + + if (result.manufacturer === '' && result.model === 'Computer' && result.version === '') { + // Check Raspberry Pi + fs.readFile('/proc/cpuinfo', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.model = util.getValue(lines, 'hardware', ':', true).toUpperCase(); + result.version = util.getValue(lines, 'revision', ':', true).toLowerCase(); + result.serial = util.getValue(lines, 'serial', ':', true); + const model = util.getValue(lines, 'model:', ':', true); + // reference values: https://elinux.org/RPi_HardwareHistory + // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md + if ((result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2710' || result.model === 'BCM2711' || result.model === 'BCM2836' || result.model === 'BCM2837') && model.toLowerCase().indexOf('raspberry') >= 0) { + const rPIRevision = util.decodePiCpuinfo(lines); + result.model = rPIRevision.model; + result.version = rPIRevision.revisionCode; + result.manufacturer = 'Raspberry Pi Foundation'; + result.raspberry = { + manufacturer: rPIRevision.manufacturer, + processor: rPIRevision.processor, + type: rPIRevision.type, + revision: rPIRevision.revision + }; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + if (_darwin) { + exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) { + if (!error) { + let lines = stdout.toString().replace(/[<>"]/g, '').split('\n'); + const model = util.splitByNumber(util.getValue(lines, 'model', '=', true)); + const version = util.getValue(lines, 'version', '=', true); + result.manufacturer = util.getValue(lines, 'manufacturer', '=', true); + result.model = version ? util.getValue(lines, 'model', '=', true) : model[0]; + result.version = version || model[1]; + result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true); + result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase(); + result.sku = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-sub-type', '=', true); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select Name,Vendor,Version,IdentifyingNumber,UUID | fl').then((stdout, error) => { + if (!error) { + let lines = stdout.split('\r\n'); + result.manufacturer = util.getValue(lines, 'vendor', ':'); + result.model = util.getValue(lines, 'name', ':'); + result.version = util.getValue(lines, 'version', ':'); + result.serial = util.getValue(lines, 'identifyingnumber', ':'); + result.uuid = util.getValue(lines, 'uuid', ':').toLowerCase(); + // detect virtual (1) + const model = result.model.toLowerCase(); + if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu') || model.startsWith('parallels')) { + result.virtual = true; + if (model.startsWith('virtualbox')) { result.virtualHost = 'VirtualBox'; } + if (model.startsWith('vmware')) { result.virtualHost = 'VMware'; } + if (model.startsWith('kvm')) { result.virtualHost = 'KVM'; } + if (model.startsWith('bochs')) { result.virtualHost = 'bochs'; } + if (model.startsWith('qemu')) { result.virtualHost = 'KVM'; } + if (model.startsWith('parallels')) { result.virtualHost = 'Parallels'; } + } + const manufacturer = result.manufacturer.toLowerCase(); + if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen' || manufacturer.startsWith('parallels')) { + result.virtual = true; + if (manufacturer.startsWith('vmware')) { result.virtualHost = 'VMware'; } + if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; } + if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; } + if (manufacturer.startsWith('parallels')) { result.virtualHost = 'Parallels'; } + } + util.powerShell('Get-CimInstance MS_Systeminformation -Namespace "root/wmi" | select systemsku | fl ').then((stdout, error) => { + if (!error) { + let lines = stdout.split('\r\n'); + result.sku = util.getValue(lines, 'systemsku', ':'); + } + if (!result.virtual) { + util.powerShell('Get-CimInstance Win32_bios | select Version, SerialNumber, SMBIOSBIOSVersion').then((stdout, error) => { + if (!error) { + let lines = stdout.toString(); + if (lines.indexOf('VRTUAL') >= 0 || lines.indexOf('A M I ') >= 0 || lines.indexOf('VirtualBox') >= 0 || lines.indexOf('VMWare') >= 0 || lines.indexOf('Xen') >= 0 || lines.indexOf('Parallels') >= 0) { + result.virtual = true; + if (lines.indexOf('VirtualBox') >= 0 && !result.virtualHost) { + result.virtualHost = 'VirtualBox'; + } + if (lines.indexOf('VMware') >= 0 && !result.virtualHost) { + result.virtualHost = 'VMware'; + } + if (lines.indexOf('Xen') >= 0 && !result.virtualHost) { + result.virtualHost = 'Xen'; + } + if (lines.indexOf('VRTUAL') >= 0 && !result.virtualHost) { + result.virtualHost = 'Hyper-V'; + } + if (lines.indexOf('A M I') >= 0 && !result.virtualHost) { + result.virtualHost = 'Virtual PC'; + } + if (lines.indexOf('Parallels') >= 0 && !result.virtualHost) { + result.virtualHost = 'Parallels'; + } + } + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.system = system; + +function cleanDefaults(s) { + const cmpStr = s.toLowerCase(); + if (cmpStr.indexOf('o.e.m.') === -1 && cmpStr.indexOf('default string') === -1 && cmpStr !== 'default') { + return s || ''; + } + return ''; +} +function bios(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + vendor: '', + version: '', + releaseDate: '', + revision: '', + }; + let cmd = ''; + if (_linux || _freebsd || _openbsd || _netbsd) { + if (process.arch === 'arm') { + cmd = 'cat /proc/cpuinfo | grep Serial'; + } else { + cmd = 'export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL'; + } + exec(cmd, function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.vendor = util.getValue(lines, 'Vendor'); + result.version = util.getValue(lines, 'Version'); + let datetime = util.getValue(lines, 'Release Date'); + result.releaseDate = util.parseDateTime(datetime).date; + result.revision = util.getValue(lines, 'BIOS Revision'); + result.serial = util.getValue(lines, 'SerialNumber'); + let language = util.getValue(lines, 'Currently Installed Language').split('|')[0]; + if (language) { + result.language = language; + } + if (lines.length && stdout.toString().indexOf('Characteristics:') >= 0) { + const features = []; + lines.forEach(line => { + if (line.indexOf(' is supported') >= 0) { + const feature = line.split(' is supported')[0].trim(); + features.push(feature); + } + }); + result.features = features; + } + // Non-Root values + const cmd = `echo -n "bios_date: "; cat /sys/devices/virtual/dmi/id/bios_date 2>/dev/null; echo; + echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo; + echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;`; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + result.vendor = !result.vendor ? util.getValue(lines, 'bios_vendor') : result.vendor; + result.version = !result.version ? util.getValue(lines, 'bios_version') : result.version; + datetime = util.getValue(lines, 'bios_date'); + result.releaseDate = !result.releaseDate ? util.parseDateTime(datetime).date : result.releaseDate; + } catch (e) { + util.noop(); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + result.vendor = 'Apple Inc.'; + exec( + 'system_profiler SPHardwareDataType -json', function (error, stdout) { + try { + const hardwareData = JSON.parse(stdout.toString()); + if (hardwareData && hardwareData.SPHardwareDataType && hardwareData.SPHardwareDataType.length) { + let bootRomVersion = hardwareData.SPHardwareDataType[0].boot_rom_version; + bootRomVersion = bootRomVersion ? bootRomVersion.split('(')[0].trim() : null; + result.version = bootRomVersion; + } + } catch (e) { + util.noop(); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + result.vendor = 'Sun Microsystems'; + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_bios | select Description,Version,Manufacturer,@{n="ReleaseDate";e={$_.ReleaseDate.ToString("yyyy-MM-dd")}},BuildNumber,SerialNumber,SMBIOSBIOSVersion | fl').then((stdout, error) => { + if (!error) { + let lines = stdout.toString().split('\r\n'); + const description = util.getValue(lines, 'description', ':'); + const version = util.getValue(lines, 'SMBIOSBIOSVersion', ':'); + if (description.indexOf(' Version ') !== -1) { + // ... Phoenix ROM BIOS PLUS Version 1.10 A04 + result.vendor = description.split(' Version ')[0].trim(); + result.version = description.split(' Version ')[1].trim(); + } else if (description.indexOf(' Ver: ') !== -1) { + // ... BIOS Date: 06/27/16 17:50:16 Ver: 1.4.5 + result.vendor = util.getValue(lines, 'manufacturer', ':'); + result.version = description.split(' Ver: ')[1].trim(); + } else { + result.vendor = util.getValue(lines, 'manufacturer', ':'); + result.version = version || util.getValue(lines, 'version', ':'); + } + result.releaseDate = util.getValue(lines, 'releasedate', ':'); + result.revision = util.getValue(lines, 'buildnumber', ':'); + result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':')); + } + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.bios = bios; + +function baseboard(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + manufacturer: '', + model: '', + version: '', + serial: '-', + assetTag: '-', + memMax: null, + memSlots: null + }; + let cmd = ''; + if (_linux || _freebsd || _openbsd || _netbsd) { + if (process.arch === 'arm') { + cmd = 'cat /proc/cpuinfo | grep Serial'; + // 'BCM2709', 'BCM2835', 'BCM2708' --> + } else { + cmd = 'export LC_ALL=C; dmidecode -t 2 2>/dev/null; unset LC_ALL'; + } + const workload = []; + workload.push(execPromise(cmd)); + workload.push(execPromise('export LC_ALL=C; dmidecode -t memory 2>/dev/null')); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().split('\n') : ['']; + result.manufacturer = util.getValue(lines, 'Manufacturer'); + result.model = util.getValue(lines, 'Product Name'); + result.version = util.getValue(lines, 'Version'); + result.serial = util.getValue(lines, 'Serial Number'); + result.assetTag = util.getValue(lines, 'Asset Tag'); + // Non-Root values + const cmd = `echo -n "board_asset_tag: "; cat /sys/devices/virtual/dmi/id/board_asset_tag 2>/dev/null; echo; + echo -n "board_name: "; cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null; echo; + echo -n "board_serial: "; cat /sys/devices/virtual/dmi/id/board_serial 2>/dev/null; echo; + echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo; + echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;`; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + result.manufacturer = !result.manufacturer ? util.getValue(lines, 'board_vendor') : result.manufacturer; + result.model = !result.model ? util.getValue(lines, 'board_name') : result.model; + result.version = !result.version ? util.getValue(lines, 'board_version') : result.version; + result.serial = !result.serial ? util.getValue(lines, 'board_serial') : result.serial; + result.assetTag = !result.assetTag ? util.getValue(lines, 'board_asset_tag') : result.assetTag; + } catch (e) { + util.noop(); + } + if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } + if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; } + + // mem + lines = data.results[1] ? data.results[1].toString().split('\n') : ['']; + result.memMax = util.toInt(util.getValue(lines, 'Maximum Capacity')) * 1024 * 1024 * 1024 || null; + result.memSlots = util.toInt(util.getValue(lines, 'Number Of Devices')) || null; + + // raspberry + let linesRpi = ''; + try { + linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n'); + } catch (e) { + util.noop(); + } + if (linesRpi) { + const hardware = util.getValue(linesRpi, 'hardware'); + if (hardware.startsWith('BCM')) { + const rpi = util.decodePiCpuinfo(linesRpi); + result.manufacturer = rpi.manufacturer; + result.model = 'Raspberry Pi'; + result.serial = rpi.serial; + result.version = rpi.type + ' - ' + rpi.revision; + result.memMax = os.totalmem(); + result.memSlots = 0; + } + } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + const workload = []; + workload.push(execPromise('ioreg -c IOPlatformExpertDevice -d 2')); + workload.push(execPromise('system_profiler SPMemoryDataType')); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().replace(/[<>"]/g, '').split('\n') : ['']; + result.manufacturer = util.getValue(lines, 'manufacturer', '=', true); + result.model = util.getValue(lines, 'model', '=', true); + result.version = util.getValue(lines, 'version', '=', true); + result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true); + result.assetTag = util.getValue(lines, 'board-id', '=', true); + + // mem + let devices = data.results[1] ? data.results[1].toString().split(' BANK ') : ['']; + if (devices.length === 1) { + devices = data.results[1] ? data.results[1].toString().split(' DIMM') : ['']; + } + devices.shift(); + result.memSlots = devices.length; + + if (os.arch() === 'arm64') { + result.memSlots = 0; + result.memMax = os.totalmem(); + } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + const workload = []; + const win10plus = parseInt(os.release()) >= 10; + const maxCapacityAttribute = win10plus ? 'MaxCapacityEx' : 'MaxCapacity'; + workload.push(util.powerShell('Get-CimInstance Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl')); + workload.push(util.powerShell(`Get-CimInstance Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`)); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().split('\r\n') : ['']; + + result.manufacturer = cleanDefaults(util.getValue(lines, 'manufacturer', ':')); + result.model = cleanDefaults(util.getValue(lines, 'model', ':')); + if (!result.model) { + result.model = cleanDefaults(util.getValue(lines, 'product', ':')); + } + result.version = cleanDefaults(util.getValue(lines, 'version', ':')); + result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':')); + result.assetTag = cleanDefaults(util.getValue(lines, 'partnumber', ':')); + if (!result.assetTag) { + result.assetTag = cleanDefaults(util.getValue(lines, 'sku', ':')); + } + + // memphysical + lines = data.results[1] ? data.results[1].toString().split('\r\n') : ['']; + result.memMax = util.toInt(util.getValue(lines, maxCapacityAttribute, ':')) * (win10plus ? 1024 : 1) || null; + result.memSlots = util.toInt(util.getValue(lines, 'MemoryDevices', ':')) || null; + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.baseboard = baseboard; + +function macOsChassisType(model) { + model = model.toLowerCase(); + if (model.startsWith('macbookair')) { return 'Notebook'; } + if (model.startsWith('macbookpro')) { return 'Laptop'; } + if (model.startsWith('macbook')) { return 'Notebook'; } + if (model.startsWith('macmini')) { return 'Desktop'; } + if (model.startsWith('imac')) { return 'Desktop'; } + if (model.startsWith('macstudio')) { return 'Desktop'; } + if (model.startsWith('macpro')) { return 'Tower'; } + return 'Other'; +} + +function chassis(callback) { + const chassisTypes = ['Other', + 'Unknown', + 'Desktop', + 'Low Profile Desktop', + 'Pizza Box', + 'Mini Tower', + 'Tower', + 'Portable', + 'Laptop', + 'Notebook', + 'Hand Held', + 'Docking Station', + 'All in One', + 'Sub Notebook', + 'Space-Saving', + 'Lunch Box', + 'Main System Chassis', + 'Expansion Chassis', + 'SubChassis', + 'Bus Expansion Chassis', + 'Peripheral Chassis', + 'Storage Chassis', + 'Rack Mount Chassis', + 'Sealed-Case PC', + 'Multi-System Chassis', + 'Compact PCI', + 'Advanced TCA', + 'Blade', + 'Blade Enclosure', + 'Tablet', + 'Convertible', + 'Detachable', + 'IoT Gateway ', + 'Embedded PC', + 'Mini PC', + 'Stick PC', + ]; + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + manufacturer: '', + model: '', + type: '', + version: '', + serial: '-', + assetTag: '-', + sku: '', + }; + if (_linux || _freebsd || _openbsd || _netbsd) { + const cmd = `echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo; + echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo; + echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo; + echo -n "chassis_vendor: "; cat /sys/devices/virtual/dmi/id/chassis_vendor 2>/dev/null; echo; + echo -n "chassis_version: "; cat /sys/devices/virtual/dmi/id/chassis_version 2>/dev/null; echo;`; + exec(cmd, function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.manufacturer = util.getValue(lines, 'chassis_vendor'); + const ctype = parseInt(util.getValue(lines, 'chassis_type').replace(/\D/g, '')); + result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : ''; + result.version = util.getValue(lines, 'chassis_version'); + result.serial = util.getValue(lines, 'chassis_serial'); + result.assetTag = util.getValue(lines, 'chassis_asset_tag'); + if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = '-'; } + if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = '-'; } + if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } + if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) { + if (!error) { + let lines = stdout.toString().replace(/[<>"]/g, '').split('\n'); + const model = util.getValue(lines, 'model', '=', true); + const modelParts = util.splitByNumber(model); + const version = util.getValue(lines, 'version', '=', true); + result.manufacturer = util.getValue(lines, 'manufacturer', '=', true); + result.model = version ? util.getValue(lines, 'model', '=', true) : modelParts[0]; + result.type = macOsChassisType(result.model); + result.version = version || model; + result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true); + result.assetTag = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-type', '=', true); + result.sku = util.getValue(lines, 'target-sub-type', '=', true); + } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU,SMBIOSAssetTag | fl').then((stdout, error) => { + if (!error) { + let lines = stdout.toString().split('\r\n'); + + result.manufacturer = cleanDefaults(util.getValue(lines, 'manufacturer', ':')); + result.model = cleanDefaults(util.getValue(lines, 'model', ':')); + const ctype = parseInt(util.getValue(lines, 'ChassisTypes', ':').replace(/\D/g, '')); + result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : ''; + result.version = cleanDefaults(util.getValue(lines, 'version', ':')); + result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':')); + result.assetTag = cleanDefaults(util.getValue(lines, 'partnumber', ':')); + if (!result.assetTag) { + result.assetTag = cleanDefaults(util.getValue(lines, 'SMBIOSAssetTag', ':')); + } + result.sku = cleanDefaults(util.getValue(lines, 'sku', ':')); + } + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.chassis = chassis; + + +/***/ }), + +/***/ 91061: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// usb.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 16. usb +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(32081).exec); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function getLinuxUsbType(type, name) { + let result = type; + const str = (name + ' ' + type).toLowerCase(); + if (str.indexOf('camera') >= 0) { result = 'Camera'; } + else if (str.indexOf('hub') >= 0) { result = 'Hub'; } + else if (str.indexOf('keybrd') >= 0) { result = 'Keyboard'; } + else if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + else if (str.indexOf('mouse') >= 0) { result = 'Mouse'; } + else if (str.indexOf('stora') >= 0) { result = 'Storage'; } + else if (str.indexOf('microp') >= 0) { result = 'Microphone'; } + else if (str.indexOf('headset') >= 0) { result = 'Audio'; } + else if (str.indexOf('audio') >= 0) { result = 'Audio'; } + + return result; +} + +function parseLinuxUsb(usb) { + const result = {}; + const lines = usb.split('\n'); + if (lines && lines.length && lines[0].indexOf('Device') >= 0) { + const parts = lines[0].split(' '); + result.bus = parseInt(parts[0], 10); + if (parts[2]) { + result.deviceId = parseInt(parts[2], 10); + } else { + result.deviceId = null; + } + } else { + result.bus = null; + result.deviceId = null; + } + const idVendor = util.getValue(lines, 'idVendor', ' ', true).trim(); + let vendorParts = idVendor.split(' '); + vendorParts.shift(); + const vendor = vendorParts.join(' '); + + const idProduct = util.getValue(lines, 'idProduct', ' ', true).trim(); + let productParts = idProduct.split(' '); + productParts.shift(); + const product = productParts.join(' '); + + const interfaceClass = util.getValue(lines, 'bInterfaceClass', ' ', true).trim(); + let interfaceClassParts = interfaceClass.split(' '); + interfaceClassParts.shift(); + const usbType = interfaceClassParts.join(' '); + + const iManufacturer = util.getValue(lines, 'iManufacturer', ' ', true).trim(); + let iManufacturerParts = iManufacturer.split(' '); + iManufacturerParts.shift(); + const manufacturer = iManufacturerParts.join(' '); + + const iSerial = util.getValue(lines, 'iSerial', ' ', true).trim(); + let iSerialParts = iSerial.split(' '); + iSerialParts.shift(); + const serial = iSerialParts.join(' '); + + result.id = (idVendor.startsWith('0x') ? idVendor.split(' ')[0].substr(2, 10) : '') + ':' + (idProduct.startsWith('0x') ? idProduct.split(' ')[0].substr(2, 10) : ''); + result.name = product; + result.type = getLinuxUsbType(usbType, product); + result.removable = null; + result.vendor = vendor; + result.manufacturer = manufacturer; + result.maxPower = util.getValue(lines, 'MaxPower', ' ', true); + result.serialNumber = serial; + + return result; +} + +function getDarwinUsbType(name) { + let result = ''; + if (name.indexOf('camera') >= 0) { result = 'Camera'; } + else if (name.indexOf('touch bar') >= 0) { result = 'Touch Bar'; } + else if (name.indexOf('controller') >= 0) { result = 'Controller'; } + else if (name.indexOf('headset') >= 0) { result = 'Audio'; } + else if (name.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + else if (name.indexOf('trackpad') >= 0) { result = 'Trackpad'; } + else if (name.indexOf('sensor') >= 0) { result = 'Sensor'; } + else if (name.indexOf('bthusb') >= 0) { result = 'Bluetooth'; } + else if (name.indexOf('bth') >= 0) { result = 'Bluetooth'; } + else if (name.indexOf('rfcomm') >= 0) { result = 'Bluetooth'; } + else if (name.indexOf('usbhub') >= 0) { result = 'Hub'; } + else if (name.indexOf(' hub') >= 0) { result = 'Hub'; } + else if (name.indexOf('mouse') >= 0) { result = 'Mouse'; } + else if (name.indexOf('microp') >= 0) { result = 'Microphone'; } + else if (name.indexOf('removable') >= 0) { result = 'Storage'; } + return result; +} + +function parseDarwinUsb(usb, id) { + const result = {}; + result.id = id; + + usb = usb.replace(/ \|/g, ''); + usb = usb.trim(); + let lines = usb.split('\n'); + lines.shift(); + try { + for (let i = 0; i < lines.length; i++) { + lines[i] = lines[i].trim(); + lines[i] = lines[i].replace(/=/g, ':'); + if (lines[i] !== '{' && lines[i] !== '}' && lines[i + 1] && lines[i + 1].trim() !== '}') { + lines[i] = lines[i] + ','; + } + + lines[i] = lines[i].replace(':Yes,', ':"Yes",'); + lines[i] = lines[i].replace(': Yes,', ': "Yes",'); + lines[i] = lines[i].replace(': Yes', ': "Yes"'); + lines[i] = lines[i].replace(':No,', ':"No",'); + lines[i] = lines[i].replace(': No,', ': "No",'); + lines[i] = lines[i].replace(': No', ': "No"'); + + // In this case (("com.apple.developer.driverkit.transport.usb")) + lines[i] = lines[i].replace('((', '').replace('))', ''); + + // In case we have <923c11> we need make it "<923c11>" for correct JSON parse + const match = /<(\w+)>/.exec(lines[i]); + if (match) { + const number = match[0]; + lines[i] = lines[i].replace(number, `"${number}"`); + } + } + const usbObj = JSON.parse(lines.join('\n')); + const removableDrive = (usbObj['Built-In'] ? usbObj['Built-In'].toLowerCase() !== 'yes' : true) && (usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() === 'no' : true); + + result.bus = null; + result.deviceId = null; + result.id = usbObj['USB Address'] || null; + result.name = usbObj['kUSBProductString'] || usbObj['USB Product Name'] || null; + result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : '')); + result.removable = usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() || '' === 'no' : true; + result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null; + result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null; + + result.maxPower = null; + result.serialNumber = usbObj['kUSBSerialNumberString'] || null; + + if (result.name) { + return result; + } else { + return null; + } + } catch (e) { + return null; + } +} + +function getWindowsUsbTypeCreation(creationclass, name) { + let result = ''; + if (name.indexOf('storage') >= 0) { result = 'Storage'; } + else if (name.indexOf('speicher') >= 0) { result = 'Storage'; } + else if (creationclass.indexOf('usbhub') >= 0) { result = 'Hub'; } + else if (creationclass.indexOf('storage') >= 0) { result = 'Storage'; } + else if (creationclass.indexOf('usbcontroller') >= 0) { result = 'Controller'; } + else if (creationclass.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + else if (creationclass.indexOf('pointing') >= 0) { result = 'Mouse'; } + else if (creationclass.indexOf('microp') >= 0) { result = 'Microphone'; } + else if (creationclass.indexOf('disk') >= 0) { result = 'Storage'; } + return result; +} + +function parseWindowsUsb(lines, id) { + const usbType = getWindowsUsbTypeCreation(util.getValue(lines, 'CreationClassName', ':').toLowerCase(), util.getValue(lines, 'name', ':').toLowerCase()); + + if (usbType) { + const result = {}; + result.bus = null; + result.deviceId = util.getValue(lines, 'deviceid', ':'); + result.id = id; + result.name = util.getValue(lines, 'name', ':'); + result.type = usbType; + result.removable = null; + result.vendor = null; + result.manufacturer = util.getValue(lines, 'Manufacturer', ':'); + result.maxPower = null; + result.serialNumber = null; + + return result; + } else { + return null; + } +} + +function usb(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux) { + const cmd = 'export LC_ALL=C; lsusb -v 2>/dev/null; unset LC_ALL'; + exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) { + if (!error) { + const parts = ('\n\n' + stdout.toString()).split('\n\nBus '); + for (let i = 1; i < parts.length; i++) { + const usb = parseLinuxUsb(parts[i]); + result.push(usb); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_darwin) { + let cmd = 'ioreg -p IOUSB -c AppleUSBRootHubDevice -w0 -l'; + exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) { + if (!error) { + const parts = (stdout.toString()).split(' +-o '); + for (let i = 1; i < parts.length; i++) { + const usb = parseDarwinUsb(parts[i]); + if (usb) { + result.push(usb); + } + } + if (callback) { + callback(result); + } + resolve(result); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + util.powerShell('Get-CimInstance CIM_LogicalDevice | where { $_.Description -match "USB"} | select Name,CreationClassName,DeviceId,Manufacturer | fl').then((stdout, error) => { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + for (let i = 0; i < parts.length; i++) { + const usb = parseWindowsUsb(parts[i].split('\n'), i); + if (usb && result.filter(x => x.deviceId === usb.deviceId).length === 0) { + result.push(usb); + } + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos || _freebsd || _openbsd || _netbsd) { + resolve(null); + } + }); + }); +} + +exports.usb = usb; + + + +/***/ }), + +/***/ 19750: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// users.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 11. Users/Sessions +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(32081).exec); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseUsersLinux(lines, phase) { + let result = []; + let result_who = []; + let result_w = {}; + let w_first = true; + let w_header = []; + let w_pos = []; + let who_line = {}; + + let is_whopart = true; + lines.forEach(function (line) { + if (line === '---') { + is_whopart = false; + } else { + let l = line.replace(/ +/g, ' ').split(' '); + + // who part + if (is_whopart) { + result_who.push({ + user: l[0], + tty: l[1], + date: l[2], + time: l[3], + ip: (l && l.length > 4) ? l[4].replace(/\(/g, '').replace(/\)/g, '') : '' + }); + } else { + // w part + if (w_first) { // header + w_header = l; + w_header.forEach(function (item) { + w_pos.push(line.indexOf(item)); + }); + w_first = false; + } else { + // split by w_pos + result_w.user = line.substring(w_pos[0], w_pos[1] - 1).trim(); + result_w.tty = line.substring(w_pos[1], w_pos[2] - 1).trim(); + result_w.ip = line.substring(w_pos[2], w_pos[3] - 1).replace(/\(/g, '').replace(/\)/g, '').trim(); + result_w.command = line.substring(w_pos[7], 1000).trim(); + // find corresponding 'who' line + who_line = result_who.filter(function (obj) { + return (obj.user.substring(0, 8).trim() === result_w.user && obj.tty === result_w.tty); + }); + if (who_line.length === 1) { + result.push({ + user: who_line[0].user, + tty: who_line[0].tty, + date: who_line[0].date, + time: who_line[0].time, + ip: who_line[0].ip, + command: result_w.command + }); + } + } + } + } + }); + if (result.length === 0 && phase === 2) { + return result_who; + } else { + return result; + } +} + +function parseUsersDarwin(lines) { + let result = []; + let result_who = []; + let result_w = {}; + let who_line = {}; + + let is_whopart = true; + lines.forEach(function (line) { + if (line === '---') { + is_whopart = false; + } else { + let l = line.replace(/ +/g, ' ').split(' '); + + // who part + if (is_whopart) { + result_who.push({ + user: l[0], + tty: l[1], + date: ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2), + time: l[4], + }); + } else { + // w part + // split by w_pos + result_w.user = l[0]; + result_w.tty = l[1]; + result_w.ip = (l[2] !== '-') ? l[2] : ''; + result_w.command = l.slice(5, 1000).join(' '); + // find corresponding 'who' line + who_line = result_who.filter(function (obj) { + return (obj.user === result_w.user && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty)); + }); + if (who_line.length === 1) { + result.push({ + user: who_line[0].user, + tty: who_line[0].tty, + date: who_line[0].date, + time: who_line[0].time, + ip: result_w.ip, + command: result_w.command + }); + } + } + } + }); + return result; +} + +function users(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + + // linux + if (_linux) { + exec('who --ips; echo "---"; w | tail -n +2', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersLinux(lines, 1); + if (result.length === 0) { + exec('who; echo "---"; w | tail -n +2', function (error, stdout) { + if (!error) { + // lines / split + lines = stdout.toString().split('\n'); + result = parseUsersLinux(lines, 2); + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + if (_freebsd || _openbsd || _netbsd) { + exec('who; echo "---"; w -ih', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersDarwin(lines); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + exec('who; echo "---"; w -h', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersDarwin(lines); + } + if (callback) { callback(result); } + resolve(result); + }); + } + + if (_darwin) { + exec('who; echo "---"; w -ih', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersDarwin(lines); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { + try { + let cmd = 'Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl' + '; echo \'#-#-#-#\';'; + cmd += 'Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ' + '; echo \'#-#-#-#\';'; + cmd += '$process = (Get-CimInstance Win32_Process -Filter "name = \'explorer.exe\'"); Invoke-CimMethod -InputObject $process[0] -MethodName GetOwner | select user, domain | fl; get-process -name explorer | select-object sessionid | fl; echo \'#-#-#-#\';'; + cmd += 'query user'; + util.powerShell(cmd).then((data) => { + if (data) { + data = data.split('#-#-#-#'); + let sessions = parseWinSessions((data[0] || '').split(/\n\s*\n/)); + let loggedons = parseWinLoggedOn((data[1] || '').split(/\n\s*\n/)); + let queryUser = parseWinUsersQuery((data[3] || '').split('\r\n')); + let users = parseWinUsers((data[2] || '').split(/\n\s*\n/), queryUser); + for (let id in loggedons) { + if ({}.hasOwnProperty.call(loggedons, id)) { + loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : ''; + } + } + users.forEach(user => { + let dateTime = ''; + for (let id in loggedons) { + if ({}.hasOwnProperty.call(loggedons, id)) { + if (loggedons[id].user === user.user && (!dateTime || dateTime < loggedons[id].dateTime)) { + dateTime = loggedons[id].dateTime; + } + } + } + + result.push({ + user: user.user, + tty: user.tty, + date: `${dateTime.substring(0, 10)}`, + time: `${dateTime.substring(11, 19)}`, + ip: '', + command: '' + }); + }); + } + if (callback) { callback(result); } + resolve(result); + + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +function parseWinSessions(sessionParts) { + const sessions = {}; + sessionParts.forEach(session => { + const lines = session.split('\r\n'); + const id = util.getValue(lines, 'LogonId'); + const starttime = util.getValue(lines, 'starttime'); + if (id) { + sessions[id] = starttime; + } + }); + return sessions; +} + +function fuzzyMatch(name1, name2) { + name1 = name1.toLowerCase(); + name2 = name2.toLowerCase(); + let eq = 0; + let len = name1.length; + if (name2.length > len) { len = name2.length; } + + for (let i = 0; i < len; i++) { + const c1 = name1[i] || ''; + const c2 = name2[i] || ''; + if (c1 === c2) { eq++; } + } + return (len > 10 ? eq / len > 0.9 : (len > 0 ? eq / len > 0.8 : false)); +} + +function parseWinUsers(userParts, userQuery) { + const users = []; + userParts.forEach(user => { + const lines = user.split('\r\n'); + + const domain = util.getValue(lines, 'domain', ':', true); + const username = util.getValue(lines, 'user', ':', true); + const sessionid = util.getValue(lines, 'sessionid', ':', true); + + if (username) { + const quser = userQuery.filter(item => fuzzyMatch(item.user, username)); + users.push({ + domain, + user: username, + tty: quser && quser[0] && quser[0].tty ? quser[0].tty : sessionid + }); + } + }); + return users; +} + +function parseWinLoggedOn(loggedonParts) { + const loggedons = {}; + loggedonParts.forEach(loggedon => { + const lines = loggedon.split('\r\n'); + + const antecendent = util.getValue(lines, 'antecedent', ':', true); + let parts = antecendent.split('='); + const name = parts.length > 2 ? parts[1].split(',')[0].replace(/"/g, '').trim() : ''; + const domain = parts.length > 2 ? parts[2].replace(/"/g, '').replace(/\)/g, '').trim() : ''; + const dependent = util.getValue(lines, 'dependent', ':', true); + parts = dependent.split('='); + const id = parts.length > 1 ? parts[1].replace(/"/g, '').replace(/\)/g, '').trim() : ''; + if (id) { + loggedons[id] = { + domain, + user: name + }; + } + }); + return loggedons; +} + +function parseWinUsersQuery(lines) { + lines = lines.filter(item => item); + let result = []; + const header = lines[0]; + const headerDelimiter = []; + if (header) { + const start = (header[0] === ' ') ? 1 : 0; + headerDelimiter.push(start - 1); + let nextSpace = 0; + for (let i = start + 1; i < header.length; i++) { + if (header[i] === ' ' && ((header[i - 1] === ' ') || (header[i - 1] === '.'))) { + nextSpace = i; + } else { + if (nextSpace) { + headerDelimiter.push(nextSpace); + nextSpace = 0; + } + } + } + for (let i = 1; i < lines.length; i++) { + if (lines[i].trim()) { + const user = lines[i].substring(headerDelimiter[0] + 1, headerDelimiter[1]).trim() || ''; + const tty = lines[i].substring(headerDelimiter[1] + 1, headerDelimiter[2] - 2).trim() || ''; + result.push({ + user: user, + tty: tty, + }); + } + } + } + return result; +} + +exports.users = users; + + +/***/ }), + +/***/ 19872: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// utils.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 0. helper functions +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const fs = __nccwpck_require__(57147); +const path = __nccwpck_require__(71017); +const spawn = (__nccwpck_require__(32081).spawn); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const util = __nccwpck_require__(73837); + +let _platform = process.platform; +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); + +let _cores = 0; +let wmicPath = ''; +let codepage = ''; +let _smartMonToolsInstalled = null; +let _rpi_cpuinfo = null; + +const WINDIR = process.env.WINDIR || 'C:\\Windows'; + +// powerShell +let _psChild; +let _psResult = ''; +let _psCmds = []; +let _psPersistent = false; +const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; '; +const _psCmdStart = '--###START###--'; +const _psError = '--ERROR--'; +const _psCmdSeperator = '--###ENDCMD###--'; +const _psIdSeperator = '--##ID##--'; + +const execOptsWin = { + windowsHide: true, + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }) +}; + +const execOptsLinux = { + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + stdio: ['pipe', 'pipe', 'ignore'] +}; + +function toInt(value) { + let result = parseInt(value, 10); + if (isNaN(result)) { + result = 0; + } + return result; +} + +function splitByNumber(str) { + let numberStarted = false; + let num = ''; + let cpart = ''; + for (const c of str) { + if ((c >= '0' && c <= '9') || numberStarted) { + numberStarted = true; + num += c; + } else { + cpart += c; + } + } + return [cpart, num]; +} + +const stringReplace = new String().replace; +const stringToLower = new String().toLowerCase; +const stringToString = new String().toString; +const stringSubstr = new String().substr; +const stringTrim = new String().trim; +const stringStartWith = new String().startsWith; +const mathMin = Math.min; + +function isFunction(functionToCheck) { + let getType = {}; + return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; +} + +function unique(obj) { + let uniques = []; + let stringify = {}; + for (let i = 0; i < obj.length; i++) { + let keys = Object.keys(obj[i]); + keys.sort(function (a, b) { return a - b; }); + let str = ''; + for (let j = 0; j < keys.length; j++) { + str += JSON.stringify(keys[j]); + str += JSON.stringify(obj[i][keys[j]]); + } + if (!{}.hasOwnProperty.call(stringify, str)) { + uniques.push(obj[i]); + stringify[str] = true; + } + } + return uniques; +} + +function sortByKey(array, keys) { + return array.sort(function (a, b) { + let x = ''; + let y = ''; + keys.forEach(function (key) { + x = x + a[key]; y = y + b[key]; + }); + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }); +} + +function cores() { + if (_cores === 0) { + _cores = os.cpus().length; + } + return _cores; +} + +function getValue(lines, property, separator, trimmed, lineMatch) { + separator = separator || ':'; + property = property.toLowerCase(); + trimmed = trimmed || false; + lineMatch = lineMatch || false; + let result = ''; + lines.some((line) => { + let lineLower = line.toLowerCase().replace(/\t/g, ''); + if (trimmed) { + lineLower = lineLower.trim(); + } + if (lineLower.startsWith(property) && (lineMatch ? (lineLower.match(property + separator)) || (lineLower.match(property + ' ' + separator)) : true)) { + const parts = trimmed ? line.trim().split(separator) : line.split(separator); + if (parts.length >= 2) { + parts.shift(); + result = parts.join(separator).trim(); + return true; + } + } + }); + return result; +} + +function decodeEscapeSequence(str, base) { + base = base || 16; + return str.replace(/\\x([0-9A-Fa-f]{2})/g, function () { + return String.fromCharCode(parseInt(arguments[1], base)); + }); +} + +function detectSplit(str) { + let seperator = ''; + let part = 0; + str.split('').forEach(element => { + if (element >= '0' && element <= '9') { + if (part === 1) { part++; } + } else { + if (part === 0) { part++; } + if (part === 1) { + seperator += element; + } + } + }); + return seperator; +} + +function parseTime(t, pmDesignator) { + pmDesignator = pmDesignator || ''; + t = t.toUpperCase(); + let hour = 0; + let min = 0; + let splitter = detectSplit(t); + let parts = t.split(splitter); + if (parts.length >= 2) { + if (parts[2]) { + parts[1] += parts[2]; + } + let isPM = (parts[1] && (parts[1].toLowerCase().indexOf('pm') > -1) || (parts[1].toLowerCase().indexOf('p.m.') > -1) || (parts[1].toLowerCase().indexOf('p. m.') > -1) || (parts[1].toLowerCase().indexOf('n') > -1) || (parts[1].toLowerCase().indexOf('ch') > -1) || (parts[1].toLowerCase().indexOf('ös') > -1) || (pmDesignator && parts[1].toLowerCase().indexOf(pmDesignator) > -1)); + hour = parseInt(parts[0], 10); + min = parseInt(parts[1], 10); + hour = isPM && hour < 12 ? hour + 12 : hour; + return ('0' + hour).substr(-2) + ':' + ('0' + min).substr(-2); + } +} + +function parseDateTime(dt, culture) { + const result = { + date: '', + time: '' + }; + culture = culture || {}; + let dateFormat = (culture.dateFormat || '').toLowerCase(); + let pmDesignator = (culture.pmDesignator || ''); + + const parts = dt.split(' '); + if (parts[0]) { + if (parts[0].indexOf('/') >= 0) { + // Dateformat: mm/dd/yyyy or dd/mm/yyyy or dd/mm/yy or yyyy/mm/dd + const dtparts = parts[0].split('/'); + if (dtparts.length === 3) { + if (dtparts[0].length === 4) { + // Dateformat: yyyy/mm/dd + result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2); + } else if (dtparts[2].length === 2) { + if ((dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1)) { + // Dateformat: mm/dd/yy + result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } else { + // Dateformat: dd/mm/yy + result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } + } else { + // Dateformat: mm/dd/yyyy or dd/mm/yyyy + const isEN = ((dt.toLowerCase().indexOf('pm') > -1) || (dt.toLowerCase().indexOf('p.m.') > -1) || (dt.toLowerCase().indexOf('p. m.') > -1) || (dt.toLowerCase().indexOf('am') > -1) || (dt.toLowerCase().indexOf('a.m.') > -1) || (dt.toLowerCase().indexOf('a. m.') > -1)); + if ((isEN || dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1) && dateFormat.indexOf('dd/') !== 0) { + // Dateformat: mm/dd/yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2); + } else { + // Dateformat: dd/mm/yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } + } + } + } + if (parts[0].indexOf('.') >= 0) { + const dtparts = parts[0].split('.'); + if (dtparts.length === 3) { + if (dateFormat.indexOf('.d.') > -1 || dateFormat.indexOf('.dd.') > -1) { + // Dateformat: mm.dd.yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2); + } else { + // Dateformat: dd.mm.yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } + } + } + if (parts[0].indexOf('-') >= 0) { + // Dateformat: yyyy-mm-dd + const dtparts = parts[0].split('-'); + if (dtparts.length === 3) { + result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2); + } + } + } + if (parts[1]) { + parts.shift(); + let time = parts.join(' '); + result.time = parseTime(time, pmDesignator); + } + return result; +} + +function parseHead(head, rights) { + let space = (rights > 0); + let count = 1; + let from = 0; + let to = 0; + let result = []; + for (let i = 0; i < head.length; i++) { + if (count <= rights) { + if (/\s/.test(head[i]) && !space) { + to = i - 1; + result.push({ + from: from, + to: to + 1, + cap: head.substring(from, to + 1) + }); + from = to + 2; + count++; + } + space = head[i] === ' '; + } else { + if (!/\s/.test(head[i]) && space) { + to = i - 1; + if (from < to) { + result.push({ + from: from, + to: to, + cap: head.substring(from, to) + }); + } + from = to + 1; + count++; + } + space = head[i] === ' '; + } + } + to = 5000; + result.push({ + from: from, + to: to, + cap: head.substring(from, to) + }); + let len = result.length; + for (let i = 0; i < len; i++) { + if (result[i].cap.replace(/\s/g, '').length === 0) { + if (i + 1 < len) { + result[i].to = result[i + 1].to; + result[i].cap = result[i].cap + result[i + 1].cap; + result.splice(i + 1, 1); + len = len - 1; + } + } + } + return result; +} + +function findObjectByKey(array, key, value) { + for (let i = 0; i < array.length; i++) { + if (array[i][key] === value) { + return i; + } + } + return -1; +} + +function getWmic() { + if (os.type() === 'Windows_NT' && !wmicPath) { + wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe'; + if (!fs.existsSync(wmicPath)) { + try { + const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n'); + if (wmicPathArray && wmicPathArray.length) { + wmicPath = wmicPathArray[0]; + } else { + wmicPath = 'wmic'; + } + } catch (e) { + wmicPath = 'wmic'; + } + } + } + return wmicPath; +} + +function wmic(command) { + return new Promise((resolve) => { + process.nextTick(() => { + try { + powerShell(getWmic() + ' ' + command).then(stdout => { + resolve(stdout, ''); + }); + } catch (e) { + resolve('', e); + } + }); + }); +} + +function getVboxmanage() { + return _windows ? `"${process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"` : 'vboxmanage'; +} + +function powerShellProceedResults(data) { + let id = ''; + let parts; + let res = ''; + // startID + if (data.indexOf(_psCmdStart) >= 0) { + parts = data.split(_psCmdStart); + const parts2 = parts[1].split(_psIdSeperator); + id = parts2[0]; + if (parts2.length > 1) { + data = parts2.slice(1).join(_psIdSeperator); + } + } + // result; + if (data.indexOf(_psCmdSeperator) >= 0) { + parts = data.split(_psCmdSeperator); + res = parts[0]; + } + let remove = -1; + for (let i = 0; i < _psCmds.length; i++) { + if (_psCmds[i].id === id) { + remove = i; + _psCmds[i].callback(res); + } + } + if (remove >= 0) { + _psCmds.splice(remove, 1); + } +} + +function powerShellStart() { + if (!_psChild) { + _psChild = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], { + stdio: 'pipe', + windowsHide: true, + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }) + }); + if (_psChild && _psChild.pid) { + _psPersistent = true; + _psChild.stdout.on('data', function (data) { + _psResult = _psResult + data.toString('utf8'); + if (data.indexOf(_psCmdSeperator) >= 0) { + powerShellProceedResults(_psResult); + _psResult = ''; + } + }); + _psChild.stderr.on('data', function () { + powerShellProceedResults(_psResult + _psError); + }); + _psChild.on('error', function () { + powerShellProceedResults(_psResult + _psError); + }); + _psChild.on('close', function () { + if (_psChild) { _psChild.kill(); } + }); + } + } +} + +function powerShellRelease() { + try { + if (_psChild) { + _psChild.stdin.write('exit' + os.EOL); + _psChild.stdin.end(); + _psPersistent = false; + } + } catch (e) { + if (_psChild) { _psChild.kill(); } + } + _psChild = null; +} + +function powerShell(cmd) { + + /// const pattern = [ + /// '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + /// '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))' + /// ].join('|'); + + if (_psPersistent) { + const id = Math.random().toString(36).substring(2, 12); + return new Promise((resolve) => { + process.nextTick(() => { + function callback(data) { + resolve(data); + } + _psCmds.push({ + id, + cmd, + callback, + start: new Date() + }); + try { + if (_psChild && _psChild.pid) { + _psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL); + } + } catch (e) { + resolve(''); + } + }); + }); + + } else { + let result = ''; + + return new Promise((resolve) => { + process.nextTick(() => { + try { + const child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], { + stdio: 'pipe', + windowsHide: true, + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }) + }); + + if (child && !child.pid) { + child.on('error', function () { + resolve(result); + }); + } + if (child && child.pid) { + child.stdout.on('data', function (data) { + result = result + data.toString('utf8'); + }); + child.stderr.on('data', function () { + child.kill(); + resolve(result); + }); + child.on('close', function () { + child.kill(); + + resolve(result); + }); + child.on('error', function () { + child.kill(); + resolve(result); + }); + try { + child.stdin.write(_psToUTF8 + cmd + os.EOL); + child.stdin.write('exit' + os.EOL); + child.stdin.end(); + } catch (e) { + child.kill(); + resolve(result); + } + } else { + resolve(result); + } + } catch (e) { + resolve(result); + } + }); + }); + } +} + +function execSafe(cmd, args, options) { + let result = ''; + options = options || {}; + + return new Promise((resolve) => { + process.nextTick(() => { + try { + const child = spawn(cmd, args, options); + + if (child && !child.pid) { + child.on('error', function () { + resolve(result); + }); + } + if (child && child.pid) { + child.stdout.on('data', function (data) { + result += data.toString(); + }); + child.on('close', function () { + child.kill(); + resolve(result); + }); + child.on('error', function () { + child.kill(); + resolve(result); + }); + } else { + resolve(result); + } + } catch (e) { + resolve(result); + } + }); + }); +} + +function getCodepage() { + if (_windows) { + if (!codepage) { + try { + const stdout = execSync('chcp', execOptsWin); + const lines = stdout.toString().split('\r\n'); + const parts = lines[0].split(':'); + codepage = parts.length > 1 ? parts[1].replace('.', '').trim() : ''; + } catch (err) { + codepage = '437'; + } + } + return codepage; + } + if (_linux || _darwin || _freebsd || _openbsd || _netbsd) { + if (!codepage) { + try { + const stdout = execSync('echo $LANG', util.execOptsLinux); + const lines = stdout.toString().split('\r\n'); + const parts = lines[0].split('.'); + codepage = parts.length > 1 ? parts[1].trim() : ''; + if (!codepage) { + codepage = 'UTF-8'; + } + } catch (err) { + codepage = 'UTF-8'; + } + } + return codepage; + } +} + +function smartMonToolsInstalled() { + if (_smartMonToolsInstalled !== null) { + return _smartMonToolsInstalled; + } + _smartMonToolsInstalled = false; + if (_windows) { + try { + const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n'); + if (pathArray && pathArray.length) { + _smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0; + } else { + _smartMonToolsInstalled = false; + } + } catch (e) { + _smartMonToolsInstalled = false; + } + } + if (_linux || _darwin || _freebsd || _openbsd || _netbsd) { + try { + const pathArray = execSync('which smartctl 2>/dev/null', execOptsLinux).toString().split('\r\n'); + _smartMonToolsInstalled = pathArray.length > 0; + } catch (e) { + util.noop(); + } + } + return _smartMonToolsInstalled; +} + +function isRaspberry() { + const PI_MODEL_NO = [ + 'BCM2708', + 'BCM2709', + 'BCM2710', + 'BCM2711', + 'BCM2712', + 'BCM2835', + 'BCM2836', + 'BCM2837', + 'BCM2837B0' + ]; + let cpuinfo = []; + + if (_rpi_cpuinfo !== null) { + cpuinfo = _rpi_cpuinfo; + } else { + try { + cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n'); + _rpi_cpuinfo = cpuinfo; + } catch (e) { + return false; + } + } + + const hardware = getValue(cpuinfo, 'hardware'); + return (hardware && PI_MODEL_NO.indexOf(hardware) > -1); +} + +function isRaspbian() { + let osrelease = []; + try { + osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).toString().split('\n'); + } catch (e) { + return false; + } + const id = getValue(osrelease, 'id', '='); + return (id && id.indexOf('raspbian') > -1); +} + +function execWin(cmd, opts, callback) { + if (!callback) { + callback = opts; + opts = execOptsWin; + } + let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul'; + exec(newCmd, opts, function (error, stdout) { + callback(error, stdout); + }); +} + +function darwinXcodeExists() { + const cmdLineToolsExists = fs.existsSync('/Library/Developer/CommandLineTools/usr/bin/'); + const xcodeAppExists = fs.existsSync('/Applications/Xcode.app/Contents/Developer/Tools'); + const xcodeExists = fs.existsSync('/Library/Developer/Xcode/'); + return (cmdLineToolsExists || xcodeExists || xcodeAppExists); +} + +function nanoSeconds() { + const time = process.hrtime(); + if (!Array.isArray(time) || time.length !== 2) { + return 0; + } + return +time[0] * 1e9 + +time[1]; +} + +function countUniqueLines(lines, startingWith) { + startingWith = startingWith || ''; + const uniqueLines = []; + lines.forEach(line => { + if (line.startsWith(startingWith)) { + if (uniqueLines.indexOf(line) === -1) { + uniqueLines.push(line); + } + } + }); + return uniqueLines.length; +} + +function countLines(lines, startingWith) { + startingWith = startingWith || ''; + const uniqueLines = []; + lines.forEach(line => { + if (line.startsWith(startingWith)) { + uniqueLines.push(line); + } + }); + return uniqueLines.length; +} + +function sanitizeShellString(str, strict) { + if (typeof strict === 'undefined') { strict = false; } + const s = str || ''; + let result = ''; + const l = mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (!(s[i] === undefined || + s[i] === '>' || + s[i] === '<' || + s[i] === '*' || + s[i] === '?' || + s[i] === '[' || + s[i] === ']' || + s[i] === '|' || + s[i] === '˚' || + s[i] === '$' || + s[i] === ';' || + s[i] === '&' || + s[i] === ']' || + s[i] === '#' || + s[i] === '\\' || + s[i] === '\t' || + s[i] === '\n' || + s[i] === '\r' || + s[i] === '\'' || + s[i] === '`' || + s[i] === '"' || + s[i].length > 1 || + (strict && s[i] === '(') || + (strict && s[i] === ')') || + (strict && s[i] === '@') || + (strict && s[i] === ' ') || + (strict && s[i] == '{') || + (strict && s[i] == ';') || + (strict && s[i] == '}'))) { + result = result + s[i]; } } + return result; +} - const eqSet = new Set() - let gt, lt - for (const c of sub) { - if (c.operator === '>' || c.operator === '>=') { - gt = higherGT(gt, c, options) - } else if (c.operator === '<' || c.operator === '<=') { - lt = lowerLT(lt, c, options) - } else { - eqSet.add(c.semver) +function isPrototypePolluted() { + const s = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + let notPolluted = true; + let st = ''; + + st.__proto__.replace = stringReplace; + st.__proto__.toLowerCase = stringToLower; + st.__proto__.toString = stringToString; + st.__proto__.substr = stringSubstr; + + notPolluted = notPolluted || (s.length !== 62); + const ms = Date.now(); + if (typeof ms === 'number' && ms > 1600000000000) { + const l = ms % 100 + 15; + for (let i = 0; i < l; i++) { + const r = Math.random() * 61.99999999 + 1; + const rs = parseInt(Math.floor(r).toString(), 10); + const rs2 = parseInt(r.toString().split('.')[0], 10); + const q = Math.random() * 61.99999999 + 1; + const qs = parseInt(Math.floor(q).toString(), 10); + const qs2 = parseInt(q.toString().split('.')[0], 10); + notPolluted = notPolluted && (r !== q); + notPolluted = notPolluted && rs === rs2 && qs === qs2; + st += s[rs - 1]; + } + notPolluted = notPolluted && st.length === l; + // string manipulation + let p = Math.random() * l * 0.9999999999; + let stm = st.substr(0, p) + ' ' + st.substr(p, 2000); + stm.__proto__.replace = stringReplace; + let sto = stm.replace(/ /g, ''); + notPolluted = notPolluted && st === sto; + p = Math.random() * l * 0.9999999999; + stm = st.substr(0, p) + '{' + st.substr(p, 2000); + sto = stm.replace(/{/g, ''); + notPolluted = notPolluted && st === sto; + p = Math.random() * l * 0.9999999999; + stm = st.substr(0, p) + '*' + st.substr(p, 2000); + sto = stm.replace(/\*/g, ''); + notPolluted = notPolluted && st === sto; + p = Math.random() * l * 0.9999999999; + stm = st.substr(0, p) + '$' + st.substr(p, 2000); + sto = stm.replace(/\$/g, ''); + notPolluted = notPolluted && st === sto; + + // lower + const stl = st.toLowerCase(); + notPolluted = notPolluted && (stl.length === l) && stl[l - 1] && !(stl[l]); + for (let i = 0; i < l; i++) { + const s1 = st[i]; + s1.__proto__.toLowerCase = stringToLower; + const s2 = stl ? stl[i] : ''; + const s1l = s1.toLowerCase(); + notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !(s1l[1]); + } + } + return !notPolluted; +} + +function hex2bin(hex) { + return ('00000000' + (parseInt(hex, 16)).toString(2)).substr(-8); +} + +function getFilesInPath(source) { + const lstatSync = fs.lstatSync; + const readdirSync = fs.readdirSync; + const join = path.join; + + function isDirectory(source) { + return lstatSync(source).isDirectory(); + } + function isFile(source) { return lstatSync(source).isFile(); } + + function getDirectories(source) { + return readdirSync(source).map(function (name) { return join(source, name); }).filter(isDirectory); + } + function getFiles(source) { + return readdirSync(source).map(function (name) { return join(source, name); }).filter(isFile); + } + + function getFilesRecursively(source) { + try { + let dirs = getDirectories(source); + let files = dirs + .map(function (dir) { return getFilesRecursively(dir); }) + .reduce(function (a, b) { return a.concat(b); }, []); + return files.concat(getFiles(source)); + } catch (e) { + return []; } } - if (eqSet.size > 1) { - return null + if (fs.existsSync(source)) { + return getFilesRecursively(source); + } else { + return []; } +} - let gtltComp - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options) - if (gtltComp > 0) { - return null - } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { - return null +function decodePiCpuinfo(lines) { + + if (_rpi_cpuinfo === null) { + _rpi_cpuinfo = lines; + } + + // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md + + const oldRevisionCodes = { + '0002': { + type: 'B', + revision: '1.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0003': { + type: 'B', + revision: '1.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0004': { + type: 'B', + revision: '2.0', + memory: 256, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0005': { + type: 'B', + revision: '2.0', + memory: 256, + manufacturer: 'Qisda', + processor: 'BCM2835' + }, + '0006': { + type: 'B', + revision: '2.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0007': { + type: 'A', + revision: '2.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0008': { + type: 'A', + revision: '2.0', + memory: 256, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0009': { + type: 'A', + revision: '2.0', + memory: 256, + manufacturer: 'Qisda', + processor: 'BCM2835' + }, + '000d': { + type: 'B', + revision: '2.0', + memory: 512, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '000e': { + type: 'B', + revision: '2.0', + memory: 512, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '000f': { + type: 'B', + revision: '2.0', + memory: 512, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0010': { + type: 'B+', + revision: '1.2', + memory: 512, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0011': { + type: 'CM1', + revision: '1.0', + memory: 512, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0012': { + type: 'A+', + revision: '1.1', + memory: 256, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0013': { + type: 'B+', + revision: '1.2', + memory: 512, + manufacturer: 'Embest', + processor: 'BCM2835' + }, + '0014': { + type: 'CM1', + revision: '1.0', + memory: 512, + manufacturer: 'Embest', + processor: 'BCM2835' + }, + '0015': { + type: 'A+', + revision: '1.1', + memory: 256, + manufacturer: '512MB Embest', + processor: 'BCM2835' } + }; + + const processorList = [ + 'BCM2835', + 'BCM2836', + 'BCM2837', + 'BCM2711', + 'BCM2712', + ]; + const manufacturerList = [ + 'Sony UK', + 'Egoman', + 'Embest', + 'Sony Japan', + 'Embest', + 'Stadium' + ]; + const typeList = { + '00': 'A', + '01': 'B', + '02': 'A+', + '03': 'B+', + '04': '2B', + '05': 'Alpha (early prototype)', + '06': 'CM1', + '08': '3B', + '09': 'Zero', + '0a': 'CM3', + '0c': 'Zero W', + '0d': '3B+', + '0e': '3A+', + '0f': 'Internal use only', + '10': 'CM3+', + '11': '4B', + '12': 'Zero 2 W', + '13': '400', + '14': 'CM4', + '15': 'CM4S', + '17': '5', + }; + + const revisionCode = getValue(lines, 'revision', ':', true); + const model = getValue(lines, 'model:', ':', true); + const serial = getValue(lines, 'serial', ':', true); + + let result = {}; + if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) { + // old revision codes + result = { + model, + serial, + revisionCode, + memory: oldRevisionCodes[revisionCode].memory, + manufacturer: oldRevisionCodes[revisionCode].manufacturer, + processor: oldRevisionCodes[revisionCode].processor, + type: oldRevisionCodes[revisionCode].type, + revision: oldRevisionCodes[revisionCode].revision, + }; + + } else { + // new revision code + const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8); + const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0; + const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)]; + const processor = processorList[parseInt(revision.substr(4, 1), 10)]; + const typeCode = revision.substr(5, 2); + + + result = { + model, + serial, + revisionCode, + memory: 256 * Math.pow(2, memSizeCode), + manufacturer, + processor, + type: {}.hasOwnProperty.call(typeList, typeCode) ? typeList[typeCode] : '', + revision: '1.' + revision.substr(7, 1), + }; } + return result; +} - // will iterate one or zero times - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) { - return null +function getRpiGpu() { + let cpuinfo = null; + if (_rpi_cpuinfo !== null) { + cpuinfo = _rpi_cpuinfo; + } else { + try { + cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n'); + _rpi_cpuinfo = cpuinfo; + } catch (e) { + return false; } + } - if (lt && !satisfies(eq, String(lt), options)) { - return null - } + const rpi = decodePiCpuinfo(cpuinfo); + if (rpi.type === '4B' || rpi.type === 'CM4' || rpi.type === 'CM4S' || rpi.type === '400') { return 'VideoCore VI'; } + if (rpi.type === '5') { return 'VideoCore VII'; } + return 'VideoCore IV'; +} - for (const c of dom) { - if (!satisfies(eq, String(c), options)) { - return false - } - } +function promiseAll(promises) { + const resolvingPromises = promises.map(function (promise) { + return new Promise(function (resolve) { + let payload = new Array(2); + promise.then(function (result) { + payload[0] = result; + }) + .catch(function (error) { + payload[1] = error; + }) + .then(function () { + // The wrapped Promise returns an array: 0 = result, 1 = error ... we resolve all + resolve(payload); + }); + }); + }); + const errors = []; + const results = []; + + // Execute all wrapped Promises + return Promise.all(resolvingPromises) + .then(function (items) { + items.forEach(function (payload) { + if (payload[1]) { + errors.push(payload[1]); + results.push(null); + } else { + errors.push(null); + results.push(payload[0]); + } + }); - return true - } + return { + errors: errors, + results: results + }; + }); +} - let higher, lower - let hasDomLT, hasDomGT - // if the subset has a prerelease, we need a comparator in the superset - // with the same tuple and a prerelease, or it's not a subset - let needDomLTPre = lt && - !options.includePrerelease && - lt.semver.prerelease.length ? lt.semver : false - let needDomGTPre = gt && - !options.includePrerelease && - gt.semver.prerelease.length ? gt.semver : false - // exception: <1.2.3-0 is the same as <1.2.3 - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && - lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { - needDomLTPre = false +function promisify(nodeStyleFunction) { + return function () { + const args = Array.prototype.slice.call(arguments); + return new Promise(function (resolve, reject) { + args.push(function (err, data) { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + nodeStyleFunction.apply(null, args); + }); + }; +} + +function promisifySave(nodeStyleFunction) { + return function () { + const args = Array.prototype.slice.call(arguments); + return new Promise(function (resolve) { + args.push(function (err, data) { + resolve(data); + }); + nodeStyleFunction.apply(null, args); + }); + }; +} + +function linuxVersion() { + let result = ''; + if (_linux) { + try { + result = execSync('uname -v', util.execOptsLinux).toString(); + } catch (e) { + result = ''; + } } + return result; +} - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' - hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' - if (gt) { - if (needDomGTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomGTPre.major && - c.semver.minor === needDomGTPre.minor && - c.semver.patch === needDomGTPre.patch) { - needDomGTPre = false +function plistParser(xmlStr) { + const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty']; + const startStr = '' && pos < len) { + pos++; + } + + let depth = 0; + let inTagStart = false; + let inTagContent = false; + let inTagEnd = false; + let metaData = [{ tagStart: '', tagEnd: '', tagContent: '', key: '', data: null }]; + let c = ''; + let cn = xmlStr[pos]; + + while (pos < len) { + c = cn; + if (pos + 1 < len) { cn = xmlStr[pos + 1]; } + if (c === '<') { + inTagContent = false; + if (cn === '/') { inTagEnd = true; } + else if (metaData[depth].tagStart) { + metaData[depth].tagContent = ''; + if (!metaData[depth].data) { metaData[depth].data = metaData[depth].tagStart === 'array' ? [] : {}; } + depth++; + metaData.push({ tagStart: '', tagEnd: '', tagContent: '', key: null, data: null }); + inTagStart = true; + inTagContent = false; + } + else if (!inTagStart) { inTagStart = true; } + } else if (c === '>') { + if (metaData[depth].tagStart === 'true/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = true; } + if (metaData[depth].tagStart === 'false/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = false; } + if (metaData[depth].tagStart === 'array/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/arrayEmpty'; metaData[depth].data = []; } + if (inTagContent) { inTagContent = false; } + if (inTagStart) { + inTagStart = false; + inTagContent = true; + if (metaData[depth].tagStart === 'array') { + metaData[depth].data = []; + } + if (metaData[depth].tagStart === 'dict') { + metaData[depth].data = {}; } } - if (c.operator === '>' || c.operator === '>=') { - higher = higherGT(gt, c, options) - if (higher === c && higher !== gt) { - return false + if (inTagEnd) { + inTagEnd = false; + if (metaData[depth].tagEnd && tags.indexOf(metaData[depth].tagEnd.substr(1)) >= 0) { + if (metaData[depth].tagEnd === '/dict' || metaData[depth].tagEnd === '/array') { + if (depth > 1 && metaData[depth - 2].tagStart === 'array') { + metaData[depth - 2].data.push(metaData[depth - 1].data); + } + if (depth > 1 && metaData[depth - 2].tagStart === 'dict') { + metaData[depth - 2].data[metaData[depth - 1].key] = metaData[depth - 1].data; + } + depth--; + metaData.pop(); + metaData[depth].tagContent = ''; + metaData[depth].tagStart = ''; + metaData[depth].tagEnd = ''; + } + else { + if (metaData[depth].tagEnd === '/key' && metaData[depth].tagContent) { + metaData[depth].key = metaData[depth].tagContent; + } else { + if (metaData[depth].tagEnd === '/real' && metaData[depth].tagContent) { metaData[depth].data = parseFloat(metaData[depth].tagContent) || 0; } + if (metaData[depth].tagEnd === '/integer' && metaData[depth].tagContent) { metaData[depth].data = parseInt(metaData[depth].tagContent) || 0; } + if (metaData[depth].tagEnd === '/string' && metaData[depth].tagContent) { metaData[depth].data = metaData[depth].tagContent || ''; } + if (metaData[depth].tagEnd === '/boolean') { metaData[depth].data = metaData[depth].tagContent || false; } + if (metaData[depth].tagEnd === '/arrayEmpty') { metaData[depth].data = metaData[depth].tagContent || []; } + if (depth > 0 && metaData[depth - 1].tagStart === 'array') { metaData[depth - 1].data.push(metaData[depth].data); } + if (depth > 0 && metaData[depth - 1].tagStart === 'dict') { metaData[depth - 1].data[metaData[depth].key] = metaData[depth].data; } + } + metaData[depth].tagContent = ''; + metaData[depth].tagStart = ''; + metaData[depth].tagEnd = ''; + } } - } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { - return false + metaData[depth].tagEnd = ''; + inTagStart = false; + inTagContent = false; } + } else { + if (inTagStart) { metaData[depth].tagStart += c; } + if (inTagEnd) { metaData[depth].tagEnd += c; } + if (inTagContent) { metaData[depth].tagContent += c; } } - if (lt) { - if (needDomLTPre) { - if (c.semver.prerelease && c.semver.prerelease.length && - c.semver.major === needDomLTPre.major && - c.semver.minor === needDomLTPre.minor && - c.semver.patch === needDomLTPre.patch) { - needDomLTPre = false + pos++; + } + return metaData[0].data; +} + +function strIsNumeric(str) { + return typeof str === 'string' && !isNaN(str) && !isNaN(parseFloat(str)); +} + +function plistReader(output) { + const lines = output.split('\n'); + for (let i = 0; i < lines.length; i++) { + if (lines[i].indexOf(' = ') >= 0) { + const lineParts = lines[i].split(' = '); + lineParts[0] = lineParts[0].trim(); + if (!lineParts[0].startsWith('"')) { + lineParts[0] = '"' + lineParts[0] + '"'; + } + lineParts[1] = lineParts[1].trim(); + if (lineParts[1].indexOf('"') === -1 && lineParts[1].endsWith(';')) { + const valueString = lineParts[1].substring(0, lineParts[1].length - 1); + if (!strIsNumeric(valueString)) { + lineParts[1] = `"${valueString}";`; } } - if (c.operator === '<' || c.operator === '<=') { - lower = lowerLT(lt, c, options) - if (lower === c && lower !== lt) { - return false + if (lineParts[1].indexOf('"') >= 0 && lineParts[1].endsWith(';')) { + const valueString = lineParts[1].substring(0, lineParts[1].length - 1).replace(/"/g, ''); + if (strIsNumeric(valueString)) { + lineParts[1] = `${valueString};`; } - } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { - return false } + lines[i] = lineParts.join(' : '); } - if (!c.operator && (lt || gt) && gtltComp !== 0) { - return false + lines[i] = lines[i].replace(/\(/g, '[').replace(/\)/g, ']').replace(/;/g, ',').trim(); + if (lines[i].startsWith('}') && lines[i - 1] && lines[i - 1].endsWith(',')) { + lines[i - 1] = lines[i - 1].substring(0, lines[i - 1].length - 1); } } - - // if there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) { - return false + output = lines.join(''); + let obj = {}; + try { + obj = JSON.parse(output); + } catch (e) { + noop(); } + return obj; +} - if (lt && hasDomGT && !gt && gtltComp !== 0) { - return false +function semverCompare(v1, v2) { + let res = 0; + const parts1 = v1.split('.'); + const parts2 = v2.split('.'); + if (parts1[0] < parts2[0]) { res = 1; } + else if (parts1[0] > parts2[0]) { res = -1; } + else if (parts1[0] === parts2[0] && parts1.length >= 2 && parts2.length >= 2) { + if (parts1[1] < parts2[1]) { res = 1; } + else if (parts1[1] > parts2[1]) { res = -1; } + else if (parts1[1] === parts2[1]) { + if (parts1.length >= 3 && parts2.length >= 3) { + if (parts1[2] < parts2[2]) { res = 1; } + else if (parts1[2] > parts2[2]) { res = -1; } + } else if (parts2.length >= 3) { + res = 1; + } + } } + return res; +} + +function noop() { } + +exports.toInt = toInt; +exports.splitByNumber = splitByNumber; +exports.execOptsWin = execOptsWin; +exports.execOptsLinux = execOptsLinux; +exports.getCodepage = getCodepage; +exports.execWin = execWin; +exports.isFunction = isFunction; +exports.unique = unique; +exports.sortByKey = sortByKey; +exports.cores = cores; +exports.getValue = getValue; +exports.decodeEscapeSequence = decodeEscapeSequence; +exports.parseDateTime = parseDateTime; +exports.parseHead = parseHead; +exports.findObjectByKey = findObjectByKey; +exports.getWmic = getWmic; +exports.wmic = wmic; +exports.darwinXcodeExists = darwinXcodeExists; +exports.getVboxmanage = getVboxmanage; +exports.powerShell = powerShell; +exports.powerShellStart = powerShellStart; +exports.powerShellRelease = powerShellRelease; +exports.execSafe = execSafe; +exports.nanoSeconds = nanoSeconds; +exports.countUniqueLines = countUniqueLines; +exports.countLines = countLines; +exports.noop = noop; +exports.isRaspberry = isRaspberry; +exports.isRaspbian = isRaspbian; +exports.sanitizeShellString = sanitizeShellString; +exports.isPrototypePolluted = isPrototypePolluted; +exports.decodePiCpuinfo = decodePiCpuinfo; +exports.getRpiGpu = getRpiGpu; +exports.promiseAll = promiseAll; +exports.promisify = promisify; +exports.promisifySave = promisifySave; +exports.smartMonToolsInstalled = smartMonToolsInstalled; +exports.linuxVersion = linuxVersion; +exports.plistParser = plistParser; +exports.plistReader = plistReader; +exports.stringReplace = stringReplace; +exports.stringToLower = stringToLower; +exports.stringToString = stringToString; +exports.stringSubstr = stringSubstr; +exports.stringTrim = stringTrim; +exports.stringStartWith = stringStartWith; +exports.mathMin = mathMin; +exports.WINDIR = WINDIR; +exports.getFilesInPath = getFilesInPath; +exports.semverCompare = semverCompare; - // we needed a prerelease range in a specific tuple, but didn't get one - // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, - // because it includes prereleases in the 1.2.3 tuple - if (needDomGTPre || needDomLTPre) { - return false - } - return true -} +/***/ }), -// >=1.2.3 is lower than >1.2.3 -const higherGT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp > 0 ? a - : comp < 0 ? b - : b.operator === '>' && a.operator === '>=' ? b - : a -} +/***/ 61454: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -// <=1.2.3 is higher than <1.2.3 -const lowerLT = (a, b, options) => { - if (!a) { - return b - } - const comp = compare(a.semver, b.semver, options) - return comp < 0 ? a - : comp > 0 ? b - : b.operator === '<' && a.operator === '<=' ? b - : a -} -module.exports = subset +// @ts-check +// ================================================================================== +// virtualbox.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 14. Docker +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const exec = (__nccwpck_require__(32081).exec); +const util = __nccwpck_require__(19872); + +function vboxInfo(callback) { + + // fallback - if only callback is given + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + try { + exec(util.getVboxmanage() + ' list vms --long', function (error, stdout) { + let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:'); + parts.shift(); + parts.forEach(part => { + const lines = ('Name:' + part).split(os.EOL); + const state = util.getValue(lines, 'State'); + const running = state.startsWith('running'); + const runningSinceString = running ? state.replace('running (since ', '').replace(')', '').trim() : ''; + let runningSince = 0; + try { + if (running) { + const sinceDateObj = new Date(runningSinceString); + const offset = sinceDateObj.getTimezoneOffset(); + runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60; + } + } catch (e) { + util.noop(); + } + const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : ''; + let stoppedSince = 0; + try { + if (!running) { + const sinceDateObj = new Date(stoppedSinceString); + const offset = sinceDateObj.getTimezoneOffset(); + stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60; + } + } catch (e) { + util.noop(); + } + result.push({ + id: util.getValue(lines, 'UUID'), + name: util.getValue(lines, 'Name'), + running, + started: runningSinceString, + runningSince, + stopped: stoppedSinceString, + stoppedSince, + guestOS: util.getValue(lines, 'Guest OS'), + hardwareUUID: util.getValue(lines, 'Hardware UUID'), + memory: parseInt(util.getValue(lines, 'Memory size', ' '), 10), + vram: parseInt(util.getValue(lines, 'VRAM size'), 10), + cpus: parseInt(util.getValue(lines, 'Number of CPUs'), 10), + cpuExepCap: util.getValue(lines, 'CPU exec cap'), + cpuProfile: util.getValue(lines, 'CPUProfile'), + chipset: util.getValue(lines, 'Chipset'), + firmware: util.getValue(lines, 'Firmware'), + pageFusion: util.getValue(lines, 'Page Fusion') === 'enabled', + configFile: util.getValue(lines, 'Config file'), + snapshotFolder: util.getValue(lines, 'Snapshot folder'), + logFolder: util.getValue(lines, 'Log folder'), + hpet: util.getValue(lines, 'HPET') === 'enabled', + pae: util.getValue(lines, 'PAE') === 'enabled', + longMode: util.getValue(lines, 'Long Mode') === 'enabled', + tripleFaultReset: util.getValue(lines, 'Triple Fault Reset') === 'enabled', + apic: util.getValue(lines, 'APIC') === 'enabled', + x2Apic: util.getValue(lines, 'X2APIC') === 'enabled', + acpi: util.getValue(lines, 'ACPI') === 'enabled', + ioApic: util.getValue(lines, 'IOAPIC') === 'enabled', + biosApicMode: util.getValue(lines, 'BIOS APIC mode'), + bootMenuMode: util.getValue(lines, 'Boot menu mode'), + bootDevice1: util.getValue(lines, 'Boot Device 1'), + bootDevice2: util.getValue(lines, 'Boot Device 2'), + bootDevice3: util.getValue(lines, 'Boot Device 3'), + bootDevice4: util.getValue(lines, 'Boot Device 4'), + timeOffset: util.getValue(lines, 'Time offset'), + rtc: util.getValue(lines, 'RTC'), + }); + }); + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} -/***/ }), +exports.vboxInfo = vboxInfo; -/***/ 382: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Range = __nccwpck_require__(5287) +/***/ }), -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) +/***/ 26437: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -module.exports = toComparators +// @ts-check +// ================================================================================== +// wifi.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 9. wifi +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(22037); +const exec = (__nccwpck_require__(32081).exec); +const execSync = (__nccwpck_require__(32081).execSync); +const util = __nccwpck_require__(19872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); + +function wifiDBFromQuality(quality) { + const qual = parseFloat(quality); + if (qual < 0) { return 0; } + if (qual >= 100) { return -50; } + return (qual / 2 - 100); +} + +function wifiQualityFromDB(db) { + const result = 2 * (parseFloat(db) + 100); + return result <= 100 ? result : 100; +} + +const _wifi_frequencies = { + 1: 2412, + 2: 2417, + 3: 2422, + 4: 2427, + 5: 2432, + 6: 2437, + 7: 2442, + 8: 2447, + 9: 2452, + 10: 2457, + 11: 2462, + 12: 2467, + 13: 2472, + 14: 2484, + 32: 5160, + 34: 5170, + 36: 5180, + 38: 5190, + 40: 5200, + 42: 5210, + 44: 5220, + 46: 5230, + 48: 5240, + 50: 5250, + 52: 5260, + 54: 5270, + 56: 5280, + 58: 5290, + 60: 5300, + 62: 5310, + 64: 5320, + 68: 5340, + 96: 5480, + 100: 5500, + 102: 5510, + 104: 5520, + 106: 5530, + 108: 5540, + 110: 5550, + 112: 5560, + 114: 5570, + 116: 5580, + 118: 5590, + 120: 5600, + 122: 5610, + 124: 5620, + 126: 5630, + 128: 5640, + 132: 5660, + 134: 5670, + 136: 5680, + 138: 5690, + 140: 5700, + 142: 5710, + 144: 5720, + 149: 5745, + 151: 5755, + 153: 5765, + 155: 5775, + 157: 5785, + 159: 5795, + 161: 5805, + 165: 5825, + 169: 5845, + 173: 5865, + 183: 4915, + 184: 4920, + 185: 4925, + 187: 4935, + 188: 4940, + 189: 4945, + 192: 4960, + 196: 4980 +}; + +function wifiFrequencyFromChannel(channel) { + return {}.hasOwnProperty.call(_wifi_frequencies, channel) ? _wifi_frequencies[channel] : null; +} + +function wifiChannelFromFrequencs(frequency) { + let channel = 0; + for (let key in _wifi_frequencies) { + if ({}.hasOwnProperty.call(_wifi_frequencies, key)) { + if (_wifi_frequencies[key] === frequency) { channel = util.toInt(key); } + } + } + return channel; +} + +function ifaceListLinux() { + const result = []; + const cmd = 'iw dev 2>/dev/null'; + try { + const all = execSync(cmd, util.execOptsLinux).toString().split('\n').map(line => line.trim()).join('\n'); + const parts = all.split('\nInterface '); + parts.shift(); + parts.forEach(ifaceDetails => { + const lines = ifaceDetails.split('\n'); + const iface = lines[0]; + const id = util.toInt(util.getValue(lines, 'ifindex', ' ')); + const mac = util.getValue(lines, 'addr', ' '); + const channel = util.toInt(util.getValue(lines, 'channel', ' ')); + result.push({ + id, + iface, + mac, + channel + }); + }); + return result; + } catch (e) { + try { + const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null', util.execOptsLinux).toString(); + const parts = all.split('\n\n'); + let i = 1; + parts.forEach(ifaceDetails => { + const lines = ifaceDetails.split('\n'); + const iface = util.getValue(lines, 'GENERAL.DEVICE'); + const type = util.getValue(lines, 'GENERAL.TYPE'); + const id = i++; // // util.getValue(lines, 'GENERAL.PATH'); + const mac = util.getValue(lines, 'GENERAL.HWADDR'); + const channel = ''; + if (type.toLowerCase() === 'wifi') { + result.push({ + id, + iface, + mac, + channel + }); + } + }); + return result; + } catch (e) { + return []; + } + } +} -/***/ }), +function nmiDeviceLinux(iface) { + const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2>/dev/null`; + try { + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const ssid = util.getValue(lines, 'GENERAL.CONNECTION'); + return { + iface, + type: util.getValue(lines, 'GENERAL.TYPE'), + vendor: util.getValue(lines, 'GENERAL.VENDOR'), + product: util.getValue(lines, 'GENERAL.PRODUCT'), + mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(), + ssid: ssid !== '--' ? ssid : null + }; + } catch (e) { + return {}; + } +} -/***/ 8029: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { +function nmiConnectionLinux(ssid) { + const cmd = `nmcli -t --show-secrets connection show ${ssid} 2>/dev/null`; + try { + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const bssid = util.getValue(lines, '802-11-wireless.seen-bssids').toLowerCase(); + return { + ssid: ssid !== '--' ? ssid : null, + uuid: util.getValue(lines, 'connection.uuid'), + type: util.getValue(lines, 'connection.type'), + autoconnect: util.getValue(lines, 'connection.autoconnect') === 'yes', + security: util.getValue(lines, '802-11-wireless-security.key-mgmt'), + bssid: bssid !== '--' ? bssid : null + }; + } catch (e) { + return {}; + } +} -const Range = __nccwpck_require__(5287) -const validRange = (range, options) => { +function wpaConnectionLinux(iface) { + if (!iface) { + return {}; + } + const cmd = `wpa_cli -i ${iface} status 2>&1`; try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const freq = util.toInt(util.getValue(lines, 'freq', '=')); + return { + ssid: util.getValue(lines, 'ssid', '='), + uuid: util.getValue(lines, 'uuid', '='), + security: util.getValue(lines, 'key_mgmt', '='), + freq, + channel: wifiChannelFromFrequencs(freq), + bssid: util.getValue(lines, 'bssid', '=').toLowerCase() + }; + } catch (e) { + return {}; } } -module.exports = validRange +function getWifiNetworkListNmi() { + const result = []; + const cmd = 'nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null'; + try { + const stdout = execSync(cmd, util.execOptsLinux); + const parts = stdout.toString().split('ACTIVE:'); + parts.shift(); + parts.forEach(part => { + part = 'ACTIVE:' + part; + const lines = part.split(os.EOL); + const channel = util.getValue(lines, 'CHAN'); + const frequency = util.getValue(lines, 'FREQ').toLowerCase().replace('mhz', '').trim(); + const security = util.getValue(lines, 'SECURITY').replace('(', '').replace(')', ''); + const wpaFlags = util.getValue(lines, 'WPA-FLAGS').replace('(', '').replace(')', ''); + const rsnFlags = util.getValue(lines, 'RSN-FLAGS').replace('(', '').replace(')', ''); + const quality = util.getValue(lines, 'SIGNAL'); + result.push({ + ssid: util.getValue(lines, 'SSID'), + bssid: util.getValue(lines, 'BSSID').toLowerCase(), + mode: util.getValue(lines, 'MODE'), + channel: channel ? parseInt(channel, 10) : null, + frequency: frequency ? parseInt(frequency, 10) : null, + signalLevel: wifiDBFromQuality(quality), + quality: quality ? parseInt(quality, 10) : null, + security: security && security !== 'none' ? security.split(' ') : [], + wpaFlags: wpaFlags && wpaFlags !== 'none' ? wpaFlags.split(' ') : [], + rsnFlags: rsnFlags && rsnFlags !== 'none' ? rsnFlags.split(' ') : [] + }); + }); + return result; + } catch (e) { + return []; + } +} -/***/ }), +function getWifiNetworkListIw(iface) { + const result = []; + try { + let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`, util.execOptsLinux).toString().split(' Cell '); + if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; } + if (iwlistParts.length > 1) { + iwlistParts.shift(); + iwlistParts.forEach(element => { + const lines = element.split('\n'); + const channel = util.getValue(lines, 'channel', ':', true); + const address = (lines && lines.length && lines[0].indexOf('Address:') >= 0 ? lines[0].split('Address:')[1].trim().toLowerCase() : ''); + const mode = util.getValue(lines, 'mode', ':', true); + const frequency = util.getValue(lines, 'frequency', ':', true); + const qualityString = util.getValue(lines, 'Quality', '=', true); + const dbParts = qualityString.toLowerCase().split('signal level='); + const db = dbParts.length > 1 ? util.toInt(dbParts[1]) : 0; + const quality = db ? wifiQualityFromDB(db) : 0; + const ssid = util.getValue(lines, 'essid', ':', true); + + // security and wpa-flags + const isWpa = element.indexOf(' WPA ') >= 0; + const isWpa2 = element.indexOf('WPA2 ') >= 0; + const security = []; + if (isWpa) { security.push('WPA'); } + if (isWpa2) { security.push('WPA2'); } + const wpaFlags = []; + let wpaFlag = ''; + lines.forEach(function (line) { + const l = line.trim().toLowerCase(); + if (l.indexOf('group cipher') >= 0) { + if (wpaFlag) { + wpaFlags.push(wpaFlag); + } + const parts = l.split(':'); + if (parts.length > 1) { + wpaFlag = parts[1].trim().toUpperCase(); + } + } + if (l.indexOf('pairwise cipher') >= 0) { + const parts = l.split(':'); + if (parts.length > 1) { + if (parts[1].indexOf('tkip')) { wpaFlag = (wpaFlag ? 'TKIP/' + wpaFlag : 'TKIP'); } + else if (parts[1].indexOf('ccmp')) { wpaFlag = (wpaFlag ? 'CCMP/' + wpaFlag : 'CCMP'); } + else if (parts[1].indexOf('proprietary')) { wpaFlag = (wpaFlag ? 'PROP/' + wpaFlag : 'PROP'); } + } + } + if (l.indexOf('authentication suites') >= 0) { + const parts = l.split(':'); + if (parts.length > 1) { + if (parts[1].indexOf('802.1x')) { wpaFlag = (wpaFlag ? '802.1x/' + wpaFlag : '802.1x'); } + else if (parts[1].indexOf('psk')) { wpaFlag = (wpaFlag ? 'PSK/' + wpaFlag : 'PSK'); } + } + } + }); + if (wpaFlag) { + wpaFlags.push(wpaFlag); + } + + result.push({ + ssid, + bssid: address, + mode, + channel: channel ? util.toInt(channel) : null, + frequency: frequency ? util.toInt(frequency.replace('.', '')) : null, + signalLevel: db, + quality, + security, + wpaFlags, + rsnFlags: [] + }); + }); + } + return result; + } catch (e) { + return -1; + } +} -/***/ 780: -/***/ ((module) => { +function parseWifiDarwin(wifiObj) { + const result = []; + if (wifiObj) { + wifiObj.forEach(function (wifiItem) { + const signalLevel = wifiItem.RSSI; + let security = []; + let wpaFlags = []; + let ssid = wifiItem.SSID_STR || ''; + if (wifiItem.WPA_IE) { + security.push('WPA'); + if (wifiItem.WPA_IE.IE_KEY_WPA_UCIPHERS) { + wifiItem.WPA_IE.IE_KEY_WPA_UCIPHERS.forEach(function (ciphers) { + if (ciphers === 0 && wpaFlags.indexOf('unknown/TKIP') === -1) { wpaFlags.push('unknown/TKIP'); } + if (ciphers === 2 && wpaFlags.indexOf('PSK/TKIP') === -1) { wpaFlags.push('PSK/TKIP'); } + if (ciphers === 4 && wpaFlags.indexOf('PSK/AES') === -1) { wpaFlags.push('PSK/AES'); } + }); + } + } + if (wifiItem.RSN_IE) { + security.push('WPA2'); + if (wifiItem.RSN_IE.IE_KEY_RSN_UCIPHERS) { + wifiItem.RSN_IE.IE_KEY_RSN_UCIPHERS.forEach(function (ciphers) { + if (ciphers === 0 && wpaFlags.indexOf('unknown/TKIP') === -1) { wpaFlags.push('unknown/TKIP'); } + if (ciphers === 2 && wpaFlags.indexOf('TKIP/TKIP') === -1) { wpaFlags.push('TKIP/TKIP'); } + if (ciphers === 4 && wpaFlags.indexOf('PSK/AES') === -1) { wpaFlags.push('PSK/AES'); } + }); + } + } + if (wifiItem.SSID && ssid === '') { + try { + ssid = Buffer.from(wifiItem.SSID, 'base64').toString('utf8'); + } catch (err) { + util.noop(); + } + } + result.push({ + ssid, + bssid: wifiItem.BSSID || '', + mode: '', + channel: wifiItem.CHANNEL, + frequency: wifiFrequencyFromChannel(wifiItem.CHANNEL), + signalLevel: signalLevel ? parseInt(signalLevel, 10) : null, + quality: wifiQualityFromDB(signalLevel), + security, + wpaFlags, + rsnFlags: [] + }); + }); + } + return result; +} +function wifiNetworks(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux) { + result = getWifiNetworkListNmi(); + if (result.length === 0) { + try { + const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString().split('\n\n'); + let iface = ''; + iwconfigParts.forEach(element => { + if (element.indexOf('no wireless') === -1 && element.trim() !== '') { + iface = element.split(' ')[0]; + } + }); + if (iface) { + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface, true); + const l = util.mathMin(s.length, 2000); + + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } -const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/; -const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/; -// const octRegex = /0x[a-z0-9]+/; -// const binRegex = /0x[a-z0-9]+/; + const res = getWifiNetworkListIw(ifaceSanitized); + if (res === -1) { + // try again after 4 secs + setTimeout(function (iface) { + const res = getWifiNetworkListIw(iface); + if (res != -1) { result = res; } + if (callback) { + callback(result); + } + resolve(result); + }, 4000); + } else { + result = res; + if (callback) { + callback(result); + } + resolve(result); + } + } else { + if (callback) { + callback(result); + } + resolve(result); + } + } catch (e) { + if (callback) { + callback(result); + } + resolve(result); + } + } else { + if (callback) { + callback(result); + } + resolve(result); + } + } else if (_darwin) { + let cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x'; + exec(cmd, { maxBuffer: 1024 * 40000 }, function (error, stdout) { + const output = stdout.toString(); + result = parseWifiDarwin(util.plistParser(output)); + if (callback) { + callback(result); + } + resolve(result); + }); + } else if (_windows) { + let cmd = 'netsh wlan show networks mode=Bssid'; + util.powerShell(cmd).then((stdout) => { + const ssidParts = stdout.toString('utf8').split(os.EOL + os.EOL + 'SSID '); + ssidParts.shift(); + + ssidParts.forEach(ssidPart => { + const ssidLines = ssidPart.split(os.EOL); + if (ssidLines && ssidLines.length >= 8 && ssidLines[0].indexOf(':') >= 0) { + const bssidsParts = ssidPart.split(' BSSID'); + bssidsParts.shift(); + + bssidsParts.forEach((bssidPart) => { + const bssidLines = bssidPart.split(os.EOL); + const bssidLine = bssidLines[0].split(':'); + bssidLine.shift(); + const bssid = bssidLine.join(':').trim().toLowerCase(); + const channel = bssidLines[3].split(':').pop().trim(); + const quality = bssidLines[1].split(':').pop().trim(); + + result.push({ + ssid: ssidLines[0].split(':').pop().trim(), + bssid, + mode: '', + channel: channel ? parseInt(channel, 10) : null, + frequency: wifiFrequencyFromChannel(channel), + signalLevel: wifiDBFromQuality(quality), + quality: quality ? parseInt(quality, 10) : null, + security: [ssidLines[2].split(':').pop().trim()], + wpaFlags: [ssidLines[3].split(':').pop().trim()], + rsnFlags: [] + }); + }); + } + }); + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} -//polyfill -if (!Number.parseInt && window.parseInt) { - Number.parseInt = window.parseInt; +exports.wifiNetworks = wifiNetworks; + +function getVendor(model) { + model = model.toLowerCase(); + let result = ''; + if (model.indexOf('intel') >= 0) { result = 'Intel'; } + else if (model.indexOf('realtek') >= 0) { result = 'Realtek'; } + else if (model.indexOf('qualcom') >= 0) { result = 'Qualcom'; } + else if (model.indexOf('broadcom') >= 0) { result = 'Broadcom'; } + else if (model.indexOf('cavium') >= 0) { result = 'Cavium'; } + else if (model.indexOf('cisco') >= 0) { result = 'Cisco'; } + else if (model.indexOf('marvel') >= 0) { result = 'Marvel'; } + else if (model.indexOf('zyxel') >= 0) { result = 'Zyxel'; } + else if (model.indexOf('melanox') >= 0) { result = 'Melanox'; } + else if (model.indexOf('d-link') >= 0) { result = 'D-Link'; } + else if (model.indexOf('tp-link') >= 0) { result = 'TP-Link'; } + else if (model.indexOf('asus') >= 0) { result = 'Asus'; } + else if (model.indexOf('linksys') >= 0) { result = 'Linksys'; } + return result; } -if (!Number.parseFloat && window.parseFloat) { - Number.parseFloat = window.parseFloat; + +function formatBssid(s) { + s = s.replace(//g, '').match(/.{1,2}/g) || []; + return s.join(':'); } - -const consider = { - hex : true, - leadingZeros: true, - decimalPoint: "\.", - eNotation: true - //skipLike: /regex/ -}; +function wifiConnections(callback) { -function toNumber(str, options = {}){ - // const options = Object.assign({}, consider); - // if(opt.leadingZeros === false){ - // options.leadingZeros = false; - // }else if(opt.hex === false){ - // options.hex = false; - // } + return new Promise((resolve) => { + process.nextTick(() => { + const result = []; - options = Object.assign({}, consider, options ); - if(!str || typeof str !== "string" ) return str; - - let trimmedStr = str.trim(); - // if(trimmedStr === "0.0") return 0; - // else if(trimmedStr === "+0.0") return 0; - // else if(trimmedStr === "-0.0") return -0; + if (_linux) { + const ifaces = ifaceListLinux(); + const networkList = getWifiNetworkListNmi(); + ifaces.forEach(ifaceDetail => { + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ifaceDetail.iface, true); + const ll = util.mathMin(s.length, 2000); - if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str; - else if (options.hex && hexRegex.test(trimmedStr)) { - return Number.parseInt(trimmedStr, 16); - // } else if (options.parseOct && octRegex.test(str)) { - // return Number.parseInt(val, 8); - // }else if (options.parseBin && binRegex.test(str)) { - // return Number.parseInt(val, 2); - }else{ - //separate negative sign, leading zeros, and rest number - const match = numRegex.exec(trimmedStr); - if(match){ - const sign = match[1]; - const leadingZeros = match[2]; - let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros - //trim ending zeros for floating number - - const eNotation = match[4] || match[6]; - if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123 - else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123 - else{//no leading zeros or leading zeros are allowed - const num = Number(trimmedStr); - const numStr = "" + num; - if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation - if(options.eNotation) return num; - else return str; - }else if(eNotation){ //given number has enotation - if(options.eNotation) return num; - else return str; - }else if(trimmedStr.indexOf(".") !== -1){ //floating number - // const decimalPart = match[5].substr(1); - // const intPart = trimmedStr.substr(0,trimmedStr.indexOf(".")); + for (let i = 0; i <= ll; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } - - // const p = numStr.indexOf("."); - // const givenIntPart = numStr.substr(0,p); - // const givenDecPart = numStr.substr(p+1); - if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0 - else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000 - else if( sign && numStr === "-"+numTrimmedByZeros) return num; - else return str; + const nmiDetails = nmiDeviceLinux(ifaceSanitized); + const wpaDetails = wpaConnectionLinux(ifaceSanitized); + const ssid = nmiDetails.ssid || wpaDetails.ssid; + const network = networkList.filter(nw => nw.ssid === ssid); + let ssidSanitized = ''; + const t = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ssid, true); + const l = util.mathMin(t.length, 2000); + for (let i = 0; i <= l; i++) { + if (t[i] !== undefined) { + ssidSanitized = ssidSanitized + t[i]; + } + } + + const nmiConnection = nmiConnectionLinux(ssidSanitized); + const channel = network && network.length && network[0].channel ? network[0].channel : (wpaDetails.channel ? wpaDetails.channel : null); + const bssid = network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null); + const signalLevel = network && network.length && network[0].signalLevel ? network[0].signalLevel : null; + if (ssid && bssid) { + result.push({ + id: ifaceDetail.id, + iface: ifaceDetail.iface, + model: nmiDetails.product, + ssid, + bssid: network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null), + channel, + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type: nmiConnection.type ? nmiConnection.type : '802.11', + security: nmiConnection.security ? nmiConnection.security : (wpaDetails.security ? wpaDetails.security : null), + signalLevel, + quality: wifiQualityFromDB(signalLevel), + txRate: null + }); + } + }); + if (callback) { + callback(result); + } + resolve(result); + } else if (_darwin) { + let cmd = 'system_profiler SPNetworkDataType'; + exec(cmd, function (error, stdout) { + const parts1 = stdout.toString().split('\n\n Wi-Fi:\n\n'); + if (parts1.length > 1) { + const lines = parts1[1].split('\n\n')[0].split('\n'); + const iface = util.getValue(lines, 'BSD Device Name', ':', true); + const model = util.getValue(lines, 'hardware', ':', true); + cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I 2>/dev/null; echo "######" ; ioreg -n AppleBCMWLANSkywalkInterface -r 2>/dev/null'; + exec(cmd, function (error, stdout) { + const parts = stdout.toString().split('######'); + const lines2 = parts[0].split('\n'); + let lines3 = []; + if (parts[1].indexOf(' | {') > 0 && parts[1].indexOf(' | }') > parts[1].indexOf(' | {')) { + lines3 = parts[1].split(' | {')[1].split(' | }')[0].replace(/ \| /g, '').replace(/"/g, '').split('\n'); + } + if (lines2.length > 10) { + const ssid = util.getValue(lines2, 'ssid', ':', true); + const bssid = util.getValue(lines2, 'bssid', ':', true) || formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true)); + const security = util.getValue(lines2, 'link auth', ':', true); + const txRate = util.getValue(lines2, 'lastTxRate', ':', true); + const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0]; + const type = '802.11'; + const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true)); + /// const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true)); + const signalLevel = rssi; + if (ssid || bssid) { + result.push({ + id: 'Wi-Fi', + iface, + model, + ssid, + bssid, + channel: util.toInt(channel), + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type, + security, + signalLevel, + quality: wifiQualityFromDB(signalLevel), + txRate + }); } - - if(leadingZeros){ - // if(numTrimmedByZeros === numStr){ - // if(options.leadingZeros) return num; - // else return str; - // }else return str; - if(numTrimmedByZeros === numStr) return num; - else if(sign+numTrimmedByZeros === numStr) return num; - else return str; + } + if (lines3.length > 10) { + const ssid = util.getValue(lines3, 'IO80211SSID', '=', true); + const bssid = formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true)); + const security = ''; + const txRate = -1; + const signalLevel = -1; + const quality = -1; + const channel = util.getValue(lines3, 'IO80211Channel', '=', true); + const type = '802.11'; + if ((ssid || bssid) && !result.length) { + result.push({ + id: 'Wi-Fi', + iface, + model, + ssid, + bssid, + channel: util.toInt(channel), + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type, + security, + signalLevel, + quality, + txRate + }); } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } else if (_windows) { + let cmd = 'netsh wlan show interfaces'; + util.powerShell(cmd).then(function (stdout) { + const allLines = stdout.toString().split('\r\n'); + for (let i = 0; i < allLines.length; i++) { + allLines[i] = allLines[i].trim(); + } + const parts = allLines.join('\r\n').split(':\r\n\r\n'); + parts.shift(); + parts.forEach(part => { + const lines = part.split('\r\n'); + if (lines.length >= 5) { + const iface = lines[0].indexOf(':') >= 0 ? lines[0].split(':')[1].trim() : ''; + const model = lines[1].indexOf(':') >= 0 ? lines[1].split(':')[1].trim() : ''; + const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : ''; + const ssid = util.getValue(lines, 'SSID', ':', true); + const bssid = util.getValue(lines, 'BSSID', ':', true); + const quality = util.getValue(lines, 'Signal', ':', true); + const signalLevel = wifiDBFromQuality(quality); + const type = util.getValue(lines, 'Radio type', ':', true) || util.getValue(lines, 'Type de radio', ':', true) || util.getValue(lines, 'Funktyp', ':', true) || null; + const security = util.getValue(lines, 'authentication', ':', true) || util.getValue(lines, 'Authentification', ':', true) || util.getValue(lines, 'Authentifizierung', ':', true) || null; + const channel = util.getValue(lines, 'Channel', ':', true) || util.getValue(lines, 'Canal', ':', true) || util.getValue(lines, 'Kanal', ':', true) || null; + const txRate = util.getValue(lines, 'Transmit rate (mbps)', ':', true) || util.getValue(lines, 'Transmission (mbit/s)', ':', true) || util.getValue(lines, 'Empfangsrate (MBit/s)', ':', true) || null; + if (model && id && ssid && bssid) { + result.push({ + id, + iface, + model, + ssid, + bssid, + channel: util.toInt(channel), + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type, + security, + signalLevel, + quality: quality ? parseInt(quality, 10) : null, + txRate: util.toInt(txRate) || null + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} - if(trimmedStr === numStr) return num; - else if(trimmedStr === sign+numStr) return num; - // else{ - // //number with +/- sign - // trimmedStr.test(/[-+][0-9]); +exports.wifiConnections = wifiConnections; - // } - return str; +function wifiInterfaces(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + const result = []; + + if (_linux) { + const ifaces = ifaceListLinux(); + ifaces.forEach(ifaceDetail => { + const nmiDetails = nmiDeviceLinux(ifaceDetail.iface); + result.push({ + id: ifaceDetail.id, + iface: ifaceDetail.iface, + model: nmiDetails.product ? nmiDetails.product : null, + vendor: nmiDetails.vendor ? nmiDetails.vendor : null, + mac: ifaceDetail.mac, + }); + }); + if (callback) { + callback(result); + } + resolve(result); + } else if (_darwin) { + let cmd = 'system_profiler SPNetworkDataType'; + exec(cmd, function (error, stdout) { + const parts1 = stdout.toString().split('\n\n Wi-Fi:\n\n'); + if (parts1.length > 1) { + const lines = parts1[1].split('\n\n')[0].split('\n'); + const iface = util.getValue(lines, 'BSD Device Name', ':', true); + const mac = util.getValue(lines, 'MAC Address', ':', true); + const model = util.getValue(lines, 'hardware', ':', true); + result.push({ + id: 'Wi-Fi', + iface, + model, + vendor: '', + mac + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else if (_windows) { + let cmd = 'netsh wlan show interfaces'; + util.powerShell(cmd).then(function (stdout) { + const allLines = stdout.toString().split('\r\n'); + for (let i = 0; i < allLines.length; i++) { + allLines[i] = allLines[i].trim(); + } + const parts = allLines.join('\r\n').split(':\r\n\r\n'); + parts.shift(); + parts.forEach(part => { + const lines = part.split('\r\n'); + if (lines.length >= 5) { + const iface = lines[0].indexOf(':') >= 0 ? lines[0].split(':')[1].trim() : ''; + const model = lines[1].indexOf(':') >= 0 ? lines[1].split(':')[1].trim() : ''; + const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : ''; + const macParts = lines[3].indexOf(':') >= 0 ? lines[3].split(':') : []; + macParts.shift(); + const mac = macParts.join(':').trim(); + const vendor = getVendor(model); + if (iface && model && id && mac) { + result.push({ + id, + iface, + model, + vendor, + mac, + }); + } } - // else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str; - - }else{ //non-numeric string - return str; + }); + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); } - } + resolve(result); + } + }); + }); } -/** - * - * @param {string} numStr without leading zeros - * @returns - */ -function trimZeros(numStr){ - if(numStr && numStr.indexOf(".") !== -1){//float - numStr = numStr.replace(/0+$/, ""); //remove ending zeros - if(numStr === ".") numStr = "0"; - else if(numStr[0] === ".") numStr = "0"+numStr; - else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1); - return numStr; - } - return numStr; -} -module.exports = toNumber +exports.wifiInterfaces = wifiInterfaces; /***/ }), -/***/ 36: +/***/ 30036: /***/ ((module) => { /****************************************************************************** @@ -49699,26 +65648,26 @@ var __disposeResources; /***/ }), -/***/ 9382: +/***/ 89382: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(1418); +module.exports = __nccwpck_require__(91418); /***/ }), -/***/ 1418: +/***/ 91418: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var net = __nccwpck_require__(1808); -var tls = __nccwpck_require__(4404); -var http = __nccwpck_require__(3685); -var https = __nccwpck_require__(5687); -var events = __nccwpck_require__(2361); -var assert = __nccwpck_require__(9491); -var util = __nccwpck_require__(3837); +var net = __nccwpck_require__(41808); +var tls = __nccwpck_require__(24404); +var http = __nccwpck_require__(13685); +var https = __nccwpck_require__(95687); +var events = __nccwpck_require__(82361); +var assert = __nccwpck_require__(39491); +var util = __nccwpck_require__(73837); exports.httpOverHttp = httpOverHttp; @@ -49984,25 +65933,25 @@ exports.debug = debug; // for test const Client = __nccwpck_require__(7486) -const Dispatcher = __nccwpck_require__(6370) -const errors = __nccwpck_require__(4556) -const Pool = __nccwpck_require__(7509) +const Dispatcher = __nccwpck_require__(96370) +const errors = __nccwpck_require__(54556) +const Pool = __nccwpck_require__(87509) const BalancedPool = __nccwpck_require__(1960) -const Agent = __nccwpck_require__(1368) +const Agent = __nccwpck_require__(81368) const util = __nccwpck_require__(5499) const { InvalidArgumentError } = errors -const api = __nccwpck_require__(1263) -const buildConnector = __nccwpck_require__(9451) -const MockClient = __nccwpck_require__(7397) -const MockAgent = __nccwpck_require__(1099) -const MockPool = __nccwpck_require__(642) -const mockErrors = __nccwpck_require__(5674) -const ProxyAgent = __nccwpck_require__(7980) -const RetryHandler = __nccwpck_require__(183) -const { getGlobalDispatcher, setGlobalDispatcher } = __nccwpck_require__(5377) -const DecoratorHandler = __nccwpck_require__(2711) -const RedirectHandler = __nccwpck_require__(5354) -const createRedirectInterceptor = __nccwpck_require__(8444) +const api = __nccwpck_require__(71263) +const buildConnector = __nccwpck_require__(39451) +const MockClient = __nccwpck_require__(87397) +const MockAgent = __nccwpck_require__(11099) +const MockPool = __nccwpck_require__(90642) +const mockErrors = __nccwpck_require__(35674) +const ProxyAgent = __nccwpck_require__(57980) +const RetryHandler = __nccwpck_require__(10183) +const { getGlobalDispatcher, setGlobalDispatcher } = __nccwpck_require__(45377) +const DecoratorHandler = __nccwpck_require__(12711) +const RedirectHandler = __nccwpck_require__(25354) +const createRedirectInterceptor = __nccwpck_require__(16834) let hasCrypto try { @@ -50085,7 +66034,7 @@ if (util.nodeMajor > 16 || (util.nodeMajor === 16 && util.nodeMinor >= 8)) { let fetchImpl = null module.exports.fetch = async function fetch (resource) { if (!fetchImpl) { - fetchImpl = (__nccwpck_require__(6690).fetch) + fetchImpl = (__nccwpck_require__(66690).fetch) } try { @@ -50098,20 +66047,20 @@ if (util.nodeMajor > 16 || (util.nodeMajor === 16 && util.nodeMinor >= 8)) { throw err } } - module.exports.Headers = __nccwpck_require__(8031).Headers - module.exports.Response = __nccwpck_require__(2620).Response - module.exports.Request = __nccwpck_require__(6255).Request - module.exports.FormData = __nccwpck_require__(3705).FormData - module.exports.File = __nccwpck_require__(5119).File - module.exports.FileReader = __nccwpck_require__(9051).FileReader + module.exports.Headers = __nccwpck_require__(28031).Headers + module.exports.Response = __nccwpck_require__(32620).Response + module.exports.Request = __nccwpck_require__(16255).Request + module.exports.FormData = __nccwpck_require__(63705).FormData + module.exports.File = __nccwpck_require__(15119).File + module.exports.FileReader = __nccwpck_require__(79051).FileReader - const { setGlobalOrigin, getGlobalOrigin } = __nccwpck_require__(3913) + const { setGlobalOrigin, getGlobalOrigin } = __nccwpck_require__(13913) module.exports.setGlobalOrigin = setGlobalOrigin module.exports.getGlobalOrigin = getGlobalOrigin - const { CacheStorage } = __nccwpck_require__(212) - const { kConstruct } = __nccwpck_require__(645) + const { CacheStorage } = __nccwpck_require__(10212) + const { kConstruct } = __nccwpck_require__(30645) // Cache & CacheStorage are tightly coupled with fetch. Even if it may run // in an older version of Node, it doesn't have any use without fetch. @@ -50119,21 +66068,21 @@ if (util.nodeMajor > 16 || (util.nodeMajor === 16 && util.nodeMinor >= 8)) { } if (util.nodeMajor >= 16) { - const { deleteCookie, getCookies, getSetCookies, setCookie } = __nccwpck_require__(3700) + const { deleteCookie, getCookies, getSetCookies, setCookie } = __nccwpck_require__(73700) module.exports.deleteCookie = deleteCookie module.exports.getCookies = getCookies module.exports.getSetCookies = getSetCookies module.exports.setCookie = setCookie - const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(8093) + const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(68093) module.exports.parseMIMEType = parseMIMEType module.exports.serializeAMimeType = serializeAMimeType } if (util.nodeMajor >= 18 && hasCrypto) { - const { WebSocket } = __nccwpck_require__(3269) + const { WebSocket } = __nccwpck_require__(53269) module.exports.WebSocket = WebSocket } @@ -50152,19 +66101,19 @@ module.exports.mockErrors = mockErrors /***/ }), -/***/ 1368: +/***/ 81368: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { InvalidArgumentError } = __nccwpck_require__(4556) -const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(5574) -const DispatcherBase = __nccwpck_require__(44) -const Pool = __nccwpck_require__(7509) +const { InvalidArgumentError } = __nccwpck_require__(54556) +const { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = __nccwpck_require__(65574) +const DispatcherBase = __nccwpck_require__(30044) +const Pool = __nccwpck_require__(87509) const Client = __nccwpck_require__(7486) const util = __nccwpck_require__(5499) -const createRedirectInterceptor = __nccwpck_require__(8444) -const { WeakRef, FinalizationRegistry } = __nccwpck_require__(4105)() +const createRedirectInterceptor = __nccwpck_require__(16834) +const { WeakRef, FinalizationRegistry } = __nccwpck_require__(54105)() const kOnConnect = Symbol('onConnect') const kOnDisconnect = Symbol('onDisconnect') @@ -50307,11 +66256,11 @@ module.exports = Agent /***/ }), -/***/ 6682: +/***/ 36682: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const { addAbortListener } = __nccwpck_require__(5499) -const { RequestAbortedError } = __nccwpck_require__(4556) +const { RequestAbortedError } = __nccwpck_require__(54556) const kListener = Symbol('kListener') const kSignal = Symbol('kSignal') @@ -50368,15 +66317,15 @@ module.exports = { /***/ }), -/***/ 3005: +/***/ 13005: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { AsyncResource } = __nccwpck_require__(852) -const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(4556) +const { AsyncResource } = __nccwpck_require__(50852) +const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(54556) const util = __nccwpck_require__(5499) -const { addSignal, removeSignal } = __nccwpck_require__(6682) +const { addSignal, removeSignal } = __nccwpck_require__(36682) class ConnectHandler extends AsyncResource { constructor (opts, callback) { @@ -50479,7 +66428,7 @@ module.exports = connect /***/ }), -/***/ 7915: +/***/ 27915: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -50488,16 +66437,16 @@ const { Readable, Duplex, PassThrough -} = __nccwpck_require__(2781) +} = __nccwpck_require__(12781) const { InvalidArgumentError, InvalidReturnValueError, RequestAbortedError -} = __nccwpck_require__(4556) +} = __nccwpck_require__(54556) const util = __nccwpck_require__(5499) -const { AsyncResource } = __nccwpck_require__(852) -const { addSignal, removeSignal } = __nccwpck_require__(6682) -const assert = __nccwpck_require__(9491) +const { AsyncResource } = __nccwpck_require__(50852) +const { addSignal, removeSignal } = __nccwpck_require__(36682) +const assert = __nccwpck_require__(39491) const kResume = Symbol('resume') @@ -50735,20 +66684,20 @@ module.exports = pipeline /***/ }), -/***/ 8353: +/***/ 58353: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Readable = __nccwpck_require__(9304) +const Readable = __nccwpck_require__(19304) const { InvalidArgumentError, RequestAbortedError -} = __nccwpck_require__(4556) +} = __nccwpck_require__(54556) const util = __nccwpck_require__(5499) -const { getResolveErrorBodyCallback } = __nccwpck_require__(5750) -const { AsyncResource } = __nccwpck_require__(852) -const { addSignal, removeSignal } = __nccwpck_require__(6682) +const { getResolveErrorBodyCallback } = __nccwpck_require__(95750) +const { AsyncResource } = __nccwpck_require__(50852) +const { addSignal, removeSignal } = __nccwpck_require__(36682) class RequestHandler extends AsyncResource { constructor (opts, callback) { @@ -50922,21 +66871,21 @@ module.exports.RequestHandler = RequestHandler /***/ }), -/***/ 5962: +/***/ 85962: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { finished, PassThrough } = __nccwpck_require__(2781) +const { finished, PassThrough } = __nccwpck_require__(12781) const { InvalidArgumentError, InvalidReturnValueError, RequestAbortedError -} = __nccwpck_require__(4556) +} = __nccwpck_require__(54556) const util = __nccwpck_require__(5499) -const { getResolveErrorBodyCallback } = __nccwpck_require__(5750) -const { AsyncResource } = __nccwpck_require__(852) -const { addSignal, removeSignal } = __nccwpck_require__(6682) +const { getResolveErrorBodyCallback } = __nccwpck_require__(95750) +const { AsyncResource } = __nccwpck_require__(50852) +const { addSignal, removeSignal } = __nccwpck_require__(36682) class StreamHandler extends AsyncResource { constructor (opts, factory, callback) { @@ -51149,16 +67098,16 @@ module.exports = stream /***/ }), -/***/ 9355: +/***/ 19355: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(4556) -const { AsyncResource } = __nccwpck_require__(852) +const { InvalidArgumentError, RequestAbortedError, SocketError } = __nccwpck_require__(54556) +const { AsyncResource } = __nccwpck_require__(50852) const util = __nccwpck_require__(5499) -const { addSignal, removeSignal } = __nccwpck_require__(6682) -const assert = __nccwpck_require__(9491) +const { addSignal, removeSignal } = __nccwpck_require__(36682) +const assert = __nccwpck_require__(39491) class UpgradeHandler extends AsyncResource { constructor (opts, callback) { @@ -51261,30 +67210,30 @@ module.exports = upgrade /***/ }), -/***/ 1263: +/***/ 71263: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports.request = __nccwpck_require__(8353) -module.exports.stream = __nccwpck_require__(5962) -module.exports.pipeline = __nccwpck_require__(7915) -module.exports.upgrade = __nccwpck_require__(9355) -module.exports.connect = __nccwpck_require__(3005) +module.exports.request = __nccwpck_require__(58353) +module.exports.stream = __nccwpck_require__(85962) +module.exports.pipeline = __nccwpck_require__(27915) +module.exports.upgrade = __nccwpck_require__(19355) +module.exports.connect = __nccwpck_require__(13005) /***/ }), -/***/ 9304: +/***/ 19304: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // Ported from https://github.com/nodejs/undici/pull/907 -const assert = __nccwpck_require__(9491) -const { Readable } = __nccwpck_require__(2781) -const { RequestAbortedError, NotSupportedError, InvalidArgumentError } = __nccwpck_require__(4556) +const assert = __nccwpck_require__(39491) +const { Readable } = __nccwpck_require__(12781) +const { RequestAbortedError, NotSupportedError, InvalidArgumentError } = __nccwpck_require__(54556) const util = __nccwpck_require__(5499) const { ReadableStreamFrom, toUSVString } = __nccwpck_require__(5499) @@ -51566,7 +67515,7 @@ function consumeEnd (consume) { resolve(dst.buffer) } else if (type === 'blob') { if (!Blob) { - Blob = (__nccwpck_require__(4300).Blob) + Blob = (__nccwpck_require__(14300).Blob) } resolve(new Blob(body, { type: stream[kContentType] })) } @@ -51604,13 +67553,13 @@ function consumeFinish (consume, err) { /***/ }), -/***/ 5750: +/***/ 95750: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const assert = __nccwpck_require__(9491) +const assert = __nccwpck_require__(39491) const { ResponseStatusCodeError -} = __nccwpck_require__(4556) +} = __nccwpck_require__(54556) const { toUSVString } = __nccwpck_require__(5499) async function getResolveErrorBodyCallback ({ callback, body, contentType, statusCode, statusMessage, headers }) { @@ -51665,7 +67614,7 @@ module.exports = { getResolveErrorBodyCallback } const { BalancedPoolMissingUpstreamError, InvalidArgumentError -} = __nccwpck_require__(4556) +} = __nccwpck_require__(54556) const { PoolBase, kClients, @@ -51673,9 +67622,9 @@ const { kAddClient, kRemoveClient, kGetDispatcher -} = __nccwpck_require__(4421) -const Pool = __nccwpck_require__(7509) -const { kUrl, kInterceptors } = __nccwpck_require__(5574) +} = __nccwpck_require__(94421) +const Pool = __nccwpck_require__(87509) +const { kUrl, kInterceptors } = __nccwpck_require__(65574) const { parseOrigin } = __nccwpck_require__(5499) const kFactory = Symbol('factory') @@ -51854,23 +67803,23 @@ module.exports = BalancedPool /***/ }), -/***/ 8714: +/***/ 78714: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { kConstruct } = __nccwpck_require__(645) -const { urlEquals, fieldValues: getFieldValues } = __nccwpck_require__(5724) +const { kConstruct } = __nccwpck_require__(30645) +const { urlEquals, fieldValues: getFieldValues } = __nccwpck_require__(15724) const { kEnumerableProperty, isDisturbed } = __nccwpck_require__(5499) -const { kHeadersList } = __nccwpck_require__(5574) -const { webidl } = __nccwpck_require__(5989) -const { Response, cloneResponse } = __nccwpck_require__(2620) -const { Request } = __nccwpck_require__(6255) -const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(8246) -const { fetching } = __nccwpck_require__(6690) +const { kHeadersList } = __nccwpck_require__(65574) +const { webidl } = __nccwpck_require__(35989) +const { Response, cloneResponse } = __nccwpck_require__(32620) +const { Request } = __nccwpck_require__(16255) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(88246) +const { fetching } = __nccwpck_require__(66690) const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = __nccwpck_require__(3640) -const assert = __nccwpck_require__(9491) -const { getGlobalDispatcher } = __nccwpck_require__(5377) +const assert = __nccwpck_require__(39491) +const { getGlobalDispatcher } = __nccwpck_require__(45377) /** * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation @@ -52699,14 +68648,14 @@ module.exports = { /***/ }), -/***/ 212: +/***/ 10212: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { kConstruct } = __nccwpck_require__(645) -const { Cache } = __nccwpck_require__(8714) -const { webidl } = __nccwpck_require__(5989) +const { kConstruct } = __nccwpck_require__(30645) +const { Cache } = __nccwpck_require__(78714) +const { webidl } = __nccwpck_require__(35989) const { kEnumerableProperty } = __nccwpck_require__(5499) class CacheStorage { @@ -52850,25 +68799,25 @@ module.exports = { /***/ }), -/***/ 645: +/***/ 30645: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { module.exports = { - kConstruct: (__nccwpck_require__(5574).kConstruct) + kConstruct: (__nccwpck_require__(65574).kConstruct) } /***/ }), -/***/ 5724: +/***/ 15724: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const assert = __nccwpck_require__(9491) -const { URLSerializer } = __nccwpck_require__(8093) +const assert = __nccwpck_require__(39491) +const { URLSerializer } = __nccwpck_require__(68093) const { isValidHeaderName } = __nccwpck_require__(3640) /** @@ -52927,14 +68876,14 @@ module.exports = { /* global WebAssembly */ -const assert = __nccwpck_require__(9491) -const net = __nccwpck_require__(1808) -const http = __nccwpck_require__(3685) -const { pipeline } = __nccwpck_require__(2781) +const assert = __nccwpck_require__(39491) +const net = __nccwpck_require__(41808) +const http = __nccwpck_require__(13685) +const { pipeline } = __nccwpck_require__(12781) const util = __nccwpck_require__(5499) -const timers = __nccwpck_require__(8175) -const Request = __nccwpck_require__(7938) -const DispatcherBase = __nccwpck_require__(44) +const timers = __nccwpck_require__(88175) +const Request = __nccwpck_require__(27938) +const DispatcherBase = __nccwpck_require__(30044) const { RequestContentLengthMismatchError, ResponseContentLengthMismatchError, @@ -52948,8 +68897,8 @@ const { HTTPParserError, ResponseExceededMaxSizeError, ClientDestroyedError -} = __nccwpck_require__(4556) -const buildConnector = __nccwpck_require__(9451) +} = __nccwpck_require__(54556) +const buildConnector = __nccwpck_require__(39451) const { kUrl, kReset, @@ -53001,12 +68950,12 @@ const { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest -} = __nccwpck_require__(5574) +} = __nccwpck_require__(65574) /** @type {import('http2')} */ let http2 try { - http2 = __nccwpck_require__(5158) + http2 = __nccwpck_require__(85158) } catch { // @ts-ignore http2 = { constants: {} } @@ -53034,7 +68983,7 @@ const kClosedResolve = Symbol('kClosedResolve') const channels = {} try { - const diagnosticsChannel = __nccwpck_require__(7643) + const diagnosticsChannel = __nccwpck_require__(67643) channels.sendHeaders = diagnosticsChannel.channel('undici:client:sendHeaders') channels.beforeConnect = diagnosticsChannel.channel('undici:client:beforeConnect') channels.connectError = diagnosticsChannel.channel('undici:client:connectError') @@ -53407,8 +69356,8 @@ function onHTTP2GoAway (code) { resume(client) } -const constants = __nccwpck_require__(2343) -const createRedirectInterceptor = __nccwpck_require__(8444) +const constants = __nccwpck_require__(92343) +const createRedirectInterceptor = __nccwpck_require__(16834) const EMPTY_BUF = Buffer.alloc(0) async function lazyllhttp () { @@ -53416,7 +69365,7 @@ async function lazyllhttp () { let mod try { - mod = await WebAssembly.compile(Buffer.from(__nccwpck_require__(2646), 'base64')) + mod = await WebAssembly.compile(Buffer.from(__nccwpck_require__(52646), 'base64')) } catch (e) { /* istanbul ignore next */ @@ -55208,14 +71157,14 @@ module.exports = Client /***/ }), -/***/ 4105: +/***/ 54105: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { /* istanbul ignore file: only for Node 12 */ -const { kConnected, kSize } = __nccwpck_require__(5574) +const { kConnected, kSize } = __nccwpck_require__(65574) class CompatWeakRef { constructor (value) { @@ -55263,7 +71212,7 @@ module.exports = function () { /***/ }), -/***/ 8887: +/***/ 18887: /***/ ((module) => { @@ -55282,15 +71231,15 @@ module.exports = { /***/ }), -/***/ 3700: +/***/ 73700: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { parseSetCookie } = __nccwpck_require__(3402) +const { parseSetCookie } = __nccwpck_require__(13402) const { stringify, getHeadersList } = __nccwpck_require__(373) -const { webidl } = __nccwpck_require__(5989) -const { Headers } = __nccwpck_require__(8031) +const { webidl } = __nccwpck_require__(35989) +const { Headers } = __nccwpck_require__(28031) /** * @typedef {Object} Cookie @@ -55473,15 +71422,15 @@ module.exports = { /***/ }), -/***/ 3402: +/***/ 13402: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(8887) +const { maxNameValuePairSize, maxAttributeValueSize } = __nccwpck_require__(18887) const { isCTLExcludingHtab } = __nccwpck_require__(373) -const { collectASequenceOfCodePointsFast } = __nccwpck_require__(8093) -const assert = __nccwpck_require__(9491) +const { collectASequenceOfCodePointsFast } = __nccwpck_require__(68093) +const assert = __nccwpck_require__(39491) /** * @description Parses the field-value attributes of a set-cookie header string. @@ -55802,8 +71751,8 @@ module.exports = { -const assert = __nccwpck_require__(9491) -const { kHeadersList } = __nccwpck_require__(5574) +const assert = __nccwpck_require__(39491) +const { kHeadersList } = __nccwpck_require__(65574) function isCTLExcludingHtab (value) { if (value.length === 0) { @@ -56095,15 +72044,15 @@ module.exports = { /***/ }), -/***/ 9451: +/***/ 39451: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const net = __nccwpck_require__(1808) -const assert = __nccwpck_require__(9491) +const net = __nccwpck_require__(41808) +const assert = __nccwpck_require__(39491) const util = __nccwpck_require__(5499) -const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(4556) +const { InvalidArgumentError, ConnectTimeoutError } = __nccwpck_require__(54556) let tls // include tls conditionally since it is not always available @@ -56186,7 +72135,7 @@ function buildConnector ({ allowH2, maxCachedSessions, socketPath, timeout, ...o let socket if (protocol === 'https:') { if (!tls) { - tls = __nccwpck_require__(4404) + tls = __nccwpck_require__(24404) } servername = servername || options.servername || util.getServerName(host) || null @@ -56416,7 +72365,7 @@ module.exports = { /***/ }), -/***/ 4556: +/***/ 54556: /***/ ((module) => { @@ -56653,7 +72602,7 @@ module.exports = { /***/ }), -/***/ 7938: +/***/ 27938: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -56661,9 +72610,9 @@ module.exports = { const { InvalidArgumentError, NotSupportedError -} = __nccwpck_require__(4556) -const assert = __nccwpck_require__(9491) -const { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = __nccwpck_require__(5574) +} = __nccwpck_require__(54556) +const assert = __nccwpck_require__(39491) +const { kHTTP2BuildRequest, kHTTP2CopyHeaders, kHTTP1BuildRequest } = __nccwpck_require__(65574) const util = __nccwpck_require__(5499) // tokenRegExp and headerCharRegex have been lifted from @@ -56694,7 +72643,7 @@ const channels = {} let extractBody try { - const diagnosticsChannel = __nccwpck_require__(7643) + const diagnosticsChannel = __nccwpck_require__(67643) channels.create = diagnosticsChannel.channel('undici:request:create') channels.bodySent = diagnosticsChannel.channel('undici:request:bodySent') channels.headers = diagnosticsChannel.channel('undici:request:headers') @@ -56859,7 +72808,7 @@ class Request { } if (!extractBody) { - extractBody = (__nccwpck_require__(2256).extractBody) + extractBody = (__nccwpck_require__(92256).extractBody) } const [bodyStream, contentType] = extractBody(body) @@ -57159,7 +73108,7 @@ module.exports = Request /***/ }), -/***/ 5574: +/***/ 65574: /***/ ((module) => { module.exports = { @@ -57234,15 +73183,15 @@ module.exports = { -const assert = __nccwpck_require__(9491) -const { kDestroyed, kBodyUsed } = __nccwpck_require__(5574) -const { IncomingMessage } = __nccwpck_require__(3685) -const stream = __nccwpck_require__(2781) -const net = __nccwpck_require__(1808) -const { InvalidArgumentError } = __nccwpck_require__(4556) -const { Blob } = __nccwpck_require__(4300) -const nodeUtil = __nccwpck_require__(3837) -const { stringify } = __nccwpck_require__(3477) +const assert = __nccwpck_require__(39491) +const { kDestroyed, kBodyUsed } = __nccwpck_require__(65574) +const { IncomingMessage } = __nccwpck_require__(13685) +const stream = __nccwpck_require__(12781) +const net = __nccwpck_require__(41808) +const { InvalidArgumentError } = __nccwpck_require__(54556) +const { Blob } = __nccwpck_require__(14300) +const nodeUtil = __nccwpck_require__(73837) +const { stringify } = __nccwpck_require__(63477) const { headerNameLowerCasedRecord } = __nccwpck_require__(5398) const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) @@ -57612,7 +73561,7 @@ async function * convertIterableToBuffer (iterable) { let ReadableStream function ReadableStreamFrom (iterable) { if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(5356).ReadableStream) + ReadableStream = (__nccwpck_require__(35356).ReadableStream) } if (ReadableStream.from) { @@ -57758,18 +73707,18 @@ module.exports = { /***/ }), -/***/ 44: +/***/ 30044: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Dispatcher = __nccwpck_require__(6370) +const Dispatcher = __nccwpck_require__(96370) const { ClientDestroyedError, ClientClosedError, InvalidArgumentError -} = __nccwpck_require__(4556) -const { kDestroy, kClose, kDispatch, kInterceptors } = __nccwpck_require__(5574) +} = __nccwpck_require__(54556) +const { kDestroy, kClose, kDispatch, kInterceptors } = __nccwpck_require__(65574) const kDestroyed = Symbol('destroyed') const kClosed = Symbol('closed') @@ -57957,12 +73906,12 @@ module.exports = DispatcherBase /***/ }), -/***/ 6370: +/***/ 96370: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const EventEmitter = __nccwpck_require__(2361) +const EventEmitter = __nccwpck_require__(82361) class Dispatcher extends EventEmitter { dispatch () { @@ -57983,7 +73932,7 @@ module.exports = Dispatcher /***/ }), -/***/ 2256: +/***/ 92256: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -57998,17 +73947,17 @@ const { createDeferredPromise, fullyReadBody } = __nccwpck_require__(3640) -const { FormData } = __nccwpck_require__(3705) -const { kState } = __nccwpck_require__(8246) -const { webidl } = __nccwpck_require__(5989) -const { DOMException, structuredClone } = __nccwpck_require__(9602) -const { Blob, File: NativeFile } = __nccwpck_require__(4300) -const { kBodyUsed } = __nccwpck_require__(5574) -const assert = __nccwpck_require__(9491) +const { FormData } = __nccwpck_require__(63705) +const { kState } = __nccwpck_require__(88246) +const { webidl } = __nccwpck_require__(35989) +const { DOMException, structuredClone } = __nccwpck_require__(69602) +const { Blob, File: NativeFile } = __nccwpck_require__(14300) +const { kBodyUsed } = __nccwpck_require__(65574) +const assert = __nccwpck_require__(39491) const { isErrored } = __nccwpck_require__(5499) -const { isUint8Array, isArrayBuffer } = __nccwpck_require__(9830) -const { File: UndiciFile } = __nccwpck_require__(5119) -const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(8093) +const { isUint8Array, isArrayBuffer } = __nccwpck_require__(29830) +const { File: UndiciFile } = __nccwpck_require__(15119) +const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(68093) let ReadableStream = globalThis.ReadableStream @@ -58020,7 +73969,7 @@ const textDecoder = new TextDecoder() // https://fetch.spec.whatwg.org/#concept-bodyinit-extract function extractBody (object, keepalive = false) { if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(5356).ReadableStream) + ReadableStream = (__nccwpck_require__(35356).ReadableStream) } // 1. Let stream be null. @@ -58241,7 +74190,7 @@ function extractBody (object, keepalive = false) { function safelyExtractBody (object, keepalive = false) { if (!ReadableStream) { // istanbul ignore next - ReadableStream = (__nccwpck_require__(5356).ReadableStream) + ReadableStream = (__nccwpck_require__(35356).ReadableStream) } // To safely extract a body and a `Content-Type` value from @@ -58595,12 +74544,12 @@ module.exports = { /***/ }), -/***/ 9602: +/***/ 69602: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { MessageChannel, receiveMessageOnPort } = __nccwpck_require__(1267) +const { MessageChannel, receiveMessageOnPort } = __nccwpck_require__(71267) const corsSafeListedMethods = ['GET', 'HEAD', 'POST'] const corsSafeListedMethodsSet = new Set(corsSafeListedMethods) @@ -58753,11 +74702,11 @@ module.exports = { /***/ }), -/***/ 8093: +/***/ 68093: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const assert = __nccwpck_require__(9491) -const { atob } = __nccwpck_require__(4300) +const assert = __nccwpck_require__(39491) +const { atob } = __nccwpck_require__(14300) const { isomorphicDecode } = __nccwpck_require__(3640) const encoder = new TextEncoder() @@ -59387,17 +75336,17 @@ module.exports = { /***/ }), -/***/ 5119: +/***/ 15119: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { Blob, File: NativeFile } = __nccwpck_require__(4300) -const { types } = __nccwpck_require__(3837) -const { kState } = __nccwpck_require__(8246) +const { Blob, File: NativeFile } = __nccwpck_require__(14300) +const { types } = __nccwpck_require__(73837) +const { kState } = __nccwpck_require__(88246) const { isBlobLike } = __nccwpck_require__(3640) -const { webidl } = __nccwpck_require__(5989) -const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(8093) +const { webidl } = __nccwpck_require__(35989) +const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(68093) const { kEnumerableProperty } = __nccwpck_require__(5499) const encoder = new TextEncoder() @@ -59738,16 +75687,16 @@ module.exports = { File, FileLike, isFileLike } /***/ }), -/***/ 3705: +/***/ 63705: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const { isBlobLike, toUSVString, makeIterator } = __nccwpck_require__(3640) -const { kState } = __nccwpck_require__(8246) -const { File: UndiciFile, FileLike, isFileLike } = __nccwpck_require__(5119) -const { webidl } = __nccwpck_require__(5989) -const { Blob, File: NativeFile } = __nccwpck_require__(4300) +const { kState } = __nccwpck_require__(88246) +const { File: UndiciFile, FileLike, isFileLike } = __nccwpck_require__(15119) +const { webidl } = __nccwpck_require__(35989) +const { Blob, File: NativeFile } = __nccwpck_require__(14300) /** @type {globalThis['File']} */ const File = NativeFile ?? UndiciFile @@ -60010,7 +75959,7 @@ module.exports = { FormData } /***/ }), -/***/ 3913: +/***/ 13913: /***/ ((module) => { @@ -60057,23 +76006,23 @@ module.exports = { /***/ }), -/***/ 8031: +/***/ 28031: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // https://github.com/Ethan-Arrowood/undici-fetch -const { kHeadersList, kConstruct } = __nccwpck_require__(5574) -const { kGuard } = __nccwpck_require__(8246) +const { kHeadersList, kConstruct } = __nccwpck_require__(65574) +const { kGuard } = __nccwpck_require__(88246) const { kEnumerableProperty } = __nccwpck_require__(5499) const { makeIterator, isValidHeaderName, isValidHeaderValue } = __nccwpck_require__(3640) -const { webidl } = __nccwpck_require__(5989) -const assert = __nccwpck_require__(9491) +const { webidl } = __nccwpck_require__(35989) +const assert = __nccwpck_require__(39491) const kHeadersMap = Symbol('headers map') const kHeadersSortedMap = Symbol('headers map sorted') @@ -60653,7 +76602,7 @@ module.exports = { /***/ }), -/***/ 6690: +/***/ 66690: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { // https://github.com/Ethan-Arrowood/undici-fetch @@ -60666,10 +76615,10 @@ const { makeAppropriateNetworkError, filterResponse, makeResponse -} = __nccwpck_require__(2620) -const { Headers } = __nccwpck_require__(8031) -const { Request, makeRequest } = __nccwpck_require__(6255) -const zlib = __nccwpck_require__(9796) +} = __nccwpck_require__(32620) +const { Headers } = __nccwpck_require__(28031) +const { Request, makeRequest } = __nccwpck_require__(16255) +const zlib = __nccwpck_require__(59796) const { bytesMatch, makePolicyContainer, @@ -60700,9 +76649,9 @@ const { urlIsHttpHttpsScheme, urlHasHttpsScheme } = __nccwpck_require__(3640) -const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(8246) -const assert = __nccwpck_require__(9491) -const { safelyExtractBody } = __nccwpck_require__(2256) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(88246) +const assert = __nccwpck_require__(39491) +const { safelyExtractBody } = __nccwpck_require__(92256) const { redirectStatusSet, nullBodyStatus, @@ -60710,16 +76659,16 @@ const { requestBodyHeader, subresourceSet, DOMException -} = __nccwpck_require__(9602) -const { kHeadersList } = __nccwpck_require__(5574) -const EE = __nccwpck_require__(2361) -const { Readable, pipeline } = __nccwpck_require__(2781) +} = __nccwpck_require__(69602) +const { kHeadersList } = __nccwpck_require__(65574) +const EE = __nccwpck_require__(82361) +const { Readable, pipeline } = __nccwpck_require__(12781) const { addAbortListener, isErrored, isReadable, nodeMajor, nodeMinor } = __nccwpck_require__(5499) -const { dataURLProcessor, serializeAMimeType } = __nccwpck_require__(8093) -const { TransformStream } = __nccwpck_require__(5356) -const { getGlobalDispatcher } = __nccwpck_require__(5377) -const { webidl } = __nccwpck_require__(5989) -const { STATUS_CODES } = __nccwpck_require__(3685) +const { dataURLProcessor, serializeAMimeType } = __nccwpck_require__(68093) +const { TransformStream } = __nccwpck_require__(35356) +const { getGlobalDispatcher } = __nccwpck_require__(45377) +const { webidl } = __nccwpck_require__(35989) +const { STATUS_CODES } = __nccwpck_require__(13685) const GET_OR_HEAD = ['GET', 'HEAD'] /** @type {import('buffer').resolveObjectURL} */ @@ -61461,7 +77410,7 @@ function schemeFetch (fetchParams) { } case 'blob:': { if (!resolveObjectURL) { - resolveObjectURL = (__nccwpck_require__(4300).resolveObjectURL) + resolveObjectURL = (__nccwpck_require__(14300).resolveObjectURL) } // 1. Let blobURLEntry be request’s current URL’s blob URL entry. @@ -62460,7 +78409,7 @@ async function httpNetworkFetch ( // cancelAlgorithm set to cancelAlgorithm, highWaterMark set to // highWaterMark, and sizeAlgorithm set to sizeAlgorithm. if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(5356).ReadableStream) + ReadableStream = (__nccwpck_require__(35356).ReadableStream) } const stream = new ReadableStream( @@ -62808,16 +78757,16 @@ module.exports = { /***/ }), -/***/ 6255: +/***/ 16255: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { /* globals AbortController */ -const { extractBody, mixinBody, cloneBody } = __nccwpck_require__(2256) -const { Headers, fill: fillHeaders, HeadersList } = __nccwpck_require__(8031) -const { FinalizationRegistry } = __nccwpck_require__(4105)() +const { extractBody, mixinBody, cloneBody } = __nccwpck_require__(92256) +const { Headers, fill: fillHeaders, HeadersList } = __nccwpck_require__(28031) +const { FinalizationRegistry } = __nccwpck_require__(54105)() const util = __nccwpck_require__(5499) const { isValidHTTPToken, @@ -62835,15 +78784,15 @@ const { requestCredentials, requestCache, requestDuplex -} = __nccwpck_require__(9602) +} = __nccwpck_require__(69602) const { kEnumerableProperty } = util -const { kHeaders, kSignal, kState, kGuard, kRealm } = __nccwpck_require__(8246) -const { webidl } = __nccwpck_require__(5989) -const { getGlobalOrigin } = __nccwpck_require__(3913) -const { URLSerializer } = __nccwpck_require__(8093) -const { kHeadersList, kConstruct } = __nccwpck_require__(5574) -const assert = __nccwpck_require__(9491) -const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(2361) +const { kHeaders, kSignal, kState, kGuard, kRealm } = __nccwpck_require__(88246) +const { webidl } = __nccwpck_require__(35989) +const { getGlobalOrigin } = __nccwpck_require__(13913) +const { URLSerializer } = __nccwpck_require__(68093) +const { kHeadersList, kConstruct } = __nccwpck_require__(65574) +const assert = __nccwpck_require__(39491) +const { getMaxListeners, setMaxListeners, getEventListeners, defaultMaxListeners } = __nccwpck_require__(82361) let TransformStream = globalThis.TransformStream @@ -63330,7 +79279,7 @@ class Request { // 2. Set finalBody to the result of creating a proxy for inputBody. if (!TransformStream) { - TransformStream = (__nccwpck_require__(5356).TransformStream) + TransformStream = (__nccwpck_require__(35356).TransformStream) } // https://streams.spec.whatwg.org/#readablestream-create-a-proxy @@ -63761,13 +79710,13 @@ module.exports = { Request, makeRequest } /***/ }), -/***/ 2620: +/***/ 32620: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { Headers, HeadersList, fill } = __nccwpck_require__(8031) -const { extractBody, cloneBody, mixinBody } = __nccwpck_require__(2256) +const { Headers, HeadersList, fill } = __nccwpck_require__(28031) +const { extractBody, cloneBody, mixinBody } = __nccwpck_require__(92256) const util = __nccwpck_require__(5499) const { kEnumerableProperty } = util const { @@ -63783,17 +79732,17 @@ const { redirectStatusSet, nullBodyStatus, DOMException -} = __nccwpck_require__(9602) -const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(8246) -const { webidl } = __nccwpck_require__(5989) -const { FormData } = __nccwpck_require__(3705) -const { getGlobalOrigin } = __nccwpck_require__(3913) -const { URLSerializer } = __nccwpck_require__(8093) -const { kHeadersList, kConstruct } = __nccwpck_require__(5574) -const assert = __nccwpck_require__(9491) -const { types } = __nccwpck_require__(3837) - -const ReadableStream = globalThis.ReadableStream || (__nccwpck_require__(5356).ReadableStream) +} = __nccwpck_require__(69602) +const { kState, kHeaders, kGuard, kRealm } = __nccwpck_require__(88246) +const { webidl } = __nccwpck_require__(35989) +const { FormData } = __nccwpck_require__(63705) +const { getGlobalOrigin } = __nccwpck_require__(13913) +const { URLSerializer } = __nccwpck_require__(68093) +const { kHeadersList, kConstruct } = __nccwpck_require__(65574) +const assert = __nccwpck_require__(39491) +const { types } = __nccwpck_require__(73837) + +const ReadableStream = globalThis.ReadableStream || (__nccwpck_require__(35356).ReadableStream) const textEncoder = new TextEncoder('utf-8') // https://fetch.spec.whatwg.org/#response-class @@ -64339,7 +80288,7 @@ module.exports = { /***/ }), -/***/ 8246: +/***/ 88246: /***/ ((module) => { @@ -64361,12 +80310,12 @@ module.exports = { -const { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = __nccwpck_require__(9602) -const { getGlobalOrigin } = __nccwpck_require__(3913) +const { redirectStatusSet, referrerPolicySet: referrerPolicyTokens, badPortsSet } = __nccwpck_require__(69602) +const { getGlobalOrigin } = __nccwpck_require__(13913) const { performance } = __nccwpck_require__(4074) const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(5499) -const assert = __nccwpck_require__(9491) -const { isUint8Array } = __nccwpck_require__(9830) +const assert = __nccwpck_require__(39491) +const { isUint8Array } = __nccwpck_require__(29830) let supportedHashes = [] @@ -65328,7 +81277,7 @@ let ReadableStream = globalThis.ReadableStream function isReadableStreamLike (stream) { if (!ReadableStream) { - ReadableStream = (__nccwpck_require__(5356).ReadableStream) + ReadableStream = (__nccwpck_require__(35356).ReadableStream) } return stream instanceof ReadableStream || ( @@ -65507,12 +81456,12 @@ module.exports = { /***/ }), -/***/ 5989: +/***/ 35989: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { types } = __nccwpck_require__(3837) +const { types } = __nccwpck_require__(73837) const { hasOwn, toUSVString } = __nccwpck_require__(3640) /** @type {import('../../types/webidl').Webidl} */ @@ -66160,7 +82109,7 @@ module.exports = { /***/ }), -/***/ 7475: +/***/ 17475: /***/ ((module) => { @@ -66457,7 +82406,7 @@ module.exports = { /***/ }), -/***/ 9051: +/***/ 79051: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -66466,15 +82415,15 @@ const { staticPropertyDescriptors, readOperation, fireAProgressEvent -} = __nccwpck_require__(6956) +} = __nccwpck_require__(86956) const { kState, kError, kResult, kEvents, kAborted -} = __nccwpck_require__(9763) -const { webidl } = __nccwpck_require__(5989) +} = __nccwpck_require__(63719) +const { webidl } = __nccwpck_require__(35989) const { kEnumerableProperty } = __nccwpck_require__(5499) class FileReader extends EventTarget { @@ -66808,12 +82757,12 @@ module.exports = { /***/ }), -/***/ 7633: +/***/ 47633: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { webidl } = __nccwpck_require__(5989) +const { webidl } = __nccwpck_require__(35989) const kState = Symbol('ProgressEvent state') @@ -66893,7 +82842,7 @@ module.exports = { /***/ }), -/***/ 9763: +/***/ 63719: /***/ ((module) => { @@ -66910,7 +82859,7 @@ module.exports = { /***/ }), -/***/ 6956: +/***/ 86956: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -66921,14 +82870,14 @@ const { kResult, kAborted, kLastProgressEventFired -} = __nccwpck_require__(9763) -const { ProgressEvent } = __nccwpck_require__(7633) -const { getEncoding } = __nccwpck_require__(7475) -const { DOMException } = __nccwpck_require__(9602) -const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(8093) -const { types } = __nccwpck_require__(3837) -const { StringDecoder } = __nccwpck_require__(1576) -const { btoa } = __nccwpck_require__(4300) +} = __nccwpck_require__(63719) +const { ProgressEvent } = __nccwpck_require__(47633) +const { getEncoding } = __nccwpck_require__(17475) +const { DOMException } = __nccwpck_require__(69602) +const { serializeAMimeType, parseMIMEType } = __nccwpck_require__(68093) +const { types } = __nccwpck_require__(73837) +const { StringDecoder } = __nccwpck_require__(71576) +const { btoa } = __nccwpck_require__(14300) /** @type {PropertyDescriptor} */ const staticPropertyDescriptors = { @@ -67309,7 +83258,7 @@ module.exports = { /***/ }), -/***/ 5377: +/***/ 45377: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -67317,8 +83266,8 @@ module.exports = { // We include a version number for the Dispatcher API. In case of breaking changes, // this version number must be increased to avoid conflicts. const globalDispatcher = Symbol.for('undici.globalDispatcher.1') -const { InvalidArgumentError } = __nccwpck_require__(4556) -const Agent = __nccwpck_require__(1368) +const { InvalidArgumentError } = __nccwpck_require__(54556) +const Agent = __nccwpck_require__(81368) if (getGlobalDispatcher() === undefined) { setGlobalDispatcher(new Agent()) @@ -67348,7 +83297,7 @@ module.exports = { /***/ }), -/***/ 2711: +/***/ 12711: /***/ ((module) => { @@ -67390,16 +83339,16 @@ module.exports = class DecoratorHandler { /***/ }), -/***/ 5354: +/***/ 25354: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { const util = __nccwpck_require__(5499) -const { kBodyUsed } = __nccwpck_require__(5574) -const assert = __nccwpck_require__(9491) -const { InvalidArgumentError } = __nccwpck_require__(4556) -const EE = __nccwpck_require__(2361) +const { kBodyUsed } = __nccwpck_require__(65574) +const assert = __nccwpck_require__(39491) +const { InvalidArgumentError } = __nccwpck_require__(54556) +const EE = __nccwpck_require__(82361) const redirectableStatusCodes = [300, 301, 302, 303, 307, 308] @@ -67618,13 +83567,13 @@ module.exports = RedirectHandler /***/ }), -/***/ 183: +/***/ 10183: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const assert = __nccwpck_require__(9491) +const assert = __nccwpck_require__(39491) -const { kRetryHandlerDefaultRetry } = __nccwpck_require__(5574) -const { RequestRetryError } = __nccwpck_require__(4556) +const { kRetryHandlerDefaultRetry } = __nccwpck_require__(65574) +const { RequestRetryError } = __nccwpck_require__(54556) const { isDisturbed, parseHeaders, parseRangeHeader } = __nccwpck_require__(5499) function calculateRetryAfterHeader (retryAfter) { @@ -67961,12 +83910,12 @@ module.exports = RetryHandler /***/ }), -/***/ 8444: +/***/ 16834: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const RedirectHandler = __nccwpck_require__(5354) +const RedirectHandler = __nccwpck_require__(25354) function createRedirectInterceptor ({ maxRedirections: defaultMaxRedirections }) { return (dispatch) => { @@ -67989,13 +83938,13 @@ module.exports = createRedirectInterceptor /***/ }), -/***/ 2343: +/***/ 92343: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SPECIAL_HEADERS = exports.HEADER_STATE = exports.MINOR = exports.MAJOR = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.STRICT_TOKEN = exports.HEX = exports.URL_CHAR = exports.STRICT_URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.FINISH = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0; -const utils_1 = __nccwpck_require__(6834); +const utils_1 = __nccwpck_require__(26834); // C headers var ERROR; (function (ERROR) { @@ -68281,7 +84230,7 @@ module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn /***/ }), -/***/ 2646: +/***/ 52646: /***/ ((module) => { module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn9/AGAGf39/f39/AALLAQgDZW52GHdhc21fb25faGVhZGVyc19jb21wbGV0ZQACA2VudhV3YXNtX29uX21lc3NhZ2VfYmVnaW4AAANlbnYLd2FzbV9vbl91cmwAAQNlbnYOd2FzbV9vbl9zdGF0dXMAAQNlbnYUd2FzbV9vbl9oZWFkZXJfZmllbGQAAQNlbnYUd2FzbV9vbl9oZWFkZXJfdmFsdWUAAQNlbnYMd2FzbV9vbl9ib2R5AAEDZW52GHdhc21fb25fbWVzc2FnZV9jb21wbGV0ZQAAA0ZFAwMEAAAFAAAAAAAABQEFAAUFBQAABgAAAAAGBgYGAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAAABAQcAAAUFAwABBAUBcAESEgUDAQACBggBfwFBgNQECwfRBSIGbWVtb3J5AgALX2luaXRpYWxpemUACRlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQALbGxodHRwX2luaXQAChhsbGh0dHBfc2hvdWxkX2tlZXBfYWxpdmUAQQxsbGh0dHBfYWxsb2MADAZtYWxsb2MARgtsbGh0dHBfZnJlZQANBGZyZWUASA9sbGh0dHBfZ2V0X3R5cGUADhVsbGh0dHBfZ2V0X2h0dHBfbWFqb3IADxVsbGh0dHBfZ2V0X2h0dHBfbWlub3IAEBFsbGh0dHBfZ2V0X21ldGhvZAARFmxsaHR0cF9nZXRfc3RhdHVzX2NvZGUAEhJsbGh0dHBfZ2V0X3VwZ3JhZGUAEwxsbGh0dHBfcmVzZXQAFA5sbGh0dHBfZXhlY3V0ZQAVFGxsaHR0cF9zZXR0aW5nc19pbml0ABYNbGxodHRwX2ZpbmlzaAAXDGxsaHR0cF9wYXVzZQAYDWxsaHR0cF9yZXN1bWUAGRtsbGh0dHBfcmVzdW1lX2FmdGVyX3VwZ3JhZGUAGhBsbGh0dHBfZ2V0X2Vycm5vABsXbGxodHRwX2dldF9lcnJvcl9yZWFzb24AHBdsbGh0dHBfc2V0X2Vycm9yX3JlYXNvbgAdFGxsaHR0cF9nZXRfZXJyb3JfcG9zAB4RbGxodHRwX2Vycm5vX25hbWUAHxJsbGh0dHBfbWV0aG9kX25hbWUAIBJs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IAH9CwMAIABBMGogAf0LAwAgAEEgaiAB/QsDACAAQd0BNgIcQQALewEBfwJAIAAoAgwiAw0AAkAgACgCBEUNACAAIAE2AgQLAkAgACABIAIQxICAgAAiAw0AIAAoAgwPCyAAIAM2AhxBACEDIAAoAgQiAUUNACAAIAEgAiAAKAIIEYGAgIAAACIBRQ0AIAAgAjYCFCAAIAE2AgwgASEDCyADC+TzAQMOfwN+BH8jgICAgABBEGsiAySAgICAACABIQQgASEFIAEhBiABIQcgASEIIAEhCSABIQogASELIAEhDCABIQ0gASEOIAEhDwJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQCAAKAIcIhBBf2oO3QHaAQHZAQIDBAUGBwgJCgsMDQ7YAQ8Q1wEREtYBExQVFhcYGRob4AHfARwdHtUBHyAhIiMkJdQBJicoKSorLNMB0gEtLtEB0AEvMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUbbAUdISUrPAc4BS80BTMwBTU5PUFFSU1RVVldYWVpbXF1eX2BhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ent8fX5/gAGBAYIBgwGEAYUBhgGHAYgBiQGKAYsBjAGNAY4BjwGQAZEB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QAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIBAOxwEAAQID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YWNrIGVycm9yAGBvbl9jaHVua19leHRlbnNpb25fdmFsdWVgIGNhbGxiYWNrIGVycm9yAGBvbl9zdGF0dXNfY29tcGxldGVgIGNhbGxiYWNrIGVycm9yAGBvbl92ZXJzaW9uX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fdXJsX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fY2h1bmtfY29tcGxldGVgIGNhbGxiYWNrIGVycm9yAGBvbl9oZWFkZXJfdmFsdWVfY29tcGxldGVgIGNhbGxiYWNrIGVycm9yAGBvbl9tZXNzYWdlX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fbWV0aG9kX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25faGVhZGVyX2ZpZWxkX2NvbXBsZXRlYCBjYWxsYmFjayBlcnJvcgBgb25fY2h1bmtfZXh0ZW5zaW9uX25hbWVgIGNhbGxiYWNrIGVycm9yAFVuZXhwZWN0ZWQgY2hhciBpbiB1cmwgc2VydmVyAEludmFsaWQgaGVhZGVyIHZhbHVlIGNoYXIASW52YWxpZCBoZWFkZXIgZmllbGQgY2hhcgBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX3ZlcnNpb24ASW52YWxpZCBtaW5vciB2ZXJzaW9uAEludmFsaWQgbWFqb3IgdmVyc2lvbgBFeHBlY3RlZCBzcGFjZSBhZnRlciB2ZXJzaW9uAEV4cGVjdGVkIENSTEYgYWZ0ZXIgdmVyc2lvbgBJbnZhbGlkIEhUVFAgdmVyc2lvbgBJbnZhbGlkIGhlYWRlciB0b2tlbgBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX3VybABJbnZhbGlkIGNoYXJhY3RlcnMgaW4gdXJsAFVuZXhwZWN0ZWQgc3RhcnQgY2hhciBpbiB1cmwARG91YmxlIEAgaW4gdXJsAEVtcHR5IENvbnRlbnQtTGVuZ3RoAEludmFsaWQgY2hhcmFjdGVyIGluIENvbnRlbnQtTGVuZ3RoAER1cGxpY2F0ZSBDb250ZW50LUxlbmd0aABJbnZhbGlkIGNoYXIgaW4gdXJsIHBhdGgAQ29udGVudC1MZW5ndGggY2FuJ3QgYmUgcHJlc2VudCB3aXRoIFRyYW5zZmVyLUVuY29kaW5nAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIHNpemUAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9oZWFkZXJfdmFsdWUAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9jaHVua19leHRlbnNpb25fdmFsdWUASW52YWxpZCBjaGFyYWN0ZXIgaW4gY2h1bmsgZXh0ZW5zaW9ucyB2YWx1ZQBNaXNzaW5nIGV4cGVjdGVkIExGIGFmdGVyIGhlYWRlciB2YWx1ZQBJbnZhbGlkIGBUcmFuc2Zlci1FbmNvZGluZ2AgaGVhZGVyIHZhbHVlAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIGV4dGVuc2lvbnMgcXVvdGUgdmFsdWUASW52YWxpZCBjaGFyYWN0ZXIgaW4gY2h1bmsgZXh0ZW5zaW9ucyBxdW90ZWQgdmFsdWUAUGF1c2VkIGJ5IG9uX2hlYWRlcnNfY29tcGxldGUASW52YWxpZCBFT0Ygc3RhdGUAb25fcmVzZXQgcGF1c2UAb25fY2h1bmtfaGVhZGVyIHBhdXNlAG9uX21lc3NhZ2VfYmVnaW4gcGF1c2UAb25fY2h1bmtfZXh0ZW5zaW9uX3ZhbHVlIHBhdXNlAG9uX3N0YXR1c19jb21wbGV0ZSBwYXVzZQBvbl92ZXJzaW9uX2NvbXBsZXRlIHBhdXNlAG9uX3VybF9jb21wbGV0ZSBwYXVzZQBvbl9jaHVua19jb21wbGV0ZSBwYXVzZQBvbl9oZWFkZXJfdmFsdWVfY29tcGxldGUgcGF1c2UAb25fbWVzc2FnZV9jb21wbGV0ZSBwYXVzZQBvbl9tZXRob2RfY29tcGxldGUgcGF1c2UAb25faGVhZGVyX2ZpZWxkX2NvbXBsZXRlIHBhdXNlAG9uX2NodW5rX2V4dGVuc2lvbl9uYW1lIHBhdXNlAFVuZXhwZWN0ZWQgc3BhY2UgYWZ0ZXIgc3RhcnQgbGluZQBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX2NodW5rX2V4dGVuc2lvbl9uYW1lAEludmFsaWQgY2hhcmFjdGVyIGluIGNodW5rIGV4dGVuc2lvbnMgbmFtZQBQYXVzZSBvbiBDT05ORUNUL1VwZ3JhZGUAUGF1c2Ugb24gUFJJL1VwZ3JhZGUARXhwZWN0ZWQgSFRUUC8yIENvbm5lY3Rpb24gUHJlZmFjZQBTcGFuIGNhbGxiYWNrIGVycm9yIGluIG9uX21ldGhvZABFeHBlY3RlZCBzcGFjZSBhZnRlciBtZXRob2QAU3BhbiBjYWxsYmFjayBlcnJvciBpbiBvbl9oZWFkZXJfZmllbGQAUGF1c2VkAEludmFsaWQgd29yZCBlbmNvdW50ZXJlZABJbnZhbGlkIG1ldGhvZCBlbmNvdW50ZXJlZABVbmV4cGVjdGVkIGNoYXIgaW4gdXJsIHNjaGVtYQBSZXF1ZXN0IGhhcyBpbnZhbGlkIGBUcmFuc2Zlci1FbmNvZGluZ2AAU1dJVENIX1BST1hZAFVTRV9QUk9YWQBNS0FDVElWSVRZAFVOUFJPQ0VTU0FCTEVfRU5USVRZAENPUFkATU9WRURfUEVSTUFORU5UTFkAVE9PX0VBUkxZAE5PVElGWQBGQUlMRURfREVQRU5ERU5DWQBCQURfR0FURVdBWQBQTEFZAFBVVABDSEVDS09VVABHQVRFV0FZX1RJTUVPVVQAUkVRVUVTVF9USU1FT1VUAE5FVFdPUktfQ09OTkVDVF9USU1FT1VUAENPTk5FQ1RJT05fVElNRU9VVABMT0dJTl9USU1FT1VUAE5FVFdPUktfUkVBRF9USU1FT1VUAFBPU1QATUlTRElSRUNURURfUkVRVUVTVABDTElFTlRfQ0xPU0VEX1JFUVVFU1QAQ0xJRU5UX0NMT1NFRF9MT0FEX0JBTEFOQ0VEX1JFUVVFU1QAQkFEX1JFUVVFU1QASFRUUF9SRVFVRVNUX1NFTlRfVE9fSFRUUFNfUE9SVABSRVBPUlQASU1fQV9URUFQT1QAUkVTRVRfQ09OVEVOVABOT19DT05URU5UAFBBUlRJQUxfQ09OVEVOVABIUEVfSU5WQUxJRF9DT05TVEFOVABIUEVfQ0JfUkVTRVQAR0VUAEhQRV9TVFJJQ1QAQ09ORkxJQ1QAVEVNUE9SQVJZX1JFRElSRUNUAFBFUk1BTkVOVF9SRURJUkVDVABDT05ORUNUAE1VTFRJX1NUQVRVUwBIUEVfSU5WQUxJRF9TVEFUVVMAVE9PX01BTllfUkVRVUVTVFMARUFSTFlfSElOVFMAVU5BVkFJTEFCTEVfRk9SX0xFR0FMX1JFQVNPTlMAT1BUSU9OUwBTV0lUQ0hJTkdfUFJPVE9DT0xTAFZBUklBTlRfQUxTT19ORUdPVElBVEVTAE1VTFRJUExFX0NIT0lDRVMASU5URVJOQUxfU0VSVkVSX0VSUk9SAFdFQl9TRVJWRVJfVU5LTk9XTl9FUlJPUgBSQUlMR1VOX0VSUk9SAElERU5USVRZX1BST1ZJREVSX0FVVEhFTlRJQ0FUSU9OX0VSUk9SAFNTTF9DRVJUSUZJQ0FURV9FUlJPUgBJTlZBTElEX1hfRk9SV0FSREVEX0ZPUgBTRVRfUEFSQU1FVEVSAEdFVF9QQVJBTUVURVIASFBFX1VTRVIAU0VFX09USEVSAEhQRV9DQl9DSFVOS19IRUFERVIATUtDQUxFTkRBUgBTRVRVUABXRUJfU0VSVkVSX0lTX0RPV04AVEVBUkRPV04ASFBFX0NMT1NFRF9DT05ORUNUSU9OAEhFVVJJU1RJQ19FWFBJUkFUSU9OAERJU0NPTk5FQ1RFRF9PUEVSQVRJT04ATk9OX0FVVEhPUklUQVRJVkVfSU5GT1JNQVRJT04ASFBFX0lOVkFMSURfVkVSU0lPTgBIUEVfQ0JfTUVTU0FHRV9CRUdJTgBTSVRFX0lTX0ZST1pFTgBIUEVfSU5WQUxJRF9IRUFERVJfVE9LRU4ASU5WQUxJRF9UT0tFTgBGT1JCSURERU4ARU5IQU5DRV9ZT1VSX0NBTE0ASFBFX0lOVkFMSURfVVJMAEJMT0NLRURfQllfUEFSRU5UQUxfQ09OVFJPTABNS0NPTABBQ0wASFBFX0lOVEVSTkFMAFJFUVVFU1RfSEVBREVSX0ZJRUxEU19UT09fTEFSR0VfVU5PRkZJQ0lBTABIUEVfT0sAVU5MSU5LAFVOTE9DSwBQUkkAUkVUUllfV0lUSABIUEVfSU5WQUxJRF9DT05URU5UX0xFTkdUSABIUEVfVU5FWFBFQ1RFRF9DT05URU5UX0xFTkdUSABGTFVTSABQUk9QUEFUQ0gATS1TRUFSQ0gAVVJJX1RPT19MT05HAFBST0NFU1NJTkcATUlTQ0VMTEFORU9VU19QRVJTSVNURU5UX1dBUk5JTkcATUlTQ0VMTEFORU9VU19XQVJOSU5HAEhQRV9JTlZBTElEX1RSQU5TRkVSX0VOQ09ESU5HAEV4cGVjdGVkIENSTEYASFBFX0lOVkFMSURfQ0hVTktfU0laRQBNT1ZFAENPTlRJTlVFAEhQRV9DQl9TVEFUVVNfQ09NUExFVEUASFBFX0NCX0hFQURFUlNfQ09NUExFVEUASFBFX0NCX1ZFUlNJT05fQ09NUExFVEUASFBFX0NCX1VSTF9DT01QTEVURQBIUEVfQ0JfQ0hVTktfQ09NUExFVEUASFBFX0NCX0hFQURFUl9WQUxVRV9DT01QTEVURQBIUEVfQ0JfQ0hVTktfRVhURU5TSU9OX1ZBTFVFX0NPTVBMRVRFAEhQRV9DQl9DSFVOS19FWFRFTlNJT05fTkFNRV9DT01QTEVURQBIUEVfQ0JfTUVTU0FHRV9DT01QTEVURQBIUEVfQ0JfTUVUSE9EX0NPTVBMRVRFAEhQRV9DQl9IRUFERVJfRklFTERfQ09NUExFVEUAREVMRVRFAEhQRV9JTlZBTElEX0VPRl9TVEFURQBJTlZBTElEX1NTTF9DRVJUSUZJQ0FURQBQQVVTRQBOT19SRVNQT05TRQBVTlNVUFBPUlRFRF9NRURJQV9UWVBFAEdPTkUATk9UX0FDQ0VQVEFCTEUAU0VSVklDRV9VTkFWQUlMQUJMRQBSQU5HRV9OT1RfU0FUSVNGSUFCTEUAT1JJR0lOX0lTX1VOUkVBQ0hBQkxFAFJFU1BPTlNFX0lTX1NUQUxFAFBVUkdFAE1FUkdFAFJFUVVFU1RfSEVBREVSX0ZJRUxEU19UT09fTEFSR0UAUkVRVUVTVF9IRUFERVJfVE9PX0xBUkdFAFBBWUxPQURfVE9PX0xBUkdFAElOU1VGRklDSUVOVF9TVE9SQUdFAEhQRV9QQVVTRURfVVBHUkFERQBIUEVfUEFVU0VEX0gyX1VQR1JBREUAU09VUkNFAEFOTk9VTkNFAFRSQUNFAEhQRV9VTkVYUEVDVEVEX1NQQUNFAERFU0NSSUJFAFVOU1VCU0NSSUJFAFJFQ09SRABIUEVfSU5WQUxJRF9NRVRIT0QATk9UX0ZPVU5EAFBST1BGSU5EAFVOQklORABSRUJJTkQAVU5BVVRIT1JJWkVEAE1FVEhPRF9OT1RfQUxMT1dFRABIVFRQX1ZFUlNJT05fTk9UX1NVUFBPUlRFRABBTFJFQURZX1JFUE9SVEVEAEFDQ0VQVEVEAE5PVF9JTVBMRU1FTlRFRABMT09QX0RFVEVDVEVEAEhQRV9DUl9FWFBFQ1RFRABIUEVfTEZfRVhQRUNURUQAQ1JFQVRFRABJTV9VU0VEAEhQRV9QQVVTRUQAVElNRU9VVF9PQ0NVUkVEAFBBWU1FTlRfUkVRVUlSRUQAUFJFQ09ORElUSU9OX1JFUVVJUkVEAFBST1hZX0FVVEhFTlRJQ0FUSU9OX1JFUVVJUkVEAE5FVFdPUktfQVVUSEVOVElDQVRJT05fUkVRVUlSRUQATEVOR1RIX1JFUVVJUkVEAFNTTF9DRVJUSUZJQ0FURV9SRVFVSVJFRABVUEdSQURFX1JFUVVJUkVEAFBBR0VfRVhQSVJFRABQUkVDT05ESVRJT05fRkFJTEVEAEVYUEVDVEFUSU9OX0ZBSUxFRABSRVZBTElEQVRJT05fRkFJTEVEAFNTTF9IQU5EU0hBS0VfRkFJTEVEAExPQ0tFRABUUkFOU0ZPUk1BVElPTl9BUFBMSUVEAE5PVF9NT0RJRklFRABOT1RfRVhURU5ERUQAQkFORFdJRFRIX0xJTUlUX0VYQ0VFREVEAFNJVEVfSVNfT1ZFUkxPQURFRABIRUFEAEV4cGVjdGVkIEhUVFAvAABeEwAAJhMAADAQAADwFwAAnRMAABUSAAA5FwAA8BIAAAoQAAB1EgAArRIAAIITAABPFAAAfxAAAKAVAAAjFAAAiRIAAIsUAABNFQAA1BEAAM8UAAAQGAAAyRYAANwWAADBEQAA4BcAALsUAAB0FAAAfBUAAOUUAAAIFwAAHxAAAGUVAACjFAAAKBUAAAIVAACZFQAALBAAAIsZAABPDwAA1A4AAGoQAADOEAAAAhcAAIkOAABuEwAAHBMAAGYUAABWFwAAwRMAAM0TAABsEwAAaBcAAGYXAABfFwAAIhMAAM4PAABpDgAA2A4AAGMWAADLEwAAqg4AACgXAAAmFwAAxRMAAF0WAADoEQAAZxMAAGUTAADyFgAAcxMAAB0XAAD5FgAA8xEAAM8OAADOFQAADBIAALMRAAClEQAAYRAAADIXAAC7EwAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgMCAgICAgAAAgIAAgIAAgICAgICAgICAgAEAAAAAAACAgICAgICAgICAgICAgICAgICAgICAgICAgAAAAICAgICAgICAgICAgICAgICAgICAgICAgICAgICAAIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAgICAgIAAAICAAICAAICAgICAgICAgIAAwAEAAAAAgICAgICAgICAgICAgICAgICAgICAgICAgIAAAACAgICAgICAgICAgICAgICAgICAgICAgICAgICAgACAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABsb3NlZWVwLWFsaXZlAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBAQEBAQEBAQEBAgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQFjaHVua2VkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQABAQEBAQAAAQEAAQEAAQEBAQEBAQEBAQAAAAAAAAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGVjdGlvbmVudC1sZW5ndGhvbnJveHktY29ubmVjdGlvbgAAAAAAAAAAAAAAAAAAAHJhbnNmZXItZW5jb2RpbmdwZ3JhZGUNCg0KDQpTTQ0KDQpUVFAvQ0UvVFNQLwAAAAAAAAAAAAAAAAECAAEDAAAAAAAAAAAAAAAAAAAAAAAABAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAAAAAAAAAAABAgABAwAAAAAAAAAAAAAAAAAAAAAAAAQBAQUBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAAAAAAAAAQAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAQEAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQAAAAAAAAAAAAABAAACAAAAAAAAAAAAAAAAAAAAAAAAAwQAAAQEBAQEBAQEBAQEBQQEBAQEBAQEBAQEBAAEAAYHBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAAQABAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAgAAAAACAAAAAAAAAAAAAAAAAAAAAAADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwAAAAAAAAMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5PVU5DRUVDS09VVE5FQ1RFVEVDUklCRUxVU0hFVEVBRFNFQVJDSFJHRUNUSVZJVFlMRU5EQVJWRU9USUZZUFRJT05TQ0hTRUFZU1RBVENIR0VPUkRJUkVDVE9SVFJDSFBBUkFNRVRFUlVSQ0VCU0NSSUJFQVJET1dOQUNFSU5ETktDS1VCU0NSSUJFSFRUUC9BRFRQLw==' @@ -68289,7 +84238,7 @@ module.exports = 'AGFzbQEAAAABMAhgAX8Bf2ADf39/AX9gBH9/f38Bf2AAAGADf39/AGABfwBgAn /***/ }), -/***/ 6834: +/***/ 26834: /***/ ((__unused_webpack_module, exports) => { @@ -68310,13 +84259,13 @@ exports.enumToMap = enumToMap; /***/ }), -/***/ 1099: +/***/ 11099: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { kClients } = __nccwpck_require__(5574) -const Agent = __nccwpck_require__(1368) +const { kClients } = __nccwpck_require__(65574) +const Agent = __nccwpck_require__(81368) const { kAgent, kMockAgentSet, @@ -68328,13 +84277,13 @@ const { kOptions, kFactory } = __nccwpck_require__(8212) -const MockClient = __nccwpck_require__(7397) -const MockPool = __nccwpck_require__(642) -const { matchValue, buildMockOptions } = __nccwpck_require__(3719) -const { InvalidArgumentError, UndiciError } = __nccwpck_require__(4556) -const Dispatcher = __nccwpck_require__(6370) -const Pluralizer = __nccwpck_require__(7316) -const PendingInterceptorsFormatter = __nccwpck_require__(8862) +const MockClient = __nccwpck_require__(87397) +const MockPool = __nccwpck_require__(90642) +const { matchValue, buildMockOptions } = __nccwpck_require__(53719) +const { InvalidArgumentError, UndiciError } = __nccwpck_require__(54556) +const Dispatcher = __nccwpck_require__(96370) +const Pluralizer = __nccwpck_require__(47316) +const PendingInterceptorsFormatter = __nccwpck_require__(88862) class FakeWeakRef { constructor (value) { @@ -68488,14 +84437,14 @@ module.exports = MockAgent /***/ }), -/***/ 7397: +/***/ 87397: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { promisify } = __nccwpck_require__(3837) +const { promisify } = __nccwpck_require__(73837) const Client = __nccwpck_require__(7486) -const { buildMockDispatch } = __nccwpck_require__(3719) +const { buildMockDispatch } = __nccwpck_require__(53719) const { kDispatches, kMockAgent, @@ -68506,8 +84455,8 @@ const { kConnected } = __nccwpck_require__(8212) const { MockInterceptor } = __nccwpck_require__(6882) -const Symbols = __nccwpck_require__(5574) -const { InvalidArgumentError } = __nccwpck_require__(4556) +const Symbols = __nccwpck_require__(65574) +const { InvalidArgumentError } = __nccwpck_require__(54556) /** * MockClient provides an API that extends the Client to influence the mockDispatches. @@ -68554,12 +84503,12 @@ module.exports = MockClient /***/ }), -/***/ 5674: +/***/ 35674: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { UndiciError } = __nccwpck_require__(4556) +const { UndiciError } = __nccwpck_require__(54556) class MockNotMatchedError extends UndiciError { constructor (message) { @@ -68583,7 +84532,7 @@ module.exports = { -const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(3719) +const { getResponseData, buildKey, addMockDispatch } = __nccwpck_require__(53719) const { kDispatches, kDispatchKey, @@ -68592,7 +84541,7 @@ const { kContentLength, kMockDispatch } = __nccwpck_require__(8212) -const { InvalidArgumentError } = __nccwpck_require__(4556) +const { InvalidArgumentError } = __nccwpck_require__(54556) const { buildURL } = __nccwpck_require__(5499) /** @@ -68791,14 +84740,14 @@ module.exports.MockScope = MockScope /***/ }), -/***/ 642: +/***/ 90642: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { promisify } = __nccwpck_require__(3837) -const Pool = __nccwpck_require__(7509) -const { buildMockDispatch } = __nccwpck_require__(3719) +const { promisify } = __nccwpck_require__(73837) +const Pool = __nccwpck_require__(87509) +const { buildMockDispatch } = __nccwpck_require__(53719) const { kDispatches, kMockAgent, @@ -68809,8 +84758,8 @@ const { kConnected } = __nccwpck_require__(8212) const { MockInterceptor } = __nccwpck_require__(6882) -const Symbols = __nccwpck_require__(5574) -const { InvalidArgumentError } = __nccwpck_require__(4556) +const Symbols = __nccwpck_require__(65574) +const { InvalidArgumentError } = __nccwpck_require__(54556) /** * MockPool provides an API that extends the Pool to influence the mockDispatches. @@ -68887,12 +84836,12 @@ module.exports = { /***/ }), -/***/ 3719: +/***/ 53719: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { MockNotMatchedError } = __nccwpck_require__(5674) +const { MockNotMatchedError } = __nccwpck_require__(35674) const { kDispatches, kMockAgent, @@ -68901,12 +84850,12 @@ const { kGetNetConnect } = __nccwpck_require__(8212) const { buildURL, nop } = __nccwpck_require__(5499) -const { STATUS_CODES } = __nccwpck_require__(3685) +const { STATUS_CODES } = __nccwpck_require__(13685) const { types: { isPromise } -} = __nccwpck_require__(3837) +} = __nccwpck_require__(73837) function matchValue (match, value) { if (typeof match === 'string') { @@ -69245,13 +85194,13 @@ module.exports = { /***/ }), -/***/ 8862: +/***/ 88862: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { Transform } = __nccwpck_require__(2781) -const { Console } = __nccwpck_require__(6206) +const { Transform } = __nccwpck_require__(12781) +const { Console } = __nccwpck_require__(96206) /** * Gets the output of `console.table(…)` as a string. @@ -69292,7 +85241,7 @@ module.exports = class PendingInterceptorsFormatter { /***/ }), -/***/ 7316: +/***/ 47316: /***/ ((module) => { @@ -69328,7 +85277,7 @@ module.exports = class Pluralizer { /***/ }), -/***/ 9479: +/***/ 19479: /***/ ((module) => { /* eslint-disable */ @@ -69452,15 +85401,15 @@ module.exports = class FixedQueue { /***/ }), -/***/ 4421: +/***/ 94421: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const DispatcherBase = __nccwpck_require__(44) -const FixedQueue = __nccwpck_require__(9479) -const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(5574) -const PoolStats = __nccwpck_require__(31) +const DispatcherBase = __nccwpck_require__(30044) +const FixedQueue = __nccwpck_require__(19479) +const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = __nccwpck_require__(65574) +const PoolStats = __nccwpck_require__(80031) const kClients = Symbol('clients') const kNeedDrain = Symbol('needDrain') @@ -69653,10 +85602,10 @@ module.exports = { /***/ }), -/***/ 31: +/***/ 80031: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(5574) +const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = __nccwpck_require__(65574) const kPool = Symbol('pool') class PoolStats { @@ -69694,7 +85643,7 @@ module.exports = PoolStats /***/ }), -/***/ 7509: +/***/ 87509: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -69705,14 +85654,14 @@ const { kNeedDrain, kAddClient, kGetDispatcher -} = __nccwpck_require__(4421) +} = __nccwpck_require__(94421) const Client = __nccwpck_require__(7486) const { InvalidArgumentError -} = __nccwpck_require__(4556) +} = __nccwpck_require__(54556) const util = __nccwpck_require__(5499) -const { kUrl, kInterceptors } = __nccwpck_require__(5574) -const buildConnector = __nccwpck_require__(9451) +const { kUrl, kInterceptors } = __nccwpck_require__(65574) +const buildConnector = __nccwpck_require__(39451) const kOptions = Symbol('options') const kConnections = Symbol('connections') @@ -69795,18 +85744,18 @@ module.exports = Pool /***/ }), -/***/ 7980: +/***/ 57980: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { kProxy, kClose, kDestroy, kInterceptors } = __nccwpck_require__(5574) -const { URL } = __nccwpck_require__(7310) -const Agent = __nccwpck_require__(1368) -const Pool = __nccwpck_require__(7509) -const DispatcherBase = __nccwpck_require__(44) -const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(4556) -const buildConnector = __nccwpck_require__(9451) +const { kProxy, kClose, kDestroy, kInterceptors } = __nccwpck_require__(65574) +const { URL } = __nccwpck_require__(57310) +const Agent = __nccwpck_require__(81368) +const Pool = __nccwpck_require__(87509) +const DispatcherBase = __nccwpck_require__(30044) +const { InvalidArgumentError, RequestAbortedError } = __nccwpck_require__(54556) +const buildConnector = __nccwpck_require__(39451) const kAgent = Symbol('proxy agent') const kClient = Symbol('proxy client') @@ -69991,7 +85940,7 @@ module.exports = ProxyAgent /***/ }), -/***/ 8175: +/***/ 88175: /***/ ((module) => { @@ -70095,26 +86044,26 @@ module.exports = { /***/ }), -/***/ 8131: +/***/ 98131: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const diagnosticsChannel = __nccwpck_require__(7643) +const diagnosticsChannel = __nccwpck_require__(67643) const { uid, states } = __nccwpck_require__(4499) const { kReadyState, kSentClose, kByteParser, kReceivedClose -} = __nccwpck_require__(1130) -const { fireEvent, failWebsocketConnection } = __nccwpck_require__(4873) -const { CloseEvent } = __nccwpck_require__(5976) -const { makeRequest } = __nccwpck_require__(6255) -const { fetching } = __nccwpck_require__(6690) -const { Headers } = __nccwpck_require__(8031) -const { getGlobalDispatcher } = __nccwpck_require__(5377) -const { kHeadersList } = __nccwpck_require__(5574) +} = __nccwpck_require__(31130) +const { fireEvent, failWebsocketConnection } = __nccwpck_require__(54873) +const { CloseEvent } = __nccwpck_require__(95976) +const { makeRequest } = __nccwpck_require__(16255) +const { fetching } = __nccwpck_require__(66690) +const { Headers } = __nccwpck_require__(28031) +const { getGlobalDispatcher } = __nccwpck_require__(45377) +const { kHeadersList } = __nccwpck_require__(65574) const channels = {} channels.open = diagnosticsChannel.channel('undici:websocket:open') @@ -70451,14 +86400,14 @@ module.exports = { /***/ }), -/***/ 5976: +/***/ 95976: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { webidl } = __nccwpck_require__(5989) +const { webidl } = __nccwpck_require__(35989) const { kEnumerableProperty } = __nccwpck_require__(5499) -const { MessagePort } = __nccwpck_require__(1267) +const { MessagePort } = __nccwpck_require__(71267) /** * @see https://html.spec.whatwg.org/multipage/comms.html#messageevent @@ -70841,16 +86790,16 @@ module.exports = { /***/ }), -/***/ 4077: +/***/ 14077: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { Writable } = __nccwpck_require__(2781) -const diagnosticsChannel = __nccwpck_require__(7643) +const { Writable } = __nccwpck_require__(12781) +const diagnosticsChannel = __nccwpck_require__(67643) const { parserStates, opcodes, states, emptyBuffer } = __nccwpck_require__(4499) -const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(1130) -const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(4873) +const { kReadyState, kSentClose, kResponse, kReceivedClose } = __nccwpck_require__(31130) +const { isValidStatusCode, failWebsocketConnection, websocketMessageReceived } = __nccwpck_require__(54873) const { WebsocketFrameSend } = __nccwpck_require__(3479) // This code was influenced by ws released under the MIT license. @@ -71192,7 +87141,7 @@ module.exports = { /***/ }), -/***/ 1130: +/***/ 31130: /***/ ((module) => { @@ -71211,14 +87160,14 @@ module.exports = { /***/ }), -/***/ 4873: +/***/ 54873: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(1130) +const { kReadyState, kController, kResponse, kBinaryType, kWebSocketURL } = __nccwpck_require__(31130) const { states, opcodes } = __nccwpck_require__(4499) -const { MessageEvent, ErrorEvent } = __nccwpck_require__(5976) +const { MessageEvent, ErrorEvent } = __nccwpck_require__(95976) /* globals Blob */ @@ -71418,15 +87367,15 @@ module.exports = { /***/ }), -/***/ 3269: +/***/ 53269: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const { webidl } = __nccwpck_require__(5989) -const { DOMException } = __nccwpck_require__(9602) -const { URLSerializer } = __nccwpck_require__(8093) -const { getGlobalOrigin } = __nccwpck_require__(3913) +const { webidl } = __nccwpck_require__(35989) +const { DOMException } = __nccwpck_require__(69602) +const { URLSerializer } = __nccwpck_require__(68093) +const { getGlobalOrigin } = __nccwpck_require__(13913) const { staticPropertyDescriptors, states, opcodes, emptyBuffer } = __nccwpck_require__(4499) const { kWebSocketURL, @@ -71436,14 +87385,14 @@ const { kResponse, kSentClose, kByteParser -} = __nccwpck_require__(1130) -const { isEstablished, isClosing, isValidSubprotocol, failWebsocketConnection, fireEvent } = __nccwpck_require__(4873) -const { establishWebSocketConnection } = __nccwpck_require__(8131) +} = __nccwpck_require__(31130) +const { isEstablished, isClosing, isValidSubprotocol, failWebsocketConnection, fireEvent } = __nccwpck_require__(54873) +const { establishWebSocketConnection } = __nccwpck_require__(98131) const { WebsocketFrameSend } = __nccwpck_require__(3479) -const { ByteParser } = __nccwpck_require__(4077) +const { ByteParser } = __nccwpck_require__(14077) const { kEnumerableProperty, isBlobLike } = __nccwpck_require__(5499) -const { getGlobalDispatcher } = __nccwpck_require__(5377) -const { types } = __nccwpck_require__(3837) +const { getGlobalDispatcher } = __nccwpck_require__(45377) +const { types } = __nccwpck_require__(73837) let experimentalWarned = false @@ -72066,7 +88015,7 @@ module.exports = { /***/ }), -/***/ 5212: +/***/ 65212: /***/ ((__unused_webpack_module, exports) => { @@ -72091,7 +88040,7 @@ exports.getUserAgent = getUserAgent; /***/ }), -/***/ 1972: +/***/ 91972: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72154,29 +88103,29 @@ Object.defineProperty(exports, "parse", ({ } })); -var _v = _interopRequireDefault(__nccwpck_require__(1265)); +var _v = _interopRequireDefault(__nccwpck_require__(71265)); -var _v2 = _interopRequireDefault(__nccwpck_require__(5203)); +var _v2 = _interopRequireDefault(__nccwpck_require__(95203)); -var _v3 = _interopRequireDefault(__nccwpck_require__(1222)); +var _v3 = _interopRequireDefault(__nccwpck_require__(41222)); -var _v4 = _interopRequireDefault(__nccwpck_require__(6193)); +var _v4 = _interopRequireDefault(__nccwpck_require__(56193)); var _nil = _interopRequireDefault(__nccwpck_require__(2110)); -var _version = _interopRequireDefault(__nccwpck_require__(5988)); +var _version = _interopRequireDefault(__nccwpck_require__(15988)); -var _validate = _interopRequireDefault(__nccwpck_require__(6350)); +var _validate = _interopRequireDefault(__nccwpck_require__(86350)); -var _stringify = _interopRequireDefault(__nccwpck_require__(5997)); +var _stringify = _interopRequireDefault(__nccwpck_require__(55997)); -var _parse = _interopRequireDefault(__nccwpck_require__(4713)); +var _parse = _interopRequireDefault(__nccwpck_require__(24713)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/***/ 8374: +/***/ 88374: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72219,7 +88168,7 @@ exports["default"] = _default; /***/ }), -/***/ 4713: +/***/ 24713: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72229,7 +88178,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(6350)); +var _validate = _interopRequireDefault(__nccwpck_require__(86350)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72270,7 +88219,7 @@ exports["default"] = _default; /***/ }), -/***/ 5496: +/***/ 55496: /***/ ((__unused_webpack_module, exports) => { @@ -72284,7 +88233,7 @@ exports["default"] = _default; /***/ }), -/***/ 2127: +/***/ 72127: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72314,7 +88263,7 @@ function rng() { /***/ }), -/***/ 170: +/***/ 80170: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72343,7 +88292,7 @@ exports["default"] = _default; /***/ }), -/***/ 5997: +/***/ 55997: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72353,7 +88302,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(6350)); +var _validate = _interopRequireDefault(__nccwpck_require__(86350)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72388,7 +88337,7 @@ exports["default"] = _default; /***/ }), -/***/ 1265: +/***/ 71265: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72398,9 +88347,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(2127)); +var _rng = _interopRequireDefault(__nccwpck_require__(72127)); -var _stringify = _interopRequireDefault(__nccwpck_require__(5997)); +var _stringify = _interopRequireDefault(__nccwpck_require__(55997)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72501,7 +88450,7 @@ exports["default"] = _default; /***/ }), -/***/ 5203: +/***/ 95203: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72511,9 +88460,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(9952)); +var _v = _interopRequireDefault(__nccwpck_require__(79952)); -var _md = _interopRequireDefault(__nccwpck_require__(8374)); +var _md = _interopRequireDefault(__nccwpck_require__(88374)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72523,7 +88472,7 @@ exports["default"] = _default; /***/ }), -/***/ 9952: +/***/ 79952: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72534,9 +88483,9 @@ Object.defineProperty(exports, "__esModule", ({ exports["default"] = _default; exports.URL = exports.DNS = void 0; -var _stringify = _interopRequireDefault(__nccwpck_require__(5997)); +var _stringify = _interopRequireDefault(__nccwpck_require__(55997)); -var _parse = _interopRequireDefault(__nccwpck_require__(4713)); +var _parse = _interopRequireDefault(__nccwpck_require__(24713)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72607,7 +88556,7 @@ function _default(name, version, hashfunc) { /***/ }), -/***/ 1222: +/***/ 41222: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72617,9 +88566,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _rng = _interopRequireDefault(__nccwpck_require__(2127)); +var _rng = _interopRequireDefault(__nccwpck_require__(72127)); -var _stringify = _interopRequireDefault(__nccwpck_require__(5997)); +var _stringify = _interopRequireDefault(__nccwpck_require__(55997)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72650,7 +88599,7 @@ exports["default"] = _default; /***/ }), -/***/ 6193: +/***/ 56193: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72660,9 +88609,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _v = _interopRequireDefault(__nccwpck_require__(9952)); +var _v = _interopRequireDefault(__nccwpck_require__(79952)); -var _sha = _interopRequireDefault(__nccwpck_require__(170)); +var _sha = _interopRequireDefault(__nccwpck_require__(80170)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72672,7 +88621,7 @@ exports["default"] = _default; /***/ }), -/***/ 6350: +/***/ 86350: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72682,7 +88631,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _regex = _interopRequireDefault(__nccwpck_require__(5496)); +var _regex = _interopRequireDefault(__nccwpck_require__(55496)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72695,7 +88644,7 @@ exports["default"] = _default; /***/ }), -/***/ 5988: +/***/ 15988: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -72705,7 +88654,7 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = void 0; -var _validate = _interopRequireDefault(__nccwpck_require__(6350)); +var _validate = _interopRequireDefault(__nccwpck_require__(86350)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72722,7 +88671,7 @@ exports["default"] = _default; /***/ }), -/***/ 4586: +/***/ 84586: /***/ ((module) => { // Returns a wrapper function that returns a wrapped callback @@ -72762,7 +88711,15 @@ function wrappy (fn, cb) { /***/ }), -/***/ 383: +/***/ 87317: +/***/ ((module) => { + +module.exports = eval("require")("osx-temperature-sensor"); + + +/***/ }), + +/***/ 30383: /***/ ((module) => { module.exports = eval("require")("supports-color"); @@ -72770,35 +88727,35 @@ module.exports = eval("require")("supports-color"); /***/ }), -/***/ 9491: +/***/ 39491: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert"); /***/ }), -/***/ 852: +/***/ 50852: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("async_hooks"); /***/ }), -/***/ 4300: +/***/ 14300: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("buffer"); /***/ }), -/***/ 2081: +/***/ 32081: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("child_process"); /***/ }), -/***/ 6206: +/***/ 96206: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("console"); @@ -72812,119 +88769,119 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("crypto"); /***/ }), -/***/ 7643: +/***/ 67643: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("diagnostics_channel"); /***/ }), -/***/ 2361: +/***/ 82361: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("events"); /***/ }), -/***/ 7147: +/***/ 57147: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs"); /***/ }), -/***/ 3685: +/***/ 13685: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http"); /***/ }), -/***/ 5158: +/***/ 85158: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("http2"); /***/ }), -/***/ 5687: +/***/ 95687: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("https"); /***/ }), -/***/ 1808: +/***/ 41808: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("net"); /***/ }), -/***/ 5673: +/***/ 15673: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:events"); /***/ }), -/***/ 8849: +/***/ 88849: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http"); /***/ }), -/***/ 2286: +/***/ 22286: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:https"); /***/ }), -/***/ 612: +/***/ 70612: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os"); /***/ }), -/***/ 7742: +/***/ 97742: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:process"); /***/ }), -/***/ 4492: +/***/ 84492: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:stream"); /***/ }), -/***/ 7261: +/***/ 47261: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util"); /***/ }), -/***/ 5628: +/***/ 65628: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:zlib"); /***/ }), -/***/ 2037: +/***/ 22037: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("os"); /***/ }), -/***/ 1017: +/***/ 71017: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("path"); @@ -72938,91 +88895,91 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("perf_hooks") /***/ }), -/***/ 3477: +/***/ 63477: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("querystring"); /***/ }), -/***/ 2781: +/***/ 12781: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("stream"); /***/ }), -/***/ 5356: +/***/ 35356: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("stream/web"); /***/ }), -/***/ 1576: +/***/ 71576: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("string_decoder"); /***/ }), -/***/ 9512: +/***/ 39512: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("timers"); /***/ }), -/***/ 4404: +/***/ 24404: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("tls"); /***/ }), -/***/ 6224: +/***/ 76224: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("tty"); /***/ }), -/***/ 7310: +/***/ 57310: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("url"); /***/ }), -/***/ 3837: +/***/ 73837: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util"); /***/ }), -/***/ 9830: +/***/ 29830: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("util/types"); /***/ }), -/***/ 1267: +/***/ 71267: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("worker_threads"); /***/ }), -/***/ 9796: +/***/ 59796: /***/ ((module) => { module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("zlib"); /***/ }), -/***/ 6548: +/***/ 76548: /***/ ((__unused_webpack_module, exports) => { @@ -73059,7 +89016,7 @@ exports.AbortError = AbortError; /***/ }), -/***/ 3765: +/***/ 23765: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73067,13 +89024,13 @@ exports.AbortError = AbortError; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.AbortError = void 0; -var AbortError_js_1 = __nccwpck_require__(6548); +var AbortError_js_1 = __nccwpck_require__(76548); Object.defineProperty(exports, "AbortError", ({ enumerable: true, get: function () { return AbortError_js_1.AbortError; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 8580: +/***/ 68580: /***/ ((__unused_webpack_module, exports) => { @@ -73121,7 +89078,7 @@ exports.AzureKeyCredential = AzureKeyCredential; /***/ }), -/***/ 4659: +/***/ 34659: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73129,7 +89086,7 @@ exports.AzureKeyCredential = AzureKeyCredential; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isNamedKeyCredential = exports.AzureNamedKeyCredential = void 0; -const core_util_1 = __nccwpck_require__(7409); +const core_util_1 = __nccwpck_require__(77409); /** * A static name/key-based credential that supports updating * the underlying name and key values. @@ -73194,7 +89151,7 @@ exports.isNamedKeyCredential = isNamedKeyCredential; /***/ }), -/***/ 1895: +/***/ 81895: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73202,7 +89159,7 @@ exports.isNamedKeyCredential = isNamedKeyCredential; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isSASCredential = exports.AzureSASCredential = void 0; -const core_util_1 = __nccwpck_require__(7409); +const core_util_1 = __nccwpck_require__(77409); /** * A static-signature-based credential that supports updating * the underlying signature value. @@ -73255,7 +89212,7 @@ exports.isSASCredential = isSASCredential; /***/ }), -/***/ 6411: +/***/ 36411: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73263,23 +89220,23 @@ exports.isSASCredential = isSASCredential; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isTokenCredential = exports.isSASCredential = exports.AzureSASCredential = exports.isNamedKeyCredential = exports.AzureNamedKeyCredential = exports.isKeyCredential = exports.AzureKeyCredential = void 0; -var azureKeyCredential_js_1 = __nccwpck_require__(8580); +var azureKeyCredential_js_1 = __nccwpck_require__(68580); Object.defineProperty(exports, "AzureKeyCredential", ({ enumerable: true, get: function () { return azureKeyCredential_js_1.AzureKeyCredential; } })); -var keyCredential_js_1 = __nccwpck_require__(7769); +var keyCredential_js_1 = __nccwpck_require__(37769); Object.defineProperty(exports, "isKeyCredential", ({ enumerable: true, get: function () { return keyCredential_js_1.isKeyCredential; } })); -var azureNamedKeyCredential_js_1 = __nccwpck_require__(4659); +var azureNamedKeyCredential_js_1 = __nccwpck_require__(34659); Object.defineProperty(exports, "AzureNamedKeyCredential", ({ enumerable: true, get: function () { return azureNamedKeyCredential_js_1.AzureNamedKeyCredential; } })); Object.defineProperty(exports, "isNamedKeyCredential", ({ enumerable: true, get: function () { return azureNamedKeyCredential_js_1.isNamedKeyCredential; } })); -var azureSASCredential_js_1 = __nccwpck_require__(1895); +var azureSASCredential_js_1 = __nccwpck_require__(81895); Object.defineProperty(exports, "AzureSASCredential", ({ enumerable: true, get: function () { return azureSASCredential_js_1.AzureSASCredential; } })); Object.defineProperty(exports, "isSASCredential", ({ enumerable: true, get: function () { return azureSASCredential_js_1.isSASCredential; } })); -var tokenCredential_js_1 = __nccwpck_require__(8479); +var tokenCredential_js_1 = __nccwpck_require__(88479); Object.defineProperty(exports, "isTokenCredential", ({ enumerable: true, get: function () { return tokenCredential_js_1.isTokenCredential; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 7769: +/***/ 37769: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73287,7 +89244,7 @@ Object.defineProperty(exports, "isTokenCredential", ({ enumerable: true, get: fu // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isKeyCredential = void 0; -const core_util_1 = __nccwpck_require__(7409); +const core_util_1 = __nccwpck_require__(77409); /** * Tests an object to determine whether it implements KeyCredential. * @@ -73301,7 +89258,7 @@ exports.isKeyCredential = isKeyCredential; /***/ }), -/***/ 8479: +/***/ 88479: /***/ ((__unused_webpack_module, exports) => { @@ -73330,7 +89287,7 @@ exports.isTokenCredential = isTokenCredential; /***/ }), -/***/ 7037: +/***/ 57037: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73338,7 +89295,7 @@ exports.isTokenCredential = isTokenCredential; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.authorizeRequestOnClaimChallenge = exports.parseCAEChallenge = void 0; -const log_js_1 = __nccwpck_require__(2065); +const log_js_1 = __nccwpck_require__(22065); const base64_js_1 = __nccwpck_require__(2174); /** * Converts: `Bearer a="b", c="d", Bearer d="e", f="g"`. @@ -73410,7 +89367,7 @@ exports.authorizeRequestOnClaimChallenge = authorizeRequestOnClaimChallenge; /***/ }), -/***/ 3230: +/***/ 63863: /***/ ((__unused_webpack_module, exports) => { @@ -73582,7 +89539,7 @@ exports.decodeStringToString = decodeStringToString; /***/ }), -/***/ 7692: +/***/ 37692: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73590,10 +89547,10 @@ exports.decodeStringToString = decodeStringToString; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.deserializationPolicy = exports.deserializationPolicyName = void 0; -const interfaces_js_1 = __nccwpck_require__(7154); -const core_rest_pipeline_1 = __nccwpck_require__(1547); -const serializer_js_1 = __nccwpck_require__(8683); -const operationHelpers_js_1 = __nccwpck_require__(43); +const interfaces_js_1 = __nccwpck_require__(97154); +const core_rest_pipeline_1 = __nccwpck_require__(61547); +const serializer_js_1 = __nccwpck_require__(28683); +const operationHelpers_js_1 = __nccwpck_require__(70043); const defaultJsonContentTypes = ["application/json", "text/json"]; const defaultXmlContentTypes = ["application/xml", "application/atom+xml"]; /** @@ -73823,7 +89780,7 @@ async function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts, /***/ }), -/***/ 5907: +/***/ 25907: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73831,7 +89788,7 @@ async function parse(jsonContentTypes, xmlContentTypes, operationResponse, opts, // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getCachedDefaultHttpClient = void 0; -const core_rest_pipeline_1 = __nccwpck_require__(1547); +const core_rest_pipeline_1 = __nccwpck_require__(61547); let cachedHttpClient; function getCachedDefaultHttpClient() { if (!cachedHttpClient) { @@ -73844,7 +89801,7 @@ exports.getCachedDefaultHttpClient = getCachedDefaultHttpClient; /***/ }), -/***/ 9384: +/***/ 29384: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73852,31 +89809,31 @@ exports.getCachedDefaultHttpClient = getCachedDefaultHttpClient; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.authorizeRequestOnTenantChallenge = exports.authorizeRequestOnClaimChallenge = exports.serializationPolicyName = exports.serializationPolicy = exports.deserializationPolicyName = exports.deserializationPolicy = exports.XML_CHARKEY = exports.XML_ATTRKEY = exports.createClientPipeline = exports.ServiceClient = exports.MapperTypeNames = exports.createSerializer = void 0; -var serializer_js_1 = __nccwpck_require__(8683); +var serializer_js_1 = __nccwpck_require__(28683); Object.defineProperty(exports, "createSerializer", ({ enumerable: true, get: function () { return serializer_js_1.createSerializer; } })); Object.defineProperty(exports, "MapperTypeNames", ({ enumerable: true, get: function () { return serializer_js_1.MapperTypeNames; } })); var serviceClient_js_1 = __nccwpck_require__(4398); Object.defineProperty(exports, "ServiceClient", ({ enumerable: true, get: function () { return serviceClient_js_1.ServiceClient; } })); -var pipeline_js_1 = __nccwpck_require__(8489); +var pipeline_js_1 = __nccwpck_require__(58489); Object.defineProperty(exports, "createClientPipeline", ({ enumerable: true, get: function () { return pipeline_js_1.createClientPipeline; } })); -var interfaces_js_1 = __nccwpck_require__(7154); +var interfaces_js_1 = __nccwpck_require__(97154); Object.defineProperty(exports, "XML_ATTRKEY", ({ enumerable: true, get: function () { return interfaces_js_1.XML_ATTRKEY; } })); Object.defineProperty(exports, "XML_CHARKEY", ({ enumerable: true, get: function () { return interfaces_js_1.XML_CHARKEY; } })); -var deserializationPolicy_js_1 = __nccwpck_require__(7692); +var deserializationPolicy_js_1 = __nccwpck_require__(37692); Object.defineProperty(exports, "deserializationPolicy", ({ enumerable: true, get: function () { return deserializationPolicy_js_1.deserializationPolicy; } })); Object.defineProperty(exports, "deserializationPolicyName", ({ enumerable: true, get: function () { return deserializationPolicy_js_1.deserializationPolicyName; } })); -var serializationPolicy_js_1 = __nccwpck_require__(8912); +var serializationPolicy_js_1 = __nccwpck_require__(48912); Object.defineProperty(exports, "serializationPolicy", ({ enumerable: true, get: function () { return serializationPolicy_js_1.serializationPolicy; } })); Object.defineProperty(exports, "serializationPolicyName", ({ enumerable: true, get: function () { return serializationPolicy_js_1.serializationPolicyName; } })); -var authorizeRequestOnClaimChallenge_js_1 = __nccwpck_require__(7037); +var authorizeRequestOnClaimChallenge_js_1 = __nccwpck_require__(57037); Object.defineProperty(exports, "authorizeRequestOnClaimChallenge", ({ enumerable: true, get: function () { return authorizeRequestOnClaimChallenge_js_1.authorizeRequestOnClaimChallenge; } })); -var authorizeRequestOnTenantChallenge_js_1 = __nccwpck_require__(3230); +var authorizeRequestOnTenantChallenge_js_1 = __nccwpck_require__(63863); Object.defineProperty(exports, "authorizeRequestOnTenantChallenge", ({ enumerable: true, get: function () { return authorizeRequestOnTenantChallenge_js_1.authorizeRequestOnTenantChallenge; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 8332: +/***/ 78332: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73884,7 +89841,7 @@ Object.defineProperty(exports, "authorizeRequestOnTenantChallenge", ({ enumerabl // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getPathStringFromParameter = exports.getStreamingResponseStatusCodes = void 0; -const serializer_js_1 = __nccwpck_require__(8683); +const serializer_js_1 = __nccwpck_require__(28683); /** * Gets the list of status codes for streaming responses. * @internal @@ -73926,7 +89883,7 @@ exports.getPathStringFromParameter = getPathStringFromParameter; /***/ }), -/***/ 7154: +/***/ 97154: /***/ ((__unused_webpack_module, exports) => { @@ -73946,7 +89903,7 @@ exports.XML_CHARKEY = "_"; /***/ }), -/***/ 2065: +/***/ 22065: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73954,13 +89911,13 @@ exports.XML_CHARKEY = "_"; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.logger = void 0; -const logger_1 = __nccwpck_require__(865); +const logger_1 = __nccwpck_require__(10865); exports.logger = (0, logger_1.createClientLogger)("core-client"); //# sourceMappingURL=log.js.map /***/ }), -/***/ 43: +/***/ 70043: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -73968,7 +89925,7 @@ exports.logger = (0, logger_1.createClientLogger)("core-client"); // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getOperationRequestInfo = exports.getOperationArgumentValueFromParameter = void 0; -const state_js_1 = __nccwpck_require__(9087); +const state_js_1 = __nccwpck_require__(39087); /** * @internal * Retrieves the value to use for a given operation argument @@ -74065,7 +90022,7 @@ exports.getOperationRequestInfo = getOperationRequestInfo; /***/ }), -/***/ 8489: +/***/ 58489: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -74073,9 +90030,9 @@ exports.getOperationRequestInfo = getOperationRequestInfo; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createClientPipeline = void 0; -const deserializationPolicy_js_1 = __nccwpck_require__(7692); -const core_rest_pipeline_1 = __nccwpck_require__(1547); -const serializationPolicy_js_1 = __nccwpck_require__(8912); +const deserializationPolicy_js_1 = __nccwpck_require__(37692); +const core_rest_pipeline_1 = __nccwpck_require__(61547); +const serializationPolicy_js_1 = __nccwpck_require__(48912); /** * Creates a new Pipeline for use with a Service Client. * Adds in deserializationPolicy by default. @@ -74101,7 +90058,7 @@ exports.createClientPipeline = createClientPipeline; /***/ }), -/***/ 8912: +/***/ 48912: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -74109,10 +90066,10 @@ exports.createClientPipeline = createClientPipeline; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.serializeRequestBody = exports.serializeHeaders = exports.serializationPolicy = exports.serializationPolicyName = void 0; -const interfaces_js_1 = __nccwpck_require__(7154); -const operationHelpers_js_1 = __nccwpck_require__(43); -const serializer_js_1 = __nccwpck_require__(8683); -const interfaceHelpers_js_1 = __nccwpck_require__(8332); +const interfaces_js_1 = __nccwpck_require__(97154); +const operationHelpers_js_1 = __nccwpck_require__(70043); +const serializer_js_1 = __nccwpck_require__(28683); +const interfaceHelpers_js_1 = __nccwpck_require__(78332); /** * The programmatic identifier of the serializationPolicy. */ @@ -74266,7 +90223,7 @@ function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) { /***/ }), -/***/ 8683: +/***/ 28683: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -74274,10 +90231,10 @@ function prepareXMLRootList(obj, elementName, xmlNamespaceKey, xmlNamespace) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.MapperTypeNames = exports.createSerializer = void 0; -const tslib_1 = __nccwpck_require__(36); +const tslib_1 = __nccwpck_require__(30036); const base64 = tslib_1.__importStar(__nccwpck_require__(2174)); -const interfaces_js_1 = __nccwpck_require__(7154); -const utils_js_1 = __nccwpck_require__(8102); +const interfaces_js_1 = __nccwpck_require__(97154); +const utils_js_1 = __nccwpck_require__(68102); class SerializerImpl { constructor(modelMappers = {}, isXML = false) { this.modelMappers = modelMappers; @@ -75207,14 +91164,14 @@ exports.MapperTypeNames = { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ServiceClient = void 0; -const core_rest_pipeline_1 = __nccwpck_require__(1547); -const pipeline_js_1 = __nccwpck_require__(8489); -const utils_js_1 = __nccwpck_require__(8102); -const httpClientCache_js_1 = __nccwpck_require__(5907); -const operationHelpers_js_1 = __nccwpck_require__(43); -const urlHelpers_js_1 = __nccwpck_require__(4140); -const interfaceHelpers_js_1 = __nccwpck_require__(8332); -const log_js_1 = __nccwpck_require__(2065); +const core_rest_pipeline_1 = __nccwpck_require__(61547); +const pipeline_js_1 = __nccwpck_require__(58489); +const utils_js_1 = __nccwpck_require__(68102); +const httpClientCache_js_1 = __nccwpck_require__(25907); +const operationHelpers_js_1 = __nccwpck_require__(70043); +const urlHelpers_js_1 = __nccwpck_require__(54140); +const interfaceHelpers_js_1 = __nccwpck_require__(78332); +const log_js_1 = __nccwpck_require__(22065); /** * Initializes a new instance of the ServiceClient. */ @@ -75358,7 +91315,7 @@ function getCredentialScopes(options) { /***/ }), -/***/ 9087: +/***/ 39087: /***/ ((__unused_webpack_module, exports) => { @@ -75376,7 +91333,7 @@ exports.state = { /***/ }), -/***/ 4140: +/***/ 54140: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -75384,8 +91341,8 @@ exports.state = { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.appendQueryParams = exports.getRequestUrl = void 0; -const operationHelpers_js_1 = __nccwpck_require__(43); -const interfaceHelpers_js_1 = __nccwpck_require__(8332); +const operationHelpers_js_1 = __nccwpck_require__(70043); +const interfaceHelpers_js_1 = __nccwpck_require__(78332); const CollectionFormatToDelimiterMap = { CSV: ",", SSV: " ", @@ -75622,7 +91579,7 @@ exports.appendQueryParams = appendQueryParams; /***/ }), -/***/ 8102: +/***/ 68102: /***/ ((__unused_webpack_module, exports) => { @@ -75750,7 +91707,7 @@ exports.flattenResponse = flattenResponse; /***/ }), -/***/ 3253: +/***/ 43253: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -75758,10 +91715,10 @@ exports.flattenResponse = flattenResponse; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ExtendedServiceClient = void 0; -const disableKeepAlivePolicy_js_1 = __nccwpck_require__(2880); -const core_rest_pipeline_1 = __nccwpck_require__(1547); -const core_client_1 = __nccwpck_require__(9384); -const response_js_1 = __nccwpck_require__(5453); +const disableKeepAlivePolicy_js_1 = __nccwpck_require__(42880); +const core_rest_pipeline_1 = __nccwpck_require__(61547); +const core_client_1 = __nccwpck_require__(29384); +const response_js_1 = __nccwpck_require__(85453); /** * Client to provide compatability between core V1 & V2. */ @@ -75811,7 +91768,7 @@ exports.ExtendedServiceClient = ExtendedServiceClient; /***/ }), -/***/ 8001: +/***/ 28001: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -75819,8 +91776,8 @@ exports.ExtendedServiceClient = ExtendedServiceClient; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.convertHttpClient = void 0; -const response_js_1 = __nccwpck_require__(5453); -const util_js_1 = __nccwpck_require__(6582); +const response_js_1 = __nccwpck_require__(85453); +const util_js_1 = __nccwpck_require__(46582); /** * Converts a RequestPolicy based HttpClient to a PipelineRequest based HttpClient. * @param requestPolicyClient - A HttpClient compatible with core-http @@ -75852,23 +91809,23 @@ exports.toHttpHeadersLike = exports.convertHttpClient = exports.disableKeepAlive * * @packageDocumentation */ -var extendedClient_js_1 = __nccwpck_require__(3253); +var extendedClient_js_1 = __nccwpck_require__(43253); Object.defineProperty(exports, "ExtendedServiceClient", ({ enumerable: true, get: function () { return extendedClient_js_1.ExtendedServiceClient; } })); -var requestPolicyFactoryPolicy_js_1 = __nccwpck_require__(1195); +var requestPolicyFactoryPolicy_js_1 = __nccwpck_require__(21195); Object.defineProperty(exports, "requestPolicyFactoryPolicyName", ({ enumerable: true, get: function () { return requestPolicyFactoryPolicy_js_1.requestPolicyFactoryPolicyName; } })); Object.defineProperty(exports, "createRequestPolicyFactoryPolicy", ({ enumerable: true, get: function () { return requestPolicyFactoryPolicy_js_1.createRequestPolicyFactoryPolicy; } })); Object.defineProperty(exports, "HttpPipelineLogLevel", ({ enumerable: true, get: function () { return requestPolicyFactoryPolicy_js_1.HttpPipelineLogLevel; } })); -var disableKeepAlivePolicy_js_1 = __nccwpck_require__(2880); +var disableKeepAlivePolicy_js_1 = __nccwpck_require__(42880); Object.defineProperty(exports, "disableKeepAlivePolicyName", ({ enumerable: true, get: function () { return disableKeepAlivePolicy_js_1.disableKeepAlivePolicyName; } })); -var httpClientAdapter_js_1 = __nccwpck_require__(8001); +var httpClientAdapter_js_1 = __nccwpck_require__(28001); Object.defineProperty(exports, "convertHttpClient", ({ enumerable: true, get: function () { return httpClientAdapter_js_1.convertHttpClient; } })); -var util_js_1 = __nccwpck_require__(6582); +var util_js_1 = __nccwpck_require__(46582); Object.defineProperty(exports, "toHttpHeadersLike", ({ enumerable: true, get: function () { return util_js_1.toHttpHeadersLike; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 2880: +/***/ 42880: /***/ ((__unused_webpack_module, exports) => { @@ -75898,7 +91855,7 @@ exports.pipelineContainsDisableKeepAlivePolicy = pipelineContainsDisableKeepAliv /***/ }), -/***/ 1195: +/***/ 21195: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -75906,8 +91863,8 @@ exports.pipelineContainsDisableKeepAlivePolicy = pipelineContainsDisableKeepAliv // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createRequestPolicyFactoryPolicy = exports.requestPolicyFactoryPolicyName = exports.HttpPipelineLogLevel = void 0; -const util_js_1 = __nccwpck_require__(6582); -const response_js_1 = __nccwpck_require__(5453); +const util_js_1 = __nccwpck_require__(46582); +const response_js_1 = __nccwpck_require__(85453); /** * An enum for compatibility with RequestPolicy */ @@ -75959,7 +91916,7 @@ exports.createRequestPolicyFactoryPolicy = createRequestPolicyFactoryPolicy; /***/ }), -/***/ 5453: +/***/ 85453: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -75967,8 +91924,8 @@ exports.createRequestPolicyFactoryPolicy = createRequestPolicyFactoryPolicy; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.toPipelineResponse = exports.toCompatResponse = void 0; -const core_rest_pipeline_1 = __nccwpck_require__(1547); -const util_js_1 = __nccwpck_require__(6582); +const core_rest_pipeline_1 = __nccwpck_require__(61547); +const util_js_1 = __nccwpck_require__(46582); const originalResponse = Symbol("Original FullOperationResponse"); /** * A helper to convert response objects from the new pipeline back to the old one. @@ -76030,7 +91987,7 @@ exports.toPipelineResponse = toPipelineResponse; /***/ }), -/***/ 6582: +/***/ 46582: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -76038,7 +91995,7 @@ exports.toPipelineResponse = toPipelineResponse; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpHeaders = exports.toHttpHeadersLike = exports.toWebResourceLike = exports.toPipelineRequest = void 0; -const core_rest_pipeline_1 = __nccwpck_require__(1547); +const core_rest_pipeline_1 = __nccwpck_require__(61547); // We use a custom symbol to cache a reference to the original request without // exposing it on the public interface. const originalRequestSymbol = Symbol("Original PipelineRequest"); @@ -76299,7 +92256,7 @@ exports.HttpHeaders = HttpHeaders; /***/ }), -/***/ 9662: +/***/ 29662: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -76600,7 +92557,7 @@ exports.pollHttpOperation = pollHttpOperation; /***/ }), -/***/ 7144: +/***/ 97144: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -76608,8 +92565,8 @@ exports.pollHttpOperation = pollHttpOperation; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createHttpPoller = void 0; -const operation_js_1 = __nccwpck_require__(9662); -const poller_js_1 = __nccwpck_require__(5488); +const operation_js_1 = __nccwpck_require__(29662); +const poller_js_1 = __nccwpck_require__(15488); /** * Creates a poller that can be used to poll a long-running operation. * @param lro - Description of the long-running operation @@ -76654,7 +92611,7 @@ exports.createHttpPoller = createHttpPoller; /***/ }), -/***/ 2173: +/***/ 72173: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -76662,8 +92619,8 @@ exports.createHttpPoller = createHttpPoller; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createHttpPoller = void 0; -const tslib_1 = __nccwpck_require__(36); -var poller_js_1 = __nccwpck_require__(7144); +const tslib_1 = __nccwpck_require__(30036); +var poller_js_1 = __nccwpck_require__(97144); Object.defineProperty(exports, "createHttpPoller", ({ enumerable: true, get: function () { return poller_js_1.createHttpPoller; } })); /** * This can be uncommented to expose the protocol-agnostic poller @@ -76677,14 +92634,14 @@ Object.defineProperty(exports, "createHttpPoller", ({ enumerable: true, get: fun // } from "./poller/models"; // export { buildCreatePoller } from "./poller/poller"; /** legacy */ -tslib_1.__exportStar(__nccwpck_require__(1146), exports); -tslib_1.__exportStar(__nccwpck_require__(622), exports); -tslib_1.__exportStar(__nccwpck_require__(1152), exports); +tslib_1.__exportStar(__nccwpck_require__(31146), exports); +tslib_1.__exportStar(__nccwpck_require__(80622), exports); +tslib_1.__exportStar(__nccwpck_require__(61152), exports); //# sourceMappingURL=index.js.map /***/ }), -/***/ 1146: +/***/ 31146: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -76692,13 +92649,13 @@ tslib_1.__exportStar(__nccwpck_require__(1152), exports); // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LroEngine = void 0; -var lroEngine_js_1 = __nccwpck_require__(6041); +var lroEngine_js_1 = __nccwpck_require__(96041); Object.defineProperty(exports, "LroEngine", ({ enumerable: true, get: function () { return lroEngine_js_1.LroEngine; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 6041: +/***/ 96041: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -76706,9 +92663,9 @@ Object.defineProperty(exports, "LroEngine", ({ enumerable: true, get: function ( // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.LroEngine = void 0; -const operation_js_1 = __nccwpck_require__(8583); -const constants_js_1 = __nccwpck_require__(2443); -const poller_js_1 = __nccwpck_require__(622); +const operation_js_1 = __nccwpck_require__(87310); +const constants_js_1 = __nccwpck_require__(32443); +const poller_js_1 = __nccwpck_require__(80622); const operation_js_2 = __nccwpck_require__(6552); /** * The LRO Engine, a class that performs polling. @@ -76737,7 +92694,7 @@ exports.LroEngine = LroEngine; /***/ }), -/***/ 8583: +/***/ 87310: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -76745,7 +92702,7 @@ exports.LroEngine = LroEngine; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.GenericPollOperation = void 0; -const operation_js_1 = __nccwpck_require__(9662); +const operation_js_1 = __nccwpck_require__(29662); const logger_js_1 = __nccwpck_require__(8561); const createStateProxy = () => ({ initState: (config) => ({ config, isStarted: true }), @@ -76831,7 +92788,7 @@ exports.GenericPollOperation = GenericPollOperation; /***/ }), -/***/ 1152: +/***/ 61152: /***/ ((__unused_webpack_module, exports) => { @@ -76842,7 +92799,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), -/***/ 622: +/***/ 80622: /***/ ((__unused_webpack_module, exports) => { @@ -77259,7 +93216,7 @@ exports.Poller = Poller; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.logger = void 0; -const logger_1 = __nccwpck_require__(865); +const logger_1 = __nccwpck_require__(10865); /** * The `@azure/logger` configuration for this package. * @internal @@ -77269,7 +93226,7 @@ exports.logger = (0, logger_1.createClientLogger)("core-lro"); /***/ }), -/***/ 2443: +/***/ 32443: /***/ ((__unused_webpack_module, exports) => { @@ -77298,7 +93255,7 @@ exports.terminalStates = ["succeeded", "canceled", "failed"]; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.pollOperation = exports.initOperation = exports.deserializeState = void 0; const logger_js_1 = __nccwpck_require__(8561); -const constants_js_1 = __nccwpck_require__(2443); +const constants_js_1 = __nccwpck_require__(32443); /** * Deserializes the state */ @@ -77467,7 +93424,7 @@ exports.pollOperation = pollOperation; /***/ }), -/***/ 5488: +/***/ 15488: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -77476,8 +93433,8 @@ exports.pollOperation = pollOperation; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.buildCreatePoller = void 0; const operation_js_1 = __nccwpck_require__(6552); -const constants_js_1 = __nccwpck_require__(2443); -const core_util_1 = __nccwpck_require__(7409); +const constants_js_1 = __nccwpck_require__(32443); +const core_util_1 = __nccwpck_require__(77409); const createStateProxy = () => ({ /** * The state at this point is created to be of type OperationState. @@ -77647,7 +93604,7 @@ exports.buildCreatePoller = buildCreatePoller; /***/ }), -/***/ 6111: +/***/ 56111: /***/ ((__unused_webpack_module, exports) => { @@ -77669,19 +93626,19 @@ exports.DEFAULT_RETRY_POLICY_COUNT = 3; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createPipelineFromOptions = createPipelineFromOptions; -const logPolicy_js_1 = __nccwpck_require__(2114); -const pipeline_js_1 = __nccwpck_require__(4795); -const redirectPolicy_js_1 = __nccwpck_require__(627); +const logPolicy_js_1 = __nccwpck_require__(32114); +const pipeline_js_1 = __nccwpck_require__(44795); +const redirectPolicy_js_1 = __nccwpck_require__(40212); const userAgentPolicy_js_1 = __nccwpck_require__(6060); -const multipartPolicy_js_1 = __nccwpck_require__(2150); -const decompressResponsePolicy_js_1 = __nccwpck_require__(9381); -const defaultRetryPolicy_js_1 = __nccwpck_require__(6185); -const formDataPolicy_js_1 = __nccwpck_require__(2963); -const core_util_1 = __nccwpck_require__(7409); -const proxyPolicy_js_1 = __nccwpck_require__(4886); -const setClientRequestIdPolicy_js_1 = __nccwpck_require__(5136); -const tlsPolicy_js_1 = __nccwpck_require__(7761); -const tracingPolicy_js_1 = __nccwpck_require__(7199); +const multipartPolicy_js_1 = __nccwpck_require__(62150); +const decompressResponsePolicy_js_1 = __nccwpck_require__(19381); +const defaultRetryPolicy_js_1 = __nccwpck_require__(66185); +const formDataPolicy_js_1 = __nccwpck_require__(12963); +const core_util_1 = __nccwpck_require__(77409); +const proxyPolicy_js_1 = __nccwpck_require__(54886); +const setClientRequestIdPolicy_js_1 = __nccwpck_require__(75136); +const tlsPolicy_js_1 = __nccwpck_require__(17761); +const tracingPolicy_js_1 = __nccwpck_require__(87199); /** * Create a new pipeline with a default set of customizable policies. * @param options - Options to configure a custom pipeline. @@ -77719,7 +93676,7 @@ function createPipelineFromOptions(options) { /***/ }), -/***/ 8469: +/***/ 68469: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -77727,7 +93684,7 @@ function createPipelineFromOptions(options) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createDefaultHttpClient = createDefaultHttpClient; -const nodeHttpClient_js_1 = __nccwpck_require__(1766); +const nodeHttpClient_js_1 = __nccwpck_require__(91766); /** * Create the correct HttpClient for the current environment. */ @@ -77738,7 +93695,7 @@ function createDefaultHttpClient() { /***/ }), -/***/ 5315: +/***/ 45315: /***/ ((__unused_webpack_module, exports) => { @@ -77836,7 +93793,7 @@ function createHttpHeaders(rawHeaders) { /***/ }), -/***/ 1547: +/***/ 61547: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -77844,39 +93801,39 @@ function createHttpHeaders(rawHeaders) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createFileFromStream = exports.createFile = exports.auxiliaryAuthenticationHeaderPolicyName = exports.auxiliaryAuthenticationHeaderPolicy = exports.ndJsonPolicyName = exports.ndJsonPolicy = exports.bearerTokenAuthenticationPolicyName = exports.bearerTokenAuthenticationPolicy = exports.formDataPolicyName = exports.formDataPolicy = exports.tlsPolicyName = exports.tlsPolicy = exports.userAgentPolicyName = exports.userAgentPolicy = exports.defaultRetryPolicy = exports.tracingPolicyName = exports.tracingPolicy = exports.retryPolicy = exports.throttlingRetryPolicyName = exports.throttlingRetryPolicy = exports.systemErrorRetryPolicyName = exports.systemErrorRetryPolicy = exports.redirectPolicyName = exports.redirectPolicy = exports.getDefaultProxySettings = exports.proxyPolicyName = exports.proxyPolicy = exports.multipartPolicyName = exports.multipartPolicy = exports.logPolicyName = exports.logPolicy = exports.setClientRequestIdPolicyName = exports.setClientRequestIdPolicy = exports.exponentialRetryPolicyName = exports.exponentialRetryPolicy = exports.decompressResponsePolicyName = exports.decompressResponsePolicy = exports.isRestError = exports.RestError = exports.createPipelineRequest = exports.createHttpHeaders = exports.createDefaultHttpClient = exports.createPipelineFromOptions = exports.createEmptyPipeline = void 0; -var pipeline_js_1 = __nccwpck_require__(4795); +var pipeline_js_1 = __nccwpck_require__(44795); Object.defineProperty(exports, "createEmptyPipeline", ({ enumerable: true, get: function () { return pipeline_js_1.createEmptyPipeline; } })); var createPipelineFromOptions_js_1 = __nccwpck_require__(4516); Object.defineProperty(exports, "createPipelineFromOptions", ({ enumerable: true, get: function () { return createPipelineFromOptions_js_1.createPipelineFromOptions; } })); -var defaultHttpClient_js_1 = __nccwpck_require__(8469); +var defaultHttpClient_js_1 = __nccwpck_require__(68469); Object.defineProperty(exports, "createDefaultHttpClient", ({ enumerable: true, get: function () { return defaultHttpClient_js_1.createDefaultHttpClient; } })); -var httpHeaders_js_1 = __nccwpck_require__(5315); +var httpHeaders_js_1 = __nccwpck_require__(45315); Object.defineProperty(exports, "createHttpHeaders", ({ enumerable: true, get: function () { return httpHeaders_js_1.createHttpHeaders; } })); -var pipelineRequest_js_1 = __nccwpck_require__(6878); +var pipelineRequest_js_1 = __nccwpck_require__(16878); Object.defineProperty(exports, "createPipelineRequest", ({ enumerable: true, get: function () { return pipelineRequest_js_1.createPipelineRequest; } })); -var restError_js_1 = __nccwpck_require__(6993); +var restError_js_1 = __nccwpck_require__(36993); Object.defineProperty(exports, "RestError", ({ enumerable: true, get: function () { return restError_js_1.RestError; } })); Object.defineProperty(exports, "isRestError", ({ enumerable: true, get: function () { return restError_js_1.isRestError; } })); -var decompressResponsePolicy_js_1 = __nccwpck_require__(9381); +var decompressResponsePolicy_js_1 = __nccwpck_require__(19381); Object.defineProperty(exports, "decompressResponsePolicy", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicy; } })); Object.defineProperty(exports, "decompressResponsePolicyName", ({ enumerable: true, get: function () { return decompressResponsePolicy_js_1.decompressResponsePolicyName; } })); -var exponentialRetryPolicy_js_1 = __nccwpck_require__(8804); +var exponentialRetryPolicy_js_1 = __nccwpck_require__(88804); Object.defineProperty(exports, "exponentialRetryPolicy", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicy; } })); Object.defineProperty(exports, "exponentialRetryPolicyName", ({ enumerable: true, get: function () { return exponentialRetryPolicy_js_1.exponentialRetryPolicyName; } })); -var setClientRequestIdPolicy_js_1 = __nccwpck_require__(5136); +var setClientRequestIdPolicy_js_1 = __nccwpck_require__(75136); Object.defineProperty(exports, "setClientRequestIdPolicy", ({ enumerable: true, get: function () { return setClientRequestIdPolicy_js_1.setClientRequestIdPolicy; } })); Object.defineProperty(exports, "setClientRequestIdPolicyName", ({ enumerable: true, get: function () { return setClientRequestIdPolicy_js_1.setClientRequestIdPolicyName; } })); -var logPolicy_js_1 = __nccwpck_require__(2114); +var logPolicy_js_1 = __nccwpck_require__(32114); Object.defineProperty(exports, "logPolicy", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicy; } })); Object.defineProperty(exports, "logPolicyName", ({ enumerable: true, get: function () { return logPolicy_js_1.logPolicyName; } })); -var multipartPolicy_js_1 = __nccwpck_require__(2150); +var multipartPolicy_js_1 = __nccwpck_require__(62150); Object.defineProperty(exports, "multipartPolicy", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicy; } })); Object.defineProperty(exports, "multipartPolicyName", ({ enumerable: true, get: function () { return multipartPolicy_js_1.multipartPolicyName; } })); -var proxyPolicy_js_1 = __nccwpck_require__(4886); +var proxyPolicy_js_1 = __nccwpck_require__(54886); Object.defineProperty(exports, "proxyPolicy", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicy; } })); Object.defineProperty(exports, "proxyPolicyName", ({ enumerable: true, get: function () { return proxyPolicy_js_1.proxyPolicyName; } })); Object.defineProperty(exports, "getDefaultProxySettings", ({ enumerable: true, get: function () { return proxyPolicy_js_1.getDefaultProxySettings; } })); -var redirectPolicy_js_1 = __nccwpck_require__(627); +var redirectPolicy_js_1 = __nccwpck_require__(40212); Object.defineProperty(exports, "redirectPolicy", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicy; } })); Object.defineProperty(exports, "redirectPolicyName", ({ enumerable: true, get: function () { return redirectPolicy_js_1.redirectPolicyName; } })); var systemErrorRetryPolicy_js_1 = __nccwpck_require__(3251); @@ -77885,39 +93842,39 @@ Object.defineProperty(exports, "systemErrorRetryPolicyName", ({ enumerable: true var throttlingRetryPolicy_js_1 = __nccwpck_require__(5870); Object.defineProperty(exports, "throttlingRetryPolicy", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicy; } })); Object.defineProperty(exports, "throttlingRetryPolicyName", ({ enumerable: true, get: function () { return throttlingRetryPolicy_js_1.throttlingRetryPolicyName; } })); -var retryPolicy_js_1 = __nccwpck_require__(4341); +var retryPolicy_js_1 = __nccwpck_require__(84341); Object.defineProperty(exports, "retryPolicy", ({ enumerable: true, get: function () { return retryPolicy_js_1.retryPolicy; } })); -var tracingPolicy_js_1 = __nccwpck_require__(7199); +var tracingPolicy_js_1 = __nccwpck_require__(87199); Object.defineProperty(exports, "tracingPolicy", ({ enumerable: true, get: function () { return tracingPolicy_js_1.tracingPolicy; } })); Object.defineProperty(exports, "tracingPolicyName", ({ enumerable: true, get: function () { return tracingPolicy_js_1.tracingPolicyName; } })); -var defaultRetryPolicy_js_1 = __nccwpck_require__(6185); +var defaultRetryPolicy_js_1 = __nccwpck_require__(66185); Object.defineProperty(exports, "defaultRetryPolicy", ({ enumerable: true, get: function () { return defaultRetryPolicy_js_1.defaultRetryPolicy; } })); var userAgentPolicy_js_1 = __nccwpck_require__(6060); Object.defineProperty(exports, "userAgentPolicy", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicy; } })); Object.defineProperty(exports, "userAgentPolicyName", ({ enumerable: true, get: function () { return userAgentPolicy_js_1.userAgentPolicyName; } })); -var tlsPolicy_js_1 = __nccwpck_require__(7761); +var tlsPolicy_js_1 = __nccwpck_require__(17761); Object.defineProperty(exports, "tlsPolicy", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicy; } })); Object.defineProperty(exports, "tlsPolicyName", ({ enumerable: true, get: function () { return tlsPolicy_js_1.tlsPolicyName; } })); -var formDataPolicy_js_1 = __nccwpck_require__(2963); +var formDataPolicy_js_1 = __nccwpck_require__(12963); Object.defineProperty(exports, "formDataPolicy", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicy; } })); Object.defineProperty(exports, "formDataPolicyName", ({ enumerable: true, get: function () { return formDataPolicy_js_1.formDataPolicyName; } })); var bearerTokenAuthenticationPolicy_js_1 = __nccwpck_require__(9507); Object.defineProperty(exports, "bearerTokenAuthenticationPolicy", ({ enumerable: true, get: function () { return bearerTokenAuthenticationPolicy_js_1.bearerTokenAuthenticationPolicy; } })); Object.defineProperty(exports, "bearerTokenAuthenticationPolicyName", ({ enumerable: true, get: function () { return bearerTokenAuthenticationPolicy_js_1.bearerTokenAuthenticationPolicyName; } })); -var ndJsonPolicy_js_1 = __nccwpck_require__(5582); +var ndJsonPolicy_js_1 = __nccwpck_require__(15582); Object.defineProperty(exports, "ndJsonPolicy", ({ enumerable: true, get: function () { return ndJsonPolicy_js_1.ndJsonPolicy; } })); Object.defineProperty(exports, "ndJsonPolicyName", ({ enumerable: true, get: function () { return ndJsonPolicy_js_1.ndJsonPolicyName; } })); -var auxiliaryAuthenticationHeaderPolicy_js_1 = __nccwpck_require__(6688); +var auxiliaryAuthenticationHeaderPolicy_js_1 = __nccwpck_require__(86688); Object.defineProperty(exports, "auxiliaryAuthenticationHeaderPolicy", ({ enumerable: true, get: function () { return auxiliaryAuthenticationHeaderPolicy_js_1.auxiliaryAuthenticationHeaderPolicy; } })); Object.defineProperty(exports, "auxiliaryAuthenticationHeaderPolicyName", ({ enumerable: true, get: function () { return auxiliaryAuthenticationHeaderPolicy_js_1.auxiliaryAuthenticationHeaderPolicyName; } })); -var file_js_1 = __nccwpck_require__(1091); +var file_js_1 = __nccwpck_require__(11091); Object.defineProperty(exports, "createFile", ({ enumerable: true, get: function () { return file_js_1.createFile; } })); Object.defineProperty(exports, "createFileFromStream", ({ enumerable: true, get: function () { return file_js_1.createFileFromStream; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 4170: +/***/ 64170: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -77925,13 +93882,13 @@ Object.defineProperty(exports, "createFileFromStream", ({ enumerable: true, get: // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.logger = void 0; -const logger_1 = __nccwpck_require__(865); +const logger_1 = __nccwpck_require__(10865); exports.logger = (0, logger_1.createClientLogger)("core-rest-pipeline"); //# sourceMappingURL=log.js.map /***/ }), -/***/ 1766: +/***/ 91766: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -77940,15 +93897,15 @@ exports.logger = (0, logger_1.createClientLogger)("core-rest-pipeline"); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getBodyLength = getBodyLength; exports.createNodeHttpClient = createNodeHttpClient; -const tslib_1 = __nccwpck_require__(36); -const http = tslib_1.__importStar(__nccwpck_require__(8849)); -const https = tslib_1.__importStar(__nccwpck_require__(2286)); -const zlib = tslib_1.__importStar(__nccwpck_require__(5628)); -const node_stream_1 = __nccwpck_require__(4492); -const abort_controller_1 = __nccwpck_require__(3765); -const httpHeaders_js_1 = __nccwpck_require__(5315); -const restError_js_1 = __nccwpck_require__(6993); -const log_js_1 = __nccwpck_require__(4170); +const tslib_1 = __nccwpck_require__(30036); +const http = tslib_1.__importStar(__nccwpck_require__(88849)); +const https = tslib_1.__importStar(__nccwpck_require__(22286)); +const zlib = tslib_1.__importStar(__nccwpck_require__(65628)); +const node_stream_1 = __nccwpck_require__(84492); +const abort_controller_1 = __nccwpck_require__(23765); +const httpHeaders_js_1 = __nccwpck_require__(45315); +const restError_js_1 = __nccwpck_require__(36993); +const log_js_1 = __nccwpck_require__(64170); const DEFAULT_TLS_SETTINGS = {}; function isReadableStream(body) { return body && typeof body.pipe === "function"; @@ -78274,7 +94231,7 @@ function createNodeHttpClient() { /***/ }), -/***/ 4795: +/***/ 44795: /***/ ((__unused_webpack_module, exports) => { @@ -78545,7 +94502,7 @@ function createEmptyPipeline() { /***/ }), -/***/ 6878: +/***/ 16878: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -78553,8 +94510,8 @@ function createEmptyPipeline() { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createPipelineRequest = createPipelineRequest; -const httpHeaders_js_1 = __nccwpck_require__(5315); -const core_util_1 = __nccwpck_require__(7409); +const httpHeaders_js_1 = __nccwpck_require__(45315); +const core_util_1 = __nccwpck_require__(77409); class PipelineRequestImpl { constructor(options) { var _a, _b, _c, _d, _e, _f, _g; @@ -78590,7 +94547,7 @@ function createPipelineRequest(options) { /***/ }), -/***/ 6688: +/***/ 86688: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -78599,8 +94556,8 @@ function createPipelineRequest(options) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.auxiliaryAuthenticationHeaderPolicyName = void 0; exports.auxiliaryAuthenticationHeaderPolicy = auxiliaryAuthenticationHeaderPolicy; -const tokenCycler_js_1 = __nccwpck_require__(9769); -const log_js_1 = __nccwpck_require__(4170); +const tokenCycler_js_1 = __nccwpck_require__(59769); +const log_js_1 = __nccwpck_require__(64170); /** * The programmatic identifier of the auxiliaryAuthenticationHeaderPolicy. */ @@ -78672,8 +94629,8 @@ function auxiliaryAuthenticationHeaderPolicy(options) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.bearerTokenAuthenticationPolicyName = void 0; exports.bearerTokenAuthenticationPolicy = bearerTokenAuthenticationPolicy; -const tokenCycler_js_1 = __nccwpck_require__(9769); -const log_js_1 = __nccwpck_require__(4170); +const tokenCycler_js_1 = __nccwpck_require__(59769); +const log_js_1 = __nccwpck_require__(64170); /** * The programmatic identifier of the bearerTokenAuthenticationPolicy. */ @@ -78781,7 +94738,7 @@ function bearerTokenAuthenticationPolicy(options) { /***/ }), -/***/ 9381: +/***/ 19381: /***/ ((__unused_webpack_module, exports) => { @@ -78814,7 +94771,7 @@ function decompressResponsePolicy() { /***/ }), -/***/ 6185: +/***/ 66185: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -78823,10 +94780,10 @@ function decompressResponsePolicy() { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.defaultRetryPolicyName = void 0; exports.defaultRetryPolicy = defaultRetryPolicy; -const exponentialRetryStrategy_js_1 = __nccwpck_require__(3512); +const exponentialRetryStrategy_js_1 = __nccwpck_require__(73512); const throttlingRetryStrategy_js_1 = __nccwpck_require__(2530); -const retryPolicy_js_1 = __nccwpck_require__(4341); -const constants_js_1 = __nccwpck_require__(6111); +const retryPolicy_js_1 = __nccwpck_require__(84341); +const constants_js_1 = __nccwpck_require__(56111); /** * Name of the {@link defaultRetryPolicy} */ @@ -78850,7 +94807,7 @@ function defaultRetryPolicy(options = {}) { /***/ }), -/***/ 8804: +/***/ 88804: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -78859,9 +94816,9 @@ function defaultRetryPolicy(options = {}) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.exponentialRetryPolicyName = void 0; exports.exponentialRetryPolicy = exponentialRetryPolicy; -const exponentialRetryStrategy_js_1 = __nccwpck_require__(3512); -const retryPolicy_js_1 = __nccwpck_require__(4341); -const constants_js_1 = __nccwpck_require__(6111); +const exponentialRetryStrategy_js_1 = __nccwpck_require__(73512); +const retryPolicy_js_1 = __nccwpck_require__(84341); +const constants_js_1 = __nccwpck_require__(56111); /** * The programmatic identifier of the exponentialRetryPolicy. */ @@ -78882,7 +94839,7 @@ function exponentialRetryPolicy(options = {}) { /***/ }), -/***/ 2963: +/***/ 12963: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -78891,8 +94848,8 @@ function exponentialRetryPolicy(options = {}) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.formDataPolicyName = void 0; exports.formDataPolicy = formDataPolicy; -const core_util_1 = __nccwpck_require__(7409); -const httpHeaders_js_1 = __nccwpck_require__(5315); +const core_util_1 = __nccwpck_require__(77409); +const httpHeaders_js_1 = __nccwpck_require__(45315); /** * The programmatic identifier of the formDataPolicy. */ @@ -78988,7 +94945,7 @@ async function prepareFormData(formData, request) { /***/ }), -/***/ 2114: +/***/ 32114: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -78997,8 +94954,8 @@ async function prepareFormData(formData, request) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.logPolicyName = void 0; exports.logPolicy = logPolicy; -const log_js_1 = __nccwpck_require__(4170); -const sanitizer_js_1 = __nccwpck_require__(9174); +const log_js_1 = __nccwpck_require__(64170); +const sanitizer_js_1 = __nccwpck_require__(79174); /** * The programmatic identifier of the logPolicy. */ @@ -79032,7 +94989,7 @@ function logPolicy(options = {}) { /***/ }), -/***/ 2150: +/***/ 62150: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -79041,9 +94998,9 @@ function logPolicy(options = {}) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.multipartPolicyName = void 0; exports.multipartPolicy = multipartPolicy; -const core_util_1 = __nccwpck_require__(7409); -const concat_js_1 = __nccwpck_require__(6974); -const typeGuards_js_1 = __nccwpck_require__(6494); +const core_util_1 = __nccwpck_require__(77409); +const concat_js_1 = __nccwpck_require__(26974); +const typeGuards_js_1 = __nccwpck_require__(1354); function generateBoundary() { return `----AzSDKFormBoundary${(0, core_util_1.randomUUID)()}`; } @@ -79153,7 +95110,7 @@ function multipartPolicy() { /***/ }), -/***/ 5582: +/***/ 15582: /***/ ((__unused_webpack_module, exports) => { @@ -79188,7 +95145,7 @@ function ndJsonPolicy() { /***/ }), -/***/ 4886: +/***/ 54886: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -79199,9 +95156,9 @@ exports.globalNoProxyList = exports.proxyPolicyName = void 0; exports.loadNoProxy = loadNoProxy; exports.getDefaultProxySettings = getDefaultProxySettings; exports.proxyPolicy = proxyPolicy; -const https_proxy_agent_1 = __nccwpck_require__(4214); -const http_proxy_agent_1 = __nccwpck_require__(3274); -const log_js_1 = __nccwpck_require__(4170); +const https_proxy_agent_1 = __nccwpck_require__(54214); +const http_proxy_agent_1 = __nccwpck_require__(33274); +const log_js_1 = __nccwpck_require__(64170); const HTTPS_PROXY = "HTTPS_PROXY"; const HTTP_PROXY = "HTTP_PROXY"; const ALL_PROXY = "ALL_PROXY"; @@ -79391,7 +95348,7 @@ function proxyPolicy(proxySettings, options) { /***/ }), -/***/ 627: +/***/ 40212: /***/ ((__unused_webpack_module, exports) => { @@ -79453,7 +95410,7 @@ async function handleRedirect(next, response, maxRetries, currentRetries = 0) { /***/ }), -/***/ 4341: +/***/ 84341: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -79461,10 +95418,10 @@ async function handleRedirect(next, response, maxRetries, currentRetries = 0) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.retryPolicy = retryPolicy; -const helpers_js_1 = __nccwpck_require__(4889); -const logger_1 = __nccwpck_require__(865); -const abort_controller_1 = __nccwpck_require__(3765); -const constants_js_1 = __nccwpck_require__(6111); +const helpers_js_1 = __nccwpck_require__(74889); +const logger_1 = __nccwpck_require__(10865); +const abort_controller_1 = __nccwpck_require__(23765); +const constants_js_1 = __nccwpck_require__(56111); const retryPolicyLogger = (0, logger_1.createClientLogger)("core-rest-pipeline retryPolicy"); /** * The programmatic identifier of the retryPolicy. @@ -79568,7 +95525,7 @@ function retryPolicy(strategies, options = { maxRetries: constants_js_1.DEFAULT_ /***/ }), -/***/ 5136: +/***/ 75136: /***/ ((__unused_webpack_module, exports) => { @@ -79611,9 +95568,9 @@ function setClientRequestIdPolicy(requestIdHeaderName = "x-ms-client-request-id" Object.defineProperty(exports, "__esModule", ({ value: true })); exports.systemErrorRetryPolicyName = void 0; exports.systemErrorRetryPolicy = systemErrorRetryPolicy; -const exponentialRetryStrategy_js_1 = __nccwpck_require__(3512); -const retryPolicy_js_1 = __nccwpck_require__(4341); -const constants_js_1 = __nccwpck_require__(6111); +const exponentialRetryStrategy_js_1 = __nccwpck_require__(73512); +const retryPolicy_js_1 = __nccwpck_require__(84341); +const constants_js_1 = __nccwpck_require__(56111); /** * Name of the {@link systemErrorRetryPolicy} */ @@ -79649,8 +95606,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.throttlingRetryPolicyName = void 0; exports.throttlingRetryPolicy = throttlingRetryPolicy; const throttlingRetryStrategy_js_1 = __nccwpck_require__(2530); -const retryPolicy_js_1 = __nccwpck_require__(4341); -const constants_js_1 = __nccwpck_require__(6111); +const retryPolicy_js_1 = __nccwpck_require__(84341); +const constants_js_1 = __nccwpck_require__(56111); /** * Name of the {@link throttlingRetryPolicy} */ @@ -79678,7 +95635,7 @@ function throttlingRetryPolicy(options = {}) { /***/ }), -/***/ 7761: +/***/ 17761: /***/ ((__unused_webpack_module, exports) => { @@ -79710,7 +95667,7 @@ function tlsPolicy(tlsSettings) { /***/ }), -/***/ 7199: +/***/ 87199: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -79719,13 +95676,13 @@ function tlsPolicy(tlsSettings) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.tracingPolicyName = void 0; exports.tracingPolicy = tracingPolicy; -const core_tracing_1 = __nccwpck_require__(3099); -const constants_js_1 = __nccwpck_require__(6111); -const userAgent_js_1 = __nccwpck_require__(9844); -const log_js_1 = __nccwpck_require__(4170); -const core_util_1 = __nccwpck_require__(7409); -const restError_js_1 = __nccwpck_require__(6993); -const sanitizer_js_1 = __nccwpck_require__(9174); +const core_tracing_1 = __nccwpck_require__(23099); +const constants_js_1 = __nccwpck_require__(56111); +const userAgent_js_1 = __nccwpck_require__(59844); +const log_js_1 = __nccwpck_require__(64170); +const core_util_1 = __nccwpck_require__(77409); +const restError_js_1 = __nccwpck_require__(36993); +const sanitizer_js_1 = __nccwpck_require__(79174); /** * The programmatic identifier of the tracingPolicy. */ @@ -79856,7 +95813,7 @@ function tryProcessResponse(span, response) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.userAgentPolicyName = void 0; exports.userAgentPolicy = userAgentPolicy; -const userAgent_js_1 = __nccwpck_require__(9844); +const userAgent_js_1 = __nccwpck_require__(59844); const UserAgentHeaderName = (0, userAgent_js_1.getUserAgentHeaderName)(); /** * The programmatic identifier of the userAgentPolicy. @@ -79883,7 +95840,7 @@ function userAgentPolicy(options = {}) { /***/ }), -/***/ 6993: +/***/ 36993: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -79892,9 +95849,9 @@ function userAgentPolicy(options = {}) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.RestError = void 0; exports.isRestError = isRestError; -const core_util_1 = __nccwpck_require__(7409); -const inspect_js_1 = __nccwpck_require__(3579); -const sanitizer_js_1 = __nccwpck_require__(9174); +const core_util_1 = __nccwpck_require__(77409); +const inspect_js_1 = __nccwpck_require__(43579); +const sanitizer_js_1 = __nccwpck_require__(79174); const errorSanitizer = new sanitizer_js_1.Sanitizer(); /** * A custom error type for failed pipeline requests. @@ -79948,7 +95905,7 @@ function isRestError(e) { /***/ }), -/***/ 3512: +/***/ 73512: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -79958,7 +95915,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.exponentialRetryStrategy = exponentialRetryStrategy; exports.isExponentialRetryResponse = isExponentialRetryResponse; exports.isSystemError = isSystemError; -const core_util_1 = __nccwpck_require__(7409); +const core_util_1 = __nccwpck_require__(77409); const throttlingRetryStrategy_js_1 = __nccwpck_require__(2530); // intervals are in milliseconds const DEFAULT_CLIENT_RETRY_INTERVAL = 1000; @@ -80038,7 +95995,7 @@ function isSystemError(err) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isThrottlingRetryResponse = isThrottlingRetryResponse; exports.throttlingRetryStrategy = throttlingRetryStrategy; -const helpers_js_1 = __nccwpck_require__(4889); +const helpers_js_1 = __nccwpck_require__(74889); /** * The header that comes back from Azure services representing * the amount of time (minimum) to wait to retry (in seconds or timestamp after which we can retry). @@ -80113,7 +96070,7 @@ function throttlingRetryStrategy() { /***/ }), -/***/ 6974: +/***/ 26974: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80121,10 +96078,10 @@ function throttlingRetryStrategy() { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.concat = concat; -const tslib_1 = __nccwpck_require__(36); -const node_stream_1 = __nccwpck_require__(4492); -const typeGuards_js_1 = __nccwpck_require__(6494); -const file_js_1 = __nccwpck_require__(1091); +const tslib_1 = __nccwpck_require__(30036); +const node_stream_1 = __nccwpck_require__(84492); +const typeGuards_js_1 = __nccwpck_require__(1354); +const file_js_1 = __nccwpck_require__(11091); function streamAsyncIterator() { return tslib_1.__asyncGenerator(this, arguments, function* streamAsyncIterator_1() { const reader = this.getReader(); @@ -80210,7 +96167,7 @@ async function concat(sources) { /***/ }), -/***/ 1091: +/***/ 11091: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80220,8 +96177,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getRawContent = getRawContent; exports.createFileFromStream = createFileFromStream; exports.createFile = createFile; -const core_util_1 = __nccwpck_require__(7409); -const typeGuards_js_1 = __nccwpck_require__(6494); +const core_util_1 = __nccwpck_require__(77409); +const typeGuards_js_1 = __nccwpck_require__(1354); const unimplementedMethods = { arrayBuffer: () => { throw new Error("Not implemented"); @@ -80317,7 +96274,7 @@ function createFile(content, name, options = {}) { /***/ }), -/***/ 4889: +/***/ 74889: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80326,7 +96283,7 @@ function createFile(content, name, options = {}) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.delay = delay; exports.parseHeaderValueAsNumber = parseHeaderValueAsNumber; -const abort_controller_1 = __nccwpck_require__(3765); +const abort_controller_1 = __nccwpck_require__(23765); const StandardAbortMessage = "The operation was aborted."; /** * A wrapper for setTimeout that resolves a promise after delayInMs milliseconds. @@ -80385,7 +96342,7 @@ function parseHeaderValueAsNumber(response, headerName) { /***/ }), -/***/ 3579: +/***/ 43579: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80393,13 +96350,13 @@ function parseHeaderValueAsNumber(response, headerName) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.custom = void 0; -const node_util_1 = __nccwpck_require__(7261); +const node_util_1 = __nccwpck_require__(47261); exports.custom = node_util_1.inspect.custom; //# sourceMappingURL=inspect.js.map /***/ }), -/***/ 9174: +/***/ 79174: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80407,7 +96364,7 @@ exports.custom = node_util_1.inspect.custom; // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Sanitizer = void 0; -const core_util_1 = __nccwpck_require__(7409); +const core_util_1 = __nccwpck_require__(77409); const RedactedString = "REDACTED"; // Make sure this list is up-to-date with the one under core/logger/Readme#Keyconcepts const defaultAllowedHeaderNames = [ @@ -80548,7 +96505,7 @@ exports.Sanitizer = Sanitizer; /***/ }), -/***/ 9769: +/***/ 59769: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80557,7 +96514,7 @@ exports.Sanitizer = Sanitizer; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DEFAULT_CYCLER_OPTIONS = void 0; exports.createTokenCycler = createTokenCycler; -const helpers_js_1 = __nccwpck_require__(4889); +const helpers_js_1 = __nccwpck_require__(74889); // Default options for the cycler if none are provided exports.DEFAULT_CYCLER_OPTIONS = { forcedRefreshWindowInMs: 1000, // Force waiting for a refresh 1s before the token expires @@ -80715,7 +96672,7 @@ function createTokenCycler(credential, tokenCyclerOptions) { /***/ }), -/***/ 6494: +/***/ 1354: /***/ ((__unused_webpack_module, exports) => { @@ -80744,7 +96701,7 @@ function isBlob(x) { /***/ }), -/***/ 9844: +/***/ 59844: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80753,8 +96710,8 @@ function isBlob(x) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getUserAgentHeaderName = getUserAgentHeaderName; exports.getUserAgentValue = getUserAgentValue; -const userAgentPlatform_js_1 = __nccwpck_require__(4857); -const constants_js_1 = __nccwpck_require__(6111); +const userAgentPlatform_js_1 = __nccwpck_require__(74857); +const constants_js_1 = __nccwpck_require__(56111); function getUserAgentString(telemetryInfo) { const parts = []; for (const [key, value] of telemetryInfo) { @@ -80784,7 +96741,7 @@ async function getUserAgentValue(prefix) { /***/ }), -/***/ 4857: +/***/ 74857: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80793,9 +96750,9 @@ async function getUserAgentValue(prefix) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getHeaderName = getHeaderName; exports.setPlatformSpecificData = setPlatformSpecificData; -const tslib_1 = __nccwpck_require__(36); -const os = tslib_1.__importStar(__nccwpck_require__(612)); -const process = tslib_1.__importStar(__nccwpck_require__(7742)); +const tslib_1 = __nccwpck_require__(30036); +const os = tslib_1.__importStar(__nccwpck_require__(70612)); +const process = tslib_1.__importStar(__nccwpck_require__(97742)); /** * @internal */ @@ -80824,7 +96781,7 @@ async function setPlatformSpecificData(map) { /***/ }), -/***/ 3099: +/***/ 23099: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80832,15 +96789,15 @@ async function setPlatformSpecificData(map) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createTracingClient = exports.useInstrumenter = void 0; -var instrumenter_js_1 = __nccwpck_require__(5501); +var instrumenter_js_1 = __nccwpck_require__(94795); Object.defineProperty(exports, "useInstrumenter", ({ enumerable: true, get: function () { return instrumenter_js_1.useInstrumenter; } })); -var tracingClient_js_1 = __nccwpck_require__(7398); +var tracingClient_js_1 = __nccwpck_require__(17398); Object.defineProperty(exports, "createTracingClient", ({ enumerable: true, get: function () { return tracingClient_js_1.createTracingClient; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 5501: +/***/ 94795: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80848,8 +96805,8 @@ Object.defineProperty(exports, "createTracingClient", ({ enumerable: true, get: // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getInstrumenter = exports.useInstrumenter = exports.createDefaultInstrumenter = exports.createDefaultTracingSpan = void 0; -const tracingContext_js_1 = __nccwpck_require__(1015); -const state_js_1 = __nccwpck_require__(3858); +const tracingContext_js_1 = __nccwpck_require__(51015); +const state_js_1 = __nccwpck_require__(93858); function createDefaultTracingSpan() { return { end: () => { @@ -80913,7 +96870,7 @@ exports.getInstrumenter = getInstrumenter; /***/ }), -/***/ 3858: +/***/ 93858: /***/ ((__unused_webpack_module, exports) => { @@ -80933,7 +96890,7 @@ exports.state = { /***/ }), -/***/ 7398: +/***/ 17398: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -80941,8 +96898,8 @@ exports.state = { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createTracingClient = void 0; -const instrumenter_js_1 = __nccwpck_require__(5501); -const tracingContext_js_1 = __nccwpck_require__(1015); +const instrumenter_js_1 = __nccwpck_require__(94795); +const tracingContext_js_1 = __nccwpck_require__(51015); /** * Creates a new tracing client. * @@ -81017,7 +96974,7 @@ exports.createTracingClient = createTracingClient; /***/ }), -/***/ 1015: +/***/ 51015: /***/ ((__unused_webpack_module, exports) => { @@ -81075,7 +97032,7 @@ exports.TracingContextImpl = TracingContextImpl; /***/ }), -/***/ 5190: +/***/ 15190: /***/ ((__unused_webpack_module, exports) => { @@ -81105,7 +97062,7 @@ async function cancelablePromiseRace(abortablePromiseBuilders, options) { /***/ }), -/***/ 9234: +/***/ 99234: /***/ ((__unused_webpack_module, exports) => { @@ -81136,7 +97093,7 @@ function stringToUint8Array(value, format) { /***/ }), -/***/ 5608: +/***/ 75608: /***/ ((__unused_webpack_module, exports) => { @@ -81192,7 +97149,7 @@ exports.isReactNative = typeof navigator !== "undefined" && (navigator === null /***/ }), -/***/ 6764: +/***/ 16764: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81200,7 +97157,7 @@ exports.isReactNative = typeof navigator !== "undefined" && (navigator === null // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createAbortablePromise = createAbortablePromise; -const abort_controller_1 = __nccwpck_require__(3765); +const abort_controller_1 = __nccwpck_require__(23765); /** * Creates an abortable promise. * @param buildPromise - A function that takes the resolve and reject functions as parameters. @@ -81243,7 +97200,7 @@ function createAbortablePromise(buildPromise, options) { /***/ }), -/***/ 7789: +/***/ 17789: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81251,7 +97208,7 @@ function createAbortablePromise(buildPromise, options) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.delay = delay; -const createAbortablePromise_js_1 = __nccwpck_require__(6764); +const createAbortablePromise_js_1 = __nccwpck_require__(16764); const StandardAbortMessage = "The delay was aborted."; /** * A wrapper for setTimeout that resolves a promise after timeInMs milliseconds. @@ -81274,7 +97231,7 @@ function delay(timeInMs, options) { /***/ }), -/***/ 1873: +/***/ 71873: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81283,7 +97240,7 @@ function delay(timeInMs, options) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.isError = isError; exports.getErrorMessage = getErrorMessage; -const object_js_1 = __nccwpck_require__(9669); +const object_js_1 = __nccwpck_require__(29669); /** * Typeguard for an error object shape (has name and message) * @param e - Something caught by a catch clause. @@ -81326,7 +97283,7 @@ function getErrorMessage(e) { /***/ }), -/***/ 7409: +/***/ 77409: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81334,29 +97291,29 @@ function getErrorMessage(e) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.stringToUint8Array = exports.uint8ArrayToString = exports.isWebWorker = exports.isReactNative = exports.isDeno = exports.isNodeRuntime = exports.isNodeLike = exports.isNode = exports.isBun = exports.isBrowser = exports.randomUUID = exports.objectHasProperty = exports.isObjectWithProperties = exports.isDefined = exports.computeSha256Hmac = exports.computeSha256Hash = exports.getErrorMessage = exports.isError = exports.isObject = exports.getRandomIntegerInclusive = exports.createAbortablePromise = exports.cancelablePromiseRace = exports.delay = void 0; -var delay_js_1 = __nccwpck_require__(7789); +var delay_js_1 = __nccwpck_require__(17789); Object.defineProperty(exports, "delay", ({ enumerable: true, get: function () { return delay_js_1.delay; } })); -var aborterUtils_js_1 = __nccwpck_require__(5190); +var aborterUtils_js_1 = __nccwpck_require__(15190); Object.defineProperty(exports, "cancelablePromiseRace", ({ enumerable: true, get: function () { return aborterUtils_js_1.cancelablePromiseRace; } })); -var createAbortablePromise_js_1 = __nccwpck_require__(6764); +var createAbortablePromise_js_1 = __nccwpck_require__(16764); Object.defineProperty(exports, "createAbortablePromise", ({ enumerable: true, get: function () { return createAbortablePromise_js_1.createAbortablePromise; } })); -var random_js_1 = __nccwpck_require__(3835); +var random_js_1 = __nccwpck_require__(23835); Object.defineProperty(exports, "getRandomIntegerInclusive", ({ enumerable: true, get: function () { return random_js_1.getRandomIntegerInclusive; } })); -var object_js_1 = __nccwpck_require__(9669); +var object_js_1 = __nccwpck_require__(29669); Object.defineProperty(exports, "isObject", ({ enumerable: true, get: function () { return object_js_1.isObject; } })); -var error_js_1 = __nccwpck_require__(1873); +var error_js_1 = __nccwpck_require__(71873); Object.defineProperty(exports, "isError", ({ enumerable: true, get: function () { return error_js_1.isError; } })); Object.defineProperty(exports, "getErrorMessage", ({ enumerable: true, get: function () { return error_js_1.getErrorMessage; } })); -var sha256_js_1 = __nccwpck_require__(136); +var sha256_js_1 = __nccwpck_require__(20136); Object.defineProperty(exports, "computeSha256Hash", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hash; } })); Object.defineProperty(exports, "computeSha256Hmac", ({ enumerable: true, get: function () { return sha256_js_1.computeSha256Hmac; } })); var typeGuards_js_1 = __nccwpck_require__(225); Object.defineProperty(exports, "isDefined", ({ enumerable: true, get: function () { return typeGuards_js_1.isDefined; } })); Object.defineProperty(exports, "isObjectWithProperties", ({ enumerable: true, get: function () { return typeGuards_js_1.isObjectWithProperties; } })); Object.defineProperty(exports, "objectHasProperty", ({ enumerable: true, get: function () { return typeGuards_js_1.objectHasProperty; } })); -var uuidUtils_js_1 = __nccwpck_require__(3563); +var uuidUtils_js_1 = __nccwpck_require__(13563); Object.defineProperty(exports, "randomUUID", ({ enumerable: true, get: function () { return uuidUtils_js_1.randomUUID; } })); -var checkEnvironment_js_1 = __nccwpck_require__(5608); +var checkEnvironment_js_1 = __nccwpck_require__(75608); Object.defineProperty(exports, "isBrowser", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBrowser; } })); Object.defineProperty(exports, "isBun", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isBun; } })); Object.defineProperty(exports, "isNode", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isNode; } })); @@ -81365,14 +97322,14 @@ Object.defineProperty(exports, "isNodeRuntime", ({ enumerable: true, get: functi Object.defineProperty(exports, "isDeno", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isDeno; } })); Object.defineProperty(exports, "isReactNative", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isReactNative; } })); Object.defineProperty(exports, "isWebWorker", ({ enumerable: true, get: function () { return checkEnvironment_js_1.isWebWorker; } })); -var bytesEncoding_js_1 = __nccwpck_require__(9234); +var bytesEncoding_js_1 = __nccwpck_require__(99234); Object.defineProperty(exports, "uint8ArrayToString", ({ enumerable: true, get: function () { return bytesEncoding_js_1.uint8ArrayToString; } })); Object.defineProperty(exports, "stringToUint8Array", ({ enumerable: true, get: function () { return bytesEncoding_js_1.stringToUint8Array; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 9669: +/***/ 29669: /***/ ((__unused_webpack_module, exports) => { @@ -81395,7 +97352,7 @@ function isObject(input) { /***/ }), -/***/ 3835: +/***/ 23835: /***/ ((__unused_webpack_module, exports) => { @@ -81425,7 +97382,7 @@ function getRandomIntegerInclusive(min, max) { /***/ }), -/***/ 136: +/***/ 20136: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81502,7 +97459,7 @@ function objectHasProperty(thing, property) { /***/ }), -/***/ 3563: +/***/ 13563: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81528,7 +97485,7 @@ function randomUUID() { /***/ }), -/***/ 8160: +/***/ 18160: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81536,17 +97493,17 @@ function randomUUID() { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.XML_CHARKEY = exports.XML_ATTRKEY = exports.parseXML = exports.stringifyXML = void 0; -var xml_js_1 = __nccwpck_require__(8436); +var xml_js_1 = __nccwpck_require__(68436); Object.defineProperty(exports, "stringifyXML", ({ enumerable: true, get: function () { return xml_js_1.stringifyXML; } })); Object.defineProperty(exports, "parseXML", ({ enumerable: true, get: function () { return xml_js_1.parseXML; } })); -var xml_common_js_1 = __nccwpck_require__(618); +var xml_common_js_1 = __nccwpck_require__(20618); Object.defineProperty(exports, "XML_ATTRKEY", ({ enumerable: true, get: function () { return xml_common_js_1.XML_ATTRKEY; } })); Object.defineProperty(exports, "XML_CHARKEY", ({ enumerable: true, get: function () { return xml_common_js_1.XML_CHARKEY; } })); //# sourceMappingURL=index.js.map /***/ }), -/***/ 618: +/***/ 20618: /***/ ((__unused_webpack_module, exports) => { @@ -81566,7 +97523,7 @@ exports.XML_CHARKEY = "_"; /***/ }), -/***/ 8436: +/***/ 68436: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81575,8 +97532,8 @@ exports.XML_CHARKEY = "_"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.stringifyXML = stringifyXML; exports.parseXML = parseXML; -const fast_xml_parser_1 = __nccwpck_require__(626); -const xml_common_js_1 = __nccwpck_require__(618); +const fast_xml_parser_1 = __nccwpck_require__(30626); +const xml_common_js_1 = __nccwpck_require__(20618); function getCommonOptions(options) { var _a; return { @@ -81639,7 +97596,7 @@ async function parseXML(str, opts = {}) { /***/ }), -/***/ 3988: +/***/ 63988: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81740,7 +97697,7 @@ exports["default"] = debugObj; /***/ }), -/***/ 865: +/***/ 10865: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -81751,8 +97708,8 @@ exports.AzureLogger = void 0; exports.setLogLevel = setLogLevel; exports.getLogLevel = getLogLevel; exports.createClientLogger = createClientLogger; -const tslib_1 = __nccwpck_require__(36); -const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(3988)); +const tslib_1 = __nccwpck_require__(30036); +const debug_js_1 = tslib_1.__importDefault(__nccwpck_require__(63988)); const registeredLoggers = new Set(); const logLevelFromEnv = (typeof process !== "undefined" && process.env && process.env.AZURE_LOG_LEVEL) || undefined; let azureLogLevel; @@ -81859,10 +97816,10 @@ function isAzureLogLevel(logLevel) { // Licensed under the MIT license. Object.defineProperty(exports, "__esModule", ({ value: true })); exports.log = log; -const tslib_1 = __nccwpck_require__(36); -const node_os_1 = __nccwpck_require__(612); -const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(7261)); -const process = tslib_1.__importStar(__nccwpck_require__(7742)); +const tslib_1 = __nccwpck_require__(30036); +const node_os_1 = __nccwpck_require__(70612); +const node_util_1 = tslib_1.__importDefault(__nccwpck_require__(47261)); +const process = tslib_1.__importStar(__nccwpck_require__(97742)); function log(message, ...args) { process.stderr.write(`${node_util_1.default.format(message, ...args)}${node_os_1.EOL}`); } @@ -81870,17 +97827,17 @@ function log(message, ...args) { /***/ }), -/***/ 6790: +/***/ 16790: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const WritableStream = (__nccwpck_require__(4492).Writable) -const inherits = (__nccwpck_require__(7261).inherits) +const WritableStream = (__nccwpck_require__(84492).Writable) +const inherits = (__nccwpck_require__(47261).inherits) const StreamSearch = __nccwpck_require__(7825) -const PartStream = __nccwpck_require__(1789) +const PartStream = __nccwpck_require__(61789) const HeaderParser = __nccwpck_require__(8013) const DASH = 45 @@ -82095,9 +98052,9 @@ module.exports = Dicer -const EventEmitter = (__nccwpck_require__(5673).EventEmitter) -const inherits = (__nccwpck_require__(7261).inherits) -const getLimit = __nccwpck_require__(6554) +const EventEmitter = (__nccwpck_require__(15673).EventEmitter) +const inherits = (__nccwpck_require__(47261).inherits) +const getLimit = __nccwpck_require__(66554) const StreamSearch = __nccwpck_require__(7825) @@ -82197,13 +98154,13 @@ module.exports = HeaderParser /***/ }), -/***/ 1789: +/***/ 61789: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const inherits = (__nccwpck_require__(7261).inherits) -const ReadableStream = (__nccwpck_require__(4492).Readable) +const inherits = (__nccwpck_require__(47261).inherits) +const ReadableStream = (__nccwpck_require__(84492).Readable) function PartStream (opts) { ReadableStream.call(this, opts) @@ -82248,8 +98205,8 @@ module.exports = PartStream * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool */ -const EventEmitter = (__nccwpck_require__(5673).EventEmitter) -const inherits = (__nccwpck_require__(7261).inherits) +const EventEmitter = (__nccwpck_require__(15673).EventEmitter) +const inherits = (__nccwpck_require__(47261).inherits) function SBMH (needle) { if (typeof needle === 'string') { @@ -82457,13 +98414,13 @@ module.exports = SBMH -const WritableStream = (__nccwpck_require__(4492).Writable) -const { inherits } = __nccwpck_require__(7261) -const Dicer = __nccwpck_require__(6790) +const WritableStream = (__nccwpck_require__(84492).Writable) +const { inherits } = __nccwpck_require__(47261) +const Dicer = __nccwpck_require__(16790) -const MultipartParser = __nccwpck_require__(7399) -const UrlencodedParser = __nccwpck_require__(86) -const parseParams = __nccwpck_require__(5213) +const MultipartParser = __nccwpck_require__(17399) +const UrlencodedParser = __nccwpck_require__(70086) +const parseParams = __nccwpck_require__(85213) function Busboy (opts) { if (!(this instanceof Busboy)) { return new Busboy(opts) } @@ -82544,7 +98501,7 @@ module.exports.Dicer = Dicer /***/ }), -/***/ 7399: +/***/ 17399: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { @@ -82556,15 +98513,15 @@ module.exports.Dicer = Dicer // * support limits.fieldNameSize // -- this will require modifications to utils.parseParams -const { Readable } = __nccwpck_require__(4492) -const { inherits } = __nccwpck_require__(7261) +const { Readable } = __nccwpck_require__(84492) +const { inherits } = __nccwpck_require__(47261) -const Dicer = __nccwpck_require__(6790) +const Dicer = __nccwpck_require__(16790) -const parseParams = __nccwpck_require__(5213) -const decodeText = __nccwpck_require__(7646) -const basename = __nccwpck_require__(7521) -const getLimit = __nccwpck_require__(6554) +const parseParams = __nccwpck_require__(85213) +const decodeText = __nccwpck_require__(57646) +const basename = __nccwpck_require__(27521) +const getLimit = __nccwpck_require__(66554) const RE_BOUNDARY = /^boundary$/i const RE_FIELD = /^form-data$/i @@ -82857,14 +98814,14 @@ module.exports = Multipart /***/ }), -/***/ 86: +/***/ 70086: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -const Decoder = __nccwpck_require__(3114) -const decodeText = __nccwpck_require__(7646) -const getLimit = __nccwpck_require__(6554) +const Decoder = __nccwpck_require__(33114) +const decodeText = __nccwpck_require__(57646) +const getLimit = __nccwpck_require__(66554) const RE_CHARSET = /^charset$/i @@ -83054,7 +99011,7 @@ module.exports = UrlEncoded /***/ }), -/***/ 3114: +/***/ 33114: /***/ ((module) => { @@ -83115,7 +99072,7 @@ module.exports = Decoder /***/ }), -/***/ 7521: +/***/ 27521: /***/ ((module) => { @@ -83136,7 +99093,7 @@ module.exports = function basename (path) { /***/ }), -/***/ 7646: +/***/ 57646: /***/ (function(module) { @@ -83257,7 +99214,7 @@ module.exports = decodeText /***/ }), -/***/ 6554: +/***/ 66554: /***/ ((module) => { @@ -83280,13 +99237,13 @@ module.exports = function getLimit (limits, name, defaultLimit) { /***/ }), -/***/ 5213: +/***/ 85213: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { /* eslint-disable object-property-newline */ -const decodeText = __nccwpck_require__(7646) +const decodeText = __nccwpck_require__(57646) const RE_ENCODED = /%[a-fA-F0-9][a-fA-F0-9]/g @@ -83483,18 +99440,18 @@ module.exports = parseParams /***/ }), -/***/ 1053: +/***/ 41053: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var Scalar = __nccwpck_require__(2112); -var YAMLMap = __nccwpck_require__(3666); -var YAMLSeq = __nccwpck_require__(1071); -var resolveBlockMap = __nccwpck_require__(7898); -var resolveBlockSeq = __nccwpck_require__(391); -var resolveFlowCollection = __nccwpck_require__(8948); +var identity = __nccwpck_require__(98656); +var Scalar = __nccwpck_require__(92112); +var YAMLMap = __nccwpck_require__(53666); +var YAMLSeq = __nccwpck_require__(11071); +var resolveBlockMap = __nccwpck_require__(77898); +var resolveBlockSeq = __nccwpck_require__(50391); +var resolveFlowCollection = __nccwpck_require__(18948); function resolveCollection(CN, ctx, token, onError, tagName, tag) { const coll = token.type === 'block-map' @@ -83580,15 +99537,15 @@ exports.composeCollection = composeCollection; /***/ }), -/***/ 7791: +/***/ 17791: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Document = __nccwpck_require__(7864); +var Document = __nccwpck_require__(87864); var composeNode = __nccwpck_require__(76); -var resolveEnd = __nccwpck_require__(1578); -var resolveProps = __nccwpck_require__(7874); +var resolveEnd = __nccwpck_require__(21578); +var resolveProps = __nccwpck_require__(27874); function composeDoc(options, directives, { offset, start, value, end }, onError) { const opts = Object.assign({ _directives: directives }, options); @@ -83636,11 +99593,11 @@ exports.composeDoc = composeDoc; -var Alias = __nccwpck_require__(8290); -var composeCollection = __nccwpck_require__(1053); -var composeScalar = __nccwpck_require__(2337); -var resolveEnd = __nccwpck_require__(1578); -var utilEmptyScalarPosition = __nccwpck_require__(7577); +var Alias = __nccwpck_require__(18290); +var composeCollection = __nccwpck_require__(41053); +var composeScalar = __nccwpck_require__(32337); +var resolveEnd = __nccwpck_require__(21578); +var utilEmptyScalarPosition = __nccwpck_require__(57577); const CN = { composeNode, composeEmptyNode }; function composeNode(ctx, token, props, onError) { @@ -83733,15 +99690,15 @@ exports.composeNode = composeNode; /***/ }), -/***/ 2337: +/***/ 32337: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var Scalar = __nccwpck_require__(2112); -var resolveBlockScalar = __nccwpck_require__(9466); -var resolveFlowScalar = __nccwpck_require__(9146); +var identity = __nccwpck_require__(98656); +var Scalar = __nccwpck_require__(92112); +var resolveBlockScalar = __nccwpck_require__(49466); +var resolveFlowScalar = __nccwpck_require__(49146); function composeScalar(ctx, token, tagToken, onError) { const { value, type, comment, range } = token.type === 'block-scalar' @@ -83822,17 +99779,17 @@ exports.composeScalar = composeScalar; /***/ }), -/***/ 1589: +/***/ 31589: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var directives = __nccwpck_require__(3062); -var Document = __nccwpck_require__(7864); -var errors = __nccwpck_require__(4139); -var identity = __nccwpck_require__(8656); -var composeDoc = __nccwpck_require__(7791); -var resolveEnd = __nccwpck_require__(1578); +var directives = __nccwpck_require__(13062); +var Document = __nccwpck_require__(87864); +var errors = __nccwpck_require__(44139); +var identity = __nccwpck_require__(98656); +var composeDoc = __nccwpck_require__(17791); +var resolveEnd = __nccwpck_require__(21578); function getErrorPos(src) { if (typeof src === 'number') @@ -84050,17 +100007,17 @@ exports.Composer = Composer; /***/ }), -/***/ 7898: +/***/ 77898: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Pair = __nccwpck_require__(5868); -var YAMLMap = __nccwpck_require__(3666); -var resolveProps = __nccwpck_require__(7874); -var utilContainsNewline = __nccwpck_require__(4411); +var Pair = __nccwpck_require__(85868); +var YAMLMap = __nccwpck_require__(53666); +var resolveProps = __nccwpck_require__(27874); +var utilContainsNewline = __nccwpck_require__(74411); var utilFlowIndentCheck = __nccwpck_require__(5032); -var utilMapIncludes = __nccwpck_require__(3246); +var utilMapIncludes = __nccwpck_require__(63246); const startColMsg = 'All mapping items must start at the same column'; function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) { @@ -84172,12 +100129,12 @@ exports.resolveBlockMap = resolveBlockMap; /***/ }), -/***/ 9466: +/***/ 49466: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); +var Scalar = __nccwpck_require__(92112); function resolveBlockScalar(ctx, scalar, onError) { const start = scalar.offset; @@ -84379,13 +100336,13 @@ exports.resolveBlockScalar = resolveBlockScalar; /***/ }), -/***/ 391: +/***/ 50391: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var YAMLSeq = __nccwpck_require__(1071); -var resolveProps = __nccwpck_require__(7874); +var YAMLSeq = __nccwpck_require__(11071); +var resolveProps = __nccwpck_require__(27874); var utilFlowIndentCheck = __nccwpck_require__(5032); function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) { @@ -84435,7 +100392,7 @@ exports.resolveBlockSeq = resolveBlockSeq; /***/ }), -/***/ 1578: +/***/ 21578: /***/ ((__unused_webpack_module, exports) => { @@ -84481,19 +100438,19 @@ exports.resolveEnd = resolveEnd; /***/ }), -/***/ 8948: +/***/ 18948: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var Pair = __nccwpck_require__(5868); -var YAMLMap = __nccwpck_require__(3666); -var YAMLSeq = __nccwpck_require__(1071); -var resolveEnd = __nccwpck_require__(1578); -var resolveProps = __nccwpck_require__(7874); -var utilContainsNewline = __nccwpck_require__(4411); -var utilMapIncludes = __nccwpck_require__(3246); +var identity = __nccwpck_require__(98656); +var Pair = __nccwpck_require__(85868); +var YAMLMap = __nccwpck_require__(53666); +var YAMLSeq = __nccwpck_require__(11071); +var resolveEnd = __nccwpck_require__(21578); +var resolveProps = __nccwpck_require__(27874); +var utilContainsNewline = __nccwpck_require__(74411); +var utilMapIncludes = __nccwpck_require__(63246); const blockMsg = 'Block collections are not allowed within flow collections'; const isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq'); @@ -84691,13 +100648,13 @@ exports.resolveFlowCollection = resolveFlowCollection; /***/ }), -/***/ 9146: +/***/ 49146: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); -var resolveEnd = __nccwpck_require__(1578); +var Scalar = __nccwpck_require__(92112); +var resolveEnd = __nccwpck_require__(21578); function resolveFlowScalar(scalar, strict, onError) { const { offset, type, source, end } = scalar; @@ -84923,7 +100880,7 @@ exports.resolveFlowScalar = resolveFlowScalar; /***/ }), -/***/ 7874: +/***/ 27874: /***/ ((__unused_webpack_module, exports) => { @@ -85080,7 +101037,7 @@ exports.resolveProps = resolveProps; /***/ }), -/***/ 4411: +/***/ 74411: /***/ ((__unused_webpack_module, exports) => { @@ -85123,7 +101080,7 @@ exports.containsNewline = containsNewline; /***/ }), -/***/ 7577: +/***/ 57577: /***/ ((__unused_webpack_module, exports) => { @@ -85164,7 +101121,7 @@ exports.emptyScalarPosition = emptyScalarPosition; -var utilContainsNewline = __nccwpck_require__(4411); +var utilContainsNewline = __nccwpck_require__(74411); function flowIndentCheck(indent, fc, onError) { if (fc?.type === 'flow-collection') { @@ -85183,12 +101140,12 @@ exports.flowIndentCheck = flowIndentCheck; /***/ }), -/***/ 3246: +/***/ 63246: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); +var identity = __nccwpck_require__(98656); function mapIncludes(ctx, items, search) { const { uniqueKeys } = ctx.options; @@ -85209,22 +101166,22 @@ exports.mapIncludes = mapIncludes; /***/ }), -/***/ 7864: +/***/ 87864: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Alias = __nccwpck_require__(8290); -var Collection = __nccwpck_require__(507); -var identity = __nccwpck_require__(8656); -var Pair = __nccwpck_require__(5868); -var toJS = __nccwpck_require__(2420); -var Schema = __nccwpck_require__(2895); -var stringifyDocument = __nccwpck_require__(2036); -var anchors = __nccwpck_require__(4790); -var applyReviver = __nccwpck_require__(5259); -var createNode = __nccwpck_require__(4685); -var directives = __nccwpck_require__(3062); +var Alias = __nccwpck_require__(18290); +var Collection = __nccwpck_require__(30507); +var identity = __nccwpck_require__(98656); +var Pair = __nccwpck_require__(85868); +var toJS = __nccwpck_require__(42420); +var Schema = __nccwpck_require__(82895); +var stringifyDocument = __nccwpck_require__(82036); +var anchors = __nccwpck_require__(84790); +var applyReviver = __nccwpck_require__(45259); +var createNode = __nccwpck_require__(54685); +var directives = __nccwpck_require__(13062); class Document { constructor(value, replacer, options) { @@ -85552,13 +101509,13 @@ exports.Document = Document; /***/ }), -/***/ 4790: +/***/ 84790: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var visit = __nccwpck_require__(976); +var identity = __nccwpck_require__(98656); +var visit = __nccwpck_require__(80976); /** * Verify that the input string is a valid anchor. @@ -85636,7 +101593,7 @@ exports.findNewAnchor = findNewAnchor; /***/ }), -/***/ 5259: +/***/ 45259: /***/ ((__unused_webpack_module, exports) => { @@ -85699,14 +101656,14 @@ exports.applyReviver = applyReviver; /***/ }), -/***/ 4685: +/***/ 54685: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Alias = __nccwpck_require__(8290); -var identity = __nccwpck_require__(8656); -var Scalar = __nccwpck_require__(2112); +var Alias = __nccwpck_require__(18290); +var identity = __nccwpck_require__(98656); +var Scalar = __nccwpck_require__(92112); const defaultTagPrefix = 'tag:yaml.org,2002:'; function findTagObject(value, tagName, tags) { @@ -85797,13 +101754,13 @@ exports.createNode = createNode; /***/ }), -/***/ 3062: +/***/ 13062: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var visit = __nccwpck_require__(976); +var identity = __nccwpck_require__(98656); +var visit = __nccwpck_require__(80976); const escapeChars = { '!': '%21', @@ -85982,7 +101939,7 @@ exports.Directives = Directives; /***/ }), -/***/ 4139: +/***/ 44139: /***/ ((__unused_webpack_module, exports) => { @@ -86057,22 +102014,22 @@ exports.prettifyError = prettifyError; var __webpack_unused_export__; -var composer = __nccwpck_require__(1589); -var Document = __nccwpck_require__(7864); -var Schema = __nccwpck_require__(2895); -var errors = __nccwpck_require__(4139); -var Alias = __nccwpck_require__(8290); -var identity = __nccwpck_require__(8656); -var Pair = __nccwpck_require__(5868); -var Scalar = __nccwpck_require__(2112); -var YAMLMap = __nccwpck_require__(3666); -var YAMLSeq = __nccwpck_require__(1071); -var cst = __nccwpck_require__(8289); -var lexer = __nccwpck_require__(216); -var lineCounter = __nccwpck_require__(13); -var parser = __nccwpck_require__(1356); -var publicApi = __nccwpck_require__(9723); -var visit = __nccwpck_require__(976); +var composer = __nccwpck_require__(31589); +var Document = __nccwpck_require__(87864); +var Schema = __nccwpck_require__(82895); +var errors = __nccwpck_require__(44139); +var Alias = __nccwpck_require__(18290); +var identity = __nccwpck_require__(98656); +var Pair = __nccwpck_require__(85868); +var Scalar = __nccwpck_require__(92112); +var YAMLMap = __nccwpck_require__(53666); +var YAMLSeq = __nccwpck_require__(11071); +var cst = __nccwpck_require__(28289); +var lexer = __nccwpck_require__(50216); +var lineCounter = __nccwpck_require__(70013); +var parser = __nccwpck_require__(11356); +var publicApi = __nccwpck_require__(29723); +var visit = __nccwpck_require__(80976); @@ -86109,7 +102066,7 @@ __webpack_unused_export__ = visit.visitAsync; /***/ }), -/***/ 3332: +/***/ 23332: /***/ ((__unused_webpack_module, exports) => { @@ -86135,16 +102092,16 @@ exports.warn = warn; /***/ }), -/***/ 8290: +/***/ 18290: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var anchors = __nccwpck_require__(4790); -var visit = __nccwpck_require__(976); -var identity = __nccwpck_require__(8656); -var Node = __nccwpck_require__(8890); -var toJS = __nccwpck_require__(2420); +var anchors = __nccwpck_require__(84790); +var visit = __nccwpck_require__(80976); +var identity = __nccwpck_require__(98656); +var Node = __nccwpck_require__(58890); +var toJS = __nccwpck_require__(42420); class Alias extends Node.NodeBase { constructor(source) { @@ -86245,14 +102202,14 @@ exports.Alias = Alias; /***/ }), -/***/ 507: +/***/ 30507: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var createNode = __nccwpck_require__(4685); -var identity = __nccwpck_require__(8656); -var Node = __nccwpck_require__(8890); +var createNode = __nccwpck_require__(54685); +var identity = __nccwpck_require__(98656); +var Node = __nccwpck_require__(58890); function collectionFromPath(schema, path, value) { let v = value; @@ -86403,14 +102360,14 @@ exports.isEmptyPath = isEmptyPath; /***/ }), -/***/ 8890: +/***/ 58890: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var applyReviver = __nccwpck_require__(5259); -var identity = __nccwpck_require__(8656); -var toJS = __nccwpck_require__(2420); +var applyReviver = __nccwpck_require__(45259); +var identity = __nccwpck_require__(98656); +var toJS = __nccwpck_require__(42420); class NodeBase { constructor(type) { @@ -86450,15 +102407,15 @@ exports.NodeBase = NodeBase; /***/ }), -/***/ 5868: +/***/ 85868: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var createNode = __nccwpck_require__(4685); -var stringifyPair = __nccwpck_require__(9715); -var addPairToJSMap = __nccwpck_require__(7706); -var identity = __nccwpck_require__(8656); +var createNode = __nccwpck_require__(54685); +var stringifyPair = __nccwpck_require__(19715); +var addPairToJSMap = __nccwpck_require__(87706); +var identity = __nccwpck_require__(98656); function createPair(key, value, ctx) { const k = createNode.createNode(key, undefined, ctx); @@ -86496,14 +102453,14 @@ exports.createPair = createPair; /***/ }), -/***/ 2112: +/***/ 92112: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var Node = __nccwpck_require__(8890); -var toJS = __nccwpck_require__(2420); +var identity = __nccwpck_require__(98656); +var Node = __nccwpck_require__(58890); +var toJS = __nccwpck_require__(42420); const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object'); class Scalar extends Node.NodeBase { @@ -86530,17 +102487,17 @@ exports.isScalarValue = isScalarValue; /***/ }), -/***/ 3666: +/***/ 53666: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var stringifyCollection = __nccwpck_require__(7127); -var addPairToJSMap = __nccwpck_require__(7706); -var Collection = __nccwpck_require__(507); -var identity = __nccwpck_require__(8656); -var Pair = __nccwpck_require__(5868); -var Scalar = __nccwpck_require__(2112); +var stringifyCollection = __nccwpck_require__(77127); +var addPairToJSMap = __nccwpck_require__(87706); +var Collection = __nccwpck_require__(30507); +var identity = __nccwpck_require__(98656); +var Pair = __nccwpck_require__(85868); +var Scalar = __nccwpck_require__(92112); function findPair(items, key) { const k = identity.isScalar(key) ? key.value : key; @@ -86684,17 +102641,17 @@ exports.findPair = findPair; /***/ }), -/***/ 1071: +/***/ 11071: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var createNode = __nccwpck_require__(4685); -var stringifyCollection = __nccwpck_require__(7127); -var Collection = __nccwpck_require__(507); -var identity = __nccwpck_require__(8656); -var Scalar = __nccwpck_require__(2112); -var toJS = __nccwpck_require__(2420); +var createNode = __nccwpck_require__(54685); +var stringifyCollection = __nccwpck_require__(77127); +var Collection = __nccwpck_require__(30507); +var identity = __nccwpck_require__(98656); +var Scalar = __nccwpck_require__(92112); +var toJS = __nccwpck_require__(42420); class YAMLSeq extends Collection.Collection { static get tagName() { @@ -86806,16 +102763,16 @@ exports.YAMLSeq = YAMLSeq; /***/ }), -/***/ 7706: +/***/ 87706: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var log = __nccwpck_require__(3332); -var stringify = __nccwpck_require__(5406); -var identity = __nccwpck_require__(8656); -var Scalar = __nccwpck_require__(2112); -var toJS = __nccwpck_require__(2420); +var log = __nccwpck_require__(23332); +var stringify = __nccwpck_require__(85406); +var identity = __nccwpck_require__(98656); +var Scalar = __nccwpck_require__(92112); +var toJS = __nccwpck_require__(42420); const MERGE_KEY = '<<'; function addPairToJSMap(ctx, map, { key, value }) { @@ -86919,7 +102876,7 @@ exports.addPairToJSMap = addPairToJSMap; /***/ }), -/***/ 8656: +/***/ 98656: /***/ ((__unused_webpack_module, exports) => { @@ -86979,12 +102936,12 @@ exports.isSeq = isSeq; /***/ }), -/***/ 2420: +/***/ 42420: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); +var identity = __nccwpck_require__(98656); /** * Recursively convert any node or its contents to native JavaScript @@ -87030,10 +102987,10 @@ exports.toJS = toJS; -var resolveBlockScalar = __nccwpck_require__(9466); -var resolveFlowScalar = __nccwpck_require__(9146); -var errors = __nccwpck_require__(4139); -var stringifyString = __nccwpck_require__(7517); +var resolveBlockScalar = __nccwpck_require__(49466); +var resolveFlowScalar = __nccwpck_require__(49146); +var errors = __nccwpck_require__(44139); +var stringifyString = __nccwpck_require__(17517); function resolveAsScalar(token, strict = true, onError) { if (token) { @@ -87250,7 +103207,7 @@ exports.setScalarValue = setScalarValue; /***/ }), -/***/ 3358: +/***/ 23358: /***/ ((__unused_webpack_module, exports) => { @@ -87320,7 +103277,7 @@ exports.stringify = stringify; /***/ }), -/***/ 6559: +/***/ 66559: /***/ ((__unused_webpack_module, exports) => { @@ -87426,14 +103383,14 @@ exports.visit = visit; /***/ }), -/***/ 8289: +/***/ 28289: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { var cstScalar = __nccwpck_require__(1870); -var cstStringify = __nccwpck_require__(3358); -var cstVisit = __nccwpck_require__(6559); +var cstStringify = __nccwpck_require__(23358); +var cstVisit = __nccwpck_require__(66559); /** The byte order mark */ const BOM = '\u{FEFF}'; @@ -87545,12 +103502,12 @@ exports.tokenType = tokenType; /***/ }), -/***/ 216: +/***/ 50216: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var cst = __nccwpck_require__(8289); +var cst = __nccwpck_require__(28289); /* START -> stream @@ -88271,7 +104228,7 @@ exports.Lexer = Lexer; /***/ }), -/***/ 13: +/***/ 70013: /***/ ((__unused_webpack_module, exports) => { @@ -88319,13 +104276,13 @@ exports.LineCounter = LineCounter; /***/ }), -/***/ 1356: +/***/ 11356: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var cst = __nccwpck_require__(8289); -var lexer = __nccwpck_require__(216); +var cst = __nccwpck_require__(28289); +var lexer = __nccwpck_require__(50216); function includesToken(list, type) { for (let i = 0; i < list.length; ++i) @@ -89282,17 +105239,17 @@ exports.Parser = Parser; /***/ }), -/***/ 9723: +/***/ 29723: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var composer = __nccwpck_require__(1589); -var Document = __nccwpck_require__(7864); -var errors = __nccwpck_require__(4139); -var log = __nccwpck_require__(3332); -var lineCounter = __nccwpck_require__(13); -var parser = __nccwpck_require__(1356); +var composer = __nccwpck_require__(31589); +var Document = __nccwpck_require__(87864); +var errors = __nccwpck_require__(44139); +var log = __nccwpck_require__(23332); +var lineCounter = __nccwpck_require__(70013); +var parser = __nccwpck_require__(11356); function parseOptions(options) { const prettyErrors = options.prettyErrors !== false; @@ -89393,16 +105350,16 @@ exports.stringify = stringify; /***/ }), -/***/ 2895: +/***/ 82895: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var map = __nccwpck_require__(9232); -var seq = __nccwpck_require__(5913); -var string = __nccwpck_require__(8428); -var tags = __nccwpck_require__(2319); +var identity = __nccwpck_require__(98656); +var map = __nccwpck_require__(59232); +var seq = __nccwpck_require__(55913); +var string = __nccwpck_require__(28428); +var tags = __nccwpck_require__(32319); const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0; class Schema { @@ -89440,13 +105397,13 @@ exports.Schema = Schema; /***/ }), -/***/ 9232: +/***/ 59232: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var YAMLMap = __nccwpck_require__(3666); +var identity = __nccwpck_require__(98656); +var YAMLMap = __nccwpck_require__(53666); const map = { collection: 'map', @@ -89466,12 +105423,12 @@ exports.map = map; /***/ }), -/***/ 5232: +/***/ 35232: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); +var Scalar = __nccwpck_require__(92112); const nullTag = { identify: value => value == null, @@ -89490,13 +105447,13 @@ exports.nullTag = nullTag; /***/ }), -/***/ 5913: +/***/ 55913: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var YAMLSeq = __nccwpck_require__(1071); +var identity = __nccwpck_require__(98656); +var YAMLSeq = __nccwpck_require__(11071); const seq = { collection: 'seq', @@ -89516,12 +105473,12 @@ exports.seq = seq; /***/ }), -/***/ 8428: +/***/ 28428: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var stringifyString = __nccwpck_require__(7517); +var stringifyString = __nccwpck_require__(17517); const string = { identify: value => typeof value === 'string', @@ -89539,12 +105496,12 @@ exports.string = string; /***/ }), -/***/ 6483: +/***/ 16483: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); +var Scalar = __nccwpck_require__(92112); const boolTag = { identify: value => typeof value === 'boolean', @@ -89567,13 +105524,13 @@ exports.boolTag = boolTag; /***/ }), -/***/ 3442: +/***/ 93442: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); -var stringifyNumber = __nccwpck_require__(3720); +var Scalar = __nccwpck_require__(92112); +var stringifyNumber = __nccwpck_require__(73720); const floatNaN = { identify: value => typeof value === 'number', @@ -89621,12 +105578,12 @@ exports.floatNaN = floatNaN; /***/ }), -/***/ 3794: +/***/ 63794: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var stringifyNumber = __nccwpck_require__(3720); +var stringifyNumber = __nccwpck_require__(73720); const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value); const intResolve = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix)); @@ -89670,18 +105627,18 @@ exports.intOct = intOct; /***/ }), -/***/ 2729: +/***/ 32729: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var map = __nccwpck_require__(9232); -var _null = __nccwpck_require__(5232); -var seq = __nccwpck_require__(5913); -var string = __nccwpck_require__(8428); -var bool = __nccwpck_require__(6483); -var float = __nccwpck_require__(3442); -var int = __nccwpck_require__(3794); +var map = __nccwpck_require__(59232); +var _null = __nccwpck_require__(35232); +var seq = __nccwpck_require__(55913); +var string = __nccwpck_require__(28428); +var bool = __nccwpck_require__(16483); +var float = __nccwpck_require__(93442); +var int = __nccwpck_require__(63794); const schema = [ map.map, @@ -89702,14 +105659,14 @@ exports.schema = schema; /***/ }), -/***/ 456: +/***/ 40456: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); -var map = __nccwpck_require__(9232); -var seq = __nccwpck_require__(5913); +var Scalar = __nccwpck_require__(92112); +var map = __nccwpck_require__(59232); +var seq = __nccwpck_require__(55913); function intIdentify(value) { return typeof value === 'bigint' || Number.isInteger(value); @@ -89773,26 +105730,26 @@ exports.schema = schema; /***/ }), -/***/ 2319: +/***/ 32319: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var map = __nccwpck_require__(9232); -var _null = __nccwpck_require__(5232); -var seq = __nccwpck_require__(5913); -var string = __nccwpck_require__(8428); -var bool = __nccwpck_require__(6483); -var float = __nccwpck_require__(3442); -var int = __nccwpck_require__(3794); -var schema = __nccwpck_require__(2729); -var schema$1 = __nccwpck_require__(456); -var binary = __nccwpck_require__(6905); -var omap = __nccwpck_require__(1349); -var pairs = __nccwpck_require__(6855); -var schema$2 = __nccwpck_require__(5161); +var map = __nccwpck_require__(59232); +var _null = __nccwpck_require__(35232); +var seq = __nccwpck_require__(55913); +var string = __nccwpck_require__(28428); +var bool = __nccwpck_require__(16483); +var float = __nccwpck_require__(93442); +var int = __nccwpck_require__(63794); +var schema = __nccwpck_require__(32729); +var schema$1 = __nccwpck_require__(40456); +var binary = __nccwpck_require__(36905); +var omap = __nccwpck_require__(91349); +var pairs = __nccwpck_require__(96855); +var schema$2 = __nccwpck_require__(25161); var set = __nccwpck_require__(8679); -var timestamp = __nccwpck_require__(5249); +var timestamp = __nccwpck_require__(45249); const schemas = new Map([ ['core', schema.schema], @@ -89866,13 +105823,13 @@ exports.getTags = getTags; /***/ }), -/***/ 6905: +/***/ 36905: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); -var stringifyString = __nccwpck_require__(7517); +var Scalar = __nccwpck_require__(92112); +var stringifyString = __nccwpck_require__(17517); const binary = { identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array @@ -89941,12 +105898,12 @@ exports.binary = binary; /***/ }), -/***/ 4651: +/***/ 54651: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); +var Scalar = __nccwpck_require__(92112); function boolStringify({ value, source }, ctx) { const boolObj = value ? trueTag : falseTag; @@ -89977,13 +105934,13 @@ exports.trueTag = trueTag; /***/ }), -/***/ 9396: +/***/ 99396: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); -var stringifyNumber = __nccwpck_require__(3720); +var Scalar = __nccwpck_require__(92112); +var stringifyNumber = __nccwpck_require__(73720); const floatNaN = { identify: value => typeof value === 'number', @@ -90034,12 +105991,12 @@ exports.floatNaN = floatNaN; /***/ }), -/***/ 1354: +/***/ 91354: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var stringifyNumber = __nccwpck_require__(3720); +var stringifyNumber = __nccwpck_require__(73720); const intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value); function intResolve(str, offset, radix, { intAsBigInt }) { @@ -90117,16 +106074,16 @@ exports.intOct = intOct; /***/ }), -/***/ 1349: +/***/ 91349: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var toJS = __nccwpck_require__(2420); -var YAMLMap = __nccwpck_require__(3666); -var YAMLSeq = __nccwpck_require__(1071); -var pairs = __nccwpck_require__(6855); +var identity = __nccwpck_require__(98656); +var toJS = __nccwpck_require__(42420); +var YAMLMap = __nccwpck_require__(53666); +var YAMLSeq = __nccwpck_require__(11071); +var pairs = __nccwpck_require__(96855); class YAMLOMap extends YAMLSeq.YAMLSeq { constructor() { @@ -90201,15 +106158,15 @@ exports.omap = omap; /***/ }), -/***/ 6855: +/***/ 96855: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var Pair = __nccwpck_require__(5868); -var Scalar = __nccwpck_require__(2112); -var YAMLSeq = __nccwpck_require__(1071); +var identity = __nccwpck_require__(98656); +var Pair = __nccwpck_require__(85868); +var Scalar = __nccwpck_require__(92112); +var YAMLSeq = __nccwpck_require__(11071); function resolvePairs(seq, onError) { if (identity.isSeq(seq)) { @@ -90290,23 +106247,23 @@ exports.resolvePairs = resolvePairs; /***/ }), -/***/ 5161: +/***/ 25161: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var map = __nccwpck_require__(9232); -var _null = __nccwpck_require__(5232); -var seq = __nccwpck_require__(5913); -var string = __nccwpck_require__(8428); -var binary = __nccwpck_require__(6905); -var bool = __nccwpck_require__(4651); -var float = __nccwpck_require__(9396); -var int = __nccwpck_require__(1354); -var omap = __nccwpck_require__(1349); -var pairs = __nccwpck_require__(6855); +var map = __nccwpck_require__(59232); +var _null = __nccwpck_require__(35232); +var seq = __nccwpck_require__(55913); +var string = __nccwpck_require__(28428); +var binary = __nccwpck_require__(36905); +var bool = __nccwpck_require__(54651); +var float = __nccwpck_require__(99396); +var int = __nccwpck_require__(91354); +var omap = __nccwpck_require__(91349); +var pairs = __nccwpck_require__(96855); var set = __nccwpck_require__(8679); -var timestamp = __nccwpck_require__(5249); +var timestamp = __nccwpck_require__(45249); const schema = [ map.map, @@ -90341,9 +106298,9 @@ exports.schema = schema; -var identity = __nccwpck_require__(8656); -var Pair = __nccwpck_require__(5868); -var YAMLMap = __nccwpck_require__(3666); +var identity = __nccwpck_require__(98656); +var Pair = __nccwpck_require__(85868); +var YAMLMap = __nccwpck_require__(53666); class YAMLSet extends YAMLMap.YAMLMap { constructor(schema) { @@ -90439,12 +106396,12 @@ exports.set = set; /***/ }), -/***/ 5249: +/***/ 45249: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var stringifyNumber = __nccwpck_require__(3720); +var stringifyNumber = __nccwpck_require__(73720); /** Internal types handle bigint as number, because TS can't figure it out. */ function parseSexagesimal(str, asBigInt) { @@ -90551,7 +106508,7 @@ exports.timestamp = timestamp; /***/ }), -/***/ 61: +/***/ 50061: /***/ ((__unused_webpack_module, exports) => { @@ -90709,15 +106666,15 @@ exports.foldFlowLines = foldFlowLines; /***/ }), -/***/ 5406: +/***/ 85406: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var anchors = __nccwpck_require__(4790); -var identity = __nccwpck_require__(8656); -var stringifyComment = __nccwpck_require__(9606); -var stringifyString = __nccwpck_require__(7517); +var anchors = __nccwpck_require__(84790); +var identity = __nccwpck_require__(98656); +var stringifyComment = __nccwpck_require__(49606); +var stringifyString = __nccwpck_require__(17517); function createStringifyContext(doc, options) { const opt = Object.assign({ @@ -90843,14 +106800,14 @@ exports.stringify = stringify; /***/ }), -/***/ 7127: +/***/ 77127: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var stringify = __nccwpck_require__(5406); -var stringifyComment = __nccwpck_require__(9606); +var identity = __nccwpck_require__(98656); +var stringify = __nccwpck_require__(85406); +var stringifyComment = __nccwpck_require__(49606); function stringifyCollection(collection, ctx, options) { const flow = ctx.inFlow ?? collection.flow; @@ -90995,7 +106952,7 @@ exports.stringifyCollection = stringifyCollection; /***/ }), -/***/ 9606: +/***/ 49606: /***/ ((__unused_webpack_module, exports) => { @@ -91026,14 +106983,14 @@ exports.stringifyComment = stringifyComment; /***/ }), -/***/ 2036: +/***/ 82036: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var stringify = __nccwpck_require__(5406); -var stringifyComment = __nccwpck_require__(9606); +var identity = __nccwpck_require__(98656); +var stringify = __nccwpck_require__(85406); +var stringifyComment = __nccwpck_require__(49606); function stringifyDocument(doc, options) { const lines = []; @@ -91120,7 +107077,7 @@ exports.stringifyDocument = stringifyDocument; /***/ }), -/***/ 3720: +/***/ 73720: /***/ ((__unused_webpack_module, exports) => { @@ -91153,15 +107110,15 @@ exports.stringifyNumber = stringifyNumber; /***/ }), -/***/ 9715: +/***/ 19715: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); -var Scalar = __nccwpck_require__(2112); -var stringify = __nccwpck_require__(5406); -var stringifyComment = __nccwpck_require__(9606); +var identity = __nccwpck_require__(98656); +var Scalar = __nccwpck_require__(92112); +var stringify = __nccwpck_require__(85406); +var stringifyComment = __nccwpck_require__(49606); function stringifyPair({ key, value }, ctx, onComment, onChompKeep) { const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx; @@ -91312,13 +107269,13 @@ exports.stringifyPair = stringifyPair; /***/ }), -/***/ 7517: +/***/ 17517: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var Scalar = __nccwpck_require__(2112); -var foldFlowLines = __nccwpck_require__(61); +var Scalar = __nccwpck_require__(92112); +var foldFlowLines = __nccwpck_require__(50061); const getFoldOptions = (ctx, isBlock) => ({ indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart, @@ -91649,12 +107606,12 @@ exports.stringifyString = stringifyString; /***/ }), -/***/ 976: +/***/ 80976: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { -var identity = __nccwpck_require__(8656); +var identity = __nccwpck_require__(98656); const BREAK = Symbol('break visit'); const SKIP = Symbol('skip children'); @@ -91890,6 +107847,13 @@ exports.visit = visit; exports.visitAsync = visitAsync; +/***/ }), + +/***/ 51927: +/***/ ((module) => { + +module.exports = {"i8":"5.23.3"}; + /***/ }) /******/ }); @@ -92116,25 +108080,27 @@ __nccwpck_require__.d(forms_namespaceObject, { }); // EXTERNAL MODULE: external "node:process" -var external_node_process_ = __nccwpck_require__(7742); +var external_node_process_ = __nccwpck_require__(97742); // EXTERNAL MODULE: ../../node_modules/@actions/core/lib/core.js -var lib_core = __nccwpck_require__(7117); +var lib_core = __nccwpck_require__(37117); // EXTERNAL MODULE: external "node:os" -var external_node_os_ = __nccwpck_require__(612); +var external_node_os_ = __nccwpck_require__(70612); // EXTERNAL MODULE: ../../node_modules/@actions/exec/lib/exec.js -var lib_exec = __nccwpck_require__(6473); +var lib_exec = __nccwpck_require__(66473); ;// CONCATENATED MODULE: external "node:crypto" const external_node_crypto_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto"); ;// CONCATENATED MODULE: external "node:path" const external_node_path_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path"); // EXTERNAL MODULE: ../../node_modules/@actions/cache/lib/cache.js -var cache = __nccwpck_require__(6930); +var cache = __nccwpck_require__(86930); // EXTERNAL MODULE: ../../node_modules/@actions/github/lib/github.js -var lib_github = __nccwpck_require__(4005); +var lib_github = __nccwpck_require__(84005); +// EXTERNAL MODULE: ../../node_modules/systeminformation/lib/index.js +var lib = __nccwpck_require__(19042); // EXTERNAL MODULE: ../../node_modules/yaml/dist/index.js var dist = __nccwpck_require__(8447); // EXTERNAL MODULE: ../../node_modules/semver/index.js -var semver = __nccwpck_require__(7546); +var semver = __nccwpck_require__(77546); ;// CONCATENATED MODULE: ./src/version.ts @@ -92305,7 +108271,7 @@ const RESOLVED_COMPILER = (async () => { ;// CONCATENATED MODULE: external "node:fs" const external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs"); // EXTERNAL MODULE: ../../node_modules/@actions/tool-cache/lib/tool-cache.js -var tool_cache = __nccwpck_require__(834); +var tool_cache = __nccwpck_require__(40834); ;// CONCATENATED MODULE: ./src/unix.ts @@ -92502,9 +108468,9 @@ async function repositoryRemoveAll() { } // EXTERNAL MODULE: ../../node_modules/@actions/http-client/lib/index.js -var lib = __nccwpck_require__(7301); +var http_client_lib = __nccwpck_require__(87301); // EXTERNAL MODULE: ../../node_modules/@actions/io/lib/io.js -var io = __nccwpck_require__(47); +var io = __nccwpck_require__(96890); ;// CONCATENATED MODULE: ../../node_modules/cheerio/lib/esm/options.js const defaultOpts = { xml: false, @@ -96096,9 +112062,9 @@ function toggleClass(value, stateVal) { } //# sourceMappingURL=attributes.js.map // EXTERNAL MODULE: ../../node_modules/css-what/lib/commonjs/index.js -var commonjs = __nccwpck_require__(7191); +var commonjs = __nccwpck_require__(47191); // EXTERNAL MODULE: ../../node_modules/boolbase/index.js -var boolbase = __nccwpck_require__(6288); +var boolbase = __nccwpck_require__(16288); ;// CONCATENATED MODULE: ../../node_modules/css-select/lib/esm/sort.js const procedure = new Map([ @@ -109793,7 +125759,7 @@ const { root: esm_root } = static_namespaceObject; function createHttpClient() { - return new lib.HttpClient("OCamlBot (+https://github.com/ocaml/setup-ocaml)", [], { allowRetries: true, maxRetries: 5 }); + return new http_client_lib.HttpClient("OCamlBot (+https://github.com/ocaml/setup-ocaml)", [], { allowRetries: true, maxRetries: 5 }); } async function getCygwinVersion() { const httpClient = createHttpClient(); @@ -109858,6 +125824,7 @@ async function setupCygwin() { + async function composeCygwinCacheKeys() { const cygwinVersion = await getCygwinVersion(); const key = `${CACHE_PREFIX}-setup-ocaml-cygwin-${cygwinVersion}`; @@ -109865,36 +125832,34 @@ async function composeCygwinCacheKeys() { return { key, restoreKeys }; } async function composeDuneCacheKeys() { - const platform = PLATFORM.replaceAll(/\W/g, "_"); - const architecture = ARCHITECTURE.replaceAll(/\W/g, "_"); const { workflow, job } = lib_github.context; const ocamlCompiler = await RESOLVED_COMPILER; - const sha256 = external_node_crypto_namespaceObject.createHash("sha256"); - const hash = sha256 - .update([architecture, job, ocamlCompiler, platform, workflow].join("")) - .digest("hex"); + const plainKey = [PLATFORM, ARCHITECTURE, ocamlCompiler, workflow, job].join(","); + const hash = external_node_crypto_namespaceObject.createHash("sha256").update(plainKey).digest("hex"); const key = `${CACHE_PREFIX}-setup-ocaml-dune-${hash}`; const restoreKeys = [key]; + lib_core.debug(`dune cache key: ${plainKey}`); return { key, restoreKeys }; } async function composeOpamCacheKeys() { const { version: opamVersion } = await getLatestOpamRelease(); const sandbox = OPAM_DISABLE_SANDBOXING ? "nosandbox" : "sandbox"; const ocamlCompiler = await RESOLVED_COMPILER; - const repositories = OPAM_REPOSITORIES.map(([_, value]) => value).join(""); - const sha256 = external_node_crypto_namespaceObject.createHash("sha256"); - const hash = sha256 - .update([ + const repositoryUrls = OPAM_REPOSITORIES.map(([_, value]) => value).join(","); + const osInfo = await lib.osInfo(); + const plainKey = [ + PLATFORM, + osInfo.release, ARCHITECTURE, - ocamlCompiler, opamVersion, - PLATFORM, - repositories, + ocamlCompiler, + repositoryUrls, sandbox, - ].join("")) - .digest("hex"); + ].join(","); + const hash = external_node_crypto_namespaceObject.createHash("sha256").update(plainKey).digest("hex"); const key = `${CACHE_PREFIX}-setup-ocaml-opam-${hash}`; const restoreKeys = [key]; + lib_core.debug(`opam cache key: ${plainKey}`); return { key, restoreKeys }; } function composeCygwinCachePaths() { @@ -110052,7 +126017,7 @@ async function trimDuneCache() { } // EXTERNAL MODULE: ../../node_modules/@actions/glob/lib/glob.js -var glob = __nccwpck_require__(3553); +var glob = __nccwpck_require__(43553); ;// CONCATENATED MODULE: ./src/packages.ts diff --git a/dist/post/LICENSE.txt b/dist/post/LICENSE.txt index f9e6f2b3..f67e31d8 100644 --- a/dist/post/LICENSE.txt +++ b/dist/post/LICENSE.txt @@ -1102,6 +1102,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +systeminformation +MIT +The MIT License (MIT) + +Copyright (c) 2014-2024 Sebastian Hildebrandt + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + tslib 0BSD Copyright (c) Microsoft Corporation. diff --git a/dist/post/index.js b/dist/post/index.js index f6c51ed0..6898843c 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -44786,6 +44786,15955 @@ function trimZeros(numStr){ module.exports = toNumber +/***/ }), + +/***/ 9238: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// audio.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 16. audio +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseAudioType(str, input, output) { + str = str.toLowerCase(); + let result = ''; + + if (str.indexOf('input') >= 0) { result = 'Microphone'; } + if (str.indexOf('display audio') >= 0) { result = 'Speaker'; } + if (str.indexOf('speak') >= 0) { result = 'Speaker'; } + if (str.indexOf('laut') >= 0) { result = 'Speaker'; } + if (str.indexOf('loud') >= 0) { result = 'Speaker'; } + if (str.indexOf('head') >= 0) { result = 'Headset'; } + if (str.indexOf('mic') >= 0) { result = 'Microphone'; } + if (str.indexOf('mikr') >= 0) { result = 'Microphone'; } + if (str.indexOf('phone') >= 0) { result = 'Phone'; } + if (str.indexOf('controll') >= 0) { result = 'Controller'; } + if (str.indexOf('line o') >= 0) { result = 'Line Out'; } + if (str.indexOf('digital o') >= 0) { result = 'Digital Out'; } + if (str.indexOf('smart sound technology') >= 0) { result = 'Digital Signal Processor'; } + if (str.indexOf('high definition audio') >= 0) { result = 'Sound Driver'; } + + if (!result && output) { + result = 'Speaker'; + } else if (!result && input) { + result = 'Microphone'; + } + return result; +} + + +function getLinuxAudioPci() { + let cmd = 'lspci -v 2>/dev/null'; + let result = []; + try { + const parts = execSync(cmd, util.execOptsLinux).toString().split('\n\n'); + parts.forEach(element => { + const lines = element.split('\n'); + if (lines && lines.length && lines[0].toLowerCase().indexOf('audio') >= 0) { + const audio = {}; + audio.slotId = lines[0].split(' ')[0]; + audio.driver = util.getValue(lines, 'Kernel driver in use', ':', true) || util.getValue(lines, 'Kernel modules', ':', true); + result.push(audio); + } + }); + return result; + } catch (e) { + return result; + } +} + +function parseLinuxAudioPciMM(lines, audioPCI) { + const result = {}; + const slotId = util.getValue(lines, 'Slot'); + + const pciMatch = audioPCI.filter(function (item) { return item.slotId === slotId; }); + + result.id = slotId; + result.name = util.getValue(lines, 'SDevice'); + result.manufacturer = util.getValue(lines, 'SVendor'); + result.revision = util.getValue(lines, 'Rev'); + result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : ''; + result.default = null; + result.channel = 'PCIe'; + result.type = parseAudioType(result.name, null, null); + result.in = null; + result.out = null; + result.status = 'online'; + + return result; +} + +function parseDarwinChannel(str) { + let result = ''; + + if (str.indexOf('builtin') >= 0) { result = 'Built-In'; } + if (str.indexOf('extern') >= 0) { result = 'Audio-Jack'; } + if (str.indexOf('hdmi') >= 0) { result = 'HDMI'; } + if (str.indexOf('displayport') >= 0) { result = 'Display-Port'; } + if (str.indexOf('usb') >= 0) { result = 'USB'; } + if (str.indexOf('pci') >= 0) { result = 'PCIe'; } + + return result; +} + +function parseDarwinAudio(audioObject, id) { + const result = {}; + const channelStr = ((audioObject.coreaudio_device_transport || '') + ' ' + (audioObject._name || '')).toLowerCase(); + + result.id = id; + result.name = audioObject._name; + result.manufacturer = audioObject.coreaudio_device_manufacturer; + result.revision = null; + result.driver = null; + result.default = !!(audioObject.coreaudio_default_audio_input_device || '') || !!(audioObject.coreaudio_default_audio_output_device || ''); + result.channel = parseDarwinChannel(channelStr); + result.type = parseAudioType(result.name, !!(audioObject.coreaudio_device_input || ''), !!(audioObject.coreaudio_device_output || '')); + result.in = !!(audioObject.coreaudio_device_input || ''); + result.out = !!(audioObject.coreaudio_device_output || ''); + result.status = 'online'; + + return result; +} + +function parseWindowsAudio(lines) { + const result = {}; + const status = util.getValue(lines, 'StatusInfo', ':'); + + result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID?? + result.name = util.getValue(lines, 'name', ':'); + result.manufacturer = util.getValue(lines, 'manufacturer', ':'); + result.revision = null; + result.driver = null; + result.default = null; + result.channel = null; + result.type = parseAudioType(result.name, null, null); + result.in = null; + result.out = null; + result.status = status; + + return result; +} + +function audio(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'lspci -vmm 2>/dev/null'; + exec(cmd, function (error, stdout) { + // PCI + if (!error) { + const audioPCI = getLinuxAudioPci(); + const parts = stdout.toString().split('\n\n'); + parts.forEach(element => { + const lines = element.split('\n'); + if (util.getValue(lines, 'class', ':', true).toLowerCase().indexOf('audio') >= 0) { + const audio = parseLinuxAudioPciMM(lines, audioPCI); + result.push(audio); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_darwin) { + let cmd = 'system_profiler SPAudioDataType -json'; + exec(cmd, function (error, stdout) { + if (!error) { + try { + const outObj = JSON.parse(stdout.toString()); + if (outObj.SPAudioDataType && outObj.SPAudioDataType.length && outObj.SPAudioDataType[0] && outObj.SPAudioDataType[0]['_items'] && outObj.SPAudioDataType[0]['_items'].length) { + for (let i = 0; i < outObj.SPAudioDataType[0]['_items'].length; i++) { + const audio = parseDarwinAudio(outObj.SPAudioDataType[0]['_items'][i], i); + result.push(audio); + } + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + util.powerShell('Get-CimInstance Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + parts.forEach(element => { + const lines = element.split('\n'); + if (util.getValue(lines, 'name', ':')) { + result.push(parseWindowsAudio(lines)); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos) { + resolve(null); + } + }); + }); +} + +exports.audio = audio; + + +/***/ }), + +/***/ 7883: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +// @ts-check; +// ================================================================================== +// battery.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 6. Battery +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(2081).exec); +const fs = __nccwpck_require__(7147); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) { + const result = {}; + let status = util.getValue(lines, 'BatteryStatus', ':').trim(); + // 1 = "Discharging" + // 2 = "On A/C" + // 3 = "Fully Charged" + // 4 = "Low" + // 5 = "Critical" + // 6 = "Charging" + // 7 = "Charging High" + // 8 = "Charging Low" + // 9 = "Charging Critical" + // 10 = "Undefined" + // 11 = "Partially Charged" + if (status >= 0) { + const statusValue = status ? parseInt(status) : 0; + result.status = statusValue; + result.hasBattery = true; + result.maxCapacity = fullChargeCapacity || parseInt(util.getValue(lines, 'DesignCapacity', ':') || 0); + result.designedCapacity = parseInt(util.getValue(lines, 'DesignCapacity', ':') || designedCapacity); + result.voltage = parseInt(util.getValue(lines, 'DesignVoltage', ':') || 0) / 1000.0; + result.capacityUnit = 'mWh'; + result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', ':') || 0); + result.currentCapacity = parseInt(result.maxCapacity * result.percent / 100); + result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || ((statusValue !== 3) && (statusValue !== 1) && result.percent < 100); + result.acConnected = result.isCharging || statusValue === 2; + result.model = util.getValue(lines, 'DeviceID', ':'); + } else { + result.status = -1; + } + + return result; +} + +module.exports = function (callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + hasBattery: false, + cycleCount: 0, + isCharging: false, + designedCapacity: 0, + maxCapacity: 0, + currentCapacity: 0, + voltage: 0, + capacityUnit: '', + percent: 0, + timeRemaining: null, + acConnected: true, + type: '', + model: '', + manufacturer: '', + serial: '' + }; + + if (_linux) { + let battery_path = ''; + if (fs.existsSync('/sys/class/power_supply/BAT1/uevent')) { + battery_path = '/sys/class/power_supply/BAT1/'; + } else if (fs.existsSync('/sys/class/power_supply/BAT0/uevent')) { + battery_path = '/sys/class/power_supply/BAT0/'; + } + + let acConnected = false; + let acPath = ''; + if (fs.existsSync('/sys/class/power_supply/AC/online')) { + acPath = '/sys/class/power_supply/AC/online'; + } else if (fs.existsSync('/sys/class/power_supply/AC0/online')) { + acPath = '/sys/class/power_supply/AC0/online'; + } + + if (acPath) { + const file = fs.readFileSync(acPath); + acConnected = file.toString().trim() === '1'; + } + + if (battery_path) { + fs.readFile(battery_path + 'uevent', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + + result.isCharging = (util.getValue(lines, 'POWER_SUPPLY_STATUS', '=').toLowerCase() === 'charging'); + result.acConnected = acConnected || result.isCharging; + result.voltage = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_VOLTAGE_NOW', '='), 10) / 1000000.0; + result.capacityUnit = result.voltage ? 'mWh' : 'mAh'; + result.cycleCount = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CYCLE_COUNT', '='), 10); + result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL', '=', true, true), 10) / 1000.0 * (result.voltage || 1)); + const desingedMinVoltage = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_VOLTAGE_MIN_DESIGN', '='), 10) / 1000000.0; + result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_FULL_DESIGN', '=', true, true), 10) / 1000.0 * (desingedMinVoltage || result.voltage || 1)); + result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10) / 1000.0 * (result.voltage || 1)); + if (!result.maxCapacity) { + result.maxCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL', '=', true, true), 10) / 1000.0; + result.designedCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_FULL_DESIGN', '=', true, true), 10) / 1000.0 | result.maxCapacity; + result.currentCapacity = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10) / 1000.0; + } + const percent = util.getValue(lines, 'POWER_SUPPLY_CAPACITY', '='); + const energy = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_ENERGY_NOW', '='), 10); + const power = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_POWER_NOW', '='), 10); + const current = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CURRENT_NOW', '='), 10); + const charge = parseInt('0' + util.getValue(lines, 'POWER_SUPPLY_CHARGE_NOW', '='), 10); + + result.percent = parseInt('0' + percent, 10); + if (result.maxCapacity && result.currentCapacity) { + result.hasBattery = true; + if (!percent) { + result.percent = 100.0 * result.currentCapacity / result.maxCapacity; + } + } + if (result.isCharging) { + result.hasBattery = true; + } + if (energy && power) { + result.timeRemaining = Math.floor(energy / power * 60); + } else if (current && charge) { + result.timeRemaining = Math.floor(charge / current * 60); + } else if (current && result.currentCapacity) { + result.timeRemaining = Math.floor(result.currentCapacity / current * 60); + } + result.type = util.getValue(lines, 'POWER_SUPPLY_TECHNOLOGY', '='); + result.model = util.getValue(lines, 'POWER_SUPPLY_MODEL_NAME', '='); + result.manufacturer = util.getValue(lines, 'POWER_SUPPLY_MANUFACTURER', '='); + result.serial = util.getValue(lines, 'POWER_SUPPLY_SERIAL_NUMBER', '='); + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('sysctl -i hw.acpi.battery hw.acpi.acline', function (error, stdout) { + let lines = stdout.toString().split('\n'); + const batteries = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.units'), 10); + const percent = parseInt('0' + util.getValue(lines, 'hw.acpi.battery.life'), 10); + result.hasBattery = (batteries > 0); + result.cycleCount = null; + result.isCharging = util.getValue(lines, 'hw.acpi.acline') !== '1'; + result.acConnected = result.isCharging; + result.maxCapacity = null; + result.currentCapacity = null; + result.capacityUnit = 'unknown'; + result.percent = batteries ? percent : null; + if (callback) { callback(result); } + resolve(result); + }); + } + + if (_darwin) { + exec('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|BatterySerialNumber|TimeRemaining|Voltage"; pmset -g batt | grep %', function (error, stdout) { + if (stdout) { + let lines = stdout.toString().replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n'); + result.cycleCount = parseInt('0' + util.getValue(lines, 'cyclecount', '='), 10); + result.voltage = parseInt('0' + util.getValue(lines, 'voltage', '='), 10) / 1000.0; + result.capacityUnit = result.voltage ? 'mWh' : 'mAh'; + result.maxCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawmaxcapacity', '='), 10) * (result.voltage || 1)); + result.currentCapacity = Math.round(parseInt('0' + util.getValue(lines, 'applerawcurrentcapacity', '='), 10) * (result.voltage || 1)); + result.designedCapacity = Math.round(parseInt('0' + util.getValue(lines, 'DesignCapacity', '='), 10) * (result.voltage || 1)); + result.manufacturer = 'Apple'; + result.serial = util.getValue(lines, 'BatterySerialNumber', '='); + let percent = null; + const line = util.getValue(lines, 'internal', 'Battery'); + let parts = line.split(';'); + if (parts && parts[0]) { + let parts2 = parts[0].split('\t'); + if (parts2 && parts2[1]) { + percent = parseFloat(parts2[1].trim().replace(/%/g, '')); + } + } + if (parts && parts[1]) { + result.isCharging = (parts[1].trim() === 'charging'); + result.acConnected = (parts[1].trim() !== 'discharging'); + } else { + result.isCharging = util.getValue(lines, 'ischarging', '=').toLowerCase() === 'yes'; + result.acConnected = result.isCharging; + } + if (result.maxCapacity && result.currentCapacity) { + result.hasBattery = true; + result.type = 'Li-ion'; + result.percent = percent !== null ? percent : Math.round(100.0 * result.currentCapacity / result.maxCapacity); + if (!result.isCharging) { + result.timeRemaining = parseInt('0' + util.getValue(lines, 'TimeRemaining', '='), 10); + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl')); + workload.push(util.powerShell('(Get-WmiObject -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity')); + workload.push(util.powerShell('(Get-CimInstance -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity')); + util.promiseAll( + workload + ).then((data) => { + if (data) { + let parts = data.results[0].split(/\n\s*\n/); + let batteries = []; + const hasValue = value => /\S/.test(value); + for (let i = 0; i < parts.length; i++) { + if (hasValue(parts[i]) && (!batteries.length || !hasValue(parts[i - 1]))) { + batteries.push([]); + } + if (hasValue(parts[i])) { + batteries[batteries.length - 1].push(parts[i]); + } + } + let designCapacities = data.results[1].split('\r\n').filter(e => e); + let fullChargeCapacities = data.results[2].split('\r\n').filter(e => e); + if (batteries.length) { + let first = false; + let additionalBatteries = []; + for (let i = 0; i < batteries.length; i++) { + let lines = batteries[i][0].split('\r\n'); + const designedCapacity = designCapacities && designCapacities.length >= (i + 1) && designCapacities[i] ? util.toInt(designCapacities[i]) : 0; + const fullChargeCapacity = fullChargeCapacities && fullChargeCapacities.length >= (i + 1) && fullChargeCapacities[i] ? util.toInt(fullChargeCapacities[i]) : 0; + const parsed = parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity); + if (!first && parsed.status > 0 && parsed.status !== 10) { + result.hasBattery = parsed.hasBattery; + result.maxCapacity = parsed.maxCapacity; + result.designedCapacity = parsed.designedCapacity; + result.voltage = parsed.voltage; + result.capacityUnit = parsed.capacityUnit; + result.percent = parsed.percent; + result.currentCapacity = parsed.currentCapacity; + result.isCharging = parsed.isCharging; + result.acConnected = parsed.acConnected; + result.model = parsed.model; + first = true; + } else if (parsed.status !== -1) { + additionalBatteries.push( + { + hasBattery: parsed.hasBattery, + maxCapacity: parsed.maxCapacity, + designedCapacity: parsed.designedCapacity, + voltage: parsed.voltage, + capacityUnit: parsed.capacityUnit, + percent: parsed.percent, + currentCapacity: parsed.currentCapacity, + isCharging: parsed.isCharging, + timeRemaining: null, + acConnected: parsed.acConnected, + model: parsed.model, + type: '', + manufacturer: '', + serial: '' + } + ); + } + } + if (!first && additionalBatteries.length) { + result = additionalBatteries[0]; + additionalBatteries.shift(); + } + if (additionalBatteries.length) { + result.additionalBatteries = additionalBatteries; + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +}; + + +/***/ }), + +/***/ 8155: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// audio.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 17. bluetooth +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const path = __nccwpck_require__(1017); +const util = __nccwpck_require__(9872); +const fs = __nccwpck_require__(7147); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseBluetoothType(str) { + let result = ''; + + if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + if (str.indexOf('mouse') >= 0) { result = 'Mouse'; } + if (str.indexOf('trackpad') >= 0) { result = 'Trackpad'; } + if (str.indexOf('speaker') >= 0) { result = 'Speaker'; } + if (str.indexOf('headset') >= 0) { result = 'Headset'; } + if (str.indexOf('phone') >= 0) { result = 'Phone'; } + if (str.indexOf('macbook') >= 0) { result = 'Computer'; } + if (str.indexOf('imac') >= 0) { result = 'Computer'; } + if (str.indexOf('ipad') >= 0) { result = 'Tablet'; } + if (str.indexOf('watch') >= 0) { result = 'Watch'; } + if (str.indexOf('headphone') >= 0) { result = 'Headset'; } + // to be continued ... + + return result; +} + +function parseBluetoothManufacturer(str) { + let result = str.split(' ')[0]; + str = str.toLowerCase(); + if (str.indexOf('apple') >= 0) { result = 'Apple'; } + if (str.indexOf('ipad') >= 0) { result = 'Apple'; } + if (str.indexOf('imac') >= 0) { result = 'Apple'; } + if (str.indexOf('iphone') >= 0) { result = 'Apple'; } + if (str.indexOf('magic mouse') >= 0) { result = 'Apple'; } + if (str.indexOf('magic track') >= 0) { result = 'Apple'; } + if (str.indexOf('macbook') >= 0) { result = 'Apple'; } + // to be continued ... + + return result; +} + +function parseLinuxBluetoothInfo(lines, macAddr1, macAddr2) { + const result = {}; + + result.device = null; + result.name = util.getValue(lines, 'name', '='); + result.manufacturer = null; + result.macDevice = macAddr1; + result.macHost = macAddr2; + result.batteryPercent = null; + result.type = parseBluetoothType(result.name.toLowerCase()); + result.connected = false; + + return result; +} + +function parseDarwinBluetoothDevices(bluetoothObject, macAddr2) { + const result = {}; + const typeStr = ((bluetoothObject.device_minorClassOfDevice_string || bluetoothObject.device_majorClassOfDevice_string || bluetoothObject.device_minorType || '') + (bluetoothObject.device_name || '')).toLowerCase(); + + result.device = bluetoothObject.device_services || ''; + result.name = bluetoothObject.device_name || ''; + result.manufacturer = bluetoothObject.device_manufacturer || parseBluetoothManufacturer(bluetoothObject.device_name || '') || ''; + result.macDevice = (bluetoothObject.device_addr || bluetoothObject.device_address || '').toLowerCase().replace(/-/g, ':'); + result.macHost = macAddr2; + result.batteryPercent = bluetoothObject.device_batteryPercent || null; + result.type = parseBluetoothType(typeStr); + result.connected = bluetoothObject.device_isconnected === 'attrib_Yes' || false; + + return result; +} + +function parseWindowsBluetooth(lines) { + const result = {}; + + result.device = null; + result.name = util.getValue(lines, 'name', ':'); + result.manufacturer = util.getValue(lines, 'manufacturer', ':'); + result.macDevice = null; + result.macHost = null; + result.batteryPercent = null; + result.type = parseBluetoothType(result.name.toLowerCase()); + result.connected = null; + + return result; +} + +function bluetoothDevices(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux) { + // get files in /var/lib/bluetooth/ recursive + const btFiles = util.getFilesInPath('/var/lib/bluetooth/'); + btFiles.forEach((element) => { + const filename = path.basename(element); + const pathParts = element.split('/'); + const macAddr1 = pathParts.length >= 6 ? pathParts[pathParts.length - 2] : null; + const macAddr2 = pathParts.length >= 7 ? pathParts[pathParts.length - 3] : null; + if (filename === 'info') { + const infoFile = fs.readFileSync(element, { encoding: 'utf8' }).split('\n'); + result.push(parseLinuxBluetoothInfo(infoFile, macAddr1, macAddr2)); + } + }); + // determine "connected" with hcitool con + try { + const hdicon = execSync('hcitool con', util.execOptsLinux).toString().toLowerCase(); + for (let i = 0; i < result.length; i++) { + if (result[i].macDevice && result[i].macDevice.length > 10 && hdicon.indexOf(result[i].macDevice.toLowerCase()) >= 0) { + result[i].connected = true; + } + } + } catch (e) { + util.noop(); + } + + if (callback) { + callback(result); + } + resolve(result); + } + if (_darwin) { + let cmd = 'system_profiler SPBluetoothDataType -json'; + exec(cmd, function (error, stdout) { + if (!error) { + try { + const outObj = JSON.parse(stdout.toString()); + if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_title'] && outObj.SPBluetoothDataType[0]['device_title'].length) { + // missing: host BT Adapter macAddr () + let macAddr2 = null; + if (outObj.SPBluetoothDataType[0]['local_device_title'] && outObj.SPBluetoothDataType[0].local_device_title.general_address) { + macAddr2 = outObj.SPBluetoothDataType[0].local_device_title.general_address.toLowerCase().replace(/-/g, ':'); + } + outObj.SPBluetoothDataType[0]['device_title'].forEach((element) => { + const obj = element; + const objKey = Object.keys(obj); + if (objKey && objKey.length === 1) { + const innerObject = obj[objKey[0]]; + innerObject.device_name = objKey[0]; + const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2); + result.push(bluetoothDevice); + } + }); + } + if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_connected'] && outObj.SPBluetoothDataType[0]['device_connected'].length) { + const macAddr2 = outObj.SPBluetoothDataType[0].controller_properties && outObj.SPBluetoothDataType[0].controller_properties.controller_address ? outObj.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g, ':') : null; + outObj.SPBluetoothDataType[0]['device_connected'].forEach((element) => { + const obj = element; + const objKey = Object.keys(obj); + if (objKey && objKey.length === 1) { + const innerObject = obj[objKey[0]]; + innerObject.device_name = objKey[0]; + innerObject.device_isconnected = 'attrib_Yes'; + const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2); + result.push(bluetoothDevice); + } + }); + } + if (outObj.SPBluetoothDataType && outObj.SPBluetoothDataType.length && outObj.SPBluetoothDataType[0] && outObj.SPBluetoothDataType[0]['device_not_connected'] && outObj.SPBluetoothDataType[0]['device_not_connected'].length) { + const macAddr2 = outObj.SPBluetoothDataType[0].controller_properties && outObj.SPBluetoothDataType[0].controller_properties.controller_address ? outObj.SPBluetoothDataType[0].controller_properties.controller_address.toLowerCase().replace(/-/g, ':') : null; + outObj.SPBluetoothDataType[0]['device_not_connected'].forEach((element) => { + const obj = element; + const objKey = Object.keys(obj); + if (objKey && objKey.length === 1) { + const innerObject = obj[objKey[0]]; + innerObject.device_name = objKey[0]; + innerObject.device_isconnected = 'attrib_No'; + const bluetoothDevice = parseDarwinBluetoothDevices(innerObject, macAddr2); + result.push(bluetoothDevice); + } + }); + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + util.powerShell('Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + parts.forEach((part) => { + if (util.getValue(part.split('\n'), 'PNPClass', ':') === 'Bluetooth') { + result.push(parseWindowsBluetooth(part.split('\n'))); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_freebsd || _netbsd || _openbsd || _sunos) { + resolve(null); + } + }); + }); +} + +exports.bluetoothDevices = bluetoothDevices; + + +/***/ }), + +/***/ 8993: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// cpu.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 4. CPU +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const fs = __nccwpck_require__(7147); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _cpu_speed = 0; +let _current_cpu = { + user: 0, + nice: 0, + system: 0, + idle: 0, + irq: 0, + steal: 0, + guest: 0, + load: 0, + tick: 0, + ms: 0, + currentLoad: 0, + currentLoadUser: 0, + currentLoadSystem: 0, + currentLoadNice: 0, + currentLoadIdle: 0, + currentLoadIrq: 0, + currentLoadSteal: 0, + currentLoadGuest: 0, + rawCurrentLoad: 0, + rawCurrentLoadUser: 0, + rawCurrentLoadSystem: 0, + rawCurrentLoadNice: 0, + rawCurrentLoadIdle: 0, + rawCurrentLoadIrq: 0, + rawCurrentLoadSteal: 0, + rawCurrentLoadGuest: 0 +}; +let _cpus = []; +let _corecount = 0; + +const AMDBaseFrequencies = { + '8346': '1.8', + '8347': '1.9', + '8350': '2.0', + '8354': '2.2', + '8356|SE': '2.4', + '8356': '2.3', + '8360': '2.5', + '2372': '2.1', + '2373': '2.1', + '2374': '2.2', + '2376': '2.3', + '2377': '2.3', + '2378': '2.4', + '2379': '2.4', + '2380': '2.5', + '2381': '2.5', + '2382': '2.6', + '2384': '2.7', + '2386': '2.8', + '2387': '2.8', + '2389': '2.9', + '2393': '3.1', + '8374': '2.2', + '8376': '2.3', + '8378': '2.4', + '8379': '2.4', + '8380': '2.5', + '8381': '2.5', + '8382': '2.6', + '8384': '2.7', + '8386': '2.8', + '8387': '2.8', + '8389': '2.9', + '8393': '3.1', + '2419EE': '1.8', + '2423HE': '2.0', + '2425HE': '2.1', + '2427': '2.2', + '2431': '2.4', + '2435': '2.6', + '2439SE': '2.8', + '8425HE': '2.1', + '8431': '2.4', + '8435': '2.6', + '8439SE': '2.8', + '4122': '2.2', + '4130': '2.6', + '4162EE': '1.7', + '4164EE': '1.8', + '4170HE': '2.1', + '4174HE': '2.3', + '4176HE': '2.4', + '4180': '2.6', + '4184': '2.8', + '6124HE': '1.8', + '6128HE': '2.0', + '6132HE': '2.2', + '6128': '2.0', + '6134': '2.3', + '6136': '2.4', + '6140': '2.6', + '6164HE': '1.7', + '6166HE': '1.8', + '6168': '1.9', + '6172': '2.1', + '6174': '2.2', + '6176': '2.3', + '6176SE': '2.3', + '6180SE': '2.5', + '3250': '2.5', + '3260': '2.7', + '3280': '2.4', + '4226': '2.7', + '4228': '2.8', + '4230': '2.9', + '4234': '3.1', + '4238': '3.3', + '4240': '3.4', + '4256': '1.6', + '4274': '2.5', + '4276': '2.6', + '4280': '2.8', + '4284': '3.0', + '6204': '3.3', + '6212': '2.6', + '6220': '3.0', + '6234': '2.4', + '6238': '2.6', + '6262HE': '1.6', + '6272': '2.1', + '6274': '2.2', + '6276': '2.3', + '6278': '2.4', + '6282SE': '2.6', + '6284SE': '2.7', + '6308': '3.5', + '6320': '2.8', + '6328': '3.2', + '6338P': '2.3', + '6344': '2.6', + '6348': '2.8', + '6366': '1.8', + '6370P': '2.0', + '6376': '2.3', + '6378': '2.4', + '6380': '2.5', + '6386': '2.8', + 'FX|4100': '3.6', + 'FX|4120': '3.9', + 'FX|4130': '3.8', + 'FX|4150': '3.8', + 'FX|4170': '4.2', + 'FX|6100': '3.3', + 'FX|6120': '3.6', + 'FX|6130': '3.6', + 'FX|6200': '3.8', + 'FX|8100': '2.8', + 'FX|8120': '3.1', + 'FX|8140': '3.2', + 'FX|8150': '3.6', + 'FX|8170': '3.9', + 'FX|4300': '3.8', + 'FX|4320': '4.0', + 'FX|4350': '4.2', + 'FX|6300': '3.5', + 'FX|6350': '3.9', + 'FX|8300': '3.3', + 'FX|8310': '3.4', + 'FX|8320': '3.5', + 'FX|8350': '4.0', + 'FX|8370': '4.0', + 'FX|9370': '4.4', + 'FX|9590': '4.7', + 'FX|8320E': '3.2', + 'FX|8370E': '3.3', + + // ZEN Desktop CPUs + '1200': '3.1', + 'Pro 1200': '3.1', + '1300X': '3.5', + 'Pro 1300': '3.5', + '1400': '3.2', + '1500X': '3.5', + 'Pro 1500': '3.5', + '1600': '3.2', + '1600X': '3.6', + 'Pro 1600': '3.2', + '1700': '3.0', + 'Pro 1700': '3.0', + '1700X': '3.4', + 'Pro 1700X': '3.4', + '1800X': '3.6', + '1900X': '3.8', + '1920': '3.2', + '1920X': '3.5', + '1950X': '3.4', + + // ZEN Desktop APUs + '200GE': '3.2', + 'Pro 200GE': '3.2', + '220GE': '3.4', + '240GE': '3.5', + '3000G': '3.5', + '300GE': '3.4', + '3050GE': '3.4', + '2200G': '3.5', + 'Pro 2200G': '3.5', + '2200GE': '3.2', + 'Pro 2200GE': '3.2', + '2400G': '3.6', + 'Pro 2400G': '3.6', + '2400GE': '3.2', + 'Pro 2400GE': '3.2', + + // ZEN Mobile APUs + 'Pro 200U': '2.3', + '300U': '2.4', + '2200U': '2.5', + '3200U': '2.6', + '2300U': '2.0', + 'Pro 2300U': '2.0', + '2500U': '2.0', + 'Pro 2500U': '2.2', + '2600H': '3.2', + '2700U': '2.0', + 'Pro 2700U': '2.2', + '2800H': '3.3', + + // ZEN Server Processors + '7351': '2.4', + '7351P': '2.4', + '7401': '2.0', + '7401P': '2.0', + '7551P': '2.0', + '7551': '2.0', + '7251': '2.1', + '7261': '2.5', + '7281': '2.1', + '7301': '2.2', + '7371': '3.1', + '7451': '2.3', + '7501': '2.0', + '7571': '2.2', + '7601': '2.2', + + // ZEN Embedded Processors + 'V1500B': '2.2', + 'V1780B': '3.35', + 'V1202B': '2.3', + 'V1404I': '2.0', + 'V1605B': '2.0', + 'V1756B': '3.25', + 'V1807B': '3.35', + + '3101': '2.1', + '3151': '2.7', + '3201': '1.5', + '3251': '2.5', + '3255': '2.5', + '3301': '2.0', + '3351': '1.9', + '3401': '1.85', + '3451': '2.15', + + // ZEN+ Desktop + '1200|AF': '3.1', + '2300X': '3.5', + '2500X': '3.6', + '2600': '3.4', + '2600E': '3.1', + '1600|AF': '3.2', + '2600X': '3.6', + '2700': '3.2', + '2700E': '2.8', + 'Pro 2700': '3.2', + '2700X': '3.7', + 'Pro 2700X': '3.6', + '2920X': '3.5', + '2950X': '3.5', + '2970WX': '3.0', + '2990WX': '3.0', + + // ZEN+ Desktop APU + 'Pro 300GE': '3.4', + 'Pro 3125GE': '3.4', + '3150G': '3.5', + 'Pro 3150G': '3.5', + '3150GE': '3.3', + 'Pro 3150GE': '3.3', + '3200G': '3.6', + 'Pro 3200G': '3.6', + '3200GE': '3.3', + 'Pro 3200GE': '3.3', + '3350G': '3.6', + 'Pro 3350G': '3.6', + '3350GE': '3.3', + 'Pro 3350GE': '3.3', + '3400G': '3.7', + 'Pro 3400G': '3.7', + '3400GE': '3.3', + 'Pro 3400GE': '3.3', + + // ZEN+ Mobile + '3300U': '2.1', + 'PRO 3300U': '2.1', + '3450U': '2.1', + '3500U': '2.1', + 'PRO 3500U': '2.1', + '3500C': '2.1', + '3550H': '2.1', + '3580U': '2.1', + '3700U': '2.3', + 'PRO 3700U': '2.3', + '3700C': '2.3', + '3750H': '2.3', + '3780U': '2.3', + + // ZEN2 Desktop CPUS + '3100': '3.6', + '3300X': '3.8', + '3500': '3.6', + '3500X': '3.6', + '3600': '3.6', + 'Pro 3600': '3.6', + '3600X': '3.8', + '3600XT': '3.8', + 'Pro 3700': '3.6', + '3700X': '3.6', + '3800X': '3.9', + '3800XT': '3.9', + '3900': '3.1', + 'Pro 3900': '3.1', + '3900X': '3.8', + '3900XT': '3.8', + '3950X': '3.5', + '3960X': '3.8', + '3970X': '3.7', + '3990X': '2.9', + '3945WX': '4.0', + '3955WX': '3.9', + '3975WX': '3.5', + '3995WX': '2.7', + + // ZEN2 Desktop APUs + '4300GE': '3.5', + 'Pro 4300GE': '3.5', + '4300G': '3.8', + 'Pro 4300G': '3.8', + '4600GE': '3.3', + 'Pro 4650GE': '3.3', + '4600G': '3.7', + 'Pro 4650G': '3.7', + '4700GE': '3.1', + 'Pro 4750GE': '3.1', + '4700G': '3.6', + 'Pro 4750G': '3.6', + '4300U': '2.7', + '4450U': '2.5', + 'Pro 4450U': '2.5', + '4500U': '2.3', + '4600U': '2.1', + 'PRO 4650U': '2.1', + '4680U': '2.1', + '4600HS': '3.0', + '4600H': '3.0', + '4700U': '2.0', + 'PRO 4750U': '1.7', + '4800U': '1.8', + '4800HS': '2.9', + '4800H': '2.9', + '4900HS': '3.0', + '4900H': '3.3', + '5300U': '2.6', + '5500U': '2.1', + '5700U': '1.8', + + // ZEN2 - EPYC + '7232P': '3.1', + '7302P': '3.0', + '7402P': '2.8', + '7502P': '2.5', + '7702P': '2.0', + '7252': '3.1', + '7262': '3.2', + '7272': '2.9', + '7282': '2.8', + '7302': '3.0', + '7352': '2.3', + '7402': '2.8', + '7452': '2.35', + '7502': '2.5', + '7532': '2.4', + '7542': '2.9', + '7552': '2.2', + '7642': '2.3', + '7662': '2.0', + '7702': '2.0', + '7742': '2.25', + '7H12': '2.6', + '7F32': '3.7', + '7F52': '3.5', + '7F72': '3.2', + + // Epyc (Milan) + + '7773X': '2.2', + '7763': '2.45', + '7713': '2.0', + '7713P': '2.0', + '7663': '2.0', + '7643': '2.3', + '7573X': '2.8', + '75F3': '2.95', + '7543': '2.8', + '7543P': '2.8', + '7513': '2.6', + '7473X': '2.8', + '7453': '2.75', + '74F3': '3.2', + '7443': '2.85', + '7443P': '2.85', + '7413': '2.65', + '7373X': '3.05', + '73F3': '3.5', + '7343': '3.2', + '7313': '3.0', + '7313P': '3.0', + '72F3': '3.7', + + // ZEN3 + '5600X': '3.7', + '5800X': '3.8', + '5900X': '3.7', + '5950X': '3.4', + '5945WX': '4.1', + '5955WX': '4.0', + '5965WX': '3.8', + '5975WX': '3.6', + '5995WX': '2.7', + + '7960X': '4.2', + '7970X': '4.0', + '7980X': '3.2', + + '7965WX': '4.2', + '7975WX': '4.0', + '7985WX': '3.2', + '7995WX': '2.5', + + // ZEN4 + '9754': '2.25', + '9754S': '2.25', + '9734': '2.2', + '9684X': '2.55', + '9384X': '3.1', + '9184X': '3.55', + '9654P': '2.4', + '9654': '2.4', + '9634': '2.25', + '9554P': '3.1', + '9554': '3.1', + '9534': '2.45', + '9474F': '3.6', + '9454P': '2.75', + '9454': '2.75', + '9374F': '3.85', + '9354P': '3.25', + '9354': '3.25', + '9334': '2.7', + '9274F': '4.05', + '9254': '2.9', + '9224': '2.5', + '9174F': '4.1', + '9124': '3.0' +}; + +const socketTypes = { + 1: 'Other', + 2: 'Unknown', + 3: 'Daughter Board', + 4: 'ZIF Socket', + 5: 'Replacement/Piggy Back', + 6: 'None', + 7: 'LIF Socket', + 8: 'Slot 1', + 9: 'Slot 2', + 10: '370 Pin Socket', + 11: 'Slot A', + 12: 'Slot M', + 13: '423', + 14: 'A (Socket 462)', + 15: '478', + 16: '754', + 17: '940', + 18: '939', + 19: 'mPGA604', + 20: 'LGA771', + 21: 'LGA775', + 22: 'S1', + 23: 'AM2', + 24: 'F (1207)', + 25: 'LGA1366', + 26: 'G34', + 27: 'AM3', + 28: 'C32', + 29: 'LGA1156', + 30: 'LGA1567', + 31: 'PGA988A', + 32: 'BGA1288', + 33: 'rPGA988B', + 34: 'BGA1023', + 35: 'BGA1224', + 36: 'LGA1155', + 37: 'LGA1356', + 38: 'LGA2011', + 39: 'FS1', + 40: 'FS2', + 41: 'FM1', + 42: 'FM2', + 43: 'LGA2011-3', + 44: 'LGA1356-3', + 45: 'LGA1150', + 46: 'BGA1168', + 47: 'BGA1234', + 48: 'BGA1364', + 49: 'AM4', + 50: 'LGA1151', + 51: 'BGA1356', + 52: 'BGA1440', + 53: 'BGA1515', + 54: 'LGA3647-1', + 55: 'SP3', + 56: 'SP3r2', + 57: 'LGA2066', + 58: 'BGA1392', + 59: 'BGA1510', + 60: 'BGA1528', + 61: 'LGA4189', + 62: 'LGA1200', + 63: 'LGA4677', + 64: 'LGA1700', + 65: 'BGA1744', + 66: 'BGA1781', + 67: 'BGA1211', + 68: 'BGA2422', + 69: 'LGA1211', + 70: 'LGA2422', + 71: 'LGA5773', + 72: 'BGA5773', +}; + +const socketTypesByName = { + 'LGA1150': 'i7-5775C i3-4340 i3-4170 G3250 i3-4160T i3-4160 E3-1231 G3258 G3240 i7-4790S i7-4790K i7-4790 i5-4690K i5-4690 i5-4590T i5-4590S i5-4590 i5-4460 i3-4360 i3-4150 G1820 G3420 G3220 i7-4771 i5-4440 i3-4330 i3-4130T i3-4130 E3-1230 i7-4770S i7-4770K i7-4770 i5-4670K i5-4670 i5-4570T i5-4570S i5-4570 i5-4430', + 'LGA1151': 'i9-9900KS E-2288G E-2224 G5420 i9-9900T i9-9900 i7-9700T i7-9700F i7-9700E i7-9700 i5-9600 i5-9500T i5-9500F i5-9500 i5-9400T i3-9350K i3-9300 i3-9100T i3-9100F i3-9100 G4930 i9-9900KF i7-9700KF i5-9600KF i5-9400F i5-9400 i3-9350KF i9-9900K i7-9700K i5-9600K G5500 G5400 i7-8700T i7-8086K i5-8600 i5-8500T i5-8500 i5-8400T i3-8300 i3-8100T G4900 i7-8700K i7-8700 i5-8600K i5-8400 i3-8350K i3-8100 E3-1270 G4600 G4560 i7-7700T i7-7700K i7-7700 i5-7600K i5-7600 i5-7500T i5-7500 i5-7400 i3-7350K i3-7300 i3-7100T i3-7100 G3930 G3900 G4400 i7-6700T i7-6700K i7-6700 i5-6600K i5-6600 i5-6500T i5-6500 i5-6400T i5-6400 i3-6300 i3-6100T i3-6100 E3-1270 E3-1270 T4500 T4400', + '1155': 'G440 G460 G465 G470 G530T G540T G550T G1610T G1620T G530 G540 G1610 G550 G1620 G555 G1630 i3-2100T i3-2120T i3-3220T i3-3240T i3-3250T i3-2100 i3-2105 i3-2102 i3-3210 i3-3220 i3-2125 i3-2120 i3-3225 i3-2130 i3-3245 i3-3240 i3-3250 i5-3570T i5-2500T i5-2400S i5-2405S i5-2390T i5-3330S i5-2500S i5-3335S i5-2300 i5-3450S i5-3340S i5-3470S i5-3475S i5-3470T i5-2310 i5-3550S i5-2320 i5-3330 i5-3350P i5-3450 i5-2400 i5-3340 i5-3570S i5-2380P i5-2450P i5-3470 i5-2500K i5-3550 i5-2500 i5-3570 i5-3570K i5-2550K i7-3770T i7-2600S i7-3770S i7-2600K i7-2600 i7-3770 i7-3770K i7-2700K G620T G630T G640T G2020T G645T G2100T G2030T G622 G860T G620 G632 G2120T G630 G640 G2010 G840 G2020 G850 G645 G2030 G860 G2120 G870 G2130 G2140 E3-1220L E3-1220L E3-1260L E3-1265L E3-1220 E3-1225 E3-1220 E3-1235 E3-1225 E3-1230 E3-1230 E3-1240 E3-1245 E3-1270 E3-1275 E3-1240 E3-1245 E3-1270 E3-1280 E3-1275 E3-1290 E3-1280 E3-1290' +}; + +function getSocketTypesByName(str) { + let result = ''; + for (const key in socketTypesByName) { + const names = socketTypesByName[key].split(' '); + names.forEach(element => { + if (str.indexOf(element) >= 0) { + result = key; + } + }); + } + return result; +} + +function cpuManufacturer(str) { + let result = str; + str = str.toLowerCase(); + + if (str.indexOf('intel') >= 0) { result = 'Intel'; } + if (str.indexOf('amd') >= 0) { result = 'AMD'; } + if (str.indexOf('qemu') >= 0) { result = 'QEMU'; } + if (str.indexOf('hygon') >= 0) { result = 'Hygon'; } + if (str.indexOf('centaur') >= 0) { result = 'WinChip/Via'; } + if (str.indexOf('vmware') >= 0) { result = 'VMware'; } + if (str.indexOf('Xen') >= 0) { result = 'Xen Hypervisor'; } + if (str.indexOf('tcg') >= 0) { result = 'QEMU'; } + if (str.indexOf('apple') >= 0) { result = 'Apple'; } + + return result; +} + +function cpuBrandManufacturer(res) { + res.brand = res.brand.replace(/\(R\)+/g, '®').replace(/\s+/g, ' ').trim(); + res.brand = res.brand.replace(/\(TM\)+/g, '™').replace(/\s+/g, ' ').trim(); + res.brand = res.brand.replace(/\(C\)+/g, '©').replace(/\s+/g, ' ').trim(); + res.brand = res.brand.replace(/CPU+/g, '').replace(/\s+/g, ' ').trim(); + res.manufacturer = cpuManufacturer(res.brand); + + let parts = res.brand.split(' '); + parts.shift(); + res.brand = parts.join(' '); + return res; +} + +function getAMDSpeed(brand) { + let result = '0'; + for (let key in AMDBaseFrequencies) { + if ({}.hasOwnProperty.call(AMDBaseFrequencies, key)) { + let parts = key.split('|'); + let found = 0; + parts.forEach(item => { + if (brand.indexOf(item) > -1) { + found++; + } + }); + if (found === parts.length) { + result = AMDBaseFrequencies[key]; + } + } + } + return parseFloat(result); +} + +// -------------------------- +// CPU - brand, speed + +function getCpu() { + + return new Promise((resolve) => { + process.nextTick(() => { + const UNKNOWN = 'unknown'; + let result = { + manufacturer: UNKNOWN, + brand: UNKNOWN, + vendor: '', + family: '', + model: '', + stepping: '', + revision: '', + voltage: '', + speed: 0, + speedMin: 0, + speedMax: 0, + governor: '', + cores: util.cores(), + physicalCores: util.cores(), + performanceCores: util.cores(), + efficiencyCores: 0, + processors: 1, + socket: '', + flags: '', + virtualization: false, + cache: {} + }; + cpuFlags().then(flags => { + result.flags = flags; + result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1; + if (_darwin) { + exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) { + let lines = stdout.toString().split('\n'); + const modelline = util.getValue(lines, 'machdep.cpu.brand_string'); + const modellineParts = modelline.split('@'); + result.brand = modellineParts[0].trim(); + const speed = modellineParts[1] ? modellineParts[1].trim() : '0'; + result.speed = parseFloat(speed.replace(/GHz+/g, '')); + let tbFrequency = util.getValue(lines, 'hw.tbfrequency') / 1000000000.0; + tbFrequency = tbFrequency < 0.1 ? tbFrequency * 100 : tbFrequency; + result.speed = result.speed === 0 ? tbFrequency : result.speed; + + _cpu_speed = result.speed; + result = cpuBrandManufacturer(result); + result.speedMin = util.getValue(lines, 'hw.cpufrequency_min') ? (util.getValue(lines, 'hw.cpufrequency_min') / 1000000000.0) : result.speed; + result.speedMax = util.getValue(lines, 'hw.cpufrequency_max') ? (util.getValue(lines, 'hw.cpufrequency_max') / 1000000000.0) : result.speed; + result.vendor = util.getValue(lines, 'machdep.cpu.vendor') || 'Apple'; + result.family = util.getValue(lines, 'machdep.cpu.family') || util.getValue(lines, 'hw.cpufamily'); + result.model = util.getValue(lines, 'machdep.cpu.model'); + result.stepping = util.getValue(lines, 'machdep.cpu.stepping') || util.getValue(lines, 'hw.cpusubfamily'); + result.virtualization = true; + const countProcessors = util.getValue(lines, 'hw.packages'); + const countCores = util.getValue(lines, 'hw.physicalcpu_max'); + const countThreads = util.getValue(lines, 'hw.ncpu'); + if (os.arch() === 'arm64') { + result.socket = 'SOC'; + try { + const clusters = execSync('ioreg -c IOPlatformDevice -d 3 -r | grep cluster-type').toString().split('\n'); + const efficiencyCores = clusters.filter(line => line.indexOf('"E"') >= 0).length; + const performanceCores = clusters.filter(line => line.indexOf('"P"') >= 0).length; + result.efficiencyCores = efficiencyCores; + result.performanceCores = performanceCores; + } catch (e) { + util.noop(); + } + } + if (countProcessors) { + result.processors = parseInt(countProcessors) || 1; + } + if (countCores && countThreads) { + result.cores = parseInt(countThreads) || util.cores(); + result.physicalCores = parseInt(countCores) || util.cores(); + } + cpuCache().then((res) => { + result.cache = res; + resolve(result); + }); + }); + } + if (_linux) { + let modelline = ''; + let lines = []; + if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; } + exec('export LC_ALL=C; lscpu; echo -n "Governor: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null; echo; unset LC_ALL', function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + } + modelline = util.getValue(lines, 'model name') || modelline; + modelline = util.getValue(lines, 'bios model name') || modelline; + const modellineParts = modelline.split('@'); + result.brand = modellineParts[0].trim(); + result.speed = modellineParts[1] ? parseFloat(modellineParts[1].trim()) : 0; + if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) { + result.speed = getAMDSpeed(result.brand); + } + if (result.speed === 0) { + const current = getCpuCurrentSpeedSync(); + if (current.avg !== 0) { result.speed = current.avg; } + } + _cpu_speed = result.speed; + result.speedMin = Math.round(parseFloat(util.getValue(lines, 'cpu min mhz').replace(/,/g, '.')) / 10.0) / 100; + result.speedMax = Math.round(parseFloat(util.getValue(lines, 'cpu max mhz').replace(/,/g, '.')) / 10.0) / 100; + + result = cpuBrandManufacturer(result); + result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id')); + + result.family = util.getValue(lines, 'cpu family'); + result.model = util.getValue(lines, 'model:'); + result.stepping = util.getValue(lines, 'stepping'); + result.revision = util.getValue(lines, 'cpu revision'); + result.cache.l1d = util.getValue(lines, 'l1d cache'); + if (result.cache.l1d) { result.cache.l1d = parseInt(result.cache.l1d) * (result.cache.l1d.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1d.indexOf('K') !== -1 ? 1024 : 1)); } + result.cache.l1i = util.getValue(lines, 'l1i cache'); + if (result.cache.l1i) { result.cache.l1i = parseInt(result.cache.l1i) * (result.cache.l1i.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l1i.indexOf('K') !== -1 ? 1024 : 1)); } + result.cache.l2 = util.getValue(lines, 'l2 cache'); + if (result.cache.l2) { result.cache.l2 = parseInt(result.cache.l2) * (result.cache.l2.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l2.indexOf('K') !== -1 ? 1024 : 1)); } + result.cache.l3 = util.getValue(lines, 'l3 cache'); + if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); } + + const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1'; + const processors = util.getValue(lines, 'socket(s)') || '1'; + const threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores) + const processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1) + const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900) + result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt; + result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores; + result.efficiencyCores = threadsPerCoreInt > 1 ? result.cores - (threadsPerCoreInt * result.performanceCores) : 0; + result.processors = processorsInt; + result.governor = util.getValue(lines, 'governor') || ''; + + // Test Raspberry + if (result.vendor === 'ARM') { + const linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n'); + const rPIRevision = util.decodePiCpuinfo(linesRpi); + if (rPIRevision.model.toLowerCase().indexOf('raspberry') >= 0) { + result.family = result.manufacturer; + result.manufacturer = rPIRevision.manufacturer; + result.brand = rPIRevision.processor; + result.revision = rPIRevision.revisionCode; + result.socket = 'SOC'; + } + } + + // socket type + let lines2 = []; + exec('export LC_ALL=C; dmidecode –t 4 2>/dev/null | grep "Upgrade: Socket"; unset LC_ALL', function (error2, stdout2) { + lines2 = stdout2.toString().split('\n'); + if (lines2 && lines2.length) { + result.socket = util.getValue(lines2, 'Upgrade').replace('Socket', '').trim() || result.socket; + } + resolve(result); + }); + }); + } + if (_freebsd || _openbsd || _netbsd) { + let modelline = ''; + let lines = []; + if (os.cpus()[0] && os.cpus()[0].model) { modelline = os.cpus()[0].model; } + exec('export LC_ALL=C; dmidecode -t 4; dmidecode -t 7 unset LC_ALL', function (error, stdout) { + let cache = []; + if (!error) { + const data = stdout.toString().split('# dmidecode'); + const processor = data.length > 1 ? data[1] : ''; + cache = data.length > 2 ? data[2].split('Cache Information') : []; + + lines = processor.split('\n'); + } + result.brand = modelline.split('@')[0].trim(); + result.speed = modelline.split('@')[1] ? parseFloat(modelline.split('@')[1].trim()) : 0; + if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) { + result.speed = getAMDSpeed(result.brand); + } + if (result.speed === 0) { + const current = getCpuCurrentSpeedSync(); + if (current.avg !== 0) { result.speed = current.avg; } + } + _cpu_speed = result.speed; + result.speedMin = result.speed; + result.speedMax = Math.round(parseFloat(util.getValue(lines, 'max speed').replace(/Mhz/g, '')) / 10.0) / 100; + + result = cpuBrandManufacturer(result); + result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer')); + let sig = util.getValue(lines, 'signature'); + sig = sig.split(','); + for (let i = 0; i < sig.length; i++) { + sig[i] = sig[i].trim(); + } + result.family = util.getValue(sig, 'Family', ' ', true); + result.model = util.getValue(sig, 'Model', ' ', true); + result.stepping = util.getValue(sig, 'Stepping', ' ', true); + result.revision = ''; + const voltage = parseFloat(util.getValue(lines, 'voltage')); + result.voltage = isNaN(voltage) ? '' : voltage.toFixed(2); + for (let i = 0; i < cache.length; i++) { + lines = cache[i].split('\n'); + let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-'); + cacheType = cacheType.length ? cacheType[0] : ''; + const sizeParts = util.getValue(lines, 'Installed Size').split(' '); + let size = parseInt(sizeParts[0], 10); + const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb'; + size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1))); + if (cacheType) { + if (cacheType === 'l1') { + result.cache[cacheType + 'd'] = size / 2; + result.cache[cacheType + 'i'] = size / 2; + } else { + result.cache[cacheType] = size; + } + } + } + // socket type + result.socket = util.getValue(lines, 'Upgrade').replace('Socket', '').trim(); + // # threads / # cores + const threadCount = util.getValue(lines, 'thread count').trim(); + const coreCount = util.getValue(lines, 'core count').trim(); + if (coreCount && threadCount) { + result.cores = parseInt(threadCount, 10); + result.physicalCores = parseInt(coreCount, 10); + } + resolve(result); + }); + } + if (_sunos) { + resolve(result); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl')); + workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl')); + workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); + + Promise.all( + workload + ).then((data) => { + let lines = data[0].split('\r\n'); + let name = util.getValue(lines, 'name', ':') || ''; + if (name.indexOf('@') >= 0) { + result.brand = name.split('@')[0].trim(); + result.speed = name.split('@')[1] ? parseFloat(name.split('@')[1].trim()) : 0; + _cpu_speed = result.speed; + } else { + result.brand = name.trim(); + result.speed = 0; + } + result = cpuBrandManufacturer(result); + result.revision = util.getValue(lines, 'revision', ':'); + result.vendor = util.getValue(lines, 'manufacturer', ':'); + result.speedMax = Math.round(parseFloat(util.getValue(lines, 'maxclockspeed', ':').replace(/,/g, '.')) / 10.0) / 100; + if (result.speed === 0 && (result.brand.indexOf('AMD') > -1 || result.brand.toLowerCase().indexOf('ryzen') > -1)) { + result.speed = getAMDSpeed(result.brand); + } + if (result.speed === 0) { + result.speed = result.speedMax; + } + result.speedMin = result.speed; + + let description = util.getValue(lines, 'description', ':').split(' '); + for (let i = 0; i < description.length; i++) { + if (description[i].toLowerCase().startsWith('family') && (i + 1) < description.length && description[i + 1]) { + result.family = description[i + 1]; + } + if (description[i].toLowerCase().startsWith('model') && (i + 1) < description.length && description[i + 1]) { + result.model = description[i + 1]; + } + if (description[i].toLowerCase().startsWith('stepping') && (i + 1) < description.length && description[i + 1]) { + result.stepping = description[i + 1]; + } + } + // socket type + const socketId = util.getValue(lines, 'UpgradeMethod', ':'); + if (socketTypes[socketId]) { + result.socket = socketTypes[socketId]; + } + const socketByName = getSocketTypesByName(name); + if (socketByName) { + result.socket = socketByName; + } + // # threads / # cores + const countProcessors = util.countLines(lines, 'Caption'); + const countThreads = util.getValue(lines, 'NumberOfLogicalProcessors', ':'); + const countCores = util.getValue(lines, 'NumberOfCores', ':'); + if (countProcessors) { + result.processors = parseInt(countProcessors) || 1; + } + if (countCores && countThreads) { + result.cores = parseInt(countThreads) || util.cores(); + result.physicalCores = parseInt(countCores) || util.cores(); + } + if (countProcessors > 1) { + result.cores = result.cores * countProcessors; + result.physicalCores = result.physicalCores * countProcessors; + } + result.cache = parseWinCache(data[0], data[1]); + const hyperv = data[2] ? data[2].toString().toLowerCase() : ''; + result.virtualization = hyperv.indexOf('true') !== -1; + + resolve(result); + }); + } catch (e) { + resolve(result); + } + } + }); + }); + }); +} + +// -------------------------- +// CPU - Processor Data + +function cpu(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + getCpu().then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.cpu = cpu; + +// -------------------------- +// CPU - current speed - in GHz + +function getCpuCurrentSpeedSync() { + + let cpus = os.cpus(); + let minFreq = 999999999; + let maxFreq = 0; + let avgFreq = 0; + let cores = []; + + if (cpus && cpus.length) { + for (let i in cpus) { + if ({}.hasOwnProperty.call(cpus, i)) { + let freq = cpus[i].speed > 100 ? (cpus[i].speed + 1) / 1000 : cpus[i].speed / 10; + avgFreq = avgFreq + freq; + if (freq > maxFreq) { maxFreq = freq; } + if (freq < minFreq) { minFreq = freq; } + cores.push(parseFloat(freq.toFixed(2))); + } + } + avgFreq = avgFreq / cpus.length; + return { + min: parseFloat(minFreq.toFixed(2)), + max: parseFloat(maxFreq.toFixed(2)), + avg: parseFloat((avgFreq).toFixed(2)), + cores: cores + }; + } else { + return { + min: 0, + max: 0, + avg: 0, + cores: cores + }; + } +} + +function cpuCurrentSpeed(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = getCpuCurrentSpeedSync(); + if (result.avg === 0 && _cpu_speed !== 0) { + const currCpuSpeed = parseFloat(_cpu_speed); + result = { + min: currCpuSpeed, + max: currCpuSpeed, + avg: currCpuSpeed, + cores: [] + }; + } + if (callback) { callback(result); } + resolve(result); + }); + }); +} + +exports.cpuCurrentSpeed = cpuCurrentSpeed; + +// -------------------------- +// CPU - temperature +// if sensors are installed + +function cpuTemperature(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + main: null, + cores: [], + max: null, + socket: [], + chipset: null + }; + if (_linux) { + // CPU Chipset, Socket + try { + const cmd = 'cat /sys/class/thermal/thermal_zone*/type 2>/dev/null; echo "-----"; cat /sys/class/thermal/thermal_zone*/temp 2>/dev/null;'; + const parts = execSync(cmd, util.execOptsLinux).toString().split('-----\n'); + if (parts.length === 2) { + const lines = parts[0].split('\n'); + const lines2 = parts[1].split('\n'); + for (let i = 0; i < lines.length; i++) { + const line = lines[i].trim(); + if (line.startsWith('acpi') && lines2[i]) { + result.socket.push(Math.round(parseInt(lines2[i], 10) / 100) / 10); + } + if (line.startsWith('pch') && lines2[i]) { + result.chipset = Math.round(parseInt(lines2[i], 10) / 100) / 10; + } + } + } + } catch (e) { + util.noop(); + } + + const cmd = 'for mon in /sys/class/hwmon/hwmon*; do for label in "$mon"/temp*_label; do if [ -f $label ]; then value=${label%_*}_input; echo $(cat "$label")___$(cat "$value"); fi; done; done;'; + try { + exec(cmd, function (error, stdout) { + stdout = stdout.toString(); + const tdiePos = stdout.toLowerCase().indexOf('tdie'); + if (tdiePos !== -1) { + stdout = stdout.substring(tdiePos); + } + let lines = stdout.split('\n'); + let tctl = 0; + lines.forEach(line => { + const parts = line.split('___'); + const label = parts[0]; + const value = parts.length > 1 && parts[1] ? parts[1] : '0'; + if (value && label && label.toLowerCase() === 'tctl') { + tctl = result.main = Math.round(parseInt(value, 10) / 100) / 10; + } + if (value && (label === undefined || (label && label.toLowerCase().startsWith('core')))) { + result.cores.push(Math.round(parseInt(value, 10) / 100) / 10); + } else if (value && label && result.main === null && (label.toLowerCase().indexOf('package') >= 0 || label.toLowerCase().indexOf('physical') >= 0 || label.toLowerCase() === 'tccd1')) { + result.main = Math.round(parseInt(value, 10) / 100) / 10; + } + }); + if (tctl && result.main === null) { + result.main = tctl; + } + + if (result.cores.length > 0) { + if (result.main === null) { + result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length); + } + let maxtmp = Math.max.apply(Math, result.cores); + result.max = (maxtmp > result.main) ? maxtmp : result.main; + } + if (result.main !== null) { + if (result.max === null) { + result.max = result.main; + } + if (callback) { callback(result); } + resolve(result); + return; + } + exec('sensors', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + let tdieTemp = null; + let newSectionStarts = true; + let section = ''; + lines.forEach(function (line) { + // determine section + if (line.trim() === '') { + newSectionStarts = true; + } else if (newSectionStarts) { + if (line.trim().toLowerCase().startsWith('acpi')) { section = 'acpi'; } + if (line.trim().toLowerCase().startsWith('pch')) { section = 'pch'; } + if (line.trim().toLowerCase().startsWith('core')) { section = 'core'; } + newSectionStarts = false; + } + let regex = /[+-]([^°]*)/g; + let temps = line.match(regex); + let firstPart = line.split(':')[0].toUpperCase(); + if (section === 'acpi') { + // socket temp + if (firstPart.indexOf('TEMP') !== -1) { + result.socket.push(parseFloat(temps)); + } + } else if (section === 'pch') { + // chipset temp + if (firstPart.indexOf('TEMP') !== -1 && !result.chipset) { + result.chipset = parseFloat(temps); + } + } + // cpu temp + if (firstPart.indexOf('PHYSICAL') !== -1 || firstPart.indexOf('PACKAGE') !== -1) { + result.main = parseFloat(temps); + } + if (firstPart.indexOf('CORE ') !== -1) { + result.cores.push(parseFloat(temps)); + } + if (firstPart.indexOf('TDIE') !== -1 && tdieTemp === null) { + tdieTemp = parseFloat(temps); + } + }); + if (result.cores.length > 0) { + result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length); + let maxtmp = Math.max.apply(Math, result.cores); + result.max = (maxtmp > result.main) ? maxtmp : result.main; + } else { + if (result.main === null && tdieTemp !== null) { + result.main = tdieTemp; + result.max = tdieTemp; + } + } + if (result.main !== null || result.max !== null) { + if (callback) { callback(result); } + resolve(result); + return; + } + } + fs.stat('/sys/class/thermal/thermal_zone0/temp', function (err) { + if (err === null) { + fs.readFile('/sys/class/thermal/thermal_zone0/temp', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0) { + result.main = parseFloat(lines[0]) / 1000.0; + result.max = result.main; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + exec('/opt/vc/bin/vcgencmd measure_temp', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0 && lines[0].indexOf('=')) { + result.main = parseFloat(lines[0].split('=')[1]); + result.max = result.main; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + }); + }); + }); + } catch (er) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('sysctl dev.cpu | grep temp', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + let sum = 0; + lines.forEach(function (line) { + const parts = line.split(':'); + if (parts.length > 1) { + const temp = parseFloat(parts[1].replace(',', '.')); + if (temp > result.max) { result.max = temp; } + sum = sum + temp; + result.cores.push(temp); + } + }); + if (result.cores.length) { + result.main = Math.round(sum / result.cores.length * 100) / 100; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + let osxTemp = null; + try { + osxTemp = __nccwpck_require__(7317); + } catch (er) { + osxTemp = null; + } + if (osxTemp) { + result = osxTemp.cpuTemperature(); + // round to 2 digits + if (result.main) { + result.main = Math.round(result.main * 100) / 100; + } + if (result.max) { + result.max = Math.round(result.max * 100) / 100; + } + if (result.cores && result.cores.length) { + for (let i = 0; i < result.cores.length; i++) { + result.cores[i] = Math.round(result.cores[i] * 100) / 100; + } + } + } + + if (callback) { callback(result); } + resolve(result); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => { + if (!error) { + let sum = 0; + let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); + lines.forEach(function (line) { + let value = (parseInt(line, 10) - 2732) / 10; + if (!isNaN(value)) { + sum = sum + value; + if (value > result.max) { result.max = value; } + result.cores.push(value); + } + }); + if (result.cores.length) { + result.main = sum / result.cores.length; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.cpuTemperature = cpuTemperature; + +// -------------------------- +// CPU Flags + +function cpuFlags(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = ''; + if (_windows) { + try { + exec('reg query "HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0" /v FeatureSet', util.execOptsWin, function (error, stdout) { + if (!error) { + let flag_hex = stdout.split('0x').pop().trim(); + let flag_bin_unpadded = parseInt(flag_hex, 16).toString(2); + let flag_bin = '0'.repeat(32 - flag_bin_unpadded.length) + flag_bin_unpadded; + // empty flags are the reserved fields in the CPUID feature bit list + // as found on wikipedia: + // https://en.wikipedia.org/wiki/CPUID + let all_flags = [ + 'fpu', 'vme', 'de', 'pse', 'tsc', 'msr', 'pae', 'mce', 'cx8', 'apic', + '', 'sep', 'mtrr', 'pge', 'mca', 'cmov', 'pat', 'pse-36', 'psn', 'clfsh', + '', 'ds', 'acpi', 'mmx', 'fxsr', 'sse', 'sse2', 'ss', 'htt', 'tm', 'ia64', 'pbe' + ]; + for (let f = 0; f < all_flags.length; f++) { + if (flag_bin[f] === '1' && all_flags[f] !== '') { + result += ' ' + all_flags[f]; + } + } + result = result.trim().toLowerCase(); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_linux) { + try { + + exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + if (line.split(':')[0].toUpperCase().indexOf('FLAGS') !== -1) { + result = line.split(':')[1].trim().toLowerCase(); + } + }); + } + if (!result) { + fs.readFile('/proc/cpuinfo', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result = util.getValue(lines, 'features', ':', true).toLowerCase(); + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t 4 2>/dev/null; unset LC_ALL', function (error, stdout) { + let flags = []; + if (!error) { + let parts = stdout.toString().split('\tFlags:'); + const lines = parts.length > 1 ? parts[1].split('\tVersion:')[0].split('\n') : []; + lines.forEach(function (line) { + let flag = (line.indexOf('(') ? line.split('(')[0].toLowerCase() : '').trim().replace(/\t/g, ''); + if (flag) { + flags.push(flag); + } + }); + } + result = flags.join(' ').trim().toLowerCase(); + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + exec('sysctl machdep.cpu.features', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0 && lines[0].indexOf('machdep.cpu.features:') !== -1) { + result = lines[0].split(':')[1].trim().toLowerCase(); + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} + +exports.cpuFlags = cpuFlags; + +// -------------------------- +// CPU Cache + +function cpuCache(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + l1d: null, + l1i: null, + l2: null, + l3: null, + }; + if (_linux) { + try { + exec('export LC_ALL=C; lscpu; unset LC_ALL', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + let parts = line.split(':'); + if (parts[0].toUpperCase().indexOf('L1D CACHE') !== -1) { + result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + if (parts[0].toUpperCase().indexOf('L1I CACHE') !== -1) { + result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + if (parts[0].toUpperCase().indexOf('L2 CACHE') !== -1) { + result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + if (parts[0].toUpperCase().indexOf('L3 CACHE') !== -1) { + result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('M') !== -1 ? 1024 * 1024 : (parts[1].indexOf('K') !== -1 ? 1024 : 1)); + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t 7 2>/dev/null; unset LC_ALL', function (error, stdout) { + let cache = []; + if (!error) { + const data = stdout.toString(); + cache = data.split('Cache Information'); + cache.shift(); + } + for (let i = 0; i < cache.length; i++) { + const lines = cache[i].split('\n'); + let cacheType = util.getValue(lines, 'Socket Designation').toLowerCase().replace(' ', '-').split('-'); + cacheType = cacheType.length ? cacheType[0] : ''; + const sizeParts = util.getValue(lines, 'Installed Size').split(' '); + let size = parseInt(sizeParts[0], 10); + const unit = sizeParts.length > 1 ? sizeParts[1] : 'kb'; + size = size * (unit === 'kb' ? 1024 : (unit === 'mb' ? 1024 * 1024 : (unit === 'gb' ? 1024 * 1024 * 1024 : 1))); + if (cacheType) { + if (cacheType === 'l1') { + result.cache[cacheType + 'd'] = size / 2; + result.cache[cacheType + 'i'] = size / 2; + } else { + result.cache[cacheType] = size; + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + exec('sysctl hw.l1icachesize hw.l1dcachesize hw.l2cachesize hw.l3cachesize', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + let parts = line.split(':'); + if (parts[0].toLowerCase().indexOf('hw.l1icachesize') !== -1) { + result.l1d = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + if (parts[0].toLowerCase().indexOf('hw.l1dcachesize') !== -1) { + result.l1i = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + if (parts[0].toLowerCase().indexOf('hw.l2cachesize') !== -1) { + result.l2 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + if (parts[0].toLowerCase().indexOf('hw.l3cachesize') !== -1) { + result.l3 = parseInt(parts[1].trim()) * (parts[1].indexOf('K') !== -1 ? 1024 : 1); + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl')); + workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl')); + + Promise.all( + workload + ).then((data) => { + result = parseWinCache(data[0], data[1]); + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +function parseWinCache(linesProc, linesCache) { + let result = { + l1d: null, + l1i: null, + l2: null, + l3: null, + }; + + // Win32_processor + let lines = linesProc.split('\r\n'); + result.l1d = 0; + result.l1i = 0; + result.l2 = util.getValue(lines, 'l2cachesize', ':'); + result.l3 = util.getValue(lines, 'l3cachesize', ':'); + if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; } else { result.l2 = 0; } + if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; } else { result.l3 = 0; } + + // Win32_CacheMemory + const parts = linesCache.split(/\n\s*\n/); + let l1i = 0; + let l1d = 0; + let l2 = 0; + parts.forEach(function (part) { + const lines = part.split('\r\n'); + const cacheType = util.getValue(lines, 'CacheType'); + const level = util.getValue(lines, 'Level'); + const installedSize = util.getValue(lines, 'InstalledSize'); + // L1 Instructions + if (level === '3' && cacheType === '3') { + result.l1i = result.l1i + parseInt(installedSize, 10) * 1024; + } + // L1 Data + if (level === '3' && cacheType === '4') { + result.l1d = result.l1d + parseInt(installedSize, 10) * 1024; + } + // L1 all + if (level === '3' && cacheType === '5') { + l1i = parseInt(installedSize, 10) / 2; + l1d = parseInt(installedSize, 10) / 2; + } + // L2 + if (level === '4' && cacheType === '5') { + l2 = l2 + parseInt(installedSize, 10) * 1024; + } + }); + if (!result.l1i && !result.l1d) { + result.l1i = l1i; + result.l1d = l1d; + } + if (l2) { + result.l2 = l2; + } + return result; +} + +exports.cpuCache = cpuCache; + +// -------------------------- +// CPU - current load - in % + +function getLoad() { + + return new Promise((resolve) => { + process.nextTick(() => { + let loads = os.loadavg().map(function (x) { return x / util.cores(); }); + let avgLoad = parseFloat((Math.max.apply(Math, loads)).toFixed(2)); + let result = {}; + + let now = Date.now() - _current_cpu.ms; + if (now >= 200) { + _current_cpu.ms = Date.now(); + const cpus = os.cpus().map(function (cpu) { + cpu.times.steal = 0; + cpu.times.guest = 0; + return cpu; + }); + let totalUser = 0; + let totalSystem = 0; + let totalNice = 0; + let totalIrq = 0; + let totalIdle = 0; + let totalSteal = 0; + let totalGuest = 0; + let cores = []; + _corecount = (cpus && cpus.length) ? cpus.length : 0; + + // linux: try to get other cpu stats + if (_linux) { + try { + const lines = execSync('cat /proc/stat 2>/dev/null | grep cpu', util.execOptsLinux).toString().split('\n'); + if (lines.length > 1) { + lines.shift(); + if (lines.length === cpus.length) { + for (let i = 0; i < lines.length; i++) { + let parts = lines[i].split(' '); + if (parts.length >= 10) { + const steal = parseFloat(parts[8]) || 0; + const guest = parseFloat(parts[9]) || 0; + cpus[i].times.steal = steal; + cpus[i].times.guest = guest; + } + } + } + } + } catch (e) { + util.noop(); + } + } + + for (let i = 0; i < _corecount; i++) { + const cpu = cpus[i].times; + totalUser += cpu.user; + totalSystem += cpu.sys; + totalNice += cpu.nice; + totalIdle += cpu.idle; + totalIrq += cpu.irq; + totalSteal += cpu.steal || 0; + totalGuest += cpu.guest || 0; + let tmpTick = (_cpus && _cpus[i] && _cpus[i].totalTick ? _cpus[i].totalTick : 0); + let tmpLoad = (_cpus && _cpus[i] && _cpus[i].totalLoad ? _cpus[i].totalLoad : 0); + let tmpUser = (_cpus && _cpus[i] && _cpus[i].user ? _cpus[i].user : 0); + let tmpSystem = (_cpus && _cpus[i] && _cpus[i].sys ? _cpus[i].sys : 0); + let tmpNice = (_cpus && _cpus[i] && _cpus[i].nice ? _cpus[i].nice : 0); + let tmpIdle = (_cpus && _cpus[i] && _cpus[i].idle ? _cpus[i].idle : 0); + let tmpIrq = (_cpus && _cpus[i] && _cpus[i].irq ? _cpus[i].irq : 0); + let tmpSteal = (_cpus && _cpus[i] && _cpus[i].steal ? _cpus[i].steal : 0); + let tmpGuest = (_cpus && _cpus[i] && _cpus[i].guest ? _cpus[i].guest : 0); + _cpus[i] = cpu; + _cpus[i].totalTick = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest + _cpus[i].idle; + _cpus[i].totalLoad = _cpus[i].user + _cpus[i].sys + _cpus[i].nice + _cpus[i].irq + _cpus[i].steal + _cpus[i].guest; + _cpus[i].currentTick = _cpus[i].totalTick - tmpTick; + _cpus[i].load = (_cpus[i].totalLoad - tmpLoad); + _cpus[i].loadUser = (_cpus[i].user - tmpUser); + _cpus[i].loadSystem = (_cpus[i].sys - tmpSystem); + _cpus[i].loadNice = (_cpus[i].nice - tmpNice); + _cpus[i].loadIdle = (_cpus[i].idle - tmpIdle); + _cpus[i].loadIrq = (_cpus[i].irq - tmpIrq); + _cpus[i].loadSteal = (_cpus[i].steal - tmpSteal); + _cpus[i].loadGuest = (_cpus[i].guest - tmpGuest); + cores[i] = {}; + cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100; + cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100; + cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100; + cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100; + cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100; + cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100; + cores[i].loadSteal = _cpus[i].loadSteal / _cpus[i].currentTick * 100; + cores[i].loadGuest = _cpus[i].loadGuest / _cpus[i].currentTick * 100; + cores[i].rawLoad = _cpus[i].load; + cores[i].rawLoadUser = _cpus[i].loadUser; + cores[i].rawLoadSystem = _cpus[i].loadSystem; + cores[i].rawLoadNice = _cpus[i].loadNice; + cores[i].rawLoadIdle = _cpus[i].loadIdle; + cores[i].rawLoadIrq = _cpus[i].loadIrq; + cores[i].rawLoadSteal = _cpus[i].loadSteal; + cores[i].rawLoadGuest = _cpus[i].loadGuest; + } + let totalTick = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest + totalIdle; + let totalLoad = totalUser + totalSystem + totalNice + totalIrq + totalSteal + totalGuest; + let currentTick = totalTick - _current_cpu.tick; + result = { + avgLoad: avgLoad, + currentLoad: (totalLoad - _current_cpu.load) / currentTick * 100, + currentLoadUser: (totalUser - _current_cpu.user) / currentTick * 100, + currentLoadSystem: (totalSystem - _current_cpu.system) / currentTick * 100, + currentLoadNice: (totalNice - _current_cpu.nice) / currentTick * 100, + currentLoadIdle: (totalIdle - _current_cpu.idle) / currentTick * 100, + currentLoadIrq: (totalIrq - _current_cpu.irq) / currentTick * 100, + currentLoadSteal: (totalSteal - _current_cpu.steal) / currentTick * 100, + currentLoadGuest: (totalGuest - _current_cpu.guest) / currentTick * 100, + rawCurrentLoad: (totalLoad - _current_cpu.load), + rawCurrentLoadUser: (totalUser - _current_cpu.user), + rawCurrentLoadSystem: (totalSystem - _current_cpu.system), + rawCurrentLoadNice: (totalNice - _current_cpu.nice), + rawCurrentLoadIdle: (totalIdle - _current_cpu.idle), + rawCurrentLoadIrq: (totalIrq - _current_cpu.irq), + rawCurrentLoadSteal: (totalSteal - _current_cpu.steal), + rawCurrentLoadGuest: (totalGuest - _current_cpu.guest), + cpus: cores + }; + _current_cpu = { + user: totalUser, + nice: totalNice, + system: totalSystem, + idle: totalIdle, + irq: totalIrq, + steal: totalSteal, + guest: totalGuest, + tick: totalTick, + load: totalLoad, + ms: _current_cpu.ms, + currentLoad: result.currentLoad, + currentLoadUser: result.currentLoadUser, + currentLoadSystem: result.currentLoadSystem, + currentLoadNice: result.currentLoadNice, + currentLoadIdle: result.currentLoadIdle, + currentLoadIrq: result.currentLoadIrq, + currentLoadSteal: result.currentLoadSteal, + currentLoadGuest: result.currentLoadGuest, + rawCurrentLoad: result.rawCurrentLoad, + rawCurrentLoadUser: result.rawCurrentLoadUser, + rawCurrentLoadSystem: result.rawCurrentLoadSystem, + rawCurrentLoadNice: result.rawCurrentLoadNice, + rawCurrentLoadIdle: result.rawCurrentLoadIdle, + rawCurrentLoadIrq: result.rawCurrentLoadIrq, + rawCurrentLoadSteal: result.rawCurrentLoadSteal, + rawCurrentLoadGuest: result.rawCurrentLoadGuest, + }; + } else { + let cores = []; + for (let i = 0; i < _corecount; i++) { + cores[i] = {}; + cores[i].load = _cpus[i].load / _cpus[i].currentTick * 100; + cores[i].loadUser = _cpus[i].loadUser / _cpus[i].currentTick * 100; + cores[i].loadSystem = _cpus[i].loadSystem / _cpus[i].currentTick * 100; + cores[i].loadNice = _cpus[i].loadNice / _cpus[i].currentTick * 100; + cores[i].loadIdle = _cpus[i].loadIdle / _cpus[i].currentTick * 100; + cores[i].loadIrq = _cpus[i].loadIrq / _cpus[i].currentTick * 100; + cores[i].rawLoad = _cpus[i].load; + cores[i].rawLoadUser = _cpus[i].loadUser; + cores[i].rawLoadSystem = _cpus[i].loadSystem; + cores[i].rawLoadNice = _cpus[i].loadNice; + cores[i].rawLoadIdle = _cpus[i].loadIdle; + cores[i].rawLoadIrq = _cpus[i].loadIrq; + cores[i].rawLoadSteal = _cpus[i].loadSteal; + cores[i].rawLoadGuest = _cpus[i].loadGuest; + } + result = { + avgLoad: avgLoad, + currentLoad: _current_cpu.currentLoad, + currentLoadUser: _current_cpu.currentLoadUser, + currentLoadSystem: _current_cpu.currentLoadSystem, + currentLoadNice: _current_cpu.currentLoadNice, + currentLoadIdle: _current_cpu.currentLoadIdle, + currentLoadIrq: _current_cpu.currentLoadIrq, + currentLoadSteal: _current_cpu.currentLoadSteal, + currentLoadGuest: _current_cpu.currentLoadGuest, + rawCurrentLoad: _current_cpu.rawCurrentLoad, + rawCurrentLoadUser: _current_cpu.rawCurrentLoadUser, + rawCurrentLoadSystem: _current_cpu.rawCurrentLoadSystem, + rawCurrentLoadNice: _current_cpu.rawCurrentLoadNice, + rawCurrentLoadIdle: _current_cpu.rawCurrentLoadIdle, + rawCurrentLoadIrq: _current_cpu.rawCurrentLoadIrq, + rawCurrentLoadSteal: _current_cpu.rawCurrentLoadSteal, + rawCurrentLoadGuest: _current_cpu.rawCurrentLoadGuest, + cpus: cores + }; + } + resolve(result); + }); + }); +} + +function currentLoad(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + getLoad().then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.currentLoad = currentLoad; + +// -------------------------- +// PS - full load +// since bootup + +function getFullLoad() { + + return new Promise((resolve) => { + process.nextTick(() => { + + const cpus = os.cpus(); + let totalUser = 0; + let totalSystem = 0; + let totalNice = 0; + let totalIrq = 0; + let totalIdle = 0; + + let result = 0; + + if (cpus && cpus.length) { + for (let i = 0, len = cpus.length; i < len; i++) { + const cpu = cpus[i].times; + totalUser += cpu.user; + totalSystem += cpu.sys; + totalNice += cpu.nice; + totalIrq += cpu.irq; + totalIdle += cpu.idle; + } + let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser; + result = (totalTicks - totalIdle) / totalTicks * 100.0; + + } + resolve(result); + }); + }); +} + +function fullLoad(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + getFullLoad().then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.fullLoad = fullLoad; + + +/***/ }), + +/***/ 8600: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// docker.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 13. Docker +// ---------------------------------------------------------------------------------- + +const util = __nccwpck_require__(9872); +const DockerSocket = __nccwpck_require__(2966); + +let _platform = process.platform; +const _windows = (_platform === 'win32'); + +let _docker_container_stats = {}; +let _docker_socket; +let _docker_last_read = 0; + + +// -------------------------- +// get containers (parameter all: get also inactive/exited containers) + +function dockerInfo(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + const result = {}; + + _docker_socket.getInfo((data) => { + result.id = data.ID; + result.containers = data.Containers; + result.containersRunning = data.ContainersRunning; + result.containersPaused = data.ContainersPaused; + result.containersStopped = data.ContainersStopped; + result.images = data.Images; + result.driver = data.Driver; + result.memoryLimit = data.MemoryLimit; + result.swapLimit = data.SwapLimit; + result.kernelMemory = data.KernelMemory; + result.cpuCfsPeriod = data.CpuCfsPeriod; + result.cpuCfsQuota = data.CpuCfsQuota; + result.cpuShares = data.CPUShares; + result.cpuSet = data.CPUSet; + result.ipv4Forwarding = data.IPv4Forwarding; + result.bridgeNfIptables = data.BridgeNfIptables; + result.bridgeNfIp6tables = data.BridgeNfIp6tables; + result.debug = data.Debug; + result.nfd = data.NFd; + result.oomKillDisable = data.OomKillDisable; + result.ngoroutines = data.NGoroutines; + result.systemTime = data.SystemTime; + result.loggingDriver = data.LoggingDriver; + result.cgroupDriver = data.CgroupDriver; + result.nEventsListener = data.NEventsListener; + result.kernelVersion = data.KernelVersion; + result.operatingSystem = data.OperatingSystem; + result.osType = data.OSType; + result.architecture = data.Architecture; + result.ncpu = data.NCPU; + result.memTotal = data.MemTotal; + result.dockerRootDir = data.DockerRootDir; + result.httpProxy = data.HttpProxy; + result.httpsProxy = data.HttpsProxy; + result.noProxy = data.NoProxy; + result.name = data.Name; + result.labels = data.Labels; + result.experimentalBuild = data.ExperimentalBuild; + result.serverVersion = data.ServerVersion; + result.clusterStore = data.ClusterStore; + result.clusterAdvertise = data.ClusterAdvertise; + result.defaultRuntime = data.DefaultRuntime; + result.liveRestoreEnabled = data.LiveRestoreEnabled; + result.isolation = data.Isolation; + result.initBinary = data.InitBinary; + result.productLicense = data.ProductLicense; + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +exports.dockerInfo = dockerInfo; + +function dockerImages(all, callback) { + + // fallback - if only callback is given + if (util.isFunction(all) && !callback) { + callback = all; + all = false; + } + if (typeof all === 'string' && all === 'true') { + all = true; + } + if (typeof all !== 'boolean' && all !== undefined) { + all = false; + } + + all = all || false; + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + const workload = []; + + _docker_socket.listImages(all, data => { + let dockerImages = {}; + try { + dockerImages = data; + if (dockerImages && Object.prototype.toString.call(dockerImages) === '[object Array]' && dockerImages.length > 0) { + + dockerImages.forEach(function (element) { + + if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) { + element.Name = element.Names[0].replace(/^\/|\/$/g, ''); + } + workload.push(dockerImagesInspect(element.Id.trim(), element)); + }); + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +// -------------------------- +// container inspect (for one container) + +function dockerImagesInspect(imageID, payload) { + return new Promise((resolve) => { + process.nextTick(() => { + imageID = imageID || ''; + if (typeof imageID !== 'string') { + return resolve(); + } + const imageIDSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(imageID, true)).trim(); + if (imageIDSanitized) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.inspectImage(imageIDSanitized.trim(), data => { + try { + resolve({ + id: payload.Id, + container: data.Container, + comment: data.Comment, + os: data.Os, + architecture: data.Architecture, + parent: data.Parent, + dockerVersion: data.DockerVersion, + size: data.Size, + sharedSize: payload.SharedSize, + virtualSize: data.VirtualSize, + author: data.Author, + created: data.Created ? Math.round(new Date(data.Created).getTime() / 1000) : 0, + containerConfig: data.ContainerConfig ? data.ContainerConfig : {}, + graphDriver: data.GraphDriver ? data.GraphDriver : {}, + repoDigests: data.RepoDigests ? data.RepoDigests : {}, + repoTags: data.RepoTags ? data.RepoTags : {}, + config: data.Config ? data.Config : {}, + rootFS: data.RootFS ? data.RootFS : {}, + }); + } catch (err) { + resolve(); + } + }); + } else { + resolve(); + } + }); + }); +} + +exports.dockerImages = dockerImages; + +function dockerContainers(all, callback) { + + function inContainers(containers, id) { + let filtered = containers.filter(obj => { + /** + * @namespace + * @property {string} Id + */ + return (obj.Id && (obj.Id === id)); + }); + return (filtered.length > 0); + } + + // fallback - if only callback is given + if (util.isFunction(all) && !callback) { + callback = all; + all = false; + } + if (typeof all === 'string' && all === 'true') { + all = true; + } + if (typeof all !== 'boolean' && all !== undefined) { + all = false; + } + + all = all || false; + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + const workload = []; + + _docker_socket.listContainers(all, data => { + let docker_containers = {}; + try { + docker_containers = data; + if (docker_containers && Object.prototype.toString.call(docker_containers) === '[object Array]' && docker_containers.length > 0) { + // GC in _docker_container_stats + for (let key in _docker_container_stats) { + if ({}.hasOwnProperty.call(_docker_container_stats, key)) { + if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; } + } + } + + docker_containers.forEach(function (element) { + + if (element.Names && Object.prototype.toString.call(element.Names) === '[object Array]' && element.Names.length > 0) { + element.Name = element.Names[0].replace(/^\/|\/$/g, ''); + } + workload.push(dockerContainerInspect(element.Id.trim(), element)); + }); + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + // GC in _docker_container_stats + for (let key in _docker_container_stats) { + if ({}.hasOwnProperty.call(_docker_container_stats, key)) { + if (!inContainers(docker_containers, key)) { delete _docker_container_stats[key]; } + } + } + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +// -------------------------- +// container inspect (for one container) + +function dockerContainerInspect(containerID, payload) { + return new Promise((resolve) => { + process.nextTick(() => { + containerID = containerID || ''; + if (typeof containerID !== 'string') { + return resolve(); + } + const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim(); + if (containerIdSanitized) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.getInspect(containerIdSanitized.trim(), data => { + try { + resolve({ + id: payload.Id, + name: payload.Name, + image: payload.Image, + imageID: payload.ImageID, + command: payload.Command, + created: payload.Created, + started: data.State && data.State.StartedAt ? Math.round(new Date(data.State.StartedAt).getTime() / 1000) : 0, + finished: data.State && data.State.FinishedAt && !data.State.FinishedAt.startsWith('0001-01-01') ? Math.round(new Date(data.State.FinishedAt).getTime() / 1000) : 0, + createdAt: data.Created ? data.Created : '', + startedAt: data.State && data.State.StartedAt ? data.State.StartedAt : '', + finishedAt: data.State && data.State.FinishedAt && !data.State.FinishedAt.startsWith('0001-01-01') ? data.State.FinishedAt : '', + state: payload.State, + restartCount: data.RestartCount || 0, + platform: data.Platform || '', + driver: data.Driver || '', + ports: payload.Ports, + mounts: payload.Mounts, + // hostconfig: payload.HostConfig, + // network: payload.NetworkSettings + }); + } catch (err) { + resolve(); + } + }); + } else { + resolve(); + } + }); + }); +} + +exports.dockerContainers = dockerContainers; + +// -------------------------- +// helper functions for calculation of docker stats + +function docker_calcCPUPercent(cpu_stats, precpu_stats) { + /** + * @namespace + * @property {object} cpu_usage + * @property {number} cpu_usage.total_usage + * @property {number} system_cpu_usage + * @property {object} cpu_usage + * @property {Array} cpu_usage.percpu_usage + */ + + if (!_windows) { + let cpuPercent = 0.0; + // calculate the change for the cpu usage of the container in between readings + let cpuDelta = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage; + // calculate the change for the entire system between readings + let systemDelta = cpu_stats.system_cpu_usage - precpu_stats.system_cpu_usage; + + if (systemDelta > 0.0 && cpuDelta > 0.0) { + // calculate the change for the cpu usage of the container in between readings + if (precpu_stats.online_cpus) { + cpuPercent = (cpuDelta / systemDelta) * precpu_stats.online_cpus * 100.0; + } + else { + cpuPercent = (cpuDelta / systemDelta) * cpu_stats.cpu_usage.percpu_usage.length * 100.0; + } + } + + return cpuPercent; + } else { + let nanoSecNow = util.nanoSeconds(); + let cpuPercent = 0.0; + if (_docker_last_read > 0) { + let possIntervals = (nanoSecNow - _docker_last_read); // / 100 * os.cpus().length; + let intervalsUsed = cpu_stats.cpu_usage.total_usage - precpu_stats.cpu_usage.total_usage; + if (possIntervals > 0) { + cpuPercent = 100.0 * intervalsUsed / possIntervals; + } + } + _docker_last_read = nanoSecNow; + return cpuPercent; + } +} + +function docker_calcNetworkIO(networks) { + let rx; + let wx; + for (let key in networks) { + // skip loop if the property is from prototype + if (!{}.hasOwnProperty.call(networks, key)) { continue; } + + /** + * @namespace + * @property {number} rx_bytes + * @property {number} tx_bytes + */ + let obj = networks[key]; + rx = +obj.rx_bytes; + wx = +obj.tx_bytes; + } + return { + rx, + wx + }; +} + +function docker_calcBlockIO(blkio_stats) { + let result = { + r: 0, + w: 0 + }; + + /** + * @namespace + * @property {Array} io_service_bytes_recursive + */ + if (blkio_stats && blkio_stats.io_service_bytes_recursive && Object.prototype.toString.call(blkio_stats.io_service_bytes_recursive) === '[object Array]' && blkio_stats.io_service_bytes_recursive.length > 0) { + blkio_stats.io_service_bytes_recursive.forEach(function (element) { + /** + * @namespace + * @property {string} op + * @property {number} value + */ + + if (element.op && element.op.toLowerCase() === 'read' && element.value) { + result.r += element.value; + } + if (element.op && element.op.toLowerCase() === 'write' && element.value) { + result.w += element.value; + } + }); + } + return result; +} + +function dockerContainerStats(containerIDs, callback) { + + let containerArray = []; + return new Promise((resolve) => { + process.nextTick(() => { + + // fallback - if only callback is given + if (util.isFunction(containerIDs) && !callback) { + callback = containerIDs; + containerArray = ['*']; + } else { + containerIDs = containerIDs || '*'; + if (typeof containerIDs !== 'string') { + if (callback) { callback([]); } + return resolve([]); + } + let containerIDsSanitized = ''; + containerIDsSanitized.__proto__.toLowerCase = util.stringToLower; + containerIDsSanitized.__proto__.replace = util.stringReplace; + containerIDsSanitized.__proto__.trim = util.stringTrim; + + containerIDsSanitized = containerIDs; + containerIDsSanitized = containerIDsSanitized.trim(); + if (containerIDsSanitized !== '*') { + containerIDsSanitized = ''; + const s = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerIDs, true)).trim(); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + s[i].__proto__.toLowerCase = util.stringToLower; + const sl = s[i].toLowerCase(); + if (sl && sl[0] && !sl[1]) { + containerIDsSanitized = containerIDsSanitized + sl[0]; + } + } + } + } + + containerIDsSanitized = containerIDsSanitized.trim().toLowerCase().replace(/,+/g, '|'); + containerArray = containerIDsSanitized.split('|'); + } + + const result = []; + + const workload = []; + if (containerArray.length && containerArray[0].trim() === '*') { + containerArray = []; + dockerContainers().then(allContainers => { + for (let container of allContainers) { + containerArray.push(container.id.substring(0, 12)); + } + if (containerArray.length) { + dockerContainerStats(containerArray.join(',')).then(result => { + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + for (let containerID of containerArray) { + workload.push(dockerContainerStatsSingle(containerID.trim())); + } + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +// -------------------------- +// container stats (for one container) + +function dockerContainerStatsSingle(containerID) { + containerID = containerID || ''; + let result = { + id: containerID, + memUsage: 0, + memLimit: 0, + memPercent: 0, + cpuPercent: 0, + pids: 0, + netIO: { + rx: 0, + wx: 0 + }, + blockIO: { + r: 0, + w: 0 + }, + restartCount: 0, + cpuStats: {}, + precpuStats: {}, + memoryStats: {}, + networks: {}, + }; + return new Promise((resolve) => { + process.nextTick(() => { + if (containerID) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.getInspect(containerID, dataInspect => { + try { + _docker_socket.getStats(containerID, data => { + try { + let stats = data; + if (!stats.message) { + if (data.id) { result.id = data.id; } + result.memUsage = (stats.memory_stats && stats.memory_stats.usage ? stats.memory_stats.usage : 0); + result.memLimit = (stats.memory_stats && stats.memory_stats.limit ? stats.memory_stats.limit : 0); + result.memPercent = (stats.memory_stats && stats.memory_stats.usage && stats.memory_stats.limit ? stats.memory_stats.usage / stats.memory_stats.limit * 100.0 : 0); + result.cpuPercent = (stats.cpu_stats && stats.precpu_stats ? docker_calcCPUPercent(stats.cpu_stats, stats.precpu_stats) : 0); + result.pids = (stats.pids_stats && stats.pids_stats.current ? stats.pids_stats.current : 0); + result.restartCount = (dataInspect.RestartCount ? dataInspect.RestartCount : 0); + if (stats.networks) { result.netIO = docker_calcNetworkIO(stats.networks); } + if (stats.blkio_stats) { result.blockIO = docker_calcBlockIO(stats.blkio_stats); } + result.cpuStats = (stats.cpu_stats ? stats.cpu_stats : {}); + result.precpuStats = (stats.precpu_stats ? stats.precpu_stats : {}); + result.memoryStats = (stats.memory_stats ? stats.memory_stats : {}); + result.networks = (stats.networks ? stats.networks : {}); + } + } catch (err) { + util.noop(); + } + // } + resolve(result); + }); + } catch (err) { + util.noop(); + } + }); + } else { + resolve(result); + } + }); + }); +} + +exports.dockerContainerStats = dockerContainerStats; + +// -------------------------- +// container processes (for one container) + +function dockerContainerProcesses(containerID, callback) { + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + containerID = containerID || ''; + if (typeof containerID !== 'string') { + return resolve(result); + } + const containerIdSanitized = (util.isPrototypePolluted() ? '' : util.sanitizeShellString(containerID, true)).trim(); + + if (containerIdSanitized) { + + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + + _docker_socket.getProcesses(containerIdSanitized, data => { + /** + * @namespace + * @property {Array} Titles + * @property {Array} Processes + **/ + try { + if (data && data.Titles && data.Processes) { + let titles = data.Titles.map(function (value) { + return value.toUpperCase(); + }); + let pos_pid = titles.indexOf('PID'); + let pos_ppid = titles.indexOf('PPID'); + let pos_pgid = titles.indexOf('PGID'); + let pos_vsz = titles.indexOf('VSZ'); + let pos_time = titles.indexOf('TIME'); + let pos_elapsed = titles.indexOf('ELAPSED'); + let pos_ni = titles.indexOf('NI'); + let pos_ruser = titles.indexOf('RUSER'); + let pos_user = titles.indexOf('USER'); + let pos_rgroup = titles.indexOf('RGROUP'); + let pos_group = titles.indexOf('GROUP'); + let pos_stat = titles.indexOf('STAT'); + let pos_rss = titles.indexOf('RSS'); + let pos_command = titles.indexOf('COMMAND'); + + data.Processes.forEach(process => { + result.push({ + pidHost: (pos_pid >= 0 ? process[pos_pid] : ''), + ppid: (pos_ppid >= 0 ? process[pos_ppid] : ''), + pgid: (pos_pgid >= 0 ? process[pos_pgid] : ''), + user: (pos_user >= 0 ? process[pos_user] : ''), + ruser: (pos_ruser >= 0 ? process[pos_ruser] : ''), + group: (pos_group >= 0 ? process[pos_group] : ''), + rgroup: (pos_rgroup >= 0 ? process[pos_rgroup] : ''), + stat: (pos_stat >= 0 ? process[pos_stat] : ''), + time: (pos_time >= 0 ? process[pos_time] : ''), + elapsed: (pos_elapsed >= 0 ? process[pos_elapsed] : ''), + nice: (pos_ni >= 0 ? process[pos_ni] : ''), + rss: (pos_rss >= 0 ? process[pos_rss] : ''), + vsz: (pos_vsz >= 0 ? process[pos_vsz] : ''), + command: (pos_command >= 0 ? process[pos_command] : '') + }); + }); + } + } catch (err) { + util.noop(); + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} + +exports.dockerContainerProcesses = dockerContainerProcesses; + +function dockerVolumes(callback) { + + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + if (!_docker_socket) { + _docker_socket = new DockerSocket(); + } + _docker_socket.listVolumes((data) => { + let dockerVolumes = {}; + try { + dockerVolumes = data; + if (dockerVolumes && dockerVolumes.Volumes && Object.prototype.toString.call(dockerVolumes.Volumes) === '[object Array]' && dockerVolumes.Volumes.length > 0) { + + dockerVolumes.Volumes.forEach(function (element) { + + result.push({ + name: element.Name, + driver: element.Driver, + labels: element.Labels, + mountpoint: element.Mountpoint, + options: element.Options, + scope: element.Scope, + created: element.CreatedAt ? Math.round(new Date(element.CreatedAt).getTime() / 1000) : 0, + }); + }); + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +exports.dockerVolumes = dockerVolumes; + +function dockerAll(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + dockerContainers(true).then(result => { + if (result && Object.prototype.toString.call(result) === '[object Array]' && result.length > 0) { + let l = result.length; + result.forEach(function (element) { + dockerContainerStats(element.id).then((res) => { + // include stats in array + element.memUsage = res[0].memUsage; + element.memLimit = res[0].memLimit; + element.memPercent = res[0].memPercent; + element.cpuPercent = res[0].cpuPercent; + element.pids = res[0].pids; + element.netIO = res[0].netIO; + element.blockIO = res[0].blockIO; + element.cpuStats = res[0].cpuStats; + element.precpuStats = res[0].precpuStats; + element.memoryStats = res[0].memoryStats; + element.networks = res[0].networks; + + dockerContainerProcesses(element.id).then(processes => { + element.processes = processes; + + l -= 1; + if (l === 0) { + if (callback) { callback(result); } + resolve(result); + } + }); + // all done?? + }); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + }); + }); +} + +exports.dockerAll = dockerAll; + + +/***/ }), + +/***/ 2966: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// dockerSockets.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 13. DockerSockets +// ---------------------------------------------------------------------------------- + +const net = __nccwpck_require__(1808); +const isWin = (__nccwpck_require__(2037).type)() === 'Windows_NT'; +const socketPath = isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock'; + +class DockerSocket { + + getInfo(callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/info HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } + + listImages(all, callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/images/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } + + inspectImage(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/images/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + listContainers(all, callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/json' + (all ? '?all=1' : '') + ' HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } + + getStats(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/' + id + '/stats?stream=0 HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + getInspect(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/' + id + '/json?stream=0 HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + getProcesses(id, callback) { + id = id || ''; + if (id) { + try { + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/containers/' + id + '/top?ps_args=-opid,ppid,pgid,vsz,time,etime,nice,ruser,user,rgroup,group,stat,rss,args HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } else { + callback({}); + } + } + + listVolumes(callback) { + try { + + let socket = net.createConnection({ path: socketPath }); + let alldata = ''; + let data; + + socket.on('connect', () => { + socket.write('GET http:/volumes HTTP/1.0\r\n\r\n'); + }); + + socket.on('data', data => { + alldata = alldata + data.toString(); + }); + + socket.on('error', () => { + socket = false; + callback({}); + }); + + socket.on('end', () => { + let startbody = alldata.indexOf('\r\n\r\n'); + alldata = alldata.substring(startbody + 4); + socket = false; + try { + data = JSON.parse(alldata); + callback(data); + } catch (err) { + callback({}); + } + }); + } catch (err) { + callback({}); + } + } +} + +module.exports = DockerSocket; + + +/***/ }), + +/***/ 9468: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// filesystem.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 8. File System +// ---------------------------------------------------------------------------------- + +const util = __nccwpck_require__(9872); +const fs = __nccwpck_require__(7147); + +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const execPromiseSave = util.promisifySave((__nccwpck_require__(2081).exec)); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _fs_speed = {}; +let _disk_io = {}; + +// -------------------------- +// FS - mounted file systems + +function fsSize(drive, callback) { + + if (util.isFunction(drive)) { + callback = drive; + drive = ''; + } + + let macOsDisks = []; + let osMounts = []; + + function getmacOsFsType(fs) { + if (!fs.startsWith('/')) { return 'NFS'; } + const parts = fs.split('/'); + const fsShort = parts[parts.length - 1]; + const macOsDisksSingle = macOsDisks.filter(item => item.indexOf(fsShort) >= 0); + if (macOsDisksSingle.length === 1 && macOsDisksSingle[0].indexOf('APFS') >= 0) { return 'APFS'; } + return 'HFS'; + } + + function isLinuxTmpFs(fs) { + const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type', 'appimaged']; + let result = false; + linuxTmpFileSystems.forEach(linuxFs => { + if (fs.toLowerCase().indexOf(linuxFs) >= 0) { result = true; } + }); + return result; + } + + function filterLines(stdout) { + let lines = stdout.toString().split('\n'); + lines.shift(); + if (stdout.toString().toLowerCase().indexOf('filesystem')) { + let removeLines = 0; + for (let i = 0; i < lines.length; i++) { + if (lines[i] && lines[i].toLowerCase().startsWith('filesystem')) { + removeLines = i; + } + } + for (let i = 0; i < removeLines; i++) { + lines.shift(); + } + } + return lines; + } + + function parseDf(lines) { + let data = []; + lines.forEach(function (line) { + if (line !== '') { + line = line.replace(/ +/g, ' ').split(' '); + if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1) || !_darwin && !isLinuxTmpFs(line[1]))) { + const fs = line[0]; + const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0])); + const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024; + const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024; + const available = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[4] : line[3])) * 1024; + const use = parseFloat((100.0 * (used / (used + available))).toFixed(2)); + let rw = osMounts && Object.keys(osMounts).length > 0 ? osMounts[fs] || false : null; + line.splice(0, (_linux || _freebsd || _openbsd || _netbsd) ? 6 : 5); + const mount = line.join(' '); + if (!data.find(el => (el.fs === fs && el.type === fsType))) { + data.push({ + fs, + type: fsType, + size, + used, + available, + use, + mount, + rw + }); + } + } + } + }); + return data; + } + + return new Promise((resolve) => { + process.nextTick(() => { + let data = []; + if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { + let cmd = ''; + macOsDisks = []; + osMounts = {}; + if (_darwin) { + cmd = 'df -kP'; + try { + macOsDisks = execSync('diskutil list').toString().split('\n').filter(line => { + return !line.startsWith('/') && line.indexOf(':') > 0; + }); + execSync('mount').toString().split('\n').filter(line => { + return line.startsWith('/'); + }).forEach((line) => { + osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1; + }); + } catch (e) { + util.noop(); + } + } + if (_linux) { + try { + cmd = 'export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL'; + execSync('cat /proc/mounts 2>/dev/null', util.execOptsLinux).toString().split('\n').filter(line => { + return line.startsWith('/'); + }).forEach((line) => { + osMounts[line.split(' ')[0]] = osMounts[line.split(' ')[0]] || false; + if (line.toLowerCase().indexOf('/snap/') === -1) { + osMounts[line.split(' ')[0]] = ((line.toLowerCase().indexOf('rw,') >= 0 || line.toLowerCase().indexOf(' rw ') >= 0)); + } + }); + } catch (e) { + util.noop(); + } + } + if (_freebsd || _openbsd || _netbsd) { + try { + cmd = 'df -lkPT'; + execSync('mount').toString().split('\n').forEach((line) => { + osMounts[line.split(' ')[0]] = line.toLowerCase().indexOf('read-only') === -1; + }); + } catch (e) { + util.noop(); + } + } + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + let lines = filterLines(stdout); + data = parseDf(lines); + if (drive) { + data = data.filter(item => { + return item.fs.toLowerCase().indexOf(drive.toLowerCase()) >= 0 || item.mount.toLowerCase().indexOf(drive.toLowerCase()) >= 0; + }); + } + if ((!error || data.length) && stdout.toString().trim() !== '') { + if (callback) { + callback(data); + } + resolve(data); + } else { + exec('df -kPT', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = filterLines(stdout); + data = parseDf(lines); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } + }); + } + if (_sunos) { + if (callback) { callback(data); } + resolve(data); + } + if (_windows) { + try { + const cmd = `Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${drive ? '| where -property Caption -eq ' + drive : ''} | fl`; + util.powerShell(cmd).then((stdout, error) => { + if (!error) { + let devices = stdout.toString().split(/\n\s*\n/); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const size = util.toInt(util.getValue(lines, 'size', ':')); + const free = util.toInt(util.getValue(lines, 'freespace', ':')); + const caption = util.getValue(lines, 'caption', ':'); + const rwValue = util.getValue(lines, 'access', ':'); + const rw = rwValue ? (util.toInt(rwValue) !== 1) : null; + if (size) { + data.push({ + fs: caption, + type: util.getValue(lines, 'filesystem', ':'), + size, + used: size - free, + available: free, + use: parseFloat(((100.0 * (size - free)) / size).toFixed(2)), + mount: caption, + rw + }); + } + }); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } catch (e) { + if (callback) { callback(data); } + resolve(data); + } + } + }); + }); +} + +exports.fsSize = fsSize; + +// -------------------------- +// FS - open files count + +function fsOpenFiles(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + const result = { + max: null, + allocated: null, + available: null + }; + if (_freebsd || _openbsd || _netbsd || _darwin) { + let cmd = 'sysctl -i kern.maxfiles kern.num_files kern.open_files'; + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.max = parseInt(util.getValue(lines, 'kern.maxfiles', ':'), 10); + result.allocated = parseInt(util.getValue(lines, 'kern.num_files', ':'), 10) || parseInt(util.getValue(lines, 'kern.open_files', ':'), 10); + result.available = result.max - result.allocated; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_linux) { + fs.readFile('/proc/sys/fs/file-nr', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines[0]) { + const parts = lines[0].replace(/\s+/g, ' ').split(' '); + if (parts.length === 3) { + result.allocated = parseInt(parts[0], 10); + result.available = parseInt(parts[1], 10); + result.max = parseInt(parts[2], 10); + if (!result.available) { result.available = result.max - result.allocated; } + } + } + if (callback) { + callback(result); + } + resolve(result); + } else { + fs.readFile('/proc/sys/fs/file-max', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines[0]) { + result.max = parseInt(lines[0], 10); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + }); + } + if (_sunos) { + if (callback) { callback(null); } + resolve(null); + } + if (_windows) { + if (callback) { callback(null); } + resolve(null); + } + }); + }); +} + +exports.fsOpenFiles = fsOpenFiles; + +// -------------------------- +// disks + +function parseBytes(s) { + return parseInt(s.substr(s.indexOf(' (') + 2, s.indexOf(' Bytes)') - 10)); +} + +function parseDevices(lines) { + let devices = []; + let i = 0; + lines.forEach(line => { + if (line.length > 0) { + if (line[0] === '*') { + i++; + } else { + let parts = line.split(':'); + if (parts.length > 1) { + if (!devices[i]) { + devices[i] = { + name: '', + identifier: '', + type: 'disk', + fsType: '', + mount: '', + size: 0, + physical: 'HDD', + uuid: '', + label: '', + model: '', + serial: '', + removable: false, + protocol: '', + group: '', + device: '' + }; + } + parts[0] = parts[0].trim().toUpperCase().replace(/ +/g, ''); + parts[1] = parts[1].trim(); + if ('DEVICEIDENTIFIER' === parts[0]) { devices[i].identifier = parts[1]; } + if ('DEVICENODE' === parts[0]) { devices[i].name = parts[1]; } + if ('VOLUMENAME' === parts[0]) { + if (parts[1].indexOf('Not applicable') === -1) { devices[i].label = parts[1]; } + } + if ('PROTOCOL' === parts[0]) { devices[i].protocol = parts[1]; } + if ('DISKSIZE' === parts[0]) { devices[i].size = parseBytes(parts[1]); } + if ('FILESYSTEMPERSONALITY' === parts[0]) { devices[i].fsType = parts[1]; } + if ('MOUNTPOINT' === parts[0]) { devices[i].mount = parts[1]; } + if ('VOLUMEUUID' === parts[0]) { devices[i].uuid = parts[1]; } + if ('READ-ONLYMEDIA' === parts[0] && parts[1] === 'Yes') { devices[i].physical = 'CD/DVD'; } + if ('SOLIDSTATE' === parts[0] && parts[1] === 'Yes') { devices[i].physical = 'SSD'; } + if ('VIRTUAL' === parts[0]) { devices[i].type = 'virtual'; } + if ('REMOVABLEMEDIA' === parts[0]) { devices[i].removable = (parts[1] === 'Removable'); } + if ('PARTITIONTYPE' === parts[0]) { devices[i].type = 'part'; } + if ('DEVICE/MEDIANAME' === parts[0]) { devices[i].model = parts[1]; } + } + } + } + }); + return devices; +} + +function parseBlk(lines) { + let data = []; + + lines.filter(line => line !== '').forEach((line) => { + try { + line = decodeURIComponent(line.replace(/\\x/g, '%')); + line = line.replace(/\\/g, '\\\\'); + let disk = JSON.parse(line); + data.push({ + 'name': disk.name, + 'type': disk.type, + 'fsType': disk.fsType, + 'mount': disk.mountpoint, + 'size': parseInt(disk.size), + 'physical': (disk.type === 'disk' ? (disk.rota === '0' ? 'SSD' : 'HDD') : (disk.type === 'rom' ? 'CD/DVD' : '')), + 'uuid': disk.uuid, + 'label': disk.label, + 'model': (disk.model || '').trim(), + 'serial': disk.serial, + 'removable': disk.rm === '1', + 'protocol': disk.tran, + 'group': disk.group || '', + }); + } catch (e) { + util.noop(); + } + }); + data = util.unique(data); + data = util.sortByKey(data, ['type', 'name']); + return data; +} + +function decodeMdabmData(lines) { + const raid = util.getValue(lines, 'md_level', '='); + const label = util.getValue(lines, 'md_name', '='); // <- get label info + const uuid = util.getValue(lines, 'md_uuid', '='); // <- get uuid info + const members = []; + lines.forEach(line => { + if (line.toLowerCase().startsWith('md_device_dev') && line.toLowerCase().indexOf('/dev/') > 0) { + members.push(line.split('/dev/')[1]); + } + }); + return { + raid, + label, + uuid, + members + }; +} + +function raidMatchLinux(data) { + // for all block devices of type "raid%" + let result = data; + try { + data.forEach(element => { + if (element.type.startsWith('raid')) { + const lines = execSync(`mdadm --export --detail /dev/${element.name}`, util.execOptsLinux).toString().split('\n'); + const mdData = decodeMdabmData(lines); + + element.label = mdData.label; // <- assign label info + element.uuid = mdData.uuid; // <- assign uuid info + + if (mdData.members && mdData.members.length && mdData.raid === element.type) { + result = result.map(blockdevice => { + if (blockdevice.fsType === 'linux_raid_member' && mdData.members.indexOf(blockdevice.name) >= 0) { + blockdevice.group = element.name; + } + return blockdevice; + }); + } + } + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getDevicesLinux(data) { + const result = []; + data.forEach(element => { + if (element.type.startsWith('disk')) { + result.push(element.name); + } + }); + return result; +} + +function matchDevicesLinux(data) { + let result = data; + try { + const devices = getDevicesLinux(data); + result = result.map(blockdevice => { + if (blockdevice.type.startsWith('part') || blockdevice.type.startsWith('disk')) { + devices.forEach(element => { + if (blockdevice.name.startsWith(element)) { + blockdevice.device = '/dev/' + element; + } + }); + } + return blockdevice; + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getDevicesMac(data) { + const result = []; + data.forEach(element => { + if (element.type.startsWith('disk')) { + result.push({ name: element.name, model: element.model, device: element.name }); + } + if (element.type.startsWith('virtual')) { + let device = ''; + result.forEach(e => { + if (e.model === element.model) { + device = e.device; + } + }); + if (device) { + result.push({ name: element.name, model: element.model, device }); + } + } + }); + return result; +} + +function matchDevicesMac(data) { + let result = data; + try { + const devices = getDevicesMac(data); + result = result.map(blockdevice => { + if (blockdevice.type.startsWith('part') || blockdevice.type.startsWith('disk') || blockdevice.type.startsWith('virtual')) { + devices.forEach(element => { + if (blockdevice.name.startsWith(element.name)) { + blockdevice.device = element.device; + } + }); + } + return blockdevice; + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getDevicesWin(diskDrives) { + const result = []; + diskDrives.forEach(element => { + const lines = element.split('\r\n'); + const device = util.getValue(lines, 'DeviceID', ':'); + let partitions = element.split('@{DeviceID='); + if (partitions.length > 1) { + partitions = partitions.slice(1); + partitions.forEach(partition => { + result.push({ name: partition.split(';')[0].toUpperCase(), device }); + }); + } + }); + return result; +} + +function matchDevicesWin(data, diskDrives) { + const devices = getDevicesWin(diskDrives); + data.map(element => { + const filteresDevices = devices.filter((e) => { return e.name === element.name.toUpperCase(); }); + if (filteresDevices.length > 0) { + element.device = filteresDevices[0].device; + } + return element; + }); + return data; +} + +function blkStdoutToObject(stdout) { + return stdout.toString() + .replace(/NAME=/g, '{"name":') + .replace(/FSTYPE=/g, ',"fsType":') + .replace(/TYPE=/g, ',"type":') + .replace(/SIZE=/g, ',"size":') + .replace(/MOUNTPOINT=/g, ',"mountpoint":') + .replace(/UUID=/g, ',"uuid":') + .replace(/ROTA=/g, ',"rota":') + .replace(/RO=/g, ',"ro":') + .replace(/RM=/g, ',"rm":') + .replace(/TRAN=/g, ',"tran":') + .replace(/SERIAL=/g, ',"serial":') + .replace(/LABEL=/g, ',"label":') + .replace(/MODEL=/g, ',"model":') + .replace(/OWNER=/g, ',"owner":') + .replace(/GROUP=/g, ',"group":') + .replace(/\n/g, '}\n'); +} + +function blockDevices(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let data = []; + if (_linux) { + // see https://wiki.ubuntuusers.de/lsblk/ + // exec("lsblk -bo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,TRAN,SERIAL,LABEL,MODEL,OWNER,GROUP,MODE,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,SCHED,RQ-SIZE,RA,WSAME", function (error, stdout) { + exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = blkStdoutToObject(stdout).split('\n'); + data = parseBlk(lines); + data = raidMatchLinux(data); + data = matchDevicesLinux(data); + if (callback) { + callback(data); + } + resolve(data); + } else { + exec('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = blkStdoutToObject(stdout).split('\n'); + data = parseBlk(lines); + data = raidMatchLinux(data); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } + }); + } + if (_darwin) { + exec('diskutil info -all', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + // parse lines into temp array of devices + data = parseDevices(lines); + data = matchDevicesMac(data); + } + if (callback) { + callback(data); + } + resolve(data); + }); + } + if (_sunos) { + if (callback) { callback(data); } + resolve(data); + } + if (_windows) { + let drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM']; + try { + // util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => { + // util.powerShell('Get-CimInstance Win32_logicaldisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => { + const workload = []; + workload.push(util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl')); + workload.push(util.powerShell('Get-WmiObject -Class Win32_diskdrive | Select-Object -Property PNPDeviceId,DeviceID, Model, Size, @{L=\'Partitions\'; E={$_.GetRelated(\'Win32_DiskPartition\').GetRelated(\'Win32_LogicalDisk\') | Select-Object -Property DeviceID, VolumeName, Size, FreeSpace}} | fl')); + util.promiseAll( + workload + ).then((res) => { + let logicalDisks = res.results[0].toString().split(/\n\s*\n/); + let diskDrives = res.results[1].toString().split(/\n\s*\n/); + logicalDisks.forEach(function (device) { + let lines = device.split('\r\n'); + let drivetype = util.getValue(lines, 'drivetype', ':'); + if (drivetype) { + data.push({ + name: util.getValue(lines, 'name', ':'), + identifier: util.getValue(lines, 'caption', ':'), + type: 'disk', + fsType: util.getValue(lines, 'filesystem', ':').toLowerCase(), + mount: util.getValue(lines, 'caption', ':'), + size: util.getValue(lines, 'size', ':'), + physical: (drivetype >= 0 && drivetype <= 6) ? drivetypes[drivetype] : drivetypes[0], + uuid: util.getValue(lines, 'volumeserialnumber', ':'), + label: util.getValue(lines, 'volumename', ':'), + model: '', + serial: util.getValue(lines, 'volumeserialnumber', ':'), + removable: drivetype === '2', + protocol: '', + group: '', + device: '' + }); + } + }); + // match devices + data = matchDevicesWin(data, diskDrives); + if (callback) { + callback(data); + } + resolve(data); + }); + } catch (e) { + if (callback) { callback(data); } + resolve(data); + } + } + if (_freebsd || _openbsd || _netbsd) { + // will follow + if (callback) { callback(null); } + resolve(null); + } + + }); + }); +} + +exports.blockDevices = blockDevices; + +// -------------------------- +// FS - speed + +function calcFsSpeed(rx, wx) { + let result = { + rx: 0, + wx: 0, + tx: 0, + rx_sec: null, + wx_sec: null, + tx_sec: null, + ms: 0 + }; + + if (_fs_speed && _fs_speed.ms) { + result.rx = rx; + result.wx = wx; + result.tx = result.rx + result.wx; + result.ms = Date.now() - _fs_speed.ms; + result.rx_sec = (result.rx - _fs_speed.bytes_read) / (result.ms / 1000); + result.wx_sec = (result.wx - _fs_speed.bytes_write) / (result.ms / 1000); + result.tx_sec = result.rx_sec + result.wx_sec; + _fs_speed.rx_sec = result.rx_sec; + _fs_speed.wx_sec = result.wx_sec; + _fs_speed.tx_sec = result.tx_sec; + _fs_speed.bytes_read = result.rx; + _fs_speed.bytes_write = result.wx; + _fs_speed.bytes_overall = result.rx + result.wx; + _fs_speed.ms = Date.now(); + _fs_speed.last_ms = result.ms; + } else { + result.rx = rx; + result.wx = wx; + result.tx = result.rx + result.wx; + _fs_speed.rx_sec = null; + _fs_speed.wx_sec = null; + _fs_speed.tx_sec = null; + _fs_speed.bytes_read = result.rx; + _fs_speed.bytes_write = result.wx; + _fs_speed.bytes_overall = result.rx + result.wx; + _fs_speed.ms = Date.now(); + _fs_speed.last_ms = 0; + } + return result; +} + +function fsStats(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + if (_windows || _freebsd || _openbsd || _netbsd || _sunos) { + return resolve(null); + } + + let result = { + rx: 0, + wx: 0, + tx: 0, + rx_sec: null, + wx_sec: null, + tx_sec: null, + ms: 0 + }; + + let rx = 0; + let wx = 0; + if ((_fs_speed && !_fs_speed.ms) || (_fs_speed && _fs_speed.ms && Date.now() - _fs_speed.ms >= 500)) { + if (_linux) { + // exec("df -k | grep /dev/", function(error, stdout) { + exec('lsblk -r 2>/dev/null | grep /', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + let fs_filter = []; + lines.forEach(function (line) { + if (line !== '') { + line = line.trim().split(' '); + if (fs_filter.indexOf(line[0]) === -1) { fs_filter.push(line[0]); } + } + }); + + let output = fs_filter.join('|'); + exec('cat /proc/diskstats | egrep "' + output + '"', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.trim(); + if (line !== '') { + line = line.replace(/ +/g, ' ').split(' '); + + rx += parseInt(line[5]) * 512; + wx += parseInt(line[9]) * 512; + } + }); + result = calcFsSpeed(rx, wx); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } + if (_darwin) { + exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.trim(); + if (line !== '') { + line = line.split(','); + + rx += parseInt(line[2]); + wx += parseInt(line[9]); + } + }); + result = calcFsSpeed(rx, wx); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + } else { + result.ms = _fs_speed.last_ms; + result.rx = _fs_speed.bytes_read; + result.wx = _fs_speed.bytes_write; + result.tx = _fs_speed.bytes_read + _fs_speed.bytes_write; + result.rx_sec = _fs_speed.rx_sec; + result.wx_sec = _fs_speed.wx_sec; + result.tx_sec = _fs_speed.tx_sec; + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} + +exports.fsStats = fsStats; + +function calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime) { + let result = { + rIO: 0, + wIO: 0, + tIO: 0, + rIO_sec: null, + wIO_sec: null, + tIO_sec: null, + rWaitTime: 0, + wWaitTime: 0, + tWaitTime: 0, + rWaitPercent: null, + wWaitPercent: null, + tWaitPercent: null, + ms: 0 + }; + if (_disk_io && _disk_io.ms) { + result.rIO = rIO; + result.wIO = wIO; + result.tIO = rIO + wIO; + result.ms = Date.now() - _disk_io.ms; + result.rIO_sec = (result.rIO - _disk_io.rIO) / (result.ms / 1000); + result.wIO_sec = (result.wIO - _disk_io.wIO) / (result.ms / 1000); + result.tIO_sec = result.rIO_sec + result.wIO_sec; + result.rWaitTime = rWaitTime; + result.wWaitTime = wWaitTime; + result.tWaitTime = tWaitTime; + result.rWaitPercent = (result.rWaitTime - _disk_io.rWaitTime) * 100 / (result.ms); + result.wWaitPercent = (result.wWaitTime - _disk_io.wWaitTime) * 100 / (result.ms); + result.tWaitPercent = (result.tWaitTime - _disk_io.tWaitTime) * 100 / (result.ms); + _disk_io.rIO = rIO; + _disk_io.wIO = wIO; + _disk_io.rIO_sec = result.rIO_sec; + _disk_io.wIO_sec = result.wIO_sec; + _disk_io.tIO_sec = result.tIO_sec; + _disk_io.rWaitTime = rWaitTime; + _disk_io.wWaitTime = wWaitTime; + _disk_io.tWaitTime = tWaitTime; + _disk_io.rWaitPercent = result.rWaitPercent; + _disk_io.wWaitPercent = result.wWaitPercent; + _disk_io.tWaitPercent = result.tWaitPercent; + _disk_io.last_ms = result.ms; + _disk_io.ms = Date.now(); + } else { + result.rIO = rIO; + result.wIO = wIO; + result.tIO = rIO + wIO; + result.rWaitTime = rWaitTime; + result.wWaitTime = wWaitTime; + result.tWaitTime = tWaitTime; + _disk_io.rIO = rIO; + _disk_io.wIO = wIO; + _disk_io.rIO_sec = null; + _disk_io.wIO_sec = null; + _disk_io.tIO_sec = null; + _disk_io.rWaitTime = rWaitTime; + _disk_io.wWaitTime = wWaitTime; + _disk_io.tWaitTime = tWaitTime; + _disk_io.rWaitPercent = null; + _disk_io.wWaitPercent = null; + _disk_io.tWaitPercent = null; + _disk_io.last_ms = 0; + _disk_io.ms = Date.now(); + } + return result; +} + +function disksIO(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + if (_windows) { + return resolve(null); + } + if (_sunos) { + return resolve(null); + } + + let result = { + rIO: 0, + wIO: 0, + tIO: 0, + rIO_sec: null, + wIO_sec: null, + tIO_sec: null, + rWaitTime: 0, + wWaitTime: 0, + tWaitTime: 0, + rWaitPercent: null, + wWaitPercent: null, + tWaitPercent: null, + ms: 0 + }; + let rIO = 0; + let wIO = 0; + let rWaitTime = 0; + let wWaitTime = 0; + let tWaitTime = 0; + + if ((_disk_io && !_disk_io.ms) || (_disk_io && _disk_io.ms && Date.now() - _disk_io.ms >= 500)) { + if (_linux || _freebsd || _openbsd || _netbsd) { + // prints Block layer statistics for all mounted volumes + // var cmd = "for mount in `lsblk | grep / | sed -r 's/│ └─//' | cut -d ' ' -f 1`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done"; + // var cmd = "for mount in `lsblk | grep / | sed 's/[│└─├]//g' | awk '{$1=$1};1' | cut -d ' ' -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r 's/ +/;/g' | sed -r 's/^;//'; done"; + let cmd = 'for mount in `lsblk 2>/dev/null | grep " disk " | sed "s/[│└─├]//g" | awk \'{$1=$1};1\' | cut -d " " -f 1 | sort -u`; do cat /sys/block/$mount/stat | sed -r "s/ +/;/g" | sed -r "s/^;//"; done'; + + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.split('\n'); + lines.forEach(function (line) { + // ignore empty lines + if (!line) { return; } + + // sum r/wIO of all disks to compute all disks IO + let stats = line.split(';'); + rIO += parseInt(stats[0]); + wIO += parseInt(stats[4]); + rWaitTime += parseInt(stats[3]); + wWaitTime += parseInt(stats[7]); + tWaitTime += parseInt(stats[10]); + }); + result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime); + + if (callback) { + callback(result); + } + resolve(result); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } + if (_darwin) { + exec('ioreg -c IOBlockStorageDriver -k Statistics -r -w0 | sed -n "/IOBlockStorageDriver/,/Statistics/p" | grep "Statistics" | tr -cd "01234567890,\n"', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.trim(); + if (line !== '') { + line = line.split(','); + + rIO += parseInt(line[10]); + wIO += parseInt(line[0]); + } + }); + result = calcDiskIO(rIO, wIO, rWaitTime, wWaitTime, tWaitTime); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + } else { + result.rIO = _disk_io.rIO; + result.wIO = _disk_io.wIO; + result.tIO = _disk_io.rIO + _disk_io.wIO; + result.ms = _disk_io.last_ms; + result.rIO_sec = _disk_io.rIO_sec; + result.wIO_sec = _disk_io.wIO_sec; + result.tIO_sec = _disk_io.tIO_sec; + result.rWaitTime = _disk_io.rWaitTime; + result.wWaitTime = _disk_io.wWaitTime; + result.tWaitTime = _disk_io.tWaitTime; + result.rWaitPercent = _disk_io.rWaitPercent; + result.wWaitPercent = _disk_io.wWaitPercent; + result.tWaitPercent = _disk_io.tWaitPercent; + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} + +exports.disksIO = disksIO; + +function diskLayout(callback) { + + function getVendorFromModel(model) { + const diskManufacturers = [ + { pattern: 'WESTERN.*', manufacturer: 'Western Digital' }, + { pattern: '^WDC.*', manufacturer: 'Western Digital' }, + { pattern: 'WD.*', manufacturer: 'Western Digital' }, + { pattern: 'TOSHIBA.*', manufacturer: 'Toshiba' }, + { pattern: 'HITACHI.*', manufacturer: 'Hitachi' }, + { pattern: '^IC.*', manufacturer: 'Hitachi' }, + { pattern: '^HTS.*', manufacturer: 'Hitachi' }, + { pattern: 'SANDISK.*', manufacturer: 'SanDisk' }, + { pattern: 'KINGSTON.*', manufacturer: 'Kingston Technology' }, + { pattern: '^SONY.*', manufacturer: 'Sony' }, + { pattern: 'TRANSCEND.*', manufacturer: 'Transcend' }, + { pattern: 'SAMSUNG.*', manufacturer: 'Samsung' }, + { pattern: '^ST(?!I\\ ).*', manufacturer: 'Seagate' }, + { pattern: '^STI\\ .*', manufacturer: 'SimpleTech' }, + { pattern: '^D...-.*', manufacturer: 'IBM' }, + { pattern: '^IBM.*', manufacturer: 'IBM' }, + { pattern: '^FUJITSU.*', manufacturer: 'Fujitsu' }, + { pattern: '^MP.*', manufacturer: 'Fujitsu' }, + { pattern: '^MK.*', manufacturer: 'Toshiba' }, + { pattern: 'MAXTO.*', manufacturer: 'Maxtor' }, + { pattern: 'PIONEER.*', manufacturer: 'Pioneer' }, + { pattern: 'PHILIPS.*', manufacturer: 'Philips' }, + { pattern: 'QUANTUM.*', manufacturer: 'Quantum Technology' }, + { pattern: 'FIREBALL.*', manufacturer: 'Quantum Technology' }, + { pattern: '^VBOX.*', manufacturer: 'VirtualBox' }, + { pattern: 'CORSAIR.*', manufacturer: 'Corsair Components' }, + { pattern: 'CRUCIAL.*', manufacturer: 'Crucial' }, + { pattern: 'ECM.*', manufacturer: 'ECM' }, + { pattern: 'INTEL.*', manufacturer: 'INTEL' }, + { pattern: 'EVO.*', manufacturer: 'Samsung' }, + { pattern: 'APPLE.*', manufacturer: 'Apple' }, + ]; + + let result = ''; + if (model) { + model = model.toUpperCase(); + diskManufacturers.forEach((manufacturer) => { + const re = RegExp(manufacturer.pattern); + if (re.test(model)) { result = manufacturer.manufacturer; } + }); + } + return result; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + const commitResult = res => { + for (let i = 0; i < res.length; i++) { + delete res[i].BSDName; + } + if (callback) { + callback(res); + } + resolve(res); + }; + + let result = []; + let cmd = ''; + + if (_linux) { + let cmdFullSmart = ''; + + exec('export LC_ALL=C; lsblk -ablJO 2>/dev/null; unset LC_ALL', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + try { + const out = stdout.toString().trim(); + let devices = []; + try { + const outJSON = JSON.parse(out); + if (outJSON && {}.hasOwnProperty.call(outJSON, 'blockdevices')) { + devices = outJSON.blockdevices.filter(item => { return (item.type === 'disk') && item.size > 0 && (item.model !== null || (item.mountpoint === null && item.label === null && item.fstype === null && item.parttype === null && item.path && item.path.indexOf('/ram') !== 0 && item.path.indexOf('/loop') !== 0 && item['disc-max'] && item['disc-max'] !== 0)); }); + } + } catch (e) { + // fallback to older version of lsblk + try { + const out2 = execSync('export LC_ALL=C; lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER,GROUP 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString(); + let lines = blkStdoutToObject(out2).split('\n'); + const data = parseBlk(lines); + devices = data.filter(item => { return (item.type === 'disk') && item.size > 0 && ((item.model !== null && item.model !== '') || (item.mount === '' && item.label === '' && item.fsType === '')); }); + } catch (e) { + util.noop(); + } + } + devices.forEach((device) => { + let mediumType = ''; + const BSDName = '/dev/' + device.name; + const logical = device.name; + try { + mediumType = execSync('cat /sys/block/' + logical + '/queue/rotational 2>/dev/null', util.execOptsLinux).toString().split('\n')[0]; + } catch (e) { + util.noop(); + } + let interfaceType = device.tran ? device.tran.toUpperCase().trim() : ''; + if (interfaceType === 'NVME') { + mediumType = '2'; + interfaceType = 'PCIe'; + } + result.push({ + device: BSDName, + type: (mediumType === '0' ? 'SSD' : (mediumType === '1' ? 'HD' : (mediumType === '2' ? 'NVMe' : (device.model && device.model.indexOf('SSD') > -1 ? 'SSD' : (device.model && device.model.indexOf('NVM') > -1 ? 'NVMe' : 'HD'))))), + name: device.model || '', + vendor: getVendorFromModel(device.model) || (device.vendor ? device.vendor.trim() : ''), + size: device.size || 0, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: device.rev ? device.rev.trim() : '', + serialNum: device.serial ? device.serial.trim() : '', + interfaceType: interfaceType, + smartStatus: 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd += `printf "\n${BSDName}|"; smartctl -H ${BSDName} | grep overall;`; + cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${BSDName};`; + }); + } catch (e) { + util.noop(); + } + } + // check S.M.A.R.T. status + if (cmdFullSmart) { + exec(cmdFullSmart, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + try { + const data = JSON.parse(`[${stdout}]`); + data.forEach(disk => { + const diskBSDName = disk.smartctl.argv[disk.smartctl.argv.length - 1]; + + for (let i = 0; i < result.length; i++) { + if (result[i].BSDName === diskBSDName) { + result[i].smartStatus = (disk.smart_status.passed ? 'Ok' : (disk.smart_status.passed === false ? 'Predicted Failure' : 'unknown')); + if (disk.temperature && disk.temperature.current) { + result[i].temperature = disk.temperature.current; + } + result[i].smartData = disk; + } + } + }); + commitResult(result); + } catch (e) { + if (cmd) { + cmd = cmd + 'printf "\n"'; + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + let lines = stdout.toString().split('\n'); + lines.forEach(line => { + if (line) { + let parts = line.split('|'); + if (parts.length === 2) { + let BSDName = parts[0]; + parts[1] = parts[1].trim(); + let parts2 = parts[1].split(':'); + if (parts2.length === 2) { + parts2[1] = parts2[1].trim(); + let status = parts2[1].toLowerCase(); + for (let i = 0; i < result.length; i++) { + if (result[i].BSDName === BSDName) { + result[i].smartStatus = (status === 'passed' ? 'Ok' : (status === 'failed!' ? 'Predicted Failure' : 'unknown')); + } + } + } + } + } + }); + commitResult(result); + }); + } else { + commitResult(result); + } + } + }); + } else { + commitResult(result); + } + }); + } + if (_freebsd || _openbsd || _netbsd) { + if (callback) { callback(result); } + resolve(result); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_darwin) { + exec('system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType', { maxBuffer: 1024 * 1024 }, function (error, stdout) { + if (!error) { + // split by type: + let lines = stdout.toString().split('\n'); + let linesSATA = []; + let linesNVMe = []; + let linesUSB = []; + let dataType = 'SATA'; + lines.forEach(line => { + if (line === 'NVMExpress:') { dataType = 'NVMe'; } + else if (line === 'USB:') { dataType = 'USB'; } + else if (line === 'SATA/SATA Express:') { dataType = 'SATA'; } + else if (dataType === 'SATA') { linesSATA.push(line); } + else if (dataType === 'NVMe') { linesNVMe.push(line); } + else if (dataType === 'USB') { linesUSB.push(line); } + }); + try { + // Serial ATA Drives + let devices = linesSATA.join('\n').split(' Physical Interconnect: '); + devices.shift(); + devices.forEach(function (device) { + device = 'InterfaceType: ' + device; + let lines = device.split('\n'); + const mediumType = util.getValue(lines, 'Medium Type', ':', true).trim(); + const sizeStr = util.getValue(lines, 'capacity', ':', true).trim(); + const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim(); + if (sizeStr) { + let sizeValue = 0; + if (sizeStr.indexOf('(') >= 0) { + sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, '')); + } + if (!sizeValue) { + sizeValue = parseInt(sizeStr); + } + if (sizeValue) { + const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase(); + result.push({ + device: BSDName, + type: mediumType.startsWith('Solid') ? 'SSD' : 'HD', + name: util.getValue(lines, 'Model', ':', true).trim(), + vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()) || util.getValue(lines, 'Manufacturer', ':', true), + size: sizeValue, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(), + serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), + interfaceType: util.getValue(lines, 'InterfaceType', ':', true).trim(), + smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; + } + } + }); + } catch (e) { + util.noop(); + } + + // NVME Drives + try { + let devices = linesNVMe.join('\n').split('\n\n Capacity:'); + devices.shift(); + devices.forEach(function (device) { + device = '!Capacity: ' + device; + let lines = device.split('\n'); + const linkWidth = util.getValue(lines, 'link width', ':', true).trim(); + const sizeStr = util.getValue(lines, '!capacity', ':', true).trim(); + const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim(); + if (sizeStr) { + let sizeValue = 0; + if (sizeStr.indexOf('(') >= 0) { + sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, '')); + } + if (!sizeValue) { + sizeValue = parseInt(sizeStr); + } + if (sizeValue) { + const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase(); + result.push({ + device: BSDName, + type: 'NVMe', + name: util.getValue(lines, 'Model', ':', true).trim(), + vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()), + size: sizeValue, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(), + serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), + interfaceType: ('PCIe ' + linkWidth).trim(), + smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; + } + } + }); + } catch (e) { + util.noop(); + } + // USB Drives + try { + let devices = linesUSB.join('\n').replaceAll('Media:\n ', 'Model:').split('\n\n Product ID:'); + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\n'); + const sizeStr = util.getValue(lines, 'Capacity', ':', true).trim(); + const BSDName = util.getValue(lines, 'BSD Name', ':', true).trim(); + if (sizeStr) { + let sizeValue = 0; + if (sizeStr.indexOf('(') >= 0) { + sizeValue = parseInt(sizeStr.match(/\(([^)]+)\)/)[1].replace(/\./g, '').replace(/,/g, '').replace(/\s/g, '')); + } + if (!sizeValue) { + sizeValue = parseInt(sizeStr); + } + if (sizeValue) { + const smartStatusString = util.getValue(lines, 'S.M.A.R.T. status', ':', true).trim().toLowerCase(); + result.push({ + device: BSDName, + type: 'USB', + name: util.getValue(lines, 'Model', ':', true).trim().replaceAll(':', ''), + vendor: getVendorFromModel(util.getValue(lines, 'Model', ':', true).trim()), + size: sizeValue, + bytesPerSector: null, + totalCylinders: null, + totalHeads: null, + totalSectors: null, + totalTracks: null, + tracksPerCylinder: null, + sectorsPerTrack: null, + firmwareRevision: util.getValue(lines, 'Revision', ':', true).trim(), + serialNum: util.getValue(lines, 'Serial Number', ':', true).trim(), + interfaceType: 'USB', + smartStatus: smartStatusString === 'verified' ? 'OK' : smartStatusString || 'unknown', + temperature: null, + BSDName: BSDName + }); + cmd = cmd + 'printf "\n' + BSDName + '|"; diskutil info /dev/' + BSDName + ' | grep SMART;'; + } + } + }); + } catch (e) { + util.noop(); + } + if (cmd) { + cmd = cmd + 'printf "\n"'; + exec(cmd, { maxBuffer: 1024 * 1024 }, function (error, stdout) { + let lines = stdout.toString().split('\n'); + lines.forEach(line => { + if (line) { + let parts = line.split('|'); + if (parts.length === 2) { + let BSDName = parts[0]; + parts[1] = parts[1].trim(); + let parts2 = parts[1].split(':'); + if (parts2.length === 2) { + parts2[1] = parts2[1].trim(); + let status = parts2[1].toLowerCase(); + for (let i = 0; i < result.length; i++) { + if (result[i].BSDName === BSDName) { + result[i].smartStatus = (status === 'not supported' ? 'not supported' : (status === 'verified' ? 'Ok' : (status === 'failing' ? 'Predicted Failure' : 'unknown'))); + } + } + } + } + } + }); + for (let i = 0; i < result.length; i++) { + delete result[i].BSDName; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + for (let i = 0; i < result.length; i++) { + delete result[i].BSDName; + } + if (callback) { + callback(result); + } + resolve(result); + } + } + }); + } + if (_windows) { + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,DeviceId,BytesPerSector,TotalCylinders,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder,SectorsPerTrack,FirmwareRevision,SerialNumber,InterfaceType | fl')); + workload.push(util.powerShell('Get-PhysicalDisk | select BusType,MediaType,FriendlyName,Model,SerialNumber,Size | fl')); + if (util.smartMonToolsInstalled()) { + try { + const smartDev = JSON.parse(execSync('smartctl --scan -j').toString()); + if (smartDev && smartDev.devices && smartDev.devices.length > 0) { + smartDev.devices.forEach((dev) => { + workload.push(execPromiseSave(`smartctl -j -a ${dev.name}`, util.execOptsWin)); + }); + } + } catch (e) { + util.noop(); + } + } + util.promiseAll( + workload + ).then((data) => { + let devices = data.results[0].toString().split(/\n\s*\n/); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const size = util.getValue(lines, 'Size', ':').trim(); + const status = util.getValue(lines, 'Status', ':').trim().toLowerCase(); + if (size) { + result.push({ + device: util.getValue(lines, 'DeviceId', ':'), // changed from PNPDeviceId to DeviceID (be be able to match devices) + type: device.indexOf('SSD') > -1 ? 'SSD' : 'HD', // just a starting point ... better: MSFT_PhysicalDisk - Media Type ... see below + name: util.getValue(lines, 'Caption', ':'), + vendor: getVendorFromModel(util.getValue(lines, 'Caption', ':', true).trim()), + size: parseInt(size), + bytesPerSector: parseInt(util.getValue(lines, 'BytesPerSector', ':')), + totalCylinders: parseInt(util.getValue(lines, 'TotalCylinders', ':')), + totalHeads: parseInt(util.getValue(lines, 'TotalHeads', ':')), + totalSectors: parseInt(util.getValue(lines, 'TotalSectors', ':')), + totalTracks: parseInt(util.getValue(lines, 'TotalTracks', ':')), + tracksPerCylinder: parseInt(util.getValue(lines, 'TracksPerCylinder', ':')), + sectorsPerTrack: parseInt(util.getValue(lines, 'SectorsPerTrack', ':')), + firmwareRevision: util.getValue(lines, 'FirmwareRevision', ':').trim(), + serialNum: util.getValue(lines, 'SerialNumber', ':').trim(), + interfaceType: util.getValue(lines, 'InterfaceType', ':').trim(), + smartStatus: (status === 'ok' ? 'Ok' : (status === 'degraded' ? 'Degraded' : (status === 'pred fail' ? 'Predicted Failure' : 'Unknown'))), + temperature: null, + }); + } + }); + devices = data.results[1].split(/\n\s*\n/); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const serialNum = util.getValue(lines, 'SerialNumber', ':').trim(); + const name = util.getValue(lines, 'FriendlyName', ':').trim().replace('Msft ', 'Microsoft'); + const size = util.getValue(lines, 'Size', ':').trim(); + const model = util.getValue(lines, 'Model', ':').trim(); + const interfaceType = util.getValue(lines, 'BusType', ':').trim(); + let mediaType = util.getValue(lines, 'MediaType', ':').trim(); + if (mediaType === '3' || mediaType === 'HDD') { mediaType = 'HD'; } + if (mediaType === '4') { mediaType = 'SSD'; } + if (mediaType === '5') { mediaType = 'SCM'; } + if (mediaType === 'Unspecified' && (model.toLowerCase().indexOf('virtual') > -1 || model.toLowerCase().indexOf('vbox') > -1)) { mediaType = 'Virtual'; } + if (size) { + let i = util.findObjectByKey(result, 'serialNum', serialNum); + if (i === -1 || serialNum === '') { + i = util.findObjectByKey(result, 'name', name); + } + if (i != -1) { + result[i].type = mediaType; + result[i].interfaceType = interfaceType; + } + } + }); + // S.M.A.R.T + data.results.shift(); + data.results.shift(); + if (data.results.length) { + data.results.forEach((smartStr) => { + try { + const smartData = JSON.parse(smartStr); + if (smartData.serial_number) { + const serialNum = smartData.serial_number; + let i = util.findObjectByKey(result, 'serialNum', serialNum); + if (i != -1) { + result[i].smartStatus = (smartData.smart_status && smartData.smart_status.passed ? 'Ok' : (smartData.smart_status && smartData.smart_status.passed === false ? 'Predicted Failure' : 'unknown')); + if (smartData.temperature && smartData.temperature.current) { + result[i].temperature = smartData.temperature.current; + } + result[i].smartData = smartData; + } + } + } catch (e) { + util.noop(); + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.diskLayout = diskLayout; + + +/***/ }), + +/***/ 9785: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// graphics.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 7. Graphics (controller, display) +// ---------------------------------------------------------------------------------- + +const fs = __nccwpck_require__(7147); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; +let _nvidiaSmiPath = ''; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _resolutionX = 0; +let _resolutionY = 0; +let _pixelDepth = 0; +let _refreshRate = 0; + +const videoTypes = { + '-2': 'UNINITIALIZED', + '-1': 'OTHER', + '0': 'HD15', + '1': 'SVIDEO', + '2': 'Composite video', + '3': 'Component video', + '4': 'DVI', + '5': 'HDMI', + '6': 'LVDS', + '8': 'D_JPN', + '9': 'SDI', + '10': 'DP', + '11': 'DP embedded', + '12': 'UDI', + '13': 'UDI embedded', + '14': 'SDTVDONGLE', + '15': 'MIRACAST', + '2147483648': 'INTERNAL' +}; + +function getVendorFromModel(model) { + const manufacturers = [ + { pattern: '^LG.+', manufacturer: 'LG' }, + { pattern: '^BENQ.+', manufacturer: 'BenQ' }, + { pattern: '^ASUS.+', manufacturer: 'Asus' }, + { pattern: '^DELL.+', manufacturer: 'Dell' }, + { pattern: '^SAMSUNG.+', manufacturer: 'Samsung' }, + { pattern: '^VIEWSON.+', manufacturer: 'ViewSonic' }, + { pattern: '^SONY.+', manufacturer: 'Sony' }, + { pattern: '^ACER.+', manufacturer: 'Acer' }, + { pattern: '^AOC.+', manufacturer: 'AOC Monitors' }, + { pattern: '^HP.+', manufacturer: 'HP' }, + { pattern: '^EIZO.?', manufacturer: 'Eizo' }, + { pattern: '^PHILIPS.?', manufacturer: 'Philips' }, + { pattern: '^IIYAMA.?', manufacturer: 'Iiyama' }, + { pattern: '^SHARP.?', manufacturer: 'Sharp' }, + { pattern: '^NEC.?', manufacturer: 'NEC' }, + { pattern: '^LENOVO.?', manufacturer: 'Lenovo' }, + { pattern: 'COMPAQ.?', manufacturer: 'Compaq' }, + { pattern: 'APPLE.?', manufacturer: 'Apple' }, + { pattern: 'INTEL.?', manufacturer: 'Intel' }, + { pattern: 'AMD.?', manufacturer: 'AMD' }, + { pattern: 'NVIDIA.?', manufacturer: 'NVDIA' }, + ]; + + let result = ''; + if (model) { + model = model.toUpperCase(); + manufacturers.forEach((manufacturer) => { + const re = RegExp(manufacturer.pattern); + if (re.test(model)) { result = manufacturer.manufacturer; } + }); + } + return result; +} + +function getVendorFromId(id) { + const vendors = { + '610': 'Apple', + '1e6d': 'LG', + '10ac': 'DELL', + '4dd9': 'Sony', + '38a3': 'NEC', + }; + return vendors[id] || ''; +} + +function vendorToId(str) { + let result = ''; + str = (str || '').toLowerCase(); + if (str.indexOf('apple') >= 0) { result = '0x05ac'; } + else if (str.indexOf('nvidia') >= 0) { result = '0x10de'; } + else if (str.indexOf('intel') >= 0) { result = '0x8086'; } + else if (str.indexOf('ati') >= 0 || str.indexOf('amd') >= 0) { result = '0x1002'; } + + return result; +} + +function getMetalVersion(id) { + const families = { + 'spdisplays_mtlgpufamilymac1': 'mac1', + 'spdisplays_mtlgpufamilymac2': 'mac2', + 'spdisplays_mtlgpufamilyapple1': 'apple1', + 'spdisplays_mtlgpufamilyapple2': 'apple2', + 'spdisplays_mtlgpufamilyapple3': 'apple3', + 'spdisplays_mtlgpufamilyapple4': 'apple4', + 'spdisplays_mtlgpufamilyapple5': 'apple5', + 'spdisplays_mtlgpufamilyapple6': 'apple6', + 'spdisplays_mtlgpufamilyapple7': 'apple7', + 'spdisplays_metalfeaturesetfamily11': 'family1_v1', + 'spdisplays_metalfeaturesetfamily12': 'family1_v2', + 'spdisplays_metalfeaturesetfamily13': 'family1_v3', + 'spdisplays_metalfeaturesetfamily14': 'family1_v4', + 'spdisplays_metalfeaturesetfamily21': 'family2_v1' + }; + return families[id] || ''; +} + +function graphics(callback) { + + function parseLinesDarwin(graphicsArr) { + const res = { + controllers: [], + displays: [] + }; + try { + graphicsArr.forEach(function (item) { + // controllers + const bus = ((item.sppci_bus || '').indexOf('builtin') > -1 ? 'Built-In' : ((item.sppci_bus || '').indexOf('pcie') > -1 ? 'PCIe' : '')); + const vram = (parseInt((item.spdisplays_vram || ''), 10) || 0) * (((item.spdisplays_vram || '').indexOf('GB') > -1) ? 1024 : 1); + const vramDyn = (parseInt((item.spdisplays_vram_shared || ''), 10) || 0) * (((item.spdisplays_vram_shared || '').indexOf('GB') > -1) ? 1024 : 1); + let metalVersion = getMetalVersion(item.spdisplays_metal || item.spdisplays_metalfamily || ''); + res.controllers.push({ + vendor: getVendorFromModel(item.spdisplays_vendor || '') || item.spdisplays_vendor || '', + model: item.sppci_model || '', + bus, + vramDynamic: bus === 'Built-In', + vram: vram || vramDyn || null, + deviceId: item['spdisplays_device-id'] || '', + vendorId: item['spdisplays_vendor-id'] || vendorToId((item['spdisplays_vendor'] || '') + (item.sppci_model || '')), + external: (item.sppci_device_type === 'spdisplays_egpu'), + cores: item['sppci_cores'] || null, + metalVersion + }); + + // displays + if (item.spdisplays_ndrvs && item.spdisplays_ndrvs.length) { + item.spdisplays_ndrvs.forEach(function (displayItem) { + const connectionType = displayItem['spdisplays_connection_type'] || ''; + const currentResolutionParts = (displayItem['_spdisplays_resolution'] || '').split('@'); + const currentResolution = currentResolutionParts[0].split('x'); + const pixelParts = (displayItem['_spdisplays_pixels'] || '').split('x'); + const pixelDepthString = displayItem['spdisplays_depth'] || ''; + const serial = displayItem['_spdisplays_display-serial-number'] || displayItem['_spdisplays_display-serial-number2'] || null; + res.displays.push({ + vendor: getVendorFromId(displayItem['_spdisplays_display-vendor-id'] || '') || getVendorFromModel(displayItem['_name'] || ''), + vendorId: displayItem['_spdisplays_display-vendor-id'] || '', + model: displayItem['_name'] || '', + productionYear: displayItem['_spdisplays_display-year'] || null, + serial: serial !== '0' ? serial : null, + displayId: displayItem['_spdisplays_displayID'] || null, + main: displayItem['spdisplays_main'] ? displayItem['spdisplays_main'] === 'spdisplays_yes' : false, + builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') > -1, + connection: ((connectionType.indexOf('_internal') > -1) ? 'Internal' : ((connectionType.indexOf('_displayport') > -1) ? 'Display Port' : ((connectionType.indexOf('_hdmi') > -1) ? 'HDMI' : null))), + sizeX: null, + sizeY: null, + pixelDepth: (pixelDepthString === 'CGSThirtyBitColor' ? 30 : (pixelDepthString === 'CGSThirtytwoBitColor' ? 32 : (pixelDepthString === 'CGSTwentyfourBitColor' ? 24 : null))), + resolutionX: pixelParts.length > 1 ? parseInt(pixelParts[0], 10) : null, + resolutionY: pixelParts.length > 1 ? parseInt(pixelParts[1], 10) : null, + currentResX: currentResolution.length > 1 ? parseInt(currentResolution[0], 10) : null, + currentResY: currentResolution.length > 1 ? parseInt(currentResolution[1], 10) : null, + positionX: 0, + positionY: 0, + currentRefreshRate: currentResolutionParts.length > 1 ? parseInt(currentResolutionParts[1], 10) : null, + + }); + }); + } + }); + return res; + } catch (e) { + return res; + } + } + + function parseLinesLinuxControllers(lines) { + let controllers = []; + let currentController = { + vendor: '', + subVendor: '', + model: '', + bus: '', + busAddress: '', + vram: null, + vramDynamic: false, + pciID: '' + }; + let isGraphicsController = false; + // PCI bus IDs + let pciIDs = []; + try { + pciIDs = execSync('export LC_ALL=C; dmidecode -t 9 2>/dev/null; unset LC_ALL | grep "Bus Address: "', util.execOptsLinux).toString().split('\n'); + for (let i = 0; i < pciIDs.length; i++) { + pciIDs[i] = pciIDs[i].replace('Bus Address:', '').replace('0000:', '').trim(); + } + pciIDs = pciIDs.filter(function (el) { + return el != null && el; + }); + } catch (e) { + util.noop(); + } + let i = 1; + lines.forEach((line) => { + let subsystem = ''; + if (i < lines.length && lines[i]) { // get next line; + subsystem = lines[i]; + if (subsystem.indexOf(':') > 0) { + subsystem = subsystem.split(':')[1]; + } + } + if ('' !== line.trim()) { + if (' ' !== line[0] && '\t' !== line[0]) { // first line of new entry + let isExternal = (pciIDs.indexOf(line.split(' ')[0]) >= 0); + let vgapos = line.toLowerCase().indexOf(' vga '); + let _3dcontrollerpos = line.toLowerCase().indexOf('3d controller'); + if (vgapos !== -1 || _3dcontrollerpos !== -1) { // VGA + if (_3dcontrollerpos !== -1 && vgapos === -1) { + vgapos = _3dcontrollerpos; + } + if (currentController.vendor || currentController.model || currentController.bus || currentController.vram !== null || currentController.vramDynamic) { // already a controller found + controllers.push(currentController); + currentController = { + vendor: '', + model: '', + bus: '', + busAddress: '', + vram: null, + vramDynamic: false, + }; + } + + const pciIDCandidate = line.split(' ')[0]; + if (/[\da-fA-F]{2}:[\da-fA-F]{2}\.[\da-fA-F]/.test(pciIDCandidate)) { + currentController.busAddress = pciIDCandidate; + } + isGraphicsController = true; + let endpos = line.search(/\[[0-9a-f]{4}:[0-9a-f]{4}]|$/); + let parts = line.substr(vgapos, endpos - vgapos).split(':'); + currentController.busAddress = line.substr(0, vgapos).trim(); + if (parts.length > 1) { + parts[1] = parts[1].trim(); + if (parts[1].toLowerCase().indexOf('corporation') >= 0) { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf('corporation') + 11).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf('corporation') + 11, 200).split('(')[0].trim(); + currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard'; + currentController.vram = null; + currentController.vramDynamic = false; + } else if (parts[1].toLowerCase().indexOf(' inc.') >= 0) { + if ((parts[1].match(/]/g) || []).length > 1) { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(']') + 1).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']') + 1, 200).trim().split('(')[0].trim(); + } else { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' inc.') + 5).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' inc.') + 5, 200).trim().split('(')[0].trim(); + } + currentController.bus = (pciIDs.length > 0 && isExternal) ? 'PCIe' : 'Onboard'; + currentController.vram = null; + currentController.vramDynamic = false; + } else if (parts[1].toLowerCase().indexOf(' ltd.') >= 0) { + if ((parts[1].match(/]/g) || []).length > 1) { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(']') + 1).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(']') + 1, 200).trim().split('(')[0].trim(); + } else { + currentController.vendor = parts[1].substr(0, parts[1].toLowerCase().indexOf(' ltd.') + 5).trim(); + currentController.model = parts[1].substr(parts[1].toLowerCase().indexOf(' ltd.') + 5, 200).trim().split('(')[0].trim(); + } + } + if (currentController.model && subsystem.indexOf(currentController.model) !== -1) { + const subVendor = subsystem.split(currentController.model)[0].trim(); + if (subVendor) { + currentController.subVendor = subVendor; + } + } + } + + } else { + isGraphicsController = false; + } + } + if (isGraphicsController) { // within VGA details + let parts = line.split(':'); + if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('devicename') !== -1 && parts[1].toLowerCase().indexOf('onboard') !== -1) { currentController.bus = 'Onboard'; } + if (parts.length > 1 && parts[0].replace(/ +/g, '').toLowerCase().indexOf('region') !== -1 && parts[1].toLowerCase().indexOf('memory') !== -1) { + let memparts = parts[1].split('='); + if (memparts.length > 1) { + currentController.vram = parseInt(memparts[1]); + } + } + } + } + i++; + }); + + if (currentController.vendor || currentController.model || currentController.bus || currentController.busAddress || currentController.vram !== null || currentController.vramDynamic) { // already a controller found + controllers.push(currentController); + } + return (controllers); + } + + function parseLinesLinuxClinfo(controllers, lines) { + const fieldPattern = /\[([^\]]+)\]\s+(\w+)\s+(.*)/; + const devices = lines.reduce((devices, line) => { + const field = fieldPattern.exec(line.trim()); + if (field) { + if (!devices[field[1]]) { + devices[field[1]] = {}; + } + devices[field[1]][field[2]] = field[3]; + } + return devices; + }, {}); + for (let deviceId in devices) { + const device = devices[deviceId]; + if (device['CL_DEVICE_TYPE'] === 'CL_DEVICE_TYPE_GPU') { + let busAddress; + if (device['CL_DEVICE_TOPOLOGY_AMD']) { + const bdf = device['CL_DEVICE_TOPOLOGY_AMD'].match(/[a-zA-Z0-9]+:\d+\.\d+/); + if (bdf) { + busAddress = bdf[0]; + } + } else if (device['CL_DEVICE_PCI_BUS_ID_NV'] && device['CL_DEVICE_PCI_SLOT_ID_NV']) { + const bus = parseInt(device['CL_DEVICE_PCI_BUS_ID_NV']); + const slot = parseInt(device['CL_DEVICE_PCI_SLOT_ID_NV']); + if (!isNaN(bus) && !isNaN(slot)) { + const b = bus & 0xff; + const d = (slot >> 3) & 0xff; + const f = slot & 0x07; + busAddress = `${b.toString().padStart(2, '0')}:${d.toString().padStart(2, '0')}.${f}`; + } + } + if (busAddress) { + let controller = controllers.find(controller => controller.busAddress === busAddress); + if (!controller) { + controller = { + vendor: '', + model: '', + bus: '', + busAddress, + vram: null, + vramDynamic: false + }; + controllers.push(controller); + } + controller.vendor = device['CL_DEVICE_VENDOR']; + if (device['CL_DEVICE_BOARD_NAME_AMD']) { + controller.model = device['CL_DEVICE_BOARD_NAME_AMD']; + } else { + controller.model = device['CL_DEVICE_NAME']; + } + const memory = parseInt(device['CL_DEVICE_GLOBAL_MEM_SIZE']); + if (!isNaN(memory)) { + controller.vram = Math.round(memory / 1024 / 1024); + } + } + } + } + return controllers; + } + + function getNvidiaSmi() { + if (_nvidiaSmiPath) { + return _nvidiaSmiPath; + } + + if (_windows) { + try { + const basePath = util.WINDIR + '\\System32\\DriverStore\\FileRepository'; + // find all directories that have an nvidia-smi.exe file + const candidateDirs = fs.readdirSync(basePath).filter(dir => { + return fs.readdirSync([basePath, dir].join('/')).includes('nvidia-smi.exe'); + }); + // use the directory with the most recently created nvidia-smi.exe file + const targetDir = candidateDirs.reduce((prevDir, currentDir) => { + const previousNvidiaSmi = fs.statSync([basePath, prevDir, 'nvidia-smi.exe'].join('/')); + const currentNvidiaSmi = fs.statSync([basePath, currentDir, 'nvidia-smi.exe'].join('/')); + return (previousNvidiaSmi.ctimeMs > currentNvidiaSmi.ctimeMs) ? prevDir : currentDir; + }); + + if (targetDir) { + _nvidiaSmiPath = [basePath, targetDir, 'nvidia-smi.exe'].join('/'); + } + } catch (e) { + util.noop(); + } + } else if (_linux) { + _nvidiaSmiPath = 'nvidia-smi'; + } + return _nvidiaSmiPath; + } + + function nvidiaSmi(options) { + const nvidiaSmiExe = getNvidiaSmi(); + options = options || util.execOptsWin; + if (nvidiaSmiExe) { + const nvidiaSmiOpts = '--query-gpu=driver_version,pci.sub_device_id,name,pci.bus_id,fan.speed,memory.total,memory.used,memory.free,utilization.gpu,utilization.memory,temperature.gpu,temperature.memory,power.draw,power.limit,clocks.gr,clocks.mem --format=csv,noheader,nounits'; + const cmd = nvidiaSmiExe + ' ' + nvidiaSmiOpts + (_linux ? ' 2>/dev/null' : ''); + if (_linux) { + options.stdio = ['pipe', 'pipe', 'ignore']; + } + try { + const res = execSync(cmd, options).toString(); + return res; + } catch (e) { + util.noop(); + } + } + return ''; + } + + function nvidiaDevices() { + + function safeParseNumber(value) { + if ([null, undefined].includes(value)) { + return value; + } + return parseFloat(value); + } + + const stdout = nvidiaSmi(); + if (!stdout) { + return []; + } + + const gpus = stdout.split('\n').filter(Boolean); + let results = gpus.map(gpu => { + const splittedData = gpu.split(', ').map(value => value.includes('N/A') ? undefined : value); + if (splittedData.length === 16) { + return { + driverVersion: splittedData[0], + subDeviceId: splittedData[1], + name: splittedData[2], + pciBus: splittedData[3], + fanSpeed: safeParseNumber(splittedData[4]), + memoryTotal: safeParseNumber(splittedData[5]), + memoryUsed: safeParseNumber(splittedData[6]), + memoryFree: safeParseNumber(splittedData[7]), + utilizationGpu: safeParseNumber(splittedData[8]), + utilizationMemory: safeParseNumber(splittedData[9]), + temperatureGpu: safeParseNumber(splittedData[10]), + temperatureMemory: safeParseNumber(splittedData[11]), + powerDraw: safeParseNumber(splittedData[12]), + powerLimit: safeParseNumber(splittedData[13]), + clockCore: safeParseNumber(splittedData[14]), + clockMemory: safeParseNumber(splittedData[15]), + }; + } else { + return {}; + } + }); + results = results.filter((item) => { + return ('pciBus' in item); + }); + return results; + } + + function mergeControllerNvidia(controller, nvidia) { + if (nvidia.driverVersion) { controller.driverVersion = nvidia.driverVersion; } + if (nvidia.subDeviceId) { controller.subDeviceId = nvidia.subDeviceId; } + if (nvidia.name) { controller.name = nvidia.name; } + if (nvidia.pciBus) { controller.pciBus = nvidia.pciBus; } + if (nvidia.fanSpeed) { controller.fanSpeed = nvidia.fanSpeed; } + if (nvidia.memoryTotal) { + controller.memoryTotal = nvidia.memoryTotal; + controller.vram = nvidia.memoryTotal; + controller.vramDynamic = false; + } + if (nvidia.memoryUsed) { controller.memoryUsed = nvidia.memoryUsed; } + if (nvidia.memoryFree) { controller.memoryFree = nvidia.memoryFree; } + if (nvidia.utilizationGpu) { controller.utilizationGpu = nvidia.utilizationGpu; } + if (nvidia.utilizationMemory) { controller.utilizationMemory = nvidia.utilizationMemory; } + if (nvidia.temperatureGpu) { controller.temperatureGpu = nvidia.temperatureGpu; } + if (nvidia.temperatureMemory) { controller.temperatureMemory = nvidia.temperatureMemory; } + if (nvidia.powerDraw) { controller.powerDraw = nvidia.powerDraw; } + if (nvidia.powerLimit) { controller.powerLimit = nvidia.powerLimit; } + if (nvidia.clockCore) { controller.clockCore = nvidia.clockCore; } + if (nvidia.clockMemory) { controller.clockMemory = nvidia.clockMemory; } + return controller; + } + + function parseLinesLinuxEdid(edid) { + // parsen EDID + // --> model + // --> resolutionx + // --> resolutiony + // --> builtin = false + // --> pixeldepth (?) + // --> sizex + // --> sizey + let result = { + vendor: '', + model: '', + deviceName: '', + main: false, + builtin: false, + connection: '', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: null, + resolutionY: null, + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }; + // find first "Detailed Timing Description" + let start = 108; + if (edid.substr(start, 6) === '000000') { + start += 36; + } + if (edid.substr(start, 6) === '000000') { + start += 36; + } + if (edid.substr(start, 6) === '000000') { + start += 36; + } + if (edid.substr(start, 6) === '000000') { + start += 36; + } + result.resolutionX = parseInt('0x0' + edid.substr(start + 8, 1) + edid.substr(start + 4, 2)); + result.resolutionY = parseInt('0x0' + edid.substr(start + 14, 1) + edid.substr(start + 10, 2)); + result.sizeX = parseInt('0x0' + edid.substr(start + 28, 1) + edid.substr(start + 24, 2)); + result.sizeY = parseInt('0x0' + edid.substr(start + 29, 1) + edid.substr(start + 26, 2)); + // monitor name + start = edid.indexOf('000000fc00'); // find first "Monitor Description Data" + if (start >= 0) { + let model_raw = edid.substr(start + 10, 26); + if (model_raw.indexOf('0a') !== -1) { + model_raw = model_raw.substr(0, model_raw.indexOf('0a')); + } + try { + if (model_raw.length > 2) { + result.model = model_raw.match(/.{1,2}/g).map(function (v) { + return String.fromCharCode(parseInt(v, 16)); + }).join(''); + } + } catch (e) { + util.noop(); + } + } else { + result.model = ''; + } + return result; + } + + function parseLinesLinuxDisplays(lines, depth) { + let displays = []; + let currentDisplay = { + vendor: '', + model: '', + deviceName: '', + main: false, + builtin: false, + connection: '', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: null, + resolutionY: null, + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }; + let is_edid = false; + let is_current = false; + let edid_raw = ''; + let start = 0; + for (let i = 1; i < lines.length; i++) { // start with second line + if ('' !== lines[i].trim()) { + if (' ' !== lines[i][0] && '\t' !== lines[i][0] && lines[i].toLowerCase().indexOf(' connected ') !== -1) { // first line of new entry + if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // push last display to array + displays.push(currentDisplay); + currentDisplay = { + vendor: '', + model: '', + main: false, + builtin: false, + connection: '', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: null, + resolutionY: null, + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }; + } + let parts = lines[i].split(' '); + currentDisplay.connection = parts[0]; + currentDisplay.main = lines[i].toLowerCase().indexOf(' primary ') >= 0; + currentDisplay.builtin = (parts[0].toLowerCase().indexOf('edp') >= 0); + } + + // try to read EDID information + if (is_edid) { + if (lines[i].search(/\S|$/) > start) { + edid_raw += lines[i].toLowerCase().trim(); + } else { + // parsen EDID + let edid_decoded = parseLinesLinuxEdid(edid_raw); + currentDisplay.vendor = edid_decoded.vendor; + currentDisplay.model = edid_decoded.model; + currentDisplay.resolutionX = edid_decoded.resolutionX; + currentDisplay.resolutionY = edid_decoded.resolutionY; + currentDisplay.sizeX = edid_decoded.sizeX; + currentDisplay.sizeY = edid_decoded.sizeY; + currentDisplay.pixelDepth = depth; + is_edid = false; + } + } + if (lines[i].toLowerCase().indexOf('edid:') >= 0) { + is_edid = true; + start = lines[i].search(/\S|$/); + } + if (lines[i].toLowerCase().indexOf('*current') >= 0) { + const parts1 = lines[i].split('('); + if (parts1 && parts1.length > 1 && parts1[0].indexOf('x') >= 0) { + const resParts = parts1[0].trim().split('x'); + currentDisplay.currentResX = util.toInt(resParts[0]); + currentDisplay.currentResY = util.toInt(resParts[1]); + } + is_current = true; + } + if (is_current && lines[i].toLowerCase().indexOf('clock') >= 0 && lines[i].toLowerCase().indexOf('hz') >= 0 && lines[i].toLowerCase().indexOf('v: height') >= 0) { + const parts1 = lines[i].split('clock'); + if (parts1 && parts1.length > 1 && parts1[1].toLowerCase().indexOf('hz') >= 0) { + currentDisplay.currentRefreshRate = util.toInt(parts1[1]); + } + is_current = false; + } + } + } + + // pushen displays + if (currentDisplay.model || currentDisplay.main || currentDisplay.builtin || currentDisplay.connection || currentDisplay.sizeX !== null || currentDisplay.pixelDepth !== null || currentDisplay.resolutionX !== null) { // still information there + displays.push(currentDisplay); + } + return displays; + } + + // function starts here + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + controllers: [], + displays: [] + }; + if (_darwin) { + let cmd = 'system_profiler -xml -detailLevel full SPDisplaysDataType'; + exec(cmd, function (error, stdout) { + if (!error) { + try { + const output = stdout.toString(); + result = parseLinesDarwin(util.plistParser(output)[0]._items); + } catch (e) { + util.noop(); + } + try { + stdout = execSync('defaults read /Library/Preferences/com.apple.windowserver.plist 2>/dev/null;defaults read /Library/Preferences/com.apple.windowserver.displays.plist 2>/dev/null; echo ""', { maxBuffer: 1024 * 20000 }); + const output = (stdout || '').toString(); + const obj = util.plistReader(output); + if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets']['Configs'] && obj['DisplayAnyUserSets']['Configs'][0] && obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']) { + const current = obj['DisplayAnyUserSets']['Configs'][0]['DisplayConfig']; + let i = 0; + current.forEach((o) => { + if (o['CurrentInfo'] && o['CurrentInfo']['OriginX'] !== undefined && result.displays && result.displays[i]) { + result.displays[i].positionX = o['CurrentInfo']['OriginX']; + } + if (o['CurrentInfo'] && o['CurrentInfo']['OriginY'] !== undefined && result.displays && result.displays[i]) { + result.displays[i].positionY = o['CurrentInfo']['OriginY']; + } + i++; + }); + } + if (obj['DisplayAnyUserSets'] && obj['DisplayAnyUserSets'].length > 0 && obj['DisplayAnyUserSets'][0].length > 0 && obj['DisplayAnyUserSets'][0][0]['DisplayID']) { + const current = obj['DisplayAnyUserSets'][0]; + let i = 0; + current.forEach((o) => { + if ('OriginX' in o && result.displays && result.displays[i]) { + result.displays[i].positionX = o['OriginX']; + } + if ('OriginY' in o && result.displays && result.displays[i]) { + result.displays[i].positionY = o['OriginY']; + } + if (o['Mode'] && o['Mode']['BitsPerPixel'] !== undefined && result.displays && result.displays[i]) { + result.displays[i].pixelDepth = o['Mode']['BitsPerPixel']; + } + i++; + }); + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_linux) { + // Raspberry: https://elinux.org/RPI_vcgencmd_usage + if (util.isRaspberry() && util.isRaspbian()) { + let cmd = 'fbset -s | grep \'mode "\'; vcgencmd get_mem gpu; tvservice -s; tvservice -n;'; + exec(cmd, function (error, stdout) { + let lines = stdout.toString().split('\n'); + if (lines.length > 3 && lines[0].indexOf('mode "') >= -1 && lines[2].indexOf('0x12000a') > -1) { + const parts = lines[0].replace('mode', '').replace(/"/g, '').trim().split('x'); + if (parts.length === 2) { + result.displays.push({ + vendor: '', + model: util.getValue(lines, 'device_name', '='), + main: true, + builtin: false, + connection: 'HDMI', + sizeX: null, + sizeY: null, + pixelDepth: null, + resolutionX: parseInt(parts[0], 10), + resolutionY: parseInt(parts[1], 10), + currentResX: null, + currentResY: null, + positionX: 0, + positionY: 0, + currentRefreshRate: null + }); + } + } + if (lines.length > 1 && stdout.toString().indexOf('gpu=') >= -1) { + result.controllers.push({ + vendor: 'Broadcom', + model: util.getRpiGpu(), + bus: '', + vram: util.getValue(lines, 'gpu', '=').replace('M', ''), + vramDynamic: true + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + let cmd = 'lspci -vvv 2>/dev/null'; + exec(cmd, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.controllers = parseLinesLinuxControllers(lines); + const nvidiaData = nvidiaDevices(); + // needs to be rewritten ... using no spread operators + result.controllers = result.controllers.map((controller) => { // match by busAddress + return mergeControllerNvidia(controller, nvidiaData.find((contr) => contr.pciBus.toLowerCase().endsWith(controller.busAddress.toLowerCase())) || {}); + }); + } + let cmd = 'clinfo --raw'; + exec(cmd, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.controllers = parseLinesLinuxClinfo(result.controllers, lines); + } + let cmd = 'xdpyinfo 2>/dev/null | grep \'depth of root window\' | awk \'{ print $5 }\''; + exec(cmd, function (error, stdout) { + let depth = 0; + if (!error) { + let lines = stdout.toString().split('\n'); + depth = parseInt(lines[0]) || 0; + } + let cmd = 'xrandr --verbose 2>/dev/null'; + exec(cmd, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.displays = parseLinesLinuxDisplays(lines, depth); + } + if (callback) { + callback(result); + } + resolve(result); + }); + }); + }); + }); + } + } + if (_freebsd || _openbsd || _netbsd) { + if (callback) { callback(null); } + resolve(null); + } + if (_sunos) { + if (callback) { callback(null); } + resolve(null); + } + if (_windows) { + + // https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/03/use-powershell-to-discover-multi-monitor-information/ + // https://devblogs.microsoft.com/scripting/use-powershell-to-discover-multi-monitor-information/ + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance win32_VideoController | fl *')); + workload.push(util.powerShell('gp "HKLM:\\SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\*" -ErrorAction SilentlyContinue | where MatchingDeviceId $null -NE | select MatchingDeviceId,HardwareInformation.qwMemorySize | fl')); + workload.push(util.powerShell('Get-CimInstance win32_desktopmonitor | fl *')); + workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl')); + workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens')); + workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl')); + workload.push(util.powerShell('gwmi WmiMonitorID -Namespace root\\wmi | ForEach-Object {(($_.ManufacturerName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.ProductCodeID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.UserFriendlyName -notmatch 0 | foreach {[char]$_}) -join "") + "|" + (($_.SerialNumberID -notmatch 0 | foreach {[char]$_}) -join "") + "|" + $_.InstanceName}')); + + const nvidiaData = nvidiaDevices(); + + Promise.all( + workload + ).then((data) => { + // controller + vram + let csections = data[0].replace(/\r/g, '').split(/\n\s*\n/); + let vsections = data[1].replace(/\r/g, '').split(/\n\s*\n/); + result.controllers = parseLinesWindowsControllers(csections, vsections); + result.controllers = result.controllers.map((controller) => { // match by subDeviceId + if (controller.vendor.toLowerCase() === 'nvidia') { + return mergeControllerNvidia(controller, nvidiaData.find(device => { + let windowsSubDeviceId = (controller.subDeviceId || '').toLowerCase(); + const nvidiaSubDeviceIdParts = device.subDeviceId.split('x'); + let nvidiaSubDeviceId = nvidiaSubDeviceIdParts.length > 1 ? nvidiaSubDeviceIdParts[1].toLowerCase() : nvidiaSubDeviceIdParts[0].toLowerCase(); + const lengthDifference = Math.abs(windowsSubDeviceId.length - nvidiaSubDeviceId.length); + if (windowsSubDeviceId.length > nvidiaSubDeviceId.length) { + for (let i = 0; i < lengthDifference; i++) { + nvidiaSubDeviceId = '0' + nvidiaSubDeviceId; + } + } else if (windowsSubDeviceId.length < nvidiaSubDeviceId.length) { + for (let i = 0; i < lengthDifference; i++) { + windowsSubDeviceId = '0' + windowsSubDeviceId; + } + } + return windowsSubDeviceId === nvidiaSubDeviceId; + }) || {}); + } else { + return controller; + } + }); + + // displays + let dsections = data[2].replace(/\r/g, '').split(/\n\s*\n/); + // result.displays = parseLinesWindowsDisplays(dsections); + if (dsections[0].trim() === '') { dsections.shift(); } + if (dsections.length && dsections[dsections.length - 1].trim() === '') { dsections.pop(); } + + // monitor (powershell) + let msections = data[3].replace(/\r/g, '').split('Active '); + msections.shift(); + + // forms.screens (powershell) + let ssections = data[4].replace(/\r/g, '').split('BitsPerPixel '); + ssections.shift(); + + // connection params (powershell) - video type + let tsections = data[5].replace(/\r/g, '').split(/\n\s*\n/); + tsections.shift(); + + // monitor ID (powershell) - model / vendor + const res = data[6].replace(/\r/g, '').split(/\n/); + let isections = []; + res.forEach(element => { + const parts = element.split('|'); + if (parts.length === 5) { + isections.push({ + vendor: parts[0], + code: parts[1], + model: parts[2], + serial: parts[3], + instanceId: parts[4] + }); + } + }); + + result.displays = parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections); + + if (result.displays.length === 1) { + if (_resolutionX) { + result.displays[0].resolutionX = _resolutionX; + if (!result.displays[0].currentResX) { + result.displays[0].currentResX = _resolutionX; + } + } + if (_resolutionY) { + result.displays[0].resolutionY = _resolutionY; + if (result.displays[0].currentResY === 0) { + result.displays[0].currentResY = _resolutionY; + } + } + if (_pixelDepth) { + result.displays[0].pixelDepth = _pixelDepth; + } + } + result.displays = result.displays.map(element => { + if (_refreshRate && !element.currentRefreshRate) { + element.currentRefreshRate = _refreshRate; + } + return element; + }); + + if (callback) { + callback(result); + } + resolve(result); + }) + .catch(() => { + if (callback) { + callback(result); + } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); + + function parseLinesWindowsControllers(sections, vections) { + const memorySizes = {}; + for (const i in vections) { + if ({}.hasOwnProperty.call(vections, i)) { + if (vections[i].trim() !== '') { + const lines = vections[i].trim().split('\n'); + const matchingDeviceId = util.getValue(lines, 'MatchingDeviceId').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i); + if (matchingDeviceId) { + const quadWordmemorySize = parseInt(util.getValue(lines, 'HardwareInformation.qwMemorySize')); + if (!isNaN(quadWordmemorySize)) { + let deviceId = matchingDeviceId[1].toUpperCase() + '&' + matchingDeviceId[2].toUpperCase(); + if (matchingDeviceId[3]) { + deviceId += '&' + matchingDeviceId[3].toUpperCase(); + } + if (matchingDeviceId[4]) { + deviceId += '&' + matchingDeviceId[4].toUpperCase(); + } + memorySizes[deviceId] = quadWordmemorySize; + } + } + } + } + } + + let controllers = []; + for (let i in sections) { + if ({}.hasOwnProperty.call(sections, i)) { + if (sections[i].trim() !== '') { + let lines = sections[i].trim().split('\n'); + let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', ':').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i); + let subDeviceId = null; + let memorySize = null; + if (pnpDeviceId) { + subDeviceId = pnpDeviceId[3] || ''; + if (subDeviceId) { + subDeviceId = subDeviceId.split('_')[1]; + } + + // Match PCI device identifier (there's an order of increasing generality): + // https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-pci-devices + + // PCI\VEN_v(4)&DEV_d(4)&SUBSYS_s(4)n(4)&REV_r(2) + if (memorySize == null && pnpDeviceId[3] && pnpDeviceId[4]) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[3].toUpperCase() + '&' + pnpDeviceId[4].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + + // PCI\VEN_v(4)&DEV_d(4)&SUBSYS_s(4)n(4) + if (memorySize == null && pnpDeviceId[3]) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[3].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + + // PCI\VEN_v(4)&DEV_d(4)&REV_r(2) + if (memorySize == null && pnpDeviceId[4]) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase() + '&' + pnpDeviceId[4].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + + // PCI\VEN_v(4)&DEV_d(4) + if (memorySize == null) { + const deviceId = pnpDeviceId[1].toUpperCase() + '&' + pnpDeviceId[2].toUpperCase(); + if ({}.hasOwnProperty.call(memorySizes, deviceId)) { + memorySize = memorySizes[deviceId]; + } + } + } + + controllers.push({ + vendor: util.getValue(lines, 'AdapterCompatibility', ':'), + model: util.getValue(lines, 'name', ':'), + bus: util.getValue(lines, 'PNPDeviceID', ':').startsWith('PCI') ? 'PCI' : '', + vram: (memorySize == null ? util.toInt(util.getValue(lines, 'AdapterRAM', ':')) : memorySize) / 1024 / 1024, + vramDynamic: (util.getValue(lines, 'VideoMemoryType', ':') === '2'), + subDeviceId + }); + _resolutionX = util.toInt(util.getValue(lines, 'CurrentHorizontalResolution', ':')) || _resolutionX; + _resolutionY = util.toInt(util.getValue(lines, 'CurrentVerticalResolution', ':')) || _resolutionY; + _refreshRate = util.toInt(util.getValue(lines, 'CurrentRefreshRate', ':')) || _refreshRate; + _pixelDepth = util.toInt(util.getValue(lines, 'CurrentBitsPerPixel', ':')) || _pixelDepth; + } + } + } + return controllers; + } + + function parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections) { + let displays = []; + let vendor = ''; + let model = ''; + let deviceID = ''; + let resolutionX = 0; + let resolutionY = 0; + if (dsections && dsections.length) { + let linesDisplay = dsections[0].split('\n'); + vendor = util.getValue(linesDisplay, 'MonitorManufacturer', ':'); + model = util.getValue(linesDisplay, 'Name', ':'); + deviceID = util.getValue(linesDisplay, 'PNPDeviceID', ':').replace(/&/g, '&').toLowerCase(); + resolutionX = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', ':')); + resolutionY = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', ':')); + } + for (let i = 0; i < ssections.length; i++) { + if (ssections[i].trim() !== '') { + ssections[i] = 'BitsPerPixel ' + ssections[i]; + msections[i] = 'Active ' + msections[i]; + // tsections can be empty OR undefined on earlier versions of powershell (<=2.0) + // Tag connection type as UNKNOWN by default if this information is missing + if (tsections.length === 0 || tsections[i] === undefined) { + tsections[i] = 'Unknown'; + } + let linesScreen = ssections[i].split('\n'); + let linesMonitor = msections[i].split('\n'); + + let linesConnection = tsections[i].split('\n'); + const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel'); + const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').replace(/=/g, ':').split(','); + const primary = util.getValue(linesScreen, 'Primary'); + const sizeX = util.getValue(linesMonitor, 'MaxHorizontalImageSize'); + const sizeY = util.getValue(linesMonitor, 'MaxVerticalImageSize'); + const instanceName = util.getValue(linesMonitor, 'InstanceName').toLowerCase(); + const videoOutputTechnology = util.getValue(linesConnection, 'VideoOutputTechnology'); + const deviceName = util.getValue(linesScreen, 'DeviceName'); + let displayVendor = ''; + let displayModel = ''; + isections.forEach(element => { + if (element.instanceId.toLowerCase().startsWith(instanceName) && vendor.startsWith('(') && model.startsWith('PnP')) { + displayVendor = element.vendor; + displayModel = element.model; + } + }); + displays.push({ + vendor: instanceName.startsWith(deviceID) && displayVendor === '' ? vendor : displayVendor, + model: instanceName.startsWith(deviceID) && displayModel === '' ? model : displayModel, + deviceName, + main: primary.toLowerCase() === 'true', + builtin: videoOutputTechnology === '2147483648', + connection: videoOutputTechnology && videoTypes[videoOutputTechnology] ? videoTypes[videoOutputTechnology] : '', + resolutionX: util.toInt(util.getValue(bounds, 'Width', ':')), + resolutionY: util.toInt(util.getValue(bounds, 'Height', ':')), + sizeX: sizeX ? parseInt(sizeX, 10) : null, + sizeY: sizeY ? parseInt(sizeY, 10) : null, + pixelDepth: bitsPerPixel, + currentResX: util.toInt(util.getValue(bounds, 'Width', ':')), + currentResY: util.toInt(util.getValue(bounds, 'Height', ':')), + positionX: util.toInt(util.getValue(bounds, 'X', ':')), + positionY: util.toInt(util.getValue(bounds, 'Y', ':')), + }); + } + } + if (ssections.length === 0) { + displays.push({ + vendor, + model, + main: true, + sizeX: null, + sizeY: null, + resolutionX, + resolutionY, + pixelDepth: null, + currentResX: resolutionX, + currentResY: resolutionY, + positionX: 0, + positionY: 0 + }); + } + return displays; + } +} + +exports.graphics = graphics; + + +/***/ }), + +/***/ 9042: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// index.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// Contributors: Guillaume Legrain (https://github.com/glegrain) +// Riccardo Novaglia (https://github.com/richy24) +// Quentin Busuttil (https://github.com/Buzut) +// Lapsio (https://github.com/lapsio) +// csy (https://github.com/csy1983) +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== + +// ---------------------------------------------------------------------------------- +// Dependencies +// ---------------------------------------------------------------------------------- + +const lib_version = (__nccwpck_require__(1927)/* .version */ .i8); +const util = __nccwpck_require__(9872); +const system = __nccwpck_require__(3888); +const osInfo = __nccwpck_require__(1067); +const cpu = __nccwpck_require__(8993); +const memory = __nccwpck_require__(6522); +const battery = __nccwpck_require__(7883); +const graphics = __nccwpck_require__(9785); +const filesystem = __nccwpck_require__(9468); +const network = __nccwpck_require__(6486); +const wifi = __nccwpck_require__(6437); +const processes = __nccwpck_require__(7157); +const users = __nccwpck_require__(9750); +const internet = __nccwpck_require__(1456); +const docker = __nccwpck_require__(8600); +const vbox = __nccwpck_require__(1454); +const printer = __nccwpck_require__(5727); +const usb = __nccwpck_require__(1061); +const audio = __nccwpck_require__(9238); +const bluetooth = __nccwpck_require__(8155); + +let _platform = process.platform; +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +// ---------------------------------------------------------------------------------- +// init +// ---------------------------------------------------------------------------------- + +if (_windows) { + util.getCodepage(); +} + +// ---------------------------------------------------------------------------------- +// General +// ---------------------------------------------------------------------------------- + +function version() { + return lib_version; +} + +// ---------------------------------------------------------------------------------- +// Get static and dynamic data (all) +// ---------------------------------------------------------------------------------- + +// -------------------------- +// get static data - they should not change until restarted + +function getStaticData(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let data = {}; + + data.version = version(); + + Promise.all([ + system.system(), + system.bios(), + system.baseboard(), + system.chassis(), + osInfo.osInfo(), + osInfo.uuid(), + osInfo.versions(), + cpu.cpu(), + cpu.cpuFlags(), + graphics.graphics(), + network.networkInterfaces(), + memory.memLayout(), + filesystem.diskLayout() + ]).then((res) => { + data.system = res[0]; + data.bios = res[1]; + data.baseboard = res[2]; + data.chassis = res[3]; + data.os = res[4]; + data.uuid = res[5]; + data.versions = res[6]; + data.cpu = res[7]; + data.cpu.flags = res[8]; + data.graphics = res[9]; + data.net = res[10]; + data.memLayout = res[11]; + data.diskLayout = res[12]; + if (callback) { callback(data); } + resolve(data); + }); + }); + }); +} + + +// -------------------------- +// get all dynamic data - e.g. for monitoring agents +// may take some seconds to get all data +// -------------------------- +// 2 additional parameters needed +// - srv: comma separated list of services to monitor e.g. "mysql, apache, postgresql" +// - iface: define network interface for which you like to monitor network speed e.g. "eth0" + +function getDynamicData(srv, iface, callback) { + + if (util.isFunction(iface)) { + callback = iface; + iface = ''; + } + if (util.isFunction(srv)) { + callback = srv; + srv = ''; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + iface = iface || network.getDefaultNetworkInterface(); + srv = srv || ''; + + // use closure to track ƒ completion + let functionProcessed = (function () { + let totalFunctions = 15; + if (_windows) { totalFunctions = 13; } + if (_freebsd || _openbsd || _netbsd) { totalFunctions = 11; } + if (_sunos) { totalFunctions = 6; } + + return function () { + if (--totalFunctions === 0) { + if (callback) { + callback(data); + } + resolve(data); + } + }; + })(); + + let data = {}; + + // get time + data.time = osInfo.time(); + + /** + * @namespace + * @property {Object} versions + * @property {string} versions.node + * @property {string} versions.v8 + */ + data.node = process.versions.node; + data.v8 = process.versions.v8; + + cpu.cpuCurrentSpeed().then((res) => { + data.cpuCurrentSpeed = res; + functionProcessed(); + }); + + users.users().then((res) => { + data.users = res; + functionProcessed(); + }); + + processes.processes().then((res) => { + data.processes = res; + functionProcessed(); + }); + + cpu.currentLoad().then((res) => { + data.currentLoad = res; + functionProcessed(); + }); + + if (!_sunos) { + cpu.cpuTemperature().then((res) => { + data.temp = res; + functionProcessed(); + }); + } + + if (!_openbsd && !_freebsd && !_netbsd && !_sunos) { + network.networkStats(iface).then((res) => { + data.networkStats = res; + functionProcessed(); + }); + } + + if (!_sunos) { + network.networkConnections().then((res) => { + data.networkConnections = res; + functionProcessed(); + }); + } + + memory.mem().then((res) => { + data.mem = res; + functionProcessed(); + }); + + if (!_sunos) { + battery().then((res) => { + data.battery = res; + functionProcessed(); + }); + } + + if (!_sunos) { + processes.services(srv).then((res) => { + data.services = res; + functionProcessed(); + }); + } + + if (!_sunos) { + filesystem.fsSize().then((res) => { + data.fsSize = res; + functionProcessed(); + }); + } + + if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) { + filesystem.fsStats().then((res) => { + data.fsStats = res; + functionProcessed(); + }); + } + + if (!_windows && !_openbsd && !_freebsd && !_netbsd && !_sunos) { + filesystem.disksIO().then((res) => { + data.disksIO = res; + functionProcessed(); + }); + } + + if (!_openbsd && !_freebsd && !_netbsd && !_sunos) { + wifi.wifiNetworks().then((res) => { + data.wifiNetworks = res; + functionProcessed(); + }); + } + + internet.inetLatency().then((res) => { + data.inetLatency = res; + functionProcessed(); + }); + }); + }); +} + +// -------------------------- +// get all data at once +// -------------------------- +// 2 additional parameters needed +// - srv: comma separated list of services to monitor e.g. "mysql, apache, postgresql" +// - iface: define network interface for which you like to monitor network speed e.g. "eth0" + +function getAllData(srv, iface, callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let data = {}; + + if (iface && util.isFunction(iface) && !callback) { + callback = iface; + iface = ''; + } + + if (srv && util.isFunction(srv) && !iface && !callback) { + callback = srv; + srv = ''; + iface = ''; + } + + getStaticData().then((res) => { + data = res; + getDynamicData(srv, iface).then((res) => { + for (let key in res) { + if ({}.hasOwnProperty.call(res, key)) { + data[key] = res[key]; + } + } + if (callback) { callback(data); } + resolve(data); + }); + }); + }); + }); +} + +function get(valueObject, callback) { + return new Promise((resolve) => { + process.nextTick(() => { + const allPromises = Object.keys(valueObject) + .filter(func => ({}.hasOwnProperty.call(exports, func))) + .map(func => { + const params = valueObject[func].substring(valueObject[func].lastIndexOf('(') + 1, valueObject[func].lastIndexOf(')')); + let funcWithoutParams = func.indexOf(')') >= 0 ? func.split(')')[1].trim() : func; + funcWithoutParams = func.indexOf('|') >= 0 ? func.split('|')[0].trim() : funcWithoutParams; + if (params) { + return exports[funcWithoutParams](params); + } else { + return exports[funcWithoutParams](''); + } + }); + + Promise.all(allPromises).then((data) => { + const result = {}; + let i = 0; + for (let key in valueObject) { + if ({}.hasOwnProperty.call(valueObject, key) && {}.hasOwnProperty.call(exports, key) && data.length > i) { + if (valueObject[key] === '*' || valueObject[key] === 'all') { + result[key] = data[i]; + } else { + let keys = valueObject[key]; + let filter = ''; + let filterParts = []; + // remove params + if (keys.indexOf(')') >= 0) { + keys = keys.split(')')[1].trim(); + } + // extract filter and remove it from keys + if (keys.indexOf('|') >= 0) { + filter = keys.split('|')[1].trim(); + filterParts = filter.split(':'); + + keys = keys.split('|')[0].trim(); + } + keys = keys.replace(/,/g, ' ').replace(/ +/g, ' ').split(' '); + if (data[i]) { + if (Array.isArray(data[i])) { + // result is in an array, go through all elements of array and pick only the right ones + const partialArray = []; + data[i].forEach(element => { + let partialRes = {}; + if (keys.length === 1 && (keys[0] === '*' || keys[0] === 'all')) { + partialRes = element; + } else { + keys.forEach(k => { + if ({}.hasOwnProperty.call(element, k)) { + partialRes[k] = element[k]; + } + }); + } + // if there is a filter, then just take those elements + if (filter && filterParts.length === 2) { + if ({}.hasOwnProperty.call(partialRes, filterParts[0].trim())) { + const val = partialRes[filterParts[0].trim()]; + if (typeof val == 'number') { + if (val === parseFloat(filterParts[1].trim())) { + partialArray.push(partialRes); + } + } else if (typeof val == 'string') { + if (val.toLowerCase() === filterParts[1].trim().toLowerCase()) { + partialArray.push(partialRes); + } + } + } + } else { + partialArray.push(partialRes); + } + + }); + result[key] = partialArray; + } else { + const partialRes = {}; + keys.forEach(k => { + if ({}.hasOwnProperty.call(data[i], k)) { + partialRes[k] = data[i][k]; + } + }); + result[key] = partialRes; + } + } else { + result[key] = {}; + } + } + i++; + } + } + if (callback) { callback(result); } + resolve(result); + }); + }); + }); +} + +function observe(valueObject, interval, callback) { + let _data = null; + + const result = setInterval(() => { + get(valueObject).then((data) => { + if (JSON.stringify(_data) !== JSON.stringify(data)) { + _data = Object.assign({}, data); + callback(data); + } + }); + }, interval); + return result; +} + +// ---------------------------------------------------------------------------------- +// export all libs +// ---------------------------------------------------------------------------------- + +exports.version = version; +exports.system = system.system; +exports.bios = system.bios; +exports.baseboard = system.baseboard; +exports.chassis = system.chassis; + +exports.time = osInfo.time; +exports.osInfo = osInfo.osInfo; +exports.versions = osInfo.versions; +exports.shell = osInfo.shell; +exports.uuid = osInfo.uuid; + +exports.cpu = cpu.cpu; +exports.cpuFlags = cpu.cpuFlags; +exports.cpuCache = cpu.cpuCache; +exports.cpuCurrentSpeed = cpu.cpuCurrentSpeed; +exports.cpuTemperature = cpu.cpuTemperature; +exports.currentLoad = cpu.currentLoad; +exports.fullLoad = cpu.fullLoad; + +exports.mem = memory.mem; +exports.memLayout = memory.memLayout; + +exports.battery = battery; + +exports.graphics = graphics.graphics; + +exports.fsSize = filesystem.fsSize; +exports.fsOpenFiles = filesystem.fsOpenFiles; +exports.blockDevices = filesystem.blockDevices; +exports.fsStats = filesystem.fsStats; +exports.disksIO = filesystem.disksIO; +exports.diskLayout = filesystem.diskLayout; + +exports.networkInterfaceDefault = network.networkInterfaceDefault; +exports.networkGatewayDefault = network.networkGatewayDefault; +exports.networkInterfaces = network.networkInterfaces; +exports.networkStats = network.networkStats; +exports.networkConnections = network.networkConnections; + +exports.wifiNetworks = wifi.wifiNetworks; +exports.wifiInterfaces = wifi.wifiInterfaces; +exports.wifiConnections = wifi.wifiConnections; + +exports.services = processes.services; +exports.processes = processes.processes; +exports.processLoad = processes.processLoad; + +exports.users = users.users; + +exports.inetChecksite = internet.inetChecksite; +exports.inetLatency = internet.inetLatency; + +exports.dockerInfo = docker.dockerInfo; +exports.dockerImages = docker.dockerImages; +exports.dockerContainers = docker.dockerContainers; +exports.dockerContainerStats = docker.dockerContainerStats; +exports.dockerContainerProcesses = docker.dockerContainerProcesses; +exports.dockerVolumes = docker.dockerVolumes; +exports.dockerAll = docker.dockerAll; + +exports.vboxInfo = vbox.vboxInfo; + +exports.printer = printer.printer; + +exports.usb = usb.usb; + +exports.audio = audio.audio; +exports.bluetoothDevices = bluetooth.bluetoothDevices; + +exports.getStaticData = getStaticData; +exports.getDynamicData = getDynamicData; +exports.getAllData = getAllData; +exports.get = get; +exports.observe = observe; + +exports.powerShellStart = util.powerShellStart; +exports.powerShellRelease = util.powerShellRelease; + + +/***/ }), + +/***/ 1456: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// internet.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 12. Internet +// ---------------------------------------------------------------------------------- + +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +// -------------------------- +// check if external site is available + +function inetChecksite(url, callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + url: url, + ok: false, + status: 404, + ms: null + }; + if (typeof url !== 'string') { + if (callback) { callback(result); } + return resolve(result); + } + let urlSanitized = ''; + const s = util.sanitizeShellString(url, true); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + s[i].__proto__.toLowerCase = util.stringToLower; + const sl = s[i].toLowerCase(); + if (sl && sl[0] && !sl[1] && sl[0].length === 1) { + urlSanitized = urlSanitized + sl[0]; + } + } + } + result.url = urlSanitized; + try { + if (urlSanitized && !util.isPrototypePolluted()) { + urlSanitized.__proto__.startsWith = util.stringStartWith; + if (urlSanitized.startsWith('file:') || urlSanitized.startsWith('gopher:') || urlSanitized.startsWith('telnet:') || urlSanitized.startsWith('mailto:') || urlSanitized.startsWith('news:') || urlSanitized.startsWith('nntp:')) { + if (callback) { callback(result); } + return resolve(result); + } + let t = Date.now(); + if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) { + let args = ['-I', '--connect-timeout', '5', '-m', '5']; + args.push(urlSanitized); + let cmd = 'curl'; + util.execSafe(cmd, args).then((stdout) => { + const lines = stdout.split('\n'); + let statusCode = lines[0] && lines[0].indexOf(' ') >= 0 ? parseInt(lines[0].split(' ')[1], 10) : 404; + result.status = statusCode || 404; + result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304); + result.ms = (result.ok ? Date.now() - t : null); + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { // if this is stable, this can be used for all OS types + const http = (urlSanitized.startsWith('https:') ? __nccwpck_require__(5687) : __nccwpck_require__(3685)); + try { + http.get(urlSanitized, (res) => { + const statusCode = res.statusCode; + + result.status = statusCode || 404; + result.ok = (statusCode === 200 || statusCode === 301 || statusCode === 302 || statusCode === 304); + + if (statusCode !== 200) { + res.resume(); + result.ms = (result.ok ? Date.now() - t : null); + if (callback) { callback(result); } + resolve(result); + } else { + res.on('data', () => { }); + res.on('end', () => { + result.ms = (result.ok ? Date.now() - t : null); + if (callback) { callback(result); } + resolve(result); + }); + } + }).on('error', () => { + if (callback) { callback(result); } + resolve(result); + }); + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } catch (err) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} + +exports.inetChecksite = inetChecksite; + +// -------------------------- +// check inet latency + +function inetLatency(host, callback) { + + // fallback - if only callback is given + if (util.isFunction(host) && !callback) { + callback = host; + host = ''; + } + + host = host || '8.8.8.8'; + + return new Promise((resolve) => { + process.nextTick(() => { + if (typeof host !== 'string') { + if (callback) { callback(null); } + return resolve(null); + } + let hostSanitized = ''; + const s = (util.isPrototypePolluted() ? '8.8.8.8' : util.sanitizeShellString(host, true)).trim(); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (!(s[i] === undefined)) { + s[i].__proto__.toLowerCase = util.stringToLower; + const sl = s[i].toLowerCase(); + if (sl && sl[0] && !sl[1]) { + hostSanitized = hostSanitized + sl[0]; + } + } + } + hostSanitized.__proto__.startsWith = util.stringStartWith; + if (hostSanitized.startsWith('file:') || hostSanitized.startsWith('gopher:') || hostSanitized.startsWith('telnet:') || hostSanitized.startsWith('mailto:') || hostSanitized.startsWith('news:') || hostSanitized.startsWith('nntp:')) { + if (callback) { callback(null); } + return resolve(null); + } + let params; + if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { + if (_linux) { + params = ['-c', '2', '-w', '3', hostSanitized]; + } + if (_freebsd || _openbsd || _netbsd) { + params = ['-c', '2', '-t', '3', hostSanitized]; + } + if (_darwin) { + params = ['-c2', '-t3', hostSanitized]; + } + util.execSafe('ping', params).then((stdout) => { + let result = null; + if (stdout) { + const lines = stdout.split('\n').filter((line) => (line.indexOf('rtt') >= 0 || line.indexOf('round-trip') >= 0 || line.indexOf('avg') >= 0)).join('\n'); + + const line = lines.split('='); + if (line.length > 1) { + const parts = line[1].split('/'); + if (parts.length > 1) { + result = parseFloat(parts[1]); + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + const params = ['-s', '-a', hostSanitized, '56', '2']; + const filt = 'avg'; + util.execSafe('ping', params, { timeout: 3000 }).then((stdout) => { + let result = null; + if (stdout) { + const lines = stdout.split('\n').filter(line => line.indexOf(filt) >= 0).join('\n'); + const line = lines.split('='); + if (line.length > 1) { + const parts = line[1].split('/'); + if (parts.length > 1) { + result = parseFloat(parts[1].replace(',', '.')); + } + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { + let result = null; + try { + const params = [hostSanitized, '-n', '1']; + util.execSafe('ping', params, util.execOptsWin).then((stdout) => { + if (stdout) { + let lines = stdout.split('\r\n'); + lines.shift(); + lines.forEach(function (line) { + if ((line.toLowerCase().match(/ms/g) || []).length === 3) { + let l = line.replace(/ +/g, ' ').split(' '); + if (l.length > 6) { + result = parseFloat(l[l.length - 1]); + } + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.inetLatency = inetLatency; + + +/***/ }), + +/***/ 6522: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// memory.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 5. Memory +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const util = __nccwpck_require__(9872); +const fs = __nccwpck_require__(7147); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +const OSX_RAM_manufacturers = { + '0x014F': 'Transcend Information', + '0x2C00': 'Micron Technology Inc.', + '0x802C': 'Micron Technology Inc.', + '0x80AD': 'Hynix Semiconductor Inc.', + '0x80CE': 'Samsung Electronics Inc.', + '0xAD00': 'Hynix Semiconductor Inc.', + '0xCE00': 'Samsung Electronics Inc.', + '0x02FE': 'Elpida', + '0x5105': 'Qimonda AG i. In.', + '0x8551': 'Qimonda AG i. In.', + '0x859B': 'Crucial', + '0x04CD': 'G-Skill' +}; + +const LINUX_RAM_manufacturers = { + '017A': 'Apacer', + '0198': 'HyperX', + '029E': 'Corsair', + '04CB': 'A-DATA', + '04CD': 'G-Skill', + '059B': 'Crucial', + '00CE': 'Samsung', + '1315': 'Crucial', + '014F': 'Transcend Information', + '2C00': 'Micron Technology Inc.', + '802C': 'Micron Technology Inc.', + '80AD': 'Hynix Semiconductor Inc.', + '80CE': 'Samsung Electronics Inc.', + 'AD00': 'Hynix Semiconductor Inc.', + 'CE00': 'Samsung Electronics Inc.', + '02FE': 'Elpida', + '5105': 'Qimonda AG i. In.', + '8551': 'Qimonda AG i. In.', + '859B': 'Crucial' +}; + +// _______________________________________________________________________________________ +// | R A M | H D | +// |______________________|_________________________| | | +// | active buffers/cache | | | +// |________________________________________________|___________|_________|______________| +// | used free | used free | +// |____________________________________________________________|________________________| +// | total | swap | +// |____________________________________________________________|________________________| + +// free (older versions) +// ---------------------------------- +// # free +// total used free shared buffers cached +// Mem: 16038 (1) 15653 (2) 384 (3) 0 (4) 236 (5) 14788 (6) +// -/+ buffers/cache: 628 (7) 15409 (8) +// Swap: 16371 83 16288 +// +// |------------------------------------------------------------| +// | R A M | +// |______________________|_____________________________________| +// | active (2-(5+6) = 7) | available (3+5+6 = 8) | +// |______________________|_________________________|___________| +// | active | buffers/cache (5+6) | | +// |________________________________________________|___________| +// | used (2) | free (3) | +// |____________________________________________________________| +// | total (1) | +// |____________________________________________________________| + +// +// free (since free von procps-ng 3.3.10) +// ---------------------------------- +// # free +// total used free shared buffers/cache available +// Mem: 16038 (1) 628 (2) 386 (3) 0 (4) 15024 (5) 14788 (6) +// Swap: 16371 83 16288 +// +// |------------------------------------------------------------| +// | R A M | +// |______________________|_____________________________________| +// | | available (6) estimated | +// |______________________|_________________________|___________| +// | active (2) | buffers/cache (5) | free (3) | +// |________________________________________________|___________| +// | total (1) | +// |____________________________________________________________| +// +// Reference: http://www.software-architect.net/blog/article/date/2015/06/12/-826c6e5052.html + +// /procs/meminfo - sample (all in kB) +// +// MemTotal: 32806380 kB +// MemFree: 17977744 kB +// MemAvailable: 19768972 kB +// Buffers: 517028 kB +// Cached: 2161876 kB +// SwapCached: 456 kB +// Active: 12081176 kB +// Inactive: 2164616 kB +// Active(anon): 10832884 kB +// Inactive(anon): 1477272 kB +// Active(file): 1248292 kB +// Inactive(file): 687344 kB +// Unevictable: 0 kB +// Mlocked: 0 kB +// SwapTotal: 16768892 kB +// SwapFree: 16768304 kB +// Dirty: 268 kB +// Writeback: 0 kB +// AnonPages: 11568832 kB +// Mapped: 719992 kB +// Shmem: 743272 kB +// Slab: 335716 kB +// SReclaimable: 256364 kB +// SUnreclaim: 79352 kB + +function mem(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + total: os.totalmem(), + free: os.freemem(), + used: os.totalmem() - os.freemem(), + + active: os.totalmem() - os.freemem(), // temporarily (fallback) + available: os.freemem(), // temporarily (fallback) + buffers: 0, + cached: 0, + slab: 0, + buffcache: 0, + + swaptotal: 0, + swapused: 0, + swapfree: 0, + writeback: null, + dirty: null + }; + + if (_linux) { + try { + fs.readFile('/proc/meminfo', function (error, stdout) { + if (!error) { + const lines = stdout.toString().split('\n'); + result.total = parseInt(util.getValue(lines, 'memtotal'), 10); + result.total = result.total ? result.total * 1024 : os.totalmem(); + result.free = parseInt(util.getValue(lines, 'memfree'), 10); + result.free = result.free ? result.free * 1024 : os.freemem(); + result.used = result.total - result.free; + + result.buffers = parseInt(util.getValue(lines, 'buffers'), 10); + result.buffers = result.buffers ? result.buffers * 1024 : 0; + result.cached = parseInt(util.getValue(lines, 'cached'), 10); + result.cached = result.cached ? result.cached * 1024 : 0; + result.slab = parseInt(util.getValue(lines, 'slab'), 10); + result.slab = result.slab ? result.slab * 1024 : 0; + result.buffcache = result.buffers + result.cached + result.slab; + + let available = parseInt(util.getValue(lines, 'memavailable'), 10); + result.available = available ? available * 1024 : result.free + result.buffcache; + result.active = result.total - result.available; + + result.swaptotal = parseInt(util.getValue(lines, 'swaptotal'), 10); + result.swaptotal = result.swaptotal ? result.swaptotal * 1024 : 0; + result.swapfree = parseInt(util.getValue(lines, 'swapfree'), 10); + result.swapfree = result.swapfree ? result.swapfree * 1024 : 0; + result.swapused = result.swaptotal - result.swapfree; + result.writeback = parseInt(util.getValue(lines, 'writeback'), 10); + result.writeback = result.writeback ? result.writeback * 1024 : 0; + result.dirty = parseInt(util.getValue(lines, 'dirty'), 10); + result.dirty = result.dirty ? result.dirty * 1024 : 0; + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + try { + exec('/sbin/sysctl hw.realmem hw.physmem vm.stats.vm.v_page_count vm.stats.vm.v_wire_count vm.stats.vm.v_active_count vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + const pagesize = parseInt(util.getValue(lines, 'vm.stats.vm.v_page_size'), 10); + const inactive = parseInt(util.getValue(lines, 'vm.stats.vm.v_inactive_count'), 10) * pagesize; + const cache = parseInt(util.getValue(lines, 'vm.stats.vm.v_cache_count'), 10) * pagesize; + + result.total = parseInt(util.getValue(lines, 'hw.realmem'), 10); + if (isNaN(result.total)) { result.total = parseInt(util.getValue(lines, 'hw.physmem'), 10); } + result.free = parseInt(util.getValue(lines, 'vm.stats.vm.v_free_count'), 10) * pagesize; + result.buffcache = inactive + cache; + result.available = result.buffcache + result.free; + result.active = result.total - result.free - result.buffcache; + + result.swaptotal = 0; + result.swapfree = 0; + result.swapused = 0; + + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_darwin) { + let pageSize = 4096; + try { + let sysPpageSize = util.toInt(execSync('sysctl -n vm.pagesize').toString()); + pageSize = sysPpageSize || pageSize; + } catch (e) { + util.noop(); + } + try { + exec('vm_stat 2>/dev/null | grep "Pages active"', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + + result.active = parseInt(lines[0].split(':')[1], 10) * pageSize; + result.buffcache = result.used - result.active; + result.available = result.free + result.buffcache; + } + exec('sysctl -n vm.swapusage 2>/dev/null', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + if (lines.length > 0) { + let firstline = lines[0].replace(/,/g, '.').replace(/M/g, ''); + let lineArray = firstline.trim().split(' '); + lineArray.forEach(line => { + if (line.toLowerCase().indexOf('total') !== -1) { result.swaptotal = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; } + if (line.toLowerCase().indexOf('used') !== -1) { result.swapused = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; } + if (line.toLowerCase().indexOf('free') !== -1) { result.swapfree = parseFloat(line.split('=')[1].trim()) * 1024 * 1024; } + }); + } + } + if (callback) { callback(result); } + resolve(result); + }); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + let swaptotal = 0; + let swapused = 0; + try { + util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => { + if (!error) { + let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); + lines.forEach(function (line) { + if (line !== '') { + line = line.trim().split(/\s\s+/); + swaptotal = swaptotal + (parseInt(line[0], 10) || 0); + swapused = swapused + (parseInt(line[1], 10) || 0); + } + }); + } + result.swaptotal = swaptotal * 1024 * 1024; + result.swapused = swapused * 1024 * 1024; + result.swapfree = result.swaptotal - result.swapused; + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.mem = mem; + +function memLayout(callback) { + + function getManufacturerDarwin(manId) { + if ({}.hasOwnProperty.call(OSX_RAM_manufacturers, manId)) { + return (OSX_RAM_manufacturers[manId]); + } + return manId; + } + + function getManufacturerLinux(manId) { + const manIdSearch = manId.replace('0x', '').toUpperCase(); + if (manIdSearch.length === 4 && {}.hasOwnProperty.call(LINUX_RAM_manufacturers, manIdSearch)) { + return (LINUX_RAM_manufacturers[manIdSearch]); + } + return manId; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = []; + + if (_linux || _freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t memory 2>/dev/null | grep -iE "Size:|Type|Speed|Manufacturer|Form Factor|Locator|Memory Device|Serial Number|Voltage|Part Number"; unset LC_ALL', function (error, stdout) { + if (!error) { + let devices = stdout.toString().split('Memory Device'); + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\n'); + const sizeString = util.getValue(lines, 'Size'); + const size = sizeString.indexOf('GB') >= 0 ? parseInt(sizeString, 10) * 1024 * 1024 * 1024 : parseInt(sizeString, 10) * 1024 * 1024; + let bank = util.getValue(lines, 'Bank Locator'); + if (bank.toLowerCase().indexOf('bad') >= 0) { + bank = ''; + } + if (parseInt(util.getValue(lines, 'Size'), 10) > 0) { + const totalWidth = util.toInt(util.getValue(lines, 'Total Width')); + const dataWidth = util.toInt(util.getValue(lines, 'Data Width')); + result.push({ + size, + bank, + type: util.getValue(lines, 'Type:'), + ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false, + clockSpeed: (util.getValue(lines, 'Configured Clock Speed:') ? parseInt(util.getValue(lines, 'Configured Clock Speed:'), 10) : (util.getValue(lines, 'Speed:') ? parseInt(util.getValue(lines, 'Speed:'), 10) : null)), + formFactor: util.getValue(lines, 'Form Factor:'), + manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')), + partNum: util.getValue(lines, 'Part Number:'), + serialNum: util.getValue(lines, 'Serial Number:'), + voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null, + voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null, + voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:')) || null, + }); + } else { + result.push({ + size: 0, + bank, + type: 'Empty', + ecc: null, + clockSpeed: 0, + formFactor: util.getValue(lines, 'Form Factor:'), + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + } + }); + } + if (!result.length) { + result.push({ + size: os.totalmem(), + bank: '', + type: '', + ecc: null, + clockSpeed: 0, + formFactor: '', + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + + // Try Raspberry PI + try { + let stdout = execSync('cat /proc/cpuinfo 2>/dev/null', util.execOptsLinux); + let lines = stdout.toString().split('\n'); + let model = util.getValue(lines, 'hardware', ':', true).toUpperCase(); + let version = util.getValue(lines, 'revision', ':', true).toLowerCase(); + + if (model === 'BCM2835' || model === 'BCM2708' || model === 'BCM2709' || model === 'BCM2835' || model === 'BCM2837') { + + const clockSpeed = { + '0': 400, + '1': 450, + '2': 450, + '3': 3200 + }; + result[0].type = 'LPDDR2'; + result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type; + result[0].ecc = false; + result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400; + result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed; + result[0].formFactor = 'SoC'; + + stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null', util.execOptsLinux); + lines = stdout.toString().split('\n'); + let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0; + if (freq) { + result[0].clockSpeed = freq; + } + + stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null', util.execOptsLinux); + lines = stdout.toString().split('\n'); + let voltage = parseFloat(util.getValue(lines, 'volt', '=', true)) || 0; + if (voltage) { + result[0].voltageConfigured = voltage; + result[0].voltageMin = voltage; + result[0].voltageMax = voltage; + } + } + } catch (e) { + util.noop(); + } + + } + if (callback) { callback(result); } + resolve(result); + }); + } + + if (_darwin) { + exec('system_profiler SPMemoryDataType', function (error, stdout) { + if (!error) { + const allLines = stdout.toString().split('\n'); + const eccStatus = util.getValue(allLines, 'ecc', ':', true).toLowerCase(); + let devices = stdout.toString().split(' BANK '); + let hasBank = true; + if (devices.length === 1) { + devices = stdout.toString().split(' DIMM'); + hasBank = false; + } + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\n'); + const bank = (hasBank ? 'BANK ' : 'DIMM') + lines[0].trim().split('/')[0]; + const size = parseInt(util.getValue(lines, ' Size')); + if (size) { + result.push({ + size: size * 1024 * 1024 * 1024, + bank: bank, + type: util.getValue(lines, ' Type:'), + ecc: eccStatus ? eccStatus === 'enabled' : null, + clockSpeed: parseInt(util.getValue(lines, ' Speed:'), 10), + formFactor: '', + manufacturer: getManufacturerDarwin(util.getValue(lines, ' Manufacturer:')), + partNum: util.getValue(lines, ' Part Number:'), + serialNum: util.getValue(lines, ' Serial Number:'), + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + } else { + result.push({ + size: 0, + bank: bank, + type: 'Empty', + ecc: null, + clockSpeed: 0, + formFactor: '', + manufacturer: '', + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + } + }); + } + if (!result.length) { + const lines = stdout.toString().split('\n'); + const size = parseInt(util.getValue(lines, ' Memory:')); + const type = util.getValue(lines, ' Type:'); + if (size && type) { + result.push({ + size: size * 1024 * 1024 * 1024, + bank: '0', + type, + ecc: false, + clockSpeed: 0, + formFactor: '', + manufacturer: 'Apple', + partNum: '', + serialNum: '', + voltageConfigured: null, + voltageMin: null, + voltageMax: null, + }); + + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + // https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.4.0a.pdf + const memoryTypes = 'Unknown|Other|DRAM|Synchronous DRAM|Cache DRAM|EDO|EDRAM|VRAM|SRAM|RAM|ROM|FLASH|EEPROM|FEPROM|EPROM|CDRAM|3DRAM|SDRAM|SGRAM|RDRAM|DDR|DDR2|DDR2 FB-DIMM|Reserved|DDR3|FBD2|DDR4|LPDDR|LPDDR2|LPDDR3|LPDDR4|Logical non-volatile device|HBM|HBM2|DDR5|LPDDR5'.split('|'); + const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|'); + + try { + util.powerShell('Get-CimInstance Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage,Tag | fl').then((stdout, error) => { + if (!error) { + let devices = stdout.toString().split(/\n\s*\n/); + devices.shift(); + devices.forEach(function (device) { + let lines = device.split('\r\n'); + const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':')); + const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':')); + const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0; + const tag = util.getValue(lines, 'Tag', ':'); + const tagInt = util.splitByNumber(tag); + if (size) { + result.push({ + size, + bank: util.getValue(lines, 'BankLabel', ':') + (tagInt[1] ? '/' + tagInt[1] : ''), // BankLabel + type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)], + ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false, + clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0, + formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0], + manufacturer: util.getValue(lines, 'Manufacturer', ':'), + partNum: util.getValue(lines, 'PartNumber', ':'), + serialNum: util.getValue(lines, 'SerialNumber', ':'), + voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0, + voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0, + voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0, + }); + } + }); + } + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.memLayout = memLayout; + + + +/***/ }), + +/***/ 6486: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// network.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 9. Network +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const fs = __nccwpck_require__(7147); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +let _network = {}; +let _default_iface = ''; +let _ifaces = {}; +let _dhcpNics = []; +let _networkInterfaces = []; +let _mac = {}; +let pathToIp; + +function getDefaultNetworkInterface() { + + let ifacename = ''; + let ifacenameFirst = ''; + try { + let ifaces = os.networkInterfaces(); + + let scopeid = 9999; + + // fallback - "first" external interface (sorted by scopeid) + for (let dev in ifaces) { + if ({}.hasOwnProperty.call(ifaces, dev)) { + ifaces[dev].forEach(function (details) { + if (details && details.internal === false) { + ifacenameFirst = ifacenameFirst || dev; // fallback if no scopeid + if (details.scopeid && details.scopeid < scopeid) { + ifacename = dev; + scopeid = details.scopeid; + } + } + }); + } + } + ifacename = ifacename || ifacenameFirst || ''; + + if (_windows) { + // https://www.inetdaemon.com/tutorials/internet/ip/routing/default_route.shtml + let defaultIp = ''; + const cmd = 'netstat -r'; + const result = execSync(cmd, util.execOptsWin); + const lines = result.toString().split(os.EOL); + lines.forEach(line => { + line = line.replace(/\s+/g, ' ').trim(); + if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) { + const parts = line.split(' '); + if (parts.length >= 5) { + defaultIp = parts[parts.length - 2]; + } + } + }); + if (defaultIp) { + for (let dev in ifaces) { + if ({}.hasOwnProperty.call(ifaces, dev)) { + ifaces[dev].forEach(function (details) { + if (details && details.address && details.address === defaultIp) { + ifacename = dev; + } + }); + } + } + } + } + if (_linux) { + let cmd = 'ip route 2> /dev/null | grep default'; + let result = execSync(cmd, util.execOptsLinux); + let parts = result.toString().split('\n')[0].split(/\s+/); + if (parts[0] === 'none' && parts[5]) { + ifacename = parts[5]; + } else if (parts[4]) { + ifacename = parts[4]; + } + + if (ifacename.indexOf(':') > -1) { + ifacename = ifacename.split(':')[1].trim(); + } + } + if (_darwin || _freebsd || _openbsd || _netbsd || _sunos) { + let cmd = ''; + if (_linux) { cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\''; } + if (_darwin) { cmd = 'route -n get default 2>/dev/null | grep interface: | awk \'{print $2}\''; } + if (_freebsd || _openbsd || _netbsd || _sunos) { cmd = 'route get 0.0.0.0 | grep interface:'; } + let result = execSync(cmd); + ifacename = result.toString().split('\n')[0]; + if (ifacename.indexOf(':') > -1) { + ifacename = ifacename.split(':')[1].trim(); + } + } + } catch (e) { + util.noop(); + } + if (ifacename) { _default_iface = ifacename; } + return _default_iface; +} + +exports.getDefaultNetworkInterface = getDefaultNetworkInterface; + +function getMacAddresses() { + let iface = ''; + let mac = ''; + let result = {}; + if (_linux || _freebsd || _openbsd || _netbsd) { + if (typeof pathToIp === 'undefined') { + try { + const lines = execSync('which ip', util.execOptsLinux).toString().split('\n'); + if (lines.length && lines[0].indexOf(':') === -1 && lines[0].indexOf('/') === 0) { + pathToIp = lines[0]; + } else { + pathToIp = ''; + } + } catch (e) { + pathToIp = ''; + } + } + try { + const cmd = 'export LC_ALL=C; ' + ((pathToIp) ? pathToIp + ' link show up' : '/sbin/ifconfig') + '; unset LC_ALL'; + let res = execSync(cmd, util.execOptsLinux); + const lines = res.toString().split('\n'); + for (let i = 0; i < lines.length; i++) { + if (lines[i] && lines[i][0] !== ' ') { + if (pathToIp) { + let nextline = lines[i + 1].trim().split(' '); + if (nextline[0] === 'link/ether') { + iface = lines[i].split(' ')[1]; + iface = iface.slice(0, iface.length - 1); + mac = nextline[1]; + } + } else { + iface = lines[i].split(' ')[0]; + mac = lines[i].split('HWaddr ')[1]; + } + + if (iface && mac) { + result[iface] = mac.trim(); + iface = ''; + mac = ''; + } + } + } + } catch (e) { + util.noop(); + } + } + if (_darwin) { + try { + const cmd = '/sbin/ifconfig'; + let res = execSync(cmd); + const lines = res.toString().split('\n'); + for (let i = 0; i < lines.length; i++) { + if (lines[i] && lines[i][0] !== '\t' && lines[i].indexOf(':') > 0) { + iface = lines[i].split(':')[0]; + } else if (lines[i].indexOf('\tether ') === 0) { + mac = lines[i].split('\tether ')[1]; + if (iface && mac) { + result[iface] = mac.trim(); + iface = ''; + mac = ''; + } + } + } + } catch (e) { + util.noop(); + } + } + return result; +} + +function networkInterfaceDefault(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = getDefaultNetworkInterface(); + if (callback) { callback(result); } + resolve(result); + }); + }); +} + +exports.networkInterfaceDefault = networkInterfaceDefault; + +// -------------------------- +// NET - interfaces + +function parseLinesWindowsNics(sections, nconfigsections) { + let nics = []; + for (let i in sections) { + if ({}.hasOwnProperty.call(sections, i)) { + + if (sections[i].trim() !== '') { + + let lines = sections[i].trim().split('\r\n'); + let linesNicConfig = nconfigsections && nconfigsections[i] ? nconfigsections[i].trim().split('\r\n') : []; + let netEnabled = util.getValue(lines, 'NetEnabled', ':'); + let adapterType = util.getValue(lines, 'AdapterTypeID', ':') === '9' ? 'wireless' : 'wired'; + let ifacename = util.getValue(lines, 'Name', ':').replace(/\]/g, ')').replace(/\[/g, '('); + let iface = util.getValue(lines, 'NetConnectionID', ':').replace(/\]/g, ')').replace(/\[/g, '('); + if (ifacename.toLowerCase().indexOf('wi-fi') >= 0 || ifacename.toLowerCase().indexOf('wireless') >= 0) { + adapterType = 'wireless'; + } + if (netEnabled !== '') { + const speed = parseInt(util.getValue(lines, 'speed', ':').trim(), 10) / 1000000; + nics.push({ + mac: util.getValue(lines, 'MACAddress', ':').toLowerCase(), + dhcp: util.getValue(linesNicConfig, 'dhcpEnabled', ':').toLowerCase() === 'true', + name: ifacename, + iface, + netEnabled: netEnabled === 'TRUE', + speed: isNaN(speed) ? null : speed, + operstate: util.getValue(lines, 'NetConnectionStatus', ':') === '2' ? 'up' : 'down', + type: adapterType + }); + } + } + } + } + return nics; +} + +function getWindowsNics() { + return new Promise((resolve) => { + process.nextTick(() => { + let cmd = 'Get-CimInstance Win32_NetworkAdapter | fl *' + '; echo \'#-#-#-#\';'; + cmd += 'Get-CimInstance Win32_NetworkAdapterConfiguration | fl DHCPEnabled' + ''; + try { + util.powerShell(cmd).then((data) => { + data = data.split('#-#-#-#'); + const nsections = (data[0] || '').split(/\n\s*\n/); + const nconfigsections = (data[1] || '').split(/\n\s*\n/); + resolve(parseLinesWindowsNics(nsections, nconfigsections)); + }); + } catch (e) { + resolve([]); + } + }); + }); +} + +function getWindowsDNSsuffixes() { + + let iface = {}; + + let dnsSuffixes = { + primaryDNS: '', + exitCode: 0, + ifaces: [], + }; + + try { + const ipconfig = execSync('ipconfig /all', util.execOptsWin); + const ipconfigArray = ipconfig.split('\r\n\r\n'); + + ipconfigArray.forEach((element, index) => { + + if (index == 1) { + const longPrimaryDNS = element.split('\r\n').filter((element) => { + return element.toUpperCase().includes('DNS'); + }); + const primaryDNS = longPrimaryDNS[0].substring(longPrimaryDNS[0].lastIndexOf(':') + 1); + dnsSuffixes.primaryDNS = primaryDNS.trim(); + if (!dnsSuffixes.primaryDNS) { dnsSuffixes.primaryDNS = 'Not defined'; } + } + if (index > 1) { + if (index % 2 == 0) { + const name = element.substring(element.lastIndexOf(' ') + 1).replace(':', ''); + iface.name = name; + } else { + const connectionSpecificDNS = element.split('\r\n').filter((element) => { + return element.toUpperCase().includes('DNS'); + }); + const dnsSuffix = connectionSpecificDNS[0].substring(connectionSpecificDNS[0].lastIndexOf(':') + 1); + iface.dnsSuffix = dnsSuffix.trim(); + dnsSuffixes.ifaces.push(iface); + iface = {}; + } + } + }); + + return dnsSuffixes; + } catch (error) { + return { + primaryDNS: '', + exitCode: 0, + ifaces: [], + }; + } +} + +function getWindowsIfaceDNSsuffix(ifaces, ifacename) { + let dnsSuffix = ''; + // Adding (.) to ensure ifacename compatibility when duplicated iface-names + const interfaceName = ifacename + '.'; + try { + const connectionDnsSuffix = ifaces.filter((iface) => { + return interfaceName.includes(iface.name + '.'); + }).map((iface) => iface.dnsSuffix); + if (connectionDnsSuffix[0]) { + dnsSuffix = connectionDnsSuffix[0]; + } + if (!dnsSuffix) { dnsSuffix = ''; } + return dnsSuffix; + } catch (error) { + return 'Unknown'; + } +} + +function getWindowsWiredProfilesInformation() { + try { + const result = execSync('netsh lan show profiles', util.execOptsWin); + const profileList = result.split('\r\nProfile on interface'); + return profileList; + } catch (error) { + if (error.status === 1 && error.stdout.includes('AutoConfig')) { + return 'Disabled'; + } + return []; + } +} + +function getWindowsWirelessIfaceSSID(interfaceName) { + try { + const result = execSync(`netsh wlan show interface name="${interfaceName}" | findstr "SSID"`, util.execOptsWin); + const SSID = result.split('\r\n').shift(); + const parseSSID = SSID.split(':').pop(); + return parseSSID; + } catch (error) { + return 'Unknown'; + } +} +function getWindowsIEEE8021x(connectionType, iface, ifaces) { + let i8021x = { + state: 'Unknown', + protocol: 'Unknown', + }; + + if (ifaces === 'Disabled') { + i8021x.state = 'Disabled'; + i8021x.protocol = 'Not defined'; + return i8021x; + } + + if (connectionType == 'wired' && ifaces.length > 0) { + try { + // Get 802.1x information by interface name + const iface8021xInfo = ifaces.find((element) => { + return element.includes(iface + '\r\n'); + }); + const arrayIface8021xInfo = iface8021xInfo.split('\r\n'); + const state8021x = arrayIface8021xInfo.find((element) => { + return element.includes('802.1x'); + }); + + if (state8021x.includes('Disabled')) { + i8021x.state = 'Disabled'; + i8021x.protocol = 'Not defined'; + } else if (state8021x.includes('Enabled')) { + const protocol8021x = arrayIface8021xInfo.find((element) => { + return element.includes('EAP'); + }); + i8021x.protocol = protocol8021x.split(':').pop(); + i8021x.state = 'Enabled'; + } + } catch (error) { + return i8021x; + } + } else if (connectionType == 'wireless') { + + let i8021xState = ''; + let i8021xProtocol = ''; + + + + try { + const SSID = getWindowsWirelessIfaceSSID(iface); + if (SSID !== 'Unknown') { + i8021xState = execSync(`netsh wlan show profiles "${SSID}" | findstr "802.1X"`, util.execOptsWin); + i8021xProtocol = execSync(`netsh wlan show profiles "${SSID}" | findstr "EAP"`, util.execOptsWin); + } + + if (i8021xState.includes(':') && i8021xProtocol.includes(':')) { + i8021x.state = i8021xState.split(':').pop(); + i8021x.protocol = i8021xProtocol.split(':').pop(); + } + } catch (error) { + if (error.status === 1 && error.stdout.includes('AutoConfig')) { + i8021x.state = 'Disabled'; + i8021x.protocol = 'Not defined'; + } + return i8021x; + } + } + + return i8021x; +} + +function splitSectionsNics(lines) { + const result = []; + let section = []; + lines.forEach(function (line) { + if (!line.startsWith('\t') && !line.startsWith(' ')) { + if (section.length) { + result.push(section); + section = []; + } + } + section.push(line); + }); + if (section.length) { + result.push(section); + } + return result; +} + +function parseLinesDarwinNics(sections) { + let nics = []; + sections.forEach(section => { + let nic = { + iface: '', + mtu: null, + mac: '', + ip6: '', + ip4: '', + speed: null, + type: '', + operstate: '', + duplex: '', + internal: false + }; + const first = section[0]; + nic.iface = first.split(':')[0].trim(); + let parts = first.split('> mtu'); + nic.mtu = parts.length > 1 ? parseInt(parts[1], 10) : null; + if (isNaN(nic.mtu)) { + nic.mtu = null; + } + nic.internal = parts[0].toLowerCase().indexOf('loopback') > -1; + section.forEach(line => { + if (line.trim().startsWith('ether ')) { + nic.mac = line.split('ether ')[1].toLowerCase().trim(); + } + if (line.trim().startsWith('inet6 ') && !nic.ip6) { + nic.ip6 = line.split('inet6 ')[1].toLowerCase().split('%')[0].split(' ')[0]; + } + if (line.trim().startsWith('inet ') && !nic.ip4) { + nic.ip4 = line.split('inet ')[1].toLowerCase().split(' ')[0]; + } + }); + let speed = util.getValue(section, 'link rate'); + nic.speed = speed ? parseFloat(speed) : null; + if (nic.speed === null) { + speed = util.getValue(section, 'uplink rate'); + nic.speed = speed ? parseFloat(speed) : null; + if (nic.speed !== null && speed.toLowerCase().indexOf('gbps') >= 0) { + nic.speed = nic.speed * 1000; + } + } else { + if (speed.toLowerCase().indexOf('gbps') >= 0) { + nic.speed = nic.speed * 1000; + } + } + nic.type = util.getValue(section, 'type').toLowerCase().indexOf('wi-fi') > -1 ? 'wireless' : 'wired'; + const operstate = util.getValue(section, 'status').toLowerCase(); + nic.operstate = (operstate === 'active' ? 'up' : (operstate === 'inactive' ? 'down' : 'unknown')); + nic.duplex = util.getValue(section, 'media').toLowerCase().indexOf('half-duplex') > -1 ? 'half' : 'full'; + if (nic.ip6 || nic.ip4 || nic.mac) { + nics.push(nic); + } + }); + return nics; +} + +function getDarwinNics() { + const cmd = '/sbin/ifconfig -v'; + try { + const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n'); + const nsections = splitSectionsNics(lines); + return (parseLinesDarwinNics(nsections)); + } catch (e) { + return []; + } +} + +function getLinuxIfaceConnectionName(interfaceName) { + const cmd = `nmcli device status 2>/dev/null | grep ${interfaceName}`; + + try { + const result = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = result.replace(/\s+/g, ' ').trim(); + const connectionNameLines = resultFormat.split(' ').slice(3); + const connectionName = connectionNameLines.join(' '); + return connectionName != '--' ? connectionName : ''; + } catch (e) { + return ''; + } +} + +function checkLinuxDCHPInterfaces(file) { + let result = []; + try { + let cmd = `cat ${file} 2> /dev/null | grep 'iface\\|source'`; + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + + lines.forEach(line => { + const parts = line.replace(/\s+/g, ' ').trim().split(' '); + if (parts.length >= 4) { + if (line.toLowerCase().indexOf(' inet ') >= 0 && line.toLowerCase().indexOf('dhcp') >= 0) { + result.push(parts[1]); + } + } + if (line.toLowerCase().includes('source')) { + let file = line.split(' ')[1]; + result = result.concat(checkLinuxDCHPInterfaces(file)); + } + }); + } catch (e) { + util.noop(); + } + return result; +} + +function getLinuxDHCPNics() { + // alternate methods getting interfaces using DHCP + let cmd = 'ip a 2> /dev/null'; + let result = []; + try { + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const nsections = splitSectionsNics(lines); + result = (parseLinuxDHCPNics(nsections)); + } catch (e) { + util.noop(); + } + try { + result = checkLinuxDCHPInterfaces('/etc/network/interfaces'); + } catch (e) { + util.noop(); + } + return result; +} + +function parseLinuxDHCPNics(sections) { + const result = []; + if (sections && sections.length) { + sections.forEach(lines => { + if (lines && lines.length) { + const parts = lines[0].split(':'); + if (parts.length > 2) { + for (let line of lines) { + if (line.indexOf(' inet ') >= 0 && line.indexOf(' dynamic ') >= 0) { + const parts2 = line.split(' '); + const nic = parts2[parts2.length - 1].trim(); + result.push(nic); + break; + } + } + } + } + }); + } + return result; +} + +function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) { + let result = false; + if (connectionName) { + const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.method;`; + try { + const lines = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = lines.replace(/\s+/g, ' ').trim(); + + let dhcStatus = resultFormat.split(' ').slice(1).toString(); + switch (dhcStatus) { + case 'auto': + result = true; + break; + + default: + result = false; + break; + } + return result; + } catch (e) { + return (DHCPNics.indexOf(iface) >= 0); + } + } else { + return (DHCPNics.indexOf(iface) >= 0); + } +} + +function getDarwinIfaceDHCPstatus(iface) { + let result = false; + const cmd = `ipconfig getpacket "${iface}" 2>/dev/null | grep lease_time;`; + try { + const lines = execSync(cmd).toString().split('\n'); + if (lines.length && lines[0].startsWith('lease_time')) { + result = true; + } + } catch (e) { + util.noop(); + } + return result; +} + +function getLinuxIfaceDNSsuffix(connectionName) { + if (connectionName) { + const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep ipv4.dns-search;`; + try { + const result = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = result.replace(/\s+/g, ' ').trim(); + const dnsSuffix = resultFormat.split(' ').slice(1).toString(); + return dnsSuffix == '--' ? 'Not defined' : dnsSuffix; + } catch (e) { + return 'Unknown'; + } + } else { + return 'Unknown'; + } +} + +function getLinuxIfaceIEEE8021xAuth(connectionName) { + if (connectionName) { + const cmd = `nmcli connection show "${connectionName}" 2>/dev/null | grep 802-1x.eap;`; + try { + const result = execSync(cmd, util.execOptsLinux).toString(); + const resultFormat = result.replace(/\s+/g, ' ').trim(); + const authenticationProtocol = resultFormat.split(' ').slice(1).toString(); + + + return authenticationProtocol == '--' ? '' : authenticationProtocol; + } catch (e) { + return 'Not defined'; + } + } else { + return 'Not defined'; + } +} + +function getLinuxIfaceIEEE8021xState(authenticationProtocol) { + if (authenticationProtocol) { + if (authenticationProtocol == 'Not defined') { + return 'Disabled'; + } + return 'Enabled'; + } else { + return 'Unknown'; + } +} + +function testVirtualNic(iface, ifaceName, mac) { + const virtualMacs = ['00:00:00:00:00:00', '00:03:FF', '00:05:69', '00:0C:29', '00:0F:4B', '00:13:07', '00:13:BE', '00:15:5d', '00:16:3E', '00:1C:42', '00:21:F6', '00:24:0B', '00:50:56', '00:A0:B1', '00:E0:C8', '08:00:27', '0A:00:27', '18:92:2C', '16:DF:49', '3C:F3:92', '54:52:00', 'FC:15:97']; + if (mac) { + return virtualMacs.filter(item => { return mac.toUpperCase().toUpperCase().startsWith(item.substring(0, mac.length)); }).length > 0 || + iface.toLowerCase().indexOf(' virtual ') > -1 || + ifaceName.toLowerCase().indexOf(' virtual ') > -1 || + iface.toLowerCase().indexOf('vethernet ') > -1 || + ifaceName.toLowerCase().indexOf('vethernet ') > -1 || + iface.toLowerCase().startsWith('veth') || + ifaceName.toLowerCase().startsWith('veth') || + iface.toLowerCase().startsWith('vboxnet') || + ifaceName.toLowerCase().startsWith('vboxnet'); + } else { return false; } +} + +function networkInterfaces(callback, rescan, defaultString) { + + if (typeof callback === 'string') { + defaultString = callback; + rescan = true; + callback = null; + } + + if (typeof callback === 'boolean') { + rescan = callback; + callback = null; + defaultString = ''; + } + if (typeof rescan === 'undefined') { + rescan = true; + } + defaultString = defaultString || ''; + defaultString = '' + defaultString; + + return new Promise((resolve) => { + process.nextTick(() => { + + let ifaces = os.networkInterfaces(); + + let result = []; + let nics = []; + let dnsSuffixes = []; + let nics8021xInfo = []; + // seperate handling in OSX + if (_darwin || _freebsd || _openbsd || _netbsd) { + if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) { + // no changes - just return object + result = _networkInterfaces; + + if (callback) { callback(result); } + resolve(result); + } else { + const defaultInterface = getDefaultNetworkInterface(); + _ifaces = JSON.parse(JSON.stringify(ifaces)); + + nics = getDarwinNics(); + + + nics.forEach(nic => { + + if ({}.hasOwnProperty.call(ifaces, nic.iface)) { + ifaces[nic.iface].forEach(function (details) { + if (details.family === 'IPv4' || details.family === 4) { + nic.ip4subnet = details.netmask; + } + if (details.family === 'IPv6' || details.family === 6) { + nic.ip6subnet = details.netmask; + } + }); + } + + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(nic.iface); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + result.push({ + iface: nic.iface, + ifaceName: nic.iface, + default: nic.iface === defaultInterface, + ip4: nic.ip4, + ip4subnet: nic.ip4subnet || '', + ip6: nic.ip6, + ip6subnet: nic.ip6subnet || '', + mac: nic.mac, + internal: nic.internal, + virtual: nic.internal ? false : testVirtualNic(nic.iface, nic.iface, nic.mac), + operstate: nic.operstate, + type: nic.type, + duplex: nic.duplex, + mtu: nic.mtu, + speed: nic.speed, + dhcp: getDarwinIfaceDHCPstatus(ifaceSanitized), + dnsSuffix: '', + ieee8021xAuth: '', + ieee8021xState: '', + carrierChanges: 0 + }); + }); + _networkInterfaces = result; + if (defaultString.toLowerCase().indexOf('default') >= 0) { + result = result.filter(item => item.default); + if (result.length > 0) { + result = result[0]; + } else { + result = []; + } + } + if (callback) { callback(result); } + resolve(result); + } + } + if (_linux) { + if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) { + // no changes - just return object + result = _networkInterfaces; + + if (callback) { callback(result); } + resolve(result); + } else { + _ifaces = JSON.parse(JSON.stringify(ifaces)); + _dhcpNics = getLinuxDHCPNics(); + const defaultInterface = getDefaultNetworkInterface(); + for (let dev in ifaces) { + let ip4 = ''; + let ip4subnet = ''; + let ip6 = ''; + let ip6subnet = ''; + let mac = ''; + let duplex = ''; + let mtu = ''; + let speed = null; + let carrierChanges = 0; + let dhcp = false; + let dnsSuffix = ''; + let ieee8021xAuth = ''; + let ieee8021xState = ''; + let type = ''; + + if ({}.hasOwnProperty.call(ifaces, dev)) { + let ifaceName = dev; + ifaces[dev].forEach(function (details) { + if (details.family === 'IPv4' || details.family === 4) { + ip4 = details.address; + ip4subnet = details.netmask; + } + if (details.family === 'IPv6' || details.family === 6) { + if (!ip6 || ip6.match(/^fe80::/i)) { + ip6 = details.address; + ip6subnet = details.netmask; + } + } + mac = details.mac; + // fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2) + const nodeMainVersion = parseInt(process.versions.node.split('.'), 10); + if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && (!details.internal) && nodeMainVersion >= 8 && nodeMainVersion <= 11) { + if (Object.keys(_mac).length === 0) { + _mac = getMacAddresses(); + } + mac = _mac[dev] || ''; + } + }); + let iface = dev.split(':')[0].trim().toLowerCase(); + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + const cmd = `echo -n "addr_assign_type: "; cat /sys/class/net/${ifaceSanitized}/addr_assign_type 2>/dev/null; echo; + echo -n "address: "; cat /sys/class/net/${ifaceSanitized}/address 2>/dev/null; echo; + echo -n "addr_len: "; cat /sys/class/net/${ifaceSanitized}/addr_len 2>/dev/null; echo; + echo -n "broadcast: "; cat /sys/class/net/${ifaceSanitized}/broadcast 2>/dev/null; echo; + echo -n "carrier: "; cat /sys/class/net/${ifaceSanitized}/carrier 2>/dev/null; echo; + echo -n "carrier_changes: "; cat /sys/class/net/${ifaceSanitized}/carrier_changes 2>/dev/null; echo; + echo -n "dev_id: "; cat /sys/class/net/${ifaceSanitized}/dev_id 2>/dev/null; echo; + echo -n "dev_port: "; cat /sys/class/net/${ifaceSanitized}/dev_port 2>/dev/null; echo; + echo -n "dormant: "; cat /sys/class/net/${ifaceSanitized}/dormant 2>/dev/null; echo; + echo -n "duplex: "; cat /sys/class/net/${ifaceSanitized}/duplex 2>/dev/null; echo; + echo -n "flags: "; cat /sys/class/net/${ifaceSanitized}/flags 2>/dev/null; echo; + echo -n "gro_flush_timeout: "; cat /sys/class/net/${ifaceSanitized}/gro_flush_timeout 2>/dev/null; echo; + echo -n "ifalias: "; cat /sys/class/net/${ifaceSanitized}/ifalias 2>/dev/null; echo; + echo -n "ifindex: "; cat /sys/class/net/${ifaceSanitized}/ifindex 2>/dev/null; echo; + echo -n "iflink: "; cat /sys/class/net/${ifaceSanitized}/iflink 2>/dev/null; echo; + echo -n "link_mode: "; cat /sys/class/net/${ifaceSanitized}/link_mode 2>/dev/null; echo; + echo -n "mtu: "; cat /sys/class/net/${ifaceSanitized}/mtu 2>/dev/null; echo; + echo -n "netdev_group: "; cat /sys/class/net/${ifaceSanitized}/netdev_group 2>/dev/null; echo; + echo -n "operstate: "; cat /sys/class/net/${ifaceSanitized}/operstate 2>/dev/null; echo; + echo -n "proto_down: "; cat /sys/class/net/${ifaceSanitized}/proto_down 2>/dev/null; echo; + echo -n "speed: "; cat /sys/class/net/${ifaceSanitized}/speed 2>/dev/null; echo; + echo -n "tx_queue_len: "; cat /sys/class/net/${ifaceSanitized}/tx_queue_len 2>/dev/null; echo; + echo -n "type: "; cat /sys/class/net/${ifaceSanitized}/type 2>/dev/null; echo; + echo -n "wireless: "; cat /proc/net/wireless 2>/dev/null | grep ${ifaceSanitized}; echo; + echo -n "wirelessspeed: "; iw dev ${ifaceSanitized} link 2>&1 | grep bitrate; echo;`; + + let lines = []; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const connectionName = getLinuxIfaceConnectionName(ifaceSanitized); + dhcp = getLinuxIfaceDHCPstatus(ifaceSanitized, connectionName, _dhcpNics); + dnsSuffix = getLinuxIfaceDNSsuffix(connectionName); + ieee8021xAuth = getLinuxIfaceIEEE8021xAuth(connectionName); + ieee8021xState = getLinuxIfaceIEEE8021xState(ieee8021xAuth); + } catch (e) { + util.noop(); + } + duplex = util.getValue(lines, 'duplex'); + duplex = duplex.startsWith('cat') ? '' : duplex; + mtu = parseInt(util.getValue(lines, 'mtu'), 10); + let myspeed = parseInt(util.getValue(lines, 'speed'), 10); + speed = isNaN(myspeed) ? null : myspeed; + let wirelessspeed = util.getValue(lines, 'wirelessspeed').split('tx bitrate: '); + if (speed === null && wirelessspeed.length === 2) { + myspeed = parseFloat(wirelessspeed[1]); + speed = isNaN(myspeed) ? null : myspeed; + } + carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10); + const operstate = util.getValue(lines, 'operstate'); + type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown'; + if (ifaceSanitized === 'lo' || ifaceSanitized.startsWith('bond')) { type = 'virtual'; } + + let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false; + if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) { + internal = true; + } + const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac); + result.push({ + iface: ifaceSanitized, + ifaceName, + default: iface === defaultInterface, + ip4, + ip4subnet, + ip6, + ip6subnet, + mac, + internal, + virtual, + operstate, + type, + duplex, + mtu, + speed, + dhcp, + dnsSuffix, + ieee8021xAuth, + ieee8021xState, + carrierChanges, + }); + } + } + _networkInterfaces = result; + if (defaultString.toLowerCase().indexOf('default') >= 0) { + result = result.filter(item => item.default); + if (result.length > 0) { + result = result[0]; + } else { + result = []; + } + } + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + if ((JSON.stringify(ifaces) === JSON.stringify(_ifaces)) && !rescan) { + // no changes - just return object + result = _networkInterfaces; + + if (callback) { callback(result); } + resolve(result); + } else { + _ifaces = JSON.parse(JSON.stringify(ifaces)); + const defaultInterface = getDefaultNetworkInterface(); + + getWindowsNics().then(function (nics) { + nics.forEach(nic => { + let found = false; + Object.keys(ifaces).forEach(key => { + if (!found) { + ifaces[key].forEach(value => { + if (Object.keys(value).indexOf('mac') >= 0) { + found = value['mac'] === nic.mac; + } + }); + } + }); + + if (!found) { + ifaces[nic.name] = [{ mac: nic.mac }]; + } + }); + nics8021xInfo = getWindowsWiredProfilesInformation(); + dnsSuffixes = getWindowsDNSsuffixes(); + for (let dev in ifaces) { + + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(dev); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + let iface = dev; + let ip4 = ''; + let ip4subnet = ''; + let ip6 = ''; + let ip6subnet = ''; + let mac = ''; + let duplex = ''; + let mtu = ''; + let speed = null; + let carrierChanges = 0; + let operstate = 'down'; + let dhcp = false; + let dnsSuffix = ''; + let ieee8021xAuth = ''; + let ieee8021xState = ''; + let type = ''; + + if ({}.hasOwnProperty.call(ifaces, dev)) { + let ifaceName = dev; + ifaces[dev].forEach(function (details) { + if (details.family === 'IPv4' || details.family === 4) { + ip4 = details.address; + ip4subnet = details.netmask; + } + if (details.family === 'IPv6' || details.family === 6) { + if (!ip6 || ip6.match(/^fe80::/i)) { + ip6 = details.address; + ip6subnet = details.netmask; + } + } + mac = details.mac; + // fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2) + const nodeMainVersion = parseInt(process.versions.node.split('.'), 10); + if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && (!details.internal) && nodeMainVersion >= 8 && nodeMainVersion <= 11) { + if (Object.keys(_mac).length === 0) { + _mac = getMacAddresses(); + } + mac = _mac[dev] || ''; + } + }); + + + + dnsSuffix = getWindowsIfaceDNSsuffix(dnsSuffixes.ifaces, ifaceSanitized); + let foundFirst = false; + nics.forEach(detail => { + if (detail.mac === mac && !foundFirst) { + iface = detail.iface || iface; + ifaceName = detail.name; + dhcp = detail.dhcp; + operstate = detail.operstate; + speed = operstate === 'up' ? detail.speed : 0; + type = detail.type; + foundFirst = true; + } + }); + + if (dev.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('wlan') >= 0 || ifaceName.toLowerCase().indexOf('802.11n') >= 0 || ifaceName.toLowerCase().indexOf('wireless') >= 0 || ifaceName.toLowerCase().indexOf('wi-fi') >= 0 || ifaceName.toLowerCase().indexOf('wifi') >= 0) { + type = 'wireless'; + } + + const IEEE8021x = getWindowsIEEE8021x(type, ifaceSanitized, nics8021xInfo); + ieee8021xAuth = IEEE8021x.protocol; + ieee8021xState = IEEE8021x.state; + let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : false; + if (dev.toLowerCase().indexOf('loopback') > -1 || ifaceName.toLowerCase().indexOf('loopback') > -1) { + internal = true; + } + const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac); + result.push({ + iface, + ifaceName, + default: iface === defaultInterface, + ip4, + ip4subnet, + ip6, + ip6subnet, + mac, + internal, + virtual, + operstate, + type, + duplex, + mtu, + speed, + dhcp, + dnsSuffix, + ieee8021xAuth, + ieee8021xState, + carrierChanges, + }); + } + } + _networkInterfaces = result; + if (defaultString.toLowerCase().indexOf('default') >= 0) { + result = result.filter(item => item.default); + if (result.length > 0) { + result = result[0]; + } else { + result = []; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } + } + }); + }); +} + +exports.networkInterfaces = networkInterfaces; + +// -------------------------- +// NET - Speed + +function calcNetworkSpeed(iface, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors) { + let result = { + iface, + operstate, + rx_bytes, + rx_dropped, + rx_errors, + tx_bytes, + tx_dropped, + tx_errors, + rx_sec: null, + tx_sec: null, + ms: 0 + }; + + if (_network[iface] && _network[iface].ms) { + result.ms = Date.now() - _network[iface].ms; + result.rx_sec = (rx_bytes - _network[iface].rx_bytes) >= 0 ? (rx_bytes - _network[iface].rx_bytes) / (result.ms / 1000) : 0; + result.tx_sec = (tx_bytes - _network[iface].tx_bytes) >= 0 ? (tx_bytes - _network[iface].tx_bytes) / (result.ms / 1000) : 0; + _network[iface].rx_bytes = rx_bytes; + _network[iface].tx_bytes = tx_bytes; + _network[iface].rx_sec = result.rx_sec; + _network[iface].tx_sec = result.tx_sec; + _network[iface].ms = Date.now(); + _network[iface].last_ms = result.ms; + _network[iface].operstate = operstate; + } else { + if (!_network[iface]) { _network[iface] = {}; } + _network[iface].rx_bytes = rx_bytes; + _network[iface].tx_bytes = tx_bytes; + _network[iface].rx_sec = null; + _network[iface].tx_sec = null; + _network[iface].ms = Date.now(); + _network[iface].last_ms = 0; + _network[iface].operstate = operstate; + } + return result; +} + +function networkStats(ifaces, callback) { + + let ifacesArray = []; + + return new Promise((resolve) => { + process.nextTick(() => { + + // fallback - if only callback is given + if (util.isFunction(ifaces) && !callback) { + callback = ifaces; + ifacesArray = [getDefaultNetworkInterface()]; + } else { + if (typeof ifaces !== 'string' && ifaces !== undefined) { + if (callback) { callback([]); } + return resolve([]); + } + ifaces = ifaces || getDefaultNetworkInterface(); + + ifaces.__proto__.toLowerCase = util.stringToLower; + ifaces.__proto__.replace = util.stringReplace; + ifaces.__proto__.trim = util.stringTrim; + + ifaces = ifaces.trim().toLowerCase().replace(/,+/g, '|'); + ifacesArray = ifaces.split('|'); + } + + const result = []; + + const workload = []; + if (ifacesArray.length && ifacesArray[0].trim() === '*') { + ifacesArray = []; + networkInterfaces(false).then(allIFaces => { + for (let iface of allIFaces) { + ifacesArray.push(iface.iface); + } + networkStats(ifacesArray.join(',')).then(result => { + if (callback) { callback(result); } + resolve(result); + }); + }); + } else { + for (let iface of ifacesArray) { + workload.push(networkStatsSingle(iface.trim())); + } + if (workload.length) { + Promise.all( + workload + ).then((data) => { + if (callback) { callback(data); } + resolve(data); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +function networkStatsSingle(iface) { + + function parseLinesWindowsPerfData(sections) { + let perfData = []; + for (let i in sections) { + if ({}.hasOwnProperty.call(sections, i)) { + if (sections[i].trim() !== '') { + let lines = sections[i].trim().split('\r\n'); + perfData.push({ + name: util.getValue(lines, 'Name', ':').replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase(), + rx_bytes: parseInt(util.getValue(lines, 'BytesReceivedPersec', ':'), 10), + rx_errors: parseInt(util.getValue(lines, 'PacketsReceivedErrors', ':'), 10), + rx_dropped: parseInt(util.getValue(lines, 'PacketsReceivedDiscarded', ':'), 10), + tx_bytes: parseInt(util.getValue(lines, 'BytesSentPersec', ':'), 10), + tx_errors: parseInt(util.getValue(lines, 'PacketsOutboundErrors', ':'), 10), + tx_dropped: parseInt(util.getValue(lines, 'PacketsOutboundDiscarded', ':'), 10) + }); + } + } + } + return perfData; + } + + return new Promise((resolve) => { + process.nextTick(() => { + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + let result = { + iface: ifaceSanitized, + operstate: 'unknown', + rx_bytes: 0, + rx_dropped: 0, + rx_errors: 0, + tx_bytes: 0, + tx_dropped: 0, + tx_errors: 0, + rx_sec: null, + tx_sec: null, + ms: 0 + }; + + let operstate = 'unknown'; + let rx_bytes = 0; + let tx_bytes = 0; + let rx_dropped = 0; + let rx_errors = 0; + let tx_dropped = 0; + let tx_errors = 0; + + let cmd, lines, stats; + if (!_network[ifaceSanitized] || (_network[ifaceSanitized] && !_network[ifaceSanitized].ms) || (_network[ifaceSanitized] && _network[ifaceSanitized].ms && Date.now() - _network[ifaceSanitized].ms >= 500)) { + if (_linux) { + if (fs.existsSync('/sys/class/net/' + ifaceSanitized)) { + cmd = + 'cat /sys/class/net/' + ifaceSanitized + '/operstate; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_bytes; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_bytes; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_dropped; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/rx_errors; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_dropped; ' + + 'cat /sys/class/net/' + ifaceSanitized + '/statistics/tx_errors; '; + exec(cmd, function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + operstate = lines[0].trim(); + rx_bytes = parseInt(lines[1], 10); + tx_bytes = parseInt(lines[2], 10); + rx_dropped = parseInt(lines[3], 10); + rx_errors = parseInt(lines[4], 10); + tx_dropped = parseInt(lines[5], 10); + tx_errors = parseInt(lines[6], 10); + + result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + + } + resolve(result); + }); + } else { + resolve(result); + } + } + if (_freebsd || _openbsd || _netbsd) { + cmd = 'netstat -ibndI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input] + exec(cmd, function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + for (let i = 1; i < lines.length; i++) { + const line = lines[i].replace(/ +/g, ' ').split(' '); + if (line && line[0] && line[7] && line[10]) { + rx_bytes = rx_bytes + parseInt(line[7]); + if (line[6].trim() !== '-') { rx_dropped = rx_dropped + parseInt(line[6]); } + if (line[5].trim() !== '-') { rx_errors = rx_errors + parseInt(line[5]); } + tx_bytes = tx_bytes + parseInt(line[10]); + if (line[12].trim() !== '-') { tx_dropped = tx_dropped + parseInt(line[12]); } + if (line[9].trim() !== '-') { tx_errors = tx_errors + parseInt(line[9]); } + operstate = 'up'; + } + } + result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + } + resolve(result); + }); + } + if (_darwin) { + cmd = 'ifconfig ' + ifaceSanitized + ' | grep "status"'; // lgtm [js/shell-command-constructed-from-input] + exec(cmd, function (error, stdout) { + result.operstate = (stdout.toString().split(':')[1] || '').trim(); + result.operstate = (result.operstate || '').toLowerCase(); + result.operstate = (result.operstate === 'active' ? 'up' : (result.operstate === 'inactive' ? 'down' : 'unknown')); + cmd = 'netstat -bdI ' + ifaceSanitized; // lgtm [js/shell-command-constructed-from-input] + exec(cmd, function (error, stdout) { + if (!error) { + lines = stdout.toString().split('\n'); + // if there is less than 2 lines, no information for this interface was found + if (lines.length > 1 && lines[1].trim() !== '') { + // skip header line + // use the second line because it is tied to the NIC instead of the ipv4 or ipv6 address + stats = lines[1].replace(/ +/g, ' ').split(' '); + const offset = stats.length > 11 ? 1 : 0; + rx_bytes = parseInt(stats[offset + 5]); + rx_dropped = parseInt(stats[offset + 10]); + rx_errors = parseInt(stats[offset + 4]); + tx_bytes = parseInt(stats[offset + 8]); + tx_dropped = parseInt(stats[offset + 10]); + tx_errors = parseInt(stats[offset + 7]); + result = calcNetworkSpeed(ifaceSanitized, rx_bytes, tx_bytes, result.operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + } + } + resolve(result); + }); + }); + } + if (_windows) { + let perfData = []; + let ifaceName = ifaceSanitized; + + // Performance Data + util.powerShell('Get-CimInstance Win32_PerfRawData_Tcpip_NetworkInterface | select Name,BytesReceivedPersec,PacketsReceivedErrors,PacketsReceivedDiscarded,BytesSentPersec,PacketsOutboundErrors,PacketsOutboundDiscarded | fl').then((stdout, error) => { + if (!error) { + const psections = stdout.toString().split(/\n\s*\n/); + perfData = parseLinesWindowsPerfData(psections); + } + + // Network Interfaces + networkInterfaces(false).then(interfaces => { + // get bytes sent, received from perfData by name + rx_bytes = 0; + tx_bytes = 0; + perfData.forEach(detail => { + interfaces.forEach(det => { + if ((det.iface.toLowerCase() === ifaceSanitized.toLowerCase() || + det.mac.toLowerCase() === ifaceSanitized.toLowerCase() || + det.ip4.toLowerCase() === ifaceSanitized.toLowerCase() || + det.ip6.toLowerCase() === ifaceSanitized.toLowerCase() || + det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === ifaceSanitized.replace(/[()[\] ]+/g, '').replace('#', '_').toLowerCase()) && + (det.ifaceName.replace(/[()[\] ]+/g, '').replace(/#|\//g, '_').toLowerCase() === detail.name)) { + ifaceName = det.iface; + rx_bytes = detail.rx_bytes; + rx_dropped = detail.rx_dropped; + rx_errors = detail.rx_errors; + tx_bytes = detail.tx_bytes; + tx_dropped = detail.tx_dropped; + tx_errors = detail.tx_errors; + operstate = det.operstate; + } + }); + }); + if (rx_bytes && tx_bytes) { + result = calcNetworkSpeed(ifaceName, parseInt(rx_bytes), parseInt(tx_bytes), operstate, rx_dropped, rx_errors, tx_dropped, tx_errors); + } + resolve(result); + }); + }); + } + } else { + result.rx_bytes = _network[ifaceSanitized].rx_bytes; + result.tx_bytes = _network[ifaceSanitized].tx_bytes; + result.rx_sec = _network[ifaceSanitized].rx_sec; + result.tx_sec = _network[ifaceSanitized].tx_sec; + result.ms = _network[ifaceSanitized].last_ms; + result.operstate = _network[ifaceSanitized].operstate; + resolve(result); + } + }); + }); +} + +exports.networkStats = networkStats; + +// -------------------------- +// NET - connections (sockets) + +function getProcessName(processes, pid) { + let cmd = ''; + processes.forEach(line => { + const parts = line.split(' '); + const id = parseInt(parts[0], 10) || -1; + if (id === pid) { + parts.shift(); + cmd = parts.join(' ').split(':')[0]; + } + }); + cmd = cmd.split(' -')[0]; + // return cmd; + const cmdParts = cmd.split('/'); + return cmdParts[cmdParts.length - 1]; +} + +function networkConnections(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'export LC_ALL=C; netstat -tunap | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'; + if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"; unset LC_ALL'; } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let lines = stdout.toString().split('\n'); + if (!error && (lines.length > 1 || lines[0] != '')) { + lines.forEach(function (line) { + line = line.replace(/ +/g, ' ').split(' '); + if (line.length >= 7) { + let localip = line[3]; + let localport = ''; + let localaddress = line[3].split(':'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join(':'); + } + let peerip = line[4]; + let peerport = ''; + let peeraddress = line[4].split(':'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join(':'); + } + let connstate = line[5]; + let proc = line[6].split('/'); + + if (connstate) { + result.push({ + protocol: line[0], + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid: proc[0] && proc[0] !== '-' ? parseInt(proc[0], 10) : null, + process: proc[1] ? proc[1].split(' ')[0].split(':')[0] : '' + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + } else { + cmd = 'ss -tunap | grep "ESTAB\\|SYN-SENT\\|SYN-RECV\\|FIN-WAIT1\\|FIN-WAIT2\\|TIME-WAIT\\|CLOSE\\|CLOSE-WAIT\\|LAST-ACK\\|LISTEN\\|CLOSING"'; + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + + if (!error) { + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + line = line.replace(/ +/g, ' ').split(' '); + if (line.length >= 6) { + let localip = line[4]; + let localport = ''; + let localaddress = line[4].split(':'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join(':'); + } + let peerip = line[5]; + let peerport = ''; + let peeraddress = line[5].split(':'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join(':'); + } + let connstate = line[1]; + if (connstate === 'ESTAB') { connstate = 'ESTABLISHED'; } + if (connstate === 'TIME-WAIT') { connstate = 'TIME_WAIT'; } + let pid = null; + let process = ''; + if (line.length >= 7 && line[6].indexOf('users:') > -1) { + let proc = line[6].replace('users:(("', '').replace(/"/g, '').split(','); + if (proc.length > 2) { + process = proc[0].split(' ')[0].split(':')[0]; + pid = parseInt(proc[1], 10); + } + } + if (connstate) { + result.push({ + protocol: line[0], + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid, + process + }); + } + } + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + }); + } + if (_darwin) { + // let cmd = 'netstat -natv | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN"'; + let cmd = 'netstat -natvln | grep "tcp4\\|tcp6\\|udp4\\|udp6"'; + const states = 'ESTABLISHED|SYN_SENT|SYN_RECV|FIN_WAIT1|FIN_WAIT2|TIME_WAIT|CLOSE|CLOSE_WAIT|LAST_ACK|LISTEN|CLOSING|UNKNOWN'; + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + exec('ps -axo pid,command', { maxBuffer: 1024 * 20000 }, function (err2, stdout2) { + let processes = stdout2.toString().split('\n'); + processes = processes.map((line => { return line.trim().replace(/ +/g, ' '); })); + let lines = stdout.toString().split('\n'); + + lines.forEach(function (line) { + line = line.replace(/ +/g, ' ').split(' '); + if (line.length >= 8) { + let localip = line[3]; + let localport = ''; + let localaddress = line[3].split('.'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join('.'); + } + let peerip = line[4]; + let peerport = ''; + let peeraddress = line[4].split('.'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join('.'); + } + const hasState = states.indexOf(line[5]) >= 0; + let connstate = hasState ? line[5] : 'UNKNOWN'; + let pid = parseInt(line[8 + (hasState ? 0 : -1)], 10); + if (connstate) { + result.push({ + protocol: line[0], + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid: pid, + process: getProcessName(processes, pid) + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + }); + + } + }); + } + if (_windows) { + let cmd = 'netstat -nao'; + try { + exec(cmd, util.execOptsWin, function (error, stdout) { + if (!error) { + + let lines = stdout.toString().split('\r\n'); + + lines.forEach(function (line) { + line = line.trim().replace(/ +/g, ' ').split(' '); + if (line.length >= 4) { + let localip = line[1]; + let localport = ''; + let localaddress = line[1].split(':'); + if (localaddress.length > 1) { + localport = localaddress[localaddress.length - 1]; + localaddress.pop(); + localip = localaddress.join(':'); + } + localip = localip.replace(/\[/g, '').replace(/\]/g, ''); + let peerip = line[2]; + let peerport = ''; + let peeraddress = line[2].split(':'); + if (peeraddress.length > 1) { + peerport = peeraddress[peeraddress.length - 1]; + peeraddress.pop(); + peerip = peeraddress.join(':'); + } + peerip = peerip.replace(/\[/g, '').replace(/\]/g, ''); + let pid = util.toInt(line[4]); + let connstate = line[3]; + if (connstate === 'HERGESTELLT') { connstate = 'ESTABLISHED'; } + if (connstate.startsWith('ABH')) { connstate = 'LISTEN'; } + if (connstate === 'SCHLIESSEN_WARTEN') { connstate = 'CLOSE_WAIT'; } + if (connstate === 'WARTEND') { connstate = 'TIME_WAIT'; } + if (connstate === 'SYN_GESENDET') { connstate = 'SYN_SENT'; } + + if (connstate === 'LISTENING') { connstate = 'LISTEN'; } + if (connstate === 'SYN_RECEIVED') { connstate = 'SYN_RECV'; } + if (connstate === 'FIN_WAIT_1') { connstate = 'FIN_WAIT1'; } + if (connstate === 'FIN_WAIT_2') { connstate = 'FIN_WAIT2'; } + if (line[0].toLowerCase() !== 'udp' && connstate) { + result.push({ + protocol: line[0].toLowerCase(), + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: connstate, + pid, + process: '' + }); + } else if (line[0].toLowerCase() === 'udp') { + result.push({ + protocol: line[0].toLowerCase(), + localAddress: localip, + localPort: localport, + peerAddress: peerip, + peerPort: peerport, + state: '', + pid: parseInt(line[3], 10), + process: '' + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.networkConnections = networkConnections; + +function networkGatewayDefault(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = ''; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'ip route get 1'; + try { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + const line = lines && lines[0] ? lines[0] : ''; + let parts = line.split(' via '); + if (parts && parts[1]) { + parts = parts[1].split(' '); + result = parts[0]; + } + if (callback) { + callback(result); + } + resolve(result); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_darwin) { + let cmd = 'route -n get default'; + try { + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + const lines = stdout.toString().split('\n').map(line => line.trim()); + result = util.getValue(lines, 'gateway'); + } + if (!result) { + cmd = 'netstat -rn | awk \'/default/ {print $2}\''; + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + const lines = stdout.toString().split('\n').map(line => line.trim()); + result = lines.find(line => (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(line))); + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + try { + exec('netstat -r', util.execOptsWin, function (error, stdout) { + const lines = stdout.toString().split(os.EOL); + lines.forEach(line => { + line = line.replace(/\s+/g, ' ').trim(); + if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) { + const parts = line.split(' '); + if (parts.length >= 5 && (parts[parts.length - 3]).indexOf('.') > -1) { + result = parts[parts.length - 3]; + } + } + }); + if (!result) { + util.powerShell('Get-CimInstance -ClassName Win32_IP4RouteTable | Where-Object { $_.Destination -eq \'0.0.0.0\' -and $_.Mask -eq \'0.0.0.0\' }') + .then((data) => { + let lines = data.toString().split('\r\n'); + if (lines.length > 1 && !result) { + result = util.getValue(lines, 'NextHop'); + if (callback) { + callback(result); + } + resolve(result); + // } else { + // exec('ipconfig', util.execOptsWin, function (error, stdout) { + // let lines = stdout.toString().split('\r\n'); + // lines.forEach(function (line) { + // line = line.trim().replace(/\. /g, ''); + // line = line.trim().replace(/ +/g, ''); + // const parts = line.split(':'); + // if ((parts[0].toLowerCase().startsWith('standardgate') || parts[0].toLowerCase().indexOf('gateway') > -1 || parts[0].toLowerCase().indexOf('enlace') > -1) && parts[1]) { + // result = parts[1]; + // } + // }); + // if (callback) { callback(result); } + // resolve(result); + // }); + } + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.networkGatewayDefault = networkGatewayDefault; + + +/***/ }), + +/***/ 1067: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// osinfo.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 3. Operating System +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const fs = __nccwpck_require__(7147); +const util = __nccwpck_require__(9872); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +// -------------------------- +// Get current time and OS uptime + +function time() { + let t = new Date().toString().split(' '); + return { + current: Date.now(), + uptime: os.uptime(), + timezone: (t.length >= 7) ? t[5] : '', + timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : '' + }; +} + +exports.time = time; + +// -------------------------- +// Get logo filename of OS distribution + +function getLogoFile(distro) { + distro = distro || ''; + distro = distro.toLowerCase(); + let result = _platform; + if (_windows) { + result = 'windows'; + } + else if (distro.indexOf('mac os') !== -1) { + result = 'apple'; + } + else if (distro.indexOf('arch') !== -1) { + result = 'arch'; + } + else if (distro.indexOf('centos') !== -1) { + result = 'centos'; + } + else if (distro.indexOf('coreos') !== -1) { + result = 'coreos'; + } + else if (distro.indexOf('debian') !== -1) { + result = 'debian'; + } + else if (distro.indexOf('deepin') !== -1) { + result = 'deepin'; + } + else if (distro.indexOf('elementary') !== -1) { + result = 'elementary'; + } + else if (distro.indexOf('fedora') !== -1) { + result = 'fedora'; + } + else if (distro.indexOf('gentoo') !== -1) { + result = 'gentoo'; + } + else if (distro.indexOf('mageia') !== -1) { + result = 'mageia'; + } + else if (distro.indexOf('mandriva') !== -1) { + result = 'mandriva'; + } + else if (distro.indexOf('manjaro') !== -1) { + result = 'manjaro'; + } + else if (distro.indexOf('mint') !== -1) { + result = 'mint'; + } + else if (distro.indexOf('mx') !== -1) { + result = 'mx'; + } + else if (distro.indexOf('openbsd') !== -1) { + result = 'openbsd'; + } + else if (distro.indexOf('freebsd') !== -1) { + result = 'freebsd'; + } + else if (distro.indexOf('opensuse') !== -1) { + result = 'opensuse'; + } + else if (distro.indexOf('pclinuxos') !== -1) { + result = 'pclinuxos'; + } + else if (distro.indexOf('puppy') !== -1) { + result = 'puppy'; + } + else if (distro.indexOf('raspbian') !== -1) { + result = 'raspbian'; + } + else if (distro.indexOf('reactos') !== -1) { + result = 'reactos'; + } + else if (distro.indexOf('redhat') !== -1) { + result = 'redhat'; + } + else if (distro.indexOf('slackware') !== -1) { + result = 'slackware'; + } + else if (distro.indexOf('sugar') !== -1) { + result = 'sugar'; + } + else if (distro.indexOf('steam') !== -1) { + result = 'steam'; + } + else if (distro.indexOf('suse') !== -1) { + result = 'suse'; + } + else if (distro.indexOf('mate') !== -1) { + result = 'ubuntu-mate'; + } + else if (distro.indexOf('lubuntu') !== -1) { + result = 'lubuntu'; + } + else if (distro.indexOf('xubuntu') !== -1) { + result = 'xubuntu'; + } + else if (distro.indexOf('ubuntu') !== -1) { + result = 'ubuntu'; + } + else if (distro.indexOf('solaris') !== -1) { + result = 'solaris'; + } + else if (distro.indexOf('tails') !== -1) { + result = 'tails'; + } + else if (distro.indexOf('feren') !== -1) { + result = 'ferenos'; + } + else if (distro.indexOf('robolinux') !== -1) { + result = 'robolinux'; + } else if (_linux && distro) { + result = distro.toLowerCase().trim().replace(/\s+/g, '-'); + } + return result; +} + +// -------------------------- +// FQDN + +function getFQDN() { + let fqdn = os.hostname; + if (_linux || _darwin) { + try { + const stdout = execSync('hostnamectl --json short 2>/dev/null', util.execOptsLinux); + const json = JSON.parse(stdout.toString()); + + fqdn = json['StaticHostname']; + } catch (e) { + try { + const stdout = execSync('hostname -f 2>/dev/null', util.execOptsLinux); + fqdn = stdout.toString().split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + } + if (_freebsd || _openbsd || _netbsd) { + try { + const stdout = execSync('hostname 2>/dev/null'); + fqdn = stdout.toString().split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + if (_windows) { + try { + const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin); + fqdn = stdout.toString().replace('.%USERDNSDOMAIN%', '').split(os.EOL)[0]; + } catch (e) { + util.noop(); + } + } + return fqdn; +} + +// -------------------------- +// OS Information + +function osInfo(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + + platform: (_platform === 'win32' ? 'Windows' : _platform), + distro: 'unknown', + release: 'unknown', + codename: '', + kernel: os.release(), + arch: os.arch(), + hostname: os.hostname(), + fqdn: getFQDN(), + codepage: '', + logofile: '', + serial: '', + build: '', + servicepack: '', + uefi: false + }; + + if (_linux) { + + exec('cat /etc/*-release; cat /usr/lib/os-release; cat /etc/openwrt_release', function (error, stdout) { + /** + * @namespace + * @property {string} DISTRIB_ID + * @property {string} NAME + * @property {string} DISTRIB_RELEASE + * @property {string} VERSION_ID + * @property {string} DISTRIB_CODENAME + */ + let release = {}; + let lines = stdout.toString().split('\n'); + lines.forEach(function (line) { + if (line.indexOf('=') !== -1) { + release[line.split('=')[0].trim().toUpperCase()] = line.split('=')[1].trim(); + } + }); + result.distro = (release.DISTRIB_ID || release.NAME || 'unknown').replace(/"/g, ''); + result.logofile = getLogoFile(result.distro); + let releaseVersion = (release.VERSION || '').replace(/"/g, ''); + let codename = (release.DISTRIB_CODENAME || release.VERSION_CODENAME || '').replace(/"/g, ''); + const prettyName = (release.PRETTY_NAME || '').replace(/"/g, ''); + if (prettyName.indexOf(result.distro + ' ') === 0) { + releaseVersion = prettyName.replace(result.distro + ' ', '').trim(); + } + if (releaseVersion.indexOf('(') >= 0) { + codename = releaseVersion.split('(')[1].replace(/[()]/g, '').trim(); + releaseVersion = releaseVersion.split('(')[0].trim(); + } + result.release = (releaseVersion || release.DISTRIB_RELEASE || release.VERSION_ID || 'unknown').replace(/"/g, ''); + result.codename = codename; + result.codepage = util.getCodepage(); + result.build = (release.BUILD_ID || '').replace(/"/g, '').trim(); + isUefiLinux().then(uefi => { + result.uefi = uefi; + uuid().then((data) => { + result.serial = data.os; + if (callback) { + callback(result); + } + resolve(result); + }); + }); + }); + } + if (_freebsd || _openbsd || _netbsd) { + + exec('sysctl kern.ostype kern.osrelease kern.osrevision kern.hostuuid machdep.bootmethod kern.geom.confxml', function (error, stdout) { + let lines = stdout.toString().split('\n'); + const distro = util.getValue(lines, 'kern.ostype'); + const logofile = getLogoFile(distro); + const release = util.getValue(lines, 'kern.osrelease').split('-')[0]; + const serial = util.getValue(lines, 'kern.uuid'); + const bootmethod = util.getValue(lines, 'machdep.bootmethod'); + const uefiConf = stdout.toString().indexOf('efi') >= 0; + const uefi = bootmethod ? bootmethod.toLowerCase().indexOf('uefi') >= 0 : (uefiConf ? uefiConf : null); + result.distro = distro || result.distro; + result.logofile = logofile || result.logofile; + result.release = release || result.release; + result.serial = serial || result.serial; + result.codename = ''; + result.codepage = util.getCodepage(); + result.uefi = uefi || null; + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_darwin) { + exec('sw_vers; sysctl kern.ostype kern.osrelease kern.osrevision kern.uuid', function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.serial = util.getValue(lines, 'kern.uuid'); + result.distro = util.getValue(lines, 'ProductName'); + result.release = (util.getValue(lines, 'ProductVersion', ':', true, true) + ' ' + util.getValue(lines, 'ProductVersionExtra', ':', true, true)).trim(); + result.build = util.getValue(lines, 'BuildVersion'); + result.logofile = getLogoFile(result.distro); + result.codename = 'macOS'; + result.codename = (result.release.indexOf('10.4') > -1 ? 'Mac OS X Tiger' : result.codename); + result.codename = (result.release.indexOf('10.5') > -1 ? 'Mac OS X Leopard' : result.codename); + result.codename = (result.release.indexOf('10.6') > -1 ? 'Mac OS X Snow Leopard' : result.codename); + result.codename = (result.release.indexOf('10.7') > -1 ? 'Mac OS X Lion' : result.codename); + result.codename = (result.release.indexOf('10.8') > -1 ? 'OS X Mountain Lion' : result.codename); + result.codename = (result.release.indexOf('10.9') > -1 ? 'OS X Mavericks' : result.codename); + result.codename = (result.release.indexOf('10.10') > -1 ? 'OS X Yosemite' : result.codename); + result.codename = (result.release.indexOf('10.11') > -1 ? 'OS X El Capitan' : result.codename); + result.codename = (result.release.indexOf('10.12') > -1 ? 'macOS Sierra' : result.codename); + result.codename = (result.release.indexOf('10.13') > -1 ? 'macOS High Sierra' : result.codename); + result.codename = (result.release.indexOf('10.14') > -1 ? 'macOS Mojave' : result.codename); + result.codename = (result.release.indexOf('10.15') > -1 ? 'macOS Catalina' : result.codename); + result.codename = (result.release.startsWith('11.') ? 'macOS Big Sur' : result.codename); + result.codename = (result.release.startsWith('12.') ? 'macOS Monterey' : result.codename); + result.codename = (result.release.startsWith('13.') ? 'macOS Ventura' : result.codename); + result.codename = (result.release.startsWith('14.') ? 'macOS Sonoma' : result.codename); + result.codename = (result.release.startsWith('15.') ? 'macOS Sequoia' : result.codename); + result.uefi = true; + result.codepage = util.getCodepage(); + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos) { + result.release = result.kernel; + exec('uname -o', function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.distro = lines[0]; + result.logofile = getLogoFile(result.distro); + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { + result.logofile = getLogoFile(); + result.release = result.kernel; + try { + const workload = []; + workload.push(util.powerShell('Get-CimInstance Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl')); + workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); + workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession')); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().split('\r\n') : ['']; + result.distro = util.getValue(lines, 'Caption', ':').trim(); + result.serial = util.getValue(lines, 'SerialNumber', ':').trim(); + result.build = util.getValue(lines, 'BuildNumber', ':').trim(); + result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', ':').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', ':').trim(); + result.codepage = util.getCodepage(); + const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : ''; + result.hypervisor = hyperv.indexOf('true') !== -1; + const term = data.results[2] ? data.results[2].toString() : ''; + result.remoteSession = (term.toString().toLowerCase().indexOf('true') >= 0); + isUefiWindows().then(uefi => { + result.uefi = uefi; + if (callback) { + callback(result); + } + resolve(result); + }); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.osInfo = osInfo; + +function isUefiLinux() { + return new Promise((resolve) => { + process.nextTick(() => { + fs.stat('/sys/firmware/efi', function (err) { + if (!err) { + return resolve(true); + } else { + exec('dmesg | grep -E "EFI v"', function (error, stdout) { + if (!error) { + const lines = stdout.toString().split('\n'); + return resolve(lines.length > 0); + } + return resolve(false); + }); + } + }); + }); + }); +} + +function isUefiWindows() { + return new Promise((resolve) => { + process.nextTick(() => { + try { + exec('findstr /C:"Detected boot environment" "%windir%\\Panther\\setupact.log"', util.execOptsWin, function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n\r')[0]; + return resolve(line.toLowerCase().indexOf('efi') >= 0); + } else { + exec('echo %firmware_type%', util.execOptsWin, function (error, stdout) { + if (!error) { + const line = stdout.toString() || ''; + return resolve(line.toLowerCase().indexOf('efi') >= 0); + } else { + return resolve(false); + } + }); + } + }); + } catch (e) { + return resolve(false); + } + }); + }); +} + +function versions(apps, callback) { + let versionObject = { + kernel: os.release(), + openssl: '', + systemOpenssl: '', + systemOpensslLib: '', + node: process.versions.node, + v8: process.versions.v8, + npm: '', + yarn: '', + pm2: '', + gulp: '', + grunt: '', + git: '', + tsc: '', + mysql: '', + redis: '', + mongodb: '', + apache: '', + nginx: '', + php: '', + docker: '', + postfix: '', + postgresql: '', + perl: '', + python: '', + python3: '', + pip: '', + pip3: '', + java: '', + gcc: '', + virtualbox: '', + bash: '', + zsh: '', + fish: '', + powershell: '', + dotnet: '' + }; + + function checkVersionParam(apps) { + if (apps === '*') { + return { + versions: versionObject, + counter: 30 + }; + } + if (!Array.isArray(apps)) { + apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|'); + apps = apps.split('|'); + const result = { + versions: {}, + counter: 0 + }; + apps.forEach(el => { + if (el) { + for (let key in versionObject) { + if ({}.hasOwnProperty.call(versionObject, key)) { + if (key.toLowerCase() === el.toLowerCase() && !{}.hasOwnProperty.call(result.versions, key)) { + result.versions[key] = versionObject[key]; + if (key === 'openssl') { + result.versions.systemOpenssl = ''; + result.versions.systemOpensslLib = ''; + } + + if (!result.versions[key]) { result.counter++; } + } + } + } + } + }); + return result; + } + } + + return new Promise((resolve) => { + process.nextTick(() => { + if (util.isFunction(apps) && !callback) { + callback = apps; + apps = '*'; + } else { + apps = apps || '*'; + if (typeof apps !== 'string') { + if (callback) { callback({}); } + return resolve({}); + } + } + const appsObj = checkVersionParam(apps); + let totalFunctions = appsObj.counter; + + let functionProcessed = (function () { + return function () { + if (--totalFunctions === 0) { + if (callback) { + callback(appsObj.versions); + } + resolve(appsObj.versions); + } + }; + })(); + + let cmd = ''; + try { + if ({}.hasOwnProperty.call(appsObj.versions, 'openssl')) { + appsObj.versions.openssl = process.versions.openssl; + exec('openssl version', function (error, stdout) { + if (!error) { + let openssl_string = stdout.toString().split('\n')[0].trim(); + let openssl = openssl_string.split(' '); + appsObj.versions.systemOpenssl = openssl.length > 0 ? openssl[1] : openssl[0]; + appsObj.versions.systemOpensslLib = openssl.length > 0 ? openssl[0] : 'openssl'; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'npm')) { + exec('npm -v', function (error, stdout) { + if (!error) { + appsObj.versions.npm = stdout.toString().split('\n')[0]; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'pm2')) { + cmd = 'pm2'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} -v`, function (error, stdout) { + if (!error) { + let pm2 = stdout.toString().split('\n')[0].trim(); + if (!pm2.startsWith('[PM2]')) { + appsObj.versions.pm2 = pm2; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'yarn')) { + exec('yarn --version', function (error, stdout) { + if (!error) { + appsObj.versions.yarn = stdout.toString().split('\n')[0]; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'gulp')) { + cmd = 'gulp'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { + if (!error) { + const gulp = stdout.toString().split('\n')[0] || ''; + appsObj.versions.gulp = (gulp.toLowerCase().split('version')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'tsc')) { + cmd = 'tsc'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { + if (!error) { + const tsc = stdout.toString().split('\n')[0] || ''; + appsObj.versions.tsc = (tsc.toLowerCase().split('version')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'grunt')) { + cmd = 'grunt'; + if (_windows) { + cmd += '.cmd'; + } + exec(`${cmd} --version`, function (error, stdout) { + if (!error) { + const grunt = stdout.toString().split('\n')[0] || ''; + appsObj.versions.grunt = (grunt.toLowerCase().split('cli v')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'git')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/git') || fs.existsSync('/opt/homebrew/bin/git'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('git --version', function (error, stdout) { + if (!error) { + let git = stdout.toString().split('\n')[0] || ''; + git = (git.toLowerCase().split('version')[1] || '').trim(); + appsObj.versions.git = (git.split(' ')[0] || '').trim(); + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('git --version', function (error, stdout) { + if (!error) { + let git = stdout.toString().split('\n')[0] || ''; + git = (git.toLowerCase().split('version')[1] || '').trim(); + appsObj.versions.git = (git.split(' ')[0] || '').trim(); + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'apache')) { + exec('apachectl -v 2>&1', function (error, stdout) { + if (!error) { + const apache = (stdout.toString().split('\n')[0] || '').split(':'); + appsObj.versions.apache = (apache.length > 1 ? apache[1].replace('Apache', '').replace('/', '').split('(')[0].trim() : ''); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'nginx')) { + exec('nginx -v 2>&1', function (error, stdout) { + if (!error) { + const nginx = stdout.toString().split('\n')[0] || ''; + appsObj.versions.nginx = (nginx.toLowerCase().split('/')[1] || '').trim(); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'mysql')) { + exec('mysql -V', function (error, stdout) { + if (!error) { + let mysql = stdout.toString().split('\n')[0] || ''; + mysql = mysql.toLowerCase(); + if (mysql.indexOf(',') > -1) { + mysql = (mysql.split(',')[0] || '').trim(); + const parts = mysql.split(' '); + appsObj.versions.mysql = (parts[parts.length - 1] || '').trim(); + } else { + if (mysql.indexOf(' ver ') > -1) { + mysql = mysql.split(' ver ')[1]; + appsObj.versions.mysql = mysql.split(' ')[0]; + } + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'php')) { + exec('php -v', function (error, stdout) { + if (!error) { + const php = stdout.toString().split('\n')[0] || ''; + let parts = php.split('('); + if (parts[0].indexOf('-')) { + parts = parts[0].split('-'); + } + appsObj.versions.php = parts[0].replace(/[^0-9.]/g, ''); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'redis')) { + exec('redis-server --version', function (error, stdout) { + if (!error) { + const redis = stdout.toString().split('\n')[0] || ''; + const parts = redis.split(' '); + appsObj.versions.redis = util.getValue(parts, 'v', '=', true); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'docker')) { + exec('docker --version', function (error, stdout) { + if (!error) { + const docker = stdout.toString().split('\n')[0] || ''; + const parts = docker.split(' '); + appsObj.versions.docker = parts.length > 2 && parts[2].endsWith(',') ? parts[2].slice(0, -1) : ''; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'postfix')) { + exec('postconf -d | grep mail_version', function (error, stdout) { + if (!error) { + const postfix = stdout.toString().split('\n') || []; + appsObj.versions.postfix = util.getValue(postfix, 'mail_version', '=', true); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'mongodb')) { + exec('mongod --version', function (error, stdout) { + if (!error) { + const mongodb = stdout.toString().split('\n')[0] || ''; + appsObj.versions.mongodb = (mongodb.toLowerCase().split(',')[0] || '').replace(/[^0-9.]/g, ''); + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'postgresql')) { + if (_linux) { + exec('locate bin/postgres', function (error, stdout) { + if (!error) { + const postgresqlBin = stdout.toString().split('\n').sort(); + if (postgresqlBin.length) { + exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', function (error, stdout) { + if (!error) { + const postgresql = stdout.toString().split('\n')[0].split(' ') || []; + appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('psql -V', function (error, stdout) { + if (!error) { + const postgresql = stdout.toString().split('\n')[0].split(' ') || []; + appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : ''; + appsObj.versions.postgresql = appsObj.versions.postgresql.split('-')[0]; + } + functionProcessed(); + }); + } + }); + } else { + if (_windows) { + util.powerShell('Get-CimInstance Win32_Service | select caption | fl').then((stdout) => { + let serviceSections = stdout.split(/\n\s*\n/); + serviceSections.forEach((item) => { + if (item.trim() !== '') { + let lines = item.trim().split('\r\n'); + let srvCaption = util.getValue(lines, 'caption', ':', true).toLowerCase(); + if (srvCaption.indexOf('postgresql') > -1) { + const parts = srvCaption.split(' server '); + if (parts.length > 1) { + appsObj.versions.postgresql = parts[1]; + } + } + } + }); + functionProcessed(); + }); + } else { + exec('postgres -V', function (error, stdout) { + if (!error) { + const postgresql = stdout.toString().split('\n')[0].split(' ') || []; + appsObj.versions.postgresql = postgresql.length ? postgresql[postgresql.length - 1] : ''; + } + functionProcessed(); + }); + } + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'perl')) { + exec('perl -v', function (error, stdout) { + if (!error) { + const perl = stdout.toString().split('\n') || ''; + while (perl.length > 0 && perl[0].trim() === '') { + perl.shift(); + } + if (perl.length > 0) { + appsObj.versions.perl = perl[0].split('(').pop().split(')')[0].replace('v', ''); + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'python')) { + if (_darwin) { + try { + const stdout = execSync('sw_vers'); + const lines = stdout.toString().split('\n'); + const osVersion = util.getValue(lines, 'ProductVersion', ':'); + const gitHomebrewExists1 = fs.existsSync('/usr/local/Cellar/python'); + const gitHomebrewExists2 = fs.existsSync('/opt/homebrew/bin/python'); + if ((util.darwinXcodeExists() && util.semverCompare('12.0.1', osVersion) < 0) || gitHomebrewExists1 || gitHomebrewExists2) { + const cmd = gitHomebrewExists1 ? '/usr/local/Cellar/python -V 2>&1' : (gitHomebrewExists2 ? '/opt/homebrew/bin/python -V 2>&1' : 'python -V 2>&1'); + exec(cmd, function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } catch (e) { + functionProcessed(); + } + + } else { + exec('python -V 2>&1', function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'python3')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/python3') || fs.existsSync('/opt/homebrew/bin/python3'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('python3 -V 2>&1', function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('python3 -V 2>&1', function (error, stdout) { + if (!error) { + const python = stdout.toString().split('\n')[0] || ''; + appsObj.versions.python3 = python.toLowerCase().replace('python', '').trim(); + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'pip')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip') || fs.existsSync('/opt/homebrew/bin/pip'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('pip -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('pip -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'pip3')) { + if (_darwin) { + const gitHomebrewExists = fs.existsSync('/usr/local/Cellar/pip3') || fs.existsSync('/opt/homebrew/bin/pip3'); + if (util.darwinXcodeExists() || gitHomebrewExists) { + exec('pip3 -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + } else { + exec('pip3 -V 2>&1', function (error, stdout) { + if (!error) { + const pip = stdout.toString().split('\n')[0] || ''; + const parts = pip.split(' '); + appsObj.versions.pip3 = parts.length >= 2 ? parts[1] : ''; + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'java')) { + if (_darwin) { + // check if any JVM is installed but avoid dialog box that Java needs to be installed + exec('/usr/libexec/java_home -V 2>&1', function (error, stdout) { + if (!error && stdout.toString().toLowerCase().indexOf('no java runtime') === -1) { + // now this can be done savely + exec('java -version 2>&1', function (error, stdout) { + if (!error) { + const java = stdout.toString().split('\n')[0] || ''; + const parts = java.split('"'); + appsObj.versions.java = parts.length === 3 ? parts[1].trim() : ''; + } + functionProcessed(); + }); + } else { + functionProcessed(); + } + }); + } else { + exec('java -version 2>&1', function (error, stdout) { + if (!error) { + const java = stdout.toString().split('\n')[0] || ''; + const parts = java.split('"'); + appsObj.versions.java = parts.length === 3 ? parts[1].trim() : ''; + } + functionProcessed(); + }); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'gcc')) { + if ((_darwin && util.darwinXcodeExists()) || !_darwin) { + exec('gcc -dumpversion', function (error, stdout) { + if (!error) { + appsObj.versions.gcc = stdout.toString().split('\n')[0].trim() || ''; + } + if (appsObj.versions.gcc.indexOf('.') > -1) { + functionProcessed(); + } else { + exec('gcc --version', function (error, stdout) { + if (!error) { + const gcc = stdout.toString().split('\n')[0].trim(); + if (gcc.indexOf('gcc') > -1 && gcc.indexOf(')') > -1) { + const parts = gcc.split(')'); + appsObj.versions.gcc = parts[1].trim() || appsObj.versions.gcc; + } + } + functionProcessed(); + }); + } + }); + } else { + functionProcessed(); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'virtualbox')) { + exec(util.getVboxmanage() + ' -v 2>&1', function (error, stdout) { + if (!error) { + const vbox = stdout.toString().split('\n')[0] || ''; + const parts = vbox.split('r'); + appsObj.versions.virtualbox = parts[0]; + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'bash')) { + exec('bash --version', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0]; + const parts = line.split(' version '); + if (parts.length > 1) { + appsObj.versions.bash = parts[1].split(' ')[0].split('(')[0]; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'zsh')) { + exec('zsh --version', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0]; + const parts = line.split('zsh '); + if (parts.length > 1) { + appsObj.versions.zsh = parts[1].split(' ')[0]; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'fish')) { + exec('fish --version', function (error, stdout) { + if (!error) { + const line = stdout.toString().split('\n')[0]; + const parts = line.split(' version '); + if (parts.length > 1) { + appsObj.versions.fish = parts[1].split(' ')[0]; + } + } + functionProcessed(); + }); + } + if ({}.hasOwnProperty.call(appsObj.versions, 'powershell')) { + if (_windows) { + util.powerShell('$PSVersionTable').then(stdout => { + const lines = stdout.toString().split('\n').map(line => line.replace(/ +/g, ' ').replace(/ +/g, ':')); + appsObj.versions.powershell = util.getValue(lines, 'psversion'); + functionProcessed(); + }); + } else { + functionProcessed(); + } + } + if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) { + if (_windows) { + util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => { + const lines = stdout.toString().split('\r\n'); + let dotnet = ''; + lines.forEach(line => { + line = line.replace(/ +/g, ' '); + const parts = line.split(' '); + dotnet = dotnet || (parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : '')); + }); + appsObj.versions.dotnet = dotnet.trim(); + functionProcessed(); + }); + } else { + functionProcessed(); + } + } + } catch (e) { + if (callback) { callback(appsObj.versions); } + resolve(appsObj.versions); + } + }); + }); +} + +exports.versions = versions; + +function shell(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + if (_windows) { + resolve('cmd'); + } else { + let result = ''; + exec('echo $SHELL', function (error, stdout) { + if (!error) { + result = stdout.toString().split('\n')[0]; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + }); + }); +} + +exports.shell = shell; + +function getUniqueMacAdresses() { + let macs = []; + try { + const ifaces = os.networkInterfaces(); + for (let dev in ifaces) { + if ({}.hasOwnProperty.call(ifaces, dev)) { + ifaces[dev].forEach(function (details) { + if (details && details.mac && details.mac !== '00:00:00:00:00:00') { + const mac = details.mac.toLowerCase(); + if (macs.indexOf(mac) === -1) { + macs.push(mac); + } + } + }); + } + } + macs = macs.sort(function (a, b) { + if (a < b) { return -1; } + if (a > b) { return 1; } + return 0; + }); + } catch (e) { + macs.push('00:00:00:00:00:00'); + } + return macs; +} + +function uuid(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + os: '', + hardware: '', + macs: getUniqueMacAdresses() + }; + let parts; + + if (_darwin) { + exec('system_profiler SPHardwareDataType -json', function (error, stdout) { + if (!error) { + try { + const jsonObj = JSON.parse(stdout.toString()); + if (jsonObj.SPHardwareDataType && jsonObj.SPHardwareDataType.length > 0) { + const spHardware = jsonObj.SPHardwareDataType[0]; + result.os = spHardware.platform_UUID.toLowerCase(); + result.hardware = spHardware.serial_number; + } + } catch (e) { + util.noop(); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_linux) { + const cmd = `echo -n "os: "; cat /var/lib/dbus/machine-id 2> /dev/null || +cat /etc/machine-id 2> /dev/null; echo; +echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`; + exec(cmd, function (error, stdout) { + const lines = stdout.toString().split('\n'); + result.os = util.getValue(lines, 'os').toLowerCase(); + result.hardware = util.getValue(lines, 'hardware').toLowerCase(); + if (!result.hardware) { + const lines = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n'); + const serial = util.getValue(lines, 'serial'); + result.hardware = serial || ''; + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_freebsd || _openbsd || _netbsd) { + exec('sysctl -i kern.hostid kern.hostuuid', function (error, stdout) { + const lines = stdout.toString().split('\n'); + result.os = util.getValue(lines, 'kern.hostid', ':').toLowerCase(); + result.hardware = util.getValue(lines, 'kern.hostuuid', ':').toLowerCase(); + if (result.os.indexOf('unknown') >= 0) { result.os = ''; } + if (result.hardware.indexOf('unknown') >= 0) { result.hardware = ''; } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + let sysdir = '%windir%\\System32'; + if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) { + sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32'; + } + util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => { + let lines = stdout.split('\r\n'); + result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase(); + exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) { + parts = stdout.toString().split('\n\r')[0].split('REG_SZ'); + result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : ''; + if (callback) { + callback(result); + } + resolve(result); + }); + }); + } + }); + }); +} + +exports.uuid = uuid; + + +/***/ }), + +/***/ 5727: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// printers.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 15. printers +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(2081).exec); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +const winPrinterStatus = { + 1: 'Other', + 2: 'Unknown', + 3: 'Idle', + 4: 'Printing', + 5: 'Warmup', + 6: 'Stopped Printing', + 7: 'Offline', +}; + +function parseLinuxCupsHeader(lines) { + const result = {}; + if (lines && lines.length) { + if (lines[0].indexOf(' CUPS v') > 0) { + const parts = lines[0].split(' CUPS v'); + result.cupsVersion = parts[1]; + } + } + return result; +} + +function parseLinuxCupsPrinter(lines) { + const result = {}; + const printerId = util.getValue(lines, 'PrinterId', ' '); + result.id = printerId ? parseInt(printerId, 10) : null; + result.name = util.getValue(lines, 'Info', ' '); + result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : ''; + result.uri = util.getValue(lines, 'DeviceURI', ' '); + result.uuid = util.getValue(lines, 'UUID', ' '); + result.status = util.getValue(lines, 'State', ' '); + result.local = util.getValue(lines, 'Location', ' ').toLowerCase().startsWith('local'); + result.default = null; + result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes'); + + return result; +} + +function parseLinuxLpstatPrinter(lines, id) { + const result = {}; + result.id = id; + result.name = util.getValue(lines, 'Description', ':', true); + result.model = lines.length > 0 && lines[0] ? lines[0].split(' ')[0] : ''; + result.uri = null; + result.uuid = null; + result.status = lines.length > 0 && lines[0] ? (lines[0].indexOf(' idle') > 0 ? 'idle' : (lines[0].indexOf(' printing') > 0 ? 'printing' : 'unknown')) : null; + result.local = util.getValue(lines, 'Location', ':', true).toLowerCase().startsWith('local'); + result.default = null; + result.shared = util.getValue(lines, 'Shared', ' ').toLowerCase().startsWith('yes'); + + return result; +} + +function parseDarwinPrinters(printerObject, id) { + const result = {}; + const uriParts = printerObject.uri.split('/'); + result.id = id; + result.name = printerObject._name; + result.model = uriParts.length ? uriParts[uriParts.length - 1] : ''; + result.uri = printerObject.uri; + result.uuid = null; + result.status = printerObject.status; + result.local = printerObject.printserver === 'local'; + result.default = printerObject.default === 'yes'; + result.shared = printerObject.shared === 'yes'; + + return result; +} + +function parseWindowsPrinters(lines, id) { + const result = {}; + const status = parseInt(util.getValue(lines, 'PrinterStatus', ':'), 10); + + result.id = id; + result.name = util.getValue(lines, 'name', ':'); + result.model = util.getValue(lines, 'DriverName', ':'); + result.uri = null; + result.uuid = null; + result.status = winPrinterStatus[status] ? winPrinterStatus[status] : null; + result.local = util.getValue(lines, 'Local', ':').toUpperCase() === 'TRUE'; + result.default = util.getValue(lines, 'Default', ':').toUpperCase() === 'TRUE'; + result.shared = util.getValue(lines, 'Shared', ':').toUpperCase() === 'TRUE'; + + return result; +} + +function printer(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux || _freebsd || _openbsd || _netbsd) { + let cmd = 'cat /etc/cups/printers.conf 2>/dev/null'; + exec(cmd, function (error, stdout) { + // printers.conf + if (!error) { + const parts = stdout.toString().split(' { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + for (let i = 0; i < parts.length; i++) { + const printer = parseWindowsPrinters(parts[i].split('\n'), i); + if (printer.name || printer.model) { + result.push(printer); + } + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos) { + resolve(null); + } + }); + }); +} + +exports.printer = printer; + + +/***/ }), + +/***/ 7157: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// processes.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 10. Processes +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const fs = __nccwpck_require__(7147); +const path = __nccwpck_require__(1017); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); + +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +const _processes_cpu = { + all: 0, + all_utime: 0, + all_stime: 0, + list: {}, + ms: 0, + result: {} +}; +const _services_cpu = { + all: 0, + all_utime: 0, + all_stime: 0, + list: {}, + ms: 0, + result: {} +}; +const _process_cpu = { + all: 0, + all_utime: 0, + all_stime: 0, + list: {}, + ms: 0, + result: {} +}; + +const _winStatusValues = { + '0': 'unknown', + '1': 'other', + '2': 'ready', + '3': 'running', + '4': 'blocked', + '5': 'suspended blocked', + '6': 'suspended ready', + '7': 'terminated', + '8': 'stopped', + '9': 'growing', +}; + +function parseTimeUnix(time) { + let result = time; + let parts = time.replace(/ +/g, ' ').split(' '); + if (parts.length === 5) { + result = parts[4] + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(parts[1].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + parts[2]).slice(-2) + ' ' + parts[3]; + } + return result; +} + +function parseElapsedTime(etime) { + let current = new Date(); + current = new Date(current.getTime() - current.getTimezoneOffset() * 60000); + + const elapsed = etime.split('-'); + + const timeIndex = elapsed.length - 1; + const days = timeIndex > 0 ? parseInt(elapsed[timeIndex - 1]) : 0; + + const timeStr = elapsed[timeIndex].split(':'); + const hours = timeStr.length === 3 ? parseInt(timeStr[0] || 0) : 0; + const mins = parseInt(timeStr[timeStr.length === 3 ? 1 : 0] || 0); + const secs = parseInt(timeStr[timeStr.length === 3 ? 2 : 1] || 0); + const ms = (((((days * 24 + hours) * 60) + mins) * 60 + secs) * 1000); + + let res = new Date(current.getTime()); + let result = res.toISOString().substring(0, 10) + ' ' + res.toISOString().substring(11, 19); + try { + res = new Date(current.getTime() - ms); + result = res.toISOString().substring(0, 10) + ' ' + res.toISOString().substring(11, 19); + } catch (e) { + util.noop(); + } + return result; +} + +// -------------------------- +// PS - services +// pass a comma separated string with services to check (mysql, apache, postgresql, ...) +// this function gives an array back, if the services are running. + +function services(srv, callback) { + + // fallback - if only callback is given + if (util.isFunction(srv) && !callback) { + callback = srv; + srv = ''; + } + + return new Promise((resolve) => { + process.nextTick(() => { + if (typeof srv !== 'string') { + if (callback) { callback([]); } + return resolve([]); + } + + if (srv) { + let srvString = ''; + srvString.__proto__.toLowerCase = util.stringToLower; + srvString.__proto__.replace = util.stringReplace; + srvString.__proto__.trim = util.stringTrim; + + const s = util.sanitizeShellString(srv); + const l = util.mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + srvString = srvString + s[i]; + } + } + + srvString = srvString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|'); + if (srvString === '') { + srvString = '*'; + } + if (util.isPrototypePolluted() && srvString !== '*') { + srvString = '------'; + } + let srvs = srvString.split('|'); + let result = []; + let dataSrv = []; + + if (_linux || _freebsd || _openbsd || _netbsd || _darwin) { + if ((_linux || _freebsd || _openbsd || _netbsd) && srvString === '*') { + try { + const tmpsrv = execSync('systemctl --all --type=service --no-legend 2> /dev/null', util.execOptsLinux).toString().split('\n'); + srvs = []; + for (const s of tmpsrv) { + const name = s.split('.service')[0]; + if (name && s.indexOf(' not-found ') === -1) { + srvs.push(name.trim()); + } + } + srvString = srvs.join('|'); + } catch (d) { + try { + srvString = ''; + const tmpsrv = execSync('service --status-all 2> /dev/null', util.execOptsLinux).toString().split('\n'); + for (const s of tmpsrv) { + const parts = s.split(']'); + if (parts.length === 2) { + srvString += (srvString !== '' ? '|' : '') + parts[1].trim(); + } + } + srvs = srvString.split('|'); + } catch (e) { + try { + const srvStr = execSync('ls /etc/init.d/ -m 2> /dev/null', util.execOptsLinux).toString().split('\n').join(''); + srvString = ''; + if (srvStr) { + const tmpsrv = srvStr.split(','); + for (const s of tmpsrv) { + const name = s.trim(); + if (name) { + srvString += (srvString !== '' ? '|' : '') + name; + } + } + srvs = srvString.split('|'); + } + } catch (f) { + srvString = ''; + srvs = []; + } + } + } + } + if ((_darwin) && srvString === '*') { // service enumeration not yet suported on mac OS + if (callback) { callback(result); } + resolve(result); + } + let args = (_darwin) ? ['-caxo', 'pcpu,pmem,pid,command'] : ['-axo', 'pcpu,pmem,pid,command']; + if (srvString !== '' && srvs.length > 0) { + util.execSafe('ps', args).then((stdout) => { + if (stdout) { + let lines = stdout.replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); + srvs.forEach(function (srv) { + let ps; + if (_darwin) { + ps = lines.filter(function (e) { + return (e.toLowerCase().indexOf(srv) !== -1); + }); + + } else { + ps = lines.filter(function (e) { + return (e.toLowerCase().indexOf(' ' + srv.toLowerCase() + ':') !== -1) || (e.toLowerCase().indexOf('/' + srv.toLowerCase()) !== -1); + }); + } + const pids = []; + for (const p of ps) { + const pid = p.trim().split(' ')[2]; + if (pid) { + pids.push(parseInt(pid, 10)); + } + } + result.push({ + name: srv, + running: ps.length > 0, + startmode: '', + pids: pids, + cpu: parseFloat((ps.reduce(function (pv, cv) { + return pv + parseFloat(cv.trim().split(' ')[0]); + }, 0)).toFixed(2)), + mem: parseFloat((ps.reduce(function (pv, cv) { + return pv + parseFloat(cv.trim().split(' ')[1]); + }, 0)).toFixed(2)) + }); + }); + if (_linux) { + // calc process_cpu - ps is not accurate in linux! + let cmd = 'cat /proc/stat | grep "cpu "'; + for (let i in result) { + for (let j in result[i].pids) { + cmd += (';cat /proc/' + result[i].pids[j] + '/stat'); + } + } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let curr_processes = stdout.toString().split('\n'); + + // first line (all - /proc/stat) + let all = parseProcStat(curr_processes.shift()); + + // process + let list_new = {}; + let resultProcess = {}; + curr_processes.forEach((element) => { + resultProcess = calcProcStatLinux(element, all, _services_cpu); + + if (resultProcess.pid) { + let listPos = -1; + for (let i in result) { + for (let j in result[i].pids) { + if (parseInt(result[i].pids[j]) === parseInt(resultProcess.pid)) { + listPos = i; + } + } + } + if (listPos >= 0) { + result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime, + cutime: resultProcess.cutime, + cstime: resultProcess.cstime + }; + } + }); + + // store old values + _services_cpu.all = all; + _services_cpu.list = Object.assign({}, list_new); + _services_cpu.ms = Date.now() - _services_cpu.ms; + _services_cpu.result = Object.assign({}, result); + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + args = ['-o', 'comm']; + util.execSafe('ps', args).then((stdout) => { + if (stdout) { + let lines = stdout.replace(/ +/g, ' ').replace(/,+/g, '.').split('\n'); + srvs.forEach(function (srv) { + let ps = lines.filter(function (e) { + return e.indexOf(srv) !== -1; + }); + result.push({ + name: srv, + running: ps.length > 0, + startmode: '', + cpu: 0, + mem: 0 + }); + }); + if (callback) { callback(result); } + resolve(result); + } else { + srvs.forEach(function (srv) { + result.push({ + name: srv, + running: false, + startmode: '', + cpu: 0, + mem: 0 + }); + }); + if (callback) { callback(result); } + resolve(result); + } + }); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } + if (_windows) { + try { + let wincommand = 'Get-CimInstance Win32_Service'; + if (srvs[0] !== '*') { + wincommand += ' -Filter "'; + srvs.forEach((srv) => { + wincommand += `Name='${srv}' or `; + }); + wincommand = `${wincommand.slice(0, -4)}"`; + } + wincommand += ' | select Name,Caption,Started,StartMode,ProcessId | fl'; + util.powerShell(wincommand).then((stdout, error) => { + if (!error) { + let serviceSections = stdout.split(/\n\s*\n/); + serviceSections.forEach((element) => { + if (element.trim() !== '') { + let lines = element.trim().split('\r\n'); + let srvName = util.getValue(lines, 'Name', ':', true).toLowerCase(); + let srvCaption = util.getValue(lines, 'Caption', ':', true).toLowerCase(); + let started = util.getValue(lines, 'Started', ':', true); + let startMode = util.getValue(lines, 'StartMode', ':', true); + let pid = util.getValue(lines, 'ProcessId', ':', true); + if (srvString === '*' || srvs.indexOf(srvName) >= 0 || srvs.indexOf(srvCaption) >= 0) { + result.push({ + name: srvName, + running: (started.toLowerCase() === 'true'), + startmode: startMode, + pids: [pid], + cpu: 0, + mem: 0 + }); + dataSrv.push(srvName); + dataSrv.push(srvCaption); + } + } + + }); + + if (srvString !== '*') { + let srvsMissing = srvs.filter(function (e) { + return dataSrv.indexOf(e) === -1; + }); + srvsMissing.forEach(function (srvName) { + result.push({ + name: srvName, + running: false, + startmode: '', + pids: [], + cpu: 0, + mem: 0 + }); + }); + } + if (callback) { callback(result); } + resolve(result); + } else { + srvs.forEach(function (srvName) { + result.push({ + name: srvName, + running: false, + startmode: '', + cpu: 0, + mem: 0 + }); + }); + if (callback) { callback(result); } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + } else { + if (callback) { callback([]); } + resolve([]); + } + }); + }); +} + +exports.services = services; + +function parseProcStat(line) { + let parts = line.replace(/ +/g, ' ').split(' '); + let user = (parts.length >= 2 ? parseInt(parts[1]) : 0); + let nice = (parts.length >= 3 ? parseInt(parts[2]) : 0); + let system = (parts.length >= 4 ? parseInt(parts[3]) : 0); + let idle = (parts.length >= 5 ? parseInt(parts[4]) : 0); + let iowait = (parts.length >= 6 ? parseInt(parts[5]) : 0); + let irq = (parts.length >= 7 ? parseInt(parts[6]) : 0); + let softirq = (parts.length >= 8 ? parseInt(parts[7]) : 0); + let steal = (parts.length >= 9 ? parseInt(parts[8]) : 0); + let guest = (parts.length >= 10 ? parseInt(parts[9]) : 0); + let guest_nice = (parts.length >= 11 ? parseInt(parts[10]) : 0); + return user + nice + system + idle + iowait + irq + softirq + steal + guest + guest_nice; +} + +function calcProcStatLinux(line, all, _cpu_old) { + let statparts = line.replace(/ +/g, ' ').split(')'); + if (statparts.length >= 2) { + let parts = statparts[1].split(' '); + if (parts.length >= 16) { + let pid = parseInt(statparts[0].split(' ')[0]); + let utime = parseInt(parts[12]); + let stime = parseInt(parts[13]); + let cutime = parseInt(parts[14]); + let cstime = parseInt(parts[15]); + + // calc + let cpuu = 0; + let cpus = 0; + if (_cpu_old.all > 0 && _cpu_old.list[pid]) { + cpuu = (utime + cutime - _cpu_old.list[pid].utime - _cpu_old.list[pid].cutime) / (all - _cpu_old.all) * 100; // user + cpus = (stime + cstime - _cpu_old.list[pid].stime - _cpu_old.list[pid].cstime) / (all - _cpu_old.all) * 100; // system + } else { + cpuu = (utime + cutime) / (all) * 100; // user + cpus = (stime + cstime) / (all) * 100; // system + } + return { + pid: pid, + utime: utime, + stime: stime, + cutime: cutime, + cstime: cstime, + cpuu: cpuu, + cpus: cpus + }; + } else { + return { + pid: 0, + utime: 0, + stime: 0, + cutime: 0, + cstime: 0, + cpuu: 0, + cpus: 0 + }; + } + } else { + return { + pid: 0, + utime: 0, + stime: 0, + cutime: 0, + cstime: 0, + cpuu: 0, + cpus: 0 + }; + } +} + +function calcProcStatWin(procStat, all, _cpu_old) { + // calc + let cpuu = 0; + let cpus = 0; + if (_cpu_old.all > 0 && _cpu_old.list[procStat.pid]) { + cpuu = (procStat.utime - _cpu_old.list[procStat.pid].utime) / (all - _cpu_old.all) * 100; // user + cpus = (procStat.stime - _cpu_old.list[procStat.pid].stime) / (all - _cpu_old.all) * 100; // system + } else { + cpuu = (procStat.utime) / (all) * 100; // user + cpus = (procStat.stime) / (all) * 100; // system + } + return { + pid: procStat.pid, + utime: procStat.utime, + stime: procStat.stime, + cpuu: cpuu > 0 ? cpuu : 0, + cpus: cpus > 0 ? cpus : 0 + }; +} + + + +// -------------------------- +// running processes + +function processes(callback) { + + let parsedhead = []; + + function getName(command) { + command = command || ''; + let result = command.split(' ')[0]; + if (result.substr(-1) === ':') { + result = result.substr(0, result.length - 1); + } + if (result.substr(0, 1) !== '[') { + let parts = result.split('/'); + if (isNaN(parseInt(parts[parts.length - 1]))) { + result = parts[parts.length - 1]; + } else { + result = parts[0]; + } + } + return result; + } + + function parseLine(line) { + + let offset = 0; + let offset2 = 0; + + function checkColumn(i) { + offset = offset2; + if (parsedhead[i]) { + offset2 = line.substring(parsedhead[i].to + offset, 10000).indexOf(' '); + } else { + offset2 = 10000; + } + } + + checkColumn(0); + const pid = parseInt(line.substring(parsedhead[0].from + offset, parsedhead[0].to + offset2)); + checkColumn(1); + const ppid = parseInt(line.substring(parsedhead[1].from + offset, parsedhead[1].to + offset2)); + checkColumn(2); + const cpu = parseFloat(line.substring(parsedhead[2].from + offset, parsedhead[2].to + offset2).replace(/,/g, '.')); + checkColumn(3); + const mem = parseFloat(line.substring(parsedhead[3].from + offset, parsedhead[3].to + offset2).replace(/,/g, '.')); + checkColumn(4); + const priority = parseInt(line.substring(parsedhead[4].from + offset, parsedhead[4].to + offset2)); + checkColumn(5); + const vsz = parseInt(line.substring(parsedhead[5].from + offset, parsedhead[5].to + offset2)); + checkColumn(6); + const rss = parseInt(line.substring(parsedhead[6].from + offset, parsedhead[6].to + offset2)); + checkColumn(7); + const nice = parseInt(line.substring(parsedhead[7].from + offset, parsedhead[7].to + offset2)) || 0; + checkColumn(8); + const started = !_sunos ? parseElapsedTime(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim()) : parseTimeUnix(line.substring(parsedhead[8].from + offset, parsedhead[8].to + offset2).trim()); + checkColumn(9); + let state = line.substring(parsedhead[9].from + offset, parsedhead[9].to + offset2).trim(); + state = (state[0] === 'R' ? 'running' : (state[0] === 'S' ? 'sleeping' : (state[0] === 'T' ? 'stopped' : (state[0] === 'W' ? 'paging' : (state[0] === 'X' ? 'dead' : (state[0] === 'Z' ? 'zombie' : ((state[0] === 'D' || state[0] === 'U') ? 'blocked' : 'unknown'))))))); + checkColumn(10); + let tty = line.substring(parsedhead[10].from + offset, parsedhead[10].to + offset2).trim(); + if (tty === '?' || tty === '??') { tty = ''; } + checkColumn(11); + const user = line.substring(parsedhead[11].from + offset, parsedhead[11].to + offset2).trim(); + checkColumn(12); + let cmdPath = ''; + let command = ''; + let params = ''; + let fullcommand = line.substring(parsedhead[12].from + offset, parsedhead[12].to + offset2).trim(); + if (fullcommand.substr(fullcommand.length - 1) === ']') { fullcommand = fullcommand.slice(0, -1); } + if (fullcommand.substr(0, 1) === '[') { command = fullcommand.substring(1); } + else { + const p1 = fullcommand.indexOf('('); + const p2 = fullcommand.indexOf(')'); + const p3 = fullcommand.indexOf('/'); + const p4 = fullcommand.indexOf(':'); + if (p1 < p2 && p1 < p3 && p3 < p2) { + command = fullcommand.split(' ')[0]; + command = command.replace(/:/g, ''); + } else { + if (p4 > 0 && (p3 === -1 || p3 > 3)) { + command = fullcommand.split(' ')[0]; + command = command.replace(/:/g, ''); + } else { + // try to figure out where parameter starts + let firstParamPos = fullcommand.indexOf(' -'); + let firstParamPathPos = fullcommand.indexOf(' /'); + firstParamPos = (firstParamPos >= 0 ? firstParamPos : 10000); + firstParamPathPos = (firstParamPathPos >= 0 ? firstParamPathPos : 10000); + const firstPos = Math.min(firstParamPos, firstParamPathPos); + let tmpCommand = fullcommand.substr(0, firstPos); + const tmpParams = fullcommand.substr(firstPos); + const lastSlashPos = tmpCommand.lastIndexOf('/'); + if (lastSlashPos >= 0) { + cmdPath = tmpCommand.substr(0, lastSlashPos); + tmpCommand = tmpCommand.substr(lastSlashPos + 1); + } + + if (firstPos === 10000 && tmpCommand.indexOf(' ') > -1) { + const parts = tmpCommand.split(' '); + if (fs.existsSync(path.join(cmdPath, parts[0]))) { + command = parts.shift(); + params = (parts.join(' ') + ' ' + tmpParams).trim(); + } else { + command = tmpCommand.trim(); + params = tmpParams.trim(); + } + } else { + command = tmpCommand.trim(); + params = tmpParams.trim(); + } + } + } + + } + + return ({ + pid: pid, + parentPid: ppid, + name: _linux ? getName(command) : command, + cpu: cpu, + cpuu: 0, + cpus: 0, + mem: mem, + priority: priority, + memVsz: vsz, + memRss: rss, + nice: nice, + started: started, + state: state, + tty: tty, + user: user, + command: command, + params: params, + path: cmdPath + }); + } + + function parseProcesses(lines) { + let result = []; + if (lines.length > 1) { + let head = lines[0]; + parsedhead = util.parseHead(head, 8); + lines.shift(); + lines.forEach(function (line) { + if (line.trim() !== '') { + result.push(parseLine(line)); + } + }); + } + return result; + } + function parseProcesses2(lines) { + + function formatDateTime(time) { + const month = ('0' + (time.getMonth() + 1).toString()).slice(-2); + const year = time.getFullYear().toString(); + const day = ('0' + time.getDate().toString()).slice(-2); + const hours = ('0' + time.getHours().toString()).slice(-2); + const mins = ('0' + time.getMinutes().toString()).slice(-2); + const secs = ('0' + time.getSeconds().toString()).slice(-2); + + return (year + '-' + month + '-' + day + ' ' + hours + ':' + mins + ':' + secs); + } + + function parseElapsed(etime) { + let started = ''; + if (etime.indexOf('d') >= 0) { + const elapsed_parts = etime.split('d'); + started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 24 + elapsed_parts[1] * 1) * 60 * 60 * 1000)); + } else if (etime.indexOf('h') >= 0) { + const elapsed_parts = etime.split('h'); + started = formatDateTime(new Date(Date.now() - (elapsed_parts[0] * 60 + elapsed_parts[1] * 1) * 60 * 1000)); + } else if (etime.indexOf(':') >= 0) { + const elapsed_parts = etime.split(':'); + started = formatDateTime(new Date(Date.now() - (elapsed_parts.length > 1 ? (elapsed_parts[0] * 60 + elapsed_parts[1]) * 1000 : elapsed_parts[0] * 1000))); + } + return started; + } + + let result = []; + lines.forEach(function (line) { + if (line.trim() !== '') { + line = line.trim().replace(/ +/g, ' ').replace(/,+/g, '.'); + const parts = line.split(' '); + const command = parts.slice(9).join(' '); + const pmem = parseFloat((1.0 * parseInt(parts[3]) * 1024 / os.totalmem()).toFixed(1)); + const started = parseElapsed(parts[5]); + + result.push({ + pid: parseInt(parts[0]), + parentPid: parseInt(parts[1]), + name: getName(command), + cpu: 0, + cpuu: 0, + cpus: 0, + mem: pmem, + priority: 0, + memVsz: parseInt(parts[2]), + memRss: parseInt(parts[3]), + nice: parseInt(parts[4]), + started: started, + state: (parts[6] === 'R' ? 'running' : (parts[6] === 'S' ? 'sleeping' : (parts[6] === 'T' ? 'stopped' : (parts[6] === 'W' ? 'paging' : (parts[6] === 'X' ? 'dead' : (parts[6] === 'Z' ? 'zombie' : ((parts[6] === 'D' || parts[6] === 'U') ? 'blocked' : 'unknown'))))))), + tty: parts[7], + user: parts[8], + command: command + }); + } + }); + return result; + } + + return new Promise((resolve) => { + process.nextTick(() => { + let result = { + all: 0, + running: 0, + blocked: 0, + sleeping: 0, + unknown: 0, + list: [] + }; + + let cmd = ''; + + if ((_processes_cpu.ms && Date.now() - _processes_cpu.ms >= 500) || _processes_cpu.ms === 0) { + if (_linux || _freebsd || _openbsd || _netbsd || _darwin || _sunos) { + if (_linux) { cmd = 'export LC_ALL=C; ps -axo pid:11,ppid:11,pcpu:6,pmem:6,pri:5,vsz:11,rss:11,ni:5,etime:30,state:5,tty:15,user:20,command; unset LC_ALL'; } + if (_freebsd || _openbsd || _netbsd) { cmd = 'export LC_ALL=C; ps -axo pid,ppid,pcpu,pmem,pri,vsz,rss,ni,etime,state,tty,user,command; unset LC_ALL'; } + if (_darwin) { cmd = 'ps -axo pid,ppid,pcpu,pmem,pri,vsz=temp_title_1,rss=temp_title_2,nice,etime=temp_title_3,state,tty,user,command -r'; } + if (_sunos) { cmd = 'ps -Ao pid,ppid,pcpu,pmem,pri,vsz,rss,nice,stime,s,tty,user,comm'; } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error && stdout.toString().trim()) { + result.list = (parseProcesses(stdout.toString().split('\n'))).slice(); + result.all = result.list.length; + result.running = result.list.filter(function (e) { + return e.state === 'running'; + }).length; + result.blocked = result.list.filter(function (e) { + return e.state === 'blocked'; + }).length; + result.sleeping = result.list.filter(function (e) { + return e.state === 'sleeping'; + }).length; + + if (_linux) { + // calc process_cpu - ps is not accurate in linux! + cmd = 'cat /proc/stat | grep "cpu "'; + result.list.forEach((element) => { + cmd += (';cat /proc/' + element.pid + '/stat'); + }); + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let curr_processes = stdout.toString().split('\n'); + + // first line (all - /proc/stat) + let all = parseProcStat(curr_processes.shift()); + + // process + let list_new = {}; + let resultProcess = {}; + curr_processes.forEach((element) => { + resultProcess = calcProcStatLinux(element, all, _processes_cpu); + + if (resultProcess.pid) { + + // store pcpu in outer array + let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid); + if (listPos >= 0) { + result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus; + result.list[listPos].cpuu = resultProcess.cpuu; + result.list[listPos].cpus = resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime, + cutime: resultProcess.cutime, + cstime: resultProcess.cstime + }; + } + }); + + // store old values + _processes_cpu.all = all; + _processes_cpu.list = Object.assign({}, list_new); + _processes_cpu.ms = Date.now() - _processes_cpu.ms; + _processes_cpu.result = Object.assign({}, result); + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,stat,tty,user,comm'; + if (_sunos) { + cmd = 'ps -o pid,ppid,vsz,rss,nice,etime,s,tty,user,comm'; + } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + lines.shift(); + + result.list = parseProcesses2(lines).slice(); + result.all = result.list.length; + result.running = result.list.filter(function (e) { + return e.state === 'running'; + }).length; + result.blocked = result.list.filter(function (e) { + return e.state === 'blocked'; + }).length; + result.sleeping = result.list.filter(function (e) { + return e.state === 'sleeping'; + }).length; + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + }); + } else if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_Process | select-Object ProcessId,ParentProcessId,ExecutionState,Caption,CommandLine,ExecutablePath,UserModeTime,KernelModeTime,WorkingSetSize,Priority,PageFileUsage, @{n="CreationDate";e={$_.CreationDate.ToString("yyyy-MM-dd HH:mm:ss")}} | fl').then((stdout, error) => { + if (!error) { + let processSections = stdout.split(/\n\s*\n/); + let procs = []; + let procStats = []; + let list_new = {}; + let allcpuu = 0; + let allcpus = 0; + processSections.forEach((element) => { + if (element.trim() !== '') { + let lines = element.trim().split('\r\n'); + let pid = parseInt(util.getValue(lines, 'ProcessId', ':', true), 10); + let parentPid = parseInt(util.getValue(lines, 'ParentProcessId', ':', true), 10); + let statusValue = util.getValue(lines, 'ExecutionState', ':'); + let name = util.getValue(lines, 'Caption', ':', true); + let commandLine = util.getValue(lines, 'CommandLine', ':', true); + // get additional command line data + let additionalCommand = false; + lines.forEach((line) => { + if (additionalCommand && line.toLowerCase().startsWith(' ')) { + commandLine += ' ' + line.trim(); + } else { + additionalCommand = false; + } + if (line.toLowerCase().startsWith('commandline')) { + additionalCommand = true; + } + }); + let commandPath = util.getValue(lines, 'ExecutablePath', ':', true); + let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); + let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); + let memw = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); + allcpuu = allcpuu + utime; + allcpus = allcpus + stime; + result.all++; + if (!statusValue) { result.unknown++; } + if (statusValue === '3') { result.running++; } + if (statusValue === '4' || statusValue === '5') { result.blocked++; } + + procStats.push({ + pid: pid, + utime: utime, + stime: stime, + cpu: 0, + cpuu: 0, + cpus: 0, + }); + procs.push({ + pid: pid, + parentPid: parentPid, + name: name, + cpu: 0, + cpuu: 0, + cpus: 0, + mem: memw / os.totalmem() * 100, + priority: parseInt(util.getValue(lines, 'Priority', ':', true), 10), + memVsz: parseInt(util.getValue(lines, 'PageFileUsage', ':', true), 10), + memRss: Math.floor(parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10) / 1024), + nice: 0, + started: util.getValue(lines, 'CreationDate', ':', true), + state: (!statusValue ? _winStatusValues[0] : _winStatusValues[statusValue]), + tty: '', + user: '', + command: commandLine || name, + path: commandPath, + params: '' + }); + } + }); + + result.sleeping = result.all - result.running - result.blocked - result.unknown; + result.list = procs; + procStats.forEach((element) => { + let resultProcess = calcProcStatWin(element, allcpuu + allcpus, _processes_cpu); + + // store pcpu in outer array + let listPos = result.list.map(function (e) { return e.pid; }).indexOf(resultProcess.pid); + if (listPos >= 0) { + result.list[listPos].cpu = resultProcess.cpuu + resultProcess.cpus; + result.list[listPos].cpuu = resultProcess.cpuu; + result.list[listPos].cpus = resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime + }; + }); + + // store old values + _processes_cpu.all = allcpuu + allcpus; + _processes_cpu.all_utime = allcpuu; + _processes_cpu.all_stime = allcpus; + _processes_cpu.list = Object.assign({}, list_new); + _processes_cpu.ms = Date.now() - _processes_cpu.ms; + _processes_cpu.result = Object.assign({}, result); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(_processes_cpu.result); } + resolve(_processes_cpu.result); + } + }); + }); +} + +exports.processes = processes; + +// -------------------------- +// PS - process load +// get detailed information about a certain process +// (PID, CPU-Usage %, Mem-Usage %) + +function processLoad(proc, callback) { + + // fallback - if only callback is given + if (util.isFunction(proc) && !callback) { + callback = proc; + proc = ''; + } + + return new Promise((resolve) => { + process.nextTick(() => { + + proc = proc || ''; + + if (typeof proc !== 'string') { + if (callback) { callback([]); } + return resolve([]); + } + + let processesString = ''; + processesString.__proto__.toLowerCase = util.stringToLower; + processesString.__proto__.replace = util.stringReplace; + processesString.__proto__.trim = util.stringTrim; + + const s = util.sanitizeShellString(proc); + const l = util.mathMin(s.length, 2000); + + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + processesString = processesString + s[i]; + } + } + + processesString = processesString.trim().toLowerCase().replace(/, /g, '|').replace(/,+/g, '|'); + if (processesString === '') { + processesString = '*'; + } + if (util.isPrototypePolluted() && processesString !== '*') { + processesString = '------'; + } + let processes = processesString.split('|'); + let result = []; + + const procSanitized = util.isPrototypePolluted() ? '' : util.sanitizeShellString(proc); + + // from here new + // let result = { + // 'proc': procSanitized, + // 'pid': null, + // 'cpu': 0, + // 'mem': 0 + // }; + if (procSanitized && processes.length && processes[0] !== '------') { + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_Process | select ProcessId,Caption,UserModeTime,KernelModeTime,WorkingSetSize | fl').then((stdout, error) => { + if (!error) { + let processSections = stdout.split(/\n\s*\n/); + let procStats = []; + let list_new = {}; + let allcpuu = 0; + let allcpus = 0; + + // go through all processes + processSections.forEach((element) => { + if (element.trim() !== '') { + let lines = element.trim().split('\r\n'); + let pid = parseInt(util.getValue(lines, 'ProcessId', ':', true), 10); + let name = util.getValue(lines, 'Caption', ':', true); + let utime = parseInt(util.getValue(lines, 'UserModeTime', ':', true), 10); + let stime = parseInt(util.getValue(lines, 'KernelModeTime', ':', true), 10); + let mem = parseInt(util.getValue(lines, 'WorkingSetSize', ':', true), 10); + allcpuu = allcpuu + utime; + allcpus = allcpus + stime; + + procStats.push({ + pid: pid, + name, + utime: utime, + stime: stime, + cpu: 0, + cpuu: 0, + cpus: 0, + mem + }); + let pname = ''; + let inList = false; + processes.forEach(function (proc) { + if (name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) { + inList = true; + pname = proc; + } + }); + + if (processesString === '*' || inList) { + let processFound = false; + result.forEach(function (item) { + if (item.proc.toLowerCase() === pname.toLowerCase()) { + item.pids.push(pid); + item.mem += mem / os.totalmem() * 100; + processFound = true; + } + }); + if (!processFound) { + result.push({ + proc: pname, + pid: pid, + pids: [pid], + cpu: 0, + mem: mem / os.totalmem() * 100 + }); + } + } + } + }); + + // add missing processes + if (processesString !== '*') { + let processesMissing = processes.filter(function (name) { + return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0; + + }); + processesMissing.forEach(function (procName) { + result.push({ + proc: procName, + pid: null, + pids: [], + cpu: 0, + mem: 0 + }); + }); + } + + // calculate proc stats for each proc + procStats.forEach((element) => { + let resultProcess = calcProcStatWin(element, allcpuu + allcpus, _process_cpu); + + let listPos = -1; + for (let j = 0; j < result.length; j++) { + if (result[j].pid === resultProcess.pid || result[j].pids.indexOf(resultProcess.pid) >= 0) { listPos = j; } + } + if (listPos >= 0) { + result[listPos].cpu += resultProcess.cpuu + resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime + }; + }); + + // store old values + _process_cpu.all = allcpuu + allcpus; + _process_cpu.all_utime = allcpuu; + _process_cpu.all_stime = allcpus; + _process_cpu.list = Object.assign({}, list_new); + _process_cpu.ms = Date.now() - _process_cpu.ms; + _process_cpu.result = JSON.parse(JSON.stringify(result)); + if (callback) { + callback(result); + } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + + if (_darwin || _linux || _freebsd || _openbsd || _netbsd) { + const params = ['-axo', 'pid,ppid,pcpu,pmem,comm']; + util.execSafe('ps', params).then((stdout) => { + if (stdout) { + let procStats = []; + let lines = stdout.toString().split('\n').filter(function (line) { + if (processesString === '*') { return true; } + if (line.toLowerCase().indexOf('grep') !== -1) { return false; } // remove this?? + let found = false; + processes.forEach(function (item) { + found = found || (line.toLowerCase().indexOf(item.toLowerCase()) >= 0); + }); + return found; + }); + + lines.forEach(function (line) { + let data = line.trim().replace(/ +/g, ' ').split(' '); + if (data.length > 4) { + procStats.push({ + name: data[4].substring(data[4].lastIndexOf('/') + 1), + pid: parseInt(data[0]) || 0, + ppid: parseInt(data[1]) || 0, + cpu: parseFloat(data[2].replace(',', '.')), + mem: parseFloat(data[3].replace(',', '.')) + }); + } + }); + + procStats.forEach(function (item) { + let listPos = -1; + let inList = false; + let name = ''; + for (let j = 0; j < result.length; j++) { + if (item.name.toLowerCase().indexOf(result[j].proc.toLowerCase()) >= 0) { + listPos = j; + } + } + processes.forEach(function (proc) { + + if (item.name.toLowerCase().indexOf(proc.toLowerCase()) >= 0 && !inList) { + inList = true; + name = proc; + } + }); + if ((processesString === '*') || inList) { + if (listPos < 0) { + result.push({ + proc: name, + pid: item.pid, + pids: [item.pid], + cpu: item.cpu, + mem: item.mem + }); + } else { + if (item.ppid < 10) { + result[listPos].pid = item.pid; + } + result[listPos].pids.push(item.pid); + result[listPos].cpu += item.cpu; + result[listPos].mem += item.mem; + } + } + }); + + if (processesString !== '*') { + // add missing processes + let processesMissing = processes.filter(function (name) { + return procStats.filter(function (item) { return item.name.toLowerCase().indexOf(name) >= 0; }).length === 0; + }); + processesMissing.forEach(function (procName) { + result.push({ + proc: procName, + pid: null, + pids: [], + cpu: 0, + mem: 0 + }); + }); + } + if (_linux) { + // calc process_cpu - ps is not accurate in linux! + result.forEach(function (item) { + item.cpu = 0; + }); + let cmd = 'cat /proc/stat | grep "cpu "'; + for (let i in result) { + for (let j in result[i].pids) { + cmd += (';cat /proc/' + result[i].pids[j] + '/stat'); + } + } + exec(cmd, { maxBuffer: 1024 * 20000 }, function (error, stdout) { + let curr_processes = stdout.toString().split('\n'); + + // first line (all - /proc/stat) + let all = parseProcStat(curr_processes.shift()); + + // process + let list_new = {}; + let resultProcess = {}; + curr_processes.forEach((element) => { + resultProcess = calcProcStatLinux(element, all, _process_cpu); + + if (resultProcess.pid) { + + // find result item + let resultItemId = -1; + for (let i in result) { + if (result[i].pids.indexOf(resultProcess.pid) >= 0) { + resultItemId = i; + } + } + // store pcpu in outer result + if (resultItemId >= 0) { + result[resultItemId].cpu += resultProcess.cpuu + resultProcess.cpus; + } + + // save new values + list_new[resultProcess.pid] = { + cpuu: resultProcess.cpuu, + cpus: resultProcess.cpus, + utime: resultProcess.utime, + stime: resultProcess.stime, + cutime: resultProcess.cutime, + cstime: resultProcess.cstime + }; + } + }); + + result.forEach(function (item) { + item.cpu = Math.round(item.cpu * 100) / 100; + }); + + _process_cpu.all = all; + _process_cpu.list = Object.assign({}, list_new); + _process_cpu.ms = Date.now() - _process_cpu.ms; + _process_cpu.result = Object.assign({}, result); + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + } + }); + }); +} + +exports.processLoad = processLoad; + + +/***/ }), + +/***/ 3888: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// system.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 2. System (Hardware, BIOS, Base Board) +// ---------------------------------------------------------------------------------- + +const fs = __nccwpck_require__(7147); +const os = __nccwpck_require__(2037); +const util = __nccwpck_require__(9872); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const execPromise = util.promisify((__nccwpck_require__(2081).exec)); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function system(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + manufacturer: '', + model: 'Computer', + version: '', + serial: '-', + uuid: '-', + sku: '-', + virtual: false + }; + + if (_linux || _freebsd || _openbsd || _netbsd) { + exec('export LC_ALL=C; dmidecode -t system 2>/dev/null; unset LC_ALL', function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.manufacturer = util.getValue(lines, 'manufacturer'); + result.model = util.getValue(lines, 'product name'); + result.version = util.getValue(lines, 'version'); + result.serial = util.getValue(lines, 'serial number'); + result.uuid = util.getValue(lines, 'uuid').toLowerCase(); + result.sku = util.getValue(lines, 'sku number'); + // Non-Root values + const cmd = `echo -n "product_name: "; cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null; echo; + echo -n "product_serial: "; cat /sys/devices/virtual/dmi/id/product_serial 2>/dev/null; echo; + echo -n "product_uuid: "; cat /sys/devices/virtual/dmi/id/product_uuid 2>/dev/null; echo; + echo -n "product_version: "; cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null; echo; + echo -n "sys_vendor: "; cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null; echo;`; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + result.manufacturer = result.manufacturer === '' ? util.getValue(lines, 'sys_vendor') : result.manufacturer; + result.model = result.model === '' ? util.getValue(lines, 'product_name') : result.model; + result.version = result.version === '' ? util.getValue(lines, 'product_version') : result.version; + result.serial = result.serial === '' ? util.getValue(lines, 'product_serial') : result.serial; + result.uuid = result.uuid === '' ? util.getValue(lines, 'product_uuid').toLowerCase() : result.uuid; + } catch (e) { + util.noop(); + } + if (!result.serial || result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } + if (!result.manufacturer || result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = ''; } + if (!result.model || result.model.toLowerCase().indexOf('o.e.m.') !== -1) { result.model = 'Computer'; } + if (!result.version || result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = ''; } + if (!result.sku || result.sku.toLowerCase().indexOf('o.e.m.') !== -1) { result.sku = '-'; } + + // detect virtual (1) + if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware') || result.model.toLowerCase().startsWith('droplet')) { + result.virtual = true; + switch (result.model.toLowerCase()) { + case 'virtualbox': + result.virtualHost = 'VirtualBox'; + break; + case 'vmware': + result.virtualHost = 'VMware'; + break; + case 'kvm': + result.virtualHost = 'KVM'; + break; + case 'bochs': + result.virtualHost = 'bochs'; + break; + } + } + if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') { + result.virtual = true; + switch (result.manufacturer.toLowerCase()) { + case 'vmware': + result.virtualHost = 'VMware'; + break; + case 'xen': + result.virtualHost = 'Xen'; + break; + } + } + if (!result.virtual) { + try { + const disksById = execSync('ls -1 /dev/disk/by-id/ 2>/dev/null', util.execOptsLinux).toString(); + if (disksById.indexOf('_QEMU_') >= 0) { + result.virtual = true; + result.virtualHost = 'QEMU'; + } + if (disksById.indexOf('_VBOX_') >= 0) { + result.virtual = true; + result.virtualHost = 'VirtualBox'; + } + } catch (e) { + util.noop(); + } + } + if (!result.virtual && (os.release().toLowerCase().indexOf('microsoft') >= 0 || os.release().toLowerCase().endsWith('wsl2'))) { + const kernelVersion = parseFloat(os.release().toLowerCase()); + result.virtual = true; + result.manufacturer = 'Microsoft'; + result.model = 'WSL'; + result.version = kernelVersion < 4.19 ? '1' : '2'; + } + if ((_freebsd || _openbsd || _netbsd) && !result.virtualHost) { + try { + const procInfo = execSync('dmidecode -t 4', util.execOptsLinux); + const procLines = procInfo.toString().split('\n'); + const procManufacturer = util.getValue(procLines, 'manufacturer', ':', true); + switch (procManufacturer.toLowerCase()) { + case 'virtualbox': + result.virtualHost = 'VirtualBox'; + break; + case 'vmware': + result.virtualHost = 'VMware'; + break; + case 'kvm': + result.virtualHost = 'KVM'; + break; + case 'bochs': + result.virtualHost = 'bochs'; + break; + } + } catch (e) { + util.noop(); + } + } + // detect docker + if (fs.existsSync('/.dockerenv') || fs.existsSync('/.dockerinit')) { + result.model = 'Docker Container'; + } + try { + const stdout = execSync('dmesg 2>/dev/null | grep -iE "virtual|hypervisor" | grep -iE "vmware|qemu|kvm|xen" | grep -viE "Nested Virtualization|/virtual/"'); + // detect virtual machines + let lines = stdout.toString().split('\n'); + if (lines.length > 0) { + if (result.model === 'Computer') { result.model = 'Virtual machine'; } + result.virtual = true; + if (stdout.toString().toLowerCase().indexOf('vmware') >= 0 && !result.virtualHost) { + result.virtualHost = 'VMware'; + } + if (stdout.toString().toLowerCase().indexOf('qemu') >= 0 && !result.virtualHost) { + result.virtualHost = 'QEMU'; + } + if (stdout.toString().toLowerCase().indexOf('xen') >= 0 && !result.virtualHost) { + result.virtualHost = 'Xen'; + } + if (stdout.toString().toLowerCase().indexOf('kvm') >= 0 && !result.virtualHost) { + result.virtualHost = 'KVM'; + } + } + } catch (e) { + util.noop(); + } + + if (result.manufacturer === '' && result.model === 'Computer' && result.version === '') { + // Check Raspberry Pi + fs.readFile('/proc/cpuinfo', function (error, stdout) { + if (!error) { + let lines = stdout.toString().split('\n'); + result.model = util.getValue(lines, 'hardware', ':', true).toUpperCase(); + result.version = util.getValue(lines, 'revision', ':', true).toLowerCase(); + result.serial = util.getValue(lines, 'serial', ':', true); + const model = util.getValue(lines, 'model:', ':', true); + // reference values: https://elinux.org/RPi_HardwareHistory + // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md + if ((result.model === 'BCM2835' || result.model === 'BCM2708' || result.model === 'BCM2709' || result.model === 'BCM2710' || result.model === 'BCM2711' || result.model === 'BCM2836' || result.model === 'BCM2837') && model.toLowerCase().indexOf('raspberry') >= 0) { + const rPIRevision = util.decodePiCpuinfo(lines); + result.model = rPIRevision.model; + result.version = rPIRevision.revisionCode; + result.manufacturer = 'Raspberry Pi Foundation'; + result.raspberry = { + manufacturer: rPIRevision.manufacturer, + processor: rPIRevision.processor, + type: rPIRevision.type, + revision: rPIRevision.revision + }; + } + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + if (_darwin) { + exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) { + if (!error) { + let lines = stdout.toString().replace(/[<>"]/g, '').split('\n'); + const model = util.splitByNumber(util.getValue(lines, 'model', '=', true)); + const version = util.getValue(lines, 'version', '=', true); + result.manufacturer = util.getValue(lines, 'manufacturer', '=', true); + result.model = version ? util.getValue(lines, 'model', '=', true) : model[0]; + result.version = version || model[1]; + result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true); + result.uuid = util.getValue(lines, 'ioplatformuuid', '=', true).toLowerCase(); + result.sku = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-sub-type', '=', true); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select Name,Vendor,Version,IdentifyingNumber,UUID | fl').then((stdout, error) => { + if (!error) { + let lines = stdout.split('\r\n'); + result.manufacturer = util.getValue(lines, 'vendor', ':'); + result.model = util.getValue(lines, 'name', ':'); + result.version = util.getValue(lines, 'version', ':'); + result.serial = util.getValue(lines, 'identifyingnumber', ':'); + result.uuid = util.getValue(lines, 'uuid', ':').toLowerCase(); + // detect virtual (1) + const model = result.model.toLowerCase(); + if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu') || model.startsWith('parallels')) { + result.virtual = true; + if (model.startsWith('virtualbox')) { result.virtualHost = 'VirtualBox'; } + if (model.startsWith('vmware')) { result.virtualHost = 'VMware'; } + if (model.startsWith('kvm')) { result.virtualHost = 'KVM'; } + if (model.startsWith('bochs')) { result.virtualHost = 'bochs'; } + if (model.startsWith('qemu')) { result.virtualHost = 'KVM'; } + if (model.startsWith('parallels')) { result.virtualHost = 'Parallels'; } + } + const manufacturer = result.manufacturer.toLowerCase(); + if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen' || manufacturer.startsWith('parallels')) { + result.virtual = true; + if (manufacturer.startsWith('vmware')) { result.virtualHost = 'VMware'; } + if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; } + if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; } + if (manufacturer.startsWith('parallels')) { result.virtualHost = 'Parallels'; } + } + util.powerShell('Get-CimInstance MS_Systeminformation -Namespace "root/wmi" | select systemsku | fl ').then((stdout, error) => { + if (!error) { + let lines = stdout.split('\r\n'); + result.sku = util.getValue(lines, 'systemsku', ':'); + } + if (!result.virtual) { + util.powerShell('Get-CimInstance Win32_bios | select Version, SerialNumber, SMBIOSBIOSVersion').then((stdout, error) => { + if (!error) { + let lines = stdout.toString(); + if (lines.indexOf('VRTUAL') >= 0 || lines.indexOf('A M I ') >= 0 || lines.indexOf('VirtualBox') >= 0 || lines.indexOf('VMWare') >= 0 || lines.indexOf('Xen') >= 0 || lines.indexOf('Parallels') >= 0) { + result.virtual = true; + if (lines.indexOf('VirtualBox') >= 0 && !result.virtualHost) { + result.virtualHost = 'VirtualBox'; + } + if (lines.indexOf('VMware') >= 0 && !result.virtualHost) { + result.virtualHost = 'VMware'; + } + if (lines.indexOf('Xen') >= 0 && !result.virtualHost) { + result.virtualHost = 'Xen'; + } + if (lines.indexOf('VRTUAL') >= 0 && !result.virtualHost) { + result.virtualHost = 'Hyper-V'; + } + if (lines.indexOf('A M I') >= 0 && !result.virtualHost) { + result.virtualHost = 'Virtual PC'; + } + if (lines.indexOf('Parallels') >= 0 && !result.virtualHost) { + result.virtualHost = 'Parallels'; + } + } + if (callback) { callback(result); } + resolve(result); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.system = system; + +function cleanDefaults(s) { + const cmpStr = s.toLowerCase(); + if (cmpStr.indexOf('o.e.m.') === -1 && cmpStr.indexOf('default string') === -1 && cmpStr !== 'default') { + return s || ''; + } + return ''; +} +function bios(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + vendor: '', + version: '', + releaseDate: '', + revision: '', + }; + let cmd = ''; + if (_linux || _freebsd || _openbsd || _netbsd) { + if (process.arch === 'arm') { + cmd = 'cat /proc/cpuinfo | grep Serial'; + } else { + cmd = 'export LC_ALL=C; dmidecode -t bios 2>/dev/null; unset LC_ALL'; + } + exec(cmd, function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.vendor = util.getValue(lines, 'Vendor'); + result.version = util.getValue(lines, 'Version'); + let datetime = util.getValue(lines, 'Release Date'); + result.releaseDate = util.parseDateTime(datetime).date; + result.revision = util.getValue(lines, 'BIOS Revision'); + result.serial = util.getValue(lines, 'SerialNumber'); + let language = util.getValue(lines, 'Currently Installed Language').split('|')[0]; + if (language) { + result.language = language; + } + if (lines.length && stdout.toString().indexOf('Characteristics:') >= 0) { + const features = []; + lines.forEach(line => { + if (line.indexOf(' is supported') >= 0) { + const feature = line.split(' is supported')[0].trim(); + features.push(feature); + } + }); + result.features = features; + } + // Non-Root values + const cmd = `echo -n "bios_date: "; cat /sys/devices/virtual/dmi/id/bios_date 2>/dev/null; echo; + echo -n "bios_vendor: "; cat /sys/devices/virtual/dmi/id/bios_vendor 2>/dev/null; echo; + echo -n "bios_version: "; cat /sys/devices/virtual/dmi/id/bios_version 2>/dev/null; echo;`; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + result.vendor = !result.vendor ? util.getValue(lines, 'bios_vendor') : result.vendor; + result.version = !result.version ? util.getValue(lines, 'bios_version') : result.version; + datetime = util.getValue(lines, 'bios_date'); + result.releaseDate = !result.releaseDate ? util.parseDateTime(datetime).date : result.releaseDate; + } catch (e) { + util.noop(); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + result.vendor = 'Apple Inc.'; + exec( + 'system_profiler SPHardwareDataType -json', function (error, stdout) { + try { + const hardwareData = JSON.parse(stdout.toString()); + if (hardwareData && hardwareData.SPHardwareDataType && hardwareData.SPHardwareDataType.length) { + let bootRomVersion = hardwareData.SPHardwareDataType[0].boot_rom_version; + bootRomVersion = bootRomVersion ? bootRomVersion.split('(')[0].trim() : null; + result.version = bootRomVersion; + } + } catch (e) { + util.noop(); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + result.vendor = 'Sun Microsystems'; + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_bios | select Description,Version,Manufacturer,@{n="ReleaseDate";e={$_.ReleaseDate.ToString("yyyy-MM-dd")}},BuildNumber,SerialNumber,SMBIOSBIOSVersion | fl').then((stdout, error) => { + if (!error) { + let lines = stdout.toString().split('\r\n'); + const description = util.getValue(lines, 'description', ':'); + const version = util.getValue(lines, 'SMBIOSBIOSVersion', ':'); + if (description.indexOf(' Version ') !== -1) { + // ... Phoenix ROM BIOS PLUS Version 1.10 A04 + result.vendor = description.split(' Version ')[0].trim(); + result.version = description.split(' Version ')[1].trim(); + } else if (description.indexOf(' Ver: ') !== -1) { + // ... BIOS Date: 06/27/16 17:50:16 Ver: 1.4.5 + result.vendor = util.getValue(lines, 'manufacturer', ':'); + result.version = description.split(' Ver: ')[1].trim(); + } else { + result.vendor = util.getValue(lines, 'manufacturer', ':'); + result.version = version || util.getValue(lines, 'version', ':'); + } + result.releaseDate = util.getValue(lines, 'releasedate', ':'); + result.revision = util.getValue(lines, 'buildnumber', ':'); + result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':')); + } + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.bios = bios; + +function baseboard(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + manufacturer: '', + model: '', + version: '', + serial: '-', + assetTag: '-', + memMax: null, + memSlots: null + }; + let cmd = ''; + if (_linux || _freebsd || _openbsd || _netbsd) { + if (process.arch === 'arm') { + cmd = 'cat /proc/cpuinfo | grep Serial'; + // 'BCM2709', 'BCM2835', 'BCM2708' --> + } else { + cmd = 'export LC_ALL=C; dmidecode -t 2 2>/dev/null; unset LC_ALL'; + } + const workload = []; + workload.push(execPromise(cmd)); + workload.push(execPromise('export LC_ALL=C; dmidecode -t memory 2>/dev/null')); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().split('\n') : ['']; + result.manufacturer = util.getValue(lines, 'Manufacturer'); + result.model = util.getValue(lines, 'Product Name'); + result.version = util.getValue(lines, 'Version'); + result.serial = util.getValue(lines, 'Serial Number'); + result.assetTag = util.getValue(lines, 'Asset Tag'); + // Non-Root values + const cmd = `echo -n "board_asset_tag: "; cat /sys/devices/virtual/dmi/id/board_asset_tag 2>/dev/null; echo; + echo -n "board_name: "; cat /sys/devices/virtual/dmi/id/board_name 2>/dev/null; echo; + echo -n "board_serial: "; cat /sys/devices/virtual/dmi/id/board_serial 2>/dev/null; echo; + echo -n "board_vendor: "; cat /sys/devices/virtual/dmi/id/board_vendor 2>/dev/null; echo; + echo -n "board_version: "; cat /sys/devices/virtual/dmi/id/board_version 2>/dev/null; echo;`; + try { + lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + result.manufacturer = !result.manufacturer ? util.getValue(lines, 'board_vendor') : result.manufacturer; + result.model = !result.model ? util.getValue(lines, 'board_name') : result.model; + result.version = !result.version ? util.getValue(lines, 'board_version') : result.version; + result.serial = !result.serial ? util.getValue(lines, 'board_serial') : result.serial; + result.assetTag = !result.assetTag ? util.getValue(lines, 'board_asset_tag') : result.assetTag; + } catch (e) { + util.noop(); + } + if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } + if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; } + + // mem + lines = data.results[1] ? data.results[1].toString().split('\n') : ['']; + result.memMax = util.toInt(util.getValue(lines, 'Maximum Capacity')) * 1024 * 1024 * 1024 || null; + result.memSlots = util.toInt(util.getValue(lines, 'Number Of Devices')) || null; + + // raspberry + let linesRpi = ''; + try { + linesRpi = fs.readFileSync('/proc/cpuinfo').toString().split('\n'); + } catch (e) { + util.noop(); + } + if (linesRpi) { + const hardware = util.getValue(linesRpi, 'hardware'); + if (hardware.startsWith('BCM')) { + const rpi = util.decodePiCpuinfo(linesRpi); + result.manufacturer = rpi.manufacturer; + result.model = 'Raspberry Pi'; + result.serial = rpi.serial; + result.version = rpi.type + ' - ' + rpi.revision; + result.memMax = os.totalmem(); + result.memSlots = 0; + } + } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + const workload = []; + workload.push(execPromise('ioreg -c IOPlatformExpertDevice -d 2')); + workload.push(execPromise('system_profiler SPMemoryDataType')); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().replace(/[<>"]/g, '').split('\n') : ['']; + result.manufacturer = util.getValue(lines, 'manufacturer', '=', true); + result.model = util.getValue(lines, 'model', '=', true); + result.version = util.getValue(lines, 'version', '=', true); + result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true); + result.assetTag = util.getValue(lines, 'board-id', '=', true); + + // mem + let devices = data.results[1] ? data.results[1].toString().split(' BANK ') : ['']; + if (devices.length === 1) { + devices = data.results[1] ? data.results[1].toString().split(' DIMM') : ['']; + } + devices.shift(); + result.memSlots = devices.length; + + if (os.arch() === 'arm64') { + result.memSlots = 0; + result.memMax = os.totalmem(); + } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + const workload = []; + const win10plus = parseInt(os.release()) >= 10; + const maxCapacityAttribute = win10plus ? 'MaxCapacityEx' : 'MaxCapacity'; + workload.push(util.powerShell('Get-CimInstance Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl')); + workload.push(util.powerShell(`Get-CimInstance Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`)); + util.promiseAll( + workload + ).then((data) => { + let lines = data.results[0] ? data.results[0].toString().split('\r\n') : ['']; + + result.manufacturer = cleanDefaults(util.getValue(lines, 'manufacturer', ':')); + result.model = cleanDefaults(util.getValue(lines, 'model', ':')); + if (!result.model) { + result.model = cleanDefaults(util.getValue(lines, 'product', ':')); + } + result.version = cleanDefaults(util.getValue(lines, 'version', ':')); + result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':')); + result.assetTag = cleanDefaults(util.getValue(lines, 'partnumber', ':')); + if (!result.assetTag) { + result.assetTag = cleanDefaults(util.getValue(lines, 'sku', ':')); + } + + // memphysical + lines = data.results[1] ? data.results[1].toString().split('\r\n') : ['']; + result.memMax = util.toInt(util.getValue(lines, maxCapacityAttribute, ':')) * (win10plus ? 1024 : 1) || null; + result.memSlots = util.toInt(util.getValue(lines, 'MemoryDevices', ':')) || null; + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.baseboard = baseboard; + +function macOsChassisType(model) { + model = model.toLowerCase(); + if (model.startsWith('macbookair')) { return 'Notebook'; } + if (model.startsWith('macbookpro')) { return 'Laptop'; } + if (model.startsWith('macbook')) { return 'Notebook'; } + if (model.startsWith('macmini')) { return 'Desktop'; } + if (model.startsWith('imac')) { return 'Desktop'; } + if (model.startsWith('macstudio')) { return 'Desktop'; } + if (model.startsWith('macpro')) { return 'Tower'; } + return 'Other'; +} + +function chassis(callback) { + const chassisTypes = ['Other', + 'Unknown', + 'Desktop', + 'Low Profile Desktop', + 'Pizza Box', + 'Mini Tower', + 'Tower', + 'Portable', + 'Laptop', + 'Notebook', + 'Hand Held', + 'Docking Station', + 'All in One', + 'Sub Notebook', + 'Space-Saving', + 'Lunch Box', + 'Main System Chassis', + 'Expansion Chassis', + 'SubChassis', + 'Bus Expansion Chassis', + 'Peripheral Chassis', + 'Storage Chassis', + 'Rack Mount Chassis', + 'Sealed-Case PC', + 'Multi-System Chassis', + 'Compact PCI', + 'Advanced TCA', + 'Blade', + 'Blade Enclosure', + 'Tablet', + 'Convertible', + 'Detachable', + 'IoT Gateway ', + 'Embedded PC', + 'Mini PC', + 'Stick PC', + ]; + + return new Promise((resolve) => { + process.nextTick(() => { + + let result = { + manufacturer: '', + model: '', + type: '', + version: '', + serial: '-', + assetTag: '-', + sku: '', + }; + if (_linux || _freebsd || _openbsd || _netbsd) { + const cmd = `echo -n "chassis_asset_tag: "; cat /sys/devices/virtual/dmi/id/chassis_asset_tag 2>/dev/null; echo; + echo -n "chassis_serial: "; cat /sys/devices/virtual/dmi/id/chassis_serial 2>/dev/null; echo; + echo -n "chassis_type: "; cat /sys/devices/virtual/dmi/id/chassis_type 2>/dev/null; echo; + echo -n "chassis_vendor: "; cat /sys/devices/virtual/dmi/id/chassis_vendor 2>/dev/null; echo; + echo -n "chassis_version: "; cat /sys/devices/virtual/dmi/id/chassis_version 2>/dev/null; echo;`; + exec(cmd, function (error, stdout) { + let lines = stdout.toString().split('\n'); + result.manufacturer = util.getValue(lines, 'chassis_vendor'); + const ctype = parseInt(util.getValue(lines, 'chassis_type').replace(/\D/g, '')); + result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : ''; + result.version = util.getValue(lines, 'chassis_version'); + result.serial = util.getValue(lines, 'chassis_serial'); + result.assetTag = util.getValue(lines, 'chassis_asset_tag'); + if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = '-'; } + if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = '-'; } + if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; } + if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_darwin) { + exec('ioreg -c IOPlatformExpertDevice -d 2', function (error, stdout) { + if (!error) { + let lines = stdout.toString().replace(/[<>"]/g, '').split('\n'); + const model = util.getValue(lines, 'model', '=', true); + const modelParts = util.splitByNumber(model); + const version = util.getValue(lines, 'version', '=', true); + result.manufacturer = util.getValue(lines, 'manufacturer', '=', true); + result.model = version ? util.getValue(lines, 'model', '=', true) : modelParts[0]; + result.type = macOsChassisType(result.model); + result.version = version || model; + result.serial = util.getValue(lines, 'ioplatformserialnumber', '=', true); + result.assetTag = util.getValue(lines, 'board-id', '=', true) || util.getValue(lines, 'target-type', '=', true); + result.sku = util.getValue(lines, 'target-sub-type', '=', true); + } + + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + if (callback) { callback(result); } + resolve(result); + } + if (_windows) { + try { + util.powerShell('Get-CimInstance Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU,SMBIOSAssetTag | fl').then((stdout, error) => { + if (!error) { + let lines = stdout.toString().split('\r\n'); + + result.manufacturer = cleanDefaults(util.getValue(lines, 'manufacturer', ':')); + result.model = cleanDefaults(util.getValue(lines, 'model', ':')); + const ctype = parseInt(util.getValue(lines, 'ChassisTypes', ':').replace(/\D/g, '')); + result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : ''; + result.version = cleanDefaults(util.getValue(lines, 'version', ':')); + result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':')); + result.assetTag = cleanDefaults(util.getValue(lines, 'partnumber', ':')); + if (!result.assetTag) { + result.assetTag = cleanDefaults(util.getValue(lines, 'SMBIOSAssetTag', ':')); + } + result.sku = cleanDefaults(util.getValue(lines, 'sku', ':')); + } + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +exports.chassis = chassis; + + +/***/ }), + +/***/ 1061: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// usb.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 16. usb +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(2081).exec); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function getLinuxUsbType(type, name) { + let result = type; + const str = (name + ' ' + type).toLowerCase(); + if (str.indexOf('camera') >= 0) { result = 'Camera'; } + else if (str.indexOf('hub') >= 0) { result = 'Hub'; } + else if (str.indexOf('keybrd') >= 0) { result = 'Keyboard'; } + else if (str.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + else if (str.indexOf('mouse') >= 0) { result = 'Mouse'; } + else if (str.indexOf('stora') >= 0) { result = 'Storage'; } + else if (str.indexOf('microp') >= 0) { result = 'Microphone'; } + else if (str.indexOf('headset') >= 0) { result = 'Audio'; } + else if (str.indexOf('audio') >= 0) { result = 'Audio'; } + + return result; +} + +function parseLinuxUsb(usb) { + const result = {}; + const lines = usb.split('\n'); + if (lines && lines.length && lines[0].indexOf('Device') >= 0) { + const parts = lines[0].split(' '); + result.bus = parseInt(parts[0], 10); + if (parts[2]) { + result.deviceId = parseInt(parts[2], 10); + } else { + result.deviceId = null; + } + } else { + result.bus = null; + result.deviceId = null; + } + const idVendor = util.getValue(lines, 'idVendor', ' ', true).trim(); + let vendorParts = idVendor.split(' '); + vendorParts.shift(); + const vendor = vendorParts.join(' '); + + const idProduct = util.getValue(lines, 'idProduct', ' ', true).trim(); + let productParts = idProduct.split(' '); + productParts.shift(); + const product = productParts.join(' '); + + const interfaceClass = util.getValue(lines, 'bInterfaceClass', ' ', true).trim(); + let interfaceClassParts = interfaceClass.split(' '); + interfaceClassParts.shift(); + const usbType = interfaceClassParts.join(' '); + + const iManufacturer = util.getValue(lines, 'iManufacturer', ' ', true).trim(); + let iManufacturerParts = iManufacturer.split(' '); + iManufacturerParts.shift(); + const manufacturer = iManufacturerParts.join(' '); + + const iSerial = util.getValue(lines, 'iSerial', ' ', true).trim(); + let iSerialParts = iSerial.split(' '); + iSerialParts.shift(); + const serial = iSerialParts.join(' '); + + result.id = (idVendor.startsWith('0x') ? idVendor.split(' ')[0].substr(2, 10) : '') + ':' + (idProduct.startsWith('0x') ? idProduct.split(' ')[0].substr(2, 10) : ''); + result.name = product; + result.type = getLinuxUsbType(usbType, product); + result.removable = null; + result.vendor = vendor; + result.manufacturer = manufacturer; + result.maxPower = util.getValue(lines, 'MaxPower', ' ', true); + result.serialNumber = serial; + + return result; +} + +function getDarwinUsbType(name) { + let result = ''; + if (name.indexOf('camera') >= 0) { result = 'Camera'; } + else if (name.indexOf('touch bar') >= 0) { result = 'Touch Bar'; } + else if (name.indexOf('controller') >= 0) { result = 'Controller'; } + else if (name.indexOf('headset') >= 0) { result = 'Audio'; } + else if (name.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + else if (name.indexOf('trackpad') >= 0) { result = 'Trackpad'; } + else if (name.indexOf('sensor') >= 0) { result = 'Sensor'; } + else if (name.indexOf('bthusb') >= 0) { result = 'Bluetooth'; } + else if (name.indexOf('bth') >= 0) { result = 'Bluetooth'; } + else if (name.indexOf('rfcomm') >= 0) { result = 'Bluetooth'; } + else if (name.indexOf('usbhub') >= 0) { result = 'Hub'; } + else if (name.indexOf(' hub') >= 0) { result = 'Hub'; } + else if (name.indexOf('mouse') >= 0) { result = 'Mouse'; } + else if (name.indexOf('microp') >= 0) { result = 'Microphone'; } + else if (name.indexOf('removable') >= 0) { result = 'Storage'; } + return result; +} + +function parseDarwinUsb(usb, id) { + const result = {}; + result.id = id; + + usb = usb.replace(/ \|/g, ''); + usb = usb.trim(); + let lines = usb.split('\n'); + lines.shift(); + try { + for (let i = 0; i < lines.length; i++) { + lines[i] = lines[i].trim(); + lines[i] = lines[i].replace(/=/g, ':'); + if (lines[i] !== '{' && lines[i] !== '}' && lines[i + 1] && lines[i + 1].trim() !== '}') { + lines[i] = lines[i] + ','; + } + + lines[i] = lines[i].replace(':Yes,', ':"Yes",'); + lines[i] = lines[i].replace(': Yes,', ': "Yes",'); + lines[i] = lines[i].replace(': Yes', ': "Yes"'); + lines[i] = lines[i].replace(':No,', ':"No",'); + lines[i] = lines[i].replace(': No,', ': "No",'); + lines[i] = lines[i].replace(': No', ': "No"'); + + // In this case (("com.apple.developer.driverkit.transport.usb")) + lines[i] = lines[i].replace('((', '').replace('))', ''); + + // In case we have <923c11> we need make it "<923c11>" for correct JSON parse + const match = /<(\w+)>/.exec(lines[i]); + if (match) { + const number = match[0]; + lines[i] = lines[i].replace(number, `"${number}"`); + } + } + const usbObj = JSON.parse(lines.join('\n')); + const removableDrive = (usbObj['Built-In'] ? usbObj['Built-In'].toLowerCase() !== 'yes' : true) && (usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() === 'no' : true); + + result.bus = null; + result.deviceId = null; + result.id = usbObj['USB Address'] || null; + result.name = usbObj['kUSBProductString'] || usbObj['USB Product Name'] || null; + result.type = getDarwinUsbType((usbObj['kUSBProductString'] || usbObj['USB Product Name'] || '').toLowerCase() + (removableDrive ? ' removable' : '')); + result.removable = usbObj['non-removable'] ? usbObj['non-removable'].toLowerCase() || '' === 'no' : true; + result.vendor = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null; + result.manufacturer = usbObj['kUSBVendorString'] || usbObj['USB Vendor Name'] || null; + + result.maxPower = null; + result.serialNumber = usbObj['kUSBSerialNumberString'] || null; + + if (result.name) { + return result; + } else { + return null; + } + } catch (e) { + return null; + } +} + +function getWindowsUsbTypeCreation(creationclass, name) { + let result = ''; + if (name.indexOf('storage') >= 0) { result = 'Storage'; } + else if (name.indexOf('speicher') >= 0) { result = 'Storage'; } + else if (creationclass.indexOf('usbhub') >= 0) { result = 'Hub'; } + else if (creationclass.indexOf('storage') >= 0) { result = 'Storage'; } + else if (creationclass.indexOf('usbcontroller') >= 0) { result = 'Controller'; } + else if (creationclass.indexOf('keyboard') >= 0) { result = 'Keyboard'; } + else if (creationclass.indexOf('pointing') >= 0) { result = 'Mouse'; } + else if (creationclass.indexOf('microp') >= 0) { result = 'Microphone'; } + else if (creationclass.indexOf('disk') >= 0) { result = 'Storage'; } + return result; +} + +function parseWindowsUsb(lines, id) { + const usbType = getWindowsUsbTypeCreation(util.getValue(lines, 'CreationClassName', ':').toLowerCase(), util.getValue(lines, 'name', ':').toLowerCase()); + + if (usbType) { + const result = {}; + result.bus = null; + result.deviceId = util.getValue(lines, 'deviceid', ':'); + result.id = id; + result.name = util.getValue(lines, 'name', ':'); + result.type = usbType; + result.removable = null; + result.vendor = null; + result.manufacturer = util.getValue(lines, 'Manufacturer', ':'); + result.maxPower = null; + result.serialNumber = null; + + return result; + } else { + return null; + } +} + +function usb(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux) { + const cmd = 'export LC_ALL=C; lsusb -v 2>/dev/null; unset LC_ALL'; + exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) { + if (!error) { + const parts = ('\n\n' + stdout.toString()).split('\n\nBus '); + for (let i = 1; i < parts.length; i++) { + const usb = parseLinuxUsb(parts[i]); + result.push(usb); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_darwin) { + let cmd = 'ioreg -p IOUSB -c AppleUSBRootHubDevice -w0 -l'; + exec(cmd, { maxBuffer: 1024 * 1024 * 128 }, function (error, stdout) { + if (!error) { + const parts = (stdout.toString()).split(' +-o '); + for (let i = 1; i < parts.length; i++) { + const usb = parseDarwinUsb(parts[i]); + if (usb) { + result.push(usb); + } + } + if (callback) { + callback(result); + } + resolve(result); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_windows) { + util.powerShell('Get-CimInstance CIM_LogicalDevice | where { $_.Description -match "USB"} | select Name,CreationClassName,DeviceId,Manufacturer | fl').then((stdout, error) => { + if (!error) { + const parts = stdout.toString().split(/\n\s*\n/); + for (let i = 0; i < parts.length; i++) { + const usb = parseWindowsUsb(parts[i].split('\n'), i); + if (usb && result.filter(x => x.deviceId === usb.deviceId).length === 0) { + result.push(usb); + } + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } + if (_sunos || _freebsd || _openbsd || _netbsd) { + resolve(null); + } + }); + }); +} + +exports.usb = usb; + + + +/***/ }), + +/***/ 9750: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// users.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 11. Users/Sessions +// ---------------------------------------------------------------------------------- + +const exec = (__nccwpck_require__(2081).exec); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); +const _sunos = (_platform === 'sunos'); + +function parseUsersLinux(lines, phase) { + let result = []; + let result_who = []; + let result_w = {}; + let w_first = true; + let w_header = []; + let w_pos = []; + let who_line = {}; + + let is_whopart = true; + lines.forEach(function (line) { + if (line === '---') { + is_whopart = false; + } else { + let l = line.replace(/ +/g, ' ').split(' '); + + // who part + if (is_whopart) { + result_who.push({ + user: l[0], + tty: l[1], + date: l[2], + time: l[3], + ip: (l && l.length > 4) ? l[4].replace(/\(/g, '').replace(/\)/g, '') : '' + }); + } else { + // w part + if (w_first) { // header + w_header = l; + w_header.forEach(function (item) { + w_pos.push(line.indexOf(item)); + }); + w_first = false; + } else { + // split by w_pos + result_w.user = line.substring(w_pos[0], w_pos[1] - 1).trim(); + result_w.tty = line.substring(w_pos[1], w_pos[2] - 1).trim(); + result_w.ip = line.substring(w_pos[2], w_pos[3] - 1).replace(/\(/g, '').replace(/\)/g, '').trim(); + result_w.command = line.substring(w_pos[7], 1000).trim(); + // find corresponding 'who' line + who_line = result_who.filter(function (obj) { + return (obj.user.substring(0, 8).trim() === result_w.user && obj.tty === result_w.tty); + }); + if (who_line.length === 1) { + result.push({ + user: who_line[0].user, + tty: who_line[0].tty, + date: who_line[0].date, + time: who_line[0].time, + ip: who_line[0].ip, + command: result_w.command + }); + } + } + } + } + }); + if (result.length === 0 && phase === 2) { + return result_who; + } else { + return result; + } +} + +function parseUsersDarwin(lines) { + let result = []; + let result_who = []; + let result_w = {}; + let who_line = {}; + + let is_whopart = true; + lines.forEach(function (line) { + if (line === '---') { + is_whopart = false; + } else { + let l = line.replace(/ +/g, ' ').split(' '); + + // who part + if (is_whopart) { + result_who.push({ + user: l[0], + tty: l[1], + date: ('' + new Date().getFullYear()) + '-' + ('0' + ('JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'.indexOf(l[2].toUpperCase()) / 3 + 1)).slice(-2) + '-' + ('0' + l[3]).slice(-2), + time: l[4], + }); + } else { + // w part + // split by w_pos + result_w.user = l[0]; + result_w.tty = l[1]; + result_w.ip = (l[2] !== '-') ? l[2] : ''; + result_w.command = l.slice(5, 1000).join(' '); + // find corresponding 'who' line + who_line = result_who.filter(function (obj) { + return (obj.user === result_w.user && (obj.tty.substring(3, 1000) === result_w.tty || obj.tty === result_w.tty)); + }); + if (who_line.length === 1) { + result.push({ + user: who_line[0].user, + tty: who_line[0].tty, + date: who_line[0].date, + time: who_line[0].time, + ip: result_w.ip, + command: result_w.command + }); + } + } + } + }); + return result; +} + +function users(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + + // linux + if (_linux) { + exec('who --ips; echo "---"; w | tail -n +2', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersLinux(lines, 1); + if (result.length === 0) { + exec('who; echo "---"; w | tail -n +2', function (error, stdout) { + if (!error) { + // lines / split + lines = stdout.toString().split('\n'); + result = parseUsersLinux(lines, 2); + } + if (callback) { callback(result); } + resolve(result); + }); + } else { + if (callback) { callback(result); } + resolve(result); + } + } else { + if (callback) { callback(result); } + resolve(result); + } + }); + } + if (_freebsd || _openbsd || _netbsd) { + exec('who; echo "---"; w -ih', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersDarwin(lines); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_sunos) { + exec('who; echo "---"; w -h', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersDarwin(lines); + } + if (callback) { callback(result); } + resolve(result); + }); + } + + if (_darwin) { + exec('who; echo "---"; w -ih', function (error, stdout) { + if (!error) { + // lines / split + let lines = stdout.toString().split('\n'); + result = parseUsersDarwin(lines); + } + if (callback) { callback(result); } + resolve(result); + }); + } + if (_windows) { + try { + let cmd = 'Get-CimInstance Win32_LogonSession | select LogonId,@{n="StartTime";e={$_.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}} | fl' + '; echo \'#-#-#-#\';'; + cmd += 'Get-CimInstance Win32_LoggedOnUser | select antecedent,dependent | fl ' + '; echo \'#-#-#-#\';'; + cmd += '$process = (Get-CimInstance Win32_Process -Filter "name = \'explorer.exe\'"); Invoke-CimMethod -InputObject $process[0] -MethodName GetOwner | select user, domain | fl; get-process -name explorer | select-object sessionid | fl; echo \'#-#-#-#\';'; + cmd += 'query user'; + util.powerShell(cmd).then((data) => { + if (data) { + data = data.split('#-#-#-#'); + let sessions = parseWinSessions((data[0] || '').split(/\n\s*\n/)); + let loggedons = parseWinLoggedOn((data[1] || '').split(/\n\s*\n/)); + let queryUser = parseWinUsersQuery((data[3] || '').split('\r\n')); + let users = parseWinUsers((data[2] || '').split(/\n\s*\n/), queryUser); + for (let id in loggedons) { + if ({}.hasOwnProperty.call(loggedons, id)) { + loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : ''; + } + } + users.forEach(user => { + let dateTime = ''; + for (let id in loggedons) { + if ({}.hasOwnProperty.call(loggedons, id)) { + if (loggedons[id].user === user.user && (!dateTime || dateTime < loggedons[id].dateTime)) { + dateTime = loggedons[id].dateTime; + } + } + } + + result.push({ + user: user.user, + tty: user.tty, + date: `${dateTime.substring(0, 10)}`, + time: `${dateTime.substring(11, 19)}`, + ip: '', + command: '' + }); + }); + } + if (callback) { callback(result); } + resolve(result); + + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + } + }); + }); +} + +function parseWinSessions(sessionParts) { + const sessions = {}; + sessionParts.forEach(session => { + const lines = session.split('\r\n'); + const id = util.getValue(lines, 'LogonId'); + const starttime = util.getValue(lines, 'starttime'); + if (id) { + sessions[id] = starttime; + } + }); + return sessions; +} + +function fuzzyMatch(name1, name2) { + name1 = name1.toLowerCase(); + name2 = name2.toLowerCase(); + let eq = 0; + let len = name1.length; + if (name2.length > len) { len = name2.length; } + + for (let i = 0; i < len; i++) { + const c1 = name1[i] || ''; + const c2 = name2[i] || ''; + if (c1 === c2) { eq++; } + } + return (len > 10 ? eq / len > 0.9 : (len > 0 ? eq / len > 0.8 : false)); +} + +function parseWinUsers(userParts, userQuery) { + const users = []; + userParts.forEach(user => { + const lines = user.split('\r\n'); + + const domain = util.getValue(lines, 'domain', ':', true); + const username = util.getValue(lines, 'user', ':', true); + const sessionid = util.getValue(lines, 'sessionid', ':', true); + + if (username) { + const quser = userQuery.filter(item => fuzzyMatch(item.user, username)); + users.push({ + domain, + user: username, + tty: quser && quser[0] && quser[0].tty ? quser[0].tty : sessionid + }); + } + }); + return users; +} + +function parseWinLoggedOn(loggedonParts) { + const loggedons = {}; + loggedonParts.forEach(loggedon => { + const lines = loggedon.split('\r\n'); + + const antecendent = util.getValue(lines, 'antecedent', ':', true); + let parts = antecendent.split('='); + const name = parts.length > 2 ? parts[1].split(',')[0].replace(/"/g, '').trim() : ''; + const domain = parts.length > 2 ? parts[2].replace(/"/g, '').replace(/\)/g, '').trim() : ''; + const dependent = util.getValue(lines, 'dependent', ':', true); + parts = dependent.split('='); + const id = parts.length > 1 ? parts[1].replace(/"/g, '').replace(/\)/g, '').trim() : ''; + if (id) { + loggedons[id] = { + domain, + user: name + }; + } + }); + return loggedons; +} + +function parseWinUsersQuery(lines) { + lines = lines.filter(item => item); + let result = []; + const header = lines[0]; + const headerDelimiter = []; + if (header) { + const start = (header[0] === ' ') ? 1 : 0; + headerDelimiter.push(start - 1); + let nextSpace = 0; + for (let i = start + 1; i < header.length; i++) { + if (header[i] === ' ' && ((header[i - 1] === ' ') || (header[i - 1] === '.'))) { + nextSpace = i; + } else { + if (nextSpace) { + headerDelimiter.push(nextSpace); + nextSpace = 0; + } + } + } + for (let i = 1; i < lines.length; i++) { + if (lines[i].trim()) { + const user = lines[i].substring(headerDelimiter[0] + 1, headerDelimiter[1]).trim() || ''; + const tty = lines[i].substring(headerDelimiter[1] + 1, headerDelimiter[2] - 2).trim() || ''; + result.push({ + user: user, + tty: tty, + }); + } + } + } + return result; +} + +exports.users = users; + + +/***/ }), + +/***/ 9872: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// utils.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 0. helper functions +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const fs = __nccwpck_require__(7147); +const path = __nccwpck_require__(1017); +const spawn = (__nccwpck_require__(2081).spawn); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const util = __nccwpck_require__(3837); + +let _platform = process.platform; +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); +const _freebsd = (_platform === 'freebsd'); +const _openbsd = (_platform === 'openbsd'); +const _netbsd = (_platform === 'netbsd'); + +let _cores = 0; +let wmicPath = ''; +let codepage = ''; +let _smartMonToolsInstalled = null; +let _rpi_cpuinfo = null; + +const WINDIR = process.env.WINDIR || 'C:\\Windows'; + +// powerShell +let _psChild; +let _psResult = ''; +let _psCmds = []; +let _psPersistent = false; +const _psToUTF8 = '$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 ; '; +const _psCmdStart = '--###START###--'; +const _psError = '--ERROR--'; +const _psCmdSeperator = '--###ENDCMD###--'; +const _psIdSeperator = '--##ID##--'; + +const execOptsWin = { + windowsHide: true, + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }) +}; + +const execOptsLinux = { + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + stdio: ['pipe', 'pipe', 'ignore'] +}; + +function toInt(value) { + let result = parseInt(value, 10); + if (isNaN(result)) { + result = 0; + } + return result; +} + +function splitByNumber(str) { + let numberStarted = false; + let num = ''; + let cpart = ''; + for (const c of str) { + if ((c >= '0' && c <= '9') || numberStarted) { + numberStarted = true; + num += c; + } else { + cpart += c; + } + } + return [cpart, num]; +} + +const stringReplace = new String().replace; +const stringToLower = new String().toLowerCase; +const stringToString = new String().toString; +const stringSubstr = new String().substr; +const stringTrim = new String().trim; +const stringStartWith = new String().startsWith; +const mathMin = Math.min; + +function isFunction(functionToCheck) { + let getType = {}; + return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; +} + +function unique(obj) { + let uniques = []; + let stringify = {}; + for (let i = 0; i < obj.length; i++) { + let keys = Object.keys(obj[i]); + keys.sort(function (a, b) { return a - b; }); + let str = ''; + for (let j = 0; j < keys.length; j++) { + str += JSON.stringify(keys[j]); + str += JSON.stringify(obj[i][keys[j]]); + } + if (!{}.hasOwnProperty.call(stringify, str)) { + uniques.push(obj[i]); + stringify[str] = true; + } + } + return uniques; +} + +function sortByKey(array, keys) { + return array.sort(function (a, b) { + let x = ''; + let y = ''; + keys.forEach(function (key) { + x = x + a[key]; y = y + b[key]; + }); + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }); +} + +function cores() { + if (_cores === 0) { + _cores = os.cpus().length; + } + return _cores; +} + +function getValue(lines, property, separator, trimmed, lineMatch) { + separator = separator || ':'; + property = property.toLowerCase(); + trimmed = trimmed || false; + lineMatch = lineMatch || false; + let result = ''; + lines.some((line) => { + let lineLower = line.toLowerCase().replace(/\t/g, ''); + if (trimmed) { + lineLower = lineLower.trim(); + } + if (lineLower.startsWith(property) && (lineMatch ? (lineLower.match(property + separator)) || (lineLower.match(property + ' ' + separator)) : true)) { + const parts = trimmed ? line.trim().split(separator) : line.split(separator); + if (parts.length >= 2) { + parts.shift(); + result = parts.join(separator).trim(); + return true; + } + } + }); + return result; +} + +function decodeEscapeSequence(str, base) { + base = base || 16; + return str.replace(/\\x([0-9A-Fa-f]{2})/g, function () { + return String.fromCharCode(parseInt(arguments[1], base)); + }); +} + +function detectSplit(str) { + let seperator = ''; + let part = 0; + str.split('').forEach(element => { + if (element >= '0' && element <= '9') { + if (part === 1) { part++; } + } else { + if (part === 0) { part++; } + if (part === 1) { + seperator += element; + } + } + }); + return seperator; +} + +function parseTime(t, pmDesignator) { + pmDesignator = pmDesignator || ''; + t = t.toUpperCase(); + let hour = 0; + let min = 0; + let splitter = detectSplit(t); + let parts = t.split(splitter); + if (parts.length >= 2) { + if (parts[2]) { + parts[1] += parts[2]; + } + let isPM = (parts[1] && (parts[1].toLowerCase().indexOf('pm') > -1) || (parts[1].toLowerCase().indexOf('p.m.') > -1) || (parts[1].toLowerCase().indexOf('p. m.') > -1) || (parts[1].toLowerCase().indexOf('n') > -1) || (parts[1].toLowerCase().indexOf('ch') > -1) || (parts[1].toLowerCase().indexOf('ös') > -1) || (pmDesignator && parts[1].toLowerCase().indexOf(pmDesignator) > -1)); + hour = parseInt(parts[0], 10); + min = parseInt(parts[1], 10); + hour = isPM && hour < 12 ? hour + 12 : hour; + return ('0' + hour).substr(-2) + ':' + ('0' + min).substr(-2); + } +} + +function parseDateTime(dt, culture) { + const result = { + date: '', + time: '' + }; + culture = culture || {}; + let dateFormat = (culture.dateFormat || '').toLowerCase(); + let pmDesignator = (culture.pmDesignator || ''); + + const parts = dt.split(' '); + if (parts[0]) { + if (parts[0].indexOf('/') >= 0) { + // Dateformat: mm/dd/yyyy or dd/mm/yyyy or dd/mm/yy or yyyy/mm/dd + const dtparts = parts[0].split('/'); + if (dtparts.length === 3) { + if (dtparts[0].length === 4) { + // Dateformat: yyyy/mm/dd + result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2); + } else if (dtparts[2].length === 2) { + if ((dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1)) { + // Dateformat: mm/dd/yy + result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } else { + // Dateformat: dd/mm/yy + result.date = '20' + dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } + } else { + // Dateformat: mm/dd/yyyy or dd/mm/yyyy + const isEN = ((dt.toLowerCase().indexOf('pm') > -1) || (dt.toLowerCase().indexOf('p.m.') > -1) || (dt.toLowerCase().indexOf('p. m.') > -1) || (dt.toLowerCase().indexOf('am') > -1) || (dt.toLowerCase().indexOf('a.m.') > -1) || (dt.toLowerCase().indexOf('a. m.') > -1)); + if ((isEN || dateFormat.indexOf('/d/') > -1 || dateFormat.indexOf('/dd/') > -1) && dateFormat.indexOf('dd/') !== 0) { + // Dateformat: mm/dd/yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2); + } else { + // Dateformat: dd/mm/yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } + } + } + } + if (parts[0].indexOf('.') >= 0) { + const dtparts = parts[0].split('.'); + if (dtparts.length === 3) { + if (dateFormat.indexOf('.d.') > -1 || dateFormat.indexOf('.dd.') > -1) { + // Dateformat: mm.dd.yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[0]).substr(-2) + '-' + ('0' + dtparts[1]).substr(-2); + } else { + // Dateformat: dd.mm.yyyy + result.date = dtparts[2] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[0]).substr(-2); + } + } + } + if (parts[0].indexOf('-') >= 0) { + // Dateformat: yyyy-mm-dd + const dtparts = parts[0].split('-'); + if (dtparts.length === 3) { + result.date = dtparts[0] + '-' + ('0' + dtparts[1]).substr(-2) + '-' + ('0' + dtparts[2]).substr(-2); + } + } + } + if (parts[1]) { + parts.shift(); + let time = parts.join(' '); + result.time = parseTime(time, pmDesignator); + } + return result; +} + +function parseHead(head, rights) { + let space = (rights > 0); + let count = 1; + let from = 0; + let to = 0; + let result = []; + for (let i = 0; i < head.length; i++) { + if (count <= rights) { + if (/\s/.test(head[i]) && !space) { + to = i - 1; + result.push({ + from: from, + to: to + 1, + cap: head.substring(from, to + 1) + }); + from = to + 2; + count++; + } + space = head[i] === ' '; + } else { + if (!/\s/.test(head[i]) && space) { + to = i - 1; + if (from < to) { + result.push({ + from: from, + to: to, + cap: head.substring(from, to) + }); + } + from = to + 1; + count++; + } + space = head[i] === ' '; + } + } + to = 5000; + result.push({ + from: from, + to: to, + cap: head.substring(from, to) + }); + let len = result.length; + for (let i = 0; i < len; i++) { + if (result[i].cap.replace(/\s/g, '').length === 0) { + if (i + 1 < len) { + result[i].to = result[i + 1].to; + result[i].cap = result[i].cap + result[i + 1].cap; + result.splice(i + 1, 1); + len = len - 1; + } + } + } + return result; +} + +function findObjectByKey(array, key, value) { + for (let i = 0; i < array.length; i++) { + if (array[i][key] === value) { + return i; + } + } + return -1; +} + +function getWmic() { + if (os.type() === 'Windows_NT' && !wmicPath) { + wmicPath = WINDIR + '\\system32\\wbem\\wmic.exe'; + if (!fs.existsSync(wmicPath)) { + try { + const wmicPathArray = execSync('WHERE WMIC', execOptsWin).toString().split('\r\n'); + if (wmicPathArray && wmicPathArray.length) { + wmicPath = wmicPathArray[0]; + } else { + wmicPath = 'wmic'; + } + } catch (e) { + wmicPath = 'wmic'; + } + } + } + return wmicPath; +} + +function wmic(command) { + return new Promise((resolve) => { + process.nextTick(() => { + try { + powerShell(getWmic() + ' ' + command).then(stdout => { + resolve(stdout, ''); + }); + } catch (e) { + resolve('', e); + } + }); + }); +} + +function getVboxmanage() { + return _windows ? `"${process.env.VBOX_INSTALL_PATH || process.env.VBOX_MSI_INSTALL_PATH}\\VBoxManage.exe"` : 'vboxmanage'; +} + +function powerShellProceedResults(data) { + let id = ''; + let parts; + let res = ''; + // startID + if (data.indexOf(_psCmdStart) >= 0) { + parts = data.split(_psCmdStart); + const parts2 = parts[1].split(_psIdSeperator); + id = parts2[0]; + if (parts2.length > 1) { + data = parts2.slice(1).join(_psIdSeperator); + } + } + // result; + if (data.indexOf(_psCmdSeperator) >= 0) { + parts = data.split(_psCmdSeperator); + res = parts[0]; + } + let remove = -1; + for (let i = 0; i < _psCmds.length; i++) { + if (_psCmds[i].id === id) { + remove = i; + _psCmds[i].callback(res); + } + } + if (remove >= 0) { + _psCmds.splice(remove, 1); + } +} + +function powerShellStart() { + if (!_psChild) { + _psChild = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], { + stdio: 'pipe', + windowsHide: true, + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }) + }); + if (_psChild && _psChild.pid) { + _psPersistent = true; + _psChild.stdout.on('data', function (data) { + _psResult = _psResult + data.toString('utf8'); + if (data.indexOf(_psCmdSeperator) >= 0) { + powerShellProceedResults(_psResult); + _psResult = ''; + } + }); + _psChild.stderr.on('data', function () { + powerShellProceedResults(_psResult + _psError); + }); + _psChild.on('error', function () { + powerShellProceedResults(_psResult + _psError); + }); + _psChild.on('close', function () { + if (_psChild) { _psChild.kill(); } + }); + } + } +} + +function powerShellRelease() { + try { + if (_psChild) { + _psChild.stdin.write('exit' + os.EOL); + _psChild.stdin.end(); + _psPersistent = false; + } + } catch (e) { + if (_psChild) { _psChild.kill(); } + } + _psChild = null; +} + +function powerShell(cmd) { + + /// const pattern = [ + /// '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + /// '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))' + /// ].join('|'); + + if (_psPersistent) { + const id = Math.random().toString(36).substring(2, 12); + return new Promise((resolve) => { + process.nextTick(() => { + function callback(data) { + resolve(data); + } + _psCmds.push({ + id, + cmd, + callback, + start: new Date() + }); + try { + if (_psChild && _psChild.pid) { + _psChild.stdin.write(_psToUTF8 + 'echo ' + _psCmdStart + id + _psIdSeperator + '; ' + os.EOL + cmd + os.EOL + 'echo ' + _psCmdSeperator + os.EOL); + } + } catch (e) { + resolve(''); + } + }); + }); + + } else { + let result = ''; + + return new Promise((resolve) => { + process.nextTick(() => { + try { + const child = spawn('powershell.exe', ['-NoProfile', '-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], { + stdio: 'pipe', + windowsHide: true, + maxBuffer: 1024 * 20000, + encoding: 'UTF-8', + env: Object.assign({}, process.env, { LANG: 'en_US.UTF-8' }) + }); + + if (child && !child.pid) { + child.on('error', function () { + resolve(result); + }); + } + if (child && child.pid) { + child.stdout.on('data', function (data) { + result = result + data.toString('utf8'); + }); + child.stderr.on('data', function () { + child.kill(); + resolve(result); + }); + child.on('close', function () { + child.kill(); + + resolve(result); + }); + child.on('error', function () { + child.kill(); + resolve(result); + }); + try { + child.stdin.write(_psToUTF8 + cmd + os.EOL); + child.stdin.write('exit' + os.EOL); + child.stdin.end(); + } catch (e) { + child.kill(); + resolve(result); + } + } else { + resolve(result); + } + } catch (e) { + resolve(result); + } + }); + }); + } +} + +function execSafe(cmd, args, options) { + let result = ''; + options = options || {}; + + return new Promise((resolve) => { + process.nextTick(() => { + try { + const child = spawn(cmd, args, options); + + if (child && !child.pid) { + child.on('error', function () { + resolve(result); + }); + } + if (child && child.pid) { + child.stdout.on('data', function (data) { + result += data.toString(); + }); + child.on('close', function () { + child.kill(); + resolve(result); + }); + child.on('error', function () { + child.kill(); + resolve(result); + }); + } else { + resolve(result); + } + } catch (e) { + resolve(result); + } + }); + }); +} + +function getCodepage() { + if (_windows) { + if (!codepage) { + try { + const stdout = execSync('chcp', execOptsWin); + const lines = stdout.toString().split('\r\n'); + const parts = lines[0].split(':'); + codepage = parts.length > 1 ? parts[1].replace('.', '').trim() : ''; + } catch (err) { + codepage = '437'; + } + } + return codepage; + } + if (_linux || _darwin || _freebsd || _openbsd || _netbsd) { + if (!codepage) { + try { + const stdout = execSync('echo $LANG', util.execOptsLinux); + const lines = stdout.toString().split('\r\n'); + const parts = lines[0].split('.'); + codepage = parts.length > 1 ? parts[1].trim() : ''; + if (!codepage) { + codepage = 'UTF-8'; + } + } catch (err) { + codepage = 'UTF-8'; + } + } + return codepage; + } +} + +function smartMonToolsInstalled() { + if (_smartMonToolsInstalled !== null) { + return _smartMonToolsInstalled; + } + _smartMonToolsInstalled = false; + if (_windows) { + try { + const pathArray = execSync('WHERE smartctl 2>nul', execOptsWin).toString().split('\r\n'); + if (pathArray && pathArray.length) { + _smartMonToolsInstalled = pathArray[0].indexOf(':\\') >= 0; + } else { + _smartMonToolsInstalled = false; + } + } catch (e) { + _smartMonToolsInstalled = false; + } + } + if (_linux || _darwin || _freebsd || _openbsd || _netbsd) { + try { + const pathArray = execSync('which smartctl 2>/dev/null', execOptsLinux).toString().split('\r\n'); + _smartMonToolsInstalled = pathArray.length > 0; + } catch (e) { + util.noop(); + } + } + return _smartMonToolsInstalled; +} + +function isRaspberry() { + const PI_MODEL_NO = [ + 'BCM2708', + 'BCM2709', + 'BCM2710', + 'BCM2711', + 'BCM2712', + 'BCM2835', + 'BCM2836', + 'BCM2837', + 'BCM2837B0' + ]; + let cpuinfo = []; + + if (_rpi_cpuinfo !== null) { + cpuinfo = _rpi_cpuinfo; + } else { + try { + cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n'); + _rpi_cpuinfo = cpuinfo; + } catch (e) { + return false; + } + } + + const hardware = getValue(cpuinfo, 'hardware'); + return (hardware && PI_MODEL_NO.indexOf(hardware) > -1); +} + +function isRaspbian() { + let osrelease = []; + try { + osrelease = fs.readFileSync('/etc/os-release', { encoding: 'utf8' }).toString().split('\n'); + } catch (e) { + return false; + } + const id = getValue(osrelease, 'id', '='); + return (id && id.indexOf('raspbian') > -1); +} + +function execWin(cmd, opts, callback) { + if (!callback) { + callback = opts; + opts = execOptsWin; + } + let newCmd = 'chcp 65001 > nul && cmd /C ' + cmd + ' && chcp ' + codepage + ' > nul'; + exec(newCmd, opts, function (error, stdout) { + callback(error, stdout); + }); +} + +function darwinXcodeExists() { + const cmdLineToolsExists = fs.existsSync('/Library/Developer/CommandLineTools/usr/bin/'); + const xcodeAppExists = fs.existsSync('/Applications/Xcode.app/Contents/Developer/Tools'); + const xcodeExists = fs.existsSync('/Library/Developer/Xcode/'); + return (cmdLineToolsExists || xcodeExists || xcodeAppExists); +} + +function nanoSeconds() { + const time = process.hrtime(); + if (!Array.isArray(time) || time.length !== 2) { + return 0; + } + return +time[0] * 1e9 + +time[1]; +} + +function countUniqueLines(lines, startingWith) { + startingWith = startingWith || ''; + const uniqueLines = []; + lines.forEach(line => { + if (line.startsWith(startingWith)) { + if (uniqueLines.indexOf(line) === -1) { + uniqueLines.push(line); + } + } + }); + return uniqueLines.length; +} + +function countLines(lines, startingWith) { + startingWith = startingWith || ''; + const uniqueLines = []; + lines.forEach(line => { + if (line.startsWith(startingWith)) { + uniqueLines.push(line); + } + }); + return uniqueLines.length; +} + +function sanitizeShellString(str, strict) { + if (typeof strict === 'undefined') { strict = false; } + const s = str || ''; + let result = ''; + const l = mathMin(s.length, 2000); + for (let i = 0; i <= l; i++) { + if (!(s[i] === undefined || + s[i] === '>' || + s[i] === '<' || + s[i] === '*' || + s[i] === '?' || + s[i] === '[' || + s[i] === ']' || + s[i] === '|' || + s[i] === '˚' || + s[i] === '$' || + s[i] === ';' || + s[i] === '&' || + s[i] === ']' || + s[i] === '#' || + s[i] === '\\' || + s[i] === '\t' || + s[i] === '\n' || + s[i] === '\r' || + s[i] === '\'' || + s[i] === '`' || + s[i] === '"' || + s[i].length > 1 || + (strict && s[i] === '(') || + (strict && s[i] === ')') || + (strict && s[i] === '@') || + (strict && s[i] === ' ') || + (strict && s[i] == '{') || + (strict && s[i] == ';') || + (strict && s[i] == '}'))) { + result = result + s[i]; + } + } + return result; +} + +function isPrototypePolluted() { + const s = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + let notPolluted = true; + let st = ''; + + st.__proto__.replace = stringReplace; + st.__proto__.toLowerCase = stringToLower; + st.__proto__.toString = stringToString; + st.__proto__.substr = stringSubstr; + + notPolluted = notPolluted || (s.length !== 62); + const ms = Date.now(); + if (typeof ms === 'number' && ms > 1600000000000) { + const l = ms % 100 + 15; + for (let i = 0; i < l; i++) { + const r = Math.random() * 61.99999999 + 1; + const rs = parseInt(Math.floor(r).toString(), 10); + const rs2 = parseInt(r.toString().split('.')[0], 10); + const q = Math.random() * 61.99999999 + 1; + const qs = parseInt(Math.floor(q).toString(), 10); + const qs2 = parseInt(q.toString().split('.')[0], 10); + notPolluted = notPolluted && (r !== q); + notPolluted = notPolluted && rs === rs2 && qs === qs2; + st += s[rs - 1]; + } + notPolluted = notPolluted && st.length === l; + // string manipulation + let p = Math.random() * l * 0.9999999999; + let stm = st.substr(0, p) + ' ' + st.substr(p, 2000); + stm.__proto__.replace = stringReplace; + let sto = stm.replace(/ /g, ''); + notPolluted = notPolluted && st === sto; + p = Math.random() * l * 0.9999999999; + stm = st.substr(0, p) + '{' + st.substr(p, 2000); + sto = stm.replace(/{/g, ''); + notPolluted = notPolluted && st === sto; + p = Math.random() * l * 0.9999999999; + stm = st.substr(0, p) + '*' + st.substr(p, 2000); + sto = stm.replace(/\*/g, ''); + notPolluted = notPolluted && st === sto; + p = Math.random() * l * 0.9999999999; + stm = st.substr(0, p) + '$' + st.substr(p, 2000); + sto = stm.replace(/\$/g, ''); + notPolluted = notPolluted && st === sto; + + // lower + const stl = st.toLowerCase(); + notPolluted = notPolluted && (stl.length === l) && stl[l - 1] && !(stl[l]); + for (let i = 0; i < l; i++) { + const s1 = st[i]; + s1.__proto__.toLowerCase = stringToLower; + const s2 = stl ? stl[i] : ''; + const s1l = s1.toLowerCase(); + notPolluted = notPolluted && s1l[0] === s2 && s1l[0] && !(s1l[1]); + } + } + return !notPolluted; +} + +function hex2bin(hex) { + return ('00000000' + (parseInt(hex, 16)).toString(2)).substr(-8); +} + +function getFilesInPath(source) { + const lstatSync = fs.lstatSync; + const readdirSync = fs.readdirSync; + const join = path.join; + + function isDirectory(source) { + return lstatSync(source).isDirectory(); + } + function isFile(source) { return lstatSync(source).isFile(); } + + function getDirectories(source) { + return readdirSync(source).map(function (name) { return join(source, name); }).filter(isDirectory); + } + function getFiles(source) { + return readdirSync(source).map(function (name) { return join(source, name); }).filter(isFile); + } + + function getFilesRecursively(source) { + try { + let dirs = getDirectories(source); + let files = dirs + .map(function (dir) { return getFilesRecursively(dir); }) + .reduce(function (a, b) { return a.concat(b); }, []); + return files.concat(getFiles(source)); + } catch (e) { + return []; + } + } + + if (fs.existsSync(source)) { + return getFilesRecursively(source); + } else { + return []; + } +} + +function decodePiCpuinfo(lines) { + + if (_rpi_cpuinfo === null) { + _rpi_cpuinfo = lines; + } + + // https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md + + const oldRevisionCodes = { + '0002': { + type: 'B', + revision: '1.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0003': { + type: 'B', + revision: '1.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0004': { + type: 'B', + revision: '2.0', + memory: 256, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0005': { + type: 'B', + revision: '2.0', + memory: 256, + manufacturer: 'Qisda', + processor: 'BCM2835' + }, + '0006': { + type: 'B', + revision: '2.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0007': { + type: 'A', + revision: '2.0', + memory: 256, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0008': { + type: 'A', + revision: '2.0', + memory: 256, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0009': { + type: 'A', + revision: '2.0', + memory: 256, + manufacturer: 'Qisda', + processor: 'BCM2835' + }, + '000d': { + type: 'B', + revision: '2.0', + memory: 512, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '000e': { + type: 'B', + revision: '2.0', + memory: 512, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '000f': { + type: 'B', + revision: '2.0', + memory: 512, + manufacturer: 'Egoman', + processor: 'BCM2835' + }, + '0010': { + type: 'B+', + revision: '1.2', + memory: 512, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0011': { + type: 'CM1', + revision: '1.0', + memory: 512, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0012': { + type: 'A+', + revision: '1.1', + memory: 256, + manufacturer: 'Sony UK', + processor: 'BCM2835' + }, + '0013': { + type: 'B+', + revision: '1.2', + memory: 512, + manufacturer: 'Embest', + processor: 'BCM2835' + }, + '0014': { + type: 'CM1', + revision: '1.0', + memory: 512, + manufacturer: 'Embest', + processor: 'BCM2835' + }, + '0015': { + type: 'A+', + revision: '1.1', + memory: 256, + manufacturer: '512MB Embest', + processor: 'BCM2835' + } + }; + + const processorList = [ + 'BCM2835', + 'BCM2836', + 'BCM2837', + 'BCM2711', + 'BCM2712', + ]; + const manufacturerList = [ + 'Sony UK', + 'Egoman', + 'Embest', + 'Sony Japan', + 'Embest', + 'Stadium' + ]; + const typeList = { + '00': 'A', + '01': 'B', + '02': 'A+', + '03': 'B+', + '04': '2B', + '05': 'Alpha (early prototype)', + '06': 'CM1', + '08': '3B', + '09': 'Zero', + '0a': 'CM3', + '0c': 'Zero W', + '0d': '3B+', + '0e': '3A+', + '0f': 'Internal use only', + '10': 'CM3+', + '11': '4B', + '12': 'Zero 2 W', + '13': '400', + '14': 'CM4', + '15': 'CM4S', + '17': '5', + }; + + const revisionCode = getValue(lines, 'revision', ':', true); + const model = getValue(lines, 'model:', ':', true); + const serial = getValue(lines, 'serial', ':', true); + + let result = {}; + if ({}.hasOwnProperty.call(oldRevisionCodes, revisionCode)) { + // old revision codes + result = { + model, + serial, + revisionCode, + memory: oldRevisionCodes[revisionCode].memory, + manufacturer: oldRevisionCodes[revisionCode].manufacturer, + processor: oldRevisionCodes[revisionCode].processor, + type: oldRevisionCodes[revisionCode].type, + revision: oldRevisionCodes[revisionCode].revision, + }; + + } else { + // new revision code + const revision = ('00000000' + getValue(lines, 'revision', ':', true).toLowerCase()).substr(-8); + const memSizeCode = parseInt(hex2bin(revision.substr(2, 1)).substr(5, 3), 2) || 0; + const manufacturer = manufacturerList[parseInt(revision.substr(3, 1), 10)]; + const processor = processorList[parseInt(revision.substr(4, 1), 10)]; + const typeCode = revision.substr(5, 2); + + + result = { + model, + serial, + revisionCode, + memory: 256 * Math.pow(2, memSizeCode), + manufacturer, + processor, + type: {}.hasOwnProperty.call(typeList, typeCode) ? typeList[typeCode] : '', + revision: '1.' + revision.substr(7, 1), + }; + } + return result; +} + +function getRpiGpu() { + let cpuinfo = null; + if (_rpi_cpuinfo !== null) { + cpuinfo = _rpi_cpuinfo; + } else { + try { + cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }).toString().split('\n'); + _rpi_cpuinfo = cpuinfo; + } catch (e) { + return false; + } + } + + const rpi = decodePiCpuinfo(cpuinfo); + if (rpi.type === '4B' || rpi.type === 'CM4' || rpi.type === 'CM4S' || rpi.type === '400') { return 'VideoCore VI'; } + if (rpi.type === '5') { return 'VideoCore VII'; } + return 'VideoCore IV'; +} + +function promiseAll(promises) { + const resolvingPromises = promises.map(function (promise) { + return new Promise(function (resolve) { + let payload = new Array(2); + promise.then(function (result) { + payload[0] = result; + }) + .catch(function (error) { + payload[1] = error; + }) + .then(function () { + // The wrapped Promise returns an array: 0 = result, 1 = error ... we resolve all + resolve(payload); + }); + }); + }); + const errors = []; + const results = []; + + // Execute all wrapped Promises + return Promise.all(resolvingPromises) + .then(function (items) { + items.forEach(function (payload) { + if (payload[1]) { + errors.push(payload[1]); + results.push(null); + } else { + errors.push(null); + results.push(payload[0]); + } + }); + + return { + errors: errors, + results: results + }; + }); +} + +function promisify(nodeStyleFunction) { + return function () { + const args = Array.prototype.slice.call(arguments); + return new Promise(function (resolve, reject) { + args.push(function (err, data) { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + nodeStyleFunction.apply(null, args); + }); + }; +} + +function promisifySave(nodeStyleFunction) { + return function () { + const args = Array.prototype.slice.call(arguments); + return new Promise(function (resolve) { + args.push(function (err, data) { + resolve(data); + }); + nodeStyleFunction.apply(null, args); + }); + }; +} + +function linuxVersion() { + let result = ''; + if (_linux) { + try { + result = execSync('uname -v', util.execOptsLinux).toString(); + } catch (e) { + result = ''; + } + } + return result; +} + +function plistParser(xmlStr) { + const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty']; + const startStr = '' && pos < len) { + pos++; + } + + let depth = 0; + let inTagStart = false; + let inTagContent = false; + let inTagEnd = false; + let metaData = [{ tagStart: '', tagEnd: '', tagContent: '', key: '', data: null }]; + let c = ''; + let cn = xmlStr[pos]; + + while (pos < len) { + c = cn; + if (pos + 1 < len) { cn = xmlStr[pos + 1]; } + if (c === '<') { + inTagContent = false; + if (cn === '/') { inTagEnd = true; } + else if (metaData[depth].tagStart) { + metaData[depth].tagContent = ''; + if (!metaData[depth].data) { metaData[depth].data = metaData[depth].tagStart === 'array' ? [] : {}; } + depth++; + metaData.push({ tagStart: '', tagEnd: '', tagContent: '', key: null, data: null }); + inTagStart = true; + inTagContent = false; + } + else if (!inTagStart) { inTagStart = true; } + } else if (c === '>') { + if (metaData[depth].tagStart === 'true/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = true; } + if (metaData[depth].tagStart === 'false/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/boolean'; metaData[depth].data = false; } + if (metaData[depth].tagStart === 'array/') { inTagStart = false; inTagEnd = true; metaData[depth].tagStart = ''; metaData[depth].tagEnd = '/arrayEmpty'; metaData[depth].data = []; } + if (inTagContent) { inTagContent = false; } + if (inTagStart) { + inTagStart = false; + inTagContent = true; + if (metaData[depth].tagStart === 'array') { + metaData[depth].data = []; + } + if (metaData[depth].tagStart === 'dict') { + metaData[depth].data = {}; + } + } + if (inTagEnd) { + inTagEnd = false; + if (metaData[depth].tagEnd && tags.indexOf(metaData[depth].tagEnd.substr(1)) >= 0) { + if (metaData[depth].tagEnd === '/dict' || metaData[depth].tagEnd === '/array') { + if (depth > 1 && metaData[depth - 2].tagStart === 'array') { + metaData[depth - 2].data.push(metaData[depth - 1].data); + } + if (depth > 1 && metaData[depth - 2].tagStart === 'dict') { + metaData[depth - 2].data[metaData[depth - 1].key] = metaData[depth - 1].data; + } + depth--; + metaData.pop(); + metaData[depth].tagContent = ''; + metaData[depth].tagStart = ''; + metaData[depth].tagEnd = ''; + } + else { + if (metaData[depth].tagEnd === '/key' && metaData[depth].tagContent) { + metaData[depth].key = metaData[depth].tagContent; + } else { + if (metaData[depth].tagEnd === '/real' && metaData[depth].tagContent) { metaData[depth].data = parseFloat(metaData[depth].tagContent) || 0; } + if (metaData[depth].tagEnd === '/integer' && metaData[depth].tagContent) { metaData[depth].data = parseInt(metaData[depth].tagContent) || 0; } + if (metaData[depth].tagEnd === '/string' && metaData[depth].tagContent) { metaData[depth].data = metaData[depth].tagContent || ''; } + if (metaData[depth].tagEnd === '/boolean') { metaData[depth].data = metaData[depth].tagContent || false; } + if (metaData[depth].tagEnd === '/arrayEmpty') { metaData[depth].data = metaData[depth].tagContent || []; } + if (depth > 0 && metaData[depth - 1].tagStart === 'array') { metaData[depth - 1].data.push(metaData[depth].data); } + if (depth > 0 && metaData[depth - 1].tagStart === 'dict') { metaData[depth - 1].data[metaData[depth].key] = metaData[depth].data; } + } + metaData[depth].tagContent = ''; + metaData[depth].tagStart = ''; + metaData[depth].tagEnd = ''; + } + } + metaData[depth].tagEnd = ''; + inTagStart = false; + inTagContent = false; + } + } else { + if (inTagStart) { metaData[depth].tagStart += c; } + if (inTagEnd) { metaData[depth].tagEnd += c; } + if (inTagContent) { metaData[depth].tagContent += c; } + } + pos++; + } + return metaData[0].data; +} + +function strIsNumeric(str) { + return typeof str === 'string' && !isNaN(str) && !isNaN(parseFloat(str)); +} + +function plistReader(output) { + const lines = output.split('\n'); + for (let i = 0; i < lines.length; i++) { + if (lines[i].indexOf(' = ') >= 0) { + const lineParts = lines[i].split(' = '); + lineParts[0] = lineParts[0].trim(); + if (!lineParts[0].startsWith('"')) { + lineParts[0] = '"' + lineParts[0] + '"'; + } + lineParts[1] = lineParts[1].trim(); + if (lineParts[1].indexOf('"') === -1 && lineParts[1].endsWith(';')) { + const valueString = lineParts[1].substring(0, lineParts[1].length - 1); + if (!strIsNumeric(valueString)) { + lineParts[1] = `"${valueString}";`; + } + } + if (lineParts[1].indexOf('"') >= 0 && lineParts[1].endsWith(';')) { + const valueString = lineParts[1].substring(0, lineParts[1].length - 1).replace(/"/g, ''); + if (strIsNumeric(valueString)) { + lineParts[1] = `${valueString};`; + } + } + lines[i] = lineParts.join(' : '); + } + lines[i] = lines[i].replace(/\(/g, '[').replace(/\)/g, ']').replace(/;/g, ',').trim(); + if (lines[i].startsWith('}') && lines[i - 1] && lines[i - 1].endsWith(',')) { + lines[i - 1] = lines[i - 1].substring(0, lines[i - 1].length - 1); + } + } + output = lines.join(''); + let obj = {}; + try { + obj = JSON.parse(output); + } catch (e) { + noop(); + } + return obj; +} + +function semverCompare(v1, v2) { + let res = 0; + const parts1 = v1.split('.'); + const parts2 = v2.split('.'); + if (parts1[0] < parts2[0]) { res = 1; } + else if (parts1[0] > parts2[0]) { res = -1; } + else if (parts1[0] === parts2[0] && parts1.length >= 2 && parts2.length >= 2) { + if (parts1[1] < parts2[1]) { res = 1; } + else if (parts1[1] > parts2[1]) { res = -1; } + else if (parts1[1] === parts2[1]) { + if (parts1.length >= 3 && parts2.length >= 3) { + if (parts1[2] < parts2[2]) { res = 1; } + else if (parts1[2] > parts2[2]) { res = -1; } + } else if (parts2.length >= 3) { + res = 1; + } + } + } + return res; +} + +function noop() { } + +exports.toInt = toInt; +exports.splitByNumber = splitByNumber; +exports.execOptsWin = execOptsWin; +exports.execOptsLinux = execOptsLinux; +exports.getCodepage = getCodepage; +exports.execWin = execWin; +exports.isFunction = isFunction; +exports.unique = unique; +exports.sortByKey = sortByKey; +exports.cores = cores; +exports.getValue = getValue; +exports.decodeEscapeSequence = decodeEscapeSequence; +exports.parseDateTime = parseDateTime; +exports.parseHead = parseHead; +exports.findObjectByKey = findObjectByKey; +exports.getWmic = getWmic; +exports.wmic = wmic; +exports.darwinXcodeExists = darwinXcodeExists; +exports.getVboxmanage = getVboxmanage; +exports.powerShell = powerShell; +exports.powerShellStart = powerShellStart; +exports.powerShellRelease = powerShellRelease; +exports.execSafe = execSafe; +exports.nanoSeconds = nanoSeconds; +exports.countUniqueLines = countUniqueLines; +exports.countLines = countLines; +exports.noop = noop; +exports.isRaspberry = isRaspberry; +exports.isRaspbian = isRaspbian; +exports.sanitizeShellString = sanitizeShellString; +exports.isPrototypePolluted = isPrototypePolluted; +exports.decodePiCpuinfo = decodePiCpuinfo; +exports.getRpiGpu = getRpiGpu; +exports.promiseAll = promiseAll; +exports.promisify = promisify; +exports.promisifySave = promisifySave; +exports.smartMonToolsInstalled = smartMonToolsInstalled; +exports.linuxVersion = linuxVersion; +exports.plistParser = plistParser; +exports.plistReader = plistReader; +exports.stringReplace = stringReplace; +exports.stringToLower = stringToLower; +exports.stringToString = stringToString; +exports.stringSubstr = stringSubstr; +exports.stringTrim = stringTrim; +exports.stringStartWith = stringStartWith; +exports.mathMin = mathMin; +exports.WINDIR = WINDIR; +exports.getFilesInPath = getFilesInPath; +exports.semverCompare = semverCompare; + + +/***/ }), + +/***/ 1454: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// virtualbox.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 14. Docker +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const exec = (__nccwpck_require__(2081).exec); +const util = __nccwpck_require__(9872); + +function vboxInfo(callback) { + + // fallback - if only callback is given + let result = []; + return new Promise((resolve) => { + process.nextTick(() => { + try { + exec(util.getVboxmanage() + ' list vms --long', function (error, stdout) { + let parts = (os.EOL + stdout.toString()).split(os.EOL + 'Name:'); + parts.shift(); + parts.forEach(part => { + const lines = ('Name:' + part).split(os.EOL); + const state = util.getValue(lines, 'State'); + const running = state.startsWith('running'); + const runningSinceString = running ? state.replace('running (since ', '').replace(')', '').trim() : ''; + let runningSince = 0; + try { + if (running) { + const sinceDateObj = new Date(runningSinceString); + const offset = sinceDateObj.getTimezoneOffset(); + runningSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60; + } + } catch (e) { + util.noop(); + } + const stoppedSinceString = !running ? state.replace('powered off (since', '').replace(')', '').trim() : ''; + let stoppedSince = 0; + try { + if (!running) { + const sinceDateObj = new Date(stoppedSinceString); + const offset = sinceDateObj.getTimezoneOffset(); + stoppedSince = Math.round((Date.now() - Date.parse(sinceDateObj)) / 1000) + offset * 60; + } + } catch (e) { + util.noop(); + } + result.push({ + id: util.getValue(lines, 'UUID'), + name: util.getValue(lines, 'Name'), + running, + started: runningSinceString, + runningSince, + stopped: stoppedSinceString, + stoppedSince, + guestOS: util.getValue(lines, 'Guest OS'), + hardwareUUID: util.getValue(lines, 'Hardware UUID'), + memory: parseInt(util.getValue(lines, 'Memory size', ' '), 10), + vram: parseInt(util.getValue(lines, 'VRAM size'), 10), + cpus: parseInt(util.getValue(lines, 'Number of CPUs'), 10), + cpuExepCap: util.getValue(lines, 'CPU exec cap'), + cpuProfile: util.getValue(lines, 'CPUProfile'), + chipset: util.getValue(lines, 'Chipset'), + firmware: util.getValue(lines, 'Firmware'), + pageFusion: util.getValue(lines, 'Page Fusion') === 'enabled', + configFile: util.getValue(lines, 'Config file'), + snapshotFolder: util.getValue(lines, 'Snapshot folder'), + logFolder: util.getValue(lines, 'Log folder'), + hpet: util.getValue(lines, 'HPET') === 'enabled', + pae: util.getValue(lines, 'PAE') === 'enabled', + longMode: util.getValue(lines, 'Long Mode') === 'enabled', + tripleFaultReset: util.getValue(lines, 'Triple Fault Reset') === 'enabled', + apic: util.getValue(lines, 'APIC') === 'enabled', + x2Apic: util.getValue(lines, 'X2APIC') === 'enabled', + acpi: util.getValue(lines, 'ACPI') === 'enabled', + ioApic: util.getValue(lines, 'IOAPIC') === 'enabled', + biosApicMode: util.getValue(lines, 'BIOS APIC mode'), + bootMenuMode: util.getValue(lines, 'Boot menu mode'), + bootDevice1: util.getValue(lines, 'Boot Device 1'), + bootDevice2: util.getValue(lines, 'Boot Device 2'), + bootDevice3: util.getValue(lines, 'Boot Device 3'), + bootDevice4: util.getValue(lines, 'Boot Device 4'), + timeOffset: util.getValue(lines, 'Time offset'), + rtc: util.getValue(lines, 'RTC'), + }); + }); + + if (callback) { callback(result); } + resolve(result); + }); + } catch (e) { + if (callback) { callback(result); } + resolve(result); + } + }); + }); +} + +exports.vboxInfo = vboxInfo; + + +/***/ }), + +/***/ 6437: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + + +// @ts-check +// ================================================================================== +// wifi.js +// ---------------------------------------------------------------------------------- +// Description: System Information - library +// for Node.js +// Copyright: (c) 2014 - 2024 +// Author: Sebastian Hildebrandt +// ---------------------------------------------------------------------------------- +// License: MIT +// ================================================================================== +// 9. wifi +// ---------------------------------------------------------------------------------- + +const os = __nccwpck_require__(2037); +const exec = (__nccwpck_require__(2081).exec); +const execSync = (__nccwpck_require__(2081).execSync); +const util = __nccwpck_require__(9872); + +let _platform = process.platform; + +const _linux = (_platform === 'linux' || _platform === 'android'); +const _darwin = (_platform === 'darwin'); +const _windows = (_platform === 'win32'); + +function wifiDBFromQuality(quality) { + const qual = parseFloat(quality); + if (qual < 0) { return 0; } + if (qual >= 100) { return -50; } + return (qual / 2 - 100); +} + +function wifiQualityFromDB(db) { + const result = 2 * (parseFloat(db) + 100); + return result <= 100 ? result : 100; +} + +const _wifi_frequencies = { + 1: 2412, + 2: 2417, + 3: 2422, + 4: 2427, + 5: 2432, + 6: 2437, + 7: 2442, + 8: 2447, + 9: 2452, + 10: 2457, + 11: 2462, + 12: 2467, + 13: 2472, + 14: 2484, + 32: 5160, + 34: 5170, + 36: 5180, + 38: 5190, + 40: 5200, + 42: 5210, + 44: 5220, + 46: 5230, + 48: 5240, + 50: 5250, + 52: 5260, + 54: 5270, + 56: 5280, + 58: 5290, + 60: 5300, + 62: 5310, + 64: 5320, + 68: 5340, + 96: 5480, + 100: 5500, + 102: 5510, + 104: 5520, + 106: 5530, + 108: 5540, + 110: 5550, + 112: 5560, + 114: 5570, + 116: 5580, + 118: 5590, + 120: 5600, + 122: 5610, + 124: 5620, + 126: 5630, + 128: 5640, + 132: 5660, + 134: 5670, + 136: 5680, + 138: 5690, + 140: 5700, + 142: 5710, + 144: 5720, + 149: 5745, + 151: 5755, + 153: 5765, + 155: 5775, + 157: 5785, + 159: 5795, + 161: 5805, + 165: 5825, + 169: 5845, + 173: 5865, + 183: 4915, + 184: 4920, + 185: 4925, + 187: 4935, + 188: 4940, + 189: 4945, + 192: 4960, + 196: 4980 +}; + +function wifiFrequencyFromChannel(channel) { + return {}.hasOwnProperty.call(_wifi_frequencies, channel) ? _wifi_frequencies[channel] : null; +} + +function wifiChannelFromFrequencs(frequency) { + let channel = 0; + for (let key in _wifi_frequencies) { + if ({}.hasOwnProperty.call(_wifi_frequencies, key)) { + if (_wifi_frequencies[key] === frequency) { channel = util.toInt(key); } + } + } + return channel; +} + +function ifaceListLinux() { + const result = []; + const cmd = 'iw dev 2>/dev/null'; + try { + const all = execSync(cmd, util.execOptsLinux).toString().split('\n').map(line => line.trim()).join('\n'); + const parts = all.split('\nInterface '); + parts.shift(); + parts.forEach(ifaceDetails => { + const lines = ifaceDetails.split('\n'); + const iface = lines[0]; + const id = util.toInt(util.getValue(lines, 'ifindex', ' ')); + const mac = util.getValue(lines, 'addr', ' '); + const channel = util.toInt(util.getValue(lines, 'channel', ' ')); + result.push({ + id, + iface, + mac, + channel + }); + }); + return result; + } catch (e) { + try { + const all = execSync('nmcli -t -f general,wifi-properties,wired-properties,interface-flags,capabilities,nsp device show 2>/dev/null', util.execOptsLinux).toString(); + const parts = all.split('\n\n'); + let i = 1; + parts.forEach(ifaceDetails => { + const lines = ifaceDetails.split('\n'); + const iface = util.getValue(lines, 'GENERAL.DEVICE'); + const type = util.getValue(lines, 'GENERAL.TYPE'); + const id = i++; // // util.getValue(lines, 'GENERAL.PATH'); + const mac = util.getValue(lines, 'GENERAL.HWADDR'); + const channel = ''; + if (type.toLowerCase() === 'wifi') { + result.push({ + id, + iface, + mac, + channel + }); + } + }); + return result; + } catch (e) { + return []; + } + } +} + +function nmiDeviceLinux(iface) { + const cmd = `nmcli -t -f general,wifi-properties,capabilities,ip4,ip6 device show ${iface} 2>/dev/null`; + try { + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const ssid = util.getValue(lines, 'GENERAL.CONNECTION'); + return { + iface, + type: util.getValue(lines, 'GENERAL.TYPE'), + vendor: util.getValue(lines, 'GENERAL.VENDOR'), + product: util.getValue(lines, 'GENERAL.PRODUCT'), + mac: util.getValue(lines, 'GENERAL.HWADDR').toLowerCase(), + ssid: ssid !== '--' ? ssid : null + }; + } catch (e) { + return {}; + } +} + +function nmiConnectionLinux(ssid) { + const cmd = `nmcli -t --show-secrets connection show ${ssid} 2>/dev/null`; + try { + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const bssid = util.getValue(lines, '802-11-wireless.seen-bssids').toLowerCase(); + return { + ssid: ssid !== '--' ? ssid : null, + uuid: util.getValue(lines, 'connection.uuid'), + type: util.getValue(lines, 'connection.type'), + autoconnect: util.getValue(lines, 'connection.autoconnect') === 'yes', + security: util.getValue(lines, '802-11-wireless-security.key-mgmt'), + bssid: bssid !== '--' ? bssid : null + }; + } catch (e) { + return {}; + } +} + +function wpaConnectionLinux(iface) { + if (!iface) { + return {}; + } + const cmd = `wpa_cli -i ${iface} status 2>&1`; + try { + const lines = execSync(cmd, util.execOptsLinux).toString().split('\n'); + const freq = util.toInt(util.getValue(lines, 'freq', '=')); + return { + ssid: util.getValue(lines, 'ssid', '='), + uuid: util.getValue(lines, 'uuid', '='), + security: util.getValue(lines, 'key_mgmt', '='), + freq, + channel: wifiChannelFromFrequencs(freq), + bssid: util.getValue(lines, 'bssid', '=').toLowerCase() + }; + } catch (e) { + return {}; + } +} + +function getWifiNetworkListNmi() { + const result = []; + const cmd = 'nmcli -t -m multiline --fields active,ssid,bssid,mode,chan,freq,signal,security,wpa-flags,rsn-flags device wifi list 2>/dev/null'; + try { + const stdout = execSync(cmd, util.execOptsLinux); + const parts = stdout.toString().split('ACTIVE:'); + parts.shift(); + parts.forEach(part => { + part = 'ACTIVE:' + part; + const lines = part.split(os.EOL); + const channel = util.getValue(lines, 'CHAN'); + const frequency = util.getValue(lines, 'FREQ').toLowerCase().replace('mhz', '').trim(); + const security = util.getValue(lines, 'SECURITY').replace('(', '').replace(')', ''); + const wpaFlags = util.getValue(lines, 'WPA-FLAGS').replace('(', '').replace(')', ''); + const rsnFlags = util.getValue(lines, 'RSN-FLAGS').replace('(', '').replace(')', ''); + const quality = util.getValue(lines, 'SIGNAL'); + result.push({ + ssid: util.getValue(lines, 'SSID'), + bssid: util.getValue(lines, 'BSSID').toLowerCase(), + mode: util.getValue(lines, 'MODE'), + channel: channel ? parseInt(channel, 10) : null, + frequency: frequency ? parseInt(frequency, 10) : null, + signalLevel: wifiDBFromQuality(quality), + quality: quality ? parseInt(quality, 10) : null, + security: security && security !== 'none' ? security.split(' ') : [], + wpaFlags: wpaFlags && wpaFlags !== 'none' ? wpaFlags.split(' ') : [], + rsnFlags: rsnFlags && rsnFlags !== 'none' ? rsnFlags.split(' ') : [] + }); + }); + return result; + } catch (e) { + return []; + } +} + +function getWifiNetworkListIw(iface) { + const result = []; + try { + let iwlistParts = execSync(`export LC_ALL=C; iwlist ${iface} scan 2>&1; unset LC_ALL`, util.execOptsLinux).toString().split(' Cell '); + if (iwlistParts[0].indexOf('resource busy') >= 0) { return -1; } + if (iwlistParts.length > 1) { + iwlistParts.shift(); + iwlistParts.forEach(element => { + const lines = element.split('\n'); + const channel = util.getValue(lines, 'channel', ':', true); + const address = (lines && lines.length && lines[0].indexOf('Address:') >= 0 ? lines[0].split('Address:')[1].trim().toLowerCase() : ''); + const mode = util.getValue(lines, 'mode', ':', true); + const frequency = util.getValue(lines, 'frequency', ':', true); + const qualityString = util.getValue(lines, 'Quality', '=', true); + const dbParts = qualityString.toLowerCase().split('signal level='); + const db = dbParts.length > 1 ? util.toInt(dbParts[1]) : 0; + const quality = db ? wifiQualityFromDB(db) : 0; + const ssid = util.getValue(lines, 'essid', ':', true); + + // security and wpa-flags + const isWpa = element.indexOf(' WPA ') >= 0; + const isWpa2 = element.indexOf('WPA2 ') >= 0; + const security = []; + if (isWpa) { security.push('WPA'); } + if (isWpa2) { security.push('WPA2'); } + const wpaFlags = []; + let wpaFlag = ''; + lines.forEach(function (line) { + const l = line.trim().toLowerCase(); + if (l.indexOf('group cipher') >= 0) { + if (wpaFlag) { + wpaFlags.push(wpaFlag); + } + const parts = l.split(':'); + if (parts.length > 1) { + wpaFlag = parts[1].trim().toUpperCase(); + } + } + if (l.indexOf('pairwise cipher') >= 0) { + const parts = l.split(':'); + if (parts.length > 1) { + if (parts[1].indexOf('tkip')) { wpaFlag = (wpaFlag ? 'TKIP/' + wpaFlag : 'TKIP'); } + else if (parts[1].indexOf('ccmp')) { wpaFlag = (wpaFlag ? 'CCMP/' + wpaFlag : 'CCMP'); } + else if (parts[1].indexOf('proprietary')) { wpaFlag = (wpaFlag ? 'PROP/' + wpaFlag : 'PROP'); } + } + } + if (l.indexOf('authentication suites') >= 0) { + const parts = l.split(':'); + if (parts.length > 1) { + if (parts[1].indexOf('802.1x')) { wpaFlag = (wpaFlag ? '802.1x/' + wpaFlag : '802.1x'); } + else if (parts[1].indexOf('psk')) { wpaFlag = (wpaFlag ? 'PSK/' + wpaFlag : 'PSK'); } + } + } + }); + if (wpaFlag) { + wpaFlags.push(wpaFlag); + } + + result.push({ + ssid, + bssid: address, + mode, + channel: channel ? util.toInt(channel) : null, + frequency: frequency ? util.toInt(frequency.replace('.', '')) : null, + signalLevel: db, + quality, + security, + wpaFlags, + rsnFlags: [] + }); + }); + } + return result; + } catch (e) { + return -1; + } +} + +function parseWifiDarwin(wifiObj) { + const result = []; + if (wifiObj) { + wifiObj.forEach(function (wifiItem) { + const signalLevel = wifiItem.RSSI; + let security = []; + let wpaFlags = []; + let ssid = wifiItem.SSID_STR || ''; + if (wifiItem.WPA_IE) { + security.push('WPA'); + if (wifiItem.WPA_IE.IE_KEY_WPA_UCIPHERS) { + wifiItem.WPA_IE.IE_KEY_WPA_UCIPHERS.forEach(function (ciphers) { + if (ciphers === 0 && wpaFlags.indexOf('unknown/TKIP') === -1) { wpaFlags.push('unknown/TKIP'); } + if (ciphers === 2 && wpaFlags.indexOf('PSK/TKIP') === -1) { wpaFlags.push('PSK/TKIP'); } + if (ciphers === 4 && wpaFlags.indexOf('PSK/AES') === -1) { wpaFlags.push('PSK/AES'); } + }); + } + } + if (wifiItem.RSN_IE) { + security.push('WPA2'); + if (wifiItem.RSN_IE.IE_KEY_RSN_UCIPHERS) { + wifiItem.RSN_IE.IE_KEY_RSN_UCIPHERS.forEach(function (ciphers) { + if (ciphers === 0 && wpaFlags.indexOf('unknown/TKIP') === -1) { wpaFlags.push('unknown/TKIP'); } + if (ciphers === 2 && wpaFlags.indexOf('TKIP/TKIP') === -1) { wpaFlags.push('TKIP/TKIP'); } + if (ciphers === 4 && wpaFlags.indexOf('PSK/AES') === -1) { wpaFlags.push('PSK/AES'); } + }); + } + } + if (wifiItem.SSID && ssid === '') { + try { + ssid = Buffer.from(wifiItem.SSID, 'base64').toString('utf8'); + } catch (err) { + util.noop(); + } + } + result.push({ + ssid, + bssid: wifiItem.BSSID || '', + mode: '', + channel: wifiItem.CHANNEL, + frequency: wifiFrequencyFromChannel(wifiItem.CHANNEL), + signalLevel: signalLevel ? parseInt(signalLevel, 10) : null, + quality: wifiQualityFromDB(signalLevel), + security, + wpaFlags, + rsnFlags: [] + }); + }); + } + return result; +} +function wifiNetworks(callback) { + return new Promise((resolve) => { + process.nextTick(() => { + let result = []; + if (_linux) { + result = getWifiNetworkListNmi(); + if (result.length === 0) { + try { + const iwconfigParts = execSync('export LC_ALL=C; iwconfig 2>/dev/null; unset LC_ALL', util.execOptsLinux).toString().split('\n\n'); + let iface = ''; + iwconfigParts.forEach(element => { + if (element.indexOf('no wireless') === -1 && element.trim() !== '') { + iface = element.split(' ')[0]; + } + }); + if (iface) { + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(iface, true); + const l = util.mathMin(s.length, 2000); + + for (let i = 0; i <= l; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + const res = getWifiNetworkListIw(ifaceSanitized); + if (res === -1) { + // try again after 4 secs + setTimeout(function (iface) { + const res = getWifiNetworkListIw(iface); + if (res != -1) { result = res; } + if (callback) { + callback(result); + } + resolve(result); + }, 4000); + } else { + result = res; + if (callback) { + callback(result); + } + resolve(result); + } + } else { + if (callback) { + callback(result); + } + resolve(result); + } + } catch (e) { + if (callback) { + callback(result); + } + resolve(result); + } + } else { + if (callback) { + callback(result); + } + resolve(result); + } + } else if (_darwin) { + let cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x'; + exec(cmd, { maxBuffer: 1024 * 40000 }, function (error, stdout) { + const output = stdout.toString(); + result = parseWifiDarwin(util.plistParser(output)); + if (callback) { + callback(result); + } + resolve(result); + }); + } else if (_windows) { + let cmd = 'netsh wlan show networks mode=Bssid'; + util.powerShell(cmd).then((stdout) => { + const ssidParts = stdout.toString('utf8').split(os.EOL + os.EOL + 'SSID '); + ssidParts.shift(); + + ssidParts.forEach(ssidPart => { + const ssidLines = ssidPart.split(os.EOL); + if (ssidLines && ssidLines.length >= 8 && ssidLines[0].indexOf(':') >= 0) { + const bssidsParts = ssidPart.split(' BSSID'); + bssidsParts.shift(); + + bssidsParts.forEach((bssidPart) => { + const bssidLines = bssidPart.split(os.EOL); + const bssidLine = bssidLines[0].split(':'); + bssidLine.shift(); + const bssid = bssidLine.join(':').trim().toLowerCase(); + const channel = bssidLines[3].split(':').pop().trim(); + const quality = bssidLines[1].split(':').pop().trim(); + + result.push({ + ssid: ssidLines[0].split(':').pop().trim(), + bssid, + mode: '', + channel: channel ? parseInt(channel, 10) : null, + frequency: wifiFrequencyFromChannel(channel), + signalLevel: wifiDBFromQuality(quality), + quality: quality ? parseInt(quality, 10) : null, + security: [ssidLines[2].split(':').pop().trim()], + wpaFlags: [ssidLines[3].split(':').pop().trim()], + rsnFlags: [] + }); + }); + } + }); + + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} + +exports.wifiNetworks = wifiNetworks; + +function getVendor(model) { + model = model.toLowerCase(); + let result = ''; + if (model.indexOf('intel') >= 0) { result = 'Intel'; } + else if (model.indexOf('realtek') >= 0) { result = 'Realtek'; } + else if (model.indexOf('qualcom') >= 0) { result = 'Qualcom'; } + else if (model.indexOf('broadcom') >= 0) { result = 'Broadcom'; } + else if (model.indexOf('cavium') >= 0) { result = 'Cavium'; } + else if (model.indexOf('cisco') >= 0) { result = 'Cisco'; } + else if (model.indexOf('marvel') >= 0) { result = 'Marvel'; } + else if (model.indexOf('zyxel') >= 0) { result = 'Zyxel'; } + else if (model.indexOf('melanox') >= 0) { result = 'Melanox'; } + else if (model.indexOf('d-link') >= 0) { result = 'D-Link'; } + else if (model.indexOf('tp-link') >= 0) { result = 'TP-Link'; } + else if (model.indexOf('asus') >= 0) { result = 'Asus'; } + else if (model.indexOf('linksys') >= 0) { result = 'Linksys'; } + return result; +} + +function formatBssid(s) { + s = s.replace(//g, '').match(/.{1,2}/g) || []; + return s.join(':'); +} + +function wifiConnections(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + const result = []; + + if (_linux) { + const ifaces = ifaceListLinux(); + const networkList = getWifiNetworkListNmi(); + ifaces.forEach(ifaceDetail => { + let ifaceSanitized = ''; + const s = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ifaceDetail.iface, true); + const ll = util.mathMin(s.length, 2000); + + for (let i = 0; i <= ll; i++) { + if (s[i] !== undefined) { + ifaceSanitized = ifaceSanitized + s[i]; + } + } + + const nmiDetails = nmiDeviceLinux(ifaceSanitized); + const wpaDetails = wpaConnectionLinux(ifaceSanitized); + const ssid = nmiDetails.ssid || wpaDetails.ssid; + const network = networkList.filter(nw => nw.ssid === ssid); + let ssidSanitized = ''; + const t = util.isPrototypePolluted() ? '---' : util.sanitizeShellString(ssid, true); + const l = util.mathMin(t.length, 2000); + for (let i = 0; i <= l; i++) { + if (t[i] !== undefined) { + ssidSanitized = ssidSanitized + t[i]; + } + } + + const nmiConnection = nmiConnectionLinux(ssidSanitized); + const channel = network && network.length && network[0].channel ? network[0].channel : (wpaDetails.channel ? wpaDetails.channel : null); + const bssid = network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null); + const signalLevel = network && network.length && network[0].signalLevel ? network[0].signalLevel : null; + if (ssid && bssid) { + result.push({ + id: ifaceDetail.id, + iface: ifaceDetail.iface, + model: nmiDetails.product, + ssid, + bssid: network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null), + channel, + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type: nmiConnection.type ? nmiConnection.type : '802.11', + security: nmiConnection.security ? nmiConnection.security : (wpaDetails.security ? wpaDetails.security : null), + signalLevel, + quality: wifiQualityFromDB(signalLevel), + txRate: null + }); + } + }); + if (callback) { + callback(result); + } + resolve(result); + } else if (_darwin) { + let cmd = 'system_profiler SPNetworkDataType'; + exec(cmd, function (error, stdout) { + const parts1 = stdout.toString().split('\n\n Wi-Fi:\n\n'); + if (parts1.length > 1) { + const lines = parts1[1].split('\n\n')[0].split('\n'); + const iface = util.getValue(lines, 'BSD Device Name', ':', true); + const model = util.getValue(lines, 'hardware', ':', true); + cmd = '/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I 2>/dev/null; echo "######" ; ioreg -n AppleBCMWLANSkywalkInterface -r 2>/dev/null'; + exec(cmd, function (error, stdout) { + const parts = stdout.toString().split('######'); + const lines2 = parts[0].split('\n'); + let lines3 = []; + if (parts[1].indexOf(' | {') > 0 && parts[1].indexOf(' | }') > parts[1].indexOf(' | {')) { + lines3 = parts[1].split(' | {')[1].split(' | }')[0].replace(/ \| /g, '').replace(/"/g, '').split('\n'); + } + if (lines2.length > 10) { + const ssid = util.getValue(lines2, 'ssid', ':', true); + const bssid = util.getValue(lines2, 'bssid', ':', true) || formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true)); + const security = util.getValue(lines2, 'link auth', ':', true); + const txRate = util.getValue(lines2, 'lastTxRate', ':', true); + const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0]; + const type = '802.11'; + const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true)); + /// const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true)); + const signalLevel = rssi; + if (ssid || bssid) { + result.push({ + id: 'Wi-Fi', + iface, + model, + ssid, + bssid, + channel: util.toInt(channel), + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type, + security, + signalLevel, + quality: wifiQualityFromDB(signalLevel), + txRate + }); + } + } + if (lines3.length > 10) { + const ssid = util.getValue(lines3, 'IO80211SSID', '=', true); + const bssid = formatBssid(util.getValue(lines3, 'IO80211BSSID', '=', true)); + const security = ''; + const txRate = -1; + const signalLevel = -1; + const quality = -1; + const channel = util.getValue(lines3, 'IO80211Channel', '=', true); + const type = '802.11'; + if ((ssid || bssid) && !result.length) { + result.push({ + id: 'Wi-Fi', + iface, + model, + ssid, + bssid, + channel: util.toInt(channel), + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type, + security, + signalLevel, + quality, + txRate + }); + } + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + } else if (_windows) { + let cmd = 'netsh wlan show interfaces'; + util.powerShell(cmd).then(function (stdout) { + const allLines = stdout.toString().split('\r\n'); + for (let i = 0; i < allLines.length; i++) { + allLines[i] = allLines[i].trim(); + } + const parts = allLines.join('\r\n').split(':\r\n\r\n'); + parts.shift(); + parts.forEach(part => { + const lines = part.split('\r\n'); + if (lines.length >= 5) { + const iface = lines[0].indexOf(':') >= 0 ? lines[0].split(':')[1].trim() : ''; + const model = lines[1].indexOf(':') >= 0 ? lines[1].split(':')[1].trim() : ''; + const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : ''; + const ssid = util.getValue(lines, 'SSID', ':', true); + const bssid = util.getValue(lines, 'BSSID', ':', true); + const quality = util.getValue(lines, 'Signal', ':', true); + const signalLevel = wifiDBFromQuality(quality); + const type = util.getValue(lines, 'Radio type', ':', true) || util.getValue(lines, 'Type de radio', ':', true) || util.getValue(lines, 'Funktyp', ':', true) || null; + const security = util.getValue(lines, 'authentication', ':', true) || util.getValue(lines, 'Authentification', ':', true) || util.getValue(lines, 'Authentifizierung', ':', true) || null; + const channel = util.getValue(lines, 'Channel', ':', true) || util.getValue(lines, 'Canal', ':', true) || util.getValue(lines, 'Kanal', ':', true) || null; + const txRate = util.getValue(lines, 'Transmit rate (mbps)', ':', true) || util.getValue(lines, 'Transmission (mbit/s)', ':', true) || util.getValue(lines, 'Empfangsrate (MBit/s)', ':', true) || null; + if (model && id && ssid && bssid) { + result.push({ + id, + iface, + model, + ssid, + bssid, + channel: util.toInt(channel), + frequency: channel ? wifiFrequencyFromChannel(channel) : null, + type, + security, + signalLevel, + quality: quality ? parseInt(quality, 10) : null, + txRate: util.toInt(txRate) || null + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} + +exports.wifiConnections = wifiConnections; + +function wifiInterfaces(callback) { + + return new Promise((resolve) => { + process.nextTick(() => { + const result = []; + + if (_linux) { + const ifaces = ifaceListLinux(); + ifaces.forEach(ifaceDetail => { + const nmiDetails = nmiDeviceLinux(ifaceDetail.iface); + result.push({ + id: ifaceDetail.id, + iface: ifaceDetail.iface, + model: nmiDetails.product ? nmiDetails.product : null, + vendor: nmiDetails.vendor ? nmiDetails.vendor : null, + mac: ifaceDetail.mac, + }); + }); + if (callback) { + callback(result); + } + resolve(result); + } else if (_darwin) { + let cmd = 'system_profiler SPNetworkDataType'; + exec(cmd, function (error, stdout) { + const parts1 = stdout.toString().split('\n\n Wi-Fi:\n\n'); + if (parts1.length > 1) { + const lines = parts1[1].split('\n\n')[0].split('\n'); + const iface = util.getValue(lines, 'BSD Device Name', ':', true); + const mac = util.getValue(lines, 'MAC Address', ':', true); + const model = util.getValue(lines, 'hardware', ':', true); + result.push({ + id: 'Wi-Fi', + iface, + model, + vendor: '', + mac + }); + } + if (callback) { + callback(result); + } + resolve(result); + }); + } else if (_windows) { + let cmd = 'netsh wlan show interfaces'; + util.powerShell(cmd).then(function (stdout) { + const allLines = stdout.toString().split('\r\n'); + for (let i = 0; i < allLines.length; i++) { + allLines[i] = allLines[i].trim(); + } + const parts = allLines.join('\r\n').split(':\r\n\r\n'); + parts.shift(); + parts.forEach(part => { + const lines = part.split('\r\n'); + if (lines.length >= 5) { + const iface = lines[0].indexOf(':') >= 0 ? lines[0].split(':')[1].trim() : ''; + const model = lines[1].indexOf(':') >= 0 ? lines[1].split(':')[1].trim() : ''; + const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : ''; + const macParts = lines[3].indexOf(':') >= 0 ? lines[3].split(':') : []; + macParts.shift(); + const mac = macParts.join(':').trim(); + const vendor = getVendor(model); + if (iface && model && id && mac) { + result.push({ + id, + iface, + model, + vendor, + mac, + }); + } + } + }); + if (callback) { + callback(result); + } + resolve(result); + }); + } else { + if (callback) { + callback(result); + } + resolve(result); + } + }); + }); +} + +exports.wifiInterfaces = wifiInterfaces; + + /***/ }), /***/ 36: @@ -68280,6 +84229,14 @@ function wrappy (fn, cb) { } +/***/ }), + +/***/ 7317: +/***/ ((module) => { + +module.exports = eval("require")("osx-temperature-sensor"); + + /***/ }), /***/ 383: @@ -87410,6 +103367,13 @@ exports.visit = visit; exports.visitAsync = visitAsync; +/***/ }), + +/***/ 1927: +/***/ ((module) => { + +module.exports = {"i8":"5.23.3"}; + /***/ }) /******/ }); @@ -87468,6 +103432,8 @@ var lib_cache = __nccwpck_require__(6930); var lib_exec = __nccwpck_require__(6473); // EXTERNAL MODULE: ../../node_modules/@actions/github/lib/github.js var lib_github = __nccwpck_require__(4005); +// EXTERNAL MODULE: ../../node_modules/systeminformation/lib/index.js +var lib = __nccwpck_require__(9042); // EXTERNAL MODULE: external "node:os" var external_node_os_ = __nccwpck_require__(612); // EXTERNAL MODULE: ../../node_modules/yaml/dist/index.js @@ -87652,6 +103618,7 @@ const constants_RESOLVED_COMPILER = (async () => { + async function composeCygwinCacheKeys() { const cygwinVersion = await getCygwinVersion(); const key = `${CACHE_PREFIX}-setup-ocaml-cygwin-${cygwinVersion}`; @@ -87659,36 +103626,34 @@ async function composeCygwinCacheKeys() { return { key, restoreKeys }; } async function composeDuneCacheKeys() { - const platform = constants_PLATFORM.replaceAll(/\W/g, "_"); - const architecture = constants_ARCHITECTURE.replaceAll(/\W/g, "_"); const { workflow, job } = lib_github.context; const ocamlCompiler = await constants_RESOLVED_COMPILER; - const sha256 = external_node_crypto_namespaceObject.createHash("sha256"); - const hash = sha256 - .update([architecture, job, ocamlCompiler, platform, workflow].join("")) - .digest("hex"); + const plainKey = [constants_PLATFORM, constants_ARCHITECTURE, ocamlCompiler, workflow, job].join(","); + const hash = external_node_crypto_namespaceObject.createHash("sha256").update(plainKey).digest("hex"); const key = `${constants_CACHE_PREFIX}-setup-ocaml-dune-${hash}`; const restoreKeys = [key]; + lib_core.debug(`dune cache key: ${plainKey}`); return { key, restoreKeys }; } async function composeOpamCacheKeys() { const { version: opamVersion } = await getLatestOpamRelease(); const sandbox = OPAM_DISABLE_SANDBOXING ? "nosandbox" : "sandbox"; const ocamlCompiler = await RESOLVED_COMPILER; - const repositories = OPAM_REPOSITORIES.map(([_, value]) => value).join(""); - const sha256 = crypto.createHash("sha256"); - const hash = sha256 - .update([ + const repositoryUrls = OPAM_REPOSITORIES.map(([_, value]) => value).join(","); + const osInfo = await system.osInfo(); + const plainKey = [ + PLATFORM, + osInfo.release, ARCHITECTURE, - ocamlCompiler, opamVersion, - PLATFORM, - repositories, + ocamlCompiler, + repositoryUrls, sandbox, - ].join("")) - .digest("hex"); + ].join(","); + const hash = crypto.createHash("sha256").update(plainKey).digest("hex"); const key = `${CACHE_PREFIX}-setup-ocaml-opam-${hash}`; const restoreKeys = [key]; + core.debug(`opam cache key: ${plainKey}`); return { key, restoreKeys }; } function composeCygwinCachePaths() { diff --git a/packages/setup-ocaml/package.json b/packages/setup-ocaml/package.json index 1f5f7903..4875b456 100644 --- a/packages/setup-ocaml/package.json +++ b/packages/setup-ocaml/package.json @@ -20,6 +20,7 @@ "@actions/tool-cache": "2.0.1", "cheerio": "1.0.0-rc.12", "semver": "7.6.3", + "systeminformation": "5.23.3", "yaml": "2.5.0" }, "devDependencies": { diff --git a/packages/setup-ocaml/src/cache.ts b/packages/setup-ocaml/src/cache.ts index 754ce41a..58dfa223 100644 --- a/packages/setup-ocaml/src/cache.ts +++ b/packages/setup-ocaml/src/cache.ts @@ -5,6 +5,7 @@ import * as cache from "@actions/cache"; import * as core from "@actions/core"; import { exec } from "@actions/exec"; import * as github from "@actions/github"; +import * as system from "systeminformation"; import { ARCHITECTURE, CACHE_PREFIX, @@ -28,16 +29,15 @@ async function composeCygwinCacheKeys() { } async function composeDuneCacheKeys() { - const platform = PLATFORM.replaceAll(/\W/g, "_"); - const architecture = ARCHITECTURE.replaceAll(/\W/g, "_"); const { workflow, job } = github.context; const ocamlCompiler = await RESOLVED_COMPILER; - const sha256 = crypto.createHash("sha256"); - const hash = sha256 - .update([architecture, job, ocamlCompiler, platform, workflow].join("")) - .digest("hex"); + const plainKey = [PLATFORM, ARCHITECTURE, ocamlCompiler, workflow, job].join( + ",", + ); + const hash = crypto.createHash("sha256").update(plainKey).digest("hex"); const key = `${CACHE_PREFIX}-setup-ocaml-dune-${hash}`; const restoreKeys = [key]; + core.debug(`dune cache key: ${plainKey}`); return { key, restoreKeys }; } @@ -45,22 +45,21 @@ async function composeOpamCacheKeys() { const { version: opamVersion } = await getLatestOpamRelease(); const sandbox = OPAM_DISABLE_SANDBOXING ? "nosandbox" : "sandbox"; const ocamlCompiler = await RESOLVED_COMPILER; - const repositories = OPAM_REPOSITORIES.map(([_, value]) => value).join(""); - const sha256 = crypto.createHash("sha256"); - const hash = sha256 - .update( - [ - ARCHITECTURE, - ocamlCompiler, - opamVersion, - PLATFORM, - repositories, - sandbox, - ].join(""), - ) - .digest("hex"); + const repositoryUrls = OPAM_REPOSITORIES.map(([_, value]) => value).join(","); + const osInfo = await system.osInfo(); + const plainKey = [ + PLATFORM, + osInfo.release, + ARCHITECTURE, + opamVersion, + ocamlCompiler, + repositoryUrls, + sandbox, + ].join(","); + const hash = crypto.createHash("sha256").update(plainKey).digest("hex"); const key = `${CACHE_PREFIX}-setup-ocaml-opam-${hash}`; const restoreKeys = [key]; + core.debug(`opam cache key: ${plainKey}`); return { key, restoreKeys }; } diff --git a/yarn.lock b/yarn.lock index 21323a31..bc41eb78 100644 --- a/yarn.lock +++ b/yarn.lock @@ -499,6 +499,7 @@ __metadata: "@vercel/ncc": "npm:0.38.1" cheerio: "npm:1.0.0-rc.12" semver: "npm:7.6.3" + systeminformation: "npm:5.23.3" typescript: "npm:5.5.4" yaml: "npm:2.5.0" languageName: unknown @@ -1715,6 +1716,16 @@ __metadata: languageName: node linkType: hard +"systeminformation@npm:5.23.3": + version: 5.23.3 + resolution: "systeminformation@npm:5.23.3" + bin: + systeminformation: lib/cli.js + checksum: 10c0/9f0bce29fca815e30756fb93ed4e89afaea95ebdb571540390f5648058a1211792398ff19974466aae5407cf34d5534e4b783b745abb490a7fcdf561f647c1f0 + conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android) + languageName: node + linkType: hard + "tar@npm:^6.1.11, tar@npm:^6.2.1": version: 6.2.1 resolution: "tar@npm:6.2.1"