from collections.abc import Callable
from typing import NoReturn
from types import FunctionType

from ..window import Window

from typing import (
    AnyStr, 
    Tuple,
    Self,
    List, 
    Any
)

def process_api_calldata(window: Window, calldata: List[Any] | None) -> List[Any]: ...

class WebviewApi:
    def __init__(self) -> None: ...
    def bridge(self, function, calldata: List[Any] | None = ...) -> Any | None: ...

class WebEngine:
    def __init__(self, window: Window) -> None: ...
    def __str__(self) -> AnyStr: ...
    @property
    def running(self) -> bool: ...
    def close(self) -> None: ...
    def create_webview_api(engine: Self) -> WebviewApi: ...
    def create_event_handler(self) -> Callable[[FunctionType], AnyStr]: ...
    def initialize_tcp_server(self) -> Tuple[int, Callable[[], NoReturn]]: ...