+
     i'  c                  s   ^ RI Ht ^ RIHt ^ RIHtHt ^RIHtH	t	  ^RIH
t
 RtRR	R
RRR/tR R lt ! R R]	P                  4      tR R ltR R ltR R lt]P&                  ! ]P(                  ]]4       ]'       dw   ]P*                  ! ]P(                  ]4       ]P,                  ! ]P(                  ]4       ]P.                  ! ]P(                  R4       ]P0                  ! ]P(                  R4       R# R#   ] d    Rt Li ; i)    )annotations)BytesIO)IOAny)Image	ImageFile)_webpTFs   VP8 RGBs   VP8XRGBAs   VP8Lc                    V ^8  d   QhRRRR/# )   prefixZbytesreturnz
bool | str format   ":/usr/lib64/python3.14/site-packages/PIL/WebPImagePlugin.py__annotate__r      s      E j     c                s    V P                  R 4      pV R,          R8H  pV R,          \        9   pV'       d"   V'       d   V'       d   \        '       g    R# R# R# )s   RIFF:i      Ns   WEBP:r   i   NzEimage file could not be identified because WEBP support not installedTF)
startswith_VP8_MODES_BY_IDENTIFIER	SUPPORTED)r   Zis_riff_file_formatZis_webp_fileZis_valid_vp8_modes   &   r   _acceptr      sN     ++G4$<7*Lu)AA|0AyW r   c                  s   a  ] tR t^%tRtRt^ t^ tR R ltR R lt	R R lt
RR	 R
 lltR R ltR R ltR V 3R lltR R ltR R ltRtV ;t# )WebPImageFileZWEBPz
WebP imagec                   V ^8  d   QhRR/# )r   r   Noner   r   r   r   r   WebPImageFile.__annotate__+   s      !  !t  !r   c                	s   \         P                  ! V P                  P                  4       4      V n        V P                  P                  4       w  V n        rr4WP                  R &   V^,	          ^,          V^,	          ^,          V^,	          ^,          V^,          3w  rVrxWgW3V P                  R&   W0n        V P                  ^8  V n	        VR8X  d   RMTV n
        W@n        V P                  P                  R4      p	V P                  P                  R4      p
V P                  P                  R4      pV	'       d   WP                  R&   V
'       d   WP                  R&   V'       d   WP                  R	&   V P                  R
R7       R# )loop
backgroundRGBXr   ZICCPZEXIFzXMP icc_profileexifxmpF)resetN)r   ZWebPAnimDecoderfpZread_decoderZget_info_sizeinfon_framesis_animated_moderawmodeZ	get_chunk_reset)selfZ
loop_countZbgcolorZframe_countmodebg_abg_rbg_gbg_br!   r"   r#   s   &           r   _openZWebPImageFile._open+   s;    --dgglln= >B]]=S=S=U:
J&		&]d"]d"\T!dN	"
D $(t":		,#==1,"fnU$
 mm--f5}}&&v.mm%%f-'2IIm$ $IIf"IIe 	% r   c               r   )r   r   zdict[int, Any] | Noner   r   r   r   r   r   M   s     1 1/ 1r   c                	sd    R V P                   9  d   R# V P                  4       P                  4       # )r"   N)r(   ZgetexifZ_get_merged_dictr.      &r   _getexifZWebPImageFile._getexifM   s&    "||~..00r   c               r
   r   frameintr   r   r   r   r   r   r   r   R   s     % %# %$ %r   c                	sD    V P                  V4      '       g   R # Wn        R # N)Z_seek_check_WebPImageFile__logical_framer.   r9      &&r   seekZWebPImageFile.seekR   s    &&  %r   c               r
   )r   r$   Zboolr   r   r   r   r   r   r   r   Y   s      D D r   c                	st    V'       d   V P                   P                  4        ^ V n        RV n        ^ V n        R# )r    Ni)r&   r$   _WebPImageFile__physical_frame_WebPImageFile__loaded_WebPImageFile__timestamp)r.   r$   r>   r   r-   ZWebPImageFile._resetY   s,    MM! !r   c               r   )r   r   ztuple[bytes, int, int]r   r   r   r   r   r   `   s     ) )1 )r   c                	s   V P                   P                  4       pV ;P                  ^,          un        Vf/   V P                  4        V P	                  ^ 4       Rp\        V4      hVw  r4W@P                  ,
          pW@n        WE,          pW4V3# )i   z(failed to decode next frame in WebP file)r&   Zget_nextr@   r-   r?   ZEOFErrorrB   )r.   Zretmsgdata	timestampdurations   &     r   	_get_nextZWebPImageFile._get_next`   s    mm$$&" ;KKMIIaL<C3- ///$ 		((r   c               r
   r8   r   r   r   r   r   r   u   s      3 4 r   c                	s    V P                   V8X  d   R # WP                   8  d   V P                  4        V P                   V8  d   V P                  4        K#  R # r;   )r@   r-   rG   r=   r>   r   _seekZWebPImageFile._seeku   sE      E)(((KKM##e+NN ,r   c               r   )r   r   zImage.core.PixelAccess | Noner   r   r   r   r   r   }   s      3 r   c                	s  < V P                   V P                  8w  d   V P                  V P                  4       V P                  4       w  rpW P                  R &   W0P                  R&   V P                  V n         V P
                  '       d-   V P                  '       d   V P
                  P                  4        \        V4      V n        \        P                  ! RRV P                  ,           ^ V P                  4      .V n        \        SV `=  4       # )rE   rF   Zraw)r    r    )rA   r<   rH   rG   r(   r%   Z_exclusive_fpZcloser   r   Z_Tilesizer,   tileZsuperload)r.   rD   rE   rF   	__class__s   &   r   rK   ZWebPImageFile.load}   s    ==D000JJt++, )-(8%DX%.IIk"$,IIj! 00DM www4---dmDG"0BAt||TUDIw|~r   c               r
   )r   posr:   r   r   r   r   r   r   r   r      s      S T r   c                	s    R # r;   r   )r.   rM   r>   r   	load_seekZWebPImageFile.load_seek   s    r   c               r   )r   r   r:   r   r   r   r   r   r      s     $ $c $r   c                	s    V P                   # r;   )r<   r5   r6   r   tellZWebPImageFile.tell   s    ###r   )Z__loadedZ__logical_frameZ__physical_frameZ__timestampr&   r+   r'   r%   r*   r)   r,   rJ   )T)Z__name__Z
__module__Z__qualname__Z__firstlineno__r   Zformat_descriptionrA   r<   r4   r7   r?   r-   rG   rH   rK   rN   rO   Z__static_attributes__Z__classcell__)rL   s   @r   r   r   %   sP    F%HO !D1
%)* $$ $r   r   c               s     V ^8  d   QhRRRR/# )r   imImage.Imager   r   r   r   r   r   r      s      { { r   c                sr    V P                   R9  d&   T P                  V P                  '       d   RMR4      p V # )r    r	   r   )r    r	   r   )r/   ZconvertZhas_transparency_data)rP   r6   r   _convert_framerR      s/    	ww--ZZ"":":":FIr   c               (    V ^8  d   QhRRRRRRRR/# 	r   rP   rQ   r%   z	IO[bytes]filenamezstr | bytesr   r   r   r   r   r   r   r      s.     y y+ y9 y y yr   c           
     s
   V P                   P                  4       p\        VP                  R . 4      4      p^ pV .V,            F  pV\	        VR^4      ,          pK  	  V^8X  d   \        WV4       R# RpRV9   d   VR,          pMyRV P                  9   di   V P                  R,          p\        V\        4      '       d@   V P                  4       pV'       d#   W^,          V^,           ^,           w  rpWV^3pMWwV^3pV P                   P                  RV P                  P                  R^ 4      4      pV P                   P                  R^ 4      pV P                   P                  RR4      pV P                   P                  RR4      pV P                   P                  R	R4      pV P                   P                  R
R4      pRpV P                   P                  RR4      pV P                   P                  R^P4      pV P                   P                  R^d4      pV P                   P                  R^ 4      pV P                   P                  R4      ;'       g    RpV P                   P                  RR4      p\        V\        P                  4      '       d   VP                  4       pV P                   P                  RR4      pV'       d   RpVf   V'       d   ^	M^pVf   V'       d   ^M^p\        V\        \        34      '       dK   \        V4      ^8w  g;   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   RV 2p\!        V4      hVw  ppppV^,          V^,          ,          V^,          ,          V^ ,          ,          p\"        P$                  ! V P&                  VVVVVVV4      p^ p ^ p!V P)                  4       p" V .V,            F  p\	        VR^4      p#\+        V#4       F  p$VP-                  V$4       \/        V4      p%VP1                  V%P3                  4       \5        V!4      VVVV4       \        V\        \        34      '       d   V!VV ,          ,          p!M	V!V,          p!V ^,          p K  	  K  	  V P-                  V"4       VP1                  R\5        V!4      VVV^ 4       VP7                  VVV4      p&V&f   Rp\!        V4      hVP9                  V&4       R#   T P-                  T"4       i ; i)append_imagesr)   Nr   rF   r   minimize_sizeFkminkmaxallow_mixedlosslessqualityalpha_qualitymethodr!    r"   r#   c              3  sN   "   T F  p^ Tu;8*  ;'       d    R8  Mu x  K  	  R# 5i)r    i   Nr   )Z.0Zvs   & r   Z	<genexpr>Z_save_all.<locals>.<genexpr>   s     4A1<<C<<s   %%Tz:Background color is not an RGBA tuple clamped to (0-255): 1cannot write file as WebP (encoder returned None))r    r    r    r    )encoderinfoZcopyZlistgetZgetattr_saver(   
isinstancer:   Z
getpaletter   ExiftobytesZtupleZlenZallOSErrorr   ZWebPAnimEncoderrI   rO   Zranger?   rR   ZaddgetimZroundZassemblewrite)'rP   r%   rU   ra   rV   ZtotalZimsr   ZpaletteZrZgZbrF   r   rW   rX   rY   rZ   Zverboser[   r\   r]   r^   r!   r"   r#   rC   r1   r2   r3   r0   ZencZ	frame_idxrE   Zcur_idxZnfrZidxr9   rD   s'   &&&                                    r   	_save_allrj      sL   ..%%'K"=>M Etm##j!,, $zbh(4J{" .
		 WW\*
j#&& mmoG!q.JNa3GHaAs^
(j#F
~~!!*bggkk*a.HIH>>fa(DNN&&>M>>fd+D>>fd+D..$$]E:KG~~!!*e4Hnn  B/GNN&&<M^^!,F..$$]399rK>>fb)D$

##||~
..

UB
'C |q!|r1 zD%=11z?as44sss4444J:,Wcl (D$d"*,	:daiHJ 


	C IIggiG4-''C#z1-CSz&s+ KKM)$! hu66)!44I)IQ	) "	 (6 	 GGD%	"Hg}aH <<T3/D|AclHHTN 	s   B8S4 4Tc               rS   rT   r   r   r   r   r   r     s(      k y K D r   c                s`   V P                   P                  R R4      pV P                   P                  R^P4      pV P                   P                  R^d4      pV P                   P                  R4      ;'       g    RpV P                   P                  RR4      p\        V\        P                  4      '       d   VP                  4       pVP                  R4      '       d
   VR	,          pV P                   P                  R
R4      pV P                   P                  R^4      p	V P                   P                  R4      '       d   ^M^ p
\        V 4      p \        P                  ! V P                  4       V\        V4      \        V4      VV	V
VV4	      pVf   Rp\        V4      hVP                  V4       R# )r[   Fr\   r]   r!   r_   r"   r   s   Exif  :i   NNr#   r^   exactNr`   )ra   rb   rd   r   re   rf   r   rR   r   Z
WebPEncoderh   Zfloatrg   ri   )rP   r%   rU   r[   r\   r]   r!   r"   r#   r^   rk   rD   rC   s   &&&          r   rc   rc     sV   ~~!!*e4Hnn  B/GNN&&<M..$$]399rK>>fc*D$

##||~''Bx
..

UB
'C^^!,F##G,,A!E		B

gm
D |AclHHTNr   z.webpz
image/webpN)Z
__future__r   Zior   Ztypingr   r   r_   r   r   r   r   ZImportErrorr   r   r   rR   rj   rc   Zregister_openr   Zregister_saveZregister_save_allZregister_extensionZregister_mimer   r   r   <module>rl      s    "   I UVV n$I'' n$byxD   M((- A	,,e4	M00)<	]117;	,,l;	 a	  Is   C9 9	DD