
    %eO/                        U d dl Z d dlmZ d dlmZmZmZmZmZ d dl	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 d d	lmZ d d
lmZ d dlmZ d dlmZ d dlm Z  erd dlm!Z! dZ"ee#d<   dZ$ee#d<   dZ%ee#d<   eej&        e'f         Z(ee#d<   ed         Z)ee#d<   ed         Z*ee#d<   ed         Z+ee#d<   ed         Z,ee#d<   ed         Z-ee#d<   ee+e,e-f         Z.ee#d <   ee.ee'         f         Z/ee#d!<    e0d"          Z1ee#d#<   g d$Z2ee#d%<   d&e(d'e'fd(Z3 ed)          	 	 	 	 	 d9d,ee'         d&ee(         d-e)d.e*d/ee/         d'dfd0            Z4d'e'fd1Z5d:d2Z6d/e/d'dfd3Z7d4e'd'd5fd6Z8d7e'd'e9fd8Z:dS );    N)dedent)TYPE_CHECKINGMappingOptionalUnioncast)urlparse)FinalLiteral	TypeAlias)image)StreamlitAPIException)
ForwardMsg)
PageConfig)gather_metrics)get_script_run_ctx)is_emoji)lower_clean_dict_keys)	TypeGuardget helpGET_HELP_KEYreport a bugREPORT_A_BUG_KEYabout	ABOUT_KEYPageIcon)centeredwideLayout)autoexpanded	collapsedInitialSideBarState)zGet helpzGet Helpr   _GetHelp)zReport a bugr   _ReportABug)Aboutr   _AboutMenuKey	MenuItemsu  🔥™🎉🚀🌌💣✨🌙🎆🎇💥🤩🤙🌛🤘⬆💡🤪🥂⚡💨🌠🎊🍿😛🔮🤟🌃🍃🍾💫▪🌴🎈🎬🌀🎄😝☔⛽🍂💃😎🍸🎨🥳☀😍🅱🌞😻🌟😜💦💅🦄😋😉👻🍁🤤👯🌻‼🌈👌🎃💛😚🔫🙌👽🍬🌅☁🍷👭☕🌚💁👅🥰🍜😌🎥🕺❕🧡☄💕🍻✅🌸🚬🤓🍹®☺💪😙☘🤠✊🤗🍵🤞😂💯😏📻🎂💗💜🌊❣🌝😘💆🤑🌿🦋😈⛄🚿😊🌹🥴😽💋😭🖤🙆👐⚪💟☃🙈🍭💻🥀🚗🤧🍝💎💓🤝💄💖🔞⁉⏰🕊🎧☠♥🌳🏾🙉⭐💊🍳🌎🙊💸❤🔪😆🌾✈📚💀🏠✌🏃🌵🚨💂🤫🤭😗😄🍒👏🙃🖖💞😅🎅🍄🆓👉💩🔊🤷⌚👸😇🚮💏👳🏽💘💿💉👠🎼🎶🎤👗❄🔐🎵🤒🍰👓🏄🌲🎮🙂📈🚙📍😵🗣❗🌺🙄👄🚘🥺🌍🏡♦💍🌱👑👙☑👾🍩🥶📣🏼🤣☯👵🍫➡🎀😃✋🍞🙇😹🙏👼🐝⚫🎁🍪🔨🌼👆👀😳🌏📖👃🎸👧💇🔒💙😞⛅🏻🍴😼🗿🍗♠🦁✔🤖☮🐢🐎💤😀🍺😁😴📺☹😲👍🎭💚🍆🍋🔵🏁🔴🔔🧐👰☎🏆🤡🐠📲🙋📌🐬✍🔑📱💰🐱💧🎓🍕👟🐣👫🍑😸🍦👁🆗🎯📢🚶🦅🐧💢🏀🚫💑🐟🌽🏊🍟💝💲🐍🍥🐸☝♣👊⚓❌🐯🏈📰🌧👿🐳💷🐺📞🆒🍀🤐🚲🍔👹🙍🌷🙎🐥💵🔝📸⚠❓🎩✂🍼😑⬇⚾🍎💔🐔⚽💭🏌🐷🍍✖🍇📝🍊🐙👋🤔🥊🗽🐑🐘🐰💐🐴♀🐦🍓✏👂🏴👇🆘😡🏉👩💌😺✝🐼🐒🐶👺🖕👬🍉🐻🐾⬅⏬▶👮🍌♂🔸👶🐮👪⛳🐐🎾🐕👴🐨🐊🔹©🎣👦👣👨👈💬⭕📹📷RANDOM_EMOJIS)u   🎈u   🤓u   🏈u   🚲u   🐧u   🦒u   🐳u   🕹️u   🇦🇲u   🎸u   🦈u   💎u   👩‍🎤u   🧙‍♂️u   🐻u   🎎
ENG_EMOJIS	page_iconreturnc                     | dk    rt                      S t          | t                    rt          |           r| S 	 t	          j        | ddddd          S # t          $ r t          | t                    r| cY S  w xY w)a  Return the string to pass to the frontend to have it show
    the given PageIcon.

    If page_icon is a string that looks like an emoji (or an emoji shortcode),
    we return it as-is. Otherwise we use `image_to_url` to return a URL.

    (If `image_to_url` raises an error and page_icon is a string, return
    the unmodified page_icon string instead of re-raising the error.)
    randomFRGBr    favicon)widthclampchannelsoutput_formatimage_id)get_random_emoji
isinstancestrr   r   image_to_url	Exception)r,   s    >lib/python3.11/site-packages/streamlit/commands/page_config.py_get_favicon_stringr>   L   s     H!!! )S!! hy&9&9 ! 
 
 
 	
    i%% 	 s   A !A;9A;set_page_configr   r    
page_titlelayoutinitial_sidebar_state
menu_itemsc                    t                      }| | |j        _        |t          |          |j        _        |dk    rt
          j        }n&|dk    rt
          j        }nt          d| d          ||j        _	        |dk    rt
          j
        }n9|dk    rt
          j        }n&|dk    rt
          j        }nt          d	| d          ||j        _        |Mt          t          t!          |                    }t#          |           |j        j        }	t'          ||	           t)                      }
|
dS |
                    |           dS )
u
  
    Configures the default settings of the page.

    .. note::
        This must be the first Streamlit command used on an app page, and must only
        be set once per page.

    Parameters
    ----------
    page_title: str or None
        The page title, shown in the browser tab. If None, defaults to the
        filename of the script ("app.py" would show "app • Streamlit").
    page_icon : Anything supported by st.image or str or None
        The page favicon.
        Besides the types supported by `st.image` (like URLs or numpy arrays),
        you can pass in an emoji as a string ("🦈") or a shortcode (":shark:").
        If you're feeling lucky, try "random" for a random emoji!
        Emoji icons are courtesy of Twemoji and loaded from MaxCDN.
    layout: "centered" or "wide"
        How the page content should be laid out. Defaults to "centered",
        which constrains the elements into a centered column of fixed width;
        "wide" uses the entire screen.
    initial_sidebar_state: "auto", "expanded", or "collapsed"
        How the sidebar should start out. Defaults to "auto",
        which hides the sidebar on small devices and shows it otherwise.
        "expanded" shows the sidebar initially; "collapsed" hides it.
        In most cases, you should just use "auto", otherwise the app will
        look bad when embedded and viewed on mobile.
    menu_items: dict
        Configure the menu that appears on the top-right side of this app.
        The keys in this dict denote the menu item you'd like to configure:

        - "Get help": str or None
            The URL this menu item should point to.
            If None, hides this menu item.
        - "Report a Bug": str or None
            The URL this menu item should point to.
            If None, hides this menu item.
        - "About": str or None
            A markdown string to show in the About dialog.
            If None, only shows Streamlit's default About text.

        The URL may also refer to an email address e.g. ``mailto:john@example.com``.

    Example
    -------
    >>> import streamlit as st
    >>>
    >>> st.set_page_config(
    ...     page_title="Ex-stream-ly Cool App",
    ...     page_icon="🧊",
    ...     layout="wide",
    ...     initial_sidebar_state="expanded",
    ...     menu_items={
    ...         'Get Help': 'https://www.extremelycoolapp.com/help',
    ...         'Report a bug': "https://www.extremelycoolapp.com/bug",
    ...         'About': "# This is a header. This is an *extremely* cool app!"
    ...     }
    ... )
    Nr   r   z,`layout` must be "centered" or "wide" (got "z")r    r!   r"   zJ`initial_sidebar_state` must be "auto" or "expanded" or "collapsed" (got ")ForwardProtopage_config_changedtitler>   r2   PageConfigProtoCENTEREDWIDEr   rA   AUTOEXPANDED	COLLAPSEDrB   r   r)   r   validate_menu_itemsrC   set_menu_items_protor   enqueue)r@   r,   rA   rB   rC   msg	pb_layoutpb_sidebar_statelowercase_menu_itemsmenu_items_protoctxs              r=   r?   r?   r   s   J ..C(2%*=i*H*H' #,			6		#(		#E6EEE
 
 	
 &/C" &&*/	*	,	,*3	+	-	-*4#/*/ / /
 
 	
 5EC1#I/DZ/P/PQQ01112=13CDDD


C
{KK    c                  J    t          j        t          dt          z  z             S )N
   )r/   choicer*   r+    rW   r=   r8   r8      s     =j8999rW   c                 8   t           | v r'| t                    | t                    |_        nd|_        t          | v r'| t                   | t                   |_        nd|_        t          | v r.| t                   #t          | t                             |_        d S d S d S )NT)	r   get_help_urlhide_get_helpr   report_a_bug_urlhide_report_a_bugr   r   about_section_md)rT   rU   s     r=   rO   rO      s    +++-9,@,N))-1*/// 01=0DEU0V--15.(((	*6067KI7V0W0W--- )(66rW   c                     |                                  D ]V\  }}t          |          st          d| d          |-t          |          s|t          k    rt          d| d          Wd S )NzCWe only accept the keys: "Get help", "Report a bug", and "About" ("z" is not a valid key.)"z" is a not a valid URL!)itemsvalid_menu_item_keyr   	valid_urlr   )rC   kvs      r=   rN   rN      s      "" 	L 	L1"1%% 	'// / /  
 =Q<< LANN+,J,J,J,JKKK	L 	LrW   keyzTypeGuard[MenuKey]c                 .    | t           t          t          hv S )N)r   r   r   )ri   s    r=   re   re     s    <!19===rW   urlc                     	 t          |           }|j        dk    rt          |j        |j        g          S t          |j        |j        g          S # t
          $ r Y dS w xY w)NmailtoF)r	   schemeallpathnetlocr<   )rk   results     r=   rf   rf     so    #=H$$v{3444FM6=1222   uus   4A A 
A A )NNr   r    N)r-   N);r/   textwrapr   typingr   r   r   r   r   urllib.parser	   typing_extensionsr
   r   r   streamlit.elementsr   streamlit.errorsr   streamlit.proto.ForwardMsg_pb2r   rE   streamlit.proto.PageConfig_pb2r   rH   streamlit.runtime.metrics_utilr   streamlit.runtime.scriptrunnerr   streamlit.string_utilr   streamlit.utilr   r   r   __annotations__r   r   AtomicImager:   r   r   r#   r$   r%   r'   r(   r)   listr*   r+   r>   r?   r8   rO   rN   re   boolrf   r[   rW   r=   <module>r      s          @ @ @ @ @ @ @ @ @ @ @ @ @ @ ! ! ! ! ! ! 7 7 7 7 7 7 7 7 7 7 $ $ $ $ $ $ 2 2 2 2 2 2 E E E E E E H H H H H H 9 9 9 9 9 9 = = = = = = * * * * * * 0 0 0 0 0 0 ,++++++ e      ( % ( ( (	5   E-s23) 3 3 3./	 / / /!()H!I Y I I I@A) A A A !?@Y @ @ @,-	 - - -X{F:; ; ; ;w56	9 6 6 6
 t b u   
  
E   *#8 # # # # #L !"" $$(17&*p pp!p p /	p
 #p 
p p p #"pf:# : : : :X X X X$
LI 
L$ 
L 
L 
L 
L>S >%9 > > > >3 4      rW   