
    /_i$                        d dl mZ d dlZd dlZd dlmZmZ d dlmZm	Z	m
Z
 d dlmZmZmZ d dlmZ d dlmZ d dlmZmZmZmZ erd d	lmZ dd
Z G d d      Zy)    )annotationsN)ChainMapUserDict)TYPE_CHECKINGAnycast)LayoutConfigWidthWithoutContentvalidate_width)Json)gather_metrics)is_custom_dictis_list_likeis_namedtupleis_pydantic_model)DeltaGeneratorc                N    t        | t              rt        |       S t        |       S )z\A repr function for json.dumps default arg, which tries to serialize sets
    as lists.
    )
isinstancesetlistrepr)os    V/var/www/html/land_sniper/venv/lib/python3.12/site-packages/streamlit/elements/json.py_ensure_serializationr   (   s      !C(475d1g5    c                  R    e Zd Z ed      ddd	 	 	 	 	 	 	 dd       Zed	d       Zy)
	JsonMixinjsonTstretch)expandedwidthc               4   t        |      r|j                         }t        |      r|j                         }t	        |t
        t        j                  t        f      st        |      rt        |      }t        |      rt        |      }t	        |t              s	 t        j                  |t               }t)               }||_        t	        |t,              r||_        n7t	        |t0              rd|_        ||_        nt#        dt5        |       d      t7        |       t9        |	      }| j$                  j;                  d
||      S # t"        $ rE}| j$                  j'                  d| d       t        j                  |dt               }Y d}~d}~ww xY w)a  Display an object or string as a pretty-printed, interactive JSON string.

        Parameters
        ----------
        body : object or str
            The object to print as JSON. All referenced objects should be
            serializable to JSON as well. If object is a string, we assume it
            contains serialized JSON.

        expanded : bool or int
            The initial expansion state of the JSON element. This can be one
            of the following:

            - ``True`` (default): The element is fully expanded.
            - ``False``: The element is fully collapsed.
            - An integer: The element is expanded to the depth specified. The
              integer must be non-negative. ``expanded=0`` is equivalent to
              ``expanded=False``.

            Regardless of the initial expansion state, users can collapse or
            expand any key-value pair to show or hide any part of the object.

        width : "stretch" or int
            The width of the JSON 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
        -------
        >>> import streamlit as st
        >>>
        >>> st.json(
        ...     {
        ...         "foo": "bar",
        ...         "stuff": [
        ...             "stuff 1",
        ...             "stuff 2",
        ...             "stuff 3",
        ...         ],
        ...         "level1": {"level2": {"level3": {"a": "b"}}},
        ...     },
        ...     expanded=2,
        ... )

        .. output::
           https://doc-json.streamlit.app/
           height: 385px

        )defaultzqWarning: this data structure was not fully serializable as JSON due to one or more unexpected keys.  (Error was: )T)skipkeysr#   Nz	The type z5 of `expanded` is not supported, must be bool or int.)r!   r   )layout_config)r   to_dictr   _asdictr   r   typesMappingProxyTyper   r   dictr   r   strr   dumpsr   	TypeErrordgwarning	JsonProtobodyboolr    intmax_expand_depthtyper   r	   _enqueue)selfr2   r    r!   err
json_protor&   s          r   r   zJsonMixin.json0   sd   ~ $<<>D<<>D8U33X>
t$:D:D$$Vzz$0EF [

h%"*J#&"&J*2J'DN+ ,) ) 
 	u$51ww
-PP1  VMMPEQRT zz$?TUVs   E	 		F;FFc                    t        d|       S )zGet our DeltaGenerator.r   )r   )r8   s    r   r/   zJsonMixin.dg   s     $d++r   N)r2   objectr    z
bool | intr!   r
   returnr   )r=   r   )__name__
__module____qualname__r   r   propertyr/    r   r   r   r   /   sh    F
  $%.hQhQ 	hQ
 #hQ 
hQ hQT , ,r   r   )r   r<   r=   zstr | list[Any])
__future__r   r   r)   collectionsr   r   typingr   r   r   #streamlit.elements.lib.layout_utilsr	   r
   r   streamlit.proto.Json_pb2r   r1   streamlit.runtime.metrics_utilr   streamlit.type_utilr   r   r   r   streamlit.delta_generatorr   r   r   rB   r   r   <module>rK      sN    #   * + + 
 7 9  86o, o,r   