+\RequirePackage{mdwkey}
+\if1%
+ \ifx\if@article\iftrue0
+ \else\ifx\chapter\@@undefined0
+ \else\ifx\chapter\relax0
+ \else1\fi\fi\fi
+ \def\mt@within{[chapter]}
+\else
+ \def\mt@within{}
+\fi
+\mkdef{mdwthm:opt}{within}{\def\mt@within{[#1]}}
+\mkdef{mdwthm:opt}{notwithin}*{\def\mt@within{}}
+\mkdef*{mdwthm:opt}{\PassOptionsToPackage{#1=#2}{amsthm}}
+\mkdef*{mdwthm:opt}*{\PassOptionsToPackage{#1}{amsthm}}
+\def\mt@opt#1{\mkparse{mdwthm:opt}{#1}}
+\DeclareOption*{\expandafter\mt@opt\expandafter{\CurrentOption}}
+\ProcessOptions