
    ch"                        S SK Jr  S SKrS SKrS SKJr  S SKJrJrJ	r	  S SK
Jr  S SKJrJrJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJrJrJr  \(       a  S SKJr   " S S5      rSS jr SS jr!g)    )annotationsN)Path)TYPE_CHECKINGAnycast)get_dg_singleton_instance)LayoutConfigWidthvalidate_width)StreamlitAPIException)Html)gather_metrics)
clean_text)SupportsReprHtmlSupportsStrhas_callable_attr)DeltaGeneratorc                  n    \ rS rSr\" S5      SS.     S
S jj5       r\SS j5       r\SS j5       rSr	g	)	HtmlMixin&   htmlstretchwidthc                  [        5       n[        US5      (       a  [        SU5      R                  5       nO[	        U[
        5      (       d  [        U5      (       a\  [        U5      n[        USS9 nUR                  5       nSSS5        [        U5      R                  R                  5       S:X  a  SW S3nO[        [        S	U5      5      nWS
:X  a  [        S5      e[        USS9  [        US9n[!        U5      (       a"  XCl        U R$                  R'                  SU5      $ XCl        U R(                  R'                  SX7S9$ ! , (       d  f       N= f)at  Insert HTML into your app.

Adding custom HTML to your app impacts safety, styling, and
maintainability. We sanitize HTML with `DOMPurify
<https://github.com/cure53/DOMPurify>`_, but inserting HTML remains a
developer risk. Passing untrusted code to ``st.html`` or dynamically
loading external code can increase the risk of vulnerabilities in your
app.

``st.html`` content is **not** iframed. Executing JavaScript is not
supported at this time.

Parameters
----------
body : any
    The HTML code to insert. This can be one of the following:

    - A string of HTML code.
    - A path to a local file with HTML code. The path can be a ``str``
      or ``Path`` object. Paths can be absolute or relative to the
      working directory (where you execute ``streamlit run``).
    - Any object. If ``body`` is not a string or path, Streamlit will
      convert the object to a string. ``body._repr_html_()`` takes
      precedence over ``str(body)`` when available.

    If the resulting HTML content is empty, Streamlit will raise an
    error.

    If ``body`` is a path to a CSS file, Streamlit will wrap the CSS
    content in ``<style>`` tags automatically. When the resulting HTML
    content only contains style tags, Streamlit will send the content
    to the event container instead of the main container to avoid
    taking up space in the app.

width : "stretch", "content", or int
    The width of the HTML element. This can be one of the following:

    - ``"stretch"`` (default): The width of the element matches the
      width of the parent container.
    - ``"content"``: The width of the element matches the width of its
      content, but doesn't exceed the width of the parent container.
    - An integer specifying the width in pixels: The element has a
      fixed width. If the specified width is greater than the width of
      the parent container, the width of the element matches the width
      of the parent container.

Example
-------
>>> import streamlit as st
>>>
>>> st.html(
...     "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"
... )

.. output::
   https://doc-html.streamlit.app/
   height: 300px

_repr_html_r   zutf-8)encodingNz.cssz<style>z</style>r    z`st.html` body cannot be emptyT)allow_contentr   r   )layout_config)	HtmlProtor   r   r   
isinstancer   _is_filestropenreadsuffixlowerr   r   r   r	   _html_only_style_tagsbody	_event_dg_enqueuedg)selfr*   r   
html_protohtml_content	file_pathfr    s           jC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\streamlit/elements/html.pyr   HtmlMixin.html'   s'   D [
 T=11 2D9EEGL d##x~~D	Ii'2a vvx 3 I%%++-7!(h? &d=$&?@L 2'(HIIuD1$51 !..*O>>**6:>>&ww
PP5 32s   1E
Ec                    [        SU 5      $ )zGet our DeltaGenerator.r   )r   r.   s    r3   r-   HtmlMixin.dg   s     $d++    c                *    [        5       R                  $ )zGet the event delta generator.)r   event_dgr6   s    r3   r+   HtmlMixin._event_dg   s     )*333r8    N)r*   z+str | Path | SupportsStr | SupportsReprHtmlr   r
   returnr   )r=   r   )
__name__
__module____qualname____firstlineno__r   r   propertyr-   r+   __static_attributes__r<   r8   r3   r   r   &   sm    F
 !	dQ9dQ 	dQ
 
dQ dQL , , 4 4r8   r   c                    SnSn[         R                  " USU [         R                  S9n[         R                  " USU[         R                  [         R                  -  S9nUR	                  5       S:H  $ )z-Check if the HTML content is only style tags.z
<!--.*?-->z<style[^>]*>.*?</style>r   )flags)resubDOTALL
IGNORECASEstrip)r0   comment_patternstyle_patternhtml_without_comments html_without_styles_and_commentss        r3   r)   r)      se     $O.M FF?BBIIV')vvr0		BMM8Q($
 ,113r99r8   c                b     [         R                  R                  U 5      $ ! [         a     gf = f)zZChecks if obj is a file, and doesn't throw if not.

The "not throwing" part is important!
F)ospathisfile	TypeError)objs    r3   r#   r#      s,    
ww~~c"" s   ! 
..)r0   r$   r=   bool)rT   r   r=   rU   )"
__future__r   rP   rF   pathlibr   typingr   r   r   $streamlit.delta_generator_singletonsr   #streamlit.elements.lib.layout_utilsr	   r
   r   streamlit.errorsr   streamlit.proto.Html_pb2r   r!   streamlit.runtime.metrics_utilr   streamlit.string_utilr   streamlit.type_utilr   r   r   streamlit.delta_generatorr   r   r)   r#   r<   r8   r3   <module>ra      sW    # 	 	  + + J 
 3 6 9 , P P8p4 p4f:"r8   