+
    i7                     
   R t ^ RIHt ^ RIHtHt ^ RIHtHt ^ RI	t	^RI
Ht ]	P                  ! R4      tRtRtR	t]	P                  ! R
],           R,           ]	P"                  4      tRt]	P                  ! RP)                  ]]4      ]	P"                  4      tR tR tR tR.]! ]4      ,           t]! RR7      R 4       t]! ]^4       U Uu/ uF  w  rWbK	  	  upp tRt]! RR7      R 4       tR t R t!R t"R t#R t$R t%R# u upp i )zT
Collection of utilities used within the package and also available for client code
)	lru_cache)chainproduct)ascii_uppercasedigitsN)CellCoordinatesExceptionz^[$]?([A-Za-z]{1,3})[$]?(\d+)$z[A-Z]{1,3}:[A-Z]{1,3}:z\d+:\d+:zq
[$]?(?P<min_col>[A-Za-z]{1,3})?
[$]?(?P<min_row>\d+)?
(:[$]?(?P<max_col>[A-Za-z]{1,3})?
[$]?(?P<max_row>\d+)?)?
^$z7
(('(?P<quoted>([^']|'')*)')|(?P<notquoted>[^'^ ^!]*))!z{0}(?P<cells>{1})(?=,?)c                    \        V \        4      '       d   \        V 4      p \        V\        4      '       d   \        V4      p\        W^,           4       Uu. uF  p\	        V4      NK  	  up# u upi )z
Given the start and end columns, return all the columns in the series.

The start and end columns can be either column letters or 1-based
indexes.
)
isinstancestrcolumn_index_from_stringrangeget_column_letter)startendxs   && Z/Users/agent/.openclaw/workspace/.venv/lib/python3.14/site-packages/openpyxl/utils/cell.pyget_column_intervalr      s[     %(/#s&s+*/Qw*?@*?Qa *?@@@s   A.c                    \         P                  V 4      pV'       g   RV  R2p\        V4      hVP                  4       w  r4\	        V4      pV'       g   RV  R2p\        V4      hW43# )z;Convert a coordinate string like 'B12' to a tuple ('B', 12)zInvalid cell coordinates ()zThere is no row 0 ()COORD_REmatchr   groupsint)coord_stringr   msgcolumnrows   &    r   coordinate_from_stringr   ,   sf    NN<(E*<.:&s++,,.KF
c(C#L>3&s++;    c                8   \         P                  V 4      pV'       g   \        V  R24      hVP                  R4      pVP	                  4        F  w  r4V'       g   K  RV 2W#&   K  	  VR,          '       g   VR,          '       d   RpMRpVP
                  ! R/ VB # )	zDConvert a coordinate to an absolute coordinate string (B12 -> $B$12)z  is not a valid coordinate range r	   max_colmax_rowz%{min_col}{min_row}:{max_col}{max_row}z{min_col}{min_row} )ABSOLUTE_REr   
ValueError	groupdictitemsformat)r   mdkvfmts   &     r   absolute_coordinater0   :   s    ,'AL>)IJKK	BA	1qc7AD  	||q||5"::??r    r"   )maxsizec                Z   ^T u;8:  d   R8:  g   M \        RP                  V 4      4      h. pV ^8  d   \        V ,          # V '       dS   \        V ^4      w  rVP	                  ^ \        V,          4       V'       d   K=  V ^,          p VP	                  ^ R4       KZ  RP                  V4      # )a  
Convert decimal column position to its ASCII (base 26) form.

Because column indices are 1-based, strides are actually pow(26, n) + 26
Hence, a correction is applied between pow(26, n) and pow(26, 2) + 26 to
prevent and additional column letter being prepended

"A" == 1 == pow(26, 0)
"Z" == 26 == pow(26, 0) + 26 // decimal equivalent 10
"AA" == 27 == pow(26, 1) + 1
"ZZ" == 702 == pow(26, 2) + 26 // decimal equivalent 100
ifG  zInvalid column index {0}Zr"   )r'   r*   __decimal_to_alphadivmodinsertjoin)col_idxresult	remainders   &  r   r   r   N   s      5 3::7CDDF|!'**
#GR0a+I67yqLGMM!S!776?r    c                V   RV  R2p\        V 4      ^8  d   \        V4      h^ p\        V P                  4       4      p \	        V \
        4       F"  w  r4 \        V,          pY%T,          ,          pK$  	  ^ Tu;8  d   R8  g   M \        V4      hV#   \         d    \        T4      hi ; i)z
Convert ASCII column name (base 26) to decimal with 1-based index

Characters represent descending multiples of powers of 26

"AFZ" == 26 * pow(26, 0) + 6 * pow(26, 1) + 1 * pow(26, 2)
'z<' is not a valid column name. Column names are from A to ZZZigG  )lenr'   reversedupperzip__powers__alpha_to_decimalKeyError)col	error_msgidxletterpowerposs   &     r   r   r   r   s     C5TUI
3x!|##
C
399;
CS(+	($V,C 	U{ , s?U?##J  	(Y''	(s   BB(c                   RP                  V 4      p\        P                  V 4      pV'       g   \        V4      hVP	                  4       w  r4rVpV'       dm   W63pWG3p	\        W,           4      '       gP   \        V4      '       d   \        V	4      '       d.   \        V	4      '       d   \        V4      '       d   \        V4      hVe   \        V4      pVe   \        V4      pVe   \        V4      pMTpVe   \        V4      pMTpW4Wg3# )z
Convert a range string into a tuple of boundaries:
(min_col, min_row, max_col, max_row)
Cell coordinates will be converted into a range with the cell at both end
z&{0} is not a valid coordinate or range)	r*   r&   r   r'   r   allanyr   r   )
range_stringr   r+   min_colmin_rowsepr#   r$   colsrowss
   &         r   range_boundariesrS      s     3
9
9,
GC,'Ao./hhj+GcG
 IIc$iiIIc$iiS/!*73g,*73g,W--r    c              #  (  a"   \        V 4      w  rr4\        W$^,           4      p\        W^,           4       Uu. uF  p\        V4      NK  	  ppV F7  o\        ;QJ d    . V3R lV 4       F  NK  	  5M! V3R lV 4       4      x  K9  	  R# u upi 5i)O
Get individual addresses for every cell in a range.
Yields one row at a time.
c              3   H   <"   T F  pR P                  VS4      x  K  	  R# 5iz{0}{1}Nr*   ).0rD   r   s   & r   	<genexpr>"rows_from_range.<locals>.<genexpr>        >#HOOC--   "N)rS   r   r   tuple)	rM   rN   rO   r#   r$   rR   rD   rQ   r   s	   &       @r   rows_from_ranger_      sy     
 *:,)G&GgA+&D.3Gq[.IJ.Isc".IDJe>>ee>>>>  Ks   5BBABc              #     a"   \        V 4      w  rr4\        W$^,           4      pR \        W^,           4       4       pV F7  o\        ;QJ d    . V3R lV 4       F  NK  	  5M! V3R lV 4       4      x  K9  	  R# 5i)rU   c              3   8   "   T F  p\        V4      x  K  	  R # 5i)N)r   )rY   rD   s   & r   rZ   "cols_from_range.<locals>.<genexpr>   s     H.Gsc"".Gs   c              3   H   <"   T F  pR P                  SV4      x  K  	  R# 5irW   rX   )rY   r   rD   s   & r   rZ   rb      r\   r]   N)rS   r   r^   )rM   rN   rO   r#   r$   rR   rQ   rD   s   &      @r   cols_from_rangerd      sa     
 *:,)G&Gg!)$DHeGQY.GHDe>>ee>>>> s   A9A<c                    \        V 4       F  w  rV\        9   g   K   M	  V RX pWR p\        V4      \        V4      3# )z:
Convert an Excel style coordinate to (row, column) tuple
N)	enumerater   r   r   )
coordinaterF   crD   r   s   &    r   coordinate_to_tupleri      sL     J'; ( Tc
C
T
Cs8-c222r    c                    \         P                  V 4      pVf   \        R4      hVP                  R4      ;'       g    VP                  R4      pVP                  R4      p\	        V4      pW$3# )zW
Convert a worksheet range to the sheetname and maximum and minimum
coordinate indices
z)Value must be of the form sheetname!A1:E4quoted	notquotedcells)SHEETRANGE_REr   r'   grouprS   )rM   r+   	sheetnamerm   
boundariess   &    r   range_to_tuplerr      se    
 	L)AyDEE!99QWW[%9IGGGE!%(J  r    c                Z    RV 9   d   V P                  RR4      p RP                  V 4      p V # )z6
Add quotes around sheetnames if they contain spaces.
r<   z''z'{0}')replacer*   )rp   s   &r   quote_sheetnameru      s2     i%%c40		*Ir    )      i  )&__doc__	functoolsr   	itertoolsr   r   stringr   r   re
exceptionsr   compiler   	COL_RANGE	ROW_RANGE
RANGE_EXPRVERBOSEr&   SHEET_TITLEr*   rn   r   r   r0   listr4   r   rf   rB   rA   r   rS   r_   rd   ri   rr   ru   )rI   rG   s   00r   <module>r      s.     $ * 	 0 ::78(		
 jjz)3.

;:

8?? jj*A$ TD11 
4 @ 5>oq4QR4Q[Sfj4QR 
4 0(.V	?	?	3!s Ss   	C?