Ë
    Ã?Æ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  CPF (CÃ©dula de Persona FÃ­sica, Costa Rica physical person ID number).

The CÃ©dula de Persona FÃ­sica (CPF), also known as CÃ©dula de Identidad is an
identifier of physical persons.

The number consists of 10 digits in the form 0P-TTTT-AAAA where P represents
the province, TTTT represents the volume (tomo) padded with zeroes on the
left, and AAAA represents the entry (asiento) also padded with zeroes on the
left.

It seems to be usual for the leading zeroes in each of the three parts to be
omitted.

More information:

* https://www.hacienda.go.cr/consultapagos/ayuda_cedulas.htm
* https://www.procomer.com/downloads/quiero/guia_solicitud_vuce.pdf (page 11)
* https://www.hacienda.go.cr/ATV/frmConsultaSituTributaria.aspx

>>> validate('3-0455-0175')
'0304550175'
>>> validate('30-1234-1234')
Traceback (most recent call last):
    ...
InvalidComponent: ...
>>> validate('12345678')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('701610395')
'07-0161-0395'
>>> format('1-613-584')
'01-0613-0584'
é    )Úannotations)Ú*)ÚcleanÚisdigitsc                óf  — t        | d«      j                  «       j                  «       } | j                  d«      }t	        |«      dk(  rE|d   j                  d«      |d<   |d   j                  d«      |d<   |d   j                  d«      |d<   dj                  |«      } t	        | «      d	k(  rd
| z   } | S )z¹Convert the number to the minimal representation.

    This strips the number of any valid separators and removes surrounding
    whitespace. Also adds padding zeroes if necessary.
    ú ú-é   r   é   é   é   Ú é	   Ú0)r   ÚupperÚstripÚsplitÚlenÚzfillÚjoin)ÚnumberÚpartss     úT/var/www/html/myprovider/mon_projet_qr/lib/python3.12/site-packages/stdnum/cr/cpf.pyÚcompactr   >   s¤   € ô �6˜3Ó×%Ñ%Ó'×-Ñ-Ó/€FØ�L‰L˜Ó€EÜ
ˆ5ƒz�Q‚à˜‘8—>‘> !Ó$ˆˆa‰Ø˜‘8—>‘> !Ó$ˆˆa‰Ø˜‘8—>‘> !Ó$ˆˆa‰Ø�W‰W�U‹^€FÜ
ˆ6ƒ{�aÒØ�v‘ˆØ€Mó    c                óš   — t        | «      } t        | «      dk7  r
t        «       ‚t        | «      s
t	        «       ‚| d   dk7  r
t        «       ‚| S )zfCheck if the number is a valid Costa Rica CPF number.

    This checks the length and formatting.
    é
   r   r   )r   r   ÚInvalidLengthr   ÚInvalidFormatÚInvalidComponent©r   s    r   Úvalidater"   Q   sK   € ô
 �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�FÔÜ‹oÐØˆa�y�CÒÜÓ Ð Ø€Mr   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)z5Check if the number is a valid Costa Rica CPF number.F)Úboolr"   ÚValidationErrorr!   s    r   Úis_validr&   `   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                óR   — t        | «      } dj                  | dd | dd | dd g«      S )z8Reformat the number to the standard presentation format.r	   Nr   é   )r   r   r!   s    r   Úformatr)   h   s3   € ä�V‹_€FØ�8‰8�V˜B˜Q�Z ¨¨! ¨f°Q°R¨jÐ9Ó:Ð:r   N)r   ÚstrÚreturnr*   )r   r*   r+   r$   )Ú__doc__Ú
__future__r   Ústdnum.exceptionsÚstdnum.utilr   r   r   r"   r&   r)   © r   r   ú<module>r1      s*   ðñ*!õF #ä ß 'óó&óô;r   