Ë
    Ìi’Z  ã            	      óè  — U d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	m
Z
mZ dZdZ	 	 	 	 d7d„Z G d	„ d
«      Zd8d„Z	 	 	 	 d9d„Zd8d„Z	 	 	 	 	 	 d:d„Z	 	 	 	 	 	 d:d„Zd;d„Z G d„ de«      Zh d£Zd ej2                  dej4                  «      fd ej2                  ddj7                  e«      › d�«      fd ej2                  d«      fd ej2                  d«      fd ej2                  dej4                  «      fgZded <   d<d!„Z	 d=	 	 	 	 	 	 	 d>d"„Zd=d?d#„Z d@d$„Z!dAd%„Z"	 	 	 	 dBd&„Z#dCd'„Z$ G d(„ d)«      Z%d*„ Z&d+„ Z'd,„ Z( G d-„ d.«      Z) G d/„ d0e)«      Z* G d1„ d2e)«      Z+ G d3„ d4e+«      Z, G d5„ d6e)«      Z-y)Dzœ
babel.numbers
~~~~~~~~~~~~~

CLDR Plural support.  See UTS #35.

:copyright: (c) 2013-2026 by the Babel Team.
:license: BSD, see LICENSE for more details.
é    )ÚannotationsN)ÚIterableÚMapping)ÚAnyÚCallableÚLiteral)ÚzeroÚoneÚtwoÚfewÚmanyÚotherr   c                ó  — t        | «      }t        |«      }t        |t        «      r&||k(  r|}nt	        j
                  t        |«      «      }t        |t        j
                  «      r�|j                  «       }|j                  }|dk  r|j                  |d nd}dj                  d„ |D «       «      }|j                  d«      }t        |«      }t        |«      }	t        |xs d«      }
t        |xs d«      }ndx}x}	x}
}dx}}||||	|
|||fS )u÷  Extract operands from a decimal, a float or an int, according to `CLDR rules`_.

    The result is an 8-tuple (n, i, v, w, f, t, c, e), where those symbols are as follows:

    ====== ===============================================================
    Symbol Value
    ------ ---------------------------------------------------------------
    n      absolute value of the source number (integer and decimals).
    i      integer digits of n.
    v      number of visible fraction digits in n, with trailing zeros.
    w      number of visible fraction digits in n, without trailing zeros.
    f      visible fractional digits in n, with trailing zeros.
    t      visible fractional digits in n, without trailing zeros.
    c      compact decimal exponent value: exponent of the power of 10 used in compact decimal formatting.
    e      currently, synonym for â€˜câ€™. however, may be redefined in the future.
    ====== ===============================================================

    .. _`CLDR rules`: https://www.unicode.org/reports/tr35/tr35-61/tr35-numbers.html#Operands

    :param source: A real number
    :type source: int|float|decimal.Decimal
    :return: A n-i-v-w-f-t-c-e tuple
    :rtype: tuple[decimal.Decimal, int, int, int, int, int, int, int]
    r   N© Ú c              3  ó2   K  — | ]  }t        |«      –— Œ y ­w©N©Ústr)Ú.0Úds     úM/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/babel/plural.pyú	<genexpr>z#extract_operands.<locals>.<genexpr>G   s   è ø€ Ò; aœ3˜qŸ6Ñ;ùs   ‚Ú0)ÚabsÚintÚ
isinstanceÚfloatÚdecimalÚDecimalr   Úas_tupleÚexponentÚdigitsÚjoinÚrstripÚlen)ÚsourceÚnÚiÚ	dec_tupleÚexpÚfraction_digitsÚtrailingÚno_trailingÚvÚwÚfÚtÚcÚes                 r   Úextract_operandsr5      s  € ô6 	ˆF‹€AÜˆA‹€AÜ�!”UÔØ�Š6Ø‰Aô —‘¤ A£Ó'ˆAä�!”W—_‘_Ô%Ø—J‘J“Lˆ	Ø× Ñ ˆØ47¸!²G˜)×*Ñ*¨3¨4Ñ0ÀˆØ—7‘7Ñ;¨?Ô;Ó;ˆØ—o‘o cÓ*ˆÜ�‹MˆÜ�ÓˆÜ�’˜AÓˆÜ�Ò ˜qÓ!‰àÐˆÐˆAÐ��AØ€I€AˆØˆa��A�q˜!˜Q Ð!Ð!ó    c                  óz   — e Zd ZdZdZdd„Zdd„Ze	 	 	 	 dd„«       Ze	dd„«       Z
e	dd„«       Zdd„Zdd	„Zdd
„Zy)Ú
PluralRuleaf  Represents a set of language pluralization rules.  The constructor
    accepts a list of (tag, expr) tuples or a dict of `CLDR rules`_. The
    resulting object is callable and accepts one parameter with a positive or
    negative number (both integer and float) for the number that indicates the
    plural form for a string and returns the tag for the format:

    >>> rule = PluralRule({'one': 'n is 1'})
    >>> rule(1)
    'one'
    >>> rule(2)
    'other'

    Currently the CLDR defines these tags: zero, one, two, few, many and
    other where other is an implicit default.  Rules should be mutually
    exclusive; for a given numeric value, only one rule should apply (i.e.
    the condition should only be true for one of the plural rule elements.

    .. _`CLDR rules`: https://www.unicode.org/reports/tr35/tr35-33/tr35-numbers.html#Language_Plural_Rules
    )ÚabstractÚ_funcc                ój  — t        |t        «      r|j                  «       }t        «       }g | _        t        |«      D ]t  \  }}|t        vrt        d|›�«      ‚||v rt        d|›d�«      ‚|j                  |«       t        |«      j                  }|sŒX| j                  j                  ||f«       Œv y)a$  Initialize the rule instance.

        :param rules: a list of ``(tag, expr)``) tuples with the rules
                      conforming to UTS #35 or a dict with the tags as keys
                      and expressions as values.
        :raise RuleError: if the expression is malformed
        zunknown tag ztag z defined twiceN)r   r   ÚitemsÚsetr9   ÚsortedÚ_plural_tagsÚ
ValueErrorÚaddÚ_ParserÚastÚappend)ÚselfÚrulesÚfoundÚkeyÚexprrC   s         r   Ú__init__zPluralRule.__init__j   s¦   € ô �eœWÔ%Ø—K‘K“MˆEÜ“ˆØ/1ˆŒÜ ›ò 	1‰IˆC�Øœ,Ñ&Ü  <°¨wÐ!7Ó8Ð8Ø˜‘Ü  4¨ w¨nÐ!=Ó>Ð>Ø�I‰I�cŒNÜ˜$“-×#Ñ#ˆCÚØ—‘×$Ñ$ c¨3 ZÕ0ñ	1r6   c                ó�   ‡— | j                   Šdj                  ˆfd„t        D «       «      }dt        | «      j                  › d|›d�S )Nú, c              3  ó<   •K  — | ]  }|‰v sŒ|› d ‰|   › �–— Œ y­w)z: Nr   )r   ÚtagrF   s     €r   r   z&PluralRule.__repr__.<locals>.<genexpr>‚   s'   øè ø€ ÒX°CÈ3ÐRWÊ<˜C˜5  5¨¡: ,Ô/ÑXùs   ƒ	�ú<ú ú>)rF   r$   r?   ÚtypeÚ__name__)rE   ÚargsrF   s     @r   Ú__repr__zPluralRule.__repr__€   s@   ø€ Ø—
‘
ˆØ�y‰yÓX¼<ÔXÓXˆØ”4˜“:×&Ñ&Ð' q¨¨°Ð2Ð2r6   c                ó6   — t        |t        «      r|S  | |«      S )a
  Create a `PluralRule` instance for the given rules.  If the rules
        are a `PluralRule` object, that object is returned.

        :param rules: the rules as list or dict, or a `PluralRule` object
        :raise RuleError: if the expression is malformed
        )r   r8   )ÚclsrF   s     r   ÚparsezPluralRule.parse…   s   € ô �eœZÔ(ØˆLÙ�5‹zÐr6   c                ó‚   — t        «       j                  }| j                  D ��ci c]  \  }}| ||«      “Œ c}}S c c}}w )zŸThe `PluralRule` as a dict of unicode plural rules.

        >>> rule = PluralRule({'one': 'n is 1'})
        >>> rule.rules
        {'one': 'n is 1'}
        )Ú_UnicodeCompilerÚcompiler9   )rE   Ú_compilerN   rC   s       r   rF   zPluralRule.rules”   s7   € ô $Ó%×-Ñ-ˆØ37·=±=×A¡x s¨C�‘X˜c“]Ñ"ÓAÐAùÓAs   ¤;c                ó:   — t        d„ | j                  D «       «      S )z°A set of explicitly defined tags in this rule.  The implicit default
        ``'other'`` rules is not part of this set unless there is an explicit
        rule for it.
        c              3  ó&   K  — | ]	  }|d    –— Œ y­w)r   Nr   )r   r)   s     r   r   z"PluralRule.tags.<locals>.<genexpr>¥   s   è ø€ Ò5 !˜˜1�Ñ5ùs   ‚)Ú	frozensetr9   ©rE   s    r   ÚtagszPluralRule.tagsŸ   s   € ô Ñ5 t§}¡}Ô5Ó5Ð5r6   c                ó   — | j                   S r   ©r9   r`   s    r   Ú__getstate__zPluralRule.__getstate__§   s   € Ø�}‰}Ðr6   c                ó   — || _         y r   rc   )rE   r9   s     r   Ú__setstate__zPluralRule.__setstate__ª   s	   € Ø ˆ�r6   c                ó\   — t        | d«      st        | «      | _        | j                  |«      S )Nr:   )ÚhasattrÚ	to_pythonr:   )rE   r(   s     r   Ú__call__zPluralRule.__call__­   s%   € Ü�t˜WÔ%Ü" 4›ˆDŒJØ�z‰z˜!‹}Ðr6   N)rF   z-Mapping[str, str] | Iterable[tuple[str, str]]ÚreturnÚNone)rk   r   )rF   ú:Mapping[str, str] | Iterable[tuple[str, str]] | PluralRulerk   r8   )rk   zMapping[str, str])rk   zfrozenset[str])rk   úlist[tuple[str, Any]])r9   rn   rk   rl   )r(   úfloat | decimal.Decimalrk   r   )rS   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__rJ   rU   ÚclassmethodrX   ÚpropertyrF   ra   rd   rf   rj   r   r6   r   r8   r8   S   sw   „ ñð( &€Ió1ó,3ð
 ðàIðð 
òó ðð òBó ðBð ò6ó ð6óó!ôr6   r8   c                ó
  — t        «       j                  }dg}t        j                  | «      j                  D ]"  \  }}|j                   ||«      › d|›d�«       Œ$ |j                  dt        z  «       dj                  |«      S )a‚  Convert a list/dict of rules or a `PluralRule` object into a JavaScript
    function.  This function depends on no external library:

    >>> to_javascript({'one': 'n is 1'})
    "(function(n) { return (n == 1) ? 'one' : 'other'; })"

    Implementation detail: The function generated will probably evaluate
    expressions involved into range operations multiple times.  This has the
    advantage that external helper functions are not required and is not a
    big performance hit for these simple calculations.

    :param rule: the rules as list or dict, or a `PluralRule` object
    :raise RuleError: if the expression is malformed
    z(function(n) { return ú ? ú : z%r; })r   )Ú_JavaScriptCompilerr[   r8   rX   r9   rD   Ú_fallback_tagr$   )ÚruleÚto_jsÚresultrN   rC   s        r   Úto_javascriptr~   ³   sz   € ô  Ó!×)Ñ)€EØ&Ð'€FÜ×$Ñ$ TÓ*×3Ñ3ò 4‰ˆˆSØ�‰™˜s›˜ C¨ w¨cÐ2Õ3ð4à
‡M�M�(œ]Ñ*Ô+Ø�7‰7�6‹?Ðr6   c           	     ó„  — t         t        t        t        dœ}t	        «       j
                  }ddg}t        j                  | «      j                  D ]+  \  }}|j                  d ||«      › dt        |«      ›�«       Œ- |j                  dt        ›�«       t        dj                  |«      dd	«      }t        ||«       |d
   S )a<  Convert a list/dict of rules or a `PluralRule` object into a regular
    Python function.  This is useful in situations where you need a real
    function and don't are about the actual rule object:

    >>> func = to_python({'one': 'n is 1', 'few': 'n in 2..4'})
    >>> func(1)
    'one'
    >>> func(3)
    'few'
    >>> func = to_python({'one': 'n in 1,11', 'few': 'n in 3..10,13..19'})
    >>> func(11)
    'one'
    >>> func(15)
    'few'

    :param rule: the rules as list or dict, or a `PluralRule` object
    :raise RuleError: if the expression is malformed
    )ÚINÚWITHINÚMODr5   zdef evaluate(n):z- n, i, v, w, f, t, c, e = extract_operands(n)z if (z
): return z return ú
z<rule>ÚexecÚevaluate)Úin_range_listÚwithin_range_listÚcldr_modulor5   Ú_PythonCompilerr[   r8   rX   r9   rD   r   rz   r$   Úeval)r{   Ú	namespaceÚto_python_funcr}   rN   rC   Úcodes          r   ri   ri   Ê   sÃ   € ô, Ü#ÜÜ,ñ	€Iô %Ó&×.Ñ.€NàØ7ð€Fô ×$Ñ$ TÓ*×3Ñ3ò K‰ˆˆSð 	�‰˜™n¨SÓ1Ð2°*¼SÀ»X¸LÐIÕJðKð ‡M�M�Hœ]Ð-Ð.Ô/Ü�4—9‘9˜VÓ$ h°Ó7€DÜˆˆyÔØ�ZÑ Ð r6   c                ó¸  — t         j                  | «      } | j                  t        hz  }t	        «       j
                  }t        D �cg c]	  }||v sŒ|‘Œ c}j                  }dt        |«      › d�g}| j                  D ](  \  }}|j                   ||«      › d ||«      › d�«       Œ* |j                   |t        «      › d�«       dj                  |«      S c c}w )a  The plural rule as gettext expression.  The gettext expression is
    technically limited to integers and returns indices rather than tags.

    >>> to_gettext({'one': 'n is 1', 'two': 'n is 2'})
    'nplurals=3; plural=((n == 1) ? 0 : (n == 2) ? 1 : 2);'

    :param rule: the rules as list or dict, or a `PluralRule` object
    :raise RuleError: if the expression is malformed
    z	nplurals=z
; plural=(rw   rx   z);r   )r8   rX   ra   rz   Ú_GettextCompilerr[   r?   Úindexr&   r9   rD   r$   )r{   Ú	used_tagsr\   rN   Ú
_get_indexr}   rC   s          r   Ú
to_gettextr“   ô   sÍ   € ô ×Ñ˜DÓ!€Dà—	‘	œ]˜OÑ+€IÜÓ!×)Ñ)€HÜ!-ÖB˜#°¸	Ò1A’#ÒB×HÑH€Jàœ#˜i›.Ð)¨Ð4Ð5€FØ—M‘Mò A‰ˆˆSØ�‰™ #›˜ s©:°c«?Ð*;¸3Ð?Õ@ðAà
‡M�M‘Z¤Ó.Ð/¨rÐ2Ô3Ø�7‰7�6‹?Ðùò Cs   Á	CÁCc                ó:   — | t        | «      k(  xr t        | |«      S )a™  Integer range list test.  This is the callback for the "in" operator
    of the UTS #35 pluralization rule language:

    >>> in_range_list(1, [(1, 3)])
    True
    >>> in_range_list(3, [(1, 3)])
    True
    >>> in_range_list(3, [(1, 3), (5, 8)])
    True
    >>> in_range_list(1.2, [(1, 4)])
    False
    >>> in_range_list(10, [(1, 4)])
    False
    >>> in_range_list(10, [(1, 4), (6, 8)])
    False
    )r   r‡   ©ÚnumÚ
range_lists     r   r†   r†     s   € ð( ”#�c“(‰?ÒAÔ0°°jÓAÐAr6   c                ó,   ‡ — t        ˆ fd„|D «       «      S )a¶  Float range test.  This is the callback for the "within" operator
    of the UTS #35 pluralization rule language:

    >>> within_range_list(1, [(1, 3)])
    True
    >>> within_range_list(1.0, [(1, 3)])
    True
    >>> within_range_list(1.2, [(1, 4)])
    True
    >>> within_range_list(8.8, [(1, 4), (7, 15)])
    True
    >>> within_range_list(10, [(1, 4)])
    False
    >>> within_range_list(10.5, [(1, 4), (20, 30)])
    False
    c              3  óD   •K  — | ]  \  }}|‰cxk  xr |k  nc –— Œ y ­wr   r   )r   Úmin_Úmax_r–   s      €r   r   z$within_range_list.<locals>.<genexpr>6  s"   øè ø€ Ò@¡z t¨Tˆt�sÖ"˜d×"Ð"Ñ@ùs   ƒ )Úanyr•   s   ` r   r‡   r‡   "  s   ø€ ô( Ó@°ZÔ@Ó@Ð@r6   c                óN   — d}| dk  r| dz  } d}|dk  r|dz  }| |z  }|r|dz  }|S )zîJavaish modulo.  This modulo operator returns the value with the sign
    of the dividend rather than the divisor like Python does:

    >>> cldr_modulo(-3, 5)
    -3
    >>> cldr_modulo(-3, -5)
    -3
    >>> cldr_modulo(3, 5)
    3
    r   éÿÿÿÿé   r   )ÚaÚbÚreverseÚrvs       r   rˆ   rˆ   9  sH   € ð €GØˆ1‚uØ	ˆR‰ˆØˆØˆ1‚uØ	ˆR‰ˆØ	
ˆQ‰€BÙØ
ˆb‰ˆØ€Ir6   c                  ó   — e Zd ZdZy)Ú	RuleErrorzRaised if a rule is malformed.N)rS   rp   rq   rr   r   r6   r   r¥   r¥   P  s   „ Ú(r6   r¥   >   r3   r4   r1   r)   r(   r2   r/   r0   z\s+Úwordz"\b(and|or|is|(?:with)?in|not|mod|[r   z])\bÚvaluez\d+Úsymbolz%|,|!=|=Úellipsisz\.{2,3}|\u2026z(list[tuple[str | None, re.Pattern[str]]]Ú_RULESc                ó>  — | j                  d«      d   } g }d}t        | «      }||k  rnt        D ]N  \  }}|j                  | |«      }|€Œ|j	                  «       }|r!|j                  ||j                  «       f«        n t        d| |   ›�«      ‚||k  rŒn|d d d…   S )Nú@r   z3malformed CLDR pluralization rule.  Got unexpected rž   )Úsplitr&   rª   ÚmatchÚendrD   Úgroupr¥   )Úsr}   Úposr¯   Útokr{   r®   s          r   Útokenize_ruler´   h  s¶   € Ø	�‰�‹�Q‰€AØ$&€FØ
€CÜ
ˆa‹&€CØ
�Š)Üò 	^‰IˆC�Ø—J‘J˜q #Ó&ˆEØÑ Ø—i‘i“k�ÙØ—M‘M 3¨¯©«Ð"6Ô7Ùð	^ô ÐQÐRSÐTWÑRXÐQ[Ð\Ó]Ð]ð �‹)ð ‘$�B�$‰<Ðr6   c                óF   — | xr | d   d   |k(  xr |d u xs | d   d   |k(  S )Nrž   r   rŸ   r   ©ÚtokensÚtype_r§   s      r   Útest_next_tokenr¹   z  s8   € ð
 ÒZ�f˜R‘j ‘m uÑ,ÒZ°%¸4°-Ò2YÀ6È"Á:ÈaÁ=ÐTYÑCYÐZr6   c                ó>   — t        | ||«      r| j                  «       S y r   )r¹   Úpopr¶   s      r   Ú
skip_tokenr¼   ‚  s   € Ü�v˜u eÔ,Ø�z‰z‹|Ðð -r6   c                ó   — d| ffS )Nr§   r   )r§   s    r   Ú
value_noder¾   ‡  s   € Ø�U�HÐÐr6   c                ó
   — | dfS )Nr   r   )Únames    r   Ú
ident_noderÁ   ‹  s   € Ø�ˆ8€Or6   c                ó
   — d| fS )Nr—   r   )r—   s    r   Úrange_list_noderÃ   �  s   € ð ˜Ð#Ð#r6   c                ó   — d| ffS )NÚnotr   )r£   s    r   ÚnegaterÆ   •  s   € Ø�2�%ˆ<Ðr6   c                  óN   — e Zd ZdZd„ Zdd„Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zy)rB   uò  Internal parser.  This class can translate a single rule into an abstract
    tree of tuples. It implements the following grammar::

        condition     = and_condition ('or' and_condition)*
                        ('@integer' samples)?
                        ('@decimal' samples)?
        and_condition = relation ('and' relation)*
        relation      = is_relation | in_relation | within_relation
        is_relation   = expr 'is' ('not')? value
        in_relation   = expr (('not')? 'in' | '=' | '!=') range_list
        within_relation = expr ('not')? 'within' range_list
        expr          = operand (('mod' | '%') value)?
        operand       = 'n' | 'i' | 'f' | 't' | 'v' | 'w'
        range_list    = (range | value) (',' range_list)*
        value         = digit+
        digit         = 0|1|2|3|4|5|6|7|8|9
        range         = value'..'value
        samples       = sampleRange (',' sampleRange)* (',' ('â€¦'|'...'))?
        sampleRange   = decimalValue '~' decimalValue
        decimalValue  = value ('.' value)?

    - Whitespace can occur between or around any of the above tokens.
    - Rules should be mutually exclusive; for a given numeric value, only one
      rule should apply (i.e. the condition should only be true for one of
      the plural rule elements).
    - The in and within relations can take comma-separated lists, such as:
      'n in 3,5,7..15'.
    - Samples are ignored.

    The translator parses the expression on instantiation into an attribute
    called `ast`.
    c                óÊ   — t        |«      | _        | j                  sd | _        y | j                  «       | _        | j                  rt	        d| j                  d   d   ›�«      ‚y )NzExpected end of rule, got rž   rŸ   )r´   r·   rC   Ú	conditionr¥   )rE   Ústrings     r   rJ   z_Parser.__init__»  s\   € Ü# FÓ+ˆŒØ�{Š{ð ˆDŒHØØ—>‘>Ó#ˆŒØ�;Š;ÜÐ8¸¿¹ÀR¹ÈÑ9KÐ8NÐOÓPÐPð r6   Nc                óÞ   — t        | j                  ||«      }|�|S |€t        |d u xr |xs |«      }| j                  st        d|› d�«      ‚t        d|› d| j                  d   d   ›�«      ‚)Nz	expected z but end of rule reachedz	 but got rž   rŸ   )r¼   r·   Úreprr¥   )rE   r¸   r§   ÚtermÚtokens        r   Úexpectz_Parser.expectÆ  s~   € Ü˜4Ÿ;™;¨¨uÓ5ˆØÐØˆLØˆ<Ü˜ ˜Ò/¨%Ò8°5Ó9ˆDØ�{Š{Ü˜i¨ vÐ-EÐFÓGÐGÜ˜) D 6¨°4·;±;¸r±?À1Ñ3EÐ2HÐIÓJÐJr6   c                ó¬   — | j                  «       }t        | j                  dd«      r,d|| j                  «       ff}t        | j                  dd«      rŒ,|S )Nr¦   Úor)Úand_conditionr¼   r·   ©rE   Úops     r   rÉ   z_Parser.conditionÐ  sO   € Ø×ÑÓ!ˆÜ˜Ÿ™ f¨dÔ3Ø˜˜D×.Ñ.Ó0Ð1Ð1ˆBô ˜Ÿ™ f¨dÕ3àˆ	r6   c                ó¬   — | j                  «       }t        | j                  dd«      r,d|| j                  «       ff}t        | j                  dd«      rŒ,|S )Nr¦   Úand)Úrelationr¼   r·   rÓ   s     r   rÒ   z_Parser.and_conditionÖ  sI   € Ø�]‰]‹_ˆÜ˜Ÿ™ f¨eÔ4Ø˜˜TŸ]™]›_Ð-Ð-ˆBô ˜Ÿ™ f¨eÕ4àˆ	r6   c                óÆ  — | j                  «       }t        | j                  dd«      r/t        | j                  dd«      rdnd}||| j                  «       ffS t        | j                  dd«      }d}t        | j                  dd«      rd}n5t        | j                  dd«      s|rt	        d«      ‚| j                  |«      S d||| j                  «       ff}|rt        |«      S |S )	Nr¦   ÚisrÅ   ÚisnotÚinÚwithinz#Cannot negate operator based rules.r×   )rI   r¼   r·   r§   r¥   Únewfangled_relationr—   rÆ   )rE   ÚleftrÔ   ÚnegatedÚmethodr£   s         r   r×   z_Parser.relationÜ  sÎ   € Ø�y‰y‹{ˆÜ�d—k‘k 6¨4Ô0Ü& t§{¡{°F¸EÔB‘ÈˆBØ˜˜dŸj™j›lÐ+Ð+Ð+Ü˜TŸ[™[¨&°%Ó8ˆØˆÜ�d—k‘k 6¨8Ô4Ø‰Fä˜dŸk™k¨6°4Ô8ÙÜ#Ð$IÓJÐJØ×/Ñ/°Ó5Ð5Ø˜& $¨¯©Ó(9Ð:Ð:ˆÙ$Œv�b‹zÐ,¨"Ð,r6   c                óÈ   — t        | j                  dd«      rd}n%t        | j                  dd«      rd}nt        d«      ‚dd|| j                  «       ff}|rt	        |«      S |S )	Nr¨   ú=Fz!=Tz'Expected "=" or "!=" or legacy relationr×   rÛ   )r¼   r·   r¥   r—   rÆ   )rE   rÞ   rß   r£   s       r   rÝ   z_Parser.newfangled_relationí  sa   € Ü�d—k‘k 8¨SÔ1Ø‰GÜ˜Ÿ™ X¨tÔ4Ø‰GäÐEÓFÐFØ˜$  d§o¡oÓ&7Ð8Ð8ˆÙ$Œv�b‹zÐ,¨"Ð,r6   c                óz   — | j                  «       }t        | j                  d«      r|| j                  «       fS ||fS )Nr©   )r§   r¼   r·   )rE   rÞ   s     r   Úrange_or_valuez_Parser.range_or_value÷  s6   € Ø�z‰z‹|ˆÜ�d—k‘k :Ô.Ø˜Ÿ™›Ð%Ð%à˜�:Ðr6   c                óÖ   — | j                  «       g}t        | j                  dd«      r7|j                  | j                  «       «       t        | j                  dd«      rŒ7t	        |«      S )Nr¨   ú,)rä   r¼   r·   rD   rÃ   )rE   r—   s     r   r—   z_Parser.range_listþ  sW   € Ø×)Ñ)Ó+Ð,ˆ
Ü˜Ÿ™ h°Ô4Ø×Ñ˜d×1Ñ1Ó3Ô4ô ˜Ÿ™ h°Õ4ä˜zÓ*Ð*r6   c                ó2  — t        | j                  d«      }|�|d   t        vrt        d«      ‚|d   }t        | j                  dd«      rd|df| j	                  «       ffS t        | j                  dd«      rd|df| j	                  «       ffS t        |«      S )Nr¦   rŸ   zExpected identifier variableÚmodr   r¨   ú%)r¼   r·   Ú_VARSr¥   r§   rÁ   )rE   r¦   rÀ   s      r   rI   z_Parser.expr  s–   € Ü˜$Ÿ+™+ vÓ.ˆØˆ<˜4 ™7¬%Ñ/ÜÐ:Ó;Ð;Ø�A‰wˆÜ�d—k‘k 6¨5Ô1Ø˜D "˜: t§z¡z£|Ð4Ð4Ð4Ü˜Ÿ™ X¨sÔ3Ø˜D "˜: t§z¡z£|Ð4Ð4Ð4Ü˜$ÓÐr6   c                óN   — t        t        | j                  d«      d   «      «      S )Nr§   rŸ   )r¾   r   rÏ   r`   s    r   r§   z_Parser.value  s    € Üœ#˜dŸk™k¨'Ó2°1Ñ5Ó6Ó7Ð7r6   )NN)rS   rp   rq   rr   rJ   rÏ   rÉ   rÒ   r×   rÝ   rä   r—   rI   r§   r   r6   r   rB   rB   ™  s<   „ ñòB	QóKòòò-ò"-òò+ò	 ó8r6   rB   c                ó   ‡ — ˆ fd„S )ú%Compiler factory for the `_Compiler`.c                óN   •— ‰| j                  |«      | j                  |«      fz  S r   ©r[   )rE   rÞ   ÚrightÚtmpls      €r   ú<lambda>z"_binary_compiler.<locals>.<lambda>  s#   ø€  T¨T¯\©\¸$Ó-?ÀÇÁÈeÓATÐ,UÑ%U€ r6   r   ©rñ   s   `r   Ú_binary_compilerrô     s	   ø€ ãUÐUr6   c                ó   ‡ — ˆ fd„S )rí   c                ó,   •— ‰| j                  |«      z  S r   rï   )rE   Úxrñ   s     €r   rò   z!_unary_compiler.<locals>.<lambda>  s   ø€ ˜4 $§,¡,¨q£/Ñ1€ r6   r   ró   s   `r   Ú_unary_compilerrø     s	   ø€ ã1Ð1r6   c                 ó   — y)Nr   r   ©r÷   s    r   rò   rò     ó   � r6   c                  ó²   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Z ed«      Z ed«      Z ed«      Z ed«      Z ed«      Z ed«      Zd„ Zy)Ú	_CompilerzZThe compilers are able to transform the expressions into multiple
    output formats.
    c                ó0   — |\  }} t        | d|› �«      |Ž S )NÚcompile_)Úgetattr)rE   ÚargrÔ   rT   s       r   r[   z_Compiler.compile%  s%   € Ø‰ˆˆDØ-Œw�t˜x¨ t˜_Ó-¨tÐ4Ð4r6   c                 ó   — y)Nr(   r   rú   s    r   rò   z_Compiler.<lambda>)  rû   r6   c                 ó   — y)Nr)   r   rú   s    r   rò   z_Compiler.<lambda>*  rû   r6   c                 ó   — y)Nr/   r   rú   s    r   rò   z_Compiler.<lambda>+  rû   r6   c                 ó   — y)Nr0   r   rú   s    r   rò   z_Compiler.<lambda>,  rû   r6   c                 ó   — y)Nr1   r   rú   s    r   rò   z_Compiler.<lambda>-  rû   r6   c                 ó   — y)Nr2   r   rú   s    r   rò   z_Compiler.<lambda>.  rû   r6   c                 ó   — y)Nr3   r   rú   s    r   rò   z_Compiler.<lambda>/  rû   r6   c                 ó   — y)Nr4   r   rú   s    r   rò   z_Compiler.<lambda>0  rû   r6   c                ó   — t        |«      S r   r   )r÷   r/   s     r   rò   z_Compiler.<lambda>1  s
   € ¤ Q£€ r6   z
(%s && %s)z
(%s || %s)z(!%s)z
(%s %% %s)z
(%s == %s)z
(%s != %s)c                ó   — t        «       ‚r   )ÚNotImplementedError)rE   rà   rI   r—   s       r   Úcompile_relationz_Compiler.compile_relation9  s   € Ü!Ó#Ð#r6   N)rS   rp   rq   rr   r[   Ú	compile_nÚ	compile_iÚ	compile_vÚ	compile_wÚ	compile_fÚ	compile_tÚ	compile_cÚ	compile_eÚcompile_valuerô   Úcompile_andÚ
compile_orrø   Úcompile_notÚcompile_modÚ
compile_isÚcompile_isnotr  r   r6   r   rý   rý      s|   „ ñò5ñ €IÙ€IÙ€IÙ€IÙ€IÙ€IÙ€IÙ€IÙ'€MÙ" <Ó0€KÙ! ,Ó/€JÙ! 'Ó*€KÙ" <Ó0€KÙ! ,Ó/€JÙ$ \Ó2€Mó$r6   rý   c                  óV   — e Zd ZdZ ed«      Z ed«      Z ed«      Z ed«      Z	d„ Z
y)r‰   z!Compiles an expression to Python.z(%s and %s)z
(%s or %s)z(not %s)zMOD(%s, %s)c                óŽ   ‡ — dj                  ˆ fd„|d   D «       «      }|j                  «       › d‰ j                  |«      › d|› d�S )Nræ   c              3  ór   •K  — | ].  \  }}d ‰j                  |«      › d‰j                  |«      › d�–— Œ0 y­w)ú(rL   ú)Nrï   )r   r    r¡   rE   s      €r   r   z3_PythonCompiler.compile_relation.<locals>.<genexpr>F  s;   øè ø€ ò 
Ù:@¸1¸aˆa�—‘˜Q“Ð   4§<¡<°£?Ð"3°1Ô5ñ
ùs   ƒ47rŸ   r   z, [z]))r$   Úupperr[   )rE   rà   rI   r—   Úrangess   `    r   r  z _PythonCompiler.compile_relationE  sN   ø€ Ø—‘ó 
ØDNÈqÁMô
ó 
ˆð —,‘,“.Ð!  4§<¡<°Ó#5Ð"6°c¸&¸ÀÐDÐDr6   N)rS   rp   rq   rr   rô   r  r  rø   r  r  r  r   r6   r   r‰   r‰   =  s3   „ Ù+á" =Ó1€KÙ! ,Ó/€JÙ! *Ó-€KÙ" =Ó1€KóEr6   r‰   c                  ó>   — e Zd ZdZej
                  ZeZeZ	eZ
eZd„ Zy)r�   z)Compile into a gettext plural expression.c                ó^  — g }| j                  |«      }|d   D ]~  }|d   |d   k(  r+|j                  d|› d| j                  |d   «      › d�«       Œ9| j                  |d   «      }| j                  |d   «      }|j                  d|› d|› d|› d|› d�	«       Œ€ dd	j                  |«      › d�S )
NrŸ   r   r   z == r!  z >= ú && z <= z || )r[   rD   r$   )rE   rà   rI   r—   r£   ÚitemÚminÚmaxs           r   r  z!_GettextCompiler.compile_relationU  sÈ   € ØˆØ�|‰|˜DÓ!ˆØ˜q‘Mò 	CˆDØ�A‰w˜$˜q™'Ò!Ø—	‘	˜A˜d˜V 4¨¯©°T¸!±WÓ(=Ð'>¸aÐ@ÕAà—l‘l 4¨¡7Ó+�Ø—l‘l 4¨¡7Ó+�Ø—	‘	˜A˜d˜V 4¨ u¨D°°°d¸3¸%¸qÐAÕBð	Cð �6—;‘;˜r“?Ð# 1Ð%Ð%r6   N)rS   rp   rq   rr   rý   r  r  Úcompile_zeror  r  r  r  r  r   r6   r   r�   r�   L  s)   „ Ù3à×#Ñ#€IØ€IØ€IØ€IØ€Ió
&r6   r�   c                  ó,   — e Zd ZdZd„ ZeZeZeZeZ	d„ Z
y)ry   z/Compiles the expression to plain of JavaScript.c                 ó   — y)NzparseInt(n, 10)r   rú   s    r   rò   z_JavaScriptCompiler.<lambda>g  rû   r6   c                óz   — t         j                  | |||«      }|dk(  r| j                  |«      }d|› d|› d|› d�}|S )NrÛ   z
(parseInt(z	, 10) == r&  r!  )r�   r  r[   )rE   rà   rI   r—   r�   s        r   r  z$_JavaScriptCompiler.compile_relationm  sL   € Ü×0Ñ0°°v¸tÀZÓPˆØ�TŠ>Ø—<‘< Ó%ˆDØ ˜v Y¨t¨f°D¸¸¸aÐ@ˆDØˆr6   N)rS   rp   rq   rr   r  r*  r  r  r  r  r  r   r6   r   ry   ry   b  s%   „ Ù9ñ ,€IØ€IØ€IØ€IØ€Iór6   ry   c                  ón   — e Zd ZdZ ed«      Z ed«      Z ed«      Z ed«      Z ed«      Z	d„ Z
d
d„Zy	)rZ   z+Returns a unicode pluralization rule again.z%s is %sz%s is not %sz	%s and %sz%s or %sz	%s mod %sc                ó,   —  | j                   |d   ddiŽS )NrŸ   rß   T)r  )rE   r×   s     r   r  z_UnicodeCompiler.compile_not‚  s   € Ø$ˆt×$Ñ$ h¨q¡kÐ@¸4Ñ@Ð@r6   c           	     óH  — g }|d   D ]k  }|d   |d   k(  r$|j                  | j                  |d   «      «       Œ2|j                  | j                  |d   «      › d| j                  |d   «      › �«       Œm | j                  |«      › |rdnd› d|› ddj                  |«      › �S )NrŸ   r   z..z notr   rP   ræ   )rD   r[   r$   )rE   rà   rI   r—   rß   r#  r'  s          r   r  z!_UnicodeCompiler.compile_relation…  s¯   € ØˆØ˜q‘Mò 	SˆDØ�A‰w˜$˜q™'Ò!Ø—‘˜dŸl™l¨4°©7Ó3Õ4à—‘ §¡¨d°1©gÓ!6Ð 7°r¸$¿,¹,ÀtÈAÁwÓ:OÐ9PÐQÕRð		Sð
 —,‘,˜tÓ$Ð%±¡f¸RÐ%@ÀÀ&ÀÈÈ3Ï8É8ÐTZÓK[ÐJ\Ð]Ð]r6   N)F)rS   rp   rq   rr   rô   r  r  r  r  r  r  r  r   r6   r   rZ   rZ   u  sE   „ Ù5ñ " *Ó-€JÙ$ ^Ó4€MÙ" ;Ó/€KÙ! *Ó-€JÙ" ;Ó/€KòAô^r6   rZ   )r'   ro   rk   zMtuple[decimal.Decimal | int, int, int, int, int, int, Literal[0], Literal[0]])r{   rm   rk   r   )r{   rm   rk   z(Callable[[float | decimal.Decimal], str])r–   ro   r—   ú+Iterable[Iterable[float | decimal.Decimal]]rk   Úbool)r    r   r¡   r   rk   r   )r±   r   rk   úlist[tuple[str, str]]r   )r·   r3  r¸   r   r§   ú
str | Nonerk   zlist[tuple[str, str]] | bool)r·   r3  r¸   r   r§   r4  )r§   r   rk   z#tuple[Literal['value'], tuple[int]])rÀ   r   rk   ztuple[str, tuple[()]])r—   r1  rk   zItuple[Literal['range_list'], Iterable[Iterable[float | decimal.Decimal]]])r£   ztuple[Any, ...]rk   z-tuple[Literal['not'], tuple[tuple[Any, ...]]]).rr   Ú
__future__r   r   ÚreÚcollections.abcr   r   Útypingr   r   r   r?   rz   r5   r8   r~   ri   r“   r†   r‡   rˆ   Ú	Exceptionr¥   rê   r[   ÚUNICODEr$   rª   Ú__annotations__r´   r¹   r¼   r¾   rÁ   rÃ   rÆ   rB   rô   rø   r*  rý   r‰   r�   ry   rZ   r   r6   r   ú<module>r<     s  ðòõ #ã Û 	ß -ß )Ñ )à=€Ø€ð:"Ø#ð:"àRó:"÷z]ñ ]ó@ð.'!Ø
Dð'!à-ó'!óTð.BØ	 ðBà;ðBð 
óBð.AØ	 ðAà;ðAð 
óAó.ô.)�	ô )ò		€ð 
ˆ:ˆ2�:‰:�f˜bŸj™jÓ)Ð*ØˆZˆR�Z‰ZÐ=¸b¿g¹gÀe»nÐ=MÈTÐRÓSÐTØˆjˆb�j‰j˜Ó Ð!Øˆzˆr�z‰z˜+Ó&Ð'Ø��—‘Ð-¨r¯z©zÓ:Ð;ð4€Ð0ó óð* ð[Ø!ð[àð[ð ð[ð "ó	[ôó
óð$Ø;ð$àNó$ó÷w8ñ w8òtVò
2ñ
 €÷$ñ $ô:E�iô Eô&�yô &ô,Ð*ô ô&^�yõ ^r6   