L i dZddlmZddlmZddlmZddlmZde dede fd Z dde d eed eee de ee ffd 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)Optional) MessageEntity) TextEncodingtextentityreturnc|jtj}||jdz|j|jzdz}|j tjS)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_LEoffsetlengthdecode)rr entity_texts ^/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/telegram/_utils/entities.pyparse_message_entityr"sW++l445Kfmma/6==6==3PTU2UVK   l44 55Nentitiestypesc|tj}|Dcic]}|j|vs|t|| c}Scc}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_TYPEStyper)rrrrs rparse_message_entitiesr2sN& }''BJ 7=V[[\aMa$T622  s==)N) __doc__collections.abcrtypingrtelegram._messageentityrtelegram._utils.stringsrstrrdictrrrr#sv&%10 6s 6M 6c 6"TX !-09A(3-9P - r