Ë
    Ã?Æi¯  ã                  óZ   — d Z ddlmZ ddlmZmZmZ ddl­ ddlm	Z	m
Z
 d
d„Zd
d„Zdd„Zy	)uô  NIF (NÃºmero de IdentificaciÃ³n Fiscal, Spanish VAT number).

The Spanish VAT number is a 9-digit number where either the first, last
digits or both can be letters.

The number is either a DNI (Documento Nacional de Identidad, for
Spaniards), a NIE (NÃºmero de IdentificaciÃ³n de Extranjero, for
foreigners) or a CIF (CÃ³digo de IdentificaciÃ³n Fiscal, for legal
entities and others).

>>> compact('ES B-58378431')
'B58378431'
>>> validate('B64717838')
'B64717838'
>>> validate('B64717839')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('54362315K')  # resident
'54362315K'
>>> validate('X-5253868-R')  # foreign person
'X5253868R'
>>> validate('M-1234567-L')  # foreign person without NIE
'M1234567L'
é    )Úannotations)ÚcifÚdniÚnie)Ú*)ÚcleanÚisdigitsc                ó‚   — 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 -ÚESé   N)r   ÚupperÚstripÚ
startswith©Únumbers    úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/es/nif.pyÚcompactr   6   s@   € ô �6˜4Ó ×&Ñ&Ó(×.Ñ.Ó0€FØ×Ñ˜ÔØ˜˜�ˆØ€Mó    c                óŽ  — t        | «      } t        | dd «      s
t        «       ‚t        | «      dk7  r
t	        «       ‚| d   dv r*| d   t        j                  | dd «      k7  r
t        «       ‚| S t        | d   «      rt        j                  | «       | S | d   dv rt        j                  | «       | S t        j                  | «       | S )úkCheck if the number provided is a valid VAT number. This checks the
    length, formatting and check digit.é   éÿÿÿÿé	   r   ÚKLMÚXYZ)r   r	   ÚInvalidFormatÚlenÚInvalidLengthr   Úcalc_check_digitÚInvalidChecksumÚvalidater   r   r   s    r   r!   r!   ?   sÇ   € ô �V‹_€FÜ�F˜1˜R�LÔ!Ü‹oÐÜ
ˆ6ƒ{�aÒÜ‹oÐØˆa�y�EÑð
 �"‰:œ×-Ñ-¨f°Q°r¨lÓ;Ò;Ü!Ó#Ð#ð €Mô 
�&˜‘)Ô	ä�‰�VÔð €Mð 
�‰�eÑ	ä�‰�VÔð €Mô 	�‰�VÔØ€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)r   F)Úboolr!   ÚValidationErrorr   s    r   Úis_validr%   Z   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"N)r   ÚstrÚreturnr&   )r   r&   r'   r#   )Ú__doc__Ú
__future__r   Ú	stdnum.esr   r   r   Ústdnum.exceptionsÚstdnum.utilr   r	   r   r!   r%   © r   r   ú<module>r.      s*   ðñ*õ4 #ç #Ñ #Ü ß 'óóô6r   