
    Fg                        S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SS	KJr  \" 5        " S
 S\5      5       rg)zgr.State() component.    )annotationsN)Callable)deepcopy)Any)document)	Component)Eventsc                     ^  \ rS rSr\R
                  /r Sr  SSSS.       SU 4S jjjjr\	SS j5       r
SS jrSS jrSS	 jrSS
 jrSS jr\	S 5       rU 4S jrSrU =r$ )State   FN)time_to_livedelete_callbackc                  > Uc  [         R                  OU=U l        U l        U=(       d    S U l         [	        U5      n[        TU ]!  XS9  Xl	        g! [
         a  n[        S[        U5       S35      UeSnAff = f)a
  
Parameters:
    value: the initial value (of arbitrary type) of the state. The provided argument is deepcopied. If a callable is provided, the function will be called whenever the app loads to set the initial value of the state.
    render: should always be True, is included for consistency with other components.
    time_to_live: The number of seconds the state should be stored for after it is created or updated. If None, the state will be stored indefinitely. Gradio automatically deletes state variables after a user closes the browser tab or refreshes the page, so this is useful for clearing state for potentially long running sessions.
    delete_callback: A function that is called when the state is deleted. The function should take the state value as an argument.
Nc                    g N )as    h/Users/admin/workspace/ai/PDFMathTranslate/myenv/lib/python3.13/site-packages/gradio/components/state.py<lambda> State.__init__.<locals>.<lambda>.   s    T    zYThe initial value of `gr.State` must be able to be deepcopied. The initial value of type z cannot be deepcopied.)valuerender)
mathinfr   r   r   	TypeErrortypesuper__init__r   )selfr   r   r   r   err	__class__s         r   r   State.__init__   s      %,DHH,	
D-  /B>	UOE
 	u4
  	klpqvlwkx  yO  P	s   A 
A<A77A<c                    gNTr   r    s    r   statefulState.stateful8       r   c                    U$ )zW
Parameters:
    payload: Value
Returns:
    Passes a value of arbitrary type through.
r   )r    payloads     r   
preprocessState.preprocess<   s	     r   c                    U$ )z
Parameters:
    value: Expects a value of arbitrary type, as long as it can be deepcopied.
Returns:
    Passes a value of arbitrary type through.
r   )r    r   s     r   postprocessState.postprocessE   s	     r   c                    0 SS.$ )Nzany valid json)r   descriptionr   r&   s    r   api_infoState.api_infoN   s    +;<<r   c                    g r   r   r&   s    r   example_payloadState.example_payloadQ       r   c                    g r   r   r&   s    r   example_valueState.example_valueT   r8   r   c                    gr%   r   r&   s    r   skip_apiState.skip_apiW   r)   r   c                *   > [         TU ]  5       nUS	 U$ )Nr   )r   
get_config)r    configr"   s     r   r@   State.get_config[   s    #%7Or   )r   r   r   r%   )r   r   r   boolr   zint | float | Noner   zCallable[[Any], None] | None)returnrC   )r+   r   rD   r   )r   r   rD   r   )rD   zdict[str, Any])rD   r   )__name__
__module____qualname____firstlineno__r	   changeEVENTSallow_string_shortcutr   propertyr'   r,   r/   r3   r6   r:   r=   r@   __static_attributes____classcell__)r"   s   @r   r   r      s    mm_F " 
 ,08< 
 ) 6 8  =   r   r   )__doc__
__future__r   r   collections.abcr   copyr   typingr   gradio_client.documentationr   gradio.components.baser   gradio.eventsr	   r   r   r   r   <module>rW      s@     "  $   0 ,   
MI M Mr   