
    g3                    l   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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e.f   Z/de+d<   ed   Z0de+d<   ed   Z1de+d<   ed   Z2de+d<   ed    Z3de+d!<   ed"   Z4de+d#<   ee2e3e4f   Z5de+d$<   ee5ee.df   f   Z6de+d%<    e7d&      Z8de+d'<   g d(Z9de+d)<   d2d*Z:d3d+Z; e!d,      	 	 	 	 	 d4	 	 	 	 	 	 	 	 	 	 	 d5d-       Z<d6d.Z=d7d/Z>d8d0Z?d9d1Z@y):    )annotationsN)Mapping)Path)dedent)TYPE_CHECKINGAnyFinalLiteralUnioncast)	TypeAlias)AtomicImageimage_to_url) 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)u   🎈u   🤓u   🏈u   🚲u   🐧u   🦒u   🐳u   🕹️u   🇦🇲u   🎸u   🦈u   💎u   👩‍🎤u   🧙‍♂️u   🐻u   🎎
ENG_EMOJISc                    | j                         D ci c]-  \  }}t        |      j                         j                         |/ c}}S c c}}w N)itemsstrlowerstrip)dictkvs      S/var/www/openai/venv/lib/python3.12/site-packages/streamlit/commands/page_config.py_lower_clean_dict_keysr<   T   s<    26**,?,$!QCFLLN  "A%,???s   2A
c                P   | dk(  r
t               S t        | t              rt        |       r| S t        | t              r| j	                  d      rt        |       S t        | t              rt        |       } 	 t        | 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.)
    randomz	:materialFRGBr&   favicon)widthclampchannelsoutput_formatimage_id)	get_random_emoji
isinstancer5   r   
startswithr   r   r   	Exception)	page_icons    r;   _get_favicon_stringrL   X   s     H!! )S!hy&9)S!i&:&:;&G%i00 )T"	N	 
 	
  i% s   5B B%#B%set_page_configc                   t               }| | |j                  _        |t        |      |j                  _        |dk(  rt
        j                  }n"|dk(  rt
        j                  }nt        |      ||j                  _	        |dk(  rt
        j                  }n8|dk(  rt
        j                  }n"|dk(  rt
        j                  }nt        |      ||j                  _        |Ft        t         t#        |            }t%        |       |j                  j&                  }	t)        ||	       t+               }
|
y|
j-                  |       y)	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 (except list), str, or None
        The page favicon. If ``page_icon`` is ``None`` (default), the favicon
        will be 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. Emoji icons are
          courtesy of Twemoji and loaded from MaxCDN.

        - 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, ``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" 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$   )layoutr&   r'   r(   )initial_sidebar_state)ForwardProtopage_config_changedtitlerL   rA   PageConfigProtoCENTEREDWIDEr   rO   AUTOEXPANDED	COLLAPSEDr   rP   r   r/   r<   validate_menu_items
menu_itemsset_menu_items_protor   enqueue)
page_titlerK   rO   rP   r[   msg	pb_layoutpb_sidebar_statelowercase_menu_itemsmenu_items_protoctxs              r;   rM   rM      s5   H .C(2%*=i*H' #,,		6	#((	-V<<%.C" &*//	*	,*33	+	-*44/"7
 	
 5EC1#I/Ej/QR0122==13CD

C
{KK    c                 H    t        j                  t        dt        z  z         S )N
   )r>   choicer0   r1    re   r;   rG   rG     s     ==j899re   c                    t         | v r| t            | t            |_        nd|_        t        | v r| t           | t           |_        nd|_        t        | v r"| t           t        | t                 |_        y y y )NT)	r   get_help_urlhide_get_helpr   report_a_bug_urlhide_report_a_bugr!   r   about_section_md)rb   rc   s     r;   r\   r\     s    ++-9,@,N)-1*// 01=0DEU0V-15.((	*6067KI7V0W- 7 )re   c                    | j                         D ]A  \  }}t        |      st        |      | t        |d      r-|t        k7  s7t        |       y )Nkey)httphttpsmailto)url)r4   valid_menu_item_keyr   r   r!   r   )r[   r9   r:   s      r;   rZ   rZ   -  sM      "1"1%2q99=q561	>*q11 #re   c                (    | t         t        t        hv S r3   )r   r   r!   rq   s    r;   rw   rw   7  s    <!19===re   )r8   r/   returnzdict[str, Any])rK   r"   ry   r5   )NNr#   r&   N)r^   z
str | NonerK   zPageIcon | NonerO   r%   rP   r)   r[   zMenuItems | Nonery   None)ry   r5   )ry   rz   )r[   r/   ry   rz   )rr   r5   ry   zTypeGuard[MenuKey])A
__future__r   r>   collections.abcr   pathlibr   textwrapr   typingr   r   r	   r
   r   r   typing_extensionsr   "streamlit.elements.lib.image_utilsr   r   streamlit.errorsr   r   r   r   streamlit.proto.ForwardMsg_pb2r   rQ   streamlit.proto.PageConfig_pb2r   rT   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   r1   r<   rL   rM   rG   r\   rZ   rw   ri   re   r;   <module>r      s   #  #   B B ' H  F H 9 V B %+ e  ( % (	5 K,-) -./	 /!()H!I Y I@A) A !?@Y @,-	 -X{F:; ;wc4i(889	9 9
  bu 

E *@*Z !"!!%17#'LLL L /	L
 !L 
L #L^:X$2>re   