Ë
    Ã?Æia  ã                  ó^   — d Z ddlmZ ddlZddl­ ddlmZmZ dd„Zdd„Z	dd„Z
dd	„Zdd
„Zy)u¢  EGN (Ð•Ð“Ð�, Ð•Ð´Ð¸Ð½ÐµÐ½ Ð³Ñ€Ð°Ð¶Ð´Ð°Ð½Ñ�ÐºÐ¸ Ð½Ð¾Ð¼ÐµÑ€, Bulgarian personal identity codes).

It is a 10-digit number of which the first 6 digits denote the person's
birth date, the next three digits represent a birth order number from
which the person's gender can be determined and the last digit is a check
digit.

>>> compact('752316 926 3')
'7523169263'
>>> validate('8032056031')
'8032056031'
>>> get_birth_date('7542011030')
datetime.date(2075, 2, 1)
>>> validate('7552A10004')  # invalid digit
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> validate('8019010008')  # invalid date
Traceback (most recent call last):
    ...
InvalidComponent: ...
é    )ÚannotationsN)Ú*)Ú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/egn.pyÚcompactr   4   s#   € ô �˜Ó×%Ñ%Ó'×-Ñ-Ó/Ð/ó    c           	     ó\   — d}t        t        d„ t        || «      D «       «      dz  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>>   s   è ø€ Ò?¡$ ! Q�1”s˜1“v•:Ñ?ùs   ‚é   r   )ÚstrÚsumÚzip)r   Úweightss     r   Úcalc_check_digitr$   :   s0   € ð +€GÜŒsÑ?¬#¨g°vÓ*>Ô?Ó?À"ÑDÀrÑIÓJÐJr   c                ó  — t        | «      } t        | dd «      dz   }t        | dd «      }t        | dd «      }|dkD  r|dz  }|dz  }n|dkD  r
|dz  }|dz  }	 t        j                  |||«      S # t        $ r t        «       ‚w xY w)	z?Split the date parts from the number and return the birth date.r   r   il  r   r   é(   éd   é   )r   r   ÚdatetimeÚdateÚ
ValueErrorÚInvalidComponent)r   ÚyearÚmonthÚdays       r   Úget_birth_dater0   A   s¢   € ä�V‹_€FÜˆv�a˜ˆ{Ó˜dÑ"€DÜ��q˜�Ó€EÜ
ˆf�Q�qˆkÓ
€CØˆr‚zØ�‰ˆØ�‰‰Ø	�ŠØ�‰ˆØ�‰ˆð!Ü�}‰}˜T 5¨#Ó.Ð.øÜò !ÜÓ Ð ð!ús   ÁA0 Á0Bc                óÈ   — t        | «      } t        | «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚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ÚInvalidLengthr0   r$   ÚInvalidChecksumr
   s    r   Úvalidater7   S   s`   € ô �V‹_€FÜ�FÔÜ‹oÐÜ
ˆ6ƒ{�bÒÜ‹oÐä�6Ôô ˜˜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)Úboolr7   ÚValidationErrorr
   s    r   Úis_validr;   d   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡")r   r    Úreturnr    )r   r    r<   zdatetime.date)r   r    r<   r9   )Ú__doc__Ú
__future__r   r)   Ústdnum.exceptionsÚstdnum.utilr   r   r   r$   r0   r7   r;   © r   r   ú<module>rB      s2   ðñ*õ. #ã ä ß 'ó0óKó!ó$ô"r   