Ë
    \Rði  ã                   ó8   — d dl mZ ddlmZ dZdZ G d„ d«      Zy)	é    ©ÚStructé   )ÚUnexpectedEndOfFileErrorú>ú<c                   ój   ‡ — e Zd ZdZdˆ fd„	Zd„ Zdd„Zdd„Zdd„Zdd„Z	dd„Z
d	„ Zd
„ Zd„ Zd„ Zˆ xZS )ÚStreamReaderzÕWraps a file-like object to provide access to structured data from a binary file.

    Byte-order is configurable. `base_offset` is added to any base value provided to
    calculate actual location for reads.
    c                 óz   •— t         t        | �  «        || _        |t        k(  rt        nt
        | _        || _        y ©N)Úsuperr
   Ú__init__Ú_streamÚLITTLE_ENDIANÚ
BIG_ENDIANÚ_byte_orderÚ_base_offset)ÚselfÚstreamÚ
byte_orderÚbase_offsetÚ	__class__s       €úM/var/www/html/Extract/venv/lib/python3.12/site-packages/docx/image/helpers.pyr   zStreamReader.__init__   s0   ø€ ÜŒl˜DÑ*Ô,ØˆŒØ,6¼-Ò,G�=ÌZˆÔØ'ˆÕó    c                 ó8   — | j                   j                  |«      S )zAllow pass-through read() call.)r   Úread)r   Úcounts     r   r   zStreamReader.read   s   € à�|‰|× Ñ  Ó'Ð'r   c                 ó,   — d}| j                  |||«      S )zÎReturn the int value of the byte at the file position defined by
        self._base_offset + `base` + `offset`.

        If `base` is None, the byte is read from the current position in the stream.
        ÚB)Ú	_read_int©r   ÚbaseÚoffsetÚfmts       r   Ú	read_bytezStreamReader.read_byte   s   € ð ˆØ�~‰~˜c 4¨Ó0Ð0r   c                 óT   — | j                   t        u rdnd}| j                  |||«      S )a:  Return the int value of the four bytes at the file position defined by
        self._base_offset + `base` + `offset`.

        If `base` is None, the long is read from the current position in the stream. The
        endian setting of this instance is used to interpret the byte layout of the
        long.
        z<Lz>L©r   r   r    r!   s       r   Ú	read_longzStreamReader.read_long#   s+   € ð ×&Ñ&¬-Ñ7‰d¸TˆØ�~‰~˜c 4¨Ó0Ð0r   c                 óT   — | j                   t        u rdnd}| j                  |||«      S )z‰Return the int value of the two bytes at the file position determined by
        `base` and `offset`, similarly to ``read_long()`` above.s   <Hs   >Hr'   r!   s       r   Ú
read_shortzStreamReader.read_short.   s+   € ð ×'Ñ'¬=Ñ8‰e¸eˆØ�~‰~˜c 4¨Ó0Ð0r   c                 ód   — d„ } ||«      }| j                  |||«      }|j                  d«      }|S )zƒReturn a string containing the `char_count` bytes at the file position
        determined by self._base_offset + `base` + `offset`.c                 ó"   — d| z  }t        |«      S )Nz%dsr   )Ú
char_countÚformat_s     r   Ú
str_structz)StreamReader.read_str.<locals>.str_struct8   s   € Ø˜jÑ(ˆGÜ˜'“?Ð"r   zUTF-8)Ú_unpack_itemÚdecode)r   r-   r"   r#   r/   ÚstructÚcharsÚunicode_strs           r   Úread_strzStreamReader.read_str4   s;   € ò	#ñ ˜JÓ'ˆØ×!Ñ! &¨$°Ó7ˆØ—l‘l 7Ó+ˆØÐr   c                 ó^   — | j                   |z   |z   }| j                  j                  |«       y r   )r   r   Úseek)r   r"   r#   Úlocations       r   r7   zStreamReader.seekA   s)   € Ø×$Ñ$ tÑ+¨fÑ4ˆØ�‰×Ñ˜(Õ#r   c                 ó6   — | j                   j                  «       S )zAllow pass-through tell() call.)r   Útell)r   s    r   r:   zStreamReader.tellE   s   € à�|‰|× Ñ Ó"Ð"r   c                 óˆ   — | j                  ||«       | j                  j                  |«      }t        |«      |k  rt        ‚|S r   )r7   r   r   Úlenr   )r   Ú
byte_countr"   r#   Úbytes_s        r   Ú_read_byteszStreamReader._read_bytesI   s;   € Ø�	‰	�$˜ÔØ—‘×"Ñ" :Ó.ˆÜˆv‹;˜Ò#Ü*Ð*Øˆr   c                 ó>   — t        |«      }| j                  |||«      S r   )r   r0   )r   r$   r"   r#   r2   s        r   r    zStreamReader._read_intP   s    € Ü˜“ˆØ× Ñ  ¨¨vÓ6Ð6r   c                 ód   — | j                  |j                  ||«      }|j                  |«      d   S )Nr   )r?   ÚsizeÚunpack)r   r2   r"   r#   r>   s        r   r0   zStreamReader._unpack_itemT   s.   € Ø×!Ñ! &§+¡+¨t°VÓ<ˆØ�}‰}˜VÓ$ QÑ'Ð'r   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r%   r(   r*   r5   r7   r:   r?   r    r0   Ú__classcell__)r   s   @r   r
   r
   	   s?   ø„ ñõ(ò(ó1ó	1ó1óó$ò#òò7ö(r   r
   N)r2   r   Ú
exceptionsr   r   r   r
   © r   r   ú<module>rK      s!   ðÝ å 0à€
Ø€÷M(ò M(r   