"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendSnapshotMessage = sendSnapshotMessage;
exports.sendEventMessage = sendEventMessage;
exports.decorateEventMessage = decorateEventMessage;
const iFrameTracking_1 = require("../sharedUtils/iFrameTracking");
function sendSnapshotMessage() {
    void sendEventMessage({
        action: 'snapshot',
        listener: 'snapshot',
        xPath: '',
        sourceEventTimeStamp: Date.now(),
        frameInfo: window.mablFrameInfo,
    });
}
async function sendEventMessage(message) {
    await (0, iFrameTracking_1.refreshFrameSpatial)();
    message = decorateEventMessage(message);
    await window.__mabl.bridge.sendToMain(message);
}
function decorateEventMessage(message) {
    return { ...message, frameInfo: window.mablFrameInfo };
}
