"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useOpenAIConversationsAdapter = useOpenAIConversationsAdapter;
const react_1 = require("react");
const mapOpenAIConversationsToChats_1 = require("./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;
}
function useOpenAIConversationsAdapter(conversations) {
    const list = getConversationsList(conversations);
    const chats = (0, react_1.useMemo)(() => (0, mapOpenAIConversationsToChats_1.mapOpenAIConversationsToChats)(list), [list]);
    return { chats };
}
//# sourceMappingURL=useOpenAIConversationsAdapter.js.map
