
    ge{                        d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZmZmZ dd	lmZ  G d
 deee	          Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      ZdS )z;String class.

Represents a unicode string using a widget.
   )DescriptionWidget)ValueWidget)CallbackDispatcherregister)
CoreWidget)
TypedTuple    )UnicodeBoolInt)warnc                        e Zd ZdZ ed                              d          Z edd                              d          Zd fd		Z ed
                              d          Z	 xZ
S )_Stringz:Base class used to create widgets that represent a string.zString valuehelpTsyncu   ​z7Placeholder text to display when nothing has been typedNc                 V    |||d<    t          t          |           j        di | d S )Nvalue )superr   __init__)selfr   kwargs	__class__s      @lib/python3.11/site-packages/ipywidgets/widgets/widget_string.pyr   z_String.__init__   s;    #F7O%gt%///////    StringModelN)__name__
__module____qualname____doc__r
   tagr   placeholderr   _model_name__classcell__r   s   @r   r   r      s        DDG(((,,$,77E
 ')*cdddhhnrhssK0 0 0 0 0 0
 '-((,,$,77KKKKKr   r   c                       e Zd ZdZ ed                              d          Z ed                              d          ZdS )HTMLz#Renders the string `value` as HTML.HTMLViewTr   	HTMLModelNr    r!   r"   r#   r
   r$   
_view_namer&   r   r   r   r*   r*   %   sT        --$$((d(33J'+&&***55KKKr   r*   c                       e Zd ZdZ ed                              d          Z ed                              d          ZdS )HTMLMathz;Renders the string `value` as HTML, and render mathematics.HTMLMathViewTr   HTMLMathModelNr-   r   r   r   r0   r0   +   sT        EE((,,$,77J'/**..D.99KKKr   r0   c                       e Zd ZdZ ed                              d          Z ed                              d          ZdS )LabelzLabel widget.

    It also renders math inside the string `value` as Latex (requires $ $ or
    $$ $$ and similar latex tags).
    	LabelViewTr   
LabelModelNr-   r   r   r   r4   r4   2   sZ         
 %%))t)44J',''+++66KKKr   r4   c                   V   e Zd ZdZ ed                              d          Z ed                              d          Z eddd                              d          Z	 e
d	d
                              d          Z e
dd                              d          ZdS )TextareazMultiline text area widget.TextareaViewTr   TextareaModelNzThe number of rows to display.)
allow_noner   FEnable or disable user changesr   lUpdate the value as the user types. If False, update on submission, e.g., pressing Enter or navigating away.)r    r!   r"   r#   r
   r$   r.   r&   r   rowsr   disabledcontinuous_updater   r   r   r8   r8   =   s        %%((,,$,77J'/**..D.99K3t+KLLLPPVZP[[DtE @AAAEE4EPPHT  )W  X  X  X  \  \  bf  \  g  gr   r8   c                   0    e Zd ZdZ ed                              d          Z ed                              d          Z edd                              d          Z	 edd	                              d          Z
 fd
Zd ZddZ xZS )TextSingle line textbox widget.TextViewTr   	TextModelFr<   r   r=   c                      t          t          |           j        |i | t                      | _        |                     | j                   d S r   )r   rB   r   r   _submission_callbackson_msg_handle_string_msg)r   argsr   r   s      r   r   zText.__init__N   sN    "dD"D3F333%7%9%9"D+,,,,,r   c                 h    |                     dd          dk    r|                     |            dS dS )zHandle a msg from the front-end.

        Parameters
        ----------
        content: dict
            Content of the msg.
        event submitN)getrG   )r   _contentbufferss       r   rI   zText._handle_string_msgS   s?     ;;w##x//&&t,,,,, 0/r   c                 |    ddl }|                    dt                     | j                            ||           dS )aE  (Un)Register a callback to handle text submission.

        Triggered when the user clicks enter.

        Parameters
        ----------
        callback: callable
            Will be called with exactly one argument: the Widget instance
        remove: bool (optional)
            Whether to unregister the callback
        r	   Nzon_submit is deprecated. Instead, set the .continuous_update attribute to False and observe the value changing with: mywidget.observe(callback, 'value').)remove)warningsr   DeprecationWarningrG   register_callback)r   callbackrT   rU   s       r   	on_submitzText.on_submit^   sU     	  r  tF  	G  	G  	G"44Xf4MMMMMr   )F)r    r!   r"   r#   r
   r$   r.   r&   r   r?   r@   r   rI   rY   r'   r(   s   @r   rB   rB   F   s       %%$$((d(33J'+&&***55KtE @AAAEE4EPPHT  )W  X  X  X  \  \  bf  \  g  g- - - - -
	- 	- 	-N N N N N N N Nr   rB   c                        e Zd ZdZ ed                              d          Z ed                              d          Z edd                              d          Z	 fd	Z
 xZS )
PasswordrC   PasswordViewTr   PasswordModelFr<   r   c              #   x   K   t          t          |                                           }|D ]}|dk    r|V  d S )Nr   )r   r[   
_repr_keys)r   
super_keyskeyr   s      r   r_   zPassword._repr_keysv   sN      8T**5577
 	 	Cg~~				 	r   )r    r!   r"   r#   r
   r$   r.   r&   r   r?   r_   r'   r(   s   @r   r[   r[   o   s        %%((,,$,77J'/**..D.99KtE @AAAEE4EPPH        r   r[   c                   "   e Zd ZdZ ed                              d          Z ed                              d          Z e e            d                              d          Z	 e
dd	
                              d          ZdS )ComboboxzCSingle line textbox widget with a dropdown and autocompletion.
    ComboboxModelTr   ComboboxViewz!Dropdown options for the combobox)traitr   FzDIf set, ensure value is in options. Implies continuous_update=False.r   N)r    r!   r"   r#   r
   r$   r&   r.   r   optionsr   ensure_optionr   r   r   rc   rc   ~   s         '/**..D.99K((,,$,77Jjgii0   
ctcnn 
 DS   
ctcnn MMr   rc   N)r#   widget_descriptionr   valuewidgetr   widgetr   r   widget_corer   trait_typesr   	traitletsr
   r   r   rU   r   r   r*   r0   r4   r8   rB   r[   rc   r   r   r   <module>ro      se   
 2 1 1 1 1 1 $ $ $ $ $ $ 0 0 0 0 0 0 0 0 # # # # # # # # # # # # ( ( ( ( ( ( ( ( ( (      8 8 8 8 8j 8 8 8& 
6 6 6 6 67 6 6 
6
 
: : : : :w : : 
: 
7 7 7 7 7G 7 7 
7 
g g g g gw g g 
g 
%N %N %N %N %N7 %N %N 
%NP 
    t   
 
    t   
  r   