import * as Sentry from '@sentry/react-router';

Sentry.init({
  dsn: "https://1a366de494f1acf8fc94a4c592807b10@o1356837.ingest.us.sentry.io/4511024367861760",
  enabled: process.env.NODE_ENV === "production",
  sendDefaultPii: true,
  tracesSampleRate: 0,
  ignoreErrors: [
    /No route matches URL ".*\.css"/,
    /No route matches URL ".*\.js"/,
    /No route matches URL ".*\.(php|env|xml|aspx|asp|bak|sql|ini)"/i,
    /No route matches URL ".*\/(wp-admin|wp-login|phpmyadmin|xmlrpc)"/i,
  ],
  beforeSend(event) {
    const msg = event.exception?.values?.[0]?.value ?? "";
    // Drop React Flight protocol probe errors (e.g. $1:aa:aa in multipart body)
    if (/\$\d+:[a-z]/.test(msg)) return null;
    return event;
  },
});
