§
    ™Štjâx  ã            
      óP  — d dl mZ d dlZd dlZd dlmZmZ d dlmZm	Z	  ej
        de	j        ¬¦  «        Z ej
        de	j        ¬¦  «        Z G d„ d	¦  «        Z ej
        d
d¬¦  «        Z G d„ dej        e         ¦  «        Z ej
        dd¬¦  «        Z G d„ dej        e         ¦  «        Z ej
        dd¬¦  «        Z ej
        dd¬¦  «        Z ej
        dd¬¦  «        Z ej
        dd¬¦  «        Z ej
        dd¬¦  «        Z G d„ dej        eeeeef         ¦  «        Z G d„ dee	j        e	j        e	j        e	j        e	j         f         ¦  «        Z! G d„ dee	j"        e	j#        e	j$        e	j%        e	j&        f         ¦  «        Z' G d„ dee	j(        e	j)        e	j*        e	j+        e	j,        f         ¦  «        Z- G d „ d!ej        e         ¦  «        Z. G d"„ d#¦  «        Z/ ej
        d$ee0e1ej2        f                  ¬¦  «        Z3 G d%„ d&¦  «        Z4d7d.„Z5d8d1„Z6d9d5„Z7g d6¢Z8dS ):é    )ÚannotationsN)ÚCallableÚSequence)Ú
exceptionsÚtypesÚTH)ÚboundÚAHc                  ó2   — e Zd ZdZdZeZ	 eZ	 d
d„Zdd„Zd	S )ÚAutha  Add custom authentication and authorization management to your LangGraph application.

    The Auth class provides a unified system for handling authentication and
    authorization in LangGraph applications. It supports custom user authentication
    protocols and fine-grained authorization rules for different resources and
    actions.

    To use, create a separate python file and add the path to the file to your
    LangGraph API configuration file (`langgraph.json`). Within that file, create
    an instance of the Auth class and register authentication and authorization
    handlers as needed.

    Example `langgraph.json` file:

    ```json
    {
      "dependencies": ["."],
      "graphs": {
        "agent": "./my_agent/agent.py:graph"
      },
      "env": ".env",
      "auth": {
        "path": "./auth.py:my_auth"
      }
    ```

    Then the LangGraph server will load your auth file and run it server-side whenever a request comes in.

    ???+ example "Basic Usage"

        ```python
        from langgraph_sdk import Auth

        my_auth = Auth()

        @my_auth.authenticate
        async def authenticate(authorization: str) -> Auth.types.MinimalUserDict:
            user = await verify_token(authorization)  # Your token verification logic
            if not user:
                raise Auth.exceptions.HTTPException(
                    status_code=401, detail="Unauthorized"
                )
            return {
                "identity": user["id"],
                "permissions": user.get("permissions", []),
            }

        # Default deny: reject all requests that don't have a specific handler
        @my_auth.on
        async def deny_all(ctx: Auth.types.AuthContext, value: Any) -> False:
            return False

        # Allow users to create threads with their own identity as owner
        @my_auth.on.threads.create
        async def allow_thread_create(
            ctx: Auth.types.AuthContext, value: Auth.types.on.threads.create.value
        ):
            metadata = value.setdefault("metadata", {})
            metadata["owner"] = ctx.user.identity

        # Allow users to read and search their own threads
        @my_auth.on.threads.read
        async def allow_thread_read(
            ctx: Auth.types.AuthContext, value: Auth.types.on.threads.read.value
        ) -> Auth.types.FilterType:
            return {"owner": ctx.user.identity}

        @my_auth.on.threads.search
        async def allow_thread_search(
            ctx: Auth.types.AuthContext, value: Auth.types.on.threads.search.value
        ) -> Auth.types.FilterType:
            return {"owner": ctx.user.identity}

        # Scope all store operations to the user's namespace
        @my_auth.on.store
        async def scope_store(ctx: Auth.types.AuthContext, value: Auth.types.on.store.value):
            namespace = tuple(value["namespace"]) if value.get("namespace") else ()
            if not namespace or namespace[0] != ctx.user.identity:
                namespace = (ctx.user.identity, *namespace)
            value["namespace"] = namespace
        ```

    ???+ note "Request Processing Flow"

        1. Authentication (your `@auth.authenticate` handler) is performed first on **every request**
        2. For authorization, the most specific matching handler is called:
            * If a handler exists for the exact resource and action, it is used (e.g., `@auth.on.threads.create`)
            * Otherwise, if a handler exists for the resource with any action, it is used (e.g., `@auth.on.threads`)
            * Finally, if no specific handlers match, the global handler is used (e.g., `@auth.on`)
            * If no global handler is set, the request is accepted

        This allows you to set default behavior with a global handler while
        overriding specific routes as needed.
    )Ú_authenticate_handlerÚ_global_handlersÚ_handler_cacheÚ	_handlersÚonÚreturnÚNonec                óh   — t          | ¦  «        | _        	 i | _        g | _        d | _        i | _        d S ©N)Ú_Onr   r   r   r   r   )Úselfs    úY/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langgraph_sdk/auth/__init__.pyÚ__init__zAuth.__init__�   s?   € Ý�d‘)”)ˆŒðV	ðr FHˆŒØ57ˆÔØAEˆÔ"ØDFˆÔÐÐó    Úfnr
   c                óR   — | j         �t          d| j         › d�¦  «        ‚|| _         |S )a×
  Register an authentication handler function.

        The authentication handler is responsible for verifying credentials
        and returning user scopes. It can accept any of the following parameters
        by name:

            - request (Request): The raw ASGI request object
            - path (str): The request path, e.g., "/threads/abcd-1234-abcd-1234/runs/abcd-1234-abcd-1234/stream"
            - method (str): The HTTP method, e.g., "GET"
            - path_params (dict[str, str]): URL path parameters, e.g., {"thread_id": "abcd-1234-abcd-1234", "run_id": "abcd-1234-abcd-1234"}
            - query_params (dict[str, str]): URL query parameters, e.g., {"stream": "true"}
            - headers (dict[bytes, bytes]): Request headers
            - authorization (str | None): The Authorization header value (e.g., "Bearer <token>")

        Args:
            fn: The authentication handler function to register.
                Must return a representation of the user. This could be a:
                    - string (the user id)
                    - dict containing {"identity": str, "permissions": list[str]}
                    - or an object with identity and permissions properties
                Permissions can be optionally used by your handlers downstream.

        Returns:
            The registered handler function.

        Raises:
            ValueError: If an authentication handler is already registered.

        ???+ example "Examples"

            Basic token authentication:

            ```python
            @auth.authenticate
            async def authenticate(authorization: str) -> str:
                user_id = verify_token(authorization)
                return user_id
            ```

            Accept the full request context:

            ```python
            @auth.authenticate
            async def authenticate(
                method: str,
                path: str,
                headers: dict[str, bytes]
            ) -> str:
                user = await verify_request(method, path, headers)
                return user
            ```

            Return user name and permissions:

            ```python
            @auth.authenticate
            async def authenticate(
                method: str,
                path: str,
                headers: dict[str, bytes]
            ) -> Auth.types.MinimalUserDict:
                permissions, user = await verify_request(method, path, headers)
                # Permissions could be things like ["runs:read", "runs:write", "threads:read", "threads:write"]
                return {
                    "identity": user["id"],
                    "permissions": permissions,
                    "display_name": user["name"],
                }
            ```
        Nz&Authentication handler already set as ú.)r   Ú
ValueError©r   r   s     r   ÚauthenticatezAuth.authenticateá   s@   € ðN Ô%Ð1ÝØV¸Ô9SÐVÐVÐVñô ð ð &(ˆÔ"Øˆ	r   N)r   r   )r   r
   r   r
   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r   r   r   r    © r   r   r   r      sw   € € € € € ð]ð ]ð~€Ið €Eð0ð
 €Jðð^Gð ^Gð ^Gð ^Gð@Lð Lð Lð Lð Lð Lr   r   ÚVT)Úcontravariantc                  ó   — e Zd Zd	d„ZdS )
Ú_ActionHandlerÚctxútypes.AuthContextÚvaluer'   r   útypes.HandlerResultc             ƒ  ó
   K  — d S r   r&   )r   r+   r-   s      r   Ú__call__z_ActionHandler.__call__6  s   è è € à!˜cr   N)r+   r,   r-   r'   r   r.   )r!   r"   r#   r0   r&   r   r   r*   r*   5  s(   € € € € € ð"ð "ð "ð "ð "ð "r   r*   ÚT)Ú	covariantc                  ó   — e Zd Zdd„Zdd„ZdS )Ú_ResourceActionOnÚauthr   Úresourceú0typing.Literal['threads', 'crons', 'assistants']ÚactionúLtyping.Literal['create', 'read', 'update', 'delete', 'search', 'create_run']r-   útype[T]r   r   c                ó>   — || _         || _        || _        || _        d S r   )r5   r6   r8   r-   )r   r5   r6   r8   r-   s        r   r   z_ResourceActionOn.__init__?  s$   € ð ˆŒ	Ø ˆŒØˆŒØˆŒ
ˆ
ˆ
r   r   ú_ActionHandler[T]c                óf   — t          |¦  «         t          | j        | j        | j        |¦  «         |S r   )Ú_validate_handlerÚ_register_handlerr5   r6   r8   r   s     r   r0   z_ResourceActionOn.__call__M  s/   € Ý˜"ÑÔÐÝ˜$œ) T¤]°D´KÀÑDÔDÐDØˆ	r   N)
r5   r   r6   r7   r8   r9   r-   r:   r   r   ©r   r<   r   r<   )r!   r"   r#   r   r0   r&   r   r   r4   r4   >  s<   € € € € € ðð ð ð ðð ð ð ð ð r   r4   ÚVCreateÚVUpdateÚVReadÚVDeleteÚVSearchc                  ó¶   — e Zd ZU dZded<   ded<   ded<   ded	<   d
ed<   ded<   d%d„Zej        d&d„¦   «         Zej        ddœd'd „¦   «         Z	 d(ddd!œd)d$„ZdS )*Ú_ResourceOnz<
    Generic base class for resource-specific handlers.
    z3type[VCreate | VUpdate | VRead | VDelete | VSearch]r-   ztype[VCreate]ÚCreateztype[VRead]ÚReadztype[VUpdate]ÚUpdateztype[VDelete]ÚDeleteztype[VSearch]ÚSearchr5   r   r6   r7   r   r   c                ó:  — || _         || _        t          ||d| j        ¦  «        | _        t          ||d| j        ¦  «        | _        t          ||d| j        ¦  «        | _        t          ||d| j	        ¦  «        | _
        t          ||d| j        ¦  «        | _        d S )NÚcreateÚreadÚupdateÚdeleteÚsearch)r5   r6   r4   rH   rN   rI   rO   rJ   rP   rK   rQ   rL   rR   )r   r5   r6   s      r   r   z_ResourceOn.__init__g  s®   € ð
 ˆŒ	Ø ˆŒÝ2CØ�(˜H d¤kñ3
ô 3
ˆŒõ /@Ø�(˜F D¤Iñ/
ô /
ˆŒ	õ 3DØ�(˜H d¤kñ3
ô 3
ˆŒõ 3DØ�(˜H d¤kñ3
ô 3
ˆŒõ 3DØ�(˜H d¤kñ3
ô 3
ˆŒˆˆr   r   úe_ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch] | _ActionHandler[dict[str, typing.Any]]ú=_ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch]c                ó   — d S r   r&   r   s     r   r0   z_ResourceOn.__call__~  s   € ð ILÈr   N©ÚactionsÚ	resourcesústr | Sequence[str]rW   ústr | Sequence[str] | NoneúˆCallable[[_ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch]], _ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch]]c               ó   — d S r   r&   ©r   rX   rW   s      r   r0   z_ResourceOn.__call__‡  s	   € ð €sr   ©rX   rW   úl_ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch] | _ActionHandler[dict[str, typing.Any]] | NoneúÈ_ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch] | Callable[[_ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch]], _ActionHandler[VCreate | VUpdate | VRead | VDelete | VSearch]]c          	     óœ   ‡ — |�>t          |¦  «         t          j        dt          ‰ j        ‰ j        d|¦  «        ¦  «        S dˆ fd„}||f}|S )NrT   Ú*Úhandlerr   c           	     ó€   •— t          | ¦  «         t          j        dt          ‰j        ‰j        d| ¦  «        ¦  «        S )NrT   rb   ©r>   ÚtypingÚcastr?   r5   r6   )rc   r   s    €r   Ú	decoratorz'_ResourceOn.__call__.<locals>.decoratorª  s?   ø€ õ ˜gÑ&Ô&Ð&Ý”;ØOÝ! $¤)¨T¬]¸CÀÑIÔIñô ð r   )rc   rT   r   rT   re   )r   r   rX   rW   rh   Ú_s   `     r   r0   z_ResourceOn.__call__’  st   ø€ ð" ˆ>Ý˜bÑ!Ô!Ð!Ý”;ØOÝ! $¤)¨T¬]¸CÀÑDÔDñô ð ð
	ð 	ð 	ð 	ð 	ð 	ð �wÐˆØÐr   ©r5   r   r6   r7   r   r   )r   rS   r   rT   )rX   rY   rW   rZ   r   r[   r   )r   r_   rX   rZ   rW   rZ   r   r`   )	r!   r"   r#   r$   Ú__annotations__r   rf   Úoverloadr0   r&   r   r   rG   rG   Z  s  € € € € € € ðð ð ?Ð>Ð>Ñ>àÐÐÑØÐÐÑØÐÐÑØÐÐÑØÐÐÑð
ð 
ð 
ð 
ð. „_ðLð Lð Lñ „_ðLð „_ð
 /3ð	ð ð ð ð ñ „_ðð  ð#ð 15Ø.2ð#ð #ð #ð #ð #ð #ð #ð #r   rG   c                  ó¢   — e Zd Zej        ej        z  ej        z  ej        z  ej        z  Z	ej        Z
ej        Zej        Zej        Zej        ZdS )Ú_AssistantsOnN)r!   r"   r#   r   ÚAssistantsCreateÚAssistantsReadÚAssistantsUpdateÚAssistantsDeleteÚAssistantsSearchr-   rH   rI   rJ   rK   rL   r&   r   r   rn   rn   ¸  su   € € € € € ð 	ÔØ
Ô
ñ	à
Ô
 ñ	!ð Ô
 ñ	!ð Ô
 ñ		!ð 
ð Ô#€FØÔ€DØÔ#€FØÔ#€FØÔ#€F€F€Fr   rn   c                  óÒ   ‡ — e Zd Zej        ej        z  ej        z  ej        z  ej        z  ej	        z  Z
ej        Zej        Zej        Zej        Zej        Zej	        Zdˆ fd„Zˆ xZS )	Ú
_ThreadsOnr5   r   r6   r7   r   r   c                ó„   •— t          ¦   «                              ||¦  «         t          ||d| j        ¦  «        | _        d S )NÚ
create_run)Úsuperr   r4   Ú	CreateRunrw   )r   r5   r6   Ú	__class__s      €r   r   z_ThreadsOn.__init__ç  sA   ø€ õ
 	‰Œ×Ò˜˜xÑ(Ô(Ð(Ý?PØ�(˜L¨$¬.ñ@
ô @
ˆŒˆˆr   rj   )r!   r"   r#   r   ÚThreadsCreateÚThreadsReadÚThreadsUpdateÚThreadsDeleteÚThreadsSearchÚ
RunsCreater-   rH   rI   rJ   rK   rL   ry   r   Ú__classcell__)rz   s   @r   ru   ru   Ï  s¹   ø€ € € € € ð 	ÔØ
Ô
ñ	à
Ô
ñ	ð Ô
ñ	ð Ô
ñ		ð
 Ô
ñ	ð 
ð Ô €FØÔ€DØÔ €FØÔ €FØÔ €FØÔ €Ið
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
r   ru   c                  ó®   — e Zd Zeej        ej        z  ej        z  ej        z  ej	        z           Z
ej        Zej        Zej        Zej        Zej	        ZdS )Ú_CronsOnN)r!   r"   r#   Útyper   ÚCronsCreateÚ	CronsReadÚCronsUpdateÚCronsDeleteÚCronsSearchr-   rH   rI   rJ   rK   rL   r&   r   r   rƒ   rƒ   ò  sx   € € € € € ð ØÔØ
Œ/ñ	à
Ô
ñ	ð Ô
ñ	ð Ô
ñ		ô€Eð Ô€FØŒ?€DØÔ€FØÔ€FØÔ€F€F€Fr   rƒ   c                  ó"   — e Zd ZdZdd
„Zdd„ZdS )Ú_StoreActionOnz@Decorator for registering a handler for a specific store action.r5   r   r8   úCtyping.Literal['put', 'get', 'search', 'delete', 'list_namespaces']r-   r:   r   r   c                ó0   — || _         || _        || _        d S r   )r5   r8   r-   )r   r5   r8   r-   s       r   r   z_StoreActionOn.__init__  s   € ð ˆŒ	ØˆŒØˆŒ
ˆ
ˆ
r   r   r<   c                ó\   — t          |¦  «         t          | j        d| j        |¦  «         |S )NÚstore)r>   r?   r5   r8   r   s     r   r0   z_StoreActionOn.__call__  s-   € Ý˜"ÑÔÐÝ˜$œ) W¨d¬k¸2Ñ>Ô>Ð>Øˆ	r   N)r5   r   r8   rŒ   r-   r:   r   r   r@   )r!   r"   r#   r$   r   r0   r&   r   r   r‹   r‹   
  sB   € € € € € ØJÐJðð ð ð ðð ð ð ð ð r   r‹   c                  ór   — e Zd Zdd„Zej        ddœdd„¦   «         Zej        dd„¦   «         Z	 dddœdd„ZdS )Ú_StoreOnr5   r   r   r   c                ó\  — || _         t          |dt          j        ¦  «        | _        	 t          |dt          j        ¦  «        | _        	 t          |dt          j        ¦  «        | _        	 t          |dt          j	        ¦  «        | _
        	 t          |dt          j        ¦  «        | _        d S )NÚputÚgetrR   rQ   Úlist_namespaces)Ú_authr‹   r   ÚStorePutr“   ÚStoreGetr”   ÚStoreSearchrR   ÚStoreDeleterQ   ÚStoreListNamespacesr•   ©r   r5   s     r   r   z_StoreOn.__init__  s¢   € ØˆŒ
Ý! $¨­u¬~Ñ>Ô>ˆŒð	õ " $¨­u¬~Ñ>Ô>ˆŒð	õ % T¨8µUÔ5FÑGÔGˆŒð	õ % T¨8µUÔ5FÑGÔGˆŒð	õ  .ØÐ#¥UÔ%>ñ 
ô  
ˆÔð	ð 	r   NrV   rW   úštyping.Literal['put', 'get', 'search', 'list_namespaces', 'delete'] | Sequence[typing.Literal['put', 'get', 'search', 'list_namespaces', 'delete']] | NoneúCallable[[AHO], AHO]c               ó   — d S r   r&   )r   rW   s     r   r0   z_StoreOn.__call__i  s	   € ð  #˜sr   r   ÚAHOc                ó   — d S r   r&   r   s     r   r0   z_StoreOn.__call__v  ó   € Ø(+¨r   ú
AHO | NoneúAHO | Callable[[AHO], AHO]c               óN   ‡ ‡— |�t          ‰ j        dd|¦  «         |S dˆˆ fd„}|S )aµ  Register a handler for specific resources and actions.

        Can be used as a decorator or with explicit resource/action parameters:

        @auth.on.store
        async def handler(): ... # Handle all store ops

        @auth.on.store(actions=("put", "get", "search", "delete"))
        async def handler(): ... # Handle specific store ops

        @auth.on.store.put
        async def handler(): ... # Handle store.put ops
        Nr�   rc   r    r   c                óš   •— t          ‰t          ¦  «        r‰g}n‰�t          ‰¦  «        ndg}|D ]}t          ‰j        d|| ¦  «         Œ| S )Nrb   r�   ©Ú
isinstanceÚstrÚlistr?   r–   )rc   Úaction_listr8   rW   r   s      €€r   rh   z$_StoreOn.__call__.<locals>.decorator˜  sf   ø€ õ ˜'¥3Ñ'Ô'ð NØ&˜i��à/6Ð/B�d 7™mœm˜mÈÈ�Ø%ð Hð H�Ý! $¤*¨g°v¸wÑGÔGÐGÐGØˆNr   ©rc   r    r   r    ©r?   r–   )r   r   rW   rh   s   ` ` r   r0   z_StoreOn.__call__y  sQ   øø€ ð2 ˆ>å˜dœj¨'°4¸Ñ<Ô<Ð<ØˆIð		ð 		ð 		ð 		ð 		ð 		ð 		ð Ðr   ©r5   r   r   r   )rW   r�   r   rž   ©r   r    r   r    r   )r   r£   rW   r�   r   r¤   )r!   r"   r#   r   rf   rl   r0   r&   r   r   r‘   r‘     s¥   € € € € € ðIð Ið Ið IðV „_ð ð
#ð 
#ð 
#ð 
#ð 
#ñ „_ð
#ð „_Ø+Ð+Ð+ñ „_Ø+ð ð*ð ð*ð *ð *ð *ð *ð *ð *ð *r   r‘   r    c                  ó|   — e Zd ZdZdZdd„Zej        dd	œdd„¦   «         Zej        dd„¦   «         Z	 ddddœdd„ZdS )r   aÒ  Entry point for authorization handlers that control access to specific resources.

    The _On class provides a flexible way to define authorization rules for different resources
    and actions in your application. It supports three main usage patterns:

    1. Global handlers that run for all resources and actions
    2. Resource-specific handlers that run for all actions on a resource
    3. Resource and action specific handlers for fine-grained control

    Each handler must be an async function that accepts two parameters:
    - ctx (AuthContext): Contains request context and authenticated user info
    - value: The data being authorized (type varies by endpoint)

    The handler should return one of:
        - None or True: Accept the request
        - False: Reject with 403 error
        - FilterType: Apply filtering rules to the response

    ???+ example "Examples"

        Start by denying all requests by default with a global handler,
        then add specific handlers to allow access:

        ```python
        # Default deny: reject all requests without a specific handler
        @auth.on
        async def deny_all(ctx: AuthContext, value: Any) -> False:
            return False
        ```

        Resource-specific handler to allow access (takes precedence
        over the global deny handler):

        ```python
        @auth.on.threads
        async def allow_thread_access(ctx: AuthContext, value: Any) -> Auth.types.FilterType:
            # Allow access only to threads owned by the user
            return {"owner": ctx.user.identity}
        ```

        Resource and action specific handler:

        ```python
        @auth.on.threads.create
        async def allow_thread_create(ctx: AuthContext, value: Any) -> None:
            # Allow thread creation, stamping the owner
            value.setdefault("metadata", {})["owner"] = ctx.user.identity
        ```

        Multiple resources or actions:

        ```python
        @auth.on(resources=["threads", "assistants"], actions=["read", "search"])
        async def allow_reads(ctx: AuthContext, value: Any) -> Auth.types.FilterType:
            # Allow read/search, scoped to user's resources
            return {"owner": ctx.user.identity}
        ```
    )r–   Ú
assistantsÚcronsÚrunsr�   Úthreadsr-   r5   r   r   r   c                ó   — || _         t          |d¦  «        | _        t          |d¦  «        | _        t          |d¦  «        | _        t          |¦  «        | _        t          t          t          j        f         | _        d S )Nr±   r´   r²   )r–   rn   r±   ru   r´   rƒ   r²   r‘   r�   Údictr©   rf   ÚAnyr-   rœ   s     r   r   z_On.__init__ï  s_   € ØˆŒ
Ý'¨¨lÑ;Ô;ˆŒÝ! $¨	Ñ2Ô2ˆŒÝ˜d GÑ,Ô,ˆŒ
Ý˜d‘^”^ˆŒ
Ý�#�vœz˜/Ô*ˆŒ
ˆ
ˆ
r   NrV   rX   rY   rW   rZ   rž   c               ó   — d S r   r&   r]   s      r   r0   z_On.__call__÷  s	   € ð  #˜sr   r   r    c                ó   — d S r   r&   r   s     r   r0   z_On.__call__ÿ  r¢   r   r^   r£   r¤   c               óR   ‡ ‡‡— |�t          ‰ j        dd|¦  «         |S dˆˆˆ fd„}|S )aÄ  Register a handler for specific resources and actions.

        Can be used as a decorator or with explicit resource/action parameters:

        @auth.on
        async def handler(): ...  # Global handler

        @auth.on(resources="threads")
        async def handler(): ...  # types.Handler for all thread actions

        @auth.on(resources="threads", actions="create")
        async def handler(): ...  # types.Handler for thread creation
        Nrc   r    r   c                óþ   •— t          ‰t          ¦  «        r‰g}n‰�t          ‰¦  «        ndg}t          ‰t          ¦  «        r‰g}n‰�t          ‰¦  «        ndg}|D ]}|D ]}t          ‰j        ||| ¦  «         ŒŒ| S )Nrb   r§   )rc   Úresource_listr«   r6   r8   rW   rX   r   s        €€€r   rh   z_On.__call__.<locals>.decorator  s¯   ø€ õ ˜)¥SÑ)Ô)ð TØ!* ��à3<Ð3H¥ Y¡¤ ÈsÈe�å˜'¥3Ñ'Ô'ð NØ&˜i��à/6Ð/B�d 7™mœm˜mÈÈ�Ø)ð Mð M�Ø)ð Mð M�FÝ% d¤j°(¸FÀGÑLÔLÐLÐLðMàˆNr   r¬   r­   )r   r   rX   rW   rh   s   ` `` r   r0   z_On.__call__  sW   øøø€ ð( ˆ>å˜dœj¨$°°bÑ9Ô9Ð9ØˆIð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð" Ðr   r®   )rX   rY   rW   rZ   r   rž   r¯   r   )r   r£   rX   rZ   rW   rZ   r   r¤   )	r!   r"   r#   r$   r%   r   rf   rl   r0   r&   r   r   r   r   ©  sµ   € € € € € ð9ð 9ðv€Ið+ð +ð +ð +ð „_ð
 /3ð	#ð #ð #ð #ð #ñ „_ð#ð „_Ø+Ð+Ð+ñ „_Ø+ð ð+ð 15Ø.2ð+ð +ð +ð +ð +ð +ð +ð +r   r   r5   r6   ú
str | Noner8   r   útypes.Handlerr   c                ó"  — t          |¦  «         |pd}|pd}|dk    r7|dk    r1| j        rt          d¦  «        ‚| j                             |¦  «         n:|�|nd}|�|nd}||f| j        v rt          d|› d|› d�¦  «        ‚|g| j        ||f<   |S )Nrb   zGlobal handler already set.ztypes.Handler already set for z, r   )r>   r   r   Úappendr   )r5   r6   r8   r   ÚrÚas         r   r?   r?   0  sÏ   € õ �bÑÔÐØˆ˜3€HØˆ]�s€FØ�3‚€˜6 Sš=˜=ØÔ ð 	<ÝÐ:Ñ;Ô;Ð;ØÔ×$Ò$ RÑ(Ô(Ð(Ð(à Ð,ˆHˆH°#ˆØÐ(ˆFˆF¨cˆØˆqˆ6�T”^Ð#Ð#ÝÐG¸aÐGÐGÀ1ÐGÐGÐGÑHÔHÐHØ"$ ˆŒ˜˜1�vÑØ€Ir   úCallable[..., typing.Any]r   c                óF  — t          j        | ¦  «        s"t          dt          | d| ¦  «        › d�¦  «        ‚t          j        | ¦  «        }d|j        vr"t          dt          | d| ¦  «        › d�¦  «        ‚d|j        vr"t          dt          | d| ¦  «        › d�¦  «        ‚dS )	zíValidates that an auth handler function meets the required signature.

    Auth handlers must:
    1. Be async functions
    2. Accept a ctx parameter of type AuthContext
    3. Accept a value parameter for the data being authorized
    zAuth handler 'r!   z|' must be an async function. Add 'async' before 'def' to make it asynchronous and ensure any IO operations are non-blocking.r+   zm' must have a 'ctx: AuthContext' parameter. Update the function signature to include this required parameter.r-   z¢' must have a 'value' parameter.  The value contains the mutable data being sent to the endpoint.Update the function signature to include this required parameter.N)ÚinspectÚiscoroutinefunctionr   ÚgetattrÚ	signatureÚ
parameters)r   Úsigs     r   r>   r>   F  sñ   € õ Ô& rÑ*Ô*ð 
Ýð3�W R¨°RÑ8Ô8ð 3ð 3ð 3ñ
ô 
ð 	
õ Ô
˜BÑ
Ô
€CØ�C”NÐ"Ð"ÝðP�W R¨°RÑ8Ô8ð Pð Pð Pñ
ô 
ð 	
ð �c”nÐ$Ð$ÝðP�W R¨°RÑ8Ô8ð Pð Pð Pñ
ô 
ð 	
ð %Ð$r   Úuserú:types.MinimalUser | types.BaseUser | types.MinimalUserDictÚboolc                ó’   — t          | t          j        ¦  «        p-t          | t          ¦  «        o|                      d¦  «        dk    S )NÚkindÚ
StudioUser)r¨   r   rÐ   r¶   r”   )rË   s    r   Úis_studio_userrÑ   c  sB   € õ 	�4�Ô)Ñ*Ô*ð 	IÝ�t�TÑ"Ô"ÐG t§x¢x°Ñ'7Ô'7¸<Ò'Gðr   )r   r   r   )
r5   r   r6   r½   r8   r½   r   r¾   r   r¾   )r   rÃ   r   r   )rË   rÌ   r   rÍ   )9Ú
__future__r   rÅ   rf   Úcollections.abcr   r   Úlanggraph_sdk.authr   r   ÚTypeVarÚHandlerr   ÚAuthenticatorr
   r   r'   ÚProtocolr*   r1   ÚGenericr4   rA   rB   rC   rD   rE   rG   ro   rp   rq   rr   rs   rn   r{   r|   r}   r~   r   ru   r…   r†   r‡   rˆ   r‰   rƒ   r‹   r‘   r¶   r©   r·   r    r   r?   r>   rÑ   Ú__all__r&   r   r   ú<module>rÛ      s  ðØ "Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0à€V„^�D ¤Ð.Ñ.Ô.€Ø€V„^�D Ô 3Ð4Ñ4Ô4€ð`ð `ð `ð `ð `ñ `ô `ð `ðJ	 €F„N�3 dÐ+Ñ+Ô+€ð"ð "ð "ð "ð "�V”_ QÔ'ñ "ô "ð "ð €F„N�3 $Ð'Ñ'Ô'€ðð ð ð ð ˜œ qÔ)ñ ô ð ð* ˆ&Œ.˜¨dÐ
3Ñ
3Ô
3€Ø
ˆ&Œ.˜¨dÐ
3Ñ
3Ô
3€ØˆŒ�w¨$Ð/Ñ/Ô/€Ø
ˆ&Œ.˜¨dÐ
3Ñ
3Ô
3€Ø
ˆ&Œ.˜¨dÐ
3Ñ
3Ô
3€ð[ð [ð [ð [ð [�&”. ¨%°¸'À7Ð!JÔKñ [ô [ð [ð|$ð $ð $ð $ð $ØØÔØÔØÔØÔØÔð		 ôñ$ô $ð $ð. 
ð  
ð  
ð  
ð  
ØØÔØÔØÔØÔØÔð		ôñ 
ô  
ð  
ðFð ð ð ð ØØÔØŒØÔØÔØÔð		ôñô ð ð0ð ð ð ð �V”^ AÔ&ñ ô ð ð&Fð Fð Fð Fð Fñ Fô Fð FðR €f„n�U .°°c¸6¼:°oÔ1FÔ"GÐHÑHÔH€ðDð Dð Dð Dð Dñ Dô Dð DðNð ð ð ð,
ð 
ð 
ð 
ð:ð ð ð ð *Ð
)Ð
)€€€r   