Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pyautogui/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pyautogui/__pycache__/__init__.cpython-312.pyc

�

(ٜg>>�
�2
�ddlmZmZmZdZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZGd�de�ZGd�de�ZGd	�d
e�Zej&ddk(sej&dddvrdd
lmZndd
lmZ	ddlmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4	ddl7m8Z8m9Z9m:Z:m;Z;d�Z=	ddl>Z>ddl>m?Z?m@Z@mAZAmBZBe=d��ZCe>j�j�eC_De=d��ZEe>j�j�eE_De=d��ZFe>j�j�eF_De=d��ZGe>j�j�eG_De=d��ZHe>j�j�eH_De=d��ZIe>j�j�eI_D	ddlKZKd�ZLdnd�ZMejdk(r	ddlNmOZOmPZPmQZQmRZRmSZSmTZTmUZUgd!�ZWeWZXd"ZYd#ZZd$Z[d%Z\d&Z]d'Z^d(Z_d)�Z`ejj�d*�rebd+��ejd,k(rd-d.lcmdZenKejdk(rd-d/lcmfZen5e
j��d0k(rd-d1lcmhZenebd2e
j��z��d3Zid4Zjd3akd5Zld6Zmd7gZnd8Zod9ZpgZqej�d:d;�Zsej�d<d=�Ztd>�Zud?�Zvd@�ZwdA�ZxdB�ZydodC�ZzdpdD�Z{dE�Z|e|Z}dndF�Z~	dG�Zeudde\dHewdd6fdI��Z�eudde\dHewdd6fdJ��Z�euddd-dHe\dHewdd6f	dK��Z�eudddHdHewdd6fdL��Z�eudddHdHewdd6fdM��Z�eudddHdHewdd6fdN��Z�eudddHeYdHewdd6fdO��Z�eudddHeYdHewdd6fdP��Z�eudqdQ��Z�eudqdR��Z�eudqdS��Z�eudddHewd8d6fdT��Z�eudddHewd8d6fdU��Z�e�Z�eudddHewe\dd6d6fdV��Z�eudddHewe\dd6d6fdW��Z�e�Z�ewdfdX�Z�dY�Z�eudrdZ��Z�eudrd[��Z�eudsd\��Z�eeudrd]���Z�eudtd^��Z�e�Z�eud_��Z�e�Z�d`�Z�d7da�Z�dudb�Z�dc�Z�dd�Z�de�Z�df�Z�dg�Z�dh�Z�di�Z�dj�Z�dndk�Z�dvdl�Z�dm�Z�e|�\Z�Z�en�jWde�d-z
fe�d-z
dfe�d-z
e�d-z
fg�y#e5$rCd�Z6e6Ze6Ze6Ze6Ze6Ze6Ze6Ze6Ze6Ze6Z e6Z!e6Z"e6Z#e6Z$e6Z%e6Z&e6Z'e6Z(e6Z)e6Z*e6Z+e6Z,e6Z-e6Z.e6Z/e6Z0e6Z1e6Z2e6Z3e6Z4Y���wxYw#e5$rd�Z<e<xZ8xZ9xZ:Z;Y���wxYw#e5$rd�ZJeJZ?eJZCeJZEeJZFeJZGeJZHeJZIeJZ@eJZAeJZBY��1wxYw#e5$rd�ZLY��8wxYw#e5$rd �ZVeVZOeVZPeVZQeVZReVZSeVZTeVZUY��/wxYw)w�)�absolute_import�division�print_functionz0.9.54N)�contextmanagerc��eZdZdZy)�PyAutoGUIExceptiona
    PyAutoGUI code will raise this exception class for any invalid actions. If PyAutoGUI raises some other exception,
    you should assume that this is caused by a bug in PyAutoGUI itself. (Including a failure to catch potential
    exceptions raised by PyAutoGUI.)
    N��__name__�
__module__�__qualname__�__doc__���=/usr/local/lib/python3.12/site-packages/pyautogui/__init__.pyrr����	rrc��eZdZdZy)�FailSafeExceptiona(
    This exception is raised by PyAutoGUI functions when the user puts the mouse cursor into one of the "failsafe
    points" (by default, one of the four corners of the primary monitor). This exception shouldn't be caught; it's
    meant to provide a way to terminate a misbehaving script.
    Nr	rrrrr'rrrc��eZdZdZy)�ImageNotFoundExceptionz�
    This exception is the PyAutoGUI version of PyScreeze's `ImageNotFoundException`, which is raised when a locate*()
    function call is unable to find an image.

    Ideally, `pyscreeze.ImageNotFoundException` should never be raised by PyAutoGUI.
    Nr	rrrrr1s��rr�))��)rr)�Sequence)�
easeInQuad�easeOutQuad�
easeInOutQuad�easeInCubic�easeOutCubic�easeInOutCubic�easeInQuart�easeOutQuart�easeInOutQuart�easeInQuint�easeOutQuint�easeInOutQuint�
easeInSine�easeOutSine�
easeInOutSine�
easeInExpo�easeOutExpo�
easeInOutExpo�
easeInCirc�easeOutCirc�
easeInOutCirc�
easeInElastic�easeOutElastic�easeInOutElastic�
easeInBack�easeOutBack�
easeInOutBack�easeInBounce�
easeOutBounce�easeInOutBouncec��td��)z�
        This function raises ``PyAutoGUIException``. It's used for the PyTweening function names if the PyTweening
        module failed to be imported.
        zoPyAutoGUI was unable to import pytweening. Please install this module to enable the function you tried to call.�r��unused_args�
unused_kwargss  r�_couldNotImportPyTweeningr=is��
!�}�
�	
r)�alert�confirm�prompt�passwordc��td��)z�
        This function raises ``PyAutoGUIException``. It's used for the PyMsgBox function names if the PyMsgbox module
        failed to be imported.
        zmPyAutoGUI was unable to import pymsgbox. Please install this module to enable the function you tried to call.r9r:s  r�_couldNotImportPyMsgBoxrC�s��
!�{�
�	
rc�B��tj���fd��}|S)a
    A decorator that wraps PyScreeze locate*() functions so that the PyAutoGUI user sees them raise PyAutoGUI's
    ImageNotFoundException rather than PyScreeze's ImageNotFoundException. This is because PyScreeze should be
    invisible to PyAutoGUI users.
    c�P��	�|i|��S#tj$rt�wxYw�N)�	pyscreezer)�args�kwargs�wrappedFunctions  �r�wrapperz5raisePyAutoGUIImageNotFoundException.<locals>.wrapper�s3���	)�"�D�3�F�3�3���/�/�	)�(�(�	)�s��%��	functools�wraps�rJrKs` r�$raisePyAutoGUIImageNotFoundExceptionrP�s'����_�_�_�%�)�&�)��Nr)�center�pixel�pixelMatchesColor�
screenshotc�,�tj|i|��SrF)rG�locate�rHrIs  rrVrV�s������0��0�0rc�,�tj|i|��SrF)rG�	locateAllrWs  rrYrY�s���"�"�D�3�F�3�3rc�,�tj|i|��SrF)rG�locateAllOnScreenrWs  rr[r[�s���*�*�D�;�F�;�;rc�,�tj|i|��SrF)rG�locateCenterOnScreenrWs  rr]r]�s���-�-�t�>�v�>�>rc�,�tj|i|��SrF)rG�locateOnScreenrWs  rr_r_�����'�'��8��8�8rc�,�tj|i|��SrF)rG�locateOnWindowrWs  rrbrb�r`rc��td��)z�
        This function raises ``PyAutoGUIException``. It's used for the PyScreeze function names if the PyScreeze module
        failed to be imported.
        z�PyAutoGUI was unable to import pyscreeze. (This is likely because you're running a version of Python that Pillow (which pyscreeze depends on) doesn't support currently.) Please install this module to enable the function you tried to call.r9)r;�unsed_kwargss  r�_couldNotImportPyScreezere�s��
!�
}�
�	
rc�,�tj�y)z�
        Launches the MouseInfo app. This application provides mouse coordinate information which can be useful when
        planning GUI automation tasks. This function blocks until the application is closed.
        N)�	mouseinfo�MouseInfoWindowrrr�	mouseInfori�s��
	�!�!�#rc��td��)z�
        This function raises PyAutoGUIException. It's used for the MouseInfo function names if the MouseInfo module
        failed to be imported.
        znPyAutoGUI was unable to import mouseinfo. Please install this module to enable the function you tried to call.r9rrrriris��
!�|�
�	
rc�T�|�d}	|t_y#t$rtd��wxYw)a�
    When called with no arguments, PyAutoGUI will raise ImageNotFoundException when the PyScreeze locate*() functions
    can't find the image it was told to locate. The default behavior is to return None. Call this function with no
    arguments (or with True as the argument) to have exceptions raised, which is a better practice.

    You can also disable raising exceptions by passing False for the argument.
    NTzDuseImageNotFoundException() ws called but pyscreeze isn't installed.)rG�USE_IMAGE_NOT_FOUND_EXCEPTION�	NameErrorr)�values r�useImageNotFoundExceptionros9��
�}���i�27�	�/���i� �!g�h�h�i�s��'�win32)�Window�getActiveWindow�getActiveWindowTitle�getWindowsAt�getWindowsWithTitle�
getAllWindows�getAllTitlesc��td��)z�
            This function raises PyAutoGUIException. It's used for the PyGetWindow function names if the PyGetWindow
            module failed to be imported.
            zpPyAutoGUI was unable to import pygetwindow. Please install this module to enable the function you tried to call.r9r:s  r�_couldNotImportPyGetWindowry)s��
%�C��
r)��	�
�
� �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�;�<�=�>�?�@�[�\�]�^�_�`�a�b�c�d�e�f�g�h�i�j�k�l�m�n�o�p�q�r�s�t�u�v�w�x�y�z�{�|�}�~�accept�add�alt�altleft�altright�apps�	backspace�browserback�browserfavorites�browserforward�browserhome�browserrefresh�
browsersearch�browserstop�capslock�clear�convert�ctrl�ctrlleft�	ctrlright�decimal�del�delete�divide�down�end�enter�esc�escape�execute�f1�f10�f11�f12�f13�f14�f15�f16�f17�f18�f19�f2�f20�f21�f22�f23�f24�f3�f4�f5�f6�f7�f8�f9�final�fn�hanguel�hangul�hanja�help�home�insert�junja�kana�kanji�
launchapp1�
launchapp2�
launchmail�launchmediaselect�left�
modechange�multiply�	nexttrack�
nonconvert�num0�num1�num2�num3�num4�num5�num6�num7�num8�num9�numlock�pagedown�pageup�pause�pgdn�pgup�	playpause�	prevtrack�print�printscreen�prntscrn�prtsc�prtscr�return�right�
scrolllock�select�	separator�shift�	shiftleft�
shiftright�sleep�space�stop�subtract�tab�up�
volumedown�
volumemute�volumeup�win�winleft�winright�yen�command�option�
optionleft�optionrightr�middler$�primary�	secondaryz^`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?z^=1234567890/0qwertzuiop89-asdfghjkl,\yxcvbnm,.7+!@#$%^&*()?)QWERTZUIOP*(_ASDFGHJKL<|YXCVBNM<>&c�@�|j�xs
|td�vS)z�
    Returns True if the ``character`` is a keyboard key that would require the shift key to be held down, such as
    uppercase letters or the symbols on the keyboard's number row.
    z~!@#$%^&*()_+{}|:"<>?)�isupper�set)�	characters r�isShiftCharacterrCs#������K�)�s�3J�/K�"K�Kr�javaz)Jython is not yet supported by PyAutoGUI.�darwinr)�_pyautogui_osx)�_pyautogui_win�Linux)�_pyautogui_x11z1Your platform (%s) is not supported by PyAutoGUI.g�������?g�������?g{�G�z�?T)rrF�
�Pointzx y�Sizezwidth heightc�B��tj���fd��}|S)zo
    A decorator that calls failSafeCheck() before the decorated function and
    _handlePause() after it.
    c�b��t��|i|��}t|jdd��|S)N�_pauseT)�
failSafeCheck�_handlePause�get)rHrI�	returnValrJs   �rrKz(_genericPyAutoGUIChecks.<locals>.wrapperOs0�����#�T�4�V�4�	��V�Z�Z��$�/�0��rrLrOs` r�_genericPyAutoGUIChecksrTIs'����_�_�_�%��&���Nrc�6�||z
|z|z}||z
|z|z}||fS)a
    Returns an (x, y) tuple of the point that has progressed a proportion ``n`` along the line defined by the two
    ``x1``, ``y1`` and ``x2``, ``y2`` coordinates.

    This function was copied from pytweening module, so that it can be called even if PyTweening is not installed.
    r)�x1�y1�x2�y2r�r�r�s       r�getPointOnLinerZ]s1��
�r�'�Q��"��A�
�r�'�Q��"��A�
�q�6�Mrc�J�d|cxkrdkstd��td��|S)a
    Returns ``n``, where ``n`` is the float argument between ``0.0`` and ``1.0``. This function is for the default
    linear tween for mouse moving functions.

    This function was copied from PyTweening module, so that it can be called even if PyTweening is not installed.
    �g�?z%Argument must be between 0.0 and 1.0.r9)r�s r�linearr]is1���!�?�s�?� �!H�I�I�� �!H�I�I��Hrc��|rDttt�sttt�sJ�t	j
t�yy)z�
    A helper function for performing a pause at the end of a PyAutoGUI function based on some settings.

    If ``_pause`` is ``True``, then sleep for ``PAUSE`` seconds (the global pause setting).
    N)�
isinstance�PAUSE�int�float�timer+�rOs rrQrQws1����%��%��E�5�)A�A�A��
�
�5��rc�L�|�|�
t�S|�+|�)ttt�d�t|��S|�;|�9t|t�s)tt|�tt�d��St|t
�r	t
|�}|�t|�Syt|t�r�t|�dk(rI|�$tt|d�t|d��Stdjt|����t|�dk(r0|�t|�Stdjt|����tdjt|����tt|�t|��S#tj$rt�wxYw)	a�
    Returns a ``Point`` object based on ``firstArg`` and ``secondArg``, which are the first two arguments passed to
    several PyAutoGUI functions. If ``firstArg`` and ``secondArg`` are both ``None``, returns the current mouse cursor
    position.

    ``firstArg`` and ``secondArg`` can be integers, a sequence of integers, or a string representing an image filename
    to find on the screen (and return the center coordinates of).
    NrrrzRWhen passing a sequence for firstArg, secondArg must not be passed (received {0}).�zfWhen passing a sequence for firstArg, secondArg must not be passed and default to None (received {0}).zTThe supplied sequence must have exactly 2 or exactly 4 elements ({0} were received).)�positionrKrar_r�strr_rQrGr�lenr�format�repr)�firstArg�	secondArg�locations   r�_normalizeXYArgsro�s�����I�-��z��	�	�i�3��S���A��'��Y��8�8�	�	�x�3�J�x�QY�<Z��S��]�C��
�1�
�$6�7�7�	�H�c�	"�		)�%�h�/�H��#��h�'�'��
�H�h�	'��x�=�A��� ��S��!��-�s�8�A�;�/?�@�@�(�h�o�o��Y�����
��]�a�
�� ��h�'�'�(�|�D�D��Y�����%�f�m�m���M���
��S��]�C�	�N�3�3��C�/�/�	)�(�(�	)�s�
F	�	F#c��|sy|�	tduryt|�dkDr|dddz}tjj�}|j�dt|j�jdd��dt|j�jdd��d|j�d|j�d|j�dt|j�dd	�d|�d|�d
�}tjj||�}t �Wtt"�t k\rAtj$tjj|t"d��t"d=t'|�t"j)|�y)a�
    A helper function that creates a screenshot to act as a logging mechanism. When a PyAutoGUI function is called,
    this function is also called to capture the state of the screen when that function was called.

    If ``logScreenshot`` is ``False`` (or None and the ``LOG_SCREENSHOTS`` constant is ``False``), no screenshot is taken.

    The ``funcName`` argument is a string of the calling function's name. It's used in the screenshot's filename.

    The ``funcArgs`` argument is a string describing the arguments passed to the calling function. It's limited to
    twelve characters to keep it short.

    The ``folder`` argument is the folder to place the screenshot file in, and defaults to the current working directory.
    NF�z...r�rr�r�r�.pngr)�LOG_SCREENSHOTSri�datetime�now�yearrh�month�rjust�day�hour�minute�second�microsecond�os�path�join�LOG_SCREENSHOTS_LIMIT�G_LOG_SCREENSHOTS_FILENAMES�unlinkrT�append)�
logScreenshot�funcName�funcArgs�folderru�filename�filepaths       r�_logScreenshotr��s#�������E�!9���8�}�r���C�R�=�5�(��
�
�
�
�
�
!�C�����C�I�I����Q��$��C�G�G����1�c�"�����
�
��
�
��C�O�O��R�a� ���
�H��w�w�|�|�F�H�-�H�	�)��4O�0P�Ti�0i�
�	�	�"�'�'�,�,�v�'B�1�'E�F�G�'��*��x���&�&�x�0rc��tj�\}}t|�}t|�}|�t|�}|�t|�}t||�S)a�
    Returns the current xy coordinates of the mouse cursor as a two-integer tuple.

    Args:
      x (int, None, optional) - If not None, this argument overrides the x in
        the return value.
      y (int, None, optional) - If not None, this argument overrides the y in
        the return value.

    Returns:
      (x, y) tuple of the current xy coordinates of the mouse cursor.

    NOTE: The position() function doesn't check for failsafe.
    )�platformModule�	_positionrarK)r�r��posx�posys    rrgrg�sQ�� �)�)�+�J�D�$��t�9�D��t�9�D��}��1�v���}��1�v����t��rc�6�ttj��S)z�Returns the width and height of the screen as a two-integer tuple.

    Returns:
      (width, height) tuple of the screen size, in pixels.
    )rLr��_sizerrr�sizer�	s����%�%�'�(�(rc��t||�\}}t|�}t|�}tj�\}}d|cxkxr|kncxrd|cxkxr|kScS)aReturns whether the given xy coordinates are on the primary screen or not.

    Note that this function doesn't work for secondary screens.

    Args:
      Either the arguments are two separate values, first arg for x and second
        for y, or there is a single argument of a sequence with two values, the
        first x and the second y.
        Example: onScreen(x, y) or onScreen([x, y])

    Returns:
      bool: True if the xy coordinates are on the screen at its current
        resolution, otherwise False.
    r)rorar�r�)r�r��width�heights    r�onScreenr�sX���A�q�!�D�A�q��A��A��A��A�"�(�(�*�M�E�6���>�E�>�-�a�1�o�v�o�-�o�-rc�>�|j�}tj�dk(r/|ttt
ttdddddddfvr6td	��|ttt
ttdddfvrtd
��|ttfvrRtj�}|r|tk(rt
S|tk(r$tS|tk(rtS|tk(rt
Sttttt
t
dtdtdt
ddddddddi
|S)a�
    The left, middle, and right mouse buttons are button numbers 1, 2, and 3 respectively. This is the numbering that
    Xlib on Linux uses (while Windows and macOS don't care about numbers; they just use "left" and "right").

    This function takes one of ``LEFT``, ``MIDDLE``, ``RIGHT``, ``PRIMARY``, ``SECONDARY``, ``1``, ``2``, ``3``, ``4``,
    ``5``, ``6``, or ``7`` for the button argument and returns either ``LEFT``, ``MIDDLE``, ``RIGHT``, ``4``, ``5``,
    ``6``, or ``7``. The ``PRIMARY``, ``SECONDARY``, ``1``, ``2``, and ``3`` values are never returned.

    The ``'left'`` and ``'right'`` mouse buttons will always refer to the physical left and right
    buttons on the mouse. The same applies for buttons 1 and 3.

    However, if ``button`` is ``'primary'`` or ``'secondary'``, then we must check if
    the mouse buttons have been "swapped" (for left-handed users) by the operating system's mouse
    settings.

    If the buttons are swapped, the primary button is the right mouse button and the secondary button is the left mouse
    button. If not swapped, the primary and secondary buttons are the left and right buttons, respectively.

    NOTE: Swap detection has not been implemented yet.
    rHrrrrf���zgbutton argument must be one of ('left', 'middle', 'right', 'primary', 'secondary', 1, 2, 3, 4, 5, 6, 7)z[button argument must be one of ('left', 'middle', 'right', 'primary', 'secondary', 1, 2, 3))�lower�platform�system�LEFT�MIDDLE�RIGHT�PRIMARY�	SECONDARYrr��_mouse_is_swapped)�button�swappeds  r�_normalizeButtonr�9s��2�\�\�^�F�����G�#��$���w�	�1�a��A�q�RS�UV�W�W�$�y��
�
�$���w�	�1�a��K�K�$�m��
�
�'�9�%�%� �2�2�4����� ����9�$����� ����9�$���
�$����u�a��q�&�!�U�TU�WX�Z[�]^�`a�cd�fg�ij�k�lr�s�srr\c	��t|�}t||�\}}td||dddd��t|d|�d|��d��t	j
|||�y)	a�Performs pressing a mouse button down (but not up).

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        mouse down happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        mouse down happens. None by default.
      button (str, int, optional): The mouse button pressed down. TODO

    Returns:
      None

    Raises:
      PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, or 3
    �moverN��duration�tween�	mouseDownr�r��r�)r�ro�_mouseMoveDragr�r��
_mouseDown�r�r�r�r�r�r�rOs       rr�r�rsW��0�f�
%�F��A�q�!�D�A�q��6�1�a��A���>��=�+�!�Q�/?��L����a��F�+rc	��t|�}t||�\}}td||dddd��t|d|�d|��d��t	j
|||�y)	a�Performs releasing a mouse button up (but not down beforehand).

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        mouse up happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        mouse up happens. None by default.
      button (str, int, optional): The mouse button released. TODO

    Returns:
      None

    Raises:
      PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, or 3
    r�rNr��mouseUpr�r�r�)r�ror�r�r��_mouseUpr�s       rr�r��sW��0�f�
%�F��A�q�!�D�A�q��6�1�a��A���>��=�)��1�-=�c�J����A�q�&�)rc	��t|�}t||�\}}td||dd||�t|d|�d|�d|�d|��d��tj
dk(rHt
|�D]9}	t�|tttfvs�!tj|||d|��;y	t
|�D]K}	t�|tttfvrtj|||�tj|��My	)
ab
    Performs pressing a mouse button down and then immediately releasing it. Returns ``None``.

    When no arguments are passed, the primary mouse button is clicked at the mouse cursor's current location.

    If integers for ``x`` and ``y`` are passed, the click will happen at that XY coordinate. If ``x`` is a string, the
    string is an image filename that PyAutoGUI will attempt to locate on the screen and click the center of. If ``x``
    is a sequence of two coordinates, those coordinates will be used for the XY coordinate to click on.

    The ``clicks`` argument is an int of how many clicks to make, and defaults to ``1``.

    The ``interval`` argument is an int or float of how many seconds to wait in between each click, if ``clicks`` is
    greater than ``1``. It defaults to ``0.0`` for no pause in between clicks.

    The ``button`` argument is one of the constants ``LEFT``, ``MIDDLE``, ``RIGHT``, ``PRIMARY``, or ``SECONDARY``.
    It defaults to ``PRIMARY`` (which is the left mouse button, unless the operating system has been set for
    left-handed users.)

    If ``x`` and ``y`` are specified, and the click is not happening at the mouse cursor's current location, then
    the ``duration`` argument is an int or float of how many seconds it should take to move the mouse to the XY
    coordinates. It defaults to ``0`` for an instant move.

    If ``x`` and ``y`` are specified and ``duration`` is not ``0``, the ``tween`` argument is a tweening function
    that specifies the movement pattern of the mouse cursor as it moves to the XY coordinates. The default is a
    simple linear tween. See the PyTweening module documentation for more details.

    The ``pause`` parameter is deprecated. Call the ``pyautogui.sleep()`` function to implement a pause.

    Raises:
      PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, 3
    r�r�clickr�r�r�rErN)r�ror�r��sysr��rangerPr�r�r�r��_multiClick�_clickrcr+)
r�r��clicks�intervalr�r�r�r�rOr�s
          rr�r��s���H�f�
%�F��A�q�!�D�A�q��6�1�a��A�x��7��=�'�F�F�A�q�+Q�Z]�^�
�|�|�x���v��A��O��$���.�.��*�*�1�a���H�E��
�v��A��O��$���.�.��%�%�a��F�3��J�J�x� �rc�4�t||d|t||||��	y)a�Performs a left mouse button click.

    This is a wrapper function for click('left', x, y).

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.
      interval (float, optional): The number of seconds in between each click,
        if the number of clicks is greater than 1. 0.0 by default, for no
        pause in between clicks.

    Returns:
      None
    rrdN)r�r��r�r�r�r�r�r�rOs       r�	leftClickr��s��6
�!�Q��8�T�8�U�M�&�Qrc�4�t||d|t||||��	y)a�Performs a right mouse button click.

    This is a wrapper function for click('right', x, y).

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.
      interval (float, optional): The number of seconds in between each click,
        if the number of clicks is greater than 1. 0.0 by default, for no
        pause in between clicks.

    Returns:
      None
    rrdN)r�r�r�s       r�
rightClickr�s��2
�!�Q��8�U�H�e�]�6�Rrc�4�t||d|t||||��	y)aPerforms a middle mouse button click.

    This is a wrapper function for click('middle', x, y).

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.

    Returns:
      None
    rrdN)r�r�r�s       r�middleClickr�(s��,
�!�Q��8�V�X�u�m�F�Src�$�tjdk(rit||�\}}td||dddd��t	j
�\}}t	j|||d�t|d|�d|�d|�d	�d
��yt||d|||||d�
�	y)a�Performs a double click.

    This is a wrapper function for click('left', x, y, 2, interval).

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.
      interval (float, optional): The number of seconds in between each click,
        if the number of clicks is greater than 1. 0.0 by default, for no
        pause in between clicks.
      button (str, int, optional): The mouse button released. TODO

    Returns:
      None

    Raises:
      PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, 3, 4,
        5, 6, or 7
    rEr�rNr�rr�r�z,2r�r�Frd)	r�r�ror�r�r�r�r�r��r�r�r�r�r�r�r�rOs        r�doubleClickr�As���@�|�|�x����1�%���1��v�q�!�Q��A�T�B��'�'�)���1��"�"�1�a���3��}�g�q�!�V�/L�UX�Y�	�a��A�x���5�-�PU�Vrc�$�tjdk(rit||�\}}td||dddd��t	j
�\}}t
|d|�d|�d|�d�d	�
�t	j|||d�yt||d|||||d�
�	y)a�Performs a triple click.

    This is a wrapper function for click('left', x, y, 3, interval).

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.
      interval (float, optional): The number of seconds in between each click,
        if the number of clicks is greater than 1. 0.0 by default, for no
        pause in between clicks.
      button (str, int, optional): The mouse button released. TODO

    Returns:
      None

    Raises:
      PyAutoGUIException: If button is not one of 'left', 'middle', 'right', 1, 2, 3, 4,
        5, 6, or 7
    rEr�rNr�r�r�z,3r�r�rFrd)	r�r�ror�r�r�r�r�r�r�s        r�tripleClickr�ls���>�|�|�x����1�%���1��v�q�!�Q��A�T�B��'�'�)���1��}�g�q�!�V�/L�UX�Y��"�"�1�a���3�	�a��A�x���5�-�PU�Vrc	��t|�ttfvr
|d|d}}t||�\}}t	|d|�d|�d|��d��tj|||�y)aPerforms a scroll of the mouse scroll wheel.

    Whether this is a vertical or horizontal scroll depends on the underlying
    operating system.

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      clicks (int, float): The amount of scrolling to perform.
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.

    Returns:
      None
    rr�scrollr�r�r�N)�type�tuple�listrgr�r��_scroll�r�r�r�r�rOs     rr�r��s\��,�A�w�5�$�-����t�Q�q�T�1���A�q�>�D�A�q��=�(�&�!�Q�,G�PS�T����6�1�a�(rc	��t|�ttfvr
|d|d}}t||�\}}t	|d|�d|�d|��d��tj|||�y)a�Performs an explicitly horizontal scroll of the mouse scroll wheel,
    if this is supported by the operating system. (Currently just Linux.)

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      clicks (int, float): The amount of scrolling to perform.
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.

    Returns:
      None
    rr�hscrollr�r�r�N)r�r�r�rgr�r��_hscrollr�s     rr�r���\��(�A�w�5�$�-����t�Q�q�T�1���A�q�>�D�A�q��=�)�6�1�a�-H�QT�U����F�A�q�)rc	��t|�ttfvr
|d|d}}t||�\}}t	|d|�d|�d|��d��tj|||�y)a�Performs an explicitly vertical scroll of the mouse scroll wheel,
    if this is supported by the operating system. (Currently just Linux.)

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      clicks (int, float): The amount of scrolling to perform.
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.

    Returns:
      None
    rr�vscrollr�r�r�N)r�r�r�rgr�r��_vscrollr�s     rr�r��r�rc	�l�t||�\}}t|d|�d|��d��td||dd||�y)a.Moves the mouse cursor to a point on the screen.

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): The x position on the screen where the
        click happens. None by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): The y position on the screen where the
        click happens. None by default.
      duration (float, optional): The amount of time it takes to move the mouse
        cursor to the xy coordinates. If 0, then the mouse cursor is moved
        instantaneously. 0.0 by default.
      tween (func, optional): The tweening function used if the duration is not
        0. A linear tween is used by default.

    Returns:
      None
    �moveTor�r�r�r�rN�ror�r�)r�r�r�r�r�rOs      rr�r��s;��2�A�q�!�D�A�q��=�(�q�!�,<�S�I��6�1�a��A�x��7rc	�l�t||�\}}t|d|�d|��d��tddd||||�y)aMoves the mouse cursor to a point on the screen, relative to its current
    position.

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): How far left (for negative values) or
        right (for positive values) to move the cursor. 0 by default. If tuple, this is used for x and y.
      y (int, float, None, optional): How far up (for negative values) or
        down (for positive values) to move the cursor. 0 by default.
      duration (float, optional): The amount of time it takes to move the mouse
        cursor to the new xy coordinates. If 0, then the mouse cursor is moved
        instantaneously. 0.0 by default.
      tween (func, optional): The tweening function used if the duration is not
        0. A linear tween is used by default.

    Returns:
      None
    �moveRelr�r�r�r�Nr�)�xOffset�yOffsetr�r�r�rOs      rr�r�s=��0(���9��G�W��=�)���-I�RU�V��6�4��w���5�Irc
��t||�\}}t|d|�d|��d��|rt|dd��td||dd|||�|rt	|dd��y	y	)
a�Performs a mouse drag (mouse movement while a button is held down) to a
    point on the screen.

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): How far left (for negative values) or
        right (for positive values) to move the cursor. 0 by default. If tuple, this is used for x and y.
        If x is a str, it's considered a filename of an image to find on
        the screen with locateOnScreen() and click the center of.
      y (int, float, None, optional): How far up (for negative values) or
        down (for positive values) to move the cursor. 0 by default.
      duration (float, optional): The amount of time it takes to move the mouse
        cursor to the new xy coordinates. If 0, then the mouse cursor is moved
        instantaneously. 0.0 by default.
      tween (func, optional): The tweening function used if the duration is not
        0. A linear tween is used by default.
      button (str, int, optional): The mouse button released. TODO
      mouseDownUp (True, False): When true, the mouseUp/Down actions are not performed.
        Which allows dragging over multiple (small) actions. 'True' by default.

    Returns:
      None
    �dragTor�r�r�F�r�r�rO�dragrN)ror�r�r�r�)r�r�r�r�r�r�rO�mouseDownUps        rr�r�,s`��>�A�q�!�D�A�q��=�(�q�!�,<�S�I����u�U�C��6�1�a��A�x���?���v�U�5�A�rc
�(�|�d}|�d}t|�ttfvr
|d|d}}|dk(r|dk(rytj�\}}	t|d|�d|��d��|rt
|dd�	�td
||	|||||�|rt|dd�	�yy)a'Performs a mouse drag (mouse movement while a button is held down) to a
    point on the screen, relative to its current position.

    The x and y parameters detail where the mouse event happens. If None, the
    current mouse position is used. If a float value, it is rounded down. If
    outside the boundaries of the screen, the event happens at edge of the
    screen.

    Args:
      x (int, float, None, tuple, optional): How far left (for negative values) or
        right (for positive values) to move the cursor. 0 by default. If tuple, this is used for xOffset and yOffset.
      y (int, float, None, optional): How far up (for negative values) or
        down (for positive values) to move the cursor. 0 by default.
      duration (float, optional): The amount of time it takes to move the mouse
        cursor to the new xy coordinates. If 0, then the mouse cursor is moved
        instantaneously. 0.0 by default.
      tween (func, optional): The tweening function used if the duration is not
        0. A linear tween is used by default.
      button (str, int, optional): The mouse button released. TODO
      mouseDownUp (True, False): When true, the mouseUp/Down actions are not performed.
        Which allows dragging over multiple (small) actions. 'True' by default.

    Returns:
      None
    Nrr�dragRelr�r�r�Fr�r�)	r�r�r�r�r�r�r�r�r�)
r�r�r�r�r�r�rOr��mousex�mouseys
          rr�r�Us���:���������G�}���
�%�"�1�:�w�q�z����!�|��1���#�-�-�/�N�F�F��=�)���-I�RU�V����u�U�C��6�6�6�7�G�X�u�f�U���v�U�5�A�rc
���|dvs
Jd|z��tjdk7rd}|�t|�nd}|�t|�nd}|�
|�|dk(r|dk(ryt�\}}	|�t|�n|}|�t|�n|	}||z
}||z
}t	�\}
}||fg}|t
kDrrt
|
|�}
||
z}|tkrt|tz�}
||
z}t|
�D�cgc]}t||	|||||
z����}}|j||f�|D]�\}}t|�dkDrtj�tt|��}tt|��}||ftvr
t!�|dk(rt#j$||���|dk(rt#j&|||���t)d	j+|���ftvrt!�yycc}w)
aHandles the actual move or drag event, since different platforms
    implement them differently.

    On Windows & Linux, a drag is a normal mouse move while a mouse button is
    held down. On OS X, a distinct "drag" event must be used instead.

    The code for moving and dragging the mouse is similar, so this function
    handles both. Users should call the moveTo() or dragTo() functions instead
    of calling _mouseMoveDrag().

    Args:
      moveOrDrag (str): Either 'move' or 'drag', for the type of action this is.
      x (int, float, None, optional): How far left (for negative values) or
        right (for positive values) to move the cursor. 0 by default.
      y (int, float, None, optional): How far up (for negative values) or
        down (for positive values) to move the cursor. 0 by default.
      xOffset (int, float, None, optional): How far left (for negative values) or
        right (for positive values) to move the cursor. 0 by default.
      yOffset (int, float, None, optional): How far up (for negative values) or
        down (for positive values) to move the cursor. 0 by default.
      duration (float, optional): The amount of time it takes to move the mouse
        cursor to the new xy coordinates. If 0, then the mouse cursor is moved
        instantaneously. 0.0 by default.
      tween (func, optional): The tweening function used if the duration is not
        0. A linear tween is used by default.
      button (str, int, optional): The mouse button released. TODO

    Returns:
      None
    )r�r�z.moveOrDrag must be in ('move', 'drag'), not %srEr�Nrrr�z Unknown value of moveOrDrag: {0})r�r�rargr��MINIMUM_DURATION�max�
MINIMUM_SLEEPr�rZr�rircr+�round�FAILSAFE_POINTSrPr��_moveTo�_dragTo�NotImplementedErrorrj)�
moveOrDragr�r�r�r�r�r�r��startx�startyr�r��steps�	num_steps�sleep_amountr��tweenX�tweenYs                  rr�r��s���D�)�)�j�+[�_i�+j�j�)�
�|�|�x���
�%�1�c�'�l�q�G�%�1�c�'�l�q�G��y�Q�Y�7�a�<�G�q�L���Z�N�F�F��-��A��V�A��-��A��V�A���L�A���L�A��F�M�E�6���V�H�E��"�"���v�&�	��)�+���-�'��H�}�4�5�I�#�i�/�L�UZ�[d�Ue�f�Ue�PQ�����1�e�A�	�M�6J�K�Ue��f�
���a��V�������u�:��>��J�J�|�$��U�6�]�#���U�6�]�#��

�F��?�2��O�����"�"�6�6�2�
�6�
!��"�"�6�6�6�:�%�&H�&O�&O�PZ�&[�\�\�' �*	����.���/��3gs�G$c�F�tjj|d�duS)aSReturns a Boolean value if the given key is a valid value to pass to
    PyAutoGUI's keyboard-related functions for the current platform.

    This function is here because passing an invalid value to the PyAutoGUI
    keyboard functions currently is a no-op that does not raise an exception.

    Some keys are only valid on some platforms. For example, while 'esc' is
    valid for the Escape key on all platforms, 'browserback' is only used on
    Windows operating systems.

    Args:
      key (str): The key value.

    Returns:
      bool: True if key is a valid value, False if not.
    N)r��keyboardMappingrR)�keys r�
isValidKeyr��s"��"�)�)�-�-�c�4�8��D�Drc��t|�dkDr|j�}t|d|d��tj|�y)awPerforms a keyboard key press without the release. This will put that
    key in a held down state.

    NOTE: For some reason, this does not seem to cause key repeats like would
    happen if a keyboard key was held down on a text field.

    Args:
      key (str): The key to be pressed down. The valid names are listed in
      KEYBOARD_KEYS.

    Returns:
      None
    r�keyDownr�r�N)rir�r�r��_keyDown�r�r�rOs   rr�r�s6���3�x�!�|��i�i�k���=�)�S��=����C� rc��t|�dkDr|j�}t|d|d��tj|�y)z�Performs a keyboard key release (without the press down beforehand).

    Args:
      key (str): The key to be released up. The valid names are listed in
      KEYBOARD_KEYS.

    Returns:
      None
    r�keyUpr�r�N)rir�r�r��_keyUpr�s   rrrs6���3�x�!�|��i�i�k���=�'�3�s�;����#�rc��t|�tk(r"t|�dkDr|j�}|g}nJg}|D]A}t|�dkDr |j	|j���1|j	|��C|}t|�}t
|ddj|�d��t|�D]R}|D]6}t�tj|�tj|��8tj|��Ty)abPerforms a keyboard key press down, followed by a release.

    Args:
      key (str, list): The key to be pressed. The valid names are listed in
      KEYBOARD_KEYS. Can also be a list of such strings.
      presses (integer, optional): The number of press repetitions.
      1 by default, for just one press.
      interval (float, optional): How many seconds between each press.
      0.0 by default, for no pause between presses.
      pause (float, optional): How many seconds in the end of function process.
      None by default, for no pause in the end of function process.
    Returns:
      None
    r�pressr�r�r�N)r�rhrir�r�rbr�r�r�rPr�r�rrcr+)	�keys�pressesr�r�rO�	lowerKeysr�r�r�s	         rrr-s��� �D�z�S���t�9�q�=��:�:�<�D��v���	��A��1�v��z�� � �����+�� � ��#�	�
���X��H��=�'�3�8�8�D�>�#�F�
�7�^���A��O��#�#�A�&��!�!�!�$��	
�
�
�8��rc#�<K�t|�tk(r"t|�dkDr|j�}|g}nJg}|D]A}t|�dkDr |j	|j���1|j	|��C|}t|ddj
|�d��|D]!}t�tj|��#	d��|D]!}t�tj|��#y#|D]!}t�tj|��#wxYw�w)a�Context manager that performs a keyboard key press down upon entry,
    followed by a release upon exit.

    Args:
      key (str, list): The key to be pressed. The valid names are listed in
      KEYBOARD_KEYS. Can also be a list of such strings.
      pause (float, optional): How many seconds in the end of function process.
      None by default, for no pause in the end of function process.
    Returns:
      None
    rrr�r�r�N)r�rhrir�r�r�r�rPr�r�r)rr�rOrr�r�s      r�holdr	Ss������D�z�S���t�9�q�=��:�:�<�D��v���	��A��1�v��z�� � �����+�� � ��#�	�
���=�'�3�8�8�D�>�#�F�
��������"��%�
��A��O��!�!�!�$����A��O��!�!�!�$��s�CD�C1�
'D�1(D�Dc���t|�}t|d|d��|D]L}t|�dkDr|j�}t	|d��tj|�t��Ny)a�Performs a keyboard key press down, followed by a release, for each of
    the characters in message.

    The message argument can also be list of strings, in which case any valid
    keyboard name can be used.

    Since this performs a sequence of keyboard presses and does not hold down
    keys, it cannot be used to perform keyboard shortcuts. Use the hotkey()
    function for that.

    Args:
      message (str, list): If a string, then the characters to be pressed. If a
        list, then the key names of the keys to press in order. The valid names
        are listed in KEYBOARD_KEYS.
      interval (float, optional): The number of seconds in between each press.
        0.0 by default, for no pause in between presses.

    Returns:
      None
    �writer�r�rFrdN)rbr�rir�rrcr+rP)�messager�r�rOr�s     r�	typewriter
ysV��,�X��H��=�'�7�3�?�
���q�6�A�:����	�A�
�a����
�
�8����rc�`�t|jdd��}t|�r4t|dt�r!t|dt
�st
|d�}t|jd�ddj|�d��|D]J}t|�d	kDr|j�}tj|�tj|��Lt|�D]J}t|�d	kDr|j�}tj|�tj|��Ly
)aPerforms key down presses on the arguments passed in order, then performs
    key releases in reverse order.

    The effect is that calling hotkey('ctrl', 'shift', 'c') would perform a
    "Ctrl-Shift-C" hotkey/keyboard shortcut press.

    Args:
      key(s) (str): The series of keys to press, in order. This can also be a
        list of key strings to press.
      interval (float, optional): The number of seconds in between each press.
        0.0 by default, for no pause in between presses.

    Returns:
      None
    r�r\rr��hotkeyr�r�r�rN)rbrRrir_rrhr�r�r�r�r�r�rcr+�reversedr)rHrIr�r�s    rrr�s���"�V�Z�Z�
�C�0�1�H�
�4�y�Z��Q���2�:�d�1�g�s�;S��T�!�W�~���6�:�:�o�.��#�(�(�4�.�QT�U�
���q�6�A�:����	�A�����"��
�
�8��	�
�d�^���q�6�A�:����	�A����a� ��
�
�8��	rc�Z�tr%tt��tvrt	d��yy)Nz�PyAutoGUI fail-safe triggered from mouse moving to a corner of the screen. To disable this fail-safe, set pyautogui.FAILSAFE to False. DISABLING FAIL-SAFE IS NOT RECOMMENDED.)�FAILSAFEr�rgr�rrrrrPrP�s-���E�(�*�%��8��
}�
�	
�9�xrc��	tjjjd�}td�|dk7s|dk7rtd|�d|���		t
�\}}dt||z
�jd�zd	zt||z
�jd�z}t||z
||z
�rtjd
k(rd}n%tj�j||f�}|dt|d�jd
�zz
}|dt|d�jd
�zz
}|dt|d�jd
�zdzz
}tjj|�|s,tjjdt!|�z�n4tjjd�t#j$d�tjj'����#t$rd}Y���wxYw#t($r@tjjd�tjj'�YywxYw)z�This function is meant to be run from the command line. It will
    automatically display the location and RGB of the mouse cursor.�idlelibFzPress Ctrl-C to quit.rz	xOffset: z
 yOffset: zX: rfz Y: rE)�NaNrrz RGB: (rz, rrr��r{N)r��stdinr�
startswith�AttributeErrorrrgrhrxr�r�rGrT�getpixel�stdoutrrircr+�flush�KeyboardInterrupt)r�r��runningIDLEr�r��positionStr�
pixelColors       r�displayMousePositionr!�s�����i�i�*�*�5�5�i�@��
�
!�"��!�|�w�!�|�
�7�G�<�=����:�D�A�q��#�a�'�k�"2�"8�"8��";�;�f�D�s�1�w�;�GW�G]�G]�^_�G`�`�K��A��K��W��5�����9Q�2�
�&�1�1�3�<�<���F��
�
�9�s�:�a�=�'9�'?�'?��'B�B�B�K��4�#�j��m�"4�":�":�1�"=�=�=�K��4�#�j��m�"4�":�":�1�"=�=��C�C�K��J�J���[�)���
�
� � ���K�(8�!8�9��
�
� � ��&��
�
�1�
��J�J����-��������<���
�
������
�
�����s%�)G;�F)H
�;H
�	H
�
AI�Ic�N�|�
|�td��|�tj�\}}|�tj�}t
j
j
�}|j�dt|j�jdd��dt|j�jdd��d|j�d|j�d|j�dt|j�dd�d|�d�}tj j#||�}t%|�y)NzVEither region or radius arguments (or neither) can be passed to snapshot, but not bothr�rr�r�rrr)�	Exceptionr�r�r~�getcwdrtrurvrhrwrxryrzr{r|r}rr�rT)	�tagr��region�radiusr�r�rur�r�s	         r�	_snapshotr(�s���
��f�0��p�q�q�
���'�'�)���1�
�~������
�
�
�
�
�
!�C�����C�I�I����Q��$��C�G�G����1�c�"�����
�
��
�
��C�O�O��R�a� ��	�H��w�w�|�|�F�H�-�H��x�rc�.�tj|�yrF)rcr+)�secondss rr+r+
s���J�J�w�rc��t|dd�D].}tt|�dd��tjd��0t�y)Nr���r}T)r�rr)r�rrhrcr+)r*r�s  r�	countdownr-s7��
�7�A�r�
"��
�c�!�f�#�T�*��
�
�1�
�#�
�Grc��tjd�}|j|�}|�td��|j	d�S)aGets the number token at the start of commandStr.

    Given '5hello' returns '5'
    Given '  5hello' returns '  5'
    Given '-42hello' returns '-42'
    Given '+42hello' returns '+42'
    Given '3.14hello' returns '3.14'

    Raises an exception if it can't tokenize a number.
    z^(\s*(\+|\-)?\d+(\.\d+)?)z1Invalid command at index 0: a number was expectedr��re�compile�searchr�group��
commandStr�pattern�mos   r�_getNumberTokenr8s@���j�j�5�6�G�	���
�	#�B�	�z� �!T�U�U�
�8�8�A�;�rc��tjd�}|j|�}|�td��|j	d�S)aGets the quoted string token at the start of commandStr.
    The quoted string must use single quotes.

    Given "'hello'world" returns "'hello'"
    Given "  'hello'world" returns "  'hello'"

    Raises an exception if it can't tokenize a quoted string.
    z^((\s*)('(.*?)'))z8Invalid command at index 0: a quoted string was expectedrr/r4s   r�_getQuotedStringTokenr:+s@���j�j�-�.�G�	���
�	#�B�	�z� �![�\�\�
�8�8�A�;�rc�J�tjd�}|j|�}|�td��d}d}|t	|�krJ||dk(r|dz
}n(||dk(r |dz}|dk(r|dz
}n$|dk(rtd��|dz
}|t	|�kr�J|dkDrtd	��|d|S)
a0Gets the command string token at the start of commandStr. It will also
    be enclosed with parentheses.

    Given "(ccc)world" returns "(ccc)"
    Given "  (ccc)world" returns "  (ccc)"
    Given "(ccf10(r))world" returns "(ccf10(r))"

    Raises an exception if it can't tokenize a quoted string.
    z^\s*\(z6Invalid command at index 0: No open parenthesis found.rr�rr�r,zKInvalid command at index 0: No open parenthesis for this close parenthesis.z9Invalid command at index 0: Not enough close parentheses.)r0r1r2rri)r5r6r7r��openParensCounts     r�_getParensCommandStrTokenr=<s����j�j��#�G�	���
�	#�B�	�z� �!Y�Z�Z�	
�A��O�
�c�*�o�
��a�=�C���q� �O�
��]�c�
!��q� �O��!�#��Q���� �B�&�(�)v�w�w�	�Q����c�*�o�
���� �!\�]�]��a��?�rc��tjd�}|j|�}|�td��|j	d�S)z�Gets the comma token at the start of commandStr.

    Given ',' returns ','
    Given '  ,', returns '  ,'

    Raises an exception if a comma isn't found.
    z	^((\s*),)z0Invalid command at index 0: a comma was expectedrr/r4s   r�_getCommaTokenr?as?���j�j��&�G�	���
�	#�B�	�z� �!S�T�T�
�8�8�A�;�rc���tjd�}g}d}|t|�k�r�||dvr|dz
}�|j||d�}|�t	d|�d||�d���|jd�}|j
|�|t|�z
}|d	vr�na|d
v�rM	t||d�}|t|�z
}t||d�}|t|�z
}t||d�}|t|�z
}|j�dj�r;|j�dj�st	d|t|�z
z��|j�dj�s;|j�dj�rt	d
|t|�z
z��|j
|j��|j
|j���n|dvr=	t||d�}|t|�z
}|j
|j��n�|dvr@	t||d�}|t|�z
}|j
|ddj��n�|dk(r�	t||d�}|t|�z
}t||d�}|t|�z
}|j
|j��|j�dd}|j
t!|��|t|�kr���|S#t$rP}	t|	�jd�\}
}}|
td�d}
t|
�|z}t	d|�d|����d}	~	wwxYw#t$rP}	t|	�jd�\}
}}|
td�d}
t|
�|z}t	d|�d|����d}	~	wwxYw#t$rP}	t|	�jd�\}
}}|
td�d}
t|
�|z}t	d|�d|����d}	~	wwxYw#t$rP}	t|	�jd�\}
}}|
td�d}
t|
�|z}t	d|�d|����d}	~	wwxYw)znTokenizes commandStr into a list of commands and their arguments for
    the run() function. Returns the list.z%^(su|sd|ss|c|l|m|r|g|d|k|w|h|f|s|a|p)r)r}rzr{r|rNzInvalid command at index z: z is not a valid command)r�r�r�r��su�sd�ss)r�r�r�z8Invalid command at index %s: Y has a +/- but X does not.z>Invalid command at index %s: Y does not have a +/- but X does.)r�r�)r�r�r�r�r,r�)r0r1ri�matchrr3r�r8r?rh�	partitionra�lstrip�	isdecimalr:r=�_tokenizeCommandStr)r5�commandPattern�commandListr�r7�individualCommandr��commar��excObj�	indexPart�colonr�indexNum�newIndexNum�num�quotedString�
numberOfLoops�
subCommandStrs                   rrHrHqs����Z�Z� H�I�N��K�	�A�
�c�*�o�
��a�=�3�3�
��F�A��
�
!�
!�*�Q�R�.�
1��
�:�$�ab�dn�op�dq�%r�s�s��H�H�Q�K�����,�-�	�S�"�
#�#��� F�F���*�
,�
d�#�J�q�r�N�3���S��V���&�z�!�"�~�6���S��Z���#�J�q�r�N�3���S��V����x�x�z�!�}�&�&�(�����A��1H�1H�1J�(�)c�gh�kn�op�kq�gq�)r�s�s��8�8�:�a�=�*�*�,�����A��1H�1H�1J�(�T�XY�\_�`a�\b�Xb�c���

���q�x�x�z�*����q�x�x�z�*��*�
,�

d�%�j���n�5���S��X�
��
���s�z�z�|�,��"6�
6�

d�4�Z���^�D���S��&�&��
���|�A�b�1�8�8�:�;��#�
%�
d� /�
�1�2�� ?�
��S��'�'�� 9�*�Q�R�.� I�
��S��'�'��
���}�3�3�5�6�*�0�0�2�1�R�8�M����2�=�A�B�a�c�*�o�
�d���i&�
d�-0��K�,A�,A�#�,F�)�	�5�'�$�S�)D�%E�%G�H��!�(�m�a�/��(�[�Za�)b�c�c��
d��:&�
d�-0��K�,A�,A�#�,F�)�	�5�'�$�S�)D�%E�%G�H��!�(�m�a�/��(�[�Za�)b�c�c��
d��"&�
d�-0��K�,A�,A�#�,F�)�	�5�'�$�S�)D�%E�%G�H��!�(�m�a�/��(�[�Za�)b�c�c��
d��*&�
d�-0��K�,A�,A�#�,F�)�	�5�'�$�S�)D�%E�%G�H��!�(�m�a�/��(�[�Za�)b�c�c��
d�se�AL
�.M&�/O�48P�
	M#�AM�M#�&	N?�/AN:�:N?�	P�AP�P�	Q7�'AQ2�2Q7c��d}|t|�k�r�||}|dk(rtt���n�|dk(rtt���nv|dk(rtt���n_|dk(rtt
���nH|dk(r
t
d��n6|d	k(r
t
d
��n$|dk(r td|dz�|dxxdz
cc<�n�|d
k(r!tt||dz��|dz
}�n�|dk(rt||dz�a
|dz
}�n�|dk(rv||dzddvr8||dzddvr+tt||dz�t||dz��n*tt||dz�t||dz��|dz
}�nA|dk(ru||dzddvr8||dzddvr+tt||dz�t||dz��n*tt||dz�t||dz��|dz
}n�|dk(rt!||dz�|dz
}n�|dk(rt#||dz�|dz
}n�|dk(r3t%||dzj'dd�j)d��|dz
}nW|dk(rt+||dz�|dz
}n;|dk(r6t-t||dz��D]}t/||dz|��|dz
}|dz
}|t|�kr���yy)Nrr�)r�r�r�r�rArrBr,rCzscreenshot%s.pngr�r�r�)r�r�rr�r�r�r�r}�r�r�r�)rir�r�r�r�r�r�rTr+rbr`r�rar�r�r�rrr�replace�splitr>r��_runCommandList)rJ�_ssCountr�r8r�s     rrZrZ�s���	�A�
�c�+��
��a�.���c�>���!�
��^����
��^��� �
��^����
��_��1�I�
��_��2�J�
��_��)�X�a�[�9�:��Q�K�1��K�
��^��%��A��E�*�+�,�
��F�A�
��^��+�a�!�e�,�-�E�
��F�A�
��^��1�q�5�!�!�$�
�2�{�1�q�5�7I�!�7L�PZ�7Z��S��Q��U�+�,�c�+�a�!�e�2D�.E�F��s�;�q�1�u�-�.��K��A��4F�0G�H�
��F�A�
��^��1�q�5�!�!�$�
�2�{�1�q�5�7I�!�7L�PZ�7Z��S��Q��U�+�,�c�+�a�!�e�2D�.E�F��s�;�q�1�u�-�.��K��A��4F�0G�H�
��F�A�
��^��+�a�!�e�$�%�
��F�A�
��^��+�a�!�e�$�%�
��F�A�
��^��K��A��&�.�.�s�B�7�=�=�c�B�C�
��F�A�
��^��+�a�!�e�$�%�
��F�A�
��^��3�{�1�q�5�1�2�3����A��E� 2�H�=�4�
��F�A�	�Q���i�c�+��
rc�L�|�dg}t|�}t}t||�|ay)a�Run a series of PyAutoGUI function calls according to a mini-language
    made for this function. The `commandStr` is composed of character
    commands that represent PyAutoGUI function calls.

    For example, `run('ccg-20,+0c')` clicks the mouse twice, then makes
    the mouse cursor go 20 pixels to the left, then click again.

    Whitespace between commands and arguments is ignored. Command characters
    must be lowercase. Quotes must be single quotes.

    For example, the previous call could also be written as `run('c c g -20, +0 c')`.

    The character commands and their equivalents are here:

    `c` => `click(button=PRIMARY)`
    `l` => `click(button=LEFT)`
    `m` => `click(button=MIDDLE)`
    `r` => `click(button=RIGHT)`
    `su` => `scroll(1) # scroll up`
    `sd` => `scroll(-1) # scroll down`
    `ss` => `screenshot('screenshot1.png') # filename number increases on its own`

    `gX,Y` => `moveTo(X, Y)`
    `g+X,-Y` => `move(X, Y) # The + or - prefix is the difference between move() and moveTo()`
    `dX,Y` => `dragTo(X, Y)`
    `d+X,-Y` => `drag(X, Y) # The + or - prefix is the difference between drag() and dragTo()`

    `k'key'` => `press('key')`
    `w'text'` => `write('text')`
    `h'key,key,key'` => `hotkey(*'key,key,key'.replace(' ', '').split(','))`
    `a'hello'` => `alert('hello')`

    `sN` => `sleep(N) # N can be an int or float`
    `pN` => `PAUSE = N # N can be an int or float`

    `fN(commands)` => for i in range(N): run(commands)

    Note that any changes to `PAUSE` with the `p` command will be undone when
    this function returns. The original `PAUSE` setting will be reset.

    TODO - This function is under development.
    Nr)rHr`rZ)r5r[rJ�
originalPAUSEs    r�runr^)s7��`��
�
��&�j�1�K��M��K��*��Erc�N�djt��}|st|�|S)Nz�
         Platform: {}
   Python Version: {}
PyAutoGUI Version: {}
       Executable: {}
       Resolution: {}
        Timestamp: {})rj�getInfor)�	dontPrint�msgs  r�	printInforcfs0�� �� ��	���C��
�c�
��Jrc��tjtjttjt�tjj�fSrF)r�r��version�__version__�
executabler�rtrurrrr`r`us2���L�L�#�+�+�{�C�N�N�D�F�H�L]�L]�La�La�Lc�d�drrF)r�)NN)NNNT)NT)rr\NT)r\NT)NNN)F)��
__future__rrrrf�collectionsr�rcrtr~r�r0rM�
contextlibrr#rrr�version_infor�collections.abc�
pytweeningrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7�ImportErrorr=�pymsgboxr>r?r@rArCrPrGrQrRrSrTrVr
rYr[r]r_rbrergriro�pygetwindowrqrrrsrtrurvrwry�	KEY_NAMES�
KEYBOARD_KEYSr�r�r�r�r��QWERTY�QWERTZrCrr�rWrFr�rGr�rIr�r�r`�DARWIN_CATCH_UP_TIMErr�rsr�r��
namedtuplerKrLrTrZr]rQror�rgr��
resolutionr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr	r
rr�shortcutrPr!r(r+r-r8r:r=r?rHrZr^rcr`�_right�_bottom�extendrrr�<module>r|s3��A�@����
���	��	��%�	��	�	�*�	��/�����A��!��s�/�/��!�4�8H�H�$�)�M0���������^
B�9�9��"?*��F�F�*�1�*�1��%�%�-�-�F�N�)�4�*�4�"�+�+�3�3�I��)�<�*�<�!*� ;� ;� C� C���)�?�*�?�$-�#A�#A�#I�#I�� �)�9�*�9�'�5�5�=�=�N��)�9�*�9�'�5�5�=�=�N��6
��$�&i�"�<�<�7��2�	
�	
�	
�8C
�	�H�
���	����
���	�

o��	n��L��<�<���6�"�
�I�
J�J��\�\�X��2��\�\�W��2��X�_�_��'�!�2�
�Q�Ud�U]�Ud�Ud�Uf�g�
h�h����
�	��
��
���(������ ������w��.���{���f�n�5��
�(	�
��=4�@+1�\�2)��
�.�4�6t�r���W�s�&�X\�ei�,��,�@��d�7�S��VZ�cg�*��*�@�
�d�1�s�7�S�PV�fj�sw�6!��6!�r���s�S��VZ�cg�R��R�:����c��W[�dh�S��S�6��$��s�&�X\�ei�T��T�0��$��T�C�v�ei�rv�'W��'W�T��$��T�C�v�ei�rv�&W��&W�R�)��)�:�*��*�6�*��*�6�
�T�C�v�U�SW�8��8�<��$��F�RW�`d�J��J�:���
�d�S��w�d�[_�mq�%B��%B�P�
�q�3�f�W�TX�ae�sw�-B��-B�`��HN�VZ�a�PE�(�!��!�*����"�"��"�J��!%���!%�H����@	��� �� �F��
�%�P�4���&�""�J
� {�|7�t:�z�e�
�&��������G�a�K�(�6�A�:�q�/�F�Q�J��RS��;T�U�V��i@�(0�
�+�J�+�K�-�M�+�K�,�L�.�N�+�K�,�L�.�N�+�K�,�L�.�N�*�J�+�K�-�M�*�J�+�K�-�M�*�J�+�K�-�M�-�M�.�N�0��*�J�+�K�-�M�,�L�-�M�/�O�Q(0��Z�B�
�+B�A�E�A�G�A�f�x�B��R�*�
�&�F�
%�F�(�I�0��3��-�N�-�N�$�E�0��)�J�+*��D�	
�
�	
��P�2�	�,��4��9��1��8��2�
�1��#2�s]�AQ(�R3�C"S
�9S-�S<�(AR0�/R0�3S�S�
S*�)S*�-S9�8S9�<T�T

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists