python (3.11.7)
    e^                        d Z g dZddlZddlZddlZddlZddlmZ ddlm	Z
 e
j        ZdZdZ
dZd	Zd
ZdZdZ ed
          Z ed          Z ej        dej        ej        z            Z ej        d          Z ej        d          Zej        j        Zd Z	 	 ddZ G d d          Z G d d          Z  G d de!          Z"dS )z+Header encoding and decoding functionality.)Header
decode_headermake_header    N)HeaderParseError)charset
     z         N   z 	us-asciizutf-8ai  
  =\?                   # literal =?
  (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
  \?                    # literal ?
  (?P<encoding>[qQbB])  # either a "q" or a "b", case insensitive
  \?                    # literal ?
  (?P<encoded>.*?)      # non-greedy up to the next ?= is the encoded string
  \?=                   # literal ?=
  z[\041-\176]+:$z
\n[^ \t]+:c                    t          | d          rd | j        D             S t                              |           s| dfgS g }|                                 D ]}t                              |          }d}|r|                    d          }|r|                                }d}|r|                    |ddf           |r{|                    d          	                                }|                    d          	                                }|                    d          }|                    |||f           |ƌg }	t          |          D ]_\  }
}|
dk    rT|d         rL||
dz
           d         r;||
dz
           d                                         r|	                    |
dz
             `t          |	          D ]}||= g }
|D ]\  }}}||
                    ||f            |d	k    r7t          j                            |          }|
                    ||f           ]|d
k    r~t!          |          dz  }|r|ddd|z
           z
  }	 t          j                            |          }|
                    ||f           # t&