
     h                      T    d Z dgZddlZddlZddlmZ  G d dej                        Zy)z9CSSUnknownRule implements DOM Level 2 CSS CSSUnknownRule.CSSUnknownRule    N   )cssrulec                        e Zd ZdZ	 d fd	Zd Zd Zd Z fdZ e	eed      Z
 e	d	 d
      Z e	d       Z xZS )r   z
    Represents an at-rule not supported by this user agent, so in
    effect all other at-rules not defined in cssutils.

    Format::

        @xxx until ';' or block {...}
    c                 V    t         |   ||       d| _        |r|| _        || _        y)z<
        :param cssText:
            of type string
        )
parentRuleparentStyleSheetN)super__init__
_atkeywordcssText	_readonly)selfr   r   r	   readonly	__class__s        [/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/cssutils/css/cssunknownrule.pyr   zCSSUnknownRule.__init__   s0     	JAQR"DL!    c                 P    d| j                   j                   d| j                  dS )Nzcssutils.css.z	(cssText=))r   __name__r   r   s    r   __repr__zCSSUnknownRule.__repr__$   s(    t~~667y@PPQRRr   c                 j    d| j                   j                   d| j                  dt        |       ddS )Nz<cssutils.css.z object cssText=z at 0xx>)r   r   r   idr   s    r   __str__zCSSUnknownRule.__str__'   s;     7 788HHXX^_abf_ghi^jjkllr   c                 @    t         j                  j                  |       S )z#Return serialized property cssText.)cssutilsserdo_CSSUnknownRuler   s    r   _getCssTextzCSSUnknownRule._getCssText*   s    ||--d33r   c                 X    t            |        j                  |      } j                  |d      }|r( j	                  |       j
                  j                  k7  rH j                  j                  d j                  |      z  t        j                  j                         yg ddd fd	}d fd	}dfd	}d fd		}d fd
	}d fd	}	d fd	}
 j                         } j                  d||||||||	|
d|
      \  }}|xr d   }|dk7  r0d} j                  j                  d j                  |      z         n4d   r/d} j                  j                  d j                  |      z         |r( j                  |       _         j#                  |       yy)ad  
        :exceptions:
            - :exc:`~xml.dom.SyntaxErr`:
              Raised if the specified CSS string value has a syntax error and
              is unparsable.
            - :exc:`~xml.dom.InvalidModificationErr`:
              Raised if the specified CSS string value represents a different
              type of rule than the current one.
            - :exc:`~xml.dom.HierarchyRequestErr`:
              Raised if the rule cannot be inserted at this point in the
              style sheet.
            - :exc:`~xml.dom.NoModificationAllowedErr`:
              Raised if the rule is readonly.
        Nz+CSSUnknownRule: No CSSUnknownRule found: %s)errorT)nesting
wellformedc                    |\  }}}}| dk7  rs|dv r	d   j                  |       n8|dv r4dddd|   }	 	d   d	   |k(  r	d   j                          n
t               	 |dv r	d   sd} |j                  ||||       | S d
	d<   
j                  j	                  d|       | S # t        $ r% d
	d<   
j                  j	                  d|       Y sw xY w)NEOFz{[(r%   z}]){[()}]r   Fr&   z+CSSUnknownRule: Wrong nesting of {, [ or (.tokenz};linecol%CSSUnknownRule: Expected end of rule.)appendpop
IndexError_logr$   )expectedseqr0   	tokenizertype_valr2   r3   openingnewr   s            r   CHARz(CSSUnknownRule._setCssText.<locals>.CHARI   s   (-%sD#u$e|I--c2(+#C"@"E
"9~b1W< #I 2 2 4&0l 2 !5 d{3y>#(JJsE#J>#O(-C%IIOO?u $  $O#  * 05C- IIOO P&+ , s   )B% %+CCc                     |\  }}}}	j                  |      }| dk7  r+d   j                  d       |j                  ||||       | S dd<   	j                  j                  d|       | S )	Nr(   r%   r+   r1   Fr&   r4   r/   )_tokenvaluer5   r8   r$   
r9   r:   r0   r;   r<   r=   r2   r3   r?   r   s
           r   FUNCTIONz,CSSUnknownRule._setCssText.<locals>.FUNCTIONh   s    (-%sD#&&u-u$	N))#.JJsE#J>#O(-C%IIOO?u $  $Or   c                 l    t        d         D ]  }dddd|   }|j                  ||        g d<   y)z!close all blocks and return 'EOF'r%   r,   r-   r   )r)   r*   r+   r(   )reversedr5   )r9   r:   r0   r;   r   closingr?   s         r   r(   z'CSSUnknownRule._setCssText.<locals>.EOFw   sC    !#i.1A$'c<Q?GJJw0 2 "$Ir   c                 ~    j                   j                  d|t        j                  j                         dd<   | S )NzCSSUnknownRule: Bad syntax.)r0   r$   Fr&   )r8   r$   xmldom	SyntaxErr)r9   r:   r0   r;   r?   r   s       r   INVALIDz+CSSUnknownRule._setCssText.<locals>.INVALID   s:    		1cggFWFW    %*L!r   c                     |\  }}}}	j                  |      }| dk7  r|j                  ||||       | S dd<   	j                  j                  d|       | S Nr(   r1   Fr&   r4   r/   )_stringtokenvaluer5   r8   r$   rC   s
           r   STRINGz*CSSUnknownRule._setCssText.<locals>.STRING   sm    (-%sD#,,U3u$JJsE#J>#O(-C%IIOO?u $  $Or   c                     |\  }}}}	j                  |      }| dk7  r|j                  ||||       | S dd<   	j                  j                  d|       | S rN   )_uritokenvaluer5   r8   r$   rC   s
           r   URIz'CSSUnknownRule._setCssText.<locals>.URI   sm    (-%sD#))%0u$JJsE#J>#O(-C%IIOO?u $  $Or   c                     |\  }}}}| dk7  r|j                  ||||       | S dd<   	j                  j                  d|       | S rN   )r5   r8   r$   rC   s
           r   defaultz+CSSUnknownRule._setCssText.<locals>.default   s]    (-%sD#u$JJsE#J>#O(-C%IIOO?u $  $Or   )r@   r(   rD   rL   rP   rS   S)r9   r:   r;   productionsrU   r?   r&   r(   Fz.CSSUnknownRule: No ending ";" or "}" found: %rr%   z,CSSUnknownRule: Unclosed "{", "[" or "(": %rN)r
   _setCssText
_tokenize2
_nexttoken_type_prods	ATKEYWORDr8   r$   	_valuestrrI   rJ   InvalidModificationErr_tempSeq_parserB   	atkeyword_setSeq)r   r   r;   attokenr@   rD   r(   rL   rP   rS   rU   newseqr&   r9   r?   r   s   `             @r   rY   zCSSUnknownRule._setCssText.   s    	G$OOG,	//)T2$**W-1F1FFIIOO=w@WWgg44   !5C$>$ $$
$ ]]_F#';;#  (&$    $/ $ J$ $9L(9J 5 "
		>>'23 Y"
		BnnW-. !%!1!1'!:V$ r   z*(DOM) The parsable textual representation.)fgetfsetdocc                     | j                   S rX   )UNKNOWN_RULEr   s    r   <lambda>zCSSUnknownRule.<lambda>   s
    T&&r   z=The type of this rule, as defined by a CSSRule type constant.)ri   c                 ,    t        | j                        S rX   )boolrc   r   s    r   rl   zCSSUnknownRule.<lambda>   s    tDNN';r   ) NNF)r   
__module____qualname____doc__r   r   r   r"   rY   propertyr   typer&   __classcell__)r   s   @r   r   r      s`     LQ"Sm4f%P 8G &ND
 ;<Jr   )	rr   __all__xml.domrI   r   ro   r   CSSRuler    r   r   <module>rz      s+    ?
   U=W__ U=r   