
    жvgL                       d dl mZ d dlZd dlmZ ddlmZ ddlmZm	Z	  ej
        d          ZddZdddZedk    rddlmZ  ed          Ze                    d            e e	dd                      ed          Ze                                 e                    d           e                                 e                    d           dS dS )     )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          }|||fV  t                               | |          }|PdS dS )zYields 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.
    r   N)re_wordmatchspangroup)r	   position
word_matchstartendwords         S/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/pip/_vendor/rich/_wrap.pywordsr      s      
 HtX..J

 __&&
s""S$]]4--
	 
 
 
 
 
     Twidthintfoldbool	list[int]c                   g }|j         }d}t          }t          |           D ]\  }}}	 ||	                                          }
||z
  }||
k    }|r| ||	          z  }?|
|k    ro|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   )appendr   r   rstripr   r   len)r	   r   r   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[[  .  .tTi..+-$3{$B!$ 	.99T??*KK U""  2",T"?"?"?K&/&<&< / /
d  *"F5MMM /*3)D//KK!SYY.EE/  &u"+)D//KK . . u'ioor   __main__)Console
   r    z@12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345abcdefghijklmnopqrstuvwxyz   uR   TextualはPythonの高速アプリケーション開発フレームワークですu4   アプリケーションは1670万色を使用でき)r	   r
   r   r   )T)r	   r
   r   r   r   r   r   r   )
__future__r   retypingr   _loopr   cellsr   r   compiler   r   r.   __name__consoler0   printrule r   r   <module>r?      s\   " " " " " " 				             ' ' ' ' ' ' ' '
"*\
"
". . . .4 4 4 4 4n z      gBGMMTUUU	E**12
6
6777gBGLLNNNMMfgggLLNNNMMHIIIII r   