a
    $ñ»jßt  ã                   @  sæ  d dl mZ d dlZd dlZd dlmZ ddlmZmZ ddl	m
Z
 ddl	m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G dd„ deƒZeG dd„ dƒƒZG dd„ dejƒZd	ddœdd„Zdsd	dddœdd„Zddœd d!„Zd	d"dœd#d$„Zdtd	d%dd&œd'd(„Zdudd%d%d)d*d+œd,d-„Zd.dœd/d0„Zdvd1d2d2d2d2d3d4ddddddd5d6œd7d8„Zdwd9d:dd;œd<d=„Zd>dd?œd@dA„Zdxd:dBdœdCdD„Z dydEdFdGœdHdI„Z!dzdJdJddEddKœdLdM„Z"d{d	dJdEddNœdOdP„Z#d|dJdEddQœdRdS„Z$dTddUœdVdW„Z%d	dXdœdYdZ„Z&d}d	d%d5d[œd\d]„Z'ed^ƒeG d_d`„ d`ƒƒƒZ(edaƒeG dbdc„ dcƒƒƒZ)eddƒeG dedf„ dfƒƒƒZ*edgƒeG dhdi„ diƒƒƒZ+edjƒeG dkdl„ dlƒƒƒZ,edmƒeG dndo„ doƒƒƒZ-edpƒeG dqdr„ drƒƒƒZ.dS )~é    )ÚannotationsN)Ú	dataclassé   )Úevent_classÚT_JSON_DICT)Úbrowser)Úpagec                      s>   e Zd Zddœdd„Zedd dœdd„ƒZ‡ fdd	„Z‡  ZS )
ÚTargetIDÚstr©Úreturnc                 C  s   | S ©N© ©Úselfr   r   ú2E:\soccer\ml_env\Lib\site-packages\mycdp/target.pyÚto_json   s    zTargetID.to_json©Újsonr   c                 C  s   | |ƒS r   r   ©Úclsr   r   r   r   Ú	from_json   s    zTargetID.from_jsonc                   s   d  tƒ  ¡ ¡S )NzTargetID({})©ÚformatÚsuperÚ__repr__r   ©Ú	__class__r   r   r      s    zTargetID.__repr__)Ú__name__Ú
__module__Ú__qualname__r   Úclassmethodr   r   Ú__classcell__r   r   r   r   r	      s   r	   c                      sB   e Zd ZdZddœdd„Zedd dœdd„ƒZ‡ fd	d
„Z‡  ZS )Ú	SessionIDz0Unique identifier of attached debugging session.r
   r   c                 C  s   | S r   r   r   r   r   r   r       s    zSessionID.to_jsonr   c                 C  s   | |ƒS r   r   r   r   r   r   r   #   s    zSessionID.from_jsonc                   s   d  tƒ  ¡ ¡S )NzSessionID({})r   r   r   r   r   r   '   s    zSessionID.__repr__©	r   r   r    Ú__doc__r   r!   r   r   r"   r   r   r   r   r#      s
   r#   c                   @  sœ   e Zd ZU 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
Zded< ddœdd„Z	e
dd dœdd„ƒZd
S )Ú
TargetInfor	   Ú	target_idr
   Útype_ÚtitleÚurlÚboolÚattachedÚcan_access_openerNútyping.Optional[TargetID]Ú	opener_idztyping.Optional[page.FrameId]Úopener_frame_idÚparent_frame_idú)typing.Optional[browser.BrowserContextID]Úbrowser_context_idútyping.Optional[str]Úsubtyper   r   c                 C  s¾   t ƒ }| j ¡ |d< | j|d< | j|d< | j|d< | j|d< | j|d< | jd ur^| j ¡ |d< | j	d urv| j	 ¡ |d< | j
d urŽ| j
 ¡ |d	< | jd ur¦| j ¡ |d
< | jd urº| j|d< |S )NÚtargetIdÚtyper)   r*   r,   ÚcanAccessOpenerÚopenerIdÚopenerFrameIdÚparentFrameIdÚbrowserContextIdr5   )Údictr'   r   r(   r)   r*   r,   r-   r/   r0   r1   r3   r5   ©r   r   r   r   r   r   @   s$    










zTargetInfo.to_jsonr   c                 C  sþ   | t  | d¡¡t| d¡ƒt| d¡ƒt| d¡ƒt| d¡ƒt| d¡ƒ| dd ¡d urlt  | d¡¡nd | dd ¡d ur�tj | d¡¡nd | d	d ¡d ur²tj |d	 ¡nd | d
d ¡d urÖtj | d
¡¡nd | dd ¡d uröt| d¡ƒnd d�S )Nr6   r7   r)   r*   r,   r8   r9   r:   r;   r<   r5   )r'   r(   r)   r*   r,   r-   r/   r0   r1   r3   r5   )	r	   r   Úgetr
   r+   r   ZFrameIdr   ÚBrowserContextIDr   r   r   r   r   T   s2    ÿÿÿýÿÿàzTargetInfo.from_json)r   r   r    Ú__annotations__r/   r0   r1   r3   r5   r   r!   r   r   r   r   r   r&   +   s   
r&   c                   @  sL   e Zd ZU dZdZded< dZded< ddœd	d
„Zedd dœdd„ƒZ	dS )ÚFilterEntryz?A filter used by target query/discovery/auto-attach operations.Nútyping.Optional[bool]Úexcluder4   r(   r   r   c                 C  s2   t ƒ }| jd ur| j|d< | jd ur.| j|d< |S )NrD   r7   )r=   rD   r(   r>   r   r   r   r   ƒ   s    



zFilterEntry.to_jsonr   c                 C  sH   | |  dd ¡d ur t|  d¡ƒnd |  dd ¡d ur@t|  d¡ƒnd d�S )NrD   r7   )rD   r(   )r?   r+   r
   r   r   r   r   r   ‹   s    ÿÿ÷zFilterEntry.from_json)
r   r   r    r%   rD   rA   r(   r   r!   r   r   r   r   r   rB   {   s   
rB   c                      sB   e Zd ZdZddœdd„Zedd dœdd„ƒZ‡ fd	d
„Z‡  ZS )ÚTargetFiltera•  
    The entries in TargetFilter are matched sequentially against targets and
    the first entry that matches determines if the target is included or not,
    depending on the value of ``exclude`` field in the entry.
    If filter is not specified, the one assumed is
    [{type: "browser", exclude: true}, {type: "tab", exclude: true}, {}]
    (i.e. include everything but ``browser`` and ``tab``).
    ztyping.List[FilterEntry]r   c                 C  s   | S r   r   r   r   r   r   r   ¥   s    zTargetFilter.to_jsonr   c                 C  s   | |ƒS r   r   r   r   r   r   r   ¨   s    zTargetFilter.from_jsonc                   s   d  tƒ  ¡ ¡S )NzTargetFilter({})r   r   r   r   r   r   ¬   s    zTargetFilter.__repr__r$   r   r   r   r   rE   ›   s
   	rE   c                   @  s@   e Zd ZU ded< ded< ddœdd„Zedd d	œd
d„ƒZdS )ÚRemoteLocationr
   ÚhostÚintÚportr   r   c                 C  s   t ƒ }| j|d< | j|d< |S )NrG   rI   )r=   rG   rI   r>   r   r   r   r   µ   s    

zRemoteLocation.to_jsonr   c                 C  s    | t | d¡ƒt| d¡ƒd�S )NrG   rI   )rG   rI   )r
   r?   rH   r   r   r   r   r   »   s    þzRemoteLocation.from_jsonN)r   r   r    rA   r   r!   r   r   r   r   r   rF   °   s
   
rF   c                   @  sB   e Zd ZdZdZdZdZdZddœdd	„Ze	dd d
œdd„ƒZ
dS )ÚWindowStatezThe state of the target window.ÚnormalZ	minimizedZ	maximizedZ
fullscreenr
   r   c                 C  s   | j S r   )Úvaluer   r   r   r   r   Ê   s    zWindowState.to_jsonr   c                 C  s   | |ƒS r   r   r   r   r   r   r   Í   s    zWindowState.from_jsonN)r   r   r    r%   ZNORMALZ	MINIMIZEDZ	MAXIMIZEDZ
FULLSCREENr   r!   r   r   r   r   r   rJ   Ã   s   rJ   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])r'   r   c                 c  s&   t ƒ }|  ¡ |d< d|dœ}|V }dS )z?
    Activates (focuses) the target.
    :param target_id:
    r6   zTarget.activateTarget©ÚmethodÚparamsN©r=   r   ©r'   rO   Úcmd_dictr   r   r   r   Úactivate_targetÒ   s    þrS   rC   z5typing.Generator[T_JSON_DICT, T_JSON_DICT, SessionID])r'   Úflattenr   c                 c  sB   t ƒ }|  ¡ |d< |dur"||d< d|dœ}|V }t | d¡¡S )ai  
    Attaches to the target with given id.
    :param target_id:
    :param flatten: *(Optional)*
     Enables "flat" access to the session via specifying sessionId attribute
     in the commands. We plan to make this the default, deprecate non-flattened
     mode, and eventually retire it. (See crbug.com/991325)
    :returns: Id assigned to the session.
    r6   NrT   zTarget.attachToTargetrM   Ú	sessionId)r=   r   r#   r   r?   )r'   rT   rO   rR   r   r   r   r   Úattach_to_targetâ   s    þrV   r   c                  c  s   ddi} | V }t  | d¡¡S )z‡
    Attaches to the browser target, only uses flat sessionId mode.
    **EXPERIMENTAL**
    :returns: Id assigned to the session.
    rN   zTarget.attachToBrowserTargetrU   )r#   r   r?   ©rR   r   r   r   r   Úattach_to_browser_targetú   s    	ÿrX   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool]c                 c  s0   t ƒ }|  ¡ |d< d|dœ}|V }t| d¡ƒS )zÂ
    Closes the target. If the target is a page that gets closed too.
    :param target_id:
    :returns: Always set to true.
     If an error occurs, the response indicates protocol error.
    r6   zTarget.closeTargetrM   Úsuccess)r=   r   r+   r?   rQ   r   r   r   Úclose_target	  s    	þrZ   r4   )r'   Úbinding_namer   c                 c  s6   t ƒ }|  ¡ |d< |dur"||d< d|dœ}|V }dS )aL  
    Inject object to the target's main frame that provides a communication
    channel with browser target.
    Injected object will be available as ``window[bindingName]``.
    The object has the following API:
    - ``binding.send(json)`` -
     a method to send messages over the remote debugging protocol
    - ``binding.onmessage = json => handleMessage(json)`` -
     a callback that will be called for the protocol notifications
     and command responses.
    **EXPERIMENTAL**
    :param target_id:
    :param binding_name: *(Optional)* Binding name, 'cdp' if not specified.
    r6   NZbindingNamezTarget.exposeDevToolsProtocolrM   rP   )r'   r[   rO   rR   r   r   r   r   Úexpose_dev_tools_protocol  s    þr\   z!typing.Optional[typing.List[str]]zDtyping.Generator[T_JSON_DICT, T_JSON_DICT, browser.BrowserContextID])Údispose_on_detachÚproxy_serverÚproxy_bypass_listÚ%origins_with_universal_network_accessr   c                 c  sr   t ƒ }| dur| |d< |dur&||d< |dur6||d< |durPdd„ |D ƒ|d< d|d	œ}|V }tj | d
¡¡S )a  
    Creates a new empty BrowserContext. Similar to an incognito profile
    but you can have more than one.
    :param dispose_on_detach: **(EXPERIMENTAL)** *(Optional)*
     If specified, disposes this context when debugging session disconnects.
    :param proxy_server: **(EXPERIMENTAL)** *(Optional)*
     Proxy server, similar to the one passed to --proxy-server
    :param proxy_bypass_list: **(EXPERIMENTAL)** *(Optional)*
     Proxy bypass list, similar to the one passed to --proxy-bypass-list
    :param origins_with_universal_network_access: **(EXPERIMENTAL)**
     *(Optional)* An optional list of origins to grant unlimited
     cross-origin access to. Parts of the URL other than those constituting
     origin are ignored.
    :returns: The id of the context created.
    NZdisposeOnDetachÚproxyServerZproxyBypassListc                 S  s   g | ]}|‘qS r   r   ©Ú.0Úir   r   r   Ú
<listcomp>W  s   z*create_browser_context.<locals>.<listcomp>Z!originsWithUniversalNetworkAccesszTarget.createBrowserContextrM   r<   )r=   r   r@   r   r?   )r]   r^   r_   r`   rO   rR   r   r   r   r   Úcreate_browser_context8  s     ÿ
þrf   zŠtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[typing.List[browser.BrowserContextID], typing.Optional[browser.BrowserContextID]]]c                  c  sD   ddi} | V }dd„ |d D ƒ|  dd¡dur>tj |d ¡ndfS )aI  
    Returns all browser contexts created with
    ``Target.createBrowserContext`` method.
    :returns: A tuple with the following items:
        0. **browserContextIds** - An array of browser context ids.
        1. **defaultBrowserContextId** - *(Optional)*
            The id of the default browser context if available.
    rN   zTarget.getBrowserContextsc                 S  s   g | ]}t j |¡‘qS r   )r   r@   r   rb   r   r   r   re   y  s   ÿz(get_browser_contexts.<locals>.<listcomp>ZbrowserContextIdsZdefaultBrowserContextIdN)r?   r   r@   r   rW   r   r   r   Úget_browser_contextsb  s    ÿþÿùrg   r
   ztyping.Optional[int]ztyping.Optional[WindowState]r2   z4typing.Generator[T_JSON_DICT, T_JSON_DICT, TargetID])r*   ÚleftÚtopÚwidthÚheightÚwindow_stater3   Úenable_begin_frame_controlÚ
new_windowÚ
backgroundÚfor_tabÚhiddenÚfocusr   c                 c  sö   t ƒ }| |d< |dur||d< |dur.||d< |dur>||d< |durN||d< |durb| ¡ |d< |durv| ¡ |d< |dur†||d	< |dur–||d
< |	dur¦|	|d< |
dur¶|
|d< |durÆ||d< |durÖ||d< d|dœ}|V }t | d¡¡S )a 	  
    Creates a new page.
    :param url: The initial URL the page will be navigated to.
     An empty string indicates about:blank.
    :param left: **(EXPERIMENTAL)** *(Optional)*
     Frame left origin in DIP (requires newWindow to be true or headless shell)
    :param top: **(EXPERIMENTAL)** *(Optional)* Frame top origin in DIP
     (requires newWindow to be true or headless shell).
    :param width: *(Optional)* Frame width in DIP
     (requires newWindow to be true or headless shell).
    :param height: *(Optional)* Frame height in DIP
     (requires newWindow to be true or headless shell).
    :param window_state: *(Optional)* Frame window state
     (requires newWindow to be true or headless shell). Default is normal.
    :param browser_context_id: **(EXPERIMENTAL)** *(Optional)*
     The browser context to create the page in.
    :param enable_begin_frame_control: **(EXPERIMENTAL)** *(Optional)*
     Whether BeginFrames for this target will be controlled via DevTools
     (headless shell only, not supported on MacOS yet, false by default).
    :param new_window: *(Optional)* Whether to create a new Window or Tab
     (false by default, not supported by headless shell).
    :param background: *(Optional)*
     Whether to create the target in background or foreground
      (false by default, not supported by headless shell).
    :param for_tab: **(EXPERIMENTAL)** *(Optional)*
     Whether to create the target of type "tab".
    :param hidden: **(EXPERIMENTAL)** *(Optional)*
     Whether to create a hidden target.
     The hidden target is observable via protocol,
     but not present in the tab UI strip. Can't be created with `forTab: true`,
     ``newWindow: true`` or ``background: false``.
     The life-time of the tab is limited to the life-time of the session.
    :param focus: **(EXPERIMENTAL)** *(Optional)* If specified, the option
     is used to determine if the new target should be focused or not.
     By default, the focus behavior depends on the value of the background
     field. For example, background=false and focus=false will result
     in the target tab being opened but the browser window remain unchanged
     (if it was in the background, it will remain in the background)
     and background=false with focus=undefined will result in the window
     being focused. Using background: true and focus: true is not supported
     and will result in an error.
    :returns: The id of the page opened.
    r*   Nrh   ri   rj   rk   ZwindowStater<   ZenableBeginFrameControlZ	newWindowro   ZforTabrq   rr   zTarget.createTargetrM   r6   ©r=   r   r	   r   r?   )r*   rh   ri   rj   rk   rl   r3   rm   rn   ro   rp   rq   rr   rO   rR   r   r   r   r   Úcreate_targetƒ  s>    :þrt   ztyping.Optional[SessionID]r.   )Ú
session_idr'   r   c                 c  sB   t ƒ }| dur|  ¡ |d< |dur.| ¡ |d< d|dœ}|V }dS )z 
    Detaches session with given id.
    :param session_id: *(Optional)* Session to detach.
    :param target_id: **(DEPRECATED)** *(Optional)* Deprecated.
    NrU   r6   zTarget.detachFromTargetrM   rP   )ru   r'   rO   rR   r   r   r   r   Údetach_from_targetß  s    	þrv   zbrowser.BrowserContextID)r3   r   c                 c  s&   t ƒ }|  ¡ |d< d|dœ}|V }dS )z›
    Deletes a BrowserContext.
    All the belonging pages will be closed
    without calling their beforeunload hooks.
    :param browser_context_id:
    r<   zTarget.disposeBrowserContextrM   NrP   )r3   rO   rR   r   r   r   r   Údispose_browser_contextô  s    	þrw   z6typing.Generator[T_JSON_DICT, T_JSON_DICT, TargetInfo]c                 c  s:   t ƒ }| dur|  ¡ |d< d|dœ}|V }t | d¡¡S )ze
    Returns information about a target.
    **EXPERIMENTAL**
    :param target_id: *(Optional)*
    Nr6   zTarget.getTargetInforM   Ú
targetInfo)r=   r   r&   r   r?   rQ   r   r   r   Úget_target_info  s    þry   ztyping.Optional[TargetFilter]zCtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[TargetInfo]])Úfilter_r   c                 c  s<   t ƒ }| dur|  ¡ |d< d|dœ}|V }dd„ |d D ƒS )aG  
    Retrieves a list of available targets.
    :param filter_: **(EXPERIMENTAL)** *(Optional)*
     Only targets matching filter will be reported.
     If filter is not specified and target discovery is currently enabled,
     a filter used for target discovery is used for consistency.
    :returns: The list of targets.
    NÚfilterzTarget.getTargetsrM   c                 S  s   g | ]}t  |¡‘qS r   )r&   r   rb   r   r   r   re   ,  ó    zget_targets.<locals>.<listcomp>ZtargetInfosrP   )rz   rO   rR   r   r   r   r   Úget_targets  s    þr}   r+   )Úauto_attachÚwait_for_debugger_on_startrT   rz   r   c                 c  sN   t ƒ }| |d< ||d< |dur&||d< |dur:| ¡ |d< d|dœ}|V }dS )að  
    Controls whether to automatically attach to new targets,
    which are considered to be related to this one.
    When turned on, attaches to all existing related targets as well.
    When turned off, automatically detaches from all currently
    attached targets.
    This also clears all targets added by ``autoAttachRelated``
    from the list of targets to watch for creation of related targets.
    :param auto_attach: Whether to auto-attach to related targets.
    :param wait_for_debugger_on_start: Whether to pause new targets
     when attaching to them.
     Use ``Runtime.runIfWaitingForDebugger`` to run paused targets.
    :param flatten: **(EXPERIMENTAL)** *(Optional)*
     Enables "flat" access to the session via specifying
     sessionId attribute in the commands. We plan to make this the default,
     deprecate non-flattened mode, and eventually retire it (crbug.com/991325).
    :param filter_: **(EXPERIMENTAL)** *(Optional)*
    Only targets matching filter will be attached.
    Z
autoAttachÚwaitForDebuggerOnStartNrT   r{   zTarget.setAutoAttachrM   rP   )r~   r   rT   rz   rO   rR   r   r   r   r   Úset_auto_attach/  s    þr�   )r'   r   rz   r   c                 c  sB   t ƒ }|  ¡ |d< ||d< |dur.| ¡ |d< d|dœ}|V }dS )aü  
    Adds the specified target to the list of targets
    that will be monitored for any related target creation
    (such as child frames, child workers and new versions of service worker)
    and reported through ``attachedToTarget``.
    The specified target is also auto-attached.
    This cancels the effect of any previous ``setAutoAttach``
    and is also cancelled by subsequent ``setAutoAttach``.
    Only available at the Browser target.
    **EXPERIMENTAL**
    :param target_id:
    :param wait_for_debugger_on_start: Whether to pause new targets
     when attaching to them. Use ``Runtime.runIfWaitingForDebugger``
     to run paused targets.
    :param filter_: **(EXPERIMENTAL)** *(Optional)*
     Only targets matching filter will be attached.
    r6   r€   Nr{   zTarget.autoAttachRelatedrM   rP   )r'   r   rz   rO   rR   r   r   r   r   Úauto_attach_relatedV  s    þr‚   )Údiscoverrz   r   c                 c  s6   t ƒ }| |d< |dur"| ¡ |d< d|dœ}|V }dS )ao  
    Controls whether to discover available targets and notify via
    ``targetCreated/targetInfoChanged/targetDestroyed`` events.
    :param discover: Whether to discover available targets.
    :param filter_: **(EXPERIMENTAL)** *(Optional)*
     Only targets matching filter will be attached.
     If ``discover`` is false, ``filter`` must be omitted or empty.
    rƒ   Nr{   zTarget.setDiscoverTargetsrM   rP   )rƒ   rz   rO   rR   r   r   r   r   Úset_discover_targetsx  s    þr„   ztyping.List[RemoteLocation])Ú	locationsr   c                 c  s,   t ƒ }dd„ | D ƒ|d< d|dœ}|V }dS )z¹
    Enables target discovery for the specified locations,
    when ``setDiscoverTargets`` was set to ``true``.
    **EXPERIMENTAL**
    :param locations: List of remote locations.
    c                 S  s   g | ]}|  ¡ ‘qS r   )r   rb   r   r   r   re   ˜  r|   z(set_remote_locations.<locals>.<listcomp>r…   zTarget.setRemoteLocationsrM   N)r=   )r…   rO   rR   r   r   r   r   Úset_remote_locationsŽ  s    	þr†   zEtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Optional[TargetID]]c                 c  sF   t ƒ }|  ¡ |d< d|dœ}|V }| dd¡durBt | d¡¡S dS )zÙ
    Gets the targetId of the DevTools page target opened for the given target
    (if any).
    :param target_id: Page or tab target ID.
    :returns: *(Optional)* The targetId of DevTools page target if exists.
    r6   zTarget.getDevToolsTargetrM   N)r=   r   r?   r	   r   rQ   r   r   r   Úget_dev_tools_target   s    	þÿýr‡   )r'   Úpanel_idr   c                 c  sB   t ƒ }|  ¡ |d< |dur"||d< d|dœ}|V }t | d¡¡S )ag  
    Opens a DevTools window for the target.
    :param target_id: This can be the page or tab target ID.
    :param panel_id: *(Optional)*
    The id of the panel we want DevTools to open initially.
    Currently supported panels are elements, console, network,
    sources, resources and performance.
    :returns: The targetId of DevTools page target.
    r6   NZpanelIdzTarget.openDevToolsrM   rs   )r'   rˆ   rO   rR   r   r   r   r   Úopen_dev_tools·  s    þr‰   zTarget.attachedToTargetc                   @  s>   e Zd ZU dZded< ded< ded< edd d	œd
d„ƒZdS )ÚAttachedToTargetzw
    **EXPERIMENTAL**
    Issued when attached to target because of auto-attach
    or ``attachToTarget`` command.
    r#   ru   r&   Útarget_infor+   Úwaiting_for_debuggerr   r   c                 C  s0   | t  | d¡¡t | d¡¡t| d¡ƒd�S )NrU   rx   ZwaitingForDebugger)ru   r‹   rŒ   )r#   r   r?   r&   r+   r   r   r   r   r   Ü  s
    ýzAttachedToTarget.from_jsonN©r   r   r    r%   rA   r!   r   r   r   r   r   rŠ   Ï  s   
rŠ   zTarget.detachedFromTargetc                   @  s6   e Zd ZU dZded< ded< edd dœdd	„ƒZd
S )ÚDetachedFromTargetzÛ
    **EXPERIMENTAL**
    Issued when detached from target for any reason
    (including ``detachFromTarget`` command).
    Can be issued multiple times per target if multiple sessions
    have been attached to it.
    r#   ru   r.   r'   r   r   c                 C  s8   | t  | d¡¡| dd ¡d ur0t | d¡¡nd d�S )NrU   r6   )ru   r'   )r#   r   r?   r	   r   r   r   r   r   ô  s    ÿûzDetachedFromTarget.from_jsonNr�   r   r   r   r   rŽ   å  s
   
rŽ   z Target.receivedMessageFromTargetc                   @  s>   e Zd ZU dZded< ded< ded< edd d	œd
d„ƒZdS )ÚReceivedMessageFromTargetzz
    Notifies about a new protocol message received from the session
    (as reported in ``attachedToTarget`` event).
    r#   ru   r
   Úmessager.   r'   r   r   c                 C  sD   | t  | d¡¡t| d¡ƒ| dd ¡d ur<t | d¡¡nd d�S )NrU   r�   r6   )ru   r�   r'   )r#   r   r?   r
   r	   r   r   r   r   r     s    ÿúz#ReceivedMessageFromTarget.from_jsonNr�   r   r   r   r   r�      s   
r�   zTarget.targetCreatedc                   @  s.   e Zd ZU dZded< edd dœdd„ƒZdS )	ÚTargetCreatedz4Issued when a possible inspection target is created.r&   r‹   r   r   c                 C  s   | t  | d¡¡d�S ©Nrx   )r‹   ©r&   r   r?   r   r   r   r   r      s    zTargetCreated.from_jsonNr�   r   r   r   r   r‘     s   
r‘   zTarget.targetDestroyedc                   @  s.   e Zd ZU dZded< edd dœdd„ƒZdS )	ÚTargetDestroyedz"Issued when a target is destroyed.r	   r'   r   r   c                 C  s   | t  | d¡¡d�S )Nr6   )r'   )r	   r   r?   r   r   r   r   r   +  s    zTargetDestroyed.from_jsonNr�   r   r   r   r   r”   %  s   
r”   zTarget.targetCrashedc                   @  s>   e Zd ZU dZded< ded< ded< edd d	œd
d„ƒZdS )ÚTargetCrashedz!Issued when a target has crashed.r	   r'   r
   ÚstatusrH   Ú
error_coder   r   c                 C  s.   | t  | d¡¡t| d¡ƒt| d¡ƒd�S )Nr6   r–   Z	errorCode)r'   r–   r—   )r	   r   r?   r
   rH   r   r   r   r   r   :  s
    ýzTargetCrashed.from_jsonNr�   r   r   r   r   r•   0  s   
r•   zTarget.targetInfoChangedc                   @  s.   e Zd ZU dZded< edd dœdd„ƒZdS )	ÚTargetInfoChangedz‹
    Issued when some information about a target has changed.
    This only happens between ``targetCreated`` and ``targetDestroyed``.
    r&   r‹   r   r   c                 C  s   | t  | d¡¡d�S r’   r“   r   r   r   r   r   L  s    zTargetInfoChanged.from_jsonNr�   r   r   r   r   r˜   C  s   
r˜   )N)N)NNNN)NNNNNNNNNNNN)NN)N)N)NN)N)N)N)/Ú
__future__r   ÚenumÚtypingÚdataclassesr   Úutilr   r   Ú r   r   r
   r	   r#   r&   rB   ÚlistrE   rF   ÚEnumrJ   rS   rV   rX   rZ   r\   rf   rg   rt   rv   rw   ry   r}   r�   r‚   r„   r†   r‡   r‰   rŠ   rŽ   r�   r‘   r”   r•   r˜   r   r   r   r   Ú<module>   s¤   O ÿ ÿ    ú*#            ó*]  þ ÿ ÿ  ü* ý# ÿ ÿ		