
    th[                         d dl Z ddlmZmZmZ ddlmZ ddlmZ	 ddlm
Z
 d Z G d d	ej                  Z ej        ej        ee            ej        ej        d
dg           dS )    N   )Image	ImageFileImagePalette)i16le)i32leo8c                 p    t          |           dk    o#t          | d          dv ot          | d          dv S )N      )  i     )r      )leni16)prefixs    f/var/www/html/mycamper/aliexpress-site/backend/venv/lib/python3.11/site-packages/PIL/FliImagePlugin.py_acceptr      s@    Fq 	&NN..	&OOv%    c                   8    e Zd ZdZdZdZd Zd Zd Zd Z	d Z
d	S )
FliImageFileFLIzAutodesk FLI/FLC AnimationFc                 4   | j                             d          }t          |          r|dd         dk    sd}t          |          t	          |d          | _        | j        dk    | _        d| _        t	          |d	          t	          |d
          f| _        t          |d          }t	          |d          }|dk    r|dz  dz  }|| j
        d<   d t          d          D             }| j                             d          }d| _        t	          |d          dk    r6| j        t          |          z   | _        | j                             d          }t	          |d          dk    rt	          |d          }d }t          |          D ]}|(| j                             |dz
  t          j                   | j                             d          }t	          |d          }	|	dv r |                     ||	dk    rdnd            nt          |          }|s nd |D             }t#          j        dd                    |                    | _        d| _        | j         | _        | j                                         | _        |                     d           d S )N         s     znot an FLI/FLC filer   r   P   
      r   r   i  F   durationc                     g | ]}|||fS  r%   ).0as     r   
<listcomp>z&FliImageFile._open.<locals>.<listcomp>F   s    111Aq!9111r      i   i  )r      r*      r   c                 t    g | ]5\  }}}t          |          t          |          z   t          |          z   6S r%   r	   )r&   rgbs       r   r(   z&FliImageFile._open.<locals>.<listcomp>a   s9    BBBYaA2a552a55=2a55(BBBr   RGBr   )fpreadr   SyntaxErrorr   n_framesis_animatedmode_sizei32inforange_FliImageFile__offsetseekosSEEK_CUR_paletter   rawjoinpalette_FliImageFile__frame_fptell_FliImageFile__rewind)
selfsmsgr#   magicrC   number_of_subchunks
chunk_size_
chunk_types
             r   _openzFliImageFile._open/   st   GLL

 	#qBx;66'Cc""" Aq		=1, 	AYYAr

*
 q"::Aq		F?? 4B.H (	* 21eCjj111GLLq!99 MCFF2DMR  Aq!99"%a))J.// 
 
)GLLa===GLLOO AYY
((MM'
b0@0@11aHHHE VV
! E CB'BBB#'sxx/@/@AA 7		!r   c                    d}t          t          | j                            d                              D ]}| j                            d          }||d         z   }|d         }|dk    rd}| j                            |dz            }t          dt	          |          d          D ]6}||         |z  }||dz            |z  }||dz            |z  }	|||	f||<   |dz  }7d S )Nr   r+   r   r)   r   )r;   r   r2   r3   r   )
rH   rC   shiftierI   nr-   r.   r/   s
             r   r@   zFliImageFile._palettej   s     s47<<??++,, 	 	AQAAaDA!AAvvQU##A1c!ffa((  aDEMa!eH%a!eH%AY
Q	 	r   c                     |                      |          sd S || j        k     r|                     d           t          | j        dz   |dz             D ]}|                     |           d S )Nr   r   )_seek_checkrD   _seekr;   )rH   framefs      r   r=   zFliImageFile.seek|   sx    && 	F4<JJqMMMt|a'33 	 	AJJqMMMM	 	r   c                    |dk    r.d| _         | j                            | j                   d| _        n|                                  || j         dz   k    rd| }t          |          || _         | j        | _        | j                            | j                   | j                            d          }|st          t          |          }|| _        dd| j        z   | j        d fg| _        | xj        |z  c_        d S )	Nr   r1   r   r   zcannot seek to frame r   fli)r   r   )rD   rE   r=   rG   r<   load
ValueErrorr2   r3   EOFErrorr9   decodermaxblocksizetile)rH   rY   rJ   rI   	framesizes        r   rX   zFliImageFile._seek   s    A::DLHMM$-(((DMM IIKKKDL1$$$1%11CS//! (T]###GLLOO 	NFF	(Vdi/EF	"r   c                     | j         S )N)rD   )rH   s    r   rF   zFliImageFile.tell   s
    |r   N)__name__
__module____qualname__formatformat_description!_close_exclusive_fp_after_loadingrP   r@   r=   rX   rF   r%   r   r   r   r   *   sq        F5(-%9 9 9v  $  # # #:    r   r   z.fliz.flc)r>    r   r   r   _binaryr   r   r   r9   r
   r   r   register_openrh   register_extensionsr%   r   r   <module>ro      s   $ 
			 , , , , , , , , , , ! ! ! ! ! ! ! ! ! ! ! !        y y y y y9& y y y~  L'w ? ? ?  ,-/? @ @ @ @ @r   