
    	[id                     Z    	 d dl mZ d dlZddlmZ  G d de      Zy# e$ r d dlZY !w xY w)    )igzipN   )TLObjectc                   R    e Zd ZdZd Zed        Zd Zed        Ze	d        Z
d Zy)	
GzipPackedir0c                     || _         y Ndata)selfr   s     T/mnt/data/GridWatch/venv/lib/python3.12/site-packages/telethon/tl/core/gzippacked.py__init__zGzipPacked.__init__   s	    	    c                     | r=t        |      dkD  r/t        t        |            }t        |      t        |      k  r|S |S |S )a  Calls bytes(request), and based on a certain threshold,
           optionally gzips the resulting data. If the gzipped data is
           smaller than the original byte array, this is returned instead.

           Note that this only applies to content related requests.
        i   )lenbytesr   )content_relatedr   gzippeds      r   gzip_if_smallerzGzipPacked.gzip_if_smaller   s?     s4y3Jt,-G!'lSY67@D@Kr   c                     t        j                  dt        j                        t	        j
                  t        j                  | j                              z   S )Nz<I)	structpackr   CONSTRUCTOR_IDr   serialize_bytesgzipcompressr   r   s    r   	__bytes__zGzipPacked.__bytes__   s=    {{4!:!:;''dii(@AB 	Br   c                     | j                  d      }|t        j                  k(  sJ t        j                  | j                               S )NF)signed)read_intr   r   r   
decompresstgread_bytes)readerconstructors     r   readzGzipPacked.read"   s>    ooUo3j77777v22455r   c                 Z    t        t        j                  |j                                     S r	   )r   r   r"   r#   )clsr$   s     r   from_readerzGzipPacked.from_reader(   s    $//&*=*=*?@AAr   c                      d| j                   dS )Nr   )_r   r
   r   s    r   to_dictzGzipPacked.to_dict,   s    II
 	
r   N)__name__
__module____qualname__r   r   staticmethodr   r   r&   classmethodr)   r,    r   r   r   r   
   sU    N  B 6 6
 B B
r   r   )isalr   r   ImportErrorr    r   r   r2   r   r   <module>r6      s5   "  &
 &
  s    	**