from typing import OrderedDict


def fdf_lines_to_dict(lines):
    """
    Converts list of FDF file lines to a dictionary of FDF file options
    :param lines: a list of FDF file lines
    :return: a dictionary of file options
    """
    fdf_dict = OrderedDict()
    is_block = False
    block_key = None
    for i, fdf_line in enumerate(lines):
        key = fdf_line[0]
        if key == '%block':
            is_block = True
            block_key = fdf_line[1]
            fdf_dict[block_key] = [i, ]
            continue
        if is_block:
            if fdf_line[0] != '%endblock':
                fdf_dict[block_key].append(fdf_line)
            else:
                is_block = False
                block_key = None
                continue
        fdf_dict[key] = [i, ] + fdf_line[1:]
    return fdf_dict