L i"ddlmZddlZddlZddlmZddlmZmZm Z ddl m Z ddl m Z mZmZddlmZddlmZdd lmZdd lmZdd lmZmZmZerdd lmZGd dZddZ ddZ!y)) annotationsN)Path) TYPE_CHECKINGAnycast)get_dg_singleton_instance) LayoutConfigWidthvalidate_width)StreamlitAPIException)Html)gather_metrics) clean_text)SupportsReprHtml SupportsStrhas_callable_attr)DeltaGeneratorc^eZdZeddd ddZed dZed dZy) HtmlMixinhtmlstretchwidthct}t|drtd|j}nt |t s t |r^t|}t|d5}|j}dddt |jjdk(rdd}nttd |}d k(r td t|d t|}t!|r#||_|j$j'd|S||_|j(j'd||S#1swYxYw)a Insert HTML into your app. Adding custom HTML to your app impacts safety, styling, and maintainability. We sanitize HTML with `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 ``rz`st.html` body cannot be emptyT) allow_contentrr) layout_config) HtmlProtorrr isinstancer_is_filestropenreadsuffixlowerrr r r _html_only_style_tagsbody _event_dg_enqueuedg)selfr)r html_proto html_content file_pathfrs ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/elements/html.pyrzHtmlMixin.html's(D[  T= 1 2D9EEGLd #x~D Ii'2 (a vvx  (I%%++-7!(h? &d=$&?@L 2 '(HI IuD1$51  ! .*JO>>**6:> >& ww -PP5 ( (s %D<<Ectd|S)zGet our DeltaGenerator.r)rr-s r2r,z HtmlMixin.dgs$d++c*tjS)zGet the event delta generator.)revent_dgr4s r2r*zHtmlMixin._event_dgs)*333r5N)r)z+str | Path | SupportsStr | SupportsReprHtmlrr returnr)r8r)__name__ __module__ __qualname__rrpropertyr,r*r5r2rr&smF ! dQ9dQ dQ  dQdQL,,44r5rcd}d}tj|d|tj}tj|d|tjtjz}|j dk(S)z-Check if the HTML content is only style tags.z z]*>.*?r)flags)resubDOTALL IGNORECASEstrip)r/comment_pattern style_patternhtml_without_comments html_without_styles_and_commentss r2r(r(se$O.MFF?B BIIV')vvr0 BMM8Q($ , 1 1 3r 99r5c` tjj|S#t$rYywxYw)zbChecks if obj is a file, and doesn't throw if not. The "not throwing" part is important! F)ospathisfile TypeError)objs r2r"r"s, ww~~c"" s ! --)r/r#r8bool)rNrr8rO)" __future__rrJr@pathlibrtypingrrr$streamlit.delta_generator_singletonsr#streamlit.elements.lib.layout_utilsr r r streamlit.errorsr streamlit.proto.Html_pb2r r streamlit.runtime.metrics_utilrstreamlit.string_utilrstreamlit.type_utilrrrstreamlit.delta_generatorrrr(r"r=r5r2r[sW# ++J 369,PP8p4p4f:"r5