� F�g ���dZddlZddlmZddlmZddlmZddlmZej d��Z ed��Z d�Z d �Z d d �ZdS) a pygments.regexopt ~~~~~~~~~~~~~~~~~ An algorithm that generates optimized regexes for matching long lists of literal strings. :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. �N)�escape)� commonprefix)�groupby)� itemgetterz [\[\^\\\-\]]c�l�dt�d�d�|����zdzS)N�[c�0�d|���zS)N�\)�group)�ms �a/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/pygments/regexopt.py�<lambda>zmake_charset.<locals>.<lambda>s������ � �)9����])� CS_ESCAPE�sub�join)�letterss r � make_charsetrs0�� ����9�9�2�7�7�7�;K�;K�L�L� L�s� R�Rrc �� � � �|rdpd}|sdS|d� t|��dkr|t� ��z|zS� s!|t|dd�d��zdz|zSt� ��dkr�g}g}|D]@}t|��dkr|�|���+|�|���At|��dkr@|r)|t|d��zdzt |��z|zS|t |��z|zSt |��}|rAt|��� |t|��zt� fd �|D��d��z|zSd �|D��}t |��}|rWt|��� |tt � fd �|D����d��zt|ddd ���z|zS|d�d �t|� fd���D����z|zS)zEReturn a regex that matches any string in the sorted list of strings.�)rr�Nz(?:�?�|c�$��g|] }|�d��� S�N�)�.0�s�plens �r � <listcomp>z#regex_opt_inner.<locals>.<listcomp>?s!���9�9�9�A�q����x�9�9�9rc�$�g|] }|ddd���S)N�����r)rr s r r"z#regex_opt_inner.<locals>.<listcomp>Bs"��,�,�,�q�1�T�T�r�T�7�,�,�,rc3�.�K�|]}|d� �V��dSrr)rr �slens �r � <genexpr>z"regex_opt_inner.<locals>.<genexpr>Hs-�����$@�$@�1�Q�v���v�Y�$@�$@�$@�$@�$@�$@rr$c3�\K�|]'}tt|d��d��V��(dS)rrN)�regex_opt_inner�list)rr s r r'z"regex_opt_inner.<locals>.<genexpr>MsR����L�L��!��e�A�h����4�4�L�L�L�L�L�Lrc�(��|d�dkS)Nrr)r �firsts �r rz!regex_opt_inner.<locals>.<lambda>Ns����1���q��9I�r) �lenrr)�appendrr�sortedrr) �strings� open_paren� close_paren� oneletter�restr �prefix� strings_rev�suffixr,r!r&s @@@r r)r)s�������$��*��K� ���r� �A�J�E� �7�|�|�q����F�5�M�M�)�K�7�7� � ��O�G�A�B�B�K��?�?�?���� � � �5�z�z�Q���� ���� � �A��1�v�v��{�{�� � ��#�#�#�#�� � �A����� �y�>�>�A� � �� <�!�O�D�"�$=�$=�=��C�"�9�-�-�.�0;�<�<�� �Y� 7� 7�7�+�E� E� �'� "� "�F� ���6�{�{���F�6�N�N�*��9�9�9�9��9�9�9�5�A�A�B��� �-�,�G�,�,�,�K� �+� &� &�F� �1��6�{�{����f�$@�$@�$@�$@��$@�$@�$@�@�@�%�H�H�I��V�D�D�b�D�\�"�"�#�%0�1� 1� � ���L�L�%�g�/I�/I�/I�/I�J�J�L�L�L� L� L� L� � �rrc�L�t|��}|t|d��z|zS)z�Return a compiled regex that matches any string in the given list. The strings to match must be literal strings, not regexes. They will be regex-escaped. *prefix* and *suffix* are pre- and appended to the final regex. �()r/r))r0r5r7s r � regex_optr:Rs)���W�o�o�G� �O�G�S�1�1� 1�F� :�:r)rr)�__doc__�rer�os.pathr� itertoolsr�operatorr�compiler� FIRST_ELEMENTrr)r:rrr �<module>rBs��� � � � � � ������� � � � � � ������������� �B�J�� '� '� �� �1� � � �S�S�S�5�5�5�p ;� ;� ;� ;� ;� ;r
Memory