"""Convert any name format to PascalCase."""

import re


def to_pascal_case(name: str) -> str:
    """Convert any name format to PascalCase.

    Handles snake_case, camelCase, kebab-case, SCREAMING_SNAKE, and mixed formats.
    Splits on non-alphanumeric characters and camelCase boundaries, then capitalizes
    each word and joins them.

    Args:
        name: Input name in any format.

    Returns:
        str: Name converted to PascalCase. Returns "Unknown" for empty input.
    """
    parts = re.split(r'[^a-zA-Z0-9]+', name)
    words = []
    for part in parts:
        if not part:
            continue
        sub_parts = re.sub(r'([a-z])([A-Z])', r'\1_\2', part).split('_')
        for w in sub_parts:
            if w:
                words.append(w[0].upper() + w[1:].lower() if len(w) > 1 else w.upper())
    return ''.join(words) if words else 'Unknown'
