
    ,hL                    v   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(  r{ddlmZ  ed      Zej#                  d        e e	dd              ed      Zej%                          ej#                  d       ej%                          ej#                  d       yy)    )annotationsN)Iterable   )	loop_last)cell_len
chop_cellsz	\s*\S+\s*c              #     K   d}t         j                  | |      }|E|j                         \  }}|j                  d      }|||f t         j                  | |      }|Dyyw)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)textposition
word_matchstartendwords         L/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/rich/_wrap.pywordsr      sh     
 HtX.J

 __&
s"S$]]4-
	 
 s   AA#!A#c                   g }|j                   }d}t        }t        |       D ]  \  }}}	 ||	j                               }
||z
  }||
k\  }|r| ||	      z  }5|
|kD  rY|rDt	        |	|      }t        |      D ](  \  }}|r ||       |r	 ||      }|t        |      z  }* |r ||        ||	      }|s|s ||        ||	      } |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   width)appendr   r   rstripr   r   len)r   r   fold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.+-$3{$B!$9T?*K U" ",T"?K&/&< /
d "5M*3D/K!SY.E/ u"+D/K u'oA .D     __main__)Console
   r   z@12345 abcdefghijklmnopqrstuvwyxzABCDEFGHIJKLMNOPQRSTUVWXYZ 12345abcdefghijklmnopqrstuvwxyz   uR   TextualはPythonの高速アプリケーション開発フレームワークですu4   アプリケーションは1670万色を使用でき)r   strreturnzIterable[tuple[int, int, str]])T)r   r.   r   intr   boolr/   z	list[int])
__future__r   retypingr   _loopr   cellsr   r   compiler
   r   r'   __name__consoler*   printrule r(   r   <module>r=      s    " 	   '
"**\
".4n z BGMMTU	*12
67BGLLNMMfgLLNMMHI r(   