§
    JŠtj©g  ã                  ó®  — d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ ddl	m
Z
mZmZmZmZmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ dd	lmZmZ dd
l m!Z! ddlm"Z"m#Z#m$Z$ g d¢Z%eeeef         Z&	  G d„ dej'        ¦  «        Z(e(j)        Z)e(j*        Z* G d„ dej'        ¦  «        Z+e+j,        Z,e+j-        Z-e+j.        Z.e+j/        Z/dZ0	  G d„ d¦  «        Z1dS )é    )ÚannotationsN)Ú	Generator)ÚUnioné   )ÚConnectionClosedÚConnectionClosedErrorÚConnectionClosedOKÚInvalidStateÚPayloadTooBigÚProtocolError)Ú	Extension)
ÚOK_CLOSE_CODESÚ	OP_BINARYÚOP_CLOSEÚOP_CONTÚOP_PINGÚOP_PONGÚOP_TEXTÚCloseÚ	CloseCodeÚFrame)ÚRequestÚResponse)ÚStreamReader)Ú
LoggerLikeÚOriginÚSubprotocol)ÚProtocolÚSideÚStateÚSEND_EOFc                  ó.   — e Zd ZdZ ed¦  «        \  ZZdS )r   z6A WebSocket connection is either a server or a client.é   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚrangeÚSERVERÚCLIENT© ó    úQ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/websockets/protocol.pyr   r   /   s%   € € € € € Ø@Ð@à�U˜1‘X”X�N€FˆFˆFˆFr,   r   c                  ó2   — e Zd ZdZ ed¦  «        \  ZZZZdS )r    z6A WebSocket connection is in one of these four states.é   N)	r$   r%   r&   r'   r(   Ú
CONNECTINGÚOPENÚCLOSINGÚCLOSEDr+   r,   r-   r    r    9   s*   € € € € € Ø@Ð@à(-¨¨a©¬Ñ%€J��g˜v˜v˜vr,   r    r,   c                  ó6  — e Zd ZdZedddœd7d„Zed8d„¦   «         Zej        d9d„¦   «         Zed:d„¦   «         Z	ed;d„¦   «         Z
ed<d„¦   «         Zd=d„Zd>d„Zd?d„Zd@d?d„Zd@d?d „ZdAdBd%„Zd=d&„Zd=d'„ZdCdDd)„ZdEd+„ZdFd-„ZdGd.„ZdHd0„ZdHd1„ZdId4„ZdId5„Zd>d6„ZdS )Jr   a6  
    Sans-I/O implementation of a WebSocket connection.

    Args:
        side: :attr:`~Side.CLIENT` or :attr:`~Side.SERVER`.
        state: Initial state of the WebSocket connection.
        max_size: Maximum size of incoming messages in bytes;
            :obj:`None` disables the limit.
        logger: Logger for this connection; depending on ``side``,
            defaults to ``logging.getLogger("websockets.client")``
            or ``logging.getLogger("websockets.server")``;
            see the :doc:`logging guide <../../topics/logging>` for details.

    i   N)ÚstateÚmax_sizeÚloggerÚsider   r5   r    r6   ú
int | Noner7   úLoggerLike | NoneÚreturnÚNonec               óR  — t          j        ¦   «         | _        	 |€.t          j        d|j                             ¦   «         › �¦  «        }|| _        	 |                     t          j	        ¦  «        | _
        || _        || _        || _        d | _        d| _        d | _        g | _        d | _        d | _        d | _        d | _        d | _        	 d| _        t1          ¦   «         | _        g | _        g | _        |                      ¦   «         | _        t=          | j        ¦  «         d | _        d S )Nzwebsockets.F) ÚuuidÚuuid4ÚidÚloggingÚ	getLoggerÚnameÚlowerr7   ÚisEnabledForÚDEBUGÚdebugr8   r5   r6   Úcur_sizeÚexpect_continuation_frameÚoriginÚ
extensionsÚsubprotocolÚ
close_rcvdÚ
close_sentÚclose_rcvd_then_sentÚhandshake_excÚeof_sentr   ÚreaderÚeventsÚwritesÚparseÚparserÚnextÚ
parser_exc)Úselfr8   r5   r6   r7   s        r-   Ú__init__zProtocol.__init__Y   s  € õ "œZ™\œ\ˆŒØBð ˆ>ÝÔ&Ð'H°T´Y·_²_Ñ5FÔ5FÐ'HÐ'HÑIÔIˆFØ"(ˆŒØ)ð ×(Ò(­¬Ñ7Ô7ˆŒ
ð ˆŒ	ð ˆŒ
ð !ˆŒð %)ˆŒð */ˆÔ&ð &*ˆŒØ+-ˆŒØ/3ˆÔð )-ˆŒØ(,ˆŒØ15ˆÔ!ð 04ˆÔð	ð ˆŒõ #‘n”nˆŒØ#%ˆŒØ#%ˆŒØ—j’j‘l”lˆŒÝˆTŒ[ÑÔÐØ,0ˆŒˆˆr,   c                ó   — | j         S )a­  
        State of the WebSocket connection.

        Defined in 4.1_, 4.2_, 7.1.3_, and 7.1.4_ of :rfc:`6455`.

        .. _4.1: https://datatracker.ietf.org/doc/html/rfc6455#section-4.1
        .. _4.2: https://datatracker.ietf.org/doc/html/rfc6455#section-4.2
        .. _7.1.3: https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.3
        .. _7.1.4: https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.4

        )Ú_state©rY   s    r-   r5   zProtocol.state�   s   € ð Œ{Ðr,   c                ób   — | j         r | j                              d|j        ¦  «         || _        d S )Nz= connection is %s)rG   r7   rC   r\   )rY   r5   s     r-   r5   zProtocol.state¬   s3   € àŒ:ð 	@ØŒK×ÒÐ2°E´JÑ?Ô?Ð?ØˆŒˆˆr,   c                ó`   — | j         t          urdS | j        €t          j        S | j        j        S )zþ
        WebSocket close code received from the remote endpoint.

        Defined in 7.1.5_ of :rfc:`6455`.

        .. _7.1.5: https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.5

        :obj:`None` if the connection isn't closed yet.

        N)r5   r3   rM   r   ÚABNORMAL_CLOSUREÚcoder]   s    r-   Ú
close_codezProtocol.close_code²   s2   € ð Œ:�VÐ#Ð#Ø�4ØŒ_Ð$ÝÔ-Ð-à”?Ô'Ð'r,   ú
str | Nonec                óL   — | j         t          urdS | j        €dS | j        j        S )a  
        WebSocket close reason  received from the remote endpoint.

        Defined in 7.1.6_ of :rfc:`6455`.

        .. _7.1.6: https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.6

        :obj:`None` if the connection isn't closed yet.

        NÚ )r5   r3   rM   Úreasonr]   s    r-   Úclose_reasonzProtocol.close_reasonÅ   s.   € ð Œ:�VÐ#Ð#Ø�4ØŒ_Ð$Ø�2à”?Ô)Ð)r,   r   c                ó  — | j         t          u s
J d¦   «         ‚| j        �5| j        �.| j        j        t
          v r| j        j        t
          v rt          }nt          } || j        | j        | j        ¦  «        }| j	        |_
        |S )aè  
        Exception to raise when trying to interact with a closed connection.

        Don't raise this exception while the connection :attr:`state`
        is :attr:`~websockets.protocol.State.CLOSING`; wait until
        it's :attr:`~websockets.protocol.State.CLOSED`.

        Indeed, the exception includes the close code and reason, which are
        known only once the connection is closed.

        Raises:
            AssertionError: If the connection isn't closed yet.

        zconnection isn't closed yet)r5   r3   rM   rN   ra   r   r	   r   rO   rX   Ú	__cause__)rY   Úexc_typeÚexcs      r-   Ú	close_exczProtocol.close_excØ   s�   € ð  Œz�VÐ#Ð#Ð#Ð%BÑ#Ô#Ð#ð ŒOÐ'Ø”Ð+Ø”Ô$­Ð6Ð6Ø”Ô$­Ð6Ð6å)ˆHˆHå,ˆHØ ( ØŒOØŒOØÔ%ñ!
ô !
ˆð œˆŒØˆ
r,   ÚdataÚbytesc                ób   — | j                              |¦  «         t          | j        ¦  «         dS )aH  
        Receive data from the network.

        After calling this method:

        - You must call :meth:`data_to_send` and send this data to the network.
        - You should call :meth:`events_received` and process resulting events.

        Raises:
            EOFError: If :meth:`receive_eof` was called earlier.

        N)rR   Ú	feed_datarW   rV   ©rY   rm   s     r-   Úreceive_datazProtocol.receive_dataþ   s0   € ð 	Œ×Ò˜dÑ#Ô#Ð#ÝˆTŒ[ÑÔÐÐÐr,   c                ó|   — | j         j        rdS | j                              ¦   «          t          | j        ¦  «         dS )a¡  
        Receive the end of the data stream from the network.

        After calling this method:

        - You must call :meth:`data_to_send` and send this data to the network;
          it will return ``[b""]``, signaling the end of the stream, or ``[]``.
        - You aren't expected to call :meth:`events_received`; it won't return
          any new events.

        :meth:`receive_eof` is idempotent.

        N)rR   ÚeofÚfeed_eofrW   rV   r]   s    r-   Úreceive_eofzProtocol.receive_eof  s?   € ð Œ;Œ?ð 	ØˆFØŒ×ÒÑÔÐÝˆTŒ[ÑÔÐÐÐr,   ÚfinÚboolc                ó  — | j         st          d¦  «        ‚| j        t          ur.t	          d| j        j                             ¦   «         › �¦  «        ‚| | _         |                      t          t          ||¦  «        ¦  «         dS )aõ  
        Send a `Continuation frame`_.

        .. _Continuation frame:
            https://datatracker.ietf.org/doc/html/rfc6455#section-5.6

        Parameters:
            data: payload containing the same kind of data
                as the initial frame.
            fin: FIN bit; set it to :obj:`True` if this is the last frame
                of a fragmented message and to :obj:`False` otherwise.

        Raises:
            ProtocolError: If a fragmented message isn't in progress.

        úunexpected continuation frameúconnection is N)rI   r   r\   r1   r
   r5   rC   rD   Ú
send_framer   r   ©rY   rm   rw   s      r-   Úsend_continuationzProtocol.send_continuation#  s�   € ð" Ô-ð 	AÝÐ ?Ñ@Ô@Ð@ØŒ;�dÐ"Ð"ÝÐI°´
´×0EÒ0EÑ0GÔ0GÐIÐIÑJÔJÐJØ-0¨ˆÔ&Ø�Š��g t¨SÑ1Ô1Ñ2Ô2Ð2Ð2Ð2r,   Tc                ó  — | j         rt          d¦  «        ‚| j        t          ur.t	          d| j        j                             ¦   «         › �¦  «        ‚| | _         |                      t          t          ||¦  «        ¦  «         dS )a£  
        Send a `Text frame`_.

        .. _Text frame:
            https://datatracker.ietf.org/doc/html/rfc6455#section-5.6

        Parameters:
            data: payload containing text encoded with UTF-8.
            fin: FIN bit; set it to :obj:`False` if this is the first frame of
                a fragmented message.

        Raises:
            ProtocolError: If a fragmented message is in progress.

        úexpected a continuation framer{   N)rI   r   r\   r1   r
   r5   rC   rD   r|   r   r   r}   s      r-   Ú	send_textzProtocol.send_text;  s�   € ð  Ô)ð 	AÝÐ ?Ñ@Ô@Ð@ØŒ;�dÐ"Ð"ÝÐI°´
´×0EÒ0EÑ0GÔ0GÐIÐIÑJÔJÐJØ-0¨ˆÔ&Ø�Š��g t¨SÑ1Ô1Ñ2Ô2Ð2Ð2Ð2r,   c                ó  — | j         rt          d¦  «        ‚| j        t          ur.t	          d| j        j                             ¦   «         › �¦  «        ‚| | _         |                      t          t          ||¦  «        ¦  «         dS )a¥  
        Send a `Binary frame`_.

        .. _Binary frame:
            https://datatracker.ietf.org/doc/html/rfc6455#section-5.6

        Parameters:
            data: payload containing arbitrary binary data.
            fin: FIN bit; set it to :obj:`False` if this is the first frame of
                a fragmented message.

        Raises:
            ProtocolError: If a fragmented message is in progress.

        r€   r{   N)rI   r   r\   r1   r
   r5   rC   rD   r|   r   r   r}   s      r-   Úsend_binaryzProtocol.send_binaryR  s�   € ð  Ô)ð 	AÝÐ ?Ñ@Ô@Ð@ØŒ;�dÐ"Ð"ÝÐI°´
´×0EÒ0EÑ0GÔ0GÐIÐIÑJÔJÐJØ-0¨ˆÔ&Ø�Š��i¨¨sÑ3Ô3Ñ4Ô4Ð4Ð4Ð4r,   re   ra   rf   Ústrc                ó¶  — | j         t          ur.t          d| j        j                             ¦   «         › �¦  «        ‚|€2|dk    rt          d¦  «        ‚t          t          j	        d¦  «        }d}n$t          ||¦  «        }| 
                    ¦   «         }|                      t          t          |¦  «        ¦  «         | j        �J ‚|| _        t           | _        dS )a_  
        Send a `Close frame`_.

        .. _Close frame:
            https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.1

        Parameters:
            code: close code.
            reason: close reason.

        Raises:
            ProtocolError: If the code isn't valid or if a reason is provided
                without a code.

        r{   Nre   z#cannot send a reason without a coder,   )r\   r1   r
   r5   rC   rD   r   r   r   ÚNO_STATUS_RCVDÚ	serializer|   r   r   rM   rN   r2   ©rY   ra   rf   Úcloserm   s        r-   Ú
send_closezProtocol.send_closei  sÊ   € ð$ Œ;�dÐ"Ð"ÝÐI°´
´×0EÒ0EÑ0GÔ0GÐIÐIÑJÔJÐJØˆ<Ø˜Š|ˆ|Ý#Ð$IÑJÔJÐJÝ�)Ô2°BÑ7Ô7ˆEØˆDˆDå˜$ Ñ'Ô'ˆEØ—?’?Ñ$Ô$ˆDà�Š��h¨Ñ-Ô-Ñ.Ô.Ð.ð ŒÐ&Ð&Ð&ØˆŒÝˆŒ
ˆ
ˆ
r,   c                óê   — | j         t          ur<| j         t          ur.t          d| j        j                             ¦   «         › �¦  «        ‚|                      t          t          |¦  «        ¦  «         dS )zÚ
        Send a `Ping frame`_.

        .. _Ping frame:
            https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.2

        Parameters:
            data: payload containing arbitrary binary data.

        r{   N)
r\   r1   r2   r
   r5   rC   rD   r|   r   r   rq   s     r-   Ú	send_pingzProtocol.send_ping�  óf   € ð Œ;�dÐ"Ð" t¤{½'Ð'AÐ'AÝÐI°´
´×0EÒ0EÑ0GÔ0GÐIÐIÑJÔJÐJØ�Š��g tÑ,Ô,Ñ-Ô-Ð-Ð-Ð-r,   c                óê   — | j         t          ur<| j         t          ur.t          d| j        j                             ¦   «         › �¦  «        ‚|                      t          t          |¦  «        ¦  «         dS )zÚ
        Send a `Pong frame`_.

        .. _Pong frame:
            https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3

        Parameters:
            data: payload containing arbitrary binary data.

        r{   N)
r\   r1   r2   r
   r5   rC   rD   r|   r   r   rq   s     r-   Ú	send_pongzProtocol.send_pong�  r�   r,   Úintc                óÈ  — | j         t          u r}|t          j        k    rmt	          ||¦  «        }|                     ¦   «         }|                      t          t          |¦  «        ¦  «         || _	        | j
        �d| _        t          | _         | j        t          u r| j        s|                      ¦   «          |                      ¦   «         | _        t'          | j        ¦  «         dS )a?  
        `Fail the WebSocket connection`_.

        .. _Fail the WebSocket connection:
            https://datatracker.ietf.org/doc/html/rfc6455#section-7.1.7

        Parameters:
            code: close code
            reason: close reason

        Raises:
            ProtocolError: If the code isn't valid.
        NT)r5   r1   r   r`   r   r‡   r|   r   r   rN   rM   rO   r2   r8   r)   rQ   Úsend_eofÚdiscardrV   rW   rˆ   s        r-   ÚfailzProtocol.fail­  sÃ   € ð& Œ:�ÐÐØ•yÔ1Ò1Ð1Ý˜d FÑ+Ô+�Ø—’Ñ(Ô(�Ø—’¥¥h°Ñ 5Ô 5Ñ6Ô6Ð6Ø"'�”ð
 ”?Ð.Ø04�DÔ-Ý$�”
ð Œ9�ÐÐ t¤}ÐØ�MŠM‰OŒOˆOð —l’l‘n”nˆŒÝˆTŒ[ÑÔÐÐÐr,   úlist[Event]c                ó$   — | j         g c}| _         |S )a*  
        Fetch events generated from data received from the network.

        Call this method immediately after any of the ``receive_*()`` methods.

        Process resulting events, likely by passing them to the application.

        Returns:
            Events read from the connection.
        )rS   )rY   rS   s     r-   Úevents_receivedzProtocol.events_receivedÞ  s   € ð #œk¨2Ðˆ�”Øˆr,   úlist[bytes]c                ó$   — | j         g c}| _         |S )aÉ  
        Obtain data to send to the network.

        Call this method immediately after any of the ``receive_*()``,
        ``send_*()``, or :meth:`fail` methods.

        Write resulting data to the connection.

        The empty bytestring :data:`~websockets.protocol.SEND_EOF` signals
        the end of the data stream. When you receive it, half-close the TCP
        connection.

        Returns:
            Data to write to the connection.

        )rT   )rY   rT   s     r-   Údata_to_sendzProtocol.data_to_sendî  s   € ð" #œk¨2Ðˆ�”Øˆr,   c                ó�   — | j         t          u rdS | j         t          u rdS | j         t          u rdS | j         t          u sJ ‚| j        S )a©  
        Tell if the TCP connection is expected to close soon.

        Call this method immediately after any of the ``receive_*()``,
        ``send_close()``, or :meth:`fail` methods.

        If it returns :obj:`True`, schedule closing the TCP connection after a
        short timeout if the other side hasn't already closed it.

        Returns:
            Whether the TCP connection is expected to close soon.

        FT)r5   r1   r2   r3   r0   rQ   r]   s    r-   Úclose_expectedzProtocol.close_expected  sV   € ðD Œ:�ÐÐØ�5ØŒ:�Ð Ð Ø�4ØŒ:�ÐÐØ�5ØŒz�ZÐ'Ð'Ð'Ð'ØŒ}Ðr,   úGenerator[None]c              #  ó  K  — 	 	 | j                              ¦   «         E d{V —†r0| j        r| j                             d¦  «         t	          d¦  «        ‚| j        €d}n| j        €| j        }n| j        | j        z
  }t          j        | j         j	        | j
        t          u || j        ¬¦  «        E d{V —†}| j        r| j                             d|¦  «         |                      |¦  «         Œè# t          $ r?}|                      t           j        t%          |¦  «        ¦  «         || _        Y d}~�nKd}~wt          $ r?}|                      t           j        t%          |¦  «        ¦  «         || _        Y d}~�nd}~wt*          $ r@}|                      t           j        |j        › d|j        › �¦  «         || _        Y d}~n¼d}~wt2          $ rX}|                     | j        ¦  «         |                      t           j        t%          |¦  «        ¦  «         || _        Y d}~n\d}~wt8          $ rL}| j                             dd¬	¦  «         |                      t           j        ¦  «         || _        Y d}~nd}~ww xY wdV — t?          d
¦  «        ‚)a-  
        Parse incoming data into frames.

        :meth:`receive_data` and :meth:`receive_eof` run this generator
        coroutine until it needs more data or reaches EOF.

        :meth:`parse` never raises an exception. Instead, it sets the
        :attr:`parser_exc` and yields control.

        TNú< EOFzunexpected end of stream)Úmaskr6   rK   z< %sz at position zparser failed)Úexc_infoz"parse() shouldn't step after error) rR   Úat_eofrG   r7   ÚEOFErrorr6   rH   r   rU   Ú
read_exactr8   r)   rK   Ú
recv_framer   r”   r   ÚPROTOCOL_ERRORr„   rX   r`   ÚUnicodeDecodeErrorÚINVALID_DATArf   Ústartr   Úset_current_sizeÚMESSAGE_TOO_BIGÚ	ExceptionÚerrorÚINTERNAL_ERRORÚAssertionError)rY   r6   Úframerk   s       r-   rU   zProtocol.parse/  sÑ  è è € ð6	"ð'Ø#œ{×1Ò1Ñ3Ô3Ð3Ð3Ð3Ð3Ð3Ð3ð ?Ø”zð 3Øœ×)Ò)¨'Ñ2Ô2Ð2õ
 #Ð#=Ñ>Ô>Ð>à”=Ð(Ø#�H�HØ”]Ð*Ø#œ}�H�Hà#œ}¨t¬}Ñ<�Hõ
 $)¤;Ø”KÔ*Øœ¥fÐ,Ø%Ø#œð	$ñ $ô $ð ð ð ð ð ð �ð ”:ð 5Ø”K×%Ò% f¨eÑ4Ô4Ð4à—’ Ñ&Ô&Ð&ð='øõ@ ð 	"ð 	"ð 	"Ø�IŠI•iÔ.µ°C±´Ñ9Ô9Ð9Ø!ˆDŒOˆOˆOˆOˆO‰Oøøøøåð 	"ð 	"ð 	"Ø�IŠI•iÔ0µ#°c±(´(Ñ;Ô;Ð;Ø!ˆDŒOˆOˆOˆOˆO‰Oøøøøå!ð 	"ð 	"ð 	"Ø�IŠI•iÔ,°´Ð.UÐ.UÈ#Ì)Ð.UÐ.UÑVÔVÐVØ!ˆDŒOˆOˆOˆOˆOˆOøøøøåð 	"ð 	"ð 	"Ø× Ò  ¤Ñ/Ô/Ð/Ø�IŠI•iÔ/µ°S±´Ñ:Ô:Ð:Ø!ˆDŒOˆOˆOˆOˆOˆOøøøøåð 	"ð 	"ð 	"ØŒK×Ò˜o¸ÐÑ=Ô=Ð=à�IŠI•iÔ.Ñ/Ô/Ð/Ø!ˆDŒOˆOˆOˆOˆOˆOøøøøð		"øøøð 	ˆˆˆÝÐAÑBÔBÐBsJ   „C)C- Ã-
I9Ã74D1Ä1I9Ä>4E8Å8I9Æ6G Ç I9ÇAH È I9È-AI4É4I9c              #  óâ  K  — | j         t          u p| j        t          u | j        k    sJ ‚| j                             ¦   «         E d{V —†s8| j                             ¦   «          | j                             ¦   «         E d{V —†¯8| j        r| j	                             d¦  «         | j         t          u r"| j        t          ur|                      ¦   «          t          | _        dV — t          d¦  «        ‚)zí
        Discard incoming data.

        This coroutine replaces :meth:`parse`:

        - after receiving a close frame, during a normal closure (1.4);
        - after sending a close frame, during an abnormal closure (7.1.7).

        NrŸ   z"discard() shouldn't step after EOF)r8   r)   r5   r0   rQ   rR   r¢   r“   rG   r7   r*   r’   r3   r¯   r]   s    r-   r“   zProtocol.discardw  sý   è è € ð ”	�VÐ#Ð? t¤zµZÐ'?ÀTÄ]ÒSÐSÐSÐSØ"œk×0Ò0Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2ð 	"ØŒK×ÒÑ!Ô!Ð!ð #œk×0Ò0Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2ð 	"àŒ:ð 	'ØŒK×Ò˜gÑ&Ô&Ð&ð Œ9�ÐÐ 4¤:µZÐ#?Ð#?Ø�MŠM‰OŒOˆOÝˆŒ
àˆˆˆõ ÐAÑBÔBÐBr,   r°   r   c                ót  — |j         t          u s|j         t          u r8| j        �t	          d¦  «        ‚|j        st          |j        ¦  «        | _        �nÉ|j         t          u rJ| j        €t	          d¦  «        ‚|j        r	d| _        �n•| xj        t          |j        ¦  «        z  c_        �nq|j         t          u r1t          t          |j        ¦  «        }|                      |¦  «         �n2|j         t          u r�n"|j         t          u rüt          j        |j        ¦  «        | _        | j        t$          u r| j        €J ‚d| _        | j        �t	          d¦  «        ‚| j        t*          u rL|                      t          t          |j        ¦  «        ¦  «         | j        | _        d| _        t$          | _        | j        t.          u r|                      ¦   «          |                      ¦   «         | _        t7          | j        ¦  «         nt9          d|j         d›�¦  «        ‚| j                             |¦  «         dS )	z-
        Process an incoming frame.

        Nr€   rz   Fzincomplete fragmented messageTzunexpected opcode: Ú02x)Úopcoder   r   rH   r   rw   Úlenrm   r   r   r   r   r|   r   r   rU   rM   r5   r2   rN   rO   r1   r8   r)   r’   r“   rV   rW   r¯   rS   Úappend)rY   r°   Ú
pong_frames      r-   r¥   zProtocol.recv_frame•  s  € ð
 Œ<�7Ð"Ð" e¤lµiÐ&?Ð&?ØŒ}Ð(Ý#Ð$CÑDÔDÐDØ”9ð 0Ý # E¤J¡¤�”ùàŒ\�WÐ$Ð$ØŒ}Ð$Ý#Ð$CÑDÔDÐDØŒyð 1Ø $�”‘à�”¥ U¤Z¡¤Ñ0�”‘àŒ\�WÐ$Ð$õ �w¨¬
Ñ3Ô3ˆJØ�OŠO˜JÑ'Ô'Ð'Ñ'àŒ\�WÐ$Ð$ñ àŒ\�XÐ%Ð%õ $œk¨%¬*Ñ5Ô5ˆDŒOØŒz�WÐ$Ð$Ø”Ð2Ð2Ð2Ø,1�Ô)àŒ}Ð(Ý#Ð$CÑDÔDÐDð Œz�TÐ!Ð!ð
 —’¥¥h°´
Ñ ;Ô ;Ñ<Ô<Ð<Ø"&¤/�”Ø,0�Ô)Ý$�”
ð Œy�FÐ"Ð"Ø—’‘”�ð Ÿ,š,™.œ.ˆDŒKÝ�”ÑÔÐÐõ !Ð!I°u´|Ð!IÐ!IÐ!IÑJÔJÐJàŒ×Ò˜5Ñ!Ô!Ð!Ð!Ð!r,   c                óÊ   — | j         r| j                              d|¦  «         | j                             |                     | j        t          u | j        ¬¦  «        ¦  «         d S )Nz> %s)r    rK   )rG   r7   rT   r¶   r‡   r8   r*   rK   )rY   r°   s     r-   r|   zProtocol.send_frameç  sm   € ØŒ:ð 	-ØŒK×Ò˜f eÑ,Ô,Ð,ØŒ×ÒØ�OŠOØ”Y¥&Ð(Øœ?ð ñ ô ñ	
ô 	
ð 	
ð 	
ð 	
r,   c                ó¦   — | j         rJ ‚d| _         | j        r| j                             d¦  «         | j                             t
          ¦  «         d S )NTz> EOF)rQ   rG   r7   rT   r¶   r!   r]   s    r-   r’   zProtocol.send_eofñ  sS   € Ø”=Ð Ð Ð ØˆŒØŒ:ð 	'ØŒK×Ò˜gÑ&Ô&Ð&ØŒ×Ò�8Ñ$Ô$Ð$Ð$Ð$r,   )
r8   r   r5   r    r6   r9   r7   r:   r;   r<   )r;   r    )r5   r    r;   r<   )r;   r9   )r;   rc   )r;   r   )rm   rn   r;   r<   )r;   r<   )rm   rn   rw   rx   r;   r<   )T)Nre   )ra   r9   rf   r„   r;   r<   )re   )ra   r�   rf   r„   r;   r<   )r;   r•   )r;   r˜   )r;   rx   )r;   r�   )r°   r   r;   r<   )r$   r%   r&   r'   r1   rZ   Úpropertyr5   Úsetterrb   rg   rl   rr   rv   r~   r�   rƒ   rŠ   rŒ   r�   r”   r—   rš   rœ   rU   r“   r¥   r|   r’   r+   r,   r-   r   r   I   sn  € € € € € ðð ð& Ø$Ø$(ðB1ð B1ð B1ð B1ð B1ð B1ðH ðð ð ñ „Xðð „\ðð ð ñ „\ðð
 ð(ð (ð (ñ „Xð(ð$ ð*ð *ð *ñ „Xð*ð$ ð!ð !ð !ñ „Xð!ðJð ð ð ð ð ð ð ð*3ð 3ð 3ð 3ð03ð 3ð 3ð 3ð 3ð.5ð 5ð 5ð 5ð 5ð."ð "ð "ð "ð "ðH.ð .ð .ð .ð .ð .ð .ð .ð -ð -ð -ð -ð -ðbð ð ð ð ð ð ð ð()ð )ð )ð )ðZFCð FCð FCð FCðPCð Cð Cð Cð<N"ð N"ð N"ð N"ðd
ð 
ð 
ð 
ð%ð %ð %ð %ð %ð %r,   r   )2Ú
__future__r   ÚenumrA   r>   Úcollections.abcr   Útypingr   Ú
exceptionsr   r   r	   r
   r   r   rK   r   Úframesr   r   r   r   r   r   r   r   r   r   Úhttp11r   r   Ústreamsr   r   r   r   Ú__all__ÚEventÚIntEnumr   r)   r*   r    r0   r1   r2   r3   r!   r   r+   r,   r-   ú<module>rÇ      sp  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð "Ð !Ð !Ð !Ð !Ð !ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð &Ð %Ð %Ð %Ð %Ð %Ð %Ð %Ø !Ð !Ð !Ð !Ð !Ð !Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3Ð 3ðð ð €ð 	ˆg�x Ð&Ô'€Ø ?ðð ð ð ð ˆ4Œ<ñ ô ð ð 
Œ€Ø	Œ€ð1ð 1ð 1ð 1ð 1ˆDŒLñ 1ô 1ð 1ð Ô€
Ø„z€Ø
Œ-€Ø	Œ€ð €Ø Eðm
%ð m
%ð m
%ð m
%ð m
%ñ m
%ô m
%ð m
%ð m
%ð m
%r,   