
    ijx              	      H   d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	m
Z
mZ ddlmZ ddlmZ dd	lmZmZ dd
lmZmZmZmZmZmZ ddlmZ ddlmZmZ ddlm Z m!Z!m"Z"  G d dejF                        Z$ G d de      Z%	 d	 	 	 d dZ&	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d!dZ'	 	 	 	 	 	 	 	 	 	 	 	 d"dZ(	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#dZ)	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d$dZ*	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#dZ+	 	 d%dddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d&dZ,y)'z*This is a python implementation of clip().    )annotationsN)islice)LiteralCallableOptional
NamedTuple   )width)iter_graphemes)	HyperlinkHyperlinkParams)_SGR_PATTERN_SGR_STATE_DEFAULT	_SGRState_sgr_state_update_sgr_state_is_active_sgr_state_to_sequence)_clamp_ambiguous_width)
TextSizingTextSizingParams)_SEQUENCE_CLASSIFY_HORIZONTAL_CURSOR_MOVEMENTINDETERMINATE_EFFECT_SEQUENCEc                      e Zd ZdZ ej
                         Z ej
                         Z ej
                         Z ej
                         Z	y)_HyperlinkActionz.Outcome of processing an OSC 8 hyperlink unit.N)
__name__
__module____qualname____doc__enumautoNO_CLOSEEMPTYOUTSIDEVISIBLE     V/home/ubuntu/.cache/pipx/cdb5059130eadca/lib/python3.12/site-packages/wcwidth/_clip.pyr   r      s9    8tyy{HDIIKEdiikGdiikGr'   r   c                  ~    e Zd ZU dZded<   dZded<   dZded<   dZd	ed
<   dZd	ed<   dZ	d	ed<   dZ
ded<   dZded<   y)_HyperlinkResultzn
    Result of processing an OSC 8 hyperlink.

    Only the fields relevant to each action are populated.
    r   actionr   int	close_endinner_width stropen_seqclipped_inner	close_seqclipped_width
hl_col_endN)r   r   r   r   __annotations__r-   r.   r1   r2   r3   r4   r5   r&   r'   r(   r*   r*   %   sU     IsKHcM3IsM3Jr'   r*   c                V    |&t        |      x}r|| z   } t        ||n|      r| dz  } | S )aZ  
    Apply SGR prefix/suffix around *result*.

    If an SGR state was captured at the first visible character, prefix the result with the
    corresponding SGR sequence, and suffix with a reset if any styles remain active at the end
    of the clipped region.

    *end_style* is the style in effect after the final SGR sequence emitted within the clip window,
    or ``None`` when no such sequence was emitted, the style at the first visible character is still
    in effect.  This matches :func:`wcwidth.propagate_sgr`, which decides the trailing reset by SGR
    state at the end of each line.
    z[0m)r   r   )resultcaptured_style	end_styleprefixs       r(   _apply_sgr_wrapr<   6   sA     !+N;;6;f_F)2CSiFMr'   c                  t        j                  | |	      \  }}||fdk(  rt        t        j                        S | |	| }t        |||||      }|dk(  rt        t        j                  |      S |
|z   }||k  s|
|k\  rt        t        j                  ||      S t        d||
z
        }||
z
  }t        |||||||d|	      }t        |||||      }t        t        j                  |||j                         ||j                         ||      S )	z
    Process an OSC 8 hyperlink unit.

    Finds the matching close sequence, measures the inner text width, and determines whether the
    hyperlink is empty, outside the clip window, or visible (requiring inner-text clipping).
    )r>   )control_codestabsizeambiguous_widthterm_programr   )r-   )r-   r.   F)fillcharr@   rA   rB   propagate_sgrr?   )r-   r.   r1   r2   r3   r4   r5   )r   
find_closer*   r   r"   r
   r#   r$   maxclipr%   	make_open
make_close)textstartendrC   r@   rA   rB   r?   params	match_endcolclose_startr-   
inner_textr.   r5   inner_clip_startinner_clip_endr2   r4   s                       r(   _process_hyperlinkrT   L   sE   * '11$	BKY8+ 0 9 9::i,J-!K a 0 6 6)LL{"JUcSj 0 8 8I,79 	9 1eck*3YN$n7'!#M ]!M   !!####%#	 	r'   c                   i }|D ])  \  }}}|j                  |g       j                  ||f       + |j                         D ]  }	|	j                           | rt	        | j                               nd}
|rt	        |j                               nd}t	        |
|      }g }d}t        ||      }||k  r|j                  |d      D ]  \  }}|j                  |        ||k\  r|dz  };|| v r#| |   \  }}|j                  |       ||xs dz  }n$||cxk  r|
k  rn n|j                  |       |dz  }||k  rt        |j                               D ]&  }||kD  s	||   D ]  \  }}|j                  |        ( dj                  |      S )z
    Reconstruct the output string from painter's algorithm state.

    Walks columns left-to-right, interleaving escape sequences and cell content, filling gaps with
    *fillchar*.
    r>   r   r&   r	   r/   )

setdefaultappendvaluessortrF   keysmingetsortedjoin)cells	sequencesrK   rL   rC   seqs_by_colcol_posorderseq_textentriesmax_cell_colmax_seq_colmax_colpartswalk_col	col_limit_	cell_textcell_wcs                       r(   _reconstruct_painterrp      s    57K$- F w+22E83DEF%%'  ).3uzz|$2L-8#k&&()bK,,GEHGS!I
i
&??8R8 	#KAxLL"	# s?MHu %hIvLL#!#H0L0X&MH! i
& K$$&' 'y=*1~ '8X&''
 775>r'   c               
    g }
d}d}d}d}|rt         nd}|t        |       k  r| |   }||k\  r'|dvr#|n| j                  d|dz         }|dk(  rn|}@|dk(  rt        j                  | |      }|s|
j                  |       |dz  }u|j                  d      W|rU|St        ||j                               }|&||k  r!|
j                  |j                                |}|j                         }t        j                  |j                               x}rt        | |||||||	||j                         |      }|j                  t        j                  u r1|
j                  |j                                |j                         }n|j                  t        j                  u r|j                   }n|j                  t        j"                  u r||j$                  z  }|j                   }n|
j                  |j&                         |
j                  |j(                         |
j                  |j*                         |r||}|rB|@t-        j.                  |j(                        D ]  }t        ||j                               }|}  ||j$                  z  }|j                   }|j                  d	      x}|j                  d
      xs d}|j                  d      }|J t1        t3        j4                  ||	      ||      }|j7                  |      }||k\  r3||z   |k  r+|
j                  |j9                                |r||}||z  }nD||k  r:||z   |kD  r2g  d fd}t;        ||||||||      }|
j=                          |r
||}n||z  }|j                         }|j                         }|r&t?        j                  |      rtA        d| d|      |
j                  |       |j                         }|dk(  r^|dkD  rA||||z  z
  z   }||k  rB||cxk  r|k  rn n|
j                  d       |r||}|dz  }||k  r0n|
j                  d       |dz  }ItC        tE        | |            }tG        |||      }|dk(  r ||cxk  r|k  r{n nx|
j                  |       nf||k\  r ||z   |k  r|
j                  |       |rF|D|}nA||k  r<||z   |kD  r4|
j                  |tI        |||z         tK        ||      z
  z         |r||}||z  }|t        |      z  }|t        |       k  rdjM                  |
      ||fS )z
    Clip text without cursor movement (simple append-to-output path).

    Returns ``(result, captured_style, end_style)``.  The caller applies SGR wrapping.
    r   N	r	   r>   
sgr_paramsrM   rN   rO   ts_metats_textr/   ts_termr?   c                (    j                  |        y N)rW   )s_w_colts_partss      r(   	_ts_writez_clip_simple.<locals>._ts_writeG  s     *r'   *Indeterminate cursor sequence at position , 	 rK   rA   rB   )r|   r0   r}   r,   r~   r,   returnNone)'r   lenfindr   matchrW   groupr   rL   r   parserT   r+   r   r"   r#   r-   r$   r.   r1   r2   r3   r   finditerr   r   from_paramsdisplay_widthmake_sequence_text_sizing_clipextendr   
ValueErrornextr   r
   r[   rF   r^   )!rJ   rK   rL   rD   rA   rB   rC   r@   strictr?   outputrO   idxr9   r:   current_stylecharnext_escmhl_statersgr_mrv   rw   rx   tsts_widthr   seqnext_tabgrapheme
grapheme_wr   s!                                   @r(   _clip_simpler      sN   , F
C
C +/N &*I*7&TM
D	/Cy #:$n4)
 yyq1H2~C6>"((s3Ad#q ww|$0]}G` 1- K!-#)MM!''), -Ieeg +00;;x;&%h !#quuwC	 88/888MM!''),%%'CXX!1!7!77++CXX!1!9!991==(C++CMM!**-MM!//2MM!++.$)?)6 %)B%1%:%:1??%K 6E,=mU[[],[M(5I6 1==(C++C 779--:''),2''),***$00VW& ++O<%<C(Nc$9MM""2"2"45$)?)68OC3Y3>E#9*,H++CX$!#C MM(+$)?)68OCeeg '')C7==cB @Rg  MM#%%'C4<{'S7]";<Hn)c)c*(^-C-:N1HC Hn d#1HCt3788_(46
 ?!c!h'E\cJ.#5MM(#!7!.3Y3+e3MM(c#sZ/?&@3uc?&RST!7!.zs8}e D	/h 776?NI55r'   c           	     T     j                  |      }||k\  r%||z   |k  r  j                         ||       ||z   S ||k\  s||z   |k  r||z   S t        d||z
        }	t        |||z         |z
  }
 j                  j
                  g } j                  j                  dkD  rt        t         j                         j                  j                        D ]  }|j                  |f        t         j                  j                  t        |      z
        D ]  }|j                  df        n<t         j                        D ]$  }|j                  |t        |||      z  f       & g d fd}||	z   }d}|D ]  \  }}||z   }||	k  r|}||
k\  r nt        ||
      t        ||	      z
  }||k(  r*|dkD  r%s|t        ||	      z   }j                  ||f       n4 ||       |t        ||	      z   }t        |      D ]  } |d||z           |}  ||       ||z   S )z
    Emit tokens for a text-sizing (OSC 66) sequence, clipped to (start, end).

    Calls *write_cells(text, width, col)* for each emitted cell or sequence. Returns new column
    position.
    r   r/   r   c                   sy D cg c]  }|d   	 }}t        d D              }t        j                  j                  dkD  rt	        |      ndj                  j
                  j                  j                  j                  j                  j                  j                        } t        |dj                  |      j                        j                         ||        j                          y c c}w )Nr   c              3  &   K   | ]	  }|d      yw)r	   Nr&   ).0us     r(   	<genexpr>z3_text_sizing_clip.<locals>.flush.<locals>.<genexpr>  s     2qad2s   r/   )sumr   rM   r
   r   	numeratordenominatorvertical_alignhorizontal_alignr   r^   
terminatorr   clear)		flush_colr   textstotal_wrM   pending_unitsscaler   write_cellss	        r(   flushz _text_sizing_clip.<locals>.flush  s    ,-!1--2M22!))//A-CJ1II!6!6II$$bii&@&@	B
 	vrwwu~r}}=KKM	 	 .s   C:r	   )r   r,   r   r   )r   r   rF   r[   rM   r   r
   r   r   rJ   rW   ranger   )r   rO   rK   rL   rC   rA   rB   r   r   	rel_startrel_endunitsgrl   r   flush_col_posunit_pos	unit_textunit_wunit_endoverlap	abs_startir   r   s   `      `               @@r(   r   r     sY   " 0H e|h#-B$$&#6X~
czS8^u,X~ Aus{#I#sX~&,GIIOOE#%E	yyrww/A 	%ALL!U$	%ryyU34 	&ALL"e%	&  ( 	?ALLE!_'357<= >?	?
 ,.M   )OMH" 	6f$y Hwh(3x+CCf!  #c(I&> >  )V!45- c(I66I7^ 8HaQ78%( 
->r'   c                 ()*+,- i )t               +g -d,d}
d}d(d}rt        nd*d}	 d 	 	 	 d!()*+,-fd}|t        |       k  r| |   }|
|k\  r|dvr|d|cxk  r|k  rmn njt        | j	                  d      | j	                  d      | j	                  d            |k  rd}n*t        j                  | |      }|dn|j                         }|dk  r#(n| j                  d|d	z         }|dk(  rn|}|dk(  rwt        j                  | |      }|s-j                  |
,|f       ,d	z  ,|d	z  }|j                  d
      `r^*\t        *|j                               *(.|
|k  r)-j                  |
,|j                         f       ,d	z  ,*}|j                         }mt        j                  |j                               x}rt!        | ||||||	||j                         |
      }|j"                  t$        j&                  u r9-j                  |
,|j                         f       ,d	z  ,|j                         }n3|j"                  t$        j(                  u r|j*                  }n	|j"                  t$        j,                  u r|
|j.                  z  }
|j*                  }nщ-j                  |
,|j0                  f       ,d	z  , ||j2                  |j4                  |
d       |
|j4                  z  }
-j                  |
,|j6                  f       ,d	z  ,rB*@t9        j:                  |j2                        D ]  }t        *|j                               **}  |j<                  }
|j*                  }A|j                  d      x}p|j                  d      xs d}|j                  d      }|J t?        tA        jB                  ||	      ||      }tE        ||
|||||      }
|j                         }|j                         }|r&tG        j                  |      rtI        d| d|      |j                  d      x}$|rtK        |      d	z
  nd}
|j                         }3|j                  d      x}a|rtK        |      nd	}|
|z   }|
|k  r4||kD  r/tM        t        |
|      tO        ||            D ]  } |d	|        |}
|j                         }|j                  d      x} I| rtK        |       nd	}!|r|!|
kD  rtI        d| d|! d|
 d      |
|!z  }
|
dk  rd}
|j                         }-j                  |
,|j                         f       ,d	z  ,|j                         }<|dk(  r	d}
|d	z  }J|dk(  r|
dkD  r|
d	z  }
|d	z  }`|dk(  rb|dkD  r=|
||
|z  z
  z   }"tM        t        |
|      tO        |"|            D ]  }# |dd	|#        |"}
n-j                  |
,df       ,d	z  ,|d	z  }tQ        tS        | |            }$tU        |$||      }%|%dk(  r(||
cxk  r|k  r{n nx-j                  |
,|$f       ,d	z  ,n^|
|k\  r|
|%z   |k  r ||$|%|
       nF|
|k  rA|
|%z   |kD  r9t        ||
      }&tM        tO        ||
|%z         |&z
        D ]  }' |d	|&|'z           |
|%z  }
|t        |$      z  }|t        |       k  rtW        )-||      (|fS )"z
    Clip text with cursor movement (painter's algorithm path).

    Returns ``(result, captured_style, end_style)``.  The caller applies SGR wrapping.
    r   Nc                   |dk(  r"| rj                  || f       dz  ryt        |      D ]  }||z   }|dkD  r9j                  |dz
  d      d   dk(  r	df|dz
  <   
j                  |dz
         j                  |d      d   dk(  r	df|dz   <   
j                  |dz          j	                  |d       
j                  |        | |f|<   |r$t        |      D ]  }
j                  ||z           ryyy)zIWrite *w* cells of text *s* at *write_col*, handling wide-char splitting.r   r	   N)r/   r      )rW   r   r\   discardpopadd)r|   w	write_colis_hyperlinkoffsetsrc_colr9   r_   r   rC   hyperlink_cellsrD   	seq_orderr`   s         r(   _write_cellsz#_clip_painter.<locals>._write_cells  sE    6  )Y!:;Q	 ^%;%2NAh 		-F&(G{uyy1g>qAQF&.]gk"''!4yy'*1-2&.]gk"''!4IIgt$##G,		- q6i( 8##I$678^3*N 4=r'   rr   rs   r>   r	   rt   ru   T)r   rv   rw   r/   rx   ry   r   r   hpa_n
cforward_ncbackward_nz!Cursor left movement at position z would move z cells left from column z, exceeding string startr   r   r   r   )F)
r|   r0   r   r,   r   r,   r   boolr   r   ),setr   r   rF   rfindr   searchrL   r   r   r   rW   r   r   r   r   rT   r+   r   r"   r#   r-   r$   r.   r1   r2   r4   r3   r   r   r5   r   r   r   r   r   r   r,   r   r[   r   r   r
   rp   ).rJ   rK   rL   rD   rA   rB   rC   r@   r   r?   rO   r   r:   next_movementr   r   foundr   r   r   r   r   rv   rw   rx   r   r   r   r   	n_forwardmove_endr   r   
n_backwardr   fill_colr   r   
clip_startr   r9   r_   r   r   r   r`   s.      `  `                                 @@@@@@r(   _clip_painterr     su   , )+E #O,.II
C
C +/N &*I*7&TM#'M +0+#'+48+ +: D	/Cy #:$n4$](@S(@tzz&)4::d+;TZZ=OPSVV$&M7>>tSIE*/-BUYY[Mq !-99VS1W5r>6>"((s3A  #y$!78Q	q ww|$0]}G` 1- K!-#)$$c9aggi%@ANI -Ieeg +00;;x;&%h !#quuwC	 88/888$$c9aggi%@ANI%%'CXX!1!7!77++CXX!1!9!991==(C++C$$c9ajj%ABNI !//3.241??*C$$c9akk%BCNI %)B%1%:%:1??%K 6E,=mU[[],[M(5I6 ,,C++C 779--:''),2''),***$00VW& (UC?  " eeg '')C7==cB @Rg  ))6(-c%j1n1eeg  ggl33
@/9C
Oq	?9E!1"3sE?C#4FG 5$Xq!45eeg  !ww}55B1<S-!
j3.$;C5%,&>se D12 
 z!7Ceeg c9aggi89NI%%'C 4<C1HC 6>Qwq1HC 4<{'S7]";< %c#uos8S7I J 3H a23  #y$!78Q	1HC t3788_(46
 ?!c!  #y(!;<Q	E\cJ.#5:s33Y3+e3UCJCz)9 :Z GH ?Xq*v*=>? 	zs8}q D	/t !	5#xHI' 'r'   r      Tr   F)rC   r@   rA   rD   r?   
overtypingrB   c                  t        |d      }|dk  r#|dk7  rt        d|       t        j                  }||k  ry| j	                         r| j                         r| || S t        |      }d| v }
|r|
sd}|6|dk7  xr. d| v xs( d	| v xs" |
xr t        t        j                  |             }n	|r|dk(  rd}|rt        nt        }t         || |||||	|||d
k(  |
       S )u  
    Clip text to display columns (start, end) while preserving all terminal sequences.

    This function extracts a substring based on visible column positions rather than character
    indices. Terminal escape sequences are preserved in output. If a wide character (width of 2) is
    split at a boundary, it is replaced with ``fillchar``.

    TAB characters (``\t``) are expanded to spaces up to the next tab stop, controlled by the
    ``tabsize`` parameter.  When cursor movement is detected, a "painter's algorithm" is used unless
    ``overtyping=False`` is set.  Cursor movement control codes are parsed for their effects instead
    of ignored.  For these operations, it is assumed that ``text`` begins at column 0.

    For text containing **OSC 8 hyperlinks**, the visible text inside a hyperlink is clipped to the
    requested column range and the hyperlink sequence is rebuilt::

        >>> clip('\x1b]8;;http://example.com\x07Click This link\x1b]8;;\x07', 6, 10)
        '\x1b]8;;http://example.com\x07This\x1b]8;;\x07'

    :param text: String to clip, may contain terminal escape sequences.
    :param start: Absolute starting column (inclusive, 0-indexed), default ``0``.
    :param end: Absolute ending column (exclusive).  The default value, ``-1``,
        signifies "to the end of the line", clipping only from *start* without
        requiring the caller to measure the display width of *text*.
    :param fillchar: Character to use when a wide character must be split at
        a boundary (default space). Must have display width of 1.
    :param tabsize: Tab stop width (default 8). Set to 0 to pass tabs through
        as zero-width (preserved in output but don't advance column position).
    :param ambiguous_width: Width to use for East Asian Ambiguous (A)
        characters. Default is ``1`` (narrow). Set to ``2`` for CJK contexts.
    :param propagate_sgr: If True (default), SGR (terminal styling) sequences
        are propagated, matching :func:`propagate_sgr`.  The result begins with
        any style active at the start position, retains any style changes
        occurring within the clipped region at their original position, and
        ends with a reset sequence if styles are active at the end position.
    :param control_codes: How to handle control characters and sequences:

        - ``'parse'`` (default): Track horizontal cursor movement and clip
          hyperlink text.  Cursor overwrite is always allowed, with best effort
          results; indeterminate sequences (home, clear, reset, etc.) are
          preserved as zero-width.
        - ``'strict'``: Like ``parse``, but raises :exc:`ValueError` on
          sequences with indeterminate effects (cursor home, clear screen,
          reset, vertical movement, etc.) matching :func:`width` behavior.
          Also raises on out-of-bounds horizontal cursor movement.
        - ``'ignore'``: All control characters are treated as zero-width.
          Cursor movement is not tracked (fastest path).

    :param overtyping: Whether to use the painter's algorithm for cursor
        movement (``\b`` backspace, ``\r`` carriage return, and CSI cursor
        left/right/position sequences).  When ``None`` (default), auto-detects
        by scanning for these characters in *text*.  Set to ``False`` for improved
        performance when the caller knows *text* contains no cursor movement
        characters.  Set to ``True`` to force the painter's algorithm (useful
        for testing).  Has no effect when ``control_codes='ignore'``.
    :param term_program: Terminal software identifier for table correction.
        ``False`` (default) disables override lookup.  ``True`` reads the
        ``TERM_PROGRAM`` or ``TERM`` environment variable for auto-detection.
        Accepts a canonical terminal name matching :func:`list_term_programs`,
        such as from XTVERSION_, ENQ_, or ``TERM_PROGRAM``.

        .. versionadded:: 0.8.0

    :returns: Substring of ``text`` spanning display columns (start, end),
        with all terminal sequences preserved and wide characters at boundaries
        replaced with ``fillchar``.

    :raises ValueError: If ``end`` is negative and not ``-1``, or if
        ``control_codes='strict'`` and an indeterminate-effect sequence or
        out-of-bounds cursor movement is encountered.

    SGR (terminal styling) sequences are propagated by default. The result
    begins with any active style and ends with a reset::

        >>> clip('\x1b[1;34mHello world\x1b[0m', 6, 11)
        '\x1b[1;34mworld\x1b[0m'
        >>> clip('\x1b[1mbold\x1b[m normal', 1, 9)
        '\x1b[1mold\x1b[m norm'

    Set ``propagate_sgr=False`` to disable this behavior.

    .. versionadded:: 0.3.0

    .. versionchanged:: 0.5.0
       Added ``propagate_sgr`` parameter (default True).

    .. versionchanged:: 0.7.0
       Added ``control_codes`` parameter (default 'parse').
       OSC 8 hyperlink-aware clipping.  OSC 66 text sizing protocol support.
       Added ``overtyping`` parameter (default None, auto-detect).

    .. versionchanged:: 0.8.4
       ``start`` now defaults to ``0`` and ``end`` to ``-1``, meaning "to the
       end of the line"::

           >>> clip('\x1b[1;34mHello world\x1b[0m', 6)
           '\x1b[1;34mworld\x1b[0m'

    Example::

        >>> clip('hello world', 0, 5)
        'hello'
        >>> clip('中文字', 0, 3)  # Wide char split at column 3
        '中 '
        >>> clip('a\tb', 0, 10)  # Tab expanded to spaces
        'a       b'
    r   r>   z5end must be -1 (to end of line) or non-negative, got r/   rs   Fignorer   r   r   )
rJ   rK   rL   rD   rA   rB   rC   r@   r   r?   )rF   r   sysmaxsizeisasciiisprintabler   r   r   r   r   r   r<   )rJ   rK   rL   rC   r@   rA   rD   r?   r   rB   has_escfn_clips               r(   rG   rG     s-   n qME
Qw"9GuMO O kk
e| ||~$**,E#,_=O nGW  X% Kt^ Jtt| JH$:AA$GH 	
 
1
)m|GG#'!)#  r'   r{   )r8   r0   r9   Optional[_SGRState]r:   r   r   r0   )rJ   r0   rK   r,   rL   r,   rC   r0   r@   r,   rA   r,   rB   
bool | strr?   $Literal['parse', 'strict', 'ignore']rM   r   rN   r,   rO   r,   r   r*   )r_   zdict[int, tuple[str, int]]r`   zlist[tuple[int, int, str]]rK   r,   rL   r,   rC   r0   r   r0   )rJ   r0   rK   r,   rL   r,   rD   r   rA   r,   rB   r   rC   r0   r@   r,   r   r   r?   r   r   z4tuple[str, Optional[_SGRState], Optional[_SGRState]])r   r   rO   r,   rK   r,   rL   r,   rC   r0   rA   r,   rB   r   r   zCallable[[str, int, int], None]r   r,   )r   r>   )rJ   r0   rK   r,   rL   r,   rC   r0   r@   r,   rA   r,   rD   r   r?   r   r   zOptional[bool]rB   r   r   r0   )-r   
__future__r   r   r    	itertoolsr   typingr   r   r   r   _widthr
   r   r   	hyperlinkr   r   	sgr_stater   r   r   r   r   r   
_constantsr   text_sizingr   r   escape_sequencesr   r   r   Enumr   r*   r<   rT   rp   r   r   r   rG   r&   r'   r(   <module>r      s<   0 "    : :  $ 10 0 / 5> >
tyy z $ 6:2>A,C
CC 
C 	C
 C C C 8C C C 
C CL4%4)4 4 
	4
 4 	4n|6
|6|6 
|6
 |6 |6 |6 |6 |6 |6 8|6 :|6~UU	U U 
	U
 U U U 1U 	UpE'
E'E' 
E'
 E' E' E' E' E' E' 8E' :E'T c
 :A!%$c
cc 
c
 c c c c 8c c c 	cr'   