%% The LaTeX package tcolorbox - version 4.42 (2020/10/09)
%% tcbxparse.code.tex: Code for xparse features
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2020 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{4.42}

\RequirePackage{xparse}[2013/12/31]

\tcbset{%
  IfNoValueTF/.code n args={3}{\IfNoValueTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  IfNoValueT/.code n args={2}{\IfNoValueT{#1}{\pgfkeysalso{#2}}},
  IfNoValueF/.code n args={2}{\IfNoValueF{#1}{\pgfkeysalso{#2}}},
  IfValueTF/.code n args={3}{\IfValueTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  IfValueT/.code n args={2}{\IfValueT{#1}{\pgfkeysalso{#2}}},
  IfValueF/.code n args={2}{\IfValueF{#1}{\pgfkeysalso{#2}}},
  IfBooleanTF/.code n args={3}{\IfBooleanTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  IfBooleanT/.code n args={2}{\IfBooleanT{#1}{\pgfkeysalso{#2}}},
  IfBooleanF/.code n args={2}{\IfBooleanF{#1}{\pgfkeysalso{#2}}},
  verbatim/.style={fontupper=\ttfamily,nobeforeafter,tcbox raise base,top=0pt,bottom=0pt,left=1mm,right=1mm,boxrule=0.3mm}
}

%-- tcolorbox --
\long\def\tcb@New@TColorBox#1#2#3{%
  \tcb@newenvironment{#1}{#2}{\tcolorbox[#3,options@for=#1]}{\endtcolorbox}}

\def\DeclareTColorBox{%
  \let\tcb@newenvironment\DeclareDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\NewTColorBox{%
  \let\tcb@newenvironment\NewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\RenewTColorBox{%
  \let\tcb@newenvironment\RenewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\ProvideTColorBox{%
  \let\tcb@newenvironment\ProvideDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

%-- tcolorbox (total) --
\long\def\tcb@New@TotalTColorBox#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\begin{tcolorbox}[#3,options@for=#1]#4\end{tcolorbox}}}

\def\DeclareTotalTColorBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\NewTotalTColorBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\RenewTotalTColorBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\ProvideTotalTColorBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

%-- tcbox --
\long\def\tcb@New@TCBox#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbox[#3,options@for=#1]}}

\def\DeclareTCBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\NewTCBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\RenewTCBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\ProvideTCBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

%-- tcbox (total) --
\long\def\tcb@New@TotalTCBox#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbox[#3,options@for=#1]{#4}}}

\def\DeclareTotalTCBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\NewTotalTCBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\RenewTotalTCBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\ProvideTotalTCBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\DeclareTotalTCBox{\tcboxverb}{ O{} v }{verbatim,#1}{#2}

%-- tcboxfit --
\long\def\tcb@New@TCBoxFit#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcboxfit[#3,options@for=#1]}}

\def\DeclareTCBoxFit{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\NewTCBoxFit{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\RenewTCBoxFit{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\ProvideTCBoxFit{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\long\def\tcb@New@TotalTCBoxFit#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcboxfit[#3,options@for=#1]{#4}}}

\def\DeclareTotalTCBoxFit{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\NewTotalTCBoxFit{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\RenewTotalTCBoxFit{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\ProvideTotalTCBoxFit{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}


%-- tcblisting --
\long\def\tcb@New@TCBListing#1#2#3{%
  \tcb@newenvironment{#1}{#2}{\tcblisting{#3,options@for=#1}}{\endtcblisting}}

\def\DeclareTCBListing{%
  \let\tcb@newenvironment\DeclareDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\NewTCBListing{%
  \let\tcb@newenvironment\NewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\RenewTCBListing{%
  \let\tcb@newenvironment\RenewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\ProvideTCBListing{%
  \let\tcb@newenvironment\ProvideDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

%-- tcbinputlisting --
\long\def\tcb@New@TCBInputListing#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbinputlisting{#3,options@for=#1}}%
}

\def\DeclareTCBInputListing{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\NewTCBInputListing{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\RenewTCBInputListing{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\ProvideTCBInputListing{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}


%-- sidebyside --

\def\tcb@sbs@content@none{\tcb@sbs@text@left\tcblower\tcb@sbs@text@right}
\def\tcb@sbs@content@left{\box\tcb@upperbox\tcblower\tcb@sbs@text@right}
\def\tcb@sbs@content@right{\tcb@sbs@text@left\tcblower\box\tcb@lowerbox}
\def\tcb@sbs@content@both{\box\tcb@upperbox\tcblower\box\tcb@lowerbox}

\def\tcb@sbs@save@upper{%
  \sbox{\tcb@upperbox}{\color{tcbcolupper}\kvtcb@fontupper\kvtcb@halignupper\tcb@insert@before@upper\tcb@sbs@text@left\tcb@insert@after@upper}%
}
\def\tcb@sbs@save@lower{%
  \sbox{\tcb@lowerbox}{\color{tcbcollower}\kvtcb@fontlower\kvtcb@halignlower\tcb@insert@before@lower\tcb@sbs@text@right\tcb@insert@after@lower}%
}

\tcbset{%
  sidebyside adapt/.is choice,
  sidebyside adapt/none/.style={%
    sidebyside@adapt@process/.style={%
      code={\let\tcb@sbs@content\tcb@sbs@content@none},
    }%
  },
  sidebyside adapt/left/.style={%
    sidebyside@adapt@process/.style={%
      code={\tcb@sbs@save@upper\let\tcb@sbs@content\tcb@sbs@content@left},
      lefthand width=\wd\tcb@upperbox,
    }%
  },
  sidebyside adapt/right/.style={%
    sidebyside@adapt@process/.style={%
      code={\tcb@sbs@save@lower\let\tcb@sbs@content\tcb@sbs@content@right},
      righthand width=\wd\tcb@lowerbox,
    }%
  },
  sidebyside adapt/both/.style={%
    sidebyside@adapt@process/.style={%
      code={\tcb@sbs@save@upper\tcb@sbs@save@lower\let\tcb@sbs@content\tcb@sbs@content@both},
      text width=\wd\tcb@upperbox+\kvtcb@sbs@gap+\wd\tcb@lowerbox,
      lefthand width=\wd\tcb@upperbox,
    }%
  },
  %
  sidebyside switch/.is choice,
  sidebyside switch/true/.style={%
    sidebyside@switch/.code={%
      \tcb@swap{\tcb@sbs@text@left}{\tcb@sbs@text@right}
    }%
  },
  sidebyside switch/false/.style={%
    sidebyside@switch/.style=%
  },
  sidebyside switch/.default=true
}


\DeclareTotalTColorBox{\tcbsidebyside}{ +O{} +m +m }{%
  code={\long\def\tcb@sbs@text@left{#2}\long\def\tcb@sbs@text@right{#3}},%
  #1,%
  sidebyside,%
  sidebyside@switch,sidebyside@adapt@process%
}{\tcb@sbs@content}


\tcbset{%
  reset@xparse/.style={%
    sidebyside adapt=none,sidebyside switch=false,%
  },
  initialize@reset=reset@xparse,
}
