�
K�g�8 � � � d dl mZmZmZ d dlmZ ddlmZmZm Z dZ
ee� � df eee d dfhz � � df eee d d fe d d
fhz � � df ee d dfe d dfg� � df ee d dfe d d
fg� � dfd�Z G d� de
� � Z G d� de� � Z G d� de
� � ZdS )� )�absolute_import�division�unicode_literals)� text_type� )�scopingElements�tableInsertModeElements�
namespacesNF�html�button�ol�ul�table�optgroup�optionT)Nr �listr �selectc �P � e Zd ZdZd� Zd� Zd� Zd� Zd
d�Zd� Z d � Z
d
� Zd� Zd� Z
dS )�NodezRepresents an item in the treec �Z � || _ d| _ d| _ i | _ g | _ g | _ dS )zRCreates a Node
:arg name: The tag name associated with the node
N)�name�parent�value�
attributes�
childNodes�_flags)�selfr s �j/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/html5lib/treebuilders/base.py�__init__z
Node.__init__ s4 � � �� ������
���� �������� c � � d� d� | j � � � D � � � � }|rd| j �d|�d�S d| j z S )N� c �$ � g | ]
\ }}|�d |�d���S )z="�"� )�.0r r s r �
<listcomp>z Node.__str__.<locals>.<listcomp>. s9 � � ";� ";� ";�&1�d�E� 26���u�u�u�"=� ";� ";� ";r �<�>�<%s>)�joinr �itemsr )r �
attributesStrs r �__str__zNode.__str__- sp � ���� ";� ";�"&�/�"7�"7�"9�"9�";� ";� ";� <� <�
� � (� (� $� � � �=�=�=�9�9��T�Y�'�'r c � � d| j z S )Nr* )r �r s r �__repr__z
Node.__repr__6 s � ����#�#r c � � t �)z[Insert node as a child of the current node
:arg node: the node to insert
��NotImplementedError�r �nodes r �appendChildzNode.appendChild9 �
� � "�!r Nc � � t �)aB Insert data as text in the current node, positioned before the
start of node insertBefore or to the end of the node's text.
:arg data: the data to insert
:arg insertBefore: True if you want to insert the text before the node
and False if you want to insert it after the node
r3 )r �data�insertBefores r �
insertTextzNode.insertTextA �
� � "�!r c � � t �)a Insert node as a child of the current node, before refNode in the
list of child nodes. Raises ValueError if refNode is not a child of
the current node
:arg node: the node to insert
:arg refNode: the child node to insert the node before
r3 )r r6 �refNodes r r; zNode.insertBeforeM r= r c � � t �)zhRemove node from the children of the current node
:arg node: the child node to remove
r3 r5 s r �removeChildzNode.removeChildY r8 r c �R � | j D ]}|� |� � �g | _ dS )z�Move all the children of the current node to newParent.
This is needed so that trees that don't store text as nodes move the
text in the correct way
:arg newParent: the node to move all this node's children to
N)r r7 )r � newParent�childs r �reparentChildrenzNode.reparentChildrena s7 � � �_� )� )�E��!�!�%�(�(�(�(�����r c � � t �)z�Return a shallow copy of the current node i.e. a node with the same
name and attributes but with no parent or child nodes
r3 r0 s r � cloneNodezNode.cloneNoden s
� � "�!r c � � t �)zFReturn true if the node has children or text, false otherwise
r3 r0 s r �
hasContentzNode.hasContentt s
� � "�!r �N)�__name__�
__module__�__qualname__�__doc__r r. r1 r7 r<