"""
This type stub file was generated by pyright.
"""

from typing import Any, Callable, NamedTuple, TYPE_CHECKING
from sphinx.application import Sphinx

"""Sphinx core events.

Gracefully adapted from the TextPress system by Armin.
"""
if TYPE_CHECKING:
    ...
logger = ...
class EventListener(NamedTuple):
    id: int
    handler: Callable
    priority: int
    ...


core_events = ...
class EventManager:
    """Event manager for Sphinx."""
    def __init__(self, app: Sphinx) -> None:
        ...
    
    def add(self, name: str) -> None:
        """Register a custom Sphinx event."""
        ...
    
    def connect(self, name: str, callback: Callable, priority: int) -> int:
        """Connect a handler to specific event."""
        ...
    
    def disconnect(self, listener_id: int) -> None:
        """Disconnect a handler."""
        ...
    
    def emit(self, name: str, *args: Any, allowed_exceptions: tuple[type[Exception], ...] = ...) -> list:
        """Emit a Sphinx event."""
        ...
    
    def emit_firstresult(self, name: str, *args: Any, allowed_exceptions: tuple[type[Exception], ...] = ...) -> Any:
        """Emit a Sphinx event and returns first result.

        This returns the result of the first handler that doesn't return ``None``.
        """
        ...
    


