import { PathFinder } from '@blockeditor/block-std';
import { assertExists } from '@blockeditor/global/utils';
export const getBlockIndexCommand = (ctx, next) => {
    const path = ctx.path ?? ctx.currentSelectionPath;
    assertExists(path, '`path` is required, you need to pass it in args or ctx before adding this command to the pipeline.');
    const parent = ctx.std.view.getParent(path);
    if (!parent) {
        return;
    }
    const index = parent.children.findIndex(x => {
        return PathFinder.equals(x.path, path);
    });
    next({
        blockIndex: index,
        parentBlock: parent.view,
    });
};
//# sourceMappingURL=get-block-index.js.map