
    ^i                         d Z ddlmZmZmZmZmZmZ ddlm	Z	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlm Z m!Z!m"Z"m#Z# ddgZ$eeeeeeeeeed
Z%de!deee&ef      fdZ'dee&ef   de"de(deeee&ef      e&ee&e(f   e&f   fdZ)	 	 	 	 	 d!de!deee&e&f      de*de*dee    de*de"fdZ+	 	 	 	 	 d!de!deee&e&f      de*de*dee    de*de"fd Z,y)"zThis module contains the classic entrypoint for creating prompts.

A `PyInquirer <https://github.com/CITGuru/PyInquirer>`_ compatible entrypoint :func:`.prompt`.
    )AnyDictListOptionalTupleUnion)InvalidArgumentRequiredKeyNotFound)CheckboxPrompt)ConfirmPrompt)ExpandPrompt)FilePathPrompt)FuzzyPrompt)InputPrompt)
ListPrompt)NumberPrompt)RawlistPrompt)SecretPrompt)InquirerPyKeybindingsInquirerPyQuestionsInquirerPySessionResult	get_stylepromptprompt_async)
confirmfilepathpasswordinputlistcheckboxrawlistexpandfuzzynumber	questionsreturnc                 b    t        | t              r| g} t        | t              st        d      | S )zProcess and validate questions.

    Args:
        questions: List of questions to create prompt.

    Returns:
        List of validated questions.
    z7argument questions should be type of list or dictionary)
isinstancedictr   r	   r%   s    ]/mnt/e/genesis-system/.venvs/browser-army/lib/python3.12/site-packages/InquirerPy/resolver.py_get_questionsr,   )   s1     )T"K	i&WXX    original_questionresultindexc                     | j                         }|j                  d      }|j                  d|      }|j                  d      }|j                  dd      }|r ||      sd||<   d}||||fS )ah  Get information from individual question.

    Args:
        original_question: Original question dictionary.
        result: Current prompt session result.
        index: Question index.

    Returns:
        A tuple containing question information in the order of
            question dictionary, type of question, name of question, message of question.
    typenamemessagewhenN)copypop)r.   r/   r0   questionquestion_typequestion_namer4   question_whens           r+   _get_questionr<   ;   sv     !%%'HLL(MLL/Mll9%GLL.M]62 $}]M7::r-   Nstylevi_moderaise_keyboard_interruptkeybindingsstyle_overridec                 T  K   i }|si }t        |       } t        ||      }t        |       D ]b  \  }}		 t        |	||      \  }
}}}|
|||||i ||
j	                  di       d}t        |   di ||
j                          d{   ||<   d |S 7 # t        $ r t        w xY ww)zClassic syntax entrypoint to create a prompt session via asynchronous method.

    Refer to :func:`InquirerPy.resolver.prompt` for detailed documentations.
    r*   r.   r/   r0   Nr@   r4   r=   r>   r?   session_resultr@    )	r,   r   	enumerater<   r7   question_mappingexecute_asyncKeyErrorr
   r%   r=   r>   r?   r@   rA   r/   question_styler0   r.   r8   r9   r:   r4   argss                  r+   r   r   T   s      ')F3Iun5N$-i$8 &  	&>K"3F%?;Hm]G "'",D"(Q+QmR1PQD +;=*I ++"+mo%F=!&* M%  	&%%	&s:   0B(BB(	>BBBB(BB%%B(c                 8   i }|si }t        |       } t        ||      }t        |       D ]Z  \  }}		 t        |	||      \  }
}}}|
|||||i ||
j	                  di       d}t        |   di ||
j                         ||<   \ |S # t        $ r t        w xY w)a  Classic syntax entrypoint to create a prompt session.

    Resolve user provided list of questions, display prompts and get the results.

    Args:
        questions: A list of :ref:`pages/prompt:question` to ask. Refer to documentation for more info.
        style: A :class:`dict` containing the style specification for the prompt. Refer to :ref:`pages/style:Style` for more info.
        vi_mode: Use vim keybindings for the prompt instead of the default emacs keybindings.
            Refer to :ref:`pages/kb:Keybindings` for more info.
        raise_keyboard_interrupt: Raise the :class:`KeyboardInterrupt` exception when `ctrl-c` is pressed. If false, the result
            will be `None` and the question is skiped.
        keybindings: List of custom :ref:`pages/kb:Keybindings` to apply. Refer to documentation for more info.
        style_override: Override all default styles. When providing any style customisation, all default styles are removed when this is True.

    Returns:
        A dictionary containing all of the question answers. The key is the name of the question and the value is the
        user answer. If the `name` key is not present as part of the question, then the question index will be used
        as the key.

    Raises:
        RequiredKeyNotFound: When the question is missing required keys.
        InvalidArgument: When the provided `questions` argument is not a type of :class:`list` nor :class:`dictionary`.

    Examples:
        >>> from InquirerPy import prompt
        >>> from InquirerPy.validator import NumberValidator
        >>> questions = [
        ...     {
        ...         "type": "input",
        ...         "message": "Enter your age:",
        ...         "validate": NumberValidator(),
        ...         "invalid_message": "Input should be number.",
        ...         "default": "18",
        ...         "name": "age",
        ...         "filter": lambda result: int(result),
        ...         "transformer": lambda result: "Adult" if int(result) >= 18 else "Youth",
        ...     },
        ...     {
        ...         "type": "rawlist",
        ...         "message": "What drinks would you like to buy:",
        ...         "default": 2,
        ...         "choices": lambda result: ["Soda", "Cidr", "Water", "Milk"]
        ...         if result["age"] < 18
        ...         else ["Wine", "Beer"],
        ...         "name": "drink",
        ...     },
        ...     {
        ...         "type": "list",
        ...         "message": "Would you like a bag:",
        ...         "choices": ["Yes", "No"],
        ...         "when": lambda result: result["drink"] in {"Wine", "Beer"},
        ...     },
        ...     {"type": "confirm", "message": "Confirm?", "default": True},
        ... ]
        >>> result = prompt(questions=questions)
    r*   rC   r@   rD   rF   )	r,   r   rG   r<   r7   rH   executerJ   r
   rK   s                  r+   r   r      s    @ ')F3Iun5N$-i$8 &  	&>K"3F%?;Hm]G "'",D"(Q+QmR1PQD %5]$C %%"%gi =!&* M  	&%%	&s   B	>B		B)NFTNT)-__doc__typingr   r   r   r   r   r   InquirerPy.exceptionsr	   r
   InquirerPy.prompts.checkboxr   InquirerPy.prompts.confirmr   InquirerPy.prompts.expandr   InquirerPy.prompts.filepathr   InquirerPy.prompts.fuzzyr   InquirerPy.prompts.inputr   InquirerPy.prompts.listr   InquirerPy.prompts.numberr   InquirerPy.prompts.rawlistr   InquirerPy.prompts.secretr   InquirerPy.utilsr   r   r   r   __all__rH   strr,   intr<   boolr   r   rF   r-   r+   <module>rb      s   ; : F 6 4 2 6 0 0 . 2 4 2  ^
$  1 d4S>6J $;CH~;/F;OR;
8DcN#S%S/3>?;6 '+%)37("(DcN#( ( #	(
 /0( ( (Z '+%)37\"\DcN#\ \ #	\
 /0\ \ \r-   