Ë
    úmxi­  ã                  óÀ   — U d dl mZ d dlZd dlmZmZmZ d dlmZ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 eez  Zd
ed<   ddd„Zdd„Zdd„Z G d„ d«      Zy)é    )ÚannotationsN)ÚTYPE_CHECKINGÚ	TypeAliasÚcast)ÚLayoutConfigÚvalidate_width)ÚStreamlitAPIException)ÚProgress)Ú
clean_text)ÚDeltaGenerator)ÚWidthWithoutContentr   Ú
FloatOrIntc                óŽ   — || cxk  xr |k  nc xs4 t        j                  | |dd¬«      xs t        j                  | |dd¬«      S )a+  
    Checks given value is 'between' the bounds of [low, high],
    considering close values around bounds are acceptable input.

    Notes
    -----
    This check is required for handling values that are slightly above or below the
    acceptable range, for example -0.0000000000021, 1.0000000000000013.
    These values are little off the conventional 0.0 <= x <= 1.0 condition
    due to floating point operations, but should still be considered acceptable input.

    Parameters
    ----------
    value : float
    low : float
    high : float

    g•Ö&è.>)Úrel_tolÚabs_tol)ÚmathÚisclose)ÚvalueÚlowÚhighs      úR/home/htdocs/ttos/venv/lib/python3.12/site-packages/streamlit/elements/progress.pyÚ_check_float_betweenr   #   sF   € ð( 
�Ö	˜Ô	ò 	AÜ�<‰<˜˜s¨D¸$Ô?ò	Aä�<‰<˜˜t¨T¸4Ô@ðó    c                ó  — t        | t        «      rd| cxk  rdk  r| S  t        d| › �«      ‚t        | t        «      r*t	        | dd¬«      rt        | dz  «      S t        d| › �«      ‚t        dt        | «      j                  › �«      ‚)	Nr   éd   z+Progress Value has invalid value [0, 100]: ç        ç      ð?)r   r   z-Progress Value has invalid value [0.0, 1.0]: z!Progress Value has invalid type: )Ú
isinstanceÚintr	   Úfloatr   ÚtypeÚ__name__)r   s    r   Ú
_get_valuer#   =   sœ   € Ü�%œÔØ�Ô˜ÒØˆLð ä#Ø9¸%¸ÐAó
ð 	
ô �%œÔÜ ¨3°SÕ9Ü�u˜s‘{Ó#Ð#Ü#Ø;¸E¸7ÐCó
ð 	
ô  Ø
+¬D°«K×,@Ñ,@Ð+AÐBóð r   c                ón   — | €y t        | t        «      rt        | «      S t        dt	        | «      › d�«      ‚)NzProgress Text is of type zd, which is not an accepted type.Text only accepts: str. Please convert the text to an accepted type.)r   Ústrr   r	   r!   )Útexts    r   Ú	_get_textr'   P   sC   € Ø€|ØÜ�$œÔÜ˜$ÓÐÜ
Ø
#¤D¨£J <ð 0Oð 	Oóð r   c                  ó:   — e Zd Z	 	 d	 	 	 	 	 	 	 dd„Zedd„«       Zy)ÚProgressMixinNc                óÈ   — t        «       }t        |«      |_        t        |«      }|�||_        t        |«       t        |¬«      }| j                  j                  d||¬«      S )aË  Display a progress bar.

        Parameters
        ----------
        value : int or float
            0 <= value <= 100 for int

            0.0 <= value <= 1.0 for float

        text : str or None
            A message to display above the progress bar. The text can optionally
            contain GitHub-flavored Markdown of the following types: Bold, 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 unsupported elements as literal
            characters by backslash-escaping them. E.g.,
            ``"1\. Not an ordered list"``.

            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

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

        Example
        -------
        Here is an example of a progress bar increasing over time and disappearing when it reaches completion:

        >>> import streamlit as st
        >>> import time
        >>>
        >>> progress_text = "Operation in progress. Please wait."
        >>> my_bar = st.progress(0, text=progress_text)
        >>>
        >>> for percent_complete in range(100):
        ...     time.sleep(0.01)
        ...     my_bar.progress(percent_complete + 1, text=progress_text)
        >>> time.sleep(1)
        >>> my_bar.empty()
        >>>
        >>> st.button("Rerun")

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

        )ÚwidthÚprogress)Úlayout_config)	ÚProgressProtor#   r   r'   r&   r   r   ÚdgÚ_enqueue)Úselfr   r&   r+   Úprogress_protor-   s         r   r,   zProgressMixin.progress\   s^   € ôD '›ˆÜ)¨%Ó0ˆÔÜ˜‹ˆØÐØ"&ˆNÔä�uÔÜ$¨5Ô1ˆà�w‰w×Ñ 
¨NÈ-ÐÓXÐXr   c                ó   — t        d| «      S )zGet our DeltaGenerator.r   )r   )r1   s    r   r/   zProgressMixin.dg©   s   € ô Ð$ dÓ+Ð+r   )NÚstretch)r   r   r&   ú
str | Noner+   r   Úreturnr   )r6   r   )r"   Ú
__module__Ú__qualname__r,   Úpropertyr/   © r   r   r)   r)   [   sT   „ ð  Ø%.ð	KYàðKYð ðKYð #ð	KYð
 
óKYðZ ò,ó ñ,r   r)   )r   r   )r   r    r   r    r   r    r6   Úbool)r   r   r6   r   )r&   r5   r6   r5   )Ú
__future__r   r   Útypingr   r   r   Ú#streamlit.elements.lib.layout_utilsr   r   Ústreamlit.errorsr	   Ústreamlit.proto.Progress_pb2r
   r.   Ústreamlit.string_utilr   Ústreamlit.delta_generatorr   r   r   r    r   Ú__annotations__r   r#   r'   r)   r:   r   r   ú<module>rD      sS   ðö #ã ß 1Ñ 1ç LÝ 2Ý BÝ ,áÝ8ÝGð
 ˜e™€
ˆIÓ #ôó4ó&÷Q,ò Q,r   