import { assertExists } from '@blockeditor/global/utils';
export const getSelectedModelsCommand = (ctx, next) => {
    const { host } = ctx;
    assertExists(host, '`host` is required, you need to use `withHost` command before adding this command to the pipeline.');
    const types = ctx.types ?? ['block', 'text', 'image'];
    const selectedModels = [];
    host.std.command
        .pipe()
        .withHost()
        .tryAll(chain => [
        chain.getTextSelection(),
        chain.getBlockSelections(),
        chain.getImageSelections(),
    ])
        .getSelectedBlocks({
        types,
    })
        .inline(ctx => {
        const { selectedBlocks } = ctx;
        assertExists(selectedBlocks);
        selectedModels.push(...selectedBlocks.map(el => el.model));
    })
        .run();
    next({ selectedModels });
};
//# sourceMappingURL=get-selected-models.js.map