o
    ,&]id                     @  sj   U d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 eeZded< dddZdddZdS )    )annotations)Final)configutil)
get_logger)
ForwardMsgr   _LOGGERmsgr   returnNonec                 C  s   | j dkrD| ddvrF| j}| d | jdd}t|| _ | j| t|t	t
dko?| ddko?| jdd	k| j_d
S d
S d
S )zComputes and assigns the unique hash for a ForwardMsg.

    If the ForwardMsg already has a hash, this is a no-op.

    Parameters
    ----------
    msg : ForwardMsg

     type>   ref_hash
initializemetadataT)deterministiczglobal.minCachedMessageSizedeltanew_elementN)hash
WhichOneofr   
ClearFieldSerializeToStringr   calc_md5CopyFromlenintr   
get_optionr   	cacheable)r	   r   serialized_msg r   a/var/www/html/IGF-ODF-V3/venv/lib/python3.10/site-packages/streamlit/runtime/forward_msg_cache.pypopulate_hash_if_needed   s   

	
r!   c                 C  s<   | j s
td | S t }| j |_|j| j d|j_|S )a  Create a ForwardMsg that refers to the given message via its hash.

    The reference message will also get a copy of the source message's
    metadata.

    Parameters
    ----------
    msg : ForwardMsg
        The ForwardMsg to create the reference to.

    Returns
    -------
    ForwardMsg
        A new ForwardMsg that "points" to the original message via the
        ref_hash field.

    zFailed to create a reference message for a ForwardMsg since the message does not have a hash. This is not expected to happen, please report this as a bug. Falling back to the original message.F)r   r   warningr   r   r   r   r   )r	   ref_msgr   r   r    create_reference_msgE   s   r$   N)r	   r   r
   r   )r	   r   r
   r   )
__future__r   typingr   	streamlitr   r   streamlit.loggerr   streamlit.proto.ForwardMsg_pb2r   __name__r   __annotations__r!   r$   r   r   r   r    <module>   s   
+