%%% singlepageempty.sty
%%% written by Nova de Hi
%%%
%%% if the document has only one page...
%%%
\ProvidesPackage{singlepageempty}[2022/03/19 v0.1]

\ExplSyntaxOn

\msg_new:nnn { onepage } { rerunwarn } 
{ Rerun~to~get~proper~result. }

\@ifclassloaded{memoir}{}{
	\RequirePackage{onepagem}
	\endinput
}

\AddToHook{env/document/end}{
	\int_case:nn { \thesheetsequence }
	{
		{ 0 } { \msg_warning:nn { onepage } { rerunwarn } }
		{ 1 } { \thispagestyle { empty } }
	}
}

\ExplSyntaxOff