1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isReactNativeBrowser = exports.isWebWorker = void 0;
|
4 | const isStandardBrowserEnv = () => {
|
5 | var _a;
|
6 | if (typeof window !== 'undefined') {
|
7 | const electronRenderCheck = typeof navigator !== 'undefined' &&
|
8 | ((_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(' electron/')) > -1;
|
9 | if (electronRenderCheck && (process === null || process === void 0 ? void 0 : process.versions)) {
|
10 | const electronMainCheck = Object.prototype.hasOwnProperty.call(process.versions, 'electron');
|
11 | return !electronMainCheck;
|
12 | }
|
13 | return typeof window.document !== 'undefined';
|
14 | }
|
15 | return false;
|
16 | };
|
17 | const isWebWorkerEnv = () => {
|
18 | var _a, _b;
|
19 | return Boolean(typeof self === 'object' &&
|
20 | ((_b = (_a = self === null || self === void 0 ? void 0 : self.constructor) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes('WorkerGlobalScope')));
|
21 | };
|
22 | const isReactNativeEnv = () => typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
|
23 | const isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
|
24 | exports.isWebWorker = isWebWorkerEnv();
|
25 | exports.isReactNativeBrowser = isReactNativeEnv();
|
26 | exports.default = isBrowser;
|
27 |
|
\ | No newline at end of file |