+
    Ri'                       R t ^ RIHt ^ RIHt ^ RIHt ^RIHt ^RI	H
t
HtHt ^RIHt ]'       d   ^ RIHtHt ^ RIHt . ROt ! R
 R	]4      t ! R R4      tR]P.                  3R R lltRR R lltRR R lltR R ltR R ltR# )z
Search operations.

For the key bindings implementation with attached filters, check
`prompt_toolkit.key_binding.bindings.search`. (Use these for new key bindings
instead of calling these function directly.)
)annotations)Enum)TYPE_CHECKING)get_app)FilterOrBoolis_searching	to_filter)	InputMode)BufferControlSearchBufferControl)LayoutSearchDirectionc                      ] tR t^tRtRtRtR# )r   FORWARDBACKWARD N)__name__
__module____qualname____firstlineno__r   r   __static_attributes__r       T/home/ubuntu/hermes-agent/venv/lib/python3.14/site-packages/prompt_toolkit/search.pyr   r      s    GHr   c                  `    ] tR t^"tRtRtR]P                  R3R R lltR R lt	R R	 lt
R
tR# )SearchStateaK  
A search 'query', associated with a search field (like a SearchToolbar).

Every searchable `BufferControl` points to a `search_buffer_control`
(another `BufferControls`) which represents the search field. The
`SearchState` attached to that search field is used for storing the current
search query.

It is possible to have one searchfield for multiple `BufferControls`. In
that case, they'll share the same `SearchState`.
If there are multiple `BufferControls` that display the same `Buffer`, then
they can have a different `SearchState` each (if they have a different
search control).
 Fc               (    V ^8  d   QhRRRRRRRR/# )	   textstr	directionr   ignore_caser   returnNoner   )formats   "r   __annotate__SearchState.__annotate__4   s2     2 22 #2 "	2
 
2r   c                	>    Wn         W n        \        V4      V n        R # N)r   r    r   r!   )selfr   r    r!   s   &&&&r   __init__SearchState.__init__4   s     	"$[1r   c                   V ^8  d   QhRR/# )r   r"   r   r   )r$   s   "r   r%   r&   >   s     { {# {r   c                	    V P                   P                   R V P                  : RV P                  : RV P                  : R2# )(z, direction=z, ignore_case=))	__class__r   r   r    r!   )r)   s   &r   __repr__SearchState.__repr__>   s?    ..))*!DII=T^^DVVdeieueudxxyzzr   c                   V ^8  d   QhRR/# )r   r"   r   r   )r$   s   "r   r%   r&   A   s     
 
K 
r   c                    V P                   \        P                  8X  d   \        P                  pM\        P                  p\	        V P
                  WP                  R7      # )zU
Create a new SearchState where backwards becomes forwards and the other
way around.
r   r    r!   )r    r   r   r   r   r   r!   )r)   r    s   & r   
__invert__SearchState.__invert__A   sH    
 >>_555'//I'00Ii=M=M
 	
r   )r    r!   r   Nr5   )r   r   r   r   __doc__	__slots__r   r   r*   r1   r6   r   r   r   r   r   r   "   s4     5I %4%<%<$)	2{
 
r   r   Nc               $    V ^8  d   QhRRRRRR/# )r   buffer_controlBufferControl | Noner    r   r"   r#   r   )r$   s   "r   r%   r%   P   s&     $9 $9($9$9 
$9r   c                   ^ RI Hp V e   \        W4      '       g   Q h\        4       P                  pV f+   \        VP
                  V4      '       g   R# VP
                  p V P                  pV'       dY   WP                  n        VP                  V4       WP                  V&   \        P                  \        4       P                  n        R# R# )z
Start search through the given `buffer_control` using the
`search_buffer_control`.

:param buffer_control: Start search for this `BufferControl`. If not given,
    search through the current control.
r
   N)prompt_toolkit.layout.controlsr
   
isinstancer   layoutcurrent_controlsearch_buffer_controlsearch_stater    focussearch_linksr	   INSERTvi_state
input_mode)r;   r    r
   rA   rC   s   &&   r   start_searchrJ   P   s     =!Z%N%NNNYF &00-@@// +@@09##- 	*+ 6D12 )2(8(8	% r   c                    V ^8  d   QhRRRR/# )r   r;   r<   r"   r#   r   )r$   s   "r   r%   r%   w   s     9 9 4 9 9r   c                   \        4       P                  pV f    VP                  p V f   R# V P                  pM2WP                  P                  4       9   g   Q h\        V4      V ,          pVP                  V 4       Ve(   VP                  V VP                  P                  4        \        P                  \        4       P                  n        R# )z1
Stop search through the given `buffer_control`.
N)r   rA   search_target_buffer_controlrC   rF   values_get_reverse_search_linksrE   bufferresetr	   
NAVIGATIONrH   rI   )r;   rA   rC   s   &  r   stop_searchrS   w   s     YF<<!  . D D!4!4!;!;!==== 9& A. Q LL ( 56 	$$**, %.$8$8GI!r   c               $    V ^8  d   QhRRRRRR/# )r   r    r   countintr"   r#   r   )r$   s   "r   r%   r%      s!     
 
_ 
S 
 
r   c                   \        4       '       g   Q h\        4       P                  p^ RIHp VP
                  p\        WC4      '       g   R# VP                  pVf   R# VP                  pVP                  V 8g  pVP                  P                  Vn        Wn	        V'       g!   VP                  P                  VRVR7       R# R# )z/
Apply search, but keep search buffer focused.
r>   NF)include_current_positionrU   )r   r   rA   r?   r
   rB   r@   rM   rD   r    rP   r   apply_search)r    rU   rA   r
   search_controlprev_controlrD   direction_changeds   &&      r   do_incremental_searchr]      s     >>>YF =++Nn4466L,,L %..);&--22L& ((5 	) 	
 r   c                   V ^8  d   QhRR/# )r   r"   r#   r   )r$   s   "r   r%   r%      s     ' 't 'r   c                    \        4       P                  p V P                  pV P                  p^ RIHp \        W4      '       g   R# Vf   R# VP                  pVP                  P                  '       d   VP                  P                  Vn	        VP                  P                  VRR7       VP                  P                  4        \        V4       R# )zD
Accept current search query. Focus original `BufferControl` again.
r>   NT)rX   )r   rA   rB   rM   r?   r
   r@   rD   rP   r   rY   append_to_historyrS   )rA   rZ   target_buffer_controlr
   rD   s        r   accept_searchrb      s     YF++N"??<n44$(55L !!!*1166   --t . 
 ++- %&r   c                    V ^8  d   QhRRRR/# )r   rA   r   r"   z(dict[BufferControl, SearchBufferControl]r   )r$   s   "r   r%   r%      s     	 		-	r   c                j    V P                   P                  4        UUu/ uF  w  rW!bK	  	  upp# u uppi )z;
Return mapping from BufferControl to SearchBufferControl.
)rF   items)rA   rC   r;   s   &  r   rO   rO      s?     6<5H5H5N5N5P5P1! 	-5P  s   /)r   rJ   rS   r(   )   )r8   
__future__r   enumr   typingr   application.currentr   filtersr   r   r   key_binding.vi_stater	   r?   r
   r   prompt_toolkit.layout.layoutr   __all__r   r   r   rJ   rS   r]   rb   rO   r   r   r   <module>ro      sr    #    ( : : +Q3d 
+
 +
^ ,0!0!8!8$9N9>
B'D	r   