from typing import Tuple
from typing import List


def split_stable_id(
    stable_id: str,
) -> Tuple[str, str, List[int]]:
    """Split stable ID.

    Analyzing stable ID and return the following information:

        * Document (root) stable ID
        * Context polymorphic type
        * Character offset start, end *relative to document start*

    Returns tuple of four values.
    """
    split1 = stable_id.split("::")
    if len(split1) == 2:
        split2 = split1[1].split(":")
        type = split2[0]
        idx = [int(_) for _ in split2[1:]]
        return split1[0], type, idx

    raise ValueError(f"Malformed stable_id:\t{stable_id}")