o
    $	³h<8  ã                   @  s  U d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZmZmZ d dlmZ d dl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 d dlm Z! d dl"m#Z# d dl$m%Z% d dl&m'Z'm(Z( d dl)m*Z* e
r{d dlm+Z+ dZ,de-d< dZ.de-d< dZ/de-d< eee0f Z1de-d< ed Z2de-d< ed Z3de-d< ed Z4de-d < ed! Z5de-d"< ed# Z6de-d$< ee4e5e6f Z7de-d%< ee7ee0df f Z8de-d&< e9d'ƒZ:de-d(< dKd,d-„Z;dLd0d1„Z<e#d2ƒ					dMdNd=d2„ƒZ=dOd>d?„Z>dPdCdD„Z?dQdEdF„Z@dRdIdJ„ZAdS )Sé    )ÚannotationsN)ÚMapping)ÚPath)Údedent)ÚTYPE_CHECKINGÚAnyÚFinalÚLiteralÚUnionÚcast)Ú	TypeAlias)ÚAtomicImageÚimage_to_url)ÚLayoutConfig)Ú StreamlitInvalidMenuItemKeyErrorÚStreamlitInvalidPageLayoutErrorÚ!StreamlitInvalidSidebarStateErrorÚStreamlitInvalidURLError)Ú
ForwardMsg)Ú
PageConfig)Úgather_metrics)Úget_script_run_ctx)Úis_emojiÚvalidate_material_icon)Úis_url)Ú	TypeGuardúget helpr   ÚGET_HELP_KEYúreport a bugÚREPORT_A_BUG_KEYÚaboutÚ	ABOUT_KEYr   Ú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ÚdictÚreturnúdict[str, Any]c                 C  s   dd„ |   ¡ D ƒS )Nc                 S  s"   i | ]\}}t |ƒ ¡  ¡ |“qS © )ÚstrÚlowerÚstrip)Ú.0ÚkÚvr4   r4   ú[/var/www/html/mmpi2/mmpi_env/lib/python3.10/site-packages/streamlit/commands/page_config.pyÚ
<dictcomp>>   s   " z*_lower_clean_dict_keys.<locals>.<dictcomp>)Úitems)r1   r4   r4   r;   Ú_lower_clean_dict_keys=   s   r>   Ú	page_iconr5   c                 C  s˜   | dkrt ƒ S t| tƒrt| ƒrd| › S t| tƒr#|  d¡r#t| ƒS t| tƒr,t| ƒ} zt| tdddddd	d
W S  t	yK   t| tƒrJ|  Y S ‚ 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.)
    Úrandomzemoji:z	:materialÚstretch)ÚwidthFÚRGBr&   Úfavicon)Úlayout_configÚclampÚchannelsÚoutput_formatÚimage_id)
Úget_random_emojiÚ
isinstancer5   r   Ú
startswithr   r   r   r   Ú	Exception)r?   r4   r4   r;   Ú_get_favicon_stringA   s0   

ÿø

úrN   Úset_page_configÚ
page_titleú
str | NoneúPageIcon | NoneÚlayoutúLayout | NoneÚinitial_sidebar_stateúInitialSideBarState | NoneÚ
menu_itemsúMenuItems | NoneÚNonec                 C  s  t ƒ }| dur| |j_|durt|ƒ|j_|dkrtj}n|dkr%tj}n|du r-tj}nt	|d‚||j_
|dkr>tj}n|dkrFtj}n|dkrNtj}n|du rVtj}nt|d‚||j_|durwtd	t|ƒƒ}t|ƒ |jj}	t||	ƒ tƒ }
|
du r€dS |
 |¡ dS )
u   
    Configure the default settings of the page.

    This command can be called multiple times in a script run to dynamically
    change the page configuration. The calls are additive, with each successive
    call overriding only the parameters that are specified.

    Parameters
    ----------
    page_title: str or None
        The page title, shown in the browser tab. If this is ``None``
        (default), the page title is inherited from the previous call of
        ``st.set_page_config``. If this is ``None`` and no previous call
        exists, the page title is inferred from the page source.

        If a page source is a Python file, its inferred title is derived from
        the filename. If a page source is a callable object, its inferred title
        is derived from the callable's name.

    page_icon : Anything supported by st.image (except list), str, or None
        The page favicon. If ``page_icon`` is ``None`` (default), the page icon
        is inherited from the previous call of ``st.set_page_config``. If this
        is ``None`` and no previous call exists, the favicon is a monochrome
        Streamlit logo.

        In addition to the types supported by |st.image|_ (except list), the
        following strings are valid:

        - A single-character emoji. For example, you can set ``page_icon="ðŸ¦ˆ"``.

        - An emoji short code. For example, you can set ``page_icon=":shark:"``.
          For a list of all supported codes, see
          https://share.streamlit.io/streamlit/emoji-shortcodes.

        - The string literal, ``"random"``. You can set ``page_icon="random"``
          to set a random emoji from the supported list above.

        - An icon from the Material Symbols library (rounded style) in the
          format ``":material/icon_name:"`` where "icon_name" is the name
          of the icon in snake case.

          For example, ``page_icon=":material/thumb_up:"`` will display the
          Thumb Up icon. Find additional icons in the `Material Symbols           <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
          font library.

        .. note::
            Colors are not supported for Material icons. When you use a
            Material icon for favicon, it will be black, regardless of browser
            theme.

        .. |st.image| replace:: ``st.image``
        .. _st.image: https://docs.streamlit.io/develop/api-reference/media/st.image

    layout: "centered", "wide", or None
        How the page content should be laid out. If this is ``None`` (default),
        the page layout is inherited from the previous call of
        ``st.set_page_config``. If this is ``None`` and no previous call
        exists, the page layout is ``"centered"``.

        ``"centered"`` constrains the elements into a centered column of fixed
        width. ``"wide"`` uses the entire screen.

    initial_sidebar_state: "auto", "expanded", "collapsed", or None
        How the sidebar should start out. If this is ``None`` (default), the
        sidebar state is inherited from the previous call of
        ``st.set_page_config``. If no previous call exists, the sidebar state
        is ``"auto"``.

        The folowing states are supported:

        - ``"auto"``: The sidebar is hidden on small devices and shown otherwise.
        - ``"expanded"``: The sidebar is shown initially.
        - ``"collapsed"``: The sidebar is hidden initially.

        In most cases, ``"auto"`` provides the best user experience across
        devices of different sizes.

    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 to configure. The following
        keys can have string or ``None`` values:

        - "Get help": The URL this menu item should point to.
        - "Report a Bug": The URL this menu item should point to.
        - "About": A markdown string to show in the About dialog.

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

        If you do not include a key, its menu item will be hidden (unless it
        was set by a previous call to ``st.set_page_config``). To remove an
        item that was specified in a previous call to ``st.set_page_config``,
        set its value to ``None`` in the dictionary.

    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$   )rS   r&   r'   r(   )rU   r/   )ÚForwardProtoÚpage_config_changedÚtitlerN   rD   ÚPageConfigProtoÚCENTEREDÚWIDEÚLAYOUT_UNSETr   rS   ÚAUTOÚEXPANDEDÚ	COLLAPSEDÚSIDEBAR_UNSETr   rU   r   r>   Úvalidate_menu_itemsrW   Úset_menu_items_protor   Úenqueue)rP   r?   rS   rU   rW   ÚmsgÚ	pb_layoutÚpb_sidebar_stateÚlowercase_menu_itemsÚmenu_items_protoÚctxr4   r4   r;   rO   p   sD   w
ÿ
c                   C  s
   t  t¡S ©N)r@   Úchoicer0   r4   r4   r4   r;   rJ     s   
rJ   rk   rl   úPageConfigProto.MenuItemsc                 C  s„   t | v r| t  d ur| t  |_nd|_t| v r&| t d ur#| t |_nd|_t| v r@| t d ur;t| t p6dƒ|_d S d|_	d S d S )NTÚ )
r   Úget_help_urlÚhide_get_helpr   Úreport_a_bug_urlÚhide_report_a_bugr!   r   Úabout_section_mdÚclear_about_md)rk   rl   r4   r4   r;   rf      s   

ÿ
ùrf   c                 C  sL   |   ¡ D ]\}}t|ƒst|d‚|d ur#t|dƒs#|tkr#t|d‚qd S )N©Úkey)ÚhttpÚhttpsÚmailto)Úurl)r=   Úvalid_menu_item_keyr   r   r!   r   )rW   r9   r:   r4   r4   r;   re   9  s   
ÿ
€úre   ry   úTypeGuard[MenuKey]c                 C  s   | t tthv S rn   )r   r   r!   rx   r4   r4   r;   r~   C  s   r~   )r1   r/   r2   r3   )r?   r"   r2   r5   )NNNNN)rP   rQ   r?   rR   rS   rT   rU   rV   rW   rX   r2   rY   )r2   r5   )rk   r/   rl   rp   r2   rY   )rW   r/   r2   rY   )ry   r5   r2   r   )BÚ
__future__r   r@   Úcollections.abcr   Úpathlibr   Útextwrapr   Útypingr   r   r   r	   r
   r   Útyping_extensionsr   Ú"streamlit.elements.lib.image_utilsr   r   Ú#streamlit.elements.lib.layout_utilsr   Ústreamlit.errorsr   r   r   r   Ústreamlit.proto.ForwardMsg_pb2r   rZ   Ústreamlit.proto.PageConfig_pb2r   r]   Ústreamlit.runtime.metrics_utilr   Ú7streamlit.runtime.scriptrunner_utils.script_run_contextr   Ústreamlit.string_utilr   r   Ústreamlit.url_utilr   r   r   Ú__annotations__r   r!   r5   r"   r%   r)   r*   r+   r-   r.   r/   Úlistr0   r>   rN   rO   rJ   rf   re   r~   r4   r4   r4   r;   Ú<module>   s\    ÿ

/û 
+


