// Metro module 943 (f944). import { MCP_LOGGING_LEVEL_ATTRIBUTE, MCP_LOGGING_LOGGER_ATTRIBUTE, MCP_LOGGING_DATA_TYPE_ATTRIBUTE, MCP_LOGGING_MESSAGE_ATTRIBUTE, MCP_RESOURCE_URI_ATTRIBUTE, MCP_REQUEST_ID_ATTRIBUTE } from "./Module940"; import { parseStringToURLObject, isURLObjectRelative } from "./Module900"; import { extractTargetInfo, getRequestArguments } from "./Module942"; import { HermesBuiltin } from "../_hermes/prelude"; const getNotificationAttributes = function getNotificationAttributes(method, a1, a2) { const r4 = {}; if (method === "notifications/cancelled") { if (a1?.requestId) { r4["mcp.cancelled.request_id"] = String(a1.requestId); } if (a1?.reason) { r4["mcp.cancelled.reason"] = String(a1.reason); } } else if (method === "notifications/message") { if (a1?.level) { r4[MCP_LOGGING_LEVEL_ATTRIBUTE] = String(a1.level); } if (a1?.logger) { r4[MCP_LOGGING_LOGGER_ATTRIBUTE] = String(a1.logger); } if (a1?.data !== void 0) { r4[MCP_LOGGING_DATA_TYPE_ATTRIBUTE] = typeof a1.data; if (a2) { const data = a1.data; let r106 = data; if (typeof r106 !== "string") { r106 = JSON.stringify(data); } r4[MCP_LOGGING_MESSAGE_ATTRIBUTE] = r106; } } } else if (method === "notifications/progress") { if (a1?.progressToken) { r4["mcp.progress.token"] = String(a1.progressToken); } if (typeof a1?.progress === "number") { r4["mcp.progress.current"] = a1.progress; } if (typeof a1?.total === "number") { r4["mcp.progress.total"] = a1.total; if (typeof a1?.progress === "number") { r4["mcp.progress.percentage"] = a1.progress / a1.total * 100; } } if (a1?.message) { r4["mcp.progress.message"] = String(a1.message); } } else if (method === "notifications/resources/updated") { if (a1?.uri) { r4[MCP_RESOURCE_URI_ATTRIBUTE] = String(a1.uri); const r31 = parseStringToURLObject(String(a1.uri)); if (r31 && !isURLObjectRelative(r31)) { r4["mcp.resource.protocol"] = r31.protocol.replace(":", ""); } } } else if (method === "notifications/initialized") { r4["mcp.lifecycle.phase"] = "initialization_complete"; r4["mcp.protocol.ready"] = 1; } return r4; }; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); export function buildTypeSpecificAttributes(a0, a1, a2, a3) { let r38; let r6 = a2; if (a0 === "request") { const r24 = extractTargetInfo(a1.method, a2 ? a2 : {}); let r26 = a1.id !== void 0; if (r26) { const r27 = {}; r27[MCP_REQUEST_ID_ATTRIBUTE] = String(a1.id); r26 = r27; } const r33 = { ...r26, ...r24.attributes }; if (a3) { const method = a1.method; if (!a2) { r6 = {}; } r38 = getRequestArguments(method, r6); } else { r38 = {}; } HermesBuiltin.copyDataProperties(r33, r38); return r33; } return getNotificationAttributes(a1.method, a2 ? a2 : {}, a3); } export { getNotificationAttributes };