import { useCreatePickerModal as useCreatePickerModalBase, useSyncPickerModalProps, } from '../hooks';
import { wixPatternsEnvironment, } from '@wix/bex-core';
import { useEssentials } from '@wix/yoshi-flow-bm/fe-essentials-giza';
import { useCallback, useState } from 'react';
export function useCreatePickerModal() {
    const { errorMonitor, environment, createChildEssentials } = useEssentials();
    const createPickerModalBase = useCreatePickerModalBase();
    return useCallback((params) => {
        const { biLoggerFactory } = createChildEssentials({});
        return createPickerModalBase({
            errorMonitor,
            biLoggerFactory,
            ...params,
            environment: wixPatternsEnvironment({
                ...environment,
                ...params?.environment,
            }),
        });
    }, []);
}
export function usePickerModal(params) {
    const createPickerModal = useCreatePickerModal();
    const [state] = useState(() => createPickerModal(params));
    useSyncPickerModalProps(state, params);
    return state;
}
//# sourceMappingURL=usePickerModal.js.map