
    Cj*
                    z    S SK Jr  S SKJrJrJrJr  \" S5      rS	S jrS	S jr	S
S jr
  S         SS jjrg)    )annotations)IterableLiteralSequenceTypeVarTc              #     #    [        U 5      n [        U5      nSU4v   U H	  nSU4v   M     g! [         a     gf = f7f)z9Iterate and generate a tuple with a flag for first value.NTFiternextStopIteration)valuesiter_valuesvalues      _/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/textual/_loop.py
loop_firstr      sP     v,K[! +Ul   s    A 0 A 
=A =A c              #     #    [        U 5      n [        U5      nU H  nSU4v   UnM     SU4v   g! [         a     gf = f7f)z8Iterate and generate a tuple with a flag for last value.NFTr
   )r   r   previous_valuer   s       r   	loop_lastr      sY     v,Kk* ^##  
  s    A2 A
?A?Ac              #     #    [        U 5      n [        U5      nSnU H  nUSU4v   SnUnM     USU4v   g! [         a     gf = f7f)zBIterate and generate a tuple with a flag for first and last value.NTFr
   )r   r   r   firstr   s        r   loop_first_lastr   !   sg     v,Kk* EUN**  ~
%%  s%   A8 A
AAAAc              #  6  #    US;   d   S5       e[        U 5      nU(       a"  [        U5       H  nX-   U-  nXU   4v   M     gUS:X  a'  [        U5       H  nUS-   =o:  a    gXU   4v   M     g[        U5       H  nUS-
  =nS:  a    gXU   4v   M     g7f)a  Iterate over values in a sequence from a given starting index, potentially wrapping the index
if it would go out of bounds.

Note that the first value to be yielded is a step from `index`, and `index` will be yielded *last*.


Args:
    values: A sequence of values.
    index: Starting index.
    direction: Direction to move index (+1 for forward, -1 for backward).
    bool: Should the index wrap when out of bounds?

Yields:
    A tuple of index and value from the sequence.
)   zdirection must be -1 or +1r   r   N)lenrange)r   index	directionwrapcount_s         r   loop_from_indexr#   0   s     ,  >">> KEuA&%/E-((  ?5\"QY&E0Um,, "
 5\"QY&E!+Um,, "s   BBN)r   Iterable[T]returnzIterable[tuple[bool, T]])r   r$   r%   zIterable[tuple[bool, bool, T]])r   T)
r   zSequence[T]r   intr   zLiteral[-1, +1]r    boolr%   zIterable[tuple[int, T]])
__future__r   typingr   r   r   r   r   r   r   r   r#        r   <module>r,      sa    " 7 7CL	
&$ "$	&-&-&- &- 	&-
 &-r+   