-module(protocol@debugger). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([encode__breakpoint_id/1, decode__breakpoint_id/1, encode__call_frame_id/1, decode__call_frame_id/1, encode__location/1, decode__location/1, encode__scope_type/1, decode__scope_type/1, encode__scope/1, encode__call_frame/1, decode__scope/1, decode__call_frame/1, encode__search_match/1, decode__search_match/1, encode__break_location_type/1, decode__break_location_type/1, encode__break_location/1, decode__break_location/1, encode__script_language/1, decode__script_language/1, encode__debug_symbols_type/1, decode__debug_symbols_type/1, encode__debug_symbols/1, decode__debug_symbols/1, decode__evaluate_on_call_frame_response/1, decode__get_possible_breakpoints_response/1, decode__get_script_source_response/1, decode__search_in_content_response/1, decode__set_breakpoint_response/1, decode__set_instrumentation_breakpoint_response/1, decode__set_breakpoint_by_url_response/1, decode__set_script_source_response/1, encode__continue_to_location_target_call_frames/1, continue_to_location/3, decode__continue_to_location_target_call_frames/1, disable/1, enable/1, evaluate_on_call_frame/8, get_possible_breakpoints/4, get_script_source/2, pause/1, remove_breakpoint/2, restart_frame/2, resume/2, search_in_content/5, set_async_call_stack_depth/2, set_breakpoint/3, encode__set_instrumentation_breakpoint_instrumentation/1, set_instrumentation_breakpoint/2, decode__set_instrumentation_breakpoint_instrumentation/1, set_breakpoint_by_url/7, set_breakpoints_active/2, encode__set_pause_on_exceptions_state/1, set_pause_on_exceptions/2, decode__set_pause_on_exceptions_state/1, set_script_source/4, set_skip_all_pauses/2, set_variable_value/5, step_into/1, step_out/1, step_over/1]). -export_type([breakpoint_id/0, call_frame_id/0, location/0, call_frame/0, scope/0, scope_type/0, search_match/0, break_location/0, break_location_type/0, script_language/0, debug_symbols/0, debug_symbols_type/0, evaluate_on_call_frame_response/0, get_possible_breakpoints_response/0, get_script_source_response/0, search_in_content_response/0, set_breakpoint_response/0, set_instrumentation_breakpoint_response/0, set_breakpoint_by_url_response/0, set_script_source_response/0, continue_to_location_target_call_frames/0, set_instrumentation_breakpoint_instrumentation/0, set_pause_on_exceptions_state/0]). -type breakpoint_id() :: {breakpoint_id, binary()}. -type call_frame_id() :: {call_frame_id, binary()}. -type location() :: {location, protocol@runtime:script_id(), integer(), gleam@option:option(integer())}. -type call_frame() :: {call_frame, call_frame_id(), binary(), gleam@option:option(location()), location(), list(scope()), protocol@runtime:remote_object(), gleam@option:option(protocol@runtime:remote_object())}. -type scope() :: {scope, scope_type(), protocol@runtime:remote_object(), gleam@option:option(binary()), gleam@option:option(location()), gleam@option:option(location())}. -type scope_type() :: scope_type_global | scope_type_local | scope_type_with | scope_type_closure | scope_type_catch | scope_type_block | scope_type_script | scope_type_eval | scope_type_module | scope_type_wasm_expression_stack. -type search_match() :: {search_match, float(), binary()}. -type break_location() :: {break_location, protocol@runtime:script_id(), integer(), gleam@option:option(integer()), gleam@option:option(break_location_type())}. -type break_location_type() :: break_location_type_debugger_statement | break_location_type_call | break_location_type_return. -type script_language() :: script_language_java_script | script_language_web_assembly. -type debug_symbols() :: {debug_symbols, debug_symbols_type(), gleam@option:option(binary())}. -type debug_symbols_type() :: debug_symbols_type_none | debug_symbols_type_source_map | debug_symbols_type_embedded_dwarf | debug_symbols_type_external_dwarf. -type evaluate_on_call_frame_response() :: {evaluate_on_call_frame_response, protocol@runtime:remote_object(), gleam@option:option(protocol@runtime:exception_details())}. -type get_possible_breakpoints_response() :: {get_possible_breakpoints_response, list(break_location())}. -type get_script_source_response() :: {get_script_source_response, binary(), gleam@option:option(binary())}. -type search_in_content_response() :: {search_in_content_response, list(search_match())}. -type set_breakpoint_response() :: {set_breakpoint_response, breakpoint_id(), location()}. -type set_instrumentation_breakpoint_response() :: {set_instrumentation_breakpoint_response, breakpoint_id()}. -type set_breakpoint_by_url_response() :: {set_breakpoint_by_url_response, breakpoint_id(), list(location())}. -type set_script_source_response() :: {set_script_source_response, gleam@option:option(protocol@runtime:exception_details())}. -type continue_to_location_target_call_frames() :: continue_to_location_target_call_frames_any | continue_to_location_target_call_frames_current. -type set_instrumentation_breakpoint_instrumentation() :: set_instrumentation_breakpoint_instrumentation_before_script_execution | set_instrumentation_breakpoint_instrumentation_before_script_with_source_map_execution. -type set_pause_on_exceptions_state() :: set_pause_on_exceptions_state_none | set_pause_on_exceptions_state_caught | set_pause_on_exceptions_state_uncaught | set_pause_on_exceptions_state_all. -spec encode__breakpoint_id(breakpoint_id()) -> gleam@json:json(). encode__breakpoint_id(Value__) -> case Value__ of {breakpoint_id, Inner_value__} -> gleam@json:string(Inner_value__) end. -spec decode__breakpoint_id(gleam@dynamic:dynamic_()) -> {ok, breakpoint_id()} | {error, list(gleam@dynamic:decode_error())}. decode__breakpoint_id(Value__) -> _pipe = Value__, (gleam@dynamic:decode1( fun(Field@0) -> {breakpoint_id, Field@0} end, fun gleam@dynamic:string/1 ))(_pipe). -spec encode__call_frame_id(call_frame_id()) -> gleam@json:json(). encode__call_frame_id(Value__) -> case Value__ of {call_frame_id, Inner_value__} -> gleam@json:string(Inner_value__) end. -spec decode__call_frame_id(gleam@dynamic:dynamic_()) -> {ok, call_frame_id()} | {error, list(gleam@dynamic:decode_error())}. decode__call_frame_id(Value__) -> _pipe = Value__, (gleam@dynamic:decode1( fun(Field@0) -> {call_frame_id, Field@0} end, fun gleam@dynamic:string/1 ))(_pipe). -spec encode__location(location()) -> gleam@json:json(). encode__location(Value__) -> gleam@json:object( begin _pipe = [{<<"scriptId"/utf8>>, protocol@runtime:encode__script_id( erlang:element(2, Value__) )}, {<<"lineNumber"/utf8>>, gleam@json:int(erlang:element(3, Value__))}], chrobot@internal@utils:add_optional( _pipe, erlang:element(4, Value__), fun(Inner_value__) -> {<<"columnNumber"/utf8>>, gleam@json:int(Inner_value__)} end ) end ). -spec decode__location(gleam@dynamic:dynamic_()) -> {ok, location()} | {error, list(gleam@dynamic:decode_error())}. decode__location(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"scriptId"/utf8>>, fun protocol@runtime:decode__script_id/1 ))(Value__), fun(Script_id) -> gleam@result:'try'( (gleam@dynamic:field( <<"lineNumber"/utf8>>, fun gleam@dynamic:int/1 ))(Value__), fun(Line_number) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"columnNumber"/utf8>>, fun gleam@dynamic:int/1 ))(Value__), fun(Column_number) -> {ok, {location, Script_id, Line_number, Column_number}} end ) end ) end ). -spec encode__scope_type(scope_type()) -> gleam@json:json(). encode__scope_type(Value__) -> _pipe = case Value__ of scope_type_global -> <<"global"/utf8>>; scope_type_local -> <<"local"/utf8>>; scope_type_with -> <<"with"/utf8>>; scope_type_closure -> <<"closure"/utf8>>; scope_type_catch -> <<"catch"/utf8>>; scope_type_block -> <<"block"/utf8>>; scope_type_script -> <<"script"/utf8>>; scope_type_eval -> <<"eval"/utf8>>; scope_type_module -> <<"module"/utf8>>; scope_type_wasm_expression_stack -> <<"wasm-expression-stack"/utf8>> end, gleam@json:string(_pipe). -spec decode__scope_type(gleam@dynamic:dynamic_()) -> {ok, scope_type()} | {error, list(gleam@dynamic:decode_error())}. decode__scope_type(Value__) -> case gleam@dynamic:string(Value__) of {ok, <<"global"/utf8>>} -> {ok, scope_type_global}; {ok, <<"local"/utf8>>} -> {ok, scope_type_local}; {ok, <<"with"/utf8>>} -> {ok, scope_type_with}; {ok, <<"closure"/utf8>>} -> {ok, scope_type_closure}; {ok, <<"catch"/utf8>>} -> {ok, scope_type_catch}; {ok, <<"block"/utf8>>} -> {ok, scope_type_block}; {ok, <<"script"/utf8>>} -> {ok, scope_type_script}; {ok, <<"eval"/utf8>>} -> {ok, scope_type_eval}; {ok, <<"module"/utf8>>} -> {ok, scope_type_module}; {ok, <<"wasm-expression-stack"/utf8>>} -> {ok, scope_type_wasm_expression_stack}; {error, Error} -> {error, Error}; {ok, Other} -> {error, [{decode_error, <<"valid enum property"/utf8>>, Other, [<<"enum decoder"/utf8>>]}]} end. -spec encode__scope(scope()) -> gleam@json:json(). encode__scope(Value__) -> gleam@json:object( begin _pipe = [{<<"type"/utf8>>, encode__scope_type(erlang:element(2, Value__))}, {<<"object"/utf8>>, protocol@runtime:encode__remote_object( erlang:element(3, Value__) )}], _pipe@1 = chrobot@internal@utils:add_optional( _pipe, erlang:element(4, Value__), fun(Inner_value__) -> {<<"name"/utf8>>, gleam@json:string(Inner_value__)} end ), _pipe@2 = chrobot@internal@utils:add_optional( _pipe@1, erlang:element(5, Value__), fun(Inner_value__@1) -> {<<"startLocation"/utf8>>, encode__location(Inner_value__@1)} end ), chrobot@internal@utils:add_optional( _pipe@2, erlang:element(6, Value__), fun(Inner_value__@2) -> {<<"endLocation"/utf8>>, encode__location(Inner_value__@2)} end ) end ). -spec encode__call_frame(call_frame()) -> gleam@json:json(). encode__call_frame(Value__) -> gleam@json:object( begin _pipe = [{<<"callFrameId"/utf8>>, encode__call_frame_id(erlang:element(2, Value__))}, {<<"functionName"/utf8>>, gleam@json:string(erlang:element(3, Value__))}, {<<"location"/utf8>>, encode__location(erlang:element(5, Value__))}, {<<"scopeChain"/utf8>>, gleam@json:array( erlang:element(6, Value__), fun encode__scope/1 )}, {<<"this"/utf8>>, protocol@runtime:encode__remote_object( erlang:element(7, Value__) )}], _pipe@1 = chrobot@internal@utils:add_optional( _pipe, erlang:element(4, Value__), fun(Inner_value__) -> {<<"functionLocation"/utf8>>, encode__location(Inner_value__)} end ), chrobot@internal@utils:add_optional( _pipe@1, erlang:element(8, Value__), fun(Inner_value__@1) -> {<<"returnValue"/utf8>>, protocol@runtime:encode__remote_object(Inner_value__@1)} end ) end ). -spec decode__scope(gleam@dynamic:dynamic_()) -> {ok, scope()} | {error, list(gleam@dynamic:decode_error())}. decode__scope(Value__) -> gleam@result:'try'( (gleam@dynamic:field(<<"type"/utf8>>, fun decode__scope_type/1))( Value__ ), fun(Type_) -> gleam@result:'try'( (gleam@dynamic:field( <<"object"/utf8>>, fun protocol@runtime:decode__remote_object/1 ))(Value__), fun(Object) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"name"/utf8>>, fun gleam@dynamic:string/1 ))(Value__), fun(Name) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"startLocation"/utf8>>, fun decode__location/1 ))(Value__), fun(Start_location) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"endLocation"/utf8>>, fun decode__location/1 ))(Value__), fun(End_location) -> {ok, {scope, Type_, Object, Name, Start_location, End_location}} end ) end ) end ) end ) end ). -spec decode__call_frame(gleam@dynamic:dynamic_()) -> {ok, call_frame()} | {error, list(gleam@dynamic:decode_error())}. decode__call_frame(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"callFrameId"/utf8>>, fun decode__call_frame_id/1 ))(Value__), fun(Call_frame_id) -> gleam@result:'try'( (gleam@dynamic:field( <<"functionName"/utf8>>, fun gleam@dynamic:string/1 ))(Value__), fun(Function_name) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"functionLocation"/utf8>>, fun decode__location/1 ))(Value__), fun(Function_location) -> gleam@result:'try'( (gleam@dynamic:field( <<"location"/utf8>>, fun decode__location/1 ))(Value__), fun(Location) -> gleam@result:'try'( (gleam@dynamic:field( <<"scopeChain"/utf8>>, gleam@dynamic:list( fun decode__scope/1 ) ))(Value__), fun(Scope_chain) -> gleam@result:'try'( (gleam@dynamic:field( <<"this"/utf8>>, fun protocol@runtime:decode__remote_object/1 ))(Value__), fun(This) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"returnValue"/utf8>>, fun protocol@runtime:decode__remote_object/1 ))(Value__), fun(Return_value) -> {ok, {call_frame, Call_frame_id, Function_name, Function_location, Location, Scope_chain, This, Return_value}} end ) end ) end ) end ) end ) end ) end ). -spec encode__search_match(search_match()) -> gleam@json:json(). encode__search_match(Value__) -> gleam@json:object( [{<<"lineNumber"/utf8>>, gleam@json:float(erlang:element(2, Value__))}, {<<"lineContent"/utf8>>, gleam@json:string(erlang:element(3, Value__))}] ). -spec decode__search_match(gleam@dynamic:dynamic_()) -> {ok, search_match()} | {error, list(gleam@dynamic:decode_error())}. decode__search_match(Value__) -> gleam@result:'try'( (gleam@dynamic:field(<<"lineNumber"/utf8>>, fun gleam@dynamic:float/1))( Value__ ), fun(Line_number) -> gleam@result:'try'( (gleam@dynamic:field( <<"lineContent"/utf8>>, fun gleam@dynamic:string/1 ))(Value__), fun(Line_content) -> {ok, {search_match, Line_number, Line_content}} end ) end ). -spec encode__break_location_type(break_location_type()) -> gleam@json:json(). encode__break_location_type(Value__) -> _pipe = case Value__ of break_location_type_debugger_statement -> <<"debuggerStatement"/utf8>>; break_location_type_call -> <<"call"/utf8>>; break_location_type_return -> <<"return"/utf8>> end, gleam@json:string(_pipe). -spec decode__break_location_type(gleam@dynamic:dynamic_()) -> {ok, break_location_type()} | {error, list(gleam@dynamic:decode_error())}. decode__break_location_type(Value__) -> case gleam@dynamic:string(Value__) of {ok, <<"debuggerStatement"/utf8>>} -> {ok, break_location_type_debugger_statement}; {ok, <<"call"/utf8>>} -> {ok, break_location_type_call}; {ok, <<"return"/utf8>>} -> {ok, break_location_type_return}; {error, Error} -> {error, Error}; {ok, Other} -> {error, [{decode_error, <<"valid enum property"/utf8>>, Other, [<<"enum decoder"/utf8>>]}]} end. -spec encode__break_location(break_location()) -> gleam@json:json(). encode__break_location(Value__) -> gleam@json:object( begin _pipe = [{<<"scriptId"/utf8>>, protocol@runtime:encode__script_id( erlang:element(2, Value__) )}, {<<"lineNumber"/utf8>>, gleam@json:int(erlang:element(3, Value__))}], _pipe@1 = chrobot@internal@utils:add_optional( _pipe, erlang:element(4, Value__), fun(Inner_value__) -> {<<"columnNumber"/utf8>>, gleam@json:int(Inner_value__)} end ), chrobot@internal@utils:add_optional( _pipe@1, erlang:element(5, Value__), fun(Inner_value__@1) -> {<<"type"/utf8>>, encode__break_location_type(Inner_value__@1)} end ) end ). -spec decode__break_location(gleam@dynamic:dynamic_()) -> {ok, break_location()} | {error, list(gleam@dynamic:decode_error())}. decode__break_location(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"scriptId"/utf8>>, fun protocol@runtime:decode__script_id/1 ))(Value__), fun(Script_id) -> gleam@result:'try'( (gleam@dynamic:field( <<"lineNumber"/utf8>>, fun gleam@dynamic:int/1 ))(Value__), fun(Line_number) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"columnNumber"/utf8>>, fun gleam@dynamic:int/1 ))(Value__), fun(Column_number) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"type"/utf8>>, fun decode__break_location_type/1 ))(Value__), fun(Type_) -> {ok, {break_location, Script_id, Line_number, Column_number, Type_}} end ) end ) end ) end ). -spec encode__script_language(script_language()) -> gleam@json:json(). encode__script_language(Value__) -> _pipe = case Value__ of script_language_java_script -> <<"JavaScript"/utf8>>; script_language_web_assembly -> <<"WebAssembly"/utf8>> end, gleam@json:string(_pipe). -spec decode__script_language(gleam@dynamic:dynamic_()) -> {ok, script_language()} | {error, list(gleam@dynamic:decode_error())}. decode__script_language(Value__) -> case gleam@dynamic:string(Value__) of {ok, <<"JavaScript"/utf8>>} -> {ok, script_language_java_script}; {ok, <<"WebAssembly"/utf8>>} -> {ok, script_language_web_assembly}; {error, Error} -> {error, Error}; {ok, Other} -> {error, [{decode_error, <<"valid enum property"/utf8>>, Other, [<<"enum decoder"/utf8>>]}]} end. -spec encode__debug_symbols_type(debug_symbols_type()) -> gleam@json:json(). encode__debug_symbols_type(Value__) -> _pipe = case Value__ of debug_symbols_type_none -> <<"None"/utf8>>; debug_symbols_type_source_map -> <<"SourceMap"/utf8>>; debug_symbols_type_embedded_dwarf -> <<"EmbeddedDWARF"/utf8>>; debug_symbols_type_external_dwarf -> <<"ExternalDWARF"/utf8>> end, gleam@json:string(_pipe). -spec decode__debug_symbols_type(gleam@dynamic:dynamic_()) -> {ok, debug_symbols_type()} | {error, list(gleam@dynamic:decode_error())}. decode__debug_symbols_type(Value__) -> case gleam@dynamic:string(Value__) of {ok, <<"None"/utf8>>} -> {ok, debug_symbols_type_none}; {ok, <<"SourceMap"/utf8>>} -> {ok, debug_symbols_type_source_map}; {ok, <<"EmbeddedDWARF"/utf8>>} -> {ok, debug_symbols_type_embedded_dwarf}; {ok, <<"ExternalDWARF"/utf8>>} -> {ok, debug_symbols_type_external_dwarf}; {error, Error} -> {error, Error}; {ok, Other} -> {error, [{decode_error, <<"valid enum property"/utf8>>, Other, [<<"enum decoder"/utf8>>]}]} end. -spec encode__debug_symbols(debug_symbols()) -> gleam@json:json(). encode__debug_symbols(Value__) -> gleam@json:object( begin _pipe = [{<<"type"/utf8>>, encode__debug_symbols_type(erlang:element(2, Value__))}], chrobot@internal@utils:add_optional( _pipe, erlang:element(3, Value__), fun(Inner_value__) -> {<<"externalURL"/utf8>>, gleam@json:string(Inner_value__)} end ) end ). -spec decode__debug_symbols(gleam@dynamic:dynamic_()) -> {ok, debug_symbols()} | {error, list(gleam@dynamic:decode_error())}. decode__debug_symbols(Value__) -> gleam@result:'try'( (gleam@dynamic:field(<<"type"/utf8>>, fun decode__debug_symbols_type/1))( Value__ ), fun(Type_) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"externalURL"/utf8>>, fun gleam@dynamic:string/1 ))(Value__), fun(External_url) -> {ok, {debug_symbols, Type_, External_url}} end ) end ). -spec decode__evaluate_on_call_frame_response(gleam@dynamic:dynamic_()) -> {ok, evaluate_on_call_frame_response()} | {error, list(gleam@dynamic:decode_error())}. decode__evaluate_on_call_frame_response(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"result"/utf8>>, fun protocol@runtime:decode__remote_object/1 ))(Value__), fun(Result) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"exceptionDetails"/utf8>>, fun protocol@runtime:decode__exception_details/1 ))(Value__), fun(Exception_details) -> {ok, {evaluate_on_call_frame_response, Result, Exception_details}} end ) end ). -spec decode__get_possible_breakpoints_response(gleam@dynamic:dynamic_()) -> {ok, get_possible_breakpoints_response()} | {error, list(gleam@dynamic:decode_error())}. decode__get_possible_breakpoints_response(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"locations"/utf8>>, gleam@dynamic:list(fun decode__break_location/1) ))(Value__), fun(Locations) -> {ok, {get_possible_breakpoints_response, Locations}} end ). -spec decode__get_script_source_response(gleam@dynamic:dynamic_()) -> {ok, get_script_source_response()} | {error, list(gleam@dynamic:decode_error())}. decode__get_script_source_response(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"scriptSource"/utf8>>, fun gleam@dynamic:string/1 ))(Value__), fun(Script_source) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"bytecode"/utf8>>, fun gleam@dynamic:string/1 ))(Value__), fun(Bytecode) -> {ok, {get_script_source_response, Script_source, Bytecode}} end ) end ). -spec decode__search_in_content_response(gleam@dynamic:dynamic_()) -> {ok, search_in_content_response()} | {error, list(gleam@dynamic:decode_error())}. decode__search_in_content_response(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"result"/utf8>>, gleam@dynamic:list(fun decode__search_match/1) ))(Value__), fun(Result) -> {ok, {search_in_content_response, Result}} end ). -spec decode__set_breakpoint_response(gleam@dynamic:dynamic_()) -> {ok, set_breakpoint_response()} | {error, list(gleam@dynamic:decode_error())}. decode__set_breakpoint_response(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"breakpointId"/utf8>>, fun decode__breakpoint_id/1 ))(Value__), fun(Breakpoint_id) -> gleam@result:'try'( (gleam@dynamic:field( <<"actualLocation"/utf8>>, fun decode__location/1 ))(Value__), fun(Actual_location) -> {ok, {set_breakpoint_response, Breakpoint_id, Actual_location}} end ) end ). -spec decode__set_instrumentation_breakpoint_response(gleam@dynamic:dynamic_()) -> {ok, set_instrumentation_breakpoint_response()} | {error, list(gleam@dynamic:decode_error())}. decode__set_instrumentation_breakpoint_response(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"breakpointId"/utf8>>, fun decode__breakpoint_id/1 ))(Value__), fun(Breakpoint_id) -> {ok, {set_instrumentation_breakpoint_response, Breakpoint_id}} end ). -spec decode__set_breakpoint_by_url_response(gleam@dynamic:dynamic_()) -> {ok, set_breakpoint_by_url_response()} | {error, list(gleam@dynamic:decode_error())}. decode__set_breakpoint_by_url_response(Value__) -> gleam@result:'try'( (gleam@dynamic:field( <<"breakpointId"/utf8>>, fun decode__breakpoint_id/1 ))(Value__), fun(Breakpoint_id) -> gleam@result:'try'( (gleam@dynamic:field( <<"locations"/utf8>>, gleam@dynamic:list(fun decode__location/1) ))(Value__), fun(Locations) -> {ok, {set_breakpoint_by_url_response, Breakpoint_id, Locations}} end ) end ). -spec decode__set_script_source_response(gleam@dynamic:dynamic_()) -> {ok, set_script_source_response()} | {error, list(gleam@dynamic:decode_error())}. decode__set_script_source_response(Value__) -> gleam@result:'try'( (gleam@dynamic:optional_field( <<"exceptionDetails"/utf8>>, fun protocol@runtime:decode__exception_details/1 ))(Value__), fun(Exception_details) -> {ok, {set_script_source_response, Exception_details}} end ). -spec encode__continue_to_location_target_call_frames( continue_to_location_target_call_frames() ) -> gleam@json:json(). encode__continue_to_location_target_call_frames(Value__) -> _pipe = case Value__ of continue_to_location_target_call_frames_any -> <<"any"/utf8>>; continue_to_location_target_call_frames_current -> <<"current"/utf8>> end, gleam@json:string(_pipe). -spec continue_to_location( fun((binary(), gleam@option:option(gleam@json:json())) -> AABX), location(), gleam@option:option(continue_to_location_target_call_frames()) ) -> AABX. continue_to_location(Callback__, Location, Target_call_frames) -> Callback__( <<"Debugger.continueToLocation"/utf8>>, {some, gleam@json:object( begin _pipe = [{<<"location"/utf8>>, encode__location(Location)}], chrobot@internal@utils:add_optional( _pipe, Target_call_frames, fun(Inner_value__) -> {<<"targetCallFrames"/utf8>>, encode__continue_to_location_target_call_frames( Inner_value__ )} end ) end )} ). -spec decode__continue_to_location_target_call_frames(gleam@dynamic:dynamic_()) -> {ok, continue_to_location_target_call_frames()} | {error, list(gleam@dynamic:decode_error())}. decode__continue_to_location_target_call_frames(Value__) -> case gleam@dynamic:string(Value__) of {ok, <<"any"/utf8>>} -> {ok, continue_to_location_target_call_frames_any}; {ok, <<"current"/utf8>>} -> {ok, continue_to_location_target_call_frames_current}; {error, Error} -> {error, Error}; {ok, Other} -> {error, [{decode_error, <<"valid enum property"/utf8>>, Other, [<<"enum decoder"/utf8>>]}]} end. -spec disable(fun((binary(), gleam@option:option(any())) -> AACX)) -> AACX. disable(Callback__) -> Callback__(<<"Debugger.disable"/utf8>>, none). -spec enable(fun((binary(), gleam@option:option(any())) -> AADB)) -> AADB. enable(Callback__) -> Callback__(<<"Debugger.enable"/utf8>>, none). -spec evaluate_on_call_frame( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), call_frame_id(), binary(), gleam@option:option(binary()), gleam@option:option(boolean()), gleam@option:option(boolean()), gleam@option:option(boolean()), gleam@option:option(boolean()) ) -> {ok, evaluate_on_call_frame_response()} | {error, chrome:request_error()}. evaluate_on_call_frame( Callback__, Call_frame_id, Expression, Object_group, Include_command_line_api, Silent, Return_by_value, Throw_on_side_effect ) -> gleam@result:'try'( Callback__( <<"Debugger.evaluateOnCallFrame"/utf8>>, {some, gleam@json:object( begin _pipe = [{<<"callFrameId"/utf8>>, encode__call_frame_id(Call_frame_id)}, {<<"expression"/utf8>>, gleam@json:string(Expression)}], _pipe@1 = chrobot@internal@utils:add_optional( _pipe, Object_group, fun(Inner_value__) -> {<<"objectGroup"/utf8>>, gleam@json:string(Inner_value__)} end ), _pipe@2 = chrobot@internal@utils:add_optional( _pipe@1, Include_command_line_api, fun(Inner_value__@1) -> {<<"includeCommandLineAPI"/utf8>>, gleam@json:bool(Inner_value__@1)} end ), _pipe@3 = chrobot@internal@utils:add_optional( _pipe@2, Silent, fun(Inner_value__@2) -> {<<"silent"/utf8>>, gleam@json:bool(Inner_value__@2)} end ), _pipe@4 = chrobot@internal@utils:add_optional( _pipe@3, Return_by_value, fun(Inner_value__@3) -> {<<"returnByValue"/utf8>>, gleam@json:bool(Inner_value__@3)} end ), chrobot@internal@utils:add_optional( _pipe@4, Throw_on_side_effect, fun(Inner_value__@4) -> {<<"throwOnSideEffect"/utf8>>, gleam@json:bool(Inner_value__@4)} end ) end )} ), fun(Result__) -> _pipe@5 = decode__evaluate_on_call_frame_response(Result__), gleam@result:replace_error(_pipe@5, protocol_error) end ). -spec get_possible_breakpoints( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), location(), gleam@option:option(location()), gleam@option:option(boolean()) ) -> {ok, get_possible_breakpoints_response()} | {error, chrome:request_error()}. get_possible_breakpoints(Callback__, Start, End, Restrict_to_function) -> gleam@result:'try'( Callback__( <<"Debugger.getPossibleBreakpoints"/utf8>>, {some, gleam@json:object( begin _pipe = [{<<"start"/utf8>>, encode__location(Start)}], _pipe@1 = chrobot@internal@utils:add_optional( _pipe, End, fun(Inner_value__) -> {<<"end"/utf8>>, encode__location(Inner_value__)} end ), chrobot@internal@utils:add_optional( _pipe@1, Restrict_to_function, fun(Inner_value__@1) -> {<<"restrictToFunction"/utf8>>, gleam@json:bool(Inner_value__@1)} end ) end )} ), fun(Result__) -> _pipe@2 = decode__get_possible_breakpoints_response(Result__), gleam@result:replace_error(_pipe@2, protocol_error) end ). -spec get_script_source( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), protocol@runtime:script_id() ) -> {ok, get_script_source_response()} | {error, chrome:request_error()}. get_script_source(Callback__, Script_id) -> gleam@result:'try'( Callback__( <<"Debugger.getScriptSource"/utf8>>, {some, gleam@json:object( [{<<"scriptId"/utf8>>, protocol@runtime:encode__script_id(Script_id)}] )} ), fun(Result__) -> _pipe = decode__get_script_source_response(Result__), gleam@result:replace_error(_pipe, protocol_error) end ). -spec pause(fun((binary(), gleam@option:option(any())) -> AAFD)) -> AAFD. pause(Callback__) -> Callback__(<<"Debugger.pause"/utf8>>, none). -spec remove_breakpoint( fun((binary(), gleam@option:option(gleam@json:json())) -> AAFH), breakpoint_id() ) -> AAFH. remove_breakpoint(Callback__, Breakpoint_id) -> Callback__( <<"Debugger.removeBreakpoint"/utf8>>, {some, gleam@json:object( [{<<"breakpointId"/utf8>>, encode__breakpoint_id(Breakpoint_id)}] )} ). -spec restart_frame( fun((binary(), gleam@option:option(gleam@json:json())) -> AAFM), call_frame_id() ) -> AAFM. restart_frame(Callback__, Call_frame_id) -> Callback__( <<"Debugger.restartFrame"/utf8>>, {some, gleam@json:object( [{<<"callFrameId"/utf8>>, encode__call_frame_id(Call_frame_id)}] )} ). -spec resume( fun((binary(), gleam@option:option(gleam@json:json())) -> AAFR), gleam@option:option(boolean()) ) -> AAFR. resume(Callback__, Terminate_on_resume) -> Callback__( <<"Debugger.resume"/utf8>>, {some, gleam@json:object( begin _pipe = [], chrobot@internal@utils:add_optional( _pipe, Terminate_on_resume, fun(Inner_value__) -> {<<"terminateOnResume"/utf8>>, gleam@json:bool(Inner_value__)} end ) end )} ). -spec search_in_content( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), protocol@runtime:script_id(), binary(), gleam@option:option(boolean()), gleam@option:option(boolean()) ) -> {ok, search_in_content_response()} | {error, chrome:request_error()}. search_in_content(Callback__, Script_id, Query, Case_sensitive, Is_regex) -> gleam@result:'try'( Callback__( <<"Debugger.searchInContent"/utf8>>, {some, gleam@json:object( begin _pipe = [{<<"scriptId"/utf8>>, protocol@runtime:encode__script_id(Script_id)}, {<<"query"/utf8>>, gleam@json:string(Query)}], _pipe@1 = chrobot@internal@utils:add_optional( _pipe, Case_sensitive, fun(Inner_value__) -> {<<"caseSensitive"/utf8>>, gleam@json:bool(Inner_value__)} end ), chrobot@internal@utils:add_optional( _pipe@1, Is_regex, fun(Inner_value__@1) -> {<<"isRegex"/utf8>>, gleam@json:bool(Inner_value__@1)} end ) end )} ), fun(Result__) -> _pipe@2 = decode__search_in_content_response(Result__), gleam@result:replace_error(_pipe@2, protocol_error) end ). -spec set_async_call_stack_depth( fun((binary(), gleam@option:option(gleam@json:json())) -> AAGO), integer() ) -> AAGO. set_async_call_stack_depth(Callback__, Max_depth) -> Callback__( <<"Debugger.setAsyncCallStackDepth"/utf8>>, {some, gleam@json:object( [{<<"maxDepth"/utf8>>, gleam@json:int(Max_depth)}] )} ). -spec set_breakpoint( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), location(), gleam@option:option(binary()) ) -> {ok, set_breakpoint_response()} | {error, chrome:request_error()}. set_breakpoint(Callback__, Location, Condition) -> gleam@result:'try'( Callback__( <<"Debugger.setBreakpoint"/utf8>>, {some, gleam@json:object( begin _pipe = [{<<"location"/utf8>>, encode__location(Location)}], chrobot@internal@utils:add_optional( _pipe, Condition, fun(Inner_value__) -> {<<"condition"/utf8>>, gleam@json:string(Inner_value__)} end ) end )} ), fun(Result__) -> _pipe@1 = decode__set_breakpoint_response(Result__), gleam@result:replace_error(_pipe@1, protocol_error) end ). -spec encode__set_instrumentation_breakpoint_instrumentation( set_instrumentation_breakpoint_instrumentation() ) -> gleam@json:json(). encode__set_instrumentation_breakpoint_instrumentation(Value__) -> _pipe = case Value__ of set_instrumentation_breakpoint_instrumentation_before_script_execution -> <<"beforeScriptExecution"/utf8>>; set_instrumentation_breakpoint_instrumentation_before_script_with_source_map_execution -> <<"beforeScriptWithSourceMapExecution"/utf8>> end, gleam@json:string(_pipe). -spec set_instrumentation_breakpoint( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), set_instrumentation_breakpoint_instrumentation() ) -> {ok, set_instrumentation_breakpoint_response()} | {error, chrome:request_error()}. set_instrumentation_breakpoint(Callback__, Instrumentation) -> gleam@result:'try'( Callback__( <<"Debugger.setInstrumentationBreakpoint"/utf8>>, {some, gleam@json:object( [{<<"instrumentation"/utf8>>, encode__set_instrumentation_breakpoint_instrumentation( Instrumentation )}] )} ), fun(Result__) -> _pipe = decode__set_instrumentation_breakpoint_response(Result__), gleam@result:replace_error(_pipe, protocol_error) end ). -spec decode__set_instrumentation_breakpoint_instrumentation( gleam@dynamic:dynamic_() ) -> {ok, set_instrumentation_breakpoint_instrumentation()} | {error, list(gleam@dynamic:decode_error())}. decode__set_instrumentation_breakpoint_instrumentation(Value__) -> case gleam@dynamic:string(Value__) of {ok, <<"beforeScriptExecution"/utf8>>} -> {ok, set_instrumentation_breakpoint_instrumentation_before_script_execution}; {ok, <<"beforeScriptWithSourceMapExecution"/utf8>>} -> {ok, set_instrumentation_breakpoint_instrumentation_before_script_with_source_map_execution}; {error, Error} -> {error, Error}; {ok, Other} -> {error, [{decode_error, <<"valid enum property"/utf8>>, Other, [<<"enum decoder"/utf8>>]}]} end. -spec set_breakpoint_by_url( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), integer(), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(integer()), gleam@option:option(binary()) ) -> {ok, set_breakpoint_by_url_response()} | {error, chrome:request_error()}. set_breakpoint_by_url( Callback__, Line_number, Url, Url_regex, Script_hash, Column_number, Condition ) -> gleam@result:'try'( Callback__( <<"Debugger.setBreakpointByUrl"/utf8>>, {some, gleam@json:object( begin _pipe = [{<<"lineNumber"/utf8>>, gleam@json:int(Line_number)}], _pipe@1 = chrobot@internal@utils:add_optional( _pipe, Url, fun(Inner_value__) -> {<<"url"/utf8>>, gleam@json:string(Inner_value__)} end ), _pipe@2 = chrobot@internal@utils:add_optional( _pipe@1, Url_regex, fun(Inner_value__@1) -> {<<"urlRegex"/utf8>>, gleam@json:string(Inner_value__@1)} end ), _pipe@3 = chrobot@internal@utils:add_optional( _pipe@2, Script_hash, fun(Inner_value__@2) -> {<<"scriptHash"/utf8>>, gleam@json:string(Inner_value__@2)} end ), _pipe@4 = chrobot@internal@utils:add_optional( _pipe@3, Column_number, fun(Inner_value__@3) -> {<<"columnNumber"/utf8>>, gleam@json:int(Inner_value__@3)} end ), chrobot@internal@utils:add_optional( _pipe@4, Condition, fun(Inner_value__@4) -> {<<"condition"/utf8>>, gleam@json:string(Inner_value__@4)} end ) end )} ), fun(Result__) -> _pipe@5 = decode__set_breakpoint_by_url_response(Result__), gleam@result:replace_error(_pipe@5, protocol_error) end ). -spec set_breakpoints_active( fun((binary(), gleam@option:option(gleam@json:json())) -> AAJJ), boolean() ) -> AAJJ. set_breakpoints_active(Callback__, Active) -> Callback__( <<"Debugger.setBreakpointsActive"/utf8>>, {some, gleam@json:object([{<<"active"/utf8>>, gleam@json:bool(Active)}])} ). -spec encode__set_pause_on_exceptions_state(set_pause_on_exceptions_state()) -> gleam@json:json(). encode__set_pause_on_exceptions_state(Value__) -> _pipe = case Value__ of set_pause_on_exceptions_state_none -> <<"none"/utf8>>; set_pause_on_exceptions_state_caught -> <<"caught"/utf8>>; set_pause_on_exceptions_state_uncaught -> <<"uncaught"/utf8>>; set_pause_on_exceptions_state_all -> <<"all"/utf8>> end, gleam@json:string(_pipe). -spec set_pause_on_exceptions( fun((binary(), gleam@option:option(gleam@json:json())) -> AAJP), set_pause_on_exceptions_state() ) -> AAJP. set_pause_on_exceptions(Callback__, State) -> Callback__( <<"Debugger.setPauseOnExceptions"/utf8>>, {some, gleam@json:object( [{<<"state"/utf8>>, encode__set_pause_on_exceptions_state(State)}] )} ). -spec decode__set_pause_on_exceptions_state(gleam@dynamic:dynamic_()) -> {ok, set_pause_on_exceptions_state()} | {error, list(gleam@dynamic:decode_error())}. decode__set_pause_on_exceptions_state(Value__) -> case gleam@dynamic:string(Value__) of {ok, <<"none"/utf8>>} -> {ok, set_pause_on_exceptions_state_none}; {ok, <<"caught"/utf8>>} -> {ok, set_pause_on_exceptions_state_caught}; {ok, <<"uncaught"/utf8>>} -> {ok, set_pause_on_exceptions_state_uncaught}; {ok, <<"all"/utf8>>} -> {ok, set_pause_on_exceptions_state_all}; {error, Error} -> {error, Error}; {ok, Other} -> {error, [{decode_error, <<"valid enum property"/utf8>>, Other, [<<"enum decoder"/utf8>>]}]} end. -spec set_script_source( fun((binary(), gleam@option:option(gleam@json:json())) -> {ok, gleam@dynamic:dynamic_()} | {error, chrome:request_error()}), protocol@runtime:script_id(), binary(), gleam@option:option(boolean()) ) -> {ok, set_script_source_response()} | {error, chrome:request_error()}. set_script_source(Callback__, Script_id, Script_source, Dry_run) -> gleam@result:'try'( Callback__( <<"Debugger.setScriptSource"/utf8>>, {some, gleam@json:object( begin _pipe = [{<<"scriptId"/utf8>>, protocol@runtime:encode__script_id(Script_id)}, {<<"scriptSource"/utf8>>, gleam@json:string(Script_source)}], chrobot@internal@utils:add_optional( _pipe, Dry_run, fun(Inner_value__) -> {<<"dryRun"/utf8>>, gleam@json:bool(Inner_value__)} end ) end )} ), fun(Result__) -> _pipe@1 = decode__set_script_source_response(Result__), gleam@result:replace_error(_pipe@1, protocol_error) end ). -spec set_skip_all_pauses( fun((binary(), gleam@option:option(gleam@json:json())) -> AALJ), boolean() ) -> AALJ. set_skip_all_pauses(Callback__, Skip) -> Callback__( <<"Debugger.setSkipAllPauses"/utf8>>, {some, gleam@json:object([{<<"skip"/utf8>>, gleam@json:bool(Skip)}])} ). -spec set_variable_value( fun((binary(), gleam@option:option(gleam@json:json())) -> AALO), integer(), binary(), protocol@runtime:call_argument(), call_frame_id() ) -> AALO. set_variable_value( Callback__, Scope_number, Variable_name, New_value, Call_frame_id ) -> Callback__( <<"Debugger.setVariableValue"/utf8>>, {some, gleam@json:object( [{<<"scopeNumber"/utf8>>, gleam@json:int(Scope_number)}, {<<"variableName"/utf8>>, gleam@json:string(Variable_name)}, {<<"newValue"/utf8>>, protocol@runtime:encode__call_argument(New_value)}, {<<"callFrameId"/utf8>>, encode__call_frame_id(Call_frame_id)}] )} ). -spec step_into(fun((binary(), gleam@option:option(any())) -> AALT)) -> AALT. step_into(Callback__) -> Callback__(<<"Debugger.stepInto"/utf8>>, none). -spec step_out(fun((binary(), gleam@option:option(any())) -> AALX)) -> AALX. step_out(Callback__) -> Callback__(<<"Debugger.stepOut"/utf8>>, none). -spec step_over(fun((binary(), gleam@option:option(any())) -> AAMB)) -> AAMB. step_over(Callback__) -> Callback__(<<"Debugger.stepOver"/utf8>>, none).