'use strict'

const logger = require('./@socketsecurity/registry/lib/logger')

// This should ONLY be included in the special Sentry build!
// Otherwise the Sentry dependency won't even be present in the manifest.

// Require constants with require(relConstantsPath) instead of require('./constants')
// so Rollup doesn't generate a constants2.js chunk.
const relConstantsPath = './constants'
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']".
{
  const Sentry = require('@sentry/node')
  Sentry.init({
    onFatalError(error) {
      // Defer module loads until after Sentry.init is called.
      if (require(relConstantsPath).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',
    // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']".
    'pub'
  )
  Sentry.setTag(
    'version',
    // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
    '0.14.144:e577de2:37d9efbe:pub'
  )
  const constants = require(relConstantsPath)
  if (constants.ENV.SOCKET_CLI_DEBUG) {
    Sentry.setTag('debugging', true)
    logger.logger.log('[DEBUG] Set up Sentry.')
  } else {
    Sentry.setTag('debugging', false)
  }
  const {
    kInternalsSymbol,
    [kInternalsSymbol]: { setSentry }
  } = constants
  setSentry(Sentry)
}
//# debugId=9772fccd-86f3-4314-b994-ba882b9e1c70
//# sourceMappingURL=instrument-with-sentry.js.map
