§
     @g°&  ã                  óœ  — d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
  G d„ d¦  «        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 G d„ d¦  «        Z G d„ d¦  «        Z G d„ d¦  «        Z G d„ d¦  «        ZeeeedœZe€e                     d¦  «         dS dS )zq
Handlers for Content-Encoding.

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
é    )ÚannotationsNé   )Úbrotli)ÚDecodingErrorc                  ó   — e Zd Zdd„Zdd„ZdS )	ÚContentDecoderÚdataÚbytesÚreturnc                ó   — t          ¦   «         ‚©N©ÚNotImplementedError©Úselfr	   s     úC/var/www/piapp/venv/lib/python3.11/site-packages/httpx/_decoders.pyÚdecodezContentDecoder.decode   ó   € Ý!Ñ#Ô#Ð#ó    c                ó   — t          ¦   «         ‚r   r   ©r   s    r   ÚflushzContentDecoder.flush   r   r   N©r	   r
   r   r
   ©r   r
   )Ú__name__Ú
__module__Ú__qualname__r   r   © r   r   r   r      s<   € € € € € ð$ð $ð $ð $ð$ð $ð $ð $ð $ð $r   r   c                  ó"   — e Zd ZdZdd„Zd	d„ZdS )
ÚIdentityDecoderz 
    Handle unencoded data.
    r	   r
   r   c                ó   — |S r   r   r   s     r   r   zIdentityDecoder.decode   s   € Øˆr   c                ó   — dS ©Nr   r   r   s    r   r   zIdentityDecoder.flush!   s   € Øˆsr   Nr   r   )r   r   r   Ú__doc__r   r   r   r   r   r    r       sF   € € € € € ðð ðð ð ð ðð ð ð ð ð r   r    c                  ó*   — e Zd ZdZd
d„Zdd„Zdd„Zd	S )ÚDeflateDecoderzZ
    Handle 'deflate' decoding.

    See: https://stackoverflow.com/questions/1838699
    r   ÚNonec                óD   — d| _         t          j        ¦   «         | _        d S )NT)Úfirst_attemptÚzlibÚdecompressobjÚdecompressorr   s    r   Ú__init__zDeflateDecoder.__init__,   s!   € Ø!ˆÔÝ Ô.Ñ0Ô0ˆÔÐÐr   r	   r
   c                ó<  — | j         }d| _         	 | j                             |¦  «        S # t          j        $ rb}|r>t          j        t          j         ¦  «        | _        |                      |¦  «        cY d }~S t          t          |¦  «        ¦  «        |‚d }~ww xY w©NF)
r)   r,   Ú
decompressr*   Úerrorr+   Ú	MAX_WBITSr   r   Ústr)r   r	   Úwas_first_attemptÚexcs       r   r   zDeflateDecoder.decode0   s¦   € Ø Ô.ÐØ"ˆÔð	3ØÔ$×/Ò/°Ñ5Ô5Ð5øÝŒzð 	3ð 	3ð 	3Ø ð )Ý$(Ô$6½¼°Ñ$GÔ$G�Ô!Ø—{’{ 4Ñ(Ô(Ð(Ð(Ð(Ð(Ð(Ð(Ý¥ C¡¤Ñ)Ô)¨sÐ2øøøøð		3øøøs    �* ªB¹:BÁ3BÁ9BÂBc                óž   — 	 | j                              ¦   «         S # t          j        $ r"}t	          t          |¦  «        ¦  «        |‚d }~ww xY wr   ©r,   r   r*   r1   r   r3   ©r   r5   s     r   r   zDeflateDecoder.flush;   óS   € ð	3ØÔ$×*Ò*Ñ,Ô,Ð,øÝŒzð 	3ð 	3ð 	3Ý¥ C¡¤Ñ)Ô)¨sÐ2øøøøð	3øøøó   ‚ ›AªAÁAN©r   r'   r   r   ©r   r   r   r$   r-   r   r   r   r   r   r&   r&   %   sZ   € € € € € ðð ð1ð 1ð 1ð 1ð	3ð 	3ð 	3ð 	3ð3ð 3ð 3ð 3ð 3ð 3r   r&   c                  ó*   — e Zd ZdZd
d„Zdd„Zdd„Zd	S )ÚGZipDecoderzW
    Handle 'gzip' decoding.

    See: https://stackoverflow.com/questions/1838699
    r   r'   c                óR   — t          j        t           j        dz  ¦  «        | _        d S )Né   )r*   r+   r2   r,   r   s    r   r-   zGZipDecoder.__init__I   s"   € Ý Ô.­t¬~ÀÑ/BÑCÔCˆÔÐÐr   r	   r
   c                ó    — 	 | j                              |¦  «        S # t          j        $ r"}t	          t          |¦  «        ¦  «        |‚d }~ww xY wr   )r,   r0   r*   r1   r   r3   ©r   r	   r5   s      r   r   zGZipDecoder.decodeL   sU   € ð	3ØÔ$×/Ò/°Ñ5Ô5Ð5øÝŒzð 	3ð 	3ð 	3Ý¥ C¡¤Ñ)Ô)¨sÐ2øøøøð	3øøøs   ‚ œA«AÁAc                óž   — 	 | j                              ¦   «         S # t          j        $ r"}t	          t          |¦  «        ¦  «        |‚d }~ww xY wr   r7   r8   s     r   r   zGZipDecoder.flushR   r9   r:   Nr;   r   r   r<   r   r   r   r>   r>   B   s^   € € € € € ðð ðDð Dð Dð Dð3ð 3ð 3ð 3ð3ð 3ð 3ð 3ð 3ð 3r   r>   c                  ó*   — e Zd ZdZd
d„Zdd„Zdd„Zd	S )ÚBrotliDecoderaT  
    Handle 'brotli' decoding.

    Requires `pip install brotlipy`. See: https://brotlipy.readthedocs.io/
        or   `pip install brotli`. See https://github.com/google/brotli
    Supports both 'brotlipy' and 'Brotli' packages since they share an import
    name. The top branches are for 'brotlipy' and bottom branches for 'Brotli'
    r   r'   c                óè   — t           €t          d¦  «        d ‚t          j        ¦   «         | _        d| _        |  t          | j        d¦  «        r| j        j        | _        d S | j        j        | _        d S )NzžUsing 'BrotliDecoder', but neither of the 'brotlicffi' or 'brotli' packages have been installed. Make sure to install httpx using `pip install httpx[brotli]`.Fr0   )	r   ÚImportErrorÚDecompressorr,   Ú	seen_dataÚhasattrr0   Ú_decompressÚprocessr   s    r   r-   zBrotliDecoder.__init__c   sƒ   € Ýˆ>ÝðPñô ð ð	õ #Ô/Ñ1Ô1ˆÔØˆŒØÐ9Ý�4Ô$ lÑ3Ô3ð 	9à#Ô0Ô;ˆDÔÐÐð  $Ô0Ô8ˆDÔÐÐr   r	   r
   c                ó¬   — |sdS d| _         	 |                      |¦  «        S # t          j        $ r"}t	          t          |¦  «        ¦  «        |‚d }~ww xY w©Nr   T)rI   rK   r   r1   r   r3   rB   s      r   r   zBrotliDecoder.decodeu   sf   € Øð 	Ø�3ØˆŒð	3Ø×#Ò# DÑ)Ô)Ð)øÝŒ|ð 	3ð 	3ð 	3Ý¥ C¡¤Ñ)Ô)¨sÐ2øøøøð	3øøøs   �" ¢A±AÁAc                óÞ   — | j         sdS 	 t          | j        d¦  «        r| j                             ¦   «          dS # t          j        $ r"}t          t          |¦  «        ¦  «        |‚d }~ww xY w)Nr   Úfinish)rI   rJ   r,   rP   r   r1   r   r3   r8   s     r   r   zBrotliDecoder.flush~   s~   € ØŒ~ð 	Ø�3ð
	3Ý�tÔ(¨(Ñ3Ô3ð +ð Ô!×(Ò(Ñ*Ô*Ð*Ø�3øÝŒ|ð 	3ð 	3ð 	3Ý¥ C¡¤Ñ)Ô)¨sÐ2øøøøð	3øøøs   ‹.; »A,Á
A'Á'A,Nr;   r   r   r<   r   r   r   rE   rE   Y   sZ   € € € € € ðð ð9ð 9ð 9ð 9ð$3ð 3ð 3ð 3ð3ð 3ð 3ð 3ð 3ð 3r   rE   c                  ó*   — e Zd ZdZdd„Zdd	„Zdd
„ZdS )ÚMultiDecoderzE
    Handle the case where multiple encodings have been applied.
    Úchildrenútyping.Sequence[ContentDecoder]r   r'   c                óH   — t          t          |¦  «        ¦  «        | _        dS )zm
        'children' should be a sequence of decoders in the order in which
        each was applied.
        N)ÚlistÚreversedrS   )r   rS   s     r   r-   zMultiDecoder.__init__“   s   € õ �X hÑ/Ô/Ñ0Ô0ˆŒˆˆr   r	   r
   c                óD   — | j         D ]}|                     |¦  «        }Œ|S r   )rS   r   ©r   r	   Úchilds      r   r   zMultiDecoder.decode›   s+   € Ø”]ð 	&ð 	&ˆEØ—<’< Ñ%Ô%ˆDˆDØˆr   c                ór   — d}| j         D ],}|                     |¦  «        |                     ¦   «         z   }Œ-|S r#   )rS   r   r   rY   s      r   r   zMultiDecoder.flush    s=   € ØˆØ”]ð 	6ð 	6ˆEØ—<’< Ñ%Ô%¨¯ª©¬Ñ5ˆDˆDØˆr   N)rS   rT   r   r'   r   r   r<   r   r   r   rR   rR   Ž   sZ   € € € € € ðð ð1ð 1ð 1ð 1ðð ð ð ð
ð ð ð ð ð r   rR   c                  ó,   — e Zd ZdZddd„Zdd„Zdd„ZdS )ÚByteChunkerz>
    Handles returning byte content in fixed-size chunks.
    NÚ
chunk_sizeú
int | Noner   r'   c                óD   — t          j        ¦   «         | _        || _        d S r   )ÚioÚBytesIOÚ_bufferÚ_chunk_size©r   r^   s     r   r-   zByteChunker.__init__¬   s   € Ý”z‘|”|ˆŒØ%ˆÔÐÐr   Úcontentr
   úlist[bytes]c                ó�  ‡ ‡— ‰ j         €|r|gng S ‰ j                             |¦  «         ‰ j                             ¦   «         ‰ j         k    rù‰ j                             ¦   «         Šˆ ˆfd„t          dt          ‰¦  «        ‰ j         ¦  «        D ¦   «         }t          |d         ¦  «        ‰ j         k    r5‰ j                             d¦  «         ‰ j                             ¦   «          |S ‰ j                             d¦  «         ‰ j                             |d         ¦  «         ‰ j                             ¦   «          |d d…         S g S )Nc                ó4   •— g | ]}‰||‰j         z   …         ‘ŒS r   ©rd   ©Ú.0Úir   Úvalues     €€r   ú
<listcomp>z&ByteChunker.decode.<locals>.<listcomp>·   ó;   ø€ ð ð ð àð �a˜!˜dÔ.Ñ.Ð.Ô/ðð ð r   r   éÿÿÿÿ©	rd   rc   ÚwriteÚtellÚgetvalueÚrangeÚlenÚseekÚtruncate©r   rf   Úchunksrn   s   `  @r   r   zByteChunker.decode°   óE  øø€ ØÔÐ#Ø 'Ð/�G�9�9¨RÐ/àŒ×Ò˜7Ñ#Ô#Ð#ØŒ<×ÒÑÔ $Ô"2Ò2Ð2Ø”L×)Ò)Ñ+Ô+ˆEðð ð ð ð å˜q¥# e¡*¤*¨dÔ.>Ñ?Ô?ðñ ô ˆFõ �6˜"”:‰Œ $Ô"2Ò2Ð2Ø”×!Ò! !Ñ$Ô$Ð$Ø”×%Ò%Ñ'Ô'Ð'Ø�à”×!Ò! !Ñ$Ô$Ð$Ø”×"Ò" 6¨"¤:Ñ.Ô.Ð.Ø”×%Ò%Ñ'Ô'Ð'Ø˜c˜r˜c”{Ð"àˆIr   c                ó¨   — | j                              ¦   «         }| j                              d¦  «         | j                              ¦   «          |r|gng S ©Nr   ©rc   ru   rx   ry   ©r   rn   s     r   r   zByteChunker.flushÇ   óP   € Ø”×%Ò%Ñ'Ô'ˆØŒ×Ò˜!ÑÔÐØŒ×ÒÑÔÐØÐ'�ˆwˆw RÐ'r   r   ©r^   r_   r   r'   )rf   r
   r   rg   )r   rg   r<   r   r   r   r]   r]   §   ó_   € € € € € ðð ð&ð &ð &ð &ð &ðð ð ð ð.(ð (ð (ð (ð (ð (r   r]   c                  ó,   — e Zd ZdZddd„Zdd„Zdd„ZdS )ÚTextChunkerz>
    Handles returning text content in fixed-size chunks.
    Nr^   r_   r   r'   c                óD   — t          j        ¦   «         | _        || _        d S r   )ra   ÚStringIOrc   rd   re   s     r   r-   zTextChunker.__init__Ó   s   € Ý”{‘}”}ˆŒØ%ˆÔÐÐr   rf   r3   ú	list[str]c                ó�  ‡ ‡— ‰ j         €|r|gng S ‰ j                             |¦  «         ‰ j                             ¦   «         ‰ j         k    rù‰ j                             ¦   «         Šˆ ˆfd„t          dt          ‰¦  «        ‰ j         ¦  «        D ¦   «         }t          |d         ¦  «        ‰ j         k    r5‰ j                             d¦  «         ‰ j                             ¦   «          |S ‰ j                             d¦  «         ‰ j                             |d         ¦  «         ‰ j                             ¦   «          |d d…         S g S )Nc                ó4   •— g | ]}‰||‰j         z   …         ‘ŒS r   rj   rk   s     €€r   ro   z&TextChunker.decode.<locals>.<listcomp>Þ   rp   r   r   rq   rr   rz   s   `  @r   r   zTextChunker.decode×   r|   r   c                ó¨   — | j                              ¦   «         }| j                              d¦  «         | j                              ¦   «          |r|gng S r~   r   r€   s     r   r   zTextChunker.flushî   r�   r   r   r‚   )rf   r3   r   rˆ   ©r   rˆ   r<   r   r   r   r…   r…   Î   rƒ   r   r…   c                  ó,   — e Zd ZdZddd„Zdd
„Zdd„ZdS )ÚTextDecoderz8
    Handles incrementally decoding bytes into text
    úutf-8Úencodingr3   r   r'   c                óL   —  t          j        |¦  «        d¬¦  «        | _        d S )NÚreplace)Úerrors)ÚcodecsÚgetincrementaldecoderÚdecoder)r   r�   s     r   r-   zTextDecoder.__init__ú   s%   € Ø=•vÔ3°HÑ=Ô=ÀYÐOÑOÔOˆŒˆˆr   r	   r
   c                ó6   — | j                              |¦  «        S r   ©r–   r   r   s     r   r   zTextDecoder.decodeý   s   € ØŒ|×"Ò" 4Ñ(Ô(Ð(r   c                ó8   — | j                              dd¦  «        S rN   r˜   r   s    r   r   zTextDecoder.flush   s   € ØŒ|×"Ò" 3¨Ñ-Ô-Ð-r   N)r�   )r�   r3   r   r'   )r	   r
   r   r3   )r   r3   r<   r   r   r   rŽ   rŽ   õ   sd   € € € € € ðð ðPð Pð Pð Pð Pð)ð )ð )ð )ð.ð .ð .ð .ð .ð .r   rŽ   c                  ó*   — e Zd ZdZdd„Zdd„Zdd	„Zd
S )ÚLineDecoderz—
    Handles incrementally reading lines from text.

    Has the same behaviour as the stdllib splitlines,
    but handling the input iteratively.
    r   r'   c                ó"   — g | _         d| _        d S r/   )ÚbufferÚtrailing_crr   s    r   r-   zLineDecoder.__init__  s   € Ø!#ˆŒØ!&ˆÔÐÐr   Útextr3   rˆ   c                óà  — d}| j         rd|z   }d| _         |                     d¦  «        rd| _         |d d…         }|sg S |d         |v }|                     ¦   «         }t          |¦  «        dk    r$|s"| j                             |d         ¦  «         g S | j        r6d                     | j        ¦  «        |d         z   g|dd …         z   }g | _        |s|                     ¦   «         g| _        |S )	Nu   
Â…â€¨â€©úFTrq   r   r   Ú )rž   ÚendswithÚ
splitlinesrw   r�   ÚappendÚjoinÚpop)r   rŸ   ÚNEWLINE_CHARSÚtrailing_newlineÚliness        r   r   zLineDecoder.decode  s  € àBˆð Ôð 	%Ø˜$‘;ˆDØ$ˆDÔØ�=Š=˜ÑÔð 	Ø#ˆDÔØ˜˜˜”9ˆDàð 	ð ˆIà œ8 }Ð4ÐØ—’Ñ!Ô!ˆåˆu‰:Œ:˜Š?ˆ?Ð#3ˆ?àŒK×Ò˜u QœxÑ(Ô(Ð(ØˆIàŒ;ð 	ð —W’W˜Tœ[Ñ)Ô)¨E°!¬HÑ4Ð5¸¸a¸b¸b¼	ÑAˆEØˆDŒKàð 	(ð !Ÿ9š9™;œ;˜-ˆDŒKàˆr   c                óx   — | j         s	| j        sg S d                     | j         ¦  «        g}g | _         d| _        |S )Nr¢   F)r�   rž   r¦   )r   rª   s     r   r   zLineDecoder.flush6  sE   € ØŒ{ð 	 4Ô#3ð 	ØˆIà—’˜œÑ%Ô%Ð&ˆØˆŒØ ˆÔØˆr   Nr;   )rŸ   r3   r   rˆ   rŒ   r<   r   r   r   r›   r›     s[   € € € € € ðð ð'ð 'ð 'ð 'ð$ð $ð $ð $ðLð ð ð ð ð r   r›   )ÚidentityÚgzipÚdeflateÚbrr¯   )r$   Ú
__future__r   r”   ra   Útypingr*   Ú_compatr   Ú_exceptionsr   r   r    r&   r>   rE   rR   r]   r…   rŽ   r›   ÚSUPPORTED_DECODERSr§   r   r   r   ú<module>rµ      sL  ððð ð
 #Ð "Ð "Ð "Ð "Ð "à €€€Ø 	€	€	€	Ø €€€Ø €€€à Ð Ð Ð Ð Ð Ø &Ð &Ð &Ð &Ð &Ð &ð$ð $ð $ð $ð $ñ $ô $ð $ð	ð 	ð 	ð 	ð 	�nñ 	ô 	ð 	ð3ð 3ð 3ð 3ð 3�^ñ 3ô 3ð 3ð:3ð 3ð 3ð 3ð 3�.ñ 3ô 3ð 3ð.23ð 23ð 23ð 23ð 23�Nñ 23ô 23ð 23ðjð ð ð ð �>ñ ô ð ð2$(ð $(ð $(ð $(ð $(ñ $(ô $(ð $(ðN$(ð $(ð $(ð $(ð $(ñ $(ô $(ð $(ðN.ð .ð .ð .ð .ñ .ô .ð .ð9ð 9ð 9ð 9ð 9ñ 9ô 9ð 9ðz  ØØØ
ð	ð Ð ð 
€>Ø×Ò˜4Ñ Ô Ð Ð Ð ð €>r   