
    h,              
       8   d dl mZmZmZmZmZmZmZmZ d dl	m
Z
mZmZmZmZ edeeee         f         eeee         f         eeeef                  eeeef                  eeeef                  f         Zddeeef         dedefdZd	d
hZdeeeee         f                  deeeee         f                  fdZ	 ddeeef         dedee         defdZ	 ddeeeedf         dee         deedf         fdZ G d deeee         f                   ZdS )    )	ItemsViewIterableIteratorKeysViewMappingMutableMappingSequence
ValuesView)AnyAnyStrOptionalUnioncastHeadersutf-8valueencodingreturnc                 Z    t          | t                    r| n|                     |          S N)
isinstancestrdecoder   r   s     X/var/www/html/marketdash/venv/lib/python3.11/site-packages/curl_cffi/requests/headers.pyto_strr      s'    uc**F55X0F0FF    authorizationzproxy-authorizationitemsc              #      K   | D ]L\  }}t          |                                          t          v rt          |t                    rdnd}||fV  Md S )Ns   [secure]z[secure])r   lowerSENSITIVE_HEADERSr   bytes)r   kvs      r   obfuscate_sensitive_headersr&   #   sh         1!'')) 111)!U33CAd



 r   Nr!   c                     t          | t                    r| n|                     |pd          }|r|                                n|S )zE
    Coerce str/bytes into a strictly byte-wise HTTP header key.
    ascii)r   r#   encoder!   )r   r!   r   bytes_values       r   normalize_header_keyr+   ,   sN     E5))Pu||H<O/P/P  #(8;[8r   c                     | dS t          | t                    r| S t          | t                    r!t          |                                           S t          t          |                               |pd          S )zG
    Coerce str/bytes into a strictly byte-wise HTTP header value.
    Nzlatin-1)r   r#   intr   r)   r   r   s     r   normalize_header_valuer.   ;   st     }t%  % #5zz  """U""8#8y999r   c            	       f   e Zd ZdZ	 d dee         dee         fdZedefd            Z	e	j
        deddfd	            Z	edeeeee         f                  fd
            Zdee         fdZdeee                  fdZdeeee         f         fdZdeeeee         f                  fdZd!dededefdZd"dededeee                  fdZd!dee         ddfdZd#dZdedee         fdZdedee         ddfdZdeddfdZdedefdZde e         fdZ!de"fdZ#dedefdZ$defdZ%dS )$r   z9
    HTTP headers, as a case-insensitive multi-dict.
    Nheadersr   c                    |  t          |t                    r$t          |j                  | _        p|j        n|s	g | _        nt          |t
                    r&fd|                                D             | _        nt          |t                    rt          |d         t          t          f          rjt          |d         t                    rdnd}g }|D ]E}|	                    |d          \  }}|
                    ||                                f           Fnt          |d         t                    r|}fd|D             | _        | _        d S )Nc                 |    g | ]8\  }}t          |d           t          |d          t          |          f9S F)r!   r   Tr+   r.   .0r$   r%   r   s      r   
<listcomp>z$Headers.__init__.<locals>.<listcomp>_   b        Aq	 )%(KKK($JJJ*1h77  r   r   :   :   )maxsplitc                 |    g | ]8\  }}t          |d           t          |d          t          |          f9S r3   r4   r5   s      r   r7   z$Headers.__init__.<locals>.<listcomp>r   r8   r   )r   r   list_listr   r   r   r   r#   splitappendstriptuple	_encoding)selfr0   r   sephliner$   r%   s     `     r   __init__zHeaders.__init__T   s    	>gw''  	gm,,DJ37#3HH 	DJJ)) 	    $MMOO  DJJ && 	'!*sEl33 '
C88Bccd# - -D::cA:66DAqHHa^,,,,- GAJ..       DJ "r   r   c                     | j         bdD ]X}| j        D ]E\  }}	 |                    |           ||                    |          n| 5# t          $ r Y  nw xY w|| _          nYd| _         | j         S )zn
        Header encoding is mandated as ascii, but we allow fallbacks to utf-8
        or iso-8859-1.
        N)r(   r   z
iso-8859-1)rD   rawr   UnicodeDecodeError)rE   r   keyr   s       r   r   zHeaders.encoding}   s     >!. . ."&( 
 
JC

8,,,272CX...-   
 &.DNE  ".~s   .A
AAr   c                     || _         d S r   )rD   )rE   r   s     r   r   zHeaders.encoding   s    r   c                 $    d | j         D             S )zH
        Returns a list of the raw header items, as byte pairs.
        c                     g | ]
\  }}}||fS  rQ   )r6   raw_key_r   s       r   r7   zHeaders.raw.<locals>.<listcomp>   s$    EEE%6Wa% EEEr   r?   rE   s    r   rK   zHeaders.raw   s    
 FE$*EEEEr   c                 N      fd j         D                                             S )Nc                 N    i | ]!\  }}}|                     j                  d "S r   r   r   )r6   rS   rM   rE   s      r   
<dictcomp>z Headers.keys.<locals>.<dictcomp>   s/    LLLIAsA

4=))4LLLr   )r?   keysrU   s   `r   rZ   zHeaders.keys   s+    LLLLLLLQQSSSr   c                     i }| j         D ][\  }}}|                    | j                  }||                    | j                  nd}||v r||xx         d| z  cc<   V|||<   \|                                S )NNone, )r?   r   r   valuesrE   values_dictrS   rM   r   str_key	str_values          r   r^   zHeaders.values   s    &(!Z 	1 	1MAsEjj//G7<7HT]333fI+%%G$$$(8Y(8(88$$$$'0G$$!!###r   c                     i }| j         D ][\  }}}|                    | j                  }||                    | j                  nd}||v r||xx         d| z  cc<   V|||<   \|                                S )z
        Return `(key, value)` items of headers. Concatenate headers
        into a single comma separated value when a key occurs multiple times.
        Nr\   r]   )r?   r   r   r   r_   s          r   r   zHeaders.items   s    
 ')!Z 	1 	1MAsEjj//G7<7HT]333fI+%%G$$$(8Y(8(88$$$$'0G$$  """r   c                 *      fd j         D             S )z
        Return a list of `(key, value)` pairs of headers. Allow multiple
        occurrences of the same key without concatenating into a single
        comma separated value.
        c                     g | ]>\  }}}|                     j                  ||                     j                  n|f?S r   rX   )r6   rM   rS   r   rE   s       r   r7   z'Headers.multi_items.<locals>.<listcomp>   s_     
 
 

 Q 

4=))/4/@T]+++e
 
 
r   rT   rU   s   `r   multi_itemszHeaders.multi_items   s2    
 
 
 

 "&
 
 
 	
r   rM   defaultc                 8    	 | |         S # t           $ r |cY S w xY w)z
        Return a header value. If multiple occurrences of the header occur
        then concatenate them together with commas.
        )KeyError)rE   rM   rg   s      r   getzHeaders.get   s5    
	9 	 	 	NNN	s   
 Fsplit_commasc                     |                                                      j                   fd j        D             }|s|S g }|D ]4}|                    d |                    d          D                        5|S )z
        Return a list of all header values for a given key.
        If `split_commas=True` is passed, then any comma separated header
        values are split into multiple return strings.
        c                     g | ]<\  }}}|                                 k    ||                    j                  n|=S r   )r!   r   r   )r6   rS   item_key
item_valueget_header_keyrE   s       r   r7   z$Headers.get_list.<locals>.<listcomp>   sX     
 
 
'8Z~~>11 1;0FJdm,,,J111r   c                 6    g | ]}|                                 S rQ   )rB   r6   items     r   r7   z$Headers.get_list.<locals>.<listcomp>   s      K K K$ K K Kr   ,)r!   r)   r   r?   extendr@   )rE   rM   rk   r^   split_valuesr   rp   s   `     @r   get_listzHeaders.get_list   s     ++DM::
 
 
 
 
+/:
 
 
  	M 	M 	ME K K%++c:J:J K K KLLLLr   c                     t          |          }|D ]}|| v r|                     |           | j                            |j                   d S r   )r   popr?   ru   )rE   r0   rM   s      r   updatezHeaders.update   sU    '"" 	 	Cd{{
'-(((((r   c                 .    t          | | j                  S )N)r   )r   r   rU   s    r   copyzHeaders.copy   s    tdm4444r   c                      |                                                      j                   fd j        D             }|dgk    rdS |rd                    d |D                       S t          |          )z
        Return a single header value.
        If there are multiple headers with the same key, then we concatenate
        them with commas. See: https://tools.ietf.org/html/rfc7230#section-3.2.2
        c                 `    g | ]*\  }}}|k    ||                     j                  n|+S r   rX   )r6   rS   
header_keyheader_valuenormalized_keyrE   s       r   r7   z'Headers.__getitem__.<locals>.<listcomp>   sT     
 
 
 ,:|^++ ' ...+++r   Nr]   c                 ,    g | ]}t          |          S rQ   )r   rr   s     r   r7   z'Headers.__getitem__.<locals>.<listcomp>
  s    :::Dc$ii:::r   )r!   r)   r   r?   joinri   )rE   rM   r   r   s   `  @r   __getitem__zHeaders.__getitem__   s     ++DM::
 
 
 
 
 04z	
 
 
 TF??4 	<99::E:::;;;smmr   c                    |                     | j        pd          }||                     | j        pd          n|}|                                fdt          | j                  D             }t          |dd                   D ]
}| j        |= |r|d         }||f| j        |<   dS | j                            ||f           dS )zs
        Set the header `key` to `value`, removing any duplicate entries.
        Retains insertion order.
        r   Nc                 .    g | ]\  }\  }}}|k    |S rQ   rQ   )r6   idxrS   rn   
lookup_keys       r   r7   z'Headers.__setitem__.<locals>.<listcomp>  s9     
 
 
%%a1:%% %%%r   r;   r   )r)   rD   r!   	enumerater?   reversedrA   )rE   rM   r   set_key	set_valuefound_indexesr   r   s          @r   __setitem__zHeaders.__setitem__  s    
 **T^6w777<7HELL27333e 	 ]]__

 
 
 
)24:)>)>
 
 
 M!""-.. 	  	 C
3 	@"C&
I>DJsOOOJw
I>?????r   c                     |                                                     | j                  fdt          | j                  D             }|st          |          t          |          D ]
}| j        |= dS )z*
        Remove the header `key`.
        c                 R    g | ]#\  }\  }}}|                                 k    !|$S rQ   )r!   )r6   r   rS   rn   del_keys       r   r7   z'Headers.__delitem__.<locals>.<listcomp>.  sC     
 
 
%%a1~~7** ***r   N)r!   r)   r   r   r?   ri   r   )rE   rM   pop_indexesr   r   s       @r   __delitem__zHeaders.__delitem__(  s     ))++$$T]33
 
 
 
)24:)>)>
 
 
  	 3--K(( 	  	 C
3	  	 r   c                     |                                                     | j                  }|d | j        D             v S )Nc                     g | ]\  }}}|	S rQ   rQ   )r6   rS   rM   s      r   r7   z(Headers.__contains__.<locals>.<listcomp><  s    >>>iaac>>>r   )r!   r)   r   r?   )rE   rM   r   s      r   __contains__zHeaders.__contains__:  s;    YY[[''66
>>4:>>>>>r   c                 D    t          |                                           S r   )iterrZ   rU   s    r   __iter__zHeaders.__iter__>  s    DIIKK   r   c                 *    t          | j                  S r   )lenr?   rU   s    r   __len__zHeaders.__len__A  s    4:r   otherc                     	 t          |          }n# t          $ r Y dS w xY wd | j        D             }d |j        D             }t          |          t          |          k    S )NFc                     g | ]
\  }}}||fS rQ   rQ   r6   rS   rM   r   s       r   r7   z"Headers.__eq__.<locals>.<listcomp>J  s"    BBBmaec5\BBBr   c                     g | ]
\  }}}||fS rQ   rQ   r   s       r   r7   z"Headers.__eq__.<locals>.<listcomp>K  s"    LLL}q#usElLLLr   )r   
ValueErrorr?   sorted)rE   r   other_headers	self_list
other_lists        r   __eq__zHeaders.__eq__D  s    	#ENNMM 	 	 	55	 CBtzBBB	LL8KLLL
i  F:$6$666s    
  c                 .   | j         j        }d}| j        dk    r
d| j        }t          t	          |                                                     }t          |          }t          |          t          |          k    }|r
| d|| dS | d|| dS )N r(   z, encoding=())	__class____name__r   r>   r&   rf   dictr   )rE   
class_nameencoding_stras_listas_dictno_duplicate_keyss         r   __repr__zHeaders.__repr__N  s    ^,
=G##:::L243C3C3E3EFFGGw--LLCLL8 	> ==7=l====99w9,9999r   )NNr   )F)r   r   )&r   
__module____qualname____doc__r   HeaderTypesr   rI   propertyr   setterr>   rC   r#   rK   r   rZ   r
   r^   r   r   rf   r   rj   boolrw   rz   r|   r   r   r   r   r   r   r-   r   r   r   rQ   r   r   r   r   O   sG        
 PT'" '",'"?G}'" '" '" '"R #    X0 _c d    _ FT%x 678 F F F XFThsm T T T T	$
8C=1 	$ 	$ 	$ 	$#yhsm!34 # # # #
T%Xc](:";< 
 
 
 
 s S C     C t Xc]@S    ,) )h{3 )t ) ) ) )5 5 5 5s x}    0@s @8C= @T @ @ @ @4 s  t        $? ? ? ? ? ?!(3- ! ! ! !    7C 7D 7 7 7 7:# : : : : : :r   )r   r   )collections.abcr   r   r   r   r   r   r	   r
   typingr   r   r   r   r   r   r#   rC   r   r   r"   r&   r   r+   r-   r.   r   rQ   r   r   <module>r      s  	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 6 5 5 5 5 5 5 5 5 5 5 5 5 5C#E8E?"#U38_U5%< !U3:!G G%U
# Gs G G G G G %&;< E&(6"2234eFHV,,-.    #9 9e99 sm9 	9 9 9 9  DH: :eS$&':3;C=:
5$;: : : :(L: L: L: L: L:nS(3-/0 L: L: L: L: L:r   