Ë
    Ã?Æi`
  ã                  óZ   — d Z ddlm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
)a�  TIN (South African Tax Identification Number).

The South African Tax Identification Number (TIN or Tax Reference Number) is
issued to individuals and legal entities for tax purposes. The number
consists of 10 digits.

More information:

* https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/South-Africa-TIN.pdf
* https://www.sars.gov.za/

>>> validate('0001339050')
'0001339050'
>>> validate('2449/494/16/0')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('9125568')
Traceback (most recent call last):
    ...
InvalidLength: ...
>>> format('084308984-8')
'0843089848'
é    )Úannotations)Úluhn)Ú*)Ú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/za/tin.pyÚcompactr   5   s#   € ô �˜Ó×%Ñ%Ó'×-Ñ-Ó/Ð/ó    c                ó¾   — t        | «      } t        | «      dk7  r
t        «       ‚t        | «      s
t	        «       ‚| d   dvr
t        «       ‚t        j                  | «      S )zCheck if the number is a valid South Africa Tax Reference Number.

    This checks the length, formatting and check digit.
    é
   r   Ú01239)r   ÚlenÚInvalidLengthr   ÚInvalidFormatÚInvalidComponentr   Úvalidater   s    r   r   r   >   sU   € ô
 �V‹_€FÜ
ˆ6ƒ{�bÒÜ‹oÐÜ�FÔÜ‹oÐØˆa�y˜ÑÜÓ Ð Ü�=‰=˜Ó Ð r   c                óJ   — 	 t        t        | «      «      S # t        $ r Y yw xY w)zACheck if the number is a valid South Africa Tax Reference Number.F)Úboolr   ÚValidationErrorr   s    r   Úis_validr   M   s)   € ðÜ”H˜VÓ$Ó%Ð%øÜò Ùðús   ‚ –	"¡"c                ó   — t        | «      S )z8Reformat the number to the standard presentation format.)r   r   s    r   Úformatr   U   s   € ä�6‹?Ðr   N)r   ÚstrÚreturnr   )r   r   r   r   )Ú__doc__Ú
__future__r   Ústdnumr   Ústdnum.exceptionsÚstdnum.utilr   r   r   r   r   r   © r   r   ú<module>r&      s,   ðñ*õ2 #å Ü ß 'ó0ó!óôr   