'use strict';

var require$$5 = require('node:module');
var logger = require('../external/@socketsecurity/registry/lib/logger');
var constants = require('./constants.js');

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.

if (constants.default.ENV.INLINED_SOCKET_CLI_SENTRY_BUILD) {
  const require$1 = require$$5.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('instrument-with-sentry.js', document.baseURI).href)));
  const Sentry = /*@__PURE__*/require$1('@sentry/node');
  Sentry.init({
    onFatalError(error) {
      // Defer module loads until after Sentry.init is called.
      if (constants.default.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', constants.default.ENV.INLINED_SOCKET_CLI_PUBLISHED_BUILD ? 'pub' : constants.default.ENV.NODE_ENV);
  Sentry.setTag('version', constants.default.ENV.INLINED_SOCKET_CLI_VERSION_HASH);
  if (constants.default.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.default;
  setSentry(Sentry);
} else if (constants.default.ENV.SOCKET_CLI_DEBUG) {
  logger.logger.info('[DEBUG] Sentry disabled explicitly.');
}
//# debugId=8db796aa-e819-4fc9-a6ac-9ca028014859
//# sourceMappingURL=instrument-with-sentry.js.map
