
    %j                     :    d dl mZmZmZ ddlmZ  G d de      Zy)    )OptionalTupleUnion   )	Directionc                   J    e Zd Zd Z	 	 ddeeef   dedee	e
e
e
e
f      fdZy)SwipeExtc                     || _         y)u=   
        Args：
            d (uiautomator2.Device)
        N)_d)selfds     V/var/www/oz-panel.ru/ozpay-pub/venv/lib/python3.12/site-packages/uiautomator2/swipe.py__init__zSwipeExt.__init__	   s    
     N	directionscaleboxc                 V     fd}|r|\  }}}}	n"d\  }} j                   j                         \  }}	||z
  |	|z
  }}
t        |
d|z
  z        dz  }t        |d|z
  z        dz  }||
dz  z   ||dz  z   f}||z   ||dz  z   f}||
dz  z   ||z   f}||z
  ||dz  z   f}||
dz  z   |	|z
  f}|t        j                  k(  r
 |||       y|t        j
                  k(  r
 |||       y|t        j                  k(  r
 |||       y|t        j                  k(  r
 |||       yt        d|      )a1  
        Args:
            direction (str): one of "left", "right", "up", "bottom" or Direction.LEFT
            scale (float): percent of swipe, range (0, 1.0]
            box (tuple): None or [lx, ly, rx, ry]
            kwargs: used as kwargs in d.swipe

        Raises:
            ValueError
        c                 ^     j                   j                  | d   | d   |d   |d   fi  y )Nr   r   )r   swipe)_from_tokwargsr   s     r   _swipez!SwipeExt.__call__.<locals>._swipe   s0    DGGMM%(E!Hc!fc!fGGr   )r   r   r      zUnknown direction:N)	r   window_sizeintr   LEFTRIGHTUPDOWN
ValueError)r   r   r   r   r   r   lxlyrxrywidthheighth_offsetv_offsetcenterleftuprightbottoms   `   `              r   __call__zSwipeExt.__call__   sU   	H  NBBFBWW((*FBRbvuE	*+q0vU+,1eQhVQY.H}b6Q;..%1*_b8m+XrFaK//eqj"x-/	&5$)//)4),,&62)..(66"19==r   )g?N)__name__
__module____qualname__r   r   r   strfloatr   r   r   r0    r   r   r	   r	      sJ     !$<@,>!)S.1,>,> uS#sC%789,>r   r	   N)typingr   r   r   _protor   objectr	   r6   r   r   <module>r:      s    * ) 4>v 4>r   