%<*package>

\clist_map_inline:nn {{}, index, target} {
    \clist_map_inline:nn {section, part, group, subgroup, subsubgroup, subsubsubgroup, sectionpath, sectionpage, sectionname, sectionparameter} {
        \tl_new:c {l_@@_#1##1_tl}
    }
    \clist_map_inline:nn {block, blockname, blockparameter, blockcontent} {
        \tl_new:c {l_@@_#1##1_tl}
    }
}

\tl_new:N \l_@@_indexparameter_tl
\tl_new:N \l_@@_linktext_tl
\tl_new:N \l_@@_targetindexparameter_tl

\tl_new:N \g_@@_TOCTitle_style_tl
\tl_new:N \g_@@_TOCPartTitle_style_tl
\tl_new:N \g_@@_TOCSection_style_tl
\tl_new:N \g_@@_SectionHeading_style_tl
\tl_new:N \g_@@_IndexGroup_style_tl
\tl_new:N \g_@@_IndexSubgroup_style_tl
\tl_new:N \g_@@_IndexSubsubgroup_style_tl
\tl_new:N \g_@@_IndexSubsubsubgroup_style_tl
\tl_new:N \g_@@_IndexBlock_style_tl
\tl_new:N \g_@@_SectionLink_style_tl
\tl_new:N \g_@@_BlockLink_style_tl
\tl_new:N \g_@@_IndexLink_style_tl

\NewDocumentCommand \SetStyle {m +m} {
    \tl_gset:cn {g_@@_#1_style_tl} {#2}
    \exp_args:Nnnc \regex_replace_all:nnN
    {@([a-zA-Z]+)} {\c{l_@@_\1_tl}} {g_@@_#1_style_tl}
    \exp_args:Nnnc \regex_replace_all:nnN
    {\#ifempty} {\c{tl_if_empty:NTF}} {g_@@_#1_style_tl}
    \exp_args:Nnnc \regex_replace_all:nnN
    {\#ifis} {\c{str_if_eq:VnTF}} {g_@@_#1_style_tl}
    \exp_args:Nnnc \regex_replace_all:nnN
    {\#ifequal} {\c{str_if_eq:VVTF}} {g_@@_#1_style_tl}
}

%</package>