
    Vh                         d dl mZmZmZ eZd dlmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZ d dlmZ d dlmZ d Zd Zd Zd Zd	 Zy
)    )absolute_importdivisionprint_function)in_table_a1in_table_b1in_table_c3in_table_c4in_table_c5in_table_c6in_table_c7in_table_c8in_table_c9in_table_c12in_table_c21_c22in_table_d1in_table_d2)	normalize)	text_typec                 *    t        | t              rdS dS )NTF)
isinstancer   strings    v/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/postgresql/plugins/module_utils/saslprep.pyis_unicode_strr      s    fi04;e;    c                     g }| D ]<  }t        |      rt        |      r|j                  d       ,|j                  |       > dj                  |      S )z'RFC4013 Mapping profile implementation.  )r   r   appendjoin)r   tmpcs      r   mapping_profiler#      sO     C 1~A 

4 

1 88C=r   c                 T    t        | d         rt        | d         st        d      yy)z2RFC3454 Check bidirectional category of the stringr   z2RFC3454: incorrect bidirectional RandALCat string.TF)r   
ValueErrorr   s    r   is_ral_stringr'   5   s.     6!96":&QRRr   c                 x   t        |       r	t        }d}nt        }d}d}| D ]  }t        |      rt	        d|z        t        |      rt	        d|z        t        |      rt	        d|z        t        |      rt	        d|z        t        |      rt	        d|z        t        |      rt	        d	|z        t        |      rt	        d
|z        t        |      rt	        d|z        t        |      rt	        d|z         ||      rt	        |d|d      t        |      st	        d|z         y)z1RFC4013 Prohibited output profile implementation.zD.2zD.1RFC4013zJ%s: prohibited non-ASCII space characters that cannot be replaced (C.1.2).z*%s: prohibited control characters (C.2.1).z,%s: prohibited private Use characters (C.3).z/%s: prohibited non-character code points (C.4).z+%s: prohibited surrogate code points (C.5).z=%s: prohibited inappropriate for plain text characters (C.6).zK%s: prohibited inappropriate for canonical representation characters (C.7).zG%s: prohibited change display properties / deprecated characters (C.8).z(%s: prohibited tagging characters (C.9).z: prohibited bidi characters (z).z,%s: prohibited unassigned code points (A.1).N)r'   r   r   r   r&   r   r   r	   r
   r   r   r   r   r   )r   is_prohibited_bidi_ch
bidi_tableRFCr"   s        r   prohibited_output_profiler-   D   sy   & V !,
 !,

C S? @BEF G GAICOPPq>KcQRRq>NQTTUUq>JSPQQq> 1367 8 8q> @BEF G Gq> <>AB C Cq>G#MNN !#sJWXX q>KcQRR?Sr   c                     t        |       st        dt        dt        |             t	        |       } t        d|       } | syt        |        | S )aP  RFC4013 implementation.
    Implements "SASLprep" profile (RFC4013) of the "stringprep" algorithm (RFC3454)
    to prepare Unicode strings representing user names and passwords for comparison.
    Regarding the RFC4013, the "SASLprep" profile is intended to be used by
    Simple Authentication and Security Layer (SASL) mechanisms
    (such as PLAIN, CRAM-MD5, and DIGEST-MD5), as well as other protocols
    exchanging simple user names and/or passwords.

    Args:
        string (unicode string): Unicode string to validate and prepare.

    Returns:
        Prepared unicode string.
    zinput must be of type z, not NFKCr   )r   	TypeErrorr   typer#   r   r-   r   s    r   saslprepr2      sO    & &!ifVWW V$F vv&F
 f%Mr   N)
__future__r   r   r   r1   __metaclass__
stringprepr   r   r   r	   r
   r   r   r   r   r   r   r   r   unicodedatar   ansible.module_utils.sixr   r   r#   r'   r-   r2    r   r   <module>r9      sJ    A @2 2 2 2 " .<.=S@$r   