Ë
     ²‘iÅ  ã                   óx   — d Z ddlmZ ddlmZ ddlmZ dededefd„Z	 dded
ee   dee   d	z  de	eef   fd„Z
y	)a.  This module contains auxiliary functionality for parsing MessageEntity objects.

Warning:
    Contents of this module are intended to be used internally by the library and *not* by the
    user. Changes to this module are not considered breaking changes and may not be documented in
    the changelog.
é    )ÚSequence)ÚMessageEntity)ÚTextEncodingÚtextÚentityÚreturnc                 óÖ   — | j                  t        j                  «      }||j                  dz  |j                  |j                  z   dz   }|j                  t        j                  «      S )a%  Returns the text from a given :class:`telegram.MessageEntity`.

    Args:
        text (:obj:`str`): The text to extract the entity from.
        entity (:class:`telegram.MessageEntity`): The entity to extract the text from.

    Returns:
        :obj:`str`: The text of the given entity.
    é   )Úencoder   Ú	UTF_16_LEÚoffsetÚlengthÚdecode)r   r   Úentity_texts      úO/var/www/telegram/venv/lib/python3.12/site-packages/telegram/_utils/entities.pyÚparse_message_entityr   !   sW   € ð —+‘+œl×4Ñ4Ó5€KØ˜fŸm™m¨aÑ/°6·=±=À6Ç=Á=Ñ3PÐTUÑ2UÐV€Kà×Ñœl×4Ñ4Ó5Ð5ó    NÚentitiesÚtypesc                 ó„   — |€t         j                  }|D �ci c]  }|j                  |v sŒ|t        | |«      “Œ  c}S c c}w )aS  
    Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
    It contains entities filtered by their ``type`` attribute as
    the key, and the text that each entity belongs to as the value of the :obj:`dict`.

    Args:
        text (:obj:`str`): The text to extract the entity from.
        entities (list[:class:`telegram.MessageEntity`]): The entities to extract the text from.
        types (list[:obj:`str`], optional): List of ``MessageEntity`` types as strings. If the
            ``type`` attribute of an entity is contained in this list, it will be returned.
            Defaults to :attr:`telegram.MessageEntity.ALL_TYPES`.

    Returns:
        dict[:class:`telegram.MessageEntity`, :obj:`str`]: A dictionary of entities mapped to
        the text that belongs to them, calculated based on UTF-16 codepoints.
    )r   Ú	ALL_TYPESÚtyper   )r   r   r   r   s       r   Úparse_message_entitiesr   1   sN   € ð& €}Ü×'Ñ'ˆð BJöØ7=ÈVÏ[É[Ð\aÒMaˆÔ$ T¨6Ó2Ñ2òð ùò s   —=«=)N)Ú__doc__Úcollections.abcr   Útelegram._messageentityr   Útelegram._utils.stringsr   Ústrr   Údictr   © r   r   ú<module>r!      ss   ðñ&õ %å 1Ý 0ð6˜sð 6¨Mð 6¸có 6ð" QUñØ
ðØ! -Ñ0ðØ9AÀ#¹ÈÑ9Mðà	ˆ-˜Ð
Ñôr   