from typing import Set
from typing import List
from typing import Dict


def deduped_actions(actions: Set[str]) -> List[str]:
    """Return a sorted list of all the unique items in `actions`, ignoring case."""

    # First, group all actions by their lowercased values. This lumps "foo" and "FOO" together.
    unique: Dict[str, List[str]] = {}
    for action in actions:
        unique.setdefault(action.lower(), []).append(action)

    # Sort the dictionary by it's lowercased keys, then return the first item in each key's sorted
    # list of values. For instance, if `unique["foo"] == ["fOO", "FOO"]`, then return "FOO" (which
    # comes first when ["foo", "FOO"] is sorted).
    return [sorted(values)[0] for _, values in sorted(unique.items())]