
    +h>                     d   d dl Z d dlmZ d dlmZ dZd Zd Z G d d      Z G d	 d
      Z G d d      Z	 G d de	      Z
 G d de	      Z G d de	      Z G d de	      Z G d de	      Z G d de	      Z G d de	      Z G d d      Z G d d      Z G d d       Z G d! d"e	      Z G d# d$e	      Z G d% d&e	      Z G d' d(e	      Z G d) d*e	      Z G d+ d,e	      Z G d- d.e	      Z G d/ d0e	      Z G d1 d2e	      Z G d3 d4e	      Z G d5 d6e	      Z G d7 d8e	      Z G d9 d:e	      Z y);    N)escape)Markup)CheckboxInput
ColorInput	DateInputDateTimeInputDateTimeLocalInput
EmailInput	FileInputHiddenInput
ListWidget
MonthInputNumberInputOptionPasswordInput
RadioInput
RangeInputSearchInputSelectSubmitInputTableWidgetTextArea	TextInputTelInput	TimeInputURLInput	WeekInputc                     | j                  d      } | j                  d      s| j                  d      r| j                  dd      } | S )N_data_aria_-)rstrip
startswithreplace)keys    G/var/www/html/venv/lib/python3.12/site-packages/wtforms/widgets/core.py	clean_keyr(   #   s;    
**S/C
~~g#.."9kk#s#J    c                     g }t        | j                               D ]T  \  }}t        |      }|du r|j                  |       '|du r,|j                  t	        |       dt        |       d       V dj                  |      S )a  
    Generate HTML attribute syntax from inputted keyword arguments.

    The output value is sorted by the passed keys, to provide consistent output
    each time this function is called with the same parameters. Because of the
    frequent use of the normally reserved keywords `class` and `for`, suffixing
    these with an underscore will allow them to be used.

    In order to facilitate the use of ``data-`` and ``aria-`` attributes, if the
    name of the attribute begins with ``data_`` or ``aria_``, then every
    underscore will be replaced with a hyphen in the generated attribute.

    >>> html_params(data_attr='user.name', aria_labeledby='name')
    'data-attr="user.name" aria-labeledby="name"'

    In addition, the values ``True`` and ``False`` are special:
      * ``attr=True`` generates the HTML compact output of a boolean attribute,
        e.g. ``checked=True`` will generate simply ``checked``
      * ``attr=False`` will be ignored and generate no output.

    >>> html_params(name='text1', id='f', class_='text')
    'class="text" id="f" name="text1"'
    >>> html_params(checked=True, readonly=False, name="text1", abc="hello")
    'abc="hello" checked name="text1"'

    .. versionchanged:: 3.0
        ``aria_`` args convert underscores to hyphens like ``data_``
        args.

    .. versionchanged:: 2.2
        ``data_`` args convert all underscores to hyphens, instead of
        only the first one.
    TFz="" )sorteditemsr(   appendstrr   join)kwargsparamskvs       r'   html_paramsr6   *   s    D Fv||~& 51aL9MM!%ZMMSVHBvayk345 88Fr)   c                       e Zd ZdZddZd Zy)r   a  
    Renders a list of fields as a `ul` or `ol` list.

    This is used for fields which encapsulate many inner fields as subfields.
    The widget will try to iterate the field to get access to the subfields and
    call them to render them.

    If `prefix_label` is set, the subfield's label is printed before the field,
    otherwise afterwards. The latter is useful for iterating radios or
    checkboxes.
    c                 ,    |dv sJ || _         || _        y )N)olul)html_tagprefix_label)selfr;   r<   s      r'   __init__zListWidget.__init__e   s    <''' (r)   c                    |j                  d|j                         d| j                   dt        d	i | dg}|D ]]  }| j                  r(|j                  d|j                   d |        d       7|j                  d |        d|j                   d       _ |j                  d| j                  z         t        dj                  |            S )
Nid<r,   >z<li>z</li>z</%s>  )	
setdefaultr@   r;   r6   r<   r/   labelr   r1   )r=   fieldr2   htmlsubfields        r'   __call__zListWidget.__call__j   s    $)DMM?!K$9&$9#:!<= 	GH  d8>>"2!HJ<uEFd8:,a/?uEF		G
 	Gdmm+,bggdm$$r)   N)r:   T__name__
__module____qualname____doc__r>   rJ   rD   r)   r'   r   r   X   s    
)
	%r)   r   c                       e Zd ZdZddZd Zy)r   a  
    Renders a list of fields as a set of table rows with th/td pairs.

    If `with_table_tag` is True, then an enclosing <table> is placed around the
    rows.

    Hidden fields will not be displayed with a row, instead the field will be
    pushed into a subsequent table row to ensure XHTML validity. Hidden fields
    at the end of the field list will appear outside the table.
    c                     || _         y N)with_table_tag)r=   rS   s     r'   r>   zTableWidget.__init__   s
    ,r)   c           
         g }| j                   r9|j                  d|j                         |j                  dt	        d	i |z         d}|D ]W  }|j
                  dv r|t        |      z  } |j                  dt        |j                        d|t        |      d       d}Y | j                   r|j                  d       |r|j                  |       t        dj                  |            S )
Nr@   z
<table %s>rC   )HiddenFieldCSRFTokenFieldz<tr><th>z	</th><td>z
</td></tr>z</table>rD   )
rS   rE   r@   r/   r6   typer0   rF   r   r1   )r=   rG   r2   rH   hiddenrI   s         r'   rJ   zTableWidget.__call__   s    dEHH-KK{'<V'<<= 	H}} AA#h-'8>>*FCMC 	 KK
#KKbggdm$$r)   NTrK   rD   r)   r'   r   r   v   s    	-%r)   r   c                   6    e Zd ZdZ ee      ZddgZddZd Zy)Inputz
    Render a basic ``<input>`` field.

    This is used as the basis for most of the other input fields.

    By default, the `_value()` method will be called upon the associated field
    to provide the ``value=`` HTML attribute.
    requireddisabledNc                     ||| _         y y rR   )
input_type)r=   r_   s     r'   r>   zInput.__init__   s    !(DO "r)   c                 t   |j                  d|j                         |j                  d| j                         d|vr|j                         |d<   t	        |di       }t        |      D ]%  }|| j                  v s||vst	        ||      ||<   ' t        d | j                  dd|j                  i|z        S )Nr@   rW   valueflagsz
<input %s>namerD   )
rE   r@   r_   _valuegetattrdirvalidation_attrsr   r6   rc   r=   rG   r2   rb   r4   s        r'   rJ   zInput.__call__   s    $)&$//2& #llnF7Ow+U 	.AD)))avo#E1-q		. l%5T%5%5%P5::%P%PPQQr)   rR   )	rL   rM   rN   rO   staticmethodr6   rg   r>   rJ   rD   r)   r'   r[   r[      s)     {+K"J/)	Rr)   r[   c                       e Zd ZdZdZg dZy)r   z*
    Render a single-line text input.
    textr\   r]   readonly	maxlength	minlengthpatternNrL   rM   rN   rO   r_   rg   rD   r)   r'   r   r      s     Jr)   r   c                   6     e Zd ZdZdZg dZddZ fdZ xZS )r   z
    Render a password input.

    For security purposes, this field will not reproduce the value on a form
    submit by default. To have the value filled in, set `hide_value` to
    `False`.
    passwordrl   c                     || _         y rR   )
hide_value)r=   ru   s     r'   r>   zPasswordInput.__init__   s	    $r)   c                 F    | j                   rd|d<   t        |   |fi |S )NrC   ra   )ru   superrJ   r=   rG   r2   	__class__s      r'   rJ   zPasswordInput.__call__   s(    ?? F7Ow000r)   rY   	rL   rM   rN   rO   r_   rg   r>   rJ   __classcell__ry   s   @r'   r   r      s&     J%1 1r)   r   c                   &     e Zd ZdZdZ fdZ xZS )r   z 
    Render a hidden input.
    rX   c                 6    t        |   |i | ddi| _        y )NrX   T)rw   r>   field_flags)r=   argsr2   ry   s      r'   r>   zHiddenInput.__init__   s"    $)&)$d+r)   )rL   rM   rN   rO   r_   r>   r{   r|   s   @r'   r   r      s     J, ,r)   r   c                   &     e Zd ZdZdZ fdZ xZS )r   zq
    Render a checkbox.

    The ``checked`` HTML attribute is set if the field's data is a non-false value.
    checkboxc                 \    t        |d|j                        rd|d<   t        |   |fi |S )NcheckedT)re   datarw   rJ   rx   s      r'   rJ   zCheckboxInput.__call__   s2    5)UZZ0 $F9w000r)   rL   rM   rN   rO   r_   rJ   r{   r|   s   @r'   r   r      s     J1 1r)   r   c                   &     e Zd ZdZdZ fdZ xZS )r   z
    Render a single radio button.

    This widget is most commonly used in conjunction with ListWidget or some
    other listing, as singular radio buttons are not very useful.
    radioc                 F    |j                   rd|d<   t        |   |fi |S )NTr   )r   rw   rJ   rx   s      r'   rJ   zRadioInput.__call__	  s)    == $F9w000r)   r   r|   s   @r'   r   r      s     J1 1r)   r   c                   :     e Zd ZdZdZg dZd fd	Z fdZ xZS )r   zURender a file chooser input.

    :param multiple: allow choosing multiple files
    file)r\   r]   acceptc                 0    t         |           || _        y rR   )rw   r>   multiple)r=   r   ry   s     r'   r>   zFileInput.__init__  s     r)   c                 P    d|d<   | j                   rd|d<   t        |   |fi |S )NFra   Tr   )r   rw   rJ   rx   s      r'   rJ   zFileInput.__call__  s2    w==!%F:w000r)   Frz   r|   s   @r'   r   r     s$    
 J9!1 1r)   r   c                   &     e Zd ZdZdZ fdZ xZS )r   z
    Renders a submit button.

    The field's label is used as the text of the submit button instead of the
    data on the field.
    submitc                 p    |j                  d|j                  j                         t        |   |fi |S )Nra   )rE   rF   rk   rw   rJ   rx   s      r'   rJ   zSubmitInput.__call__0  s2    '5;;#3#34w000r)   r   r|   s   @r'   r   r   &  s     J1 1r)   r   c                       e Zd ZdZg dZd Zy)r   zs
    Renders a multi-line text area.

    `rows` and `cols` ought to be passed as keyword args when rendering.
    )r\   r]   rm   rn   ro   c           	      6   |j                  d|j                         t        |di       }t        |      D ]%  }|| j                  v s||vst        ||      ||<   ' t        dt        dd|j                  i|dt        |j                               d      S )Nr@   rb   z
<textarea rc   z>
z</textarea>rD   )
rE   r@   re   rf   rg   r   r6   rc   r   rd   rh   s        r'   rJ   zTextArea.__call__>  s    $)w+U 	.AD)))avo#E1-q		. 5

5f5velln7MO
 	
r)   N)rL   rM   rN   rO   rg   rJ   rD   r)   r'   r   r   5  s     V	
r)   r   c                   6    e Zd ZdZddgZddZd Zed        Zy)	r   a  
    Renders a select field.

    If `multiple` is True, then the `size` property should be specified on
    rendering to make the field useful.

    The field must provide an `iter_choices()` method which the widget will
    call on rendering; this method must yield tuples of
    `(value, label, selected)` or `(value, label, selected, render_kw)`.
    It also must provide a `has_groups()` method which tells whether choices
    are divided into groups, and if they do, the field must have an
    `iter_groups()` method that yields tuples of `(label, choices)`, where
    `choices` is a iterable of `(value, label, selected)` tuples.
    r\   r]   c                     || _         y rR   )r   )r=   r   s     r'   r>   zSelect.__init__\  s	     r)   c           	         |j                  d|j                         | j                  rd|d<   t        |di       }t	        |      D ]%  }|| j
                  v s||vst        ||      ||<   ' dt        dd|j                  i|z  g}|j                         r|j                         D ]  \  }}|j                  dt        |      z         |D ]`  }t        |      d	k(  r|\  }	}
}}n$t        j                  d
t        d       |\  }	}
}i }|j                   | j                  |	|
|fi |       b |j                  d        ns|j!                         D ]`  }t        |      d	k(  r|\  }	}
}}n$t        j                  d
t        d       |\  }	}
}i }|j                   | j                  |	|
|fi |       b |j                  d       t#        dj%                  |            S )Nr@   Tr   rb   z<select %s>rc   z<optgroup %s>)rF      zj'iter_groups' is expected to return 4 items tuple since wtforms 3.1, this will be mandatory in wtforms 3.2   )
stacklevelz</optgroup>z	</select>rC   rD   )rE   r@   r   re   rf   rg   r6   rc   
has_groupsiter_groupsr/   lenwarningswarnDeprecationWarningrender_optioniter_choicesr   r1   )r=   rG   r2   rb   r4   rH   groupchoiceschoicevalrF   selected	render_kws                r'   rJ   zSelect.__call___  s   $)==!%F:w+U 	.AD)))avo#E1-q		.  F Fv FFG"'"3"3"5 +wOk.FFG% WF6{a':@7UHi Q.'(	 06,UH$&	KK 2 2 23x U9 UVW M*+"  ,,. Sv;!#6<3C)MMM*#$	 ,2(C "I.D..sE8QyQRS 	K bggdm$$r)   c                     |du rt        |      }t        ||      }|rd|d<   t        dt        di | dt	        |       d      S )NT)ra   r   z<option rB   z	</option>rD   )r0   dictr   r6   r   )clsra   rF   r   r2   optionss         r'   r   zSelect.render_option  sR    D=JEvU+"&GJ!7w!7 8&-	RSSr)   Nr   )	rL   rM   rN   rO   rg   r>   rJ   classmethodr   rD   r)   r'   r   r   J  s5     #J/!)%V T Tr)   r   c                       e Zd ZdZd Zy)r   z
    Renders the individual option from a select field.

    This is just a convenience for various custom rendering situations, and an
    option by itself does not constitute an entire field.
    c                     t        j                  |j                         |j                  j                  |j
                  fi |S rR   )r   r   rd   rF   rk   r   )r=   rG   r2   s      r'   rJ   zOption.__call__  s8    ##LLNEKK,,emm
?E
 	
r)   N)rL   rM   rN   rO   rJ   rD   r)   r'   r   r     s    
r)   r   c                       e Zd ZdZdZg dZy)r   z.
    Renders an input with type "search".
    searchrl   Nrq   rD   r)   r'   r   r     s     Jr)   r   c                       e Zd ZdZdZg dZy)r   z+
    Renders an input with type "tel".
    telrl   Nrq   rD   r)   r'   r   r          Jr)   r   c                       e Zd ZdZdZg dZy)r   z+
    Renders an input with type "url".
    urlrl   Nrq   rD   r)   r'   r   r     r   r)   r   c                       e Zd ZdZdZg dZy)r
   z-
    Renders an input with type "email".
    emailrl   Nrq   rD   r)   r'   r
   r
     s     Jr)   r
   c                       e Zd ZdZdZg dZy)r   z0
    Renders an input with type "datetime".
    datetimer\   r]   rm   maxminstepNrq   rD   r)   r'   r   r     s     JQr)   r   c                       e Zd ZdZdZg dZy)r   z,
    Renders an input with type "date".
    dater   Nrq   rD   r)   r'   r   r          JQr)   r   c                       e Zd ZdZdZg dZy)r   z-
    Renders an input with type "month".
    monthr   Nrq   rD   r)   r'   r   r     s     JQr)   r   c                       e Zd ZdZdZg dZy)r   z,
    Renders an input with type "week".
    weekr   Nrq   rD   r)   r'   r   r     r   r)   r   c                       e Zd ZdZdZg dZy)r   z,
    Renders an input with type "time".
    timer   Nrq   rD   r)   r'   r   r     r   r)   r   c                       e Zd ZdZdZg dZy)r	   z6
    Renders an input with type "datetime-local".
    zdatetime-localr   Nrq   rD   r)   r'   r	   r	     s     "JQr)   r	   c                   6     e Zd ZdZdZg dZddZ fdZ xZS )r   z.
    Renders an input with type "number".
    numberr   c                 .    || _         || _        || _        y rR   )r   r   r   )r=   r   r   r   s       r'   r>   zNumberInput.__init__"  s    	r)   c                    | j                   |j                  d| j                          | j                  |j                  d| j                         | j                  |j                  d| j                         t	        |   |fi |S )Nr   r   r   )r   rE   r   r   rw   rJ   rx   s      r'   rJ   zNumberInput.__call__'  sr    99 fdii088eTXX.88eTXX.w000r)   )NNNrz   r|   s   @r'   r   r     s$     JQ
1 1r)   r   c                   6     e Zd ZdZdZg dZddZ fdZ xZS )r   z-
    Renders an input with type "range".
    range)r\   r]   r   r   r   c                     || _         y rR   )r   )r=   r   s     r'   r>   zRangeInput.__init__9  s	    	r)   c                 t    | j                   |j                  d| j                          t        |   |fi |S )Nr   )r   rE   rw   rJ   rx   s      r'   rJ   zRangeInput.__call__<  s6    99 fdii0w000r)   rR   rz   r|   s   @r'   r   r   1  s$     JE1 1r)   r   c                       e Zd ZdZdZy)r   z-
    Renders an input with type "color".
    colorN)rL   rM   rN   rO   r_   rD   r)   r'   r   r   B  s     Jr)   r   )!r   
markupsafer   r   __all__r(   r6   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   rD   r)   r'   <module>r      s`     :+\% %<"% "%JR R:  1E 18	,% 	,1E 11 1 1 1.1% 1
 
*IT ITX
 
%  u  u    RE RR RR RR RR RR R1% 1.1 1" r)   