
    g                        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rd dlmZ  ee      Zd	ed
<    G d de
      Zy)    )annotationsN)TYPE_CHECKINGFinal)util)BaseComponentRegistry)StreamlitAPIException)
get_logger)BaseCustomComponentr   _LOGGERc                  D    e Zd Zd	dZd
dZddZddZddZddZddZ	y)LocalComponentRegistryc                D    i | _         t        j                         | _        y N)_components	threadingLock_lockselfs    f/var/www/openai/venv/lib/python3.12/site-packages/streamlit/components/lib/local_component_registry.py__init__zLocalComponentRegistry.__init__!   s    ;=^^%
    c                ,    t        j                  |       S r   )r   repr_r   s    r   __repr__zLocalComponentRegistry.__repr__%   s    zz$r   c                   |j                   }|.t        j                  j                  |      st	        d| d      | j
                  5  | j                  j                  |j                        }|| j                  |j                  <   ddd       ||k7  rt        j                  d||       t        j                  d|       y# 1 sw Y   >xY w)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   	componentr   existings       r   register_componentz)LocalComponentRegistry.register_component(   s     ##rww}}W'='*H	QR(STTZZ''++INN;H/8DY^^,  I$9OO8 	/; Zs   	?CCc                Z    | j                   j                  |d      }||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&   s      r   get_component_pathz)LocalComponentRegistry.get_component_pathC   s2     $$((t4	$-$9y  CtCr   c                Z    | j                   j                  |d       }||j                  S d S r   )r   r"   module_namer*   s      r   get_module_namez&LocalComponentRegistry.get_module_nameL   s0    $$((t4	(1(=y$$G4Gr   c                :    | j                   j                  |d       S r   )r   r"   )r   r#   s     r   get_componentz$LocalComponentRegistry.get_componentP   s    ##D$//r   c                H    t        | j                  j                               S r   )listr   valuesr   s    r   get_componentsz%LocalComponentRegistry.get_componentsS   s    D$$++-..r   N)returnNone)r5   str)r&   r
   r5   r6   )r#   r7   r5   z
str | None)r#   r7   r5   zBaseCustomComponent | None)r5   zlist[BaseCustomComponent])
__name__
__module____qualname__r   r   r(   r+   r.   r0   r4    r   r   r   r       s'    & <6DH0/r   r   )
__future__r   r   r   typingr   r   	streamlitr   2streamlit.components.types.base_component_registryr   streamlit.errorsr   streamlit.loggerr	   0streamlit.components.types.base_custom_componentr
   r8   r   __annotations__r   r;   r   r   <module>rD      sA    # 	  '  T 2 'TH% %4/2 4/r   