import { useMemo } from 'react';
import { mapOpenAIConversationsToChats } from "./helpers/mapOpenAIConversationsToChats.js";
function getConversationsList(input) {
    var _a;
    if (!input || Array.isArray(input))
        return input;
    if (typeof input === 'object' && 'data' in input)
        return (_a = input.data) !== null && _a !== void 0 ? _a : null;
    return null;
}
export function useOpenAIConversationsAdapter(conversations) {
    const list = getConversationsList(conversations);
    const chats = useMemo(() => mapOpenAIConversationsToChats(list), [list]);
    return { chats };
}
//# sourceMappingURL=useOpenAIConversationsAdapter.js.map
