Ë
    ^QêjÌH  ã                  óT  — d dl mZ d dl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
 ddlmZ ddlmZmZmZmZmZ ddlmZ g d	¢Z d
j,                  ej.                  Ž Zej2                  j5                  dde› de› �«      Zej2                  j5                  dde› de› �«      Z eej2                  j5                  dd«      «      Z eej2                  j5                  dd«      «      Z eej2                  j5                  dd«      «      Z d!d„Z! ejD                  d«      Z# ejD                  d«      Z$ ejD                  d«      Z% ejD                  d«      Z&ejN                   G d„ d«      «       Z(ejN                   G d„ d«      «       Z)ef	 	 	 	 	 d"d„Z*	 	 	 	 d#d„Z+	 	 	 	 	 	 	 	 	 	 	 	 d$d „Z,y)%é    )ÚannotationsN)Ú	Generator)ÚCallableé   )ÚHeaders)ÚHeaderLineTooLongÚRequestLineTooLongÚSecurityErrorÚStatusLineTooLongÚTooManyHeaders)Úversion)ÚSERVERÚ
USER_AGENTÚRequestÚResponsez{}.{}ÚWEBSOCKETS_USER_AGENTzPython/z websockets/ÚWEBSOCKETS_SERVERÚWEBSOCKETS_MAX_NUM_HEADERSÚ128ÚWEBSOCKETS_MAX_LINE_LENGTHÚ8192ÚWEBSOCKETS_MAX_BODY_SIZEÚ	1_048_576c                ó&   — | j                  d¬«      S )zG
    Decode a bytestring for interpolating into an error message.

    Úbackslashreplace)Úerrors)Údecode)Úvalues    úV/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/websockets/http11.pyÚdr    8   s   € ð
 �<‰<Ð1ˆ<Ó2Ð2ó    s   [-!#$%&\'*+.^_`|~0-9a-zA-Z]+s   [\x09\x20-\x7e\x80-\xff]*s   [0-9]{1,18}s   [0-9a-fA-F]{1,15}c                  ó„   — e Zd ZU dZded<   ded<   dZded<   dZded	<   d
Zded<   edd„«       Z	e
	 	 	 	 dd„«       Zdd„Zy
)r   aé  
    WebSocket handshake request.

    ``method`` and ``path`` must contain only ASCII characters. ``headers``
    should contain only ASCII characters; however, non-ASCII header values are
    tolerated and encoded as ISO-8859-1.

    Attributes:
        path: Request path, including optional query.
        headers: Request headers.
        method: Request method; WebSocket handshake requests use GET.
        protocol: Request protocol; WebSocket handshake requests use HTTP/1.1.
    ÚstrÚpathr   ÚheadersÚGETÚmethodzHTTP/1.1ÚprotocolNúException | NoneÚ
_exceptionc                óN   — t        j                  dt        «       | j                  S )NzIRequest.exception is deprecated; use ServerProtocol.handshake_exc instead©ÚwarningsÚwarnÚDeprecationWarningr*   ©Úselfs    r   Ú	exceptionzRequest.exception{   s    € ä�‰ØWÜô	
ð �‰Ðr!   c              #  ó>  K  — 	 t        |t        «      E d{  –—† }	 |j                  dd«      \  }}}|dvrt	        dt        |«      › �«      ‚|j                  d«      }|j                  d«      }|j                  d«      }	t        |«      E d{  –—† }
d	|
v rt        d
«      ‚t        |
j                  d«      «      dhk  st	        d«      ‚ | |	|
||«      S 7 Œ¿# t        $ r}t        d«      |‚d}~ww xY w# t        $ r t	        dt        |«      › �«      d‚w xY w7 Œ‹­w)aê  
        Parse a WebSocket handshake request.

        This is a generator-based coroutine.

        The request method and path must contain only ASCII characters. The
        request path isn't URL-decoded or validated in any way. Request headers
        should contain only ASCII characters; however, non-ASCII header values
        are tolerated and decoded with ISO-8859-1.

        :meth:`parse` doesn't read the request body because WebSocket handshake
        requests don't have one. If the request contains a body, it may be read
        from the data stream after :meth:`parse` returns.

        Args:
            read_line: Generator-based coroutine that reads a LF-terminated
                line or raises an exception if there isn't enough data

        Raises:
            EOFError: If the connection is closed without a full HTTP request.
            RequestLineTooLong: If the request line is too long.
            HeaderLineTooLong: If a header line is too long.
            TooManyHeaders: If there are too many headers.
            UnicodeDecodeError: If the request method or path isn't ASCII.
            ValueError: If the request isn't well formatted.
            NotImplementedError: If the request uses Transfer-Encoding.

        Nz1connection closed while reading HTTP request lineó    é   zinvalid HTTP request line: ©ó   HTTP/1.1s   HTTP/1.0ú5unsupported protocol; expected HTTP/1.1 or HTTP/1.0: ÚasciiúTransfer-Encodingz!transfer codings aren't supportedúContent-LengthÚ0zunsupported request body)Ú
parse_liner	   ÚEOFErrorÚsplitÚ
ValueErrorr    r   Úparse_headersÚNotImplementedErrorÚsetÚget_all)ÚclsÚ	read_lineÚrequest_lineÚexcÚ
raw_methodÚraw_pathÚraw_protocolr'   r(   r$   r%   s              r   ÚparsezRequest.parseƒ   sM  è ø€ ðR	YÜ&0°Ô<NÓ&O×OˆLð	XØ1=×1CÑ1CÀDÈ!Ó1LÑ.ˆJ˜ ,ð Ð9Ñ9ÜØGÜ�\“?Ð#ð%óð ð ×"Ñ" 7Ó+ˆØ×&Ñ& wÓ/ˆð �‰˜wÓ'ˆä*¨9Ó5×5ˆð  'Ñ)Ü%Ð&IÓJÐJô
 �7—?‘?Ð#3Ó4Ó5¸#¸Ò>ÜÐ7Ó8Ð8á�4˜ &¨(Ó3Ð3ðC PùÜò 	YÜÐNÓOÐUXÐXûð	Yûô
 ò 	XÜÐ:¼1¸\»?Ð:KÐLÓMÐSWÐWð	Xúð 6úsV   ‚D„C —C˜C �C6 ³ADÂDÂADÃC Ã	C3Ã"C.Ã.C3Ã3DÃ6"DÄDc                ó´   — | j                   › d| j                  › d| j                  › d�}|j                  d«      }|| j                  j                  «       z  }|S )z;
        Serialize a WebSocket handshake request.

        ú ú
r9   )r'   r$   r(   Úencoder%   Ú	serialize)r1   rG   Úrequests      r   rQ   zRequest.serializeÐ   sT   € ð Ÿ+™+˜ a¨¯	©	 {°!°D·M±M°?À$ÐGˆØ×%Ñ% gÓ.ˆØ�4—<‘<×)Ñ)Ó+Ñ+ˆØˆr!   ©Úreturnr)   )rF   úJCallable[[int, type[Exception]], Generator[None, None, bytes | bytearray]]rT   zGenerator[None, None, Request]©rT   Úbytes)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r'   r(   r*   Úpropertyr2   ÚclassmethodrL   rQ   © r!   r   r   r   a   s{   … ñð ƒIØÓð €FˆCÓØ€HˆcÓð $(€JÐ Ó'àòó ðð ðJ4ð
ðJ4ð
 
(òJ4ó ðJ4ôX
r!   r   c                  óŽ   — e Zd ZU dZded<   ded<   ded<   dZd	ed
<   dZded<   edd„«       Ze		 d	 	 	 	 	 	 	 	 	 dd„«       Z
dd„Zy)r   aw  
    WebSocket handshake response.

    ``reason_phrase`` and ``headers`` should contain only ASCII characters;
    however, non-ASCII reason phrases and header values are tolerated and
    encoded as ISO-8859-1.

    Attributes:
        status_code: Response code.
        reason_phrase: Response reason.
        headers: Response headers.
        body: Response body.

    ÚintÚstatus_coder#   Úreason_phraser   r%   r!   úbytes | bytearrayÚbodyNr)   r*   c                óN   — t        j                  dt        «       | j                  S )NzJResponse.exception is deprecated; use ClientProtocol.handshake_exc insteadr,   r0   s    r   r2   zResponse.exceptionõ   s"   € ä�‰ð7äô	
ð
 �‰Ðr!   c              #  ó  K  — 	 t        |t        «      E d{  –—† }	 |j                  dd«      \  }}}	|r|dvr3t	        dt        |«      › �«      ‚|dk7  rt	        d	t        |«      › �«      ‚t        j                  |«      st	        d
t        |«      › �«      ‚t        |«      }
d|
cxk  rdk  sn t	        dt        |«      › �«      ‚t        j                  |	«      st	        dt        |	«      › �«      ‚|	j                  d«      }t        |«      E d{  –—† }|rd}nt        |
||||«      E d{  –—† } | |
|||«      S 7 �Œ'# t        $ r}t        d«      |‚d}~ww xY w# t        $ r t	        dt        |«      › �«      d‚w xY w7 Œp7 ŒV­w)a  
        Parse a WebSocket handshake response.

        This is a generator-based coroutine.

        The reason phrase and headers should contain only ASCII characters;
        however, non-ASCII reason phrases and header values are tolerated and
        decoded as ISO-8859-1.

        Args:
            read_line: Generator-based coroutine that reads a LF-terminated
                line or raises an exception if there isn't enough data.
            read_exact: Generator-based coroutine that reads the requested
                bytes or raises an exception if there isn't enough data.
            read_to_eof: Generator-based coroutine that reads until the end
                of the stream.

        Raises:
            EOFError: If the connection is closed without a full HTTP response.
            StatusLineTooLong: If the status line is too long.
            HeaderLineTooLong: If a header line is too long.
            TooManyHeaders: If there are too many headers.
            SecurityError: If the response body exceeds a security limit.
            LookupError: If the response isn't well formatted.
            ValueError: If the response isn't well formatted.
            NotImplementedError: If the response uses Transfer-Encoding, and
                it isn't "chunked".

        Nz0connection closed while reading HTTP status liner4   r5   zinvalid HTTP status line: r6   r8   r7   z)unsupported protocol; expected HTTP/1.1: z+invalid status code; expected integer; got éd   iX  u-   invalid status code; expected 100â€“599; got zinvalid HTTP reason phrase: ú
iso-8859-1r!   )r=   r   r>   r?   r@   r    Ú
_digits_reÚ	fullmatchra   Ú	_value_rer   rA   Ú	read_body)rE   rF   Ú
read_exactÚread_to_eofÚproxyÚstatus_linerH   r(   Úraw_status_codeÚ
raw_reasonrb   Úreasonr%   re   s                 r   rL   zResponse.parseþ   sÏ  è ø€ ðV	XÜ%/°	Ô;LÓ%M×MˆKð	VØ4?×4EÑ4EÀdÈAÓ4NÑ1ˆH�o zñ ØÐ9Ñ9Ü ØKÜ˜“~Ð&ð(óð ð
 ˜;Ò&Ü Ø?ÄÀ+ÃÐ?OÐPóð ô ×#Ñ# OÔ4ÜØ=¼aÀÓ>PÐ=QÐRóð ô ˜/Ó*ˆØ�kÔ' CÔ'ÜØ?ÄÀ/Ó@RÐ?SÐTóð ô ×"Ñ" :Ô.ÜÐ;¼A¸j»M¸?ÐKÓLÐLð ×"Ñ" <Ó0ˆä*¨9Ó5×5ˆñ Ø‰Dä'Ø˜W i°¸[ó÷ ˆDñ �; ¨°Ó6Ð6ð[ NúÜò 	XÜÐMÓNÐTWÐWûð	Xûô
 ò 	VÜÐ9¼!¸K».Ð9IÐJÓKÐQUÐUð	Vúð: 6øðúsg   ‚F„E —D>˜E �E ³CFÄFÄFÄ.FÄ/FÄ>E Å	EÅ
EÅEÅFÅ"F Æ FÆFc                óº   — d| j                   › d| j                  › d�}|j                  d«      }|| j                  j	                  «       z  }|| j
                  z  }|S )z<
        Serialize a WebSocket handshake response.

        z	HTTP/1.1 rN   rO   ri   )rb   rc   rP   r%   rQ   re   )r1   rq   Úresponses      r   rQ   zResponse.serializeY  s`   € ð " $×"2Ñ"2Ð!3°1°T×5GÑ5GÐ4HÈÐMˆØ×%Ñ% lÓ3ˆØ�D—L‘L×*Ñ*Ó,Ñ,ˆØ�D—I‘IÑˆØˆr!   rS   )F)
rF   rU   rn   ú9Callable[[int], Generator[None, None, bytes | bytearray]]ro   rU   rp   ÚboolrT   zGenerator[None, None, Response]rV   )rX   rY   rZ   r[   r\   re   r*   r]   r2   r^   rL   rQ   r_   r!   r   r   r   Ý   sœ   … ñð ÓØÓØÓØ!€DÐ
Ó!à#'€JÐ Ó'àòó ðð ð ðX7ð
ðX7ð
 NðX7ð
ðX7ð ðX7ð 
)òX7ó ðX7ôt
r!   r   c              #  óz   K  —  | t         |«      E d{  –—† }|j                  d«      st        d«      ‚|dd S 7 Œ%­w)aä  
    Parse a single line.

    CRLF is stripped from the return value.

    Args:
        read_line: Generator-based coroutine that reads a LF-terminated line
            or raises an exception if there isn't enough data.
        too_long_exc_type: exception to raise if the line is too long;
            defaults to :exc:`SecurityError`.

    Raises:
        EOFError: If the connection is closed without a CRLF.
        SecurityError: If the response exceeds a security limit.

    Nó   
zline without CRLFéþÿÿÿ)ÚMAX_LINE_LENGTHÚendswithr>   )rF   Útoo_long_exc_typeÚlines      r   r=   r=   f  sB   è ø€ ñ,  ¤Ð1BÓC×C€Dà�=‰=˜Ô!ÜÐ*Ó+Ð+Ø��ˆ9Ðð	 Dús   ‚;“9”&;c              #  ó¢  K  — t        «       }t        t        dz   «      D ]Ö  }	 t        | t        «      E d{  –—† }|dk(  r |S 	 |j                  dd«      \  }}t        j                  |«      st        dt        |«      › �«      ‚|j                  d«      }t        j                  |«      st        d	t        |«      › �«      ‚|j                  d
«      }|j                  d«      }|j                  ||«       ŒØ t        dt        › d�«      ‚7 ŒÔ# t
        $ r}t        d«      |‚d}~ww xY w# t        $ r t        dt        |«      › �«      d‚w xY w­w)a-  
    Parse HTTP headers.

    Headers should contain only ASCII characters; however, non-ASCII values are
    tolerated and decoded as ISO-8859-1.

    Args:
        read_line: Generator-based coroutine that reads a LF-terminated line
            or raises an exception if there isn't enough data.

    Raises:
        EOFError: If the connection is closed without complete headers.
        HeaderLineTooLong: If a header line is too long.
        TooManyHeaders: If there are too many headers.
        ValueError: If the request isn't well formatted.

    r   Nz,connection closed while reading HTTP headersr!   ó   :zinvalid HTTP header line: zinvalid HTTP header name: s    	zinvalid HTTP header value: r9   ri   zexpected no more than z headers)r   ÚrangeÚMAX_NUM_HEADERSr=   r   r>   r?   r@   r    Ú	_token_rerk   Ústriprl   r   Úset_insecurer   )	rF   r%   Ú_r   rH   Úraw_nameÚ	raw_valueÚnamer   s	            r   rA   rA   ƒ  sc  è ø€ ô4 ‹i€GÜ”? QÑ&Ó'ò Qˆð	TÜ(¨Ô4EÓF×FˆDð �3Š;Øð4 €Nð1	OØ"&§*¡*¨T°1Ó"5ÑˆH�iô ×"Ñ" 8Ô,ÜÐ9¼!¸H»+¸ÐGÓHÐHØ—O‘O FÓ+ˆ	Ü×"Ñ" 9Ô-ÜÐ:¼1¸Y»<¸.ÐIÓJÐJà�‰˜wÓ'ˆð × Ñ  Ó.ˆð 	×Ñ˜T 5Õ)ð7Qô< Ð5´oÐ5FÀhÐOÓPÐPð9 GùÜò 	TÜÐIÓJÐPSÐSûð	Tûô ò 	OÜÐ9¼!¸D»'¸ÐCÓDÈ$ÐNð	OüsP   ‚ E£D¶D·D»EÁD*ÁB2EÄDÄ	D'ÄD"Ä"D'Ä'EÄ*"EÅEc              #  óŽ  K  — d| cxk  rdk  sn | dk(  s| dk(  ry|j                  d«      x}�ù|dk7  rt        d|› d	�«      ‚d}	 t        |t        «      E d {  –—† }|j	                  d
d«      d   }t
        j                  |«      st        dt        |«      › �«      ‚t        |d«      }	|	dk(  rnbt        |«      |	z   t        kD  rt        d|	› dt        |«      › d�«      ‚| ||	«      E d {  –—† z  } |d«      E d {  –—† dk7  rt        d«      ‚ŒÍt        |«      E d {  –—†  |S |j                  d«      x}
�et        j                  |
j                  d«      «      st        d|
› �«      ‚t        |
«      }|t        kD  rt        d|› d�«      ‚ ||«      E d {  –—† S  |t        t        «      E d {  –—† S 7 �Œ`7 ŒÎ7 Œ¾7 Œž7 Œ&7 Œ­w)Nrh   éÈ   éÌ   i0  r!   r:   Úchunkedztransfer coding z isn't supportedó   ;r   r   zinvalid chunk size: é   zchunk too large: z bytes after z bytesr5   rz   zchunk without CRLFr;   ri   zinvalid content length: zbody too large: )ÚgetrB   r=   r
   r?   Ú_hexdigits_rerk   r    ra   ÚlenÚMAX_BODY_SIZEr@   rA   rj   rP   )rb   r%   rF   rn   ro   Úcodingre   Úchunk_size_lineÚraw_chunk_sizeÚ
chunk_sizeÚraw_content_lengthÚcontent_lengths               r   rm   rm   Á  sô  è ø€ ð ˆkÔ˜CÔ ;°#Ò#5¸ÈÒ9KØð —K‘KÐ 3Ó4Ð
4ˆ&Ð	AØ�YÒÜ%Ð(8¸¸Ð@PÐ&QÓRÐRàˆØÜ)3°I¼}Ó)M×MˆOØ,×2Ñ2°4¸Ó;¸AÑ>ˆNÜ ×*Ñ*¨>Ô:Ü#Ð&:¼1¸^Ó;LÐ:MÐ$NÓOÐOÜ˜^¨RÓ0ˆJØ˜QŠØÜ�4‹y˜:Ñ%¬Ò5Ü#Ø'¨
 |°=ÄÀTÃÀÈ6ÐRóð ð ™z¨*Ó5×5Ñ5ˆDÙ% a›=×(¨WÒ4Ü Ð!5Ó6Ð6ð ô  ! Ó+×+Ð+Øˆà '§¡Ð,<Ó =Ð
=Ð
Ð	JÜ×#Ñ#Ð$6×$=Ñ$=¸lÓ$KÔLÜÐ":Ð;MÐ:NÐ OÓPÐPÜÐ/Ó0ˆØœMÒ)ÜÐ"2°>Ð2BÀ&Ð IÓJÐJÙ% nÓ5×5Ð6ñ '¤}´mÓD×DÐEð7 Nùð 6øØ(øð 	,øð 6øð Eúsn   ‚AGÁF8ÁBGÃ,F;Ã-GÃ>F=Ã?!GÄ F?Ä!A9GÆGÆGÆ3GÆ4GÆ;GÆ=GÆ?GÇGÇG)r   rd   rT   r#   )rF   rU   r~   ztype[Exception]rT   ú(Generator[None, None, bytes | bytearray])rF   rU   rT   zGenerator[None, None, Headers])rb   ra   r%   r   rF   rU   rn   rw   ro   rU   rT   r›   )-Ú
__future__r   ÚdataclassesÚosÚreÚsysr-   Úcollections.abcr   Útypingr   Údatastructuresr   Ú
exceptionsr   r	   r
   r   r   r   Úwebsockets_versionÚ__all__ÚformatÚversion_infoÚPYTHON_VERSIONÚenvironr‘   r   r   ra   rƒ   r|   r”   r    Úcompiler„   rl   rj   r’   Ú	dataclassr   r   r=   rA   rm   r_   r!   r   ú<module>r­      s  ðÝ "ã Û 	Û 	Û 
Û Ý %Ý å #÷õ õ 3ò€ð  �—‘ ×!1Ñ!1Ð2€ð �Z‰Z�^‰^ØØˆnÐ˜\Ð*<Ð)=Ð>ó€
ð 
�‰�‰ØØˆnÐ˜\Ð*<Ð)=Ð>ó
€ñ �b—j‘j—n‘nÐ%AÀ5ÓIÓJ€ñ �b—j‘j—n‘nÐ%AÀ6ÓJÓK€ñ �B—J‘J—N‘NÐ#=¸{ÓKÓL€ó3ð ˆB�J‰JÐ7Ó8€	ð ˆB�J‰JÐ4Ó5€	ð ˆR�Z‰Z˜Ó(€
ð
 �—
‘
Ð0Ó1€ð ×Ñ÷xð xó ðxðv ×Ñ÷Eð Eó ðEðX *7ð	ððð 'ð	ð
 .óð:;ðð;ð $ó	;ð|8FØð8Fàð8Fðð8Fð Jð8Fðð8Fð .ô8Fr!   