import { BaseBackend } from '@sentry/core';
import { SentryError } from '@sentry/utils';
export var IPC = {
    /** IPC to ping the main process when initializing in the renderer. */
    PING: 'sentry-electron.ping',
    /** IPC to send a captured event (exception or message) to Sentry. */
    EVENT: 'sentry-electron.event',
    /** IPC to capture a scope globally. */
    SCOPE: 'sentry-electron.scope',
};
/** Get the name of an electron app for <v5 and v7< */
export function getNameFallback() {
    if (typeof require === 'undefined') {
        throw new SentryError('Could not require("electron") to get appName. Please ensure you pass `appName` to Sentry options');
    }
    var electron = require('electron');
    // if we're in the main process
    // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
    if (electron && electron.app) {
        // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
        var appMain = electron.app;
        return appMain.name || appMain.getName();
    }
    // We're in the renderer process but the remote module is not available
    // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
    if (!electron || !electron.remote) {
        throw new SentryError('The Electron `remote` module was not available to get appName. Please ensure you pass `appName` to Sentry options');
    }
    // Remote is available so get the app name
    // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
    var a = electron.remote.app;
    return a.name || a.getName();
}
/** Common interface for Electron backends. */
export { BaseBackend as CommonBackend };
//# sourceMappingURL=common.js.map