+
    j,i                     :   R t ^ RIHt ^ RIt^ RIHtHtHt ^RIH	t	 ^RI
Ht ^RIHt R.t]P                  ! R]P                   ! R	4      ,           R
,           4      t]P                  ! R]P                   ! R	4      ,           R,           4      t]P                  ! R]P                   ! R	4      ,           R,           4      t]P                  ! R]P                   ! R	4      ,           R,           4      t ! R R4      t ! R R]]]3,          4      t]! 4       t ! R R4      tR# )z 
Parser for VT100 input stream.
)annotationsN)CallableDict	Generator)KeyPress)Keys)ANSI_SEQUENCESVt100Parser^z[z
\d+;\d+R\Zz(<?[\d;]+[mM]|M...)\Zz[\d;]*\Zz(<?[\d;]*|M.{0,2})\Zc                      ] tR t^$tRtRtR# )_Flushz8Helper object to indicate flush operation to the parser. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       C/usr/lib/python3/dist-packages/prompt_toolkit/input/vt100_parser.pyr   r   $   s    Br   r   c                  &    ] tR t^*tRtR R ltRtR# )_IsPrefixOfLongerMatchCachezx
Dictionary that maps input sequences to a boolean indicating whether there is
any key that start with this characters.
c                    V ^8  d   QhRRRR/# )   prefixstrreturnboolr   )formats   "r   __annotate__(_IsPrefixOfLongerMatchCache.__annotate__0   s      # $ r   c                	B  a \         P                  S4      '       g   \        P                  S4      '       d   R pM`\        ;QJ d2    V3R l\        P
                  ! 4        4       F  '       g   K   R M'	  RM#! V3R l\        P
                  ! 4        4       4      pW S&   V# )Tc              3  p   <"   T F+  w  rVP                  S4      '       g   K  VS8w  g   K'  Vx  K-  	  R # 5iN)
startswith).0kvr   s   &  r   	<genexpr>:_IsPrefixOfLongerMatchCache.__missing__.<locals>.<genexpr>9   s4      2DA<<' ,-K 2s   66
6F)_cpr_response_prefix_rematch_mouse_event_prefix_reanyr   items)selfr   results   &f r   __missing__'_IsPrefixOfLongerMatchCache.__missing__0   s     #((004J4P4P5
 5
 F S *002SSS *002 F Vr   r   N)r   r   r   r   r   r1   r   r   r   r   r   r   *   s    
 r   r   c                      ] tR t^FtRtR R ltRR R lltR R ltR R	 ltR
 R lt	R R lt
R R ltR R ltR R ltRtR# )r	   a2  
Parser for VT100 input stream.
Data can be fed through the `feed` method and the given callback will be
called with KeyPress objects.

::

    def callback(key):
        pass
    i = Vt100Parser(callback)
    i.feed('data...')

:attr feed_key_callback: Function that will be called when a key is parsed.
c                    V ^8  d   QhRRRR/# )r   feed_key_callbackzCallable[[KeyPress], None]r   Noner   )r   s   "r   r   Vt100Parser.__annotate__Y   s      *D  r   c                	2    Wn         V P                  4        R # r#   )r5   reset)r/   r5   s   &&r   __init__Vt100Parser.__init__Y   s    !2

r   c                    V ^8  d   QhRRRR/# )r   requestr   r   r6   r   )r   s   "r   r   r7   ]   s      T d r   c                	4    R V n         V P                  4        R# )FN)_in_bracketed_paste_start_parser)r/   r=   s   &&r   r9   Vt100Parser.reset]   s    #( r   c                   V ^8  d   QhRR/# r   r   r6   r   )r   s   "r   r   r7   a   s     & &t &r   c                f    V P                  4       V n        V P                  P                  R4       R# )z
Start the parser coroutine.
N)_input_parser_generator_input_parsersendr/   s   &r   r@   Vt100Parser._start_parsera   s)     "99;%r   c                    V ^8  d   QhRRRR/# )r   r   r   r   zNone | Keys | tuple[Keys, ...]r   )r   s   "r   r   r7   h   s       )G r   c                    \         P                  V4      '       d   \        P                  # \        P                  V4      '       d   \        P
                  #  \        V,          #   \         d     R# i ; i)z4
Return the key (or keys) that maps to this prefix.
N)_cpr_response_rer+   r   CPRResponse_mouse_event_reVt100MouseEventr   KeyError)r/   r   s   &&r   
_get_matchVt100Parser._get_matchh   s`     !!&))###""6**'''	!&)) 		s   A% %A43A4c                   V ^8  d   QhRR/# )r   r   z#Generator[None, str | _Flush, None]r   )r   s   "r   r   r7   {   s     0, 0,)L 0,r   c              #  ~  "   RpRpRp RpV'       d   RpM%Rx p\        V\        4      '       d   RpMW,          pV'       g   K=  \        V,          pV P                  V4      pV'       g	   V'       g   V'       d   V P	                  Wa4       RpK  V'       g   V'       d   K  V'       d   K  RpRp\        \        V4      ^ R4       F;  pV P                  VRV 4      pV'       g   K!  V P	                  WaRV 4       WR pRpK=  	  V'       d   EK  V P	                  V^ ,          V^ ,          4       VR,          pEK4  5i)z1
Coroutine (state machine) for the input parser.
 FTN:   NN)
isinstancer    _IS_PREFIX_OF_LONGER_MATCH_CACHErQ   _call_handlerrangelen)	r/   r   retryflushcis_prefix_of_longer_matchr+   foundis	   &        r   rE   #Vt100Parser._input_parser_generator{   s     E a(( EKF v,LV,T)/ !:&&u5F #<#<ee!E E #3v;26 $r
 ; 5 ..uRajA%+BZF$(E 7 !5**6!9fQi@!'s@   D=-D=%D=,D=4D=<D=D=#D=-6D=(#D=,D=c               $    V ^8  d   QhRRRRRR/# )r   keyzstr | Keys | tuple[Keys, ...]insert_textr   r   r6   r   )r   s   "r   r   r7      s)     C C0C?BC	Cr   c                   \        V\        4      '       d1   \        V4       F  w  r4T P                  YC^ 8X  d   TMR4       K!  	  R# V\        P
                  8X  d   RV n        RV n        R# V P                  \        W4      4       R# )z
Callback to handler.
rU   TN)
rX   tuple	enumeraterZ   r   BracketedPaster?   _paste_bufferr5   r   )r/   re   rf   rb   r&   s   &&&  r   rZ   Vt100Parser._call_handler   sl     c5!!
 "#""1!VkD ' d)))+/(%'"&&x'ABr   c                    V ^8  d   QhRRRR/# r   datar   r   r6   r   )r   s   "r   r   r7      s     $/ $/ $/ $/r   c                X   V P                   '       d   V ;P                  V,          un        RpW P                  9   d   V P                  P                  V4      pV P                  RV pV P                  \	        \
        P                  V4      4       RV n         V P                  V\        V4      ,           R pRV n        V P                  V4       R# R# \        V4       FH  w  rgV P                   '       d   V P                  WR 4        R# V P                  P                  V4       KJ  	  R# )z>
Feed the input stream.

:param data: Input string (unicode).
z[201~NFrU   )r?   rk   indexr5   r   r   rj   r\   feedri   rF   rG   )r/   ro   end_mark	end_indexpaste_content	remainingrb   r_   s   &&      r   rr   Vt100Parser.feed   s     ###$&"H--- ..44X>	 !% 2 2:I >&&x0C0C]'ST ,1( ..y3x=/H/JK	%'"		)$ .  "$+++ IId2h'&&++A. (r   c                   V ^8  d   QhRR/# rC   r   )r   s   "r   r   r7      s     * *t *r   c                L    V P                   P                  \        4       4       R# )a  
Flush the buffer of the input stream.

This will allow us to handle the escape key (or maybe meta) sooner.
The input received by the escape key is actually the same as the first
characters of e.g. Arrow-Up, so without knowing what follows the escape
sequence, we don't know whether escape has been pressed, or whether
it's something else. This flush function should be called after a
timeout, and processes everything that's still in the buffer as-is, so
without assuming any characters will follow.
N)rF   rG   r   rH   s   &r   r^   Vt100Parser.flush   s     	)r   c                    V ^8  d   QhRRRR/# rn   r   )r   s   "r   r   r7      s      3 4 r   c                H    V P                  V4       V P                  4        R# )z(
Wrapper around ``feed`` and ``flush``.
N)rr   r^   )r/   ro   s   &&r   feed_and_flushVt100Parser.feed_and_flush   s     			$

r   )r?   rF   rk   r5   N)F)r   r   r   r   r   r:   r9   r@   rQ   rE   rZ   rr   r^   r}   r   r   r   r   r	   r	   F   s<    $&&0,dC($/L* r   )r   
__future__r   retypingr   r   r   key_binding.key_processorr   keysr   ansi_escape_sequencesr   __all__compileescaperL   rN   r*   r,   r   r   r   r   rY   r	   r   r   r   <module>r      s    # 	 , , 0  1  ::cBIIg$66FG  **S299W#558PPQ
 **S299W+=%=%KL C"))G*<$<?V$VW 	 	$sDy/ 2 $?#@  t tr   