
    ]h""                     t    d Z ddlmZmZmZmZ dgZdZdZddl	m
Z
 ddlZddlZ G d	 de
j                        Zy)
z9CSSUnknownRule implements DOM Level 2 CSS CSSUnknownRule.    )unicode_literalsdivisionabsolute_importprint_functionCSSUnknownRulerestructuredtextz$Id$   )cssruleNc                        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 css_parser.

    Format::

        @xxx until ';' or block {...}
    c                 ^    t         t        |   ||       d| _        |r|| _        || _        y)z<
        :param cssText:
            of type string
        )
parentRuleparentStyleSheetN)superr   __init__
_atkeywordcssText	_readonly)selfr   r   r   readonly	__class__s        /home/pod-website-builder.sw7ft.com/pod-website-builder/website-analyzer/venv/lib/python3.12/site-packages/css_parser/css/cssunknownrule.pyr   zCSSUnknownRule.__init__   s7     	nd,
>N 	- 	P"DL!    c                 P    d| j                   j                  d| j                  dS )Nzcss_parser.css.z	(cssText=))r   __name__r   r   s    r   __repr__zCSSUnknownRule.__repr__%   s     NN##LL 	r   c                 `    d| j                   j                  | j                  t        |       fz  S )Nz-<css_parser.css.%s object cssText=%r at 0x%x>)r   r   r   idr   s    r   __str__zCSSUnknownRule.__str__*   s0    >NN##LLtHB  	r   c                 @    t         j                  j                  |       S )z#Return serialized property cssText.)
css_parserserdo_CSSUnknownRuler   s    r   _getCssTextzCSSUnknownRule._getCssText0   s    ~~//55r   c                 `    t         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seqr3   	tokenizertype_valr5   r6   openingnewr   s            r   CHARz(CSSUnknownRule._setCssText.<locals>.CHARP   s   (-%sD#u$e|I--c2(+#C"@"EG"9~b1W< #I 2 2 4&0l 2 !5 d{3y>#(JJsE#J>#O(-C%IIOO$K*/ $ 1#O  * G05C- IIOO -9@E , GGs   )B% %+CCc                     |\  }}}}	j                  |      }| dk7  r+d   j                  d       |j                  ||||       | S dd<   	j                  j                  d|       | S )	Nr+   r(   r.   r4   Fr)   r7   r2   )_tokenvaluer8   r;   r'   
r<   r=   r3   r>   r?   r@   r5   r6   rB   r   s
           r   FUNCTIONz,CSSUnknownRule._setCssText.<locals>.FUNCTIONl   s~    (-%sD#&&u-u$	N))#.JJsE#J>#O(-C%IIOO$K*/ $ 1#Or   c                 l    t        d         D ]  }dddd|   }|j                  ||        g d<   y)z!close all blocks and return 'EOF'r(   r/   r0   r   )r,   r-   r.   r+   )reversedr8   )r<   r=   r3   r>   xclosingrB   s         r   r+   z'CSSUnknownRule._setCssText.<locals>.EOFz   sH    !#i.1 1A$'c<Q?GJJw01 "$Ir   c                 ~    j                   j                  d|t        j                  j                         dd<   | S )NzCSSUnknownRule: Bad syntax.)r3   r'   Fr)   )r;   r'   xmldom	SyntaxErr)r<   r=   r3   r>   rB   r   s       r   INVALIDz+CSSUnknownRule._setCssText.<locals>.INVALID   s:    		 =&+3773D3D   F$)L!r   c                     |\  }}}}	j                  |      }| dk7  r|j                  ||||       | S dd<   	j                  j                  d|       | S Nr+   r4   Fr)   r7   r2   )_stringtokenvaluer8   r;   r'   rF   s
           r   STRINGz*CSSUnknownRule._setCssText.<locals>.STRING   sl    (-%sD#,,U3u$JJsE#J>#O(-C%IIOO$K*/ $ 1#Or   c                     |\  }}}}	j                  |      }| dk7  r|j                  ||||       | S dd<   	j                  j                  d|       | S rR   )_uritokenvaluer8   r;   r'   rF   s
           r   URIz'CSSUnknownRule._setCssText.<locals>.URI   sl    (-%sD#))%0u$JJsE#J>#O(-C%IIOO$K*/ $ 1#Or   c                     |\  }}}}| dk7  r|j                  ||||       | S dd<   	j                  j                  d|       | S rR   )r8   r;   r'   rF   s
           r   defaultz+CSSUnknownRule._setCssText.<locals>.default   s\    (-%sD#u$JJsE#J>#O(-C%IIOO$K*/ $ 1#Or   )rC   r+   rG   rP   rT   rW   S)r<   r=   r>   productionsrY   rB   r)   r+   Fz.CSSUnknownRule: No ending ";" or "}" found: %rr(   z,CSSUnknownRule: Unclosed "{", "[" or "(": %rN)r   r   _setCssText
_tokenize2
_nexttoken_type_prods	ATKEYWORDr;   r'   	_valuestrrM   rN   InvalidModificationErr_tempSeq_parserE   	atkeyword_setSeq)r   r   r>   attokenrC   rG   r+   rP   rT   rW   rY   newseqr)   r<   rB   r   s   `             @r   r]   zCSSUnknownRule._setCssText4   s    	nd/8OOG,	//)T2$**W-1F1FFIIOOI NN734"%''"@"@  B
 !!%C$8$ 
$
$	$ ]]_F#';;39YDHCFHPGNFLCFAH<> 8?36 $/ $8 J $9L(9J 5 "
		 !%'+~~g'>!? @Y"
		 N"&.."9!: ; !%!1!1'!:V$ r   z*(DOM) The parsable textual representation.)fgetfsetdocc                     | j                   S r\   )UNKNOWN_RULEr   s    r   <lambda>zCSSUnknownRule.<lambda>   s    !2!2 r   z=The type of this rule, as defined by a CSSRule type constant.)rm   c                 ,    t        | j                        S r\   )boolrg   r   s    r   rp   zCSSUnknownRule.<lambda>   s    tDNN'; r   ) NNF)r   
__module____qualname____doc__r   r   r    r%   r]   propertyr   typer)   __classcell__)r   s   @r   r   r      s`     /316"
6W%r KkGIG 2)*D ;<Jr   )rv   
__future__r   r   r   r   __all____docformat____version__rs   r
   r"   xml.domrM   CSSRuler    r   r   <module>r      s;    ? R R
"   G=W__ G=r   