import { useWixPatternsContainer, useCreateCollection, } from '@wix/bex-core/react';
import { TableState } from '../state';
import { useOptionalCachedState } from './useOptionalCachedState';
export const useTableCollection = (config) => {
    const container = useWixPatternsContainer();
    const createCollection = useCreateCollection();
    const state = useOptionalCachedState(() => {
        return new TableState({
            collection: createCollection(config),
            container,
        });
    });
    config.aiAssistant?.useAiAssistant({
        collection: state.collection,
        loadingRowState: state.loadingRowState,
    });
    return state;
};
//# sourceMappingURL=useTableCollection.js.map