// Metro module 893 (f894). import { isError, isParameterizedString, isPlainObject, isErrorEvent } from "./isInstanceOf"; import { extractExceptionKeysForMessage } from "./addNonEnumerableProperty"; import { normalizeToSize } from "./normalize"; import { addExceptionMechanism, addExceptionTypeValue } from "./Module830"; const exceptionFromError = function exceptionFromError(a0, a1) { const type = a1.name || a1.constructor.name; const r23 = isError(a1) && "__sentry_fetch_url_host__" in a1 && typeof a1.__sentry_fetch_url_host__ === "string"; const message = a1.message; const r17 = { type, value: r23 ? `${message} (${a1.__sentry_fetch_url_host__})` : message }; const frames = a0(a1.stack || "", 1); if (frames.length) { r17.stacktrace = { frames }; } return r17; }; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); export function _enhanceErrorWithSentryInfo(a0) { const r17 = isError(a0) && "__sentry_fetch_url_host__" in a0 && typeof a0.__sentry_fetch_url_host__ === "string"; const message = a0.message; return r17 ? `${message} (${a0.__sentry_fetch_url_host__})` : message; } export function eventFromMessage(a0, a1, level = "info", r7) { const event_id = r7?.event_id; const r8 = arguments[4]; const r4 = { event_id, level }; if (r8 && r7?.syntheticException) { const frames = a0(r7.syntheticException.stack || "", 1); if (frames.length) { r4.exception = { values: [{ value: a1, stacktrace: { frames } }] }; addExceptionMechanism(r4, { synthetic: true }); } } if (isParameterizedString(a1)) { r4.logentry = { message: a1.__sentry_template_string__, params: a1.__sentry_template_values__ }; return r4; } r4.message = a1; return r4; } export function eventFromUnknownInput(a0, a1, a2, a3) { let r43, message; const r10 = a3?.data && a3.data.mechanism || { handled: true, type: "generic" }; if (isError(a2)) { r43 = [a2, void 0]; } else { r10.synthetic = true; if (isPlainObject(a2)) { const r52 = { __serialized__: normalizeToSize(a2, a0 == null ? void 0 : a0.getOptions().normalizeDepth) }; let r55 = void 0; for (const key in a2) { r55 = void 0; if (Object.prototype.hasOwnProperty.call(a2, key)) { const r60 = a2[key]; const r62 = r60 instanceof Error; r55 = r60; if (r62) { break; } } } r55 = void 0; if (r55) { r43 = [r55, r52]; } else { if ("name" in a2 && typeof a2.name === "string") { const r100 = `'${a2.name}' captured as exception`; message = "message" in a2 && typeof a2.message === "string" ? r100 + ` with message '${a2.message}'` : r100; } else if ("message" in a2 && typeof a2.message === "string") { message = a2.message; } else { const r74 = extractExceptionKeysForMessage(a2); if (isErrorEvent(a2)) { message = `Event \`ErrorEvent\` captured as exception with message \`${a2.message}\``; } else { const r80 = (function getObjectClassName(a0) { let r8; try { const prototypeOf = Object.getPrototypeOf(a0); r8 = prototypeOf ? prototypeOf.constructor.name : void 0; } catch ($e) { return void 0; } return r8; })(a2); message = `${r80 ? r80 !== "Object" ? `'${r80}'` : "Object" : "Object"} captured as exception with keys: ${r74}`; } } const r111 = a3?.syntheticException || new Error(message); r111.message = message; r43 = [r111, r52]; } } else { const r34 = a3?.syntheticException || new Error(a2); r34.message = `${a2}`; r43 = [r34, void 0]; } } const [r124, extra] = r43; const r130 = { exception: { values: [exceptionFromError(a1, r124)] } }; if (extra) { r130.extra = extra; } addExceptionTypeValue(r130, void 0, void 0); addExceptionMechanism(r130, r10); return { ...r130, event_id: a3?.event_id }; } export { exceptionFromError }; export function parseStackFrames(a0, a1) { return a0(a1.stack || "", 1); }