import * as Sentry from '@sentry/react';
let initialized = false;
/** Initialize browser Sentry when a DSN is provided. Safe to call repeatedly. */
export function initAdminSentry(dsn) {
    if (initialized || !dsn?.trim())
        return;
    Sentry.init({
        dsn: dsn.trim(),
        environment: process.env.NODE_ENV ?? 'development',
        tracesSampleRate: 0,
    });
    initialized = true;
}
/** Report a React error boundary catch when Sentry is configured. Never throws. */
export function captureAdminException(error, context) {
    try {
        if (!initialized)
            return;
        Sentry.captureException(error, {
            contexts: context?.componentStack
                ? { react: { componentStack: context.componentStack } }
                : undefined,
        });
    }
    catch {
        // Observability must never break the admin UI.
    }
}
//# sourceMappingURL=sentry.js.map