
    %e6                     D   d dl Z d dlmZ d dlZ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 d dlmZmZ  ee          Z ed	          d
efd            Z ed          d
efd            Z ed          d
efd            Z ed          ded
efd            ZdS )    N)NoReturn)source_util)make_deprecated_name_warning)NoSessionContextStreamlitAPIException)
get_logger)gather_metrics)	RerunDataget_script_run_ctxstopreturnc                      t                      } | r5| j        r0| j                                         t          j                     dS dS dS )a  Stops execution immediately.

    Streamlit will not run any statements after `st.stop()`.
    We recommend rendering a message to explain why the script has stopped.

    Example
    -------
    >>> import streamlit as st
    >>>
    >>> name = st.text_input('Name')
    >>> if not name:
    >>>   st.warning('Please input a name.')
    >>>   st.stop()
    >>> st.success('Thank you for inputting a name.')

    N)r   script_requestsrequest_stopstempty)ctxs    Dlib/python3.11/site-packages/streamlit/commands/execution_control.pyr   r      sY    $ 

C
 s" ((***





       rerunc                      t                      } | rS| j        rN| j        }| j        }| j                            t          ||                     t          j                     dS dS dS )zRerun the script immediately.

    When ``st.rerun()`` is called, the script is halted - no more statements will
    be run, and the script will be queued to re-run from the top.
    query_stringpage_script_hashN)r   r   r   r   request_rerunr
   r   r   )r   r   r   s      r   r   r   7   s     

C
 s" '/)))!1  	
 	
 	
 	




   r   experimental_rerunc                  x    t          ddd          } t                              |            t                       dS )zRerun the script immediately.

    When ``st.experimental_rerun()`` is called, the script is halted - no
    more statements will be run, and the script will be queued to re-run
    from the top.
    r   r   z
2024-04-01N)r   _LOGGERwarningr   )msgs    r   r   r   O   s7     '';Wl
S
SC OOC	GGGGGr   switch_pagepagec                 8   t                      }|r|j        st                      t          j                            t          j                    |j                  }t          j                            |          }t          j        	                    | 
                    d                    } t          j                            ||           t          j        |j                                                  }fd|D             }t          |          dk    r3t          d|  dt          j                            |           d          |j                            t%          |j        |d         d                              t)          j                     d	S )
u  Programmatically switch the current page in a multipage app.

    When ``st.switch_page()`` is called, the current page execution stops and
    the specified page runs as if the user clicked on it in the sidebar
    navigation. The specified page must be recognized by Streamlit's multipage
    architecture (your main Python file or a Python file in a ``pages/``
    folder). Arbitrary Python scripts cannot be passed to ``st.switch_pages``.

    Parameters
    ----------
    page: str
        The file path (relative to the main script) of the page to switch to.

    Example
    -------
    Consider the following example given this file structure:

    >>> your-repository/
    >>> ├── pages/
    >>> │   ├── page_1.py.py
    >>> │   └── page_2.py.py
    >>> └── your_app.py

    >>> import streamlit as st
    >>>
    >>> if st.button("Home"):
    >>>     st.switch_page("your_app.py")
    >>> if st.button("Page 1"):
    >>>     st.switch_page("pages/page_1.py")
    >>> if st.button("Page 2"):
    >>>     st.switch_page("pages/page_2.py")

    .. output ::
        https://doc-switch-page.streamlit.app/
        height: 350px

    /c                 ,    g | ]}|d          k    |S )script_path ).0prequested_pages     r   
<listcomp>zswitch_page.<locals>.<listcomp>   s(    TTT1=1A^1S1SQ1S1S1Sr   r   zCould not find page: 'zJ'. Must be the file path relative to the main script, from the directory: .r   r   N)r   r   r   ospathjoingetcwdmain_script_pathdirnamenormpathstripr   	get_pagesvalueslenr   basenamer   r
   r   r   r   )r"   r   r1   main_script_directoryall_app_pagesmatched_pagesr*   s         @r   r!   r!   _   s   P 

C !c) !   w||BIKK1EFFGOO,<== 7DJJsOO,,D W\\"7>>N)#*>??FFHHMTTTTTTTM
=Q# `T  `  `uwu|  vF  vF  G\  v]  v]  `  `  `
 
 	
 %%)*1-.@A	
 	
 	
   HJJJJJr   )r-   typingr   	streamlitr   r   streamlit.deprecation_utilr   streamlit.errorsr   r   streamlit.loggerr   streamlit.runtime.metrics_utilr	   streamlit.runtime.scriptrunnerr
   r   __name__r   r   r   r   strr!   r'   r   r   <module>rE      s   
			           ! ! ! ! ! ! C C C C C C D D D D D D D D ' ' ' ' ' ' 9 9 9 9 9 9 H H H H H H H H
*X

 h    2 x    . $%%H    &% Ec Eh E E E E E Er   