
    ,ji,-              !           S SK r S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJ	r	  S S
K
Jr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SK J!r!  S SK"J#r#  SS \\SSSSSSSS4S\$S\\	\$\\\$\4   4      S\\$   S\\\$   /\	\%\$4   4   S \$S!\\$   S"\\   S#\\	\$\\\$\4   4      S$\%S%\%S&\%S'\	\$\%S4   S(\\$   S)\%S*\S+\!4 S, jjr&g)-    N)Any)Callable)Dict)List)Optional)Sequence)Tuple)Union)Application)FormattedText)KeyBindings)Keys)Style)utils)DEFAULT_QUESTION_PREFIX)DEFAULT_SELECTED_POINTER)INVALID_INPUT)common)Choice)InquirerControl)	Separator)Question)merge_styles_defaultc                     g)NT )as    V/home/james-whalen/.local/lib/python3.13/site-packages/questionary/prompts/checkbox.py<lambda>r   !   s    $    TFmessagechoicesdefaultvalidateqmarkpointerstyleinitial_choiceuse_arrow_keysuse_jk_keysuse_emacs_keysuse_search_filterinstructionshow_descriptionkwargsreturnc           
      0  ^ ^^^^^^^ U(       d  U	(       d  U
(       d  [        S5      eU	(       a  T(       a  [        S5      e[        [        S/5      U/5      n[        T5      (       d  [        S5      e[	        UUUUUS9mS[
        [        [        [        4      4UUU UU4S jjnS[
        [           4U4S jjmS	[
        [           S[        4UU4S
 jjm[        R                  " TU40 UD6n[        5       nUR                  [        R                  SS9UR                  [        R                   SS9S 5       5       nUR                  SSS9UUU4S j5       nUR                  T(       a  [        R"                  OSSS9UUU4S j5       nUR                  T(       a  [        R$                  OSSS9UUU4S j5       nU4S jnU4S jnT(       am  U4S jn[&        R(                   H/  nU[&        R*                  ;   a  M  UR                  USS9" U5        M1     UR                  [        R,                  SS9" U5        U(       aH  UR                  [        R.                  SS9" U5        UR                  [        R0                  SS9" U5        U	(       a,  UR                  SSS9" U5        UR                  SSS9" U5        U
(       aH  UR                  [        R2                  SS9" U5        UR                  [        R4                  SS9" U5        UR                  [        R6                  SS9UUU4S j5       nUR                  [        R                  5      S 5       n[9        [;        SUUUS.[<        R>                  " U[:        R@                  5      D65      $ )u  Ask the user to select from a list of items.

This is a multiselect, the user can choose one, none or many of the
items.

Example:
    >>> import questionary
    >>> questionary.checkbox(
    ...    'Select toppings',
    ...    choices=[
    ...        "Cheese",
    ...        "Tomato",
    ...        "Pineapple",
    ...    ]).ask()
    ? Select toppings done (2 selections)
    ['Cheese', 'Pineapple']

.. image:: ../images/checkbox.gif

This is just a really basic example, the prompt can be customised using the
parameters.


Args:
    message: Question text

    choices: Items shown in the selection, this can contain :class:`Choice` or
             or :class:`Separator` objects or simple items as strings. Passing
             :class:`Choice` objects, allows you to configure the item more
             (e.g. preselecting it or disabling it).

    default: Default return value (single value). If you want to preselect
             multiple items, use ``Choice("foo", checked=True)`` instead.

    validate: Require the entered value to pass a validation. The
              value can not be submitted until the validator accepts
              it (e.g. to check minimum password length).

              This should be a function accepting the input and
              returning a boolean. Alternatively, the return value
              may be a string (indicating failure), which contains
              the error message to be displayed.

    qmark: Question prefix displayed in front of the question.
           By default this is a ``?``.

    pointer: Pointer symbol in front of the currently highlighted element.
             By default this is a ``»``.
             Use ``None`` to disable it.

    style: A custom color and style for the question parts. You can
           configure colors as well as font types for different elements.

    initial_choice: A value corresponding to a selectable item in the choices,
                    to initially set the pointer position to.

    use_arrow_keys: Allow the user to select items from the list using
                    arrow keys.

    use_jk_keys: Allow the user to select items from the list using
                 `j` (down) and `k` (up) keys.

    use_emacs_keys: Allow the user to select items from the list using
                    `Ctrl+N` (down) and `Ctrl+P` (up) keys.

    use_search_filter: Flag to enable search filtering. Typing some string will
                       filter the choices to keep only the ones that contain the
                       search string.
                       Note that activating this option disables "vi-like"
                       navigation as "j" and "k" can be part of a prefix and
                       therefore cannot be used for navigation

    instruction: A message describing how to navigate the menu.

    show_description: Display description of current selection if available.

Returns:
    :class:`Question`: Question instance, ready to be prompted (using ``.ask()``).
zOSome option to move the selection is required. Arrow keys or j/k or Emacs keys.zSCannot use j/k keys with prefix filter search, since j/k can be part of the prefix.)zbottom-toolbar	noreversezvalidate must be callable)r%   r'   r-   r/   c            
      ~  > / n U R                  ST45        U R                  SSR                  T5      45        TR                  (       Ga  [        TR                  5      nUS:X  a  U R                  S5        U $ US:X  a  [        TR                  5       S   R                  [        5      (       aT  TR                  5       S   R                  nU R                  SSR                  U Vs/ s H  o3S   PM	     sn5      45        U $ U R                  SS	R                  TR                  5       S   R                  5      45         U $ U R                  SS
R                  U5      45         U $ Tb  U R                  ST45        U $ U R                  SST(       a  SOS ST(       a  SOS ST(       a  SOS S345        U $ s  snf )Nzclass:qmarkzclass:questionz {} r   )class:answerdone   r3    z[{}]zdone ({} selections)zclass:instructionz-(Use arrow keys to move, <space> to select, <zctrl-ar   z> to toggle, <iz> to invertz, type to filter))
appendformatis_answeredlenselected_options
isinstanceget_selected_valuestitlelistjoin)	tokensnbr_selectedtstokenicr,   r    r$   r+   s	       r   get_prompt_tokens#checkbox.<locals>.get_prompt_tokens   s   }e,-'w)?@A>>>r223Lq 67F E "b446q9??FF//1!4::BMM*GG2$>2%1X2$>?> 1 MM*"MM"*@*@*B1*E*K*KL0 # #%;%B%B<%PQ"  &2K@A  +(9HsC D(9HsC;1B-K1	N	 9 %?s   'F:c                  b   > TR                  5        V s/ s H  o R                  PM     sn $ s  sn f N)r?   value)crG   s    r   r?   %checkbox.<locals>.get_selected_values   s(    !#!7!7!9:!9A!9:::s   ,selected_valuesc                    > T" U 5      nUSL nU(       d%  USL a  [         nO[        U5      n[        SU4/5      nU(       d  TR                  (       a	  WTl        U$ S Tl        U$ )NTFzclass:validation-toolbar)r   strr   submission_attemptederror_message)rO   verdictvalid
error_textrS   rG   r#   s        r   perform_validation$checkbox.<locals>.perform_validation   sv    ?+4%*
 \
),F
+S*TUM "'2+B+BM 	  IM 	 r   T)eagerc                 @    U R                   R                  [        SS9  g )Nzclass:aborting)	exceptionr&   )appexitKeyboardInterrupt)events    r   _checkbox.<locals>._   s     			!2:JKr    c                    > TR                  5       R                  nUTR                  ;   a  TR                  R                  U5        OTR                  R	                  U5        T" T" 5       5        g rK   )get_pointed_atrL   r=   remover9   )_eventpointed_choicer?   rG   rW   s     r   togglecheckbox.<locals>.toggle   sY    **,22R000&&~6&&~6.01r   r7   c                   > TR                    Vs/ s HU  n[        U[        5      (       a  M  UR                  TR                  ;  d  M6  UR
                  (       a  MI  UR                  PMW     nnUTl        T" T" 5       5        g s  snf rK   )r!   r>   r   rL   r=   disabled)rf   rM   inverted_selectionr?   rG   rW   s      r   invertcheckbox.<locals>.invert   s{     ZZ
a+  r222  JJ	 AGG 	 
 1.01
s   BB	BBr   c                 @  > SnTR                    Hp  n[        U[        5      (       a  M  UR                  TR                  ;  d  M6  UR
                  (       a  MI  TR                  R                  UR                  5        SnMr     U(       a  / Tl        T" T" 5       5        g )NTF)r!   r>   r   rL   r=   rk   r9   )rf   all_selectedrM   r?   rG   rW   s      r   allcheckbox.<locals>.all  sv    Aq),,GG2#6#66


 ##**1773$  "$B.01r   c                    > TR                  5         TR                  5       (       d(  TR                  5         TR                  5       (       d  M'  g g rK   )select_nextis_selection_validr_   rG   s    r   move_cursor_down"checkbox.<locals>.move_cursor_down  s7    
''))NN ''))r   c                    > TR                  5         TR                  5       (       d(  TR                  5         TR                  5       (       d  M'  g g rK   )select_previousru   rv   s    r   move_cursor_up checkbox.<locals>.move_cursor_up  s;    
''))  ''))r   c                 V   > TR                  U R                  S   R                  5        g )Nr   )add_search_characterkey_sequencekeyrv   s    r   search_filtercheckbox.<locals>.search_filter  s"    ##E$6$6q$9$=$=>r   jkc                 ~   > T" 5       nSTl         T" U5      (       a!  STl        U R                  R                  US9  g g )NT)result)rR   r;   r\   r]   )r_   rO   r?   rG   rW   s     r   
set_answercheckbox.<locals>.set_answer3  s<    -/"&o..!BNIINN/N2 /r   c                     g)zDisallow inserting other text.Nr   )rf   s    r   othercheckbox.<locals>.other<  s    r   )layoutkey_bindingsr&   r   )!
ValueErrorr   r   callabler   r   r	   rQ   r   boolr   create_inquirer_layoutr   addr   ControlQControlCControlIControlAstring	printable
whitespace	BackspaceDownUpControlNControlPControlMr   r   r   used_kwargs__init__) r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   merged_stylerH   r   bindingsr`   rh   rm   rq   rw   r{   r   	characterr   r   r?   rG   rW   s    `  ``      ``                @@@r   checkboxr      s3   B k^
 	

 (a
 	
 (
 234	
L H455	%)
B,tE#s(O4 , ,\;c ;DI $  $ **2/@KFKF}H\\$--t\,\\$--t\,L - -L \\#T\"2 #2 \\#4$--#T\J
2 K
2 \\#4$--#T\J2 K2 
!
 	?  ))IF---LL$L/> * 	T^^40?TYYd+,<=TWWD).9S%&67S%n5T]]$/0@AT]]$/?\\$--t\,3 -3 \\$((- -  	
!	
 (<(<=		
 r   )'r   typingr   r   r   r   r   r   r	   r
   prompt_toolkit.applicationr   prompt_toolkit.formatted_textr   prompt_toolkit.key_bindingr   prompt_toolkit.keysr   prompt_toolkit.stylesr   questionaryr   questionary.constantsr   r   r   questionary.promptsr   questionary.prompts.commonr   r   r   questionary.questionr   questionary.stylesr   rQ   r   r   r   r   r   <module>r      s            2 7 2 $ '  9 : / & - 6 0 ) 3 "8F(5!CG05!%!jjeCc3h789j c]j S	{E$)$445	j
 j c]j E?j U3S#X#>?@j j j j S$_-j #j j j  !jr   