� ]�gL ���ddlmZddlZddlmZddlmZddlmZm Z ej d��Z dd �Z ddd�Z edkr�ddlmZed���Ze�d��ee dd����ed���Ze���e�d��e���e�d��dSdS) �)� annotationsN)�Iterable�)� loop_last)�cell_len� chop_cellsz \s*\S+\s*�text�str�return�Iterable[tuple[int, int, str]]c#��K�d}t�||��}|�R|���\}}|�d��}|||fV�t�||��}|�PdSdS)z�Yields each word from the text as a tuple containing (start_index, end_index, word). A "word" in this context may include the actual word and any whitespace to the right. rN)�re_word�match�span�group)r �position� word_match�start�end�words �Z/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/rich/_wrap.py�wordsr s����� �H����t�X�.�.�J� � ��_�_�&�&� ��s�����"�"���S�$������]�]�4��-�-� � � � � � � �T�width�int�fold�bool� list[int]c���g}|j}d}t}t|��D]�\}}} || �����} ||z } | | k} | r||| ��z }�?| |kro|rTt | |���} t | ��D]2\}}|r ||��|r ||��}� |t |��z }�3��|r ||��|| ��}��|r|r||��|| ��}��|S)a�Given a string of text, and a width (measured in cells), return a list of cell offsets which the string should be split at in order for it to fit within the given width. Args: text: The text to examine. width: The available cell width. fold: If True, words longer than `width` will be folded onto a new line. Returns: A list of indices to break the line at. r�r)�appendrr�rstriprr�len)r rr�break_positionsr!� cell_offset� _cell_lenr�_endr� word_length�remaining_space�word_fits_remaining_space� folded_word�last�lines r� divide_liner.s^��"$�O� � #�F��K��I�"�4�[�[� .� .���t�T��i�� � � � �.�.� ��+�-��$3�{�$B�!� $� .� �9�9�T�?�?� *�K�K��U�"�"��2�",�T��"?�"?�"?�K�&/� �&<�&<�/�/� ��d� �*�"�F�5�M�M�M��/�*3�)�D�/�/�K�K�!�S��Y�Y�.�E�E� /��&���u� � � �"+�)�D�/�/�K�K�� .�� .���u� � � �'�i��o�o� �� �r�__main__)�Console� r z@12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345�abcdefghijklmnopqrstuvwxyz�uRTextualはPythonの高速アプリケーション開発フレームワークですu4アプリケーションは1670万色を使用でき)r r r r )T)r r rrrrr r)� __future__r�re�typingr�_loopr�cellsrr�compilerrr.�__name__�consoler0�print�rule�rr�<module>r?s\��"�"�"�"�"�"� � � � �������������'�'�'�'�'�'�'�'� �"�*�\� "� "�� .� .� .� .�4�4�4�4�4�n �z��� � � � � � ��g�B����G� �M�M�T�U�U�U� �E�*�*�1�2� 6� 6�7�7�7��g�B����G� �L�L�N�N�N� �M�M�f�g�g�g� �L�L�N�N�N� �M�M�H�I�I�I�I�I��r
Memory