§
    šŠtj×  ã            
       óŠ   — d dl mZmZ deeeeef         f         deeeeeeef         f         f         fd„Zdededefd„ZdS )	é    )ÚDictÚUnionÚinputÚreturnc                 ó"  — 	 ddl }n# t          $ r t          d¦  «        ‚w xY wt          | t          ¦  «        r+|                     | g¦  «        }|j        d         |j        dœS t          | t          ¦  «        ryt          ¦   «         }| D ]}| 	                    | |         ¦  «         Œ|                     |¦  «        }|j        }d}t          ¦   «         }| D ]}||         ||<   |dz  }Œ||j        dœS t          dt          | ¦  «        › �¦  «        ‚)aû  
    Sanitize input string or dict of strings by replacing sensitive data with
    placeholders.

    It returns the sanitized input string or dict of strings and the secure
    context as a dict following the format:
    {
        "sanitized_input": <sanitized input string or dict of strings>,
        "secure_context": <secure context>
    }

    The secure context is a bytes object that is needed to de-sanitize the response
    from the LLM.

    Args:
        input: Input string or dict of strings.

    Returns:
        Sanitized input string or dict of strings and the secure context
        as a dict following the format:
        {
            "sanitized_input": <sanitized input string or dict of strings>,
            "secure_context": <secure context>
        }

        The `secure_context` needs to be passed to the `desanitize` function.

    Raises:
        ValueError: If the input is not a string or dict of strings.
        ImportError: If the `opaqueprompts` Python package is not installed.
    r   NúhCould not import the `opaqueprompts` Python package, please install it with `pip install opaqueprompts`.)Úsanitized_inputÚsecure_contexté   zUnexpected input type )ÚopaquepromptsÚImportErrorÚ
isinstanceÚstrÚsanitizeÚsanitized_textsr
   ÚdictÚlistÚappendÚ
ValueErrorÚtype)	r   ÚopÚsanitize_responseÚvaluesÚkeyÚsanitize_values_responseÚsanitized_input_valuesÚidxr	   s	            úi/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_community/utilities/opaqueprompts.pyr   r      sh  € ðD
Ø"Ð"Ð"Ð"Ð"øÝð 
ð 
ð 
ÝðBñ
ô 
ð 	
ð
øøøõ �%�ÑÔð 
à13·²¸e¸WÑ1EÔ1EÐà0Ô@ÀÔCØ/Ô>ð
ð 
ð 	
õ
 �%�ÑÔð 
å‘”ˆð ð 	&ð 	&ˆCØ�MŠM˜% œ*Ñ%Ô%Ð%Ð%ð 9;¿ºÀFÑ8KÔ8KÐ ð ":Ô!IÐØˆÝ™&œ&ˆØð 	ð 	ˆCØ#9¸#Ô#>ˆO˜CÑ Ø�1‰HˆCˆCð  /Ø6ÔEð
ð 
ð 	
õ
 Ð;­d°5©k¬kÐ;Ð;Ñ
<Ô
<Ð<ó   ‚ ‡!Úsanitized_textr
   c                 ó‚   — 	 ddl }n# t          $ r t          d¦  «        ‚w xY w|                     | |¦  «        }|j        S )zî
    Restore the original sensitive data from the sanitized text.

    Args:
        sanitized_text: Sanitized text.
        secure_context: Secure context returned by the `sanitize` function.

    Returns:
        De-sanitized text.
    r   Nr   )r   r   Ú
desanitizeÚdesanitized_text)r    r
   r   Údesanitize_responses       r   r"   r"   Q   so   € ð
Ø"Ð"Ð"Ð"Ð"øÝð 
ð 
ð 
ÝðBñ
ô 
ð 	
ð
øøøð
 24·²Ø˜ñ2ô 2Ðð Ô/Ð/r   N)Útypingr   r   r   r   Úbytesr"   © ó    r   ú<module>r)      s©   ðØ Ð Ð Ð Ð Ð Ð Ð ðJ=Ø��d˜3 ˜8”nÐ$Ô%ðJ=à	ˆ#ˆu�S˜$˜s C˜xœ.Ð(Ô)Ð
)Ô*ðJ=ð J=ð J=ð J=ðZ0˜sð 0°Eð 0¸cð 0ð 0ð 0ð 0ð 0ð 0r(   