Ë
    Eêñi2M  ã                  ó´   — 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 d dlmZmZmZ erd dlmZ d d	lmZ d d
lmZ 	 	 	 	 	 	 dd„Z G d„ d«      Zy)é    )Úannotations)ÚTYPE_CHECKINGÚcast)Úvalidate_width)ÚAlert)ÚWidthConfig)Úgather_metrics)Ú
clean_textÚextract_leading_iconÚvalidate_icon_or_emoji)ÚDeltaGenerator)ÚWidthWithoutContent)ÚSupportsStrc                óf   — t        | «      }|�|t        |«      fS t        |«      \  }}|r||fS |dfS )a  Process body and icon for alert elements.

    If icon is explicitly provided, validates and returns it with cleaned body.
    If icon is None, attempts to extract a leading emoji or material icon from body.

    Returns a tuple of (cleaned_body, validated_icon).
    Ú )r
   r   r   )ÚbodyÚiconÚcleaned_bodyÚextracted_iconÚremaining_bodys        úZ/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/alert.pyÚ_process_alert_body_and_iconr   #   sO   € ô ˜dÓ#€LàÐØÔ3°DÓ9Ð9Ð9ô &:¸,Ó%GÑ"€N�NÙØ˜~Ð-Ð-à˜ÐÐó    c                  ó  — e Zd Z ed«      ddddœ	 	 	 	 	 	 	 	 	 dd„«       Z ed«      ddddœ	 	 	 	 	 	 	 	 	 dd„«       Z ed«      ddddœ	 	 	 	 	 	 	 	 	 dd	„«       Z ed
«      ddddœ	 	 	 	 	 	 	 	 	 dd„«       Zedd„«       Z	y)Ú
AlertMixinÚerrorNÚstretch)r   ÚwidthÚtitlec               ót  — t        «       }t        ||«      \  }}||_        ||_        t         j                  |_        |�t        |«      |_        t        |«       t        «       }t        |t        «      r||_        nd|_        |j                  j                  |«       | j                   j#                  d|«      S )uˆ  Display error message.

        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.

            If ``icon`` is ``None``, and ``body`` begins with an emoji or
            Material icon shortcode, Streamlit will extract it and display it
            slightly enlarged, as if it were passed to ``icon``. If ``body``
            contains multiple icons, or you want to override this behavior,
            you can insert a null Markdown directive like ``:red[]`` before
            your leading icon.

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

        icon : str or None
            An optional emoji or icon to display next to the alert. If ``icon``
            is ``None`` (default), Streamlit attempts to extract a leading
            emoji or Material icon shortcode from ``body``. If found, the icon
            is displayed and removed from the body text. If no leading icon is
            found, no icon is displayed. If ``icon`` is a string, it takes
            precedence over any icon in the body, and the following options
            are valid:

            - A single-character emoji. For example, you can set ``icon="ðŸš¨"``
              or ``icon="ðŸ”¥"``. Emoji short codes are not supported.

            - An icon from the Material Symbols library (rounded style) in the
              format ``":material/icon_name:"`` where "icon_name" is the name
              of the icon in snake case.

              For example, ``icon=":material/thumb_up:"`` will display the
              Thumb Up icon. Find additional icons in the `Material Symbols               <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
              font library.

            - ``"spinner"``: Displays a spinner as an icon.

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

            - ``"stretch"`` (default): The width of the element matches 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.

        title : str or None
            An optional title to display above the body text. If ``None``
            (default), no title is displayed. The title is rendered with bold
            styling and can optionally contain GitHub-flavored Markdown of the
            following types: Italics, Strikethroughs, Inline Code, Links, and
            Images. Images display like icons, with a max height equal to the
            font height.

            Unsupported Markdown elements are unwrapped so only their children
            (text contents) render. Display elements are not supported.

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

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.error('This is an error', icon="ðŸš¨")

        TÚalert)Ú
AlertProtor   r   r   ÚERRORÚformatr
   r   r   r   Ú
isinstanceÚintÚpixel_widthÚuse_stretchÚwidth_configÚCopyFromÚdgÚ_enqueue©	Úselfr   r   r   r   Úalert_protoÚprocessed_bodyÚprocessed_iconr)   s	            r   r   zAlertMixin.error;   s¢   € ôh !“lˆä)EÀdÈDÓ)QÑ&ˆ˜Ø)ˆÔØ)ˆÔÜ'×-Ñ-ˆÔØÐÜ *¨5Ó 1ˆKÔä�uÔä"“}ˆä�eœSÔ!Ø',ˆLÕ$à'+ˆLÔ$à× Ñ ×)Ñ)¨,Ô7à�w‰w×Ñ ¨Ó5Ð5r   Úwarningc               ót  — t        «       }t        ||«      \  }}||_        ||_        t         j                  |_        |�t        |«      |_        t        |«       t        «       }t        |t        «      r||_        nd|_        |j                  j                  |«       | j                   j#                  d|«      S )u‘  Display warning message.

        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.

            If ``icon`` is ``None``, and ``body`` begins with an emoji or
            Material icon shortcode, Streamlit will extract it and display it
            slightly enlarged, as if it were passed to ``icon``. If ``body``
            contains multiple icons, or you want to override this behavior,
            you can insert a null Markdown directive like ``:red[]`` before
            your leading icon.

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

        icon : str or None
            An optional emoji or icon to display next to the alert. If ``icon``
            is ``None`` (default), Streamlit attempts to extract a leading
            emoji or Material icon shortcode from ``body``. If found, the icon
            is displayed and removed from the body text. If no leading icon is
            found, no icon is displayed. If ``icon`` is a string, it takes
            precedence over any icon in the body, and the following options
            are valid:

            - A single-character emoji. For example, you can set ``icon="ðŸš¨"``
              or ``icon="ðŸ”¥"``. Emoji short codes are not supported.

            - An icon from the Material Symbols library (rounded style) in the
              format ``":material/icon_name:"`` where "icon_name" is the name
              of the icon in snake case.

              For example, ``icon=":material/thumb_up:"`` will display the
              Thumb Up icon. Find additional icons in the `Material Symbols               <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
              font library.

            - ``"spinner"``: Displays a spinner as an icon.

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

            - ``"stretch"`` (default): The width of the element matches 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.

        title : str or None
            An optional title to display above the body text. If ``None``
            (default), no title is displayed. The title is rendered with bold
            styling and can optionally contain GitHub-flavored Markdown of the
            following types: Italics, Strikethroughs, Inline Code, Links, and
            Images. Images display like icons, with a max height equal to the
            font height.

            Unsupported Markdown elements are unwrapped so only their children
            (text contents) render. Display elements are not supported.

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

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.warning('This is a warning', icon="âš ï¸�")

        Tr!   )r"   r   r   r   ÚWARNINGr$   r
   r   r   r   r%   r&   r'   r(   r)   r*   r+   r,   r-   s	            r   r2   zAlertMixin.warning¥   ó¢   € ôh !“lˆÜ)EÀdÈDÓ)QÑ&ˆ˜Ø)ˆÔØ)ˆÔÜ'×/Ñ/ˆÔØÐÜ *¨5Ó 1ˆKÔä�uÔä"“}ˆä�eœSÔ!Ø',ˆLÕ$à'+ˆLÔ$à× Ñ ×)Ñ)¨,Ô7à�w‰w×Ñ ¨Ó5Ð5r   Úinfoc               ót  — t        «       }t        ||«      \  }}||_        ||_        t         j                  |_        |�t        |«      |_        t        |«       t        «       }t        |t        «      r||_        nd|_        |j                  j                  |«       | j                   j#                  d|«      S )u©  Display an informational message.

        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.

            If ``icon`` is ``None``, and ``body`` begins with an emoji or
            Material icon shortcode, Streamlit will extract it and display it
            slightly enlarged, as if it were passed to ``icon``. If ``body``
            contains multiple icons, or you want to override this behavior,
            you can insert a null Markdown directive like ``:red[]`` before
            your leading icon.

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

        icon : str or None
            An optional emoji or icon to display next to the alert. If ``icon``
            is ``None`` (default), Streamlit attempts to extract a leading
            emoji or Material icon shortcode from ``body``. If found, the icon
            is displayed and removed from the body text. If no leading icon is
            found, no icon is displayed. If ``icon`` is a string, it takes
            precedence over any icon in the body, and the following options
            are valid:

            - A single-character emoji. For example, you can set ``icon="ðŸš¨"``
              or ``icon="ðŸ”¥"``. Emoji short codes are not supported.

            - An icon from the Material Symbols library (rounded style) in the
              format ``":material/icon_name:"`` where "icon_name" is the name
              of the icon in snake case.

              For example, ``icon=":material/thumb_up:"`` will display the
              Thumb Up icon. Find additional icons in the `Material Symbols               <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
              font library.

            - ``"spinner"``: Displays a spinner as an icon.

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

            - ``"stretch"`` (default): The width of the element matches 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.

        title : str or None
            An optional title to display above the body text. If ``None``
            (default), no title is displayed. The title is rendered with bold
            styling and can optionally contain GitHub-flavored Markdown of the
            following types: Italics, Strikethroughs, Inline Code, Links, and
            Images. Images display like icons, with a max height equal to the
            font height.

            Unsupported Markdown elements are unwrapped so only their children
            (text contents) render. Display elements are not supported.

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

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.info('This is a purely informational message', icon="â„¹ï¸�")

        Tr!   )r"   r   r   r   ÚINFOr$   r
   r   r   r   r%   r&   r'   r(   r)   r*   r+   r,   r-   s	            r   r6   zAlertMixin.info  s    € ôj !“lˆÜ)EÀdÈDÓ)QÑ&ˆ˜Ø)ˆÔØ)ˆÔÜ'Ÿ_™_ˆÔØÐÜ *¨5Ó 1ˆKÔä�uÔä"“}ˆä�eœSÔ!Ø',ˆLÕ$à'+ˆLÔ$à× Ñ ×)Ñ)¨,Ô7à�w‰w×Ñ ¨Ó5Ð5r   Úsuccessc               ót  — t        «       }t        ||«      \  }}||_        ||_        t         j                  |_        |�t        |«      |_        t        |«       t        «       }t        |t        «      r||_        nd|_        |j                  j                  |«       | j                   j#                  d|«      S )u™  Display a success message.

        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.

            If ``icon`` is ``None``, and ``body`` begins with an emoji or
            Material icon shortcode, Streamlit will extract it and display it
            slightly enlarged, as if it were passed to ``icon``. If ``body``
            contains multiple icons, or you want to override this behavior,
            you can insert a null Markdown directive like ``:red[]`` before
            your leading icon.

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

        icon : str or None
            An optional emoji or icon to display next to the alert. If ``icon``
            is ``None`` (default), Streamlit attempts to extract a leading
            emoji or Material icon shortcode from ``body``. If found, the icon
            is displayed and removed from the body text. If no leading icon is
            found, no icon is displayed. If ``icon`` is a string, it takes
            precedence over any icon in the body, and the following options
            are valid:

            - A single-character emoji. For example, you can set ``icon="ðŸš¨"``
              or ``icon="ðŸ”¥"``. Emoji short codes are not supported.

            - An icon from the Material Symbols library (rounded style) in the
              format ``":material/icon_name:"`` where "icon_name" is the name
              of the icon in snake case.

              For example, ``icon=":material/thumb_up:"`` will display the
              Thumb Up icon. Find additional icons in the `Material Symbols               <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
              font library.

            - ``"spinner"``: Displays a spinner as an icon.

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

            - ``"stretch"`` (default): The width of the element matches 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.

        title : str or None
            An optional title to display above the body text. If ``None``
            (default), no title is displayed. The title is rendered with bold
            styling and can optionally contain GitHub-flavored Markdown of the
            following types: Italics, Strikethroughs, Inline Code, Links, and
            Images. Images display like icons, with a max height equal to the
            font height.

            Unsupported Markdown elements are unwrapped so only their children
            (text contents) render. Display elements are not supported.

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

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.success('This is a success message!', icon="âœ…")

        Tr!   )r"   r   r   r   ÚSUCCESSr$   r
   r   r   r   r%   r&   r'   r(   r)   r*   r+   r,   r-   s	            r   r9   zAlertMixin.successx  r5   r   c                ó   — t        d| «      S )zGet our DeltaGenerator.r   )r   )r.   s    r   r+   zAlertMixin.dgá  s   € ô Ð$ dÓ+Ð+r   )
r   r   r   ú
str | Noner   r   r   zSupportsStr | NoneÚreturnr   )r>   r   )
Ú__name__Ú
__module__Ú__qualname__r	   r   r2   r6   r9   Úpropertyr+   © r   r   r   r   :   s„  „ Ù�GÓð
  Ø%.Ø$(ñg6àðg6ð ð	g6ð
 #ðg6ð "ðg6ð 
òg6ó ðg6ñR �IÓð
  Ø%.Ø$(ñf6àðf6ð ð	f6ð
 #ðf6ð "ðf6ð 
òf6ó ðf6ñP �FÓð
  Ø%.Ø$(ñg6àðg6ð ð	g6ð
 #ðg6ð "ðg6ð 
òg6ó ðg6ñR �IÓð
  Ø%.Ø$(ñf6àðf6ð ð	f6ð
 #ðf6ð "ðf6ð 
òf6ó ðf6ðP ò,ó ñ,r   r   N)r   r   r   r=   r>   ztuple[str, str])Ú
__future__r   Útypingr   r   Ú#streamlit.elements.lib.layout_utilsr   Ústreamlit.proto.Alert_pb2r   r"   Ústreamlit.proto.WidthConfig_pb2r   Ústreamlit.runtime.metrics_utilr	   Ústreamlit.string_utilr
   r   r   Ústreamlit.delta_generatorr   r   Ústreamlit.type_utilr   r   r   rC   r   r   ú<module>rM      sZ   ðõ #ç &å >Ý 9Ý 7Ý 9÷ñ ñ Ý8ÝGÝ/ðØ
ðØ'ðàó÷.j,ò j,r   