Ë
    ¸�©jõu  ã                  óî  — 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
mZmZ d dlmZ d dlmZmZmZ d dlZddlmZmZmZ ddlmZmZ dd	lmZmZmZmZm Z  dd
l!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z) ddl*m+Z+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3 ddlm4Z4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z: ddl;m<Z< ddl=m>Z> g d¢Z? e@ej‚                  j…                  dd«      «      ZC G d„ de<«      ZD G d„ d«      ZE	 	 d(	 	 	 	 	 	 	 d)d„ZF	 d dlGmHZH d dlIm.ZJ eHj–                  eHj–                  eHj˜                  eHj˜                  d œZMd!d"d!d"d œZN	 	 	 	 	 	 	 	 d*d#„ZOd+d%„ZQdddd&œ	 	 	 	 	 	 	 	 	 	 	 	 	 d,d'„ZRy# eP$ r 	 	 	 	 	 	 	 	 d*d$„ZOY Œ.w xY w)-é    )ÚannotationsN)ÚAsyncIteratorÚ	GeneratorÚSequence)ÚTracebackType)ÚAnyÚCallableÚLiteralé   )ÚClientProtocolÚbackoffÚprocess_exception)ÚHeadersÚHeadersLike)ÚInvalidProxyMessageÚInvalidProxyStatusÚInvalidStatusÚ
ProxyErrorÚSecurityError)ÚClientExtensionFactory)Ú enable_client_permessage_deflate)Úvalidate_subprotocols)Ú
USER_AGENTÚResponse)Ú
CONNECTINGÚEvent)ÚProxyÚ	get_proxyÚparse_proxyÚprepare_connect_request)ÚStreamReader)Ú
LoggerLikeÚOriginÚPathLikeÚSubprotocol)ÚWebSocketURIÚ	parse_urié   )Ú
Connection)Úrace_events)ÚconnectÚunix_connectÚClientConnectionÚWEBSOCKETS_MAX_REDIRECTSÚ10c                  ór   ‡ — e Zd ZdZdddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
ˆ fd„Zdef	 	 	 	 	 dd„Zdˆ fd	„Zˆ xZS )r-   al  
    :mod:`trio` implementation of a WebSocket client connection.

    :class:`ClientConnection` provides :meth:`recv` and :meth:`send` coroutines
    for receiving and sending messages.

    It supports asynchronous iteration to receive messages::

        async for message in websocket:
            await process(message)

    The iterator exits normally when the connection is closed with close code
    1000 (OK) or 1001 (going away) or without a close code. It raises a
    :exc:`~websockets.exceptions.ConnectionClosedError` when the connection is
    closed with any other code.

    The ``ping_interval``, ``ping_timeout``, ``close_timeout``, and
    ``max_queue`` arguments have the same meaning as in :func:`connect`.

    Args:
        nursery: Trio nursery.
        stream: Trio stream connected to a WebSocket server.
        protocol: Sans-I/O connection.

    é   é
   é   ©Úping_intervalÚping_timeoutÚclose_timeoutÚ	max_queuec          	     óh   •— |  t         ‰| �  |||||||¬«       t        j                  «       | _        y )Nr4   )ÚsuperÚ__init__Útrior   Úresponse_rcvd)	ÚselfÚnurseryÚstreamÚprotocolr5   r6   r7   r8   Ú	__class__s	           €ú]/var/www/html/streamforge-license/venv/lib/python3.12/site-packages/websockets/trio/client.pyr;   zClientConnection.__init__D   s?   ø€ ñ 	Ü‰ÑØØØØ'Ø%Ø'Øð 	ô 	
ô "ŸZ™Z›\ˆÕó    Nc              ƒ  ón  K  — | j                   j                  «       | _        |�%| j                  j                  j	                  |«       |�&| j                  j                  j                  d|«       | j                  t        ¬«      4 ƒd{  –—†  | j                   j                  | j                  «       ddd«      ƒd{  –—†  t        | j                  | j                  «      ƒ d{  –—†  | j                   j                  �| j                   j                  ‚y7 ŒŽ7 Œ[# 1 ƒd{  –—†7  sw Y   ŒkxY w7 ŒJ­w)z1
        Perform the opening handshake.

        Nz
User-Agent)Úexpected_state)rA   r+   ÚrequestÚheadersÚupdateÚ
setdefaultÚsend_contextr   Úsend_requestr*   r=   Ústream_closedÚhandshake_exc)r>   Úadditional_headersÚuser_agent_headers      rC   Ú	handshakezClientConnection.handshake[   sþ   è ø€ ð —}‘}×,Ñ,Ó.ˆŒØÐ)Ø�L‰L× Ñ ×'Ñ'Ð(:Ô;ØÐ(Ø�L‰L× Ñ ×+Ñ+¨LÐ:KÔLØ×$Ñ$´JÐ$Ó?÷ 	5ñ 	5Ø�M‰M×&Ñ& t§|¡|Ô4÷	5÷ 	5ô ˜$×,Ñ,¨d×.@Ñ.@ÓA×AÐAð �=‰=×&Ñ&Ð2Ø—-‘-×-Ñ-Ð-ð 3ð	5øð 	5ø÷ 	5÷ 	5ñ 	5úð 	BúsT   ‚B	D5ÂDÂD5Â&DÂ5D5Ã DÃ'D5Ã(D3Ã)2D5ÄD5ÄD0Ä$D'Ä%D0Ä,D5c                ó¤   •— | j                   €4t        |t        «      sJ ‚|| _         | j                  j	                  «        yt
        ‰| �  |«       y)z.
        Process one incoming event.

        N)ÚresponseÚ
isinstancer   r=   Úsetr:   Úprocess_event)r>   ÚeventrB   s     €rC   rV   zClientConnection.process_eventu   sG   ø€ ð �=‰=Ð Ü˜e¤XÔ.Ð.Ð.Ø!ˆDŒMØ×Ñ×"Ñ"Õ$ô ‰GÑ! %Õ(rD   )r?   útrio.Nurseryr@   útrio.abc.StreamrA   r   r5   úfloat | Noner6   rZ   r7   rZ   r8   ú*int | None | tuple[int | None, int | None]ÚreturnÚNone)rO   úHeadersLike | NonerP   ú
str | Noner\   r]   )rW   r   r\   r]   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r;   r   rQ   rV   Ú__classcell__)rB   s   @rC   r-   r-   )   s�   ø„ ñð@ ')Ø%'Ø&(Ø@Bñ*àð*ð  ð*ð !ð	*ð $ð*ð #ð*ð $ð*ð >ð*ð 
õ*ð2 26Ø(2ð.à.ð.ð &ð.ð 
ó	.÷4)ñ )rD   r-   c                  ó  — e Zd ZdZddddddddedddeddddeddddd	œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zdd„Zdd„Z	dd„Z
dd„Zdd„Zdd„Z	 	 	 	 	 	 	 	 dd„Zdd„Z	 	 	 	 	 	 	 	 dd„Zdd„Zy)r+   aq  
    Connect to the WebSocket server at ``uri``.

    :func:`connect` should be treated as an asynchronous context manager
    yielding a :class:`ClientConnection`, which can then receive and send
    messages::

        from websockets.trio.client import connect

        async with connect(...) as websocket:
            ...

    The connection is closed automatically when exiting the context.

    :func:`connect` can also be treated as an infinite asynchronous iterator
    to reconnect automatically on errors::

        async for websocket in connect(...):
            try:
                ...
            except websockets.exceptions.ConnectionClosed:
                continue

    If the connection fails with a transient error, it is retried with
    exponential backoff. If it fails with a fatal error, the exception is
    raised, breaking out of the loop.

    The connection is closed automatically after each iteration of the loop.

    :func:`connect` cannot be awaited directly. This is because it runs a task
    to manage the connection and Trio doesn't support spawning tasks without a
    context that ensures completion.

    Args:
        uri: URI of the WebSocket server.
        stream: Preexisting TCP stream. ``stream`` overrides the host and port
            from ``uri``. You may call :func:`~trio.open_tcp_stream` to create a
            suitable TCP stream.
        ssl: Configuration for enabling TLS on the connection.
        server_hostname: Host name for the TLS handshake. ``server_hostname``
            overrides the host name from ``uri``.
        origin: Value of the ``Origin`` header, for servers that require it.
        extensions: List of supported extensions, in order in which they
            should be negotiated and run.
        subprotocols: List of supported subprotocols, in order of decreasing
            preference.
        compression: The "permessage-deflate" extension is enabled by default.
            Set ``compression`` to :obj:`None` to disable it. See the
            :doc:`compression guide <../../topics/compression>` for details.
        additional_headers: Arbitrary HTTP headers to add to the handshake
            request.
        user_agent_header: Value of  the ``User-Agent`` request header.
            It defaults to ``"Python/x.y.z websockets/X.Y"``.
            Setting it to :obj:`None` removes the header.
        proxy: If a proxy is configured, it is used by default. Set ``proxy``
            to :obj:`None` to disable the proxy or to the address of a proxy
            to override the system configuration. See the :doc:`proxy docs
            <../../topics/proxies>` for details.
        proxy_ssl: Configuration for enabling TLS on the proxy connection.
        proxy_server_hostname: Host name for the TLS handshake with the proxy.
            ``proxy_server_hostname`` overrides the host name from ``proxy``.
        process_exception: When reconnecting automatically, tell whether an
            error is transient or fatal. The default behavior is defined by
            :func:`~websockets.client.process_exception`. Refer to its
            documentation for details.
        open_timeout: Timeout for opening the connection in seconds.
            :obj:`None` disables the timeout.
        ping_interval: Interval between keepalive pings in seconds.
            :obj:`None` disables keepalive.
        ping_timeout: Timeout for keepalive pings in seconds.
            :obj:`None` disables timeouts.
        close_timeout: Timeout for closing the connection in seconds.
            :obj:`None` disables the timeout.
        reconnect_delays: Delays in seconds between reconnection attempts.
            Default is exponential backoff with 5s jitter, capped at 60s.
        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.
        max_queue: High-water mark of the buffer where frames are received.
            It defaults to 16 frames. The low-water mark defaults to ``max_queue
            // 4``. You may pass a ``(high, low)`` tuple to set the high-water
            and low-water marks. If you want to disable flow control entirely,
            you may set it to ``None``, although that's a bad idea.
        logger: Logger for this client.
            It defaults to ``logging.getLogger("websockets.client")``.
            See the :doc:`logging guide <../../topics/logging>` for details.
        create_connection: Factory for the :class:`ClientConnection` managing
            the connection. Set it to a wrapper or a subclass to customize
            connection handling.

    Any other keyword arguments are passed to :func:`~trio.open_tcp_stream`.
    For example, you can set ``host`` and ``port`` to connect to a different
    host and port from those found in ``uri``. This only changes the destination
    of the TCP connection. The host name from ``uri`` is still used in the TLS
    handshake for secure connections and in the ``Host`` header.

    Raises:
        InvalidURI: If ``uri`` isn't a valid WebSocket URI.
        InvalidProxy: If ``proxy`` isn't a valid proxy.
        OSError: If the TCP connection fails.
        InvalidHandshake: If the opening handshake fails.
        TimeoutError: If the opening handshake times out.

    NÚdeflateTr2   r1   i   r3   )r@   ÚsslÚserver_hostnameÚoriginÚ
extensionsÚsubprotocolsÚcompressionrO   rP   ÚproxyÚ	proxy_sslÚproxy_server_hostnamer   Úopen_timeoutr5   r6   r7   Úreconnect_delaysÚmax_sizer8   ÚloggerÚcreate_connectionc               ó(  — || _         t        |«      | _        | j                  j                  s|�t	        d«      ‚|�t        |«       |dk(  rt        |«      }n|�t	        d|› �«      ‚|€t        j                  d«      }|€t        }|| _
        || _        || _        |	| _        |
| _        || _        || _        || _        || _        || _        || _        || _        || _        || _        t1        |||||¬«      | _        t1        ||||¬«      | _        y )Nz-ssl argument is incompatible with a ws:// URIrf   zunsupported compression: zwebsockets.client)ri   rj   rk   rr   rs   r4   )Úurir'   Úws_uriÚsecureÚ
ValueErrorr   r   ÚloggingÚ	getLoggerr-   r@   rg   rh   rO   rP   rm   rn   ro   r   rp   rq   rs   rt   Úopen_tcp_stream_kwargsÚdictÚprotocol_kwargsÚconnection_kwargs)r>   rv   r@   rg   rh   ri   rj   rk   rl   rO   rP   rm   rn   ro   r   rp   r5   r6   r7   rq   rr   r8   rs   rt   Úkwargss                            rC   r;   zconnect.__init__ó   s1  € ðH ˆŒÜ “nˆŒØ�{‰{×!Ò! c oÜÐLÓMÐMàÐ#Ü! ,Ô/à˜)Ò#Ü9¸*ÓE‰JØÐ$ÜÐ8¸¸ÐFÓGÐGàˆ>Ü×&Ñ&Ð':Ó;ˆFàÐ$Ü 0ÐàˆŒØˆŒØ.ˆÔØ"4ˆÔØ!2ˆÔØˆŒ
Ø"ˆŒØ%:ˆÔ"Ø!2ˆÔØ(ˆÔØ 0ˆÔØˆŒØ!2ˆÔØ&,ˆÔ#Ü#ØØ!Ø%ØØô 
ˆÔô "&Ø'Ø%Ø'Øô	"
ˆÕrD   c              ƒ  óš  K  — | j                   j                  «       }|j                  dd«      }| j                  }|rd}|du rt	        | j
                  «      }|r,t        j                  |j                  d«      «      ƒ d{  –—† S |�Ñt        |«      }|j                  dd dk(  r0t        || j
                  |j                  dd«      ¬	«      ƒ d{  –—† S |j                  dd
 dk(  rg|j                  dk7  r| j                  �t        d«      ‚t        || j
                  f| j                  | j                  | j                  dœ|¤Žƒ d{  –—† S t!        d«      ‚|j#                  d| j
                  j$                  «       |j#                  d| j
                  j&                  «       t        j(                  di |¤Žƒ d{  –—† S 7 �ŒA7 Œô7 Œ}7 Œ­w)zFOpen a TCP or Unix connection to the server, possibly through a proxy.ÚunixFNTÚpathé   ÚsocksÚlocal_address)Ú
local_addré   ÚhttpÚhttpsz8proxy_ssl argument is incompatible with an http:// proxy©rP   rg   rh   z&parse_proxy returned unsupported proxyÚhostÚport© )r|   ÚcopyÚpoprm   r   rw   r<   Úopen_unix_socketr   ÚschemeÚconnect_socks_proxyrn   ry   Úconnect_http_proxyrP   ro   ÚAssertionErrorrJ   rŒ   r�   Úopen_tcp_stream)r>   r€   r‚   rm   Úproxy_parseds        rC   r–   zconnect.open_tcp_streamF  s»  è ø€ à×,Ñ,×1Ñ1Ó3ˆØ�z‰z˜& %Ó(ˆà—
‘
ˆÙØˆEØ�D‰=Ü˜dŸk™kÓ*ˆEáÜ×.Ñ.¨v¯z©z¸&Ó/AÓB×BÐBàÐÜ& uÓ-ˆLà×"Ñ" 2 AÐ&¨'Ò1Ü0Ø Ø—K‘Kð  &Ÿz™z¨/¸4Ó@ô÷ ð ð ×$Ñ$ R aÐ(¨FÒ2Ø×&Ñ&¨'Ò1°d·n±nÐ6PÜ$ØRóð ô 0Ø Ø—K‘Kðð '+×&<Ñ&<ØŸ™Ø$(×$>Ñ$>ñð ñ÷ ð ô %Ð%MÓNÐNð ×Ñ˜f d§k¡k×&6Ñ&6Ô7Ø×Ñ˜f d§k¡k×&6Ñ&6Ô7Ü×-Ñ-Ñ7°Ñ7×7Ð7ðE Cùðøðøð 8úsK   ‚A?GÂGÂAGÃGÃA8GÅ	GÅ
A3GÆ=G	Æ>GÇGÇGÇ	Gc              ƒ  ó,  K  — | j                   €t        j                  «       }n| j                   }| j                  €| j                  j
                  }n| j                  }t        j                  |||d¬«      }|j                  «       ƒ d{  –—†  |S 7 Œ­w)zEnable TLS on the connection.NT©rh   Úhttps_compatible)	rg   Ú
ssl_moduleÚcreate_default_contextrh   rw   rŒ   r<   Ú	SSLStreamÚdo_handshake)r>   r@   rg   rh   Ú
ssl_streams        rC   Ú
enable_tlszconnect.enable_tlsv  s†   è ø€ à�8‰8ÐÜ×3Ñ3Ó5‰Cà—(‘(ˆCØ×ÑÐ'Ø"Ÿk™k×.Ñ.‰Oà"×2Ñ2ˆOÜ—^‘^ØØØ+Ø!ô	
ˆ
ð ×%Ñ%Ó'×'Ð'ØÐð 	(ús   ‚B	BÂBÂBc              ƒ  ó„  K  — | j                   €| j                  «       ƒ d{  –—† }n| j                   }	 | j                  j                  r| j	                  |«      ƒ d{  –—† }t        | j                  fi | j                  ¤Ž} | j                  |||fi | j                  ¤Ž}|j                  | j                  | j                  «      ƒ d{  –—†  |S 7 Œ°7 Œu7 Œ
# t        j                  $ r* t        j                  |«      ƒ d{  –—†7   t        d«      ‚t         $ r  t        j                  |«      ƒ d{  –—†7   ‚ w xY w­w)zCreate a WebSocket connection.Nznursery should be canceled)r@   r–   rw   rx   r    r   r~   rt   r   rQ   rO   rP   r<   Ú	CancelledÚaclose_forcefullyr•   Ú	Exception)r>   r?   r@   rA   Ú
connections        rC   Úopen_connectionzconnect.open_connection‰  s6  è ø€ à�;‰;ÐØ×/Ñ/Ó1×1‰Fà—[‘[ˆFð!	Ø�{‰{×!Ò!Ø#Ÿ™¨vÓ6×6�ä%Ø—‘ñà×&Ñ&ñˆHð 0˜×/Ñ/ØØØñð ×(Ñ(ñ	ˆJð ×&Ñ&Ø×'Ñ'Ø×&Ñ&ó÷ ð ð$ ÐðO 2øð 7øðùô
 �~‰~ò 	?Ü×(Ñ(¨Ó0×0Ñ0ô !Ð!=Ó>Ð>Üò 	ô ×(Ñ(¨Ó0×0Ñ0Øð	üsc   ‚ E ¢C£E µ*C ÁCÁ A,C ÃCÃC ÃE ÃC ÃC Ã+D=ÄDÄ0D=Ä5D8Ä6D=Ä=E c                óº  — t        |t        «      r0|j                  j                  dv rd|j                  j                  v s|S | j
                  }t        j                  j                  | j                  |j                  j                  d   «      }t        |«      }| j                  �t        d|› d�«      S |j                  r|j                  st        d|› �«      S |j                  |j                  k7  s2|j                  |j                  k7  s|j                   |j                   k7  r´| j"                  j%                  dd«      rt        d|› d	�«      S | j"                  j%                  d
«      €| j"                  j%                  d«      �t        d|› d�«      S | j&                  �8t)        d„ t)        | j&                  «      j+                  «       D «       «      | _        |S )z¬
        Determine whether a connection error is a redirect that can be followed.

        Return the new URI if it's a valid redirect. Else, return an exception.

        )é,  i-  i.  i/  i3  i4  ÚLocationzcannot follow redirect to z with a preexisting streamz)cannot follow redirect to non-secure URI r‚   Fz'cannot follow cross-origin redirect to z with a Unix socketrŒ   r�   z with an explicit host or portc              3  óN   K  — | ]  \  }}|j                  «       d vr||f–— Œ y­w))ÚauthorizationÚcookiezproxy-authorizationN)Úlower)Ú.0ÚkeyÚvalues      rC   ú	<genexpr>z+connect.process_redirect.<locals>.<genexpr>ó  s2   è ø€ ò á&˜C ØŸ9™9›;ØQñRð ˜eœñùs   ‚#%)rT   r   rS   Ústatus_coderH   rw   ÚurllibÚparseÚurljoinrv   r'   r@   ry   rx   r   rŒ   r�   r|   ÚgetrO   r   Ú	raw_items)r>   ÚexcÚ
old_ws_uriÚnew_uriÚ
new_ws_uris        rC   Úprocess_redirectzconnect.process_redirectµ  sÅ  € ô �sœMÔ*Ø—‘×(Ñ(ðñð ˜cŸl™l×2Ñ2Ñ2àˆJà—[‘[ˆ
Ü—,‘,×&Ñ& t§x¡x°·±×1EÑ1EÀjÑ1QÓRˆÜ˜wÓ'ˆ
ð �;‰;Ð"ÜØ,¨W¨IÐ5OÐPóð ð
 ×Ò Z×%6Ò%6Ü Ð#LÈWÈIÐ!VÓWÐWð ×Ñ ×!2Ñ!2Ò2Ø�‰ *§/¡/Ò1Ø�‰ *§/¡/Ò1ð ×*Ñ*×.Ñ.¨v°uÔ=Ü!Ø=¸g¸Yð G)ð *óð ð ×+Ñ+×/Ñ/°Ó7ÐCØ×.Ñ.×2Ñ2°6Ó:ÐFä!Ø=¸g¸Yð G4ð 5óð ð ×&Ñ&Ð2Ü*1ñä*1°$×2IÑ2IÓ*J×*TÑ*TÓ*Vôó+�Ô'ð ˆrD   c              ƒ  ó\  K  — 	 | j                   €t        j                  «       nt        j                  | j                   «      5  t	        t
        «      D ]8  }	 | j                  |«      ƒ d {  –—† }|j                  «        |c cd d d «       S  t        dt
        › d�«      ‚7 Œ5# t        $ rJ}| j                  |«      }t        |t        «      r||u r‚ ||‚|| _        t        |«      | _        Y d }~Œžd }~ww xY w# 1 sw Y   y xY w# t        j                  $ r}t!        d«      |‚d }~ww xY w­w)Nz
more than z
 redirectsz"timed out during opening handshake)rp   r<   ÚCancelScopeÚ
fail_afterÚrangeÚMAX_REDIRECTSr¦   Ústart_keepaliver¤   r¼   rT   rv   r'   rw   r   ÚTooSlowErrorÚTimeoutError)r>   r?   Ú_r¥   r¸   Ú
exc_or_uris         rC   r+   zconnect.connectý  s4  è ø€ ð	Nð ×$Ñ$Ð,ô × Ñ Ô"ä—_‘_ T×%6Ñ%6Ó7ñPô
 œ}Ó-ò P�Að*Ø+/×+?Ñ+?ÀÓ+H×%H˜
ð  #×2Ñ2Ô4Ø)Ñ)÷1Pñ Pð
Pô* (¨*´]°OÀ:Ð(NÓOÐOð' &IùÜ$ò %Ø%)×%:Ñ%:¸3Ó%?˜
Ü% j´)Ô<à)¨SÑ0Ø %à&0°cÐ 9ð (2˜DœHÜ*3°JÓ*?˜DœKÜ$ûð%ú÷Pð Pûô8 × Ñ ò 	NäÐCÓDÈ#ÐMûð	Nüs�   ‚D,„?D ÁC9ÁB#Á+B!Á,B#Á0C9Â	D ÂD,ÂC9Â!B#Â#	C6Â,A C1Ã,C9Ã1C6Ã6C9Ã9DÃ>D ÄD,ÄD ÄD)ÄD$Ä$D)Ä)D,c              ƒ  óB  K  — | j                  «       ƒ d {  –—†  	 | j                  | j                  «      ƒ d {  –—† | _        | j                  S 7 Œ97 Œ# t        $ r?}| j                  t        |«      ||j                  «      ƒ d {  –—†7   t        d«      ‚d }~ww xY w­w)Nz4expected __aexit_nursery__ to re-raise the exception)	Ú__aenter_nursery__r+   r?   r¥   ÚBaseExceptionÚ__aexit_nursery__ÚtypeÚ__traceback__r•   )r>   r¸   s     rC   Ú
__aenter__zconnect.__aenter__$  s‡   è ø€ Ø×%Ñ%Ó'×'Ð'ð	YØ$(§L¡L°·±Ó$>×>ˆDŒOØ—?‘?Ð"ð 	(øà>ùäò 	YØ×(Ñ(¬¨c«°C¸×9JÑ9JÓK×KÑKÜ Ð!WÓXÐXûð	YüsN   ‚B–A—BœA ºA»A ÁBÁA Á	BÁ)BÂB	ÂBÂBÂBc              ƒ  óè   K  — 	 	 | j                   j                  «       ƒ d {  –—†  | ` 	 | j                  |||«      ƒ d {  –—†  y 7 Œ## | ` w xY w7 Œ# | j                  |||«      ƒ d {  –—†7   w xY w­w)N)r¥   ÚacloserÊ   )r>   Úexc_typeÚ	exc_valueÚ	tracebacks       rC   Ú	__aexit__zconnect.__aexit__-  sk   è ø€ ð	Ið$Ø—o‘o×,Ñ,Ó.×.Ð.à‘Oà×(Ñ(¨°9¸iÓH×HÑHð	 /ùà‘OúàHù�$×(Ñ(¨°9¸iÓH×HÒHüsZ   ‚A2…A ¢A£A §A ªA2Á AÁA2ÁA ÁAÁA ÁA2ÁA/Á(A+Á)A/Á/A2c              ƒ  ó¾   K  — t        | d«      rt        d«      ‚t        j                  «       | _        | j                  j                  «       ƒ d {  –—† | _        y 7 Œ
­w)NÚnursery_managerzconnect() isn't reentrant)ÚhasattrÚRuntimeErrorr<   Úopen_nurseryrÕ   rÍ   r?   )r>   s    rC   rÈ   zconnect.__aenter_nursery__;  sJ   è ø€ Ü�4Ð*Ô+ÜÐ:Ó;Ð;Ü#×0Ñ0Ó2ˆÔØ!×1Ñ1×<Ñ<Ó>×>ˆ�Ð>ús   ‚AAÁAÁAc              ƒ  ó^  K  — 	 | j                   j                  |||«      ƒ d {  –—†  | ` y 7 Œ# t        $ rl}t        |t        «      sJ ‚	 t
        j                  j                  |«       n-# t
        j                  j                  $ r t        d«      |‚w xY wY d }~| ` y d }~ww xY w# | ` w xY w­w)Nz8unexpected multiple exceptions; please file a bug report)
rÕ   rÓ   rÉ   rT   ÚBaseExceptionGroupr<   Ú_utilÚ!raise_single_exception_from_groupÚMultipleExceptionErrorr•   )r>   rÐ   rÑ   rÒ   r¸   s        rC   rÊ   zconnect.__aexit_nursery__A  s±   è ø€ ð	%Ø×&Ñ&×0Ñ0°¸9ÀiÓP×PÐPð Ñ$ð QùÜò 	Ü˜cÔ#5Ô6Ð6Ð6ðÜ—
‘
×<Ñ<¸SÕAøÜ—:‘:×4Ñ4ò Ü$ØNóàððúó Bð Ñ$ûð	ûð Ñ$üs`   ‚B-„ . ¤,¥. ©B-¬. ®	B#·BÁ
A*Á)BÁ**BÂBÂB& ÂB-ÂB#Â#B& Â&B*Â*B-c               ó  K  — d }	 	 | 4 ƒd {  –—† }|­–— d d d «      ƒd {  –—†  d }Œ$7 Œ7 Œ	# 1 ƒd {  –—†7  sw Y   ŒxY w# t         $ r»}	 | j                  |«      }n# t         $ r}|}Y d }~nd }~ww xY w||u r‚ |�||‚|€| j                  «       }t        |«      }| j                  j                  d|t        j                  |«      d   j                  «       «       t        j                  |«      ƒ d {  –—†7   Y d }~ŒÙd }~ww xY w­w)Nz0connect failed; reconnecting in %.1f seconds: %sr   )r¤   r   rq   Únextrs   ÚinforÒ   Úformat_exception_onlyÚstripr<   Úsleep)r>   Údelaysr¥   r¸   Únew_excÚ
raised_excÚdelays          rC   Ú	__aiter__zconnect.__aiter__[  s  è ø€ Ø*.ˆØð"Ø÷ %ð % :Ø$Ó$÷%÷ %ðB �ðG ð%øð %ø÷ %÷ %ñ %ûäò (ð
)Ø"×4Ñ4°SÓ9‘GøÜ ò )Ø(•Gûð)úð
 ˜c‘>ØØÐ&Ø! sÐ*ð �>Ø!×2Ñ2Ó4�FÜ˜V›�Ø—‘× Ñ ØFØÜ×3Ñ3°CÓ8¸Ñ;×AÑAÓCôô
 —j‘j Ó'×'Ö'ûð7(üs–   ‚D
‡A �*ŽA ‘.—A ¢,£A §D
ªA ¬A ®A ´7µA ¼A Á	DÁAÁDÁ	A4Á(A/Á*DÁ/A4Á4BDÃ7C:Ã8DÃ=D
ÄDÄD
)2rv   Ústrr@   ztrio.abc.Stream | Nonerg   ússl_module.SSLContext | Nonerh   r_   ri   zOrigin | Nonerj   z'Sequence[ClientExtensionFactory] | Nonerk   zSequence[Subprotocol] | Nonerl   r_   rO   r^   rP   r_   rm   zstr | Literal[True] | Nonern   rê   ro   r_   r   z'Callable[[Exception], Exception | None]rp   rZ   r5   rZ   r6   rZ   r7   rZ   rq   zCallable[[], Generator[float]]rr   r[   r8   r[   rs   zLoggerLike | Nonert   ztype[ClientConnection] | Noner€   r   r\   r]   )r\   rY   )r@   rY   r\   rY   )r?   rX   r\   r-   )r¸   r¤   r\   zException | str)r\   r-   )rÐ   ztype[BaseException] | NonerÑ   zBaseException | NonerÒ   zTracebackType | Noner\   r]   )r\   r]   )r\   zAsyncIterator[ClientConnection])r`   ra   rb   rc   r   r   r   r;   r–   r    r¦   r¼   r+   rÍ   rÓ   rÈ   rÊ   rè   rŽ   rD   rC   r+   r+   …   s÷  „ ñhðd *.Ø,0Ø&*à $Ø>BØ59Ø"+à15Ø(2Ø,0Ø26Ø,0ØEVà%'Ø&(Ø%'Ø&(Ø;Bà?DØ@Bà$(à;?ñAQ
àðQ
ð
 'ðQ
ð *ðQ
ð $ðQ
ð ðQ
ð <ðQ
ð 3ðQ
ð  ðQ
ð /ðQ
ð &ðQ
ð  *ð!Q
ð" 0ð#Q
ð$  *ð%Q
ð& Cð'Q
ð* #ð+Q
ð, $ð-Q
ð. #ð/Q
ð0 $ð1Q
ð2 9ð3Q
ð6 =ð7Q
ð8 >ð9Q
ð< "ð=Q
ð@ 9ðAQ
ðD ðEQ
ðF 
óGQ
óf.8ó`ó&*óXFóP NóNYðIà,ðIð (ðIð (ð	Ið
 
óIó?ð%à,ð%ð (ð%ð (ð	%ð
 
ó%ô4%rD   r+   c                ó®   — |j                  d«      }| €|€t        d«      ‚| �|�t        d«      ‚|€|j                  d«      €d}nd}t        d	|d| dœ|¤ŽS )
aã  
    Connect to a WebSocket server listening on a Unix socket.

    This function accepts the same keyword arguments as :func:`connect`.

    It's only available on Unix.

    It's mainly useful for debugging servers listening on Unix sockets.

    Args:
        path: File system path to the Unix socket.
        uri: URI of the WebSocket server. ``uri`` defaults to
            ``ws://localhost/`` or, when a ``ssl`` argument is provided, to
            ``wss://localhost/``.

    r@   zmissing path argumentz path is incompatible with streamrg   zws://localhost/zwss://localhost/T)rv   r‚   rƒ   rŽ   )r¶   ry   r+   )rƒ   rv   r€   r@   s       rC   r,   r,   ƒ  ss   € ð* �Z‰Z˜Ó!€FØ€|˜˜ÜÐ0Ó1Ð1Ø	Ð	˜fÐ0ÜÐ;Ó<Ð<à
€{Ø�:‰:�eÓÐ$Ø#‰Cà$ˆCäÐ;�s ¨DÑ;°FÑ;Ð;rD   )Ú	ProxyType)r   )Úsocks5hÚsocks5Úsocks4aÚsocks4TFc           	   ‹  ó–  K  — t        t        | j                     | j                  | j                  | j
                  | j                  t        | j                     «      }	 t        j                   |j                  |j                  |j                  fi |¤Žƒ d{  –—† «      S 7 Œ# t        $ r ‚ t        $ r}t        d«      |‚d}~ww xY w­w)z0Connect via a SOCKS proxy and return the socket.Nz failed to connect to SOCKS proxy)Ú
SocksProxyÚSOCKS_PROXY_TYPESr’   rŒ   r�   ÚusernameÚpasswordÚSOCKS_PROXY_RDNSr<   ÚSocketStreamr+   ÚOSErrorr¤   r   )rm   rw   r€   Úsocks_proxyr¸   s        rC   r“   r“   Ã  s®   è ø€ ô !Ü˜eŸl™lÑ+Ø�J‰JØ�J‰JØ�N‰NØ�N‰NÜ˜UŸ\™\Ñ*ó
ˆð	JÜ×$Ñ$Ø)�k×)Ñ)¨&¯+©+°v·{±{ÑMÀfÑM×Móð ØMùäò 	ØÜò 	JÜÐ?Ó@ÀcÐIûð	Jüs<   ‚AC	Á:B# ÂB!ÂB# Â C	Â!B# Â#CÂ5CÃCÃC	c              ‹  ó    K  — t        d«      ‚­w)Nz6connecting through a SOCKS proxy requires python-socks)ÚImportError)rm   rw   r€   s      rC   r“   r“   ­  s   è ø€ ô
 ÐRÓSÐSùs   ‚c              ƒ  ó0  K  — t        «       }t        j                  |j                  |j                  |j
                  d¬«      }	 	 | j                  d«      ƒ d {  –—† }|r|j                  |«       n|j                  «        t        |«       ŒI7 Œ4# t        $ ra}t        |j                  t        «      sJ ‚|j                  }d|j                  cxk  rdk  rn t        |«      ‚|cY d }~S t        |«      ‚d }~wt        $ r}t!        d«      |‚d }~ww xY w­w)NT)rm   i   éÈ   r¨   z0did not receive a valid HTTP response from proxy)r!   r   r´   Ú	read_lineÚ
read_exactÚread_to_eofÚreceive_someÚ	feed_dataÚfeed_eofrß   ÚStopIterationrT   r°   r²   r   r¤   r   )r@   ÚreaderÚparserÚdatar¸   rS   s         rC   Úread_connect_responser  Þ  sú   è ø€ Ü‹^€FÜ�^‰^Ø×ÑØ×ÑØ×ÑØô	€FðØØ×,Ñ,¨TÓ2×2ˆDÙØ× Ñ  Õ&à—‘Ô!Ü�ŒLð Ø2ùô ò /Ü˜#Ÿ)™)¤XÔ.Ð.Ð.Ø—9‘9ˆØ�(×&Ñ&Ô,¨Ô,ô % XÓ.Ð.ð �Oä$ XÓ.Ð.ûÜò Ü!Ø>ó
àð	ûðüsO   ‚ADÁB ÁBÁ5B Â	DÂAC6Ã%DÃ&DÃ+C6Ã6DÄDÄDÄDr‹   c             ‹  ó<  K  — t        j                  | j                  | j                  fi |¤Žƒ d {  –—† }	 | j                  dk(  rW|€t        j                  «       }|€| j                  }t        j                  |||d¬«      }|j                  «       ƒ d {  –—†  |}t        | ||«      }|j                  |«      ƒ d {  –—†  t        |«      ƒ d {  –—†  |S 7 Œ¦7 ŒC7 Œ7 Œ# t         j                  t        f$ r  t        j                  |«      ƒ d {  –—†7   ‚ w xY w­w)NrŠ   Tr™   )r<   r–   rŒ   r�   r’   r›   rœ   r�   rž   r    Úsend_allr  r¢   r¤   r£   )	rm   rw   rP   rg   rh   r€   r@   rŸ   rG   s	            rC   r”   r”   û  s  è ø€ ô ×'Ñ'¨¯
©
°E·J±JÑIÀ&ÑI×I€Fðà�<‰<˜7Ò"Øˆ{Ü ×7Ñ7Ó9�ØÐ&Ø"'§*¡*�ÜŸ™ØØØ /Ø!%ô	ˆJð ×)Ñ)Ó+×+Ð+ØˆFô *¨%°Ð9JÓKˆØ�o‰o˜gÓ&×&Ð&Ü# FÓ+×+Ð+ð €Mð7 Jøð ,øð
 	'øØ+ùä�N‰NœIÐ&ò Ü×$Ñ$ VÓ,×,Ñ,Øðüsi   ‚/D±C²D·AC  ÂCÂ'C  Â>CÂ?C  ÃCÃC  ÃDÃC  ÃC  ÃC  Ã 1DÄDÄDÄD)NN)rƒ   zPathLike | Nonerv   r_   r€   r   r\   r+   )rm   r   rw   r&   r€   r   r\   rY   )r@   rY   r\   r   )rm   r   rw   r&   rP   r_   rg   rê   rh   r_   r€   r   r\   rY   )SÚ
__future__r   rz   Úosrg   r›   rÒ   Úurllib.parser³   Úcollections.abcr   r   r   Útypesr   Útypingr   r	   r
   r<   Úclientr   r   r   Údatastructuresr   r   Ú
exceptionsr   r   r   r   r   Úextensions.baser   Úextensions.permessage_deflater   rH   r   Úhttp11r   r   rA   r   r   rm   r   r   r   r    Ústreamsr!   r"   r#   r$   r%   rv   r&   r'   r¥   r)   Úutilsr*   Ú__all__ÚintÚenvironr¶   rÁ   r-   r+   r,   Úpython_socksrì   Úpython_socks.async_.triorò   ÚSOCKS5ÚSOCKS4ró   rö   r“   rû   r  r”   rŽ   rD   rC   ú<module>r      sì  ðÝ "ã Û 	Û Û Û ß >Ñ >Ý ß )Ñ )ã ç ?Ñ ?ß 1÷õ õ 5Ý LÝ +ß )ß (ß JÓ JÝ "ß >Ó >ß )Ý "Ý ò :€á�B—J‘J—N‘NÐ#=¸tÓDÓE€ôX)�zô X)÷x{ñ {ð~ !Øð!<Ø
ð!<à	ð!<ð ð!<ð ó	!<ðH4JÝ&Ý<ð ×#Ñ#Ø×"Ñ"Ø×#Ñ#Ø×"Ñ"ñ	Ðð ØØØñ	ÐðJØðJàðJð ðJð 
ó	Jó6ðB %)Ø(,Ø"&ñ%Øð%àð%ð "ð	%ð
 
&ð%ð  ð%ð ð%ð ô%øða ò TðTØðTàðTð ðTð 
õ	TðTús   Ã7E  Å E4Å3E4