-module(agnostic@runtime@app). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/agnostic/runtime/app.gleam"). -export([configure/1, configure_server_component/1]). -export_type([app/3, config/1, option/1]). -type app(MCK, MCL, MCM) :: {app, gleam@option:option(gleam@erlang@process:name(agnostic@runtime@headless:message(MCM))), fun((MCK) -> {MCL, agnostic@effect:effect(MCM)}), fun((MCL, MCM) -> {MCL, agnostic@effect:effect(MCM)}), fun((MCL) -> agnostic@vdom@vnode:element(MCM)), config(MCM)}. -type config(MCN) :: {config, boolean(), boolean(), boolean(), list({binary(), fun((binary()) -> {ok, MCN} | {error, nil})}), list({binary(), gleam@dynamic@decode:decoder(MCN)}), list({binary(), gleam@dynamic@decode:decoder(MCN)}), boolean(), gleam@option:option(fun((binary()) -> MCN)), gleam@option:option(MCN), gleam@option:option(fun((binary()) -> MCN)), gleam@option:option(fun((boolean()) -> MCN)), gleam@option:option(MCN), gleam@option:option(MCN), gleam@option:option(MCN)}. -type option(MCO) :: {option, fun((config(MCO)) -> config(MCO))}. -file("src/agnostic/runtime/app.gleam", 73). -spec configure(list(option(MCP))) -> config(MCP). configure(Options) -> gleam@list:fold( Options, {config, true, true, false, [], [], [], false, none, none, none, none, none, none, none}, fun(Config, Option) -> (erlang:element(2, Option))(Config) end ). -file("src/agnostic/runtime/app.gleam", 77). -spec configure_server_component(config(MCT)) -> agnostic@runtime@headless:config(MCT). configure_server_component(Config) -> {config, erlang:element(2, Config), erlang:element(3, Config), maps:from_list(lists:reverse(erlang:element(5, Config))), maps:from_list(lists:reverse(erlang:element(6, Config))), maps:from_list(lists:reverse(erlang:element(7, Config))), erlang:element(13, Config), erlang:element(15, Config)}.