2026-07-29 08:29:29 +00:00
// Module ID: 834
// Function ID: 835
// Name: regExp
// Dependencies: [835, 829, 831, 836, 837, 824]
// Module 834 (regExp)
2026-08-24 06:08:38 +00:00
import generateSpanId from "generateSpanId" /* 829 */ ;
import baggageHeaderToDynamicSamplingContext from "baggageHeaderToDynamicSamplingContext" /* 835 */ ;
import dsnFromString from "dsnFromString" /* 837 */ ;
require = arg1 ;
2026-07-29 08:29:29 +00:00
const dependencyMap = arg6 ;
Object . defineProperty ( arg5 , Symbol . toStringTag , { value : "Module" } ) ;
const regExp = new RegExp ( "^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$" ) ;
arg5 . TRACEPARENT _REGEXP = regExp ;
arg5 . extractTraceparentData = function extractTraceparentData ( str ) {
if ( str ) {
const match = str . match ( regExp ) ;
if ( match ) {
let flag = true ;
if ( "1" !== match [ 3 ] ) {
if ( "0" === match [ 3 ] ) {
flag = false ;
}
}
const obj = { traceId : null , parentSampled : null , parentSpanId : null } ;
obj [ 0 ] = match [ 1 ] ;
obj [ 1 ] = flag ;
obj [ 2 ] = match [ 2 ] ;
return obj ;
}
}
} ;
arg5 . generateSentryTraceHeader = function generateSentryTraceHeader ( ) {
let traceId = arg0 ;
if ( arg0 === undefined ) {
2026-08-24 06:08:38 +00:00
traceId = generateSpanId . generateTraceId ( ) ;
const obj = generateSpanId ;
2026-07-29 08:29:29 +00:00
}
let spanId = arg1 ;
if ( arg1 === undefined ) {
2026-08-24 06:08:38 +00:00
spanId = generateSpanId . generateSpanId ( ) ;
const obj2 = generateSpanId ;
2026-07-29 08:29:29 +00:00
}
let str = "" ;
if ( undefined !== arg2 ) {
let str2 = "-0" ;
if ( arg2 ) {
str2 = "-1" ;
}
str = str2 ;
}
return "" + traceId + "-" + spanId + str ;
} ;
arg5 . generateTraceparentHeader = function generateTraceparentHeader ( traceId , propagationSpanId2 , sampled2 ) {
if ( traceId === undefined ) {
2026-08-24 06:08:38 +00:00
traceId = generateSpanId . generateTraceId ( ) ;
const obj = generateSpanId ;
2026-07-29 08:29:29 +00:00
}
let spanId = propagationSpanId2 ;
if ( propagationSpanId2 === undefined ) {
2026-08-24 06:08:38 +00:00
spanId = generateSpanId . generateSpanId ( ) ;
const obj2 = generateSpanId ;
2026-07-29 08:29:29 +00:00
}
let str = "00" ;
if ( sampled2 ) {
str = "01" ;
}
return "00-" + traceId + "-" + spanId + "-" + str ;
} ;
arg5 . propagationContextFromHeaders = function propagationContextFromHeaders ( str ) {
let tmp ;
if ( str ) {
const match = str . match ( regExp ) ;
if ( match ) {
let flag = true ;
if ( "1" !== match [ 3 ] ) {
if ( "0" === match [ 3 ] ) {
flag = false ;
}
}
let obj = { traceId : null , parentSampled : null , parentSpanId : null } ;
obj [ 0 ] = match [ 1 ] ;
obj [ 1 ] = flag ;
obj [ 2 ] = match [ 2 ] ;
tmp = obj ;
}
}
2026-08-24 06:08:38 +00:00
let result = baggageHeaderToDynamicSamplingContext . baggageHeaderToDynamicSamplingContext ( arg1 ) ;
2026-07-29 08:29:29 +00:00
let traceId ;
if ( tmp != null ) {
traceId = tmp . traceId ;
}
if ( traceId ) {
let tmp4Result = tmp4 ( 836 ) ;
let sample _rand ;
if ( result != null ) {
sample _rand = result . sample _rand ;
}
const str3 = tmp4Result . parseSampleRate ( sample _rand ) ;
if ( undefined !== str3 ) {
if ( result ) {
result . sample _rand = str3 . toString ( ) ;
}
obj = { traceId : null , parentSpanId : null , sampled : null , dsc : null , sampleRand : null } ;
( { traceId : obj10 [ 0 ] , parentSpanId : obj10 [ 1 ] , parentSampled : obj10 [ 2 ] } = tmp ) ;
if ( ! result ) {
result = { } ;
}
obj [ 3 ] = result ;
obj [ 4 ] = str3 ;
return obj ;
} else {
tmp4Result = tmp4 ( 836 ) ;
let sample _rate ;
if ( result != null ) {
sample _rate = result . sample _rate ;
}
const parseSampleRateResult = tmp4Result . parseSampleRate ( sample _rate ) ;
if ( ! parseSampleRateResult ) {
tmp4 ( 831 ) . safeMathRandom ( ) ;
const tmp4Result1 = tmp4 ( 831 ) ;
} else {
let parentSampled ;
if ( tmp != null ) {
parentSampled = tmp . parentSampled ;
}
}
const safeMathRandomResult1 = tmp4 ( 831 ) . safeMathRandom ( ) ;
if ( tmp . parentSampled ) {
let result1 = safeMathRandomResult1 * parseSampleRateResult ;
} else {
result1 = parseSampleRateResult + safeMathRandomResult1 * ( 1 - parseSampleRateResult ) ;
}
const tmp4Result2 = tmp4 ( 831 ) ;
}
} else {
obj = { traceId : null , sampleRand : null } ;
obj [ 0 ] = tmp4 ( 829 ) . generateTraceId ( ) ;
const tmp4Result3 = tmp4 ( 829 ) ;
obj [ 1 ] = tmp4 ( 831 ) . safeMathRandom ( ) ;
return obj ;
}
} ;
arg5 . shouldContinueTrace = function shouldContinueTrace ( client , org _id ) {
2026-08-24 06:08:38 +00:00
const result = dsnFromString . extractOrgIdFromClient ( client ) ;
2026-07-29 08:29:29 +00:00
if ( org _id ) {
if ( result ) {
if ( org _id !== result ) {
const debug2 = tmp ( 824 ) . debug ;
const _HermesInternal2 = HermesInternal ;
debug2 . log ( "Won't continue trace because org IDs don't match (incoming baggage: " + org _id + ", SDK options: " + result + ")" ) ;
let flag = false ;
}
return flag ;
}
}
const tmp4 = client . getOptions ( ) . strictTraceContinuation || false ;
flag = ! tmp4 ;
if ( tmp4 ) {
let tmp5 = org _id ;
if ( org _id ) {
tmp5 = ! result ;
}
if ( ! tmp5 ) {
let tmp6 = ! org _id ;
if ( ! org _id ) {
tmp6 = result ;
}
tmp5 = tmp6 ;
}
flag = ! tmp5 ;
}
if ( ! flag ) {
const debug = tmp ( 824 ) . debug ;
const _HermesInternal = HermesInternal ;
debug . log ( "Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: " + org _id + ", Sentry client: " + result + ")" ) ;
flag = false ;
}
} ;