Ë
    Eêñi}  ã                  óö   — U d 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 dd
lmZ erddlZddlmZ ddlmZmZ edddef   Zded<    G d„ d«      Z 	 	 	 	 	 	 	 	 dd„Z!y)z&Streamlit support for GraphViz charts.é    )Úannotations)ÚTYPE_CHECKINGÚ	TypeAliasÚUnionÚcast)Ú	type_util)Úmake_deprecated_name_warningÚshow_deprecation_warning)Úcreate_layout_config)ÚStreamlitAPIException)ÚGraphVizChart)Úgather_metrics)Ú	calc_hashN)ÚDeltaGenerator)ÚHeightÚWidthzgraphviz.Graphzgraphviz.Digraphzgraphviz.Sourcer   ÚFigureOrDotc                  óZ   — e Zd Z ed«      	 ddddœ	 	 	 	 	 	 	 	 	 dd„«       Zed	d„«       Zy)
ÚGraphvizMixinÚgraphviz_chartNÚcontent)ÚwidthÚheightc          	     ó6  — |�!t        t        ddddd¬«      d¬«       |rdnd	}| j                  j                  «       }t	        |j                  «       «      }t        «       }t        |||«       t        ||d
d
¬«      }| j                  j                  d||¬«      S )ai  Display a graph using the dagre-d3 library.

        .. Important::
            You must install ``graphviz>=0.19.0`` to use this command. You can
            install all charting dependencies (except Bokeh) as an extra with
            Streamlit:

            .. code-block:: shell

               pip install streamlit[charts]

        Parameters
        ----------
        figure_or_dot : graphviz.dot.Graph, graphviz.dot.Digraph, graphviz.sources.Source, str
            The Graphlib graph object or dot string to display

        use_container_width : bool
            Whether to override the figure's native width with the width of
            the parent container. If ``use_container_width`` is ``False``
            (default), Streamlit sets the width of the chart to fit its contents
            according to the plotting library, up to the width of the parent
            container. If ``use_container_width`` is ``True``, Streamlit sets
            the width of the figure to match the width of the parent container.

            .. deprecated::
                ``use_container_width`` is deprecated and will be removed in a
                future release. For ``use_container_width=True``, use
                ``width="stretch"``. For ``use_container_width=False``, use
                ``width="content"``.

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

            - ``"content"`` (default): The width of the element matches the
              width of its content, but doesn't exceed the width of the parent
              container.
            - ``"stretch"``: 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.

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

        Examples
        --------
        >>> import streamlit as st
        >>> import graphviz
        >>>
        >>> # Create a graphlib graph object
        >>> graph = graphviz.Digraph()
        >>> graph.edge("run", "intr")
        >>> graph.edge("intr", "runbl")
        >>> graph.edge("runbl", "run")
        >>> graph.edge("run", "kernel")
        >>> graph.edge("kernel", "zombie")
        >>> graph.edge("kernel", "sleep")
        >>> graph.edge("kernel", "runmem")
        >>> graph.edge("sleep", "swap")
        >>> graph.edge("swap", "runswap")
        >>> graph.edge("runswap", "new")
        >>> graph.edge("runswap", "runmem")
        >>> graph.edge("new", "runmem")
        >>> graph.edge("sleep", "runmem")
        >>>
        >>> st.graphviz_chart(graph)

        Or you can render the chart from the graph using GraphViz's Dot
        language:

        >>> st.graphviz_chart('''
            digraph {
                run -> intr
                intr -> runbl
                runbl -> run
                run -> kernel
                kernel -> zombie
                kernel -> sleep
                kernel -> runmem
                sleep -> swap
                swap -> runswap
                runswap -> new
                runswap -> runmem
                new -> runmem
                sleep -> runmem
            }
        ''')

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

        Úuse_container_widthr   z
2025-12-31znFor `use_container_width=True`, use `width='stretch'`. For `use_container_width=False`, use `width='content'`.F)Úinclude_st_prefix)Úshow_in_browserÚstretchr   T)r   r   Úallow_content_widthÚallow_content_heightr   )Úlayout_config)
r
   r	   ÚdgÚ_get_delta_path_strr   ÚencodeÚGraphVizChartProtoÚmarshallr   Ú_enqueue)	ÚselfÚfigure_or_dotr   r   r   Ú
delta_pathÚ
element_idÚgraphviz_chart_protor!   s	            úc/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/graphviz_chart.pyr   zGraphvizMixin.graphviz_chart,   s¸   € ðd Ð*Ü$Ü,Ø)ØØ ðNà&+ôð !&õ
ñ "5‘I¸)ˆEð —W‘W×0Ñ0Ó2ˆ
Ü˜z×0Ñ0Ó2Ó3ˆ
ä1Ó3ÐäÐ% }°jÔAô -ØØØ $Ø!%ô	
ˆð �w‰w×ÑØÐ2À-ð  ó 
ð 	
ó    c                ó   — t        d| «      S )zGet our DeltaGenerator.r   )r   )r(   s    r-   r"   zGraphvizMixin.dgÀ   s   € ô Ð$ dÓ+Ð+r.   )N)
r)   r   r   zbool | Noner   r   r   r   Úreturnr   )r0   r   )Ú__name__Ú
__module__Ú__qualname__r   r   Úpropertyr"   © r.   r-   r   r   +   sy   „ ÙÐ$Ó%ð ,0ðQ
ð
 !Ø"ñQ
à"ðQ
ð )ðQ
ð
 ðQ
ð ðQ
ð 
òQ
ó &ðQ
ðf ò,ó ñ,r.   r   c                óú   — t        j                  |«      r%t        d|«      }|j                  }|j                  }n,t        |t        «      r|}d}nt        dt        |«      › �«      ‚|| _	        || _        || _
        y)zXConstruct a GraphViz chart object.

    See DeltaGenerator.graphviz_chart for docs.
    z3graphviz.Graph | graphviz.Digraph | graphviz.SourceÚdotz#Unhandled type for graphviz chart: N)r   Úis_graphviz_chartr   ÚsourceÚengineÚ
isinstanceÚstrr   ÚtypeÚspecr+   )Úprotor)   r+   Úchartr7   r:   s         r-   r&   r&   Æ   s~   € ô ×"Ñ" =Ô1ÜØAÀ=ó
ˆð �l‰lˆØ—‘‰Ü	�M¤3Ô	'ØˆØ‰ä#Ø1´$°}Ó2EÐ1FÐGó
ð 	
ð €E„JØ€E„LØ!€EÕr.   )r?   r%   r)   r   r+   r<   r0   ÚNone)"Ú__doc__Ú
__future__r   Útypingr   r   r   r   Ú	streamlitr   Ústreamlit.deprecation_utilr	   r
   Ú#streamlit.elements.lib.layout_utilsr   Ústreamlit.errorsr   Ú!streamlit.proto.GraphVizChart_pb2r   r%   Ústreamlit.runtime.metrics_utilr   Ústreamlit.utilr   ÚgraphvizÚstreamlit.delta_generatorr   r   r   r<   r   Ú__annotations__r   r&   r5   r.   r-   ú<module>rO      sŽ   ðò -å "ç 8Ó 8å ÷õ EÝ 2Ý QÝ 9Ý $áÛå8ßAàØÐ(Ð*;¸SÐ@ñ€ˆYó ÷
X,ñ X,ðv"Øð"àð"ð ð"ð 
ô	"r.   