+
    Qii  c                  s2   R t ^ RIHt RtRtRtRtRt^ RIt^ RI	t	^ RI
t
^ RIHt ^ RIt]P                  ! R	R
4       ^ RIHt ^ RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt ^RIHt  ! R R]P<                  4      t ! R R4      t R# ):Utilities for obtaining information about accessible text.)annotationsz$Id$z
$Revision$z$Date$zGCopyright (c) 2024 Igalia, S.L.Copyright (c) 2024 GNOME Foundation Inc.ZLGPLN)	GeneratorAtspiz2.0)r   )GLib)
colornames)debug)messages)settings)text_attribute_names)AXObject)AXUtilitiesRole)AXUtilitiesStatec                  s   ] tR t^;tRtRtRtRtRtRt	Rt
RtRtRtRtRtRtRtRtR tR!tR"tR#tR$tR%tR&tR'tR(tR)tR*tR+tR,tR-t R.t!R/t"R0t#R1t$R2t%R3t&R4t'R5t(R6t)]*R R l4       t+]*R R l4       t,R R lt-R R	 lt.R
 R lt/R R lt0R R lt1Rt2R# )7AXTextAttributez/Enum representing an accessible text attribute.c                    V ^8  d   QhRRRR/#    stringstrreturnz'AXTextAttribute' | None Zformat   "1/usr/lib/python3.14/site-packages/orca/ax_text.py__annotate__AXTextAttribute.__annotate__g   s       )A     c                J    V  F  pVP                  4       V8X  g   K  Vu # 	  R# )z5Returns the AXTextAttribute for the specified string.N)get_attribute_nameZclsr   Z	attribute   && r   from_stringZAXTextAttribute.from_stringf   *     I++-7    r   c               r   r   r   r   r   r   r   r   q   s      3 3K r   c                r   )z?Returns the AXTextAttribute for the specified localized string.N)get_localized_namer   r   r   from_localized_stringZ%AXTextAttribute.from_localized_stringp   r    r   c                   V ^8  d   QhRR/# r   r   r   r   r   r   r   r   r   z   s      C r   c                s(    V P                   ^ ,          # )z0Returns the non-localized name of the attribute.valueself   &r   r   Z"AXTextAttribute.get_attribute_namez        zz!}r   c               r#   r$   r   r   r   r   r   r      s     D DC Dr   c                sf    V P                   ^ ,          p\        P                  P                  W4      # )z,Returns the localized name of the attribute.)r&   r	   Zattribute_namesget)r(   Zname   & r   r!   Z"AXTextAttribute.get_localized_name   s(     zz!}#3377CCr   c               r#   r$   r   r   r   r   r   r      s     G GC Gr   c                s>   Vf   R# VP                  R4      '       dx   VP                  R4      ^ ,          p\        P                  ! 4       R,          V9   d    \        P
                  ! \        V4      4      # \        P
                  ! \        V4      4      # V \        P                  \        P                  39   dC   \        P                  '       d   \        P                  ! V4      # \        P                  ! V4      # VP!                  RR4      pV \        P"                  8X  d   VP!                  RR4      pMJV \        P$                  8X  d6   VP                  R4      ^ ,          P'                  4       P'                  R4      p\(        P*                  P-                  W4      # )	z-Returns the localized value of the attribute. ZpxZdecimal_pointz-mozZjustifyZfillZ,Z")endswithsplitlocaleZ
localeconvr   Zpixel_countfloatintr   BG_COLORFG_COLORr   ZuseColorNamesr   Zrgb_string_to_color_nameZnormalize_rgb_stringreplaceJUSTIFICATIONFAMILY_NAMEstripr	   Zattribute_valuesr+   )r(   r&      &&r   get_localized_valueZ#AXTextAttribute.get_localized_value   s3    =>>$KK%a(E  "?3u<++E%L99''E
33O,,o.F.FGG%%%!::5AA22599 fb) ?000MM)V4E_000KK$Q'--/55c:E#4488FFr   c               r#   r   r   boolr   r   r   r   r   r      s      4 r   c                s(    V P                   ^,          # )z=Returns True if the attribute should be presented by default.r%   r'   r)   r   should_present_by_defaultZ)AXTextAttribute.should_present_by_default   r*   r   c               r#   r;   r   r   r   r   r   r      s       r   c                sX   . ROpW9   d   R# V \         P                  8X  d   \        V4      R8H  # V \         P                  8X  d   VR8H  # V \         P                  8X  d   VR8H  # V \         P
                  8X  d2   \        P                  ! 4       ^ ,          ;'       g    RpWR,          8H  # R# )	zPReturns True if value should be treated as the default value for this attribute.r-   Tg      ?ZbaselineZ400:Nr   NF)Z0Z0mmZ0pxZnoneZfalseZnormalr-   N)r   SCALEr1   TEXT_POSITIONWEIGHTLANGUAGEr0   Z	getlocale)r(   r&   Znull_valuesZloc   &&  r   value_is_defaultZ AXTextAttribute.value_is_default   s     O?(((<3&&?000J&&?)))E>!?+++""$Q'--2CG##r   r   N)zbg-colorT)zbg-full-heightF)z
bg-stippleF)Z	directionF)ZeditableF)zfamily-nameT)zfg-colorT)z
fg-stippleF)zfont-effectT)indentT)invalidT)Z	invisibleF)justificationT)ZlanguageF)zleft-marginF)zline-heightF)zparagraph-styleT)zpixels-above-linesF)zpixels-below-linesF)zpixels-inside-wrapF)zright-marginF)ZriseF)ZscaleF)ZsizeT)ZstretchF)ZstrikethroughT)ZstyleT)ztext-decorationT)ztext-positionF)ztext-rotationT)ztext-shadowF)	underlineT)ZvariantF)zvertical-alignF)ZweightT)z	wrap-modeF)zwriting-modeF)3__name__
__module____qualname____firstlineno____doc__r3   ZBG_FULL_HEIGHTZ
BG_STIPPLEZ	DIRECTIONZEDITABLEr7   r4   Z
FG_STIPPLEZFONT_EFFECTZINDENTZINVALIDZ	INVISIBLEr6   rA   ZLEFT_MARGINZLINE_HEIGHTZPARAGRAPH_STYLEZPIXELS_ABOVE_LINESZPIXELS_BELOW_LINESZPIXELS_INSIDE_WRAPZRIGHT_MARGINZRISEr>   ZSIZEZSTRETCHZSTRIKETHROUGHZSTYLEZTEXT_DECORATIONr?   ZTEXT_ROTATIONZTEXT_SHADOWZ	UNDERLINEZVARIANTZVERTICAL_ALIGNr@   Z	WRAP_MODEZWRITING_MODEZclassmethodr   r"   r   r!   r:   r=   rC   __static_attributes__r   r   r   r   r   ;   s	   9 "H.N&J$I"H'K!H&J'KFG$I+M"H(K(K/O666*LDED G+ME/O,M+M(K#I G.NF$I*L   
DG8
 r   r   c                  s   ] tR t^t$ Rt/ tR]R&   ]RR R ll4       t]R R l4       t	]RR	 R
 ll4       t
]RR R ll4       t]RR R ll4       t]RR R ll4       t]R R l4       t]RR R ll4       t]RR R ll4       t]RR R ll4       t]RR R ll4       t]R R l4       t]RR R ll4       t]RR R  ll4       t]RR! R" ll4       t]R# R$ l4       t]R% R& l4       t]RR' R( ll4       t]RR) R* ll4       t]R+ R, l4       t]RR- R. ll4       t]RR/ R0 ll4       t]RR1 R2 ll4       t]RR3 R4 ll4       t]R5 R6 l4       t ]RR7 R8 ll4       t!]RR9 R: ll4       t"]RR; R< ll4       t#]R= R> l4       t$]R? R@ l4       t%]RA RB l4       t&]RC RD l4       t']RE RF l4       t(]RG RH l4       t)]RI RJ l4       t*]RK RL l4       t+]RM RN l4       t,]RO RP l4       t-]RQ RR l4       t.]RS RT l4       t/]RU RV l4       t0]RW RX l4       t1]RY RZ l4       t2]R[ R\ l4       t3]R] R^ l4       t4]R_ R` l4       t5]Ra Rb l4       t6]Rc Rd l4       t7]RRe Rf ll4       t8]Rg Rh l4       t9]RRi Rj ll4       t:]RRk Rl ll4       t;]Rm Rn l4       t<]Ro Rp l4       t=]RRq Rr ll4       t>]Rs Rt l4       t?]Ru Rv l4       t@]Rw Rx l4       tA]Ry Rz l4       tB]R{ R| l4       tC]R} R~ l4       tD]RR R ll4       tE]RR R ll4       tF]R R l4       tG]R R l4       tH]R R l4       tI]R R l4       tJ]RR R ll4       tK]RR R ll4       tLRtMR# )AXTextr    zdict[int, tuple[str, int, int]]CACHED_TEXT_SELECTIONNc               $    V ^8  d   QhRRRRRR/# r   objAtspi.Accessibleoffset
int | Noner   tuple[str, int, int]r   r   r   r   r   AXText.__annotate__   s+     "F "F"F"F 
"Fr   c           	     s   \         P                  V 4      pV'       g   R# Vf   \         P                  V 4      p^ Tu;8:  d   V8:  g1   M RV R2p\        P                  ! \        P
                  VR4       R#  \        P                  P                  W\        P                  P                  4      pTf2   RT RT R2.p\        P                  ! \        P
                  TR4       R# TP                  P                  R	R
4      pRT R2T RT RTP                    RTP"                   R2.p\        P                  ! \        P
                  TR4       TP                  TP                   TP"                  3#   \        P                   d8   pRT 2p\        P                  ! \        P
                  TR4       Ru Rp?# Rp?ii ; i)zHReturns the (character, start, end) for the current or specified offset.NzWARNING: Offset z, is not valid. No character can be provided.Tz.AXText: Exception in get_character_at_offset: z.AXText: get_string_at_offset (char) failed forat .
\nzAXText: Character at offset  in'' (-)r-       rb   )rN   get_character_countget_caret_offsetr   print_message
LEVEL_INFOr   Textget_string_at_offsetTextGranularityZCHARr   GErrorprint_tokenscontentr5   start_offset
end_offset)rR   rT   lengthmsgresulterrortokensdebug_string   &&      r   get_character_at_offsetZAXText.get_character_at_offset   s    ++C0O>,,S1FF$f$$VH,XYC 0 0#t<O	ZZ44S%BWBWB\B\]F >FsSYRZZ[_]Fu//>O~~--dE:0<cl^3v':':&;1V=N=N<OqQS5++VT:~~v22F4E4EEE {{ 	B5'JC 0 0#t<O	s   98E2 2F>,F93F>9F>c               (    V ^8  d   QhRRRRRRRR/# r   rR   rS   xr2   yr   rV   r   r   r   r   r   rW      *     ; ;$4 ; ; ;I] ;r   c                    \         P                  WV4      p^ Tu;8:  d   \         P                  V 4      8  g   M R# \         P                  W4      # )z;Returns the (character, start, end) at the specified point.ra   )rN   get_offset_at_pointrc   rv   rR   ry   rz   rT      &&& r   get_character_at_pointZAXText.get_character_at_point   D     ++CA6F<V77<<O--c::r   c               rP   rQ   r   r   r   r   r   rW      &       
r   c                :   Vf   \         P                  V 4      p\         P                  W4      w  r#pV'       g   R# \         P                  V 4      p\	        WA^,           4      pWe8  d3   \         P                  W4      w  rxp	WxV	3W#V38w  d   WxV	3# V^,          pK8  R# )zMReturns the next (character, start, end) for the current or specified offset.ra   )rN   rd   rv   rc   max)
rR   rT   current_characterstartendro   next_offsetZnext_character
next_startnext_end
   &&        r   get_next_characterZAXText.get_next_character        >,,S1F(.(F(Fs(S%# O++C0#z*"393Q3QRU3c0NH5:KTW9XX%8;;1Kr   c               rP   rQ   r   r   r   r   r   rW     &       
r   c                   Vf   \         P                  V 4      p\         P                  W4      w  r#pV'       g   R# V^ 8:  d   R# V^,
          pV^ 8  d3   \         P                  W4      w  rgpWgV3W#V38w  d   WgV3# V^,          pK9  R# )zQReturns the previous (character, start, end) for the current or specified offset.ra   )rN   rd   rv   )	rR   rT   r   r   r   prev_offsetZprev_character
prev_startprev_end	   &&       r   get_previous_characterZAXText.get_previous_character       >,,S1F(.(F(Fs(S%# OA:OaiQ393Q3QRU3c0NH5:KTW9XX%8;;1Kr   c               rP   r   rR   rS   rT   rU   r   z+Generator[tuple[str, int, int], None, None]r   r   r   r   r   rW   "  s&     0 000 
50r   c              #  $  "   Vf   \         P                  V 4      pRp\         P                  V 4      pW8  dV   \         P                  W4      w  rEpVf   V'       g   R# V'       d   WEV3V8w  d   WEV3x  \	        Wa^,           4      pWEV3pK[  R# 5i)zOGenerator to iterate by character in obj starting with the character at offset.N)rN   rd   rc   rv   r   )rR   rT   last_resultro   	characterr   r      &&     r   iter_characterZAXText.iter_character!  s      >,,S1F++C0o$*$B$B3$O!Ic"9i4C++qj)F#C/K    AB	B')Bc               rP   rQ   r   r   r   r   r   rW   7  +     F FFF 
Fr   c           	        \         P                  V 4      pV'       g   R# Vf   \         P                  V 4      p\        \	        ^ V4      V^,
          4      p \
        P                  P                  W\
        P                  P                  4      pTf2   RT RT R2.p\        P                  ! \        P                  TR4       R# RT R2T R	TP                    R
TP"                   RTP$                   R2.p\        P                  ! \        P                  TR4       TP                   TP"                  TP$                  3#   \        P                   d8   pRT 2p\        P                  ! \        P                  TR4       Ru Rp?# Rp?ii ; i)zCReturns the (word, start, end) for the current or specified offset.Nz)AXText: Exception in get_word_at_offset: Tz.AXText: get_string_at_offset (word) failed forrX   rY   zAXText: Word at offset r\   r]   r^   r_   r`   ra   )rN   rc   rd   minr   r   rg   rh   ri   ZWORDr   rj   r   re   rf   rk   rl   rm   rn   rR   rT   ro   rq   rr   rp   rs   r   r   get_word_at_offsetZAXText.get_word_at_offset6  s_    ++C0O>,,S1FSF^VaZ0	ZZ44S%BWBWB\B\]F >FsSYRZZ[_]Fu//>O+F837fnn%S)<)<(=Qv?P?P>QQRSU5++VT:~~v22F4E4EEE {{ 	=eWEC 0 0#t<O	   8D> >F
,F?F
F
c               rw   rx   r   r   r   r   r   rW   W  *     6 6/ 6C 6C 6DX 6r   c                r|   )z6Returns the (word, start, end) at the specified point.ra   )rN   r}   rc   r   r~   r   r   get_word_at_pointZAXText.get_word_at_pointV  D     ++CA6F<V77<<O((55r   c               rP   rQ   r   r   r   r   r   rW   a  r   r   c                r   )zHReturns the next (word, start, end) for the current or specified offset.ra   )rN   rd   r   rc   r   )
rR   rT   current_wordr   r   ro   r   Z	next_wordr   r   r   r   get_next_wordZAXText.get_next_word`       >,,S1F#)#<#<S#I SO++C0#z*".4.G.G.Y+I8x0\#4NN h661Kr   c               rP   rQ   r   r   r   r   r   rW   z  r   r   c                r   )zLReturns the previous (word, start, end) for the current or specified offset.ra   )rN   rd   r   )	rR   rT   r   r   r   r   Z	prev_wordr   r   r   r   get_previous_wordZAXText.get_previous_wordy  s     >,,S1F#)#<#<S#I SOA:OaiQ.4.G.G.Y+I8x0\#4NN h661Kr   c               rP   r   r   r   r   r   r   rW     s&     + +++ 
5+r   c              #  r   )zEGenerator to iterate by word in obj starting with the word at offset.N)rN   rd   rc   r   r   )rR   rT   r   ro   Zwordr   r   r   r   	iter_wordZAXText.iter_word  s      >,,S1F++C0o%88ED"4c*k93&&qj)Fs*K r   c               rP   rQ   r   r   r   r   r   rW     s+     7F 7F7F7F 
7Fr   c           	     s   \         P                  V 4      pV'       g   R# Vf   \         P                  V 4      p\        P                  ! V 4      '       gW   \
        P                  ! V 4      '       g;   \
        P                  ! V 4      '       g   \        \        ^ V4      V^,
          4      pM\        ^ V4      p \        P                  P                  W\        P                  P                  4      pTf2   RT RT R2.p\"        P(                  ! \"        P&                  TR4       R# TP*                  TP,                  u;8X  d   R8X  dK   M MGY8X  dB   T^,          p\        P                  P                  Y\        P                  P                  4      pTP.                  P1                  RR4      pR	T R
2T RT RTP*                   RTP,                   R2.p\"        P(                  ! \"        P&                  TR4       ^ Tu;8:  d   TP*                  8  d   M MT^,          pRT 2p\"        P$                  ! \"        P&                  TR4       \        P                  P                  Y\        P                  P                  4      pTP.                  P1                  RR4      pR	T R
2T RT RTP*                   RTP,                   R2.p\"        P(                  ! \"        P&                  TR4       TP.                  TP*                  TP,                  3#   \        P                    d8   pRT 2p\"        P$                  ! \"        P&                  TR4       Ru Rp?# Rp?ii ; i)zCReturns the (line, start, end) for the current or specified offset.Nz)AXText: Exception in get_line_at_offset: Tz.AXText: get_string_at_offset (line) failed forrX   rY   rZ   r[   zAXText: Line at offset r\   r]   r^   r_   r`   z?ERROR: Start offset is greater than offset. Trying with offset ra   )rN   rc   rd   r   Zis_multi_liner   is_paragraphZ
is_sectionr   r   r   rg   rh   ri   ZLINEr   rj   r   re   rf   rk   rm   rn   rl   r5   )rR   rT   ro   rq   rr   rp   rs   rt   ru   r   get_line_at_offsetZAXText.get_line_at_offset  s    ++C0O>,,S1F
  --c22"//44_=W=WX[=\=\Q!4FF^F	ZZ44S%BWBWB\B\]F >FsSYRZZ[_]Fu//>O &"3"39r9f>NaKFZZ44S%BWBWB\B\]F~~--dE:+F837l^3v':':&;1V=N=N<OqQS5++VT:,,,,aKFSTZS[\C 0 0#t<ZZ44S%BWBWB\B\]F!>>11$>L/xs;S~S)<)<(=Qv?P?P>QQRSUFu//>~~v22F4E4EEE? {{ 	=eWEC 0 0#t<O	s   88L M$,MMMc               rw   rx   r   r   r   r   r   rW     r   r   c                r|   )z6Returns the (line, start, end) at the specified point.ra   )rN   r}   rc   r   r~   r   r   get_line_at_pointZAXText.get_line_at_point  r   r   c               rP   rQ   r   r   r   r   r   rW     r   r   c                r   )zHReturns the next (line, start, end) for the current or specified offset.ra   )rN   rd   r   rc   r   )
rR   rT   current_liner   r   ro   r   	next_liner   r   r   r   get_next_lineZAXText.get_next_line  r   r   c               rP   rQ   r   r   r   r   r   rW     s&       
r   c                s   Vf   \         P                  V 4      p\         P                  W4      w  r#pV'       gZ   V\         P                  V 4      8X  d@   \         P                  W^,
          4      w  r#pVP	                  R4      '       d
   V^,
          pV'       d   V^ 8:  d   R# V^,
          pV^ 8  d3   \         P                  W4      w  rgpWgV3W#V38w  d   WgV3# V^,          pK9  R# )zLReturns the previous (line, start, end) for the current or specified offset.rZ   ra   )rN   rd   r   rc   r.   )	rR   rT   r   r   r   r   Z	prev_liner   r   r   r   get_previous_lineZAXText.get_previous_line  s     >,,S1F#)#<#<S#I S&*D*DS*I I'-'@'@qj'Q$L$$T**
uzOaiQ.4.G.G.Y+I8x0\#4NN h661Kr   c               rP   r   r   r   r   r   r   rW   $  s&     ' ''' 
5'r   c              #     "   \         P                  W4      w  r#pV'       g   R# Ve   W8  d   W#V3x  Tp \         P                  W4      w  rgpV'       d   Wu8:  d   R# WgV3x  TpK3  5i)zEGenerator to iterate by line in obj starting with the line at offset.N)rN   r   r   )	rR   rT   liner   r   current_startr   r   r   r   r   	iter_lineZAXText.iter_line#  sp      "44SAS >V\s"".4.B.B3.V+I8
 ;11&M   A(A*c               r   )r   textr   r   z	list[int]r   r   r   r   r   rW   @  s       	 r   c                s   V '       g   . # ^ .pRp\         P                  ! W 4       F  pVP                  4       pV\        V 4      8  d5   W,          P	                  4       '       g   W,          R8X  d   V^,          pKD  V\        V 4      8  g   Ki  WA9  g   Kq  VP                  V4       K  	  VR,          \        V 4      8w  d   VP                  \        V 4      4       V# )zJReturns the offsets in text that should be treated as sentence beginnings.z[.!?]+(?=\s|\ufffc|$)   ￼r   )reZfinditerr   lenZisspaceappend)r   
boundariesZpatternZmatchZend_pos   &    r   _find_sentence_boundariesZ AXText._find_sentence_boundaries?  s     IS
*[[/EiikGCI%4=+@+@+B+BdmW_F_1T"w'@!!'* 0 b>SY&c$i(r   c               r   )r   r   r   r   r<   r   r   r   r   r   rW   W  s     H H# H$ Hr   c                sV    \        T ;'       d    \        P                  ! RV 4      4      # )z)Check if text contains a sentence ending.z\S[.!?]+(\s|\ufffc|$))r<   r   search)r   r)   r   has_sentence_endingZAXText.has_sentence_endingV  s#     DFFRYY'?FGGr   c               rP   rQ   r   r   r   r   r   rW   ]  s&     ; ;;; 
;r   c                s   Vf   \         P                  V 4      p\         P                  V 4      pV'       d   V^ 8  g   V\        V4      8  d   R# T^ \        V4      rTp\         P	                  V4      p\        \        V4      ^,
          4       F3  pWg,          Wg^,           ,          rYu;8:  d
   V	8  g   K)  M K-  W(V	 YrTp M	  RV RV RV RV RV R2	.p
\        P                  ! \        P                  V
R4       W4V3# )	z7Fallback sentence detection for broken implementations.zAXText: Fallback sentence inz at offset z: 'r^   r_   r`   Tra   )	rN   rd   get_all_textr   r   ranger   rk   rf   )rR   rT   r   Zfallback_textZfallback_startZfallback_endr   ir   r   rs   s   &&         r    _get_sentence_at_offset_fallbackZ'AXText._get_sentence_at_offset_fallback\  s     >,,S1F""3'vzVs4y%8O6:As4y|55d;
s:*+A#
q5(93$$$>Bou|	 , 1#xs=/^<LAl^[\]_5++VT:l::r   c               rP   rQ   r   r   r   r   r   rW   x  s+     $F $F$F$F 
$Fr   c           	     s~   \         P                  V 4      pV'       g   R# Vf   \         P                  V 4      p\        \	        ^ V4      V^,
          4      p \
        P                  P                  W\
        P                  P                  4      pTf2   RT RT R2.p\        P                   ! \        P                  TR4       R# TP"                  TP$                  u;8X  d   R8X  g   M TP&                  '       g   \         P                  Y4      # TP"                  TP$                  8X  d9   TP"                  R9   d(   TP&                  '       g   \         P                  Y4      # RT R2T R	TP&                   R
TP"                   RTP$                   R2.p\        P                   ! \        P                  TR4       TP&                  TP"                  TP$                  3#   \        P                   dK   pRT 2p\        P                  ! \        P                  TR4       \         P                  Y4      u Rp?# Rp?ii ; i)zGReturns the (sentence, start, end) for the current or specified offset.Nz-AXText: Exception in get_sentence_at_offset: Tz2AXText: get_string_at_offset (sentence) failed forrX   rY   zAXText: Sentence at offset r\   r]   r^   r_   r`   ra   r   rb   r   )rN   rc   rd   r   r   r   rg   rh   ri   ZSENTENCEr   rj   r   re   rf   r   rk   rm   rn   rl   r   r   r   get_sentence_at_offsetZAXText.get_sentence_at_offsetw  s    ++C0O>,,S1FSF^VaZ0	HZZ44S%BWBWB`B`aF >JCSVW]V^^_Q`aFu//>O&"3"39r9::3GG6#4#447*6>>>::3GG/xs;Sfnn%S)<)<(=Qv?P?P>QQRSU5++VT:~~v22F4E4EEE) {{ 	HA%IC 0 0#t<::3GG	Hs   8G H<2?H71H<7H<c               rw   rx   r   r   r   r   r   rW     s*     : :#3 : : :H\ :r   c                r|   )z:Returns the (sentence, start, end) at the specified point.ra   )rN   r}   rc   r   r~   r   r   get_sentence_at_pointZAXText.get_sentence_at_point  sD     ++CA6F<V77<<O,,S99r   c               rP   rQ   r   r   r   r   r   rW     r   r   c                r   )zLReturns the next (sentence, start, end) for the current or specified offset.ra   )rN   rd   r   rc   r   )
rR   rT   current_sentencer   r   ro   r   next_sentencer   r   r   r   get_next_sentenceZAXText.get_next_sentence  s     >,,S1F'-'D'DS'Q$O++C0#z*"282O2OPS2a/Mx849IRU8VV$(::1Kr   c               rP   rQ   r   r   r   r   r   rW     r   r   c                r   )zPReturns the previous (sentence, start, end) for the current or specified offset.ra   )rN   rd   r   )	rR   rT   r   r   r   r   Zprev_sentencer   r   r   r   get_previous_sentenceZAXText.get_previous_sentence  s     >,,S1F'-'D'DS'Q$OA:OaiQ282O2OPS2a/Mx849IRU8VV$(::1Kr   c               rP   r   r   r   r   r   r   rW     s&     ' ''' 
5'r   c              #  r   )zMGenerator to iterate by sentence in obj starting with the sentence at offset.N)rN   r   r   )	rR   rT   Zsentencer   r   r   r   r   r   r   r   iter_sentenceZAXText.iter_sentence  sp       &<<SI
 >V\3&&282J2J32^/Mx J$?X55&Mr   c               rP   rQ   r   r   r   r   r   rW     r   r   c           	     r   )zHReturns the (paragraph, start, end) for the current or specified offset.Nz.AXText: Exception in get_paragraph_at_offset: Tz3AXText: get_string_at_offset (paragraph) failed forrX   rY   zAXText: Paragraph at offset r\   r]   r^   r_   r`   ra   )rN   rc   rd   r   r   r   rg   rh   ri   Z	PARAGRAPHr   rj   r   re   rf   rk   rl   rm   rn   r   r   r   get_paragraph_at_offsetZAXText.get_paragraph_at_offset  sa    ++C0O>,,S1FSF^VaZ0	ZZ44S%BWBWBaBabF >KSTWX^W__`RabFu//>O0<cfnn%S)<)<(=Qv?P?P>QQRSU5++VT:~~v22F4E4EEE {{ 	B5'JC 0 0#t<O	r   c               rw   rx   r   r   r   r   r   rW     r{   r   c                r|   )z;Returns the (paragraph, start, end) at the specified point.ra   )rN   r}   rc   r   r~   r   r   get_paragraph_at_pointZAXText.get_paragraph_at_point  r   r   c               rP   rQ   r   r   r   r   r   rW      r   r   c                r   )zMReturns the next (paragraph, start, end) for the current or specified offset.ra   )rN   rd   r   rc   r   )
rR   rT   current_paragraphr   r   ro   r   Znext_paragraphr   r   r   r   get_next_paragraphZAXText.get_next_paragraph  r   r   c               rP   rQ   r   r   r   r   r   rW   9  r   r   c                r   )zQReturns the previous (paragraph, start, end) for the current or specified offset.ra   )rN   rd   r   )	rR   rT   r   r   r   r   Zprev_paragraphr   r   r   r   get_previous_paragraphZAXText.get_previous_paragraph8  r   r   c               rP   r   r   r   r   r   r   rW   T  s$     0 00'10	40r   c              #  r   )zOGenerator to iterate by paragraph in obj starting with the paragraph at offset.N)rN   rd   rc   r   r   )rR   rT   r   ro   Z	paragraphr   r   r   r   iter_paragraphZAXText.iter_paragraphS  s      >,,S1F++C0o$*$B$B3$O!Ic"9i4C++qj)F#C/K r   c               r   r   rR   rS   r   r<   r   r   r   r   r   rW   h  s     
 
*: 
t 
r   c                s"   \         P                  ! V 4      '       g   R# \        P                  V ^ 4      w  rpT;'       d    ^ Tu;8*  ;'       d    V8  Mu pRV RV 2.p\        P
                  ! \        P                  VR4       \        V4      # )z8Returns True if paragraph iteration is supported on obj.Fz(AXText: Paragraph iteration supported on: T)r
   supports_textrN   r   r   rk   rf   r<   )rR   r   r   r   rq   rs      &     r   supports_paragraph_iterationZ#AXText.supports_paragraph_iterationg  s}     %%c**#;;CCs,,A,,,<cRx=Q5++VT:F|r   c               r   r   rR   rS   r   r2   r   r   r   r   r   rW   u  s      !1 c r   c                |   \         P                  ! V 4      '       g   ^ #  \        P                  P	                  V 4      pRT RT R2.p\        P                  ! \        P                  TR4       T#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?^ # Rp?ii ; i)z#Returns the character count of obj.z*AXText: Exception in get_character_count: TNAXText:reports z characters.)r
   r   r   rg   rc   r   rj   r   re   rf   rk   )rR   countrr   rp   rs   r   r   rc   ZAXText.get_character_countt  s     %%c**	JJ2237E SHUG<"@A5++VT: {{ 	>ugFC 0 0#t<	   A0 0B;+B66B;c               r   r   r   r   r   r   r   rW     s      . 3 r   c                s~   \         P                  ! V 4      '       g   R#  \        P                  P	                  V 4      pRT RT R2.p\        P                  ! \        P                  TR4       T#   \
        P                   d8   pRT 2p\        P                  ! \        P                  TR4       Ru Rp?# Rp?ii ; i)z Returns the caret offset of obj.z'AXText: Exception in get_caret_offset: TNr   zreports caret offset of rY   r   )r
   r   r   rg   rd   r   rj   r   re   rf   rk   )rR   rT   rr   rp   rs   r   r   rd   ZAXText.get_caret_offset  s     %%c**I	ZZ005F S$<VHA"FG5++VT: {{ 	;E7CC 0 0#t<I	s   A0 0B<,B71B<7B<c               rP   r   rR   rS   rT   r2   r   r<   r   r   r   r   r   rW     s"      .   r   c                s   \         P                  ! V 4      '       g   R#  \        P                  P	                  W4      pRT R2T RT 2.p\        P                  ! \        P                  TR4       T#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)PReturns False if we definitely failed to set the offset. True cannot be trusted.Fz'AXText: Exception in set_caret_offset: TNz-AXText: Reported result of setting offset to r\   r   )r
   r   r   rg   set_caret_offsetr   rj   r   re   rf   rk   )rR   rT   rq   rr   rp   rs      &&    r   r   ZAXText.set_caret_offset  s     %%c**	ZZ00=F B&MsVXY_X`Tab5++VT: {{ 	;E7CC 0 0#t<	s   A3 3B>+B99B>c               r   r   r   r   r   r   r   rW     s     / /'7 /D /r   c                s.    \         P                  V ^ 4      # r   )rN   r   rR   r)   r   set_caret_offset_to_startZ AXText.set_caret_offset_to_start  s     &&sA..r   c               r   r   r   r   r   r   r   rW     s     M M%5 M$ Mr   c                sT    \         P                  V \         P                  V 4      4      # r   )rN   r   rc   r   r)   r   set_caret_offset_to_endZAXText.set_caret_offset_to_end  s"     &&sF,F,Fs,KLLr   c               rw   )r   rR   rS   rm   r2   rn   r   r   r   r   r   r   r   rW     s*      + 3 C TW r   c           	     s   \         P                  ! V 4      '       g   R# VR8X  d   \        P                  V 4      p \        P
                  P                  WV4      pTP                  RR4      pRT RT R	T R
T R2.p\        P                  ! \        P                  TR4       T#   \        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z5Returns the text of obj within the specified offsets.r-   z$AXText: Exception in get_substring: TNrZ   r[   AXText: Text ofZ(r_   z): 'r]   r   )r
   r   rN   rc   r   rg   get_textr   rj   r   re   rf   r5   rk   )rR   rm   rn   rq   rr   rp   rt   rs   s   &&&     r   get_substringZAXText.get_substring  s     %%c**33C8J	ZZ((JGF ~~dE2#SAl^1ZL\NZ[*\]5++VT: {{ 	8@C 0 0#t<	s    B% %C0:+C++C0c               r   )r   rR   rS   r   r   r   r   r   r   r   rW     s      * s r   c                sJ   \         P                  V 4      pV'       g   R#  \        P                  P	                  V ^ V4      pTP                  4       p\        T4      ^8  d1   RP                  TR,          4       RRP                  TRR 4       2pMTpTP                  RR	4      pR
T RT R2.p\        P                  ! \        P                  TR4       T#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z Returns the text content of obj.r-   z#AXText: Exception in get_all_text: TN Ni   N ... rZ   r[   r   r]   )rN   rc   r   rg   r   r   rj   r   re   rf   r/   r   joinr5   rk   )rR   ro   rq   rr   rp   wordsrt   rs      &       r   r   ZAXText.get_all_text  s    ++C0	ZZ((a8F u:?!hhuRy12%rs8L7MNL!L#++D%8#SAl^1*=>5++VT: {{ 	7w?C 0 0#t<	s   !C D",+DD"c               r   r   r   r   r   r   r   rW     s      / C r   c                r   )z:Returns the number of reported selected substrings in obj.z(AXText: Exception in _get_n_selections: TNr   r   z selection(s).)r
   r   r   rg   Zget_n_selectionsr   rj   r   re   rf   rk   )rR   rq   rr   rp   rs   r   r   _get_n_selectionsZAXText._get_n_selections  s     %%c**	ZZ005F SHVHN"CD5++VT: {{ 	<UGDC 0 0#t<	r   c               rP   )r   rR   rS   selection_numberr2   r   Noner   r   r   r   r   rW     s"      / 3 4 r   c                s   \         P                  ! V 4      '       g   R#  \        P                  P	                  W4       R#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z+Attempts to remove the specified selection.Nz(AXText: Exception in _remove_selection: T)
r
   r   r   rg   Zremove_selectionr   rj   r   re   rf   )rR   r   rr   rp   rB   r   _remove_selectionZAXText._remove_selection  sj     %%c**	JJ''>{{ 	<UGDC 0 0#t<	s   A B+BBc               r   r   r   r   r   r   r   rW     s     5 5/ 5D 5r   c                s>    \        \        P                  V 4      4      # )z&Returns True if obj has selected text.)r<   rN   get_selected_rangesr   r)   r   has_selected_textZAXText.has_selected_text  s     F..s344r   c               r   r   r   r   r   r   r   rW     s     = ="2 =t =r   c                s    \         P                  V 4      pV'       g   R# \         P                  V 4      pV'       g   R# V^ ,          ^ ,          ^ 8H  ;'       d    VR,          ^,          V8H  # )z0Returns True of all the text in obj is selected.Fr   )rN   rc   r   )rR   ro   rangess   &  r   is_all_text_selectedZAXText.is_all_text_selected  sX     ++C0++C0ay|q <<VBZ]f%<<r   c               r   r   rR   rS   r   r   r   r   r   r   r   rW     s     - -%5 -$ -r   c                sz    \        \        P                  V 4      4       F  p\        P                  W4       K  	  R# )z$Attempts to clear the selected text.N)r   rN   r   r   )rR   r   r,   r   clear_all_selected_textZAXText.clear_all_selected_text  s,     v//45A$$S, 6r   c               r   r   r   r   r   r   r   rW   "  s      (8 S r   c                s`    \         P                  V 4      pV'       d   V^ ,          ^ ,          # R# )z1Returns the leftmost offset of the selected text.r   rN   r   rR   r   r,   r   get_selection_start_offsetZ!AXText.get_selection_start_offset!  s*     ++C0!9Q<	r   c               r   r   r   r   r   r   r   rW   ,  s      &6 3 r   c                s`    \         P                  V 4      pV'       d   VR,          ^,          # R# )z2Returns the rightmost offset of the selected text.r   r   r   r,   r   get_selection_end_offsetZAXText.get_selection_end_offset+  s*     ++C0":a= 	r   c               r   )r   rR   rS   r   zlist[tuple[int, int]]r   r   r   r   r   rW   6  s      !1 6K r   c                sF   \         P                  V 4      pV'       g   . # . p\        V4       Fs  p \        P                  P                  W4      p^ TP                  u;8:  d   TP                  8  g   KH  M KL  TP                  TP                  TP                  34       Ku  	  RV RV 2.p\        P                  ! \        P                  VR4       V#   \        P                   d8   pRT 2p\        P                  ! \        P                  TR4        Rp? Kw  Rp?ii ; i)zQReturns a list of (start_offset, end_offset) tuples reflecting the selected text.z*AXText: Exception in get_selected_ranges: TNr   zreports selected ranges: )rN   r   r   r   rg   Zget_selectionr   rj   r   re   rf   rm   rn   r   rk   )rR   r   
selectionsr   rq   rr   rp   rs   r   r   r   ZAXText.get_selected_ranges5  s     ((-I
uA11#9
 F'';&*;*;;;!!6#6#68I8I"JK  S$=j\"JK5++VT: ;; B5'J##E$4$4c4@s   CD )+DD c               r   r   rR   rS   r   rV   r   r   r   r   r   rW   M  s     " "&6 ";O "r   c           	     s    \         P                  P                  \        V 4      R	4      w  rpVP	                  RR4      pRV RV RV RV R2.p\
        P                  ! \
        P                  VR4       WV3# )
z?Returns the last known selected string, start, and end for obj.rZ   r[   zAXText: Cached selection forzis 'r^   , r`   Tra   )rN   rO   r+   hashr5   r   rk   rf   )rR   r   r   r   rt   rs   r   r   get_cached_selected_textZAXText.get_cached_selected_textL  s}     $99==d3iTs~~dE20#l^3ugUWX[W\\]7^_5++VT:c!!r   c               r   r   r   r   r   r   r   rW   W  s     P P)9 Pd Pr   c                sd    \         P                  V 4      \         P                  \        V 4      &   R# )z?Updates the last known selected string, start, and end for obj.N)rN   get_selected_textrO   r  r   r)   r   update_cached_selected_textZ"AXText.update_cached_selected_textV  s#     392J2J32O$$T#Y/r   c               r   r   r   r   r   r   r   rW   ]  s     . ./ .4H .r   c           	     s>   \         P                  V 4      pV'       g   R# . pRpRp\        \        V4      4       FE  pVP	                  \         P
                  ! V .VO5!  4       V^,          pVR8X  g   K<  V^ ,          pKG  	  RP                  V4      pVP                  4       p\        V4      ^8  d1   RP                  VR,          4       RRP                  VRR 4       2pMTpRV RV RV RV R	2.p	\        P                  ! \        P                  V	R
4       WcV3# )z4Returns the selected string, start, and end for obj.r   r   r   NzAXText: Selected text ofr]   r^   r_   r`   Tra   r   r   )rN   r   ZsortedZsetr   r   r   r/   r   r   rk   rf   )
rR   r   Zstringsrm   rn   	selectionr   r   rt   rs   s
   &         r   r  ZAXText.get_selected_text\  s    //4
O
J0INN6//@i@A"1Jr!(|	 1 xx 

u:?!hhuRy12%rs8L7MNLL,cl^3|nAj\CE5++VT::--r   c               rw   r   rR   rS   rm   r2   rn   r   r<   r   r   r   r   r   rW   z  s+       0  QT Y] r   c                s    \         P                  ! V 4      '       g   R#  \        P                  P	                  WV4      pV#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z7Creates a new selection for the specified range in obj.Fz%AXText: Exception in _add_selection: TN)
r
   r   r   rg   Zadd_selectionr   rj   r   re   rf   )rR   rm   rn   rq   rr   rp   s   &&&   r   _add_new_selectionZAXText._add_new_selectiony  sw     %%c**	ZZ--cLF  {{ 	9%AC 0 0#t<	    A B+BBc          
     s,    V ^8  d   QhRRRRRRRRRR/# )	r   rR   rS   rm   r2   rn   r   r   r<   r   r   r   r   r   rW     s:        	
 
r   c                s    \         P                  ! V 4      '       g   R#  \        P                  P	                  WW4      pV#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z;Modifies specified selection in obj to the specified range.Fz(AXText: Exception in set_selected_text: TN)
r
   r   r   rg   Zset_selectionr   rj   r   re   rf   )rR   rm   rn   r   rq   rr   rp   s   &&&&   r   _update_existing_selectionZ!AXText._update_existing_selection  sw     %%c**	ZZ--c\^F  {{ 	<UGDC 0 0#t<	r	  c               rw   r  r   r   r   r   r   rW     s+      / s PS X\ r   c                s   \         P                  V 4      ^ 8  d   \         P                  WV4      pM\         P                  WV4      pV'       d   \        P
                  \        P                  8  da   \         P                  WV4      p\         P                  V 4      ^ ,          pWE8w  d)   Rp\        P                  ! \        P
                  VR4       V# )zSReturns False if we definitely failed to set the selection. True cannot be trusted.z1AXText: Substring and selected text do not match.T)
rN   r   r
  r  r   rf   Z
debugLevelr   r  re   )rR   rm   rn   rq   Z	substringr  rp      &&&    r   set_selected_textZAXText.set_selected_text  s     ##C(1,66s*UF..s*MFe&&%*:*::,,S
KI005a8I%I##E$4$4c4@r   c               rP   )r   rR   rS   rT   rU   r   ztuple[dict[str, str], int, int]r   r   r   r   r   rW     s+     '] ']']'] 
)']r   c                sH   \         P                  ! V 4      '       g   / ^ ^ 3# Vf   \        P                  V 4      p \        P
                  P                  WRR7      pTfH   RT RT R2.p\        P                  ! \        P                  TR4       / ^ \        P                  T 4      3# RT RT R	T 2.p\        P                  ! \        P                  TR4       \         P                  ! T R
4      pT^ ,          P                  R4      '       g%   TP                  R4      pT'       d   Yr^ ,          R&   T^ ,          P                  R4      '       g%   TP                  R4      pT'       d   Yr^ ,          R&   T^ ,          ;'       g    / T^,          ;'       g    ^ T^,          ;'       g    \        P                  T 4      3#   \        P                   dN   pRT 2p\        P                  ! \        P                  TR4       / ^ \        P                  T 4      3u Rp?# Rp?ii ; i)zCReturns a (dict, start, end) tuple for attributes at offset in obj.NT)Zinclude_defaultsz4AXText: Exception in get_text_attributes_at_offset: z$AXText: get_attribute_run failed forz
at offset rY   zAXText: Attributes forz : FrF   z
text-alignrD   ztext-indent)r
   r   rN   rd   r   rg   Zget_attribute_runr   rj   r   re   rf   rc   rk   Zget_attributes_dictr+   )rR   rT   rq   rr   rp   rs   Zobj_attributesZalternativeru   r   get_text_attributes_at_offsetZ$AXText.get_text_attributes_at_offset  s    %%c**q!8O>,,S1F	:ZZ11#PT1UF ><cZPVxWXCYZFu//>q&44S999*C:fXS1QR5++VT: "55c5Aay}}_--(,,\:K-8q	/*ay}}X&&(,,];K&1q	(#ayBq	Qq	0\0\V=W=WX[=\\\3 {{ 	:HPC 0 0#t<q&44S999	:s   !F? ?H!AHH!H!c               rw   )r   rR   rS   rm   r2   rn   r   z%list[tuple[int, int, dict[str, str]]]r   r   r   r   r   rW     s0        
/	r   c                sT   \         P                  ! V 4      '       g   . # VR	8X  d   \        P                  V 4      pRV RV RV 2.p\        P
                  ! \        P                  VR4       . pTpWR8  d~   \        P                  W4      w  rgpWx8:  d   VP                  \        Wu4      W34       M.RV RV 2p	\        P                  ! \        P                  V	R4       \        W^,           4      pK  R\        V4       R2p	\        P                  ! \        P                  V	R4       V# )
z:Returns a list of (start, end, attrs dict) tuples for obj.zAXText: Getting attributes forzchars: r_   TzAXText: Start offset z > end offset zAXText: z attribute ranges found.r   )r
   r   rN   rc   r   rk   rf   r  r   r   re   r   )
rR   rm   rn   rs   ZrvrT   Zattrsr   r   rp   s
   &&&       r   get_all_text_attributesZAXText.get_all_text_attributes  s    %%c**I33C8J2C7<.PQR\Q]9^_5++VT:! & D DS QE#|		3u-s:; .eWN3%H##E$4$4c4@qj)FR	!9:E,,c48	r   c               r#   )r   r   zlist[AXTextAttribute]r   r   r   r   r   rW      s     % %/D %r   c                 s     \        \        4      # )z4Returns a set of all supported text attribute names.)Zlistr   r   r   r   !get_all_supported_text_attributesZ(AXText.get_all_supported_text_attributes  s     O$$r   c               s(    V ^8  d   QhRRRRRRRR/# )r   rR   rS   ry   r2   rz   r   r   r   r   r   r   rW     s)      !1 c c c r   c                s   \         P                  ! V 4      '       g   R#  \        P                  P	                  WV\        P
                  P                  4      pRT RT RT RT 2.p\        P                  ! \        P                  TR4       T#   \        P                   d8   pRT 2p\        P                  ! \        P                  TR4       Ru Rp?# Rp?ii ; i)	z;Returns the character offset in obj at the specified point.z*AXText: Exception in get_offset_at_point: TNzAXText: Offset inrX   r  z is r   )r
   r   r   rg   r}   	CoordTypeWINDOWr   rj   r   re   rf   rk   )rR   ry   rz   rT   rr   rp   rs   r  r   r}   ZAXText.get_offset_at_point  s     %%c**I	ZZ33CAu?U?UVF &sc!BqcfX,FG5++VT: {{ 	>ugFC 0 0#t<I	s   9B C$,CCCc               rP   )r   rR   rS   rT   rU   r   
Atspi.Rectr   r   r   r   r   rW     s#       0 * PZ r   c                s0   \         P                  ! V 4      '       g   \        P                  ! 4       # Vf   \        P                  V 4      p \        P                  P                  W\        P                  P                  4      pRT R2T RT.p\        P                  ! \        P                  TR4       T#   \        P                   dK   pRT 2p\        P                  ! \        P                  TR4       \        P                  ! 4       u Rp?# Rp?ii ; i)zGReturns the Atspi rect of the character at the specified offset in obj.Nz)AXText: Exception in get_character_rect: TzAXText: Offset r\   has rect)r
   r   r   RectrN   rd   rg   Zget_character_extentsr  r  r   rj   r   re   rf   rk   )rR   rT   rectrr   rp   rs   r   r   get_character_rectZAXText.get_character_rect  s     %%c**::<>,,S1F	 ::33CAWAWXD $F83/j$G5++VT: {{ 	 =eWEC 0 0#t<::<	 s   8B6 6D?D
DDc               rw   )r   rR   rS   r   r2   r   r   r  r   r   r   r   r   rW   -  s)      , S s z r   c                s>   \         P                  ! V 4      '       g   \        P                  ! 4       # V^ 8:  d   \        P                  V 4      p \        P                  P                  WV\        P                  P                  4      pRT RT R2T RT.p\        P                  ! \        P                  TR4       T#   \        P                   dK   pRT 2p\        P                  ! \        P                  TR4       \        P                  ! 4       u Rp?# Rp?ii ; i)zCReturns the Atspi rect of the string at the specified range in obj.z%AXText: Exception in get_range_rect: TNzAXText: Range r_   r\   r  )r
   r   r   r  rN   rc   rg   Zget_range_extentsr  r  r   rj   r   re   rf   rk   )rR   r   r   r  rr   rp   rs   r  r   get_range_rectZAXText.get_range_rect,  s     %%c**::<!8,,S1C	 :://CAWAWXD #5'3%s3S*dK5++VT: {{ 	 9%AC 0 0#t<::<	 s   9B= =D?DDDc               $    V ^8  d   QhRRRRRR/# )r   rect1r  rect2r   r<   r   r   r   r   r   rW   B  s&     A A: Aj AT Ar   c                s   VP                   V P                   8*  ;'       d    VP                  V P                  8*  ;'       d    VP                   VP                  ,           V P                   V P                  ,           8  ;'       d<    VP                  VP                  ,           V P                  V P                  ,           8  # )z1Returns true if rect1 is fully contained in rect2)ry   rz   Zwidthheight)r  r  r9   r   _rect_is_fully_contained_inZ"AXText._rect_is_fully_contained_inA  s     ww%''! A Aegg&8 A A%++%5;;)>>A A%,,&%''ELL*@@	Ar   c               r  )r   	line_rectr  	clip_rectr   r2   r   r   r   r   r   rW   J  s!      J : # r   c                s2   \        ^ VP                  4      Vn        V P                  V P                  ^,          ,           VP                  8  d   R# V P                  V P                  ^,          ,           VP                  VP                  ,           8  d   ^# ^ # )zFReturns -1 (line above), 1 (line below), or 0 (line inside) clip_rect.r   )r   rz   r  )r  r  r9   r   _line_comparisonZAXText._line_comparisonI  sl    
 !Y[[)	;;))A--	;I;;))A--	i>N>N0NNr   c               rP   )r   rR   rS   r  r  r   zlist[tuple[str, int, int]]r   r   r   r   r   rW   Y  s&       
$r   c           	     s   RV RV.p\         P                  ! \         P                  VR4       \        P	                  W4      w  r4pVP                  RR4      pRV RV RV R	V R
2.p\         P                  ! \         P                  VR4       W4V3.pTp\        P                  W4       FK  w  r4p\        P                  WV4      p	\        P                  W4      ^ 8  d    MVP                  W4V34       KM  	  VR,          w  r4pVP                  RR4      pRV RV RV R	V R
2.p\         P                  ! \         P                  VR4       V# )zIReturns a list of (string, start, end) for lines of obj inside clip_rect.z!AXText: Getting visible lines forZinsideTrZ   r[   zAXText: First visible line inzis: 'r^   r_   r`   zAXText: Last visible line inr   )
r   rk   rf   rN   find_first_visible_liner5   r   r  r  r   )
rR   r  rs   r   r   r   rt   rq   rT   r  r   r   get_visible_linesZAXText.get_visible_linesX  sV    6sHiP5++VT:!99#IS||D%013%~SQVPWWXY\X]]^8_`5++VT:$% & 0 0 =D--c#>I&&y<q@MM4,-	 !> "":S||D%00#|nCPUwVWX[W\\]7^_5++VT:r   c               rP   r   rR   rS   r  r  r   rV   r   r   r   r   r   rW   v  &     * *** 
*r   c                s   Rp\         P                  V 4      p^ TrTWE8  Ed7   WE,           ^,          p\         P                  W4      w  rxp	V^ 8X  d   WxV	3# V^ 8  d6   RV.p
\        P                  ! \        P
                  V
R4       V^,           pKu  WxV	3p\         P                  W^,
          4      w  rpV^ 8:  d
   V^ 8:  d   V# \         P                  WV	4      p\         P                  W4      ^ 8  d   V^,           pK  \         P                  W4      ^ 8  d   TpEK  \         P                  WV4      p\         P                  W4      ^ 8w  d   V# WV3pTpEK=  V# )zLReturns the first (string, start, end) visible line of obj inside clip_rect.z(AXText: Treating invalid offset as aboveTra   rN   rc   r   r   rk   rf   r  r  )rR   r  rq   ro   lowhighmidr   r   r   rs   Zprevious_lineZprevious_startZprevious_end	text_rectZprevious_rect   &&              r   r   ZAXText.find_first_visible_lineu  sQ    ++C0vTj:!#C%88BDzC''qyDiP""5#3#3VTBAg#%F:@:S:STWabYb:c7M<"|q'8--c#>I&&y<q@Ag&&y<q@"11#|TM&&}@AE"L@FDr   c               rP   r"  r   r   r   r   r   rW     r#  r   c                s   Rp\         P                  V 4      p^ TrTWE8  Ed.   WE,           ^,          p\         P                  W4      w  rxp	W8  d   WxV	3# V	^ 8:  d/   RV.p
\        P                  ! \        P
                  V
R4       TpKm  WxV	3p\         P                  W	4      w  rpV^ 8:  d
   V^ 8:  d   V# \         P                  WV	4      p\         P                  W4      ^ 8  d   V^,           pK  \         P                  W4      ^ 8  d   TpK  \         P                  WV4      p\         P                  W4      ^ 8w  d   V# WV3pV^,           pEK4  V# )zKReturns the last (string, start, end) visible line of obj inside clip_rect.z(AXText: Treating invalid offset as belowTra   r$  )rR   r  rq   ro   r%  r&  r'  r   r   r   rs   r   r   r   r(  Z	next_rectr)  r   find_last_visible_lineZAXText.find_last_visible_line  sF    ++C0vTj:!#C%88BD}C''axDiP""5#3#3VTB#%F.4.G.G.Q+I8Q8q=--c#>I&&y<q@Ag&&y<q@--cxHI&&y<AH4F'Cr   c               rP   r   rR   rS   rT   rU   r   r<   r   r   r   r   r   rW     s#      '7  W[ r   c                s    \         P                  W4      ^ ,          pVP                  R4      R8X  d   R# VP                  R4      R8X  d   R# VP                  R4      R8X  d   R# VP                  R4      R	9   d   R# R# )
z>Returns True if the text attributes indicate a spelling error.rE   spellingTgrammarFztext-spellingZ
misspelledrG   )rr   r,  rN   r  r+   rR   rT   Z
attributesr   r   string_has_spelling_errorZ AXText.string_has_spelling_error  sm     99#FqI
>>)$
2>>)$	1>>/*l:>>+&*??r   c               rP   r+  r   r   r   r   r   rW     s#      &6 
 VZ r   c                s    \         P                  W4      ^ ,          pVP                  R4      R8X  d   R# VP                  R4      R8X  d   R# R# )z=Returns True if the text attributes indicate a grammar error.rE   r-  TrG   Fr.  r/  r   r   string_has_grammar_errorZAXText.string_has_grammar_error  sD     99#FqI
>>)$	1>>+&)3r   c               r   )r   r   r   r   r<   r   r   r   r   r   rW     s     % %# %$ %r   c                s    V R8H  # )u@   Returns True if character is an embedded object character (￼).r   r   )r   r)   r   is_eocZAXText.is_eoc  s     H$$r   c               rP   r   r   r   r   r   r   rW     s"     ( ((8 (# ($ (r   c                s\    \         P                  W4      w  r#p\         P                  V4      # )uG   Returns True if character in obj is an embedded object character (￼).)rN   rv   r2  )rR   rT   r   Z_startZ_ends   &&   r   character_at_offset_is_eocZ!AXText.character_at_offset_is_eoc  s(     #)"@"@"M	4}}Y''r   c               r   r   r   r   r   r   r   rW     s     4 4$4 4 4r   c                s    \         P                  ! V 4      '       g   R# \        P                  V 4      P	                  4       '       * # )z<Returns True if obj lacks text, or contains only whitespace.T)r
   r   rN   r   r8   r   r)   r   is_whitespace_or_emptyZAXText.is_whitespace_or_empty  s5     %%c**&&s+11333r   c               r   r   r   r   r   r   r   rW      s     
- 
-"2 
-t 
-r   c                s    \         P                  ! V 4      '       g   R# \        P                  V 4      P	                  4       pV'       g   \
        P                  ! V 4      # \        \        P                  ! RV4      4      # )z)Returns True if obj has presentable text.Fz\w+)
r
   r   rN   r   r8   r   r   r<   r   r   )rR   r   r,   r   has_presentable_textZAXText.has_presentable_text  s[     %%c**""3'--/"//44BIIfd+,,r   c               s0    V ^8  d   QhRRRRRRRRRRR	R
/# )r   rR   rS   ry   r2   rz   rm   rU   rn   r   r<   r   r   r   r   r   rW     sD        !	
  
r   c                s   \         P                  V 4      pV'       g   R# Vf   ^ pVf
   V^,
          p \        P                  P	                  WV\        P
                  P                  W4      pRT RT RT R2T R	T R
T 2.p	\        P                  ! \        P                  T	R4       T#   \        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)z.Attempts to scroll obj to the specified point.FNz0AXText: Exception in scroll_substring_to_point: TAXText: Scrolledsubstring (r_   ) tor  r   )rN   rc   r   rg   scroll_substring_to_pointr  r  r   rj   r   re   rf   rk   )
rR   ry   rz   rm   rn   ro   rq   rr   rp   rs   s
   &&&&&     r   r9  Z AXText.scroll_substring_to_point  s     ++C0L!J	ZZ99:u/E/EqMF %c[a
|SW+XCr!Bvh')5++VT: {{ 	DUGLC 0 0#t<	s   :B+ +C6 +C11C6c          
     s,    V ^8  d   QhRRRRRRRRRR	/# )
r   rR   rS   locationzAtspi.ScrollTyperm   rU   rn   r   r<   r   r   r   r   r   rW   -  s:      " ! 	
 
r   c                s   \         P                  V 4      pV'       g   R# Vf   ^ pVf
   V^,
          p \        P                  P	                  WW14      pRT RT RT R2TR	T 2.p\        P                  ! \        P                  TR4       T#   \
        P                   d7   pRT 2p\        P                  ! \        P                  TR4        Rp?R# Rp?ii ; i)
zLAttempts to scroll the substring to the specified Atspi.ScrollType location.FNz3AXText: Exception in scroll_substring_to_location: Tr6  r7  r_   r8  r   )rN   rc   r   rg   Zscroll_substring_tor   rj   r   re   rf   rk   )	rR   r:  rm   rn   ro   rq   rr   rp   rs   s	   &&&&     r   scroll_substring_to_locationZ#AXText.scroll_substring_to_location,  s     ++C0L!J	ZZ33Cz\F %c[a
|SW+XbM+5++VT: {{ 	GwOC 0 0#t<	s    B C"+CCr   )N)rb   r   )NN)NrH   rI   rJ   rK   rL   rO   Z__annotations__Zstaticmethodrv   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rc   rd   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r
  r  r  r  r  r}   r  r  r  r  r!  r   r*  r0  r1  r2  r3  r4  r5  r9  r;  rM   r   r   r   rN   rN      s   D=?:?"F "FH ; ;  0  4 0 0( F F> 6 6  0  4 + +( 7F 7Fr 6 6  0  8 ' '6  , H H
 ; ;4 $F $FL : :  0  4 ' '0 F F> ; ;  0  4 0 0& 
 
  "  "  " / /
 M M
  *  2  "   5 5
 = = - -      , " " P P
 . .8    (  * '] ']R  @ % %
  "  (  ( A A    8 * *X * *X     % %
 ( ( 4 4 
- 
-  >  r   rN   )!rL   Z
__future__r   Z__id__Z__version__Z__date__Z__copyright__Z__license__Zenumr0   r   Ztypingr   ZgiZrequire_versionZgi.repositoryr   r   r-   r   r   r   r   r	   Z	ax_objectr
   Zax_utilities_roler   Zax_utilities_stater   ZEnumr   rN   r   r   r   <module>r<     s   8 A #;   	  	   7E "       "  . 0|dii ||O Or   