
    ;3h/                        d 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 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  e        G d de             Zy)zgr.Button() component.    )annotations)CallableSequence)Path)TYPE_CHECKINGAnyLiteral)document)	Component)Events)I18nData)Timerc                       e Zd ZdZej
                  gZ	 ddddddddddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d fdZed	        Z	dd
Z
ddZddZddZ xZS )Buttonz
    Creates a button that can be assigned arbitrary .click() events. The value (label) of the button can be used as an input to the function (rarely used) or set via the output of a function.
    N	secondarylgTvalue)everyinputsvariantsizeiconlinkvisibleinteractiveelem_idelem_classesrenderkeypreserved_by_keyscale	min_widthc                   t         |   ||||
||||||	||       | j                  |      | _        || _        || _        || _        y)aG  
        Parameters:
            value: default text for the button to display. If a function is provided, the function will be called each time the app loads to set the initial value of this component.
            every: continuously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
            inputs: components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change.
            variant: sets the background and text color of the button. Use 'primary' for main call-to-action buttons, 'secondary' for a more subdued style, 'stop' for a stop button, 'huggingface' for a black background with white text, consistent with Hugging Face's button styles.
            size: size of the button. Can be "sm", "md", or "lg".
            icon: URL or path to the icon file to display within the button. If None, no icon will be displayed.
            link: URL to open when the button is clicked. If None, no link will be used.
            visible: if False, component will be hidden.
            interactive: if False, the Button will be in a disabled state.
            elem_id: an optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
            elem_classes: an optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
            render: if False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
            key: in a gr.render, Components with the same key across re-renders are treated as the same component, not a new component. Properties set in 'preserved_by_key' are not reset across a re-render.
            preserved_by_key: A list of parameters from this component's constructor. Inside a gr.render() function, if a component is re-rendered with the same key, these (and only these) parameters will be preserved in the UI (if they have been changed by the user or an event listener) instead of re-rendered based on the values provided during constructor.
            scale: relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
            min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
        )r   r   r   r   r   r   r   r    r   r   r!   r"   N)super__init__serve_static_filer   r   r   r   )selfr   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   	__class__s                    X/var/www/html/audio-gradio/venv/lib/python3.12/site-packages/gradio/components/button.pyr%   zButton.__init__   se    N 	%-# 	 	
 **40			    c                     y)NT r'   s    r)   skip_apizButton.skip_apiU   s    r*   c                    |S )z
        Parameters:
            payload: string corresponding to the button label
        Returns:
            (Rarely used) the `str` corresponding to the button label when the button is clicked
        r,   )r'   payloads     r)   
preprocesszButton.preprocessY   s	     r*   c                    t        |      S )z
        Parameters:
            value: string corresponding to the button label
        Returns:
            Expects a `str` value that is set as the button label
        )str)r'   r   s     r)   postprocesszButton.postprocessb   s     5zr*   c                     yNRunr,   r-   s    r)   example_payloadzButton.example_payloadk       r*   c                     yr6   r,   r-   s    r)   example_valuezButton.example_valuen   r9   r*   )r7   ) r   zstr | I18nData | Callabler   zTimer | float | Noner   z7Component | Sequence[Component] | set[Component] | Noner   z6Literal['primary', 'secondary', 'stop', 'huggingface']r   zLiteral['sm', 'md', 'lg']r   zstr | Path | Noner   
str | Noner   boolr   r=   r   r<   r   list[str] | str | Noner   r=   r   z(int | str | tuple[int | str, ...] | Noner    r>   r!   
int | Noner"   r?   )r0   r<   returnr<   )r   r<   r@   r<   )r@   r   )__name__
__module____qualname____doc__r   clickEVENTSr%   propertyr.   r1   r4   r8   r;   __classcell__)r(   s   @r)   r   r      s    ll^F ,18 '+JNJU*."& "/38<3:  $%8(8 $	8
 H8 H8 (8  8 8 8 8 8 -8 8 68  1!8" #8$ %8t  r*   r   N)rD   
__future__r   collections.abcr   r   pathlibr   typingr   r   r	   gradio_client.documentationr
   gradio.components.baser   gradio.eventsr   gradio.i18nr   gradio.componentsr   r   r,   r*   r)   <module>rR      sI     " .  . . 0 ,    ' 
[Y [ [r*   