ó
    ÖÁ“iÝ5  ã                  ó®  • S SK Jr  S SKrS SKrS SKrS SKJrJr  S SKJ	r	  SSK
JrJr  SSKJrJrJrJrJrJrJr  SSKJrJr  SS	KJrJrJrJrJrJrJrJ r   SS
K!J"r"J#r#  SSK$J%r%  SSK&J'r'J(r(J)r)J*r*J+r+  SSKJ,r,J-r-J.r.J/r/J0r0J1r1  SSK2J3r3  SSK4J5r5J6r6  S/r7 " S S\*5      r8 " S S\85      r9\:" \Rv                  Ry                  SS5      5      r=\:" \Rv                  Ry                  SS5      5      r>\:" \Rv                  Ry                  SS5      5      r?\:" \Rv                  Ry                  SS5      5      r@\=\>\?\@4         S S jjrA\%" \B" 5       SSSS.S9  g)!é    )ÚannotationsN)Ú	GeneratorÚSequence)ÚAnyé   )ÚHeadersÚMultipleValuesError)ÚInvalidHandshakeÚInvalidHeaderÚInvalidHeaderValueÚInvalidMessageÚInvalidStatusÚInvalidUpgradeÚNegotiationError)ÚClientExtensionFactoryÚ	Extension)Úbuild_authorization_basicÚbuild_extensionÚ
build_hostÚbuild_subprotocolÚparse_connectionÚparse_extensionÚparse_subprotocolÚparse_upgrade)ÚRequestÚResponse)Úlazy_import)ÚCLIENTÚ
CONNECTINGÚOPENÚProtocolÚState)ÚConnectionOptionÚExtensionHeaderÚ
LoggerLikeÚOriginÚSubprotocolÚUpgradeProtocol)ÚWebSocketURI)Ú
accept_keyÚgenerate_keyÚClientProtocolc                  ó¢   ^ • \ rS rSrSrSSS\SSS.               SU 4S jjjrSS jrSS jrSS	 jr	SS
 jr
SS jrSU 4S jjrSrU =r$ )r,   é0   a#  
Sans-I/O implementation of a WebSocket client connection.

Args:
    uri: URI of the WebSocket server, parsed
        with :func:`~websockets.uri.parse_uri`.
    origin: Value of the ``Origin`` header. This is useful when connecting
        to a server that validates the ``Origin`` header to defend against
        Cross-Site WebSocket Hijacking attacks.
    extensions: List of supported extensions, in order in which they
        should be tried.
    subprotocols: List of supported subprotocols, in order of decreasing
        preference.
    state: Initial state of the WebSocket connection.
    max_size: Maximum size of incoming messages in bytes.
        :obj:`None` disables the limit. You may pass a ``(max_message_size,
        max_fragment_size)`` tuple to set different limits for messages and
        fragments when you expect long messages sent in short fragments.
    logger: Logger for this connection;
        defaults to ``logging.getLogger("websockets.client")``;
        see the :doc:`logging guide <../../topics/logging>` for details.

Ni   )ÚoriginÚ
extensionsÚsubprotocolsÚstateÚmax_sizeÚloggerc               ó|   >• [         TU ]  [        UUUS9  Xl        X l        X0l        X@l        [        5       U l        g )N)Úsider2   r3   r4   )	ÚsuperÚ__init__r   Úurir/   Úavailable_extensionsÚavailable_subprotocolsr+   Úkey)	Úselfr9   r/   r0   r1   r2   r3   r4   Ú	__class__s	           €ÚN/home/mande/repo/quber/.venv/lib/python3.13/site-packages/websockets/client.pyr8   ÚClientProtocol.__init__I   sD   ø€ ô 	‰ÑÜØØØð	 	ñ 	
ð ŒØŒØ$.Ô!Ø&2Ô#Ü“>ˆ�ó    c                óÊ  • [        5       n[        U R                  R                  U R                  R                  U R                  R
                  5      US'   U R                  R                  (       a  [        U R                  R                  6 US'   U R                  b  U R                  US'   SUS'   SUS'   U R                  US'   SUS	'   U R                  bC  [        U R                   Vs/ s H  nUR                  UR                  5       4PM!     sn5      US
'   U R                  b  [        U R                  5      US'   [!        U R                  R"                  U5      $ s  snf )a  
Create a handshake request to open a connection.

You must send the handshake request with :meth:`send_request`.

You can modify it before sending it, for example to add HTTP headers.

Returns:
    WebSocket handshake request event to send to the server.

ÚHostÚAuthorizationr&   Ú	websocketÚUpgradeÚ
ConnectionzSec-WebSocket-KeyÚ13zSec-WebSocket-VersionúSec-WebSocket-ExtensionsúSec-WebSocket-Protocol)r   r   r9   ÚhostÚportÚsecureÚ	user_infor   r/   r<   r:   r   ÚnameÚget_request_paramsr;   r   r   Úresource_name)r=   ÚheadersÚextension_factorys      r?   ÚconnectÚClientProtocol.connect`   s;  € ô “)ˆÜ$ T§X¡X§]¡]°D·H±H·M±MÀ4Ç8Á8Ç?Á?ÓSˆ�‰Ø�8‰8××Ü'@À$Ç(Á(×BTÑBTÐ'UˆG�OÑ$Ø�;‰;Ñ"Ø $§¡ˆG�HÑØ(ˆ�	ÑØ )ˆ�ÑØ'+§x¡xˆÐ#Ñ$Ø+/ˆÐ'Ñ(Ø×$Ñ$Ñ0Ü2Að .2×-FÒ-Fóâ-FÐ)ð '×+Ñ+Ð->×-QÑ-QÓ-SÓTÙ-Fñó3ˆGÐ.Ñ/ð ×&Ñ&Ñ2Ü0AØ×+Ñ+ó1ˆGÐ,Ñ-ô �t—x‘x×-Ñ-¨wÓ7Ð7ùòs   Ã+&E c                ób  • UR                   S:w  a  [        U5      eUR                  n[        UR	                  S5       Vs/ s H  n[        U5      PM     sn/ 5      n[        S U 5       5      (       d(  [        SU(       a  SR                  U5      5      eS5      e[        UR	                  S5       Vs/ s H  n[        U5      PM     sn/ 5      n[        U5      S:X  a  US   R                  5       S	:X  d(  [        SU(       a  SR                  U5      5      eS5      e US
   nU[        U R                   5      :w  a  [#        S
U5      eU R%                  U5      U l        U R)                  U5      U l        gs  snf s  snf ! [         a    [        S
5      Se[         a    [        S
S5      Sef = f)z®
Check a handshake response.

Args:
    request: WebSocket handshake response received from the server.

Raises:
    InvalidHandshake: If the handshake response is invalid.

ée   rG   c              3  óF   #   • U  H  oR                  5       S :H  v •  M     g7f)ÚupgradeN)Úlower)Ú.0Úvalues     r?   Ú	<genexpr>Ú2ClientProtocol.process_response.<locals>.<genexpr>—   s   é € ÐFº:°%—;‘;“= IÖ-º:ùs   ‚!ú, NrF   r   r   rE   zSec-WebSocket-Acceptzmultiple values)Ústatus_coder   rR   ÚsumÚget_allr   Úanyr   Újoinr   ÚlenrZ   ÚKeyErrorr   r	   r*   r<   r   Úprocess_extensionsr0   Úprocess_subprotocolÚsubprotocol)r=   ÚresponserR   r\   Ú
connectionrY   Ú
s_w_accepts          r?   Úprocess_responseÚClientProtocol.process_responseƒ   s¦  € ð ×Ñ 3Ó&Ü Ó)Ð)à×"Ñ"ˆä-0Ø29·/±/À,Ô2OÓPÒ2O¨Ô˜eÖ$Ñ2OÑPÐRTó.
ˆ
ô ÑF¹:ÓF×FÑFÜ Ø¶z˜dŸi™i¨
Ó3óð ØGKóð ô *-Ø/6¯©¸yÔ/IÓJÒ/I eŒ]˜5Ö!Ñ/IÑJÈBó*
ˆô
 �G“ Ó! g¨a¡j×&6Ñ&6Ó&8¸KÓ&GÜ  Æ'¨D¯I©I°gÓ,>ÓTÐTÈtÓTÐTð	UØ Ð!7Ñ8ˆJð
 œ D§H¡HÓ-Ó-Ü$Ð%;¸ZÓHÐHà×1Ñ1°'Ó:ˆŒØ×3Ñ3°GÓ<ˆÕùò3 Qùò Køô ó 	BÜÐ 6Ó7¸TÐAÜ"ó 	UÜÐ 6Ð8IÓJÐPTÐTð	Uús   Á E7Â4E<Ä F Æ-F.c                ó¨  • / nUR                  S5      nU(       a¡  U R                  c  [        S5      e[        U Vs/ s H  n[	        U5      PM     sn/ 5      nU H]  u  pgU R                   H9  nUR
                  U:w  a  M   UR                  Xr5      n	UR                  U	5          ML     [        SU SU 35      e   U$ s  snf ! [         a     Md  f = f)aÊ  
Handle the Sec-WebSocket-Extensions HTTP response header.

Check that each extension is supported, as well as its parameters.

:rfc:`6455` leaves the rules up to the specification of each
extension.

To provide this level of flexibility, for each extension accepted by
the server, we check for a match with each extension available in the
client configuration. If no match is found, an exception is raised.

If several variants of the same extension are accepted by the server,
it may be configured several times, which won't make sense in general.
Extensions must implement their own requirements. For this purpose,
the list of previously accepted extensions is provided.

Other requirements, for example related to mandatory extensions or the
order of extensions, may be implemented by overriding this method.

Args:
    headers: WebSocket handshake response headers.

Returns:
    List of accepted extensions.

Raises:
    InvalidHandshake: To abort the handshake.

rI   zno extensions supportedzUnsupported extension: name = z, params = )rb   r:   r   ra   r   rO   Úprocess_response_paramsÚappend)
r=   rR   Úaccepted_extensionsr0   Úheader_valueÚparsed_extensionsrO   Úresponse_paramsrS   Ú	extensions
             r?   rg   Ú!ClientProtocol.process_extensions°   s   € ð> 02Ðà—_‘_Ð%?Ó@ˆ
æØ×(Ñ(Ñ0Ü&Ð'@ÓAÐAä7:ÙCMÓNÂ:°<” Ö.Á:ÑNÐPRó8Ðó *;Ñ%�Ø)-×)BÔ)BÐ%à(×-Ñ-°Ó5Ù ð!Ø$5×$MÑ$MØ+ó%˜	ð (×.Ñ.¨yÔ9ò ñ# *Cô, +ð"Ø"&  {°?Ð2CðEóð ñ/ *;ð8 #Ð"ùò? Oøô ,ó !Ú ð!ús   ¼B>ÂCÃ
CÃCc                ó^  • SnUR                  S5      nU(       a�  U R                  c  [        S5      e[        U Vs/ s H  n[	        U5      PM     sn/ 5      n[        U5      S:”  a  [        SSSR                  U5       35      eUS   nX R                  ;  a  [        SU 35      eU$ s  snf )	zë
Handle the Sec-WebSocket-Protocol HTTP response header.

If provided, check that it contains exactly one supported subprotocol.

Args:
    headers: WebSocket handshake response headers.

Returns:
   Subprotocol, if one was selected.

NrJ   zno subprotocols supportedr   zmultiple values: r_   r   zunsupported subprotocol: )rb   r;   r   ra   r   re   r   rd   )r=   rR   ri   r1   rs   Úparsed_subprotocolss         r?   rh   Ú"ClientProtocol.process_subprotocolù   sÅ   € ð +/ˆà—‘Ð'?Ó@ˆæØ×*Ñ*Ñ2Ü&Ð'BÓCÐCä9<ÙEQÓRÂ\°\Ô" <Ö0Á\ÑRÐTVó:Ðô Ð&Ó'¨!Ó+Ü#Ø,Ø'¨¯	©	Ð2EÓ(FÐ'GÐHóð ð
 .¨aÑ0ˆKØ×"=Ñ"=Ó=Ü&Ð)BÀ;À-Ð'PÓQÐQàÐùò Ss   ¼B*c                óB  • U R                   (       ae  U R                  R                  SUR                  5        UR                  R	                  5        H!  u  p#U R                  R                  SX#5        M#     U R
                  R                  UR                  5       5        g)za
Send a handshake request to the server.

Args:
    request: WebSocket handshake request event.

z> GET %s HTTP/1.1z> %s: %sN)Údebugr4   ÚpathrR   Ú	raw_itemsÚwritesrq   Ú	serialize)r=   Úrequestr<   r\   s       r?   Úsend_requestÚClientProtocol.send_request  sn   € ð �:�:Ø�K‰K×ÑÐ1°7·<±<Ô@Ø%Ÿo™o×7Ñ7Ö9‘
�Ø—‘×!Ñ! *¨cÖ9ñ :ð 	�‰×Ñ˜7×,Ñ,Ó.Õ/rA   c              #  ó.  >#   • U R                   [        L Gam   [        R                  " U R                  R
                  U R                  R                  U R                  R                  5       S h  v•N nU R                   (       a²  WR"                  UR$                  pCU R&                  R!                  SX45        UR(                  R+                  5        H!  u  pVU R&                  R!                  SXV5        M#     UR,                  (       a/  U R&                  R!                  S[/        UR,                  5      5         U R1                  W5        U R                   [        L d   e[:        U l         U R6                  R9                  U5        [<        TU ]  5        S h  v•N   g  GN,! [         ai  n[        S5      U l
        X R                  l        U R                  5         U R                  5       U l        [        U R                  5        S v •   S nAGN˜S nAff = f! [2         aq  nUWl        U R6                  R9                  U5        X l
        U R                  5         U R                  5       U l        [        U R                  5        S v •   S nAGNAS nAff = f Nü7f)Nz%did not receive a valid HTTP responsez< HTTP/1.1 %d %sz< %s: %sz< [body] (%d bytes))r2   r   r   ÚparseÚreaderÚ	read_lineÚ
read_exactÚread_to_eofÚ	Exceptionr   Úhandshake_excÚ	__cause__Úsend_eofÚdiscardÚparserÚnextr|   r`   Úreason_phraser4   rR   r~   Úbodyre   rm   r
   Ú
_exceptionÚeventsrq   r    r7   )r=   rj   ÚexcÚcodeÚphraser<   r\   r>   s          €r?   r…   ÚClientProtocol.parse,  sß  øé € Ø�:‰:œÓ#ðÜ&.§n¢nØ—K‘K×)Ñ)Ø—K‘K×*Ñ*Ø—K‘K×+Ñ+ó'÷ �ð �z�zØ'×3Ñ3°X×5KÑ5K�fØ—‘×!Ñ!Ð"4°dÔCØ"*×"2Ñ"2×"<Ñ"<Ö">‘J�CØ—K‘K×%Ñ% j°#Ö=ñ #?à—=—=Ø—K‘K×%Ñ%Ð&;¼SÀÇÁÓ=OÔPð	Ø×%Ñ% hÔ/ð —:‘:¤Ò+Ð+Ð+ÜˆDŒJØ�K‰K×Ñ˜xÔ(ä‘7‘=“?×"Ñ"òMøô
 ó Ü%3Ø;ó&�Ô"ð 03×"Ñ"Ô,Ø—‘”Ø"Ÿl™l›n�”Ü�T—[‘[Ô!ß‘ûðûô( $ó Ø&)�Ô#Ø—‘×"Ñ" 8Ô,Ø%(Ô"Ø—‘”Ø"Ÿl™l›n�”Ü�T—[‘[Ô!ß‘ûðúñ 	#ùs{   ƒJ™AF Á0FÁ1F Á5CJÄ9H Å
AJÆJÆJÆF Æ
HÆ)AHÈJÈHÈJÈ
JÈA&JÊJÊJÊJ)
r:   r;   r0   r‹   r<   r/   r�   r2   ri   r9   )r9   r)   r/   zOrigin | Noner0   z'Sequence[ClientExtensionFactory] | Noner1   zSequence[Subprotocol] | Noner2   r"   r3   z*int | None | tuple[int | None, int | None]r4   zLoggerLike | NoneÚreturnÚNone)r™   r   )rj   r   r™   rš   )rR   r   r™   zlist[Extension])rR   r   r™   zSubprotocol | None)r�   r   r™   rš   )r™   zGenerator[None])Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r8   rT   rm   rg   rh   r‚   r…   Ú__static_attributes__Ú__classcell__©r>   s   @r?   r,   r,   0   sœ   ø† ñð8 !%Ø>BØ59Ø!Ø?DØ$(ñ"àð"ð ð	"ð
 <ð"ð 3ð"ð ð"ð =ð"ð "ð"ð 
÷"ð "ô.!8ôF+=ôZG#ôR"ôH0÷)#õ )#rA   c                  ó,   ^ • \ rS rSrSU 4S jjrSrU =r$ )ÚClientConnectioniX  c                ó\   >• [         R                  " S[        5        [        TU ]  " U0 UD6  g )Nz.ClientConnection was renamed to ClientProtocol)ÚwarningsÚwarnÚDeprecationWarningr7   r8   )r=   ÚargsÚkwargsr>   s      €r?   r8   ÚClientConnection.__init__Y  s)   ø€ Ü�ŠØ<Üô	
ô 	‰Ò˜$Ð) &Ó)rA   © )r©   r   rª   r   r™   rš   )r›   rœ   r�   rž   r8   r    r¡   r¢   s   @r?   r¤   r¤   X  s   ø† ÷*õ *rA   r¤   Ú WEBSOCKETS_BACKOFF_INITIAL_DELAYÚ5ÚWEBSOCKETS_BACKOFF_MIN_DELAYz3.1ÚWEBSOCKETS_BACKOFF_MAX_DELAYz90.0ÚWEBSOCKETS_BACKOFF_FACTORz1.618c              #  óx   #   • [         R                   " 5       U -  v •  UnXB:  a  Uv •  XC-  nXB:  a  M   Uv •  M  7f)z‡
Generate a series of backoff delays between reconnection attempts.

Yields:
    How many seconds to wait before retrying to connect.

)Úrandom)Úinitial_delayÚ	min_delayÚ	max_delayÚfactorÚdelays        r?   Úbackoffr¹   g  sF   é € ô �-Š-‹/˜MÑ
)Ò)Ø€EØ
Ó
ØŠØ‰ˆð Õ
ð ØŠñ ùs   ‚/:³:z.legacy.client)ÚWebSocketClientProtocolrT   Úunix_connect)Údeprecated_aliases)
r´   Úfloatrµ   r½   r¶   r½   r·   r½   r™   zGenerator[float])CÚ
__future__r   Úosr³   r¦   Úcollections.abcr   r   Útypingr   Údatastructuresr   r	   Ú
exceptionsr
   r   r   r   r   r   r   r0   r   r   rR   r   r   r   r   r   r   r   r   Úhttp11r   r   Úimportsr   Úprotocolr   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r9   r)   Úutilsr*   r+   Ú__all__r,   r¤   r½   ÚenvironÚgetÚBACKOFF_INITIAL_DELAYÚBACKOFF_MIN_DELAYÚBACKOFF_MAX_DELAYÚBACKOFF_FACTORr¹   Úglobalsr¬   rA   r?   Ú<module>rÐ      sP  ðÝ "ã 	Û Û ß /Ý ç 8÷÷ ñ ÷ :÷	÷ 	ó 	÷ &Ý  ß ?Õ ?÷÷ õ ß +ð Ð
€ôe#�Xô e#ôP	*�~ô *ñ ˜bŸj™jŸn™nÐ-OÐQTÓUÓVÐ Ù˜"Ÿ*™*Ÿ.™.Ð)GÈÓOÓPÐ Ù˜"Ÿ*™*Ÿ.™.Ð)GÈÓPÓQÐ Ù�r—z‘z—~‘~Ð&AÀ7ÓKÓL€ð 1Ø(Ø(Ø"ð	Øðàðð ðð ð	ð
 õñ0 ÙƒIð $4Ø#Ø(ñ	órA   