%% The LaTeX package tcolorbox - version 6.7.1 (2025/07/08)
%% tcbhooks.code.tex: Code for adding hooks
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2025 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{6.7.1}

\tcbset{%
  before upper app/.code={\appto\kvtcb@before@upper{#1}},%
  before upper pre/.code={\preto\kvtcb@before@upper{#1}},%
  after upper app/.code={\appto\kvtcb@after@upper{#1}},%
  after upper pre/.code={\preto\kvtcb@after@upper{#1}},%
  before lower app/.code={\appto\kvtcb@before@lower{#1}},%
  before lower pre/.code={\preto\kvtcb@before@lower{#1}},%
  after lower app/.code={\appto\kvtcb@after@lower{#1}},%
  after lower pre/.code={\preto\kvtcb@after@lower{#1}},%
  before title app/.code={\appto\kvtcb@before@title{#1}},%
  before title pre/.code={\preto\kvtcb@before@title{#1}},%
  after title app/.code={\appto\kvtcb@after@title{#1}},%
  after title pre/.code={\preto\kvtcb@after@title{#1}},%
  %
  % usable inside the document or in the preamble after setting before / after
  before app/.code={\appto\kvtcb@beforebox{#1}},%
  before pre/.code={\preto\kvtcb@beforebox{#1}},%
  after app/.code={\appto\kvtcb@afterbox{#1}},%
  after pre/.code={\preto\kvtcb@afterbox{#1}},%
  %
  before float app/.code={\appto\kvtcb@beforefloat{#1}},%
  before float pre/.code={\preto\kvtcb@beforefloat{#1}},%
  after float app/.code={\appto\kvtcb@afterfloat{#1}},%
  after float pre/.code={\preto\kvtcb@afterfloat{#1}},%
  %
  overlay unbroken app/.code={\appto\tcb@overlay@unbroken{#1}},%
  overlay unbroken pre/.code={\preto\tcb@overlay@unbroken{#1}},%
  overlay first app/.code={\appto\tcb@overlay@first{#1}},%
  overlay first pre/.code={\preto\tcb@overlay@first{#1}},%
  overlay middle app/.code={\appto\tcb@overlay@middle{#1}},%
  overlay middle pre/.code={\preto\tcb@overlay@middle{#1}},%
  overlay last app/.code={\appto\tcb@overlay@last{#1}},%
  overlay last pre/.code={\preto\tcb@overlay@last{#1}},%
  %
  overlay app/.style={overlay unbroken app={#1},overlay first app={#1},overlay middle app={#1},overlay last app={#1}},%
  overlay pre/.style={overlay unbroken pre={#1},overlay first pre={#1},overlay middle pre={#1},overlay last pre={#1}},%
  overlay broken app/.style={overlay first app={#1},overlay middle app={#1},overlay last app={#1}},%
  overlay broken pre/.style={overlay first pre={#1},overlay middle pre={#1},overlay last pre={#1}},%
  overlay unbroken and first app/.style={overlay unbroken app={#1},overlay first app={#1}},%
  overlay unbroken and first pre/.style={overlay unbroken pre={#1},overlay first pre={#1}},%
  overlay unbroken and last app/.style={overlay unbroken app={#1},overlay last app={#1}},%
  overlay unbroken and last pre/.style={overlay unbroken pre={#1},overlay last pre={#1}},%
  overlay middle and last app/.style={overlay middle app={#1},overlay last app={#1}},%
  overlay middle and last pre/.style={overlay middle pre={#1},overlay last pre={#1}},%
  overlay first and middle app/.style={overlay first app={#1},overlay middle app={#1}},%
  overlay first and middle pre/.style={overlay first pre={#1},overlay middle pre={#1}},%
  %
  % skins:
  frame code app/.code={\appto\tcb@frame@code{#1}},%
  frame code pre/.code={\preto\tcb@frame@code{#1}},%
  interior titled code app/.code={\appto\tcb@interiortitled@code{#1}},%
  interior titled code pre/.code={\preto\tcb@interiortitled@code{#1}},%
  interior code app/.code={\appto\tcb@interior@code{#1}},%
  interior code pre/.code={\preto\tcb@interior@code{#1}},%
  segmentation code app/.code={\appto\tcb@segmentation@code{#1}},%
  segmentation code pre/.code={\preto\tcb@segmentation@code{#1}},%
  title code app/.code={\appto\tcb@title@code{#1}},%
  title code pre/.code={\preto\tcb@title@code{#1}},%
  %
  extras unbroken pre/.code={\preto\tcb@extras@unbroken{\tcbset{#1}}},%
  extras first pre/.code={\preto\tcb@extras@first{\tcbset{#1}}},%
  extras middle pre/.code={\preto\tcb@extras@middle{\tcbset{#1}}},%
  extras last pre/.code={\preto\tcb@extras@last{\tcbset{#1}}},%
  extras pre/.style={extras unbroken pre={#1},extras first pre={#1},extras middle pre={#1},extras last pre={#1}},%
  extras broken pre/.style={extras first pre={#1},extras middle pre={#1},extras last pre={#1}},%
  extras unbroken and first pre/.style={extras unbroken pre={#1},extras first pre={#1}},%
  extras unbroken and last pre/.style={extras unbroken pre={#1},extras last pre={#1}},%
  extras middle and last pre/.style={extras middle pre={#1},extras last pre={#1}},%
  extras first and middle pre/.style={extras first pre={#1},extras middle pre={#1}},%
  %
  underlay unbroken pre/.code={\preto\tcb@underlay@unbroken{#1}},%
  underlay first pre/.code={\preto\tcb@underlay@first{#1}},%
  underlay middle pre/.code={\preto\tcb@underlay@middle{#1}},%
  underlay last pre/.code={\preto\tcb@underlay@last{#1}},%
  underlay boxed title pre/.code={\preto\tcb@underlay@boxedtitle{#1}},%
  underlay pre/.style={underlay unbroken pre={#1},underlay first pre={#1},underlay middle pre={#1},underlay last pre={#1}},%
  underlay broken pre/.style={underlay first pre={#1},underlay middle pre={#1},underlay last pre={#1}},%
  underlay unbroken and first pre/.style={underlay unbroken pre={#1},underlay first pre={#1}},%
  underlay unbroken and last pre/.style={underlay unbroken pre={#1},underlay last pre={#1}},%
  underlay middle and last pre/.style={underlay middle pre={#1},underlay last pre={#1}},%
  underlay first and middle pre/.style={underlay first pre={#1},underlay middle pre={#1}},%
  finish unbroken pre/.code={\preto\tcb@finish@unbroken{#1}},%
  finish first pre/.code={\preto\tcb@finish@first{#1}},%
  finish middle pre/.code={\preto\tcb@finish@middle{#1}},%
  finish last pre/.code={\preto\tcb@finish@last{#1}},%
  finish pre/.style={finish unbroken pre={#1},finish first pre={#1},finish middle pre={#1},finish last pre={#1}},%
  finish broken pre/.style={finish first pre={#1},finish middle pre={#1},finish last pre={#1}},%
  finish unbroken and first pre/.style={finish unbroken pre={#1},finish first pre={#1}},%
  finish unbroken and last pre/.style={finish unbroken pre={#1},finish last pre={#1}},%
  finish middle and last pre/.style={finish middle pre={#1},finish last pre={#1}},%
  finish first and middle pre/.style={finish first pre={#1},finish middle pre={#1}},%
  %
  watermark@overlay app/.style={overlay app={\tcb@drawspec@watermark{#1}}},
  watermark@overlay pre/.style={overlay pre={\tcb@drawspec@watermark{#1}}},
  watermark@overlay@on app/.style n args={2}{overlay #1 app={\tcb@drawspec@watermark{#2}}},
  watermark@overlay@on pre/.style n args={2}{overlay #1 pred={\tcb@drawspec@watermark{#2}}},
  %
  watermark tikz app/.style={watermark@overlay app={fill@picture={#1}}},
  watermark tikz pre/.style={watermark@overlay pre={fill@picture={#1}}},
  watermark tikz app on/.style args={#1 is #2}{watermark@overlay@on app={#1}{fill@picture={#2}}},
  watermark tikz pre on/.style args={#1 is #2}{watermark@overlay@on pre={#1}{fill@picture={#2}}},
  watermark graphics app/.style={watermark@overlay app={fill@image={#1}}},
  watermark graphics pre/.style={watermark@overlay pre={fill@image={#1}}},
  watermark graphics app on/.style args={#1 is #2}{watermark@overlay@on app={#1}{fill@image={#2}}},
  watermark graphics pre on/.style args={#1 is #2}{watermark@overlay@on pre={#1}{fill@image={#2}}},
  watermark text app/.style={watermark@overlay app={fill@picture={\node[inner sep=0pt,align=flush center]{#1};}}},
  watermark text pre/.style={watermark@overlay pre={fill@picture={\node[inner sep=0pt,align=flush center]{#1};}}},
  watermark text app on/.style args={#1 is #2}{watermark@overlay@on app={#1}{fill@picture={\node[inner sep=0pt,align=flush center]{#2};}}},
  watermark text pre on/.style args={#1 is #2}{watermark@overlay@on pre={#1}{fill@picture={\node[inner sep=0pt,align=flush center]{#2};}}},
  %
  minted options app/.code={\appto\kvtcb@minted@options{,#1}},
  minted options pre/.code={\preto\kvtcb@minted@options{#1,}},
  listing options app/.code={\appto\kvtcb@listingoptions{,#1}},
  listing options pre/.code={\preto\kvtcb@listingoptions{#1,}},
}

\ExplSyntaxOn
\tcbset {
  __environment-app / .style~n~args = { 3 }
    {
      before~#1~app = { \begin{#2} #3 },
      after~#1~pre  = { \end{#2} }
    },
  environment~upper~app / .value~required,
  environment~lower~app / .value~required,
  environment~title~app / .value~required,
  environment~upper~app / .style = { __environment-app = {upper}{#1}{ } },
  environment~lower~app / .style = { __environment-app = {lower}{#1}{ } },
  environment~title~app / .style = { __environment-app = {title}{#1}{ } },
  environment~upper~args~app / .style~n~args = { 2 }{ __environment-app = {upper}{#1}{#2} },
  environment~lower~args~app / .style~n~args = { 2 }{ __environment-app = {lower}{#1}{#2} },
  environment~title~args~app / .style~n~args = { 2 }{ __environment-app = {title}{#1}{#2} },
  __environment-pre / .style~n~args = { 3 }
    {
      before~#1~pre = { \begin{#2} #3 },
      after~#1~app  = { \end{#2} }
    },
  environment~upper~pre / .value~required,
  environment~lower~pre / .value~required,
  environment~title~pre / .value~required,
  environment~upper~pre / .style = { __environment-pre = {upper}{#1}{ } },
  environment~lower~pre / .style = { __environment-pre = {lower}{#1}{ } },
  environment~title~pre / .style = { __environment-pre = {title}{#1}{ } },
  environment~upper~args~pre / .style~n~args = { 2 }{ __environment-pre = {upper}{#1}{#2} },
  environment~lower~args~pre / .style~n~args = { 2 }{ __environment-pre = {lower}{#1}{#2} },
  environment~title~args~pre / .style~n~args = { 2 }{ __environment-pre = {title}{#1}{#2} },
}
\ExplSyntaxOff

