Ë
    Ã?Æi
  ã                  óN   — d Z ddlmZ ddl­ ddlmZmZ d
d„Zd
d„Zd
d„Z	dd„Z
y	)u×  PNF (Ð›Ð�Ð§, Ð›Ð¸Ñ‡ÐµÐ½ Ð½Ð¾Ð¼ÐµÑ€ Ð½Ð° Ñ‡ÑƒÐ¶Ð´ÐµÐ½ÐµÑ†, Bulgarian number of a foreigner).

The personal number of a foreigner is a 10-digit number where the last digit
is the result of a weighted checksum.

>>> validate('7111 042 925')
'7111042925'
>>> validate('7111042922')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('71110A2922')  # invalid digit
Traceback (most recent call last):
    ...
InvalidFormat: ...
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                óR   — t        | d«      j                  «       j                  «       S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -.)r   ÚupperÚstrip©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/bg/pnf.pyÚcompactr   ,   s#   € ô �˜Ó×%Ñ%Ó'×-Ñ-Ó/Ð/ó    c           	     óV   — d}t        t        d„ t        || «      D «       «      dz  «      S )zZCalculate the check digit. The number passed should not have the
    check digit included.)	é   é   é   é   é   é	   é   é   é   c              3  ó>   K  — | ]  \  }}|t        |«      z  –— Œ y ­w)N)Úint)Ú.0ÚwÚns      r   ú	<genexpr>z#calc_check_digit.<locals>.<genexpr>6   s   è ø€ Ò?¡$ ! Q�1”s˜1“v•:Ñ?ùs   ‚é
   )ÚstrÚsumÚzip)r   Úweightss     r   Úcalc_check_digitr$   2   s+   € ð /€GÜŒsÑ?¬#¨g°vÓ*>Ô?Ó?À"ÑDÓEÐEr   c                ó²   — t        | «      } t        | «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚t        | dd «      | d   k7  r
t        «       ‚| S )z…Check if the number is a valid national identification number. This
    checks the length, formatting, embedded date and check digit.r   Néÿÿÿÿ)r   r   ÚInvalidFormatÚlenÚInvalidLengthr$   ÚInvalidChecksumr
   s    r   Úvalidater+   9   sV   € ô �V‹_€FÜ�FÔÜ‹oÐÜ
ˆ6ƒ{�bÒÜ‹oÐÜ˜˜s ˜Ó$¨¨r©
Ò2ÜÓÐØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z>Check if the number is a valid national identification number.F)Úboolr+   ÚValidationErrorr
   s    r   Úis_validr/   F   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"N)r   r    Úreturnr    )r   r    r0   r-   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r$   r+   r/   © r   r   ú<module>r6      s*   ðñ*õ" #ä ß 'ó0óFó
ôr   