§
    ¨eîiFQ  ã                   ó  — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZmZmZ dd	lmZmZ dd
lmZ erddlmZ  G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        ZdS )z:This module contains classes related to gifs sent by bots.é    )ÚSequence)ÚTYPE_CHECKING)ÚChat)ÚSticker)ÚMessageEntity)ÚTelegramObject)Úde_json_optionalÚde_list_optionalÚparse_sequence_arg)Úparse_message_entitiesÚparse_message_entity)ÚJSONDict)ÚBotc            
       óD   ‡ — e Zd ZdZdZddœdededededz  fˆ fd	„Zˆ xZS )
ÚGiftBackgrounda  This object describes the background of a gift.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`center_color`, :attr:`edge_color` and :attr:`text_color` are
    equal.

    .. versionadded:: 22.6

    Args:
        center_color (:obj:`int`): Center color of the background in RGB format.
        edge_color (:obj:`int`): Edge color of the background in RGB format.
        text_color (:obj:`int`): Text color of the background in RGB format.

    Attributes:
        center_color (:obj:`int`): Center color of the background in RGB format.
        edge_color (:obj:`int`): Edge color of the background in RGB format.
        text_color (:obj:`int`): Text color of the background in RGB format.

    )Úcenter_colorÚ
edge_colorÚ
text_colorN©Ú
api_kwargsr   r   r   r   c                óÐ   •— t          ¦   «                              |¬¦  «         || _        || _        || _        | j        | j        | j        f| _        |                      ¦   «          d S ©Nr   )ÚsuperÚ__init__r   r   r   Ú	_id_attrsÚ_freeze)Úselfr   r   r   r   Ú	__class__s        €úS/home/div/.hermes/hermes-agent/venv/lib/python3.11/site-packages/telegram/_gifts.pyr   zGiftBackground.__init__@   sd   ø€ õ 	‰Œ×Ò JÐÑ/Ô/Ð/Ø!-ˆÔØ)ˆŒØ)ˆŒð ÔØŒOØŒOð
ˆŒð 	�Š‰Œˆˆˆó    )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úintr   r   Ú__classcell__©r   s   @r   r   r   %   s‡   ø€ € € € € ðð ð(€Ið '+ðð ð àðð ðð ð	ð ˜t‘Oðð ð ð ð ð ð ð ð ð r    r   c                   óè   ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 dddœdededededz  d	edz  d
edz  dedz  dedz  dedz  de	dz  de
dz  de
dz  dedz  dedz  fˆ fd„Zeddedddd fˆ fd„¦   «         Zˆ xZS )ÚGiftak  This object represents a gift that can be sent by the bot.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`id` is equal.

    .. versionadded:: 21.8

    Args:
        id (:obj:`str`): Unique identifier of the gift.
        sticker (:class:`~telegram.Sticker`): The sticker that represents the gift.
        star_count (:obj:`int`): The number of Telegram Stars that must be paid to send the
            sticker.
        total_count (:obj:`int`, optional): The total number of the gifts of this type that can be
            sent by all users; for limited gifts only.
        remaining_count (:obj:`int`, optional): The number of remaining gifts of this type that can
            be sent by all users; for limited gifts only.
        upgrade_star_count (:obj:`int`, optional): The number of Telegram Stars that must be paid
            to upgrade the gift to a unique one.

            .. versionadded:: 21.10
        publisher_chat (:class:`telegram.Chat`, optional): Information about the chat that
            published the gift.

            .. versionadded:: 22.4
        personal_total_count (:obj:`int`, optional): The total number of gifts of this type that
            can be sent by the bot; for limited gifts only.

            .. versionadded:: 22.6
        personal_remaining_count (:obj:`int`, optional): The number of remaining gifts of this type
            that can be sent by the bot; for limited gifts only.

            .. versionadded:: 22.6
        background (:class:`GiftBackground`, optional): Background of the gift.

            .. versionadded:: 22.6
        is_premium (:obj:`bool`, optional): :obj:`True`, if the gift can only be purchased by
            Telegram Premium subscribers.

            .. versionadded:: 22.6
        has_colors (:obj:`bool`, optional): :obj:`True`, if the gift can be used (after being
            upgraded) to customize a user's appearance.

            .. versionadded:: 22.6
        unique_gift_variant_count (:obj:`int`, optional): The total number of different unique
            gifts that can be obtained by upgrading the gift.

            .. versionadded:: 22.6

    Attributes:
        id (:obj:`str`): Unique identifier of the gift.
        sticker (:class:`~telegram.Sticker`): The sticker that represents the gift.
        star_count (:obj:`int`): The number of Telegram Stars that must be paid to send the
            sticker.
        total_count (:obj:`int`): Optional. The total number of the gifts of this type that can be
            sent by all users; for limited gifts only.
        remaining_count (:obj:`int`): Optional. The number of remaining gifts of this type that can
            be sent by all users; for limited gifts only.
        upgrade_star_count (:obj:`int`): Optional. The number of Telegram Stars that must be paid
            to upgrade the gift to a unique one.

            .. versionadded:: 21.10
        publisher_chat (:class:`telegram.Chat`): Optional. Information about the chat that
            published the gift.

            .. versionadded:: 22.4
        personal_total_count (:obj:`int`): Optional. The total number of gifts of this type that
            can be sent by the bot; for limited gifts only.

            .. versionadded:: 22.6
        personal_remaining_count (:obj:`int`): Optional. The number of remaining gifts of this type
            that can be sent by the bot; for limited gifts only.

            .. versionadded:: 22.6
        background (:class:`GiftBackground`): Optional. Background of the gift.

            .. versionadded:: 22.6
        is_premium (:obj:`bool`): Optional. :obj:`True`, if the gift can only be purchased by
            Telegram Premium subscribers.

            .. versionadded:: 22.6
        has_colors (:obj:`bool`): Optional. :obj:`True`, if the gift can be used (after being
            upgraded) to customize a user's appearance.

            .. versionadded:: 22.6
        unique_gift_variant_count (:obj:`int`): Optional. The total number of different unique
            gifts that can be obtained by upgrading the gift.

            .. versionadded:: 22.6

    )Ú
backgroundÚ
has_colorsÚidÚ
is_premiumÚpersonal_remaining_countÚpersonal_total_countÚpublisher_chatÚremaining_countÚ
star_countÚstickerÚtotal_countÚunique_gift_variant_countÚupgrade_star_countNr   r-   r4   r3   r5   r2   r7   r1   r0   r/   r+   r.   r,   r6   r   c                óD  •— t          ¦   «                              |¬¦  «         || _        || _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        || _        || _        || _        | j        f| _        |                      ¦   «          d S r   )r   r   r-   r4   r3   r5   r2   r7   r1   r0   r/   r+   r.   r,   r6   r   r   )r   r-   r4   r3   r5   r2   r7   r1   r0   r/   r+   r.   r,   r6   r   r   s                  €r   r   zGift.__init__Â   sž   ø€ õ$ 	‰Œ×Ò JÐÑ/Ô/Ð/ØˆŒØ 'ˆŒØ)ˆŒØ'2ˆÔØ+:ˆÔØ.@ˆÔØ+9ˆÔØ0DˆÔ!Ø4LˆÔ%Ø1;ˆŒØ'1ˆŒØ'1ˆŒØ5NˆÔ&àœ'˜ˆŒà�Š‰Œˆˆˆr    ÚdataÚbotú
Bot | NoneÚreturnc                 ó|  •— |                       |¦  «        }t          |                     d¦  «        t          |¦  «        |d<   t          |                     d¦  «        t          |¦  «        |d<   t          |                     d¦  «        t
          |¦  «        |d<   t          ¦   «                              ||¬¦  «        S )ú,See :meth:`telegram.TelegramObject.de_json`.r4   r1   r+   ©r9   r:   )Ú_parse_datar	   Úgetr   r   r   r   Úde_json©Úclsr9   r:   r   s      €r   rB   zGift.de_jsonç   s™   ø€ ð �Š˜tÑ$Ô$ˆå*¨4¯8ª8°IÑ+>Ô+>ÅÈÑMÔMˆˆY‰Ý!1°$·(²(Ð;KÑ2LÔ2LÍdÐTWÑ!XÔ!XˆÐÑÝ-¨d¯hªh°|Ñ.DÔ.DÅnÐVYÑZÔZˆˆ\ÑÝ‰wŒw�Š D¨cˆÑ2Ô2Ð2r    )
NNNNNNNNNN©N)r!   r"   r#   r$   r%   Ústrr   r&   r   r   Úboolr   r   ÚclassmethodrB   r'   r(   s   @r   r*   r*   V   s�  ø€ € € € € ðYð Yðv€Ið* #'Ø&*Ø)-Ø&*Ø+/Ø/3Ø,0Ø"&Ø"&Ø04ð#ð  '+ð!#ð #ð #àð#ð ð#ð ð	#ð
 ˜4‘Zð#ð ˜t™ð#ð   $™Jð#ð ˜t™ð#ð " D™jð#ð #&¨¡*ð#ð # TÑ)ð#ð ˜4‘Kð#ð ˜4‘Kð#ð $'¨¡:ð#ð  ˜t‘Oð!#ð #ð #ð #ð #ð #ðJ ð3ð 3˜8ð 3¨,ð 3À&ð 3ð 3ð 3ð 3ð 3ñ „[ð3ð 3ð 3ð 3ð 3r    r*   c                   ór   ‡ — e Zd ZdZdZddœdee         dedz  fˆ fd„Ze	dded	d
dd fˆ fd„¦   «         Z
ˆ xZS )ÚGiftsav  This object represent a list of gifts.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`gifts` are equal.

    .. versionadded:: 21.8

    Args:
        gifts (Sequence[:class:`Gift`]): The sequence of gifts.

    Attributes:
        gifts (tuple[:class:`Gift`]): The sequence of gifts.

    )ÚgiftsNr   rK   r   c                ó¶   •— t          ¦   «                              |¬¦  «         t          |¦  «        | _        | j        f| _        |                      ¦   «          d S r   )r   r   r   rK   r   r   )r   rK   r   r   s      €r   r   zGifts.__init__  sK   ø€ õ 	‰Œ×Ò JÐÑ/Ô/Ð/Ý'9¸%Ñ'@Ô'@ˆŒ
àœ*˜ˆŒà�Š‰Œˆˆˆr    r9   r:   r;   r<   c                 óÌ   •— |                       |¦  «        }t          |                     d¦  «        t          |¦  «        |d<   t	          ¦   «                              ||¬¦  «        S )r>   rK   r?   )r@   r
   rA   r*   r   rB   rC   s      €r   rB   zGifts.de_json  sQ   ø€ ð �Š˜tÑ$Ô$ˆå(¨¯ª°'Ñ):Ô):½DÀ#ÑFÔFˆˆW‰Ý‰wŒw�Š D¨cˆÑ2Ô2Ð2r    rE   )r!   r"   r#   r$   r%   r   r*   r   r   rH   rB   r'   r(   s   @r   rJ   rJ   ò   s»   ø€ € € € € ðð ð €Ið '+ð	ð ð à˜Œ~ðð ˜t‘Oð	ð ð ð ð ð ð ð3ð 3˜8ð 3¨,ð 3À'ð 3ð 3ð 3ð 3ð 3ñ „[ð3ð 3ð 3ð 3ð 3r    rJ   c                   ó$  ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 	 dddœdededz  dedz  dedz  d	edz  d
edz  de	e
         dz  dedz  dedz  dedz  dedz  fˆ fd„Zeddedddd fˆ fd„¦   «         Zde
defd„Zddee         dz  dee
ef         fd„Zˆ xZS )ÚGiftInfoa¿  Describes a service message about a regular gift that was sent or received.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`gift` is equal.

    .. versionadded:: 22.1

    Args:
        gift (:class:`Gift`): Information about the gift.
        owned_gift_id (:obj:`str`, optional): Unique identifier of the received gift for the bot;
            only present for gifts received on behalf of business accounts.
        convert_star_count (:obj:`int`, optional) Number of Telegram Stars that can be claimed by
            the receiver by converting the gift; omitted if conversion to Telegram Stars
            is impossible.
        prepaid_upgrade_star_count (:obj:`int`, optional): Number of Telegram Stars that were
            prepaid for the ability to upgrade the gift.
        can_be_upgraded (:obj:`bool`, optional): :obj:`True`, if the gift can be upgraded
            to a unique gift.
        text (:obj:`str`, optional): Text of the message that was added to the gift.
        entities (Sequence[:class:`telegram.MessageEntity`], optional): Special entities that
            appear in the text.
        is_private (:obj:`bool`, optional): :obj:`True`, if the sender and gift text are
            shown only to the gift receiver; otherwise, everyone will be able to see them.
        is_upgrade_separate (:obj:`bool`, optional): :obj:`True`, if the gift's upgrade was
            purchased after the gift was sent.

            .. versionadded:: 22.6
        unique_gift_number (:obj:`int`, optional): Unique number reserved for this gift when
            upgraded. See the number field in :class:`~telegram.UniqueGift`.

            .. versionadded:: 22.6

    Attributes:
        gift (:class:`Gift`): Information about the gift.
        owned_gift_id (:obj:`str`): Optional. Unique identifier of the received gift for the bot;
            only present for gifts received on behalf of business accounts.
        convert_star_count (:obj:`int`): Optional. Number of Telegram Stars that can be claimed by
            the receiver by converting the gift; omitted if conversion to Telegram Stars
            is impossible.
        prepaid_upgrade_star_count (:obj:`int`): Optional. Number of Telegram Stars that were
            prepaid for the ability to upgrade the gift.
        can_be_upgraded (:obj:`bool`): Optional. :obj:`True`, if the gift can be upgraded
            to a unique gift.
        text (:obj:`str`): Optional. Text of the message that was added to the gift.
        entities (Sequence[:class:`telegram.MessageEntity`]): Optional. Special entities that
            appear in the text.
        is_private (:obj:`bool`): Optional. :obj:`True`, if the sender and gift text are
            shown only to the gift receiver; otherwise, everyone will be able to see them.
        is_upgrade_separate (:obj:`bool`): Optional. :obj:`True`, if the gift's upgrade was
            purchased after the gift was sent.

            .. versionadded:: 22.6
        unique_gift_number (:obj:`int`): Optional. Unique number reserved for this gift when
            upgraded. See the number field in :class:`~telegram.UniqueGift`.

            .. versionadded:: 22.6

    )
Úcan_be_upgradedÚconvert_star_countÚentitiesÚgiftÚ
is_privateÚis_upgrade_separateÚowned_gift_idÚprepaid_upgrade_star_countÚtextÚunique_gift_numberNr   rS   rV   rQ   rW   rP   rX   rR   rT   rY   rU   r   c                ó4  •— t          ¦   «                              |¬¦  «         || _        || _        || _        || _        || _        || _        t          |¦  «        | _	        || _
        |	| _        |
| _        | j        f| _        |                      ¦   «          d S r   )r   r   rS   rV   rQ   rW   rP   rX   r   rR   rT   rY   rU   r   r   )r   rS   rV   rQ   rW   rP   rX   rR   rT   rY   rU   r   r   s               €r   r   zGiftInfo.__init__c  s�   ø€ õ 	‰Œ×Ò JÐÑ/Ô/Ð/àˆŒ	à)6ˆÔØ.@ˆÔØ6PˆÔ'Ø,;ˆÔØ $ˆŒ	Ý3EÀhÑ3OÔ3OˆŒØ'1ˆŒØ.@ˆÔØ0CˆÔ àœ)˜ˆŒà�Š‰Œˆˆˆr    r9   r:   r;   r<   c                 ó$  •— |                       |¦  «        }t          |                     d¦  «        t          |¦  «        |d<   t	          |                     d¦  «        t
          |¦  «        |d<   t          ¦   «                              ||¬¦  «        S )r>   rS   rR   r?   )r@   r	   rA   r*   r
   r   r   rB   rC   s      €r   rB   zGiftInfo.de_json„  st   ø€ ð �Š˜tÑ$Ô$ˆå'¨¯ª°Ñ(8Ô(8½$ÀÑDÔDˆˆV‰Ý+¨D¯HªH°ZÑ,@Ô,@Å-ÐQTÑUÔUˆˆZÑå‰wŒw�Š D¨cˆÑ2Ô2Ð2r    Úentityc                 óX   — | j         st          d¦  «        ‚t          | j         |¦  «        S )aÔ  Returns the text in :attr:`text`
        from a given :class:`telegram.MessageEntity` of :attr:`entities`.

        Note:
            This method is present because Telegram calculates the offset and length in
            UTF-16 codepoint pairs, which some versions of Python don't handle automatically.
            (That is, you can't just slice ``Message.text`` with the offset and length.)

        Args:
            entity (:class:`telegram.MessageEntity`): The entity to extract the text from. It must
                be an entity that belongs to :attr:`entities`.

        Returns:
            :obj:`str`: The text of the given entity.

        Raises:
            RuntimeError: If the gift info has no text.

        úThis GiftInfo has no 'text'.)rX   ÚRuntimeErrorr   )r   r\   s     r   Úparse_entityzGiftInfo.parse_entityŽ  s/   € ð( Œyð 	?ÝÐ=Ñ>Ô>Ð>å# D¤I¨vÑ6Ô6Ð6r    Útypesc                 ód   — | j         st          d¦  «        ‚t          | j         | j        |¦  «        S )aO  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this gift info's text filtered by their ``type`` attribute as
        the key, and the text that each entity belongs to as the value of the :obj:`dict`.

        Note:
            This method should always be used instead of the :attr:`entities`
            attribute, since it calculates the correct substring from the message text based on
            UTF-16 codepoints. See :attr:`parse_entity` for more info.

        Args:
            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.

        Raises:
            RuntimeError: If the gift info has no text.

        r^   )rX   r_   r   rR   )r   ra   s     r   Úparse_entitieszGiftInfo.parse_entities§  s3   € ð0 Œyð 	?ÝÐ=Ñ>Ô>Ð>å% d¤i°´ÀÑFÔFÐFr    )	NNNNNNNNNrE   )r!   r"   r#   r$   r%   r*   rF   r&   rG   r   r   r   r   rH   rB   r`   ÚlistÚdictrc   r'   r(   s   @r   rO   rO     sÇ  ø€ € € € € ð9ð 9ðv€Ið  %)Ø)-Ø15Ø'+ØØ37Ø"&Ø)-Ø+/ðð '+ðð ð àðð ˜T‘zðð   $™Jð	ð
 %(¨$¡Jðð  ™ðð �D‰jðð ˜=Ô)¨DÑ0ðð ˜4‘Kðð   $™Jðð " D™[ðð ˜t‘Oðð ð ð ð ð ðB ð3ð 3˜8ð 3¨,ð 3À*ð 3ð 3ð 3ð 3ð 3ñ „[ð3ð7 =ð 7°Sð 7ð 7ð 7ð 7ð2Gð G D¨¤I°Ñ$4ð GÀÀ]ÐTWÐEWÔ@Xð Gð Gð Gð Gð Gð Gð Gð Gr    rO   c                   óL   ‡ — e Zd ZdZdZddœdedededed	ed
edz  fˆ fd„Zˆ xZS )ÚAcceptedGiftTypesaÂ  This object describes the types of gifts that can be gifted to a user or a chat.

    Objects of this class are comparable in terms of equality. Two objects of this class are
    considered equal if their :attr:`unlimited_gifts`, :attr:`limited_gifts`,
    :attr:`unique_gifts`, :attr:`premium_subscription` and :attr:`gifts_from_channels` are equal.

    .. versionadded:: 22.1
    .. versionchanged:: 22.6
        :attr:`gifts_from_channels` is now considered for equality checks.

    Args:
        unlimited_gifts (:class:`bool`): :obj:`True`, if unlimited regular gifts are accepted.
        limited_gifts (:class:`bool`): :obj:`True`, if limited regular gifts are accepted.
        unique_gifts (:class:`bool`): :obj:`True`, if unique gifts or gifts that can be upgraded
            to unique for free are accepted.
        premium_subscription (:class:`bool`): :obj:`True`, if a Telegram Premium subscription
            is accepted.
        gifts_from_channels (:obj:`bool`): :obj:`True`, if transfers of unique gifts from channels
            are accepted

            .. versionadded:: 22.6

    Attributes:
        unlimited_gifts (:class:`bool`): :obj:`True`, if unlimited regular gifts are accepted.
        limited_gifts (:class:`bool`): :obj:`True`, if limited regular gifts are accepted.
        unique_gifts (:class:`bool`): :obj:`True`, if unique gifts or gifts that can be upgraded
            to unique for free are accepted.
        premium_subscription (:class:`bool`): :obj:`True`, if a Telegram Premium subscription
            is accepted.
        gifts_from_channels (:obj:`bool`): :obj:`True`, if transfers of unique gifts from channels
            are accepted

            .. versionadded:: 22.6

    )Úgifts_from_channelsÚlimited_giftsÚpremium_subscriptionÚunique_giftsÚunlimited_giftsNr   rl   ri   rk   rj   rh   r   c                ó  •— t          ¦   «                              |¬¦  «         || _        || _        || _        || _        || _        | j        | j        | j        | j        | j        f| _        |                      ¦   «          d S r   )	r   r   rl   ri   rk   rj   rh   r   r   )r   rl   ri   rk   rj   rh   r   r   s          €r   r   zAcceptedGiftTypes.__init__ò  s„   ø€ õ 	‰Œ×Ò JÐÑ/Ô/Ð/Ø%4ˆÔØ#0ˆÔØ".ˆÔØ*>ˆÔ!Ø)<ˆÔ ð Ô ØÔØÔØÔ%ØÔ$ð
ˆŒð 	�Š‰Œˆˆˆr    )	r!   r"   r#   r$   r%   rG   r   r   r'   r(   s   @r   rg   rg   Å  sœ   ø€ € € € € ð"ð "ðH€Ið  '+ðð ð àðð ðð ð	ð
 #ðð "ðð ˜t‘Oðð ð ð ð ð ð ð ð ð r    rg   N)r$   Úcollections.abcr   Útypingr   Útelegram._chatr   Útelegram._files.stickerr   Útelegram._messageentityr   Útelegram._telegramobjectr   Útelegram._utils.argumentparsingr	   r
   r   Útelegram._utils.entitiesr   r   Útelegram._utils.typesr   Útelegramr   r   r*   rJ   rO   rg   © r    r   ú<module>ry      sÞ  ðð( AÐ @à $Ð $Ð $Ð $Ð $Ð $Ø  Ð  Ð  Ð  Ð  Ð  à Ð Ð Ð Ð Ð Ø +Ð +Ð +Ð +Ð +Ð +Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø bÐ bÐ bÐ bÐ bÐ bÐ bÐ bÐ bÐ bØ QÐ QÐ QÐ QÐ QÐ QÐ QÐ QØ *Ð *Ð *Ð *Ð *Ð *àð ØÐÐÐÐÐð.ð .ð .ð .ð .�^ñ .ô .ð .ðbY3ð Y3ð Y3ð Y3ð Y3ˆ>ñ Y3ô Y3ð Y3ðx%3ð %3ð %3ð %3ð %3ˆNñ %3ô %3ð %3ðPhGð hGð hGð hGð hGˆ~ñ hGô hGð hGðVFð Fð Fð Fð F˜ñ Fô Fð Fð Fð Fr    