o
    h                     @  s   U 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 d dl	m
Z
 d dlmZ d dlmZ er7d dlmZ eeZd	ed
< G dd de
ZdS )    )annotationsN)TYPE_CHECKINGFinal)util)BaseComponentRegistry)StreamlitAPIException)
get_logger)BaseCustomComponentr   _LOGGERc                   @  sR   e Zd ZdddZdddZdd
dZdddZdddZdddZdddZ	dS )LocalComponentRegistryreturnNonec                 C  s   i | _ t | _d S N)_components	threadingLock_lockself r   e/var/www/vscode/kcb/lib/python3.10/site-packages/streamlit/components/lib/local_component_registry.py__init__!   s   zLocalComponentRegistry.__init__strc                 C  s
   t | S r   )r   repr_r   r   r   r   __repr__%   s   
zLocalComponentRegistry.__repr__	componentr	   c                 C  s   |j }|durtj|std| d| j | j|j}|| j|j< W d   n1 s0w   Y  |durD||krDt	
d|| t	d| dS )zRegister a CustomComponent.

        Parameters
        ----------
        component : BaseCustomComponent
            The component to register.
        NzNo such component directory: ''z&%s overriding previously-registered %szRegistered component %s)abspathospathisdirr   r   r   getnamer
   warningdebug)r   r   r   existingr   r   r   register_component(   s   
z)LocalComponentRegistry.register_componentr"   
str | Nonec                 C  s    | j |d}|dur|jS dS )zReturn the filesystem path for the component with the given name.

        If no such component is registered, or if the component exists but is
        being served from a URL, return None instead.
        N)r   r!   r   r   r"   r   r   r   r   get_component_pathC   s   z)LocalComponentRegistry.get_component_pathc                 C  s    | j |d }|d ur|jS d S r   )r   r!   module_namer(   r   r   r   get_module_nameL   s   z&LocalComponentRegistry.get_module_nameBaseCustomComponent | Nonec                 C  s   | j |d S r   )r   r!   )r   r"   r   r   r   get_componentP      z$LocalComponentRegistry.get_componentlist[BaseCustomComponent]c                 C  s   t | j S r   )listr   valuesr   r   r   r   get_componentsS   r.   z%LocalComponentRegistry.get_componentsN)r   r   )r   r   )r   r	   r   r   )r"   r   r   r'   )r"   r   r   r,   )r   r/   )
__name__
__module____qualname__r   r   r&   r)   r+   r-   r2   r   r   r   r   r       s    




	
r   )
__future__r   r   r   typingr   r   	streamlitr   2streamlit.components.types.base_component_registryr   streamlit.errorsr   streamlit.loggerr   0streamlit.components.types.base_custom_componentr	   r3   r
   __annotations__r   r   r   r   r   <module>   s   