Ë
    †j€#  ã                   óì   — d Z ddlZddl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 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 e	 edddd¬«       G d„ d«      «       «       Zy)z[This module contains a class that describes a single parameter of a request to the Bot API.é    N)ÚSequence)Ú	dataclass)Úfinal)ÚInputStoryContent)Ú	InputFile)Ú
InputMediaÚInputPaidMedia)ÚInputProfilePhotoÚInputProfilePhotoStatic)ÚInputSticker)ÚTelegramObject)Úto_timestamp)Ú
StringEnum)ÚUploadFileDictTF)ÚreprÚeqÚorderÚfrozenc                   óÀ   — e Zd ZU dZdZeed<   eed<   ee	   dz  ed<   e
dedz  fd„«       Ze
dedz  fd	„«       Zededeeee	   f   fd
„«       Zedededd fd„«       Zy)ÚRequestParameteraÀ  Instances of this class represent a single parameter to be sent along with a request to
    the Bot API.

    .. versionadded:: 20.0

    Warning:
        This class intended is to be used internally by the library and *not* by the user. Changes
        to this class are not considered breaking changes and may not be documented in the
        changelog.

    Args:
        name (:obj:`str`): The name of the parameter.
        value (:obj:`object` | :obj:`None`): The value of the parameter. Must be JSON-dumpable.
        input_files (list[:class:`telegram.InputFile`], optional): A list of files that should be
            uploaded along with this parameter.

    Attributes:
        name (:obj:`str`): The name of the parameter.
        value (:obj:`object` | :obj:`None`): The value of the parameter.
        input_files (list[:class:`telegram.InputFile` | :obj:`None`): A list of files that should
            be uploaded along with this parameter.
    )Úinput_filesÚnameÚvaluer   r   Nr   Úreturnc                 ó¦   — t        | j                  t        «      r| j                  S | j                  €yt        j                  | j                  «      S )zêThe JSON dumped :attr:`value` or :obj:`None` if :attr:`value` is :obj:`None`.
        The latter can currently only happen if :attr:`input_files` has exactly one element that
        must not be uploaded via an attach:// URI.
        N)Ú
isinstancer   ÚstrÚjsonÚdumps)Úselfs    úa/var/www/html/datingFans/myenv/lib/python3.12/site-packages/telegram/request/_requestparameter.pyÚ
json_valuezRequestParameter.json_valueF   s<   € ô �d—j‘j¤#Ô&Ø—:‘:ÐØ�:‰:ÐØÜ�z‰z˜$Ÿ*™*Ó%Ð%ó    c                 ó    — | j                   sy| j                   D �ci c]'  }|j                  xs | j                  |j                  “Œ) c}S c c}w )z…A dict with the file data to upload, if any.

        .. versionchanged:: 21.5
            Content may now be a file handle.
        N)r   Úattach_namer   Úfield_tuple)r    Ú
input_files     r!   Úmultipart_datazRequestParameter.multipart_dataR   sR   € ð ×ÒØð #×.Ñ.ö
àð ×#Ñ#Ò0 t§y¡y°:×3IÑ3IÑIò
ð 	
ùò 
s   œ,Ac                 ó>  — t        | t        j                  «      rt        | «      g fS t        | t        j                  «      r1| j                  «       }|j                  «       rt        |«      g fS |g fS t        | t        «      r| j                  g fS t        | t        «      r | j                  r| j                  | gfS d| gfS t        | t        t        z  «      rÛt        | j                  t        «      rÁ| j                  «       }| j                  j                  r| j                  j                  |d<   n|j!                  dd«       |j#                  dd«      }t        |t        «      r>|j                  r|j                  |d<   n|j!                  dd«       || j                  |gfS || j                  gfS t        | t$        «      rft        | t&        «      rdnd}t        t)        | |«      x}t        «      s| j                  «       g fS | j                  «       }|j                  ||<   ||gfS t        | t*        «      r^| j,                  }t        t)        | |«      x}t        «      s| j                  «       g fS | j                  «       }|j                  ||<   ||gfS t        | t.        «      rRt        | j0                  t        «      r8| j                  «       }| j0                  j                  |d<   || j0                  gfS t        | t2        «      r| j                  «       g fS | g fS )aX  Converts `value` into something that we can json-dump. Returns two values:
        1. the JSON-dumpable value. May be `None` in case the value is an InputFile which must
           not be uploaded via an attach:// URI
        2. A list of InputFiles that should be uploaded for this value

        Note that we handle files differently depending on whether attaching them via an URI of the
        form attach://<name> is documented to be allowed or not.
        There was some confusion whether this worked for all files, so that we stick to the
        documented ways for now.
        See https://github.com/tdlib/telegram-bot-api/issues/167 and
        https://github.com/tdlib/telegram-bot-api/issues/259

        This method only does some special casing for our own helper class StringEnum, but not
        for general enums. This is because:
        * tg.constants currently only uses IntEnum as second enum type and json dumping that
          is no problem
        * if a user passes a custom enum, it's unlikely that we can actually properly handle it
          even with some special casing.
        NÚmediaÚ	thumbnailÚphotoÚ	animationÚsticker)r   ÚdtmÚdatetimer   Ú	timedeltaÚtotal_secondsÚ
is_integerÚintr   r   r   Ú
attach_urir   r	   r*   Úto_dictÚpopÚgetr
   r   Úgetattrr   Útyper   r.   r   )r   ÚsecondsÚdatar+   Úattrr*   s         r!   Ú!_value_and_input_files_from_inputz2RequestParameter._value_and_input_files_from_input`   s¨  € ô. �eœSŸ\™\Ô*Ü Ó&¨Ð*Ð*Ü�eœSŸ]™]Ô+Ø×)Ñ)Ó+ˆGà×!Ñ!Ô#Ü˜7“| RÐ'Ð'ð ˜B�;ÐÜ�eœZÔ(Ø—;‘; �?Ð"Ü�eœYÔ'Ø×ÒØ×'Ñ'¨%¨Ð0Ð0Ø˜%˜�=Ð ä�eœZ¬.Ñ8Ô9¼jÈÏÉÔV_Ô>`ð —=‘=“?ˆDØ�{‰{×%Ò%Ø %§¡× 6Ñ 6��W’à—‘˜ $Ô'àŸ™ ¨dÓ3ˆIÜ˜)¤YÔ/Ø×'Ò'Ø(1×(<Ñ(<�D˜Ò%à—H‘H˜[¨$Ô/Ø˜eŸk™k¨9Ð5Ð5Ð5à˜%Ÿ+™+˜Ð&Ð&ä�eÔ.Ô/Ü(¨Ô0GÔH‘7ÈkˆDÜ¤w¨u°dÓ';Ð;˜e¼YÔGà—}‘}“¨Ð*Ð*ð —=‘=“?ˆDØ×)Ñ)ˆD�‰JØ˜%˜�=Ð ä�eÔ.Ô/Ø—:‘:ˆDÜ¤w¨u°dÓ';Ð;˜e¼YÔGà—}‘}“¨Ð*Ð*ð —=‘=“?ˆDØ×)Ñ)ˆD�‰JØ˜%˜�=Ð ä�eœ\Ô*¬z¸%¿-¹-ÌÔ/Sð —=‘=“?ˆDØ#Ÿm™m×6Ñ6ˆD�‰OØ˜%Ÿ-™-˜Ð(Ð(ä�eœ^Ô,à—=‘=“? BÐ&Ð&Ø�bˆyÐr#   Úkeyc                 óF  — t        |t        t        z  «      set        |t        «      rUg }g }|D ]:  }| j	                  |«      \  }}|�|j                  |«       |j                  |«       Œ< t        |||xs d¬«      S | j	                  |«      \  }}t        |||xs d¬«      S )z¢Builds an instance of this class for a given key-value pair that represents the raw
        input as passed along from a method of :class:`telegram.Bot`.
        N)r   r   r   )r   r   Úbytesr   r>   ÚappendÚextendr   )Úclsr?   r   Úparam_valuesr   ÚobjÚparam_valuer'   s           r!   Ú
from_inputzRequestParameter.from_input¿   s­   € ô
 ˜%¤¤u¡Ô-´*¸UÄHÔ2MØˆLØˆKØò /�Ø*-×*OÑ*OÐPSÓ*TÑ'�˜ZØÐ*Ø ×'Ñ'¨Ô4Ø×"Ñ" :Õ.ð	/ô
 $¨°LÈkÒNaÐ]aÔbÐbà#&×#HÑ#HÈÓ#OÑ ˆ�[Ü S°ÈÒI\ÐX\Ô]Ð]r#   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   Ú__annotations__ÚobjectÚlistr   Úpropertyr"   r   r(   ÚstaticmethodÚtupler>   ÚclassmethodrH   © r#   r!   r   r   &   sÊ   … ñð. 1€Ià
ƒIØƒMØ�i‘ 4Ñ'Ó'àð	&˜C $™Jò 	&ó ð	&ð ð
 °Ñ 5ò 
ó ð
ð ð\Øð\à	ˆv�t˜I‘Ð&Ñ	'ò\ó ð\ð| ð^˜Sð ^¨ð ^Ð4Fò ^ó ñ^r#   r   )rL   r0   r/   r   Úcollections.abcr   Údataclassesr   Útypingr   Ú"telegram._files._inputstorycontentr   Útelegram._files.inputfiler   Útelegram._files.inputmediar   r	   Ú!telegram._files.inputprofilephotor
   r   Útelegram._files.inputstickerr   Útelegram._telegramobjectr   Útelegram._utils.datetimer   Útelegram._utils.enumr   Útelegram._utils.typesr   r   rU   r#   r!   ú<module>rb      sg   ðñ& bã Û Ý $Ý !Ý å @Ý /ß Aß XÝ 5Ý 3Ý 1Ý +Ý 0ð Ù
�˜ e°DÔ9÷g^ð g^ó :ó ñg^r#   