// Metro module 1156 (f1157). import { uuid4, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, dropUndefinedKeys, timestampInSeconds, spanToJSON, setMeasurement, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, getSpanDescendants, debug } from "./Module817"; import { RN_GLOBAL_OBJ } from "./Module816"; let c962_2; const createSpanJSON = function createSpanJSON(a0) { const r7 = Object; const r20 = { status: "ok", ...a0 }; const span_id = a0.span_id ? a0.span_id : uuid4().substring(16); const trace_id = a0.trace_id ? a0.trace_id : uuid4(); const r13 = Object; const r36 = {}; r36[SEMANTIC_ATTRIBUTE_SENTRY_OP] = a0.op; r36[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = a0.origin; return dropUndefinedKeys(r7.assign(r20, { span_id, trace_id, data: dropUndefinedKeys(r13.assign(r36, a0.data ? a0.data : {})) })); }; c962_2 = Date.now(); export const defaultTransactionSource = "component"; export const customTransactionSource = "custom"; export const MARGIN_OF_ERROR_SECONDS = 0.05; export function getTimeOriginMilliseconds() { return c962_2; } export function isNearToNow(a0) { return !!a0 && Math.abs(timestampInSeconds() - a0) <= 0.05; } export function setSpanDurationAsMeasurement(a0, a1) { const r9 = spanToJSON(a1); const { timestamp, start_timestamp } = r9; if (timestamp && start_timestamp) { setMeasurement(a0, 1000 * (timestamp - start_timestamp), "millisecond"); } } export function setSpanDurationAsMeasurementOnSpan(a0, a1, a2) { const r11 = spanToJSON(a1); const { timestamp, start_timestamp } = r11; if (timestamp && start_timestamp) { const r17 = 1000 * (timestamp - start_timestamp); const addEvent = a2.addEvent; const r19 = {}; r19[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE] = r17; r19[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT] = "millisecond"; addEvent.call(a2, a0, r19); } } export function setSpanMeasurement(a0, a1, a2, a3) { const addEvent = a0.addEvent; const r2 = {}; r2[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE] = a2; r2[SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT] = a3; addEvent.call(a0, a1, r2); } export function getLatestChildSpanEndTimestamp(a0) { const r6 = getSpanDescendants(a0).map((item) => spanToJSON(item).timestamp).filter((item) => !!item); const length = r6.length; let r20 = void 0; if (length) { const r22 = Math; r20 = r22.max.apply(r22, [...r6]); } return r20; } export function getBundleStartTimestampMs() { const __BUNDLE_START_TIME__ = RN_GLOBAL_OBJ.__BUNDLE_START_TIME__; if (__BUNDLE_START_TIME__) { return RN_GLOBAL_OBJ.nativePerformanceNow ? Date.now() - RN_GLOBAL_OBJ.nativePerformanceNow() + __BUNDLE_START_TIME__ : __BUNDLE_START_TIME__; } debug.warn("Missing the bundle start time on the global object."); } export { createSpanJSON }; export function createChildSpanJSON(a0, a1) { return createSpanJSON({ op: a0.op, trace_id: a0.trace_id, parent_span_id: a0.span_id, origin: a0.origin || "manual", ...a1 }); }