ó
    ‰*£h7  ã                   óæ  • S r SSKJr  SSKJrJr  SSKJrJr  SSK	r	SSK
Jr  \	R                  " S5      rS	rS
rSr\	R                  " S\-   S-   \	R"                  5      rSr\	R                  " SR)                  \\5      \	R"                  5      rS rS rS rS/\" \5      -   r\" SS9S 5       r\" \S5       V Vs0 s H  u  pX_M	     snn rSr\" SS9S 5       rS r S r!S r"S r#S r$S r%gs  snn f )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                 óÜ   • [        U [        5      (       a  [        U 5      n [        U[        5      (       a  [        U5      n[        XS-   5       Vs/ s H  n[	        U5      PM     sn$ s  snf )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.
r   )Ú
isinstanceÚstrÚcolumn_index_from_stringÚrangeÚget_column_letter)ÚstartÚendÚxs      ÚP/home/mande/repo/quber/.venv/lib/python3.13/site-packages/openpyxl/utils/cell.pyÚget_column_intervalr      s[   € ô �%œ×ÑÜ(¨Ó/ˆÜ�#”s×ÑÜ& sÓ+ˆÜ*/°¸Q±wÔ*?Ó@Ò*? QÔ˜aÖ Ñ*?Ñ@Ð@ùÒ@s   ÁA)c                 óÌ   • [         R                  U 5      nU(       d  SU  S3n[        U5      eUR                  5       u  p4[	        U5      nU(       d  SU  S3n[        U5      eX44$ )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   € ä�N‰N˜<Ó(€EÞØ*¨<¨.¸Ð:ˆÜ& sÓ+Ð+Ø—,‘,“.�K€FÜ
ˆc‹(€CÞØ# L >°Ð3ˆÜ& sÓ+Ð+Øˆ;Ðó    c                 ó   • [         R                  U 5      nU(       d  [        U  S35      eUR                  S5      nUR	                  5        H  u  p4U(       d  M  SU 3X#'   M     US   (       d
  US   (       a  SnOSnUR
                  " S0 UD6$ )	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_coordinater2   :   s‚   € ä×Ñ˜,Ó'€AÞÜ˜L˜>Ð)IÐJÓKÐKà	�‰�B‹€AØ—‘–	‰ˆßˆ1Ø�q�c�7ˆA‹Dñ ð 	ˆ‡|�q˜—|Ø5‰à"ˆØ�:Š:‰?˜‰?Ðr"   r$   )Úmaxsizec                 óB  • SU s=::  a  S::  d  O  [        SR                  U 5      5      e/ nU S:  a	  [        U    $ U (       aN  [        U S5      u  pUR	                  S[        U   5        U(       d  U S-  n UR	                  SS5        U (       a  MN  SR                  U5      $ )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
r   ifG  zInvalid column index {0}é   r   Ú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à�ƒ|Ü! 'Ñ*Ð*æ
Ü# G¨RÓ0ÑˆØ�‰�aÔ+¨IÑ6Ô7ÞØ�q‰LˆGØ�M‰M˜!˜SÔ!÷ ˆ'ð �7‰7�6‹?Ðr"   )r   r5   i¤  c                 ó6  • SU  S3n[        U 5      S:”  a  [        U5      eSn[        U R                  5       5      n [	        U [
        5       H  u  p4 [        U   nX%U-  -  nM     SUs=:  a  S:  d  O  [        U5      eU$ ! [         a    [        U5      ef = f)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 ZZZé   r   igG  )Úlenr)   ÚreversedÚupperÚzipÚ__powersÚ__alpha_to_decimalÚKeyError)ÚcolÚ	error_msgÚidxÚletterÚpowerÚposs         r   r   r   r   s§   € ð �C�5ÐTÐU€IÜ
ˆ3ƒx�!ƒ|Ü˜Ó#Ð#Ø
€CÜ
�3—9‘9“;Ó
€CÜ˜S¤(Ö+‰ˆð	(Ü$ VÑ,ˆCð 	�U‰{ÑŠñ ,ð ˆs�?�U�?Ü˜Ó#Ð#Ø€Jøô ó 	(Ü˜YÓ'Ð'ð	(ús   Á	BÂBc                 óò  • SR                  U 5      n[        R                  U 5      nU(       d  [        U5      eUR	                  5       u  p4pVnU(       ac  X64nXG4n	[        X‰-   5      (       dK  [        U5      (       a  [        U	5      (       a+  [        U	5      (       a  [        U5      (       a  [        U5      eUb  [        U5      nUb  [        U5      nUb  [        U5      nOUnUb  [        U5      nOUnX4Xg4$ )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_boundariesrW   ‹   sä   € ð 3×
9Ñ
9¸,Ó
G€CÜ×Ñ˜,Ó'€AÞÜ˜‹oÐà./¯h©h«jÑ+€G�c Gæ
ØÐˆØÐˆô �‘×ÑÜ��I‰Iœc $Ÿi™iÜ��I‰Iœc $Ÿi™iä˜S“/Ð!àÑÜ*¨7Ó3ˆàÑÜ�g“,ˆàÑÜ*¨7Ó3‰àˆàÑÜ�g“,‰àˆà˜WÐ-Ð-r"   c              #   óÞ   ^#   • [        U 5      u  pp4[        X$S-   5      n[        XS-   5       Vs/ s H  n[        U5      PM     nnU H  m[        U4S jU 5       5      v •  M     gs  snf 7f)úO
Get individual addresses for every cell in a range.
Yields one row at a time.
r   c              3   óH   >#   • U  H  nS R                  UT5      v •  M     g7f©z{0}{1}N©r,   )Ú.0rH   r    s     €r   Ú	<genexpr>Ú"rows_from_range.<locals>.<genexpr>¿   ó   øé € Ð>º°#�H—O‘O C¨×-Ð-ºùó   ƒ"N)rW   r   r   Útuple)	rQ   rR   rS   r%   r&   rV   rH   rU   r    s	           @r   Úrows_from_rangerc   ¶   sk   øé € ô
 *:¸,Ó)GÑ&€G�gÜ� A™+Ó&€DÜ.3°GÀq¹[Ô.IÓJÒ.I sÔ˜cÖ"Ñ.I€DÐJÛˆÜÔ>¹Ó>Ó>Ô>ò ùò Kùs   ƒ-A-°A(Á(A-c              #   ó°   ^#   • [        U 5      u  pp4[        X$S-   5      nS [        XS-   5       5       nU H  m[        U4S jU 5       5      v •  M     g7f)rY   r   c              3   ó8   #   • U  H  n[        U5      v •  M     g 7f)N)r   )r]   rH   s     r   r^   Ú"cols_from_range.<locals>.<genexpr>É   s   é € ÐHÒ.G sÔ˜c×"Ð"Ò.Gùs   ‚c              3   óH   >#   • U  H  nS R                  TU5      v •  M     g7fr[   r\   )r]   r    rH   s     €r   r^   rf   Ë   r`   ra   N)rW   r   rb   )rQ   rR   rS   r%   r&   rV   rU   rH   s          @r   Úcols_from_rangerh   Â   sS   øé € ô
 *:¸,Ó)GÑ&€G�gÜ� !™)Ó$€DÙH¬e°GÀQ¹YÔ.GÓH€DÛˆÜÔ>¹Ó>Ó>Ô>ò ùs   ƒAAc                 ó€   • [        U 5       H  u  pU[        ;   d  M    O   U SW nXS n[        U5      [        U5      4$ )z:
Convert an Excel style coordinate to (row, column) tuple
N)Ú	enumerater   r   r   )Ú
coordinaterJ   ÚcrH   r    s        r   Úcoordinate_to_tuplerm   Î   sL   € ô ˜JÖ'‰ˆØ”�;Ùñ (ð �T�cÐ
€CØ
�TÐ
€CÜˆs‹8Ô-¨cÓ2Ð2Ð2r"   c                 óØ   • [         R                  U 5      nUc  [        S5      eUR                  S5      =(       d    UR                  S5      nUR                  S5      n[	        U5      nX$4$ )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)   ÚgrouprW   )rQ   r-   Ú	sheetnamerq   Ú
boundariess        r   Úrange_to_tuplerv   Ú   sb   € ô
 	×Ñ˜LÓ)€AØ�yÜÐDÓEÐEØ—‘˜Ó!×9 Q§W¡W¨[Ó%9€IØ�G‰G�GÓ€EÜ! %Ó(€JØÐ Ð r"   c                 óX   • SU ;   a  U R                  SS5      n SR                  U 5      n U $ )z6
Add quotes around sheetnames if they contain spaces.
r?   z''z'{0}')Úreplacer,   )rt   s    r   Úquote_sheetnamery   è   s2   € ð ˆiÓØ×%Ñ% c¨4Ó0ˆ	à—‘ 	Ó*€IØÐr"   )&Ú__doc__Ú	functoolsr   Ú	itertoolsr   r   Ústringr   r   ÚreÚ
exceptionsr	   Úcompiler   Ú	COL_RANGEÚ	ROW_RANGEÚ
RANGE_EXPRÚVERBOSEr(   ÚSHEET_TITLEr,   rr   r   r!   r2   Úlistr7   r   rj   rF   rE   r   rW   rc   rh   rm   rv   ry   )rM   rK   s   00r   Ú<module>r‡      s.  ðñõ  ß $ß *Û 	å 0ð �:Š:Ð7Ó8€Ø(€	Ø€	ð€
ð �jŠj˜˜zÑ)¨3Ñ.°·
±
Ó;€ð:€à—
’
Ð8×?Ñ?Ø�óØ Ÿj™jó*€òAòòð$ �T™D Ó1Ñ1Ð á
�4Ññó ðñ@ 5>¸oÈqÔ4QÔRÒ4Q¡[ S�f’jÑ4QÒRÐ Ø€á
�4Ññó ðò0(.òV	?ò	?ò	3ò!óùós Ss   Â:C-