§
    *P„j¶  ã                  ó0  — d dl mZ d dlZd dlmZ ddlmZmZmZm	Z	m
Z
mZ  G d„ dej        ¦  «        Z G d„ d	ej        ¦  «        Z G d
„ dej        ¦  «        Z G d„ deej        ¦  «        Z G d„ deej        ¦  «        Zdd„Z ej        e¦  «         dS )é    )ÚannotationsN)ÚAnyé   )Ú	IDNAErrorÚ_unicode_dots_reÚalabelÚdecodeÚencodeÚulabelc                  ó&   — e Zd ZdZddd„Zddd„ZdS )ÚCodecaf  Stateless IDNA 2008 codec.

    Implements the :class:`codecs.Codec` protocol so that the whole-domain
    encoder (:func:`idna.encode`) and decoder (:func:`idna.decode`) are
    accessible through the standard codec machinery as ``"idna2008"``.

    Only the ``"strict"`` error handler is supported; any other handler
    raises :exc:`~idna.IDNAError`.
    ÚstrictÚdataÚstrÚerrorsÚreturnútuple[bytes, int]c                ó|   — |dk    rt          d|› d�d¬¦  «        ‚|sdS t          |¦  «        t          |¦  «        fS )Nr   úUnsupported error handling "ú"Úunsupported_errors©Úcode©ó    r   )r   r
   Úlen©Úselfr   r   s      úO/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/idna/codec.pyr
   zCodec.encode   sQ   € Ø�XÒÐÝÐD¸6ÐDÐDÐDÐK_Ð`Ñ`Ô`Ð`àð 	Ø�6å�d‰|Œ|�S ™YœYÐ&Ð&r   Úbytesútuple[str, int]c                ó|   — |dk    rt          d|› d�d¬¦  «        ‚|sdS t          |¦  «        t          |¦  «        fS )Nr   r   r   r   r   ©Ú r   )r   r	   r   r   s      r   r	   zCodec.decode   sQ   € Ø�XÒÐÝÐD¸6ÐDÐDÐDÐK_Ð`Ñ`Ô`Ð`àð 	Ø�5å�d‰|Œ|�S ™YœYÐ&Ð&r   N)r   )r   r   r   r   r   r   )r   r    r   r   r   r!   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r	   © r   r   r   r   	   sP   € € € € € ðð ð'ð 'ð 'ð 'ð 'ð'ð 'ð 'ð 'ð 'ð 'ð 'r   r   c                  ó   — e Zd ZdZdd	„Zd
S )ÚIncrementalEncodera·  Incremental IDNA 2008 encoder.

    Buffers a partial trailing label across calls until either the next
    label separator is seen or ``final=True``, so that streamed input is
    encoded one whole label at a time. Any of the four Unicode label
    separators (``U+002E``, ``U+3002``, ``U+FF0E``, ``U+FF61``) ends a
    label; the result always uses ``U+002E`` as the separator.

    Only the ``"strict"`` error handler is supported.
    r   r   r   ÚfinalÚboolr   r   c                ó‚  — |dk    rt          d|› d�d¬¦  «        ‚|sdS t          j        |¦  «        }d}|r|d         sd	}|d= n	|s|d= |rd	}g }d
}|D ]=}|                     t	          |¦  «        ¦  «         |r|dz  }|t          |¦  «        z  }Œ>d	                     |¦  «        |z   }	|t          |¦  «        z  }|	|fS )Nr   r   r   r   r   r   r   éÿÿÿÿó   .r   r   )r   r   ÚsplitÚappendr   r   Újoin)
r   r   r   r,   ÚlabelsÚtrailing_dotÚresultÚsizeÚlabelÚresult_bytess
             r   Ú_buffer_encodez!IncrementalEncoder._buffer_encode3   s  € Ø�XÒÐÝÐD¸6ÐDÐDÐDÐK_Ð`Ñ`Ô`Ð`àð 	Ø�6å!Ô'¨Ñ-Ô-ˆØˆØð 	(Ø˜"”:ð (Ø#�Ø˜2�J�JØð (à˜2�JØð (Ø#'�LàˆØˆØð 	ð 	ˆEØ�MŠM�& ™-œ-Ñ(Ô(Ð(Øð Ø˜‘	�Ø•C˜‘J”JÑˆDˆDà—y’y Ñ(Ô(¨<Ñ7ˆØ•�LÑ!Ô!Ñ!ˆØ˜TÐ!Ð!r   N)r   r   r   r   r,   r-   r   r   )r%   r&   r'   r(   r:   r)   r   r   r+   r+   '   s2   € € € € € ð	ð 	ð"ð "ð "ð "ð "ð "r   r+   c                  ó   — e Zd ZdZdd
„ZdS )ÚIncrementalDecodera  Incremental IDNA 2008 decoder.

    Buffers a partial trailing label across calls until either the next
    label separator is seen or ``final=True``, so that streamed input is
    decoded one whole label at a time.

    Only the ``"strict"`` error handler is supported.
    r   r   r   r   r,   r-   r   r!   c                ó  — |dk    rt          d|› d�d¬¦  «        ‚|sdS t          |t          ¦  «        s6	 t          |d¦  «        }n$# t          $ r}t          dd	¬¦  «        |‚d }~ww xY wt	          j        |¦  «        }d
}|r|d         sd}|d= n	|s|d= |rd}g }d}|D ]=}	|                     t          |	¦  «        ¦  «         |r|dz  }|t          |	¦  «        z  }Œ>d 	                    |¦  «        |z   }
|t          |¦  «        z  }|
|fS )Nr   r   r   r   r   r#   ÚasciizInvalid ASCII in A-labelÚinvalid_asciir$   r/   ú.r   r   )
r   Ú
isinstancer   ÚUnicodeDecodeErrorr   r1   r2   r   r   r3   )r   r   r   r,   Úerrr4   r5   r6   r7   r8   Ú
result_strs              r   Ú_buffer_decodez!IncrementalDecoder._buffer_decode]   sz  € Ø�XÒÐÝÐD¸6ÐDÐDÐDÐK_Ð`Ñ`Ô`Ð`àð 	Ø�7å˜$¥Ñ$Ô$ð 	[ð[Ý˜4 Ñ)Ô)��øÝ%ð [ð [ð [ÝÐ :ÀÐQÑQÔQÐWZÐZøøøøð[øøøõ "Ô'¨Ñ-Ô-ˆØˆØð 	'Ø˜"”:ð 'Ø"�Ø˜2�J�JØð 'à˜2�JØð 'Ø#&�LàˆØˆØð 	ð 	ˆEØ�MŠM�& ™-œ-Ñ(Ô(Ð(Øð Ø˜‘	�Ø•C˜‘J”JÑˆDˆDà—X’X˜fÑ%Ô%¨Ñ4ˆ
Ø•�LÑ!Ô!Ñ!ˆØ˜DÐ!Ð!s   ¶A Á
A(ÁA#Á#A(N)r   r   r   r   r,   r-   r   r!   )r%   r&   r'   r(   rE   r)   r   r   r<   r<   S   s2   € € € € € ðð ð#"ð #"ð #"ð #"ð #"ð #"r   r<   c                  ó   — e Zd ZdS )ÚStreamWriterN©r%   r&   r'   r)   r   r   rG   rG   ƒ   ó   € € € € € Ø€Dr   rG   c                  ó   — e Zd ZdS )ÚStreamReaderNrH   r)   r   r   rK   rK   ‡   rI   r   rK   Únamer   r   úcodecs.CodecInfo | Nonec           	     ó´   — | dk    rdS t          j        | t          ¦   «         j        t          ¦   «         j        t
          t          t          t          ¬¦  «        S )a£  Codec search function registered with :mod:`codecs`.

    Returns a :class:`codecs.CodecInfo` for the ``"idna2008"`` codec name
    so that ``str.encode("idna2008")`` and ``bytes.decode("idna2008")``
    invoke the IDNA 2008 codec defined in this module.

    :param name: The codec name being looked up.
    :returns: A :class:`codecs.CodecInfo` instance if ``name`` is
        ``"idna2008"``, otherwise ``None``.
    Úidna2008N)rL   r
   r	   ÚincrementalencoderÚincrementaldecoderÚstreamwriterÚstreamreader)	ÚcodecsÚ	CodecInfor   r
   r	   r+   r<   rG   rK   )rL   s    r   Úsearch_functionrV   ‹   sO   € ð ˆzÒÐØˆtÝÔØÝ‰wŒwŒ~Ý‰wŒwŒ~Ý-Ý-Ý!Ý!ðñ ô ð r   )rL   r   r   rM   )Ú
__future__r   rT   Útypingr   Úcorer   r   r   r	   r
   r   r   ÚBufferedIncrementalEncoderr+   ÚBufferedIncrementalDecoderr<   rG   rK   rV   Úregisterr)   r   r   ú<module>r]      sv  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ð Ð à MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ MÐ Mð'ð 'ð 'ð 'ð 'ˆFŒLñ 'ô 'ð 'ð<)"ð )"ð )"ð )"ð )"˜Ô:ñ )"ô )"ð )"ðX-"ð -"ð -"ð -"ð -"˜Ô:ñ -"ô -"ð -"ð`	ð 	ð 	ð 	ð 	�5˜&Ô-ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	�5˜&Ô-ñ 	ô 	ð 	ðð ð ð ð0 €„�Ñ  Ô  Ð  Ð  Ð  r   