Ë
    F‚$h-&  ã                   óæ   — d dl mZ d dlmZmZ d dlmZ erd dlmZ d dl	m
Z
 dZ G d„ de«      Z G d	„ d
e«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ de«      Zy)é    )ÚTYPE_CHECKING)ÚImageÚ	ImageDraw)ÚQRModuleDrawer)ÚStyledPilImage)ÚActiveWithNeighborsé   c                   ó   — e Zd ZU dZded<   y)ÚStyledPilQRModuleDrawerzù
    A base class for StyledPilImage module drawers.

    NOTE: the color that this draws in should be whatever is equivalent to
    black in the color space, and the specified QRColorMask will handle adding
    colors as necessary to the image
    r   ÚimgN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© ó    úc/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/qrcode/image/styles/moduledrawers/pil.pyr   r      s   … ñð 
Ôr   r   c                   ó.   ‡ — e Zd ZdZˆ fd„Zdefd„Zˆ xZS )ÚSquareModuleDrawerz-
    Draws the modules as simple squares
    c                 ó€   •— t        ‰| �  |i |¤Ž t        j                  | j                  j
                  «      | _        y ©N)ÚsuperÚ
initializer   ÚDrawr   Ú_imgÚimgDraw©ÚselfÚargsÚkwargsÚ	__class__s      €r   r   zSquareModuleDrawer.initialize    s-   ø€ Ü‰Ñ˜DÐ+ FÒ+Ü —~‘~ d§h¡h§m¡mÓ4ˆ�r   Ú	is_activec                 ól   — |r2| j                   j                  || j                  j                  ¬«       y y )N©Úfill)r   Ú	rectangler   Úpaint_color©r   Úboxr#   s      r   ÚdrawrectzSquareModuleDrawer.drawrect$   s+   € ÙØ�L‰L×"Ñ" 3¨T¯X©X×-AÑ-AÐ"ÕBð r   )r   r   r   r   r   Úboolr+   Ú__classcell__©r"   s   @r   r   r      s   ø„ ñô5ðC t÷ Cr   r   c                   ó6   ‡ — e Zd ZdZdd„Zˆ fd„Zdefd„Zˆ xZS )ÚGappedSquareModuleDrawerz¹
    Draws the modules as simple squares that are not contiguous.

    The size_ratio determines how wide the squares are relative to the width of
    the space they are printed in
    c                 ó   — || _         y r   )Ú
size_ratio)r   r2   s     r   Ú__init__z!GappedSquareModuleDrawer.__init__1   s	   € Ø$ˆ�r   c                 óÜ   •— t        ‰| �  |i |¤Ž t        j                  | j                  j
                  «      | _        d| j                  z
  | j                  j                  z  dz  | _	        y )Né   é   )
r   r   r   r   r   r   r   r2   Úbox_sizeÚdeltar   s      €r   r   z#GappedSquareModuleDrawer.initialize4   sQ   ø€ Ü‰Ñ˜DÐ+ FÒ+Ü —~‘~ d§h¡h§m¡mÓ4ˆŒØ˜$Ÿ/™/Ñ)¨T¯X©X×->Ñ->Ñ>ÀÑBˆ�
r   r#   c                 ó  — |r„|d   d   | j                   z   |d   d   | j                   z   |d   d   | j                   z
  |d   d   | j                   z
  f}| j                  j                  || j                  j                  ¬«       y y )Nr   r5   r%   )r8   r   r'   r   r(   )r   r*   r#   Úsmaller_boxs       r   r+   z!GappedSquareModuleDrawer.drawrect9   s„   € Ùà�A‘�q‘	˜DŸJ™JÑ&Ø�A‘�q‘	˜DŸJ™JÑ&Ø�A‘�q‘	˜DŸJ™JÑ&Ø�A‘�q‘	˜DŸJ™JÑ&ð	ˆKð �L‰L×"Ñ" ;°T·X±X×5IÑ5IÐ"ÕJð r   ©gš™™™™™é?)	r   r   r   r   r3   r   r,   r+   r-   r.   s   @r   r0   r0   )   s!   ø„ ñó%ôCð
K t÷ Kr   r0   c                   ó2   ‡ — e Zd ZdZdZˆ fd„Zdefd„Zˆ xZS )ÚCircleModuleDrawerz&
    Draws the modules as circles
    Nc                 ó  •— t        ‰| �  |i |¤Ž | j                  j                  }|t        z  }t        j                  | j                  j                  ||f| j                  j                  j                  «      | _
        t        j                  | j                  «      j                  dd||f| j                  j                  ¬«       | j                  j                  ||ft
        j                   j"                  «      | _
        y )Nr   r%   )r   r   r   r7   ÚANTIALIASING_FACTORr   ÚnewÚmodeÚ
color_maskÚ
back_colorÚcircler   r   Úellipser(   ÚresizeÚ
ResamplingÚLANCZOS)r   r    r!   r7   Ú	fake_sizer"   s        €r   r   zCircleModuleDrawer.initializeK   sÊ   ø€ Ü‰Ñ˜DÐ+ FÒ+Ø—8‘8×$Ñ$ˆØÔ2Ñ2ˆ	Ü—i‘iØ�H‰H�M‰MØ˜	Ð"Ø�H‰H×Ñ×*Ñ*ó
ˆŒô
 	�‰�t—{‘{Ó#×+Ñ+Ø��9˜iÐ(¨t¯x©x×/CÑ/Cð 	,ô 	
ð —k‘k×(Ñ(¨(°HÐ)=¼u×?OÑ?O×?WÑ?WÓXˆ�r   r#   c                 ó†   — |r?| j                   j                  j                  | j                  |d   d   |d   d   f«       y y ©Nr   r5   )r   r   ÚpasterD   r)   s      r   r+   zCircleModuleDrawer.drawrectY   s;   € ÙØ�H‰H�M‰M×Ñ §¡¨c°!©f°Q©i¸¸Q¹À¹Ð-CÕDð r   )	r   r   r   r   rD   r   r,   r+   r-   r.   s   @r   r=   r=   D   s#   ø„ ñð €FôYðE t÷ Er   r=   c                   óP   ‡ — e Zd ZdZdZd
d„Zˆ fd„Zd„ Zdeee	      ddfd	„Z
ˆ xZS )ÚRoundedModuleDraweraP  
    Draws the modules with all 90 degree corners replaced with rounded edges.

    radius_ratio determines the radius of the rounded edges - a value of 1
    means that an isolated module will be drawn as a circle, while a value of 0
    means that the radius of the rounded edge will be 0 (and thus back to 90
    degrees again).
    Tc                 ó   — || _         y r   )Úradius_ratio)r   rP   s     r   r3   zRoundedModuleDrawer.__init__j   s
   € Ø(ˆÕr   c                 ó’   •— t        ‰| �  |i |¤Ž t        | j                  j                  dz  «      | _        | j                  «        y )Nr6   )r   r   Úintr   r7   Úcorner_widthÚsetup_cornersr   s      €r   r   zRoundedModuleDrawer.initializem   s=   ø€ Ü‰Ñ˜DÐ+ FÒ+Ü §¡× 1Ñ 1°AÑ 5Ó6ˆÔØ×ÑÕr   c                 ó  — | j                   j                  }| j                   j                  j                  }| j                   j                  }t        j                  || j                  | j                  f|«      | _        | j                  t        z  }| j                  |z  }|dz  }t        j                  |||f|«      }t        j                  |«      }|j                  dd||f|¬«       |j                  |d||f|¬«       |j                  d|||f|¬«       |j                  | j                  | j                  ft
        j                   j"                  «      | _        | j$                  j'                  t
        j(                  j*                  «      | _        | j$                  j'                  t
        j(                  j.                  «      | _        | j$                  j'                  t
        j(                  j2                  «      | _        y ©Nr6   r   r%   )r   rA   rB   rC   r(   r   r@   rS   ÚSQUAREr?   rP   r   r   rE   r'   rF   rG   rH   ÚNW_ROUNDÚ	transposeÚ	TransposeÚFLIP_TOP_BOTTOMÚSW_ROUNDÚ
ROTATE_180ÚSE_ROUNDÚFLIP_LEFT_RIGHTÚNE_ROUND)	r   rA   rC   Úfront_colorÚ
fake_widthÚradiusÚdiameterÚbaseÚ	base_draws	            r   rT   z!RoundedModuleDrawer.setup_cornersr   s™  € Ø�x‰x�}‰}ˆØ—X‘X×(Ñ(×3Ñ3ˆ
Ø—h‘h×*Ñ*ˆÜ—i‘iØ�4×$Ñ$ d×&7Ñ&7Ð8¸+ó
ˆŒð ×&Ñ&Ô)<Ñ<ˆ
Ø×"Ñ" ZÑ/ˆØ˜A‘:ˆÜ�y‰yØ�:˜zÐ*¨Jó
ˆô —N‘N 4Ó(ˆ	Ø×Ñ˜1˜a ¨8Ð4¸;ÐÔGØ×Ñ˜V Q¨
°JÐ?ÀkÐÔRØ×Ñ˜Q ¨
°JÐ?ÀkÐÔRØŸ™Ø×Ñ × 1Ñ 1Ð2´E×4DÑ4D×4LÑ4Ló
ˆŒð Ÿ™×/Ñ/´·±×0OÑ0OÓPˆŒØŸ™×/Ñ/´·±×0JÑ0JÓKˆŒØŸ™×/Ñ/´·±×0OÑ0OÓPˆ�r   r*   r#   r   c                 óÂ  — |sy |j                    xr |j                   }|j                   xr |j                   }|j                   xr |j                   }|j                   xr |j                    }|r| j                  n| j
                  }|r| j                  n| j
                  }|r| j                  n| j
                  }	|r| j                  n| j
                  }
| j                  j                  j                  ||d   d   |d   d   f«       | j                  j                  j                  ||d   d   | j                  z   |d   d   f«       | j                  j                  j                  |	|d   d   | j                  z   |d   d   | j                  z   f«       | j                  j                  j                  |
|d   d   |d   d   | j                  z   f«       y rK   )ÚWÚNÚEÚSrX   rW   r`   r^   r\   r   r   rL   rS   )r   r*   r#   Ú
nw_roundedÚ
ne_roundedÚ
se_roundedÚ
sw_roundedÚnwÚneÚseÚsws              r   r+   zRoundedModuleDrawer.drawrect‹   s‰  € ÙØà"Ÿ™�_Ò8¨Y¯[©[¨ˆ
Ø"Ÿ™�_Ò8¨Y¯[©[¨ˆ
Ø"Ÿ™�_Ò8¨Y¯[©[¨ˆ
Ø"Ÿ™�_Ò8¨Y¯[©[¨ˆ
á(ˆT�]Š]¨d¯k©kˆÙ(ˆT�]Š]¨d¯k©kˆÙ(ˆT�]Š]¨d¯k©kˆÙ(ˆT�]Š]¨d¯k©kˆØ�‰�‰×Ñ˜B  Q¡¨¡¨C°©F°1©IÐ 6Ô7Ø�‰�‰×Ñ˜B  Q¡¨¡¨T×->Ñ->Ñ!>ÀÀAÁÀqÁ	Ð JÔKØ�‰�‰×ÑØ��Q‘˜‘˜T×.Ñ.Ñ.°°A±°q±	¸D×<MÑ<MÑ0MÐNô	
ð 	�‰�‰×Ñ˜B  Q¡¨¡¨C°©F°1©I¸×8IÑ8IÑ,IÐ JÕKr   )r5   )r   r   r   r   Úneeds_neighborsr3   r   rT   ÚlistrR   r+   r-   r.   s   @r   rN   rN   ^   s>   ø„ ñð €Oó)ôò
Qð2L˜D  c¡™Oð LÐ8M÷ Lr   rN   c                   ó<   ‡ — e Zd ZdZdZdd„Zˆ fd„Zd„ Zdd„Zˆ xZ	S )	ÚVerticalBarsDrawerzÌ
    Draws vertically contiguous groups of modules as long rounded rectangles,
    with gaps between neighboring bands (the size of these gaps is inversely
    proportional to the horizontal_shrink).
    Tc                 ó   — || _         y r   )Úhorizontal_shrink)r   ry   s     r   r3   zVerticalBarsDrawer.__init__©   s
   € Ø!2ˆÕr   c                 óæ   •— t        ‰| �  |i |¤Ž t        | j                  j                  dz  «      | _        t        d| j                  z
  | j
                  z  «      | _        | j                  «        y ©Nr6   r5   )	r   r   rR   r   r7   Úhalf_heightry   r8   Úsetup_edgesr   s      €r   r   zVerticalBarsDrawer.initialize¬   s_   ø€ Ü‰Ñ˜DÐ+ FÒ+Ü˜tŸx™x×0Ñ0°1Ñ4Ó5ˆÔÜ˜!˜d×4Ñ4Ñ4¸×8HÑ8HÑHÓIˆŒ
Ø×ÑÕr   c                 ó°  — | j                   j                  }| j                   j                  j                  }| j                   j                  }| j
                  }|dz  }t        || j                  z  «      }t        j                  |||f|«      | _
        |t        z  }|t        z  }t        j                  |||f|«      }	t        j                  |	«      }
|
j                  dd||dz  f|¬«       |	j                  ||ft        j                   j"                  «      | _        | j$                  j'                  t        j(                  j*                  «      | _        y rV   )r   rA   rB   rC   r(   r|   rR   ry   r   r@   rW   r?   r   r   rE   rF   rG   rH   Ú	ROUND_TOPrY   rZ   r[   ÚROUND_BOTTOM)r   rA   rC   ra   ÚheightÚwidthÚshrunken_widthrb   Úfake_heightre   rf   s              r   r}   zVerticalBarsDrawer.setup_edges²   s  € Ø�x‰x�}‰}ˆØ—X‘X×(Ñ(×3Ñ3ˆ
Ø—h‘h×*Ñ*ˆà×!Ñ!ˆØ˜‘
ˆÜ˜U T×%;Ñ%;Ñ;Ó<ˆÜ—i‘i  ~°vÐ&>ÀÓLˆŒàÔ0Ñ0ˆ
ØÔ2Ñ2ˆÜ�y‰yØ�:˜{Ð+¨Zó
ˆô —N‘N 4Ó(ˆ	Ø×Ñ˜1˜a ¨[¸1©_Ð=ÀKÐÔPàŸ™ n°fÐ%=¼u×?OÑ?O×?WÑ?WÓXˆŒØ ŸN™N×4Ñ4´U·_±_×5TÑ5TÓUˆÕr   c                 óÄ  — |rÞ|j                    }|j                   }|r| j                  n| j                  }|r| j                  n| j                  }| j
                  j                  j                  ||d   d   | j                  z   |d   d   f«       | j
                  j                  j                  ||d   d   | j                  z   |d   d   | j                  z   f«       y y rK   )
ri   rk   r   rW   r€   r   r   rL   r8   r|   )r   r*   r#   Útop_roundedÚbottom_roundedÚtopÚbottoms          r   r+   zVerticalBarsDrawer.drawrectÇ   s¾   € Ùà'Ÿk™k˜/ˆKØ!*§¡˜_ˆNá$/�$—.’.°T·[±[ˆCÙ*8�T×&Ò&¸d¿k¹kˆFØ�H‰H�M‰M×Ñ  c¨!¡f¨Q¡i°$·*±*Ñ&<¸cÀ!¹fÀQ¹iÐ%HÔIØ�H‰H�M‰M×ÑØ˜˜Q™ ™ T§Z¡ZÑ/°°Q±¸±¸T×=MÑ=MÑ1MÐNõð r   r;   ©r#   r   ©
r   r   r   r   rt   r3   r   r}   r+   r-   r.   s   @r   rw   rw       s$   ø„ ñð €Oó3ôòV÷*r   rw   c                   ó<   ‡ — e Zd ZdZdZdd„Zˆ fd„Zd„ Zdd„Zˆ xZ	S )	ÚHorizontalBarsDrawerzÌ
    Draws horizontally contiguous groups of modules as long rounded rectangles,
    with gaps between neighboring bands (the size of these gaps is inversely
    proportional to the vertical_shrink).
    Tc                 ó   — || _         y r   )Úvertical_shrink)r   r�   s     r   r3   zHorizontalBarsDrawer.__init__Þ   s
   € Ø.ˆÕr   c                 óæ   •— t        ‰| �  |i |¤Ž t        | j                  j                  dz  «      | _        t        d| j                  z
  | j
                  z  «      | _        | j                  «        y r{   )	r   r   rR   r   r7   Ú
half_widthr�   r8   r}   r   s      €r   r   zHorizontalBarsDrawer.initializeá   s\   ø€ Ü‰Ñ˜DÐ+ FÒ+Ü˜dŸh™h×/Ñ/°!Ñ3Ó4ˆŒÜ˜!˜d×2Ñ2Ñ2°d·o±oÑEÓFˆŒ
Ø×ÑÕr   c                 ó°  — | j                   j                  }| j                   j                  j                  }| j                   j                  }| j
                  }|dz  }t        || j                  z  «      }t        j                  |||f|«      | _
        |t        z  }|t        z  }t        j                  |||f|«      }	t        j                  |	«      }
|
j                  dd|dz  |f|¬«       |	j                  ||ft        j                   j"                  «      | _        | j$                  j'                  t        j(                  j*                  «      | _        y rV   )r   rA   rB   rC   r(   r‘   rR   r�   r   r@   rW   r?   r   r   rE   rF   rG   rH   Ú
ROUND_LEFTrY   rZ   r_   ÚROUND_RIGHT)r   rA   rC   ra   r‚   r�   Úshrunken_heightrb   r„   re   rf   s              r   r}   z HorizontalBarsDrawer.setup_edgesç   s  € Ø�x‰x�}‰}ˆØ—X‘X×(Ñ(×3Ñ3ˆ
Ø—h‘h×*Ñ*ˆà—‘ˆØ˜‘ˆÜ˜f t×';Ñ';Ñ;Ó<ˆÜ—i‘i  u¨oÐ&>ÀÓLˆŒàÔ0Ñ0ˆ
ØÔ2Ñ2ˆÜ�y‰yØ�:˜{Ð+¨Zó
ˆô —N‘N 4Ó(ˆ	Ø×Ñ˜1˜a ¨a¡°Ð=ÀKÐÔPàŸ+™+Ø�OÐ$¤e×&6Ñ&6×&>Ñ&>ó
ˆŒð  Ÿ?™?×4Ñ4´U·_±_×5TÑ5TÓUˆÕr   c                 óÄ  — |rÞ|j                    }|j                   }|r| j                  n| j                  }|r| j                  n| j                  }| j
                  j                  j                  ||d   d   |d   d   | j                  z   f«       | j
                  j                  j                  ||d   d   | j                  z   |d   d   | j                  z   f«       y y rK   )
rh   rj   r“   rW   r”   r   r   rL   r8   r‘   )r   r*   r#   Úleft_roundedÚright_roundedÚleftÚrights          r   r+   zHorizontalBarsDrawer.drawrectþ   s¼   € Ùà(Ÿ{™{˜?ˆLØ )§¡˜OˆMá&2�4—?’?¸¿¹ˆDÙ(5�D×$Ò$¸4¿;¹;ˆEØ�H‰H�M‰M×Ñ  s¨1¡v¨a¡y°#°a±&¸±)¸d¿j¹jÑ2HÐ&IÔJØ�H‰H�M‰M×ÑØ˜˜A™˜q™	 D§O¡OÑ3°S¸±V¸A±YÀÇÁÑ5KÐLõð r   r;   rŠ   r‹   r.   s   @r   r�   r�   Õ   s$   ø„ ñð €Oó/ôòV÷.r   r�   N)Útypingr   ÚPILr   r   Ú&qrcode.image.styles.moduledrawers.baser   Úqrcode.image.styledpilr   Úqrcode.mainr   r?   r   r   r0   r=   rN   rw   r�   r   r   r   ú<module>r       sƒ   ðÝ  ç  Ý AáÝ5Ý/ð Ð ô	˜nô 	ôCÐ0ô CôKÐ6ô Kô6EÐ0ô Eô4?LÐ1ô ?LôD2Ð0ô 2ôj4Ð2õ 4r   