Ë
    ¹ûàgUW  ã                   ó²  — d Z ddlZddlZddlZddlZddlZddlZddlm	Z	 ddl
mZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZmZ i a e	«       Zda dZ!dZ" edejF                  «      Z$ edejJ                  «      Z& ed«      Z' ee«      d„ «       Z( G d„ d«      Z) G d„ dejT                  «      Z+d„ Z,d„ Z-d„ Z.d„ Z/d„ Z0d„ Z1d„ Z2d„ Zd „ Z3d!„ Z4d"„ Z5d#„ Z6d$„ Z7d%„ Z8 ejr                  d&¬'«      d(„ «       Z:ejr                  d)„ «       Z; ejr                  d&¬'«      d/d*„«       Z<d/d+„Z=d/d,„Z> ejr                  d&¬'«      d-„ «       Z?d.„ Z@y)0zTranslation helper functions.é    N)ÚLocal)Úapps)Úsettings)Ú	LANG_INFO)ÚAppRegistryNotReady)Úsetting_changed)Úreceiver)Ú_lazy_re_compile)ÚSafeDataÚ	mark_safeé   )Úto_languageÚ	to_localeúiô  a   
        # "en", "en-au", "x-y-z", "es-419", "*"
        ([A-Za-z]{1,8}(?:-[A-Za-z0-9]{1,8})*|\*)
        # Optional "q=1.00", "q=0.8"
        (?:\s*;\s*q=(0(?:\.[0-9]{,3})?|1(?:\.0{,3})?))?
        # Multiple accepts per header.
        (?:\s*,\s*|$)
    z3^[a-z]{1,8}(?:-[a-z0-9]{1,8})*(?:@[a-z0-9]{1,20})?$z^/(\w+([@-]\w+){0,2})(/|$)c                 ó†   — | dv r=t         j                  «        t        j                  «        t        j                  «        yy)zy
    Reset global state when LANGUAGES setting has been changed, as some
    languages should no longer be accepted.
    )Ú	LANGUAGESÚLANGUAGE_CODEN)Úcheck_for_languageÚcache_clearÚget_languagesÚget_supported_language_variant)ÚsettingÚkwargss     úa/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/django/utils/translation/trans_real.pyÚreset_cacher   =   s6   € ð Ð0Ñ0Ü×&Ñ&Ô(Ü×!Ñ!Ô#Ü&×2Ñ2Õ4ð 1ó    c                   óJ   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
dd
„Zd„ Zy)ÚTranslationCatalogz‡
    Simulate a dict for DjangoTranslation._catalog so as multiple catalogs
    with different plural equations are kept separate.
    Nc                 óŠ   — |r|j                   j                  «       gni g| _        |r|j                  g| _        y d„ g| _        y )Nc                 ó   — t        | dk7  «      S ©Nr   ©Úint©Úns    r   ú<lambda>z-TranslationCatalog.__init__.<locals>.<lambda>Q   s   € ÄÀAÈÁFÃ€ r   )Ú_catalogÚcopyÚ	_catalogsÚpluralÚ_plurals)ÚselfÚtranss     r   Ú__init__zTranslationCatalog.__init__O   s8   € Ù49˜%Ÿ.™.×-Ñ-Ó/Ñ0À¸tˆŒÙ*/˜Ÿ™˜ˆ�Ñ6KÐ5Lˆ�r   c                 óf   — | j                   D ]	  }	 ||   c S  t        |«      ‚# t        $ r Y Œ"w xY w©N)r)   ÚKeyError)r,   ÚkeyÚcats      r   Ú__getitem__zTranslationCatalog.__getitem__S   sC   € Ø—>‘>ò 	ˆCðØ˜3‘x’ð	ô
 �s‹mÐøô ò Ùðús   ‘$¤	0¯0c                 ó(   — || j                   d   |<   y ©Nr   )r)   )r,   r2   Úvalues      r   Ú__setitem__zTranslationCatalog.__setitem__[   s   € Ø!&ˆ�‰�qÑ˜#Òr   c                 ó@   ‡— t        ˆfd„| j                  D «       «      S )Nc              3   ó&   •K  — | ]  }‰|v –— Œ
 y ­wr0   © )Ú.0r3   r2   s     €r   ú	<genexpr>z2TranslationCatalog.__contains__.<locals>.<genexpr>_   s   øè ø€ Ò8 #�3˜#”:Ñ8ùs   ƒ)Úanyr)   )r,   r2   s    `r   Ú__contains__zTranslationCatalog.__contains__^   s   ø€ ÜÓ8¨¯©Ô8Ó8Ð8r   c              #   ób   K  — | j                   D ]  }|j                  «       E d {  –—†  Œ y 7 Œ­wr0   )r)   Úitems©r,   r3   s     r   rA   zTranslationCatalog.itemsa   s+   è ø€ Ø—>‘>ò 	#ˆCØ—y‘y“{×"Ñ"ñ	#Ø"úó   ‚#/¥-¦/c              #   ób   K  — | j                   D ]  }|j                  «       E d {  –—†  Œ y 7 Œ­wr0   )r)   ÚkeysrB   s     r   rE   zTranslationCatalog.keyse   s+   è ø€ Ø—>‘>ò 	"ˆCØ—x‘x“z×!Ñ!ñ	"Ø!úrC   c                 óˆ  — t        | j                  | j                  «      D ]E  \  }}|j                  j                  |j                  k(  sŒ*|j                  |j                  «        y  | j                  j                  d|j                  j                  «       «       | j                  j                  d|j                  «       y r6   )	Úzipr)   r+   r*   Ú__code__Úupdater'   Úinsertr(   )r,   r-   r3   r*   s       r   rI   zTranslationCatalog.updatei   sˆ   € ä˜tŸ~™~¨t¯}©}Ó=ò 	2‰KˆC�Ø�|‰|×$Ñ$¨¯©Ó7Ø—
‘
˜5Ÿ>™>Ô*Ùð	2ð
 �N‰N×!Ñ! ! U§^¡^×%8Ñ%8Ó%:Ô;Ø�M‰M× Ñ   E§L¡LÕ1r   c                 óp   — t        «       }| j                  D ]  }|j                  ||«      }||usŒ|c S  |S r0   )Úobjectr)   Úget)r,   r2   ÚdefaultÚmissingr3   Úresults         r   rM   zTranslationCatalog.gets   s@   € Ü“(ˆØ—>‘>ò 	ˆCØ—W‘W˜S 'Ó*ˆFØ˜WÒ$Ø’ð	ð ˆr   c                 óœ   — t        | j                  | j                  «      D ]$  \  }}|j                  | ||«      f«      }|€Œ"|c S  t        ‚r0   )rG   r)   r+   rM   r1   )r,   ÚmsgidÚnumr3   r*   Útmsgs         r   r*   zTranslationCatalog.plural{   sM   € Ü˜tŸ~™~¨t¯}©}Ó=ò 	‰KˆC�Ø—7‘7˜E¡6¨#£;Ð/Ó0ˆDØÑØ’ð	ô ˆr   r0   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r.   r4   r8   r?   rA   rE   rI   rM   r*   r;   r   r   r   r   I   s5   „ ñó
Mòò'ò9ò#ò"ò2óór   r   c                   ó\   — e Zd ZdZdZdd„Zd„ Zdd„Zd„ Zd„ Z	d	„ Z
dd
„Zd„ Zd„ Zd„ Zd„ Zy)ÚDjangoTranslationa]  
    Set up the GNUTranslations context with regard to output charset.

    This translation object will be constructed out of multiple GNUTranslations
    objects by merging their catalogs. It will construct an object for the
    requested language and add a fallback to the default language, if it's
    different from the requested language.
    ÚdjangoNc                 óÔ  — t         j                  j                  | «       |�|| _        || _        t        |«      | _        t        |«      | _        d| _	        d„ | _
        | j                  dk(  r.|�t        j                  dt        «       d}| j                  «        |r*|D ]$  }| j                  |«      }| j!                  |«       Œ& n| j#                  «        | j%                  «        | j                  t&        j(                  k(  r7| j                  dk(  r(| j                  €t+        dt&        j(                  z  «      ‚| j-                  |«       | j                  €t/        «       | _	        yy)z8Create a GNUTranslations() using many locale directoriesNc                 ó   — t        | dk7  «      S r!   r"   r$   s    r   r&   z,DjangoTranslation.__init__.<locals>.<lambda>›   s   € ¤ A¨¡F£€ r   r[   z.localedirs is ignored when domain is 'django'.z3No translation files found for default language %s.)Úgettext_moduleÚGNUTranslationsr.   ÚdomainÚ_DjangoTranslation__languager   Ú_DjangoTranslation__to_languager   Ú_DjangoTranslation__localer'   r*   ÚwarningsÚwarnÚRuntimeWarningÚ_init_translation_catalogÚ_new_gnu_transÚmergeÚ _add_installed_apps_translationsÚ_add_local_translationsr   r   ÚOSErrorÚ_add_fallbackr   )r,   Úlanguager`   Ú
localedirsÚ	localedirÚtranslations         r   r.   zDjangoTranslation.__init__�   sB  € ä×&Ñ&×/Ñ/°Ô5ØÐØ ˆDŒKà"ˆŒÜ(¨Ó2ˆÔÜ! (Ó+ˆŒØˆŒñ ,ˆŒà�;‰;˜(Ò"ØÐ%ä—‘ØDÄnôð "�
Ø×*Ñ*Ô,áØ'ò (�	Ø"×1Ñ1°)Ó<�Ø—
‘
˜;Õ'ñ(ð ×1Ñ1Ô3à×$Ñ$Ô&à�O‰Oœx×5Ñ5Ò5Ø—‘˜xÒ'Ø—‘Ð%ô ØEÜ×(Ñ(ñ)óð ð 	×Ñ˜:Ô&Ø�=‰=Ð ä.Ó0ˆD�Mð !r   c                 ó    — d| j                   z  S )Nz<DjangoTranslation lang:%s>©ra   ©r,   s    r   Ú__repr__zDjangoTranslation.__repr__½   s   € Ø,¨t¯©Ñ>Ð>r   c                 ó^   — t        j                  | j                  || j                  g|¬«      S )zü
        Return a mergeable gettext.GNUTranslations instance.

        A convenience wrapper. By default gettext uses 'fallback=False'.
        Using param `use_null_fallback` to avoid confusion with any other
        references to 'fallback'.
        )r`   rp   Ú	languagesÚfallback)r^   rq   r`   rc   )r,   rp   Úuse_null_fallbacks      r   rh   z DjangoTranslation._new_gnu_transÀ   s-   € ô ×)Ñ)Ø—;‘;ØØ—}‘}�oØ&ô	
ð 	
r   c                 ó  — t         j                  t        j                     j                  }t
        j                  j                  t
        j                  j                  |«      d«      }| j                  |«      }| j                  |«       y)z7Create a base catalog using global django translations.ÚlocaleN)ÚsysÚmodulesr   rV   Ú__file__ÚosÚpathÚjoinÚdirnamerh   ri   )r,   Úsettingsfilerp   rq   s       r   rg   z+DjangoTranslation._init_translation_catalogÏ   sY   € ä—{‘{¤8×#6Ñ#6Ñ7×@Ñ@ˆÜ—G‘G—L‘L¤§¡§¡°Ó!>ÀÓIˆ	Ø×)Ñ)¨)Ó4ˆØ�
‰
�;Õr   c                 óV  — 	 t        t        j                  «       «      }|D ]n  }t        j
                  j                  |j
                  d«      }t        j
                  j                  |«      sŒM| j                  |«      }| j                  |«       Œp y# t        $ r t        d«      ‚w xY w)z+Merge translations from each installed app.z˜The translation infrastructure cannot be initialized before the apps registry is ready. Check that you don't make non-lazy gettext calls at import time.r{   N)
Úreversedr   Úget_app_configsr   r   r€   r�   Úexistsrh   ri   )r,   Úapp_configsÚ
app_configrp   rq   s        r   rj   z2DjangoTranslation._add_installed_apps_translationsÖ   s’   € ð	Ü"¤4×#7Ñ#7Ó#9Ó:ˆKð &ò 	(ˆJÜŸ™Ÿ™ Z§_¡_°hÓ?ˆIÜ�w‰w�~‰~˜iÕ(Ø"×1Ñ1°)Ó<�Ø—
‘
˜;Õ'ñ		(øô #ò 	Ü%ð0óð ð	ús   ‚B ÂB(c                 ó„   — t        t        j                  «      D ]$  }| j                  |«      }| j	                  |«       Œ& y)z+Merge translations defined in LOCALE_PATHS.N)r…   r   ÚLOCALE_PATHSrh   ri   )r,   rp   rq   s      r   rk   z)DjangoTranslation._add_local_translationsæ   s8   € ä!¤(×"7Ñ"7Ó8ò 	$ˆIØ×-Ñ-¨iÓ8ˆKØ�J‰J�{Õ#ñ	$r   c                 ó6  — | j                   t        j                  k(  s| j                   j                  d«      ry| j                  dk(  rt        t        j                  «      }n&t        t        j                  | j                  |¬«      }| j                  |«       y)z=Set the GNUTranslations() fallback with the default language.ÚenNr[   )r`   ro   )ra   r   r   Ú
startswithr`   rq   rZ   Úadd_fallback)r,   ro   Údefault_translations      r   rm   zDjangoTranslation._add_fallbackì   sy   € ð �?‰?œh×4Ñ4Ò4¸¿¹×8RÑ8RØô9
ð Ø�;‰;˜(Ò"ä"-¬h×.DÑ.DÓ"EÑä"3Ü×&Ñ&¨t¯{©{Àzô#Ðð 	×ÑÐ-Õ.r   c                 ó@  — t        |dd«      sy| j                  €A|j                  | _        |j                  j	                  «       | _        t        |«      | _        n| j                  j                  |«       |j                  r| j                  |j                  «       yy)z,Merge another translation into this catalog.r'   N)	Úgetattrr'   r*   Ú_infor(   r   rI   Ú	_fallbackr�   )r,   Úothers     r   ri   zDjangoTranslation.mergeý   sv   € ä�u˜j¨$Ô/ØØ�=‰=Ð àŸ,™,ˆDŒKØŸ™×)Ñ)Ó+ˆDŒJÜ.¨uÓ5ˆD�Mà�M‰M× Ñ  Ô'Ø�?Š?Ø×Ñ˜eŸo™oÕ.ð r   c                 ó   — | j                   S )z Return the translation language.rs   rt   s    r   rn   zDjangoTranslation.language  s   € à�‰Ðr   c                 ó   — | j                   S )z%Return the translation language name.)rb   rt   s    r   r   zDjangoTranslation.to_language  s   € à×!Ñ!Ð!r   c                 óÎ   — 	 | j                   j                  ||«      }|S # t        $ r; | j                  r| j                  j	                  |||«      cY S |dk(  r|}Y |S |}Y |S w xY wr!   )r'   r*   r1   r”   Úngettext)r,   Úmsgid1Úmsgid2r%   rT   s        r   r™   zDjangoTranslation.ngettext  st   € ð	Ø—=‘=×'Ñ'¨°Ó2ˆDð ˆøô ò 	Ø�~Š~Ø—~‘~×.Ñ.¨v°v¸qÓAÒAØ�AŠvØ‘ð ˆð ‘Øˆð	ús   ‚   2A$ÁA$ÁA$Á#A$)NN)Tr0   )rU   rV   rW   rX   r`   r.   ru   rh   rg   rj   rk   rm   ri   rn   r   r™   r;   r   r   rZ   rZ   ƒ   sF   „ ñð €Fó,1ò\?ó
ò ò(ò $ó/ò"/òò"ó
r   rZ   c                 óH   — | t         vrt        | «      t         | <   t         |    S )zE
    Return a translation object in the default 'django' domain.
    )Ú_translationsrZ   ©rn   s    r   rq   rq      s&   € ð
 ”}Ñ$Ü"3°HÓ"=Œ�hÑÜ˜Ñ"Ð"r   c                 ó2   — | syt        | «      t        _        y)zˆ
    Fetch the translation object for a given language and install it as the
    current translation object for the current thread.
    N)rq   Ú_activer7   rž   s    r   Úactivater¡   *  s   € ñ
 ØÜ Ó)„G…Mr   c                  ó2   — t        t        d«      rt        `yy)zz
    Uninstall the active translation object so that further _() calls resolve
    to the default translation object.
    r7   N)Úhasattrr    r7   r;   r   r   Ú
deactivater¤   4  s   € ô
 Œw˜Ô Ü‰Mð !r   c                  ój   — t        j                  «       t        _        d„ t        j                  _        y)z¶
    Make the active translation object a NullTranslations() instance. This is
    useful when we want delayed translations to appear as the original string
    for some reason.
    c                   ó   — y r0   r;   )Úargss    r   r&   z deactivate_all.<locals>.<lambda>D  s   � r   N)r^   ÚNullTranslationsr    r7   r   r;   r   r   Údeactivate_allr©   =  s    € ô #×3Ñ3Ó5„G„MÙ 2„G‡M�MÕr   c                  ó¦   — t        t        dd«      } | �	 | j                  «       S t        j
                  S # t        $ r Y t        j
                  S w xY w)z'Return the currently selected language.r7   N)r’   r    r   ÚAttributeErrorr   r   ©Úts    r   Úget_languager®   G  sT   € ä”˜ $Ó'€AØ€}ð	Ø—=‘=“?Ð"ô ×!Ñ!Ð!øô ò 	Øä×!Ñ!Ð!ð	ús   •5 µ	AÁAc                  óx   — t        «       } | €yt        «       j                  d«      d   }|t        j                  v S )zw
    Return selected language's BiDi layout.

    * False = left-to-right layout
    * True = right-to-left layout
    Fú-r   )r®   Úsplitr   ÚLANGUAGES_BIDI)ÚlangÚ	base_langs     r   Úget_language_bidirµ   S  s;   € ô ‹>€DØ€|Øä “N×(Ñ(¨Ó-¨aÑ0ˆ	ØœH×3Ñ3Ð3Ð3r   c                  óv   — t        t        dd«      } | �| S t        €t        t        j
                  «      at        S )zÒ
    Return the current active catalog for further processing.
    This can be used if you need to modify the catalog or want to access the
    whole message catalog instead of just translating one string.
    r7   N©r’   r    Ú_defaultrq   r   r   r¬   s    r   Úcatalogr¹   b  s7   € ô 	”˜ $Ó'€AØ€}ØˆÜÐÜœx×5Ñ5Ó6ˆÜ€Or   c                 ó6  — | j                  dd«      j                  dd«      }|rHt        xs t        t        j                  «      at        t        dt        «      }|j                  |«      }n t        | «      d«      }t        | t        «      rt        |«      S |S )zÛ
    Translate the 'message' string. It uses the current thread to find the
    translation object to use. If no current translation is activated, the
    message will be run through the default translation object.
    z
ú
úr7   Ú )Úreplacer¸   rq   r   r   r’   r    ÚgettextÚtypeÚ
isinstancer   r   )ÚmessageÚeol_messageÚtranslation_objectrP   s       r   r¿   r¿   r  s„   € ð —/‘/ &¨$Ó/×7Ñ7¸¸dÓC€KáÜÒBœ{¬8×+AÑ+AÓBˆÜ$¤W¨g´xÓ@Ðà#×+Ñ+¨KÓ8‰ð ”�g“˜rÓ"ˆä�'œ8Ô$Ü˜Ó Ð à€Mr   c                 ó‚   — | ›t         ›|›�}t        |«      }t         |v r|}|S t        |t        «      rt	        |«      }|S r0   )ÚCONTEXT_SEPARATORr¿   rÁ   r   r   )ÚcontextrÂ   Úmsg_with_ctxtrP   s       r   ÚpgettextrÉ   Œ  sH   € Ù 'Õ):¹GÐD€MÜ�]Ó#€FÜ˜FÑ"àˆð €Mô 
�GœXÔ	&Ü˜6Ó"ˆØ€Mr   c                 ó   — | S )zò
    Mark strings for translation but don't translate them now. This can be
    used to store strings in global variables that should stay in the base
    language (because they might be used externally) and will be translated
    later.
    r;   )rÂ   s    r   Úgettext_nooprË   —  s	   € ð €Nr   c                 ó¾   — t        t        dd «      }|� t        ||«      | ||«      S t        €t        t        j
                  «      a t        t        |«      | ||«      S )Nr7   r·   )Úsingularr*   ÚnumberÚtranslation_functionr­   s        r   Údo_ntranslaterÐ   ¡  s_   € ô 	”˜ $Ó'€AØ€}Ø/Œw�qÐ.Ó/°¸&À&ÓIÐIÜÐÜœx×5Ñ5Ó6ˆØ2Œ7”8Ð1Ó2°8¸VÀVÓLÐLr   c                 ó   — t        | ||d«      S )zg
    Return a string of the translation of either the singular or plural,
    based on the number.
    r™   )rÐ   )rÍ   r*   rÎ   s      r   r™   r™   ¬  s   € ô
 ˜ 6¨6°:Ó>Ð>r   c                 ór   — | ›t         ›|›�| ›t         ›|›�|f}t        |Ž }t         |v rt        |||«      }|S r0   )rÆ   r™   )rÇ   rÍ   r*   rÎ   Úmsgs_with_ctxtrP   s         r   Ú	npgettextrÔ   ´  sI   € áÕ.±Ð9ÙÕ.±Ð7Øð€Nô
 �~Ð&€FÜ˜FÑ"ä˜( F¨FÓ3ˆØ€Mr   c                  óä  — t         j                  j                  t         j                  j                  t        j
                  t        j                     j                  «      d«      } g }t        j                  «       D ]]  }t         j                  j                  |j                  d«      }t         j                  j                  |«      sŒM|j                  |«       Œ_ | gt        j                  ¢|¢S )zB
    Return a list of paths to user-provides languages files.
    r{   )r   r€   r�   r‚   r|   r}   r   rV   r~   r   r†   r‡   Úappendr‹   )Ú
globalpathÚ	app_pathsr‰   Úlocale_paths       r   Úall_locale_pathsrÚ   Á  s­   € ô —‘—‘Ü
�‰�‰œŸ™¤H×$7Ñ$7Ñ8×AÑAÓBÀHó€Jð €IÜ×*Ñ*Ó,ò *ˆ
Ü—g‘g—l‘l :§?¡?°HÓ=ˆÜ�7‰7�>‰>˜+Õ&Ø×Ñ˜[Õ)ð*ð Ð;œ×.Ñ.Ð;°Ð;Ð;r   iè  )Úmaxsizec                 ól   ‡ — ‰ �t         j                  ‰ «      syt        ˆ fd„t        «       D «       «      S )a…  
    Check whether there is a global language file for the given language
    code. This is used to decide whether a user-provided language is
    available.

    lru_cache should have a maxsize to prevent from memory exhaustion attacks,
    as the provided language codes are taken from the HTTP request. See also
    <https://www.djangoproject.com/weblog/2007/oct/26/security-fix/>.
    Fc              3   ód   •K  — | ]'  }t        j                  d |t        ‰«      g«      du–— Œ) y­w)r[   N)r^   Úfindr   )r<   r€   Ú	lang_codes     €r   r=   z%check_for_language.<locals>.<genexpr>Þ  s5   øè ø€ ò àô 	×Ñ˜H d¬Y°yÓ-AÐ,BÓCÈ4ÔOñùs   ƒ-0)Úlanguage_code_reÚsearchr>   rÚ   )rß   s   `r   r   r   Ð  s9   ø€ ð ÐÔ 0× 7Ñ 7¸	Ô BØÜó ä$Ó&ôó ð r   c                  ó    — t        t        j                  «      j                  «       D � �ci c]  \  } }| j	                  «       |“Œ c}} S c c}} w )z›
    Cache of settings.LANGUAGES in a dictionary for easy lookups by key.
    Convert keys to lowercase as they should be treated as case-insensitive.
    )Údictr   r   rA   Úlower)r2   r7   s     r   r   r   ä  s;   € ô 26´h×6HÑ6HÓ1I×1OÑ1OÓ1Q×R¡: 3¨ˆC�I‰I‹K˜ÑÓRÐRùÓRs   «A
c                 ó<  — | �r t        | «      t        kD  r/|s"| j                  ddt        «      x}dkD  r| d| } nt        | «      ‚| g}	 |j	                  t
        |    d   «       d}| j                  dd|«      x}dkD  r-|j                  | d| «       | j                  dd|«      x}dkD  rŒ-|d   }t        «       }|D ]$  }|j                  «       |v sŒt        |«      sŒ"|c S  |s|D ]  }|j                  |dz   «      sŒ|c S  t        | «      ‚# t        $ r Y Œ¶w xY w)a}  
    Return the language code that's listed in supported languages, possibly
    selecting a more generic variant. Raise LookupError if nothing is found.

    If `strict` is False (the default), look for a country-specific variant
    when neither the language code nor its generic variant is found.

    The language code is truncated to a maximum length to avoid potential
    denial of service attacks.

    lru_cache should have a maxsize to prevent from memory exhaustion attacks,
    as the provided language codes are taken from the HTTP request. See also
    <https://www.djangoproject.com/weblog/2007/oct/26/security-fix/>.
    r°   r   Nrx   éÿÿÿÿ)ÚlenÚLANGUAGE_CODE_MAX_LENGTHÚrfindÚLookupErrorÚextendr   r1   rÖ   r   rä   r   rŽ   )	rß   ÚstrictÚindexÚpossible_lang_codesÚiÚgeneric_lang_codeÚsupported_lang_codesÚcodeÚsupported_codes	            r   r   r   í  sS  € ò  ô ˆy‹>Ô4Ò4áØ'Ÿo™o¨c°1Ô6NÓOÐO�UÐSTÒTð & f uÐ-‘	ä! )Ó,Ð,ð  )˜kÐð	Ø×&Ñ&¤y°Ñ';¸JÑ'GÔHð ˆØ—O‘O C¨¨AÓ.Ð.ˆq°"Ò4Ø×&Ñ& y°°! }Ô5ð —O‘O C¨¨AÓ.Ð.ˆq°"Ó4à/°Ñ3ÐÜ,›Ðà'ò 	ˆDØ�z‰z‹|Ð3Ò3Ô8JÈ4Õ8PØ’ð	ñ à"6ò *�Ø!×,Ñ,Ð->ÀÑ-DÕEØ)Ò)ð*ô �iÓ
 Ð øô! ò 	Ùð	ús   Á	D Ä	DÄDc                 óv   — t         j                  | «      }|sy|d   }	 t        ||¬«      S # t        $ r Y yw xY w)zæ
    Return the language code if there's a valid language code found in `path`.

    If `strict` is False (the default), look for a country-specific variant
    when neither the language code nor its generic variant is found.
    Nr   )rì   )Úlanguage_code_prefix_reÚmatchr   rê   )r€   rì   Úregex_matchrß   s       r   Úget_language_from_pathrø   !  sG   € ô *×/Ñ/°Ó5€KÙØØ˜A‘€IðÜ-¨iÀÔGÐGøÜò Ùðús   Ÿ, ¬	8·8c                 ó8  — |rt        | j                  «      }|�|S | j                  j                  t        j
                  «      }|�|t        «       v rt        |«      r|S 	 t        |«      S # t        $ r Y nw xY w| j                  j                  dd«      }t        |«      D ]>  \  }}|dk(  r n4t        j                  |«      sŒ#	 t        |«      c S # t        $ r Y Œ<w xY w 	 t        t        j                  «      S # t        $ r t        j                  cY S w xY w)a—  
    Analyze the request to find what language the user wants the system to
    show. Only languages listed in settings.LANGUAGES are taken into account.
    If the user requests a sublanguage where we have a main language, we send
    out the main language.

    If check_path is True, the URL path prefix will be checked for a language
    code, otherwise this is skipped for backwards compatibility.
    ÚHTTP_ACCEPT_LANGUAGEr½   Ú*)rø   Ú	path_infoÚCOOKIESrM   r   ÚLANGUAGE_COOKIE_NAMEr   r   r   rê   ÚMETAÚparse_accept_lang_headerrà   rá   r   )ÚrequestÚ
check_pathrß   ÚacceptÚaccept_langÚunuseds         r   Úget_language_from_requestr  2  s  € ñ Ü*¨7×+<Ñ+<Ó=ˆ	ØÐ ØÐà—‘×#Ñ#¤H×$AÑ$AÓB€IàÐØœ›Ñ(Ü˜yÔ)àÐðÜ-¨iÓ8Ð8øÜò Ùðúð �\‰\×ÑÐ4°bÓ9€FÜ7¸Ó?ò 
Ñˆ�VØ˜#ÒÙä×&Ñ& {Ô3Øð	Ü1°+Ó>Ò>øÜò 	Ùð	úð
ð&Ü-¬h×.DÑ.DÓEÐEøÜò &Ü×%Ñ%Ò%ð&ús6   Á!
A, Á,	A8Á7A8Ã
CÃ	CÃCÃ$C= Ã=DÄDc                 ó8  — g }t         j                  | j                  «       «      }|d   ryt        dt	        |«      dz
  d«      D ]5  }|||dz    \  }}}|r y|rt        |«      }nd}|j                  ||f«       Œ7 |j                  d„ d¬	«       t        |«      S )
zá
    Parse the lang_string, which is the body of an HTTP Accept-Language
    header, and return a tuple of (lang, q-value), ordered by 'q' values.

    Return an empty tuple if there are any format errors in lang_string.
    ræ   r;   r   r   é   g      ð?c                 ó   — | d   S r!   r;   )Úks    r   r&   z+_parse_accept_lang_header.<locals>.<lambda>v  s
   € ˜a ™d€ r   T)r2   Úreverse)	Úaccept_language_rer±   rä   Úrangerç   ÚfloatrÖ   ÚsortÚtuple)Úlang_stringrP   Úpiecesrï   Úfirstr³   Úprioritys          r   Ú_parse_accept_lang_headerr  a  s§   € ð €FÜ×%Ñ% k×&7Ñ&7Ó&9Ó:€FØˆb‚zØÜ�1”c˜&“k A‘o qÓ)ò (ˆØ & q¨1¨q©5Ð 1Ñˆˆt�XÙÙÙÜ˜X“‰HàˆHØ�‰�t˜XÐ&Õ'ð(ð ‡K�K‘N¨D€KÔ1Ü�‹=Ðr   c                 ó’   — t        | «      t        k  rt        | «      S | j                  ddt        «      x}dkD  rt        | d| «      S y)aŽ  
    Parse the value of the Accept-Language header up to a maximum length.

    The value of the header is truncated to a maximum length to avoid potential
    denial of service and memory exhaustion attacks. Excessive memory could be
    used if the raw value is very large as it would be cached due to the use of
    functools.lru_cache() to avoid repetitive parsing of common header values.
    ú,r   Nr;   )rç   rè   r  ré   )r  rí   s     r   r   r   z  sS   € ô ˆ;ÓÔ3Ò3Ü(¨Ó5Ð5ð
 ×"Ñ" 3¨Ô+CÓDÐDˆÈÒIÜ(¨°V°eÐ)<Ó=Ð=ð r   )F)ArX   Ú	functoolsr¿   r^   r   Úrer|   rd   Úasgiref.localr   Údjango.appsr   Údjango.confr   Údjango.conf.localer   Údjango.core.exceptionsr   Údjango.core.signalsr   Údjango.dispatchr	   Údjango.utils.regex_helperr
   Údjango.utils.safestringr   r   r½   r   r   r�   r    r¸   rÆ   rè   ÚVERBOSEr  Ú
IGNORECASErà   rõ   r   r   r_   rZ   rq   r¡   r¤   r©   r®   rµ   r¹   rÉ   rË   rÐ   r™   rÔ   rÚ   Ú	lru_cacher   r   r   rø   r  r  r   r;   r   r   ú<module>r&     s¬  ðÙ #ã Û  Û 	Û 	Û 
Û å å Ý  Ý (Ý 6Ý /Ý $Ý 6ß 7ç $ð €Ù
‹'€ð €ð Ð ð Ð ñ &ðð ‡J�Jó
Ð ñ $Ø:¸B¿M¹MóÐ ñ +Ð+HÓIÐ ñ 
ˆ/Óñ5ó ð5÷7ñ 7ôtZ˜×6Ñ6ô Zòz#ò*òò3ò	"ò4òò ò4òòMò?ò
ò<ð €×Ñ˜TÔ"ñó #ðð& ×ÑñSó ðSð €×Ñ˜TÔ"ò0!ó #ð0!ófó",&ð^ €×Ñ˜TÔ"ñó #ðó0r   