
    i                    V    U d Z ddlmZ ddlmZ dZded<    eddh      Zd	ed
<   ddZ	y)z*Stage 1a: BOM (Byte Order Mark) detection.    )annotations)DetectionResult))     z	utf-32-be)     z	utf-32-le)s   ﻿z	utf-8-sig)s   z	utf-16-be)s   z	utf-16-leztuple[tuple[bytes, str], ...]_BOMSr   r   zfrozenset[bytes]_UTF32_BOMSc                    t         D ]N  \  }}| j                  |      s|t        v r t        |       t        |      z
  }|dz  dk7  r@t	        |dd      c S  y)zCheck for a byte order mark at the start of *data*.

    :param data: The raw byte data to examine.
    :returns: A :class:`DetectionResult` with confidence 1.0, or ``None``.
       r   g      ?N)encoding
confidencelanguage)r   
startswithr   lenr   )data	bom_bytesr   payload_lens       d/Users/bowang/.openclaw/workspace/ChatDev/.venv/lib/python3.12/site-packages/chardet/pipeline/bom.py
detect_bomr      s^      %	8??9%
 K'!$i#i.8?a'"HtTT  %     N)r   bytesreturnzDetectionResult | None)
__doc__
__future__r   chardet.pipeliner   r   __annotations__	frozensetr   r    r   r   <module>r      s;    0 " ,($  !*+>@S*T U Ur   