+
    Qi	                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
Ht ^ RIHtHtHt ^RIHtHtHtHtHt ^RIHt ^RIHt ^R	IHt ^R
IHt ^RIHt ^RI H!t! ^RI"H#t# Rt$]$'       d   ^ RI%H&t& ^ RIH't'H(t( ^RIH)t) ]PT                  ! ]+4      t,]PZ                  ! R4      P\                  t/Rt0RORPRQRRRSRTRURVRWRXRYRZR[R\R]R^R_R`RaRbRcRdReRfRgRhRiRjRkRl/t1]PZ                  ! R!4      t2]Pf                  t4 ^@]4,          t5  ! R" R#]	4      t6 ! R$ R%]	4      t7R& R' lt8RmR( R) llt9 ! R* R+4      t: ! R, R-];4      t< ! R. R/4      t= ! R0 R1]4      t> ! R2 R3]:4      t?R4 R5 lt@ ! R6 R7]P&                  4      tARRnR8RoRRpRRqRRrRRsR9RtRRtRRtRRuRRvRRwRRxRRyR Rz/tBR: R; ltC ! R< R=4      tD ! R> R?4      tER@ RA ltF ! RB RC]4      tGRD RE ltHRF RG ltI]CR3RH RI lltJRJ RK ltK]P                  ! ]AP                  ]A]@4       ]P                  ! ]AP                  ]J4       ]P                  ! ]AP                  ]I4       ]P                  ! ]AP                  RLRM.4       ]P                  ! ]AP                  RN4       R# ){    )annotationsN)IntEnum)Fraction)IO
NamedTuplecast)Image
ImageChops	ImageFileImagePaletteImageSequence)i16be)i32be)o8)o16be)o32be)	deprecate)DeferredErrorF)Callable)AnyNoReturn)_imagings   \w\w\w\ws   PNG

1LL;2L;4I;16I;16BRGBPP;1P;2P;4LARGBAs   ^* *$c                  &    ] tR t^nt^ t ^t ^tRtR# )Disposal N)__name__
__module____qualname____firstlineno__OP_NONEOP_BACKGROUNDOP_PREVIOUS__static_attributes__r(       X/Users/mibo/.openclaw/workspace/.venv/lib/python3.14/site-packages/PIL/PngImagePlugin.pyr'   r'   n   s$    G M
 Kr1   r'   c                       ] tR t^t^ t ^tRtR# )Blendr(   N)r)   r*   r+   r,   	OP_SOURCEOP_OVERr0   r(   r1   r2   r4   r4      s    I
 Gr1   r4   c                    V ^8  d   QhRRRR/# )   sbytesreturnr(   )formats   "r2   __annotate__r=      s      U u r1   c                    \         P                  ! 4       pVP                  V \        4      pVP                  '       d   R p\        V4      hV# )z=Decompressed data too large for PngImagePlugin.MAX_TEXT_CHUNK)zlibdecompressobj
decompressMAX_TEXT_CHUNKunconsumed_tail
ValueError)r9   dobj	plaintextmsgs   &   r2   _safe_zlib_decompressrH      sA    D>2IMor1   c               $    V ^8  d   QhRRRRRR/# )r8   datar:   seedintr;   r(   )r<   s   "r2   r=   r=      s!     / / /c /# /r1   c                <    \         P                  ! W4      R ,          # )l    )r?   crc32)rJ   rK   s   &&r2   _crc32rO      s    ::d!J..r1   c                      ] tR t^tR R ltR R ltR R ltR R ltR	 R
 ltR R lt	R R lt
R R ltR R ltRR R lltRtR# )ChunkStreamc                    V ^8  d   QhRRRR/# r8   fp	IO[bytes]r;   Noner(   )r<   s   "r2   r=   ChunkStream.__annotate__   s     = =9 = =r1   c                	     Wn         . V n        R # NrT   queue)selfrT   s   &&r2   __init__ChunkStream.__init__   s    $&:<
r1   c                   V ^8  d   QhRR/# )r8   r;   ztuple[bytes, int, int]r(   )r<   s   "r2   r=   rW      s        ,  r1   c                   RpV P                   f   Q hV P                  '       d:   V P                  P                  4       w  rpV P                   P                  V4       MIV P                   P	                  ^4      pVR,          pV P                   P                  4       p\        V4      p\        V4      '       g1   \        P                  '       g   R\        V4       R2p\        V4      hWV3# )z.Fetch a new chunk. Returns header information.N:   NNzbroken PNG file (chunk ))rT   r[   popseekreadtelli32is_cidr   LOAD_TRUNCATED_IMAGESreprSyntaxError)r\   cidposlengthr9   rG   s   &     r2   re   ChunkStream.read   s    ww""":::#zz~~/CfGGLLQAB%C'',,.CVFc{{222/S	{!<!#&&r1   c                   V ^8  d   QhRR/# )r8   r;   rQ   r(   )r<   s   "r2   r=   rW      s      ; r1   c                	    V # rY   r(   r\   s   &r2   	__enter__ChunkStream.__enter__   s    r1   c                    V ^8  d   QhRRRR/# )r8   argsobjectr;   rV   r(   )r<   s   "r2   r=   rW      s      f  r1   c                	&    V P                  4        R # rY   )close)r\   rv   s   &*r2   __exit__ChunkStream.__exit__   s    

r1   c                   V ^8  d   QhRR/# r8   r;   rV   r(   )r<   s   "r2   r=   rW      s     $ $t $r1   c                	"    R ;V n         V n        R # rY   )r[   rT   rr   s   &r2   ry   ChunkStream.close   s    ##
TWr1   c               (    V ^8  d   QhRRRRRRRR/# )r8   rl   r:   rm   rL   rn   r;   rV   r(   )r<   s   "r2   r=   rW      s(     . . .C . . .r1   c                	`    V P                   f   Q hV P                   P                  WV34       R # rY   )r[   appendr\   rl   rm   rn   s   &&&&r2   pushChunkStream.push   s)    zz%%%

3V,-r1   c               (    V ^8  d   QhRRRRRRRR/# )r8   rl   r:   rm   rL   rn   r;   r(   )r<   s   "r2   r=   rW      s.     J J JC J J Jr1   c                x    \         P                  RWV4       \        V RVP                  R4       24      ! W#4      # )z"Call the appropriate chunk handlerzSTREAM %r %s %schunk_ascii)loggerdebuggetattrdecoder   s   &&&&r2   callChunkStream.call   s8     	&&9tvcjj&9%:;<SIIr1   c               $    V ^8  d   QhRRRRRR/# r8   rl   r:   rJ   r;   rV   r(   )r<   s   "r2   r=   rW      s!     * *u *E *d *r1   c                   \         P                  '       d1   V^ ,          ^,	          ^,          '       d   V P                  W4       R# V P                  f   Q h \	        V\	        V4      4      p\        V P                  P                  ^4      4      pW48w  d   R\        V4       R2p\        V4      hR#   \        P                   d!   pR\        T4       R2p\        T4      ThRp?ii ; i)zRead and verify checksumNz(broken PNG file (bad header checksum in rb   z(broken PNG file (incomplete checksum in )r   ri   crc_skiprT   rO   rg   re   rj   rk   structerror)r\   rl   rJ   crc1crc2rG   es   &&&    r2   crcChunkStream.crc   s     ***A!aMM#$ww"""	*$s,Dtww||A'D|@c1M!#&&  || 	*<T#YKqICc")	*s   AB3 3C(C##C(c               $    V ^8  d   QhRRRRRR/# r   r(   )r<   s   "r2   r=   rW      s!      E  4 r1   c                \    V P                   f   Q hV P                   P                  ^4       R# )zRead checksumN)rT   re   )r\   rl   rJ   s   &&&r2   r   ChunkStream.crc_skip   s#     ww"""Qr1   c                    V ^8  d   QhRRRR/# )r8   endchunkr:   r;   zlist[bytes]r(   )r<   s   "r2   r=   rW      s      u ; r1   c                	@   . pV P                   f   Q h  V P                  4       w  r4pY18X  d    T# T P                  T\        P                  ! T P                   T4      4       TP                  T4       Kb    \        P                   d   pRp\	        T4      ThR p?ii ; i)Nztruncated PNG file)	rT   re   r   r   OSErrorr   r   
_safe_readr   )r\   r   cidsrl   rm   rn   r   rG   s   &&      r2   verifyChunkStream.verify   s     ww"""*#'99; &
   HHS)..tww?@KK << **cl)*s   A5 5B
BBrZ   N)   IEND)r)   r*   r+   r,   r]   re   rs   rz   ry   r   r   r   r   r   r0   r(   r1   r2   rQ   rQ      s:    = *$.J** r1   rQ   c                  J    ] tR tRt$ RtR]R&   R]R&   ]R
R R ll4       tR	tR# )iTXt   ze
Subclass of string to allow iTXt chunks to look like strings while
keeping their extra information

zstr | bytes | NonelangtkeyNc               (    V ^8  d   QhRRRRRRRR/# )r8   textstrr   z
str | Noner   r;   r   r(   )r<   s   "r2   r=   iTXt.__annotate__  s,      (7A	r1   c                H    \         P                  W4      pW$n        W4n        V# )z
:param cls: the class to use when creating the instance
:param text: value for this key
:param lang: language code
:param tkey: UTF-8 version of the key name
)r   __new__r   r   )clsr   r   r   r\   s   &&&& r2   r   iTXt.__new__
  s!     {{3%		r1   )r   r   )NN)	r)   r*   r+   r,   __doc____annotations__staticmethodr   r0   r(   r1   r2   r   r      s'     
 r1   r   c                  V    ] tR tRtRtR R ltRR R lltRR R lltRR	 R
 lltRt	R# )PngInfoi  z4
PNG chunk container (for use with save(pnginfo=))

c                   V ^8  d   QhRR/# r}   r(   )r<   s   "r2   r=   PngInfo.__annotate__!  s     : :$ :r1   c                	    . V n         R # rY   chunksrr   s   &r2   r]   PngInfo.__init__!  s	    79r1   c               (    V ^8  d   QhRRRRRRRR/# )r8   rl   r:   rJ   
after_idatboolr;   rV   r(   )r<   s   "r2   r=   r   $  s(     
4 
4u 
4E 
4t 
4 
4r1   c                @    V P                   P                  WV34       R# )zAppends an arbitrary chunk. Use with caution.

:param cid: a byte string, 4 bytes long.
:param data: a byte string of the encoded data
:param after_idat: for use with private chunks. Whether the chunk
                   should be written after IDAT

N)r   r   )r\   rl   rJ   r   s   &&&&r2   addPngInfo.add$  s     	Cz23r1   c               0    V ^8  d   QhRRRRRRRRRRRR	/# )
r8   keystr | bytesvaluer   r   zipr   r;   rV   r(   )r<   s   "r2   r=   r   0  sN     !U !U!U !U 	!U
 !U !U 
!Ur1   c                r   \        V\        4      '       g   VP                  RR4      p\        V\        4      '       g   VP                  RR4      p\        V\        4      '       g   VP                  RR4      p\        V\        4      '       g   VP                  RR4      pV'       dS   V P                  RVR,           V,           R,           V,           R,           \        P
                  ! V4      ,           4       R# V P                  RVR,           V,           R,           V,           R,           V,           4       R# )	zAppends an iTXt chunk.

:param key: latin-1 encodable text key name
:param value: value for this key
:param lang: language code
:param tkey: UTF-8 version of the key name
:param zip: compression flag

latin-1strictutf-8   iTXts         s      N)
isinstancer:   encoder   r?   compress)r\   r   r   r   r   r   s   &&&&&&r2   add_itxtPngInfo.add_itxt0  s    $ #u%%**Y1C%''LL(3E$&&;;w1D$&&;;w1DHHk!D(5047%?$--PUBVV
 HHWcIo4u<tCeKeSTr1   c               (    V ^8  d   QhRRRRRRRR/# )	r8   r   r   r   zstr | bytes | iTXtr   r   r;   rV   r(   )r<   s   "r2   r=   r   S  s,     !3 !3!3'9!3@D!3	!3r1   c                x   \        V\        4      '       dQ   T P                  TTVP                  e   VP                  MRVP                  e   VP                  VR7      # RVR7      # \        V\
        4      '       g    VP                  RR4      p\        V\
        4      '       g   VP                  RR4      pV'       d7   V P                  RVR,           \        P                  ! V4      ,           4       R# V P                  RVR	,           V,           4       R#   \         d    T P                  YTR7      u # i ; i)
zAppends a text chunk.

:param key: latin-1 encodable text key name
:param value: value for this key, text or an
   :py:class:`PIL.PngImagePlugin.iTXt` instance
:param zip: compression flag

Nr1   )r   r   r      zTXt        tEXtr   )r   r   r   r   r   r:   r   UnicodeErrorr   r?   r   )r\   r   r   r   s   &&&&r2   add_textPngInfo.add_textS  s
    eT""==#jj4

##jj4

 !   ;> !   %'':Y9 #u%%**Y1CHHWcGmdmmE.BBCHHWcEkE12   :}}SS}99:s   >D D98D9r   NF) r   F)
r)   r*   r+   r,   r   r]   r   r   r   r0   r(   r1   r2   r   r     s"    
:
4!UF!3 !3r1   r   c                  6    ] tR tRt$ R]R&   R]R&   R]R&   RtR	# )
_RewindStatei{  z dict[str | tuple[int, int], Any]infozlist[ImageFile._Tile]tilez
int | Noneseq_numr(   Nr)   r*   r+   r,   r   r0   r(   r1   r2   r   r   {  s    
**
r1   r   c                    a  ] tR tRtR V 3R lltR R ltR R ltR R	 ltR
 R ltR R lt	R R lt
R R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR( R) ltR* R+ ltR,tV ;t# )-	PngStreami  c                    V ^8  d   QhRRRR/# rS   r(   )r<   s   "r2   r=   PngStream.__annotate__  s      9  r1   c                	   < \         SV `  V4       / V n        / V n        RV n        RV n        . V n        RV n        RV n        RV n	        RV n
        \        / . R4      V n        ^ V n        R# )r   r   Nr   r   )superr]   im_infoim_textim_sizeim_modeim_tile
im_paletteim_custom_mimetypeim_n_frames_seq_numr   rewind_statetext_memory)r\   rT   	__class__s   &&r2   r]   PngStream.__init__  sl     :<.0.048.2'+$((R6r1   c                    V ^8  d   QhRRRR/# )r8   chunklenrL   r;   rV   r(   )r<   s   "r2   r=   r     s     " "# "$ "r1   c                	    V ;P                   V,          un         V P                   \        8  d   R V P                    R2p\        V4      hR# )z%Too much memory used in text chunks: z>MAX_TEXT_MEMORYN)r   MAX_TEXT_MEMORYrD   )r\   r   rG   s   && r2   check_text_memoryPngStream.check_text_memory  sN    H$o-7##$$46  S/! .r1   c                   V ^8  d   QhRR/# r}   r(   )r<   s   "r2   r=   r     s     
 
T 
r1   c                	    \        V P                  P                  4       V P                  V P                  4      V n        R # rY   )r   r   copyr   r   r   rr   s   &r2   save_rewindPngStream.save_rewind  s-    (LLLLMM
r1   c                   V ^8  d   QhRR/# r}   r(   )r<   s   "r2   r=   r     s     2 2 2r1   c                	    V P                   P                  P                  4       V n        V P                   P                  V n        V P                   P                  V n        R # rY   )r   r   r  r   r   r   r   r   rr   s   &r2   rewindPngStream.rewind  sD    ((--224((--))11r1   c               $    V ^8  d   QhRRRRRR/# r8   rm   rL   rn   r;   r:   r(   )r<   s   "r2   r=   r     s!      c 3 5 r1   c                	    V P                   f   Q h\        P                  ! V P                   V4      pVP                  R4      p\        P                  RVR V 4       W4^,           ,          p\        P                  RV4       V^ 8w  d   RV R2p\        V4      h \        W4^,           R  4      pYpP                  R&   T#   \         d    \        P                  '       d   R p L5h \        P                   d    R p LNi ; i)Nr   ziCCP profile name %rzCompression method %sUnknown compression method z in iCCP chunkicc_profile)rT   r   r   findr   r   rk   rH   rD   ri   r?   r   r   )r\   rm   rn   r9   icomp_methodrG   r  s   &&&     r2   
chunk_iCCPPngStream.chunk_iCCP  s    ww"""  &1 FF5M+QrU3Ah,k:!/}NKCc""	/a%'
;K '2]#  	..."zz 	K	s$   B> > C=C=#C=7C=<C=c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     !      c 3 5 r1   c                	   V P                   f   Q h\        P                  ! V P                   V4      pV^8  d&   \        P                  '       d   V# Rp\	        V4      h\        V^ 4      \        V^4      3V n         \        V^,          V^	,          3,          w  V n        V n	        V^,          '       d   ^V P                  R&   V^,          '       d   Rp\        V4      hV#   \         d     LIi ; i)NzTruncated IHDR chunk	interlacezunknown filter category)rT   r   r   ri   rD   rg   r   _MODESr   
im_rawmode	Exceptionr   rk   r\   rm   rn   r9   rG   s   &&&  r2   
chunk_IHDRPngStream.chunk_IHDR  s    ww"""  &1B;...(CS/!1ay#a)+	,2AaD!A$<,@)DL$/ R55()DLL%R55+Cc""  		s   <*C" "C0/C0c               $    V ^8  d   QhRRRRRR/# r8   rm   rL   rn   r;   r   r(   )r<   s   "r2   r=   r     s!      c 3 8 r1   c                	b   R V P                   9   d6   \        P                  ! RV P                   R ,          WP                  4      .pMQV P                  e   RV P                   R&   \        P                  ! RRV P
                  ,           WP                  4      .pW0n        W n        Rp\        V4      h)bboxr   Tdefault_imagezimage data foundr   )	r   r   _Tiler  r   r   r   im_idatEOFError)r\   rm   rn   r   rG   s   &&&  r2   
chunk_IDATPngStream.chunk_IDAT  s    T\\!OOE4<<+?ooVWD+04_-OOE6DLL+@#WXD smr1   c               $    V ^8  d   QhRRRRRR/# r  r(   )r<   s   "r2   r=   r     s!      c 3 8 r1   c                	    R p\        V4      h)zend of PNG image)r#  )r\   rm   rn   rG   s   &&& r2   
chunk_IENDPngStream.chunk_IEND  s     smr1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     s!      c 3 5 r1   c                	    V P                   f   Q h\        P                  ! V P                   V4      pV P                  R8X  d
   RV3V n        V# )Nr    r   )rT   r   r   r   r   r\   rm   rn   r9   s   &&& r2   
chunk_PLTEPngStream.chunk_PLTE  sD    ww"""  &1<<3#QhDOr1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     s!      c 3 5 r1   c                	r   V P                   f   Q h\        P                  ! V P                   V4      pV P                  R8X  dU   \        P                  V4      '       d)   VP                  R4      pV^ 8  d   W@P                  R&   V# W0P                  R&    V# V P                  R8X  d%   \        V4      '       d   ^M^ V P                  R&   V# V P                  R9   d   \        V4      V P                  R&   V# V P                  R8X  d0   \        V4      \        V^4      \        V^4      3V P                  R&   V# )Nr    r   transparencyr   r   )r   r   )	rT   r   r   r   _simple_palettematchr  r   i16)r\   rm   rn   r9   r  s   &&&  r2   
chunk_tRNSPngStream.chunk_tRNS  s   ww"""  &1<<3$$Q'' FF5M634LL0  01^,  \\S 25a&&3aDLL(
 	 \\]*+.q6DLL(  \\U"+.q63q!9c!Qi+GDLL(r1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r   	  s!      c 3 5 r1   c                	    V P                   f   Q h\        P                  ! V P                   V4      p\        V4      R,          V P                  R&   V# )N     j@gamma)rT   r   r   rg   r   r,  s   &&& r2   
chunk_gAMAPngStream.chunk_gAMA	  sD    ww"""  &1 #A 1Wr1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     s!      c 3 5 r1   c                	0   V P                   f   Q h\        P                  ! V P                   V4      p\        P                  ! R\        V4      ^,           R2V4      p\        ;QJ d    . R V 4       F  NK  	  5M! R V 4       4      V P                  R&   V# )N>Ic              3  2   "   T F  qR ,          x  K  	  R# 5i)r9  Nr(   ).0elts   & r2   	<genexpr>'PngStream.chunk_cHRM.<locals>.<genexpr>  s     ,Px8^^xs   chromaticity)rT   r   r   r   unpacklentupler   )r\   rm   rn   r9   raw_valss   &&&  r2   
chunk_cHRMPngStream.chunk_cHRM  sw     ww"""  &1==1SVq[M!3Q7',u,Px,Puu,Px,P'P^$r1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     s!      c 3 5 r1   c                	    V P                   f   Q h\        P                  ! V P                   V4      pV^8  d&   \        P                  '       d   V# Rp\	        V4      hV^ ,          V P
                  R&   V# )NzTruncated sRGB chunksrgb)rT   r   r   ri   rD   r   r  s   &&&  r2   
chunk_sRGBPngStream.chunk_sRGB  sh     ww"""  &1A:...(CS/! tVr1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r   +  s!      c 3 5 r1   c                	   V P                   f   Q h\        P                  ! V P                   V4      pV^	8  d&   \        P                  '       d   V# Rp\	        V4      h\        V^ 4      \        V^4      reV^,          pV^8X  d#   VR,          VR,          3pWP                  R&   V# V^ 8X  d   WV3V P                  R&   V# )NzTruncated pHYs chunk
F%u?dpiaspect)rT   r   r   ri   rD   rg   r   )	r\   rm   rn   r9   rG   pxpyunitrU  s	   &&&      r2   
chunk_pHYsPngStream.chunk_pHYs+  s    ww"""  &1A:...(CS/!QC1IBt19v+rF{*C"%LL  QY%'VDLL"r1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r   =  s!      c 3 5 r1   c                	   V P                   f   Q h\        P                  ! V P                   V4      p VP                  R^4      w  rEV'       de   VP                  RR4      pVP                  RR4      pVR8X  d   TMTV P                  V&   WpP                  V&   V P                  \        V4      4       V#   \         d    TpRp Li ; i)Nr   r1   r   r   replaces   exif)
rT   r   r   splitrD   r   r   r   r   rH  )r\   rm   rn   r9   kvk_strv_strs   &&&     r2   
chunk_tEXtPngStream.chunk_tEXt=  s    ww"""  &1	775!$DA
 HHY1EHHY	2E'(G|!DLL"'LL""3u:.  	AA	s   B5 5CCc               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r   Q  s!     ! !c !3 !5 !r1   c                	   V P                   f   Q h\        P                  ! V P                   V4      p VP                  R^4      w  rEV'       d   V^ ,          pM^ pV^ 8w  d   RV R2p\        V4      h \        VR,          4      pT'       d]   TP                  RR4      pTP                  RR4      p	T	;T P                  T&   T P                  T&   T P                  \        T	4      4       T#   \         d    TpRp Li ; i  \         d    \        P                  '       d   Rp Lh \        P                   d    Rp Li ; i)	Nr   r1   r  z in zTXt chunk:   NNr   r   r^  )rT   r   r   r_  rD   rk   rH   ri   r?   r   r   r   r   r   rH  )
r\   rm   rn   r9   r`  ra  r  rG   rb  rc  s
   &&&       r2   
chunk_zTXtPngStream.chunk_zTXtQ  s.   ww"""  &1	775!$DA A$KK!/}NKCc""	%ae,A HHY1EHHY	2E8==DLL$,,u"5""3u:.7  	AA	  	...zz 	A	s5   C, 4D ,C>=C> E "E &E :E ?E c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r   t  s!     ) )c )3 )5 )r1   c                	   V P                   f   Q h\        P                  ! V P                   V4      ;r4 VP                  R^4      w  rS\        T4      ^8  d   T# T^ ,          T^,          TR,          r7p TP                  R^4      w  rp
T^ 8w  d   T^ 8X  d    \        T
4      p
MT# TR8X  d   YP                  R&    TP                  RR4      pTP                  RR4      pT	P                  RR4      pT
P                  RR4      p\        YT4      ;T P                  T&   T P                  T&   T P                  \        T4      4       T#   \         d    Tu # i ; i  \         d    Tu # i ; i  \         d    \        P                  '       d   Tu # h \        P                   d    Tu # i ; i  \         d    Tu # i ; i)Nr   :r8   NNs   XML:com.adobe.xmpxmpr   r   r   )rT   r   r   r_  rD   rH  rH   ri   r?   r   r   r   r   r   r   r   )r\   rm   rn   rr9   r`  cfcmr   tkra  rb  lang_strtk_strrc  s   &&&            r2   
chunk_iTXtPngStream.chunk_iTXtt  s   ww"""$$TWWf55	775!$DA q6A:HaD!A$"	''%+KDa 7Qw-a0A $$"#LL	HHY1E{{7H5HYYw1FHHWh/E 59&4QQUdll51s5z*G  	H	  	H	 "  666 zz H  	H	sZ   E	 5E E/ =AF1 	EEE,+E,/ F.F.F.(F.-F.1G Gc               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     s!      c 3 5 r1   c                	    V P                   f   Q h\        P                  ! V P                   V4      pRV,           V P                  R&   V# )N   Exif  exif)rT   r   r   r   r,  s   &&& r2   
chunk_eXIfPngStream.chunk_eXIf  s@    ww"""  &1.2Vr1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     r  r1   c                	   V P                   f   Q h\        P                  ! V P                   V4      pV^8  d&   \        P                  '       d   V# Rp\	        V4      hV P
                  e    R V n        \        P                  ! R4       V# \        V4      pV^ 8X  g   VR8  d   \        P                  ! R4       V# WPn        \        V^4      V P                  R&   RV n
        V# )Nz"APNG contains truncated acTL chunkz4Invalid APNG, will use default PNG image if possiblel        loopz
image/apng)rT   r   r   ri   rD   r   warningswarnrg   r   r   )r\   rm   rn   r9   rG   n_framess   &&&   r2   
chunk_acTLPngStream.chunk_acTL  s    ww"""  &1A:...6CS/!'#DMMPQHq6q=Hz1MMPQH#"1ayV".r1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     s!      c 3 5 r1   c                	j   V P                   f   Q h\        P                  ! V P                   V4      pV^8  d&   \        P                  '       d   V# Rp\	        V4      h\        V4      pV P                  f   V^ 8w  g'   V P                  e&   V P                  V^,
          8w  d   Rp\        V4      hWPn        \        V^4      \        V^4      rv\        V^4      \        V^4      rV P                  w  rW,           V
8  g   W,           V8  d   Rp\        V4      hWW,           W,           3V P                  R&   \        V^4      \        V^4      rV^ 8X  d   ^dp\        V4      \        V4      ,          R,          V P                  R&   V^,          V P                  R&   V^,          V P                  R&   V# )	Nz"APNG contains truncated fcTL chunk#APNG contains frame sequence errorszAPNG contains invalid framesr    durationdisposalblend)rT   r   r   ri   rD   rg   r   rk   r   r   r4  float)r\   rm   rn   r9   rG   seqwidthheightrW  rX  im_wim_h	delay_num	delay_dens   &&&           r2   
chunk_fcTLPngStream.chunk_fcTL  sm   ww"""  &1B;...6CS/!!fMM!cQhMM%$--37*B7Cc""Aq	3q!9vQSBZB\\
:d 20Cc"" "
BK@V"1bz3q":9>I#(#3eI6F#F#MZ #$R5Z  !"Wr1   c               $    V ^8  d   QhRRRRRR/# r	  r(   )r<   s   "r2   r=   r     s!     4 4c 43 45 4r1   c                	   V P                   f   Q hV^8  dG   \        P                  '       d$   \        P                  ! V P                   V4      pV# Rp\	        V4      h\        P                  ! V P                   ^4      p\        V4      pV P                  V^,
          8w  d   Rp\        V4      hWPn        V P                  V^,           V^,
          4      # )Nz"APNG contains truncated fDAT chunkr  )	rT   r   ri   r   rD   rg   r   rk   r$  )r\   rm   rn   r9   rG   r  s   &&&   r2   
chunk_fdATPngStream.chunk_fdAT  s    ww"""A:...((&96CS/!  !,!f==C!G#7Cc""sQw
33r1   )r   r   r"  r   r   r   r   r  r   r   r   r   r   )r)   r*   r+   r,   r]   r   r  r  r  r  r$  r(  r-  r5  r;  rK  rP  rZ  rd  ri  rt  rz  r  r  r  r0   __classcell__r   s   @r2   r   r     sx     ""
2
8*."$(!F)V*<4 4r1   r   c                    V ^8  d   QhRRRR/# )r8   prefixr:   r;   r   r(   )r<   s   "r2   r=   r=     s     % %E %d %r1   c                ,    V P                  \        4      # rY   )
startswith_MAGIC)r  s   &r2   _acceptr    s    V$$r1   c                     a  ] tR tRtRtRtR R lt]R R l4       tR V 3R	 llt	R
 R lt
RR R lltR R ltR R ltR R ltR R ltR R ltR V 3R lltRtV ;t# )PngImageFilei  PNGzPortable network graphicsc                   V ^8  d   QhRR/# r}   r(   )r<   s   "r2   r=   PngImageFile.__annotate__  s     B- B-t B-r1   c                	   V P                   f   Q h\        V P                   P                  ^4      4      '       g   Rp\        V4      hV P                   V n        ^ V n        . V n        \        V P                   4      V n         V P                  P                  4       w  r#p V P                  P                  W#V4      pT P                  P%                  Y%4       KX    \         d     M\         du    \        P                  RY#T4       \        P                  ! T P                   T4      pTR,          P!                  4       '       d   T P                  P#                  Y%34        Li ; iT P                  P&                  T n        T P                  P*                  T n        T P                  P.                  T n        R T n        T P                  P4                  T n        T P                  P8                  T n        T P                  P<                  ;'       g    ^T n        T P0                  PA                  RR4      T n!        T P                  PD                  '       d4   T P                  PD                  w  rg\F        PH                  ! Yg4      T n%        TR8X  d   T^,
          T n&        MY@n&        T P                  P<                  e   RT n'        T P                  PQ                  4        T PL                  T n)        T P                  PU                  4       T n+        T PB                  '       d   T ;P>                  ^,          un        T PY                  ^ 4       T P>                  ^8  T n-        R # )Nznot a PNG file%r %s %s (unknown)rh  r8   Nr   F   fdAT).rT   r  re   rk   _fp_PngImageFile__frameprivate_chunksr   pngr   r#  AttributeErrorr   r   r   r   islowerr   r   r   _moder   _sizer   r   _textr   r   r   custom_mimetyper   r  getr   r   r   rawpalette_PngImageFile__prepare_idat!_close_exclusive_fp_after_loadingr  _PngImageFile__rewind_idatrf   _PngImageFile__rewind_seekis_animated)r\   rG   rl   rm   rn   r9   rawmoderJ   s   &       r2   _openPngImageFile._open  sp   ww"""tww||A''"Cc""77
 VX%.tww%7  $xx}}Cf9HHMM#F3 HHLL   ! 913VD((&9s8##%%''..x8	9 XX%%
XX%%
HH$$	37
HH$$	#xx::,,11!YY]]?EB88 HH//MG'++G:DL'>"(1*D"(88+5:D2HH  "!%!4!4D HHMMODM!!!"JJqM==1,s    C E$&E$/A2E$#E$c                   V ^8  d   QhRR/# )r8   r;   zdict[str, str | iTXt]r(   )r<   s   "r2   r=   r  ?  s      + r1   c                	<   V P                   ft   V P                  '       d/   V P                  pV P                  V P                  ^,
          4       V P                  4        V P                  '       d   V P                  X4       V P                   f   Q hV P                   # rY   )r  r  r  rd   r  load)r\   frames   & r2   r   PngImageFile.text>  su     :: 		$--!+,IIK		% zz%%%zzr1   c                   V ^8  d   QhRR/# r}   r(   )r<   s   "r2   r=   r  N  s       r1   c                V  < V P                   f   Rp\        V4      hV P                   P                  V P                  ^ ,          ^,          ^,
          4       V P                  f   Q hV P                  P                  4        V P                  P                  4        \        SV `  4        R# )zVerify PNG fileNz)verify must be called directly after open)rT   RuntimeErrorrd   r   r  r   ry   r   )r\   rG   r   s   & r2   r   PngImageFile.verifyN  sw     77?=Cs## 	TYYq\!_q()xx###r1   c                    V ^8  d   QhRRRR/# )r8   r  rL   r;   rV   r(   )r<   s   "r2   r=   r  ^  s     + +# +$ +r1   c                	r   V P                  V4      '       g   R # WP                  8  d   V P                  ^ R4       V P                  p\        V P                  ^,           V^,           4       F  p V P                  V4       K  	  R #   \         d%   pT P                  T4       Rp\	        T4      ThR p?ii ; i)NTzno more images in APNG file)_seek_checkr  r  ranger#  rd   )r\   r  
last_framefr   rG   s   &&    r2   rd   PngImageFile.seek^  s    &&<<JJq$\\
t||a'3A+

1 4  +		*%3sm*+s   0BB6B11B6c               $    V ^8  d   QhRRRRRR/# )r8   r  rL   r  r   r;   rV   r(   )r<   s   "r2   r=   r  m  s+     bI bI3 bI bI bIr1   c                	   V P                   f   Q h\        V P                  \        4      '       d   V P                  P                  hV  R pV^ 8X  Ed:   V'       d   V P                  P                  V P                  4       V P                   P                  4        V P                  V n	        R V n
        V P                   P                  V n        V P                   P                  V n        V P                  V n        R V n        R V n        V P                  P%                  RR4      V n        V P                  P%                  R4      V n        V P                  P%                  R4      V n        V P                  P%                  R4      p^ V n        EMzWP,                  ^,           8w  d   RV 2p\/        V4      hV P1                  4        V P"                  '       d1   V P2                  P5                  V P"                  V P6                  4       V P2                  P9                  4       V n        V P                  V n        V P                  '       d3   \:        P<                  ! V P                  V P                  4       ^ V n	        Rp V P                  P?                  ^4        V P                   P?                  4       w  rgpTR8X  d   R	p\G        T4      hTR
8X  d   T'       d   Rp\E        T4      hRp T P                   PI                  YgT4       K  V'       d   W0n        V P                   f5   V P(                  \R        PT                  8X  d   \R        PV                  V n        R V n        V P(                  \R        PT                  8X  da   V P                   '       dM   V P                   P9                  4       V n        V PY                  V P"                  V P6                  4      V n        R # R # V P(                  \R        PV                  8X  dg   \Z        P\                  P_                  V P`                  V Pb                  4      V n        V PY                  V P"                  V P6                  4      V n        R # R #   \@        PB                  \D        3 d     Mi ; i  \J         d     M\F         dG    TR8X  d   T^,          pT'       d	   Yn	         Mo\:        P<                  ! T P                  T4        EKe  \L         d>    \N        PQ                  RYgT4       \:        P<                  ! T P                  T4        EK  i ; iYn        T P                   P                  T n        T P                  P%                  R4      T n        T P                  P%                  R4      T n        T P                  P%                  R4      pT P                  '       d   EK  Rp\G        T4      h)Nr   Fr  r  r  zcannot seek to frame Tr   zNo more images in APNG file   fcTLzAPNG missing frame datar  r  zimage not found in APNG frame)2r  r   r  r   exrd   r  r  r  r  _imr   r   r   r   rT   _prev_imdisposer  r   
dispose_opblend_opr  rD   r  impastedispose_extentr  r   r   re   r   r   rk   r#  r   UnicodeDecodeErrorr  r   r   r'   r/   r.   _cropr	   corefillmodesize)	r\   r  r  r  rG   frame_startrl   rm   rn   s	   &&&      r2   r  PngImageFile._seekm  s   xx###dhh..((++A:dmm,!&*&8&8# HH,,	 HH,,	(( DMDL!%!FD"iimmJ7DO IIMM'2DM!YY]]62NDLq((-eW5 o% IIK|||dllD,?,?@ GGLLNDMhhDG """$$TWWd.A.AB&'#KQ'+xx}}$Cf '>7C"3-''>"7)#.."&K:HHMM#F3. ES == T__8L8L%L&44DO??h222}}}#}}113#zz$,,8K8KL  __ 6 66 ::??499dii@DL::dllD4G4GHDL 7c k2  *  :g~!&28/!((&99% :LL!5sH((&99: !L((DI"iimmJ7DO IIMM'2DM!YY]]62N9995sm#sH   Q# (R #R RT'T'T'3T';!T' T')9T'&T'c                   V ^8  d   QhRR/# )r8   r;   rL   r(   )r<   s   "r2   r=   r    s      c r1   c                	    V P                   # rY   )r  rr   s   &r2   rf   PngImageFile.tell  s    ||r1   c                   V ^8  d   QhRR/# r}   r(   )r<   s   "r2   r=   r    s     / /d /r1   c                    V P                   P                  R4      '       d   V P                  R,           V n        V P                  V n        \
        P
                  P                  V 4       R# )z"internal: prepare to read PNG filer  N)rh  )r   r  decoderconfigr  _PngImageFile__idatr   load_preparerr   s   &r2   r  PngImageFile.load_prepare  sK     99==%%!%!3!3d!:D))((.r1   c                    V ^8  d   QhRRRR/# )r8   
read_bytesrL   r;   r:   r(   )r<   s   "r2   r=   r    s     !( !(C !(E !(r1   c                p   V P                   f   Q hV P                  f   Q hV P                  ^ 8X  d   V P                  P                  ^4       V P                   P                  4       w  r#pVR9  d   V P                   P	                  W#V4       R# VR8X  d.    V P                   P                  W#V4       V^,
          V n        K  W@n        K  V^ 8:  d   V P                  pM\        WP                  4      pV P                  V,
          V n        V P                  P                  V4      #   \         d     Li ; i)zinternal: read more image datar  r1   )   IDATs   DDATr  )r  rT   r  re   r   r   r#  min)r\   r  rl   rm   rn   s   &&   r2   	load_readPngImageFile.load_read  s     xx###ww"""kkQ GGLLO#xx}}Cf55c/g~HHMM#F3 %qj$ ?JZ5JkkJ.ww||J''   s   D' 'D54D5c                   V ^8  d   QhRR/# r}   r(   )r<   s   "r2   r=   r     s     =( =($ =(r1   c                   V P                   f   Q hV P                  f   Q hV P                  ^ 8w  d&   V P                  P                  V P                  4        V P                  P                  ^4        V P                   P                  4       w  rpTR8X  d   M\TR8X  d7   T P                  '       d%   ^ T n        T P                   P                  YT4       M T P                   P                  YT4       K  T P                   P.                  T n        T P                  '       g$   T P                   P3                  4        RT n         R# T P4                  '       Edq   T P6                  \8        P:                  8X  EdO   T P=                  T P>                  T P@                  4      pT P>                  PB                  R8X  d6   R	T PD                  9   d%   TPG                  R
T PD                  R	,          4      pMT P>                  PB                  R8X  dt   R	T PD                  9   dc   T PD                  R	,          p\I        T\J        4      '       d   TPM                  T4       M'\I        T\N        4      '       d   TPQ                  T4       TPS                  R
4      pT P4                  PU                  Y`P@                  T4       T P4                  T n        R# R# R#   \        P
                  \        3 d     EK  i ; i  \         d     EK  \         dk    TR8X  d
   T^,          p \        P                  ! T P                  T4        EK    \         d&   p\        P                   '       d	    Rp? EKp  ThRp?ii ; i\"         d|    \$        P'                  RYT4       \        P                  ! T P                  T4      pTR,          P)                  4       '       d"   T P*                  P-                  YR34        EK   EK  i ; i)z%internal: finished reading image dataNTr   r  r  r  r  r   r1  r%   r    )+r  rT   r  re   r   r   rk   r  r  r   r   r  r#  r   r   r   ri   r  r   r   r  r  r   r   r  ry   r  r  r4   r6   r  r  r  r  r   convert_transparentr   r:   putpalettealphasrL   putpalettealphaconvertr  )	r\   rl   rm   rn   r   r9   updatedmaskts	   &        r2   load_endPngImageFile.load_end   s   xx###ww""";;!GGLL%GGLLO#'88==? & g~D$4$4$4&'#c/?c/$ XX%%
HHNNDH}}}%--!?**TWWd.A.AB77<<5(^tyy-H"66		. 9D ww||s*~/J IIn5%a//#44Q7'3//#33A6"??62D##G-@-@$G-- "@}G LL+.  &  	 '>aKF ((&99   666	 
 " ?13VD((&9s8##%%''..~>> &?sa   4K
 K- 
K*)K*-O4<O4O4!L<<M,M'O4%M''M,,O48A3O43O4c                   V ^8  d   QhRR/# )r8   r;   zdict[int, Any] | Noner(   )r<   s   "r2   r=   r  ?  s     1 1/ 1r1   c                	    R V P                   9  d   V P                  4        R V P                   9  d   RV P                   9  d   R# V P                  4       P                  4       # )ry  zRaw profile type exifN)r   r  getexif_get_merged_dictrr   s   &r2   _getexifPngImageFile._getexif?  sG    "IIK"'>dii'O||~..00r1   c                   V ^8  d   QhRR/# )r8   r;   z
Image.Exifr(   )r<   s   "r2   r=   r  F  s     ! ! !r1   c                	b   < R V P                   9  d   V P                  4        \        SV `  4       # )ry  )r   r  r   r  )r\   r   s   &r2   r  PngImageFile.getexifF  s%    "IIKw  r1   )__frame__idat__prepare_idat__rewind__rewind_idatr  r  r  r  r  r  r  r  r  r  r   r  r  r  rT   r  r   r  r  r  r  r  r   r   )r)   r*   r+   r,   r<   format_descriptionr  propertyr   r   rd   r  rf   r  r  r  r  r  r0   r  r  s   @r2   r  r    se    F4B-H    +bIH/!(F=(~1! !r1   r  L;1r@  c               (    V ^8  d   QhRRRRRRRR/# r8   rT   rU   rl   r:   rJ   r;   rV   r(   )r<   s   "r2   r=   r=   d  s(        u  r1   c                    RP                  V4      pV P                  \        \        V4      4      V,           4       V P                  V4       \	        V\	        V4      4      pV P                  \        V4      4       R# )z'Write a PNG chunk (including CRC field)r1   N)joinwriteo32rH  rO   )rT   rl   rJ   	byte_datar   s   &&*  r2   putchunkr  d  sW     IHHSY 3&'HHY
F3K
(CHHSXr1   c                  .    ] tR tRtR R ltR R ltRtR# )_idatio  c               $    V ^8  d   QhRRRRRR/# )r8   rT   rU   chunkCallable[..., None]r;   rV   r(   )r<   s   "r2   r=   _idat.__annotate__r  s"      9 -@ T r1   c                	    Wn         W n        R # rY   )rT   r  )r\   rT   r  s   &&&r2   r]   _idat.__init__r  s    
r1   c                    V ^8  d   QhRRRR/# r8   rJ   r:   r;   rV   r(   )r<   s   "r2   r=   r  v  s     + +% +D +r1   c                	@    V P                  V P                  R V4       R# )r  Nr  rT   r\   rJ   s   &&r2   r  _idat.writev  s    

477GT*r1   r#  Nr)   r*   r+   r,   r]   r  r0   r(   r1   r2   r  r  o  s    + +r1   r  c                  .    ] tR tRtR R ltR R ltRtR# )_fdatiz  c               (    V ^8  d   QhRRRRRRRR/# )	r8   rT   rU   r  r  r   rL   r;   rV   r(   )r<   s   "r2   r=   _fdat.__annotate__}  s*      9 -@ 3 SW r1   c                	*    Wn         W n        W0n        R # rY   )rT   r  r   )r\   rT   r  r   s   &&&&r2   r]   _fdat.__init__}  s    
r1   c                    V ^8  d   QhRRRR/# r!  r(   )r<   s   "r2   r=   r*    s      % D r1   c                	    V P                  V P                  R \        V P                  4      V4       V ;P                  ^,          un        R# )r  N)r  rT   r  r   r$  s   &&r2   r  _fdat.write  s/    

477GS%6=r1   )r  rT   r   Nr&  r(   r1   r2   r(  r(  z  s    
 r1   r(  c               $    V ^8  d   QhRRRRRR/# )r8   r  Image.Imageencoderinfodict[str, Any]r;   rV   r(   )r<   s   "r2   r=   r=     s!      ; ^  r1   c                    VP                  R R4      VP                  RR4      VP                  RR4      VP                  RR4      3V n        R# )optimizeFcompress_levelcompress_type
dictionaryr1   N)r  encoderconfig)r  r2  s   &&r2   _apply_encoderinfor;    sE    
E*("-,c*	Br1   c                  6    ] tR tRt$ R]R&   R]R&   R]R&   RtR	# )
_Framei  r1  r  z tuple[int, int, int, int] | Noner  r3  r2  r(   Nr   r(   r1   r2   r=  r=    s    O
**r1   r=  c               8    V ^8  d   QhRRRRRRRRR	RR
RRRRR/# )r8   r  r1  rT   rU   r  r  r  r   r  r   zImage.Image | Noneappend_imageszlist[Image.Image]r;   r(   )r<   s   "r2   r=   r=     sb     P PPP P 	P
 P &P %P Pr1   c                   V P                   P                  R 4      pV P                   P                  RV P                  P                  R^ 4      4      pV P                   P                  RV P                  P                  R\        P                  4      4      p	V P                   P                  RV P                  P                  R\
        P                  4      4      p
V'       d   \        P                  ! V4      pM\        P                  ! V .V4      p. p^ pV EF<  p\        P                  ! V4       EF  pVP                  V8X  d   VP                  4       pMVP                  V4      pV P                   P                  4       p\        V\        \         34      '       d   W},          VR &   M+Vf(   R VP                  9   d   VP                  R ,          VR &   \        V	\        \         34      '       d   W,          VR&   \        V
\        \         34      '       d   W,          VR&   V^,          pV'       Ed   VR,          pVP                   P                  R4      pVP                   P                  R4      pV\        P"                  8X  d!   \%        V4      ^8  d   \        P&                  pV\        P&                  8X  d   VP(                  P                  4       p\*        P,                  P/                  RV P0                  R4      pVP2                  pV'       d   VP5                  V4      pMRV P0                  ,           pVP7                  VV4       M5V\        P"                  8X  d   VR,          P(                  pMVP(                  p\8        P:                  ! VP                  R4      VP                  R4      4      pVP=                  RR7      pV'       g]   VVP                  R4      8X  dG   VVP                  R4      8X  d1   R V9   d*   VP                   R ;;,          VR ,          ,          uu&   EK  MRpVP?                  \A        VVV4      4       EK   	  EK?  	  \%        V4      ^8X  d   V'       g   V^ ,          P(                  # V! VR\C        \%        V4      4      \C        V4      4       V'       d   V P                  V8X  d   T MV P                  V4      p\E        VV P                   4       \F        PH                  ! V\K        \L        \N        ,          \Q        W4      4      \F        PR                  ! R	RV P0                  ,           ^ V4      .4       ^ p\U        V4       EF{  w  ppVP(                  pVP2                  '       g   RVP0                  ,           pMVP2                  pVP5                  V4      pVP0                  pVP                   pVP                  R ^ 4      p\W        VR
,          4      PY                  R4      pVPZ                  R8  d   Rp\]        V4      hVP                  RV	4      p VP                  RV
4      p!V! VR\C        V4      \C        V^ ,          4      \C        V^,          4      \C        V^ ,          4      \C        V^,          4      \_        VPZ                  4      \_        VP`                  4      \c        V 4      \c        V!4      4       V^,          p\E        WP                   4       V^ 8X  do   V'       gg   \F        PH                  ! V\K        \L        \N        ,          \Q        W4      4      \F        PR                  ! R	RVP0                  ,           ^ V4      .4       EK	  \e        WV4      p"\F        PH                  ! V\K        \L        \N        ,          V"4      \F        PR                  ! R	RVP0                  ,           ^ V4      .4       V"Pf                  pEK~  	  R# )r  r~  r  r  Nr%   F)
alpha_onlys   acTLr   r    zcannot write durationr  r9  )r   r   r   r   r   )4r2  r  r   r'   r-   r4   r5   	itertoolschainr   Iteratorr  r  r  r   listrI  r/   rH  r.   r  r	   r  r  r  r  cropr  r
   subtract_modulogetbboxr   r=  r  r;  r   _saver   r   r:   r  r!  	enumerater   limit_denominator	numeratorrD   o16denominatorr   r(  r   )#r  rT   r  r  r  r   r?  r  r~  r  r  rE  	im_framesframe_countim_seqim_framer2  previousprev_disposal
prev_blendbase_imr  r  delta
default_imr   r  
frame_datar  frame_durationdelayrG   frame_disposalframe_blendfdat_chunkss#   &&&&&&&                            r2   _write_multiple_framesra    s    ~~!!*-H>>fbggkk&!&<=D~~!!*bggkk*hFVFV.WXHNNwGU__(MNE.m4 IK%..v6H}}$#==?#++D1..--/K(T5M22*2*?J'!jHMM&A*2--
*CJ'(T5M22*2*?J'%$//','9G$1Ky$R= ( 4 4 8 8 D%1155g>
 H$8$88S^a=O$,$:$:M H$:$::&kk..0G#jjoofbgg|LG#==D"),,t"4%/MM'40"h&:&::'m..G&kkG"22$$V,goof.E }}}6%)DD"koog&>>"k1((4J8OO4VHdK@Ae 7 j 9~=| 

C	ND		 77d?R

40@
:r~~6EE",-__UFRWW$4aAB	
 G&y1z==HMM)D??D}}T*H}} ,,$Q7$./AA%H??U")CS/!$X>!oogu5LQLQLQLQL !!"~{O	
 	18^^4A:mOORYb 01(>7KL  73KOORY,(>7KL
 "))G_ 2` r1   c               (    V ^8  d   QhRRRRRRRR/# )	r8   r  r1  rT   rU   filenamer   r;   rV   r(   )r<   s   "r2   r=   r=   )  s(     + ++ +9 + + +r1   c                "    \        WVR R7       R# )T)save_allN)rK  )r  rT   rc  s   &&&r2   	_save_allrf  )  s    	"(T*r1   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r8   r  r1  rT   rU   rc  r   r  r  re  r   r;   rV   r(   )r<   s   "r2   r=   r=   -  sL     I III I 	I
 I 
Ir1   c                B  a( V'       Ed>   V P                   P                  R V P                  P                  R 4      4      p\        4       p\        4       o(V P                   P                  R. 4      p\        P
                  ! V .V4       FV  p\        P                  ! V4       F9  p	VP                  V	P                  4       S(P                  V	P                  4       K;  	  KX  	  R/ F  p
W9   g   K   M	  VP                  4       p
\        ;QJ d     . V(3R l\        ^4       4       F  NK  	  5M! V(3R l\        ^4       4       4      pMV P                  pV P                  p
T
pV
R8X  d   RV P                   9   d&   \        ^V P                   R,          ,          R4      pMZV P                  '       dG   \!        \        \#        V P                  P%                  4       ^,          4      ^,          R4      ^4      pMRpV^8:  d#   V^8:  d   ^pMV^8:  d   ^pM^pVRV 2,          p \&        V,          w  pppTR8X  d   \-        R^^R7       TP/                  \0        4       T! TR\3        T^ ,          4      \3        T^,          4      TTRRR4	       . R0OpT P                   P                  RT P                  P                  R4      4      pT'       dB   RpTR,           \4        P6                  ! T4      ,           pT! TRT4       TP9                  R4       T P                   P                  R4      pT'       d   . R1OpTP:                   F  pTR,          w  ppTT9   d   TP9                  T4       T! TTT4       K3  TT9   d   T! TTT4       KF  TR,          P=                  4       '       g   Ke  \#        T4      ^8H  ;'       d
    T^,          pT'       d   K  T! TTT4       K  	  T P                  R8X  dM   X^,          pT P>                  PA                  R4      RT p\#        T4      T8  d   TR,          pK  T! TRT4       T P                   P                  RT P                  P                  RR4      4      pT'       g	   T^ 8X  Ed   T P                  R8X  d]   Xp \C        T\D        4      '       d   T! TRTRT  4       EM5\!        ^ \        ^T4      4      pRT,          R,           p!T! TRT!RT  4       EM T P                  R29   d+   \!        ^ \        RT4      4      pT! TR\G        T4      4       MT P                  R8X  d;   Tw  p"p#p$T! TR\G        T"4      \G        T#4      ,           \G        T$4      ,           4       MzRT P                   9   d   Rp\+        T4      hM[T P                  R8X  dK   T P>                  PI                  4       R8X  d,   T P>                  PA                  RR4      p!Xp T! TRT!RT  4       T P                   P                  R 4      p%T%'       d[   T! TR!\3        \K        T%^ ,          R",          R#,           4      4      \3        \K        T%^,          R",          R#,           4      4      R$4       T'       dH   R%R&.pTP:                   F3  pTR,          w  ppTT9   g   K  TP9                  T4       T! TTT4       K5  	  T P                   P                  R'4      p&T&'       d\   \C        T&\L        PN                  4      '       d   T&PQ                  ^4      p&T&PS                  R(4      '       d
   T&R),          p&T! TR*T&4       T p'T'       d   \U        YY:TXX4      p'T''       dz   \W        T'T P                   4       \X        PZ                  ! T'\]        \^        \D        ,          \a        Y4      4      \X        Pb                  ! R+R3T'P                  ,           ^ T4      .4       T'       dr   TP:                   Fa  pTR,          w  ppTR,          P=                  4       '       g   K.  \#        T4      ^8H  ;'       d
    T^,          pT'       g   KW  T! TTT4       Kc  	  T! TR,R-4       \e        TR.4      '       d   TPg                  4        R# R#   \(         d   pR	T
 R
2p\+        T4      ThRp?ii ; i)4r   r?  r%   r   r    c              3  P   <a"   T F  o\        V3R  lS 4       4      x  K  	  R# 5i)c              3  4   <"   T F  qS,          x  K  	  R # 5irY   r(   )rB  
frame_sizer  s   & r2   rD  "_save.<locals>.<genexpr>.<genexpr>F  s     ?:As   N)max)rB  r  sizess   &@r2   rD  _save.<locals>.<genexpr>F  s     RAS????s   "&bitsr   ;zcannot write mode z as PNGNr@  zSaving I mode images as PNG)
stacklevels   IHDRr      sRGBr  s   ICC Profiler   s   iCCPpnginfo:Nr8   Nr  s   PLTEr1  s   tRNS   rB  z%cannot use transparency for this modeArU  s   pHYsrT  g      ?   s   bKGDs   hISTry  rx  :   NNs   eXIfr   r   r1   flush)r%   r   r    )s   cHRMs   cICPs   gAMAs   sBITrs  s   tIME)s   sPLTr   r   r   )r   r   r@  r   r   )4r2  r  r   setrD  rE  r   rF  r   r  r  rc   rI  r  r  r  rm  rH  getdata	_OUTMODESKeyErrorr   r   r  r  r  r?   r   remover   r  r  
getpaletter   r:   rO  getpalettemoderL   r	   Exiftobytesr  ra  r;  r   rK  r   r   r  r!  hasattrry  ))r  rT   rc  r  re  r   modesr?  rS  rT  r  r  outmodecolorsrp  r  	bit_depth
color_typer   rG   r   iccnamerJ   r   chunks_multiple_allowed
info_chunkrl   r   palette_byte_numberpalette_bytesr1  alpha_bytesalpharedgreenbluerU  ry  	single_imrn  s)   &&&&&                                   @r2   rK  rK  -  s    x**RWW[[9
 **?B?oordM:F)226:		(--(		(--( ; ; )D} ) 99;DuRqRuuRqRRwwwwGs{ R^^#bnnV44c:F zzzSRZZ%7%7%9!%<!=!BCH!LR<{14&z!G")27);&J #~/B
 HHV	
DGDG
 DF
..

]BGGKK,F
GC
 g~c 22b'4  	g>>i(D"F++J"2ICf}c"b#t$//b#t$S!!## _1CCjm
!z"c4( & 
ww#~$qj((/0D1DE- #66U"Mb'=)>>%%nbggkk.RV6WXL|q(77c> K,..b'<#=>"1c#|&<=,.6b'5+#67WW//q#e\":;L"gs<01WW+C"gs3x#e*4s4y@A/ >cl"	 0 77c>bee224>EE$$VS1E K"gu\k23
..

U
#C
CFVOc)*+CFVOc)*+	
 7#++J"2ICf}c"b#t$	 & >>f%DdEJJ''<<?D???++8Db'4 $&I*E-
	 9bnn5EE",-__UFY^^$;QHI	
 ++J"2IC3x!! _1CCjm
:"c4( & 
"gsr7

 a  ""4&0cl!"s   #a< <bbbc               $    V ^8  d   QhRRRRRR/# )r8   r  r1  paramsr   r;   z list[tuple[bytes, bytes, bytes]]r(   )r<   s   "r2   r=   r=     s"      +  1Q r1   c                r   a ^ RI Hp . oR V3R llpV! 4       p Wn        \        WRV4       V =S#   T =i ; i)z4Return a list of PNG chunks representing this image.)BytesIOc               (    V ^8  d   QhRRRRRRRR/# r  r(   )r<   s   "r2   r=   getchunks.<locals>.__annotate__  s(     - -9 -5 - -4 -r1   c                   < R P                  V4      p\        \        V\        V4      4      4      pSP                  WV34       R# )r1   N)r  r  rO   r   )rT   rl   rJ   r  r   r   s   &&*  r2   r   getchunks.<locals>.append  s6    HHTN	&F3K01ss+,r1   r   )ior  r2  rK  )r  r  r  r   rT   r   s   &,   @r2   	getchunksr    sG    F- -
 
Bbb&!NM Ns   2 6z.pngz.apngz	image/png)rh  r   )r   r   )r8   r   )r   r   )ra   r   )r   r   )   r   )r   r   )   r   )r   r   )r  r8   )r   r   )r  r8   )r   zRGB;16B)rh     )r    r!   )r8   r  )r    r"   )ra   r  )r    r#   )r  r  )r    r    )r  ra   )r$   r$   )r  ra   )r%   zLA;16B)r  rx  )r%   r%   )r  rx  )r%   zRGBA;16B)r   )r   rw  r   )r  rw  r   )r      r   )r      r   )r      r   )r$   r  r  )r      r   )r!   rw     )r"   r  r  )r#   r  r  )r    r  r  )r   r  r  )r%   r     )R
__future__r   rD  loggingrer   r  r?   enumr   	fractionsr   typingr   r   r   r   r	   r
   r   r   r   _binaryr   r4  r   rg   r   r   rO  r   r  
_deprecater   _utilr   TYPE_CHECKINGcollections.abcr   r   r   r   	getLoggerr)   r   compiler3  rh   r  r  r2  	SAFEBLOCKrB   r   r'   r4   rH   rO   rQ   r   r   r   r   r   r  r  r|  r  r  r(  r;  r=  ra  rf  rK  r  register_openr<   register_saveregister_save_allregister_extensionsregister_mimer(   r1   r2   <module>r     s  B #   	      ' ' G G ! !  ! ! !  ($			8	$	L	!	'	' 
 J
L
L
J
N
L
L
L
J
L
!+
2 **01$$
 ~%w *G /[ [|3 6Y3 Y3@: f4 f4Z%T!9&& T!x
 	 	$	$	$	 
"	$
'(	$	$	$	 	$
&!	(+ +
 
 Z  Pf+ "*I`2   L''w ?   L'' /   ++Y 7   ,--/@ A   L'' 5r1   