{ "version": 3, "sources": ["index.js", "lib/globals.js", "lib/is-electron.js", "lib/is-browser.js", "lib/get-browser.js", "utils/assert.js"], "sourcesContent": ["// Extract injected version from package.json (injected by babel plugin)\n// @ts-expect-error\nexport const VERSION = typeof \"4.0.7\" !== 'undefined' ? \"4.0.7\" : 'untranspiled source';\n// ENVIRONMENT\nexport { self, window, global, document, process, console } from \"./lib/globals.js\";\nexport { isBrowser } from \"./lib/is-browser.js\";\nexport { getBrowser, isMobile } from \"./lib/get-browser.js\";\nexport { isElectron } from \"./lib/is-electron.js\";\n// ENVIRONMENT'S ASSERT IS 5-15KB, SO WE PROVIDE OUR OWN\nexport { assert } from \"./utils/assert.js\";\n// TODO - wish we could just export a constant\n// export const isBrowser = checkIfBrowser();\n", "// Do not name these variables the same as the global objects - will break bundling\nconst global_ = globalThis;\nconst window_ = globalThis;\nconst document_ = globalThis.document || {};\nconst process_ = globalThis.process || {};\nconst console_ = globalThis.console;\nconst navigator_ = globalThis.navigator || {};\nexport { global_ as global, global_ as self, window_ as window, document_ as document, process_ as process, console_ as console, navigator_ as navigator };\n", "// based on https://github.com/cheton/is-electron\n// https://github.com/electron/electron/issues/2288\n/* eslint-disable complexity */\nexport function isElectron(mockUserAgent) {\n // Renderer process\n // @ts-expect-error\n if (typeof window !== 'undefined' && window.process?.type === 'renderer') {\n return true;\n }\n // Main process\n // eslint-disable-next-line\n if (typeof process !== 'undefined' && Boolean(process.versions?.['electron'])) {\n return true;\n }\n // Detect the user agent when the `nodeIntegration` option is set to true\n const realUserAgent = typeof navigator !== 'undefined' && navigator.userAgent;\n const userAgent = mockUserAgent || realUserAgent;\n return Boolean(userAgent && userAgent.indexOf('Electron') >= 0);\n}\n", "// This function is needed in initialization stages,\n// make sure it can be imported in isolation\nimport { isElectron } from \"./is-electron.js\";\n/** Check if in browser by duck-typing Node context */\nexport function isBrowser() {\n const isNode = \n // @ts-expect-error\n typeof process === 'object' && String(process) === '[object process]' && !process?.browser;\n return !isNode || isElectron();\n}\n", "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n// This function is needed in initialization stages,\n// make sure it can be imported in isolation\nimport { isBrowser } from \"./is-browser.js\";\nimport { isElectron } from \"./is-electron.js\";\nimport { navigator } from \"./globals.js\";\nexport function isMobile() {\n return typeof globalThis.orientation !== 'undefined';\n}\n// Simple browser detection\n// `mockUserAgent` parameter allows user agent to be overridden for testing\n/* eslint-disable complexity */\nexport function getBrowser(mockUserAgent) {\n if (!mockUserAgent && !isBrowser()) {\n return 'Node';\n }\n if (isElectron(mockUserAgent)) {\n return 'Electron';\n }\n const userAgent = mockUserAgent || navigator.userAgent || '';\n // NOTE: Order of tests matter, as many agents list Chrome etc.\n if (userAgent.indexOf('Edge') > -1) {\n return 'Edge';\n }\n if (globalThis.chrome) {\n return 'Chrome';\n }\n if (globalThis.safari) {\n return 'Safari';\n }\n if (globalThis.mozInnerScreenX) {\n return 'Firefox';\n }\n return 'Unknown';\n}\n", "export function assert(condition, message) {\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