Ë
    Mf—iÍ  ã                  óZ   — d dl mZ ddlmZ dZerd dlmZ  G d„ d«      Z	 d
	 	 	 	 	 dd	„Zy)é    )Úannotationsé   )ÚImageF)ÚCallablec                  ó0   — e Zd ZdZdd„Zdd„Zd	d„Zd
d„Zy)ÚIteratora-  
    This class implements an iterator object that can be used to loop
    over an image sequence.

    You can use the ``[]`` operator to access elements by index. This operator
    will raise an :py:exc:`IndexError` if you try to access a nonexistent
    frame.

    :param im: An image object.
    c                ó|   — t        |d«      sd}t        |«      ‚|| _        t        | j                  dd«      | _        y )NÚseekzim must have seek methodÚ
_min_framer   )ÚhasattrÚAttributeErrorÚimÚgetattrÚposition)Úselfr   Úmsgs      ú</usr/local/lib/python3.12/dist-packages/PIL/ImageSequence.pyÚ__init__zIterator.__init__&   s7   € Ür˜6Ô"Ø,ˆCÜ  Ó%Ð%ØˆŒÜ §¡¨°qÓ9ˆó    c                ó   — 	 | j                   j                  |«       | j                   S # t        $ r}d}t        |«      |‚d }~ww xY w)Núend of sequence)r   r
   ÚEOFErrorÚ
IndexError)r   ÚixÚer   s       r   Ú__getitem__zIterator.__getitem__-   sA   € ð	)ØG‰GL‰L˜ÔØ—7‘7ˆNøÜò 	)Ø#ˆCÜ˜S“/ qÐ(ûð	)ús   ‚&) ©	A²A Á Ac                ó   — | S ©N© )r   s    r   Ú__iter__zIterator.__iter__5   s   € Øˆr   c                óÎ   — 	 | j                   j                  | j                  «       | xj                  dz  c_        | j                   S # t        $ r}d}t	        |«      |‚d }~ww xY w)Nr   r   )r   r
   r   r   ÚStopIteration)r   r   r   s      r   Ú__next__zIterator.__next__8   sT   € ð	,ØG‰GL‰L˜Ÿ™Ô'ØMŠM˜QÑMØ—7‘7ˆNøÜò 	,Ø#ˆCÜ Ó$¨!Ð+ûð	,ús   ‚AA Á	A$ÁAÁA$N)r   úImage.ImageÚreturnÚNone)r   Úintr%   r$   )r%   r   )r%   r$   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r    r#   r   r   r   r   r      s   „ ñ	ó:ó)óô,r   r   Nc                ó  — t        | t        «      s| g} g }| D ]M  }|j                  «       }|t        |«      D cg c]  }|j	                  «       ‘Œ c}z  }|j                  |«       ŒO |r|D  cg c]
  }  || «      ‘Œ c} S |S c c}w c c} w )a  
    Applies a given function to all frames in an image or a list of images.
    The frames are returned as a list of separate images.

    :param im: An image, or a list of images.
    :param func: The function to apply to all of the image frames.
    :returns: A list of images.
    )Ú
isinstanceÚlistÚtellr   Úcopyr
   )r   ÚfuncÚimsÚ
imSequenceÚcurrentÚim_frames         r   Ú
all_framesr6   B   sŠ   € ô bœ$ÔØˆTˆà
€CØò !ˆ
Ø—/‘/Ó#ˆà´¸Ó0DÖE H—‘•ÒEÑEˆà‰˜Õ ð!ñ (,˜sÖ#˜‰DHÒ#Ð4°Ð4ùò Fùò $s   ¹BÁ.Br   )r   zImage.Image | list[Image.Image]r1   z+Callable[[Image.Image], Image.Image] | Noner%   zlist[Image.Image])	Ú
__future__r   Ú r   ÚTYPE_CHECKINGÚcollections.abcr   r   r6   r   r   r   ú<module>r;      sG   ðõ" #å à€ÙÝ(÷%,ñ %,ðT 9=ð5Ø'ð5à
5ð5ð ô5r   