import { asRecord, normalizeText, } from './helpers.js';
export { assertNoLegacyLocalModelPrefix } from '../internal/legacy-local-model-prefix.js';
export function withOptionalHeadSubjectUserId(request, subjectUserId) {
    const normalized = normalizeText(subjectUserId);
    if (!normalized) {
        return request;
    }
    return {
        ...request,
        head: {
            ...request.head,
            subjectUserId: normalized,
        },
    };
}
export function flattenImageProviderOptions(value) {
    const topLevel = asRecord(value);
    const flattened = {};
    const applyLayer = (layer) => {
        for (const [key, item] of Object.entries(layer)) {
            const normalizedKey = normalizeText(key);
            if (!normalizedKey
                || normalizedKey === 'nimi'
                || normalizedKey === 'llama'
                || normalizedKey === 'media'
                || normalizedKey === 'sidecar'
                || normalizedKey === 'extra') {
                continue;
            }
            flattened[normalizedKey] = item;
        }
    };
    applyLayer(asRecord(topLevel.llama));
    applyLayer(asRecord(topLevel.media));
    applyLayer(asRecord(topLevel.sidecar));
    applyLayer(asRecord(topLevel.extra));
    applyLayer(asRecord(topLevel.nimi));
    applyLayer(topLevel);
    return flattened;
}
export function toVideoModeValue(value) {
    switch (value) {
        case 't2v':
            return 1;
        case 'i2v-first-frame':
            return 2;
        case 'i2v-first-last':
            return 3;
        case 'i2v-reference':
            return 4;
        default:
            return 0;
    }
}
export function toVideoRoleValue(value) {
    switch (value) {
        case 'prompt':
            return 1;
        case 'first_frame':
            return 2;
        case 'last_frame':
            return 3;
        case 'reference_image':
            return 4;
        default:
            return 0;
    }
}
//# sourceMappingURL=model-factory-shared.js.map