import { useCallback, useState } from 'react';
import { PickerStandaloneState } from '../../state';
import { useWixPatternsContainer, useWixPatternsContainerOverrides, useCreateCollection, } from '@wix/bex-core/react';
export function useCreatePickerStandalone() {
    const { window, errorMonitor, createBILogger } = useWixPatternsContainer();
    const containerOverrides = useWixPatternsContainerOverrides();
    const createCollection = useCreateCollection();
    return useCallback((config) => {
        const { noItemsAvailableDestinationUrl, initialSelect, logoType = 'wix', defaultDestinationUrl, urlSegmentPropertyMap, events, shouldFilterNotAffectTotalCount, ...collectionConfig } = config;
        const collection = createCollection({
            persistQueryToUrl: true,
            ...collectionConfig,
            events,
        });
        return new PickerStandaloneState({
            collection,
            noItemsAvailableDestinationUrl,
            initialSelect,
            defaultDestinationUrl,
            urlSegmentPropertyMap,
            window: containerOverrides.window ?? window,
            errorMonitor,
            logoType,
            shouldFilterNotAffectTotalCount,
            events,
            createBILogger,
        });
    }, []);
}
export function usePickerStandalone(config) {
    const createPickerStandalone = useCreatePickerStandalone();
    const [state] = useState(() => createPickerStandalone(config));
    return state;
}
//# sourceMappingURL=usePickerStandalone.js.map