§
    ßŽ’j²  ã                  ój  — U d dl mZ d dl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 erddlmZmZ g d¢Zeegd	f         Zd
ed<   	 eege	d         f         Zd
ed<   	  G d„ d¦  «        Zeeegd	f         Zd
ed<   eeege	d         f         Zd
ed<   eeeef         Zd
ed<   dd„Zd d„Zd!d„Zd!d„ZdS )"é    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚUnionÚCallableÚIterableÚ	Awaitable)Ú	TypeAliasé   )Ú
APIRequest)ÚAPIResponseÚAsyncAPIResponse)Ú
MiddlewareÚCallNextÚAsyncCallNextÚMiddlewareCallableÚAsyncMiddlewareCallableÚMiddlewareInputúAPIResponse[Any]r
   r   úAsyncAPIResponse[Any]r   c                  ó"   — e Zd ZdZdd„Zdd„ZdS )r   zìBase class for client-level middleware.

    Subclass and override `handle` (used by the sync client) and/or `handle_async`
    (used by the async client). The default implementations delegate straight to
    the rest of the chain.
    Úrequestr   Ú	call_nextr   Úreturnr   c                ó   —  ||¦  «        S ©N© ©Úselfr   r   s      úCC:\Projects\DSCons\.venv\Lib\site-packages\anthropic\_middleware.pyÚhandlezMiddleware.handle6   s   € Øˆy˜Ñ!Ô!Ð!ó    r   r   c              ƒ  ó(   K  —  ||¦  «        ƒ d {V —†S r   r   r   s      r    Úhandle_asynczMiddleware.handle_async9   s(   è è € Ø�Y˜wÑ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'r"   N)r   r   r   r   r   r   )r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r$   r   r"   r    r   r   .   sF   € € € € € ðð ð"ð "ð "ð "ð(ð (ð (ð (ð (ð (r"   r   r   r   r   Ú
middlewareÚobjectr   Ústrc                óÂ   — t          | t          ¦  «        rt          | ¦  «        j        S t	          | dd ¦  «        }t          |t
          ¦  «        r|nt          | ¦  «        S )Nr%   )Ú
isinstancer   Útyper%   Úgetattrr+   Úrepr)r)   Únames     r    Ú_middleware_namer2   B   sW   € Ý�*�jÑ)Ô)ð )Ý�JÑÔÔ(Ð(Ý�:˜z¨4Ñ0Ô0€DÝ˜d¥CÑ(Ô(Ð>ˆ4ˆ4­d°:Ñ.>Ô.>Ð>r"   ÚobjÚboolc                ó€   — t          j        | ¦  «        rdS t          | dd¦  «        }|duot          j        |¦  «        S )z·Whether calling the given object returns a coroutine.

    Unlike `inspect.iscoroutinefunction(obj)` this also handles class instances
    that define an async `__call__` method.
    TÚ__call__N)ÚinspectÚiscoroutinefunctionr/   )r3   Úcalls     r    Ú_is_async_callabler:   I   sH   € õ Ô" 3Ñ'Ô'ð ØˆtÝ�3˜
 DÑ)Ô)€DØ�tÐÐA¥Ô ;¸DÑ AÔ AÐAr"   úIterable[MiddlewareInput]ÚNonec                ó  — | D ]ü}t          |t          ¦  «        r‡t          |¦  «        j        t          j        u r t	          dt          |¦  «        › d�¦  «        ‚t          j        t          |¦  «        j        ¦  «        r t	          dt          |¦  «        › d�¦  «        ‚Œžt          |¦  «        s t	          dt          |¦  «        › d�¦  «        ‚t          |¦  «        r t	          dt          |¦  «        › d�¦  «        ‚Œýd S )Númiddleware zW does not implement `handle()`; the synchronous client requires sync-capable middlewarezj defines `handle()` as an async function; the synchronous client requires `handle()` to be a sync functionú is not callablezP is an async function; the synchronous client requires sync middleware functions)
r-   r   r.   r!   Ú	TypeErrorr2   r7   r8   Úcallabler:   ©r)   Úentrys     r    Úvalidate_sync_middlewarerD   U   sN  € Øð ð ˆÝ�e�ZÑ(Ô(ð 	Ý�E‰{Œ{Ô!¥ZÔ%6Ð6Ð6ÝðNÕ"2°5Ñ"9Ô"9ð Nð Nð Nñô ð õ Ô*­4°©;¬;Ô+=Ñ>Ô>ð ÝðWÕ"2°5Ñ"9Ô"9ð Wð Wð Wñô ð ðõ
 ˜%‘”ð 	ÝÐSÕ*:¸5Ñ*AÔ*AÐSÐSÐSÑTÔTÐTÝ Ñ&Ô&ð 	ÝðLÕ.¨uÑ5Ô5ð Lð Lð Lñô ð ð	ðð r"   c                ó  — | D ]ü}t          |t          ¦  «        r‡t          |¦  «        j        t          j        u r t	          dt          |¦  «        › d�¦  «        ‚t          j        t          |¦  «        j        ¦  «        s t	          dt          |¦  «        › d�¦  «        ‚Œžt          |¦  «        s t	          dt          |¦  «        › d�¦  «        ‚t          |¦  «        s t	          dt          |¦  «        › d�¦  «        ‚Œýd S )Nr>   z_ does not implement `handle_async()`; the asynchronous client requires async-capable middlewarezw defines `handle_async()` as a sync function; the asynchronous client requires `handle_async()` to be an async functionr?   zV is not an async function; the asynchronous client requires async middleware functions)
r-   r   r.   r$   r@   r2   r7   r8   rA   r:   rB   s     r    Úvalidate_async_middlewarerF   k   sN  € Øð ð ˆÝ�e�ZÑ(Ô(ð 	Ý�E‰{Œ{Ô'­:Ô+BÐBÐBÝðPÕ"2°5Ñ"9Ô"9ð Pð Pð Pñô ð õ Ô.­t°E©{¬{Ô/GÑHÔHð Ýð`Õ"2°5Ñ"9Ô"9ð `ð `ð `ñô ð ðõ
 ˜%‘”ð 	ÝÐSÕ*:¸5Ñ*AÔ*AÐSÐSÐSÑTÔTÐTÝ# EÑ*Ô*ð 	ÝðNÕ.¨uÑ5Ô5ð Nð Nð Nñô ð ð	ðð r"   )r)   r*   r   r+   )r3   r*   r   r4   )r)   r;   r   r<   )Ú
__future__r   r7   Útypingr   r   r   r   r   r	   Útyping_extensionsr
   Ú_requestr   Ú	_responser   r   Ú__all__r   Ú__annotations__r   r   r   r   r   r2   r:   rD   rF   r   r"   r    ú<module>rN      sç  ðØ "Ð "Ð "Ð "Ð "Ð "Ð "à €€€Ø KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KÐ KØ 'Ð 'Ð 'Ð 'Ð 'Ð 'à  Ð  Ð  Ð  Ð  Ð  àð 9Ø8Ð8Ð8Ð8Ð8Ð8Ð8Ð8ðð ð €ð  
˜|Ð-?Ð?Ô@€Ð @Ð @Ð @Ñ @ð	ð $ Z L°)Ð<SÔ2TÐ$TÔU€Ð UÐ UÐ UÑ Uð	ð(ð (ð (ð (ð (ñ (ô (ð (ð !)¨*°hÐ)?ÐASÐ)SÔ TÐ Ð TÐ TÐ TÑ TØ%-¨z¸=Ð.IÈ9ÐUlÔKmÐ.mÔ%nÐ Ð nÐ nÐ nÑ nØ" :Ð/AÐCZÐ#ZÔ[€Ð [Ð [Ð [Ñ [ð?ð ?ð ?ð ?ð	Bð 	Bð 	Bð 	Bðð ð ð ð,ð ð ð ð ð r"   