import { normalizeReasoningInAnthropicPayloadWithNative, normalizeReasoningInChatPayloadWithNative, normalizeReasoningInGeminiPayloadWithNative, normalizeReasoningInOpenAIPayloadWithNative, normalizeReasoningInResponsesPayloadWithNative } from '../../router/virtual-router/engine-selection/native-shared-conversion-semantics.js';
export const RESPONSES_INSTRUCTIONS_REASONING_FIELD = '__rcc_reasoning_instructions';
function assertReasoningNormalizerNativeAvailable() {
    if (typeof normalizeReasoningInChatPayloadWithNative !== 'function' ||
        typeof normalizeReasoningInResponsesPayloadWithNative !== 'function' ||
        typeof normalizeReasoningInGeminiPayloadWithNative !== 'function' ||
        typeof normalizeReasoningInAnthropicPayloadWithNative !== 'function' ||
        typeof normalizeReasoningInOpenAIPayloadWithNative !== 'function') {
        throw new Error('[reasoning-normalizer] native bindings unavailable');
    }
}
export function normalizeReasoningInChatPayload(payload) {
    assertReasoningNormalizerNativeAvailable();
    if (!payload)
        return;
    const normalized = normalizeReasoningInChatPayloadWithNative(payload);
    if (normalized && typeof normalized === 'object') {
        Object.assign(payload, normalized);
    }
}
export function normalizeReasoningInResponsesPayload(payload, options = { includeOutput: true }) {
    assertReasoningNormalizerNativeAvailable();
    if (!payload)
        return;
    const normalized = normalizeReasoningInResponsesPayloadWithNative(payload, options);
    if (normalized && typeof normalized === 'object') {
        Object.assign(payload, normalized);
    }
}
export function normalizeReasoningInGeminiPayload(payload) {
    assertReasoningNormalizerNativeAvailable();
    if (!payload)
        return;
    const normalized = normalizeReasoningInGeminiPayloadWithNative(payload);
    if (normalized && typeof normalized === 'object') {
        Object.assign(payload, normalized);
    }
}
export function normalizeReasoningInAnthropicPayload(payload) {
    assertReasoningNormalizerNativeAvailable();
    if (!payload)
        return;
    const normalized = normalizeReasoningInAnthropicPayloadWithNative(payload);
    if (normalized && typeof normalized === 'object') {
        Object.assign(payload, normalized);
    }
}
export function normalizeReasoningInOpenAIPayload(payload) {
    assertReasoningNormalizerNativeAvailable();
    if (!payload)
        return;
    const normalized = normalizeReasoningInOpenAIPayloadWithNative(payload);
    if (normalized && typeof normalized === 'object') {
        Object.assign(payload, normalized);
    }
}
