
     f                    h    d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZddlm	Z	 	 	 	 	 dddZ
ddZdS )    )annotationsN   )ImageFbbox tuple[int, int, int, int] | Noneinclude_layered_windowsboolall_screensxdisplay
str | NonereturnImage.Imagec           
        |}t           j        dk    rt          j        d          \  }}t	          j        |           dg}| r| \  }}}	}
|d| d| d|	|z
   d|
|z
   gz  }t          j        |d|gz              t          j	        |          }|
                                 t	          j        |           | r3|                    |	|z
  |
|z
  f          }|                                 |S |S t           j        dk    rt          j                            ||          \  }}}t          j        d||d	d
|d         dz  dz   dz  d          }| r1|\  }}| \  }}}	}
|                    ||z
  ||z
  |	|z
  |
|z
  f          }|S |}	 t          j        j        sd}t%          |          t          j                            |          \  }}t          j        d||d	d|d         dz  d          }| r|                    |           }|S # t$          $ r |t           j        dvrt)          j        d          rt          j        d          \  }}t	          j        |           t          j        dd|g           t          j	        |          }|
                                 t	          j        |           | r-|                    |           }|                                 |cY S |cY S  w xY w)Ndarwin.pngscreencapturez-R,z-xwin32RGBrawBGRr      z$Pillow was built without XCB supportBGRX   r   )r   r   zgnome-screenshotz-f)sysplatformtempfilemkstemposclose
subprocesscallr   openloadunlinkresizecoregrabscreen_win32	frombytescropHAVE_XCBOSErrorgrabscreen_x11shutilwhich)r   r   r
   r   fhfilepathargslefttoprightbottomim
im_resizedoffsetsizedatax0y0display_namemsg
im_croppeds                        P/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/PIL/ImageGrab.pygrabrD      s3    <8###+F33LBHRLLL#$D J+/(c5&$HHHHuTzHHF3JHHIIODD(#33444H%%BGGIIIIh "YYfsl'CDD



!!I\W$$!&!<!<'" "FD$ a1qB&	 	B  MB+/(c5&WWdRir52:v{KLLI'Lz" 	8C#,,Z..|<<
d* _UD$vtAw{ANN 	B	/     $777/00 8 $+F33LBHRLLLO/x@AAAH%%BGGIIIIh "WWT]]



!!!!III%s   AH CK%K%#K%Image.Image | list[str] | Nonec                    t           j        dk    rt          j        d          \  } }t	          j        |            d|z   dz   ddddg}d	g}|D ]	}|d
|gz  }
t          j        |           d }t	          j        |          j	        dk    r(t          j        |          }|                                 t	          j        |           |S t           j        dk    r>t          j                                        \  }}|dk    rdd l}|                    d|          d         }	|d         dk    r1||	d                              d                              d          }
n0||	d                              d                              d          }
|
d |
                    d                   S t+          |t,                    rVt/          j        |          }|dk    rddlm} |                    |          S |dk    rddlm} |                    |          S d S t	          j        d          rd}nt	          j        d          rd}nd }t?          j         d          r	|dv rg d}n.t?          j         d           r	|d!v rg d"}nd#}tC          |          t          j"        |d$%          }|j#        dk    r[|j$        }d&D ]	}||v r d S 
|d          d'}|r,|d(|%                                                                 z  }tM          |          t/          j        |j'                  }t          j        |          }|                                 |S ))Nr   r   z,set theFile to (open for access POSIX file "z" with write permission)tryu6       write (the clipboard as «class PNGf») to theFilezend tryzclose access theFile	osascriptz-er   r   fileI   zutf-16le mbcs pngr   )PngImagePluginDIB)BmpImagePluginWAYLAND_DISPLAYwaylandDISPLAYx11wl-paste)rT   N)rW   -timagexclip)rV   N)rZ   z
-selection	clipboardrX   z	image/pngz-ozDwl-paste or xclip is required for ImageGrab.grabclipboard() on LinuxT)capture_output)s   Nothing is copieds   No selections"   No suitable type of content copieds    not availables   cannot convert s(   xclip: Error: There is no owner for the z errorz: )(r   r   r   r    r!   r"   r#   r$   statst_sizer   r%   r&   r'   r)   grabclipboard_win32structunpack_fromdecodesplitindex
isinstancebytesioBytesIOrN   rP   PngImageFilerR   DibImageFilegetenvr0   r1   NotImplementedErrorrun
returncodestderrstripChildProcessErrorstdout)r2   r3   commandsscriptcommandr9   fmtr=   r`   ofilesrP   rR   session_typer4   rA   perrsilent_errors                      rC   grabclipboardr}   i   s   
|x'//H
:() D"
  	& 	&GtWo%FF78$))H%%BGGIII
	(			 	 J2244	T&==MMM""3--a0ABx1}}QRR
3399$??QRR//55d;;*5;;r??*++dE"" 		9:d##De||,,,,,,%224888,,,,,,%224888t9&'' 	 $LLYy!! 	  LLL<
## 	+8I(I(I...DD\'"" 	+|}'D'DPPPDDXC%c***N4555<1(C!      3&&44 '!W$$$C 32CIIKK..00222#C(((z!(##Z
				    )NFFN)
r   r   r   r	   r
   r	   r   r   r   r   )r   rE   )
__future__r   rg   r!   r0   r#   r   r   rN   r   rD   r}    r~   rC   <module>r      s   " # " " " " " 				 				      



        .2$)	I I I I IXY Y Y Y Y Yr~   