from pathlib import Path


def get_dictionaries(base: Path) -> list[tuple[str, list[Path]]]:
    """Make a list of available dictionaries and the interesting files.

    :param base: The Apple Dictionaries root directory.
    :return: A list of tuples of name, files for each dictionary.
    """
    all_dicts = sorted(
        (
            (
                dic.stem,
                [
                    f
                    for f in (dic / "Contents" / "Resources").iterdir()
                    if f.suffix != ".lproj"
                ],
            )
            for dic_path in Path(base).iterdir()
            if dic_path.is_dir()
            for dic in (dic_path / "AssetData").iterdir()
        ),
        key=lambda x: x[0],
    )
    return [(name, files) for name, files in all_dicts if files]