a
    $ñ»j¬Õ  ã                   @  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
 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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jƒZeG dd„ dƒƒZd£ddd d!œd"d#„Zd d$œd%d&„Zd¤d'd(d)œd*d+„Zd¥d
d,dd-d-d-d-d-d.d/d0œ
d1d2„Zd¦dd3d-d4d5œd6d7„Zd8d9d:œd;d<„Zd8d=d:œd>d?„Zd,d@dAœdBdC„Z dDdEdFœdGdH„Z!d d$œdIdJ„Z"dd dKœdLdM„Z#d§d
ddNdOœdPdQ„Z$d¨d-d dRœdSdT„Z%d©d8d,d-d-dUdVœdWdX„Z&dYd dZœd[d\„Z'd]d d^œd_d`„Z(d8dad dbœdcdd„Z)dªdddedfœdgdh„Z*d,didjœdkdl„Z+d«dYddddmddndoœdpdq„Z,d¬drddidsœdtdu„Z-dvd dwœdxdy„Z.d,d dzœd{d|„Z/d}d d~œdd€„Z0d­d8d,d-d-d�d‚œdƒd„„Z1dvd d…œd†d‡„Z2dYd,d}d
d dˆœd‰dŠ„Z3d®d-d‹d dŒœd�dŽ„Z4d d$œd�d�„Z5d¯d‹d d‘œd’d“„Z6ed”ƒeG d•d–„ d–ƒƒƒZ7ed—ƒeG d˜d™„ d™ƒƒƒZ8edšƒeG d›dœ„ dœƒƒƒZ9ed�ƒeG dždŸ„ dŸƒƒƒZ:ed ƒeG d¡d¢„ d¢ƒƒƒZ;dS )°é    )ÚannotationsN)Ú	dataclassé   )Úevent_classÚT_JSON_DICT)Úruntimec                      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 )ÚBreakpointIdzBreakpoint identifier.Ústr©Úreturnc                 C  s   | S ©N© ©Úselfr   r   ú4E:\soccer\ml_env\Lib\site-packages\mycdp/debugger.pyÚto_json   s    zBreakpointId.to_json©Újsonr   c                 C  s   | |ƒS r   r   ©Úclsr   r   r   r   Ú	from_json   s    zBreakpointId.from_jsonc                   s   d  tƒ  ¡ ¡S )NzBreakpointId({})©ÚformatÚsuperÚ__repr__r   ©Ú	__class__r   r   r      s    zBreakpointId.__repr__©	Ú__name__Ú
__module__Ú__qualname__Ú__doc__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 )ÚCallFrameIdzCall frame identifier.r	   r
   c                 C  s   | S r   r   r   r   r   r   r   !   s    zCallFrameId.to_jsonr   c                 C  s   | |ƒS r   r   r   r   r   r   r   $   s    zCallFrameId.from_jsonc                   s   d  tƒ  ¡ ¡S )NzCallFrameId({})r   r   r   r   r   r   (   s    zCallFrameId.__repr__r   r   r   r   r   r$      s
   r$   c                   @  sP   e Zd ZU dZded< ded< dZded< d	d
œdd„Zed	d dœdd„ƒZdS )ÚLocationúLocation in the source code.úruntime.ScriptIdÚ	script_idÚintÚline_numberNútyping.Optional[int]Úcolumn_numberr   r
   c                 C  s6   t ƒ }| j ¡ |d< | j|d< | jd ur2| j|d< |S )NÚscriptIdÚ
lineNumberÚcolumnNumber)Údictr(   r   r*   r,   ©r   r   r   r   r   r   6   s    


zLocation.to_jsonr   c                 C  sD   | t j | d¡¡t| d¡ƒ| dd ¡d ur<t| d¡ƒnd d�S )Nr-   r.   r/   )r(   r*   r,   )r   ÚScriptIdr   Úgetr)   r   r   r   r   r   >   s    ÿúzLocation.from_json)	r   r   r    r!   Ú__annotations__r,   r   r"   r   r   r   r   r   r%   ,   s   
r%   c                   @  sD   e Zd ZU dZded< ded< ddœdd„Zedd d	œd
d„ƒZdS )ÚScriptPositionr&   r)   r*   r,   r   r
   c                 C  s   t ƒ }| j|d< | j|d< |S )Nr.   r/   )r0   r*   r,   r1   r   r   r   r   Q   s    

zScriptPosition.to_jsonr   c                 C  s    | t | d¡ƒt | d¡ƒd�S )Nr.   r/   )r*   r,   )r)   r3   r   r   r   r   r   W   s    þzScriptPosition.from_jsonN©r   r   r    r!   r4   r   r"   r   r   r   r   r   r5   K   s   
r5   c                   @  sL   e Zd ZU dZded< ded< ded< ddœd	d
„Zedd dœdd„ƒZdS )ÚLocationRangez!Location range within one script.r'   r(   r5   ÚstartÚendr   r
   c                 C  s4   t ƒ }| j ¡ |d< | j ¡ |d< | j ¡ |d< |S )Nr-   r8   r9   )r0   r(   r   r8   r9   r1   r   r   r   r   f   s
    zLocationRange.to_jsonr   c                 C  s4   | t j | d¡¡t | d¡¡t | d¡¡d�S )Nr-   r8   r9   )r(   r8   r9   )r   r2   r   r3   r5   r   r   r   r   r   m   s
    ýzLocationRange.from_jsonNr6   r   r   r   r   r7   _   s   
r7   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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 )Ú	CallFramez@JavaScript call frame. Array of call frames form the call stack.r$   Úcall_frame_idr	   Úfunction_namer%   ÚlocationÚurlztyping.List[Scope]Úscope_chainúruntime.RemoteObjectÚthisNútyping.Optional[Location]Úfunction_locationz%typing.Optional[runtime.RemoteObject]Úreturn_valueútyping.Optional[bool]Úcan_be_restartedr   r
   c                 C  s    t ƒ }| j ¡ |d< | j|d< | j ¡ |d< | j|d< dd„ | jD ƒ|d< | j ¡ |d< | jd urp| j ¡ |d	< | j	d urˆ| j	 ¡ |d
< | j
d urœ| j
|d< |S )NÚcallFrameIdÚfunctionNamer=   r>   c                 S  s   g | ]}|  ¡ ‘qS r   ©r   ©Ú.0Úir   r   r   Ú
<listcomp>™   ó    z%CallFrame.to_json.<locals>.<listcomp>Ú
scopeChainrA   ÚfunctionLocationÚreturnValueÚcanBeRestarted)r0   r;   r   r<   r=   r>   r?   rA   rC   rD   rF   r1   r   r   r   r   “   s    





zCallFrame.to_jsonr   c                 C  sÂ   | t  | d¡¡t| d¡ƒt | d¡¡t| d¡ƒdd„ |d D ƒtj | d¡¡| d	d ¡d urvt | d	¡¡nd | d
d ¡d urštj | d
¡¡nd | dd ¡d urºt| d¡ƒnd d�	S )NrG   rH   r=   r>   c                 S  s   g | ]}t  |¡‘qS r   )ÚScoper   rJ   r   r   r   rM   ª   rN   z'CallFrame.from_json.<locals>.<listcomp>rO   rA   rP   rQ   rR   )	r;   r<   r=   r>   r?   rA   rC   rD   rF   )r$   r   r3   r	   r%   r   ÚRemoteObjectÚboolr   r   r   r   r   £   s"    ÿÿÿìzCallFrame.from_json)r   r   r    r!   r4   rC   rD   rF   r   r"   r   r   r   r   r   r:   v   s   
r:   c                   @  sh   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dœdd„Ze	dd dœdd„ƒZ
dS )rS   zScope description.r	   Útype_r@   Úobject_Nútyping.Optional[str]ÚnamerB   Ústart_locationÚend_locationr   r
   c                 C  sf   t ƒ }| j|d< | j ¡ |d< | jd ur2| j|d< | jd urJ| j ¡ |d< | jd urb| j ¡ |d< |S )NÚtypeÚobjectrY   ÚstartLocationÚendLocation)r0   rV   rW   r   rY   rZ   r[   r1   r   r   r   r   Ï   s    




zScope.to_jsonr   c              
   C  sˆ   | t | d¡ƒtj | d¡¡| dd ¡d ur<t | d¡ƒnd | dd ¡d ur^t | d¡¡nd | dd ¡d ur€t | d¡¡nd d�S )Nr\   r]   rY   r^   r_   )rV   rW   rY   rZ   r[   )r	   r3   r   rT   r   r%   r   r   r   r   r   Û   s    ÿÿÿðzScope.from_json)r   r   r    r!   r4   rY   rZ   r[   r   r"   r   r   r   r   r   rS   ¾   s   
rS   c                   @  sD   e Zd ZU dZded< ded< ddœdd	„Zedd d
œdd„ƒZdS )ÚSearchMatchzSearch match for resource.Úfloatr*   r	   Úline_contentr   r
   c                 C  s   t ƒ }| j|d< | j|d< |S )Nr.   ÚlineContent)r0   r*   rb   r1   r   r   r   r   ú   s    

zSearchMatch.to_jsonr   c                 C  s    | t | d¡ƒt| d¡ƒd�S )Nr.   rc   )r*   rb   )ra   r3   r	   r   r   r   r   r      s    þzSearchMatch.from_jsonNr6   r   r   r   r   r`   ò   s   
r`   c                   @  sX   e Zd ZU ded< 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 )ÚBreakLocationr'   r(   r)   r*   Nr+   r,   rX   rV   r   r
   c                 C  sJ   t ƒ }| j ¡ |d< | j|d< | jd ur2| j|d< | jd urF| j|d< |S )Nr-   r.   r/   r\   )r0   r(   r   r*   r,   rV   r1   r   r   r   r     s    




zBreakLocation.to_jsonr   c                 C  sd   | t j | d¡¡t| d¡ƒ| dd ¡d ur<t| d¡ƒnd | dd ¡d ur\t| d¡ƒnd d�S )Nr-   r.   r/   r\   )r(   r*   r,   rV   )r   r2   r   r3   r)   r	   r   r   r   r   r     s    ÿÿõzBreakLocation.from_json)	r   r   r    r4   r,   rV   r   r"   r   r   r   r   r   rd     s   

rd   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 )ÚWasmDisassemblyChunkútyping.List[str]Úlinesztyping.List[int]Úbytecode_offsetsr   r
   c                 C  s2   t ƒ }dd„ | jD ƒ|d< dd„ | jD ƒ|d< |S )Nc                 S  s   g | ]}|‘qS r   r   rJ   r   r   r   rM   7  rN   z0WasmDisassemblyChunk.to_json.<locals>.<listcomp>rg   c                 S  s   g | ]}|‘qS r   r   rJ   r   r   r   rM   8  rN   ÚbytecodeOffsets)r0   rg   rh   r1   r   r   r   r   5  s    zWasmDisassemblyChunk.to_jsonr   c                 C  s(   | dd„ |d D ƒdd„ |d D ƒd�S )Nc                 S  s   g | ]}t |ƒ‘qS r   ©r	   rJ   r   r   r   rM   >  rN   z2WasmDisassemblyChunk.from_json.<locals>.<listcomp>rg   c                 S  s   g | ]}t |ƒ‘qS r   ©r)   rJ   r   r   r   rM   ?  rN   ri   )rg   rh   r   r   r   r   r   r   ;  s    þzWasmDisassemblyChunk.from_jsonN)r   r   r    r4   r   r"   r   r   r   r   r   re   .  s
   
re   c                   @  s:   e Zd ZdZdZdZddœdd„Zedd dœd	d
„ƒZdS )ÚScriptLanguagez"Enum of possible script languages.Ú
JavaScriptÚWebAssemblyr	   r
   c                 C  s   | j S r   )Úvaluer   r   r   r   r   H  s    zScriptLanguage.to_jsonr   c                 C  s   | |ƒS r   r   r   r   r   r   r   K  s    zScriptLanguage.from_jsonN)	r   r   r    r!   ZJAVA_SCRIPTZWEB_ASSEMBLYr   r"   r   r   r   r   r   rl   C  s   rl   c                   @  sH   e Zd ZU dZded< dZded< ddœd	d
„Zedd dœdd„ƒZdS )ÚDebugSymbolsz*Debug symbols available for a wasm script.r	   rV   NrX   Úexternal_urlr   r
   c                 C  s(   t ƒ }| j|d< | jd ur$| j|d< |S )Nr\   ÚexternalURL)r0   rV   rq   r1   r   r   r   r   X  s
    


zDebugSymbols.to_jsonr   c                 C  s4   | t | d¡ƒ| dd ¡d ur,t | d¡ƒnd d�S )Nr\   rr   )rV   rq   )r	   r3   r   r   r   r   r   _  s    ÿûzDebugSymbols.from_json)	r   r   r    r!   r4   rq   r   r"   r   r   r   r   r   rp   P  s   
rp   rX   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None])r=   Útarget_call_framesr   c                 c  s6   t ƒ }|  ¡ |d< |dur"||d< d|dœ}|V }dS )z›
    Continues execution until specific location is reached.
    :param location: Location to continue to.
    :param target_call_frames: *(Optional)*
    r=   NZtargetCallFrameszDebugger.continueToLocation©ÚmethodÚparams©r0   r   )r=   rs   rv   Úcmd_dictr   r   r   r   Úcontinue_to_locationk  s    þry   r
   c                  c  s   ddi} | V }dS )z!Disables debugger for given page.ru   zDebugger.disableNr   ©rx   r   r   r   r   Údisable~  s    ÿr{   ztyping.Optional[float]zDtyping.Generator[T_JSON_DICT, T_JSON_DICT, runtime.UniqueDebuggerId])Úmax_scripts_cache_sizer   c                 c  s8   t ƒ }| dur| |d< d|dœ}|V }tj | d¡¡S )a·  
    Enables debugger for the given page.
    Clients should not assume that the debugging has been
    enabled until the result for this command is received.
    :param max_scripts_cache_size: **(EXPERIMENTAL)** *(Optional)*
    The maximum size in bytes of collected scripts
    (not referenced by other heap objects) the debugger can hold.
    Puts no limit if parameter is omitted.
    :returns: Unique identifier of the debugger.
    NZmaxScriptsCacheSizezDebugger.enablert   Z
debuggerId)r0   r   ZUniqueDebuggerIdr   r3   )r|   rv   rx   r   r   r   r   Úenable†  s    þr}   r	   rE   z"typing.Optional[runtime.TimeDelta]zytyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[runtime.RemoteObject, typing.Optional[runtime.ExceptionDetails]]])
r;   Ú
expressionÚobject_groupÚinclude_command_line_apiÚsilentÚreturn_by_valueÚgenerate_previewÚthrow_on_side_effectÚtimeoutr   c	                 c  sÖ   t ƒ }	|  ¡ |	d< ||	d< |dur*||	d< |dur:||	d< |durJ||	d< |durZ||	d< |durj||	d< |durz||	d	< |durŽ| ¡ |	d
< d|	dœ}
|
V }tj | d¡¡| dd¡durÐtj | d¡¡ndfS )aS  
    Evaluates expression on a given call frame.
    :param call_frame_id: Call frame identifier to evaluate on.
    :param expression: Expression to evaluate.
    :param object_group: *(Optional)*
     String object group name to put result into
     (allows releasing resulting object handles using ``releaseObjectGroup``).
    :param include_command_line_api: *(Optional)*
     Specifies whether command line API should be available
    to the evaluated expression, defaults to false.
    :param silent: *(Optional)*
     In silent mode exceptions thrown during evaluation are not reported
     and do not pause execution. Overrides ````setPauseOnException``` state.
    :param return_by_value: *(Optional)*
     Whether the result is expected to be a JSON object
     that should be sent by value.
    :param generate_preview: **(EXPERIMENTAL)** *(Optional)*
     Whether preview should be generated for the result.
    :param throw_on_side_effect: *(Optional)*
     Whether to throw an exception if side effect cannot be ruled out
     during evaluation.
    :param timeout: **(EXPERIMENTAL)** *(Optional)*
    Terminate execution after timing out (number of milliseconds).
    :returns: A tuple with the following items:
        0. **result** - Object wrapper for the evaluation result.
        1. **exceptionDetails** - *(Optional)* Exception details.
    rG   r~   NZobjectGroupZincludeCommandLineAPIr�   ZreturnByValueZgeneratePreviewZthrowOnSideEffectr…   zDebugger.evaluateOnCallFramert   ÚresultÚexceptionDetails)r0   r   r   rT   r   r3   ÚExceptionDetails)r;   r~   r   r€   r�   r‚   rƒ   r„   r…   rv   rx   r   r   r   r   Úevaluate_on_call_framež  s4    ,þÿûr‰   rB   zFtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[BreakLocation]])r8   r9   Úrestrict_to_functionr   c                 c  sX   t ƒ }|  ¡ |d< |dur&| ¡ |d< |dur6||d< d|dœ}|V }dd„ |d	 D ƒS )
a,  
    Returns possible locations for breakpoint.
    scriptId in start and end range locations should be the same.
    :param start: Start of range to search possible breakpoint locations in.
    :param end: *(Optional)*
      End of range to search possible breakpoint locations in (excluding).
      When not specified, end of scripts is used as end of range.
    :param restrict_to_function: *(Optional)*
     Only consider locations which are in the same (non-nested)
     function as start.
    :returns: List of the possible breakpoint locations.
    r8   Nr9   ZrestrictToFunctionzDebugger.getPossibleBreakpointsrt   c                 S  s   g | ]}t  |¡‘qS r   )rd   r   rJ   r   r   r   rM     rN   z,get_possible_breakpoints.<locals>.<listcomp>Ú	locationsrw   )r8   r9   rŠ   rv   rx   r   r   r   r   Úget_possible_breakpointsê  s    þrŒ   r'   zStyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[str, typing.Optional[str]]])r(   r   c                 c  sR   t ƒ }|  ¡ |d< d|dœ}|V }t| d¡ƒ| dd¡durLt| d¡ƒndfS )a_  
    Returns source for the script with given id.
    :param script_id: Id of the script to get source for.
    :returns: A tuple with the following items:
        0. **scriptSource** - Script source (empty in case of Wasm bytecode).
        1. **bytecode** - *(Optional)* Wasm bytecode.
        (Encoded as a base64 string when passed over JSON)
    r-   zDebugger.getScriptSourcert   ÚscriptSourceÚbytecodeN)r0   r   r	   r3   ©r(   rv   rx   r   r   r   r   Úget_script_source	  s    þÿûr�   z{typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[typing.Optional[str], int, typing.List[int], WasmDisassemblyChunk]]c                 c  sp   t ƒ }|  ¡ |d< d|dœ}|V }| dd¡dur@t| d¡ƒndt| d¡ƒdd„ |d	 D ƒt | d
¡¡fS )aq  
    **EXPERIMENTAL**
    :param script_id: Id of the script to disassemble
    :returns: A tuple with the following items:
        0. **streamId** - *(Optional)*
          For large modules, return a stream from which additional chunks
          of disassembly can be read successively.
        1. **totalNumberOfLines** -
          The total number of lines in the disassembly text.
        2. **functionBodyOffsets** -
          The offsets of all function bodies,
          in the format [start1, end1, start2, end2, ...] where all ends
          are exclusive.
        3. **chunk** - The first chunk of disassembly.
    r-   zDebugger.disassembleWasmModulert   ÚstreamIdNZtotalNumberOfLinesc                 S  s   g | ]}t |ƒ‘qS r   rk   rJ   r   r   r   rM   M  rN   z+disassemble_wasm_module.<locals>.<listcomp>ZfunctionBodyOffsetsÚchunk)r0   r   r3   r	   r)   re   r   r�   r   r   r   Údisassemble_wasm_module'  s    þÿør“   z@typing.Generator[T_JSON_DICT, T_JSON_DICT, WasmDisassemblyChunk])Ú	stream_idr   c                 c  s.   t ƒ }| |d< d|dœ}|V }t | d¡¡S )a^  
    Disassemble the next chunk of lines for the module corresponding to the
    stream. If disassembly is complete, this API will invalidate the streamId
    and return an empty chunk. Any subsequent calls for the now invalid stream
    will return errors.
    **EXPERIMENTAL**
    :param stream_id:
    :returns: The next chunk of disassembly.
    r‘   z!Debugger.nextWasmDisassemblyChunkrt   r’   )r0   re   r   r3   )r”   rv   rx   r   r   r   r   Únext_wasm_disassembly_chunkR  s    þr•   zruntime.StackTraceIdz>typing.Generator[T_JSON_DICT, T_JSON_DICT, runtime.StackTrace])Ústack_trace_idr   c                 c  s4   t ƒ }|  ¡ |d< d|dœ}|V }tj | d¡¡S )zj
    Returns stack trace with given ``stackTraceId``.
    **EXPERIMENTAL**
    :param stack_trace_id:
    ZstackTraceIdzDebugger.getStackTracert   Ú
stackTrace)r0   r   r   Ú
StackTracer   r3   )r–   rv   rx   r   r   r   r   Úget_stack_traceh  s    þr™   c                  c  s   ddi} | V }dS )z'Stops on the next JavaScript statement.ru   zDebugger.pauseNr   rz   r   r   r   Úpausez  s    ÿrš   )Úbreakpoint_idr   c                 c  s&   t ƒ }|  ¡ |d< d|dœ}|V }dS )zB
    Removes JavaScript breakpoint.
    :param breakpoint_id:
    ÚbreakpointIdzDebugger.removeBreakpointrt   Nrw   )r›   rv   rx   r   r   r   r   Úremove_breakpoint‚  s    þr�   zœtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[typing.List[CallFrame], typing.Optional[runtime.StackTrace], typing.Optional[runtime.StackTraceId]]])r;   Úmoder   c                 c  sŽ   t ƒ }|  ¡ |d< |dur"||d< d|dœ}|V }dd„ |d D ƒ| d	d¡durdtj | d	¡¡nd| d
d¡durˆtj | d
¡¡ndfS )aË  
    Restarts particular call frame from the beginning. The old, deprecated
    behavior of `restartFrame` is to stay paused and allow further CDP commands
    after a restart was scheduled. This can cause problems with restarting, so
    we now continue execution immediatly after it has been scheduled until we
    reach the beginning of the restarted frame.
    To stay back-wards compatible, ``restartFrame`` now expects a ``mode``
    parameter to be present. If the `mode` parameter is missing, `restartFrame`
    errors out.
    The various return values are deprecated and `callFrames` is always empty.
    Use the call frames from the ``Debugger#paused`` events instead, that fires
    once V8 pauses at the beginning of the restarted function.
    :param call_frame_id: Call frame identifier to evaluate on.
    :param mode: **(EXPERIMENTAL)** *(Optional)* The ``mode`` parameter
     must be present and set to 'StepInto', otherwise ``restartFrame``
     will error out.
    :returns: A tuple with the following items:
        0. **callFrames** - New stack trace.
        1. **asyncStackTrace** - *(Optional)* Async stack trace, if any.
        2. **asyncStackTraceId** - *(Optional)* Async stack trace, if any.
    rG   Nrž   zDebugger.restartFramert   c                 S  s   g | ]}t  |¡‘qS r   ©r:   r   rJ   r   r   r   rM   ¼  rN   z!restart_frame.<locals>.<listcomp>Ú
callFramesÚasyncStackTraceÚasyncStackTraceId)r0   r   r3   r   r˜   r   ÚStackTraceId)r;   rž   rv   rx   r   r   r   r   Úrestart_frame’  s      þÿÿör¤   )Úterminate_on_resumer   c                 c  s*   t ƒ }| dur| |d< d|dœ}|V }dS )a½  
    Resumes JavaScript execution.
    :param terminate_on_resume: *(Optional)*
    Set to true to terminate execution upon resuming execution.
    In contrast to Runtime.terminateExecution,
    this will allows to execute further JavaScript (i.e. via evaluation)
    until execution of the paused code is actually resumed,
    at which point termination is triggered.
    If execution is currently not paused, this parameter has no effect.
    NZterminateOnResumezDebugger.resumert   ©r0   )r¥   rv   rx   r   r   r   r   ÚresumeÊ  s    þr§   zDtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[SearchMatch]])r(   ÚqueryÚcase_sensitiveÚis_regexr   c                 c  s\   t ƒ }|  ¡ |d< ||d< |dur*||d< |dur:||d< d|dœ}|V }dd	„ |d
 D ƒS )aQ  
    Searches for given string in script content.
    :param script_id: Id of the script to search in.
    :param query: String to search for.
    :param case_sensitive: *(Optional)* If true, search is case sensitive.
    :param is_regex: *(Optional)* If true, treats string parameter as regex.
    :returns: List of search matches.
    r-   r¨   NZcaseSensitiveZisRegexzDebugger.searchInContentrt   c                 S  s   g | ]}t  |¡‘qS r   )r`   r   rJ   r   r   r   rM   û  rN   z%search_in_content.<locals>.<listcomp>r†   rw   )r(   r¨   r©   rª   rv   rx   r   r   r   r   Úsearch_in_contentá  s    þr«   r)   )Ú	max_depthr   c                 c  s"   t ƒ }| |d< d|dœ}|V }dS )z»
    Enables or disables async call stacks tracking.
    :param max_depth: Maximum depth of async call stacks.
    Setting to `0` will disable collecting async call stacks (default).
    ZmaxDepthzDebugger.setAsyncCallStackDepthrt   Nr¦   )r¬   rv   rx   r   r   r   r   Úset_async_call_stack_depthþ  s    þr­   rf   )Úpatternsr   c                 c  s,   t ƒ }dd„ | D ƒ|d< d|dœ}|V }dS )a¤  
    Replace previous blackbox patterns with passed ones.
    Forces backend to skip stepping/pausing in
    scripts with url matching one of the patterns.
    VM will try to leave blackboxed script by
    performing 'step in' several times,
    finally resorting to 'step out' if unsuccessful.
    **EXPERIMENTAL**
    :param patterns:
    Array of regexps that will be used to check script url for blackbox state.
    c                 S  s   g | ]}|‘qS r   r   rJ   r   r   r   rM     rN   z)set_blackbox_patterns.<locals>.<listcomp>r®   zDebugger.setBlackboxPatternsrt   Nr¦   )r®   rv   rx   r   r   r   r   Úset_blackbox_patterns  s    þr¯   ztyping.List[ScriptPosition])r(   Ú	positionsr   c                 c  s8   t ƒ }|  ¡ |d< dd„ |D ƒ|d< d|dœ}|V }dS )a¤  
    Makes backend skip steps in the script in blackboxed ranges.
    VM will try leave blacklisted scripts by performing 'step in'
    several times, finally resorting to 'step out' if unsuccessful.
    Positions array contains positions where blackbox state is changed.
    First interval isn't blackboxed. Array should be sorted.
    **EXPERIMENTAL**
    :param script_id: Id of the script.
    :param positions:
    r-   c                 S  s   g | ]}|  ¡ ‘qS r   rI   rJ   r   r   r   rM   5  rN   z)set_blackboxed_ranges.<locals>.<listcomp>r°   zDebugger.setBlackboxedRangesrt   Nrw   )r(   r°   rv   rx   r   r   r   r   Úset_blackboxed_ranges&  s    þr±   zPtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[BreakpointId, Location]])r=   Ú	conditionr   c                 c  sR   t ƒ }|  ¡ |d< |dur"||d< d|dœ}|V }t | d¡¡t | d¡¡fS )aü  
    Sets JavaScript breakpoint at a given location.
    :param location: Location to set breakpoint in.
    :param condition: *(Optional)* Expression to use as a breakpoint condition.
     When specified, debugger will only stop on the breakpoint
     if this expression evaluates to true.
    :returns: A tuple with the following items:
        0. **breakpointId** -
           ID of the created breakpoint for further reference.
        1. **actualLocation** - Location this breakpoint resolved into.
    r=   Nr²   zDebugger.setBreakpointrt   rœ   ZactualLocation)r0   r   r   r   r3   r%   )r=   r²   rv   rx   r   r   r   r   Úset_breakpoint=  s    þþr³   z8typing.Generator[T_JSON_DICT, T_JSON_DICT, BreakpointId])Úinstrumentationr   c                 c  s.   t ƒ }| |d< d|dœ}|V }t | d¡¡S )zž
    Sets instrumentation breakpoint.
    :param instrumentation: Instrumentation name.
    :returns: Id of the created breakpoint for further reference.
    r´   z%Debugger.setInstrumentationBreakpointrt   rœ   ©r0   r   r   r3   )r´   rv   rx   r   r   r   r   Úset_instrumentation_breakpoint\  s    þr¶   r+   z]typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[BreakpointId, typing.List[Location]]])r*   r>   Ú	url_regexÚscript_hashr,   r²   r   c           	      c  s�   t ƒ }| |d< |dur||d< |dur.||d< |dur>||d< |durN||d< |dur^||d< d|d	œ}|V }t | d
¡¡dd„ |d D ƒfS )a  
    Sets JavaScript breakpoint at given location specified either by URL
    or URL regex. Once this command is issued, all existing parsed scripts
    will have breakpoints resolved and returned in ``locations`` property.
    Further matching script parsing will result in subsequent
    ``breakpointResolved`` events issued.
    This logical breakpoint will survive page reloads.
    :param line_number: Line number to set breakpoint at.
    :param url: *(Optional)* URL of the resources to set breakpoint on.
    :param url_regex: *(Optional)*
     Regex pattern for the URLs of the resources to set breakpoints on.
     Either ```url```` or ````urlRegex``` must be specified.
    :param script_hash: *(Optional)*
     Script hash of the resources to set breakpoint on.
    :param column_number: *(Optional)*
     Offset in the line to set breakpoint at.
    :param condition: *(Optional)*
     Expression to use as a breakpoint condition.
     When specified, debugger will only stop on the breakpoint
     if this expression evaluates to true.
    :returns: A tuple with the following items:
        0. **breakpointId** -
          Id of the created breakpoint for further reference.
        1. **locations** - List of the locations this breakpoint resolved
          into upon addition.
    r.   Nr>   ZurlRegexZ
scriptHashr/   r²   zDebugger.setBreakpointByUrlrt   rœ   c                 S  s   g | ]}t  |¡‘qS r   )r%   r   rJ   r   r   r   rM   ¥  rN   z)set_breakpoint_by_url.<locals>.<listcomp>r‹   rµ   )	r*   r>   r·   r¸   r,   r²   rv   rx   r   r   r   r   Úset_breakpoint_by_urln  s&    $þþr¹   zruntime.RemoteObjectId)Ú	object_idr²   r   c                 c  sB   t ƒ }|  ¡ |d< |dur"||d< d|dœ}|V }t | d¡¡S )aü  
    Sets JavaScript breakpoint before each call to the given function.
    If another function was created from the same source as a given one,
    calling it will also trigger the breakpoint.
    **EXPERIMENTAL**
    :param object_id: Function object id.
    :param condition: *(Optional)* Expression to use as a breakpoint condition.
     When specified, debugger will stop on the breakpoint
     if this expression evaluates to true.
    :returns: Id of the created breakpoint for further reference.
    ZobjectIdNr²   z$Debugger.setBreakpointOnFunctionCallrt   rœ   )r0   r   r   r   r3   )rº   r²   rv   rx   r   r   r   r   Úset_breakpoint_on_function_call©  s    þr»   rU   )Úactiver   c                 c  s"   t ƒ }| |d< d|dœ}|V }dS )zy
    Activates / deactivates all breakpoints on the page.
    :param active: New value for breakpoints active state.
    r¼   zDebugger.setBreakpointsActivert   Nr¦   )r¼   rv   rx   r   r   r   r   Úset_breakpoints_activeÃ  s    þr½   )Ústater   c                 c  s"   t ƒ }| |d< d|dœ}|V }dS )zó
    Defines pause on exceptions state.
    Can be set to stop on all exceptions, uncaught exceptions,
    or caught exceptions, no exceptions.
    Initial pause on exceptions state is ``none``.
    :param state: Pause on exceptions mode.
    r¾   zDebugger.setPauseOnExceptionsrt   Nr¦   )r¾   rv   rx   r   r   r   r   Úset_pause_on_exceptionsÓ  s    
þr¿   zruntime.CallArgument)Ú	new_valuer   c                 c  s&   t ƒ }|  ¡ |d< d|dœ}|V }dS )z’
    Changes return value in top frame. Available only at return break position.
    **EXPERIMENTAL**
    :param new_value: New return value.
    ÚnewValuezDebugger.setReturnValuert   Nrw   )rÀ   rv   rx   r   r   r   r   Úset_return_valueæ  s    þrÂ   zôtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[typing.Optional[typing.List[CallFrame]], typing.Optional[bool], typing.Optional[runtime.StackTrace], typing.Optional[runtime.StackTraceId], str, typing.Optional[runtime.ExceptionDetails]]])r(   Úscript_sourceÚdry_runÚallow_top_frame_editingr   c              
   c  s  t ƒ }|  ¡ |d< ||d< |dur*||d< |dur:||d< d|dœ}|V }| dd¡durld	d
„ |d D ƒnd| dd¡durŒt| d¡ƒnd| dd¡dur°tj | d¡¡nd| dd¡durÔtj | d¡¡ndt| d¡ƒ| dd¡du�rtj	 | d¡¡ndfS )a¥  
    Edits JavaScript source live.
    In general, functions that are currently on the stack cannot be edited with
    a single exception: If the edited function is the top-most stack frame and
    that is the only activation of that function on the stack. In this case
    the live edit will be successful and a ``Debugger.restartFrame`` for the
    top-most function is automatically triggered.
    :param script_id: Id of the script to edit.
    :param script_source: New content of the script.
    :param dry_run: *(Optional)*
     If true the change will not actually be applied.
     Dry run may be used to get result description
     without actually modifying the code.
    :param allow_top_frame_editing: **(EXPERIMENTAL)** *(Optional)*
     If true, then ``scriptSource`` is allowed to change the function
     on top of the stack as long as the top-most stack frame is the
     only activation of that function.
    :returns: A tuple with the following items:
        0. **callFrames** - *(Optional)*
          New stack trace in case editing has happened while VM was stopped.
        1. **stackChanged** - *(Optional)*
          Whether current call stack was modified after applying the changes.
        2. **asyncStackTrace** - *(Optional)* Async stack trace, if any.
        3. **asyncStackTraceId** - *(Optional)* Async stack trace, if any.
        4. **status** - Whether the operation was successful or not.
          Only `` Ok`` denotes a successful live edit
          while the other enum variants denote why the live edit failed.
        5. **exceptionDetails** - *(Optional)*
          Exception details if any.
          Only present when ``status`` is `` CompileError`.
    r-   r�   NZdryRunZallowTopFrameEditingzDebugger.setScriptSourcert   r    c                 S  s   g | ]}t  |¡‘qS r   rŸ   rJ   r   r   r   rM   5  rN   z%set_script_source.<locals>.<listcomp>ZstackChangedr¡   r¢   Ústatusr‡   )
r0   r   r3   rU   r   r˜   r   r£   r	   rˆ   )r(   rÃ   rÄ   rÅ   rv   rx   r   r   r   r   Úset_script_source÷  s8    0þÿÿÿÿÿçrÇ   )Úskipr   c                 c  s"   t ƒ }| |d< d|dœ}|V }dS )z’
    Makes page not interrupt on any pauses
    (breakpoint, exception, dom exception etc).
    :param skip: New value for skip pauses state.
    rÈ   zDebugger.setSkipAllPausesrt   Nr¦   )rÈ   rv   rx   r   r   r   r   Úset_skip_all_pausesQ  s    þrÉ   )Úscope_numberÚvariable_namerÀ   r;   r   c                 c  sB   t ƒ }| |d< ||d< | ¡ |d< | ¡ |d< d|dœ}|V }dS )aÏ  
    Changes value of variable in a callframe.
    Object-based scopes are not supported and must be mutated manually.
    :param scope_number: 0-based number of scope as was listed in scope chain.
     Only 'local', 'closure' and 'catch' scope types are allowed.
     Other scopes could be manipulated manually.
    :param variable_name: Variable name.
    :param new_value: New variable value.
    :param call_frame_id: Id of callframe that holds variable.
    ZscopeNumberZvariableNamerÁ   rG   zDebugger.setVariableValuert   Nrw   )rÊ   rË   rÀ   r;   rv   rx   r   r   r   r   Úset_variable_valueb  s    þrÌ   z+typing.Optional[typing.List[LocationRange]])Úbreak_on_async_callÚ	skip_listr   c                 c  sD   t ƒ }| dur| |d< |dur0dd„ |D ƒ|d< d|dœ}|V }dS )a[  
    Steps into the function call.
    :param break_on_async_call: **(EXPERIMENTAL)** *(Optional)*
     Debugger will pause on the execution of the first async task
     which was scheduled before next pause.
    :param skip_list: **(EXPERIMENTAL)** *(Optional)*
    The skipList specifies location ranges that should be skipped on step into.
    NZbreakOnAsyncCallc                 S  s   g | ]}|  ¡ ‘qS r   rI   rJ   r   r   r   rM   Ž  rN   zstep_into.<locals>.<listcomp>ÚskipListzDebugger.stepIntort   r¦   )rÍ   rÎ   rv   rx   r   r   r   r   Ú	step_into~  s    þrÐ   c                  c  s   ddi} | V }dS )zSteps out of the function call.ru   zDebugger.stepOutNr   rz   r   r   r   Ústep_out–  s    ÿrÑ   )rÎ   r   c                 c  s4   t ƒ }| dur dd„ | D ƒ|d< d|dœ}|V }dS )z©
    Steps over the statement.
    :param skip_list: **(EXPERIMENTAL)** *(Optional)*
    The skipList specifies location ranges that should be skipped on step over.
    Nc                 S  s   g | ]}|  ¡ ‘qS r   rI   rJ   r   r   r   rM   ¨  rN   zstep_over.<locals>.<listcomp>rÏ   zDebugger.stepOverrt   r¦   )rÎ   rv   rx   r   r   r   r   Ú	step_overž  s    þrÒ   zDebugger.breakpointResolvedc                   @  s6   e Zd ZU dZded< ded< edd dœdd	„ƒZd
S )ÚBreakpointResolvedzCFired when breakpoint is resolved to an actual script and location.r   r›   r%   r=   r   r   c                 C  s$   | t  | d¡¡t | d¡¡d�S )Nrœ   r=   )r›   r=   )r   r   r3   r%   r   r   r   r   r   ¹  s    þzBreakpointResolved.from_jsonN©r   r   r    r!   r4   r"   r   r   r   r   r   rÓ   °  s
   
rÓ   zDebugger.pausedc                   @  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< edd dœdd„ƒZdS )ÚPausedzk
    Fired when the virtual machine stopped on breakpoint
    or exception or any other stop criteria.
    ztyping.List[CallFrame]Úcall_framesr	   Úreasonútyping.Optional[dict]Údataz!typing.Optional[typing.List[str]]Úhit_breakpointsú#typing.Optional[runtime.StackTrace]Úasync_stack_tracez%typing.Optional[runtime.StackTraceId]Úasync_stack_trace_idÚasync_call_stack_trace_idr   r   c                 C  sÔ   | dd„ |d D ƒt | d¡ƒ| dd ¡d ur<t| d¡ƒnd | dd ¡d ur`dd„ |d 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�S )Nc                 S  s   g | ]}t  |¡‘qS r   rŸ   rJ   r   r   r   rM   Ú  rN   z$Paused.from_json.<locals>.<listcomp>r    r×   rÙ   ZhitBreakpointsc                 S  s   g | ]}t |ƒ‘qS r   rj   rJ   r   r   r   rM   â  rN   r¡   r¢   ZasyncCallStackTraceId)rÖ   r×   rÙ   rÚ   rÜ   rÝ   rÞ   )r	   r3   r0   r   r˜   r   r£   r   r   r   r   r   ×  s*    ÿÿÿÿýÿäzPaused.from_jsonNrÔ   r   r   r   r   rÕ   Á  s   
rÕ   zDebugger.resumedc                   @  s$   e Zd ZdZedd dœdd„ƒZdS )ÚResumedz1Fired when the virtual machine resumed execution.r   r   c                 C  s   | ƒ S r   r   r   r   r   r   r   ÿ  s    zResumed.from_jsonN)r   r   r    r!   r"   r   r   r   r   r   rß   ú  s   rß   zDebugger.scriptFailedToParsec                   @  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ed< ded< ded< ded< ded< ded< edd dœdd „ƒZd!S )"ÚScriptFailedToParsez5Fired when virtual machine fails to parse the script.r'   r(   r	   r>   r)   Ú
start_lineÚstart_columnÚend_lineÚ
end_columnúruntime.ExecutionContextIdÚexecution_context_idÚhash_rØ   Úexecution_context_aux_datarX   Úsource_map_urlrE   Úhas_source_urlÚ	is_moduler+   ÚlengthrÛ   Ústack_traceÚcode_offsetútyping.Optional[ScriptLanguage]Úscript_languageÚembedder_namer   r   c                 C  s   | t j | d¡¡t| d¡ƒt| d¡ƒt| d¡ƒt| d¡ƒt| d¡ƒt j | d¡¡t| d¡ƒ| d	d ¡d urˆt| d	¡ƒnd | d
d ¡d ur¨t| d
¡ƒnd | dd ¡d urÈt| d¡ƒnd | dd ¡d urèt| d¡ƒnd | dd ¡d u�r
t| d¡ƒnd | dd ¡d u�r0t j	 | d¡¡nd | dd ¡d u�rRt| d¡ƒnd | dd ¡d u�rvt
 | d¡¡nd | dd ¡d u�r˜t| d¡ƒnd d�S )Nr-   r>   Ú	startLineÚstartColumnÚendLineÚ	endColumnÚexecutionContextIdÚhashÚexecutionContextAuxDataÚsourceMapURLÚhasSourceURLÚisModulerì   r—   Ú
codeOffsetÚscriptLanguageÚembedderName)r(   r>   rá   râ   rã   rä   ræ   rç   rè   ré   rê   rë   rì   rí   rî   rð   rñ   )r   r2   r   r3   r	   r)   ÚExecutionContextIdr0   rU   r˜   rl   r   r   r   r   r   0  sN    ÿÿÿÿÿÿÿÿÿÿÊzScriptFailedToParse.from_jsonNrÔ   r   r   r   r   rà     s(   
rà   zDebugger.scriptParsedc                   @  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ed< ded< ded< ded< ded< ded< ded< ded< ed d d!œd"d#„ƒZd$S )%ÚScriptParsedz’
    Fired when virtual machine parses script.
    This event is also fired for all known and uncollected
    scripts upon enabling debugger.
    r'   r(   r	   r>   r)   rá   râ   rã   rä   rå   ræ   rç   rØ   rè   rE   Úis_live_editrX   ré   rê   rë   r+   rì   rÛ   rí   rî   rï   rð   ztyping.Optional[DebugSymbols]Údebug_symbolsrñ   r   r   c                 C  sæ  | t j | d¡¡t| d¡ƒt| d¡ƒt| d¡ƒt| d¡ƒt| d¡ƒt j | d¡¡t| d¡ƒ| d	d ¡d urˆt| d	¡ƒnd | d
d ¡d ur¨t| d
¡ƒnd | dd ¡d urÈt| d¡ƒnd | dd ¡d urèt| d¡ƒnd | dd ¡d u�r
t| d¡ƒnd | dd ¡d u�r,t| d¡ƒnd | dd ¡d u�rRt j	 | d¡¡nd | dd ¡d u�rtt| d¡ƒnd | dd ¡d u�r˜t
 | d¡¡nd | dd ¡d u�r¼t | d¡¡nd | dd ¡d u�rÞt| d¡ƒnd d�S )Nr-   r>   rò   ró   rô   rõ   rö   r÷   rø   Z
isLiveEditrù   rú   rû   rì   r—   rü   rý   ZdebugSymbolsrþ   )r(   r>   rá   râ   rã   rä   ræ   rç   rè   r  ré   rê   rë   rì   rí   rî   rð   r  rñ   )r   r2   r   r3   r	   r)   rÿ   r0   rU   r˜   rl   rp   r   r   r   r   r   £  sZ    ÿÿÿÿÿÿÿÿÿÿÿÿÀzScriptParsed.from_jsonNrÔ   r   r   r   r   r   m  s,   
r   )N)N)NNNNNNN)NN)N)N)NN)N)NNNNN)N)NN)NN)N)<Ú
__future__r   ÚenumÚtypingÚdataclassesr   Úutilr   r   Ú r   r	   r   r$   r%   r5   r7   r:   rS   r`   rd   re   ÚEnumrl   rp   ry   r{   r}   r‰   rŒ   r�   r“   r•   r™   rš   r�   r¤   r§   r«   r­   r¯   r±   r³   r¶   r¹   r»   r½   r¿   rÂ   rÇ   rÉ   rÌ   rÐ   rÑ   rÒ   rÓ   rÕ   rß   rà   r   r   r   r   r   Ú<module>   sÄ   G3% ÿ	 ÿ       ÷"N  ý+ ÿ9 ÿ  ü ÿ     ú< ÿ  üZ  þ	 ÿ7g