Ë
    Eêñi•  ã                  óf  — U d dl mZ d dlmZmZ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mZmZ d dlmZmZ d dlmZmZ d dlmZ erd d	lmZ d d
lmZ  e	j<                  e«      Z de!d<   dd„Z"da#de!d<   	 d	 	 	 	 	 	 	 dd„Z$ G d„ de«      Z%dd„Z&dd„Z'	 d ddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 d!d„Z(d"d„Z)y)#é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚFinal)ÚconfigÚerrorsÚloggerÚruntime)Ú
is_in_form)ÚStreamlitAPIWarningÚ.StreamlitFragmentWidgetsNotAllowedOutsideErrorÚ!StreamlitInvalidFormCallbackErrorÚ'StreamlitValueAssignmentNotAllowedError)Úget_script_run_ctxÚin_cached_function)ÚWidgetCallbackÚget_session_state)Úrequire_valid_user_key)ÚSequence)ÚDeltaGeneratorr   Ú_LOGGERc                ó^   — t        j                  «       rt        | «      r|�
t        «       ‚yyy)zæEnsures that widgets other than `st.form_submit_button` within a form don't have
    an on_change callback set.

    Raises
    ------
    StreamlitInvalidFormCallbackError:
        Raised when the described rule is violated.
    N)r
   Úexistsr   r   )ÚdgÚ	on_changes     úa/var/www/pod-logistic/pod-ai/venv/lib/python3.12/site-packages/streamlit/elements/lib/policies.pyÚcheck_callback_rulesr   +   s-   € ô ‡~�~ÔœJ rœN¨yÐ/DÜ/Ó1Ð1ð 0E˜NÐó    FÚboolÚ_shown_default_value_warningTc                óú   — |�t        j                  «       syt        «       }|j                  |«      sy|st	        |¬«      ‚| �8t
        s1t        j                  d«      st        j                  d|d¬«       dayyyy)aª  Ensures that no values are set for widgets with the given key when writing
    is not allowed.

    Additionally, if `global.disableWidgetStateDuplicationWarning` is False, logs a
    warning when a widget has a default value but its value is also set via session state.

    Raises
    ------
    StreamlitValueAssignmentNotAllowedError:
        Raised when writing is not allowed but session state contains a new value.
    N)Úkeyz+global.disableWidgetStateDuplicationWarningzoThe widget with key "%s" was created with a default value but also had its value set via the Session State API.T©Ú
stack_info)
r
   r   r   Úis_new_state_valuer   r    r   Ú
get_optionr   Úwarning)Údefault_valuer"   Úwrites_allowedÚsession_states       r   Úcheck_session_state_rulesr+   <   sŠ   € ð  €{œ'Ÿ.™.Ô*Øä%Ó'€MØ×+Ñ+¨CÔ0ØáÜ5¸#Ô>Ð>ð 	Ð!Ý,Ü×!Ñ!Ð"OÔPä�‰ð7àØð	 	ô 	
ð (,Ñ$ð Qð -ð 	"r   c                  ó    ‡ — e Zd Zdˆ fd„Zˆ xZS )ÚCachedWidgetWarningc                ó$   •— t         ‰| �  d«       y )Na#  
Your script uses a widget command in a cached function
(function decorated with `@st.cache_data` or `@st.cache_resource`).
This code will only be called when we detect a cache "miss",
which can lead to unexpected results.

To fix this, move all widget commands outside the cached function.
)ÚsuperÚ__init__)ÚselfÚ	__class__s    €r   r0   zCachedWidgetWarning.__init__e   s   ø€ Ü‰Ñðõ		
r   ©ÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__r0   Ú__classcell__)r2   s   @r   r-   r-   d   s   ø„ ÷

ñ 

r   r-   c                 óZ   — t        j                  «       rddlm}   | t	        «       «       yy)av  Check if a widget is allowed to be used in the current context.
    More specifically, this checks if the current context is inside a
    cached function that disallows widget usage. If so, it raises a warning.

    If there are other similar checks in the future, we could extend this
    function to check for those as well. And rename it to check_widget_usage_rules.
    r   ©Ú	exceptionN)r   ÚgetÚ	streamlitr<   r-   r;   s    r   Úcheck_cache_replay_rulesr?   r   s&   € ô ×ÑÔÝ'ñ 	Ô%Ó'Õ(ð  r   c                ó$  — t        «       }|�|j                  €y|j                  }| j                  j                  }|€y|j
                  }t        |«      t        |«      k  r
t        «       ‚t        |«      D ]  \  }}||   |k7  sŒt        «       ‚ y)a[  Ensures that the current widget is not written outside of the
    fragment's delta path.

    Should be called by ever element that acts as a widget.
    We don't allow writing widgets from within a widget to the outside path
    because it can lead to unexpected behavior. For elements, this is okay
    because they do not trigger a re-run.
    N)	r   Úcurrent_fragment_idÚcurrent_fragment_delta_pathÚ
_active_dgÚ_cursorÚ
delta_pathÚlenr   Ú	enumerate)r   ÚctxrB   Úcurrent_cursorÚcurrent_cursor_delta_pathÚindexÚ
path_indexs          r   Úcheck_fragment_path_policyrM   ‚   s¢   € ô Ó
€Cà
€{�c×-Ñ-Ð5Øà"%×"AÑ"AÐØ—]‘]×*Ñ*€NØÐØà .× 9Ñ 9Ðô Ð$Ó%¬Ð,GÓ(HÒHÜ<Ó>Ð>ô 'Ð'BÓCò CÑˆˆzØ$ UÑ+¨zÓ9Ü@ÓBÐBñCr   N)r(   r)   Úenable_check_callback_rulesc               ó€   — t        | «       t        «        |rt        | |«       |�t        |«       t	        |||¬«       y)z7Check all widget policies for the given DeltaGenerator.N)r(   r"   r)   )rM   r?   r   r   r+   )r   r"   r   r(   r)   rN   s         r   Úcheck_widget_policiesrP   ¤   s;   € ô ˜rÔ"ÜÔÙ"Ü˜R Ô+Ø
€Ü˜sÔ#ÜØ#¨¸^ör   c                óp   — | st         j                  dd¬«       |dvrt        j                  d|› d�«      ‚y )NzÔ`label` got an empty value. This is discouraged for accessibility reasons and may be disallowed in the future by raising an exception. Please provide a non-empty label and hide it with label_visibility if needed.Tr#   >   ÚhiddenÚvisibleÚ	collapsedz%Unsupported label_visibility option 'z7'. Valid values are 'visible', 'hidden' or 'collapsed'.)r   r'   r   ÚStreamlitAPIException)ÚlabelÚlabel_visibilitys     r   Úmaybe_raise_label_warningsrX   ¹   sZ   € ÙÜ�‰ðð ð 	ô 	
ð ÐAÑAÜ×*Ñ*Ø3Ð4DÐ3Eð FCð Dó
ð 	
ð Br   )r   r   r   úWidgetCallback | Noner4   r5   )T)r(   r   r"   ú
str | Noner)   r   r4   r5   r3   )r   r   r4   r5   )N)r   r   r"   rZ   r   rY   r(   zSequence[Any] | Any | Noner)   r   rN   r   r4   r5   )rV   rZ   rW   rZ   r4   r5   )*Ú
__future__r   Útypingr   r   r   r>   r   r   r	   r
   Ú!streamlit.elements.lib.form_utilsr   Ústreamlit.errorsr   r   r   r   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr   r   Ústreamlit.runtime.stater   r   Ústreamlit.runtime.state.commonr   Úcollections.abcr   Ústreamlit.delta_generatorr   Ú
get_loggerr6   r   Ú__annotations__r   r    r+   r-   r?   rM   rP   rX   © r   r   ú<module>rg      s  ðö #ç ,Ñ ,ç 5Ó 5Ý 8÷ó ÷÷ FÝ AáÝ(å8ð #�×"Ñ" 8Ó,€ˆÓ ,ó2ð &+Ð ˜dÓ *ð AEð%,Øð%,Ø'ð%,Ø9=ð%,à	ó%,ôP
Ð-ô 
ó)ó CðJ (,ðð
 15ØØ(,ñØðà	ðð %ðð
 .ðð ðð "&ðð 
óô*
r   