'use strict';

var Module = require('node:module');
var logger = require('../external/@socketsecurity/registry/lib/logger');

var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
// This should ONLY be included in the special Sentry build!
// Otherwise the Sentry dependency won't even be present in the manifest.

const require$1 =Module.createRequire(require('u' + 'rl').pathToFileURL(__filename).href)

// Require constants with require(relConstantsPath) instead of require('./constants')
// so Rollup doesn't generate a constants2.js chunk.
const relConstantsPath = './constants';
const constants = require$1(relConstantsPath);

// Lazily access constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD.
if (constants.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD) {
  const Sentry = require$1('@sentry/node');
  Sentry.init({
    onFatalError(error) {
      // Defer module loads until after Sentry.init is called.
      if (constants.ENV.SOCKET_CLI_DEBUG) {
        logger.logger.fail('[DEBUG] [Sentry onFatalError]:', error);
      }
    },
    dsn: 'https://66736701db8e4ffac046bd09fa6aaced@o555220.ingest.us.sentry.io/4508846967619585',
    enabled: true,
    integrations: []
  });
  Sentry.setTag('environment',
  // Lazily access constants.ENV.INLINED_SOCKET_CLI_PUBLISHED_BUILD.
  constants.ENV.INLINED_SOCKET_CLI_PUBLISHED_BUILD ? 'pub' :
  // Lazily access constants.ENV.NODE_ENV.
  constants.ENV.NODE_ENV);
  Sentry.setTag('version',
  // Lazily access constants.ENV.INLINED_SOCKET_CLI_VERSION_HASH.
  constants.ENV.INLINED_SOCKET_CLI_VERSION_HASH);
  // Lazily access constants.ENV.SOCKET_CLI_DEBUG.
  if (constants.ENV.SOCKET_CLI_DEBUG) {
    Sentry.setTag('debugging', true);
    logger.logger.info('[DEBUG] Set up Sentry.');
  } else {
    Sentry.setTag('debugging', false);
  }
  const {
    kInternalsSymbol,
    [kInternalsSymbol]: {
      setSentry
    }
  } = constants;
  setSentry(Sentry);
}
// Lazily access constants.ENV.SOCKET_CLI_DEBUG.
else if (constants.ENV.SOCKET_CLI_DEBUG) {
  logger.logger.info('[DEBUG] Sentry disabled explicitly.');
}
//# debugId=16cab898-cd6a-4850-811b-81c05fb7cac
//# sourceMappingURL=instrument-with-sentry.js.map
