+
    	iJ                         ^ RI Ht ^RIHtHtHtHt ^RIHt RR lt	R t
RR ltRR ltR tRR	 ltR
 tR tRR ltRR ltRR ltRR ltRR ltR tR tR tRR ltR# )    )chain)AtRuleDeclaration
ParseErrorQualifiedRule)parse_component_value_listc                Z    \        V \        4      '       d   \        W4      p \        V 4      # )aY  Iterate component values out of string or component values iterable.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments: If the input is a string, ignore all CSS comments.
:returns: An iterator yielding :term:`component values`.

)
isinstancestrr   iter)inputskip_commentss   &&U/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/tinycss2/parser.py_to_token_iteratorr      s%     %*5@;    c                B    V  F  pVP                   R9  g   K  Vu # 	  R# )zReturn the next significant (neither whitespace or comment) token.

:type tokens: :term:`iterator`
:param tokens: An iterator yielding :term:`component values`.
:returns: A :term:`component value`, or :obj:`None`.

N
whitespacecomment)type)tokenstokens   & r   _next_significantr      s      ::66L r   c                    \        W4      p\        V4      p\        V4      pVf   \        ^^RR4      # Ve#   \        VP                  VP                  RR4      # V# )a  Parse a single :diagram:`component value`.

This is used e.g. for an attribute value
referred to by ``attr(foo length)``.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments: If the input is a string, ignore all CSS comments.
:returns:
    A :term:`component value` (that is neither whitespace or comment),
    or a :class:`~tinycss2.ast.ParseError`.

emptyInput is emptyextra-inputzGot more than one token)r   r   r   source_linesource_column)r   r   r   firstseconds   &&   r   parse_one_component_valuer"   #   si      5Ff%Ev&F}!Q)9:: 4 4m%' 	' r   c                h    \        W4      p\        V4      pVf   \        ^^RR4      # \        W24      # )a  Parse a single :diagram:`declaration`.

This is used e.g. for a declaration in an `@supports
<https://drafts.csswg.org/css-conditional/#at-supports>`_ test.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments: If the input is a string, ignore all CSS comments.
:returns:
    A :class:`~tinycss2.ast.Declaration`
    or :class:`~tinycss2.ast.ParseError`.

Any whitespace or comment before the ``:`` colon is dropped.

r   r   )r   r   r   _parse_declaration)r   r   r   first_tokens   &&  r   parse_one_declarationr&   ?   s;    "  5F#F+K!Q)9::k22r   c                 T    V  F!  pVR 8X  d    R# V'       g   K  VR8X  g   K    R# 	  R# );N} )r   nestedr   s   && r   _consume_remnantsr,   W   s$    C<V	 r   c           	        T pVP                   R8w  d<   \        W4       \        VP                  VP                  RRVP                    R24      # \        V4      pVf.   \        W4       \        VP                  VP                  RR4      # VR8w  d.   \        W4       \        VP                  VP                  RR4      # . pR	pR
pR
p\        V4       F  w  rVR	8X  d   V
R8X  d   RpT	pM`VR8X  d&   V
P                   R8X  d   V
P                  R8X  d   RpM4V
P                   R9  d$   R	pV
P                   R8X  d   V'       d   RpMRpMRpVP                  V
4       K  	  VR8X  d   VXR1 V'       d+   V'       d#   \        VP                  VP                  RR4      # \        VP                  VP                  VP                  VP                  WVR8H  4      # )a  Parse a declaration.

Consume :obj:`tokens` until the end of the declaration or the first error.

:type first_token: :term:`component value`
:param first_token: The first component value of the rule.
:type tokens: :term:`iterator`
:param tokens: An iterator yielding :term:`component values`.
:type nested: :obj:`bool`
:param nested: Whether the declaration is nested or top-level.
:returns:
    A :class:`~tinycss2.ast.Declaration`
    or :class:`~tinycss2.ast.ParseError`.

identinvalidz+Expected <ident> for declaration name, got .Nz,Expected ':' after declaration name, got EOF:z6Expected ':' after declaration name, got {colon.type}.valueF!bang	important{} blockTzDeclaration contains {} blockr   )r   r,   r   r   r   r   	enumeratelower_valueappendr   r2   )r%   r   r+   namecolonr2   statecontains_non_whitespacecontains_simple_blockir   bang_positions   &&&         r   r$   r$   _   s     DyyG&)d00)9$))AFH 	H f%E}&)d00):< 	< 
#&)u22IDF 	F EE#!f%GEMvo%**"7%%4EZZ88EzzZ'*,0).2+*.'U! &$ -.! !8u22I+- 	- $,,djj$:J:J#% %r   c                P   . p. pV R8w  dY   V P                   R8w  dH   V FA  pVR8X  d   VP                  V4        M(VP                  V4       VP                   R8X  g   KA   M	  \        V \        V4      RR7      pVP                   R8X  d   V# \	        W#V4      p\        WRRR7      # )z#Consume declaration or nested rule.r(   r6   T)r+   declaration)
stop_tokenr+   )r   r9   r$   r   r   _consume_qualified_rule)r%   r   declaration_tokenssemicolon_tokenr   rB   s   &&    r   _consume_blocks_contentrG      s    Ock..*<E|&&u-%%e,zzZ'  %T,-d<K=()FC&{sSWXXr   c                v    . pV F  pVR8X  d    MVP                  V4       K  	  \        V \        V4      4      # )zyLike :func:`_parse_declaration`, but stop at the first ``;``.

Deprecated, use :func:`_consume_blocks_content` instead.

r(   )r9   r$   r   )r%   r   other_declaration_tokensr   s   &&  r   _consume_declaration_in_listrJ      sA      "C< ''.  k40H+IJJr   c                   \        W4      p. pV F  pVP                  R8X  d   V'       g   VP                  V4       K/  K1  VP                  R8X  d   V'       g   VP                  V4       K]  K_  VP                  R8X  d   VP                  \        WS4      4       K  VR8w  g   K  VP                  \	        WS4      4       K  	  V# )u  Parse a block’s contents.

This is used e.g. for the :attr:`~tinycss2.ast.QualifiedRule.content`
of a style rule or ``@page`` rule, or for the ``style`` attribute of an
HTML element.

In contexts that don’t expect any at-rule and/or qualified rule,
all :class:`~tinycss2.ast.AtRule` and/or
:class:`~tinycss2.ast.QualifiedRule` objects should simply be rejected as
invalid.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments:
    Ignore CSS comments at the top-level of the list.
    If the input is a string, ignore all comments.
:type skip_whitespace: :obj:`bool`
:param skip_whitespace:
    Ignore whitespace at the top-level of the list.
    Whitespace is still preserved
    in the :attr:`~tinycss2.ast.Declaration.value` of declarations
    and the :attr:`~tinycss2.ast.AtRule.prelude`
    and :attr:`~tinycss2.ast.AtRule.content` of at-rules.
:returns:
    A list of
    :class:`~tinycss2.ast.Declaration`,
    :class:`~tinycss2.ast.AtRule`,
    :class:`~tinycss2.ast.QualifiedRule`,
    :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
    :class:`~tinycss2.ast.WhitespaceToken`
    (if ``skip_whitespace`` is false),
    and :class:`~tinycss2.ast.ParseError` objects

r   r   
at-keywordr(   )r   r   r9   _consume_at_rulerG   r   r   skip_whitespacer   resultr   s   &&&   r   parse_blocks_contentsrQ      s    H  5FF::%"e$ #ZZ9$ e$ !ZZ<'MM*59:c\MM1%@A  Mr   c                   \        W4      p. pV F  pVP                  R8X  d   V'       g   VP                  V4       K/  K1  VP                  R8X  d   V'       g   VP                  V4       K]  K_  VP                  R8X  d   VP                  \        WS4      4       K  VR8w  g   K  VP                  \	        WS4      4       K  	  V# )u9  Parse a :diagram:`declaration list` (which may also contain at-rules).

Deprecated and removed from CSS Syntax Level 3. Use
:func:`parse_blocks_contents` instead.

This is used e.g. for the :attr:`~tinycss2.ast.QualifiedRule.content`
of a style rule or ``@page`` rule, or for the ``style`` attribute of an
HTML element.

In contexts that don’t expect any at-rule, all
:class:`~tinycss2.ast.AtRule` objects should simply be rejected as invalid.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments:
    Ignore CSS comments at the top-level of the list.
    If the input is a string, ignore all comments.
:type skip_whitespace: :obj:`bool`
:param skip_whitespace:
    Ignore whitespace at the top-level of the list.
    Whitespace is still preserved
    in the :attr:`~tinycss2.ast.Declaration.value` of declarations
    and the :attr:`~tinycss2.ast.AtRule.prelude`
    and :attr:`~tinycss2.ast.AtRule.content` of at-rules.
:returns:
    A list of
    :class:`~tinycss2.ast.Declaration`,
    :class:`~tinycss2.ast.AtRule`,
    :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
    :class:`~tinycss2.ast.WhitespaceToken`
    (if ``skip_whitespace`` is false),
    and :class:`~tinycss2.ast.ParseError` objects

r   r   rL   r(   )r   r   r9   rM   rJ   rN   s   &&&   r   parse_declaration_listrS      s    H  5FF::%"e$ #ZZ9$ e$ !ZZ<'MM*59:c\MM6uEF  Mr   c                    \        W4      p\        V4      pVf   \        ^^RR4      # \        W24      p\        V4      pVe4   \        VP                  VP
                  RRVP                  ,          4      # V# )at  Parse a single :diagram:`qualified rule` or :diagram:`at-rule`.

This would be used e.g. by `insertRule()
<https://drafts.csswg.org/cssom/#dom-cssstylesheet-insertrule>`_
in an implementation of CSSOM.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments:
    If the input is a string, ignore all CSS comments.
:returns:
    A :class:`~tinycss2.ast.QualifiedRule`,
    :class:`~tinycss2.ast.AtRule`,
    or :class:`~tinycss2.ast.ParseError` objects.

Any whitespace or comment before or after the rule is dropped.

r   r   r   z4Expected a single rule, got %s after the first rule.)r   r   r   _consume_ruler   r   r   )r   r   r   r    rulenexts   &&    r   parse_one_rulerX   4  s~    (  5Ff%E}!Q)9::'DV$Dd00-BTYYNP 	P Kr   c                   \        W4      p. pV Fy  pVP                  R8X  d   V'       g   VP                  V4       K/  K1  VP                  R8X  d   V'       g   VP                  V4       K]  K_  VP                  \        WS4      4       K{  	  V# )a  Parse a non-top-level :diagram:`rule list`.

Deprecated and removed from CSS Syntax. Use :func:`parse_blocks_contents`
instead.

This is used for parsing the :attr:`~tinycss2.ast.AtRule.content`
of nested rules like ``@media``.
This differs from :func:`parse_stylesheet` in that
top-level ``<!--`` and ``-->`` tokens are not ignored.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments:
    Ignore CSS comments at the top-level of the list.
    If the input is a string, ignore all comments.
:type skip_whitespace: :obj:`bool`
:param skip_whitespace:
    Ignore whitespace at the top-level of the list.
    Whitespace is still preserved
    in the :attr:`~tinycss2.ast.QualifiedRule.prelude`
    and the :attr:`~tinycss2.ast.QualifiedRule.content` of rules.
:returns:
    A list of
    :class:`~tinycss2.ast.QualifiedRule`,
    :class:`~tinycss2.ast.AtRule`,
    :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
    :class:`~tinycss2.ast.WhitespaceToken`
    (if ``skip_whitespace`` is false),
    and :class:`~tinycss2.ast.ParseError` objects.

r   r   r   r   r9   rU   rN   s   &&&   r   parse_rule_listr[   V  sx    B  5FF::%"e$ #ZZ9$ e$ ! MM-67  Mr   c                0   \        W4      p. pV F  pVP                  R8X  d   V'       g   VP                  V4       K/  K1  VP                  R8X  d   V'       g   VP                  V4       K]  K_  VR9  g   Kh  VP                  \        WS4      4       K  	  V# )aN  Parse :diagram:`stylesheet` from text.

This is used e.g. for a ``<style>`` HTML element.

This differs from :func:`parse_rule_list` in that
top-level ``<!--`` and ``-->`` tokens are ignored.
This is a legacy quirk for the ``<style>`` HTML element.

:type input: :obj:`str` or :term:`iterable`
:param input: A string or an iterable of :term:`component values`.
:type skip_comments: :obj:`bool`
:param skip_comments:
    Ignore CSS comments at the top-level of the stylesheet.
    If the input is a string, ignore all comments.
:type skip_whitespace: :obj:`bool`
:param skip_whitespace:
    Ignore whitespace at the top-level of the stylesheet.
    Whitespace is still preserved
    in the :attr:`~tinycss2.ast.QualifiedRule.prelude`
    and the :attr:`~tinycss2.ast.QualifiedRule.content` of rules.
:returns:
    A list of
    :class:`~tinycss2.ast.QualifiedRule`,
    :class:`~tinycss2.ast.AtRule`,
    :class:`~tinycss2.ast.Comment` (if ``skip_comments`` is false),
    :class:`~tinycss2.ast.WhitespaceToken`
    (if ``skip_whitespace`` is false),
    and :class:`~tinycss2.ast.ParseError` objects.

r   r   )z<!--z-->rZ   rN   s   &&&   r   parse_stylesheetr]     s}    >  5FF::%"e$ #ZZ9$ e$ !/)MM-67  Mr   c                P    V P                   R8X  d   \        W4      # \        W4      # )a  Parse a qualified rule or at-rule.

Consume just enough of :obj:`tokens` for this rule.

:type first_token: :term:`component value`
:param first_token: The first component value of the rule.
:type tokens: :term:`iterator`
:param tokens: An iterator yielding :term:`component values`.
:returns:
    A :class:`~tinycss2.ast.QualifiedRule`,
    :class:`~tinycss2.ast.AtRule`,
    or :class:`~tinycss2.ast.ParseError`.

rL   )r   rM   rD   )r%   r   s   &&r   rU   rU     s(     <'44";77r   c                    . pRpV F<  pVP                   R8X  d   VP                  p MVR8X  d    MVP                  V4       K>  	  \        V P                  V P
                  V P                  V P                  W#4      # )a  Parse an at-rule.

Consume just enough of :obj:`tokens` for this rule.

:type at_keyword: :class:`AtKeywordToken`
:param at_keyword: The at-rule keyword token starting this rule.
:type tokens: :term:`iterator`
:param tokens: An iterator yielding :term:`component values`.
:type nested: :obj:`bool`
:param nested: Whether the at-rule is nested or top-level.
:returns:
    A :class:`~tinycss2.ast.QualifiedRule`,
    or :class:`~tinycss2.ast.ParseError`.

Nr6   r(   )r   contentr9   r   r   r   r2   r8   )
at_keywordr   preluder`   r   s   &&   r   rM   rM     s{      GG::# mmGc\u  
 8 8*:J:J2 2r   c                L    \        V P                  V P                  RV R24      # )z6Create rule parse error raised because of given token.r/   z. reached before {} block for a qualified rule.)r   r   r   )r   r:   s   &&r   _rule_errorrd     s/    5..	&@AC Cr   Nc                Z   W8X  d   \        V R4      # V P                  R8X  d   . pT pMYV .pV F=  pWc8X  d   \        VR4      u # VP                  R8X  d   Tp M(VP                  V4       K?  	  \        VR,          R4      # \        V P                  V P
                  WEP                  4      # )a  Consume a qualified rule.

Consume just enough of :obj:`tokens` for this rule.

:type first_token: :term:`component value`
:param first_token: The first component value of the rule.
:type tokens: :term:`iterator`
:param tokens: An iterator yielding :term:`component values`.
:type nested: :obj:`bool`
:param nested: Whether the rule is nested or top-level.
:type stop_token: :class:`~tinycss2.ast.Node`
:param stop_token: A token that ends rule parsing when met.

z
Stop tokenr6   EOF)rd   r   r9   r   r   r   r`   )r%   r   r+   rC   rb   blockr   s   &&&&   r   rD   rD     s       ;55:%-E""5,77zzZ' NN5!  wr{E22!:!:G]]T Tr   )F)T)FF)FN)	itertoolsr   astr   r   r   r   	tokenizerr   r   r   r"   r&   r,   r$   rG   rJ   rQ   rS   rX   r[   r]   rU   rM   rd   rD   r*   r   r   <module>rl      sr     ? ? 1
830G%TY*K1h1hD,^*Z8(2@C#Tr   