Ë
    Ã?Æi+  ã                  ó^   — d Z ddlmZ ddl­ ddlmZ ddlmZmZ dZ	dd„Z
dd„Zdd	„Zdd
„Zy)u>  nÂ° TVA (taxe sur la valeur ajoutÃ©e, French VAT number).

The nÂ° TVA (NumÃ©ro d'identification Ã  la taxe sur la valeur ajoutÃ©e) is the
SIREN (SystÃ¨me dâ€™Identification du RÃ©pertoire des Entreprises) prefixed by
two digits. In old style numbers the two digits are numeric, with new
style numbers at least one is a alphabetic.

>>> compact('Fr 40 303 265 045')
'40303265045'
>>> validate('23334175221')
'23334175221'
>>> validate('84 323 140 391')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('K7399859412')  # new-style number
'K7399859412'
>>> validate('4Z123456782')  # new-style number starting with digit
'4Z123456782'
>>> validate('IO334175221')   # the letters cannot by I or O
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> to_siren('Fr 40 303 265 045')
'303265045'
é    )Úannotations)Ú*)Úsiren)ÚcleanÚisdigitsÚ"0123456789ABCDEFGHJKLMNPQRSTUVWXYZc                ó‚   — t        | d«      j                  «       j                  «       } | j                  d«      r| dd } | S )zˆConvert the number to the minimal representation. This strips the
    number of any valid separators and removes surrounding whitespace.z -.ÚFRé   N)r   ÚupperÚstripÚ
startswith©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/fr/tva.pyÚcompactr   ;   s@   € ô �6˜5Ó!×'Ñ'Ó)×/Ñ/Ó1€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c                ó¼  — t        | «      } t        d„ | dd D «       «      s
t        «       ‚t        | dd «      s
t        «       ‚t	        | «      dk7  r
t        «       ‚| dd dk7  rt        j                  | dd «       t        | «      r/t        | dd «      t        | dd dz   «      dz  k7  r
t        «       ‚| S t        | d	   «      r8t        j                  | d	   «      d
z  t        j                  | d   «      z   dz
  }n7t        j                  | d	   «      dz  t        j                  | d   «      z   dz
  }t        | dd «      dz   |dz  z   dz  |dz  k7  r
t        «       ‚| S )zbCheck if the number is a valid VAT number. This checks the length,
    formatting and check digit.c              3  ó,   K  — | ]  }|t         v –— Œ y ­w)N)Ú	_alphabet)Ú.0Úxs     r   ú	<genexpr>zvalidate.<locals>.<genexpr>H   s   è ø€ Ò2 !ˆq”IŒ~Ñ2ùs   ‚Nr   é   é   Ú000Ú12éa   r   é   é   é
   é"   éd   )r   ÚallÚInvalidFormatr   ÚlenÚInvalidLengthr   ÚvalidateÚintÚInvalidChecksumr   Úindex)r   Úchecks     r   r(   r(   D   si  € ô �V‹_€FÜÑ2 v¨b¨q zÔ2Ô2Ü‹oÐÜ�F˜1˜2�JÔÜ‹oÐÜ
ˆ6ƒ{�bÒÜ‹oÐØˆa�€{�eÒä�‰�v˜a˜b�zÔ"Ü�Ôäˆv�b�qˆz‹?œs 6¨!¨" :°Ñ#4Ó5¸Ñ:Ò;Ü!Ó#Ð#ð €Mô �F˜1‘IÔä—‘  q¡	Ó*¨RÑ/Ü—‘  q¡	Ó*ñ+Ø-/ñ0ñ ô
 —‘  q¡	Ó*¨RÑ/Ü—‘  q¡	Ó*ñ+Ø-0ñ1ð ô ��q�r�
‹O˜aÑ %¨2¡+Ñ-°Ñ3¸À¹
ÒCÜ!Ó#Ð#Ø€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z*Check if the number is a valid VAT number.F)Úboolr(   ÚValidationErrorr   s    r   Úis_validr0   d   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óF   — t        | «      } | dd dk(  r
t        «       ‚| dd S )zlConvert the VAT number to a SIREN number.

    The SIREN number is the 9 last digits of the VAT number.
    r   r   r   N)r   ÚInvalidComponentr   s    r   Úto_sirenr3   l   s0   € ô
 �V‹_€FØˆa�€{�eÒäÓ Ð Ø�!�"ˆ:Ðr   N)r   ÚstrÚreturnr4   )r   r4   r5   r.   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚ	stdnum.frr   Ústdnum.utilr   r   r   r   r(   r0   r3   © r   r   ú<module>r<      s4   ðñ*õ6 #ä Ý ß 'ð 1€	óóó@ô	r   