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

from datetime import date, datetime, time, timedelta
from typing import Any, Literal, TYPE_CHECKING, Union, overload
from google.protobuf.message import Message
from typing_extensions import TypeAlias
from streamlit.proto.ChatInput_pb2 import ChatInput
from streamlit.proto.LabelVisibilityMessage_pb2 import LabelVisibilityMessage
from streamlit.runtime.scriptrunner_utils.script_run_context import ScriptRunContext
from builtins import ellipsis
from collections.abc import Iterable

if TYPE_CHECKING:
    ...
Key: TypeAlias = Union[str, int]
LabelVisibility: TypeAlias = Literal["visible", "hidden", "collapsed"]
PROTO_SCALAR_VALUE = Union[float, int, bool, str, bytes]
SAFE_VALUES = Union[date, time, datetime, timedelta, None, "ellipsis", Message, PROTO_SCALAR_VALUE,]
def get_label_visibility_proto_value(label_visibility_string: LabelVisibility) -> LabelVisibilityMessage.LabelVisibilityOptions.ValueType:
    """Returns one of LabelVisibilityMessage enum constants.py based on string value."""
    ...

def get_chat_input_accept_file_proto_value(accept_file_value: bool | Literal["multiple"]) -> ChatInput.AcceptFile.ValueType:
    """Returns one of ChatInput.AcceptFile enum value based on string value."""
    ...

@overload
def to_key(key: None) -> None:
    ...

@overload
def to_key(key: Key) -> str:
    ...

def to_key(key: Key | None) -> str | None:
    ...

def compute_and_register_element_id(element_type: str, *, user_key: str | None, form_id: str | None, **kwargs: SAFE_VALUES | Iterable[SAFE_VALUES]) -> str:
    """Compute and register the ID for the given element.

    This ID is stable: a given set of inputs to this function will always produce
    the same ID output. Only stable, deterministic values should be used to compute
    element IDs. Using nondeterministic values as inputs can cause the resulting
    element ID to change between runs.

    The element ID includes the user_key so elements with identical arguments can
    use it to be distinct. The element ID includes an easily identified prefix, and the
    user_key as a suffix, to make it easy to identify it and know if a key maps to it.

    The element ID gets registered to make sure that only one ID and user-specified
    key exists at the same time. If there are duplicated IDs or keys, an error
    is raised.

    Parameters
    ----------
    element_type : str
        The type (command name) of the element to register.

    user_key : str | None
        The user-specified key for the element. `None` if no key is provided
        or if the element doesn't support a specifying a key.

    form_id : str | None
        The ID of the form that the element belongs to. `None` or empty string
        if the element doesn't belong to a form or doesn't support forms.

    kwargs : SAFE_VALUES | Iterable[SAFE_VALUES]
        The arguments to use to compute the element ID.
        The arguments must be stable, deterministic values.
        Some common parameters like key, disabled,
        format_func, label_visibility, args, kwargs, on_change, and
        the active_script_hash are not supposed to be added here
    """
    ...

def save_for_app_testing(ctx: ScriptRunContext, k: str, v: Any): # -> None:
    ...

