// Copyright 2026 The Lynx Authors. All rights reserved.
// Licensed under the Apache License Version 2.0 that can be found in the
// LICENSE file in the root directory of this source tree.
import { registerMTEventBackgroundFunctionCtx } from './main-thread-background-function.js';
export function isMTEventCtx(value) {
    return value != null
        && typeof value === 'object'
        && !Array.isArray(value)
        && typeof value._wkltId === 'string';
}
export function isMTEventNativeWrapper(value) {
    return value != null
        && typeof value === 'object'
        && !Array.isArray(value)
        && value.type === 'worklet'
        && isMTEventCtx(value.value);
}
export function prepareMTEventCtxForNative(rawCtx, previousPreparedValue, previousRawValue) {
    if (previousRawValue === rawCtx) {
        return previousPreparedValue;
    }
    const preparedCtx = { ...rawCtx };
    registerMTEventBackgroundFunctionCtx(preparedCtx);
    return {
        type: 'worklet',
        value: preparedCtx,
    };
}
//# sourceMappingURL=main-thread-event-ctx.js.map