o
    YhI4                     @  s   U d dl mZ d dlmZ d dlmZmZmZmZ d dl	m
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rSd d
lmZ d dlmZ d dlmZ G dd deZeeed df Zded< ee edf Z!ded< G dd dZ"dS )    )annotations)Enum)TYPE_CHECKINGLiteralUnioncast)	TypeAlias)LayoutConfigvalidate_width)StreamlitAPIException)Heading)gather_metrics)
clean_text)DeltaGenerator)Width)SupportsStrc                   @  s   e Zd ZdZdZdZdS )HeadingProtoTagh1h2h3N)__name__
__module____qualname__	TITLE_TAG
HEADER_TAGSUBHEADER_TAG r   r   [/var/www/html/Persson_Maskin/env/lib/python3.10/site-packages/streamlit/elements/heading.pyr   "   s    r   FNr   AnchorDividerc                   @  s   e Zd Zed	d%ddddd&ddZed	d%ddddd&ddZed	d%dddd'ddZed(ddZe	d)ddZ
e				d*d+d#d$ZdS ),HeadingMixinheaderNFstretch)helpdividerwidthbodyr   anchorr   r#   
str | Noner$   r   r%   r   returnr   c             	   C  :   t |dd t|d}| jjdtjtj||||d|dS )aF  Display text in header formatting.

        Parameters
        ----------
        body : str
            The text to display as GitHub-flavored Markdown. Syntax
            information can be found at: https://github.github.com/gfm.

            See the ``body`` parameter of |st.markdown|_ for additional,
            supported Markdown directives.

            .. |st.markdown| replace:: ``st.markdown``
            .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown

        anchor : str or False
            The anchor name of the header that can be accessed with #anchor
            in the URL. If omitted, it generates an anchor using the body.
            If False, the anchor is not shown in the UI.

        help : str or None
            A tooltip that gets displayed next to the header. If this is
            ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        divider : bool, "blue", "green", "orange", "red", "violet", "yellow", "gray"/"grey", or "rainbow"
            Shows a colored divider below the header. If this is ``True``,
            successive headers will cycle through divider colors, except gray
            and rainbow. That is, the first header will have a blue line, the
            second header will have a green line, and so on. If this is a
            string, the color can be set to one of the following: blue, green,
            orange, red, violet, yellow, gray/grey, or rainbow.

        width : "stretch", "content", or int
            The width of the header 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.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.header("_Streamlit_ is :blue[cool] :sunglasses:")
        >>> st.header("This is a header with a divider", divider="gray")
        >>> st.header("These headers have rotating dividers", divider=True)
        >>> st.header("One", divider=True)
        >>> st.header("Two", divider=True)
        >>> st.header("Three", divider=True)
        >>> st.header("Four", divider=True)

        .. output::
           https://doc-header.streamlit.app/
           height: 600px

        Tallow_contentr%   headingtagr&   r'   r#   r$   layout_config)r
   r	   dg_enqueuer    _create_heading_protor   r   selfr&   r'   r#   r$   r%   r2   r   r   r   r!   -      J
zHeadingMixin.header	subheaderc             	   C  r*   )am  Display text in subheader formatting.

        Parameters
        ----------
        body : str
            The text to display as GitHub-flavored Markdown. Syntax
            information can be found at: https://github.github.com/gfm.

            See the ``body`` parameter of |st.markdown|_ for additional,
            supported Markdown directives.

            .. |st.markdown| replace:: ``st.markdown``
            .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown

        anchor : str or False
            The anchor name of the header that can be accessed with #anchor
            in the URL. If omitted, it generates an anchor using the body.
            If False, the anchor is not shown in the UI.

        help : str or None
            A tooltip that gets displayed next to the subheader. If this is
            ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        divider : bool, "blue", "green", "orange", "red", "violet", "yellow", "gray"/"grey", or "rainbow"
            Shows a colored divider below the header. If this is ``True``,
            successive headers will cycle through divider colors, except gray
            and rainbow. That is, the first header will have a blue line, the
            second header will have a green line, and so on. If this is a
            string, the color can be set to one of the following: blue, green,
            orange, red, violet, yellow, gray/grey, or rainbow.

        width : "stretch", "content", or int
            The width of the subheader 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.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.subheader("_Streamlit_ is :blue[cool] :sunglasses:")
        >>> st.subheader("This is a subheader with a divider", divider="gray")
        >>> st.subheader("These subheaders have rotating dividers", divider=True)
        >>> st.subheader("One", divider=True)
        >>> st.subheader("Two", divider=True)
        >>> st.subheader("Three", divider=True)
        >>> st.subheader("Four", divider=True)

        .. output::
           https://doc-subheader.streamlit.app/
           height: 500px

        Tr+   r-   r.   r/   r1   )r
   r	   r3   r4   r    r5   r   r   r6   r   r   r   r9      r8   zHeadingMixin.subheadertitle)r#   r%   c                C  s8   t |dd t|d}| jjdtjtj|||d|dS )a[  Display text in title formatting.

        Each document should have a single `st.title()`, although this is not
        enforced.

        Parameters
        ----------
        body : str
            The text to display as GitHub-flavored Markdown. Syntax
            information can be found at: https://github.github.com/gfm.

            See the ``body`` parameter of |st.markdown|_ for additional,
            supported Markdown directives.

            .. |st.markdown| replace:: ``st.markdown``
            .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown

        anchor : str or False
            The anchor name of the header that can be accessed with #anchor
            in the URL. If omitted, it generates an anchor using the body.
            If False, the anchor is not shown in the UI.

        help : str or None
            A tooltip that gets displayed next to the title. If this is
            ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        width : "stretch", "content", or int
            The width of the title 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.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.title("This is a title")
        >>> st.title("_Streamlit_ is :blue[cool] :sunglasses:")

        .. output::
           https://doc-title.streamlit.app/
           height: 220px

        Tr+   r-   r.   )r0   r&   r'   r#   r1   )r
   r	   r3   r4   r    r5   r   r   )r7   r&   r'   r#   r%   r2   r   r   r   r:      s   ?

zHeadingMixin.titlec                 C  s
   t d| S )zGet our DeltaGenerator.r   )r   )r7   r   r   r   r3   )  s   
zHeadingMixin.dgstrc                 C  sB   | du rdS g d}| |v rt d| S td|  dd| d)	NTauto)	redorangeyellowbluegreenvioletgraygreyrainbowr;   z&Divider parameter has invalid value: `z`. Please choose from: z, .)r   r   join)r$   valid_colorsr   r   r   _handle_divider_color.  s   
z"HeadingMixin._handle_divider_colorr0   r   HeadingProtoc                 C  s   t  }| j|_t||_|rt||_|d ur@|du r d|_n t	|t
r)||_n|du r5td| dtdt|j d|rE||_|S )NFTz$Anchor parameter has invalid value: z-. Supported values: None, any string or Falsez#Anchor parameter has invalid type: )rJ   valuer0   r   r&   r    rI   r$   hide_anchor
isinstancer;   r'   r   typer   r#   )r0   r&   r'   r#   r$   protor   r   r   r5   C  s(   


z"HeadingMixin._create_heading_proto)N)r&   r   r'   r   r#   r(   r$   r   r%   r   r)   r   )
r&   r   r'   r   r#   r(   r%   r   r)   r   )r)   r   )r$   r   r)   r;   )NNF)r0   r   r&   r   r'   r   r#   r(   r$   r   r)   rJ   )r   r   r   r   r!   r9   r:   propertyr3   staticmethodrI   r5   r   r   r   r   r    ,   s<    XXIr    )#
__future__r   enumr   typingr   r   r   r   typing_extensionsr   #streamlit.elements.lib.layout_utilsr	   r
   streamlit.errorsr   streamlit.proto.Heading_pb2r   rJ   streamlit.runtime.metrics_utilr   streamlit.string_utilr   streamlit.delta_generatorr   r   streamlit.type_utilr   r   r;   r   __annotations__boolr   r    r   r   r   r   <module>   s"   