
    -Ph                        d Z ddlmZ ddlZddlZddlmZ erddlZdZdZ	 ej
        dd          Zd	Zd
ZddZddZdS )zPNG image manipulation helpers.    )annotationsN)TYPE_CHECKING      !i
   s
   tEXtDepth s       IENDB`filenamestr | os.PathLike[str]return
int | Nonec                x   t          | d          5 }|                    t          t          z    d           |                    t                    }|                    t          t          z             s	 ddd           dS t          j	        d|dd                   d         cddd           S # 1 swxY w Y   dS )zARead the special tEXt chunk indicating the depth from a PNG file.rb   Nr         r   )
openseekLEN_IEND	LEN_DEPTHread
startswithDEPTH_CHUNK_LENDEPTH_CHUNK_STARTstructunpack)r	   f
depthchunks      O/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx/util/png.pyread_png_depthr      s   	h		 =	I%&***VVI&&
$$_7H%HII 	== = = = = = = = =z"R%'899!<= = = = = = = = = = = = = = = = = =s   A"B/ "B//B36B3depthintNonec                   t          j        d|          }t          | d          5 }|                    t           d           |                    t          t          z   |z              t          j	        t          |z             dz  }|                    t          j        d|                     |                    t                     ddd           dS # 1 swxY w Y   dS )zWrite the special tEXt chunk indicating the depth to a PNG file.

    The chunk is placed immediately before the special IEND chunk.
    r   zr+br   l    z!IN)r   packr   r   r   writer   r   binasciicrc32
IEND_CHUNK)r	   r    datar   crcs        r   write_png_depthr+       s   
 ;tU##D	h		 	!	y!	"33d:;;;n.566C	D#&&'''	
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   B#CCC)r	   r
   r   r   )r	   r
   r    r!   r   r"   )__doc__
__future__r   r&   r   typingr   osr   r   r$   r   r   r(   r   r+        r   <module>r2      s    % % " " " " " "               III	&+dB''$ 4
	= 	= 	= 	=     r1   