Ë
    †j6O  ã                   ó(  — d Z ddlZddlmZ ddlmZ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 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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&y)z8This module contains objects that represent owned gifts.é    N)ÚSequence)ÚTYPE_CHECKINGÚFinal)Ú	constants)ÚGift)ÚMessageEntity)ÚTelegramObject)Ú
UniqueGift)ÚUser)Úenum)Úde_json_optionalÚde_list_optionalÚparse_sequence_arg)Úextract_tzinfo_from_defaultsÚfrom_timestamp)Úparse_message_entitiesÚparse_message_entity)ÚJSONDict)ÚBotc                   óâ   ‡ — e Zd ZU dZdZej                  j                  Zee	   e
d<   	 ej                  j                  Zee	   e
d<   	 ddœde	dedz  d	dfˆ fd
„Zeddeddd	d fˆ fd„«       Zˆ xZS )Ú	OwnedGiftaî  This object describes a gift received and owned by a user or a chat. Currently, it
    can be one of:

    * :class:`telegram.OwnedGiftRegular`
    * :class:`telegram.OwnedGiftUnique`

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

    .. versionadded:: 22.1

    Args:
        type (:obj:`str`): Type of the owned gift.

    Attributes:
        type (:obj:`str`): Type of the owned gift.
    )ÚtypeÚREGULARÚUNIQUEN©Ú
api_kwargsr   r   Úreturnc                ó¾   •— t         ‰| �  |¬«       t        j                  t        j
                  ||«      | _        | j                  f| _        | j                  «        y ©Nr   )	ÚsuperÚ__init__r   Ú
get_memberr   ÚOwnedGiftTyper   Ú	_id_attrsÚ_freeze)Úselfr   r   Ú	__class__s      €úR/var/www/html/datingFans/myenv/lib/python3.12/site-packages/telegram/_ownedgift.pyr!   zOwnedGift.__init__C   sE   ø€ ô 	‰Ñ JÐÔ/ÜŸ™¬×)@Ñ)@À$ÈÓMˆŒ	àŸ)™)˜ˆŒØ�‰�ó    ÚdataÚbotú
Bot | Nonec                 ó  •— | j                  |«      }| j                  t        | j                  t        i}| t
        u r8|j                  d«      |v r%||j                  d«         j                  ||¬«      S t        ‰| �!  ||¬«      S )aX  Converts JSON data to the appropriate :class:`OwnedGift` object, i.e. takes
        care of selecting the correct subclass.

        Args:
            data (dict[:obj:`str`, ...]): The JSON data.
            bot (:class:`telegram.Bot`, optional): The bot associated with this object.

        Returns:
            The Telegram object.

        r   ©r*   r+   )
Ú_parse_datar   ÚOwnedGiftRegularr   ÚOwnedGiftUniquer   ÚgetÚpopÚde_jsonr    )Úclsr*   r+   Ú_class_mappingr'   s       €r(   r4   zOwnedGift.de_jsonO   s€   ø€ ð �‰˜tÓ$ˆð �K‰KÔ)Ø�J‰Jœð6
ˆð
 ”)Ñ §¡¨Ó 0°NÑ BØ! $§(¡(¨6Ó"2Ñ3×;Ñ;ÀÈ3Ð;ÓOÐOä‰w‰ D¨cˆÓ2Ð2r)   ©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r#   r   r   ÚstrÚ__annotations__r   r   r!   Úclassmethodr4   Ú__classcell__©r'   s   @r(   r   r   )   sœ   ø… ñð$ €Ià#×1Ñ1×9Ñ9€GˆU�3‰ZÓ9Ø;Ø"×0Ñ0×7Ñ7€FˆE�#‰JÓ7Ø:ð '+ò	
àð
ð ˜t‘Oð	
ð
 
õ
ð ñ3˜8ð 3¨,ð 3À+ô 3ó ô3r)   r   c                   óx   ‡ — e Zd ZdZdZ	 dddœdedee   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 )Ú
OwnedGiftsau  Contains the list of gifts received and owned by 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:`total_count` and :attr:`gifts` are equal.

    .. versionadded:: 22.1

    Args:
        total_count (:obj:`int`): The total number of gifts owned by the user or the chat.
        gifts (Sequence[:class:`telegram.OwnedGift`]): The list of gifts.
        next_offset (:obj:`str`, optional): Offset for the next request. If empty,
            then there are no more results.

    Attributes:
        total_count (:obj:`int`): The total number of gifts owned by the user or the chat.
        gifts (Sequence[:class:`telegram.OwnedGift`]): The list of gifts.
        next_offset (:obj:`str`): Optional. Offset for the next request. If empty,
            then there are no more results.
    )ÚgiftsÚnext_offsetÚtotal_countNr   rF   rD   rE   r   c                ó¼   •— t         ‰| �  |¬«       || _        t        |«      | _        || _        | j                  | j                  f| _        | j                  «        y r   )r    r!   rF   r   rD   rE   r$   r%   )r&   rF   rD   rE   r   r'   s        €r(   r!   zOwnedGifts.__init__„   sP   ø€ ô 	‰Ñ JÐÔ/Ø +ˆÔÜ,>¸uÓ,EˆŒ
Ø'2ˆÔà×*Ñ*¨D¯J©JÐ7ˆŒà�‰�r)   r*   r+   r,   r   c                 óŽ   •— | j                  |«      }t        |j                  d«      t        |«      |d<   t        ‰| �  ||¬«      S )z,See :meth:`telegram.TelegramObject.de_json`.rD   r.   )r/   r   r2   r   r    r4   )r5   r*   r+   r'   s      €r(   r4   zOwnedGifts.de_json•   sA   ø€ ð �‰˜tÓ$ˆä(¨¯©°'Ó):¼IÀsÓKˆˆW‰Ü‰w‰ D¨cˆÓ2Ð2r)   r7   )r8   r9   r:   r;   r<   Úintr   r   r=   r   r!   r?   r4   r@   rA   s   @r(   rC   rC   i   s   ø„ ñð(€Ið #'ð	ð '+òàðð ˜	Ñ"ðð ˜4‘Zð	ð ˜t‘Oõð" ñ3˜8ð 3¨,ð 3À,ô 3ó ô3r)   rC   c            "       óL  ‡ — e Zd ZdZdZ	 	 	 	 	 	 	 	 	 	 	 	 dddœdedej                  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  dedz  dedz  dedz  dedz  dedz  dd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 ) r0   a�  Describes a regular gift owned by 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:`gift` and :attr:`send_date` are equal.

    .. versionadded:: 22.1

    Args:
        gift (:class:`telegram.Gift`): Information about the regular gift.
        owned_gift_id (:obj:`str`, optional): Unique identifier of the gift for the bot; for
            gifts received on behalf of business accounts only.
        sender_user (:class:`telegram.User`, optional): Sender of the gift if it is a known user.
        send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`.
            |datetime_localization|.
        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_saved (:obj:`bool`, optional): :obj:`True`, if the gift is displayed on the account's
            profile page; for gifts received on behalf of business accounts only.
        can_be_upgraded (:obj:`bool`, optional): :obj:`True`, if the gift can be upgraded to a
            unique gift; for gifts received on behalf of business accounts only.
        was_refunded (:obj:`bool`, optional): :obj:`True`, if the gift was refunded and isn't
            available anymore.
        convert_star_count (:obj:`int`, optional): Number of Telegram Stars that can be
            claimed by the receiver instead of the gift; omitted if the gift cannot be converted
            to Telegram Stars; for gifts received on behalf of business accounts only.
        prepaid_upgrade_star_count (:obj:`int`, optional): Number of Telegram Stars that were
            paid for the ability to upgrade the gift.
        is_upgrade_separate (:obj:`bool`, optional): :obj:`True`, if the gift's upgrade was
            purchased after the gift was sent; for gifts received on behalf of business accounts

            .. 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:
        type (:obj:`str`): Type of the gift, always :attr:`~telegram.OwnedGift.REGULAR`.
        gift (:class:`telegram.Gift`): Information about the regular gift.
        owned_gift_id (:obj:`str`): Optional. Unique identifier of the gift for the bot; for
            gifts received on behalf of business accounts only.
        sender_user (:class:`telegram.User`): Optional. Sender of the gift if it is a known user.
        send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`.
            |datetime_localization|.
        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_saved (:obj:`bool`): Optional. :obj:`True`, if the gift is displayed on the account's
            profile page; for gifts received on behalf of business accounts only.
        can_be_upgraded (:obj:`bool`): Optional. :obj:`True`, if the gift can be upgraded to a
            unique gift; for gifts received on behalf of business accounts only.
        was_refunded (:obj:`bool`): Optional. :obj:`True`, if the gift was refunded and isn't
            available anymore.
        convert_star_count (:obj:`int`): Optional. Number of Telegram Stars that can be
            claimed by the receiver instead of the gift; omitted if the gift cannot be converted
            to Telegram Stars; for gifts received on behalf of business accounts only.
        prepaid_upgrade_star_count (:obj:`int`): Optional. Number of Telegram Stars that were
            paid for the ability to upgrade the gift.
        is_upgrade_separate (:obj:`bool`): Optional. :obj:`True`, if the gift's upgrade was
            purchased after the gift was sent; for gifts received on behalf of business accounts

            .. 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_savedÚis_upgrade_separateÚowned_gift_idÚprepaid_upgrade_star_countÚ	send_dateÚsender_userÚtextÚunique_gift_numberÚwas_refundedNr   rN   rT   rR   rU   rV   rM   rO   rP   rK   rX   rL   rS   rQ   rW   r   r   c                ó´  •— t         ‰| �  t        j                  |¬«       | j	                  «       5  || _        || _        || _        || _        || _	        t        |«      | _        || _        || _        |	| _        |
| _        || _        || _        || _        || _        | j(                  | j
                  | j                  f| _        d d d «       y # 1 sw Y   y xY w©N)r   r   )r    r!   r   r   Ú	_unfrozenrN   rT   rR   rU   rV   r   rM   rO   rP   rK   rX   rL   rS   rQ   rW   r   r$   )r&   rN   rT   rR   rU   rV   rM   rO   rP   rK   rX   rL   rS   rQ   rW   r   r'   s                   €r(   r!   zOwnedGiftRegular.__init__ú   sÉ   ø€ ô& 	‰Ñœi×/Ñ/¸JÐÔGà�^‰^Óñ 	DØ"ˆDŒIØ+4ˆDŒNØ-:ˆDÔØ,7ˆDÔØ$(ˆDŒIÜ7IÈ(Ó7SˆDŒMØ+5ˆDŒOØ)1ˆDŒMØ0?ˆDÔ Ø-9ˆDÔØ2DˆDÔ#Ø:TˆDÔ+Ø4GˆDÔ$Ø2DˆDÔ#à"Ÿi™i¨¯©°D·N±NÐCˆDŒN÷!	D÷ 	Dñ 	Dús   ±BCÃCr*   r+   r,   c                 ón  •— | j                  |«      }t        |«      }t        |j                  d«      |¬«      |d<   t	        |j                  d«      t
        |«      |d<   t	        |j                  d«      t        |«      |d<   t        |j                  d«      t        |«      |d<   t        ‰| �)  ||¬«      S )ú'See :meth:`telegram.OwnedGift.de_json`.rT   ©ÚtzinforU   rN   rM   r.   )r/   r   r   r2   r   r   r   r   r   r    r4   ©r5   r*   r+   Ú
loc_tzinfor'   s       €r(   r4   zOwnedGiftRegular.de_json!  sž   ø€ ð �‰˜tÓ$ˆä1°#Ó6ˆ
Ü*¨4¯8©8°KÓ+@ÈÔTˆˆ[ÑÜ.¨t¯x©x¸Ó/FÌÈcÓRˆˆ]ÑÜ'¨¯©°Ó(8¼$ÀÓDˆˆV‰Ü+¨D¯H©H°ZÓ,@Ä-ÐQTÓUˆˆZÑä‰w‰ D¨cˆÓ2Ð2r)   Úentityc                 ó\   — | 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 ``OwnedGiftRegular.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 owned gift has no text.

        ú$This OwnedGiftRegular has no 'text'.)rV   ÚRuntimeErrorr   )r&   rb   s     r(   Úparse_entityzOwnedGiftRegular.parse_entity.  s(   € ð( �yŠyÜÐEÓFÐFä# D§I¡I¨vÓ6Ð6r)   Útypesc                 ór   — | j                   st        d«      ‚t        | j                   | j                  |«      S )aQ  
        Returns a :obj:`dict` that maps :class:`telegram.MessageEntity` to :obj:`str`.
        It contains entities from this owned gift'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 owned gift has no text.

        rd   )rV   re   r   rM   )r&   rg   s     r(   Úparse_entitieszOwnedGiftRegular.parse_entitiesG  s.   € ð0 �yŠyÜÐEÓFÐFä% d§i¡i°·±ÀÓFÐFr)   )NNNNNNNNNNNNr7   )r8   r9   r:   r;   r<   r   ÚdtmÚdatetimer=   r   r   r   ÚboolrI   r   r!   r?   r4   rf   ÚlistÚdictri   r@   rA   s   @r(   r0   r0   ž   sœ  ø„ ñHðT€Ið* %)Ø#'ØØ37Ø"&Ø $Ø'+Ø$(Ø)-Ø15Ø+/Ø)-ð%Dð" '+ò#%Dàð%Dð —<‘<ð%Dð ˜T‘zð	%Dð
 ˜D‘[ð%Dð �D‰jð%Dð ˜=Ñ)¨DÑ0ð%Dð ˜4‘Kð%Dð ˜‘+ð%Dð  ™ð%Dð ˜T‘kð%Dð   $™Jð%Dð %(¨$¡Jð%Dð " D™[ð%Dð   $™Jð%Dð" ˜t‘Oð#%Dð$ 
õ%%DðN ñ
3˜8ð 
3¨,ð 
3ÐBTô 
3ó ð
3ð7 =ð 7°Só 7ñ2G D¨¡I°Ñ$4ð GÀÀ]ÐTWÐEWÑ@X÷ Gr)   r0   c                   óÚ   ‡ — e Zd ZdZdZ	 	 	 	 	 	 dddœdedej                  dedz  de	dz  d	e
dz  d
e
dz  dedz  dej                  dz  dedz  ddfˆ fd„Zeddedddd fˆ fd„«       Zˆ xZS )r1   ah  
    Describes a unique gift received and owned by 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:`gift` and :attr:`send_date` are equal.

    .. versionadded:: 22.1

    Args:
        gift (:class:`telegram.UniqueGift`): Information about the unique gift.
        owned_gift_id (:obj:`str`, optional): Unique identifier of the received gift for the
            bot; for gifts received on behalf of business accounts only.
        sender_user (:class:`telegram.User`, optional): Sender of the gift if it is a known user.
        send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`.
            |datetime_localization|
        is_saved (:obj:`bool`, optional): :obj:`True`, if the gift is displayed on the account's
            profile page; for gifts received on behalf of business accounts only.
        can_be_transferred (:obj:`bool`, optional): :obj:`True`, if the gift can be transferred to
            another owner; for gifts received on behalf of business accounts only.
        transfer_star_count (:obj:`int`, optional): Number of Telegram Stars that must be paid
            to transfer the gift; omitted if the bot cannot transfer the gift.
        next_transfer_date (:obj:`datetime.datetime`, optional): Date when the gift can be
            transferred. If it's in the past, then the gift can be transferred now.
            |datetime_localization|
            .. versionadded:: 22.3

    Attributes:
        type (:obj:`str`): Type of the owned gift, always :tg-const:`~telegram.OwnedGift.UNIQUE`.
        gift (:class:`telegram.UniqueGift`): Information about the unique gift.
        owned_gift_id (:obj:`str`): Optional. Unique identifier of the received gift for the
            bot; for gifts received on behalf of business accounts only.
        sender_user (:class:`telegram.User`): Optional. Sender of the gift if it is a known user.
        send_date (:obj:`datetime.datetime`): Date the gift was sent as :class:`datetime.datetime`.
            |datetime_localization|
        is_saved (:obj:`bool`): Optional. :obj:`True`, if the gift is displayed on the account's
            profile page; for gifts received on behalf of business accounts only.
        can_be_transferred (:obj:`bool`): Optional. :obj:`True`, if the gift can be transferred to
            another owner; for gifts received on behalf of business accounts only.
        transfer_star_count (:obj:`int`): Optional. Number of Telegram Stars that must be paid
            to transfer the gift; omitted if the bot cannot transfer the gift.
        next_transfer_date (:obj:`datetime.datetime`): Optional. Date when the gift can be
            transferred. If it's in the past, then the gift can be transferred now.
            |datetime_localization|
            .. versionadded:: 22.3
    )Úcan_be_transferredrN   rP   Únext_transfer_daterR   rT   rU   Útransfer_star_countNr   rN   rT   rR   rU   rP   rp   rr   rq   r   r   c	                óN  •— t         ‰
| �  t        j                  |	¬«       | j	                  «       5  || _        || _        || _        || _        || _	        || _
        || _        || _        | j                  | j
                  | j                  f| _        d d d «       y # 1 sw Y   y xY wrZ   )r    r!   r   r   r[   rN   rT   rR   rU   rP   rp   rr   rq   r   r$   )r&   rN   rT   rR   rU   rP   rp   rr   rq   r   r'   s             €r(   r!   zOwnedGiftUnique.__init__Ÿ  s—   ø€ ô 	‰Ñœi×.Ñ.¸:ÐÔFà�^‰^Óñ 
	DØ$(ˆDŒIØ+4ˆDŒNØ-:ˆDÔØ,7ˆDÔØ)1ˆDŒMØ3EˆDÔ#Ø3FˆDÔ$Ø;MˆDÔ#à"Ÿi™i¨¯©°D·N±NÐCˆDŒN÷
	D÷ 
	Dñ 
	Dús   ±A!BÂB$r*   r+   r,   c                 óf  •— | j                  |«      }t        |«      }t        |j                  d«      |¬«      |d<   t	        |j                  d«      t
        |«      |d<   t	        |j                  d«      t        |«      |d<   t        |j                  d«      |¬«      |d<   t        ‰| �!  ||¬«      S )r]   rT   r^   rU   rN   rq   r.   )	r/   r   r   r2   r   r   r
   r    r4   r`   s       €r(   r4   zOwnedGiftUnique.de_jsonº  s¢   ø€ ð �‰˜tÓ$ˆä1°#Ó6ˆ
Ü*¨4¯8©8°KÓ+@ÈÔTˆˆ[ÑÜ.¨t¯x©x¸Ó/FÌÈcÓRˆˆ]ÑÜ'¨¯©°Ó(8¼*ÀcÓJˆˆV‰Ü%3Ø�H‰HÐ)Ó*°:ô&
ˆÐ!Ñ"ô ‰w‰ D¨cˆÓ2Ð2r)   )NNNNNNr7   )r8   r9   r:   r;   r<   r
   rj   rk   r=   r   rl   rI   r   r!   r?   r4   r@   rA   s   @r(   r1   r1   e  sð   ø„ ñ,ð\	€Ið %)Ø#'Ø $Ø*.Ø*.Ø26ðDð '+òDàðDð —<‘<ðDð ˜T‘zð	Dð
 ˜D‘[ðDð ˜‘+ðDð ! 4™KðDð ! 4™ZðDð  ŸL™L¨4Ñ/ðDð ˜t‘OðDð 
õDð6 ñ3˜8ð 3¨,ð 3ÐBSô 3ó ô3r)   r1   )'r;   rk   rj   Úcollections.abcr   Útypingr   r   Útelegramr   Útelegram._giftsr   Útelegram._messageentityr   Útelegram._telegramobjectr	   Útelegram._uniquegiftr
   Útelegram._userr   Útelegram._utilsr   Útelegram._utils.argumentparsingr   r   r   Útelegram._utils.datetimer   r   Útelegram._utils.entitiesr   r   Útelegram._utils.typesr   r   r   rC   r0   r1   © r)   r(   ú<module>rƒ      sv   ðñ& ?ã Ý $ß 'å Ý  Ý 1Ý 3Ý +Ý Ý  ß bÑ bß Qß QÝ *áÝô=3�ô =3ô@23�ô 23ôjDG�yô DGôNb3�iõ b3r)   