import { buildFactory, } from './build-factory.js';
export function hydratedStaticStateFactory(controllerDefinitions, options) {
    return (solutionType) => async (...params) => {
        const solutionTypeBuild = await buildFactory(controllerDefinitions, options)(solutionType);
        const { engine, controllers } = await solutionTypeBuild(
        // @ts-expect-error: TODO: KIT-4742: the wiring will fix also the type inconsistencies
        ...params);
        params[0].searchActions.forEach((action) => {
            engine.dispatch(action);
        });
        await engine.waitForRequestCompletedAction();
        return { engine, controllers };
    };
}
