import { ensureBridgeInstructionsWithNative } from '../router/virtual-router/engine-selection/native-shared-conversion-semantics.js';
export function ensureBridgeInstructions(payload) {
    const normalized = ensureBridgeInstructionsWithNative(payload);
    if (normalized && typeof normalized === 'object') {
        if (Object.prototype.hasOwnProperty.call(normalized, 'input')) {
            payload.input = normalized.input;
        }
        if (Object.prototype.hasOwnProperty.call(normalized, 'instructions')) {
            payload.instructions = normalized.instructions;
        }
        else if (Object.prototype.hasOwnProperty.call(payload, 'instructions')) {
            delete payload.instructions;
        }
    }
    const instructions = payload.instructions;
    return typeof instructions === 'string' && instructions.length ? instructions : undefined;
}
