Ë
    qûàgYX  ã                  ó@  — d dl mZ d dlZd dlmZ d dlmZ ddlmZm	Z	m
Z
mZ ddlmZmZmZmZ ddlmZ dd	lmZmZ dd
lmZmZmZmZmZmZmZ  ej<                  d«      Z ej@                  «       Z!e!jE                   ejF                  d«      «       	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z$	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z%	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z&	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z'y)é    )ÚannotationsN)ÚPathLike)ÚBinaryIOé   )Úcoherence_ratioÚencoding_languagesÚmb_encoding_languagesÚmerge_coherence_ratios)ÚIANA_SUPPORTEDÚTOO_BIG_SEQUENCEÚTOO_SMALL_SEQUENCEÚTRACE)Ú
mess_ratio)ÚCharsetMatchÚCharsetMatches)Úany_specified_encodingÚcut_sequence_chunksÚ	iana_nameÚidentify_sig_or_bomÚis_cp_similarÚis_multi_byte_encodingÚshould_strip_sig_or_bomÚcharset_normalizerz)%(asctime)s | %(levelname)s | %(message)sc
                ó   — t        | t        t        f«      s#t        dj	                  t        | «      «      «      ‚|rBt        j                  }
t        j                  t        «       t        j                  t        «       t        | «      }|dk(  rqt        j                  d«       |r@t        j                  t        «       t        j                  
xs t        j                   «       t#        t%        | dddg d«      g«      S |�Dt        j'                  t        d	d
j)                  |«      «       |D �cg c]  }t+        |d«      ‘Œ }}ng }|�Dt        j'                  t        dd
j)                  |«      «       |D �cg c]  }t+        |d«      ‘Œ }}ng }|||z  k  r!t        j'                  t        d|||«       d}|}|dkD  r||z  |k  rt-        ||z  «      }t        | «      t.        k  }t        | «      t0        k\  }|r*t        j'                  t        dj	                  |«      «       n+|r)t        j'                  t        dj	                  |«      «       g }|rt3        | «      nd}|�,|j5                  |«       t        j'                  t        d|«       t7        «       }g }g }d}d}d}t#        «       }t#        «       }t9        | «      \  }}|�6|j5                  |«       t        j'                  t        dt        |«      |«       |j5                  d«       d|vr|j5                  d«       |t:        z   D �]^  }|r||vrŒ|r||v rŒ||v rŒ|j=                  |«       d}||k(  }|xr t?        |«      }|dv r|st        j'                  t        d|«       Œ`|dv r|st        j'                  t        d|«       Œ‚	 tA        |«      }	 |r9|du r5tG        |du r| dt-        d«       n| t        |«      t-        d«       |¬«       ntG        |du r| n| t        |«      d |¬«      }d}!|D ]  }"tM        ||"«      sŒd}! n |!rt        j'                  t        d|"«       �Œ"tO        |sdn
t        |«      |t-        ||z  «      «      }#|xr |duxr t        |«      |k  }$|$rt        j'                  t        d|«       t-        t        |#«      dz  «      }%tQ        |%d«      }%d}&d}'g }(g })	 tS        | ||#||||||«	      D ]g  }*|(j5                  |*«       |)j5                  tU        |*||du xr dt        |«      cxk  xr dk  nc «      «       |)d    |k\  r|&dz  }&|&|%k\  s|sŒb|du sŒg n |'s$|r"|s 	 | t-        d"«      d jW                  |d#¬$«       |)rtY        |)«      t        |)«      z  nd}+|+|k\  s|&|%k\  rm|j5                  |«       t        j'                  t        d&||&t[        |+d'z  d(¬)«      «       |	r-|dd|fv r&|'s$t%        | ||dg ||¬*«      },||k(  r|,}n
|dk(  r|,}n|,}�ŒÞt        j'                  t        d+|t[        |+d'z  d(¬)«      «       |st]        |«      }-nt_        |«      }-|-r3t        j'                  t        d,j	                  |tG        |-«      «      «       g }.|dk7  r8|(D ]3  }*ta        |*||-rd-j)                  |-«      nd«      }/|.j5                  |/«       Œ5 tc        |.«      }0|0r*t        j'                  t        d.j	                  |0|«      «       t%        | ||+||0|du s||ddfv r|nd|¬*«      }1|j5                  |1«       ||ddfv ry|+d/k  rt|+dk(  r^t        j                  d0|1jd                  «       |r.t        j                  t        «       t        j                  
«       t#        |1g«      c S |j5                  |1«       t        |«      r||�||v rvd|v rrd|v rn|jg                  «       }2t        j                  d0|2jd                  «       |r.t        j                  t        «       t        j                  
«       t#        |2g«      c S ||k(  s�Œ
t        j                  d1|«       |r.t        j                  t        «       t        j                  
«       t#        ||   g«      c S  t        |«      dk(  rÆ|s|s|rt        j'                  t        d2«       |r2t        j                  d3|jd                  «       |j5                  |«       nr|r|�|r|r|jh                  |jh                  k7  s|�'t        j                  d4«       |j5                  |«       n(|r&t        j                  d5«       |j5                  |«       |r<t        j                  d6|jg                  «       jd                  t        |«      dz
  «       nt        j                  d7«       |r.t        j                  t        «       t        j                  
«       |S c c}w c c}w # tB        tD        f$ r t        j'                  t        d|«       Y �Œòw xY w# tH        tJ        f$ rQ} t        | tJ        «      s%t        j'                  t        d|tG        | «      «       |j5                  |«       Y d} ~ �ŒQd} ~ ww xY w# tH        $ r4} t        j'                  t        d!|tG        | «      «       |%}&d}'Y d} ~ �Œkd} ~ ww xY w# tH        $ rA} t        j'                  t        d%|tG        | «      «       |j5                  |«       Y d} ~ �ŒÞd} ~ ww xY w)8af  
    Given a raw bytes sequence, return the best possibles charset usable to render str objects.
    If there is no results, it is a strong indicator that the source is binary/not text.
    By default, the process will extract 5 blocks of 512o each to assess the mess and coherence of a given sequence.
    And will give up a particular code page after 20% of measured mess. Those criteria are customizable at will.

    The preemptive behavior DOES NOT replace the traditional detection workflow, it prioritize a particular code page
    but never take it for granted. Can improve the performance.

    You may want to focus your attention to some code page or/and not others, use cp_isolation and cp_exclusion for that
    purpose.

    This function will strip the SIG in the payload/sequence every time except on UTF-16, UTF-32.
    By default the library does not setup any handler other than the NullHandler, if you choose to set the 'explain'
    toggle to True it will alter the logger configuration to add a StreamHandler that is suitable for debugging.
    Custom logging format and handler can be set manually.
    z3Expected object of type bytes or bytearray, got: {}r   z<Encoding detection on empty bytes, assuming utf_8 intention.Úutf_8g        FÚ Nz`cp_isolation is set. use this flag for debugging purpose. limited list of encoding allowed : %s.z, zacp_exclusion is set. use this flag for debugging purpose. limited list of encoding excluded : %s.z^override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.r   z>Trying to detect encoding from a tiny portion of ({}) byte(s).zIUsing lazy str decoding because the payload is quite large, ({}) byte(s).z@Detected declarative mark in sequence. Priority +1 given for %s.zIDetected a SIG or BOM mark on first %i byte(s). Priority +1 given for %s.Úascii>   Úutf_16Úutf_32z\Encoding %s won't be tested as-is because it require a BOM. Will try some sub-encoder LE/BE.>   Úutf_7zREncoding %s won't be tested as-is because detection is unreliable without BOM/SIG.z2Encoding %s does not provide an IncrementalDecoderg    €„A)Úencodingz9Code page %s does not fit given bytes sequence at ALL. %sTzW%s is deemed too similar to code page %s and was consider unsuited already. Continuing!zpCode page %s is a multi byte encoding table and it appear that at least one character was encoded using n-bytes.é   é   éÿÿÿÿzaLazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %sg     jè@Ústrict)Úerrorsz^LazyStr Loading: After final lookup, code page %s does not fit given bytes sequence at ALL. %szc%s was excluded because of initial chaos probing. Gave up %i time(s). Computed mean chaos is %f %%.éd   é   )Úndigits)Úpreemptive_declarationz=%s passed initial chaos probing. Mean measured chaos is %f %%z&{} should target any language(s) of {}ú,z We detected language {} using {}çš™™™™™¹?z.Encoding detection: %s is most likely the one.zoEncoding detection: %s is most likely the one as we detected a BOM or SIG within the beginning of the sequence.zONothing got out of the detection process. Using ASCII/UTF-8/Specified fallback.z7Encoding detection: %s will be used as a fallback matchz:Encoding detection: utf_8 will be used as a fallback matchz:Encoding detection: ascii will be used as a fallback matchz]Encoding detection: Found %s as plausible (best-candidate) for content. With %i alternatives.z=Encoding detection: Unable to determine any suitable charset.)5Ú
isinstanceÚ	bytearrayÚbytesÚ	TypeErrorÚformatÚtypeÚloggerÚlevelÚ
addHandlerÚexplain_handlerÚsetLevelr   ÚlenÚdebugÚremoveHandlerÚloggingÚWARNINGr   r   ÚlogÚjoinr   Úintr   r   r   ÚappendÚsetr   r   Úaddr   r   ÚModuleNotFoundErrorÚImportErrorÚstrÚUnicodeDecodeErrorÚLookupErrorr   ÚrangeÚmaxr   r   ÚdecodeÚsumÚroundr   r	   r   r
   r!   ÚbestÚfingerprint)3Ú	sequencesÚstepsÚ
chunk_sizeÚ	thresholdÚcp_isolationÚcp_exclusionÚpreemptive_behaviourÚexplainÚlanguage_thresholdÚenable_fallbackÚprevious_logger_levelÚlengthÚcpÚis_too_small_sequenceÚis_too_large_sequenceÚprioritized_encodingsÚspecified_encodingÚtestedÚtested_but_hard_failureÚtested_but_soft_failureÚfallback_asciiÚfallback_u8Úfallback_specifiedÚresultsÚearly_stop_resultsÚsig_encodingÚsig_payloadÚencoding_ianaÚdecoded_payloadÚbom_or_sig_availableÚstrip_sig_or_bomÚis_multi_byte_decoderÚeÚsimilar_soft_failure_testÚencoding_soft_failedÚr_Úmulti_byte_bonusÚmax_chunk_gave_upÚearly_stop_countÚlazy_str_hard_failureÚ	md_chunksÚ	md_ratiosÚchunkÚmean_mess_ratioÚfallback_entryÚtarget_languagesÚ	cd_ratiosÚchunk_languagesÚcd_ratios_mergedÚcurrent_matchÚprobable_results3                                                      úT/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/charset_normalizer/api.pyÚ
from_bytesrƒ   !   sZ  € ô< �i¤)¬UÐ!3Ô4ÜØA×HÑHÜ�Y“óó
ð 	
ñ Ü%+§\¡\ÐÜ×Ñœ/Ô*Ü�‰œÔä�i“.€Fà�‚{Ü�‰ÐSÔTÙÜ× Ñ ¤Ô1Ü�O‰OÐ1ÒD´W·_±_ÔEÜœ|¨I°wÀÀUÈBÐPRÓSÐTÓUÐUàÐÜ�
‰
Üð5à�I‰I�lÓ#ô		
ð 8DÖD°œ	 " eÕ,ÐDˆÑDàˆàÐÜ�
‰
Üð6à�I‰I�lÓ#ô		
ð 8DÖD°œ	 " eÕ,ÐDˆÑDàˆà�*˜uÑ$Ò%Ü�
‰
ÜØlØØØô	
ð ˆØˆ
àˆq‚y�V˜e‘^ jÒ0Ü˜ %™Ó(ˆ
ä"% i£.Ô3EÑ"EÐÜ"% i£.Ô4DÑ"DÐáÜ�
‰
ÜØL×SÑSØóõ	
ñ 
Ü�
‰
ÜØW×^Ñ^Øóô	
ð (*Ðñ .BÔ˜yÔ)Àtð ð Ð%Ø×$Ñ$Ð%7Ô8Ü�
‰
ÜØNØô	
ô “u€FØ)+ÐØ)+Ðà*.€NØ'+€KØ.2Ðä,Ó.€Gä)7Ó)9Ðä 3°IÓ >Ñ€L�+àÐØ×$Ñ$ \Ô2Ü�
‰
ÜØWÜ�ÓØô		
ð × Ñ  Ô)àÐ+Ñ+Ø×$Ñ$ WÔ-à.´Ñ?ó ~<ˆÙ˜M°Ñ=Øá˜M¨\Ñ9Øà˜FÑ"Øà�
‰
�=Ô!à&*ˆØ%1°]Ñ%BÐØ!5ò "
Ô:QØó;
Ðð Ð0Ñ0Ñ9MÜ�J‰JÜØnØôð
 Ø˜IÑ%Ñ.BÜ�J‰JÜØdØôð
 ð	Ü*@ÀÓ*OÐ!ð	Ù$Ð)>À%Ñ)GÜð ,¨uÑ4ð " +¤C¨£IÑ.à&¤s¨;Ó'7¼#¸d»)ÐDà*öô #&ð ,¨uÑ4ñ "à&¤s¨;Ó'7Ð'9Ð:à*ô#�ð& +0Ð!à$;ò 	Ð Ü˜]Ð,@ÕAØ,0Ð)Ùð	ñ
 %Ü�J‰JÜØiØØ$ô	ñ äÙ)‰A¬s°;Ó/?ØÜ�˜‘Óó
ˆð "ò .Ø tÐ+ò.ä�OÓ$ vÑ-ð 	ñ Ü�J‰JÜð-àô	ô "%¤S¨£W¨q¡[Ó!1ÐäÐ 1°1Ó5ÐØ !ÐØ %Ðà!ˆ	Øˆ	ð'	)Ü,ØØØØØ$Ø ØØ%Øó
ò �ð × Ñ  Ô'à× Ñ ÜØØ!Ø 4˜ÒG¨A´°\Ó1BÖ,GÀaÔ,Góôð ˜R‘= IÒ-Ø$¨Ñ)Ð$à$Ð(9Ò9Ú(Ð-=ÀÒ-Fáð7ñV &Ù%Ù)ð
Øœ#˜d›)˜+Ð&×-Ñ-¨mÀHÐ-ÔMñ EN¤ Y£´#°i³.Ò!@ÐSVˆØ˜iÒ'Ð+;Ð?PÒ+PØ#×*Ñ*¨=Ô9Ü�J‰JÜð0àØ Ü�o¨Ñ+°QÔ7ôñ  Ø! g¨wÐ8JÐ%KÑKÙ-ä!-ØØ!ØØØØ#Ø+=ô"�ð !Ð$6Ò6Ø)7Ñ&Ø" gÒ-Ø%3‘Nà"0�KÙä�
‰
ÜØKØÜ�/ CÑ'°Ô3ô		
ñ %Ü*<¸]Ó*KÑä4°]ÓCÐáÜ�J‰JÜØ8×?Ñ?Ø!¤3Ð'7Ó#8óôð ˆ	ð ˜GÒ#Ø"ò 2�Ü"1ØØ&Ù2B�C—H‘HÐ-Ô.Èó#�ð × Ñ  Õ1ð2ô 2°)Ó<ÐáÜ�J‰JÜØ2×9Ñ9Ø$ móôô %ØØØØ Øð *¨UÑ2Ø$Ð);¸WÀgÐ(NÑNñ  ð
 à#5ô
ˆð" 	�‰�}Ô%ð Ð0°'¸7ÐCÑCØ #Ò%ð  #Ò%Ü—‘ØDØ!×*Ñ*ôñ Ü×(Ñ(¬Ô9Ü—O‘OÐ$9Ô:Ü% } oÓ6Ò6à×%Ñ% mÔ4ô Ð"Ô#Ø#Ð+Ð/AÀVÑ/KØ˜6Ñ!Ø˜6Ñ!à,>×,CÑ,CÓ,EˆOÜ�L‰LØ@Ø×(Ñ(ôñ Ü×$Ñ$¤_Ô5Ü—‘Ð 5Ô6ä! ?Ð"3Ó4Ò4à˜LÔ(Ü�L‰Lð1àôñ
 Ü×$Ñ$¤_Ô5Ü—‘Ð 5Ô6Ü! 7¨=Ñ#9Ð":Ó;Ò;ð}	~<ô@
 ˆ7ƒ|�qÒÙ™.Ñ,>Ü�J‰JÜØaôñ
 Ü�L‰LØIØ"×+Ñ+ôð �N‰NÐ-Õ.á˜^Ð3áÙ"Ø×+Ñ+¨~×/IÑ/IÒIàÐ'ä�L‰LÐUÔVØ�N‰N˜;Õ'ÙÜ�L‰LÐUÔVØ�N‰N˜>Ô*áÜ�‰ØkØ�L‰L‹N×#Ñ#Ü�‹L˜1Ñõ	
ô 	�‰ÐTÔUáÜ×Ñœ_Ô-Ü�‰Ð-Ô.à€NùòE Eùò Eøôb $¤[Ð1ò 	Ü�J‰JÜØDØôò
 ð	ûô6 #¤KÐ0ò 		Ü˜a¤Ô-Ü—
‘
ÜØOØ!Ü˜“Fô	ð $×*Ñ*¨=Ô9Ýûð		ûôl ò
	)ô �J‰JÜØsØÜ�A“ô	ð  1ÐØ$(Ö!ûð
	)ûô* &ò Ü—
‘
ÜØtØ!Ü˜“Fô	ð (×.Ñ.¨}Ô=Ýûðúsu   Ä/g%Å7g*Î-g/Î9Ah ÓA4jÕjÕjÕkç/*hèhè j è/Ai;é;j ê	k ê)j;ê;k ë	lë6lìlc
                óF   — t        | j                  «       |||||||||	«
      S )z†
    Same thing than the function from_bytes but using a file pointer that is already ready.
    Will not close the file pointer.
    )rƒ   Úread)
ÚfprP   rQ   rR   rS   rT   rU   rV   rW   rX   s
             r‚   Úfrom_fpr‡      s5   € ô  Ø
�‰‹	ØØØØØØØØØóð ó    c
                ón   — t        | d«      5 }
t        |
|||||||||	«
      cddd«       S # 1 sw Y   yxY w)z•
    Same thing than the function from_bytes but with one extra step. Opening and reading given file path in binary mode.
    Can raise IOError.
    ÚrbN)Úopenr‡   )ÚpathrP   rQ   rR   rS   rT   rU   rV   rW   rX   r†   s              r‚   Ú	from_pathr�   >  sK   € ô  
ˆd�DÓ	ð 
˜RÜØØØØØØØ ØØØó
÷
÷ 
ò 
ús   �+«4c
                óê   — t        | t        t        f«      rt        | |||||||||	¬«
      }
|
 S t        | t        t
        f«      rt        | |||||||||	¬«
      }
|
 S t        | |||||||||	¬«
      }
|
 S )a)  
    Detect if the given input (file, bytes, or path) points to a binary file. aka. not a string.
    Based on the same main heuristic algorithms and default kwargs at the sole exception that fallbacks match
    are disabled to be stricter around ASCII-compatible but unlikely to be a string.
    )	rP   rQ   rR   rS   rT   rU   rV   rW   rX   )r-   rE   r   r�   r/   r.   rƒ   r‡   )Úfp_or_path_or_payloadrP   rQ   rR   rS   rT   rU   rV   rW   rX   Úguessess              r‚   Ú	is_binaryr‘   ]  sÇ   € ô" Ð'¬#¬x¨Ô9ÜØ!ØØ!ØØ%Ø%Ø!5ØØ1Ø+ô
ˆðZ ˆ;ÐôC 
ØäÜð	
ô
ô Ø!ØØ!ØØ%Ø%Ø!5ØØ1Ø+ô
ˆð4 ˆ;Ðô Ø!ØØ!ØØ%Ø%Ø!5ØØ1Ø+ô
ˆð ˆ;Ðrˆ   )	é   é   çš™™™™™É?NNTFr,   T)rO   zbytes | bytearrayrP   r?   rQ   r?   rR   ÚfloatrS   úlist[str] | NonerT   r–   rU   ÚboolrV   r—   rW   r•   rX   r—   Úreturnr   )r†   r   rP   r?   rQ   r?   rR   r•   rS   r–   rT   r–   rU   r—   rV   r—   rW   r•   rX   r—   r˜   r   )rŒ   zstr | bytes | PathLikerP   r?   rQ   r?   rR   r•   rS   r–   rT   r–   rU   r—   rV   r—   rW   r•   rX   r—   r˜   r   )	r’   r“   r”   NNTFr,   F)r�   z!PathLike | str | BinaryIO | bytesrP   r?   rQ   r?   rR   r•   rS   r–   rT   r–   rU   r—   rV   r—   rW   r•   rX   r—   r˜   r—   )(Ú
__future__r   r;   Úosr   Útypingr   Úcdr   r   r	   r
   Úconstantr   r   r   r   Úmdr   Úmodelsr   r   Úutilsr   r   r   r   r   r   r   Ú	getLoggerr3   ÚStreamHandlerr6   ÚsetFormatterÚ	Formatterrƒ   r‡   r�   r‘   © rˆ   r‚   ú<module>r¦      s¼  ðÝ "ã Ý Ý ÷ó ÷ RÓ QÝ ß 0÷÷ ñ ð 
ˆ×	Ñ	Ð/Ó	0€Ø'�'×'Ñ'Ó)€Ø × Ñ Ø€G×ÑÐAÓBôð ØØØ%)Ø%)Ø!%ØØ #Ø ð|Ø ð|àð|ð ð|ð ð	|ð
 #ð|ð #ð|ð ð|ð ð|ð ð|ð ð|ð ó|ðB ØØØ%)Ø%)Ø!%ØØ #Ø ðØðàðð ðð ð	ð
 #ðð #ðð ðð ðð ðð ðð óð@ ØØØ%)Ø%)Ø!%ØØ #Ø ð
Ø
 ð
àð
ð ð
ð ð	
ð
 #ð
ð #ð
ð ð
ð ð
ð ð
ð ð
ð ó
ðB ØØØ%)Ø%)Ø!%ØØ #Ø!ð?Ø<ð?àð?ð ð?ð ð	?ð
 #ð?ð #ð?ð ð?ð ð?ð ð?ð ð?ð 
ô?rˆ   