Ë
    ˜2Úi§&  ã                   ót  — d Z ddlZddlmZ ddlmZ dxZZdZi Z	 ej                  d«      j                  Z ej                  d«      j                  Zd	Zi Z	  ej"                  d
«      Z eej1                  «       «      D ]D  Zej4                  dk(  sŒej6                  dd Zeee<   ej9                  d«      d   ZeevsŒ@eee<   ŒF eD � ci c]  } | j=                  «       | “Œ c} Zd„ Z  G d„ d«      Z! G d„ de"«      Z# G d„ d«      Z$ G d„ d«      Z%y# eef$ r  ee«      j,                  dz  ZY ŒÇw xY wc c} w )zY

Pyphen
======

Pure Python module to hyphenate text, inspired by Ruby's Text::Hyphen.

é    N)Ú	resources)ÚPathz0.14.0)ÚPyphenÚ	LANGUAGESÚlanguage_fallbackz\^{2}([0-9a-f]{2})z
(\d?)(\D?))ú%ú#ÚLEFTHYPHENMINÚRIGHTHYPHENMINÚCOMPOUNDLEFTHYPHENMINÚCOMPOUNDRIGHTHYPHENMINzpyphen.dictionariesÚdictionariesz.dicé   éüÿÿÿÚ_c                 óÒ   — | j                  dd«      j                  «       j                  d«      }|r6dj                  |«      } | t        v r	t        |    S |j                  «        |rŒ5yy)a	  Get a fallback language available in our dictionaries.

    http://www.unicode.org/reports/tr35/#Locale_Inheritance

    We use the normal truncation inheritance. This function needs aliases
    including scripts for languages with multiple regions available.

    ú-r   N)ÚreplaceÚlowerÚsplitÚjoinÚLANGUAGES_LOWERCASEÚpop)ÚlanguageÚpartss     úF/var/www/html/acx/venv/lib/python3.12/site-packages/pyphen/__init__.pyr   r   0   s\   € ð ×Ñ˜S #Ó&×,Ñ,Ó.×4Ñ4°SÓ9€EÙ
Ø—8‘8˜E“?ˆØÔ*Ñ*Ü& xÑ0Ð0Ø�	‰	Œô	 ó    c                   ó   — e Zd ZdZd„ Zd„ Zy)ÚAlternativeParserz¶Parser of nonstandard hyphen pattern alternative.

    The instance returns a special int with data about the current position in
    the pattern when called with an odd value.

    c                 óÔ   — |j                  d«      }|d   | _        t        |d   «      | _        t        |d   «      | _        |j                  d«      r| xj                  dz  c_        y y )Nú,r   é   é   ú.)r   ÚchangeÚintÚindexÚcutÚ
startswith)ÚselfÚpatternÚalternatives      r   Ú__init__zAlternativeParser.__init__H   s]   € Ø!×'Ñ'¨Ó,ˆØ! !‘nˆŒÜ˜ Q™Ó(ˆŒ
Ü�{ 1‘~Ó&ˆŒØ×Ñ˜cÔ"Ø�JŠJ˜!‰OŽJð #r   c                 óª   — | xj                   dz  c_         t        |«      }|dz  r-t        || j                  | j                   | j                  f«      S |S )Nr"   )r'   r&   ÚDataIntr%   r(   )r*   Úvalues     r   Ú__call__zAlternativeParser.__call__P   sD   € Ø�
Š
�a‰�
Ü�E“
ˆØ�1Š9Ü˜5 4§;¡;°·
±
¸D¿H¹HÐ"EÓFÐFàˆLr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r-   r1   © r   r   r   r   A   s   „ ñòór   r   c                   ó   — e Zd ZdZdd„Zy)r/   zE``int`` with some other data can be stuck to in a ``data`` attribute.Nc                 óŠ   — t         j                  | |«      }|r#t        |t        «      r|j                  |_        |S ||_        |S )z…Create a new ``DataInt``.

        Call with ``reference=dataint_object`` to use the data from another
        ``DataInt``.

        )r&   Ú__new__Ú
isinstancer/   Údata)Úclsr0   r;   Ú	referenceÚobjs        r   r9   zDataInt.__new__[   s@   € ô �k‰k˜#˜uÓ%ˆÙœ I¬wÔ7Ø —~‘~ˆCŒHð ˆ
ð ˆCŒHØˆ
r   )NN)r2   r3   r4   r5   r9   r6   r   r   r/   r/   Y   s
   „ ÙOôr   r/   c                   ó   — e Zd ZdZd„ Zd„ Zy)ÚHyphDictzHyphenation patterns.c                 ó@  — i | _         |j                  d«      j                  «       j                  «       }|j	                  «       dk(  rd}|j                  |«      j                  d«      dd D �]   }|j                  «       }|r|j                  t        «      rŒ,t        d„ |«      }d|v r&d	|v r"|j                  dd«      \  }}t        ||«      }nt        }t        t        |«      D ��cg c]  \  }}| ||xs d
«      f‘Œ c}}Ž \  }}	t        |	«      dk(  rŒ«dt!        |	«      }}
|	|
   s|
dz  }
|	|
   sŒ|	|dz
     s|dz  }|	|dz
     sŒ|
|	|
| f| j                   dj#                  |«      <   �Œ i | _        t        d„ | j                   D «       «      | _        yc c}}w )zhRead a ``hyph_*.dic`` and parse its patterns.

        :param path: Path of hyph_*.dic to read

        Úrbzmicrosoft-cp1251Úcp1251ú
r"   Nc                 óJ   — t        t        | j                  d«      d«      «      S )Nr"   é   )Úchrr&   Úgroup)Úmatchs    r   ú<lambda>z#HyphDict.__init__.<locals>.<lambda>�   s   € œc¤# e§k¡k°!£n°bÓ"9Ó:€ r   ú/ú=Ú0r   Ú c              3   ó2   K  — | ]  }t        |«      –— Œ y ­w)N)Úlen)Ú.0Úkeys     r   ú	<genexpr>z$HyphDict.__init__.<locals>.<genexpr>›   s   è ø€ Ò< sœ#˜cŸ(Ñ<ùs   ‚)ÚpatternsÚopenÚreadlineÚdecoder   Ú	read_textr   Ústripr)   ÚignoredÚ	parse_hexr   r&   ÚzipÚparseÚmaxrP   r   ÚcacheÚmaxlen)r*   ÚpathÚencodingr+   r,   ÚfactoryÚiÚstringÚtagsÚvaluesÚstartÚends               r   r-   zHyphDict.__init__m   s°  € ð ˆŒð —9‘9˜T“?×+Ñ+Ó-×4Ñ4Ó6ˆØ�>‰>ÓÐ1Ò1ØˆHà—~‘~ hÓ/×5Ñ5°dÓ;¸A¸BÐ?ó 	DˆGØ—m‘m“oˆGÙ˜g×0Ñ0´Ô9Øô  Ù:¸GóEˆGð �g‰~ #¨¡.Ø'.§}¡}°S¸!Ó'<Ñ$�˜Ü+¨G°[ÓA‘ä�äÜ=BÀ7»^÷!MÙ09°°6�™ ¢ cÓ*Ò+ó!Mð N‰LˆD�&ô �6‹{˜aÒØð œC ›K�3ˆEØ˜U’mØ˜‘
�ð ˜U“mà˜S 1™W’oØ�q‘�ð ˜S 1™W“oð ,1°&¸¸sÐ2CÐ+CˆD�M‰M˜"Ÿ'™' $›-Ó(ð=	Dð@ ˆŒ
ÜÑ<¨d¯m©mÔ<Ó<ˆ�ùó#!Ms   Ã)Fc           	      ó~  — |j                  «       }| j                  j                  |«      }|�€d|› d�}dgt        |«      dz   z  }t	        t        |«      dz
  «      D ]–  }t        || j                  z   t        |«      «      dz   }t	        |dz   |«      D ]]  }| j                  j                  ||| «      }|sŒ$|\  }	}
t        ||	z   ||	z   t        |
«      z   «      }t        t        |
||   «      ||<   Œ_ Œ˜ t        |«      D ��cg c]  \  }}|dz  rt        |dz
  |¬«      ‘Œ c}}x| j                  |<   }|S c c}}w )aþ  Get a list of positions where the word can be hyphenated.

        :param word: unicode string of the word to hyphenate

        E.g. for the dutch word 'lettergrepen' this method returns ``[3, 6,
        9]``.

        Each position is a ``DataInt`` with a data attribute.

        If the data attribute is not ``None``, it contains a tuple with
        information about nonstandard hyphenation at that point: ``(change,
        index, cut)``.

        change
          a string like ``'ff=f'``, that describes how hyphenation should
          take place.

        index
          where to substitute the change, counting from the current point

        cut
          how many characters to remove while substituting the nonstandard
          hyphenation

        r$   r   r"   r#   )r=   )r   r_   ÚgetrP   ÚrangeÚminr`   rT   ÚsliceÚmapr^   Ú	enumerater/   )r*   ÚwordÚpointsÚpointed_wordÚ
referencesrd   ÚstopÚjr+   Úoffsetrg   Úslice_r=   s                r   Ú	positionszHyphDict.positions�   sV  € ð4 �z‰z‹|ˆØ—‘—‘ Ó%ˆØ‰>Ø˜t˜f A˜;ˆLØ˜¤ LÓ 1°AÑ 5Ñ6ˆJäœ3˜|Ó,¨qÑ0Ó1ò N�Ü˜1˜tŸ{™{™?¬C°Ó,=Ó>ÀÑB�Ü˜q 1™u dÓ+ò N�AØ"Ÿm™m×/Ñ/°¸Q¸qÐ0AÓB�GÙ"Ø Ø%,‘N�F˜FÜ" 1 v¡:¨q°6©z¼CÀ»KÑ/GÓH�FÜ),¬S°&¸*ÀVÑ:LÓ)M�J˜vÒ&ñNðNô %.¨jÓ$9÷)Lá �A�y¸YÈº]ô ˜˜A™¨Ö3ó)Lð LˆD�J‰J�tÑ˜vð ˆùó)Ls   ÄD9N)r2   r3   r4   r5   r-   ry   r6   r   r   r@   r@   j   s   „ Ùò.=ó`-r   r@   c                   ó8   — e Zd ZdZdd„Zd„ Zd„ Zd	d„Zd	d„ZeZ	y)
r   zEHyphenation class, with methods to hyphenate strings in various ways.Nc                 óœ   — |st         t        |«         }|| _        || _        |r|t        vrt        |«      t        |<   t        |   | _        y)a¨  Create an hyphenation instance for given lang or filename.

        :param filename: filename of hyph_*.dic to read
        :param lang: lang of the included dict to use if no filename is given
        :param left: minimum number of characters of the first syllabe
        :param right: minimum number of characters of the last syllabe
        :param cache: if ``True``, use cached copy of the hyphenation patterns

        N)r   r   ÚleftÚrightÚhdcacher@   Úhd)r*   ÚfilenameÚlangr|   r}   r_   s         r   r-   zPyphen.__init__Ð   sJ   € ñ Ü Ô!2°4Ó!8Ñ9ˆHØˆŒ	ØˆŒ
Ù˜¬Ñ/Ü (¨Ó 2ŒG�HÑÜ˜(Ñ#ˆ�r   c                 óÀ   — t        |«      | j                  z
  }| j                  j                  |«      D �cg c]  }| j                  |cxk  r|k  sŒn n|‘Œ c}S c c}w )zñGet a list of positions where the word can be hyphenated.

        :param word: unicode string of the word to hyphenate

        See also ``HyphDict.positions``. The points that are too far to the
        left or right are removed.

        )rP   r}   r   ry   r|   )r*   rq   r}   rd   s       r   ry   zPyphen.positionsâ   sI   € ô �D“	˜DŸJ™JÑ&ˆØŸ7™7×,Ñ,¨TÓ2ÖN�a°d·i±iÀ1Ô6MÈÖ6M’ÒNÐNùÒNs   ¶AÁAc              #   ó8  K  — t        | j                  |«      «      D ]y  }|j                  r_|j                  \  }}}||z  }|j                  «       r|j	                  «       }|j                  d«      \  }}|d| |z   ||||z   d z   f–— Œn|d| ||d f–— Œ{ y­w)z†Iterate over all hyphenation possibilities, the longest first.

        :param word: unicode string of the word to hyphenate

        rL   N)Úreversedry   r;   ÚisupperÚupperr   )r*   rq   Úpositionr%   r'   r(   Úc1Úc2s           r   ÚiteratezPyphen.iterateî   s©   è ø€ ô ! §¡°Ó!5Ó6ò 
	7ˆHØ�}Š}à%-§]¡]Ñ"�˜˜sØ˜Ñ!�Ø—<‘<”>Ø#Ÿ\™\›^�FØŸ™ cÓ*‘��BØ˜6˜E�l RÑ'¨¨d°5¸3±;°<Ð.@Ñ)@Ð@Ó@à˜9˜H�o t¨H¨I Ð6Ó6ñ
	7ùs   ‚BBc                 ó€   — |t        |«      z  }| j                  |«      D ]  \  }}t        |«      |k  sŒ||z   |fc S  y)a´  Get the longest possible first part and the last part of a word.

        :param word: unicode string of the word to hyphenate
        :param width: maximum length of the first part
        :param hyphen: unicode string used as hyphen character

        The first part has the hyphen already attached.

        Returns ``None`` if there is no hyphenation point before ``width``, or
        if the word could not be hyphenated.

        N)rP   rŠ   )r*   rq   ÚwidthÚhyphenÚw1Úw2s         r   ÚwrapzPyphen.wrap   sH   € ð 	”�V“ÑˆØ—l‘l 4Ó(ò 	'‰FˆB�Ü�2‹w˜%ÓØ˜F‘{ B�Ò&ñ	'r   c                 óP  — t        |«      }t        | j                  |«      «      D ]n  }|j                  rN|j                  \  }}}||z  }|j	                  «       r|j                  «       }|j                  d|«      ||||z    Œ]|j                  ||«       Œp dj                  |«      S )a£  Get the word as a string with all the possible hyphens inserted.

        :param word: unicode string of the word to hyphenate
        :param hyphen: unicode string used as hyphen character

        E.g. for the dutch word ``'lettergrepen'``, this method returns the
        unicode string ``'let-ter-gre-pen'``. The hyphen string to use can be
        given as the second parameter, that defaults to ``'-'``.

        rL   rN   )	Úlistr„   ry   r;   r…   r†   r   Úinsertr   )r*   rq   r�   Úlettersr‡   r%   r'   r(   s           r   ÚinsertedzPyphen.inserted  s™   € ô �t“*ˆÜ  §¡°Ó!5Ó6ò 		1ˆHØ�}Š}à%-§]¡]Ñ"�˜˜sØ˜Ñ!�Ø—<‘<”>Ø#Ÿ\™\›^�FØ-3¯^©^¸CÀÓ-H�˜˜e c™kÑ*à—‘˜x¨Õ0ð		1ð �w‰w�wÓÐr   )NNr#   r#   T)r   )
r2   r3   r4   r5   r-   ry   rŠ   r�   r•   r1   r6   r   r   r   r   Í   s&   „ ÙOó$ò$
Oò7ó$'ó$ ð2 �Hr   r   )&r5   ÚreÚ	importlibr   Úpathlibr   ÚVERSIONÚ__version__Ú__all__r~   ÚcompileÚsubr[   Úfindallr]   rZ   r   Úfilesr   ÚAttributeErrorÚ	TypeErrorÚ__file__ÚparentÚsortedÚiterdirra   ÚsuffixÚnamer   Ú
short_namer   r   r   r   r&   r/   r@   r   )r§   s   0r   ú<module>r©      sh  ðñó 
Ý Ý à Ð  €ˆ+à
6€ð €ð ˆB�J‰JÐ,Ó-×1Ñ1€	Øˆ�
‰
�=Ó!×)Ñ)€ð7€ð
 €	ð:Ø"�9—?‘?Ð#8Ó9€Lñ
 �<×'Ñ'Ó)Ó*ò )€DØ‡{�{�fÓØ�y‰y˜˜2ˆˆØˆ	�$‰Ø—Z‘Z “_ QÑ'ˆ
Ø˜YÒ&Ø$(ˆI�jÒ!ð)ð 7@Ö@¨d�t—z‘z“| TÑ)Ò@Ð ò÷"ñ ô0ˆcô ÷"`ñ `÷F^ò ^øðY 	˜	Ð"ò :á˜“>×(Ñ(¨>Ñ9‚Lð:üò As   ÁD ÃD5ÄD2Ä1D2