a
    d]                    @  s   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
Z
d dlZd dlZd dlmZmZ d dl
mZ d dlmZmZmZmZmZ d dlmZ ed	 G d
d dZeddddddG dd deZdS )    )annotationsN)Path)Iterable)documentset_documentation_group)CommitOperationAdd)colorsfontsget_matching_versionget_theme_assetssizes)README_CONTENTZthemesc                	   @  s   e Zd Zdd Zdd Zdd Zedd dd	d
Zedd dddZddddZ	ed#dddddZ
edddddZeddddddZd$dddddddd d!d"ZdS )%
ThemeClassc                 C  s   g | _ d | _d S N)_stylesheetsname)self r   [/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/themes/base.py__init__   s    zThemeClass.__init__c                   s*  i }i }| j  D ]\  dr&qd u r\ drLd | d d < qntd  dtd} fdd}t|| dd	  d
r d d  | < q| < q| D ]\  |vr| < qdd	dd | D  d }dd	dd | D  d }| d| S )N__darkzCannot set 'z1' to None - only dark mode variables can be None.z(\*)([\w_]+)(\b)c                   s   |  d}|dr4|dr4td  d d drv|drv d d |dd  krvtd  d d	|  d
}|dd}d| dS )Nr   *r   zCannot refer 'z' to 'zz' - dark variable references are automatically used for dark mode attributes, so do not use the _dark suffix in the value.r      zN' - if dark and light mode values are the same, set dark mode version to None.   r   -zvar(--))group
startswithendswith
ValueErrorreplace)matchZ
full_matchwordattrvalr   r   	repl_func3   s"    

z,ThemeClass._get_theme_css.<locals>.repl_funcr   z-darkz:root {

c                 S  s"   g | ]\}}d | d| dqS z  --z: ;r   .0r&   r'   r   r   r   
<listcomp>V       z-ThemeClass._get_theme_css.<locals>.<listcomp>z
}z.dark {
c                 S  s"   g | ]\}}d | d| dqS r*   r   r,   r   r   r   r.   [   r/   )
__dict__itemsr   r    r!   strresubr"   join)r   cssZdark_csspatternr(   Zcss_codeZdark_css_coder   r%   r   _get_theme_css!   sJ    






zThemeClass._get_theme_cssc                 C  sd   di i}t | D ]N}|dr8|ds8|dks8|dkrtt| |ttfrt| ||d |< q|S )z+Convert the theme into a python dictionary.themer   _fontr   r   )dirr   
isinstancegetattrlistr2   )r   Zschemapropr   r   r   to_dicta   s    zThemeClass.to_dictr2   )pathreturnc                 C  sB   t |&}| tj|tjdW  d   S 1 s40    Y  dS )zdLoad a theme from a json file.

        Parameters:
            path: The filepath to read.
        )object_hookN)open	from_dictjsonloadr	   Zas_font)clsrA   fpr   r   r   rG   n   s    
zThemeClass.loadzdict[str, dict[str, str]])r9   rB   c                 C  sd   |  }|d   D ]\}}t||| qt }|jD ]*}|ds4t||s4t||t|| q4|S )zCreate a theme instance from a dictionary representation.

        Parameters:
            theme: The dictionary representation of the theme.
        r9   r   )r1   setattrBaser0   r   hasattrr=   )rH   r9   Z	new_themer?   valuebaser&   r   r   r   rE   x   s    
zThemeClass.from_dictfilenamec                 C  s"   t |tj|  tjd dS )zsWrite the theme to a json file.

        Parameters:
            filename: The path to write the theme too
        rH   N)r   
write_textrF   dumpsr@   r	   FontEncoder)r   rP   r   r   r   dump   s    zThemeClass.dumpNz
str | None)	repo_namehf_tokenc              
   C  s   d|vr|d }}n| d\}}tj|d}z||}W n8 tjyt } ztd| d|W Y d}~n
d}~0 0 t|}t||}	|	std| ddd	 |D  tj	|d
d|	j
 dd}
| |
}||_|S )a  Load a theme from the hub.

        This DOES NOT require a HuggingFace account for downloading publicly available themes.

        Parameters:
            repo_name: string of the form <author>/<theme-name>@<semantic-version-expression>.  If a semantic version expression is omitted, the latest version will be fetched.
            hf_token: HuggingFace Token. Only needed to download private themes.
        @Ntoken
The space z does not existz.Cannot find a matching version for expression z from files c                 S  s   g | ]
}|j qS r   rO   )r-   fr   r   r   r.      r/   z'ThemeClass.from_hub.<locals>.<listcomp>spacethemes/theme_schema@.json)repo_id	repo_typerP   )splithuggingface_hubHfApi
space_inforequests	HTTPErrorr!   r   r
   Zhf_hub_downloadversionrG   r   )rH   rV   rW   r   rh   apire   eassetsZmatching_versionZ
theme_filer9   r   r   r   from_hub   s0    
(

zThemeClass.from_hubz huggingface_hub.hf_api.SpaceInfo)re   rB   c                 C  s&   t | }t|dd dj}t| S )Nc                 S  s   | j S r   rh   )Zassetr   r   r   <lambda>   r/   z.ThemeClass._get_next_version.<locals>.<lambda>)key)r   maxrh   r2   Z
next_patch)re   rk   Zlatest_versionr   r   r   _get_next_version   s    zThemeClass._get_next_versionbool)re   rh   rB   c                   s   t | }t fdd|D S )Nc                 3  s   | ]}|j t kV  qd S r   )rh   semverVersion)r-   arm   r   r   	<genexpr>   r/   z3ThemeClass._theme_version_exists.<locals>.<genexpr>)r   any)re   rh   rk   r   rm   r   _theme_version_exists   s    z ThemeClass._theme_version_existsF)rV   org_namerh   rW   
theme_namedescriptionprivatec              
   C  s  ddl m} t }	|sZzt d }
W qj tyV } ztd|W Y d}~qjd}~0 0 ntj|dd }
|pp|
 d| }z|	|}W n tj	y   d}Y n0 |du}|s|r| 
|nd}n
t|}|r| ||rtd	| d
| d| d|p|}tjdddd2}|  }||d< tj||tjd W d   n1 sN0    Y  tjddd8}tj||pvd|
|d}|t| W d   n1 s0    Y  tjdddx}ttjd  }tdd| d|}td|p||}td|p
|
|}td||}|| W d   n1 s>0    Y  t d| d|j!dt d|j!dt d|j!dg}tj"|d d!|d"|d# |	j#|d$d ||d% d&| }t$d'|  |S )(u  Upload a theme to the HuggingFace hub.

        This requires a HuggingFace account.

        Parameters:
            repo_name: The name of the repository to store the theme assets, e.g. 'my_theme' or 'sunset'.
            org_name: The name of the org to save the space in. If None (the default), the username corresponding to the logged in user, or hƒ_token is used.
            version: A semantic version tag for theme. Bumping the version tag lets you publish updates to a theme without changing the look of applications that already loaded your theme.
            hf_token: API token for your HuggingFace account
            theme_name: Name for the name. If None, defaults to repo_name
            description: A long form description to your theme.
        r   )__version__r   zIn order to push to hub, log in via `huggingface-cli login` or provide a theme_token to push_to_hub. For more information see https://huggingface.co/docs/huggingface_hub/quick-start#loginNrY   /z0.0.1r[   z" already has a theme with version z. See: themes/theme_schema@zE.json. To manually override this version, use the HuggingFace hub UI.wFr_   )modedeletesuffixrh   rQ   )r   r   z%Add a description of this theme here!)rz   r{   authorZgradio_versionzapp.pyztheme=gr.themes.Default\(\)ztheme=''z{THEME}z{AUTHOR}z{SPACE_NAME}r^   )Zpath_in_repoZpath_or_fileobjz	README.mdr]   gradioT)ra   Z	space_sdkrZ   exist_okr|   zUpdating theme)r`   Zcommit_messagera   
operationsrZ   zhttps://huggingface.co/spaces/zSee your theme here! )%r   r}   rc   rd   ZwhoamiOSErrorr!   re   rf   rg   rq   rs   rt   rx   tempfileNamedTemporaryFiler@   rF   rU   r	   rT   r   formatwritetextwrapdedentr   __file__parent	read_textr3   r4   r   r   Zcreate_repoZcreate_commitprint)r   rV   ry   rh   rW   rz   r{   r|   r}   ri   r   rj   Zspace_idre   Zspace_existsr   Zcss_filecontentsZreadme_fileZreadme_contentZapp_filer   urlr   r   r   push_to_hub   s    


20
*
	
zThemeClass.push_to_hub)N)NNNNNF)__name__
__module____qualname__r   r8   r@   classmethodrG   rE   rU   rl   staticmethodrq   rx   r   r   r   r   r   r      s*   @	'	      r   r   rl   rG   rU   rE   r@   c                   @  sJ  e Zd Zejejejejejej	e
ddddfe
ddddfd	d
d
d
dddddd	ddZdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd dddZdS )rK   zSource Sans Prozui-sans-serifz	system-uiz
sans-serifzIBM Plex Monozui-monospaceZConsolasZ	monospace)primary_huesecondary_hueneutral_hue	text_sizespacing_sizeradius_sizefont	font_monozcolors.Color | strzsizes.Size | strz-fonts.Font | str | Iterable[fonts.Font | str]c                C  s  d| _ ddd}	|	|dd}|	|dd}|	|dd}|	|ddd	}|	|dd
d	}|	|ddd	}|j| _|j| _|j| _|j| _|j	| _
|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j| _|j	| _|j| _|j| _|j| _|j| _|j| _ |j| _!|j| _"|j| _#|j| _$|j| _%|j	| _&|j| _'|j| _(|j| _)|j| _*|j| _+|j| _,|j-| _.|j/| _0|j1| _2|j3| _4|j5| _6|j7| _8|j9| _:|j-| _;|j/| _<|j1| _=|j3| _>|j5| _?|j7| _@|j9| _A|j-| _B|j/| _C|j1| _D|j3| _E|j5| _F|j7| _G|j9| _HtI|tJs |g}dd |D | _KtI|tJsB|g}dd |D | _LdMdd | jKD | _NdMdd | jLD | _Og | _P| jK| jL D ] }|Q }
|
r| jPR|
 q| S  dS )a
  
        Parameters:
            primary_hue: The primary hue of the theme. Load a preset, like gradio.themes.colors.green (or just the string "green"), or pass your own gradio.themes.utils.Color object.
            secondary_hue: The secondary hue of the theme. Load a preset, like gradio.themes.colors.green (or just the string "green"), or pass your own gradio.themes.utils.Color object.
            neutral_hue: The neutral hue of the theme, used . Load a preset, like gradio.themes.colors.green (or just the string "green"), or pass your own gradio.themes.utils.Color object.
            text_size: The size of the text. Load a preset, like gradio.themes.sizes.text_sm (or just the string "sm"), or pass your own gradio.themes.utils.Size object.
            spacing_size: The size of the spacing. Load a preset, like gradio.themes.sizes.spacing_sm (or just the string "sm"), or pass your own gradio.themes.utils.Size object.
            radius_size: The radius size of corners. Load a preset, like gradio.themes.sizes.radius_sm (or just the string "sm"), or pass your own gradio.themes.utils.Size object.
            font: The primary font to use for the theme. Pass a string for a system font, or a gradio.themes.font.GoogleFont object to load a font from Google Fonts. Pass a list of fonts for fallbacks.
            font_mono: The monospace font to use for the theme, applies to code. Pass a string for a system font, or a gradio.themes.font.GoogleFont object to load a font from Google Fonts. Pass a list of fonts for fallbacks.
        rN   colorNc                 S  s   t | ts| S |dkrHtjjD ]}|j| kr|  S qtd|  dnB|dkrtjjD ] }|j| d|  krX|  S qXtd|  dd S )Nr   zColor shortcut z not found.sizer   zSize shortcut )	r<   r2   r   ZColorallr   r!   r   Size)Zshortcutr   prefixr   r   r   r   r   expand_shortcutk  s    



z&Base.__init__.<locals>.expand_shortcut)r   r   text)r   r   spacingZradiusc                 S  s&   g | ]}t |tjr|nt|qS r   r<   r	   ZFontr-   Zfontfamr   r   r   r.     s   z!Base.__init__.<locals>.<listcomp>c                 S  s&   g | ]}t |tjr|nt|qS r   r   r   r   r   r   r.     s   z, c                 s  s   | ]}t |V  qd S r   r2   r-   r   r   r   r   rv     r/   z Base.__init__.<locals>.<genexpr>c                 s  s   | ]}t |V  qd S r   r   r   r   r   r   rv     r/   )r   N)Tr   c50Z
primary_50Zc100Zprimary_100Zc200Zprimary_200Zc300Zprimary_300Zc400Zprimary_400c500Zprimary_500Zc600Zprimary_600c700Zprimary_700Zc800Zprimary_800Zc900Zprimary_900Zc950Zprimary_950Zsecondary_50Zsecondary_100Zsecondary_200Zsecondary_300Zsecondary_400Zsecondary_500Zsecondary_600Zsecondary_700Zsecondary_800Zsecondary_900Zsecondary_950Z
neutral_50Zneutral_100Zneutral_200Zneutral_300Zneutral_400Zneutral_500Zneutral_600Zneutral_700Zneutral_800Zneutral_900Zneutral_950ZxxsZspacing_xxsxsZ
spacing_xssmZ
spacing_smZmd
spacing_mdZlgZ
spacing_lgZxlZ
spacing_xlZxxlZspacing_xxlZ
radius_xxsZ	radius_xsZ	radius_sm	radius_mdZ	radius_lgZ	radius_xlZ
radius_xxlZtext_xxsZtext_xsZtext_smtext_mdZtext_lgZtext_xlZtext_xxlr<   r   r:   Z
_font_monor5   r   r   r   Z
stylesheetappendset)r   r   r   r   r   r   r   r   r   r   Zfont_stylesheetr   r   r   r   C  s    &
zBase.__init__N)body_background_fillbody_background_fill_darkbody_text_colorbody_text_color_darkbody_text_sizebody_text_color_subduedbody_text_color_subdued_darkbody_text_weightembed_radiusbackground_fill_primarybackground_fill_primary_darkbackground_fill_secondarybackground_fill_secondary_darkborder_color_accentborder_color_accent_darkborder_color_accent_subdued border_color_accent_subdued_darkborder_color_primaryborder_color_primary_darkcolor_accentcolor_accent_softcolor_accent_soft_darklink_text_colorlink_text_color_darklink_text_color_activelink_text_color_active_darklink_text_color_hoverlink_text_color_hover_darklink_text_color_visitedlink_text_color_visited_darkprose_text_sizeprose_text_weightprose_header_text_weightshadow_dropshadow_drop_lgshadow_insetshadow_spreadshadow_spread_darkblock_background_fillblock_background_fill_darkblock_border_colorblock_border_color_darkblock_border_widthblock_border_width_darkblock_info_text_colorblock_info_text_color_darkblock_info_text_sizeblock_info_text_weightblock_label_background_fill block_label_background_fill_darkblock_label_border_colorblock_label_border_color_darkblock_label_border_widthblock_label_border_width_darkblock_label_shadowblock_label_text_colorblock_label_text_color_darkblock_label_marginblock_label_paddingblock_label_radiusblock_label_right_radiusblock_label_text_sizeblock_label_text_weightblock_paddingblock_radiusblock_shadowblock_shadow_darkblock_title_background_fill block_title_background_fill_darkblock_title_border_colorblock_title_border_color_darkblock_title_border_widthblock_title_border_width_darkblock_title_text_colorblock_title_text_color_darkblock_title_paddingblock_title_radiusblock_title_text_sizeblock_title_text_weightcontainer_radiusform_gap_width
layout_gappanel_background_fillpanel_background_fill_darkpanel_border_colorpanel_border_color_darkpanel_border_widthpanel_border_width_darksection_header_text_sizesection_header_text_weightchatbot_code_background_color"chatbot_code_background_color_darkcheckbox_background_colorcheckbox_background_color_darkcheckbox_background_color_focus$checkbox_background_color_focus_darkcheckbox_background_color_hover$checkbox_background_color_hover_dark"checkbox_background_color_selected'checkbox_background_color_selected_darkcheckbox_border_colorcheckbox_border_color_darkcheckbox_border_color_focus checkbox_border_color_focus_darkcheckbox_border_color_hover checkbox_border_color_hover_darkcheckbox_border_color_selected#checkbox_border_color_selected_darkcheckbox_border_radiuscheckbox_border_widthcheckbox_border_width_darkcheckbox_checkradio_circlecheckbox_shadowcheckbox_label_background_fill#checkbox_label_background_fill_dark$checkbox_label_background_fill_hover)checkbox_label_background_fill_hover_dark'checkbox_label_background_fill_selected,checkbox_label_background_fill_selected_darkcheckbox_label_border_color checkbox_label_border_color_dark!checkbox_label_border_color_hover&checkbox_label_border_color_hover_darkcheckbox_label_border_width checkbox_label_border_width_darkcheckbox_label_gapcheckbox_label_paddingcheckbox_label_shadowcheckbox_label_text_sizecheckbox_label_text_weightcheckbox_label_text_colorcheckbox_label_text_color_dark"checkbox_label_text_color_selected'checkbox_label_text_color_selected_darkerror_background_fillerror_background_fill_darkerror_border_colorerror_border_color_darkerror_border_widtherror_border_width_darkerror_text_colorerror_text_color_darkerror_icon_colorerror_icon_color_darkinput_background_fillinput_background_fill_darkinput_background_fill_focus input_background_fill_focus_darkinput_background_fill_hover input_background_fill_hover_darkinput_border_colorinput_border_color_darkinput_border_color_focusinput_border_color_focus_darkinput_border_color_hoverinput_border_color_hover_darkinput_border_widthinput_border_width_darkinput_paddinginput_placeholder_colorinput_placeholder_color_darkinput_radiusinput_shadowinput_shadow_darkinput_shadow_focusinput_shadow_focus_darkinput_text_sizeinput_text_weightloader_colorloader_color_darkslider_colorslider_color_darkstat_background_fillstat_background_fill_darktable_border_colortable_border_color_darktable_even_background_filltable_even_background_fill_darktable_odd_background_filltable_odd_background_fill_darktable_radiustable_row_focustable_row_focus_darkbutton_border_widthbutton_border_width_darkbutton_shadowbutton_shadow_activebutton_shadow_hoverbutton_transitionbutton_large_paddingbutton_large_radiusbutton_large_text_sizebutton_large_text_weightbutton_small_paddingbutton_small_radiusbutton_small_text_sizebutton_small_text_weightbutton_primary_background_fill#button_primary_background_fill_dark$button_primary_background_fill_hover)button_primary_background_fill_hover_darkbutton_primary_border_color button_primary_border_color_dark!button_primary_border_color_hover&button_primary_border_color_hover_darkbutton_primary_text_colorbutton_primary_text_color_darkbutton_primary_text_color_hover$button_primary_text_color_hover_dark button_secondary_background_fill%button_secondary_background_fill_dark&button_secondary_background_fill_hover+button_secondary_background_fill_hover_darkbutton_secondary_border_color"button_secondary_border_color_dark#button_secondary_border_color_hover(button_secondary_border_color_hover_darkbutton_secondary_text_color button_secondary_text_color_dark!button_secondary_text_color_hover&button_secondary_text_color_hover_darkbutton_cancel_background_fill"button_cancel_background_fill_dark#button_cancel_background_fill_hover(button_cancel_background_fill_hover_darkbutton_cancel_border_colorbutton_cancel_border_color_dark button_cancel_border_color_hover%button_cancel_border_color_hover_darkbutton_cancel_text_colorbutton_cancel_text_color_darkbutton_cancel_text_color_hover#button_cancel_text_color_hover_dark)rB   c                C  s  |pt | dd| _|p t | dd| _|p2t | dd| _|pDt | dd| _|pVt | dd	| _|pht | d
d| _|	pzt | dd| _|pt | dd| _|pt | dd| _	|pt | dd| _
|
pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|p t | dd| _|p4t | d d!| _|pHt | d"d| _|p\t | d#d$| _|ppt | d%d$| _|pt | d&d'| _|pt | d(d'| _|pt | d)d*| _|pt | d+d,| _|pt | d-d'| _|pt | d.d$| _|pt | d/d0| _|pt | d1d0| _|"p$t | d2d3| _|#p8t | d4d5| _|$pLt | d6d7| _|%p`t | d8d9| _ |&ptt | d:d;| _!|'pt | d<d| _"|(pt | d=d| _#|)pt | d>d?| _$|*pt | d@d?| _%|+pt | dAd;| _&|,pt | dBdC| _'|-p t | dDdE| _(|.pt | dFdE| _)|/p(t | dGdH| _*|0p<t | dId| _+|1pPt | dJd| _,|2pdt | dKdL| _-|3pxt | dMd?| _.|4pt | dNd?| _/|5pt | dOd;| _0|6pt | dPdC| _1|7pt | dQdR| _2|8pt | dSdT| _3|9pt | dUd!| _4|:pt | dVdW| _5|;pt | dXdY| _6|<p,t | dZd[| _7|=p@t | d\d]| _8|>pTt | d^dH| _9|?pht | d_d| _:|@p|t | d`da| _;|Apt | dbd| _<|Bpt | dcdd| _=|Cpt | dedC| _>|Dpt | dfdd| _?|Ept | dgdC| _@|Fpt | dhdd| _A|Gpt | didC| _B|Hpt | djdk| _C|Ip0t | dldC| _D|JpDt | dmdT| _E|KpXt | dnd!| _F|Lplt | dodW| _G|Mpt | dpdd| _H|Npt | dqd	| _I|Opt | drd| _J|Ppt | dsd| _K|Qpt | dtdk| _L|Rpt | dudv| _M|Spt | dwdL| _N|Tpt | dxdL| _O|Up t | dyd?| _P|Vp4t | dzd?| _Q|WpHt | d{dW| _R|Xp\t | d|dC| _S|Yppt | d}d	| _T|Zpt | d~d| _U|pt | dd| _V|pt | dd| _W|[pt | dd| _X|\pt | dd| _Y|]pt | dd| _Z|^pt | dd| _[|_pt | dd| _\|`p$t | dd| _]|ap8t | dd| _^|bpLt | dd| __|cp`t | dd$| _`|dptt | dd$| _a|ept | dd| _b|fpt | dd| _c|gpt | dd'| _d|hpt | dd'| _e|ipt | dd| _f|jpt | dd| _g|kp t | dd$| _h|lpt | dd$| _i|mp(t | dd| _j|np<t | dd| _k|opPt | dd| _l|spdt | dd| _m|tpxt | dd| _n|upt | dd| _o|vpt | dd| _p|wpt | dd| _q|xpt | dd| _r|ypt | dd?| _s|zpt | dd?| _t|{	pt | dd| _u||	pt | dd| _v|}	p,t | dd| _w|~	p@t | dd| _x|	pTt | dd| _y|	pht | dd| _z|	p|t | ddd| _{|	pt | dd	| _||	pt | dd| _}|p	pt | dd| _~|q	pt | dd| _|r	pt | dd| _|	pt | dd| _|
pt | dd| _|
pt | dd| _|
p0t | dd| _|
pHt | dtjj| _|
p\t | dd| _|
ptt | dtjj| _|
pt | dtjj| _|
pt | dd;| _|
pt | ddC| _|
pt | dtjj| _|
pt | dtjj| _|
pt | dtjj| _|pt | dtjj| _|p(t | dd| _|p<t | dd| _|pPt | dd'| _|pdt | dd$| _|pxt | dd̓| _|pt | dd̓| _|pt | dd?| _|pt | dd?| _|pt | dd҃| _|pt | dd| _|pt | ddՃ| _|pt | ddՃ| _|pt | ddk| _|p,t | ddC| _|p@t | ddڃ| _|pTt | dd0| _|pht | ddT| _|p|t | dd| _|pt | ddd| _|pt | ddC| _|pt | dd| _|pt | ddC| _|pt | dd	| _|pt | dd| _|pt | dd| _|pt | ddC| _|p0t | dd	| _| pDt | dd| _|!pXt | dd| _|plt | dd| _|pt | ddC| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|p t | dd| _|p4t | dd| _|pHt | dd| _|p\t | dd| _|ppt | dd| _|pt | dd| _|ߐpt | dd| _|pt | dd| _|pt | dd| _|pt | d d| _|pt | dd| _|pt | dd| _|pt | dd| _|p6t | dd| _|pNt | dd| _|pft | d	d| _|p~t | d
d| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|pt | dd| _|ǐp
t | dd| _|Ȑp"t | dd| _|ɐp:t | dd| _|ʐpRt | dd| _|ːpjt | dd| _|̐pt | dd| _|͐pt | dd| _|ΐpt | dd| _|ϐpt | d d| _|Аpt | d!d| _|ѐpt | d"d#| _|Ґpt | d$d#| _|Ӑp&t | d%d!| _|Ԑp<t | d&d| _|ՐpRt | d'd| _|֐pht | d(d| _|אp~t | d)d!| _|ؐpt | d*d| _|ِpt | d+d| _|ڐpt | d,d| _|ېpt | d-d| _|ܐpt | d.d| _|ݐpt | d/d| _|ސp t | d0d| _|p6t | d1dd| _|pLt | d2dd| _|pbt | d3dd| _|Ðpzt | d4d5| _|Đpt | d6d| _|Őpt | d7d	| _|Ɛpt | d8d| _|pt | d9d:| _| S (;  a(X  
        Parameters:
            body_background_fill: The background of the entire app.
            body_background_fill_dark: The background of the entire app in dark mode.
            body_text_color: The default text color.
            body_text_color_dark: The default text color in dark mode.
            body_text_size: The default text size.
            body_text_color_subdued: The text color used for softer, less important text.
            body_text_color_subdued_dark: The text color used for softer, less important text in dark mode.
            body_text_weight: The default text weight.
            embed_radius: The corner radius used for embedding when the app is embedded within a page.
            background_fill_primary: The background primarily used for items placed directly on the page.
            background_fill_primary_dark: The background primarily used for items placed directly on the page in dark mode.
            background_fill_secondary: The background primarily used for items placed on top of another item.
            background_fill_secondary_dark: The background primarily used for items placed on top of another item in dark mode.
            border_color_accent: The border color used for accented items.
            border_color_accent_dark: The border color used for accented items in dark mode.
            border_color_accent_subdued: The subdued border color for accented items.
            border_color_accent_subdued_dark: The subdued border color for accented items in dark mode.
            border_color_primary: The border color primarily used for items placed directly on the page.
            border_color_primary_dark: The border color primarily used for items placed directly on the page in dark mode.
            color_accent: The color used for accented items.
            color_accent_soft: The softer color used for accented items.
            color_accent_soft_dark: The softer color used for accented items in dark mode.
            link_text_color: The text color used for links.
            link_text_color_dark: The text color used for links in dark mode.
            link_text_color_active: The text color used for links when they are active.
            link_text_color_active_dark: The text color used for links when they are active in dark mode.
            link_text_color_hover: The text color used for links when they are hovered over.
            link_text_color_hover_dark: The text color used for links when they are hovered over in dark mode.
            link_text_color_visited: The text color used for links when they have been visited.
            link_text_color_visited_dark: The text color used for links when they have been visited in dark mode.
            prose_text_size: The text size used for markdown and other prose.
            prose_text_weight: The text weight used for markdown and other prose.
            prose_header_text_weight: The text weight of a header used for markdown and other prose.
            shadow_drop: Drop shadow used by other shadowed items.
            shadow_drop_lg: Larger drop shadow used by other shadowed items.
            shadow_inset: Inset shadow used by other shadowed items.
            shadow_spread: Size of shadow spread used by shadowed items.
            shadow_spread_dark: Size of shadow spread used by shadowed items in dark mode.
            block_background_fill: The background around an item.
            block_background_fill_dark: The background around an item in dark mode.
            block_border_color: The border color around an item.
            block_border_color_dark: The border color around an item in dark mode.
            block_border_width: The border width around an item.
            block_border_width_dark: The border width around an item in dark mode.
            block_info_text_color: The color of the info text.
            block_info_text_color_dark: The color of the info text in dark mode.
            block_info_text_size: The size of the info text.
            block_info_text_weight: The weight of the info text.
            block_label_background_fill: The background of the title label of a media element (e.g. image).
            block_label_background_fill_dark: The background of the title label of a media element (e.g. image) in dark mode.
            block_label_border_color: The border color of the title label of a media element (e.g. image).
            block_label_border_color_dark: The border color of the title label of a media element (e.g. image) in dark mode.
            block_label_border_width: The border width of the title label of a media element (e.g. image).
            block_label_border_width_dark: The border width of the title label of a media element (e.g. image) in dark mode.
            block_label_shadow: The shadow of the title label of a media element (e.g. image).
            block_label_text_color: The text color of the title label of a media element (e.g. image).
            block_label_text_color_dark: The text color of the title label of a media element (e.g. image) in dark mode.
            block_label_margin: The margin of the title label of a media element (e.g. image) from its surrounding container.
            block_label_padding: The padding of the title label of a media element (e.g. image).
            block_label_radius: The corner radius of the title label of a media element (e.g. image).
            block_label_right_radius: The corner radius of a right-aligned helper label.
            block_label_text_size: The text size of the title label of a media element (e.g. image).
            block_label_text_weight: The text weight of the title label of a media element (e.g. image).
            block_padding: The padding around an item.
            block_radius: The corner radius around an item.
            block_shadow: The shadow under an item.
            block_shadow_dark: The shadow under an item in dark mode.
            block_title_background_fill: The background of the title of a form element (e.g. textbox).
            block_title_background_fill_dark: The background of the title of a form element (e.g. textbox) in dark mode.
            block_title_border_color: The border color of the title of a form element (e.g. textbox).
            block_title_border_color_dark: The border color of the title of a form element (e.g. textbox) in dark mode.
            block_title_border_width: The border width of the title of a form element (e.g. textbox).
            block_title_border_width_dark: The border width of the title of a form element (e.g. textbox) in dark mode.
            block_title_text_color: The text color of the title of a form element (e.g. textbox).
            block_title_text_color_dark: The text color of the title of a form element (e.g. textbox) in dark mode.
            block_title_padding: The padding of the title of a form element (e.g. textbox).
            block_title_radius: The corner radius of the title of a form element (e.g. textbox).
            block_title_text_size: The text size of the title of a form element (e.g. textbox).
            block_title_text_weight: The text weight of the title of a form element (e.g. textbox).
            container_radius: The corner radius of a layout component that holds other content.
            form_gap_width: The border gap between form elements, (e.g. consecutive textboxes).
            layout_gap: The gap between items within a row or column.
            panel_background_fill: The background of a panel.
            panel_background_fill_dark: The background of a panel in dark mode.
            panel_border_color: The border color of a panel.
            panel_border_color_dark: The border color of a panel in dark mode.
            panel_border_width: The border width of a panel.
            panel_border_width_dark: The border width of a panel in dark mode.
            section_header_text_size: The text size of a section header (e.g. tab name).
            section_header_text_weight: The text weight of a section header (e.g. tab name).
            chatbot_code_background_color: The background color of code blocks in the chatbot.
            chatbot_code_background_color_dark: The background color of code blocks in the chatbot in dark mode.
            checkbox_background_color: The background of a checkbox square or radio circle.
            checkbox_background_color_dark: The background of a checkbox square or radio circle in dark mode.
            checkbox_background_color_focus: The background of a checkbox square or radio circle when focused.
            checkbox_background_color_focus_dark: The background of a checkbox square or radio circle when focused in dark mode.
            checkbox_background_color_hover: The background of a checkbox square or radio circle when hovered over.
            checkbox_background_color_hover_dark: The background of a checkbox square or radio circle when hovered over in dark mode.
            checkbox_background_color_selected: The background of a checkbox square or radio circle when selected.
            checkbox_background_color_selected_dark: The background of a checkbox square or radio circle when selected in dark mode.
            checkbox_border_color: The border color of a checkbox square or radio circle.
            checkbox_border_color_dark: The border color of a checkbox square or radio circle in dark mode.
            checkbox_border_color_focus: The border color of a checkbox square or radio circle when focused.
            checkbox_border_color_focus_dark: The border color of a checkbox square or radio circle when focused in dark mode.
            checkbox_border_color_hover: The border color of a checkbox square or radio circle when hovered over.
            checkbox_border_color_hover_dark: The border color of a checkbox square or radio circle when hovered over in dark mode.
            checkbox_border_color_selected: The border color of a checkbox square or radio circle when selected.
            checkbox_border_color_selected_dark: The border color of a checkbox square or radio circle when selected in dark mode.
            checkbox_border_radius: The corner radius of a checkbox square.
            checkbox_border_width: The border width of a checkbox square or radio circle.
            checkbox_border_width_dark: The border width of a checkbox square or radio circle in dark mode.
            checkbox_check: The checkmark visual of a checkbox square.
            radio_circle: The circle visual of a radio circle.
            checkbox_shadow: The shadow of a checkbox square or radio circle.
            checkbox_label_background_fill: The background of the surrounding button of a checkbox or radio element.
            checkbox_label_background_fill_dark: The background of the surrounding button of a checkbox or radio element in dark mode.
            checkbox_label_background_fill_hover: The background of the surrounding button of a checkbox or radio element when hovered over.
            checkbox_label_background_fill_hover_dark: The background of the surrounding button of a checkbox or radio element when hovered over in dark mode.
            checkbox_label_background_fill_selected: The background of the surrounding button of a checkbox or radio element when selected.
            checkbox_label_background_fill_selected_dark: The background of the surrounding button of a checkbox or radio element when selected in dark mode.
            checkbox_label_border_color: The border color of the surrounding button of a checkbox or radio element.
            checkbox_label_border_color_dark: The border color of the surrounding button of a checkbox or radio element in dark mode.
            checkbox_label_border_color_hover: The border color of the surrounding button of a checkbox or radio element when hovered over.
            checkbox_label_border_color_hover_dark: The border color of the surrounding button of a checkbox or radio element when hovered over in dark mode.
            checkbox_label_border_width: The border width of the surrounding button of a checkbox or radio element.
            checkbox_label_border_width_dark: The border width of the surrounding button of a checkbox or radio element in dark mode.
            checkbox_label_gap: The gap consecutive checkbox or radio elements.
            checkbox_label_padding: The padding of the surrounding button of a checkbox or radio element.
            checkbox_label_shadow: The shadow of the surrounding button of a checkbox or radio element.
            checkbox_label_text_size: The text size of the label accompanying a checkbox or radio element.
            checkbox_label_text_weight: The text weight of the label accompanying a checkbox or radio element.
            checkbox_label_text_color: The text color of the label accompanying a checkbox or radio element.
            checkbox_label_text_color_dark: The text color of the label accompanying a checkbox or radio element in dark mode.
            checkbox_label_text_color_selected: The text color of the label accompanying a checkbox or radio element when selected.
            checkbox_label_text_color_selected_dark: The text color of the label accompanying a checkbox or radio element when selected in dark mode.
            error_background_fill: The background of an error message.
            error_background_fill_dark: The background of an error message in dark mode.
            error_border_color: The border color of an error message.
            error_border_color_dark: The border color of an error message in dark mode.
            error_border_width: The border width of an error message.
            error_border_width_dark: The border width of an error message in dark mode.
            error_text_color: The text color of an error message.
            error_text_color_dark: The text color of an error message in dark mode.
            input_background_fill: The background of an input field.
            input_background_fill_dark: The background of an input field in dark mode.
            input_background_fill_focus: The background of an input field when focused.
            input_background_fill_focus_dark: The background of an input field when focused in dark mode.
            input_background_fill_hover: The background of an input field when hovered over.
            input_background_fill_hover_dark: The background of an input field when hovered over in dark mode.
            input_border_color: The border color of an input field.
            input_border_color_dark: The border color of an input field in dark mode.
            input_border_color_focus: The border color of an input field when focused.
            input_border_color_focus_dark: The border color of an input field when focused in dark mode.
            input_border_color_hover: The border color of an input field when hovered over.
            input_border_color_hover_dark: The border color of an input field when hovered over in dark mode.
            input_border_width: The border width of an input field.
            input_border_width_dark: The border width of an input field in dark mode.
            input_padding: The padding of an input field.
            input_placeholder_color: The placeholder text color of an input field.
            input_placeholder_color_dark: The placeholder text color of an input field in dark mode.
            input_radius: The corner radius of an input field.
            input_shadow: The shadow of an input field.
            input_shadow_dark: The shadow of an input field in dark mode.
            input_shadow_focus: The shadow of an input field when focused.
            input_shadow_focus_dark: The shadow of an input field when focused in dark mode.
            input_text_size: The text size of an input field.
            input_text_weight: The text weight of an input field.
            loader_color: The color of the loading animation while a request is pending.
            loader_color_dark: The color of the loading animation while a request is pending in dark mode.
            slider_color: The color of the slider in a range element.
            slider_color_dark: The color of the slider in a range element in dark mode.
            stat_background_fill: The background used for stats visuals (e.g. confidence bars in label).
            stat_background_fill_dark: The background used for stats visuals (e.g. confidence bars in label) in dark mode.
            table_border_color: The border color of a table.
            table_border_color_dark: The border color of a table in dark mode.
            table_even_background_fill: The background of even rows in a table.
            table_even_background_fill_dark: The background of even rows in a table in dark mode.
            table_odd_background_fill: The background of odd rows in a table.
            table_odd_background_fill_dark: The background of odd rows in a table in dark mode.
            table_radius: The corner radius of a table.
            table_row_focus: The background of a focused row in a table.
            table_row_focus_dark: The background of a focused row in a table in dark mode.
            button_border_width: The border width of a button.
            button_border_width_dark: The border width of a button in dark mode.
            button_cancel_background_fill: The background of a button of "cancel" variant.
            button_cancel_background_fill_dark: The background of a button of "cancel" variant in dark mode.
            button_cancel_background_fill_hover: The background of a button of "cancel" variant when hovered over.
            button_cancel_background_fill_hover_dark: The background of a button of "cancel" variant when hovered over in dark mode.
            button_cancel_border_color: The border color of a button of "cancel" variant.
            button_cancel_border_color_dark: The border color of a button of "cancel" variant in dark mode.
            button_cancel_border_color_hover: The border color of a button of "cancel" variant when hovered over.
            button_cancel_border_color_hover_dark: The border color of a button of "cancel" variant when hovered over in dark mode.
            button_cancel_text_color: The text color of a button of "cancel" variant.
            button_cancel_text_color_dark: The text color of a button of "cancel" variant in dark mode.
            button_cancel_text_color_hover: The text color of a button of "cancel" variant when hovered over.
            button_cancel_text_color_hover_dark: The text color of a button of "cancel" variant when hovered over in dark mode.
            button_large_padding: The padding of a button with the default "large" size.
            button_large_radius: The corner radius of a button with the default "large" size.
            button_large_text_size: The text size of a button with the default "large" size.
            button_large_text_weight: The text weight of a button with the default "large" size.
            button_primary_background_fill: The background of a button of "primary" variant.
            button_primary_background_fill_dark: The background of a button of "primary" variant in dark mode.
            button_primary_background_fill_hover: The background of a button of "primary" variant when hovered over.
            button_primary_background_fill_hover_dark: The background of a button of "primary" variant when hovered over in dark mode.
            button_primary_border_color: The border color of a button of "primary" variant.
            button_primary_border_color_dark: The border color of a button of "primary" variant in dark mode.
            button_primary_border_color_hover: The border color of a button of "primary" variant when hovered over.
            button_primary_border_color_hover_dark: The border color of a button of "primary" variant when hovered over in dark mode.
            button_primary_text_color: The text color of a button of "primary" variant.
            button_primary_text_color_dark: The text color of a button of "primary" variant in dark mode.
            button_primary_text_color_hover: The text color of a button of "primary" variant when hovered over.
            button_primary_text_color_hover_dark: The text color of a button of "primary" variant when hovered over in dark mode.
            button_secondary_background_fill: The background of a button of default "secondary" variant.
            button_secondary_background_fill_dark: The background of a button of default "secondary" variant in dark mode.
            button_secondary_background_fill_hover: The background of a button of default "secondary" variant when hovered over.
            button_secondary_background_fill_hover_dark: The background of a button of default "secondary" variant when hovered over in dark mode.
            button_secondary_border_color: The border color of a button of default "secondary" variant.
            button_secondary_border_color_dark: The border color of a button of default "secondary" variant in dark mode.
            button_secondary_border_color_hover: The border color of a button of default "secondary" variant when hovered over.
            button_secondary_border_color_hover_dark: The border color of a button of default "secondary" variant when hovered over in dark mode.
            button_secondary_text_color: The text color of a button of default "secondary" variant.
            button_secondary_text_color_dark: The text color of a button of default "secondary" variant in dark mode.
            button_secondary_text_color_hover: The text color of a button of default "secondary" variant when hovered over.
            button_secondary_text_color_hover_dark: The text color of a button of default "secondary" variant when hovered over in dark mode.
            button_shadow: The shadow under a button.
            button_shadow_active: The shadow under a button when pressed.
            button_shadow_hover: The shadow under a button when hovered over.
            button_small_padding: The padding of a button set to "small" size.
            button_small_radius: The corner radius of a button set to "small" size.
            button_small_text_size: The text size of a button set to "small" size.
            button_small_text_weight: The text weight of a button set to "small" size.
            button_transition: The transition animation duration of a button between regular, hover, and focused states.
        r   z*background_fill_primaryr   r   z*neutral_800r   z*neutral_100r   z*text_mdr   Z400r   z
*radius_lgr   z*primary_500r   z*primary_50r   z*neutral_700Zbackground_primaryZwhiteZbackground_primary_darkz*neutral_950Zbackground_secondaryz*neutral_50Zbackground_secondary_darkz*neutral_900r   z*primary_300r   z*neutral_600r   z*neutral_200r   r   z*secondary_600r   r   z*secondary_500r   r   z*secondary_700r   z*secondary_400r   r   r   z*neutral_400r   r   z rgba(0,0,0,0.05) 0px 1px 2px 0pxr   z=0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)r   z&rgba(0,0,0,0.05) 0px 2px 4px 0px insetr   Z3pxr   Z1pxr   r   r   z*border_color_primaryr   r   r   Nr   z*body_text_color_subduedr   r   z*text_smr   r   r   z*background_fill_secondaryr   r   r   r   r   z*block_shadowr   z*neutral_500r   r   0r   z*spacing_sm *spacing_lgr   z1calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px) 0r   z10 calc(*radius_lg - 1px) 0 calc(*radius_lg - 1px)r   r   r   z#*spacing_xl calc(*spacing_xl + 2px)r   r   noner   r   r   r   r   r   Z0pxr  r  r  r  r  r  r  r  r	  r
  z*spacing_xxlr  r  r  r  r  r  r  r  r   z*border_color_accentr   r  r  r  r  r  z*checkbox_background_colorr  r  r  r  r  r  z*neutral_300r  r  r   r!  r"  r#  r$  r%  z
*radius_smr&  z*input_border_widthr'  r+  z!*button_secondary_background_fillr,  r-  z'*button_secondary_background_fill_hoverr.  r/  z*checkbox_label_background_fillr0  r1  r2  r3  z*checkbox_label_border_colorr4  r5  r6  r7  z*spacing_lgr8  z!*spacing_md calc(2 * *spacing_md)r9  r:  r;  r(  zurl("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")r)  zurl("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")r*  z*input_shadowr<  z*body_text_colorr=  r>  z*checkbox_label_text_colorr?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  z*input_background_fillrO  rP  rQ  rR  z*secondary_300rS  rT  z*input_border_colorrU  rV  rW  rX  z*spacing_xlrY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  z*color_accentrc  r   r   r   Z600rd  autore  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  z*color_accent_softrp  rq  rr  r  r  r  z*button_cancel_background_fillr  r  z*button_secondary_border_colorr  r  z*button_cancel_border_colorr  r  z*button_secondary_text_colorr  r  z*button_cancel_text_colorr  rw  z!*spacing_lg calc(2 * *spacing_lg)rx  ry  z*text_lgrz  r  z*primary_200r  z*primary_700r  z*button_primary_background_fillr  r  r  z*primary_600r  z*button_primary_border_colorr  r  r  r  z*button_primary_text_colorr  r  r  r  r  r  r  r  r  r  r  r  r  rs  rt  ru  r{  z!*spacing_sm calc(2 * *spacing_sm)r|  r}  r~  rv  zbackground-color 0.2s ease)r=   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r;  r(  r)  r*  r<  r=  r>  r?  r   Zredr   r@  rA  r   rB  r   rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  rc  r   r   r   rd  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  rp  rq  rr  r  r  r  r  r  r  r  r  r  r  r  r  rw  rx  ry  rz  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rs  rt  ru  r{  r|  r}  r~  rv  )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r!  r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  ro  rp  rq  rr  rs  rt  ru  rv  rw  rx  ry  rz  r{  r|  r}  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r     sh      e


		



					









		
		






	
	

				

zBase.set)r   r   r   r   ZblueZgrayr   r   r   r   r	   Z
GoogleFontr   r   r   r   r   r   rK   A  s  	   rK   )
__future__r   rF   r3   r   r   pathlibr   typingr   rc   rf   Zsemantic_versionrs   Zgradio_client.documentationr   r   r   Zgradio.themes.utilsr   r	   r
   r   r   Z"gradio.themes.utils.readme_contentr   r   rK   r   r   r   r   <module>   s&     '