Ë
    úmxiš  ã                  ó¼   — d dl mZ d dlZd dlZd dlmZ d dl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 d d
lmZ dd„Z	 	 d	 	 	 	 	 	 	 dd„Z G d„ d«      Zy)é    )ÚannotationsN)ÚPath)ÚTYPE_CHECKING)Úconfig)ÚCustomComponent)Úget_instance)Úget_script_run_ctx)Ú	FrameType)ÚBaseComponentRegistryc                ó  — t        j                  | «      }|€t        d«      ‚|j                  }|dk(  rVt        j                  | «      }t
        j                  j                  |«      }t
        j                  j                  |«      \  }}|S )Nz)module is None. This should never happen.Ú__main__)	ÚinspectÚ	getmoduleÚRuntimeErrorÚ__name__ÚgetfileÚosÚpathÚbasenameÚsplitext)Úcaller_frameÚmoduleÚmodule_nameÚ	file_pathÚfilenameÚ_s         úa/home/htdocs/ttos/venv/lib/python3.12/site-packages/streamlit/components/v1/component_registry.pyÚ_get_module_namer   !   sx   € ô ×Ñ˜|Ó,€FØ€~ÜÐFÓGÐGØ—/‘/€Kð �jÒ Ü—O‘O LÓ1ˆ	Ü—7‘7×#Ñ# IÓ.ˆÜŸ™×)Ñ)¨(Ó3‰ˆ�QàÐó    c                ó–  — |�t        |t        «      rt        |«      }t        j                  «       }|€t        d«      ‚|j                  }|€t        d«      ‚t        |«      }|› d| › �}|st        j                  d«      x}r|› d|› d�}t        ||||¬«      }t        «       }	|	�#t        «       j                  j                  |«       |S )aö  Create a custom component and register it if there is a ``ScriptRunContext``.

    The component is not registered when there is no ``ScriptRunContext``.
    This can happen when a ``CustomComponent`` is executed as standalone
    command (e.g. for testing).

    To use this function, import it from the ``streamlit.components.v1``
    module.

    .. warning::
        Using ``st.components.v1.declare_component`` directly (instead of
        importing its module) is deprecated and will be disallowed in a later
        version.

    Parameters
    ----------
    name : str
        A short, descriptive name for the component, like "slider".

    path: str, Path, or None
        The path to serve the component's frontend files from. The path should
        be absolute. If ``path`` is ``None`` (default), Streamlit will serve
        the component from the location in ``url``. Either ``path`` or ``url``
        must be specified. If both are specified, then ``url`` will take
        precedence.

    url: str or None
        The URL that the component is served from. If ``url`` is ``None``
        (default), Streamlit will serve the component from the location in
        ``path``. Either ``path`` or ``url`` must be specified. If both are
        specified, then ``url`` will take precedence.


    Returns
    -------
    CustomComponent
        A ``CustomComponent`` that can be called like a function.
        Calling the component will create a new instance of the component
        in the Streamlit app.

    z0current_frame is None. This should never happen.z/caller_frame is None. This should never happen.ú.z!server.customComponentBaseUrlPathú/)Únamer   Úurlr   )Ú
isinstancer   Ústrr   Úcurrentframer   Úf_backr   r   Ú
get_optionr   r	   r   Úcomponent_registryÚregister_component)
r#   r   r$   Úcurrent_framer   r   Úcomponent_nameÚcomponent_base_pathÚ	componentÚctxs
             r   Údeclare_componentr1   5   sé   € ð\ ÐœJ t¬TÔ2Ü�4‹yˆô '.×&:Ñ&:Ó&<€MØÐÜÐMÓNÐNà ×'Ñ'€LØÐÜÐLÓMÐMä" <Ó0€Kð $�} A d VÐ,€Nñ Ü%×0Ñ0Ð1TÓUÐUÐÐUà$Ð% Q ~Ð&6°aÐ8ˆô  Ø $¨C¸[ô€Iô Ó
€CØ
€Ü‹×)Ñ)×<Ñ<¸YÔGØÐr   c                  ó   — e Zd Zedd„«       Zy)ÚComponentRegistryc                ó*   — t        «       j                  S )z6Returns the ComponentRegistry of the runtime instance.)r   r*   )Úclss    r   ÚinstancezComponentRegistry.instance�   s   € ô ‹~×0Ñ0Ð0r   N)Úreturnr   )r   Ú
__module__Ú__qualname__Úclassmethodr6   © r   r   r3   r3   Ž   s   „ Øò1ó ñ1r   r3   )r   r
   r7   r&   )NN)r#   r&   r   zstr | Path | Noner$   z
str | Noner7   r   )Ú
__future__r   r   r   Úpathlibr   Útypingr   Ú	streamlitr   Ú(streamlit.components.v1.custom_componentr   Ústreamlit.runtimer   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr	   Útypesr
   Ú2streamlit.components.types.base_component_registryr   r   r1   r3   r;   r   r   ú<module>rE      sq   ðõ #ã Û 	Ý Ý  å Ý DÝ *Ý VáÝåXóð, #ØðPØ
ðPà
ðPð 
ðPð ó	P÷r1ò 1r   