%%
%% This is file `tocbasic.sty',
%% generated with the docstrip utility, extended by scrdocstrip.
%%
%% The original source files were:
%%
%% tocbasic.dtx  (with options: `package,identify')
%% tocbasic.dtx  (with options: `package,prepare')
%% tocbasic.dtx  (with options: `package,option')
%% tocbasic.dtx  (with options: `package,execoption')
%% tocbasic.dtx  (with options: `package,preparebody')
%% tocbasic.dtx  (with options: `package,body,deprecated')
%% scrkernel-tocstyle.dtx  (with options: `package,body')
%% scrkernel-tocstyle.dtx  (with options: `package,style,gobble')
%% scrkernel-tocstyle.dtx  (with options: `package,style,dottedtocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,undottedtocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,largetocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,tocline')
%% scrkernel-tocstyle.dtx  (with options: `package,style,toctext')
%% scrkernel-tocstyle.dtx  (with options: `package,style,default')
%% tocbasic.dtx  (with options: `package,exit')
%% scrlogo.dtx  (with options: `logo')
%% 
%% Copyright (c) 2008-2026 Markus Kohm [komascript at gmx info]
%% 
%% This file was generated from file(s) of the KOMA-Script bundle.
%% ---------------------------------------------------------------
%% 
%% It may be distributed under the conditions of the
%% LaTeX Project Public License in the version distributed together
%% with KOMA-Script, see file `lppl.txt' or `lppl-de.txt'.
%% 
%% This file may only be distributed together with a copy of the
%% KOMA-Script bundle.  You may however distribute the
%% KOMA-Script bundle without all such generated files.  See also
%% `lppl.txt' or `lppl-de.txt' for additional information.
%% 
%% The list of files belonging to KOMA-Script distribution is given in
%% the file `MANIFEST.md'.  See also `lppl.txt' or `lppl-de.txt' for
%% additional information.
%% 
%% If this file is a beta version, you may not be allowed to distribute
%% it.  Look at the comments below to see if this is the case.
%% 
%% English and German manuals are part of KOMA-Script bundle.
%% ----------------------------------------------------------
%% 
%% See `README'.
%% 
%% The KOMA-Script bundle (but maybe not this file) was based upon the
%% LaTeX 2.09 Script family created by Frank Neukam 1993 and the LaTeX2e
%% standard classes created by The LaTeX3 Project 1994-1996.  You can
%% find a complete unmodified copy of LaTeX2e at
%% <http://mirror.ctan.org/tex-archive/macros/latex/base/>.
%% 
%%% From File: $Id: tocbasic.dtx 4251 2025-12-31 10:31:49Z kohm $
%%%            (run: identify)
\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\ProvidesPackage{tocbasic}[%
  2026/02/02 v3.49.2 KOMA-Script
  package
  (handling toc-files)%
]
%%% From File: $Id: tocbasic.dtx 4251 2025-12-31 10:31:49Z kohm $
%%%            (run: prepare)
\newif\if@tocbasic@old@latex@found
\ifnum 0=\ifcsname IfFormatAtLeastTF\endcsname
    \IfFormatAtLeastTF{2022-06-01}{1}{0}
  \else
    0
  \fi\relax
  \PackageWarningNoLine{tocbasic}{%
    LaTeX kernel too old!\MessageBreak
    For full functionality the package needs at least\MessageBreak
    LaTeX 2022-06-01.\MessageBreak
    You are using an older LaTeX version.\MessageBreak
    So the functionality will be limited.\MessageBreak
    Note that this also can result in error messages,\MessageBreak
    that would not raise with an up-to-date LaTeX%
  }
  \@tocbasic@old@latex@foundtrue
\fi
\RequirePackage{scrbase}
\scr@ifundefinedorrelax{NewDocumentCommand}{%
  \RequirePackage{xparse}[2018-04-12]%
}{}
\IfClassLoadedTF{beamer}{%
  \PackageWarningNoLine{tocbasic}{%
    beamer class detected,\MessageBreak
    loading package tocbasic aborted%
  }%
  \DeclareOption*{}
  \ProcessOptions
  \endinput
}{}
%%% From File: $Id: tocbasic.dtx 4251 2025-12-31 10:31:49Z kohm $
%%%            (run: option)
\if@tocbasic@old@latex@found\else
  \ExplSyntaxOn

  \bool_new:N \g__tocbasic_patch_all_bool
  \bool_new:N \g__tocbasic_patch_starttoc_bool
  \bool_new:N \g__tocbasic_patch_chapter_bool
  \bool_new:c { g__tocbasic_patch_chapter*_bool }
  \bool_new:N \g__tocbasic_patch_listoffigures_bool
  \bool_new:N \g__tocbasic_patch_listoftables_bool

  \bool_new:N \g__tocbasic_patch_caption_bool
  \keys_define:nn { tocbasic }
    {
      enablepatch  .code             = \__tocbasic_endisable_patch:nn {#1} \c_true_bool,
      enablepatch  .usage            = preamble,
      enablepatch  .value_required:n = true,
      disablepatch .code             = \__tocbasic_endisable_patch:nn {#1} \c_false_bool,
      disablepatch .usage            = preamble,
      disablepatch .value_required:n = true,
    }

  \msg_new:nnnn { tocbasic } { unknown-patch }
    {
      \text_uppercase:n #1bling~of~unknown~patch~#2~ignored.
    }
    {
      You've~tried~to~#1able~patch~#2,~
      but~this~is~not~a~known~patch.~
      Because~of~this~your~attempt~is~ignored.~
      See~the~KOMA-Script~user~manual~for~more~information~about~known~patches.
    }

  \cs_new:Nn \__tocbasic_endisable_patch:nn
    {
      \clist_map_inline:nn { #1 }
        {
          \cs_if_exist:cTF { g__tocbasic_patch_##1_bool }
            {
              \bool_set_eq:cN { g__tocbasic_patch_##1_bool } #2
            }
            {
              \exp_args:Nnnx \msg_warning:nnnn { tocbasic } { unknown-patch }
                { \bool_if:NTF #2 { en } { dis } } { ##1 }
            }
        }
    }

  \ExplSyntaxOff
\fi
\if@tocbasic@old@latex@found\else
\ExplSyntaxOn
\bool_new:N \g__tocbasic__caption_above_bool
\cs_new:Nn \tocbasic_define_caption_keys:n
  {
    \keys_if_exist:nnF { tocbasic } { #1captionabove }
      {
        \keys_define:nn { tocbasic }
          {
            #1captionabove .choice:,
            #1captionabove / true .code:n       =
              { \__tocbasic_set_caption_position_top_bottom:nn { #1 } { t } },
            #1captionabove / false .code:n      =
              { \__tocbasic_set_caption_position_top_bottom:nn { #1 } { b } },
            #1captionabove / unknown .code:n    =
              { \msg_error:nne { keys } { boolean-values-only } \l_keys_path_str },
            #1captionabove .usage:n             = general,
            #1captionabove .default:n           = true,
            #1captionbelow .choice:,
            #1captionbelow / true .code:n       =
              { \__tocbasic_set_caption_position_top_bottom:nn { #1 } { b } },
            #1captionbelow / false .code:n      =
              { \__tocbasic_set_caption_position_top_bottom:nn { #1 } { t } },
            #1captionbelow / unknown .code:n    =
              { \msg_error:nne { keys } { boolean-values-only } \l_keys_path_str },
            #1captionbelow .usage:n             = general,
            #1captionbelow .default:n           = true,
            #1captionposition .choice:,
            #1captionposition / top .code:n     =
              { \__tocbasic_set_caption_position_top_bottom:nn { #1 } { t } },
            #1captionposition / bottom .code:n  =
              { \__tocbasic_set_caption_position_top_bottom:nn { #1 } { b } },
            #1captionposition .usage:n          = general,
            #1captionposition .value_required:n = true,
          }
        \str_if_empty:nF { #1 }
          {
            \keys_define:nn { tocbasic }
              {
                #1captionposition / default .code:n =
                  { \__tocbasic_set_caption_position_top_bottom:nn { #1 } { default } },
                #1captionposition .initial:n = default
              }
          }
        \cs_if_exist:NTF \captionsetup
          {
            \bool_if_exist:cTF { g__tocbasic_ #1 _caption_above_bool }
              {
                \exp_last_unbraced:Ne \captionsetup
                  {
                    \str_if_empty:nF {#1} {[#1]}
                    {
                      #1position=
                      { \bool_if:cTF { g__tocbasic_ #1 _caption_above_bool } tb }
                    }
                  }
              }
              {
                \tl_if_exist:cT { caption@opt@#1 }
                  {
                    \tl_if_empty:cF { caption@opt@#1 }
                      { \clearcaptionsetup[position]{#1} }
                  }
              }
          }
          {
            \tl_if_eq:VnT \everypar { \@nodocument }
              {
                \str_if_in:nnTF { ,table,figure,, } { ,#1, }
                  {
                    \exp_args:Ne \PassOptionsToPackage
                      {
                        #1position=
                        \bool_if_exist:cTF { g__tocbasic_ #1 _caption_above_bool }
                          { \bool_if:cTF { g__tocbasic_ #1 _caption_above_bool } tb }
                          { default }
                      }
                      { caption }
                  }
                  {
                    \hook_gput_code:nnn { package / caption / after } { tocbasic }
                      {
                        \bool_if_exist:cT { g__tocbasic_ #1 _caption_above_bool }
                          {
                            \exp_last_unbraced:Ne \captionsetup
                              {
                                \str_if_empty:nF {#1} {[#1]}
                                { position=\bool_if:cTF { g__tocbasic_ #1 _caption_above_bool } tb }
                              }
                          }
                      }
                  }
              }
          }
      }
  }
\cs_new:Nn \__tocbasic_set_caption_position_top_bottom:nn
  {
    \str_if_eq:nnTF { #2 } { default }
      {
        \bool_if_exist:cT { g__tocbasic_ #1 _caption_above_bool }
          { \cs_undefine:c { g__tocbasic_ #1 _caption_above_bool } }
        \cs_if_exist:NTF \clearcaptionsetup
          {
            \tl_if_exist:cT { caption@opt@#1 }
              {
                \tl_if_empty:cF { caption@opt@#1 }
                  { \clearcaptionsetup[position]{ #1 } }
              }
          }
          {
            \tl_if_eq:VnT \everypar { \@nodocument }
              {
                \str_if_in:nnT { ,table,figure,, } { ,#1, }
                  {
                    \PassOptionsToPackage { #1position=#2 } { caption }
                  }
              }
          }
      }
      {
        \bool_if_exist:cF { g__tocbasic_ #1 _caption_above_bool }
          { \bool_new:c { g__tocbasic_ #1 _caption_above_bool } }
        \str_if_eq:nnTF { #2 } { t }
          { \bool_set_true:c }
          { \bool_set_false:c }
          { g__tocbasic_ #1 _caption_above_bool }
        \cs_if_exist:NTF \captionsetup
          {
            \exp_last_unbraced:Ne \captionsetup
              { \str_if_empty:nF {#1} {[#1]} }
              { position=#2 }
          }
          {
            \tl_if_eq:VnT \everypar { \@nodocument }
              {
                \str_if_in:nnT { ,table,figure,, } { ,#1, }
                  {
                    \PassOptionsToPackage { #1position=#2 } { caption }
                  }
              }
          }
      }
  }
\tocbasic_define_caption_keys:n {}
\clist_map_inline:nn { table, figure }
  {
    \bool_if:nT
      {
        { \cs_if_exist_p:c { #1 } && \cs_if_exist_p:c { end#1 } }
        ||
        { \cs_if_exist_p:c { #1- } && \cs_if_exist_p:c { end#1- } }
      }
      {
        \tocbasic_define_caption_keys:n { #1 }
      }
  }

\ExplSyntaxOff
\fi
%%% From File: $Id: tocbasic.dtx 4251 2025-12-31 10:31:49Z kohm $
%%%            (run: execoption)
\if@tocbasic@old@latex@found
  \ProcessOptions\relax
\else
  \ProcessKeyOptions[tocbasic]
\fi
%%% From File: $Id: tocbasic.dtx 4251 2025-12-31 10:31:49Z kohm $
%%%            (run: preparebody)
%%% From File: $Id: tocbasic.dtx 4251 2025-12-31 10:31:49Z kohm $
%%%            (run: body)
\if@tocbasic@old@latex@found\else
  \ExplSyntaxOn
  \msg_new:nnnn { tocbasic } { dangerous-patch }
    {
      Dangerous~#2~patch~enabled \str_if_empty:nF { #1 } { ~using~#1 } .
    }
    {
      \str_if_empty:nF { #1 } { Class~#1~does~not~need~the~#2~patch.~ }
      Using~this~patch~can~even~result~in~harm.~
      If~you~are~not~sure~that~this~patch~is~needed,~
      you~should~not~enable~it.~
      Please,~see~the~KOMA-Script~user~manual~for~more~information~about~
      the~#2~patch.
    }

  \AtBeginDocument
    {

      \bool_if:NT \g__tocbasic_patch_all_bool
        {
          \bool_set_true:N \g__tocbasic_patch_starttoc_bool
          \cs_if_exist:NF \KOMAClassName
            {
              \bool_set_true:N \g__tocbasic_patch_chapter_bool
              \bool_set_true:c { g__tocbasic_patch_chapter*_bool }
            }
          \bool_set_true:N \g__tocbasic_patch_listoffigures_bool
          \bool_set_true:N \g__tocbasic_patch_listoftables_bool
          \IfPackageLoadedTF{ caption } { }
            { \bool_set_true:N \g__tocbasic_patch_caption_bool }
        }

      \bool_if:NT \g__tocbasic_patch_chapter_bool
        {
          \__tocbasic_chapter_patch_code:
        }

      \bool_if:NT \g__tocbasic_patch_starttoc_bool \tocbasicautomode

      \bool_if:NT \g__tocbasic_patch_listoffigures_bool
        {
          \__tocbasic_listof_patch_code:n{figure}
        }

      \bool_if:NT \g__tocbasic_patch_listoftables_bool
        {
          \__tocbasic_listof_patch_code:n{table}
        }

    }

  \ExplSyntaxOff
\fi
\AfterPackage*{multitoc}{%
  \@ifpackagelater{multitoc}{2022/02/10}{}{%
    \PackageWarningNoLine{tocbasic}{%
      Usage of package `multitoc' is not recommended!\MessageBreak
      Note, this package generally results in empty ToCs\MessageBreak
      for all extension but `toc', `lof' and `lot' and\MessageBreak
      even for these extensions if you do not use the\MessageBreak
      corresponding multitoc options.\MessageBreak
      It is recommended to use:\MessageBreak
      \space\space\string\usepackage{multicol}\MessageBreak
      \space\space\string\BeforeStartingTOC{\string\begin{multicols}{2}}%
      \MessageBreak
      \space\space\string\AfterStartingTOC{\string\end{multicols}}%
      \MessageBreak
      instead of loading package `multitoc'.\MessageBreak
      See the KOMA-Script manual for more information\MessageBreak
      about using \string\BeforeStartingTOC\space and
      \string\AfterStartingTOC\MessageBreak
      and the multicol manual for more information\MessageBreak
      about the `multicols' environment%
    }%
  }%
}
\newcommand*{\tb@listoftocs}{}
\providecommand*{\ifattoclist}{%
  \PackageWarning{tocbasic}{Usage of deprecated command
    `\string\ifattoclist'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\ifattoclist' by `\string\Ifattoclist'%
  }%
  \Ifattoclist
}
\newcommand{\Ifattoclist}[1]{%
  \begingroup
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b\@tempswatrue\fi
    }%
    \edef\reserved@b{#1}\@tempswafalse\tb@listoftocs
    \if@tempswa\aftergroup\@firstoftwo\else\aftergroup\@secondoftwo\fi
  \endgroup
}
\newcommand*{\tb@optowner}[1]{%
  \IfValueTF{#1}{%
    #1%
  }{%
    \ifx\@currname\@empty\else
      \@currname.\@currext%
    \fi
  }%
}
\NewDocumentCommand\addtotoclist{om}{%
  \edef\reserved@b{\tb@optowner{#1}}%
  \Ifattoclist{#2}{%
    \PackageError{tocbasic}{%
      file extension `#2' cannot be used twice
    }{%
      File extension `#2' is already used by a toc-file, while
      \ifx\relax#1\relax someone\else #2\fi\MessageBreak
      tried to use it again for a toc-file.\MessageBreak
      This may be either an incompatibility of packages, an error at a
      package,\MessageBreak
      or a mistake by the user.\MessageBreak
    }%
  }{%
    \begingroup
      \edef\reserved@a{%
        \noexpand\g@addto@macro\noexpand\tb@listoftocs{%
          \noexpand\do{#2}{\reserved@b}}}\reserved@a
    \endgroup
    \ifx\reserved@b\@empty\else
      \@ifundefined{tb@\reserved@b @add@hook}{}{%
        \edef\reserved@a{%
          \noexpand\def\noexpand\@currext{#2}%
          \noexpand\@nameuse{tb@\reserved@b @add@hook}%
          \noexpand\def\noexpand\@currext{\@currext}%
        }\reserved@a
      }%
    \fi
    \edef\reserved@a{%
      \noexpand\def\noexpand\@currext{#2}%
      \noexpand\@nameuse{tb@@add@hook}%
      \noexpand\def\noexpand\@currext{\@currext}%
    }\reserved@a
  }%
}
\newcommand*{\owneroftoc}[2][\@firstofone]{%
  \begingroup
    \let\reserved@a\endgroup
    \def\do##1##2{\Ifstr{#2}{##1}{\def\reserved@a{\endgroup#1{##2}}}{}}%
    \tb@listoftocs
  \reserved@a
}
\newcommand*{\categoryoftoc}{\owneroftoc}
\NewDocumentCommand\AtAddToTocList{o}{%
  \edef\reserved@a{\tb@optowner{#1}}%
  \@ifundefined{tb@\reserved@a @add@hook}%
    {\@namedef{tb@\reserved@a @add@hook}{}}%
    {}%
  \expandafter\g@addto@macro\csname tb@\reserved@a @add@hook\endcsname
}
\newcommand*{\tocbasic@extend@babel}[1]{%
  \Iftocfeature{#1}{nobabel}{%
    \PackageInfo{tocbasic}{omitting babel extension for `#1'\MessageBreak
      because of feature `nobabel' available\MessageBreak
      for `#1'}%
  }{%
    \scr@ifundefinedorrelax{bbl@set@language}{%
      \PackageInfo{tocbasic}{omitting babel extension for `#1'\MessageBreak
        because of missing \string\bbl@set@language}%
    }{%
      \scr@ifundefinedorrelax{BabelContentsFiles}{%
        \PackageInfo{tocbasic}{setting babel extension for `#1'}%
        \expandafter\gdef\expandafter\bbl@set@language
        \expandafter##\expandafter1%
        \expandafter{%
          \bbl@set@language{##1}%
          \addtocontents{#1}{\xstring\select@language{\languagename}}%
        }%
      }{%
        \@expandtwoargs\in@{,#1,}{,\BabelContentsFiles,}%
        \ifin@
          \PackageInfo{tocbasic}{omitting babel extension for
            `#1'\MessageBreak
            because it is already in \string\BabelContentsFiles}%
        \else
          \PackageInfo{tocbasic}{setting babel extension for `#1'}%
          \xdef\BabelContentsFiles{\BabelContentsFiles,#1}%
        \fi
      }%
    }%
  }%
}
\AtAddToTocList[]{\expandafter\tocbasic@extend@babel\expandafter{\@currext}}
\NewDocumentCommand\removefromtoclist{om}{%
  \begingroup
    \let\tb@oldlist\tb@listoftocs
    \edef\reserved@b{#2}%
    \global\let\tb@listoftocs\empty
    \def\do##1##2{%
      \edef\reserved@a{##1}%
      \ifx\reserved@a\reserved@b
        \IfValueT{#1}{%
          \begingroup
            \edef\@currext{##2}%
            \edef\reserved@b{#1}%
            \ifx\@currext\reserved@b
            \else
              \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
            \fi
          \endgroup
        }%
      \else
        \g@addto@macro\tb@listoftocs{\do{##1}{##2}}%
      \fi
    }%
    \tb@oldlist
  \endgroup
}
\NewDocumentCommand\doforeachtocfile{o+m}{%
  \IfValueTF{#1}{%
    \def\do##1##2{%
      \edef\reserved@a{#1}\edef\reserved@b{##2}%
      \ifx\reserved@a\reserved@b \edef\@currext{##1}#2\fi
    }%
  }{%
    \def\do##1##2{\edef\@currext{##1}#2}%
  }%
  \edef\reserved@a{%
    \noexpand\tb@listoftocs
    \noexpand\def\noexpand\@currext{\@currext}%
  }\reserved@a
  \let\do\noexpand
}
\NewDocumentCommand\addtoeachtocfile{o+m}{%
  \doforeachtocfile[{#1}]{\addtocontents{\@currext}{#2}}%
}
\NewDocumentCommand\addcontentslinetoeachtocfile{omm}{%
   \doforeachtocfile[{#1}]{\addcontentsline{\@currext}{#2}{#3}}%
}
\NewDocumentCommand\addxcontentsline{mmO{}m}{%
  \scr@ifundefinedorrelax{add#2#1entry}{%
    \tocbasic@addxcontentsline{#1}{#2}{#3}{#4}%
  }{%
    \@nameuse{add#2#1entry}{#3}{#4}%
  }%
}
\newcommand*{\nonumberline}{}%
\newcommand*{\tocbasic@addxcontentsline}[4]{%
  \IfArgIsEmpty{#3}{%
    \addcontentsline{#1}{#2}{\protect\nonumberline#4}%
  }{%
    \addcontentsline{#1}{#2}{\protect\numberline{#3}#4}%
  }%
}
\NewDocumentCommand\addxcontentslinetoeachtocfile{omom}{%
  \doforeachtocfile[{#1}]{\addxcontentsline{\@currext}{#2}[{#3}]{#4}}
}
\if@tocbasic@old@latex@found\else
  \ExplSyntaxOn
  \cs_new:Npn \__tocbasic_chapter_patch_code:
    {
      \cs_if_exist:NTF \KOMAClassName
        {
          \exp_args:Nnnx \msg_warn:nnnn { tocbasic } { dangerous-patch }
            { \KOMAClassName } { chapter }
        }
        {
          \exp_args:Nnnx \msg_note:nnnn { tocbasic } { dangerous-patch }
            { } { chapter }
        }
      \hook_gput_code:nnn { cmd/@makechapterhead/before } { tocbasic }
        {
          \doforeachtocfile[float]{
            \addtocontents{\@currext}{\tocbasic@chapter@skip}
          }
        }
      \bool_if:cT { g__tocbasic_patch_chapter*_bool }
        {
          \hook_gput_code:nnn { cmd/@makeschapterhead/before } { tocbasic }
            {
              \doforeachtocfile[float]{
                \addtocontents{\@currext}{\tocbasic@chapter@skip}
              }
            }
        }
      \ProvideDocumentCommand \tocbasic@chapter@skip { } { \addvspace{10\p@} }
    }
  \ExplSyntaxOff
\fi
\newcommand*{\tocbasic@starttoc}[1]{%
  \begingroup
    \tocbasic@reentrant@warning
    \def\tocbasic@reentrant@warning{%
      \PackageWarning{tocbasic}{%
        Loading one auxiliary file inside the setup context\MessageBreak
        of another auxiliary file is not recommended.\MessageBreak
        In this case settings for `\@currext' could also influence\MessageBreak
        settings of `#1' and local states of `#1' can also\MessageBreak
        influence local states of `\@currext'%
      }%
    }%
    \edef\@currext{#1}%
    \Iftocfeature{\@currext}{noparskipfake}{}{%
      \ifvmode
        \@tempskipa\lastskip
        \vskip-\lastskip
        \addtolength{\@tempskipa}{\parskip}%
        \vskip\@tempskipa
      \fi
    }%
    \setlength{\parskip}{\z@}%
    \setlength{\parindent}{\z@}%
    \setlength{\parfillskip}{\z@\@plus 1fil}%
    \csname tocbasic@@before@hook\endcsname
    \csname tb@#1@before@hook\endcsname
    \@starttoc{#1}%
    \BeforeClosingMainAux{%
      \addtocontents{#1}{%
        \string\providecommand\string\tocbasic@end@toc@file{}%
        \string\tocbasic@end@toc@file
      }%
    }%
    \edef\@currext{#1}%
    \csname tb@#1@after@hook\endcsname
    \csname tocbasic@@after@hook\endcsname
  \endgroup
}
\newcommand*{\tocbasic@end@toc@file}{\par}
\newcommand*{\tocbasic@reentrant@warning}{}
\newcommand*{\tocbasic@@before@hook}{}
\newcommand*{\tocbasic@@after@hook}{}
\newcommand{\BeforeStartingTOC}[2][]{%
  \ifx\relax#1\relax
    \g@addto@macro\tocbasic@@before@hook{#2}%
  \else
    \@ifundefined{tb@#1@before@hook}{%
      \expandafter\global\expandafter\let\csname tb@#1@before@hook\endcsname
      \@empty
    }{}%
    \expandafter\g@addto@macro\csname tb@#1@before@hook\endcsname{#2}%
  \fi
}
\newcommand{\AfterStartingTOC}[2][]{%
  \ifx\relax#1\relax
    \g@addto@macro\tocbasic@@after@hook{#2}%
  \else
    \@ifundefined{tb@#1@after@hook}{%
      \expandafter\global\expandafter\let\csname tb@#1@after@hook\endcsname
      \@empty
    }{}%
    \expandafter\g@addto@macro\csname tb@#1@after@hook\endcsname{#2}%
  \fi
}
\newcommand*{\listoftoc}{%
  \kernel@ifstar \tocbasic@starttoc\@listoftoc
}
\newcommand*{\@listoftoc}[2][]{%
  \begingroup
    \def\list@fname{#1}%
    \@ifundefined{listof#2name}{%
      \ifx\list@fname\@empty
        \PackageWarning{tocbasic}{%
          You should either define \expandafter\string\csname
          listof#2name\endcsname\MessageBreak
          or use the optional argument of \string\listoftoc\space\MessageBreak
          to set the term to be used for the\MessageBreak
          heading of list of #2}%
        \def\list@fname{\listofname~#2}%
      \fi
    }{%
      \expandafter\let\expandafter\list@fname\csname listof#2name\endcsname
    }%
    \edef\@currext{#2}%
    \Iftocfeature{\@currext}{onecolumn}{%
      \Iftocfeature{\@currext}{leveldown}{}{%
        \if@twocolumn
          \aftergroup\twocolumn\onecolumn
        \fi
      }%
    }{}%
    \Iftocfeature{\@currext}{numberline}{\def\nonumberline{\numberline{}}}{}%
    \expandafter\tocbasic@listhead\expandafter{\list@fname}%
    \scr@ifundefinedorrelax{microtypesetup}{}{%
      \Iftocfeature{\@currext}{noprotrusion}{}{%
        \microtypesetup{protrusion=false}%
        \PackageInfo{tocbasic}{%
          character protrusion at \@currext\space deactivated}%
      }%
    }%
    \tocbasic@starttoc{#2}%
  \endgroup
}
\if@tocbasic@old@latex@found\else
  \ExplSyntaxOn
  \cs_new:Nn \__tocbasic_listof_patch_code:n
    {
      \cs_set:cpn { listof#1s } { \exp_args:Nc \listoftoc { ext@#1  } }
      \cs_if_exist:cF { listof \use:c { ext@#1 } name }
        {
          \cs_new:cpn { listof \use:c { ext@#1 } name }
            { \use:c { list#1name } }
        }
    }
  \ExplSyntaxOff
\fi
\IfPackageLoadedTF{tocbibind}{}{%
  \AtBeginDocument{%
    \IfPackageLoadedTF{tocbibind}{%
      \PackageInfo{tocbasic}{usage of `tocbibind' detected}%
      \newcommand*{\tb@tocbibindpatch}[3]{%
        \long\def\reserved@a{\tocfile{#2}{#1} }%
        \ifx #3\reserved@a
          \PackageWarningNoLine{tocbasic}{%
            `tocbibind' redefinition of `\string#3'\MessageBreak
            detected.\MessageBreak
            Note: Loading `tocbibind' without option `not#1'\MessageBreak
            can break several features of `tocbasic'%
            \scr@ifundefinedorrelax{KOMAClassName}{%
              .\MessageBreak
              Loading `tocbibind' before `tocbasic' would avoid\MessageBreak
              this warning message%
            }{}%
          }%
        \fi
      }%
      \tb@tocbibindpatch{toc}{\contentsname}{\tableofcontents}%
      \tb@tocbibindpatch{lof}{\listfigurename}{\listoffigures}%
      \tb@tocbibindpatch{lot}{\listtablename}{\listoftables}%
    }{}%
  }%
}
\newcommand*{\listofname}{List of}
\NewDocumentCommand\listofeachtoc{o}{%
  \doforeachtocfile[{#1}]{\listoftoc{\@currext}}%
}
\providecommand*{\ext@toc}{toc}
\newcommand*{\tocbasic@listhead}[1]{%
  \@ifundefined{tocbasic@listhead@\@currext}{%
    \scr@ifundefinedorrelax{chapter}{%
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \Iftocfeature{\@currext}{leveldown}{%
          \Iftocfeature{\@currext}{numbered}{%
            \subsection[##1]{##1}%
          }{%
            \subsection*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {subsection}{##1}%
              }{}%
              \c@secnumdepth=-\maxdimen
              \subsectionmark{##1}%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }{%
          \Iftocfeature{\@currext}{numbered}{%
            \section[##1]{##1}%
          }{%
            \section*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {section}{##1}%
              }{}%
              \@ifundefined{@mkdouble}{%
                \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
              }{%
                \@mkdouble{\MakeMarkcase{##1}}%
              }%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }%
      }%
    }{%
      \expandafter\def\csname tocbasic@listhead@\@currext\endcsname##1{%
        \Iftocfeature{\@currext}{leveldown}{%
          \Iftocfeature{\@currext}{numbered}{%
            \section{##1}%
          }{%
            \Iftocfeature{\@currext}{totoc}{%
              \@ifundefined{addsec}{%
                \section*{##1}%
                \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
                \begingroup
                  \@ifundefined{@mkright}{%
                    \IfActiveMkBoth{\markright{\MakeMarkcase{##1}}}{}%
                  }{%
                    \@mkright{\MakeMarkcase{##1}}%
                  }%
                  \expandafter\addxcontentsline\expandafter{\ext@toc}%
                  {section}{##1}%
                \endgroup
                \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
              }{%
                \addsec{##1}%
              }%
            }{%
              \section*{##1}%
              \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
              \begingroup
                \@ifundefined{addsecmark}{%
                  \c@secnumdepth=-\maxdimen
                  \sectionmark{##1}%
                }{%
                  \addsecmark{##1}%
                }%
              \endgroup
              \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
            }%
          }%
        }{%
          \Iftocfeature{\@currext}{numbered}{%
            \chapter[##1]{##1}%
          }{%
            \chapter*{##1}%
            \ifvmode\@tempcnta\lastpenalty\@tempskipa\lastskip\unskip\fi
            \begingroup
              \@ifundefined{@mkdouble}{%
                \@mkboth{\MakeMarkcase{##1}}{\MakeMarkcase{##1}}%
              }{%
                \@mkdouble{\MakeMarkcase{##1}}%
              }%
              \Iftocfeature{\@currext}{totoc}{%
                \expandafter\addxcontentsline\expandafter{\ext@toc}%
                {chapter}{##1}%
              }{}%
            \endgroup
            \ifvmode\penalty\@tempcnta\vskip\@tempskipa\fi
          }%
        }%
      }%
    }%
  }{}%
  \csname tb@@beforehead@hook\endcsname
  \csname tb@\@currext @beforehead@hook\endcsname
  \csname tocbasic@listhead@\@currext\endcsname{#1}%
  \csname tb@\@currext @afterhead@hook\endcsname
  \csname tb@@afterhead@hook\endcsname
}
\newcommand{\BeforeTOCHead}[2][]{%
  \@ifundefined{tb@#1@beforehead@hook}{%
    \expandafter\global\expandafter\let\csname tb@#1@beforehead@hook\endcsname
    \@empty
  }{}%
  \expandafter\g@addto@macro\csname tb@#1@beforehead@hook\endcsname{#2}%
}
\newcommand{\AfterTOCHead}[2][]{%
  \@ifundefined{tb@#1@afterhead@hook}{%
    \expandafter\global\expandafter\let\csname tb@#1@afterhead@hook\endcsname
    \@empty
  }{}%
  \expandafter\g@addto@macro\csname tb@#1@afterhead@hook\endcsname{#2}%
}
\newcommand*{\deftocheading}[1]{%
  \@namedef{tocbasic@listhead@#1}##1}
\newcommand*{\setuptoc}[2]{%
  \@for\@tempa:=#2\do{%
    \scr@trim@spaces\@tempa
    \@namedef{tocbasic@#1@feature@\@tempa}{}%
  }%
}
\newcommand*{\unsettoc}[2]{%
  \@for\@tempa:=#2\do{%
    \scr@trim@spaces\@tempa
    \expandafter\let\csname tocbasic@#1@feature@\@tempa\endcsname\relax
  }%
}
\setuptoc{toc}{nobabel}
\setuptoc{lof}{nobabel}
\setuptoc{lot}{nobabel}
\providecommand*{\iftocfeature}{%
  \PackageWarning{tocbasic}{Usage of deprecated command
    `\string\iftocfeature'.\MessageBreak
    The command has been renamed because of a\MessageBreak
    recommendation of The LaTeX Project Team.\MessageBreak
    Please replace `\string\iftocfeature' by `\string\Iftocfeature'%
  }%
  \Iftocfeature
}
\newcommand*{\Iftocfeature}[2]{%
  \scr@ifundefinedorrelax{tocbasic@#1@feature@#2}{%
    \expandafter\@secondoftwo
  }{%
    \expandafter\@firstoftwo
  }%
}
\newcommand*{\tocbasicautomode}{%
  \let\tb@saved@starttoc\@starttoc
  \let\@starttoc\tocbasic@starttoc
  \BeforeStartingTOC{%
    \let\@starttoc\tb@saved@starttoc
    \expandafter\Ifattoclist\expandafter{\@currext}{}{%
      \addtotoclist[tocbasicautomode]{\@currext}%
    }%
  }%
}
\DefineFamily{KOMAarg}
\DefineFamilyMember[.toc]{KOMAarg}
\newcommand*{\DeclareNewTOC}[2][]{%
  \newif\iftb@nt@float
  \newif\iftb@nt@nonfloat
  \newif\iftb@nt@forcenames
  \def\tb@nt@floattype{\tb@nt@autofloattype}%
  \def\tb@nt@floatpos{tbp}%
  \def\tb@nt@ext{#2}%
  \edef\tb@nt@type{#2}%
  \let\tb@nt@types\relax
  \def\tb@nt@owner{float}%
  \def\tb@nt@name{\expandafter\protect\expandafter\MakeUppercase\tb@nt@type}%
  \let\tb@nt@listname\relax
  \let\tb@nt@counterwithin\@empty
  \let\tb@nt@atbegin\@empty
  \let\tb@nt@atend\@empty
  \def\tb@nt@tocentrystyle{default}%
  \def\tb@nt@tocstyle@options{level=1}%
  \IfArgIsEmpty{#1}{%
    \begingroup
      \let\scr@dte@current\tb@nt@type
      \@ExecuteTOCEntryStyleInitCode{\tb@nt@tocentrystyle}{\tb@nt@type}%
      \def\do@endgroup{\endgroup}%
      \def\do##1{%
        \Ifstr{##1}{numwidth}{%
          \l@addto@macro\do@endgroup{%
            \l@addto@macro{\tb@nt@tocstyle@options}{,numwidth=1.5em}%
          }%
        }{%
          \Ifstr{##1}{indent}{%
            \l@addto@macro\do@endgroup{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,indent=1em}%
            }%
          }{}%
        }%
        \kernel@ifnextchar[%]
          {\@dodefault}%
          {}%
      }%
      \def\@dodefault[##1]{}%
      \scr@dte@doopts
    \do@endgroup
  }{%
    \let\tb@nt@extra@relax@opts\@empty
    \DefineFamilyKey[.toc]{KOMAarg}{type}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@type{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{tocentrystyle}[default]{%
      \IfArgIsEmpty{##1}{%
        \edef\tb@nt@tocentrystyle{##1}%
        \FamilyKeyStateProcessed
      }{%
        \scr@ifundefinedorrelax{scr@dte@def@l@##1}{%
          \FamilyKeyStateUnknownValue
        }{%
          \edef\tb@nt@tocentrystyle{##1}%
          \FamilyKeyStateProcessed
        }%
      }%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{extension}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@ext{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{owner}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{category}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@owner{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{@else@}{\FamilyKeyStateProcessed}%
    \FamilyExecuteOptions[.toc]{KOMAarg}{#1}%
    \RelaxFamilyKey[.toc]{KOMAarg}{@else@}%
  }%
  \expandafter\newcommand\csname ext@\tb@nt@type\endcsname{}%
  \expandafter\let\csname ext@\tb@nt@type\endcsname\tb@nt@ext
  \addtotoclist[\tb@nt@owner]{\csname ext@\tb@nt@type\endcsname}%
  \IfArgIsEmpty{#1}{}{%
    \DefineFamilyKey[.toc]{KOMAarg}{type}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{tocentrystyle}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{extension}{\FamilyKeyStateProcessed}%
    \DefineFamilyKey[.toc]{KOMAarg}{category}{\FamilyKeyStateProcessed}%
    \Ifstr{\tb@nt@tocentrystyle}{}{}{%
      \begingroup
        \let\scr@dte@current\tb@nt@type
        \@ExecuteTOCEntryStyleInitCode{\tb@nt@tocentrystyle}{\tb@nt@type}%
        \def\do@endgroup{\endgroup}%
        \def\do##1{%
          \l@addto@macro\do@endgroup{%
            \l@addto@macro\tb@nt@extra@relax@opts{%
              \RelaxFamilyKey[.toc]{KOMAarg}{toc##1}%
              \RelaxFamilyKey[.toc]{KOMAarg}{tocentry##1}%
              \RelaxFamilyKey[.toc]{KOMAarg}{tocentry##1:}%
            }%
          }%
          \kernel@ifnextchar[%]
            {\@dodefault{##1}}%
            {\@donodefault{##1}}%
        }%
        \def\@donodefault##1{%
          \l@addto@macro\do@endgroup{%
            \DefineFamilyKey[.toc]{KOMAarg}{toc##1}{%
              \PackageWarning{tocbasic}{you should use `tocentry##1'
                instead\MessageBreak
                of `toc##1'}%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1:}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1:={####1}}%
            }%
          }%
        }%
        \def\@dodefault##1[##2]{%
          \l@addto@macro\do@endgroup{%
            \DefineFamilyKey[.toc]{KOMAarg}{toc##1}[##2]{%
              \PackageWarning{tocbasic}{you should use `tocentry##1'
                instead\MessageBreak
                of `toc##1'}%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1}[##2]{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1={####1}}%
              \FamilyKeyStateProcessed
            }%
            \DefineFamilyKey[.toc]{KOMAarg}{tocentry##1:}{%
              \l@addto@macro{\tb@nt@tocstyle@options}{,##1:={####1}}%
            }%
          }%
        }%
        \scr@dte@doopts
      \do@endgroup
    }%
    \FamilyStringKey[.toc]{KOMAarg}{atbegin}{\tb@nt@atbegin}%
    \FamilyStringKey[.toc]{KOMAarg}{atend}{\tb@nt@atend}%
    \DefineFamilyKey[.toc]{KOMAarg}{counterwithin}{%
      \edef\tb@nt@counterwithin{##1}\FamilyKeyStateProcessed
    }%
    \FamilyBoolKey[.toc]{KOMAarg}{float}{tb@nt@float}%
    \DefineFamilyKey[.toc]{KOMAarg}{floatpos}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@floatpos{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{floattype}{%
      \FamilySetCounterMacro{KOMAarg}{floattype}{\reserved@d}{##1}%
      \ifx\FamilyKeyState\FamilyKeyStateProcessed
        \ifnum 0=
          \ifnum\reserved@d<1 0 \else\ifnum\reserved@d>31 0 \else 1 \fi\fi
          \FamilyKeyStateUnknownValue
        \else
          \let\tb@nt@floattype\reserved@d
        \fi
      \fi
    }%
    \FamilyBoolKey[.toc]{KOMAarg}{forcenames}{tb@nt@forcenames}%
    \DefineFamilyKey[.toc]{KOMAarg}{hang}{%
      \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocnumwidth}{%
        \PackageWarning{tocbasic}{%
          deprecated option `hang'.\MessageBreak
          Option will be ignored, because toc entry style\MessageBreak
          `\tb@nt@tocentrystyle' does not provide option `numwidth'%
        }%
      }{%
        \PackageWarning{tocbasic}{%
          deprecated option `hang'.\MessageBreak
          You should replace option `hang' by option\MessageBreak
          `tocentrynumwidth'%
        }%
        \l@addto@macro\tb@nt@tocstyle@options{,numwidth={##1}}%
      }%
      \FamilyKeyStateProcessed
    }%
    \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocnumwidth}{}{%
      \l@addto@macro\tb@nt@tocstyle@options{,numwidth=1.5em}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{indent}{%
      \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocindent}{%
        \PackageWarning{tocbasic}{%
          deprecated option `indent'.\MessageBreak
          Option will be ignored, because toc entry style\MessageBreak
          `\tb@nt@tocentrystyle' does not provide option `indent'%
        }%
      }{%
        \PackageWarning{tocbasic}{%
          deprecated option `indent'.\MessageBreak
          You should replace option `indent' by option\MessageBreak
          `tocentryindent'%
        }%
        \l@addto@macro\tb@nt@tocstyle@options{,indent={##1}}%
      }%
      \FamilyKeyStateProcessed
    }%
    \scr@ifundefinedorrelax{KV@KOMAarg.toc@tocindent}{}{%
      \l@addto@macro\tb@nt@tocstyle@options{,indent=1em}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{level}{%
      \PackageWarning{tocbasic}{%
        deprecated option `level'.\MessageBreak
        You should replace option `level' by option\MessageBreak
        `tocentrylevel'%
      }%
      \l@addto@macro\tb@nt@tocstyle@options{,level={##1}}%
      \FamilyKeyStateProcessed
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{listname}{%
      \tb@ifvalueisnotempty{##1}{\def\tb@nt@listname{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{name}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@name{##1}}%
    }%
    \FamilyBoolKey[.toc]{KOMAarg}{nonfloat}{tb@nt@nonfloat}%
    \DefineFamilyKey[.toc]{KOMAarg}{types}{%
      \tb@ifvalueisnotempty{##1}{\edef\tb@nt@types{##1}}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{setup}{%
      \setuptoc\tb@nt@ext{##1}%
    }%
    \DefineFamilyKey[.toc]{KOMAarg}{unset}{%
      \unsettoc\tb@nt@ext{##1}%
    }%
    \FamilyExecuteOptions[.toc]{KOMAarg}{#1}%
    \RelaxFamilyKey[.toc]{KOMAarg}{unset}%
    \RelaxFamilyKey[.toc]{KOMAarg}{setup}%
    \RelaxFamilyKey[.toc]{KOMAarg}{types}%
    \RelaxFamilyKey[.toc]{KOMAarg}{nonfloat}%
    \RelaxFamilyKey[.toc]{KOMAarg}{name}%
    \RelaxFamilyKey[.toc]{KOMAarg}{listname}%
    \RelaxFamilyKey[.toc]{KOMAarg}{level}%
    \RelaxFamilyKey[.toc]{KOMAarg}{indent}%
    \RelaxFamilyKey[.toc]{KOMAarg}{hang}%
    \RelaxFamilyKey[.toc]{KOMAarg}{forcenames}%
    \RelaxFamilyKey[.toc]{KOMAarg}{floatpos}%
    \RelaxFamilyKey[.toc]{KOMAarg}{float}%
    \RelaxFamilyKey[.toc]{KOMAarg}{counterwithin}%
    \RelaxFamilyKey[.toc]{KOMAarg}{atend}%
    \RelaxFamilyKey[.toc]{KOMAarg}{atbegin}%
    \tb@nt@extra@relax@opts
    \RelaxFamilyKey[.toc]{KOMAarg}{category}%
    \RelaxFamilyKey[.toc]{KOMAarg}{owner}%
    \RelaxFamilyKey[.toc]{KOMAarg}{extension}%
    \RelaxFamilyKey[.toc]{KOMAarg}{tocentrystyle}%
    \RelaxFamilyKey[.toc]{KOMAarg}{type}%
  }%
  \expandafter\let\csname tb@nt@type@\tb@nt@ext\endcsname\tb@nt@type
  \scr@ifundefinedorrelax{tb@nt@types}{%
    \edef\tb@nt@types{\tb@nt@type s}%
  }{}%
  \scr@ifundefinedorrelax{tb@nt@listname}{%
    \protected@edef\tb@nt@listname{List of \protect\MakeUppercase\tb@nt@types}%
  }{}%
  \@ifundefined{\tb@nt@type name}{%
    \expandafter\protected@edef\csname \tb@nt@type name\endcsname{\tb@nt@name}%
  }{%
    \iftb@nt@forcenames
      \expandafter\protected@edef\csname \tb@nt@type name\endcsname
      {\tb@nt@name}%
    \fi
  }%
  \@ifundefined{list\tb@nt@type name}{%
    \expandafter\let\csname list\tb@nt@type name\endcsname\tb@nt@listname
  }{%
    \iftb@nt@forcenames
      \expandafter\let\csname list\tb@nt@type name\endcsname\tb@nt@listname
    \fi
  }%
  \expandafter\newcommand\csname listof\tb@nt@ext name\expandafter\endcsname
    \expandafter{\csname list\tb@nt@type name\endcsname}%
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname listof\tb@nt@types\endcsname{%
      \noexpand\listoftoc{%
        \expandafter\noexpand\csname ext@\tb@nt@type\endcsname}%
    }%
  }\@tempa
  \Ifstr{\tb@nt@tocentrystyle}{}{%
    \@ifundefined{l@\tb@nt@type}{%
      \PackageWarning{tocbasic}{%
        \expandafter\string\csname l@\tb@nt@type\endcsname\space
        undefined!\MessageBreak
        I hope you know, what you are doing, but\MessageBreak
        maybe it would be better to use proper\MessageBreak
        `tocentrystyle' settings%
      }%
    }{}%
  }{%
    \edef\reserved@a{%
      \noexpand\DeclareTOCStyleEntry[%
        {\unexpanded\expandafter{\tb@nt@tocstyle@options}}%
      ]{\tb@nt@tocentrystyle}{\tb@nt@type}%
    }%
    \reserved@a
  }%
  \@ifundefined{listof\tb@nt@ext entryname}{%
    \expandafter\let\csname listof\tb@nt@ext entryname\endcsname\tb@nt@name
  }{}%
  \begingroup\edef\@tempa{\endgroup
    \noexpand\newcommand*\csname setup\tb@nt@types\endcsname{%
      \noexpand\setuptoc{\tb@nt@ext}%
    }%
  }\@tempa
  \@tempswafalse
  \iftb@nt@float
    \expandafter\newcommand\expandafter*\csname fps@\tb@nt@type\expandafter
    \endcsname\expandafter{\tb@nt@floatpos}%
    \expandafter\newcommand\expandafter*\csname ftype@\tb@nt@type\expandafter
    \endcsname\expandafter{\tb@nt@floattype}%
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newenvironment{\tb@nt@type}{%
          \noexpand\kernel@ifnextchar[%]
          {\noexpand\tb@atbegin@after\noexpand\@float{\tb@nt@type}}%
          {\noexpand\edef\noexpand\reserved@a{%
              \noexpand\noexpand\noexpand\tb@atbegin@after
              \noexpand\noexpand\noexpand\@float{\tb@nt@type}%
              [\noexpand\csname fps@\tb@nt@type\noexpand\endcsname]}%
            \noexpand\reserved@a}%
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\end@float
        }%
        \noexpand\newenvironment{\tb@nt@type*}{%
          \noexpand\kernel@ifnextchar[%]
          {\noexpand\tb@atbegin@after\noexpand\@dblfloat{\tb@nt@type}}%
          {\noexpand\edef\noexpand\reserved@a{%
              \noexpand\noexpand\noexpand\tb@atbegin@after
              \noexpand\noexpand\noexpand\@dblfloat{\tb@nt@type}%
              [\noexpand\csname fps@\tb@nt@type\noexpand\endcsname]}%
            \noexpand\reserved@a}%
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\end@dblfloat
        }%
        \if@tocbasic@old@latex@found\else
          \expandafter\noexpand\csname tocbasic_define_caption_keys:n\endcsname
            {\tb@nt@type}%
        \fi
      }%
    \@tempa
    \@tempswatrue
  \fi
  \iftb@nt@nonfloat
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newenvironment{\tb@nt@type-}{%
          \noexpand\trivlist\noexpand\item\noexpand\relax
          \noexpand\minipage{\noexpand\linewidth}%
          \noexpand\def\noexpand\@captype{\tb@nt@type}%
          \noexpand\csname \tb@nt@type @atbegin\noexpand\endcsname
        }{%
          \noexpand\csname \tb@nt@type @atend\noexpand\endcsname
          \noexpand\endminipage\noexpand\endtrivlist
        }%
        \if@tocbasic@old@latex@found\else
          \expandafter\noexpand\csname tocbasic_define_caption_keys:n\endcsname
            {\tb@nt@type}%
        \fi
      }%
    \@tempa
    \@tempswatrue
  \fi
  \if@tempswa
    \@ifundefined{c@\tb@nt@type}{%
      \newcounter{\tb@nt@type}%
    }{%
      \PackageWarning{tocbasic}{using already defined counter `\tb@nt@type'}%
    }%
    \ifx\tb@nt@counterwithin\@empty\else
      \@addtoreset{\tb@nt@type}{\tb@nt@counterwithin}%
      \begingroup
        \def\reserved@c{section}%
        \@ifundefined{chapter}{}{%
          \@ifundefined{c@chapter}{}{%
            \@ifundefined{l@chapter}{}{%
              \def\reserved@c{chapter}}}}%
        \expandafter\Ifstr\expandafter{\reserved@c}{\tb@nt@counterwithin}{%
          \edef\@tempa{%
            \noexpand\endgroup
            \noexpand\renewcommand*\expandafter\noexpand
            \csname the\tb@nt@type\endcsname{%
              \unexpanded{%
                \expandafter\ifx\csname if@mainmatter\expandafter\endcsname
                \csname iffalse\endcsname\else
              }%
                \noexpand\ifnum
                \expandafter\noexpand\csname c@\tb@nt@counterwithin\endcsname
                >\noexpand\z@
                  \expandafter\noexpand\csname the\tb@nt@counterwithin\endcsname
                  .%
                \noexpand\fi
              \noexpand\fi
              \noexpand\arabic{\tb@nt@type}%
            }%
          }%
        }{%
          \edef\@tempa{%
            \noexpand\endgroup
            \noexpand\renewcommand*\expandafter\noexpand
            \csname the\tb@nt@type\endcsname{%
              \expandafter\noexpand\csname the\tb@nt@counterwithin\endcsname
              .%
              \noexpand\arabic{\tb@nt@type}%
            }%
          }%
        }%
      \@tempa
    \fi
    \begingroup
      \edef\@tempa{%
        \noexpand\endgroup
        \noexpand\newcommand*\expandafter\noexpand
        \csname \tb@nt@type format\endcsname{%
          \expandafter\noexpand\csname \tb@nt@type name\endcsname
          \noexpand\nobreakspace
          \expandafter\noexpand\csname the\tb@nt@type\endcsname
          \ifx\tb@nt@counterwithin\@empty\else
            \noexpand\csname autodot\endcsname
          \fi
        }%
        \noexpand\newcommand*\expandafter\noexpand
        \csname fnum@\tb@nt@type\endcsname{%
          \expandafter\noexpand\csname \tb@nt@type format\endcsname
        }%
      }%
    \@tempa
    \expandafter\newcommand\expandafter*\csname \tb@nt@type @atbegin\expandafter
    \endcsname\expandafter{\tb@nt@atbegin}%
    \expandafter\newcommand\expandafter*\csname \tb@nt@type @atend\expandafter
    \endcsname\expandafter{\tb@nt@atend}%
  \fi
}
\newcommand*{\tb@atbegin@after}[3]{}
\def\tb@atbegin@after#1#2[#3]{%
  #1{#2}[#3]%
  \csname #2@atbegin\endcsname
}
\newcommand*{\tb@ifvalueisnotempty}[1]{%
  \Ifstr{#1}{}{%
    \FamilyKeyStateUnknownValue
    \expandafter\@gobble
  }{%
    \FamilyKeyStateProcessed
    \expandafter\@firstofone
  }%
}
\newcommand*{\tb@nt@autofloattype}{16}
\if@tocbasic@old@latex@found\else
\ExplSyntaxOn
\hook_gput_code:nnn { begindocument } { tocbasic }
  {
    \DeclareCommandCopy { \__tocbasic_saved_caption:w } { \caption }
    \bool_if:NT \g__tocbasic_patch_caption_bool
      {
        \__tocbasic_caption_patch_code:
      }
  }

\hook_gset_rule:nnnn { begindocument } { tocbasic } { after } { caption }
\hook_gset_rule:nnnn { begindocument } { tocbasic } { after } { caption3 }

\cs_new:Npn \__tocbasic_caption_patch_code:
  {
    \DeclareCommandCopy { \caption } { \__tocbasic_caption:w }
    \DeclareCommandCopy { \captionof } { \__tocbasic_caption_of:w }
  }
\msg_new:nnnn { tocbasic } { caption-code-by-class-deactivated }
  {
    Loading~of~class-dependent~code~for~package~caption3\\
    prevented~\msg_line_context:.
  }
  {
    The~caption3~package~attempts~to~detect~classes~known~to~it~
    using~a~number~of~heuristics~and,~if~necessary,~
    reload~class-dependent~code.~
    Unfortunately,~the~code~from~caption-koma.sto,~for~example,~
    is~no~longer~compatible~with~the~KOMA-Script~package~tocbasic~
    since~KOMA-Script~3.46.~
    Therefore,~the~tocbasic~package~attempts~to~prevent~this~file~
    from~being~loaded~by~pretending~to~caption3~that~a~standard~class~
    is~being~used.~
    Since~the~caption3~package,~as~part~of~the~caption~collection,~
    is~no~longer~maintained,~and~since~the~KOMA-Script~author~himself~
    is~trying~to~maintain~the~compatibility~of~the~caption~package~
    with~KOMA-Script,~this~is~currently~the~best~known~method~
    to~prevent~unnecessary~warnings~from~caption~or~caption3.
  }
\cs_if_exist:NT \KOMAClassName
  {
    \hook_gput_code:nnn { package / caption3 / before } { tocbasic }
      {
        \cs_set:Npn \caption@documentclass { standard }
        \msg_info:nn { tocbasic } { caption-code-by-class-deactivated }
      }
  }
\prg_new_conditional:Nnn \tocbasic_if_caption_above:n { p, T, F, TF }
  {
    \bool_if:nTF
      {
        \cs_if_exist_use:cF { g__tocbasic_ #1 _caption_above_bool }
          {
            \g__tocbasic__caption_above_bool
          }
      }
      {
        \prg_return_true:
      }
      {
        \prg_return_false:
      }
  }
\prg_new_conditional:Npnn \tocbasic_if_caption_above: { p, T, F, TF }
  {
    \bool_if:nTF
      {
        \cs_if_exist_use:cF { g__tocbasic_ \@captype _caption_above_bool }
          {
            \g__tocbasic__caption_above_bool
          }
      }
      {
        \prg_return_true:
      }
      {
        \prg_return_false:
      }
  }
\cs_new:Nn \__tocbasic_caption_setup:
  {
    \tocbasic_if_caption_above:TF
      {
        \cs_if_exist:NTF \captionsetup
          { \captionsetup { position=top } }
          { \__tocbasic_swap_skip: }
      }
      {
        \cs_if_exist:NT \captionsetup
          { \captionsetup { position=bottom } }
      }
  }
\cs_new:Nn \__tocbasic_captionof_setup:n
  {
    \exp_args:Nne \hook_gput_next_code:nn { tocbasic / caption / after }
      {
        \cs_if_exist:NTF \@captype
          { \exp_not:N \tl_set:Nn \exp_not:N \@captype { \@captype } }
          { \exp_not:n { \cs_set_eq:NN \@captype \tex_undefined:D } }
      }
    \tocbasic_if_caption_above:nTF { #1 }
      {
        \cs_if_exist:NTF \captionsetup
          { \captionsetup { type=#1, position=top } }
          {
            \tl_set:Ne \@captype { #1 }
            \__tocbasic_swap_skip:
          }
      }
      {
        \cs_if_exist:NTF \captionsetup
          { \captionsetup { type=#1, position=bottom } }
          { \tl_set:Ne \@captype { #1 } }
      }
  }
\cs_new:Nn \__tocbasic_captionof_setup:nn
  {
    \exp_args:Nne \hook_gput_next_code:nn { tocbasic / caption / after }
      {
        \cs_if_exist:NTF \@captype
          { \exp_not:N \tl_set:Nn \exp_not:N \@captype { \@captype } }
          { \exp_not:n { \cs_set_eq:NN \@captype \tex_undefined:D } }
      }
    \str_if_eq:eeTF { #2 } { top }
      {
        \cs_if_exist:NTF \captionsetup
          { \captionsetup { type=#1, position=top } }
          {
            \tl_set:Ne \@captype { #1 }
            \__tocbasic_swap_skip:
          }
      }
      {
        \cs_if_exist:NTF \captionsetup
          { \captionsetup { type=#1, position=#2 } }
          { \tl_set:Ne \@captype { #1 } }
      }
  }
\NewDocumentCommand \__tocbasic_caption:w { s o +m }
  {
    \__tocbasic_caption_setup:
    \exp_last_unbraced:Ne \__tocbasic_saved_caption:w
      { \IfBooleanT{#1}* \IfValueT{#2} { \exp_not:n {[{#2}]} } }
      {#3}
    \hook_use:n { tocbasic / caption / after }
  }
\NewDocumentCommand \captionabove { s O{#3} +m }
  {
    \cs_if_exist:NTF \captionsetup
      { \captionsetup { position=top } }
      { \__tocbasic_swap_skip: }
    \exp_last_unbraced:Ne \__tocbasic_saved_caption:w { \IfBooleanT{#1}* }
      [{#2}] {#3}
    \hook_use:n { tocbasic / caption / after }
  }

\NewDocumentCommand \captionbelow { s O{#3} +m }
  {
    \cs_if_exist:NT \captionsetup
      { \captionsetup { position=bottom } }
    \exp_last_unbraced:Ne \__tocbasic_saved_caption:w { \IfBooleanT{#1}* }
      [{#2}] {#3}
    \hook_use:n { tocbasic / caption / after }
  }
\NewDocumentCommand \__tocbasic_caption_of:w { s m o +m }
  {
    \__tocbasic_captionof_setup:n { #2 }
    \exp_last_unbraced:Ne \__tocbasic_saved_caption:w
      { \IfBooleanT{#1}* \IfValueT{#3} { \exp_not:n {[{#3}]} } }
      {#4}
    \hook_use:n { tocbasic / caption / after }
  }

\cs_if_exist:NF { \captionof }
  { \DeclareCommandCopy { \captionof } { \__tocbasic_caption_of:w } }
\cs_if_exist:NTF \socket_new:nn
  { \socket_new:nn { tocbasic / swapskip / after } { 0 } }
  { \hook_new:n { tocbasic / swapskip / after } }
\hook_new:n { tocbasic / caption / after }
\cs_new:Nn \__tocbasic_swap_skip:
  {
    \skip_set_eq:NN \l_tmpa_skip \abovecaptionskip
    \skip_set_eq:NN \abovecaptionskip \belowcaptionskip
    \skip_set_eq:NN \belowcaptionskip \l_tmpa_skip
    \hook_gput_next_code:nn { tocbasic / caption / after } {
      \skip_set_eq:NN \l_tmpa_skip \abovecaptionskip
      \skip_set_eq:NN \abovecaptionskip \belowcaptionskip
      \skip_set_eq:NN \belowcaptionskip \l_tmpa_skip
    }
    \cs_if_exist_use:NF \socket_use:n \hook_use:n
      { tocbasic / swapskip / after }
  }
\NewDocumentCommand \captionaboveof { s m O{#4} +m }
  {
    \__tocbasic_captionof_setup:nn { #2 } { top }
    \exp_last_unbraced:Ne \__tocbasic_saved_caption:w { \IfBooleanT{#1}* }
      [{#3}] {#4}
    \hook_use:n { tocbasic / caption / after }
  }

\NewDocumentCommand \captionbelowof { s m O{#4} +m }
  {
    \__tocbasic_captionof_setup:nn { #2 } { bottom }
    \exp_last_unbraced:Ne \__tocbasic_saved_caption:w { \IfBooleanT{#1}* }
      [{#3}] {#4}
    \hook_use:n { tocbasic / caption / after }
  }
\ExplSyntaxOff
\fi
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: body)
\newcommand*{\scr@numberline}[1]{%
  \numberline@box{%
    \numberline@prefix
    \Ifstr{#1}{}{#1}{%
      \numberline@numberformat{#1}%
    }%
    \numberline@postfix
  }%
}
\newcommand*{\usetocbasicnumberline}[1][%
  \PackageInfo{tocbasic}{Using my definition of `\string\numberline'}%
]{%
  \@tempswatrue
  \begingroup
    \def\scr@numberline##1{\global\@tempswafalse}%
    \@tempdima\maxdimen
    \sbox\@tempboxa{\numberline{0}}%
  \endgroup
  \if@tempswa #1\renewcommand*{\numberline}[1]{\scr@numberline{##1}}\fi
}
\newcommand*{\numberline@prefix}{}
\newcommand*{\numberline@postfix}{\hfil}
\newcommand*{\numberline@numberformat}[1]{%
  \Ifstr{#1}{}{}{\numberline@numberprefix#1\numberline@numberpostfix}%
}
\newcommand*{\numberline@numberprefix}{}
\newcommand*{\numberline@numberpostfix}{}
\newcommand*{\numberline@box}[1]{\hb@xt@\@tempdima{#1}}
\DefineFamily{KOMAarg}
\DefineFamilyMember[.dte]{KOMAarg}
\NewDocumentCommand{\@DefineTOCEntryOption}{mmom}{%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2}%
  }%
  \IfValueTF{#3}{%
    \l@addto@macro\scr@dte@doopts{[#3]}%
    \DefineFamilyKey[.dte]{KOMAarg}{#2}[{#3}]{#4}%
  }{%
    \DefineFamilyKey[.dte]{KOMAarg}{#2}{#4}%
  }%
}
\newcommand*{\@RelaxTOCEntryOptions}{%
  \begingroup
    \def\do@endgroup{\endgroup}%
    \DeclareDocumentCommand\do{m+o}{%
      \l@addto@macro\do@endgroup{%
        \RelaxFamilyKey[.dte]{KOMAarg}{##1}%
      }%
    }%
    \scr@dte@doopts
  \do@endgroup
}
\NewDocumentCommand{\@DefineTOCEntryListOption}{mmommm}{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{##1}%
    \FamilyKeyStateProcessed
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #4\scr@dte@current#5\expandafter\endcsname
      \csname #4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \expandafter\protected@edef\csname #4\scr@dte@current#5\endcsname{%
      \csname #4\scr@dte@current#5\endcsname,##1}%
    \FamilyKeyStateProcessed
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\NewDocumentCommand{\@DefineTOCEntryLengthOption}{mmommm}{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryLengthOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #4\scr@dte@current#5\expandafter\endcsname
      \csname #4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \@DefineTOCEntryAddLengthOptionMacro{#2+}{#4}{#5}{##1}%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}%
    \noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryLengthOptionMacro}[4]{%
  \protected@edef\reserved@a{%
    \noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}%
  }\reserved@a
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \ifscr@dte@expandtopt
      \expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
        \the\@tempskipa}%
    \else
      \expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{#4}%
    \fi
  \fi
}
\newcommand*{\@DefineTOCEntryAddLengthOptionMacro}[4]{%
  \@ifundefined{#2\scr@dte@current#3}{%
    \FamilyKeyStateUnknownValue
  }{%
    \protected@edef\reserved@a{%
      \noexpand\FamilySetLength{KOMAarg}{#1}{\noexpand\@tempskipa}{#4}%
    }\reserved@a
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \ifscr@dte@expandtopt
        \expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
          \the\glueexpr\@tempskipa
          +\csname #2\scr@dte@current#3\endcsname\relax}%
      \else
        \expandafter\protected@edef\csname #2\scr@dte@current#3\endcsname{%
          \the\glueexpr #4%
            +\csname #2\scr@dte@current#3\endcsname\relax}%
      \fi
    \fi
  }%
}
\NewDocumentCommand{\@DefineTOCEntryNumberOption}{mmommm}{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryNumberOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname #4\scr@dte@current#5\expandafter\endcsname
      \csname #4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2+}{%
    \@DefineTOCEntryAddNumberOptionMacro{#2+}{#4}{#5}{##1}%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}%
    \noexpand\do{#2:}\noexpand\do{#2+}%
  }%
}
\newcommand*{\@DefineTOCEntryNumberOptionMacro}[4]{%
  \protected@edef\reserved@a{%
    \noexpand\FamilySetCounterMacro{KOMAarg}{#1}{%
      \expandafter\noexpand\csname #2\scr@dte@current#3\endcsname
    }{#4}%
  }\reserved@a
}
\newcommand*{\@DefineTOCEntryAddNumberOptionMacro}[4]{%
  \@ifundefined{#2\scr@dte@current#3}{%
    \FamilyKeyStateUnknownValue
  }{%
    \FamilySetCounterMacro{KOMAarg}{#1}{%
      \reserved@a
    }{#4}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \expandafter\edef\csname #2\scr@dte@current#3\endcsname{%
        \the\numexpr \reserved@a+\csname #2\scr@dte@current#3\endcsname\relax
      }%
    \fi
  }%
}
\NewDocumentCommand{\@DefineTOCEntryBooleanOption}{mmO{true}mmm}{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{if#4}{#5}{#2}{#6}%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5true}{#2}{#6}%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5false}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryBoolOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{if#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname if#4\scr@dte@current#5\expandafter\endcsname
      \csname if#4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
  }%
}
\newcommand*{\@DefineTOCEntryBoolOptionMacro}[4]{%
  \@ifundefined{if#2\scr@dte@current#3}{%
    \expandafter\newif\csname if#2\scr@dte@current#3\endcsname
  }{}%
  \FamilySetBool{KOMAarg}{#1}{#2\scr@dte@current#3}{#4}%
}
\NewDocumentCommand{\@DefineTOCEntryIfOption}{mmO{true}mmm}{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{If#4}{#5}{#2}{#6}%
  \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
    \@DefineTOCEntryIfOptionMacro{#2}{#4}{#5}{##1}%
  }%
  \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
    \scr@ifundefinedorrelax{If#4##1#5}{\FamilyKeyStateUnknownValue}{%
      \expandafter\let
      \csname If#4\scr@dte@current#5\expandafter\endcsname
      \csname If#4##1#5\endcsname
      \FamilyKeyStateProcessed
    }%
  }%
  \edef\scr@dte@doopts{%
    \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
  }%
}
\newcommand*{\@DefineTOCEntryIfOptionMacro}[4]{%
  \FamilySetBool{KOMAarg}{#1}{@tempswa}{#4}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \if@tempswa
      \expandafter\let\csname If#2\scr@dte@current#3\endcsname\@firstoftwo
    \else
      \expandafter\let\csname If#2\scr@dte@current#3\endcsname\@secondoftwo
    \fi
  \fi
}
\NewDocumentCommand{\@DefineTOCEntryCommandOption}{mmommO{0}m}{%
  \@TOCEntryStyleNeedsCommandByOption{#1}{#4}{#5}{#2}{#7}%
  \ifcase #6
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}{####8}}%
    }%
  \or
    \@DefineTOCEntryOption{#1}{#2}[{#3}]{%
      \@DefineTOCEntryCommandOptionMacro{#2}{#4}{#5}[#6]{##1{####1}{####2}{###3}{###4}{####5}{####6}{####7}{####8}{####9}}%
    }%
  \else
    \PackageError{tocbasic}{maximum argument supported}{%
      \string\DefineTOCEntryCommandOption\space currently supports only
      commands with\MessageBreak
      at most one argument not #5}%
    \expandafter\@gobbletwo
  \fi
  \@firstofone{%
    \DefineFamilyKey[.dte]{KOMAarg}{#2:}{%
      \scr@ifundefinedorrelax{#4##1#5}{\FamilyKeyStateUnknownValue}{%
        \expandafter\let
        \csname #4\scr@dte@current#5\expandafter\endcsname
        \csname #4##1#5\endcsname
        \FamilyKeyStateProcessed
      }%
    }%
    \edef\scr@dte@doopts{%
      \unexpanded\expandafter{\scr@dte@doopts}\noexpand\do{#2:}%
    }%
  }%
}
\newcommand*{\@DefineTOCEntryCommandOptionMacro}[3]{%
  \@testopt{\@DefineTOCEntryCommandOptionMacro@{#1}{#2}{#3}}0%
}
\newcommand*{\@DefineTOCEntryCommandOptionMacro@}{}
\long\def\@DefineTOCEntryCommandOptionMacro@#1#2#3[#4]#5{%
  \let\l@ngrel@x\long
  \expandafter\@yargdef\csname #2\scr@dte@current#3\endcsname\@ne{#4}{#5}%
  \FamilyKeyStateProcessed
}
\newcommand{\@AddToDeclareTOCEntryStylePreCheckNeeds}[1]{%
  \expandafter\providecommand\csname scr@dte@precheck\endcsname[1]{}%
  \expandafter\l@addto@macro@a\csname scr@dte@precheck\endcsname
}
\newcommand{\@PreToDeclareTOCEntryStylePreCheckNeeds}[1]{%
  \expandafter\providecommand\csname scr@dte@precheck\endcsname[1]{}%
  \expandafter\l@preto@macro@a\csname scr@dte@precheck\endcsname
}
\newcommand*{\@TOCEntryStyleNeedsCommandByOption}[5]{%
  \expandafter\providecommand\expandafter*\csname scr@dte@#1@needs\endcsname{}%
  \expandafter\l@addto@macro\csname scr@dte@#1@needs\endcsname{%
    \do{#2}{#3}{#4}{#5}%
  }%
}
\NewDocumentCommand\TOCEntryStyleInitCode{sm}{%
  \IfBooleanT{#1}{\expandafter\let\csname scr@dte@#2@init\endcsname\relax}%
  \scr@ifundefinedorrelax{scr@dte@#2@init}{%
    \expandafter\newcommand\expandafter*%
    \csname scr@dte@#2@init\endcsname[1]%
  }{%
    \expandafter\l@addto@macro@a\csname scr@dte@#2@init\endcsname
  }%
}
\newcommand{\TOCEntryStyleStartInitCode}[1]{%
  \scr@ifundefinedorrelax{scr@dte@#1@init}{%
    \expandafter\providecommand\expandafter*%
    \csname scr@dte@#1@init\endcsname[1]%
  }{%
    \expandafter\l@preto@macro@a\csname scr@dte@#1@init\endcsname
  }%
}
\newcommand*{\@ExecuteTOCEntryStyleInitCode}[2]{%
  \let\scr@dte@doopts\@empty
  \expandafter\let\csname scr@dte@#1@needs\endcsname\relax
  \scr@ifundefinedorrelax{scr@dte@#1@init}{}{%
    \def\DefineTOCEntryBooleanOption{\@DefineTOCEntryBooleanOption{#1}}%
    \def\DefineTOCEntryCommandOption{\@DefineTOCEntryCommandOption{#1}}%
    \def\DefineTOCEntryIfOption{\@DefineTOCEntryIfOption{#1}}%
    \def\DefineTOCEntryLengthOption{\@DefineTOCEntryLengthOption{#1}}%
    \def\DefineTOCEntryListOption{\@DefineTOCEntryListOption{#1}}%
    \def\DefineTOCEntryNumberOption{\@DefineTOCEntryNumberOption{#1}}%
    \def\DefineTOCEntryOption{\@DefineTOCEntryOption{#1}}%
    \def\AddToDeclareTOCEntryStylePreCheckNeeds{%
      \@AddToDeclareTOCEntryStylePreCheckNeeds{#1}}%
    \def\PreToDeclareTOCEntryStylePreCheckNeeds{%
      \@PreToDeclareTOCEntryStylePreCheckNeeds{#1}}%
    \def\TOCEntryStyleNeedsCommandByOption{%
      \@TOCEntryStyleNeedsCommandByOption{#1}}%
    \@nameuse{scr@dte@#1@init}{#2}%
    \let\TOCEntryStyleNeedsCommandByOption\relax
    \let\PreToDeclareTOCEntryStylePreCheckNeeds\relax
    \let\AddToDeclareTOCEntryStylePreCheckNeeds\relax
    \let\DefineTOCEntryOption\relax
    \let\DefineTOCEntryNumberOption\relax
    \let\DefineTOCEntryListOption\relax
    \let\DefineTOCEntryLengthOption\relax
    \let\DefineTOCEntryIfOption\relax
    \let\DefineTOCEntryCommandOption\relax
    \let\DefineTOCEntryBooleanOption\relax
  }%
}
\NewDocumentCommand{\DeclareTOCStyleEntry}{+omm}{%
  \scr@ifundefinedorrelax{scr@dte@def@l@#2}{%
    \IfFileExists{tocbasic-tocstyle-#2.def}{%
      \edef\reserved@a{%
        \unexpanded{%
          \makeatletter
          \input{tocbasic-tocstyle-#2.def}%
          \catcode`\@=}\the\catcode`\@\relax
      }\reserved@a
    }{}%
  }{}%
  \scr@ifundefinedorrelax{scr@dte@def@l@#2}{%
    \PackageError{tocbasic}{toc entry style `#2' undefined}{%
      Somebody told me to define toc entry `#3' with style `#2',\MessageBreak
      but I do not know style `#2'.\MessageBreak
      You should first define the style then define the entry.\MessageBreak
      If you'll continue, I'll ignore the command. This could result
      in\MessageBreak
      further error messages.%
    }%
  }{%
    \let\scr@dte@precheck\@gobble
    \def\scr@dte@current{#3}%
    \@ExecuteTOCEntryStyleInitCode{#2}{#3}%
    \IfValueT{#1}{%
      \FamilyBoolKey[.dte]{KOMAarg}{expandtopt}{scr@dte@expandtopt}%
      \scr@dte@expandtoptfalse
      \FamilyExecuteOptions[.dte]{KOMAarg}{#1}%
      \RelaxFamilyKey[.dte]{KOMAarg}{expandtopt}%
    }%
    \@RelaxTOCEntryOptions
    \let\scr@dte@doopts\relax
    \let\scr@dte@current\relax
    \scr@ifundefinedorrelax{#3tocdepth}{%
      \expandafter\let\csname #3tocdepth\expandafter\endcsname
      \csname #3numdepth\endcsname
    }{}%
    \scr@dte@precheck{#3}%
    \let\scr@dte@precheck\relax
    \begingroup
      \aftergroup\@tempswatrue
      \def\do##1##2##3##4{%
        \scr@ifundefinedorrelax{##1#3##2}{%
          \PackageError{tocbasic}{toc style `#2' needs ##4\MessageBreak
            of `#3'}{%
            Usually the ##4 is defined using option `##3'.\MessageBreak
            In some cases it may be set defining command
            `\expandafter\string\csname ##1#3##2\endcsname'.\MessageBreak
            If you'll continue, I'll ignore the command. This could result
            in\MessageBreak
            further error messages.%
          }%
          \aftergroup\@tempswafalse
        }{}%
      }%
      \do{}{tocdepth}{level}{toc style level}%
      \@nameuse{scr@dte@#2@needs}%
    \endgroup
    \if@tempswa
      \@nameuse{scr@dte@def@l@#2}{#3}%
      \expandafter\edef\csname scr@dte@#3@style\endcsname{#2}%
      \expandafter\edef\csname scr@tso@#3@style\endcsname{#2}%
      \expandafter\let\csname toclevel@#3\expandafter\endcsname
      \csname #3tocdepth\endcsname
      \if@atdocument\else
        \scr@ifundefinedorrelax{AfterPackage}{%
          \AtBeginDocument
        }{%
          \AfterPackage*{hyperref}%
        }%
        {%
          \expandafter\let\csname toclevel@#3\expandafter\endcsname
          \csname #3tocdepth\endcsname
        }%
      \fi
    \fi
  }%
}
\NewDocumentCommand{\DeclareTOCStyleEntries}{+omm}{%
  \edef\reserved@a{#3}%
  \@for \reserved@a:=\reserved@a \do {%
    \scr@trim@spaces\reserved@a
    \ifx\reserved@a\@empty\else
      \IfValueTF{#1}{%
        \edef\reserved@a{%
          \unexpanded{\DeclareTOCStyleEntry[{#1}]{#2}}{\reserved@a}}%
      }{%
        \edef\reserved@a{%
          \unexpanded{\DeclareTOCStyleEntry{#2}}{\reserved@a}}%
      }%
      \reserved@a
    \fi
  }%
}
\NewDocumentCommand{\DeclareTOCEntryStyle}{m+O{}+m}{%
  \@namedef{scr@dte@def@l@#1}##1{%
    \@namedef{l@##1}####1####2{%
      \TOC@EntryStartHook{##1}%
      #3%
      \TOC@EntryEndHook{##1}%
    }%
  }%
  \TOCEntryStyleInitCode*{#1}{%
    \DefineTOCEntryNumberOption{level}{}{tocdepth}{toc entry level}%
    #2%
  }%
}
\newcommand*{\TOC@EntryStartHook}[1]{}
\newcommand*{\TOC@EntryEndHook}[1]{}
\newcommand*{\CloneTOCEntryStyle}[2]{%
  \expandafter\let\csname scr@dte@def@l@#2\expandafter\endcsname
  \csname scr@dte@def@l@#1\endcsname
  \expandafter\let\csname scr@dte@#2@init\expandafter\endcsname
  \csname scr@dte@#1@init\endcsname
}
\providecommand*\@pnumwidth{1.55em}
\providecommand*\@tocrmarg {2.55em}
\providecommand*\@dotsep   {4.5}
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: style,gobble)
\DeclareTOCEntryStyle{gobble}{}%
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: style,dottedtocline)
\DeclareTOCEntryStyle{dottedtocline}[{%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \DefineTOCEntryLengthOption{numwidth}%
    {scr@tso@}{@numwidth}{entry number width}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \Ifstr{#1}{lstlisting}{\@namedef{#1tocdepth}{1}}{%
                        \expandafter\let\csname #1tocdepth\expandafter\endcsname
                        \csname #1numdepth\endcsname
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \expandafter\let\csname #1tocdepth\expandafter\endcsname
    \csname toclevel@#1\endcsname
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
            \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
                \scr@ifundefinedorrelax{l@chapter}{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{3.8em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{7em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{10em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{7.0em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{12em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@numwidth}{%
    \@ifundefined{scr@#1@tocnumwidth}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
              \scr@ifundefinedorrelax{chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@numwidth}{3.2em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@numwidth}{4.1em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@numwidth}{5m}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@numwidth}{3.1em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@numwidth}{5em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@numwidth}{6em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}%
    }%
  }{}%
}]{%
  \Iftocfeature{\@currext}{noindent}{%
    \@dottedtocline{\@nameuse{#1tocdepth}}{\z@}%
                   {\@nameuse{scr@tso@#1@numwidth}}{##1}{##2}%
  }{%
    \@dottedtocline{\@nameuse{#1tocdepth}}{\@nameuse{scr@tso@#1@indent}}%
                   {\@nameuse{scr@tso@#1@numwidth}}{##1}{##2}%
  }%
}
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: style,undottedtocline)
\DeclareTOCEntryStyle{undottedtocline}[{%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \DefineTOCEntryLengthOption{numwidth}%
    {scr@tso@}{@numwidth}{entry number width}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \Ifstr{#1}{lstlisting}{\@namedef{#1tocdepth}{1}}{%
                        \expandafter\let\csname #1tocdepth\expandafter\endcsname
                        \csname #1numdepth\endcsname
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \expandafter\let\csname #1tocdepth\expandafter\endcsname
    \csname toclevel@#1\endcsname
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
            \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
                \scr@ifundefinedorrelax{l@chapter}{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{3.8em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{7em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{10em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{7.0em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{12em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@numwidth}{%
    \@ifundefined{scr@#1@tocnumwidth}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
              \scr@ifundefinedorrelax{chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@numwidth}{3.2em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@numwidth}{4.1em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@numwidth}{5m}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@numwidth}{3.1em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@numwidth}{5em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@numwidth}{6em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}%
    }%
  }{}%
}]{%
  \ifnum \c@tocdepth >\numexpr \@nameuse{#1tocdepth}-\@ne\relax
    \ifnum \@nameuse{#1tocdepth}<\@ne
      \scr@ifundefinedorrelax{chapter}{%
        \addpenalty\@secpenalty
        \addvspace{1.0em \@plus\p@}%
      }{%
        \addpenalty{-\@highpenalty}%
        \vskip 1.0em \@plus\p@
      }%
    \else
      \addpenalty\@secpenalty
      \addvspace{1.0em \@plus\p@}%
    \fi
    \setlength\@tempdima{\@nameuse{scr@tso@#1@numwidth}}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \bfseries
      \advance\leftskip\@tempdima
      \Iftocfeature{\@currext}{noindent}{%
        \hskip -\leftskip
      }{%
        \advance\leftskip\@nameuse{scr@tso@#1@indent}%
        \hskip -\dimexpr \leftskip-\@nameuse{scr@tso@#1@indent}\relax
      }%
      ##1%
      \nobreak
      \hfil \nobreak\hb@xt@\@pnumwidth{\hss ##2}%
      \par
      \penalty\@highpenalty
    \endgroup
  \fi
}
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: style, largetocline)
\DeclareTOCEntryStyle{largetocline}[{%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \Ifstr{#1}{lstlisting}{\@namedef{#1tocdepth}{1}}{%
                        \expandafter\let\csname #1tocdepth\expandafter\endcsname
                        \csname #1numdepth\endcsname
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \expandafter\let\csname #1tocdepth\expandafter\endcsname
    \csname toclevel@#1\endcsname
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
            \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
                \scr@ifundefinedorrelax{l@chapter}{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{3.8em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{7em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{10em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{7.0em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{12em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
}]{%
  \ifnum \c@tocdepth >\numexpr \@nameuse{#1tocdepth}-\@ne\relax
    \ifnum \@nameuse{#1tocdepth}<\@ne
      \scr@ifundefinedorrelax{chapter}{%
        \addpenalty\@secpenalty
        \addvspace{2.25em \@plus\p@}%
      }{%
        \addpenalty{-\@highpenalty}%
        \addvspace{2.25em \@plus\p@}%
      }%
    \else
      \addpenalty\@secpenalty
      \addvspace{2.25em \@plus\p@}%
    \fi
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode
      \large
      \bfseries
      \Iftocfeature{\@currext}{noindent}{%
      }{%
        \advance\leftskip\@nameuse{scr@tso@#1@indent}%
      }%
      ##1%
      \hfil \nobreak\hb@xt@\@pnumwidth{\hss ##2}%
      \par
      \nobreak
      \ifnum 0=
        \scr@ifundefinedorrelax{chapter}{\if@compatibility 1\else 0\fi}{1}\relax
        \global\@nobreaktrue
        \everypar{\global\@nobreakfalse\everypar{}}%
      \fi
    \endgroup
  \fi
}
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: style,tocline)
\DeclareTOCEntryStyle{tocline}[{%
  \DefineTOCEntryCommandOption{numberprefix}%
    {scr@tso@}{@numberprefix}{number prefix definition}%
  \DefineTOCEntryCommandOption{numberpostfix}%
    {scr@tso@}{@numberpostfix}{number postfix definition}%
  \DefineTOCEntryLengthOption{beforeskip}%
    {scr@tso@}{@beforeskip}{vertical skip before the entry}%
  \DefineTOCEntryIfOption{breakafternumber}%
    {scr@tso@}{@breakafternumber}{line break after number flag}%
  \DefineTOCEntryIfOption{dynnumwidth}%
  {scr@tso@}{@dynnumwidth}{dynamic number width flag}%
  \DefineTOCEntryListOption{indentfollows}%
    {scr@tso@}{@indentfollows}{list of levels that define the indent}%
  \DefineTOCEntryIfOption{dynindent}%
    {scr@tso@}{@dynindent}{dynamic indent width flag}%
  \DefineTOCEntryCommandOption{entryformat}%
    {scr@tso@}{@entryformat}[1]{entry format}%
  \DefineTOCEntryCommandOption{entrynumberformat}%
    {scr@tso@}{@numberformat}[1]{entry number format}%
  \DefineTOCEntryCommandOption{linefill}[\TOCLineLeaderFill]%
    {scr@tso@}{@linefill}{filling between text and page number}%
  \DefineTOCEntryLengthOption{numsep}%
    {scr@tso@}{@numsep}{entry number separation}%
  \DefineTOCEntryCommandOption{onstarthigherlevel}%
    {scr@tso@}{@LastTOCLevelWasLower}{start higher level entry hook}%
  \DefineTOCEntryCommandOption{onstartlowerlevel}%
    {scr@tso@}{@LastTOCLevelWasHigher}{start lower level entry hook}%
  \DefineTOCEntryCommandOption{onstartsamelevel}%
    {scr@tso@}{@LastTOCLevelWasSame}{start same level entry hook}%
  \DefineTOCEntryCommandOption{pagenumberbox}%
    {scr@tso@}{@pagenumberbox}[1]{page number box}%
  \DefineTOCEntryCommandOption{pagenumberformat}%
    {scr@tso@}{@pagenumberformat}[1]{page number format}%
  \DefineTOCEntryLengthOption{pagenumberwidth}%
    {scr@tso@}{@pagenumberwidth}{width of page number box}%
  \DefineTOCEntryLengthOption{rightindent}%
    {scr@tso@}{@rightindent}{entry's text right indent}%
  \DefineTOCEntryOption{raggedentrytext}[true]{%
    \FamilySetBool{KOMAarg}{raggedentrytext}{@tempswa}{##1}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \if@tempswa
        \expandafter\let\csname ragged\scr@dte@current entry\endcsname
        \raggedright
      \else
        \expandafter\let\csname ragged\scr@dte@current entry\endcsname
        \relax
      \fi
    \fi
  }%
  \DefineTOCEntryIfOption{raggedpagenumber}%
    {scr@tso@}{@raggedpage}{page number ragged flag}%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \DefineTOCEntryLengthOption{numwidth}%
    {scr@tso@}{@numwidth}{entry number width}%
  \ExpandArgs{c}\providecommand{scr@tso@#1@numberprefix}{}%
  \ExpandArgs{c}\providecommand{scr@tso@#1@numberpostfix}{}%
  \scr@ifundefinedorrelax{#1tocdepth}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{\scr@dte@nosub{#1}tocdepth}{}{%
        \expandafter\edef\csname #1tocdepth\endcsname{%
          \the\numexpr \noexpand\@nameuse{\scr@dte@nosub{#1}tocdepth}+\@ne\relax
        }%
      }%
    }{}%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \Ifstr{#1}{lstlisting}{\@namedef{#1tocdepth}{1}}{%
                        \expandafter\let\csname #1tocdepth\expandafter\endcsname
                        \csname #1numdepth\endcsname
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \expandafter\let\csname #1tocdepth\expandafter\endcsname
    \csname toclevel@#1\endcsname
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstrstart{#1}{sub}{%
        \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@indent}{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
              \relax
            }%
          }{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
                       +\noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }%
      }{}%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@pagenumberwidth}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@pagenumberwidth}{%
        \@namedef{scr@tso@#1@pagenumberwidth}{\@pnumwidth}%
      }{%
        \expandafter\let
        \csname scr@tso@#1@pagenumberwidth\expandafter\endcsname
        \csname scr@tso@\scr@dte@nosub{#1}@pagenumberwidth\endcsname
      }%
    }{%
      \@namedef{scr@tso@#1@pagenumberwidth}{\@pnumwidth}%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@rightindent}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@rightindent}{%
        \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
      }{%
        \expandafter\let
        \csname scr@tso@#1@rightindent\expandafter\endcsname
        \csname scr@tso@\scr@dte@nosub{#1}@rightindent\endcsname
      }%
    }{%
      \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
            \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
                \scr@ifundefinedorrelax{l@chapter}{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{3.8em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{7em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{10em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{7.0em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{12em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@numwidth}{%
    \scr@ifundefinedorrelax{scr@#1@tocnumwidth}{%
      \Ifstrstart{#1}{sub}{%
        \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{%
          \expandafter\edef\csname scr@tso@#1@numwidth\endcsname{%
            \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
                     +.9em%
            \relax
          }%
        }%
      }{}%
    }{%
      \@namedef{scr@tso@#1@numwidth}{\@nameuse{scr@#1@tocnumwidth}}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@numwidth}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
            \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
              \scr@ifundefinedorrelax{chapter}{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{1.5em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@numwidth}{3.2em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@numwidth}{4.1em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@numwidth}{5m}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }{%
                \Ifstr{#1}{section}{\@namedef{scr@tso@#1@numwidth}{2.3em}}{%
                  \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@numwidth}{3.2em}}{%
                    \Ifstr{#1}{subsubsection}{%
                      \@namedef{scr@tso@#1@numwidth}{3.1em}%
                    }{%
                      \Ifstr{#1}{paragraph}{%
                        \@namedef{scr@tso@#1@numwidth}{5em}%
                      }{%
                        \Ifstr{#1}{subparagraph}{%
                          \@namedef{scr@tso@#1@numwidth}{6em}%
                        }{%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
  }{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@LastTOCLevelWasLower\endcsname{\LastTOCLevelWasLower}%
  \expandafter\providecommand%
  \csname scr@tso@#1@LastTOCLevelWasSame\endcsname{\LastTOCLevelWasSame}%
  \expandafter\providecommand%
  \csname scr@tso@#1@LastTOCLevelWasHigher\endcsname{\LastTOCLevelWasHigher}%
  \@ifundefined{scr@tso@#1@beforeskip}{%
    \Ifstr{#1}{part}{%
      \@namedef{scr@tso@#1@beforeskip}{\glueexpr 2.25em \@plus\p@\relax}%
    }{%
      \Ifstr{#1}{chapter}{%
        \@namedef{scr@tso@#1@beforeskip}{\glueexpr 1.0em \@plus\p@\relax}%
      }{%
        \Ifstr{#1}{section}{%
          \scr@ifundefinedorrelax{l@chapter}{%
            \@namedef{scr@tso@#1@beforeskip}{\glueexpr 1.0em \@plus\p@\relax}%
          }{}%
        }{}%
      }%
    }%
    \expandafter\providecommand\expandafter*%
    \csname scr@tso@#1@beforeskip\endcsname{\glueexpr \z@ plus .2\p@\relax}%
  }{}%
  \@ifundefined{scr@dte@#1@maxnumwidth}{%
    \expandafter\newlength\csname scr@dte@#1@maxnumwidth\endcsname
    \setlength{\@nameuse{scr@dte@#1@maxnumwidth}}{\z@}%
  }{}%
  \providecommand*{\scr@dte@donumwidth}{}%
  \g@addto@macro{\scr@dte@donumwidth}{\do{#1}}%
  \expandafter\providecommand\expandafter*%
  \csname scr@tso@#1@numsep\endcsname{.4em}%
  \expandafter\providecommand%
  \csname scr@tso@#1@numberformat\endcsname[1]{##1}%
  \Ifstr{#1}{part}{%
    \expandafter\providecommand%
    \csname scr@tso@#1@entryformat\endcsname[1]{\large\bfseries ##1}%
  }{%
    \Ifstr{#1}{chapter}{%
      \expandafter\providecommand%
      \csname scr@tso@#1@entryformat\endcsname[1]{\bfseries ##1}%
    }{%
      \scr@ifundefinedorrelax{l@chapter}{%
        \Ifstr{#1}{section}{%
          \expandafter\providecommand%
          \csname scr@tso@#1@entryformat\endcsname[1]{\bfseries ##1}%
        }{}%
      }{}%
      \expandafter\providecommand%
      \csname scr@tso@#1@entryformat\endcsname[1]{##1}%
    }%
  }%
  \expandafter\providecommand
  \csname Ifscr@tso@#1@breakafternumber\endcsname[2]{##2}%
  \@ifundefined{scr@tso@#1@linefill}{%
    \Ifstr{#1}{part}{%
      \@namedef{scr@tso@#1@linefill}{\hfill}%
    }{%
      \Ifstr{#1}{chapter}{%
        \@namedef{scr@tso@#1@linefill}{\hfill}%
      }{%
        \scr@ifundefinedorrelax{l@chapter}{%
          \Ifstr{#1}{section}{%
            \@namedef{scr@tso@#1@linefill}{\hfill}%
          }{}%
        }{}%
        \expandafter\providecommand%
        \csname scr@tso@#1@linefill\endcsname{\TOCLineLeaderFill\relax}%
      }%
    }%
  }{}%
  \expandafter\providecommand\csname Ifscr@tso@#1@raggedpage\endcsname[2]{##2}%
  \Ifstr{#1}{part}{%
    \expandafter\providecommand%
    \csname scr@tso@#1@pagenumberformat\endcsname[1]{\large\bfseries ##1}%
  }{%
    \Ifstr{#1}{chapter}{%
      \expandafter\providecommand%
      \csname scr@tso@#1@pagenumberformat\endcsname[1]{\bfseries ##1}%
    }{%
      \scr@ifundefinedorrelax{l@chapter}{%
        \Ifstr{#1}{section}{%
          \expandafter\providecommand%
          \csname scr@tso@#1@pagenumberformat\endcsname[1]{\bfseries ##1}%
        }{}%
      }{}%
      \expandafter\providecommand%
      \csname scr@tso@#1@pagenumberformat\endcsname[1]{%
        \normalfont\normalcolor ##1}%
    }%
  }%
  \expandafter\providecommand%
  \csname scr@tso@#1@pagenumberbox\endcsname[1]{%
    \hb@xt@\@nameuse{scr@dte@pagenumberwidth}{\hfil ##1}}%
  \expandafter\providecommand\csname
    Ifscr@tso@#1@dynnumwidth\endcsname[2]{##2}%
  \expandafter\providecommand\csname Ifscr@tso@#1@dynindent\endcsname[2]{##2}%
  \scr@ifundefinedorrelax{scr@tso@#1@indentfollows}{%
    \Ifstrstart{#1}{sub}{%
      \expandafter\edef\csname scr@tso@#1@indentfollows\endcsname{%
        \scr@dte@nosub{#1}%
      }%
    }{%
      \expandafter\let\csname scr@tso@#1@indentfollows\endcsname\@empty
    }%
  }{}%
}]{%
  \scr@dte@tocline{#1}{##1}{##2}%
}
\AtBeginDocument{%
  \BeforeClosingMainAux{%
    \begingroup
      \def\do#1{%
        \relax
        \scr@ifundefinedorrelax{scr@dte@#1@maxnumwidth}{}{%
          \ifdim \@nameuse{scr@dte@#1@maxnumwidth}>\z@
            \if@filesw
              \protected@write\@mainaux{}{%
                \string\global\string\@namedef{scr@dte@#1@lastmaxnumwidth}%
                {\the\@nameuse{scr@dte@#1@maxnumwidth}}%
              }%
            \fi
            \@nameuse{scr@dte@#1@maxnumwidth}\z@
          \fi
        }%
      }%
      \@nameuse{scr@dte@donumwidth}%
    \endgroup
  }%
}
\newcommand*{\scr@dte@nosub}[1]{\@scr@dte@nosub #1\relax}
\newcommand*{\@scr@dte@nosub}{}
\def\@scr@dte@nosub sub#1\relax{#1}
\newlength\scr@dte@tocline@numberwidth
\newcommand*{\scr@dte@tocline}[3]{%
  \ifnum \@nameuse{#1tocdepth}>\c@tocdepth
  \else
    \tocbasic@DependOnPenaltyAndTOCLevel{#1}%
    \addvspace{\@nameuse{scr@tso@#1@beforeskip}}\relax
    \@nameuse{Ifscr@tso@#1@dynindent}{%
      \expandafter\ifx\csname scr@tso@#1@indentfollows\endcsname\@empty
        \PackageWarning{tocbasic}{`dynindent' for `#1' not available}%
      \else
        \edef\reserved@a{\@nameuse{scr@tso@#1@indentfollows}}%
        \@for \reserved@a:=\reserved@a\do {%
          \scr@trim@spaces\reserved@a
          \ifx\reserved@a\@empty\else
            \scr@ifundefinedorrelax{\reserved@a tocdepth}{%
            }{%
              \ifnum \@nameuse{\reserved@a tocdepth}<\@nameuse{#1tocdepth}%
                \@tempdima\@nameuse{scr@tso@\reserved@a @indent}\relax
                \@nameuse{Ifscr@tso@\reserved@a @dynnumwidth}{%
                  \scr@ifundefinedorrelax
                  {scr@dte@\reserved@a @lastmaxnumwidth}{%
                    \advance\@tempdima
                    \@nameuse{scr@tso@\reserved@a @numwidth}\relax
                  }{%
                    \advance\@tempdima
                    \@nameuse{scr@dte@\reserved@a @lastmaxnumwidth}\relax
                  }%
                }{%
                  \advance\@tempdima
                  \@nameuse{scr@tso@\reserved@a @numwidth}\relax
                }%
                \ifdim \@tempdima>\@nameuse{scr@tso@#1@indent}\relax
                  \expandafter\edef\csname scr@tso@#1@indent\endcsname
                  {\the\@tempdima}%
                \fi
              \fi
            }%
          \fi
        }%
      \fi
    }{}%
    {%
      \Iftocfeature{\@currext}{noindent}{%
        \leftskip \z@
      }{%
        \leftskip \@nameuse{scr@tso@#1@indent}\relax
      }%
      \rightskip \@nameuse{scr@tso@#1@rightindent}\relax
      \parfillskip -\rightskip
      \@nameuse{Ifscr@tso@#1@raggedpage}{%
        \addtolength{\parfillskip}{\z@ \@plus 1fil}%
      }{}%
      \Iftocfeature{\@currext}{noindent}{%
        \parindent \z@
      }{%
        \parindent \@nameuse{scr@tso@#1@indent}\relax
      }%
      \@afterindenttrue
      \interlinepenalty\@M
      \expandafter\ifx\csname ragged#1entry\endcsname\raggedright
        \addtolength\rightskip\@flushglue
      \else
        \def\reserved@a{\raggedright}%
        \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
          \addtolength\rightskip\@flushglue
        \else
          \renewcommand\reserved@a{\raggedright}%
          \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
            \addtolength\rightskip\@flushglue
          \fi
        \fi
      \fi
      \leavevmode
      \@tempdima \@nameuse{scr@tso@#1@numwidth}\relax
      \@nameuse{Ifscr@tso@#1@dynnumwidth}{%
        \scr@ifundefinedorrelax{scr@dte@#1@lastmaxnumwidth}{}{%
          \ifdim \@nameuse{scr@dte@#1@lastmaxnumwidth}>\@tempdima
            \@tempdima\@nameuse{scr@dte@#1@lastmaxnumwidth}\relax
          \fi
        }%
      }{}%
      \advance\leftskip \@tempdima
      \null\nobreak\hskip -\leftskip
      {%
        \l@preto@macro\numberline@numberprefix
          {\@nameuse{scr@tso@#1@numberprefix}}%
        \l@addto@macro\numberline@numberpostfix
          {\@nameuse{scr@tso@#1@numberpostfix}}%
        \usetocbasicnumberline
        \let\scr@dte@numberline@box\numberline@box
        \def\numberline@box##1{%
          \sbox\scr@dte@tocline@numbox{\@nameuse{scr@tso@#1@numberformat}{##1}}%
          \global\scr@dte@tocline@numberwidth
          \dimexpr\wd\scr@dte@tocline@numbox+\@nameuse{scr@tso@#1@numsep}\relax
          \relax
          \ifdim \scr@dte@tocline@numberwidth
                >\@nameuse{scr@dte@#1@maxnumwidth}\relax
            \global\@nameuse{scr@dte@#1@maxnumwidth}\scr@dte@tocline@numberwidth
          \fi
          \@nameuse{Ifscr@tso@#1@dynnumwidth}{}{%
            \ifdim \scr@dte@tocline@numberwidth
                  >\dimexpr \@nameuse{scr@tso@#1@numwidth}%
                           +\@nameuse{scr@tso@#1@numsep}\relax\relax
              \PackageWarning{tocbasic}{%
                number width of #1 toc entries should be
                increased!\MessageBreak
                Currently used number width =
                \the\wd\scr@dte@tocline@numbox,\MessageBreak
                Wanted number separation
                \space\space\space =
                \the\dimexpr\@nameuse{scr@tso@#1@numsep}\relax,\MessageBreak
                Reserved number width \space\space\space\space\space\space =
                \the\dimexpr\@nameuse{scr@tso@#1@numwidth}\relax%
              }%
            \fi
          }%
          \scr@dte@numberline@box{\@nameuse{scr@tso@#1@numberformat}{##1}}%
          \@nameuse{Ifscr@tso@#1@breakafternumber}{%
            {\parfillskip\@flushglue\par}\nobreak\hskip-\leftskip
          }{}%
        }%
        \@nameuse{scr@tso@#1@entryformat}{%
          #2%
          \nobreak
          {%
            \normalfont\normalsize\@nameuse{scr@tso@#1@linefill}%
            \nobreak
            \expandafter\let\expandafter\scr@dte@pagenumberwidth
            \csname scr@tso@#1@pagenumberwidth\endcsname
            \@nameuse{scr@tso@#1@pagenumberbox}{%
              \@nameuse{scr@tso@#1@pagenumberformat}{#3}%
            }%
          }%
          \@par
        }%
      }%
    }%
    \tocbasic@SetPenaltyByTOCLevel{#1}%
  \fi
}
\newsavebox\scr@dte@tocline@numbox
\newcommand*{\tocbasic@DependOnPenaltyAndTOCLevel}[1]{%
  \ifnum \lastpenalty<\numexpr 20009-\@nameuse{#1tocdepth}\relax
    \@nameuse{scr@tso@#1@LastTOCLevelWasHigher}%
  \else\ifnum \lastpenalty=\numexpr 20009-\@nameuse{#1tocdepth}\relax
      \@nameuse{scr@tso@#1@LastTOCLevelWasSame}%
    \else
      \@nameuse{scr@tso@#1@LastTOCLevelWasLower}%
    \fi
  \fi
}
\newcommand*{\tocbasic@SetPenaltyByTOCLevel}[1]{%
  \penalty \numexpr 20009-\@nameuse{#1tocdepth}\relax
}
\newcommand*{\LastTOCLevelWasHigher}{\ifvmode\addpenalty{\@lowpenalty}\fi}
\newcommand*{\LastTOCLevelWasSame}{\ifvmode\addpenalty{\@lowpenalty}\fi}
\newcommand*{\LastTOCLevelWasLower}{}
\newcommand*{\TOCLineLeaderFill}[1][.]{%
  \leaders\hbox{$\m@th
    \mkern \@dotsep mu\hbox{#1}\mkern \@dotsep
    mu$}\hfill
}
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: style,toctext)
\DeclareTOCEntryStyle{toctext}[{%
  \DefineTOCEntryLengthOption{beforeskip}%
    {scr@tso@}{@beforeskip}{vertical skip before the entry}%
  \DefineTOCEntryListOption{indentfollows}%
    {scr@tso@}{@indentfollows}{list of levels that define the indent}%
  \DefineTOCEntryIfOption{dynindent}%
    {scr@tso@}{@dynindent}{dynamic indent width flag}%
  \DefineTOCEntryCommandOption{entryformat}%
    {scr@tso@}{@entryformat}[1]{entry format}%
  \DefineTOCEntryCommandOption{entrynumberformat}%
    {scr@tso@}{@numberformat}[1]{entry number format}%
  \DefineTOCEntryCommandOption{prepagenumber}%
    {scr@tso@}{@prepagenumber}{separator between text and page number}%
  \DefineTOCEntryLengthOption{numsep}%
    {scr@tso@}{@numsep}{entry number separation}%
  \DefineTOCEntryCommandOption{onstartfirstentry}%
    {scr@tso@}{@onstartfirstentry}{output at start of paragraph}%
  \DefineTOCEntryCommandOption{onstartentry}%
    {scr@tso@}{@onstartentry}{output at start of all entries but the first}%
  \DefineTOCEntryCommandOption{onendlastentry}%
    {scr@tso@}{@onendlastentry}{output at end of paragraph}%
  \DefineTOCEntryCommandOption{afterpar}%
    {scr@tso@}{@afterpar}{settings after end of paragraph}%
  \DefineTOCEntryCommandOption{onendentry}%
    {scr@tso@}{@onendentry}{output at end of all entries but the last}%
  \DefineTOCEntryCommandOption{pagenumberformat}%
    {scr@tso@}{@pagenumberformat}[1]{page number format}%
  \DefineTOCEntryLengthOption{rightindent}%
    {scr@tso@}{@rightindent}{entry's text right indent}%
  \DefineTOCEntryIfOption{raggedright}%
    {scr@tso@}{@raggedright}{use raggedright for the whole paragraph}%
  \DefineTOCEntryLengthOption{indent}%
    {scr@tso@}{@indent}{entry indent}%
  \scr@ifundefinedorrelax{#1tocdepth}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{\scr@dte@nosub{#1}tocdepth}{}{%
        \expandafter\edef\csname #1tocdepth\endcsname{%
          \the\numexpr \noexpand\@nameuse{\scr@dte@nosub{#1}tocdepth}+\@ne\relax
        }%
      }%
    }{}%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \Ifstr{#1}{part}{\@namedef{#1tocdepth}{-1}}{%
      \Ifstr{#1}{chapter}{\@namedef{#1tocdepth}{0}}{%
        \Ifstr{#1}{section}{\@namedef{#1tocdepth}{1}}{%
          \Ifstr{#1}{subsection}{\@namedef{#1tocdepth}{2}}{%
            \Ifstr{#1}{subsubsection}{\@namedef{#1tocdepth}{3}}{%
              \Ifstr{#1}{paragraph}{\@namedef{#1tocdepth}{4}}{%
                \Ifstr{#1}{subparagraph}{\@namedef{#1tocdepth}{5}}{%
                  \Ifstr{#1}{figure}{\@namedef{#1tocdepth}{1}}{%
                    \Ifstr{#1}{table}{\@namedef{#1tocdepth}{1}}{%
                      \Ifstr{#1}{lstlisting}{\@namedef{#1tocdepth}{1}}{%
                        \expandafter\let\csname #1tocdepth\expandafter\endcsname
                        \csname #1numdepth\endcsname
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
    }%
  }{}%
  \@ifundefined{#1tocdepth}{%
    \expandafter\let\csname #1tocdepth\expandafter\endcsname
    \csname toclevel@#1\endcsname
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@indent}{%
    \@ifundefined{scr@#1@tocindent}{%
      \Ifstrstart{#1}{sub}{%
        \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@indent}{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }{%
          \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@numwidth}{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
              \relax
            }%
          }{%
            \expandafter\edef\csname scr@tso@#1@indent\endcsname{%
              \glueexpr \noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@indent}%
                       +\noexpand\@nameuse{scr@tso@\scr@dte@nosub{#1}@numwidth}%
              \relax
            }%
          }%
        }%
      }{}%
    }{%
      \@namedef{scr@tso@#1@indent}{\@nameuse{scr@#1@tocindent}}%
    }%
  }{}%
  \scr@ifundefinedorrelax{scr@tso@#1@rightindent}{%
    \Ifstrstart{#1}{sub}{%
      \scr@ifundefinedorrelax{scr@tso@\scr@dte@nosub{#1}@rightindent}{%
        \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
      }{%
        \expandafter\let
        \csname scr@tso@#1@rightindent\expandafter\endcsname
        \csname scr@tso@\scr@dte@nosub{#1}@rightindent\endcsname
      }%
    }{%
      \@namedef{scr@tso@#1@rightindent}{\@tocrmarg}%
    }%
  }{}%
  \@ifundefined{scr@tso@#1@indent}{%
      \Ifstr{#1}{figure}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
        \Ifstr{#1}{table}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
          \Ifstr{#1}{lstlisting}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
            \Ifstr{#1}{part}{\@namedef{scr@tso@#1@indent}{0em}}{%
              \Ifstr{#1}{chapter}{\@namedef{scr@tso@#1@indent}{0em}}{%
                \scr@ifundefinedorrelax{l@chapter}{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{0pt}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{3.8em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{7em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{10em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }{%
                  \Ifstr{#1}{section}{\@namedef{scr@tso@#1@indent}{1.5em}}{%
                    \Ifstr{#1}{subsection}{\@namedef{scr@tso@#1@indent}{3.8em}}{%
                      \Ifstr{#1}{subsubsection}{%
                        \@namedef{scr@tso@#1@indent}{7.0em}%
                      }{%
                        \Ifstr{#1}{paragraph}{%
                          \@namedef{scr@tso@#1@indent}{10em}%
                        }{%
                          \Ifstr{#1}{subparagraph}{%
                            \@namedef{scr@tso@#1@indent}{12em}%
                          }{%
                          }%
                        }%
                      }%
                    }%
                  }%
                }%
              }%
            }%
          }%
        }%
      }%
  }{}%
  \expandafter\providecommand\expandafter*%
  \csname scr@tso@#1@beforeskip\endcsname{\z@}%
  \expandafter\providecommand\expandafter*%
  \csname scr@tso@#1@numsep\endcsname{.4em}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onstartfirstentry\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onstartentry\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onendlastentry\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@onendentry\endcsname{\quad}%
  \expandafter\providecommand%
  \csname scr@tso@#1@afterpar\endcsname{}%
  \expandafter\providecommand%
  \csname scr@tso@#1@numberformat\endcsname[1]{##1}%
      \expandafter\providecommand%
      \csname scr@tso@#1@entryformat\endcsname[1]{##1}%
  \expandafter\providecommand\csname Ifscr@tso@#1@dynindent\endcsname[2]{##2}%
  \scr@ifundefinedorrelax{scr@tso@#1@indentfollows}{%
    \Ifstrstart{#1}{sub}{%
      \expandafter\edef\csname scr@tso@#1@indentfollows\endcsname{%
        \scr@dte@nosub{#1}%
      }%
    }{%
      \expandafter\let\csname scr@tso@#1@indentfollows\endcsname\@empty
    }%
  }{}%
  \expandafter\providecommand%
  \csname Ifscr@tso@#1@raggedright\endcsname[2]{##2}%
  \expandafter\providecommand%
  \csname scr@tso@#1@prepagenumber\endcsname{\nobreakspace}%
  \expandafter\providecommand%
  \csname scr@tso@#1@pagenumberformat\endcsname[1]{##1}%
}]{%
  \scr@dte@toctext{#1}{##1}{##2}%
}
\newcommand*{\scr@dte@toctext}[3]{%
  \ifnum \@nameuse{#1tocdepth}>\c@tocdepth
  \else
    \ifhmode
      \scr@dte@toctext@lastend
      \@nameuse{scr@tso@#1@onstartentry}%
    \else
      \addvspace{\@nameuse{scr@tso@#1@beforeskip}}%
      \leavevmode
      \def\par{%
        \scr@dte@toctext@raggedright
        \scr@dte@toctext@parend
        \@par
        \scr@dte@toctext@afterpar
        \global\let\scr@dte@toctext@afterpar\relax
        \global\let\scr@dte@toctext@parend\relax
        \global\let\scr@dte@toctext@raggedright\relax
      }%
      \global\let\scr@dte@toctext@afterpar\@empty
      \Iftocfeature{\@currext}{noindent}{%
        \leftskip \z@
      }{%
        \@nameuse{Ifscr@tso@#1@dynindent}{%
          \expandafter\ifx\csname scr@tso@#1@indentfollows\endcsname\@empty
            \PackageWarning{tocbasic}{`dynindent' for `#1' not available}%
          \else
            \edef\reserved@a{\@nameuse{scr@tso@#1@indentfollows}}%
            \@for \reserved@a:=\reserved@a\do {%
              \scr@trim@spaces\reserved@a
              \ifx\reserved@a\@empty\else
                \scr@ifundefinedorrelax{\reserved@a tocdepth}{%
                }{%
                  \ifnum \@nameuse{\reserved@a tocdepth}<\@nameuse{#1tocdepth}%
                    \@tempdima\@nameuse{scr@tso@\reserved@a @indent}\relax
                    \@nameuse{Ifscr@tso@\reserved@a @dynnumwidth}{%
                      \scr@ifundefinedorrelax
                      {scr@dte@\reserved@a @lastmaxnumwidth}{%
                        \advance\@tempdima
                        \@nameuse{scr@tso@\reserved@a @numwidth}\relax
                      }{%
                        \advance\@tempdima
                        \@nameuse{scr@dte@\reserved@a @lastmaxnumwidth}\relax
                      }%
                    }{%
                      \advance\@tempdima
                      \@nameuse{scr@tso@\reserved@a @numwidth}\relax
                    }%
                    \ifdim \@tempdima>\@nameuse{scr@tso@#1@indent}\relax
                      \expandafter\edef\csname scr@tso@#1@indent\endcsname
                      {\the\@tempdima}%
                    \fi
                  \fi
                }%
              \fi
            }%
          \fi
        }{}%
        \leftskip \@nameuse{scr@tso@#1@indent}\relax
      }%
      \rightskip \@nameuse{scr@tso@#1@rightindent}\relax
      \parfillskip \z@ \@plus 1fill\relax
      \ifx\addvspace\scr@dte@xaddvspace\else
        \let\scr@dte@saddvspace\addvspace
        \def\scr@dte@xaddvspace{%
          \let\addvspace\scr@dte@saddvspace\par\addvspace}%
        \let\addvspace\scr@dte@xaddvspace
      \fi
      \ifx\addpenalty\scr@dte@xaddpenalty\else
        \let\scr@dte@saddpenalty\addpenalty
        \def\scr@dte@xaddpenalty{%
          \let\addpenalty\scr@dte@saddpenalty\par\addpenalty}%
      \fi
      \@nameuse{scr@tso@#1@onstartfirstentry}%
    \fi
    \@nameuse{Ifscr@tso@#1@raggedright}{%
      \let\\\@centercr
      \gdef\scr@dte@toctext@raggedright{%
        \@rightskip\@flushglue
        \addtolength\rightskip\@rightskip
      }%
    }{}%
    \l@addto@macro\scr@dte@toctext@afterpar{\@nameuse{scr@tso@#1@afterpar}}%
    \expandafter\global\expandafter\let\expandafter\scr@dte@toctext@lastend
    \csname scr@tso@#1@onendentry\endcsname
    \expandafter\global\expandafter\let\expandafter\scr@dte@toctext@parend
    \csname scr@tso@#1@onendlastentry\endcsname
    {%
      \usetocbasicnumberline
      \def\numberline@box##1{%
        \mbox{%
          \@nameuse{scr@tso@#1@numberformat}{\ignorespaces ##1\unskip}%
          \hskip\@nameuse{scr@tso@#1@numsep}\relax
        }%
      }%
      \@nameuse{scr@tso@#1@entryformat}{%
        \ignorespaces#2\unskip
        \@nameuse{scr@tso@#1@prepagenumber}%
        \@nameuse{scr@tso@#1@pagenumberformat}{\ignorespaces #3\unskip}%
      }%
    }%
  \fi
}
\newcommand*{\scr@dte@toctext@raggedright}{}
\newcommand*{\scr@dte@toctext@parend}{}
\newcommand*{\scr@dte@toctext@lastend}{}
%%% From File: $Id: scrkernel-tocstyle.dtx 4228 2025-10-08 14:10:51Z kohm $
%%%            (run: style,dottedtocline)
\CloneTOCEntryStyle{dottedtocline}{default}
%%% From File: $Id: tocbasic.dtx 4251 2025-12-31 10:31:49Z kohm $
%%%            (run: exit)
\AtBeginDocument{%
  \@ifundefined{MakeMarkcase}{%
    \scr@ifundefinedorrelax{KOMAClassName}{%
      \let\MakeMarkcase\MakeUppercase
    }{%
      \let\MakeMarkcase\@firstofone
    }%
  }{}%
}
%%% From File: $Id: scrlogo.dtx 4032 2023-04-17 09:45:11Z kohm $
\RequirePackage{scrlogo}
\endinput
%%
%% End of file `tocbasic.sty'.
