
    ch1                       % S SK Jr  S SKJr  S SKJr  S SKJrJrJ	r	J
r
Jr  S SKJr  S SKJrJrJrJrJr  S SKJr  S SKJrJr  S S	KJr  S S
KJr  S SKJr  S SK J!r!  \(       a
  S SK"r#S SK$J%r%  \
SS\&\'\(S4   r)S\*S'   \
\&\'\(S4   r+S\*S'   \	S   r,S\*S'   \" SS9 " S S5      5       r- " S S5      r.S!S jr/S"S jr0S#S jr1      S$S jr2S%S  jr3g)&    )annotations)	dataclass)dedent)TYPE_CHECKINGAnyLiteralUnioncast)	TypeAlias)HeightLayoutConfigWidthvalidate_heightvalidate_width)maybe_raise_label_warnings)LabelVisibility get_label_visibility_proto_value)StreamlitAPIException)Metric)gather_metrics)
clean_textN)DeltaGeneratorznp.integer[Any]znp.floating[Any]r   ValueDelta)normalinverseoff
DeltaColorT)frozenc                  *    \ rS rSr% S\S'   S\S'   Srg)MetricColorAndDirection3   z!MetricProto.MetricColor.ValueTypecolorz%MetricProto.MetricDirection.ValueType	direction N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r%       lC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\streamlit/elements/metric.pyr!   r!   3   s    ,,44r,   r!   c                      \ rS rSr\" S5             S                   SS jj5       r\S	S j5       rSrg)
MetricMixin9   metricNc
                   [        X5        [        5       n
[        U5      U
l        [	        U5      U
l        [        U5      U
l        Xzl        Ub  [        U5      U
l
        [        [        S[        U5      5      U5      nUR                  U
l        UR                  U
l        [!        U5      U
R"                  l        ['        U	SS9  [)        USS9  [+        XS9nU R,                  R/                  SXS9$ )u  Display a metric in big bold font, with an optional indicator of how the metric changed.

Tip: If you want to display a large number, it may be a good idea to
shorten it using packages like `millify <https://github.com/azaitsev/millify>`_
or `numerize <https://github.com/davidsa03/numerize>`_. E.g. ``1234`` can be
displayed as ``1.2k`` using ``st.metric("Short number", millify(1234))``.

Parameters
----------
label : str
    The header or title for the metric. The label 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

value : int, float, str, or None
     Value of the metric. None is rendered as a long dash.

delta : int, float, str, or None
    Indicator of how the metric changed, rendered with an arrow below
    the metric. If delta is negative (int/float) or starts with a minus
    sign (str), the arrow points down and the text is red; else the
    arrow points up and the text is green. If None (default), no delta
    indicator is shown.

delta_color : "normal", "inverse", or "off"
     If "normal" (default), the delta indicator is shown as described
     above. If "inverse", it is red when positive and green when
     negative. This is useful when a negative change is considered
     good, e.g. if cost decreased. If "off", delta is  shown in gray
     regardless of its value.

help : str or None
    A tooltip that gets displayed next to the metric label. Streamlit
    only displays the tooltip when ``label_visibility="visible"``. 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``.

label_visibility : "visible", "hidden", or "collapsed"
    The visibility of the label. The default is ``"visible"``. If this
    is ``"hidden"``, Streamlit displays an empty spacer instead of the
    label, which can help keep the widget aligned with other widgets.
    If this is ``"collapsed"``, Streamlit displays no label or spacer.

border : bool
    Whether to show a border around the metric container. If this is
    ``False`` (default), no border is shown. If this is ``True``, a
    border is shown.

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

    - ``"content"`` (default): The height of the element matches the
      height of its content.
    - ``"stretch"``: The height of the element matches the height of
      its content or the height of the parent container, whichever is
      larger. If the element is not in a parent container, the height
      of the element matches the height of its content.
    - An integer specifying the height in pixels: The element has a
      fixed height. If the content is larger than the specified
      height, scrolling is enabled.

width : "stretch", "content", or int
    The width of the metric 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
--------
**Example 1: Show a metric**

>>> import streamlit as st
>>>
>>> st.metric(label="Temperature", value="70 °F", delta="1.2 °F")

.. output::
    https://doc-metric-example1.streamlit.app/
    height: 210px

**Example 2: Create a row of metrics**

``st.metric`` looks especially nice in combination with ``st.columns``.

>>> import streamlit as st
>>>
>>> col1, col2, col3 = st.columns(3)
>>> col1.metric("Temperature", "70 °F", "1.2 °F")
>>> col2.metric("Wind", "9 mph", "-8%")
>>> col3.metric("Humidity", "86%", "4%")

.. output::
    https://doc-metric-example2.streamlit.app/
    height: 210px

**Example 3: Modify the delta indicator**

The delta indicator color can also be inverted or turned off.

>>> import streamlit as st
>>>
>>> st.metric(label="Gas price", value=4, delta=-0.5, delta_color="inverse")
>>>
>>> st.metric(
...     label="Active developers", value=123, delta=123, delta_color="off"
... )

.. output::
    https://doc-metric-example3.streamlit.app/
    height: 320px

**Example 4: Create a grid of metric cards**

Add borders to your metrics to create a dashboard look.

>>> import streamlit as st
>>>
>>> a, b = st.columns(2)
>>> c, d = st.columns(2)
>>>
>>> a.metric("Temperature", "30°F", "-9°F", border=True)
>>> b.metric("Wind", "4 mph", "2 mph", border=True)
>>>
>>> c.metric("Humidity", "77%", "5%", border=True)
>>> d.metric("Pressure", "30.34 inHg", "-2 inHg", border=True)

.. output::
    https://doc-metric-example4.streamlit.app/
    height: 350px

r   T)allow_content)widthheightr1   )layout_config)r   MetricProto_parse_valuebody_parse_labellabel_parse_deltadeltashow_borderr   help$_determine_delta_color_and_directionr
   r   r#   r$   r   label_visibilityvaluer   r   r   dg_enqueue)selfr;   rB   r=   delta_colorr?   rA   borderr4   r5   metric_protocolor_and_directionr6   s                r-   r1   MetricMixin.metric:   s    H 	#5;"}(/)%0)%0#)  &tLBz+67
 166!4!>!>.N/
%%+ 	d3uD1$5@ww,TTr,   c                    [        SU 5      $ )Nr   )r
   )rE   s    r-   rC   MetricMixin.dg   s    $d++r,   r%   )Nr   NvisibleFstretchcontent)r;   strrB   r   r=   r   rF   r   r?   z
str | NonerA   r   rG   boolr4   r   r5   r   returnr   )rR   r   )	r&   r'   r(   r)   r   r1   propertyrC   r+   r%   r,   r-   r/   r/   9   s    H
 "*,5 "zUzU zU 	zU
  zU zU *zU zU zU zU 
zU zUx , ,r,   r/   c                f    [        U [        5      (       d  [        SU  S[        U 5       S35      eU $ )N'' is of type zg, which is not an accepted type. label only accepts: str. Please convert the label to an accepted type.)
isinstancerP   	TypeErrortype)r;   s    r-   r:   r:      s@    eS!!wmDK= 1V V
 	
 Lr,   c                `   U c  g[        U [        [        [        45      (       a  [        U 5      $ [	        U S5      (       aD   [        U R                  5       [        [        45      (       a  [        U R                  5       5      $  [        SU  S[        U 5       S35      e! [         a     N'f = f)Nu   —itemrU   rV   z|, which is not an accepted type. value only accepts: int, float, str, or None. Please convert the value to an accepted type.)	rW   intfloatrP   hasattrr[   	ExceptionrX   rY   )rB   s    r-   r8   r8     s    }%#uc*++5zuf	%**,555::<(( 6 
E7-U} -9 	9 	  		s   AB   
B-,B-c                    U b  U S:X  a  g[        U [        5      (       a  [        U 5      $ [        U [        [        45      (       a  [        U 5      $ [        SU  S[        U 5       S35      e)N rU   rV   z|, which is not an accepted type. delta only accepts: int, float, str, or None. Please convert the value to an accepted type.)rW   rP   r   r\   r]   rX   rY   r=   s    r-   r<   r<     sj    }%e}%#u&&5z

E7-U} -9 	9 r,   c                   U S;  a  [        SU  S35      eUb  US:X  a:  [        [        R                  R                  [        R
                  R                  S9$ [        U5      (       aw  U S:X  a  [        R                  R                  nO;U S:X  a  [        R                  R                  nO[        R                  R                  n[        R
                  R                  nOvU S:X  a  [        R                  R                  nO;U S:X  a  [        R                  R                  nO[        R                  R                  n[        R
                  R                  n[        UUS9$ )N>   r   r   r   rU   zS' is not an accepted value. delta_color only accepts: 'normal', 'inverse', or 'off'ra   )r#   r$   r   r   )r   r!   r7   MetricColorGRAYMetricDirectionNONE_is_negative_deltaREDGREENDOWNUP)rF   r=   cd_colorcd_directions       r-   r@   r@   )  s+    66#} , ,
 	

 }&))..!1166
 	

 %  (""..22HI%"..44H"..33H"2277(""..44HI%"..22H"..33H"2255" r,   c                H    [        [        U 5      5      R                  S5      $ )N-)r   rP   
startswithrb   s    r-   rh   rh   P  s    #e*((--r,   )r;   rP   rR   rP   )rB   r   rR   rP   )r=   r   rR   rP   )rF   r   r=   r   rR   r!   )r=   r   rR   rQ   )4
__future__r   dataclassesr   textwrapr   typingr   r   r   r	   r
   typing_extensionsr   #streamlit.elements.lib.layout_utilsr   r   r   r   r   streamlit.elements.lib.policiesr   streamlit.elements.lib.utilsr   r   streamlit.errorsr   streamlit.proto.Metric_pb2r   r7   streamlit.runtime.metrics_utilr   streamlit.string_utilr   numpynpstreamlit.delta_generatorr   r]   r\   rP   r   r*   r   r   r!   r/   r:   r8   r<   r@   rh   r%   r,   r-   <module>r      s    # !  ; ; '  G 3 < 9 ,8 *,>sCQUUVy VS$./y / :;
I ; $5 5 5
@, @,F,$$$ $N.r,   