
    }f                    \    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Z
d ZdS )	    )annotationsN   )ImageFc           
        |}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)bboxinclude_layered_windowsall_screensxdisplayfhfilepathargslefttoprightbottomim
im_resizedoffsetsizedatax0y0msg
im_croppeds                       F/var/www/rtfcompare/venv/lib/python3.11/site-packages/PIL/ImageGrab.pygrabr>      s,   <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z" 	8C#,,Z..x88
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#c                    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)rM   N)rP   -timagexclip)rO   N)rS   z
-selection	clipboardrQ   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BytesIOrG   rI   PngImageFilerK   DibImageFilegetenvr'   r(   NotImplementedErrorrun
returncodestderrstripChildProcessErrorstdout)r-   r.   commandsscriptcommandr4   fmtr8   rY   ofilesrI   rK   session_typer/   r;   perrsilent_errors                      r=   grabclipboardrv   a   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)
__future__r   r`   r   r'   r   r   r   rG   r   r>   rv    rw   r=   <module>rz      s   " # " " " " " 				 				      



       A A A AHY Y Y Y Yrw   