WcB gdZddlmZddlZddlZddlmZddlmZdZ dZ dZ d Z d Z d Zd Zid e e dfde e dfde e dfde e dfde e dfde e dfde e dfde e dfde e dfde e dfde e dfde e dfd dde e dfde e dfde ddfde ddfe ddfe e dfe e dfd Zid!d d"d d#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dd0dd1ddddd2dd3d d4Zd5d6dd7Zdd8Zd9Zd:Zd;ZGd<d=ZdS)>)Charset add_alias add_charset add_codec)partialN)errors)encode_7or8bitus-asciiz unknown-8bitz iso-8859-1z iso-8859-2z iso-8859-3z iso-8859-4z iso-8859-9z iso-8859-10z iso-8859-13z iso-8859-14z iso-8859-15z iso-8859-16z windows-1252viscii)NNNbig5gb2312zeuc-jp iso-2022-jp shift_jisutf-8)rzkoi8-rrlatin_1zlatin-1latin_2zlatin-2latin_3zlatin-3latin_4zlatin-4latin_5zlatin-5latin_6zlatin-6latin_7zlatin-7latin_8zlatin-8latin_9zks_c_5601-1987zeuc-kr)zlatin-9latin_10zlatin-10cp949euc_jpeuc_krascii eucgb2312_cnbig5_tw)rrrcR |tkr td|||ft|<dS)Nz!SHORTEST not allowed for body_enc)SHORTEST ValueErrorCHARSETS)charset header_encbody_encoutput_charsets &/usr/lib64/python3.12/email/charset.pyrrms7,8<==#X~>HWc |t|<dSN)ALIASES)alias canonicals r.rrs GENNNr/c |t|<dSr1) CODEC_MAP)r* codecnames r.rrs #Igr/cb|tkr|jddS|j|S)Nr#surrogateescape) UNKNOWN8BITencode)stringcodecs r._encoder>s. }}W&788}}U##r/cJeZdZ efdZdZdZdZdZdZ dZ dZ d Z d S) rc t|tr|jdnt|d}|j }tj|||_ tj|jttdf\}}}|s |j}||_ ||_tj|||_t j|j|j|_t j|j|j|_dS#t$rt j |wxYw)Nr#) isinstancestrr; UnicodeErrorr CharsetErrorlowerr2get input_charsetr)r'BASE64header_encoding body_encodingr-r6 input_codec output_codec)selfrGhencbencconvs r.__init__zCharset.__init__s.  5---$$W--- #M7 ; &++- $[[ F$<<(:(:)164(@BdDt%%D#!%kk$5%==););)-););=%MM$*=*=*.*=*=?) 5 5 5%%m4 4 5s 4D44"Ec8|jjSr1)rGrErMs r.__repr__zCharset.__repr__s!!''))r/cXt|t|jkSr1)rBrE)rMothers r.__eq__zCharset.__eq__s4yCJ,,...r/cn |jtkrdS|jtkrdStS)Nzquoted-printablebase64)rJQPrHr rSs r.get_body_encodingzCharset.get_body_encodings<     # #%%   6 ) )8! !r/c4 |jp |jSr1)r-rGrSs r.get_output_charsetzCharset.get_output_charsets  ""8d&8&88r/c |jpd}t||}|j|}||S|j||S)Nr)rLr> _get_encoder header_encode)rMr<r= header_bytesencoder_modules r.r`zCharset.header_encodesS !!/Zvu- **<8  !M++L%@@r/c, |jpd}t||}|j|}t|j|}|j }t |tz}g} g} t||z } |D]} | j| tj| } |jt| |}|| ksQ| j| s| s| jdnD| rdnd}tj| }t||}| j||| g} t||z } tj| }t||}| j||| S)Nr)r* r)rLr>r_rr`r]lenRFC2047_CHROME_LENnextappend EMPTYSTRINGjoin header_lengthpop)rMr< maxlengthsr=rarbencoderr*extralines current_linemaxlen character this_linelength separator joined_lines r.header_encode_lineszCharset.header_encode_lines*s "!!/Zvu- **<8.66FF))+G 11 j!E) 2 2I    * *#((6I#11')W2MNF  ""u\\LL&&&(-2I"-"2"2<"@K#*;#>LLL!677 ){ j)E1!&&|4 {E2  WW\*++ r/c|jtkrtjS|jtkrtj S|jt krjtjj|}tj j|}||krtjStj SdSr1)rIrHemail base64mimerZ quoprimimer'rk)rMralen64lenqps r.r_zCharset._get_encoderhs   6 ) )## #  ! !R ' '## #  ! !X - -$$22<@E$$22<@Eu}}''''''4r/c> |s|S|jturPt|tr|j |j }t jj|S|jturbt|tr|j |j }|jd}t jj|St|tr,|j |j jd}|S)Nlatin1r#) rJrHrArBr;r-rzr{ body_encoderZdecoder|)rMr<s r.rzCharset.body_encodews vM    ' '&#&&t':':;##//7 7   2 % %&#&&t':':;]]8,F##//7 7&#&&t':':;BB7KMr/N) __name__ __module__ __qualname__DEFAULT_CHARSETrQrTrWr[r]r`rxr_rr/r.rrs*V&5????B***///"""*999AAA&<<<|   r/r)__all__ functoolsremail.base64mimerzemail.quoprimimeremail.encodersr rZrHr'rfrr:rir)r2r6rrrr>rrr/r.rs    ))))))    Br- Br- Br-   Br-  Br- Br- Br- Br- Br-  Br-! "Br-# $ Br-% &-' ( Fv-) * Fv-+ , Ft 6- .Ft 6/ 0t-v-vw/5   >  |  | | |   |   |  | | | | } } } } }  }! "}# $1   <"    ????8###$$$mmmmmmmmmr/