// Metro module 1180 (f1181). import { DEFAULT_BUFFER_SIZE, makeNativeTransportFactory } from "./makeNativeTransport"; import { isRunningInMetroDevServer, getDefaultEnvironment, isExpoGo, isWeb } from "./Module1002"; import { NATIVE } from "./Module1001"; import { useEncodePolyfill } from "./globalEncodeFactory"; import { enableSyncToNative } from "./Module1182"; import * as _Module817 from "./Module817"; import { getGlobalScope, getIsolationScope, makeDsn, debug, stackParserFromStackParserOptions, getIntegrationsToSetup, initAndBind, getClient } from "./Module817"; import { safeFactory, safeTracesSampler } from "./Module1183"; import { getDevServer } from "./getDevServer"; import { getDefaultRelease } from "./Module1184"; import { shouldEnableNativeNagger } from "./Module1185"; import * as _Module1135 from "./Module1135"; import { makeFetchTransport, defaultStackParser } from "./Module1135"; import { getDefaultIntegrations } from "./Module1186"; import { ReactNativeClient } from "./ReactNativeClient"; import { ReactNativeProfiler } from "./Module1187"; import { TouchEventBoundary } from "./TouchEventBoundary"; import { FeedbackWidgetProvider } from "./FeedbackWidgetProvider"; function $mk117654($env) { return function(a0) { a0($env[0]); }; } let c983_4; let c983_3 = (this ? this.__awaiter : this) || function(c12881_0, c12881_1, a2, c12881_3) { let r2 = a2; let Promise2 = a2; if (!a2) { Promise2 = Promise; r2 = Promise2; } return new r2(function(a0, c24283_1) { let rejected2, step2; let c24283_0 = a0; const fulfilled2 = function fulfilled(a0) { try { step2(c12881_3.next(a0)); } catch ($e) { c24283_1($e); } }; rejected2 = function rejected(a0) { try { step2(c12881_3.throw(a0)); } catch ($e) { c24283_1($e); } }; step2 = function step(a0) { if (a0.done) { c24283_0(a0.value); } else { let env28852; let value = a0.value; const r10 = env28852 = {}; env28852[0] = value; if (!(value instanceof Promise2)) { value = new Promise2($mk117654(r10)); } value.then(fulfilled2, rejected2); } }; const r16 = c12881_3.apply(c12881_0, c12881_1 || []); c12881_3 = r16; const r18 = r16.next(); const { done, value } = r18; if (done) { a0(value); } else { let env24284; const r21 = env24284 = {}; env24284[0] = value; (value instanceof Promise2 ? value : new Promise2($mk117654(r21))).then(fulfilled2, rejected2); } }); }; c983_4 = { enableNativeCrashHandling: true, enableNativeNagger: true, autoInitializeNativeSdk: true, enableAutoPerformanceTracing: true, enableWatchdogTerminationTracking: true, patchGlobalPromise: true, sendClientReports: true, maxQueueSize: DEFAULT_BUFFER_SIZE, attachStacktrace: true, enableCaptureFailedRequests: false, enableNdk: true, enableAppStartTracking: true, enableNativeFramesTracking: true, enableStallTracking: true, enableUserInteractionTracing: false, propagateTraceparent: false }; export function init(a0) { if (!isRunningInMetroDevServer()) { let maxQueueSize = a0.maxQueueSize; if (!(maxQueueSize !== null && maxQueueSize !== void 0)) { const transportOptions = a0.transportOptions; maxQueueSize = transportOptions !== null ? transportOptions !== void 0 ? transportOptions.bufferSize : void 0 : void 0; } if (!(maxQueueSize !== null && maxQueueSize !== void 0)) { maxQueueSize = c983_4.maxQueueSize; } const r1 = a0.enableNative !== void 0 && !a0.enableNative; const enableNative = r1 ? !r1 : NATIVE.isNativeAvailable(); useEncodePolyfill(); if (enableNative) { enableSyncToNative(getGlobalScope()); enableSyncToNative(getIsolationScope()); } let c12882_0 = safeFactory(a0.beforeBreadcrumb, { loggerMessage: "The beforeBreadcrumb threw an error" }); const devServer = getDevServer(); const url = devServer !== null ? devServer !== void 0 ? devServer.url : void 0 : void 0; const dsn = a0.dsn; let r66 = void 0; if (dsn) { const r70 = makeDsn(dsn); if (r70) { r66 = `${r70.protocol}://${r70.host}${r70.port ? `:${r70.port}` : ""}`; } else { debug.error("Failed to extract url from DSN: ", dsn); r66 = void 0; } } let c12882_2 = r66; const r87 = Object; const r95 = { ...c983_4, ...a0 }; let release = a0.release; if (!(release !== null && release !== void 0)) { release = getDefaultRelease(); } const r100 = { release, enableNative, enableNativeNagger: shouldEnableNativeNagger(a0.enableNativeNagger), transport: a0.transport || makeNativeTransportFactory({ enableNative }) || makeFetchTransport, transportOptions: null, maxQueueSize: null, integrations: null, stackParser: null, beforeBreadcrumb: null, initialScope: null }; const r112 = Object; const r114 = Object; const r119 = { ...c983_4.transportOptions }; let transportOptions2 = a0.transportOptions; if (!(transportOptions2 !== null && transportOptions2 !== void 0)) { transportOptions2 = {}; } r100.transportOptions = r112.assign(r114.assign(r119, transportOptions2), { bufferSize: maxQueueSize }); r100.maxQueueSize = maxQueueSize; r100.integrations = []; r100.stackParser = stackParserFromStackParserOptions(a0.stackParser || defaultStackParser); r100.beforeBreadcrumb = (a0, a1) => { let r18; let r4 = a0; if (c12882_0) { r4 = c12882_0(a0, a1); if (r4 === null) { return null; } } const r9 = r4.type || ""; const data = r4.data; const r12 = typeof (data !== null ? data !== void 0 ? data.url : void 0 : void 0) === "string" ? r4.data.url : ""; L15: { if (r9 === "http") { if (url) { const r17 = r12.startsWith(url); r18 = null; if (r17) { break L15; } } if (c12882_2) { const r21 = r12.startsWith(c12882_2); r18 = null; if (r21) { break L15; } } } r18 = r4; } return r18; }; r100.initialScope = safeFactory(a0.initialScope, { loggerMessage: "The initialScope threw an error" }); const r139 = r87.assign(r95, r100); if ("tracesSampler" in r139) { r139.tracesSampler = safeTracesSampler(r139.tracesSampler); } if (!("environment" in r139)) { r139.environment = getDefaultEnvironment(); } const defaultIntegrations = a0.defaultIntegrations === void 0 ? getDefaultIntegrations(r139) : a0.defaultIntegrations; r139.integrations = getIntegrationsToSetup({ integrations: safeFactory(a0.integrations, { loggerMessage: "The integrations threw an error" }), defaultIntegrations }); initAndBind(ReactNativeClient, r139); if (isExpoGo()) { debug.log("Offline caching, native errors features are not available in Expo Go."); debug.log("Use EAS Build / Native Release Build to test these features."); } } } export function wrap(a0, a1) { let Component = a0; const r8 = Object; const r13 = { ...a1?.profilerProps }; const displayName = a0.displayName; let c12883_2 = r8.assign(r13, { name: displayName !== null ? displayName !== void 0 ? displayName : "Root" : "Root", updateProps: {} }); const Profiler = isWeb() ? _Module1135.Profiler : ReactNativeProfiler; return (a0) => { const r10 = Object; let r8 = a1?.touchEventBoundaryProps; if (!(r8 !== null && r8 !== void 0)) { r8 = {}; } return ; }; } export function nativeCrash() { NATIVE.nativeCrash(); } export async function flush() { let r45; let c24285_3 = 0; L13: { try { c24285_3 = 1; const client = getClient(); if (client) { r45 = await client.flush(); c24285_3 = 0; break L13; } c24285_3 = 0; debug.error("Failed to flush the event queue."); } catch ($e) { let r8 = $e; if (c24285_3 !== 0) { while (true) { try { c24285_3 = 0; debug.error("Failed to flush the event queue."); } catch ($e) { r8 = $e; if (c24285_3 === 0) { break; } continue; } return false; } } throw r8; } return false; } return r45; } export async function close() { let c24286_3 = 0; L14: { try { c24286_3 = 1; const client = getClient(); if (client) { await client.close(); c24286_3 = 0; break L14; } c24286_3 = 0; } catch ($e) { let r8 = $e; if (c24286_3 !== 0) { while (true) { try { c24286_3 = 0; debug.error("Failed to close the SDK"); break L14; } catch ($e) { r8 = $e; if (c24286_3 === 0) { break; } } } } throw r8; } return void 0; } } export function withScope(c12884_0) { return _Module817.withScope((a0) => { let r5; try { r5 = c12884_0(a0); } catch ($e) { debug.error("Error while running withScope callback", $e); return void 0; } return r5; }); } export async function crashedLastRun() { return NATIVE.crashedLastRun(); }