o
    ҷh|                     @  s  d dl mZ ddlmZmZ d dlmZ d dlZd dlZddl	m
Z
 ddl	mZ ddl	mZ eG d	d
 d
ZeG dd dZeG dd dZeG dd dZeG dd dZG dd deZG dd deZeG dd dZeG dd dZeG dd dZG dd deZeG dd  d ZeG d!d" d"ZeG d#d$ d$ZeG d%d& d&Zd=d)d*Zd=d+d,Z			d>d?d4d5Z 				d@dAd;d<Z!dS )B    )annotations   )event_classT_JSON_DICT)	dataclassN)dom)dom_debugger)pagec                   @  sf  e Zd ZU dZded< ded< ded< ded< d	Zd
ed< d	Zd
ed< d	Zded< d	Zded< d	Z	ded< d	Z
ded< d	Zded< d	Zded< d	Zd
ed< d	Zd
ed< d	Zd
ed< d	Zd
ed< d	Zd
ed< d	Zd
ed< d	Zded< d	Zded< d	Zd ed!< d	Zd"ed#< d	Zded$< d	Zd%ed&< d	Zd
ed'< d	Zd
ed(< d	Zd)ed*< d	Zd)ed+< d,d- Zed.d/ Zd	S )0DOMNodez!
    A Node in the DOM tree.
    int	node_typestr	node_name
node_valuezdom.BackendNodeIdbackend_node_idNtyping.Optional[str]
text_valueinput_valuetyping.Optional[bool]input_checkedoption_selected!typing.Optional[typing.List[int]]child_node_indexesz'typing.Optional[typing.List[NameValue]]
attributespseudo_element_indexestyping.Optional[int]layout_node_indexdocument_urlbase_urlcontent_languagedocument_encoding	public_id	system_idztyping.Optional[page.FrameId]frame_idcontent_document_indexztyping.Optional[dom.PseudoType]pseudo_typez#typing.Optional[dom.ShadowRootType]shadow_root_typeis_clickablez8typing.Optional[typing.List[dom_debugger.EventListener]]event_listenerscurrent_source_url
origin_urltyping.Optional[float]scroll_offset_xscroll_offset_yc                 C  sR  t  }| j|d< | j|d< | j|d< | j |d< | jd ur#| j|d< | jd ur-| j|d< | jd ur7| j|d< | j	d urA| j	|d< | j
d urPd	d
 | j
D |d< | jd ur_dd
 | jD |d< | jd urndd
 | jD |d< | jd urx| j|d< | jd ur| j|d< | jd ur| j|d< | jd ur| j|d< | jd ur| j|d< | jd ur| j|d< | jd ur| j|d< | jd ur| j |d< | jd ur| j|d< | jd ur| j |d< | jd ur| j |d< | jd ur| j|d< | jd urdd
 | jD |d< | jd ur| j|d< | jd ur| j|d< | jd ur| j|d < | jd ur'| j|d!< |S )"NnodeTypenodeName	nodeValuebackendNodeId	textValue
inputValueinputCheckedoptionSelectedc                 S     g | ]}|qS  r7   .0ir7   r7   g/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/common/devtools/v117/dom_snapshot.py
<listcomp>~       z#DOMNode.to_json.<locals>.<listcomp>childNodeIndexesc                 S     g | ]}|  qS r7   to_jsonr8   r7   r7   r;   r<          r   c                 S  r6   r7   r7   r8   r7   r7   r;   r<      r=   pseudoElementIndexeslayoutNodeIndexdocumentURLbaseURLcontentLanguagedocumentEncodingpublicIdsystemIdframeIdcontentDocumentIndex
pseudoTypeshadowRootTypeisClickablec                 S  r?   r7   r@   r8   r7   r7   r;   r<      rB   eventListenerscurrentSourceURL	originURLscrollOffsetXscrollOffsetY)dictr   r   r   r   rA   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r,   r-   selfjsonr7   r7   r;   rA   o   sl   







































zDOMNode.to_jsonc                 C  s  | d=i dt |d dt|d dt|d dtj|d d	d
|v r,t|d
 nd dd|v r9t|d nd dd|v rFt|d nd dd|v rSt|d nd dd|v rcdd |d D nd dd|v rsdd |d D nd dd|v rdd |d D nd dd|v rt |d nd dd|v rt|d nd dd|v rt|d nd d d!|v rt|d! nd d"d#|v rt|d# nd d$d%|v rt|d% nd d&d'|v rt|d' nd d(d)|v rtj|d) nd d*d+|v rt |d+ nd d,d-|v r
tj|d- nd d.d/|v rtj	|d/ nd d0d1|v r(t|d1 nd d2d3|v r9d4d |d3 D nd d5d6|v rGt|d6 nd d7d8|v rUt|d8 nd d9d:|v rct
|d: nd d;d<|v rst
|d< S d S )>Nr   r.   r   r/   r   r0   r   r1   r   r2   r   r3   r   r4   r   r5   r   r>   c                 S     g | ]}t |qS r7   r   r8   r7   r7   r;   r<      rB   z%DOMNode.from_json.<locals>.<listcomp>r   c                 S     g | ]}t |qS r7   	NameValue	from_jsonr8   r7   r7   r;   r<          r   rC   c                 S  rY   r7   rZ   r8   r7   r7   r;   r<      rB   r   rD   r   rE   r   rF   r   rG   r    rH   r!   rI   r"   rJ   r#   rK   r$   rL   r%   rM   r&   rN   r'   rO   r(   rP   c                 S     g | ]}t j|qS r7   )r   EventListenerr^   r8   r7   r7   r;   r<          r)   rQ   r*   rR   r,   rS   r-   rT   r7   )r   r   r   BackendNodeIdr^   boolr	   FrameId
PseudoTypeShadowRootTypefloatclsrX   r7   r7   r;   r^      s   	
zDOMNode.from_json) __name__
__module____qualname____doc____annotations__r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r,   r-   rA   classmethodr^   r7   r7   r7   r;   r
      sB   
 8r
   c                   @  s>   e Zd ZU dZded< ded< ded< dd Zed	d
 ZdS )InlineTextBoxz
    Details of post layout rendered text positions. The exact layout should not be regarded as
    stable and may change between versions.
    dom.Rectbounding_boxr   start_character_indexnum_charactersc                 C  s,   t  }| j |d< | j|d< | j|d< |S )NboundingBoxstartCharacterIndexnumCharacters)rU   rs   rA   rt   ru   rV   r7   r7   r;   rA      s
   

zInlineTextBox.to_jsonc                 C  s*   | t j|d t|d t|d dS )Nrv   rw   rx   )rs   rt   ru   )r   Rectr^   r   ri   r7   r7   r;   r^      s
   

zInlineTextBox.from_jsonNrk   rl   rm   rn   ro   rA   rp   r^   r7   r7   r7   r;   rq      s   
 rq   c                   @  sr   e Zd ZU dZded< ded< dZded< dZd	ed
< dZded< dZded< dZ	ded< dd Z
edd ZdS )LayoutTreeNodezD
    Details of an element in the DOM tree with a LayoutObject.
    r   dom_node_indexrr   rs   Nr   layout_textz+typing.Optional[typing.List[InlineTextBox]]inline_text_nodesr   style_indexpaint_orderr   is_stacking_contextc                 C  s   t  }| j|d< | j |d< | jd ur| j|d< | jd ur(dd | jD |d< | jd ur2| j|d< | jd ur<| j|d< | jd urF| j|d	< |S )
NdomNodeIndexrv   
layoutTextc                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   z*LayoutTreeNode.to_json.<locals>.<listcomp>inlineTextNodes
styleIndex
paintOrderisStackingContext)	rU   r|   rs   rA   r}   r~   r   r   r   rV   r7   r7   r;   rA     s   









zLayoutTreeNode.to_jsonc              
   C  s   | t |d tj|d d|v rt|d nd d|v r%dd |d D nd d|v r0t |d nd d|v r;t |d nd d	|v rHt|d	 d
S d d
S )Nr   rv   r   r   c                 S  r[   r7   )rq   r^   r8   r7   r7   r;   r<     r_   z,LayoutTreeNode.from_json.<locals>.<listcomp>r   r   r   )r|   rs   r}   r~   r   r   r   )r   r   ry   r^   r   rd   ri   r7   r7   r;   r^     s   
zLayoutTreeNode.from_json)rk   rl   rm   rn   ro   r}   r~   r   r   r   rA   rp   r^   r7   r7   r7   r;   r{      s   
 r{   c                   @  s.   e Zd ZU dZded< dd Zedd ZdS )	ComputedStylezQ
    A subset of the full ComputedStyle as defined by the request whitelist.
    ztyping.List[NameValue]
propertiesc                 C     t  }dd | jD |d< |S )Nc                 S  r?   r7   r@   r8   r7   r7   r;   r<   -  rB   z)ComputedStyle.to_json.<locals>.<listcomp>r   )rU   r   rV   r7   r7   r;   rA   +     zComputedStyle.to_jsonc                 C     | dd |d D dS )Nc                 S  r[   r7   r\   r8   r7   r7   r;   r<   3  r_   z+ComputedStyle.from_json.<locals>.<listcomp>r   )r   r7   ri   r7   r7   r;   r^   0     zComputedStyle.from_jsonNrz   r7   r7   r7   r;   r   #  s   
 r   c                   @  s6   e Zd ZU dZded< ded< dd Zedd Zd	S )
r]   z
    A name/value pair.
    r   namevaluec                 C  s   t  }| j|d< | j|d< |S )Nr   r   )rU   r   r   rV   r7   r7   r;   rA   B  s   

zNameValue.to_jsonc                 C  s   | t |d t |d dS )Nr   r   )r   r   r   ri   r7   r7   r;   r^   H  s   

zNameValue.from_jsonNrz   r7   r7   r7   r;   r]   7  s   
 r]   c                      8   e Zd ZdZdddZedddZ fd	d
Z  ZS )StringIndex3
    Index of the string in the strings table.
    returnr   c                 C     | S Nr7   rW   r7   r7   r;   rA   T     zStringIndex.to_jsonrX   c                 C     | |S r   r7   ri   r7   r7   r;   r^   W     zStringIndex.from_jsonc                      d t  S )NzStringIndex({})formatsuper__repr__r   	__class__r7   r;   r   [     zStringIndex.__repr__)r   r   )rX   r   r   r   	rk   rl   rm   rn   rA   rp   r^   r   __classcell__r7   r7   r   r;   r   P      
r   c                      r   )ArrayOfStringsr   r   typing.List[StringIndex]c                 C  r   r   r7   r   r7   r7   r;   rA   c  r   zArrayOfStrings.to_jsonrX   c                 C  r   r   r7   ri   r7   r7   r;   r^   f  r   zArrayOfStrings.from_jsonc                   r   )NzArrayOfStrings({})r   r   r   r7   r;   r   j  r   zArrayOfStrings.__repr__)r   r   )rX   r   r   r   r   r7   r7   r   r;   r   _  r   r   c                   @  s6   e Zd ZU dZded< ded< dd Zedd	 Zd
S )RareStringDataz2
    Data that is only present on rare nodes.
    typing.List[int]indexr   r   c                 C  2   t  }dd | jD |d< dd | jD |d< |S )Nc                 S  r6   r7   r7   r8   r7   r7   r;   r<   y  r=   z*RareStringData.to_json.<locals>.<listcomp>r   c                 S  r?   r7   r@   r8   r7   r7   r;   r<   z  rB   r   rU   r   r   rV   r7   r7   r;   rA   w     zRareStringData.to_jsonc                 C  (   | dd |d D dd |d D dS )Nc                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   z,RareStringData.from_json.<locals>.<listcomp>r   c                 S  r[   r7   r   r^   r8   r7   r7   r;   r<     r_   r   r   r   r7   ri   r7   r7   r;   r^   }     zRareStringData.from_jsonNrz   r7   r7   r7   r;   r   n  s   
 r   c                   @  s*   e Zd ZU ded< dd Zedd ZdS )RareBooleanDatar   r   c                 C  r   )Nc                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   z+RareBooleanData.to_json.<locals>.<listcomp>r   )rU   r   rV   r7   r7   r;   rA     r   zRareBooleanData.to_jsonc                 C  r   )Nc                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   z-RareBooleanData.from_json.<locals>.<listcomp>r   )r   r7   ri   r7   r7   r;   r^     r   zRareBooleanData.from_jsonNrk   rl   rm   ro   rA   rp   r^   r7   r7   r7   r;   r     s
   
 r   c                   @  s2   e Zd ZU ded< ded< dd Zedd ZdS )	RareIntegerDatar   r   r   c                 C  r   )Nc                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   z+RareIntegerData.to_json.<locals>.<listcomp>r   c                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   r   r   rV   r7   r7   r;   rA     r   zRareIntegerData.to_jsonc                 C  r   )Nc                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   z-RareIntegerData.from_json.<locals>.<listcomp>r   c                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   r   r   r7   ri   r7   r7   r;   r^     r   zRareIntegerData.from_jsonNr   r7   r7   r7   r;   r     s   
 r   c                      s4   e Zd Zd
ddZedddZ fdd	Z  ZS )	Rectangler   typing.List[float]c                 C  r   r   r7   r   r7   r7   r;   rA     r   zRectangle.to_jsonrX   c                 C  r   r   r7   ri   r7   r7   r;   r^     r   zRectangle.from_jsonc                   r   )NzRectangle({})r   r   r   r7   r;   r     r   zRectangle.__repr__)r   r   )rX   r   r   r   )rk   rl   rm   rA   rp   r^   r   r   r7   r7   r   r;   r     s
    
r   c                   @  s   e Zd ZU dZded< ded< ded< ded< ded< ded< ded	< ded
< ded< ded< ded< dZded< dZded< dZded< dZded< dd Z	e
dd ZdS )DocumentSnapshotz
    Document snapshot.
    r   r   titler   r   encoding_namer!   r"   r#   NodeTreeSnapshotnodesLayoutTreeSnapshotlayoutTextBoxSnapshot
text_boxesNr+   r,   r-   content_widthcontent_heightc                 C  s   t  }| j |d< | j |d< | j |d< | j |d< | j |d< | j |d< | j |d< | j	 |d< | j
 |d	< | j |d
< | j |d< | jd urZ| j|d< | jd urd| j|d< | jd urn| j|d< | jd urx| j|d< |S )NrE   r   rF   rG   encodingNamerI   rJ   rK   r   r   	textBoxesrS   rT   contentWidthcontentHeight)rU   r   rA   r   r   r   r   r!   r"   r#   r   r   r   r,   r-   r   r   rV   r7   r7   r;   rA     s*   







zDocumentSnapshot.to_jsonc                 C  s   | t |d t |d t |d t |d t |d t |d t |d t |d t|d	 t|d
 t|d d|v rMt|d nd d|v rXt|d nd d|v rct|d nd d|v rpt|d dS d dS )NrE   r   rF   rG   r   rI   rJ   rK   r   r   r   rS   rT   r   r   )r   r   r   r   r   r!   r"   r#   r   r   r   r,   r-   r   r   )r   r^   r   r   r   rh   ri   r7   r7   r;   r^     s&   zDocumentSnapshot.from_json)rk   rl   rm   rn   ro   r,   r-   r   r   rA   rp   r^   r7   r7   r7   r;   r     s(   
 r   c                   @  s   e Zd ZU dZdZded< dZded< dZded< dZded	< dZ	ded
< dZ
ded< dZded< dZded< dZded< dZded< dZded< dZded< dZded< dZded< dZded< dZded< dZded< dd Zedd ZdS )r   z!
    Table containing nodes.
    Nr   parent_indexr   ztyping.Optional[RareStringData]r&   )typing.Optional[typing.List[StringIndex]]r   r   z/typing.Optional[typing.List[dom.BackendNodeId]]r   z,typing.Optional[typing.List[ArrayOfStrings]]r   r   r   z typing.Optional[RareBooleanData]r   r   z typing.Optional[RareIntegerData]r$   r%   pseudo_identifierr'   r)   r*   c                 C  s  t  }| jd urdd | jD |d< | jd ur!dd | jD |d< | jd ur-| j |d< | jd ur<dd | jD |d< | jd urKd	d | jD |d
< | jd urZdd | jD |d< | jd uridd | jD |d< | j	d uru| j	 |d< | j
d ur| j
 |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< | jd ur| j |d< |S )Nc                 S  r6   r7   r7   r8   r7   r7   r;   r<   Q  r=   z,NodeTreeSnapshot.to_json.<locals>.<listcomp>parentIndexc                 S  r6   r7   r7   r8   r7   r7   r;   r<   S  r=   r.   rN   c                 S  r?   r7   r@   r8   r7   r7   r;   r<   W  rB   r/   c                 S  r?   r7   r@   r8   r7   r7   r;   r<   Y  rB   r0   c                 S  r?   r7   r@   r8   r7   r7   r;   r<   [  rB   r1   c                 S  r?   r7   r@   r8   r7   r7   r;   r<   ]  rB   r   r2   r3   r4   r5   rL   rM   pseudoIdentifierrO   rQ   rR   )rU   r   r   r&   rA   r   r   r   r   r   r   r   r   r$   r%   r   r'   r)   r*   rV   r7   r7   r;   rA   N  sH   
















zNodeTreeSnapshot.to_jsonc                 C  s  | d)i dd|v rdd |d D nd dd|v r!dd |d D nd dd	|v r/t |d	 nd d
d|v r?dd |d D nd dd|v rOdd |d D nd dd|v r_dd |d D nd dd|v rodd |d D nd dd|v r}t |d nd dd|v rt |d nd dd|v rt|d nd dd|v rt|d nd dd|v rt|d nd dd |v rt |d  nd d!d"|v rt |d" nd d#d$|v rt|d$ nd d%d&|v rt |d& nd d'd(|v rt |d( S d S )*Nr   r   c                 S  rY   r7   rZ   r8   r7   r7   r;   r<   w  rB   z.NodeTreeSnapshot.from_json.<locals>.<listcomp>r   r.   c                 S  rY   r7   rZ   r8   r7   r7   r;   r<   x  rB   r&   rN   r   r/   c                 S  r[   r7   r   r8   r7   r7   r;   r<   z  r_   r   r0   c                 S  r[   r7   r   r8   r7   r7   r;   r<   {  r_   r   r1   c                 S  r`   r7   )r   rc   r^   r8   r7   r7   r;   r<   |  rb   r   c                 S  r[   r7   r   r^   r8   r7   r7   r;   r<   }  r_   r   r2   r   r3   r   r4   r   r5   r$   rL   r%   rM   r   r   r'   rO   r)   rQ   r*   rR   r7   )r   r^   r   r   ri   r7   r7   r;   r^   t  sj   	
zNodeTreeSnapshot.from_json)rk   rl   rm   rn   r   ro   r   r&   r   r   r   r   r   r   r   r   r$   r%   r   r'   r)   r*   rA   rp   r^   r7   r7   r7   r;   r     s,   
 &r   c                   @  s   e Zd ZU dZded< ded< ded< ded	< d
ed< dZded< dZded< dZded< dZded< dZ	ded< dZ
ded< dd Zedd ZdS )r   zM
    Table of details of an element in the DOM tree with a LayoutObject.
    r   
node_indexztyping.List[ArrayOfStrings]stylestyping.List[Rectangle]boundsr   textr   stacking_contextsNr   paint_ordersz'typing.Optional[typing.List[Rectangle]]offset_rectsscroll_rectsclient_rectsr   blended_background_colorsz#typing.Optional[typing.List[float]]text_color_opacitiesc                 C  s  t  }dd | jD |d< dd | jD |d< dd | jD |d< dd | jD |d	< | j |d
< | jd urAdd | jD |d< | jd urPdd | jD |d< | j	d ur_dd | j	D |d< | j
d urndd | j
D |d< | jd ur}dd | jD |d< | jd urdd | jD |d< |S )Nc                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   z.LayoutTreeSnapshot.to_json.<locals>.<listcomp>	nodeIndexc                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   r   c                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   r   c                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   r   stackingContextsc                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   paintOrdersc                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   offsetRectsc                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   scrollRectsc                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   clientRectsc                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   blendedBackgroundColorsc                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   textColorOpacities)rU   r   r   r   r   r   rA   r   r   r   r   r   r   rV   r7   r7   r;   rA     s&   





zLayoutTreeSnapshot.to_jsonc                 C  s   | dd |d D dd |d D dd |d D dd |d	 D t |d
 d|v r4dd |d D nd d|v rBdd |d D nd d|v rPdd |d D nd d|v r^dd |d D nd d|v rldd |d D nd d|v r|dd |d D dS d dS )Nc                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   z0LayoutTreeSnapshot.from_json.<locals>.<listcomp>r   c                 S  r[   r7   r   r8   r7   r7   r;   r<     r_   r   c                 S  r[   r7   r   r^   r8   r7   r7   r;   r<     r_   r   c                 S  r[   r7   r   r8   r7   r7   r;   r<     r_   r   r   r   c                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   r   c                 S  r[   r7   r   r8   r7   r7   r;   r<     r_   r   c                 S  r[   r7   r   r8   r7   r7   r;   r<     r_   r   c                 S  r[   r7   r   r8   r7   r7   r;   r<     r_   r   c                 S  r[   r7   r   r8   r7   r7   r;   r<     r_   r   c                 S  rY   r7   )rh   r8   r7   r7   r;   r<     rB   )r   r   r   r   r   r   r   r   r   r   r   )r   r^   ri   r7   r7   r;   r^     s   zLayoutTreeSnapshot.from_json)rk   rl   rm   rn   ro   r   r   r   r   r   r   rA   rp   r^   r7   r7   r7   r;   r     s    
 r   c                   @  sF   e Zd ZU dZded< ded< ded< ded< dd	 Zed
d ZdS )r   z
    Table of details of the post layout rendered text positions. The exact layout should not be regarded as
    stable and may change between versions.
    r   layout_indexr   r   startlengthc                 C  sZ   t  }dd | jD |d< dd | jD |d< dd | jD |d< dd | jD |d	< |S )
Nc                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   z+TextBoxSnapshot.to_json.<locals>.<listcomp>layoutIndexc                 S  r?   r7   r@   r8   r7   r7   r;   r<     rB   r   c                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   r   c                 S  r6   r7   r7   r8   r7   r7   r;   r<     r=   r   )rU   r   r   r   r   rV   r7   r7   r;   rA     s   zTextBoxSnapshot.to_jsonc                 C  sH   | dd |d D dd |d D dd |d D dd |d	 D d
S )Nc                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   z-TextBoxSnapshot.from_json.<locals>.<listcomp>r   c                 S  r[   r7   r   r8   r7   r7   r;   r<     r_   r   c                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   r   c                 S  rY   r7   rZ   r8   r7   r7   r;   r<     rB   r   )r   r   r   r   r7   ri   r7   r7   r;   r^     s   zTextBoxSnapshot.from_jsonNrz   r7   r7   r7   r;   r     s   
 r   r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c                  c      ddi} | V }dS )z9
    Disables DOM snapshot agent for the given page.
    methodzDOMSnapshot.disableNr7   cmd_dictrX   r7   r7   r;   disable     
r   c                  c  r   )z8
    Enables DOM snapshot agent for the given page.
    r   zDOMSnapshot.enableNr7   r   r7   r7   r;   enable	  r   r   computed_style_whitelisttyping.List[str]include_event_listenersr   include_paint_orderinclude_user_agent_shadow_treetyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[typing.List[DOMNode], typing.List[LayoutTreeNode], typing.List[ComputedStyle]]]c                 c  s    t  }dd | D |d< |dur||d< |dur||d< |dur%||d< d|d	}|V }d
d |d D dd |d D dd |d D fS )a?  
    Returns a document snapshot, including the full DOM tree of the root node (including iframes,
    template contents, and imported documents) in a flattened array, as well as layout and
    white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
    flattened.

    :param computed_style_whitelist: Whitelist of computed styles to return.
    :param include_event_listeners: *(Optional)* Whether or not to retrieve details of DOM listeners (default false).
    :param include_paint_order: *(Optional)* Whether to determine and include the paint order index of LayoutTreeNodes (default false).
    :param include_user_agent_shadow_tree: *(Optional)* Whether to include UA shadow tree in the snapshot (default false).
    :returns: A tuple with the following items:

        0. **domNodes** - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
        1. **layoutTreeNodes** - The nodes in the layout tree.
        2. **computedStyles** - Whitelisted ComputedStyle properties for each node in the layout tree.
    c                 S  r6   r7   r7   r8   r7   r7   r;   r<   *  r=   z get_snapshot.<locals>.<listcomp>computedStyleWhitelistNincludeEventListenersincludePaintOrderincludeUserAgentShadowTreezDOMSnapshot.getSnapshotr   paramsc                 S  r[   r7   )r
   r^   r8   r7   r7   r;   r<   7  r_   domNodesc                 S  r[   r7   )r{   r^   r8   r7   r7   r;   r<   8  r_   layoutTreeNodesc                 S  r[   r7   )r   r^   r8   r7   r7   r;   r<   9  r_   computedStylesrU   )r   r   r   r   r   r   rX   r7   r7   r;   get_snapshot  s"   r   computed_stylesinclude_dom_rects!include_blended_background_colorsinclude_text_color_opacitiesityping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[typing.List[DocumentSnapshot], typing.List[str]]]c                 c  s    t  }dd | D |d< |dur||d< |dur||d< |dur%||d< |dur-||d< d	|d
}|V }dd |d D dd |d D fS )a  
    Returns a document snapshot, including the full DOM tree of the root node (including iframes,
    template contents, and imported documents) in a flattened array, as well as layout and
    white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
    flattened.

    :param computed_styles: Whitelist of computed styles to return.
    :param include_paint_order: *(Optional)* Whether to include layout object paint orders into the snapshot.
    :param include_dom_rects: *(Optional)* Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot
    :param include_blended_background_colors: **(EXPERIMENTAL)** *(Optional)* Whether to include blended background colors in the snapshot (default: false). Blended background color is achieved by blending background colors of all elements that overlap with the current element.
    :param include_text_color_opacities: **(EXPERIMENTAL)** *(Optional)* Whether to include text color opacity in the snapshot (default: false). An element might have the opacity property set that affects the text color of the element. The final text color opacity is computed based on the opacity of all overlapping elements.
    :returns: A tuple with the following items:

        0. **documents** - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
        1. **strings** - Shared string table that all string properties refer to with indexes.
    c                 S  r6   r7   r7   r8   r7   r7   r;   r<   U  r=   z$capture_snapshot.<locals>.<listcomp>r   Nr   includeDOMRectsincludeBlendedBackgroundColorsincludeTextColorOpacitieszDOMSnapshot.captureSnapshotr   c                 S  r[   r7   )r   r^   r8   r7   r7   r;   r<   d  r_   	documentsc                 S  rY   r7   r   r8   r7   r7   r;   r<   e  rB   stringsr   )r   r   r   r   r  r   r   rX   r7   r7   r;   capture_snapshot=  s$   r  )r   r   )NNN)
r   r   r   r   r   r   r   r   r   r   )NNNN)r   r   r   r   r   r   r   r   r  r   r   r  )"
__future__r   utilr   r   dataclassesr   enumtyping r   r   r	   r
   rq   r{   r   r]   r   r   listr   r   r   r   r   r   r   r   r   r   r   r   r  r7   r7   r7   r;   <module>   s^    8 8]wM
%

,