WcBc sgdZddlmZddlZddlZddlmZddlmZdZ 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_codeci)partialN)errors)encode_7or8bitiiiius-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-1252Zviscii)NNNbig5gb2312zeuc-jp iso-2022-jpZ shift_jisutf-8)r zkoi8-rr Zlatin_1zlatin-1Zlatin_2zlatin-2Zlatin_3zlatin-3Zlatin_4zlatin-4Zlatin_5zlatin-5Zlatin_6zlatin-6Zlatin_7zlatin-7Zlatin_8zlatin-8Zlatin_9zks_c_5601-1987zeuc-kr)zlatin-9Zlatin_10zlatin-10Zcp949Zeuc_jpZeuc_krasciiZ eucgb2312_cnZbig5_tw)r r rcsR |tkr td|||ft|<dS)Nz!SHORTEST not allowed for body_enc)SHORTESTZ ValueErrorCHARSETS)charsetZ header_encZbody_encoutput_charset &/usr/lib64/python3.12/email/charset.pyrrms7,8<==#X~>HWc |t|<dSN)ALIASES)ZaliasZ canonical rrrs GENNNrcrr) CODEC_MAP)rZ codecnamerrrrs #Igrcsb|tkr|jddS|j|S)Nr Zsurrogateescape) UNKNOWN8BITencode)stringcodecrr_encoders. }}W&788}}U##rcsJeZdZ efdZdZdZdZdZdZ dZ dZ d Z d S) rcs 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 ) isinstancestrrZ UnicodeErrorrZ CharsetErrorlowerrZget input_charsetrrBASE64header_encoding body_encodingrrZ input_codec output_codec)selfr"ZhencZbencZconv r__init__zCharset.__init__s.  5---$$W--- #M7 ; &++- $[[ F$<<(:(:)164(@BdDt%%D#!%kk$5%==););)-););=%MM$*=*=*.*=*=?) 5 5 5%%m4 4 5s 4D44"Ecs8|jjSr)r"r!r' r__repr__zCharset.__repr__s!!''))rcsXt|t|jkSr)r r!)r'Zotherrr__eq__zCharset.__eq__s4yCJ,,...rcsn |jtkrdS|jtkrdStS)Nzquoted-printableZbase64)r%QPr#rr*r+rget_body_encodingzCharset.get_body_encodings<     # #%%   6 ) )8! !rcs4 |jp |jSr)rr"r*r+rget_output_charsetzCharset.get_output_charsets  ""8d&8&88rcs |jpd}t||}|j|}||S|j||S)Nr)r&r _get_encoder header_encode)r'rr header_bytesencoder_moduler(rr2zCharset.header_encodesS !!/Zvu- **<8  !M++L%@@rcs, |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)rz r)r&rr1rr2r0ZlenRFC2047_CHROME_LENZnextZappend EMPTYSTRINGZjoin header_lengthZpop)r'rZ maxlengthsrr3r4ZencoderrZextraZlinesZ current_lineZmaxlenZ characterZ this_lineZlengthZ separatorZ joined_lines rheader_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\*++ rcs|jtkrtjS|jtkrtj S|jt krjtjj|}tj j|}||krtjStj SdSr)r$r#email base64mimer. quoprimimerr7)r'r3Zlen64Zlenqprrr1zCharset._get_encoderhs   6 ) )## #  ! !R ' '## #  ! !X - -$$22<@E$$22<@Eu}}''''''4rcs> |s|S|jturPt|tr|j |j }t jj|S|jturbt|tr|j |j }|jd}t jj|St|tr,|j |j jd}|S)NZlatin1r ) r%r#rr rrr9r: body_encoder.Zdecoder;)r'rrrr<zCharset.body_encodews vM    ' '&#&&t':':;##//7 7   2 % %&#&&t':':;]]8,F##//7 7&#&&t':':;BB7KMrN) Z__name__Z __module__Z __qualname__DEFAULT_CHARSETr)r,r-r/r0r2r8r1r<rrrrs*V&5????B***///"""*999AAA&<<<|   rr)Z__all__Z functoolsrZemail.base64mimer9Zemail.quoprimimerZemail.encodersrr.r#rr5r=rr6rrrrrrrrr>rrr?s    ))))))    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