%%
%% This is file `expl3-code.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% expl3.dtx  (with options: `package')
%% l3bootstrap.dtx  (with options: `package')
%% l3names.dtx  (with options: `package,tex')
%% l3basics.dtx  (with options: `package')
%% l3expan.dtx  (with options: `package')
%% l3quark.dtx  (with options: `package')
%% l3tl.dtx  (with options: `package')
%% l3str.dtx  (with options: `package')
%% l3seq.dtx  (with options: `package')
%% l3int.dtx  (with options: `package')
%% l3flag.dtx  (with options: `package')
%% l3prg.dtx  (with options: `package')
%% l3sys.dtx  (with options: `package,tex')
%% l3clist.dtx  (with options: `package')
%% l3token.dtx  (with options: `package,tex')
%% l3prop.dtx  (with options: `package')
%% l3msg.dtx  (with options: `package')
%% l3file.dtx  (with options: `package')
%% l3skip.dtx  (with options: `package')
%% l3keys.dtx  (with options: `package')
%% l3intarray.dtx  (with options: `package')
%% l3fp.dtx  (with options: `package')
%% l3fp-aux.dtx  (with options: `package')
%% l3fp-traps.dtx  (with options: `package')
%% l3fp-round.dtx  (with options: `package')
%% l3fp-parse.dtx  (with options: `package')
%% l3fp-assign.dtx  (with options: `package')
%% l3fp-logic.dtx  (with options: `package')
%% l3fp-basics.dtx  (with options: `package')
%% l3fp-extended.dtx  (with options: `package')
%% l3fp-expo.dtx  (with options: `package')
%% l3fp-trig.dtx  (with options: `package')
%% l3fp-convert.dtx  (with options: `package')
%% l3fp-random.dtx  (with options: `package')
%% l3fparray.dtx  (with options: `package')
%% l3cctab.dtx  (with options: `package')
%% l3sort.dtx  (with options: `package')
%% l3str-convert.dtx  (with options: `package')
%% l3tl-analysis.dtx  (with options: `package')
%% l3regex.dtx  (with options: `package')
%% l3box.dtx  (with options: `package')
%% l3color.dtx  (with options: `package')
%% l3pdf.dtx  (with options: `package')
%% l3coffins.dtx  (with options: `package')
%% l3luatex.dtx  (with options: `package,tex')
%% l3unicode.dtx  (with options: `package')
%% l3text.dtx  (with options: `package')
%% l3text-case.dtx  (with options: `package')
%% l3text-purify.dtx  (with options: `package')
%% l3candidates.dtx  (with options: `package')
%% l3legacy.dtx  (with options: `package')
%% l3deprecation.dtx  (with options: `package,kernel')
%% 
%% Copyright (C) 1990-2021 The LaTeX Project
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    https://www.latex-project.org/lppl.txt
%% 
%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: expl3.dtx
\def\ExplFileDate{2021-02-18}%
\begingroup
  \def\next{\endgroup}%
  \expandafter\ifx\csname PackageError\endcsname\relax
    \begingroup
      \def\next{\endgroup\endgroup}%
      \def\PackageError#1#2#3%
        {%
          \endgroup
          \errhelp{#3}%
          \errmessage{#1 Error: #2!}%
        }%
  \fi
  \expandafter\ifx\csname ExplLoaderFileDate\endcsname\relax
    \def\next
      {%
        \PackageError{expl3}{No expl3 loader detected}
          {%
            You have attempted to use the expl3 code directly rather than using
            the correct loader. Loading of expl3 will abort.
          }%
        \endgroup
        \endinput
      }
  \else
    \ifx\ExplLoaderFileDate\ExplFileDate
    \else
      \def\next
        {%
          \PackageError{expl3}{Mismatched expl3 files detected}
            {%
              You have attempted to load expl3 with mismatched files:
              probably you have one or more files 'locally installed' which
              are in conflict. Loading of expl3 will abort.
            }%
          \endgroup
          \endinput
        }%
    \fi
\fi
\next
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname ver@expl3-code.tex\endcsname\relax
  \expandafter\edef\csname ver@expl3-code.tex\endcsname
    {%
      \ExplFileDate\space
      L3 programming layer
    }%
\else
  \expandafter\endinput
\fi
\immediate\write-1 %
  {%
    Package: expl3
      \ExplFileDate\space
      L3 programming layer (code)%
  }%
%% File: l3bootstrap.dtx
\begingroup
  \expandafter\ifx\csname directlua\endcsname\relax
  \else
    \directlua{%
      local i
      local t = { }
      for _,i in pairs(tex.extraprimitives("luatex")) do
        if string.match(i,"^U") then
          if not string.match(i,"^Uchar$") then %$
            table.insert(t,i)
          end
        end
      end
      tex.enableprimitives("", t)
    }%
  \fi
\endgroup
\begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname pdfstrcmp\endcsname\relax
  \let\pdfstrcmp\strcmp
\fi
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
\else
  \ifnum\luatexversion<110 %
  \else
    \begingroup\expandafter\expandafter\expandafter\endgroup
    \expandafter\ifx\csname newcatcodetable\endcsname\relax
      \input{ltluatex}%
    \fi
    \begingroup\edef\ignored{%
      \expandafter\noexpand\csname prg_return_true:\endcsname
      \expandafter\noexpand\csname prg_return_false:\endcsname
    }\endgroup
    \directlua{require("expl3")}%
    \ifnum 0%
      \directlua{
        if status.ini_version then
          tex.write("1")
        end
      }>0 %
      \everyjob\expandafter{%
        \the\expandafter\everyjob
        \csname\detokenize{lua_now:n}\endcsname{require("expl3")}%
      }%
    \fi
  \fi
\fi
\begingroup
  \def\next{\endgroup}%
  \def\ShortText{Required primitives not found}%
  \def\LongText%
    {%
      LaTeX3 requires the e-TeX primitives and additional functionality as
      described in the README file.
      \LineBreak
      These are available in the engines\LineBreak
      - pdfTeX v1.40\LineBreak
      - XeTeX v0.99992\LineBreak
      - LuaTeX v1.10\LineBreak
      - e-(u)pTeX mid-2012\LineBreak
      or later.\LineBreak
      \LineBreak
    }%
  \ifnum0%
    \expandafter\ifx\csname pdfstrcmp\endcsname\relax
    \else
      \expandafter\ifx\csname pdftexversion\endcsname\relax
        \expandafter\ifx\csname Ucharcat\endcsname\relax
          \expandafter\ifx\csname kanjiskip\endcsname\relax
          \else
            1%
          \fi
        \else
          1%
        \fi
      \else
        \ifnum\pdftexversion<140 \else 1\fi
      \fi
    \fi
    \expandafter\ifx\csname directlua\endcsname\relax
    \else
      \ifnum\luatexversion<110 \else 1\fi
    \fi
    =0 %
      \newlinechar`\^^J %
      \def\LineBreak{\noexpand\MessageBreak}%
      \expandafter\ifx\csname PackageError\endcsname\relax
        \def\LineBreak{^^J}%
        \def\PackageError#1#2#3%
          {%
            \errhelp{#3}%
            \errmessage{#1 Error: #2}%
          }%
      \fi
      \edef\next
        {%
          \noexpand\PackageError{expl3}{\ShortText}
            {\LongText Loading of expl3 will abort!}%
          \endgroup
          \noexpand\endinput
        }%
  \fi
\next
\begingroup
  \def\@tempa{LaTeX2e}%
  \def\next{}%
  \ifx\fmtname\@tempa
    \expandafter\ifx\csname extrafloats\endcsname\relax
      \def\next
        {%
          \RequirePackage{etex}%
          \csname reserveinserts\endcsname{32}%
        }%
    \fi
  \fi
\expandafter\endgroup
\next
\protected\edef\ExplSyntaxOff
  {%
    \protected\def\noexpand\ExplSyntaxOff{}%
    \catcode   9 = \the\catcode   9\relax
    \catcode  32 = \the\catcode  32\relax
    \catcode  34 = \the\catcode  34\relax
    \catcode  38 = \the\catcode  38\relax
    \catcode  58 = \the\catcode  58\relax
    \catcode  94 = \the\catcode  94\relax
    \catcode  95 = \the\catcode  95\relax
    \catcode 124 = \the\catcode 124\relax
    \catcode 126 = \the\catcode 126\relax
    \endlinechar = \the\endlinechar\relax
    \chardef\csname\detokenize{l__kernel_expl_bool}\endcsname = 0\relax
  }%
\catcode 9   = 9\relax
\catcode 32  = 9\relax
\catcode 34  = 12\relax
\catcode 38 =  4\relax
\catcode 58  = 11\relax
\catcode 94  = 7\relax
\catcode 95  = 11\relax
\catcode 124 = 12\relax
\catcode 126 = 10\relax
\endlinechar = 32\relax
\chardef\l__kernel_expl_bool = 1\relax
\protected \def \ExplSyntaxOn
  {
    \bool_if:NF \l__kernel_expl_bool
      {
        \cs_set_protected:Npx \ExplSyntaxOff
          {
            \char_set_catcode:nn { 9 }   { \char_value_catcode:n { 9 } }
            \char_set_catcode:nn { 32 }  { \char_value_catcode:n { 32 } }
            \char_set_catcode:nn { 34 }  { \char_value_catcode:n { 34 } }
            \char_set_catcode:nn { 38 }  { \char_value_catcode:n { 38 } }
            \char_set_catcode:nn { 58 }  { \char_value_catcode:n { 58 } }
            \char_set_catcode:nn { 94 }  { \char_value_catcode:n { 94 } }
            \char_set_catcode:nn { 95 }  { \char_value_catcode:n { 95 } }
            \char_set_catcode:nn { 124 } { \char_value_catcode:n { 124 } }
            \char_set_catcode:nn { 126 } { \char_value_catcode:n { 126 } }
            \tex_endlinechar:D =
              \tex_the:D \tex_endlinechar:D \scan_stop:
            \bool_set_false:N \l__kernel_expl_bool
            \cs_set_protected:Npn \ExplSyntaxOff { }
          }
      }
    \char_set_catcode_ignore:n           { 9 }   % tab
    \char_set_catcode_ignore:n           { 32 }  % space
    \char_set_catcode_other:n            { 34 }  % double quote
    \char_set_catcode_alignment:n        { 38 }  % ampersand
    \char_set_catcode_letter:n           { 58 }  % colon
    \char_set_catcode_math_superscript:n { 94 }  % circumflex
    \char_set_catcode_letter:n           { 95 }  % underscore
    \char_set_catcode_other:n            { 124 } % pipe
    \char_set_catcode_space:n            { 126 } % tilde
    \tex_endlinechar:D = 32 \scan_stop:
    \bool_set_true:N \l__kernel_expl_bool
  }
%% File: l3names.dtx
\let \tex_global:D \global
\let \tex_let:D    \let
\begingroup
  \long \def \__kernel_primitive:NN #1#2
    { \tex_global:D \tex_let:D #2 #1 }
  \__kernel_primitive:NN \                      \tex_space:D
  \__kernel_primitive:NN \/                     \tex_italiccorrection:D
  \__kernel_primitive:NN \-                     \tex_hyphen:D
  \__kernel_primitive:NN \above                 \tex_above:D
  \__kernel_primitive:NN \abovedisplayshortskip \tex_abovedisplayshortskip:D
  \__kernel_primitive:NN \abovedisplayskip      \tex_abovedisplayskip:D
  \__kernel_primitive:NN \abovewithdelims       \tex_abovewithdelims:D
  \__kernel_primitive:NN \accent                \tex_accent:D
  \__kernel_primitive:NN \adjdemerits           \tex_adjdemerits:D
  \__kernel_primitive:NN \advance               \tex_advance:D
  \__kernel_primitive:NN \afterassignment       \tex_afterassignment:D
  \__kernel_primitive:NN \aftergroup            \tex_aftergroup:D
  \__kernel_primitive:NN \atop                  \tex_atop:D
  \__kernel_primitive:NN \atopwithdelims        \tex_atopwithdelims:D
  \__kernel_primitive:NN \badness               \tex_badness:D
  \__kernel_primitive:NN \baselineskip          \tex_baselineskip:D
  \__kernel_primitive:NN \batchmode             \tex_batchmode:D
  \__kernel_primitive:NN \begingroup            \tex_begingroup:D
  \__kernel_primitive:NN \belowdisplayshortskip \tex_belowdisplayshortskip:D
  \__kernel_primitive:NN \belowdisplayskip      \tex_belowdisplayskip:D
  \__kernel_primitive:NN \binoppenalty          \tex_binoppenalty:D
  \__kernel_primitive:NN \botmark               \tex_botmark:D
  \__kernel_primitive:NN \box                   \tex_box:D
  \__kernel_primitive:NN \boxmaxdepth           \tex_boxmaxdepth:D
  \__kernel_primitive:NN \brokenpenalty         \tex_brokenpenalty:D
  \__kernel_primitive:NN \catcode               \tex_catcode:D
  \__kernel_primitive:NN \char                  \tex_char:D
  \__kernel_primitive:NN \chardef               \tex_chardef:D
  \__kernel_primitive:NN \cleaders              \tex_cleaders:D
  \__kernel_primitive:NN \closein               \tex_closein:D
  \__kernel_primitive:NN \closeout              \tex_closeout:D
  \__kernel_primitive:NN \clubpenalty           \tex_clubpenalty:D
  \__kernel_primitive:NN \copy                  \tex_copy:D
  \__kernel_primitive:NN \count                 \tex_count:D
  \__kernel_primitive:NN \countdef              \tex_countdef:D
  \__kernel_primitive:NN \cr                    \tex_cr:D
  \__kernel_primitive:NN \crcr                  \tex_crcr:D
  \__kernel_primitive:NN \csname                \tex_csname:D
  \__kernel_primitive:NN \day                   \tex_day:D
  \__kernel_primitive:NN \deadcycles            \tex_deadcycles:D
  \__kernel_primitive:NN \def                   \tex_def:D
  \__kernel_primitive:NN \defaulthyphenchar     \tex_defaulthyphenchar:D
  \__kernel_primitive:NN \defaultskewchar       \tex_defaultskewchar:D
  \__kernel_primitive:NN \delcode               \tex_delcode:D
  \__kernel_primitive:NN \delimiter             \tex_delimiter:D
  \__kernel_primitive:NN \delimiterfactor       \tex_delimiterfactor:D
  \__kernel_primitive:NN \delimitershortfall    \tex_delimitershortfall:D
  \__kernel_primitive:NN \dimen                 \tex_dimen:D
  \__kernel_primitive:NN \dimendef              \tex_dimendef:D
  \__kernel_primitive:NN \discretionary         \tex_discretionary:D
  \__kernel_primitive:NN \displayindent         \tex_displayindent:D
  \__kernel_primitive:NN \displaylimits         \tex_displaylimits:D
  \__kernel_primitive:NN \displaystyle          \tex_displaystyle:D
  \__kernel_primitive:NN \displaywidowpenalty   \tex_displaywidowpenalty:D
  \__kernel_primitive:NN \displaywidth          \tex_displaywidth:D
  \__kernel_primitive:NN \divide                \tex_divide:D
  \__kernel_primitive:NN \doublehyphendemerits  \tex_doublehyphendemerits:D
  \__kernel_primitive:NN \dp                    \tex_dp:D
  \__kernel_primitive:NN \dump                  \tex_dump:D
  \__kernel_primitive:NN \edef                  \tex_edef:D
  \__kernel_primitive:NN \else                  \tex_else:D
  \__kernel_primitive:NN \emergencystretch      \tex_emergencystretch:D
  \__kernel_primitive:NN \end                   \tex_end:D
  \__kernel_primitive:NN \endcsname             \tex_endcsname:D
  \__kernel_primitive:NN \endgroup              \tex_endgroup:D
  \__kernel_primitive:NN \endinput              \tex_endinput:D
  \__kernel_primitive:NN \endlinechar           \tex_endlinechar:D
  \__kernel_primitive:NN \eqno                  \tex_eqno:D
  \__kernel_primitive:NN \errhelp               \tex_errhelp:D
  \__kernel_primitive:NN \errmessage            \tex_errmessage:D
  \__kernel_primitive:NN \errorcontextlines     \tex_errorcontextlines:D
  \__kernel_primitive:NN \errorstopmode         \tex_errorstopmode:D
  \__kernel_primitive:NN \escapechar            \tex_escapechar:D
  \__kernel_primitive:NN \everycr               \tex_everycr:D
  \__kernel_primitive:NN \everydisplay          \tex_everydisplay:D
  \__kernel_primitive:NN \everyhbox             \tex_everyhbox:D
  \__kernel_primitive:NN \everyjob              \tex_everyjob:D
  \__kernel_primitive:NN \everymath             \tex_everymath:D
  \__kernel_primitive:NN \everypar              \tex_everypar:D
  \__kernel_primitive:NN \everyvbox             \tex_everyvbox:D
  \__kernel_primitive:NN \exhyphenpenalty       \tex_exhyphenpenalty:D
  \__kernel_primitive:NN \expandafter           \tex_expandafter:D
  \__kernel_primitive:NN \fam                   \tex_fam:D
  \__kernel_primitive:NN \fi                    \tex_fi:D
  \__kernel_primitive:NN \finalhyphendemerits   \tex_finalhyphendemerits:D
  \__kernel_primitive:NN \firstmark             \tex_firstmark:D
  \__kernel_primitive:NN \floatingpenalty       \tex_floatingpenalty:D
  \__kernel_primitive:NN \font                  \tex_font:D
  \__kernel_primitive:NN \fontdimen             \tex_fontdimen:D
  \__kernel_primitive:NN \fontname              \tex_fontname:D
  \__kernel_primitive:NN \futurelet             \tex_futurelet:D
  \__kernel_primitive:NN \gdef                  \tex_gdef:D
  \__kernel_primitive:NN \global                \tex_global:D
  \__kernel_primitive:NN \globaldefs            \tex_globaldefs:D
  \__kernel_primitive:NN \halign                \tex_halign:D
  \__kernel_primitive:NN \hangafter             \tex_hangafter:D
  \__kernel_primitive:NN \hangindent            \tex_hangindent:D
  \__kernel_primitive:NN \hbadness              \tex_hbadness:D
  \__kernel_primitive:NN \hbox                  \tex_hbox:D
  \__kernel_primitive:NN \hfil                  \tex_hfil:D
  \__kernel_primitive:NN \hfill                 \tex_hfill:D
  \__kernel_primitive:NN \hfilneg               \tex_hfilneg:D
  \__kernel_primitive:NN \hfuzz                 \tex_hfuzz:D
  \__kernel_primitive:NN \hoffset               \tex_hoffset:D
  \__kernel_primitive:NN \holdinginserts        \tex_holdinginserts:D
  \__kernel_primitive:NN \hrule                 \tex_hrule:D
  \__kernel_primitive:NN \hsize                 \tex_hsize:D
  \__kernel_primitive:NN \hskip                 \tex_hskip:D
  \__kernel_primitive:NN \hss                   \tex_hss:D
  \__kernel_primitive:NN \ht                    \tex_ht:D
  \__kernel_primitive:NN \hyphenation           \tex_hyphenation:D
  \__kernel_primitive:NN \hyphenchar            \tex_hyphenchar:D
  \__kernel_primitive:NN \hyphenpenalty         \tex_hyphenpenalty:D
  \__kernel_primitive:NN \if                    \tex_if:D
  \__kernel_primitive:NN \ifcase                \tex_ifcase:D
  \__kernel_primitive:NN \ifcat                 \tex_ifcat:D
  \__kernel_primitive:NN \ifdim                 \tex_ifdim:D
  \__kernel_primitive:NN \ifeof                 \tex_ifeof:D
  \__kernel_primitive:NN \iffalse               \tex_iffalse:D
  \__kernel_primitive:NN \ifhbox                \tex_ifhbox:D
  \__kernel_primitive:NN \ifhmode               \tex_ifhmode:D
  \__kernel_primitive:NN \ifinner               \tex_ifinner:D
  \__kernel_primitive:NN \ifmmode               \tex_ifmmode:D
  \__kernel_primitive:NN \ifnum                 \tex_ifnum:D
  \__kernel_primitive:NN \ifodd                 \tex_ifodd:D
  \__kernel_primitive:NN \iftrue                \tex_iftrue:D
  \__kernel_primitive:NN \ifvbox                \tex_ifvbox:D
  \__kernel_primitive:NN \ifvmode               \tex_ifvmode:D
  \__kernel_primitive:NN \ifvoid                \tex_ifvoid:D
  \__kernel_primitive:NN \ifx                   \tex_ifx:D
  \__kernel_primitive:NN \ignorespaces          \tex_ignorespaces:D
  \__kernel_primitive:NN \immediate             \tex_immediate:D
  \__kernel_primitive:NN \indent                \tex_indent:D
  \__kernel_primitive:NN \input                 \tex_input:D
  \__kernel_primitive:NN \inputlineno           \tex_inputlineno:D
  \__kernel_primitive:NN \insert                \tex_insert:D
  \__kernel_primitive:NN \insertpenalties       \tex_insertpenalties:D
  \__kernel_primitive:NN \interlinepenalty      \tex_interlinepenalty:D
  \__kernel_primitive:NN \jobname               \tex_jobname:D
  \__kernel_primitive:NN \kern                  \tex_kern:D
  \__kernel_primitive:NN \language              \tex_language:D
  \__kernel_primitive:NN \lastbox               \tex_lastbox:D
  \__kernel_primitive:NN \lastkern              \tex_lastkern:D
  \__kernel_primitive:NN \lastpenalty           \tex_lastpenalty:D
  \__kernel_primitive:NN \lastskip              \tex_lastskip:D
  \__kernel_primitive:NN \lccode                \tex_lccode:D
  \__kernel_primitive:NN \leaders               \tex_leaders:D
  \__kernel_primitive:NN \left                  \tex_left:D
  \__kernel_primitive:NN \lefthyphenmin         \tex_lefthyphenmin:D
  \__kernel_primitive:NN \leftskip              \tex_leftskip:D
  \__kernel_primitive:NN \leqno                 \tex_leqno:D
  \__kernel_primitive:NN \let                   \tex_let:D
  \__kernel_primitive:NN \limits                \tex_limits:D
  \__kernel_primitive:NN \linepenalty           \tex_linepenalty:D
  \__kernel_primitive:NN \lineskip              \tex_lineskip:D
  \__kernel_primitive:NN \lineskiplimit         \tex_lineskiplimit:D
  \__kernel_primitive:NN \long                  \tex_long:D
  \__kernel_primitive:NN \looseness             \tex_looseness:D
  \__kernel_primitive:NN \lower                 \tex_lower:D
  \__kernel_primitive:NN \lowercase             \tex_lowercase:D
  \__kernel_primitive:NN \mag                   \tex_mag:D
  \__kernel_primitive:NN \mark                  \tex_mark:D
  \__kernel_primitive:NN \mathaccent            \tex_mathaccent:D
  \__kernel_primitive:NN \mathbin               \tex_mathbin:D
  \__kernel_primitive:NN \mathchar              \tex_mathchar:D
  \__kernel_primitive:NN \mathchardef           \tex_mathchardef:D
  \__kernel_primitive:NN \mathchoice            \tex_mathchoice:D
  \__kernel_primitive:NN \mathclose             \tex_mathclose:D
  \__kernel_primitive:NN \mathcode              \tex_mathcode:D
  \__kernel_primitive:NN \mathinner             \tex_mathinner:D
  \__kernel_primitive:NN \mathop                \tex_mathop:D
  \__kernel_primitive:NN \mathopen              \tex_mathopen:D
  \__kernel_primitive:NN \mathord               \tex_mathord:D
  \__kernel_primitive:NN \mathpunct             \tex_mathpunct:D
  \__kernel_primitive:NN \mathrel               \tex_mathrel:D
  \__kernel_primitive:NN \mathsurround          \tex_mathsurround:D
  \__kernel_primitive:NN \maxdeadcycles         \tex_maxdeadcycles:D
  \__kernel_primitive:NN \maxdepth              \tex_maxdepth:D
  \__kernel_primitive:NN \meaning               \tex_meaning:D
  \__kernel_primitive:NN \medmuskip             \tex_medmuskip:D
  \__kernel_primitive:NN \message               \tex_message:D
  \__kernel_primitive:NN \mkern                 \tex_mkern:D
  \__kernel_primitive:NN \month                 \tex_month:D
  \__kernel_primitive:NN \moveleft              \tex_moveleft:D
  \__kernel_primitive:NN \moveright             \tex_moveright:D
  \__kernel_primitive:NN \mskip                 \tex_mskip:D
  \__kernel_primitive:NN \multiply              \tex_multiply:D
  \__kernel_primitive:NN \muskip                \tex_muskip:D
  \__kernel_primitive:NN \muskipdef             \tex_muskipdef:D
  \__kernel_primitive:NN \newlinechar           \tex_newlinechar:D
  \__kernel_primitive:NN \noalign               \tex_noalign:D
  \__kernel_primitive:NN \noboundary            \tex_noboundary:D
  \__kernel_primitive:NN \noexpand              \tex_noexpand:D
  \__kernel_primitive:NN \noindent              \tex_noindent:D
  \__kernel_primitive:NN \nolimits              \tex_nolimits:D
  \__kernel_primitive:NN \nonscript             \tex_nonscript:D
  \__kernel_primitive:NN \nonstopmode           \tex_nonstopmode:D
  \__kernel_primitive:NN \nulldelimiterspace    \tex_nulldelimiterspace:D
  \__kernel_primitive:NN \nullfont              \tex_nullfont:D
  \__kernel_primitive:NN \number                \tex_number:D
  \__kernel_primitive:NN \omit                  \tex_omit:D
  \__kernel_primitive:NN \openin                \tex_openin:D
  \__kernel_primitive:NN \openout               \tex_openout:D
  \__kernel_primitive:NN \or                    \tex_or:D
  \__kernel_primitive:NN \outer                 \tex_outer:D
  \__kernel_primitive:NN \output                \tex_output:D
  \__kernel_primitive:NN \outputpenalty         \tex_outputpenalty:D
  \__kernel_primitive:NN \over                  \tex_over:D
  \__kernel_primitive:NN \overfullrule          \tex_overfullrule:D
  \__kernel_primitive:NN \overline              \tex_overline:D
  \__kernel_primitive:NN \overwithdelims        \tex_overwithdelims:D
  \__kernel_primitive:NN \pagedepth             \tex_pagedepth:D
  \__kernel_primitive:NN \pagefilllstretch      \tex_pagefilllstretch:D
  \__kernel_primitive:NN \pagefillstretch       \tex_pagefillstretch:D
  \__kernel_primitive:NN \pagefilstretch        \tex_pagefilstretch:D
  \__kernel_primitive:NN \pagegoal              \tex_pagegoal:D
  \__kernel_primitive:NN \pageshrink            \tex_pageshrink:D
  \__kernel_primitive:NN \pagestretch           \tex_pagestretch:D
  \__kernel_primitive:NN \pagetotal             \tex_pagetotal:D
  \__kernel_primitive:NN \par                   \tex_par:D
  \__kernel_primitive:NN \parfillskip           \tex_parfillskip:D
  \__kernel_primitive:NN \parindent             \tex_parindent:D
  \__kernel_primitive:NN \parshape              \tex_parshape:D
  \__kernel_primitive:NN \parskip               \tex_parskip:D
  \__kernel_primitive:NN \patterns              \tex_patterns:D
  \__kernel_primitive:NN \pausing               \tex_pausing:D
  \__kernel_primitive:NN \penalty               \tex_penalty:D
  \__kernel_primitive:NN \postdisplaypenalty    \tex_postdisplaypenalty:D
  \__kernel_primitive:NN \predisplaypenalty     \tex_predisplaypenalty:D
  \__kernel_primitive:NN \predisplaysize        \tex_predisplaysize:D
  \__kernel_primitive:NN \pretolerance          \tex_pretolerance:D
  \__kernel_primitive:NN \prevdepth             \tex_prevdepth:D
  \__kernel_primitive:NN \prevgraf              \tex_prevgraf:D
  \__kernel_primitive:NN \radical               \tex_radical:D
  \__kernel_primitive:NN \raise                 \tex_raise:D
  \__kernel_primitive:NN \read                  \tex_read:D
  \__kernel_primitive:NN \relax                 \tex_relax:D
  \__kernel_primitive:NN \relpenalty            \tex_relpenalty:D
  \__kernel_primitive:NN \right                 \tex_right:D
  \__kernel_primitive:NN \righthyphenmin        \tex_righthyphenmin:D
  \__kernel_primitive:NN \rightskip             \tex_rightskip:D
  \__kernel_primitive:NN \romannumeral          \tex_romannumeral:D
  \__kernel_primitive:NN \scriptfont            \tex_scriptfont:D
  \__kernel_primitive:NN \scriptscriptfont      \tex_scriptscriptfont:D
  \__kernel_primitive:NN \scriptscriptstyle     \tex_scriptscriptstyle:D
  \__kernel_primitive:NN \scriptspace           \tex_scriptspace:D
  \__kernel_primitive:NN \scriptstyle           \tex_scriptstyle:D
  \__kernel_primitive:NN \scrollmode            \tex_scrollmode:D
  \__kernel_primitive:NN \setbox                \tex_setbox:D
  \__kernel_primitive:NN \setlanguage           \tex_setlanguage:D
  \__kernel_primitive:NN \sfcode                \tex_sfcode:D
  \__kernel_primitive:NN \shipout               \tex_shipout:D
  \__kernel_primitive:NN \show                  \tex_show:D
  \__kernel_primitive:NN \showbox               \tex_showbox:D
  \__kernel_primitive:NN \showboxbreadth        \tex_showboxbreadth:D
  \__kernel_primitive:NN \showboxdepth          \tex_showboxdepth:D
  \__kernel_primitive:NN \showlists             \tex_showlists:D
  \__kernel_primitive:NN \showthe               \tex_showthe:D
  \__kernel_primitive:NN \skewchar              \tex_skewchar:D
  \__kernel_primitive:NN \skip                  \tex_skip:D
  \__kernel_primitive:NN \skipdef               \tex_skipdef:D
  \__kernel_primitive:NN \spacefactor           \tex_spacefactor:D
  \__kernel_primitive:NN \spaceskip             \tex_spaceskip:D
  \__kernel_primitive:NN \span                  \tex_span:D
  \__kernel_primitive:NN \special               \tex_special:D
  \__kernel_primitive:NN \splitbotmark          \tex_splitbotmark:D
  \__kernel_primitive:NN \splitfirstmark        \tex_splitfirstmark:D
  \__kernel_primitive:NN \splitmaxdepth         \tex_splitmaxdepth:D
  \__kernel_primitive:NN \splittopskip          \tex_splittopskip:D
  \__kernel_primitive:NN \string                \tex_string:D
  \__kernel_primitive:NN \tabskip               \tex_tabskip:D
  \__kernel_primitive:NN \textfont              \tex_textfont:D
  \__kernel_primitive:NN \textstyle             \tex_textstyle:D
  \__kernel_primitive:NN \the                   \tex_the:D
  \__kernel_primitive:NN \thickmuskip           \tex_thickmuskip:D
  \__kernel_primitive:NN \thinmuskip            \tex_thinmuskip:D
  \__kernel_primitive:NN \time                  \tex_time:D
  \__kernel_primitive:NN \toks                  \tex_toks:D
  \__kernel_primitive:NN \toksdef               \tex_toksdef:D
  \__kernel_primitive:NN \tolerance             \tex_tolerance:D
  \__kernel_primitive:NN \topmark               \tex_topmark:D
  \__kernel_primitive:NN \topskip               \tex_topskip:D
  \__kernel_primitive:NN \tracingcommands       \tex_tracingcommands:D
  \__kernel_primitive:NN \tracinglostchars      \tex_tracinglostchars:D
  \__kernel_primitive:NN \tracingmacros         \tex_tracingmacros:D
  \__kernel_primitive:NN \tracingonline         \tex_tracingonline:D
  \__kernel_primitive:NN \tracingoutput         \tex_tracingoutput:D
  \__kernel_primitive:NN \tracingpages          \tex_tracingpages:D
  \__kernel_primitive:NN \tracingparagraphs     \tex_tracingparagraphs:D
  \__kernel_primitive:NN \tracingrestores       \tex_tracingrestores:D
  \__kernel_primitive:NN \tracingstats          \tex_tracingstats:D
  \__kernel_primitive:NN \uccode                \tex_uccode:D
  \__kernel_primitive:NN \uchyph                \tex_uchyph:D
  \__kernel_primitive:NN \underline             \tex_underline:D
  \__kernel_primitive:NN \unhbox                \tex_unhbox:D
  \__kernel_primitive:NN \unhcopy               \tex_unhcopy:D
  \__kernel_primitive:NN \unkern                \tex_unkern:D
  \__kernel_primitive:NN \unpenalty             \tex_unpenalty:D
  \__kernel_primitive:NN \unskip                \tex_unskip:D
  \__kernel_primitive:NN \unvbox                \tex_unvbox:D
  \__kernel_primitive:NN \unvcopy               \tex_unvcopy:D
  \__kernel_primitive:NN \uppercase             \tex_uppercase:D
  \__kernel_primitive:NN \vadjust               \tex_vadjust:D
  \__kernel_primitive:NN \valign                \tex_valign:D
  \__kernel_primitive:NN \vbadness              \tex_vbadness:D
  \__kernel_primitive:NN \vbox                  \tex_vbox:D
  \__kernel_primitive:NN \vcenter               \tex_vcenter:D
  \__kernel_primitive:NN \vfil                  \tex_vfil:D
  \__kernel_primitive:NN \vfill                 \tex_vfill:D
  \__kernel_primitive:NN \vfilneg               \tex_vfilneg:D
  \__kernel_primitive:NN \vfuzz                 \tex_vfuzz:D
  \__kernel_primitive:NN \voffset               \tex_voffset:D
  \__kernel_primitive:NN \vrule                 \tex_vrule:D
  \__kernel_primitive:NN \vsize                 \tex_vsize:D
  \__kernel_primitive:NN \vskip                 \tex_vskip:D
  \__kernel_primitive:NN \vsplit                \tex_vsplit:D
  \__kernel_primitive:NN \vss                   \tex_vss:D
  \__kernel_primitive:NN \vtop                  \tex_vtop:D
  \__kernel_primitive:NN \wd                    \tex_wd:D
  \__kernel_primitive:NN \widowpenalty          \tex_widowpenalty:D
  \__kernel_primitive:NN \write                 \tex_write:D
  \__kernel_primitive:NN \xdef                  \tex_xdef:D
  \__kernel_primitive:NN \xleaders              \tex_xleaders:D
  \__kernel_primitive:NN \xspaceskip            \tex_xspaceskip:D
  \__kernel_primitive:NN \year                  \tex_year:D
  \__kernel_primitive:NN \beginL                \tex_beginL:D
  \__kernel_primitive:NN \beginR                \tex_beginR:D
  \__kernel_primitive:NN \botmarks              \tex_botmarks:D
  \__kernel_primitive:NN \clubpenalties         \tex_clubpenalties:D
  \__kernel_primitive:NN \currentgrouplevel     \tex_currentgrouplevel:D
  \__kernel_primitive:NN \currentgrouptype      \tex_currentgrouptype:D
  \__kernel_primitive:NN \currentifbranch       \tex_currentifbranch:D
  \__kernel_primitive:NN \currentiflevel        \tex_currentiflevel:D
  \__kernel_primitive:NN \currentiftype         \tex_currentiftype:D
  \__kernel_primitive:NN \detokenize            \tex_detokenize:D
  \__kernel_primitive:NN \dimexpr               \tex_dimexpr:D
  \__kernel_primitive:NN \displaywidowpenalties \tex_displaywidowpenalties:D
  \__kernel_primitive:NN \endL                  \tex_endL:D
  \__kernel_primitive:NN \endR                  \tex_endR:D
  \__kernel_primitive:NN \eTeXrevision          \tex_eTeXrevision:D
  \__kernel_primitive:NN \eTeXversion           \tex_eTeXversion:D
  \__kernel_primitive:NN \everyeof              \tex_everyeof:D
  \__kernel_primitive:NN \firstmarks            \tex_firstmarks:D
  \__kernel_primitive:NN \fontchardp            \tex_fontchardp:D
  \__kernel_primitive:NN \fontcharht            \tex_fontcharht:D
  \__kernel_primitive:NN \fontcharic            \tex_fontcharic:D
  \__kernel_primitive:NN \fontcharwd            \tex_fontcharwd:D
  \__kernel_primitive:NN \glueexpr              \tex_glueexpr:D
  \__kernel_primitive:NN \glueshrink            \tex_glueshrink:D
  \__kernel_primitive:NN \glueshrinkorder       \tex_glueshrinkorder:D
  \__kernel_primitive:NN \gluestretch           \tex_gluestretch:D
  \__kernel_primitive:NN \gluestretchorder      \tex_gluestretchorder:D
  \__kernel_primitive:NN \gluetomu              \tex_gluetomu:D
  \__kernel_primitive:NN \ifcsname              \tex_ifcsname:D
  \__kernel_primitive:NN \ifdefined             \tex_ifdefined:D
  \__kernel_primitive:NN \iffontchar            \tex_iffontchar:D
  \__kernel_primitive:NN \interactionmode       \tex_interactionmode:D
  \__kernel_primitive:NN \interlinepenalties    \tex_interlinepenalties:D
  \__kernel_primitive:NN \lastlinefit           \tex_lastlinefit:D
  \__kernel_primitive:NN \lastnodetype          \tex_lastnodetype:D
  \__kernel_primitive:NN \marks                 \tex_marks:D
  \__kernel_primitive:NN \middle                \tex_middle:D
  \__kernel_primitive:NN \muexpr                \tex_muexpr:D
  \__kernel_primitive:NN \mutoglue              \tex_mutoglue:D
  \__kernel_primitive:NN \numexpr               \tex_numexpr:D
  \__kernel_primitive:NN \pagediscards          \tex_pagediscards:D
  \__kernel_primitive:NN \parshapedimen         \tex_parshapedimen:D
  \__kernel_primitive:NN \parshapeindent        \tex_parshapeindent:D
  \__kernel_primitive:NN \parshapelength        \tex_parshapelength:D
  \__kernel_primitive:NN \predisplaydirection   \tex_predisplaydirection:D
  \__kernel_primitive:NN \protected             \tex_protected:D
  \__kernel_primitive:NN \readline              \tex_readline:D
  \__kernel_primitive:NN \savinghyphcodes       \tex_savinghyphcodes:D
  \__kernel_primitive:NN \savingvdiscards       \tex_savingvdiscards:D
  \__kernel_primitive:NN \scantokens            \tex_scantokens:D
  \__kernel_primitive:NN \showgroups            \tex_showgroups:D
  \__kernel_primitive:NN \showifs               \tex_showifs:D
  \__kernel_primitive:NN \showtokens            \tex_showtokens:D
  \__kernel_primitive:NN \splitbotmarks         \tex_splitbotmarks:D
  \__kernel_primitive:NN \splitdiscards         \tex_splitdiscards:D
  \__kernel_primitive:NN \splitfirstmarks       \tex_splitfirstmarks:D
  \__kernel_primitive:NN \TeXXeTstate           \tex_TeXXeTstate:D
  \__kernel_primitive:NN \topmarks              \tex_topmarks:D
  \__kernel_primitive:NN \tracingassigns        \tex_tracingassigns:D
  \__kernel_primitive:NN \tracinggroups         \tex_tracinggroups:D
  \__kernel_primitive:NN \tracingifs            \tex_tracingifs:D
  \__kernel_primitive:NN \tracingnesting        \tex_tracingnesting:D
  \__kernel_primitive:NN \tracingscantokens     \tex_tracingscantokens:D
  \__kernel_primitive:NN \unexpanded            \tex_unexpanded:D
  \__kernel_primitive:NN \unless                \tex_unless:D
  \__kernel_primitive:NN \widowpenalties        \tex_widowpenalties:D
  \__kernel_primitive:NN \pdfannot              \tex_pdfannot:D
  \__kernel_primitive:NN \pdfcatalog            \tex_pdfcatalog:D
  \__kernel_primitive:NN \pdfcompresslevel      \tex_pdfcompresslevel:D
  \__kernel_primitive:NN \pdfcolorstack         \tex_pdfcolorstack:D
  \__kernel_primitive:NN \pdfcolorstackinit     \tex_pdfcolorstackinit:D
  \__kernel_primitive:NN \pdfcreationdate       \tex_pdfcreationdate:D
  \__kernel_primitive:NN \pdfdecimaldigits      \tex_pdfdecimaldigits:D
  \__kernel_primitive:NN \pdfdest               \tex_pdfdest:D
  \__kernel_primitive:NN \pdfdestmargin         \tex_pdfdestmargin:D
  \__kernel_primitive:NN \pdfendlink            \tex_pdfendlink:D
  \__kernel_primitive:NN \pdfendthread          \tex_pdfendthread:D
  \__kernel_primitive:NN \pdffontattr           \tex_pdffontattr:D
  \__kernel_primitive:NN \pdffontname           \tex_pdffontname:D
  \__kernel_primitive:NN \pdffontobjnum         \tex_pdffontobjnum:D
  \__kernel_primitive:NN \pdfgamma              \tex_pdfgamma:D
  \__kernel_primitive:NN \pdfimageapplygamma    \tex_pdfimageapplygamma:D
  \__kernel_primitive:NN \pdfimagegamma         \tex_pdfimagegamma:D
  \__kernel_primitive:NN \pdfgentounicode       \tex_pdfgentounicode:D
  \__kernel_primitive:NN \pdfglyphtounicode     \tex_pdfglyphtounicode:D
  \__kernel_primitive:NN \pdfhorigin            \tex_pdfhorigin:D
  \__kernel_primitive:NN \pdfimagehicolor       \tex_pdfimagehicolor:D
  \__kernel_primitive:NN \pdfimageresolution    \tex_pdfimageresolution:D
  \__kernel_primitive:NN \pdfincludechars       \tex_pdfincludechars:D
  \__kernel_primitive:NN \pdfinclusioncopyfonts \tex_pdfinclusioncopyfonts:D
  \__kernel_primitive:NN \pdfinclusionerrorlevel
    \tex_pdfinclusionerrorlevel:D
  \__kernel_primitive:NN \pdfinfo               \tex_pdfinfo:D
  \__kernel_primitive:NN \pdflastannot          \tex_pdflastannot:D
  \__kernel_primitive:NN \pdflastlink           \tex_pdflastlink:D
  \__kernel_primitive:NN \pdflastobj            \tex_pdflastobj:D
  \__kernel_primitive:NN \pdflastxform          \tex_pdflastxform:D
  \__kernel_primitive:NN \pdflastximage         \tex_pdflastximage:D
  \__kernel_primitive:NN \pdflastximagecolordepth
    \tex_pdflastximagecolordepth:D
  \__kernel_primitive:NN \pdflastximagepages    \tex_pdflastximagepages:D
  \__kernel_primitive:NN \pdflinkmargin         \tex_pdflinkmargin:D
  \__kernel_primitive:NN \pdfliteral            \tex_pdfliteral:D
  \__kernel_primitive:NN \pdfmajorversion       \tex_pdfmajorversion:D
  \__kernel_primitive:NN \pdfminorversion       \tex_pdfminorversion:D
  \__kernel_primitive:NN \pdfnames              \tex_pdfnames:D
  \__kernel_primitive:NN \pdfobj                \tex_pdfobj:D
  \__kernel_primitive:NN \pdfobjcompresslevel   \tex_pdfobjcompresslevel:D
  \__kernel_primitive:NN \pdfoutline            \tex_pdfoutline:D
  \__kernel_primitive:NN \pdfoutput             \tex_pdfoutput:D
  \__kernel_primitive:NN \pdfpageattr           \tex_pdfpageattr:D
  \__kernel_primitive:NN \pdfpagesattr          \tex_pdfpagesattr:D
  \__kernel_primitive:NN \pdfpagebox            \tex_pdfpagebox:D
  \__kernel_primitive:NN \pdfpageref            \tex_pdfpageref:D
  \__kernel_primitive:NN \pdfpageresources      \tex_pdfpageresources:D
  \__kernel_primitive:NN \pdfpagesattr          \tex_pdfpagesattr:D
  \__kernel_primitive:NN \pdfrefobj             \tex_pdfrefobj:D
  \__kernel_primitive:NN \pdfrefxform           \tex_pdfrefxform:D
  \__kernel_primitive:NN \pdfrefximage          \tex_pdfrefximage:D
  \__kernel_primitive:NN \pdfrestore            \tex_pdfrestore:D
  \__kernel_primitive:NN \pdfretval             \tex_pdfretval:D
  \__kernel_primitive:NN \pdfsave               \tex_pdfsave:D
  \__kernel_primitive:NN \pdfsetmatrix          \tex_pdfsetmatrix:D
  \__kernel_primitive:NN \pdfstartlink          \tex_pdfstartlink:D
  \__kernel_primitive:NN \pdfstartthread        \tex_pdfstartthread:D
  \__kernel_primitive:NN \pdfsuppressptexinfo   \tex_pdfsuppressptexinfo:D
  \__kernel_primitive:NN \pdfthread             \tex_pdfthread:D
  \__kernel_primitive:NN \pdfthreadmargin       \tex_pdfthreadmargin:D
  \__kernel_primitive:NN \pdftrailer            \tex_pdftrailer:D
  \__kernel_primitive:NN \pdfuniqueresname      \tex_pdfuniqueresname:D
  \__kernel_primitive:NN \pdfvorigin            \tex_pdfvorigin:D
  \__kernel_primitive:NN \pdfxform              \tex_pdfxform:D
  \__kernel_primitive:NN \pdfxformname          \tex_pdfxformname:D
  \__kernel_primitive:NN \pdfximage             \tex_pdfximage:D
  \__kernel_primitive:NN \pdfximagebbox         \tex_pdfximagebbox:D
  \__kernel_primitive:NN \ifpdfabsdim           \tex_ifabsdim:D
  \__kernel_primitive:NN \ifpdfabsnum           \tex_ifabsnum:D
  \__kernel_primitive:NN \ifpdfprimitive        \tex_ifprimitive:D
  \__kernel_primitive:NN \pdfadjustspacing      \tex_adjustspacing:D
  \__kernel_primitive:NN \pdfcopyfont           \tex_copyfont:D
  \__kernel_primitive:NN \pdfdraftmode          \tex_draftmode:D
  \__kernel_primitive:NN \pdfeachlinedepth      \tex_eachlinedepth:D
  \__kernel_primitive:NN \pdfeachlineheight     \tex_eachlineheight:D
  \__kernel_primitive:NN \pdfelapsedtime        \tex_elapsedtime:D
  \__kernel_primitive:NN \pdffirstlineheight    \tex_firstlineheight:D
  \__kernel_primitive:NN \pdffontexpand         \tex_fontexpand:D
  \__kernel_primitive:NN \pdffontsize           \tex_fontsize:D
  \__kernel_primitive:NN \pdfignoreddimen       \tex_ignoreddimen:D
  \__kernel_primitive:NN \pdfinsertht           \tex_insertht:D
  \__kernel_primitive:NN \pdflastlinedepth      \tex_lastlinedepth:D
  \__kernel_primitive:NN \pdflastxpos           \tex_lastxpos:D
  \__kernel_primitive:NN \pdflastypos           \tex_lastypos:D
  \__kernel_primitive:NN \pdfmapfile            \tex_mapfile:D
  \__kernel_primitive:NN \pdfmapline            \tex_mapline:D
  \__kernel_primitive:NN \pdfnoligatures        \tex_noligatures:D
  \__kernel_primitive:NN \pdfnormaldeviate      \tex_normaldeviate:D
  \__kernel_primitive:NN \pdfpageheight         \tex_pageheight:D
  \__kernel_primitive:NN \pdfpagewidth          \tex_pagewidth:D
  \__kernel_primitive:NN \pdfpkmode             \tex_pkmode:D
  \__kernel_primitive:NN \pdfpkresolution       \tex_pkresolution:D
  \__kernel_primitive:NN \pdfprimitive          \tex_primitive:D
  \__kernel_primitive:NN \pdfprotrudechars      \tex_protrudechars:D
  \__kernel_primitive:NN \pdfpxdimen            \tex_pxdimen:D
  \__kernel_primitive:NN \pdfrandomseed         \tex_randomseed:D
  \__kernel_primitive:NN \pdfresettimer         \tex_resettimer:D
  \__kernel_primitive:NN \pdfsavepos            \tex_savepos:D
  \__kernel_primitive:NN \pdfsetrandomseed      \tex_setrandomseed:D
  \__kernel_primitive:NN \pdfshellescape        \tex_shellescape:D
  \__kernel_primitive:NN \pdftracingfonts       \tex_tracingfonts:D
  \__kernel_primitive:NN \pdfuniformdeviate     \tex_uniformdeviate:D
  \__kernel_primitive:NN \pdftexbanner          \tex_pdftexbanner:D
  \__kernel_primitive:NN \pdftexrevision        \tex_pdftexrevision:D
  \__kernel_primitive:NN \pdftexversion         \tex_pdftexversion:D
  \__kernel_primitive:NN \efcode                \tex_efcode:D
  \__kernel_primitive:NN \ifincsname            \tex_ifincsname:D
  \__kernel_primitive:NN \leftmarginkern        \tex_leftmarginkern:D
  \__kernel_primitive:NN \letterspacefont       \tex_letterspacefont:D
  \__kernel_primitive:NN \lpcode                \tex_lpcode:D
  \__kernel_primitive:NN \quitvmode             \tex_quitvmode:D
  \__kernel_primitive:NN \rightmarginkern       \tex_rightmarginkern:D
  \__kernel_primitive:NN \rpcode                \tex_rpcode:D
  \__kernel_primitive:NN \synctex               \tex_synctex:D
  \__kernel_primitive:NN \tagcode               \tex_tagcode:D
  \tex_long:D \tex_def:D \use_ii:nn #1#2 {#2}
  \tex_long:D \tex_def:D \use_none:n #1 { }
  \tex_long:D \tex_def:D \__kernel_primitive:NN #1#2
    {
      \tex_ifdefined:D #1
        \tex_expandafter:D \use_ii:nn
      \tex_fi:D
        \use_none:n { \tex_global:D \tex_let:D #2 #1 }
    }
  \__kernel_primitive:NN \pdfstrcmp             \tex_strcmp:D
  \__kernel_primitive:NN \pdffilesize           \tex_filesize:D
  \__kernel_primitive:NN \pdfmdfivesum          \tex_mdfivesum:D
  \__kernel_primitive:NN \pdffilemoddate        \tex_filemoddate:D
  \__kernel_primitive:NN \pdffiledump           \tex_filedump:D
  \__kernel_primitive:NN \suppressfontnotfounderror
    \tex_suppressfontnotfounderror:D
  \__kernel_primitive:NN \XeTeXcharclass        \tex_XeTeXcharclass:D
  \__kernel_primitive:NN \XeTeXcharglyph        \tex_XeTeXcharglyph:D
  \__kernel_primitive:NN \XeTeXcountfeatures    \tex_XeTeXcountfeatures:D
  \__kernel_primitive:NN \XeTeXcountglyphs      \tex_XeTeXcountglyphs:D
  \__kernel_primitive:NN \XeTeXcountselectors   \tex_XeTeXcountselectors:D
  \__kernel_primitive:NN \XeTeXcountvariations  \tex_XeTeXcountvariations:D
  \__kernel_primitive:NN \XeTeXdefaultencoding  \tex_XeTeXdefaultencoding:D
  \__kernel_primitive:NN \XeTeXdashbreakstate   \tex_XeTeXdashbreakstate:D
  \__kernel_primitive:NN \XeTeXfeaturecode      \tex_XeTeXfeaturecode:D
  \__kernel_primitive:NN \XeTeXfeaturename      \tex_XeTeXfeaturename:D
  \__kernel_primitive:NN \XeTeXfindfeaturebyname
    \tex_XeTeXfindfeaturebyname:D
  \__kernel_primitive:NN \XeTeXfindselectorbyname
    \tex_XeTeXfindselectorbyname:D
  \__kernel_primitive:NN \XeTeXfindvariationbyname
    \tex_XeTeXfindvariationbyname:D
  \__kernel_primitive:NN \XeTeXfirstfontchar    \tex_XeTeXfirstfontchar:D
  \__kernel_primitive:NN \XeTeXfonttype         \tex_XeTeXfonttype:D
  \__kernel_primitive:NN \XeTeXgenerateactualtext
    \tex_XeTeXgenerateactualtext:D
  \__kernel_primitive:NN \XeTeXglyph            \tex_XeTeXglyph:D
  \__kernel_primitive:NN \XeTeXglyphbounds      \tex_XeTeXglyphbounds:D
  \__kernel_primitive:NN \XeTeXglyphindex       \tex_XeTeXglyphindex:D
  \__kernel_primitive:NN \XeTeXglyphname        \tex_XeTeXglyphname:D
  \__kernel_primitive:NN \XeTeXinputencoding    \tex_XeTeXinputencoding:D
  \__kernel_primitive:NN \XeTeXinputnormalization
    \tex_XeTeXinputnormalization:D
  \__kernel_primitive:NN \XeTeXinterchartokenstate
    \tex_XeTeXinterchartokenstate:D
  \__kernel_primitive:NN \XeTeXinterchartoks    \tex_XeTeXinterchartoks:D
  \__kernel_primitive:NN \XeTeXisdefaultselector
    \tex_XeTeXisdefaultselector:D
  \__kernel_primitive:NN \XeTeXisexclusivefeature
    \tex_XeTeXisexclusivefeature:D
  \__kernel_primitive:NN \XeTeXlastfontchar     \tex_XeTeXlastfontchar:D
  \__kernel_primitive:NN \XeTeXlinebreakskip    \tex_XeTeXlinebreakskip:D
  \__kernel_primitive:NN \XeTeXlinebreaklocale  \tex_XeTeXlinebreaklocale:D
  \__kernel_primitive:NN \XeTeXlinebreakpenalty \tex_XeTeXlinebreakpenalty:D
  \__kernel_primitive:NN \XeTeXOTcountfeatures  \tex_XeTeXOTcountfeatures:D
  \__kernel_primitive:NN \XeTeXOTcountlanguages \tex_XeTeXOTcountlanguages:D
  \__kernel_primitive:NN \XeTeXOTcountscripts   \tex_XeTeXOTcountscripts:D
  \__kernel_primitive:NN \XeTeXOTfeaturetag     \tex_XeTeXOTfeaturetag:D
  \__kernel_primitive:NN \XeTeXOTlanguagetag    \tex_XeTeXOTlanguagetag:D
  \__kernel_primitive:NN \XeTeXOTscripttag      \tex_XeTeXOTscripttag:D
  \__kernel_primitive:NN \XeTeXpdffile          \tex_XeTeXpdffile:D
  \__kernel_primitive:NN \XeTeXpdfpagecount     \tex_XeTeXpdfpagecount:D
  \__kernel_primitive:NN \XeTeXpicfile          \tex_XeTeXpicfile:D
  \__kernel_primitive:NN \XeTeXrevision         \tex_XeTeXrevision:D
  \__kernel_primitive:NN \XeTeXselectorname     \tex_XeTeXselectorname:D
  \__kernel_primitive:NN \XeTeXtracingfonts     \tex_XeTeXtracingfonts:D
  \__kernel_primitive:NN \XeTeXupwardsmode      \tex_XeTeXupwardsmode:D
  \__kernel_primitive:NN \XeTeXuseglyphmetrics  \tex_XeTeXuseglyphmetrics:D
  \__kernel_primitive:NN \XeTeXvariation        \tex_XeTeXvariation:D
  \__kernel_primitive:NN \XeTeXvariationdefault \tex_XeTeXvariationdefault:D
  \__kernel_primitive:NN \XeTeXvariationmax     \tex_XeTeXvariationmax:D
  \__kernel_primitive:NN \XeTeXvariationmin     \tex_XeTeXvariationmin:D
  \__kernel_primitive:NN \XeTeXvariationname    \tex_XeTeXvariationname:D
  \__kernel_primitive:NN \XeTeXversion          \tex_XeTeXversion:D
  \__kernel_primitive:NN \creationdate          \tex_creationdate:D
  \__kernel_primitive:NN \elapsedtime           \tex_elapsedtime:D
  \__kernel_primitive:NN \filedump              \tex_filedump:D
  \__kernel_primitive:NN \filemoddate           \tex_filemoddate:D
  \__kernel_primitive:NN \filesize              \tex_filesize:D
  \__kernel_primitive:NN \mdfivesum             \tex_mdfivesum:D
  \__kernel_primitive:NN \ifprimitive           \tex_ifprimitive:D
  \__kernel_primitive:NN \primitive             \tex_primitive:D
  \__kernel_primitive:NN \resettimer            \tex_resettimer:D
  \__kernel_primitive:NN \shellescape           \tex_shellescape:D
  \__kernel_primitive:NN \alignmark             \tex_alignmark:D
  \__kernel_primitive:NN \aligntab              \tex_aligntab:D
  \__kernel_primitive:NN \attribute             \tex_attribute:D
  \__kernel_primitive:NN \attributedef          \tex_attributedef:D
  \__kernel_primitive:NN \automaticdiscretionary
    \tex_automaticdiscretionary:D
  \__kernel_primitive:NN \automatichyphenmode   \tex_automatichyphenmode:D
  \__kernel_primitive:NN \automatichyphenpenalty
    \tex_automatichyphenpenalty:D
  \__kernel_primitive:NN \begincsname           \tex_begincsname:D
  \__kernel_primitive:NN \bodydir               \tex_bodydir:D
  \__kernel_primitive:NN \bodydirection         \tex_bodydirection:D
  \__kernel_primitive:NN \boxdir                \tex_boxdir:D
  \__kernel_primitive:NN \boxdirection          \tex_boxdirection:D
  \__kernel_primitive:NN \breakafterdirmode     \tex_breakafterdirmode:D
  \__kernel_primitive:NN \catcodetable          \tex_catcodetable:D
  \__kernel_primitive:NN \clearmarks            \tex_clearmarks:D
  \__kernel_primitive:NN \crampeddisplaystyle   \tex_crampeddisplaystyle:D
  \__kernel_primitive:NN \crampedscriptscriptstyle
    \tex_crampedscriptscriptstyle:D
  \__kernel_primitive:NN \crampedscriptstyle    \tex_crampedscriptstyle:D
  \__kernel_primitive:NN \crampedtextstyle      \tex_crampedtextstyle:D
  \__kernel_primitive:NN \csstring              \tex_csstring:D
  \__kernel_primitive:NN \directlua             \tex_directlua:D
  \__kernel_primitive:NN \dviextension          \tex_dviextension:D
  \__kernel_primitive:NN \dvifeedback           \tex_dvifeedback:D
  \__kernel_primitive:NN \dvivariable           \tex_dvivariable:D
  \__kernel_primitive:NN \eTeXglueshrinkorder   \tex_eTeXglueshrinkorder:D
  \__kernel_primitive:NN \eTeXgluestretchorder  \tex_eTeXgluestretchorder:D
  \__kernel_primitive:NN \etoksapp              \tex_etoksapp:D
  \__kernel_primitive:NN \etokspre              \tex_etokspre:D
  \__kernel_primitive:NN \exceptionpenalty      \tex_exceptionpenalty:D
  \__kernel_primitive:NN \explicithyphenpenalty \tex_explicithyphenpenalty:D
  \__kernel_primitive:NN \expanded              \tex_expanded:D
  \__kernel_primitive:NN \explicitdiscretionary \tex_explicitdiscretionary:D
  \__kernel_primitive:NN \firstvalidlanguage    \tex_firstvalidlanguage:D
  \__kernel_primitive:NN \fontid                \tex_fontid:D
  \__kernel_primitive:NN \formatname            \tex_formatname:D
  \__kernel_primitive:NN \hjcode                \tex_hjcode:D
  \__kernel_primitive:NN \hpack                 \tex_hpack:D
  \__kernel_primitive:NN \hyphenationbounds     \tex_hyphenationbounds:D
  \__kernel_primitive:NN \hyphenationmin        \tex_hyphenationmin:D
  \__kernel_primitive:NN \hyphenpenaltymode     \tex_hyphenpenaltymode:D
  \__kernel_primitive:NN \gleaders              \tex_gleaders:D
  \__kernel_primitive:NN \ifcondition           \tex_ifcondition:D
  \__kernel_primitive:NN \immediateassigned     \tex_immediateassigned:D
  \__kernel_primitive:NN \immediateassignment   \tex_immediateassignment:D
  \__kernel_primitive:NN \initcatcodetable      \tex_initcatcodetable:D
  \__kernel_primitive:NN \lastnamedcs           \tex_lastnamedcs:D
  \__kernel_primitive:NN \latelua               \tex_latelua:D
  \__kernel_primitive:NN \lateluafunction       \tex_lateluafunction:D
  \__kernel_primitive:NN \leftghost             \tex_leftghost:D
  \__kernel_primitive:NN \letcharcode           \tex_letcharcode:D
  \__kernel_primitive:NN \linedir               \tex_linedir:D
  \__kernel_primitive:NN \linedirection         \tex_linedirection:D
  \__kernel_primitive:NN \localbrokenpenalty    \tex_localbrokenpenalty:D
  \__kernel_primitive:NN \localinterlinepenalty \tex_localinterlinepenalty:D
  \__kernel_primitive:NN \luabytecode           \tex_luabytecode:D
  \__kernel_primitive:NN \luabytecodecall       \tex_luabytecodecall:D
  \__kernel_primitive:NN \luacopyinputnodes     \tex_luacopyinputnodes:D
  \__kernel_primitive:NN \luadef                \tex_luadef:D
  \__kernel_primitive:NN \localleftbox          \tex_localleftbox:D
  \__kernel_primitive:NN \localrightbox         \tex_localrightbox:D
  \__kernel_primitive:NN \luaescapestring       \tex_luaescapestring:D
  \__kernel_primitive:NN \luafunction           \tex_luafunction:D
  \__kernel_primitive:NN \luafunctioncall       \tex_luafunctioncall:D
  \__kernel_primitive:NN \luatexbanner          \tex_luatexbanner:D
  \__kernel_primitive:NN \luatexrevision        \tex_luatexrevision:D
  \__kernel_primitive:NN \luatexversion         \tex_luatexversion:D
  \__kernel_primitive:NN \mathdelimitersmode    \tex_mathdelimitersmode:D
  \__kernel_primitive:NN \mathdir               \tex_mathdir:D
  \__kernel_primitive:NN \mathdirection         \tex_mathdirection:D
  \__kernel_primitive:NN \mathdisplayskipmode   \tex_mathdisplayskipmode:D
  \__kernel_primitive:NN \matheqnogapstep       \tex_matheqnogapstep:D
  \__kernel_primitive:NN \mathnolimitsmode      \tex_mathnolimitsmode:D
  \__kernel_primitive:NN \mathoption            \tex_mathoption:D
  \__kernel_primitive:NN \mathpenaltiesmode     \tex_mathpenaltiesmode:D
  \__kernel_primitive:NN \mathrulesfam          \tex_mathrulesfam:D
  \__kernel_primitive:NN \mathscriptsmode       \tex_mathscriptsmode:D
  \__kernel_primitive:NN \mathscriptboxmode     \tex_mathscriptboxmode:D
  \__kernel_primitive:NN \mathscriptcharmode    \tex_mathscriptcharmode:D
  \__kernel_primitive:NN \mathstyle             \tex_mathstyle:D
  \__kernel_primitive:NN \mathsurroundmode      \tex_mathsurroundmode:D
  \__kernel_primitive:NN \mathsurroundskip      \tex_mathsurroundskip:D
  \__kernel_primitive:NN \nohrule               \tex_nohrule:D
  \__kernel_primitive:NN \nokerns               \tex_nokerns:D
  \__kernel_primitive:NN \noligs                \tex_noligs:D
  \__kernel_primitive:NN \nospaces              \tex_nospaces:D
  \__kernel_primitive:NN \novrule               \tex_novrule:D
  \__kernel_primitive:NN \outputbox             \tex_outputbox:D
  \__kernel_primitive:NN \pagebottomoffset      \tex_pagebottomoffset:D
  \__kernel_primitive:NN \pagedir               \tex_pagedir:D
  \__kernel_primitive:NN \pagedirection         \tex_pagedirection:D
  \__kernel_primitive:NN \pageleftoffset        \tex_pageleftoffset:D
  \__kernel_primitive:NN \pagerightoffset       \tex_pagerightoffset:D
  \__kernel_primitive:NN \pagetopoffset         \tex_pagetopoffset:D
  \__kernel_primitive:NN \pardir                \tex_pardir:D
  \__kernel_primitive:NN \pardirection          \tex_pardirection:D
  \__kernel_primitive:NN \pdfextension          \tex_pdfextension:D
  \__kernel_primitive:NN \pdffeedback           \tex_pdffeedback:D
  \__kernel_primitive:NN \pdfvariable           \tex_pdfvariable:D
  \__kernel_primitive:NN \postexhyphenchar      \tex_postexhyphenchar:D
  \__kernel_primitive:NN \posthyphenchar        \tex_posthyphenchar:D
  \__kernel_primitive:NN \prebinoppenalty       \tex_prebinoppenalty:D
  \__kernel_primitive:NN \predisplaygapfactor   \tex_predisplaygapfactor:D
  \__kernel_primitive:NN \preexhyphenchar       \tex_preexhyphenchar:D
  \__kernel_primitive:NN \prehyphenchar         \tex_prehyphenchar:D
  \__kernel_primitive:NN \prerelpenalty         \tex_prerelpenalty:D
  \__kernel_primitive:NN \rightghost            \tex_rightghost:D
  \__kernel_primitive:NN \savecatcodetable      \tex_savecatcodetable:D
  \__kernel_primitive:NN \scantextokens         \tex_scantextokens:D
  \__kernel_primitive:NN \setfontid             \tex_setfontid:D
  \__kernel_primitive:NN \shapemode             \tex_shapemode:D
  \__kernel_primitive:NN \suppressifcsnameerror \tex_suppressifcsnameerror:D
  \__kernel_primitive:NN \suppresslongerror     \tex_suppresslongerror:D
  \__kernel_primitive:NN \suppressmathparerror  \tex_suppressmathparerror:D
  \__kernel_primitive:NN \suppressoutererror    \tex_suppressoutererror:D
  \__kernel_primitive:NN \suppressprimitiveerror
    \tex_suppressprimitiveerror:D
  \__kernel_primitive:NN \textdir               \tex_textdir:D
  \__kernel_primitive:NN \textdirection         \tex_textdirection:D
  \__kernel_primitive:NN \toksapp               \tex_toksapp:D
  \__kernel_primitive:NN \tokspre               \tex_tokspre:D
  \__kernel_primitive:NN \tpack                 \tex_tpack:D
  \__kernel_primitive:NN \vpack                 \tex_vpack:D
  \__kernel_primitive:NN \adjustspacing         \tex_adjustspacing:D
  \__kernel_primitive:NN \copyfont              \tex_copyfont:D
  \__kernel_primitive:NN \draftmode             \tex_draftmode:D
  \__kernel_primitive:NN \expandglyphsinfont    \tex_fontexpand:D
  \__kernel_primitive:NN \ifabsdim              \tex_ifabsdim:D
  \__kernel_primitive:NN \ifabsnum              \tex_ifabsnum:D
  \__kernel_primitive:NN \ignoreligaturesinfont \tex_ignoreligaturesinfont:D
  \__kernel_primitive:NN \insertht              \tex_insertht:D
  \__kernel_primitive:NN \lastsavedboxresourceindex
    \tex_pdflastxform:D
  \__kernel_primitive:NN \lastsavedimageresourceindex
    \tex_pdflastximage:D
  \__kernel_primitive:NN \lastsavedimageresourcepages
    \tex_pdflastximagepages:D
  \__kernel_primitive:NN \lastxpos              \tex_lastxpos:D
  \__kernel_primitive:NN \lastypos              \tex_lastypos:D
  \__kernel_primitive:NN \normaldeviate         \tex_normaldeviate:D
  \__kernel_primitive:NN \outputmode            \tex_pdfoutput:D
  \__kernel_primitive:NN \pageheight            \tex_pageheight:D
  \__kernel_primitive:NN \pagewidth             \tex_pagewidth:D
  \__kernel_primitive:NN \protrudechars         \tex_protrudechars:D
  \__kernel_primitive:NN \pxdimen               \tex_pxdimen:D
  \__kernel_primitive:NN \randomseed            \tex_randomseed:D
  \__kernel_primitive:NN \useboxresource        \tex_pdfrefxform:D
  \__kernel_primitive:NN \useimageresource      \tex_pdfrefximage:D
  \__kernel_primitive:NN \savepos               \tex_savepos:D
  \__kernel_primitive:NN \saveboxresource       \tex_pdfxform:D
  \__kernel_primitive:NN \saveimageresource     \tex_pdfximage:D
  \__kernel_primitive:NN \setrandomseed         \tex_setrandomseed:D
  \__kernel_primitive:NN \tracingfonts          \tex_tracingfonts:D
  \__kernel_primitive:NN \uniformdeviate        \tex_uniformdeviate:D
  \__kernel_primitive:NN \Uchar                 \tex_Uchar:D
  \__kernel_primitive:NN \Ucharcat              \tex_Ucharcat:D
  \__kernel_primitive:NN \Udelcode              \tex_Udelcode:D
  \__kernel_primitive:NN \Udelcodenum           \tex_Udelcodenum:D
  \__kernel_primitive:NN \Udelimiter            \tex_Udelimiter:D
  \__kernel_primitive:NN \Udelimiterover        \tex_Udelimiterover:D
  \__kernel_primitive:NN \Udelimiterunder       \tex_Udelimiterunder:D
  \__kernel_primitive:NN \Uhextensible          \tex_Uhextensible:D
  \__kernel_primitive:NN \Umathaccent           \tex_Umathaccent:D
  \__kernel_primitive:NN \Umathaxis             \tex_Umathaxis:D
  \__kernel_primitive:NN \Umathbinbinspacing    \tex_Umathbinbinspacing:D
  \__kernel_primitive:NN \Umathbinclosespacing  \tex_Umathbinclosespacing:D
  \__kernel_primitive:NN \Umathbininnerspacing  \tex_Umathbininnerspacing:D
  \__kernel_primitive:NN \Umathbinopenspacing   \tex_Umathbinopenspacing:D
  \__kernel_primitive:NN \Umathbinopspacing     \tex_Umathbinopspacing:D
  \__kernel_primitive:NN \Umathbinordspacing    \tex_Umathbinordspacing:D
  \__kernel_primitive:NN \Umathbinpunctspacing  \tex_Umathbinpunctspacing:D
  \__kernel_primitive:NN \Umathbinrelspacing    \tex_Umathbinrelspacing:D
  \__kernel_primitive:NN \Umathchar             \tex_Umathchar:D
  \__kernel_primitive:NN \Umathcharclass        \tex_Umathcharclass:D
  \__kernel_primitive:NN \Umathchardef          \tex_Umathchardef:D
  \__kernel_primitive:NN \Umathcharfam          \tex_Umathcharfam:D
  \__kernel_primitive:NN \Umathcharnum          \tex_Umathcharnum:D
  \__kernel_primitive:NN \Umathcharnumdef       \tex_Umathcharnumdef:D
  \__kernel_primitive:NN \Umathcharslot         \tex_Umathcharslot:D
  \__kernel_primitive:NN \Umathclosebinspacing  \tex_Umathclosebinspacing:D
  \__kernel_primitive:NN \Umathcloseclosespacing
    \tex_Umathcloseclosespacing:D
  \__kernel_primitive:NN \Umathcloseinnerspacing
    \tex_Umathcloseinnerspacing:D
  \__kernel_primitive:NN \Umathcloseopenspacing \tex_Umathcloseopenspacing:D
  \__kernel_primitive:NN \Umathcloseopspacing   \tex_Umathcloseopspacing:D
  \__kernel_primitive:NN \Umathcloseordspacing  \tex_Umathcloseordspacing:D
  \__kernel_primitive:NN \Umathclosepunctspacing
    \tex_Umathclosepunctspacing:D
  \__kernel_primitive:NN \Umathcloserelspacing  \tex_Umathcloserelspacing:D
  \__kernel_primitive:NN \Umathcode             \tex_Umathcode:D
  \__kernel_primitive:NN \Umathcodenum          \tex_Umathcodenum:D
  \__kernel_primitive:NN \Umathconnectoroverlapmin
    \tex_Umathconnectoroverlapmin:D
  \__kernel_primitive:NN \Umathfractiondelsize  \tex_Umathfractiondelsize:D
  \__kernel_primitive:NN \Umathfractiondenomdown
    \tex_Umathfractiondenomdown:D
  \__kernel_primitive:NN \Umathfractiondenomvgap
    \tex_Umathfractiondenomvgap:D
  \__kernel_primitive:NN \Umathfractionnumup    \tex_Umathfractionnumup:D
  \__kernel_primitive:NN \Umathfractionnumvgap  \tex_Umathfractionnumvgap:D
  \__kernel_primitive:NN \Umathfractionrule     \tex_Umathfractionrule:D
  \__kernel_primitive:NN \Umathinnerbinspacing  \tex_Umathinnerbinspacing:D
  \__kernel_primitive:NN \Umathinnerclosespacing
    \tex_Umathinnerclosespacing:D
  \__kernel_primitive:NN \Umathinnerinnerspacing
    \tex_Umathinnerinnerspacing:D
  \__kernel_primitive:NN \Umathinneropenspacing \tex_Umathinneropenspacing:D
  \__kernel_primitive:NN \Umathinneropspacing   \tex_Umathinneropspacing:D
  \__kernel_primitive:NN \Umathinnerordspacing  \tex_Umathinnerordspacing:D
  \__kernel_primitive:NN \Umathinnerpunctspacing
    \tex_Umathinnerpunctspacing:D
  \__kernel_primitive:NN \Umathinnerrelspacing  \tex_Umathinnerrelspacing:D
  \__kernel_primitive:NN \Umathlimitabovebgap   \tex_Umathlimitabovebgap:D
  \__kernel_primitive:NN \Umathlimitabovekern   \tex_Umathlimitabovekern:D
  \__kernel_primitive:NN \Umathlimitabovevgap   \tex_Umathlimitabovevgap:D
  \__kernel_primitive:NN \Umathlimitbelowbgap   \tex_Umathlimitbelowbgap:D
  \__kernel_primitive:NN \Umathlimitbelowkern   \tex_Umathlimitbelowkern:D
  \__kernel_primitive:NN \Umathlimitbelowvgap   \tex_Umathlimitbelowvgap:D
  \__kernel_primitive:NN \Umathnolimitsubfactor \tex_Umathnolimitsubfactor:D
  \__kernel_primitive:NN \Umathnolimitsupfactor \tex_Umathnolimitsupfactor:D
  \__kernel_primitive:NN \Umathopbinspacing     \tex_Umathopbinspacing:D
  \__kernel_primitive:NN \Umathopclosespacing   \tex_Umathopclosespacing:D
  \__kernel_primitive:NN \Umathopenbinspacing   \tex_Umathopenbinspacing:D
  \__kernel_primitive:NN \Umathopenclosespacing \tex_Umathopenclosespacing:D
  \__kernel_primitive:NN \Umathopeninnerspacing \tex_Umathopeninnerspacing:D
  \__kernel_primitive:NN \Umathopenopenspacing  \tex_Umathopenopenspacing:D
  \__kernel_primitive:NN \Umathopenopspacing    \tex_Umathopenopspacing:D
  \__kernel_primitive:NN \Umathopenordspacing   \tex_Umathopenordspacing:D
  \__kernel_primitive:NN \Umathopenpunctspacing \tex_Umathopenpunctspacing:D
  \__kernel_primitive:NN \Umathopenrelspacing   \tex_Umathopenrelspacing:D
  \__kernel_primitive:NN \Umathoperatorsize     \tex_Umathoperatorsize:D
  \__kernel_primitive:NN \Umathopinnerspacing   \tex_Umathopinnerspacing:D
  \__kernel_primitive:NN \Umathopopenspacing    \tex_Umathopopenspacing:D
  \__kernel_primitive:NN \Umathopopspacing      \tex_Umathopopspacing:D
  \__kernel_primitive:NN \Umathopordspacing     \tex_Umathopordspacing:D
  \__kernel_primitive:NN \Umathoppunctspacing   \tex_Umathoppunctspacing:D
  \__kernel_primitive:NN \Umathoprelspacing     \tex_Umathoprelspacing:D
  \__kernel_primitive:NN \Umathordbinspacing    \tex_Umathordbinspacing:D
  \__kernel_primitive:NN \Umathordclosespacing  \tex_Umathordclosespacing:D
  \__kernel_primitive:NN \Umathordinnerspacing  \tex_Umathordinnerspacing:D
  \__kernel_primitive:NN \Umathordopenspacing   \tex_Umathordopenspacing:D
  \__kernel_primitive:NN \Umathordopspacing     \tex_Umathordopspacing:D
  \__kernel_primitive:NN \Umathordordspacing    \tex_Umathordordspacing:D
  \__kernel_primitive:NN \Umathordpunctspacing  \tex_Umathordpunctspacing:D
  \__kernel_primitive:NN \Umathordrelspacing    \tex_Umathordrelspacing:D
  \__kernel_primitive:NN \Umathoverbarkern      \tex_Umathoverbarkern:D
  \__kernel_primitive:NN \Umathoverbarrule      \tex_Umathoverbarrule:D
  \__kernel_primitive:NN \Umathoverbarvgap      \tex_Umathoverbarvgap:D
  \__kernel_primitive:NN \Umathoverdelimiterbgap
     \tex_Umathoverdelimiterbgap:D
  \__kernel_primitive:NN \Umathoverdelimitervgap
    \tex_Umathoverdelimitervgap:D
  \__kernel_primitive:NN \Umathpunctbinspacing  \tex_Umathpunctbinspacing:D
  \__kernel_primitive:NN \Umathpunctclosespacing
    \tex_Umathpunctclosespacing:D
  \__kernel_primitive:NN \Umathpunctinnerspacing
    \tex_Umathpunctinnerspacing:D
  \__kernel_primitive:NN \Umathpunctopenspacing \tex_Umathpunctopenspacing:D
  \__kernel_primitive:NN \Umathpunctopspacing   \tex_Umathpunctopspacing:D
  \__kernel_primitive:NN \Umathpunctordspacing  \tex_Umathpunctordspacing:D
  \__kernel_primitive:NN \Umathpunctpunctspacing
    \tex_Umathpunctpunctspacing:D
  \__kernel_primitive:NN \Umathpunctrelspacing  \tex_Umathpunctrelspacing:D
  \__kernel_primitive:NN \Umathquad             \tex_Umathquad:D
  \__kernel_primitive:NN \Umathradicaldegreeafter
    \tex_Umathradicaldegreeafter:D
  \__kernel_primitive:NN \Umathradicaldegreebefore
    \tex_Umathradicaldegreebefore:D
  \__kernel_primitive:NN \Umathradicaldegreeraise
    \tex_Umathradicaldegreeraise:D
  \__kernel_primitive:NN \Umathradicalkern      \tex_Umathradicalkern:D
  \__kernel_primitive:NN \Umathradicalrule      \tex_Umathradicalrule:D
  \__kernel_primitive:NN \Umathradicalvgap      \tex_Umathradicalvgap:D
  \__kernel_primitive:NN \Umathrelbinspacing    \tex_Umathrelbinspacing:D
  \__kernel_primitive:NN \Umathrelclosespacing  \tex_Umathrelclosespacing:D
  \__kernel_primitive:NN \Umathrelinnerspacing  \tex_Umathrelinnerspacing:D
  \__kernel_primitive:NN \Umathrelopenspacing   \tex_Umathrelopenspacing:D
  \__kernel_primitive:NN \Umathrelopspacing     \tex_Umathrelopspacing:D
  \__kernel_primitive:NN \Umathrelordspacing    \tex_Umathrelordspacing:D
  \__kernel_primitive:NN \Umathrelpunctspacing  \tex_Umathrelpunctspacing:D
  \__kernel_primitive:NN \Umathrelrelspacing    \tex_Umathrelrelspacing:D
  \__kernel_primitive:NN \Umathskewedfractionhgap
    \tex_Umathskewedfractionhgap:D
  \__kernel_primitive:NN \Umathskewedfractionvgap
    \tex_Umathskewedfractionvgap:D
  \__kernel_primitive:NN \Umathspaceafterscript \tex_Umathspaceafterscript:D
  \__kernel_primitive:NN \Umathstackdenomdown   \tex_Umathstackdenomdown:D
  \__kernel_primitive:NN \Umathstacknumup       \tex_Umathstacknumup:D
  \__kernel_primitive:NN \Umathstackvgap        \tex_Umathstackvgap:D
  \__kernel_primitive:NN \Umathsubshiftdown     \tex_Umathsubshiftdown:D
  \__kernel_primitive:NN \Umathsubshiftdrop     \tex_Umathsubshiftdrop:D
  \__kernel_primitive:NN \Umathsubsupshiftdown  \tex_Umathsubsupshiftdown:D
  \__kernel_primitive:NN \Umathsubsupvgap       \tex_Umathsubsupvgap:D
  \__kernel_primitive:NN \Umathsubtopmax        \tex_Umathsubtopmax:D
  \__kernel_primitive:NN \Umathsupbottommin     \tex_Umathsupbottommin:D
  \__kernel_primitive:NN \Umathsupshiftdrop     \tex_Umathsupshiftdrop:D
  \__kernel_primitive:NN \Umathsupshiftup       \tex_Umathsupshiftup:D
  \__kernel_primitive:NN \Umathsupsubbottommax  \tex_Umathsupsubbottommax:D
  \__kernel_primitive:NN \Umathunderbarkern     \tex_Umathunderbarkern:D
  \__kernel_primitive:NN \Umathunderbarrule     \tex_Umathunderbarrule:D
  \__kernel_primitive:NN \Umathunderbarvgap     \tex_Umathunderbarvgap:D
  \__kernel_primitive:NN \Umathunderdelimiterbgap
    \tex_Umathunderdelimiterbgap:D
  \__kernel_primitive:NN \Umathunderdelimitervgap
    \tex_Umathunderdelimitervgap:D
  \__kernel_primitive:NN \Unosubscript          \tex_Unosubscript:D
  \__kernel_primitive:NN \Unosuperscript        \tex_Unosuperscript:D
  \__kernel_primitive:NN \Uoverdelimiter        \tex_Uoverdelimiter:D
  \__kernel_primitive:NN \Uradical              \tex_Uradical:D
  \__kernel_primitive:NN \Uroot                 \tex_Uroot:D
  \__kernel_primitive:NN \Uskewed               \tex_Uskewed:D
  \__kernel_primitive:NN \Uskewedwithdelims     \tex_Uskewedwithdelims:D
  \__kernel_primitive:NN \Ustack                \tex_Ustack:D
  \__kernel_primitive:NN \Ustartdisplaymath     \tex_Ustartdisplaymath:D
  \__kernel_primitive:NN \Ustartmath            \tex_Ustartmath:D
  \__kernel_primitive:NN \Ustopdisplaymath      \tex_Ustopdisplaymath:D
  \__kernel_primitive:NN \Ustopmath             \tex_Ustopmath:D
  \__kernel_primitive:NN \Usubscript            \tex_Usubscript:D
  \__kernel_primitive:NN \Usuperscript          \tex_Usuperscript:D
  \__kernel_primitive:NN \Uunderdelimiter       \tex_Uunderdelimiter:D
  \__kernel_primitive:NN \Uvextensible          \tex_Uvextensible:D
  \__kernel_primitive:NN \autospacing           \tex_autospacing:D
  \__kernel_primitive:NN \autoxspacing          \tex_autoxspacing:D
  \__kernel_primitive:NN \currentcjktoken       \tex_currentcjktoken:D
  \__kernel_primitive:NN \currentspacingmode    \tex_currentspacingmode:D
  \__kernel_primitive:NN \currentxspacingmode   \tex_currentxspacingmode:D
  \__kernel_primitive:NN \disinhibitglue        \tex_disinhibitglue:D
  \__kernel_primitive:NN \dtou                  \tex_dtou:D
  \__kernel_primitive:NN \epTeXinputencoding    \tex_epTeXinputencoding:D
  \__kernel_primitive:NN \epTeXversion          \tex_epTeXversion:D
  \__kernel_primitive:NN \euc                   \tex_euc:D
  \__kernel_primitive:NN \hfi                   \tex_hfi:D
  \__kernel_primitive:NN \ifdbox                \tex_ifdbox:D
  \__kernel_primitive:NN \ifddir                \tex_ifddir:D
  \__kernel_primitive:NN \ifjfont               \tex_ifjfont:D
  \__kernel_primitive:NN \ifmbox                \tex_ifmbox:D
  \__kernel_primitive:NN \ifmdir                \tex_ifmdir:D
  \__kernel_primitive:NN \iftbox                \tex_iftbox:D
  \__kernel_primitive:NN \iftfont               \tex_iftfont:D
  \__kernel_primitive:NN \iftdir                \tex_iftdir:D
  \__kernel_primitive:NN \ifybox                \tex_ifybox:D
  \__kernel_primitive:NN \ifydir                \tex_ifydir:D
  \__kernel_primitive:NN \inhibitglue           \tex_inhibitglue:D
  \__kernel_primitive:NN \inhibitxspcode        \tex_inhibitxspcode:D
  \__kernel_primitive:NN \jcharwidowpenalty     \tex_jcharwidowpenalty:D
  \__kernel_primitive:NN \jfam                  \tex_jfam:D
  \__kernel_primitive:NN \jfont                 \tex_jfont:D
  \__kernel_primitive:NN \jis                   \tex_jis:D
  \__kernel_primitive:NN \kanjiskip             \tex_kanjiskip:D
  \__kernel_primitive:NN \kansuji               \tex_kansuji:D
  \__kernel_primitive:NN \kansujichar           \tex_kansujichar:D
  \__kernel_primitive:NN \kcatcode              \tex_kcatcode:D
  \__kernel_primitive:NN \kuten                 \tex_kuten:D
  \__kernel_primitive:NN \lastnodechar          \tex_lastnodechar:D
  \__kernel_primitive:NN \lastnodesubtype       \tex_lastnodesubtype:D
  \__kernel_primitive:NN \noautospacing         \tex_noautospacing:D
  \__kernel_primitive:NN \noautoxspacing        \tex_noautoxspacing:D
  \__kernel_primitive:NN \pagefistretch         \tex_pagefistretch:D
  \__kernel_primitive:NN \postbreakpenalty      \tex_postbreakpenalty:D
  \__kernel_primitive:NN \prebreakpenalty       \tex_prebreakpenalty:D
  \__kernel_primitive:NN \ptexminorversion      \tex_ptexminorversion:D
  \__kernel_primitive:NN \ptexrevision          \tex_ptexrevision:D
  \__kernel_primitive:NN \ptexversion           \tex_ptexversion:D
  \__kernel_primitive:NN \readpapersizespecial  \tex_readpapersizespecial:D
  \__kernel_primitive:NN \scriptbaselineshiftfactor
    \tex_scriptbaselineshiftfactor:D
  \__kernel_primitive:NN \scriptscriptbaselineshiftfactor
    \tex_scriptscriptbaselineshiftfactor:D
  \__kernel_primitive:NN \showmode              \tex_showmode:D
  \__kernel_primitive:NN \sjis                  \tex_sjis:D
  \__kernel_primitive:NN \tate                  \tex_tate:D
  \__kernel_primitive:NN \tbaselineshift        \tex_tbaselineshift:D
  \__kernel_primitive:NN \textbaselineshiftfactor
    \tex_textbaselineshiftfactor:D
  \__kernel_primitive:NN \tfont                 \tex_tfont:D
  \__kernel_primitive:NN \xkanjiskip            \tex_xkanjiskip:D
  \__kernel_primitive:NN \xspcode               \tex_xspcode:D
  \__kernel_primitive:NN \ybaselineshift        \tex_ybaselineshift:D
  \__kernel_primitive:NN \yoko                  \tex_yoko:D
  \__kernel_primitive:NN \vfi                   \tex_vfi:D
  \__kernel_primitive:NN \currentcjktoken       \tex_currentcjktoken:D
  \__kernel_primitive:NN \disablecjktoken       \tex_disablecjktoken:D
  \__kernel_primitive:NN \enablecjktoken        \tex_enablecjktoken:D
  \__kernel_primitive:NN \forcecjktoken         \tex_forcecjktoken:D
  \__kernel_primitive:NN \kchar                 \tex_kchar:D
  \__kernel_primitive:NN \kchardef              \tex_kchardef:D
  \__kernel_primitive:NN \kuten                 \tex_kuten:D
  \__kernel_primitive:NN \ucs                   \tex_ucs:D
  \__kernel_primitive:NN \uptexrevision         \tex_uptexrevision:D
  \__kernel_primitive:NN \uptexversion          \tex_uptexversion:D
  \__kernel_primitive:NN \odelcode              \tex_odelcode:D
  \__kernel_primitive:NN \odelimiter            \tex_odelimiter:D
  \__kernel_primitive:NN \omathaccent           \tex_omathaccent:D
  \__kernel_primitive:NN \omathchar             \tex_omathchar:D
  \__kernel_primitive:NN \omathchardef          \tex_omathchardef:D
  \__kernel_primitive:NN \omathcode             \tex_omathcode:D
  \__kernel_primitive:NN \oradical              \tex_oradical:D
\tex_endgroup:D
\tex_ifdefined:D \@@end
  \tex_let:D \tex_end:D                  \@@end
  \tex_let:D \tex_input:D                \@@input
\tex_fi:D
\tex_ifdefined:D \@@hyph
  \tex_let:D \tex_everydisplay:D         \frozen@everydisplay
  \tex_let:D \tex_everymath:D            \frozen@everymath
  \tex_let:D \tex_hyphen:D               \@@hyph
  \tex_let:D \tex_italiccorrection:D     \@@italiccorr
  \tex_let:D \tex_underline:D            \@@underline
  \tex_ifdefined:D \@@shipout
    \tex_let:D \tex_shipout:D \@@shipout
  \tex_fi:D
  \tex_begingroup:D
    \tex_edef:D \l_tmpa_tl { \tex_string:D \shipout }
    \tex_edef:D \l_tmpb_tl { \tex_meaning:D \shipout }
    \tex_ifx:D \l_tmpa_tl \l_tmpb_tl
    \tex_else:D
      \tex_expandafter:D \@tfor \tex_expandafter:D \@tempa \tex_string:D :=
        \CROP@shipout
        \dup@shipout
        \GPTorg@shipout
        \LL@shipout
        \mem@oldshipout
        \opem@shipout
        \pgfpages@originalshipout
        \pr@shipout
        \Shipout
        \verso@orig@shipout
        \do
          {
            \tex_edef:D \l_tmpb_tl
              { \tex_expandafter:D \tex_meaning:D \@tempa }
            \tex_ifx:D \l_tmpa_tl \l_tmpb_tl
              \tex_global:D \tex_expandafter:D \tex_let:D
                \tex_expandafter:D \tex_shipout:D \@tempa
            \tex_fi:D
          }
    \tex_fi:D
  \tex_endgroup:D
  \tex_let:D \tex_tracingfonts:D \tex_undefined:D
  \tex_ifdefined:D \pdftracingfonts
    \tex_let:D \tex_tracingfonts:D \pdftracingfonts
  \tex_else:D
    \tex_ifdefined:D \tex_directlua:D
      \tex_directlua:D { tex.enableprimitives("@@", {"tracingfonts"}) }
      \tex_let:D \tex_tracingfonts:D \@@tracingfonts
    \tex_fi:D
  \tex_fi:D
\tex_fi:D
\tex_ifdefined:D \luatexsuppressfontnotfounderror
  \tex_let:D \tex_alignmark:D           \luatexalignmark
  \tex_let:D \tex_aligntab:D            \luatexaligntab
  \tex_let:D \tex_attribute:D           \luatexattribute
  \tex_let:D \tex_attributedef:D        \luatexattributedef
  \tex_let:D \tex_catcodetable:D        \luatexcatcodetable
  \tex_let:D \tex_clearmarks:D          \luatexclearmarks
  \tex_let:D \tex_crampeddisplaystyle:D \luatexcrampeddisplaystyle
  \tex_let:D \tex_crampedscriptscriptstyle:D
    \luatexcrampedscriptscriptstyle
  \tex_let:D \tex_crampedscriptstyle:D  \luatexcrampedscriptstyle
  \tex_let:D \tex_crampedtextstyle:D    \luatexcrampedtextstyle
  \tex_let:D \tex_fontid:D              \luatexfontid
  \tex_let:D \tex_formatname:D          \luatexformatname
  \tex_let:D \tex_gleaders:D            \luatexgleaders
  \tex_let:D \tex_initcatcodetable:D    \luatexinitcatcodetable
  \tex_let:D \tex_latelua:D             \luatexlatelua
  \tex_let:D \tex_luaescapestring:D     \luatexluaescapestring
  \tex_let:D \tex_luafunction:D         \luatexluafunction
  \tex_let:D \tex_mathstyle:D           \luatexmathstyle
  \tex_let:D \tex_nokerns:D             \luatexnokerns
  \tex_let:D \tex_noligs:D              \luatexnoligs
  \tex_let:D \tex_outputbox:D           \luatexoutputbox
  \tex_let:D \tex_pageleftoffset:D      \luatexpageleftoffset
  \tex_let:D \tex_pagetopoffset:D       \luatexpagetopoffset
  \tex_let:D \tex_postexhyphenchar:D    \luatexpostexhyphenchar
  \tex_let:D \tex_posthyphenchar:D      \luatexposthyphenchar
  \tex_let:D \tex_preexhyphenchar:D     \luatexpreexhyphenchar
  \tex_let:D \tex_prehyphenchar:D       \luatexprehyphenchar
  \tex_let:D \tex_savecatcodetable:D    \luatexsavecatcodetable
  \tex_let:D \tex_scantextokens:D       \luatexscantextokens
  \tex_let:D \tex_suppressifcsnameerror:D
    \luatexsuppressifcsnameerror
  \tex_let:D \tex_suppresslongerror:D   \luatexsuppresslongerror
  \tex_let:D \tex_suppressmathparerror:D
    \luatexsuppressmathparerror
  \tex_let:D \tex_suppressoutererror:D  \luatexsuppressoutererror
  \tex_let:D \tex_Uchar:D                  \luatexUchar
  \tex_let:D \tex_suppressfontnotfounderror:D
    \luatexsuppressfontnotfounderror
  \tex_let:D \tex_bodydir:D             \luatexbodydir
  \tex_let:D \tex_boxdir:D              \luatexboxdir
  \tex_let:D \tex_leftghost:D           \luatexleftghost
  \tex_let:D \tex_localbrokenpenalty:D  \luatexlocalbrokenpenalty
  \tex_let:D \tex_localinterlinepenalty:D
    \luatexlocalinterlinepenalty
  \tex_let:D \tex_localleftbox:D        \luatexlocalleftbox
  \tex_let:D \tex_localrightbox:D       \luatexlocalrightbox
  \tex_let:D \tex_mathdir:D             \luatexmathdir
  \tex_let:D \tex_pagebottomoffset:D    \luatexpagebottomoffset
  \tex_let:D \tex_pagedir:D             \luatexpagedir
  \tex_let:D \tex_pageheight:D             \luatexpageheight
  \tex_let:D \tex_pagerightoffset:D     \luatexpagerightoffset
  \tex_let:D \tex_pagewidth:D              \luatexpagewidth
  \tex_let:D \tex_pardir:D              \luatexpardir
  \tex_let:D \tex_rightghost:D          \luatexrightghost
  \tex_let:D \tex_textdir:D             \luatextextdir
\tex_fi:D
\tex_ifnum:D 0
  \tex_ifdefined:D \tex_pdftexversion:D 1 \tex_fi:D
  \tex_ifdefined:D \tex_luatexversion:D 1 \tex_fi:D
    = 0 %
  \tex_let:D \tex_mapfile:D \tex_undefined:D
  \tex_let:D \tex_mapline:D \tex_undefined:D
\tex_fi:D
\tex_begingroup:D
  \tex_edef:D \l_tmpa_tl { \tex_meaning:D \tex_time:D }
  \tex_edef:D \l_tmpb_tl { \tex_string:D \time }
  \tex_ifx:D \l_tmpa_tl \l_tmpb_tl
  \tex_else:D
    \tex_global:D \tex_let:D \tex_time:D \tex_undefined:D
  \tex_fi:D
  \tex_edef:D \l_tmpa_tl { \tex_meaning:D \tex_day:D }
  \tex_edef:D \l_tmpb_tl { \tex_string:D \day }
  \tex_ifx:D \l_tmpa_tl \l_tmpb_tl
  \tex_else:D
    \tex_global:D \tex_let:D \tex_day:D \tex_undefined:D
  \tex_fi:D
  \tex_edef:D \l_tmpa_tl { \tex_meaning:D \tex_month:D }
  \tex_edef:D \l_tmpb_tl { \tex_string:D \month }
  \tex_ifx:D \l_tmpa_tl \l_tmpb_tl
  \tex_else:D
    \tex_global:D \tex_let:D \tex_month:D \tex_undefined:D
  \tex_fi:D
  \tex_edef:D \l_tmpa_tl { \tex_meaning:D \tex_year:D }
  \tex_edef:D \l_tmpb_tl { \tex_string:D \year }
  \tex_ifx:D \l_tmpa_tl \l_tmpb_tl
  \tex_else:D
    \tex_global:D \tex_let:D \tex_year:D \tex_undefined:D
  \tex_fi:D
\tex_endgroup:D
\tex_ifdefined:D \tex_luatexversion:D
  \tex_let:D \tex_pdftexbanner:D   \tex_undefined:D
  \tex_let:D \tex_pdftexrevision:D \tex_undefined:D
  \tex_let:D \tex_pdftexversion:D  \tex_undefined:D
\tex_fi:D
\tex_ifdefined:D \orieveryjob
  \tex_let:D \tex_everyjob:D \orieveryjob
\tex_fi:D
\tex_ifdefined:D \oripdfoutput
  \tex_let:D \tex_pdfoutput:D \oripdfoutput
\tex_fi:D
\tex_ifdefined:D \normalend
  \tex_let:D \tex_end:D         \normalend
  \tex_let:D \tex_everyjob:D    \normaleveryjob
  \tex_let:D \tex_input:D       \normalinput
  \tex_let:D \tex_language:D    \normallanguage
  \tex_let:D \tex_mathop:D      \normalmathop
  \tex_let:D \tex_month:D       \normalmonth
  \tex_let:D \tex_outer:D       \normalouter
  \tex_let:D \tex_over:D        \normalover
  \tex_let:D \tex_vcenter:D     \normalvcenter
  \tex_let:D \tex_unexpanded:D  \normalunexpanded
  \tex_let:D \tex_expanded:D    \normalexpanded
\tex_fi:D
\tex_ifdefined:D \normalitaliccorrection
  \tex_let:D \tex_hoffset:D          \normalhoffset
  \tex_let:D \tex_italiccorrection:D \normalitaliccorrection
  \tex_let:D \tex_voffset:D          \normalvoffset
  \tex_let:D \tex_showtokens:D       \normalshowtokens
  \tex_let:D \tex_bodydir:D          \spac_directions_normal_body_dir
  \tex_let:D \tex_pagedir:D          \spac_directions_normal_page_dir
\tex_fi:D
\tex_ifdefined:D \normalleft
  \tex_let:D \tex_left:D   \normalleft
  \tex_let:D \tex_middle:D \normalmiddle
  \tex_let:D \tex_right:D  \normalright
\tex_fi:D
%% File: l3basics.dtx
\tex_let:D \if_true:           \tex_iftrue:D
\tex_let:D \if_false:          \tex_iffalse:D
\tex_let:D \or:                \tex_or:D
\tex_let:D \else:              \tex_else:D
\tex_let:D \fi:                \tex_fi:D
\tex_let:D \reverse_if:N       \tex_unless:D
\tex_let:D \if:w               \tex_if:D
\tex_let:D \if_charcode:w      \tex_if:D
\tex_let:D \if_catcode:w       \tex_ifcat:D
\tex_let:D \if_meaning:w       \tex_ifx:D
\tex_let:D \if_bool:N          \tex_ifodd:D
\tex_let:D \if_mode_math:       \tex_ifmmode:D
\tex_let:D \if_mode_horizontal: \tex_ifhmode:D
\tex_let:D \if_mode_vertical:   \tex_ifvmode:D
\tex_let:D \if_mode_inner:      \tex_ifinner:D
\tex_let:D \if_cs_exist:N      \tex_ifdefined:D
\tex_let:D \if_cs_exist:w      \tex_ifcsname:D
\tex_let:D \cs:w               \tex_csname:D
\tex_let:D \cs_end:            \tex_endcsname:D
\tex_let:D \exp_after:wN       \tex_expandafter:D
\tex_let:D \exp_not:N          \tex_noexpand:D
\tex_let:D \exp_not:n          \tex_unexpanded:D
\tex_let:D \exp:w              \tex_romannumeral:D
\tex_chardef:D \exp_end:  = 0 ~
\tex_let:D \token_to_meaning:N \tex_meaning:D
\tex_let:D \cs_meaning:N       \tex_meaning:D
\tex_let:D \tl_to_str:n          \tex_detokenize:D
\tex_let:D \token_to_str:N       \tex_string:D
\tex_let:D \__kernel_tl_to_str:w \tex_detokenize:D
\tex_let:D \scan_stop:         \tex_relax:D
\tex_let:D \group_begin:       \tex_begingroup:D
\tex_let:D \group_end:         \tex_endgroup:D
\tex_let:D \if_int_compare:w   \tex_ifnum:D
\tex_let:D \__int_to_roman:w     \tex_romannumeral:D
\tex_let:D \group_insert_after:N \tex_aftergroup:D
\tex_long:D \tex_def:D \exp_args:Nc #1#2
  { \exp_after:wN #1 \cs:w #2 \cs_end: }
\tex_long:D \tex_def:D \exp_args:cc #1#2
  { \cs:w #1 \exp_after:wN \cs_end: \cs:w #2 \cs_end: }
\tex_def:D \token_to_str:c { \exp_args:Nc \token_to_str:N }
\tex_long:D \tex_def:D \cs_meaning:c #1
  {
    \if_cs_exist:w #1 \cs_end:
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
    { \exp_args:Nc \cs_meaning:N {#1} }
    { \tl_to_str:n {undefined} }
  }
\tex_let:D \token_to_meaning:c = \cs_meaning:c
\tex_chardef:D \c_zero_int    = 0 ~
\tex_ifdefined:D \tex_luatexversion:D
  \tex_chardef:D \c_max_register_int = 65 535 ~
\tex_else:D
  \tex_ifdefined:D \tex_omathchardef:D
    \tex_omathchardef:D \c_max_register_int = 65535 ~
  \tex_else:D
    \tex_mathchardef:D \c_max_register_int = 32767 ~
  \tex_fi:D
\tex_fi:D
\tex_let:D \cs_set_nopar:Npn            \tex_def:D
\tex_let:D \cs_set_nopar:Npx            \tex_edef:D
\tex_protected:D \tex_long:D \tex_def:D \cs_set:Npn
  { \tex_long:D \tex_def:D }
\tex_protected:D \tex_long:D \tex_def:D \cs_set:Npx
  { \tex_long:D \tex_edef:D }
\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected_nopar:Npn
  { \tex_protected:D \tex_def:D }
\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected_nopar:Npx
  { \tex_protected:D \tex_edef:D }
\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected:Npn
  { \tex_protected:D \tex_long:D \tex_def:D }
\tex_protected:D \tex_long:D \tex_def:D \cs_set_protected:Npx
  { \tex_protected:D \tex_long:D \tex_edef:D }
\tex_let:D \cs_gset_nopar:Npn           \tex_gdef:D
\tex_let:D \cs_gset_nopar:Npx           \tex_xdef:D
\cs_set_protected:Npn \cs_gset:Npn
  { \tex_long:D \tex_gdef:D }
\cs_set_protected:Npn \cs_gset:Npx
  { \tex_long:D \tex_xdef:D }
\cs_set_protected:Npn \cs_gset_protected_nopar:Npn
  { \tex_protected:D \tex_gdef:D }
\cs_set_protected:Npn \cs_gset_protected_nopar:Npx
  { \tex_protected:D \tex_xdef:D }
\cs_set_protected:Npn \cs_gset_protected:Npn
  { \tex_protected:D \tex_long:D \tex_gdef:D }
\cs_set_protected:Npn \cs_gset_protected:Npx
  { \tex_protected:D \tex_long:D \tex_xdef:D }
\cs_set_nopar:Npn \l__exp_internal_tl { }
\cs_set:Npn \use:c #1 { \cs:w #1 \cs_end: }
\cs_set_protected:Npn \use:x #1
  {
    \cs_set_nopar:Npx \l__exp_internal_tl {#1}
    \l__exp_internal_tl
  }
\cs_set:Npn \use:e #1 { \tex_expanded:D {#1} }
\tex_ifdefined:D \tex_expanded:D \tex_else:D
  \cs_set:Npn \use:e #1 { \exp_args:Ne \use:n {#1} }
\tex_fi:D
\cs_set:Npn \use:n    #1       {#1}
\cs_set:Npn \use:nn   #1#2     {#1#2}
\cs_set:Npn \use:nnn  #1#2#3   {#1#2#3}
\cs_set:Npn \use:nnnn #1#2#3#4 {#1#2#3#4}
\cs_set:Npn \use_i:nn  #1#2 {#1}
\cs_set:Npn \use_ii:nn #1#2 {#2}
\cs_set:Npn \use_i:nnn    #1#2#3 {#1}
\cs_set:Npn \use_ii:nnn   #1#2#3 {#2}
\cs_set:Npn \use_iii:nnn  #1#2#3 {#3}
\cs_set:Npn \use_i_ii:nnn #1#2#3 {#1#2}
\cs_set:Npn \use_i:nnnn   #1#2#3#4 {#1}
\cs_set:Npn \use_ii:nnnn  #1#2#3#4 {#2}
\cs_set:Npn \use_iii:nnnn #1#2#3#4 {#3}
\cs_set:Npn \use_iv:nnnn  #1#2#3#4 {#4}
\cs_set:Npn \use_ii_i:nn #1#2 { #2 #1 }
\cs_set:Npn \use_none_delimit_by_q_nil:w  #1 \q_nil  { }
\cs_set:Npn \use_none_delimit_by_q_stop:w #1 \q_stop { }
\cs_set:Npn \use_none_delimit_by_q_recursion_stop:w #1 \q_recursion_stop { }
\cs_set:Npn \use_i_delimit_by_q_nil:nw  #1#2 \q_nil  {#1}
\cs_set:Npn \use_i_delimit_by_q_stop:nw #1#2 \q_stop {#1}
\cs_set:Npn \use_i_delimit_by_q_recursion_stop:nw
  #1#2 \q_recursion_stop {#1}
\cs_set:Npn \use_none:n         #1                 { }
\cs_set:Npn \use_none:nn        #1#2               { }
\cs_set:Npn \use_none:nnn       #1#2#3             { }
\cs_set:Npn \use_none:nnnn      #1#2#3#4           { }
\cs_set:Npn \use_none:nnnnn     #1#2#3#4#5         { }
\cs_set:Npn \use_none:nnnnnn    #1#2#3#4#5#6       { }
\cs_set:Npn \use_none:nnnnnnn   #1#2#3#4#5#6#7     { }
\cs_set:Npn \use_none:nnnnnnnn  #1#2#3#4#5#6#7#8   { }
\cs_set:Npn \use_none:nnnnnnnnn #1#2#3#4#5#6#7#8#9 { }
\cs_set_protected:Npn \__kernel_if_debug:TF #1#2 {#2}
\cs_set_protected:Npn \debug_on:n #1
  {
    \__kernel_msg_error:nnx { kernel } { enable-debug }
      { \tl_to_str:n { \debug_on:n {#1} } }
  }
\cs_set_protected:Npn \debug_off:n #1
  {
    \__kernel_msg_error:nnx { kernel } { enable-debug }
       { \tl_to_str:n { \debug_off:n {#1} } }
  }
\cs_set_protected:Npn \debug_suspend: { }
\cs_set_protected:Npn \debug_resume: { }
\cs_set_nopar:Npn \g__debug_deprecation_on_tl { }
\cs_set_nopar:Npn \g__debug_deprecation_off_tl { }
\cs_set_protected:Npn \__kernel_deprecation_code:nn #1#2
  {
    \tl_gput_right:Nn \g__debug_deprecation_on_tl {#1}
    \tl_gput_right:Nn \g__debug_deprecation_off_tl {#2}
  }
\cs_set:Npn \prg_return_true:
  { \exp_after:wN \use_i:nn  \exp:w }
\cs_set:Npn \prg_return_false:
  { \exp_after:wN \use_ii:nn \exp:w}
\cs_set:Npn \__prg_use_none_delimit_by_q_recursion_stop:w
  #1 \q__prg_recursion_stop { }
\cs_set_protected:Npn \prg_set_conditional:Npnn
  { \__prg_generate_conditional_parm:NNNpnn \cs_set:Npn e }
\cs_set_protected:Npn \prg_new_conditional:Npnn
  { \__prg_generate_conditional_parm:NNNpnn \cs_new:Npn e }
\cs_set_protected:Npn \prg_set_protected_conditional:Npnn
  { \__prg_generate_conditional_parm:NNNpnn \cs_set_protected:Npn p }
\cs_set_protected:Npn \prg_new_protected_conditional:Npnn
  { \__prg_generate_conditional_parm:NNNpnn \cs_new_protected:Npn p }
\cs_set_protected:Npn \__prg_generate_conditional_parm:NNNpnn #1#2#3#4#
  {
    \use:x
      {
        \__prg_generate_conditional:nnNNNnnn
          \cs_split_function:N #3
      }
      #1 #2 {#4}
  }
\cs_set_protected:Npn \prg_set_conditional:Nnn
  { \__prg_generate_conditional_count:NNNnn \cs_set:Npn e }
\cs_set_protected:Npn \prg_new_conditional:Nnn
  { \__prg_generate_conditional_count:NNNnn \cs_new:Npn e }
\cs_set_protected:Npn \prg_set_protected_conditional:Nnn
  { \__prg_generate_conditional_count:NNNnn \cs_set_protected:Npn p }
\cs_set_protected:Npn \prg_new_protected_conditional:Nnn
  { \__prg_generate_conditional_count:NNNnn \cs_new_protected:Npn p }
\cs_set_protected:Npn \__prg_generate_conditional_count:NNNnn #1#2#3
  {
    \use:x
      {
        \__prg_generate_conditional_count:nnNNNnn
        \cs_split_function:N #3
      }
      #1 #2
  }
\cs_set_protected:Npn \__prg_generate_conditional_count:nnNNNnn #1#2#3#4#5
  {
    \__kernel_cs_parm_from_arg_count:nnF
      { \__prg_generate_conditional:nnNNNnnn {#1} {#2} #3 #4 #5 }
      { \tl_count:n {#2} }
      {
        \__kernel_msg_error:nnxx { kernel } { bad-number-of-arguments }
          { \token_to_str:c { #1 : #2 } }
          { \tl_count:n {#2} }
        \use_none:nn
      }
  }
\cs_set_protected:Npn \__prg_generate_conditional:nnNNNnnn #1#2#3#4#5#6#7#8
  {
    \if_meaning:w \c_false_bool #3
      \__kernel_msg_error:nnx { kernel } { missing-colon }
        { \token_to_str:c {#1} }
      \exp_after:wN \use_none:nn
    \fi:
    \use:x
      {
        \exp_not:N \__prg_generate_conditional:NNnnnnNw
        \exp_not:n { #4 #5 {#1} {#2} {#6} }
        \__prg_generate_conditional_test:w
          #8 \s__prg_mark
            \__prg_generate_conditional_fast:nw
          \prg_return_true: \else: \prg_return_false: \fi: \s__prg_mark
            \use_none:n
        \exp_not:n { {#8} \use_i_ii:nnn }
        \tl_to_str:n {#7}
        \exp_not:n { , \q__prg_recursion_tail , \q__prg_recursion_stop }
      }
  }
\cs_set:Npn \__prg_generate_conditional_test:w
    #1 \prg_return_true: \else: \prg_return_false: \fi: \s__prg_mark #2
  { #2 {#1} }
\cs_set:Npn \__prg_generate_conditional_fast:nw #1#2 \exp_not:n #3
  { \exp_not:n { {#1} \use_i:nn } }
\cs_set_protected:Npn \__prg_generate_conditional:NNnnnnNw #1#2#3#4#5#6#7#8 ,
  {
    \if_meaning:w \q__prg_recursion_tail #8
      \exp_after:wN \__prg_use_none_delimit_by_q_recursion_stop:w
    \fi:
    \use:c { __prg_generate_ #8 _form:wNNnnnnN }
        \tl_if_empty:nF {#8}
          {
            \__kernel_msg_error:nnxx
              { kernel } { conditional-form-unknown }
              {#8} { \token_to_str:c { #3 : #4 } }
          }
        \use_none:nnnnnnnn
      \s__prg_stop
      #1 #2 {#3} {#4} {#5} {#6} #7
    \__prg_generate_conditional:NNnnnnNw #1 #2 {#3} {#4} {#5} {#6} #7
  }
\cs_set_protected:Npn \__prg_generate_p_form:wNNnnnnN
    #1 \s__prg_stop #2#3#4#5#6#7#8
  {
    \if_meaning:w e #3
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
      {
        #8
          { \exp_args:Nc #2 { #4 _p: #5 } #6 }
          { { #7 \exp_end: \c_true_bool \c_false_bool } }
          { #7 \__prg_p_true:w \fi: \c_false_bool }
      }
      {
        \__kernel_msg_error:nnx { kernel } { protected-predicate }
          { \token_to_str:c { #4 _p: #5 } }
      }
  }
\cs_set_protected:Npn \__prg_generate_T_form:wNNnnnnN
    #1 \s__prg_stop #2#3#4#5#6#7#8
  {
    #8
      { \exp_args:Nc #2 { #4 : #5 T } #6 }
      { { #7 \exp_end: \use:n \use_none:n } }
      { #7 \exp_after:wN \use_ii:nn \fi: \use_none:n }
  }
\cs_set_protected:Npn \__prg_generate_F_form:wNNnnnnN
    #1 \s__prg_stop #2#3#4#5#6#7#8
  {
    #8
      { \exp_args:Nc #2 { #4 : #5 F } #6 }
      { { #7 \exp_end: { } } }
      { #7 \exp_after:wN \use_none:nn \fi: \use:n }
  }
\cs_set_protected:Npn \__prg_generate_TF_form:wNNnnnnN
    #1 \s__prg_stop #2#3#4#5#6#7#8
  {
    #8
      { \exp_args:Nc #2 { #4 : #5 TF } #6 }
      { { #7 \exp_end: } }
      { #7 \exp_after:wN \use_ii:nnn \fi: \use_ii:nn }
  }
\cs_set:Npn \__prg_p_true:w \fi: \c_false_bool { \fi: \c_true_bool }
\cs_set_protected:Npn \prg_set_eq_conditional:NNn
  { \__prg_set_eq_conditional:NNNn \cs_set_eq:cc }
\cs_set_protected:Npn \prg_new_eq_conditional:NNn
  { \__prg_set_eq_conditional:NNNn \cs_new_eq:cc }
\cs_set_protected:Npn \__prg_set_eq_conditional:NNNn #1#2#3#4
  {
    \use:x
      {
        \exp_not:N \__prg_set_eq_conditional:nnNnnNNw
          \cs_split_function:N #2
          \cs_split_function:N #3
          \exp_not:N #1
          \tl_to_str:n {#4}
          \exp_not:n { , \q__prg_recursion_tail , \q__prg_recursion_stop }
      }
  }
\cs_set_protected:Npn \__prg_set_eq_conditional:nnNnnNNw #1#2#3#4#5#6
  {
    \if_meaning:w \c_false_bool #3
      \__kernel_msg_error:nnx { kernel } { missing-colon }
        { \token_to_str:c {#1} }
      \exp_after:wN \__prg_use_none_delimit_by_q_recursion_stop:w
    \fi:
    \if_meaning:w \c_false_bool #6
      \__kernel_msg_error:nnx { kernel } { missing-colon }
        { \token_to_str:c {#4} }
      \exp_after:wN \__prg_use_none_delimit_by_q_recursion_stop:w
    \fi:
    \__prg_set_eq_conditional_loop:nnnnNw {#1} {#2} {#4} {#5}
  }
\cs_set_protected:Npn \__prg_set_eq_conditional_loop:nnnnNw #1#2#3#4#5#6 ,
  {
    \if_meaning:w \q__prg_recursion_tail #6
      \exp_after:wN \__prg_use_none_delimit_by_q_recursion_stop:w
    \fi:
    \use:c { __prg_set_eq_conditional_ #6 _form:wNnnnn }
        \tl_if_empty:nF {#6}
          {
            \__kernel_msg_error:nnxx
              { kernel } { conditional-form-unknown }
              {#6} { \token_to_str:c { #1 : #2 } }
          }
        \use_none:nnnnnn
      \s__prg_stop
      #5 {#1} {#2} {#3} {#4}
    \__prg_set_eq_conditional_loop:nnnnNw {#1} {#2} {#3} {#4} #5
  }
\cs_set:Npn \__prg_set_eq_conditional_p_form:wNnnnn #1 \s__prg_stop #2#3#4#5#6
  { #2 { #3 _p : #4    }    { #5 _p : #6    } }
\cs_set:Npn \__prg_set_eq_conditional_TF_form:wNnnnn #1 \s__prg_stop #2#3#4#5#6
  { #2 { #3    : #4 TF }    { #5    : #6 TF } }
\cs_set:Npn \__prg_set_eq_conditional_T_form:wNnnnn #1 \s__prg_stop #2#3#4#5#6
  { #2 { #3    : #4 T  }    { #5    : #6 T  } }
\cs_set:Npn \__prg_set_eq_conditional_F_form:wNnnnn #1 \s__prg_stop #2#3#4#5#6
  { #2 { #3    : #4  F }    { #5    : #6  F } }
\tex_chardef:D \c_true_bool  = 1 ~
\tex_chardef:D \c_false_bool = 0 ~
\cs_set:Npn \cs_to_str:N
  {
    \tex_romannumeral:D
      \if:w \token_to_str:N \ \__cs_to_str:w \fi:
      \exp_after:wN \__cs_to_str:N \token_to_str:N
  }
\cs_set:Npn \__cs_to_str:N #1 { \c_zero_int }
\cs_set:Npn \__cs_to_str:w #1 \__cs_to_str:N
  { - \int_value:w \fi: \exp_after:wN \c_zero_int }
\cs_set_protected:Npn \__cs_tmp:w #1
  {
    \cs_set:Npn \cs_split_function:N ##1
      {
        \exp_after:wN \exp_after:wN \exp_after:wN
        \__cs_split_function_auxi:w
          \cs_to_str:N ##1 \s__cs_mark \c_true_bool
          #1 \s__cs_mark \c_false_bool \s__cs_stop
      }
    \cs_set:Npn \__cs_split_function_auxi:w
        ##1 #1 ##2 \s__cs_mark ##3##4 \s__cs_stop
      { \__cs_split_function_auxii:w ##1 \s__cs_mark \s__cs_stop {##2} ##3 }
    \cs_set:Npn \__cs_split_function_auxii:w ##1 \s__cs_mark ##2 \s__cs_stop
      { {##1} }
  }
\exp_after:wN \__cs_tmp:w \token_to_str:N :
\prg_set_conditional:Npnn \cs_if_exist:N #1 { p , T , F , TF }
  {
    \if_meaning:w #1 \scan_stop:
      \prg_return_false:
    \else:
      \if_cs_exist:N #1
        \prg_return_true:
      \else:
        \prg_return_false:
      \fi:
    \fi:
  }
\prg_set_conditional:Npnn \cs_if_exist:c #1 { p , T , F , TF }
  {
    \if_cs_exist:w #1 \cs_end:
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
    {
      \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop:
        \prg_return_false:
      \else:
        \prg_return_true:
      \fi:
    }
    \prg_return_false:
  }
\prg_set_conditional:Npnn \cs_if_free:N #1 { p , T , F , TF }
  {
    \if_meaning:w #1 \scan_stop:
      \prg_return_true:
    \else:
      \if_cs_exist:N #1
        \prg_return_false:
      \else:
        \prg_return_true:
      \fi:
    \fi:
  }
\prg_set_conditional:Npnn \cs_if_free:c #1 { p , T , F , TF }
  {
    \if_cs_exist:w #1 \cs_end:
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
      {
        \exp_after:wN \if_meaning:w \cs:w #1 \cs_end: \scan_stop:
          \prg_return_true:
        \else:
          \prg_return_false:
        \fi:
      }
      { \prg_return_true: }
  }
\cs_set:Npn \cs_if_exist_use:NTF #1#2
  { \cs_if_exist:NTF #1 { #1 #2 } }
\cs_set:Npn \cs_if_exist_use:NF #1
  { \cs_if_exist:NTF #1 { #1 } }
\cs_set:Npn \cs_if_exist_use:NT #1 #2
  { \cs_if_exist:NTF #1 { #1 #2 } { } }
\cs_set:Npn \cs_if_exist_use:N #1
  { \cs_if_exist:NTF #1 { #1 } { } }
\cs_set:Npn \cs_if_exist_use:cTF #1#2
  { \cs_if_exist:cTF {#1} { \use:c {#1} #2 } }
\cs_set:Npn \cs_if_exist_use:cF #1
  { \cs_if_exist:cTF {#1} { \use:c {#1} } }
\cs_set:Npn \cs_if_exist_use:cT #1#2
  { \cs_if_exist:cTF {#1} { \use:c {#1} #2 } { } }
\cs_set:Npn \cs_if_exist_use:c #1
  { \cs_if_exist:cTF {#1} { \use:c {#1} } { } }
\cs_set_protected:Npn \__kernel_msg_error:nnxx #1#2#3#4
  {
    \tex_newlinechar:D = `\^^J \scan_stop:
    \tex_errmessage:D
      {
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!~! ^^J
        Argh,~internal~LaTeX3~error! ^^J ^^J
        Module ~ #1 , ~ message~name~"#2": ^^J
        Arguments~'#3'~and~'#4' ^^J ^^J
        This~is~one~for~The~LaTeX3~Project:~bailing~out
      }
    \tex_end:D
  }
\cs_set_protected:Npn \__kernel_msg_error:nnx #1#2#3
  { \__kernel_msg_error:nnxx {#1} {#2} {#3} { } }
\cs_set_protected:Npn \__kernel_msg_error:nn #1#2
  { \__kernel_msg_error:nnxx {#1} {#2} { } { } }
\cs_set:Npn \msg_line_context:
  { on~line~ \tex_the:D \tex_inputlineno:D }
\cs_set_protected:Npn \iow_log:x
  { \tex_immediate:D \tex_write:D -1 }
\cs_set_protected:Npn \iow_term:x
  { \tex_immediate:D \tex_write:D 16 }
\cs_set_protected:Npn \__kernel_chk_if_free_cs:N #1
  {
    \cs_if_free:NF #1
      {
        \__kernel_msg_error:nnxx { kernel } { command-already-defined }
          { \token_to_str:N #1 } { \token_to_meaning:N #1 }
      }
  }
\cs_set_protected:Npn \__kernel_chk_if_free_cs:c
  { \exp_args:Nc \__kernel_chk_if_free_cs:N }
\cs_set:Npn \__cs_tmp:w #1#2
  {
    \cs_set_protected:Npn #1 ##1
       {
         \__kernel_chk_if_free_cs:N ##1
         #2 ##1
      }
  }
\__cs_tmp:w \cs_new_nopar:Npn           \cs_gset_nopar:Npn
\__cs_tmp:w \cs_new_nopar:Npx           \cs_gset_nopar:Npx
\__cs_tmp:w \cs_new:Npn                 \cs_gset:Npn
\__cs_tmp:w \cs_new:Npx                 \cs_gset:Npx
\__cs_tmp:w \cs_new_protected_nopar:Npn \cs_gset_protected_nopar:Npn
\__cs_tmp:w \cs_new_protected_nopar:Npx \cs_gset_protected_nopar:Npx
\__cs_tmp:w \cs_new_protected:Npn       \cs_gset_protected:Npn
\__cs_tmp:w \cs_new_protected:Npx       \cs_gset_protected:Npx
\cs_set:Npn \__cs_tmp:w #1#2
  { \cs_new_protected_nopar:Npn #1 { \exp_args:Nc #2 } }
\__cs_tmp:w \cs_set_nopar:cpn  \cs_set_nopar:Npn
\__cs_tmp:w \cs_set_nopar:cpx  \cs_set_nopar:Npx
\__cs_tmp:w \cs_gset_nopar:cpn \cs_gset_nopar:Npn
\__cs_tmp:w \cs_gset_nopar:cpx \cs_gset_nopar:Npx
\__cs_tmp:w \cs_new_nopar:cpn  \cs_new_nopar:Npn
\__cs_tmp:w \cs_new_nopar:cpx  \cs_new_nopar:Npx
\__cs_tmp:w \cs_set:cpn  \cs_set:Npn
\__cs_tmp:w \cs_set:cpx  \cs_set:Npx
\__cs_tmp:w \cs_gset:cpn \cs_gset:Npn
\__cs_tmp:w \cs_gset:cpx \cs_gset:Npx
\__cs_tmp:w \cs_new:cpn  \cs_new:Npn
\__cs_tmp:w \cs_new:cpx  \cs_new:Npx
\__cs_tmp:w \cs_set_protected_nopar:cpn  \cs_set_protected_nopar:Npn
\__cs_tmp:w \cs_set_protected_nopar:cpx  \cs_set_protected_nopar:Npx
\__cs_tmp:w \cs_gset_protected_nopar:cpn \cs_gset_protected_nopar:Npn
\__cs_tmp:w \cs_gset_protected_nopar:cpx \cs_gset_protected_nopar:Npx
\__cs_tmp:w \cs_new_protected_nopar:cpn  \cs_new_protected_nopar:Npn
\__cs_tmp:w \cs_new_protected_nopar:cpx  \cs_new_protected_nopar:Npx
\__cs_tmp:w \cs_set_protected:cpn  \cs_set_protected:Npn
\__cs_tmp:w \cs_set_protected:cpx  \cs_set_protected:Npx
\__cs_tmp:w \cs_gset_protected:cpn \cs_gset_protected:Npn
\__cs_tmp:w \cs_gset_protected:cpx \cs_gset_protected:Npx
\__cs_tmp:w \cs_new_protected:cpn  \cs_new_protected:Npn
\__cs_tmp:w \cs_new_protected:cpx  \cs_new_protected:Npx
\cs_new_protected:Npn \cs_set_eq:NN #1 { \tex_let:D #1 =~ }
\cs_new_protected:Npn \cs_set_eq:cN { \exp_args:Nc  \cs_set_eq:NN }
\cs_new_protected:Npn \cs_set_eq:Nc { \exp_args:NNc \cs_set_eq:NN }
\cs_new_protected:Npn \cs_set_eq:cc { \exp_args:Ncc \cs_set_eq:NN }
\cs_new_protected:Npn \cs_gset_eq:NN { \tex_global:D  \cs_set_eq:NN }
\cs_new_protected:Npn \cs_gset_eq:Nc { \exp_args:NNc  \cs_gset_eq:NN }
\cs_new_protected:Npn \cs_gset_eq:cN { \exp_args:Nc   \cs_gset_eq:NN }
\cs_new_protected:Npn \cs_gset_eq:cc { \exp_args:Ncc  \cs_gset_eq:NN }
\cs_new_protected:Npn \cs_new_eq:NN #1
  {
    \__kernel_chk_if_free_cs:N #1
    \tex_global:D \cs_set_eq:NN #1
  }
\cs_new_protected:Npn \cs_new_eq:cN { \exp_args:Nc  \cs_new_eq:NN }
\cs_new_protected:Npn \cs_new_eq:Nc { \exp_args:NNc \cs_new_eq:NN }
\cs_new_protected:Npn \cs_new_eq:cc { \exp_args:Ncc \cs_new_eq:NN }
\cs_new_protected:Npn \cs_undefine:N #1
  { \cs_gset_eq:NN #1 \tex_undefined:D }
\cs_new_protected:Npn \cs_undefine:c #1
  {
    \if_cs_exist:w #1 \cs_end:
      \exp_after:wN \use:n
    \else:
      \exp_after:wN \use_none:n
    \fi:
    { \cs_gset_eq:cN {#1} \tex_undefined:D }
  }
\cs_set_protected:Npn \__kernel_cs_parm_from_arg_count:nnF #1#2
  {
    \exp_args:Nx \__cs_parm_from_arg_count_test:nnF
      {
        \exp_after:wN \exp_not:n
        \if_case:w \int_eval:n {#2}
             { }
        \or: { ##1 }
        \or: { ##1##2 }
        \or: { ##1##2##3 }
        \or: { ##1##2##3##4 }
        \or: { ##1##2##3##4##5 }
        \or: { ##1##2##3##4##5##6 }
        \or: { ##1##2##3##4##5##6##7 }
        \or: { ##1##2##3##4##5##6##7##8 }
        \or: { ##1##2##3##4##5##6##7##8##9 }
        \else: { \c_false_bool }
        \fi:
      }
      {#1}
  }
\cs_set_protected:Npn \__cs_parm_from_arg_count_test:nnF #1#2
  {
    \if_meaning:w \c_false_bool #1
      \exp_after:wN \use_ii:nn
    \else:
      \exp_after:wN \use_i:nn
    \fi:
    { #2 {#1} }
  }
\cs_new:Npn \__cs_count_signature:N #1
  { \exp_args:Nf \__cs_count_signature:n { \cs_split_function:N #1 } }
\cs_new:Npn \__cs_count_signature:n #1
  { \int_eval:n { \__cs_count_signature:nnN #1 } }
\cs_new:Npn \__cs_count_signature:nnN #1#2#3
  {
    \if_meaning:w \c_true_bool #3
      \tl_count:n {#2}
    \else:
      -1
    \fi:
  }
\cs_new:Npn \__cs_count_signature:c
  { \exp_args:Nc \__cs_count_signature:N }
\cs_new_protected:Npn \cs_generate_from_arg_count:NNnn #1#2#3#4
  {
    \__kernel_cs_parm_from_arg_count:nnF { \use:nnn #2 #1 } {#3}
      {
        \__kernel_msg_error:nnxx { kernel } { bad-number-of-arguments }
          { \token_to_str:N #1 } { \int_eval:n {#3} }
        \use_none:n
      }
      {#4}
  }
\cs_new_protected:Npn \cs_generate_from_arg_count:cNnn
  { \exp_args:Nc \cs_generate_from_arg_count:NNnn }
\cs_new_protected:Npn \cs_generate_from_arg_count:Ncnn
  { \exp_args:NNc \cs_generate_from_arg_count:NNnn }
\cs_set:Npn \__cs_tmp:w #1#2#3
  {
    \cs_new_protected:cpx { cs_ #1 : #2 }
      {
        \exp_not:N \__cs_generate_from_signature:NNn
        \exp_after:wN \exp_not:N \cs:w cs_ #1 : #3 \cs_end:
      }
  }
\cs_new_protected:Npn \__cs_generate_from_signature:NNn #1#2
  {
    \use:x
      {
        \__cs_generate_from_signature:nnNNNn
        \cs_split_function:N #2
      }
      #1 #2
  }
\cs_new_protected:Npn \__cs_generate_from_signature:nnNNNn #1#2#3#4#5#6
  {
    \bool_if:NTF #3
      {
        \str_if_eq:eeF { }
          { \tl_map_function:nN {#2} \__cs_generate_from_signature:n }
          {
            \__kernel_msg_error:nnx { kernel } { non-base-function }
              { \token_to_str:N #5 }
          }
        \cs_generate_from_arg_count:NNnn
          #5 #4 { \tl_count:n {#2} } {#6}
      }
      {
        \__kernel_msg_error:nnx { kernel } { missing-colon }
          { \token_to_str:N #5 }
      }
  }
\cs_new:Npn \__cs_generate_from_signature:n #1
  {
    \if:w n #1 \else: \if:w N #1 \else:
    \if:w T #1 \else: \if:w F #1 \else: #1 \fi: \fi: \fi: \fi:
  }
\__cs_tmp:w { set }                  { Nn } { Npn }
\__cs_tmp:w { set }                  { Nx } { Npx }
\__cs_tmp:w { set_nopar }            { Nn } { Npn }
\__cs_tmp:w { set_nopar }            { Nx } { Npx }
\__cs_tmp:w { set_protected }        { Nn } { Npn }
\__cs_tmp:w { set_protected }        { Nx } { Npx }
\__cs_tmp:w { set_protected_nopar }  { Nn } { Npn }
\__cs_tmp:w { set_protected_nopar }  { Nx } { Npx }
\__cs_tmp:w { gset }                 { Nn } { Npn }
\__cs_tmp:w { gset }                 { Nx } { Npx }
\__cs_tmp:w { gset_nopar }           { Nn } { Npn }
\__cs_tmp:w { gset_nopar }           { Nx } { Npx }
\__cs_tmp:w { gset_protected }       { Nn } { Npn }
\__cs_tmp:w { gset_protected }       { Nx } { Npx }
\__cs_tmp:w { gset_protected_nopar } { Nn } { Npn }
\__cs_tmp:w { gset_protected_nopar } { Nx } { Npx }
\__cs_tmp:w { new }                  { Nn } { Npn }
\__cs_tmp:w { new }                  { Nx } { Npx }
\__cs_tmp:w { new_nopar }            { Nn } { Npn }
\__cs_tmp:w { new_nopar }            { Nx } { Npx }
\__cs_tmp:w { new_protected }        { Nn } { Npn }
\__cs_tmp:w { new_protected }        { Nx } { Npx }
\__cs_tmp:w { new_protected_nopar }  { Nn } { Npn }
\__cs_tmp:w { new_protected_nopar }  { Nx } { Npx }
\cs_set:Npn \__cs_tmp:w #1#2
  {
    \cs_new_protected:cpx { cs_ #1 : c #2 }
      {
        \exp_not:N \exp_args:Nc
        \exp_after:wN \exp_not:N \cs:w cs_ #1 : N #2 \cs_end:
      }
  }
\__cs_tmp:w { set }                  { n }
\__cs_tmp:w { set }                  { x }
\__cs_tmp:w { set_nopar }            { n }
\__cs_tmp:w { set_nopar }            { x }
\__cs_tmp:w { set_protected }        { n }
\__cs_tmp:w { set_protected }        { x }
\__cs_tmp:w { set_protected_nopar }  { n }
\__cs_tmp:w { set_protected_nopar }  { x }
\__cs_tmp:w { gset }                 { n }
\__cs_tmp:w { gset }                 { x }
\__cs_tmp:w { gset_nopar }           { n }
\__cs_tmp:w { gset_nopar }           { x }
\__cs_tmp:w { gset_protected }       { n }
\__cs_tmp:w { gset_protected }       { x }
\__cs_tmp:w { gset_protected_nopar } { n }
\__cs_tmp:w { gset_protected_nopar } { x }
\__cs_tmp:w { new }                  { n }
\__cs_tmp:w { new }                  { x }
\__cs_tmp:w { new_nopar }            { n }
\__cs_tmp:w { new_nopar }            { x }
\__cs_tmp:w { new_protected }        { n }
\__cs_tmp:w { new_protected }        { x }
\__cs_tmp:w { new_protected_nopar }  { n }
\__cs_tmp:w { new_protected_nopar }  { x }
\prg_new_conditional:Npnn \cs_if_eq:NN #1#2 { p , T , F , TF }
  {
    \if_meaning:w #1#2
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\cs_new:Npn \cs_if_eq_p:cN { \exp_args:Nc  \cs_if_eq_p:NN }
\cs_new:Npn \cs_if_eq:cNTF { \exp_args:Nc  \cs_if_eq:NNTF }
\cs_new:Npn \cs_if_eq:cNT  { \exp_args:Nc  \cs_if_eq:NNT }
\cs_new:Npn \cs_if_eq:cNF  { \exp_args:Nc  \cs_if_eq:NNF }
\cs_new:Npn \cs_if_eq_p:Nc { \exp_args:NNc \cs_if_eq_p:NN }
\cs_new:Npn \cs_if_eq:NcTF { \exp_args:NNc \cs_if_eq:NNTF }
\cs_new:Npn \cs_if_eq:NcT  { \exp_args:NNc \cs_if_eq:NNT }
\cs_new:Npn \cs_if_eq:NcF  { \exp_args:NNc \cs_if_eq:NNF }
\cs_new:Npn \cs_if_eq_p:cc { \exp_args:Ncc \cs_if_eq_p:NN }
\cs_new:Npn \cs_if_eq:ccTF { \exp_args:Ncc \cs_if_eq:NNTF }
\cs_new:Npn \cs_if_eq:ccT  { \exp_args:Ncc \cs_if_eq:NNT }
\cs_new:Npn \cs_if_eq:ccF  { \exp_args:Ncc \cs_if_eq:NNF }
\cs_new_protected:Npn \__kernel_chk_defined:NT #1#2
  {
    \cs_if_exist:NTF #1
      {#2}
      {
        \__kernel_msg_error:nnx { kernel } { variable-not-defined }
          { \token_to_str:N #1 }
      }
  }
\cs_new_protected:Npn \__kernel_register_show:N
  { \__kernel_register_show_aux:NN \tl_show:n }
\cs_new_protected:Npn \__kernel_register_show:c
  { \exp_args:Nc \__kernel_register_show:N }
\cs_new_protected:Npn \__kernel_register_log:N
  { \__kernel_register_show_aux:NN \tl_log:n }
\cs_new_protected:Npn \__kernel_register_log:c
  { \exp_args:Nc \__kernel_register_log:N }
\cs_new_protected:Npn \__kernel_register_show_aux:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      {
        \exp_args:No \__kernel_register_show_aux:nNN
          { \tex_the:D #2 } #2 #1
      }
  }
\cs_new_protected:Npn \__kernel_register_show_aux:nNN #1#2#3
  { \exp_args:No #3 { \token_to_str:N #2 = #1 } }
\cs_new_protected:Npn \cs_show:N { \__kernel_show:NN \tl_show:n }
\cs_new_protected:Npn \cs_show:c
  { \group_begin: \exp_args:NNc \group_end: \cs_show:N }
\cs_new_protected:Npn \cs_log:N { \__kernel_show:NN \tl_log:n }
\cs_new_protected:Npn \cs_log:c
  { \group_begin: \exp_args:NNc \group_end: \cs_log:N }
\cs_new_protected:Npn \__kernel_show:NN #1#2
  {
    \group_begin:
      \int_set:Nn \tex_escapechar:D { `\\ }
      \exp_args:NNx
    \group_end:
    #1 { \token_to_str:N #2 = \cs_meaning:N #2 }
  }
\use:x
  {
    \exp_not:n { \cs_new:Npn \__kernel_prefix_arg_replacement:wN #1 }
    \tl_to_str:n { macro : } \exp_not:n { #2 -> #3 \s__kernel_stop #4 }
  }
  { #4 {#1} {#2} {#3} }
\cs_new:Npn \cs_prefix_spec:N #1
  {
    \token_if_macro:NTF #1
      {
        \exp_after:wN \__kernel_prefix_arg_replacement:wN
          \token_to_meaning:N #1 \s__kernel_stop \use_i:nnn
      }
      { \scan_stop: }
  }
\cs_new:Npn \cs_argument_spec:N #1
  {
    \token_if_macro:NTF #1
      {
        \exp_after:wN \__kernel_prefix_arg_replacement:wN
          \token_to_meaning:N #1 \s__kernel_stop \use_ii:nnn
      }
      { \scan_stop: }
  }
\cs_new:Npn \cs_replacement_spec:N #1
  {
    \token_if_macro:NTF #1
      {
        \exp_after:wN \__kernel_prefix_arg_replacement:wN
          \token_to_meaning:N #1 \s__kernel_stop \use_iii:nnn
      }
      { \scan_stop: }
  }
\cs_new:Npn \prg_do_nothing: { }
\cs_new_eq:NN \prg_break_point:Nn \use_ii:nn
\cs_new:Npn \prg_map_break:Nn #1#2#3 \prg_break_point:Nn #4#5
  {
    #5
    \if_meaning:w #1 #4
      \exp_after:wN \use_iii:nnn
    \fi:
    \prg_map_break:Nn #1 {#2}
  }
\cs_new_eq:NN \prg_break_point: \prg_do_nothing:
\cs_new:Npn \prg_break: #1 \prg_break_point: { }
\cs_new:Npn \prg_break:n #1#2 \prg_break_point: {#1}
\cs_new_protected:Npn \mode_leave_vertical:
  {
    \if_mode_vertical:
      \exp_after:wN \tex_indent:D
    \fi:
  }
%% File: l3expan.dtx
\cs_new:Npn \__exp_arg_next:nnn #1#2#3 { #2 \::: { #3 {#1} } }
\cs_new:Npn \__exp_arg_next:Nnn #1#2#3 { #2 \::: { #3 #1 } }
\cs_new:Npn \::: #1 {#1}
\cs_new:Npn \::n #1 \::: #2#3 { #1 \::: { #2 {#3} } }
\cs_new:Npn \::N #1 \::: #2#3 { #1 \::: {#2#3} }
\cs_new:Npn \::p #1 \::: #2#3# { #1 \::: {#2#3} }
\cs_new:Npn \::c #1 \::: #2#3
  { \exp_after:wN \__exp_arg_next:Nnn \cs:w #3 \cs_end: {#1} {#2} }
\cs_new:Npn \::o #1 \::: #2#3
  { \exp_after:wN \__exp_arg_next:nnn \exp_after:wN {#3} {#1} {#2} }
\cs_if_exist:NTF \tex_expanded:D
  {
    \cs_new:Npn \::e #1 \::: #2#3
      { \tex_expanded:D { \exp_not:n { #1 \::: } { \exp_not:n {#2} {#3} } } }
  }
  {
    \cs_new:Npn \::e #1 \::: #2#3
      { \exp_args:Ne \__exp_arg_next:nnn {#3} {#1} {#2} }
  }
\cs_new:Npn \::f #1 \::: #2#3
  {
    \exp_after:wN \__exp_arg_next:nnn
      \exp_after:wN { \exp:w \exp_end_continue_f:w #3 }
      {#1} {#2}
  }
\use:nn { \cs_new_eq:NN \exp_stop_f: } { ~ }
\cs_new_protected:Npn \::x #1 \::: #2#3
  {
    \cs_set_nopar:Npx \l__exp_internal_tl
      { \exp_not:n { #1 \::: } { \exp_not:n {#2} {#3} } }
    \l__exp_internal_tl
  }
\cs_new:Npn \::V #1 \::: #2#3
  {
    \exp_after:wN \__exp_arg_next:nnn
      \exp_after:wN { \exp:w \__exp_eval_register:N #3 }
      {#1} {#2}
}
\cs_new:Npn \::v #1 \::: #2#3
  {
    \exp_after:wN \__exp_arg_next:nnn
      \exp_after:wN { \exp:w \__exp_eval_register:c {#3} }
      {#1} {#2}
  }
\cs_new:Npn \__exp_eval_register:N #1
  {
    \exp_after:wN \if_meaning:w \exp_not:N #1 #1
      \if_meaning:w \scan_stop: #1
        \__exp_eval_error_msg:w
      \fi:
    \else:
      \exp_after:wN \use_i_ii:nnn
    \fi:
    \exp_after:wN \exp_end: \tex_the:D #1
  }
\cs_new:Npn \__exp_eval_register:c #1
  { \exp_after:wN \__exp_eval_register:N \cs:w #1 \cs_end: }
\cs_new:Npn \__exp_eval_error_msg:w #1 \tex_the:D #2
  {
      \fi:
    \fi:
    \__kernel_msg_expandable_error:nnn { kernel } { bad-variable } {#2}
    \exp_end:
  }
\cs_new:Npn \exp_args:NNc #1#2#3
  { \exp_after:wN #1 \exp_after:wN #2 \cs:w # 3\cs_end: }
\cs_new:Npn \exp_args:Ncc #1#2#3
  { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: \cs:w #3 \cs_end: }
\cs_new:Npn \exp_args:Nccc #1#2#3#4
  {
    \exp_after:wN #1
      \cs:w #2 \exp_after:wN \cs_end:
      \cs:w #3 \exp_after:wN \cs_end:
      \cs:w #4 \cs_end:
  }
\cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} }
\cs_new:Npn \exp_args:NNo #1#2#3
  { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN {#3} }
\cs_new:Npn \exp_args:NNNo #1#2#3#4
  { \exp_after:wN #1 \exp_after:wN#2 \exp_after:wN #3 \exp_after:wN {#4} }
\cs_if_exist:NTF \tex_expanded:D
  {
    \cs_new:Npn \exp_args:Ne #1#2
      { \exp_after:wN #1 \tex_expanded:D { {#2} } }
  }
  {
    \cs_new:Npn \exp_args:Ne #1#2
      {
        \exp_after:wN #1 \exp_after:wN
          { \exp:w \__exp_e:nn {#2} { } }
      }
  }
\cs_new:Npn \exp_args:Nf #1#2
  { \exp_after:wN #1 \exp_after:wN { \exp:w \exp_end_continue_f:w #2 } }
\cs_new:Npn \exp_args:Nv #1#2
  {
    \exp_after:wN #1 \exp_after:wN
      { \exp:w \__exp_eval_register:c {#2} }
  }
\cs_new:Npn \exp_args:NV #1#2
  {
    \exp_after:wN #1 \exp_after:wN
      { \exp:w \__exp_eval_register:N #2 }
  }
\cs_new:Npn \exp_args:NNV #1#2#3
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN { \exp:w \__exp_eval_register:N #3 }
  }
\cs_new:Npn \exp_args:NNv #1#2#3
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN { \exp:w \__exp_eval_register:c {#3} }
  }
\cs_if_exist:NTF \tex_expanded:D
  {
    \cs_new:Npn \exp_args:NNe #1#2#3
      {
        \exp_after:wN #1
        \exp_after:wN #2
        \tex_expanded:D { {#3} }
      }
  }
  { \cs_new:Npn \exp_args:NNe { \::N \::e \::: } }
\cs_new:Npn \exp_args:NNf #1#2#3
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN { \exp:w \exp_end_continue_f:w #3 }
  }
\cs_new:Npn \exp_args:Nco #1#2#3
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \exp_after:wN {#3}
  }
\cs_new:Npn \exp_args:NcV #1#2#3
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \exp_after:wN { \exp:w \__exp_eval_register:N #3 }
  }
\cs_new:Npn \exp_args:Ncv #1#2#3
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \exp_after:wN { \exp:w \__exp_eval_register:c {#3} }
  }
\cs_new:Npn \exp_args:Ncf #1#2#3
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \exp_after:wN { \exp:w \exp_end_continue_f:w #3 }
  }
\cs_new:Npn \exp_args:NVV #1#2#3
  {
    \exp_after:wN #1
    \exp_after:wN { \exp:w \exp_after:wN
      \__exp_eval_register:N \exp_after:wN #2 \exp_after:wN }
    \exp_after:wN { \exp:w \__exp_eval_register:N #3 }
  }
\cs_new:Npn \exp_args:NNNV #1#2#3#4
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN { \exp:w \__exp_eval_register:N #4 }
  }
\cs_new:Npn \exp_args:NNNv #1#2#3#4
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN { \exp:w \__exp_eval_register:c {#4} }
  }
\cs_new:Npn \exp_args:NcNc #1#2#3#4
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \exp_after:wN #3
    \cs:w #4 \cs_end:
  }
\cs_new:Npn \exp_args:NcNo #1#2#3#4
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \exp_after:wN #3
    \exp_after:wN {#4}
  }
\cs_new:Npn \exp_args:Ncco #1#2#3#4
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \cs:w #3 \exp_after:wN \cs_end:
    \exp_after:wN {#4}
  }
\cs_new_protected:Npn \exp_args:Nx #1#2
  { \use:x { \exp_not:N #1 {#2} } }
\cs_new:Npn \__exp_arg_last_unbraced:nn #1#2 { #2#1 }
\cs_new:Npn \::o_unbraced \::: #1#2
  { \exp_after:wN \__exp_arg_last_unbraced:nn \exp_after:wN {#2} {#1} }
\cs_new:Npn \::V_unbraced \::: #1#2
  {
    \exp_after:wN \__exp_arg_last_unbraced:nn
      \exp_after:wN { \exp:w \__exp_eval_register:N #2 } {#1}
  }
\cs_new:Npn \::v_unbraced \::: #1#2
  {
    \exp_after:wN \__exp_arg_last_unbraced:nn
      \exp_after:wN { \exp:w \__exp_eval_register:c {#2} } {#1}
  }
\cs_if_exist:NTF \tex_expanded:D
  {
    \cs_new:Npn \::e_unbraced \::: #1#2
      { \tex_expanded:D { \exp_not:n {#1} #2 } }
  }
  {
    \cs_new:Npn \::e_unbraced \::: #1#2
      { \exp:w \__exp_e:nn {#2} {#1} }
  }
\cs_new:Npn \::f_unbraced \::: #1#2
  {
    \exp_after:wN \__exp_arg_last_unbraced:nn
      \exp_after:wN { \exp:w \exp_end_continue_f:w #2 } {#1}
  }
\cs_new_protected:Npn \::x_unbraced \::: #1#2
  {
    \cs_set_nopar:Npx \l__exp_internal_tl { \exp_not:n {#1} #2 }
    \l__exp_internal_tl
  }
\cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 }
\cs_new:Npn \exp_last_unbraced:NV #1#2
  { \exp_after:wN #1 \exp:w \__exp_eval_register:N #2 }
\cs_new:Npn \exp_last_unbraced:Nv #1#2
  { \exp_after:wN #1 \exp:w \__exp_eval_register:c {#2} }
\cs_if_exist:NTF \tex_expanded:D
  {
    \cs_new:Npn \exp_last_unbraced:Ne #1#2
      { \exp_after:wN #1 \tex_expanded:D {#2} }
  }
  { \cs_new:Npn \exp_last_unbraced:Ne { \::e_unbraced \::: } }
\cs_new:Npn \exp_last_unbraced:Nf #1#2
  { \exp_after:wN #1 \exp:w \exp_end_continue_f:w #2 }
\cs_new:Npn \exp_last_unbraced:NNo #1#2#3
  { \exp_after:wN #1 \exp_after:wN #2 #3 }
\cs_new:Npn \exp_last_unbraced:NNV #1#2#3
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp:w \__exp_eval_register:N #3
  }
\cs_new:Npn \exp_last_unbraced:NNf #1#2#3
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp:w \exp_end_continue_f:w #3
  }
\cs_new:Npn \exp_last_unbraced:Nco #1#2#3
  { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: #3 }
\cs_new:Npn \exp_last_unbraced:NcV #1#2#3
  {
    \exp_after:wN #1
    \cs:w #2 \exp_after:wN \cs_end:
    \exp:w \__exp_eval_register:N #3
  }
\cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4
  { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 }
\cs_new:Npn \exp_last_unbraced:NNNV #1#2#3#4
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN #3
    \exp:w \__exp_eval_register:N #4
  }
\cs_new:Npn \exp_last_unbraced:NNNf #1#2#3#4
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN #3
    \exp:w \exp_end_continue_f:w #4
  }
\cs_new:Npn \exp_last_unbraced:Nno { \::n \::o_unbraced \::: }
\cs_new:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: }
\cs_new:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: }
\cs_new:Npn \exp_last_unbraced:NnNo { \::n \::N \::o_unbraced \::: }
\cs_new:Npn \exp_last_unbraced:NNNNo #1#2#3#4#5
  { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 \exp_after:wN #4 #5 }
\cs_new:Npn \exp_last_unbraced:NNNNf #1#2#3#4#5
  {
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN #4
    \exp:w \exp_end_continue_f:w #5
  }
\cs_new_protected:Npn \exp_last_unbraced:Nx { \::x_unbraced \::: }
\cs_new:Npn \exp_last_two_unbraced:Noo #1#2#3
  { \exp_after:wN \__exp_last_two_unbraced:noN \exp_after:wN {#3} {#2} #1 }
\cs_new:Npn \__exp_last_two_unbraced:noN #1#2#3
   { \exp_after:wN #3 #2 #1 }
\cs_new_eq:NN \__kernel_exp_not:w \tex_unexpanded:D
\cs_new:Npn \exp_not:c #1 { \exp_after:wN \exp_not:N \cs:w #1 \cs_end: }
\cs_new:Npn \exp_not:o #1 { \__kernel_exp_not:w \exp_after:wN {#1} }
\cs_if_exist:NTF \tex_expanded:D
  {
    \cs_new:Npn \exp_not:e #1
      { \__kernel_exp_not:w \tex_expanded:D { {#1} } }
  }
  {
    \cs_new:Npn \exp_not:e
      { \__kernel_exp_not:w \exp_args:Ne \prg_do_nothing: }
  }
\cs_new:Npn \exp_not:f #1
  { \__kernel_exp_not:w \exp_after:wN { \exp:w \exp_end_continue_f:w #1 } }
\cs_new:Npn \exp_not:V #1
  {
    \__kernel_exp_not:w \exp_after:wN
      { \exp:w \__exp_eval_register:N #1 }
  }
\cs_new:Npn \exp_not:v #1
  {
    \__kernel_exp_not:w \exp_after:wN
      { \exp:w \__exp_eval_register:c {#1} }
  }
\group_begin:
  \tex_catcode:D `\^^@ = 13
  \cs_new_protected:Npn \exp_end_continue_f:w { `^^@ }
  \if_cs_exist:N ^^@
  \else:
    \cs_new:Npn ^^@
      { \__kernel_msg_expandable_error:nn { kernel } { bad-exp-end-f } }
  \fi:
  \cs_new:Npn \exp_end_continue_f:nw #1 { `^^@ #1 }
\group_end:
\cs_if_exist:NF \tex_expanded:D
  {
    \cs_new:Npn \__exp_e:nn #1
      {
        \if_false: { \fi:
          \tl_if_head_is_N_type:nTF {#1}
            { \__exp_e:N }
            {
              \tl_if_head_is_group:nTF {#1}
                { \__exp_e_group:n }
                {
                  \tl_if_empty:nTF {#1}
                    { \exp_after:wN \__exp_e_end:nn }
                    { \exp_after:wN \__exp_e_space:nn }
                  \exp_after:wN { \if_false: } \fi:
                }
            }
          #1
        }
      }
    \cs_new:Npn \__exp_e_end:nn #1#2 { \exp_end: #2 }
    \cs_new:Npn \__exp_e_space:nn #1#2
      { \exp_args:Nf \__exp_e:nn {#1} { #2 ~ } }
    \cs_new:Npn \__exp_e_group:n #1
      {
        \exp_after:wN \__exp_e_put:nn
        \exp_after:wN { \exp_after:wN { \exp_after:wN {
              \exp:w \if_false: } \fi: \__exp_e:nn {#1} { } } }
      }
    \cs_new:Npn \__exp_e_put:nn #1
      {
        \exp_args:NNo \exp_args:No \__exp_e_put:nnn
          { \tl_head:n {#1} } {#1}
      }
    \cs_new:Npn \__exp_e_put:nnn #1#2#3
      { \exp_args:No \__exp_e:nn { \use_none:n #2 } { #3 #1 } }
    \cs_new:Npn \__exp_e:N #1
      {
        \exp_after:wN \__exp_e:Nnn
        \exp_after:wN #1
        \exp_after:wN { \if_false: } \fi:
      }
    \cs_new:Npn \__exp_e:Nnn #1
      {
        \if_case:w
          \exp_after:wN \if_meaning:w \exp_not:N #1 #1 1 ~ \fi:
          \token_if_protected_macro:NT #1 { 1 ~ }
          \token_if_protected_long_macro:NT #1 { 1 ~ }
          \if_meaning:w \exp_not:n #1 2 ~ \fi:
          \if_meaning:w \exp_not:N #1 3 ~ \fi:
          \if_meaning:w \tex_the:D #1 4 ~ \fi:
          \if_meaning:w \tex_primitive:D #1 5 ~ \fi:
          0 ~
          \exp_after:wN \__exp_e_expandable:Nnn
        \or: \exp_after:wN \__exp_e_protected:Nnn
        \or: \exp_after:wN \__exp_e_unexpanded:Nnn
        \or: \exp_after:wN \__exp_e_noexpand:Nnn
        \or: \exp_after:wN \__exp_e_the:Nnn
        \or: \exp_after:wN \__exp_e_primitive:Nnn
        \fi:
        #1
      }
    \cs_new:Npn \__exp_e_protected:Nnn #1#2#3
      { \__exp_e:nn {#2} { #3 #1 } }
    \cs_new:Npn \__exp_e_expandable:Nnn #1#2
      { \exp_args:No \__exp_e:nn { #1 #2 } }
    \cs_new:Npn \__exp_e_primitive:Nnn #1#2
      {
        \if_false: { \fi:
          \tl_if_head_is_N_type:nTF {#2}
            { \__exp_e_primitive_aux:NNw #1 }
            {
              \__kernel_msg_expandable_error:nnn { kernel } { e-type }
                { Missing~primitive~name }
              \__exp_e_primitive_aux:NNw #1 \c_empty_tl
            }
          #2
        }
      }
    \cs_new:Npn \__exp_e_primitive_aux:NNw #1#2
      {
        \exp_after:wN \__exp_e_primitive_aux:NNnn
        \exp_after:wN #1
        \exp_after:wN #2
        \exp_after:wN { \if_false: } \fi:
      }
    \cs_new:Npn \__exp_e_primitive_aux:NNnn #1#2
      {
        \exp_args:Nf \str_case_e:nnTF { \cs_to_str:N #2 }
          {
            { unexpanded } { \__exp_e_unexpanded:Nnn \exp_not:n }
            { noexpand } { \__exp_e_noexpand:Nnn \exp_not:N }
            { the } { \__exp_e_the:Nnn \tex_the:D }
            {
              \sys_if_engine_xetex:T { pdf }
              \sys_if_engine_luatex:T { pdf }
              primitive
            } { \__exp_e_primitive:Nnn #1 }
          }
          { \__exp_e_primitive_other:NNnn #1 #2 }
      }
    \cs_new:Npn \__exp_e_primitive_other:NNnn #1#2#3
      {
        \exp_args:No \__exp_e_primitive_other_aux:nNNnn
          { #1 #2 #3 }
          #1 #2 {#3}
      }
    \cs_new:Npn \__exp_e_primitive_other_aux:nNNnn #1#2#3#4#5
      {
        \str_if_eq:nnTF {#1} { #2 #3 #4 }
          { \__exp_e:nn {#4} { #5 #2 #3 } }
          { \__exp_e:nn {#1} {#5} }
      }
    \cs_new:Npn \__exp_e_noexpand:Nnn #1#2
      {
        \tl_if_head_is_N_type:nTF {#2}
          { \__exp_e_put:nn } { \__exp_e:nn } {#2}
      }
    \cs_new:Npn \__exp_e_unexpanded:Nnn #1 { \__exp_e_unexpanded:nn }
    \cs_new:Npn \__exp_e_unexpanded:nn #1
      {
        \tl_if_head_is_N_type:nTF {#1}
          {
            \exp_args:Nf \__exp_e_unexpanded:nn
              { \__exp_e_unexpanded:nN {#1} #1 }
          }
          {
            \tl_if_head_is_group:nTF {#1}
              { \__exp_e_put:nn }
              {
                \tl_if_empty:nTF {#1}
                  {
                    \__kernel_msg_expandable_error:nnn
                      { kernel } { e-type }
                      { \unexpanded missing~brace }
                    \__exp_e_end:nn
                  }
                  { \exp_args:Nf \__exp_e_unexpanded:nn }
              }
            {#1}
          }
      }
    \cs_new:Npn \__exp_e_unexpanded:nN #1#2
      {
        \exp_after:wN \if_meaning:w \exp_not:N #2 #2
          \exp_after:wN \use_i:nn
        \else:
          \exp_after:wN \use_ii:nn
        \fi:
        {
          \token_if_eq_catcode:NNTF #2 \c_space_token
            { \exp_stop_f: }
            {
              \token_if_eq_meaning:NNTF #2 \scan_stop:
                { \exp_stop_f: }
                {
                  \__kernel_msg_expandable_error:nnn
                    { kernel } { e-type }
                    { \unexpanded missing~brace }
                  { }
                }
            }
        }
        {
          \token_if_eq_meaning:NNTF #2 \exp_not:N
            {
              \exp_args:No \tl_if_head_is_N_type:nT { \use_none:n #1 }
                { \__exp_e_unexpanded:N }
            }
            { \exp_after:wN \exp_stop_f: #2 }
        }
      }
    \cs_new:Npn \__exp_e_unexpanded:N #1
      {
        \exp_after:wN \if_meaning:w \exp_not:N #1 #1 \else:
          \exp_after:wN \use_i:nn
        \fi:
        \exp_stop_f: #1
      }
    \cs_new:Npn \__exp_e_the:Nnn #1#2
      {
        \tl_if_head_is_N_type:nTF {#2}
          { \if_false: { \fi: \__exp_e_the:N #2 } }
          { \exp_args:No \__exp_e:nn { \tex_the:D #2 } }
      }
    \cs_new:Npn \__exp_e_the:N #1
      {
        \exp_after:wN \if_meaning:w \exp_not:N #1 #1
          \exp_after:wN \use_i:nn
        \else:
          \exp_after:wN \use_ii:nn
        \fi:
        {
          \if_meaning:w \tex_toks:D #1
            \exp_after:wN \__exp_e_the_toks:wnn \int_value:w
            \exp_after:wN \__exp_e_the_toks:n
            \exp_after:wN { \int_value:w \if_false: } \fi:
          \else:
            \__exp_e_if_toks_register:NTF #1
              { \exp_after:wN \__exp_e_the_toks_reg:N }
              {
                \exp_after:wN \__exp_e:nn \exp_after:wN {
                  \tex_the:D \if_false: } \fi:
              }
            \exp_after:wN #1
          \fi:
        }
        {
          \exp_after:wN \__exp_e_the:Nnn \exp_after:wN ?
          \exp_after:wN { \exp:w \if_false: } \fi:
          \exp_after:wN \exp_end: #1
        }
      }
    \cs_new:Npn \__exp_e_the_toks_reg:N #1
      {
        \exp_after:wN \__exp_e_put:nn \exp_after:wN {
          \exp_after:wN {
            \tex_the:D \if_false: } \fi: #1 }
      }
    \cs_new:Npn \__exp_e_the_toks:wnn #1; #2
      {
        \exp_args:No \__exp_e_put:nnn
          { \tex_the:D \tex_toks:D #1 } { ? #2 }
      }
    \cs_new:Npn \__exp_e_the_toks:n #1
      {
        \tl_if_head_is_N_type:nTF {#1}
          { \exp_after:wN \__exp_e_the_toks:N \if_false: { \fi: #1 } }
          { ; {#1} }
      }
    \cs_new:Npn \__exp_e_the_toks:N #1
      {
        \if_int_compare:w 10 < 9 \token_to_str:N #1 \exp_stop_f:
          \exp_after:wN \use_i:nn
        \else:
          \exp_after:wN \use_ii:nn
        \fi:
        {
          #1
          \exp_after:wN \__exp_e_the_toks:n
          \exp_after:wN { \if_false: } \fi:
        }
        {
          \exp_after:wN ;
          \exp_after:wN { \if_false: } \fi: #1
        }
      }
    \prg_new_conditional:Npnn \__exp_e_if_toks_register:N #1 { TF }
      {
        \token_if_toks_register:NTF #1 { \prg_return_true: }
          {
            \cs_if_exist:cTF
              {
                __exp_e_the_
                \exp_after:wN \cs_to_str:N
                \token_to_meaning:N #1
                :
              } { \prg_return_true: } { \prg_return_false: }
          }
      }
    \cs_new_eq:NN \__exp_e_the_XeTeXinterchartoks: ?
    \cs_new_eq:NN \__exp_e_the_errhelp: ?
    \cs_new_eq:NN \__exp_e_the_everycr: ?
    \cs_new_eq:NN \__exp_e_the_everydisplay: ?
    \cs_new_eq:NN \__exp_e_the_everyeof: ?
    \cs_new_eq:NN \__exp_e_the_everyhbox: ?
    \cs_new_eq:NN \__exp_e_the_everyjob: ?
    \cs_new_eq:NN \__exp_e_the_everymath: ?
    \cs_new_eq:NN \__exp_e_the_everypar: ?
    \cs_new_eq:NN \__exp_e_the_everyvbox: ?
    \cs_new_eq:NN \__exp_e_the_output: ?
    \cs_new_eq:NN \__exp_e_the_pdfpageattr: ?
    \cs_new_eq:NN \__exp_e_the_pdfpageresources: ?
    \cs_new_eq:NN \__exp_e_the_pdfpagesattr: ?
    \cs_new_eq:NN \__exp_e_the_pdfpkmode: ?
  }
\cs_new_eq:NN \s__cs_mark \scan_stop:
\cs_new_eq:NN \s__cs_stop \scan_stop:
\cs_new:Npn \q__cs_recursion_stop { \q__cs_recursion_stop }
\cs_new:Npn \__cs_use_none_delimit_by_s_stop:w #1 \s__cs_stop { }
\cs_new:Npn \__cs_use_i_delimit_by_s_stop:nw #1 #2 \s__cs_stop {#1}
\cs_new:Npn \__cs_use_none_delimit_by_q_recursion_stop:w
  #1 \q__cs_recursion_stop { }
\cs_new_protected:Npn \cs_generate_variant:Nn #1#2
  {
    \__cs_generate_variant:N #1
    \use:x
      {
        \__cs_generate_variant:nnNN
          \cs_split_function:N #1
          \exp_not:N #1
          \tl_to_str:n {#2} ,
            \exp_not:N \scan_stop: ,
            \exp_not:N \q__cs_recursion_stop
      }
  }
\cs_new_protected:Npn \cs_generate_variant:cn
  { \exp_args:Nc \cs_generate_variant:Nn }
\cs_new_protected:Npx \__cs_generate_variant:N #1
  {
    \exp_not:N \exp_after:wN \exp_not:N \if_meaning:w
      \exp_not:N \exp_not:N #1 #1
      \cs_set_eq:NN \exp_not:N \__cs_tmp:w \cs_new_protected:Npx
    \exp_not:N \else:
      \exp_not:N \exp_after:wN \exp_not:N \__cs_generate_variant:ww
        \exp_not:N \token_to_meaning:N #1 \tl_to_str:n { ma }
          \s__cs_mark
        \s__cs_mark \cs_new_protected:Npx
        \tl_to_str:n { pr }
        \s__cs_mark \cs_new:Npx
        \s__cs_stop
    \exp_not:N \fi:
  }
\exp_last_unbraced:NNNNo
  \cs_new_protected:Npn \__cs_generate_variant:ww
    #1 { \tl_to_str:n { ma } } #2 \s__cs_mark
    { \__cs_generate_variant:wwNw #1 }
\exp_last_unbraced:NNNNo
  \cs_new_protected:Npn \__cs_generate_variant:wwNw
    #1 { \tl_to_str:n { pr } } #2 \s__cs_mark #3 #4 \s__cs_stop
    { \cs_set_eq:NN \__cs_tmp:w #3 }
\cs_new_protected:Npn \__cs_generate_variant:nnNN #1#2#3#4
  {
    \if_meaning:w \c_false_bool #3
      \__kernel_msg_error:nnx { kernel } { missing-colon }
        { \token_to_str:c {#1} }
      \exp_after:wN \__cs_use_none_delimit_by_q_recursion_stop:w
    \fi:
    \__cs_generate_variant:Nnnw #4 {#1}{#2}
  }
\cs_new_protected:Npn \__cs_generate_variant:Nnnw #1#2#3#4 ,
  {
    \if_meaning:w \scan_stop: #4
      \exp_after:wN \__cs_use_none_delimit_by_q_recursion_stop:w
    \fi:
    \use:x
      {
        \exp_not:N \__cs_generate_variant:wwNN
        \__cs_generate_variant_loop:nNwN { }
          #4
          \__cs_generate_variant_loop_end:nwwwNNnn
          \s__cs_mark
          #3 ~
          { ~ { } \fi: \__cs_generate_variant_loop_long:wNNnn } ~
          { }
          \s__cs_stop
        \exp_not:N #1 {#2} {#4}
      }
    \__cs_generate_variant:Nnnw #1 {#2} {#3}
  }
\cs_new:Npn \__cs_generate_variant_loop:nNwN #1#2#3 \s__cs_mark #4
  {
    \if:w #2 #4
      \exp_after:wN \__cs_generate_variant_loop_same:w
    \else:
      \if:w #4 \__cs_generate_variant_loop_base:N #2 \else:
        \if:w 0
          \if:w N #4 \else: \if:w n #4 \else: 1 \fi: \fi:
          \if:w \scan_stop: \__cs_generate_variant_loop_base:N #2 1 \fi:
          0
          \__cs_generate_variant_loop_special:NNwNNnn #4#2
        \else:
          \__cs_generate_variant_loop_invalid:NNwNNnn #4#2
        \fi:
      \fi:
    \fi:
    #1
    \prg_do_nothing:
    #2
    \__cs_generate_variant_loop:nNwN { } #3 \s__cs_mark
  }
\cs_new:Npn \__cs_generate_variant_loop_base:N #1
  {
    \if:w c #1 N \else:
      \if:w o #1 n \else:
        \if:w V #1 n \else:
          \if:w v #1 n \else:
            \if:w f #1 n \else:
              \if:w e #1 n \else:
                \if:w x #1 n \else:
                  \if:w n #1 n \else:
                    \if:w N #1 N \else:
                      \scan_stop:
                    \fi:
                  \fi:
                \fi:
              \fi:
            \fi:
          \fi:
        \fi:
      \fi:
    \fi:
  }
\cs_new:Npn \__cs_generate_variant_loop_same:w
    #1 \prg_do_nothing: #2#3#4
  { #3 { #1 \__cs_generate_variant_same:N #2 } }
\cs_new:Npn \__cs_generate_variant_loop_end:nwwwNNnn
    #1#2 \s__cs_mark #3 ~ #4 \s__cs_stop #5#6#7#8
  {
    \scan_stop: \scan_stop: \fi:
    \s__cs_mark \s__cs_stop
    \exp_not:N #6
    \exp_not:c { #7 : #8 #1 #3 }
  }
\cs_new:Npn \__cs_generate_variant_loop_long:wNNnn #1 \s__cs_stop #2#3#4#5
  {
    \exp_not:n
      {
        \s__cs_mark
        \__kernel_msg_error:nnxx { kernel } { variant-too-long }
          {#5} { \token_to_str:N #3 }
        \use_none:nnn
        \s__cs_stop
        #3
        #3
      }
  }
\cs_new:Npn \__cs_generate_variant_loop_invalid:NNwNNnn
    #1#2 \fi: \fi: \fi: #3 \s__cs_stop #4#5#6#7
  {
    \fi: \fi: \fi:
    \exp_not:n
      {
        \s__cs_mark
        \__kernel_msg_error:nnxxxx { kernel } { invalid-variant }
          {#7} { \token_to_str:N #5 } {#1} {#2}
        \use_none:nnn
        \s__cs_stop
        #5
        #5
      }
  }
\cs_new:Npn \__cs_generate_variant_loop_special:NNwNNnn
  #1#2#3 \s__cs_stop #4#5#6#7
  {
    #3 \s__cs_stop #4 #5 {#6} {#7}
    \exp_not:n
      {
        \__kernel_msg_error:nnxxxx
          { kernel } { deprecated-variant }
          {#7} { \token_to_str:N #5 } {#1} {#2}
      }
  }
\cs_new:Npn \__cs_generate_variant_same:N #1
  {
    \if:w N #1 #1 \else:
      \if:w p #1 #1 \else:
        \token_to_str:N n
        \if:w n #1 \else:
          \__cs_generate_variant_loop_special:NNwNNnn #1#1
        \fi:
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__cs_generate_variant:wwNN
    #1 \s__cs_mark #2 \s__cs_stop #3#4
  {
    #2
    \cs_if_free:NT #4
      {
        \group_begin:
          \__cs_generate_internal_variant:n {#1}
          \__cs_tmp:w #4 { \exp_not:c { exp_args:N #1 } \exp_not:N #3 }
        \group_end:
      }
  }
\cs_new_protected:Npx \__cs_generate_internal_variant:n #1
  {
    \exp_not:N \__cs_generate_internal_variant:wwnNwn
      #1 \s__cs_mark
        { \cs_set_eq:NN \exp_not:N \__cs_tmp:w \cs_new_protected:Npx }
        \cs_new_protected:cpn
        \use:x
      \token_to_str:N x \s__cs_mark
        { }
        \cs_new:cpn
        \exp_not:N \tex_expanded:D
    \s__cs_stop
      {#1}
  }
\exp_last_unbraced:NNNNo
  \cs_new_protected:Npn \__cs_generate_internal_variant:wwnNwn #1
    { \token_to_str:N x } #2 \s__cs_mark #3#4#5#6 \s__cs_stop #7
  {
    #3
    \cs_if_free:cT { exp_args:N #7 }
      { \__cs_generate_internal_variant:NNn #4 #5 {#7} }
  }
\cs_set_protected:Npn \__cs_tmp:w #1
  {
    \cs_new_protected:Npn \__cs_generate_internal_variant:NNn ##1##2##3
      {
        \if_catcode:w X \use_none:nnnnnnnn ##3
            \prg_do_nothing: \prg_do_nothing: \prg_do_nothing:
            \prg_do_nothing: \prg_do_nothing: \prg_do_nothing:
            \prg_do_nothing: \prg_do_nothing: X
          \exp_after:wN \__cs_generate_internal_test:Nw \exp_after:wN ##2
        \else:
          \exp_after:wN \__cs_generate_internal_test_aux:w \exp_after:wN #1
        \fi:
        ##3
        \s__cs_mark
        {
          \use:x
            {
              ##1 { exp_args:N ##3 }
                { \__cs_generate_internal_variant_loop:n ##3 { : \use_i:nn } }
            }
        }
        #1
        \s__cs_mark
        { \exp_not:n { \__cs_generate_internal_one_go:NNn ##1 ##2 {##3} } }
        \s__cs_stop
      }
    \cs_new_protected:Npn \__cs_generate_internal_test_aux:w
        ##1 #1 ##2 \s__cs_mark ##3 ##4 \s__cs_stop {##3}
    \cs_if_exist:NTF \tex_expanded:D
      {
        \cs_new_eq:NN \__cs_generate_internal_test:Nw
          \__cs_generate_internal_test_aux:w
      }
      {
        \cs_new_protected:Npn \__cs_generate_internal_test:Nw ##1
          {
            \if_meaning:w \tex_expanded:D ##1
              \exp_after:wN \__cs_generate_internal_test_aux:w
              \exp_after:wN #1
            \else:
              \exp_after:wN \__cs_generate_internal_test_aux:w
            \fi:
          }
      }
  }
\exp_args:No \__cs_tmp:w { \token_to_str:N p }
\cs_new_protected:Npn \__cs_generate_internal_one_go:NNn #1#2#3
  {
    \__cs_generate_internal_loop:nwnnw
      { \exp_not:N ##1 } 1 . { } { }
      #3 { ? \__cs_generate_internal_end:w } X ;
      23456789 { ? \__cs_generate_internal_long:w } ;
    #1 #2 {#3}
  }
\cs_new_protected:Npn \__cs_generate_internal_loop:nwnnw #1#2 . #3#4#5#6 ; #7
  {
    \use_none:n #5
    \use_none:n #7
    \cs_if_exist_use:cF { __cs_generate_internal_#5:NN }
      { \__cs_generate_internal_other:NN }
        #5 #7
    #7 .
    { #3 #1 } { #4 ## #2 }
    #6 ;
  }
\cs_new_protected:Npn \__cs_generate_internal_N:NN #1#2
  { \__cs_generate_internal_loop:nwnnw { \exp_not:N ###2 } }
\cs_new_protected:Npn \__cs_generate_internal_c:NN #1#2
  { \exp_args:No \__cs_generate_internal_loop:nwnnw { \exp_not:c {###2} } }
\cs_new_protected:Npn \__cs_generate_internal_n:NN #1#2
  { \__cs_generate_internal_loop:nwnnw { { \exp_not:n {###2} } } }
\cs_new_protected:Npn \__cs_generate_internal_x:NN #1#2
  { \__cs_generate_internal_loop:nwnnw { {###2} } }
\cs_new_protected:Npn \__cs_generate_internal_other:NN #1#2
  {
    \exp_args:No \__cs_generate_internal_loop:nwnnw
      {
        \exp_after:wN
        {
          \exp:w \exp_args:NNc \exp_after:wN \exp_end:
          { exp_not:#1 } {###2}
        }
      }
  }
\cs_new_protected:Npn \__cs_generate_internal_end:w #1 . #2#3#4 ; #5 ; #6#7#8
  { #6 { exp_args:N #8 } #3 { #7 {#2} } }
\cs_new_protected:Npn \__cs_generate_internal_long:w #1 N #2#3 . #4#5#6#
  {
    \exp_args:Nx \__cs_generate_internal_long:nnnNNn
      { \__cs_generate_internal_variant_loop:n #2 #6 { : \use_i:nn } }
      {#4} {#5}
  }
\cs_new:Npn \__cs_generate_internal_long:nnnNNn #1#2#3#4 ; ; #5#6#7
  { #5 { exp_args:N #7 } #3 { #6 { \exp_not:n {#1} {#2} } } }
\cs_new:Npn \__cs_generate_internal_variant_loop:n #1
  {
    \exp_after:wN \exp_not:N \cs:w :: #1 \cs_end:
    \__cs_generate_internal_variant_loop:n
  }
\cs_new_protected:Npn \prg_generate_conditional_variant:Nnn #1
  {
    \use:x
      {
        \__cs_generate_variant:nnNnn
          \cs_split_function:N #1
      }
  }
\cs_new_protected:Npn \__cs_generate_variant:nnNnn #1#2#3#4#5
  {
    \if_meaning:w \c_false_bool #3
      \__kernel_msg_error:nnx { kernel } { missing-colon }
        { \token_to_str:c {#1} }
      \__cs_use_i_delimit_by_s_stop:nw
    \fi:
    \exp_after:wN \__cs_generate_variant:w
    \tl_to_str:n {#5} , \scan_stop: , \q__cs_recursion_stop
    \__cs_use_none_delimit_by_s_stop:w \s__cs_mark {#1} {#2} {#4} \s__cs_stop
  }
\cs_new_protected:Npn \__cs_generate_variant:w
    #1 , #2 \s__cs_mark #3#4#5
  {
    \if_meaning:w \scan_stop: #1 \scan_stop:
      \if_meaning:w \q__cs_nil #1 \q__cs_nil
        \use_i:nnn
      \fi:
      \exp_after:wN \__cs_use_none_delimit_by_q_recursion_stop:w
    \else:
      \cs_if_exist_use:cTF { __cs_generate_variant_#1_form:nnn }
        { {#3} {#4} {#5} }
        {
          \__kernel_msg_error:nnxx
            { kernel } { conditional-form-unknown }
            {#1} { \token_to_str:c { #3 : #4 } }
        }
    \fi:
    \__cs_generate_variant:w #2 \s__cs_mark {#3} {#4} {#5}
  }
\cs_new_protected:Npn \__cs_generate_variant_p_form:nnn #1#2
  { \cs_generate_variant:cn { #1 _p : #2 } }
\cs_new_protected:Npn \__cs_generate_variant_T_form:nnn #1#2
  { \cs_generate_variant:cn { #1 : #2 T } }
\cs_new_protected:Npn \__cs_generate_variant_F_form:nnn #1#2
  { \cs_generate_variant:cn { #1 : #2 F } }
\cs_new_protected:Npn \__cs_generate_variant_TF_form:nnn #1#2
  { \cs_generate_variant:cn { #1 : #2 TF } }
\cs_new_protected:Npn \exp_args_generate:n #1
  {
    \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} }
      {
        \str_map_inline:nn {##1}
          {
            \str_if_in:nnF { NnpcofeVvx } {####1}
              {
                \__kernel_msg_error:nnnn { kernel } { invalid-exp-args }
                  {####1} {##1}
                \str_map_break:n { \use_none:nn }
              }
          }
        \__cs_generate_internal_variant:n {##1}
      }
  }
\cs_set_protected:Npn \__cs_tmp:w #1
  {
    \group_begin:
      \exp_args:No \__cs_generate_internal_variant:n
        { \tl_to_str:n {#1} }
    \group_end:
  }
\__cs_tmp:w { nc }
\__cs_tmp:w { no }
\__cs_tmp:w { nV }
\__cs_tmp:w { nv }
\__cs_tmp:w { ne }
\__cs_tmp:w { nf }
\__cs_tmp:w { oc }
\__cs_tmp:w { oo }
\__cs_tmp:w { of }
\__cs_tmp:w { Vo }
\__cs_tmp:w { fo }
\__cs_tmp:w { ff }
\__cs_tmp:w { ee }
\__cs_tmp:w { Nx }
\__cs_tmp:w { cx }
\__cs_tmp:w { nx }
\__cs_tmp:w { ox }
\__cs_tmp:w { xo }
\__cs_tmp:w { xx }
\__cs_tmp:w { Ncf }
\__cs_tmp:w { Nno }
\__cs_tmp:w { NnV }
\__cs_tmp:w { Noo }
\__cs_tmp:w { NVV }
\__cs_tmp:w { cno }
\__cs_tmp:w { cnV }
\__cs_tmp:w { coo }
\__cs_tmp:w { cVV }
\__cs_tmp:w { nnc }
\__cs_tmp:w { nno }
\__cs_tmp:w { nnf }
\__cs_tmp:w { nff }
\__cs_tmp:w { ooo }
\__cs_tmp:w { oof }
\__cs_tmp:w { ffo }
\__cs_tmp:w { eee }
\__cs_tmp:w { NNx }
\__cs_tmp:w { Nnx }
\__cs_tmp:w { Nox }
\__cs_tmp:w { nnx }
\__cs_tmp:w { nox }
\__cs_tmp:w { ccx }
\__cs_tmp:w { cnx }
\__cs_tmp:w { oox }
%% File: l3quark.dtx
\cs_new_protected:Npn \quark_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs_gset_nopar:Npn #1 {#1}
  }
\quark_new:N \q_nil
\quark_new:N \q_mark
\quark_new:N \q_no_value
\quark_new:N \q_stop
\quark_new:N \q_recursion_tail
\quark_new:N \q_recursion_stop
\cs_new_eq:NN \s__quark \scan_stop:
\quark_new:N \q__quark_nil
\cs_new:Npn \quark_if_recursion_tail_stop:N #1
  {
    \if_meaning:w \q_recursion_tail #1
      \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
    \fi:
  }
\cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1
  {
    \if_meaning:w \q_recursion_tail #1
      \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw
    \else:
      \exp_after:wN \use_none:n
    \fi:
  }
\cs_new:Npn \quark_if_recursion_tail_stop:n #1
  {
    \tl_if_empty:oTF
      { \__quark_if_recursion_tail:w {} #1 {} ?! \q_recursion_tail ??! }
      { \use_none_delimit_by_q_recursion_stop:w }
      { }
  }
\cs_new:Npn \quark_if_recursion_tail_stop_do:nn #1
  {
    \tl_if_empty:oTF
      { \__quark_if_recursion_tail:w {} #1 {} ?! \q_recursion_tail ??! }
      { \use_i_delimit_by_q_recursion_stop:nw }
      { \use_none:n }
  }
\cs_new:Npn \__quark_if_recursion_tail:w
    #1 \q_recursion_tail #2 ? #3 ?! { #1 #2 }
\cs_generate_variant:Nn \quark_if_recursion_tail_stop:n { o }
\cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn { o }
\cs_new:Npn \quark_if_recursion_tail_break:NN #1#2
  {
    \if_meaning:w \q_recursion_tail #1
      \exp_after:wN #2
    \fi:
  }
\cs_new:Npn \quark_if_recursion_tail_break:nN #1#2
  {
    \tl_if_empty:oT
      { \__quark_if_recursion_tail:w {} #1 {} ?! \q_recursion_tail ??! }
      {#2}
  }
\prg_new_conditional:Npnn \quark_if_nil:N #1 { p, T , F , TF }
  {
    \if_meaning:w \q_nil #1
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_new_conditional:Npnn \quark_if_no_value:N #1 { p, T , F , TF }
  {
    \if_meaning:w \q_no_value #1
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \quark_if_no_value:N
  { c } { p , T , F , TF }
\prg_new_conditional:Npnn \quark_if_nil:n #1 { p, T , F , TF }
  {
    \__quark_if_empty_if:o
      { \__quark_if_nil:w {} #1 {} ? ! \q_nil ? ? ! }
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__quark_if_nil:w #1 \q_nil #2 ? #3 ? ! { #1 #2 }
\prg_new_conditional:Npnn \quark_if_no_value:n #1 { p, T , F , TF }
  {
    \__quark_if_empty_if:o
      { \__quark_if_no_value:w {} #1 {} ? ! \q_no_value ? ? ! }
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__quark_if_no_value:w #1 \q_no_value #2 ? #3 ? ! { #1 #2 }
\prg_generate_conditional_variant:Nnn \quark_if_nil:n
  { V , o } { p , TF , T , F }
\cs_new:Npn \__quark_if_empty_if:o #1
  {
    \exp_after:wN \if_meaning:w \exp_after:wN \q_nil
      \__kernel_tl_to_str:w \exp_after:wN {#1} \q_nil
  }
\cs_new_protected:Npn \__kernel_quark_new_test:N #1
  { \__quark_new_test_aux:Nx #1 { \__quark_module_name:N #1 } }
\cs_new_protected:Npn \__quark_new_test_aux:Nn #1 #2
  {
    \if_meaning:w \q_nil #2 \q_nil
      \__kernel_msg_error:nnx { kernel } { invalid-quark-function }
        { \token_to_str:N #1 }
    \else:
      \__quark_new_test:Nccn #1
        { q__#2_recursion_tail } { q__#2_recursion_stop } { __#2 }
    \fi:
  }
\cs_generate_variant:Nn \__quark_new_test_aux:Nn { Nx }
\cs_new_protected:Npn \__quark_new_test:NNNn #1
  {
    \exp_last_unbraced:Nf \__quark_new_test_aux:nnNNnnnn
      { \cs_split_function:N #1 }
      #1 { test }
  }
\cs_generate_variant:Nn \__quark_new_test:NNNn { Ncc }
\cs_new_protected:Npn \__kernel_quark_new_conditional:Nn #1
  {
    \__quark_new_conditional:Nxxn #1
      { \__quark_quark_conditional_name:N #1 }
      { \__quark_module_name:N #1 }
  }
\cs_new_protected:Npn \__quark_new_conditional:Nnnn #1#2#3#4
  {
    \if_meaning:w \q_nil #2 \q_nil
      \__kernel_msg_error:nnx { kernel } { invalid-quark-function }
        { \token_to_str:N #1 }
    \else:
      \if_meaning:w \q_nil #3 \q_nil
        \__kernel_msg_error:nnx { kernel } { invalid-quark-function }
          { \token_to_str:N #1 }
      \else:
        \exp_last_unbraced:Nf \__quark_new_test_aux:nnNNnnnn
          { \cs_split_function:N #1 }
          #1 { conditional }
          {#2} {#3} {#4}
      \fi:
    \fi:
  }
\cs_generate_variant:Nn \__quark_new_conditional:Nnnn { Nxx }
\cs_new_protected:Npn \__quark_new_test_aux:nnNNnnnn #1 #2 #3 #4 #5
  {
    \cs_if_exist_use:cTF { __quark_new_#5_#2:Nnnn } { #4 }
      {
        \__kernel_msg_error:nnxx { kernel } { invalid-quark-function }
          { \token_to_str:N #4 } {#2}
        \use_none:nnn
      }
  }
\cs_new_protected:Npn \__quark_new_test_n:Nnnn #1 #2 #3 #4
  {
    \__quark_new_test_aux_do:nNNnnnnNNn {#4} #2 #3 { none } { } { } { }
      \__quark_new_test_define_tl:nNnNNn #1 { }
  }
\cs_new_protected:Npn \__quark_new_test_nn:Nnnn #1 #2 #3 #4
  {
    \__quark_new_test_aux_do:nNNnnnnNNn {#4} #2 #3 { i } { n } {##1} {##2}
      \__quark_new_test_define_tl:nNnNNn #1 { \use_none:n }
  }
\cs_new_protected:Npn \__quark_new_test_nN:Nnnn #1 #2 #3 #4
  {
    \__quark_new_test_aux_do:nNNnnnnNNn {#4} #2 #3 { i } { n } {##1} {##2}
      \__quark_new_test_define_break_tl:nNNNNn #1 { }
  }
\cs_new_protected:Npn \__quark_new_test_N:Nnnn #1 #2 #3 #4
  {
    \__quark_new_test_aux_do:nNNnnnnNNn {#4} #2 #3 { none } { } { } { }
      \__quark_new_test_define_ifx:nNnNNn #1 { }
  }
\cs_new_protected:Npn \__quark_new_test_Nn:Nnnn #1 #2 #3 #4
  {
    \__quark_new_test_aux_do:nNNnnnnNNn {#4} #2 #3 { i } { n } {##1} {##2}
      \__quark_new_test_define_ifx:nNnNNn #1
      { \else: \exp_after:wN \use_none:n }
  }
\cs_new_protected:Npn \__quark_new_test_NN:Nnnn #1 #2 #3 #4
  {
    \__quark_new_test_aux_do:nNNnnnnNNn {#4} #2 #3 { i } { n } {##1} {##2}
      \__quark_new_test_define_break_ifx:nNNNNn #1 { }
  }
\cs_new_protected:Npn \__quark_new_test_aux_do:nNNnnnnNNn #1 #2 #3 #4 #5
  {
    \exp_args:Ncc \__quark_test_define_aux:NNNNnnNNn
      { #1 _quark_recursion_tail:w }
      { #1 _use_ #4 _delimit_by_q_recursion_stop: #5 w }
      #2 #3
  }
\cs_new_protected:Npn \__quark_test_define_aux:NNNNnnNNn #1 #2 #3 #4 #5 #6 #7
  {
    \cs_gset:Npn #1  ##1 #3 ##2 ? ##3 ?! { ##1 ##2 }
    \cs_gset:Npn #2  ##1 #6 #4 {#5}
    #7 {##1} #1 #2 #3
  }
\cs_new_protected:Npn \__quark_new_test_define_tl:nNnNNn #1 #2 #3 #4 #5 #6
  {
    \cs_new:Npn #5 #1
      {
        \tl_if_empty:oTF
          { #2 {} ##1 {} ?! #4 ??! }
          {#3} {#6}
      }
  }
\cs_new_protected:Npn \__quark_new_test_define_ifx:nNnNNn #1 #2 #3 #4 #5 #6
  {
    \cs_new:Npn #5 #1
      {
        \if_meaning:w #4 ##1
          \exp_after:wN #3
          #6
        \fi:
      }
  }
\cs_new_protected:Npn \__quark_new_test_define_break_tl:nNNNNn #1 #2 #3
  { \__quark_new_test_define_tl:nNnNNn {##1##2} #2 {##2} }
\cs_new_protected:Npn \__quark_new_test_define_break_ifx:nNNNNn #1 #2 #3
  { \__quark_new_test_define_ifx:nNnNNn {##1##2} #2 {##2} }
\cs_new_protected:Npn \__quark_new_conditional_n:Nnnn
  { \__quark_new_conditional_aux_do:NNnnn \use_i:nn }
\cs_new_protected:Npn \__quark_new_conditional_N:Nnnn
  { \__quark_new_conditional_aux_do:NNnnn \use_ii:nn }
\cs_new_protected:Npn \__quark_new_conditional_aux_do:NNnnn #1 #2 #3 #4
  {
    \exp_args:Ncc \__quark_new_conditional_define:NNNNn
      { __ #4 _if_quark_ #3 :w } { q__ #4 _ #3 } #2 #1
  }
\cs_new_protected:Npn \__quark_new_conditional_define:NNNNn #1 #2 #3 #4 #5
  {
    #4 { \cs_gset:Npn #1  ##1 #2 ##2 ? ##3 ?! { ##1 ##2 } } { }
    \exp_args:Nno \use:n { \prg_new_conditional:Npnn #3 ##1 {#5} }
      {
        #4 { \__quark_if_empty_if:o { #1 {} ##1 {} ?! #2 ??! } }
           { \if_meaning:w #2 ##1 }
        \prg_return_true: \else: \prg_return_false: \fi:
      }
  }
\cs_set:Npn \__quark_tmp:w #1#2
  {
    \cs_new:Npn \__quark_module_name:N ##1
      {
        \exp_last_unbraced:Nf \__quark_module_name:w
          { \cs_to_str:N ##1 } #1 \s__quark
      }
    \cs_new:Npn \__quark_module_name:w ##1 #1 ##2 \s__quark
      { \__quark_module_name_loop:w ##1 #2 \use_none:n { } #2 \s__quark }
    \cs_new:Npn \__quark_module_name_loop:w ##1 #2
      {
        \use_i_ii:nnn \if_meaning:w \prg_do_nothing:
            ##1 \prg_do_nothing: \prg_do_nothing:
          \exp_after:wN \__quark_module_name_loop:w
        \else:
          \__quark_module_name_end:w ##1
        \fi:
      }
    \cs_new:Npn \__quark_module_name_end:w
      ##1 \fi: ##2 \s__quark { \fi: ##1 }
  }
\exp_after:wN \__quark_tmp:w \tl_to_str:n { : _ }
\cs_set:Npn \__quark_tmp:w #1 #2 \s__quark
  {
    \cs_new:Npn \__quark_quark_conditional_name:N ##1
      {
        \exp_last_unbraced:Nf \__quark_quark_conditional_name:w
          { \cs_to_str:N ##1 } #1 #2 #1 \s__quark
      }
    \cs_new:Npn \__quark_quark_conditional_name:w
      ##1 #2 ##2 #1 ##3 \s__quark {##2}
  }
\exp_after:wN \__quark_tmp:w \tl_to_str:n { : _quark_if_ } \s__quark
\cs_gset:Npn \g__scan_marks_tl { }
\cs_new_protected:Npn \scan_new:N #1
  {
    \tl_if_in:NnTF \g__scan_marks_tl { #1 }
      {
        \__kernel_msg_error:nnx { kernel } { scanmark-already-defined }
          { \token_to_str:N #1 }
      }
      {
        \tl_gput_right:Nn \g__scan_marks_tl {#1}
        \cs_new_eq:NN #1 \scan_stop:
      }
  }
\cs_new_eq:NN \s_stop \scan_stop:
\cs_gset_nopar:Npx \g__scan_marks_tl
  {
    \exp_not:o \g__scan_marks_tl
    \s_stop
    \s__quark
  }
\cs_new:Npn \use_none_delimit_by_s_stop:w #1 \s_stop { }
%% File: l3tl.dtx
\cs_new_eq:NN \__kernel_tl_set:Nx  \cs_set_nopar:Npx
\cs_new_eq:NN \__kernel_tl_gset:Nx \cs_gset_nopar:Npx
\cs_new_protected:Npn \tl_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs_gset_eq:NN #1 \c_empty_tl
  }
\cs_generate_variant:Nn \tl_new:N { c }
\cs_new_protected:Npn \tl_const:Nn #1#2
  {
    \__kernel_chk_if_free_cs:N #1
    \cs_gset_nopar:Npx #1 { \__kernel_exp_not:w {#2} }
  }
\cs_new_protected:Npn \tl_const:Nx #1#2
  {
    \__kernel_chk_if_free_cs:N #1
    \cs_gset_nopar:Npx #1 {#2}
  }
\cs_generate_variant:Nn \tl_const:Nn { c }
\cs_generate_variant:Nn \tl_const:Nx { c }
\cs_new_protected:Npn \tl_clear:N  #1
  { \tl_set_eq:NN #1 \c_empty_tl }
\cs_new_protected:Npn \tl_gclear:N #1
  { \tl_gset_eq:NN #1 \c_empty_tl }
\cs_generate_variant:Nn \tl_clear:N  { c }
\cs_generate_variant:Nn \tl_gclear:N { c }
\cs_new_protected:Npn \tl_clear_new:N  #1
  { \tl_if_exist:NTF #1 { \tl_clear:N #1 } { \tl_new:N #1 } }
\cs_new_protected:Npn \tl_gclear_new:N #1
  { \tl_if_exist:NTF #1 { \tl_gclear:N #1 } { \tl_new:N #1 } }
\cs_generate_variant:Nn \tl_clear_new:N  { c }
\cs_generate_variant:Nn \tl_gclear_new:N { c }
\cs_new_protected:Npn \tl_set_eq:NN  #1#2 { \cs_set_eq:NN #1 #2 }
\cs_new_protected:Npn \tl_gset_eq:NN #1#2 { \cs_gset_eq:NN #1 #2 }
\cs_generate_variant:Nn \tl_set_eq:NN { cN, Nc, cc }
\cs_generate_variant:Nn \tl_gset_eq:NN { cN, Nc, cc }
\cs_new_protected:Npn \tl_concat:NNN #1#2#3
  {
    \__kernel_tl_set:Nx #1
      {
        \__kernel_exp_not:w \exp_after:wN {#2}
        \__kernel_exp_not:w \exp_after:wN {#3}
      }
  }
\cs_new_protected:Npn \tl_gconcat:NNN #1#2#3
  {
    \__kernel_tl_gset:Nx #1
      {
        \__kernel_exp_not:w \exp_after:wN {#2}
        \__kernel_exp_not:w \exp_after:wN {#3}
      }
  }
\cs_generate_variant:Nn \tl_concat:NNN  { ccc }
\cs_generate_variant:Nn \tl_gconcat:NNN { ccc }
\prg_new_eq_conditional:NNn \tl_if_exist:N \cs_if_exist:N { TF , T , F , p }
\prg_new_eq_conditional:NNn \tl_if_exist:c \cs_if_exist:c { TF , T , F , p }
\tl_const:Nn \c_empty_tl { }
\group_begin:
\tex_lccode:D `A = `-
\tex_lccode:D `N = `N
\tex_lccode:D `V = `V
\tex_lowercase:D
  {
    \group_end:
    \tl_const:Nn \c_novalue_tl { ANoValue- }
  }
\tl_const:Nn \c_space_tl { ~ }
\cs_new_protected:Npn \tl_set:Nn #1#2
  { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w {#2} } }
\cs_new_protected:Npn \tl_set:No #1#2
  { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
\cs_new_protected:Npn \tl_set:Nx #1#2
  { \__kernel_tl_set:Nx #1 {#2} }
\cs_new_protected:Npn \tl_gset:Nn #1#2
  { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w {#2} } }
\cs_new_protected:Npn \tl_gset:No #1#2
  { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#2} } }
\cs_new_protected:Npn \tl_gset:Nx #1#2
  { \__kernel_tl_gset:Nx #1 {#2} }
\cs_generate_variant:Nn \tl_set:Nn  {    NV , Nv , Nf }
\cs_generate_variant:Nn \tl_set:Nn  { c, cV , cv , cf }
\cs_generate_variant:Nn \tl_set:Nx  { c }
\cs_generate_variant:Nn \tl_set:No  { c }
\cs_generate_variant:Nn \tl_gset:Nn {    NV , Nv , Nf }
\cs_generate_variant:Nn \tl_gset:Nn { c, cV , cv , cf }
\cs_generate_variant:Nn \tl_gset:Nx { c }
\cs_generate_variant:Nn \tl_gset:No { c }
\cs_new_protected:Npn \tl_put_left:Nn #1#2
  {
    \__kernel_tl_set:Nx #1
      { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
  }
\cs_new_protected:Npn \tl_put_left:NV #1#2
  {
    \__kernel_tl_set:Nx #1
      { \exp_not:V #2 \__kernel_exp_not:w \exp_after:wN {#1} }
  }
\cs_new_protected:Npn \tl_put_left:No #1#2
  {
    \__kernel_tl_set:Nx #1
      {
        \__kernel_exp_not:w \exp_after:wN {#2}
        \__kernel_exp_not:w \exp_after:wN {#1}
      }
  }
\cs_new_protected:Npn \tl_put_left:Nx #1#2
  { \__kernel_tl_set:Nx #1 { #2 \__kernel_exp_not:w \exp_after:wN {#1} } }
\cs_new_protected:Npn \tl_gput_left:Nn #1#2
  {
    \__kernel_tl_gset:Nx #1
      { \__kernel_exp_not:w {#2} \__kernel_exp_not:w \exp_after:wN {#1} }
  }
\cs_new_protected:Npn \tl_gput_left:NV #1#2
  {
    \__kernel_tl_gset:Nx #1
      { \exp_not:V #2 \__kernel_exp_not:w \exp_after:wN {#1} }
  }
\cs_new_protected:Npn \tl_gput_left:No #1#2
  {
    \__kernel_tl_gset:Nx #1
      {
        \__kernel_exp_not:w \exp_after:wN {#2}
        \__kernel_exp_not:w \exp_after:wN {#1}
      }
  }
\cs_new_protected:Npn \tl_gput_left:Nx #1#2
  { \__kernel_tl_gset:Nx #1 { #2 \__kernel_exp_not:w \exp_after:wN {#1} } }
\cs_generate_variant:Nn \tl_put_left:Nn  { c }
\cs_generate_variant:Nn \tl_put_left:NV  { c }
\cs_generate_variant:Nn \tl_put_left:No  { c }
\cs_generate_variant:Nn \tl_put_left:Nx  { c }
\cs_generate_variant:Nn \tl_gput_left:Nn { c }
\cs_generate_variant:Nn \tl_gput_left:NV { c }
\cs_generate_variant:Nn \tl_gput_left:No { c }
\cs_generate_variant:Nn \tl_gput_left:Nx { c }
\cs_new_protected:Npn \tl_put_right:Nn #1#2
  { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
\cs_new_protected:Npn \tl_put_right:NV #1#2
  {
    \__kernel_tl_set:Nx #1
      { \__kernel_exp_not:w \exp_after:wN {#1} \exp_not:V #2 }
  }
\cs_new_protected:Npn \tl_put_right:No #1#2
  {
    \__kernel_tl_set:Nx #1
      {
        \__kernel_exp_not:w \exp_after:wN {#1}
        \__kernel_exp_not:w \exp_after:wN {#2}
      }
  }
\cs_new_protected:Npn \tl_put_right:Nx #1#2
  { \__kernel_tl_set:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#1} #2 } }
\cs_new_protected:Npn \tl_gput_right:Nn #1#2
  { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN { #1 #2 } } }
\cs_new_protected:Npn \tl_gput_right:NV #1#2
  {
    \__kernel_tl_gset:Nx #1
      { \__kernel_exp_not:w \exp_after:wN {#1} \exp_not:V #2 }
  }
\cs_new_protected:Npn \tl_gput_right:No #1#2
  {
    \__kernel_tl_gset:Nx #1
      {
        \__kernel_exp_not:w \exp_after:wN {#1}
        \__kernel_exp_not:w \exp_after:wN {#2}
      }
  }
\cs_new_protected:Npn \tl_gput_right:Nx #1#2
  { \__kernel_tl_gset:Nx #1 { \__kernel_exp_not:w \exp_after:wN {#1} #2 } }
\cs_generate_variant:Nn \tl_put_right:Nn  { c }
\cs_generate_variant:Nn \tl_put_right:NV  { c }
\cs_generate_variant:Nn \tl_put_right:No  { c }
\cs_generate_variant:Nn \tl_put_right:Nx  { c }
\cs_generate_variant:Nn \tl_gput_right:Nn { c }
\cs_generate_variant:Nn \tl_gput_right:NV { c }
\cs_generate_variant:Nn \tl_gput_right:No { c }
\cs_generate_variant:Nn \tl_gput_right:Nx { c }
\quark_new:N \q__tl_nil
\quark_new:N \q__tl_mark
\quark_new:N \q__tl_stop
\quark_new:N \q__tl_recursion_tail
\quark_new:N \q__tl_recursion_stop
\__kernel_quark_new_test:N \__tl_if_recursion_tail_break:nN
\__kernel_quark_new_conditional:Nn \__tl_quark_if_nil:n { TF }
\tl_const:Nx \c__tl_rescan_marker_tl { : \token_to_str:N : }
\cs_new_protected:Npn \tl_rescan:nn #1#2
  {
    \tl_set_rescan:Nnn \l__tl_internal_a_tl {#1} {#2}
    \exp_after:wN \__tl_rescan_aux:
    \l__tl_internal_a_tl
  }
\exp_args:NNo \cs_new_protected:Npn \__tl_rescan_aux:
  { \tl_clear:N \l__tl_internal_a_tl }
\cs_new_protected:Npn \tl_set_rescan:Nnn
  { \__tl_set_rescan:NNnn \tl_set:No }
\cs_new_protected:Npn \tl_gset_rescan:Nnn
  { \__tl_set_rescan:NNnn \tl_gset:No }
\cs_new_protected:Npn \__tl_set_rescan:NNnn #1#2#3#4
  {
    \group_begin:
      \if_false: { \fi:
      \int_set_eq:NN \tex_tracingnesting:D \c_zero_int
      \int_compare:nNnT \tex_endlinechar:D = { 32 }
        { \int_set:Nn \tex_endlinechar:D { -1 } }
      \int_set_eq:NN \tex_newlinechar:D \tex_endlinechar:D
      #3 \scan_stop:
      \exp_args:No \__tl_set_rescan:nNN { \tl_to_str:n {#4} } #1 #2
    \if_false: } \fi:
  }
\cs_new_protected:Npn \__tl_set_rescan_multi:nNN #1#2#3
  {
    \tex_everyeof:D \exp_after:wN { \c__tl_rescan_marker_tl }
    \exp_after:wN \__tl_rescan:NNw
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN \prg_do_nothing:
    \tex_scantokens:D {#1}
  }
\exp_args:Nno \use:nn
  { \cs_new:Npn \__tl_rescan:NNw #1#2#3 } \c__tl_rescan_marker_tl
  {
    \group_end:
    #1 #2 {#3}
  }
\cs_generate_variant:Nn \tl_set_rescan:Nnn  {     Nno , Nnx }
\cs_generate_variant:Nn \tl_set_rescan:Nnn  { c , cno , cnx }
\cs_generate_variant:Nn \tl_gset_rescan:Nnn {     Nno , Nnx }
\cs_generate_variant:Nn \tl_gset_rescan:Nnn { c , cno }
\cs_new_protected:Npn \__tl_set_rescan:nNN #1
  {
    \int_compare:nNnTF \tex_newlinechar:D < 0
      { \use_ii:nn }
      {
        \exp_args:Nnf \tl_if_in:nnTF {#1}
          { \char_generate:nn { \tex_newlinechar:D } { 12 } }
      }
        { \__tl_set_rescan_multi:nNN }
        {
          \int_set:Nn \tex_endlinechar:D { -1 }
          \__tl_set_rescan_single:nnNN { `' }
        }
    {#1}
  }
\cs_new_protected:Npn \__tl_set_rescan_single:nnNN #1
  {
    \int_compare:nNnTF
      { \char_value_catcode:n {#1} / 2 } = 6
      {
        \exp_args:Nof \__tl_set_rescan_single_aux:nnnNN
          \c__tl_rescan_marker_tl
          { \char_generate:nn {#1} { \char_value_catcode:n {#1} } }
      }
      {
        \int_compare:nNnTF {#1} < { `\~ }
          {
            \exp_args:Nf \__tl_set_rescan_single:nnNN
              { \int_eval:n { #1 + 1 } }
          }
          { \__tl_set_rescan_multi:nNN }
      }
  }
\cs_new_protected:Npn \__tl_set_rescan_single_aux:nnnNN #1#2#3#4#5
  {
    \tex_everyeof:D
      {
        #1 \use_none:n
        #2 #1 { \exp:w \__tl_set_rescan_single_aux:w }
        \s__tl_stop
      }
    \cs_set:Npn \__tl_rescan:NNw ##1##2##3 #2 #1 ##4 ##5 \s__tl_stop
      {
        \group_end:
        ##1 ##2 { ##4 ##3 }
      }
    \exp_after:wN \__tl_rescan:NNw
    \exp_after:wN #4
    \exp_after:wN #5
    \tex_scantokens:D { #2 #3 #2 }
  }
\exp_args:Nno \use:nn
  { \cs_new:Npn \__tl_set_rescan_single_aux:w #1 }
  \c__tl_rescan_marker_tl #2
  { \use_i:nn \exp_end: #1 }
\cs_new_protected:Npn \tl_replace_once:Nnn
  { \__tl_replace:NnNNNnn \q__tl_mark ? \__tl_replace_wrap:w \__kernel_tl_set:Nx  }
\cs_new_protected:Npn \tl_greplace_once:Nnn
  { \__tl_replace:NnNNNnn \q__tl_mark ? \__tl_replace_wrap:w \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \tl_replace_all:Nnn
  { \__tl_replace:NnNNNnn \q__tl_mark ? \__tl_replace_next:w \__kernel_tl_set:Nx  }
\cs_new_protected:Npn \tl_greplace_all:Nnn
  { \__tl_replace:NnNNNnn \q__tl_mark ? \__tl_replace_next:w \__kernel_tl_gset:Nx }
\cs_generate_variant:Nn \tl_replace_once:Nnn  { c }
\cs_generate_variant:Nn \tl_greplace_once:Nnn { c }
\cs_generate_variant:Nn \tl_replace_all:Nnn   { c }
\cs_generate_variant:Nn \tl_greplace_all:Nnn  { c }
\cs_new_protected:Npn \__tl_replace:NnNNNnn #1#2#3#4#5#6#7
  {
    \tl_if_empty:nTF {#6}
      {
        \__kernel_msg_error:nnx { kernel } { empty-search-pattern }
          { \tl_to_str:n {#7} }
      }
      {
        \tl_if_in:onTF { #5 #6 } {#1}
          {
            \tl_if_in:nnTF {#6} {#1}
              { \exp_args:Nc \__tl_replace:NnNNNnn {#2} {#2?} }
              {
                \__tl_quark_if_nil:nTF {#6}
                  { \__tl_replace_auxi:NnnNNNnn #5 {#1} { #1 \q__tl_stop } }
                  { \__tl_replace_auxi:NnnNNNnn #5 {#1} { #1 \q__tl_nil  } }
              }
          }
          { \__tl_replace_auxii:nNNNnn {#1} }
          #3#4#5 {#6} {#7}
      }
  }
\cs_new_protected:Npn \__tl_replace_auxi:NnnNNNnn #1#2#3
  {
    \tl_if_in:NnTF #1 { #2 #3 #3 }
      { \__tl_replace_auxi:NnnNNNnn #1 { #2 #3 } {#2} }
      { \__tl_replace_auxii:nNNNnn { #2 #3 #3 } }
  }
\cs_new_protected:Npn \__tl_replace_auxii:nNNNnn #1#2#3#4#5#6
  {
    \group_align_safe_begin:
    \cs_set:Npn \__tl_replace_wrap:w ##1 #1 ##2
      { \__kernel_exp_not:w \exp_after:wN { \use_none:nn ##1 } ##2 }
    \cs_set:Npx \__tl_replace_next:w ##1 #5
      {
        \exp_not:N \__tl_replace_wrap:w ##1
        \exp_not:n { #1 }
        \exp_not:n { \exp_not:n {#6} }
        \exp_not:n { #2 { } { } }
      }
    #3 #4
      {
        \exp_after:wN \__tl_replace_next_aux:w
        #4
        #1
        {
          \if_false: { \fi: }
          \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi:
        }
        #5
      }
    \group_align_safe_end:
  }
\cs_new:Npn \__tl_replace_next_aux:w { \__tl_replace_next:w { } { } }
\cs_new_eq:NN \__tl_replace_wrap:w ?
\cs_new_eq:NN \__tl_replace_next:w ?
\cs_new_protected:Npn \tl_remove_once:Nn #1#2
  { \tl_replace_once:Nnn #1 {#2} { } }
\cs_new_protected:Npn \tl_gremove_once:Nn #1#2
  { \tl_greplace_once:Nnn #1 {#2} { } }
\cs_generate_variant:Nn \tl_remove_once:Nn  { c }
\cs_generate_variant:Nn \tl_gremove_once:Nn { c }
\cs_new_protected:Npn \tl_remove_all:Nn #1#2
  { \tl_replace_all:Nnn #1 {#2} { } }
\cs_new_protected:Npn \tl_gremove_all:Nn #1#2
  { \tl_greplace_all:Nnn #1 {#2} { } }
\cs_generate_variant:Nn \tl_remove_all:Nn  { c }
\cs_generate_variant:Nn \tl_gremove_all:Nn { c }
\prg_new_conditional:Npnn \tl_if_empty:N #1 { p , T , F , TF }
  {
    \if_meaning:w #1 \c_empty_tl
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_empty:N
  { c } { p , T , F , TF }
\prg_new_conditional:Npnn \tl_if_empty:n #1 { p , TF , T , F }
  {
    \if:w \scan_stop: \tl_to_str:n {#1} \scan_stop:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_empty:n
  { V } { p , TF , T , F }
\cs_new:Npn \__tl_if_empty_if:o #1
  {
    \if:w \scan_stop: \__kernel_tl_to_str:w \exp_after:wN {#1} \scan_stop:
  }
\exp_args:Nno \use:n
  { \prg_new_conditional:Npnn \tl_if_empty:o #1 { p , TF , T , F } }
  {
    \__tl_if_empty_if:o {#1}
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
 }
\exp_args:Nno \use:n
  { \prg_new_conditional:Npnn \tl_if_blank:n #1 { p , T , F , TF } }
  {
    \__tl_if_empty_if:o { \use_none:n #1 ? }
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_blank:n
  { e , V , o } { p , T , F , TF }
\prg_new_conditional:Npnn \tl_if_eq:NN #1#2 { p , T , F , TF }
  {
    \if_meaning:w #1 #2
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_eq:NN
  { Nc , c , cc } { p , TF , T , F }
\tl_new:N \l__tl_internal_a_tl
\tl_new:N \l__tl_internal_b_tl
\prg_new_protected_conditional:Npnn \tl_if_eq:Nn #1#2 { T , F , TF }
  {
    \group_begin:
      \tl_set:Nn \l__tl_internal_b_tl {#2}
      \exp_after:wN
    \group_end:
    \if_meaning:w #1 \l__tl_internal_b_tl
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_eq:Nn { c } { TF , T , F }
\prg_new_protected_conditional:Npnn \tl_if_eq:nn #1#2 { T , F ,  TF }
  {
    \group_begin:
      \tl_set:Nn \l__tl_internal_a_tl {#1}
      \tl_set:Nn \l__tl_internal_b_tl {#2}
      \exp_after:wN
    \group_end:
    \if_meaning:w \l__tl_internal_a_tl \l__tl_internal_b_tl
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new_protected:Npn \tl_if_in:NnT  { \exp_args:No \tl_if_in:nnT  }
\cs_new_protected:Npn \tl_if_in:NnF  { \exp_args:No \tl_if_in:nnF  }
\cs_new_protected:Npn \tl_if_in:NnTF { \exp_args:No \tl_if_in:nnTF }
\prg_generate_conditional_variant:Nnn \tl_if_in:Nn
  { c } { T , F , TF }
\prg_new_protected_conditional:Npnn \tl_if_in:nn #1#2 { T  , F , TF }
  {
    \scan_stop:
    \if_false: { \fi:
    \cs_set:Npn \__tl_tmp:w ##1 #2 { }
    \tl_if_empty:oTF { \__tl_tmp:w #1 {} {} #2 }
      { \prg_return_false: } { \prg_return_true: }
    \if_false: } \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_in:nn
  { V , o , no } { T , F , TF }
\cs_set_protected:Npn \__tl_tmp:w #1
  {
    \prg_new_conditional:Npnn \tl_if_novalue:n ##1
      { p , T ,  F , TF }
      {
        \str_if_eq:onTF
          { \__tl_if_novalue:w ? ##1 { } #1 }
          { ? { } #1 }
          { \prg_return_true: }
          { \prg_return_false: }
      }
    \cs_new:Npn \__tl_if_novalue:w ##1 #1 {##1}
  }
\exp_args:No \__tl_tmp:w { \c_novalue_tl }
\cs_new:Npn \tl_if_single_p:N { \exp_args:No \tl_if_single_p:n }
\cs_new:Npn \tl_if_single:NT  { \exp_args:No \tl_if_single:nT  }
\cs_new:Npn \tl_if_single:NF  { \exp_args:No \tl_if_single:nF  }
\cs_new:Npn \tl_if_single:NTF { \exp_args:No \tl_if_single:nTF }
\prg_new_conditional:Npnn \tl_if_single:n #1 { p , T , F , TF }
  {
    \if:w \scan_stop: \exp_after:wN \__tl_if_single:nnw
        \__kernel_tl_to_str:w
          \exp_after:wN { \use_none:nn #1 ?? } \scan_stop: ? \s__tl_stop
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__tl_if_single:nnw #1#2#3 \s__tl_stop {#2}
\prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF }
  {
    \tl_if_head_is_N_type:nTF {#1}
      { \__tl_if_empty_if:o { \use_none:n #1 } }
      {
        \tl_if_empty:nTF {#1}
          { \if_false: }
          { \__tl_if_empty_if:o { \exp:w \exp_end_continue_f:w #1 } }
      }
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \tl_case:Nn #1#2
  {
    \exp:w
    \__tl_case:NnTF #1 {#2} { } { }
  }
\cs_new:Npn \tl_case:NnT #1#2#3
  {
    \exp:w
    \__tl_case:NnTF #1 {#2} {#3} { }
  }
\cs_new:Npn \tl_case:NnF #1#2#3
  {
    \exp:w
    \__tl_case:NnTF #1 {#2} { } {#3}
  }
\cs_new:Npn \tl_case:NnTF #1#2
  {
    \exp:w
    \__tl_case:NnTF #1 {#2}
  }
\cs_new:Npn \__tl_case:NnTF #1#2#3#4
  { \__tl_case:Nw #1 #2 #1 { } \s__tl_mark {#3} \s__tl_mark {#4} \s__tl_stop }
\cs_new:Npn \__tl_case:Nw #1#2#3
  {
    \tl_if_eq:NNTF #1 #2
      { \__tl_case_end:nw {#3} }
      { \__tl_case:Nw #1 }
  }
\cs_generate_variant:Nn \tl_case:Nn   { c }
\prg_generate_conditional_variant:Nnn \tl_case:Nn
  { c } { T , F , TF }
\cs_new:Npn \__tl_case_end:nw #1#2#3 \s__tl_mark #4#5 \s__tl_stop
  { \exp_end: #1 #4 }
\cs_new:Npn \tl_map_function:nN #1#2
  {
    \__tl_map_function:Nn #2 #1
      \q__tl_recursion_tail
    \prg_break_point:Nn \tl_map_break: { }
  }
\cs_new:Npn \tl_map_function:NN
  { \exp_args:No \tl_map_function:nN }
\cs_new:Npn \__tl_map_function:Nn #1#2
  {
    \__tl_if_recursion_tail_break:nN {#2} \tl_map_break:
    #1 {#2} \__tl_map_function:Nn #1
  }
\cs_generate_variant:Nn \tl_map_function:NN { c }
\cs_new_protected:Npn \tl_map_inline:nn #1#2
  {
    \int_gincr:N \g__kernel_prg_map_int
    \cs_gset_protected:cpn
      { __tl_map_ \int_use:N \g__kernel_prg_map_int :w } ##1 {#2}
    \exp_args:Nc \__tl_map_function:Nn
      { __tl_map_ \int_use:N \g__kernel_prg_map_int :w }
      #1 \q__tl_recursion_tail
    \prg_break_point:Nn \tl_map_break:
      { \int_gdecr:N \g__kernel_prg_map_int }
  }
\cs_new_protected:Npn \tl_map_inline:Nn
  { \exp_args:No \tl_map_inline:nn }
\cs_generate_variant:Nn \tl_map_inline:Nn { c }
\cs_new:Npn \tl_map_tokens:nn #1#2
  {
    \__tl_map_tokens:nn {#2} #1
      \q__tl_recursion_tail
    \prg_break_point:Nn \tl_map_break: { }
  }
\cs_new:Npn \tl_map_tokens:Nn
  { \exp_args:No \tl_map_tokens:nn }
\cs_generate_variant:Nn \tl_map_tokens:Nn { c }
\cs_new:Npn \__tl_map_tokens:nn #1#2
  {
    \__tl_if_recursion_tail_break:nN {#2} \tl_map_break:
    \use:n {#1} {#2}
    \__tl_map_tokens:nn {#1}
  }
\cs_new_protected:Npn \tl_map_variable:nNn #1#2#3
  {
    \__tl_map_variable:Nnn #2 {#3} #1
      \q__tl_recursion_tail
    \prg_break_point:Nn \tl_map_break: { }
  }
\cs_new_protected:Npn \tl_map_variable:NNn
  { \exp_args:No \tl_map_variable:nNn }
\cs_new_protected:Npn \__tl_map_variable:Nnn #1#2#3
  {
    \__tl_if_recursion_tail_break:nN {#3} \tl_map_break:
    \tl_set:Nn #1 {#3}
    \use:n {#2}
    \__tl_map_variable:Nnn #1 {#2}
  }
\cs_generate_variant:Nn \tl_map_variable:NNn { c }
\cs_new:Npn \tl_map_break:
  { \prg_map_break:Nn \tl_map_break: { } }
\cs_new:Npn \tl_map_break:n
  { \prg_map_break:Nn \tl_map_break: }
\cs_generate_variant:Nn \tl_to_str:n { V }
\cs_new:Npn \tl_to_str:N #1 { \__kernel_tl_to_str:w \exp_after:wN {#1} }
\cs_generate_variant:Nn \tl_to_str:N { c }
\cs_new:Npn \tl_use:N #1
  {
    \tl_if_exist:NTF #1 {#1}
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { bad-variable } {#1}
      }
  }
\cs_generate_variant:Nn \tl_use:N { c }
\cs_new:Npn \tl_count:n #1
  {
    \int_eval:n
      { 0 \tl_map_function:nN {#1} \__tl_count:n }
  }
\cs_new:Npn \tl_count:N #1
  {
    \int_eval:n
      { 0 \tl_map_function:NN #1 \__tl_count:n }
  }
\cs_new:Npn \__tl_count:n #1 { + 1 }
\cs_generate_variant:Nn \tl_count:n { V , o }
\cs_generate_variant:Nn \tl_count:N { c }
\cs_new:Npn \tl_count_tokens:n #1
  {
    \int_eval:n
      {
        \__tl_act:NNNn
          \__tl_act_count_normal:N
          \__tl_act_count_group:n
          \__tl_act_count_space:
          {#1}
      }
  }
\cs_new:Npn \__tl_act_count_normal:N #1 { 1 + }
\cs_new:Npn \__tl_act_count_space: { 1 + }
\cs_new:Npn \__tl_act_count_group:n #1 { 2 + \tl_count_tokens:n {#1} + }
\cs_new:Npn \tl_reverse_items:n #1
  {
    \__tl_reverse_items:nwNwn #1 ?
      \s__tl_mark \__tl_reverse_items:nwNwn
      \s__tl_mark \__tl_reverse_items:wn
      \s__tl_stop { }
  }
\cs_new:Npn \__tl_reverse_items:nwNwn #1 #2 \s__tl_mark #3 #4 \s__tl_stop #5
  {
    #3 #2
      \s__tl_mark \__tl_reverse_items:nwNwn
      \s__tl_mark \__tl_reverse_items:wn
      \s__tl_stop { {#1} #5 }
  }
\cs_new:Npn \__tl_reverse_items:wn #1 \s__tl_stop #2
  { \__kernel_exp_not:w \exp_after:wN { \use_none:nn #2 } }
\cs_new:Npn \tl_trim_spaces:n #1
  {
    \__tl_trim_spaces:nn
      { \__tl_trim_mark: #1 }
      { \__kernel_exp_not:w \exp_after:wN }
  }
\cs_generate_variant:Nn \tl_trim_spaces:n { o }
\cs_new:Npn \tl_trim_spaces_apply:nN #1#2
  { \__tl_trim_spaces:nn { \__tl_trim_mark: #1 } { \exp_args:No #2 } }
\cs_generate_variant:Nn \tl_trim_spaces_apply:nN { o }
\cs_new_protected:Npn \tl_trim_spaces:N #1
  { \__kernel_tl_set:Nx #1 { \exp_args:No \tl_trim_spaces:n {#1} } }
\cs_new_protected:Npn \tl_gtrim_spaces:N #1
  { \__kernel_tl_gset:Nx #1 { \exp_args:No \tl_trim_spaces:n {#1} } }
\cs_generate_variant:Nn \tl_trim_spaces:N  { c }
\cs_generate_variant:Nn \tl_gtrim_spaces:N { c }
\cs_set_protected:Npn \__tl_tmp:w #1
  {
    \cs_new:Npn \__tl_trim_spaces:nn ##1
      {
        \__tl_trim_spaces_auxi:w
          ##1
          \s__tl_nil
          \__tl_trim_mark: #1 { }
          \__tl_trim_mark: \__tl_trim_spaces_auxii:w
          \__tl_trim_spaces_auxiii:w
          #1 \s__tl_nil
          \__tl_trim_spaces_auxiv:w
        \s__tl_stop
      }
    \cs_new:Npn
        \__tl_trim_spaces_auxi:w ##1 \__tl_trim_mark: #1 ##2 \__tl_trim_mark: ##3
      {
        ##3
        \__tl_trim_spaces_auxi:w
        \__tl_trim_mark:
        ##2
        \__tl_trim_mark: #1 {##1}
      }
    \cs_new:Npn \__tl_trim_spaces_auxii:w
        \__tl_trim_spaces_auxi:w \__tl_trim_mark: \__tl_trim_mark: ##1
      {
        \__tl_trim_spaces_auxiii:w
        ##1
      }
    \cs_new:Npn \__tl_trim_spaces_auxiii:w ##1 #1 \s__tl_nil ##2
      {
        ##2
        ##1 \s__tl_nil
        \__tl_trim_spaces_auxiii:w
      }
    \cs_new:Npn \__tl_trim_spaces_auxiv:w ##1 \s__tl_nil ##2 \s__tl_stop ##3
      { ##3 { ##1 } }
    \cs_new:Npn \__tl_trim_mark: {}
  }
\__tl_tmp:w { ~ }
\cs_if_exist:NTF \tex_expanded:D
  {
    \cs_new:Npn \tl_head:n #1
      {
        \__kernel_exp_not:w \tex_expanded:D
          { { \if_false: { \fi: \__tl_head_aux:n #1 { } } } }
      }
    \cs_new:Npn \__tl_head_aux:n #1
      {
        \__kernel_exp_not:w {#1}
        \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi:
      }
  }
  {
    \cs_new:Npn \tl_head:n #1
      {
        \__kernel_exp_not:w
          \if_false: { \fi: \__tl_head_auxi:nw #1 { } \s__tl_stop }
      }
    \cs_new:Npn \__tl_head_auxi:nw #1#2 \s__tl_stop
      {
        \exp_after:wN \__tl_head_auxii:n \exp_after:wN {
          \if_false: } \fi: {#1}
      }
    \exp_args:Nno \use:n
      { \cs_new:Npn \__tl_head_auxii:n #1 }
      {
        \__tl_if_empty_if:o { \use_none:n #1 }
          \exp_after:wN \use_ii:nnn
        \fi:
        \use_ii:nn
          {#1}
          { \if_false: { \fi: \__tl_head_auxi:nw #1 } }
      }
  }
\cs_generate_variant:Nn \tl_head:n { V , v , f }
\cs_new:Npn \tl_head:w #1#2 \q_stop {#1}
\cs_new:Npn \__tl_tl_head:w #1#2 \s__tl_stop {#1}
\cs_new:Npn \tl_head:N { \exp_args:No \tl_head:n }
\exp_args:Nno \use:n { \cs_new:Npn \tl_tail:n #1 }
  {
    \exp_after:wN \__kernel_exp_not:w
      \tl_if_blank:nTF {#1}
        { { } }
        { \exp_after:wN { \use_none:n #1 } }
  }
\cs_generate_variant:Nn \tl_tail:n { V , v , f }
\cs_new:Npn \tl_tail:N { \exp_args:No \tl_tail:n }
\prg_new_conditional:Npnn \tl_if_head_eq_charcode:nN #1#2 { p , T , F , TF }
  {
    \if_charcode:w
        \tl_if_head_is_N_type:nTF { #1 ? }
          { \__tl_head_exp_not:w #1 { ^ \__tl_if_head_eq_empty_arg:w } \s__tl_stop }
          { \str_head:n {#1} }
        \exp_not:N #2
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_head_eq_charcode:nN
  { f } { p , TF , T , F }
\prg_new_conditional:Npnn \tl_if_head_eq_catcode:nN #1 #2 { p , T , F , TF }
  {
    \if_catcode:w
        \tl_if_head_is_N_type:nTF { #1 ? }
          { \__tl_head_exp_not:w #1 { ^ \__tl_if_head_eq_empty_arg:w } \s__tl_stop }
          {
            \tl_if_head_is_group:nTF {#1}
              \c_group_begin_token
              \c_space_token
          }
        \exp_not:N #2
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \tl_if_head_eq_catcode:nN
  { o } { p , TF , T , F }
\prg_new_conditional:Npnn \tl_if_head_eq_meaning:nN #1#2 { p , T , F , TF }
  {
    \tl_if_head_is_N_type:nTF { #1 ? }
      \__tl_if_head_eq_meaning_normal:nN
      \__tl_if_head_eq_meaning_special:nN
    {#1} #2
  }
\cs_new:Npn \__tl_if_head_eq_meaning_normal:nN #1 #2
  {
    \exp_after:wN \if_meaning:w
        \__tl_tl_head:w #1 { ?? \use_none:nnn } \s__tl_stop #2
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__tl_if_head_eq_meaning_special:nN #1 #2
  {
    \if_charcode:w \str_head:n {#1} \exp_not:N #2
      \exp_after:wN \use_ii:nn
    \else:
      \prg_return_false:
    \fi:
    \use_none:n
    {
      \if_catcode:w \exp_not:N #2
                    \tl_if_head_is_group:nTF {#1}
                      { \c_group_begin_token }
                      { \c_space_token }
        \prg_return_true:
      \else:
        \prg_return_false:
      \fi:
    }
  }
\cs_new:Npn \__tl_head_exp_not:w #1 #2 \s__tl_stop
  { \exp_not:N #1 }
\cs_new:Npn \__tl_if_head_eq_empty_arg:w \exp_not:N #1
  { ? }
\prg_new_conditional:Npnn \tl_if_head_is_N_type:n #1 { p , T , F , TF }
  {
    \if:w
        \if_false: { \fi: \__tl_if_head_is_N_type_auxi:w \prg_do_nothing: #1 ~ }
        { \exp_after:wN { \token_to_str:N #1 } }
        \scan_stop: \scan_stop:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\exp_args:Nno \use:n { \cs_new:Npn \__tl_if_head_is_N_type_auxi:w #1 ~ }
  {
    \tl_if_empty:oTF { #1 }
      { f \exp_after:wN \use_none:nn }
      { \exp_after:wN \__tl_if_head_is_N_type_auxii:n }
    \exp_after:wN { \if_false: } \fi:
  }
\cs_new:Npn \__tl_if_head_is_N_type_auxii:n #1
  { \exp_after:wN \use_none:n \exp_after:wN }
\prg_new_conditional:Npnn \tl_if_head_is_group:n #1 { p , T , F , TF }
  {
    \if:w
        \exp_after:wN \use_none:n
          \exp_after:wN { \exp_after:wN { \token_to_str:N #1 ? } }
        \scan_stop: \scan_stop:
      \__tl_if_head_is_group_fi_false:w
    \fi:
    \if_true:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__tl_if_head_is_group_fi_false:w \fi: \if_true: { \fi: \if_false: }
\prg_new_conditional:Npnn \tl_if_head_is_space:n #1 { p , T , F , TF }
  {
    \if:w
        \if_false: { \fi: \__tl_if_head_is_space:w \prg_do_nothing: #1 ? ~ }
        \scan_stop: \scan_stop:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\exp_args:Nno \use:n { \cs_new:Npn \__tl_if_head_is_space:w #1 ~ }
  {
    \__tl_if_empty_if:o {#1} \else: f \fi:
    \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi:
  }
\scan_new:N \s__tl_act_stop
\cs_set_protected:Npn \__tl_tmp:w #1
  {
    \cs_new:Npn \__tl_act_if_head_is_space:nTF ##1
      {
        \__tl_act_if_head_is_space:w
          \s__tl_act_stop ##1 \s__tl_act_stop \__tl_act_if_head_is_space_true:w
          \s__tl_act_stop #1  \s__tl_act_stop \use_ii:nn
      }
    \cs_new:Npn \__tl_act_if_head_is_space:w
        ##1 \s__tl_act_stop #1 ##2 \s__tl_act_stop
      {}
    \cs_new:Npn \__tl_act_if_head_is_space_true:w
        \s__tl_act_stop #1 \s__tl_act_stop \use_ii:nn ##1 ##2
      {##1}
  }
\__tl_tmp:w { ~ }
\exp_args:Nnx \use:n { \cs_new:Npn \__tl_act_loop:w #1 \s__tl_act_stop }
  {
    \exp_not:o { \__tl_act_if_head_is_space:nTF {#1} }
      \exp_not:N \__tl_act_space:wwNNN
      {
        \exp_not:o { \tl_if_head_is_group:nTF {#1} }
          \exp_not:N \__tl_act_group:nwNNN
          \exp_not:N \__tl_act_normal:NwNNN
      }
    \exp_not:n {#1} \s__tl_act_stop
  }
\cs_undefine:N \__tl_act_if_head_is_space:nTF
\cs_new:Npn \__tl_act_normal:NwNNN #1 #2 \s__tl_act_stop #3
  {
    #3 #1
    \__tl_act_loop:w #2 \s__tl_act_stop
    #3
  }
\cs_new:Npn \__tl_use_none_delimit_by_s_act_stop:w #1 \s__tl_act_stop { }
\cs_new:Npn \__tl_act_end:wn #1 \__tl_act_result:n #2
  { \group_align_safe_end: \exp_end: #2 }
\cs_new:Npn \__tl_act_group:nwNNN #1 #2 \s__tl_act_stop #3#4#5
  {
    \__tl_use_none_delimit_by_s_act_stop:w #1 \__tl_act_end:wn \s__tl_act_stop
    #5 {#1}
    \__tl_act_loop:w #2 \s__tl_act_stop
    #3 #4 #5
  }
\exp_last_unbraced:NNo
  \cs_new:Npn \__tl_act_space:wwNNN \c_space_tl #1 \s__tl_act_stop #2#3
  {
    #3
    \__tl_act_loop:w #1 \s__tl_act_stop
    #2 #3
  }
\cs_new:Npn \__tl_act:NNNn #1#2#3#4
  {
    \group_align_safe_begin:
    \__tl_act_loop:w #4 { \s__tl_act_stop } ? \s__tl_act_stop
    #1 #3 #2
    \__tl_act_result:n { }
  }
\cs_new:Npn \__tl_act_output:n #1 #2 \__tl_act_result:n #3
  { #2 \__tl_act_result:n { #3 #1 } }
\cs_new:Npn \__tl_act_reverse_output:n #1 #2 \__tl_act_result:n #3
  { #2 \__tl_act_result:n { #1 #3 } }
\cs_new:Npn \tl_reverse:n #1
  {
    \__kernel_exp_not:w \exp_after:wN
      {
        \exp:w
        \__tl_act:NNNn
          \__tl_reverse_normal:N
          \__tl_reverse_group_preserve:n
          \__tl_reverse_space:
          {#1}
      }
  }
\cs_generate_variant:Nn \tl_reverse:n { o , V }
\cs_new:Npn \__tl_reverse_normal:N
  { \__tl_act_reverse_output:n }
\cs_new:Npn \__tl_reverse_group_preserve:n #1
  { \__tl_act_reverse_output:n { {#1} } }
\cs_new:Npn \__tl_reverse_space:
  { \__tl_act_reverse_output:n { ~ } }
\cs_new_protected:Npn \tl_reverse:N #1
  { \__kernel_tl_set:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } }
\cs_new_protected:Npn \tl_greverse:N #1
  { \__kernel_tl_gset:Nx #1 { \exp_args:No \tl_reverse:n { #1 } } }
\cs_generate_variant:Nn \tl_reverse:N  { c }
\cs_generate_variant:Nn \tl_greverse:N { c }
\cs_new:Npn \tl_item:nn #1#2
  {
    \exp_args:Nf \__tl_item:nn
      { \exp_args:Nf \__tl_item_aux:nn { \int_eval:n {#2} } {#1} }
    #1
    \q__tl_recursion_tail
    \prg_break_point:
  }
\cs_new:Npn \__tl_item_aux:nn #1#2
  {
    \int_compare:nNnTF {#1} < 0
      { \int_eval:n { \tl_count:n {#2} + 1 + #1 } }
      {#1}
  }
\cs_new:Npn \__tl_item:nn #1#2
  {
    \__tl_if_recursion_tail_break:nN {#2} \prg_break:
    \int_compare:nNnTF {#1} = 1
      { \prg_break:n { \exp_not:n {#2} } }
      { \exp_args:Nf \__tl_item:nn { \int_eval:n { #1 - 1 } } }
  }
\cs_new:Npn \tl_item:Nn { \exp_args:No \tl_item:nn }
\cs_generate_variant:Nn \tl_item:Nn { c }
\cs_new:Npn \tl_rand_item:n #1
  {
    \tl_if_blank:nF {#1}
      { \tl_item:nn {#1} { \int_rand:nn { 1 } { \tl_count:n {#1} } } }
  }
\cs_new:Npn \tl_rand_item:N { \exp_args:No \tl_rand_item:n }
\cs_generate_variant:Nn \tl_rand_item:N { c }
\cs_new:Npn \tl_range:Nnn { \exp_args:No \tl_range:nnn }
\cs_generate_variant:Nn \tl_range:Nnn { c }
\cs_new:Npn \tl_range:nnn { \__tl_range:Nnnn \__tl_range:w }
\cs_new:Npn \__tl_range:Nnnn #1#2#3#4
  {
    \tl_head:f
      {
        \exp_args:Nf \__tl_range:nnnNn
          { \tl_count:n {#2} } {#3} {#4} #1 {#2}
      }
  }
\cs_new:Npn \__tl_range:nnnNn #1#2#3
  {
    \exp_args:Nff \__tl_range:nnNn
      {
        \exp_args:Nf \__tl_range_normalize:nn
          { \int_eval:n { #2 - 1 } } {#1}
      }
      {
        \exp_args:Nf \__tl_range_normalize:nn
          { \int_eval:n {#3} } {#1}
      }
  }
\cs_new:Npn \__tl_range:nnNn #1#2#3#4
  {
    \if_int_compare:w #2 > #1 \exp_stop_f: \else:
      \exp_after:wN { \exp_after:wN }
    \fi:
    \exp_after:wN #3
    \int_value:w \int_eval:n { #2 - #1 } \exp_after:wN ;
    \exp_after:wN { \exp:w \__tl_range_skip:w #1 ; { } #4 }
  }
\cs_new:Npn \__tl_range_skip:w #1 ; #2
  {
    \if_int_compare:w #1 > 0 \exp_stop_f:
      \exp_after:wN \__tl_range_skip:w
      \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ;
    \else:
      \exp_after:wN \exp_end:
    \fi:
  }
\cs_new:Npn \__tl_range:w #1 ; #2
  {
    \exp_args:Nf \__tl_range_collect:nn
      { \__tl_range_skip_spaces:n {#2} } {#1}
  }
\cs_new:Npn \__tl_range_skip_spaces:n #1
  {
    \tl_if_head_is_space:nTF {#1}
      { \exp_args:Nf \__tl_range_skip_spaces:n {#1} }
      { { } #1 }
  }
\cs_new:Npn \__tl_range_collect:nn #1#2
  {
    \int_compare:nNnTF {#2} = 0
      {#1}
      {
        \exp_args:No \tl_if_head_is_space:nTF { \use_none:n #1 }
          {
            \exp_args:Nf \__tl_range_collect:nn
              { \__tl_range_collect_space:nw #1 }
              {#2}
          }
          {
            \__tl_range_collect:ff
              {
                \exp_args:No \tl_if_head_is_N_type:nTF { \use_none:n #1 }
                  { \__tl_range_collect_N:nN }
                  { \__tl_range_collect_group:nn }
                #1
              }
              { \int_eval:n { #2 - 1 } }
          }
      }
  }
\cs_new:Npn \__tl_range_collect_space:nw #1 ~ { { #1 ~ } }
\cs_new:Npn \__tl_range_collect_N:nN #1#2 { { #1 #2 } }
\cs_new:Npn \__tl_range_collect_group:nn #1#2 { { #1 {#2} } }
\cs_generate_variant:Nn \__tl_range_collect:nn { ff }
\cs_new:Npn \__tl_range_normalize:nn #1#2
  {
    \int_eval:n
      {
        \if_int_compare:w #1 < 0 \exp_stop_f:
          \if_int_compare:w #1 < -#2 \exp_stop_f:
            0
          \else:
            #1 + #2 + 1
          \fi:
        \else:
          \if_int_compare:w #1 < #2 \exp_stop_f:
            #1
          \else:
            #2
          \fi:
        \fi:
      }
  }
\cs_new_protected:Npn \tl_show:N { \__tl_show:NN \tl_show:n }
\cs_generate_variant:Nn \tl_show:N { c }
\cs_new_protected:Npn \tl_log:N { \__tl_show:NN \tl_log:n }
\cs_generate_variant:Nn \tl_log:N { c }
\cs_new_protected:Npn \__tl_show:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      {
        \exp_args:Ne #1
          { \token_to_str:N #2 = \__kernel_exp_not:w \exp_after:wN {#2} }
      }
  }
\cs_new_protected:Npn \tl_show:n #1
  { \iow_wrap:nnnN { >~ \tl_to_str:n {#1} . } { } { } \__tl_show:n }
\cs_new_protected:Npn \__tl_show:n #1
  {
    \tl_set:Nf \l__tl_internal_a_tl { \__tl_show:w #1 \s__tl_stop }
    \__kernel_iow_with:Nnn \tex_newlinechar:D { 10 }
      {
        \__kernel_iow_with:Nnn \tex_errorcontextlines:D { -1 }
          {
            \tex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN
              { \exp_after:wN \l__tl_internal_a_tl }
          }
      }
  }
\cs_new:Npn \__tl_show:w #1 > #2 . \s__tl_stop {#2}
\cs_new_protected:Npn \tl_log:n #1
  { \iow_wrap:nnnN { > ~ \tl_to_str:n {#1} . } { } { } \iow_log:n }
\scan_new:N \s__tl_nil
\scan_new:N \s__tl_mark
\scan_new:N \s__tl_stop
\tl_new:N \g_tmpa_tl
\tl_new:N \g_tmpb_tl
\tl_new:N \l_tmpa_tl
\tl_new:N \l_tmpb_tl
\cs_undefine:N \__tl_tmp:w
%% File: l3str.dtx
\scan_new:N \s__str_mark
\scan_new:N \s__str_stop
\cs_new:Npn \__str_use_none_delimit_by_s_stop:w #1 \s__str_stop { }
\cs_new:Npn \__str_use_i_delimit_by_s_stop:nw #1 #2 \s__str_stop {#1}
\quark_new:N \q__str_recursion_tail
\quark_new:N \q__str_recursion_stop
\__kernel_quark_new_test:N \__str_if_recursion_tail_break:NN
\__kernel_quark_new_test:N \__str_if_recursion_tail_stop_do:Nn
\group_begin:
  \cs_set_protected:Npn \__str_tmp:n #1
    {
      \tl_if_blank:nF {#1}
        {
          \cs_new_eq:cc { str_ #1 :N } { tl_ #1 :N }
          \exp_args:Nc \cs_generate_variant:Nn { str_ #1 :N } { c }
          \__str_tmp:n
        }
    }
  \__str_tmp:n
    { new }
    { use }
    { clear }
    { gclear }
    { clear_new }
    { gclear_new }
    { }
\group_end:
\cs_new_eq:NN \str_set_eq:NN \tl_set_eq:NN
\cs_new_eq:NN \str_gset_eq:NN \tl_gset_eq:NN
\cs_generate_variant:Nn \str_set_eq:NN  { c , Nc , cc }
\cs_generate_variant:Nn \str_gset_eq:NN { c , Nc , cc }
\cs_new_eq:NN \str_concat:NNN \tl_concat:NNN
\cs_new_eq:NN \str_gconcat:NNN \tl_gconcat:NNN
\cs_generate_variant:Nn \str_concat:NNN  { ccc }
\cs_generate_variant:Nn \str_gconcat:NNN { ccc }
\group_begin:
  \cs_set_protected:Npn \__str_tmp:n #1
    {
      \tl_if_blank:nF {#1}
        {
          \cs_new_protected:cpx { str_ #1 :Nn } ##1##2
            {
              \exp_not:c { tl_ #1 :Nx } ##1
                { \exp_not:N \tl_to_str:n {##2} }
            }
          \cs_generate_variant:cn { str_ #1 :Nn } { NV , Nx , cn , cV , cx }
          \__str_tmp:n
        }
    }
  \__str_tmp:n
    { set }
    { gset }
    { const }
    { put_left }
    { gput_left }
    { put_right }
    { gput_right }
    { }
\group_end:
\cs_new_protected:Npn \str_replace_once:Nnn
  { \__str_replace:NNNnn \prg_do_nothing: \__kernel_tl_set:Nx  }
\cs_new_protected:Npn \str_greplace_once:Nnn
  { \__str_replace:NNNnn \prg_do_nothing: \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \str_replace_all:Nnn
  { \__str_replace:NNNnn \__str_replace_next:w \__kernel_tl_set:Nx  }
\cs_new_protected:Npn \str_greplace_all:Nnn
  { \__str_replace:NNNnn \__str_replace_next:w \__kernel_tl_gset:Nx }
\cs_generate_variant:Nn \str_replace_once:Nnn  { c }
\cs_generate_variant:Nn \str_greplace_once:Nnn { c }
\cs_generate_variant:Nn \str_replace_all:Nnn   { c }
\cs_generate_variant:Nn \str_greplace_all:Nnn  { c }
\cs_new_protected:Npn \__str_replace:NNNnn #1#2#3#4#5
  {
    \tl_if_empty:nTF {#4}
      {
        \__kernel_msg_error:nnx { kernel } { empty-search-pattern } {#5}
      }
      {
        \use:x
          {
            \exp_not:n { \__str_replace_aux:NNNnnn #1 #2 #3 }
              { \tl_to_str:N #3 }
              { \tl_to_str:n {#4} } { \tl_to_str:n {#5} }
          }
      }
  }
\cs_new_protected:Npn \__str_replace_aux:NNNnnn #1#2#3#4#5#6
  {
    \cs_set:Npn \__str_replace_next:w ##1 #5 { ##1 #6 #1 }
    #2 #3
      {
        \__str_replace_next:w
        #4
        \__str_use_none_delimit_by_s_stop:w
        #5
        \s__str_stop
      }
  }
\cs_new_eq:NN \__str_replace_next:w ?
\cs_new_protected:Npn \str_remove_once:Nn #1#2
  { \str_replace_once:Nnn #1 {#2} { } }
\cs_new_protected:Npn \str_gremove_once:Nn #1#2
  { \str_greplace_once:Nnn #1 {#2} { } }
\cs_generate_variant:Nn \str_remove_once:Nn  { c }
\cs_generate_variant:Nn \str_gremove_once:Nn { c }
\cs_new_protected:Npn \str_remove_all:Nn #1#2
  { \str_replace_all:Nnn #1 {#2} { } }
\cs_new_protected:Npn \str_gremove_all:Nn #1#2
  { \str_greplace_all:Nnn #1 {#2} { } }
\cs_generate_variant:Nn \str_remove_all:Nn  { c }
\cs_generate_variant:Nn \str_gremove_all:Nn { c }
\prg_new_eq_conditional:NNn \str_if_exist:N \tl_if_exist:N
  { p , T , F , TF }
\prg_new_eq_conditional:NNn \str_if_exist:c \tl_if_exist:c
  { p , T , F , TF }
\prg_new_eq_conditional:NNn \str_if_empty:N \tl_if_empty:N
  { p , T , F , TF }
\prg_new_eq_conditional:NNn \str_if_empty:c \tl_if_empty:c
  { p , T , F , TF }
\cs_new_eq:NN \__str_if_eq:nn \tex_strcmp:D
\prg_new_conditional:Npnn \str_if_eq:nn #1#2 { p , T , F , TF }
  {
    \if_int_compare:w
      \__str_if_eq:nn { \exp_not:n {#1} } { \exp_not:n {#2} }
      = 0 \exp_stop_f:
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_generate_conditional_variant:Nnn \str_if_eq:nn
  { V , v , o , nV , no , VV , nv } { p , T , F , TF }
\prg_new_conditional:Npnn \str_if_eq:ee #1#2 { p , T , F , TF }
  {
    \if_int_compare:w \__str_if_eq:nn {#1} {#2} = 0 \exp_stop_f:
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \str_if_eq:NN #1#2 { p , TF , T , F }
  {
    \if_int_compare:w
      \__str_if_eq:nn { \tl_to_str:N #1 } { \tl_to_str:N #2 }
      = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_generate_conditional_variant:Nnn \str_if_eq:NN
  { c , Nc , cc } { T , F , TF , p }
\prg_new_protected_conditional:Npnn \str_if_in:Nn #1#2 { T , F , TF }
  {
    \use:x
      { \tl_if_in:nnTF { \tl_to_str:N #1 } { \tl_to_str:n {#2} } }
      { \prg_return_true: } { \prg_return_false: }
  }
\prg_generate_conditional_variant:Nnn \str_if_in:Nn
  { c } { T , F , TF }
\prg_new_protected_conditional:Npnn \str_if_in:nn #1#2 { T , F , TF }
  {
    \use:x
      { \tl_if_in:nnTF { \tl_to_str:n {#1} } { \tl_to_str:n {#2} } }
      { \prg_return_true: } { \prg_return_false: }
  }
\cs_new:Npn \str_case:nn #1#2
  {
    \exp:w
    \__str_case:nnTF {#1} {#2} { } { }
  }
\cs_new:Npn \str_case:nnT #1#2#3
  {
    \exp:w
    \__str_case:nnTF {#1} {#2} {#3} { }
  }
\cs_new:Npn \str_case:nnF #1#2
  {
    \exp:w
    \__str_case:nnTF {#1} {#2} { }
  }
\cs_new:Npn \str_case:nnTF #1#2
  {
    \exp:w
    \__str_case:nnTF {#1} {#2}
  }
\cs_new:Npn \__str_case:nnTF #1#2#3#4
  { \__str_case:nw {#1} #2 {#1} { } \s__str_mark {#3} \s__str_mark {#4} \s__str_stop }
\cs_generate_variant:Nn \str_case:nn   { V , o , nV , nv }
\prg_generate_conditional_variant:Nnn \str_case:nn
  { V , o , nV , nv } { T , F , TF }
\cs_new:Npn \__str_case:nw #1#2#3
  {
    \str_if_eq:nnTF {#1} {#2}
      { \__str_case_end:nw {#3} }
      { \__str_case:nw {#1} }
  }
\cs_new:Npn \str_case_e:nn #1#2
  {
    \exp:w
    \__str_case_e:nnTF {#1} {#2} { } { }
  }
\cs_new:Npn \str_case_e:nnT #1#2#3
  {
    \exp:w
    \__str_case_e:nnTF {#1} {#2} {#3} { }
  }
\cs_new:Npn \str_case_e:nnF #1#2
  {
    \exp:w
    \__str_case_e:nnTF {#1} {#2} { }
  }
\cs_new:Npn \str_case_e:nnTF #1#2
  {
    \exp:w
    \__str_case_e:nnTF {#1} {#2}
  }
\cs_new:Npn \__str_case_e:nnTF #1#2#3#4
  { \__str_case_e:nw {#1} #2 {#1} { } \s__str_mark {#3} \s__str_mark {#4} \s__str_stop }
\cs_new:Npn \__str_case_e:nw #1#2#3
  {
    \str_if_eq:eeTF {#1} {#2}
      { \__str_case_end:nw {#3} }
      { \__str_case_e:nw {#1} }
  }
\cs_new:Npn \__str_case_end:nw #1#2#3 \s__str_mark #4#5 \s__str_stop
  { \exp_end: #1 #4 }
\cs_new:Npn \str_map_function:nN #1#2
  {
    \exp_after:wN \__str_map_function:w
    \exp_after:wN \__str_map_function:Nn \exp_after:wN #2
      \__kernel_tl_to_str:w {#1}
      \q__str_recursion_tail ? ~
    \prg_break_point:Nn \str_map_break: { }
  }
\cs_new:Npn \str_map_function:NN
  { \exp_args:No \str_map_function:nN }
\cs_new:Npn \__str_map_function:w #1 ~
  { #1 { ~ { ~ } \__str_map_function:w } }
\cs_new:Npn \__str_map_function:Nn #1#2
  {
    \if_meaning:w \q__str_recursion_tail #2
      \exp_after:wN \str_map_break:
    \fi:
    #1 #2 \__str_map_function:Nn #1
  }
\cs_generate_variant:Nn \str_map_function:NN { c }
\cs_new_protected:Npn \str_map_inline:nn #1#2
  {
    \int_gincr:N \g__kernel_prg_map_int
    \cs_gset_protected:cpn
      { __str_map_ \int_use:N \g__kernel_prg_map_int :w } ##1 {#2}
    \use:x
      {
        \exp_not:N \__str_map_inline:NN
        \exp_not:c { __str_map_ \int_use:N \g__kernel_prg_map_int :w }
        \__kernel_str_to_other_fast:n {#1}
      }
      \q__str_recursion_tail
    \prg_break_point:Nn \str_map_break:
      { \int_gdecr:N \g__kernel_prg_map_int }
  }
\cs_new_protected:Npn \str_map_inline:Nn
  { \exp_args:No \str_map_inline:nn }
\cs_generate_variant:Nn \str_map_inline:Nn { c }
\cs_new:Npn \__str_map_inline:NN #1#2
  {
    \__str_if_recursion_tail_break:NN #2 \str_map_break:
    \exp_args:No #1 { \token_to_str:N #2 }
    \__str_map_inline:NN #1
  }
\cs_new_protected:Npn \str_map_variable:nNn #1#2#3
  {
    \use:x
      {
        \exp_not:n { \__str_map_variable:NnN #2 {#3} }
        \__kernel_str_to_other_fast:n {#1}
      }
      \q__str_recursion_tail
    \prg_break_point:Nn \str_map_break: { }
  }
\cs_new_protected:Npn \str_map_variable:NNn
  { \exp_args:No \str_map_variable:nNn }
\cs_new_protected:Npn \__str_map_variable:NnN #1#2#3
  {
    \__str_if_recursion_tail_break:NN #3 \str_map_break:
    \str_set:Nn #1 {#3}
    \use:n {#2}
    \__str_map_variable:NnN #1 {#2}
  }
\cs_generate_variant:Nn \str_map_variable:NNn { c }
\cs_new:Npn \str_map_break:
  { \prg_map_break:Nn \str_map_break: { } }
\cs_new:Npn \str_map_break:n
  { \prg_map_break:Nn \str_map_break: }
\cs_new:Npn \__kernel_str_to_other:n #1
  {
    \exp_after:wN \__str_to_other_loop:w
      \tl_to_str:n {#1} ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \s__str_mark \s__str_stop
  }
\group_begin:
\tex_lccode:D `\* = `\  %
\tex_lccode:D `\A = `\A %
\tex_lowercase:D
  {
    \group_end:
    \cs_new:Npn \__str_to_other_loop:w
      #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 \s__str_stop
      {
        \if_meaning:w A #8
          \__str_to_other_end:w
        \fi:
        \__str_to_other_loop:w
        #9 #1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * \s__str_stop
      }
    \cs_new:Npn \__str_to_other_end:w \fi: #1 \s__str_mark #2 * A #3 \s__str_stop
      { \fi: #2 }
  }
\cs_new:Npn \__kernel_str_to_other_fast:n #1
  {
    \exp_after:wN \__str_to_other_fast_loop:w \tl_to_str:n {#1} ~
      A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \s__str_stop
  }
\group_begin:
\tex_lccode:D `\* = `\  %
\tex_lccode:D `\A = `\A %
\tex_lowercase:D
  {
    \group_end:
    \cs_new:Npn \__str_to_other_fast_loop:w
      #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 ~
      {
        \if_meaning:w A #9
          \__str_to_other_fast_end:w
        \fi:
        #1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * #9
        \__str_to_other_fast_loop:w *
      }
    \cs_new:Npn \__str_to_other_fast_end:w #1 * A #2 \s__str_stop {#1}
  }
\cs_new:Npn \str_item:Nn { \exp_args:No \str_item:nn }
\cs_generate_variant:Nn \str_item:Nn { c }
\cs_new:Npn \str_item:nn #1#2
  {
    \exp_args:Nf \tl_to_str:n
      {
        \exp_args:Nf \__str_item:nn
          { \__kernel_str_to_other:n {#1} } {#2}
      }
  }
\cs_new:Npn \str_item_ignore_spaces:nn #1
  { \exp_args:No \__str_item:nn { \tl_to_str:n {#1} } }
\cs_new:Npn \__str_item:nn #1#2
  {
    \exp_after:wN \__str_item:w
    \int_value:w \int_eval:n {#2} \exp_after:wN ;
    \int_value:w \__str_count:n {#1} ;
    #1 \s__str_stop
  }
\cs_new:Npn \__str_item:w #1; #2;
  {
    \int_compare:nNnTF {#1} < 0
      {
        \int_compare:nNnTF {#1} < {-#2}
          { \__str_use_none_delimit_by_s_stop:w }
          {
            \exp_after:wN \__str_use_i_delimit_by_s_stop:nw
            \exp:w \exp_after:wN \__str_skip_exp_end:w
              \int_value:w \int_eval:n { #1 + #2 } ;
          }
      }
      {
        \int_compare:nNnTF {#1} > {#2}
          { \__str_use_none_delimit_by_s_stop:w }
          {
            \exp_after:wN \__str_use_i_delimit_by_s_stop:nw
            \exp:w \__str_skip_exp_end:w #1 ; { }
          }
      }
  }
\cs_new:Npn \__str_skip_exp_end:w #1;
  {
    \if_int_compare:w #1 > 8 \exp_stop_f:
      \exp_after:wN \__str_skip_loop:wNNNNNNNN
    \else:
      \exp_after:wN \__str_skip_end:w
      \int_value:w \int_eval:w
    \fi:
    #1 ;
  }
\cs_new:Npn \__str_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9
  {
    \exp_after:wN \__str_skip_exp_end:w
      \int_value:w \int_eval:n { #1 - 8 } ;
  }
\cs_new:Npn \__str_skip_end:w #1 ;
  {
    \exp_after:wN \__str_skip_end:NNNNNNNN
    \if_case:w #1 \exp_stop_f: \or: \or: \or: \or: \or: \or: \or: \or:
  }
\cs_new:Npn \__str_skip_end:NNNNNNNN #1#2#3#4#5#6#7#8 { \fi: \exp_end: }
\cs_new:Npn \str_range:Nnn { \exp_args:No \str_range:nnn }
\cs_generate_variant:Nn \str_range:Nnn { c }
\cs_new:Npn \str_range:nnn #1#2#3
  {
    \exp_args:Nf \tl_to_str:n
      {
        \exp_args:Nf \__str_range:nnn
          { \__kernel_str_to_other:n {#1} } {#2} {#3}
      }
  }
\cs_new:Npn \str_range_ignore_spaces:nnn #1
  { \exp_args:No \__str_range:nnn { \tl_to_str:n {#1} } }
\cs_new:Npn \__str_range:nnn #1#2#3
  {
    \exp_after:wN \__str_range:w
    \int_value:w \__str_count:n {#1} \exp_after:wN ;
    \int_value:w \int_eval:n { (#2) - 1 } \exp_after:wN ;
    \int_value:w \int_eval:n {#3} ;
    #1 \s__str_stop
  }
\cs_new:Npn \__str_range:w #1; #2; #3;
  {
    \exp_args:Nf \__str_range:nnw
      { \__str_range_normalize:nn {#2} {#1} }
      { \__str_range_normalize:nn {#3} {#1} }
  }
\cs_new:Npn \__str_range:nnw #1#2
  {
    \exp_after:wN \__str_collect_delimit_by_q_stop:w
    \int_value:w \int_eval:n { #2 - #1 } \exp_after:wN ;
    \exp:w \__str_skip_exp_end:w #1 ;
  }
\cs_new:Npn \__str_range_normalize:nn #1#2
  {
    \int_eval:n
      {
        \if_int_compare:w #1 < 0 \exp_stop_f:
          \if_int_compare:w #1 < -#2 \exp_stop_f:
            0
          \else:
            #1 + #2 + 1
          \fi:
        \else:
          \if_int_compare:w #1 < #2 \exp_stop_f:
            #1
          \else:
            #2
          \fi:
        \fi:
      }
  }
\cs_new:Npn \__str_collect_delimit_by_q_stop:w #1;
  { \__str_collect_loop:wn #1 ; { } }
\cs_new:Npn \__str_collect_loop:wn #1 ;
  {
    \if_int_compare:w #1 > 7 \exp_stop_f:
      \exp_after:wN \__str_collect_loop:wnNNNNNNN
    \else:
      \exp_after:wN \__str_collect_end:wn
    \fi:
    #1 ;
  }
\cs_new:Npn \__str_collect_loop:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9
  {
    \exp_after:wN \__str_collect_loop:wn
    \int_value:w \int_eval:n { #1 - 7 } ;
    { #2 #3#4#5#6#7#8#9 }
  }
\cs_new:Npn \__str_collect_end:wn #1 ;
  {
    \exp_after:wN \__str_collect_end:nnnnnnnnw
    \if_case:w \if_int_compare:w #1 > 0 \exp_stop_f:
      #1 \else: 0 \fi: \exp_stop_f:
      \or: \or: \or: \or: \or: \or: \fi:
  }
\cs_new:Npn \__str_collect_end:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \s__str_stop
  { #1#2#3#4#5#6#7#8 }
\cs_new:Npn \str_count_spaces:N
  { \exp_args:No \str_count_spaces:n }
\cs_generate_variant:Nn \str_count_spaces:N { c }
\cs_new:Npn \str_count_spaces:n #1
  {
    \int_eval:n
      {
        \exp_after:wN \__str_count_spaces_loop:w
        \tl_to_str:n {#1} ~
        X 7 ~ X 6 ~ X 5 ~ X 4 ~ X 3 ~ X 2 ~ X 1 ~ X 0 ~ X -1 ~
        \s__str_stop
      }
  }
\cs_new:Npn \__str_count_spaces_loop:w #1~#2~#3~#4~#5~#6~#7~#8~#9~
  {
    \if_meaning:w X #9
      \__str_use_i_delimit_by_s_stop:nw
    \fi:
    9 + \__str_count_spaces_loop:w
  }
\cs_new:Npn \str_count:N { \exp_args:No \str_count:n }
\cs_generate_variant:Nn \str_count:N { c }
\cs_new:Npn \str_count:n #1
  {
    \__str_count_aux:n
      {
        \str_count_spaces:n {#1}
        + \exp_after:wN \__str_count_loop:NNNNNNNNN \tl_to_str:n {#1}
      }
  }
\cs_new:Npn \__str_count:n #1
  {
    \__str_count_aux:n
      { \__str_count_loop:NNNNNNNNN #1 }
  }
\cs_new:Npn \str_count_ignore_spaces:n #1
  {
    \__str_count_aux:n
      { \exp_after:wN \__str_count_loop:NNNNNNNNN \tl_to_str:n {#1} }
  }
\cs_new:Npn \__str_count_aux:n #1
  {
    \int_eval:n
      {
        #1
        { X 8 } { X 7 } { X 6 }
        { X 5 } { X 4 } { X 3 }
        { X 2 } { X 1 } { X 0 }
        \s__str_stop
      }
  }
\cs_new:Npn \__str_count_loop:NNNNNNNNN #1#2#3#4#5#6#7#8#9
  {
    \if_meaning:w X #9
      \exp_after:wN \__str_use_none_delimit_by_s_stop:w
    \fi:
    9 + \__str_count_loop:NNNNNNNNN
  }
\cs_new:Npn \str_head:N { \exp_args:No \str_head:n }
\cs_generate_variant:Nn \str_head:N { c }
\cs_new:Npn \str_head:n #1
  {
    \exp_after:wN \__str_head:w
    \tl_to_str:n {#1}
    { { } } ~ \s__str_stop
  }
\cs_new:Npn \__str_head:w #1 ~ %
  { \__str_use_i_delimit_by_s_stop:nw #1 { ~ } }
\cs_new:Npn \str_head_ignore_spaces:n #1
  {
    \exp_after:wN \__str_use_i_delimit_by_s_stop:nw
    \tl_to_str:n {#1} { } \s__str_stop
  }
\cs_new:Npn \str_tail:N { \exp_args:No \str_tail:n }
\cs_generate_variant:Nn \str_tail:N { c }
\cs_new:Npn \str_tail:n #1
  {
    \exp_after:wN \__str_tail_auxi:w
    \reverse_if:N \if_charcode:w
        \scan_stop: \tl_to_str:n {#1} X X \s__str_stop
  }
\cs_new:Npn \__str_tail_auxi:w #1 X #2 \s__str_stop { \fi: #1 }
\cs_new:Npn \str_tail_ignore_spaces:n #1
  {
    \exp_after:wN \__str_tail_auxii:w
    \tl_to_str:n {#1} \s__str_mark \s__str_mark \s__str_stop
  }
\cs_new:Npn \__str_tail_auxii:w #1 #2 \s__str_mark #3 \s__str_stop { #2 }
\cs_new:Npn \str_foldcase:n  #1 { \__str_change_case:nn {#1} { fold } }
\cs_new:Npn \str_lowercase:n #1 { \__str_change_case:nn {#1} { lower } }
\cs_new:Npn \str_uppercase:n #1 { \__str_change_case:nn {#1} { upper } }
\cs_generate_variant:Nn \str_foldcase:n  { V }
\cs_generate_variant:Nn \str_lowercase:n { f }
\cs_generate_variant:Nn \str_uppercase:n { f }
\cs_new:Npn \__str_change_case:nn #1
  {
    \exp_after:wN \__str_change_case_aux:nn \exp_after:wN
      { \tl_to_str:n {#1} }
  }
\cs_new:Npn \__str_change_case_aux:nn #1#2
  {
    \__str_change_case_loop:nw {#2} #1 \q__str_recursion_tail \q__str_recursion_stop
      \__str_change_case_result:n { }
  }
\cs_new:Npn \__str_change_case_output:nw #1#2 \__str_change_case_result:n #3
  { #2 \__str_change_case_result:n { #3 #1 } }
\cs_generate_variant:Nn  \__str_change_case_output:nw { f }
\cs_new:Npn \__str_change_case_end:wn #1 \__str_change_case_result:n #2
  { \tl_to_str:n {#2} }
\cs_new:Npn \__str_change_case_loop:nw #1#2 \q__str_recursion_stop
  {
    \tl_if_head_is_space:nTF {#2}
      { \__str_change_case_space:n }
      { \__str_change_case_char:nN }
    {#1} #2 \q__str_recursion_stop
  }
\exp_last_unbraced:NNNNo
  \cs_new:Npn \__str_change_case_space:n #1 \c_space_tl
  {
    \__str_change_case_output:nw { ~ }
    \__str_change_case_loop:nw {#1}
  }
\cs_new:Npn \__str_change_case_char:nN #1#2
  {
    \__str_if_recursion_tail_stop_do:Nn #2
      { \__str_change_case_end:wn }
    \__str_change_case_output:fw
      { \use:c { char_str_ #1 case:N } #2 }
    \__str_change_case_loop:nw {#1}
  }
\str_const:Nx \c_ampersand_str   { \cs_to_str:N \& }
\str_const:Nx \c_atsign_str      { \cs_to_str:N \@ }
\str_const:Nx \c_backslash_str   { \cs_to_str:N \\ }
\str_const:Nx \c_left_brace_str  { \cs_to_str:N \{ }
\str_const:Nx \c_right_brace_str { \cs_to_str:N \} }
\str_const:Nx \c_circumflex_str  { \cs_to_str:N \^ }
\str_const:Nx \c_colon_str       { \cs_to_str:N \: }
\str_const:Nx \c_dollar_str      { \cs_to_str:N \$ }
\str_const:Nx \c_hash_str        { \cs_to_str:N \# }
\str_const:Nx \c_percent_str     { \cs_to_str:N \% }
\str_const:Nx \c_tilde_str       { \cs_to_str:N \~ }
\str_const:Nx \c_underscore_str  { \cs_to_str:N \_ }
\str_const:Nx \c_zero_str        { 0 }
\str_new:N \l_tmpa_str
\str_new:N \l_tmpb_str
\str_new:N \g_tmpa_str
\str_new:N \g_tmpb_str
\cs_new_eq:NN \str_show:n \tl_show:n
\cs_new_eq:NN \str_show:N \tl_show:N
\cs_generate_variant:Nn \str_show:N { c }
\cs_new_eq:NN \str_log:n \tl_log:n
\cs_new_eq:NN \str_log:N \tl_log:N
\cs_generate_variant:Nn \str_log:N { c }
%% File: l3seq.dtx
\scan_new:N \s__seq
\scan_new:N \s__seq_mark
\scan_new:N \s__seq_stop
\cs_new:Npn \__seq_item:n
  {
    \__kernel_msg_expandable_error:nn { kernel } { misused-sequence }
    \use_none:n
  }
\tl_new:N \l__seq_internal_a_tl
\tl_new:N \l__seq_internal_b_tl
\cs_new_eq:NN \__seq_tmp:w ?
\tl_const:Nn \c_empty_seq { \s__seq }
\cs_new_protected:Npn \seq_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs_gset_eq:NN #1 \c_empty_seq
  }
\cs_generate_variant:Nn \seq_new:N { c }
\cs_new_protected:Npn \seq_clear:N  #1
  { \seq_set_eq:NN #1 \c_empty_seq }
\cs_generate_variant:Nn \seq_clear:N  { c }
\cs_new_protected:Npn \seq_gclear:N #1
  { \seq_gset_eq:NN #1 \c_empty_seq }
\cs_generate_variant:Nn \seq_gclear:N { c }
\cs_new_protected:Npn \seq_clear_new:N  #1
  { \seq_if_exist:NTF #1 { \seq_clear:N #1 } { \seq_new:N #1 } }
\cs_generate_variant:Nn \seq_clear_new:N  { c }
\cs_new_protected:Npn \seq_gclear_new:N #1
  { \seq_if_exist:NTF #1 { \seq_gclear:N #1 } { \seq_new:N #1 } }
\cs_generate_variant:Nn \seq_gclear_new:N { c }
\cs_new_eq:NN \seq_set_eq:NN  \tl_set_eq:NN
\cs_new_eq:NN \seq_set_eq:Nc  \tl_set_eq:Nc
\cs_new_eq:NN \seq_set_eq:cN  \tl_set_eq:cN
\cs_new_eq:NN \seq_set_eq:cc  \tl_set_eq:cc
\cs_new_eq:NN \seq_gset_eq:NN \tl_gset_eq:NN
\cs_new_eq:NN \seq_gset_eq:Nc \tl_gset_eq:Nc
\cs_new_eq:NN \seq_gset_eq:cN \tl_gset_eq:cN
\cs_new_eq:NN \seq_gset_eq:cc \tl_gset_eq:cc
\cs_new_protected:Npn \seq_set_from_clist:NN #1#2
  {
    \__kernel_tl_set:Nx #1
      { \s__seq \clist_map_function:NN #2 \__seq_wrap_item:n }
  }
\cs_new_protected:Npn \seq_set_from_clist:Nn #1#2
  {
    \__kernel_tl_set:Nx #1
      { \s__seq \clist_map_function:nN {#2} \__seq_wrap_item:n }
  }
\cs_new_protected:Npn \seq_gset_from_clist:NN #1#2
  {
    \__kernel_tl_gset:Nx #1
      { \s__seq \clist_map_function:NN #2 \__seq_wrap_item:n }
  }
\cs_new_protected:Npn \seq_gset_from_clist:Nn #1#2
  {
    \__kernel_tl_gset:Nx #1
      { \s__seq \clist_map_function:nN {#2} \__seq_wrap_item:n }
  }
\cs_generate_variant:Nn \seq_set_from_clist:NN  {     Nc }
\cs_generate_variant:Nn \seq_set_from_clist:NN  { c , cc }
\cs_generate_variant:Nn \seq_set_from_clist:Nn  { c      }
\cs_generate_variant:Nn \seq_gset_from_clist:NN {     Nc }
\cs_generate_variant:Nn \seq_gset_from_clist:NN { c , cc }
\cs_generate_variant:Nn \seq_gset_from_clist:Nn { c      }
\cs_new_protected:Npn \seq_const_from_clist:Nn #1#2
  {
    \tl_const:Nx #1
      { \s__seq \clist_map_function:nN {#2} \__seq_wrap_item:n }
  }
\cs_generate_variant:Nn \seq_const_from_clist:Nn { c }
\cs_new_protected:Npn \seq_set_split:Nnn
  { \__seq_set_split:NNnn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_gset_split:Nnn
  { \__seq_set_split:NNnn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_set_split:NNnn #1#2#3#4
  {
    \tl_if_empty:nTF {#3}
      {
        \tl_set:Nn \l__seq_internal_a_tl
          { \tl_map_function:nN {#4} \__seq_wrap_item:n }
      }
      {
        \tl_set:Nn \l__seq_internal_a_tl
          {
            \__seq_set_split_auxi:w \prg_do_nothing:
            #4
            \__seq_set_split_end:
          }
        \tl_replace_all:Nnn \l__seq_internal_a_tl { #3 }
          {
            \__seq_set_split_end:
            \__seq_set_split_auxi:w \prg_do_nothing:
          }
        \__kernel_tl_set:Nx \l__seq_internal_a_tl { \l__seq_internal_a_tl }
      }
    #1 #2 { \s__seq \l__seq_internal_a_tl }
  }
\cs_new:Npn \__seq_set_split_auxi:w #1 \__seq_set_split_end:
  {
    \exp_not:N \__seq_set_split_auxii:w
    \exp_args:No \tl_trim_spaces:n {#1}
    \exp_not:N \__seq_set_split_end:
  }
\cs_new:Npn \__seq_set_split_auxii:w #1 \__seq_set_split_end:
  { \__seq_wrap_item:n {#1} }
\cs_generate_variant:Nn \seq_set_split:Nnn  { NnV }
\cs_generate_variant:Nn \seq_gset_split:Nnn { NnV }
\cs_new_protected:Npn \seq_concat:NNN #1#2#3
  { \tl_set:Nf #1 { \exp_after:wN \use_i:nn \exp_after:wN #2 #3 } }
\cs_new_protected:Npn \seq_gconcat:NNN #1#2#3
  { \tl_gset:Nf #1 { \exp_after:wN \use_i:nn \exp_after:wN #2 #3 } }
\cs_generate_variant:Nn \seq_concat:NNN  { ccc }
\cs_generate_variant:Nn \seq_gconcat:NNN { ccc }
\prg_new_eq_conditional:NNn \seq_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \seq_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\cs_new_protected:Npn \seq_put_left:Nn #1#2
  {
    \__kernel_tl_set:Nx #1
      {
        \exp_not:n { \s__seq \__seq_item:n {#2} }
        \exp_not:f { \exp_after:wN \__seq_put_left_aux:w #1 }
      }
  }
\cs_new_protected:Npn \seq_gput_left:Nn #1#2
  {
    \__kernel_tl_gset:Nx #1
      {
        \exp_not:n { \s__seq \__seq_item:n {#2} }
        \exp_not:f { \exp_after:wN \__seq_put_left_aux:w #1 }
      }
  }
\cs_new:Npn \__seq_put_left_aux:w \s__seq { \exp_stop_f: }
\cs_generate_variant:Nn \seq_put_left:Nn  {     NV , Nv , No , Nx }
\cs_generate_variant:Nn \seq_put_left:Nn  { c , cV , cv , co , cx }
\cs_generate_variant:Nn \seq_gput_left:Nn  {     NV , Nv , No , Nx }
\cs_generate_variant:Nn \seq_gput_left:Nn  { c , cV , cv , co , cx }
\cs_new_protected:Npn \seq_put_right:Nn #1#2
  { \tl_put_right:Nn #1 { \__seq_item:n {#2} } }
\cs_new_protected:Npn \seq_gput_right:Nn #1#2
  { \tl_gput_right:Nn #1 { \__seq_item:n {#2} } }
\cs_generate_variant:Nn \seq_gput_right:Nn {     NV , Nv , No , Nx }
\cs_generate_variant:Nn \seq_gput_right:Nn { c , cV , cv , co , cx }
\cs_generate_variant:Nn \seq_put_right:Nn {     NV , Nv , No , Nx }
\cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx }
\cs_new:Npn \__seq_wrap_item:n #1 { \exp_not:n { \__seq_item:n {#1} } }
\seq_new:N \l__seq_remove_seq
\cs_new_protected:Npn \seq_remove_duplicates:N
  { \__seq_remove_duplicates:NN \seq_set_eq:NN }
\cs_new_protected:Npn \seq_gremove_duplicates:N
  { \__seq_remove_duplicates:NN \seq_gset_eq:NN }
\cs_new_protected:Npn \__seq_remove_duplicates:NN #1#2
  {
    \seq_clear:N \l__seq_remove_seq
    \seq_map_inline:Nn #2
      {
        \seq_if_in:NnF \l__seq_remove_seq {##1}
          { \seq_put_right:Nn \l__seq_remove_seq {##1} }
      }
    #1 #2 \l__seq_remove_seq
  }
\cs_generate_variant:Nn \seq_remove_duplicates:N  { c }
\cs_generate_variant:Nn \seq_gremove_duplicates:N { c }
\cs_new_protected:Npn \seq_remove_all:Nn
  { \__seq_remove_all_aux:NNn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_gremove_all:Nn
  { \__seq_remove_all_aux:NNn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_remove_all_aux:NNn #1#2#3
  {
    \__seq_push_item_def:n
      {
        \str_if_eq:nnT {##1} {#3}
          {
            \if_false: { \fi: }
            \tl_set:Nn \l__seq_internal_b_tl {##1}
            #1 #2
               { \if_false: } \fi:
                 \exp_not:o {#2}
                 \tl_if_eq:NNT \l__seq_internal_a_tl \l__seq_internal_b_tl
                   { \use_none:nn }
          }
        \__seq_wrap_item:n {##1}
      }
    \tl_set:Nn \l__seq_internal_a_tl {#3}
    #1 #2 {#2}
    \__seq_pop_item_def:
  }
\cs_generate_variant:Nn \seq_remove_all:Nn  { c }
\cs_generate_variant:Nn \seq_gremove_all:Nn { c }
\cs_new_protected:Npn \seq_reverse:N
  { \__seq_reverse:NN \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_greverse:N
  { \__seq_reverse:NN \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_reverse:NN #1 #2
  {
    \cs_set_eq:NN \__seq_tmp:w \__seq_item:n
    \cs_set_eq:NN \__seq_item:n \__seq_reverse_item:nwn
    #1 #2 { #2 \exp_not:n { } }
    \cs_set_eq:NN \__seq_item:n \__seq_tmp:w
  }
\cs_new:Npn \__seq_reverse_item:nwn #1 #2 \exp_not:n #3
  {
    #2
    \exp_not:n { \__seq_item:n {#1} #3 }
  }
\cs_generate_variant:Nn \seq_reverse:N  { c }
\cs_generate_variant:Nn \seq_greverse:N { c }
\prg_new_conditional:Npnn \seq_if_empty:N #1 { p , T , F , TF }
  {
    \if_meaning:w #1 \c_empty_seq
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \seq_if_empty:N
  { c } { p , T , F , TF }
\cs_if_exist:NTF \tex_uniformdeviate:D
  {
    \seq_new:N \g__seq_internal_seq
    \cs_new_protected:Npn \seq_shuffle:N { \__seq_shuffle:NN \seq_set_eq:NN }
    \cs_new_protected:Npn \seq_gshuffle:N { \__seq_shuffle:NN \seq_gset_eq:NN }
    \cs_new_protected:Npn \__seq_shuffle:NN #1#2
      {
        \int_compare:nNnTF { \seq_count:N #2 } > \c_max_register_int
          {
            \__kernel_msg_error:nnx { kernel } { shuffle-too-large }
              { \token_to_str:N #2 }
          }
          {
            \group_begin:
              \int_zero:N \l__seq_internal_a_int
              \__seq_push_item_def:
              \cs_gset_eq:NN \__seq_item:n \__seq_shuffle_item:n
              #2
              \__seq_pop_item_def:
              \seq_gset_from_inline_x:Nnn \g__seq_internal_seq
                { \int_step_function:nN { \l__seq_internal_a_int } }
                { \tex_the:D \tex_toks:D ##1 }
            \group_end:
            #1 #2 \g__seq_internal_seq
            \seq_gclear:N \g__seq_internal_seq
          }
      }
    \cs_new_protected:Npn \__seq_shuffle_item:n
      {
        \int_incr:N \l__seq_internal_a_int
        \int_set:Nn \l__seq_internal_b_int
          { 1 + \tex_uniformdeviate:D \l__seq_internal_a_int }
        \tex_toks:D \l__seq_internal_a_int
          = \tex_toks:D \l__seq_internal_b_int
        \tex_toks:D \l__seq_internal_b_int
      }
  }
  {
    \cs_new_protected:Npn \seq_shuffle:N #1
      {
        \__kernel_msg_error:nnn { kernel } { fp-no-random }
          { \seq_shuffle:N #1 }
      }
    \cs_new_eq:NN \seq_gshuffle:N \seq_shuffle:N
  }
\cs_generate_variant:Nn \seq_shuffle:N { c }
\cs_generate_variant:Nn \seq_gshuffle:N { c }
\prg_new_protected_conditional:Npnn \seq_if_in:Nn #1#2
  { T , F , TF }
  {
    \group_begin:
      \tl_set:Nn \l__seq_internal_a_tl {#2}
      \cs_set_protected:Npn \__seq_item:n ##1
        {
          \tl_set:Nn \l__seq_internal_b_tl {##1}
          \if_meaning:w \l__seq_internal_a_tl \l__seq_internal_b_tl
            \exp_after:wN \__seq_if_in:
          \fi:
        }
      #1
    \group_end:
    \prg_return_false:
    \prg_break_point:
  }
\cs_new:Npn \__seq_if_in:
  { \prg_break:n { \group_end: \prg_return_true: } }
\prg_generate_conditional_variant:Nnn \seq_if_in:Nn
  { NV , Nv , No , Nx , c , cV , cv , co , cx } { T , F , TF }
\cs_new_protected:Npn \__seq_pop:NNNN #1#2#3#4
  {
    \if_meaning:w #3 \c_empty_seq
      \tl_set:Nn #4 { \q_no_value }
    \else:
      #1#2#3#4
    \fi:
  }
\cs_new_protected:Npn \__seq_pop_TF:NNNN #1#2#3#4
  {
    \if_meaning:w #3 \c_empty_seq
      % \tl_set:Nn #4 { \q_no_value }
      \prg_return_false:
    \else:
      #1#2#3#4
      \prg_return_true:
    \fi:
  }
\cs_new_protected:Npn \seq_get_left:NN #1#2
  {
    \__kernel_tl_set:Nx #2
      {
        \exp_after:wN \__seq_get_left:wnw
        #1 \__seq_item:n { \q_no_value } \s__seq_stop
      }
  }
\cs_new:Npn \__seq_get_left:wnw #1 \__seq_item:n #2#3 \s__seq_stop
  { \exp_not:n {#2} }
\cs_generate_variant:Nn \seq_get_left:NN { c }
\cs_new_protected:Npn \seq_pop_left:NN
  { \__seq_pop:NNNN \__seq_pop_left:NNN \tl_set:Nn }
\cs_new_protected:Npn \seq_gpop_left:NN
  { \__seq_pop:NNNN \__seq_pop_left:NNN \tl_gset:Nn }
\cs_new_protected:Npn \__seq_pop_left:NNN #1#2#3
  { \exp_after:wN \__seq_pop_left:wnwNNN #2 \s__seq_stop #1#2#3 }
\cs_new_protected:Npn \__seq_pop_left:wnwNNN
    #1 \__seq_item:n #2#3 \s__seq_stop #4#5#6
  {
    #4 #5 { #1 #3 }
    \tl_set:Nn #6 {#2}
  }
\cs_generate_variant:Nn \seq_pop_left:NN  { c }
\cs_generate_variant:Nn \seq_gpop_left:NN { c }
\cs_new_protected:Npn \seq_get_right:NN #1#2
  {
    \__kernel_tl_set:Nx #2
      {
        \exp_after:wN \use_i_ii:nnn
        \exp_after:wN \__seq_get_right_loop:nw
        \exp_after:wN \q_no_value
        #1
        \__seq_get_right_end:NnN \__seq_item:n
      }
  }
\cs_new:Npn \__seq_get_right_loop:nw #1#2 \__seq_item:n
  {
    #2 \use_none:n {#1}
    \__seq_get_right_loop:nw
  }
\cs_new:Npn \__seq_get_right_end:NnN #1#2#3 { \exp_not:n {#2} }
\cs_generate_variant:Nn \seq_get_right:NN { c }
\cs_new_protected:Npn \seq_pop_right:NN
  { \__seq_pop:NNNN \__seq_pop_right:NNN \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_gpop_right:NN
  { \__seq_pop:NNNN \__seq_pop_right:NNN \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_pop_right:NNN #1#2#3
  {
    \cs_set_eq:NN \__seq_tmp:w \__seq_item:n
    \cs_set_eq:NN \__seq_item:n \scan_stop:
    #1 #2
      { \if_false: } \fi: \s__seq
        \exp_after:wN \use_i:nnn
        \exp_after:wN \__seq_pop_right_loop:nn
        #2
        {
          \if_false: { \fi: }
          \__kernel_tl_set:Nx #3
        }
        { } \use_none:nn
    \cs_set_eq:NN \__seq_item:n \__seq_tmp:w
  }
\cs_new:Npn \__seq_pop_right_loop:nn #1#2
  {
    #2 { \exp_not:n {#1} }
    \__seq_pop_right_loop:nn
  }
\cs_generate_variant:Nn \seq_pop_right:NN  { c }
\cs_generate_variant:Nn \seq_gpop_right:NN { c }
\prg_new_protected_conditional:Npnn \seq_get_left:NN #1#2 { T , F , TF }
  { \__seq_pop_TF:NNNN \prg_do_nothing: \seq_get_left:NN #1#2 }
\prg_new_protected_conditional:Npnn \seq_get_right:NN #1#2 { T , F , TF }
  { \__seq_pop_TF:NNNN \prg_do_nothing: \seq_get_right:NN #1#2 }
\prg_generate_conditional_variant:Nnn \seq_get_left:NN
  { c } { T , F , TF }
\prg_generate_conditional_variant:Nnn \seq_get_right:NN
  { c } { T , F , TF }
\prg_new_protected_conditional:Npnn \seq_pop_left:NN #1#2
  { T , F , TF }
  { \__seq_pop_TF:NNNN \__seq_pop_left:NNN \tl_set:Nn #1 #2 }
\prg_new_protected_conditional:Npnn \seq_gpop_left:NN #1#2
  { T , F , TF }
  { \__seq_pop_TF:NNNN \__seq_pop_left:NNN \tl_gset:Nn #1 #2 }
\prg_new_protected_conditional:Npnn \seq_pop_right:NN #1#2
  { T , F , TF }
  { \__seq_pop_TF:NNNN \__seq_pop_right:NNN \__kernel_tl_set:Nx #1 #2 }
\prg_new_protected_conditional:Npnn \seq_gpop_right:NN #1#2
  { T , F , TF }
  { \__seq_pop_TF:NNNN \__seq_pop_right:NNN \__kernel_tl_gset:Nx #1 #2 }
\prg_generate_conditional_variant:Nnn \seq_pop_left:NN { c }
  { T , F , TF }
\prg_generate_conditional_variant:Nnn \seq_gpop_left:NN { c }
  { T , F , TF }
\prg_generate_conditional_variant:Nnn \seq_pop_right:NN { c }
  { T , F , TF }
\prg_generate_conditional_variant:Nnn \seq_gpop_right:NN { c }
  { T , F , TF }
\cs_new:Npn \seq_item:Nn #1
  { \exp_after:wN \__seq_item:wNn #1 \s__seq_stop #1 }
\cs_new:Npn \__seq_item:wNn \s__seq #1 \s__seq_stop #2#3
  {
    \exp_args:Nf \__seq_item:nwn
      { \exp_args:Nf \__seq_item:nN { \int_eval:n {#3} } #2 }
    #1
    \prg_break: \__seq_item:n { }
    \prg_break_point:
  }
\cs_new:Npn \__seq_item:nN #1#2
  {
    \int_compare:nNnTF {#1} < 0
      { \int_eval:n { \seq_count:N #2 + 1 + #1 } }
      {#1}
  }
\cs_new:Npn \__seq_item:nwn #1#2 \__seq_item:n #3
  {
    #2
    \int_compare:nNnTF {#1} = 1
      { \prg_break:n { \exp_not:n {#3} } }
      { \exp_args:Nf \__seq_item:nwn { \int_eval:n { #1 - 1 } } }
  }
\cs_generate_variant:Nn \seq_item:Nn { c }
\cs_new:Npn \seq_rand_item:N #1
  {
    \seq_if_empty:NF #1
      { \seq_item:Nn #1 { \int_rand:nn { 1 } { \seq_count:N #1 } } }
  }
\cs_generate_variant:Nn \seq_rand_item:N { c }
\cs_new:Npn \seq_map_break:
  { \prg_map_break:Nn \seq_map_break: { } }
\cs_new:Npn \seq_map_break:n
  { \prg_map_break:Nn \seq_map_break: }
\cs_new:Npn \seq_map_function:NN #1#2
  {
    \exp_after:wN \use_i_ii:nnn
    \exp_after:wN \__seq_map_function:Nw
    \exp_after:wN #2
    #1
    \prg_break: \__seq_item:n { } \prg_break_point:
    \prg_break_point:Nn \seq_map_break: { }
  }
\cs_new:Npn \__seq_map_function:Nw #1#2 \__seq_item:n #3
  {
    #2
    #1 {#3}
    \__seq_map_function:Nw #1
  }
\cs_generate_variant:Nn \seq_map_function:NN { c }
\cs_new_protected:Npn \__seq_push_item_def:n
  {
    \__seq_push_item_def:
    \cs_gset:Npn \__seq_item:n ##1
  }
\cs_new_protected:Npn \__seq_push_item_def:x
  {
    \__seq_push_item_def:
    \cs_gset:Npx \__seq_item:n ##1
  }
\cs_new_protected:Npn \__seq_push_item_def:
  {
    \int_gincr:N \g__kernel_prg_map_int
    \cs_gset_eq:cN { __seq_map_ \int_use:N \g__kernel_prg_map_int :w }
      \__seq_item:n
  }
\cs_new_protected:Npn \__seq_pop_item_def:
  {
    \cs_gset_eq:Nc \__seq_item:n
      { __seq_map_ \int_use:N \g__kernel_prg_map_int :w }
    \int_gdecr:N \g__kernel_prg_map_int
  }
\cs_new_protected:Npn \seq_map_inline:Nn #1#2
  {
    \__seq_push_item_def:n {#2}
    #1
    \prg_break_point:Nn \seq_map_break: { \__seq_pop_item_def: }
  }
\cs_generate_variant:Nn \seq_map_inline:Nn { c }
\cs_new:Npn \seq_map_tokens:Nn #1#2
  {
    \exp_last_unbraced:Nno
      \use_i:nn { \__seq_map_tokens:nw {#2} } #1
    \prg_break: \__seq_item:n { } \prg_break_point:
    \prg_break_point:Nn \seq_map_break: { }
  }
\cs_generate_variant:Nn \seq_map_tokens:Nn { c }
\cs_new:Npn \__seq_map_tokens:nw #1#2 \__seq_item:n #3
  {
    #2
    \use:n {#1} {#3}
    \__seq_map_tokens:nw {#1}
  }
\cs_new_protected:Npn \seq_map_variable:NNn #1#2#3
  {
    \__seq_push_item_def:x
      {
        \tl_set:Nn \exp_not:N #2 {##1}
        \exp_not:n {#3}
      }
    #1
    \prg_break_point:Nn \seq_map_break: { \__seq_pop_item_def: }
  }
\cs_generate_variant:Nn \seq_map_variable:NNn {     Nc }
\cs_generate_variant:Nn \seq_map_variable:NNn { c , cc }
\cs_new:Npn \seq_map_indexed_function:NN #1#2
  {
    \__seq_map_indexed:NN #1#2
    \prg_break_point:Nn \seq_map_break: { }
  }
\cs_new_protected:Npn \seq_map_indexed_inline:Nn #1#2
  {
    \int_gincr:N \g__kernel_prg_map_int
    \cs_gset_protected:cpn
      { __seq_map_ \int_use:N \g__kernel_prg_map_int :w } ##1##2 {#2}
    \exp_args:NNc \__seq_map_indexed:NN #1
      { __seq_map_ \int_use:N \g__kernel_prg_map_int :w }
    \prg_break_point:Nn \seq_map_break:
      { \int_gdecr:N \g__kernel_prg_map_int }
  }
\cs_new:Npn \__seq_map_indexed:NN #1#2
  {
    \exp_after:wN \__seq_map_indexed:Nw
    \exp_after:wN #2
    \int_value:w 1
    \exp_after:wN \use_i:nn
    \exp_after:wN ;
    #1
    \prg_break: \__seq_item:n { } \prg_break_point:
  }
\cs_new:Npn \__seq_map_indexed:Nw #1#2 ; #3 \__seq_item:n #4
  {
    #3
    #1 {#2} {#4}
    \exp_after:wN \__seq_map_indexed:Nw
    \exp_after:wN #1
    \int_value:w \int_eval:w 1 + #2 ;
  }
\cs_new_protected:Npn \seq_set_map_x:NNn
  { \__seq_set_map_x:NNNn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_gset_map_x:NNn
  { \__seq_set_map_x:NNNn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_set_map_x:NNNn #1#2#3#4
  {
    \__seq_push_item_def:n { \exp_not:N \__seq_item:n {#4} }
    #1 #2 { #3 }
    \__seq_pop_item_def:
  }
\cs_new_protected:Npn \seq_set_map:NNn
  { \__seq_set_map:NNNn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_gset_map:NNn
  { \__seq_set_map:NNNn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_set_map:NNNn #1#2#3#4
  {
    \__seq_push_item_def:n { \exp_not:n { \__seq_item:n {#4} } }
    #1 #2 { #3 }
    \__seq_pop_item_def:
  }
\cs_new:Npn \seq_count:N #1
  {
    \int_eval:n
      {
        \exp_after:wN \use_i:nn
        \exp_after:wN \__seq_count:w
        #1
        \__seq_count_end:w \__seq_item:n 7
        \__seq_count_end:w \__seq_item:n 6
        \__seq_count_end:w \__seq_item:n 5
        \__seq_count_end:w \__seq_item:n 4
        \__seq_count_end:w \__seq_item:n 3
        \__seq_count_end:w \__seq_item:n 2
        \__seq_count_end:w \__seq_item:n 1
        \__seq_count_end:w \__seq_item:n 0
        \prg_break_point:
      }
  }
\cs_new:Npn \__seq_count:w
    #1 \__seq_item:n #2 \__seq_item:n #3 \__seq_item:n #4 \__seq_item:n
    #5 \__seq_item:n #6 \__seq_item:n #7 \__seq_item:n #8 #9 \__seq_item:n
  { #9 8 + \__seq_count:w }
\cs_new:Npn \__seq_count_end:w 8 + \__seq_count:w #1#2 \prg_break_point: {#1}
\cs_generate_variant:Nn \seq_count:N { c }
\cs_new:Npn \seq_use:Nnnn #1#2#3#4
  {
    \seq_if_exist:NTF #1
      {
        \int_case:nnF { \seq_count:N #1 }
          {
            { 0 } { }
            { 1 } { \exp_after:wN \__seq_use:NNnNnn #1 ? { } { } }
            { 2 } { \exp_after:wN \__seq_use:NNnNnn #1 {#2} }
          }
          {
            \exp_after:wN \__seq_use_setup:w #1 \__seq_item:n
            \s__seq_mark { \__seq_use:nwwwwnwn {#3} }
            \s__seq_mark { \__seq_use:nwwn {#4} }
            \s__seq_stop { }
          }
      }
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { bad-variable } {#1}
      }
  }
\cs_generate_variant:Nn \seq_use:Nnnn { c }
\cs_new:Npn \__seq_use:NNnNnn #1#2#3#4#5#6 { \exp_not:n { #3 #6 #5 } }
\cs_new:Npn \__seq_use_setup:w \s__seq { \__seq_use:nwwwwnwn { } }
\cs_new:Npn \__seq_use:nwwwwnwn
    #1 \__seq_item:n #2 \__seq_item:n #3 \__seq_item:n #4#5
    \s__seq_mark #6#7 \s__seq_stop #8
  {
    #6 \__seq_item:n {#3} \__seq_item:n {#4} #5
    \s__seq_mark {#6} #7 \s__seq_stop { #8 #1 #2 }
  }
\cs_new:Npn \__seq_use:nwwn #1 \__seq_item:n #2 #3 \s__seq_stop #4
  { \exp_not:n { #4 #1 #2 } }
\cs_new:Npn \seq_use:Nn #1#2
  { \seq_use:Nnnn #1 {#2} {#2} {#2} }
\cs_generate_variant:Nn \seq_use:Nn { c }
\cs_new_eq:NN \seq_push:Nn  \seq_put_left:Nn
\cs_new_eq:NN \seq_push:NV  \seq_put_left:NV
\cs_new_eq:NN \seq_push:Nv  \seq_put_left:Nv
\cs_new_eq:NN \seq_push:No  \seq_put_left:No
\cs_new_eq:NN \seq_push:Nx  \seq_put_left:Nx
\cs_new_eq:NN \seq_push:cn  \seq_put_left:cn
\cs_new_eq:NN \seq_push:cV  \seq_put_left:cV
\cs_new_eq:NN \seq_push:cv  \seq_put_left:cv
\cs_new_eq:NN \seq_push:co  \seq_put_left:co
\cs_new_eq:NN \seq_push:cx  \seq_put_left:cx
\cs_new_eq:NN \seq_gpush:Nn \seq_gput_left:Nn
\cs_new_eq:NN \seq_gpush:NV \seq_gput_left:NV
\cs_new_eq:NN \seq_gpush:Nv \seq_gput_left:Nv
\cs_new_eq:NN \seq_gpush:No \seq_gput_left:No
\cs_new_eq:NN \seq_gpush:Nx \seq_gput_left:Nx
\cs_new_eq:NN \seq_gpush:cn \seq_gput_left:cn
\cs_new_eq:NN \seq_gpush:cV \seq_gput_left:cV
\cs_new_eq:NN \seq_gpush:cv \seq_gput_left:cv
\cs_new_eq:NN \seq_gpush:co \seq_gput_left:co
\cs_new_eq:NN \seq_gpush:cx \seq_gput_left:cx
\cs_new_eq:NN \seq_get:NN \seq_get_left:NN
\cs_new_eq:NN \seq_get:cN \seq_get_left:cN
\cs_new_eq:NN \seq_pop:NN \seq_pop_left:NN
\cs_new_eq:NN \seq_pop:cN \seq_pop_left:cN
\cs_new_eq:NN \seq_gpop:NN \seq_gpop_left:NN
\cs_new_eq:NN \seq_gpop:cN \seq_gpop_left:cN
\prg_new_eq_conditional:NNn \seq_get:NN  \seq_get_left:NN  { T , F , TF }
\prg_new_eq_conditional:NNn \seq_get:cN  \seq_get_left:cN  { T , F , TF }
\prg_new_eq_conditional:NNn \seq_pop:NN  \seq_pop_left:NN  { T , F , TF }
\prg_new_eq_conditional:NNn \seq_pop:cN  \seq_pop_left:cN  { T , F , TF }
\prg_new_eq_conditional:NNn \seq_gpop:NN \seq_gpop_left:NN { T , F , TF }
\prg_new_eq_conditional:NNn \seq_gpop:cN \seq_gpop_left:cN { T , F , TF }
\cs_new_protected:Npn \seq_show:N { \__seq_show:NN \msg_show:nnxxxx }
\cs_generate_variant:Nn \seq_show:N { c }
\cs_new_protected:Npn \seq_log:N { \__seq_show:NN \msg_log:nnxxxx }
\cs_generate_variant:Nn \seq_log:N { c }
\cs_new_protected:Npn \__seq_show:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      {
        #1 { LaTeX/kernel } { show-seq }
          { \token_to_str:N #2 }
          { \seq_map_function:NN #2 \msg_show_item:n }
          { } { }
      }
  }
\seq_new:N \l_tmpa_seq
\seq_new:N \l_tmpb_seq
\seq_new:N \g_tmpa_seq
\seq_new:N \g_tmpb_seq
%% File: l3int.dtx
\cs_new_eq:NN \int_value:w      \tex_number:D
\cs_new_eq:NN \__int_eval:w       \tex_numexpr:D
\cs_new_eq:NN \__int_eval_end:    \tex_relax:D
\cs_new_eq:NN \if_int_odd:w     \tex_ifodd:D
\cs_new_eq:NN \if_case:w        \tex_ifcase:D
\scan_new:N \s__int_mark
\scan_new:N \s__int_stop
\cs_new:Npn \__int_use_none_delimit_by_s_stop:w #1 \s__int_stop { }
\quark_new:N \q__int_recursion_tail
\quark_new:N \q__int_recursion_stop
\__kernel_quark_new_test:N \__int_if_recursion_tail_stop_do:Nn
\__kernel_quark_new_test:N \__int_if_recursion_tail_stop:N
\cs_new:Npn \int_eval:n #1
  { \int_value:w \__int_eval:w #1 \__int_eval_end: }
\cs_new:Npn \int_eval:w { \int_value:w \__int_eval:w }
\cs_new:Npn \int_sign:n #1
  {
    \int_value:w \exp_after:wN \__int_sign:Nw
      \int_value:w \__int_eval:w #1 \__int_eval_end: ;
    \exp_stop_f:
  }
\cs_new:Npn \__int_sign:Nw #1#2 ;
  {
    \if_meaning:w 0 #1
      0
    \else:
      \if_meaning:w - #1 - \fi: 1
    \fi:
  }
\cs_new:Npn \int_abs:n #1
  {
    \int_value:w \exp_after:wN \__int_abs:N
      \int_value:w \__int_eval:w #1 \__int_eval_end:
    \exp_stop_f:
  }
\cs_new:Npn \__int_abs:N #1
  { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: }
\cs_set:Npn \int_max:nn #1#2
  {
    \int_value:w \exp_after:wN \__int_maxmin:wwN
      \int_value:w \__int_eval:w #1 \exp_after:wN ;
      \int_value:w \__int_eval:w #2 ;
      >
    \exp_stop_f:
  }
\cs_set:Npn \int_min:nn #1#2
  {
    \int_value:w \exp_after:wN \__int_maxmin:wwN
      \int_value:w \__int_eval:w #1 \exp_after:wN ;
      \int_value:w \__int_eval:w #2 ;
      <
    \exp_stop_f:
  }
\cs_new:Npn \__int_maxmin:wwN #1 ; #2 ; #3
  {
    \if_int_compare:w #1 #3 #2 ~
      #1
    \else:
      #2
    \fi:
  }
\cs_new:Npn \int_div_truncate:nn #1#2
  {
    \int_value:w \__int_eval:w
      \exp_after:wN \__int_div_truncate:NwNw
      \int_value:w \__int_eval:w #1 \exp_after:wN ;
      \int_value:w \__int_eval:w #2 ;
    \__int_eval_end:
  }
\cs_new:Npn \__int_div_truncate:NwNw #1#2; #3#4;
  {
    \if_meaning:w 0 #1
      0
    \else:
      (
        #1#2
        \if_meaning:w - #1 + \else: - \fi:
        ( \if_meaning:w - #3 - \fi: #3#4 - 1 ) / 2
      )
    \fi:
    / #3#4
  }
\cs_new:Npn \int_div_round:nn #1#2
  { \int_value:w \__int_eval:w ( #1 ) / ( #2 ) \__int_eval_end: }
\cs_new:Npn \int_mod:nn #1#2
  {
    \int_value:w \__int_eval:w \exp_after:wN \__int_mod:ww
      \int_value:w \__int_eval:w #1 \exp_after:wN ;
      \int_value:w \__int_eval:w #2 ;
    \__int_eval_end:
  }
\cs_new:Npn \__int_mod:ww #1; #2;
  { #1 - ( \__int_div_truncate:NwNw #1 ; #2 ; ) * #2 }
\cs_new:Npn \__kernel_int_add:nnn #1#2#3
  {
    \int_value:w \__int_eval:w #1
      \if_int_compare:w #2 < \c_zero_int \exp_after:wN \reverse_if:N \fi:
      \if_int_compare:w #1 < \c_zero_int + #2 + #3 \else: + #3 + #2 \fi:
    \__int_eval_end:
  }
\cs_new_protected:Npn \int_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs:w newcount \cs_end: #1
  }
\cs_generate_variant:Nn \int_new:N { c }
\cs_new_protected:Npn \int_const:Nn #1#2
  {
    \int_compare:nNnTF {#2} < \c_zero_int
      {
        \int_new:N #1
        \tex_global:D
      }
      {
        \int_compare:nNnTF {#2} > \c__int_max_constdef_int
          {
            \int_new:N #1
            \tex_global:D
          }
          {
            \__kernel_chk_if_free_cs:N #1
            \tex_global:D \__int_constdef:Nw
          }
      }
    #1 = \__int_eval:w #2 \__int_eval_end:
  }
\cs_generate_variant:Nn \int_const:Nn { c }
\if_int_odd:w 0
  \cs_if_exist:NT \tex_luatexversion:D { 1 }
  \cs_if_exist:NT \tex_omathchardef:D  { 1 }
  \cs_if_exist:NT \tex_XeTeXversion:D  { 1 } ~
    \cs_if_exist:NTF \tex_omathchardef:D
      { \cs_new_eq:NN \__int_constdef:Nw \tex_omathchardef:D }
      { \cs_new_eq:NN \__int_constdef:Nw \tex_chardef:D }
    \__int_constdef:Nw \c__int_max_constdef_int 1114111 ~
\else:
  \cs_new_eq:NN \__int_constdef:Nw \tex_mathchardef:D
  \tex_mathchardef:D \c__int_max_constdef_int 32767 ~
\fi:
\cs_new_protected:Npn \int_zero:N  #1 { #1 = \c_zero_int }
\cs_new_protected:Npn \int_gzero:N #1 { \tex_global:D #1 = \c_zero_int }
\cs_generate_variant:Nn \int_zero:N  { c }
\cs_generate_variant:Nn \int_gzero:N { c }
\cs_new_protected:Npn \int_zero_new:N  #1
  { \int_if_exist:NTF #1 { \int_zero:N #1 } { \int_new:N #1 } }
\cs_new_protected:Npn \int_gzero_new:N #1
  { \int_if_exist:NTF #1 { \int_gzero:N #1 } { \int_new:N #1 } }
\cs_generate_variant:Nn \int_zero_new:N  { c }
\cs_generate_variant:Nn \int_gzero_new:N { c }
\cs_new_protected:Npn \int_set_eq:NN #1#2 { #1 = #2 }
\cs_generate_variant:Nn \int_set_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \int_gset_eq:NN #1#2 { \tex_global:D #1 = #2 }
\cs_generate_variant:Nn \int_gset_eq:NN { c , Nc , cc }
\prg_new_eq_conditional:NNn \int_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \int_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\cs_new_protected:Npn \int_add:Nn #1#2
  { \tex_advance:D #1 by \__int_eval:w #2 \__int_eval_end: }
\cs_new_protected:Npn \int_sub:Nn #1#2
  { \tex_advance:D #1 by - \__int_eval:w #2 \__int_eval_end: }
\cs_new_protected:Npn \int_gadd:Nn #1#2
  { \tex_global:D \tex_advance:D #1 by \__int_eval:w #2 \__int_eval_end: }
\cs_new_protected:Npn \int_gsub:Nn #1#2
  { \tex_global:D \tex_advance:D #1 by - \__int_eval:w #2 \__int_eval_end: }
\cs_generate_variant:Nn \int_add:Nn  { c }
\cs_generate_variant:Nn \int_gadd:Nn { c }
\cs_generate_variant:Nn \int_sub:Nn  { c }
\cs_generate_variant:Nn \int_gsub:Nn { c }
\cs_new_protected:Npn \int_incr:N #1
  { \tex_advance:D #1 \c_one_int }
\cs_new_protected:Npn \int_decr:N #1
  { \tex_advance:D #1 - \c_one_int }
\cs_new_protected:Npn \int_gincr:N #1
  { \tex_global:D \tex_advance:D #1 \c_one_int }
\cs_new_protected:Npn \int_gdecr:N #1
  { \tex_global:D \tex_advance:D #1 - \c_one_int }
\cs_generate_variant:Nn \int_incr:N  { c }
\cs_generate_variant:Nn \int_decr:N  { c }
\cs_generate_variant:Nn \int_gincr:N { c }
\cs_generate_variant:Nn \int_gdecr:N { c }
\cs_new_protected:Npn \int_set:Nn #1#2
  { #1 ~ \__int_eval:w #2 \__int_eval_end: }
\cs_new_protected:Npn \int_gset:Nn #1#2
  { \tex_global:D #1 ~ \__int_eval:w #2 \__int_eval_end: }
\cs_generate_variant:Nn \int_set:Nn  { c }
\cs_generate_variant:Nn \int_gset:Nn { c }
\cs_new_eq:NN \int_use:N \tex_the:D
\cs_new:Npn \int_use:c #1 { \tex_the:D \cs:w #1 \cs_end: }
\cs_new_protected:Npn \__int_compare_error:
  {
    \if_int_compare:w \c_zero_int \c_zero_int \fi:
    =
    \__int_compare_error:
  }
\cs_new:Npn \__int_compare_error:Nw
    #1#2 \s__int_stop
  {
    { }
    \c_zero_int \fi:
    \__kernel_msg_expandable_error:nnn
      { kernel } { unknown-comparison } {#1}
    \prg_return_false:
  }
\prg_new_conditional:Npnn \int_compare:n #1 { p , T , F , TF }
  {
    \exp_after:wN \__int_compare:w
    \int_value:w \__int_eval:w #1 \__int_compare_error:
  }
\cs_new:Npn \__int_compare:w #1 \__int_compare_error:
  {
    \exp_after:wN \if_false: \int_value:w
      \__int_compare:Nw #1 e { = nd_ } \s__int_stop
  }
\cs_new:Npn \__int_compare:Nw #1#2 \s__int_stop
  {
    \exp_after:wN \__int_compare:NNw
      \__int_to_roman:w - 0 #2 \s__int_mark
    #1#2 \s__int_stop
  }
\cs_new:Npn \__int_compare:NNw #1#2#3 \s__int_mark
  {
    \__kernel_exp_not:w
    \use:c
      {
        __int_compare_ \token_to_str:N #1
        \if_meaning:w = #2 =  \fi:
        :NNw
      }
      \__int_compare_error:Nw #1
  }
\cs_new:cpn { __int_compare_end_=:NNw } #1#2#3 e #4 \s__int_stop
  {
    {#3} \exp_stop_f:
    \prg_return_false: \else: \prg_return_true: \fi:
  }
\cs_new:Npn \__int_compare:nnN #1#2#3
  {
        {#2} \exp_stop_f:
      \prg_return_false: \exp_after:wN \__int_use_none_delimit_by_s_stop:w
    \fi:
    #1 #2 #3 \exp_after:wN \__int_compare:Nw \int_value:w \__int_eval:w
  }
\cs_new:cpn { __int_compare_=:NNw } #1#2#3 =
  { \__int_compare:nnN { \reverse_if:N \if_int_compare:w } {#3} = }
\cs_new:cpn { __int_compare_<:NNw } #1#2#3 <
  { \__int_compare:nnN { \reverse_if:N \if_int_compare:w } {#3} < }
\cs_new:cpn { __int_compare_>:NNw } #1#2#3 >
  { \__int_compare:nnN { \reverse_if:N \if_int_compare:w } {#3} > }
\cs_new:cpn { __int_compare_==:NNw } #1#2#3 ==
  { \__int_compare:nnN { \reverse_if:N \if_int_compare:w } {#3} = }
\cs_new:cpn { __int_compare_!=:NNw } #1#2#3 !=
  { \__int_compare:nnN { \if_int_compare:w } {#3} = }
\cs_new:cpn { __int_compare_<=:NNw } #1#2#3 <=
  { \__int_compare:nnN { \if_int_compare:w } {#3} > }
\cs_new:cpn { __int_compare_>=:NNw } #1#2#3 >=
  { \__int_compare:nnN { \if_int_compare:w } {#3} < }
\prg_new_conditional:Npnn \int_compare:nNn #1#2#3 { p , T , F , TF }
  {
    \if_int_compare:w \__int_eval:w #1 #2 \__int_eval:w #3 \__int_eval_end:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \int_case:nnTF #1
  {
    \exp:w
    \exp_args:Nf \__int_case:nnTF { \int_eval:n {#1} }
  }
\cs_new:Npn \int_case:nnT #1#2#3
  {
    \exp:w
    \exp_args:Nf \__int_case:nnTF { \int_eval:n {#1} } {#2} {#3} { }
  }
\cs_new:Npn \int_case:nnF #1#2
  {
    \exp:w
    \exp_args:Nf \__int_case:nnTF { \int_eval:n {#1} } {#2} { }
  }
\cs_new:Npn \int_case:nn #1#2
  {
    \exp:w
    \exp_args:Nf \__int_case:nnTF { \int_eval:n {#1} } {#2} { } { }
  }
\cs_new:Npn \__int_case:nnTF #1#2#3#4
  { \__int_case:nw {#1} #2 {#1} { } \s__int_mark {#3} \s__int_mark {#4} \s__int_stop }
\cs_new:Npn \__int_case:nw #1#2#3
  {
    \int_compare:nNnTF {#1} = {#2}
      { \__int_case_end:nw {#3} }
      { \__int_case:nw {#1} }
  }
\cs_new:Npn \__int_case_end:nw #1#2#3 \s__int_mark #4#5 \s__int_stop
  { \exp_end: #1 #4 }
\prg_new_conditional:Npnn \int_if_odd:n #1 { p , T , F , TF}
  {
    \if_int_odd:w \__int_eval:w #1 \__int_eval_end:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_new_conditional:Npnn \int_if_even:n #1 { p , T , F , TF}
  {
    \reverse_if:N \if_int_odd:w \__int_eval:w #1 \__int_eval_end:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \int_while_do:nn #1#2
  {
    \int_compare:nT {#1}
      {
        #2
        \int_while_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \int_until_do:nn #1#2
  {
    \int_compare:nF {#1}
      {
        #2
        \int_until_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \int_do_while:nn #1#2
  {
    #2
    \int_compare:nT {#1}
      { \int_do_while:nn {#1} {#2} }
  }
\cs_new:Npn \int_do_until:nn #1#2
  {
    #2
    \int_compare:nF {#1}
      { \int_do_until:nn {#1} {#2} }
  }
\cs_new:Npn \int_while_do:nNnn #1#2#3#4
  {
    \int_compare:nNnT {#1} #2 {#3}
      {
        #4
        \int_while_do:nNnn {#1} #2 {#3} {#4}
      }
  }
\cs_new:Npn \int_until_do:nNnn #1#2#3#4
  {
    \int_compare:nNnF {#1} #2 {#3}
      {
        #4
        \int_until_do:nNnn {#1} #2 {#3} {#4}
      }
  }
\cs_new:Npn \int_do_while:nNnn #1#2#3#4
  {
    #4
    \int_compare:nNnT {#1} #2 {#3}
      { \int_do_while:nNnn {#1} #2 {#3} {#4} }
  }
\cs_new:Npn \int_do_until:nNnn #1#2#3#4
  {
    #4
    \int_compare:nNnF {#1} #2 {#3}
      { \int_do_until:nNnn {#1} #2 {#3} {#4} }
  }
\cs_new:Npn \int_step_function:nnnN #1#2#3
  {
    \exp_after:wN \__int_step:wwwN
    \int_value:w \__int_eval:w #1 \exp_after:wN ;
    \int_value:w \__int_eval:w #2 \exp_after:wN ;
    \int_value:w \__int_eval:w #3 ;
  }
\cs_new:Npn \__int_step:wwwN #1; #2; #3; #4
  {
    \int_compare:nNnTF {#2} > \c_zero_int
      { \__int_step:NwnnN > }
      {
        \int_compare:nNnTF {#2} = \c_zero_int
          {
            \__kernel_msg_expandable_error:nnn
              { kernel } { zero-step } {#4}
            \prg_break:
          }
          { \__int_step:NwnnN < }
      }
      #1 ; {#2} {#3} #4
    \prg_break_point:
  }
\cs_new:Npn \__int_step:NwnnN #1#2 ; #3#4#5
  {
    \if_int_compare:w #2 #1 #4 \exp_stop_f:
      \prg_break:n
    \fi:
    #5 {#2}
    \exp_after:wN \__int_step:NwnnN
    \exp_after:wN #1
    \int_value:w \__int_eval:w #2 + #3 ; {#3} {#4} #5
  }
\cs_new:Npn \int_step_function:nN
  { \int_step_function:nnnN { 1 } { 1 } }
\cs_new:Npn \int_step_function:nnN #1
  { \int_step_function:nnnN {#1} { 1 } }
\cs_new_protected:Npn \int_step_inline:nn
  { \int_step_inline:nnnn { 1 } { 1 } }
\cs_new_protected:Npn \int_step_inline:nnn #1
  { \int_step_inline:nnnn {#1} { 1 } }
\cs_new_protected:Npn \int_step_inline:nnnn
  {
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:NNc \__int_step:NNnnnn
      \cs_gset_protected:Npn
      { __int_map_ \int_use:N \g__kernel_prg_map_int :w }
  }
\cs_new_protected:Npn \int_step_variable:nNn
  { \int_step_variable:nnnNn { 1 } { 1 } }
\cs_new_protected:Npn \int_step_variable:nnNn #1
  { \int_step_variable:nnnNn {#1} { 1 } }
\cs_new_protected:Npn \int_step_variable:nnnNn #1#2#3#4#5
  {
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:NNc \__int_step:NNnnnn
      \cs_gset_protected:Npx
      { __int_map_ \int_use:N \g__kernel_prg_map_int :w }
      {#1}{#2}{#3}
      {
        \tl_set:Nn \exp_not:N #4 {##1}
        \exp_not:n {#5}
      }
  }
\cs_new_protected:Npn \__int_step:NNnnnn #1#2#3#4#5#6
  {
    #1 #2 ##1 {#6}
    \int_step_function:nnnN {#3} {#4} {#5} #2
    \prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__kernel_prg_map_int }
  }
\cs_new_eq:NN \int_to_arabic:n \int_eval:n
\cs_new:Npn \int_to_symbols:nnn #1#2#3
  {
    \int_compare:nNnTF {#1} > {#2}
      {
        \exp_args:NNo \exp_args:No \__int_to_symbols:nnnn
          {
            \int_case:nn
              { 1 + \int_mod:nn { #1 - 1 } {#2} }
              {#3}
          }
          {#1} {#2} {#3}
      }
      { \int_case:nn {#1} {#3} }
  }
\cs_new:Npn \__int_to_symbols:nnnn #1#2#3#4
  {
    \exp_args:Nf \int_to_symbols:nnn
      { \int_div_truncate:nn { #2 - 1 } {#3} } {#3} {#4}
    #1
  }
\cs_new:Npn \int_to_alph:n #1
  {
    \int_to_symbols:nnn {#1} { 26 }
      {
        {  1 } { a }
        {  2 } { b }
        {  3 } { c }
        {  4 } { d }
        {  5 } { e }
        {  6 } { f }
        {  7 } { g }
        {  8 } { h }
        {  9 } { i }
        { 10 } { j }
        { 11 } { k }
        { 12 } { l }
        { 13 } { m }
        { 14 } { n }
        { 15 } { o }
        { 16 } { p }
        { 17 } { q }
        { 18 } { r }
        { 19 } { s }
        { 20 } { t }
        { 21 } { u }
        { 22 } { v }
        { 23 } { w }
        { 24 } { x }
        { 25 } { y }
        { 26 } { z }
      }
  }
\cs_new:Npn \int_to_Alph:n #1
  {
    \int_to_symbols:nnn {#1} { 26 }
      {
        {  1 } { A }
        {  2 } { B }
        {  3 } { C }
        {  4 } { D }
        {  5 } { E }
        {  6 } { F }
        {  7 } { G }
        {  8 } { H }
        {  9 } { I }
        { 10 } { J }
        { 11 } { K }
        { 12 } { L }
        { 13 } { M }
        { 14 } { N }
        { 15 } { O }
        { 16 } { P }
        { 17 } { Q }
        { 18 } { R }
        { 19 } { S }
        { 20 } { T }
        { 21 } { U }
        { 22 } { V }
        { 23 } { W }
        { 24 } { X }
        { 25 } { Y }
        { 26 } { Z }
      }
  }
\cs_new:Npn \int_to_base:nn #1
  { \exp_args:Nf \__int_to_base:nn { \int_eval:n {#1} } }
\cs_new:Npn \int_to_Base:nn #1
  { \exp_args:Nf \__int_to_Base:nn { \int_eval:n {#1} } }
\cs_new:Npn \__int_to_base:nn #1#2
  {
    \int_compare:nNnTF {#1} < 0
      { \exp_args:No \__int_to_base:nnN { \use_none:n #1 } {#2} - }
      { \__int_to_base:nnN {#1} {#2} \c_empty_tl }
  }
\cs_new:Npn \__int_to_Base:nn #1#2
  {
    \int_compare:nNnTF {#1} < 0
      { \exp_args:No \__int_to_Base:nnN { \use_none:n #1 } {#2} - }
      { \__int_to_Base:nnN {#1} {#2} \c_empty_tl }
  }
\cs_new:Npn \__int_to_base:nnN #1#2#3
  {
    \int_compare:nNnTF {#1} < {#2}
      { \exp_last_unbraced:Nf #3 { \__int_to_letter:n {#1} } }
      {
        \exp_args:Nf \__int_to_base:nnnN
          { \__int_to_letter:n { \int_mod:nn {#1} {#2} } }
          {#1}
          {#2}
          #3
      }
  }
\cs_new:Npn \__int_to_base:nnnN #1#2#3#4
  {
    \exp_args:Nf \__int_to_base:nnN
      { \int_div_truncate:nn {#2} {#3} }
      {#3}
      #4
    #1
  }
\cs_new:Npn \__int_to_Base:nnN #1#2#3
  {
    \int_compare:nNnTF {#1} < {#2}
      { \exp_last_unbraced:Nf #3 { \__int_to_Letter:n {#1} } }
      {
        \exp_args:Nf \__int_to_Base:nnnN
          { \__int_to_Letter:n { \int_mod:nn {#1} {#2} } }
          {#1}
          {#2}
          #3
      }
  }
\cs_new:Npn \__int_to_Base:nnnN #1#2#3#4
  {
    \exp_args:Nf \__int_to_Base:nnN
      { \int_div_truncate:nn {#2} {#3} }
      {#3}
      #4
    #1
  }
\cs_new:Npn \__int_to_letter:n #1
  {
    \exp_after:wN \exp_after:wN
    \if_case:w \__int_eval:w #1 - 10 \__int_eval_end:
         a
    \or: b
    \or: c
    \or: d
    \or: e
    \or: f
    \or: g
    \or: h
    \or: i
    \or: j
    \or: k
    \or: l
    \or: m
    \or: n
    \or: o
    \or: p
    \or: q
    \or: r
    \or: s
    \or: t
    \or: u
    \or: v
    \or: w
    \or: x
    \or: y
    \or: z
    \else: \int_value:w \__int_eval:w #1 \exp_after:wN \__int_eval_end:
    \fi:
  }
\cs_new:Npn \__int_to_Letter:n #1
  {
    \exp_after:wN \exp_after:wN
    \if_case:w \__int_eval:w #1 - 10 \__int_eval_end:
         A
    \or: B
    \or: C
    \or: D
    \or: E
    \or: F
    \or: G
    \or: H
    \or: I
    \or: J
    \or: K
    \or: L
    \or: M
    \or: N
    \or: O
    \or: P
    \or: Q
    \or: R
    \or: S
    \or: T
    \or: U
    \or: V
    \or: W
    \or: X
    \or: Y
    \or: Z
    \else: \int_value:w \__int_eval:w #1 \exp_after:wN \__int_eval_end:
    \fi:
  }
\cs_new:Npn \int_to_bin:n #1
  { \int_to_base:nn {#1} { 2 } }
\cs_new:Npn \int_to_hex:n #1
  { \int_to_base:nn {#1} { 16 } }
\cs_new:Npn \int_to_Hex:n #1
  { \int_to_Base:nn {#1} { 16 } }
\cs_new:Npn \int_to_oct:n #1
  { \int_to_base:nn {#1} { 8 } }
\cs_new:Npn \int_to_roman:n #1
  {
    \exp_after:wN \__int_to_roman:N
      \__int_to_roman:w \int_eval:n {#1} Q
  }
\cs_new:Npn \__int_to_roman:N #1
  {
    \use:c { __int_to_roman_ #1 :w }
    \__int_to_roman:N
  }
\cs_new:Npn \int_to_Roman:n #1
  {
    \exp_after:wN \__int_to_Roman_aux:N
      \__int_to_roman:w \int_eval:n {#1} Q
  }
\cs_new:Npn \__int_to_Roman_aux:N #1
  {
    \use:c { __int_to_Roman_ #1 :w }
    \__int_to_Roman_aux:N
  }
\cs_new:Npn \__int_to_roman_i:w { i }
\cs_new:Npn \__int_to_roman_v:w { v }
\cs_new:Npn \__int_to_roman_x:w { x }
\cs_new:Npn \__int_to_roman_l:w { l }
\cs_new:Npn \__int_to_roman_c:w { c }
\cs_new:Npn \__int_to_roman_d:w { d }
\cs_new:Npn \__int_to_roman_m:w { m }
\cs_new:Npn \__int_to_roman_Q:w #1 { }
\cs_new:Npn \__int_to_Roman_i:w { I }
\cs_new:Npn \__int_to_Roman_v:w { V }
\cs_new:Npn \__int_to_Roman_x:w { X }
\cs_new:Npn \__int_to_Roman_l:w { L }
\cs_new:Npn \__int_to_Roman_c:w { C }
\cs_new:Npn \__int_to_Roman_d:w { D }
\cs_new:Npn \__int_to_Roman_m:w { M }
\cs_new:Npn \__int_to_Roman_Q:w #1 { }
\cs_new:Npn \__int_pass_signs:wn #1
  {
    \if:w + \if:w - \exp_not:N #1 + \fi: \exp_not:N #1
      \exp_after:wN \__int_pass_signs:wn
    \else:
      \exp_after:wN \__int_pass_signs_end:wn
      \exp_after:wN #1
    \fi:
  }
\cs_new:Npn \__int_pass_signs_end:wn #1 \s__int_stop #2 { #2 #1 }
\cs_new:Npn \int_from_alph:n #1
  {
    \int_eval:n
      {
        \exp_after:wN \__int_pass_signs:wn \tl_to_str:n {#1}
          \s__int_stop { \__int_from_alph:nN { 0 } }
        \q__int_recursion_tail \q__int_recursion_stop
      }
  }
\cs_new:Npn \__int_from_alph:nN #1#2
  {
    \__int_if_recursion_tail_stop_do:Nn #2 {#1}
    \exp_args:Nf \__int_from_alph:nN
      { \int_eval:n { #1 * 26 + \__int_from_alph:N #2 } }
  }
\cs_new:Npn \__int_from_alph:N #1
  { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 64 } { 96 } }
\cs_new:Npn \int_from_base:nn #1#2
  {
    \int_eval:n
      {
        \exp_after:wN \__int_pass_signs:wn \tl_to_str:n {#1}
          \s__int_stop { \__int_from_base:nnN { 0 } {#2} }
        \q__int_recursion_tail \q__int_recursion_stop
      }
  }
\cs_new:Npn \__int_from_base:nnN #1#2#3
  {
    \__int_if_recursion_tail_stop_do:Nn #3 {#1}
    \exp_args:Nf \__int_from_base:nnN
      { \int_eval:n { #1 * #2 + \__int_from_base:N #3 } }
      {#2}
  }
\cs_new:Npn \__int_from_base:N #1
  {
    \int_compare:nNnTF { `#1 } < { 58 }
      {#1}
      { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 55 } { 87 } }
  }
\cs_new:Npn \int_from_bin:n #1
  { \int_from_base:nn {#1} { 2 } }
\cs_new:Npn \int_from_hex:n #1
  { \int_from_base:nn {#1} { 16 } }
\cs_new:Npn \int_from_oct:n #1
  { \int_from_base:nn {#1} { 8 } }
\int_const:cn { c__int_from_roman_i_int } { 1 }
\int_const:cn { c__int_from_roman_v_int } { 5 }
\int_const:cn { c__int_from_roman_x_int } { 10 }
\int_const:cn { c__int_from_roman_l_int } { 50 }
\int_const:cn { c__int_from_roman_c_int } { 100 }
\int_const:cn { c__int_from_roman_d_int } { 500 }
\int_const:cn { c__int_from_roman_m_int } { 1000 }
\int_const:cn { c__int_from_roman_I_int } { 1 }
\int_const:cn { c__int_from_roman_V_int } { 5 }
\int_const:cn { c__int_from_roman_X_int } { 10 }
\int_const:cn { c__int_from_roman_L_int } { 50 }
\int_const:cn { c__int_from_roman_C_int } { 100 }
\int_const:cn { c__int_from_roman_D_int } { 500 }
\int_const:cn { c__int_from_roman_M_int } { 1000 }
\cs_new:Npn \int_from_roman:n #1
  {
    \int_eval:n
      {
        (
          0
          \exp_after:wN \__int_from_roman:NN \tl_to_str:n {#1}
          \q__int_recursion_tail \q__int_recursion_tail \q__int_recursion_stop
        )
      }
  }
\cs_new:Npn \__int_from_roman:NN #1#2
  {
    \__int_if_recursion_tail_stop:N #1
    \int_if_exist:cF { c__int_from_roman_ #1 _int }
      { \__int_from_roman_error:w }
    \__int_if_recursion_tail_stop_do:Nn #2
      { + \use:c { c__int_from_roman_ #1 _int } }
    \int_if_exist:cF { c__int_from_roman_ #2 _int }
      { \__int_from_roman_error:w }
    \int_compare:nNnTF
      { \use:c { c__int_from_roman_ #1 _int } }
      <
      { \use:c { c__int_from_roman_ #2 _int } }
      {
        + \use:c { c__int_from_roman_ #2 _int }
        - \use:c { c__int_from_roman_ #1 _int }
        \__int_from_roman:NN
      }
      {
        + \use:c { c__int_from_roman_ #1 _int }
        \__int_from_roman:NN #2
      }
  }
\cs_new:Npn \__int_from_roman_error:w #1 \q__int_recursion_stop #2
  { #2 * 0 - 1 }
\cs_new_eq:NN \int_show:N \__kernel_register_show:N
\cs_generate_variant:Nn \int_show:N { c }
\cs_new_protected:Npn \int_show:n
  { \msg_show_eval:Nn \int_eval:n }
\cs_new_eq:NN \int_log:N \__kernel_register_log:N
\cs_generate_variant:Nn \int_log:N { c }
\cs_new_protected:Npn \int_log:n
  { \msg_log_eval:Nn \int_eval:n }
\int_const:Nn \c_one_int { 1 }
\int_const:Nn \c_max_int { 2 147 483 647 }
\int_const:Nn \c_max_char_int
  {
    \if_int_odd:w 0
      \cs_if_exist:NT \tex_luatexversion:D  { 1 }
      \cs_if_exist:NT \tex_XeTeXversion:D    { 1 } ~
      "10FFFF
    \else:
      "FF
    \fi:
  }
\int_new:N \l_tmpa_int
\int_new:N \l_tmpb_int
\int_new:N \g_tmpa_int
\int_new:N \g_tmpb_int
\int_new:N \l__seq_internal_a_int
\int_new:N \l__seq_internal_b_int
%% File: l3flag.dtx
\cs_new_protected:Npn \flag_new:n #1
  {
    \cs_new:cpn { flag~#1 } ##1 ;
      { \exp_after:wN \use_none:n \cs:w flag~#1~##1 \cs_end: }
  }
\cs_new_protected:Npn \flag_clear:n #1 { \__flag_clear:wn 0 ; {#1} }
\cs_new_protected:Npn \__flag_clear:wn #1 ; #2
  {
    \if_cs_exist:w flag~#2~#1 \cs_end:
      \cs_set_eq:cN { flag~#2~#1 } \tex_undefined:D
      \exp_after:wN \__flag_clear:wn
      \int_value:w \int_eval:w 1 + #1
    \else:
      \use_i:nnn
    \fi:
    ; {#2}
  }
\cs_new_protected:Npn \flag_clear_new:n #1
  { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} }
\cs_new_protected:Npn \flag_show:n { \__flag_show:Nn \tl_show:n }
\cs_new_protected:Npn \flag_log:n { \__flag_show:Nn \tl_log:n }
\cs_new_protected:Npn \__flag_show:Nn #1#2
  {
    \exp_args:Nc \__kernel_chk_defined:NT { flag~#2 }
      {
        \exp_args:Nx #1
          { \tl_to_str:n { flag~#2~height } = \flag_height:n {#2} }
      }
  }
\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF }
  {
    \cs_if_exist:cTF { flag~#1 }
      { \prg_return_true: } { \prg_return_false: }
  }
\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF }
  {
    \if_cs_exist:w flag~#1~0 \cs_end:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \flag_height:n #1 { \__flag_height_loop:wn 0; {#1} }
\cs_new:Npn \__flag_height_loop:wn #1 ; #2
  {
    \if_cs_exist:w flag~#2~#1 \cs_end:
      \exp_after:wN \__flag_height_loop:wn \int_value:w \int_eval:w 1 +
    \else:
      \exp_after:wN \__flag_height_end:wn
    \fi:
    #1 ; {#2}
  }
\cs_new:Npn \__flag_height_end:wn #1 ; #2 {#1}
\cs_new:Npn \flag_raise:n #1
  {
    \cs:w flag~#1 \exp_after:wN \cs_end:
    \int_value:w \flag_height:n {#1} ;
  }
%% File: l3prg.dtx
\cs_new_eq:NN \if_predicate:w \tex_ifodd:D
\cs_new_protected:Npn \bool_new:N #1 { \cs_new_eq:NN #1 \c_false_bool }
\cs_generate_variant:Nn \bool_new:N { c }
\cs_new_protected:Npn \bool_const:Nn #1#2
  {
    \__kernel_chk_if_free_cs:N #1
    \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2}
  }
\cs_generate_variant:Nn \bool_const:Nn { c }
\cs_new_protected:Npn \bool_set_true:N #1
  { \cs_set_eq:NN #1 \c_true_bool }
\cs_new_protected:Npn \bool_set_false:N #1
  { \cs_set_eq:NN #1 \c_false_bool }
\cs_new_protected:Npn \bool_gset_true:N #1
  { \cs_gset_eq:NN #1 \c_true_bool }
\cs_new_protected:Npn \bool_gset_false:N #1
  { \cs_gset_eq:NN #1 \c_false_bool }
\cs_generate_variant:Nn \bool_set_true:N   { c }
\cs_generate_variant:Nn \bool_set_false:N  { c }
\cs_generate_variant:Nn \bool_gset_true:N  { c }
\cs_generate_variant:Nn \bool_gset_false:N { c }
\cs_new_eq:NN \bool_set_eq:NN  \tl_set_eq:NN
\cs_new_eq:NN \bool_gset_eq:NN \tl_gset_eq:NN
\cs_generate_variant:Nn \bool_set_eq:NN { Nc, cN, cc }
\cs_generate_variant:Nn \bool_gset_eq:NN { Nc, cN, cc }
\cs_new_protected:Npn \bool_set:Nn #1#2
  {
    \exp_last_unbraced:NNNf
      \tex_chardef:D #1 = { \bool_if_p:n {#2} }
  }
\cs_new_protected:Npn \bool_gset:Nn #1#2
  {
    \exp_last_unbraced:NNNNf
      \tex_global:D \tex_chardef:D #1 = { \bool_if_p:n {#2} }
  }
\cs_generate_variant:Nn \bool_set:Nn  { c }
\cs_generate_variant:Nn \bool_gset:Nn { c }
\quark_new:N \q__bool_recursion_tail
\quark_new:N \q__bool_recursion_stop
\cs_new:Npn \__bool_use_i_delimit_by_q_recursion_stop:nw
  #1 #2 \q__bool_recursion_stop {#1}
\__kernel_quark_new_test:N \__bool_if_recursion_tail_stop_do:nn
\prg_new_conditional:Npnn \bool_if:N #1 { p , T , F , TF }
  {
    \if_bool:N #1
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \bool_if:N { c } { p , T , F , TF }
\cs_new_protected:Npn \bool_show:n
  { \msg_show_eval:Nn \__bool_to_str:n }
\cs_new_protected:Npn \bool_log:n
  { \msg_log_eval:Nn \__bool_to_str:n }
\cs_new:Npn \__bool_to_str:n #1
  { \bool_if:nTF {#1} { true } { false } }
\cs_new_protected:Npn \bool_show:N { \__bool_show:NN \tl_show:n }
\cs_generate_variant:Nn \bool_show:N { c }
\cs_new_protected:Npn \bool_log:N { \__bool_show:NN \tl_log:n }
\cs_generate_variant:Nn \bool_log:N { c }
\cs_new_protected:Npn \__bool_show:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      { \exp_args:Nx #1 { \token_to_str:N #2 = \__bool_to_str:n {#2} } }
  }
\bool_new:N \l_tmpa_bool
\bool_new:N \l_tmpb_bool
\bool_new:N \g_tmpa_bool
\bool_new:N \g_tmpb_bool
\prg_new_eq_conditional:NNn \bool_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \bool_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\prg_new_conditional:Npnn \bool_if:n #1 { T , F , TF }
  {
    \if_predicate:w \bool_if_p:n {#1}
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \bool_if_p:n { \exp_args:Nf \__bool_if_p:n }
\cs_new:Npn \__bool_if_p:n #1
  {
    \tl_if_empty:oT { \use_none:nn #1 . } { \__bool_if_p_aux:w }
    \group_align_safe_begin:
    \exp_after:wN
    \group_align_safe_end:
    \exp:w \exp_end_continue_f:w % (
    \__bool_get_next:NN \use_i:nnnn #1 )
  }
\cs_new:Npn \__bool_if_p_aux:w #1 \use_i:nnnn #2#3 {#2}
\cs_new:Npn \__bool_get_next:NN #1#2
  {
    \use:c
      {
        __bool_
        \if_meaning:w !#2 ! \else: \if_meaning:w (#2 ( \else: p \fi: \fi:
        :Nw
      }
      #1 #2
  }
\cs_new:cpn { __bool_!:Nw } #1#2
  {
    \exp_after:wN \__bool_get_next:NN
    #1 \use_ii:nnnn \use_i:nnnn \use_iii:nnnn \use_iv:nnnn
  }
\cs_new:cpn { __bool_(:Nw } #1#2
  {
    \exp_after:wN \__bool_choose:NNN \exp_after:wN #1
    \int_value:w \__bool_get_next:NN \use_i:nnnn
  }
\cs_new:cpn { __bool_p:Nw } #1
  { \exp_after:wN \__bool_choose:NNN \exp_after:wN #1 \int_value:w }
\cs_new:Npn \__bool_choose:NNN #1#2#3
  {
    \use:c
      {
        __bool_ \token_to_str:N #3 _
        #1 #2 { \if_meaning:w 0 #2 1 \else: 0 \fi: } 2 0 :
      }
  }
\cs_new:cpn { __bool_)_0: } { \c_false_bool }
\cs_new:cpn { __bool_)_1: } { \c_true_bool }
\cs_new:cpn { __bool_)_2: } { \c_true_bool }
\cs_new:cpn { __bool_&_0: } & { \__bool_get_next:NN \use_iv:nnnn }
\cs_new:cpn { __bool_&_1: } & { \__bool_get_next:NN \use_i:nnnn }
\cs_new:cpn { __bool_&_2: } & { \__bool_get_next:NN \use_iii:nnnn }
\cs_new:cpn { __bool_|_0: } | { \__bool_get_next:NN \use_i:nnnn }
\cs_new:cpn { __bool_|_1: } | { \__bool_get_next:NN \use_iii:nnnn }
\cs_new:cpn { __bool_|_2: } | { \__bool_get_next:NN \use_iii:nnnn }
\cs_new:Npn \bool_lazy_all_p:n #1
  { \__bool_lazy_all:n #1 \q__bool_recursion_tail \q__bool_recursion_stop }
\prg_new_conditional:Npnn \bool_lazy_all:n #1 { T , F , TF }
  {
    \if_predicate:w \bool_lazy_all_p:n {#1}
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__bool_lazy_all:n #1
  {
    \__bool_if_recursion_tail_stop_do:nn {#1} { \c_true_bool }
    \bool_if:nF {#1}
      { \__bool_use_i_delimit_by_q_recursion_stop:nw { \c_false_bool } }
    \__bool_lazy_all:n
  }
\prg_new_conditional:Npnn \bool_lazy_and:nn #1#2 { p , T , F , TF }
  {
    \if_predicate:w
        \bool_if:nTF {#1} { \bool_if_p:n {#2} } { \c_false_bool }
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \bool_lazy_any_p:n #1
  { \__bool_lazy_any:n #1 \q__bool_recursion_tail \q__bool_recursion_stop }
\prg_new_conditional:Npnn \bool_lazy_any:n #1 { T , F , TF }
  {
    \if_predicate:w \bool_lazy_any_p:n {#1}
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__bool_lazy_any:n #1
  {
    \__bool_if_recursion_tail_stop_do:nn {#1} { \c_false_bool }
    \bool_if:nT {#1}
      { \__bool_use_i_delimit_by_q_recursion_stop:nw { \c_true_bool } }
    \__bool_lazy_any:n
  }
\prg_new_conditional:Npnn \bool_lazy_or:nn #1#2 { p , T , F , TF }
  {
    \if_predicate:w
        \bool_if:nTF {#1} { \c_true_bool } { \bool_if_p:n {#2} }
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \bool_not_p:n #1 { \bool_if_p:n { ! ( #1 ) } }
\prg_new_conditional:Npnn \bool_xor:nn #1#2 { p , T , F , TF }
  {
    \bool_if:nT {#1} \reverse_if:N
    \if_predicate:w \bool_if_p:n {#2}
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \bool_while_do:Nn #1#2
  { \bool_if:NT #1 { #2 \bool_while_do:Nn #1 {#2} } }
\cs_new:Npn \bool_until_do:Nn #1#2
  { \bool_if:NF #1 { #2 \bool_until_do:Nn #1 {#2} } }
\cs_generate_variant:Nn \bool_while_do:Nn { c }
\cs_generate_variant:Nn \bool_until_do:Nn { c }
\cs_new:Npn \bool_do_while:Nn #1#2
  { #2 \bool_if:NT #1 { \bool_do_while:Nn #1 {#2} } }
\cs_new:Npn \bool_do_until:Nn #1#2
  { #2 \bool_if:NF #1 { \bool_do_until:Nn #1 {#2} } }
\cs_generate_variant:Nn \bool_do_while:Nn { c }
\cs_generate_variant:Nn \bool_do_until:Nn { c }
\cs_new:Npn \bool_while_do:nn #1#2
  {
    \bool_if:nT {#1}
      {
        #2
        \bool_while_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \bool_do_while:nn #1#2
  {
    #2
    \bool_if:nT {#1} { \bool_do_while:nn {#1} {#2} }
  }
\cs_new:Npn \bool_until_do:nn #1#2
  {
    \bool_if:nF {#1}
      {
        #2
        \bool_until_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \bool_do_until:nn #1#2
  {
    #2
    \bool_if:nF {#1} { \bool_do_until:nn {#1} {#2}  }
  }
\cs_new:Npn \prg_replicate:nn #1
  {
    \exp:w
      \exp_after:wN \__prg_replicate_first:N
      \int_value:w \int_eval:n {#1}
      \cs_end:
  }
\cs_new:Npn \__prg_replicate:N #1
  { \cs:w __prg_replicate_#1 :n \__prg_replicate:N }
\cs_new:Npn \__prg_replicate_first:N #1
  { \cs:w __prg_replicate_first_ #1 :n \__prg_replicate:N }
\cs_new:Npn \__prg_replicate_ :n #1 { \cs_end: }
\cs_new:cpn { __prg_replicate_0:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} }
\cs_new:cpn { __prg_replicate_1:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1 }
\cs_new:cpn { __prg_replicate_2:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1 }
\cs_new:cpn { __prg_replicate_3:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1 }
\cs_new:cpn { __prg_replicate_4:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1 }
\cs_new:cpn { __prg_replicate_5:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_6:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_7:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_8:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_9:n } #1
  { \cs_end: {#1#1#1#1#1#1#1#1#1#1} #1#1#1#1#1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_first_-:n } #1
  {
    \exp_end:
    \__kernel_msg_expandable_error:nn { kernel } { negative-replication }
  }
\cs_new:cpn { __prg_replicate_first_0:n } #1 { \exp_end: }
\cs_new:cpn { __prg_replicate_first_1:n } #1 { \exp_end: #1 }
\cs_new:cpn { __prg_replicate_first_2:n } #1 { \exp_end: #1#1 }
\cs_new:cpn { __prg_replicate_first_3:n } #1 { \exp_end: #1#1#1 }
\cs_new:cpn { __prg_replicate_first_4:n } #1 { \exp_end: #1#1#1#1 }
\cs_new:cpn { __prg_replicate_first_5:n } #1 { \exp_end: #1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_first_6:n } #1 { \exp_end: #1#1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_first_7:n } #1 { \exp_end: #1#1#1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_first_8:n } #1 { \exp_end: #1#1#1#1#1#1#1#1 }
\cs_new:cpn { __prg_replicate_first_9:n } #1
  { \exp_end: #1#1#1#1#1#1#1#1#1 }
\prg_new_conditional:Npnn \mode_if_vertical: { p , T , F , TF }
  { \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi: }
\prg_new_conditional:Npnn \mode_if_horizontal: { p , T , F , TF }
  { \if_mode_horizontal: \prg_return_true: \else: \prg_return_false: \fi: }
\prg_new_conditional:Npnn \mode_if_inner: { p , T , F , TF }
  { \if_mode_inner: \prg_return_true: \else: \prg_return_false: \fi: }
\prg_new_conditional:Npnn \mode_if_math: { p , T , F , TF }
  { \if_mode_math: \prg_return_true: \else: \prg_return_false: \fi: }
\cs_new:Npn \group_align_safe_begin:
  { \if_int_compare:w \if_false: { \fi: `} = \c_zero_int \fi: }
\cs_new:Npn \group_align_safe_end:
  { \if_int_compare:w `{ = \c_zero_int } \fi: }
\int_new:N \g__kernel_prg_map_int
%% File: l3sys.dtx
\cs_new_protected:Npn \__sys_const:nn #1#2
  {
    \bool_if:nTF {#2}
      {
        \cs_new_eq:cN { #1 :T }  \use:n
        \cs_new_eq:cN { #1 :F }  \use_none:n
        \cs_new_eq:cN { #1 :TF } \use_i:nn
        \cs_new_eq:cN { #1 _p: } \c_true_bool
      }
      {
        \cs_new_eq:cN { #1 :T }  \use_none:n
        \cs_new_eq:cN { #1 :F }  \use:n
        \cs_new_eq:cN { #1 :TF } \use_ii:nn
        \cs_new_eq:cN { #1 _p: } \c_false_bool
      }
  }
\str_const:Nx \c_sys_engine_str
  {
    \cs_if_exist:NT \tex_luatexversion:D { luatex }
    \cs_if_exist:NT \tex_pdftexversion:D { pdftex }
    \cs_if_exist:NT \tex_kanjiskip:D
      {
        \cs_if_exist:NTF \tex_enablecjktoken:D
          { uptex }
          { ptex }
      }
    \cs_if_exist:NT \tex_XeTeXversion:D { xetex }
  }
\tl_map_inline:nn { { luatex } { pdftex } { ptex } { uptex } { xetex } }
  {
    \__sys_const:nn { sys_if_engine_ #1 }
      { \str_if_eq_p:Vn \c_sys_engine_str {#1} }
  }
\group_begin:
  \cs_set_eq:NN \lua_now:e    \tex_directlua:D
  \str_const:Nx \c_sys_engine_exec_str
    {
      \sys_if_engine_pdftex:T { pdf }
      \sys_if_engine_xetex:T  { xe  }
      \sys_if_engine_ptex:T   { ep  }
      \sys_if_engine_uptex:T  { eup }
      \sys_if_engine_luatex:T
        {
          lua \lua_now:e
            {
              if (pcall(require, 'luaharfbuzz')) then ~
                tex.print("hb") ~
              end
            }
        }
      tex
    }
\group_end:
\str_const:Nx \c_sys_engine_format_str
  {
    \cs_if_exist:NTF \fmtname
      {
        \bool_lazy_or:nnTF
          { \str_if_eq_p:Vn \fmtname { plain } }
          { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
          {
            \sys_if_engine_pdftex:T
              { \int_compare:nNnT { \tex_pdfoutput:D } = { 1 } { pdf } }
            \sys_if_engine_xetex:T  { xe }
            \sys_if_engine_ptex:T   { p  }
            \sys_if_engine_uptex:T  { up }
            \sys_if_engine_luatex:T
              {
                \int_compare:nNnT { \tex_pdfoutput:D } = { 0 } { dvi }
                lua
              }
            \str_if_eq:VnTF \fmtname { LaTeX2e }
              { latex }
              {
                \bool_lazy_and:nnT
                  { \sys_if_engine_pdftex_p: }
                  { \int_compare_p:nNn { \tex_pdfoutput:D } = { 0 } }
                    { e }
                tex
              }
          }
          { \fmtname }
      }
      { unknown }
  }
\__sys_const:nn { sys_if_rand_exist }
  { \cs_if_exist_p:N \tex_uniformdeviate:D }
\cs_new_protected:Npn \sys_load_backend:n #1
  {
    \sys_finalise:
    \str_if_exist:NTF \c_sys_backend_str
      {
        \str_if_eq:VnF \c_sys_backend_str {#1}
          { \__kernel_msg_error:nn { sys } { backend-set } }
      }
      {
        \tl_if_blank:nF {#1}
          { \tl_set:Nn \g__sys_backend_tl {#1} }
        \__sys_load_backend_check:N \g__sys_backend_tl
        \str_const:Nx \c_sys_backend_str { \g__sys_backend_tl }
        \__kernel_sys_configuration_load:n
          { l3backend- \c_sys_backend_str }
      }
  }
\cs_new_protected:Npn \__sys_load_backend_check:N #1
  {
    \sys_if_engine_xetex:TF
      {
        \str_case:VnF #1
          {
            { dvisvgm }   { }
            { xdvipdfmx } { \tl_gset:Nn #1 { xetex } }
            { xetex }     { }
          }
          {
            \__kernel_msg_error:nnxx { sys } { wrong-backend }
              #1 { xetex }
            \tl_gset:Nn #1 { xetex }
          }
      }
      {
        \sys_if_output_pdf:TF
          {
            \str_if_eq:VnTF #1 { pdfmode }
              {
                \sys_if_engine_luatex:TF
                  { \tl_gset:Nn #1 { luatex } }
                  { \tl_gset:Nn #1 { pdftex } }
              }
              {
                \bool_lazy_or:nnF
                  { \str_if_eq_p:Vn #1 { luatex } }
                  { \str_if_eq_p:Vn #1 { pdftex } }
                  {
                    \__kernel_msg_error:nnxx { sys } { wrong-backend }
                      #1 { \sys_if_engine_luatex:TF { luatex } { pdftex } }
                    \sys_if_engine_luatex:TF
                      { \tl_gset:Nn #1 { luatex } }
                      { \tl_gset:Nn #1 { pdftex } }
                  }
              }
          }
          {
            \str_case:VnF #1
              {
                { dvipdfmx } { }
                { dvips }    { }
                { dvisvgm }  { }
              }
              {
                \__kernel_msg_error:nnxx { sys } { wrong-backend }
                  #1 { dvips }
                \tl_gset:Nn #1 { dvips }
              }
          }
      }
  }
\bool_new:N \g__sys_debug_bool
\bool_new:N \g__sys_deprecation_bool
\cs_new_protected:Npn \sys_load_debug:
  {
    \bool_if:NF \g__sys_debug_bool
      { \__kernel_sys_configuration_load:n { l3debug } }
    \bool_gset_true:N \g__sys_debug_bool
  }
\cs_new_protected:Npn \sys_load_deprecation:
  {
    \bool_if:NF \g__sys_deprecation_bool
      { \__kernel_sys_configuration_load:n { l3deprecation } }
    \bool_gset_true:N \g__sys_deprecation_bool
  }
\tl_new:N \l__sys_internal_tl
\tl_const:Nx \c__sys_marker_tl { : \token_to_str:N : }
\cs_new_protected:Npn \sys_get_shell:nnN #1#2#3
  {
    \sys_get_shell:nnNF {#1} {#2} #3
      { \tl_set:Nn #3 { \q_no_value } }
  }
\prg_new_protected_conditional:Npnn \sys_get_shell:nnN #1#2#3 { T , F , TF }
  {
    \sys_if_shell:TF
      { \exp_args:No \__sys_get:nnN { \tl_to_str:n {#1} } {#2} #3 }
      { \prg_return_false: }
  }
\cs_new_protected:Npn \__sys_get:nnN #1#2#3
  {
    \tl_if_in:nnTF {#1} { " }
      {
        \__kernel_msg_error:nnx
          { kernel } { quote-in-shell } {#1}
        \prg_return_false:
      }
      {
        \group_begin:
          \if_false: { \fi:
          \int_set_eq:NN \tex_tracingnesting:D \c_zero_int
          \exp_args:No \tex_everyeof:D { \c__sys_marker_tl }
          #2 \scan_stop:
          \exp_after:wN \__sys_get_do:Nw
          \exp_after:wN #3
          \exp_after:wN \prg_do_nothing:
            \tex_input:D | "#1" \scan_stop:
        \if_false: } \fi:
        \prg_return_true:
      }
  }
\exp_args:Nno \use:nn
  { \cs_new_protected:Npn \__sys_get_do:Nw #1#2 }
  { \c__sys_marker_tl }
  {
    \group_end:
    \tl_set:No #1 {#2}
  }
\sys_if_engine_luatex:F
  { \int_const:Nn \c__sys_shell_stream_int { 18 } }
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Npn \sys_shell_now:n #1
      { \__sys_shell_now:e { \exp_not:n {#1} } }
  }
  {
    \cs_new_protected:Npn \sys_shell_now:n #1
      { \iow_now:Nn \c__sys_shell_stream_int {#1} }
  }
\cs_generate_variant:Nn \sys_shell_now:n { x }
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Npn \sys_shell_shipout:n #1
    { \__sys_shell_shipout:e { \exp_not:n {#1} } }
  }
  {
    \cs_new_protected:Npn \sys_shell_shipout:n #1
      { \iow_shipout:Nn \c__sys_shell_stream_int {#1} }
  }
\cs_generate_variant:Nn \sys_shell_shipout:n { x }
\cs_new_protected:Npn \sys_everyjob:
  {
    \tl_use:N \g__sys_everyjob_tl
    \tl_gclear:N \g__sys_everyjob_tl
  }
\cs_new_protected:Npn \__sys_everyjob:n #1
  { \tl_gput_right:Nn \g__sys_everyjob_tl {#1} }
\tl_new:N \g__sys_everyjob_tl
\__sys_everyjob:n
  { \cs_new_eq:NN \c_sys_jobname_str \tex_jobname:D }
\__sys_everyjob:n
  {
    \group_begin:
      \cs_set:Npn \__sys_tmp:w #1
        {
          \str_if_eq:eeTF { \cs_meaning:N #1 } { \token_to_str:N #1 }
            { #1 }
            {
              \cs_if_exist:NTF \tex_primitive:D
                {
                  \bool_lazy_and:nnTF
                    { \sys_if_engine_xetex_p: }
                    {
                      \int_compare_p:nNn
                        { \exp_after:wN \use_none:n \tex_XeTeXrevision:D }
                          < { 99999 }
                    }
                    { 0 }
                    { \tex_primitive:D #1 }
                }
                { 0 }
            }
        }
      \int_const:Nn \c_sys_minute_int
        { \int_mod:nn { \__sys_tmp:w \time } { 60 } }
      \int_const:Nn \c_sys_hour_int
        { \int_div_truncate:nn { \__sys_tmp:w \time } { 60 } }
      \int_const:Nn \c_sys_day_int   { \__sys_tmp:w \day }
      \int_const:Nn \c_sys_month_int { \__sys_tmp:w \month }
      \int_const:Nn \c_sys_year_int  { \__sys_tmp:w \year }
    \group_end:
  }
\__sys_everyjob:n
  {
    \sys_if_rand_exist:TF
      { \cs_new:Npn \sys_rand_seed: { \tex_the:D \tex_randomseed:D } }
      {
        \cs_new:Npn \sys_rand_seed:
          {
            \int_value:w
            \__kernel_msg_expandable_error:nnn { kernel } { fp-no-random }
              { \sys_rand_seed: }
            \c_zero_int
          }
      }
  }
\__sys_everyjob:n
  {
    \sys_if_rand_exist:TF
      {
        \cs_new_protected:Npn \sys_gset_rand_seed:n #1
          { \tex_setrandomseed:D \int_eval:n {#1} \exp_stop_f: }
      }
      {
        \cs_new_protected:Npn \sys_gset_rand_seed:n #1
          {
            \__kernel_msg_error:nnn { kernel } { fp-no-random }
              { \sys_gset_rand_seed:n {#1} }
          }
      }
  }
\__sys_everyjob:n
  {
    \int_const:Nn \c_sys_shell_escape_int
      {
        \sys_if_engine_luatex:TF
          {
            \tex_directlua:D
              { tex.sprint(status.shell_escape~or~os.execute()) }
          }
          { \tex_shellescape:D }
      }
  }
\__sys_everyjob:n
  {
    \__sys_const:nn { sys_if_shell }
      { \int_compare_p:nNn \c_sys_shell_escape_int > 0 }
    \__sys_const:nn { sys_if_shell_unrestricted }
      { \int_compare_p:nNn \c_sys_shell_escape_int = 1 }
    \__sys_const:nn { sys_if_shell_restricted }
      { \int_compare_p:nNn \c_sys_shell_escape_int = 2 }
  }
\__sys_everyjob:n
  { \cs_gset_eq:NN \g_file_curr_name_str \tex_jobname:D }
\cs_new_protected:Npn \sys_finalise:
  {
    \sys_everyjob:
    \tl_use:N \g__sys_finalise_tl
    \tl_gclear:N \g__sys_finalise_tl
  }
\cs_new_protected:Npn \__sys_finalise:n #1
  { \tl_gput_right:Nn \g__sys_finalise_tl {#1} }
\tl_new:N \g__sys_finalise_tl
\__sys_finalise:n
  {
    \str_const:Nx \c_sys_output_str
      {
        \int_compare:nNnTF
          { \cs_if_exist_use:NF \tex_pdfoutput:D { 0 } } > { 0 }
          { pdf }
          { dvi }
      }
    \__sys_const:nn { sys_if_output_dvi }
      { \str_if_eq_p:Vn \c_sys_output_str { dvi } }
    \__sys_const:nn { sys_if_output_pdf }
      { \str_if_eq_p:Vn \c_sys_output_str { pdf } }
  }
\tl_new:N \g__sys_backend_tl
\__sys_finalise:n
  {
    \__kernel_tl_gset:Nx \g__sys_backend_tl
      {
        \sys_if_engine_xetex:TF
          { xetex }
          {
             \sys_if_output_pdf:TF
              {
                \sys_if_engine_pdftex:TF
                  { pdftex }
                  { luatex }
              }
              { dvips }
           }
      }
  }
\__sys_finalise:n
  {
    \cs_if_exist:NT \@classoptionslist
      {
        \cs_if_eq:NNF \@classoptionslist \scan_stop:
          {
            \clist_map_inline:Nn \@classoptionslist
              {
                \str_case:nnT {#1}
                  {
                    { dvipdfmx }
                      { \tl_gset:Nn \g__sys_backend_tl { dvipdfmx } }
                    { dvips }
                      { \tl_gset:Nn \g__sys_backend_tl { dvips } }
                    { dvisvgm }
                      { \tl_gset:Nn \g__sys_backend_tl { dvisvgm } }
                    { pdftex }
                      { \tl_gset:Nn \g__sys_backend_tl { pdfmode } }
                    { xetex }
                      { \tl_gset:Nn \g__sys_backend_tl { xdvipdfmx } }
                  }
                  { \clist_remove_all:Nn \@unusedoptionlist {#1} }
              }
          }
      }
  }
%% File: l3clist.dtx
\cs_new_eq:NN \c_empty_clist \c_empty_tl
\tl_new:N \l__clist_internal_clist
\scan_new:N \s__clist_mark
\scan_new:N \s__clist_stop
\cs_new:Npn \__clist_use_none_delimit_by_s_stop:w #1 \s__clist_stop { }
\cs_new:Npn \__clist_use_i_delimit_by_s_stop:nw #1 #2 \s__clist_stop {#1}
\quark_new:N \q__clist_recursion_tail
\quark_new:N \q__clist_recursion_stop
\__kernel_quark_new_test:N \__clist_if_recursion_tail_break:nN
\__kernel_quark_new_test:N \__clist_if_recursion_tail_stop:n
\cs_new_protected:Npn \__clist_tmp:w { }
\cs_new:Npn \__clist_trim_next:w #1 ,
  {
    \tl_if_empty:oTF { \use_none:nn #1 ? }
      { \__clist_trim_next:w \prg_do_nothing: }
      { \tl_trim_spaces_apply:oN {#1} \exp_end: }
  }
\cs_new:Npn \__clist_sanitize:n #1
  {
    \exp_after:wN \__clist_sanitize:Nn \exp_after:wN \c_empty_tl
    \exp:w \__clist_trim_next:w \prg_do_nothing:
    #1 , \q__clist_recursion_tail , \q__clist_recursion_stop
  }
\cs_new:Npn \__clist_sanitize:Nn #1#2
  {
    \__clist_if_recursion_tail_stop:n {#2}
    #1 \__clist_wrap_item:w #2 ,
    \exp_after:wN \__clist_sanitize:Nn \exp_after:wN ,
    \exp:w \__clist_trim_next:w \prg_do_nothing:
  }
\prg_new_conditional:Npnn \__clist_if_wrap:n #1 { TF }
  {
    \tl_if_empty:oTF
      {
        \__clist_if_wrap:w
          \s__clist_mark ? #1 ~ \s__clist_mark ? ~ #1
          \s__clist_mark , ~ \s__clist_mark #1 ,
      }
      {
        \tl_if_head_is_group:nTF { #1 { } }
          {
            \tl_if_empty:nTF {#1}
              { \prg_return_true: }
              {
                \tl_if_empty:oTF { \use_none:n #1}
                  { \prg_return_true: }
                  { \prg_return_false: }
              }
          }
          { \prg_return_false: }
      }
      { \prg_return_true: }
  }
\cs_new:Npn \__clist_if_wrap:w #1 \s__clist_mark ? ~ #2 ~ \s__clist_mark #3 , { }
\cs_new:Npn \__clist_wrap_item:w #1 ,
  { \__clist_if_wrap:nTF {#1} { \exp_not:n { {#1} } } { \exp_not:n {#1} } }
\cs_new_eq:NN \clist_new:N \tl_new:N
\cs_new_eq:NN \clist_new:c \tl_new:c
\cs_new_protected:Npn \clist_const:Nn #1#2
  { \tl_const:Nx #1 { \__clist_sanitize:n {#2} } }
\cs_generate_variant:Nn \clist_const:Nn { c , Nx , cx }
\cs_new_eq:NN \clist_clear:N  \tl_clear:N
\cs_new_eq:NN \clist_clear:c  \tl_clear:c
\cs_new_eq:NN \clist_gclear:N \tl_gclear:N
\cs_new_eq:NN \clist_gclear:c \tl_gclear:c
\cs_new_eq:NN \clist_clear_new:N  \tl_clear_new:N
\cs_new_eq:NN \clist_clear_new:c  \tl_clear_new:c
\cs_new_eq:NN \clist_gclear_new:N \tl_gclear_new:N
\cs_new_eq:NN \clist_gclear_new:c \tl_gclear_new:c
\cs_new_eq:NN \clist_set_eq:NN  \tl_set_eq:NN
\cs_new_eq:NN \clist_set_eq:Nc  \tl_set_eq:Nc
\cs_new_eq:NN \clist_set_eq:cN  \tl_set_eq:cN
\cs_new_eq:NN \clist_set_eq:cc  \tl_set_eq:cc
\cs_new_eq:NN \clist_gset_eq:NN \tl_gset_eq:NN
\cs_new_eq:NN \clist_gset_eq:Nc \tl_gset_eq:Nc
\cs_new_eq:NN \clist_gset_eq:cN \tl_gset_eq:cN
\cs_new_eq:NN \clist_gset_eq:cc \tl_gset_eq:cc
\cs_new_protected:Npn \clist_set_from_seq:NN
  { \__clist_set_from_seq:NNNN \clist_clear:N  \__kernel_tl_set:Nx  }
\cs_new_protected:Npn \clist_gset_from_seq:NN
  { \__clist_set_from_seq:NNNN \clist_gclear:N \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__clist_set_from_seq:NNNN #1#2#3#4
  {
    \seq_if_empty:NTF #4
      { #1 #3 }
      {
        #2 #3
          {
            \exp_after:wN \use_none:n \exp:w \exp_end_continue_f:w
            \seq_map_function:NN #4 \__clist_set_from_seq:n
          }
      }
  }
\cs_new:Npn \__clist_set_from_seq:n #1
  {
    ,
    \__clist_if_wrap:nTF {#1}
      { \exp_not:n { {#1} } }
      { \exp_not:n {#1} }
  }
\cs_generate_variant:Nn \clist_set_from_seq:NN  {     Nc }
\cs_generate_variant:Nn \clist_set_from_seq:NN  { c , cc }
\cs_generate_variant:Nn \clist_gset_from_seq:NN {     Nc }
\cs_generate_variant:Nn \clist_gset_from_seq:NN { c , cc }
\cs_new_protected:Npn \clist_concat:NNN
  { \__clist_concat:NNNN \__kernel_tl_set:Nx }
\cs_new_protected:Npn \clist_gconcat:NNN
  { \__clist_concat:NNNN \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__clist_concat:NNNN #1#2#3#4
  {
    #1 #2
      {
        \exp_not:o #3
        \clist_if_empty:NF #3 { \clist_if_empty:NF #4 { , } }
        \exp_not:o #4
      }
  }
\cs_generate_variant:Nn \clist_concat:NNN  { ccc }
\cs_generate_variant:Nn \clist_gconcat:NNN { ccc }
\prg_new_eq_conditional:NNn \clist_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \clist_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\cs_new_protected:Npn \clist_set:Nn #1#2
  { \__kernel_tl_set:Nx #1 { \__clist_sanitize:n {#2} } }
\cs_new_protected:Npn \clist_gset:Nn #1#2
  { \__kernel_tl_gset:Nx #1 { \__clist_sanitize:n {#2} } }
\cs_generate_variant:Nn \clist_set:Nn  { NV , No , Nx , c , cV , co , cx }
\cs_generate_variant:Nn \clist_gset:Nn { NV , No , Nx , c , cV , co , cx }
\cs_new_protected:Npn \clist_put_left:Nn
  { \__clist_put_left:NNNn \clist_concat:NNN \clist_set:Nn }
\cs_new_protected:Npn \clist_gput_left:Nn
  { \__clist_put_left:NNNn \clist_gconcat:NNN \clist_set:Nn }
\cs_new_protected:Npn \__clist_put_left:NNNn #1#2#3#4
  {
    #2 \l__clist_internal_clist {#4}
    #1 #3 \l__clist_internal_clist #3
  }
\cs_generate_variant:Nn \clist_put_left:Nn  {     NV , No , Nx }
\cs_generate_variant:Nn \clist_put_left:Nn  { c , cV , co , cx }
\cs_generate_variant:Nn \clist_gput_left:Nn {     NV , No , Nx }
\cs_generate_variant:Nn \clist_gput_left:Nn { c , cV , co , cx }
\cs_new_protected:Npn \clist_put_right:Nn
  { \__clist_put_right:NNNn \clist_concat:NNN \clist_set:Nn }
\cs_new_protected:Npn \clist_gput_right:Nn
  { \__clist_put_right:NNNn \clist_gconcat:NNN \clist_set:Nn }
\cs_new_protected:Npn \__clist_put_right:NNNn #1#2#3#4
  {
    #2 \l__clist_internal_clist {#4}
    #1 #3 #3 \l__clist_internal_clist
  }
\cs_generate_variant:Nn \clist_put_right:Nn  {     NV , No , Nx }
\cs_generate_variant:Nn \clist_put_right:Nn  { c , cV , co , cx }
\cs_generate_variant:Nn \clist_gput_right:Nn {     NV , No , Nx }
\cs_generate_variant:Nn \clist_gput_right:Nn { c , cV , co , cx }
\cs_new_protected:Npn \clist_get:NN #1#2
  {
    \if_meaning:w #1 \c_empty_clist
      \tl_set:Nn #2 { \q_no_value }
    \else:
      \exp_after:wN \__clist_get:wN #1 , \s__clist_stop #2
    \fi:
  }
\cs_new_protected:Npn \__clist_get:wN #1 , #2 \s__clist_stop #3
  { \tl_set:Nn #3 {#1} }
\cs_generate_variant:Nn \clist_get:NN { c }
\cs_new_protected:Npn \clist_pop:NN
  { \__clist_pop:NNN \__kernel_tl_set:Nx }
\cs_new_protected:Npn \clist_gpop:NN
  { \__clist_pop:NNN \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__clist_pop:NNN #1#2#3
  {
    \if_meaning:w #2 \c_empty_clist
      \tl_set:Nn #3 { \q_no_value }
    \else:
      \exp_after:wN \__clist_pop:wwNNN #2 , \s__clist_mark \s__clist_stop #1#2#3
    \fi:
  }
\cs_new_protected:Npn \__clist_pop:wwNNN #1 , #2 \s__clist_stop #3#4#5
  {
    \tl_set:Nn #5 {#1}
    #3 #4
      {
        \__clist_pop:wN \prg_do_nothing:
          #2 \exp_not:o
          , \s__clist_mark \use_none:n
        \s__clist_stop
      }
  }
\cs_new:Npn \__clist_pop:wN #1 , \s__clist_mark #2 #3 \s__clist_stop { #2 {#1} }
\cs_generate_variant:Nn \clist_pop:NN  { c }
\cs_generate_variant:Nn \clist_gpop:NN { c }
\prg_new_protected_conditional:Npnn \clist_get:NN #1#2 { T , F , TF }
  {
    \if_meaning:w #1 \c_empty_clist
      \prg_return_false:
    \else:
      \exp_after:wN \__clist_get:wN #1 , \s__clist_stop #2
      \prg_return_true:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \clist_get:NN { c } { T , F , TF }
\prg_new_protected_conditional:Npnn \clist_pop:NN #1#2 { T , F , TF }
  { \__clist_pop_TF:NNN \__kernel_tl_set:Nx #1 #2 }
\prg_new_protected_conditional:Npnn \clist_gpop:NN #1#2 { T , F , TF }
  { \__clist_pop_TF:NNN \__kernel_tl_gset:Nx #1 #2 }
\cs_new_protected:Npn \__clist_pop_TF:NNN #1#2#3
  {
    \if_meaning:w #2 \c_empty_clist
      \prg_return_false:
    \else:
      \exp_after:wN \__clist_pop:wwNNN #2 , \s__clist_mark \s__clist_stop #1#2#3
      \prg_return_true:
    \fi:
  }
\prg_generate_conditional_variant:Nnn \clist_pop:NN { c } { T , F , TF }
\prg_generate_conditional_variant:Nnn \clist_gpop:NN { c } { T , F , TF }
\cs_new_eq:NN \clist_push:Nn  \clist_put_left:Nn
\cs_new_eq:NN \clist_push:NV  \clist_put_left:NV
\cs_new_eq:NN \clist_push:No  \clist_put_left:No
\cs_new_eq:NN \clist_push:Nx  \clist_put_left:Nx
\cs_new_eq:NN \clist_push:cn  \clist_put_left:cn
\cs_new_eq:NN \clist_push:cV  \clist_put_left:cV
\cs_new_eq:NN \clist_push:co  \clist_put_left:co
\cs_new_eq:NN \clist_push:cx  \clist_put_left:cx
\cs_new_eq:NN \clist_gpush:Nn \clist_gput_left:Nn
\cs_new_eq:NN \clist_gpush:NV \clist_gput_left:NV
\cs_new_eq:NN \clist_gpush:No \clist_gput_left:No
\cs_new_eq:NN \clist_gpush:Nx \clist_gput_left:Nx
\cs_new_eq:NN \clist_gpush:cn \clist_gput_left:cn
\cs_new_eq:NN \clist_gpush:cV \clist_gput_left:cV
\cs_new_eq:NN \clist_gpush:co \clist_gput_left:co
\cs_new_eq:NN \clist_gpush:cx \clist_gput_left:cx
\clist_new:N \l__clist_internal_remove_clist
\seq_new:N \l__clist_internal_remove_seq
\cs_new_protected:Npn \clist_remove_duplicates:N
  { \__clist_remove_duplicates:NN \clist_set_eq:NN }
\cs_new_protected:Npn \clist_gremove_duplicates:N
  { \__clist_remove_duplicates:NN \clist_gset_eq:NN }
\cs_new_protected:Npn \__clist_remove_duplicates:NN #1#2
  {
    \clist_clear:N \l__clist_internal_remove_clist
    \clist_map_inline:Nn #2
      {
        \clist_if_in:NnF \l__clist_internal_remove_clist {##1}
          { \clist_put_right:Nn \l__clist_internal_remove_clist {##1} }
      }
    #1 #2 \l__clist_internal_remove_clist
  }
\cs_generate_variant:Nn \clist_remove_duplicates:N  { c }
\cs_generate_variant:Nn \clist_gremove_duplicates:N { c }
\cs_new_protected:Npn \clist_remove_all:Nn
  { \__clist_remove_all:NNNn \clist_set_from_seq:NN \__kernel_tl_set:Nx }
\cs_new_protected:Npn \clist_gremove_all:Nn
  { \__clist_remove_all:NNNn \clist_gset_from_seq:NN \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__clist_remove_all:NNNn #1#2#3#4
  {
    \__clist_if_wrap:nTF {#4}
      {
        \seq_set_from_clist:NN \l__clist_internal_remove_seq #3
        \seq_remove_all:Nn \l__clist_internal_remove_seq {#4}
        #1 #3 \l__clist_internal_remove_seq
      }
      {
        \cs_set:Npn \__clist_tmp:w ##1 , #4 ,
          {
            ##1
            , \s__clist_mark , \__clist_use_none_delimit_by_s_stop:w ,
            \__clist_remove_all:
          }
        #2 #3
          {
            \exp_after:wN \__clist_remove_all:
            #3 , \s__clist_mark , #4 , \s__clist_stop
          }
        \clist_if_empty:NF #3
          {
            #2 #3
              {
                \exp_args:No \exp_not:o
                  { \exp_after:wN \use_none:n #3 }
              }
          }
      }
  }
\cs_new:Npn \__clist_remove_all:
  { \exp_after:wN \__clist_remove_all:w \__clist_tmp:w , }
\cs_new:Npn \__clist_remove_all:w #1 , \s__clist_mark , #2 , { \exp_not:n {#1} }
\cs_generate_variant:Nn \clist_remove_all:Nn  { c }
\cs_generate_variant:Nn \clist_gremove_all:Nn { c }
\cs_new_protected:Npn \clist_reverse:N #1
  { \__kernel_tl_set:Nx #1 { \exp_args:No \clist_reverse:n {#1} } }
\cs_new_protected:Npn \clist_greverse:N #1
  { \__kernel_tl_gset:Nx #1 { \exp_args:No \clist_reverse:n {#1} } }
\cs_generate_variant:Nn \clist_reverse:N { c }
\cs_generate_variant:Nn \clist_greverse:N { c }
\cs_new:Npn \clist_reverse:n #1
  {
    \__clist_reverse:wwNww ? #1 ,
      \s__clist_mark \__clist_reverse:wwNww ! ,
      \s__clist_mark \__clist_reverse_end:ww
      \s__clist_stop ? \s__clist_mark
  }
\cs_new:Npn \__clist_reverse:wwNww
    #1 , #2 \s__clist_mark #3 #4 \s__clist_stop ? #5 \s__clist_mark
  { #3 ? #2 \s__clist_mark #3 #4 \s__clist_stop #1 , #5 \s__clist_mark }
\cs_new:Npn \__clist_reverse_end:ww #1 ! #2 , \s__clist_mark
  { \exp_not:o { \use_none:n #2 } }
\prg_new_eq_conditional:NNn \clist_if_empty:N \tl_if_empty:N
  { p , T , F , TF }
\prg_new_eq_conditional:NNn \clist_if_empty:c \tl_if_empty:c
  { p , T , F , TF }
\prg_new_conditional:Npnn \clist_if_empty:n #1 { p , T , F , TF }
  {
    \__clist_if_empty_n:w ? #1
    , \s__clist_mark \prg_return_false:
    , \s__clist_mark \prg_return_true:
    \s__clist_stop
  }
\cs_new:Npn \__clist_if_empty_n:w #1 ,
  {
    \tl_if_empty:oTF { \use_none:nn #1 ? }
      { \__clist_if_empty_n:w ? }
      { \__clist_if_empty_n:wNw }
  }
\cs_new:Npn \__clist_if_empty_n:wNw #1 \s__clist_mark #2#3 \s__clist_stop {#2}
\prg_new_protected_conditional:Npnn \clist_if_in:Nn #1#2 { T  , F , TF }
  {
    \exp_args:No \__clist_if_in_return:nnN #1 {#2} #1
  }
\prg_new_protected_conditional:Npnn \clist_if_in:nn #1#2 { T  , F , TF }
  {
    \clist_set:Nn \l__clist_internal_clist {#1}
    \exp_args:No \__clist_if_in_return:nnN \l__clist_internal_clist {#2}
      \l__clist_internal_clist
  }
\cs_new_protected:Npn \__clist_if_in_return:nnN #1#2#3
  {
    \__clist_if_wrap:nTF {#2}
      {
        \cs_set:Npx \__clist_tmp:w ##1
          {
            \exp_not:N \tl_if_eq:nnT {##1}
            \exp_not:n
              {
                {#2}
                { \clist_map_break:n { \prg_return_true: \use_none:n } }
              }
          }
        \clist_map_function:NN #3 \__clist_tmp:w
        \prg_return_false:
      }
      {
        \cs_set:Npn \__clist_tmp:w ##1 ,#2, { }
        \tl_if_empty:oTF
          { \__clist_tmp:w ,#1, {} {} ,#2, }
          { \prg_return_false: } { \prg_return_true: }
      }
  }
\prg_generate_conditional_variant:Nnn \clist_if_in:Nn
  { NV , No , c , cV , co } { T , F , TF }
\prg_generate_conditional_variant:Nnn \clist_if_in:nn
  { nV , no } { T , F , TF }
\cs_new:Npn \clist_map_function:NN #1#2
  {
    \clist_if_empty:NF #1
      {
        \exp_last_unbraced:NNo \__clist_map_function:Nw #2 #1
          , \q__clist_recursion_tail ,
        \prg_break_point:Nn \clist_map_break: { }
      }
  }
\cs_new:Npn \__clist_map_function:Nw #1#2 ,
  {
    \__clist_if_recursion_tail_break:nN {#2} \clist_map_break:
    #1 {#2}
    \__clist_map_function:Nw #1
  }
\cs_generate_variant:Nn \clist_map_function:NN { c }
\cs_new:Npn \clist_map_function:nN #1#2
  {
    \exp_after:wN \__clist_map_function_n:Nn \exp_after:wN #2
    \exp:w \__clist_trim_next:w \prg_do_nothing: #1 , \q__clist_recursion_tail ,
    \prg_break_point:Nn \clist_map_break: { }
  }
\cs_new:Npn \__clist_map_function_n:Nn #1 #2
  {
    \__clist_if_recursion_tail_break:nN {#2} \clist_map_break:
    \__clist_map_unbrace:Nw #1 #2,
    \exp_after:wN \__clist_map_function_n:Nn \exp_after:wN #1
    \exp:w \__clist_trim_next:w \prg_do_nothing:
  }
\cs_new:Npn \__clist_map_unbrace:Nw #1 #2, { #1 {#2} }
\cs_new_protected:Npn \clist_map_inline:Nn #1#2
  {
    \clist_if_empty:NF #1
      {
        \int_gincr:N \g__kernel_prg_map_int
        \cs_gset_protected:cpn
          { __clist_map_ \int_use:N \g__kernel_prg_map_int :w } ##1 {#2}
        \exp_last_unbraced:Nco \__clist_map_function:Nw
          { __clist_map_ \int_use:N \g__kernel_prg_map_int :w }
          #1 , \q__clist_recursion_tail ,
        \prg_break_point:Nn \clist_map_break:
          { \int_gdecr:N \g__kernel_prg_map_int }
      }
  }
\cs_new_protected:Npn \clist_map_inline:nn #1
  {
    \clist_set:Nn \l__clist_internal_clist {#1}
    \clist_map_inline:Nn \l__clist_internal_clist
  }
\cs_generate_variant:Nn \clist_map_inline:Nn { c }
\cs_new_protected:Npn \clist_map_variable:NNn #1#2#3
  {
    \clist_if_empty:NF #1
      {
        \exp_args:Nno \use:nn
          { \__clist_map_variable:Nnw #2 {#3} }
          #1
          , \q__clist_recursion_tail , \q__clist_recursion_stop
        \prg_break_point:Nn \clist_map_break: { }
      }
  }
\cs_new_protected:Npn \clist_map_variable:nNn #1
  {
    \clist_set:Nn \l__clist_internal_clist {#1}
    \clist_map_variable:NNn \l__clist_internal_clist
  }
\cs_new_protected:Npn \__clist_map_variable:Nnw #1#2#3,
  {
    \__clist_if_recursion_tail_stop:n {#3}
    \tl_set:Nn #1 {#3}
    \use:n {#2}
    \__clist_map_variable:Nnw #1 {#2}
  }
\cs_generate_variant:Nn \clist_map_variable:NNn { c }
\cs_new:Npn \clist_map_break:
  { \prg_map_break:Nn \clist_map_break: { } }
\cs_new:Npn \clist_map_break:n
  { \prg_map_break:Nn \clist_map_break: }
\cs_new:Npn \clist_count:N #1
  {
    \int_eval:n
      {
        0
        \clist_map_function:NN #1 \__clist_count:n
      }
  }
\cs_generate_variant:Nn \clist_count:N { c }
\cs_new:Npx \clist_count:n #1
  {
    \exp_not:N \int_eval:n
      {
        0
        \exp_not:N \__clist_count:w \c_space_tl
        #1 \exp_not:n { , \q__clist_recursion_tail , \q__clist_recursion_stop }
      }
  }
\cs_new:Npn \__clist_count:n #1 { + 1 }
\cs_new:Npx \__clist_count:w #1 ,
  {
    \exp_not:n { \exp_args:Nf \__clist_if_recursion_tail_stop:n } {#1}
    \exp_not:N \tl_if_blank:nF {#1} { + 1 }
    \exp_not:N \__clist_count:w \c_space_tl
  }
\cs_new:Npn \clist_use:Nnnn #1#2#3#4
  {
    \clist_if_exist:NTF #1
      {
        \int_case:nnF { \clist_count:N #1 }
          {
            { 0 } { }
            { 1 } { \exp_after:wN \__clist_use:wwn #1 , , { } }
            { 2 } { \exp_after:wN \__clist_use:wwn #1 , {#2} }
          }
          {
            \exp_after:wN \__clist_use:nwwwwnwn
            \exp_after:wN { \exp_after:wN } #1 ,
            \s__clist_mark , { \__clist_use:nwwwwnwn {#3} }
            \s__clist_mark , { \__clist_use:nwwn {#4} }
            \s__clist_stop { }
          }
      }
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { bad-variable } {#1}
      }
  }
\cs_generate_variant:Nn \clist_use:Nnnn { c }
\cs_new:Npn \__clist_use:wwn #1 , #2 , #3 { \exp_not:n { #1 #3 #2 } }
\cs_new:Npn \__clist_use:nwwwwnwn
    #1#2 , #3 , #4 , #5 \s__clist_mark , #6#7 \s__clist_stop #8
  { #6 {#3} , {#4} , #5 \s__clist_mark , {#6} #7 \s__clist_stop { #8 #1 #2 } }
\cs_new:Npn \__clist_use:nwwn #1#2 , #3 \s__clist_stop #4
  { \exp_not:n { #4 #1 #2 } }
\cs_new:Npn \clist_use:Nn #1#2
  { \clist_use:Nnnn #1 {#2} {#2} {#2} }
\cs_generate_variant:Nn \clist_use:Nn { c }
\cs_new:Npn \clist_item:Nn #1#2
  {
    \__clist_item:ffoN
      { \clist_count:N #1 }
      { \int_eval:n {#2} }
      #1
      \__clist_item_N_loop:nw
  }
\cs_new:Npn \__clist_item:nnnN #1#2#3#4
  {
    \int_compare:nNnTF {#2} < 0
      {
        \int_compare:nNnTF {#2} < { - #1 }
          { \__clist_use_none_delimit_by_s_stop:w }
          { \exp_args:Nf #4 { \int_eval:n { #2 + 1 + #1 } } }
      }
      {
        \int_compare:nNnTF {#2} > {#1}
          { \__clist_use_none_delimit_by_s_stop:w }
          { #4 {#2} }
      }
    { } , #3 , \s__clist_stop
  }
\cs_generate_variant:Nn \__clist_item:nnnN { ffo, ff }
\cs_new:Npn \__clist_item_N_loop:nw #1 #2,
  {
    \int_compare:nNnTF {#1} = 0
      { \__clist_use_i_delimit_by_s_stop:nw { \exp_not:n {#2} } }
      { \exp_args:Nf \__clist_item_N_loop:nw { \int_eval:n { #1 - 1 } } }
  }
\cs_generate_variant:Nn \clist_item:Nn { c }
\cs_new:Npn \clist_item:nn #1#2
  {
    \__clist_item:ffnN
      { \clist_count:n {#1} }
      { \int_eval:n {#2} }
      {#1}
      \__clist_item_n:nw
  }
\cs_new:Npn \__clist_item_n:nw #1
  { \__clist_item_n_loop:nw {#1} \prg_do_nothing: }
\cs_new:Npn \__clist_item_n_loop:nw #1 #2,
  {
    \exp_args:No \tl_if_blank:nTF {#2}
      { \__clist_item_n_loop:nw {#1} \prg_do_nothing: }
      {
        \int_compare:nNnTF {#1} = 0
          { \exp_args:No \__clist_item_n_end:n {#2} }
          {
            \exp_args:Nf \__clist_item_n_loop:nw
              { \int_eval:n { #1 - 1 } }
              \prg_do_nothing:
          }
      }
  }
\cs_new:Npn \__clist_item_n_end:n #1 #2 \s__clist_stop
  { \tl_trim_spaces_apply:nN {#1} \__clist_item_n_strip:n }
\cs_new:Npn \__clist_item_n_strip:n #1 { \__clist_item_n_strip:w #1 , }
\cs_new:Npn \__clist_item_n_strip:w #1 , { \exp_not:n {#1} }
\cs_new:Npn \clist_rand_item:n #1
  { \exp_args:Nf \__clist_rand_item:nn { \clist_count:n {#1} } {#1} }
\cs_new:Npn \__clist_rand_item:nn #1#2
  {
    \int_compare:nNnF {#1} = 0
      { \clist_item:nn {#2} { \int_rand:nn { 1 } {#1} } }
  }
\cs_new:Npn \clist_rand_item:N #1
  {
    \clist_if_empty:NF #1
      { \clist_item:Nn #1 { \int_rand:nn { 1 } { \clist_count:N #1 } } }
  }
\cs_generate_variant:Nn \clist_rand_item:N { c }
\cs_new_protected:Npn \clist_show:N { \__clist_show:NN \msg_show:nnxxxx }
\cs_generate_variant:Nn \clist_show:N { c }
\cs_new_protected:Npn \clist_log:N { \__clist_show:NN \msg_log:nnxxxx }
\cs_generate_variant:Nn \clist_log:N { c }
\cs_new_protected:Npn \__clist_show:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      {
        #1 { LaTeX/kernel } { show-clist }
          { \token_to_str:N #2 }
          { \clist_map_function:NN #2 \msg_show_item:n }
          { } { }
      }
  }
\cs_new_protected:Npn \clist_show:n { \__clist_show:Nn \msg_show:nnxxxx }
\cs_new_protected:Npn \clist_log:n { \__clist_show:Nn \msg_log:nnxxxx }
\cs_new_protected:Npn \__clist_show:Nn #1#2
  {
    #1 { LaTeX/kernel } { show-clist }
      { } { \clist_map_function:nN {#2} \msg_show_item:n } { } { }
  }
\clist_new:N \l_tmpa_clist
\clist_new:N \l_tmpb_clist
\clist_new:N \g_tmpa_clist
\clist_new:N \g_tmpb_clist
%% File: l3token.dtx
\scan_new:N \s__char_stop
\quark_new:N \q__char_no_value
\__kernel_quark_new_conditional:Nn \__char_quark_if_no_value:N { TF }
\cs_new_protected:Npn \char_set_catcode:nn #1#2
  { \tex_catcode:D \int_eval:n {#1} = \int_eval:n {#2} \exp_stop_f: }
\cs_new:Npn \char_value_catcode:n #1
  { \tex_the:D \tex_catcode:D \int_eval:n {#1} \exp_stop_f: }
\cs_new_protected:Npn \char_show_value_catcode:n #1
  { \exp_args:Nf \tl_show:n { \char_value_catcode:n {#1} } }
\cs_new_protected:Npn \char_set_catcode_escape:N #1
  { \char_set_catcode:nn { `#1 } { 0 } }
\cs_new_protected:Npn \char_set_catcode_group_begin:N #1
  { \char_set_catcode:nn { `#1 } { 1 } }
\cs_new_protected:Npn \char_set_catcode_group_end:N #1
  { \char_set_catcode:nn { `#1 } { 2 } }
\cs_new_protected:Npn \char_set_catcode_math_toggle:N #1
  { \char_set_catcode:nn { `#1 } { 3 } }
\cs_new_protected:Npn \char_set_catcode_alignment:N #1
  { \char_set_catcode:nn { `#1 } { 4 } }
\cs_new_protected:Npn \char_set_catcode_end_line:N #1
  { \char_set_catcode:nn { `#1 } { 5 } }
\cs_new_protected:Npn \char_set_catcode_parameter:N #1
  { \char_set_catcode:nn { `#1 } { 6 } }
\cs_new_protected:Npn \char_set_catcode_math_superscript:N #1
  { \char_set_catcode:nn { `#1 } { 7 } }
\cs_new_protected:Npn \char_set_catcode_math_subscript:N #1
  { \char_set_catcode:nn { `#1 } { 8 } }
\cs_new_protected:Npn \char_set_catcode_ignore:N #1
  { \char_set_catcode:nn { `#1 } { 9 } }
\cs_new_protected:Npn \char_set_catcode_space:N #1
  { \char_set_catcode:nn { `#1 } { 10 } }
\cs_new_protected:Npn \char_set_catcode_letter:N #1
  { \char_set_catcode:nn { `#1 } { 11 } }
\cs_new_protected:Npn \char_set_catcode_other:N #1
  { \char_set_catcode:nn { `#1 } { 12 } }
\cs_new_protected:Npn \char_set_catcode_active:N #1
  { \char_set_catcode:nn { `#1 } { 13 } }
\cs_new_protected:Npn \char_set_catcode_comment:N #1
  { \char_set_catcode:nn { `#1 } { 14 } }
\cs_new_protected:Npn \char_set_catcode_invalid:N #1
  { \char_set_catcode:nn { `#1 } { 15 } }
\cs_new_protected:Npn \char_set_catcode_escape:n #1
  { \char_set_catcode:nn {#1} { 0 } }
\cs_new_protected:Npn \char_set_catcode_group_begin:n #1
  { \char_set_catcode:nn {#1} { 1 } }
\cs_new_protected:Npn \char_set_catcode_group_end:n #1
  { \char_set_catcode:nn {#1} { 2 } }
\cs_new_protected:Npn \char_set_catcode_math_toggle:n #1
  { \char_set_catcode:nn {#1} { 3 } }
\cs_new_protected:Npn \char_set_catcode_alignment:n #1
  { \char_set_catcode:nn {#1} { 4 } }
\cs_new_protected:Npn \char_set_catcode_end_line:n #1
  { \char_set_catcode:nn {#1} { 5 } }
\cs_new_protected:Npn \char_set_catcode_parameter:n #1
  { \char_set_catcode:nn {#1} { 6 } }
\cs_new_protected:Npn \char_set_catcode_math_superscript:n #1
  { \char_set_catcode:nn {#1} { 7 } }
\cs_new_protected:Npn \char_set_catcode_math_subscript:n #1
  { \char_set_catcode:nn {#1} { 8 } }
\cs_new_protected:Npn \char_set_catcode_ignore:n #1
  { \char_set_catcode:nn {#1} { 9 } }
\cs_new_protected:Npn \char_set_catcode_space:n #1
  { \char_set_catcode:nn {#1} { 10 } }
\cs_new_protected:Npn \char_set_catcode_letter:n #1
  { \char_set_catcode:nn {#1} { 11 } }
\cs_new_protected:Npn \char_set_catcode_other:n #1
  { \char_set_catcode:nn {#1} { 12 } }
\cs_new_protected:Npn \char_set_catcode_active:n #1
  { \char_set_catcode:nn {#1} { 13 } }
\cs_new_protected:Npn \char_set_catcode_comment:n #1
  { \char_set_catcode:nn {#1} { 14 } }
\cs_new_protected:Npn \char_set_catcode_invalid:n #1
  { \char_set_catcode:nn {#1} { 15 } }
\cs_new_protected:Npn \char_set_mathcode:nn #1#2
  { \tex_mathcode:D \int_eval:n {#1} = \int_eval:n {#2} \exp_stop_f: }
\cs_new:Npn \char_value_mathcode:n #1
  { \tex_the:D \tex_mathcode:D \int_eval:n {#1} \exp_stop_f: }
\cs_new_protected:Npn \char_show_value_mathcode:n #1
  { \exp_args:Nf \tl_show:n { \char_value_mathcode:n {#1} } }
\cs_new_protected:Npn \char_set_lccode:nn #1#2
  { \tex_lccode:D \int_eval:n {#1} = \int_eval:n {#2} \exp_stop_f: }
\cs_new:Npn \char_value_lccode:n #1
  { \tex_the:D \tex_lccode:D \int_eval:n {#1} \exp_stop_f: }
\cs_new_protected:Npn \char_show_value_lccode:n #1
  { \exp_args:Nf \tl_show:n { \char_value_lccode:n {#1} } }
\cs_new_protected:Npn \char_set_uccode:nn #1#2
  { \tex_uccode:D \int_eval:n {#1} = \int_eval:n {#2} \exp_stop_f: }
\cs_new:Npn \char_value_uccode:n #1
  { \tex_the:D \tex_uccode:D \int_eval:n {#1} \exp_stop_f: }
\cs_new_protected:Npn \char_show_value_uccode:n #1
  { \exp_args:Nf \tl_show:n { \char_value_uccode:n {#1} } }
\cs_new_protected:Npn \char_set_sfcode:nn #1#2
  { \tex_sfcode:D \int_eval:n {#1} = \int_eval:n {#2} \exp_stop_f: }
\cs_new:Npn \char_value_sfcode:n #1
  { \tex_the:D \tex_sfcode:D \int_eval:n {#1} \exp_stop_f: }
\cs_new_protected:Npn \char_show_value_sfcode:n #1
  { \exp_args:Nf \tl_show:n { \char_value_sfcode:n {#1} } }
\seq_new:N \l_char_special_seq
\seq_set_split:Nnn \l_char_special_seq { }
  { \  \" \# \$ \% \& \\ \^ \_ \{ \} \~ }
\seq_new:N \l_char_active_seq
\seq_set_split:Nnn \l_char_active_seq { }
  { \" \$ \& \^ \_ \~ }
\group_begin:
  \char_set_catcode_active:N \^^@
  \cs_set_protected:Npn \__char_tmp:nN #1#2
    {
      \cs_new_protected:cpn { #1 :nN } ##1
        {
          \group_begin:
            \char_set_lccode:nn { `\^^@ } { ##1 }
          \tex_lowercase:D { \group_end: #2 ^^@ }
        }
      \cs_new_protected:cpx { #1 :NN } ##1
        { \exp_not:c { #1 : nN } { `##1 } }
    }
  \__char_tmp:nN { char_set_active_eq }  \cs_set_eq:NN
  \__char_tmp:nN { char_gset_active_eq } \cs_gset_eq:NN
\group_end:
\cs_generate_variant:Nn \char_set_active_eq:NN  { Nc }
\cs_generate_variant:Nn \char_gset_active_eq:NN { Nc }
\cs_generate_variant:Nn \char_set_active_eq:nN  { nc }
\cs_generate_variant:Nn \char_gset_active_eq:nN { nc }
\cs_new_eq:NN \__char_int_to_roman:w \tex_romannumeral:D
\cs_new:Npn \char_generate:nn #1#2
  {
    \exp:w \exp_after:wN \__char_generate_aux:w
      \int_value:w \int_eval:n {#1} \exp_after:wN ;
      \int_value:w \int_eval:n {#2} ;
  }
\cs_new:Npn \__char_generate_aux:w #1 ; #2 ;
  {
    \if_int_compare:w #2 = 10 \exp_stop_f:
      \if_int_compare:w #1 =  0 \exp_stop_f:
        \__kernel_msg_expandable_error:nn { kernel } { char-null-space }
      \else:
        \__kernel_msg_expandable_error:nn { kernel } { char-space }
      \fi:
    \else:
      \if_int_odd:w 0
          \if_int_compare:w #2 < 1  \exp_stop_f: 1 \fi:
          \if_int_compare:w #2 = 5  \exp_stop_f: 1 \fi:
          \if_int_compare:w #2 = 9  \exp_stop_f: 1 \fi:
          \if_int_compare:w #2 > 13 \exp_stop_f: 1 \fi: \exp_stop_f:
        \__kernel_msg_expandable_error:nn { kernel }
          { char-invalid-catcode }
      \else:
        \if_int_odd:w 0
          \if_int_compare:w #1 < 0 \exp_stop_f: 1 \fi:
          \if_int_compare:w #1 > \c_max_char_int 1 \fi: \exp_stop_f:
          \__kernel_msg_expandable_error:nn { kernel }
            { char-out-of-range }
        \else:
          \__char_generate_aux:nnw {#1} {#2}
        \fi:
      \fi:
    \fi:
    \exp_end:
  }
\tl_new:N \l__char_tmp_tl
\group_begin:
  \char_set_catcode_active:N \^^L
  \cs_set:Npn ^^L { }
  \char_set_catcode_other:n { 0 }
  \if_int_odd:w 0
      \sys_if_engine_luatex:T { 1 }
      \sys_if_engine_xetex:T { 1 } \exp_stop_f:
      \cs_new:Npn \__char_generate_aux:nnw #1#2#3 \exp_end:
        {
          #3
          \exp_after:wN \exp_end:
          \tex_Ucharcat:D #1 \exp_stop_f: #2 \exp_stop_f:
        }
      \cs_if_exist:NF \tex_expanded:D
        {
          \cs_new_eq:NN \__char_generate_auxii:nnw \__char_generate_aux:nnw
          \cs_gset:Npn \__char_generate_aux:nnw #1#2#3 \exp_end:
            {
              #3
              \if_int_compare:w #2 = 13 \exp_stop_f:
                \__kernel_msg_expandable_error:nn { kernel } { char-active }
              \else:
                \__char_generate_auxii:nnw {#1} {#2}
              \fi:
              \exp_end:
            }
        }
  \else:
      \tl_set:Nn \l__char_tmp_tl { \exp_not:N \or: }
      \char_set_catcode_group_begin:n { 0 } % {
      \tl_put_right:Nn \l__char_tmp_tl { ^^@ \if_false: } }
      \char_set_catcode_group_end:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { { \fi: \exp_not:N \or: ^^@ } % }
      \__kernel_tl_set:Nx \l__char_tmp_tl { \l__char_tmp_tl }
      \char_set_catcode_math_toggle:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \char_set_catcode_alignment:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \tl_put_right:Nn \l__char_tmp_tl { \or: }
      \char_set_catcode_parameter:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \char_set_catcode_math_superscript:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \char_set_catcode_math_subscript:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \tl_put_right:Nn \l__char_tmp_tl { \or: }
      \char_set_catcode_space:n { 0 }
      \tl_put_right:No \l__char_tmp_tl { \use:n { \or: } ^^@ }
      \char_set_catcode_letter:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \char_set_catcode_other:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \char_set_catcode_active:n { 0 }
      \tl_put_right:Nn \l__char_tmp_tl { \or: ^^@ }
      \cs_set_protected:Npn \__char_tmp:n #1
        {
          \char_set_lccode:nn { 0 } {#1}
          \char_set_lccode:nn { 32 } {#1}
          \exp_args:Nx \tex_lowercase:D
            {
              \tl_const:Nn
                \exp_not:c { c__char_ \__char_int_to_roman:w #1 _tl }
                { \exp_not:o \l__char_tmp_tl }
            }
        }
      \int_step_function:nnN { 0 } { 11 }  \__char_tmp:n
      \group_begin:
        \tl_replace_once:Nnn \l__char_tmp_tl { ^^@ } { \ERROR }
        \__char_tmp:n { 12 }
      \group_end:
      \int_step_function:nnN { 13 } { 255 } \__char_tmp:n
      \cs_new:Npn \__char_generate_aux:nnw #1#2#3 \exp_end:
        {
          #3
          \if_false: { \fi:
          \exp_after:wN \exp_after:wN
          \exp_after:wN \exp_end:
          \exp_after:wN \exp_after:wN
          \if_case:w #2
            \exp_last_unbraced:Nv \exp_stop_f:
              { c__char_ \__char_int_to_roman:w #1 _tl }
          \or: }
          \fi:
        }
  \fi:
\group_end:
\cs_new:Npn \char_to_utfviii_bytes:n #1
  {
    \exp_args:Nf \__char_to_utfviii_bytes_auxi:n
      { \int_eval:n {#1} }
  }
\cs_new:Npn \__char_to_utfviii_bytes_auxi:n #1
  {
    \if_int_compare:w #1 > "80 \exp_stop_f:
      \if_int_compare:w #1 < "800 \exp_stop_f:
        \__char_to_utfviii_bytes_outputi:nw
          { \__char_to_utfviii_bytes_auxii:Nnn C {#1} { 64 } }
        \__char_to_utfviii_bytes_outputii:nw
          { \__char_to_utfviii_bytes_auxiii:n {#1} }
      \else:
        \if_int_compare:w #1 < "10000 \exp_stop_f:
          \__char_to_utfviii_bytes_outputi:nw
            { \__char_to_utfviii_bytes_auxii:Nnn E {#1} { 64 * 64 } }
          \__char_to_utfviii_bytes_outputii:nw
            {
              \__char_to_utfviii_bytes_auxiii:n
                { \int_div_truncate:nn {#1} { 64 } }
            }
          \__char_to_utfviii_bytes_outputiii:nw
            { \__char_to_utfviii_bytes_auxiii:n {#1} }
        \else:
          \__char_to_utfviii_bytes_outputi:nw
            {
              \__char_to_utfviii_bytes_auxii:Nnn F
                 {#1} { 64 * 64 * 64 }
            }
          \__char_to_utfviii_bytes_outputii:nw
            {
              \__char_to_utfviii_bytes_auxiii:n
                { \int_div_truncate:nn {#1} { 64 * 64 } }
            }
          \__char_to_utfviii_bytes_outputiii:nw
            {
              \__char_to_utfviii_bytes_auxiii:n
                { \int_div_truncate:nn {#1} { 64 } }
            }
          \__char_to_utfviii_bytes_outputiv:nw
            { \__char_to_utfviii_bytes_auxiii:n {#1} }
        \fi:
      \fi:
    \else:
      \__char_to_utfviii_bytes_outputi:nw {#1}
    \fi:
    \__char_to_utfviii_bytes_end: { } { } { } { }
  }
\cs_new:Npn \__char_to_utfviii_bytes_auxii:Nnn #1#2#3
  {  "#10 + \int_div_truncate:nn {#2} {#3} }
\cs_new:Npn \__char_to_utfviii_bytes_auxiii:n #1
  { \int_mod:nn {#1} { 64 } + 128 }
\cs_new:Npn \__char_to_utfviii_bytes_outputi:nw
  #1 #2 \__char_to_utfviii_bytes_end: #3
  { \__char_to_utfviii_bytes_output:fnn { \int_eval:n {#1} } { } {#2} }
\cs_new:Npn \__char_to_utfviii_bytes_outputii:nw
  #1 #2 \__char_to_utfviii_bytes_end: #3#4
  { \__char_to_utfviii_bytes_output:fnn { \int_eval:n {#1} } { {#3} } {#2} }
\cs_new:Npn \__char_to_utfviii_bytes_outputiii:nw
  #1 #2 \__char_to_utfviii_bytes_end: #3#4#5
  {
    \__char_to_utfviii_bytes_output:fnn
      { \int_eval:n {#1} } { {#3} {#4} } {#2}
  }
\cs_new:Npn \__char_to_utfviii_bytes_outputiv:nw
  #1 #2 \__char_to_utfviii_bytes_end: #3#4#5#6
  {
    \__char_to_utfviii_bytes_output:fnn
      { \int_eval:n {#1} } { {#3} {#4} {#5} } {#2}
  }
\cs_new:Npn \__char_to_utfviii_bytes_output:nnn #1#2#3
  {
    #3
    \__char_to_utfviii_bytes_end: #2 {#1}
  }
\cs_generate_variant:Nn \__char_to_utfviii_bytes_output:nnn { f }
\cs_new:Npn \__char_to_utfviii_bytes_end: { }
\cs_new:Npn \char_to_nfd:N #1
  {
    \cs_if_exist:cTF { c__char_nfd_ \token_to_str:N #1 _ tl }
      {
        \exp_after:wN \exp_after:wN \exp_after:wN \__char_to_nfd:Nw
          \exp_after:wN \exp_after:wN \exp_after:wN #1
            \cs:w c__char_nfd_ \token_to_str:N #1 _ tl \cs_end:
              \s__char_stop
      }
      { \exp_not:n {#1} }
  }
\cs_set_eq:NN \__char_to_nfd:n \char_to_nfd:N
\cs_new:Npn \__char_to_nfd:Nw #1#2#3 \s__char_stop
  {
    \exp_args:Ne \__char_to_nfd:n
      { \char_generate:nn { `#2 } { \__char_change_case_catcode:N #1 } }
    \tl_if_blank:nF {#3}
      {
        \exp_args:Ne \__char_to_nfd:n
          { \char_generate:nn { `#3 } { \char_value_catcode:n { `#3 } } }
      }
  }
\cs_new:Npn \char_lowercase:N #1
  { \__char_change_case:nNN { lower } \char_value_lccode:n #1 }
\cs_new:Npn \char_uppercase:N #1
  { \__char_change_case:nNN { upper } \char_value_uccode:n #1 }
\cs_new:Npn \char_titlecase:N #1
  {
    \tl_if_exist:cTF { c__char_titlecase_ \token_to_str:N #1 _tl }
      {
        \__char_change_case_multi:vN
          { c__char_titlecase_ \token_to_str:N #1 _tl } #1
      }
      { \char_uppercase:N #1 }
  }
\cs_new:Npn \char_foldcase:N #1
  { \__char_change_case:nNN { fold } \char_value_lccode:n #1 }
\cs_new:Npn \__char_change_case:nNN #1#2#3
  {
    \tl_if_exist:cTF { c__char_ #1 case_ \token_to_str:N #3 _tl }
      {
        \__char_change_case_multi:vN
          { c__char_ #1 case_ \token_to_str:N #3 _tl } #3
      }
      { \exp_args:Nf \__char_change_case:nN { #2 { `#3 } } #3 }
  }
\cs_new:Npn \__char_change_case:nN #1#2
  {
    \int_compare:nNnTF {#1} = 0
      { #2 }
      { \char_generate:nn {#1} { \__char_change_case_catcode:N #2 } }
  }
\cs_new:Npn \__char_change_case_multi:nN #1#2
  { \__char_change_case_multi:NNNNw #2 #1 \q__char_no_value \q__char_no_value \s__char_stop }
\cs_generate_variant:Nn \__char_change_case_multi:nN { v }
\cs_new:Npn \__char_change_case_multi:NNNNw #1#2#3#4#5 \s__char_stop
  {
    \__char_quark_if_no_value:NTF #4
      {
        \__char_quark_if_no_value:NTF #3
          { \__char_change_case:NN #1 #2 }
          { \__char_change_case:NNN #1 #2#3 }
      }
      { \__char_change_case:NNNN #1 #2#3#4 }
  }
\cs_new:Npn \__char_change_case:NNN #1#2#3
  {
    \exp_args:Nnf \use:nn
      { \__char_change_case:NN #1 #2 }
      { \__char_change_case:NN #1 #3 }
  }
\cs_new:Npn \__char_change_case:NNNN #1#2#3#4
  {
    \exp_args:Nnff \use:nnn
      { \__char_change_case:NN #1 #2 }
      { \__char_change_case:NN #1 #3 }
      { \__char_change_case:NN #1 #4 }
  }
\cs_new:Npn \__char_change_case:NN #1#2
  { \char_generate:nn { `#2 } { \__char_change_case_catcode:N #1 } }
\cs_new:Npn \__char_change_case_catcode:N #1
  {
    \if_catcode:w \exp_not:N #1 \c_math_toggle_token
      3
    \else:
      \if_catcode:w \exp_not:N #1 \c_alignment_token
        4
      \else:
        \if_catcode:w \exp_not:N #1 \c_math_superscript_token
          7
        \else:
          \if_catcode:w \exp_not:N #1 \c_math_subscript_token
            8
          \else:
            \if_catcode:w \exp_not:N #1 \c_space_token
              10
            \else:
             \if_catcode:w \exp_not:N #1 \c_catcode_letter_token
               11
             \else:
               \if_catcode:w \exp_not:N #1 \c_catcode_other_token
                 12
               \else:
                 13
               \fi:
             \fi:
            \fi:
          \fi:
        \fi:
      \fi:
    \fi:
  }
\cs_new:Npn \char_str_lowercase:N #1
  { \__char_str_change_case:nNN { lower } \char_value_lccode:n #1 }
\cs_new:Npn \char_str_uppercase:N #1
  { \__char_str_change_case:nNN { upper } \char_value_uccode:n #1 }
\cs_new:Npn \char_str_titlecase:N #1
  {
    \tl_if_exist:cTF { c__char_titlecase_ \token_to_str:N #1 _tl }
      { \tl_to_str:c { c__char_titlecase_ \token_to_str:N #1 _tl } }
      { \char_str_uppercase:N #1 }
  }
\cs_new:Npn \char_str_foldcase:N #1
  { \__char_str_change_case:nNN { fold } \char_value_lccode:n #1 }
\cs_new:Npn \__char_str_change_case:nNN #1#2#3
  {
    \tl_if_exist:cTF { c__char_ #1 case_ \token_to_str:N #3 _tl }
      { \tl_to_str:c { c__char_ #1 case_ \token_to_str:N #3 _tl } }
      { \exp_args:Nf \__char_str_change_case:nN { #2 { `#3 } } #3 }
  }
\cs_new:Npn \__char_str_change_case:nN #1#2
  {
    \int_compare:nNnTF {#1} = 0
      { \tl_to_str:n {#2} }
      { \char_generate:nn {#1} { 12 } }
  }
\bool_lazy_or:nnF
  { \cs_if_exist_p:N \tex_luatexversion:D }
  { \cs_if_exist_p:N \tex_XeTeXversion:D }
  {
    \cs_set:Npn \__char_str_change_case:nN #1#2
      { \tl_to_str:n {#2} }
  }
\tl_const:Nx \c_catcode_other_space_tl { \char_generate:nn { `\  } { 12 } }
\scan_new:N \s__token_mark
\scan_new:N \s__token_stop
\group_begin:
  \__kernel_chk_if_free_cs:N \c_group_begin_token
  \tex_global:D \tex_let:D \c_group_begin_token {
  \__kernel_chk_if_free_cs:N \c_group_end_token
  \tex_global:D \tex_let:D \c_group_end_token }
  \char_set_catcode_math_toggle:N \*
  \cs_new_eq:NN \c_math_toggle_token *
  \char_set_catcode_alignment:N \*
  \cs_new_eq:NN \c_alignment_token *
  \cs_new_eq:NN \c_parameter_token #
  \cs_new_eq:NN \c_math_superscript_token ^
  \char_set_catcode_math_subscript:N \*
  \cs_new_eq:NN \c_math_subscript_token *
  \__kernel_chk_if_free_cs:N \c_space_token
  \use:n { \tex_global:D \tex_let:D \c_space_token = ~ } ~
  \cs_new_eq:NN \c_catcode_letter_token a
  \cs_new_eq:NN \c_catcode_other_token 1
\group_end:
\group_begin:
  \char_set_catcode_active:N \*
  \tl_const:Nn \c_catcode_active_tl { \exp_not:N * }
\group_end:
\prg_new_conditional:Npnn \token_if_group_begin:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_group_begin_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_group_end:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_group_end_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_math_toggle:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_math_toggle_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_alignment:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_alignment_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\group_begin:
\cs_set_eq:NN \c_parameter_token \scan_stop:
\prg_new_conditional:Npnn \token_if_parameter:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_parameter_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\group_end:
\prg_new_conditional:Npnn \token_if_math_superscript:N #1
  { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_math_superscript_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_math_subscript:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_math_subscript_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_space:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_space_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_letter:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_catcode_letter_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_other:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_catcode_other_token
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_active:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \c_catcode_active_tl
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_eq_meaning:NN #1#2 { p , T ,  F , TF }
  {
    \if_meaning:w  #1  #2
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_eq_catcode:NN #1#2 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \exp_not:N #2
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_eq_charcode:NN #1#2 { p , T ,  F , TF }
  {
    \if_charcode:w \exp_not:N #1 \exp_not:N #2
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\use:x
  {
    \prg_new_conditional:Npnn \exp_not:N \token_if_macro:N ##1
      { p , T ,  F , TF }
      {
        \exp_not:N \exp_after:wN \exp_not:N \__token_if_macro_p:w
        \exp_not:N \token_to_meaning:N ##1 \tl_to_str:n { ma : }
          \s__token_stop
      }
    \cs_new:Npn \exp_not:N  \__token_if_macro_p:w
      ##1 \tl_to_str:n { ma } ##2 \c_colon_str ##3 \s__token_stop
  }
      {
        \str_if_eq:nnTF { #2 } { cro }
          { \prg_return_true: }
          { \prg_return_false: }
      }
\prg_new_conditional:Npnn \token_if_cs:N #1 { p , T ,  F , TF }
  {
    \if_catcode:w \exp_not:N #1 \scan_stop:
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \token_if_expandable:N #1 { p , T ,  F , TF }
  {
    \exp_after:wN \if_meaning:w \exp_not:N #1 #1
      \prg_return_false:
    \else:
      \if_cs_exist:N #1
        \prg_return_true:
      \else:
        \prg_return_false:
      \fi:
    \fi:
  }
\group_begin:
\cs_set_protected:Npn \__token_tmp:w #1
  {
    \use:x
      {
        \cs_new:Npn \exp_not:c { __token_delimit_by_ #1 :w }
            ####1 \tl_to_str:n {#1} ####2 \s__token_stop
          { ####1 \tl_to_str:n {#1} }
      }
  }
\__token_tmp:w { char" }
\__token_tmp:w { count }
\__token_tmp:w { dimen }
\__token_tmp:w { ~ font }
\__token_tmp:w { macro }
\__token_tmp:w { muskip }
\__token_tmp:w { skip }
\__token_tmp:w { toks }
\group_end:
\group_begin:
\cs_set_protected:Npn \__token_tmp:w #1#2#3
  {
    \use:x
      {
        \prg_new_conditional:Npnn \exp_not:c { token_if_ #1 :N } ####1
          { p , T ,  F , TF }
          {
            \cs_if_exist:cT { tex_ #2 :D }
              {
                \exp_not:N \if_meaning:w ####1 \exp_not:c { tex_ #2 :D }
                \exp_not:N \prg_return_false:
                \exp_not:N \else:
                \exp_not:N \if_meaning:w ####1 \exp_not:c { tex_ #2 def:D }
                \exp_not:N \prg_return_false:
                \exp_not:N \else:
              }
            \exp_not:N \str_if_eq:eeTF
              {
                \exp_not:N \exp_after:wN
                \exp_not:c { __token_delimit_by_ #2 :w }
                \exp_not:N \token_to_meaning:N ####1
                ? \tl_to_str:n {#2} \s__token_stop
              }
              { \exp_not:n {#3} }
              { \exp_not:N \prg_return_true: }
              { \exp_not:N \prg_return_false: }
            \cs_if_exist:cT { tex_ #2 :D }
              {
                \exp_not:N \fi:
                \exp_not:N \fi:
              }
          }
      }
  }
\__token_tmp:w { chardef } { char" } { \token_to_str:N \char" }
\__token_tmp:w { mathchardef } { char" } { \token_to_str:N \mathchar" }
\__token_tmp:w { long_macro } { macro } { \tl_to_str:n { \long } macro }
\__token_tmp:w { protected_macro } { macro }
  { \tl_to_str:n { \protected } macro }
\__token_tmp:w { protected_long_macro } { macro }
  { \token_to_str:N \protected \tl_to_str:n { \long } macro }
\__token_tmp:w { font_selection } { ~ font } { select ~ font }
\__token_tmp:w { dim_register } { dimen } { \token_to_str:N \dimen }
\__token_tmp:w { int_register } { count } { \token_to_str:N \count }
\__token_tmp:w { muskip_register } { muskip } { \token_to_str:N \muskip }
\__token_tmp:w { skip_register } { skip } { \token_to_str:N \skip }
\__token_tmp:w { toks_register } { toks } { \token_to_str:N \toks }
\group_end:
\sys_if_engine_luatex:TF
  {
    \prg_new_conditional:Npnn \token_if_primitive:N #1 { p , T , F , TF }
      {
        \__token_if_primitive_lua:N #1
      }
  }
  {
    \tex_chardef:D \c__token_A_int = `A ~ %
    \use:x
      {
        \prg_new_conditional:Npnn \exp_not:N \token_if_primitive:N ##1
          { p , T , F , TF }
          {
            \exp_not:N \token_if_macro:NTF ##1
              \exp_not:N \prg_return_false:
              {
                \exp_not:N \exp_after:wN \exp_not:N \__token_if_primitive:NNw
                \exp_not:N \token_to_meaning:N ##1
                  \tl_to_str:n { : : : } \s__token_stop ##1
              }
          }
        \cs_new:Npn \exp_not:N \__token_if_primitive:NNw
          ##1##2 ##3 \c_colon_str ##4 \s__token_stop
          {
            \exp_not:N \tl_if_empty:oTF
              { \exp_not:N \__token_if_primitive_space:w ##3 ~ }
              {
                \exp_not:N \__token_if_primitive_loop:N ##3
                  \c_colon_str \s__token_stop
              }
              { \exp_not:N \__token_if_primitive_nullfont:N }
          }
      }
    \cs_new:Npn \__token_if_primitive_space:w #1 ~ { }
    \cs_new:Npn \__token_if_primitive_nullfont:N #1
      {
        \if_meaning:w \tex_nullfont:D #1
          \prg_return_true:
        \else:
          \prg_return_false:
        \fi:
      }
    \cs_new:Npn \__token_if_primitive_loop:N #1
      {
        \if_int_compare:w `#1 < \c__token_A_int %
          \exp_after:wN \__token_if_primitive:Nw
          \exp_after:wN #1
        \else:
          \exp_after:wN \__token_if_primitive_loop:N
        \fi:
      }
    \cs_new:Npn \__token_if_primitive:Nw #1 #2 \s__token_stop
      {
        \if:w : #1
          \exp_after:wN \__token_if_primitive_undefined:N
        \else:
          \prg_return_false:
          \exp_after:wN \use_none:n
        \fi:
      }
    \cs_new:Npn \__token_if_primitive_undefined:N #1
      {
        \if_cs_exist:N #1
          \prg_return_true:
        \else:
          \prg_return_false:
        \fi:
      }
  }
\cs_new:Npn \token_case_catcode:Nn #1#2
  { \exp:w \__token_case:NNnTF \token_if_eq_catcode:NNTF #1 {#2} { } { } }
\cs_new:Npn \token_case_catcode:NnT #1#2#3
  { \exp:w \__token_case:NNnTF \token_if_eq_catcode:NNTF #1 {#2} {#3} { } }
\cs_new:Npn \token_case_catcode:NnF #1#2
  { \exp:w \__token_case:NNnTF \token_if_eq_catcode:NNTF #1 {#2} { } }
\cs_new:Npn \token_case_catcode:NnTF
  { \exp:w \__token_case:NNnTF \token_if_eq_catcode:NNTF }
\cs_new:Npn \token_case_charcode:Nn #1#2
  { \exp:w \__token_case:NNnTF \token_if_eq_charcode:NNTF #1 {#2} { } { } }
\cs_new:Npn \token_case_charcode:NnT #1#2#3
  { \exp:w \__token_case:NNnTF \token_if_eq_charcode:NNTF #1 {#2} {#3} { } }
\cs_new:Npn \token_case_charcode:NnF #1#2
  { \exp:w \__token_case:NNnTF \token_if_eq_charcode:NNTF #1 {#2} { } }
\cs_new:Npn \token_case_charcode:NnTF
  { \exp:w \__token_case:NNnTF \token_if_eq_charcode:NNTF }
\cs_new:Npn \token_case_meaning:Nn #1#2
  { \exp:w \__token_case:NNnTF \token_if_eq_meaning:NNTF #1 {#2} { } { } }
\cs_new:Npn \token_case_meaning:NnT #1#2#3
  { \exp:w \__token_case:NNnTF \token_if_eq_meaning:NNTF #1 {#2} {#3} { } }
\cs_new:Npn \token_case_meaning:NnF #1#2
  { \exp:w \__token_case:NNnTF \token_if_eq_meaning:NNTF #1 {#2} { } }
\cs_new:Npn \token_case_meaning:NnTF
  { \exp:w \__token_case:NNnTF \token_if_eq_meaning:NNTF }
\cs_new:Npn \__token_case:NNnTF #1#2#3#4#5
  {
    \__token_case:NNw #1 #2 #3 #2 { }
    \s__token_mark {#4}
    \s__token_mark {#5}
    \s__token_stop
  }
\cs_new:Npn \__token_case:NNw #1#2#3#4
  {
    #1 #2 #3
      { \__token_case_end:nw {#4} }
      { \__token_case:NNw #1 #2 }
  }
\cs_new:Npn \__token_case_end:nw #1#2#3 \s__token_mark #4#5 \s__token_stop
  { \exp_end: #1 #4 }
\cs_new_eq:NN \l_peek_token ?
\cs_new_eq:NN \g_peek_token ?
\cs_new_eq:NN \l__peek_search_token ?
\tl_new:N \l__peek_search_tl
\cs_new:Npn \__peek_true:w  { }
\cs_new:Npn \__peek_true_aux:w  { }
\cs_new:Npn \__peek_false:w { }
\cs_new:Npn \__peek_tmp:w { }
\scan_new:N \s__peek_mark
\scan_new:N \s__peek_stop
\cs_new:Npn \__peek_use_none_delimit_by_s_stop:w #1 \s__peek_stop { }
\cs_new_protected:Npn \peek_after:Nw
  { \tex_futurelet:D \l_peek_token }
\cs_new_protected:Npn \peek_gafter:Nw
  { \tex_global:D \tex_futurelet:D \g_peek_token }
\cs_new_protected:Npn \__peek_true_remove:w
  {
    \tex_afterassignment:D \__peek_true_aux:w
    \cs_set_eq:NN \__peek_tmp:w
  }
\cs_new_protected:Npn \peek_remove_spaces:n #1
  {
    \cs_set:Npx \__peek_false:w { \exp_not:n {#1} }
    \group_align_safe_begin:
    \cs_set:Npn \__peek_true_aux:w { \peek_after:Nw \__peek_remove_spaces: }
    \__peek_true_aux:w
  }
\cs_new_protected:Npn \__peek_remove_spaces:
  {
    \if_meaning:w \l_peek_token \c_space_token
      \exp_after:wN \__peek_true_remove:w
    \else:
      \group_align_safe_end:
      \exp_after:wN \__peek_false:w
    \fi:
  }
\cs_new_protected:Npn \__peek_token_generic_aux:NNNTF #1#2#3#4#5
  {
    \group_align_safe_begin:
    \cs_set_eq:NN \l__peek_search_token #3
    \tl_set:Nn \l__peek_search_tl {#3}
    \cs_set:Npx \__peek_true_aux:w
      {
        \exp_not:N \group_align_safe_end:
        \exp_not:n {#4}
      }
    \cs_set_eq:NN \__peek_true:w #1
    \cs_set:Npx \__peek_false:w
      {
        \exp_not:N \group_align_safe_end:
        \exp_not:n {#5}
      }
    \peek_after:Nw #2
  }
\cs_new_protected:Npn \__peek_token_generic:NNTF
  { \__peek_token_generic_aux:NNNTF \__peek_true_aux:w }
\cs_new_protected:Npn \__peek_token_generic:NNT #1#2#3
  { \__peek_token_generic:NNTF #1 #2 {#3} { } }
\cs_new_protected:Npn \__peek_token_generic:NNF #1#2#3
  { \__peek_token_generic:NNTF #1 #2 { } {#3} }
\cs_new_protected:Npn \__peek_token_remove_generic:NNTF
  { \__peek_token_generic_aux:NNNTF \__peek_true_remove:w }
\cs_new_protected:Npn \__peek_token_remove_generic:NNT #1#2#3
  { \__peek_token_remove_generic:NNTF #1 #2 {#3} { } }
\cs_new_protected:Npn \__peek_token_remove_generic:NNF #1#2#3
  { \__peek_token_remove_generic:NNTF #1 #2 { } {#3} }
\cs_new:Npn \__peek_execute_branches_meaning:
  {
    \if_meaning:w \l_peek_token \l__peek_search_token
      \exp_after:wN \__peek_true:w
    \else:
      \exp_after:wN \__peek_false:w
    \fi:
  }
\cs_new:Npn \__peek_execute_branches_catcode:
  { \if_catcode:w \__peek_execute_branches_catcode_aux: }
\cs_new:Npn \__peek_execute_branches_charcode:
  { \if_charcode:w \__peek_execute_branches_catcode_aux: }
\cs_new:Npn \__peek_execute_branches_catcode_aux:
  {
        \if_catcode:w \exp_not:N \l_peek_token \scan_stop:
          \exp_after:wN \exp_after:wN
          \exp_after:wN \__peek_execute_branches_catcode_auxii:N
          \exp_after:wN \exp_not:N
        \else:
          \exp_after:wN \__peek_execute_branches_catcode_auxiii:
        \fi:
  }
\cs_new:Npn \__peek_execute_branches_catcode_auxii:N #1
  {
        \exp_not:N #1
        \exp_after:wN \exp_not:N \l__peek_search_tl
      \exp_after:wN \__peek_true:w
    \else:
      \exp_after:wN \__peek_false:w
    \fi:
    #1
  }
\cs_new:Npn \__peek_execute_branches_catcode_auxiii:
  {
        \exp_not:N \l_peek_token
        \exp_after:wN \exp_not:N \l__peek_search_tl
      \exp_after:wN \__peek_true:w
    \else:
      \exp_after:wN \__peek_false:w
    \fi:
  }
\tl_map_inline:nn { { catcode } { charcode } { meaning } }
  {
    \tl_map_inline:nn { { } { _remove } }
      {
        \tl_map_inline:nn { { TF } { T } { F } }
          {
            \cs_new_protected:cpx { peek_ #1 ##1 :N ####1 }
              {
                \exp_not:c { __peek_token ##1 _generic:NN ####1 }
                \exp_not:c { __peek_execute_branches_ #1 : }
              }
          }
      }
  }
\tl_map_inline:nn
  {
    { catcode } { catcode_remove }
    { charcode } { charcode_remove }
    { meaning } { meaning_remove }
  }
  {
    \cs_new_protected:cpx { peek_#1_ignore_spaces:NTF } ##1##2##3
      {
        \peek_remove_spaces:n
          { \exp_not:c { peek_#1:NTF } ##1 {##2} {##3} }
      }
    \cs_new_protected:cpx { peek_#1_ignore_spaces:NT } ##1##2
      {
        \peek_remove_spaces:n
          { \exp_not:c { peek_#1:NT } ##1 {##2} }
      }
    \cs_new_protected:cpx { peek_#1_ignore_spaces:NF } ##1##2
      {
        \peek_remove_spaces:n
          { \exp_not:c { peek_#1:NF } ##1 {##2} }
      }
  }
\group_begin:
  \cs_set_protected:Npn \__peek_tmp:w #1 \s__peek_stop
    {
      \cs_new_protected:Npn \__peek_execute_branches_N_type:
        {
          \if_int_odd:w
              \if_catcode:w \exp_not:N \l_peek_token {   0 \exp_stop_f: \fi:
              \if_catcode:w \exp_not:N \l_peek_token }   0 \exp_stop_f: \fi:
              \if_meaning:w \l_peek_token \c_space_token 0 \exp_stop_f: \fi:
              1 \exp_stop_f:
            \exp_after:wN \__peek_N_type:w
              \token_to_meaning:N \l_peek_token
              \s__peek_mark \__peek_N_type_aux:nnw
              #1 \s__peek_mark \__peek_use_none_delimit_by_s_stop:w
              \s__peek_stop
            \exp_after:wN \__peek_true:w
          \else:
            \exp_after:wN \__peek_false:w
          \fi:
        }
      \cs_new_protected:Npn \__peek_N_type:w ##1 #1 ##2 \s__peek_mark ##3
        { ##3 {##1} {##2} }
    }
  \exp_after:wN \__peek_tmp:w \tl_to_str:n { outer } \s__peek_stop
\group_end:
\cs_new_protected:Npn \__peek_N_type_aux:nnw #1 #2 #3 \fi:
  {
    \fi:
    \tl_if_in:noTF {#1} { \tl_to_str:n {ma} }
      { \__peek_true:w }
      { \tl_if_empty:nTF {#2} { \__peek_true:w } { \__peek_false:w } }
  }
\cs_new_protected:Npn \peek_N_type:TF
  {
    \__peek_token_generic:NNTF
      \__peek_execute_branches_N_type: \scan_stop:
  }
\cs_new_protected:Npn \peek_N_type:T
  { \__peek_token_generic:NNT \__peek_execute_branches_N_type: \scan_stop: }
\cs_new_protected:Npn \peek_N_type:F
  { \__peek_token_generic:NNF \__peek_execute_branches_N_type: \scan_stop: }
%% File: l3prop.dtx
\scan_new:N \s__prop
\cs_new:Npn \__prop_pair:wn #1 \s__prop #2
  { \__kernel_msg_expandable_error:nn { kernel } { misused-prop } }
\tl_new:N \l__prop_internal_tl
\tl_const:Nn \c_empty_prop { \s__prop }
\scan_new:N \s__prop_mark
\scan_new:N \s__prop_stop
\quark_new:N \q__prop_recursion_tail
\quark_new:N \q__prop_recursion_stop
\__kernel_quark_new_test:N \__prop_if_recursion_tail_stop:n
\cs_generate_variant:Nn \__prop_if_recursion_tail_stop:n { o }
\cs_new_protected:Npn \prop_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs_gset_eq:NN #1 \c_empty_prop
  }
\cs_generate_variant:Nn \prop_new:N { c }
\cs_new_protected:Npn \prop_clear:N  #1
  { \prop_set_eq:NN #1 \c_empty_prop }
\cs_generate_variant:Nn \prop_clear:N  { c }
\cs_new_protected:Npn \prop_gclear:N #1
  { \prop_gset_eq:NN #1 \c_empty_prop }
\cs_generate_variant:Nn \prop_gclear:N { c }
\cs_new_protected:Npn \prop_clear_new:N  #1
  { \prop_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } }
\cs_generate_variant:Nn \prop_clear_new:N  { c }
\cs_new_protected:Npn \prop_gclear_new:N #1
  { \prop_if_exist:NTF #1 { \prop_gclear:N #1 } { \prop_new:N #1 } }
\cs_generate_variant:Nn \prop_gclear_new:N { c }
\cs_new_eq:NN \prop_set_eq:NN  \tl_set_eq:NN
\cs_new_eq:NN \prop_set_eq:Nc  \tl_set_eq:Nc
\cs_new_eq:NN \prop_set_eq:cN  \tl_set_eq:cN
\cs_new_eq:NN \prop_set_eq:cc  \tl_set_eq:cc
\cs_new_eq:NN \prop_gset_eq:NN \tl_gset_eq:NN
\cs_new_eq:NN \prop_gset_eq:Nc \tl_gset_eq:Nc
\cs_new_eq:NN \prop_gset_eq:cN \tl_gset_eq:cN
\cs_new_eq:NN \prop_gset_eq:cc \tl_gset_eq:cc
\prop_new:N \l_tmpa_prop
\prop_new:N \l_tmpb_prop
\prop_new:N \g_tmpa_prop
\prop_new:N \g_tmpb_prop
\prop_new:N \l__prop_internal_prop
\cs_new_protected:Npn \prop_set_from_keyval:Nn #1#2
  {
    \prop_clear:N \l__prop_internal_prop
    \__prop_from_keyval:n {#2}
    \prop_set_eq:NN #1 \l__prop_internal_prop
    \prop_clear:N \l__prop_internal_prop
  }
\cs_generate_variant:Nn \prop_set_from_keyval:Nn { c }
\cs_new_protected:Npn \prop_gset_from_keyval:Nn #1#2
  {
    \prop_clear:N \l__prop_internal_prop
    \__prop_from_keyval:n {#2}
    \prop_gset_eq:NN #1 \l__prop_internal_prop
    \prop_clear:N \l__prop_internal_prop
  }
\cs_generate_variant:Nn \prop_gset_from_keyval:Nn { c }
\cs_new_protected:Npn \prop_const_from_keyval:Nn #1#2
  {
    \prop_clear:N \l__prop_internal_prop
    \__prop_from_keyval:n {#2}
    \tl_const:Nx #1 { \exp_not:o \l__prop_internal_prop }
    \prop_clear:N \l__prop_internal_prop
  }
\cs_generate_variant:Nn \prop_const_from_keyval:Nn { c }
\cs_new_protected:Npn \__prop_from_keyval:n #1
  {
    \__prop_from_keyval_loop:w \prg_do_nothing: #1 ,
      \q__prop_recursion_tail , \q__prop_recursion_stop
  }
\cs_new_protected:Npn \__prop_from_keyval_loop:w #1 ,
  {
    \__prop_if_recursion_tail_stop:o {#1}
    \__prop_from_keyval_split:Nw \__prop_from_keyval_key:n
      #1 = = \s__prop_stop {#1}
    \__prop_from_keyval_loop:w \prg_do_nothing:
  }
\cs_new_protected:Npn \__prop_from_keyval_split:Nw #1#2 =
  { \tl_trim_spaces_apply:oN {#2} #1 }
\cs_new_protected:Npn \__prop_from_keyval_key:n #1
  { \__prop_from_keyval_key:w #1 \s__prop_mark }
\cs_new_protected:Npn \__prop_from_keyval_key:w #1 \s__prop_mark #2 \s__prop_stop
  {
    \__prop_from_keyval_split:Nw \__prop_from_keyval_value:n
      \prg_do_nothing: #2 \s__prop_stop {#1}
  }
\cs_new_protected:Npn \__prop_from_keyval_value:n #1
  { \__prop_from_keyval_value:w #1 \s__prop_mark }
\cs_new_protected:Npn \__prop_from_keyval_value:w #1 \s__prop_mark #2 \s__prop_stop #3#4
  {
    \tl_if_empty:nF { #3 #1 #2 }
      {
        \str_if_eq:nnTF {#2} { = }
          { \prop_put:Nnn \l__prop_internal_prop {#3} {#1} }
          {
            \__kernel_msg_error:nnx { kernel } { prop-keyval }
              { \exp_not:o {#4} }
          }
      }
  }
\cs_new_protected:Npn \__prop_split:NnTF #1#2
  { \exp_args:NNo \__prop_split_aux:NnTF #1 { \tl_to_str:n {#2} } }
\cs_new_protected:Npn \__prop_split_aux:NnTF #1#2#3#4
  {
    \cs_set:Npn \__prop_split_aux:w ##1
      \__prop_pair:wn #2 \s__prop ##2 ##3 \s__prop_mark ##4 ##5 \s__prop_stop
      { ##4 {#3} {#4} }
    \exp_after:wN \__prop_split_aux:w #1 \s__prop_mark \use_i:nn
      \__prop_pair:wn #2 \s__prop { } \s__prop_mark \use_ii:nn \s__prop_stop
  }
\cs_new:Npn \__prop_split_aux:w { }
\cs_new_protected:Npn \prop_remove:Nn #1#2
  {
    \__prop_split:NnTF #1 {#2}
      { \tl_set:Nn #1 { ##1 ##3 } }
      { }
  }
\cs_new_protected:Npn \prop_gremove:Nn #1#2
  {
    \__prop_split:NnTF #1 {#2}
      { \tl_gset:Nn #1 { ##1 ##3 } }
      { }
  }
\cs_generate_variant:Nn \prop_remove:Nn  {     NV }
\cs_generate_variant:Nn \prop_remove:Nn  { c , cV }
\cs_generate_variant:Nn \prop_gremove:Nn {     NV }
\cs_generate_variant:Nn \prop_gremove:Nn { c , cV }
\cs_new_protected:Npn \prop_get:NnN #1#2#3
  {
    \__prop_split:NnTF #1 {#2}
      { \tl_set:Nn #3 {##2} }
      { \tl_set:Nn #3 { \q_no_value } }
  }
\cs_generate_variant:Nn \prop_get:NnN {     NV , Nv , No }
\cs_generate_variant:Nn \prop_get:NnN { c , cV , cv , co }
\cs_new_protected:Npn \prop_pop:NnN #1#2#3
  {
    \__prop_split:NnTF #1 {#2}
      {
        \tl_set:Nn #3 {##2}
        \tl_set:Nn #1 { ##1 ##3 }
      }
      { \tl_set:Nn #3 { \q_no_value } }
  }
\cs_new_protected:Npn \prop_gpop:NnN #1#2#3
  {
    \__prop_split:NnTF #1 {#2}
      {
        \tl_set:Nn #3 {##2}
        \tl_gset:Nn #1 { ##1 ##3 }
      }
      { \tl_set:Nn #3 { \q_no_value } }
  }
\cs_generate_variant:Nn \prop_pop:NnN  {     No }
\cs_generate_variant:Nn \prop_pop:NnN  { c , co }
\cs_generate_variant:Nn \prop_gpop:NnN {     No }
\cs_generate_variant:Nn \prop_gpop:NnN { c , co }
\cs_new:Npn \prop_item:Nn #1#2
  {
    \exp_last_unbraced:Noo \__prop_item_Nn:nwwn { \tl_to_str:n {#2} } #1
      \__prop_pair:wn \tl_to_str:n {#2} \s__prop { }
    \prg_break_point:
  }
\cs_new:Npn \__prop_item_Nn:nwwn #1#2 \__prop_pair:wn #3 \s__prop #4
  {
    \str_if_eq:eeTF {#1} {#3}
      { \prg_break:n { \exp_not:n {#4} } }
      { \__prop_item_Nn:nwwn {#1} }
  }
\cs_generate_variant:Nn \prop_item:Nn { c }
\cs_new:Npn \prop_count:N #1
  {
    \int_eval:n
      {
        0
        \prop_map_function:NN #1 \__prop_count:nn
      }
  }
\cs_new:Npn \__prop_count:nn #1#2 { + 1 }
\cs_generate_variant:Nn \prop_count:N { c }
\prg_new_protected_conditional:Npnn \prop_pop:NnN #1#2#3 { T , F , TF }
  {
    \__prop_split:NnTF #1 {#2}
      {
        \tl_set:Nn #3 {##2}
        \tl_set:Nn #1 { ##1 ##3 }
        \prg_return_true:
      }
      { \prg_return_false: }
  }
\prg_new_protected_conditional:Npnn \prop_gpop:NnN #1#2#3 { T , F , TF }
  {
    \__prop_split:NnTF #1 {#2}
      {
        \tl_set:Nn #3 {##2}
        \tl_gset:Nn #1 { ##1 ##3 }
        \prg_return_true:
      }
      { \prg_return_false: }
  }
\prg_generate_conditional_variant:Nnn \prop_pop:NnN { c } { T , F , TF }
\prg_generate_conditional_variant:Nnn \prop_gpop:NnN { c } { T , F , TF }
\cs_new_protected:Npn \prop_put:Nnn  { \__prop_put:NNnn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \prop_gput:Nnn { \__prop_put:NNnn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__prop_put:NNnn #1#2#3#4
  {
    \tl_set:Nn \l__prop_internal_tl
      {
        \exp_not:N \__prop_pair:wn \tl_to_str:n {#3}
        \s__prop { \exp_not:n {#4} }
      }
    \__prop_split:NnTF #2 {#3}
      { #1 #2 { \exp_not:n {##1} \l__prop_internal_tl \exp_not:n {##3} } }
      { #1 #2 { \exp_not:o {#2} \l__prop_internal_tl } }
  }
\cs_generate_variant:Nn \prop_put:Nnn
  {     NnV , Nno , Nnx , NV , NVV , NVx , Nvx , No , Noo , Nxx }
\cs_generate_variant:Nn \prop_put:Nnn
  { c , cnV , cno , cnx , cV , cVV , cVx , cvx , co , coo , cxx }
\cs_generate_variant:Nn \prop_gput:Nnn
  {     NnV , Nno , Nnx , NV , NVV , NVx , Nvx , No , Noo , Nxx }
\cs_generate_variant:Nn \prop_gput:Nnn
  { c , cnV , cno , cnx , cV , cVV , cVx , cvx , co , coo , cxx }
\cs_new_protected:Npn \prop_put_if_new:Nnn
  { \__prop_put_if_new:NNnn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \prop_gput_if_new:Nnn
  { \__prop_put_if_new:NNnn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__prop_put_if_new:NNnn #1#2#3#4
  {
    \tl_set:Nn \l__prop_internal_tl
      {
        \exp_not:N \__prop_pair:wn \tl_to_str:n {#3}
        \s__prop \exp_not:n { {#4} }
      }
    \__prop_split:NnTF #2 {#3}
      { }
      { #1 #2 { \exp_not:o {#2} \l__prop_internal_tl } }
  }
\cs_generate_variant:Nn \prop_put_if_new:Nnn  { c }
\cs_generate_variant:Nn \prop_gput_if_new:Nnn { c }
\prg_new_eq_conditional:NNn \prop_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \prop_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\prg_new_conditional:Npnn \prop_if_empty:N #1 { p , T , F , TF }
  {
    \tl_if_eq:NNTF #1 \c_empty_prop
      \prg_return_true: \prg_return_false:
  }
\prg_generate_conditional_variant:Nnn \prop_if_empty:N
  { c } { p , T , F , TF }
\prg_new_conditional:Npnn \prop_if_in:Nn #1#2 { p , T , F , TF }
  {
    \exp_last_unbraced:Noo \__prop_if_in:nwwn { \tl_to_str:n {#2} } #1
      \__prop_pair:wn \tl_to_str:n {#2} \s__prop { }
      \q__prop_recursion_tail
    \prg_break_point:
  }
\cs_new:Npn \__prop_if_in:nwwn #1#2 \__prop_pair:wn #3 \s__prop #4
  {
    \str_if_eq:eeTF {#1} {#3}
      { \__prop_if_in:N }
      { \__prop_if_in:nwwn {#1} }
  }
\cs_new:Npn \__prop_if_in:N #1
  {
    \if_meaning:w \q__prop_recursion_tail #1
      \prg_return_false:
    \else:
      \prg_return_true:
    \fi:
    \prg_break:
  }
\prg_generate_conditional_variant:Nnn \prop_if_in:Nn
  { NV , No , c , cV , co } { p , T , F , TF }
\prg_new_protected_conditional:Npnn \prop_get:NnN #1#2#3 { T , F , TF }
  {
    \__prop_split:NnTF #1 {#2}
      {
        \tl_set:Nn #3 {##2}
        \prg_return_true:
      }
      { \prg_return_false: }
  }
\prg_generate_conditional_variant:Nnn \prop_get:NnN
  { NV , Nv , No , c , cV , cv , co } { T , F , TF }
\cs_new:Npn \prop_map_function:NN #1#2
  {
    \exp_after:wN \use_i_ii:nnn
    \exp_after:wN \__prop_map_function:Nwwn
    \exp_after:wN #2
    #1
    \prg_break: \__prop_pair:wn \s__prop { } \prg_break_point:
    \prg_break_point:Nn \prop_map_break: { }
  }
\cs_new:Npn \__prop_map_function:Nwwn #1#2 \__prop_pair:wn #3 \s__prop #4
  {
    #2
    #1 {#3} {#4}
    \__prop_map_function:Nwwn #1
  }
\cs_generate_variant:Nn \prop_map_function:NN { Nc , c , cc }
\cs_new_protected:Npn \prop_map_inline:Nn #1#2
  {
    \cs_gset_eq:cN
      { __prop_map_ \int_use:N \g__kernel_prg_map_int :wn } \__prop_pair:wn
    \int_gincr:N \g__kernel_prg_map_int
    \cs_gset_protected:Npn \__prop_pair:wn ##1 \s__prop ##2 {#2}
    #1
    \prg_break_point:Nn \prop_map_break:
      {
        \int_gdecr:N \g__kernel_prg_map_int
        \cs_gset_eq:Nc \__prop_pair:wn
          { __prop_map_ \int_use:N \g__kernel_prg_map_int :wn }
      }
  }
\cs_generate_variant:Nn \prop_map_inline:Nn { c }
\cs_new:Npn \prop_map_tokens:Nn #1#2
  {
    \exp_last_unbraced:Nno
      \use_i:nn { \__prop_map_tokens:nwwn {#2} } #1
      \prg_break: \__prop_pair:wn \s__prop { } \prg_break_point:
    \prg_break_point:Nn \prop_map_break: { }
  }
\cs_new:Npn \__prop_map_tokens:nwwn #1#2 \__prop_pair:wn #3 \s__prop #4
  {
    #2
    \use:n {#1} {#3} {#4}
    \__prop_map_tokens:nwwn {#1}
  }
\cs_generate_variant:Nn \prop_map_tokens:Nn { c }
\cs_new:Npn \prop_map_break:
  { \prg_map_break:Nn \prop_map_break: { } }
\cs_new:Npn \prop_map_break:n
  { \prg_map_break:Nn \prop_map_break: }
\cs_new_protected:Npn \prop_show:N { \__prop_show:NN \msg_show:nnxxxx }
\cs_generate_variant:Nn \prop_show:N { c }
\cs_new_protected:Npn \prop_log:N { \__prop_show:NN \msg_log:nnxxxx }
\cs_generate_variant:Nn \prop_log:N { c }
\cs_new_protected:Npn \__prop_show:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      {
        #1 { LaTeX/kernel } { show-prop }
          { \token_to_str:N #2 }
          { \prop_map_function:NN #2 \msg_show_item:nn }
          { } { }
      }
  }
%% File: l3msg.dtx
\tl_new:N \l__msg_internal_tl
\str_new:N \l__msg_name_str
\str_new:N \l__msg_text_str
\scan_new:N \s__msg_mark
\scan_new:N \s__msg_stop
\cs_new:Npn \__msg_use_none_delimit_by_s_stop:w #1 \s__msg_stop { }
\tl_const:Nn \c__msg_text_prefix_tl      { msg~text~>~ }
\tl_const:Nn \c__msg_more_text_prefix_tl { msg~extra~text~>~ }
\prg_new_conditional:Npnn \msg_if_exist:nn #1#2 { p , T , F , TF }
  {
    \cs_if_exist:cTF { \c__msg_text_prefix_tl #1 / #2 }
      { \prg_return_true: } { \prg_return_false: }
  }
\cs_new_protected:Npn \__msg_chk_free:nn #1#2
  {
    \msg_if_exist:nnT {#1} {#2}
      {
        \__kernel_msg_error:nnxx { kernel } { message-already-defined }
          {#1} {#2}
      }
  }
\cs_new_protected:Npn \msg_new:nnnn #1#2
  {
    \__msg_chk_free:nn {#1} {#2}
    \msg_gset:nnnn {#1} {#2}
  }
\cs_new_protected:Npn \msg_new:nnn #1#2#3
  { \msg_new:nnnn {#1} {#2} {#3} { } }
\cs_new_protected:Npn \msg_set:nnnn #1#2#3#4
  {
    \cs_set:cpn { \c__msg_text_prefix_tl #1 / #2 }
      ##1##2##3##4 {#3}
    \cs_set:cpn { \c__msg_more_text_prefix_tl #1 / #2 }
      ##1##2##3##4 {#4}
  }
\cs_new_protected:Npn \msg_set:nnn #1#2#3
  { \msg_set:nnnn {#1} {#2} {#3} { } }
\cs_new_protected:Npn \msg_gset:nnnn #1#2#3#4
  {
    \cs_gset:cpn { \c__msg_text_prefix_tl #1 / #2 }
      ##1##2##3##4 {#3}
    \cs_gset:cpn { \c__msg_more_text_prefix_tl #1 / #2 }
      ##1##2##3##4 {#4}
  }
\cs_new_protected:Npn \msg_gset:nnn #1#2#3
  { \msg_gset:nnnn {#1} {#2} {#3} { } }
\tl_const:Nn \c__msg_coding_error_text_tl
  {
    This~is~a~coding~error.
    \\ \\
  }
\tl_const:Nn \c__msg_continue_text_tl
  { Type~<return>~to~continue }
\tl_const:Nn \c__msg_critical_text_tl
  { Reading~the~current~file~'\g_file_curr_name_str'~will~stop. }
\tl_const:Nn \c__msg_fatal_text_tl
  { This~is~a~fatal~error:~LaTeX~will~abort. }
\tl_const:Nn \c__msg_help_text_tl
  { For~immediate~help~type~H~<return> }
\tl_const:Nn \c__msg_no_info_text_tl
  {
    LaTeX~does~not~know~anything~more~about~this~error,~sorry.
    \c__msg_return_text_tl
  }
\tl_const:Nn \c__msg_on_line_text_tl { on~line }
\tl_const:Nn \c__msg_return_text_tl
  {
    \\ \\
    Try~typing~<return>~to~proceed.
    \\
    If~that~doesn't~work,~type~X~<return>~to~quit.
  }
\tl_const:Nn \c__msg_trouble_text_tl
  {
    \\ \\
    More~errors~will~almost~certainly~follow: \\
    the~LaTeX~run~should~be~aborted.
  }
\cs_new:Npn \msg_line_number: { \int_use:N \tex_inputlineno:D }
\cs_gset:Npn \msg_line_context:
  {
    \c__msg_on_line_text_tl
    \c_space_tl
    \msg_line_number:
  }
\cs_new_protected:Npn \__msg_interrupt:NnnnN #1#2#3#4#5
  {
    \str_set:Nx \l__msg_text_str { #1 {#2} }
    \str_set:Nx \l__msg_name_str { \msg_module_name:n {#2} }
    \cs_if_eq:cNTF
      { \c__msg_more_text_prefix_tl #2 / #3 }
      \__msg_no_more_text:nnnn
      {
        \__msg_interrupt_wrap:nnn
          { \use:c { \c__msg_text_prefix_tl #2 / #3 } #4 }
          { \c__msg_continue_text_tl }
          {
             \c__msg_no_info_text_tl
             \tl_if_empty:NF #5
               { \\ \\ #5 }
          }
      }
      {
        \__msg_interrupt_wrap:nnn
          { \use:c { \c__msg_text_prefix_tl #2 / #3 } #4 }
          { \c__msg_help_text_tl }
          {
             \use:c { \c__msg_more_text_prefix_tl #2 / #3 } #4
             \tl_if_empty:NF #5
               { \\ \\ #5 }
          }
      }
  }
\cs_new:Npn \__msg_no_more_text:nnnn #1#2#3#4 { }
\cs_new_protected:Npn \__msg_interrupt_wrap:nnn #1#2#3
  {
    \iow_wrap:nnnN { \\ #3 } { } { } \__msg_interrupt_more_text:n
    \group_begin:
      \int_sub:Nn \l_iow_line_count_int { 2 }
      \iow_wrap:nxnN { \l__msg_text_str : ~ #1 }
        {
          ( \l__msg_name_str )
          \prg_replicate:nn
            {
                \str_count:N \l__msg_text_str
              - \str_count:N \l__msg_name_str
              + 2
            }
            { ~ }
        }
        { } \__msg_interrupt_text:n
    \iow_wrap:nnnN { \l__msg_internal_tl \\ \\ #2 } { } { }
      \__msg_interrupt:n
  }
\cs_new_protected:Npn \__msg_interrupt_text:n #1
  {
    \group_end:
    \tl_set:Nn \l__msg_internal_tl {#1}
  }
\cs_new_protected:Npn \__msg_interrupt_more_text:n #1
  { \exp_args:Nx \tex_errhelp:D { #1 \iow_newline: } }
\group_begin:
  \char_set_lccode:nn { 38 } { 32 } % &
  \char_set_lccode:nn { 46 } { 32 } % .
  \char_set_lccode:nn { 123 } { 32 } % {
  \char_set_lccode:nn { 125 } { 32 } % }
  \char_set_catcode_active:N \&
\tex_lowercase:D
  {
    \group_end:
    \cs_new_protected:Npn \__msg_interrupt:n #1
      {
        \iow_term:n { }
        \__kernel_iow_with:Nnn \tex_newlinechar:D { `\^^J }
          {
            \__kernel_iow_with:Nnn \tex_errorcontextlines:D { -1 }
              {
                \group_begin:
                  \cs_set_protected:Npn &
                    {
                      \tex_errmessage:D
                        {
                          #1
                          \use_none:n
                            { ............................................ }
                        }
                    }
                  \exp_after:wN
                \group_end:
                &
              }
          }
      }
  }
\int_gset:Nn \tex_errorcontextlines:D { -1 }
\cs_new:Npn \msg_fatal_text:n #1
  {
    Fatal ~
    \msg_error_text:n {#1}
  }
\cs_new:Npn \msg_critical_text:n #1
  {
    Critical ~
    \msg_error_text:n {#1}
  }
\cs_new:Npn \msg_error_text:n #1
  { \__msg_text:nn {#1} { Error } }
\cs_new:Npn \msg_warning_text:n #1
  { \__msg_text:nn {#1} { Warning } }
\cs_new:Npn \msg_info_text:n #1
  { \__msg_text:nn {#1} { Info } }
\cs_new:Npn \__msg_text:nn #1#2
  {
    \exp_args:Nf \__msg_text:n { \msg_module_type:n {#1} }
    \msg_module_name:n {#1} ~
    #2
  }
\cs_new:Npn \__msg_text:n #1
  {
    \tl_if_blank:nF {#1}
      { #1 ~ }
  }
\prop_new:N \g_msg_module_name_prop
\prop_gput:Nnn \g_msg_module_name_prop { LaTeX } { LaTeX3 }
\prop_new:N \g_msg_module_type_prop
\prop_gput:Nnn \g_msg_module_type_prop { LaTeX } { }
\cs_new:Npn \msg_module_type:n #1
  {
    \prop_if_in:NnTF \g_msg_module_type_prop {#1}
      { \prop_item:Nn \g_msg_module_type_prop {#1} }
      { Package }
  }
\cs_new:Npn \msg_module_name:n #1
  {
    \prop_if_in:NnTF \g_msg_module_name_prop {#1}
      { \prop_item:Nn \g_msg_module_name_prop {#1} }
      {#1}
  }
\cs_new:Npn \msg_see_documentation_text:n #1
  {
    See~the~ \msg_module_name:n {#1} ~
    documentation~for~further~information.
  }
\group_begin:
  \cs_set_protected:Npn \__msg_class_new:nn #1#2
    {
      \prop_new:c { l__msg_redirect_ #1 _prop }
      \cs_new_protected:cpn { __msg_ #1 _code:nnnnnn }
          ##1##2##3##4##5##6 {#2}
      \cs_new_protected:cpn { msg_ #1 :nnnnnn } ##1##2##3##4##5##6
        {
          \use:x
            {
              \exp_not:n { \__msg_use:nnnnnnn {#1} {##1} {##2} }
                { \tl_to_str:n {##3} } { \tl_to_str:n {##4} }
                { \tl_to_str:n {##5} } { \tl_to_str:n {##6} }
            }
        }
      \cs_new_protected:cpx { msg_ #1 :nnnnn } ##1##2##3##4##5
        { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} {##5} { } }
      \cs_new_protected:cpx { msg_ #1 :nnnn } ##1##2##3##4
        { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} {##4} { } { } }
      \cs_new_protected:cpx { msg_ #1 :nnn } ##1##2##3
        { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} {##3} { } { } { } }
      \cs_new_protected:cpx { msg_ #1 :nn } ##1##2
        { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} { } { } { } { } }
      \cs_new_protected:cpx { msg_ #1 :nnxxxx } ##1##2##3##4##5##6
        {
          \use:x
            {
              \exp_not:N \exp_not:n
                { \exp_not:c { msg_ #1 :nnnnnn } {##1} {##2} }
                {##3} {##4} {##5} {##6}
            }
        }
      \cs_new_protected:cpx { msg_ #1 :nnxxx } ##1##2##3##4##5
        { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } }
      \cs_new_protected:cpx { msg_ #1 :nnxx } ##1##2##3##4
        { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } }
      \cs_new_protected:cpx { msg_ #1 :nnx } ##1##2##3
        { \exp_not:c { msg_ #1 :nnxxxx } {##1} {##2} {##3} { } { } { } }
    }
  \__msg_class_new:nn { fatal }
    {
      \__msg_interrupt:NnnnN
        \msg_fatal_text:n {#1} {#2}
        { {#3} {#4} {#5} {#6} }
        \c__msg_fatal_text_tl
      \__msg_fatal_exit:
    }
  \cs_new_protected:Npn \__msg_fatal_exit:
    {
      \tex_batchmode:D
      \tex_read:D -1 to \l__msg_internal_tl
    }
  \__msg_class_new:nn { critical }
    {
      \__msg_interrupt:NnnnN
        \msg_critical_text:n {#1} {#2}
        { {#3} {#4} {#5} {#6} }
        \c__msg_critical_text_tl
      \tex_endinput:D
    }
  \__msg_class_new:nn { error }
    {
      \__msg_interrupt:NnnnN
        \msg_error_text:n {#1} {#2}
        { {#3} {#4} {#5} {#6} }
        \c_empty_tl
    }
  \__msg_class_new:nn { warning }
    {
      \str_set:Nx \l__msg_text_str { \msg_warning_text:n {#1} }
      \str_set:Nx \l__msg_name_str { \msg_module_name:n {#1} }
      \iow_term:n { }
      \iow_wrap:nxnN
        {
          \l__msg_text_str : ~
          \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6}
        }
        {
          ( \l__msg_name_str )
          \prg_replicate:nn
            {
                \str_count:N \l__msg_text_str
              - \str_count:N \l__msg_name_str
            }
            { ~ }
        }
        { } \iow_term:n
      \iow_term:n { }
    }
  \__msg_class_new:nn { info }
    {
      \str_set:Nx \l__msg_text_str { \msg_info_text:n {#1} }
      \str_set:Nx \l__msg_name_str { \msg_module_name:n {#1} }
      \iow_log:n { }
      \iow_wrap:nxnN
        {
          \l__msg_text_str : ~
          \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6}
        }
        {
          ( \l__msg_name_str )
          \prg_replicate:nn
             {
                 \str_count:N \l__msg_text_str
               - \str_count:N \l__msg_name_str
             }
            { ~ }
         }
         { } \iow_log:n
      \iow_log:n { }
    }
  \__msg_class_new:nn { log }
    {
      \iow_wrap:nnnN
        { \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} }
        { } { } \iow_log:n
    }
  \__msg_class_new:nn { term }
    {
      \iow_wrap:nnnN
        { \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} }
        { } { } \iow_term:n
    }
  \__msg_class_new:nn { none } { }
  \__msg_class_new:nn { show }
    {
      \iow_wrap:nnnN
        { \use:c { \c__msg_text_prefix_tl #1 / #2 } {#3} {#4} {#5} {#6} }
        { } { } \__msg_show:n
    }
  \cs_new_protected:Npn \__msg_show:n #1
    {
      \tl_if_in:nnTF { ^^J #1 } { ^^J > ~ }
        {
          \tl_if_in:nnTF { #1 \s__msg_mark } { . \s__msg_mark }
            { \__msg_show_dot:w } { \__msg_show:w }
          ^^J #1 \s__msg_stop
        }
        { \__msg_show:nn { ? #1 } { } }
    }
  \cs_new:Npn \__msg_show_dot:w #1 ^^J > ~ #2 . \s__msg_stop
    { \__msg_show:nn {#1} {#2} }
  \cs_new:Npn \__msg_show:w #1 ^^J > ~ #2 \s__msg_stop
    { \__msg_show:nn {#1} {#2} }
  \cs_new_protected:Npn \__msg_show:nn #1#2
    {
      \tl_if_empty:nF {#1}
        { \exp_args:No \iow_term:n { \use_none:n #1 } }
      \tl_set:Nn \l__msg_internal_tl {#2}
      \__kernel_iow_with:Nnn \tex_newlinechar:D { 10 }
        {
          \__kernel_iow_with:Nnn \tex_errorcontextlines:D { -1 }
            {
              \tex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN
                { \exp_after:wN \l__msg_internal_tl }
            }
        }
    }
\group_end:
\cs_new:Npn \__msg_class_chk_exist:nT #1
  {
    \cs_if_free:cTF { __msg_ #1 _code:nnnnnn }
      { \__kernel_msg_error:nnx { kernel } { message-class-unknown } {#1} }
  }
\tl_new:N \l__msg_class_tl
\tl_new:N \l__msg_current_class_tl
\prop_new:N \l__msg_redirect_prop
\seq_new:N \l__msg_hierarchy_seq
\seq_new:N \l__msg_class_loop_seq
\cs_new_protected:Npn \__msg_use:nnnnnnn #1#2#3#4#5#6#7
  {
    \cs_if_exist_use:N \conditionally@traceoff
    \msg_if_exist:nnTF {#2} {#3}
      {
        \__msg_class_chk_exist:nT {#1}
          {
            \tl_set:Nn \l__msg_current_class_tl {#1}
            \cs_set_protected:Npx \__msg_use_code:
              {
                \exp_not:n
                  {
                    \use:c { __msg_ \l__msg_class_tl _code:nnnnnn }
                      {#2} {#3} {#4} {#5} {#6} {#7}
                  }
              }
            \__msg_use_redirect_name:n { #2 / #3 }
          }
      }
      { \__kernel_msg_error:nnxx { kernel } { message-unknown } {#2} {#3} }
    \cs_if_exist_use:N \conditionally@traceon
  }
\cs_new_protected:Npn \__msg_use_code: { }
\cs_new_protected:Npn \__msg_use_redirect_name:n #1
  {
    \prop_get:NnNTF \l__msg_redirect_prop { / #1 } \l__msg_class_tl
      { \__msg_use_code: }
      {
        \seq_clear:N \l__msg_hierarchy_seq
        \__msg_use_hierarchy:nwwN { }
          #1 \s__msg_mark \__msg_use_hierarchy:nwwN
          /  \s__msg_mark \__msg_use_none_delimit_by_s_stop:w
          \s__msg_stop
        \__msg_use_redirect_module:n { }
      }
  }
\cs_new_protected:Npn \__msg_use_hierarchy:nwwN #1#2 / #3 \s__msg_mark #4
  {
    \seq_put_left:Nn \l__msg_hierarchy_seq {#1}
    #4 { #1 / #2 } #3 \s__msg_mark #4
  }
\cs_new_protected:Npn \__msg_use_redirect_module:n #1
  {
    \seq_map_inline:Nn \l__msg_hierarchy_seq
      {
        \prop_get:cnNTF { l__msg_redirect_ \l__msg_current_class_tl _prop }
          {##1} \l__msg_class_tl
          {
            \seq_map_break:n
              {
                \tl_if_eq:NNTF \l__msg_current_class_tl \l__msg_class_tl
                  { \__msg_use_code: }
                  {
                    \tl_set_eq:NN \l__msg_current_class_tl \l__msg_class_tl
                    \__msg_use_redirect_module:n {##1}
                  }
              }
          }
          {
            \str_if_eq:nnT {##1} {#1}
              {
                \tl_set_eq:NN \l__msg_class_tl \l__msg_current_class_tl
                \seq_map_break:n { \__msg_use_code: }
              }
          }
      }
  }
\cs_new_protected:Npn \msg_redirect_name:nnn #1#2#3
  {
    \tl_if_empty:nTF {#3}
      { \prop_remove:Nn \l__msg_redirect_prop { / #1 / #2 } }
      {
        \__msg_class_chk_exist:nT {#3}
          { \prop_put:Nnn \l__msg_redirect_prop { / #1 / #2 } {#3} }
      }
  }
\cs_new_protected:Npn \msg_redirect_class:nn
  { \__msg_redirect:nnn { } }
\cs_new_protected:Npn \msg_redirect_module:nnn #1
  { \__msg_redirect:nnn { / #1 } }
\cs_new_protected:Npn \__msg_redirect:nnn #1#2#3
  {
    \__msg_class_chk_exist:nT {#2}
      {
        \tl_if_empty:nTF {#3}
          { \prop_remove:cn { l__msg_redirect_ #2 _prop } {#1} }
          {
            \__msg_class_chk_exist:nT {#3}
              {
                \prop_put:cnn { l__msg_redirect_ #2 _prop } {#1} {#3}
                \tl_set:Nn \l__msg_current_class_tl {#2}
                \seq_clear:N \l__msg_class_loop_seq
                \__msg_redirect_loop_chk:nnn {#2} {#3} {#1}
              }
          }
      }
  }
\cs_new_protected:Npn \__msg_redirect_loop_chk:nnn #1#2#3
  {
    \seq_put_right:Nn \l__msg_class_loop_seq {#1}
    \prop_get:cnNT { l__msg_redirect_ #1 _prop } {#3} \l__msg_class_tl
      {
        \str_if_eq:VnF \l__msg_class_tl {#1}
          {
            \tl_if_eq:NNTF \l__msg_class_tl \l__msg_current_class_tl
              {
                \prop_put:cnn { l__msg_redirect_ #2 _prop } {#3} {#2}
                \__kernel_msg_warning:nnxxxx
                  { kernel } { message-redirect-loop }
                  { \seq_item:Nn \l__msg_class_loop_seq { 1 } }
                  { \seq_item:Nn \l__msg_class_loop_seq { 2 } }
                  {#3}
                  {
                    \seq_map_function:NN \l__msg_class_loop_seq
                      \__msg_redirect_loop_list:n
                    { \seq_item:Nn \l__msg_class_loop_seq { 1 } }
                  }
              }
              { \__msg_redirect_loop_chk:onn \l__msg_class_tl {#2} {#3} }
          }
      }
  }
\cs_generate_variant:Nn \__msg_redirect_loop_chk:nnn { o }
\cs_new:Npn \__msg_redirect_loop_list:n #1 { {#1} ~ => ~ }
\cs_new_protected:Npn \__kernel_msg_new:nnnn #1#2
  { \msg_new:nnnn { LaTeX } { #1 / #2 } }
\cs_new_protected:Npn \__kernel_msg_new:nnn #1#2
  { \msg_new:nnn { LaTeX } { #1 / #2 } }
\cs_new_protected:Npn \__kernel_msg_set:nnnn #1#2
  { \msg_set:nnnn { LaTeX } { #1 / #2 } }
\cs_new_protected:Npn \__kernel_msg_set:nnn #1#2
  { \msg_set:nnn { LaTeX } { #1 / #2 } }
\group_begin:
  \cs_set_protected:Npn \__msg_kernel_class_new:nN #1
    { \__msg_kernel_class_new_aux:nN { __kernel_msg_ #1 } }
  \cs_set_protected:Npn \__msg_kernel_class_new_aux:nN #1#2
    {
      \cs_new_protected:cpn { #1 :nnnnnn } ##1##2##3##4##5##6
        {
          \use:x
            {
              \exp_not:n { #2 { LaTeX } { ##1 / ##2 } }
                { \tl_to_str:n {##3} } { \tl_to_str:n {##4} }
                { \tl_to_str:n {##5} } { \tl_to_str:n {##6} }
            }
        }
      \cs_new_protected:cpx { #1 :nnnnn } ##1##2##3##4##5
        { \exp_not:c { #1 :nnnnnn } {##1} {##2} {##3} {##4} {##5} { } }
      \cs_new_protected:cpx { #1 :nnnn } ##1##2##3##4
        { \exp_not:c { #1 :nnnnnn } {##1} {##2} {##3} {##4} { } { } }
      \cs_new_protected:cpx { #1 :nnn } ##1##2##3
        { \exp_not:c { #1 :nnnnnn } {##1} {##2} {##3} { } { } { } }
      \cs_new_protected:cpx { #1 :nn } ##1##2
        { \exp_not:c { #1 :nnnnnn } {##1} {##2} { } { } { } { } }
      \cs_new_protected:cpx { #1 :nnxxxx } ##1##2##3##4##5##6
        {
          \use:x
            {
              \exp_not:N \exp_not:n
                { \exp_not:c { #1 :nnnnnn } {##1} {##2} }
                {##3} {##4} {##5} {##6}
            }
        }
      \cs_new_protected:cpx { #1 :nnxxx } ##1##2##3##4##5
        { \exp_not:c { #1 :nnxxxx } {##1} {##2} {##3} {##4} {##5} { } }
      \cs_new_protected:cpx { #1 :nnxx } ##1##2##3##4
        { \exp_not:c { #1 :nnxxxx } {##1} {##2} {##3} {##4} { } { } }
      \cs_new_protected:cpx { #1 :nnx } ##1##2##3
        { \exp_not:c { #1 :nnxxxx } {##1} {##2} {##3} { } { } { } }
    }
  \__msg_kernel_class_new:nN { fatal } \__msg_fatal_code:nnnnnn
  \__msg_kernel_class_new:nN { critical } \__msg_critical_code:nnnnnn
  \cs_undefine:N \__kernel_msg_error:nnxx
  \cs_undefine:N \__kernel_msg_error:nnx
  \cs_undefine:N \__kernel_msg_error:nn
  \__msg_kernel_class_new:nN { error } \__msg_error_code:nnnnnn
  \__msg_kernel_class_new:nN { warning } \msg_warning:nnxxxx
  \__msg_kernel_class_new:nN { info } \msg_info:nnxxxx
\group_end:
\__kernel_msg_new:nnnn { kernel } { message-already-defined }
  { Message~'#2'~for~module~'#1'~already~defined. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~was~asked~to~define~a~new~message~called~'#2'\\
    by~the~module~'#1':~this~message~already~exists.
    \c__msg_return_text_tl
  }
\__kernel_msg_new:nnnn { kernel } { message-unknown }
  { Unknown~message~'#2'~for~module~'#1'. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~was~asked~to~display~a~message~called~'#2'\\
    by~the~module~'#1':~this~message~does~not~exist.
    \c__msg_return_text_tl
  }
\__kernel_msg_new:nnnn { kernel } { message-class-unknown }
  { Unknown~message~class~'#1'. }
  {
    LaTeX~has~been~asked~to~redirect~messages~to~a~class~'#1':\\
    this~was~never~defined.
    \c__msg_return_text_tl
  }
\__kernel_msg_new:nnnn { kernel } { message-redirect-loop }
  {
    Message~redirection~loop~caused~by~ {#1} ~=>~ {#2}
    \tl_if_empty:nF {#3} { ~for~module~' \use_none:n #3 ' } .
  }
  {
    Adding~the~message~redirection~ {#1} ~=>~ {#2}
    \tl_if_empty:nF {#3} { ~for~the~module~' \use_none:n #3 ' } ~
    created~an~infinite~loop\\\\
    \iow_indent:n { #4 \\\\ }
  }
\__kernel_msg_new:nnnn { kernel } { bad-number-of-arguments }
  { Function~'#1'~cannot~be~defined~with~#2~arguments. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~define~a~function~'#1'~with~
    #2~arguments.~
    TeX~allows~between~0~and~9~arguments~for~a~single~function.
  }
\__kernel_msg_new:nnn { kernel } { char-active }
  { Cannot~generate~active~chars. }
\__kernel_msg_new:nnn { kernel } { char-invalid-catcode }
  { Invalid~catcode~for~char~generation. }
\__kernel_msg_new:nnn { kernel } { char-null-space }
  { Cannot~generate~null~char~as~a~space. }
\__kernel_msg_new:nnn { kernel } { char-out-of-range }
  { Charcode~requested~out~of~engine~range. }
\__kernel_msg_new:nnn { kernel } { char-space }
  { Cannot~generate~space~chars. }
\__kernel_msg_new:nnnn { kernel } { command-already-defined }
  { Control~sequence~#1~already~defined. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~create~a~new~control~sequence~'#1'~
    but~this~name~has~already~been~used~elsewhere. \\ \\
    The~current~meaning~is:\\
    \ \ #2
  }
\__kernel_msg_new:nnnn { kernel } { command-not-defined }
  { Control~sequence~#1~undefined. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~use~a~control~sequence~'#1':\\
    this~has~not~been~defined~yet.
  }
\__kernel_msg_new:nnnn { kernel } { empty-search-pattern }
  { Empty~search~pattern. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~
    would~lead~to~an~infinite~loop!
  }
\__kernel_msg_new:nnnn { kernel } { out-of-registers }
  { No~room~for~a~new~#1. }
  {
    TeX~only~supports~\int_use:N \c_max_register_int \ %
    of~each~type.~All~the~#1~registers~have~been~used.~
    This~run~will~be~aborted~now.
  }
\__kernel_msg_new:nnnn { kernel } { non-base-function }
  { Function~'#1'~is~not~a~base~function }
  {
    \c__msg_coding_error_text_tl
    Functions~defined~through~\iow_char:N\\cs_new:Nn~must~have~
    a~signature~consisting~of~only~normal~arguments~'N'~and~'n'.~
    To~define~variants~use~\iow_char:N\\cs_generate_variant:Nn~
    and~to~define~other~functions~use~\iow_char:N\\cs_new:Npn.
  }
\__kernel_msg_new:nnnn { kernel } { missing-colon }
  { Function~'#1'~contains~no~':'. }
  {
    \c__msg_coding_error_text_tl
    Code-level~functions~must~contain~':'~to~separate~the~
    argument~specification~from~the~function~name.~This~is~
    needed~when~defining~conditionals~or~variants,~or~when~building~a~
    parameter~text~from~the~number~of~arguments~of~the~function.
  }
\__kernel_msg_new:nnnn { kernel } { overflow }
  { Integers~larger~than~2^{30}-1~cannot~be~stored~in~arrays. }
  {
    An~attempt~was~made~to~store~#3~
    \tl_if_empty:nF {#2} { at~position~#2~ } in~the~array~'#1'.~
    The~largest~allowed~value~#4~will~be~used~instead.
  }
\__kernel_msg_new:nnnn { kernel } { out-of-bounds }
  { Access~to~an~entry~beyond~an~array's~bounds. }
  {
    An~attempt~was~made~to~access~or~store~data~at~position~#2~of~the~
    array~'#1',~but~this~array~has~entries~at~positions~from~1~to~#3.
  }
\__kernel_msg_new:nnnn { kernel } { protected-predicate }
  { Predicate~'#1'~must~be~expandable. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~define~'#1'~as~a~protected~predicate.~
    Only~expandable~tests~can~have~a~predicate~version.
  }
\__kernel_msg_new:nnn { kernel } { randint-backward-range }
  { Bounds~ordered~backwards~in~\iow_char:N\\int_rand:nn~{#1}~{#2}. }
\__kernel_msg_new:nnnn { kernel } { conditional-form-unknown }
  { Conditional~form~'#1'~for~function~'#2'~unknown. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~define~the~conditional~form~'#1'~of~
    the~function~'#2',~but~only~'TF',~'T',~'F',~and~'p'~forms~exist.
  }
\__kernel_msg_new:nnnn { kernel } { key-no-property }
  { No~property~given~in~definition~of~key~'#1'. }
  {
    \c__msg_coding_error_text_tl
    Inside~\keys_define:nn  each~key~name~
    needs~a~property:  \\ \\
    \iow_indent:n { #1 .<property> } \\ \\
    LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property.
  }
\__kernel_msg_new:nnnn { kernel } { key-property-boolean-values-only }
  { The~property~'#1'~accepts~boolean~values~only. }
  {
    \c__msg_coding_error_text_tl
    The~property~'#1'~only~accepts~the~values~'true'~and~'false'.
  }
\__kernel_msg_new:nnnn { kernel } { key-property-requires-value }
  { The~property~'#1'~requires~a~value. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~was~asked~to~set~property~'#1'~for~key~'#2'.\\
    No~value~was~given~for~the~property,~and~one~is~required.
  }
\__kernel_msg_new:nnnn { kernel } { key-property-unknown }
  { The~key~property~'#1'~is~unknown. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~
    this~property~is~not~defined.
  }
\__kernel_msg_new:nnnn { kernel } { quote-in-shell }
  { Quotes~in~shell~command~'#1'. }
  { Shell~commands~cannot~contain~quotes~("). }
\__kernel_msg_new:nnnn { kernel } { invalid-quark-function }
  { Quark~test~function~'#1'~is~invalid. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~create~quark~test~function~'#1'~
    \tl_if_empty:nTF {#2}
      { but~that~name~ }
      { with~signature~'#2',~but~that~signature~ }
    is~not~valid.
  }
\__kernel_msg_new:nnn { kernel } { invalid-quark }
  { Invalid~quark~variable~'#1'. }
\__kernel_msg_new:nnnn { kernel } { scanmark-already-defined }
  { Scan~mark~#1~already~defined. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~create~a~new~scan~mark~'#1'~
    but~this~name~has~already~been~used~for~a~scan~mark.
  }
\__kernel_msg_new:nnnn { kernel } { shuffle-too-large }
  { The~sequence~#1~is~too~long~to~be~shuffled~by~TeX. }
  {
    TeX~has~ \int_eval:n { \c_max_register_int + 1 } ~
    toks~registers:~this~only~allows~to~shuffle~up~to~
    \int_use:N \c_max_register_int \ items.~
    The~list~will~not~be~shuffled.
  }
\__kernel_msg_new:nnnn { kernel } { variable-not-defined }
  { Variable~#1~undefined. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~show~a~variable~#1,~but~this~has~not~
    been~defined~yet.
  }
\__kernel_msg_new:nnnn { kernel } { variant-too-long }
  { Variant~form~'#1'~longer~than~base~signature~of~'#2'. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~
    with~a~signature~starting~with~'#1',~but~that~is~longer~than~
    the~signature~(part~after~the~colon)~of~'#2'.
  }
\__kernel_msg_new:nnnn { kernel } { invalid-variant }
  { Variant~form~'#1'~invalid~for~base~form~'#2'. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~
    with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~
    from~type~'#3'~to~type~'#4'.
  }
\__kernel_msg_new:nnnn { kernel } { invalid-exp-args }
  { Invalid~variant~specifier~'#1'~in~'#2'. }
  {
    \c__msg_coding_error_text_tl
    LaTeX~has~been~asked~to~create~an~\iow_char:N\\exp_args:N...~
    function~with~signature~'N#2'~but~'#1'~is~not~a~valid~argument~
    specifier.
  }
\__kernel_msg_new:nnn { kernel } { deprecated-variant }
  {
    Variant~form~'#1'~deprecated~for~base~form~'#2'.~
    One~should~not~change~an~argument~from~type~'#3'~to~type~'#4'
    \str_case:nnF {#3}
      {
        { n } { :~use~a~'\token_if_eq_charcode:NNTF #4 c v V'~variant? }
        { N } { :~base~form~only~accepts~a~single~token~argument. }
        {#4} { :~base~form~is~already~a~variant. }
      } { . }
  }
\__kernel_msg_new:nnnn { kernel } { enable-debug }
  { To~use~'#1'~set~the~'enable-debug'~option. }
  {
    The~function~'#1'~will~be~ignored~because~it~can~only~work~if~
    some~internal~functions~in~expl3~have~been~appropriately~
    defined.~This~only~happens~if~one~of~the~options~
    'enable-debug',~'check-declarations'~or~'log-functions'~was~
    given~as~an~option:~see~the~main~expl3~documentation.
  }
\__kernel_msg_new:nnn { kernel } { bad-exp-end-f }
  { Misused~\exp_end_continue_f:w or~:nw }
\__kernel_msg_new:nnn { kernel } { bad-variable }
  { Erroneous~variable~#1 used! }
\__kernel_msg_new:nnn { kernel } { misused-sequence }
  { A~sequence~was~misused. }
\__kernel_msg_new:nnn { kernel } { misused-prop }
  { A~property~list~was~misused. }
\__kernel_msg_new:nnn { kernel } { negative-replication }
  { Negative~argument~for~\iow_char:N\\prg_replicate:nn. }
\__kernel_msg_new:nnn { kernel } { prop-keyval }
  { Missing/extra~'='~in~'#1'~(in~'..._keyval:Nn') }
\__kernel_msg_new:nnn { kernel } { unknown-comparison }
  { Relation~'#1'~unknown:~use~=,~<,~>,~==,~!=,~<=,~>=. }
\__kernel_msg_new:nnn { kernel } { zero-step }
  { Zero~step~size~for~step~function~#1. }
\cs_if_exist:NF \tex_expanded:D
  {
    \__kernel_msg_new:nnn { kernel } { e-type }
      { #1 ~ in~e-type~argument }
  }
\__kernel_msg_new:nnn { kernel } { show-clist }
  {
    The~comma~list~ \tl_if_empty:nF {#1} { #1 ~ }
    \tl_if_empty:nTF {#2}
      { is~empty \\>~ . }
      { contains~the~items~(without~outer~braces): #2 . }
  }
\__kernel_msg_new:nnn { kernel } { show-intarray }
  { The~integer~array~#1~contains~#2~items: \\ #3 . }
\__kernel_msg_new:nnn { kernel } { show-prop }
  {
    The~property~list~#1~
    \tl_if_empty:nTF {#2}
      { is~empty \\>~ . }
      { contains~the~pairs~(without~outer~braces): #2 . }
  }
\__kernel_msg_new:nnn { kernel } { show-seq }
  {
    The~sequence~#1~
    \tl_if_empty:nTF {#2}
      { is~empty \\>~ . }
      { contains~the~items~(without~outer~braces): #2 . }
  }
\__kernel_msg_new:nnn { kernel } { show-streams }
  {
    \tl_if_empty:nTF {#2} { No~ } { The~following~ }
    \str_case:nn {#1}
      {
        { ior } { input ~ }
        { iow } { output ~ }
      }
    streams~are~
    \tl_if_empty:nTF {#2} { open } { in~use: #2 . }
  }
\__kernel_msg_new:nnnn { sys } { backend-set }
  { Backend~configuration~already~set. }
  {
    Run-time~backend~selection~may~only~be~carried~out~once~during~a~run.~
    This~second~attempt~to~set~them~will~be~ignored.
  }
\__kernel_msg_new:nnnn { sys } { wrong-backend }
  { Backend~request~inconsistent~with~engine:~using~'#2'~backend. }
  {
    You~have~requested~backend~'#1',~but~this~is~not~suitable~for~use~with~the~
    active~engine.~LaTeX3~will~use~the~'#2'~backend~instead.
  }
\group_begin:
\cs_set_protected:Npn \__msg_tmp:w #1#2
  {
    \cs_new:Npn \__msg_expandable_error:n ##1
      {
        \exp:w
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__msg_expandable_error:w
        \exp_after:wN \exp_after:wN
        \exp_after:wN \exp_end:
        \use:n { #1 #2 ##1 } #2
      }
    \cs_new:Npn \__msg_expandable_error:w ##1 #2 ##2 #2 {##1}
  }
\exp_args:Ncx \__msg_tmp:w { LaTeX3~error: }
  { \char_generate:nn { `\  } { 7 } }
\group_end:
\exp_args_generate:n { oooo }
\cs_new:Npn \__kernel_msg_expandable_error:nnnnnn #1#2#3#4#5#6
  {
    \exp_args:Ne \__msg_expandable_error:n
      {
        \exp_args:Nc \exp_args:Noooo
          { \c__msg_text_prefix_tl LaTeX / #1 / #2 }
          { \tl_to_str:n {#3} }
          { \tl_to_str:n {#4} }
          { \tl_to_str:n {#5} }
          { \tl_to_str:n {#6} }
      }
  }
\cs_new:Npn \__kernel_msg_expandable_error:nnnnn #1#2#3#4#5
  {
    \__kernel_msg_expandable_error:nnnnnn
      {#1} {#2} {#3} {#4} {#5} { }
  }
\cs_new:Npn \__kernel_msg_expandable_error:nnnn #1#2#3#4
  {
    \__kernel_msg_expandable_error:nnnnnn
      {#1} {#2} {#3} {#4} { } { }
  }
\cs_new:Npn \__kernel_msg_expandable_error:nnn #1#2#3
  {
    \__kernel_msg_expandable_error:nnnnnn
      {#1} {#2} {#3} { } { } { }
  }
\cs_new:Npn \__kernel_msg_expandable_error:nn #1#2
  {
    \__kernel_msg_expandable_error:nnnnnn
      {#1} {#2} { } { } { } { }
  }
\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnnnnn { nnffff }
\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnnnn { nnfff }
\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnnn { nnff }
\cs_generate_variant:Nn \__kernel_msg_expandable_error:nnn { nnf }
\cs_new:Npn \msg_expandable_error:nnnnnn #1#2#3#4#5#6
  {
    \exp_args:Ne \__msg_expandable_error_module:nn
      {
        \exp_args:Nc \exp_args:Noooo
          { \c__msg_text_prefix_tl #1 / #2 }
          { \tl_to_str:n {#3} }
          { \tl_to_str:n {#4} }
          { \tl_to_str:n {#5} }
          { \tl_to_str:n {#6} }
      }
      {#1}
  }
\cs_new:Npn \msg_expandable_error:nnnnn #1#2#3#4#5
  { \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} {#5} { } }
\cs_new:Npn \msg_expandable_error:nnnn #1#2#3#4
  { \msg_expandable_error:nnnnnn {#1} {#2} {#3} {#4} { } { } }
\cs_new:Npn \msg_expandable_error:nnn #1#2#3
  { \msg_expandable_error:nnnnnn {#1} {#2} {#3} { } { } { } }
\cs_new:Npn \msg_expandable_error:nn #1#2
  { \msg_expandable_error:nnnnnn {#1} {#2} { } { } { } { } }
\cs_generate_variant:Nn \msg_expandable_error:nnnnnn { nnffff }
\cs_generate_variant:Nn \msg_expandable_error:nnnnn  { nnfff }
\cs_generate_variant:Nn \msg_expandable_error:nnnn   { nnff }
\cs_generate_variant:Nn \msg_expandable_error:nnn    { nnf }
\cs_new:Npn \__msg_expandable_error_module:nn #1#2
  {
    \exp_after:wN \exp_after:wN
    \exp_after:wN \__msg_use_none_delimit_by_s_stop:w
    \use:n { \::error ! ~ #2 : ~ #1 } \s__msg_stop
  }
%% File: l3file.dtx
\tl_new:N  \l__ior_internal_tl
\int_const:Nn \c__ior_term_ior { 16 }
\seq_new:N \g__ior_streams_seq
\tl_new:N \l__ior_stream_tl
\prop_new:N \g__ior_streams_prop
\int_step_inline:nnn
  { 0 }
  {
    \cs_if_exist:NTF \normalend
      { \tex_count:D 38 ~ }
      {
        \tex_count:D 16 ~ %
        \cs_if_exist:NT \loccount { - 1 }
      }
  }
  {
    \prop_gput:Nnn \g__ior_streams_prop {#1} { Reserved~by~format }
  }
\cs_new_protected:Npn \ior_new:N #1 { \cs_new_eq:NN #1 \c__ior_term_ior }
\cs_generate_variant:Nn \ior_new:N { c }
\ior_new:N \g_tmpa_ior
\ior_new:N \g_tmpb_ior
\cs_new_protected:Npn \ior_open:Nn #1#2
  { \ior_open:NnF #1 {#2} { \__kernel_file_missing:n {#2} } }
\cs_generate_variant:Nn \ior_open:Nn { c }
\tl_new:N \l__ior_file_name_tl
\prg_new_protected_conditional:Npnn \ior_open:Nn #1#2 { T , F , TF }
  {
    \file_get_full_name:nNTF {#2} \l__ior_file_name_tl
      {
        \__kernel_ior_open:No #1 \l__ior_file_name_tl
        \prg_return_true:
      }
      { \prg_return_false: }
  }
\prg_generate_conditional_variant:Nnn \ior_open:Nn { c } { T , F , TF }
\exp_args:NNf \cs_new_protected:Npn \__ior_new:N
  { \exp_args:NNc \exp_after:wN \exp_stop_f: { newread } }
\cs_if_exist:NT \normalend
  {
    \cs_new_eq:NN \__ior_new_aux:N \__ior_new:N
    \cs_set_protected:Npn \__ior_new:N #1
      {
        \cs_undefine:N #1
        \__ior_new_aux:N #1
      }
  }
\cs_new_protected:Npn \__kernel_ior_open:Nn #1#2
  {
    \ior_close:N #1
    \seq_gpop:NNTF \g__ior_streams_seq \l__ior_stream_tl
      { \__ior_open_stream:Nn #1 {#2} }
      {
        \__ior_new:N #1
        \__kernel_tl_set:Nx \l__ior_stream_tl { \int_eval:n {#1} }
        \__ior_open_stream:Nn #1 {#2}
      }
  }
\cs_generate_variant:Nn \__kernel_ior_open:Nn { No }
\cs_new_protected:Npx \__ior_open_stream:Nn #1#2
  {
    \tex_global:D \tex_chardef:D #1 = \exp_not:N \l__ior_stream_tl \scan_stop:
    \prop_gput:NVn \exp_not:N \g__ior_streams_prop #1 {#2}
    \tex_openin:D #1
      \sys_if_engine_luatex:TF
        { {#2} }
        {  \exp_not:N \__kernel_file_name_quote:n {#2} \scan_stop: }
  }
\cs_new_protected:Npn \ior_close:N #1
  {
    \int_compare:nT { -1 < #1 < \c__ior_term_ior }
      {
        \tex_closein:D #1
        \prop_gremove:NV \g__ior_streams_prop #1
        \seq_if_in:NVF \g__ior_streams_seq #1
          { \seq_gpush:NV \g__ior_streams_seq #1 }
        \cs_gset_eq:NN #1 \c__ior_term_ior
      }
  }
\cs_generate_variant:Nn \ior_close:N { c }
\cs_new_protected:Npn \ior_show_list: { \__ior_list:N \msg_show:nnxxxx }
\cs_new_protected:Npn \ior_log_list: { \__ior_list:N \msg_log:nnxxxx }
\cs_new_protected:Npn \__ior_list:N #1
  {
    #1 { LaTeX / kernel } { show-streams }
      { ior }
      {
        \prop_map_function:NN \g__ior_streams_prop
          \msg_show_item_unbraced:nn
      }
      { } { }
  }
\cs_new_eq:NN \if_eof:w \tex_ifeof:D
\prg_new_conditional:Npnn \ior_if_eof:N #1 { p , T , F , TF }
  {
    \cs_if_exist:NTF #1
      {
        \int_compare:nTF { -1 < #1 < \c__ior_term_ior }
          {
            \if_eof:w #1
              \prg_return_true:
            \else:
              \prg_return_false:
            \fi:
          }
          { \prg_return_true: }
      }
      { \prg_return_true: }
  }
\cs_new_protected:Npn \ior_get:NN #1#2
  { \ior_get:NNF #1 #2 { \tl_set:Nn #2 { \q_no_value } } }
\cs_new_protected:Npn \__ior_get:NN #1#2
  { \tex_read:D #1 to #2 }
\prg_new_protected_conditional:Npnn \ior_get:NN #1#2 { T , F , TF }
  {
    \ior_if_eof:NTF #1
      { \prg_return_false: }
      {
        \__ior_get:NN #1 #2
        \prg_return_true:
      }
  }
\cs_new_protected:Npn \ior_str_get:NN #1#2
  { \ior_str_get:NNF #1 #2 { \tl_set:Nn #2 { \q_no_value } } }
\cs_new_protected:Npn \__ior_str_get:NN #1#2
  {
    \exp_args:Nno \use:n
      {
        \int_set:Nn \tex_endlinechar:D { -1 }
        \tex_readline:D #1 to #2
        \int_set:Nn \tex_endlinechar:D
      }   { \int_use:N \tex_endlinechar:D }
  }
\prg_new_protected_conditional:Npnn \ior_str_get:NN #1#2 { T , F , TF }
  {
    \ior_if_eof:NTF #1
      { \prg_return_false: }
      {
        \__ior_str_get:NN #1 #2
        \prg_return_true:
      }
  }
\int_const:Nn \c__ior_term_noprompt_ior { -1 }
\cs_new_protected:Npn \ior_get_term:nN #1#2
  { \__ior_get_term:NnN \__ior_get:NN {#1} #2 }
\cs_new_protected:Npn \ior_str_get_term:nN #1#2
  { \__ior_get_term:NnN \__ior_str_get:NN {#1} #2 }
\cs_new_protected:Npn \__ior_get_term:NnN #1#2#3
  {
    \group_begin:
      \tex_escapechar:D = -1 \scan_stop:
      \tl_if_blank:nTF {#2}
        { \exp_args:NNc #1 \c__ior_term_noprompt_ior }
        { \exp_args:NNc #1 \c__ior_term_ior }
          {#2}
    \exp_args:NNNv \group_end:
    \tl_set:Nn #3 {#2}
  }
\cs_new:Npn \ior_map_break:
  { \prg_map_break:Nn \ior_map_break: { } }
\cs_new:Npn \ior_map_break:n
  { \prg_map_break:Nn \ior_map_break: }
\cs_new_protected:Npn \ior_map_inline:Nn
  { \__ior_map_inline:NNn \__ior_get:NN }
\cs_new_protected:Npn \ior_str_map_inline:Nn
  { \__ior_map_inline:NNn \__ior_str_get:NN }
\cs_new_protected:Npn \__ior_map_inline:NNn
  {
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:Nc \__ior_map_inline:NNNn
      { __ior_map_ \int_use:N \g__kernel_prg_map_int :n }
  }
\cs_new_protected:Npn \__ior_map_inline:NNNn #1#2#3#4
  {
    \cs_gset_protected:Npn #1 ##1 {#4}
    \ior_if_eof:NF #3 { \__ior_map_inline_loop:NNN #1#2#3 }
    \prg_break_point:Nn \ior_map_break:
      { \int_gdecr:N \g__kernel_prg_map_int }
  }
\cs_new_protected:Npn \__ior_map_inline_loop:NNN #1#2#3
  {
    #2 #3 \l__ior_internal_tl
    \if_eof:w #3
      \exp_after:wN \ior_map_break:
    \fi:
    \exp_args:No #1 \l__ior_internal_tl
    \__ior_map_inline_loop:NNN #1#2#3
  }
\cs_new_protected:Npn \ior_map_variable:NNn
  { \__ior_map_variable:NNNn \ior_get:NN }
\cs_new_protected:Npn \ior_str_map_variable:NNn
  { \__ior_map_variable:NNNn \ior_str_get:NN }
\cs_new_protected:Npn \__ior_map_variable:NNNn #1#2#3#4
  {
    \ior_if_eof:NF #2 { \__ior_map_variable_loop:NNNn #1#2#3 {#4} }
    \prg_break_point:Nn \ior_map_break: { }
  }
\cs_new_protected:Npn \__ior_map_variable_loop:NNNn #1#2#3#4
  {
    #1 #2 #3
    \if_eof:w #2
      \exp_after:wN \ior_map_break:
    \fi:
    #4
    \__ior_map_variable_loop:NNNn #1#2#3 {#4}
  }
\int_const:Nn \c_log_iow  { -1 }
\int_const:Nn \c_term_iow
  {
    \bool_lazy_and:nnTF
      { \sys_if_engine_luatex_p: }
      { \int_compare_p:nNn \tex_luatexversion:D > { 80 } }
      { 128 }
      { 16 }
  }
\seq_new:N \g__iow_streams_seq
\tl_new:N \l__iow_stream_tl
\prop_new:N \g__iow_streams_prop
\int_step_inline:nnn
  { 0 }
  {
    \cs_if_exist:NTF \normalend
      { \tex_count:D 39 ~ }
      {
        \tex_count:D 17 ~
        \cs_if_exist:NT \loccount { - 1 }
      }
  }
  {
    \prop_gput:Nnn \g__iow_streams_prop {#1} { Reserved~by~format }
  }
\scan_new:N \s__iow_mark
\scan_new:N \s__iow_stop
\cs_new:Npn \__iow_use_i_delimit_by_s_stop:nw #1 #2 \s__iow_stop {#1}
\quark_new:N \q__iow_nil
\cs_new_protected:Npn \iow_new:N #1 { \cs_new_eq:NN #1 \c_term_iow }
\cs_generate_variant:Nn \iow_new:N { c }
\iow_new:N \g_tmpa_iow
\iow_new:N \g_tmpb_iow
\exp_args:NNf \cs_new_protected:Npn \__iow_new:N
  { \exp_args:NNc \exp_after:wN \exp_stop_f: { newwrite } }
\tl_new:N \l__iow_file_name_tl
\cs_new_protected:Npn \iow_open:Nn #1#2
  {
    \__kernel_tl_set:Nx \l__iow_file_name_tl
      { \__kernel_file_name_sanitize:n {#2} }
    \iow_close:N #1
    \seq_gpop:NNTF \g__iow_streams_seq \l__iow_stream_tl
      { \__iow_open_stream:NV #1 \l__iow_file_name_tl }
      {
        \__iow_new:N #1
        \__kernel_tl_set:Nx \l__iow_stream_tl { \int_eval:n {#1} }
        \__iow_open_stream:NV #1 \l__iow_file_name_tl
      }
  }
\cs_generate_variant:Nn \iow_open:Nn { c }
\cs_new_protected:Npn \__iow_open_stream:Nn #1#2
  {
    \tex_global:D \tex_chardef:D #1 = \l__iow_stream_tl \scan_stop:
    \prop_gput:NVn \g__iow_streams_prop #1 {#2}
    \tex_immediate:D \tex_openout:D
        #1 \__kernel_file_name_quote:n {#2} \scan_stop:
  }
\cs_generate_variant:Nn \__iow_open_stream:Nn { NV }
\cs_new_protected:Npn \iow_close:N #1
  {
    \int_compare:nT { - \c_log_iow < #1 < \c_term_iow }
      {
        \tex_immediate:D \tex_closeout:D #1
        \prop_gremove:NV \g__iow_streams_prop #1
        \seq_if_in:NVF \g__iow_streams_seq #1
          { \seq_gpush:NV \g__iow_streams_seq #1 }
        \cs_gset_eq:NN #1 \c_term_iow
      }
  }
\cs_generate_variant:Nn \iow_close:N { c }
\cs_new_protected:Npn \iow_show_list: { \__iow_list:N \msg_show:nnxxxx }
\cs_new_protected:Npn \iow_log_list: { \__iow_list:N \msg_log:nnxxxx }
\cs_new_protected:Npn \__iow_list:N #1
  {
    #1 { LaTeX / kernel } { show-streams }
      { iow }
      {
        \prop_map_function:NN \g__iow_streams_prop
          \msg_show_item_unbraced:nn
      }
      { } { }
  }
\cs_new_protected:Npn \iow_shipout_x:Nn #1#2
  { \tex_write:D #1 {#2} }
\cs_generate_variant:Nn \iow_shipout_x:Nn { c, Nx, cx }
\cs_new_protected:Npn \iow_shipout:Nn #1#2
  { \tex_write:D #1 { \exp_not:n {#2} } }
\cs_generate_variant:Nn \iow_shipout:Nn { c, Nx, cx }
\cs_new_protected:Npn \__kernel_iow_with:Nnn #1#2
  {
    \int_compare:nNnTF {#1} = {#2}
      { \use:n }
      { \exp_args:No \__iow_with:nNnn { \int_use:N #1 } #1 {#2} }
  }
\cs_new_protected:Npn \__iow_with:nNnn #1#2#3#4
  {
    \int_set:Nn #2 {#3}
    #4
    \int_set:Nn #2 {#1}
  }
\cs_new_protected:Npn \iow_now:Nn #1#2
  {
    \__kernel_iow_with:Nnn \tex_newlinechar:D { `\^^J }
      { \tex_immediate:D \tex_write:D #1 { \exp_not:n {#2} } }
  }
\cs_generate_variant:Nn \iow_now:Nn { c, Nx, cx }
\cs_set_protected:Npn \iow_log:x  { \iow_now:Nx \c_log_iow  }
\cs_new_protected:Npn \iow_log:n  { \iow_now:Nn \c_log_iow  }
\cs_set_protected:Npn \iow_term:x { \iow_now:Nx \c_term_iow }
\cs_new_protected:Npn \iow_term:n { \iow_now:Nn \c_term_iow }
\cs_new:Npn \iow_newline: { ^^J }
\cs_new_eq:NN \iow_char:N \cs_to_str:N
\int_new:N  \l_iow_line_count_int
\int_set:Nn \l_iow_line_count_int { 78 }
\tl_new:N \l__iow_newline_tl
\int_new:N \l__iow_line_target_int
\tl_new:N \l__iow_one_indent_tl
\int_new:N \l__iow_one_indent_int
\cs_new:Npn \__iow_unindent:w { }
\cs_new_protected:Npn \__iow_set_indent:n #1
  {
    \__kernel_tl_set:Nx \l__iow_one_indent_tl
      { \exp_args:No \__kernel_str_to_other_fast:n { \tl_to_str:n {#1} } }
    \int_set:Nn \l__iow_one_indent_int
      { \str_count:N \l__iow_one_indent_tl }
    \exp_last_unbraced:NNo
      \cs_set:Npn \__iow_unindent:w \l__iow_one_indent_tl { }
  }
\exp_args:Nx \__iow_set_indent:n { \prg_replicate:nn { 4 } { ~ } }
\tl_new:N \l__iow_indent_tl
\int_new:N \l__iow_indent_int
\tl_new:N \l__iow_line_tl
\tl_new:N \l__iow_line_part_tl
\bool_new:N \l__iow_line_break_bool
\tl_new:N \l__iow_wrap_tl
\group_begin:
  \int_set:Nn \tex_escapechar:D { -1 }
  \tl_const:Nx \c__iow_wrap_marker_tl
    { \tl_to_str:n { \^^I \^^O \^^W \^^_ \^^W \^^R \^^A \^^P } }
\group_end:
\tl_map_inline:nn
  { { end } { newline } { allow_break } { indent } { unindent } }
  {
    \tl_const:cx { c__iow_wrap_ #1 _marker_tl }
      {
        \c__iow_wrap_marker_tl
        #1
        \c_catcode_other_space_tl
      }
  }
\cs_new_protected:Npn \iow_allow_break:
  {
    \__kernel_msg_error:nnnn { kernel } { iow-indent }
      { \iow_wrap:nnnN } { \iow_allow_break: }
  }
\cs_new:Npx \__iow_allow_break: { \c__iow_wrap_allow_break_marker_tl }
\cs_new:Npn \__iow_allow_break_error:
  {
    \__kernel_msg_expandable_error:nnnn { kernel } { iow-indent }
      { \iow_wrap:nnnN } { \iow_allow_break: }
  }
\cs_new_protected:Npn \iow_indent:n #1
  {
    \__kernel_msg_error:nnnnn { kernel } { iow-indent }
      { \iow_wrap:nnnN } { \iow_indent:n } {#1}
    #1
  }
\cs_new:Npx \__iow_indent:n #1
  {
    \c__iow_wrap_indent_marker_tl
    #1
    \c__iow_wrap_unindent_marker_tl
  }
\cs_new:Npn \__iow_indent_error:n #1
  {
    \__kernel_msg_expandable_error:nnnnn { kernel } { iow-indent }
      { \iow_wrap:nnnN } { \iow_indent:n } {#1}
    #1
  }
\cs_new_protected:Npn \iow_wrap:nnnN #1#2#3#4
  {
    \group_begin:
      \cs_if_exist_use:N \conditionally@traceoff
      \int_set:Nn \tex_escapechar:D { -1 }
      \cs_set:Npx \{ { \token_to_str:N \{ }
      \cs_set:Npx \# { \token_to_str:N \# }
      \cs_set:Npx \} { \token_to_str:N \} }
      \cs_set:Npx \% { \token_to_str:N \% }
      \cs_set:Npx \~ { \token_to_str:N \~ }
      \int_set:Nn \tex_escapechar:D { 92 }
      \cs_set_eq:NN \\ \iow_newline:
      \cs_set_eq:NN \  \c_catcode_other_space_tl
      \cs_set_eq:NN \iow_allow_break: \__iow_allow_break:
      \cs_set_eq:NN \iow_indent:n \__iow_indent:n
      #3
      \cs_set_eq:NN \protect \token_to_str:N
      \__kernel_tl_set:Nx \l__iow_wrap_tl {#1}
      \cs_set_eq:NN \iow_allow_break: \__iow_allow_break_error:
      \cs_set_eq:NN \iow_indent:n \__iow_indent_error:n
      \__kernel_tl_set:Nx \l__iow_newline_tl { \iow_newline: #2 }
      \__kernel_tl_set:Nx \l__iow_newline_tl { \tl_to_str:N \l__iow_newline_tl }
      \int_set:Nn \l__iow_line_target_int
        { \l_iow_line_count_int - \str_count:N \l__iow_newline_tl + 1 }
       \int_compare:nNnT { \l__iow_line_target_int } < 0
         {
           \tl_set:Nn \l__iow_newline_tl { \iow_newline: }
           \int_set:Nn \l__iow_line_target_int
             { \l_iow_line_count_int + 1 }
         }
      \__iow_wrap_do:
    \exp_args:NNf \group_end:
    #4 { \tl_to_str:N \l__iow_wrap_tl }
  }
\cs_generate_variant:Nn \iow_wrap:nnnN { nx }
\cs_new_protected:Npn \__iow_wrap_do:
  {
    \__kernel_tl_set:Nx \l__iow_wrap_tl
      {
        \exp_args:No \__kernel_str_to_other_fast:n \l__iow_wrap_tl
        \c__iow_wrap_end_marker_tl
      }
    \__kernel_tl_set:Nx \l__iow_wrap_tl
      {
        \exp_after:wN \__iow_wrap_fix_newline:w \l__iow_wrap_tl
          ^^J \q__iow_nil ^^J \s__iow_stop
      }
    \exp_after:wN \__iow_wrap_start:w \l__iow_wrap_tl
  }
\cs_new:Npn \__iow_wrap_fix_newline:w #1 ^^J #2 ^^J
  {
    #1
    \if_meaning:w \q__iow_nil #2
      \__iow_use_i_delimit_by_s_stop:nw
    \fi:
    \c__iow_wrap_newline_marker_tl
    \__iow_wrap_fix_newline:w #2 ^^J
  }
\cs_new_protected:Npn \__iow_wrap_start:w
  {
    \bool_set_false:N \l__iow_line_break_bool
    \tl_clear:N \l__iow_line_tl
    \tl_clear:N \l__iow_line_part_tl
    \tl_set:Nn \l__iow_wrap_tl { ~ \use_none:n }
    \int_zero:N \l__iow_indent_int
    \tl_clear:N \l__iow_indent_tl
    \__iow_wrap_chunk:nw { \l_iow_line_count_int }
  }
\cs_set_protected:Npn \__iow_tmp:w #1#2
  {
    \cs_new_protected:Npn \__iow_wrap_chunk:nw ##1##2 #2
      {
        \tl_if_empty:nTF {##2}
          {
            \tl_clear:N \l__iow_line_part_tl
            \__iow_wrap_next:nw {##1}
          }
          {
            \tl_if_empty:NTF \l__iow_line_tl
              {
                \__iow_wrap_line:nw
                  { \l__iow_indent_tl }
                  ##1 - \l__iow_indent_int ;
              }
              { \__iow_wrap_line:nw { } ##1 ; }
            ##2 #1
            \__iow_wrap_end_chunk:w 7 6 5 4 3 2 1 0 \s__iow_stop
          }
      }
    \cs_new_protected:Npn \__iow_wrap_next:nw ##1##2 #1
      { \use:c { __iow_wrap_##2:n } {##1} }
  }
\exp_args:NVV \__iow_tmp:w \c_catcode_other_space_tl \c__iow_wrap_marker_tl
\cs_new_protected:Npn \__iow_wrap_line:nw #1
  {
    \tex_edef:D \l__iow_line_part_tl { \if_false: } \fi:
    #1
    \exp_after:wN \__iow_wrap_line_loop:w
    \int_value:w \int_eval:w
  }
\cs_new:Npn \__iow_wrap_line_loop:w #1 ; #2#3#4#5#6#7#8#9
  {
    \if_int_compare:w #1 < 8 \exp_stop_f:
      \__iow_wrap_line_aux:Nw #1
    \fi:
    #2 #3 #4 #5 #6 #7 #8 #9
    \exp_after:wN \__iow_wrap_line_loop:w
    \int_value:w \int_eval:w #1 - 8 ;
  }
\cs_new:Npn \__iow_wrap_line_aux:Nw #1#2#3 \exp_after:wN #4 ;
  {
    #2
    \exp_after:wN \__iow_wrap_line_end:NnnnnnnnN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
    \exp_after:wN \exp_after:wN
    \if_case:w #1 \exp_stop_f:
         \prg_do_nothing:
    \or: \use_none:n
    \or: \use_none:nn
    \or: \use_none:nnn
    \or: \use_none:nnnn
    \or: \use_none:nnnnn
    \or: \use_none:nnnnnn
    \or: \__iow_wrap_line_seven:nnnnnnn
    \fi:
    { } { } { } { } { } { } { } #3
  }
\cs_new:Npn \__iow_wrap_line_seven:nnnnnnn #1#2#3#4#5#6#7 { \exp_stop_f: }
\cs_new:Npn \__iow_wrap_line_end:NnnnnnnnN #1#2#3#4#5#6#7#8#9
  {
    #2 #3 #4 #5 #6 #7 #8
    \use_none:nnnnn \int_eval:w 8 - ; #9
    \token_if_eq_charcode:NNTF \c_space_token #9
      { \__iow_wrap_line_end:nw { } }
      { \if_false: { \fi: } \__iow_wrap_break:w #9 }
  }
\cs_new:Npn \__iow_wrap_line_end:nw #1
  {
    \if_false: { \fi: }
    \__iow_wrap_store_do:n {#1}
    \__iow_wrap_next_line:w
  }
\cs_new:Npn \__iow_wrap_end_chunk:w
    #1 \int_eval:w #2 - #3 ; #4#5 \s__iow_stop
  {
    \if_false: { \fi: }
    \exp_args:Nf \__iow_wrap_next:nw { \int_eval:n { #2 - #4 } }
  }
\cs_set_protected:Npn \__iow_tmp:w #1
  {
    \cs_new:Npn \__iow_wrap_break:w
      {
        \tex_edef:D \l__iow_line_part_tl
          { \if_false: } \fi:
            \exp_after:wN \__iow_wrap_break_first:w
            \l__iow_line_part_tl
            #1
            { ? \__iow_wrap_break_end:w }
            \s__iow_mark
      }
    \cs_new:Npn \__iow_wrap_break_first:w ##1 #1 ##2
      {
        \use_none:nn ##2 \__iow_wrap_break_none:w
        \__iow_wrap_break_loop:w ##1 #1 ##2
      }
    \cs_new:Npn \__iow_wrap_break_none:w ##1##2 #1 ##3 \s__iow_mark ##4 #1
      {
        \tl_if_empty:NTF \l__iow_line_tl
          { ##2 ##4 \__iow_wrap_line_end:nw { } }
          { \__iow_wrap_line_end:nw { \__iow_wrap_trim:N } ##2 ##4 #1 }
      }
    \cs_new:Npn \__iow_wrap_break_loop:w ##1 #1 ##2 #1 ##3
      {
        \use_none:n ##3
        ##1 #1
        \__iow_wrap_break_loop:w ##2 #1 ##3
      }
    \cs_new:Npn \__iow_wrap_break_end:w ##1 #1 ##2 ##3 #1 ##4 \s__iow_mark
      { ##1 \__iow_wrap_line_end:nw { } ##3 }
  }
\exp_args:NV \__iow_tmp:w \c_catcode_other_space_tl
\cs_new_protected:Npn \__iow_wrap_next_line:w #1#2 \s__iow_stop
  {
    \tl_clear:N \l__iow_line_tl
    \token_if_eq_meaning:NNTF #1 \__iow_wrap_end_chunk:w
      {
        \tl_clear:N \l__iow_line_part_tl
        \bool_set_true:N \l__iow_line_break_bool
        \__iow_wrap_next:nw { \l__iow_line_target_int }
      }
      {
        \__iow_wrap_line:nw
          { \l__iow_indent_tl }
          \l__iow_line_target_int - \l__iow_indent_int ;
          #1 #2 \s__iow_stop
      }
  }
\cs_new_protected:Npn \__iow_wrap_allow_break:n #1
  {
    \__kernel_tl_set:Nx \l__iow_line_tl
      { \l__iow_line_tl \__iow_wrap_trim:N \l__iow_line_part_tl }
    \bool_set_false:N \l__iow_line_break_bool
    \tl_if_empty:NTF \l__iow_line_part_tl
      { \__iow_wrap_chunk:nw {#1} }
      { \exp_args:Nf \__iow_wrap_chunk:nw { \int_eval:n { #1 + 1 } } }
  }
\cs_new_protected:Npn \__iow_wrap_indent:n #1
  {
    \tl_put_right:Nx \l__iow_line_tl { \l__iow_line_part_tl }
    \bool_set_false:N \l__iow_line_break_bool
    \int_add:Nn \l__iow_indent_int { \l__iow_one_indent_int }
    \tl_put_right:No \l__iow_indent_tl { \l__iow_one_indent_tl }
    \__iow_wrap_chunk:nw {#1}
  }
\cs_new_protected:Npn \__iow_wrap_unindent:n #1
  {
    \tl_put_right:Nx \l__iow_line_tl { \l__iow_line_part_tl }
    \bool_set_false:N \l__iow_line_break_bool
    \int_sub:Nn \l__iow_indent_int { \l__iow_one_indent_int }
    \__kernel_tl_set:Nx \l__iow_indent_tl
      { \exp_after:wN \__iow_unindent:w \l__iow_indent_tl }
    \__iow_wrap_chunk:nw {#1}
  }
\cs_new_protected:Npn \__iow_wrap_newline:n #1
  {
    \bool_if:NF \l__iow_line_break_bool
      { \__iow_wrap_store_do:n { \__iow_wrap_trim:N } }
    \bool_set_false:N \l__iow_line_break_bool
    \__iow_wrap_chunk:nw { \l__iow_line_target_int }
  }
\cs_new_protected:Npn \__iow_wrap_end:n #1
  {
    \bool_if:NF \l__iow_line_break_bool
      { \__iow_wrap_store_do:n { \__iow_wrap_trim:N } }
    \bool_set_false:N \l__iow_line_break_bool
  }
\cs_new_protected:Npn \__iow_wrap_store_do:n #1
  {
    \__kernel_tl_set:Nx \l__iow_line_tl
      { \l__iow_line_tl \l__iow_line_part_tl }
    \__kernel_tl_set:Nx \l__iow_wrap_tl
      {
        \l__iow_wrap_tl
        \l__iow_newline_tl
        #1 \l__iow_line_tl
      }
    \tl_clear:N \l__iow_line_tl
  }
\cs_set_protected:Npn \__iow_tmp:w #1
  {
    \cs_new:Npn \__iow_wrap_trim:N ##1
      { \exp_after:wN \__iow_wrap_trim:w ##1 \s__iow_mark #1 \s__iow_mark \s__iow_stop }
    \cs_new:Npn \__iow_wrap_trim:w ##1 #1 \s__iow_mark
      { \__iow_wrap_trim_aux:w ##1 \s__iow_mark }
    \cs_new:Npn \__iow_wrap_trim_aux:w ##1 \s__iow_mark ##2 \s__iow_stop {##1}
  }
\exp_args:NV \__iow_tmp:w \c_catcode_other_space_tl
\tl_new:N \l__file_internal_tl
\str_new:N \g_file_curr_dir_str
\str_new:N \g_file_curr_ext_str
\str_new:N \g_file_curr_name_str
\seq_new:N \g__file_stack_seq
\group_begin:
  \cs_set_protected:Npn \__file_tmp:w #1#2#3
    {
      \tl_if_blank:nTF {#1}
        {
          \cs_set:Npn \__file_tmp:w ##1 " ##2 " ##3 \s__file_stop
            { { } {##2} {  } }
          \seq_gput_right:Nx \g__file_stack_seq
            {
              \exp_after:wN \__file_tmp:w \tex_jobname:D
                " \tex_jobname:D " \s__file_stop
            }
        }
        {
          \seq_gput_right:Nn \g__file_stack_seq { { } {#1} {#2} }
          \__file_tmp:w
        }
    }
  \cs_if_exist:NT \@currnamestack
    {
      \tl_if_empty:NF \@currnamestack
        { \exp_after:wN \__file_tmp:w \@currnamestack }
    }
\group_end:
\seq_new:N \g__file_record_seq
\tl_new:N \l__file_base_name_tl
\tl_new:N \l__file_full_name_tl
\str_new:N \l__file_dir_str
\str_new:N \l__file_ext_str
\str_new:N \l__file_name_str
\seq_new:N \l_file_search_path_seq
\seq_new:N \l__file_tmp_seq
\scan_new:N \s__file_stop
\quark_new:N \q__file_nil
\__kernel_quark_new_conditional:Nn \__file_quark_if_nil:n { TF }
\quark_new:N \q__file_recursion_tail
\quark_new:N \q__file_recursion_stop
\__kernel_quark_new_test:N \__file_if_recursion_tail_stop:N
\__kernel_quark_new_test:N \__file_if_recursion_tail_stop_do:nn
\cs_new:Npn \__kernel_file_name_sanitize:n #1
  {
    \exp_args:Ne \__kernel_file_name_trim_spaces:n
      {
        \exp_args:Ne \__kernel_file_name_strip_quotes:n
          {
            \__kernel_file_name_expand_loop:w #1
              \q__file_recursion_tail \q__file_recursion_stop
          }
      }
  }
\cs_new:Npn \__kernel_file_name_expand_loop:w #1 \q__file_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#1}
      { \__kernel_file_name_expand_N_type:Nw }
      {
        \tl_if_head_is_group:nTF {#1}
          { \__kernel_file_name_expand_group:nw }
          { \__kernel_file_name_expand_space:w }
      }
    #1 \q__file_recursion_stop
  }
\cs_new:Npn \__kernel_file_name_expand_N_type:Nw #1
  {
    \__file_if_recursion_tail_stop:N #1
    \bool_lazy_and:nnTF
      { \token_if_expandable_p:N #1 }
      {
        \bool_not_p:n
          {
            \bool_lazy_any_p:n
              {
                { \token_if_protected_macro_p:N #1 }
                { \token_if_protected_long_macro_p:N #1 }
                { \token_if_active_p:N #1 }
              }
          }
      }
      { \exp_after:wN \__kernel_file_name_expand_loop:w #1 }
      {
        \token_to_str:N #1
        \__kernel_file_name_expand_loop:w
      }
  }
\cs_new:Npx \__kernel_file_name_expand_group:nw #1
  {
    \c_left_brace_str
    \exp_not:N \__kernel_file_name_expand_loop:w
     #1
     \c_right_brace_str
  }
\exp_last_unbraced:NNo
  \cs_new:Npx \__kernel_file_name_expand_space:w \c_space_tl
    {
      \c_space_tl
      \exp_not:N \__kernel_file_name_expand_loop:w
    }
\cs_new:Npn \__kernel_file_name_strip_quotes:n #1
  {
    \__kernel_file_name_strip_quotes:nnnw {#1} { 0 } { }
      #1 " \q__file_recursion_tail " \q__file_recursion_stop
  }
\cs_new:Npn \__kernel_file_name_strip_quotes:nnnw #1#2#3#4 "
  {
    \__file_if_recursion_tail_stop_do:nn {#4}
      { \__kernel_file_name_strip_quotes:nnn {#1} {#2} {#3} }
    \__kernel_file_name_strip_quotes:nnnw {#1} { #2 + 1 } { #3#4 }
  }
\cs_new:Npn \__kernel_file_name_strip_quotes:nnn #1#2#3
  {
    \int_if_even:nT {#2}
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { unbalanced-quote-in-filename } {#1}
      }
    #3
  }
\cs_new:Npn \__kernel_file_name_trim_spaces:n #1
  { \__kernel_file_name_trim_spaces:nw {#1} #1 . \q__file_nil . \s__file_stop }
\cs_new:Npn \__kernel_file_name_trim_spaces:nw #1#2 . #3 . #4 \s__file_stop
  {
    \__file_quark_if_nil:nTF {#3}
      {
        \exp_args:Ne \__kernel_file_name_trim_spaces_aux:n
          { \tl_trim_spaces:n { #1 \s__file_stop } }
      }
      { \tl_trim_spaces:n {#1} }
  }
\cs_new:Npn \__kernel_file_name_trim_spaces_aux:n #1
  { \__kernel_file_name_trim_spaces_aux:w #1 }
\cs_new:Npn \__kernel_file_name_trim_spaces_aux:w #1 \s__file_stop {#1}
\cs_new:Npn \__kernel_file_name_quote:n #1
  { \__kernel_file_name_quote:nw {#1} #1 ~ \q__file_nil \s__file_stop }
\cs_new:Npn \__kernel_file_name_quote:nw #1 #2 ~ #3 \s__file_stop
  {
    \__file_quark_if_nil:nTF {#3}
      { #1 }
      { "#1" }
  }
\tl_const:Nx \c__file_marker_tl { : \token_to_str:N : }
\cs_new_protected:Npn \file_get:nnN #1#2#3
  {
    \file_get:nnNF {#1} {#2} #3
      { \tl_set:Nn #3 { \q_no_value } }
  }
\prg_new_protected_conditional:Npnn \file_get:nnN #1#2#3 { T , F , TF }
  {
    \file_get_full_name:nNTF {#1} \l__file_full_name_tl
      {
        \exp_args:NV \__file_get_aux:nnN
          \l__file_full_name_tl
          {#2} #3
        \prg_return_true:
      }
      { \prg_return_false: }
  }
\cs_new_protected:Npx \__file_get_aux:nnN #1#2#3
  {
    \exp_not:N \if_false: { \exp_not:N \fi:
    \group_begin:
      \int_set_eq:NN \tex_tracingnesting:D \c_zero_int
      \exp_not:N \exp_args:No \tex_everyeof:D
        { \exp_not:N \c__file_marker_tl }
      #2 \scan_stop:
      \exp_not:N \exp_after:wN \exp_not:N \__file_get_do:Nw
      \exp_not:N \exp_after:wN #3
      \exp_not:N \exp_after:wN \exp_not:N \prg_do_nothing:
      \exp_not:N \tex_input:D
      \sys_if_engine_luatex:TF
        { {#1} }
        { \exp_not:N \__kernel_file_name_quote:n {#1} \scan_stop: }
    \exp_not:N \if_false: } \exp_not:N \fi:
  }
\exp_args:Nno \use:nn
  { \cs_new_protected:Npn \__file_get_do:Nw #1#2 }
  { \c__file_marker_tl }
  {
    \group_end:
    \tl_set:No #1 {#2}
  }
\cs_new_eq:NN \__file_size:n \tex_filesize:D
\cs_new:Npn \file_full_name:n #1
  {
    \exp_args:Ne \__file_full_name:n
      { \__kernel_file_name_sanitize:n {#1} }
  }
\cs_new:Npn \__file_full_name:n #1
  {
    \tl_if_blank:nF {#1}
      {
        \tl_if_blank:eTF { \__file_size:n {#1} }
          {
            \seq_map_tokens:Nn \l_file_search_path_seq
              { \__file_full_name_aux:Nnn \seq_map_break:n {#1} }
            \cs_if_exist:NT \input@path
              {
                \tl_map_tokens:Nn \input@path
                  { \__file_full_name_aux:Nnn \tl_map_break:n {#1} }
              }
            \__file_name_end:
          }
          { \__file_ext_check:n {#1} }
      }
  }
\cs_new:Npn \__file_full_name_aux:Nnn #1#2#3
  { \exp_args:Ne \__file_full_name_aux:nN { \tl_to_str:n {#3} / #2 } #1 }
\cs_new:Npn \__file_full_name_aux:nN #1 #2
  {
    \tl_if_blank:eF { \__file_size:n {#1} }
      {
        #2
          {
            \__file_ext_check:n {#1}
            \__file_name_cleanup:w
          }
      }
  }
\cs_new:Npn \__file_name_cleanup:w #1 \__file_name_end: { }
\cs_new:Npn \__file_name_end: { }
\cs_new:Npn \__file_ext_check:n #1
  { \__file_ext_check:nw { / } #1 / \q__file_nil / \s__file_stop }
\cs_new:Npn \__file_ext_check:nw #1 #2 / #3 / #4 \s__file_stop
  {
    \__file_quark_if_nil:nTF {#3}
      {
        \exp_args:No \__file_ext_check:nnw
          { \use_none:n #1 } {#2} #2 . \q__file_nil . \s__file_stop
      }
      { \__file_ext_check:nw { #1 #2 / } #3 / #4 \s__file_stop }
  }
\cs_new:Npx \__file_ext_check:nnw #1#2#3 . #4 . #5 \s__file_stop
  {
    \exp_not:N \__file_quark_if_nil:nTF {#4}
      {
        \exp_not:N \__file_ext_check:nn
          { #1 #2 } { #1 #2 \tl_to_str:n { .tex } }
      }
      { #1 #2 }
  }
\cs_new:Npn \__file_ext_check:nn #1#2
  {
    \tl_if_blank:eTF { \__file_size:n {#2} }
      {#1}
      {
        \int_compare:nNnTF
          { \__file_size:n {#1} } = { \__file_size:n {#2} }
          {#2}
          {#1}
      }
  }
\cs_if_exist:NF \tex_filesize:D
  {
    \cs_gset:Npn \file_full_name:n #1
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { primitive-not-available }
          { \(pdf)filesize }
      }
  }
\__kernel_msg_new:nnnn { kernel } { primitive-not-available }
  { Primitive~\token_to_str:N #1 not~available }
  {
    The~version~of~your~TeX~engine~does~not~provide~functionality~equivalent~to~
    the~#1~primitive.
  }
\cs_new_protected:Npn \file_get_full_name:nN #1#2
  {
    \file_get_full_name:nNF {#1} #2
      { \tl_set:Nn #2 { \q_no_value } }
  }
\cs_generate_variant:Nn \file_get_full_name:nN { V }
\prg_new_protected_conditional:Npnn \file_get_full_name:nN #1#2 { T , F , TF }
  {
    \__kernel_tl_set:Nx #2
      { \file_full_name:n {#1} }
    \tl_if_empty:NTF #2
      { \prg_return_false: }
      { \prg_return_true: }
  }
\cs_generate_variant:Nn \file_get_full_name:nNT  { V }
\cs_generate_variant:Nn \file_get_full_name:nNF  { V }
\cs_generate_variant:Nn \file_get_full_name:nNTF { V }
\cs_if_exist:NF \tex_filesize:D
  {
    \prg_set_protected_conditional:Npnn \file_get_full_name:nN #1#2 { T , F , TF }
      {
        \__kernel_tl_set:Nx \l__file_base_name_tl
          { \__kernel_file_name_sanitize:n {#1} }
        \__file_get_full_name_search:nN { } \use:n
        \seq_map_inline:Nn \l_file_search_path_seq
          { \__file_get_full_name_search:nN { ##1 / } \seq_map_break:n }
        \cs_if_exist:NT \input@path
          {
            \tl_map_inline:Nn \input@path
              { \__file_get_full_name_search:nN { ##1 } \tl_map_break:n }
          }
        \tl_set:Nn \l__file_full_name_tl { \q_no_value }
        \prg_break_point:
        \quark_if_no_value:NTF \l__file_full_name_tl
          {
            \ior_close:N \g__file_internal_ior
            \prg_return_false:
          }
          {
            \file_parse_full_name:VNNN \l__file_full_name_tl
              \l__file_dir_str \l__file_name_str \l__file_ext_str
            \str_if_empty:NT \l__file_ext_str
              {
                \__kernel_ior_open:No \g__file_internal_ior
                  { \l__file_full_name_tl .tex }
                \ior_if_eof:NF \g__file_internal_ior
                   { \tl_put_right:Nn \l__file_full_name_tl { .tex } }
              }
            \ior_close:N \g__file_internal_ior
            \tl_set_eq:NN #2 \l__file_full_name_tl
            \prg_return_true:
          }
      }
  }
\cs_new_protected:Npn \__file_get_full_name_search:nN #1#2
  {
    \__kernel_tl_set:Nx \l__file_full_name_tl
      { \tl_to_str:n {#1} \l__file_base_name_tl }
    \__kernel_ior_open:No \g__file_internal_ior \l__file_full_name_tl
    \ior_if_eof:NF \g__file_internal_ior { #2 { \prg_break: } }
  }
\ior_new:N \g__file_internal_ior
\cs_new:Npn \file_size:n #1
  { \__file_details:nn {#1} { size } }
\cs_new:Npn \file_timestamp:n #1
  { \__file_details:nn {#1} { moddate } }
\cs_new:Npn \__file_details:nn #1#2
  {
    \exp_args:Ne \__file_details_aux:nn
      { \file_full_name:n {#1} } {#2}
  }
\cs_new:Npn \__file_details_aux:nn #1#2
  {
    \tl_if_blank:nF {#1}
      { \use:c { tex_file #2 :D } {#1} }
  }
\cs_new:Npn \file_mdfive_hash:n #1
  { \exp_args:Ne \__file_mdfive_hash:n { \file_full_name:n {#1} } }
\cs_new:Npn \__file_mdfive_hash:n #1
  { \tex_mdfivesum:D file {#1} }
\cs_new:Npn \file_hex_dump:nnn #1#2#3
  {
    \exp_args:Neee \__file_hex_dump_auxi:nnn
      { \file_full_name:n {#1} }
      { \int_eval:n {#2} }
      { \int_eval:n {#3} }
  }
\cs_new:Npn \__file_hex_dump_auxi:nnn #1#2#3
  {
    \bool_lazy_any:nF
      {
        { \tl_if_blank_p:n {#1} }
        { \int_compare_p:nNn {#2} = 0 }
        { \int_compare_p:nNn {#3} = 0 }
      }
      {
        \exp_args:Ne \__file_hex_dump_auxii:nnnn
          { \__file_details_aux:nn {#1} { size } }
          {#1} {#2} {#3}
      }
  }
\cs_new:Npn \__file_hex_dump_auxii:nnnn #1#2#3#4
  {
    \int_compare:nNnTF {#3} > 0
      { \__file_hex_dump_auxiii:nnnn {#3} }
      {
        \exp_args:Ne \__file_hex_dump_auxiii:nnnn
          { \int_eval:n { #1 + #3 } }
      }
        {#1} {#2} {#4}
  }
\cs_new:Npn \__file_hex_dump_auxiii:nnnn #1#2#3#4
  {
    \int_compare:nNnTF {#4} > 0
      { \__file_hex_dump_auxiv:nnn {#4} }
      {
        \exp_args:Ne \__file_hex_dump_auxiv:nnn
          { \int_eval:n { #2 + #4 } }
      }
        {#1} {#3}
  }
\cs_new:Npn \__file_hex_dump_auxiv:nnn #1#2#3
  {
    \tex_filedump:D
      offset ~ \int_eval:n { #2 - 1 } ~
      length ~ \int_eval:n { #1 - #2 + 1 }
      {#3}
  }
\cs_new:Npn \file_hex_dump:n #1
  { \exp_args:Ne \__file_hex_dump:n { \file_full_name:n {#1} } }
\sys_if_engine_luatex:TF
  {
    \cs_new:Npn \__file_hex_dump:n #1
      {
        \tl_if_blank:nF {#1}
          { \tex_filedump:D whole {#1} {#1} }
      }
  }
  {
    \cs_new:Npn \__file_hex_dump:n #1
      {
        \tl_if_blank:nF {#1}
          { \tex_filedump:D length \tex_filesize:D {#1} {#1} }
      }
  }
\cs_new_protected:Npn \file_get_hex_dump:nN #1#2
  { \file_get_hex_dump:nNF {#1} #2 { \tl_set:Nn #2 { \q_no_value } } }
\cs_new_protected:Npn \file_get_mdfive_hash:nN #1#2
  { \file_get_mdfive_hash:nNF {#1} #2 { \tl_set:Nn #2 { \q_no_value } } }
\cs_new_protected:Npn \file_get_size:nN #1#2
  { \file_get_size:nNF {#1} #2 { \tl_set:Nn #2 { \q_no_value } } }
\cs_new_protected:Npn \file_get_timestamp:nN #1#2
  { \file_get_timestamp:nNF {#1} #2 { \tl_set:Nn #2 { \q_no_value } } }
\prg_new_protected_conditional:Npnn \file_get_hex_dump:nN #1#2 { T , F , TF }
  { \__file_get_details:nnN {#1} { hex_dump } #2 }
\prg_new_protected_conditional:Npnn \file_get_mdfive_hash:nN #1#2 { T , F , TF }
  { \__file_get_details:nnN {#1} { mdfive_hash } #2 }
\prg_new_protected_conditional:Npnn \file_get_size:nN #1#2 { T , F , TF }
  { \__file_get_details:nnN {#1} { size } #2 }
\prg_new_protected_conditional:Npnn \file_get_timestamp:nN #1#2 { T , F , TF }
  { \__file_get_details:nnN {#1} { timestamp } #2 }
\cs_new_protected:Npn \__file_get_details:nnN #1#2#3
  {
    \__kernel_tl_set:Nx #3
      { \use:c { file_ #2 :n } {#1} }
    \tl_if_empty:NTF #3
      { \prg_return_false: }
      { \prg_return_true: }
  }
\cs_if_exist:NF \tex_filesize:D
  {
    \cs_set_protected:Npn \__file_get_details:nnN #1#2#3
       {
        \tl_clear:N #3
        \__kernel_msg_error:nnx
          { kernel } { primitive-not-available }
          {
            \token_to_str:N \(pdf)file
            \str_case:nn {#2}
              {
                { hex_dump } { dump }
                { mdfive_hash } { mdfivesum }
                { timestamp } { moddate }
                { size } { size }
              }
          }
        \prg_return_false:
      }
  }
\cs_new_protected:Npn \file_get_hex_dump:nnnN #1#2#3#4
  {
    \file_get_hex_dump:nnnNF {#1} {#2} {#3} #4
      { \tl_set:Nn #4 { \q_no_value } }
  }
\prg_new_protected_conditional:Npnn \file_get_hex_dump:nnnN #1#2#3#4
  { T , F , TF }
  {
    \__kernel_tl_set:Nx #4
      { \file_hex_dump:nnn {#1} {#2} {#3} }
    \tl_if_empty:NTF #4
      { \prg_return_false: }
      { \prg_return_true: }
  }
\cs_new_eq:NN \__file_str_cmp:nn \tex_strcmp:D
\prg_new_conditional:Npnn \file_compare_timestamp:nNn #1#2#3
  { p , T , F , TF }
  {
    \exp_args:Nee \__file_compare_timestamp:nnN
      { \file_full_name:n {#1} }
      { \file_full_name:n {#3} }
      #2
   }
\cs_new:Npn \__file_compare_timestamp:nnN #1#2#3
  {
    \tl_if_blank:nTF {#1}
      {
        \if_charcode:w #3 <
          \prg_return_true:
        \else:
          \prg_return_false:
        \fi:
      }
      {
        \tl_if_blank:nTF {#2}
          {
             \if_charcode:w #3 >
                \prg_return_true:
              \else:
                \prg_return_false:
              \fi:
          }
          {
            \if_int_compare:w
              \__file_str_cmp:nn
                { \__file_timestamp:n {#1} }
                { \__file_timestamp:n {#2} }
                #3 0 \exp_stop_f:
              \prg_return_true:
            \else:
              \prg_return_false:
            \fi:
          }
      }
  }
\cs_new_eq:NN \__file_timestamp:n \tex_filemoddate:D
\cs_if_exist:NF \__file_timestamp:n
  {
    \prg_set_conditional:Npnn \file_compare_timestamp:nNn #1#2#3
      { p , T , F , TF }
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { primitive-not-available }
          { \(pdf)filemoddate }
        \prg_return_false:
      }
  }
\prg_new_protected_conditional:Npnn \file_if_exist:n #1 { T , F , TF }
  {
    \file_get_full_name:nNTF {#1} \l__file_full_name_tl
      { \prg_return_true: }
      { \prg_return_false: }
  }
\cs_new_protected:Npn \file_if_exist_input:n #1
  {
    \file_get_full_name:nNT {#1} \l__file_full_name_tl
      { \__file_input:V \l__file_full_name_tl }
  }
\cs_new_protected:Npn \file_if_exist_input:nF #1#2
  {
    \file_get_full_name:nNTF {#1} \l__file_full_name_tl
      { \__file_input:V \l__file_full_name_tl }
      {#2}
  }
\cs_new_protected:Npn \file_input_stop: { \tex_endinput:D }
\cs_new_protected:Npn \__kernel_file_missing:n #1
  {
    \__kernel_msg_error:nnx { kernel } { file-not-found }
      { \__kernel_file_name_sanitize:n {#1} }
  }
\cs_new_protected:Npn \file_input:n #1
  {
    \file_get_full_name:nNTF {#1} \l__file_full_name_tl
      { \__file_input:V \l__file_full_name_tl }
      { \__kernel_file_missing:n {#1} }
  }
\cs_new_protected:Npx \__file_input:n #1
  {
    \exp_not:N \clist_if_exist:NTF \exp_not:N \@filelist
      { \exp_not:N \@addtofilelist {#1} }
      { \seq_gput_right:Nn \exp_not:N \g__file_record_seq {#1} }
    \exp_not:N \__file_input_push:n {#1}
    \exp_not:N \tex_input:D
    \sys_if_engine_luatex:TF
      { {#1} }
      { \exp_not:N \__kernel_file_name_quote:n {#1} \scan_stop: }
    \exp_not:N \__file_input_pop:
  }
\cs_generate_variant:Nn \__file_input:n { V }
\cs_new_protected:Npn \__file_input_push:n #1
  {
    \seq_gpush:Nx \g__file_stack_seq
      {
        { \g_file_curr_dir_str }
        { \g_file_curr_name_str }
        { \g_file_curr_ext_str }
      }
    \file_parse_full_name:nNNN {#1}
      \l__file_dir_str \l__file_name_str \l__file_ext_str
    \str_gset_eq:NN \g_file_curr_dir_str  \l__file_dir_str
    \str_gset_eq:NN \g_file_curr_name_str \l__file_name_str
    \str_gset_eq:NN \g_file_curr_ext_str  \l__file_ext_str
  }
\cs_new_eq:NN \__kernel_file_input_push:n \__file_input_push:n
\cs_new_protected:Npn \__file_input_pop:
  {
    \seq_gpop:NN \g__file_stack_seq \l__file_internal_tl
    \exp_after:wN \__file_input_pop:nnn \l__file_internal_tl
  }
\cs_new_eq:NN \__kernel_file_input_pop: \__file_input_pop:
\cs_new_protected:Npn \__file_input_pop:nnn #1#2#3
  {
    \str_gset:Nn \g_file_curr_dir_str  {#1}
    \str_gset:Nn \g_file_curr_name_str {#2}
    \str_gset:Nn \g_file_curr_ext_str  {#3}
  }
\cs_new:Npn \file_parse_full_name:n #1
  {
    \file_parse_full_name_apply:nN {#1}
      \prg_do_nothing:
  }
\cs_new:Npn \file_parse_full_name_apply:nN #1
  {
    \exp_args:Ne \__file_parse_full_name_auxi:nN
      { \__kernel_file_name_sanitize:n {#1} }
  }
\cs_new:Npn \__file_parse_full_name_auxi:nN #1
  {
    \__file_parse_full_name_area:nw { } #1
      / \s__file_stop
  }
\cs_new:Npn \__file_parse_full_name_area:nw #1 #2 / #3 \s__file_stop
  {
    \tl_if_empty:nTF {#3}
      { \__file_parse_full_name_base:nw { } #2 . \s__file_stop {#1} }
      { \__file_parse_full_name_area:nw { #1 / #2 } #3 \s__file_stop }
  }
\cs_new:Npn \__file_parse_full_name_base:nw #1 #2 . #3 \s__file_stop
  {
    \tl_if_empty:nTF {#3}
      {
        \tl_if_empty:nTF {#1}
          {
            \tl_if_empty:nTF {#2}
              { \__file_parse_full_name_tidy:nnnN { } { } }
              { \__file_parse_full_name_tidy:nnnN { .#2 } { } }
          }
          { \__file_parse_full_name_tidy:nnnN {#1} { .#2 } }
      }
      { \__file_parse_full_name_base:nw { #1 . #2 } #3 \s__file_stop }
  }
\cs_new:Npn \__file_parse_full_name_tidy:nnnN #1 #2 #3 #4
  {
    \exp_args:Nee #4
      {
        \str_if_eq:nnF {#3} { / } { \use_none:n }
        #3 \prg_do_nothing:
      }
      { \use_none:n #1 \prg_do_nothing: }
      {#2}
  }
\cs_new_protected:Npn \file_parse_full_name:nNNN #1 #2 #3 #4
  {
    \file_parse_full_name_apply:nN {#1}
      \__file_full_name_assign:nnnNNN #2 #3 #4
  }
\cs_new_protected:Npn \__file_full_name_assign:nnnNNN #1 #2 #3 #4 #5 #6
  {
    \str_set:Nn #4 {#1}
    \str_set:Nn #5 {#2}
    \str_set:Nn #6 {#3}
  }
\cs_generate_variant:Nn \file_parse_full_name:nNNN { V }
\cs_new_protected:Npn \file_show_list: { \__file_list:N \msg_show:nnxxxx }
\cs_new_protected:Npn \file_log_list: { \__file_list:N \msg_log:nnxxxx }
\cs_new_protected:Npn \__file_list:N #1
  {
    \seq_clear:N \l__file_tmp_seq
    \clist_if_exist:NT \@filelist
      {
        \exp_args:NNx \seq_set_from_clist:Nn \l__file_tmp_seq
          { \tl_to_str:N \@filelist }
      }
    \seq_concat:NNN \l__file_tmp_seq \l__file_tmp_seq \g__file_record_seq
    \seq_remove_duplicates:N \l__file_tmp_seq
    #1 { LaTeX/kernel } { file-list }
      { \seq_map_function:NN \l__file_tmp_seq \__file_list_aux:n }
        { } { } { }
  }
\cs_new:Npn \__file_list_aux:n #1 { \iow_newline: #1 }
\cs_if_exist:NT \@filelist
  {
    \AtBeginDocument
      {
        \exp_args:NNx \seq_set_from_clist:Nn \l__file_tmp_seq
          { \tl_to_str:N \@filelist }
        \seq_gconcat:NNN
          \g__file_record_seq
          \g__file_record_seq
          \l__file_tmp_seq
      }
  }
\cs_new_protected:Npn \GetIdInfo
  {
    \tl_clear_new:N \ExplFileDescription
    \tl_clear_new:N \ExplFileDate
    \tl_clear_new:N \ExplFileName
    \tl_clear_new:N \ExplFileExtension
    \tl_clear_new:N \ExplFileVersion
    \group_begin:
    \char_set_catcode_space:n { 32 }
    \exp_after:wN
    \group_end:
    \__file_id_info_auxi:w
  }
\cs_new_protected:Npn \__file_id_info_auxi:w $ #1 $ #2
  {
    \tl_set:Nn \ExplFileDescription {#2}
    \str_if_eq:nnTF {#1} { Id }
      {
        \tl_set:Nn \ExplFileDate { 0000/00/00 }
        \tl_set:Nn \ExplFileName { [unknown] }
        \tl_set:Nn \ExplFileExtension { [unknown~extension] }
        \tl_set:Nn \ExplFileVersion {-1}
      }
      { \__file_id_info_auxii:w #1 ~ \s__file_stop }
  }
\cs_new_protected:Npn \__file_id_info_auxii:w
    #1 ~ #2.#3 ~ #4 ~ #5 ~ #6 \s__file_stop
  {
    \tl_set:Nn \ExplFileName {#2}
    \tl_set:Nn \ExplFileExtension {#3}
    \tl_set:Nn \ExplFileVersion {#4}
    \str_if_eq:nnTF {#4} {-1}
      { \tl_set:Nn \ExplFileDate { 0000/00/00 } }
      { \__file_id_info_auxiii:w #5 - 0 - 0 - \s__file_stop }
  }
\cs_new_protected:Npn \__file_id_info_auxiii:w #1 - #2 - #3 - #4 \s__file_stop
  { \tl_set:Nn \ExplFileDate { #1/#2/#3 } }
\cs_new_protected:Npn \__kernel_dependency_version_check:Nn #1
  { \exp_args:NV \__kernel_dependency_version_check:nn #1 }
\cs_new_protected:Npn \__kernel_dependency_version_check:nn #1
  {
    \cs_if_exist:NTF \c__kernel_expl_date_tl
      {
        \exp_args:NV \__file_kernel_dependency_compare:nnn
          \c__kernel_expl_date_tl {#1}
       }
       { \__file_kernel_dependency_compare:nnn { 0000-00-00 } {#1} }
  }
\cs_new_protected:Npn \__file_kernel_dependency_compare:nnn #1 #2 #3
  {
    \int_compare:nNnT
        { \__file_parse_version:w #1 \s__file_stop } <
        { \__file_parse_version:w #2 \s__file_stop }
      { \__file_mismatched_dependency_error:nn {#2} {#3} }
  }
\cs_new:Npn \__file_parse_version:w #1 - #2 - #3 \s__file_stop {#1#2#3}
\cs_new_protected:Npn \__file_mismatched_dependency_error:nn #1 #2
  {
    \exp_args:NNx \ior_shell_open:Nn \g__file_internal_ior
      {
        kpsewhich ~ --all ~
          --engine = \c_sys_engine_exec_str
          \c_space_tl \c_sys_engine_format_str
            \bool_lazy_and:nnF
                { \tl_if_exist_p:N \development@branch@name }
                { ! \tl_if_empty_p:N \development@branch@name }
              { -dev } .fmt
      }
    \seq_clear:N \l__file_tmp_seq
    \ior_map_inline:Nn \g__file_internal_ior
      { \seq_put_right:Nn \l__file_tmp_seq {##1} }
    \ior_close:N \g__file_internal_ior
    \__kernel_msg_error:nnnn { kernel } { mismatched-support-file }
      {#1} {#2}
    \tex_endinput:D
  }
\__kernel_msg_new:nnnn { kernel } { mismatched-support-file }
  {
    Mismatched~LaTeX~support~files~detected. \\
    Loading~'#2'~aborted!
    \tl_if_exist:NT \c__kernel_expl_date_tl
      {
        \\ \\
        The~L3~programming~layer~in~the~LaTeX~format \\
        is~dated~\c__kernel_expl_date_tl,~but~in~your~TeX~
        tree~the~files~require \\ at~least~#1.
      }
  }
  {
    \int_compare:nNnTF { \seq_count:N \l__file_tmp_seq } > 1
      {
        The~cause~seems~to~be~an~old~format~file~in~the~user~tree. \\
        LaTeX~found~these~files:
        \seq_map_tokens:Nn \l__file_tmp_seq { \\~-~\use:n } \\
        Try~deleting~the~file~in~the~user~tree~then~run~LaTeX~again.
      }
      {
        The~most~likely~causes~are:
        \\~-~A~recent~format~generation~failed;
        \\~-~A~stray~format~file~in~the~user~tree~which~needs~
             to~be~removed~or~rebuilt;
        \\~-~You~are~running~a~manually~installed~version~of~#2 \\
        \ \ \ which~is~incompatible~with~the~version~in~LaTeX. \\
      }
    \\
    LaTeX~will~abort~loading~the~incompatible~support~files~
    but~this~may~lead~to \\ later~errors.~Please~ensure~that~
    your~LaTeX~format~is~correctly~regenerated.
  }
\__kernel_msg_new:nnnn { kernel } { file-not-found }
  { File~'#1'~not~found. }
  {
    The~requested~file~could~not~be~found~in~the~current~directory,~
    in~the~TeX~search~path~or~in~the~LaTeX~search~path.
  }
\__kernel_msg_new:nnn { kernel } { file-list }
  {
    >~File~List~<
    #1 \\
    .............
  }
\__kernel_msg_new:nnnn { kernel } { unbalanced-quote-in-filename }
  { Unbalanced~quotes~in~file~name~'#1'. }
  {
    File~names~must~contain~balanced~numbers~of~quotes~(").
  }
\__kernel_msg_new:nnnn { kernel } { iow-indent }
  { Only~#1 (arg~1)~allows~#2 }
  {
    The~command~#2 can~only~be~used~in~messages~
    which~will~be~wrapped~using~#1.
    \tl_if_empty:nF {#3} { ~ It~was~called~with~argument~'#3'. }
  }
\sys_if_engine_luatex:TF
  {
    \str_const:Nx \c_sys_platform_str
      { \tex_directlua:D { tex.print(os.type) } }
  }
  {
    \file_if_exist:nTF { nul: }
      {
        \file_if_exist:nF { /dev/null }
          { \str_const:Nn \c_sys_platform_str { windows } }
      }
      {
        \file_if_exist:nT { /dev/null }
          { \str_const:Nn \c_sys_platform_str { unix } }
      }
  }
\cs_if_exist:NF \c_sys_platform_str
  { \str_const:Nn \c_sys_platform_str { unknown }  }
\clist_map_inline:nn { unix , windows }
  {
    \__sys_const:nn { sys_if_platform_ #1 }
      { \str_if_eq_p:Vn \c_sys_platform_str { #1 } }
  }
%% File: l3skip.dtx
\cs_new_eq:NN \if_dim:w      \tex_ifdim:D
\cs_new_eq:NN \__dim_eval:w      \tex_dimexpr:D
\cs_new_eq:NN \__dim_eval_end:   \tex_relax:D
\scan_new:N \s__dim_mark
\scan_new:N \s__dim_stop
\cs_new:Npn \__dim_use_none_delimit_by_s_stop:w #1 \s__dim_stop { }
\cs_new_protected:Npn \dim_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs:w newdimen \cs_end: #1
  }
\cs_generate_variant:Nn \dim_new:N { c }
\cs_new_protected:Npn \dim_const:Nn #1#2
  {
    \dim_new:N #1
    \tex_global:D #1 ~ \dim_eval:n {#2} \scan_stop:
  }
\cs_generate_variant:Nn \dim_const:Nn { c }
\cs_new_protected:Npn \dim_zero:N #1 { #1 \c_zero_skip }
\cs_new_protected:Npn \dim_gzero:N #1
  { \tex_global:D #1 \c_zero_skip }
\cs_generate_variant:Nn \dim_zero:N  { c }
\cs_generate_variant:Nn \dim_gzero:N { c }
\cs_new_protected:Npn \dim_zero_new:N  #1
  { \dim_if_exist:NTF #1 { \dim_zero:N #1 } { \dim_new:N #1 } }
\cs_new_protected:Npn \dim_gzero_new:N #1
  { \dim_if_exist:NTF #1 { \dim_gzero:N #1 } { \dim_new:N #1 } }
\cs_generate_variant:Nn \dim_zero_new:N  { c }
\cs_generate_variant:Nn \dim_gzero_new:N { c }
\prg_new_eq_conditional:NNn \dim_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \dim_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\cs_new_protected:Npn \dim_set:Nn #1#2
  { #1 ~ \__dim_eval:w #2 \__dim_eval_end: \scan_stop: }
\cs_new_protected:Npn \dim_gset:Nn #1#2
  { \tex_global:D #1 ~ \__dim_eval:w #2 \__dim_eval_end: \scan_stop: }
\cs_generate_variant:Nn \dim_set:Nn  { c }
\cs_generate_variant:Nn \dim_gset:Nn { c }
\cs_new_protected:Npn \dim_set_eq:NN #1#2
  { #1 = #2 \scan_stop: }
\cs_generate_variant:Nn \dim_set_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \dim_gset_eq:NN #1#2
  { \tex_global:D #1 = #2 \scan_stop: }
\cs_generate_variant:Nn \dim_gset_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \dim_add:Nn #1#2
  { \tex_advance:D #1 by \__dim_eval:w #2 \__dim_eval_end: \scan_stop: }
\cs_new_protected:Npn \dim_gadd:Nn #1#2
  {
    \tex_global:D \tex_advance:D #1 by
      \__dim_eval:w #2 \__dim_eval_end: \scan_stop:
  }
\cs_generate_variant:Nn \dim_add:Nn  { c }
\cs_generate_variant:Nn \dim_gadd:Nn { c }
\cs_new_protected:Npn \dim_sub:Nn #1#2
  { \tex_advance:D #1 by - \__dim_eval:w #2 \__dim_eval_end: \scan_stop: }
\cs_new_protected:Npn \dim_gsub:Nn #1#2
  {
    \tex_global:D \tex_advance:D #1 by
      -\__dim_eval:w #2 \__dim_eval_end: \scan_stop:
  }
\cs_generate_variant:Nn \dim_sub:Nn  { c }
\cs_generate_variant:Nn \dim_gsub:Nn { c }
\cs_new:Npn \dim_abs:n #1
  {
    \exp_after:wN \__dim_abs:N
    \dim_use:N \__dim_eval:w #1 \__dim_eval_end:
  }
\cs_new:Npn \__dim_abs:N #1
  { \if_meaning:w - #1 \else: \exp_after:wN #1 \fi: }
\cs_new:Npn \dim_max:nn #1#2
  {
    \dim_use:N \__dim_eval:w \exp_after:wN \__dim_maxmin:wwN
      \dim_use:N \__dim_eval:w #1 \exp_after:wN ;
      \dim_use:N \__dim_eval:w #2 ;
      >
    \__dim_eval_end:
  }
\cs_new:Npn \dim_min:nn #1#2
  {
    \dim_use:N \__dim_eval:w \exp_after:wN \__dim_maxmin:wwN
      \dim_use:N \__dim_eval:w #1 \exp_after:wN ;
      \dim_use:N \__dim_eval:w #2 ;
      <
    \__dim_eval_end:
  }
\cs_new:Npn \__dim_maxmin:wwN #1 ; #2 ; #3
  {
    \if_dim:w #1 #3 #2 ~
      #1
    \else:
      #2
    \fi:
  }
\cs_new:Npn \dim_ratio:nn #1#2
  { \__dim_ratio:n {#1} / \__dim_ratio:n {#2} }
\cs_new:Npn \__dim_ratio:n #1
  { \int_value:w \__dim_eval:w (#1) \__dim_eval_end: }
\prg_new_conditional:Npnn \dim_compare:nNn #1#2#3 { p , T , F , TF }
  {
    \if_dim:w \__dim_eval:w #1 #2 \__dim_eval:w #3 \__dim_eval_end:
      \prg_return_true: \else: \prg_return_false: \fi:
  }
\prg_new_conditional:Npnn \dim_compare:n #1 { p , T , F , TF }
  {
    \exp_after:wN \__dim_compare:w
    \dim_use:N \__dim_eval:w #1 \__dim_compare_error:
  }
\cs_new:Npn \__dim_compare:w #1 \__dim_compare_error:
  {
    \exp_after:wN \if_false: \exp:w \exp_end_continue_f:w
      \__dim_compare:wNN #1 ? { = \__dim_compare_end:w \else: } \s__dim_stop
  }
\exp_args:Nno \use:nn
  { \cs_new:Npn \__dim_compare:wNN #1 } { \tl_to_str:n {pt} #2#3 }
  {
      \if_meaning:w = #3
        \use:c { __dim_compare_#2:w }
      \fi:
        #1 pt \exp_stop_f:
      \prg_return_false:
      \exp_after:wN \__dim_use_none_delimit_by_s_stop:w
    \fi:
    \reverse_if:N \if_dim:w #1 pt #2
      \exp_after:wN \__dim_compare:wNN
      \dim_use:N \__dim_eval:w #3
  }
\cs_new:cpn { __dim_compare_ ! :w }
    #1 \reverse_if:N #2 ! #3 = { #1 #2 = #3 }
\cs_new:cpn { __dim_compare_ = :w }
    #1 \__dim_eval:w = { #1 \__dim_eval:w }
\cs_new:cpn { __dim_compare_ < :w }
    #1 \reverse_if:N #2 < #3 = { #1 #2 > #3 }
\cs_new:cpn { __dim_compare_ > :w }
    #1 \reverse_if:N #2 > #3 = { #1 #2 < #3 }
\cs_new:Npn \__dim_compare_end:w #1 \prg_return_false: #2 \s__dim_stop
  { #1 \prg_return_false: \else: \prg_return_true: \fi: }
\cs_new_protected:Npn \__dim_compare_error:
  {
    \if_int_compare:w \c_zero_int \c_zero_int \fi:
    =
    \__dim_compare_error:
  }
\cs_new:Npn \dim_case:nnTF #1
  {
    \exp:w
    \exp_args:Nf \__dim_case:nnTF { \dim_eval:n {#1} }
  }
\cs_new:Npn \dim_case:nnT #1#2#3
  {
    \exp:w
    \exp_args:Nf \__dim_case:nnTF { \dim_eval:n {#1} } {#2} {#3} { }
  }
\cs_new:Npn \dim_case:nnF #1#2
  {
    \exp:w
    \exp_args:Nf \__dim_case:nnTF { \dim_eval:n {#1} } {#2} { }
  }
\cs_new:Npn \dim_case:nn #1#2
  {
    \exp:w
    \exp_args:Nf \__dim_case:nnTF { \dim_eval:n {#1} } {#2} { } { }
  }
\cs_new:Npn \__dim_case:nnTF #1#2#3#4
  { \__dim_case:nw {#1} #2 {#1} { } \s__dim_mark {#3} \s__dim_mark {#4} \s__dim_stop }
\cs_new:Npn \__dim_case:nw #1#2#3
  {
    \dim_compare:nNnTF {#1} = {#2}
      { \__dim_case_end:nw {#3} }
      { \__dim_case:nw {#1} }
  }
\cs_new:Npn \__dim_case_end:nw #1#2#3 \s__dim_mark #4#5 \s__dim_stop
  { \exp_end: #1 #4 }
\cs_new:Npn \dim_while_do:nn #1#2
  {
    \dim_compare:nT {#1}
      {
        #2
        \dim_while_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \dim_until_do:nn #1#2
  {
    \dim_compare:nF {#1}
      {
        #2
        \dim_until_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \dim_do_while:nn #1#2
  {
    #2
    \dim_compare:nT {#1}
      { \dim_do_while:nn {#1} {#2} }
  }
\cs_new:Npn \dim_do_until:nn #1#2
  {
    #2
    \dim_compare:nF {#1}
      { \dim_do_until:nn {#1} {#2} }
  }
\cs_new:Npn \dim_while_do:nNnn #1#2#3#4
  {
    \dim_compare:nNnT {#1} #2 {#3}
      {
        #4
        \dim_while_do:nNnn {#1} #2 {#3} {#4}
      }
  }
\cs_new:Npn \dim_until_do:nNnn #1#2#3#4
  {
  \dim_compare:nNnF {#1} #2 {#3}
    {
      #4
      \dim_until_do:nNnn {#1} #2 {#3} {#4}
    }
  }
\cs_new:Npn \dim_do_while:nNnn #1#2#3#4
  {
    #4
    \dim_compare:nNnT {#1} #2 {#3}
      { \dim_do_while:nNnn {#1} #2 {#3} {#4} }
  }
\cs_new:Npn \dim_do_until:nNnn #1#2#3#4
  {
    #4
    \dim_compare:nNnF {#1} #2 {#3}
      { \dim_do_until:nNnn {#1} #2 {#3} {#4} }
  }
\cs_new:Npn \dim_step_function:nnnN #1#2#3
  {
    \exp_after:wN \__dim_step:wwwN
    \tex_the:D \__dim_eval:w #1 \exp_after:wN ;
    \tex_the:D \__dim_eval:w #2 \exp_after:wN ;
    \tex_the:D \__dim_eval:w #3 ;
  }
\cs_new:Npn \__dim_step:wwwN #1; #2; #3; #4
  {
    \dim_compare:nNnTF {#2} > \c_zero_dim
      { \__dim_step:NnnnN > }
      {
        \dim_compare:nNnTF {#2} = \c_zero_dim
          {
            \__kernel_msg_expandable_error:nnn { kernel } { zero-step } {#4}
            \use_none:nnnn
          }
          { \__dim_step:NnnnN < }
      }
      {#1} {#2} {#3} #4
  }
\cs_new:Npn \__dim_step:NnnnN #1#2#3#4#5
  {
    \dim_compare:nNnF {#2} #1 {#4}
      {
        #5 {#2}
        \exp_args:NNf \__dim_step:NnnnN
          #1 { \dim_eval:n { #2 + #3 } } {#3} {#4} #5
      }
  }
\cs_new_protected:Npn \dim_step_inline:nnnn
  {
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:NNc \__dim_step:NNnnnn
      \cs_gset_protected:Npn
      { __dim_map_ \int_use:N \g__kernel_prg_map_int :w }
  }
\cs_new_protected:Npn \dim_step_variable:nnnNn #1#2#3#4#5
  {
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:NNc \__dim_step:NNnnnn
      \cs_gset_protected:Npx
      { __dim_map_ \int_use:N \g__kernel_prg_map_int :w }
      {#1}{#2}{#3}
      {
        \tl_set:Nn \exp_not:N #4 {##1}
        \exp_not:n {#5}
      }
  }
\cs_new_protected:Npn \__dim_step:NNnnnn #1#2#3#4#5#6
  {
    #1 #2 ##1 {#6}
    \dim_step_function:nnnN {#3} {#4} {#5} #2
    \prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__kernel_prg_map_int }
  }
\cs_new:Npn \dim_eval:n #1
  { \dim_use:N \__dim_eval:w #1 \__dim_eval_end: }
\cs_new:Npn \dim_sign:n #1
  {
    \int_value:w \exp_after:wN \__dim_sign:Nw
      \dim_use:N \__dim_eval:w #1 \__dim_eval_end: ;
    \exp_stop_f:
  }
\cs_new:Npn \__dim_sign:Nw #1#2 ;
  {
    \if_dim:w #1#2 > \c_zero_dim
      1
    \else:
      \if_meaning:w - #1
        -1
      \else:
        0
      \fi:
    \fi:
  }
\cs_new_eq:NN \dim_use:N \tex_the:D
\cs_new:Npn \dim_use:c #1 { \tex_the:D \cs:w #1 \cs_end: }
\cs_new:Npn \dim_to_decimal:n #1
  {
    \exp_after:wN
      \__dim_to_decimal:w \dim_use:N \__dim_eval:w #1 \__dim_eval_end:
  }
\use:x
  {
    \cs_new:Npn \exp_not:N \__dim_to_decimal:w
      ##1 . ##2 \tl_to_str:n { pt }
  }
      {
        \int_compare:nNnTF {#2} > { 0 }
          { #1 . #2 }
          { #1 }
      }
\cs_new:Npn \dim_to_decimal_in_bp:n #1
  { \dim_to_decimal:n { ( #1 ) * 800 / 803 } }
\cs_new:Npn \dim_to_decimal_in_sp:n #1
  { \int_value:w \__dim_eval:w #1 \__dim_eval_end: }
\cs_new:Npn \dim_to_decimal_in_unit:nn #1#2
  {
    \dim_to_decimal:n
      {
        1pt *
        \dim_ratio:nn {#1} {#2}
      }
  }
\cs_new_eq:NN  \dim_show:N \__kernel_register_show:N
\cs_generate_variant:Nn \dim_show:N { c }
\cs_new_protected:Npn \dim_show:n
  { \msg_show_eval:Nn \dim_eval:n }
\cs_new_eq:NN \dim_log:N \__kernel_register_log:N
\cs_new_eq:NN \dim_log:c \__kernel_register_log:c
\cs_new_protected:Npn \dim_log:n
  { \msg_log_eval:Nn \dim_eval:n }
\dim_const:Nn \c_zero_dim { 0 pt }
\dim_const:Nn \c_max_dim { 16383.99999 pt }
\dim_new:N \l_tmpa_dim
\dim_new:N \l_tmpb_dim
\dim_new:N \g_tmpa_dim
\dim_new:N \g_tmpb_dim
\scan_new:N \s__skip_stop
\cs_new_protected:Npn \skip_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs:w newskip \cs_end: #1
  }
\cs_generate_variant:Nn \skip_new:N { c }
\cs_new_protected:Npn \skip_const:Nn #1#2
  {
    \skip_new:N #1
    \tex_global:D #1 ~ \skip_eval:n {#2} \scan_stop:
  }
\cs_generate_variant:Nn \skip_const:Nn { c }
\cs_new_protected:Npn \skip_zero:N #1 { #1 \c_zero_skip }
\cs_new_protected:Npn \skip_gzero:N #1 { \tex_global:D #1 \c_zero_skip }
\cs_generate_variant:Nn \skip_zero:N  { c }
\cs_generate_variant:Nn \skip_gzero:N { c }
\cs_new_protected:Npn \skip_zero_new:N  #1
  { \skip_if_exist:NTF #1 { \skip_zero:N #1 } { \skip_new:N #1 } }
\cs_new_protected:Npn \skip_gzero_new:N #1
  { \skip_if_exist:NTF #1 { \skip_gzero:N #1 } { \skip_new:N #1 } }
\cs_generate_variant:Nn \skip_zero_new:N  { c }
\cs_generate_variant:Nn \skip_gzero_new:N { c }
\prg_new_eq_conditional:NNn \skip_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \skip_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\cs_new_protected:Npn \skip_set:Nn #1#2
  { #1 ~ \tex_glueexpr:D #2 \scan_stop: }
\cs_new_protected:Npn \skip_gset:Nn #1#2
  { \tex_global:D #1 ~ \tex_glueexpr:D #2 \scan_stop: }
\cs_generate_variant:Nn \skip_set:Nn  { c }
\cs_generate_variant:Nn \skip_gset:Nn { c }
\cs_new_protected:Npn \skip_set_eq:NN #1#2 { #1 = #2 }
\cs_generate_variant:Nn \skip_set_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \skip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 }
\cs_generate_variant:Nn \skip_gset_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \skip_add:Nn #1#2
  { \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: }
\cs_new_protected:Npn \skip_gadd:Nn #1#2
  { \tex_global:D \tex_advance:D #1 by \tex_glueexpr:D #2 \scan_stop: }
\cs_generate_variant:Nn \skip_add:Nn  { c }
\cs_generate_variant:Nn \skip_gadd:Nn { c }
\cs_new_protected:Npn \skip_sub:Nn #1#2
  { \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: }
\cs_new_protected:Npn \skip_gsub:Nn #1#2
  { \tex_global:D \tex_advance:D #1 by - \tex_glueexpr:D #2 \scan_stop: }
\cs_generate_variant:Nn \skip_sub:Nn  { c }
\cs_generate_variant:Nn \skip_gsub:Nn { c }
\prg_new_conditional:Npnn \skip_if_eq:nn #1#2 { p , T , F , TF }
  {
    \str_if_eq:eeTF { \skip_eval:n { #1 } } { \skip_eval:n { #2 } }
       { \prg_return_true: }
       { \prg_return_false: }
  }
\cs_set_protected:Npn \__skip_tmp:w #1
  {
    \prg_new_conditional:Npnn \skip_if_finite:n ##1 { p , T , F , TF }
      {
        \exp_after:wN \__skip_if_finite:wwNw
        \skip_use:N \tex_glueexpr:D ##1 ; \prg_return_false:
        #1 ; \prg_return_true: \s__skip_stop
      }
    \cs_new:Npn \__skip_if_finite:wwNw ##1 #1 ##2 ; ##3 ##4 \s__skip_stop {##3}
  }
\exp_args:No \__skip_tmp:w { \tl_to_str:n { fil } }
\cs_new:Npn \skip_eval:n #1
  { \skip_use:N \tex_glueexpr:D #1 \scan_stop: }
\cs_new_eq:NN \skip_use:N \tex_the:D
\cs_new:Npn \skip_use:c #1 { \tex_the:D \cs:w #1 \cs_end: }
\cs_new_eq:NN  \skip_horizontal:N \tex_hskip:D
\cs_new:Npn \skip_horizontal:n #1
  { \skip_horizontal:N \tex_glueexpr:D #1 \scan_stop: }
\cs_new_eq:NN  \skip_vertical:N \tex_vskip:D
\cs_new:Npn \skip_vertical:n #1
  { \skip_vertical:N \tex_glueexpr:D #1 \scan_stop: }
\cs_generate_variant:Nn \skip_horizontal:N { c }
\cs_generate_variant:Nn \skip_vertical:N { c }
\cs_new_eq:NN  \skip_show:N \__kernel_register_show:N
\cs_generate_variant:Nn \skip_show:N { c }
\cs_new_protected:Npn \skip_show:n
  { \msg_show_eval:Nn \skip_eval:n }
\cs_new_eq:NN \skip_log:N \__kernel_register_log:N
\cs_new_eq:NN \skip_log:c \__kernel_register_log:c
\cs_new_protected:Npn \skip_log:n
  { \msg_log_eval:Nn \skip_eval:n }
\skip_const:Nn \c_zero_skip { \c_zero_dim }
\skip_const:Nn \c_max_skip { \c_max_dim }
\skip_new:N \l_tmpa_skip
\skip_new:N \l_tmpb_skip
\skip_new:N \g_tmpa_skip
\skip_new:N \g_tmpb_skip
\cs_new_protected:Npn \muskip_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs:w newmuskip \cs_end: #1
  }
\cs_generate_variant:Nn \muskip_new:N { c }
\cs_new_protected:Npn \muskip_const:Nn #1#2
  {
    \muskip_new:N #1
    \tex_global:D #1 ~ \muskip_eval:n {#2} \scan_stop:
  }
\cs_generate_variant:Nn \muskip_const:Nn { c }
\cs_new_protected:Npn \muskip_zero:N #1
  { #1 \c_zero_muskip }
\cs_new_protected:Npn \muskip_gzero:N #1
  { \tex_global:D #1 \c_zero_muskip }
\cs_generate_variant:Nn \muskip_zero:N  { c }
\cs_generate_variant:Nn \muskip_gzero:N { c }
\cs_new_protected:Npn \muskip_zero_new:N  #1
  { \muskip_if_exist:NTF #1 { \muskip_zero:N #1 } { \muskip_new:N #1 } }
\cs_new_protected:Npn \muskip_gzero_new:N #1
  { \muskip_if_exist:NTF #1 { \muskip_gzero:N #1 } { \muskip_new:N #1 } }
\cs_generate_variant:Nn \muskip_zero_new:N  { c }
\cs_generate_variant:Nn \muskip_gzero_new:N { c }
\prg_new_eq_conditional:NNn \muskip_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \muskip_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\cs_new_protected:Npn \muskip_set:Nn #1#2
  { #1 ~ \tex_muexpr:D #2 \scan_stop: }
\cs_new_protected:Npn \muskip_gset:Nn #1#2
  { \tex_global:D #1 ~ \tex_muexpr:D #2 \scan_stop: }
\cs_generate_variant:Nn \muskip_set:Nn  { c }
\cs_generate_variant:Nn \muskip_gset:Nn { c }
\cs_new_protected:Npn \muskip_set_eq:NN #1#2 { #1 = #2 }
\cs_generate_variant:Nn \muskip_set_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \muskip_gset_eq:NN #1#2 { \tex_global:D #1 = #2 }
\cs_generate_variant:Nn \muskip_gset_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \muskip_add:Nn #1#2
  { \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: }
\cs_new_protected:Npn \muskip_gadd:Nn #1#2
  { \tex_global:D \tex_advance:D #1 by \tex_muexpr:D #2 \scan_stop: }
\cs_generate_variant:Nn \muskip_add:Nn  { c }
\cs_generate_variant:Nn \muskip_gadd:Nn { c }
\cs_new_protected:Npn \muskip_sub:Nn #1#2
  { \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: }
\cs_new_protected:Npn \muskip_gsub:Nn #1#2
  { \tex_global:D \tex_advance:D #1 by - \tex_muexpr:D #2 \scan_stop: }
\cs_generate_variant:Nn \muskip_sub:Nn  { c }
\cs_generate_variant:Nn \muskip_gsub:Nn { c }
\cs_new:Npn \muskip_eval:n #1
  { \muskip_use:N \tex_muexpr:D #1 \scan_stop: }
\cs_new_eq:NN \muskip_use:N \tex_the:D
\cs_generate_variant:Nn \muskip_use:N { c }
\cs_new_eq:NN  \muskip_show:N \__kernel_register_show:N
\cs_generate_variant:Nn \muskip_show:N { c }
\cs_new_protected:Npn \muskip_show:n
  { \msg_show_eval:Nn \muskip_eval:n }
\cs_new_eq:NN \muskip_log:N \__kernel_register_log:N
\cs_new_eq:NN \muskip_log:c \__kernel_register_log:c
\cs_new_protected:Npn \muskip_log:n
  { \msg_log_eval:Nn \muskip_eval:n }
\muskip_const:Nn \c_zero_muskip { 0 mu }
\muskip_const:Nn \c_max_muskip  { 16383.99999 mu }
\muskip_new:N \l_tmpa_muskip
\muskip_new:N \l_tmpb_muskip
\muskip_new:N \g_tmpa_muskip
\muskip_new:N \g_tmpb_muskip
%% File: l3keys.dtx
\scan_new:N \s__keyval_nil
\scan_new:N \s__keyval_mark
\scan_new:N \s__keyval_stop
\scan_new:N \s__keyval_tail
\group_begin:
  \cs_set_protected:Npn \__keyval_tmp:NN #1#2
    {
      \cs_new:Npn \keyval_parse:nnn ##1 ##2 ##3
        { \__keyval_loop_active:nnw {##1} {##2} \s__keyval_mark ##3 #1 \s__keyval_tail #1 }
      \cs_new_eq:NN \keyval_parse:NNn \keyval_parse:nnn
      \cs_new:Npn \__keyval_loop_active:nnw ##1 ##2 ##3 #1
        {
          \__keyval_if_recursion_tail:w ##3
            \__keyval_end_loop_active:w \s__keyval_tail
          \__keyval_loop_other:nnw {##1} {##2} ##3 , \s__keyval_tail ,
        }
      \cs_new:Npn \__keyval_split_other:w ##1 = ##2 \s__keyval_mark ##3
        { ##3 ##1 \s__keyval_stop \s__keyval_mark ##2 }
      \cs_new:Npn \__keyval_split_active:w ##1 #2 ##2 \s__keyval_mark ##3
        { ##3 ##1 \s__keyval_stop \s__keyval_mark ##2 }
      \cs_new:Npn \__keyval_loop_other:nnw ##1 ##2 ##3 ,
        {
          \__keyval_if_recursion_tail:w ##3
            \__keyval_end_loop_other:w \s__keyval_tail
          \__keyval_split_active:w ##3 \s__keyval_nil
            \s__keyval_mark \__keyval_split_active_auxi:w
            #2 \s__keyval_mark \__keyval_clean_up_active:w
          {##1} {##2}
          \s__keyval_mark
        }
      \cs_new:Npn \__keyval_split_active_auxi:w ##1 \s__keyval_stop
        {
          \__keyval_split_other:w ##1 \s__keyval_nil
            \s__keyval_mark \__keyval_misplaced_equal_after_active_error:w
            = \s__keyval_mark \__keyval_split_active_auxii:w
        }
      \cs_new:Npn \__keyval_split_active_auxii:w
          ##1 \s__keyval_nil \s__keyval_mark \__keyval_misplaced_equal_after_active_error:w
          \s__keyval_stop \s__keyval_mark
          ##2 \s__keyval_nil #2 \s__keyval_mark \__keyval_clean_up_active:w
        { \__keyval_trim:nN {##1} \__keyval_split_active_auxiii:w ##2 \s__keyval_nil }
      \cs_new:Npn \__keyval_split_active_auxiii:w ##1 ##2 \s__keyval_nil
        {
          \__keyval_split_active:w ##2 \s__keyval_nil
            \s__keyval_mark \__keyval_misplaced_equal_in_split_error:w
            #2 \s__keyval_mark \__keyval_split_active_auxiv:w
            {##1}
        }
      \cs_new:Npn \__keyval_split_active_auxiv:w
          ##1 \s__keyval_nil \s__keyval_mark \__keyval_misplaced_equal_in_split_error:w
          \s__keyval_stop \s__keyval_mark
        {
          \__keyval_split_other:w ##1 \s__keyval_nil
            \s__keyval_mark \__keyval_misplaced_equal_in_split_error:w
            = \s__keyval_mark \__keyval_split_active_auxv:w
        }
      \cs_new:Npn \__keyval_split_active_auxv:w
          ##1 \s__keyval_nil \s__keyval_mark \__keyval_misplaced_equal_in_split_error:w
          \s__keyval_stop \s__keyval_mark
        { \__keyval_trim:nN { ##1 } \__keyval_pair:nnnn }
      \cs_new:Npn \__keyval_clean_up_active:w
          ##1 \s__keyval_nil \s__keyval_mark \__keyval_split_active_auxi:w \s__keyval_stop \s__keyval_mark
        {
          \__keyval_split_other:w ##1 \s__keyval_nil
            \s__keyval_mark \__keyval_split_other_auxi:w
            = \s__keyval_mark \__keyval_clean_up_other:w
        }
      \cs_new:Npn \__keyval_split_other_auxi:w ##1 \s__keyval_stop
        { \__keyval_trim:nN { ##1 } \__keyval_split_other_auxii:w }
      \cs_new:Npn \__keyval_split_other_auxii:w
          ##1 ##2 \s__keyval_nil = \s__keyval_mark \__keyval_clean_up_other:w
        {
          \__keyval_split_other:w ##2 \s__keyval_nil
            \s__keyval_mark \__keyval_misplaced_equal_in_split_error:w
            = \s__keyval_mark \__keyval_split_other_auxiii:w
            { ##1 }
        }
      \cs_new:Npn \__keyval_split_other_auxiii:w
          ##1 \s__keyval_nil \s__keyval_mark \__keyval_misplaced_equal_in_split_error:w
          \s__keyval_stop \s__keyval_mark
        { \__keyval_trim:nN { ##1 } \__keyval_pair:nnnn }
      \cs_new:Npn \__keyval_clean_up_other:w
          ##1 \s__keyval_nil \s__keyval_mark \__keyval_split_other_auxi:w \s__keyval_stop \s__keyval_mark
        {
          \__keyval_if_blank:w ##1 \s__keyval_nil \s__keyval_stop \__keyval_blank_true:w
            \s__keyval_mark \s__keyval_stop
            \__keyval_trim:nN { ##1 } \__keyval_key:nn
        }
      \cs_new:Npn \__keyval_misplaced_equal_after_active_error:w
          \s__keyval_mark ##1 \s__keyval_stop \s__keyval_mark ##2 \s__keyval_nil
           = \s__keyval_mark \__keyval_split_active_auxii:w
           \s__keyval_mark ##3 \s__keyval_nil
           #2 \s__keyval_mark \__keyval_clean_up_active:w
        {
          \__kernel_msg_expandable_error:nn
            { kernel } { misplaced-equals-sign }
          \__keyval_loop_other:nnw
        }
      \cs_new:Npn \__keyval_misplaced_equal_in_split_error:w
          \s__keyval_mark ##1 \s__keyval_stop \s__keyval_mark ##2 \s__keyval_nil
          ##3 \s__keyval_mark ##4 ##5
        {
          \__kernel_msg_expandable_error:nn
            { kernel } { misplaced-equals-sign }
          \__keyval_loop_other:nnw
        }
      \cs_new:Npn \__keyval_end_loop_other:w
          \s__keyval_tail
          \__keyval_split_active:w
          \s__keyval_mark \s__keyval_tail
          \s__keyval_nil \s__keyval_mark
          \__keyval_split_active_auxi:w
          #2 \s__keyval_mark \__keyval_clean_up_active:w
        { \__keyval_loop_active:nnw }
      \cs_new:Npn \__keyval_end_loop_active:w
          \s__keyval_tail
          \__keyval_loop_other:nnw ##1 \s__keyval_mark \s__keyval_tail , \s__keyval_tail ,
        { }
    }
  \char_set_catcode_active:n { `\, }
  \char_set_catcode_active:n { `\= }
  \__keyval_tmp:NN , =
\group_end:
\cs_new:Npn \__keyval_pair:nnnn #1 #2 #3 #4
  {
    \__keyval_if_blank:w \s__keyval_mark #2 \s__keyval_nil \s__keyval_stop \__keyval_blank_key_error:w
      \s__keyval_mark \s__keyval_stop
    \exp_not:n { #4 { #2 } { #1 } }
    \__keyval_loop_other:nnw {#3} {#4}
  }
\cs_new:Npn \__keyval_key:nn #1 #2
  {
    \__keyval_if_blank:w \s__keyval_mark #1 \s__keyval_nil \s__keyval_stop \__keyval_blank_key_error:w
      \s__keyval_mark \s__keyval_stop
    \exp_not:n { #2 { #1 } }
    \__keyval_loop_other:nnw {#2}
  }
\cs_new:Npn \__keyval_if_empty:w #1 \s__keyval_mark \s__keyval_stop { }
\cs_new:Npn \__keyval_if_blank:w \s__keyval_mark #1 { \__keyval_if_empty:w \s__keyval_mark }
\cs_new:Npn \__keyval_if_recursion_tail:w \s__keyval_mark #1 \s__keyval_tail { }
\cs_new:Npn \__keyval_blank_true:w \s__keyval_mark \s__keyval_stop \__keyval_trim:nN #1 \__keyval_key:nn
  { \__keyval_loop_other:nnw }
\cs_new:Npn \__keyval_blank_key_error:w \s__keyval_mark \s__keyval_stop \exp_not:n #1
  {
    \__kernel_msg_expandable_error:nn
      { kernel } { blank-key-name }
  }
\__kernel_msg_new:nnn { kernel } { misplaced-equals-sign }
  { Misplaced~equals~sign~in~key-value~input~\msg_line_context: }
\__kernel_msg_new:nnn { kernel } { blank-key-name }
  { Blank~key~name~in~key-value~input~\msg_line_context: }
\group_begin:
  \cs_set_protected:Npn \__keyval_tmp:n #1
    {
      \cs_new:Npn \__keyval_trim:nN ##1
        {
          \__keyval_trim_auxi:w
            ##1
            \s__keyval_nil
            \s__keyval_mark #1 { }
            \s__keyval_mark \__keyval_trim_auxii:w
            \__keyval_trim_auxiii:w
            #1 \s__keyval_nil
            \__keyval_trim_auxiv:w
        }
      \cs_new:Npn \__keyval_trim_auxi:w ##1 \s__keyval_mark #1 ##2 \s__keyval_mark ##3
        {
          ##3
          \__keyval_trim_auxi:w
          \s__keyval_mark
          ##2
          \s__keyval_mark #1 {##1}
        }
      \cs_new:Npn \__keyval_trim_auxii:w \__keyval_trim_auxi:w \s__keyval_mark \s__keyval_mark ##1
        {
          \__keyval_trim_auxiii:w
          ##1
        }
      \cs_new:Npn \__keyval_trim_auxiii:w ##1 #1 \s__keyval_nil ##2
        {
          ##2
          ##1 \s__keyval_nil
          \__keyval_trim_auxiii:w
        }
      \cs_new:Npn \__keyval_trim_auxiv:w
          \s__keyval_mark ##1 \s__keyval_nil
          \__keyval_trim_auxiii:w \s__keyval_nil \__keyval_trim_auxiii:w
          ##2
        { ##2 { ##1 } }
    }
  \__keyval_tmp:n { ~ }
\group_end:
\str_const:Nn \c__keys_code_root_str     { key~code~>~ }
\str_const:Nn \c__keys_default_root_str  { key~default~>~ }
\str_const:Nn \c__keys_groups_root_str   { key~groups~>~ }
\str_const:Nn \c__keys_inherit_root_str  { key~inherit~>~ }
\str_const:Nn \c__keys_type_root_str     { key~type~>~ }
\str_const:Nn \c__keys_validate_root_str { key~validate~>~ }
\str_const:Nn \c__keys_props_root_str { key~prop~>~ }
\int_new:N \l_keys_choice_int
\tl_new:N \l_keys_choice_tl
\clist_new:N \l__keys_groups_clist
\str_new:N \l_keys_key_str
\tl_new:N \l_keys_key_tl
\str_new:N \l__keys_module_str
\bool_new:N \l__keys_no_value_bool
\bool_new:N \l__keys_only_known_bool
\str_new:N \l_keys_path_str
\tl_new:N \l_keys_path_tl
\str_new:N \l__keys_inherit_str
\tl_new:N \l__keys_relative_tl
\tl_set:Nn \l__keys_relative_tl { \q__keys_no_value }
\str_new:N \l__keys_property_str
\bool_new:N \l__keys_selective_bool
\bool_new:N \l__keys_filtered_bool
\seq_new:N \l__keys_selective_seq
\tl_new:N \l__keys_unused_clist
\tl_new:N \l_keys_value_tl
\bool_new:N \l__keys_tmp_bool
\tl_new:N \l__keys_tmpa_tl
\tl_new:N \l__keys_tmpb_tl
\scan_new:N \s__keys_nil
\scan_new:N \s__keys_mark
\scan_new:N \s__keys_stop
\quark_new:N \q__keys_no_value
\__kernel_quark_new_conditional:Nn \__keys_quark_if_no_value:N { TF }
\cs_new_protected:Npn \keys_define:nn
  { \__keys_define:onn \l__keys_module_str }
\cs_new_protected:Npn \__keys_define:nnn #1#2#3
  {
    \str_set:Nx \l__keys_module_str { \__keys_trim_spaces:n {#2} }
    \keyval_parse:NNn \__keys_define:n \__keys_define:nn {#3}
    \str_set:Nn \l__keys_module_str {#1}
  }
\cs_generate_variant:Nn \__keys_define:nnn { o }
\cs_new_protected:Npn \__keys_define:n #1
  {
    \bool_set_true:N \l__keys_no_value_bool
    \__keys_define_aux:nn {#1} { }
  }
\cs_new_protected:Npn \__keys_define:nn #1#2
  {
    \bool_set_false:N \l__keys_no_value_bool
    \__keys_define_aux:nn {#1} {#2}
  }
\cs_new_protected:Npn \__keys_define_aux:nn #1#2
  {
    \__keys_property_find:n {#1}
    \cs_if_exist:cTF { \c__keys_props_root_str \l__keys_property_str }
      { \__keys_define_code:n {#2} }
      {
        \str_if_empty:NF \l__keys_property_str
          {
            \__kernel_msg_error:nnxx { kernel } { key-property-unknown }
              \l__keys_property_str \l_keys_path_str
          }
      }
  }
\cs_new_protected:Npn \__keys_property_find:n #1
  {
    \cs_set_nopar:Npx \l__keys_property_str { \__keys_trim_spaces:n { #1 } }
    \exp_after:wN \__keys_property_find_auxi:w \l__keys_property_str
      \s__keys_nil \__keys_property_find_auxii:w
      . \s__keys_nil \__keys_property_find_err:w
  }
\cs_new_protected:Npn \__keys_property_find_auxi:w #1 . #2 \s__keys_nil #3
  {
    #3 #1 \s__keys_mark #2 \s__keys_nil #3
  }
\cs_new_protected:Npn \__keys_property_find_auxii:w
    #1 \s__keys_mark #2 \s__keys_nil \__keys_property_find_auxii:w . \s__keys_nil
    \__keys_property_find_err:w
  {
    \cs_set_nopar:Npx \l_keys_path_str
      { \str_if_empty:NF \l__keys_module_str { \l__keys_module_str / } #1 }
    \__keys_property_find_auxi:w #2 \s__keys_nil \__keys_property_find_auxiii:w . \s__keys_nil
      \__keys_property_find_auxiv:w
  }
\cs_new_protected:Npn \__keys_property_find_auxiii:w #1 \s__keys_mark
  {
    \cs_set_nopar:Npx \l_keys_path_str { \l_keys_path_str . #1 }
    \__keys_property_find_auxi:w
  }
\cs_new_protected:Npn \__keys_property_find_auxiv:w
    #1 \s__keys_nil \__keys_property_find_auxiii:w
    \s__keys_mark \s__keys_nil \__keys_property_find_auxiv:w
  {
    \cs_set_nopar:Npx \l__keys_property_str { . #1 }
    \cs_set_nopar:Npx \l_keys_path_str
      { \exp_after:wN \__keys_trim_spaces:n \exp_after:wN { \l_keys_path_str } }
    \tl_set_eq:NN \l_keys_path_tl \l_keys_path_str
  }
\cs_new_protected:Npn \__keys_property_find_err:w
    #1 \s__keys_nil #2 \__keys_property_find_err:w
  {
    \str_clear:N \l__keys_property_str
    \__kernel_msg_error:nnn { kernel } { key-no-property } {#1}
  }
\cs_new_protected:Npn \__keys_define_code:n #1
  {
    \bool_if:NTF \l__keys_no_value_bool
      {
        \exp_after:wN \__keys_define_code:w
          \l__keys_property_str \s__keys_stop
          { \use:c { \c__keys_props_root_str \l__keys_property_str } }
          {
            \__kernel_msg_error:nnxx { kernel } { key-property-requires-value }
              \l__keys_property_str \l_keys_path_str
          }
      }
      { \use:c { \c__keys_props_root_str \l__keys_property_str } {#1} }
  }
\exp_last_unbraced:NNNNo
  \cs_new:Npn \__keys_define_code:w #1 \c_colon_str #2 \s__keys_stop
    { \tl_if_empty:nTF {#2} }
\cs_new_protected:Npn \__keys_bool_set:Nn #1#2
  {
    \bool_if_exist:NF #1 { \bool_new:N #1 }
    \__keys_choice_make:
    \__keys_cmd_set:nx { \l_keys_path_str / true }
      { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 }
    \__keys_cmd_set:nx { \l_keys_path_str / false }
      { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 }
    \__keys_cmd_set:nn { \l_keys_path_str / unknown }
      {
        \__kernel_msg_error:nnx { kernel } { boolean-values-only }
          \l_keys_key_str
      }
    \__keys_default_set:n { true }
  }
\cs_generate_variant:Nn \__keys_bool_set:Nn { c }
\cs_new_protected:Npn \__keys_bool_set_inverse:Nn #1#2
  {
    \bool_if_exist:NF #1 { \bool_new:N #1 }
    \__keys_choice_make:
    \__keys_cmd_set:nx { \l_keys_path_str / true }
      { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 }
    \__keys_cmd_set:nx { \l_keys_path_str / false }
      { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 }
    \__keys_cmd_set:nn { \l_keys_path_str / unknown }
      {
        \__kernel_msg_error:nnx { kernel } { boolean-values-only }
          \l_keys_key_str
      }
    \__keys_default_set:n { true }
  }
\cs_generate_variant:Nn \__keys_bool_set_inverse:Nn { c }
\cs_new_protected:Npn \__keys_choice_make:
  { \__keys_choice_make:N \__keys_choice_find:n }
\cs_new_protected:Npn \__keys_multichoice_make:
  { \__keys_choice_make:N \__keys_multichoice_find:n }
\cs_new_protected:Npn \__keys_choice_make:N #1
  {
    \cs_if_exist:cTF
      { \c__keys_type_root_str \__keys_parent:o \l_keys_path_str }
      {
        \str_if_eq:vnTF
          { \c__keys_type_root_str \__keys_parent:o \l_keys_path_str }
          { choice }
          {
            \__kernel_msg_error:nnxx { kernel } { nested-choice-key }
              \l_keys_path_tl { \__keys_parent:o \l_keys_path_str }
          }
          { \__keys_choice_make_aux:N #1 }
      }
      { \__keys_choice_make_aux:N #1 }
  }
\cs_new_protected:Npn \__keys_choice_make_aux:N #1
  {
    \cs_set_nopar:cpn { \c__keys_type_root_str \l_keys_path_str }
      { choice }
    \__keys_cmd_set:nn \l_keys_path_str { #1 {##1} }
    \__keys_cmd_set:nn { \l_keys_path_str / unknown }
      {
        \__kernel_msg_error:nnxx { kernel } { key-choice-unknown }
          \l_keys_path_str {##1}
      }
  }
\cs_new_protected:Npn \__keys_choices_make:nn
  { \__keys_choices_make:Nnn \__keys_choice_make: }
\cs_new_protected:Npn \__keys_multichoices_make:nn
  { \__keys_choices_make:Nnn \__keys_multichoice_make: }
\cs_new_protected:Npn \__keys_choices_make:Nnn #1#2#3
  {
    #1
    \int_zero:N \l_keys_choice_int
    \clist_map_inline:nn {#2}
      {
        \int_incr:N \l_keys_choice_int
        \__keys_cmd_set:nx
          { \l_keys_path_str / \__keys_trim_spaces:n {##1} }
          {
            \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1}
            \int_set:Nn \exp_not:N \l_keys_choice_int
              { \int_use:N \l_keys_choice_int }
            \exp_not:n {#3}
          }
      }
  }
\cs_new_protected:Npn \__keys_cmd_set:nn #1#2
  { \cs_set_protected:cpn { \c__keys_code_root_str #1 } ##1 {#2} }
\cs_generate_variant:Nn \__keys_cmd_set:nn { nx , Vn , Vo }
\cs_new_protected:Npn \__keys_cs_set:NNpn #1#2#3#
  {
    \cs_set_protected:cpx { \c__keys_code_root_str \l_keys_path_str } ##1
      { #1 \exp_not:N #2 \exp_not:n {#3} {##1} }
    \use_none:n
  }
\cs_generate_variant:Nn \__keys_cs_set:NNpn { Nc }
\cs_new_protected:Npn \__keys_default_set:n #1
  {
    \tl_if_empty:nTF {#1}
      {
        \cs_set_eq:cN
          { \c__keys_default_root_str \l_keys_path_str }
          \tex_undefined:D
      }
      {
        \cs_set_nopar:cpx
          { \c__keys_default_root_str \l_keys_path_str }
          { \exp_not:n {#1} }
        \__keys_value_requirement:nn { required } { false }
      }
  }
\cs_new_protected:Npn \__keys_groups_set:n #1
  {
    \clist_set:Nn \l__keys_groups_clist {#1}
    \clist_if_empty:NTF \l__keys_groups_clist
      {
        \cs_set_eq:cN { \c__keys_groups_root_str \l_keys_path_str }
          \tex_undefined:D
      }
      {
        \cs_set_eq:cN { \c__keys_groups_root_str \l_keys_path_str }
          \l__keys_groups_clist
      }
  }
\cs_new_protected:Npn \__keys_inherit:n #1
  {
    \__keys_undefine:
    \cs_set_nopar:cpn { \c__keys_inherit_root_str \l_keys_path_str } {#1}
  }
\cs_new_protected:Npn \__keys_initialise:n #1
  {
    \cs_if_exist:cTF
      { \c__keys_inherit_root_str \__keys_parent:o \l_keys_path_str }
      { \__keys_execute_inherit: }
      {
        \str_clear:N \l__keys_inherit_str
        \cs_if_exist:cT { \c__keys_code_root_str \l_keys_path_str }
          { \__keys_execute:nn \l_keys_path_str {#1} }
      }
  }
\cs_new_protected:Npn \__keys_meta_make:n #1
  {
    \__keys_cmd_set:Vo \l_keys_path_str
      {
        \exp_after:wN \keys_set:nn \exp_after:wN { \l__keys_module_str } {#1}
      }
  }
\cs_new_protected:Npn \__keys_meta_make:nn #1#2
  { \__keys_cmd_set:Vn \l_keys_path_str { \keys_set:nn {#1} {#2} } }
\cs_new_protected:Npn \__keys_prop_put:Nn #1#2
  {
    \prop_if_exist:NF #1 { \prop_new:N #1 }
    \exp_after:wN \__keys_find_key_module:wNN \l_keys_path_str \s__keys_stop
      \l__keys_tmpa_tl \l__keys_tmpb_tl
    \__keys_cmd_set:nx \l_keys_path_str
      {
        \exp_not:c { prop_ #2 put:Nnn }
        \exp_not:N #1
        { \l__keys_tmpb_tl }
        \exp_not:n { {##1} }
      }
  }
\cs_generate_variant:Nn \__keys_prop_put:Nn { c }
\cs_new_protected:Npn \__keys_undefine:
  {
    \clist_map_inline:nn
      { code , default , groups , inherit , type , validate }
      {
        \cs_set_eq:cN
          { \tl_use:c { c__keys_ ##1 _root_str } \l_keys_path_str }
          \tex_undefined:D
      }
  }
\cs_new_protected:Npn \__keys_value_requirement:nn #1#2
  {
    \str_case:nnF {#2}
      {
        { true }
          {
            \cs_set_eq:cc
              { \c__keys_validate_root_str \l_keys_path_str }
              { __keys_validate_ #1 : }
          }
        { false }
          {
            \cs_if_eq:ccT
              { \c__keys_validate_root_str \l_keys_path_str }
              { __keys_validate_ #1 : }
              {
                \cs_set_eq:cN
                  { \c__keys_validate_root_str \l_keys_path_str }
                  \tex_undefined:D
              }
          }
      }
      {
        \__kernel_msg_error:nnx { kernel }
          { key-property-boolean-values-only }
          { .value_ #1 :n }
      }
  }
\cs_new_protected:Npn \__keys_validate_forbidden:
  {
    \bool_if:NF \l__keys_no_value_bool
      {
        \__kernel_msg_error:nnxx { kernel } { value-forbidden }
          \l_keys_path_str \l_keys_value_tl
        \use_none:nnn
      }
  }
\cs_new_protected:Npn \__keys_validate_required:
  {
    \bool_if:NT \l__keys_no_value_bool
      {
        \__kernel_msg_error:nnx { kernel } { value-required }
          \l_keys_path_str
        \use_none:nnn
      }
  }
\cs_new_protected:Npn \__keys_variable_set:NnnN #1#2#3#4
  {
    \use:c { #2_if_exist:NF } #1 { \use:c { #2 _new:N } #1 }
    \__keys_cmd_set:nx \l_keys_path_str
      {
        \exp_not:c { #2 _ #3 set:N #4 }
        \exp_not:N #1
        \exp_not:n  { {##1} }
      }
  }
\cs_generate_variant:Nn \__keys_variable_set:NnnN { c }
\cs_new_protected:Npn \__keys_variable_set_required:NnnN #1#2#3#4
  {
    \__keys_variable_set:NnnN #1 {#2} {#3} #4
    \__keys_value_requirement:nn { required } { true }
  }
\cs_generate_variant:Nn \__keys_variable_set_required:NnnN { c }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_set:N } #1
  { \__keys_bool_set:Nn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_set:c } #1
  { \__keys_bool_set:cn {#1} { } }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_gset:N } #1
  { \__keys_bool_set:Nn #1 { g } }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_gset:c } #1
  { \__keys_bool_set:cn {#1} { g } }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_set_inverse:N } #1
  { \__keys_bool_set_inverse:Nn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_set_inverse:c } #1
  { \__keys_bool_set_inverse:cn {#1} { } }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_gset_inverse:N } #1
  { \__keys_bool_set_inverse:Nn #1 { g } }
\cs_new_protected:cpn { \c__keys_props_root_str .bool_gset_inverse:c } #1
  { \__keys_bool_set_inverse:cn {#1} { g } }
\cs_new_protected:cpn { \c__keys_props_root_str .choice: }
  { \__keys_choice_make: }
\cs_new_protected:cpn { \c__keys_props_root_str .choices:nn } #1
  { \__keys_choices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .choices:Vn } #1
  { \exp_args:NV \__keys_choices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .choices:on } #1
  { \exp_args:No \__keys_choices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .choices:xn } #1
  { \exp_args:Nx \__keys_choices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .code:n } #1
  { \__keys_cmd_set:nn \l_keys_path_str {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .clist_set:N } #1
  { \__keys_variable_set:NnnN #1 { clist } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .clist_set:c } #1
  { \__keys_variable_set:cnnN {#1} { clist } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .clist_gset:N } #1
  { \__keys_variable_set:NnnN #1 { clist } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .clist_gset:c } #1
  { \__keys_variable_set:cnnN {#1} { clist } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_set:Np } #1
  { \__keys_cs_set:NNpn \cs_set:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_set:cp } #1
  { \__keys_cs_set:Ncpn \cs_set:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_set_protected:Np } #1
  { \__keys_cs_set:NNpn \cs_set_protected:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_set_protected:cp } #1
  { \__keys_cs_set:Ncpn \cs_set_protected:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_gset:Np } #1
  { \__keys_cs_set:NNpn \cs_gset:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_gset:cp } #1
  { \__keys_cs_set:Ncpn \cs_gset:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_gset_protected:Np } #1
  { \__keys_cs_set:NNpn \cs_gset_protected:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .cs_gset_protected:cp } #1
  { \__keys_cs_set:Ncpn \cs_gset_protected:Npn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .default:n } #1
  { \__keys_default_set:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .default:V } #1
  { \exp_args:NV \__keys_default_set:n #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .default:o } #1
  { \exp_args:No \__keys_default_set:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .default:x } #1
  { \exp_args:Nx \__keys_default_set:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .dim_set:N } #1
  { \__keys_variable_set_required:NnnN #1 { dim } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .dim_set:c } #1
  { \__keys_variable_set_required:cnnN {#1} { dim } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .dim_gset:N } #1
  { \__keys_variable_set_required:NnnN #1 { dim } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .dim_gset:c } #1
  { \__keys_variable_set_required:cnnN {#1} { dim } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .fp_set:N } #1
  { \__keys_variable_set_required:NnnN #1 { fp } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .fp_set:c } #1
  { \__keys_variable_set_required:cnnN {#1} { fp } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .fp_gset:N } #1
  { \__keys_variable_set_required:NnnN #1 { fp } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .fp_gset:c } #1
  { \__keys_variable_set_required:cnnN {#1} { fp } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .groups:n } #1
  { \__keys_groups_set:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .inherit:n } #1
  { \__keys_inherit:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .initial:n } #1
  { \__keys_initialise:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .initial:V } #1
  { \exp_args:NV \__keys_initialise:n #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .initial:o } #1
  { \exp_args:No \__keys_initialise:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .initial:x } #1
  { \exp_args:Nx \__keys_initialise:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .int_set:N } #1
  { \__keys_variable_set_required:NnnN #1 { int } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .int_set:c } #1
  { \__keys_variable_set_required:cnnN {#1} { int } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .int_gset:N } #1
  { \__keys_variable_set_required:NnnN #1 { int } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .int_gset:c } #1
  { \__keys_variable_set_required:cnnN {#1} { int } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .meta:n } #1
  { \__keys_meta_make:n {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .meta:nn } #1
  { \__keys_meta_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .multichoice: }
  { \__keys_multichoice_make: }
\cs_new_protected:cpn { \c__keys_props_root_str .multichoices:nn } #1
  { \__keys_multichoices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .multichoices:Vn } #1
  { \exp_args:NV \__keys_multichoices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .multichoices:on } #1
  { \exp_args:No \__keys_multichoices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .multichoices:xn } #1
  { \exp_args:Nx \__keys_multichoices_make:nn #1 }
\cs_new_protected:cpn { \c__keys_props_root_str .muskip_set:N } #1
  { \__keys_variable_set_required:NnnN #1 { muskip } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .muskip_set:c } #1
  { \__keys_variable_set_required:cnnN {#1} { muskip } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .muskip_gset:N } #1
  { \__keys_variable_set_required:NnnN #1 { muskip } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .muskip_gset:c } #1
  { \__keys_variable_set_required:cnnN {#1} { muskip } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .prop_put:N } #1
  { \__keys_prop_put:Nn #1 { } }
\cs_new_protected:cpn { \c__keys_props_root_str .prop_put:c } #1
  { \__keys_prop_put:cn {#1} { } }
\cs_new_protected:cpn { \c__keys_props_root_str .prop_gput:N } #1
  { \__keys_prop_put:Nn #1 { g } }
\cs_new_protected:cpn { \c__keys_props_root_str .prop_gput:c } #1
  { \__keys_prop_put:cn {#1} { g } }
\cs_new_protected:cpn { \c__keys_props_root_str .skip_set:N } #1
  { \__keys_variable_set_required:NnnN #1 { skip } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .skip_set:c } #1
  { \__keys_variable_set_required:cnnN {#1} { skip } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .skip_gset:N } #1
  { \__keys_variable_set_required:NnnN #1 { skip } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .skip_gset:c } #1
  { \__keys_variable_set_required:cnnN {#1} { skip } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_set:N } #1
  { \__keys_variable_set:NnnN #1 { tl } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_set:c } #1
  { \__keys_variable_set:cnnN {#1} { tl } { } n }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_set_x:N } #1
  { \__keys_variable_set:NnnN #1 { tl } { } x }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_set_x:c } #1
  { \__keys_variable_set:cnnN {#1} { tl } { } x }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_gset:N } #1
  { \__keys_variable_set:NnnN #1 { tl } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_gset:c } #1
  { \__keys_variable_set:cnnN {#1} { tl } { g } n }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_gset_x:N } #1
  { \__keys_variable_set:NnnN #1 { tl } { g } x }
\cs_new_protected:cpn { \c__keys_props_root_str .tl_gset_x:c } #1
  { \__keys_variable_set:cnnN {#1} { tl } { g } x }
\cs_new_protected:cpn { \c__keys_props_root_str .undefine: }
  { \__keys_undefine: }
\cs_new_protected:cpn { \c__keys_props_root_str .value_forbidden:n } #1
  { \__keys_value_requirement:nn { forbidden } {#1} }
\cs_new_protected:cpn { \c__keys_props_root_str .value_required:n } #1
  { \__keys_value_requirement:nn { required } {#1} }
\cs_new_protected:Npn \keys_set:nn #1#2
  {
    \use:x
      {
        \bool_set_false:N \exp_not:N \l__keys_only_known_bool
        \bool_set_false:N \exp_not:N \l__keys_filtered_bool
        \bool_set_false:N \exp_not:N \l__keys_selective_bool
        \tl_set:Nn \exp_not:N \l__keys_relative_tl
          { \exp_not:N \q__keys_no_value }
        \__keys_set:nn \exp_not:n { {#1} {#2} }
        \bool_if:NT \l__keys_only_known_bool
          { \bool_set_true:N \exp_not:N \l__keys_only_known_bool }
        \bool_if:NT \l__keys_filtered_bool
          { \bool_set_true:N \exp_not:N \l__keys_filtered_bool }
        \bool_if:NT \l__keys_selective_bool
          { \bool_set_true:N \exp_not:N \l__keys_selective_bool }
        \tl_set:Nn \exp_not:N \l__keys_relative_tl
          { \exp_not:o \l__keys_relative_tl }
      }
  }
\cs_generate_variant:Nn \keys_set:nn { nV , nv , no }
\cs_new_protected:Npn \__keys_set:nn #1#2
  { \exp_args:No \__keys_set:nnn \l__keys_module_str {#1} {#2} }
\cs_new_protected:Npn \__keys_set:nnn #1#2#3
  {
    \str_set:Nx \l__keys_module_str { \__keys_trim_spaces:n {#2} }
    \keyval_parse:NNn \__keys_set_keyval:n \__keys_set_keyval:nn {#3}
    \str_set:Nn \l__keys_module_str {#1}
  }
\cs_new_protected:Npn \keys_set_known:nnN #1#2#3
  {
    \exp_args:No \__keys_set_known:nnnnN
      \l__keys_unused_clist \q__keys_no_value {#1} {#2} #3
  }
\cs_generate_variant:Nn \keys_set_known:nnN { nV , nv , no }
\cs_new_protected:Npn \keys_set_known:nnnN #1#2#3#4
  {
    \exp_args:No \__keys_set_known:nnnnN
      \l__keys_unused_clist {#3} {#1} {#2} #4
  }
\cs_generate_variant:Nn \keys_set_known:nnnN { nV , nv , no }
\cs_new_protected:Npn \__keys_set_known:nnnnN #1#2#3#4#5
  {
    \clist_clear:N \l__keys_unused_clist
    \__keys_set_known:nnn {#2} {#3} {#4}
    \__kernel_tl_set:Nx #5 { \exp_not:o \l__keys_unused_clist }
    \tl_set:Nn \l__keys_unused_clist {#1}
  }
\cs_new_protected:Npn \keys_set_known:nn #1#2
  { \__keys_set_known:nnn \q__keys_no_value {#1} {#2} }
\cs_generate_variant:Nn \keys_set_known:nn { nV , nv , no }
\cs_new_protected:Npn \__keys_set_known:nnn #1#2#3
  {
    \use:x
      {
        \bool_set_true:N \exp_not:N \l__keys_only_known_bool
        \bool_set_false:N \exp_not:N \l__keys_filtered_bool
        \bool_set_false:N \exp_not:N \l__keys_selective_bool
        \tl_set:Nn \exp_not:N \l__keys_relative_tl { \exp_not:n {#1} }
        \__keys_set:nn \exp_not:n { {#2} {#3} }
        \bool_if:NF \l__keys_only_known_bool
          { \bool_set_false:N \exp_not:N \l__keys_only_known_bool }
        \bool_if:NT \l__keys_filtered_bool
          { \bool_set_true:N \exp_not:N \l__keys_filtered_bool }
        \bool_if:NT \l__keys_selective_bool
          { \bool_set_true:N \exp_not:N \l__keys_selective_bool }
        \tl_set:Nn \exp_not:N \l__keys_relative_tl
          { \exp_not:o \l__keys_relative_tl }
      }
  }
\cs_new_protected:Npn \keys_set_filter:nnnN #1#2#3#4
  {
    \exp_args:No \__keys_set_filter:nnnnnN
      \l__keys_unused_clist
        \q__keys_no_value {#1} {#2} {#3} #4
  }
\cs_generate_variant:Nn \keys_set_filter:nnnN { nnV , nnv , nno }
\cs_new_protected:Npn \keys_set_filter:nnnnN #1#2#3#4#5
  {
    \exp_args:No \__keys_set_filter:nnnnnN
      \l__keys_unused_clist {#4} {#1} {#2} {#3} #5
  }
\cs_generate_variant:Nn \keys_set_filter:nnnnN { nnV , nnv , nno }
\cs_new_protected:Npn \__keys_set_filter:nnnnnN #1#2#3#4#5#6
  {
    \clist_clear:N \l__keys_unused_clist
    \__keys_set_filter:nnnn {#2} {#3} {#4} {#5}
    \__kernel_tl_set:Nx #6 { \exp_not:o \l__keys_unused_clist }
    \tl_set:Nn \l__keys_unused_clist {#1}
  }
\cs_new_protected:Npn \keys_set_filter:nnn #1#2#3
  {\__keys_set_filter:nnnn \q__keys_no_value {#1} {#2} {#3} }
\cs_generate_variant:Nn \keys_set_filter:nnn { nnV , nnv , nno }
\cs_new_protected:Npn \__keys_set_filter:nnnn #1#2#3#4
  {
    \use:x
      {
        \bool_set_false:N \exp_not:N \l__keys_only_known_bool
        \bool_set_true:N \exp_not:N \l__keys_filtered_bool
        \bool_set_true:N \exp_not:N \l__keys_selective_bool
        \tl_set:Nn \exp_not:N \l__keys_relative_tl { \exp_not:n {#1} }
        \__keys_set_selective:nnn \exp_not:n { {#2} {#3} {#4} }
        \bool_if:NT \l__keys_only_known_bool
          { \bool_set_true:N \exp_not:N \l__keys_only_known_bool }
        \bool_if:NF \l__keys_filtered_bool
          { \bool_set_false:N \exp_not:N \l__keys_filtered_bool }
        \bool_if:NF \l__keys_selective_bool
          { \bool_set_false:N \exp_not:N \l__keys_selective_bool }
        \tl_set:Nn \exp_not:N \l__keys_relative_tl
          { \exp_not:o \l__keys_relative_tl }
      }
  }
\cs_new_protected:Npn \keys_set_groups:nnn #1#2#3
  {
    \use:x
      {
        \bool_set_false:N \exp_not:N \l__keys_only_known_bool
        \bool_set_false:N \exp_not:N \l__keys_filtered_bool
        \bool_set_true:N \exp_not:N \l__keys_selective_bool
        \tl_set:Nn \exp_not:N \l__keys_relative_tl
          { \exp_not:N \q__keys_no_value }
        \__keys_set_selective:nnn \exp_not:n { {#1} {#2} {#3} }
        \bool_if:NT \l__keys_only_known_bool
          { \bool_set_true:N \exp_not:N \l__keys_only_known_bool }
        \bool_if:NF \l__keys_filtered_bool
          { \bool_set_true:N \exp_not:N \l__keys_filtered_bool }
        \bool_if:NF \l__keys_selective_bool
          { \bool_set_false:N \exp_not:N \l__keys_selective_bool }
        \tl_set:Nn \exp_not:N \l__keys_relative_tl
          { \exp_not:o \l__keys_relative_tl }
      }
  }
\cs_generate_variant:Nn \keys_set_groups:nnn { nnV , nnv , nno }
\cs_new_protected:Npn \__keys_set_selective:nnn
  { \exp_args:No \__keys_set_selective:nnnn \l__keys_selective_seq }
\cs_new_protected:Npn \__keys_set_selective:nnnn #1#2#3#4
  {
    \seq_set_from_clist:Nn \l__keys_selective_seq {#3}
    \__keys_set:nn {#2} {#4}
    \tl_set:Nn \l__keys_selective_seq {#1}
  }
\cs_new_protected:Npn \__keys_set_keyval:n #1
  {
    \bool_set_true:N \l__keys_no_value_bool
    \__keys_set_keyval:onn \l__keys_module_str {#1} { }
  }
\cs_new_protected:Npn \__keys_set_keyval:nn #1#2
  {
    \bool_set_false:N \l__keys_no_value_bool
    \__keys_set_keyval:onn \l__keys_module_str {#1} {#2}
  }
\cs_new_protected:Npn \__keys_set_keyval:nnn #1#2#3
  {
    \__kernel_tl_set:Nx \l_keys_path_str
      {
        \tl_if_blank:nF {#1}
          { #1 / }
        \__keys_trim_spaces:n {#2}
      }
    \str_clear:N \l__keys_module_str
    \str_clear:N \l__keys_inherit_str
    \exp_after:wN \__keys_find_key_module:wNN \l_keys_path_str \s__keys_stop
      \l__keys_module_str \l_keys_key_str
    \tl_set_eq:NN \l_keys_key_tl \l_keys_key_str
    \__keys_value_or_default:n {#3}
    \bool_if:NTF \l__keys_selective_bool
      \__keys_set_selective:
      \__keys_execute:
    \str_set:Nn \l__keys_module_str {#1}
  }
\cs_generate_variant:Nn \__keys_set_keyval:nnn { o }
\cs_new_protected:Npn \__keys_find_key_module:wNN #1 \s__keys_stop #2 #3
  {
    \__keys_find_key_module_auxi:Nw #2 #1 \s__keys_nil \__keys_find_key_module_auxii:Nw
      / \s__keys_nil \__keys_find_key_module_auxiv:Nw #3
  }
\cs_new_protected:Npn \__keys_find_key_module_auxi:Nw #1 #2 / #3 \s__keys_nil #4
  {
    #4 #1 #2 \s__keys_mark #3 \s__keys_nil #4
  }
\cs_new_protected:Npn \__keys_find_key_module_auxii:Nw
    #1 #2 \s__keys_mark #3 \s__keys_nil \__keys_find_key_module_auxii:Nw
  {
    \cs_set_nopar:Npx #1 { \tl_if_empty:NF #1 { #1 / } #2 }
    \__keys_find_key_module_auxi:Nw #1 #3 \s__keys_nil \__keys_find_key_module_auxiii:Nw
  }
\cs_new_protected:Npn \__keys_find_key_module_auxiii:Nw #1 #2 \s__keys_mark
  {
    \cs_set_nopar:Npx #1 { \tl_if_empty:NF #1 { #1 / } #2 }
    \__keys_find_key_module_auxi:Nw #1
  }
\cs_new_protected:Npn \__keys_find_key_module_auxiv:Nw
    #1 #2 \s__keys_nil #3 \s__keys_mark
    \s__keys_nil \__keys_find_key_module_auxiv:Nw #4
  {
    \cs_set_nopar:Npn #4 { #2 }
  }
\cs_new_protected:Npn \__keys_set_selective:
  {
    \cs_if_exist:cTF { \c__keys_groups_root_str \l_keys_path_str }
      {
        \clist_set_eq:Nc \l__keys_groups_clist
          { \c__keys_groups_root_str \l_keys_path_str }
        \__keys_check_groups:
      }
      {
        \bool_if:NTF \l__keys_filtered_bool
          \__keys_execute:
          \__keys_store_unused:
      }
  }
\cs_new_protected:Npn \__keys_check_groups:
  {
    \bool_set_false:N \l__keys_tmp_bool
    \seq_map_inline:Nn \l__keys_selective_seq
      {
        \clist_map_inline:Nn \l__keys_groups_clist
          {
            \str_if_eq:nnT {##1} {####1}
              {
                \bool_set_true:N \l__keys_tmp_bool
                \clist_map_break:n \seq_map_break:
              }
          }
      }
    \bool_if:NTF \l__keys_tmp_bool
      {
        \bool_if:NTF \l__keys_filtered_bool
          \__keys_store_unused:
          \__keys_execute:
      }
      {
        \bool_if:NTF \l__keys_filtered_bool
          \__keys_execute:
          \__keys_store_unused:
      }
  }
\cs_new_protected:Npn \__keys_value_or_default:n #1
  {
    \bool_if:NTF \l__keys_no_value_bool
      {
        \cs_if_exist:cTF { \c__keys_default_root_str \l_keys_path_str }
          {
            \tl_set_eq:Nc
              \l_keys_value_tl
              { \c__keys_default_root_str \l_keys_path_str }
          }
          {
            \tl_clear:N \l_keys_value_tl
            \cs_if_exist:cT
              { \c__keys_inherit_root_str \__keys_parent:o \l_keys_path_str }
              { \__keys_default_inherit: }
          }
      }
      { \tl_set:Nn \l_keys_value_tl {#1} }
  }
\cs_new_protected:Npn \__keys_default_inherit:
  {
    \clist_map_inline:cn
      { \c__keys_inherit_root_str \__keys_parent:o \l_keys_path_str }
      {
        \cs_if_exist:cT
          { \c__keys_default_root_str ##1 / \l_keys_key_str }
          {
            \tl_set_eq:Nc
              \l_keys_value_tl
              { \c__keys_default_root_str ##1 / \l_keys_key_str }
            \clist_map_break:
          }
      }
  }
\cs_new_protected:Npn \__keys_execute:
  {
    \cs_if_exist:cTF { \c__keys_code_root_str \l_keys_path_str }
      {
        \cs_if_exist_use:c { \c__keys_validate_root_str \l_keys_path_str }
        \__keys_execute:no \l_keys_path_str \l_keys_value_tl
      }
      {
        \cs_if_exist:cTF
          { \c__keys_inherit_root_str \__keys_parent:o \l_keys_path_str }
          { \__keys_execute_inherit: }
          { \__keys_execute_unknown: }
      }
  }
\cs_new_protected:Npn \__keys_execute_inherit:
  {
    \clist_map_inline:cn
      { \c__keys_inherit_root_str \__keys_parent:o \l_keys_path_str }
      {
        \cs_if_exist:cT
          { \c__keys_code_root_str ##1 / \l_keys_key_str }
          {
            \str_set:Nn \l__keys_inherit_str {##1}
            \cs_if_exist_use:c { \c__keys_validate_root_str ##1 / \l_keys_key_str }
            \__keys_execute:no { ##1 / \l_keys_key_str } \l_keys_value_tl
            \clist_map_break:n \use_none:n
          }
      }
    \__keys_execute_unknown:
  }
\cs_new_protected:Npn \__keys_execute_unknown:
  {
    \bool_if:NTF \l__keys_only_known_bool
      { \__keys_store_unused: }
      {
        \cs_if_exist:cTF
          { \c__keys_code_root_str \l__keys_module_str / unknown }
          { \__keys_execute:no { \l__keys_module_str / unknown } \l_keys_value_tl }
          {
            \__kernel_msg_error:nnxx { kernel } { key-unknown }
              \l_keys_path_str \l__keys_module_str
          }
      }
  }
\cs_new:Npn \__keys_execute:nn #1#2
  { \__keys_execute:no {#1} { \prg_do_nothing: #2 } }
\cs_new:Npn \__keys_execute:no #1#2
  {
    \exp_args:NNo \exp_args:No \use:n
      {
        \cs:w \c__keys_code_root_str #1 \exp_after:wN \cs_end:
        \exp_after:wN {#2}
      }
  }
\cs_new_protected:Npn \__keys_store_unused:
  {
    \__keys_quark_if_no_value:NTF \l__keys_relative_tl
      {
        \clist_put_right:Nx \l__keys_unused_clist
          {
            \l_keys_key_str
            \bool_if:NF \l__keys_no_value_bool
              { = { \exp_not:o \l_keys_value_tl } }
          }
      }
      {
        \tl_if_empty:NTF \l__keys_relative_tl
          {
            \clist_put_right:Nx \l__keys_unused_clist
              {
                \l_keys_path_str
                \bool_if:NF \l__keys_no_value_bool
                  { = { \exp_not:o \l_keys_value_tl } }
              }
          }
          { \__keys_store_unused_aux: }
      }
  }
\cs_new_protected:Npn \__keys_store_unused_aux:
  {
    \__kernel_tl_set:Nx \l__keys_relative_tl
      { \exp_args:No \__keys_trim_spaces:n \l__keys_relative_tl }
    \use:x
      {
        \cs_set_protected:Npn \__keys_store_unused:w
          ####1 \l__keys_relative_tl /
          ####2 \l__keys_relative_tl /
          ####3 \s__keys_stop
      }
        {
          \tl_if_blank:nF {##1}
            {
              \__kernel_msg_error:nnxx { kernel } { bad-relative-key-path }
                \l_keys_path_str
                \l__keys_relative_tl
            }
          \clist_put_right:Nx \l__keys_unused_clist
            {
              \exp_not:n {##2}
              \bool_if:NF \l__keys_no_value_bool
                { = { \exp_not:o \l_keys_value_tl } }
            }
        }
    \use:x
      {
        \__keys_store_unused:w \l_keys_path_str
          \l__keys_relative_tl / \l__keys_relative_tl /
          \s__keys_stop
      }
  }
\cs_new_protected:Npn \__keys_store_unused:w { }
\cs_new:Npn \__keys_choice_find:n #1
  {
    \str_if_empty:NTF \l__keys_inherit_str
      { \__keys_choice_find:nn \l_keys_path_str {#1} }
      {
        \__keys_choice_find:nn
          { \l__keys_inherit_str / \l_keys_key_str } {#1}
      }
  }
\cs_new:Npn \__keys_choice_find:nn #1#2
  {
    \cs_if_exist:cTF { \c__keys_code_root_str #1 / \__keys_trim_spaces:n {#2} }
      { \__keys_execute:nn { #1 / \__keys_trim_spaces:n {#2} } {#2} }
      { \__keys_execute:nn { #1 / unknown } {#2} }
  }
\cs_new:Npn \__keys_multichoice_find:n #1
  { \clist_map_function:nN {#1} \__keys_choice_find:n }
\cs_new:Npn \__keys_parent:o #1
  {
    \exp_after:wN \__keys_parent_auxi:w #1 \q_nil \__keys_parent_auxii:w
      / \q_nil \__keys_parent_auxiv:w
  }
\cs_new:Npn \__keys_parent_auxi:w #1 / #2 \q_nil #3
  {
    #3 { #1 } #2 \q_nil #3
  }
\cs_new:Npn \__keys_parent_auxii:w #1 #2 \q_nil \__keys_parent_auxii:w
  {
    #1 \__keys_parent_auxi:w #2 \q_nil \__keys_parent_auxiii:n
  }
\cs_new:Npn \__keys_parent_auxiii:n #1
  {
    / #1 \__keys_parent_auxi:w
  }
\cs_new:Npn \__keys_parent_auxiv:w #1 \q_nil \__keys_parent_auxiv:w
  {
  }
\group_begin:
  \cs_set:Npn \__keys_tmp:n #1
    {
      \cs_new:Npn \__keys_trim_spaces:n ##1
        {
          \exp_after:wN \__keys_trim_spaces_auxi:w \tl_to_str:n { / ##1 } /
            \s__keys_nil  \__keys_trim_spaces_auxi:w
            \s__keys_mark \__keys_trim_spaces_auxii:w
            #1 / #1
            \s__keys_nil  \__keys_trim_spaces_auxii:w
            \s__keys_mark \__keys_trim_spaces_auxiii:w
        }
    }
  \__keys_tmp:n { ~ }
\group_end:
\cs_new:Npn \__keys_trim_spaces_auxi:w #1 ~ / #2 \s__keys_nil #3
  {
    #3 #1 / #2 \s__keys_nil #3
  }
\cs_new:Npn \__keys_trim_spaces_auxii:w #1 / ~ #2 \s__keys_mark #3
  {
    #3 #1 / #2 \s__keys_mark #3
  }
\cs_new:Npn \__keys_trim_spaces_auxiii:w
    / #1 /
    \s__keys_nil  \__keys_trim_spaces_auxi:w
    \s__keys_mark \__keys_trim_spaces_auxii:w
    /
    \s__keys_nil  \__keys_trim_spaces_auxii:w
    \s__keys_mark \__keys_trim_spaces_auxiii:w
  {
    #1
  }
\prg_new_conditional:Npnn \keys_if_exist:nn #1#2 { p , T , F , TF }
  {
    \cs_if_exist:cTF
      { \c__keys_code_root_str \__keys_trim_spaces:n { #1 / #2 } }
      { \prg_return_true: }
      { \prg_return_false: }
  }
\prg_new_conditional:Npnn \keys_if_choice_exist:nnn #1#2#3
  { p , T , F , TF }
  {
    \cs_if_exist:cTF
      { \c__keys_code_root_str \__keys_trim_spaces:n { #1 / #2 / #3 } }
      { \prg_return_true: }
      { \prg_return_false: }
  }
\cs_new_protected:Npn \keys_show:nn
  { \__keys_show:Nnn \msg_show:nnxxxx }
\cs_new_protected:Npn \keys_log:nn
  { \__keys_show:Nnn \msg_log:nnxxxx }
\cs_new_protected:Npn \__keys_show:Nnn #1#2#3
  {
    #1 { LaTeX / kernel } { show-key }
      { \__keys_trim_spaces:n { #2 / #3 } }
      {
        \keys_if_exist:nnT {#2} {#3}
          {
            \exp_args:Nnf \msg_show_item_unbraced:nn { code }
              {
                \exp_args:Nc \cs_replacement_spec:N
                  {
                    \c__keys_code_root_str
                    \__keys_trim_spaces:n { #2 / #3 }
                  }
              }
          }
      }
      { } { }
  }
\__kernel_msg_new:nnnn { kernel } { bad-relative-key-path }
  { The~key~'#1'~is~not~inside~the~'#2'~path. }
  { The~key~'#1'~cannot~be~expressed~relative~to~path~'#2'. }
\__kernel_msg_new:nnnn { kernel } { boolean-values-only }
  { Key~'#1'~accepts~boolean~values~only. }
  { The~key~'#1'~only~accepts~the~values~'true'~and~'false'. }
\__kernel_msg_new:nnnn { kernel } { key-choice-unknown }
  { Key~'#1'~accepts~only~a~fixed~set~of~choices. }
  {
    The~key~'#1'~only~accepts~predefined~values,~
    and~'#2'~is~not~one~of~these.
  }
\__kernel_msg_new:nnnn { kernel } { key-unknown }
  { The~key~'#1'~is~unknown~and~is~being~ignored. }
  {
    The~module~'#2'~does~not~have~a~key~called~'#1'.\\
    Check~that~you~have~spelled~the~key~name~correctly.
  }
\__kernel_msg_new:nnnn { kernel } { nested-choice-key }
  { Attempt~to~define~'#1'~as~a~nested~choice~key. }
  {
    The~key~'#1'~cannot~be~defined~as~a~choice~as~the~parent~key~'#2'~is~
    itself~a~choice.
  }
\__kernel_msg_new:nnnn { kernel } { value-forbidden }
  { The~key~'#1'~does~not~take~a~value. }
  {
    The~key~'#1'~should~be~given~without~a~value.\\
    The~value~'#2'~was~present:~the~key~will~be~ignored.
  }
\__kernel_msg_new:nnnn { kernel } { value-required }
  { The~key~'#1'~requires~a~value. }
  {
    The~key~'#1'~must~have~a~value.\\
    No~value~was~present:~the~key~will~be~ignored.
  }
\__kernel_msg_new:nnn { kernel } { show-key }
  {
    The~key~#1~
    \tl_if_empty:nTF {#2}
      { is~undefined. }
      { has~the~properties: #2 . }
  }
%% File: l3intarray.dtx
\cs_new_eq:NN \__intarray_entry:w \tex_fontdimen:D
\cs_new_eq:NN \__intarray_count:w \tex_hyphenchar:D
\int_new:N \l__intarray_loop_int
\dim_const:Nn \c__intarray_sp_dim { 1 sp }
\int_new:N \g__intarray_font_int
\__kernel_msg_new:nnn { kernel } { negative-array-size }
  { Size~of~array~may~not~be~negative:~#1 }
\cs_new_protected:Npn \__intarray_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \int_gincr:N \g__intarray_font_int
    \tex_global:D \tex_font:D #1
      = cmr10~at~ \g__intarray_font_int \c__intarray_sp_dim \scan_stop:
    \int_step_inline:nn { 8 }
      { \__kernel_intarray_gset:Nnn #1 {##1} \c_zero_int }
  }
\cs_new_protected:Npn \intarray_new:Nn #1#2
  {
    \__intarray_new:N #1
    \__intarray_count:w #1 = \int_eval:n {#2} \scan_stop:
    \int_compare:nNnT { \intarray_count:N #1 } < 0
      {
        \__kernel_msg_error:nnx { kernel } { negative-array-size }
          { \intarray_count:N #1 }
      }
    \int_compare:nNnT { \intarray_count:N #1 } > 0
      { \__kernel_intarray_gset:Nnn #1 { \intarray_count:N #1 } { 0 } }
  }
\cs_generate_variant:Nn \intarray_new:Nn { c }
\cs_new:Npn \intarray_count:N #1 { \int_value:w \__intarray_count:w #1 }
\cs_generate_variant:Nn \intarray_count:N { c }
\cs_new:Npn \__intarray_signed_max_dim:n #1
  { \int_value:w \int_compare:nNnT {#1} < 0 { - } \c_max_dim }
\cs_new:Npn \__intarray_bounds:NNnTF #1#2#3
  {
    \if_int_compare:w 1 > #3 \exp_stop_f:
      \__intarray_bounds_error:NNnw #1 #2 {#3}
    \else:
      \if_int_compare:w #3 > \intarray_count:N #2 \exp_stop_f:
        \__intarray_bounds_error:NNnw #1 #2 {#3}
      \fi:
    \fi:
    \use_i:nn
  }
\cs_new:Npn \__intarray_bounds_error:NNnw #1#2#3#4 \use_i:nn #5#6
  {
    #4
    #1 { kernel } { out-of-bounds }
      { \token_to_str:N #2 } {#3} { \intarray_count:N #2 }
    #6
  }
\cs_new_protected:Npn \__kernel_intarray_gset:Nnn #1#2#3
  { \__intarray_entry:w #2 #1 #3 \c__intarray_sp_dim }
\cs_new_protected:Npn \intarray_gset:Nnn #1#2#3
  {
    \exp_after:wN \__intarray_gset:Nww
    \exp_after:wN #1
    \int_value:w \int_eval:n {#2} \exp_after:wN ;
    \int_value:w \int_eval:n {#3} ;
  }
\cs_generate_variant:Nn \intarray_gset:Nnn { c }
\cs_new_protected:Npn \__intarray_gset:Nww #1#2 ; #3 ;
  {
    \__intarray_bounds:NNnTF \__kernel_msg_error:nnxxx #1 {#2}
      {
        \__intarray_gset_overflow_test:nw {#3}
        \__kernel_intarray_gset:Nnn #1 {#2} {#3}
      }
      { }
  }
\cs_if_exist:NTF \tex_ifabsnum:D
  {
    \cs_new_protected:Npn \__intarray_gset_overflow_test:nw #1
      {
        \tex_ifabsnum:D #1 > \c_max_dim
          \exp_after:wN \__intarray_gset_overflow:NNnn
        \fi:
      }
  }
  {
    \cs_new_protected:Npn \__intarray_gset_overflow_test:nw #1
      {
        \if_int_compare:w \int_abs:n {#1} > \c_max_dim
          \exp_after:wN \__intarray_gset_overflow:NNnn
        \fi:
      }
  }
\cs_new_protected:Npn \__intarray_gset_overflow:NNnn #1#2#3#4
  {
    \__kernel_msg_error:nnxxxx { kernel } { overflow }
      { \token_to_str:N #2 } {#3} {#4} {  \__intarray_signed_max_dim:n {#4} }
    #1 #2 {#3} { \__intarray_signed_max_dim:n {#4} }
  }
\cs_new_protected:Npn \intarray_gzero:N #1
  {
    \int_zero:N \l__intarray_loop_int
    \prg_replicate:nn { \intarray_count:N #1 }
      {
        \int_incr:N \l__intarray_loop_int
        \__intarray_entry:w \l__intarray_loop_int #1 \c_zero_dim
      }
  }
\cs_generate_variant:Nn \intarray_gzero:N { c }
\cs_new:Npn \__kernel_intarray_item:Nn #1#2
  { \int_value:w \__intarray_entry:w #2 #1 }
\cs_new:Npn \intarray_item:Nn #1#2
  {
    \exp_after:wN \__intarray_item:Nw
    \exp_after:wN #1
    \int_value:w \int_eval:n {#2} ;
  }
\cs_generate_variant:Nn \intarray_item:Nn { c }
\cs_new:Npn \__intarray_item:Nw #1#2 ;
  {
    \__intarray_bounds:NNnTF \__kernel_msg_expandable_error:nnfff #1 {#2}
      { \__kernel_intarray_item:Nn #1 {#2} }
      { 0 }
  }
\cs_new:Npn \intarray_rand_item:N #1
  { \intarray_item:Nn #1 { \int_rand:n { \intarray_count:N #1 } } }
\cs_generate_variant:Nn \intarray_rand_item:N { c }
\cs_new_protected:Npn \intarray_const_from_clist:Nn #1#2
  {
    \__intarray_new:N #1
    \int_zero:N \l__intarray_loop_int
    \clist_map_inline:nn {#2}
      { \exp_args:Nf \__intarray_const_from_clist:nN { \int_eval:n {##1} } #1 }
    \__intarray_count:w #1 \l__intarray_loop_int
  }
\cs_generate_variant:Nn \intarray_const_from_clist:Nn { c }
\cs_new_protected:Npn \__intarray_const_from_clist:nN #1#2
  {
    \int_incr:N \l__intarray_loop_int
    \__intarray_gset_overflow_test:nw {#1}
    \__kernel_intarray_gset:Nnn #2 \l__intarray_loop_int {#1}
  }
\cs_new:Npn \intarray_to_clist:N #1 { \__intarray_to_clist:Nn #1 { , } }
\cs_generate_variant:Nn \intarray_to_clist:N { c }
\cs_new:Npn \__intarray_to_clist:Nn #1#2
  {
    \int_compare:nNnF { \intarray_count:N #1 } = \c_zero_int
      {
        \exp_last_unbraced:Nf \use_none:n
          { \__intarray_to_clist:w 1 ; #1 {#2} \prg_break_point: }
      }
  }
\cs_new:Npn \__intarray_to_clist:w #1 ; #2#3
  {
    \if_int_compare:w #1 > \__intarray_count:w #2
      \prg_break:n
    \fi:
    #3 \__kernel_intarray_item:Nn #2 {#1}
    \exp_after:wN \__intarray_to_clist:w
    \int_value:w \int_eval:w #1 + \c_one_int ; #2 {#3}
  }
\cs_new:Npn \__kernel_intarray_range_to_clist:Nnn #1#2#3
  {
    \exp_last_unbraced:Nf \use_none:n
      {
        \exp_after:wN \__intarray_range_to_clist:ww
        \int_value:w \int_eval:w #2 \exp_after:wN ;
        \int_value:w \int_eval:w #3 ;
        #1 \prg_break_point:
      }
  }
\cs_new:Npn \__intarray_range_to_clist:ww #1 ; #2 ; #3
  {
    \if_int_compare:w #1 > #2 \exp_stop_f:
      \prg_break:n
    \fi:
    , \__kernel_intarray_item:Nn #3 {#1}
    \exp_after:wN \__intarray_range_to_clist:ww
    \int_value:w \int_eval:w #1 + \c_one_int ; #2 ; #3
  }
\cs_new_protected:Npn \__kernel_intarray_gset_range_from_clist:Nnn #1#2#3
  {
    \int_set:Nn \l__intarray_loop_int {#2}
    \__intarray_gset_range:Nw #1 #3 , , \prg_break_point:
  }
\cs_new_protected:Npn \__intarray_gset_range:Nw #1 #2 ,
  {
    \if_catcode:w \scan_stop: \tl_to_str:n {#2} \scan_stop:
      \prg_break:n
    \fi:
    \__kernel_intarray_gset:Nnn #1 \l__intarray_loop_int {#2}
    \int_incr:N \l__intarray_loop_int
    \__intarray_gset_range:Nw #1
  }
\cs_new_protected:Npn \intarray_show:N { \__intarray_show:NN \msg_show:nnxxxx }
\cs_generate_variant:Nn \intarray_show:N { c }
\cs_new_protected:Npn \intarray_log:N { \__intarray_show:NN \msg_log:nnxxxx }
\cs_generate_variant:Nn \intarray_log:N { c }
\cs_new_protected:Npn \__intarray_show:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      {
        #1 { LaTeX/kernel } { show-intarray }
          { \token_to_str:N #2 }
          { \intarray_count:N #2 }
          { >~ \__intarray_to_clist:Nn #2 { , ~ } }
          { }
      }
  }
\cs_new_protected:Npn \intarray_gset_rand:Nn #1
  { \intarray_gset_rand:Nnn #1 { 1 } }
\cs_generate_variant:Nn \intarray_gset_rand:Nn { c }
\sys_if_rand_exist:TF
  {
    \cs_new_protected:Npn \intarray_gset_rand:Nnn #1#2#3
      {
        \__intarray_gset_rand:Nff #1
          { \int_eval:n {#2} } { \int_eval:n {#3} }
      }
    \cs_new_protected:Npn \__intarray_gset_rand:Nnn #1#2#3
      {
        \int_compare:nNnTF {#2} > {#3}
          {
            \__kernel_msg_expandable_error:nnnn
              { kernel } { randint-backward-range } {#2} {#3}
            \__intarray_gset_rand:Nnn #1 {#3} {#2}
          }
          {
            \__intarray_gset_overflow_test:nw {#2}
            \__intarray_gset_rand_auxi:Nnnn #1 { } {#2} {#3}
          }
      }
    \cs_generate_variant:Nn \__intarray_gset_rand:Nnn { Nff }
    \cs_new_protected:Npn \__intarray_gset_rand_auxi:Nnnn #1#2#3#4
      {
        \__intarray_gset_overflow_test:nw {#4}
        \__intarray_gset_rand_auxii:Nnnn #1 { } {#4} {#3}
      }
    \cs_new_protected:Npn \__intarray_gset_rand_auxii:Nnnn #1#2#3#4
      {
        \exp_args:NNf \__intarray_gset_rand_auxiii:Nnnn #1
          { \int_eval:n { #3 - #4 + 1 } } {#4} {#3}
      }
    \cs_new_protected:Npn \__intarray_gset_rand_auxiii:Nnnn #1#2#3#4
      {
        \exp_args:NNf \__intarray_gset_all_same:Nn #1
          {
            \int_compare:nNnTF {#2} > \c__kernel_randint_max_int
              {
                \exp_stop_f:
                \int_eval:n { \__kernel_randint:nn {#3} {#4} }
              }
              {
                \exp_stop_f:
                \int_eval:n { \__kernel_randint:n {#2} - 1 + #3 }
              }
          }
      }
    \cs_new_protected:Npn \__intarray_gset_all_same:Nn #1#2
      {
        \int_zero:N \l__intarray_loop_int
        \prg_replicate:nn { \intarray_count:N #1 }
          {
            \int_incr:N \l__intarray_loop_int
            \__kernel_intarray_gset:Nnn #1 \l__intarray_loop_int {#2}
          }
      }
  }
  {
    \cs_new_protected:Npn \intarray_gset_rand:Nnn #1#2#3
      {
        \__kernel_msg_error:nnn { kernel } { fp-no-random }
          { \intarray_gset_rand:Nnn #1 {#2} {#3} }
      }
  }
\cs_generate_variant:Nn \intarray_gset_rand:Nnn { c }
%% File: l3fp.dtx
%% File: l3fp-aux.dtx
\cs_new_eq:NN \__fp_int_eval:w \tex_numexpr:D
\cs_new_eq:NN \__fp_int_eval_end: \scan_stop:
\cs_new_eq:NN \__fp_int_to_roman:w \tex_romannumeral:D
\cs_new:Npn \__fp_use_none_stop_f:n #1 { \exp_stop_f: }
\cs_new:Npn \__fp_use_s:n #1 { #1; }
\cs_new:Npn \__fp_use_s:nn #1#2 { #1#2; }
\cs_new:Npn \__fp_use_none_until_s:w #1; { }
\cs_new:Npn \__fp_use_i_until_s:nw #1#2; {#1}
\cs_new:Npn \__fp_use_ii_until_s:nnw #1#2#3; {#2}
\cs_new:Npn \__fp_reverse_args:Nww #1 #2; #3; { #1 #3; #2; }
\cs_new:Npn \__fp_rrot:www #1; #2; #3; { #2; #3; #1; }
\cs_new:Npn \__fp_use_i:ww #1; #2; { #1; }
\cs_new:Npn \__fp_use_i:www #1; #2; #3; { #1; }
\cs_new_protected:Npn \__fp_misused:n #1
  { \__kernel_msg_error:nnx { kernel } { misused-fp } { \fp_to_tl:n {#1} } }
\scan_new:N \s__fp
\cs_new_protected:Npn \__fp_chk:w #1 ;
  { \__fp_misused:n { \s__fp \__fp_chk:w #1 ; } }
\scan_new:N \s__fp_expr_mark
\scan_new:N \s__fp_expr_stop
\scan_new:N \s__fp_mark
\scan_new:N \s__fp_stop
\cs_new:Npn \__fp_use_i_delimit_by_s_stop:nw #1 #2 \s__fp_stop {#1}
\scan_new:N \s__fp_invalid
\scan_new:N \s__fp_underflow
\scan_new:N \s__fp_overflow
\scan_new:N \s__fp_division
\scan_new:N \s__fp_exact
\tl_const:Nn \c_zero_fp       { \s__fp \__fp_chk:w 0 0 \s__fp_exact ; }
\tl_const:Nn \c_minus_zero_fp { \s__fp \__fp_chk:w 0 2 \s__fp_exact ; }
\tl_const:Nn \c_inf_fp        { \s__fp \__fp_chk:w 2 0 \s__fp_exact ; }
\tl_const:Nn \c_minus_inf_fp  { \s__fp \__fp_chk:w 2 2 \s__fp_exact ; }
\tl_const:Nn \c_nan_fp        { \s__fp \__fp_chk:w 3 1 \s__fp_exact ; }
\int_const:Nn \c__fp_prec_int { 16 }
\int_const:Nn \c__fp_half_prec_int { 8 }
\int_const:Nn \c__fp_block_int { 4 }
\int_const:Nn \c__fp_myriad_int { 10000 }
\int_const:Nn \c__fp_minus_min_exponent_int { 10000 }
\int_const:Nn \c__fp_max_exponent_int { 10000 }
\int_const:Nn \c__fp_max_exp_exponent_int { 5 }
\tl_const:Nx \c__fp_overflowing_fp
  {
    \s__fp \__fp_chk:w 1 0
      { \int_eval:n { \c__fp_max_exponent_int + 1 } }
      {1000} {0000} {0000} {0000} ;
  }
\cs_new:Npn \__fp_zero_fp:N #1
  { \s__fp \__fp_chk:w 0 #1 \s__fp_underflow ; }
\cs_new:Npn \__fp_inf_fp:N #1
  { \s__fp \__fp_chk:w 2 #1 \s__fp_overflow ; }
\cs_new:Npn \__fp_exponent:w \s__fp \__fp_chk:w #1
  {
    \if_meaning:w 1 #1
      \exp_after:wN \__fp_use_ii_until_s:nnw
    \else:
      \exp_after:wN \__fp_use_i_until_s:nw
      \exp_after:wN 0
    \fi:
  }
\cs_new:Npn \__fp_neg_sign:N #1
  { \__fp_int_eval:w 2 - #1 \__fp_int_eval_end: }
\cs_new:Npn \__fp_kind:w #1
  {
    \__fp_if_type_fp:NTwFw
      #1 \__fp_use_ii_until_s:nnw
      \s__fp { \__fp_use_i_until_s:nw 4 }
      \s__fp_stop
  }
\cs_new:Npn \__fp_sanitize:Nw #1 #2;
  {
    \if_case:w
        \if_int_compare:w #2 > \c__fp_max_exponent_int 1 ~ \else:
        \if_int_compare:w #2 < - \c__fp_minus_min_exponent_int 2 ~ \else:
        \if_meaning:w 1 #1 3 ~ \fi: \fi: \fi: 0 ~
    \or: \exp_after:wN \__fp_overflow:w
    \or: \exp_after:wN \__fp_underflow:w
    \or: \exp_after:wN \__fp_sanitize_zero:w
    \fi:
    \s__fp \__fp_chk:w 1 #1 {#2}
  }
\cs_new:Npn \__fp_sanitize:wN #1; #2 { \__fp_sanitize:Nw #2 #1; }
\cs_new:Npn \__fp_sanitize_zero:w \s__fp \__fp_chk:w #1 #2 #3;
  { \c_zero_fp }
\cs_new:Npn \__fp_exp_after_o:w \s__fp \__fp_chk:w #1
  {
    \if_meaning:w 1 #1
      \exp_after:wN \__fp_exp_after_normal:nNNw
    \else:
      \exp_after:wN \__fp_exp_after_special:nNNw
    \fi:
    { }
    #1
  }
\cs_new:Npn \__fp_exp_after_f:nw #1 \s__fp \__fp_chk:w #2
  {
    \if_meaning:w 1 #2
      \exp_after:wN \__fp_exp_after_normal:nNNw
    \else:
      \exp_after:wN \__fp_exp_after_special:nNNw
    \fi:
    { \exp:w \exp_end_continue_f:w #1 }
    #2
  }
\cs_new:Npn \__fp_exp_after_special:nNNw #1#2#3#4;
  {
    \exp_after:wN \s__fp
    \exp_after:wN \__fp_chk:w
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN #4
    \exp_after:wN ;
    #1
  }
\cs_new:Npn \__fp_exp_after_normal:nNNw #1 1 #2 #3 #4#5#6#7;
  {
    \exp_after:wN \__fp_exp_after_normal:Nwwwww
    \exp_after:wN #2
    \int_value:w #3   \exp_after:wN ;
    \int_value:w 1 #4 \exp_after:wN ;
    \int_value:w 1 #5 \exp_after:wN ;
    \int_value:w 1 #6 \exp_after:wN ;
    \int_value:w 1 #7 \exp_after:wN ; #1
  }
\cs_new:Npn \__fp_exp_after_normal:Nwwwww
    #1 #2; 1 #3 ; 1 #4 ; 1 #5 ; 1 #6 ;
  { \s__fp \__fp_chk:w 1 #1 {#2} {#3} {#4} {#5} {#6} ; }
\scan_new:N \s__fp_tuple
\cs_new_protected:Npn \__fp_tuple_chk:w #1 ;
  { \__fp_misused:n { \s__fp_tuple \__fp_tuple_chk:w #1 ; } }
\tl_const:Nn \c__fp_empty_tuple_fp
  { \s__fp_tuple \__fp_tuple_chk:w { } ; }
\cs_new:Npn \__fp_array_count:n #1
  { \__fp_tuple_count:w \s__fp_tuple \__fp_tuple_chk:w {#1} ; }
\cs_new:Npn \__fp_tuple_count:w \s__fp_tuple \__fp_tuple_chk:w #1 ;
  {
    \int_value:w \__fp_int_eval:w 0
      \__fp_tuple_count_loop:Nw #1 { ? \prg_break: } ;
      \prg_break_point:
    \__fp_int_eval_end:
  }
\cs_new:Npn \__fp_tuple_count_loop:Nw #1#2;
  { \use_none:n #1 + 1 \__fp_tuple_count_loop:Nw }
\cs_new:Npn \__fp_if_type_fp:NTwFw #1 \s__fp #2 #3 \s__fp_stop {#2}
\cs_new:Npn \__fp_array_if_all_fp:nTF #1
  {
    \__fp_array_if_all_fp_loop:w #1 { \s__fp \prg_break: } ;
    \prg_break_point: \use_i:nn
  }
\cs_new:Npn \__fp_array_if_all_fp_loop:w #1#2 ;
  {
    \__fp_if_type_fp:NTwFw
      #1 \__fp_array_if_all_fp_loop:w
      \s__fp { \prg_break:n \use_iii:nnn }
      \s__fp_stop
  }
\cs_new:Npn \__fp_type_from_scan:N #1
  {
    \__fp_if_type_fp:NTwFw
      #1 { }
      \s__fp { \__fp_type_from_scan_other:N #1 }
      \s__fp_stop
  }
\cs_new:Npx \__fp_type_from_scan_other:N #1
  {
    \exp_not:N \exp_after:wN \exp_not:N \__fp_type_from_scan:w
    \exp_not:N \token_to_str:N #1 \s__fp_mark
      \tl_to_str:n { s__fp _? } \s__fp_mark \s__fp_stop
  }
\exp_last_unbraced:NNNNo
  \cs_new:Npn \__fp_type_from_scan:w #1
    { \tl_to_str:n { s__fp } } #2 \s__fp_mark #3 \s__fp_stop {#2}
\cs_new:Npn \__fp_change_func_type:NNN #1#2#3
  {
    \__fp_if_type_fp:NTwFw
      #1 #2
      \s__fp
        {
          \exp_after:wN \__fp_change_func_type_chk:NNN
          \cs:w
            __fp \__fp_type_from_scan_other:N #1
            \exp_after:wN \__fp_change_func_type_aux:w \token_to_str:N #2
          \cs_end:
          #2 #3
        }
      \s__fp_stop
  }
\exp_last_unbraced:NNNNo
  \cs_new:Npn \__fp_change_func_type_aux:w #1 { \tl_to_str:n { __fp } } { }
\cs_new:Npn \__fp_change_func_type_chk:NNN #1#2#3
  {
    \if_meaning:w \scan_stop: #1
      \exp_after:wN #3 \exp_after:wN #2
    \else:
      \exp_after:wN #1
    \fi:
  }
\cs_new:Npn \__fp_exp_after_any_f:Nnw #1
  { \cs:w __fp_exp_after \__fp_type_from_scan_other:N #1 _f:nw \cs_end: }
\cs_new:Npn \__fp_exp_after_any_f:nw #1#2
  {
    \__fp_if_type_fp:NTwFw
      #2 \__fp_exp_after_f:nw
      \s__fp { \__fp_exp_after_any_f:Nnw #2 }
      \s__fp_stop
    {#1} #2
  }
\cs_new_eq:NN \__fp_exp_after_expr_stop_f:nw \use_none:nn
\cs_new:Npn \__fp_exp_after_tuple_o:w
  { \__fp_exp_after_tuple_f:nw { \exp_after:wN \exp_stop_f: } }
\cs_new:Npn \__fp_exp_after_tuple_f:nw
  #1 \s__fp_tuple \__fp_tuple_chk:w #2 ;
  {
    \exp_after:wN \s__fp_tuple
    \exp_after:wN \__fp_tuple_chk:w
    \exp_after:wN {
      \exp:w \exp_end_continue_f:w
      \__fp_exp_after_array_f:w #2 \s__fp_expr_stop
    \exp_after:wN }
    \exp_after:wN ;
    \exp:w \exp_end_continue_f:w #1
  }
\cs_new:Npn \__fp_exp_after_array_f:w
  { \__fp_exp_after_any_f:nw { \__fp_exp_after_array_f:w } }
\int_const:Nn \c__fp_leading_shift_int  { - 5 0000 }
\int_const:Nn \c__fp_middle_shift_int   { 5 0000 *  9999 }
\int_const:Nn \c__fp_trailing_shift_int { 5 0000 * 10000 }
\cs_new:Npn \__fp_pack:NNNNNw #1 #2#3#4#5 #6; { + #1#2#3#4#5 ; {#6} }
\int_const:Nn \c__fp_big_leading_shift_int  { - 15 2374 }
\int_const:Nn \c__fp_big_middle_shift_int   { 15 2374 *  9999 }
\int_const:Nn \c__fp_big_trailing_shift_int { 15 2374 * 10000 }
\cs_new:Npn \__fp_pack_big:NNNNNNw #1#2 #3#4#5#6 #7;
  { + #1#2#3#4#5#6 ; {#7} }
\int_const:Nn \c__fp_Bigg_leading_shift_int  { - 20 0000 }
\int_const:Nn \c__fp_Bigg_middle_shift_int   { 20 0000 *  9999 }
\int_const:Nn \c__fp_Bigg_trailing_shift_int { 20 0000 * 10000 }
\cs_new:Npn \__fp_pack_Bigg:NNNNNNw #1#2 #3#4#5#6 #7;
  { + #1#2#3#4#5#6 ; {#7} }
\cs_new:Npn \__fp_pack_twice_four:wNNNNNNNN #1; #2#3#4#5 #6#7#8#9
  { #1 {#2#3#4#5} {#6#7#8#9} ; }
\cs_new:Npn \__fp_pack_eight:wNNNNNNNN #1; #2#3#4#5 #6#7#8#9
  { #1 {#2#3#4#5#6#7#8#9} ; }
\cs_new:Npn \__fp_basics_pack_low:NNNNNw #1 #2#3#4#5 #6;
  { + #1 - 1 ; {#2#3#4#5} {#6} ; }
\cs_new:Npn \__fp_basics_pack_high:NNNNNw #1 #2#3#4#5 #6;
  {
    \if_meaning:w 2 #1
      \__fp_basics_pack_high_carry:w
    \fi:
    ; {#2#3#4#5} {#6}
  }
\cs_new:Npn \__fp_basics_pack_high_carry:w \fi: ; #1
  { \fi: + 1 ; {1000} }
\cs_new:Npn \__fp_basics_pack_weird_low:NNNNw #1 #2#3#4 #5;
  {
    \if_meaning:w 2 #1
      + 1
    \fi:
    \__fp_int_eval_end:
    #2#3#4; {#5} ;
  }
\cs_new:Npn \__fp_basics_pack_weird_high:NNNNNNNNw
   1 #1#2#3#4 #5#6#7#8 #9; { ; {#1#2#3#4} {#5#6#7#8} {#9} }
\cs_new:Npn \__fp_decimate:nNnnnn #1
  {
    \cs:w
      __fp_decimate_
      \if_int_compare:w \__fp_int_eval:w #1 > \c__fp_prec_int
        tiny
      \else:
        \__fp_int_to_roman:w \__fp_int_eval:w #1
      \fi:
      :Nnnnn
    \cs_end:
  }
\cs_new:Npn \__fp_decimate_:Nnnnn #1 #2#3#4#5
  { #1 0 {#2#3} {#4#5} ; }
\cs_new:Npn \__fp_decimate_tiny:Nnnnn #1 #2#3#4#5
  { #1 1 { 0000 0000 } { 0000 0000 } 0 #2#3#4#5 ; }
\cs_new:Npn \__fp_tmp:w #1 #2 #3
  {
    \cs_new:cpn { __fp_decimate_ #1 :Nnnnn } ##1 ##2##3##4##5
      {
        \exp_after:wN ##1
        \int_value:w
          \exp_after:wN \__fp_round_digit:Nw #2 ;
        \__fp_decimate_pack:nnnnnnnnnnw #3 ;
      }
  }
\__fp_tmp:w {i}   {\use_none:nnn      #50}{    0{#2}#3{#4}#5               }
\__fp_tmp:w {ii}  {\use_none:nn       #5 }{    00{#2}#3{#4}#5              }
\__fp_tmp:w {iii} {\use_none:n        #5 }{    000{#2}#3{#4}#5             }
\__fp_tmp:w {iv}  {                   #5 }{   {0000}#2{#3}#4 #5            }
\__fp_tmp:w {v}   {\use_none:nnn    #4#5 }{   0{0000}#2{#3}#4 #5           }
\__fp_tmp:w {vi}  {\use_none:nn     #4#5 }{   00{0000}#2{#3}#4 #5          }
\__fp_tmp:w {vii} {\use_none:n      #4#5 }{   000{0000}#2{#3}#4 #5         }
\__fp_tmp:w {viii}{                 #4#5 }{  {0000}0000{#2}#3 #4 #5        }
\__fp_tmp:w {ix}  {\use_none:nnn  #3#4+#5}{  0{0000}0000{#2}#3 #4 #5       }
\__fp_tmp:w {x}   {\use_none:nn   #3#4+#5}{  00{0000}0000{#2}#3 #4 #5      }
\__fp_tmp:w {xi}  {\use_none:n    #3#4+#5}{  000{0000}0000{#2}#3 #4 #5     }
\__fp_tmp:w {xii} {               #3#4+#5}{ {0000}0000{0000}#2 #3 #4 #5    }
\__fp_tmp:w {xiii}{\use_none:nnn#2#3+#4#5}{ 0{0000}0000{0000}#2 #3 #4 #5   }
\__fp_tmp:w {xiv} {\use_none:nn #2#3+#4#5}{ 00{0000}0000{0000}#2 #3 #4 #5  }
\__fp_tmp:w {xv}  {\use_none:n  #2#3+#4#5}{ 000{0000}0000{0000}#2 #3 #4 #5 }
\__fp_tmp:w {xvi} {             #2#3+#4#5}{{0000}0000{0000}0000 #2 #3 #4 #5}
\cs_new:Npn \__fp_decimate_pack:nnnnnnnnnnw #1#2#3#4#5
  { \__fp_decimate_pack:nnnnnnw { #1#2#3#4#5 } }
\cs_new:Npn \__fp_decimate_pack:nnnnnnw #1 #2#3#4#5#6
  { {#1} {#2#3#4#5#6} }
\cs_new:Npn \__fp_case_use:nw #1#2 \fi: #3 \s__fp { \fi: #1 \s__fp }
\cs_new:Npn \__fp_case_return:nw #1#2 \fi: #3 ; { \fi: #1 }
\cs_new:Npn \__fp_case_return_o:Nw #1#2 \fi: #3 \s__fp #4 ;
  { \fi: \exp_after:wN #1 }
\cs_new:Npn \__fp_case_return_same_o:w #1 \fi: #2 \s__fp
  { \fi: \__fp_exp_after_o:w \s__fp }
\cs_new:Npn \__fp_case_return_o:Nww #1#2 \fi: #3 \s__fp #4 ; #5 ;
  { \fi: \exp_after:wN #1 }
\cs_new:Npn \__fp_case_return_i_o:ww #1 \fi: #2 \s__fp #3 ; \s__fp #4 ;
  { \fi: \__fp_exp_after_o:w \s__fp #3 ; }
\cs_new:Npn \__fp_case_return_ii_o:ww #1 \fi: #2 \s__fp #3 ;
  { \fi: \__fp_exp_after_o:w }
\prg_new_conditional:Npnn \__fp_int:w \s__fp \__fp_chk:w #1 #2 #3 #4;
  { TF , T , F , p }
  {
    \if_case:w #1 \exp_stop_f:
           \prg_return_true:
    \or:
      \if_charcode:w 0
        \__fp_decimate:nNnnnn { \c__fp_prec_int - #3 }
          \__fp_use_i_until_s:nw #4
        \prg_return_true:
      \else:
        \prg_return_false:
      \fi:
    \else: \prg_return_false:
    \fi:
  }
\cs_new:Npn \__fp_small_int:wTF \s__fp \__fp_chk:w #1#2
  {
    \if_case:w #1 \exp_stop_f:
           \__fp_case_return:nw { \__fp_small_int_true:wTF 0 ; }
    \or:   \exp_after:wN \__fp_small_int_normal:NnwTF
    \or:
      \__fp_case_return:nw
        {
          \exp_after:wN \__fp_small_int_true:wTF \int_value:w
            \if_meaning:w 2 #2 - \fi: 1 0000 0000 ;
        }
    \else: \__fp_case_return:nw \use_ii:nn
    \fi:
    #2
  }
\cs_new:Npn \__fp_small_int_true:wTF #1; #2#3 { #2 {#1} }
\cs_new:Npn \__fp_small_int_normal:NnwTF #1#2#3;
  {
    \__fp_decimate:nNnnnn { \c__fp_prec_int - #2 }
      \__fp_small_int_test:NnnwNw
      #3 #1
  }
\cs_new:Npn \__fp_small_int_test:NnnwNw #1#2#3#4; #5
  {
    \if_meaning:w 0 #1
      \exp_after:wN \__fp_small_int_true:wTF
      \int_value:w \if_meaning:w 2 #5 - \fi:
        \if_int_compare:w #2 > 0 \exp_stop_f:
          1 0000 0000
        \else:
          #3
        \fi:
      \exp_after:wN ;
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
  }
\cs_new_eq:NN \__fp_str_if_eq:nn \tex_strcmp:D
\cs_new:Npn \__fp_func_to_name:N #1
  {
    \exp_last_unbraced:Nf
      \__fp_func_to_name_aux:w { \cs_to_str:N #1 } X
  }
\cs_set_protected:Npn \__fp_tmp:w #1 #2
  { \cs_new:Npn \__fp_func_to_name_aux:w ##1 #1 ##2 #2 ##3 X {##2} }
\exp_args:Nff \__fp_tmp:w { \tl_to_str:n { __fp_ } }
  { \tl_to_str:n { _o: } }
\__kernel_msg_new:nnnn { kernel } { misused-fp }
  { A~floating~point~with~value~'#1'~was~misused. }
  {
    To~obtain~the~value~of~a~floating~point~variable,~use~
    '\token_to_str:N \fp_to_decimal:N',~
    '\token_to_str:N \fp_to_tl:N',~or~other~
    conversion~functions.
  }
%% File: l3fp-traps.dtx
\flag_new:n { fp_invalid_operation }
\flag_new:n { fp_division_by_zero }
\flag_new:n { fp_overflow }
\flag_new:n { fp_underflow }
\cs_new_protected:Npn \fp_trap:nn #1#2
  {
    \cs_if_exist_use:cF { __fp_trap_#1_set_#2: }
      {
        \clist_if_in:nnTF
          { invalid_operation , division_by_zero , overflow , underflow }
          {#1}
          {
            \__kernel_msg_error:nnxx { kernel }
              { unknown-fpu-trap-type } {#1} {#2}
          }
          {
            \__kernel_msg_error:nnx
              { kernel } { unknown-fpu-exception } {#1}
          }
      }
  }
\cs_new_protected:Npn \__fp_trap_invalid_operation_set_error:
  { \__fp_trap_invalid_operation_set:N \prg_do_nothing: }
\cs_new_protected:Npn \__fp_trap_invalid_operation_set_flag:
  { \__fp_trap_invalid_operation_set:N \use_none:nnnnn }
\cs_new_protected:Npn \__fp_trap_invalid_operation_set_none:
  { \__fp_trap_invalid_operation_set:N \use_none:nnnnnnn }
\cs_new_protected:Npn \__fp_trap_invalid_operation_set:N #1
  {
    \exp_args:Nno \use:n
      { \cs_set:Npn \__fp_invalid_operation:nnw ##1##2##3; }
      {
        #1
        \__fp_error:nnfn { fp-invalid } {##2} { \fp_to_tl:n { ##3; } } { }
        \flag_raise_if_clear:n { fp_invalid_operation }
        ##1
      }
    \exp_args:Nno \use:n
      { \cs_set:Npn \__fp_invalid_operation_o:Nww ##1##2; ##3; }
      {
        #1
        \__fp_error:nffn { fp-invalid-ii }
          { \fp_to_tl:n { ##2; } } { \fp_to_tl:n { ##3; } } {##1}
        \flag_raise_if_clear:n { fp_invalid_operation }
        \exp_after:wN \c_nan_fp
      }
    \exp_args:Nno \use:n
      { \cs_set:Npn \__fp_invalid_operation_tl_o:ff ##1##2 }
      {
        #1
        \__fp_error:nffn { fp-invalid } {##1} {##2} { }
        \flag_raise_if_clear:n { fp_invalid_operation }
        \exp_after:wN \c_nan_fp
      }
  }
\cs_new_protected:Npn \__fp_trap_division_by_zero_set_error:
  { \__fp_trap_division_by_zero_set:N \prg_do_nothing: }
\cs_new_protected:Npn \__fp_trap_division_by_zero_set_flag:
  { \__fp_trap_division_by_zero_set:N \use_none:nnnnn }
\cs_new_protected:Npn \__fp_trap_division_by_zero_set_none:
  { \__fp_trap_division_by_zero_set:N \use_none:nnnnnnn }
\cs_new_protected:Npn \__fp_trap_division_by_zero_set:N #1
  {
    \exp_args:Nno \use:n
      { \cs_set:Npn \__fp_division_by_zero_o:Nnw ##1##2##3; }
      {
        #1
        \__fp_error:nnfn { fp-zero-div } {##2} { \fp_to_tl:n { ##3; } } { }
        \flag_raise_if_clear:n { fp_division_by_zero }
        \exp_after:wN ##1
      }
    \exp_args:Nno \use:n
      { \cs_set:Npn \__fp_division_by_zero_o:NNww ##1##2##3; ##4; }
      {
        #1
        \__fp_error:nffn { fp-zero-div-ii }
          { \fp_to_tl:n { ##3; } } { \fp_to_tl:n { ##4; } } {##2}
        \flag_raise_if_clear:n { fp_division_by_zero }
        \exp_after:wN ##1
      }
  }
\cs_new_protected:Npn \__fp_trap_overflow_set_error:
  { \__fp_trap_overflow_set:N \prg_do_nothing: }
\cs_new_protected:Npn \__fp_trap_overflow_set_flag:
  { \__fp_trap_overflow_set:N \use_none:nnnnn }
\cs_new_protected:Npn \__fp_trap_overflow_set_none:
  { \__fp_trap_overflow_set:N \use_none:nnnnnnn }
\cs_new_protected:Npn \__fp_trap_overflow_set:N #1
  { \__fp_trap_overflow_set:NnNn #1 { overflow } \__fp_inf_fp:N { inf } }
\cs_new_protected:Npn \__fp_trap_underflow_set_error:
  { \__fp_trap_underflow_set:N \prg_do_nothing: }
\cs_new_protected:Npn \__fp_trap_underflow_set_flag:
  { \__fp_trap_underflow_set:N \use_none:nnnnn }
\cs_new_protected:Npn \__fp_trap_underflow_set_none:
  { \__fp_trap_underflow_set:N \use_none:nnnnnnn }
\cs_new_protected:Npn \__fp_trap_underflow_set:N #1
  { \__fp_trap_overflow_set:NnNn #1 { underflow } \__fp_zero_fp:N { 0 } }
\cs_new_protected:Npn \__fp_trap_overflow_set:NnNn #1#2#3#4
  {
    \exp_args:Nno \use:n
      { \cs_set:cpn { __fp_ #2 :w } \s__fp \__fp_chk:w ##1##2##3; }
      {
        #1
        \__fp_error:nffn
          { fp-flow \if_meaning:w 1 ##1 -to \fi: }
          { \fp_to_tl:n { \s__fp \__fp_chk:w ##1##2##3; } }
          { \token_if_eq_meaning:NNF 0 ##2 { - } #4 }
          {#2}
        \flag_raise_if_clear:n { fp_#2 }
        #3 ##2
      }
  }
\cs_new:Npn \__fp_invalid_operation:nnw #1#2#3; { }
\cs_new:Npn \__fp_invalid_operation_o:Nww #1#2; #3; { }
\cs_new:Npn \__fp_invalid_operation_tl_o:ff #1 #2 { }
\cs_new:Npn \__fp_division_by_zero_o:Nnw #1#2#3; { }
\cs_new:Npn \__fp_division_by_zero_o:NNww #1#2#3; #4; { }
\cs_new:Npn \__fp_overflow:w { }
\cs_new:Npn \__fp_underflow:w { }
\fp_trap:nn { invalid_operation } { error }
\fp_trap:nn { division_by_zero } { flag }
\fp_trap:nn { overflow } { flag }
\fp_trap:nn { underflow } { flag }
\cs_new:Npn \__fp_invalid_operation_o:nw
  { \__fp_invalid_operation:nnw { \exp_after:wN \c_nan_fp } }
\cs_generate_variant:Nn \__fp_invalid_operation_o:nw { f }
\cs_new:Npn \__fp_error:nnnn
  { \__kernel_msg_expandable_error:nnnnn { kernel } }
\cs_generate_variant:Nn \__fp_error:nnnn { nnf, nff , nfff }
\__kernel_msg_new:nnnn { kernel } { unknown-fpu-exception }
  {
    The~FPU~exception~'#1'~is~not~known:~
    that~trap~will~never~be~triggered.
  }
  {
    The~only~exceptions~to~which~traps~can~be~attached~are \\
    \iow_indent:n
      {
        * ~ invalid_operation \\
        * ~ division_by_zero \\
        * ~ overflow \\
        * ~ underflow
      }
  }
\__kernel_msg_new:nnnn { kernel } { unknown-fpu-trap-type }
  { The~FPU~trap~type~'#2'~is~not~known. }
  {
    The~trap~type~must~be~one~of \\
    \iow_indent:n
      {
        * ~ error \\
        * ~ flag \\
        * ~ none
      }
  }
\__kernel_msg_new:nnn { kernel } { fp-flow }
  { An ~ #3 ~ occurred. }
\__kernel_msg_new:nnn { kernel } { fp-flow-to }
  { #1 ~ #3 ed ~ to ~ #2 . }
\__kernel_msg_new:nnn { kernel } { fp-zero-div }
  { Division~by~zero~in~ #1 (#2) }
\__kernel_msg_new:nnn { kernel } { fp-zero-div-ii }
  { Division~by~zero~in~ (#1) #3 (#2) }
\__kernel_msg_new:nnn { kernel } { fp-invalid }
  { Invalid~operation~ #1 (#2) }
\__kernel_msg_new:nnn { kernel } { fp-invalid-ii }
  { Invalid~operation~ (#1) #3 (#2) }
\__kernel_msg_new:nnn { kernel } { fp-unknown-type }
  { Unknown~type~for~'#1' }
%% File: l3fp-round.dtx
\cs_new:Npn \__fp_parse_word_trunc:N
  { \__fp_parse_function:NNN \__fp_round_o:Nw \__fp_round_to_zero:NNN }
\cs_new:Npn \__fp_parse_word_floor:N
  { \__fp_parse_function:NNN \__fp_round_o:Nw \__fp_round_to_ninf:NNN }
\cs_new:Npn \__fp_parse_word_ceil:N
  { \__fp_parse_function:NNN \__fp_round_o:Nw \__fp_round_to_pinf:NNN }
\cs_new:Npn \__fp_parse_word_round:N #1#2
  {
    \__fp_parse_function:NNN
      \__fp_round_o:Nw \__fp_round_to_nearest:NNN #1
    #2
  }
\cs_new:Npn \__fp_parse_round:Nw #1 #2 \__fp_round_to_nearest:NNN #3#4
  { #2 #1 #3 }

\int_const:Nn \c__fp_five_int { 5 }
\cs_new:Npn \__fp_round_return_one:
  { \exp_after:wN 1 \exp_after:wN \exp_stop_f: \exp:w }
\cs_new:Npn \__fp_round_to_ninf:NNN #1 #2 #3
  {
    \if_meaning:w 2 #1
      \if_int_compare:w #3 > 0 \exp_stop_f:
        \__fp_round_return_one:
      \fi:
    \fi:
    0 \exp_stop_f:
  }
\cs_new:Npn \__fp_round_to_zero:NNN #1 #2 #3 { 0 \exp_stop_f: }
\cs_new:Npn \__fp_round_to_pinf:NNN #1 #2 #3
  {
    \if_meaning:w 0 #1
      \if_int_compare:w #3 > 0 \exp_stop_f:
        \__fp_round_return_one:
      \fi:
    \fi:
    0 \exp_stop_f:
  }
\cs_new:Npn \__fp_round_to_nearest:NNN #1 #2 #3
  {
    \if_int_compare:w #3 > \c__fp_five_int
      \__fp_round_return_one:
    \else:
      \if_meaning:w 5 #3
        \if_int_odd:w #2 \exp_stop_f:
          \__fp_round_return_one:
        \fi:
      \fi:
    \fi:
    0 \exp_stop_f:
  }
\cs_new:Npn \__fp_round_to_nearest_ninf:NNN #1 #2 #3
  {
    \if_int_compare:w #3 > \c__fp_five_int
      \__fp_round_return_one:
    \else:
      \if_meaning:w 5 #3
        \if_meaning:w 2 #1
            \__fp_round_return_one:
        \fi:
      \fi:
    \fi:
    0 \exp_stop_f:
  }
\cs_new:Npn \__fp_round_to_nearest_zero:NNN #1 #2 #3
  {
    \if_int_compare:w #3 > \c__fp_five_int
      \__fp_round_return_one:
    \fi:
    0 \exp_stop_f:
  }
\cs_new:Npn \__fp_round_to_nearest_pinf:NNN #1 #2 #3
  {
    \if_int_compare:w #3 > \c__fp_five_int
      \__fp_round_return_one:
    \else:
      \if_meaning:w 5 #3
        \if_meaning:w 0 #1
            \__fp_round_return_one:
        \fi:
      \fi:
    \fi:
    0 \exp_stop_f:
  }
\cs_new_eq:NN \__fp_round:NNN \__fp_round_to_nearest:NNN
\cs_new:Npn \__fp_round_s:NNNw #1 #2 #3 #4;
  {
    \exp_after:wN \__fp_round:NNN
    \exp_after:wN #1
    \exp_after:wN #2
    \int_value:w \__fp_int_eval:w
      \if_int_odd:w 0 \if_meaning:w 0 #3 1 \fi:
                      \if_meaning:w 5 #3 1 \fi:
                \exp_stop_f:
        \if_int_compare:w \__fp_int_eval:w #4 > 0 \exp_stop_f:
          1 +
        \fi:
      \fi:
      #3
    ;
  }
\cs_new:Npn \__fp_round_digit:Nw #1 #2;
  {
    \if_int_odd:w \if_meaning:w 0 #1 1 \else:
                  \if_meaning:w 5 #1 1 \else:
                  0 \fi: \fi: \exp_stop_f:
      \if_int_compare:w \__fp_int_eval:w #2 > 0 \exp_stop_f:
        \__fp_int_eval:w 1 +
      \fi:
    \fi:
    #1
  }
\cs_new_eq:NN \__fp_round_to_ninf_neg:NNN \__fp_round_to_pinf:NNN
\cs_new:Npn \__fp_round_to_zero_neg:NNN #1 #2 #3
  {
    \if_int_compare:w #3 > 0 \exp_stop_f:
      \__fp_round_return_one:
    \fi:
    0 \exp_stop_f:
  }
\cs_new_eq:NN \__fp_round_to_pinf_neg:NNN \__fp_round_to_ninf:NNN
\cs_new_eq:NN \__fp_round_to_nearest_neg:NNN \__fp_round_to_nearest:NNN
\cs_new_eq:NN \__fp_round_to_nearest_ninf_neg:NNN
  \__fp_round_to_nearest_pinf:NNN
\cs_new:Npn \__fp_round_to_nearest_zero_neg:NNN #1 #2 #3
  {
    \if_int_compare:w #3 < \c__fp_five_int \else:
      \__fp_round_return_one:
    \fi:
    0 \exp_stop_f:
  }
\cs_new_eq:NN \__fp_round_to_nearest_pinf_neg:NNN
  \__fp_round_to_nearest_ninf:NNN
\cs_new_eq:NN \__fp_round_neg:NNN \__fp_round_to_nearest_neg:NNN
\cs_new:Npn \__fp_round_o:Nw #1
  {
    \__fp_parse_function_all_fp_o:fnw
      { \__fp_round_name_from_cs:N #1 }
      { \__fp_round_aux_o:Nw #1 }
  }
\cs_new:Npn \__fp_round_aux_o:Nw #1#2 @
  {
    \if_case:w
      \__fp_int_eval:w \__fp_array_count:n {#2} \__fp_int_eval_end:
         \__fp_round_no_arg_o:Nw #1 \exp:w
    \or: \__fp_round:Nwn #1 #2 {0} \exp:w
    \or: \__fp_round:Nww #1 #2 \exp:w
    \else: \__fp_round:Nwww #1 #2 @ \exp:w
    \fi:
    \exp_after:wN \exp_end:
  }
\cs_new:Npn \__fp_round_no_arg_o:Nw #1
  {
    \cs_if_eq:NNTF #1 \__fp_round_to_nearest:NNN
      { \__fp_error:nnnn { fp-num-args } { round () } { 1 } { 3 } }
      {
        \__fp_error:nffn { fp-num-args }
          { \__fp_round_name_from_cs:N #1 () } { 1 } { 2 }
      }
    \exp_after:wN \c_nan_fp
  }
\cs_new:Npn \__fp_round:Nwww #1#2 ; #3 ; \s__fp \__fp_chk:w #4#5#6 ; #7 @
  {
    \cs_if_eq:NNTF #1 \__fp_round_to_nearest:NNN
      {
        \tl_if_empty:nTF {#7}
          {
            \exp_args:Nc \__fp_round:Nww
              {
                __fp_round_to_nearest
                \if_meaning:w 0 #4 _zero \else:
                \if_case:w #5 \exp_stop_f: _pinf \or: \else: _ninf \fi: \fi:
                :NNN
              }
            #2 ; #3 ;
          }
          {
            \__fp_error:nnnn { fp-num-args } { round () } { 1 } { 3 }
            \exp_after:wN \c_nan_fp
          }
      }
      {
        \__fp_error:nffn { fp-num-args }
          { \__fp_round_name_from_cs:N #1 () } { 1 } { 2 }
        \exp_after:wN \c_nan_fp
      }
  }
\cs_new:Npn \__fp_round_name_from_cs:N #1
  {
    \cs_if_eq:NNTF #1 \__fp_round_to_zero:NNN { trunc }
      {
        \cs_if_eq:NNTF #1 \__fp_round_to_ninf:NNN { floor }
          {
            \cs_if_eq:NNTF #1 \__fp_round_to_pinf:NNN { ceil }
              { round }
          }
      }
  }
\cs_new:Npn \__fp_round:Nww #1#2 ; #3 ;
  {
    \__fp_small_int:wTF #3; { \__fp_round:Nwn #1#2; }
      {
        \if:w 3 \__fp_kind:w #3 ;
          \exp_after:wN \use_i:nn
        \else:
          \exp_after:wN \use_ii:nn
        \fi:
        { \exp_after:wN \c_nan_fp }
        {
          \__fp_invalid_operation_tl_o:ff
            { \__fp_round_name_from_cs:N #1 }
            { \__fp_array_to_clist:n { #2; #3; } }
        }
      }
  }
\cs_new:Npn \__fp_round:Nwn #1 \s__fp \__fp_chk:w #2#3#4; #5
  {
    \if_meaning:w 1 #2
      \exp_after:wN \__fp_round_normal:NwNNnw
      \exp_after:wN #1
      \int_value:w #5
    \else:
      \exp_after:wN \__fp_exp_after_o:w
    \fi:
    \s__fp \__fp_chk:w #2#3#4;
  }
\cs_new:Npn \__fp_round_normal:NwNNnw #1#2 \s__fp \__fp_chk:w 1#3#4#5;
  {
    \__fp_decimate:nNnnnn { \c__fp_prec_int - #4 - #2 }
      \__fp_round_normal:NnnwNNnn #5 #1 #3 {#4} {#2}
  }
\cs_new:Npn \__fp_round_normal:NnnwNNnn #1#2#3#4; #5#6
  {
    \exp_after:wN \__fp_round_normal:NNwNnn
    \int_value:w \__fp_int_eval:w
      \if_int_compare:w #2 > 0 \exp_stop_f:
        1 \int_value:w #2
        \exp_after:wN \__fp_round_pack:Nw
        \int_value:w \__fp_int_eval:w 1#3 +
      \else:
        \if_int_compare:w #3 > 0 \exp_stop_f:
          1 \int_value:w #3 +
        \fi:
      \fi:
      \exp_after:wN #5
      \exp_after:wN #6
      \use_none:nnnnnnn #3
      #1
      \__fp_int_eval_end:
      0000 0000 0000 0000 ; #6
  }
\cs_new:Npn \__fp_round_pack:Nw #1
  { \if_meaning:w 2 #1 + 1 \fi: \__fp_int_eval_end: }
\cs_new:Npn \__fp_round_normal:NNwNnn #1 #2
  {
    \if_meaning:w 0 #2
      \exp_after:wN \__fp_round_special:NwwNnn
      \exp_after:wN #1
    \fi:
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_round_normal_end:wwNnn
    ; #2
  }
\cs_new:Npn \__fp_round_normal_end:wwNnn #1;#2;#3#4#5
  {
    \exp_after:wN \__fp_exp_after_o:w \exp:w \exp_end_continue_f:w
    \__fp_sanitize:Nw #3 #4 ; #1 ;
  }
\cs_new:Npn \__fp_round_special:NwwNnn #1#2;#3;#4#5#6
  {
    \if_meaning:w 0 #1
      \__fp_case_return:nw
        { \exp_after:wN \__fp_zero_fp:N \exp_after:wN #4 }
    \else:
      \exp_after:wN \__fp_round_special_aux:Nw
      \exp_after:wN #4
      \int_value:w \__fp_int_eval:w 1
        \if_meaning:w 1 #1 -#6 \else: +#5 \fi:
    \fi:
    ;
  }
\cs_new:Npn \__fp_round_special_aux:Nw #1#2;
  {
    \exp_after:wN \__fp_exp_after_o:w \exp:w \exp_end_continue_f:w
    \__fp_sanitize:Nw #1#2; {1000}{0000}{0000}{0000};
  }
%% File: l3fp-parse.dtx
\int_const:Nn \c__fp_prec_func_int   { 16 }
\int_const:Nn \c__fp_prec_hatii_int  { 14 }
\int_const:Nn \c__fp_prec_hat_int    { 13 }
\int_const:Nn \c__fp_prec_not_int    { 12 }
\int_const:Nn \c__fp_prec_juxt_int   { 11 }
\int_const:Nn \c__fp_prec_times_int  { 10 }
\int_const:Nn \c__fp_prec_plus_int   { 9 }
\int_const:Nn \c__fp_prec_comp_int   { 7 }
\int_const:Nn \c__fp_prec_and_int    { 6 }
\int_const:Nn \c__fp_prec_or_int     { 5 }
\int_const:Nn \c__fp_prec_quest_int  { 4 }
\int_const:Nn \c__fp_prec_colon_int  { 3 }
\int_const:Nn \c__fp_prec_comma_int  { 2 }
\int_const:Nn \c__fp_prec_tuple_int  { 1 }
\int_const:Nn \c__fp_prec_end_int    { 0 }
\cs_new:Npn \__fp_parse_expand:w #1 { \exp_end_continue_f:w #1 }
\cs_new:Npn \__fp_parse_return_semicolon:w
    #1 \fi: \__fp_parse_expand:w { \fi: ; #1 }
\cs_set_protected:Npn \__fp_tmp:w #1 #2 #3
  {
    \cs_new:cpn { __fp_parse_digits_ #1 :N } ##1
      {
        \if_int_compare:w 9 < 1 \token_to_str:N ##1 \exp_stop_f:
          \token_to_str:N ##1 \exp_after:wN #2 \exp:w
        \else:
          \__fp_parse_return_semicolon:w #3 ##1
        \fi:
        \__fp_parse_expand:w
      }
  }
\__fp_tmp:w {vii}  \__fp_parse_digits_vi:N   { 0000000 ; 7 }
\__fp_tmp:w {vi}   \__fp_parse_digits_v:N    { 000000 ; 6 }
\__fp_tmp:w {v}    \__fp_parse_digits_iv:N   { 00000 ; 5 }
\__fp_tmp:w {iv}   \__fp_parse_digits_iii:N  { 0000 ; 4 }
\__fp_tmp:w {iii}  \__fp_parse_digits_ii:N   { 000 ; 3 }
\__fp_tmp:w {ii}   \__fp_parse_digits_i:N    { 00 ; 2 }
\__fp_tmp:w {i}    \__fp_parse_digits_:N     { 0 ; 1 }
\cs_new:Npn \__fp_parse_digits_:N { ; ; 0 }
\cs_new:Npn \__fp_parse_one:Nw #1 #2
  {
    \if_catcode:w \scan_stop: \exp_not:N #2
      \exp_after:wN \if_meaning:w \exp_not:N #2 #2 \else:
        \exp_after:wN \reverse_if:N
      \fi:
      \if_meaning:w \scan_stop: #2
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_one_fp:NN
      \else:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_one_register:NN
      \fi:
    \else:
      \if_int_compare:w 9 < 1 \token_to_str:N #2 \exp_stop_f:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_one_digit:NN
      \else:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_one_other:NN
      \fi:
    \fi:
    #1 #2
  }
\cs_new:Npn \__fp_parse_one_fp:NN #1
  {
    \__fp_exp_after_any_f:nw
      {
        \exp_after:wN \__fp_parse_infix:NN
        \exp_after:wN #1 \exp:w \__fp_parse_expand:w
      }
  }
\cs_new:Npn \__fp_exp_after_expr_mark_f:nw #1
  {
    \int_case:nnF { \exp_after:wN \use_i:nnn \use_none:nnn #1 }
      {
        \c__fp_prec_comma_int { }
        \c__fp_prec_tuple_int { }
        \c__fp_prec_end_int
          {
            \exp_after:wN \c__fp_empty_tuple_fp
            \exp:w \exp_end_continue_f:w
          }
      }
      {
        \__kernel_msg_expandable_error:nn { kernel } { fp-early-end }
        \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w
      }
    #1
  }
\cs_new:cpn { __fp_exp_after_?_f:nw } #1#2
  {
    \__kernel_msg_expandable_error:nnn { kernel } { bad-variable }
      {#2}
    \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w #1
  }
\cs_set_protected:Npn \__fp_tmp:w #1
  {
    \cs_if_exist:NT #1
      {
        \cs_gset:cpn { __fp_exp_after_?_f:nw } ##1##2
          {
            \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w ##1
            \str_if_eq:nnTF {##2} { \protect }
              {
                \cs_if_eq:NNTF ##2 #1 { \use_i:nn } { \use:n }
                {
                  \__kernel_msg_expandable_error:nnn { kernel }
                    { fp-robust-cmd }
                }
              }
              {
                \__kernel_msg_expandable_error:nnn { kernel }
                  { bad-variable } {##2}
              }
          }
      }
  }
\exp_args:Nc \__fp_tmp:w { @unexpandable@protect }
\cs_new:Npn \__fp_parse_one_register:NN #1#2
  {
    \exp_after:wN \__fp_parse_infix_after_operand:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
      \__fp_parse_one_register_special:N #2
      \exp_after:wN \__fp_parse_one_register_aux:Nw
      \exp_after:wN #2
      \int_value:w
        \exp_after:wN \__fp_parse_exponent:N
        \exp:w \__fp_parse_expand:w
  }
\cs_new:Npx \__fp_parse_one_register_aux:Nw #1
  {
    \exp_not:n
      {
        \exp_after:wN \use:nn
        \exp_after:wN \__fp_parse_one_register_auxii:wwwNw
      }
    \exp_not:N \exp_after:wN { \exp_not:N \tex_the:D #1 }
      ; \exp_not:N \__fp_parse_one_register_dim:ww
      \tl_to_str:n { pt } ; \exp_not:N \__fp_parse_one_register_mu:www
      . \tl_to_str:n { pt } ; \exp_not:N \__fp_parse_one_register_int:www
      \s__fp_stop
  }
\exp_args:Nno \use:nn
  { \cs_new:Npn \__fp_parse_one_register_auxii:wwwNw #1 . #2 }
    { \tl_to_str:n { pt } #3 ; #4#5 \s__fp_stop }
    { #4 #1.#2; }
\exp_args:Nno \use:nn
  { \cs_new:Npn \__fp_parse_one_register_mu:www #1 }
    { \tl_to_str:n { mu } ; #2 ; }
    { \__fp_parse_one_register_dim:ww #1 ; }
\cs_new:Npn \__fp_parse_one_register_int:www #1; #2.; #3;
  { \__fp_parse:n { #1 e #3 } }
\cs_new:Npn \__fp_parse_one_register_dim:ww #1; #2;
  {
    \exp_after:wN \__fp_from_dim_test:ww
    \int_value:w #2 \exp_after:wN ,
    \int_value:w \dim_to_decimal_in_sp:n { #1 pt } ;
  }
\cs_new:Npn \__fp_parse_one_register_special:N #1
  {
    \if_meaning:w \box_wd:N #1 \__fp_parse_one_register_wd:w \fi:
    \if_meaning:w \box_ht:N #1 \__fp_parse_one_register_wd:w \fi:
    \if_meaning:w \box_dp:N #1 \__fp_parse_one_register_wd:w \fi:
    \if_meaning:w \infty #1
      \__fp_parse_one_register_math:NNw \infty #1
    \fi:
    \if_meaning:w \pi #1
      \__fp_parse_one_register_math:NNw \pi #1
    \fi:
  }
\cs_new:Npn \__fp_parse_one_register_math:NNw
    #1#2#3#4 \__fp_parse_expand:w
  {
    #3
    \str_if_eq:nnTF {#1} {#2}
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { fp-infty-pi } {#1}
        \c_nan_fp
      }
      { #4 \__fp_parse_expand:w }
  }
\cs_new:Npn \__fp_parse_one_register_wd:w
    #1#2 \exp_after:wN #3#4 \__fp_parse_expand:w
  {
    #1
    \exp_after:wN \__fp_parse_one_register_wd:Nw
    #4 \__fp_parse_expand:w e
  }
\cs_new:Npn \__fp_parse_one_register_wd:Nw #1#2 ;
  {
    \exp_after:wN \__fp_from_dim_test:ww
    \exp_after:wN 0 \exp_after:wN ,
    \int_value:w \dim_to_decimal_in_sp:n { #1 #2 } ;
  }
\cs_new:Npn \__fp_parse_one_digit:NN #1
  {
    \exp_after:wN \__fp_parse_infix_after_operand:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
      \exp_after:wN \__fp_sanitize:wN
      \int_value:w \__fp_int_eval:w 0 \__fp_parse_trim_zeros:N
  }
\cs_new:Npn \__fp_parse_one_other:NN #1 #2
  {
    \if_int_compare:w
        \__fp_int_eval:w
          ( `#2 \if_int_compare:w `#2 > `Z - 32 \fi: ) / 26
        = 3 \exp_stop_f:
      \exp_after:wN \__fp_parse_word:Nw
      \exp_after:wN #1
      \exp_after:wN #2
      \exp:w \exp_after:wN \__fp_parse_letters:N
      \exp:w
    \else:
      \exp_after:wN \__fp_parse_prefix:NNN
      \exp_after:wN #1
      \exp_after:wN #2
      \cs:w
        __fp_parse_prefix_ \token_to_str:N #2 :Nw
        \exp_after:wN
      \cs_end:
      \exp:w
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_word:Nw #1#2;
  {
    \cs_if_exist_use:cF { __fp_parse_word_#2:N }
      {
        \cs_if_exist_use:cF
          { __fp_parse_caseless_ \str_foldcase:n {#2} :N }
          {
            \__kernel_msg_expandable_error:nnn
              { kernel } { unknown-fp-word } {#2}
            \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w
            \__fp_parse_infix:NN
          }
      }
      #1
  }
\cs_new:Npn \__fp_parse_letters:N #1
  {
    \exp_end_continue_f:w
    \if_int_compare:w
        \if_catcode:w \scan_stop: \exp_not:N #1
          0
        \else:
          \__fp_int_eval:w
            ( `#1 \if_int_compare:w `#1 > `Z - 32 \fi: ) / 26
        \fi:
        = 3 \exp_stop_f:
      \exp_after:wN #1
      \exp:w \exp_after:wN \__fp_parse_letters:N
      \exp:w
    \else:
      \__fp_parse_return_semicolon:w #1
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_prefix:NNN #1#2#3
  {
    \if_meaning:w \scan_stop: #3
      \exp_after:wN \__fp_parse_prefix_unknown:NNN
      \exp_after:wN #2
    \fi:
    #3 #1
  }
\cs_new:Npn \__fp_parse_prefix_unknown:NNN #1#2#3
  {
    \cs_if_exist:cTF { __fp_parse_infix_ \token_to_str:N #1 :N }
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { fp-missing-number } {#1}
        \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w
        \__fp_parse_infix:NN #3 #1
      }
      {
        \__kernel_msg_expandable_error:nnn
          { kernel } { fp-unknown-symbol } {#1}
        \__fp_parse_one:Nw #3
      }
  }
\cs_new:Npn \__fp_parse_trim_zeros:N #1
  {
    \if:w 0 \exp_not:N #1
      \exp_after:wN \__fp_parse_trim_zeros:N
      \exp:w
    \else:
      \if:w . \exp_not:N #1
        \exp_after:wN \__fp_parse_strim_zeros:N
        \exp:w
      \else:
        \__fp_parse_trim_end:w #1
      \fi:
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_trim_end:w #1 \fi: \fi: \__fp_parse_expand:w
  {
      \fi:
    \fi:
    \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f:
      \exp_after:wN \__fp_parse_large:N
    \else:
      \exp_after:wN \__fp_parse_zero:
    \fi:
    #1
  }
\cs_new:Npn \__fp_parse_strim_zeros:N #1
  {
    \if:w 0 \exp_not:N #1
      - 1
      \exp_after:wN \__fp_parse_strim_zeros:N \exp:w
    \else:
      \__fp_parse_strim_end:w #1
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_strim_end:w #1 \fi: \__fp_parse_expand:w
  {
    \fi:
    \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f:
      \exp_after:wN \__fp_parse_small:N
    \else:
      \exp_after:wN \__fp_parse_zero:
    \fi:
    #1
  }
\cs_new:Npn \__fp_parse_zero:
  {
    \exp_after:wN ; \exp_after:wN 1
    \int_value:w \__fp_parse_exponent:N
  }
\cs_new:Npn \__fp_parse_small:N #1
  {
    \exp_after:wN \__fp_parse_pack_leading:NNNNNww
    \int_value:w \__fp_int_eval:w 1 \token_to_str:N #1
      \exp_after:wN \__fp_parse_small_leading:wwNN
      \int_value:w 1
        \exp_after:wN \__fp_parse_digits_vii:N
        \exp:w \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_small_leading:wwNN 1 #1 ; #2; #3 #4
  {
    #1 #2
    \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww
    \exp_after:wN 0
    \int_value:w \__fp_int_eval:w 1
      \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f:
        \token_to_str:N #4
        \exp_after:wN \__fp_parse_small_trailing:wwNN
        \int_value:w 1
          \exp_after:wN \__fp_parse_digits_vi:N
          \exp:w
      \else:
        0000 0000 \__fp_parse_exponent:Nw #4
      \fi:
      \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_small_trailing:wwNN 1 #1 ; #2; #3 #4
  {
    #1 #2
    \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f:
      \token_to_str:N #4
      \exp_after:wN \__fp_parse_small_round:NN
      \exp_after:wN #4
      \exp:w
    \else:
      0 \__fp_parse_exponent:Nw #4
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_pack_trailing:NNNNNNww #1 #2 #3#4#5#6 #7; #8 ;
  {
    \if_meaning:w 2 #2 + 1 \fi:
    ; #8 + #1 ; {#3#4#5#6} {#7};
  }
\cs_new:Npn \__fp_parse_pack_leading:NNNNNww #1 #2#3#4#5 #6; #7;
  {
    + #7
    \if_meaning:w 2 #1 \__fp_parse_pack_carry:w \fi:
    ; 0 {#2#3#4#5} {#6}
  }
\cs_new:Npn \__fp_parse_pack_carry:w \fi: ; 0 #1
  { \fi: + 1 ; 0 {1000} }
\cs_new:Npn \__fp_parse_large:N #1
  {
    \exp_after:wN \__fp_parse_large_leading:wwNN
    \int_value:w 1 \token_to_str:N #1
      \exp_after:wN \__fp_parse_digits_vii:N
      \exp:w \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_large_leading:wwNN 1 #1 ; #2; #3 #4
  {
    + \c__fp_half_prec_int - #3
    \exp_after:wN \__fp_parse_pack_leading:NNNNNww
    \int_value:w \__fp_int_eval:w 1 #1
      \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f:
        \exp_after:wN \__fp_parse_large_trailing:wwNN
        \int_value:w 1 \token_to_str:N #4
          \exp_after:wN \__fp_parse_digits_vi:N
          \exp:w
      \else:
        \if:w . \exp_not:N #4
          \exp_after:wN \__fp_parse_small_leading:wwNN
          \int_value:w 1
            \cs:w
              __fp_parse_digits_
              \__fp_int_to_roman:w #3
              :N \exp_after:wN
            \cs_end:
            \exp:w
        \else:
          #2
          \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww
          \exp_after:wN 0
          \int_value:w 1 0000 0000
          \__fp_parse_exponent:Nw #4
        \fi:
      \fi:
      \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_large_trailing:wwNN 1 #1 ; #2; #3 #4
  {
    \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f:
      \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww
      \exp_after:wN \c__fp_half_prec_int
      \int_value:w \__fp_int_eval:w 1 #1 \token_to_str:N #4
        \exp_after:wN \__fp_parse_large_round:NN
        \exp_after:wN #4
        \exp:w
    \else:
      \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww
      \int_value:w \__fp_int_eval:w 7 - #3 \exp_stop_f:
      \int_value:w \__fp_int_eval:w 1 #1
        \if:w . \exp_not:N #4
          \exp_after:wN \__fp_parse_small_trailing:wwNN
          \int_value:w 1
            \cs:w
              __fp_parse_digits_
              \__fp_int_to_roman:w #3
              :N \exp_after:wN
            \cs_end:
            \exp:w
        \else:
          #2 0 \__fp_parse_exponent:Nw #4
        \fi:
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_round_loop:N #1
  {
    \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f:
      + 1
      \if:w 0 \token_to_str:N #1
        \exp_after:wN \__fp_parse_round_loop:N
        \exp:w
      \else:
        \exp_after:wN \__fp_parse_round_up:N
        \exp:w
      \fi:
    \else:
      \__fp_parse_return_semicolon:w 0 #1
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_round_up:N #1
  {
    \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f:
      + 1
      \exp_after:wN \__fp_parse_round_up:N
      \exp:w
    \else:
      \__fp_parse_return_semicolon:w 1 #1
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_round_after:wN #1; #2
  {
    + #2 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w #1 + \__fp_parse_exponent:N
  }
\cs_new:Npn \__fp_parse_small_round:NN #1#2
  {
    \if_int_compare:w 9 < 1 \token_to_str:N #2 \exp_stop_f:
      +
      \exp_after:wN \__fp_round_s:NNNw
      \exp_after:wN 0
      \exp_after:wN #1
      \exp_after:wN #2
      \int_value:w \__fp_int_eval:w
        \exp_after:wN \__fp_parse_round_after:wN
        \int_value:w \__fp_int_eval:w 0 * \__fp_int_eval:w 0
          \exp_after:wN \__fp_parse_round_loop:N
          \exp:w
    \else:
      \__fp_parse_exponent:Nw #2
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_large_round:NN #1#2
  {
    \if_int_compare:w 9 < 1 \token_to_str:N #2 \exp_stop_f:
      +
      \exp_after:wN \__fp_round_s:NNNw
      \exp_after:wN 0
      \exp_after:wN #1
      \exp_after:wN #2
      \int_value:w \__fp_int_eval:w
        \exp_after:wN \__fp_parse_large_round_aux:wNN
        \int_value:w \__fp_int_eval:w 1
          \exp_after:wN \__fp_parse_round_loop:N
    \else: %^^A could be dot, or e, or other
      \exp_after:wN \__fp_parse_large_round_test:NN
      \exp_after:wN #1
      \exp_after:wN #2
    \fi:
  }
\cs_new:Npn \__fp_parse_large_round_test:NN #1#2
  {
    \if:w . \exp_not:N #2
      \exp_after:wN \__fp_parse_small_round:NN
      \exp_after:wN #1
      \exp:w
    \else:
      \__fp_parse_exponent:Nw #2
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_large_round_aux:wNN #1 ; #2 #3
  {
    + #2
    \exp_after:wN \__fp_parse_round_after:wN
    \int_value:w \__fp_int_eval:w #1
      \if:w . \exp_not:N #3
        + 0 * \__fp_int_eval:w 0
          \exp_after:wN \__fp_parse_round_loop:N
          \exp:w \exp_after:wN \__fp_parse_expand:w
      \else:
        \exp_after:wN ;
        \exp_after:wN 0
        \exp_after:wN #3
      \fi:
  }
\cs_new:Npn \__fp_parse_exponent:Nw #1 #2 \__fp_parse_expand:w
  {
    \exp_after:wN ;
    \int_value:w #2 \__fp_parse_exponent:N #1
  }
\cs_new:Npn \__fp_parse_exponent:N #1
  {
    \if:w e \if:w E \exp_not:N #1 e \else: \exp_not:N #1 \fi:
      \exp_after:wN \__fp_parse_exponent_aux:NN
      \exp_after:wN #1
      \exp:w
    \else:
      0 \__fp_parse_return_semicolon:w #1
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_exponent_aux:NN #1#2
  {
    \if_int_compare:w \if_catcode:w \scan_stop: \exp_not:N #2
                0 \else: `#2 \fi: > `9 \exp_stop_f:
      0 \exp_after:wN ; \exp_after:wN #1
    \else:
      \exp_after:wN \__fp_parse_exponent_sign:N
    \fi:
    #2
  }
\cs_new:Npn \__fp_parse_exponent_sign:N #1
  {
    \if:w + \if:w - \exp_not:N #1 + \fi: \token_to_str:N #1
      \exp_after:wN \__fp_parse_exponent_sign:N
      \exp:w \exp_after:wN \__fp_parse_expand:w
    \else:
      \exp_after:wN \__fp_parse_exponent_body:N
      \exp_after:wN #1
    \fi:
  }
\cs_new:Npn \__fp_parse_exponent_body:N #1
  {
    \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f:
      \token_to_str:N #1
      \exp_after:wN \__fp_parse_exponent_digits:N
      \exp:w
    \else:
      \__fp_parse_exponent_keep:NTF #1
        { \__fp_parse_return_semicolon:w #1 }
        {
          \exp_after:wN ;
          \exp:w
        }
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_exponent_digits:N #1
  {
    \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f:
      \token_to_str:N #1
      \exp_after:wN \__fp_parse_exponent_digits:N
      \exp:w
    \else:
      \__fp_parse_return_semicolon:w #1
    \fi:
    \__fp_parse_expand:w
  }
\prg_new_conditional:Npnn \__fp_parse_exponent_keep:N #1 { TF }
  {
    \if_catcode:w \scan_stop: \exp_not:N #1
      \if_meaning:w \scan_stop: #1
        \if_int_compare:w
            \__fp_str_if_eq:nn { \s__fp } { \exp_not:N #1 }
            = 0 \exp_stop_f:
          0
          \__kernel_msg_expandable_error:nnn
            { kernel } { fp-after-e } { floating~point~ }
          \prg_return_true:
        \else:
          0
          \__kernel_msg_expandable_error:nnn
            { kernel } { bad-variable } {#1}
          \prg_return_false:
        \fi:
      \else:
        \if_int_compare:w
            \__fp_str_if_eq:nn { \int_value:w #1 } { \tex_the:D #1 }
            = 0 \exp_stop_f:
          \int_value:w #1
        \else:
          0
          \__kernel_msg_expandable_error:nnn
            { kernel } { fp-after-e } { dimension~#1 }
        \fi:
        \prg_return_false:
      \fi:
    \else:
      0
      \__kernel_msg_expandable_error:nnn
        { kernel } { fp-missing } { exponent }
      \prg_return_true:
    \fi:
  }
\cs_new_eq:cN { __fp_parse_prefix_+:Nw } \__fp_parse_one:Nw
\cs_new:Npn \__fp_parse_apply_function:NNNwN #1#2#3#4@#5
  {
    #3 #2 #4 @
    \exp:w \exp_end_continue_f:w #5 #1
  }
\cs_new:Npn \__fp_parse_apply_unary:NNNwN #1#2#3#4@#5
  {
    \__fp_parse_apply_unary_chk:NwNw #4 @ ; . \s__fp_stop
    \__fp_parse_apply_unary_type:NNN
    #3 #2 #4 @
    \exp:w \exp_end_continue_f:w #5 #1
  }
\cs_new:Npn \__fp_parse_apply_unary_chk:NwNw #1#2 ; #3#4 \s__fp_stop
  {
    \if_meaning:w @ #3 \else:
      \token_if_eq_meaning:NNTF . #3
        { \__fp_parse_apply_unary_chk:nNNNNw { no } }
        { \__fp_parse_apply_unary_chk:nNNNNw { multi } }
    \fi:
  }
\cs_new:Npn \__fp_parse_apply_unary_chk:nNNNNw #1#2#3#4#5#6 @
  {
    #2
    \__fp_error:nffn { fp-#1-arg } { \__fp_func_to_name:N #4 } { } { }
    \exp_after:wN #4 \exp_after:wN #5 \c_nan_fp @
  }
\cs_new:Npn \__fp_parse_apply_unary_type:NNN #1#2#3
  {
    \__fp_change_func_type:NNN #3 #1 \__fp_parse_apply_unary_error:NNw
    #2 #3
  }
\cs_new:Npn \__fp_parse_apply_unary_error:NNw #1#2#3 @
  { \__fp_invalid_operation_o:fw { \__fp_func_to_name:N #1 } #3 }
\cs_set_protected:Npn \__fp_tmp:w #1#2#3#4
  {
    \cs_new:cpn { __fp_parse_prefix_ #1 :Nw } ##1
      {
        \exp_after:wN \__fp_parse_apply_unary:NNNwN
        \exp_after:wN ##1
        \exp_after:wN #4
        \exp_after:wN #3
        \exp:w
        \if_int_compare:w #2 < ##1
          \__fp_parse_operand:Nw ##1
        \else:
          \__fp_parse_operand:Nw #2
        \fi:
        \__fp_parse_expand:w
      }
  }
\__fp_tmp:w - \c__fp_prec_not_int \__fp_set_sign_o:w 2
\__fp_tmp:w ! \c__fp_prec_not_int \__fp_not_o:w ?
\cs_new:cpn { __fp_parse_prefix_.:Nw } #1
  {
    \exp_after:wN \__fp_parse_infix_after_operand:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
      \exp_after:wN \__fp_sanitize:wN
      \int_value:w \__fp_int_eval:w 0 \__fp_parse_strim_zeros:N
  }
\cs_new:cpn { __fp_parse_prefix_(:Nw } #1
  {
    \exp_after:wN \__fp_parse_lparen_after:NwN
    \exp_after:wN #1
    \exp:w
    \if_int_compare:w #1 = \c__fp_prec_func_int
      \__fp_parse_operand:Nw \c__fp_prec_comma_int
    \else:
      \__fp_parse_operand:Nw \c__fp_prec_tuple_int
    \fi:
    \__fp_parse_expand:w
  }
\cs_new:Npx \__fp_parse_lparen_after:NwN #1#2 @ #3
  {
    \exp_not:N \token_if_eq_meaning:NNTF #3
      \exp_not:c { __fp_parse_infix_):N }
      {
        \exp_not:N \__fp_exp_after_array_f:w #2 \s__fp_expr_stop
        \exp_not:N \exp_after:wN
        \exp_not:N \__fp_parse_infix_after_paren:NN
        \exp_not:N \exp_after:wN #1
        \exp_not:N \exp:w
        \exp_not:N \__fp_parse_expand:w
      }
      {
        \exp_not:N \__kernel_msg_expandable_error:nnn
          { kernel } { fp-missing } { ) }
        \exp_not:N \tl_if_empty:nT {#2} \exp_not:N \c__fp_empty_tuple_fp
        #2 @
        \exp_not:N \use_none:n #3
      }
  }
\cs_new:cpn { __fp_parse_prefix_):Nw } #1
  {
    \if_int_compare:w #1 = \c__fp_prec_comma_int
    \else:
      \if_int_compare:w #1 = \c__fp_prec_tuple_int
        \exp_after:wN \c__fp_empty_tuple_fp \exp:w
      \else:
        \__kernel_msg_expandable_error:nnn
          { kernel } { fp-missing-number } { ) }
        \exp_after:wN \c_nan_fp \exp:w
      \fi:
      \exp_end_continue_f:w
    \fi:
    \__fp_parse_infix_after_paren:NN #1 )
  }
\cs_set_protected:Npn \__fp_tmp:w #1 #2
  {
    \cs_new:cpn { __fp_parse_word_#1:N }
      { \exp_after:wN #2 \exp:w \exp_end_continue_f:w \__fp_parse_infix:NN }
  }
\__fp_tmp:w { inf } \c_inf_fp
\__fp_tmp:w { nan } \c_nan_fp
\__fp_tmp:w { pi  } \c_pi_fp
\__fp_tmp:w { deg } \c_one_degree_fp
\__fp_tmp:w { true } \c_one_fp
\__fp_tmp:w { false } \c_zero_fp
\cs_new_eq:NN \__fp_parse_caseless_inf:N \__fp_parse_word_inf:N
\cs_new_eq:NN \__fp_parse_caseless_infinity:N \__fp_parse_word_inf:N
\cs_new_eq:NN \__fp_parse_caseless_nan:N \__fp_parse_word_nan:N
\cs_set_protected:Npn \__fp_tmp:w #1 #2
  {
    \cs_new:cpn { __fp_parse_word_#1:N }
      {
        \__fp_exp_after_f:nw { \__fp_parse_infix:NN }
        \s__fp \__fp_chk:w 10 #2 ;
      }
  }
\__fp_tmp:w {pt} { {1} {1000} {0000} {0000} {0000} }
\__fp_tmp:w {in} { {2} {7227} {0000} {0000} {0000} }
\__fp_tmp:w {pc} { {2} {1200} {0000} {0000} {0000} }
\__fp_tmp:w {cm} { {2} {2845} {2755} {9055} {1181} }
\__fp_tmp:w {mm} { {1} {2845} {2755} {9055} {1181} }
\__fp_tmp:w {dd} { {1} {1070} {0085} {6496} {0630} }
\__fp_tmp:w {cc} { {2} {1284} {0102} {7795} {2756} }
\__fp_tmp:w {nd} { {1} {1066} {9783} {4645} {6693} }
\__fp_tmp:w {nc} { {2} {1280} {3740} {1574} {8031} }
\__fp_tmp:w {bp} { {1} {1003} {7500} {0000} {0000} }
\__fp_tmp:w {sp} { {-4} {1525} {8789} {0625} {0000} }
\tl_map_inline:nn { {em} {ex} }
  {
    \cs_new:cpn { __fp_parse_word_#1:N }
      {
        \exp_after:wN \__fp_from_dim_test:ww
        \exp_after:wN 0 \exp_after:wN ,
        \int_value:w \dim_to_decimal_in_sp:n { 1 #1 } \exp_after:wN ;
        \exp:w \exp_end_continue_f:w \__fp_parse_infix:NN
      }
  }
\cs_new:Npn \__fp_parse_unary_function:NNN #1#2#3
  {
    \exp_after:wN \__fp_parse_apply_unary:NNNwN
    \exp_after:wN #3
    \exp_after:wN #2
    \exp_after:wN #1
    \exp:w
    \__fp_parse_operand:Nw \c__fp_prec_func_int \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_function:NNN #1#2#3
  {
    \exp_after:wN \__fp_parse_apply_function:NNNwN
    \exp_after:wN #3
    \exp_after:wN #2
    \exp_after:wN #1
    \exp:w
    \__fp_parse_operand:Nw \c__fp_prec_func_int \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse:n #1
  {
    \exp:w
      \exp_after:wN \__fp_parse_after:ww
      \exp:w
        \__fp_parse_operand:Nw \c__fp_prec_end_int
        \__fp_parse_expand:w #1
        \s__fp_expr_mark \__fp_parse_infix_end:N
      \s__fp_expr_stop
    \exp_end:
  }
\cs_new:Npn \__fp_parse_after:ww
    #1@ \__fp_parse_infix_end:N \s__fp_expr_stop #2 { #2 #1 }
\cs_new:Npn \__fp_parse_o:n #1
  {
    \exp:w
      \exp_after:wN \__fp_parse_after:ww
      \exp:w
        \__fp_parse_operand:Nw \c__fp_prec_end_int
        \__fp_parse_expand:w #1
        \s__fp_expr_mark \__fp_parse_infix_end:N
      \s__fp_expr_stop
    {
      \exp_end_continue_f:w
      \__fp_exp_after_any_f:nw { \exp_after:wN \exp_stop_f: }
    }
  }
\cs_new:Npn \__fp_parse_operand:Nw #1
  {
    \exp_end_continue_f:w
    \exp_after:wN \__fp_parse_continue:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
    \exp_after:wN \__fp_parse_one:Nw
    \exp_after:wN #1
    \exp:w
  }
\cs_new:Npn \__fp_parse_continue:NwN #1 #2 @ #3 { #3 #1 #2 @ }
\cs_new:Npn \__fp_parse_apply_binary:NwNwN #1 #2#3@ #4 #5#6@ #7
  {
    \exp_after:wN \__fp_parse_continue:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
      \exp_after:wN \__fp_parse_apply_binary_chk:NN
        \cs:w
          __fp
          \__fp_type_from_scan:N #2
          _#4
          \__fp_type_from_scan:N #5
          _o:ww
        \cs_end:
        #4
      #2#3 #5#6
    \exp:w \exp_end_continue_f:w #7 #1
  }
\cs_new:Npn \__fp_parse_apply_binary_chk:NN #1#2
  {
    \if_meaning:w \scan_stop: #1
      \__fp_parse_apply_binary_error:NNN #2
    \fi:
    #1
  }
\cs_new:Npn \__fp_parse_apply_binary_error:NNN #1#2#3
  {
    #2
    \__fp_invalid_operation_o:Nww #1
  }
\cs_new:Npn \__fp_binary_type_o:Nww #1 #2#3 ; #4
  {
    \exp_after:wN \__fp_parse_apply_binary_chk:NN
      \cs:w
        __fp
        \__fp_type_from_scan:N #2
        _ #1
        \__fp_type_from_scan:N #4
        _o:ww
      \cs_end:
      #1
    #2 #3 ; #4
  }
\cs_new:Npn \__fp_binary_rev_type_o:Nww #1 #2#3 ; #4#5 ;
  {
    \exp_after:wN \__fp_parse_apply_binary_chk:NN
      \cs:w
        __fp
        \__fp_type_from_scan:N #4
        _ #1
        \__fp_type_from_scan:N #2
        _o:ww
      \cs_end:
      #1
    #4 #5 ; #2 #3 ;
  }
\cs_new:Npn \__fp_parse_infix_after_operand:NwN #1 #2;
  {
    \__fp_exp_after_f:nw { \__fp_parse_infix:NN #1 }
    #2;
  }
\cs_new:Npn \__fp_parse_infix:NN #1 #2
  {
    \if_catcode:w \scan_stop: \exp_not:N #2
      \if_int_compare:w
          \__fp_str_if_eq:nn { \s__fp_expr_mark } { \exp_not:N #2 }
          = 0 \exp_stop_f:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_infix_mark:NNN
      \else:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_infix_juxt:N
      \fi:
    \else:
      \if_int_compare:w
          \__fp_int_eval:w
            ( `#2 \if_int_compare:w `#2 > `Z - 32 \fi: ) / 26
          = 3 \exp_stop_f:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_infix_juxt:N
      \else:
        \exp_after:wN \__fp_parse_infix_check:NNN
        \cs:w
          __fp_parse_infix_ \token_to_str:N #2 :N
          \exp_after:wN \exp_after:wN \exp_after:wN
        \cs_end:
      \fi:
    \fi:
    #1
    #2
  }
\cs_new:Npn \__fp_parse_infix_check:NNN #1#2#3
  {
    \if_meaning:w \scan_stop: #1
      \__kernel_msg_expandable_error:nnn
        { kernel } { fp-missing } { * }
      \exp_after:wN \__fp_parse_infix_mul:N
      \exp_after:wN #2
      \exp_after:wN #3
    \else:
      \exp_after:wN #1
      \exp_after:wN #2
      \exp:w \exp_after:wN \__fp_parse_expand:w
    \fi:
  }
\cs_new:Npn \__fp_parse_infix_after_paren:NN #1 #2
  {
    \if_catcode:w \scan_stop: \exp_not:N #2
      \if_int_compare:w
          \__fp_str_if_eq:nn { \s__fp_expr_mark } { \exp_not:N #2 }
          = 0 \exp_stop_f:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_infix_mark:NNN
      \else:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_infix_mul:N
      \fi:
    \else:
      \if_int_compare:w
          \__fp_int_eval:w
            ( `#2 \if_int_compare:w `#2 > `Z - 32 \fi: ) / 26
          = 3 \exp_stop_f:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_parse_infix_mul:N
      \else:
        \exp_after:wN \__fp_parse_infix_check:NNN
        \cs:w
          __fp_parse_infix_ \token_to_str:N #2 :N
          \exp_after:wN \exp_after:wN \exp_after:wN
        \cs_end:
      \fi:
    \fi:
    #1
    #2
  }
\cs_new:Npn \__fp_parse_infix_mark:NNN #1#2#3 { #3 #1 }
\cs_new:Npn \__fp_parse_infix_end:N #1
  { @ \use_none:n \__fp_parse_infix_end:N }
\cs_set_protected:Npn \__fp_tmp:w #1
  {
    \cs_new:Npn #1 ##1
      {
        \if_int_compare:w ##1 > \c__fp_prec_end_int
          \exp_after:wN @
          \exp_after:wN \use_none:n
          \exp_after:wN #1
        \else:
          \__kernel_msg_expandable_error:nnn { kernel } { fp-extra } { ) }
          \exp_after:wN \__fp_parse_infix:NN
          \exp_after:wN ##1
          \exp:w \exp_after:wN \__fp_parse_expand:w
        \fi:
      }
  }
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_):N }
\cs_set_protected:Npn \__fp_tmp:w #1
  {
    \cs_new:Npn #1 ##1
      {
        \if_int_compare:w ##1 > \c__fp_prec_comma_int
          \exp_after:wN @
          \exp_after:wN \use_none:n
          \exp_after:wN #1
        \else:
          \if_int_compare:w ##1 < \c__fp_prec_comma_int
            \exp_after:wN @
            \exp_after:wN \__fp_parse_apply_comma:NwNwN
            \exp_after:wN ,
            \exp:w
          \else:
            \exp_after:wN \__fp_parse_infix_comma:w
            \exp:w
          \fi:
          \__fp_parse_operand:Nw \c__fp_prec_comma_int
          \exp_after:wN \__fp_parse_expand:w
        \fi:
      }
  }
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_,:N }
\cs_new:Npn \__fp_parse_infix_comma:w #1 @
  { #1 @ \use_none:n }
\cs_new:Npn \__fp_parse_apply_comma:NwNwN #1 #2@ #3 #4@ #5
  {
    \exp_after:wN \__fp_parse_continue:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
    \__fp_exp_after_tuple_f:nw { }
      \s__fp_tuple \__fp_tuple_chk:w { #2 #4 } ;
    #5 #1
  }
\cs_set_protected:Npn \__fp_tmp:w #1#2#3#4
  {
    \cs_new:Npn #1 ##1
      {
        \if_int_compare:w ##1 < #3
          \exp_after:wN @
          \exp_after:wN \__fp_parse_apply_binary:NwNwN
          \exp_after:wN #2
          \exp:w
          \__fp_parse_operand:Nw #4
          \exp_after:wN \__fp_parse_expand:w
        \else:
          \exp_after:wN @
          \exp_after:wN \use_none:n
          \exp_after:wN #1
        \fi:
      }
  }
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_^:N }   ^
  \c__fp_prec_hatii_int \c__fp_prec_hat_int
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_juxt:N } *
  \c__fp_prec_juxt_int \c__fp_prec_juxt_int
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_/:N }   /
  \c__fp_prec_times_int \c__fp_prec_times_int
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_mul:N } *
  \c__fp_prec_times_int \c__fp_prec_times_int
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_-:N }   -
  \c__fp_prec_plus_int  \c__fp_prec_plus_int
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_+:N }   +
  \c__fp_prec_plus_int  \c__fp_prec_plus_int
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_and:N } &
  \c__fp_prec_and_int   \c__fp_prec_and_int
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_or:N }  |
  \c__fp_prec_or_int    \c__fp_prec_or_int
\cs_new:cpn { __fp_parse_infix_(:N } #1
  { \__fp_parse_infix_mul:N #1 ( }
\cs_set_protected:Npn \__fp_tmp:w #1
  {
    \cs_new:cpn { __fp_parse_infix_*:N } ##1##2
      {
        \if:w * \exp_not:N ##2
          \exp_after:wN #1
          \exp_after:wN ##1
        \else:
          \exp_after:wN \__fp_parse_infix_mul:N
          \exp_after:wN ##1
          \exp_after:wN ##2
        \fi:
      }
  }
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_^:N }
\cs_set_protected:Npn \__fp_tmp:w #1#2#3
  {
    \cs_new:Npn #1 ##1##2
      {
        \if:w #2 \exp_not:N ##2
          \exp_after:wN #1
          \exp_after:wN ##1
          \exp:w \exp_after:wN \__fp_parse_expand:w
        \else:
          \exp_after:wN #3
          \exp_after:wN ##1
          \exp_after:wN ##2
        \fi:
      }
  }
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_|:N } | \__fp_parse_infix_or:N
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_&:N } & \__fp_parse_infix_and:N
\cs_set_protected:Npn \__fp_tmp:w #1#2#3#4
  {
    \cs_new:Npn #1 ##1
      {
        \if_int_compare:w ##1 < \c__fp_prec_quest_int
          #4
          \exp_after:wN @
          \exp_after:wN #2
          \exp:w
          \__fp_parse_operand:Nw #3
          \exp_after:wN \__fp_parse_expand:w
        \else:
          \exp_after:wN @
          \exp_after:wN \use_none:n
          \exp_after:wN #1
        \fi:
      }
  }
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_?:N }
  \__fp_ternary:NwwN \c__fp_prec_quest_int { }
\exp_args:Nc \__fp_tmp:w { __fp_parse_infix_::N }
  \__fp_ternary_auxii:NwwN \c__fp_prec_colon_int
  {
    \__kernel_msg_expandable_error:nnnn
      { kernel } { fp-missing } { ? } { ~for~?: }
  }
\cs_new:cpn { __fp_parse_infix_<:N } #1
  { \__fp_parse_compare:NNNNNNN #1 1 0 0 0 0 < }
\cs_new:cpn { __fp_parse_infix_=:N } #1
  { \__fp_parse_compare:NNNNNNN #1 1 0 0 0 0 = }
\cs_new:cpn { __fp_parse_infix_>:N } #1
  { \__fp_parse_compare:NNNNNNN #1 1 0 0 0 0 > }
\cs_new:cpn { __fp_parse_infix_!:N } #1
  {
    \exp_after:wN \__fp_parse_compare:NNNNNNN
    \exp_after:wN #1
    \exp_after:wN 0
    \exp_after:wN 1
    \exp_after:wN 1
    \exp_after:wN 1
    \exp_after:wN 1
  }
\cs_new:Npn \__fp_parse_excl_error:
  {
    \__kernel_msg_expandable_error:nnnn
      { kernel } { fp-missing } { = } { ~after~!. }
  }
\cs_new:Npn \__fp_parse_compare:NNNNNNN #1
  {
    \if_int_compare:w #1 < \c__fp_prec_comp_int
      \exp_after:wN \__fp_parse_compare_auxi:NNNNNNN
      \exp_after:wN \__fp_parse_excl_error:
    \else:
      \exp_after:wN @
      \exp_after:wN \use_none:n
      \exp_after:wN \__fp_parse_compare:NNNNNNN
    \fi:
  }
\cs_new:Npn \__fp_parse_compare_auxi:NNNNNNN #1#2#3#4#5#6#7
  {
    \if_case:w
      \__fp_int_eval:w \exp_after:wN ` \token_to_str:N #7 - `<
        \__fp_int_eval_end:
         \__fp_parse_compare_auxii:NNNNN #2#2#4#5#6
    \or: \__fp_parse_compare_auxii:NNNNN #2#3#2#5#6
    \or: \__fp_parse_compare_auxii:NNNNN #2#3#4#2#6
    \or: \__fp_parse_compare_auxii:NNNNN #2#3#4#5#2
    \else: #1 \__fp_parse_compare_end:NNNNw #3#4#5#6#7
    \fi:
  }
\cs_new:Npn \__fp_parse_compare_auxii:NNNNN #1#2#3#4#5
  {
    \exp_after:wN \__fp_parse_compare_auxi:NNNNNNN
    \exp_after:wN \prg_do_nothing:
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN #4
    \exp_after:wN #5
    \exp:w \exp_after:wN \__fp_parse_expand:w
  }
\cs_new:Npn \__fp_parse_compare_end:NNNNw #1#2#3#4#5 \fi:
  {
    \fi:
    \exp_after:wN @
    \exp_after:wN \__fp_parse_apply_compare:NwNNNNNwN
    \exp_after:wN \c_one_fp
    \exp_after:wN #1
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN #4
    \exp:w
    \__fp_parse_operand:Nw \c__fp_prec_comp_int \__fp_parse_expand:w #5
  }
\cs_new:Npn \__fp_parse_apply_compare:NwNNNNNwN
    #1 #2@ #3 #4#5#6#7 #8@ #9
  {
    \if_int_odd:w
        \if_meaning:w \c_zero_fp #3
          0
        \else:
          \if_case:w \__fp_compare_back_any:ww #8 #2 \exp_stop_f:
            #5 \or: #6 \or: #7 \else: #4
          \fi:
        \fi:
        \exp_stop_f:
      \exp_after:wN \__fp_parse_apply_compare_aux:NNwN
      \exp_after:wN \c_one_fp
    \else:
      \exp_after:wN \__fp_parse_apply_compare_aux:NNwN
      \exp_after:wN \c_zero_fp
    \fi:
    #1 #8 #9
  }
\cs_new:Npn \__fp_parse_apply_compare_aux:NNwN #1 #2 #3; #4
  {
    \if_meaning:w \__fp_parse_compare:NNNNNNN #4
      \exp_after:wN \__fp_parse_continue_compare:NNwNN
      \exp_after:wN #1
      \exp_after:wN #2
      \exp:w \exp_end_continue_f:w
      \__fp_exp_after_o:w #3;
      \exp:w \exp_end_continue_f:w
    \else:
      \exp_after:wN \__fp_parse_continue:NwN
      \exp_after:wN #2
      \exp:w \exp_end_continue_f:w
      \exp_after:wN #1
      \exp:w \exp_end_continue_f:w
    \fi:
    #4 #2
  }
\cs_new:Npn \__fp_parse_continue_compare:NNwNN #1#2 #3@ #4#5
  { #4 #2 #3@ #1 }
\cs_new:Npn \__fp_parse_function_all_fp_o:fnw #1#2#3 @
  {
    \__fp_array_if_all_fp:nTF {#3}
      { #2 #3 @ }
      {
        \__fp_error:nffn { fp-bad-args }
          {#1}
          { \fp_to_tl:n { \s__fp_tuple \__fp_tuple_chk:w {#3} ; } }
          { }
        \exp_after:wN \c_nan_fp
      }
  }
\cs_new:Npn \__fp_parse_function_one_two:nnw #1#2#3
  {
    \__fp_if_type_fp:NTwFw
      #3 { } \s__fp \__fp_parse_function_one_two_error_o:w \s__fp_stop
    \__fp_parse_function_one_two_aux:nnw {#1} {#2} #3
  }
\cs_new:Npn \__fp_parse_function_one_two_error_o:w #1#2#3#4 @
  {
    \__fp_error:nffn { fp-bad-args }
      {#2}
      { \fp_to_tl:n { \s__fp_tuple \__fp_tuple_chk:w {#4} ; } }
      { }
    \exp_after:wN \c_nan_fp
  }
\cs_new:Npn \__fp_parse_function_one_two_aux:nnw #1#2 #3; #4
  {
    \__fp_if_type_fp:NTwFw
      #4 { }
      \s__fp
      {
        \if_meaning:w @ #4
          \exp_after:wN \use_iv:nnnn
        \fi:
        \__fp_parse_function_one_two_error_o:w
      }
      \s__fp_stop
    \__fp_parse_function_one_two_auxii:nnw {#1} {#2} #3; #4
  }
\cs_new:Npn \__fp_parse_function_one_two_auxii:nnw #1#2#3; #4; #5
  {
    \if_meaning:w @ #5 \else:
      \exp_after:wN \__fp_parse_function_one_two_error_o:w
    \fi:
    \use_ii:nn {#1} { \use_none:n #2 } #3; #4; #5
  }
\cs_new:Npn \__fp_tuple_map_o:nw #1 \s__fp_tuple \__fp_tuple_chk:w #2 ;
  {
    \exp_after:wN \s__fp_tuple
    \exp_after:wN \__fp_tuple_chk:w
    \exp_after:wN {
      \exp:w \exp_end_continue_f:w
      \__fp_tuple_map_loop_o:nw {#1} #2
        { \s__fp \prg_break: } ;
      \prg_break_point:
    \exp_after:wN } \exp_after:wN ;
  }
\cs_new:Npn \__fp_tuple_map_loop_o:nw #1#2#3 ;
  {
    \use_none:n #2
    #1 #2 #3 ;
    \exp:w \exp_end_continue_f:w
    \__fp_tuple_map_loop_o:nw {#1}
  }
\cs_new:Npn \__fp_tuple_mapthread_o:nww #1
    \s__fp_tuple \__fp_tuple_chk:w #2 ;
    \s__fp_tuple \__fp_tuple_chk:w #3 ;
  {
    \exp_after:wN \s__fp_tuple
    \exp_after:wN \__fp_tuple_chk:w
    \exp_after:wN {
      \exp:w \exp_end_continue_f:w
      \__fp_tuple_mapthread_loop_o:nw {#1}
        #2 { \s__fp \prg_break: } ; @
        #3 { \s__fp \prg_break: } ;
      \prg_break_point:
    \exp_after:wN } \exp_after:wN ;
  }
\cs_new:Npn \__fp_tuple_mapthread_loop_o:nw #1#2#3 ; #4 @ #5#6 ;
  {
    \use_none:n #2
    \use_none:n #5
    #1 #2 #3 ; #5 #6 ;
    \exp:w \exp_end_continue_f:w
    \__fp_tuple_mapthread_loop_o:nw {#1} #4 @
  }
\__kernel_msg_new:nnn { kernel } { fp-deprecated }
  { '#1'~deprecated;~use~'#2' }
\__kernel_msg_new:nnn { kernel } { unknown-fp-word }
  { Unknown~fp~word~#1. }
\__kernel_msg_new:nnn { kernel } { fp-missing }
  { Missing~#1~inserted #2. }
\__kernel_msg_new:nnn { kernel } { fp-extra }
  { Extra~#1~ignored. }
\__kernel_msg_new:nnn { kernel } { fp-early-end }
  { Premature~end~in~fp~expression. }
\__kernel_msg_new:nnn { kernel } { fp-after-e }
  { Cannot~use~#1 after~'e'. }
\__kernel_msg_new:nnn { kernel } { fp-missing-number }
  { Missing~number~before~'#1'. }
\__kernel_msg_new:nnn { kernel } { fp-unknown-symbol }
  { Unknown~symbol~#1~ignored. }
\__kernel_msg_new:nnn { kernel } { fp-extra-comma }
  { Unexpected~comma~turned~to~nan~result. }
\__kernel_msg_new:nnn { kernel } { fp-no-arg }
  { #1~got~no~argument;~used~nan. }
\__kernel_msg_new:nnn { kernel } { fp-multi-arg }
  { #1~got~more~than~one~argument;~used~nan. }
\__kernel_msg_new:nnn { kernel } { fp-num-args }
  { #1~expects~between~#2~and~#3~arguments. }
\__kernel_msg_new:nnn { kernel } { fp-bad-args }
  { Arguments~in~#1#2~are~invalid. }
\__kernel_msg_new:nnn { kernel } { fp-infty-pi }
  { Math~command~#1 is~not~an~fp }
\cs_if_exist:cT { @unexpandable@protect }
  {
    \__kernel_msg_new:nnn { kernel } { fp-robust-cmd }
      { Robust~command~#1 invalid~in~fp~expression! }
  }
%% File: l3fp-assign.dtx
\cs_new_protected:Npn \fp_new:N #1
  { \cs_new_eq:NN #1 \c_zero_fp }
\cs_generate_variant:Nn \fp_new:N {c}
\cs_new_protected:Npn \fp_set:Nn   #1#2
  { \__kernel_tl_set:Nx #1 { \exp_not:f { \__fp_parse:n {#2} } } }
\cs_new_protected:Npn \fp_gset:Nn  #1#2
  { \__kernel_tl_gset:Nx #1 { \exp_not:f { \__fp_parse:n {#2} } } }
\cs_new_protected:Npn \fp_const:Nn #1#2
  { \tl_const:Nx #1 { \exp_not:f { \__fp_parse:n {#2} } } }
\cs_generate_variant:Nn \fp_set:Nn {c}
\cs_generate_variant:Nn \fp_gset:Nn {c}
\cs_generate_variant:Nn \fp_const:Nn {c}
\cs_new_eq:NN \fp_set_eq:NN  \tl_set_eq:NN
\cs_new_eq:NN \fp_gset_eq:NN \tl_gset_eq:NN
\cs_generate_variant:Nn \fp_set_eq:NN  { c , Nc , cc }
\cs_generate_variant:Nn \fp_gset_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \fp_zero:N #1 { \fp_set_eq:NN #1 \c_zero_fp }
\cs_new_protected:Npn \fp_gzero:N #1 { \fp_gset_eq:NN #1 \c_zero_fp }
\cs_generate_variant:Nn \fp_zero:N  { c }
\cs_generate_variant:Nn \fp_gzero:N { c }
\cs_new_protected:Npn \fp_zero_new:N #1
  { \fp_if_exist:NTF #1 { \fp_zero:N #1 } { \fp_new:N #1 } }
\cs_new_protected:Npn \fp_gzero_new:N #1
  { \fp_if_exist:NTF #1 { \fp_gzero:N #1 } { \fp_new:N #1 } }
\cs_generate_variant:Nn \fp_zero_new:N  { c }
\cs_generate_variant:Nn \fp_gzero_new:N { c }
\cs_new_protected:Npn \fp_add:Nn  { \__fp_add:NNNn \fp_set:Nn  + }
\cs_new_protected:Npn \fp_gadd:Nn { \__fp_add:NNNn \fp_gset:Nn + }
\cs_new_protected:Npn \fp_sub:Nn  { \__fp_add:NNNn \fp_set:Nn  - }
\cs_new_protected:Npn \fp_gsub:Nn { \__fp_add:NNNn \fp_gset:Nn - }
\cs_new_protected:Npn \__fp_add:NNNn #1#2#3#4
  { #1 #3 { #3 #2 \__fp_parse:n {#4} } }
\cs_generate_variant:Nn \fp_add:Nn  { c }
\cs_generate_variant:Nn \fp_gadd:Nn { c }
\cs_generate_variant:Nn \fp_sub:Nn  { c }
\cs_generate_variant:Nn \fp_gsub:Nn { c }
\cs_new_protected:Npn \fp_show:N { \__fp_show:NN \tl_show:n }
\cs_generate_variant:Nn \fp_show:N { c }
\cs_new_protected:Npn \fp_log:N { \__fp_show:NN \tl_log:n }
\cs_generate_variant:Nn \fp_log:N { c }
\cs_new_protected:Npn \__fp_show:NN #1#2
  {
    \__kernel_chk_defined:NT #2
      { \exp_args:Nx #1 { \token_to_str:N #2 = \fp_to_tl:N #2 } }
  }
\cs_new_protected:Npn \fp_show:n
  { \msg_show_eval:Nn \fp_to_tl:n }
\cs_new_protected:Npn \fp_log:n
  { \msg_log_eval:Nn \fp_to_tl:n }
\fp_const:Nn \c_e_fp          { 2.718 2818 2845 9045 }
\fp_const:Nn \c_one_fp        { 1 }
\fp_const:Nn \c_pi_fp         { 3.141 5926 5358 9793 }
\fp_const:Nn \c_one_degree_fp { 0.0 1745 3292 5199 4330 }
\fp_new:N \l_tmpa_fp
\fp_new:N \l_tmpb_fp
\fp_new:N \g_tmpa_fp
\fp_new:N \g_tmpb_fp
%% File: l3fp-logic.dtx
\cs_new:Npn \__fp_parse_word_max:N
  { \__fp_parse_function:NNN \__fp_minmax_o:Nw 2 }
\cs_new:Npn \__fp_parse_word_min:N
  { \__fp_parse_function:NNN \__fp_minmax_o:Nw 0 }
\prg_new_eq_conditional:NNn \fp_if_exist:N \cs_if_exist:N { TF , T , F , p }
\prg_new_eq_conditional:NNn \fp_if_exist:c \cs_if_exist:c { TF , T , F , p }
\prg_new_conditional:Npnn \fp_if_nan:n #1 { TF , T , F , p }
  {
    \if:w 3 \exp_last_unbraced:Nf \__fp_kind:w { \__fp_parse:n {#1} }
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_new_conditional:Npnn \fp_compare:n #1 { p , T , F , TF }
  {
    \exp_after:wN \__fp_compare_return:w
    \exp:w \exp_end_continue_f:w \__fp_parse:n {#1}
  }
\cs_new:Npn \__fp_compare_return:w #1#2#3;
  {
    \if_charcode:w 0
          \__fp_if_type_fp:NTwFw
            #1 { \__fp_use_i_delimit_by_s_stop:nw #3 \s__fp_stop }
            \s__fp 1 \s__fp_stop
      \prg_return_false:
    \else:
      \prg_return_true:
    \fi:
  }
\prg_new_conditional:Npnn \fp_compare:nNn #1#2#3 { p , T , F , TF }
  {
    \if_int_compare:w
        \exp_after:wN \__fp_compare_aux:wn
          \exp:w \exp_end_continue_f:w \__fp_parse:n {#1} {#3}
        = \__fp_int_eval:w `#2 - `= \__fp_int_eval_end:
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__fp_compare_aux:wn #1; #2
  {
    \exp_after:wN \__fp_compare_back_any:ww
      \exp:w \exp_end_continue_f:w \__fp_parse:n {#2} #1;
  }
\cs_new:Npn \__fp_compare_back_any:ww #1#2; #3
  {
    \__fp_if_type_fp:NTwFw
      #1 { \__fp_if_type_fp:NTwFw #3 \use_i:nn \s__fp \use_ii:nn \s__fp_stop }
      \s__fp \use_ii:nn \s__fp_stop
    \__fp_compare_back:ww
    {
      \cs:w
        __fp
        \__fp_type_from_scan:N #1
        _compare_back
        \__fp_type_from_scan:N #3
        :ww
      \cs_end:
    }
    #1#2 ; #3
  }
\cs_new:Npn \__fp_compare_back:ww
    \s__fp \__fp_chk:w #1 #2 #3;
    \s__fp \__fp_chk:w #4 #5 #6;
  {
    \int_value:w
      \if_meaning:w 3 #1 \exp_after:wN \__fp_compare_nan:w \fi:
      \if_meaning:w 3 #4 \exp_after:wN \__fp_compare_nan:w \fi:
      \if_meaning:w 2 #5 - \fi:
      \if_meaning:w #2 #5
        \if_meaning:w #1 #4
          \if_meaning:w 1 #1
            \__fp_compare_npos:nwnw #6; #3;
          \else:
            0
          \fi:
        \else:
          \if_int_compare:w #4 < #1 - \fi: 1
        \fi:
      \else:
        \if_int_compare:w #1#4 = 0 \exp_stop_f:
          0
        \else:
          1
        \fi:
      \fi:
    \exp_stop_f:
  }
\cs_new:Npn \__fp_compare_nan:w #1 \fi: \exp_stop_f: { 2 \exp_stop_f: }
\cs_new:Npn \__fp_compare_back_tuple:ww #1; #2; { 2 }
\cs_new:Npn \__fp_tuple_compare_back:ww #1; #2; { 2 }
\cs_new:Npn \__fp_tuple_compare_back_tuple:ww
  \s__fp_tuple \__fp_tuple_chk:w #1;
  \s__fp_tuple \__fp_tuple_chk:w #2;
  {
    \int_compare:nNnTF { \__fp_array_count:n {#1} } =
      { \__fp_array_count:n {#2} }
      {
        \int_value:w 0
          \__fp_tuple_compare_back_loop:w
              #1 { \s__fp \prg_break: } ; @
              #2 { \s__fp \prg_break: } ;
            \prg_break_point:
        \exp_stop_f:
      }
      { 2 }
  }
\cs_new:Npn \__fp_tuple_compare_back_loop:w #1#2 ; #3 @ #4#5 ;
  {
    \use_none:n #1
    \use_none:n #4
    \if_int_compare:w
        \__fp_compare_back_any:ww #1 #2 ; #4 #5 ; = 0 \exp_stop_f:
    \else:
      2 \exp_after:wN \prg_break:
    \fi:
    \__fp_tuple_compare_back_loop:w #3 @
  }
\cs_new:Npn \__fp_compare_npos:nwnw #1#2; #3#4;
  {
    \if_int_compare:w #1 = #3 \exp_stop_f:
      \__fp_compare_significand:nnnnnnnn #2 #4
    \else:
      \if_int_compare:w #1 < #3 - \fi: 1
    \fi:
  }
\cs_new:Npn \__fp_compare_significand:nnnnnnnn #1#2#3#4#5#6#7#8
  {
    \if_int_compare:w #1#2 = #5#6 \exp_stop_f:
      \if_int_compare:w #3#4 = #7#8 \exp_stop_f:
        0
      \else:
        \if_int_compare:w #3#4 < #7#8 - \fi: 1
      \fi:
    \else:
      \if_int_compare:w #1#2 < #5#6 - \fi: 1
    \fi:
  }
\cs_new:Npn \fp_do_until:nn #1#2
  {
    #2
    \fp_compare:nF {#1}
      { \fp_do_until:nn {#1} {#2} }
  }
\cs_new:Npn \fp_do_while:nn #1#2
  {
    #2
    \fp_compare:nT {#1}
      { \fp_do_while:nn {#1} {#2} }
  }
\cs_new:Npn \fp_until_do:nn #1#2
  {
    \fp_compare:nF {#1}
      {
        #2
        \fp_until_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \fp_while_do:nn #1#2
  {
    \fp_compare:nT {#1}
      {
        #2
        \fp_while_do:nn {#1} {#2}
      }
  }
\cs_new:Npn \fp_do_until:nNnn #1#2#3#4
  {
    #4
    \fp_compare:nNnF {#1} #2 {#3}
      { \fp_do_until:nNnn {#1} #2 {#3} {#4} }
  }
\cs_new:Npn \fp_do_while:nNnn #1#2#3#4
  {
    #4
    \fp_compare:nNnT {#1} #2 {#3}
      { \fp_do_while:nNnn {#1} #2 {#3} {#4} }
  }
\cs_new:Npn \fp_until_do:nNnn #1#2#3#4
  {
    \fp_compare:nNnF {#1} #2 {#3}
      {
        #4
        \fp_until_do:nNnn {#1} #2 {#3} {#4}
      }
  }
\cs_new:Npn \fp_while_do:nNnn #1#2#3#4
  {
    \fp_compare:nNnT {#1} #2 {#3}
      {
        #4
        \fp_while_do:nNnn {#1} #2 {#3} {#4}
      }
  }
\cs_new:Npn \fp_step_function:nnnN #1#2#3
  {
    \exp_after:wN \__fp_step:wwwN
      \exp:w \exp_end_continue_f:w \__fp_parse_o:n {#1}
      \exp:w \exp_end_continue_f:w \__fp_parse_o:n {#2}
      \exp:w \exp_end_continue_f:w \__fp_parse:n {#3}
  }
\cs_generate_variant:Nn \fp_step_function:nnnN { nnnc }
\cs_new:Npn \__fp_step:wwwN #1#2; #3#4; #5#6; #7
  {
    \__fp_if_type_fp:NTwFw #1 { } \s__fp \prg_break: \s__fp_stop
    \__fp_if_type_fp:NTwFw #3 { } \s__fp \prg_break: \s__fp_stop
    \__fp_if_type_fp:NTwFw #5 { } \s__fp \prg_break: \s__fp_stop
    \use_i:nnnn { \__fp_step_fp:wwwN #1#2; #3#4; #5#6; #7 }
    \prg_break_point:
    \use:n
      {
        \__fp_error:nfff { fp-step-tuple } { \fp_to_tl:n { #1#2 ; } }
          { \fp_to_tl:n { #3#4 ; } } { \fp_to_tl:n { #5#6 ; } }
      }
  }
\cs_new:Npn \__fp_step_fp:wwwN #1 ; \s__fp \__fp_chk:w #2#3#4 ; #5; #6
  {
    \token_if_eq_meaning:NNTF #2 1
      {
        \token_if_eq_meaning:NNTF #3 0
          { \__fp_step:NnnnnN > }
          { \__fp_step:NnnnnN < }
      }
      {
        \token_if_eq_meaning:NNTF #2 0
          {
            \__kernel_msg_expandable_error:nnn { kernel }
              { zero-step } {#6}
          }
          {
            \__fp_error:nnfn { fp-bad-step } { }
              { \fp_to_tl:n { \s__fp \__fp_chk:w #2#3#4 ; } } {#6}
          }
        \use_none:nnnnn
      }
      { #1 ; } { \c_nan_fp } { \s__fp \__fp_chk:w #2#3#4 ; } { #5 ; } #6
  }
\cs_new:Npn \__fp_step:NnnnnN #1#2#3#4#5#6
  {
    \fp_compare:nNnTF {#2} = {#3}
      {
        \__fp_error:nffn { fp-tiny-step }
          { \fp_to_tl:n {#3} } { \fp_to_tl:n {#4} } {#6}
      }
      {
        \fp_compare:nNnF {#2} #1 {#5}
          {
            \exp_args:Nf #6 { \__fp_to_decimal_dispatch:w #2 }
            \__fp_step:NfnnnN
              #1 { \__fp_parse:n { #2 + #4 } } {#2} {#4} {#5} #6
          }
      }
  }
\cs_generate_variant:Nn \__fp_step:NnnnnN { Nf }
\cs_new_protected:Npn \fp_step_inline:nnnn
  {
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:NNc \__fp_step:NNnnnn
      \cs_gset_protected:Npn
      { __fp_map_ \int_use:N \g__kernel_prg_map_int :w }
  }
\cs_new_protected:Npn \fp_step_variable:nnnNn #1#2#3#4#5
  {
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:NNc \__fp_step:NNnnnn
      \cs_gset_protected:Npx
      { __fp_map_ \int_use:N \g__kernel_prg_map_int :w }
      {#1} {#2} {#3}
      {
        \tl_set:Nn \exp_not:N #4 {##1}
        \exp_not:n {#5}
      }
  }
\cs_new_protected:Npn \__fp_step:NNnnnn #1#2#3#4#5#6
  {
    #1 #2 ##1 {#6}
    \fp_step_function:nnnN {#3} {#4} {#5} #2
    \prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__kernel_prg_map_int }
  }
\__kernel_msg_new:nnn { kernel } { fp-step-tuple }
  { Tuple~argument~in~fp_step_...~{#1}{#2}{#3}. }
\__kernel_msg_new:nnn { kernel } { fp-bad-step }
  { Invalid~step~size~#2~in~step~function~#3. }
\__kernel_msg_new:nnn { kernel } { fp-tiny-step }
  { Tiny~step~size~(#1+#2=#1)~in~step~function~#3. }
\cs_new:Npn \__fp_minmax_o:Nw #1
  {
    \__fp_parse_function_all_fp_o:fnw
      { \token_if_eq_meaning:NNTF 0 #1 { min } { max } }
      { \__fp_minmax_aux_o:Nw #1 }
  }
\cs_new:Npn \__fp_minmax_aux_o:Nw #1#2 @
  {
    \if_meaning:w 0 #1
      \exp_after:wN \__fp_minmax_loop:Nww \exp_after:wN +
    \else:
      \exp_after:wN \__fp_minmax_loop:Nww \exp_after:wN -
    \fi:
    #2
    \s__fp \__fp_chk:w 2 #1 \s__fp_exact ;
    \s__fp \__fp_chk:w { 3 \__fp_minmax_break_o:w } ;
  }
\cs_new:Npn \__fp_minmax_loop:Nww
    #1 \s__fp \__fp_chk:w #2#3; \s__fp \__fp_chk:w #4#5;
  {
    \if_meaning:w 3 #4
      \if_meaning:w 3 #2
        \__fp_minmax_auxi:ww
      \else:
        \__fp_minmax_auxii:ww
      \fi:
    \else:
      \if_int_compare:w
          \__fp_compare_back:ww
            \s__fp \__fp_chk:w #4#5;
            \s__fp \__fp_chk:w #2#3;
          = #1 1 \exp_stop_f:
        \__fp_minmax_auxii:ww
      \else:
        \__fp_minmax_auxi:ww
      \fi:
    \fi:
    \__fp_minmax_loop:Nww #1
      \s__fp \__fp_chk:w #2#3;
      \s__fp \__fp_chk:w #4#5;
  }
\cs_new:Npn \__fp_minmax_auxi:ww  #1 \fi: \fi: #2 \s__fp #3 ; \s__fp #4;
  { \fi: \fi: #2 \s__fp #3 ; }
\cs_new:Npn \__fp_minmax_auxii:ww #1 \fi: \fi: #2 \s__fp #3 ;
  { \fi: \fi: #2 }
\cs_new:Npn \__fp_minmax_break_o:w #1 \fi: \fi: #2 \s__fp #3; #4;
  { \fi: \__fp_exp_after_o:w \s__fp #3; }
\cs_new:Npn \__fp_not_o:w #1 \s__fp \__fp_chk:w #2#3; @
  {
    \if_meaning:w 0 #2
      \exp_after:wN \exp_after:wN \exp_after:wN \c_one_fp
    \else:
      \exp_after:wN \exp_after:wN \exp_after:wN \c_zero_fp
    \fi:
  }
\cs_new:Npn \__fp_tuple_not_o:w #1 @ { \exp_after:wN \c_zero_fp }
\group_begin:
  \char_set_catcode_letter:N &
  \char_set_catcode_letter:N |
  \cs_new:Npn \__fp_&_o:ww #1 \s__fp \__fp_chk:w #2#3;
    {
      \if_meaning:w 0 #2 #1
        \__fp_and_return:wNw \s__fp \__fp_chk:w #2#3;
      \fi:
      \__fp_exp_after_o:w
    }
  \cs_new:Npn \__fp_&_tuple_o:ww #1 \s__fp \__fp_chk:w #2#3;
    {
      \if_meaning:w 0 #2 #1
        \__fp_and_return:wNw \s__fp \__fp_chk:w #2#3;
      \fi:
      \__fp_exp_after_tuple_o:w
    }
  \cs_new:Npn \__fp_tuple_&_o:ww #1; { \__fp_exp_after_o:w }
  \cs_new:Npn \__fp_tuple_&_tuple_o:ww #1; { \__fp_exp_after_tuple_o:w }
  \cs_new:Npn \__fp_|_o:ww { \__fp_&_o:ww \else: }
  \cs_new:Npn \__fp_|_tuple_o:ww { \__fp_&_tuple_o:ww \else: }
  \cs_new:Npn \__fp_tuple_|_o:ww #1; #2; { \__fp_exp_after_tuple_o:w #1; }
  \cs_new:Npn \__fp_tuple_|_tuple_o:ww #1; #2;
    { \__fp_exp_after_tuple_o:w #1; }
\group_end:
\cs_new:Npn \__fp_and_return:wNw #1; \fi: #2;
  { \fi: \__fp_exp_after_o:w #1; }
\cs_new:Npn \__fp_ternary:NwwN #1 #2#3@ #4@ #5
  {
    \if_meaning:w \__fp_parse_infix_::N #5
      \if_charcode:w 0
            \__fp_if_type_fp:NTwFw
              #2 { \use_i:nn \__fp_use_i_delimit_by_s_stop:nw #3 \s__fp_stop }
              \s__fp 1 \s__fp_stop
        \exp_after:wN \exp_after:wN \exp_after:wN \__fp_ternary_auxii:NwwN
      \else:
        \exp_after:wN \exp_after:wN \exp_after:wN \__fp_ternary_auxi:NwwN
      \fi:
      \exp_after:wN #1
      \exp:w \exp_end_continue_f:w
      \__fp_exp_after_array_f:w #4 \s__fp_expr_stop
      \exp_after:wN @
      \exp:w
        \__fp_parse_operand:Nw \c__fp_prec_colon_int
        \__fp_parse_expand:w
    \else:
      \__kernel_msg_expandable_error:nnnn
        { kernel } { fp-missing } { : } { ~for~?: }
      \exp_after:wN \__fp_parse_continue:NwN
      \exp_after:wN #1
      \exp:w \exp_end_continue_f:w
      \__fp_exp_after_array_f:w #4 \s__fp_expr_stop
      \exp_after:wN #5
      \exp_after:wN #1
    \fi:
  }
\cs_new:Npn \__fp_ternary_auxi:NwwN #1#2@#3@#4
  {
    \exp_after:wN \__fp_parse_continue:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
    \__fp_exp_after_array_f:w #2 \s__fp_expr_stop
    #4 #1
  }
\cs_new:Npn \__fp_ternary_auxii:NwwN #1#2@#3@#4
  {
    \exp_after:wN \__fp_parse_continue:NwN
    \exp_after:wN #1
    \exp:w \exp_end_continue_f:w
    \__fp_exp_after_array_f:w #3 \s__fp_expr_stop
    #4 #1
  }
%% File: l3fp-basics.dtx
\cs_new:Npn \__fp_parse_word_abs:N
  { \__fp_parse_unary_function:NNN \__fp_set_sign_o:w 0 }
\cs_new:Npn \__fp_parse_word_logb:N
  { \__fp_parse_unary_function:NNN \__fp_logb_o:w ? }
\cs_new:Npn \__fp_parse_word_sign:N
  { \__fp_parse_unary_function:NNN \__fp_sign_o:w ? }
\cs_new:Npn \__fp_parse_word_sqrt:N
  { \__fp_parse_unary_function:NNN \__fp_sqrt_o:w ? }
\cs_new:cpx { __fp_-_o:ww } \s__fp
  {
    \exp_not:c { __fp_+_o:ww }
    \exp_not:n { \s__fp \__fp_neg_sign:N }
  }
\cs_new:cpn { __fp_+_o:ww }
    \s__fp #1 \__fp_chk:w #2 #3 ; \s__fp \__fp_chk:w #4 #5
  {
    \if_case:w
      \if_meaning:w #2 #4
        #2
      \else:
        \if_int_compare:w #2 > #4 \exp_stop_f:
          3
        \else:
          4
        \fi:
      \fi:
      \exp_stop_f:
           \exp_after:wN \__fp_add_zeros_o:Nww \int_value:w
    \or:   \exp_after:wN \__fp_add_normal_o:Nww \int_value:w
    \or:   \exp_after:wN \__fp_add_inf_o:Nww \int_value:w
    \or:   \__fp_case_return_i_o:ww
    \else: \exp_after:wN \__fp_add_return_ii_o:Nww \int_value:w
    \fi:
    #1 #5
    \s__fp \__fp_chk:w #2 #3 ;
    \s__fp \__fp_chk:w #4 #5
  }
\cs_new:Npn \__fp_add_return_ii_o:Nww #1 #2 ; \s__fp \__fp_chk:w #3 #4
  { \__fp_exp_after_o:w \s__fp \__fp_chk:w #3 #1 }
\cs_new:Npn \__fp_add_zeros_o:Nww #1 \s__fp \__fp_chk:w 0 #2
  {
    \if_int_compare:w #2 #1 = 20 \exp_stop_f:
      \exp_after:wN \__fp_add_return_ii_o:Nww
    \else:
      \__fp_case_return_i_o:ww
    \fi:
    #1
    \s__fp \__fp_chk:w 0 #2
  }
\cs_new:Npn \__fp_add_inf_o:Nww
    #1 \s__fp \__fp_chk:w 2 #2 #3; \s__fp \__fp_chk:w 2 #4
  {
    \if_meaning:w #1 #2
      \__fp_case_return_i_o:ww
    \else:
      \__fp_case_use:nw
        {
          \exp_last_unbraced:Nf \__fp_invalid_operation_o:Nww
            { \token_if_eq_meaning:NNTF #1 #4 + - }
        }
    \fi:
    \s__fp \__fp_chk:w 2 #2 #3;
    \s__fp \__fp_chk:w 2 #4
  }
\cs_new:Npn \__fp_add_normal_o:Nww #1 \s__fp \__fp_chk:w 1 #2
  {
    \if_meaning:w #1#2
      \exp_after:wN \__fp_add_npos_o:NnwNnw
    \else:
      \exp_after:wN \__fp_sub_npos_o:NnwNnw
    \fi:
    #2
  }
\cs_new:Npn \__fp_add_npos_o:NnwNnw #1#2#3 ; \s__fp \__fp_chk:w 1 #4 #5
  {
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w
      \if_int_compare:w #2 > #5 \exp_stop_f:
        #2
        \exp_after:wN \__fp_add_big_i_o:wNww \int_value:w -
      \else:
        #5
        \exp_after:wN \__fp_add_big_ii_o:wNww \int_value:w
      \fi:
      \__fp_int_eval:w #5 - #2 ; #1 #3;
  }
\cs_new:Npn \__fp_add_big_i_o:wNww #1; #2 #3; #4;
  {
    \__fp_decimate:nNnnnn {#1}
      \__fp_add_significand_o:NnnwnnnnN
      #4
    #3
    #2
  }
\cs_new:Npn \__fp_add_big_ii_o:wNww #1; #2 #3; #4;
  {
    \__fp_decimate:nNnnnn {#1}
      \__fp_add_significand_o:NnnwnnnnN
      #3
    #4
    #2
  }
\cs_new:Npn \__fp_add_significand_o:NnnwnnnnN #1 #2#3 #4; #5#6#7#8
  {
    \exp_after:wN \__fp_add_significand_test_o:N
    \int_value:w \__fp_int_eval:w 1#5#6 + #2
      \exp_after:wN \__fp_add_significand_pack:NNNNNNN
      \int_value:w \__fp_int_eval:w 1#7#8 + #3 ; #1
  }
\cs_new:Npn \__fp_add_significand_pack:NNNNNNN #1 #2#3#4#5#6#7
  {
    \if_meaning:w 2 #1
      + 1
    \fi:
    ; #2 #3 #4 #5 #6 #7 ;
  }
\cs_new:Npn \__fp_add_significand_test_o:N #1
  {
    \if_meaning:w 2 #1
      \exp_after:wN \__fp_add_significand_carry_o:wwwNN
    \else:
      \exp_after:wN \__fp_add_significand_no_carry_o:wwwNN
    \fi:
  }
\cs_new:Npn \__fp_add_significand_no_carry_o:wwwNN
    #1; #2; #3#4 ; #5#6
  {
    \exp_after:wN \__fp_basics_pack_high:NNNNNw
    \int_value:w \__fp_int_eval:w 1 #1
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w 1 #2 #3#4
        + \__fp_round:NNN #6 #4 #5
        \exp_after:wN ;
  }
\cs_new:Npn \__fp_add_significand_carry_o:wwwNN
    #1; #2; #3#4; #5#6
  {
    + 1
    \exp_after:wN \__fp_basics_pack_weird_high:NNNNNNNNw
    \int_value:w \__fp_int_eval:w 1 1 #1
      \exp_after:wN \__fp_basics_pack_weird_low:NNNNw
      \int_value:w \__fp_int_eval:w 1 #2#3 +
        \exp_after:wN \__fp_round:NNN
        \exp_after:wN #6
        \exp_after:wN #3
        \int_value:w \__fp_round_digit:Nw #4 #5 ;
        \exp_after:wN ;
  }
\cs_new:Npn \__fp_sub_npos_o:NnwNnw #1#2#3; \s__fp \__fp_chk:w 1 #4#5#6;
  {
    \if_case:w \__fp_compare_npos:nwnw {#2} #3; {#5} #6; \exp_stop_f:
      \exp_after:wN \__fp_sub_eq_o:Nnwnw
    \or:
      \exp_after:wN \__fp_sub_npos_i_o:Nnwnw
    \else:
      \exp_after:wN \__fp_sub_npos_ii_o:Nnwnw
    \fi:
    #1 {#2} #3; {#5} #6;
  }
\cs_new:Npn \__fp_sub_eq_o:Nnwnw #1#2; #3; { \exp_after:wN \c_zero_fp }
\cs_new:Npn \__fp_sub_npos_ii_o:Nnwnw #1 #2; #3;
  {
    \exp_after:wN \__fp_sub_npos_i_o:Nnwnw
      \int_value:w \__fp_neg_sign:N #1
      #3; #2;
  }
\cs_new:Npn \__fp_sub_npos_i_o:Nnwnw #1 #2#3; #4#5;
  {
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w
      #2
      \if_int_compare:w #2 = #4 \exp_stop_f:
        \exp_after:wN \__fp_sub_back_near_o:nnnnnnnnN
      \else:
        \exp_after:wN \__fp_decimate:nNnnnn \exp_after:wN
          { \int_value:w \__fp_int_eval:w #2 - #4 - 1 \exp_after:wN }
          \exp_after:wN \__fp_sub_back_far_o:NnnwnnnnN
      \fi:
        #5
      #3
      #1
  }
\cs_new:Npn \__fp_sub_back_near_o:nnnnnnnnN #1#2#3#4 #5#6#7#8 #9
  {
    \exp_after:wN \__fp_sub_back_near_after:wNNNNw
    \int_value:w \__fp_int_eval:w 10#5#6 - #1#2 - 11
      \exp_after:wN \__fp_sub_back_near_pack:NNNNNNw
      \int_value:w \__fp_int_eval:w 11#7#8 - #3#4 \exp_after:wN ;
  }
\cs_new:Npn \__fp_sub_back_near_pack:NNNNNNw #1#2#3#4#5#6#7 ;
  { + #1#2 ; {#3#4#5#6} {#7} ; }
\cs_new:Npn \__fp_sub_back_near_after:wNNNNw 10 #1#2#3#4 #5 ;
  {
    \if_meaning:w 0 #1
      \exp_after:wN \__fp_sub_back_shift:wnnnn
    \fi:
    ; {#1#2#3#4} {#5}
  }
\cs_new:Npn \__fp_sub_back_shift:wnnnn ; #1#2
  {
    \exp_after:wN \__fp_sub_back_shift_ii:ww
    \int_value:w #1 #2 0 ;
  }
\cs_new:Npn \__fp_sub_back_shift_ii:ww #1 0 ; #2#3 ;
  {
    \if_meaning:w @ #1 @
      - 7
      - \exp_after:wN \use_i:nnn
        \exp_after:wN \__fp_sub_back_shift_iii:NNNNNNNNw
        \int_value:w #2#3 0 ~ 123456789;
    \else:
      - \__fp_sub_back_shift_iii:NNNNNNNNw #1 123456789;
    \fi:
    \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
    \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
    \exp_after:wN \__fp_sub_back_shift_iv:nnnnw
    \exp_after:wN ;
    \int_value:w
    #1 ~ #2#3 0 ~ 0000 0000 0000 000 ;
  }
\cs_new:Npn \__fp_sub_back_shift_iii:NNNNNNNNw #1#2#3#4#5#6#7#8#9; {#8}
\cs_new:Npn \__fp_sub_back_shift_iv:nnnnw #1 ; #2 ; { ; #1 ; }
\cs_new:Npn \__fp_sub_back_far_o:NnnwnnnnN #1 #2#3 #4; #5#6#7#8
  {
    \if_case:w
      \if_int_compare:w 1 #2 = #5#6 \use_i:nnnn #7 \exp_stop_f:
        \if_int_compare:w #3 = \use_none:n #7#8 0 \exp_stop_f:
          0
        \else:
          \if_int_compare:w #3 > \use_none:n #7#8 0 - \fi: 1
        \fi:
      \else:
        \if_int_compare:w 1 #2 > #5#6 \use_i:nnnn #7 - \fi: 1
      \fi:
      \exp_stop_f:
           \exp_after:wN \__fp_sub_back_quite_far_o:wwNN
    \or:   \exp_after:wN \__fp_sub_back_very_far_o:wwwwNN
    \else: \exp_after:wN \__fp_sub_back_not_far_o:wwwwNN
    \fi:
    #2 ~ #3 ; #5 #6 ~ #7 #8 ; #1
  }
\cs_new:Npn \__fp_sub_back_quite_far_o:wwNN #1; #2; #3#4
  {
    \exp_after:wN \__fp_sub_back_quite_far_ii:NN
    \exp_after:wN #3
    \exp_after:wN #4
  }
\cs_new:Npn \__fp_sub_back_quite_far_ii:NN #1#2
  {
    \if_case:w \__fp_round_neg:NNN #2 0 #1
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
      { ; {1000} {0000} {0000} {0000} ; }
      { - 1 ; {9999} {9999} {9999} {9999} ; }
  }
\cs_new:Npn \__fp_sub_back_not_far_o:wwwwNN #1 ~ #2; #3 ~ #4; #5#6
  {
    - 1
    \exp_after:wN \__fp_sub_back_near_after:wNNNNw
    \int_value:w \__fp_int_eval:w 1#30 - #1 - 11
      \exp_after:wN \__fp_sub_back_near_pack:NNNNNNw
      \int_value:w \__fp_int_eval:w 11 0000 0000 + #40 - #2
        - \exp_after:wN \__fp_round_neg:NNN
          \exp_after:wN #6
          \use_none:nnnnnnn #2 #5
        \exp_after:wN ;
  }
\cs_new:Npn \__fp_sub_back_very_far_o:wwwwNN #1#2#3#4#5#6#7
  {
    \__fp_pack_eight:wNNNNNNNN
    \__fp_sub_back_very_far_ii_o:nnNwwNN
    { 0 #1#2#3 #4#5#6#7 }
    ;
  }
\cs_new:Npn \__fp_sub_back_very_far_ii_o:nnNwwNN #1#2 ; #3 ; #4 ~ #5; #6#7
  {
    \exp_after:wN \__fp_basics_pack_high:NNNNNw
    \int_value:w \__fp_int_eval:w 1#4 - #1 - 1
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w 2#5 - #2
        - \exp_after:wN \__fp_round_neg:NNN
          \exp_after:wN #7
          \int_value:w
            \if_int_odd:w \__fp_int_eval:w #5 - #2 \__fp_int_eval_end:
              1 \else: 2 \fi:
          \int_value:w \__fp_round_digit:Nw #3 #6 ;
      \exp_after:wN ;
  }
\cs_new:cpn { __fp_*_o:ww }
  {
    \__fp_mul_cases_o:NnNnww
      *
      { - 2 + }
      \__fp_mul_npos_o:Nww
      { }
  }
\cs_new:Npn \__fp_mul_cases_o:NnNnww
    #1#2#3#4 \s__fp \__fp_chk:w #5#6#7; \s__fp \__fp_chk:w #8#9
  {
    \if_case:w \__fp_int_eval:w
                 \if_int_compare:w #5 #8 = 11 ~
                   1
                 \else:
                   \if_meaning:w 3 #8
                     3
                   \else:
                     \if_meaning:w 3 #5
                       2
                     \else:
                       \if_int_compare:w #5 #8 = 10 ~
                         9 #2 - 2
                       \else:
                         (#5 #2 #8) / 2 * 2 + 7
                       \fi:
                     \fi:
                   \fi:
                 \fi:
                 \if_meaning:w #6 #9 - 1 \fi:
               \__fp_int_eval_end:
         \__fp_case_use:nw { #3 0 }
    \or: \__fp_case_use:nw { #3 2 }
    \or: \__fp_case_return_i_o:ww
    \or: \__fp_case_return_ii_o:ww
    \or: \__fp_case_return_o:Nww \c_zero_fp
    \or: \__fp_case_return_o:Nww \c_minus_zero_fp
    \or: \__fp_case_use:nw { \__fp_invalid_operation_o:Nww #1 }
    \or: \__fp_case_use:nw { \__fp_invalid_operation_o:Nww #1 }
    \or: \__fp_case_return_o:Nww \c_inf_fp
    \or: \__fp_case_return_o:Nww \c_minus_inf_fp
    #4
    \fi:
    \s__fp \__fp_chk:w #5 #6 #7;
    \s__fp \__fp_chk:w #8 #9
  }
\cs_new:Npn \__fp_mul_npos_o:Nww
    #1 \s__fp \__fp_chk:w #2 #3 #4 #5 ; \s__fp \__fp_chk:w #6 #7 #8 #9 ;
  {
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w
      #4 + #8
      \__fp_mul_significand_o:nnnnNnnnn #5 #1 #9
  }
\cs_new:Npn \__fp_mul_significand_o:nnnnNnnnn #1#2#3#4 #5 #6#7#8#9
  {
    \exp_after:wN \__fp_mul_significand_test_f:NNN
    \exp_after:wN #5
    \int_value:w \__fp_int_eval:w 99990000 + #1*#6 +
      \exp_after:wN \__fp_mul_significand_keep:NNNNNw
      \int_value:w \__fp_int_eval:w 99990000 + #1*#7 + #2*#6 +
        \exp_after:wN \__fp_mul_significand_keep:NNNNNw
        \int_value:w \__fp_int_eval:w 99990000 + #1*#8 + #2*#7 + #3*#6 +
          \exp_after:wN \__fp_mul_significand_drop:NNNNNw
          \int_value:w \__fp_int_eval:w 99990000 + #1*#9 + #2*#8 +
            #3*#7 + #4*#6 +
            \exp_after:wN \__fp_mul_significand_drop:NNNNNw
            \int_value:w \__fp_int_eval:w 99990000 + #2*#9 + #3*#8 +
              #4*#7 +
              \exp_after:wN \__fp_mul_significand_drop:NNNNNw
              \int_value:w \__fp_int_eval:w 99990000 + #3*#9 + #4*#8 +
                \exp_after:wN \__fp_mul_significand_drop:NNNNNw
                \int_value:w \__fp_int_eval:w 100000000 + #4*#9 ;
    ; \exp_after:wN ;
  }
\cs_new:Npn \__fp_mul_significand_drop:NNNNNw #1#2#3#4#5 #6;
  { #1#2#3#4#5 ; + #6 }
\cs_new:Npn \__fp_mul_significand_keep:NNNNNw #1#2#3#4#5 #6;
  { #1#2#3#4#5 ; #6 ; }
\cs_new:Npn \__fp_mul_significand_test_f:NNN #1 #2 #3
  {
    \if_meaning:w 0 #3
      \exp_after:wN \__fp_mul_significand_small_f:NNwwwN
    \else:
      \exp_after:wN \__fp_mul_significand_large_f:NwwNNNN
    \fi:
    #1 #3
  }
\cs_new:Npn \__fp_mul_significand_large_f:NwwNNNN #1 #2; #3; #4#5#6#7; +
  {
    \exp_after:wN \__fp_basics_pack_high:NNNNNw
    \int_value:w \__fp_int_eval:w 1#2
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w 1#3#4#5#6#7
        + \exp_after:wN \__fp_round:NNN
          \exp_after:wN #1
          \exp_after:wN #7
          \int_value:w \__fp_round_digit:Nw
  }
\cs_new:Npn \__fp_mul_significand_small_f:NNwwwN #1 #2#3; #4#5; #6; + #7
  {
    - 1
    \exp_after:wN \__fp_basics_pack_high:NNNNNw
    \int_value:w \__fp_int_eval:w 1#3#4
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w 1#5#6#7
        + \exp_after:wN \__fp_round:NNN
          \exp_after:wN #1
          \exp_after:wN #7
          \int_value:w \__fp_round_digit:Nw
  }
\cs_new:cpn { __fp_/_o:ww }
  {
    \__fp_mul_cases_o:NnNnww
      /
      { - }
      \__fp_div_npos_o:Nww
      {
        \or:
          \__fp_case_use:nw
            { \__fp_division_by_zero_o:NNww \c_inf_fp / }
        \or:
          \__fp_case_use:nw
            { \__fp_division_by_zero_o:NNww \c_minus_inf_fp / }
      }
  }
\cs_new:Npn \__fp_div_npos_o:Nww
    #1 \s__fp \__fp_chk:w 1 #2 #3 #4 ; \s__fp \__fp_chk:w 1 #5 #6 #7#8#9;
  {
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w
      #3 - #6
      \exp_after:wN \__fp_div_significand_i_o:wnnw
        \int_value:w \__fp_int_eval:w #7 \use_i:nnnn #8 + 1 ;
        #4
        {#7}{#8}#9 ;
        #1
  }
\cs_new:Npn \__fp_div_significand_i_o:wnnw #1 ; #2#3 #4 ;
  {
    \exp_after:wN \__fp_div_significand_test_o:w
    \int_value:w \__fp_int_eval:w
      \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn
      \int_value:w \__fp_int_eval:w 999999 + #2 #3 0 / #1 ;
        #2 #3 ;
        #4
        { \exp_after:wN \__fp_div_significand_ii:wwn \int_value:w #1 }
        { \exp_after:wN \__fp_div_significand_ii:wwn \int_value:w #1 }
        { \exp_after:wN \__fp_div_significand_ii:wwn \int_value:w #1 }
        { \exp_after:wN \__fp_div_significand_iii:wwnnnnn \int_value:w #1 }
  }
\cs_new:Npn \__fp_div_significand_calc:wwnnnnnnn 1#1
  {
    \if_meaning:w 1 #1
      \exp_after:wN \__fp_div_significand_calc_i:wwnnnnnnn
    \else:
      \exp_after:wN \__fp_div_significand_calc_ii:wwnnnnnnn
    \fi:
  }
\cs_new:Npn \__fp_div_significand_calc_i:wwnnnnnnn
  #1; #2;#3#4 #5#6#7#8 #9
  {
    1 1 #1
    #9 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w \c__fp_Bigg_leading_shift_int
      + #2 - #1 * #5 - #5#60
      \exp_after:wN \__fp_pack_Bigg:NNNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_Bigg_middle_shift_int
        + #3 - #1 * #6 - #70
        \exp_after:wN \__fp_pack_Bigg:NNNNNNw
        \int_value:w \__fp_int_eval:w \c__fp_Bigg_middle_shift_int
          + #4 - #1 * #7 - #80
          \exp_after:wN \__fp_pack_Bigg:NNNNNNw
          \int_value:w \__fp_int_eval:w \c__fp_Bigg_trailing_shift_int
            - #1 * #8 ;
    {#5}{#6}{#7}{#8}
  }
\cs_new:Npn \__fp_div_significand_calc_ii:wwnnnnnnn
  #1; #2;#3#4 #5#6#7#8 #9
  {
    1 0 #1
    #9 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w \c__fp_Bigg_leading_shift_int
      + #2 - #1 * #5
      \exp_after:wN \__fp_pack_Bigg:NNNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_Bigg_middle_shift_int
        + #3 - #1 * #6
        \exp_after:wN \__fp_pack_Bigg:NNNNNNw
        \int_value:w \__fp_int_eval:w \c__fp_Bigg_middle_shift_int
          + #4 - #1 * #7
          \exp_after:wN \__fp_pack_Bigg:NNNNNNw
          \int_value:w \__fp_int_eval:w \c__fp_Bigg_trailing_shift_int
            - #1 * #8 ;
    {#5}{#6}{#7}{#8}
  }
\cs_new:Npn \__fp_div_significand_ii:wwn #1; #2;#3
  {
    \exp_after:wN \__fp_div_significand_pack:NNN
    \int_value:w \__fp_int_eval:w
      \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn
      \int_value:w \__fp_int_eval:w 999999 + #2 #3 0 / #1 ; #2 #3 ;
  }
\cs_new:Npn \__fp_div_significand_iii:wwnnnnn #1; #2;#3#4#5 #6#7
  {
    0
    \exp_after:wN \__fp_div_significand_iv:wwnnnnnnn
    \int_value:w \__fp_int_eval:w ( 2 * #2 #3) / #6 #7 ; % <- P
      #2 ; {#3} {#4} {#5}
      {#6} {#7}
  }
\cs_new:Npn \__fp_div_significand_iv:wwnnnnnnn #1; #2;#3#4#5 #6#7#8#9
  {
    + 5 * #1
    \exp_after:wN \__fp_div_significand_vi:Nw
    \int_value:w \__fp_int_eval:w -20 + 2*#2#3 - #1*#6#7 +
      \exp_after:wN \__fp_div_significand_v:NN
      \int_value:w \__fp_int_eval:w 199980 + 2*#4 - #1*#8 +
        \exp_after:wN \__fp_div_significand_v:NN
        \int_value:w \__fp_int_eval:w 200000 + 2*#5 - #1*#9 ;
  }
\cs_new:Npn \__fp_div_significand_v:NN #1#2 { #1#2 \__fp_int_eval_end: + }
\cs_new:Npn \__fp_div_significand_vi:Nw #1#2;
  {
    \if_meaning:w 0 #1
      \if_int_compare:w \__fp_int_eval:w #2 > 0 + 1 \fi:
    \else:
      \if_meaning:w - #1 - \else: + \fi: 1
    \fi:
    ;
  }
\cs_new:Npn \__fp_div_significand_pack:NNN 1 #1 #2 { + #1 #2 ; }
\cs_new:Npn \__fp_div_significand_test_o:w 10 #1
  {
    \if_meaning:w 0 #1
      \exp_after:wN \__fp_div_significand_small_o:wwwNNNNwN
    \else:
      \exp_after:wN \__fp_div_significand_large_o:wwwNNNNwN
    \fi:
    #1
  }
\cs_new:Npn \__fp_div_significand_small_o:wwwNNNNwN
    0 #1; #2; #3; #4#5#6#7#8; #9
  {
    \exp_after:wN \__fp_basics_pack_high:NNNNNw
    \int_value:w \__fp_int_eval:w 1 #1#2
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w 1 #3#4#5#6#7
        + \__fp_round:NNN #9 #7 #8
        \exp_after:wN ;
  }
\cs_new:Npn \__fp_div_significand_large_o:wwwNNNNwN
    #1; #2; #3; #4#5#6#7#8; #9
  {
    + 1
    \exp_after:wN \__fp_basics_pack_weird_high:NNNNNNNNw
    \int_value:w \__fp_int_eval:w 1 #1 #2
      \exp_after:wN \__fp_basics_pack_weird_low:NNNNw
      \int_value:w \__fp_int_eval:w 1 #3 #4 #5 #6 +
        \exp_after:wN \__fp_round:NNN
        \exp_after:wN #9
        \exp_after:wN #6
        \int_value:w \__fp_round_digit:Nw #7 #8 ;
      \exp_after:wN ;
  }
\cs_new:Npn \__fp_sqrt_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_meaning:w 0 #2 \__fp_case_return_same_o:w \fi:
    \if_meaning:w 2 #3
      \__fp_case_use:nw { \__fp_invalid_operation_o:nw { sqrt } }
    \fi:
    \if_meaning:w 1 #2 \else: \__fp_case_return_same_o:w \fi:
    \__fp_sqrt_npos_o:w
    \s__fp \__fp_chk:w #2 #3 #4;
  }
\cs_new:Npn \__fp_sqrt_npos_o:w \s__fp \__fp_chk:w 1 0 #1#2#3#4#5;
  {
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN 0
    \int_value:w \__fp_int_eval:w
      \if_int_odd:w #1 \exp_stop_f:
        \exp_after:wN \__fp_sqrt_npos_auxi_o:wwnnN
      \fi:
      #1 / 2
      \__fp_sqrt_Newton_o:wwn 56234133; 0; {#2#3} {#4#5} 0
  }
\cs_new:Npn \__fp_sqrt_npos_auxi_o:wwnnN #1 / 2 #2; 0; #3#4#5
  {
    ( #1 + 1 ) / 2
    \__fp_pack_eight:wNNNNNNNN
    \__fp_sqrt_npos_auxii_o:wNNNNNNNN
    ;
    0 #3 #4
  }
\cs_new:Npn \__fp_sqrt_npos_auxii_o:wNNNNNNNN #1; #2#3#4#5#6#7#8#9
  { \__fp_sqrt_Newton_o:wwn 17782794; 0; {#1} {#2#3#4#5#6#7#8#9} }
\cs_new:Npn \__fp_sqrt_Newton_o:wwn #1; #2; #3
  {
    \if_int_compare:w #1 = #2 \exp_stop_f:
      \exp_after:wN \__fp_sqrt_auxi_o:NNNNwnnN
      \int_value:w \__fp_int_eval:w 9999 9999 +
        \exp_after:wN \__fp_use_none_until_s:w
    \fi:
    \exp_after:wN \__fp_sqrt_Newton_o:wwn
    \int_value:w \__fp_int_eval:w (#1 + #3 * 1 0000 0000 / #1) / 2 ;
    #1; {#3}
  }
\cs_new:Npn \__fp_sqrt_auxi_o:NNNNwnnN 1 #1#2#3#4#5;
  {
    \__fp_sqrt_auxii_o:NnnnnnnnN
      \__fp_sqrt_auxiii_o:wnnnnnnnn
      {#1#2#3#4} {#5} {2499} {9988} {7500}
  }
\cs_new:Npn \__fp_sqrt_auxii_o:NnnnnnnnN #1 #2#3#4#5#6 #7#8#9
  {
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w \c__fp_big_leading_shift_int
      + #7 - #2 * #2
      \exp_after:wN \__fp_pack_big:NNNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
        - 2 * #2 * #3
        \exp_after:wN \__fp_pack_big:NNNNNNw
        \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
          + #8 - #3 * #3 - 2 * #2 * #4
          \exp_after:wN \__fp_pack_big:NNNNNNw
          \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
            - 2 * #3 * #4 - 2 * #2 * #5
            \exp_after:wN \__fp_pack_big:NNNNNNw
            \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
              + #9 000 0000 - #4 * #4 - 2 * #3 * #5 - 2 * #2 * #6
              \exp_after:wN \__fp_pack_big:NNNNNNw
              \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
                - 2 * #4 * #5 - 2 * #3 * #6
                \exp_after:wN \__fp_pack_big:NNNNNNw
                \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
                  - #5 * #5 - 2 * #4 * #6
                  \exp_after:wN \__fp_pack_big:NNNNNNw
                  \int_value:w \__fp_int_eval:w
                    \c__fp_big_middle_shift_int
                    - 2 * #5 * #6
                    \exp_after:wN \__fp_pack_big:NNNNNNw
                    \int_value:w \__fp_int_eval:w
                      \c__fp_big_trailing_shift_int
                      - #6 * #6 ;
    % (
    - 257 ) * 5000 0000 / (#2#3 + 1) + 10 0000 0000 ;
    {#2}{#3}{#4}{#5}{#6} {#7}{#8}#9
  }
\cs_new:Npn \__fp_sqrt_auxiii_o:wnnnnnnnn
    #1; #2#3#4#5#6#7#8#9
  {
    \if_int_compare:w #1 > 1 \exp_stop_f:
      \exp_after:wN \__fp_sqrt_auxiv_o:NNNNNw
      \int_value:w \__fp_int_eval:w (#1#2 %)
    \else:
      \if_int_compare:w #1#2 > 1 \exp_stop_f:
        \exp_after:wN \__fp_sqrt_auxv_o:NNNNNw
        \int_value:w \__fp_int_eval:w (#1#2#3 %)
      \else:
        \if_int_compare:w #1#2#3 > 1 \exp_stop_f:
          \exp_after:wN \__fp_sqrt_auxvi_o:NNNNNw
          \int_value:w \__fp_int_eval:w (#1#2#3#4 %)
        \else:
          \exp_after:wN \__fp_sqrt_auxvii_o:NNNNNw
          \int_value:w \__fp_int_eval:w (#1#2#3#4#5 %)
        \fi:
      \fi:
    \fi:
  }
\cs_new:Npn \__fp_sqrt_auxiv_o:NNNNNw 1#1#2#3#4#5#6;
  { \__fp_sqrt_auxviii_o:nnnnnnn {#1#2#3#4#5#6} {00000000} }
\cs_new:Npn \__fp_sqrt_auxv_o:NNNNNw 1#1#2#3#4#5#6;
  { \__fp_sqrt_auxviii_o:nnnnnnn {000#1#2#3#4#5} {#60000} }
\cs_new:Npn \__fp_sqrt_auxvi_o:NNNNNw 1#1#2#3#4#5#6;
  { \__fp_sqrt_auxviii_o:nnnnnnn {0000000#1} {#2#3#4#5#6} }
\cs_new:Npn \__fp_sqrt_auxvii_o:NNNNNw 1#1#2#3#4#5#6;
  {
    \if_int_compare:w #1#2 = 0 \exp_stop_f:
      \exp_after:wN \__fp_sqrt_auxx_o:Nnnnnnnn
    \fi:
    \__fp_sqrt_auxviii_o:nnnnnnn {00000000} {000#1#2#3#4#5}
  }
\cs_new:Npn \__fp_sqrt_auxviii_o:nnnnnnn #1#2 #3#4#5#6#7
  {
    \exp_after:wN \__fp_sqrt_auxix_o:wnwnw
    \int_value:w \__fp_int_eval:w #3
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w #1 + 1#4#5
        \exp_after:wN \__fp_basics_pack_low:NNNNNw
        \int_value:w \__fp_int_eval:w #2 + 1#6#7 ;
  }
\cs_new:Npn \__fp_sqrt_auxix_o:wnwnw #1; #2#3; #4#5;
  {
    \__fp_sqrt_auxii_o:NnnnnnnnN
      \__fp_sqrt_auxiii_o:wnnnnnnnn {#1}{#2}{#3}{#4}{#5}
  }
\cs_new:Npn \__fp_sqrt_auxx_o:Nnnnnnnn #1#2#3 #4#5#6#7#8
  {
    \exp_after:wN \__fp_sqrt_auxxi_o:wwnnN
    \int_value:w \__fp_int_eval:w
      (#8 + 2499) / 5000 * 5000 ;
      {#4} {#5} {#6} {#7} ;
  }
\cs_new:Npn \__fp_sqrt_auxxi_o:wwnnN #1; #2; #3#4#5
  {
    \__fp_sqrt_auxii_o:NnnnnnnnN
      \__fp_sqrt_auxxii_o:nnnnnnnnw
      #2 {#1}
      {#3} { #4 + 1 } #5
  }
\cs_new:Npn \__fp_sqrt_auxxii_o:nnnnnnnnw 0; #1#2#3#4#5#6#7#8 #9;
  {
    \if_int_compare:w #1#2 > 0 \exp_stop_f:
      \if_int_compare:w #1#2 = 1 \exp_stop_f:
        \if_int_compare:w #3#4 = 0 \exp_stop_f:
          \if_int_compare:w #5#6 = 0 \exp_stop_f:
            \if_int_compare:w #7#8 = 0 \exp_stop_f:
              \__fp_sqrt_auxxiii_o:w
            \fi:
          \fi:
        \fi:
      \fi:
      \exp_after:wN \__fp_sqrt_auxxiv_o:wnnnnnnnN
      \int_value:w 9998
    \else:
      \exp_after:wN \__fp_sqrt_auxxiv_o:wnnnnnnnN
      \int_value:w 10000
    \fi:
    ;
  }
\cs_new:Npn \__fp_sqrt_auxxiii_o:w \fi: \fi: \fi: \fi: #1 \fi: ;
  {
    \fi: \fi: \fi: \fi: \fi:
    \__fp_sqrt_auxxiv_o:wnnnnnnnN 9999 ;
  }
\cs_new:Npn \__fp_sqrt_auxxiv_o:wnnnnnnnN #1; #2#3#4#5#6 #7#8#9
  {
    \exp_after:wN \__fp_basics_pack_high:NNNNNw
    \int_value:w \__fp_int_eval:w 1 0000 0000 + #2#3
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w 1 0000 0000
        + #4#5
        \if_int_compare:w #6 > #1 \exp_stop_f: + 1 \fi:
        + \exp_after:wN \__fp_round:NNN
          \exp_after:wN 0
          \exp_after:wN 0
          \int_value:w
            \exp_after:wN \use_i:nn
            \exp_after:wN \__fp_round_digit:Nw
            \int_value:w \__fp_int_eval:w #6 + 19999 - #1 ;
    \exp_after:wN ;
  }
\cs_new:Npn \__fp_logb_o:w ? \s__fp \__fp_chk:w #1#2; @
  {
    \if_case:w #1 \exp_stop_f:
           \__fp_case_use:nw
             { \__fp_division_by_zero_o:Nnw \c_minus_inf_fp { logb } }
    \or:   \exp_after:wN \__fp_logb_aux_o:w
    \or:   \__fp_case_return_o:Nw \c_inf_fp
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #1 #2;
  }
\cs_new:Npn \__fp_logb_aux_o:w \s__fp \__fp_chk:w #1 #2 #3 #4 ;
  {
    \exp_after:wN \__fp_parse:n \exp_after:wN
      { \int_value:w \int_eval:w #3 - 1 \exp_after:wN }
  }
\cs_new:Npn \__fp_sign_o:w ? \s__fp \__fp_chk:w #1#2; @
  {
    \if_case:w #1 \exp_stop_f:
           \__fp_case_return_same_o:w
    \or:   \exp_after:wN \__fp_sign_aux_o:w
    \or:   \exp_after:wN \__fp_sign_aux_o:w
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #1 #2;
  }
\cs_new:Npn \__fp_sign_aux_o:w \s__fp \__fp_chk:w #1 #2 #3 ;
  { \exp_after:wN \__fp_set_sign_o:w \exp_after:wN #2 \c_one_fp @ }
\cs_new:Npn \__fp_set_sign_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \exp_after:wN \__fp_exp_after_o:w
    \exp_after:wN \s__fp
    \exp_after:wN \__fp_chk:w
    \exp_after:wN #2
    \int_value:w
      \if_case:w #3 \exp_stop_f: #1 \or: 1 \or: 0 \fi: \exp_stop_f:
    #4;
  }
\cs_new:Npn \__fp_tuple_set_sign_o:w #1
  {
    \if_meaning:w 2 #1
      \exp_after:wN \__fp_tuple_set_sign_aux_o:Nnw
    \fi:
    \__fp_invalid_operation_o:nw { abs }
  }
\cs_new:Npn \__fp_tuple_set_sign_aux_o:Nnw #1#2#3 @
  { \__fp_tuple_map_o:nw \__fp_tuple_set_sign_aux_o:w #3 }
\cs_new:Npn \__fp_tuple_set_sign_aux_o:w #1#2 ;
  {
    \__fp_change_func_type:NNN #1 \__fp_set_sign_o:w
      \__fp_parse_apply_unary_error:NNw
    2 #1 #2 ; @
  }
\cs_new:cpn { __fp_*_tuple_o:ww } #1 ;
  { \__fp_tuple_map_o:nw { \__fp_binary_type_o:Nww * #1 ; } }
\cs_new:cpn { __fp_tuple_*_o:ww } #1 ; #2 ;
  { \__fp_tuple_map_o:nw { \__fp_binary_rev_type_o:Nww * #2 ; } #1 ; }
\cs_new:cpn { __fp_tuple_/_o:ww } #1 ; #2 ;
  { \__fp_tuple_map_o:nw { \__fp_binary_rev_type_o:Nww / #2 ; } #1 ; }
\cs_set_protected:Npn \__fp_tmp:w #1
  {
    \cs_new:cpn { __fp_tuple_#1_tuple_o:ww }
        \s__fp_tuple \__fp_tuple_chk:w ##1 ;
        \s__fp_tuple \__fp_tuple_chk:w ##2 ;
      {
        \int_compare:nNnTF
          { \__fp_array_count:n {##1} } = { \__fp_array_count:n {##2} }
          { \__fp_tuple_mapthread_o:nww { \__fp_binary_type_o:Nww #1 } }
          { \__fp_invalid_operation_o:nww #1 }
        \s__fp_tuple \__fp_tuple_chk:w {##1} ;
        \s__fp_tuple \__fp_tuple_chk:w {##2} ;
      }
  }
\__fp_tmp:w +
\__fp_tmp:w -
%% File: l3fp-extended.dtx
\tl_const:Nn \c__fp_one_fixed_tl
  { {10000} {0000} {0000} {0000} {0000} {0000} ; }
\cs_new:Npn \__fp_fixed_continue:wn #1; #2 { #2 #1; }
\cs_new:Npn \__fp_fixed_add_one:wN #1#2; #3
  {
    \exp_after:wN #3 \exp_after:wN
      { \int_value:w \__fp_int_eval:w \c__fp_myriad_int + #1 } #2 ;
  }
\cs_new:Npn \__fp_fixed_div_myriad:wn #1#2#3#4#5#6;
  {
    \exp_after:wN \__fp_fixed_mul_after:wwn
    \int_value:w \__fp_int_eval:w \c__fp_leading_shift_int
      \exp_after:wN \__fp_pack:NNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_trailing_shift_int
        + #1 ; {#2}{#3}{#4}{#5};
  }
\cs_new:Npn \__fp_fixed_mul_after:wwn #1; #2; #3 { #3 {#1} #2; }
\cs_new:Npn \__fp_fixed_mul_short:wwn #1#2#3#4#5#6; #7#8#9;
  {
    \exp_after:wN \__fp_fixed_mul_after:wwn
    \int_value:w \__fp_int_eval:w \c__fp_leading_shift_int
      + #1*#7
      \exp_after:wN \__fp_pack:NNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
        + #1*#8 + #2*#7
        \exp_after:wN \__fp_pack:NNNNNw
        \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
          + #1*#9 + #2*#8 + #3*#7
          \exp_after:wN \__fp_pack:NNNNNw
          \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
            + #2*#9 + #3*#8 + #4*#7
            \exp_after:wN \__fp_pack:NNNNNw
            \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
              + #3*#9 + #4*#8 + #5*#7
              \exp_after:wN \__fp_pack:NNNNNw
              \int_value:w \__fp_int_eval:w \c__fp_trailing_shift_int
                + #4*#9 + #5*#8 + #6*#7
                + ( #5*#9 + #6*#8 + #6*#9 / \c__fp_myriad_int )
                / \c__fp_myriad_int ; ;
  }
\cs_new:Npn \__fp_fixed_div_int:wwN #1#2#3#4#5#6 ; #7 ; #8
  {
    \exp_after:wN \__fp_fixed_div_int_after:Nw
    \exp_after:wN #8
    \int_value:w \__fp_int_eval:w - 1
      \__fp_fixed_div_int:wnN
      #1; {#7} \__fp_fixed_div_int_auxi:wnn
      #2; {#7} \__fp_fixed_div_int_auxi:wnn
      #3; {#7} \__fp_fixed_div_int_auxi:wnn
      #4; {#7} \__fp_fixed_div_int_auxi:wnn
      #5; {#7} \__fp_fixed_div_int_auxi:wnn
      #6; {#7} \__fp_fixed_div_int_auxii:wnn ;
  }
\cs_new:Npn \__fp_fixed_div_int:wnN #1; #2 #3
  {
    \exp_after:wN #3
    \int_value:w \__fp_int_eval:w #1 / #2 - 1 ;
    {#2}
    {#1}
  }
\cs_new:Npn \__fp_fixed_div_int_auxi:wnn #1; #2 #3
  {
    + #1
    \exp_after:wN \__fp_fixed_div_int_pack:Nw
    \int_value:w \__fp_int_eval:w 9999
      \exp_after:wN \__fp_fixed_div_int:wnN
      \int_value:w \__fp_int_eval:w #3 - #1*#2 \__fp_int_eval_end:
  }
\cs_new:Npn \__fp_fixed_div_int_auxii:wnn #1; #2 #3 { + #1 + 2 ; }
\cs_new:Npn \__fp_fixed_div_int_pack:Nw #1 #2; { + #1; {#2} }
\cs_new:Npn \__fp_fixed_div_int_after:Nw #1 #2; { #1 {#2} }
\cs_new:Npn \__fp_fixed_add:wwn { \__fp_fixed_add:Nnnnnwnn + }
\cs_new:Npn \__fp_fixed_sub:wwn { \__fp_fixed_add:Nnnnnwnn - }
\cs_new:Npn \__fp_fixed_add:Nnnnnwnn #1 #2#3#4#5 #6; #7#8
  {
    \exp_after:wN \__fp_fixed_add_after:NNNNNwn
    \int_value:w \__fp_int_eval:w 9 9999 9998 + #2#3 #1 #7#8
      \exp_after:wN \__fp_fixed_add_pack:NNNNNwn
      \int_value:w \__fp_int_eval:w 1 9999 9998 + #4#5
        \__fp_fixed_add:nnNnnnwn #6 #1
  }
\cs_new:Npn \__fp_fixed_add:nnNnnnwn #1#2 #3 #4#5 #6#7 ; #8
  {
    #3 #4#5
    \exp_after:wN \__fp_fixed_add_pack:NNNNNwn
    \int_value:w \__fp_int_eval:w 2 0000 0000 #3 #6#7 + #1#2 ; {#8} ;
  }
\cs_new:Npn \__fp_fixed_add_pack:NNNNNwn #1 #2#3#4#5 #6; #7
  { + #1 ; {#7} {#2#3#4#5} {#6} }
\cs_new:Npn \__fp_fixed_add_after:NNNNNwn 1 #1 #2#3#4#5 #6; #7
  { #7 {#1#2#3#4#5} {#6} }
\cs_new:Npn \__fp_fixed_mul:wwn #1#2#3#4 #5; #6#7#8#9
  {
    \exp_after:wN \__fp_fixed_mul_after:wwn
    \int_value:w \__fp_int_eval:w \c__fp_leading_shift_int
      \exp_after:wN \__fp_pack:NNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
        + #1*#6
        \exp_after:wN \__fp_pack:NNNNNw
        \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
          + #1*#7 + #2*#6
          \exp_after:wN \__fp_pack:NNNNNw
          \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
            + #1*#8 + #2*#7 + #3*#6
            \exp_after:wN \__fp_pack:NNNNNw
            \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
              + #1*#9 + #2*#8 + #3*#7 + #4*#6
              \exp_after:wN \__fp_pack:NNNNNw
              \int_value:w \__fp_int_eval:w \c__fp_trailing_shift_int
                + #2*#9 + #3*#8 + #4*#7
                + ( #3*#9 + #4*#8
                  + \__fp_fixed_mul:nnnnnnnw #5 {#6}{#7}  {#1}{#2}
  }
\cs_new:Npn \__fp_fixed_mul:nnnnnnnw #1#2 #3#4 #5#6 #7#8 ;
  {
    #1*#4 + #2*#3 + #5*#8 + #6*#7 ) / \c__fp_myriad_int
    + #1*#3 + #5*#7 ; ;
  }
\cs_new:Npn \__fp_fixed_mul_add:wwwn #1; #2; #3#4#5#6#7#8;
  {
    \exp_after:wN \__fp_fixed_mul_after:wwn
    \int_value:w \__fp_int_eval:w \c__fp_big_leading_shift_int
      \exp_after:wN \__fp_pack_big:NNNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int + #3 #4
        \__fp_fixed_mul_add:Nwnnnwnnn +
          + #5 #6 ; #2 ; #1 ; #2 ; +
          + #7 #8 ; ;
  }
\cs_new:Npn \__fp_fixed_mul_sub_back:wwwn #1; #2; #3#4#5#6#7#8;
  {
    \exp_after:wN \__fp_fixed_mul_after:wwn
    \int_value:w \__fp_int_eval:w \c__fp_big_leading_shift_int
      \exp_after:wN \__fp_pack_big:NNNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int + #3 #4
        \__fp_fixed_mul_add:Nwnnnwnnn -
          + #5 #6 ; #2 ; #1 ; #2 ; -
          + #7 #8 ; ;
  }
\cs_new:Npn \__fp_fixed_one_minus_mul:wwn #1; #2;
  {
    \exp_after:wN \__fp_fixed_mul_after:wwn
    \int_value:w \__fp_int_eval:w \c__fp_big_leading_shift_int
      \exp_after:wN \__fp_pack_big:NNNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int +
        1 0000 0000
        \__fp_fixed_mul_add:Nwnnnwnnn -
          ; #2 ; #1 ; #2 ; -
          ; ;
  }
\cs_new:Npn \__fp_fixed_mul_add:Nwnnnwnnn #1 #2; #3#4#5#6; #7#8#9
  {
    #1 #7*#3
    \exp_after:wN \__fp_pack_big:NNNNNNw
    \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
      #1 #7*#4 #1 #8*#3
      \exp_after:wN \__fp_pack_big:NNNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
        #1 #7*#5 #1 #8*#4 #1 #9*#3 #2
        \exp_after:wN \__fp_pack_big:NNNNNNw
        \int_value:w \__fp_int_eval:w \c__fp_big_middle_shift_int
          #1 \__fp_fixed_mul_add:nnnnwnnnn {#7}{#8}{#9}
  }
\cs_new:Npn \__fp_fixed_mul_add:nnnnwnnnn #1#2#3#4#5; #6#7#8#9
  {
    ( #1*#9 + #2*#8 + #3*#7 + #4*#6 )
    \exp_after:wN \__fp_pack_big:NNNNNNw
    \int_value:w \__fp_int_eval:w \c__fp_big_trailing_shift_int
      \__fp_fixed_mul_add:nnnnwnnwN
        { #6 + #4*#7 + #3*#8 + #2*#9 + #1 }
        { #7 + #4*#8 + #3*#9 + #2 }
        {#1} #5;
        {#6}
  }
\cs_new:Npn \__fp_fixed_mul_add:nnnnwnnwN #1#2 #3#4#5; #6#7#8; #9
  {
    #9 (#4* #1 *#7)
    #9 (#5*#6+#4* #2 *#7+#3*#8) / \c__fp_myriad_int
  }
\cs_new:Npn \__fp_ep_to_fixed:wwn #1,#2
  {
    \exp_after:wN \__fp_ep_to_fixed_auxi:www
    \int_value:w \__fp_int_eval:w 1 0000 0000 + #2 \exp_after:wN ;
    \exp:w \exp_end_continue_f:w
    \prg_replicate:nn { 4 - \int_max:nn {#1} { -32 } } { 0 } ;
  }
\cs_new:Npn \__fp_ep_to_fixed_auxi:www 1#1; #2; #3#4#5#6#7;
  {
    \__fp_pack_eight:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_ep_to_fixed_auxii:nnnnnnnwn ;
    #2 #1#3#4#5#6#7 0000 !
  }
\cs_new:Npn \__fp_ep_to_fixed_auxii:nnnnnnnwn #1#2#3#4#5#6#7; #8! #9
  { #9 {#1#2}{#3}{#4}{#5}{#6}{#7}; }
\cs_new:Npn \__fp_ep_to_ep:wwN #1,#2#3#4#5#6#7; #8
  {
    \exp_after:wN #8
    \int_value:w \__fp_int_eval:w #1 + 4
      \exp_after:wN \use_i:nn
      \exp_after:wN \__fp_ep_to_ep_loop:N
      \int_value:w \__fp_int_eval:w 1 0000 0000 + #2 \__fp_int_eval_end:
      #3#4#5#6#7 ; ; !
  }
\cs_new:Npn \__fp_ep_to_ep_loop:N #1
  {
    \if_meaning:w 0 #1
      - 1
    \else:
      \__fp_ep_to_ep_end:www #1
    \fi:
    \__fp_ep_to_ep_loop:N
  }
\cs_new:Npn \__fp_ep_to_ep_end:www
    #1 \fi: \__fp_ep_to_ep_loop:N #2; #3!
  {
    \fi:
    \if_meaning:w ; #1
      - 2 * \c__fp_max_exponent_int
      \__fp_ep_to_ep_zero:ww
    \fi:
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_use_i:ww , ;
    #1 #2 0000 0000 0000 0000 0000 0000 ;
  }
\cs_new:Npn \__fp_ep_to_ep_zero:ww \fi: #1; #2; #3;
  { \fi: , {1000}{0000}{0000}{0000}{0000}{0000} ; }
\cs_new:Npn \__fp_ep_compare:wwww #1,#2#3#4#5#6#7;
  { \__fp_ep_compare_aux:wwww {#1}{#2}{#3}{#4}{#5}; #6#7; }
\cs_new:Npn \__fp_ep_compare_aux:wwww #1;#2;#3,#4#5#6#7#8#9;
  {
    \if_case:w
      \__fp_compare_npos:nwnw #1; {#3}{#4}{#5}{#6}{#7}; \exp_stop_f:
            \if_int_compare:w #2 = #8#9 \exp_stop_f:
              0
            \else:
              \if_int_compare:w #2 < #8#9 - \fi: 1
            \fi:
    \or:    1
    \else: -1
    \fi:
  }
\cs_new:Npn \__fp_ep_mul:wwwwn #1,#2; #3,#4;
  {
    \__fp_ep_to_ep:wwN #3,#4;
    \__fp_fixed_continue:wn
    {
      \__fp_ep_to_ep:wwN #1,#2;
      \__fp_ep_mul_raw:wwwwN
    }
    \__fp_fixed_continue:wn
  }
\cs_new:Npn \__fp_ep_mul_raw:wwwwN #1,#2; #3,#4; #5
  {
    \__fp_fixed_mul:wwn #2; #4;
    { \exp_after:wN #5 \int_value:w \__fp_int_eval:w #1 + #3 , }
  }
\cs_new:Npn \__fp_ep_div:wwwwn #1,#2; #3,#4;
  {
    \__fp_ep_to_ep:wwN #1,#2;
    \__fp_fixed_continue:wn
    {
      \__fp_ep_to_ep:wwN #3,#4;
      \__fp_ep_div_esti:wwwwn
    }
  }
\cs_new:Npn \__fp_ep_div_esti:wwwwn #1,#2#3; #4,
  {
    \exp_after:wN \__fp_ep_div_estii:wwnnwwn
    \int_value:w \__fp_int_eval:w 10 0000 0000 / ( #2 + 1 )
      \exp_after:wN ;
    \int_value:w \__fp_int_eval:w #4 - #1 + 1 ,
    {#2} #3;
  }
\cs_new:Npn \__fp_ep_div_estii:wwnnwwn #1; #2,#3#4#5; #6; #7
  {
    \exp_after:wN \__fp_ep_div_estiii:NNNNNwwwn
    \int_value:w \__fp_int_eval:w 10 0000 0000 - 1750
      + #1 000 + (10 0000 0000 / #3 - #1) * (1000 - #4 / 10) ;
    {#3}{#4}#5; #6; { #7 #2, }
  }
\cs_new:Npn \__fp_ep_div_estiii:NNNNNwwwn 1#1#2#3#4#5#6; #7;
  {
    \__fp_fixed_mul_short:wwn #7; {#1}{#2#3#4#5}{#6};
    \__fp_ep_div_epsi:wnNNNNNn {#1#2#3#4}#5#6
    \__fp_fixed_mul:wwn
  }
\cs_new:Npn \__fp_ep_div_epsi:wnNNNNNn #1#2#3#4#5#6;
  {
    \exp_after:wN \__fp_ep_div_epsii:wwnNNNNNn
    \int_value:w \__fp_int_eval:w 1 9998 - #2
      \exp_after:wN \__fp_ep_div_eps_pack:NNNNNw
      \int_value:w \__fp_int_eval:w 1 9999 9998 - #3#4
        \exp_after:wN \__fp_ep_div_eps_pack:NNNNNw
        \int_value:w \__fp_int_eval:w 2 0000 0000 - #5#6 ; ;
  }
\cs_new:Npn \__fp_ep_div_eps_pack:NNNNNw #1#2#3#4#5#6;
  { + #1 ; {#2#3#4#5} {#6} }
\cs_new:Npn \__fp_ep_div_epsii:wwnNNNNNn 1#1; #2; #3#4#5#6#7#8
  {
    \__fp_fixed_mul:wwn {0000}{#1}#2; {0000}{#1}#2;
    \__fp_fixed_add_one:wN
    \__fp_fixed_mul:wwn {10000} {#1} #2 ;
    {
      \__fp_fixed_mul_short:wwn {0000}{#1}#2; {#3}{#4#5#6#7}{#8000};
      \__fp_fixed_div_myriad:wn
      \__fp_fixed_mul:wwn
    }
    \__fp_fixed_add:wwn {#3}{#4#5#6#7}{#8000}{0000}{0000}{0000};
  }
\cs_new:Npn \__fp_ep_isqrt:wwn #1,#2;
  {
    \__fp_ep_to_ep:wwN #1,#2;
    \__fp_ep_isqrt_auxi:wwn
  }
\cs_new:Npn \__fp_ep_isqrt_auxi:wwn #1,
  {
    \exp_after:wN \__fp_ep_isqrt_auxii:wwnnnwn
    \int_value:w \__fp_int_eval:w
      \int_if_odd:nTF {#1}
        { (1 - #1) / 2 , 535 , { 0 } { } }
        { 1 - #1 / 2 , 168 , { } { 0 } }
  }
\cs_new:Npn \__fp_ep_isqrt_auxii:wwnnnwn #1, #2, #3#4 #5#6; #7
  {
    \__fp_ep_isqrt_esti:wwwnnwn #2, 0, #5, {#3} {#4}
      {#5} #6 ; { #7 #1 , }
  }
\cs_new:Npn \__fp_ep_isqrt_esti:wwwnnwn #1, #2, #3, #4
  {
    \if_int_compare:w #1 = #2 \exp_stop_f:
      \exp_after:wN \__fp_ep_isqrt_estii:wwwnnwn
    \fi:
    \exp_after:wN \__fp_ep_isqrt_esti:wwwnnwn
    \int_value:w \__fp_int_eval:w
      (#1 + 1 0050 0000 #4 / (#1 * #3)) / 2 ,
    #1, #3, {#4}
  }
\cs_new:Npn \__fp_ep_isqrt_estii:wwwnnwn #1, #2, #3, #4#5
  {
    \exp_after:wN \__fp_ep_isqrt_estiii:NNNNNwwwn
    \int_value:w \__fp_int_eval:w 1000 0000 + #2 * #2 #5 * 5
      \exp_after:wN , \int_value:w \__fp_int_eval:w 10000 + #2 ;
  }
\cs_new:Npn \__fp_ep_isqrt_estiii:NNNNNwwwn 1#1#2#3#4#5#6, 1#7#8; #9;
  {
    \__fp_fixed_mul_short:wwn #9; {#1} {#2#3#4#5} {#600} ;
    \__fp_ep_isqrt_epsi:wN
    \__fp_fixed_mul_short:wwn {#7} {#80} {0000} ;
  }
\cs_new:Npn \__fp_ep_isqrt_epsi:wN #1;
  {
    \__fp_fixed_sub:wwn {15000}{0000}{0000}{0000}{0000}{0000}; #1;
    \__fp_ep_isqrt_epsii:wwN #1;
    \__fp_ep_isqrt_epsii:wwN #1;
    \__fp_ep_isqrt_epsii:wwN #1;
  }
\cs_new:Npn \__fp_ep_isqrt_epsii:wwN #1; #2;
  {
    \__fp_fixed_mul:wwn #1; #1;
    \__fp_fixed_mul_sub_back:wwwn #2;
      {15000}{0000}{0000}{0000}{0000}{0000};
    \__fp_fixed_mul:wwn #1;
  }
\cs_new:Npn \__fp_ep_to_float_o:wwN #1,
  { + \__fp_int_eval:w #1 \__fp_fixed_to_float_o:wN }
\cs_new:Npn \__fp_ep_inv_to_float_o:wwN #1,#2;
  {
    \__fp_ep_div:wwwwn 1,{1000}{0000}{0000}{0000}{0000}{0000}; #1,#2;
    \__fp_ep_to_float_o:wwN
  }
\cs_new:Npn \__fp_fixed_inv_to_float_o:wN
  { \__fp_ep_inv_to_float_o:wwN 0, }
\cs_new:Npn \__fp_fixed_to_float_rad_o:wN #1;
  {
    \__fp_fixed_mul:wwn #1; {5729}{5779}{5130}{8232}{0876}{7981};
    { \__fp_ep_to_float_o:wwN 2, }
  }
\cs_new:Npn \__fp_fixed_to_float_o:Nw #1#2;
  { \__fp_fixed_to_float_o:wN #2; #1 }
\cs_new:Npn \__fp_fixed_to_float_o:wN #1#2#3#4#5#6; #7
  { % for the 8-digit-at-the-start thing
    + \__fp_int_eval:w \c__fp_block_int
    \exp_after:wN \exp_after:wN
    \exp_after:wN \__fp_fixed_to_loop:N
    \exp_after:wN \use_none:n
    \int_value:w \__fp_int_eval:w
      1 0000 0000 + #1   \exp_after:wN \__fp_use_none_stop_f:n
      \int_value:w   1#2 \exp_after:wN \__fp_use_none_stop_f:n
      \int_value:w 1#3#4 \exp_after:wN \__fp_use_none_stop_f:n
      \int_value:w 1#5#6
    \exp_after:wN ;
    \exp_after:wN ;
  }
\cs_new:Npn \__fp_fixed_to_loop:N #1
  {
    \if_meaning:w 0 #1
      - 1
      \exp_after:wN \__fp_fixed_to_loop:N
    \else:
      \exp_after:wN \__fp_fixed_to_loop_end:w
      \exp_after:wN #1
    \fi:
  }
\cs_new:Npn \__fp_fixed_to_loop_end:w #1 #2 ;
  {
    \if_meaning:w ; #1
      \exp_after:wN \__fp_fixed_to_float_zero:w
    \else:
      \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
      \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
      \exp_after:wN \__fp_fixed_to_float_pack:ww
      \exp_after:wN ;
    \fi:
    #1 #2 0000 0000 0000 0000 ;
  }
\cs_new:Npn \__fp_fixed_to_float_zero:w ; 0000 0000 0000 0000 ;
  {
    - 2 * \c__fp_max_exponent_int ;
    {0000} {0000} {0000} {0000} ;
  }
\cs_new:Npn \__fp_fixed_to_float_pack:ww #1 ; #2#3 ; ;
  {
    \if_int_compare:w #2 > 4 \exp_stop_f:
      \exp_after:wN \__fp_fixed_to_float_round_up:wnnnnw
    \fi:
    ; #1 ;
  }
\cs_new:Npn \__fp_fixed_to_float_round_up:wnnnnw ; #1#2#3#4 ;
  {
    \exp_after:wN \__fp_basics_pack_high:NNNNNw
    \int_value:w \__fp_int_eval:w 1 #1#2
      \exp_after:wN \__fp_basics_pack_low:NNNNNw
      \int_value:w \__fp_int_eval:w 1 #3#4 + 1 ;
  }
%% File: l3fp-expo.dtx
\cs_new:Npn \__fp_parse_word_exp:N
  { \__fp_parse_unary_function:NNN \__fp_exp_o:w ? }
\cs_new:Npn \__fp_parse_word_ln:N
  { \__fp_parse_unary_function:NNN \__fp_ln_o:w ? }
\cs_new:Npn \__fp_parse_word_fact:N
  { \__fp_parse_unary_function:NNN \__fp_fact_o:w ? }
\tl_const:Nn \c__fp_ln_i_fixed_tl   { {0000}{0000}{0000}{0000}{0000}{0000};}
\tl_const:Nn \c__fp_ln_ii_fixed_tl  { {6931}{4718}{0559}{9453}{0941}{7232};}
\tl_const:Nn \c__fp_ln_iii_fixed_tl {{10986}{1228}{8668}{1096}{9139}{5245};}
\tl_const:Nn \c__fp_ln_iv_fixed_tl  {{13862}{9436}{1119}{8906}{1883}{4464};}
\tl_const:Nn \c__fp_ln_vi_fixed_tl  {{17917}{5946}{9228}{0550}{0081}{2477};}
\tl_const:Nn \c__fp_ln_vii_fixed_tl {{19459}{1014}{9055}{3133}{0510}{5353};}
\tl_const:Nn \c__fp_ln_viii_fixed_tl{{20794}{4154}{1679}{8359}{2825}{1696};}
\tl_const:Nn \c__fp_ln_ix_fixed_tl  {{21972}{2457}{7336}{2193}{8279}{0490};}
\tl_const:Nn \c__fp_ln_x_fixed_tl   {{23025}{8509}{2994}{0456}{8401}{7991};}
\cs_new:Npn \__fp_ln_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_meaning:w 2 #3
      \__fp_case_use:nw { \__fp_invalid_operation_o:nw { ln } }
    \fi:
    \if_case:w #2 \exp_stop_f:
      \__fp_case_use:nw
        { \__fp_division_by_zero_o:Nnw \c_minus_inf_fp { ln } }
    \or:
    \else:
      \__fp_case_return_same_o:w
    \fi:
    \__fp_ln_npos_o:w \s__fp \__fp_chk:w #2#3#4;
  }
\cs_new:Npn \__fp_ln_npos_o:w \s__fp \__fp_chk:w 10#1#2#3;
  { %^^A todo: ln(1) should be "exact zero", not "underflow"
    \exp_after:wN \__fp_sanitize:Nw
    \int_value:w % for the overall sign
      \if_int_compare:w #1 < 1 \exp_stop_f:
        2
      \else:
        0
      \fi:
      \exp_after:wN \exp_stop_f:
      \int_value:w \__fp_int_eval:w % for the exponent
        \__fp_ln_significand:NNNNnnnN #2#3
        \__fp_ln_exponent:wn {#1}
  }
\cs_new:Npn \__fp_ln_significand:NNNNnnnN #1#2#3#4
  {
    \exp_after:wN \__fp_ln_x_ii:wnnnn
    \int_value:w
      \if_case:w #1 \exp_stop_f:
      \or:
        \if_int_compare:w #2 < 4 \exp_stop_f:
          \__fp_int_eval:w 10 - #2
        \else:
          6
        \fi:
      \or: 4
      \or: 3
      \or: 2
      \or: 2
      \or: 2
      \else: 1
      \fi:
    ; { #1 #2 #3 #4 }
  }
\cs_new:Npn \__fp_ln_x_ii:wnnnn #1; #2#3#4#5
  {
    \exp_after:wN \__fp_ln_div_after:Nw
    \cs:w c__fp_ln_ \__fp_int_to_roman:w #1 _fixed_tl \exp_after:wN \cs_end:
    \int_value:w
      \exp_after:wN \__fp_ln_x_iv:wnnnnnnnn
      \int_value:w \__fp_int_eval:w
        \exp_after:wN \__fp_ln_x_iii_var:NNNNNw
        \int_value:w \__fp_int_eval:w 9999 9990 + #1*#2#3 +
          \exp_after:wN \__fp_ln_x_iii:NNNNNNw
          \int_value:w \__fp_int_eval:w 10 0000 0000 + #1*#4#5 ;
    {20000} {0000} {0000} {0000}
  } %^^A todo: reoptimize (a generalization attempt failed).
\cs_new:Npn \__fp_ln_x_iii:NNNNNNw #1#2 #3#4#5#6 #7;
  { #1#2; {#3#4#5#6} {#7} }
\cs_new:Npn \__fp_ln_x_iii_var:NNNNNw #1 #2#3#4#5 #6;
  {
    #1#2#3#4#5 + 1 ;
    {#1#2#3#4#5} {#6}
  }
\cs_new:Npn \__fp_ln_x_iv:wnnnnnnnn #1; #2#3#4#5 #6#7#8#9
  {
    \exp_after:wN \__fp_div_significand_pack:NNN
    \int_value:w \__fp_int_eval:w
    \__fp_ln_div_i:w #1 ;
      #6 #7 ; {#8} {#9}
      {#2} {#3} {#4} {#5}
      { \exp_after:wN \__fp_ln_div_ii:wwn \int_value:w #1 }
      { \exp_after:wN \__fp_ln_div_ii:wwn \int_value:w #1 }
      { \exp_after:wN \__fp_ln_div_ii:wwn \int_value:w #1 }
      { \exp_after:wN \__fp_ln_div_ii:wwn \int_value:w #1 }
      { \exp_after:wN \__fp_ln_div_vi:wwn \int_value:w #1 }
  }
\cs_new:Npn \__fp_ln_div_i:w #1;
  {
    \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn
    \int_value:w \__fp_int_eval:w 999999 + 2 0000 0000 / #1 ; % Q1
  }
\cs_new:Npn \__fp_ln_div_ii:wwn #1; #2;#3 % y; B1;B2 <- for k=1
  {
    \exp_after:wN \__fp_div_significand_pack:NNN
    \int_value:w \__fp_int_eval:w
      \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn
      \int_value:w \__fp_int_eval:w 999999 + #2 #3 / #1 ; % Q2
      #2 #3 ;
  }
\cs_new:Npn \__fp_ln_div_vi:wwn #1; #2;#3#4#5 #6#7#8#9 %y;F1;F2F3F4x1x2x3x4
  {
    \exp_after:wN \__fp_div_significand_pack:NNN
    \int_value:w \__fp_int_eval:w 1000000 + #2 #3 / #1 ; % Q6
  }
\cs_new:Npn \__fp_ln_div_after:Nw #1#2;
  {
    \if_meaning:w 0 #2
      \exp_after:wN \__fp_ln_t_small:Nw
    \else:
      \exp_after:wN \__fp_ln_t_large:NNw
      \exp_after:wN -
    \fi:
    #1
  }
\cs_new:Npn \__fp_ln_t_small:Nw #1 #2; #3; #4; #5; #6; #7;
  {
    \exp_after:wN \__fp_ln_t_large:NNw
    \exp_after:wN + % <sign>
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w 9999 - #2 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w 9999 - #3 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w 9999 - #4 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w 9999 - #5 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w 9999 - #6 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w 1 0000 - #7 ;
  }
\cs_new:Npn \__fp_ln_t_large:NNw #1 #2 #3; #4; #5; #6; #7; #8;
  {
    \exp_after:wN \__fp_ln_square_t_after:w
    \int_value:w \__fp_int_eval:w 9999 0000 + #3*#3
      \exp_after:wN \__fp_ln_square_t_pack:NNNNNw
      \int_value:w \__fp_int_eval:w 9999 0000 + 2*#3*#4
        \exp_after:wN \__fp_ln_square_t_pack:NNNNNw
        \int_value:w \__fp_int_eval:w 9999 0000 + 2*#3*#5 + #4*#4
          \exp_after:wN \__fp_ln_square_t_pack:NNNNNw
          \int_value:w \__fp_int_eval:w 9999 0000 + 2*#3*#6 + 2*#4*#5
            \exp_after:wN \__fp_ln_square_t_pack:NNNNNw
            \int_value:w \__fp_int_eval:w
              1 0000 0000 + 2*#3*#7 + 2*#4*#6 + #5*#5
              + (2*#3*#8 + 2*#4*#7 + 2*#5*#6) / 1 0000
              % ; ; ;
    \exp_after:wN \__fp_ln_twice_t_after:w
    \int_value:w \__fp_int_eval:w -1 + 2*#3
      \exp_after:wN \__fp_ln_twice_t_pack:Nw
      \int_value:w \__fp_int_eval:w 9999 + 2*#4
        \exp_after:wN \__fp_ln_twice_t_pack:Nw
        \int_value:w \__fp_int_eval:w 9999 + 2*#5
          \exp_after:wN \__fp_ln_twice_t_pack:Nw
          \int_value:w \__fp_int_eval:w 9999 + 2*#6
            \exp_after:wN \__fp_ln_twice_t_pack:Nw
            \int_value:w \__fp_int_eval:w 9999 + 2*#7
              \exp_after:wN \__fp_ln_twice_t_pack:Nw
              \int_value:w \__fp_int_eval:w 10000 + 2*#8 ; ;
    { \__fp_ln_c:NwNw #1 }
    #2
  }
\cs_new:Npn \__fp_ln_twice_t_pack:Nw #1 #2; { + #1 ; {#2} }
\cs_new:Npn \__fp_ln_twice_t_after:w #1; { ;;; {#1} }
\cs_new:Npn \__fp_ln_square_t_pack:NNNNNw #1 #2#3#4#5 #6;
  { + #1#2#3#4#5 ; {#6} }
\cs_new:Npn \__fp_ln_square_t_after:w 1 0 #1#2#3 #4;
  { \__fp_ln_Taylor:wwNw {0#1#2#3} {#4} }
\cs_new:Npn \__fp_ln_Taylor:wwNw
  { \__fp_ln_Taylor_loop:www 21 ; {0000}{0000}{0000}{0000}{0000}{0000} ; }
\cs_new:Npn \__fp_ln_Taylor_loop:www #1; #2; #3;
  {
    \if_int_compare:w #1 = 1 \exp_stop_f:
      \__fp_ln_Taylor_break:w
    \fi:
    \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl #1;
    \__fp_fixed_add:wwn #2;
    \__fp_fixed_mul:wwn #3;
    {
      \exp_after:wN \__fp_ln_Taylor_loop:www
      \int_value:w \__fp_int_eval:w #1 - 2 ;
    }
    #3;
  }
\cs_new:Npn \__fp_ln_Taylor_break:w \fi: #1 \__fp_fixed_add:wwn #2#3; #4 ;;
  {
    \fi:
    \exp_after:wN \__fp_fixed_mul:wwn
    \exp_after:wN { \int_value:w \__fp_int_eval:w 10000 + #2 } #3;
  }
\cs_new:Npn \__fp_ln_c:NwNw #1 #2; #3
  {
    \if_meaning:w + #1
      \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_sub:wwn
    \else:
      \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_add:wwn
    \fi:
    #3 #2 ;
  }
\cs_new:Npn \__fp_ln_exponent:wn #1; #2
  {
    \if_case:w #2 \exp_stop_f:
      0 \__fp_case_return:nw { \__fp_fixed_to_float_o:Nw 2 }
    \or:
      \exp_after:wN \__fp_ln_exponent_one:ww \int_value:w
    \else:
      \if_int_compare:w #2 > 0 \exp_stop_f:
        \exp_after:wN \__fp_ln_exponent_small:NNww
        \exp_after:wN 0
        \exp_after:wN \__fp_fixed_sub:wwn \int_value:w
      \else:
        \exp_after:wN \__fp_ln_exponent_small:NNww
        \exp_after:wN 2
        \exp_after:wN \__fp_fixed_add:wwn \int_value:w -
      \fi:
    \fi:
    #2; #1;
  }
\cs_new:Npn \__fp_ln_exponent_one:ww 1; #1;
  {
    0
    \exp_after:wN \__fp_fixed_sub:wwn \c__fp_ln_x_fixed_tl #1;
    \__fp_fixed_to_float_o:wN 0
  }
\cs_new:Npn \__fp_ln_exponent_small:NNww #1#2#3; #4#5#6#7#8#9;
  {
    4
    \exp_after:wN \__fp_fixed_mul:wwn
      \c__fp_ln_x_fixed_tl
      {#3}{0000}{0000}{0000}{0000}{0000} ;
    #2
      {0000}{#4}{#5}{#6}{#7}{#8};
    \__fp_fixed_to_float_o:wN #1
  }
\cs_new:Npn \__fp_exp_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_case:w #2 \exp_stop_f:
      \__fp_case_return_o:Nw \c_one_fp
    \or:
      \exp_after:wN \__fp_exp_normal_o:w
    \or:
      \if_meaning:w 0 #3
        \exp_after:wN \__fp_case_return_o:Nw
        \exp_after:wN \c_inf_fp
      \else:
        \exp_after:wN \__fp_case_return_o:Nw
        \exp_after:wN \c_zero_fp
      \fi:
    \or:
      \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2#3#4;
  }
\cs_new:Npn \__fp_exp_normal_o:w \s__fp \__fp_chk:w 1#1
  {
    \if_meaning:w 0 #1
      \__fp_exp_pos_o:NNwnw + \__fp_fixed_to_float_o:wN
    \else:
      \__fp_exp_pos_o:NNwnw - \__fp_fixed_inv_to_float_o:wN
    \fi:
  }
\cs_new:Npn \__fp_exp_pos_o:NNwnw #1#2#3 \fi: #4#5;
  {
    \fi:
    \if_int_compare:w #4 > \c__fp_max_exp_exponent_int
      \token_if_eq_charcode:NNTF + #1
        { \__fp_exp_overflow:NN \__fp_overflow:w \c_inf_fp }
        { \__fp_exp_overflow:NN \__fp_underflow:w \c_zero_fp }
      \exp:w
    \else:
      \exp_after:wN \__fp_sanitize:Nw
      \exp_after:wN 0
      \int_value:w #1 \__fp_int_eval:w
        \if_int_compare:w #4 < 0 \exp_stop_f:
          \exp_after:wN \use_i:nn
        \else:
          \exp_after:wN \use_ii:nn
        \fi:
        {
          0
          \__fp_decimate:nNnnnn { - #4 }
            \__fp_exp_Taylor:Nnnwn
        }
        {
          \__fp_decimate:nNnnnn { \c__fp_prec_int - #4 }
            \__fp_exp_pos_large:NnnNwn
        }
        #5
        {#4}
        #1 #2 0
        \exp:w
    \fi:
    \exp_after:wN \exp_end:
  }
\cs_new:Npn \__fp_exp_overflow:NN #1#2
  {
    \exp_after:wN \exp_after:wN
    \exp_after:wN #1
    \exp_after:wN #2
  }
\cs_new:Npn \__fp_exp_Taylor:Nnnwn #1#2#3 #4; #5 #6
  {
    #6
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN
    \__fp_exp_Taylor_ii:ww
    ; #2#3#4 0000 0000 ;
  }
\cs_new:Npn \__fp_exp_Taylor_ii:ww #1; #2;
  { \__fp_exp_Taylor_loop:www 10 ; #1 ; #1 ; \s__fp_stop }
\cs_new:Npn \__fp_exp_Taylor_loop:www #1; #2; #3;
  {
    \if_int_compare:w #1 = 1 \exp_stop_f:
      \exp_after:wN \__fp_exp_Taylor_break:Nww
    \fi:
    \__fp_fixed_div_int:wwN #3 ; #1 ;
    \__fp_fixed_add_one:wN
    \__fp_fixed_mul:wwn #2 ;
    {
      \exp_after:wN \__fp_exp_Taylor_loop:www
      \int_value:w \__fp_int_eval:w #1 - 1 ;
      #2 ;
    }
  }
\cs_new:Npn \__fp_exp_Taylor_break:Nww #1 #2; #3 \s__fp_stop
  { \__fp_fixed_add_one:wN #2 ; }
\intarray_const_from_clist:Nn \c__fp_exp_intarray
  {
         1 , 1 1105 1709 , 1 1807 5647 , 1 6248 1171 ,
         1 , 1 1221 4027 , 1 5816 0169 , 1 8339 2107 ,
         1 , 1 1349 8588 , 1 0757 6003 , 1 1039 8374 ,
         1 , 1 1491 8246 , 1 9764 1270 , 1 3178 2485 ,
         1 , 1 1648 7212 , 1 7070 0128 , 1 1468 4865 ,
         1 , 1 1822 1188 , 1 0039 0508 , 1 9748 7537 ,
         1 , 1 2013 7527 , 1 0747 0476 , 1 5216 2455 ,
         1 , 1 2225 5409 , 1 2849 2467 , 1 6045 7954 ,
         1 , 1 2459 6031 , 1 1115 6949 , 1 6638 0013 ,
         1 , 1 2718 2818 , 1 2845 9045 , 1 2353 6029 ,
         1 , 1 7389 0560 , 1 9893 0650 , 1 2272 3043 ,
         2 , 1 2008 5536 , 1 9231 8766 , 1 7740 9285 ,
         2 , 1 5459 8150 , 1 0331 4423 , 1 9078 1103 ,
         3 , 1 1484 1315 , 1 9102 5766 , 1 0342 1116 ,
         3 , 1 4034 2879 , 1 3492 7351 , 1 2260 8387 ,
         4 , 1 1096 6331 , 1 5842 8458 , 1 5992 6372 ,
         4 , 1 2980 9579 , 1 8704 1728 , 1 2747 4359 ,
         4 , 1 8103 0839 , 1 2757 5384 , 1 0077 1000 ,
         5 , 1 2202 6465 , 1 7948 0671 , 1 6516 9579 ,
         9 , 1 4851 6519 , 1 5409 7902 , 1 7796 9107 ,
        14 , 1 1068 6474 , 1 5815 2446 , 1 2146 9905 ,
        18 , 1 2353 8526 , 1 6837 0199 , 1 8540 7900 ,
        22 , 1 5184 7055 , 1 2858 7072 , 1 4640 8745 ,
        27 , 1 1142 0073 , 1 8981 5684 , 1 2836 6296 ,
        31 , 1 2515 4386 , 1 7091 9167 , 1 0062 6578 ,
        35 , 1 5540 6223 , 1 8439 3510 , 1 0525 7117 ,
        40 , 1 1220 4032 , 1 9431 7840 , 1 8020 0271 ,
        44 , 1 2688 1171 , 1 4181 6135 , 1 4484 1263 ,
        87 , 1 7225 9737 , 1 6812 5749 , 1 2581 7748 ,
       131 , 1 1942 4263 , 1 9524 1255 , 1 9365 8421 ,
       174 , 1 5221 4696 , 1 8976 4143 , 1 9505 8876 ,
       218 , 1 1403 5922 , 1 1785 2837 , 1 4107 3977 ,
       261 , 1 3773 0203 , 1 0092 9939 , 1 8234 0143 ,
       305 , 1 1014 2320 , 1 5473 5004 , 1 5094 5533 ,
       348 , 1 2726 3745 , 1 7211 2566 , 1 5673 6478 ,
       391 , 1 7328 8142 , 1 2230 7421 , 1 7051 8866 ,
       435 , 1 1970 0711 , 1 1401 7046 , 1 9938 8888 ,
       869 , 1 3881 1801 , 1 9428 4368 , 1 5764 8232 ,
      1303 , 1 7646 2009 , 1 8905 4704 , 1 8893 1073 ,
      1738 , 1 1506 3559 , 1 7005 0524 , 1 9009 7592 ,
      2172 , 1 2967 6283 , 1 8402 3667 , 1 0689 6630 ,
      2606 , 1 5846 4389 , 1 5650 2114 , 1 7278 5046 ,
      3041 , 1 1151 7900 , 1 5080 6878 , 1 2914 4154 ,
      3475 , 1 2269 1083 , 1 0850 6857 , 1 8724 4002 ,
      3909 , 1 4470 3047 , 1 3316 5442 , 1 6408 6591 ,
      4343 , 1 8806 8182 , 1 2566 2921 , 1 5872 6150 ,
      8686 , 1 7756 0047 , 1 2598 6861 , 1 0458 3204 ,
     13029 , 1 6830 5723 , 1 7791 4884 , 1 1932 7351 ,
     17372 , 1 6015 5609 , 1 3095 3052 , 1 3494 7574 ,
     21715 , 1 5297 7951 , 1 6443 0315 , 1 3251 3576 ,
     26058 , 1 4665 6719 , 1 0099 3379 , 1 5527 2929 ,
     30401 , 1 4108 9724 , 1 3326 3186 , 1 5271 5665 ,
     34744 , 1 3618 6973 , 1 3140 0875 , 1 3856 4102 ,
     39087 , 1 3186 9209 , 1 6113 3900 , 1 6705 9685 ,
  }
\cs_new:Npn \__fp_exp_pos_large:NnnNwn #1#2#3 #4#5; #6
  {
    \exp_after:wN \exp_after:wN \exp_after:wN \__fp_exp_large:NwN
    \exp_after:wN \exp_after:wN \exp_after:wN #6
    \exp_after:wN \c__fp_one_fixed_tl
    \int_value:w #3 #4 \exp_stop_f:
    #5 00000 ;
  }
\cs_new:Npn \__fp_exp_large:NwN #1#2; #3
  {
    \if_case:w #3 ~
      \exp_after:wN \__fp_fixed_continue:wn
    \else:
      \exp_after:wN \__fp_exp_intarray:w
      \int_value:w \__fp_int_eval:w 36 * #1 + 4 * #3 \exp_after:wN ;
    \fi:
    #2;
    {
      \if_meaning:w 0 #1
        \exp_after:wN \__fp_exp_large_after:wwn
      \else:
        \exp_after:wN \__fp_exp_large:NwN
        \int_value:w \__fp_int_eval:w #1 - 1 \exp_after:wN \scan_stop:
      \fi:
    }
  }
\cs_new:Npn \__fp_exp_intarray:w #1 ;
  {
    +
    \__kernel_intarray_item:Nn \c__fp_exp_intarray
      { \__fp_int_eval:w #1 - 3 \scan_stop: }
    \exp_after:wN \use_i:nnn
    \exp_after:wN \__fp_fixed_mul:wwn
    \int_value:w 0
    \exp_after:wN \__fp_exp_intarray_aux:w
    \int_value:w \__kernel_intarray_item:Nn
                   \c__fp_exp_intarray { \__fp_int_eval:w #1 - 2 }
    \exp_after:wN \__fp_exp_intarray_aux:w
    \int_value:w \__kernel_intarray_item:Nn
                   \c__fp_exp_intarray { \__fp_int_eval:w #1 - 1 }
    \exp_after:wN \__fp_exp_intarray_aux:w
    \int_value:w \__kernel_intarray_item:Nn \c__fp_exp_intarray {#1} ; ;
  }
\cs_new:Npn \__fp_exp_intarray_aux:w 1 #1#2#3#4#5 ; { ; {#1#2#3#4} {#5} }
\cs_new:Npn \__fp_exp_large_after:wwn #1; #2; #3
  {
    \__fp_exp_Taylor:Nnnwn ? { } { } 0 #2; {} #3
    \__fp_fixed_mul:wwn #1;
  }
\cs_new:cpn { __fp_ \iow_char:N \^ _o:ww }
    \s__fp \__fp_chk:w #1#2#3; \s__fp \__fp_chk:w #4#5#6;
  {
    \if_meaning:w 0 #4
      \__fp_case_return_o:Nw \c_one_fp
    \fi:
    \if_case:w #2 \exp_stop_f:
      \exp_after:wN \use_i:nn
    \or:
      \__fp_case_return_o:Nw \c_nan_fp
    \else:
      \exp_after:wN \__fp_pow_neg:www
      \exp:w \exp_end_continue_f:w \exp_after:wN \use:nn
    \fi:
    {
      \if_meaning:w 1 #1
        \exp_after:wN \__fp_pow_normal_o:ww
      \else:
        \exp_after:wN \__fp_pow_zero_or_inf:ww
      \fi:
      \s__fp \__fp_chk:w #1#2#3;
    }
    { \s__fp \__fp_chk:w #4#5#6; \s__fp \__fp_chk:w #1#2#3; }
    \s__fp \__fp_chk:w #4#5#6;
  }
\cs_new:Npn \__fp_pow_zero_or_inf:ww
    \s__fp \__fp_chk:w #1#2; \s__fp \__fp_chk:w #3#4
  {
    \if_meaning:w 1 #4
      \__fp_case_return_same_o:w
    \fi:
    \if_meaning:w #1 #4
      \__fp_case_return_o:Nw \c_zero_fp
    \fi:
    \if_meaning:w 2 #1
      \__fp_case_return_o:Nw \c_inf_fp
    \fi:
    \if_meaning:w 2 #3
      \__fp_case_return_o:Nw \c_inf_fp
    \else:
      \__fp_case_use:nw
        {
          \__fp_division_by_zero_o:NNww \c_inf_fp ^
            \s__fp \__fp_chk:w #1 #2 ;
        }
    \fi:
    \s__fp \__fp_chk:w #3#4
  }
\cs_new:Npn \__fp_pow_normal_o:ww
    \s__fp \__fp_chk:w 1 #1#2#3; \s__fp \__fp_chk:w #4#5
  {
    \if_int_compare:w \__fp_str_if_eq:nn { #2 #3 }
              { 1 {1000} {0000} {0000} {0000} } = 0 \exp_stop_f:
      \if_int_compare:w #4 #1 = 32 \exp_stop_f:
        \exp_after:wN \__fp_case_return_ii_o:ww
      \fi:
      \__fp_case_return_o:Nww \c_one_fp
    \fi:
    \if_case:w #4 \exp_stop_f:
    \or:
      \exp_after:wN \__fp_pow_npos_o:Nww
      \exp_after:wN #5
    \or:
      \if_meaning:w 2 #5 \exp_after:wN \reverse_if:N \fi:
      \if_int_compare:w #2 > 0 \exp_stop_f:
        \exp_after:wN \__fp_case_return_o:Nww
        \exp_after:wN \c_inf_fp
      \else:
        \exp_after:wN \__fp_case_return_o:Nww
        \exp_after:wN \c_zero_fp
      \fi:
    \or:
      \__fp_case_return_ii_o:ww
    \fi:
    \s__fp \__fp_chk:w 1 #1 {#2} #3 ;
    \s__fp \__fp_chk:w #4 #5
  }
\cs_new:Npn \__fp_pow_npos_o:Nww #1 \s__fp \__fp_chk:w 1#2#3
  {
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN 0
    \int_value:w
      \if:w #1 \if_int_compare:w #3 > 0 \exp_stop_f: 0 \else: 2 \fi:
        \exp_after:wN \__fp_pow_npos_aux:NNnww
        \exp_after:wN +
        \exp_after:wN \__fp_fixed_to_float_o:wN
      \else:
        \exp_after:wN \__fp_pow_npos_aux:NNnww
        \exp_after:wN -
        \exp_after:wN \__fp_fixed_inv_to_float_o:wN
      \fi:
      {#3}
  }
\cs_new:Npn \__fp_pow_npos_aux:NNnww #1#2#3#4#5; \s__fp \__fp_chk:w 1#6#7#8;
  {
    #1
    \__fp_int_eval:w
      \__fp_ln_significand:NNNNnnnN #4#5
      \__fp_pow_exponent:wnN {#3}
      \__fp_fixed_mul:wwn #8 {0000}{0000} ;
      \__fp_pow_B:wwN #7;
      #1 #2 0 % fixed_to_float_o:wN
  }
\cs_new:Npn \__fp_pow_exponent:wnN #1; #2
  {
    \if_int_compare:w #2 > 0 \exp_stop_f:
      \exp_after:wN \__fp_pow_exponent:Nwnnnnnw % n\ln(10) - (-\ln(x))
      \exp_after:wN +
    \else:
      \exp_after:wN \__fp_pow_exponent:Nwnnnnnw % -(|n|\ln(10) + (-\ln(x)))
      \exp_after:wN -
    \fi:
    #2; #1;
  }
\cs_new:Npn \__fp_pow_exponent:Nwnnnnnw #1#2; #3#4#5#6#7#8;
  { %^^A todo: use that in ln.
    \exp_after:wN \__fp_fixed_mul_after:wwn
    \int_value:w \__fp_int_eval:w \c__fp_leading_shift_int
      \exp_after:wN \__fp_pack:NNNNNw
      \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
        #1#2*23025 - #1 #3
        \exp_after:wN \__fp_pack:NNNNNw
        \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
          #1 #2*8509 - #1 #4
          \exp_after:wN \__fp_pack:NNNNNw
          \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
            #1 #2*2994 - #1 #5
            \exp_after:wN \__fp_pack:NNNNNw
            \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
              #1 #2*0456 - #1 #6
              \exp_after:wN \__fp_pack:NNNNNw
              \int_value:w \__fp_int_eval:w \c__fp_trailing_shift_int
                #1 #2*8401 - #1 #7
                #1 ( #2*7991 - #8 ) / 1 0000 ; ;
  }
\cs_new:Npn \__fp_pow_B:wwN #1#2#3#4#5#6; #7;
  {
    \if_int_compare:w #7 < 0 \exp_stop_f:
      \exp_after:wN \__fp_pow_C_neg:w \int_value:w -
    \else:
      \if_int_compare:w #7 < 22 \exp_stop_f:
        \exp_after:wN \__fp_pow_C_pos:w \int_value:w
      \else:
        \exp_after:wN \__fp_pow_C_overflow:w \int_value:w
      \fi:
    \fi:
    #7 \exp_after:wN ;
    \int_value:w \__fp_int_eval:w 10 0000 + #1 \__fp_int_eval_end:
    #2#3#4#5#6 0000 0000 0000 0000 0000 0000 ; %^^A todo: how many 0?
  }
\cs_new:Npn \__fp_pow_C_overflow:w #1; #2; #3
  {
    + 2 * \c__fp_max_exponent_int
    \exp_after:wN \__fp_fixed_continue:wn \c__fp_one_fixed_tl
  }
\cs_new:Npn \__fp_pow_C_neg:w #1 ; 1
  {
    \exp_after:wN \exp_after:wN \exp_after:wN \__fp_pow_C_pack:w
    \prg_replicate:nn {#1} {0}
  }
\cs_new:Npn \__fp_pow_C_pos:w #1; 1
  { \__fp_pow_C_pos_loop:wN #1; }
\cs_new:Npn \__fp_pow_C_pos_loop:wN #1; #2
  {
    \if_meaning:w 0 #1
      \exp_after:wN \__fp_pow_C_pack:w
      \exp_after:wN #2
    \else:
      \if_meaning:w 0 #2
        \exp_after:wN \__fp_pow_C_pos_loop:wN \int_value:w
      \else:
        \exp_after:wN \__fp_pow_C_overflow:w \int_value:w
      \fi:
      \__fp_int_eval:w #1 - 1 \exp_after:wN ;
    \fi:
  }
\cs_new:Npn \__fp_pow_C_pack:w
  {
    \exp_after:wN \__fp_exp_large:NwN
    \exp_after:wN 5
    \c__fp_one_fixed_tl
  }
\cs_new:Npn \__fp_pow_neg:www \s__fp \__fp_chk:w #1#2; #3; #4;
  {
    \if_case:w \__fp_pow_neg_case:w #4 ;
      \exp_after:wN \__fp_pow_neg_aux:wNN
    \or:
      \if_int_compare:w \__fp_int_eval:w #1 / 2 = 1 \exp_stop_f:
        \__fp_invalid_operation_o:Nww ^ #3; #4;
        \exp:w \exp_end_continue_f:w
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__fp_use_none_until_s:w
      \fi:
    \fi:
    \__fp_exp_after_o:w
    \s__fp \__fp_chk:w #1#2;
  }
\cs_new:Npn \__fp_pow_neg_aux:wNN #1 \s__fp \__fp_chk:w #2#3
  {
    \exp_after:wN \__fp_exp_after_o:w
    \exp_after:wN \s__fp
    \exp_after:wN \__fp_chk:w
    \exp_after:wN #2
    \int_value:w \__fp_int_eval:w 2 - #3 \__fp_int_eval_end:
  }
\cs_new:Npn \__fp_pow_neg_case:w \s__fp \__fp_chk:w #1#2#3;
  {
    \if_case:w #1 \exp_stop_f:
           -1
    \or:   \__fp_pow_neg_case_aux:nnnnn #3
    \or:   -1
    \else: 1
    \fi:
    \exp_stop_f:
  }
\cs_new:Npn \__fp_pow_neg_case_aux:nnnnn #1#2#3#4#5
  {
    \if_int_compare:w #1 > \c__fp_prec_int
      -1
    \else:
      \__fp_decimate:nNnnnn { \c__fp_prec_int - #1 }
        \__fp_pow_neg_case_aux:Nnnw
        {#2} {#3} {#4} {#5}
    \fi:
  }
\cs_new:Npn \__fp_pow_neg_case_aux:Nnnw #1#2#3#4 ;
  {
    \if_meaning:w 0 #1
      \if_int_odd:w #3 \exp_stop_f:
        0
      \else:
        -1
      \fi:
    \else:
      1
    \fi:
  }
\int_const:Nn \c__fp_fact_max_arg_int { 3248 }
\cs_new:Npn \__fp_fact_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_case:w #2 \exp_stop_f:
      \__fp_case_return_o:Nw \c_one_fp
    \or:
    \or:
      \if_meaning:w 0 #3
        \exp_after:wN \__fp_case_return_same_o:w
      \fi:
    \or:
      \__fp_case_return_same_o:w
    \fi:
    \if_meaning:w 2 #3
      \__fp_case_use:nw { \__fp_invalid_operation_o:fw { fact } }
    \fi:
    \__fp_fact_pos_o:w
    \s__fp \__fp_chk:w #2 #3 #4 ;
  }
\cs_new:Npn \__fp_fact_pos_o:w #1;
  {
    \__fp_small_int:wTF #1;
      { \__fp_fact_int_o:n }
      { \__fp_invalid_operation_o:fw { fact } #1; }
  }
\cs_new:Npn \__fp_fact_int_o:n #1
  {
    \if_int_compare:w #1 > \c__fp_fact_max_arg_int
      \__fp_case_return:nw
        {
          \exp_after:wN \exp_after:wN \exp_after:wN \__fp_overflow:w
          \exp_after:wN \c_inf_fp
        }
    \fi:
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN 0
    \int_value:w \__fp_int_eval:w
    \__fp_fact_loop_o:w #1 . 4 , { 1 } { } { } { } { } { } ;
  }
\cs_new:Npn \__fp_fact_loop_o:w #1 . #2 ;
  {
    \if_int_compare:w #1 < 12 \exp_stop_f:
      \__fp_fact_small_o:w #1
    \fi:
    \exp_after:wN \__fp_ep_mul:wwwwn
    \exp_after:wN 4 \exp_after:wN ,
    \exp_after:wN { \int_value:w \__fp_int_eval:w #1 * (#1 - 1) }
    { } { } { } { } { } ;
    #2 ;
    {
      \exp_after:wN \__fp_fact_loop_o:w
      \int_value:w \__fp_int_eval:w #1 - 2 .
    }
  }
\cs_new:Npn \__fp_fact_small_o:w #1 \fi: #2 ; #3 ; #4
  {
    \fi:
    \exp_after:wN \__fp_ep_mul:wwwwn
    \exp_after:wN 4 \exp_after:wN ,
    \exp_after:wN
      {
        \int_value:w
        \if_case:w #1 \exp_stop_f:
        1 \or: 1 \or: 2 \or: 6 \or: 24 \or: 120 \or: 720 \or: 5040
        \or: 40320 \or: 362880 \or: 3628800 \or: 39916800
        \fi:
      } { } { } { } { } { } ;
    #3 ;
    \__fp_ep_to_float_o:wwN 0
  }
%% File: l3fp-trig.dtx
\tl_map_inline:nn
  {
    {acos} {acsc} {asec} {asin}
    {cos} {cot} {csc} {sec} {sin} {tan}
  }
  {
    \cs_new:cpx { __fp_parse_word_#1:N }
      {
        \exp_not:N \__fp_parse_unary_function:NNN
        \exp_not:c { __fp_#1_o:w }
        \exp_not:N \use_i:nn
      }
    \cs_new:cpx { __fp_parse_word_#1d:N }
      {
        \exp_not:N \__fp_parse_unary_function:NNN
        \exp_not:c { __fp_#1_o:w }
        \exp_not:N \use_ii:nn
      }
  }
\cs_new:Npn \__fp_parse_word_acot:N
  { \__fp_parse_function:NNN \__fp_acot_o:Nw \use_i:nn }
\cs_new:Npn \__fp_parse_word_acotd:N
  { \__fp_parse_function:NNN \__fp_acot_o:Nw \use_ii:nn }
\cs_new:Npn \__fp_parse_word_atan:N
  { \__fp_parse_function:NNN \__fp_atan_o:Nw \use_i:nn }
\cs_new:Npn \__fp_parse_word_atand:N
  { \__fp_parse_function:NNN \__fp_atan_o:Nw \use_ii:nn }
\cs_new:Npn \__fp_sin_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_case:w #2 \exp_stop_f:
           \__fp_case_return_same_o:w
    \or:   \__fp_case_use:nw
             {
               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
                 \__fp_ep_to_float_o:wwN #3 0
             }
    \or:   \__fp_case_use:nw
             { \__fp_invalid_operation_o:fw { #1 { sin } { sind } } }
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3 #4;
  }
\cs_new:Npn \__fp_cos_o:w #1 \s__fp \__fp_chk:w #2#3; @
  {
    \if_case:w #2 \exp_stop_f:
           \__fp_case_return_o:Nw \c_one_fp
    \or:   \__fp_case_use:nw
             {
               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
                 \__fp_ep_to_float_o:wwN 0 2
             }
    \or:   \__fp_case_use:nw
             { \__fp_invalid_operation_o:fw { #1 { cos } { cosd } } }
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3;
  }
\cs_new:Npn \__fp_csc_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_case:w #2 \exp_stop_f:
           \__fp_cot_zero_o:Nfw #3 { #1 { csc } { cscd } }
    \or:   \__fp_case_use:nw
             {
               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
                 \__fp_ep_inv_to_float_o:wwN #3 0
             }
    \or:   \__fp_case_use:nw
             { \__fp_invalid_operation_o:fw { #1 { csc } { cscd } } }
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3 #4;
  }
\cs_new:Npn \__fp_sec_o:w #1 \s__fp \__fp_chk:w #2#3; @
  {
    \if_case:w #2 \exp_stop_f:
           \__fp_case_return_o:Nw \c_one_fp
    \or:   \__fp_case_use:nw
             {
               \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww
                 \__fp_ep_inv_to_float_o:wwN 0 2
             }
    \or:   \__fp_case_use:nw
             { \__fp_invalid_operation_o:fw { #1 { sec } { secd } } }
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3;
  }
\cs_new:Npn \__fp_tan_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_case:w #2 \exp_stop_f:
           \__fp_case_return_same_o:w
    \or:   \__fp_case_use:nw
             {
               \__fp_trig:NNNNNwn #1
                 \__fp_tan_series_o:NNwwww 0 #3 1
             }
    \or:   \__fp_case_use:nw
             { \__fp_invalid_operation_o:fw { #1 { tan } { tand } } }
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3 #4;
  }
\cs_new:Npn \__fp_cot_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_case:w #2 \exp_stop_f:
           \__fp_cot_zero_o:Nfw #3 { #1 { cot } { cotd } }
    \or:   \__fp_case_use:nw
             {
               \__fp_trig:NNNNNwn #1
                 \__fp_tan_series_o:NNwwww 2 #3 3
             }
    \or:   \__fp_case_use:nw
             { \__fp_invalid_operation_o:fw { #1 { cot } { cotd } } }
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3 #4;
  }
\cs_new:Npn \__fp_cot_zero_o:Nfw #1#2#3 \fi:
  {
    \fi:
    \token_if_eq_meaning:NNTF 0 #1
      { \exp_args:NNf \__fp_division_by_zero_o:Nnw \c_inf_fp }
      { \exp_args:NNf \__fp_division_by_zero_o:Nnw \c_minus_inf_fp }
    {#2}
  }
\cs_new:Npn \__fp_trig:NNNNNwn #1#2#3#4#5 \s__fp \__fp_chk:w 1#6#7#8;
  {
    \exp_after:wN #2
    \exp_after:wN #3
    \exp_after:wN #4
    \int_value:w \__fp_int_eval:w #5
      \exp_after:wN \exp_after:wN \exp_after:wN \exp_after:wN
      \if_int_compare:w #7 > #1 0 1 \exp_stop_f:
        #1 \__fp_trig_large:ww \__fp_trigd_large:ww
      \else:
        #1 \__fp_trig_small:ww \__fp_trigd_small:ww
      \fi:
    #7,#8{0000}{0000};
  }
\cs_new:Npn \__fp_trig_small:ww #1,#2;
  { \__fp_ep_to_fixed:wwn #1,#2; . #1,#2; }
\cs_new:Npn \__fp_trigd_small:ww #1,#2;
  {
    \__fp_ep_mul_raw:wwwwN
      -1,{1745}{3292}{5199}{4329}{5769}{2369}; #1,#2;
    \__fp_trig_small:ww
  }
\cs_new:Npn \__fp_trigd_large:ww #1, #2#3#4#5#6#7;
  {
    \exp_after:wN \__fp_pack_eight:wNNNNNNNN
    \exp_after:wN \__fp_pack_eight:wNNNNNNNN
    \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
    \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN
    \exp_after:wN \__fp_trigd_large_auxi:nnnnwNNNN
    \exp_after:wN ;
    \exp:w \exp_end_continue_f:w
    \prg_replicate:nn { \int_max:nn { 22 - #1 } { 0 } } { 0 }
    #2#3#4#5#6#7 0000 0000 0000 !
  }
\cs_new:Npn \__fp_trigd_large_auxi:nnnnwNNNN #1#2#3#4#5; #6#7#8#9
  {
    \exp_after:wN \__fp_trigd_large_auxii:wNw
    \int_value:w \__fp_int_eval:w #1 + #2
      - (#1 + #2 - 4) / 9 * 9 \__fp_int_eval_end:
    #3;
    #4; #5{#6#7#8#9};
  }
\cs_new:Npn \__fp_trigd_large_auxii:wNw #1; #2#3;
  {
    + (#1#2 - 4) / 9 * 2
    \exp_after:wN \__fp_trigd_large_auxiii:www
    \int_value:w \__fp_int_eval:w #1#2
      - (#1#2 - 4) / 9 * 9 \__fp_int_eval_end: #3 ;
  }
\cs_new:Npn \__fp_trigd_large_auxiii:www #1; #2; #3!
  {
    \if_int_compare:w #1 < 4500 \exp_stop_f:
      \exp_after:wN \__fp_use_i_until_s:nw
      \exp_after:wN \__fp_fixed_continue:wn
    \else:
      + 1
    \fi:
    \__fp_fixed_sub:wwn {9000}{0000}{0000}{0000}{0000}{0000};
      {#1}#2{0000}{0000};
    { \__fp_trigd_small:ww 2, }
  }
\intarray_const_from_clist:Nn \c__fp_trig_intarray
  {
    100000000, 100000000, 115915494, 130918953, 135768883, 176337251,
    143620344, 159645740, 145644874, 176673440, 158896797, 163422653,
    150901138, 102766253, 108595607, 128427267, 157958036, 189291184,
    161145786, 152877967, 141073169, 198392292, 139966937, 140907757,
    130777463, 196925307, 168871739, 128962173, 197661693, 136239024,
    117236290, 111832380, 111422269, 197557159, 140461890, 108690267,
    139561204, 189410936, 193784408, 155287230, 199946443, 140024867,
    123477394, 159610898, 132309678, 130749061, 166986462, 180469944,
    186521878, 181574786, 156696424, 110389958, 174139348, 160998386,
    180991999, 162442875, 158517117, 188584311, 117518767, 116054654,
    175369880, 109739460, 136475933, 137680593, 102494496, 163530532,
    171567755, 103220324, 177781639, 171660229, 146748119, 159816584,
    106060168, 103035998, 113391198, 174988327, 186654435, 127975507,
    100162406, 177564388, 184957131, 108801221, 199376147, 168137776,
    147378906, 133068046, 145797848, 117613124, 127314069, 196077502,
    145002977, 159857089, 105690279, 167851315, 125210016, 131774602,
    109248116, 106240561, 145620314, 164840892, 148459191, 143521157,
    154075562, 100871526, 160680221, 171591407, 157474582, 172259774,
    162853998, 175155329, 139081398, 117724093, 158254797, 107332871,
    190406999, 175907657, 170784934, 170393589, 182808717, 134256403,
    166895116, 162545705, 194332763, 112686500, 126122717, 197115321,
    112599504, 138667945, 103762556, 108363171, 116952597, 158128224,
    194162333, 143145106, 112353687, 185631136, 136692167, 114206974,
    169601292, 150578336, 105311960, 185945098, 139556718, 170995474,
    165104316, 123815517, 158083944, 129799709, 199505254, 138756612,
    194458833, 106846050, 178529151, 151410404, 189298850, 163881607,
    176196993, 107341038, 199957869, 118905980, 193737772, 106187543,
    122271893, 101366255, 126123878, 103875388, 181106814, 106765434,
    108282785, 126933426, 179955607, 107903860, 160352738, 199624512,
    159957492, 176297023, 159409558, 143011648, 129641185, 157771240,
    157544494, 157021789, 176979240, 194903272, 194770216, 164960356,
    153181535, 144003840, 168987471, 176915887, 163190966, 150696440,
    147769706, 187683656, 177810477, 197954503, 153395758, 130188183,
    186879377, 166124814, 195305996, 155802190, 183598751, 103512712,
    190432315, 180498719, 168687775, 194656634, 162210342, 104440855,
    149785037, 192738694, 129353661, 193778292, 187359378, 143470323,
    102371458, 137923557, 111863634, 119294601, 183182291, 196416500,
    187830793, 131353497, 179099745, 186492902, 167450609, 189368909,
    145883050, 133703053, 180547312, 132158094, 131976760, 132283131,
    141898097, 149822438, 133517435, 169898475, 101039500, 168388003,
    197867235, 199608024, 100273901, 108749548, 154787923, 156826113,
    199489032, 168997427, 108349611, 149208289, 103776784, 174303550,
    145684560, 183671479, 130845672, 133270354, 185392556, 120208683,
    193240995, 162211753, 131839402, 109707935, 170774965, 149880868,
    160663609, 168661967, 103747454, 121028312, 119251846, 122483499,
    111611495, 166556037, 196967613, 199312829, 196077608, 127799010,
    107830360, 102338272, 198790854, 102387615, 157445430, 192601191,
    100543379, 198389046, 154921248, 129516070, 172853005, 122721023,
    160175233, 113173179, 175931105, 103281551, 109373913, 163964530,
    157926071, 180083617, 195487672, 146459804, 173977292, 144810920,
    109371257, 186918332, 189588628, 139904358, 168666639, 175673445,
    114095036, 137327191, 174311388, 106638307, 125923027, 159734506,
    105482127, 178037065, 133778303, 121709877, 134966568, 149080032,
    169885067, 141791464, 168350828, 116168533, 114336160, 173099514,
    198531198, 119733758, 144420984, 116559541, 152250643, 139431286,
    144403838, 183561508, 179771645, 101706470, 167518774, 156059160,
    187168578, 157939226, 123475633, 117111329, 198655941, 159689071,
    198506887, 144230057, 151919770, 156900382, 118392562, 120338742,
    135362568, 108354156, 151729710, 188117217, 195936832, 156488518,
    174997487, 108553116, 159830610, 113921445, 144601614, 188452770,
    125114110, 170248521, 173974510, 138667364, 103872860, 109967489,
    131735618, 112071174, 104788993, 168886556, 192307848, 150230570,
    157144063, 163863202, 136852010, 174100574, 185922811, 115721968,
    100397824, 175953001, 166958522, 112303464, 118773650, 143546764,
    164565659, 171901123, 108476709, 193097085, 191283646, 166919177,
    169387914, 133315566, 150669813, 121641521, 100895711, 172862384,
    126070678, 145176011, 113450800, 169947684, 122356989, 162488051,
    157759809, 153397080, 185475059, 175362656, 149034394, 145420581,
    178864356, 183042000, 131509559, 147434392, 152544850, 167491429,
    108647514, 142303321, 133245695, 111634945, 167753939, 142403609,
    105438335, 152829243, 142203494, 184366151, 146632286, 102477666,
    166049531, 140657343, 157553014, 109082798, 180914786, 169343492,
    127376026, 134997829, 195701816, 119643212, 133140475, 176289748,
    140828911, 174097478, 126378991, 181699939, 148749771, 151989818,
    172666294, 160183053, 195832752, 109236350, 168538892, 128468247,
    125997252, 183007668, 156937583, 165972291, 198244297, 147406163,
    181831139, 158306744, 134851692, 185973832, 137392662, 140243450,
    119978099, 140402189, 161348342, 173613676, 144991382, 171541660,
    163424829, 136374185, 106122610, 186132119, 198633462, 184709941,
    183994274, 129559156, 128333990, 148038211, 175011612, 111667205,
    119125793, 103552929, 124113440, 131161341, 112495318, 138592695,
    184904438, 146807849, 109739828, 108855297, 104515305, 139914009,
    188698840, 188365483, 166522246, 168624087, 125401404, 100911787,
    142122045, 123075334, 173972538, 114940388, 141905868, 142311594,
    163227443, 139066125, 116239310, 162831953, 123883392, 113153455,
    163815117, 152035108, 174595582, 101123754, 135976815, 153401874,
    107394340, 136339780, 138817210, 104531691, 182951948, 179591767,
    139541778, 179243527, 161740724, 160593916, 102732282, 187946819,
    136491289, 149714953, 143255272, 135916592, 198072479, 198580612,
    169007332, 118844526, 179433504, 155801952, 149256630, 162048766,
    116134365, 133992028, 175452085, 155344144, 109905129, 182727454,
    165911813, 122232840, 151166615, 165070983, 175574337, 129548631,
    120411217, 116380915, 160616116, 157320000, 183306114, 160618128,
    103262586, 195951602, 146321661, 138576614, 180471993, 127077713,
    116441201, 159496011, 106328305, 120759583, 148503050, 179095584,
    198298218, 167402898, 138551383, 123957020, 180763975, 150429225,
    198476470, 171016426, 197438450, 143091658, 164528360, 132493360,
    143546572, 137557916, 113663241, 120457809, 196971566, 134022158,
    180545794, 131328278, 100552461, 132088901, 187421210, 192448910,
    141005215, 149680971, 113720754, 100571096, 134066431, 135745439,
    191597694, 135788920, 179342561, 177830222, 137011486, 142492523,
    192487287, 113132021, 176673607, 156645598, 127260957, 141566023,
    143787436, 129132109, 174858971, 150713073, 191040726, 143541417,
    197057222, 165479803, 181512759, 157912400, 125344680, 148220261,
    173422990, 101020483, 106246303, 137964746, 178190501, 181183037,
    151538028, 179523433, 141955021, 135689770, 191290561, 143178787,
    192086205, 174499925, 178975690, 118492103, 124206471, 138519113,
    188147564, 102097605, 154895793, 178514140, 141453051, 151583964,
    128232654, 106020603, 131189158, 165702720, 186250269, 191639375,
    115278873, 160608114, 155694842, 110322407, 177272742, 116513642,
    134366992, 171634030, 194053074, 180652685, 109301658, 192136921,
    141431293, 171341061, 157153714, 106203978, 147618426, 150297807,
    186062669, 169960809, 118422347, 163350477, 146719017, 145045144,
    161663828, 146208240, 186735951, 102371302, 190444377, 194085350,
    134454426, 133413062, 163074595, 113830310, 122931469, 134466832,
    185176632, 182415152, 110179422, 164439571, 181217170, 121756492,
    119644493, 196532222, 118765848, 182445119, 109401340, 150443213,
    198586286, 121083179, 139396084, 143898019, 114787389, 177233102,
    186310131, 148695521, 126205182, 178063494, 157118662, 177825659,
    188310053, 151552316, 165984394, 109022180, 163144545, 121212978,
    197344714, 188741258, 126822386, 102360271, 109981191, 152056882,
    134723983, 158013366, 106837863, 128867928, 161973236, 172536066,
    185216856, 132011948, 197807339, 158419190, 166595838, 167852941,
    124187182, 117279875, 106103946, 106481958, 157456200, 160892122,
    184163943, 173846549, 158993202, 184812364, 133466119, 170732430,
    195458590, 173361878, 162906318, 150165106, 126757685, 112163575,
    188696307, 145199922, 100107766, 176830946, 198149756, 122682434,
    179367131, 108412102, 119520899, 148191244, 140487511, 171059184,
    141399078, 189455775, 118462161, 190415309, 134543802, 180893862,
    180732375, 178615267, 179711433, 123241969, 185780563, 176301808,
    184386640, 160717536, 183213626, 129671224, 126094285, 140110963,
    121826276, 151201170, 122552929, 128965559, 146082049, 138409069,
    107606920, 103954646, 119164002, 115673360, 117909631, 187289199,
    186343410, 186903200, 157966371, 103128612, 135698881, 176403642,
    152540837, 109810814, 183519031, 121318624, 172281810, 150845123,
    169019064, 166322359, 138872454, 163073727, 128087898, 130041018,
    194859136, 173742589, 141812405, 167291912, 138003306, 134499821,
    196315803, 186381054, 124578934, 150084553, 128031351, 118843410,
    107373060, 159565443, 173624887, 171292628, 198074235, 139074061,
    178690578, 144431052, 174262641, 176783005, 182214864, 162289361,
    192966929, 192033046, 169332843, 181580535, 164864073, 118444059,
    195496893, 153773183, 167266131, 130108623, 158802128, 180432893,
    144562140, 147978945, 142337360, 158506327, 104399819, 132635916,
    168734194, 136567839, 101281912, 120281622, 195003330, 112236091,
    185875592, 101959081, 122415367, 194990954, 148881099, 175891989,
    108115811, 163538891, 163394029, 123722049, 184837522, 142362091,
    100834097, 156679171, 100841679, 157022331, 178971071, 102928884,
    189701309, 195339954, 124415335, 106062584, 139214524, 133864640,
    134324406, 157317477, 155340540, 144810061, 177612569, 108474646,
    114329765, 143900008, 138265211, 145210162, 136643111, 197987319,
    102751191, 144121361, 169620456, 193602633, 161023559, 162140467,
    102901215, 167964187, 135746835, 187317233, 110047459, 163339773,
    124770449, 118885134, 141536376, 100915375, 164267438, 145016622,
    113937193, 106748706, 128815954, 164819775, 119220771, 102367432,
    189062690, 170911791, 194127762, 112245117, 123546771, 115640433,
    135772061, 166615646, 174474627, 130562291, 133320309, 153340551,
    138417181, 194605321, 150142632, 180008795, 151813296, 175497284,
    167018836, 157425342, 150169942, 131069156, 134310662, 160434122,
    105213831, 158797111, 150754540, 163290657, 102484886, 148697402,
    187203725, 198692811, 149360627, 140384233, 128749423, 132178578,
    177507355, 171857043, 178737969, 134023369, 102911446, 196144864,
    197697194, 134527467, 144296030, 189437192, 154052665, 188907106,
    162062575, 150993037, 199766583, 167936112, 181374511, 104971506,
    115378374, 135795558, 167972129, 135876446, 130937572, 103221320,
    124605656, 161129971, 131027586, 191128460, 143251843, 143269155,
    129284585, 173495971, 150425653, 199302112, 118494723, 121323805,
    116549802, 190991967, 168151180, 122483192, 151273721, 199792134,
    133106764, 121874844, 126215985, 112167639, 167793529, 182985195,
    185453921, 106957880, 158685312, 132775454, 133229161, 198905318,
    190537253, 191582222, 192325972, 178133427, 181825606, 148823337,
    160719681, 101448145, 131983362, 137910767, 112550175, 128826351,
    183649210, 135725874, 110356573, 189469487, 154446940, 118175923,
    106093708, 128146501, 185742532, 149692127, 164624247, 183221076,
    154737505, 168198834, 156410354, 158027261, 125228550, 131543250,
    139591848, 191898263, 104987591, 115406321, 103542638, 190012837,
    142615518, 178773183, 175862355, 117537850, 169565995, 170028011,
    158412588, 170150030, 117025916, 174630208, 142412449, 112839238,
    105257725, 114737141, 123102301, 172563968, 130555358, 132628403,
    183638157, 168682846, 143304568, 105994018, 170010719, 152092970,
    117799058, 132164175, 179868116, 158654714, 177489647, 116547948,
    183121404, 131836079, 184431405, 157311793, 149677763, 173989893,
    102277656, 107058530, 140837477, 152640947, 143507039, 152145247,
    101683884, 107090870, 161471944, 137225650, 128231458, 172995869,
    173831689, 171268519, 139042297, 111072135, 107569780, 137262545,
    181410950, 138270388, 198736451, 162848201, 180468288, 120582913,
    153390138, 135649144, 130040157, 106509887, 192671541, 174507066,
    186888783, 143805558, 135011967, 145862340, 180595327, 124727843,
    182925939, 157715840, 136885940, 198993925, 152416883, 178793572,
    179679516, 154076673, 192703125, 164187609, 162190243, 104699348,
    159891990, 160012977, 174692145, 132970421, 167781726, 115178506,
    153008552, 155999794, 102099694, 155431545, 127458567, 104403686,
    168042864, 184045128, 181182309, 179349696, 127218364, 192935516,
    120298724, 169583299, 148193297, 183358034, 159023227, 105261254,
    121144370, 184359584, 194433836, 138388317, 175184116, 108817112,
    151279233, 137457721, 193398208, 119005406, 132929377, 175306906,
    160741530, 149976826, 147124407, 176881724, 186734216, 185881509,
    191334220, 175930947, 117385515, 193408089, 157124410, 163472089,
    131949128, 180783576, 131158294, 100549708, 191802336, 165960770,
    170927599, 101052702, 181508688, 197828549, 143403726, 142729262,
    110348701, 139928688, 153550062, 106151434, 130786653, 196085995,
    100587149, 139141652, 106530207, 100852656, 124074703, 166073660,
    153338052, 163766757, 120188394, 197277047, 122215363, 138511354,
    183463624, 161985542, 159938719, 133367482, 104220974, 149956672,
    170250544, 164232439, 157506869, 159133019, 137469191, 142980999,
    134242305, 150172665, 121209241, 145596259, 160554427, 159095199,
    168243130, 184279693, 171132070, 121049823, 123819574, 171759855,
    119501864, 163094029, 175943631, 194450091, 191506160, 149228764,
    132319212, 197034460, 193584259, 126727638, 168143633, 109856853,
    127860243, 132141052, 133076065, 188414958, 158718197, 107124299,
    159592267, 181172796, 144388537, 196763139, 127431422, 179531145,
    100064922, 112650013, 132686230, 121550837,
  }
\cs_new:Npn \__fp_trig_large:ww #1, #2#3#4#5#6;
  {
    \exp_after:wN \__fp_trig_large_auxi:w
    \int_value:w \__fp_int_eval:w (#1 - 4) / 8 \exp_after:wN ,
    \int_value:w #1 , ;
    {#2}{#3}{#4}{#5} ;
  }
\cs_new:Npn \__fp_trig_large_auxi:w #1, #2,
  {
    \exp_after:wN \exp_after:wN
    \exp_after:wN \__fp_trig_large_auxii:w
    \cs:w
      use_none:n \prg_replicate:nn { #2 - #1 * 8 } { n }
      \exp_after:wN
    \cs_end:
    \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 1 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 2 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 3 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 4 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 5 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 6 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 7 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 8 \scan_stop: }
    \exp_after:wN \__fp_trig_large_auxiii:w \int_value:w
    \__kernel_intarray_item:Nn \c__fp_trig_intarray
      { \__fp_int_eval:w #1 + 9 \scan_stop: }
    \exp_stop_f:
  }
\cs_new:Npn \__fp_trig_large_auxii:w
  {
    \__fp_pack_twice_four:wNNNNNNNN \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN \__fp_pack_twice_four:wNNNNNNNN
    \__fp_pack_twice_four:wNNNNNNNN \__fp_pack_twice_four:wNNNNNNNN
    \__fp_trig_large_auxv:www ;
  }
\cs_new:Npn \__fp_trig_large_auxiii:w 1 { \exp_stop_f: }
\cs_new:Npn \__fp_trig_large_auxv:www #1; #2; #3;
  {
    \exp_after:wN \__fp_use_i_until_s:nw
    \exp_after:wN \__fp_trig_large_auxvii:w
    \int_value:w \__fp_int_eval:w \c__fp_leading_shift_int
      \prg_replicate:nn { 13 }
        { \__fp_trig_large_auxvi:wnnnnnnnn }
      + \c__fp_trailing_shift_int - \c__fp_middle_shift_int
      \__fp_use_i_until_s:nw
      ; #3 #1 ; ;
  }
\cs_new:Npn \__fp_trig_large_auxvi:wnnnnnnnn #1; #2#3#4#5#6#7#8#9
  {
    \exp_after:wN \__fp_trig_large_pack:NNNNNw
    \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
      + #2*#9 + #3*#8 + #4*#7 + #5*#6
      #1; {#2}{#3}{#4}{#5} {#7}{#8}{#9}
  }
\cs_new:Npn \__fp_trig_large_pack:NNNNNw #1#2#3#4#5#6;
  { + #1#2#3#4#5 ; #6 }
\cs_new:Npn \__fp_trig_large_auxvii:w #1#2#3
  {
    \exp_after:wN \__fp_trig_large_auxviii:ww
    \int_value:w \__fp_int_eval:w (#1#2#3 - 62) / 125 ;
    #1#2#3
  }
\cs_new:Npn \__fp_trig_large_auxviii:ww #1;
  {
    + #1
    \if_int_odd:w #1 \exp_stop_f:
      \exp_after:wN \__fp_trig_large_auxix:Nw
      \exp_after:wN -
    \else:
      \exp_after:wN \__fp_trig_large_auxix:Nw
      \exp_after:wN +
    \fi:
  }
\cs_new:Npn \__fp_trig_large_auxix:Nw
  {
    \exp_after:wN \__fp_use_i_until_s:nw
    \exp_after:wN \__fp_trig_large_auxxi:w
    \int_value:w \__fp_int_eval:w \c__fp_leading_shift_int
      \prg_replicate:nn { 13 }
        { \__fp_trig_large_auxx:wNNNNN }
      + \c__fp_trailing_shift_int - \c__fp_middle_shift_int
      ;
  }
\cs_new:Npn \__fp_trig_large_auxx:wNNNNN #1; #2 #3#4#5#6
  {
    \exp_after:wN \__fp_trig_large_pack:NNNNNw
    \int_value:w \__fp_int_eval:w \c__fp_middle_shift_int
      #2 8 * #3#4#5#6
      #1; #2
  }
\cs_new:Npn \__fp_trig_large_auxxi:w #1;
  {
    \exp_after:wN \__fp_ep_mul_raw:wwwwN
    \int_value:w \__fp_int_eval:w 0 \__fp_ep_to_ep_loop:N #1 ; ; !
    0,{7853}{9816}{3397}{4483}{0961}{5661};
    \__fp_trig_small:ww
  }
\cs_new:Npn \__fp_sin_series_o:NNwwww #1#2#3. #4;
  {
    \__fp_fixed_mul:wwn #4; #4;
    {
      \exp_after:wN \__fp_sin_series_aux_o:NNnwww
      \exp_after:wN #1
      \int_value:w
        \if_int_odd:w \__fp_int_eval:w (#3 + 2) / 4 \__fp_int_eval_end:
          #2
        \else:
          \if_meaning:w #2 0 2 \else: 0 \fi:
        \fi:
      {#3}
    }
  }
\cs_new:Npn \__fp_sin_series_aux_o:NNnwww #1#2#3 #4; #5,#6;
  {
    \if_int_odd:w \__fp_int_eval:w #3 / 2 \__fp_int_eval_end:
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
    { % 1/18!
      \__fp_fixed_mul_sub_back:wwwn    {0000}{0000}{0000}{0001}{5619}{2070};
                                  #4;{0000}{0000}{0000}{0477}{9477}{3324};
      \__fp_fixed_mul_sub_back:wwwn #4;{0000}{0000}{0011}{4707}{4559}{7730};
      \__fp_fixed_mul_sub_back:wwwn #4;{0000}{0000}{2087}{6756}{9878}{6810};
      \__fp_fixed_mul_sub_back:wwwn #4;{0000}{0027}{5573}{1922}{3985}{8907};
      \__fp_fixed_mul_sub_back:wwwn #4;{0000}{2480}{1587}{3015}{8730}{1587};
      \__fp_fixed_mul_sub_back:wwwn #4;{0013}{8888}{8888}{8888}{8888}{8889};
      \__fp_fixed_mul_sub_back:wwwn #4;{0416}{6666}{6666}{6666}{6666}{6667};
      \__fp_fixed_mul_sub_back:wwwn #4;{5000}{0000}{0000}{0000}{0000}{0000};
      \__fp_fixed_mul_sub_back:wwwn#4;{10000}{0000}{0000}{0000}{0000}{0000};
      { \__fp_fixed_continue:wn 0, }
    }
    { % 1/17!
      \__fp_fixed_mul_sub_back:wwwn    {0000}{0000}{0000}{0028}{1145}{7254};
                                  #4;{0000}{0000}{0000}{7647}{1637}{3182};
      \__fp_fixed_mul_sub_back:wwwn #4;{0000}{0000}{0160}{5904}{3836}{8216};
      \__fp_fixed_mul_sub_back:wwwn #4;{0000}{0002}{5052}{1083}{8544}{1719};
      \__fp_fixed_mul_sub_back:wwwn #4;{0000}{0275}{5731}{9223}{9858}{9065};
      \__fp_fixed_mul_sub_back:wwwn #4;{0001}{9841}{2698}{4126}{9841}{2698};
      \__fp_fixed_mul_sub_back:wwwn #4;{0083}{3333}{3333}{3333}{3333}{3333};
      \__fp_fixed_mul_sub_back:wwwn #4;{1666}{6666}{6666}{6666}{6666}{6667};
      \__fp_fixed_mul_sub_back:wwwn#4;{10000}{0000}{0000}{0000}{0000}{0000};
      { \__fp_ep_mul:wwwwn 0, } #5,#6;
    }
    {
      \exp_after:wN \__fp_sanitize:Nw
      \exp_after:wN #2
      \int_value:w \__fp_int_eval:w #1
    }
    #2
  }
\cs_new:Npn \__fp_tan_series_o:NNwwww #1#2#3. #4;
  {
    \__fp_fixed_mul:wwn #4; #4;
    {
      \exp_after:wN \__fp_tan_series_aux_o:Nnwww
      \int_value:w
        \if_int_odd:w \__fp_int_eval:w #3 / 2 \__fp_int_eval_end:
          \exp_after:wN \reverse_if:N
        \fi:
        \if_meaning:w #1#2 2 \else: 0 \fi:
      {#3}
    }
  }
\cs_new:Npn \__fp_tan_series_aux_o:Nnwww #1 #2 #3; #4,#5;
  {
    \__fp_fixed_mul_sub_back:wwwn     {0000}{0000}{1527}{3493}{0856}{7059};
                                #3; {0000}{0159}{6080}{0274}{5257}{6472};
    \__fp_fixed_mul_sub_back:wwwn #3; {0002}{4571}{2320}{0157}{2558}{8481};
    \__fp_fixed_mul_sub_back:wwwn #3; {0115}{5830}{7533}{5397}{3168}{2147};
    \__fp_fixed_mul_sub_back:wwwn #3; {1929}{8245}{6140}{3508}{7719}{2982};
    \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000};
    { \__fp_ep_mul:wwwwn 0, } #4,#5;
    {
      \__fp_fixed_mul_sub_back:wwwn    {0000}{0007}{0258}{0681}{9408}{4706};
                                  #3;{0000}{2343}{7175}{1399}{6151}{7670};
      \__fp_fixed_mul_sub_back:wwwn #3;{0019}{2638}{4588}{9232}{8861}{3691};
      \__fp_fixed_mul_sub_back:wwwn #3;{0536}{6357}{0691}{4344}{6852}{4252};
      \__fp_fixed_mul_sub_back:wwwn #3;{5263}{1578}{9473}{6842}{1052}{6315};
      \__fp_fixed_mul_sub_back:wwwn#3;{10000}{0000}{0000}{0000}{0000}{0000};
      {
        \reverse_if:N \if_int_odd:w
            \__fp_int_eval:w (#2 - 1) / 2 \__fp_int_eval_end:
          \exp_after:wN \__fp_reverse_args:Nww
        \fi:
        \__fp_ep_div:wwwwn 0,
      }
    }
    {
      \exp_after:wN \__fp_sanitize:Nw
      \exp_after:wN #1
      \int_value:w \__fp_int_eval:w \__fp_ep_to_float_o:wwN
    }
    #1
  }
\cs_new:Npn \__fp_atan_o:Nw #1
  {
    \__fp_parse_function_one_two:nnw
      { #1 { atan } { atand } }
      { \__fp_atan_default:w \__fp_atanii_o:Nww #1 }
  }
\cs_new:Npn \__fp_acot_o:Nw #1
  {
    \__fp_parse_function_one_two:nnw
      { #1 { acot } { acotd } }
      { \__fp_atan_default:w \__fp_acotii_o:Nww #1 }
  }
\cs_new:Npx \__fp_atan_default:w #1#2#3 @ { #1 #2 #3 \c_one_fp @ }
\cs_new:Npn \__fp_atanii_o:Nww
    #1 \s__fp \__fp_chk:w #2#3#4; \s__fp \__fp_chk:w #5 #6 @
  {
    \if_meaning:w 3 #2 \__fp_case_return_i_o:ww \fi:
    \if_meaning:w 3 #5 \__fp_case_return_ii_o:ww \fi:
    \if_case:w
      \if_meaning:w #2 #5
        \if_meaning:w 1 #2 10 \else: 0 \fi:
      \else:
        \if_int_compare:w #2 > #5 \exp_stop_f: 1 \else: 2 \fi:
      \fi:
      \exp_stop_f:
         \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 2 }
    \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 4 }
    \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 0 }
    \fi:
    \__fp_atan_normal_o:NNnwNnw #1
    \s__fp \__fp_chk:w #2#3#4;
    \s__fp \__fp_chk:w #5 #6
  }
\cs_new:Npn \__fp_acotii_o:Nww #1#2; #3;
  { \__fp_atanii_o:Nww #1#3; #2; }
\cs_new:Npn \__fp_atan_inf_o:NNNw #1#2#3 \s__fp \__fp_chk:w #4#5#6;
  {
    \exp_after:wN \__fp_atan_combine_o:NwwwwwN
    \exp_after:wN #2
    \int_value:w \__fp_int_eval:w
      \if_meaning:w 2 #5 7 - \fi: #3 \exp_after:wN ;
    \c__fp_one_fixed_tl
    {0000}{0000}{0000}{0000}{0000}{0000};
    0,{0000}{0000}{0000}{0000}{0000}{0000}; #1
  }
\cs_new_protected:Npn \__fp_atan_normal_o:NNnwNnw
    #1 \s__fp \__fp_chk:w 1#2#3#4; \s__fp \__fp_chk:w 1#5#6#7;
  {
    \__fp_atan_test_o:NwwNwwN
      #2 #3, #4{0000}{0000};
      #5 #6, #7{0000}{0000}; #1
  }
\cs_new:Npn \__fp_atan_test_o:NwwNwwN #1#2,#3; #4#5,#6;
  {
    \exp_after:wN \__fp_atan_combine_o:NwwwwwN
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w
      \if_meaning:w 2 #4
        7 - \__fp_int_eval:w
      \fi:
      \if_int_compare:w
          \__fp_ep_compare:wwww #2,#3; #5,#6; > 0 \exp_stop_f:
        3 -
        \exp_after:wN \__fp_reverse_args:Nww
      \fi:
      \__fp_atan_div:wnwwnw #2,#3; #5,#6;
  }
\cs_new:Npn \__fp_atan_div:wnwwnw #1,#2#3; #4,#5#6;
  {
    \if_int_compare:w
      \__fp_int_eval:w 41421 * #5 < #2 000
        \if_case:w \__fp_int_eval:w #4 - #1 \__fp_int_eval_end:
          00 \or: 0 \fi:
      \exp_stop_f:
      \exp_after:wN \__fp_atan_near:wwwn
    \fi:
    0
    \__fp_ep_div:wwwwn #1,{#2}#3; #4,{#5}#6;
    \__fp_atan_auxi:ww
  }
\cs_new:Npn \__fp_atan_near:wwwn
    0 \__fp_ep_div:wwwwn #1,#2; #3,
  {
    1
    \__fp_ep_to_fixed:wwn #1 - #3, #2;
    \__fp_atan_near_aux:wwn
  }
\cs_new:Npn \__fp_atan_near_aux:wwn #1; #2;
  {
    \__fp_fixed_add:wwn #1; #2;
    { \__fp_fixed_sub:wwn #2; #1; { \__fp_ep_div:wwwwn 0, } 0, }
  }
\cs_new:Npn \__fp_atan_auxi:ww #1,#2;
  { \__fp_ep_to_fixed:wwn #1,#2; \__fp_atan_auxii:w #1,#2; }
\cs_new:Npn \__fp_atan_auxii:w #1;
  {
    \__fp_fixed_mul:wwn #1; #1;
    {
      \__fp_atan_Taylor_loop:www 39 ;
        {0000}{0000}{0000}{0000}{0000}{0000} ;
    }
    ! #1;
  }
\cs_new:Npn \__fp_atan_Taylor_loop:www #1; #2; #3;
  {
    \if_int_compare:w #1 = -1 \exp_stop_f:
      \__fp_atan_Taylor_break:w
    \fi:
    \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl #1;
    \__fp_rrot:www \__fp_fixed_mul_sub_back:wwwn #2; #3;
    {
      \exp_after:wN \__fp_atan_Taylor_loop:www
      \int_value:w \__fp_int_eval:w #1 - 2 ;
    }
    #3;
  }
\cs_new:Npn \__fp_atan_Taylor_break:w
    \fi: #1 \__fp_fixed_mul_sub_back:wwwn #2; #3 !
  { \fi: ; #2 ; }
\cs_new:Npn \__fp_atan_combine_o:NwwwwwN #1 #2; #3; #4; #5,#6; #7
  {
    \exp_after:wN \__fp_sanitize:Nw
    \exp_after:wN #1
    \int_value:w \__fp_int_eval:w
      \if_meaning:w 0 #2
        \exp_after:wN \use_i:nn
      \else:
        \exp_after:wN \use_ii:nn
      \fi:
      { #5 \__fp_fixed_mul:wwn #3; #6; }
      {
        \__fp_fixed_mul:wwn #3; #4;
        {
          \exp_after:wN \__fp_atan_combine_aux:ww
          \int_value:w \__fp_int_eval:w #2 / 2 ; #2;
        }
      }
      { #7 \__fp_fixed_to_float_o:wN \__fp_fixed_to_float_rad_o:wN }
      #1
  }
\cs_new:Npn \__fp_atan_combine_aux:ww #1; #2;
  {
    \__fp_fixed_mul_short:wwn
      {7853}{9816}{3397}{4483}{0961}{5661};
      {#1}{0000}{0000};
    {
      \if_int_odd:w #2 \exp_stop_f:
        \exp_after:wN \__fp_fixed_sub:wwn
      \else:
        \exp_after:wN \__fp_fixed_add:wwn
      \fi:
    }
  }
\cs_new:Npn \__fp_asin_o:w #1 \s__fp \__fp_chk:w #2#3; @
  {
    \if_case:w #2 \exp_stop_f:
      \__fp_case_return_same_o:w
    \or:
      \__fp_case_use:nw
        { \__fp_asin_normal_o:NfwNnnnnw #1 { #1 { asin } { asind } } }
    \or:
      \__fp_case_use:nw
        { \__fp_invalid_operation_o:fw { #1 { asin } { asind } } }
    \else:
      \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3;
  }
\cs_new:Npn \__fp_acos_o:w #1 \s__fp \__fp_chk:w #2#3; @
  {
    \if_case:w #2 \exp_stop_f:
      \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 4 }
    \or:
      \__fp_case_use:nw
        {
          \__fp_asin_normal_o:NfwNnnnnw #1 { #1 { acos } { acosd } }
            \__fp_reverse_args:Nww
        }
    \or:
      \__fp_case_use:nw
        { \__fp_invalid_operation_o:fw { #1 { acos } { acosd } } }
    \else:
      \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3;
  }
\cs_new:Npn \__fp_asin_normal_o:NfwNnnnnw
    #1#2#3 \s__fp \__fp_chk:w 1#4#5#6#7#8#9;
  {
    \if_int_compare:w #5 < 1 \exp_stop_f:
      \exp_after:wN \__fp_use_none_until_s:w
    \fi:
    \if_int_compare:w \__fp_int_eval:w #5 + #6#7 + #8#9 = 1000 0001 ~
      \exp_after:wN \__fp_use_none_until_s:w
    \fi:
    \__fp_use_i:ww
    \__fp_invalid_operation_o:fw {#2}
      \s__fp \__fp_chk:w 1#4{#5}{#6}{#7}{#8}{#9};
    \__fp_asin_auxi_o:NnNww
      #1 {#3} #4 #5,{#6}{#7}{#8}{#9}{0000}{0000};
  }
\cs_new:Npn \__fp_asin_auxi_o:NnNww #1#2#3#4,#5;
  {
    \__fp_ep_to_fixed:wwn #4,#5;
    \__fp_asin_isqrt:wn
    \__fp_ep_mul:wwwwn #4,#5;
    \__fp_ep_to_ep:wwN
    \__fp_fixed_continue:wn
    { #2 \__fp_atan_test_o:NwwNwwN #3 }
    0 1,{1000}{0000}{0000}{0000}{0000}{0000}; #1
  }
\cs_new:Npn \__fp_asin_isqrt:wn #1;
  {
    \exp_after:wN \__fp_fixed_sub:wwn \c__fp_one_fixed_tl #1;
    {
      \__fp_fixed_add_one:wN #1;
      \__fp_fixed_continue:wn { \__fp_ep_mul:wwwwn 0, } 0,
    }
    \__fp_ep_isqrt:wwn
  }
\cs_new:Npn \__fp_acsc_o:w #1 \s__fp \__fp_chk:w #2#3#4; @
  {
    \if_case:w \if_meaning:w 2 #2 #3 \fi: #2 \exp_stop_f:
           \__fp_case_use:nw
             { \__fp_invalid_operation_o:fw { #1 { acsc } { acscd } } }
    \or:   \__fp_case_use:nw
             { \__fp_acsc_normal_o:NfwNnw #1 { #1 { acsc } { acscd } } }
    \or:   \__fp_case_return_o:Nw \c_zero_fp
    \or:   \__fp_case_return_same_o:w
    \else: \__fp_case_return_o:Nw \c_minus_zero_fp
    \fi:
    \s__fp \__fp_chk:w #2 #3 #4;
  }
\cs_new:Npn \__fp_asec_o:w #1 \s__fp \__fp_chk:w #2#3; @
  {
    \if_case:w #2 \exp_stop_f:
      \__fp_case_use:nw
        { \__fp_invalid_operation_o:fw { #1 { asec } { asecd } } }
    \or:
      \__fp_case_use:nw
        {
          \__fp_acsc_normal_o:NfwNnw #1 { #1 { asec } { asecd } }
            \__fp_reverse_args:Nww
        }
    \or:   \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 4 }
    \else: \__fp_case_return_same_o:w
    \fi:
    \s__fp \__fp_chk:w #2 #3;
  }
\cs_new:Npn \__fp_acsc_normal_o:NfwNnw #1#2#3 \s__fp \__fp_chk:w 1#4#5#6;
  {
    \int_compare:nNnTF {#5} < 1
      {
        \__fp_invalid_operation_o:fw {#2}
          \s__fp \__fp_chk:w 1#4{#5}#6;
      }
      {
        \__fp_ep_div:wwwwn
          1,{1000}{0000}{0000}{0000}{0000}{0000};
          #5,#6{0000}{0000};
        { \__fp_asin_auxi_o:NnNww #1 {#3} #4 }
      }
  }
%% File: l3fp-convert.dtx
\cs_new:Npn \__fp_tuple_convert:Nw #1 \s__fp_tuple \__fp_tuple_chk:w #2 ;
  {
    \int_case:nnF { \__fp_array_count:n {#2} }
      {
        { 0 } { ( ) }
        { 1 } { \__fp_tuple_convert_end:w @ { #1 #2 , } }
      }
      {
        \__fp_tuple_convert_loop:nNw { } #1
          #2 { ? \__fp_tuple_convert_end:w } ;
          @ { \use_none:nn }
      }
  }
\cs_new:Npn \__fp_tuple_convert_loop:nNw #1#2#3#4; #5 @ #6
  {
    \use_none:n #3
    \exp_args:Nf \__fp_tuple_convert_loop:nNw { #2 #3#4 ; } #2 #5
      @ { #6 , ~ #1 }
  }
\cs_new:Npn \__fp_tuple_convert_end:w #1 @ #2
  { \exp_after:wN ( \exp:w \exp_end_continue_f:w #2 ) }
\cs_new:Npn \__fp_trim_zeros:w #1 ;
  {
    \__fp_trim_zeros_loop:w #1
      ; \__fp_trim_zeros_loop:w 0; \__fp_trim_zeros_dot:w .; \s__fp_stop
  }
\cs_new:Npn \__fp_trim_zeros_loop:w #1 0; #2 { #2 #1 ; #2 }
\cs_new:Npn \__fp_trim_zeros_dot:w #1 .; { \__fp_trim_zeros_end:w #1 ; }
\cs_new:Npn \__fp_trim_zeros_end:w #1 ; #2 \s__fp_stop { #1 }
\cs_new:Npn \fp_to_scientific:N #1
  { \exp_after:wN \__fp_to_scientific_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_scientific:N { c }
\cs_new:Npn \fp_to_scientific:n
  {
    \exp_after:wN \__fp_to_scientific_dispatch:w
    \exp:w \exp_end_continue_f:w \__fp_parse:n
  }
\cs_new:Npn \__fp_to_scientific_dispatch:w #1
  {
    \__fp_change_func_type:NNN
      #1 \__fp_to_scientific:w \__fp_to_scientific_recover:w
    #1
  }
\cs_new:Npn \__fp_to_scientific_recover:w #1 #2 ;
  {
    \__fp_error:nffn { fp-unknown-type } { \tl_to_str:n { #2 ; } } { } { }
    nan
  }
\cs_new:Npn \__fp_tuple_to_scientific:w
  { \__fp_tuple_convert:Nw \__fp_to_scientific_dispatch:w }
\cs_new:Npn \__fp_to_scientific:w \s__fp \__fp_chk:w #1#2
  {
    \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi:
    \if_case:w #1 \exp_stop_f:
         \__fp_case_return:nw { 0.000000000000000e0 }
    \or: \exp_after:wN \__fp_to_scientific_normal:wnnnnn
    \or:
      \__fp_case_use:nw
        {
          \__fp_invalid_operation:nnw
            { \fp_to_scientific:N \c__fp_overflowing_fp }
            { fp_to_scientific }
        }
    \or:
      \__fp_case_use:nw
        {
          \__fp_invalid_operation:nnw
            { \fp_to_scientific:N \c_zero_fp }
            { fp_to_scientific }
        }
    \fi:
    \s__fp \__fp_chk:w #1 #2
  }
\cs_new:Npn \__fp_to_scientific_normal:wnnnnn
  \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ;
  {
    \exp_after:wN \__fp_to_scientific_normal:wNw
    \exp_after:wN e
    \int_value:w \__fp_int_eval:w #2 - 1
    ; #3 #4 #5 #6 ;
  }
\cs_new:Npn \__fp_to_scientific_normal:wNw #1 ; #2#3;
  { #2.#3 #1 }
\cs_new:Npn \fp_to_decimal:N #1
  { \exp_after:wN \__fp_to_decimal_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_decimal:N { c }
\cs_new:Npn \fp_to_decimal:n
  {
    \exp_after:wN \__fp_to_decimal_dispatch:w
    \exp:w \exp_end_continue_f:w \__fp_parse:n
  }
\cs_new:Npn \__fp_to_decimal_dispatch:w #1
  {
    \__fp_change_func_type:NNN
      #1 \__fp_to_decimal:w \__fp_to_decimal_recover:w
    #1
  }
\cs_new:Npn \__fp_to_decimal_recover:w #1 #2 ;
  {
    \__fp_error:nffn { fp-unknown-type } { \tl_to_str:n { #2 ; } } { } { }
    nan
  }
\cs_new:Npn \__fp_tuple_to_decimal:w
  { \__fp_tuple_convert:Nw \__fp_to_decimal_dispatch:w }
\cs_new:Npn \__fp_to_decimal:w \s__fp \__fp_chk:w #1#2
  {
    \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi:
    \if_case:w #1 \exp_stop_f:
         \__fp_case_return:nw { 0 }
    \or: \exp_after:wN \__fp_to_decimal_normal:wnnnnn
    \or:
      \__fp_case_use:nw
        {
          \__fp_invalid_operation:nnw
            { \fp_to_decimal:N \c__fp_overflowing_fp }
            { fp_to_decimal }
        }
    \or:
      \__fp_case_use:nw
        {
          \__fp_invalid_operation:nnw
            { 0 }
            { fp_to_decimal }
        }
    \fi:
    \s__fp \__fp_chk:w #1 #2
  }
\cs_new:Npn \__fp_to_decimal_normal:wnnnnn
    \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ;
  {
    \int_compare:nNnTF {#2} > 0
      {
        \int_compare:nNnTF {#2} < \c__fp_prec_int
          {
            \__fp_decimate:nNnnnn { \c__fp_prec_int - #2 }
              \__fp_to_decimal_large:Nnnw
          }
          {
            \exp_after:wN \exp_after:wN
            \exp_after:wN \__fp_to_decimal_huge:wnnnn
            \prg_replicate:nn { #2 - \c__fp_prec_int } { 0 } ;
          }
        {#3} {#4} {#5} {#6}
      }
      {
        \exp_after:wN \__fp_trim_zeros:w
        \exp_after:wN 0
        \exp_after:wN .
        \exp:w \exp_end_continue_f:w \prg_replicate:nn { - #2 } { 0 }
        #3#4#5#6 ;
      }
  }
\cs_new:Npn \__fp_to_decimal_large:Nnnw #1#2#3#4;
  {
    \exp_after:wN \__fp_trim_zeros:w \int_value:w
      \if_int_compare:w #2 > 0 \exp_stop_f:
        #2
      \fi:
      \exp_stop_f:
      #3.#4 ;
  }
\cs_new:Npn \__fp_to_decimal_huge:wnnnn #1; #2#3#4#5 { #2#3#4#5 #1 }
\cs_new:Npn \fp_to_tl:N #1 { \exp_after:wN \__fp_to_tl_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_tl:N { c }
\cs_new:Npn \fp_to_tl:n
  {
    \exp_after:wN \__fp_to_tl_dispatch:w
    \exp:w \exp_end_continue_f:w \__fp_parse:n
  }
\cs_new:Npn \__fp_to_tl_dispatch:w #1
  { \__fp_change_func_type:NNN #1 \__fp_to_tl:w \__fp_to_tl_recover:w #1 }
\cs_new:Npn \__fp_to_tl_recover:w #1 #2 ;
  {
    \__fp_error:nffn { fp-unknown-type } { \tl_to_str:n { #2 ; } } { } { }
    nan
  }
\cs_new:Npn \__fp_tuple_to_tl:w
  { \__fp_tuple_convert:Nw \__fp_to_tl_dispatch:w }
\cs_new:Npn \__fp_to_tl:w \s__fp \__fp_chk:w #1#2
  {
    \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi:
    \if_case:w #1 \exp_stop_f:
           \__fp_case_return:nw { 0 }
    \or:   \exp_after:wN \__fp_to_tl_normal:nnnnn
    \or:   \__fp_case_return:nw { inf }
    \else: \__fp_case_return:nw { nan }
    \fi:
  }
\cs_new:Npn \__fp_to_tl_normal:nnnnn #1
  {
    \int_compare:nTF
      { -2 <= #1 <= \c__fp_prec_int }
      { \__fp_to_decimal_normal:wnnnnn }
      { \__fp_to_tl_scientific:wnnnnn }
    \s__fp \__fp_chk:w 1 0 {#1}
  }
\cs_new:Npn \__fp_to_tl_scientific:wnnnnn
  \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ;
  {
    \exp_after:wN \__fp_to_tl_scientific:wNw
    \exp_after:wN e
    \int_value:w \__fp_int_eval:w #2 - 1
    ; #3 #4 #5 #6 ;
  }
\cs_new:Npn \__fp_to_tl_scientific:wNw #1 ; #2#3;
  { \__fp_trim_zeros:w #2.#3 ; #1 }
\cs_new:Npn \fp_to_dim:N #1
  { \exp_after:wN \__fp_to_dim_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_dim:N { c }
\cs_new:Npn \fp_to_dim:n
  {
    \exp_after:wN \__fp_to_dim_dispatch:w
    \exp:w \exp_end_continue_f:w \__fp_parse:n
  }
\cs_new:Npn \__fp_to_dim_dispatch:w #1#2 ;
  {
    \__fp_change_func_type:NNN #1 \__fp_to_dim:w \__fp_to_dim_recover:w
    #1 #2 ;
  }
\cs_new:Npn \__fp_to_dim_recover:w #1
  { \__fp_invalid_operation:nnw { 0pt } { fp_to_dim } }
\cs_new:Npn \__fp_to_dim:w #1 ; { \__fp_to_decimal:w #1 ; pt }
\cs_new:Npn \fp_to_int:N #1 { \exp_after:wN \__fp_to_int_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_int:N { c }
\cs_new:Npn \fp_to_int:n
  {
    \exp_after:wN \__fp_to_int_dispatch:w
    \exp:w \exp_end_continue_f:w \__fp_parse:n
  }
\cs_new:Npn \__fp_to_int_dispatch:w #1#2 ;
  {
    \__fp_change_func_type:NNN #1 \__fp_to_int:w \__fp_to_int_recover:w
    #1 #2 ;
  }
\cs_new:Npn \__fp_to_int_recover:w #1
  { \__fp_invalid_operation:nnw { 0 } { fp_to_int } }
\cs_new:Npn \__fp_to_int:w #1;
  {
    \exp_after:wN \__fp_to_decimal:w \exp:w \exp_end_continue_f:w
    \__fp_round:Nwn \__fp_round_to_nearest:NNN #1; { 0 }
  }
\cs_new:Npn \dim_to_fp:n #1
  {
    \exp_after:wN \__fp_from_dim_test:ww
    \exp_after:wN 0
    \exp_after:wN ,
    \int_value:w \tex_glueexpr:D #1 ;
  }
\cs_new:Npn \__fp_from_dim_test:ww #1, #2
  {
    \if_meaning:w 0 #2
      \__fp_case_return:nw { \exp_after:wN \c_zero_fp }
    \else:
      \exp_after:wN \__fp_from_dim:wNw
      \int_value:w \__fp_int_eval:w #1 - 4
        \if_meaning:w - #2
          \exp_after:wN , \exp_after:wN 2 \int_value:w
        \else:
          \exp_after:wN , \exp_after:wN 0 \int_value:w #2
        \fi:
    \fi:
  }
\cs_new:Npn \__fp_from_dim:wNw #1,#2#3;
  {
    \__fp_pack_twice_four:wNNNNNNNN \__fp_from_dim:wNNnnnnnn ;
    #3 000 0000 00 {10}987654321; #2 {#1}
  }
\cs_new:Npn \__fp_from_dim:wNNnnnnnn #1; #2#3#4#5#6#7#8#9
  { \__fp_from_dim:wnnnnwNn #1 {#2#300} {0000} ; }
\cs_new:Npn \__fp_from_dim:wnnnnwNn #1; #2#3#4#5#6; #7#8
  {
    \__fp_mul_npos_o:Nww #7
      \s__fp \__fp_chk:w 1 #7 {#5} #1 ;
      \s__fp \__fp_chk:w 1 0 {#8} {1525} {8789} {0625} {0000} ;
      \prg_do_nothing:
  }
\cs_new_eq:NN \fp_use:N \fp_to_decimal:N
\cs_generate_variant:Nn \fp_use:N { c }
\cs_new_eq:NN \fp_eval:n \fp_to_decimal:n
\cs_new:Npn \fp_sign:n #1
  { \fp_to_decimal:n { sign \__fp_parse:n {#1} } }
\cs_new:Npn \fp_abs:n #1
  { \fp_to_decimal:n { abs \__fp_parse:n {#1} } }
\cs_new:Npn \fp_max:nn #1#2
  { \fp_to_decimal:n { max ( \__fp_parse:n {#1} , \__fp_parse:n {#2} ) } }
\cs_new:Npn \fp_min:nn #1#2
  { \fp_to_decimal:n { min ( \__fp_parse:n {#1} , \__fp_parse:n {#2} ) } }
\cs_new:Npn \__fp_array_to_clist:n #1
  {
    \tl_if_empty:nF {#1}
      {
        \exp_last_unbraced:Ne \use_ii:nn
          {
            \__fp_array_to_clist_loop:Nw #1 { ? \prg_break: } ;
            \prg_break_point:
          }
      }
  }
\cs_new:Npn \__fp_array_to_clist_loop:Nw #1#2;
  {
    \use_none:n #1
    , ~
    \exp_not:f { \__fp_to_tl_dispatch:w #1 #2 ; }
    \__fp_array_to_clist_loop:Nw
  }
%% File: l3fp-random.dtx
\cs_new:Npn \__fp_parse_word_rand:N
  { \__fp_parse_function:NNN \__fp_rand_o:Nw ? }
\cs_new:Npn \__fp_parse_word_randint:N
  { \__fp_parse_function:NNN \__fp_randint_o:Nw ? }
\sys_if_rand_exist:F
  {
    \__kernel_msg_new:nnn { kernel } { fp-no-random }
      { Random~numbers~unavailable~for~#1 }
    \cs_new:Npn \__fp_rand_o:Nw ? #1 @
      {
        \__kernel_msg_expandable_error:nnn { kernel } { fp-no-random }
          { fp~rand }
        \exp_after:wN \c_nan_fp
      }
    \cs_new_eq:NN \__fp_randint_o:Nw \__fp_rand_o:Nw
    \cs_new:Npn \int_rand:nn #1#2
      {
        \__kernel_msg_expandable_error:nnn { kernel } { fp-no-random }
          { \int_rand:nn {#1} {#2} }
        \int_eval:n {#1}
      }
    \cs_new:Npn \int_rand:n #1
      {
        \__kernel_msg_expandable_error:nnn { kernel } { fp-no-random }
          { \int_rand:n {#1} }
        1
      }
  }
\sys_if_rand_exist:T
  {
    \int_const:Nn \c__kernel_randint_max_int { 131071 }
    \cs_new:Npn \__kernel_randint:n #1
      {
        (#1 * \tex_uniformdeviate:D 16384
        + \tex_uniformdeviate:D #1 + 8192 ) / 16384
      }
    \cs_new:Npn \__fp_rand_myriads:n #1
      { \__fp_rand_myriads_loop:w #1 \prg_break: X \prg_break_point: ; }
    \cs_new:Npn \__fp_rand_myriads_loop:w #1 X
      {
        #1
        \exp_after:wN \__fp_rand_myriads_get:w
        \int_value:w \__fp_int_eval:w 9999 +
          \__kernel_randint:n { 10000 }
        \__fp_rand_myriads_loop:w
      }
    \cs_new:Npn \__fp_rand_myriads_get:w 1 #1 ; { ; {#1} }
    \cs_new:Npn \__fp_rand_o:Nw ? #1 @
      {
        \tl_if_empty:nTF {#1}
          {
            \exp_after:wN \__fp_rand_o:w
            \exp:w \exp_end_continue_f:w
            \__fp_rand_myriads:n { XXXX } { 0000 } { 0000 } ; 0
          }
          {
            \__kernel_msg_expandable_error:nnnnn
              { kernel } { fp-num-args } { rand() } { 0 } { 0 }
            \exp_after:wN \c_nan_fp
          }
      }
    \cs_new:Npn \__fp_rand_o:w ;
      {
        \exp_after:wN \__fp_sanitize:Nw
        \exp_after:wN 0
        \int_value:w \__fp_int_eval:w \c_zero_int
          \__fp_fixed_to_float_o:wN
      }
    \cs_new:Npn \__fp_randint_o:Nw ?
      {
        \__fp_parse_function_one_two:nnw
          { randint }
          { \__fp_randint_default:w \__fp_randint_o:w }
      }
    \cs_new:Npn \__fp_randint_default:w #1 { \exp_after:wN #1 \c_one_fp }
    \cs_new:Npn \__fp_randint_badarg:w \s__fp \__fp_chk:w #1#2#3;
      {
        \__fp_int:wTF \s__fp \__fp_chk:w #1#2#3;
          {
            \if_meaning:w 1 #1
              \if_int_compare:w
                  \__fp_use_i_until_s:nw #3 ; > \c__fp_prec_int
                1 \exp_stop_f:
              \fi:
            \fi:
          }
          { 1 \exp_stop_f: }
      }
    \cs_new:Npn \__fp_randint_o:w #1; #2; @
      {
        \if_case:w
            \__fp_randint_badarg:w #1;
            \__fp_randint_badarg:w #2;
            \if:w 1 \__fp_compare_back:ww #2; #1; 1 \exp_stop_f: \fi:
            0 \exp_stop_f:
          \__fp_randint_auxi_o:ww #1; #2;
        \or:
          \__fp_invalid_operation_tl_o:ff
            { randint } { \__fp_array_to_clist:n { #1; #2; } }
          \exp:w
        \fi:
        \exp_after:wN \exp_end:
      }
    \cs_new:Npn \__fp_randint_auxi_o:ww #1 ; #2 ; #3 \exp_end:
      {
        \fi:
        \__fp_randint_auxii:wn #2 ;
        { \__fp_randint_auxii:wn #1 ; \__fp_randint_auxiii_o:ww }
      }
    \cs_new:Npn \__fp_randint_auxii:wn \s__fp \__fp_chk:w #1#2#3#4 ;
      {
        \if_meaning:w 0 #1
          \exp_after:wN \use_i:nn
        \else:
          \exp_after:wN \use_ii:nn
        \fi:
        { \exp_after:wN \__fp_fixed_continue:wn \c__fp_one_fixed_tl }
        {
          \exp_after:wN \__fp_ep_to_fixed:wwn
          \int_value:w \__fp_int_eval:w
            #3 - \c__fp_prec_int , #4 {0000} {0000} ;
          {
            \if_meaning:w 0 #2
              \exp_after:wN \use_i:nnnn
              \exp_after:wN \__fp_fixed_add_one:wN
            \fi:
            \exp_after:wN \__fp_fixed_sub:wwn \c__fp_one_fixed_tl
          }
          \__fp_fixed_continue:wn
        }
      }
    \cs_new:Npn \__fp_randint_auxiii_o:ww #1 ; #2 ;
      {
        \__fp_fixed_add:wwn #2 ;
          {0000} {0000} {0000} {0001} {0000} {0000} ;
        \__fp_fixed_sub:wwn #1 ;
        {
          \exp_after:wN \use_i:nn
          \exp_after:wN \__fp_fixed_mul_add:wwwn
          \exp:w \exp_end_continue_f:w \__fp_rand_myriads:n { XXXXXX } ;
        }
        #1 ;
        \__fp_randint_auxiv_o:ww
        #2 ;
        \__fp_randint_auxv_o:w #1 ; @
      }
    \cs_new:Npn \__fp_randint_auxiv_o:ww #1#2#3#4#5 ; #6#7#8#9
      {
        \if_int_compare:w
            \if_int_compare:w #1#2 > #6#7 \exp_stop_f: 1 \else:
            \if_int_compare:w #1#2 < #6#7 \exp_stop_f: - \fi: \fi:
            #3#4 > #8#9 \exp_stop_f:
          \__fp_use_i_until_s:nw
        \fi:
        \__fp_randint_auxv_o:w {#1}{#2}{#3}{#4}#5
      }
    \cs_new:Npn \__fp_randint_auxv_o:w #1#2#3#4#5 ; #6 @
      {
        \exp_after:wN \__fp_sanitize:Nw
        \int_value:w
        \if_int_compare:w #1 < 10000 \exp_stop_f:
          2
        \else:
          0
          \exp_after:wN \exp_after:wN
          \exp_after:wN \__fp_reverse_args:Nww
        \fi:
        \exp_after:wN \__fp_fixed_sub:wwn \c__fp_one_fixed_tl
        {#1} {#2} {#3} {#4} {0000} {0000} ;
        {
          \exp_after:wN \exp_stop_f:
          \int_value:w \__fp_int_eval:w \c__fp_prec_int
            \__fp_fixed_to_float_o:wN
        }
        0
        \exp:w \exp_after:wN \exp_end:
      }
    \cs_new:Npn \int_rand:nn #1#2
      {
        \int_eval:n
          {
            \exp_after:wN \__fp_randint:ww
            \int_value:w \int_eval:n {#1} \exp_after:wN ;
            \int_value:w \int_eval:n {#2} ;
          }
      }
    \cs_new:Npn \__fp_randint:ww #1; #2;
      {
        \if_int_compare:w #1 > #2 \exp_stop_f:
          \__kernel_msg_expandable_error:nnnn
            { kernel } { randint-backward-range } {#1} {#2}
          \__fp_randint:ww #2; #1;
        \else:
          \if_int_compare:w \__fp_int_eval:w #2
              \if_int_compare:w #1 > \c_zero_int
                - #1 < \__fp_int_eval:w
              \else:
                < \__fp_int_eval:w #1 +
              \fi:
              \c__kernel_randint_max_int
              \__fp_int_eval_end:
            \__kernel_randint:n
              { \__fp_int_eval:w #2 - #1 + 1 \__fp_int_eval_end: }
            - 1 + #1
          \else:
            \__kernel_randint:nn {#1} {#2}
          \fi:
        \fi:
      }
    \cs_new:Npn \__kernel_randint:nn #1#2
      {
        #1
        \exp_after:wN \__fp_randint_wide_aux:w
        \int_value:w
          \exp_after:wN \__fp_randint_split_o:Nw
          \tex_uniformdeviate:D 268435456 ;
        \int_value:w
          \exp_after:wN \__fp_randint_split_o:Nw
          \tex_uniformdeviate:D 268435456 ;
        \int_value:w
          \exp_after:wN \__fp_randint_split_o:Nw
          \int_value:w \__fp_int_eval:w 131072 +
            \exp_after:wN \__fp_randint_split_o:Nw
            \int_value:w
              \__kernel_int_add:nnn {#2} { -#1 } { -\c_max_int } ;
        .
      }
    \cs_new:Npn \__fp_randint_split_o:Nw #1#2 ;
      {
        \if_meaning:w 0 #1
          0 \exp_after:wN ; \int_value:w 0
        \else:
          \exp_after:wN \__fp_randint_split_aux:w
          \int_value:w \__fp_int_eval:w (#1#2 - 8192) / 16384 ;
          + #1#2
        \fi:
        \exp_after:wN ;
      }
    \cs_new:Npn \__fp_randint_split_aux:w #1 ;
      {
        #1 \exp_after:wN ;
        \int_value:w \__fp_int_eval:w - #1 * 16384
      }
    \cs_new:Npn \__fp_randint_wide_aux:w #1;#2; #3;#4; #5;#6;#7; .
      {
        \exp_after:wN \__fp_randint_wide_auxii:w
        \int_value:w \__fp_int_eval:w #5 * #3 + #6 * #1 +
          (#5 * #4 + #6 * #3 + #7 * #1 +
           (#5 * #2 +           #7 * #3 +
            (16384 * #6 + #7) * (16384 * #4 + #2) / 268435456) / 16384
          ) / 16384 \exp_after:wN ;
        \int_value:w \__fp_int_eval:w (#5 + #6) * 16384 + #7 ;
        #1 ; #5 ;
      }
    \cs_new:Npn \__fp_randint_wide_auxii:w #1; #2; #3; #4;
      {
        \if_int_odd:w 0
            \if_int_compare:w #1 = #2 \else: \exp_stop_f: \fi:
            \if_int_compare:w #4 = \c_zero_int 1 \fi:
            \if_int_compare:w #3 = 16383 ~ 1 \fi:
            \exp_stop_f:
          \exp_after:wN \prg_break:
        \fi:
        \if_int_compare:w #4 < 8 \exp_stop_f:
          + #4 * #3 * 16384
        \else:
          + 8 * #3 * 16384 + (#4 - 8) * #3 * 16384
        \fi:
        + #1
        \prg_break_point:
      }
    \cs_new:Npn \int_rand:n #1
      {
        \int_eval:n
          { \exp_args:Nf \__fp_randint:n { \int_eval:n {#1} } }
      }
    \cs_new:Npn \__fp_randint:n #1
      {
        \if_int_compare:w #1 < 1 \exp_stop_f:
          \__kernel_msg_expandable_error:nnnn
            { kernel } { randint-backward-range } { 1 } {#1}
          \__fp_randint:ww #1; 1;
        \else:
          \if_int_compare:w #1 > \c__kernel_randint_max_int
            \__kernel_randint:nn { 1 } {#1}
          \else:
            \__kernel_randint:n {#1}
          \fi:
        \fi:
      }
  }
%% File: l3fparray.dtx

\int_new:N \g__fp_array_int
\int_new:N \l__fp_array_loop_int
\cs_new_protected:Npn \fparray_new:Nn #1#2
  {
    \tl_new:N #1
    \prg_replicate:nn { 3 }
      {
        \int_gincr:N \g__fp_array_int
        \exp_args:NNc \tl_gput_right:Nn #1
          { g__fp_array_ \__fp_int_to_roman:w \g__fp_array_int _intarray }
      }
    \exp_last_unbraced:Nfo \__fp_array_new:nNNNN
      { \int_eval:n {#2} } #1 #1
  }
\cs_generate_variant:Nn \fparray_new:Nn { c }
\cs_new_protected:Npn \__fp_array_new:nNNNN #1#2#3#4#5
  {
    \int_compare:nNnTF {#1} < 0
      {
        \__kernel_msg_error:nnn { kernel } { negative-array-size } {#1}
        \cs_undefine:N #1
        \int_gsub:Nn \g__fp_array_int { 3 }
      }
      {
        \intarray_new:Nn #2 {#1}
        \intarray_new:Nn #3 {#1}
        \intarray_new:Nn #4 {#1}
      }
  }
\cs_new:Npn \fparray_count:N #1
  {
    \exp_after:wN \use_i:nnn
    \exp_after:wN \intarray_count:N #1
  }
\cs_generate_variant:Nn \fparray_count:N { c }
\cs_new:Npn \__fp_array_bounds:NNnTF #1#2#3#4#5
  {
    \if_int_compare:w 1 > #3 \exp_stop_f:
      \__fp_array_bounds_error:NNn #1 #2 {#3}
      #5
    \else:
      \if_int_compare:w #3 > \fparray_count:N #2 \exp_stop_f:
        \__fp_array_bounds_error:NNn #1 #2 {#3}
        #5
      \else:
        #4
      \fi:
    \fi:
  }
\cs_new:Npn \__fp_array_bounds_error:NNn #1#2#3
  {
    #1 { kernel } { out-of-bounds }
      { \token_to_str:N #2 } {#3} { \fparray_count:N #2 }
  }
\cs_new_protected:Npn \fparray_gset:Nnn #1#2#3
  {
    \exp_after:wN \exp_after:wN
    \exp_after:wN \__fp_array_gset:NNNNww
    \exp_after:wN #1
    \exp_after:wN #1
    \int_value:w \int_eval:n {#2} \exp_after:wN ;
    \exp:w \exp_end_continue_f:w \__fp_parse:n {#3}
  }
\cs_generate_variant:Nn \fparray_gset:Nnn { c }
\cs_new_protected:Npn \__fp_array_gset:NNNNww #1#2#3#4#5 ; #6 ;
  {
    \__fp_array_bounds:NNnTF \__kernel_msg_error:nnxxx #4 {#5}
      {
        \exp_after:wN \__fp_change_func_type:NNN
          \__fp_use_i_until_s:nw #6 ;
          \__fp_array_gset:w
          \__fp_array_gset_recover:Nw
        #6 ; {#5} #1 #2 #3
      }
      { }
  }
\cs_new_protected:Npn \__fp_array_gset_recover:Nw #1#2 ;
  {
    \__fp_error:nffn { fp-unknown-type } { \tl_to_str:n { #2 ; } } { } { }
    \exp_after:wN #1 \c_nan_fp
  }
\cs_new_protected:Npn \__fp_array_gset:w \s__fp \__fp_chk:w #1#2
  {
    \if_case:w #1 \exp_stop_f:
         \__fp_case_return:nw { \__fp_array_gset_special:nnNNN {#2} }
    \or: \exp_after:wN \__fp_array_gset_normal:w
    \or: \__fp_case_return:nw { \__fp_array_gset_special:nnNNN { #2 3 } }
    \or: \__fp_case_return:nw { \__fp_array_gset_special:nnNNN { 1 } }
    \fi:
    \s__fp \__fp_chk:w #1 #2
  }
\cs_new_protected:Npn \__fp_array_gset_normal:w
  \s__fp \__fp_chk:w 1 #1 #2 #3#4#5 ; #6#7#8#9
  {
    \__kernel_intarray_gset:Nnn #7 {#6} {#2}
    \__kernel_intarray_gset:Nnn #8 {#6}
      { \if_meaning:w 2 #1 3 \else: 1 \fi: #3#4 }
    \__kernel_intarray_gset:Nnn #9 {#6} { 1 \use:nn #5 }
  }
\cs_new_protected:Npn \__fp_array_gset_special:nnNNN #1#2#3#4#5
  {
    \__kernel_intarray_gset:Nnn #3 {#2} {#1}
    \__kernel_intarray_gset:Nnn #4 {#2} {0}
    \__kernel_intarray_gset:Nnn #5 {#2} {0}
  }
\cs_new_protected:Npn \fparray_gzero:N #1
  {
    \int_zero:N \l__fp_array_loop_int
    \prg_replicate:nn { \fparray_count:N #1 }
      {
        \int_incr:N \l__fp_array_loop_int
        \exp_after:wN \__fp_array_gset_special:nnNNN
        \exp_after:wN 0
        \exp_after:wN \l__fp_array_loop_int
        #1
      }
  }
\cs_generate_variant:Nn \fparray_gzero:N { c }
\cs_new:Npn \fparray_item:Nn #1#2
  {
    \exp_after:wN \__fp_array_item:NwN
    \exp_after:wN #1
    \int_value:w \int_eval:n {#2} ;
    \__fp_to_decimal:w
  }
\cs_generate_variant:Nn \fparray_item:Nn { c }
\cs_new:Npn \fparray_item_to_tl:Nn #1#2
  {
    \exp_after:wN \__fp_array_item:NwN
    \exp_after:wN #1
    \int_value:w \int_eval:n {#2} ;
    \__fp_to_tl:w
  }
\cs_generate_variant:Nn \fparray_item_to_tl:Nn { c }
\cs_new:Npn \__fp_array_item:NwN #1#2 ; #3
  {
    \__fp_array_bounds:NNnTF \__kernel_msg_expandable_error:nnfff #1 {#2}
      { \exp_after:wN \__fp_array_item:NNNnN #1 {#2} #3 }
      { \exp_after:wN #3 \c_nan_fp }
  }
\cs_new:Npn \__fp_array_item:NNNnN #1#2#3#4
  {
    \exp_after:wN \__fp_array_item:N
    \int_value:w \__kernel_intarray_item:Nn #2 {#4} \exp_after:wN ;
    \int_value:w \__kernel_intarray_item:Nn #3 {#4} \exp_after:wN ;
    \int_value:w \__kernel_intarray_item:Nn #1 {#4} ;
  }
\cs_new:Npn \__fp_array_item:N #1
  {
    \if_meaning:w 0 #1 \exp_after:wN \__fp_array_item_special:w \fi:
    \__fp_array_item:w #1
  }
\cs_new:Npn \__fp_array_item:w #1 #2#3#4#5 #6 ; 1 #7 ;
  {
    \exp_after:wN \__fp_array_item_normal:w
    \int_value:w \if_meaning:w #1 1 0 \else: 2 \fi: \exp_stop_f:
    #7 ; {#2#3#4#5} {#6} ;
  }
\cs_new:Npn \__fp_array_item_special:w #1 ; #2 ; #3 ; #4
  {
    \exp_after:wN #4
    \exp:w \exp_end_continue_f:w
    \if_case:w #3 \exp_stop_f:
         \exp_after:wN \c_zero_fp
    \or: \exp_after:wN \c_nan_fp
    \or: \exp_after:wN \c_minus_zero_fp
    \or: \exp_after:wN \c_inf_fp
    \else: \exp_after:wN \c_minus_inf_fp
    \fi:
  }
\cs_new:Npn \__fp_array_item_normal:w #1 #2#3#4#5 #6 ; #7 ; #8 ; #9
  { #9 \s__fp \__fp_chk:w 1 #1 {#8} #7 {#2#3#4#5} {#6} ; }
%% File: l3cctab.dtx
\seq_new:N \g__cctab_stack_seq
\seq_new:N \g__cctab_unused_seq
\seq_new:N \g__cctab_group_seq
\int_new:N  \g__cctab_allocate_int
\tl_new:N \l__cctab_internal_a_tl
\tl_new:N \l__cctab_internal_b_tl
\prop_new:N \g__cctab_endlinechar_prop
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Npn \cctab_new:N #1
      {
        \__kernel_chk_if_free_cs:N #1
        \__cctab_new:N #1
      }
    \cs_new_protected:Npn \__cctab_new:N #1
      {
        \newcatcodetable #1
        \tex_initcatcodetable:D #1
      }
  }
  {
    \cs_new_protected:Npn \__cctab_new:N #1
      { \intarray_new:Nn #1 { 257 } }
    \cs_new_protected:Npn \__cctab_gstore:Nnn #1#2#3
      { \intarray_gset:Nnn #1 { \int_eval:n { #2 + 1 } } {#3} }
    \cs_new_protected:Npn \cctab_new:N #1
      {
        \__kernel_chk_if_free_cs:N #1
        \__cctab_new:N #1
        \int_step_inline:nn { 256 }
          { \__kernel_intarray_gset:Nnn #1 {##1} { 12 } }
        \__kernel_intarray_gset:Nnn #1 { 257 } { 13 }
        \__cctab_gstore:Nnn #1 { 0 } { 9 }
        \__cctab_gstore:Nnn #1 { 13 } { 5 }
        \__cctab_gstore:Nnn #1 { 32 } { 10 }
        \__cctab_gstore:Nnn #1 { 37 } { 14 }
        \int_step_inline:nnn { 65 } { 90 }
          { \__cctab_gstore:Nnn #1 {##1} { 11 } }
        \__cctab_gstore:Nnn #1 { 92 } { 0 }
        \int_step_inline:nnn { 97 } { 122 }
          { \__cctab_gstore:Nnn #1 {##1} { 11 } }
        \__cctab_gstore:Nnn #1 { 127 } { 15 }
      }
  }
\cs_generate_variant:Nn \cctab_new:N { c }
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Npn \__cctab_gset:n #1
      { \exp_args:Nf \__cctab_gset_aux:n { \int_eval:n {#1} } }
    \cs_new_protected:Npn \__cctab_gset_aux:n #1
      {
        \tex_savecatcodetable:D #1 \scan_stop:
        \int_compare:nNnTF { \tex_endlinechar:D } = { 13 }
          { \prop_gremove:Nn \g__cctab_endlinechar_prop {#1} }
          {
            \prop_gput:NnV \g__cctab_endlinechar_prop {#1}
              \tex_endlinechar:D
          }
      }
  }
  {
    \cs_new_protected:Npn \__cctab_gset:n #1
      {
        \int_step_inline:nn { 256 }
          {
            \__kernel_intarray_gset:Nnn #1 {##1}
              { \char_value_catcode:n { ##1 - 1 } }
          }
        \__kernel_intarray_gset:Nnn #1 { 257 }
          { \tex_endlinechar:D }
      }
  }
\cs_new_protected:Npn \cctab_gset:Nn #1#2
  {
    \__cctab_chk_if_valid:NT #1
      {
        \group_begin:
          \cctab_select:N \c_initex_cctab
          #2 \scan_stop:
          \__cctab_gset:n {#1}
        \group_end:
      }
  }
\cs_generate_variant:Nn \cctab_gset:Nn { c }
\sys_if_engine_luatex:T
  {
    \__cctab_new:N \g__cctab_internal_cctab
    \cs_new:Npn \__cctab_internal_cctab_name:
      {
        g__cctab_internal
        \tex_romannumeral:D \tex_currentgrouplevel:D
        _cctab
      }
  }
\cs_new_protected:Npn \cctab_select:N #1
  { \__cctab_chk_if_valid:NT #1 { \__cctab_select:N #1 } }
\cs_generate_variant:Nn \cctab_select:N { c }
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Npn \__cctab_select:N #1
      {
        \tex_catcodetable:D #1
        \prop_get:NVNTF \g__cctab_endlinechar_prop #1 \l__cctab_internal_a_tl
          { \int_set:Nn \tex_endlinechar:D { \l__cctab_internal_a_tl } }
          { \int_set:Nn \tex_endlinechar:D { 13 } }
        \cs_if_exist:cF { \__cctab_internal_cctab_name: }
          { \exp_args:Nc \__cctab_new:N { \__cctab_internal_cctab_name: } }
        \exp_args:Nc \tex_savecatcodetable:D { \__cctab_internal_cctab_name: }
        \exp_args:Nc \tex_catcodetable:D { \__cctab_internal_cctab_name: }
      }
  }
  {
    \cs_new_protected:Npn \__cctab_select:N #1
      {
        \int_step_inline:nn { 256 }
          {
            \char_set_catcode:nn { ##1 - 1 }
              { \__kernel_intarray_item:Nn #1 {##1} }
          }
        \int_set:Nn \tex_endlinechar:D
          { \__kernel_intarray_item:Nn #1 { 257 } }
      }
  }
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Npn \__cctab_begin_aux:
      {
        \__cctab_new:N \g__cctab_next_cctab
        \tl_set:NV \l__cctab_internal_a_tl \g__cctab_next_cctab
        \cs_undefine:N \g__cctab_next_cctab
      }
  }
  {
    \cs_new_protected:Npn \__cctab_begin_aux:
      {
        \int_gincr:N \g__cctab_allocate_int
        \exp_args:Nc \__cctab_new:N
          { g__cctab_ \int_use:N \g__cctab_allocate_int _cctab }
        \exp_args:NNc \tl_set:Nn \l__cctab_internal_a_tl
          { g__cctab_ \int_use:N \g__cctab_allocate_int _cctab }
      }
  }
\cs_new_protected:Npn \cctab_begin:N #1
  {
    \__cctab_chk_if_valid:NT #1
      {
        \seq_gpop:NNF \g__cctab_unused_seq \l__cctab_internal_a_tl
          { \__cctab_begin_aux: }
        \exp_args:Nx \__cctab_chk_group_begin:n
          { \__cctab_nesting_number:N \l__cctab_internal_a_tl }
        \seq_gpush:NV \g__cctab_stack_seq \l__cctab_internal_a_tl
        \exp_args:NV \__cctab_gset:n \l__cctab_internal_a_tl
        \__cctab_select:N #1
      }
  }
\cs_generate_variant:Nn \cctab_begin:N { c }
\cs_new_protected:Npn \cctab_end:
  {
    \seq_gpop:NNTF \g__cctab_stack_seq \l__cctab_internal_a_tl
      {
        \seq_gpush:NV \g__cctab_unused_seq \l__cctab_internal_a_tl
        \exp_args:Nx \__cctab_chk_group_end:n
          { \__cctab_nesting_number:N \l__cctab_internal_a_tl }
        \__cctab_select:N \l__cctab_internal_a_tl
      }
      { \__kernel_msg_error:nn { kernel } { cctab-extra-end } }
  }
\cs_new_protected:Npn \__cctab_chk_group_begin:n #1
  {
    \seq_gpush:Nx \g__cctab_group_seq
      { \int_use:N \tex_currentgrouplevel:D }
    \cs_set_eq:cN { __cctab_group_ #1 _chk: } \prg_do_nothing:
  }
\cs_new_protected:Npn \__cctab_chk_group_end:n #1
  {
    \seq_gpop:NN \g__cctab_group_seq \l__cctab_internal_b_tl
    \bool_lazy_and:nnF
      {
        \int_compare_p:nNn
          { \tex_currentgrouplevel:D } = { \l__cctab_internal_b_tl }
      }
      { \cs_if_exist_p:c { __cctab_group_ #1 _chk: } }
      {
        \__kernel_msg_error:nnx { kernel } { cctab-group-mismatch }
          {
            \int_sign:n
              { \tex_currentgrouplevel:D - \l__cctab_internal_b_tl }
          }
      }
    \cs_undefine:c { __cctab_group_ #1 _chk: }
  }
\sys_if_engine_luatex:TF
  { \cs_new:Npn \__cctab_nesting_number:N #1 {#1} }
  {
    \cs_new:Npn \__cctab_nesting_number:N #1
      {
        \exp_after:wN \exp_after:wN \exp_after:wN \__cctab_nesting_number:w
          \exp_after:wN \token_to_str:N #1
      }
    \use:x
      {
        \cs_new:Npn \exp_not:N \__cctab_nesting_number:w
          ##1 \tl_to_str:n { g__cctab_ } ##2 \tl_to_str:n { _cctab } {##2}
      }
  }
\cs_if_exist:NT \hook_gput_code:nnn
  {
    \hook_gput_code:nnn { enddocument/end } { kernel }
      {
        \seq_if_empty:NF \g__cctab_stack_seq
          { \__kernel_msg_error:nn { kernel } { cctab-missing-end } }
      }
  }
\prg_new_eq_conditional:NNn \cctab_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \cctab_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\prg_new_protected_conditional:Npnn \__cctab_chk_if_valid:N #1
  { TF , T , F }
  {
    \cctab_if_exist:NTF #1
      {
        \__cctab_chk_if_valid_aux:NTF #1
          { \prg_return_true: }
          {
            \__kernel_msg_error:nnx { kernel } { invalid-cctab }
              { \token_to_str:N #1 }
            \prg_return_false:
          }
      }
      {
        \__kernel_msg_error:nnx { kernel } { command-not-defined }
          { \token_to_str:N #1 }
        \prg_return_false:
      }
  }
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Npn \__cctab_chk_if_valid_aux:NTF #1
      {
        \int_compare:nNnTF {#1-1} < { \e@alloc@ccodetable@count }
      }
    \cs_if_exist:NT \c_syst_catcodes_n
      {
        \cs_gset_protected:Npn \__cctab_chk_if_valid_aux:NTF #1
          {
            \int_compare:nTF { #1 <= \c_syst_catcodes_n }
          }
      }
  }
  {
    \cs_new_protected:Npn \__cctab_chk_if_valid_aux:NTF #1
      {
        \exp_args:Nf \str_if_in:nnTF
          { \cs_meaning:N #1 }
          { select~font~cmr10~at~ }
      }
  }
\cs_new_protected:Npn \cctab_const:Nn #1#2
  {
    \cctab_new:N #1
    \cctab_gset:Nn #1 {#2}
  }
\cs_generate_variant:Nn \cctab_const:Nn { c }
\cctab_new:N \c_initex_cctab
\cctab_const:Nn \c_other_cctab
  {
    \cctab_select:N \c_initex_cctab
    \int_set:Nn \tex_endlinechar:D     { -1 }
    \int_step_inline:nnn { 0 } { 127 }
      { \char_set_catcode_other:n {#1} }
  }
\cctab_const:Nn \c_str_cctab
  {
    \cctab_select:N \c_other_cctab
    \char_set_catcode_space:n { 32 }
  }
\cs_if_exist:NTF \@expl@finalise@setup@@
  { \tl_gput_right:Nn \@expl@finalise@setup@@ }
  { \use:n }
  {
    \__cctab_new:N \c_code_cctab
    \group_begin:
      \int_set:Nn \tex_endlinechar:D { 32 }
      \char_set_catcode_invalid:n { 0 }
      \bool_lazy_or:nnTF
        { \sys_if_engine_xetex_p: } { \sys_if_engine_luatex_p: }
        { \int_step_function:nN { 31 } \char_set_catcode_invalid:n }
        { \int_step_function:nN { 31 } \char_set_catcode_active:n }
      \int_step_function:nnN { 33 } { 64 } \char_set_catcode_other:n
      \int_step_function:nnN { 65 } { 90 } \char_set_catcode_letter:n
      \int_step_function:nnN { 91 } { 96 } \char_set_catcode_other:n
      \int_step_function:nnN { 97 } { 122 } \char_set_catcode_letter:n
      \char_set_catcode_ignore:n           { 9 }   % tab
      \char_set_catcode_other:n            { 10 }  % lf
      \char_set_catcode_active:n           { 12 }  % ff
      \char_set_catcode_end_line:n         { 13 }  % cr
      \char_set_catcode_ignore:n           { 32 }  % space
      \char_set_catcode_parameter:n        { 35 }  % hash
      \char_set_catcode_math_toggle:n      { 36 }  % dollar
      \char_set_catcode_comment:n          { 37 }  % percent
      \char_set_catcode_alignment:n        { 38 }  % ampersand
      \char_set_catcode_letter:n           { 58 }  % colon
      \char_set_catcode_escape:n           { 92 }  % backslash
      \char_set_catcode_math_superscript:n { 94 }  % circumflex
      \char_set_catcode_letter:n           { 95 }  % underscore
      \char_set_catcode_group_begin:n      { 123 } % left brace
      \char_set_catcode_other:n            { 124 } % pipe
      \char_set_catcode_group_end:n        { 125 } % right brace
      \char_set_catcode_space:n            { 126 } % tilde
      \char_set_catcode_invalid:n          { 127 } % ^^?
      \bool_lazy_or:nnF
        { \sys_if_engine_xetex_p: } { \sys_if_engine_luatex_p: }
        { \int_step_function:nnN { 128 } { 255 } \char_set_catcode_active:n }
      \__cctab_gset:n { \c_code_cctab }
    \group_end:
    \cctab_const:Nn \c_document_cctab
      {
        \cctab_select:N \c_code_cctab
        \int_set:Nn \tex_endlinechar:D { 13 }
        \char_set_catcode_space:n          { 9 }
        \char_set_catcode_space:n          { 32 }
        \char_set_catcode_other:n          { 58 }
        \char_set_catcode_math_subscript:n { 95 }
        \char_set_catcode_active:n         { 126 }
      }
  }
\__kernel_msg_new:nnnn { kernel } { cctab-stack-full }
  { The~category~code~table~stack~is~exhausted. }
  {
    LaTeX~has~been~asked~to~switch~to~a~new~category~code~table,~
    but~there~is~no~more~space~to~do~this!
  }
\__kernel_msg_new:nnnn { kernel } { cctab-extra-end }
  { Extra~\iow_char:N\\cctab_end:~ignored~\msg_line_context:. }
  {
    LaTeX~came~across~a~\iow_char:N\\cctab_end:~without~a~matching~
    \iow_char:N\\cctab_begin:N.~This~command~will~be~ignored.
  }
\__kernel_msg_new:nnnn { kernel } { cctab-missing-end }
  { Missing~\iow_char:N\\cctab_end:~before~end~of~TeX~run. }
  {
    LaTeX~came~across~more~\iow_char:N\\cctab_begin:N~than~
    \iow_char:N\\cctab_end:.
  }
\__kernel_msg_new:nnnn { kernel } { invalid-cctab }
  { Invalid~\iow_char:N\\catcode~table. }
  {
    You~can~only~switch~to~a~\iow_char:N\\catcode~table~that~is~
    initialized~using~\iow_char:N\\cctab_new:N~or~
    \iow_char:N\\cctab_const:Nn.
  }
\__kernel_msg_new:nnnn { kernel } { cctab-group-mismatch }
  {
    \iow_char:N\\cctab_end:~occurred~in~a~
    \int_case:nn {#1}
      {
        { 0 } { different~group }
        { 1 } { higher~group~level }
        { -1 } { lower~group~level }
      } ~than~
    the~matching~\iow_char:N\\cctab_begin:N.
  }
  {
    Catcode~tables~and~groups~must~be~properly~nested,~but~
    you~tried~to~interleave~them.~LaTeX~will~try~to~proceed,~
    but~results~may~be~unexpected.
  }
%% File l3sort.dtx
\seq_new:N \g__sort_internal_seq
\tl_new:N \g__sort_internal_tl
\int_new:N \l__sort_length_int
\int_new:N \l__sort_min_int
\int_new:N \l__sort_top_int
\int_new:N \l__sort_max_int
\int_new:N \l__sort_true_max_int
\int_new:N \l__sort_block_int
\int_new:N \l__sort_begin_int
\int_new:N \l__sort_end_int
\int_new:N \l__sort_A_int
\int_new:N \l__sort_B_int
\int_new:N \l__sort_C_int
\scan_new:N \s__sort_mark
\scan_new:N \s__sort_stop
\cs_new_protected:Npn \__sort_shrink_range:
  {
    \int_set:Nn \l__sort_A_int
      { \l__sort_true_max_int - \l__sort_min_int + 1 }
    \int_set:Nn \l__sort_block_int { \c_max_register_int / 2 }
    \__sort_shrink_range_loop:
    \int_set:Nn \l__sort_max_int
      {
        \int_compare:nNnTF
          { \l__sort_block_int * 3 / 2 } > \l__sort_A_int
          {
            \l__sort_min_int
            + ( \l__sort_A_int - 1 ) / 2
            + \l__sort_block_int / 4
            - 1
          }
          { \l__sort_true_max_int - \l__sort_block_int / 2 }
      }
  }
\cs_new_protected:Npn \__sort_shrink_range_loop:
  {
    \if_int_compare:w \l__sort_A_int < \l__sort_block_int
      \tex_divide:D \l__sort_block_int 2 \exp_stop_f:
      \exp_after:wN \__sort_shrink_range_loop:
    \fi:
  }
\cs_new_protected:Npn \__sort_compute_range:
  {
    \int_set:Nn \l__sort_min_int { \tex_count:D 15 + 1 }
    \int_set:Nn \l__sort_true_max_int { \c_max_register_int + 1 }
    \__sort_shrink_range:
    \if_meaning:w \loctoks \tex_undefined:D \else:
      \if_meaning:w \loctoks \scan_stop: \else:
        \__sort_redefine_compute_range:
        \__sort_compute_range:
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__sort_redefine_compute_range:
  {
    \cs_if_exist:cTF { ver@elocalloc.sty }
      {
        \cs_gset_protected:Npn \__sort_compute_range:
          {
            \int_set:Nn \l__sort_min_int { \tex_count:D 265 }
            \int_set_eq:NN \l__sort_true_max_int \e@alloc@top
            \__sort_shrink_range:
          }
      }
      {
        \cs_gset_protected:Npn \__sort_compute_range:
          {
            \int_set:Nn \l__sort_min_int { \tex_count:D 265 }
            \int_set:Nn \l__sort_true_max_int { \tex_count:D 275 }
            \__sort_shrink_range:
          }
      }
  }
\cs_if_exist:NT \loctoks { \__sort_redefine_compute_range: }
\tl_map_inline:nn { \lastallocatedtoks \c_syst_last_allocated_toks }
  {
    \cs_if_exist:NT #1
      {
        \cs_gset_protected:Npn \__sort_compute_range:
          {
            \int_set:Nn \l__sort_min_int { #1 + 1 }
            \int_set:Nn \l__sort_true_max_int { \c_max_register_int + 1 }
            \__sort_shrink_range:
          }
      }
  }
\cs_new_protected:Npn \__sort_main:NNNn #1#2#3#4
  {
    \__sort_disable_toksdef:
    \__sort_compute_range:
    \int_set_eq:NN \l__sort_top_int \l__sort_min_int
    #1 #3
      {
        \if_int_compare:w \l__sort_top_int = \l__sort_max_int
          \__sort_too_long_error:NNw #2 #3
        \fi:
        \tex_toks:D \l__sort_top_int {##1}
        \int_incr:N \l__sort_top_int
      }
    \int_set:Nn \l__sort_length_int
      { \l__sort_top_int - \l__sort_min_int }
    \cs_set:Npn \__sort_compare:nn ##1 ##2 {#4}
    \int_set:Nn \l__sort_block_int { 1 }
    \__sort_level:
  }
\cs_new_protected:Npn \tl_sort:Nn { \__sort_tl:NNn \tl_set_eq:NN }
\cs_generate_variant:Nn \tl_sort:Nn { c }
\cs_new_protected:Npn \tl_gsort:Nn { \__sort_tl:NNn \tl_gset_eq:NN }
\cs_generate_variant:Nn \tl_gsort:Nn { c }
\cs_new_protected:Npn \__sort_tl:NNn #1#2#3
  {
    \group_begin:
      \__sort_main:NNNn \tl_map_inline:Nn \tl_map_break:n #2 {#3}
      \__kernel_tl_gset:Nx \g__sort_internal_tl
        { \__sort_tl_toks:w \l__sort_min_int ; }
    \group_end:
    #1 #2 \g__sort_internal_tl
    \tl_gclear:N \g__sort_internal_tl
    \prg_break_point:
  }
\cs_new:Npn \__sort_tl_toks:w #1 ;
  {
    \if_int_compare:w #1 < \l__sort_top_int
      { \tex_the:D \tex_toks:D #1 }
      \exp_after:wN \__sort_tl_toks:w
      \int_value:w \int_eval:n { #1 + 1 } \exp_after:wN ;
    \fi:
  }
\cs_new_protected:Npn \seq_sort:Nn
  { \__sort_seq:NNNNn \seq_map_inline:Nn \seq_map_break:n \seq_set_eq:NN }
\cs_generate_variant:Nn \seq_sort:Nn { c }
\cs_new_protected:Npn \seq_gsort:Nn
  { \__sort_seq:NNNNn \seq_map_inline:Nn \seq_map_break:n \seq_gset_eq:NN }
\cs_generate_variant:Nn \seq_gsort:Nn { c }
\cs_new_protected:Npn \clist_sort:Nn
  {
    \__sort_seq:NNNNn \clist_map_inline:Nn \clist_map_break:n
      \clist_set_from_seq:NN
  }
\cs_generate_variant:Nn \clist_sort:Nn { c }
\cs_new_protected:Npn \clist_gsort:Nn
  {
    \__sort_seq:NNNNn \clist_map_inline:Nn \clist_map_break:n
      \clist_gset_from_seq:NN
  }
\cs_generate_variant:Nn \clist_gsort:Nn { c }
\cs_new_protected:Npn \__sort_seq:NNNNn #1#2#3#4#5
  {
    \group_begin:
      \__sort_main:NNNn #1 #2 #4 {#5}
      \seq_gset_from_inline_x:Nnn \g__sort_internal_seq
        {
          \int_step_function:nnN
            { \l__sort_min_int } { \l__sort_top_int - 1 }
        }
        { \tex_the:D \tex_toks:D ##1 }
    \group_end:
    #3 #4 \g__sort_internal_seq
    \seq_gclear:N \g__sort_internal_seq
    \prg_break_point:
  }
\cs_new_protected:Npn \__sort_level:
  {
    \if_int_compare:w \l__sort_block_int < \l__sort_length_int
      \l__sort_end_int \l__sort_min_int
      \__sort_merge_blocks:
      \tex_advance:D \l__sort_block_int \l__sort_block_int
      \exp_after:wN \__sort_level:
    \fi:
  }
\cs_new_protected:Npn \__sort_merge_blocks:
  {
    \l__sort_begin_int \l__sort_end_int
    \tex_advance:D \l__sort_end_int \l__sort_block_int
    \if_int_compare:w \l__sort_end_int < \l__sort_top_int
      \l__sort_A_int \l__sort_end_int
      \tex_advance:D \l__sort_end_int \l__sort_block_int
      \if_int_compare:w \l__sort_end_int > \l__sort_top_int
        \l__sort_end_int \l__sort_top_int
      \fi:
      \l__sort_B_int \l__sort_A_int
      \l__sort_C_int \l__sort_top_int
      \__sort_copy_block:
      \int_decr:N \l__sort_A_int
      \int_decr:N \l__sort_B_int
      \int_decr:N \l__sort_C_int
      \exp_after:wN \__sort_merge_blocks_aux:
      \exp_after:wN \__sort_merge_blocks:
    \fi:
  }
\cs_new_protected:Npn \__sort_copy_block:
  {
    \tex_toks:D \l__sort_C_int \tex_toks:D \l__sort_B_int
    \int_incr:N \l__sort_C_int
    \int_incr:N \l__sort_B_int
    \if_int_compare:w \l__sort_B_int = \l__sort_end_int
      \use_i:nn
    \fi:
    \__sort_copy_block:
  }
\cs_new_protected:Npn \__sort_merge_blocks_aux:
  {
    \exp_after:wN \__sort_compare:nn \exp_after:wN
      { \tex_the:D \tex_toks:D \exp_after:wN \l__sort_A_int \exp_after:wN }
      \exp_after:wN { \tex_the:D \tex_toks:D \l__sort_C_int }
    \prg_do_nothing:
    \__sort_return_mark:w
    \__sort_return_mark:w
    \s__sort_mark
    \__sort_return_none_error:
  }
\cs_new_protected:Npn \sort_return_same:
    #1 \__sort_return_mark:w #2 \s__sort_mark
  {
    #1
    #2
    \__sort_return_two_error:
    \__sort_return_mark:w
    \s__sort_mark
    \__sort_return_same:w
  }
\cs_new_protected:Npn \sort_return_swapped:
    #1 \__sort_return_mark:w #2 \s__sort_mark
  {
    #1
    #2
    \__sort_return_two_error:
    \__sort_return_mark:w
    \s__sort_mark
    \__sort_return_swapped:w
  }
\cs_new_protected:Npn \__sort_return_mark:w #1 \s__sort_mark { }
\cs_new_protected:Npn \__sort_return_none_error:
  {
    \__kernel_msg_error:nnxx { kernel } { return-none }
      { \tex_the:D \tex_toks:D \l__sort_A_int }
      { \tex_the:D \tex_toks:D \l__sort_C_int }
    \__sort_return_same:w \__sort_return_none_error:
  }
\cs_new_protected:Npn \__sort_return_two_error:
  {
    \__kernel_msg_error:nnxx { kernel } { return-two }
      { \tex_the:D \tex_toks:D \l__sort_A_int }
      { \tex_the:D \tex_toks:D \l__sort_C_int }
  }
\cs_new_protected:Npn \__sort_return_same:w #1 \__sort_return_none_error:
  {
    \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int
    \int_decr:N \l__sort_B_int
    \int_decr:N \l__sort_C_int
    \if_int_compare:w \l__sort_C_int < \l__sort_top_int
      \use_i:nn
    \fi:
    \__sort_merge_blocks_aux:
  }
\cs_new_protected:Npn \__sort_return_swapped:w #1 \__sort_return_none_error:
  {
    \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_A_int
    \int_decr:N \l__sort_B_int
    \int_decr:N \l__sort_A_int
    \if_int_compare:w \l__sort_A_int < \l__sort_begin_int
      \__sort_merge_blocks_end: \use_i:nn
    \fi:
    \__sort_merge_blocks_aux:
  }
\cs_new_protected:Npn \__sort_merge_blocks_end:
  {
    \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int
    \int_decr:N \l__sort_B_int
    \int_decr:N \l__sort_C_int
    \if_int_compare:w \l__sort_B_int < \l__sort_begin_int
      \use_i:nn
    \fi:
    \__sort_merge_blocks_end:
  }
\cs_new:Npn \tl_sort:nN #1#2
  {
    \exp_not:f
      {
        \tl_if_blank:nF {#1}
          {
            \__sort_quick_prepare:Nnnn #2 { } { }
              #1
              { \prg_break_point: \__sort_quick_prepare_end:NNNnw }
            \s__sort_stop
          }
      }
  }
\cs_new:Npn \__sort_quick_prepare:Nnnn #1#2#3#4
  {
    \prg_break: #4 \prg_break_point:
    \__sort_quick_prepare:Nnnn #1 { #2 #3 } { #1 {#4} }
  }
\cs_new:Npn \__sort_quick_prepare_end:NNNnw #1#2#3#4#5 \s__sort_stop
  {
    \__sort_quick_split:NnNn #4 \__sort_quick_end:nnTFNn { }
    \s__sort_mark { \__sort_quick_cleanup:w \exp_stop_f: }
    \s__sort_mark \s__sort_stop
  }
\cs_new:Npn \__sort_quick_cleanup:w #1 \s__sort_mark \s__sort_stop {#1}
\cs_new:Npn \__sort_quick_split:NnNn #1#2#3#4
  {
    #3 {#2} {#4} \__sort_quick_only_ii:NnnnnNn
      \__sort_quick_only_i:NnnnnNn
      \__sort_quick_single_end:nnnwnw
      { #3 {#4} } { } { } {#2}
  }
\cs_new:Npn \__sort_quick_only_i:NnnnnNn #1#2#3#4#5#6#7
  {
    #6 {#5} {#7} \__sort_quick_split_ii:NnnnnNn
      \__sort_quick_only_i:NnnnnNn
      \__sort_quick_only_i_end:nnnwnw
      { #6 {#7} } { #3 #2 } { } {#5}
  }
\cs_new:Npn \__sort_quick_only_ii:NnnnnNn #1#2#3#4#5#6#7
  {
    #6 {#5} {#7} \__sort_quick_only_ii:NnnnnNn
      \__sort_quick_split_i:NnnnnNn
      \__sort_quick_only_ii_end:nnnwnw
      { #6 {#7} } { } { #4 #2 } {#5}
  }
\cs_new:Npn \__sort_quick_split_i:NnnnnNn #1#2#3#4#5#6#7
  {
    #6 {#5} {#7} \__sort_quick_split_ii:NnnnnNn
      \__sort_quick_split_i:NnnnnNn
      \__sort_quick_split_end:nnnwnw
      { #6 {#7} } { #3 #2 } {#4} {#5}
  }
\cs_new:Npn \__sort_quick_split_ii:NnnnnNn #1#2#3#4#5#6#7
  {
    #6 {#5} {#7} \__sort_quick_split_ii:NnnnnNn
      \__sort_quick_split_i:NnnnnNn
      \__sort_quick_split_end:nnnwnw
      { #6 {#7} } {#3} { #4 #2 } {#5}
  }
\cs_new:Npn \__sort_quick_end:nnTFNn #1#2#3#4#5#6 {#5}
\cs_new:Npn \__sort_quick_single_end:nnnwnw #1#2#3#4 \s__sort_mark #5#6 \s__sort_stop
  { #5 {#3} #6 \s__sort_stop }
\cs_new:Npn \__sort_quick_only_i_end:nnnwnw #1#2#3#4 \s__sort_mark #5#6 \s__sort_stop
  {
    \__sort_quick_split:NnNn #1
      \__sort_quick_end:nnTFNn { } \s__sort_mark {#5}
    {#3}
    #6 \s__sort_stop
  }
\cs_new:Npn \__sort_quick_only_ii_end:nnnwnw #1#2#3#4 \s__sort_mark #5#6 \s__sort_stop
  {
    \__sort_quick_split:NnNn #2
      \__sort_quick_end:nnTFNn { } \s__sort_mark { #5 {#3} }
    #6 \s__sort_stop
  }
\cs_new:Npn \__sort_quick_split_end:nnnwnw #1#2#3#4 \s__sort_mark #5#6 \s__sort_stop
  {
    \__sort_quick_split:NnNn #2 \__sort_quick_end:nnTFNn { } \s__sort_mark
      {
        \__sort_quick_split:NnNn #1
          \__sort_quick_end:nnTFNn { } \s__sort_mark {#5}
        {#3}
      }
    #6 \s__sort_stop
  }
\cs_new_protected:Npn \__sort_error:
  {
    \cs_set_eq:NN \__sort_merge_blocks_aux: \prg_do_nothing:
    \cs_set_eq:NN \__sort_merge_blocks: \prg_do_nothing:
    \cs_set_protected:Npn \__sort_level: { \group_end: \prg_break: }
  }
\cs_new_protected:Npn \__sort_disable_toksdef:
  { \cs_set_eq:NN \toksdef \__sort_disabled_toksdef:n }
\cs_new_protected:Npn \__sort_disabled_toksdef:n #1
  {
    \__kernel_msg_error:nnx { kernel } { toksdef }
      { \token_to_str:N #1 }
    \__sort_error:
    \tex_toksdef:D #1
  }
\__kernel_msg_new:nnnn { kernel } { toksdef }
  { Allocation~of~\iow_char:N\\toks~registers~impossible~while~sorting. }
  {
    The~comparison~code~used~for~sorting~a~list~has~attempted~to~
    define~#1~as~a~new~\iow_char:N\\toks~register~using~
    \iow_char:N\\newtoks~
    or~a~similar~command.~The~list~will~not~be~sorted.
  }
\cs_new_protected:Npn \__sort_too_long_error:NNw #1#2 \fi:
  {
    \fi:
    \__kernel_msg_error:nnxxx { kernel } { too-large }
      { \token_to_str:N #2 }
      { \int_eval:n { \l__sort_true_max_int - \l__sort_min_int } }
      { \int_eval:n { \l__sort_top_int - \l__sort_min_int } }
    #1 \__sort_error:
  }
\__kernel_msg_new:nnnn { kernel } { too-large }
  { The~list~#1~is~too~long~to~be~sorted~by~TeX. }
  {
    TeX~has~#2~toks~registers~still~available:~
    this~only~allows~to~sort~with~up~to~#3~
    items.~The~list~will~not~be~sorted.
  }
\__kernel_msg_new:nnnn { kernel } { return-none }
  { The~comparison~code~did~not~return. }
  {
    When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~
    did~not~call~
    \iow_char:N\\sort_return_same: ~nor~
    \iow_char:N\\sort_return_swapped: .~
    Exactly~one~of~these~should~be~called.
  }
\__kernel_msg_new:nnnn { kernel } { return-two }
  { The~comparison~code~returned~multiple~times. }
  {
    When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~called~
    \iow_char:N\\sort_return_same: ~or~
    \iow_char:N\\sort_return_swapped: ~multiple~times.~
    Exactly~one~of~these~should~be~called.
  }
%% File: l3str-convert.dtx
\cs_new_protected:Npn \__str_tmp:w { }
\tl_new:N \l__str_internal_tl
\tl_new:N \g__str_result_tl
\int_const:Nn \c__str_replacement_char_int { "FFFD }
\int_const:Nn \c__str_max_byte_int { 255 }
\scan_new:N \s__str
\quark_new:N \q__str_nil
\prop_new:N \g__str_alias_prop
\prop_gput:Nnn \g__str_alias_prop { latin1 } { iso88591 }
\prop_gput:Nnn \g__str_alias_prop { latin2 } { iso88592 }
\prop_gput:Nnn \g__str_alias_prop { latin3 } { iso88593 }
\prop_gput:Nnn \g__str_alias_prop { latin4 } { iso88594 }
\prop_gput:Nnn \g__str_alias_prop { latin5 } { iso88599 }
\prop_gput:Nnn \g__str_alias_prop { latin6 } { iso885910 }
\prop_gput:Nnn \g__str_alias_prop { latin7 } { iso885913 }
\prop_gput:Nnn \g__str_alias_prop { latin8 } { iso885914 }
\prop_gput:Nnn \g__str_alias_prop { latin9 } { iso885915 }
\prop_gput:Nnn \g__str_alias_prop { latin10 } { iso885916 }
\prop_gput:Nnn \g__str_alias_prop { utf16le } { utf16 }
\prop_gput:Nnn \g__str_alias_prop { utf16be } { utf16 }
\prop_gput:Nnn \g__str_alias_prop { utf32le } { utf32 }
\prop_gput:Nnn \g__str_alias_prop { utf32be } { utf32 }
\prop_gput:Nnn \g__str_alias_prop { hexadecimal } { hex }
\bool_lazy_any:nTF
  {
    \sys_if_engine_luatex_p:
    \sys_if_engine_xetex_p:
  }
  {
    \prop_gput:Nnn \g__str_alias_prop { default } {  }
  }
  {
    \prop_gput:Nnn \g__str_alias_prop { default } { utf8 }
  }
\bool_new:N \g__str_error_bool
\flag_new:n { str_byte }
\flag_new:n { str_error }
\prg_new_conditional:Npnn \__str_if_contains_char:Nn #1#2 { T , TF }
  {
    \exp_after:wN \__str_if_contains_char_aux:nn \exp_after:wN {#1} {#2}
      { \prg_break:n { ? \fi: } }
    \prg_break_point:
    \prg_return_false:
  }
\cs_new:Npn \__str_if_contains_char_aux:nn #1#2
  { \__str_if_contains_char_auxi:nN {#2} #1 }
\prg_new_conditional:Npnn \__str_if_contains_char:nn #1#2 { TF }
  {
    \__str_if_contains_char_auxi:nN {#2} #1 { \prg_break:n { ? \fi: } }
    \prg_break_point:
    \prg_return_false:
  }
\cs_new:Npn \__str_if_contains_char_auxi:nN #1#2
  {
    \if_charcode:w #1 #2
      \exp_after:wN \__str_if_contains_char_true:
    \fi:
    \__str_if_contains_char_auxi:nN {#1}
  }
\cs_new:Npn \__str_if_contains_char_true:
  { \prg_break:n { \prg_return_true: \use_none:n } }
\prg_new_conditional:Npnn \__str_octal_use:N #1 { TF }
  {
    \if_int_compare:w 1 < '1 \token_to_str:N #1 \exp_stop_f:
      #1 \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\prg_new_conditional:Npnn \__str_hexadecimal_use:N #1 { TF }
  {
    \if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f:
      #1 \prg_return_true:
    \else:
      \if_case:w \int_eval:n { \exp_after:wN ` \token_to_str:N #1 - `a }
           A
      \or: B
      \or: C
      \or: D
      \or: E
      \or: F
      \else:
        \prg_return_false:
        \exp_after:wN \use_none:n
      \fi:
      \prg_return_true:
    \fi:
  }
\group_begin:
  \__kernel_tl_set:Nx \l__str_internal_tl { \tl_to_str:n { 0123456789ABCDEF } }
   \tl_map_inline:Nn \l__str_internal_tl
     {
        \tl_map_inline:Nn \l__str_internal_tl
          {
            \tl_const:cx { c__str_byte_ \int_eval:n {"#1##1} _tl }
               { \char_generate:nn { "#1##1 } { 12 } #1 ##1 }
          }
     }
\group_end:
\tl_const:cn { c__str_byte_-1_tl } { { } \use_none:n { } }
\cs_new:Npn \__str_output_byte:n #1
  { \__str_output_byte:w #1 \__str_output_end: }
\cs_new:Npn \__str_output_byte:w
  {
    \exp_after:wN \exp_after:wN
    \exp_after:wN \use_i:nnn
    \cs:w c__str_byte_ \int_eval:w
  }
\cs_new:Npn \__str_output_hexadecimal:n #1
  {
    \exp_after:wN \exp_after:wN
    \exp_after:wN \use_none:n
    \cs:w c__str_byte_ \int_eval:n {#1} _tl \cs_end:
  }
\cs_new:Npn \__str_output_end:
  { \scan_stop: _tl \cs_end: }
\cs_new:Npn \__str_output_byte_pair_be:n #1
  {
    \exp_args:Nf \__str_output_byte_pair:nnN
      { \int_div_truncate:nn { #1 } { "100 } } {#1} \use:nn
  }
\cs_new:Npn \__str_output_byte_pair_le:n #1
  {
    \exp_args:Nf \__str_output_byte_pair:nnN
      { \int_div_truncate:nn { #1 } { "100 } } {#1} \use_ii_i:nn
  }
\cs_new:Npn \__str_output_byte_pair:nnN #1#2#3
  {
    #3
      { \__str_output_byte:n { #1 } }
      { \__str_output_byte:n { #2 - #1 * "100 } }
  }
\cs_new_protected:Npn \__str_convert_gmap:N #1
  {
    \__kernel_tl_gset:Nx \g__str_result_tl
      {
        \exp_after:wN \__str_convert_gmap_loop:NN
        \exp_after:wN #1
          \g__str_result_tl { ? \prg_break: }
        \prg_break_point:
      }
  }
\cs_new:Npn \__str_convert_gmap_loop:NN #1#2
  {
    \use_none:n #2
    #1#2
    \__str_convert_gmap_loop:NN #1
  }
\cs_new_protected:Npn \__str_convert_gmap_internal:N #1
  {
    \__kernel_tl_gset:Nx \g__str_result_tl
      {
        \exp_after:wN \__str_convert_gmap_internal_loop:Nww
        \exp_after:wN #1
          \g__str_result_tl \s__str \s__str_stop \prg_break: \s__str
        \prg_break_point:
      }
  }
\cs_new:Npn \__str_convert_gmap_internal_loop:Nww #1 #2 \s__str #3 \s__str
  {
    \__str_use_none_delimit_by_s_stop:w #3 \s__str_stop
    #1 {#3}
    \__str_convert_gmap_internal_loop:Nww #1
  }
\cs_new_protected:Npn \__str_if_flag_error:nnx #1
  {
    \flag_if_raised:nTF {#1}
      { \__kernel_msg_error:nnx { str } }
      { \use_none:nn }
  }
\cs_new_protected:Npn \__str_if_flag_no_error:nnx #1#2#3
  { \flag_if_raised:nT {#1} { \bool_gset_true:N \g__str_error_bool } }
\cs_new:Npn \__str_if_flag_times:nT #1#2
  { \flag_if_raised:nT {#1} { #2~(x \flag_height:n {#1} ) } }
\cs_new_protected:Npn \str_set_convert:Nnnn
  { \__str_convert:nNNnnn { } \tl_set_eq:NN }
\cs_new_protected:Npn \str_gset_convert:Nnnn
  { \__str_convert:nNNnnn { } \tl_gset_eq:NN }
\prg_new_protected_conditional:Npnn
    \str_set_convert:Nnnn #1#2#3#4 { T , F , TF }
  {
    \bool_gset_false:N \g__str_error_bool
    \__str_convert:nNNnnn
      { \cs_set_eq:NN \__str_if_flag_error:nnx \__str_if_flag_no_error:nnx }
      \tl_set_eq:NN #1 {#2} {#3} {#4}
    \bool_if:NTF \g__str_error_bool \prg_return_false: \prg_return_true:
  }
\prg_new_protected_conditional:Npnn
    \str_gset_convert:Nnnn #1#2#3#4 { T , F , TF }
  {
    \bool_gset_false:N \g__str_error_bool
    \__str_convert:nNNnnn
      { \cs_set_eq:NN \__str_if_flag_error:nnx \__str_if_flag_no_error:nnx }
      \tl_gset_eq:NN #1 {#2} {#3} {#4}
    \bool_if:NTF \g__str_error_bool \prg_return_false: \prg_return_true:
  }
\cs_new_protected:Npn \__str_convert:nNNnnn #1#2#3#4#5#6
  {
    \group_begin:
      #1
      \__kernel_tl_gset:Nx \g__str_result_tl { \__kernel_str_to_other_fast:n {#4} }
      \exp_after:wN \__str_convert:wwwnn
        \tl_to_str:n {#5} /// \s__str_stop
        { decode } { unescape }
        \prg_do_nothing:
        \__str_convert_decode_:
      \exp_after:wN \__str_convert:wwwnn
        \tl_to_str:n {#6} /// \s__str_stop
        { encode } { escape }
        \use_ii_i:nn
        \__str_convert_encode_:
    \group_end:
    #2 #3 \g__str_result_tl
  }
\cs_new_protected:Npn \__str_convert:wwwnn
    #1 / #2 // #3 \s__str_stop #4#5
  {
    \__str_convert:nnn {enc} {#4} {#1}
    \__str_convert:nnn {esc} {#5} {#2}
    \exp_args:Ncc \__str_convert:NNnNN
      { __str_convert_#4_#1: } { __str_convert_#5_#2: } {#2}
  }
\cs_new_protected:Npn \__str_convert:NNnNN #1#2#3#4#5
  {
    \if_meaning:w #1 #5
      \tl_if_empty:nF {#3}
        { \__kernel_msg_error:nnx { str } { native-escaping } {#3} }
      #1
    \else:
      #4 #2 #1
    \fi:
  }
\cs_new_protected:Npn \__str_convert:nnn #1#2#3
  {
    \cs_if_exist:cF { __str_convert_#2_#3: }
      {
        \exp_args:Nx \__str_convert:nnnn
          { \__str_convert_lowercase_alphanum:n {#3} }
          {#1} {#2} {#3}
      }
  }
\cs_new_protected:Npn \__str_convert:nnnn #1#2#3#4
  {
    \cs_if_exist:cF { __str_convert_#3_#1: }
      {
        \prop_get:NnNF \g__str_alias_prop {#1} \l__str_internal_tl
          { \tl_set:Nn \l__str_internal_tl {#1} }
        \cs_if_exist:cF { __str_convert_#3_ \l__str_internal_tl : }
          {
            \file_if_exist:nTF { l3str-#2- \l__str_internal_tl .def }
              {
                \group_begin:
                  \__str_load_catcodes:
                  \file_input:n { l3str-#2- \l__str_internal_tl .def }
                \group_end:
              }
              {
                \tl_clear:N \l__str_internal_tl
                \__kernel_msg_error:nnxx { str } { unknown-#2 } {#4} {#1}
              }
          }
        \cs_if_exist:cF { __str_convert_#3_#1: }
          {
            \cs_gset_eq:cc { __str_convert_#3_#1: }
              { __str_convert_#3_ \l__str_internal_tl : }
          }
      }
    \cs_gset_eq:cc { __str_convert_#3_#4: } { __str_convert_#3_#1: }
  }
\cs_new:Npn \__str_convert_lowercase_alphanum:n #1
  {
    \exp_after:wN \__str_convert_lowercase_alphanum_loop:N
      \tl_to_str:n {#1} { ? \prg_break: }
    \prg_break_point:
  }
\cs_new:Npn \__str_convert_lowercase_alphanum_loop:N #1
  {
    \use_none:n #1
    \if_int_compare:w `#1 > `Z \exp_stop_f:
      \if_int_compare:w `#1 > `z \exp_stop_f: \else:
        \if_int_compare:w `#1 < `a \exp_stop_f: \else:
          #1
        \fi:
      \fi:
    \else:
      \if_int_compare:w `#1 < `A \exp_stop_f:
        \if_int_compare:w 1 < 1#1 \exp_stop_f:
          #1
        \fi:
      \else:
        \__str_output_byte:n { `#1 + `a - `A }
      \fi:
    \fi:
    \__str_convert_lowercase_alphanum_loop:N
  }
\cs_new_protected:Npn \__str_load_catcodes:
  {
    \char_set_catcode_escape:N \\
    \char_set_catcode_group_begin:N \{
    \char_set_catcode_group_end:N \}
    \char_set_catcode_math_toggle:N \$
    \char_set_catcode_alignment:N \&
    \char_set_catcode_parameter:N \#
    \char_set_catcode_math_superscript:N \^
    \char_set_catcode_ignore:N \ %
    \char_set_catcode_space:N \~
    \tl_map_function:nN { abcdefghijklmnopqrstuvwxyz_:ABCDEFILNPSTUX }
      \char_set_catcode_letter:N
    \tl_map_function:nN { 0123456789"'?*+-.(),`!/<>[];= }
      \char_set_catcode_other:N
    \char_set_catcode_comment:N \%
    \int_set:Nn \tex_endlinechar:D {32}
  }
\bool_lazy_any:nTF
  {
    \sys_if_engine_luatex_p:
    \sys_if_engine_xetex_p:
  }
  {
    \cs_new:Npn \__str_filter_bytes:n #1
      {
        \__str_filter_bytes_aux:N #1
          { ? \prg_break: }
        \prg_break_point:
      }
    \cs_new:Npn \__str_filter_bytes_aux:N #1
      {
        \use_none:n #1
        \if_int_compare:w `#1 < 256 \exp_stop_f:
          #1
        \else:
          \flag_raise:n { str_byte }
        \fi:
        \__str_filter_bytes_aux:N
      }
  }
  { \cs_new_eq:NN \__str_filter_bytes:n \use:n }
\bool_lazy_any:nTF
  {
    \sys_if_engine_luatex_p:
    \sys_if_engine_xetex_p:
  }
  {
    \cs_new_protected:Npn \__str_convert_unescape_:
      {
        \flag_clear:n { str_byte }
        \__kernel_tl_gset:Nx \g__str_result_tl
          { \exp_args:No \__str_filter_bytes:n \g__str_result_tl }
        \__str_if_flag_error:nnx { str_byte } { non-byte } { bytes }
      }
  }
  { \cs_new_protected:Npn \__str_convert_unescape_: { } }
\cs_new_eq:NN \__str_convert_unescape_bytes: \__str_convert_unescape_:
\cs_new_protected:Npn \__str_convert_escape_: { }
\cs_new_eq:NN \__str_convert_escape_bytes: \__str_convert_escape_:
\cs_new_protected:Npn \__str_convert_decode_:
  { \__str_convert_gmap:N \__str_decode_native_char:N }
\cs_new:Npn \__str_decode_native_char:N #1
  { #1 \s__str \int_value:w `#1 \s__str }
\bool_lazy_any:nTF
  {
    \sys_if_engine_luatex_p:
    \sys_if_engine_xetex_p:
  }
  {
    \cs_new_protected:Npn \__str_convert_encode_:
      { \__str_convert_gmap_internal:N \__str_encode_native_char:n }
    \cs_new:Npn \__str_encode_native_char:n #1
      { \char_generate:nn {#1} {12} }
  }
  {
    \cs_new_protected:Npn \__str_convert_encode_:
      {
        \flag_clear:n { str_error }
        \__str_convert_gmap_internal:N \__str_encode_native_char:n
        \__str_if_flag_error:nnx { str_error }
          { native-overflow } { }
      }
    \cs_new:Npn \__str_encode_native_char:n #1
      {
        \if_int_compare:w #1 > \c__str_max_byte_int
          \flag_raise:n { str_error }
          ?
        \else:
          \char_generate:nn {#1} {12}
        \fi:
      }
    \__kernel_msg_new:nnnn { str } { native-overflow }
      { Character~code~too~large~for~this~engine. }
      {
        This~engine~only~support~8-bit~characters:~
        valid~character~codes~are~in~the~range~[0,255].~
        To~manipulate~arbitrary~Unicode,~use~LuaTeX~or~XeTeX.
      }
  }
\cs_new_protected:Npn \__str_convert_decode_clist:
  {
    \clist_gset:No \g__str_result_tl \g__str_result_tl
    \__kernel_tl_gset:Nx \g__str_result_tl
      {
        \exp_args:No \clist_map_function:nN
          \g__str_result_tl \__str_decode_clist_char:n
      }
  }
\cs_new:Npn \__str_decode_clist_char:n #1
  { #1 \s__str \int_eval:n {#1} \s__str }
\cs_new_protected:Npn \__str_convert_encode_clist:
  {
    \__str_convert_gmap_internal:N \__str_encode_clist_char:n
    \__kernel_tl_gset:Nx \g__str_result_tl { \tl_tail:N \g__str_result_tl }
  }
\cs_new:Npn \__str_encode_clist_char:n #1 { , #1 }
\cs_new_protected:Npn \__str_declare_eight_bit_encoding:nnnn #1
  {
    \tl_set:Nn \l__str_internal_tl {#1}
    \cs_new_protected:cpn { __str_convert_decode_#1: }
      { \__str_convert_decode_eight_bit:n {#1} }
    \cs_new_protected:cpn { __str_convert_encode_#1: }
      { \__str_convert_encode_eight_bit:n {#1} }
    \exp_args:Ncc \__str_declare_eight_bit_aux:NNnnn
      { g__str_decode_#1_intarray } { g__str_encode_#1_intarray }
  }
\cs_new_protected:Npn \__str_declare_eight_bit_aux:NNnnn #1#2#3#4#5
  {
    \intarray_new:Nn #1 { 256 }
    \int_step_inline:nnn { 0 } { 255 }
      { \intarray_gset:Nnn #1 { 1 + ##1 } {##1} }
    \__str_declare_eight_bit_loop:Nnn #1
      #4 { \s__str_stop \prg_break: } { }
    \prg_break_point:
    \__str_declare_eight_bit_loop:Nn #1
      #5 { \s__str_stop \prg_break: }
    \prg_break_point:
    \intarray_new:Nn #2 {#3}
    \int_step_inline:nnn { 0 } { 255 }
      {
        \int_compare:nNnF { \intarray_item:Nn #1 { 1 + ##1 } } = { -1 }
          {
            \intarray_gset:Nnn #2
              {
                1 +
                \int_mod:nn { \intarray_item:Nn #1 { 1 + ##1 } }
                  { \intarray_count:N #2 }
              }
              {##1}
          }
      }
  }
\cs_new_protected:Npn \__str_declare_eight_bit_loop:Nnn #1#2#3
  {
    \__str_use_none_delimit_by_s_stop:w #2 \s__str_stop
    \intarray_gset:Nnn #1 { 1 + "#2 } { "#3 }
    \__str_declare_eight_bit_loop:Nnn #1
  }
\cs_new_protected:Npn \__str_declare_eight_bit_loop:Nn #1#2
  {
    \__str_use_none_delimit_by_s_stop:w #2 \s__str_stop
    \intarray_gset:Nnn #1 { 1 + "#2 } { -1 }
    \__str_declare_eight_bit_loop:Nn #1
  }
\cs_new_protected:Npn \__str_convert_decode_eight_bit:n #1
  {
    \cs_set:Npx \__str_tmp:w
      {
        \exp_not:N \__str_decode_eight_bit_aux:Nn
        \exp_not:c { g__str_decode_#1_intarray }
      }
    \flag_clear:n { str_error }
    \__str_convert_gmap:N \__str_tmp:w
    \__str_if_flag_error:nnx { str_error } { decode-8-bit } {#1}
  }
\cs_new:Npn \__str_decode_eight_bit_aux:Nn #1#2
  {
    #2 \s__str
    \exp_args:Nf \__str_decode_eight_bit_aux:n
      { \intarray_item:Nn #1 { 1 + `#2 } }
    \s__str
  }
\cs_new:Npn \__str_decode_eight_bit_aux:n #1
  {
    \if_int_compare:w #1 < \c_zero_int
      \flag_raise:n { str_error }
      \int_value:w \c__str_replacement_char_int
    \else:
      #1
    \fi:
  }
\int_new:N \l__str_modulo_int
\cs_new_protected:Npn \__str_convert_encode_eight_bit:n #1
  {
    \cs_set:Npx \__str_tmp:w
      {
        \exp_not:N \__str_encode_eight_bit_aux:NNn
        \exp_not:c { g__str_encode_#1_intarray }
        \exp_not:c { g__str_decode_#1_intarray }
      }
    \flag_clear:n { str_error }
    \__str_convert_gmap_internal:N \__str_tmp:w
    \__str_if_flag_error:nnx { str_error } { encode-8-bit } {#1}
  }
\cs_new:Npn \__str_encode_eight_bit_aux:NNn #1#2#3
  {
    \exp_args:Nf \__str_encode_eight_bit_aux:nnN
      {
        \intarray_item:Nn #1
          { 1 + \int_mod:nn {#3} { \intarray_count:N #1 } }
      }
      {#3}
      #2
  }
\cs_new:Npn \__str_encode_eight_bit_aux:nnN #1#2#3
  {
    \int_compare:nNnTF { \intarray_item:Nn #3 { 1 + #1 } } = {#2}
      { \__str_output_byte:n {#1} }
      { \flag_raise:n { str_error } }
  }
\__kernel_msg_new:nnn { str } { unknown-esc }
  { Escaping~scheme~'#1'~(filtered:~'#2')~unknown. }
\__kernel_msg_new:nnn { str } { unknown-enc }
  { Encoding~scheme~'#1'~(filtered:~'#2')~unknown. }
\__kernel_msg_new:nnnn { str } { native-escaping }
  { The~'native'~encoding~scheme~does~not~support~any~escaping. }
  {
    Since~native~strings~do~not~consist~in~bytes,~
    none~of~the~escaping~methods~make~sense.~
    The~specified~escaping,~'#1',~will be ignored.
  }
\__kernel_msg_new:nnn { str } { file-not-found }
  { File~'l3str-#1.def'~not~found. }
\bool_lazy_any:nT
  {
    \sys_if_engine_luatex_p:
    \sys_if_engine_xetex_p:
  }
  {
    \__kernel_msg_new:nnnn { str } { non-byte }
      { String~invalid~in~escaping~'#1':~it~may~only~contain~bytes. }
      {
        Some~characters~in~the~string~you~asked~to~convert~are~not~
        8-bit~characters.~Perhaps~the~string~is~a~'native'~Unicode~string?~
        If~it~is,~try~using\\
        \\
        \iow_indent:n
          {
            \iow_char:N\\str_set_convert:Nnnn \\
            \ \ <str~var>~\{~<string>~\}~\{~native~\}~\{~<target~encoding>~\}
          }
      }
  }
\__kernel_msg_new:nnnn { str } { decode-8-bit }
  { Invalid~string~in~encoding~'#1'. }
  {
    LaTeX~came~across~a~byte~which~is~not~defined~to~represent~
    any~character~in~the~encoding~'#1'.
  }
\__kernel_msg_new:nnnn { str } { encode-8-bit }
  { Unicode~string~cannot~be~converted~to~encoding~'#1'. }
  {
    The~encoding~'#1'~only~contains~a~subset~of~all~Unicode~characters.~
    LaTeX~was~asked~to~convert~a~string~to~that~encoding,~but~that~
    string~contains~a~character~that~'#1'~does~not~support.
  }
\cs_new_protected:Npn \__str_convert_unescape_hex:
  {
    \group_begin:
      \flag_clear:n { str_error }
      \int_set:Nn \tex_escapechar:D { 92 }
      \__kernel_tl_gset:Nx \g__str_result_tl
        {
          \__str_output_byte:w "
            \exp_last_unbraced:Nf \__str_unescape_hex_auxi:N
              { \tl_to_str:N \g__str_result_tl }
            0 { ? 0 - 1 \prg_break: }
            \prg_break_point:
          \__str_output_end:
        }
      \__str_if_flag_error:nnx { str_error } { unescape-hex } { }
    \group_end:
  }
\cs_new:Npn \__str_unescape_hex_auxi:N #1
  {
    \use_none:n #1
    \__str_hexadecimal_use:NTF #1
      { \__str_unescape_hex_auxii:N }
      {
        \flag_raise:n { str_error }
        \__str_unescape_hex_auxi:N
      }
  }
\cs_new:Npn \__str_unescape_hex_auxii:N #1
  {
    \use_none:n #1
    \__str_hexadecimal_use:NTF #1
      {
        \__str_output_end:
        \__str_output_byte:w " \__str_unescape_hex_auxi:N
      }
      {
        \flag_raise:n { str_error }
        \__str_unescape_hex_auxii:N
      }
  }
\__kernel_msg_new:nnnn { str } { unescape-hex }
  { String~invalid~in~escaping~'hex':~only~hexadecimal~digits~allowed. }
  {
    Some~characters~in~the~string~you~asked~to~convert~are~not~
    hexadecimal~digits~(0-9,~A-F,~a-f)~nor~spaces.
  }
\cs_set_protected:Npn \__str_tmp:w #1#2#3
  {
    \cs_new_protected:cpn { __str_convert_unescape_#2: }
      {
        \group_begin:
          \flag_clear:n { str_byte }
          \flag_clear:n { str_error }
          \int_set:Nn \tex_escapechar:D { 92 }
          \__kernel_tl_gset:Nx \g__str_result_tl
            {
              \exp_after:wN #3 \g__str_result_tl
                #1 ? { ? \prg_break: }
              \prg_break_point:
            }
          \__str_if_flag_error:nnx { str_byte } { non-byte } { #2 }
          \__str_if_flag_error:nnx { str_error } { unescape-#2 } { }
        \group_end:
      }
    \cs_new:Npn #3 ##1#1##2##3
      {
        \__str_filter_bytes:n {##1}
        \use_none:n ##3
        \__str_output_byte:w "
          \__str_hexadecimal_use:NTF ##2
            {
              \__str_hexadecimal_use:NTF ##3
                { }
                {
                  \flag_raise:n { str_error }
                  * 0 + `#1 \use_i:nn
                }
            }
            {
              \flag_raise:n { str_error }
              0 + `#1 \use_i:nn
            }
        \__str_output_end:
        \use_i:nnn #3 ##2##3
      }
    \__kernel_msg_new:nnnn { str } { unescape-#2 }
      { String~invalid~in~escaping~'#2'. }
      {
        LaTeX~came~across~the~escape~character~'#1'~not~followed~by~
        two~hexadecimal~digits.~This~is~invalid~in~the~escaping~'#2'.
      }
  }
\exp_after:wN \__str_tmp:w \c_hash_str { name }
  \__str_unescape_name_loop:wNN
\exp_after:wN \__str_tmp:w \c_percent_str { url }
  \__str_unescape_url_loop:wNN
\group_begin:
  \char_set_catcode_other:N \^^J
  \char_set_catcode_other:N \^^M
  \cs_set_protected:Npn \__str_tmp:w #1
    {
      \cs_new_protected:Npn \__str_convert_unescape_string:
        {
          \group_begin:
            \flag_clear:n { str_byte }
            \flag_clear:n { str_error }
            \int_set:Nn \tex_escapechar:D { 92 }
            \__kernel_tl_gset:Nx \g__str_result_tl
              {
                \exp_after:wN \__str_unescape_string_newlines:wN
                  \g__str_result_tl \prg_break: ^^M ?
                \prg_break_point:
              }
            \__kernel_tl_gset:Nx \g__str_result_tl
              {
                \exp_after:wN \__str_unescape_string_loop:wNNN
                  \g__str_result_tl #1 ?? { ? \prg_break: }
                \prg_break_point:
              }
            \__str_if_flag_error:nnx { str_byte } { non-byte } { string }
            \__str_if_flag_error:nnx { str_error } { unescape-string } { }
          \group_end:
        }
    }
  \exp_args:No \__str_tmp:w { \c_backslash_str }
  \exp_last_unbraced:NNNNo
    \cs_new:Npn \__str_unescape_string_loop:wNNN #1 \c_backslash_str #2#3#4
        {
          \__str_filter_bytes:n {#1}
          \use_none:n #4
          \__str_output_byte:w '
            \__str_octal_use:NTF #2
              {
                \__str_octal_use:NTF #3
                  {
                    \__str_octal_use:NTF #4
                      {
                        \if_int_compare:w #2 > 3 \exp_stop_f:
                          - 256
                        \fi:
                        \__str_unescape_string_repeat:NNNNNN
                      }
                      { \__str_unescape_string_repeat:NNNNNN ? }
                  }
                  { \__str_unescape_string_repeat:NNNNNN ?? }
              }
              {
                \str_case_e:nnF {#2}
                  {
                    { \c_backslash_str } { 134 }
                    { ( } { 50 }
                    { ) } { 51 }
                    { r } { 15 }
                    { f } { 14 }
                    { n } { 12 }
                    { t } { 11 }
                    { b } { 10 }
                    { ^^J } { 0 - 1 }
                  }
                  {
                    \flag_raise:n { str_error }
                    0 - 1 \use_i:nn
                  }
              }
          \__str_output_end:
          \use_i:nn \__str_unescape_string_loop:wNNN #2#3#4
        }
  \cs_new:Npn \__str_unescape_string_repeat:NNNNNN #1#2#3#4#5#6
    { \__str_output_end: \__str_unescape_string_loop:wNNN }
  \cs_new:Npn \__str_unescape_string_newlines:wN #1 ^^M #2
    {
      #1
      \if_charcode:w ^^J #2 \else: ^^J \fi:
      \__str_unescape_string_newlines:wN #2
    }
  \__kernel_msg_new:nnnn { str } { unescape-string }
    { String~invalid~in~escaping~'string'. }
    {
      LaTeX~came~across~an~escape~character~'\c_backslash_str'~
      not~followed~by~any~of:~'n',~'r',~'t',~'b',~'f',~'(',~')',~
      '\c_backslash_str',~one~to~three~octal~digits,~or~the~end~
      of~a~line.
    }
\group_end:
\cs_new_protected:Npn \__str_convert_escape_hex:
  { \__str_convert_gmap:N \__str_escape_hex_char:N }
\cs_new:Npn \__str_escape_hex_char:N #1
  { \__str_output_hexadecimal:n { `#1 } }
\str_const:Nn \c__str_escape_name_not_str { ! " $ & ' } %$
\str_const:Nn \c__str_escape_name_str { {}/<>[] }
\cs_new_protected:Npn \__str_convert_escape_name:
  { \__str_convert_gmap:N \__str_escape_name_char:n }
\cs_new:Npn \__str_escape_name_char:n #1
  {
    \__str_if_escape_name:nTF {#1} {#1}
      { \c_hash_str \__str_output_hexadecimal:n {`#1} }
  }
\prg_new_conditional:Npnn \__str_if_escape_name:n #1 { TF }
  {
    \if_int_compare:w `#1 < "2A \exp_stop_f:
      \__str_if_contains_char:NnTF \c__str_escape_name_not_str {#1}
        \prg_return_true: \prg_return_false:
    \else:
      \if_int_compare:w `#1 > "7E \exp_stop_f:
        \prg_return_false:
      \else:
        \__str_if_contains_char:NnTF \c__str_escape_name_str {#1}
          \prg_return_false: \prg_return_true:
      \fi:
    \fi:
  }
\str_const:Nx \c__str_escape_string_str
  { \c_backslash_str ( ) }
\cs_new_protected:Npn \__str_convert_escape_string:
  { \__str_convert_gmap:N \__str_escape_string_char:N }
\cs_new:Npn \__str_escape_string_char:N #1
  {
    \__str_if_escape_string:NTF #1
      {
        \__str_if_contains_char:NnT
          \c__str_escape_string_str {#1}
          { \c_backslash_str }
        #1
      }
      {
        \c_backslash_str
        \int_div_truncate:nn {`#1} {64}
        \int_mod:nn { \int_div_truncate:nn {`#1} { 8 } } { 8 }
        \int_mod:nn {`#1} { 8 }
      }
  }
\prg_new_conditional:Npnn \__str_if_escape_string:N #1 { TF }
  {
    \if_int_compare:w `#1 < "21 \exp_stop_f:
      \prg_return_false:
    \else:
      \if_int_compare:w `#1 > "7E \exp_stop_f:
        \prg_return_false:
      \else:
        \prg_return_true:
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__str_convert_escape_url:
  { \__str_convert_gmap:N \__str_escape_url_char:n }
\cs_new:Npn \__str_escape_url_char:n #1
  {
    \__str_if_escape_url:nTF {#1} {#1}
      { \c_percent_str \__str_output_hexadecimal:n { `#1 } }
  }
\prg_new_conditional:Npnn \__str_if_escape_url:n #1 { TF }
  {
    \if_int_compare:w `#1 < "41 \exp_stop_f:
      \__str_if_contains_char:nnTF { "-.<> } {#1}
        \prg_return_true: \prg_return_false:
    \else:
      \if_int_compare:w `#1 > "7E \exp_stop_f:
        \prg_return_false:
      \else:
        \__str_if_contains_char:nnTF { [ ] } {#1}
          \prg_return_false: \prg_return_true:
      \fi:
    \fi:
  }
\cs_new_protected:cpn { __str_convert_encode_utf8: }
  { \__str_convert_gmap_internal:N \__str_encode_utf_viii_char:n }
\cs_new:Npn \__str_encode_utf_viii_char:n #1
  {
    \__str_encode_utf_viii_loop:wwnnw #1 ; - 1 + 0 * ;
      { 128 } {       0 }
      {  32 } {     192 }
      {  16 } {     224 }
      {   8 } {     240 }
    \s__str_stop
  }
\cs_new:Npn \__str_encode_utf_viii_loop:wwnnw #1; #2; #3#4 #5 \s__str_stop
  {
    \if_int_compare:w #1 < #3 \exp_stop_f:
      \__str_output_byte:n { #1 + #4 }
      \exp_after:wN \__str_use_none_delimit_by_s_stop:w
    \fi:
    \exp_after:wN \__str_encode_utf_viii_loop:wwnnw
      \int_value:w \int_div_truncate:nn {#1} {64} ; #1 ;
      #5 \s__str_stop
    \__str_output_byte:n { #2 - 64 * ( #1 - 2 ) }
  }
\flag_clear_new:n { str_missing }
\flag_clear_new:n { str_extra }
\flag_clear_new:n { str_overlong }
\flag_clear_new:n { str_overflow }
\__kernel_msg_new:nnnn { str } { utf8-decode }
  {
    Invalid~UTF-8~string:
    \exp_last_unbraced:Nf \use_none:n
      {
        \__str_if_flag_times:nT { str_missing }  { ,~missing~continuation~byte }
        \__str_if_flag_times:nT { str_extra }    { ,~extra~continuation~byte }
        \__str_if_flag_times:nT { str_overlong } { ,~overlong~form }
        \__str_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
      }
    .
  }
  {
    In~the~UTF-8~encoding,~each~Unicode~character~consists~in~
    1~to~4~bytes,~with~the~following~bit~pattern: \\
    \iow_indent:n
      {
        Code~point~\ \ \ \ <~128:~0xxxxxxx \\
        Code~point~\ \ \  <~2048:~110xxxxx~10xxxxxx \\
        Code~point~\ \   <~65536:~1110xxxx~10xxxxxx~10xxxxxx \\
        Code~point~    <~1114112:~11110xxx~10xxxxxx~10xxxxxx~10xxxxxx \\
      }
    Bytes~of~the~form~10xxxxxx~are~called~continuation~bytes.
    \flag_if_raised:nT { str_missing }
      {
        \\\\
        A~leading~byte~(in~the~range~[192,255])~was~not~followed~by~
        the~appropriate~number~of~continuation~bytes.
      }
    \flag_if_raised:nT { str_extra }
      {
        \\\\
        LaTeX~came~across~a~continuation~byte~when~it~was~not~expected.
      }
    \flag_if_raised:nT { str_overlong }
      {
        \\\\
        Every~Unicode~code~point~must~be~expressed~in~the~shortest~
        possible~form.~For~instance,~'0xC0'~'0x83'~is~not~a~valid~
        representation~for~the~code~point~3.
      }
    \flag_if_raised:nT { str_overflow }
      {
        \\\\
        Unicode~limits~code~points~to~the~range~[0,1114111].
      }
  }
\cs_new_protected:cpn { __str_convert_decode_utf8: }
  {
    \flag_clear:n { str_error }
    \flag_clear:n { str_missing }
    \flag_clear:n { str_extra }
    \flag_clear:n { str_overlong }
    \flag_clear:n { str_overflow }
    \__kernel_tl_gset:Nx \g__str_result_tl
      {
        \exp_after:wN \__str_decode_utf_viii_start:N \g__str_result_tl
          { \prg_break: \__str_decode_utf_viii_end: }
        \prg_break_point:
      }
    \__str_if_flag_error:nnx { str_error } { utf8-decode } { }
  }
\cs_new:Npn \__str_decode_utf_viii_start:N #1
  {
    #1
    \if_int_compare:w `#1 < "C0 \exp_stop_f:
      \s__str
      \if_int_compare:w `#1 < "80 \exp_stop_f:
        \int_value:w `#1
      \else:
        \flag_raise:n { str_extra }
        \flag_raise:n { str_error }
        \int_use:N \c__str_replacement_char_int
      \fi:
    \else:
      \exp_after:wN \__str_decode_utf_viii_continuation:wwN
      \int_value:w \int_eval:n { `#1 - "C0 } \exp_after:wN
    \fi:
    \s__str
    \__str_use_none_delimit_by_s_stop:w {"80} {"800} {"10000} {"110000} \s__str_stop
    \__str_decode_utf_viii_start:N
  }
\cs_new:Npn \__str_decode_utf_viii_continuation:wwN
    #1 \s__str #2 \__str_decode_utf_viii_start:N #3
  {
    \use_none:n #3
    \if_int_compare:w `#3 <
          \if_int_compare:w `#3 < "80 \exp_stop_f: - \fi:
          "C0 \exp_stop_f:
      #3
      \exp_after:wN \__str_decode_utf_viii_aux:wNnnwN
      \int_value:w \int_eval:n { #1 * "40 + `#3 - "80 } \exp_after:wN
    \else:
      \s__str
      \flag_raise:n { str_missing }
      \flag_raise:n { str_error }
      \int_use:N \c__str_replacement_char_int
    \fi:
    \s__str
    #2
    \__str_decode_utf_viii_start:N #3
  }
\cs_new:Npn \__str_decode_utf_viii_aux:wNnnwN
    #1 \s__str #2#3#4 #5 \__str_decode_utf_viii_start:N #6
  {
    \if_int_compare:w #1 < #4 \exp_stop_f:
      \s__str
      \if_int_compare:w #1 < #3 \exp_stop_f:
        \flag_raise:n { str_overlong }
        \flag_raise:n { str_error }
        \int_use:N \c__str_replacement_char_int
      \else:
        #1
      \fi:
    \else:
      \if_meaning:w \s__str_stop #5
        \__str_decode_utf_viii_overflow:w #1
      \fi:
      \exp_after:wN \__str_decode_utf_viii_continuation:wwN
      \int_value:w \int_eval:n { #1 - #4 } \exp_after:wN
    \fi:
    \s__str
    #2 {#4} #5
    \__str_decode_utf_viii_start:N
  }
\cs_new:Npn \__str_decode_utf_viii_overflow:w #1 \fi: #2 \fi:
  {
    \fi: \fi:
    \flag_raise:n { str_overflow }
    \flag_raise:n { str_error }
    \int_use:N \c__str_replacement_char_int
  }
\cs_new:Npn \__str_decode_utf_viii_end:
  {
    \s__str
    \flag_raise:n { str_missing }
    \flag_raise:n { str_error }
    \int_use:N \c__str_replacement_char_int \s__str
    \prg_break:
  }
\group_begin:
  \char_set_catcode_other:N \^^fe
  \char_set_catcode_other:N \^^ff
  \cs_new_protected:cpn { __str_convert_encode_utf16: }
    {
      \__str_encode_utf_xvi_aux:N \__str_output_byte_pair_be:n
      \tl_gput_left:Nx \g__str_result_tl { ^^fe ^^ff }
    }
  \cs_new_protected:cpn { __str_convert_encode_utf16be: }
    { \__str_encode_utf_xvi_aux:N \__str_output_byte_pair_be:n }
  \cs_new_protected:cpn { __str_convert_encode_utf16le: }
    { \__str_encode_utf_xvi_aux:N \__str_output_byte_pair_le:n }
  \cs_new_protected:Npn \__str_encode_utf_xvi_aux:N #1
    {
      \flag_clear:n { str_error }
      \cs_set_eq:NN \__str_tmp:w #1
      \__str_convert_gmap_internal:N \__str_encode_utf_xvi_char:n
      \__str_if_flag_error:nnx { str_error } { utf16-encode } { }
    }
  \cs_new:Npn \__str_encode_utf_xvi_char:n #1
    {
      \if_int_compare:w #1 < "D800 \exp_stop_f:
        \__str_tmp:w {#1}
      \else:
        \if_int_compare:w #1 < "10000 \exp_stop_f:
          \if_int_compare:w #1 < "E000 \exp_stop_f:
            \flag_raise:n { str_error }
            \__str_tmp:w { \c__str_replacement_char_int }
          \else:
            \__str_tmp:w {#1}
          \fi:
        \else:
          \exp_args:Nf \__str_tmp:w { \int_div_truncate:nn {#1} {"400} + "D7C0 }
          \exp_args:Nf \__str_tmp:w { \int_mod:nn {#1} {"400} + "DC00 }
        \fi:
      \fi:
    }
  \flag_clear_new:n { str_missing }
  \flag_clear_new:n { str_extra }
  \flag_clear_new:n { str_end }
  \__kernel_msg_new:nnnn { str } { utf16-encode }
    { Unicode~string~cannot~be~expressed~in~UTF-16:~surrogate. }
    {
      Surrogate~code~points~(in~the~range~[U+D800,~U+DFFF])~
      can~be~expressed~in~the~UTF-8~and~UTF-32~encodings,~
      but~not~in~the~UTF-16~encoding.
    }
  \__kernel_msg_new:nnnn { str } { utf16-decode }
    {
      Invalid~UTF-16~string:
      \exp_last_unbraced:Nf \use_none:n
        {
          \__str_if_flag_times:nT { str_missing }  { ,~missing~trail~surrogate }
          \__str_if_flag_times:nT { str_extra }    { ,~extra~trail~surrogate }
          \__str_if_flag_times:nT { str_end }      { ,~odd~number~of~bytes }
        }
      .
    }
    {
      In~the~UTF-16~encoding,~each~Unicode~character~is~encoded~as~
      2~or~4~bytes: \\
      \iow_indent:n
        {
          Code~point~in~[U+0000,~U+D7FF]:~two~bytes \\
          Code~point~in~[U+D800,~U+DFFF]:~illegal \\
          Code~point~in~[U+E000,~U+FFFF]:~two~bytes \\
          Code~point~in~[U+10000,~U+10FFFF]:~
            a~lead~surrogate~and~a~trail~surrogate \\
        }
      Lead~surrogates~are~pairs~of~bytes~in~the~range~[0xD800,~0xDBFF],~
      and~trail~surrogates~are~in~the~range~[0xDC00,~0xDFFF].
      \flag_if_raised:nT { str_missing }
        {
          \\\\
          A~lead~surrogate~was~not~followed~by~a~trail~surrogate.
        }
      \flag_if_raised:nT { str_extra }
        {
          \\\\
          LaTeX~came~across~a~trail~surrogate~when~it~was~not~expected.
        }
      \flag_if_raised:nT { str_end }
        {
          \\\\
          The~string~contained~an~odd~number~of~bytes.~This~is~invalid:~
          the~basic~code~unit~for~UTF-16~is~16~bits~(2~bytes).
        }
    }
  \cs_new_protected:cpn { __str_convert_decode_utf16be: }
    { \__str_decode_utf_xvi:Nw 1 \g__str_result_tl \s__str_stop }
  \cs_new_protected:cpn { __str_convert_decode_utf16le: }
    { \__str_decode_utf_xvi:Nw 2 \g__str_result_tl \s__str_stop }
  \cs_new_protected:cpn { __str_convert_decode_utf16: }
    {
      \exp_after:wN \__str_decode_utf_xvi_bom:NN
        \g__str_result_tl \s__str_stop \s__str_stop \s__str_stop
    }
  \cs_new_protected:Npn \__str_decode_utf_xvi_bom:NN #1#2
    {
      \str_if_eq:nnTF { #1#2 } { ^^ff ^^fe }
        { \__str_decode_utf_xvi:Nw 2 }
        {
          \str_if_eq:nnTF { #1#2 } { ^^fe ^^ff }
            { \__str_decode_utf_xvi:Nw 1 }
            { \__str_decode_utf_xvi:Nw 1 #1#2 }
        }
    }
  \cs_new_protected:Npn \__str_decode_utf_xvi:Nw #1#2 \s__str_stop
    {
      \flag_clear:n { str_error }
      \flag_clear:n { str_missing }
      \flag_clear:n { str_extra }
      \flag_clear:n { str_end }
      \cs_set:Npn \__str_tmp:w ##1 ##2 { ` ## #1 }
      \__kernel_tl_gset:Nx \g__str_result_tl
        {
          \exp_after:wN \__str_decode_utf_xvi_pair:NN
            #2 \q__str_nil \q__str_nil
          \prg_break_point:
        }
      \__str_if_flag_error:nnx { str_error } { utf16-decode } { }
    }
  \cs_new:Npn \__str_decode_utf_xvi_pair:NN #1#2
    {
      \if_meaning:w \q__str_nil #2
        \__str_decode_utf_xvi_pair_end:Nw #1
      \fi:
      \if_case:w
        \int_eval:n { ( \__str_tmp:w #1#2 - "D6 ) / 4 } \scan_stop:
      \or: \exp_after:wN \__str_decode_utf_xvi_quad:NNwNN
      \or: \exp_after:wN \__str_decode_utf_xvi_extra:NNw
      \fi:
      #1#2 \s__str
      \int_eval:n { "100 * \__str_tmp:w #1#2 + \__str_tmp:w #2#1 } \s__str
      \__str_decode_utf_xvi_pair:NN
    }
  \cs_new:Npn \__str_decode_utf_xvi_quad:NNwNN
      #1#2 #3 \__str_decode_utf_xvi_pair:NN #4#5
    {
      \if_meaning:w \q__str_nil #5
        \__str_decode_utf_xvi_error:nNN { missing } #1#2
        \__str_decode_utf_xvi_pair_end:Nw #4
      \fi:
      \if_int_compare:w
          \if_int_compare:w \__str_tmp:w #4#5 < "DC \exp_stop_f:
            0 = 1
          \else:
            \__str_tmp:w #4#5 < "E0
          \fi:
          \exp_stop_f:
        #1 #2 #4 #5 \s__str
        \int_eval:n
          {
            ( "100 * \__str_tmp:w #1#2 + \__str_tmp:w #2#1 - "D7F7 ) * "400
            + "100 * \__str_tmp:w #4#5 + \__str_tmp:w #5#4
          }
        \s__str
        \exp_after:wN \use_i:nnn
      \else:
        \__str_decode_utf_xvi_error:nNN { missing } #1#2
      \fi:
      \__str_decode_utf_xvi_pair:NN #4#5
    }
  \cs_new:Npn \__str_decode_utf_xvi_pair_end:Nw #1 \fi:
    {
      \fi:
      \if_meaning:w \q__str_nil #1
      \else:
        \__str_decode_utf_xvi_error:nNN { end } #1 \prg_do_nothing:
      \fi:
      \prg_break:
    }
  \cs_new:Npn \__str_decode_utf_xvi_extra:NNw #1#2 \s__str #3 \s__str
    { \__str_decode_utf_xvi_error:nNN { extra } #1#2 }
  \cs_new:Npn \__str_decode_utf_xvi_error:nNN #1#2#3
    {
      \flag_raise:n { str_error }
      \flag_raise:n { str_#1 }
      #2 #3 \s__str
      \int_use:N \c__str_replacement_char_int \s__str
    }
\group_end:
\group_begin:
  \char_set_catcode_other:N \^^00
  \char_set_catcode_other:N \^^fe
  \char_set_catcode_other:N \^^ff
  \cs_new_protected:cpn { __str_convert_encode_utf32: }
    {
      \__str_convert_gmap_internal:N \__str_encode_utf_xxxii_be:n
      \tl_gput_left:Nx \g__str_result_tl { ^^00 ^^00 ^^fe ^^ff }
    }
  \cs_new_protected:cpn { __str_convert_encode_utf32be: }
    { \__str_convert_gmap_internal:N \__str_encode_utf_xxxii_be:n }
  \cs_new_protected:cpn { __str_convert_encode_utf32le: }
    { \__str_convert_gmap_internal:N \__str_encode_utf_xxxii_le:n }
  \cs_new:Npn \__str_encode_utf_xxxii_be:n #1
    {
      \exp_args:Nf \__str_encode_utf_xxxii_be_aux:nn
        { \int_div_truncate:nn {#1} { "100 } } {#1}
    }
  \cs_new:Npn \__str_encode_utf_xxxii_be_aux:nn #1#2
    {
      ^^00
      \__str_output_byte_pair_be:n {#1}
      \__str_output_byte:n { #2 - #1 * "100 }
    }
  \cs_new:Npn \__str_encode_utf_xxxii_le:n #1
    {
      \exp_args:Nf \__str_encode_utf_xxxii_le_aux:nn
        { \int_div_truncate:nn {#1} { "100 } } {#1}
    }
  \cs_new:Npn \__str_encode_utf_xxxii_le_aux:nn #1#2
    {
      \__str_output_byte:n { #2 - #1 * "100 }
      \__str_output_byte_pair_le:n {#1}
      ^^00
    }
  \flag_clear_new:n { str_overflow }
  \flag_clear_new:n { str_end }
  \__kernel_msg_new:nnnn { str } { utf32-decode }
    {
      Invalid~UTF-32~string:
      \exp_last_unbraced:Nf \use_none:n
        {
          \__str_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
          \__str_if_flag_times:nT { str_end }      { ,~truncated~string }
        }
      .
    }
    {
      In~the~UTF-32~encoding,~every~Unicode~character~
      (in~the~range~[U+0000,~U+10FFFF])~is~encoded~as~4~bytes.
      \flag_if_raised:nT { str_overflow }
        {
          \\\\
          LaTeX~came~across~a~code~point~larger~than~1114111,~
          the~maximum~code~point~defined~by~Unicode.~
          Perhaps~the~string~was~not~encoded~in~the~UTF-32~encoding?
        }
      \flag_if_raised:nT { str_end }
        {
          \\\\
          The~length~of~the~string~is~not~a~multiple~of~4.~
          Perhaps~the~string~was~truncated?
        }
    }
  \cs_new_protected:cpn { __str_convert_decode_utf32be: }
    { \__str_decode_utf_xxxii:Nw 1 \g__str_result_tl \s__str_stop }
  \cs_new_protected:cpn { __str_convert_decode_utf32le: }
    { \__str_decode_utf_xxxii:Nw 2 \g__str_result_tl \s__str_stop }
  \cs_new_protected:cpn { __str_convert_decode_utf32: }
    {
      \exp_after:wN \__str_decode_utf_xxxii_bom:NNNN \g__str_result_tl
        \s__str_stop \s__str_stop \s__str_stop \s__str_stop \s__str_stop
    }
  \cs_new_protected:Npn \__str_decode_utf_xxxii_bom:NNNN #1#2#3#4
    {
      \str_if_eq:nnTF { #1#2#3#4 } { ^^ff ^^fe ^^00 ^^00 }
        { \__str_decode_utf_xxxii:Nw 2 }
        {
          \str_if_eq:nnTF { #1#2#3#4 } { ^^00 ^^00 ^^fe ^^ff }
            { \__str_decode_utf_xxxii:Nw 1 }
            { \__str_decode_utf_xxxii:Nw 1 #1#2#3#4 }
        }
    }
  \cs_new_protected:Npn \__str_decode_utf_xxxii:Nw #1#2 \s__str_stop
    {
      \flag_clear:n { str_overflow }
      \flag_clear:n { str_end }
      \flag_clear:n { str_error }
      \cs_set:Npn \__str_tmp:w ##1 ##2 { ` ## #1 }
      \__kernel_tl_gset:Nx \g__str_result_tl
        {
          \exp_after:wN \__str_decode_utf_xxxii_loop:NNNN
            #2 \s__str_stop \s__str_stop \s__str_stop \s__str_stop
          \prg_break_point:
        }
      \__str_if_flag_error:nnx { str_error } { utf32-decode } { }
    }
  \cs_new:Npn \__str_decode_utf_xxxii_loop:NNNN #1#2#3#4
    {
      \if_meaning:w \s__str_stop #4
        \exp_after:wN \__str_decode_utf_xxxii_end:w
      \fi:
      #1#2#3#4 \s__str
      \if_int_compare:w \__str_tmp:w #1#4 > 0 \exp_stop_f:
        \flag_raise:n { str_overflow }
        \flag_raise:n { str_error }
        \int_use:N \c__str_replacement_char_int
      \else:
        \if_int_compare:w \__str_tmp:w #2#3 > 16 \exp_stop_f:
          \flag_raise:n { str_overflow }
          \flag_raise:n { str_error }
          \int_use:N \c__str_replacement_char_int
        \else:
          \int_eval:n
            { \__str_tmp:w #2#3*"10000 + \__str_tmp:w #3#2*"100 + \__str_tmp:w #4#1 }
        \fi:
      \fi:
      \s__str
      \__str_decode_utf_xxxii_loop:NNNN
    }
  \cs_new:Npn \__str_decode_utf_xxxii_end:w #1 \s__str_stop
    {
      \tl_if_empty:nF {#1}
        {
          \flag_raise:n { str_end }
          \flag_raise:n { str_error }
          #1 \s__str
          \int_use:N \c__str_replacement_char_int \s__str
        }
      \prg_break:
    }
\group_end:
\cs_new:Npn \str_convert_pdfname:n #1
  {
    \exp_args:Ne \tl_to_str:n
      { \str_map_function:nN {#1} \__str_convert_pdfname:n }
  }
\bool_lazy_or:nnTF
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new:Npn \__str_convert_pdfname:n #1
      {
        \int_compare:nNnTF { `#1 } > { "7F }
          { \__str_convert_pdfname_bytes:n {#1} }
          { \__str_escape_name_char:n {#1} }
      }
    \cs_new:Npn \__str_convert_pdfname_bytes:n #1
      {
        \exp_args:Ne \__str_convert_pdfname_bytes_aux:n
          { \char_to_utfviii_bytes:n {`#1} }
      }
    \cs_new:Npn \__str_convert_pdfname_bytes_aux:n #1
      { \__str_convert_pdfname_bytes_aux:nnnn #1 }
    \cs_new:Npx \__str_convert_pdfname_bytes_aux:nnnn #1#2#3#4
      {
        \c_hash_str \exp_not:N \__str_output_hexadecimal:n {#1}
        \c_hash_str \exp_not:N \__str_output_hexadecimal:n {#2}
        \exp_not:N \tl_if_blank:nF {#3}
          {
            \c_hash_str \exp_not:N \__str_output_hexadecimal:n {#3}
            \exp_not:N \tl_if_blank:nF {#4}
              {
                \c_hash_str \exp_not:N \__str_output_hexadecimal:n {#4}
              }
          }
      }
  }
  { \cs_new_eq:NN \__str_convert_pdfname:n \__str_escape_name_char:n }
%% File: l3tl-analysis.dtx
\scan_new:N \s__tl
\cs_new_eq:NN \l__tl_analysis_token ?
\cs_new_eq:NN \l__tl_analysis_char_token ?
\cs_new_eq:NN \l__tl_analysis_next_token ?
\tl_new:N \l__tl_peek_code_tl
\group_begin:
\char_set_active_eq:NN \  \scan_stop:
\tl_const:Nx \c__tl_peek_catcodes_tl
  {
    \char_generate:nn { 32 } { 3 }   3
    \char_generate:nn { 32 } { 4 }   4
    # \char_generate:nn { 32 } { 6 } 6
    \char_generate:nn { 32 } { 7 }   7
    \char_generate:nn { 32 } { 8 }   8
    \c_space_tl                     \token_to_str:N A
    \char_generate:nn { 32 } { 11 } \token_to_str:N B
    \char_generate:nn { 32 } { 12 } \token_to_str:N C
    \char_generate:nn { 32 } { 13 } \token_to_str:N D
  }
\group_end:
\int_new:N \l__tl_analysis_normal_int
\int_new:N \l__tl_analysis_index_int
\int_new:N \l__tl_analysis_nesting_int
\int_new:N \l__tl_analysis_type_int
\tl_new:N \g__tl_analysis_result_tl
\cs_new:Npn \__tl_analysis_extract_charcode:
  {
    \exp_after:wN \__tl_analysis_extract_charcode_aux:w
      \token_to_meaning:N \l__tl_analysis_token
  }
\cs_new:Npn \__tl_analysis_extract_charcode_aux:w #1 ~ #2 ~ { ` }
\cs_new:Npn \__tl_analysis_cs_space_count:NN #1 #2
  {
    \exp_after:wN #1
    \int_value:w \int_eval:w 0
      \exp_after:wN \__tl_analysis_cs_space_count:w
        \token_to_str:N #2
        \fi: \__tl_analysis_cs_space_count_end:w ; ~ !
  }
\cs_new:Npn \__tl_analysis_cs_space_count:w #1 ~
  {
    \if_false: #1 #1 \fi:
    + 1
    \__tl_analysis_cs_space_count:w
  }
\cs_new:Npn \__tl_analysis_cs_space_count_end:w ; #1 \fi: #2 !
  { \exp_after:wN ; \int_value:w \str_count_ignore_spaces:n {#1} ; }
\cs_new_protected:Npn \__tl_analysis:n #1
  {
    \group_begin:
      \group_align_safe_begin:
        \__tl_analysis_a:n {#1}
        \__tl_analysis_b:n {#1}
      \group_align_safe_end:
    \group_end:
  }
\group_begin:
  \char_set_catcode_active:N \^^@
  \cs_new_protected:Npn \__tl_analysis_disable:n #1
    {
      \tex_lccode:D 0 = #1 \exp_stop_f:
      \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D
    }
  \bool_lazy_or:nnT
    { \sys_if_engine_ptex_p: }
    { \sys_if_engine_uptex_p: }
    {
      \cs_gset_protected:Npn \__tl_analysis_disable:n #1
        {
          \if_int_compare:w 256 > #1 \exp_stop_f:
            \tex_lccode:D 0 = #1 \exp_stop_f:
            \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D
          \fi:
        }
    }
\group_end:
\cs_new_protected:Npn \__tl_analysis_a:n #1
  {
    \__tl_analysis_disable:n { 32 }
    \int_set:Nn \tex_escapechar:D { 92 }
    \int_zero:N \l__tl_analysis_normal_int
    \int_zero:N \l__tl_analysis_index_int
    \int_zero:N \l__tl_analysis_nesting_int
    \if_false: { \fi: \__tl_analysis_a_loop:w #1 }
    \int_decr:N \l__tl_analysis_index_int
  }
\cs_new_protected:Npn \__tl_analysis_a_loop:w
  { \tex_futurelet:D \l__tl_analysis_token \__tl_analysis_a_type:w }
\cs_new_protected:Npn \__tl_analysis_a_type:w
  {
    \l__tl_analysis_type_int =
      \if_meaning:w \l__tl_analysis_token \c_space_token
        0
      \else:
        \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_begin_token
          1
        \else:
          \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_end_token
            - 1
          \else:
            2
          \fi:
        \fi:
      \fi:
      \exp_stop_f:
    \if_case:w \l__tl_analysis_type_int
         \exp_after:wN \__tl_analysis_a_space:w
    \or: \exp_after:wN \__tl_analysis_a_bgroup:w
    \or: \exp_after:wN \__tl_analysis_a_safe:N
    \else: \exp_after:wN \__tl_analysis_a_egroup:w
    \fi:
  }
\cs_new_protected:Npn \__tl_analysis_a_space:w
  {
    \tex_afterassignment:D \__tl_analysis_a_space_test:w
    \exp_after:wN \cs_set_eq:NN
    \exp_after:wN \l__tl_analysis_char_token
    \token_to_str:N
  }
\cs_new_protected:Npn \__tl_analysis_a_space_test:w
  {
    \if_meaning:w \l__tl_analysis_char_token \c_space_token
      \tex_toks:D \l__tl_analysis_index_int { \exp_not:n { ~ } }
      \__tl_analysis_a_store:
    \else:
      \int_incr:N \l__tl_analysis_normal_int
    \fi:
    \__tl_analysis_a_loop:w
  }
\group_begin:
  \char_set_catcode_group_begin:N \^^@ % {
  \cs_new_protected:Npn \__tl_analysis_a_bgroup:w
    { \__tl_analysis_a_group:nw { \exp_after:wN ^^@ \if_false: } \fi: } }
  \char_set_catcode_group_end:N \^^@
  \cs_new_protected:Npn \__tl_analysis_a_egroup:w
    { \__tl_analysis_a_group:nw { \if_false: { \fi: ^^@ } } % }
\group_end:
\cs_new_protected:Npn \__tl_analysis_a_group:nw #1
  {
    \tex_lccode:D 0 = \__tl_analysis_extract_charcode: \scan_stop:
    \tex_lowercase:D { \tex_toks:D \l__tl_analysis_index_int {#1} }
    \if_int_compare:w \tex_lccode:D 0 = \tex_escapechar:D
      \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D }
    \fi:
    \__tl_analysis_disable:n { \tex_lccode:D 0 }
    \tex_futurelet:D \l__tl_analysis_token \__tl_analysis_a_group_aux:w
  }
\cs_new_protected:Npn \__tl_analysis_a_group_aux:w
  {
    \if_meaning:w \l__tl_analysis_token \tex_undefined:D
      \exp_after:wN \__tl_analysis_a_safe:N
    \else:
      \exp_after:wN \__tl_analysis_a_group_auxii:w
    \fi:
  }
\cs_new_protected:Npn \__tl_analysis_a_group_auxii:w
  {
    \tex_afterassignment:D \__tl_analysis_a_group_test:w
    \exp_after:wN \cs_set_eq:NN
    \exp_after:wN \l__tl_analysis_char_token
    \token_to_str:N
  }
\cs_new_protected:Npn \__tl_analysis_a_group_test:w
  {
    \if_charcode:w \l__tl_analysis_token \l__tl_analysis_char_token
      \__tl_analysis_a_store:
    \else:
      \int_incr:N \l__tl_analysis_normal_int
    \fi:
    \__tl_analysis_a_loop:w
  }
\cs_new_protected:Npn \__tl_analysis_a_store:
  {
    \tex_advance:D \l__tl_analysis_nesting_int \l__tl_analysis_type_int
    \if_int_compare:w \tex_lccode:D 0 = `\ \exp_stop_f:
      \tex_advance:D \l__tl_analysis_type_int \l__tl_analysis_type_int
    \fi:
    \tex_skip:D \l__tl_analysis_index_int
      = \l__tl_analysis_normal_int sp
         plus \l__tl_analysis_type_int sp \scan_stop:
    \int_incr:N \l__tl_analysis_index_int
    \int_zero:N \l__tl_analysis_normal_int
    \if_int_compare:w \l__tl_analysis_nesting_int = -1 \exp_stop_f:
      \cs_set_eq:NN \__tl_analysis_a_loop:w \scan_stop:
    \fi:
  }
\cs_new_protected:Npn \__tl_analysis_a_safe:N #1
  {
    \if_charcode:w
        \scan_stop:
        \exp_after:wN \use_none:n \token_to_str:N #1 \prg_do_nothing:
        \scan_stop:
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
      {
        \__tl_analysis_disable:n { `#1 }
        \int_incr:N \l__tl_analysis_normal_int
      }
      { \__tl_analysis_cs_space_count:NN \__tl_analysis_a_cs:ww #1 }
    \__tl_analysis_a_loop:w
  }
\cs_new_protected:Npn \__tl_analysis_a_cs:ww #1; #2;
  {
    \if_int_compare:w #1 > 0 \exp_stop_f:
      \tex_skip:D \l__tl_analysis_index_int
        = \int_eval:n { \l__tl_analysis_normal_int + 1 } sp \exp_stop_f:
      \tex_advance:D \l__tl_analysis_index_int #1 \exp_stop_f:
    \else:
      \tex_advance:D
    \fi:
    \l__tl_analysis_normal_int #2 \exp_stop_f:
  }
\cs_new_protected:Npn \__tl_analysis_b:n #1
  {
    \__kernel_tl_gset:Nx \g__tl_analysis_result_tl
      {
        \__tl_analysis_b_loop:w 0; #1
        \prg_break_point:
      }
  }
\cs_new:Npn \__tl_analysis_b_loop:w #1;
  {
    \exp_after:wN \__tl_analysis_b_normals:ww
      \int_value:w \tex_skip:D #1 ; #1 ;
  }
\cs_new:Npn \__tl_analysis_b_normals:ww #1;
  {
    \if_int_compare:w #1 = 0 \exp_stop_f:
      \__tl_analysis_b_special:w
    \fi:
    \__tl_analysis_b_normal:wwN #1;
  }
\cs_new:Npn \__tl_analysis_b_normal:wwN #1; #2; #3
  {
    \exp_not:n { \exp_not:n { #3 } } \s__tl
    \if_charcode:w
        \scan_stop:
        \exp_after:wN \use_none:n \token_to_str:N #3 \prg_do_nothing:
        \scan_stop:
      \exp_after:wN \__tl_analysis_b_char:Nww
    \else:
      \exp_after:wN \__tl_analysis_b_cs:Nww
    \fi:
    #3 #1; #2;
  }
\cs_new:Npx \__tl_analysis_b_char:Nww #1
  {
    \exp_not:N \if_meaning:w #1 \exp_not:N \tex_undefined:D
      \token_to_str:N D \exp_not:N \else:
    \exp_not:N \if_catcode:w #1 \c_catcode_other_token
      \token_to_str:N C \exp_not:N \else:
    \exp_not:N \if_catcode:w #1 \c_catcode_letter_token
      \token_to_str:N B \exp_not:N \else:
    \exp_not:N \if_catcode:w #1 \c_math_toggle_token      3
      \exp_not:N \else:
    \exp_not:N \if_catcode:w #1 \c_alignment_token        4
      \exp_not:N \else:
    \exp_not:N \if_catcode:w #1 \c_math_superscript_token 7
      \exp_not:N \else:
    \exp_not:N \if_catcode:w #1 \c_math_subscript_token   8
      \exp_not:N \else:
    \exp_not:N \if_catcode:w #1 \c_space_token
      \token_to_str:N A \exp_not:N \else:
      6
    \exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: }
    \exp_not:N \int_value:w `#1 \s__tl
   \exp_not:N \exp_after:wN \exp_not:N \__tl_analysis_b_normals:ww
     \exp_not:N \int_value:w \exp_not:N \int_eval:w - 1 +
  }
\cs_new:Npn \__tl_analysis_b_cs:Nww #1
  {
    0 -1 \s__tl
    \__tl_analysis_cs_space_count:NN \__tl_analysis_b_cs_test:ww #1
  }
\cs_new:Npn \__tl_analysis_b_cs_test:ww #1 ; #2 ; #3 ; #4 ;
  {
    \exp_after:wN \__tl_analysis_b_normals:ww
    \int_value:w \int_eval:w
    \if_int_compare:w #1 = 0 \exp_stop_f:
      #3
    \else:
      \tex_skip:D \int_eval:n { #4 + #1 } \exp_stop_f:
    \fi:
    - #2
    \exp_after:wN ;
    \int_value:w \int_eval:n { #4 + #1 } ;
  }
\group_begin:
  \char_set_catcode_other:N A
  \cs_new:Npn \__tl_analysis_b_special:w
      \fi: \__tl_analysis_b_normal:wwN 0 ; #1 ;
    {
      \fi:
      \if_int_compare:w #1 = \l__tl_analysis_index_int
        \exp_after:wN \prg_break:
      \fi:
      \tex_the:D \tex_toks:D #1 \s__tl
      \if_case:w \tex_gluestretch:D \tex_skip:D #1 \exp_stop_f:
             \token_to_str:N A
      \or:   1
      \or:   1
      \else: 2
      \fi:
      \if_int_odd:w \tex_gluestretch:D \tex_skip:D #1 \exp_stop_f:
        \exp_after:wN \__tl_analysis_b_special_char:wN \int_value:w
      \else:
        \exp_after:wN \__tl_analysis_b_special_space:w \int_value:w
      \fi:
      \int_eval:n { 1 + #1 } \exp_after:wN ;
      \token_to_str:N
    }
\group_end:
\cs_new:Npn \__tl_analysis_b_special_char:wN #1 ; #2
  {
    \int_value:w `#2 \s__tl
    \__tl_analysis_b_loop:w #1 ;
  }
\cs_new:Npn \__tl_analysis_b_special_space:w #1 ; ~
  {
    32 \s__tl
    \__tl_analysis_b_loop:w #1 ;
  }
\cs_new_protected:Npn \tl_analysis_map_inline:nn #1
  {
    \__tl_analysis:n {#1}
    \int_gincr:N \g__kernel_prg_map_int
    \exp_args:Nc \__tl_analysis_map_inline_aux:Nn
      { __tl_analysis_map_inline_ \int_use:N \g__kernel_prg_map_int :wNw }
  }
\cs_new_protected:Npn  \tl_analysis_map_inline:Nn #1
  { \exp_args:No \tl_analysis_map_inline:nn #1 }
\cs_new_protected:Npn \__tl_analysis_map_inline_aux:Nn #1#2
  {
    \cs_gset_protected:Npn #1 ##1 \s__tl ##2 ##3 \s__tl
      {
        \use_none:n ##2
        \__tl_analysis_map_inline_aux:nnn {##1} {##3} {##2}
      }
    \cs_gset_protected:Npn \__tl_analysis_map_inline_aux:nnn ##1##2##3
      {
        #2
        #1
      }
    \exp_after:wN #1
      \g__tl_analysis_result_tl
      \s__tl { ? \tl_map_break: } \s__tl
    \prg_break_point:Nn \tl_map_break:
      { \int_gdecr:N \g__kernel_prg_map_int }
  }
\cs_new_protected:Npn \tl_analysis_show:N #1
  {
    \tl_if_exist:NTF #1
      {
        \exp_args:No \__tl_analysis:n {#1}
        \msg_show:nnxxxx { LaTeX / kernel } { show-tl-analysis }
          { \token_to_str:N #1 } { \__tl_analysis_show: } { } { }
      }
      { \tl_show:N #1 }
  }
\cs_new_protected:Npn \tl_analysis_show:n #1
  {
    \__tl_analysis:n {#1}
    \msg_show:nnxxxx { LaTeX / kernel } { show-tl-analysis }
      { } { \__tl_analysis_show: } { } { }
  }
\cs_new:Npn \__tl_analysis_show:
  {
    \exp_after:wN \__tl_analysis_show_loop:wNw \g__tl_analysis_result_tl
    \s__tl { ? \prg_break: } \s__tl
    \prg_break_point:
  }
\cs_new:Npn \__tl_analysis_show_loop:wNw #1 \s__tl #2 #3 \s__tl
  {
    \use_none:n #2
    \iow_newline: > \use:nn { ~ } { ~ }
    \if_int_compare:w "#2 = 0 \exp_stop_f:
      \exp_after:wN \__tl_analysis_show_cs:n
    \else:
      \if_int_compare:w "#2 = 13 \exp_stop_f:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__tl_analysis_show_active:n
      \else:
        \exp_after:wN \exp_after:wN
        \exp_after:wN \__tl_analysis_show_normal:n
      \fi:
    \fi:
    {#1}
    \__tl_analysis_show_loop:wNw
  }
\cs_new:Npn \__tl_analysis_show_normal:n #1
  {
    \exp_after:wN \token_to_str:N #1 ~
    ( \exp_after:wN \token_to_meaning:N #1 )
  }
\cs_new:Npn \__tl_analysis_show_value:N #1
  {
    \token_if_expandable:NF #1
      {
        \token_if_chardef:NTF       #1 \prg_break: { }
        \token_if_mathchardef:NTF   #1 \prg_break: { }
        \token_if_dim_register:NTF  #1 \prg_break: { }
        \token_if_int_register:NTF  #1 \prg_break: { }
        \token_if_skip_register:NTF #1 \prg_break: { }
        \token_if_toks_register:NTF #1 \prg_break: { }
        \use_none:nnn
        \prg_break_point:
        \use:n { \exp_after:wN = \tex_the:D #1 }
      }
  }
\cs_new:Npn \__tl_analysis_show_cs:n #1
  { \exp_args:No \__tl_analysis_show_long:nn {#1} { control~sequence= } }
\cs_new:Npn \__tl_analysis_show_active:n #1
  { \exp_args:No \__tl_analysis_show_long:nn {#1} { active~character= } }
\cs_new:Npn \__tl_analysis_show_long:nn #1
  {
    \__tl_analysis_show_long_aux:oofn
      { \token_to_str:N #1 }
      { \token_to_meaning:N #1 }
      { \__tl_analysis_show_value:N #1 }
  }
\cs_new:Npn \__tl_analysis_show_long_aux:nnnn #1#2#3#4
  {
    \int_compare:nNnTF
      { \str_count:n { #1 ~ ( #4 #2 #3 ) } }
      > { \l_iow_line_count_int - 3 }
      {
        \str_range:nnn { #1 ~ ( #4 #2 #3 ) } { 1 }
          {
            \l_iow_line_count_int - 3
            - \str_count:N \c__tl_analysis_show_etc_str
          }
        \c__tl_analysis_show_etc_str
      }
      { #1 ~ ( #4 #2 #3 ) }
  }
\cs_generate_variant:Nn \__tl_analysis_show_long_aux:nnnn { oof }
\cs_new:Npn \peek_analysis_map_break:
  { \prg_map_break:Nn \peek_analysis_map_break: { } }
\cs_new:Npn \peek_analysis_map_break:n
  { \prg_map_break:Nn \peek_analysis_map_break: }
\int_new:N \l__tl_peek_charcode_int
\cs_new:Npn \__tl_analysis_char_arg:Nw
  {
    \if_meaning:w \l__tl_analysis_token \c_space_token
      \exp_after:wN \__tl_analysis_char_arg_aux:Nw
    \fi:
  }
\cs_new:Npn \__tl_analysis_char_arg_aux:Nw #1 ~ { #1 { ~ } }
\cs_new_protected:Npn \peek_analysis_map_inline:n #1
  {
    \int_gincr:N \g__kernel_prg_map_int
    \cs_set_protected:cpn
      { __tl_analysis_map_ \int_use:N \g__kernel_prg_map_int :nnN }
      ##1##2##3
      {
        \group_end:
        #1
        \__tl_peek_analysis_loop:NNn
          \prg_break_point:Nn \peek_analysis_map_break: { }
      }
    \__tl_peek_analysis_loop:NNn ? ? ?
  }
\cs_new_protected:Npn \__tl_peek_analysis_loop:NNn #1#2#3
  {
    \group_begin:
    \tl_set:Nx \l__tl_peek_code_tl
      {
        \exp_not:c
          { __tl_analysis_map_ \int_use:N \g__kernel_prg_map_int :nnN }
      }
    \int_set:Nn \tex_escapechar:D { `\\ }
    \peek_after:Nw \__tl_peek_analysis_test:
  }
\cs_new_protected:Npn \__tl_peek_analysis_test:
  {
    \if_int_odd:w
      \if_catcode:w \exp_not:N \l_peek_token {   0 \exp_stop_f: \fi:
      \if_catcode:w \exp_not:N \l_peek_token }   0 \exp_stop_f: \fi:
      \if_meaning:w \l_peek_token \c_space_token 0 \exp_stop_f: \fi:
      1 \exp_stop_f:
      \exp_after:wN \exp_after:wN
      \exp_after:wN \__tl_peek_analysis_normal:N
      \exp_after:wN \exp_not:N
    \else:
      \exp_after:wN \__tl_peek_analysis_special:
    \fi:
  }
\cs_new_protected:Npn \__tl_peek_analysis_normal:N #1
  {
    \exp_after:wN \reverse_if:N \exp_after:wN \if_meaning:w
        \exp_not:N #1 #1
      \tex_let:D #1 \scan_stop:
      \tl_put_right:Nn \l__tl_peek_code_tl { { \exp_not:N #1 } }
    \else:
      \tl_put_right:Nn \l__tl_peek_code_tl { { \exp_not:n {#1} } }
    \fi:
    \if_charcode:w
        \scan_stop:
        \exp_after:wN \use_none:n \token_to_str:N #1 \prg_do_nothing:
        \scan_stop:
      \exp_after:wN \__tl_peek_analysis_char:N
      \exp_after:wN #1
    \else:
      \exp_after:wN \__tl_peek_analysis_cs:
    \fi:
  }
\cs_new_protected:Npn \__tl_peek_analysis_cs:
  { \l__tl_peek_code_tl { -1 } 0 }
\cs_new_protected:Npn \__tl_peek_analysis_char:N #1
  {
    \char_set_lccode:nn { `#1 } { 32 }
    \tex_lowercase:D { \__tl_peek_analysis_char:nN {#1} } #1
  }
\cs_new_protected:Npn \__tl_peek_analysis_char:nN #1#2
  {
    \cs_set_protected:Npn \__tl_tmp:w ##1 #1 ##2 ##3 \scan_stop:
      { \exp_args:No \l__tl_peek_code_tl { \int_value:w `#2 } ##2 }
    \exp_after:wN \__tl_tmp:w \c__tl_peek_catcodes_tl \scan_stop:
  }
\cs_new_protected:Npn \__tl_peek_analysis_special:
  {
    \tex_let:D \l__tl_analysis_token = ~ \l_peek_token
    \int_set:Nn \l__tl_peek_charcode_int
      { \__tl_analysis_extract_charcode: }
    \if_int_compare:w \l__tl_peek_charcode_int = \tex_escapechar:D
      \int_set:Nn \tex_escapechar:D { `\/ }
    \fi:
    \char_set_active_eq:nN { \l__tl_peek_charcode_int } \scan_stop:
    \char_set_active_eq:nN { \tex_escapechar:D } \scan_stop:
    \cs_set_eq:cN { } \scan_stop:
    \tex_futurelet:D \l__tl_analysis_token
    \__tl_peek_analysis_retest:
  }
\cs_new_protected:Npn \__tl_peek_analysis_retest:
  {
    \if_meaning:w \l__tl_analysis_token \scan_stop:
      \exp_after:wN \__tl_peek_analysis_normal:N
    \else:
      \exp_after:wN \__tl_peek_analysis_next:
    \fi:
  }
\cs_new_protected:Npn \__tl_peek_analysis_next:
  {
    \tl_if_empty:oT { \tex_the:D \tex_everyeof:D }
      { \tex_everyeof:D { \scan_stop: } }
    \tex_afterassignment:D \__tl_peek_analysis_str:
    \tex_futurelet:D \l__tl_analysis_next_token
  }
\cs_new_protected:Npn \__tl_peek_analysis_str:
  {
    \exp_after:wN \tex_futurelet:D
    \exp_after:wN \l__tl_analysis_token
    \exp_after:wN \__tl_peek_analysis_str:w
    \token_to_str:N
  }
\cs_new_protected:Npn \__tl_peek_analysis_str:w
  { \__tl_analysis_char_arg:Nw \__tl_peek_analysis_str:n }
\cs_new_protected:Npn \__tl_peek_analysis_str:n #1
  {
    \int_case:nnF { `#1 }
      {
        { \l__tl_peek_charcode_int }
          { \__tl_peek_analysis_explicit:n {#1} }
        { \tex_escapechar:D } { \__tl_peek_analysis_escape: }
      }
      { \__tl_peek_analysis_active_str:n {#1} }
  }
\cs_new_protected:Npn \__tl_peek_analysis_active_str:n #1
  {
    \tl_put_right:Nx \l__tl_peek_code_tl
      {
        { \char_generate:nn { `#1 } { 13 } }
        { \int_value:w `#1 }
        \token_to_str:N D
      }
    \l__tl_peek_code_tl
  }
\cs_new_protected:Npn \__tl_peek_analysis_explicit:n #1
  {
    \tl_put_right:Nx \l__tl_peek_code_tl
      {
        \if_meaning:w \l_peek_token \c_space_token
          { ~ } { 32 } \token_to_str:N A
        \else:
          \if_catcode:w \l_peek_token \c_group_begin_token
            {
              \exp_not:N \exp_after:wN
              \char_generate:nn { `#1 } { 1 }
              \exp_not:N \if_false:
              \if_false: { \fi: }
              \exp_not:N \fi:
            }
            { \int_value:w `#1 }
            1
          \else:
            {
              \exp_not:N \if_false:
              { \if_false: } \fi:
              \exp_not:N \fi:
              \char_generate:nn { `#1 } { 2 }
            }
            { \int_value:w `#1 }
            2
          \fi:
        \fi:
      }
    \l__tl_peek_code_tl
  }
\cs_new_protected:Npn \__tl_peek_analysis_escape:
  {
    \tl_clear:N \l__tl_internal_a_tl
    \tex_futurelet:D \l__tl_analysis_token
      \__tl_peek_analysis_collect:w
  }
\cs_new_protected:Npn \__tl_peek_analysis_collect:w
  { \__tl_analysis_char_arg:Nw \__tl_peek_analysis_collect:n }
\cs_new_protected:Npn \__tl_peek_analysis_collect:n #1
  {
    \tl_put_right:Nn \l__tl_internal_a_tl {#1}
    \__tl_peek_analysis_collect_loop:
  }
\cs_new_protected:Npn \__tl_peek_analysis_collect_loop:
  {
    \tex_futurelet:D \l__tl_analysis_token
      \__tl_peek_analysis_collect_test:
  }
\cs_new_protected:Npn \__tl_peek_analysis_collect_test:
  {
    \if_meaning:w \l__tl_analysis_token \l__tl_analysis_next_token
      \exp_after:wN \if_meaning:w \cs:w \l__tl_internal_a_tl \cs_end: \l_peek_token
        \__tl_peek_analysis_collect_end:NNN
      \fi:
    \fi:
    \__tl_peek_analysis_collect:w
  }
\cs_new_protected:Npn \__tl_peek_analysis_collect_end:NNN #1#2#3
  {
    #1 #2
    \tl_put_right:Nx \l__tl_peek_code_tl
      {
        { \exp_not:N \exp_not:n { \exp_not:c { \l__tl_internal_a_tl } } }
        { -1 }
        0
      }
    \l__tl_peek_code_tl
  }
\tl_const:Nx \c__tl_analysis_show_etc_str % (
  { \token_to_str:N \ETC.) }
\__kernel_msg_new:nnn { kernel } { show-tl-analysis }
  {
    The~token~list~ \tl_if_empty:nF {#1} { #1 ~ }
    \tl_if_empty:nTF {#2}
      { is~empty }
      { contains~the~tokens: #2 }
  }
%% File: l3regex.dtx
\cs_new_eq:NN \__regex_int_eval:w \tex_numexpr:D
\cs_new_protected:Npn \__regex_standard_escapechar:
  { \int_set:Nn \tex_escapechar:D { `\\ } }
\cs_new:Npn \__regex_toks_use:w { \tex_the:D \tex_toks:D }
\cs_new_protected:Npn \__regex_toks_clear:N #1
  { \__regex_toks_set:Nn #1 { } }
\cs_new_eq:NN \__regex_toks_set:Nn \tex_toks:D
\cs_new_protected:Npn \__regex_toks_set:No #1
  { \tex_toks:D #1 \exp_after:wN }
\cs_new_protected:Npn \__regex_toks_memcpy:NNn #1#2#3
  {
    \prg_replicate:nn {#3}
      {
        \tex_toks:D #1 = \tex_toks:D #2
        \int_incr:N #1
        \int_incr:N #2
      }
  }
\cs_new_protected:Npn \__regex_toks_put_left:Nx #1#2
  {
    \cs_set_nopar:Npx \__regex_tmp:w { #2 }
    \tex_toks:D #1 \exp_after:wN \exp_after:wN \exp_after:wN
      { \exp_after:wN \__regex_tmp:w \tex_the:D \tex_toks:D #1 }
  }
\cs_new_protected:Npn \__regex_toks_put_right:Nx #1#2
  {
    \cs_set_nopar:Npx \__regex_tmp:w {#2}
    \tex_toks:D #1 \exp_after:wN
      { \tex_the:D \tex_toks:D \exp_after:wN #1 \__regex_tmp:w }
  }
\cs_new_protected:Npn \__regex_toks_put_right:Nn #1#2
  { \tex_toks:D #1 \exp_after:wN { \tex_the:D \tex_toks:D #1 #2 } }
\cs_new:Npn \__regex_curr_cs_to_str:
  {
    \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N
    \l__regex_curr_token_tl
  }
\cs_new:Npn \__regex_intarray_item:NnF #1#2
  { \exp_args:Nf \__regex_intarray_item_aux:nNF { \int_eval:n {#2} } #1 }
\cs_new:Npn \__regex_intarray_item_aux:nNF #1#2
  {
    \if_int_compare:w #1 > \c_zero_int
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
    { \__kernel_intarray_item:Nn #2 {#1} }
  }
\cs_new:Npn \__regex_maplike_break:
  { \prg_map_break:Nn \__regex_maplike_break: { } }
\cs_new:Npn \__regex_tmp:w { }
\tl_new:N   \l__regex_internal_a_tl
\tl_new:N   \l__regex_internal_b_tl
\int_new:N  \l__regex_internal_a_int
\int_new:N  \l__regex_internal_b_int
\int_new:N  \l__regex_internal_c_int
\bool_new:N \l__regex_internal_bool
\seq_new:N  \l__regex_internal_seq
\tl_new:N   \g__regex_internal_tl
\tl_new:N \l__regex_build_tl
\tl_const:Nn \c__regex_no_match_regex
  {
    \__regex_branch:n
      { \__regex_class:NnnnN \c_true_bool { } { 1 } { 0 } \c_true_bool }
  }
\int_new:N \l__regex_balance_int
\int_const:Nn \c__regex_ascii_min_int { 0 }
\int_const:Nn \c__regex_ascii_max_control_int { 31 }
\int_const:Nn \c__regex_ascii_max_int { 127 }
\int_const:Nn \c__regex_ascii_lower_int { `a - `A }
\quark_new:N \q__regex_recursion_stop
\cs_new:Npn \__regex_use_none_delimit_by_q_recursion_stop:w
  #1 \q__regex_recursion_stop { }
\cs_new:Npn \__regex_use_i_delimit_by_q_recursion_stop:nw
  #1 #2 \q__regex_recursion_stop {#1}
\quark_new:N \q__regex_nil
\__kernel_quark_new_conditional:Nn \__regex_quark_if_nil:N { F }
\cs_new_protected:Npn \__regex_break_true:w
   #1 \__regex_break_point:TF #2 #3 {#2}
\cs_new_protected:Npn \__regex_break_point:TF #1 #2 { #2 }
\cs_new_protected:Npn \__regex_item_reverse:n #1
  {
    #1
    \__regex_break_point:TF { } \__regex_break_true:w
  }
\cs_new_protected:Npn \__regex_item_caseful_equal:n #1
  {
    \if_int_compare:w #1 = \l__regex_curr_char_int
      \exp_after:wN \__regex_break_true:w
    \fi:
  }
\cs_new_protected:Npn \__regex_item_caseful_range:nn #1 #2
  {
    \reverse_if:N \if_int_compare:w #1 > \l__regex_curr_char_int
      \reverse_if:N \if_int_compare:w #2 < \l__regex_curr_char_int
        \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__regex_item_caseless_equal:n #1
  {
    \if_int_compare:w #1 = \l__regex_curr_char_int
      \exp_after:wN \__regex_break_true:w
    \fi:
    \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int
      \__regex_compute_case_changed_char:
    \fi:
    \if_int_compare:w #1 = \l__regex_case_changed_char_int
      \exp_after:wN \__regex_break_true:w
    \fi:
  }
\cs_new_protected:Npn \__regex_item_caseless_range:nn #1 #2
  {
    \reverse_if:N \if_int_compare:w #1 > \l__regex_curr_char_int
      \reverse_if:N \if_int_compare:w #2 < \l__regex_curr_char_int
        \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w
      \fi:
    \fi:
    \if_int_compare:w \l__regex_case_changed_char_int = \c_max_int
      \__regex_compute_case_changed_char:
    \fi:
    \reverse_if:N \if_int_compare:w #1 > \l__regex_case_changed_char_int
      \reverse_if:N \if_int_compare:w #2 < \l__regex_case_changed_char_int
        \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__regex_compute_case_changed_char:
  {
    \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_curr_char_int
    \if_int_compare:w \l__regex_curr_char_int > `Z \exp_stop_f:
      \if_int_compare:w \l__regex_curr_char_int > `z \exp_stop_f: \else:
        \if_int_compare:w \l__regex_curr_char_int < `a \exp_stop_f: \else:
          \int_sub:Nn \l__regex_case_changed_char_int
            { \c__regex_ascii_lower_int }
        \fi:
      \fi:
    \else:
      \if_int_compare:w \l__regex_curr_char_int < `A \exp_stop_f: \else:
        \int_add:Nn \l__regex_case_changed_char_int
          { \c__regex_ascii_lower_int }
      \fi:
    \fi:
  }
\cs_new_eq:NN \__regex_item_equal:n ?
\cs_new_eq:NN \__regex_item_range:nn ?
\cs_new_protected:Npn \__regex_item_catcode:
  {
    "
    \if_case:w \l__regex_curr_catcode_int
         1       \or: 4       \or: 10      \or: 40
    \or: 100     \or:         \or: 1000    \or: 4000
    \or: 10000   \or:         \or: 100000  \or: 400000
    \or: 1000000 \or: 4000000 \else: 1*0
    \fi:
  }
\cs_new_protected:Npn \__regex_item_catcode:nT #1
  {
    \if_int_odd:w \int_eval:n { #1 / \__regex_item_catcode: } \exp_stop_f:
      \exp_after:wN \use:n
    \else:
      \exp_after:wN \use_none:n
    \fi:
  }
\cs_new_protected:Npn \__regex_item_catcode_reverse:nT #1#2
  { \__regex_item_catcode:nT {#1} { \__regex_item_reverse:n {#2} } }
\cs_new_protected:Npn \__regex_item_exact:nn #1#2
  {
    \if_int_compare:w #1 = \l__regex_curr_catcode_int
      \if_int_compare:w #2 = \l__regex_curr_char_int
        \exp_after:wN \exp_after:wN \exp_after:wN \__regex_break_true:w
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__regex_item_exact_cs:n #1
  {
    \int_compare:nNnTF \l__regex_curr_catcode_int = 0
      {
        \__kernel_tl_set:Nx \l__regex_internal_a_tl
          { \scan_stop: \__regex_curr_cs_to_str: \scan_stop: }
        \tl_if_in:noTF { \scan_stop: #1 \scan_stop: }
          \l__regex_internal_a_tl
          { \__regex_break_true:w } { }
      }
      { }
  }
\cs_new_protected:Npn \__regex_item_cs:n #1
  {
    \int_compare:nNnT \l__regex_curr_catcode_int = 0
      {
        \group_begin:
          \__regex_single_match:
          \__regex_disable_submatches:
          \__regex_build_for_cs:n {#1}
          \bool_set_eq:NN \l__regex_saved_success_bool
            \g__regex_success_bool
          \exp_args:Nx \__regex_match_cs:n { \__regex_curr_cs_to_str: }
          \if_meaning:w \c_true_bool \g__regex_success_bool
            \group_insert_after:N \__regex_break_true:w
          \fi:
          \bool_gset_eq:NN \g__regex_success_bool
            \l__regex_saved_success_bool
        \group_end:
      }
  }
\cs_new_protected:Npn \__regex_prop_d:
  { \__regex_item_caseful_range:nn { `0 } { `9 } }
\cs_new_protected:Npn \__regex_prop_h:
  {
    \__regex_item_caseful_equal:n { `\ }
    \__regex_item_caseful_equal:n { `\^^I }
  }
\cs_new_protected:Npn \__regex_prop_s:
  {
    \__regex_item_caseful_equal:n { `\ }
    \__regex_item_caseful_equal:n { `\^^I }
    \__regex_item_caseful_equal:n { `\^^J }
    \__regex_item_caseful_equal:n { `\^^L }
    \__regex_item_caseful_equal:n { `\^^M }
  }
\cs_new_protected:Npn \__regex_prop_v:
  { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr
\cs_new_protected:Npn \__regex_prop_w:
  {
    \__regex_item_caseful_range:nn { `a } { `z }
    \__regex_item_caseful_range:nn { `A } { `Z }
    \__regex_item_caseful_range:nn { `0 } { `9 }
    \__regex_item_caseful_equal:n { `_ }
  }
\cs_new_protected:Npn \__regex_prop_N:
  {
    \__regex_item_reverse:n
      { \__regex_item_caseful_equal:n { `\^^J } }
  }
\cs_new_protected:Npn \__regex_posix_alnum:
  { \__regex_posix_alpha: \__regex_posix_digit: }
\cs_new_protected:Npn \__regex_posix_alpha:
  { \__regex_posix_lower: \__regex_posix_upper: }
\cs_new_protected:Npn \__regex_posix_ascii:
  {
    \__regex_item_caseful_range:nn
      \c__regex_ascii_min_int
      \c__regex_ascii_max_int
  }
\cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h:
\cs_new_protected:Npn \__regex_posix_cntrl:
  {
    \__regex_item_caseful_range:nn
      \c__regex_ascii_min_int
      \c__regex_ascii_max_control_int
    \__regex_item_caseful_equal:n \c__regex_ascii_max_int
  }
\cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d:
\cs_new_protected:Npn \__regex_posix_graph:
  { \__regex_item_caseful_range:nn { `! } { `\~ } }
\cs_new_protected:Npn \__regex_posix_lower:
  { \__regex_item_caseful_range:nn { `a } { `z } }
\cs_new_protected:Npn \__regex_posix_print:
  { \__regex_item_caseful_range:nn { `\  } { `\~ } }
\cs_new_protected:Npn \__regex_posix_punct:
  {
    \__regex_item_caseful_range:nn { `! } { `/ }
    \__regex_item_caseful_range:nn { `: } { `@ }
    \__regex_item_caseful_range:nn { `[ } { `` }
    \__regex_item_caseful_range:nn { `\{ } { `\~ }
  }
\cs_new_protected:Npn \__regex_posix_space:
  {
    \__regex_item_caseful_equal:n { `\  }
    \__regex_item_caseful_range:nn { `\^^I } { `\^^M }
  }
\cs_new_protected:Npn \__regex_posix_upper:
  { \__regex_item_caseful_range:nn { `A } { `Z } }
\cs_new_eq:NN \__regex_posix_word: \__regex_prop_w:
\cs_new_protected:Npn \__regex_posix_xdigit:
  {
    \__regex_posix_digit:
    \__regex_item_caseful_range:nn { `A } { `F }
    \__regex_item_caseful_range:nn { `a } { `f }
  }
\cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4
  {
    \group_begin:
      \tl_clear:N \l__regex_internal_a_tl
      \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 }
      \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 }
      \cs_set:Npn \__regex_escape_raw:N ##1 { #3 }
      \__regex_standard_escapechar:
      \__kernel_tl_gset:Nx \g__regex_internal_tl
        { \__kernel_str_to_other_fast:n {#4} }
      \tl_put_right:Nx \l__regex_internal_a_tl
        {
          \exp_after:wN \__regex_escape_loop:N \g__regex_internal_tl
          { break } \prg_break_point:
        }
      \exp_after:wN
    \group_end:
    \l__regex_internal_a_tl
  }
\cs_new:Npn \__regex_escape_loop:N #1
  {
    \cs_if_exist_use:cF { __regex_escape_\token_to_str:N #1:w }
      { \__regex_escape_unescaped:N #1 }
    \__regex_escape_loop:N
  }
\cs_new:cpn { __regex_escape_ \c_backslash_str :w }
    \__regex_escape_loop:N #1
  {
    \cs_if_exist_use:cF { __regex_escape_/\token_to_str:N #1:w }
      { \__regex_escape_escaped:N #1 }
    \__regex_escape_loop:N
  }
\cs_new_eq:NN \__regex_escape_unescaped:N ?
\cs_new_eq:NN \__regex_escape_escaped:N   ?
\cs_new_eq:NN \__regex_escape_raw:N       ?
\cs_new_eq:NN \__regex_escape_break:w \prg_break:
\cs_new:cpn { __regex_escape_/break:w }
  {
    \__kernel_msg_expandable_error:nn { kernel } { trailing-backslash }
    \prg_break:
  }
\cs_new:cpn { __regex_escape_~:w } { }
\cs_new:cpx { __regex_escape_/a:w }
  { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^G }
\cs_new:cpx { __regex_escape_/t:w }
  { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^I }
\cs_new:cpx { __regex_escape_/n:w }
  { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^J }
\cs_new:cpx { __regex_escape_/f:w }
  { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^L }
\cs_new:cpx { __regex_escape_/r:w }
  { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^M }
\cs_new:cpx { __regex_escape_/e:w }
  { \exp_not:N \__regex_escape_raw:N \iow_char:N \^^[ }
\cs_new:cpn { __regex_escape_/x:w } \__regex_escape_loop:N
  {
    \exp_after:wN \__regex_escape_x_end:w
    \int_value:w "0 \__regex_escape_x_test:N
  }
\cs_new:Npn \__regex_escape_x_end:w #1 ;
  {
    \int_compare:nNnTF {#1} > \c_max_char_int
      {
        \__kernel_msg_expandable_error:nnff { kernel } { x-overflow }
          {#1} { \int_to_Hex:n {#1} }
      }
      {
        \exp_last_unbraced:Nf \__regex_escape_raw:N
          { \char_generate:nn {#1} { 12 } }
      }
  }
\cs_new:Npn \__regex_escape_x_test:N #1
  {
    \str_if_eq:nnTF {#1} { break } { ; }
      {
        \if_charcode:w \c_space_token #1
          \exp_after:wN \__regex_escape_x_test:N
        \else:
          \exp_after:wN \__regex_escape_x_testii:N
          \exp_after:wN #1
        \fi:
      }
  }
\cs_new:Npn \__regex_escape_x_testii:N #1
  {
    \if_charcode:w \c_left_brace_str #1
      \exp_after:wN \__regex_escape_x_loop:N
    \else:
      \__regex_hexadecimal_use:NTF #1
        { \exp_after:wN \__regex_escape_x:N }
        { ; \exp_after:wN \__regex_escape_loop:N \exp_after:wN #1 }
    \fi:
  }
\cs_new:Npn \__regex_escape_x:N #1
  {
    \str_if_eq:nnTF {#1} { break } { ; }
      {
        \__regex_hexadecimal_use:NTF #1
          { ; \__regex_escape_loop:N }
          { ; \__regex_escape_loop:N #1 }
      }
  }
\cs_new:Npn \__regex_escape_x_loop:N #1
  {
    \str_if_eq:nnTF {#1} { break }
      { ; \__regex_escape_x_loop_error:n { } {#1} }
      {
        \__regex_hexadecimal_use:NTF #1
          { \__regex_escape_x_loop:N }
          {
            \token_if_eq_charcode:NNTF \c_space_token #1
              { \__regex_escape_x_loop:N }
              {
                ;
                \exp_after:wN
                \token_if_eq_charcode:NNTF \c_right_brace_str #1
                  { \__regex_escape_loop:N }
                  { \__regex_escape_x_loop_error:n {#1} }
              }
          }
      }
  }
\cs_new:Npn \__regex_escape_x_loop_error:n #1
  {
    \__kernel_msg_expandable_error:nnn { kernel } { x-missing-rbrace } {#1}
    \__regex_escape_loop:N #1
  }
\prg_new_conditional:Npnn \__regex_hexadecimal_use:N #1 { TF }
  {
    \if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f:
      #1 \prg_return_true:
    \else:
      \if_case:w
        \int_eval:n { \exp_after:wN ` \token_to_str:N #1 - `a }
           A
      \or: B
      \or: C
      \or: D
      \or: E
      \or: F
      \else:
        \prg_return_false:
        \exp_after:wN \use_none:n
      \fi:
      \prg_return_true:
    \fi:
  }
\prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF }
  {
    \if_int_compare:w `#1 > `Z \exp_stop_f:
      \if_int_compare:w `#1 > `z \exp_stop_f:
        \if_int_compare:w `#1 < \c__regex_ascii_max_int
          \prg_return_true: \else: \prg_return_false: \fi:
      \else:
        \if_int_compare:w `#1 < `a \exp_stop_f:
          \prg_return_true: \else: \prg_return_false: \fi:
      \fi:
    \else:
      \if_int_compare:w `#1 > `9 \exp_stop_f:
        \if_int_compare:w `#1 < `A \exp_stop_f:
          \prg_return_true: \else: \prg_return_false: \fi:
      \else:
        \if_int_compare:w `#1 < `0 \exp_stop_f:
          \if_int_compare:w `#1 < `\ \exp_stop_f:
            \prg_return_false: \else: \prg_return_true: \fi:
        \else: \prg_return_false: \fi:
      \fi:
    \fi:
  }
\prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF }
  {
    \if_int_compare:w `#1 > `Z \exp_stop_f:
      \if_int_compare:w `#1 > `z \exp_stop_f:
        \prg_return_false:
      \else:
        \if_int_compare:w `#1 < `a \exp_stop_f:
          \prg_return_false: \else: \prg_return_true: \fi:
      \fi:
    \else:
      \if_int_compare:w `#1 > `9 \exp_stop_f:
        \if_int_compare:w `#1 < `A \exp_stop_f:
          \prg_return_false: \else: \prg_return_true: \fi:
      \else:
        \if_int_compare:w `#1 < `0 \exp_stop_f:
          \prg_return_false: \else: \prg_return_true: \fi:
      \fi:
    \fi:
  }
\int_new:N \l__regex_group_level_int
\int_new:N \l__regex_mode_int
\int_const:Nn \c__regex_cs_in_class_mode_int { -6 }
\int_const:Nn \c__regex_cs_mode_int { -2 }
\int_const:Nn \c__regex_outer_mode_int { 0 }
\int_const:Nn \c__regex_catcode_mode_int { 2 }
\int_const:Nn \c__regex_class_mode_int { 3 }
\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 }
\int_new:N \l__regex_catcodes_int
\int_new:N \l__regex_default_catcodes_int
\bool_new:N \l__regex_catcodes_bool
\int_const:Nn \c__regex_catcode_C_int { "1 }
\int_const:Nn \c__regex_catcode_B_int { "4 }
\int_const:Nn \c__regex_catcode_E_int { "10 }
\int_const:Nn \c__regex_catcode_M_int { "40 }
\int_const:Nn \c__regex_catcode_T_int { "100 }
\int_const:Nn \c__regex_catcode_P_int { "1000 }
\int_const:Nn \c__regex_catcode_U_int { "4000 }
\int_const:Nn \c__regex_catcode_D_int { "10000 }
\int_const:Nn \c__regex_catcode_S_int { "100000 }
\int_const:Nn \c__regex_catcode_L_int { "400000 }
\int_const:Nn \c__regex_catcode_O_int { "1000000 }
\int_const:Nn \c__regex_catcode_A_int { "4000000 }
\int_const:Nn \c__regex_all_catcodes_int { "5515155 }
\cs_new_eq:NN \l__regex_internal_regex \c__regex_no_match_regex
\seq_new:N \l__regex_show_prefix_seq
\int_new:N \l__regex_show_lines_int
\prg_new_conditional:Npnn \__regex_two_if_eq:NNNN #1#2#3#4 { TF }
  {
    \if_meaning:w #1 #3
      \if:w #2 #4
        \prg_return_true:
      \else:
        \prg_return_false:
      \fi:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new_protected:Npn \__regex_get_digits:NTFw #1#2#3#4#5
  {
    \__regex_if_raw_digit:NNTF #4 #5
      { #1 = #5 \__regex_get_digits_loop:nw {#2} }
      { #3 #4 #5 }
  }
\cs_new:Npn \__regex_get_digits_loop:nw #1#2#3
  {
    \__regex_if_raw_digit:NNTF #2 #3
      { #3 \__regex_get_digits_loop:nw {#1} }
      { \scan_stop: #1 #2 #3 }
  }
\prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF }
  {
    \if_meaning:w \__regex_compile_raw:N #1
      \if_int_compare:w 1 < 1 #2 \exp_stop_f:
        \prg_return_true:
      \else:
        \prg_return_false:
      \fi:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new:Npn \__regex_if_in_class:TF
  {
    \if_int_odd:w \l__regex_mode_int
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
  }
\cs_new:Npn \__regex_if_in_cs:TF
  {
    \if_int_odd:w \l__regex_mode_int
      \exp_after:wN \use_ii:nn
    \else:
      \if_int_compare:w \l__regex_mode_int < \c__regex_outer_mode_int
        \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn
      \else:
        \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn
      \fi:
    \fi:
  }
\cs_new:Npn \__regex_if_in_class_or_catcode:TF
  {
    \if_int_odd:w \l__regex_mode_int
      \exp_after:wN \use_i:nn
    \else:
      \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int
        \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn
      \else:
        \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn
      \fi:
    \fi:
  }
\cs_new:Npn \__regex_if_within_catcode:TF
  {
    \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
  }
\cs_new_protected:Npn \__regex_chk_c_allowed:T
  {
    \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int
      \exp_after:wN \use:n
    \else:
      \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int
        \exp_after:wN \exp_after:wN \exp_after:wN \use:n
      \else:
        \__kernel_msg_error:nn { kernel } { c-bad-mode }
        \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__regex_mode_quit_c:
  {
    \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int
      \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int
    \else:
      \if_int_compare:w \l__regex_mode_int =
        \c__regex_catcode_in_class_mode_int
        \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__regex_compile:w
  {
    \group_begin:
      \tl_build_begin:N \l__regex_build_tl
      \int_zero:N \l__regex_group_level_int
      \int_set_eq:NN \l__regex_default_catcodes_int
        \c__regex_all_catcodes_int
      \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int
      \cs_set:Npn \__regex_item_equal:n  { \__regex_item_caseful_equal:n }
      \cs_set:Npn \__regex_item_range:nn { \__regex_item_caseful_range:nn }
      \tl_build_put_right:Nn \l__regex_build_tl
        { \__regex_branch:n { \if_false: } \fi: }
  }
\cs_new_protected:Npn \__regex_compile_end:
  {
      \__regex_if_in_class:TF
        {
          \__kernel_msg_error:nn { kernel } { missing-rbrack }
          \use:c { __regex_compile_]: }
          \prg_do_nothing: \prg_do_nothing:
        }
        { }
      \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f:
        \__kernel_msg_error:nnx { kernel } { missing-rparen }
          { \int_use:N \l__regex_group_level_int }
        \prg_replicate:nn
          { \l__regex_group_level_int }
          {
              \tl_build_put_right:Nn \l__regex_build_tl
                {
                  \if_false: { \fi: }
                  \if_false: { \fi: } { 1 } { 0 } \c_true_bool
                }
              \tl_build_end:N \l__regex_build_tl
              \exp_args:NNNo
            \group_end:
            \tl_build_put_right:Nn \l__regex_build_tl
              { \l__regex_build_tl }
          }
      \fi:
      \tl_build_put_right:Nn \l__regex_build_tl { \if_false: { \fi: } }
      \tl_build_end:N \l__regex_build_tl
      \exp_args:NNNx
    \group_end:
    \tl_set:Nn \l__regex_internal_regex { \l__regex_build_tl }
  }
\cs_new_protected:Npn \__regex_compile:n #1
  {
    \__regex_compile:w
      \__regex_standard_escapechar:
      \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int
      \__regex_escape_use:nnnn
        {
          \__regex_char_if_special:NTF ##1
            \__regex_compile_special:N \__regex_compile_raw:N ##1
        }
        {
          \__regex_char_if_alphanumeric:NTF ##1
            \__regex_compile_escaped:N \__regex_compile_raw:N ##1
        }
        { \__regex_compile_raw:N ##1 }
        { #1 }
      \prg_do_nothing: \prg_do_nothing:
      \prg_do_nothing: \prg_do_nothing:
      \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int
        { \__kernel_msg_error:nn { kernel } { c-trailing } }
      \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int
        {
          \__kernel_msg_error:nn { kernel } { c-missing-rbrace }
          \__regex_compile_end_cs:
          \prg_do_nothing: \prg_do_nothing:
          \prg_do_nothing: \prg_do_nothing:
        }
    \__regex_compile_end:
  }
\cs_new_protected:Npn \__regex_compile_special:N #1
  {
    \cs_if_exist_use:cF { __regex_compile_#1: }
      { \__regex_compile_raw:N #1 }
  }
\cs_new_protected:Npn \__regex_compile_escaped:N #1
  {
    \cs_if_exist_use:cF { __regex_compile_/#1: }
      { \__regex_compile_raw:N #1 }
  }
\cs_new_protected:Npn \__regex_compile_one:n #1
  {
    \__regex_mode_quit_c:
    \__regex_if_in_class:TF { }
      {
        \tl_build_put_right:Nn \l__regex_build_tl
          { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
      }
    \tl_build_put_right:Nx \l__regex_build_tl
      {
        \if_int_compare:w \l__regex_catcodes_int <
          \c__regex_all_catcodes_int
          \__regex_item_catcode:nT { \int_use:N \l__regex_catcodes_int }
            { \exp_not:N \exp_not:n {#1} }
        \else:
          \exp_not:N \exp_not:n {#1}
        \fi:
      }
    \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int
    \__regex_if_in_class:TF { } { \__regex_compile_quantifier:w }
  }
\cs_new_protected:Npn \__regex_compile_abort_tokens:n #1
  {
    \use:x
      {
        \exp_args:No \tl_map_function:nN { \tl_to_str:n {#1} }
          \__regex_compile_raw:N
      }
  }
\cs_generate_variant:Nn \__regex_compile_abort_tokens:n { x }
\cs_new_protected:Npn \__regex_compile_quantifier:w #1#2
  {
    \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N
      {
        \cs_if_exist_use:cF { __regex_compile_quantifier_#2:w }
          { \__regex_compile_quantifier_none: #1 #2 }
      }
      { \__regex_compile_quantifier_none: #1 #2 }
  }
\cs_new_protected:Npn \__regex_compile_quantifier_none:
  {
    \tl_build_put_right:Nn \l__regex_build_tl
      { \if_false: { \fi: } { 1 } { 0 } \c_false_bool }
  }
\cs_new_protected:Npn \__regex_compile_quantifier_abort:xNN #1#2#3
  {
    \__regex_compile_quantifier_none:
    \__kernel_msg_warning:nnxx { kernel } { invalid-quantifier } {#1} {#3}
    \__regex_compile_abort_tokens:x {#1}
    #2 #3
  }
\cs_new_protected:Npn \__regex_compile_quantifier_lazyness:nnNN #1#2#3#4
  {
    \__regex_two_if_eq:NNNNTF #3 #4 \__regex_compile_special:N ?
      {
        \tl_build_put_right:Nn \l__regex_build_tl
          { \if_false: { \fi: } { #1 } { #2 } \c_true_bool }
      }
      {
        \tl_build_put_right:Nn \l__regex_build_tl
          { \if_false: { \fi: } { #1 } { #2 } \c_false_bool }
        #3 #4
      }
  }
\cs_new_protected:cpn { __regex_compile_quantifier_?:w }
  { \__regex_compile_quantifier_lazyness:nnNN { 0 } { 1 } }
\cs_new_protected:cpn { __regex_compile_quantifier_*:w }
  { \__regex_compile_quantifier_lazyness:nnNN { 0 } { -1 } }
\cs_new_protected:cpn { __regex_compile_quantifier_+:w }
  { \__regex_compile_quantifier_lazyness:nnNN { 1 } { -1 } }
\cs_new_protected:cpn { __regex_compile_quantifier_ \c_left_brace_str :w }
  {
    \__regex_get_digits:NTFw \l__regex_internal_a_int
      { \__regex_compile_quantifier_braced_auxi:w }
      { \__regex_compile_quantifier_abort:xNN { \c_left_brace_str } }
  }
\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxi:w #1#2
  {
    \str_case_e:nnF { #1 #2 }
      {
        { \__regex_compile_special:N \c_right_brace_str }
          {
            \exp_args:No \__regex_compile_quantifier_lazyness:nnNN
              { \int_use:N \l__regex_internal_a_int } { 0 }
          }
        { \__regex_compile_special:N , }
          {
            \__regex_get_digits:NTFw \l__regex_internal_b_int
              { \__regex_compile_quantifier_braced_auxiii:w }
              { \__regex_compile_quantifier_braced_auxii:w }
          }
      }
      {
        \__regex_compile_quantifier_abort:xNN
          { \c_left_brace_str \int_use:N \l__regex_internal_a_int }
        #1 #2
      }
  }
\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxii:w #1#2
  {
    \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_special:N \c_right_brace_str
      {
        \exp_args:No \__regex_compile_quantifier_lazyness:nnNN
          { \int_use:N \l__regex_internal_a_int } { -1 }
      }
      {
        \__regex_compile_quantifier_abort:xNN
          { \c_left_brace_str \int_use:N \l__regex_internal_a_int , }
        #1 #2
      }
  }
\cs_new_protected:Npn \__regex_compile_quantifier_braced_auxiii:w #1#2
  {
    \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_special:N \c_right_brace_str
      {
        \if_int_compare:w \l__regex_internal_a_int >
          \l__regex_internal_b_int
          \__kernel_msg_error:nnxx { kernel } { backwards-quantifier }
            { \int_use:N \l__regex_internal_a_int }
            { \int_use:N \l__regex_internal_b_int }
          \int_zero:N \l__regex_internal_b_int
        \else:
          \int_sub:Nn \l__regex_internal_b_int \l__regex_internal_a_int
        \fi:
        \exp_args:Noo \__regex_compile_quantifier_lazyness:nnNN
          { \int_use:N \l__regex_internal_a_int }
          { \int_use:N \l__regex_internal_b_int }
      }
      {
        \__regex_compile_quantifier_abort:xNN
          {
            \c_left_brace_str
            \int_use:N \l__regex_internal_a_int ,
            \int_use:N \l__regex_internal_b_int
          }
        #1 #2
      }
  }
\cs_new_protected:Npn \__regex_compile_raw_error:N #1
  {
    \__kernel_msg_error:nnx { kernel } { bad-escape } {#1}
    \__regex_compile_raw:N #1
  }
\cs_new_protected:Npn \__regex_compile_raw:N #1#2#3
  {
    \__regex_if_in_class:TF
      {
        \__regex_two_if_eq:NNNNTF #2 #3 \__regex_compile_special:N -
          { \__regex_compile_range:Nw #1 }
          {
            \__regex_compile_one:n
              { \__regex_item_equal:n { \int_value:w `#1 } }
            #2 #3
          }
      }
      {
        \__regex_compile_one:n
          { \__regex_item_equal:n { \int_value:w `#1 } }
        #2 #3
      }
  }
\prg_new_protected_conditional:Npnn \__regex_if_end_range:NN #1#2 { TF }
  {
    \if_meaning:w \__regex_compile_raw:N #1
      \prg_return_true:
    \else:
      \if_meaning:w \__regex_compile_special:N #1
        \if_charcode:w ] #2
          \prg_return_false:
        \else:
          \prg_return_true:
        \fi:
      \else:
        \prg_return_false:
      \fi:
    \fi:
  }
\cs_new_protected:Npn \__regex_compile_range:Nw #1#2#3
  {
    \__regex_if_end_range:NNTF #2 #3
      {
        \if_int_compare:w `#1 > `#3 \exp_stop_f:
          \__kernel_msg_error:nnxx { kernel } { range-backwards } {#1} {#3}
        \else:
          \tl_build_put_right:Nx \l__regex_build_tl
            {
              \if_int_compare:w `#1 = `#3 \exp_stop_f:
                \__regex_item_equal:n
              \else:
                \__regex_item_range:nn { \int_value:w `#1 }
              \fi:
              { \int_value:w `#3 }
            }
        \fi:
      }
      {
        \__kernel_msg_warning:nnxx { kernel } { range-missing-end }
          {#1} { \c_backslash_str #3 }
        \tl_build_put_right:Nx \l__regex_build_tl
          {
            \__regex_item_equal:n { \int_value:w `#1 \exp_stop_f: }
            \__regex_item_equal:n { \int_value:w `- \exp_stop_f: }
          }
        #2#3
      }
  }
\cs_new_protected:cpx { __regex_compile_.: }
  {
    \exp_not:N \__regex_if_in_class:TF
      { \__regex_compile_raw:N . }
      { \__regex_compile_one:n \exp_not:c { __regex_prop_.: } }
  }
\cs_new_protected:cpn { __regex_prop_.: }
  {
    \if_int_compare:w \l__regex_curr_char_int > - 2 \exp_stop_f:
      \exp_after:wN \__regex_break_true:w
    \fi:
  }
\cs_set_protected:Npn \__regex_tmp:w #1#2
  {
    \cs_new_protected:cpx { __regex_compile_/#1: }
      { \__regex_compile_one:n \exp_not:c { __regex_prop_#1: } }
    \cs_new_protected:cpx { __regex_compile_/#2: }
      {
        \__regex_compile_one:n
          { \__regex_item_reverse:n \exp_not:c { __regex_prop_#1: } }
      }
  }
\__regex_tmp:w d D
\__regex_tmp:w h H
\__regex_tmp:w s S
\__regex_tmp:w v V
\__regex_tmp:w w W
\cs_new_protected:cpn { __regex_compile_/N: }
  { \__regex_compile_one:n \__regex_prop_N: }
\cs_new_protected:Npn \__regex_compile_anchor_letter:NNN #1#2#3
  {
    \__regex_if_in_class_or_catcode:TF { \__regex_compile_raw_error:N #1 }
      {
        \tl_build_put_right:Nn \l__regex_build_tl
          { \__regex_assertion:Nn #2 {#3} }
      }
  }
\cs_new_protected:cpn { __regex_compile_/A: }
  { \__regex_compile_anchor_letter:NNN A \c_true_bool \__regex_A_test: }
\cs_new_protected:cpn { __regex_compile_/G: }
  { \__regex_compile_anchor_letter:NNN G \c_true_bool \__regex_G_test: }
\cs_new_protected:cpn { __regex_compile_/Z: }
  { \__regex_compile_anchor_letter:NNN Z \c_true_bool \__regex_Z_test: }
\cs_new_protected:cpn { __regex_compile_/z: }
  { \__regex_compile_anchor_letter:NNN z \c_true_bool \__regex_Z_test: }
\cs_new_protected:cpn { __regex_compile_/b: }
  { \__regex_compile_anchor_letter:NNN b \c_true_bool \__regex_b_test: }
\cs_new_protected:cpn { __regex_compile_/B: }
  { \__regex_compile_anchor_letter:NNN B \c_false_bool \__regex_b_test: }
\cs_set_protected:Npn \__regex_tmp:w #1#2
  {
    \cs_new_protected:cpn { __regex_compile_#1: }
      {
        \__regex_if_in_class_or_catcode:TF { \__regex_compile_raw:N #1 }
          {
            \tl_build_put_right:Nn \l__regex_build_tl
              { \__regex_assertion:Nn \c_true_bool {#2} }
          }
      }
  }
\exp_args:Nx \__regex_tmp:w { \iow_char:N \^ } { \__regex_A_test: }
\exp_args:Nx \__regex_tmp:w { \iow_char:N \$ } { \__regex_Z_test: }
\cs_new_protected:cpn { __regex_compile_]: }
  {
    \__regex_if_in_class:TF
      {
        \if_int_compare:w \l__regex_mode_int >
          \c__regex_catcode_in_class_mode_int
          \tl_build_put_right:Nn \l__regex_build_tl { \if_false: { \fi: } }
        \fi:
        \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f:
        \tex_divide:D \l__regex_mode_int 13 \exp_stop_f:
        \if_int_odd:w \l__regex_mode_int \else:
          \exp_after:wN \__regex_compile_quantifier:w
        \fi:
      }
      { \__regex_compile_raw:N ] }
  }
\cs_new_protected:cpn { __regex_compile_[: }
  {
    \__regex_if_in_class:TF
      { \__regex_compile_class_posix_test:w }
      {
        \__regex_if_within_catcode:TF
          {
            \exp_after:wN \__regex_compile_class_catcode:w
              \int_use:N \l__regex_catcodes_int ;
          }
          { \__regex_compile_class_normal:w }
      }
  }
\cs_new_protected:Npn \__regex_compile_class_normal:w
  {
    \__regex_compile_class:TFNN
      { \__regex_class:NnnnN \c_true_bool }
      { \__regex_class:NnnnN \c_false_bool }
  }
\cs_new_protected:Npn \__regex_compile_class_catcode:w #1;
  {
    \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int
      \tl_build_put_right:Nn \l__regex_build_tl
        { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: }
    \fi:
    \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int
    \__regex_compile_class:TFNN
      { \__regex_item_catcode:nT {#1} }
      { \__regex_item_catcode_reverse:nT {#1} }
  }
\cs_new_protected:Npn \__regex_compile_class:TFNN #1#2#3#4
  {
    \l__regex_mode_int = \int_value:w \l__regex_mode_int 3 \exp_stop_f:
    \__regex_two_if_eq:NNNNTF #3 #4 \__regex_compile_special:N ^
      {
        \tl_build_put_right:Nn \l__regex_build_tl { #2 { \if_false: } \fi: }
        \__regex_compile_class:NN
      }
      {
        \tl_build_put_right:Nn \l__regex_build_tl { #1 { \if_false: } \fi: }
        \__regex_compile_class:NN #3 #4
      }
  }
\cs_new_protected:Npn \__regex_compile_class:NN #1#2
  {
    \token_if_eq_charcode:NNTF #2 ]
      { \__regex_compile_raw:N #2 }
      { #1 #2 }
  }
\cs_new_protected:Npn \__regex_compile_class_posix_test:w #1#2
  {
    \token_if_eq_meaning:NNT \__regex_compile_special:N #1
      {
        \str_case:nn { #2 }
          {
            : { \__regex_compile_class_posix:NNNNw }
            = {
                \__kernel_msg_warning:nnx { kernel }
                  { posix-unsupported } { = }
              }
            . {
                \__kernel_msg_warning:nnx { kernel }
                  { posix-unsupported } { . }
              }
          }
      }
    \__regex_compile_raw:N [ #1 #2
  }
\cs_new_protected:Npn \__regex_compile_class_posix:NNNNw #1#2#3#4#5#6
  {
    \__regex_two_if_eq:NNNNTF #5 #6 \__regex_compile_special:N ^
      {
        \bool_set_false:N \l__regex_internal_bool
        \__kernel_tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi:
          \__regex_compile_class_posix_loop:w
      }
      {
        \bool_set_true:N \l__regex_internal_bool
        \__kernel_tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi:
          \__regex_compile_class_posix_loop:w #5 #6
      }
  }
\cs_new:Npn \__regex_compile_class_posix_loop:w #1#2
  {
    \token_if_eq_meaning:NNTF \__regex_compile_raw:N #1
      { #2 \__regex_compile_class_posix_loop:w }
      { \if_false: { \fi: } \__regex_compile_class_posix_end:w #1 #2 }
  }
\cs_new_protected:Npn \__regex_compile_class_posix_end:w #1#2#3#4
  {
    \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_special:N :
      { \__regex_two_if_eq:NNNNTF #3 #4 \__regex_compile_special:N ] }
      { \use_ii:nn }
      {
        \cs_if_exist:cTF { __regex_posix_ \l__regex_internal_a_tl : }
          {
            \__regex_compile_one:n
              {
                \bool_if:NF \l__regex_internal_bool \__regex_item_reverse:n
                \exp_not:c { __regex_posix_ \l__regex_internal_a_tl : }
              }
          }
          {
            \__kernel_msg_warning:nnx { kernel } { posix-unknown }
              { \l__regex_internal_a_tl }
            \__regex_compile_abort_tokens:x
              {
                [: \bool_if:NF \l__regex_internal_bool { ^ }
                \l__regex_internal_a_tl :]
              }
          }
      }
      {
        \__kernel_msg_error:nnxx { kernel } { posix-missing-close }
          { [: \l__regex_internal_a_tl } { #2 #4 }
        \__regex_compile_abort_tokens:x { [: \l__regex_internal_a_tl }
        #1 #2 #3 #4
      }
  }
\cs_new_protected:Npn \__regex_compile_group_begin:N #1
  {
    \tl_build_put_right:Nn \l__regex_build_tl { #1 { \if_false: } \fi: }
    \__regex_mode_quit_c:
    \group_begin:
      \tl_build_begin:N \l__regex_build_tl
      \int_set_eq:NN \l__regex_default_catcodes_int \l__regex_catcodes_int
      \int_incr:N \l__regex_group_level_int
      \tl_build_put_right:Nn \l__regex_build_tl
        { \__regex_branch:n { \if_false: } \fi: }
  }
\cs_new_protected:Npn \__regex_compile_group_end:
  {
    \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f:
        \tl_build_put_right:Nn \l__regex_build_tl { \if_false: { \fi: } }
        \tl_build_end:N \l__regex_build_tl
        \exp_args:NNNx
      \group_end:
      \tl_build_put_right:Nn \l__regex_build_tl { \l__regex_build_tl }
      \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int
      \exp_after:wN \__regex_compile_quantifier:w
    \else:
      \__kernel_msg_warning:nn { kernel } { extra-rparen }
      \exp_after:wN \__regex_compile_raw:N \exp_after:wN )
    \fi:
  }
\cs_new_protected:cpn { __regex_compile_(: }
  {
    \__regex_if_in_class:TF { \__regex_compile_raw:N ( }
      {
        \if_int_compare:w \l__regex_mode_int =
          \c__regex_catcode_in_class_mode_int
          \__kernel_msg_error:nn { kernel } { c-lparen-in-class }
          \exp_after:wN \__regex_compile_raw:N \exp_after:wN (
        \else:
          \exp_after:wN \__regex_compile_lparen:w
        \fi:
      }
  }
\cs_new_protected:Npn \__regex_compile_lparen:w #1#2#3#4
  {
    \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_special:N ?
      {
        \cs_if_exist_use:cF
          { __regex_compile_special_group_\token_to_str:N #4 :w }
          {
            \__kernel_msg_warning:nnx { kernel } { special-group-unknown }
              { (? #4 }
            \__regex_compile_group_begin:N \__regex_group:nnnN
              \__regex_compile_raw:N ? #3 #4
          }
      }
      {
        \__regex_compile_group_begin:N \__regex_group:nnnN
          #1 #2 #3 #4
      }
  }
\cs_new_protected:cpn { __regex_compile_|: }
  {
    \__regex_if_in_class:TF { \__regex_compile_raw:N | }
      {
        \tl_build_put_right:Nn \l__regex_build_tl
          { \if_false: { \fi: } \__regex_branch:n { \if_false: } \fi: }
      }
  }
\cs_new_protected:cpn { __regex_compile_): }
  {
    \__regex_if_in_class:TF { \__regex_compile_raw:N ) }
      { \__regex_compile_group_end: }
  }
\cs_new_protected:cpn { __regex_compile_special_group_::w }
  { \__regex_compile_group_begin:N \__regex_group_no_capture:nnnN }
\cs_new_protected:cpn { __regex_compile_special_group_|:w }
  { \__regex_compile_group_begin:N \__regex_group_resetting:nnnN }
\cs_new_protected:Npn \__regex_compile_special_group_i:w #1#2
  {
    \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_special:N )
      {
        \cs_set:Npn \__regex_item_equal:n
          { \__regex_item_caseless_equal:n }
        \cs_set:Npn \__regex_item_range:nn
          { \__regex_item_caseless_range:nn }
      }
      {
        \__kernel_msg_warning:nnx { kernel } { unknown-option } { (?i #2 }
        \__regex_compile_raw:N (
        \__regex_compile_raw:N ?
        \__regex_compile_raw:N i
        #1 #2
      }
  }
\cs_new_protected:cpn { __regex_compile_special_group_-:w } #1#2#3#4
  {
    \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_raw:N i
      { \__regex_two_if_eq:NNNNTF #3 #4 \__regex_compile_special:N ) }
      { \use_ii:nn }
      {
        \cs_set:Npn \__regex_item_equal:n
          { \__regex_item_caseful_equal:n }
        \cs_set:Npn \__regex_item_range:nn
          { \__regex_item_caseful_range:nn }
      }
      {
        \__kernel_msg_warning:nnx { kernel } { unknown-option } { (?-#2#4 }
        \__regex_compile_raw:N (
        \__regex_compile_raw:N ?
        \__regex_compile_raw:N -
        #1 #2 #3 #4
      }
  }
\cs_new_protected:cpn { __regex_compile_/c: }
  { \__regex_chk_c_allowed:T { \__regex_compile_c_test:NN } }
\cs_new_protected:Npn \__regex_compile_c_test:NN #1#2
  {
    \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N
      {
        \int_if_exist:cTF { c__regex_catcode_#2_int }
          {
            \int_set_eq:Nc \l__regex_catcodes_int
              { c__regex_catcode_#2_int }
            \l__regex_mode_int
              = \if_case:w \l__regex_mode_int
                  \c__regex_catcode_mode_int
                \else:
                  \c__regex_catcode_in_class_mode_int
                \fi:
            \token_if_eq_charcode:NNT C #2 { \__regex_compile_c_C:NN }
          }
      }
      { \cs_if_exist_use:cF { __regex_compile_c_#2:w } }
          {
            \__kernel_msg_error:nnx { kernel } { c-missing-category } {#2}
            #1 #2
          }
  }
\cs_new_protected:Npn \__regex_compile_c_C:NN #1#2
  {
    \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N
      {
        \token_if_eq_charcode:NNTF #2 .
          { \use_none:n }
          { \token_if_eq_charcode:NNF #2 ( } % )
      }
      { \use:n }
    { \__kernel_msg_error:nnn { kernel } { c-C-invalid } {#2} }
    #1 #2
  }
\cs_new_protected:cpn { __regex_compile_c_[:w } #1#2
  {
    \l__regex_mode_int
      = \if_case:w \l__regex_mode_int
          \c__regex_catcode_mode_int
        \else:
          \c__regex_catcode_in_class_mode_int
        \fi:
    \int_zero:N \l__regex_catcodes_int
    \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_special:N ^
      {
        \bool_set_false:N \l__regex_catcodes_bool
        \__regex_compile_c_lbrack_loop:NN
      }
      {
        \bool_set_true:N \l__regex_catcodes_bool
        \__regex_compile_c_lbrack_loop:NN
        #1 #2
      }
  }
\cs_new_protected:Npn \__regex_compile_c_lbrack_loop:NN #1#2
  {
    \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N
      {
        \int_if_exist:cTF { c__regex_catcode_#2_int }
          {
            \exp_args:Nc \__regex_compile_c_lbrack_add:N
              { c__regex_catcode_#2_int }
            \__regex_compile_c_lbrack_loop:NN
          }
      }
      {
        \token_if_eq_charcode:NNTF #2 ]
          { \__regex_compile_c_lbrack_end: }
      }
          {
            \__kernel_msg_error:nnx { kernel } { c-missing-rbrack } {#2}
            \__regex_compile_c_lbrack_end:
            #1 #2
          }
  }
\cs_new_protected:Npn \__regex_compile_c_lbrack_add:N #1
  {
    \if_int_odd:w \int_eval:n { \l__regex_catcodes_int / #1 } \exp_stop_f:
    \else:
      \int_add:Nn \l__regex_catcodes_int {#1}
    \fi:
  }
\cs_new_protected:Npn \__regex_compile_c_lbrack_end:
  {
    \if_meaning:w \c_false_bool \l__regex_catcodes_bool
      \int_set:Nn \l__regex_catcodes_int
        { \c__regex_all_catcodes_int - \l__regex_catcodes_int }
    \fi:
  }
\cs_new_protected:cpn { __regex_compile_c_ \c_left_brace_str :w }
  {
    \__regex_compile:w
      \__regex_disable_submatches:
      \l__regex_mode_int
        = \if_case:w \l__regex_mode_int
            \c__regex_cs_mode_int
          \else:
            \c__regex_cs_in_class_mode_int
          \fi:
  }
\flag_new:n { __regex_cs }
\cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : }
  {
    \__regex_if_in_cs:TF
      { \__regex_compile_end_cs: }
      { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str }
  }
\cs_new_protected:Npn \__regex_compile_end_cs:
  {
    \__regex_compile_end:
    \flag_clear:n { __regex_cs }
    \__kernel_tl_set:Nx \l__regex_internal_a_tl
      {
        \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex
        \q__regex_nil \q__regex_nil \q__regex_recursion_stop
      }
    \exp_args:Nx \__regex_compile_one:n
      {
        \flag_if_raised:nTF { __regex_cs }
          { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } }
          {
            \__regex_item_exact_cs:n
              { \tl_tail:N \l__regex_internal_a_tl }
          }
      }
  }
\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2
  {
    \cs_if_eq:NNTF #1 \__regex_branch:n
      {
        \scan_stop:
        \__regex_compile_cs_aux:NNnnnN #2
        \q__regex_nil \q__regex_nil \q__regex_nil
        \q__regex_nil \q__regex_nil \q__regex_nil \q__regex_recursion_stop
        \__regex_compile_cs_aux:Nn
      }
      {
        \__regex_quark_if_nil:NF #1 { \flag_raise_if_clear:n { __regex_cs } }
        \__regex_use_none_delimit_by_q_recursion_stop:w
      }
  }
\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6
  {
    \bool_lazy_all:nTF
      {
        { \cs_if_eq_p:NN #1 \__regex_class:NnnnN }
        {#2}
        { \tl_if_head_eq_meaning_p:nN {#3} \__regex_item_caseful_equal:n }
        { \int_compare_p:nNn { \tl_count:n {#3} } = { 2 } }
        { \int_compare_p:nNn {#5} = { 0 } }
      }
      {
        \prg_replicate:nn {#4}
          { \char_generate:nn { \use_ii:nn #3 } {12} }
        \__regex_compile_cs_aux:NNnnnN
      }
      {
        \__regex_quark_if_nil:NF #1
          {
            \flag_raise_if_clear:n { __regex_cs }
            \__regex_use_i_delimit_by_q_recursion_stop:nw
          }
        \__regex_use_none_delimit_by_q_recursion_stop:w
      }
  }
\cs_new_protected:cpn { __regex_compile_/u: } #1#2
  {
    \__regex_if_in_class_or_catcode:TF
      { \__regex_compile_raw_error:N u #1 #2 }
      {
        \__regex_two_if_eq:NNNNTF #1 #2 \__regex_compile_special:N \c_left_brace_str
          {
            \__kernel_tl_set:Nx \l__regex_internal_a_tl { \if_false: } \fi:
            \__regex_compile_u_loop:NN
          }
          {
            \__kernel_msg_error:nn { kernel } { u-missing-lbrace }
            \__regex_compile_raw:N u #1 #2
          }
      }
  }
\cs_new:Npn \__regex_compile_u_loop:NN #1#2
  {
    \token_if_eq_meaning:NNTF #1 \__regex_compile_raw:N
      { #2 \__regex_compile_u_loop:NN }
      {
        \token_if_eq_meaning:NNTF #1 \__regex_compile_special:N
          {
            \exp_after:wN \token_if_eq_charcode:NNTF \c_right_brace_str #2
              { \if_false: { \fi: } \__regex_compile_u_end: }
              { #2 \__regex_compile_u_loop:NN }
          }
          {
            \if_false: { \fi: }
            \__kernel_msg_error:nnx { kernel } { u-missing-rbrace } {#2}
            \__regex_compile_u_end:
            #1 #2
          }
      }
  }
\cs_new_protected:Npn \__regex_compile_u_end:
  {
    \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl }
    \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int
      \__regex_compile_u_not_cs:
    \else:
      \__regex_compile_u_in_cs:
    \fi:
  }
\cs_new_protected:Npn \__regex_compile_u_in_cs:
  {
    \__kernel_tl_gset:Nx \g__regex_internal_tl
      {
        \exp_args:No \__kernel_str_to_other_fast:n
          { \l__regex_internal_a_tl }
      }
    \tl_build_put_right:Nx \l__regex_build_tl
      {
        \tl_map_function:NN \g__regex_internal_tl
          \__regex_compile_u_in_cs_aux:n
      }
  }
\cs_new:Npn \__regex_compile_u_in_cs_aux:n #1
  {
    \__regex_class:NnnnN \c_true_bool
      { \__regex_item_caseful_equal:n { \int_value:w `#1 } }
      { 1 } { 0 } \c_false_bool
  }
\cs_new_protected:Npn \__regex_compile_u_not_cs:
  {
    \tl_analysis_map_inline:Nn \l__regex_internal_a_tl
      {
        \tl_build_put_right:Nx \l__regex_build_tl
          {
            \__regex_class:NnnnN \c_true_bool
              {
                \if_int_compare:w "##3 = 0 \exp_stop_f:
                  \__regex_item_exact_cs:n
                    { \exp_after:wN \cs_to_str:N ##1 }
                \else:
                  \__regex_item_exact:nn { \int_value:w "##3 } { ##2 }
                \fi:
              }
              { 1 } { 0 } \c_false_bool
          }
      }
  }
\cs_new_protected:cpn { __regex_compile_/K: }
  {
    \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int
      { \tl_build_put_right:Nn \l__regex_build_tl { \__regex_command_K: } }
      { \__regex_compile_raw_error:N K }
  }
\cs_new_protected:Npn \__regex_show:N #1
  {
    \group_begin:
      \tl_build_begin:N \l__regex_build_tl
      \cs_set_protected:Npn \__regex_branch:n
        {
          \seq_pop_right:NN \l__regex_show_prefix_seq
            \l__regex_internal_a_tl
          \__regex_show_one:n { +-branch }
          \seq_put_right:No \l__regex_show_prefix_seq
            \l__regex_internal_a_tl
          \use:n
        }
      \cs_set_protected:Npn \__regex_group:nnnN
        { \__regex_show_group_aux:nnnnN { } }
      \cs_set_protected:Npn \__regex_group_no_capture:nnnN
        { \__regex_show_group_aux:nnnnN { ~(no~capture) } }
      \cs_set_protected:Npn \__regex_group_resetting:nnnN
        { \__regex_show_group_aux:nnnnN { ~(resetting) } }
      \cs_set_eq:NN \__regex_class:NnnnN \__regex_show_class:NnnnN
      \cs_set_protected:Npn \__regex_command_K:
        { \__regex_show_one:n { reset~match~start~(\iow_char:N\\K) } }
      \cs_set_protected:Npn \__regex_assertion:Nn ##1##2
        {
          \__regex_show_one:n
            { \bool_if:NF ##1 { negative~ } assertion:~##2 }
        }
      \cs_set:Npn \__regex_b_test: { word~boundary }
      \cs_set:Npn \__regex_Z_test: { anchor~at~end~(\iow_char:N\\Z) }
      \cs_set:Npn \__regex_A_test: { anchor~at~start~(\iow_char:N\\A) }
      \cs_set:Npn \__regex_G_test: { anchor~at~start~of~match~(\iow_char:N\\G) }
      \cs_set_protected:Npn \__regex_item_caseful_equal:n ##1
        { \__regex_show_one:n { char~code~\int_eval:n{##1} } }
      \cs_set_protected:Npn \__regex_item_caseful_range:nn ##1##2
        {
          \__regex_show_one:n
            { range~[\int_eval:n{##1}, \int_eval:n{##2}] }
        }
      \cs_set_protected:Npn \__regex_item_caseless_equal:n ##1
        { \__regex_show_one:n { char~code~\int_eval:n{##1}~(caseless) } }
      \cs_set_protected:Npn \__regex_item_caseless_range:nn ##1##2
        {
          \__regex_show_one:n
            { Range~[\int_eval:n{##1}, \int_eval:n{##2}]~(caseless) }
        }
      \cs_set_protected:Npn \__regex_item_catcode:nT
        { \__regex_show_item_catcode:NnT \c_true_bool }
      \cs_set_protected:Npn \__regex_item_catcode_reverse:nT
        { \__regex_show_item_catcode:NnT \c_false_bool }
      \cs_set_protected:Npn \__regex_item_reverse:n
        { \__regex_show_scope:nn { Reversed~match } }
      \cs_set_protected:Npn \__regex_item_exact:nn ##1##2
        { \__regex_show_one:n { char~##2,~catcode~##1 } }
      \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n
      \cs_set_protected:Npn \__regex_item_cs:n
        { \__regex_show_scope:nn { control~sequence } }
      \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } }
      \seq_clear:N \l__regex_show_prefix_seq
      \__regex_show_push:n { ~ }
      \cs_if_exist_use:N #1
      \tl_build_end:N \l__regex_build_tl
      \exp_args:NNNo
    \group_end:
    \tl_set:Nn \l__regex_internal_a_tl { \l__regex_build_tl }
  }
\cs_new_protected:Npn \__regex_show_one:n #1
  {
    \int_incr:N \l__regex_show_lines_int
    \tl_build_put_right:Nx \l__regex_build_tl
      {
        \exp_not:N \iow_newline:
        \seq_map_function:NN \l__regex_show_prefix_seq \use:n
        #1
      }
  }
\cs_new_protected:Npn \__regex_show_push:n #1
  { \seq_put_right:Nx \l__regex_show_prefix_seq { #1 ~ } }
\cs_new_protected:Npn \__regex_show_pop:
  { \seq_pop_right:NN \l__regex_show_prefix_seq \l__regex_internal_a_tl }
\cs_new_protected:Npn \__regex_show_scope:nn #1#2
  {
    \__regex_show_one:n {#1}
    \__regex_show_push:n { ~ }
    #2
    \__regex_show_pop:
  }
\cs_new_protected:Npn \__regex_show_group_aux:nnnnN #1#2#3#4#5
  {
    \__regex_show_one:n { ,-group~begin #1 }
    \__regex_show_push:n { | }
    \use_ii:nn #2
    \__regex_show_pop:
    \__regex_show_one:n
      { `-group~end \__regex_msg_repeated:nnN {#3} {#4} #5 }
  }
\cs_set:Npn \__regex_show_class:NnnnN #1#2#3#4#5
  {
    \group_begin:
      \tl_build_begin:N \l__regex_build_tl
      \int_zero:N \l__regex_show_lines_int
      \__regex_show_push:n {~}
      #2
    \int_compare:nTF { \l__regex_show_lines_int = 0 }
      {
        \group_end:
        \__regex_show_one:n { \bool_if:NTF #1 { Fail } { Pass } }
      }
      {
        \bool_if:nTF
          { #1 && \int_compare_p:n { \l__regex_show_lines_int = 1 } }
          {
            \group_end:
            #2
            \tl_build_put_right:Nn \l__regex_build_tl
              { \__regex_msg_repeated:nnN {#3} {#4} #5 }
          }
          {
              \tl_build_end:N \l__regex_build_tl
              \exp_args:NNNo
            \group_end:
            \tl_set:Nn \l__regex_internal_a_tl \l__regex_build_tl
            \__regex_show_one:n
              {
                \bool_if:NTF #1 { Match } { Don't~match }
                \__regex_msg_repeated:nnN {#3} {#4} #5
              }
            \tl_build_put_right:Nx \l__regex_build_tl
              { \exp_not:o \l__regex_internal_a_tl }
          }
      }
  }
\cs_new_protected:Npn \__regex_show_item_catcode:NnT #1#2
  {
    \seq_set_split:Nnn \l__regex_internal_seq { } { CBEMTPUDSLOA }
    \seq_set_filter:NNn \l__regex_internal_seq \l__regex_internal_seq
      { \int_if_odd_p:n { #2 / \int_use:c { c__regex_catcode_##1_int } } }
    \__regex_show_scope:nn
      {
        categories~
        \seq_map_function:NN \l__regex_internal_seq \use:n
        , ~
        \bool_if:NF #1 { negative~ } class
      }
  }
\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1
  {
    \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1}
    \seq_set_map_x:NNn \l__regex_internal_seq
      \l__regex_internal_seq { \iow_char:N\\##1 }
    \__regex_show_one:n
      { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } }
  }
\int_new:N  \l__regex_min_state_int
\int_set:Nn \l__regex_min_state_int { 1 }
\int_new:N  \l__regex_max_state_int
\int_new:N  \l__regex_left_state_int
\int_new:N  \l__regex_right_state_int
\seq_new:N  \l__regex_left_state_seq
\seq_new:N  \l__regex_right_state_seq
\int_new:N  \l__regex_capturing_group_int
\cs_new_protected:Npn \__regex_build:n
  { \__regex_build_aux:Nn \c_true_bool }
\cs_new_protected:Npn \__regex_build:N
  { \__regex_build_aux:NN \c_true_bool }
\cs_new_protected:Npn \__regex_build_aux:Nn #1#2
  {
    \__regex_compile:n {#2}
    \__regex_build_aux:NN #1 \l__regex_internal_regex
  }
\cs_new_protected:Npn \__regex_build_aux:NN #1#2
  {
    \__regex_standard_escapechar:
    \int_zero:N \l__regex_capturing_group_int
    \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int
    \__regex_build_new_state:
    \__regex_build_new_state:
    \__regex_toks_put_right:Nn \l__regex_left_state_int
      { \__regex_action_start_wildcard:N #1 }
    \__regex_group:nnnN {#2} { 1 } { 0 } \c_false_bool
    \__regex_toks_put_right:Nn \l__regex_right_state_int
      { \__regex_action_success: }
  }
\cs_new_protected:Npn \__regex_build_for_cs:n #1
  {
    \int_set_eq:NN \l__regex_min_state_int \l__regex_max_state_int
    \__regex_build_new_state:
    \__regex_build_new_state:
    \__regex_push_lr_states:
    #1
    \__regex_pop_lr_states:
    \__regex_toks_put_right:Nn \l__regex_right_state_int
      {
        \if_int_compare:w -2 = \l__regex_curr_char_int
          \exp_after:wN \__regex_action_success:
        \fi:
      }
  }
\cs_new_protected:Npn \__regex_push_lr_states:
  {
    \seq_push:No \l__regex_left_state_seq
      { \int_use:N \l__regex_left_state_int }
    \seq_push:No \l__regex_right_state_seq
      { \int_use:N \l__regex_right_state_int }
  }
\cs_new_protected:Npn \__regex_pop_lr_states:
  {
    \seq_pop:NN \l__regex_left_state_seq  \l__regex_internal_a_tl
    \int_set:Nn \l__regex_left_state_int  \l__regex_internal_a_tl
    \seq_pop:NN \l__regex_right_state_seq \l__regex_internal_a_tl
    \int_set:Nn \l__regex_right_state_int \l__regex_internal_a_tl
  }
\cs_new_protected:Npn \__regex_build_transition_left:NNN #1#2#3
  { \__regex_toks_put_left:Nx  #2 { #1 { \int_eval:n { #3 - #2 } } } }
\cs_new_protected:Npn \__regex_build_transition_right:nNn #1#2#3
  { \__regex_toks_put_right:Nx #2 { #1 { \int_eval:n { #3 - #2 } } } }
\cs_new_protected:Npn \__regex_build_new_state:
  {
    \__regex_toks_clear:N \l__regex_max_state_int
    \int_set_eq:NN \l__regex_left_state_int \l__regex_right_state_int
    \int_set_eq:NN \l__regex_right_state_int \l__regex_max_state_int
    \int_incr:N \l__regex_max_state_int
  }
\cs_new_protected:Npn \__regex_build_transitions_lazyness:NNNNN #1#2#3#4#5
  {
    \__regex_build_new_state:
    \__regex_toks_put_right:Nx \l__regex_left_state_int
      {
        \if_meaning:w \c_true_bool #1
          #2 { \int_eval:n { #3 - \l__regex_left_state_int } }
          #4 { \int_eval:n { #5 - \l__regex_left_state_int } }
        \else:
          #4 { \int_eval:n { #5 - \l__regex_left_state_int } }
          #2 { \int_eval:n { #3 - \l__regex_left_state_int } }
        \fi:
      }
  }
\cs_new_protected:Npn \__regex_class:NnnnN #1#2#3#4#5
  {
    \cs_set:Npx \__regex_tests_action_cost:n ##1
      {
        \exp_not:n { \exp_not:n {#2} }
        \bool_if:NTF #1
          { \__regex_break_point:TF { \__regex_action_cost:n {##1} } { } }
          { \__regex_break_point:TF { } { \__regex_action_cost:n {##1} } }
      }
    \if_case:w - #4 \exp_stop_f:
           \__regex_class_repeat:n   {#3}
    \or:   \__regex_class_repeat:nN  {#3}      #5
    \else: \__regex_class_repeat:nnN {#3} {#4} #5
    \fi:
  }
\cs_new:Npn \__regex_tests_action_cost:n { \__regex_action_cost:n }
\cs_new_protected:Npn \__regex_class_repeat:n #1
  {
    \prg_replicate:nn {#1}
      {
        \__regex_build_new_state:
        \__regex_build_transition_right:nNn \__regex_tests_action_cost:n
          \l__regex_left_state_int \l__regex_right_state_int
      }
  }
\cs_new_protected:Npn \__regex_class_repeat:nN #1#2
  {
    \if_int_compare:w #1 = 0 \exp_stop_f:
      \__regex_build_transitions_lazyness:NNNNN #2
        \__regex_action_free:n       \l__regex_right_state_int
        \__regex_tests_action_cost:n \l__regex_left_state_int
    \else:
      \__regex_class_repeat:n {#1}
      \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int
      \__regex_build_transitions_lazyness:NNNNN #2
        \__regex_action_free:n \l__regex_right_state_int
        \__regex_action_free:n \l__regex_internal_a_int
    \fi:
  }
\cs_new_protected:Npn \__regex_class_repeat:nnN #1#2#3
  {
    \__regex_class_repeat:n {#1}
    \int_set:Nn \l__regex_internal_a_int
      { \l__regex_max_state_int + #2 - 1 }
    \prg_replicate:nn { #2 }
      {
        \__regex_build_transitions_lazyness:NNNNN #3
          \__regex_action_free:n       \l__regex_internal_a_int
          \__regex_tests_action_cost:n \l__regex_right_state_int
      }
  }
\cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5
  {
      \if_int_compare:w #3 = 0 \exp_stop_f:
        \__regex_build_new_state:
        \__regex_build_transition_right:nNn \__regex_action_free_group:n
          \l__regex_left_state_int \l__regex_right_state_int
      \fi:
      \__regex_build_new_state:
      \__regex_push_lr_states:
      #2
      \__regex_pop_lr_states:
      \if_case:w - #4 \exp_stop_f:
             \__regex_group_repeat:nn   {#1} {#3}
      \or:   \__regex_group_repeat:nnN  {#1} {#3}      #5
      \else: \__regex_group_repeat:nnnN {#1} {#3} {#4} #5
      \fi:
  }
\cs_new_protected:Npn \__regex_group:nnnN #1
  {
    \exp_args:No \__regex_group_aux:nnnnN
      { \int_use:N \l__regex_capturing_group_int }
      {
        \int_incr:N \l__regex_capturing_group_int
        #1
      }
  }
\cs_new_protected:Npn \__regex_group_no_capture:nnnN
  { \__regex_group_aux:nnnnN { -1 } }
\cs_new_protected:Npn \__regex_group_resetting:nnnN #1
  {
    \__regex_group_aux:nnnnN { -1 }
      {
        \exp_args:Noo \__regex_group_resetting_loop:nnNn
          { \int_use:N \l__regex_capturing_group_int }
          { \int_use:N \l__regex_capturing_group_int }
          #1
          { ?? \prg_break:n } { }
        \prg_break_point:
      }
  }
\cs_new_protected:Npn \__regex_group_resetting_loop:nnNn #1#2#3#4
  {
    \use_none:nn #3 { \int_set:Nn \l__regex_capturing_group_int {#1} }
    \int_set:Nn \l__regex_capturing_group_int {#2}
    #3 {#4}
    \exp_args:Nf \__regex_group_resetting_loop:nnNn
      { \int_max:nn {#1} { \l__regex_capturing_group_int } }
      {#2}
  }
\cs_new_protected:Npn \__regex_branch:n #1
  {
    \__regex_build_new_state:
    \seq_get:NN \l__regex_left_state_seq \l__regex_internal_a_tl
    \int_set:Nn \l__regex_left_state_int \l__regex_internal_a_tl
    \__regex_build_transition_right:nNn \__regex_action_free:n
      \l__regex_left_state_int \l__regex_right_state_int
    #1
    \seq_get:NN \l__regex_right_state_seq \l__regex_internal_a_tl
    \__regex_build_transition_right:nNn \__regex_action_free:n
      \l__regex_right_state_int \l__regex_internal_a_tl
  }
\cs_new_protected:Npn \__regex_group_repeat:nn #1#2
  {
    \if_int_compare:w #2 = 0 \exp_stop_f:
      \int_set:Nn \l__regex_max_state_int
        { \l__regex_left_state_int - 1 }
      \__regex_build_new_state:
    \else:
      \__regex_group_repeat_aux:n {#2}
      \__regex_group_submatches:nNN {#1}
        \l__regex_internal_a_int \l__regex_right_state_int
      \__regex_build_new_state:
    \fi:
  }
\cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3
  {
    \if_int_compare:w #1 > - 1 \exp_stop_f:
      \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:nN {#1} < }
      \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:nN {#1} > }
    \fi:
  }
\cs_new_protected:Npn \__regex_group_repeat_aux:n #1
  {
    \__regex_build_transition_right:nNn \__regex_action_free:n
      \l__regex_right_state_int \l__regex_max_state_int
    \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int
    \int_set_eq:NN \l__regex_internal_b_int \l__regex_max_state_int
    \if_int_compare:w \int_eval:n {#1} > 1 \exp_stop_f:
      \int_set:Nn \l__regex_internal_c_int
        {
          ( #1 - 1 )
          * ( \l__regex_internal_b_int - \l__regex_internal_a_int )
        }
      \int_add:Nn \l__regex_right_state_int { \l__regex_internal_c_int }
      \int_add:Nn \l__regex_max_state_int   { \l__regex_internal_c_int }
      \__regex_toks_memcpy:NNn
        \l__regex_internal_b_int
        \l__regex_internal_a_int
        \l__regex_internal_c_int
    \fi:
  }
\cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3
  {
    \if_int_compare:w #2 = 0 \exp_stop_f:
      \__regex_group_submatches:nNN {#1}
        \l__regex_left_state_int \l__regex_right_state_int
      \int_set:Nn \l__regex_internal_a_int
        { \l__regex_left_state_int - 1 }
      \__regex_build_transition_right:nNn \__regex_action_free:n
        \l__regex_right_state_int \l__regex_internal_a_int
      \__regex_build_new_state:
      \if_meaning:w \c_true_bool #3
        \__regex_build_transition_left:NNN \__regex_action_free:n
          \l__regex_internal_a_int \l__regex_right_state_int
      \else:
        \__regex_build_transition_right:nNn \__regex_action_free:n
          \l__regex_internal_a_int \l__regex_right_state_int
      \fi:
    \else:
      \__regex_group_repeat_aux:n {#2}
      \__regex_group_submatches:nNN {#1}
        \l__regex_internal_a_int \l__regex_right_state_int
      \if_meaning:w \c_true_bool #3
        \__regex_build_transition_right:nNn \__regex_action_free_group:n
          \l__regex_right_state_int \l__regex_internal_a_int
      \else:
        \__regex_build_transition_left:NNN \__regex_action_free_group:n
          \l__regex_right_state_int \l__regex_internal_a_int
      \fi:
      \__regex_build_new_state:
    \fi:
  }
\cs_new_protected:Npn \__regex_group_repeat:nnnN #1#2#3#4
  {
    \__regex_group_submatches:nNN {#1}
      \l__regex_left_state_int \l__regex_right_state_int
    \__regex_group_repeat_aux:n { #2 + #3 }
    \if_meaning:w \c_true_bool #4
      \int_set_eq:NN \l__regex_left_state_int \l__regex_max_state_int
      \prg_replicate:nn { #3 }
        {
          \int_sub:Nn \l__regex_left_state_int
            { \l__regex_internal_b_int - \l__regex_internal_a_int }
          \__regex_build_transition_left:NNN \__regex_action_free:n
            \l__regex_left_state_int \l__regex_max_state_int
        }
    \else:
      \prg_replicate:nn { #3 - 1 }
        {
          \int_sub:Nn \l__regex_right_state_int
            { \l__regex_internal_b_int - \l__regex_internal_a_int }
          \__regex_build_transition_right:nNn \__regex_action_free:n
            \l__regex_right_state_int \l__regex_max_state_int
        }
      \if_int_compare:w #2 = 0 \exp_stop_f:
        \int_set:Nn \l__regex_right_state_int
          { \l__regex_left_state_int - 1 }
      \else:
        \int_sub:Nn \l__regex_right_state_int
          { \l__regex_internal_b_int - \l__regex_internal_a_int }
      \fi:
      \__regex_build_transition_right:nNn \__regex_action_free:n
        \l__regex_right_state_int \l__regex_max_state_int
    \fi:
    \__regex_build_new_state:
  }
\cs_new_protected:Npn \__regex_assertion:Nn #1#2
  {
    \__regex_build_new_state:
    \__regex_toks_put_right:Nx \l__regex_left_state_int
      {
        \exp_not:n {#2}
        \__regex_break_point:TF
          \bool_if:NF #1 { { } }
          {
            \__regex_action_free:n
              {
                \int_eval:n
                  { \l__regex_right_state_int - \l__regex_left_state_int }
              }
          }
          \bool_if:NT #1 { { } }
      }
  }
\cs_new_protected:Npn \__regex_b_test:
  {
    \group_begin:
      \int_set_eq:NN \l__regex_curr_char_int \l__regex_last_char_int
      \__regex_prop_w:
      \__regex_break_point:TF
        { \group_end: \__regex_item_reverse:n \__regex_prop_w: }
        { \group_end: \__regex_prop_w: }
  }
\cs_new_protected:Npn \__regex_Z_test:
  {
    \if_int_compare:w -2 = \l__regex_curr_char_int
      \exp_after:wN \__regex_break_true:w
    \fi:
  }
\cs_new_protected:Npn \__regex_A_test:
  {
    \if_int_compare:w -2 = \l__regex_last_char_int
      \exp_after:wN \__regex_break_true:w
    \fi:
  }
\cs_new_protected:Npn \__regex_G_test:
  {
    \if_int_compare:w \l__regex_curr_pos_int = \l__regex_start_pos_int
      \exp_after:wN \__regex_break_true:w
    \fi:
  }
\cs_new_protected:Npn \__regex_command_K:
  {
    \__regex_build_new_state:
    \__regex_toks_put_right:Nx \l__regex_left_state_int
      {
        \__regex_action_submatch:nN { 0 } <
        \bool_set_true:N \l__regex_fresh_thread_bool
        \__regex_action_free:n
          {
            \int_eval:n
              { \l__regex_right_state_int - \l__regex_left_state_int }
          }
        \bool_set_false:N \l__regex_fresh_thread_bool
      }
  }
\int_new:N \l__regex_min_pos_int
\int_new:N \l__regex_max_pos_int
\int_new:N \l__regex_curr_pos_int
\int_new:N \l__regex_start_pos_int
\int_new:N \l__regex_success_pos_int
\int_new:N \l__regex_curr_char_int
\int_new:N \l__regex_curr_catcode_int
\tl_new:N \l__regex_curr_token_tl
\int_new:N \l__regex_last_char_int
\int_new:N \l__regex_last_char_success_int
\int_new:N \l__regex_case_changed_char_int
\int_new:N \l__regex_curr_state_int
\tl_new:N \l__regex_curr_submatches_tl
\tl_new:N \l__regex_success_submatches_tl
\int_new:N \l__regex_step_int
\int_new:N \l__regex_min_thread_int
\int_new:N \l__regex_max_thread_int
\intarray_new:Nn \g__regex_state_active_intarray { 65536 }
\intarray_new:Nn \g__regex_thread_info_intarray { 65536 }
\tl_new:N \l__regex_matched_analysis_tl
\tl_new:N \l__regex_curr_analysis_tl
\tl_new:N \l__regex_every_match_tl
\bool_new:N \l__regex_fresh_thread_bool
\bool_new:N \l__regex_empty_success_bool
\cs_new_eq:NN \__regex_if_two_empty_matches:F \use:n
\bool_new:N \g__regex_success_bool
\bool_new:N \l__regex_saved_success_bool
\bool_new:N \l__regex_match_success_bool
\cs_new_protected:Npn \__regex_match:n #1
  {
    \__regex_match_init:
    \__regex_match_once_init:
    \tl_analysis_map_inline:nn {#1}
      { \__regex_match_one_token:nnN {##1} {##2} ##3 }
    \__regex_match_one_token:nnN { } { -2 } F
    \prg_break_point:Nn \__regex_maplike_break: { }
  }
\cs_new_protected:Npn \__regex_match_cs:n #1
  {
    \int_set_eq:NN \l__regex_min_thread_int \l__regex_max_thread_int
    \__regex_match_init:
    \__regex_match_once_init:
    \str_map_inline:nn {#1}
      {
        \tl_if_blank:nTF {##1}
          { \__regex_match_one_token:nnN {##1} {`##1} A }
          { \__regex_match_one_token:nnN {##1} {`##1} C }
      }
    \__regex_match_one_token:nnN { } { -2 } F
    \prg_break_point:Nn \__regex_maplike_break: { }
  }
\cs_new_protected:Npn \__regex_match_init:
  {
    \bool_gset_false:N \g__regex_success_bool
    \int_step_inline:nnn
      \l__regex_min_state_int { \l__regex_max_state_int - 1 }
      {
        \__kernel_intarray_gset:Nnn
          \g__regex_state_active_intarray {##1} { 1 }
      }
    \int_zero:N \l__regex_step_int
    \int_set:Nn \l__regex_min_pos_int { 2 }
    \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int
    \int_set:Nn \l__regex_last_char_success_int { -2 }
    \tl_build_begin:N \l__regex_matched_analysis_tl
    \tl_clear:N \l__regex_curr_analysis_tl
    \int_set:Nn \l__regex_min_submatch_int { 1 }
    \int_set_eq:NN \l__regex_submatch_int \l__regex_min_submatch_int
    \bool_set_false:N \l__regex_empty_success_bool
  }
\cs_new_protected:Npn \__regex_match_once_init:
  {
    \if_meaning:w \c_true_bool \l__regex_empty_success_bool
      \cs_set:Npn \__regex_if_two_empty_matches:F
        {
          \int_compare:nNnF
            \l__regex_start_pos_int = \l__regex_curr_pos_int
        }
    \else:
      \cs_set_eq:NN \__regex_if_two_empty_matches:F \use:n
    \fi:
    \int_set_eq:NN \l__regex_start_pos_int \l__regex_success_pos_int
    \bool_set_false:N \l__regex_match_success_bool
    \tl_set:Nx \l__regex_curr_submatches_tl
      { \prg_replicate:nn { 2 * \l__regex_capturing_group_int } { 0 , } }
    \int_set_eq:NN \l__regex_max_thread_int \l__regex_min_thread_int
    \__regex_store_state:n { \l__regex_min_state_int }
    \int_set:Nn \l__regex_curr_pos_int
      { \l__regex_start_pos_int - 1 }
    \int_set_eq:NN \l__regex_curr_char_int \l__regex_last_char_success_int
    \tl_build_get:NN \l__regex_matched_analysis_tl \l__regex_internal_a_tl
    \exp_args:NNf \__regex_match_once_init_aux:
    \tl_map_inline:nn
      { \exp_after:wN \l__regex_internal_a_tl \l__regex_curr_analysis_tl }
      { \__regex_match_one_token:nnN ##1 }
    \prg_break_point:Nn \__regex_maplike_break: { }
  }
\cs_new_protected:Npn \__regex_match_once_init_aux:
  {
    \tl_build_clear:N \l__regex_matched_analysis_tl
    \tl_clear:N \l__regex_curr_analysis_tl
  }
\cs_new_protected:Npn \__regex_single_match:
  {
    \tl_set:Nn \l__regex_every_match_tl
      {
        \bool_gset_eq:NN
          \g__regex_success_bool
          \l__regex_match_success_bool
        \__regex_maplike_break:
      }
  }
\cs_new_protected:Npn \__regex_multi_match:n #1
  {
    \tl_set:Nn \l__regex_every_match_tl
      {
        \if_meaning:w \c_false_bool \l__regex_match_success_bool
          \exp_after:wN \__regex_maplike_break:
        \fi:
        \bool_gset_true:N \g__regex_success_bool
        #1
        \__regex_match_once_init:
      }
  }
\cs_new_protected:Npn \__regex_match_one_token:nnN #1#2#3
  {
    \int_add:Nn \l__regex_step_int { 2 }
    \int_incr:N \l__regex_curr_pos_int
    \int_set_eq:NN \l__regex_last_char_int \l__regex_curr_char_int
    \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int
    \tl_set:Nn \l__regex_curr_token_tl {#1}
    \int_set:Nn \l__regex_curr_char_int {#2}
    \int_set:Nn \l__regex_curr_catcode_int { "#3 }
    \tl_build_put_right:Nx \l__regex_matched_analysis_tl
      { \exp_not:o \l__regex_curr_analysis_tl }
    \tl_set:Nn \l__regex_curr_analysis_tl { { {#1} {#2} #3 } }
    \use:x
      {
        \int_set_eq:NN \l__regex_max_thread_int \l__regex_min_thread_int
        \int_step_function:nnN
          { \l__regex_min_thread_int }
          { \l__regex_max_thread_int - 1 }
          \__regex_match_one_active:n
      }
    \prg_break_point:
    \bool_set_false:N \l__regex_fresh_thread_bool
    \if_int_compare:w \l__regex_max_thread_int > \l__regex_min_thread_int
      \if_int_compare:w -2 < \l__regex_curr_char_int
        \exp_after:wN \exp_after:wN \exp_after:wN \use_none:n
      \fi:
    \fi:
    \l__regex_every_match_tl
  }
\cs_new:Npn \__regex_match_one_active:n #1
  {
    \__regex_use_state_and_submatches:w
    \__kernel_intarray_range_to_clist:Nnn
      \g__regex_thread_info_intarray
      { 1 + #1 * (\l__regex_capturing_group_int * 2 + 1) }
      { (1 + #1) * (\l__regex_capturing_group_int * 2 + 1) }
    ;
  }
\cs_new_protected:Npn \__regex_use_state:
  {
    \__kernel_intarray_gset:Nnn \g__regex_state_active_intarray
      { \l__regex_curr_state_int } { \l__regex_step_int }
    \__regex_toks_use:w \l__regex_curr_state_int
    \__kernel_intarray_gset:Nnn \g__regex_state_active_intarray
      { \l__regex_curr_state_int }
      { \int_eval:n { \l__regex_step_int + 1 } }
  }
\cs_new_protected:Npn \__regex_use_state_and_submatches:w #1 , #2 ;
  {
    \int_set:Nn \l__regex_curr_state_int {#1}
    \if_int_compare:w
        \__kernel_intarray_item:Nn \g__regex_state_active_intarray
          { \l__regex_curr_state_int }
                      < \l__regex_step_int
      \tl_set:Nn \l__regex_curr_submatches_tl { #2 , }
      \exp_after:wN \__regex_use_state:
    \fi:
    \scan_stop:
  }
\cs_new_protected:Npn \__regex_action_start_wildcard:N #1
  {
    \bool_set_true:N \l__regex_fresh_thread_bool
    \__regex_action_free:n {1}
    \bool_set_false:N \l__regex_fresh_thread_bool
    \bool_if:NT #1 { \__regex_action_cost:n {0} }
  }
\cs_new_protected:Npn \__regex_action_free:n
  { \__regex_action_free_aux:nn { > \l__regex_step_int \else: } }
\cs_new_protected:Npn \__regex_action_free_group:n
  { \__regex_action_free_aux:nn { < \l__regex_step_int } }
\cs_new_protected:Npn \__regex_action_free_aux:nn #1#2
  {
    \use:x
      {
        \int_add:Nn \l__regex_curr_state_int {#2}
        \exp_not:n
          {
            \if_int_compare:w
                \__kernel_intarray_item:Nn \g__regex_state_active_intarray
                  { \l__regex_curr_state_int }
                #1
              \exp_after:wN \__regex_use_state:
            \fi:
          }
        \int_set:Nn \l__regex_curr_state_int
          { \int_use:N \l__regex_curr_state_int }
        \tl_set:Nn \exp_not:N \l__regex_curr_submatches_tl
          { \exp_not:o \l__regex_curr_submatches_tl }
      }
  }
\cs_new_protected:Npn \__regex_action_cost:n #1
  {
    \exp_args:Nx \__regex_store_state:n
      { \int_eval:n { \l__regex_curr_state_int + #1 } }
  }
\cs_new_protected:Npn \__regex_store_state:n #1
  {
    \exp_args:No \__regex_store_submatches:nn
      \l__regex_curr_submatches_tl {#1}
    \int_incr:N \l__regex_max_thread_int
  }
\cs_new_protected:Npn \__regex_store_submatches:nn #1#2
  {
    \__kernel_intarray_gset_range_from_clist:Nnn
      \g__regex_thread_info_intarray
      {
        \__regex_int_eval:w
        1 + \l__regex_max_thread_int *
        (\l__regex_capturing_group_int * 2 + 1)
      }
      { #2 , #1 }
  }
\cs_new_protected:Npn \__regex_disable_submatches:
  {
    \cs_set_protected:Npn \__regex_store_submatches:n ##1 { }
    \cs_set_protected:Npn \__regex_action_submatch:nN ##1##2 { }
  }
\cs_new_protected:Npn \__regex_action_submatch:nN #1#2
  {
    \exp_after:wN \__regex_action_submatch_aux:w
    \l__regex_curr_submatches_tl ; {#1} #2
  }
\cs_new_protected:Npn \__regex_action_submatch_aux:w #1 ; #2#3
  {
    \tl_set:Nx \l__regex_curr_submatches_tl
      {
        \prg_replicate:nn
          { #2 \if_meaning:w > #3 + \l__regex_capturing_group_int \fi: }
          { \__regex_action_submatch_auxii:w }
        \__regex_action_submatch_auxiii:w
        #1
      }
  }
\cs_new:Npn \__regex_action_submatch_auxii:w
    #1 \__regex_action_submatch_auxiii:w #2 ,
  { #2 , #1 \__regex_action_submatch_auxiii:w }
\cs_new:Npn \__regex_action_submatch_auxiii:w #1 ,
  { \int_use:N \l__regex_curr_pos_int , }
\cs_new_protected:Npn \__regex_action_success:
  {
    \__regex_if_two_empty_matches:F
      {
        \bool_set_true:N \l__regex_match_success_bool
        \bool_set_eq:NN \l__regex_empty_success_bool
          \l__regex_fresh_thread_bool
        \int_set_eq:NN \l__regex_success_pos_int \l__regex_curr_pos_int
        \int_set_eq:NN \l__regex_last_char_success_int \l__regex_last_char_int
        \tl_build_clear:N \l__regex_matched_analysis_tl
        \tl_set_eq:NN \l__regex_success_submatches_tl
          \l__regex_curr_submatches_tl
        \prg_break:
      }
  }
\int_new:N \l__regex_replacement_csnames_int
\tl_new:N \l__regex_replacement_category_tl
\seq_new:N \l__regex_replacement_category_seq
\tl_new:N \l__regex_balance_tl
\cs_new:Npn \__regex_replacement_balance_one_match:n #1
  { - \__regex_submatch_balance:n {#1} }
\cs_new:Npn \__regex_replacement_do_one_match:n #1
  {
    \__regex_query_range:nn
      { \__kernel_intarray_item:Nn \g__regex_submatch_prev_intarray {#1} }
      { \__kernel_intarray_item:Nn \g__regex_submatch_begin_intarray {#1} }
  }
\cs_new:Npn \__regex_replacement_exp_not:N #1 { \exp_not:n {#1} }
\cs_new_eq:NN \__regex_replacement_exp_not:V \exp_not:V
\cs_new:Npn \__regex_query_range:nn #1#2
  {
    \exp_after:wN \__regex_query_range_loop:ww
    \int_value:w \__regex_int_eval:w #1 \exp_after:wN ;
    \int_value:w \__regex_int_eval:w #2 ;
    \prg_break_point:
  }
\cs_new:Npn \__regex_query_range_loop:ww #1 ; #2 ;
  {
    \if_int_compare:w #1 < #2 \exp_stop_f:
    \else:
      \exp_after:wN \prg_break:
    \fi:
    \__regex_toks_use:w #1 \exp_stop_f:
    \exp_after:wN \__regex_query_range_loop:ww
      \int_value:w \__regex_int_eval:w #1 + 1 ; #2 ;
  }
\cs_new:Npn \__regex_query_submatch:n #1
  {
    \__regex_query_range:nn
      { \__kernel_intarray_item:Nn \g__regex_submatch_begin_intarray {#1} }
      { \__kernel_intarray_item:Nn \g__regex_submatch_end_intarray {#1} }
  }
\cs_new_protected:Npn \__regex_submatch_balance:n #1
  {
    \int_eval:n
      {
        \__regex_intarray_item:NnF \g__regex_balance_intarray
          {
            \__kernel_intarray_item:Nn
              \g__regex_submatch_end_intarray {#1}
          }
          { 0 }
        -
        \__regex_intarray_item:NnF \g__regex_balance_intarray
          {
            \__kernel_intarray_item:Nn
              \g__regex_submatch_begin_intarray {#1}
          }
          { 0 }
      }
  }
\cs_new_protected:Npn \__regex_replacement:n #1
  {
    \group_begin:
      \tl_build_begin:N \l__regex_build_tl
      \int_zero:N \l__regex_balance_int
      \tl_clear:N \l__regex_balance_tl
      \__regex_escape_use:nnnn
        {
          \if_charcode:w \c_right_brace_str ##1
            \__regex_replacement_rbrace:N
          \else:
            \__regex_replacement_normal:n
          \fi:
          ##1
        }
        { \__regex_replacement_escaped:N ##1 }
        { \__regex_replacement_normal:n ##1 }
        {#1}
      \prg_do_nothing: \prg_do_nothing:
      \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f:
        \__kernel_msg_error:nnx { kernel } { replacement-missing-rbrace }
          { \int_use:N \l__regex_replacement_csnames_int }
        \tl_build_put_right:Nx \l__regex_build_tl
          { \prg_replicate:nn \l__regex_replacement_csnames_int \cs_end: }
      \fi:
      \seq_if_empty:NF \l__regex_replacement_category_seq
        {
          \__kernel_msg_error:nnx { kernel } { replacement-missing-rparen }
            { \seq_count:N \l__regex_replacement_category_seq }
          \seq_clear:N \l__regex_replacement_category_seq
        }
      \cs_gset:Npx \__regex_replacement_balance_one_match:n ##1
        {
          + \int_use:N \l__regex_balance_int
          \l__regex_balance_tl
          - \__regex_submatch_balance:n {##1}
        }
      \tl_build_end:N \l__regex_build_tl
      \exp_args:NNo
    \group_end:
    \__regex_replacement_aux:n \l__regex_build_tl
  }
\cs_new_protected:Npn \__regex_replacement_aux:n #1
  {
    \cs_set:Npn \__regex_replacement_do_one_match:n ##1
      {
        \__regex_query_range:nn
          {
            \__kernel_intarray_item:Nn
              \g__regex_submatch_prev_intarray {##1}
          }
          {
            \__kernel_intarray_item:Nn
              \g__regex_submatch_begin_intarray {##1}
          }
        #1
      }
  }
\cs_new_protected:Npn \__regex_replacement_put:n
  { \tl_build_put_right:Nn \l__regex_build_tl }
\cs_new_protected:Npn \__regex_replacement_normal:n #1
  {
    \tl_if_empty:NTF \l__regex_replacement_category_tl
      { \__regex_replacement_put:n {#1} }
      { % (
        \token_if_eq_charcode:NNTF #1 )
          {
            \seq_pop:NN \l__regex_replacement_category_seq
              \l__regex_replacement_category_tl
          }
          {
            \use:c
              {
                __regex_replacement_c_
                \l__regex_replacement_category_tl :w
              }
              \__regex_replacement_normal:n {#1}
          }
      }
  }
\cs_new_protected:Npn \__regex_replacement_escaped:N #1
  {
    \cs_if_exist_use:cF { __regex_replacement_#1:w }
      {
        \if_int_compare:w 1 < 1#1 \exp_stop_f:
          \__regex_replacement_put_submatch:n {#1}
        \else:
          \exp_args:No \__regex_replacement_normal:n
            { \token_to_str:N #1 }
        \fi:
      }
  }
\cs_new_protected:Npn \__regex_replacement_put_submatch:n #1
  {
    \if_int_compare:w #1 < \l__regex_capturing_group_int
      \__regex_replacement_put_submatch_aux:n {#1}
    \fi:
  }
\cs_new_protected:Npn \__regex_replacement_put_submatch_aux:n #1
  {
    \tl_build_put_right:Nn \l__regex_build_tl
      { \__regex_query_submatch:n { \int_eval:n { #1 + ##1 } } }
    \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f:
      \tl_put_right:Nn \l__regex_balance_tl
        {
          + \__regex_submatch_balance:n
            { \exp_not:N \int_eval:n { #1 + ##1 } }
        }
    \fi:
  }
\cs_new_protected:Npn \__regex_replacement_g:w #1#2
  {
    \__regex_two_if_eq:NNNNTF
      #1 #2 \__regex_replacement_normal:n \c_left_brace_str
      { \l__regex_internal_a_int = \__regex_replacement_g_digits:NN }
      { \__regex_replacement_error:NNN g #1 #2 }
  }
\cs_new:Npn \__regex_replacement_g_digits:NN #1#2
  {
    \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n
      {
        \if_int_compare:w 1 < 1#2 \exp_stop_f:
          #2
          \exp_after:wN \use_i:nnn
          \exp_after:wN \__regex_replacement_g_digits:NN
        \else:
          \exp_stop_f:
          \exp_after:wN \__regex_replacement_error:NNN
          \exp_after:wN g
        \fi:
      }
      {
        \exp_stop_f:
        \if_meaning:w \__regex_replacement_rbrace:N #1
          \exp_args:No \__regex_replacement_put_submatch:n
            { \int_use:N \l__regex_internal_a_int }
          \exp_after:wN \use_none:nn
        \else:
          \exp_after:wN \__regex_replacement_error:NNN
          \exp_after:wN g
        \fi:
      }
    #1 #2
  }
\cs_new_protected:Npn \__regex_replacement_c:w #1#2
  {
    \token_if_eq_meaning:NNTF #1 \__regex_replacement_normal:n
      {
        \exp_after:wN \token_if_eq_charcode:NNTF \c_left_brace_str #2
          { \__regex_replacement_cu_aux:Nw \__regex_replacement_exp_not:N }
          {
            \cs_if_exist:cTF { __regex_replacement_c_#2:w }
              { \__regex_replacement_cat:NNN #2 }
              { \__regex_replacement_error:NNN c #1#2 }
          }
      }
      { \__regex_replacement_error:NNN c #1#2 }
  }
\cs_new_protected:Npn \__regex_replacement_cu_aux:Nw #1
  {
    \if_case:w \l__regex_replacement_csnames_int
      \tl_build_put_right:Nn \l__regex_build_tl
        { \exp_not:n { \exp_after:wN #1 \cs:w } }
    \else:
      \tl_build_put_right:Nn \l__regex_build_tl
        { \exp_not:n { \exp_after:wN \tl_to_str:V \cs:w } }
    \fi:
    \int_incr:N \l__regex_replacement_csnames_int
  }
\cs_new_protected:Npn \__regex_replacement_u:w #1#2
  {
    \__regex_two_if_eq:NNNNTF
      #1 #2 \__regex_replacement_normal:n \c_left_brace_str
      { \__regex_replacement_cu_aux:Nw \__regex_replacement_exp_not:V }
      { \__regex_replacement_error:NNN u #1#2 }
  }
\cs_new_protected:Npn \__regex_replacement_rbrace:N #1
  {
    \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f:
      \tl_build_put_right:Nn \l__regex_build_tl { \cs_end: }
      \int_decr:N \l__regex_replacement_csnames_int
    \else:
      \__regex_replacement_normal:n {#1}
    \fi:
  }
\cs_new_protected:Npn \__regex_replacement_cat:NNN #1#2#3
  {
    \token_if_eq_meaning:NNTF \prg_do_nothing: #3
      { \__kernel_msg_error:nn { kernel } { replacement-catcode-end } }
      {
        \int_compare:nNnTF { \l__regex_replacement_csnames_int } > 0
          {
            \__kernel_msg_error:nnnn
              { kernel } { replacement-catcode-in-cs } {#1} {#3}
            #2 #3
          }
          {
            \__regex_two_if_eq:NNNNTF #2 #3 \__regex_replacement_normal:n (
              {
                \seq_push:NV \l__regex_replacement_category_seq
                  \l__regex_replacement_category_tl
                \tl_set:Nn \l__regex_replacement_category_tl {#1}
              }
              {
                \token_if_eq_meaning:NNT #2 \__regex_replacement_escaped:N
                  {
                    \__regex_char_if_alphanumeric:NTF #3
                      {
                        \__kernel_msg_error:nnnn
                          { kernel } { replacement-catcode-escaped }
                          {#1} {#3}
                      }
                      { }
                  }
                \use:c { __regex_replacement_c_#1:w } #2 #3
              }
          }
      }
  }
\group_begin:
  \cs_new_protected:Npn \__regex_replacement_char:nNN #1#2#3
    {
      \tex_lccode:D 0 = `#3 \scan_stop:
      \tex_lowercase:D { \__regex_replacement_put:n {#1} }
    }
  \char_set_catcode_active:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_A:w
    { \__regex_replacement_char:nNN { \exp_not:n { \exp_not:N ^^@ } } }
  \char_set_catcode_group_begin:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_B:w
    {
      \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f:
        \int_incr:N \l__regex_balance_int
      \fi:
      \__regex_replacement_char:nNN
        { \exp_not:n { \exp_after:wN ^^@ \if_false: } \fi: } }
    }
  \cs_new_protected:Npn \__regex_replacement_c_C:w #1#2
    {
      \tl_build_put_right:Nn \l__regex_build_tl
        { \exp_not:N \__regex_replacement_exp_not:N \exp_not:c {#2} }
    }
  \char_set_catcode_math_subscript:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_D:w
    { \__regex_replacement_char:nNN { ^^@ } }
  \char_set_catcode_group_end:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_E:w
    {
      \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f:
        \int_decr:N \l__regex_balance_int
      \fi:
      \__regex_replacement_char:nNN
        { \exp_not:n { \if_false: { \fi:  ^^@ } }
    }
  \char_set_catcode_letter:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_L:w
    { \__regex_replacement_char:nNN { ^^@ } }
  \char_set_catcode_math_toggle:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_M:w
    { \__regex_replacement_char:nNN { ^^@ } }
  \char_set_catcode_other:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_O:w
    { \__regex_replacement_char:nNN { ^^@ } }
  \char_set_catcode_parameter:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_P:w
    {
      \__regex_replacement_char:nNN
        { \exp_not:n { \exp_not:n { ^^@^^@^^@^^@ } } }
    }
  \cs_new_protected:Npn \__regex_replacement_c_S:w #1#2
    {
      \if_int_compare:w `#2 = 0 \exp_stop_f:
        \__kernel_msg_error:nn { kernel } { replacement-null-space }
      \fi:
      \tex_lccode:D `\ = `#2 \scan_stop:
      \tex_lowercase:D { \__regex_replacement_put:n {~} }
    }
  \char_set_catcode_alignment:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_T:w
    { \__regex_replacement_char:nNN { ^^@ } }
  \char_set_catcode_math_superscript:N \^^@
  \cs_new_protected:Npn \__regex_replacement_c_U:w
    { \__regex_replacement_char:nNN { ^^@ } }
\group_end:
\cs_new_protected:Npn \__regex_replacement_error:NNN #1#2#3
  {
    \__kernel_msg_error:nnx { kernel } { replacement-#1 } {#3}
    #2 #3
  }
\cs_new_protected:Npn \regex_new:N #1
  { \cs_new_eq:NN #1 \c__regex_no_match_regex }
\regex_new:N \l_tmpa_regex
\regex_new:N \l_tmpb_regex
\regex_new:N \g_tmpa_regex
\regex_new:N \g_tmpb_regex
\cs_new_protected:Npn \regex_set:Nn #1#2
  {
    \__regex_compile:n {#2}
    \tl_set_eq:NN #1 \l__regex_internal_regex
  }
\cs_new_protected:Npn \regex_gset:Nn #1#2
  {
    \__regex_compile:n {#2}
    \tl_gset_eq:NN #1 \l__regex_internal_regex
  }
\cs_new_protected:Npn \regex_const:Nn #1#2
  {
    \__regex_compile:n {#2}
    \tl_const:Nx #1 { \exp_not:o \l__regex_internal_regex }
  }
\cs_new_protected:Npn \regex_show:n #1
  {
    \__regex_compile:n {#1}
    \__regex_show:N \l__regex_internal_regex
    \msg_show:nnxxxx { LaTeX / kernel } { show-regex }
      { \tl_to_str:n {#1} } { }
      { \l__regex_internal_a_tl } { }
  }
\cs_new_protected:Npn \regex_show:N #1
  {
    \__kernel_chk_defined:NT #1
      {
        \__regex_show:N #1
        \msg_show:nnxxxx { LaTeX / kernel } { show-regex }
          { } { \token_to_str:N #1 }
          { \l__regex_internal_a_tl } { }
      }
  }
\prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF }
  {
    \__regex_if_match:nn { \__regex_build:n {#1} } {#2}
    \__regex_return:
  }
\prg_new_protected_conditional:Npnn \regex_match:Nn #1#2 { T , F , TF }
  {
    \__regex_if_match:nn { \__regex_build:N #1 } {#2}
    \__regex_return:
  }
\cs_new_protected:Npn \regex_count:nnN #1
  { \__regex_count:nnN { \__regex_build:n {#1} } }
\cs_new_protected:Npn \regex_count:NnN #1
  { \__regex_count:nnN { \__regex_build:N #1 } }
\cs_set_protected:Npn \__regex_tmp:w #1#2#3
  {
    \cs_new_protected:Npn #2 ##1 { #1 { \__regex_build:n {##1} } }
    \cs_new_protected:Npn #3 ##1 { #1 { \__regex_build:N  ##1  } }
    \prg_new_protected_conditional:Npnn #2 ##1##2##3 { T , F , TF }
      { #1 { \__regex_build:n {##1} } {##2} ##3 \__regex_return: }
    \prg_new_protected_conditional:Npnn #3 ##1##2##3 { T , F , TF }
      { #1 { \__regex_build:N  ##1  } {##2} ##3 \__regex_return: }
  }
\__regex_tmp:w \__regex_extract_once:nnN
  \regex_extract_once:nnN \regex_extract_once:NnN
\__regex_tmp:w \__regex_extract_all:nnN
  \regex_extract_all:nnN \regex_extract_all:NnN
\__regex_tmp:w \__regex_replace_once:nnN
  \regex_replace_once:nnN \regex_replace_once:NnN
\__regex_tmp:w \__regex_replace_all:nnN
  \regex_replace_all:nnN \regex_replace_all:NnN
\__regex_tmp:w \__regex_split:nnN \regex_split:nnN \regex_split:NnN
\int_new:N \l__regex_match_count_int
\flag_new:n { __regex_begin }
\flag_new:n { __regex_end }
\int_new:N \l__regex_min_submatch_int
\int_new:N \l__regex_submatch_int
\int_new:N \l__regex_zeroth_submatch_int
\intarray_new:Nn \g__regex_submatch_prev_intarray { 65536 }
\intarray_new:Nn \g__regex_submatch_begin_intarray { 65536 }
\intarray_new:Nn \g__regex_submatch_end_intarray { 65536 }
\intarray_new:Nn \g__regex_balance_intarray { 65536 }
\cs_new_protected:Npn \__regex_return:
  {
    \if_meaning:w \c_true_bool \g__regex_success_bool
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
\cs_new_protected:Npn \__regex_query_set:n #1
  {
    \int_zero:N \l__regex_balance_int
    \int_zero:N \l__regex_curr_pos_int
    \__regex_query_set_aux:nN { } F
    \tl_analysis_map_inline:nn {#1}
      { \__regex_query_set_aux:nN {##1} ##3 }
    \__regex_query_set_aux:nN { } F
    \int_set_eq:NN \l__regex_max_pos_int \l__regex_curr_pos_int
  }
\cs_new_protected:Npn \__regex_query_set_aux:nN #1#2
  {
    \int_incr:N \l__regex_curr_pos_int
    \__regex_toks_set:Nn \l__regex_curr_pos_int {#1}
    \__kernel_intarray_gset:Nnn \g__regex_balance_intarray
      { \l__regex_curr_pos_int } { \l__regex_balance_int }
    \if_case:w "#2 \exp_stop_f:
    \or: \int_incr:N \l__regex_balance_int
    \or: \int_decr:N \l__regex_balance_int
    \fi:
  }
\cs_new_protected:Npn \__regex_if_match:nn #1#2
  {
    \group_begin:
      \__regex_disable_submatches:
      \__regex_single_match:
      #1
      \__regex_match:n {#2}
    \group_end:
  }
\cs_new_protected:Npn \__regex_count:nnN #1#2#3
  {
    \group_begin:
      \__regex_disable_submatches:
      \int_zero:N \l__regex_match_count_int
      \__regex_multi_match:n { \int_incr:N \l__regex_match_count_int }
      #1
      \__regex_match:n {#2}
      \exp_args:NNNo
    \group_end:
    \int_set:Nn #3 { \int_use:N \l__regex_match_count_int }
  }
\cs_new_protected:Npn \__regex_extract_once:nnN #1#2#3
  {
    \group_begin:
      \__regex_single_match:
      #1
      \__regex_match:n {#2}
      \__regex_extract:
      \__regex_query_set:n {#2}
    \__regex_group_end_extract_seq:N #3
  }
\cs_new_protected:Npn \__regex_extract_all:nnN #1#2#3
  {
    \group_begin:
      \__regex_multi_match:n { \__regex_extract: }
      #1
      \__regex_match:n {#2}
      \__regex_query_set:n {#2}
    \__regex_group_end_extract_seq:N #3
  }
\cs_new_protected:Npn \__regex_split:nnN #1#2#3
  {
    \group_begin:
      \__regex_multi_match:n
        {
          \if_int_compare:w
            \l__regex_start_pos_int < \l__regex_success_pos_int
            \__regex_extract:
            \__kernel_intarray_gset:Nnn \g__regex_submatch_prev_intarray
              { \l__regex_zeroth_submatch_int } { 0 }
            \__kernel_intarray_gset:Nnn \g__regex_submatch_end_intarray
              { \l__regex_zeroth_submatch_int }
              {
                \__kernel_intarray_item:Nn \g__regex_submatch_begin_intarray
                  { \l__regex_zeroth_submatch_int }
              }
            \__kernel_intarray_gset:Nnn \g__regex_submatch_begin_intarray
              { \l__regex_zeroth_submatch_int }
              { \l__regex_start_pos_int }
          \fi:
        }
      #1
      \__regex_match:n {#2}
      \__regex_query_set:n {#2}
      \__kernel_intarray_gset:Nnn \g__regex_submatch_prev_intarray
        { \l__regex_submatch_int } { 0 }
      \__kernel_intarray_gset:Nnn \g__regex_submatch_end_intarray
        { \l__regex_submatch_int }
        { \l__regex_max_pos_int }
      \__kernel_intarray_gset:Nnn \g__regex_submatch_begin_intarray
        { \l__regex_submatch_int }
        { \l__regex_start_pos_int }
      \int_incr:N \l__regex_submatch_int
      \if_meaning:w \c_true_bool \l__regex_empty_success_bool
        \if_int_compare:w \l__regex_start_pos_int = \l__regex_max_pos_int
          \int_decr:N \l__regex_submatch_int
        \fi:
      \fi:
    \__regex_group_end_extract_seq:N #3
  }
\cs_new_protected:Npn \__regex_group_end_extract_seq:N #1
  {
      \flag_clear:n { __regex_begin }
      \flag_clear:n { __regex_end }
      \seq_set_from_function:NnN \l__regex_internal_seq
        {
          \int_step_function:nnN { \l__regex_min_submatch_int }
            { \l__regex_submatch_int - 1 }
        }
        \__regex_extract_seq_aux:n
      \int_compare:nNnF
        {
          \flag_height:n { __regex_begin } +
          \flag_height:n { __regex_end }
        }
          = 0
        {
          \__kernel_msg_error:nnxxx { kernel } { result-unbalanced }
            { splitting~or~extracting~submatches }
            { \flag_height:n { __regex_end } }
            { \flag_height:n { __regex_begin } }
        }
      \seq_set_map_x:NNn \l__regex_internal_seq \l__regex_internal_seq {##1}
      \exp_args:NNNo
      \group_end:
      \tl_set:Nn #1 { \l__regex_internal_seq }
  }
\cs_new:Npn \__regex_extract_seq_aux:n #1
  {
    \exp_after:wN \__regex_extract_seq_aux:ww
    \int_value:w \__regex_submatch_balance:n {#1} ; #1;
  }
\cs_new:Npn \__regex_extract_seq_aux:ww #1; #2;
  {
    \if_int_compare:w #1 < 0 \exp_stop_f:
      \flag_raise:n { __regex_end }
      \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } }
    \fi:
    \__regex_query_submatch:n {#2}
    \if_int_compare:w #1 > 0 \exp_stop_f:
      \flag_raise:n { __regex_begin }
      \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } }
    \fi:
  }
\cs_new_protected:Npn \__regex_extract:
  {
    \if_meaning:w \c_true_bool \g__regex_success_bool
      \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int
      \prg_replicate:nn \l__regex_capturing_group_int
        {
          \__kernel_intarray_gset:Nnn \g__regex_submatch_prev_intarray
            { \l__regex_submatch_int } { 0 }
          \int_incr:N \l__regex_submatch_int
        }
      \__kernel_intarray_gset:Nnn \g__regex_submatch_prev_intarray
        { \l__regex_zeroth_submatch_int } { \l__regex_start_pos_int }
      \int_zero:N \l__regex_internal_a_int
      \clist_map_inline:Nn \l__regex_success_submatches_tl
        {
          \if_int_compare:w \l__regex_internal_a_int < \l__regex_capturing_group_int
            \__kernel_intarray_gset:Nnn \g__regex_submatch_begin_intarray
              { \__regex_int_eval:w \l__regex_zeroth_submatch_int + \l__regex_internal_a_int } {##1}
          \else:
            \__kernel_intarray_gset:Nnn \g__regex_submatch_end_intarray
              { \__regex_int_eval:w \l__regex_zeroth_submatch_int + \l__regex_internal_a_int - \l__regex_capturing_group_int } {##1}
          \fi:
          \int_incr:N \l__regex_internal_a_int
        }
    \fi:
  }
\cs_new_protected:Npn \__regex_replace_once:nnN #1#2#3
  {
    \group_begin:
      \__regex_single_match:
      #1
      \exp_args:No \__regex_match:n {#3}
      \if_meaning:w \c_false_bool \g__regex_success_bool
        \group_end:
      \else:
        \__regex_extract:
        \exp_args:No \__regex_query_set:n {#3}
        \__regex_replacement:n {#2}
        \int_set:Nn \l__regex_balance_int
          {
            \__regex_replacement_balance_one_match:n
              { \l__regex_zeroth_submatch_int }
          }
        \__kernel_tl_set:Nx \l__regex_internal_a_tl
          {
            \__regex_replacement_do_one_match:n
              { \l__regex_zeroth_submatch_int }
            \__regex_query_range:nn
              {
                \__kernel_intarray_item:Nn \g__regex_submatch_end_intarray
                  { \l__regex_zeroth_submatch_int }
              }
              { \l__regex_max_pos_int }
          }
        \__regex_group_end_replace:N #3
      \fi:
  }
\cs_new_protected:Npn \__regex_replace_all:nnN #1#2#3
  {
    \group_begin:
      \__regex_multi_match:n { \__regex_extract: }
      #1
      \exp_args:No \__regex_match:n {#3}
      \exp_args:No \__regex_query_set:n {#3}
      \__regex_replacement:n {#2}
      \int_set:Nn \l__regex_balance_int
        {
          0
          \int_step_function:nnnN
            { \l__regex_min_submatch_int }
            \l__regex_capturing_group_int
            { \l__regex_submatch_int - 1 }
            \__regex_replacement_balance_one_match:n
        }
      \__kernel_tl_set:Nx \l__regex_internal_a_tl
        {
          \int_step_function:nnnN
            { \l__regex_min_submatch_int }
            \l__regex_capturing_group_int
            { \l__regex_submatch_int - 1 }
            \__regex_replacement_do_one_match:n
          \__regex_query_range:nn
            \l__regex_start_pos_int \l__regex_max_pos_int
        }
    \__regex_group_end_replace:N #3
  }
\cs_new_protected:Npn \__regex_group_end_replace:N #1
  {
    \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f:
    \else:
      \__kernel_msg_error:nnxxx { kernel } { result-unbalanced }
        { replacing }
        { \int_max:nn { - \l__regex_balance_int } { 0 } }
        { \int_max:nn { \l__regex_balance_int } { 0 } }
    \fi:
    \use:x
      {
        \group_end:
        \tl_set:Nn \exp_not:N #1
          {
            \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f:
              \prg_replicate:nn { - \l__regex_balance_int }
                { { \if_false: } \fi: }
            \fi:
            \l__regex_internal_a_tl
            \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f:
              \prg_replicate:nn { \l__regex_balance_int }
                { \if_false: { \fi: } }
            \fi:
          }
      }
  }
\tl_new:N \l__regex_peek_true_tl
\tl_new:N \l__regex_peek_false_tl
\tl_new:N \l__regex_replacement_tl
\tl_new:N \l__regex_input_tl
\cs_new_eq:NN \__regex_input_item:n ?
\cs_new_protected:Npn \peek_regex:nTF #1
  {
    \__regex_peek:nnTF
      { \__regex_build_aux:Nn \c_false_bool {#1} }
      { \__regex_peek_end: }
  }
\cs_new_protected:Npn \peek_regex:nT #1#2
  { \peek_regex:nTF {#1} {#2} { } }
\cs_new_protected:Npn \peek_regex:nF #1 { \peek_regex:nTF {#1} { } }
\cs_new_protected:Npn \peek_regex:NTF #1
  {
    \__regex_peek:nnTF
      { \__regex_build_aux:NN \c_false_bool #1 }
      { \__regex_peek_end: }
  }
\cs_new_protected:Npn \peek_regex:NT #1#2
  { \peek_regex:NTF #1 {#2} { } }
\cs_new_protected:Npn \peek_regex:NF #1 { \peek_regex:NTF {#1} { } }
\cs_new_protected:Npn \peek_regex_remove_once:nTF #1
  {
    \__regex_peek:nnTF
      { \__regex_build_aux:Nn \c_false_bool {#1} }
      { \__regex_peek_remove_end:n {##1} }
  }
\cs_new_protected:Npn \peek_regex_remove_once:nT #1#2
  { \peek_regex_remove_once:nTF {#1} {#2} { } }
\cs_new_protected:Npn \peek_regex_remove_once:nF #1
  { \peek_regex_remove_once:nTF {#1} { } }
\cs_new_protected:Npn \peek_regex_remove_once:NTF #1
  {
    \__regex_peek:nnTF
      { \__regex_build_aux:NN \c_false_bool #1 }
      { \__regex_peek_remove_end:n {##1} }
  }
\cs_new_protected:Npn \peek_regex_remove_once:NT #1#2
  { \peek_regex_remove_once:NTF #1 {#2} { } }
\cs_new_protected:Npn \peek_regex_remove_once:NF #1
  { \peek_regex_remove_once:NTF #1 { } }
\cs_new_protected:Npn \__regex_peek:nnTF #1
  {
    \__regex_peek_aux:nnTF
      {
        \__regex_disable_submatches:
        #1
      }
  }
\cs_new_protected:Npn \__regex_peek_aux:nnTF #1#2#3#4
  {
    \group_begin:
      \tl_set:Nn \l__regex_peek_true_tl { \group_end: #3 }
      \tl_set:Nn \l__regex_peek_false_tl { \group_end: #4 }
      \__regex_single_match:
      #1
      \__regex_match_init:
      \tl_build_clear:N \l__regex_input_tl
      \__regex_match_once_init:
      \peek_analysis_map_inline:n
        {
          \tl_build_put_right:Nn \l__regex_input_tl
            { \__regex_input_item:n {##1} }
          \__regex_match_one_token:nnN {##1} {##2} ##3
          \use_none:nnn
          \prg_break_point:Nn \__regex_maplike_break:
            { \peek_analysis_map_break:n {#2} }
        }
  }
\cs_new_protected:Npn \__regex_peek_end:
  {
    \bool_if:NTF \g__regex_success_bool
      { \__regex_peek_reinsert:N \l__regex_peek_true_tl }
      { \__regex_peek_reinsert:N \l__regex_peek_false_tl }
  }
\cs_new_protected:Npn \__regex_peek_remove_end:n #1
  {
    \bool_if:NTF \g__regex_success_bool
      { \exp_args:NNo \use:nn \l__regex_peek_true_tl {#1} }
      { \__regex_peek_reinsert:N \l__regex_peek_false_tl }
  }
\cs_new_protected:Npn \__regex_peek_reinsert:N #1
  {
    \tl_build_end:N \l__regex_input_tl
    \cs_set_eq:NN \__regex_input_item:n \__regex_reinsert_item:n
    \exp_after:wN #1 \exp:w \l__regex_input_tl \exp_end:
  }
\cs_new_protected:Npn \__regex_reinsert_item:n #1
  {
    \exp_after:wN \exp_after:wN
    \exp_after:wN \exp_end:
    \exp_after:wN \exp_after:wN
    #1
    \exp:w
  }
\cs_new_protected:Npn \peek_regex_replace_once:nnTF #1
  { \__regex_peek_replace:nnTF { \__regex_build_aux:Nn \c_false_bool {#1} } }
\cs_new_protected:Npn \peek_regex_replace_once:nnT #1#2#3
  { \peek_regex_replace_once:nnTF {#1} {#2} {#3} { } }
\cs_new_protected:Npn \peek_regex_replace_once:nnF #1#2
  { \peek_regex_replace_once:nnTF {#1} {#2} { } }
\cs_new_protected:Npn \peek_regex_replace_once:nn #1#2
  { \peek_regex_replace_once:nnTF {#1} {#2} { } { } }
\cs_new_protected:Npn \peek_regex_replace_once:NnTF #1
  { \__regex_peek_replace:nnTF { \__regex_build_aux:NN \c_false_bool #1 } }
\cs_new_protected:Npn \peek_regex_replace_once:NnT #1#2#3
  { \peek_regex_replace_once:NnTF #1 {#2} {#3} { } }
\cs_new_protected:Npn \peek_regex_replace_once:NnF #1#2
  { \peek_regex_replace_once:NnTF #1 {#2} { } }
\cs_new_protected:Npn \peek_regex_replace_once:Nn #1#2
  { \peek_regex_replace_once:NnTF #1 {#2} { } { } }
\cs_new_protected:Npn \__regex_peek_replace:nnTF #1#2
  {
    \tl_set:Nn \l__regex_replacement_tl {#2}
    \__regex_peek_aux:nnTF {#1} { \__regex_peek_replace_end: }
  }
\cs_new_protected:Npn \__regex_peek_replace_end:
  {
    \bool_if:NTF \g__regex_success_bool
      {
        \__regex_extract:
        \__regex_query_set_from_input_tl:
        \cs_set_eq:NN \__regex_replacement_put:n \__regex_peek_replacement_put:n
        \cs_set_eq:NN \__regex_replacement_put_submatch_aux:n
          \__regex_peek_replacement_put_submatch_aux:n
        \cs_set_eq:NN \__regex_input_item:n \__regex_reinsert_item:n
        \cs_set_eq:NN \__regex_replacement_exp_not:N \__regex_peek_replacement_token:n
        \cs_set_eq:NN \__regex_replacement_exp_not:V \__regex_peek_replacement_var:N
        \exp_args:No \__regex_replacement:n { \l__regex_replacement_tl }
        \use:x
          {
            \exp_not:n { \exp_after:wN \l__regex_peek_true_tl \exp:w }
            \__regex_replacement_do_one_match:n
              { \l__regex_zeroth_submatch_int }
            \__regex_query_range:nn
              {
                \__kernel_intarray_item:Nn \g__regex_submatch_end_intarray
                  { \l__regex_zeroth_submatch_int }
              }
              { \l__regex_max_pos_int }
            \exp_end:
          }
      }
      { \__regex_peek_reinsert:N \l__regex_peek_false_tl }
  }
\cs_new_protected:Npn \__regex_query_set_from_input_tl:
  {
    \tl_build_end:N \l__regex_input_tl
    \int_zero:N \l__regex_curr_pos_int
    \cs_set_eq:NN \__regex_input_item:n \__regex_query_set_item:n
    \__regex_query_set_item:n { }
    \l__regex_input_tl
    \__regex_query_set_item:n { }
    \int_set_eq:NN \l__regex_max_pos_int \l__regex_curr_pos_int
  }
\cs_new_protected:Npn \__regex_query_set_item:n #1
  {
    \int_incr:N \l__regex_curr_pos_int
    \__regex_toks_set:Nn \l__regex_curr_pos_int { \__regex_input_item:n {#1} }
  }
\cs_new_protected:Npn \__regex_peek_replacement_put:n #1
  {
    \if_case:w \l__regex_replacement_csnames_int
      \tl_build_put_right:Nn \l__regex_build_tl
        { \exp_not:N \__regex_reinsert_item:n {#1} }
    \else:
      \tl_build_put_right:Nn \l__regex_build_tl {#1}
    \fi:
  }
\cs_new_protected:Npn \__regex_peek_replacement_token:n #1
  { \exp_after:wN \exp_end: \exp_after:wN #1 \exp:w }
\cs_new_protected:Npn \__regex_peek_replacement_put_submatch_aux:n #1
  {
    \if_case:w \l__regex_replacement_csnames_int
      \tl_build_put_right:Nn \l__regex_build_tl
        { \__regex_query_submatch:n { \int_eval:n { #1 + ##1 } } }
    \else:
      \tl_build_put_right:Nn \l__regex_build_tl
        { \exp:w \__regex_query_submatch:n { \int_eval:n { #1 + ##1 } } \exp_end: }
    \fi:
  }
\cs_new_protected:Npn \__regex_peek_replacement_var:N #1
  {
    \exp_after:wN \exp_last_unbraced:NV
    \exp_after:wN \exp_end:
    \exp_after:wN #1
    \exp:w
  }
\use:x
  {
    \__kernel_msg_new:nnn { kernel } { trailing-backslash }
      { Trailing~escape~char~'\iow_char:N\\'~in~regex~or~replacement. }
    \__kernel_msg_new:nnn { kernel } { x-missing-rbrace }
      {
        Missing~brace~'\iow_char:N\}'~in~regex~
        '...\iow_char:N\\x\iow_char:N\{...##1'.
      }
    \__kernel_msg_new:nnn { kernel } { x-overflow }
      {
        Character~code~##1~too~large~in~
        \iow_char:N\\x\iow_char:N\{##2\iow_char:N\}~regex.
      }
  }
\__kernel_msg_new:nnnn { kernel } { invalid-quantifier }
  { Braced~quantifier~'#1'~may~not~be~followed~by~'#2'. }
  {
    The~character~'#2'~is~invalid~in~the~braced~quantifier~'#1'.~
    The~only~valid~quantifiers~are~'*',~'?',~'+',~'{<int>}',~
    '{<min>,}'~and~'{<min>,<max>}',~optionally~followed~by~'?'.
  }
\__kernel_msg_new:nnnn { kernel } { missing-rbrack }
  { Missing~right~bracket~inserted~in~regular~expression. }
  {
    LaTeX~was~given~a~regular~expression~where~a~character~class~
    was~started~with~'[',~but~the~matching~']'~is~missing.
  }
\__kernel_msg_new:nnnn { kernel } { missing-rparen }
  {
    Missing~right~
    \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } ~
    inserted~in~regular~expression.
  }
  {
    LaTeX~was~given~a~regular~expression~with~\int_eval:n {#1} ~
    more~left~parentheses~than~right~parentheses.
  }
\__kernel_msg_new:nnnn { kernel } { extra-rparen }
  { Extra~right~parenthesis~ignored~in~regular~expression. }
  {
    LaTeX~came~across~a~closing~parenthesis~when~no~submatch~group~
    was~open.~The~parenthesis~will~be~ignored.
  }
\__kernel_msg_new:nnnn { kernel } { bad-escape }
  {
    Invalid~escape~'\iow_char:N\\#1'~
    \__regex_if_in_cs:TF { within~a~control~sequence. }
      {
        \__regex_if_in_class:TF
          { in~a~character~class. }
          { following~a~category~test. }
      }
  }
  {
    The~escape~sequence~'\iow_char:N\\#1'~may~not~appear~
    \__regex_if_in_cs:TF
      {
        within~a~control~sequence~test~introduced~by~
        '\iow_char:N\\c\iow_char:N\{'.
      }
      {
        \__regex_if_in_class:TF
          { within~a~character~class~ }
          { following~a~category~test~such~as~'\iow_char:N\\cL'~ }
        because~it~does~not~match~exactly~one~character.
      }
  }
\__kernel_msg_new:nnnn { kernel } { range-missing-end }
  { Invalid~end-point~for~range~'#1-#2'~in~character~class. }
  {
    The~end-point~'#2'~of~the~range~'#1-#2'~may~not~serve~as~an~
    end-point~for~a~range:~alphanumeric~characters~should~not~be~
    escaped,~and~non-alphanumeric~characters~should~be~escaped.
  }
\__kernel_msg_new:nnnn { kernel } { range-backwards }
  { Range~'[#1-#2]'~out~of~order~in~character~class. }
  {
    In~ranges~of~characters~'[x-y]'~appearing~in~character~classes,~
    the~first~character~code~must~not~be~larger~than~the~second.~
    Here,~'#1'~has~character~code~\int_eval:n {`#1},~while~
    '#2'~has~character~code~\int_eval:n {`#2}.
  }
\__kernel_msg_new:nnnn { kernel } { c-bad-mode }
  { Invalid~nested~'\iow_char:N\\c'~escape~in~regular~expression. }
  {
    The~'\iow_char:N\\c'~escape~cannot~be~used~within~
    a~control~sequence~test~'\iow_char:N\\c{...}'~
    nor~another~category~test.~
    To~combine~several~category~tests,~use~'\iow_char:N\\c[...]'.
  }
\__kernel_msg_new:nnnn { kernel } { c-C-invalid }
  { '\iow_char:N\\cC'~should~be~followed~by~'.'~or~'(',~not~'#1'. }
  {
    The~'\iow_char:N\\cC'~construction~restricts~the~next~item~to~be~a~
    control~sequence~or~the~next~group~to~be~made~of~control~sequences.~
    It~only~makes~sense~to~follow~it~by~'.'~or~by~a~group.
  }
\__kernel_msg_new:nnnn { kernel } { c-lparen-in-class }
  { Catcode~test~cannot~apply~to~group~in~character~class }
  {
    Construction~such~as~'\iow_char:N\\cL(abc)'~are~not~allowed~inside~a~
    class~'[...]'~because~classes~do~not~match~multiple~characters~at~once.
  }
\__kernel_msg_new:nnnn { kernel } { c-missing-rbrace }
  { Missing~right~brace~inserted~for~'\iow_char:N\\c'~escape. }
  {
    LaTeX~was~given~a~regular~expression~where~a~
    '\iow_char:N\\c\iow_char:N\{...'~construction~was~not~ended~
    with~a~closing~brace~'\iow_char:N\}'.
  }
\__kernel_msg_new:nnnn { kernel } { c-missing-rbrack }
  { Missing~right~bracket~inserted~for~'\iow_char:N\\c'~escape. }
  {
    A~construction~'\iow_char:N\\c[...'~appears~in~a~
    regular~expression,~but~the~closing~']'~is~not~present.
  }
\__kernel_msg_new:nnnn { kernel } { c-missing-category }
  { Invalid~character~'#1'~following~'\iow_char:N\\c'~escape. }
  {
    In~regular~expressions,~the~'\iow_char:N\\c'~escape~sequence~
    may~only~be~followed~by~a~left~brace,~a~left~bracket,~or~a~
    capital~letter~representing~a~character~category,~namely~
    one~of~'ABCDELMOPSTU'.
  }
\__kernel_msg_new:nnnn { kernel } { c-trailing }
  { Trailing~category~code~escape~'\iow_char:N\\c'... }
  {
    A~regular~expression~ends~with~'\iow_char:N\\c'~followed~
    by~a~letter.~It~will~be~ignored.
  }
\__kernel_msg_new:nnnn { kernel } { u-missing-lbrace }
  { Missing~left~brace~following~'\iow_char:N\\u'~escape. }
  {
    The~'\iow_char:N\\u'~escape~sequence~must~be~followed~by~
    a~brace~group~with~the~name~of~the~variable~to~use.
  }
\__kernel_msg_new:nnnn { kernel } { u-missing-rbrace }
  { Missing~right~brace~inserted~for~'\iow_char:N\\u'~escape. }
  {
    LaTeX~
    \str_if_eq:eeTF { } {#2}
      { reached~the~end~of~the~string~ }
      { encountered~an~escaped~alphanumeric~character '\iow_char:N\\#2'~ }
    when~parsing~the~argument~of~an~
    '\iow_char:N\\u\iow_char:N\{...\}'~escape.
  }
\__kernel_msg_new:nnnn { kernel } { posix-unsupported }
  { POSIX~collating~element~'[#1 ~ #1]'~not~supported. }
  {
    The~'[.foo.]'~and~'[=bar=]'~syntaxes~have~a~special~meaning~
    in~POSIX~regular~expressions.~This~is~not~supported~by~LaTeX.~
    Maybe~you~forgot~to~escape~a~left~bracket~in~a~character~class?
  }
\__kernel_msg_new:nnnn { kernel } { posix-unknown }
  { POSIX~class~'[:#1:]'~unknown. }
  {
    '[:#1:]'~is~not~among~the~known~POSIX~classes~
    '[:alnum:]',~'[:alpha:]',~'[:ascii:]',~'[:blank:]',~
    '[:cntrl:]',~'[:digit:]',~'[:graph:]',~'[:lower:]',~
    '[:print:]',~'[:punct:]',~'[:space:]',~'[:upper:]',~
    '[:word:]',~and~'[:xdigit:]'.
  }
\__kernel_msg_new:nnnn { kernel } { posix-missing-close }
  { Missing~closing~':]'~for~POSIX~class. }
  { The~POSIX~syntax~'#1'~must~be~followed~by~':]',~not~'#2'. }
\__kernel_msg_new:nnnn { kernel } { result-unbalanced }
  { Missing~brace~inserted~when~#1. }
  {
    LaTeX~was~asked~to~do~some~regular~expression~operation,~
    and~the~resulting~token~list~would~not~have~the~same~number~
    of~begin-group~and~end-group~tokens.~Braces~were~inserted:~
    #2~left,~#3~right.
  }
\__kernel_msg_new:nnnn { kernel } { unknown-option }
  { Unknown~option~'#1'~for~regular~expressions. }
  {
    The~only~available~option~is~'case-insensitive',~toggled~by~
    '(?i)'~and~'(?-i)'.
  }
\__kernel_msg_new:nnnn { kernel } { special-group-unknown }
  { Unknown~special~group~'#1~...'~in~a~regular~expression. }
  {
    The~only~valid~constructions~starting~with~'(?'~are~
    '(?:~...~)',~'(?|~...~)',~'(?i)',~and~'(?-i)'.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-c }
  { Misused~'\iow_char:N\\c'~command~in~a~replacement~text. }
  {
    In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~
    can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~
    or~a~brace~group,~not~by~'#1'.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-u }
  { Misused~'\iow_char:N\\u'~command~in~a~replacement~text. }
  {
    In~a~replacement~text,~the~'\iow_char:N\\u'~escape~sequence~
    must~be~~followed~by~a~brace~group~holding~the~name~of~the~
    variable~to~use.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-g }
  {
    Missing~brace~for~the~'\iow_char:N\\g'~construction~
    in~a~replacement~text.
  }
  {
    In~the~replacement~text~for~a~regular~expression~search,~
    submatches~are~represented~either~as~'\iow_char:N \\g{dd..d}',~
    or~'\\d',~where~'d'~are~single~digits.~Here,~a~brace~is~missing.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-catcode-end }
  {
    Missing~character~for~the~'\iow_char:N\\c<category><character>'~
    construction~in~a~replacement~text.
  }
  {
    In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~
    can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~
    the~character~category.~Then,~a~character~must~follow.~LaTeX~
    reached~the~end~of~the~replacement~when~looking~for~that.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-catcode-escaped }
  {
    Escaped~letter~or~digit~after~category~code~in~replacement~text.
  }
  {
    In~a~replacement~text,~the~'\iow_char:N\\c'~escape~sequence~
    can~be~followed~by~one~of~the~letters~'ABCDELMOPSTU'~representing~
    the~character~category.~Then,~a~character~must~follow,~not~
    '\iow_char:N\\#2'.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-catcode-in-cs }
  {
    Category~code~'\iow_char:N\\c#1#3'~ignored~inside~
    '\iow_char:N\\c\{...\}'~in~a~replacement~text.
  }
  {
    In~a~replacement~text,~the~category~codes~of~the~argument~of~
    '\iow_char:N\\c\{...\}'~are~ignored~when~building~the~control~
    sequence~name.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-null-space }
  { TeX~cannot~build~a~space~token~with~character~code~0. }
  {
    You~asked~for~a~character~token~with~category~space,~
    and~character~code~0,~for~instance~through~
    '\iow_char:N\\cS\iow_char:N\\x00'.~
    This~specific~case~is~impossible~and~will~be~replaced~
    by~a~normal~space.
  }
\__kernel_msg_new:nnnn { kernel } { replacement-missing-rbrace }
  { Missing~right~brace~inserted~in~replacement~text. }
  {
    There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~
    missing~right~\int_compare:nTF { #1 = 1 } { brace } { braces } .
  }
\__kernel_msg_new:nnnn { kernel } { replacement-missing-rparen }
  { Missing~right~parenthesis~inserted~in~replacement~text. }
  {
    There~ \int_compare:nTF { #1 = 1 } { was } { were } ~ #1~
    missing~right~
    \int_compare:nTF { #1 = 1 } { parenthesis } { parentheses } .
  }
\__kernel_msg_new:nnnn { kernel } { backwards-quantifier }
  { Quantifer~"{#1,#2}"~is~backwards. }
  { The~values~given~in~a~quantifier~must~be~in~order. }
\__kernel_msg_new:nnn { kernel } { show-regex }
  {
    >~Compiled~regex~
    \tl_if_empty:nTF {#1} { variable~ #2 } { {#1} } :
    #3
  }
\cs_new:Npn \__regex_msg_repeated:nnN #1#2#3
  {
    \str_if_eq:eeF { #1 #2 } { 1 0 }
      {
        , ~ repeated ~
        \int_case:nnF {#2}
          {
            { -1 } { #1~or~more~times,~\bool_if:NTF #3 { lazy } { greedy } }
            {  0 } { #1~times }
          }
          {
            between~#1~and~\int_eval:n {#1+#2}~times,~
            \bool_if:NTF #3 { lazy } { greedy }
          }
      }
  }
\cs_new_protected:Npn \__regex_trace_push:nnN #1#2#3
  { \__regex_trace:nnx {#1} {#2} { entering~ \token_to_str:N #3 } }
\cs_new_protected:Npn \__regex_trace_pop:nnN #1#2#3
   { \__regex_trace:nnx {#1} {#2} { leaving~ \token_to_str:N #3 } }
\cs_new_protected:Npn \__regex_trace:nnx #1#2#3
  {
    \int_compare:nNnF
      { \int_use:c { g__regex_trace_#1_int } } < {#2}
      { \iow_term:x { Trace:~#3 } }
  }
\int_new:N \g__regex_trace_regex_int
\cs_new_protected:Npn \__regex_trace_states:n #1
  {
    \int_step_inline:nnn
      \l__regex_min_state_int
      { \l__regex_max_state_int - 1 }
      {
        \__regex_trace:nnx { regex } {#1}
          { \iow_char:N \\toks ##1 = { \__regex_toks_use:w ##1 } }
      }
  }
%% File: l3box.dtx
\cs_new_eq:NN \__box_dim_eval:w \tex_dimexpr:D
\cs_new:Npn \__box_dim_eval:n #1
  { \__box_dim_eval:w #1 \scan_stop: }
\cs_new_protected:Npn \__kernel_kern:n #1
  { \tex_kern:D \__box_dim_eval:n {#1} }
\cs_new_protected:Npn \box_new:N #1
  {
    \__kernel_chk_if_free_cs:N #1
    \cs:w newbox \cs_end: #1
  }
\cs_generate_variant:Nn \box_new:N { c }
\cs_new_protected:Npn \box_clear:N #1
  { \box_set_eq:NN  #1 \c_empty_box }
\cs_new_protected:Npn \box_gclear:N #1
  { \box_gset_eq:NN #1 \c_empty_box }
\cs_generate_variant:Nn \box_clear:N  { c }
\cs_generate_variant:Nn \box_gclear:N { c }
\cs_new_protected:Npn \box_clear_new:N #1
  { \box_if_exist:NTF #1 { \box_clear:N #1 } { \box_new:N #1 } }
\cs_new_protected:Npn \box_gclear_new:N #1
  { \box_if_exist:NTF #1 { \box_gclear:N #1 } { \box_new:N #1 } }
\cs_generate_variant:Nn \box_clear_new:N  { c }
\cs_generate_variant:Nn \box_gclear_new:N { c }
\cs_new_protected:Npn \box_set_eq:NN #1#2
  { \tex_setbox:D #1 \tex_copy:D #2 }
\cs_new_protected:Npn \box_gset_eq:NN #1#2
  { \tex_global:D \tex_setbox:D #1 \tex_copy:D #2 }
\cs_generate_variant:Nn \box_set_eq:NN  { c , Nc , cc }
\cs_generate_variant:Nn \box_gset_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \box_set_eq_drop:NN #1#2
  { \tex_setbox:D #1 \tex_box:D #2 }
\cs_new_protected:Npn \box_gset_eq_drop:NN #1#2
  { \tex_global:D \tex_setbox:D #1 \tex_box:D #2 }
\cs_generate_variant:Nn \box_set_eq_drop:NN  { c , Nc , cc }
\cs_generate_variant:Nn \box_gset_eq_drop:NN { c , Nc , cc }
\prg_new_eq_conditional:NNn \box_if_exist:N \cs_if_exist:N
  { TF , T , F , p }
\prg_new_eq_conditional:NNn \box_if_exist:c \cs_if_exist:c
  { TF , T , F , p }
\cs_new_eq:NN \box_ht:N \tex_ht:D
\cs_new_eq:NN \box_dp:N \tex_dp:D
\cs_new_eq:NN \box_wd:N \tex_wd:D
\cs_generate_variant:Nn \box_ht:N { c }
\cs_generate_variant:Nn \box_dp:N { c }
\cs_generate_variant:Nn \box_wd:N { c }
\cs_new_protected:Npn \box_set_dp:Nn #1#2
  {
    \tex_setbox:D #1 = \tex_copy:D #1
    \box_dp:N #1 \__box_dim_eval:n {#2}
  }
\cs_generate_variant:Nn \box_set_dp:Nn { c }
\cs_new_protected:Npn \box_gset_dp:Nn #1#2
  { \box_dp:N #1 \__box_dim_eval:n {#2} }
\cs_generate_variant:Nn \box_gset_dp:Nn { c }
\cs_new_protected:Npn \box_set_ht:Nn #1#2
  {
    \tex_setbox:D #1 = \tex_copy:D #1
    \box_ht:N #1 \__box_dim_eval:n {#2}
  }
\cs_generate_variant:Nn \box_set_ht:Nn { c }
\cs_new_protected:Npn \box_gset_ht:Nn #1#2
  { \box_ht:N #1 \__box_dim_eval:n {#2} }
\cs_generate_variant:Nn \box_gset_ht:Nn { c }
\cs_new_protected:Npn \box_set_wd:Nn #1#2
  {
    \tex_setbox:D #1 = \tex_copy:D #1
    \box_wd:N #1 \__box_dim_eval:n {#2}
  }
\cs_generate_variant:Nn \box_set_wd:Nn { c }
\cs_new_protected:Npn \box_gset_wd:Nn #1#2
  { \box_wd:N #1 \__box_dim_eval:n {#2} }
\cs_generate_variant:Nn \box_gset_wd:Nn { c }
\cs_new_eq:NN \box_use_drop:N \tex_box:D
\cs_new_eq:NN \box_use:N \tex_copy:D
\cs_generate_variant:Nn \box_use_drop:N { c }
\cs_generate_variant:Nn \box_use:N { c }
\cs_new_protected:Npn \box_move_left:nn #1#2
  { \tex_moveleft:D \__box_dim_eval:n {#1} #2 }
\cs_new_protected:Npn \box_move_right:nn #1#2
  { \tex_moveright:D \__box_dim_eval:n {#1} #2 }
\cs_new_protected:Npn \box_move_up:nn #1#2
  { \tex_raise:D \__box_dim_eval:n {#1} #2 }
\cs_new_protected:Npn \box_move_down:nn #1#2
  { \tex_lower:D \__box_dim_eval:n {#1} #2 }
\cs_new_eq:NN \if_hbox:N      \tex_ifhbox:D
\cs_new_eq:NN \if_vbox:N      \tex_ifvbox:D
\cs_new_eq:NN \if_box_empty:N \tex_ifvoid:D
\prg_new_conditional:Npnn \box_if_horizontal:N #1 { p , T , F , TF }
  { \if_hbox:N #1 \prg_return_true: \else: \prg_return_false: \fi: }
\prg_new_conditional:Npnn \box_if_vertical:N #1 { p , T , F , TF }
  { \if_vbox:N #1 \prg_return_true: \else: \prg_return_false: \fi: }
\prg_generate_conditional_variant:Nnn \box_if_horizontal:N
  { c } { p , T , F , TF }
\prg_generate_conditional_variant:Nnn \box_if_vertical:N
  { c } { p , T , F , TF }
\prg_new_conditional:Npnn \box_if_empty:N #1 { p , T , F , TF }
  { \if_box_empty:N #1 \prg_return_true: \else: \prg_return_false: \fi: }
\prg_generate_conditional_variant:Nnn \box_if_empty:N
  { c } { p , T , F , TF }
\cs_new_protected:Npn \box_set_to_last:N #1
  { \tex_setbox:D #1 \tex_lastbox:D }
\cs_new_protected:Npn \box_gset_to_last:N #1
  { \tex_global:D \tex_setbox:D #1 \tex_lastbox:D }
\cs_generate_variant:Nn \box_set_to_last:N  { c }
\cs_generate_variant:Nn \box_gset_to_last:N { c }
\box_new:N \c_empty_box
\box_new:N \l_tmpa_box
\box_new:N \l_tmpb_box
\box_new:N \g_tmpa_box
\box_new:N \g_tmpb_box
\cs_new_protected:Npn \box_show:N #1
  { \box_show:Nnn #1 \c_max_int \c_max_int }
\cs_generate_variant:Nn \box_show:N { c }
\cs_new_protected:Npn \box_show:Nnn #1#2#3
  { \__box_show:NNff 1 #1 { \int_eval:n {#2} } { \int_eval:n {#3} } }
\cs_generate_variant:Nn \box_show:Nnn { c }
\cs_new_protected:Npn \box_log:N #1
  { \box_log:Nnn #1 \c_max_int \c_max_int }
\cs_generate_variant:Nn \box_log:N { c }
\cs_new_protected:Npn \box_log:Nnn
  { \exp_args:No \__box_log:nNnn { \tex_the:D \tex_interactionmode:D } }
\cs_new_protected:Npn \__box_log:nNnn #1#2#3#4
  {
    \int_set:Nn \tex_interactionmode:D { 0 }
    \__box_show:NNff 0 #2 { \int_eval:n {#3} } { \int_eval:n {#4} }
    \int_set:Nn \tex_interactionmode:D {#1}
  }
\cs_generate_variant:Nn \box_log:Nnn { c }
\cs_new_protected:Npn \__box_show:NNnn #1#2#3#4
  {
    \box_if_exist:NTF #2
      {
        \group_begin:
          \int_set:Nn \tex_showboxbreadth:D {#3}
          \int_set:Nn \tex_showboxdepth:D   {#4}
          \int_set:Nn \tex_tracingonline:D  {#1}
          \int_set:Nn \tex_errorcontextlines:D { -1 }
          \tex_showbox:D \use:n {#2}
        \group_end:
      }
      {
        \__kernel_msg_error:nnx { kernel } { variable-not-defined }
          { \token_to_str:N #2 }
      }
  }
\cs_generate_variant:Nn \__box_show:NNnn { NNff }
\cs_new_protected:Npn \hbox:n #1
  { \tex_hbox:D \scan_stop: { \color_group_begin: #1 \color_group_end: } }
\cs_new_protected:Npn \hbox_set:Nn #1#2
  {
    \tex_setbox:D #1 \tex_hbox:D
      { \color_group_begin: #2 \color_group_end: }
  }
\cs_new_protected:Npn \hbox_gset:Nn #1#2
  {
    \tex_global:D \tex_setbox:D #1 \tex_hbox:D
      { \color_group_begin: #2 \color_group_end: }
  }
\cs_generate_variant:Nn \hbox_set:Nn { c }
\cs_generate_variant:Nn \hbox_gset:Nn { c }
\cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3
  {
    \tex_setbox:D #1 \tex_hbox:D to \__box_dim_eval:n {#2}
      { \color_group_begin: #3 \color_group_end: }
  }
\cs_new_protected:Npn \hbox_gset_to_wd:Nnn #1#2#3
  {
    \tex_global:D \tex_setbox:D #1 \tex_hbox:D to \__box_dim_eval:n {#2}
      { \color_group_begin: #3 \color_group_end: }
  }
\cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c }
\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn { c }
\cs_new_protected:Npn \hbox_set:Nw  #1
  {
    \tex_setbox:D #1 \tex_hbox:D
      \c_group_begin_token
        \color_group_begin:
  }
\cs_new_protected:Npn \hbox_gset:Nw  #1
  {
    \tex_global:D \tex_setbox:D #1 \tex_hbox:D
      \c_group_begin_token
        \color_group_begin:
  }
\cs_generate_variant:Nn \hbox_set:Nw  { c }
\cs_generate_variant:Nn \hbox_gset:Nw { c }
\cs_new_protected:Npn \hbox_set_end:
  {
      \color_group_end:
    \c_group_end_token
  }
\cs_new_eq:NN \hbox_gset_end: \hbox_set_end:
\cs_new_protected:Npn \hbox_set_to_wd:Nnw #1#2
  {
    \tex_setbox:D #1 \tex_hbox:D to \__box_dim_eval:n {#2}
      \c_group_begin_token
        \color_group_begin:
  }
\cs_new_protected:Npn \hbox_gset_to_wd:Nnw #1#2
  {
    \tex_global:D \tex_setbox:D #1 \tex_hbox:D to \__box_dim_eval:n {#2}
      \c_group_begin_token
        \color_group_begin:
  }
\cs_generate_variant:Nn \hbox_set_to_wd:Nnw  { c }
\cs_generate_variant:Nn \hbox_gset_to_wd:Nnw { c }
\cs_new_protected:Npn \hbox_to_wd:nn #1#2
   {
     \tex_hbox:D to \__box_dim_eval:n {#1}
       { \color_group_begin: #2 \color_group_end: }
   }
\cs_new_protected:Npn \hbox_to_zero:n #1
  {
    \tex_hbox:D to \c_zero_dim
      { \color_group_begin: #1 \color_group_end: }
  }
\cs_new_protected:Npn \hbox_overlap_center:n  #1
  { \hbox_to_zero:n { \tex_hss:D #1 \tex_hss:D } }
\cs_new_protected:Npn \hbox_overlap_left:n  #1
  { \hbox_to_zero:n { \tex_hss:D #1 } }
\cs_new_protected:Npn \hbox_overlap_right:n #1
  { \hbox_to_zero:n { #1 \tex_hss:D } }
\cs_new_eq:NN \hbox_unpack:N \tex_unhcopy:D
\cs_new_eq:NN \hbox_unpack_drop:N \tex_unhbox:D
\cs_generate_variant:Nn \hbox_unpack:N { c }
\cs_generate_variant:Nn \hbox_unpack_drop:N { c }
\cs_new_protected:Npn \vbox:n #1
  { \tex_vbox:D { \color_group_begin: #1 \par \color_group_end: } }
\cs_new_protected:Npn \vbox_top:n #1
  { \tex_vtop:D { \color_group_begin: #1 \par \color_group_end: } }
\cs_new_protected:Npn \vbox_to_ht:nn #1#2
  {
    \tex_vbox:D to \__box_dim_eval:n {#1}
      { \color_group_begin: #2 \par \color_group_end: }
  }
\cs_new_protected:Npn \vbox_to_zero:n #1
  {
    \tex_vbox:D to \c_zero_dim
      { \color_group_begin: #1 \par \color_group_end: }
  }
\cs_new_protected:Npn \vbox_set:Nn #1#2
  {
    \tex_setbox:D #1 \tex_vbox:D
      { \color_group_begin: #2 \par \color_group_end: }
  }
\cs_new_protected:Npn \vbox_gset:Nn #1#2
  {
    \tex_global:D \tex_setbox:D #1 \tex_vbox:D
      { \color_group_begin: #2 \par \color_group_end: }
  }
\cs_generate_variant:Nn \vbox_set:Nn  { c }
\cs_generate_variant:Nn \vbox_gset:Nn { c }
\cs_new_protected:Npn \vbox_set_top:Nn #1#2
  {
    \tex_setbox:D #1 \tex_vtop:D
      { \color_group_begin: #2 \par \color_group_end: }
  }
\cs_new_protected:Npn \vbox_gset_top:Nn #1#2
  {
    \tex_global:D \tex_setbox:D #1 \tex_vtop:D
      { \color_group_begin: #2 \par \color_group_end: }
  }
\cs_generate_variant:Nn \vbox_set_top:Nn { c }
\cs_generate_variant:Nn \vbox_gset_top:Nn { c }
\cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3
  {
    \tex_setbox:D #1 \tex_vbox:D to \__box_dim_eval:n {#2}
      { \color_group_begin: #3 \par \color_group_end: }
  }
\cs_new_protected:Npn \vbox_gset_to_ht:Nnn #1#2#3
  {
    \tex_global:D \tex_setbox:D #1 \tex_vbox:D to \__box_dim_eval:n {#2}
      { \color_group_begin: #3 \par \color_group_end: }
  }
\cs_generate_variant:Nn \vbox_set_to_ht:Nnn  { c }
\cs_generate_variant:Nn \vbox_gset_to_ht:Nnn { c }
\cs_new_protected:Npn \vbox_set:Nw #1
  {
    \tex_setbox:D #1 \tex_vbox:D
      \c_group_begin_token
        \color_group_begin:
  }
\cs_new_protected:Npn \vbox_gset:Nw #1
  {
    \tex_global:D \tex_setbox:D #1 \tex_vbox:D
      \c_group_begin_token
        \color_group_begin:
  }
\cs_generate_variant:Nn \vbox_set:Nw  { c }
\cs_generate_variant:Nn \vbox_gset:Nw { c }
\cs_new_protected:Npn \vbox_set_end:
  {
        \par
      \color_group_end:
    \c_group_end_token
  }
\cs_new_eq:NN \vbox_gset_end: \vbox_set_end:
\cs_new_protected:Npn \vbox_set_to_ht:Nnw #1#2
  {
    \tex_setbox:D #1 \tex_vbox:D to \__box_dim_eval:n {#2}
      \c_group_begin_token
        \color_group_begin:
  }
\cs_new_protected:Npn \vbox_gset_to_ht:Nnw #1#2
  {
    \tex_global:D \tex_setbox:D #1 \tex_vbox:D to \__box_dim_eval:n {#2}
      \c_group_begin_token
        \color_group_begin:
  }
\cs_generate_variant:Nn \vbox_set_to_ht:Nnw  { c }
\cs_generate_variant:Nn \vbox_gset_to_ht:Nnw { c }
\cs_new_eq:NN \vbox_unpack:N \tex_unvcopy:D
\cs_new_eq:NN \vbox_unpack_drop:N \tex_unvbox:D
\cs_generate_variant:Nn \vbox_unpack:N { c }
\cs_generate_variant:Nn \vbox_unpack_drop:N { c }
\cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3
  { \tex_setbox:D #1 \tex_vsplit:D #2 to \__box_dim_eval:n {#3} }
\cs_generate_variant:Nn \vbox_set_split_to_ht:NNn { c , Nc , cc }
\cs_new_protected:Npn \vbox_gset_split_to_ht:NNn #1#2#3
  {
    \tex_global:D \tex_setbox:D #1
      \tex_vsplit:D #2 to \__box_dim_eval:n {#3}
  }
\cs_generate_variant:Nn \vbox_gset_split_to_ht:NNn { c , Nc , cc }
\fp_new:N \l__box_angle_fp
\fp_new:N \l__box_cos_fp
\fp_new:N \l__box_sin_fp
\dim_new:N \l__box_top_dim
\dim_new:N \l__box_bottom_dim
\dim_new:N \l__box_left_dim
\dim_new:N \l__box_right_dim
\dim_new:N \l__box_top_new_dim
\dim_new:N \l__box_bottom_new_dim
\dim_new:N \l__box_left_new_dim
\dim_new:N \l__box_right_new_dim
\box_new:N \l__box_internal_box
\cs_new_protected:Npn \box_rotate:Nn #1#2
  { \__box_rotate:NnN #1 {#2} \hbox_set:Nn }
\cs_generate_variant:Nn \box_rotate:Nn { c }
\cs_new_protected:Npn \box_grotate:Nn #1#2
  { \__box_rotate:NnN #1 {#2} \hbox_gset:Nn }
\cs_generate_variant:Nn \box_grotate:Nn { c }
\cs_new_protected:Npn \__box_rotate:NnN #1#2#3
  {
    #3 #1
      {
        \fp_set:Nn \l__box_angle_fp {#2}
        \fp_set:Nn \l__box_sin_fp { sind ( \l__box_angle_fp ) }
        \fp_set:Nn \l__box_cos_fp { cosd ( \l__box_angle_fp ) }
        \__box_rotate:N #1
      }
  }
\cs_new_protected:Npn \__box_rotate:N #1
  {
    \dim_set:Nn \l__box_top_dim    {  \box_ht:N #1 }
    \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 }
    \dim_set:Nn \l__box_right_dim  {  \box_wd:N #1 }
    \dim_zero:N \l__box_left_dim
    \fp_compare:nNnTF \l__box_sin_fp > \c_zero_fp
      {
        \fp_compare:nNnTF \l__box_cos_fp > \c_zero_fp
          { \__box_rotate_quadrant_one: }
          { \__box_rotate_quadrant_two: }
      }
      {
        \fp_compare:nNnTF \l__box_cos_fp < \c_zero_fp
          { \__box_rotate_quadrant_three: }
          { \__box_rotate_quadrant_four: }
      }
    \hbox_set:Nn \l__box_internal_box { \box_use:N #1 }
    \hbox_set:Nn \l__box_internal_box
      {
        \__kernel_kern:n { -\l__box_left_new_dim }
        \hbox:n
          {
            \__box_backend_rotate:Nn
              \l__box_internal_box
              \l__box_angle_fp
          }
      }
    \box_set_ht:Nn \l__box_internal_box {  \l__box_top_new_dim }
    \box_set_dp:Nn \l__box_internal_box { -\l__box_bottom_new_dim }
    \box_set_wd:Nn \l__box_internal_box
      { \l__box_right_new_dim - \l__box_left_new_dim }
    \box_use_drop:N \l__box_internal_box
  }
\cs_new_protected:Npn \__box_rotate_xdir:nnN #1#2#3
  {
    \dim_set:Nn #3
      {
        \fp_to_dim:n
          {
              \l__box_cos_fp * \dim_to_fp:n {#1}
            - \l__box_sin_fp * \dim_to_fp:n {#2}
          }
      }
  }
\cs_new_protected:Npn \__box_rotate_ydir:nnN #1#2#3
  {
    \dim_set:Nn #3
      {
        \fp_to_dim:n
          {
              \l__box_sin_fp * \dim_to_fp:n {#1}
            + \l__box_cos_fp * \dim_to_fp:n {#2}
          }
      }
  }
\cs_new_protected:Npn \__box_rotate_quadrant_one:
  {
    \__box_rotate_ydir:nnN \l__box_right_dim \l__box_top_dim
      \l__box_top_new_dim
    \__box_rotate_ydir:nnN \l__box_left_dim  \l__box_bottom_dim
      \l__box_bottom_new_dim
    \__box_rotate_xdir:nnN \l__box_left_dim  \l__box_top_dim
      \l__box_left_new_dim
    \__box_rotate_xdir:nnN \l__box_right_dim \l__box_bottom_dim
      \l__box_right_new_dim
  }
\cs_new_protected:Npn \__box_rotate_quadrant_two:
  {
    \__box_rotate_ydir:nnN \l__box_right_dim \l__box_bottom_dim
      \l__box_top_new_dim
    \__box_rotate_ydir:nnN \l__box_left_dim  \l__box_top_dim
      \l__box_bottom_new_dim
    \__box_rotate_xdir:nnN \l__box_right_dim  \l__box_top_dim
      \l__box_left_new_dim
    \__box_rotate_xdir:nnN \l__box_left_dim   \l__box_bottom_dim
      \l__box_right_new_dim
  }
\cs_new_protected:Npn \__box_rotate_quadrant_three:
  {
    \__box_rotate_ydir:nnN \l__box_left_dim  \l__box_bottom_dim
      \l__box_top_new_dim
    \__box_rotate_ydir:nnN \l__box_right_dim \l__box_top_dim
      \l__box_bottom_new_dim
    \__box_rotate_xdir:nnN \l__box_right_dim \l__box_bottom_dim
      \l__box_left_new_dim
    \__box_rotate_xdir:nnN \l__box_left_dim   \l__box_top_dim
      \l__box_right_new_dim
  }
\cs_new_protected:Npn \__box_rotate_quadrant_four:
  {
    \__box_rotate_ydir:nnN \l__box_left_dim  \l__box_top_dim
      \l__box_top_new_dim
    \__box_rotate_ydir:nnN \l__box_right_dim \l__box_bottom_dim
      \l__box_bottom_new_dim
    \__box_rotate_xdir:nnN \l__box_left_dim  \l__box_bottom_dim
      \l__box_left_new_dim
    \__box_rotate_xdir:nnN \l__box_right_dim \l__box_top_dim
      \l__box_right_new_dim
  }
\fp_new:N \l__box_scale_x_fp
\fp_new:N \l__box_scale_y_fp
\cs_new_protected:Npn \box_resize_to_wd_and_ht_plus_dp:Nnn #1#2#3
  {
    \__box_resize_to_wd_and_ht_plus_dp:NnnN #1 {#2} {#3}
      \hbox_set:Nn
  }
\cs_generate_variant:Nn \box_resize_to_wd_and_ht_plus_dp:Nnn { c }
\cs_new_protected:Npn \box_gresize_to_wd_and_ht_plus_dp:Nnn #1#2#3
  {
    \__box_resize_to_wd_and_ht_plus_dp:NnnN #1 {#2} {#3}
      \hbox_gset:Nn
  }
\cs_generate_variant:Nn \box_gresize_to_wd_and_ht_plus_dp:Nnn { c }
\cs_new_protected:Npn \__box_resize_to_wd_and_ht_plus_dp:NnnN #1#2#3#4
  {
    #4 #1
      {
        \__box_resize_set_corners:N #1
        \fp_set:Nn \l__box_scale_x_fp
          { \dim_to_fp:n {#2} / \dim_to_fp:n { \l__box_right_dim } }
        \fp_set:Nn \l__box_scale_y_fp
          {
              \dim_to_fp:n {#3}
            / \dim_to_fp:n { \l__box_top_dim - \l__box_bottom_dim }
          }
        \__box_resize:N #1
      }
  }
\cs_new_protected:Npn \__box_resize_set_corners:N #1
  {
    \dim_set:Nn \l__box_top_dim    {  \box_ht:N #1 }
    \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 }
    \dim_set:Nn \l__box_right_dim  {  \box_wd:N #1 }
    \dim_zero:N \l__box_left_dim
  }
\cs_new_protected:Npn \__box_resize:N #1
  {
    \__box_resize:NNN \l__box_right_new_dim
      \l__box_scale_x_fp \l__box_right_dim
    \__box_resize:NNN \l__box_bottom_new_dim
      \l__box_scale_y_fp \l__box_bottom_dim
    \__box_resize:NNN \l__box_top_new_dim
      \l__box_scale_y_fp \l__box_top_dim
    \__box_resize_common:N #1
  }
\cs_new_protected:Npn \__box_resize:NNN #1#2#3
  {
    \dim_set:Nn #1
      { \fp_to_dim:n { \fp_abs:n { #2 } * \dim_to_fp:n { #3 } } }
  }
\cs_new_protected:Npn \box_resize_to_ht:Nn #1#2
  { \__box_resize_to_ht:NnN #1 {#2} \hbox_set:Nn }
\cs_generate_variant:Nn \box_resize_to_ht:Nn { c }
\cs_new_protected:Npn \box_gresize_to_ht:Nn #1#2
  { \__box_resize_to_ht:NnN #1 {#2} \hbox_gset:Nn }
\cs_generate_variant:Nn \box_gresize_to_ht:Nn { c }
\cs_new_protected:Npn \__box_resize_to_ht:NnN #1#2#3
  {
    #3 #1
      {
        \__box_resize_set_corners:N #1
        \fp_set:Nn \l__box_scale_y_fp
          {
              \dim_to_fp:n {#2}
            / \dim_to_fp:n { \l__box_top_dim }
          }
        \fp_set_eq:NN \l__box_scale_x_fp \l__box_scale_y_fp
        \__box_resize:N #1
      }
  }
\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2
  { \__box_resize_to_ht_plus_dp:NnN #1 {#2} \hbox_set:Nn }
\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c }
\cs_new_protected:Npn \box_gresize_to_ht_plus_dp:Nn #1#2
  { \__box_resize_to_ht_plus_dp:NnN #1 {#2} \hbox_gset:Nn }
\cs_generate_variant:Nn \box_gresize_to_ht_plus_dp:Nn { c }
\cs_new_protected:Npn \__box_resize_to_ht_plus_dp:NnN #1#2#3
  {
    \hbox_set:Nn #1
      {
        \__box_resize_set_corners:N #1
        \fp_set:Nn \l__box_scale_y_fp
          {
              \dim_to_fp:n {#2}
            / \dim_to_fp:n { \l__box_top_dim - \l__box_bottom_dim }
          }
        \fp_set_eq:NN \l__box_scale_x_fp \l__box_scale_y_fp
        \__box_resize:N #1
      }
  }
\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2
  { \__box_resize_to_wd:NnN #1 {#2} \hbox_set:Nn }
\cs_generate_variant:Nn \box_resize_to_wd:Nn { c }
\cs_new_protected:Npn \box_gresize_to_wd:Nn #1#2
  { \__box_resize_to_wd:NnN #1 {#2} \hbox_gset:Nn }
\cs_generate_variant:Nn \box_gresize_to_wd:Nn { c }
\cs_new_protected:Npn \__box_resize_to_wd:NnN #1#2#3
  {
    #3 #1
      {
        \__box_resize_set_corners:N #1
        \fp_set:Nn \l__box_scale_x_fp
          { \dim_to_fp:n {#2} / \dim_to_fp:n { \l__box_right_dim } }
        \fp_set_eq:NN \l__box_scale_y_fp \l__box_scale_x_fp
        \__box_resize:N #1
      }
  }
\cs_new_protected:Npn \box_resize_to_wd_and_ht:Nnn #1#2#3
  { \__box_resize_to_wd_and_ht:NnnN #1 {#2} {#3} \hbox_set:Nn }
\cs_generate_variant:Nn \box_resize_to_wd_and_ht:Nnn { c }
\cs_new_protected:Npn \box_gresize_to_wd_and_ht:Nnn #1#2#3
  { \__box_resize_to_wd_and_ht:NnnN #1 {#2} {#3} \hbox_gset:Nn }
\cs_generate_variant:Nn \box_gresize_to_wd_and_ht:Nnn { c }
\cs_new_protected:Npn \__box_resize_to_wd_and_ht:NnnN #1#2#3#4
  {
    #4 #1
      {
        \__box_resize_set_corners:N #1
        \fp_set:Nn \l__box_scale_x_fp
          { \dim_to_fp:n {#2} / \dim_to_fp:n { \l__box_right_dim } }
        \fp_set:Nn \l__box_scale_y_fp
          {
              \dim_to_fp:n {#3}
            / \dim_to_fp:n { \l__box_top_dim }
          }
        \__box_resize:N #1
      }
  }
\cs_new_protected:Npn \box_scale:Nnn #1#2#3
  { \__box_scale:NnnN #1 {#2} {#3} \hbox_set:Nn }
\cs_generate_variant:Nn \box_scale:Nnn { c }
\cs_new_protected:Npn \box_gscale:Nnn #1#2#3
  { \__box_scale:NnnN #1 {#2} {#3} \hbox_gset:Nn }
\cs_generate_variant:Nn \box_gscale:Nnn { c }
\cs_new_protected:Npn \__box_scale:NnnN #1#2#3#4
  {
    #4 #1
      {
        \fp_set:Nn \l__box_scale_x_fp {#2}
        \fp_set:Nn \l__box_scale_y_fp {#3}
        \__box_scale:N #1
      }
  }
\cs_new_protected:Npn \__box_scale:N #1
  {
    \dim_set:Nn \l__box_top_dim    {  \box_ht:N #1 }
    \dim_set:Nn \l__box_bottom_dim { -\box_dp:N #1 }
    \dim_set:Nn \l__box_right_dim  {  \box_wd:N #1 }
    \dim_zero:N \l__box_left_dim
    \dim_set:Nn \l__box_top_new_dim
      { \fp_abs:n { \l__box_scale_y_fp } \l__box_top_dim }
    \dim_set:Nn \l__box_bottom_new_dim
      { \fp_abs:n { \l__box_scale_y_fp } \l__box_bottom_dim }
    \dim_set:Nn \l__box_right_new_dim
      { \fp_abs:n { \l__box_scale_x_fp } \l__box_right_dim }
    \__box_resize_common:N #1
  }
\cs_new_protected:Npn \box_autosize_to_wd_and_ht:Nnn #1#2#3
  { \__box_autosize:NnnnN #1 {#2} {#3} { \box_ht:N #1 } \hbox_set:Nn }
\cs_generate_variant:Nn \box_autosize_to_wd_and_ht:Nnn { c }
\cs_new_protected:Npn \box_gautosize_to_wd_and_ht:Nnn #1#2#3
  { \__box_autosize:NnnnN #1 {#2} {#3} { \box_ht:N #1 } \hbox_gset:Nn }
\cs_generate_variant:Nn \box_autosize_to_wd_and_ht:Nnn { c }
\cs_new_protected:Npn \box_autosize_to_wd_and_ht_plus_dp:Nnn #1#2#3
  {
    \__box_autosize:NnnnN #1 {#2} {#3} { \box_ht:N #1 + \box_dp:N #1 }
      \hbox_set:Nn
  }
\cs_generate_variant:Nn \box_autosize_to_wd_and_ht_plus_dp:Nnn { c }
\cs_new_protected:Npn \box_gautosize_to_wd_and_ht_plus_dp:Nnn #1#2#3
  {
    \__box_autosize:NnnnN #1 {#2} {#3} { \box_ht:N #1 + \box_dp:N #1 }
      \hbox_gset:Nn
  }
\cs_generate_variant:Nn \box_gautosize_to_wd_and_ht_plus_dp:Nnn { c }
\cs_new_protected:Npn \__box_autosize:NnnnN #1#2#3#4#5
  {
    #5 #1
      {
        \fp_set:Nn \l__box_scale_x_fp { ( #2 ) / \box_wd:N #1 }
        \fp_set:Nn \l__box_scale_y_fp { ( #3 ) / ( #4 ) }
        \fp_compare:nNnTF \l__box_scale_x_fp > \l__box_scale_y_fp
          { \fp_set_eq:NN \l__box_scale_x_fp \l__box_scale_y_fp }
          { \fp_set_eq:NN \l__box_scale_y_fp \l__box_scale_x_fp }
        \__box_scale:N #1
      }
  }
\cs_new_protected:Npn \__box_resize_common:N #1
  {
    \hbox_set:Nn \l__box_internal_box
      {
        \__box_backend_scale:Nnn
          #1
          \l__box_scale_x_fp
          \l__box_scale_y_fp
      }
    \fp_compare:nNnTF \l__box_scale_y_fp > \c_zero_fp
      {
        \box_set_ht:Nn \l__box_internal_box { \l__box_top_new_dim }
        \box_set_dp:Nn \l__box_internal_box { -\l__box_bottom_new_dim }
      }
      {
        \box_set_dp:Nn \l__box_internal_box { \l__box_top_new_dim }
        \box_set_ht:Nn \l__box_internal_box { -\l__box_bottom_new_dim }
      }
    \fp_compare:nNnTF \l__box_scale_x_fp < \c_zero_fp
      {
        \hbox_to_wd:nn { \l__box_right_new_dim }
          {
            \__kernel_kern:n { \l__box_right_new_dim }
            \box_use_drop:N \l__box_internal_box
            \tex_hss:D
          }
      }
      {
        \box_set_wd:Nn \l__box_internal_box { \l__box_right_new_dim }
        \hbox:n
          {
            \__kernel_kern:n { 0pt }
            \box_use_drop:N \l__box_internal_box
            \tex_hss:D
          }
      }
  }
%% File: l3color.dtx
\cs_new_eq:NN \color_group_begin: \group_begin:
\cs_new_eq:NN \color_group_end:   \group_end:
\cs_new_protected:Npn \color_ensure_current:
  {
    \__color_backend_pickup:N \l__color_current_tl
    \__color_select:N \l__color_current_tl
  }
\scan_new:N \s__color_stop
\cs_new_protected:Npn \__color_select:N #1
  { \exp_after:wN \__color_select:nn #1 }
\cs_new_protected:Npn \__color_select:nn #1#2
  { \use:c { __color_backend_select_ #1 :n } {#2} }
\tl_new:N \l__color_current_tl
\tl_set:Nn \l__color_current_tl { { gray } { 0 } }

\int_new:N \l__color_internal_int
\tl_new:N \l__color_internal_tl
\scan_new:N \s__color_mark
\prg_new_conditional:Npnn \__color_if_defined:n #1 { T, F, TF }
  {
    \prop_if_exist:cTF { l__color_named_ #1 _prop }
      \prg_return_true:
      \prg_return_false:
  }
\cs_new:Npn \__color_model:N #1 { \exp_after:wN \use_i:nn #1 }
\cs_new:Npn \__color_values:N #1 { \exp_after:wN \use_ii:nn #1 }
\cs_new_protected:Npn \__color_extract:nNN #1#2#3
  {
    \tl_set_eq:Nc #2 { l__color_named_ #1 _tl }
    \prop_get:cVN { l__color_named_ #1 _prop } #2 #3
  }
\cs_generate_variant:Nn \__color_extract:nNN { V }
\cs_new_protected:Npn \__color_convert:nnN #1#2#3
  { \__color_convert:nnVN {#1} {#2} #3 #3 }
\cs_generate_variant:Nn \__color_convert:nnN { VV }
\cs_new_protected:Npn \__color_convert:nnnN #1#2#3#4
  {
    \tl_set:Nx #4
      {
        \cs_if_exist:cTF { __color_convert_ #1 _ #2 :w }
          { \use:c { __color_convert_ #1 _ #2 :w } #3 ~ 0 ~ 0 ~ 0 \s__color_stop }
          { \use:c { c__color_fallback_ #2 _tl } }
      }
  }
\cs_generate_variant:Nn \__color_convert:nnnN { nV , nnV }
\cs_new:Npn \__color_convert_gray_rgb:w #1 ~ #2 \s__color_stop
  { #1 ~ #1 ~ #1 }
\cs_new:Npn \__color_convert_gray_cmyk:w #1 ~ #2 \s__color_stop
  { 0 ~ 0 ~ 0 ~ \fp_eval:n { 1 - #1 } }
\cs_new:Npn \__color_convert_rgb_gray:w #1 ~ #2 ~ #3 ~ #4 \s__color_stop
  { \fp_eval:n { 0.3 * #1 + 0.59 * #2 + 0.11 * #3 } }
\cs_new:Npn \__color_convert_rgb_cmyk:w #1 ~ #2 ~ #3 ~ #4 \s__color_stop
  {
    \exp_args:Nf \__color_convert_rgb_cmyk:nnnn
      { \fp_eval:n { min ( 1 - #1 , 1 - #2 , 1 - #3 ) } } {#1} {#2} {#3}
  }
\cs_new:Npn \__color_convert_rgb_cmyk:nnnn #1#2#3#4
  {
    \fp_eval:n { min ( 1 , max ( 0 , 1 - #2 - #1 ) ) } \c_space_tl
    \fp_eval:n { min ( 1 , max ( 0 , 1 - #3 - #1 ) ) } \c_space_tl
    \fp_eval:n { min ( 1 , max ( 0 , 1 - #4 - #1 ) ) } \c_space_tl
    #1
  }
\cs_new:Npn \__color_convert_cmyk_gray:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \s__color_stop
  { \fp_eval:n { 1 - min ( 1 , 0.3 * #1 + 0.59 * #2 + 0.11 * #3 + #4 ) } }
\cs_new:Npn \__color_convert_cmyk_rgb:w #1 ~ #2 ~ #3 ~ #4 ~ #5 \s__color_stop
  {
    \fp_eval:n { 1 - min ( 1 , #1 + #4 ) } \c_space_tl
    \fp_eval:n { 1 - min ( 1 , #2 + #4 ) } \c_space_tl
    \fp_eval:n { 1 - min ( 1 , #3 + #4 ) }
  }
\tl_new:N \l__color_model_tl
\tl_new:N \l__color_value_tl
\tl_new:N \l__color_next_model_tl
\tl_new:N \l__color_next_value_tl
\cs_new_protected:Npx \__color_parse:nN #1#2
  {
    \exp_not:N \__color_backend_pickup:N \exp_not:N \l__color_current_tl
    \tl_set:Nx \exp_not:c { l__color_named_ . _tl }
      { \exp_not:N \__color_model:N \exp_not:N \l__color_current_tl }
    \prop_put:NVx \exp_not:c { l__color_named_ . _prop }
      \exp_not:c { l__color_named_ . _tl }
      { \exp_not:N \__color_values:N \exp_not:N \l__color_current_tl }
    \exp_not:N \exp_args:Ne \exp_not:N \__color_parse_aux:nN
      { \exp_not:N \tl_to_str:n {#1} } #2
  }
\cs_new_protected:Npn \__color_parse_aux:nN #1#2
  {
    \tl_if_exist:cTF { l__color_named_ #1 _prop }
      { \__color_parse_set_eq:Nn #2 {#1} }
      { \__color_parse:Nw #2#1 ! \s__color_stop }
    \__color_check_model:N #2
  }
\cs_new_protected:Npn \__color_parse_set_eq:Nn #1#2
  {
    \tl_if_empty:NTF \l_color_fixed_model_tl
       { \exp_args:Nv \__color_parse_set_eq:nNn { l__color_named_ #2 _tl } }
       { \exp_args:NV \__color_parse_set_eq:nNn \l_color_fixed_model_tl }
         #1 {#2}
  }
\cs_new_protected:Npn \__color_parse_set_eq:nNn #1#2#3
  {
    \prop_get:cnNTF
      { l__color_named_ #3 _prop } {#1}
      \l__color_value_tl
      { \tl_set:Nx #2 { {#1} { \l__color_value_tl } } }
      {
        \tl_set_eq:Nc \l__color_model_tl { l__color_named_ #3 _tl }
        \prop_get:cVN { l__color_named_ #3 _prop } \l__color_model_tl
          \l__color_value_tl
         \__color_convert:nnN
           \l__color_model_tl {#1} \l__color_value_tl
        \tl_set:Nx #2
          {
            {#1}
            { \l__color_value_tl }
          }
      }
  }
\cs_new_protected:Npn \__color_parse:Nw #1#2 ! #3 \s__color_stop
  {
    \__color_if_defined:nTF {#2}
      {
        \tl_if_blank:nTF {#3}
          { \__color_parse_set_eq:Nn #1 {#2} }
          { \__color_parse_loop_init:Nnn #1 {#2} {#3} }
      }
      {
        \__kernel_msg_error:nnn { color } { unknown-color } {#2}
        \tl_set:Nn \l__color_current_tl { { gray } { 0 } }
      }
  }
\cs_new_protected:Npn \__color_parse_loop_init:Nnn #1#2#3
  {
    \group_begin:
      \__color_extract:nNN {#2} \l__color_model_tl \l__color_value_tl
      \__color_parse_loop:w #3 ! ! ! ! \s__color_stop
      \tl_set:Nx \l__color_internal_tl
        { { \l__color_model_tl } { \l__color_value_tl } }
    \exp_args:NNNV \group_end:
    \tl_set:Nn #1 \l__color_internal_tl
  }
\cs_new_protected:Npn \__color_parse_loop:w #1 ! #2 ! #3 ! #4 ! #5 \s__color_stop
  {
    \bool_lazy_or:nnF
      { \tl_if_blank_p:n {#1} }
      { \int_compare_p:nNn {#1} = { 100 } }
      {
        \int_compare:nNnTF {#1} = { 0 }
          {
            \tl_if_blank:nTF {#2}
              { \__color_extract:nNN { white } }
              { \__color_extract:nNN {#2} }
                \l__color_model_tl \l__color_value_tl
          }
          {
            \use:x
              {
                \__color_parse_loop:nn {#1}
                  { \tl_if_blank:nTF {#2} { white } {#2} }
              }
          }
      }
    \tl_if_blank:nF {#3}
      { \__color_parse_loop:w #3 ! #4 ! #5 \s__color_stop }
    \__color_parse_end:
  }
\cs_new_protected:Npn \__color_parse_loop:nn #1#2
  {
    \__color_if_defined:nTF {#2}
      {
        \__color_extract:nNN {#2} \l__color_next_model_tl \l__color_next_value_tl
        \tl_if_eq:NNF \l__color_model_tl \l__color_next_model_tl
          {
            \str_if_eq:VnTF \l__color_model_tl { gray }
              { \__color_parse_gray:n {#2} }
              { \__color_parse_std:n {#2} }
          }
        \tl_set:Nx \l__color_value_tl
          {
            \__color_parse_mix:NVVn
              \l__color_model_tl \l__color_value_tl \l__color_next_value_tl {#1}
          }
      }
      {
        \__kernel_msg_error:nnn { color } { unknown-color } {#2}
        \__color_extract:nNN { black } \l__color_model_tl \l__color_value_tl
        \__color_parse_break:w
      }
  }
\cs_new_protected:Npn \__color_parse_gray:n #1
  {
    \tl_set_eq:NN \l__color_model_tl \l__color_next_model_tl
    \tl_set:Nn \l__color_next_model_tl { gray }
    \exp_args:NnV \__color_convert:nnN { gray } \l__color_model_tl
      \l__color_value_tl
    \prop_get:cVN { l__color_named_ #1 _prop } \l__color_model_tl
      \l__color_next_value_tl
  }
\cs_new_protected:Npn \__color_parse_std:n #1
  {
    \prop_get:cVNF { l__color_named_ #1 _prop }
      \l__color_model_tl
      \l__color_next_value_tl
        {
          \__color_convert:VVN
            \l__color_next_model_tl
            \l__color_model_tl
            \l__color_next_value_tl
        }
  }
\cs_new_protected:Npn \__color_parse_break:w #1 \__color_parse_end: { }
\cs_new_protected:Npn \__color_parse_end: { }
\cs_new:Npn \__color_parse_mix:Nnnn #1#2#3#4
  {
    \exp_args:Nf \__color_parse_mix:nNnn
      { \fp_eval:n { #4 / 100 } }
      #1 {#2} {#3}
  }
\cs_generate_variant:Nn \__color_parse_mix:Nnnn { NVV }
\cs_new:Npn \__color_parse_mix:nNnn #1#2#3#4
  {
    \use:c { __color_parse_mix_ #2 :nw } {#1}
      #3 \s__color_mark #4 \s__color_stop
  }
\cs_new:Npn \__color_parse_mix_gray:nw #1#2 \s__color_mark #3 \s__color_stop
  { \fp_eval:n { #2 * #1 + #3 * ( 1 - #1 ) } }
\cs_new:Npn \__color_parse_mix_rgb:nw
  #1#2 ~ #3 ~ #4 \s__color_mark #5 ~ #6 ~ #7 \s__color_stop
  {
    \fp_eval:n { #2 * #1 + #5 * ( 1 - #1 ) } \c_space_tl
    \fp_eval:n { #3 * #1 + #6 * ( 1 - #1 ) } \c_space_tl
    \fp_eval:n { #4 * #1 + #7 * ( 1 - #1 ) }
  }
\cs_new:Npn \__color_parse_mix_cmyk:nw
  #1#2 ~ #3 ~ #4 ~ #5 \s__color_mark #6 ~ #7 ~ #8 ~ #9 \s__color_stop
  {
    \fp_eval:n { #2 * #1 + #6 * ( 1 - #1 ) } \c_space_tl
    \fp_eval:n { #3 * #1 + #7 * ( 1 - #1 ) } \c_space_tl
    \fp_eval:n { #4 * #1 + #8 * ( 1 - #1 ) } \c_space_tl
    \fp_eval:n { #5 * #1 + #9 * ( 1 - #1 ) }
  }
\cs_new:Npn \__color_parse_model_gray:w #1 , #2 \s__color_stop
  { { gray } { \__color_parse_number:n {#1} } }
\cs_new:Npn \__color_parse_model_rgb:w #1 , #2 , #3 , #4 \s__color_stop
  {
    { rgb }
    {
      \__color_parse_number:n {#1} ~
      \__color_parse_number:n {#2} ~
      \__color_parse_number:n {#3}
    }
  }
\cs_new:Npn \__color_parse_model_cmyk:w #1 , #2 , #3 , #4 , #5 \s__color_stop
  {
    { cmyk }
    {
      \__color_parse_number:n {#1} ~
      \__color_parse_number:n {#2} ~
      \__color_parse_number:n {#3} ~
      \__color_parse_number:n {#4}
    }
  }
\cs_new:Npn \__color_parse_number:n #1
  {  \__color_parse_number:w #1 . 0 . \s__color_stop }
\cs_new:Npn \__color_parse_number:w #1 . #2 . #3 \s__color_stop
  { \tl_if_blank:nTF {#1} { 0 } {#1} . #2 }
\cs_new:Npn \__color_parse_model_Gray:w #1 , #2 \s__color_stop
  { { gray } { \fp_eval:n { #1 / 15 } } }
\cs_new:Npn \__color_parse_model_hsb:w #1 , #2 , #3 , #4 \s__color_stop
  { \__color_parse_model_hsb:nnn {#1} {#2} {#3} }
\cs_new:Npn \__color_parse_model_Hsb:w #1 , #2 , #3 , #4 \s__color_stop
  {
    \exp_args:Ne \__color_parse_model_hsb:nnn { \fp_eval:n { #1 / 360 } }
      {#2} {#3}
  }
\cs_new:Npn \__color_parse_model_hsb:nnn #1#2#3
  {
    { rgb }
    {
      \exp_args:Ne \__color_parse_model_hsb_aux:nnn
        { \fp_eval:n { 6 * #1 } } {#2} {#3}
    }
  }
\cs_new:Npn \__color_parse_model_hsb_aux:nnn #1#2#3
  {
    \exp_args:Nee \__color_parse_model_hsb_aux:nnnn
      { \fp_eval:n { floor(#1) } } { \fp_eval:n { #1 - floor(#1) } }
      {#2} {#3}
  }
\cs_new:Npn \__color_parse_model_hsb_aux:nnnn #1#2#3#4
  {
    \use:e
      {
        \exp_not:N \__color_parse_model_hsb_aux:nnnnn
         { \__color_parse_number:n {#4} }
         { \fp_eval:n { round(#4 * (1 - #3) ,5) } }
         { \fp_eval:n { round(#4 * ( 1 - #3 * #2 ) ,5) } }
         { \fp_eval:n { round(#4 * ( 1 - #3 * (1 - #2) ) ,5) } }
         {#1}
      }
  }
\cs_new:Npn \__color_parse_model_hsb_aux:nnnnn #1#2#3#4#5
  { \use:c { __color_parse_model_hsb_ #5 :nnnn } {#1} {#2} {#3} {#4} }
\cs_new:cpn { __color_parse_model_hsb_0:nnnn } #1#2#3#4 { #1 ~ #4 ~ #2 }
\cs_new:cpn { __color_parse_model_hsb_1:nnnn } #1#2#3#4 { #3 ~ #1 ~ #2 }
\cs_new:cpn { __color_parse_model_hsb_2:nnnn } #1#2#3#4 { #2 ~ #1 ~ #4 }
\cs_new:cpn { __color_parse_model_hsb_3:nnnn } #1#2#3#4 { #2 ~ #3 ~ #1 }
\cs_new:cpn { __color_parse_model_hsb_4:nnnn } #1#2#3#4 { #4 ~ #2 ~ #1 }
\cs_new:cpn { __color_parse_model_hsb_5:nnnn } #1#2#3#4 { #1 ~ #2 ~ #3 }
\cs_new:cpn { __color_parse_model_hsb_6:nnnn } #1#2#3#4 { #1 ~ #2 ~ #2 }
\cs_new:Npn \__color_parse_model_HSB:w #1 , #2 , #3 , #4 \s__color_stop
  {
    \exp_args:Neee \__color_parse_model_hsb:nnn
      { \fp_eval:n {#1 / 240} }
      { \fp_eval:n {#2 / 240} }
      { \fp_eval:n {#3 / 240} }
  }
\cs_new:Npn \__color_parse_model_HTML:w #1 , #2 \s__color_stop
  { \__color_parse_model_HTML_aux:w #1 0 0 0 0 0 0 \s__color_stop }
\cs_new:Npn \__color_parse_model_HTML_aux:w #1#2#3#4#5#6#7 \s__color_stop
  {
    { rgb }
    {
      \fp_eval:n { round(\int_from_hex:n {#1#2} / 255,5) } ~
      \fp_eval:n { round(\int_from_hex:n {#3#4} / 255,5) } ~
      \fp_eval:n { round(\int_from_hex:n {#5#6} / 255,5) }
    }
  }
\cs_new:Npn \__color_parse_model_RGB:w #1 , #2 , #3 , #4 \s__color_stop
  {
    { rgb }
    {
      \fp_eval:n { round(#1 / 255,5) } ~
      \fp_eval:n { round(#2 / 255,5) } ~
      \fp_eval:n { round(#3 / 255,5) }
    }
  }
\cs_new:Npn \__color_parse_model_wave:w #1 , #2 \s__color_stop
  {
    { rgb }
    {
      \fp_compare:nNnTF {#1} < { 420 }
        { \__color_parse_model_wave_auxi:nn {#1} { 0.3 + 0.7 * (#1 - 380) / 40 }
        }
        {
          \fp_compare:nNnTF {#1} > { 700 }
            { \__color_parse_model_wave_auxi:nn {#1} { 0.3 + 0.7 * (#1 - 780) / -80 } }
            { \__color_parse_model_wave_auxi:nn {#1} { 1 } }
        }
    }
  }
\cs_new:Npn \__color_parse_model_wave_auxi:nn #1#2
  {
    \fp_compare:nNnTF {#1} < { 440 }
      {
        \__color_parse_model_wave_auxii:nn
          { 4 + \__color_parse_model_wave_rho:n { (#1 - 440) / -60 } }
          {#2}
      }
      {
        \fp_compare:nNnTF {#1} < { 490 }
          {
            \__color_parse_model_wave_auxii:nn
              { 4 - \__color_parse_model_wave_rho:n { (#1 - 440) / 50 } }
              {#2}
          }
          {
            \fp_compare:nNnTF {#1} < { 510 }
              {
                \__color_parse_model_wave_auxii:nn
                  { 2 + \__color_parse_model_wave_rho:n { (#1 - 510) / -20 } }
                  {#2}
              }
              {
                \fp_compare:nNnTF {#1} < { 580 }
                  {
                    \__color_parse_model_wave_auxii:nn
                      { 2 - \__color_parse_model_wave_rho:n { (#1 - 510) / 70 } }
                      {#2}
                  }
                  {
                    \fp_compare:nNnTF {#1} < { 645 }
                      {
                        \__color_parse_model_wave_auxii:nn
                          { \__color_parse_model_wave_rho:n { (#1 - 645) / -65 } }
                          {#2}
                      }
                      { \__color_parse_model_wave_auxii:nn { 0 } {#2} }
                  }
              }
          }
      }
  }
\cs_new:Npn \__color_parse_model_wave_auxii:nn #1#2
  {
    \exp_args:Neee \__color_parse_model_hsb_aux:nnn
      { \fp_eval:n {#1} }
      { 1 }
      { \__color_parse_model_wave_rho:n {#2} }
  }
\cs_new:Npn \__color_parse_model_wave_rho:n #1
  { \fp_eval:n { min(1, max(0,#1) ) } }
\tl_new:N \l_color_fixed_model_tl
\cs_new_protected:Npn \__color_check_model:N #1
  {
    \tl_if_empty:NF \l_color_fixed_model_tl
      {
        \exp_after:wN \__color_check_model:nn #1
        \tl_if_eq:NNF \l__color_model_tl \l_color_fixed_model_tl
          {
            \__color_convert:VVN \l__color_model_tl \l_color_fixed_model_tl
              \l__color_value_tl
          }
        \tl_set:Nx #1
          { { \l_color_fixed_model_tl } { \l__color_value_tl } }
      }
  }
\cs_new_protected:Npn \__color_check_model:nn #1#2
  {
    \tl_set:Nn \l__color_model_tl {#1}
    \tl_set:Nn \l__color_value_tl {#2}
  }
\cs_new_protected:Npx \__color_select:
  {
    \tl_set:Nx \exp_not:c { l__color_named_ . _tl }
      { \exp_not:N \__color_model:N \exp_not:N \l__color_current_tl }
    \prop_clear:N \exp_not:c { l__color_named_ . _prop }
    \prop_put:NVx \exp_not:c { l__color_named_ . _prop }
      \exp_not:c { l__color_named_ . _tl }
      { \exp_not:N \__color_values:N \exp_not:N \l__color_current_tl }
    \__color_select:N \exp_not:N \l__color_current_tl
  }
\cs_new_protected:Npn \color_select:n #1
  {
    \__color_parse:nN {#1} \l__color_current_tl
    \__color_select:
  }
\cs_new_protected:Npn \color_select:nn #1#2
  {
    \__color_select_main:Nw \l__color_current_tl
      #1 / / \s__color_mark #2 / / \s__color_stop
    \__color_select:
  }
\cs_new_protected:Npn \__color_select_main:Nw
  #1 #2 / #3 / #4 \s__color_mark #5 / #6 / #7 \s__color_stop
  {
    \__color_select:nnN {#2} {#5} #1
    \bool_lazy_or:nnF
      { \tl_if_empty_p:N \l_color_fixed_model_tl }
      { \str_if_eq_p:nV {#2} \l_color_fixed_model_tl }
      { \__color_select_loop:Nw #1 #3 / #4 \s__color_mark #6 / #7 \s__color_stop }
  }
\cs_new_protected:Npn \__color_select_loop:Nw
  #1 #2 / #3 \s__color_mark #4 / #5 \s__color_stop
  {
    \str_if_eq:nVTF {#2} \l_color_fixed_model_tl
      { \__color_select:nnN {#2} {#4} #1 }
      {
        \tl_if_blank:nTF {#2}
          { \exp_after:wN \__color_select_swap:Nnn \exp_after:wN #1 #1 }
          { \__color_select_loop:Nw #1 #3 \s__color_mark #5 \s__color_stop }
      }
  }
\cs_new_protected:Npn \__color_select:nnN #1#2#3
  {
    \cs_if_exist:cTF { __color_parse_model_ #1 :w }
      {
        \tl_set:Nx #3
          { \use:c { __color_parse_model_ #1 :w } #2 , 0 , 0 , 0 , 0 \s__color_stop }
      }
      { \__kernel_msg_error:nnn { color } { unknown-model } {#1} }
  }
\cs_new_protected:Npn \__color_select_swap:Nnn #1#2#3
  {
    \__color_convert:nVnN {#2} \l_color_fixed_model_tl {#3} \l__color_value_tl
    \tl_set:Nx #1
      { { \l_color_fixed_model_tl } { \l__color_value_tl } }
  }
\cs_new_protected:Npn \color_fill:n #1
  {
    \__color_parse:nN {#1} \l__color_current_tl
    \exp_after:wN \__color_draw:nnn \l__color_current_tl { fill }
  }
\cs_new_protected:Npn \color_stroke:n #1
  {
    \__color_parse:nN {#1} \l__color_current_tl
    \exp_after:wN \__color_draw:nnn \l__color_current_tl { stroke }
  }
\cs_new_protected:Npn \color_fill:nn #1#2
  {
    \__color_select_main:Nw \l__color_current_tl
      #1 / / \s__color_mark #2 / / \s__color_stop
    \exp_after:wN \__color_draw:nnn \l__color_current_tl { fill }
  }
\cs_new_protected:Npn \color_stroke:nn #1#2
  {
    \__color_select_main:Nw \l__color_current_tl
      #1 / / \s__color_mark #2 / / \s__color_stop
    \exp_after:wN \__color_draw:nnn \l__color_current_tl { stroke }
  }
\cs_new_protected:Npn \__color_draw:nnn #1#2#3
  { \use:c { __color_backend_ #3 _ #1 :n } {#2} }
\tl_new:N \l__color_named_tl
\cs_new_protected:Npn \color_set:nn #1#2
  {
    \exp_args:NV \__color_set:nnn
      \l_color_fixed_model_tl {#1} {#2}
  }
\cs_new_protected:Npn \__color_set:nnn #1#2#3
  {
    \tl_clear:N \l_color_fixed_model_tl
    \__color_set:nn {#2} {#3}
    \tl_set:Nn \l_color_fixed_model_tl {#1}
  }
\cs_new_protected:Npn \__color_set:nn #1#2
  {
    \str_if_eq:nnF {#1} { . }
      {
        \__color_parse:nN {#2} \l__color_named_tl
        \tl_clear_new:c { l__color_named_ #1 _tl }
        \tl_set:cx { l__color_named_ #1 _tl }
          { \__color_model:N \l__color_named_tl }
        \prop_clear_new:c { l__color_named_ #1 _prop }
        \prop_put:cvx { l__color_named_ #1 _prop } { l__color_named_ #1 _tl }
          { \__color_values:N \l__color_named_tl }
        \__color_set:nnw {#1} {#2} #2 ! \s__color_stop
      }
  }
\cs_new_protected:Npn \__color_set:nnw #1#2#3 ! #4 \s__color_stop
  {
    \clist_map_inline:nn { cmyk , gray , rgb }
      {
        \prop_get:cnNT { l__color_named_ #3 _prop } {##1} \l__color_internal_tl
          {
            \prop_if_in:cnF { l__color_named_ #1 _prop } {##1}
              {
                \group_begin:
                  \tl_set:cn { l__color_named_ #3 _tl } {##1}
                  \__color_parse:nN {#2} \l__color_internal_tl
                \exp_args:NNNV \group_end:
                \tl_set:Nn \l__color_internal_tl \l__color_internal_tl
                \prop_put:cxx { l__color_named_ #1 _prop }
                  { \__color_model:N \l__color_internal_tl }
                  { \__color_values:N \l__color_internal_tl }
              }
          }
      }
  }
\cs_new_protected:Npx \color_set:nnn #1#2#3
  {
    \exp_not:N \str_if_eq:nnF {#1} { . }
      {
        \tl_clear_new:c { l__color_named_ #1 _tl }
        \prop_clear_new:c { l__color_named_ #1 _prop }
        \exp_not:N \__color_set_colon:nnw {#1} {#3}
          #2 \c_colon_str \c_colon_str \exp_not:N \s__color_stop
      }
  }
\use:x
  {
    \cs_new_protected:Npn \exp_not:N \__color_set_colon:nnw
      ##1##2 ##3 \c_colon_str ##4 \c_colon_str
      ##5 \exp_not:N \s__color_stop
  }
  {
    \tl_if_blank:nTF {#4}
      { \__color_set_loop:nw {#1} #3 }
      { \__color_set_loop:nw {#1} #4 }
        / / \s__color_mark #2 / / \s__color_stop
  }
\cs_new_protected:Npn \__color_set_loop:nw
  #1#2 / #3 \s__color_mark #4 / #5 \s__color_stop
  {
    \tl_if_blank:nF {#2}
      {
        \__color_select:nnN {#2} {#4} \l__color_named_tl
        \tl_set:Nx \l__color_internal_tl { \__color_model:N \l__color_named_tl }
        \tl_if_empty:cT { l__color_named_ #1 _tl }
          { \tl_set_eq:cN { l__color_named_ #1 _tl } \l__color_internal_tl }
        \prop_put:cVx { l__color_named_ #1 _prop } \l__color_internal_tl
          { \__color_values:N \l__color_named_tl }
        \__color_set_loop:nw {#1} #3 \s__color_mark #5 \s__color_stop
      }
  }
\cs_new_protected:Npn \color_set_eq:nn #1#2
  {
    \__color_if_defined:nTF {#2}
      {
        \tl_clear_new:c { l__color_named_ #1 _tl }
        \prop_clear_new:c { l__color_named_ #1 _prop }
        \str_if_eq:nnTF {#2} { . }
          {
            \tl_set:cx { l__color_named_ #1 _tl }
              { \__color_model:N \l__color_current_tl }
            \prop_put:cvx { l__color_named_ #1 _prop } { l__color_named_ #1 _tl }
              { \__color_values:N \l__color_current_tl }
          }
          {
            \tl_set_eq:cc { l__color_named_ #1 _tl } { l__color_named_ #2 _tl }
            \prop_set_eq:cc { l__color_named_ #1 _prop } { l__color_named_ #2 _prop }
          }
      }
      {
        \__kernel_msg_error:nnn { color } { unknown-color } {#2}
      }
  }
\color_set:nnn { black } { gray } { 0 }
\color_set:nnn { white } { gray } { 1 }
\color_set:nnn { cyan }    { cmyk } { 1 , 0 , 0 , 0 }
\color_set:nnn { magenta } { cmyk } { 0 , 1 , 0 , 0 }
\color_set:nnn { yellow }  { cmyk } { 0 , 0 , 1 , 0 }
\color_set:nnn { red }   { rgb } { 1 , 0 , 0 }
\color_set:nnn { green } { rgb } { 0 , 1 , 0 }
\color_set:nnn { blue }  { rgb } { 0 , 0 , 1 }
\prop_new:c { l__color_named_._prop }
\tl_new:c { l__color_named_._tl }
\tl_set:cx { l__color_named_._tl } { \__color_model:N \l__color_current_tl }
\cs_new_protected:Npn \color_export:nnN #1#2#3
  {
    \group_begin:
      \tl_if_exist:cT { c__color_export_ #2 _tl }
        { \tl_set_eq:Nc \l_color_fixed_model_tl { c__color_export_ #2 _tl } }
      \__color_parse:nN {#1} #3
      \__color_export:nN {#2} #3
    \exp_args:NNNV \group_end:
    \tl_set:Nn #3 #3
  }
\cs_new_protected:Npn \color_export:nnnN #1#2#3#4
  {
    \__color_select_main:Nw #4
      #1 / / \s__color_mark #2 / / \s__color_stop
    \__color_export:nN {#3} #4
  }
\cs_new_protected:Npn \__color_export:nN #1#2
  { \exp_after:wN \__color_export:nnnN #2 {#1} #2 }
\cs_new:Npn \__color_export:nnnN #1#2#3#4
  {
    \cs_if_exist_use:cF { __color_export_format_ #3 :nnN }
      {
        \__kernel_msg_error:nnn { color } { unknown-export-format } {#3}
        \use_none:nnn
      }
        {#1} {#2} #4
  }
\cs_new_protected:Npn \__color_export_format_backend:nnN #1#2#3
  { \tl_set:Nn #3 { {#1} {#2} } }
\cs_new_protected:Npn \__color_export:nnnNN #1#2#3#4#5
  {
    \str_if_eq:nnTF {#2} {#1}
      { #5 #4 #3 \s__color_stop }
      {
        \__color_convert:nnnN {#2} {#1} {#3} #4
        \exp_after:wN #5 \exp_after:wN #4
          #4 \s__color_stop
      }
  }
\tl_const:Nn \c__color_export_HTML_tl { rgb }
\tl_const:cn { c__color_export_space-sep-cmyk_tl } { cmyk }
\tl_const:cn { c__color_export_space-sep-rgb_tl } { rgb }
\cs_new_protected:cpx { __color_export_format_space-sep-cmyk:nnN } #1#2#3
  {
    \exp_not:N \__color_export:nnnNN { cmyk } {#1} {#2} #3
      \exp_not:c { __color_export_space-sep-cmyk:Nw }
  }
\cs_new_protected:cpn { __color_export_space-sep-cmyk:Nw } #1#2 \s__color_stop
  { \tl_set:Nx #1 {#2} }
\cs_new_protected:Npn \__color_export_format_HTML:nnN #1#2#3
  { \__color_export:nnnNN { rgb } {#1} {#2}#3 \__color_export_HTML:Nw }
\cs_new_protected:cpx { __color_export_format_space-sep-rgb:nnN } #1#2#3
  {
    \exp_not:N \__color_export:nnnNN { rgb } {#1} {#2} #3
      \exp_not:c { __color_export_space-sep-rgb:Nw }
  }
\cs_new_protected:Npn \__color_export_HTML:Nw #1#2 ~ #3 ~ #4 \s__color_stop
  {
    \tl_set:Nx #1
      {
        \__color_export_HTML:n {#2}
        \__color_export_HTML:n {#3}
        \__color_export_HTML:n {#4}
      }
  }
\cs_new:Npn \__color_export_HTML:n #1
  {
    \fp_compare:nNnTF {#1} = { 0 }
      { 00 }
      { \int_to_Hex:n { \fp_to_int:n { #1 * 255 } } }
  }
\cs_new_protected:cpn { __color_export_space-sep-rgb:Nw } #1#2 \s__color_stop
  { \tl_set:Nx #1 {#2} }
\prop_new:N \l__color_internal_prop
\int_new:N \g__color_model_int
\tl_const:Nn \c__color_fallback_cmyk_tl { 0 ~ 0 ~ 0 ~ 1 }
\tl_const:Nn \c__color_fallback_gray_tl { 1 }
\tl_const:Nn \c__color_fallback_rgb_tl { 1 ~ 1 ~ 1 }
\prop_new:N \g__color_colorants_prop
\prop_gput:Nnn \g__color_colorants_prop { black }   { Black }
\prop_gput:Nnn \g__color_colorants_prop { blue }    { Blue }
\prop_gput:Nnn \g__color_colorants_prop { cyan }    { Cyan }
\prop_gput:Nnn \g__color_colorants_prop { green }   { Green }
\prop_gput:Nnn \g__color_colorants_prop { magenta } { Magenta }
\prop_gput:Nnn \g__color_colorants_prop { none }    { None }
\prop_gput:Nnn \g__color_colorants_prop { red }     { Red }
\prop_gput:Nnn \g__color_colorants_prop { yellow }  { Yellow }
\tl_const:Nn \c__color_model_whitepoint_CIELAB_a_tl      { 1.0985 ~ 1 ~ 0.3558 }
\tl_const:Nn \c__color_model_whitepoint_CIELAB_b_tl      { 0.9807 ~ 1 ~ 1.1822 }
\tl_const:Nn \c__color_model_whitepoint_CIELAB_e_tl      { 1 ~ 1 ~ 1 }
\tl_const:cn { c__color_model_whitepoint_CIELAB_d50_tl } { 0.9642 ~ 1 ~ 0.8251 }
\tl_const:cn { c__color_model_whitepoint_CIELAB_d55_tl } { 0.9568 ~ 1 ~ 0.9214 }
\tl_const:cn { c__color_model_whitepoint_CIELAB_d65_tl } { 0.9504 ~ 1 ~ 1.0888 }
\tl_const:cn { c__color_model_whitepoint_CIELAB_d75_tl } { 0.9497 ~ 1 ~ 1.2261 }
\tl_const:Nn \c__color_model_range_CIELAB_tl { 0 ~ 100 ~ -128 ~ 127 ~ -128 ~ 127 }
\prop_new:N \g__color_alternative_model_prop
\clist_map_inline:nn { cyan , magenta , yellow , black }
  { \prop_gput:Nnn \g__color_alternative_model_prop {#1} { cmyk } }
\clist_map_inline:nn { red , green , blue }
  { \prop_gput:Nnn \g__color_alternative_model_prop {#1} { rgb } }
\prop_new:N \g__color_alternative_values_prop
\prop_gput:Nnn \g__color_alternative_values_prop { cyan }    {  1 , 0 , 0 , 0 }
\prop_gput:Nnn \g__color_alternative_values_prop { magenta } {  0 , 1 , 0 , 0 }
\prop_gput:Nnn \g__color_alternative_values_prop { yellow }  {  0 , 0 , 1 , 0 }
\prop_gput:Nnn \g__color_alternative_values_prop { black }   {  0 , 0 , 0 , 1 }
\prop_gput:Nnn \g__color_alternative_values_prop { red }   {  1 , 0 , 0 }
\prop_gput:Nnn \g__color_alternative_values_prop { green } {  0 , 1 , 0 }
\prop_gput:Nnn \g__color_alternative_values_prop { blue }  {  0 , 0 , 1 }
\cs_new_protected:Npn \color_model_new:nnn #1#2#3
  {
    \exp_args:Nee \__color_model_new:nnn
      { \tl_to_str:n {#1} }
      { \str_foldcase:n {#2} } {#3}
  }
\cs_new_protected:Npn \__color_model_new:nnn #1#2#3
  {
    \cs_if_exist:cTF { __color_parse_model_ #1 :w }
      {
        \__kernel_msg_error:nnn { color } { model-already-defined } {#1}
      }
      {
        \cs_if_exist:cTF { __color_model_ #2 :n }
          {
            \prop_set_from_keyval:Nn \l__color_internal_prop {#3}
            \use:c { __color_model_ #2 :n } {#1}
          }
          {
            \__kernel_msg_error:nnn { color } { unknown-model-type } {#2}
          }
      }
  }
\cs_new_protected:Npn \__color_model_separation:n #1
  {
    \prop_get:NnNTF \l__color_internal_prop { name }
      \l__color_internal_tl
      {
        \exp_args:NV \__color_model_separation:nn
          \l__color_internal_tl {#1}
      }
      {
        \__kernel_msg_error:nnn { color }
          { separation-requires-name } {#1}
      }
  }
\cs_new_protected:Npn \__color_model_separation:nn #1#2
  {
    \prop_get:NnNTF \l__color_internal_prop { alternative-model }
      \l__color_internal_tl
      {
        \exp_args:NV \__color_model_separation:nnn
          \l__color_internal_tl {#2} {#1}
      }
      {
        \__kernel_msg_error:nnn { color }
          { separation-alternative-model } {#2}
      }
  }
\cs_new_protected:Npn \__color_model_separation:nnn #1#2#3
  {
    \cs_if_exist:cTF { __color_model_separation_ #1 :nnnnnn }
      {
        \prop_get:NnNTF \l__color_internal_prop { alternative-values }
          \l__color_internal_tl
          {
            \exp_after:wN \__color_model_separation:w \l__color_internal_tl
              , 0 , 0 , 0 , 0 \s__color_stop {#2} {#3} {#1}
          }
          {
            \__kernel_msg_error:nnn { color }
              { separation-alternative-values } {#2}
          }
      }
      {
        \__kernel_msg_error:nnn { color }
          { unknown-alternative-model } {#1}
      }
  }
\cs_new_protected:Npn \__color_model_separation:w
  #1 , #2 , #3 , #4 , #5 \s__color_stop #6#7#8
  {
    \int_gincr:N \g__color_model_int
    \tl_const:cn { c__color_fallback_ #6 _tl } { 1 }
    \cs_new_eq:cN { __color_parse_mix_ #6 :nw } \__color_parse_mix_gray:nw
    \cs_new:cpn { __color_parse_model_ #6 :w } ##1 , ##2 \s__color_stop
      { {#6} { \__color_parse_number:n {##1} } }
    \clist_map_inline:nn { fill , stroke , select }
      {
        \cs_new_protected:cpx { __color_backend_ ##1 _ #6 :n } ####1
          {
            \exp_not:c { __color_backend_ ##1 _ separation:nn }
              { color \int_use:N \g__color_model_int } {####1}
          }
      }
    \use:c { __color_model_separation_ #8 :nnnnnn }
      {#6} {#7} {#1} {#2} {#3} {#4}
    \prop_gput:Nnn \g__color_alternative_model_prop {#6} {#8}
    \prop_gput:Nnx \g__color_colorants_prop {#6}
      { \str_convert_pdfname:n {#7} }
    \cs_new_protected:cpx { __color_model_ #6 _white: }
      {
        \prop_put:Nnn \exp_not:N \l__color_named_white_prop {#6} { 0 }
        \exp_not:N \int_compare:nNnF { \tex_currentgrouplevel:D } = 0
          { \group_insert_after:N \exp_not:c { __color_model_ #6 _ white: } }
      }
    \use:c { __color_model_ #6 _white: }
  }
\cs_new_protected:Npn \__color_model_separation_cmyk:nnnnnn #1#2#3#4#5#6
  {
    \cs_new:cpn { __color_convert_ #1 _cmyk:w } ##1 ~ ##2 \s__color_stop
      {
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #4} ~
         \fp_eval:n {##1 * #5} ~
         \fp_eval:n {##1 * #6}
      }
    \__color_model_convert:nnn {#1} { cmyk } { rgb }
    \__color_model_convert:nnn {#1} { cmyk } { gray }
    \prop_gput:Nnn \g__color_alternative_values_prop {#1} { #3 , #4 , #5 , #6 }
    \__color_backend_separation_init:nnnnn {#2} { /DeviceCMYK } { }
      { 0 ~ 0 ~ 0 ~ 0 } { #3 ~ #4 ~ #5 ~ #6 }
  }
\cs_new_protected:Npn \__color_model_separation_rgb:nnnnnn #1#2#3#4#5#6
  {
    \cs_new:cpn { __color_convert_ #1 _rgb:w } ##1 ~ ##2 \s__color_stop
      {
         \fp_eval:n {##1 * #3} ~
         \fp_eval:n {##1 * #4} ~
         \fp_eval:n {##1 * #5}
      }
    \__color_model_convert:nnn {#1} { rgb } { cmyk }
    \__color_model_convert:nnn {#1} { rgb } { gray }
    \prop_gput:Nnn \g__color_alternative_values_prop {#1} { #3 , #4 , #5 }
    \__color_backend_separation_init:nnnnn {#2} { /DeviceRGB } { }
      { 0 ~ 0 ~ 0 } { #3 ~ #4 ~ #5 }
  }
\cs_new_protected:Npn \__color_model_separation_gray:nnnnnn #1#2#3#4#5#6
  {
    \cs_new:cpn { __color_convert_ #1 _cmyk:w } ##1 ~ ##2 \s__color_stop
      {
        \fp_eval:n {##1 * #3} ~
        \fp_eval:n {##1 * #3} ~
        \fp_eval:n {##1 * #3} ~
        \fp_eval:n {##1 * #3}
      }
    \cs_new:cpn { __color_convert_ #1 _gray:w } ##1 ~ ##2 \s__color_stop
      { \fp_eval:n {##1 * #3} }
    \cs_new:cpn { __color_convert_ #1 _rgb:w } ##1 ~ ##2 \s__color_stop
      {
        \fp_eval:n {##1 * #3} ~
        \fp_eval:n {##1 * #3} ~
        \fp_eval:n {##1 * #3}
      }
    \prop_gput:Nnn \g__color_alternative_values_prop {#1} {#3}
    \__color_backend_separation_init:nnnnn {#2} { /DeviceGray } { } { 0 } {#3}
  }
\cs_new_protected:Npn \__color_model_convert:nnn #1#2#3
  {
    \cs_new:cpx { __color_convert_ #1 _ #3 :w } ##1 ~ ##2 \s__color_stop
      {
        \exp_not:N \exp_args:NNe \exp_not:N \use:nn
        \exp_not:c { __color_convert_  #2 _ #3 :w }
          { \exp_not:c { __color_convert_ #1 _ #2 :w } ##1 ~ ##2 \s__color_stop }
          \c_space_tl \exp_not:N \s__color_stop
      }
  }
\cs_new_protected:Npn \__color_model_separation_CIELAB:nnnnnn #1#2#3#4#5#6
  {
    \prop_get:NnNF \l__color_internal_prop { illuminant }
      \l__color_internal_tl
      {
        \__kernel_msg_error:nnn { color }
          { CIELAB-requires-illuminant } {#1}
        \tl_set:Nn \l__color_internal_tl { d50 }
      }
    \exp_args:NV \__color_model_separation_CIELAB:nnnnnnn
      \l__color_internal_tl {#1} {#2} {#3} {#4} {#5} {#6}
  }
\cs_new_protected:Npn \__color_model_separation_CIELAB:nnnnnnn #1#2#3#4#5#6#7
  {
    \tl_if_exist:cTF { c__color_model_whitepoint_CIELAB_ #1 _tl }
      {
        \__color_backend_separation_init_CIELAB:nnn {#1} {#3} { #4 ~ #5 ~ #6 }
        \cs_new:cpn { __color_convert_ #2 _cmyk:w } ##1 ~ ##2 \s__color_stop
          { 0 ~ 0 ~ 0 ~ 1 }
        \cs_new:cpn { __color_convert_ #2 _rgb:w } ##1 ~ ##2 \s__color_stop
          { 1 ~ 1 ~ 1 }
        \cs_new:cpn { __color_convert_ #2 _gray:w } ##1 ~ ##2 \s__color_stop
          { 1 }
      }
      {
        \__kernel_msg_error:nnn { color }
          { unknown-CIELAB-illuminant } {#1}
      }
  }
\cs_new_protected:Npn \__color_model_devicen:n #1
  {
    \prop_get:NnNTF \l__color_internal_prop { names }
      \l__color_internal_tl
      {
        \exp_args:NV \__color_model_devicen:nn
          \l__color_internal_tl {#1}
      }
      {
        \__kernel_msg_error:nnn { color }
          { DeviceN-requires-names } {#1}
      }
  }
\cs_new_protected:Npn \__color_model_devicen:nn #1#2
  {
    \tl_clear:N \l__color_model_tl
    \clist_map_inline:nn {#1}
      {
        \prop_get:NnNTF \g__color_alternative_model_prop {##1}
          \l__color_internal_tl
          {
            \tl_if_empty:NTF \l__color_model_tl
              { \tl_set_eq:NN \l__color_model_tl \l__color_internal_tl }
              {
                \str_if_eq:VVF \l__color_model_tl \l__color_internal_tl
                  {
                    \__kernel_msg_error:nnn { color }
                      { DeviceN-inconsistent-alternative }
                      {#2}
                    \clist_map_break:n { \use_none:nnnn }
                  }
               }
          }
          {
            \str_if_eq:nnF {##1} { none }
              {
                \__kernel_msg_error:nnn { color }
                  { DeviceN-no-alternative }
                  {#2}
              }
          }
      }
    \tl_if_empty:NTF \l__color_model_tl
      {
        \__kernel_msg_error:nnn { color }
          { DeviceN-no-alternative } {#2}
      }
      { \exp_args:NV \__color_model_devicen:nnn \l__color_model_tl {#1} {#2} }
  }
\cs_new_protected:Npn \__color_model_devicen:nnn #1#2#3
  {
    \exp_args:Nx \__color_model_devicen:nnnn
      { \clist_count:n {#2} } {#1} {#2} {#3}
  }
\cs_new_protected:Npn \__color_model_devicen:nnnn #1#2#3#4
  {
    \int_gincr:N \g__color_model_int
    \tl_const:cx { c__color_fallback_ #4 _tl }
      { \prg_replicate:nn {#1} { 1 ~ } }
    \cs_if_exist_use:cF { __color_model_devicen_parse_ #1 :nn }
      { \__color_model_devicen_parse_generic:nn }
        {#4} {#1}
    \clist_map_inline:nn { fill , stroke , select }
      {
        \cs_new_protected:cpx { __color_backend_ ##1 _ #4 :n } ####1
          {
            \exp_not:c { __color_backend_ ##1 _ devicen:nn }
              { color \int_use:N \g__color_model_int } {####1}
          }
      }
    \cs_new_protected:cpx { __color_model_ #4 _white: }
      {
        \prop_put:Nnn \exp_not:N \l__color_named_white_prop {#4}
          { \prg_replicate:nn {#1} { 0 ~ } }
        \exp_not:N \int_compare:nNnF { \tex_currentgrouplevel:D } = 0
          { \group_insert_after:N \exp_not:c { __color_model_ #4 _ white: } }
      }
    \use:c { __color_model_ #4 _white: }
    \__color_model_devicen_init:nnn {#1} {#2} {#3}
    \__color_model_devicen_convert:nnn {#4} {#2} {#3}
  }
\cs_new_protected:cpn { __color_model_devicen_parse_1:nn } #1#2
  {
    \cs_new:cpn { __color_parse_model_ #1 :w  } ##1 , ##2 \s__color_stop
      { {#1} { \__color_parse_number:n {##1} } }
    \cs_new_eq:cN { __color_parse_mix_ #1 :nw  } \__color_parse_mix_gray:nw
  }
\cs_new_protected:cpn { __color_model_devicen_parse_2:nn } #1#2
  {
    \cs_new:cpn { __color_parse_model_ #1 :w  } ##1 , ##2 , ##3 \s__color_stop
      { {#1} { \__color_parse_number:n {##1} ~ \__color_parse_number:n {##2} } }
    \cs_new:cpn { __color_parse_mix_ #1 :nw }
      ##1##2 ~ ##3 \s__color_mark ##4 ~ ##5 \s__color_stop
      {
        \fp_eval:n { ##2 * ##1 + ##4 * ( 1 - ##1 ) } \c_space_tl
        \fp_eval:n { ##3 * ##1 + ##5 * ( 1 - ##1 ) }
      }
  }
\cs_new_protected:cpn { __color_model_devicen_parse_3:nn } #1#2
  {
    \cs_new:cpn { __color_parse_model_ #1 :w  } ##1 , ##2 , ##3 , ##4 \s__color_stop
      {
        {#1}
        {
          \__color_parse_number:n {##1} ~
          \__color_parse_number:n {##2} ~
          \__color_parse_number:n {##3}
        }
      }
    \cs_new_eq:cN { __color_parse_mix_ #1 :nw  } \__color_parse_mix_rgb:nw
  }
\cs_new_protected:cpn { __color_model_devicen_parse_4:nn } #1#2
  {
    \cs_new:cpn { __color_parse_model_ #1 :w  }
      ##1 , ##2 , ##3 , ##4 , ##5 \s__color_stop
      {
        {#1}
        {
          \__color_parse_number:n {##1} ~
          \__color_parse_number:n {##2} ~
          \__color_parse_number:n {##3} ~
          \__color_parse_number:n {##4}
        }
      }
  \cs_new_eq:cN { __color_parse_mix_ #1 :nw } \__color_parse_mix_cmyk:nw
  }
\cs_new_protected:Npn \__color_model_devicen_parse_generic:nn #1#2
  {
    \cs_new:cpn { __color_parse_model_ #1 :w  } ##1 , ##2 \s__color_stop
      {
        {#1}
        { \__color_model_devicen_parse:nw {#2} ##1 , ##2 , \q_nil , \s__color_stop }
      }
    \cs_new:cpx { __color_parse_mix_ #1 :nw }
      ##1 ##2 \s__color_mark ##3 \s__color_stop
      {
        \exp_not:N \__color_model_devicen_mix:nw {##1}
          ##2 \c_space_tl \exp_not:N \q_nil \c_space_tl \exp_not:N \s__color_mark
          ##3 \c_space_tl \exp_not:N \q_nil \c_space_tl \exp_not:N \s__color_stop
      }
  }
\cs_new:Npn \__color_model_devicen_parse:nw #1#2 , #3 \s__color_stop
  {
    \int_compare:nNnT {#1} > 0
      {
        \quark_if_nil:nTF {#2}
          { \prg_replicate:nn {#1} { 0 ~ } }
          {
            \__color_parse_number:n {#2}
            \int_compare:nNnT {#1} > 1 { ~ }
            \exp_args:Nf \__color_model_devicen_parse:nw
              { \int_eval:n { #1 - 1 } } #3 \s__color_stop
          }
      }
  }
\cs_new:Npn \__color_model_devicen_mix:nw #1#2 ~ #3 \s__color_mark #4 ~ #5 \s__color_stop
  {
    \fp_eval:n { #2 * #1 + #4 * ( 1 - #1 ) }
    \quark_if_nil:oF { \tl_head:w #3 \q_stop }
      {
        \c_space_tl
        \__color_model_devicen_mix:nw {#1} #3 \s__color_mark #5 \s__color_stop
      }
  }
\cs_new_protected:Npn \__color_model_devicen_init:nnn #1#2#3
  {
    \exp_args:Ne \__color_model_devicen_init:nnnn
      {
        \str_case:nn {#2}
          {
            { cmyk } { 4 }
            { gray } { 1 }
            { rgb }  { 3 }
          }
      }
      {#1} {#2} {#3}
  }
\cs_new_protected:Npn \__color_model_devicen_init:nnnn #1#2#3#4
  {
    \tl_set:Nx \l__color_internal_tl
      { \prg_replicate:nn {#1} { 1.0 ~ }   }
    \int_zero:N \l__color_internal_int
    \clist_map_inline:nn {#4}
      {
        \int_incr:N \l__color_internal_int
        \prop_get:NnN \g__color_alternative_values_prop {##1}
          \l__color_value_tl
        \exp_after:wN \__color_model_devicen_transform:w
          \l__color_value_tl , 0 , 0 , 0 \s__color_stop {#1} {#2}
      }
    \tl_put_right:Nx \l__color_internal_tl
      {
        \prg_replicate:nn {#1}
          { neg ~ 1.0 ~ add ~ #1 ~ -1 ~ roll ~ }
        \int_eval:n { #2 + 4 } ~ 4 ~ roll
        \prg_replicate:nn {#2} { ~ pop }
      }
    \use:x
      {
        \__color_backend_devicen_init:nnn
          {
            \clist_map_function:nN {#4}
              \__color_model_devicen_colorant:n
          }
          {
            \str_case:nn {#3}
              {
                { cmyk } { /DeviceCMYK }
                { gray } { /DeviceGray }
                { rgb }  { /DeviceRGB }
              }
          }
          { \exp_not:V \l__color_internal_tl }
      }
  }
\cs_new_protected:Npn \__color_model_devicen_transform:w
  #1 , #2 , #3 , #4 , #5 \s__color_stop #6#7
  {
    \use:c { __color_model_devicen_transform_ #6 :nnnnn }
      {#1} {#2} {#3} {#4} {#7}
  }
\cs_new_protected:cpn { __color_model_devicen_transform_1:nnnnn } #1#2#3#4#5
  { \__color_model_devicen_transform:nnn {#5} { 1 } {#1} }
\cs_new_protected:cpn { __color_model_devicen_transform_3:nnnnn } #1#2#3#4#5
  {
    \clist_map_inline { #1 , #2 , #3 }
      { \__color_model_devicen_transform:nnn {#5} { 3 } {##1} }
  }
\cs_new_protected:cpn { __color_model_devicen_transform_4:nnnnn } #1#2#3#4#5
  {
    \clist_map_inline:nn { #1 , #2 , #3 , #4 }
      { \__color_model_devicen_transform:nnn {#5} { 4 } {##1} }
  }
\cs_new_protected:Npn \__color_model_devicen_transform:nnn #1#2#3
  {
    \tl_put_right:Nx \l__color_internal_tl
      {
        \fp_compare:nNnF {#3} = \c_zero_fp
          {
            \int_eval:n { #1 - \l__color_internal_int + #2 } ~ index ~
              #3 ~ neg ~ mul ~ 1.0 ~ add ~ mul ~
          }
        #2 ~ -1 ~ roll ~
      }
  }
\cs_new:Npn \__color_model_devicen_colorant:n #1
  {
    / \prop_item:Nn \g__color_colorants_prop {#1} ~
  }
\cs_new_protected:Npn \__color_model_devicen_convert:nnn #1#2#3
  {
    \use:c { __color_model_devicen_convert_ #2 :nn } {#1} {#3}
  }
\cs_new_protected:Npn \__color_model_devicen_convert_cmyk:nn #1#2
  {
    \__color_model_convert:nnn {#1} { cmyk } { gray }
    \__color_model_convert:nnn {#1} { cmyk } { rgb }
    \__color_model_devicen_convert:nnnn {#1} { cmyk } { 4 } {#2}
  }
\cs_new_protected:Npn \__color_model_devicen_convert_gray:nn #1#2
  {
    \__color_model_convert:nnn {#1} { gray } { cmyk }
    \__color_model_convert:nnn {#1} { gray } { rgb }
    \__color_model_devicen_convert:nnnn {#1} { gray } { 1 } {#2}
  }
\cs_new_protected:Npn \__color_model_devicen_convert_rgb:nn #1#2
  {
    \__color_model_convert:nnn {#1} { rgb } { cmyk }
    \__color_model_convert:nnn {#1} { rgb } { gray }
    \__color_model_devicen_convert:nnnn {#1} { rgb } { 3 } {#2}
  }
\cs_new_protected:Npn \__color_model_devicen_convert:nnnn #1#2#3#4
  {
    \cs_new:cpx { __color_convert_ #1 _ #2 :w } ##1 \s__color_stop
      {
        \exp_not:c { __color_convert_devicen_ #2 : \prg_replicate:nn {#3} { n } w }
          \prg_replicate:nn {#3} { { 1 } }
          ##1 \exp_not:N \s__color_mark
          \clist_map_function:nN {#4} \__color_model_devicen_convert:n
          \exp_not:N \s__color_stop
      }
  }
\cs_new:Npn \__color_model_devicen_convert:n #1
  {
    {
      \exp_args:Ne \__color_model_devicen_convert_aux:n
        { \prop_item:Nn \g__color_alternative_values_prop {#1} }
    }
  }
\cs_new:Npn \__color_model_devicen_convert_aux:n #1
  { \__color_model_devicen_convert_aux:w #1 , , , , \s__color_stop }
\cs_new:Npn \__color_model_devicen_convert_aux:w #1 , #2 , #3 , #4 , #5 \s__color_stop
  {
    {#1}
    \tl_if_blank:nF {#2}
      {
        {#2}
        \tl_if_blank:nF {#3}
          {
            {#3}
            \tl_if_blank:nF {#4} { {#4} }
          }
      }
  }
\cs_new:Npn \__color_convert_devicen_cmyk:nnnnw
  #1#2#3#4#5 ~ #6 \s__color_mark #7#8 \s__color_stop
  {
    \__color_convert_devicen_cmyk:nnnnnnnnn {#5} {#1} {#2} {#3} {#4} #7
      #6 \s__color_mark #8 \s__color_stop
  }
\cs_new:Npn \__color_convert_devicen_cmyk:nnnnnnnnn #1#2#3#4#5#6#7#8#9
  {
    \use:e
      {
        \exp_not:N \__color_convert_devicen_cmyk_aux:nnnnw
          { \fp_eval:n { #2 * (1 - (#1 * #6)) } }
          { \fp_eval:n { #3 * (1 - (#1 * #7)) } }
          { \fp_eval:n { #4 * (1 - (#1 * #8)) } }
          { \fp_eval:n { #5 * (1 - (#1 * #9)) } }
      }
  }
\cs_new:Npn \__color_convert_devicen_cmyk_aux:nnnnw
  #1#2#3#4 #5 \s__color_mark #6 \s__color_stop
  {
    \tl_if_blank:nTF {#5}
      {
        \fp_eval:n { 1 - #1 } ~
        \fp_eval:n { 1 - #2 } ~
        \fp_eval:n { 1 - #3 } ~
        \fp_eval:n { 1 - #4 }
      }
      {
        \__color_convert_devicen_cmyk:nnnnw {#1} {#2} {#3} {#4}
          #5 \s__color_mark #6 \s__color_stop
      }
  }
\cs_new:Npn \__color_convert_devicen_gray:nw
  #1#2 ~ #3 \s__color_mark #4#5 \s__color_stop
  {
    \__color_convert_devicen_gray:nnn {#2} {#1} #4
      #3 \s__color_mark #5 \s__color_stop
  }
\cs_new:Npn \__color_convert_devicen_gray:nnn #1#2#3
  {
    \exp_arsgs:Ne \__color_convert_devicen_gray_aux:nw
      { \fp_eval:n { #2 * (1 - (#1 * #3)) } }
  }
\cs_new:Npn \__color_convert_devicen_gray_aux:nw
  #1 #2 \s__color_mark #3 \s__color_stop
  {
    \tl_if_blank:nTF {#2}
      { \fp_eval:n { 1 - #1 } }
      {
        \__color_convert_devicen_gray:nw {#1}
          #2 \s__color_mark #3 \s__color_stop
      }
  }
\cs_new:Npn \__color_convert_devicen_rgb:nnnw
  #1#2#3#4 ~ #5 \s__color_mark #6#7 \s__color_stop
  {
    \__color_convert_devicen_cmyk:nnnnnn {#4} {#1} {#2} {#3} #6
      #5 \s__color_mark #7 \s__color_stop
  }
\cs_new:Npn \__color_convert_devicen_rgb:nnnnnnn #1#2#3#4#5#6#7
  {
    \use:e
      {
        \exp_not:N \__color_convert_devicen_rgb_aux:nnnw
          { \fp_eval:n { #2 * (1 - (#1 * #5)) } }
          { \fp_eval:n { #3 * (1 - (#1 * #6)) } }
          { \fp_eval:n { #4 * (1 - (#1 * #7)) } }
      }
  }
\cs_new:Npn \__color_convert_devicen_rgb_aux:nnnw
  #1#2#3 #4 \s__color_mark #5 \s__color_stop
  {
    \tl_if_blank:nTF {#4}
      {
        \fp_eval:n { 1 - #1 } ~
        \fp_eval:n { 1 - #2 } ~
        \fp_eval:n { 1 - #3 }
      }
      {
        \__color_convert_devicen_rgb:nnnw {#1} {#2} {#3}
          #4 \s__color_mark #5 \s__color_stop
      }
  }
\cs_new_protected:Npn \color_show:n #1
  {
    \msg_show:nnxxxx { LaTeX / color } { show }
      {#1}
      {
        \__color_if_defined:nT {#1}
          {
            \exp_args:Nv \__color_show:n { l__color_named_ #1 _tl }
            \prop_map_function:cN
              { l__color_named_ #1 _prop }
              \msg_show_item_unbraced:nn
          }
      }
      { }
      { }
  }
\cs_new:Npn \__color_show:n #1
  {
    \msg_show_item_unbraced:nn { model } {#1}
  }
\__kernel_msg_new:nnnn { color } { CIELAB-requires-illuminant }
  { CIELAB~color~space~'#1'~require~an~illuminant. }
  {
    LaTeX~has~been~asked~to~create~a~separation~color~space~using~
    CIELAB~specifications,~but~no~\\ \\
    \iow_indent:n { illuminant~=~<basis> }
    \\ \\
    key~was~given~with~the~correct~information.~LaTeX~will~use~illuminant~
    'd50'~for~recovery.
  }
\__kernel_msg_new:nnnn { color } { conversion-not-available }
  { No~model~conversion~available~from~'#1'~to~'#2'. }
  {
    LaTeX~has~been~asked~to~convert~a~color~from~model~'#1'~
    to~model'#2',~but~there~is~no~method~available~to~do~that.
  }
\__kernel_msg_new:nnnn { color } { DeviceN-inconsistent-alternative }
  { DeviceN~color~spaces~require~a~single~alternative~space. }
  {
    LaTeX~has~been~asked~to~create~a~DeviceN~color~space~'#1',~
    but~the~constituent~colors~do~not~have~a~common~alternative~
    color.
  }
\__kernel_msg_new:nnnn { color } { DeviceN-no-alternative }
  { DeviceN~color~spaces~require~an~alternative~space. }
  {
    LaTeX~has~been~asked~to~create~a~DeviceN~color~space~'#1',~
    but~the~constituent~colors~do~not~all~have~a~device-based~alternative.
  }
\__kernel_msg_new:nnnn { color } { DeviceN-requires-names }
  { DeviceN~color~space~'#1'~require~a~list~of~names. }
  {
    LaTeX~has~been~asked~to~create~a~DeviceN~color~space,~
    but~no~\\ \\
    \iow_indent:n { names~=~<names> }
    \\ \\
    key~was~given~with~the~correct~information.
  }
\__kernel_msg_new:nnnn { color } { model-already-defined }
  { Color~model~'#1'~already~defined. }
  {
    LaTeX~was~asked~to~define~a~new~color~model~called~'#1',~but~
    this~color~model~already~exists.
  }
\__kernel_msg_new:nnnn { color } { separation-alternative-model }
  { Separation~color~space~'#1'~require~an~alternative~model. }
  {
    LaTeX~has~been~asked~to~create~a~separation~color~space,~
    but~no~\\ \\
    \iow_indent:n { alternative-model~=~<model> }
    \\ \\
    key~was~given~with~the~correct~information.
  }
\__kernel_msg_new:nnnn { color } { separation-alternative-values }
  { Separation~color~space~'#1'~require~values~for~the~alternative~space. }
  {
    LaTeX~has~been~asked~to~create~a~separation~color~space,~
    but~no~\\ \\
    \iow_indent:n { alternative-values~=~<model> }
    \\ \\
    key~was~given~with~the~correct~information.
  }
\__kernel_msg_new:nnnn { color } { separation-requires-name }
  { Separation~color~space~'#1'~require~a~formal~name. }
  {
    LaTeX~has~been~asked~to~create~a~separation~color~space,~
    but~no~\\ \\
    \iow_indent:n { name~=~<formal~name> }
    \\ \\
    key~was~given~with~the~correct~information.
  }
\__kernel_msg_new:nnnn { color } { unknown-color }
  { Unknown~color~'#1'. }
  {
    LaTeX~has~been~asked~to~use~a~color~named~'#1',~
    but~this~has~never~been~defined.
  }
\__kernel_msg_new:nnnn { color } { unknown-alternative-model }
  { Separation~color~space~'#1'~require~an~valid~alternative~space. }
  {
    LaTeX~has~been~asked~to~create~a~separation~color~space,~
    but~the~model~given~as\\ \\
    \iow_indent:n { alternative-model~=~<model> }
    \\ \\
    is~unknown.
  }
\__kernel_msg_new:nnnn { color } { unknown-export-format }
  { Unknown~export~format~'#1'. }
  {
    LaTeX~has~been~asked~to~export~a~color~in~format~'#1',~
    but~this~has~never~been~defined.
  }
\__kernel_msg_new:nnnn { color } { unknown-CIELAB-illuminant }
  { Unknown~illuminant~model~'#1'. }
  {
    LaTeX~has~been~asked~to~use~create~a~color~space~using~CIELAB~
    illuminant~'#1',~but~this~does~not~exist.
  }
\__kernel_msg_new:nnnn { color } { unknown-model }
  { Unknown~color~model~'#1'. }
  {
    LaTeX~has~been~asked~to~use~a~color~model~called~'#1',~
    but~this~model~is~not~set~up.
  }
\__kernel_msg_new:nnnn { color } { unknown-model-type }
  { Unknown~color~model~type~'#1'. }
  {
    LaTeX~has~been~asked~to~create~a~new~color~model~called~'#1',~
    but~this~type~of~model~was~never~set~up.
  }
\__kernel_msg_new:nnn { color } { show }
  {
    The~color~#1~
    \tl_if_empty:nTF {#2}
      { is~undefined. }
      { has~the~properties: #2 }
  }
%% File: l3pdf.dtx
\scan_new:N \s__pdf_stop
\bool_new:N \g__pdf_init_bool
\bool_lazy_and:nnT
  { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
  { \tl_if_exist_p:N \@expl@finalise@setup@@ }
  {
    \tl_gput_right:Nn \@expl@finalise@setup@@
      {
        \tl_gput_right:Nn \@kernel@after@begindocument
          { \bool_gset_true:N \g__pdf_init_bool }
      }
  }
\cs_new_protected:Npn \pdf_uncompress:
  {
    \bool_if:NF \g__pdf_init_bool
      {
        \__pdf_backend_compresslevel:n { 0 }
        \__pdf_backend_compress_objects:n { \c_false_bool }
      }
  }
\cs_new_protected:Npn \pdf_object_new:nn #1#2
  { \__pdf_backend_object_new:nn {#1} {#2} }
\prg_new_conditional:Npnn \pdf_object_if_exist:n #1 { p , T , F , TF }
  {
    \int_if_exist:cTF { c__pdf_backend_object_ \tl_to_str:n {#1} _int }
     { \prg_return_true: }
     { \prg_return_false:}
  }
\cs_new_protected:Npn \pdf_object_write:nn #1#2
  {
    \__pdf_backend_object_write:nn {#1} {#2}
    \bool_gset_true:N \g__pdf_init_bool
  }
\cs_generate_variant:Nn \pdf_object_write:nn { nx }
\cs_new:Npn \pdf_object_ref:n #1 { \__pdf_backend_object_ref:n {#1} }
\cs_new_protected:Npn \pdf_object_unnamed_write:nn #1#2
  {
    \__pdf_backend_object_now:nn {#1} {#2}
    \bool_gset_true:N \g__pdf_init_bool
  }
\cs_generate_variant:Nn \pdf_object_unnamed_write:nn { nx }
\cs_new:Npn \pdf_object_ref_last: { \__pdf_backend_object_last: }
\cs_new:Npn \pdf_pageobject_ref:n #1
  { \__pdf_backend_pageobject_ref:n {#1} }
\prg_new_conditional:Npnn \pdf_version_compare:Nn #1#2 { p , T , F , TF }
  { \use:c { __pdf_version_compare_ #1 :w } #2 . . \s__pdf_stop }
\cs_new:cpn { __pdf_version_compare_=:w } #1 . #2 . #3 \s__pdf_stop
 {
   \bool_lazy_and:nnTF
    { \int_compare_p:nNn \__pdf_backend_version_major: = {#1} }
    { \int_compare_p:nNn \__pdf_backend_version_minor: = {#2} }
    { \prg_return_true: }
    { \prg_return_false: }
 }
\cs_new:cpn { __pdf_version_compare_<:w } #1 . #2 . #3 \s__pdf_stop
 {
   \bool_lazy_or:nnTF
    { \int_compare_p:nNn \__pdf_backend_version_major: < {#1} }
    {
      \bool_lazy_and_p:nn
        { \int_compare_p:nNn \__pdf_backend_version_major: = {#1} }
        { \int_compare_p:nNn \__pdf_backend_version_minor: < {#2} }
    }
    { \prg_return_true: }
    { \prg_return_false: }
 }
\cs_new:cpn { __pdf_version_compare_>:w } #1 . #2 . #3 \s__pdf_stop
 {
   \bool_lazy_or:nnTF
    { \int_compare_p:nNn \__pdf_backend_version_major: > {#1} }
    {
      \bool_lazy_and_p:nn
        { \int_compare_p:nNn \__pdf_backend_version_major: = {#1} }
        { \int_compare_p:nNn \__pdf_backend_version_minor: > {#2} }
    }
    { \prg_return_true: }
    { \prg_return_false: }
 }
\cs_new_protected:Npn \pdf_version_gset:n #1
  { \__pdf_version_gset:w  #1 . . \s__pdf_stop }
\cs_new_protected:Npn \pdf_version_min_gset:n #1
  {
    \pdf_version_compare:NnT < {#1}
      { \__pdf_version_gset:w  #1 . . \s__pdf_stop }
  }
\cs_new_protected:Npn \__pdf_version_gset:w  #1 . #2 . #3\s__pdf_stop
  {
    \bool_if:NF \g__pdf_init_bool
      {
        \__pdf_backend_version_major_gset:n {#1}
        \__pdf_backend_version_minor_gset:n {#2}
      }
  }
\cs_new:Npn \pdf_version:
  { \__pdf_backend_version_major: . \__pdf_backend_version_minor: }
\cs_new:Npn \pdf_version_major: { \__pdf_backend_version_major: }
\cs_new:Npn \pdf_version_minor: { \__pdf_backend_version_minor: }
\cs_new_protected:Npn \pdf_destination:nn #1#2
  { \__pdf_backend_destination:nn {#1} {#2} }
\cs_new_protected:Npn \pdf_destination:nnnn #1#2#3#4
  {
    \hbox_to_zero:n
      { \__pdf_backend_destination:nnnn {#1} {#2} {#3} {#4} }
  }
%% File: l3coffins.dtx
\box_new:N \l__coffin_internal_box
\dim_new:N \l__coffin_internal_dim
\tl_new:N  \l__coffin_internal_tl
\prop_const_from_keyval:Nn \c__coffin_corners_prop
  {
    tl = { 0pt } { 0pt } ,
    tr = { 0pt } { 0pt } ,
    bl = { 0pt } { 0pt } ,
    br = { 0pt } { 0pt } ,
  }
\prop_const_from_keyval:Nn \c__coffin_poles_prop
  {
    l  = { 0pt } { 0pt } { 0pt } { 1000pt } ,
    hc = { 0pt } { 0pt } { 0pt } { 1000pt } ,
    r  = { 0pt } { 0pt } { 0pt } { 1000pt } ,
    b  = { 0pt } { 0pt } { 1000pt } { 0pt } ,
    vc = { 0pt } { 0pt } { 1000pt } { 0pt } ,
    t  = { 0pt } { 0pt } { 1000pt } { 0pt } ,
    B  = { 0pt } { 0pt } { 1000pt } { 0pt } ,
    H  = { 0pt } { 0pt } { 1000pt } { 0pt } ,
    T  = { 0pt } { 0pt } { 1000pt } { 0pt } ,
  }
\fp_new:N \l__coffin_slope_A_fp
\fp_new:N \l__coffin_slope_B_fp
\bool_new:N \l__coffin_error_bool
\dim_new:N \l__coffin_offset_x_dim
\dim_new:N \l__coffin_offset_y_dim
\tl_new:N \l__coffin_pole_a_tl
\tl_new:N \l__coffin_pole_b_tl
\dim_new:N \l__coffin_x_dim
\dim_new:N \l__coffin_y_dim
\dim_new:N \l__coffin_x_prime_dim
\dim_new:N \l__coffin_y_prime_dim
\cs_new_eq:NN \__coffin_to_value:N \tex_number:D
\prg_new_conditional:Npnn \coffin_if_exist:N #1 { p , T , F , TF }
  {
    \cs_if_exist:NTF #1
      {
        \cs_if_exist:cTF { coffin ~ \__coffin_to_value:N #1 ~ poles }
          { \prg_return_true: }
          { \prg_return_false: }
      }
      { \prg_return_false: }
  }
\prg_generate_conditional_variant:Nnn \coffin_if_exist:N
  { c } { p , T , F , TF }
\cs_new_protected:Npn \__coffin_if_exist:NT #1#2
  {
    \coffin_if_exist:NTF #1
      { #2 }
      {
        \__kernel_msg_error:nnx { kernel } { unknown-coffin }
          { \token_to_str:N #1 }
      }
  }
\cs_new_protected:Npn \coffin_clear:N #1
  {
    \__coffin_if_exist:NT #1
      {
        \box_clear:N #1
        \__coffin_reset_structure:N #1
      }
  }
\cs_generate_variant:Nn \coffin_clear:N { c }
\cs_new_protected:Npn \coffin_gclear:N #1
  {
    \__coffin_if_exist:NT #1
      {
        \box_gclear:N #1
        \__coffin_greset_structure:N #1
      }
  }
\cs_generate_variant:Nn \coffin_gclear:N { c }
\cs_new_protected:Npn \coffin_new:N #1
  {
    \box_new:N #1
    \debug_suspend:
    \prop_gclear_new:c { coffin ~ \__coffin_to_value:N #1 ~ corners }
    \prop_gclear_new:c { coffin ~ \__coffin_to_value:N #1 ~ poles }
    \prop_gset_eq:cN { coffin ~ \__coffin_to_value:N #1 ~ corners }
      \c__coffin_corners_prop
    \prop_gset_eq:cN { coffin ~ \__coffin_to_value:N #1 ~ poles }
      \c__coffin_poles_prop
    \debug_resume:
  }
\cs_generate_variant:Nn \coffin_new:N { c }
\cs_new_protected:Npn \hcoffin_set:Nn #1#2
  {
    \__coffin_if_exist:NT #1
      {
        \hbox_set:Nn #1
          {
            \color_ensure_current:
            #2
          }
        \__coffin_update:N #1
      }
  }
\cs_generate_variant:Nn \hcoffin_set:Nn { c }
\cs_new_protected:Npn \hcoffin_gset:Nn #1#2
  {
    \__coffin_if_exist:NT #1
      {
        \hbox_gset:Nn #1
          {
            \color_ensure_current:
            #2
          }
        \__coffin_gupdate:N #1
      }
  }
\cs_generate_variant:Nn \hcoffin_gset:Nn { c }
\cs_new_protected:Npn \vcoffin_set:Nnn #1#2#3
  {
    \__coffin_set_vertical:NnnNN #1 {#2} {#3}
      \vbox_set:Nn \__coffin_update:N
  }
\cs_generate_variant:Nn \vcoffin_set:Nnn { c }
\cs_new_protected:Npn \vcoffin_gset:Nnn #1#2#3
  {
    \__coffin_set_vertical:NnnNN #1 {#2} {#3}
      \vbox_gset:Nn \__coffin_gupdate:N
  }
\cs_generate_variant:Nn \vcoffin_gset:Nnn { c }
\cs_new_protected:Npn \__coffin_set_vertical:NnnNN #1#2#3#4#5
  {
    \__coffin_if_exist:NT #1
      {
        #4 #1
          {
            \dim_set:Nn \tex_hsize:D {#2}
            \__coffin_set_vertical_aux:
            #3
          }
        #5 #1
        \vbox_set_top:Nn \l__coffin_internal_box { \vbox_unpack:N #1 }
        \__coffin_set_pole:Nnx #1 { T }
          {
            { 0pt }
            {
              \dim_eval:n
                { \box_ht:N #1 - \box_ht:N \l__coffin_internal_box }
            }
            { 1000pt }
            { 0pt }
          }
        \box_clear:N \l__coffin_internal_box
      }
  }
\cs_new_protected:Npx \__coffin_set_vertical_aux:
  {
    \bool_lazy_and:nnT
      { \cs_if_exist_p:N \fmtname }
      { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
      {
        \dim_set_eq:NN \exp_not:N \linewidth \tex_hsize:D
        \dim_set_eq:NN \exp_not:N \columnwidth \tex_hsize:D
      }
  }
\cs_new_protected:Npn \hcoffin_set:Nw #1
  {
    \__coffin_if_exist:NT #1
      {
        \hbox_set:Nw #1 \color_ensure_current:
          \cs_set_protected:Npn \hcoffin_set_end:
            {
              \hbox_set_end:
              \__coffin_update:N #1
            }
      }
  }
\cs_generate_variant:Nn \hcoffin_set:Nw { c }
\cs_new_protected:Npn \hcoffin_gset:Nw #1
  {
    \__coffin_if_exist:NT #1
      {
        \hbox_gset:Nw #1 \color_ensure_current:
          \cs_set_protected:Npn \hcoffin_gset_end:
            {
              \hbox_gset_end:
              \__coffin_gupdate:N #1
            }
      }
  }
\cs_generate_variant:Nn \hcoffin_gset:Nw { c }
\cs_new_protected:Npn \hcoffin_set_end: { }
\cs_new_protected:Npn \hcoffin_gset_end: { }
\cs_new_protected:Npn \vcoffin_set:Nnw #1#2
  {
    \__coffin_set_vertical:NnNNNNw #1 {#2} \vbox_set:Nw
      \vcoffin_set_end:
      \vbox_set_end: \__coffin_update:N
  }
\cs_generate_variant:Nn \vcoffin_set:Nnw { c }
\cs_new_protected:Npn \vcoffin_gset:Nnw #1#2
  {
    \__coffin_set_vertical:NnNNNNw #1 {#2} \vbox_gset:Nw
      \vcoffin_gset_end:
      \vbox_gset_end: \__coffin_gupdate:N
  }
\cs_generate_variant:Nn \vcoffin_gset:Nnw { c }
\cs_new_protected:Npn \__coffin_set_vertical:NnNNNNw #1#2#3#4#5#6
  {
    \__coffin_if_exist:NT #1
      {
        #3 #1
          \dim_set:Nn \tex_hsize:D {#2}
          \__coffin_set_vertical_aux:
          \cs_set_protected:Npn #4
            {
              #5
              #6 #1
              \vbox_set_top:Nn \l__coffin_internal_box { \vbox_unpack:N #1 }
              \__coffin_set_pole:Nnx #1 { T }
                {
                  { 0pt }
                  {
                    \dim_eval:n
                      { \box_ht:N #1 - \box_ht:N \l__coffin_internal_box }
                  }
                  { 1000pt }
                  { 0pt }
                }
              \box_clear:N \l__coffin_internal_box
            }
      }
  }
\cs_new_protected:Npn \vcoffin_set_end: { }
\cs_new_protected:Npn \vcoffin_gset_end: { }
\cs_new_protected:Npn \coffin_set_eq:NN #1#2
  {
    \__coffin_if_exist:NT #1
      {
        \box_set_eq:NN #1 #2
        \prop_set_eq:cc { coffin ~ \__coffin_to_value:N #1 ~ corners }
          { coffin ~ \__coffin_to_value:N #2 ~ corners }
         \prop_set_eq:cc { coffin ~ \__coffin_to_value:N #1 ~ poles }
          { coffin ~ \__coffin_to_value:N #2 ~ poles }
      }
  }
\cs_generate_variant:Nn \coffin_set_eq:NN { c , Nc , cc }
\cs_new_protected:Npn \coffin_gset_eq:NN #1#2
  {
    \__coffin_if_exist:NT #1
      {
        \box_gset_eq:NN #1 #2
        \prop_gset_eq:cc { coffin ~ \__coffin_to_value:N #1 ~ corners }
          { coffin ~ \__coffin_to_value:N #2 ~ corners }
         \prop_gset_eq:cc { coffin ~ \__coffin_to_value:N #1 ~ poles }
          { coffin ~ \__coffin_to_value:N #2 ~ poles }
      }
  }
\cs_generate_variant:Nn \coffin_gset_eq:NN { c , Nc , cc }
\coffin_new:N \c_empty_coffin
\coffin_new:N \l__coffin_aligned_coffin
\coffin_new:N \l__coffin_aligned_internal_coffin
\coffin_new:N \l_tmpa_coffin
\coffin_new:N \l_tmpb_coffin
\coffin_new:N \g_tmpa_coffin
\coffin_new:N \g_tmpb_coffin
\cs_new_eq:NN \coffin_dp:N \box_dp:N
\cs_new_eq:NN \coffin_dp:c \box_dp:c
\cs_new_eq:NN \coffin_ht:N \box_ht:N
\cs_new_eq:NN \coffin_ht:c \box_ht:c
\cs_new_eq:NN \coffin_wd:N \box_wd:N
\cs_new_eq:NN \coffin_wd:c \box_wd:c
\cs_new_protected:Npn \__coffin_get_pole:NnN #1#2#3
  {
    \prop_get:cnNF
      { coffin ~ \__coffin_to_value:N #1 ~ poles } {#2} #3
      {
        \__kernel_msg_error:nnxx { kernel } { unknown-coffin-pole }
          { \exp_not:n {#2} } { \token_to_str:N #1 }
        \tl_set:Nn #3 { { 0pt } { 0pt } { 0pt } { 0pt } }
      }
  }
\cs_new_protected:Npn \__coffin_reset_structure:N #1
  {
    \prop_set_eq:cN { coffin ~ \__coffin_to_value:N #1 ~ corners }
      \c__coffin_corners_prop
    \prop_set_eq:cN { coffin ~ \__coffin_to_value:N #1 ~ poles }
      \c__coffin_poles_prop
  }
\cs_new_protected:Npn \__coffin_greset_structure:N #1
  {
    \prop_gset_eq:cN { coffin ~ \__coffin_to_value:N #1 ~ corners }
      \c__coffin_corners_prop
    \prop_gset_eq:cN { coffin ~ \__coffin_to_value:N #1 ~ poles }
      \c__coffin_poles_prop
  }
\cs_new_protected:Npn \coffin_set_horizontal_pole:Nnn #1#2#3
  { \__coffin_set_horizontal_pole:NnnN #1 {#2} {#3} \prop_put:cnx }
\cs_generate_variant:Nn \coffin_set_horizontal_pole:Nnn { c }
\cs_new_protected:Npn \coffin_gset_horizontal_pole:Nnn #1#2#3
  { \__coffin_set_horizontal_pole:NnnN #1 {#2} {#3} \prop_gput:cnx }
\cs_generate_variant:Nn \coffin_gset_horizontal_pole:Nnn { c }
\cs_new_protected:Npn \__coffin_set_horizontal_pole:NnnN #1#2#3#4
  {
    \__coffin_if_exist:NT #1
      {
        #4 { coffin ~ \__coffin_to_value:N #1 ~ poles }
          {#2}
          {
            { 0pt } { \dim_eval:n {#3} }
            { 1000pt } { 0pt }
          }
      }
  }
\cs_new_protected:Npn \coffin_set_vertical_pole:Nnn #1#2#3
  { \__coffin_set_vertical_pole:NnnN #1 {#2} {#3} \prop_put:cnx }
\cs_generate_variant:Nn \coffin_set_vertical_pole:Nnn { c }
\cs_new_protected:Npn \coffin_gset_vertical_pole:Nnn #1#2#3
  { \__coffin_set_vertical_pole:NnnN #1 {#2} {#3} \prop_gput:cnx }
  \cs_generate_variant:Nn \coffin_gset_vertical_pole:Nnn { c }
\cs_new_protected:Npn \__coffin_set_vertical_pole:NnnN #1#2#3#4
  {
    \__coffin_if_exist:NT #1
      {
        #4 { coffin ~ \__coffin_to_value:N #1 ~ poles }
          {#2}
          {
            { \dim_eval:n {#3} } { 0pt }
            { 0pt } { 1000pt }
          }
      }
  }
\cs_new_protected:Npn \__coffin_set_pole:Nnn #1#2#3
  {
    \prop_put:cnn { coffin ~ \__coffin_to_value:N #1 ~ poles }
      {#2} {#3}
  }
\cs_generate_variant:Nn \__coffin_set_pole:Nnn { Nnx }
\cs_new_protected:Npn \__coffin_update:N #1
  {
    \__coffin_reset_structure:N #1
    \__coffin_update_corners:N #1
    \__coffin_update_poles:N #1
  }
\cs_new_protected:Npn \__coffin_gupdate:N #1
  {
    \__coffin_greset_structure:N #1
    \__coffin_gupdate_corners:N #1
    \__coffin_gupdate_poles:N #1
  }
\cs_new_protected:Npn \__coffin_update_corners:N #1
  { \__coffin_update_corners:NN #1 \prop_put:Nnx }
\cs_new_protected:Npn \__coffin_gupdate_corners:N #1
  { \__coffin_update_corners:NN #1 \prop_gput:Nnx }
\cs_new_protected:Npn \__coffin_update_corners:NN #1#2
  {
    \exp_args:Nc \__coffin_update_corners:NNN
      { coffin ~ \__coffin_to_value:N #1 ~ corners }
      #1 #2
  }
\cs_new_protected:Npn \__coffin_update_corners:NNN #1#2#3
  {
    #3 #1
      { tl }
      { { 0pt } { \dim_eval:n { \box_ht:N #2 } } }
    #3 #1
      { tr }
      {
        { \dim_eval:n { \box_wd:N #2 } }
        { \dim_eval:n { \box_ht:N #2 } }
      }
    #3 #1
      { bl }
      { { 0pt } { \dim_eval:n { -\box_dp:N #2 } } }
    #3 #1
      { br }
      {
        { \dim_eval:n { \box_wd:N #2 } }
        { \dim_eval:n { -\box_dp:N #2 } }
      }
  }
\cs_new_protected:Npn \__coffin_update_poles:N #1
  { \__coffin_update_poles:NN #1 \prop_put:Nnx }
\cs_new_protected:Npn \__coffin_gupdate_poles:N #1
  { \__coffin_update_poles:NN #1 \prop_gput:Nnx }
\cs_new_protected:Npn \__coffin_update_poles:NN #1#2
  {
    \exp_args:Nc \__coffin_update_poles:NNN
      { coffin ~ \__coffin_to_value:N #1 ~ poles }
      #1 #2
  }
\cs_new_protected:Npn \__coffin_update_poles:NNN #1#2#3
  {
    #3 #1 { hc }
      {
        { \dim_eval:n { 0.5 \box_wd:N #2 } }
        { 0pt } { 0pt } { 1000pt }
      }
    #3 #1 { r }
      {
        { \dim_eval:n { \box_wd:N #2 } }
        { 0pt } { 0pt } { 1000pt }
      }
    #3 #1 { vc }
      {
        { 0pt }
        { \dim_eval:n { ( \box_ht:N #2 - \box_dp:N #2 ) / 2 } }
        { 1000pt }
        { 0pt }
      }
    #3 #1 { t }
      {
        { 0pt }
        { \dim_eval:n { \box_ht:N #2 } }
        { 1000pt }
        { 0pt }
      }
    #3 #1 { b }
      {
        { 0pt }
        { \dim_eval:n { -\box_dp:N #2 } }
        { 1000pt }
        { 0pt }
      }
  }
\cs_new_protected:Npn \__coffin_calculate_intersection:Nnn #1#2#3
  {
    \__coffin_get_pole:NnN #1 {#2} \l__coffin_pole_a_tl
    \__coffin_get_pole:NnN #1 {#3} \l__coffin_pole_b_tl
    \bool_set_false:N \l__coffin_error_bool
    \exp_last_two_unbraced:Noo
      \__coffin_calculate_intersection:nnnnnnnn
        \l__coffin_pole_a_tl \l__coffin_pole_b_tl
    \bool_if:NT \l__coffin_error_bool
      {
        \__kernel_msg_error:nn { kernel } { no-pole-intersection }
        \dim_zero:N \l__coffin_x_dim
        \dim_zero:N \l__coffin_y_dim
      }
  }
\cs_new_protected:Npn \__coffin_calculate_intersection:nnnnnnnn
  #1#2#3#4#5#6#7#8
  {
    \dim_compare:nNnTF {#3} = \c_zero_dim
      {
        \dim_set:Nn \l__coffin_x_dim {#1}
        \dim_compare:nNnTF {#7} = \c_zero_dim
          { \bool_set_true:N \l__coffin_error_bool }
          {
            \dim_set:Nn \l__coffin_y_dim
              {
                \dim_compare:nNnTF {#8} = \c_zero_dim
                  {#6}
                  {
                    \fp_to_dim:n
                      {
                          ( \dim_to_fp:n {#8} / \dim_to_fp:n {#7} )
                        * ( \dim_to_fp:n {#1} - \dim_to_fp:n {#5} )
                        + \dim_to_fp:n {#6}
                      }
                  }
              }
          }
      }
      {
        \dim_compare:nNnTF {#4} = \c_zero_dim
          {
            \dim_set:Nn \l__coffin_y_dim {#2}
            \dim_compare:nNnTF {#8} = { \c_zero_dim }
              { \bool_set_true:N \l__coffin_error_bool }
              {
                \dim_set:Nn \l__coffin_x_dim
                  {
                    \dim_compare:nNnTF {#7} = \c_zero_dim
                      {#5}
                      {
                        \fp_to_dim:n
                          {
                              ( \dim_to_fp:n {#7} / \dim_to_fp:n {#8} )
                            * ( \dim_to_fp:n {#4} - \dim_to_fp:n {#6} )
                             + \dim_to_fp:n {#5}
                          }
                      }
                  }
              }
          }
          {
            \use:x
              {
                \__coffin_calculate_intersection:nnnnnn
                  { \dim_to_fp:n {#4} / \dim_to_fp:n {#3} }
                  { \dim_to_fp:n {#8} / \dim_to_fp:n {#7} }
              }
                {#1} {#2} {#5} {#6}
          }
      }
  }
\cs_set_protected:Npn \__coffin_calculate_intersection:nnnnnn #1#2#3#4#5#6
  {
    \fp_compare:nNnTF {#1} = {#2}
      { \bool_set_true:N \l__coffin_error_bool }
      {
        \dim_set:Nn \l__coffin_x_dim
          {
            \fp_to_dim:n
              {
                (
                    #1 * \dim_to_fp:n {#3}
                  - #2 * \dim_to_fp:n {#5}
                  - \dim_to_fp:n {#4}
                  + \dim_to_fp:n {#6}
                )
                /
                ( #1 - #2 )
              }
          }
        \dim_set:Nn \l__coffin_y_dim
          {
            \fp_to_dim:n
              {
                  #1 * ( \l__coffin_x_dim - \dim_to_fp:n {#3} )
                + \dim_to_fp:n {#4}
              }
          }
      }
  }
\fp_new:N \l__coffin_sin_fp
\fp_new:N \l__coffin_cos_fp
\prop_new:N \l__coffin_bounding_prop
\prop_new:N \l__coffin_corners_prop
\prop_new:N \l__coffin_poles_prop
\dim_new:N \l__coffin_bounding_shift_dim
\dim_new:N \l__coffin_left_corner_dim
\dim_new:N \l__coffin_right_corner_dim
\dim_new:N \l__coffin_bottom_corner_dim
\dim_new:N \l__coffin_top_corner_dim
\cs_new_protected:Npn \coffin_rotate:Nn #1#2
  { \__coffin_rotate:NnNNN #1 {#2} \box_rotate:Nn \prop_set_eq:cN \hbox_set:Nn }
\cs_generate_variant:Nn \coffin_rotate:Nn { c }
\cs_new_protected:Npn \coffin_grotate:Nn #1#2
  { \__coffin_rotate:NnNNN #1 {#2} \box_grotate:Nn \prop_gset_eq:cN \hbox_gset:Nn }
\cs_generate_variant:Nn \coffin_grotate:Nn { c }
\cs_new_protected:Npn \__coffin_rotate:NnNNN #1#2#3#4#5
  {
    \fp_set:Nn \l__coffin_sin_fp { sind ( #2 ) }
    \fp_set:Nn \l__coffin_cos_fp { cosd ( #2 ) }
    \prop_set_eq:Nc \l__coffin_corners_prop
      { coffin ~ \__coffin_to_value:N #1 ~ corners }
    \prop_set_eq:Nc \l__coffin_poles_prop
      { coffin ~ \__coffin_to_value:N #1 ~ poles }
    \prop_map_inline:Nn \l__coffin_corners_prop
      { \__coffin_rotate_corner:Nnnn #1 {##1} ##2 }
    \prop_map_inline:Nn \l__coffin_poles_prop
      { \__coffin_rotate_pole:Nnnnnn #1 {##1} ##2 }
    \__coffin_set_bounding:N #1
    \prop_map_inline:Nn \l__coffin_bounding_prop
      { \__coffin_rotate_bounding:nnn {##1} ##2 }
    \__coffin_find_corner_maxima:N #1
    \__coffin_find_bounding_shift:
    #3 #1 {#2}
    \hbox_set:Nn \l__coffin_internal_box
      {
        \__kernel_kern:n
            { \l__coffin_bounding_shift_dim - \l__coffin_left_corner_dim }
        \box_move_down:nn { \l__coffin_bottom_corner_dim }
          { \box_use:N #1 }
      }
    \box_set_ht:Nn \l__coffin_internal_box
      { \l__coffin_top_corner_dim - \l__coffin_bottom_corner_dim }
    \box_set_dp:Nn \l__coffin_internal_box { 0pt }
    \box_set_wd:Nn \l__coffin_internal_box
      { \l__coffin_right_corner_dim - \l__coffin_left_corner_dim }
    #5 #1 { \box_use_drop:N \l__coffin_internal_box }
    \prop_map_inline:Nn \l__coffin_corners_prop
      { \__coffin_shift_corner:Nnnn #1 {##1} ##2 }
    \prop_map_inline:Nn \l__coffin_poles_prop
      { \__coffin_shift_pole:Nnnnnn #1 {##1} ##2 }
    #4 { coffin ~ \__coffin_to_value:N #1 ~ corners }
      \l__coffin_corners_prop
    #4 { coffin ~ \__coffin_to_value:N #1 ~ poles }
      \l__coffin_poles_prop
  }
\cs_new_protected:Npn \__coffin_set_bounding:N #1
  {
    \prop_put:Nnx \l__coffin_bounding_prop { tl }
      { { 0pt } { \dim_eval:n { \box_ht:N #1 } } }
    \prop_put:Nnx \l__coffin_bounding_prop { tr }
      {
        { \dim_eval:n { \box_wd:N #1 } }
        { \dim_eval:n { \box_ht:N #1 } }
      }
    \dim_set:Nn \l__coffin_internal_dim { -\box_dp:N #1 }
    \prop_put:Nnx \l__coffin_bounding_prop { bl }
      { { 0pt } { \dim_use:N \l__coffin_internal_dim } }
    \prop_put:Nnx \l__coffin_bounding_prop { br }
      {
        { \dim_eval:n { \box_wd:N #1 } }
        { \dim_use:N \l__coffin_internal_dim }
      }
  }
\cs_new_protected:Npn \__coffin_rotate_bounding:nnn #1#2#3
  {
    \__coffin_rotate_vector:nnNN {#2} {#3} \l__coffin_x_dim \l__coffin_y_dim
    \prop_put:Nnx \l__coffin_bounding_prop {#1}
      { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } }
  }
\cs_new_protected:Npn \__coffin_rotate_corner:Nnnn #1#2#3#4
  {
    \__coffin_rotate_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim
    \prop_put:Nnx \l__coffin_corners_prop {#2}
      { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } }
  }
\cs_new_protected:Npn \__coffin_rotate_pole:Nnnnnn #1#2#3#4#5#6
  {
    \__coffin_rotate_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim
    \__coffin_rotate_vector:nnNN {#5} {#6}
      \l__coffin_x_prime_dim \l__coffin_y_prime_dim
    \prop_put:Nnx \l__coffin_poles_prop {#2}
      {
        { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim }
        { \dim_use:N \l__coffin_x_prime_dim }
        { \dim_use:N \l__coffin_y_prime_dim }
      }
  }
\cs_new_protected:Npn \__coffin_rotate_vector:nnNN #1#2#3#4
  {
    \dim_set:Nn #3
      {
        \fp_to_dim:n
          {
              \dim_to_fp:n {#1} * \l__coffin_cos_fp
            - \dim_to_fp:n {#2} * \l__coffin_sin_fp
          }
      }
    \dim_set:Nn #4
      {
        \fp_to_dim:n
          {
              \dim_to_fp:n {#1} * \l__coffin_sin_fp
            + \dim_to_fp:n {#2} * \l__coffin_cos_fp
          }
      }
  }
\cs_new_protected:Npn \__coffin_find_corner_maxima:N #1
  {
    \dim_set:Nn \l__coffin_top_corner_dim   { -\c_max_dim }
    \dim_set:Nn \l__coffin_right_corner_dim { -\c_max_dim }
    \dim_set:Nn \l__coffin_bottom_corner_dim { \c_max_dim }
    \dim_set:Nn \l__coffin_left_corner_dim   { \c_max_dim }
    \prop_map_inline:Nn \l__coffin_corners_prop
      { \__coffin_find_corner_maxima_aux:nn ##2 }
  }
\cs_new_protected:Npn \__coffin_find_corner_maxima_aux:nn #1#2
  {
    \dim_set:Nn \l__coffin_left_corner_dim
     { \dim_min:nn { \l__coffin_left_corner_dim } {#1} }
    \dim_set:Nn \l__coffin_right_corner_dim
     { \dim_max:nn { \l__coffin_right_corner_dim } {#1} }
    \dim_set:Nn \l__coffin_bottom_corner_dim
     { \dim_min:nn { \l__coffin_bottom_corner_dim } {#2} }
    \dim_set:Nn \l__coffin_top_corner_dim
     { \dim_max:nn { \l__coffin_top_corner_dim } {#2} }
  }
\cs_new_protected:Npn \__coffin_find_bounding_shift:
  {
    \dim_set:Nn \l__coffin_bounding_shift_dim { \c_max_dim }
    \prop_map_inline:Nn \l__coffin_bounding_prop
      { \__coffin_find_bounding_shift_aux:nn ##2 }
  }
\cs_new_protected:Npn \__coffin_find_bounding_shift_aux:nn #1#2
  {
    \dim_set:Nn \l__coffin_bounding_shift_dim
      { \dim_min:nn { \l__coffin_bounding_shift_dim } {#1} }
  }
\cs_new_protected:Npn \__coffin_shift_corner:Nnnn #1#2#3#4
  {
    \prop_put:Nnx \l__coffin_corners_prop {#2}
      {
        { \dim_eval:n { #3 - \l__coffin_left_corner_dim } }
        { \dim_eval:n { #4 - \l__coffin_bottom_corner_dim } }
      }
  }
\cs_new_protected:Npn \__coffin_shift_pole:Nnnnnn #1#2#3#4#5#6
  {
    \prop_put:Nnx \l__coffin_poles_prop {#2}
      {
        { \dim_eval:n { #3 - \l__coffin_left_corner_dim } }
        { \dim_eval:n { #4 - \l__coffin_bottom_corner_dim } }
        {#5} {#6}
      }
  }
\fp_new:N \l__coffin_scale_x_fp
\fp_new:N \l__coffin_scale_y_fp
\dim_new:N \l__coffin_scaled_total_height_dim
\dim_new:N \l__coffin_scaled_width_dim
\cs_new_protected:Npn \coffin_resize:Nnn #1#2#3
  {
    \__coffin_resize:NnnNN #1 {#2} {#3}
      \box_resize_to_wd_and_ht_plus_dp:Nnn
      \prop_set_eq:cN
  }
\cs_generate_variant:Nn \coffin_resize:Nnn { c }
\cs_new_protected:Npn \coffin_gresize:Nnn #1#2#3
  {
    \__coffin_resize:NnnNN #1 {#2} {#3}
      \box_gresize_to_wd_and_ht_plus_dp:Nnn
      \prop_gset_eq:cN
  }
\cs_generate_variant:Nn \coffin_gresize:Nnn { c }
\cs_new_protected:Npn \__coffin_resize:NnnNN #1#2#3#4#5
  {
    \fp_set:Nn \l__coffin_scale_x_fp
      { \dim_to_fp:n {#2} / \dim_to_fp:n { \coffin_wd:N #1 } }
    \fp_set:Nn \l__coffin_scale_y_fp
      {
          \dim_to_fp:n {#3}
        / \dim_to_fp:n { \coffin_ht:N #1 + \coffin_dp:N #1 }
      }
    #4 #1 {#2} {#3}
    \__coffin_resize_common:NnnN #1 {#2} {#3} #5
  }
\cs_new_protected:Npn \__coffin_resize_common:NnnN #1#2#3#4
  {
    \prop_set_eq:Nc \l__coffin_corners_prop
      { coffin ~ \__coffin_to_value:N #1 ~ corners }
    \prop_set_eq:Nc \l__coffin_poles_prop
      { coffin ~ \__coffin_to_value:N #1 ~ poles }
    \prop_map_inline:Nn \l__coffin_corners_prop
      { \__coffin_scale_corner:Nnnn #1 {##1} ##2 }
    \prop_map_inline:Nn \l__coffin_poles_prop
      { \__coffin_scale_pole:Nnnnnn #1 {##1} ##2 }
    \fp_compare:nNnT \l__coffin_scale_x_fp < \c_zero_fp
      {
        \prop_map_inline:Nn \l__coffin_corners_prop
          { \__coffin_x_shift_corner:Nnnn #1 {##1} ##2 }
        \prop_map_inline:Nn \l__coffin_poles_prop
          { \__coffin_x_shift_pole:Nnnnnn #1 {##1} ##2 }
      }
    #4 { coffin ~ \__coffin_to_value:N #1 ~ corners }
      \l__coffin_corners_prop
    #4 { coffin ~ \__coffin_to_value:N #1 ~ poles }
      \l__coffin_poles_prop
  }
\cs_new_protected:Npn \coffin_scale:Nnn #1#2#3
  { \__coffin_scale:NnnNN #1 {#2} {#3} \box_scale:Nnn \prop_set_eq:cN }
\cs_generate_variant:Nn \coffin_scale:Nnn { c }
\cs_new_protected:Npn \coffin_gscale:Nnn #1#2#3
  { \__coffin_scale:NnnNN #1 {#2} {#3} \box_gscale:Nnn \prop_gset_eq:cN }
\cs_generate_variant:Nn \coffin_gscale:Nnn { c }
\cs_new_protected:Npn \__coffin_scale:NnnNN #1#2#3#4#5
  {
    \fp_set:Nn \l__coffin_scale_x_fp {#2}
    \fp_set:Nn \l__coffin_scale_y_fp {#3}
    #4 #1 { \l__coffin_scale_x_fp } { \l__coffin_scale_y_fp }
    \dim_set:Nn \l__coffin_internal_dim
      { \coffin_ht:N #1 + \coffin_dp:N #1 }
    \dim_set:Nn \l__coffin_scaled_total_height_dim
      { \fp_abs:n { \l__coffin_scale_y_fp } \l__coffin_internal_dim }
    \dim_set:Nn \l__coffin_scaled_width_dim
      { -\fp_abs:n { \l__coffin_scale_x_fp  } \coffin_wd:N #1 }
    \__coffin_resize_common:NnnN #1
      { \l__coffin_scaled_width_dim } { \l__coffin_scaled_total_height_dim }
      #5
  }
\cs_new_protected:Npn \__coffin_scale_vector:nnNN #1#2#3#4
  {
    \dim_set:Nn #3
      { \fp_to_dim:n { \dim_to_fp:n {#1} * \l__coffin_scale_x_fp } }
    \dim_set:Nn #4
      { \fp_to_dim:n { \dim_to_fp:n {#2} * \l__coffin_scale_y_fp } }
  }
\cs_new_protected:Npn \__coffin_scale_corner:Nnnn #1#2#3#4
  {
    \__coffin_scale_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim
    \prop_put:Nnx \l__coffin_corners_prop {#2}
      { { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim } }
  }
\cs_new_protected:Npn \__coffin_scale_pole:Nnnnnn #1#2#3#4#5#6
  {
    \__coffin_scale_vector:nnNN {#3} {#4} \l__coffin_x_dim \l__coffin_y_dim
    \prop_put:Nnx \l__coffin_poles_prop {#2}
      {
        { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim }
        {#5} {#6}
      }
  }
\cs_new_protected:Npn \__coffin_x_shift_corner:Nnnn #1#2#3#4
  {
    \prop_put:Nnx \l__coffin_corners_prop {#2}
      {
        { \dim_eval:n { #3 + \box_wd:N #1 } } {#4}
      }
  }
\cs_new_protected:Npn \__coffin_x_shift_pole:Nnnnnn #1#2#3#4#5#6
  {
    \prop_put:Nnx \l__coffin_poles_prop {#2}
      {
        { \dim_eval:n { #3 + \box_wd:N #1 } } {#4}
        {#5} {#6}
      }
  }
\cs_new_protected:Npn \coffin_join:NnnNnnnn #1#2#3#4#5#6#7#8
  {
    \__coffin_join:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8}
      \coffin_set_eq:NN
  }
\cs_generate_variant:Nn \coffin_join:NnnNnnnn { c , Nnnc , cnnc }
\cs_new_protected:Npn \coffin_gjoin:NnnNnnnn #1#2#3#4#5#6#7#8
  {
    \__coffin_join:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8}
      \coffin_gset_eq:NN
  }
\cs_generate_variant:Nn \coffin_gjoin:NnnNnnnn { c , Nnnc , cnnc }
\cs_new_protected:Npn \__coffin_join:NnnNnnnnN #1#2#3#4#5#6#7#8#9
  {
    \__coffin_align:NnnNnnnnN
      #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l__coffin_aligned_coffin
    \hbox_set:Nn \l__coffin_aligned_coffin
      {
        \dim_compare:nNnT { \l__coffin_offset_x_dim } < \c_zero_dim
          { \__kernel_kern:n { -\l__coffin_offset_x_dim } }
        \hbox_unpack:N \l__coffin_aligned_coffin
        \dim_set:Nn \l__coffin_internal_dim
          { \l__coffin_offset_x_dim - \box_wd:N #1 + \box_wd:N #4 }
        \dim_compare:nNnT \l__coffin_internal_dim < \c_zero_dim
          { \__kernel_kern:n { -\l__coffin_internal_dim } }
      }
   \__coffin_reset_structure:N \l__coffin_aligned_coffin
   \prop_clear:c
     {
       coffin ~ \__coffin_to_value:N \l__coffin_aligned_coffin
       \c_space_tl corners
     }
   \__coffin_update_poles:N \l__coffin_aligned_coffin
    \dim_compare:nNnTF \l__coffin_offset_x_dim < \c_zero_dim
      {
        \__coffin_offset_poles:Nnn #1 { -\l__coffin_offset_x_dim } { 0pt }
        \__coffin_offset_poles:Nnn #4 { 0pt } { \l__coffin_offset_y_dim }
        \__coffin_offset_corners:Nnn #1 { -\l__coffin_offset_x_dim } { 0pt }
        \__coffin_offset_corners:Nnn #4 { 0pt } { \l__coffin_offset_y_dim }
      }
      {
        \__coffin_offset_poles:Nnn #1 { 0pt } { 0pt }
        \__coffin_offset_poles:Nnn #4
          { \l__coffin_offset_x_dim } { \l__coffin_offset_y_dim }
        \__coffin_offset_corners:Nnn #1 { 0pt } { 0pt }
        \__coffin_offset_corners:Nnn #4
          { \l__coffin_offset_x_dim } { \l__coffin_offset_y_dim }
      }
    \__coffin_update_vertical_poles:NNN #1 #4 \l__coffin_aligned_coffin
    #9 #1 \l__coffin_aligned_coffin
  }
\cs_new_protected:Npn \coffin_attach:NnnNnnnn #1#2#3#4#5#6#7#8
  {
    \__coffin_attach:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8}
      \coffin_set_eq:NN
  }
\cs_generate_variant:Nn \coffin_attach:NnnNnnnn { c , Nnnc , cnnc }
\cs_new_protected:Npn \coffin_gattach:NnnNnnnn #1#2#3#4#5#6#7#8
  {
    \__coffin_attach:NnnNnnnnN #1 {#2} {#3} #4 {#5} {#6} {#7} {#8}
      \coffin_gset_eq:NN
  }
\cs_generate_variant:Nn \coffin_gattach:NnnNnnnn { c , Nnnc , cnnc }
\cs_new_protected:Npn \__coffin_attach:NnnNnnnnN #1#2#3#4#5#6#7#8#9
  {
    \__coffin_align:NnnNnnnnN
      #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l__coffin_aligned_coffin
    \box_set_ht:Nn \l__coffin_aligned_coffin { \box_ht:N #1 }
    \box_set_dp:Nn \l__coffin_aligned_coffin { \box_dp:N #1 }
    \box_set_wd:Nn \l__coffin_aligned_coffin { \box_wd:N #1 }
    \__coffin_reset_structure:N \l__coffin_aligned_coffin
    \prop_set_eq:cc
      {
        coffin ~ \__coffin_to_value:N \l__coffin_aligned_coffin
        \c_space_tl corners
      }
      { coffin ~ \__coffin_to_value:N #1 ~ corners }
    \__coffin_update_poles:N  \l__coffin_aligned_coffin
    \__coffin_offset_poles:Nnn #1 { 0pt } { 0pt }
    \__coffin_offset_poles:Nnn #4
      { \l__coffin_offset_x_dim } { \l__coffin_offset_y_dim }
    \__coffin_update_vertical_poles:NNN #1 #4 \l__coffin_aligned_coffin
    \coffin_set_eq:NN #1 \l__coffin_aligned_coffin
  }
\cs_new_protected:Npn \__coffin_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8
  {
    \__coffin_align:NnnNnnnnN
      #1 {#2} {#3} #4 {#5} {#6} {#7} {#8} \l__coffin_aligned_coffin
    \box_set_ht:Nn \l__coffin_aligned_coffin { \box_ht:N #1 }
    \box_set_dp:Nn \l__coffin_aligned_coffin { \box_dp:N #1 }
    \box_set_wd:Nn \l__coffin_aligned_coffin { \box_wd:N #1 }
    \box_set_eq:NN #1 \l__coffin_aligned_coffin
  }
\cs_new_protected:Npn \__coffin_align:NnnNnnnnN #1#2#3#4#5#6#7#8#9
  {
    \__coffin_calculate_intersection:Nnn #4 {#5} {#6}
    \dim_set:Nn \l__coffin_x_prime_dim { \l__coffin_x_dim }
    \dim_set:Nn \l__coffin_y_prime_dim { \l__coffin_y_dim }
    \__coffin_calculate_intersection:Nnn #1 {#2} {#3}
    \dim_set:Nn \l__coffin_offset_x_dim
      { \l__coffin_x_dim - \l__coffin_x_prime_dim + #7 }
    \dim_set:Nn \l__coffin_offset_y_dim
      { \l__coffin_y_dim - \l__coffin_y_prime_dim + #8 }
    \hbox_set:Nn \l__coffin_aligned_internal_coffin
      {
        \box_use:N #1
        \__kernel_kern:n { -\box_wd:N #1 }
        \__kernel_kern:n { \l__coffin_offset_x_dim }
        \box_move_up:nn { \l__coffin_offset_y_dim } { \box_use:N #4 }
      }
    \coffin_set_eq:NN #9 \l__coffin_aligned_internal_coffin
  }
\cs_new_protected:Npn \__coffin_offset_poles:Nnn #1#2#3
  {
    \prop_map_inline:cn { coffin ~ \__coffin_to_value:N #1 ~ poles }
      { \__coffin_offset_pole:Nnnnnnn #1 {##1} ##2 {#2} {#3} }
  }
\cs_new_protected:Npn \__coffin_offset_pole:Nnnnnnn #1#2#3#4#5#6#7#8
  {
    \dim_set:Nn \l__coffin_x_dim { #3 + #7 }
    \dim_set:Nn \l__coffin_y_dim { #4 + #8 }
    \tl_if_in:nnTF {#2} { - }
      { \tl_set:Nn \l__coffin_internal_tl { {#2} } }
      { \tl_set:Nn \l__coffin_internal_tl { { #1 - #2 } } }
    \exp_last_unbraced:NNo \__coffin_set_pole:Nnx \l__coffin_aligned_coffin
      { \l__coffin_internal_tl }
      {
        { \dim_use:N \l__coffin_x_dim } { \dim_use:N \l__coffin_y_dim }
        {#5} {#6}
      }
  }
\cs_new_protected:Npn \__coffin_offset_corners:Nnn #1#2#3
  {
    \prop_map_inline:cn { coffin ~ \__coffin_to_value:N #1 ~ corners }
      { \__coffin_offset_corner:Nnnnn #1 {##1} ##2 {#2} {#3} }
  }
\cs_new_protected:Npn \__coffin_offset_corner:Nnnnn #1#2#3#4#5#6
  {
    \prop_put:cnx
      {
        coffin ~ \__coffin_to_value:N \l__coffin_aligned_coffin
        \c_space_tl corners
      }
      { #1 - #2 }
      {
        { \dim_eval:n { #3 + #5 } }
        { \dim_eval:n { #4 + #6 } }
      }
  }
\cs_new_protected:Npn \__coffin_update_vertical_poles:NNN #1#2#3
  {
    \__coffin_get_pole:NnN #3 { #1 -T } \l__coffin_pole_a_tl
    \__coffin_get_pole:NnN #3 { #2 -T } \l__coffin_pole_b_tl
    \exp_last_two_unbraced:Noo \__coffin_update_T:nnnnnnnnN
      \l__coffin_pole_a_tl \l__coffin_pole_b_tl #3
    \__coffin_get_pole:NnN #3 { #1 -B } \l__coffin_pole_a_tl
    \__coffin_get_pole:NnN #3 { #2 -B } \l__coffin_pole_b_tl
    \exp_last_two_unbraced:Noo \__coffin_update_B:nnnnnnnnN
      \l__coffin_pole_a_tl \l__coffin_pole_b_tl #3
  }
\cs_new_protected:Npn \__coffin_update_T:nnnnnnnnN #1#2#3#4#5#6#7#8#9
  {
    \dim_compare:nNnTF {#2} < {#6}
      {
        \__coffin_set_pole:Nnx #9 { T }
          { { 0pt } {#6} { 1000pt } { 0pt } }
      }
      {
        \__coffin_set_pole:Nnx #9 { T }
          { { 0pt } {#2} { 1000pt } { 0pt } }
      }
  }
\cs_new_protected:Npn \__coffin_update_B:nnnnnnnnN #1#2#3#4#5#6#7#8#9
  {
    \dim_compare:nNnTF {#2} < {#6}
      {
        \__coffin_set_pole:Nnx #9 { B }
          { { 0pt } {#2}  { 1000pt } { 0pt } }
      }
      {
        \__coffin_set_pole:Nnx #9 { B }
          { { 0pt } {#6} { 1000pt } { 0pt } }
      }
  }
\coffin_new:N \c__coffin_empty_coffin
\tex_setbox:D \c__coffin_empty_coffin = \tex_hbox:D { }
\cs_new_protected:Npn \coffin_typeset:Nnnnn #1#2#3#4#5
  {
    \mode_leave_vertical:
    \__coffin_align:NnnNnnnnN \c__coffin_empty_coffin { H } { l }
      #1 {#2} {#3} {#4} {#5} \l__coffin_aligned_coffin
    \box_use_drop:N \l__coffin_aligned_coffin
  }
\cs_generate_variant:Nn \coffin_typeset:Nnnnn { c }
\coffin_new:N \l__coffin_display_coffin
\coffin_new:N \l__coffin_display_coord_coffin
\coffin_new:N \l__coffin_display_pole_coffin
\prop_new:N \l__coffin_display_handles_prop
\prop_put:Nnn \l__coffin_display_handles_prop { tl }
  { { b } { r } { -1 } { 1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { thc }
  { { b } { hc } { 0 } { 1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { tr }
  { { b } { l } { 1 } { 1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { vcl }
  { { vc } { r } { -1 } { 0 } }
\prop_put:Nnn \l__coffin_display_handles_prop { vchc }
  { { vc } { hc } { 0 } { 0 } }
\prop_put:Nnn \l__coffin_display_handles_prop { vcr }
  { { vc } { l } { 1 } { 0 } }
\prop_put:Nnn \l__coffin_display_handles_prop { bl }
  { { t } { r } { -1 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { bhc }
  { { t } { hc } { 0 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { br }
  { { t } { l } { 1 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Tl }
  { { t } { r } { -1 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Thc }
  { { t } { hc } { 0 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Tr }
  { { t } { l } { 1 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Hl }
  { { vc } { r } { -1 } { 1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Hhc }
  { { vc } { hc } { 0 } { 1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Hr }
  { { vc } { l } { 1 } { 1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Bl }
  { { b } { r } { -1 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Bhc }
  { { b } { hc } { 0 } { -1 } }
\prop_put:Nnn \l__coffin_display_handles_prop { Br }
  { { b } { l } { 1 } { -1 } }
\dim_new:N  \l__coffin_display_offset_dim
\dim_set:Nn \l__coffin_display_offset_dim { 2pt }
\dim_new:N \l__coffin_display_x_dim
\dim_new:N \l__coffin_display_y_dim
\prop_new:N \l__coffin_display_poles_prop
\tl_new:N \l__coffin_display_font_tl
\bool_lazy_and:nnT
  { \cs_if_exist_p:N \fmtname }
  { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
  {
    \tl_set:Nn \l__coffin_display_font_tl
      { \sffamily \tiny }
  }
\cs_new_protected:Npn \__coffin_rule:nn #1#2
  {
    \mode_leave_vertical:
    \hbox:n { \tex_vrule:D width #1 height #2 \scan_stop: }
  }
\cs_new_protected:Npn \coffin_mark_handle:Nnnn #1#2#3#4
  {
    \hcoffin_set:Nn \l__coffin_display_pole_coffin
      {
        \color_select:n {#4}
        \__coffin_rule:nn { 1pt } { 1pt }
      }
    \__coffin_attach_mark:NnnNnnnn #1 {#2} {#3}
      \l__coffin_display_pole_coffin { hc } { vc } { 0pt } { 0pt }
    \hcoffin_set:Nn \l__coffin_display_coord_coffin
      {
        \color_select:n {#4}
        \l__coffin_display_font_tl
        ( \tl_to_str:n { #2 , #3 } )
      }
    \prop_get:NnN \l__coffin_display_handles_prop
      { #2 #3 } \l__coffin_internal_tl
    \quark_if_no_value:NTF \l__coffin_internal_tl
      {
        \prop_get:NnN \l__coffin_display_handles_prop
          { #3 #2 } \l__coffin_internal_tl
        \quark_if_no_value:NTF \l__coffin_internal_tl
          {
            \__coffin_attach_mark:NnnNnnnn #1 {#2} {#3}
              \l__coffin_display_coord_coffin { l } { vc }
                { 1pt } { 0pt }
          }
          {
            \exp_last_unbraced:No \__coffin_mark_handle_aux:nnnnNnn
              \l__coffin_internal_tl #1 {#2} {#3}
          }
      }
      {
        \exp_last_unbraced:No \__coffin_mark_handle_aux:nnnnNnn
          \l__coffin_internal_tl #1 {#2} {#3}
      }
  }
\cs_new_protected:Npn \__coffin_mark_handle_aux:nnnnNnn #1#2#3#4#5#6#7
  {
    \__coffin_attach_mark:NnnNnnnn #5 {#6} {#7}
      \l__coffin_display_coord_coffin {#1} {#2}
      { #3 \l__coffin_display_offset_dim }
      { #4 \l__coffin_display_offset_dim }
  }
\cs_generate_variant:Nn \coffin_mark_handle:Nnnn { c }
\cs_new_protected:Npn \coffin_display_handles:Nn #1#2
  {
    \hcoffin_set:Nn \l__coffin_display_pole_coffin
      {
        \color_select:n {#2}
        \__coffin_rule:nn { 1pt } { 1pt }
      }
    \prop_set_eq:Nc \l__coffin_display_poles_prop
      { coffin ~ \__coffin_to_value:N #1 ~ poles }
    \__coffin_get_pole:NnN #1 { H } \l__coffin_pole_a_tl
    \__coffin_get_pole:NnN #1 { T } \l__coffin_pole_b_tl
    \tl_if_eq:NNT \l__coffin_pole_a_tl \l__coffin_pole_b_tl
      { \prop_remove:Nn \l__coffin_display_poles_prop { T } }
    \__coffin_get_pole:NnN #1 { B } \l__coffin_pole_b_tl
    \tl_if_eq:NNT \l__coffin_pole_a_tl \l__coffin_pole_b_tl
      { \prop_remove:Nn \l__coffin_display_poles_prop { B } }
    \coffin_set_eq:NN \l__coffin_display_coffin #1
    \prop_map_inline:Nn \l__coffin_display_poles_prop
      {
        \prop_remove:Nn \l__coffin_display_poles_prop {##1}
        \__coffin_display_handles_aux:nnnnnn {##1} ##2 {#2}
      }
    \box_use_drop:N \l__coffin_display_coffin
  }
\cs_new_protected:Npn \__coffin_display_handles_aux:nnnnnn #1#2#3#4#5#6
  {
    \prop_map_inline:Nn \l__coffin_display_poles_prop
      {
        \bool_set_false:N \l__coffin_error_bool
        \__coffin_calculate_intersection:nnnnnnnn {#2} {#3} {#4} {#5} ##2
        \bool_if:NF \l__coffin_error_bool
          {
            \dim_set:Nn \l__coffin_display_x_dim { \l__coffin_x_dim }
            \dim_set:Nn \l__coffin_display_y_dim { \l__coffin_y_dim }
            \__coffin_display_attach:Nnnnn
              \l__coffin_display_pole_coffin { hc } { vc }
              { 0pt } { 0pt }
            \hcoffin_set:Nn \l__coffin_display_coord_coffin
              {
                \color_select:n {#6}
                \l__coffin_display_font_tl
                ( \tl_to_str:n { #1 , ##1 } )
              }
            \prop_get:NnN \l__coffin_display_handles_prop
              { #1 ##1 } \l__coffin_internal_tl
            \quark_if_no_value:NTF \l__coffin_internal_tl
              {
                \prop_get:NnN \l__coffin_display_handles_prop
                  { ##1 #1 } \l__coffin_internal_tl
                \quark_if_no_value:NTF \l__coffin_internal_tl
                  {
                    \__coffin_display_attach:Nnnnn
                      \l__coffin_display_coord_coffin { l } { vc }
                      { 1pt } { 0pt }
                  }
                  {
                    \exp_last_unbraced:No
                      \__coffin_display_handles_aux:nnnn
                      \l__coffin_internal_tl
                  }
              }
              {
                \exp_last_unbraced:No \__coffin_display_handles_aux:nnnn
                  \l__coffin_internal_tl
              }
          }
      }
  }
\cs_new_protected:Npn \__coffin_display_handles_aux:nnnn #1#2#3#4
  {
    \__coffin_display_attach:Nnnnn
      \l__coffin_display_coord_coffin {#1} {#2}
      { #3 \l__coffin_display_offset_dim }
      { #4 \l__coffin_display_offset_dim }
  }
\cs_generate_variant:Nn \coffin_display_handles:Nn { c }
\cs_new_protected:Npn \__coffin_display_attach:Nnnnn #1#2#3#4#5
  {
    \__coffin_calculate_intersection:Nnn #1 {#2} {#3}
    \dim_set:Nn \l__coffin_x_prime_dim { \l__coffin_x_dim }
    \dim_set:Nn \l__coffin_y_prime_dim { \l__coffin_y_dim }
    \dim_set:Nn \l__coffin_offset_x_dim
      { \l__coffin_display_x_dim - \l__coffin_x_prime_dim + #4 }
    \dim_set:Nn \l__coffin_offset_y_dim
      { \l__coffin_display_y_dim - \l__coffin_y_prime_dim + #5 }
    \hbox_set:Nn \l__coffin_aligned_coffin
      {
        \box_use:N \l__coffin_display_coffin
        \__kernel_kern:n { -\box_wd:N \l__coffin_display_coffin }
        \__kernel_kern:n { \l__coffin_offset_x_dim }
        \box_move_up:nn { \l__coffin_offset_y_dim } { \box_use:N #1 }
      }
    \box_set_ht:Nn \l__coffin_aligned_coffin
      { \box_ht:N \l__coffin_display_coffin }
    \box_set_dp:Nn \l__coffin_aligned_coffin
      { \box_dp:N \l__coffin_display_coffin }
    \box_set_wd:Nn \l__coffin_aligned_coffin
      { \box_wd:N \l__coffin_display_coffin }
    \box_set_eq:NN \l__coffin_display_coffin \l__coffin_aligned_coffin
  }
\cs_new_protected:Npn \coffin_show_structure:N
  { \__coffin_show_structure:NN \msg_show:nnxxxx }
\cs_generate_variant:Nn \coffin_show_structure:N { c }
\cs_new_protected:Npn \coffin_log_structure:N
  { \__coffin_show_structure:NN \msg_log:nnxxxx }
\cs_generate_variant:Nn \coffin_log_structure:N { c }
\cs_new_protected:Npn \__coffin_show_structure:NN #1#2
  {
    \__coffin_if_exist:NT #2
      {
        #1 { LaTeX / kernel } { show-coffin }
          { \token_to_str:N #2 }
          {
            \iow_newline: >~ ht ~=~ \dim_eval:n { \coffin_ht:N #2 }
            \iow_newline: >~ dp ~=~ \dim_eval:n { \coffin_dp:N #2 }
            \iow_newline: >~ wd ~=~ \dim_eval:n { \coffin_wd:N #2 }
          }
          {
            \prop_map_function:cN
              { coffin ~ \__coffin_to_value:N #2 ~ poles }
              \msg_show_item_unbraced:nn
          }
          { }
      }
  }
\__kernel_msg_new:nnnn { kernel } { no-pole-intersection }
  { No~intersection~between~coffin~poles. }
  {
    LaTeX~was~asked~to~find~the~intersection~between~two~poles,~
    but~they~do~not~have~a~unique~meeting~point:~
    the~value~(0pt,~0pt)~will~be~used.
  }
\__kernel_msg_new:nnnn { kernel } { unknown-coffin }
  { Unknown~coffin~'#1'. }
  { The~coffin~'#1'~was~never~defined. }
\__kernel_msg_new:nnnn { kernel } { unknown-coffin-pole }
  { Pole~'#1'~unknown~for~coffin~'#2'. }
  {
    LaTeX~was~asked~to~find~a~typesetting~pole~for~a~coffin,~
    but~either~the~coffin~does~not~exist~or~the~pole~name~is~wrong.
  }
\__kernel_msg_new:nnn { kernel } { show-coffin }
  {
    Size~of~coffin~#1 : #2 \\
    Poles~of~coffin~#1 : #3 .
  }
%% File: l3luatex.dtx
\cs_new_eq:NN \__lua_escape:n  \tex_luaescapestring:D
\cs_new_eq:NN \__lua_now:n     \tex_directlua:D
\cs_new_eq:NN \__lua_shipout:n \tex_latelua:D
\cs_undefine:N \lua_escape:e
\cs_undefine:N \lua_now:e
\cs_new:Npn \lua_now:e #1 { \__lua_now:n {#1} }
\cs_new:Npn \lua_now:n #1 { \lua_now:e { \exp_not:n {#1} } }
\cs_new_protected:Npn \lua_shipout_e:n #1 { \__lua_shipout:n {#1} }
\cs_new_protected:Npn \lua_shipout:n #1
  { \lua_shipout_e:n { \exp_not:n {#1} } }
\cs_new:Npn \lua_escape:e #1 { \__lua_escape:n {#1} }
\cs_new:Npn \lua_escape:n #1 { \lua_escape:e { \exp_not:n {#1} } }
\sys_if_engine_luatex:F
  {
    \clist_map_inline:nn
      {
        \lua_escape:n , \lua_escape:e ,
        \lua_now:n , \lua_now:e
      }
      {
        \cs_set:Npn #1 ##1
          {
            \__kernel_msg_expandable_error:nnn
              { kernel } { luatex-required } { #1 }
          }
      }
    \clist_map_inline:nn
      { \lua_shipout_e:n , \lua_shipout:n }
      {
        \cs_set_protected:Npn #1 ##1
          {
            \__kernel_msg_error:nnn
              { kernel } { luatex-required } { #1 }
          }
      }
  }
\__kernel_msg_new:nnnn { kernel } { luatex-required }
  { LuaTeX~engine~not~in~use!~Ignoring~#1. }
  {
    The~feature~you~are~using~is~only~available~
    with~the~LuaTeX~engine.~LaTeX3~ignored~'#1'.
  }
%% File: l3unicode.dtx
\ior_new:N \g__char_data_ior
\bool_lazy_or:nnTF { \sys_if_engine_luatex_p: } { \sys_if_engine_xetex_p: }
  {
    \group_begin:
      \cs_set:Npn \__char_generate_char:n #1
        { \tex_detokenize:D \tex_expandafter:D { \tex_Uchar:D " #1 } }
      \cs_set:Npx \__char_generate:n #1
        {
          \exp_not:N \tex_unexpanded:D \exp_not:N \exp_after:wN
            {
              \exp_not:N \tex_Ucharcat:D
                #1 ~
                \tex_catcode:D #1 ~
            }
        }
      \ior_open:Nn \g__char_data_ior { UnicodeData.txt }
      \cs_set_protected:Npn \__char_data_auxi:w
        #1 ; #2 ; #3 ; #4 ; #5 ; #6 ; #7 ; #8 ; #9 ;
        {
          \tl_if_blank:nF {#6}
            {
              \tl_if_head_eq_charcode:nNF {#6}  < % >
                { \__char_data_auxii:w #1 ; #6 ~ \q_stop }
            }
          \__char_data_auxiii:w #1 ;
        }
      \cs_set_protected:Npn \__char_data_auxii:w #1 ; #2 ~ #3 \q_stop
        {
          \tl_const:cx
            { c__char_nfd_ \__char_generate_char:n {#1} _tl }
            {
              \__char_generate:n { "#2 }
              \tl_if_blank:nF {#3}
                { \__char_generate:n { "#3 } }
            }
        }
      \cs_set_protected:Npn \__char_data_auxiii:w
        #1 ; #2 ; #3 ; #4 ; #5 ; #6 ; #7 ~ \q_stop
        {
          \cs_set_nopar:Npn \l__char_tmpa_tl {#7}
          \reverse_if:N \if_meaning:w \l__char_tmpa_tl \c_empty_tl
            \cs_set_nopar:Npn \l__char_tmpb_tl {#5}
            \reverse_if:N \if_meaning:w \l__char_tmpa_tl \l__char_tmpb_tl
              \tl_const:cx
                { c__char_titlecase_ \__char_generate_char:n {#1} _tl }
                { \__char_generate:n { "#7 } }
            \fi:
          \fi:
        }
      \group_begin:
        \char_set_catcode_space:n { `\  }%
        \ior_map_variable:NNn \g__char_data_ior \l__char_tmpa_tl
          {%
            \if_meaning:w \l__char_tmpa_tl \c_space_tl
              \exp_after:wN \ior_map_break:
            \fi:
            \exp_after:wN \__char_data_auxi:w \l__char_tmpa_tl \q_stop
          }%
      \group_end:
      \ior_close:N \g__char_data_ior
      \ior_open:Nn \g__char_data_ior { CaseFolding.txt }
      \cs_set_protected:Npn \__char_data_auxi:w #1 ;~ #2 ;~ #3 ; #4 \q_stop
        {
          \if:w \tl_head:n { #2 ? } C
            \reverse_if:N \if_int_compare:w
              \char_value_lccode:n {"#1} = "#3 ~
              \tl_const:cx
                { c__char_foldcase_ \__char_generate_char:n {#1} _tl }
                { \__char_generate:n { "#3 } }
            \fi:
          \else:
            \if:w \tl_head:n { #2 ? } F
              \__char_data_auxii:w #1 ~ #3 ~ \q_stop
            \fi:
          \fi:
        }
      \cs_set_protected:Npn \__char_data_auxii:w #1 ~ #2 ~ #3 ~ #4 \q_stop
        {
          \tl_const:cx { c__char_foldcase_ \__char_generate_char:n {#1} _tl }
            {
              \__char_generate:n { "#2 }
              \__char_generate:n { "#3 }
              \tl_if_blank:nF {#4}
                { \__char_generate:n { \int_value:w "#4 } }
            }
        }
      \ior_str_map_inline:Nn \g__char_data_ior
        {
          \reverse_if:N \if:w \c_hash_str \tl_head:w #1 \c_hash_str \q_stop
            \__char_data_auxi:w #1 \q_stop
          \fi:
        }
      \ior_close:N \g__char_data_ior
      \ior_open:Nn \g__char_data_ior { SpecialCasing.txt }
      \cs_set_protected:Npn \__char_data_auxi:w
        #1 ;~ #2 ;~ #3 ;~ #4 ; #5 \q_stop
        {
          \use:n { \__char_data_auxii:w #1 ~ lower ~ #2 ~ } ~ \q_stop
          \use:n { \__char_data_auxii:w #1 ~ upper ~ #4 ~ } ~ \q_stop
          \str_if_eq:nnF {#3} {#4}
            { \use:n { \__char_data_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop }
        }
      \cs_set_protected:Npn \__char_data_auxii:w
        #1 ~ #2 ~ #3 ~ #4 ~ #5 \q_stop
        {
          \tl_if_empty:nF {#4}
            {
              \tl_const:cx { c__char_ #2 case_ \__char_generate_char:n {#1} _tl }
                {
                  \__char_generate:n { "#3 }
                  \__char_generate:n { "#4 }
                  \tl_if_blank:nF {#5}
                    { \__char_generate:n { "#5 } }
                }
            }
        }
      \ior_str_map_inline:Nn \g__char_data_ior
        {
          \str_if_eq:eeTF
            { \tl_head:w #1 \c_hash_str \q_stop }
            { \c_hash_str }
            {
              \str_if_eq:eeT
                {#1}
                { \c_hash_str \c_space_tl Conditional~Mappings }
                { \ior_map_break: }
            }
            { \__char_data_auxi:w #1 \q_stop }
        }
      \ior_close:N \g__char_data_ior
    \group_end:
  }
  {
    \group_begin:
      \cs_set_protected:Npn \__char_tmp:NN #1#2
        {
          \quark_if_recursion_tail_stop:N #2
          \tl_const:cn { c__char_uppercase_ #2 _tl } {#1}
          \tl_const:cn { c__char_lowercase_ #1 _tl } {#2}
          \tl_const:cn { c__char_foldcase_  #1 _tl } {#2}
          \__char_tmp:NN
        }
      \__char_tmp:NN
        AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz
        ? \q_recursion_tail \q_recursion_stop
      \ior_open:Nn \g__char_data_ior { UnicodeData.txt }
      \ior_close:N \g__char_data_ior
    \group_end:
  }
%% File: l3text.dtx
\scan_new:N \s__text_stop
\quark_new:N \q__text_nil
\__kernel_quark_new_conditional:Nn \__text_quark_if_nil:n { TF }
\quark_new:N \q__text_recursion_tail
\quark_new:N \q__text_recursion_stop
\cs_new:Npn \__text_use_i_delimit_by_q_recursion_stop:nw
  #1 #2 \q__text_recursion_stop {#1}
\__kernel_quark_new_test:N \__text_if_recursion_tail_stop_do:Nn
\group_begin:
  \char_set_catcode_active:n { 0 }
  \cs_new:Npn \__text_token_to_explicit:N #1
    {
      \if_catcode:w \exp_not:N #1
        \if_catcode:w \scan_stop: \exp_not:N #1
          \scan_stop:
        \else:
          \exp_not:N ^^@
        \fi:
        \exp_after:wN \__text_token_to_explicit_cs:N
      \else:
        \exp_after:wN \__text_token_to_explicit_char:N
      \fi:
      #1
    }
\group_end:
\cs_new:Npn \__text_token_to_explicit_cs:N #1
  {
    \exp_after:wN \if_meaning:w \exp_not:N #1 #1
      \exp_after:wN \use:nn \exp_after:wN
        \__text_token_to_explicit_cs_aux:N
    \else:
      \exp_after:wN \exp_not:n
    \fi:
      {#1}
  }
\cs_new:Npn \__text_token_to_explicit_cs_aux:N #1
  {
    \bool_lazy_or:nnTF
      { \token_if_chardef_p:N #1 }
      { \token_if_mathchardef_p:N #1 }
      {
        \char_generate:nn {#1}
          { \char_value_catcode:n {#1} }
      }
      {#1}
  }
\cs_new:Npn \__text_token_to_explicit_char:N #1
  {
    \if:w
      \if_catcode:w ^ \exp_args:No \str_tail:n { \token_to_str:N #1 } ^
        \token_to_str:N #1 #1
        \else:
        AB
      \fi:
      \exp_after:wN \exp_not:n
    \else:
      \exp_after:wN \__text_token_to_explicit:n
    \fi:
      {#1}
  }
\cs_new:Npn \__text_token_to_explicit:n #1
  {
    \exp_after:wN \__text_token_to_explicit_auxi:w
      \int_value:w
        \if_catcode:w \c_group_begin_token #1 1 \else:
        \if_catcode:w \c_group_end_token #1 2 \else:
        \if_catcode:w \c_math_toggle_token #1 3 \else:
        \if_catcode:w ## #1 6 \else:
        \if_catcode:w ^ #1 7 \else:
        \if_catcode:w \c_math_subscript_token #1 8 \else:
        \if_catcode:w \c_space_token #1 10 \else:
        \if_catcode:w A #1 11 \else:
        \if_catcode:w + #1 12 \else:
        4 \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi:
    \exp_after:wN ;
    \token_to_meaning:N #1 \s__text_stop
  }
\cs_new:Npn \__text_token_to_explicit_auxi:w #1 ; #2 \s__text_stop
  {
    \char_generate:nn
      {
        \if_int_compare:w #1 < 9 \exp_stop_f:
          \exp_after:wN \__text_token_to_explicit_auxii:w
        \else:
          \exp_after:wN \__text_token_to_explicit_auxiii:w
        \fi:
        #2
      }
      {#1}
  }
\exp_last_unbraced:NNNNo \cs_new:Npn \__text_token_to_explicit_auxii:w
  #1 { \tl_to_str:n { character ~ } } { ` }
\cs_new:Npn \__text_token_to_explicit_auxiii:w #1 ~ #2 ~ { ` }
\cs_new:Npn \__text_char_catcode:N #1
  {
    \if_catcode:w \exp_not:N #1 \c_math_toggle_token
      3
    \else:
      \if_catcode:w \exp_not:N #1 \c_alignment_token
        4
      \else:
        \if_catcode:w \exp_not:N #1 \c_math_superscript_token
          7
        \else:
          \if_catcode:w \exp_not:N #1 \c_math_subscript_token
            8
          \else:
            \if_catcode:w \exp_not:N #1 \c_space_token
              10
            \else:
             \if_catcode:w \exp_not:N #1 \c_catcode_letter_token
               11
             \else:
               \if_catcode:w \exp_not:N #1 \c_catcode_other_token
                 12
               \else:
                 13
               \fi:
             \fi:
            \fi:
          \fi:
        \fi:
      \fi:
    \fi:
  }
\prg_new_conditional:Npnn \__text_if_expandable:N #1 { T , F , TF }
  {
    \token_if_expandable:NTF #1
      {
        \bool_lazy_any:nTF
          {
            { \token_if_protected_macro_p:N      #1 }
            { \token_if_protected_long_macro_p:N #1 }
            { \token_if_eq_meaning_p:NN \q__text_recursion_tail #1 }
          }
          { \prg_return_false: }
          { \prg_return_true: }
      }
      { \prg_return_false: }
  }
\tl_new:N \l_text_accents_tl
\tl_set:Nn \l_text_accents_tl
  { \` \' \^ \~ \= \u \. \" \r \H \v \d \c \k \b \t }
\tl_new:N \l_text_letterlike_tl
\tl_set:Nn \l_text_letterlike_tl
  {
    \AA \aa
    \AE \ae
    \DH \dh
    \DJ \dj
    \IJ \ij
    \L  \l
    \NG \ng
    \O  \o
    \OE \oe
    \SS \ss
    \TH \th
  }
\tl_new:N \l_text_case_exclude_arg_tl
\tl_set:Nn \l_text_case_exclude_arg_tl { \begin \cite \end \label \ref }
\tl_new:N \l_text_math_arg_tl
\tl_set:Nn \l_text_math_arg_tl { \ensuremath }
\tl_new:N \l_text_math_delims_tl
\tl_set:Nn \l_text_math_delims_tl { $ $ \( \) }
\tl_new:N \l_text_expand_exclude_tl
\tl_set:Nn \l_text_expand_exclude_tl
  { \begin \cite \end \label \ref }
\tl_new:N \l__text_math_mode_tl
\tex_chardef:D \c__text_chardef_space_token = `\  %
\tex_mathchardef:D \c__text_mathchardef_space_token = `\  %
\tex_chardef:D \c__text_chardef_group_begin_token = `\{ % `\}
\tex_mathchardef:D \c__text_mathchardef_group_begin_token = `\{ % `\} `\{
\tex_chardef:D \c__text_chardef_group_end_token = `\} % `\{
\tex_mathchardef:D \c__text_mathchardef_group_end_token = `\} %
\cs_new:Npn \text_expand:n #1
  {
    \__kernel_exp_not:w \exp_after:wN
      {
        \exp:w
        \__text_expand:n {#1}
      }
  }
\cs_new:Npn \__text_expand:n #1
  {
    \group_align_safe_begin:
    \__text_expand_loop:w #1
      \q__text_recursion_tail \q__text_recursion_stop
    \__text_expand_result:n { }
  }
\cs_new:Npn \__text_expand_store:n #1
  { \__text_expand_store:nw {#1} }
\cs_generate_variant:Nn \__text_expand_store:n { o }
\cs_new:Npn \__text_expand_store:nw #1#2 \__text_expand_result:n #3
  { #2 \__text_expand_result:n { #3 #1 } }
\cs_new:Npn \__text_expand_end:w #1 \__text_expand_result:n #2
  {
    \group_align_safe_end:
    \exp_end:
    #2
  }
\cs_new:Npn \__text_expand_loop:w #1 \q__text_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#1}
      { \__text_expand_N_type:N }
      {
        \tl_if_head_is_group:nTF {#1}
          { \__text_expand_group:n }
          { \__text_expand_space:w }
      }
    #1 \q__text_recursion_stop
  }
\cs_new:Npn \__text_expand_group:n #1
  {
    \__text_expand_store:o
      {
        \exp_after:wN
          {
            \exp:w
            \__text_expand:n {#1}
          }
      }
    \__text_expand_loop:w
  }
\exp_last_unbraced:NNo \cs_new:Npn \__text_expand_space:w \c_space_tl
  {
    \__text_expand_store:n { ~ }
    \__text_expand_loop:w
  }
\cs_new:Npx \__text_expand_N_type:N #1
  {
    \exp_not:N \__text_if_recursion_tail_stop_do:Nn #1
      { \exp_not:N \__text_expand_end:w }
    \exp_not:N \bool_lazy_any:nTF
      {
        { \exp_not:N \token_if_eq_meaning_p:NN #1 \c_space_token }
        {
          \exp_not:N \token_if_eq_meaning_p:NN #1
            \c__text_chardef_space_token
        }
        {
          \exp_not:N \token_if_eq_meaning_p:NN #1
            \c__text_mathchardef_space_token
        }
      }
      { \exp_not:N \__text_expand_space:w \c_space_tl }
      { \exp_not:N \__text_expand_N_type_auxi:N #1 }
  }
\cs_new:Npn \__text_expand_N_type_auxi:N #1
  {
    \bool_lazy_or:nnTF
      { \token_if_eq_meaning_p:NN #1 \c__text_chardef_group_begin_token }
      { \token_if_eq_meaning_p:NN #1 \c__text_mathchardef_group_begin_token }
      {
        \__text_expand_store:o \c_left_brace_str
        \__text_expand_loop:w
      }
      {
        \bool_lazy_or:nnTF
          { \token_if_eq_meaning_p:NN #1 \c__text_chardef_group_end_token }
          { \token_if_eq_meaning_p:NN #1 \c__text_mathchardef_group_end_token }
          {
            \__text_expand_store:o \c_right_brace_str
            \__text_expand_loop:w
          }
          { \__text_expand_N_type_auxii:N #1 }
      }
  }
\cs_new:Npn \__text_expand_N_type_auxii:N #1
  {
    \token_if_eq_meaning:NNTF #1 \c_group_begin_token
      {
        { \if_false: } \fi:
        \__text_expand_loop:w
      }
      {
        \token_if_eq_meaning:NNTF #1 \c_group_end_token
          {
            \if_false: { \fi: }
            \__text_expand_loop:w
          }
          { \__text_expand_N_type_auxiii:N #1 }
      }
  }
\cs_new:Npn \__text_expand_N_type_auxiii:N #1
  {
    \exp_after:wN \__text_expand_math_search:NNN
      \exp_after:wN #1 \l_text_math_delims_tl
      \q__text_recursion_tail \q__text_recursion_tail
      \q__text_recursion_stop
  }
\cs_new:Npn \__text_expand_math_search:NNN #1#2#3
  {
    \__text_if_recursion_tail_stop_do:Nn #2
      { \__text_expand_explicit:N #1 }
    \token_if_eq_meaning:NNTF #1 #2
      {
        \__text_use_i_delimit_by_q_recursion_stop:nw
           {
             \__text_expand_store:n {#1}
             \__text_expand_math_loop:Nw #3
           }
      }
      { \__text_expand_math_search:NNN #1 }
  }
\cs_new:Npn \__text_expand_math_loop:Nw #1#2 \q__text_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#2}
      { \__text_expand_math_N_type:NN }
      {
        \tl_if_head_is_group:nTF {#2}
          { \__text_expand_math_group:Nn }
          { \__text_expand_math_space:Nw }
      }
    #1#2 \q__text_recursion_stop
  }
\cs_new:Npn \__text_expand_math_N_type:NN #1#2
  {
    \__text_if_recursion_tail_stop_do:Nn #2
      { \__text_expand_end:w }
    \__text_expand_store:n {#2}
    \token_if_eq_meaning:NNTF #2 #1
      { \__text_expand_loop:w }
      { \__text_expand_math_loop:Nw #1 }
  }
\cs_new:Npn \__text_expand_math_group:Nn #1#2
  {
    \__text_expand_store:n { {#2} }
    \__text_expand_math_loop:Nw #1
  }
\exp_after:wN \cs_new:Npn \exp_after:wN \__text_expand_math_space:Nw
  \exp_after:wN # \exp_after:wN 1 \c_space_tl
  {
    \__text_expand_store:n { ~ }
    \__text_expand_math_loop:Nw #1
  }
\cs_new:Npn \__text_expand_explicit:N #1
  {
    \token_if_cs:NTF #1
      { \__text_expand_exclude:N #1 }
      {
        \__text_expand_store:n {#1}
        \__text_expand_loop:w
      }
  }
\cs_new:Npn \__text_expand_exclude:N #1
  {
    \exp_args:Ne \__text_expand_exclude:nN
      {
        \exp_not:V \l_text_math_arg_tl
        \exp_not:V \l_text_accents_tl
        \exp_not:V \l_text_expand_exclude_tl
      }
    #1
  }
\cs_new:Npn \__text_expand_exclude:nN #1#2
  {
    \__text_expand_exclude:NN #2 #1
      \q__text_recursion_tail \q__text_recursion_stop
  }
\cs_new:Npn \__text_expand_exclude:NN #1#2
  {
    \__text_if_recursion_tail_stop_do:Nn #2
      { \__text_expand_letterlike:N #1 }
    \str_if_eq:nnTF {#1} {#2}
      {
        \__text_use_i_delimit_by_q_recursion_stop:nw
          { \__text_expand_exclude:Nn #1 }
      }
      { \__text_expand_exclude:NN #1 }
  }
\cs_new:Npn \__text_expand_exclude:Nn #1#2
  {
    \__text_expand_store:n { #1 {#2} }
    \__text_expand_loop:w
  }
\cs_new:Npn \__text_expand_letterlike:N #1
  {
    \exp_after:wN \__text_expand_letterlike:NN \exp_after:wN
      #1 \l_text_letterlike_tl
      \q__text_recursion_tail \q__text_recursion_stop
  }
\cs_new:Npn \__text_expand_letterlike:NN #1#2
  {
    \__text_if_recursion_tail_stop_do:Nn #2
      { \__text_expand_cs:N #1 }
    \cs_if_eq:NNTF #2 #1
      {
        \__text_use_i_delimit_by_q_recursion_stop:nw
          {
            \__text_expand_store:n {#1}
            \__text_expand_loop:w
          }
      }
      { \__text_expand_letterlike:NN #1 }
  }
\cs_new:Npx \__text_expand_cs:N #1
  {
    \exp_not:N \str_if_eq:nnTF {#1} { \exp_not:N \protect }
      { \exp_not:N \__text_expand_protect:N }
      {
        \bool_lazy_and:nnTF
          { \cs_if_exist_p:N \fmtname }
          { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
          { \exp_not:N \__text_expand_testopt:N #1 }
          { \exp_not:N \__text_expand_replace:N #1 }
      }
  }
\cs_new:Npn \__text_expand_protect:N #1
  {
    \exp_args:Ne \__text_expand_protect:nN
      { \cs_to_str:N #1 } #1
  }
\cs_new:Npn \__text_expand_protect:nN #1#2
  { \__text_expand_protect:Nw #2 #1 \q__text_nil #1 ~ \q__text_nil \q__text_nil \s__text_stop }
\cs_new:Npn \__text_expand_protect:Nw #1 #2 ~ \q__text_nil #3 \q__text_nil #4 \s__text_stop
  {
    \__text_quark_if_nil:nTF {#4}
      {
        \cs_if_exist:cTF {#2}
          { \exp_args:Ne \__text_expand_store:n { \exp_not:c {#2} } }
          { \__text_expand_store:n { \protect #1 } }
      }
      { \__text_expand_store:n { \protect #1 } }
    \__text_expand_loop:w
  }
\cs_new:Npn \__text_expand_testopt:N #1
  {
    \str_if_eq:nnTF {#1} { \@protected@testopt }
      { \__text_expand_testopt:NNn }
      { \__text_expand_encoding:N #1 }
  }
\cs_new:Npn \__text_expand_testopt:NNn #1#2#3
  {
    \__text_expand_store:n {#1}
    \__text_expand_loop:w
  }
\cs_new:Npn \__text_expand_encoding:N #1
  {
    \bool_lazy_or:nnTF
      { \cs_if_eq_p:NN  #1 \@current@cmd }
      { \cs_if_eq_p:NN  #1 \@changed@cmd }
      { \exp_after:wN \__text_expand_loop:w \__text_expand_encoding_escape:NN }
      { \__text_expand_replace:N #1 }
  }
\cs_new:Npn \__text_expand_encoding_escape:NN #1#2 { \exp_not:n {#1} }
\cs_new:Npn \__text_expand_replace:N #1
  {
    \bool_lazy_and:nnTF
      { \cs_if_exist_p:c { l__text_expand_ \token_to_str:N #1 _tl } }
      {
        \bool_lazy_or_p:nn
          { \token_if_cs_p:N #1 }
          { \token_if_active_p:N #1 }
      }
      {
        \exp_args:Nv \__text_expand_replace:n
          { l__text_expand_ \token_to_str:N #1 _tl }
      }
      { \__text_expand_cs_expand:N #1 }
  }
\cs_new:Npn \__text_expand_replace:n #1 { \__text_expand_loop:w #1 }
\cs_new:Npn \__text_expand_cs_expand:N #1
  {
    \__text_if_expandable:NTF #1
      {
        \token_if_eq_meaning:NNTF #1 \exp_not:n
          { \__text_expand_noexpand:w }
          { \exp_after:wN \__text_expand_loop:w #1 }
      }
      {
        \__text_expand_store:n {#1}
        \__text_expand_loop:w
      }
  }
\cs_new:Npn \__text_expand_noexpand:w #1#
  { \__text_expand_noexpand:nn {#1} }
\cs_new:Npn \__text_expand_noexpand:nn #1#2
  {
    #1 \__text_expand_store:n #1 {#2}
    \__text_expand_loop:w
  }
\cs_new_protected:Npn \text_declare_expand_equivalent:Nn #1#2
  {
    \tl_clear_new:c { l__text_expand_ \token_to_str:N #1 _tl }
    \tl_set:cn { l__text_expand_ \token_to_str:N #1 _tl } {#2}
  }
\cs_generate_variant:Nn \text_declare_expand_equivalent:Nn { c }
%% File: l3text-case.dtx
\bool_new:N \l_text_titlecase_check_letter_bool
\bool_set_true:N \l_text_titlecase_check_letter_bool
\cs_new:Npn \text_lowercase:n #1
  { \__text_change_case:nnn { lower } { } {#1} }
\cs_new:Npn \text_uppercase:n #1
  { \__text_change_case:nnn { upper } { } {#1} }
\cs_new:Npn \text_titlecase:n #1
  { \__text_change_case:nnn { title } { } {#1} }
\cs_new:Npn \text_titlecase_first:n #1
  { \__text_change_case:nnn { titleonly } { } {#1} }
\cs_new:Npn \text_lowercase:nn #1#2
  { \__text_change_case:nnn { lower } {#1} {#2} }
\cs_new:Npn \text_uppercase:nn #1#2
  { \__text_change_case:nnn { upper } {#1} {#2} }
\cs_new:Npn \text_titlecase:nn #1#2
  { \__text_change_case:nnn { title } {#1} {#2} }
\cs_new:Npn \text_titlecase_first:nn #1#2
  { \__text_change_case:nnn { titleonly } {#1} {#2} }
\cs_new:Npn \__text_change_case:nnn #1#2#3
  {
     \__kernel_exp_not:w \exp_after:wN
      {
        \exp:w
        \exp_args:Ne \__text_change_case_aux:nnn
          { \text_expand:n {#3} }
          {#1} {#2}
      }
  }
\cs_new:Npn \__text_change_case_aux:nnn #1#2#3
  {
    \group_align_safe_begin:
    \cs_if_exist_use:c { __text_change_case_boundary_ #2 _ #3 :Nnnw }
    \__text_change_case_loop:nnw {#2} {#3} #1
      \q__text_recursion_tail \q__text_recursion_stop
    \__text_change_case_result:n { }
  }
\cs_new:Npn \__text_change_case_store:n #1
  { \__text_change_case_store:nw {#1} }
\cs_generate_variant:Nn \__text_change_case_store:n { o , e , V , v }
\cs_new:Npn \__text_change_case_store:nw #1#2 \__text_change_case_result:n #3
  { #2 \__text_change_case_result:n { #3 #1 } }
\cs_new:Npn \__text_change_case_end:w #1 \__text_change_case_result:n #2
  {
    \group_align_safe_end:
    \exp_end:
    #2
  }
\cs_new:Npn \__text_change_case_loop:nnw #1#2#3 \q__text_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#3}
      { \__text_change_case_N_type:nnN }
      {
        \tl_if_head_is_group:nTF {#3}
          { \use:c { __text_change_case_group_ #1 :nnn } }
          { \__text_change_case_space:nnw }
      }
    {#1} {#2} #3 \q__text_recursion_stop
  }
\cs_new:Npn \__text_change_case_break:w #1 \q__text_recursion_tail \q__text_recursion_stop
  {
    \__text_change_case_store:n {#1}
    \__text_change_case_end:w
  }
\cs_new:Npn \__text_change_case_group_lower:nnn #1#2#3
  {
    \__text_change_case_store:o
      {
        \exp_after:wN
          {
            \exp:w
            \__text_change_case_aux:nnn {#3} {#1} {#2}
          }
      }
    \__text_change_case_loop:nnw {#1} {#2}
  }
\cs_new_eq:NN \__text_change_case_group_upper:nnn
  \__text_change_case_group_lower:nnn
\cs_new:Npn \__text_change_case_group_title:nnn #1#2#3
  {
    \__text_change_case_store:o
      {
        \exp_after:wN
          {
            \exp:w
            \__text_change_case_aux:nnn {#3} {#1} {#2}
          }
      }
    \__text_change_case_loop:nnw { lower } {#2}
  }
\cs_new:Npn \__text_change_case_group_titleonly:nnn #1#2#3
  {
    \__text_change_case_store:o
      {
        \exp_after:wN
          {
            \exp:w
            \__text_change_case_aux:nnn {#3} {#1} {#2}
          }
      }
    \__text_change_case_break:w
  }
\use:x
  {
    \cs_new:Npn \exp_not:N \__text_change_case_space:nnw ##1##2 \c_space_tl
  }
  {
    \__text_change_case_store:n { ~ }
    \cs_if_exist_use:c { __text_change_case_boundary_ #1 _ #2 :Nnnw }
    \__text_change_case_loop:nnw {#1} {#2}
  }
\cs_new:Npn \__text_change_case_N_type:nnN #1#2#3
  {
    \__text_if_recursion_tail_stop_do:Nn #3
      { \__text_change_case_end:w }
    \__text_change_case_N_type_aux:nnN {#1} {#2} #3
  }
\cs_new:Npn \__text_change_case_N_type_aux:nnN #1#2#3
  {
    \exp_args:NV \__text_change_case_N_type:nnnN
      \l_text_math_delims_tl {#1} {#2} #3
  }
\cs_new:Npn \__text_change_case_N_type:nnnN #1#2#3#4
  {
    \__text_change_case_math_search:nnNNN {#2} {#3} #4 #1
      \q__text_recursion_tail \q__text_recursion_tail
      \q__text_recursion_stop
  }
\cs_new:Npn \__text_change_case_math_search:nnNNN #1#2#3#4#5
  {
    \__text_if_recursion_tail_stop_do:Nn #4
      { \__text_change_case_cs_check:nnN {#1} {#2} #3 }
    \token_if_eq_meaning:NNTF #3 #4
      {
        \__text_use_i_delimit_by_q_recursion_stop:nw
           {
             \__text_change_case_store:n {#3}
             \__text_change_case_math_loop:nnNw {#1} {#2} #5
           }
      }
      { \__text_change_case_math_search:nnNNN {#1} {#2} #3 }
  }
\cs_new:Npn \__text_change_case_math_loop:nnNw #1#2#3#4 \q__text_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#4}
      { \__text_change_case_math_N_type:nnNN }
      {
        \tl_if_head_is_group:nTF {#4}
          { \__text_change_case_math_group:nnNn }
          { \__text_change_case_math_space:nnNw }
      }
    {#1} {#2} #3 #4 \q__text_recursion_stop
  }
\cs_new:Npn \__text_change_case_math_N_type:nnNN #1#2#3#4
  {
    \__text_if_recursion_tail_stop_do:Nn #4
      { \__text_change_case_end:w }
    \__text_change_case_store:n {#4}
    \token_if_eq_meaning:NNTF #4 #3
      { \__text_change_case_loop:nnw {#1} {#2} }
      { \__text_change_case_math_loop:nnNw {#1} {#2} #3 }
  }
\cs_new:Npn \__text_change_case_math_group:nnNn #1#2#3#4
  {
    \__text_change_case_store:n { {#4} }
    \__text_change_case_math_loop:nnNw {#1} {#2} #3
  }
\use:x
  {
    \cs_new:Npn \exp_not:N \__text_change_case_math_space:nnNw ##1##2##3
      \c_space_tl
  }
  {
    \__text_change_case_store:n { ~ }
    \__text_change_case_math_loop:nnNw {#1} {#2} #3
  }
\cs_new:Npn \__text_change_case_cs_check:nnN #1#2#3
  {
    \token_if_cs:NTF #3
      { \__text_change_case_exclude:nnN }
      { \use:c { __text_change_case_char_ #1 :nnN } }
        {#1} {#2} #3
  }
\cs_new:Npn \__text_change_case_exclude:nnN #1#2#3
  {
    \exp_args:Ne \__text_change_case_exclude:nnnN
      {
        \exp_not:V \l_text_math_arg_tl
        \exp_not:V \l_text_case_exclude_arg_tl
      }
      {#1} {#2} #3
  }
\cs_new:Npn \__text_change_case_exclude:nnnN #1#2#3#4
  {
    \__text_change_case_exclude:nnNN {#2} {#3} #4 #1
      \q__text_recursion_tail \q__text_recursion_stop
  }
\cs_new:Npn \__text_change_case_exclude:nnNN #1#2#3#4
  {
    \__text_if_recursion_tail_stop_do:Nn #4
      { \use:c { __text_change_case_letterlike_ #1 :nnN } {#1} {#2} #3 }
    \str_if_eq:nnTF {#3} {#4}
      {
        \__text_use_i_delimit_by_q_recursion_stop:nw
          { \__text_change_case_exclude:nnNn {#1} {#2} #3 }
      }
      { \__text_change_case_exclude:nnNN {#1} {#2} #3 }
  }
\cs_new:Npn \__text_change_case_exclude:nnNn #1#2#3#4
  {
    \__text_change_case_store:n { #3 {#4} }
    \__text_change_case_loop:nnw {#1} {#2}
  }
\cs_new:Npn \__text_change_case_letterlike_lower:nnN #1#2#3
  { \__text_change_case_letterlike:nnnnN {#1} {#1} {#1} {#2} #3 }
\cs_new_eq:NN \__text_change_case_letterlike_upper:nnN
  \__text_change_case_letterlike_lower:nnN
\cs_new:Npn \__text_change_case_letterlike_title:nnN #1#2#3
  { \__text_change_case_letterlike:nnnnN { upper } { lower } {#1} {#2} #3 }
\cs_new:Npn \__text_change_case_letterlike_titleonly:nnN #1#2#3
  { \__text_change_case_letterlike:nnnnN { upper } { end } {#1} {#2} #3 }
\cs_new:Npn \__text_change_case_letterlike:nnnnN #1#2#3#4#5
  {
    \cs_if_exist:cTF { c__text_ #1 case_ \token_to_str:N #5 _tl }
      {
        \__text_change_case_store:v
          { c__text_ #1 case_ \token_to_str:N #5 _tl }
         \use:c { __text_change_case_char_next_ #2 :nn } {#2} {#4}
      }
      {
        \__text_change_case_store:n {#5}
        \cs_if_exist:cTF
          {
            c__text_
            \str_if_eq:nnTF {#1} { lower } { upper } { lower }
            case_ \token_to_str:N #5 _tl
          }
          { \use:c { __text_change_case_char_next_ #2 :nn } {#2} {#4} }
          { \__text_change_case_loop:nnw {#3} {#4} }
      }
  }
\cs_new:Npn \__text_change_case_char_lower:nnN #1#2#3
  {
    \cs_if_exist_use:cF { __text_change_case_lower_ #2 :nnnN }
      { \__text_change_case_lower_sigma:nnnN }
        {#1} {#1} {#2} #3
  }
\cs_new:Npn \__text_change_case_char_upper:nnN #1#2#3
  {
    \cs_if_exist_use:cF { __text_change_case_upper_ #2 :nnnN }
      { \__text_change_case_char:nnnN }
        {#1} {#1} {#2} #3
  }
\bool_lazy_or:nnTF
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new:Npn \__text_change_case_lower_sigma:nnnN #1#2#3#4
      {
        \int_compare:nNnTF { `#4 } = { "03A3 }
          { \__text_change_case_lower_sigma:nnNw {#2} {#3} #4 }
          { \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
      }
    \cs_new:Npn \__text_change_case_lower_sigma:nnNw #1#2#3#4 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#4}
          { \__text_change_case_lower_sigma:NnnN #3 }
          {
            \__text_change_case_store:e
              { \char_generate:nn { "03C2 } { \__text_char_catcode:N #3 } }
            \__text_change_case_loop:nnw
          }
            {#1} {#2} #4 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_lower_sigma:NnnN #1#2#3#4
      {
        \__text_change_case_store:e
          {
            \token_if_letter:NTF #4
              { \char_generate:nn { "03C3 } { \__text_char_catcode:N #1 } }
              { \char_generate:nn { "03C2 } { \__text_char_catcode:N #1 } }
          }
        \__text_change_case_loop:nnw {#2} {#3} #4
      }
  }
  {
    \cs_new:Npn \__text_change_case_lower_sigma:nnnN #1#2#3#4
      {
        \int_compare:nNnTF { `#4 } = { "CE }
          { \__text_change_case_lower_sigma:nnnNN  }
          { \__text_change_case_char:nnnN }
            {#1} {#2} {#3} #4
      }
    \cs_new:Npn \__text_change_case_lower_sigma:nnnNN #1#2#3#4#5
      {
        \int_compare:nNnTF { `#5 } = { "A3 }
          { \__text_change_case_lower_sigma:nnw {#2} {#3}  }
          { \__text_change_case_char:nnnN {#1} {#2} {#3} #4#5 }
      }
    \cs_new:Npn \__text_change_case_lower_sigma:nnw #1#2#3 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#3}
          { \__text_change_case_lower_sigma:nnN }
          {
            \__text_change_case_store:V \c__text_final_sigma_tl
            \__text_change_case_loop:nnw
          }
        {#1} {#2} #3 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_lower_sigma:nnN #1#2#3
      {
        \bool_lazy_or:nnTF
          { \token_if_letter_p:N #3 }
          {
            \bool_lazy_and_p:nn
              { \token_if_active_p:N #3 }
              { \int_compare_p:nNn { `#3 } > { "80 } }
          }
          { \__text_change_case_store:V \c__text_sigma_tl }
          { \__text_change_case_store:V \c__text_final_sigma_tl }
        \__text_change_case_loop:nnw {#1} {#2} #3
      }
  }
\cs_new:Npx \__text_change_case_char_title:nnN #1#2#3
  {
    \exp_not:N \bool_if:NTF \l_text_titlecase_check_letter_bool
      {
        \bool_lazy_or:nnTF
          { \sys_if_engine_luatex_p: }
          { \sys_if_engine_xetex_p: }
          { \exp_not:N \token_if_letter:NTF #3 }
          {
            \exp_not:N \bool_lazy_or:nnTF
              { \exp_not:N \token_if_letter_p:N #3 }
              { \exp_not:N \token_if_active_p:N #3 }
          }
          { \exp_not:N \use:c { __text_change_case_char_ #1 :nN } }
          { \exp_not:N \__text_change_case_char_title:nnnN { title } {#1} }
      }
      { \exp_not:N \use:c { __text_change_case_char_ #1 :nN } }
        {#2} #3
  }
\cs_new_eq:NN \__text_change_case_char_titleonly:nnN
  \__text_change_case_char_title:nnN
\cs_new:Npn \__text_change_case_char_title:nN #1#2
  { \__text_change_case_char_title:nnnN { title } { lower } {#1} #2 }
\cs_new:Npn \__text_change_case_char_titleonly:nN #1#2
  { \__text_change_case_char_title:nnnN { title } { end } {#1} #2 }
\cs_new:Npn \__text_change_case_char_title:nnnN #1#2#3#4
  {
    \cs_if_exist_use:cF { __text_change_case_title_ #3 :nnnN }
      {
        \cs_if_exist_use:cF { __text_change_case_upper_ #3 :nnnN }
          { \__text_change_case_char:nnnN }
      }
        {#1} {#2} {#3} #4
  }
\cs_new:Npn \__text_change_case_char:nnnN #1#2#3#4
  {
    \token_if_active:NTF #4
      { \__text_change_case_store:n {#4} }
      {
        \__text_change_case_store:e
          { \use:c { char_ #1 case :N } #4 }
      }
    \use:c { __text_change_case_char_next_ #2 :nn } {#2} {#3}
  }
\bool_lazy_or:nnF
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new_eq:NN \__text_change_case_char_aux:nnnN
      \__text_change_case_char:nnnN
    \cs_gset:Npn \__text_change_case_char:nnnN #1#2#3#4
      {
        \int_compare:nNnTF { `#4 } > { "80 }
          {
            \int_compare:nNnTF { `#4 } < { "E0 }
              { \__text_change_case_char_UTFviii:nnnNN }
              {
                \int_compare:nNnTF { `#4 } < { "F0 }
                  { \__text_change_case_char_UTFviii:nnnNNN }
                  { \__text_change_case_char_UTFviii:nnnNNNN }
              }
                {#1} {#2} {#3} #4
          }
          { \__text_change_case_char_aux:nnnN {#1} {#2} {#3} #4 }
       }
    \cs_new:Npn \__text_change_case_char_UTFviii:nnnNN #1#2#3#4#5
      { \__text_change_case_char_UTFviii:nnnn {#1} {#2} {#3} {#4#5} }
    \cs_new:Npn \__text_change_case_char_UTFviii:nnnNNN #1#2#3#4#5#6
      { \__text_change_case_char_UTFviii:nnnn {#1} {#2} {#3} {#4#5#6} }
    \cs_new:Npn \__text_change_case_char_UTFviii:nnnNNNNN #1#2#3#4#5#6#7
      { \__text_change_case_char_UTFviii:nnnn {#1} {#2} {#3} {#4#5#6#7} }
    \cs_new:Npn \__text_change_case_char_UTFviii:nnnn #1#2#3#4
      {
        \cs_if_exist:cTF { c__text_ #1 case_ \tl_to_str:n {#4} _tl }
          {
            \__text_change_case_store:v
              { c__text_ #1 case_ \tl_to_str:n {#4} _tl }
          }
          { \__text_change_case_store:n {#4} }
        \use:c { __text_change_case_char_next_ #2 :nn } {#2} {#3}
      }
  }
\cs_new:Npn \__text_change_case_char_next_lower:nn #1#2
  { \__text_change_case_loop:nnw {#1} {#2} }
\cs_new_eq:NN \__text_change_case_char_next_upper:nn
  \__text_change_case_char_next_lower:nn
\cs_new_eq:NN \__text_change_case_char_next_title:nn
  \__text_change_case_char_next_lower:nn
\cs_new_eq:NN \__text_change_case_char_next_titleonly:nn
  \__text_change_case_char_next_lower:nn
\cs_new:Npn \__text_change_case_char_next_end:nn #1#2
  { \__text_change_case_break:w }
\bool_lazy_or:nnTF
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new:cpn { __text_change_case_upper_de-alt:nnnN } #1#2#3#4
      {
        \int_compare:nNnTF { `#4 } = { "00DF }
          {
            \__text_change_case_store:e
             { \char_generate:nn { "1E9E } { \__text_char_catcode:N #4 } }
            \use:c { __text_change_case_char_next_ #2 :nn }
              {#2} {#3}
          }
          { \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
      }
  }
  {
    \cs_new:cpx { __text_change_case_upper_de-alt:nnnN } #1#2#3#4
      {
        \exp_not:N \int_compare:nNnTF { `#4 } = { "00C3 }
          {
            \exp_not:c { __text_change_case_upper_de-alt:nnnNN }
              {#1} {#2} {#3} #4
          }
          { \exp_not:N \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
      }
    \cs_new:cpn { __text_change_case_upper_de-alt:nnnNN } #1#2#3#4#5
      {
        \int_compare:nNnTF { `#5 } = { "009F }
          {
            \__text_change_case_store:V \c__text_grosses_Eszett_tl
            \use:c { __text_change_case_char_next_ #2 :nn } {#2} {#3}
          }
          { \__text_change_case_char:nnnN {#1} {#2} {#3} #4#5 }
      }
  }
\bool_lazy_or:nnT
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new:Npn \__text_change_case_upper_el:nnnN #1#2#3#4
      {
        \__text_change_case_if_greek:nTF { `#4 }
          {
            \exp_args:Ne \__text_change_case_upper_el:nnn
              { \char_to_nfd:N #4 } {#2} {#3}
          }
          { \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
      }
    \cs_new:Npn \__text_change_case_upper_el:nnn #1#2#3
      { \__text_change_case_upper_el:nnNw {#2} {#3} #1 }
    \cs_new:Npn \__text_change_case_upper_el:nnNw #1#2#3#4 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#4}
          { \__text_change_case_upper_el:NnnN #3 }
          {
            \__text_change_case_store:e { \char_uppercase:N #3 }
            \__text_change_case_loop:nnw
          }
            {#1} {#2} #4 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_upper_el:NnnN #1#2#3#4
      {
        \token_if_cs:NTF #4
          {
            \__text_change_case_store:e { \char_uppercase:N #1 }
            \__text_change_case_loop:nnw {#2} {#3} #4
          }
          {
            \int_compare:nNnTF { `#4 } = { "0308 }
              { \__text_change_case_upper_el_dialytika:nnN {#2} {#3} #1 }
              {
                 \__text_change_case_if_greek_accent:nTF { `#4 }
                  { \__text_change_case_upper_el_hiatus:nnNw {#2} {#3} #1 }
                  {
                    \__text_change_case_if_greek_diacritic:nTF { `#4 }
                      {
                        \__text_change_case_store:e { \char_uppercase:N #1 }
                        \__text_change_case_loop:nnw {#2} {#3}
                      }
                      {
                        \__text_change_case_store:e { \char_uppercase:N #1 }
                        \__text_change_case_loop:nnw {#2} {#3} #4
                      }
                  }
              }
          }
      }
    \cs_new:Npn \__text_change_case_upper_el_dialytika:nnN #1#2#3
      {
        \__text_change_case_if_takes_dialytika:nTF { `#3 }
          { \__text_change_case_upper_el_dialytika:N #3 }
          { \__text_change_case_store:e { \char_uppercase:N #3 } }
        \__text_change_case_upper_el_gobble:nnw {#1} {#2}
      }
    \cs_new:Npn \__text_change_case_upper_el_dialytika:N #1
      {
        \__text_change_case_store:e
          {
            \bool_lazy_or:nnTF
              { \int_compare_p:nNn { `#1 } = { "0399 } }
              { \int_compare_p:nNn { `#1 } = { "03B9 } }
              { \char_generate:nn { "03AA } { \__text_char_catcode:N #1 } }
              { \char_generate:nn { "03AB } { \__text_char_catcode:N #1 } }
          }
      }
    \cs_new:Npn \__text_change_case_upper_el_hiatus:nnNw
      #1#2#3#4 \q__text_recursion_stop
      {
        \__text_change_case_store:e { \char_uppercase:N #3 }
        \tl_if_head_is_N_type:nTF {#4}
          { \__text_change_case_upper_el_hiatus:nnN }
          { \__text_change_case_loop:nnw }
            {#1} {#2} #4 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_upper_el_hiatus:nnN #1#2#3
      {
        \token_if_cs:NTF #3
          { \__text_change_case_loop:nnw {#1} {#2} #3 }
          {
            \__text_change_case_if_takes_dialytika:nTF { `#3 }
              {
                \__text_change_case_upper_el_dialytika:N #3
                \__text_change_case_upper_el_gobble:nnw {#1} {#2}
              }
              { \__text_change_case_loop:nnw {#1} {#2} #3 }
          }
      }
    \cs_new:Npn \__text_change_case_upper_el_gobble:nnw
      #1#2#3 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#3}
          { \__text_change_case_upper_el_gobble:nnN }
          { \__text_change_case_loop:nnw }
            {#1} {#2} #3 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_upper_el_gobble:nnN #1#2#3
      {
        \bool_lazy_or:nnTF
          { \token_if_cs_p:N #3 }
          {
            ! \bool_lazy_or_p:nn
              { \__text_change_case_if_greek_accent_p:n { `#3 } }
              { \__text_change_case_if_greek_diacritic_p:n { `#3 } }
          }
          { \__text_change_case_loop:nnw {#1} {#2} #3 }
          { \__text_change_case_upper_el_gobble:nnw {#1} {#2} }
      }
  }
\prg_new_conditional:Npnn \__text_change_case_if_greek:n #1 { TF }
  {
    \if_int_compare:w #1 < "0370 \exp_stop_f:
      \prg_return_false:
    \else:
      \if_int_compare:w #1 > "03FF \exp_stop_f:
        \if_int_compare:w #1 < "1F00 \exp_stop_f:
          \prg_return_false:
        \else:
          \if_int_compare:w #1 > "1FFF \exp_stop_f:
            \prg_return_false:
          \else:
            \prg_return_true:
          \fi:
        \fi:
      \else:
        \prg_return_true:
      \fi:
    \fi:
  }
\prg_new_conditional:Npnn \__text_change_case_if_greek_accent:n #1 { TF , p }
  {
    \if_int_compare:w #1 = "0300 \exp_stop_f:
      \prg_return_true:
    \else:
      \if_int_compare:w #1 = "0301 \exp_stop_f:
        \prg_return_true:
      \else:
        \if_int_compare:w #1 = "0342 \exp_stop_f:
          \prg_return_true:
        \else:
          \if_int_compare:w #1 = "0302 \exp_stop_f:
            \prg_return_true:
          \else:
            \if_int_compare:w #1 = "0303 \exp_stop_f:
              \prg_return_true:
            \else:
              \if_int_compare:w #1 = "0311 \exp_stop_f:
                \prg_return_true:
              \else:
                \prg_return_false:
              \fi:
            \fi:
          \fi:
        \fi:
      \fi:
    \fi:
  }
\prg_new_conditional:Npnn \__text_change_case_if_greek_diacritic:n
  #1 { TF , p }
  {
    \if_int_compare:w #1 = "0304 \exp_stop_f:
      \prg_return_true:
    \else:
      \if_int_compare:w #1 = "0306 \exp_stop_f:
        \prg_return_true:
      \else:
        \if_int_compare:w #1 = "0313 \exp_stop_f:
          \prg_return_true:
        \else:
          \if_int_compare:w #1 = "0314 \exp_stop_f:
            \prg_return_true:
          \else:
            \if_int_compare:w #1 = "0343 \exp_stop_f:
              \prg_return_true:
            \else:
              \prg_return_false:
            \fi:
          \fi:
        \fi:
      \fi:
    \fi:
  }
\prg_new_conditional:Npnn \__text_change_case_if_takes_dialytika:n #1 { TF }
  {
    \if_int_compare:w #1 = "0399 \exp_stop_f:
      \prg_return_true:
    \else:
      \if_int_compare:w #1 = "03B9 \exp_stop_f:
        \prg_return_true:
      \else:
        \if_int_compare:w #1 = "03A5 \exp_stop_f:
          \prg_return_true:
        \else:
          \if_int_compare:w #1 = "03C5 \exp_stop_f:
            \prg_return_true:
          \else:
            \prg_return_false:
          \fi:
        \fi:
      \fi:
    \fi:
   }
\bool_lazy_or:nnT
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new:Npn \__text_change_case_boundary_upper_el:Nnnw
      #1#2#3#4 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#4}
          { \__text_change_case_boundary_upper_el:nnN }
          { \__text_change_case_loop:nnw }
            {#2} {#3} #4 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_boundary_upper_el:nnN #1#2#3
      {
        \bool_lazy_or:nnTF
          { \token_if_cs_p:N #3 }
          {
            ! \bool_lazy_or_p:nn
              { \int_compare_p:nNn { `#3 } = { "03AE } }
              { \int_compare_p:nNn { `#3 } = { "1F22 } }
          }
          { \__text_change_case_loop:nnw }
          { \__text_change_case_boundary_upper_el:nnNw }
            {#1} {#2} #3
      }
    \cs_new:Npn \__text_change_case_boundary_upper_el:nnNw
      #1#2#3#4 \q__text_recursion_stop
       {
        \tl_if_head_is_N_type:nTF {#4}
          { \__text_change_case_boundary_upper_el:NnnN #3 }
          {
            \__text_change_case_store:e
              { \char_generate:nn { "0389 } { \__text_char_catcode:N #3 } }
            \__text_change_case_loop:nnw
          }
            {#1} {#2} #4 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_boundary_upper_el:NnnN #1#2#3#4
      {
        \token_if_letter:NTF #4
          { \__text_change_case_loop:nnw {#2} {#3} #1#4 }
          {
            \__text_change_case_store:e
              { \char_generate:nn { "0389 } { \__text_char_catcode:N #1 } }
            \__text_change_case_loop:nnw {#2} {#3} #4
          }
      }
  }
\bool_lazy_or:nnT
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new:Npn \__text_change_case_title_el:nnnN #1#2#3#4
      { \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
  }
\bool_lazy_or:nnT
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
   \cs_new:Npn \__text_change_case_lower_lt:nnnN #1#2#3#4
     {
        \exp_args:Ne \__text_change_case_lower_lt_auxi:nnnN
          {
            \int_case:nn { `#4 }
              {
                { "00CC } { "0300 }
                { "00CD } { "0301 }
                { "0128 } { "0303 }
              }
          }
            {#2} {#3} #4
      }
    \cs_new:Npn \__text_change_case_lower_lt_auxi:nnnN #1#2#3#4
      {
        \tl_if_blank:nTF {#1}
          {
            \exp_args:Ne \__text_change_case_lower_lt_auxii:nnnN
              {
                \int_case:nn { `#4 }
                  {
                    { "0049 } { "0069 }
                    { "004A } { "006A }
                    { "012E } { "012F }
                  }
              }
              {#2} {#3} #4
          }
          {
            \__text_change_case_store:e
              {
                \char_generate:nn { "0069 } { \__text_char_catcode:N #4 }
                \char_generate:nn { "0307 } { \__text_char_catcode:N #4 }
                \char_generate:nn {#1} { \__text_char_catcode:N #4 }
              }
            \__text_change_case_loop:nnw {#2} {#3}
          }
      }
    \cs_new:Npn \__text_change_case_lower_lt_auxii:nnnN #1#2#3#4
      {
        \tl_if_blank:nTF {#1}
          { \__text_change_case_lower_sigma:nnnN {#2} {#2} {#3} #4 }
          {
            \__text_change_case_store:e
              { \char_generate:nn {#1} { \__text_char_catcode:N #4 } }
            \__text_change_case_lower_lt:nnw {#2} {#3}
          }
      }
    \cs_new:Npn \__text_change_case_lower_lt:nnw #1#2#3 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#3}
          { \__text_change_case_lower_lt:nnN }
          { \__text_change_case_loop:nnw }
           {#1} {#2} #3 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_lower_lt:nnN #1#2#3
      {
        \bool_lazy_and:nnT
          { ! \token_if_cs_p:N #3 }
          {
            \bool_lazy_any_p:n
              {
                { \int_compare_p:nNn { `#3 } = { "0300 } }
                { \int_compare_p:nNn { `#3 } = { "0301 } }
                { \int_compare_p:nNn { `#3 } = { "0303 } }
              }
          }
          {
            \__text_change_case_store:e
              { \char_generate:nn { "0307 } { \__text_char_catcode:N #3 } }
          }
        \__text_change_case_loop:nnw {#1} {#2} #3
      }
  }
\bool_lazy_or:nnT
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
   \cs_new:Npn \__text_change_case_upper_lt:nnnN #1#2#3#4
     {
        \exp_args:Ne \__text_change_case_upper_lt_aux:nnnN
          {
            \int_case:nn { `#4 }
              {
                { "0069 } { "0049 }
                { "006A } { "004A }
                { "012F } { "012E }
              }
          }
            {#2} {#3} #4
      }
   \cs_new:Npn \__text_change_case_upper_lt_aux:nnnN #1#2#3#4
     {
       \tl_if_blank:nTF {#1}
         { \__text_change_case_char:nnnN { upper } {#2} {#3} #4 }
         {
           \__text_change_case_store:e
             { \char_generate:nn {#1} { \__text_char_catcode:N #4 } }
           \__text_change_case_upper_lt:nnw {#2} {#3}
         }
     }
    \cs_new:Npn \__text_change_case_upper_lt:nnw #1#2#3 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#3}
          { \__text_change_case_upper_lt:nnN }
          { \use:c { __text_change_case_char_next_ #1 :nn } }
            {#1} {#2} #3 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_upper_lt:nnN #1#2#3
      {
        \bool_lazy_and:nnTF
          { ! \token_if_cs_p:N #3 }
          { \int_compare_p:nNn { `#3 } = { "0307 } }
          { \use:c { __text_change_case_char_next_ #1 :nn } {#1} {#2} }
          { \use:c { __text_change_case_char_next_ #1 :nn } {#1} {#2} #3 }
      }
  }
\cs_new:Npn \__text_change_case_title_nl:nnnN #1#2#3#4
  {
    \bool_lazy_or:nnTF
      { \int_compare_p:nNn { `#4 } = { "0049 } }
      { \int_compare_p:nNn { `#4 } = { "0069 } }
      {
        \__text_change_case_store:e
          { \char_generate:nn { "0049 } { \__text_char_catcode:N #4 } }
        \__text_change_case_title_nl:nnw {#2} {#3}
      }
      { \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
  }
\cs_new:Npn \__text_change_case_title_nl:nnw #1#2#3 \q__text_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#3}
      { \__text_change_case_title_nl:nnN }
      { \use:c { __text_change_case_char_next_ #1 :nn } }
        {#1} {#2} #3 \q__text_recursion_stop
  }
\cs_new:Npn \__text_change_case_title_nl:nnN #1#2#3
  {
    \bool_lazy_and:nnTF
      { ! \token_if_cs_p:N #3 }
      {
        \bool_lazy_or_p:nn
          { \int_compare_p:nNn { `#3 } = { "004A } }
          { \int_compare_p:nNn { `#3 } = { "006A } }
      }
      {
        \__text_change_case_store:e
          { \char_generate:nn { "004A } { \__text_char_catcode:N #3 } }
        \use:c { __text_change_case_char_next_ #1 :nn } {#1} {#2}
      }
      { \use:c { __text_change_case_char_next_ #1 :nn } {#1} {#2} #3 }
  }
\bool_lazy_or:nnTF
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_new:Npn \__text_change_case_lower_tr:nnnN #1#2#3#4
      {
        \int_compare:nNnTF { `#4 } = { "0049 }
          { \__text_change_case_lower_tr:nnNw {#1} {#3} #4 }
          {
            \int_compare:nNnTF { `#4 } = { "0130 }
              {
                \__text_change_case_store:e
                  { \char_generate:nn { "0069 } { \__text_char_catcode:N #4 } }
                \__text_change_case_loop:nnw {#1} {#3}
              }
              { \__text_change_case_lower_sigma:nnnN {#1} {#2} {#3} #4 }
          }
      }
    \cs_new:Npn \__text_change_case_lower_tr:nnNw #1#2#3#4 \q__text_recursion_stop
      {
        \tl_if_head_is_N_type:nTF {#4}
          { \__text_change_case_lower_tr:NnnN #3 }
          {
            \__text_change_case_store:e
              { \char_generate:nn { "0131 } { \__text_char_catcode:N #3 } }
            \__text_change_case_loop:nnw
          }
            {#1} {#2} #4 \q__text_recursion_stop
      }
    \cs_new:Npn \__text_change_case_lower_tr:NnnN #1#2#3#4
      {
        \bool_lazy_or:nnTF
          { \token_if_cs_p:N #4 }
          { ! \int_compare_p:nNn { `#4 } = { "0307 } }
          {
            \__text_change_case_store:e
              { \char_generate:nn { "0131 } { \__text_char_catcode:N #1 } }
            \__text_change_case_loop:nnw {#2} {#3} #4
          }
          {
            \__text_change_case_store:e
              { \char_generate:nn { "0069 } { \__text_char_catcode:N #1 } }
            \__text_change_case_loop:nnw {#2} {#3}
          }
      }
  }
  {
    \cs_new:Npn \__text_change_case_lower_tr:nnnN #1#2#3#4
      {
        \int_compare:nNnTF { `#4 } = { "0049 }
          {
            \__text_change_case_store:V \c__text_dotless_i_tl
            \__text_change_case_loop:nnw {#1} {#3}
          }
          {
            \int_compare:nNnTF { `#4 } = { "00C4 }
              { \__text_change_case_lower_tr:nnnNN {#1} {#2} {#3} #4 }
              { \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
          }
      }
    \cs_new:Npn \__text_change_case_lower_tr:nnnNN #1#2#3#4#5
      {
        \int_compare:nNnTF { `#5 } = { "00B0 }
          {
            \__text_change_case_store:e
              {
                \char_generate:nn { "0069 }
                  { \char_value_catcode:n { "0069 } }
              }
            \__text_change_case_loop:nnw {#1} {#3}
          }
          { \__text_change_case_char:nnnN {#1} {#2} {#3} #4#5 }
      }
  }
\cs_new:Npx \__text_change_case_upper_tr:nnnN #1#2#3#4
  {
    \exp_not:N \int_compare:nNnTF { `#4 } = { "0069 }
      {
        \bool_lazy_or:nnTF
          { \sys_if_engine_luatex_p: }
          { \sys_if_engine_xetex_p: }
          {
            \exp_not:N \__text_change_case_store:e
              {
                \exp_not:N \char_generate:nn { "0130 }
                  { \exp_not:N \__text_char_catcode:N #4 }
              }
          }
          {
            \exp_not:N \__text_change_case_store:V
            \exp_not:N \c__text_dotted_I_tl
          }
        \exp_not:N \use:c { __text_change_case_char_next_ #2 :nn } {#2} {#3}
      }
      { \exp_not:N \__text_change_case_char:nnnN {#1} {#2} {#3} #4 }
  }
\cs_new_eq:NN \__text_change_case_lower_az:nnnN
  \__text_change_case_lower_tr:nnnN
\cs_new_eq:NN \__text_change_case_upper_az:nnnN
  \__text_change_case_upper_tr:nnnN
\group_begin:
  \bool_lazy_or:nnF
    { \sys_if_engine_luatex_p: }
    { \sys_if_engine_xetex_p: }
    {
      \cs_set_protected:Npn \__text_tmp:w #1#2
        {
          \group_begin:
            \cs_set_protected:Npn \__text_tmp:w ##1##2##3##4
              {
                \tl_const:Nx #1
                  {
                    \exp_after:wN \exp_after:wN \exp_after:wN
                      \exp_not:N \char_generate:nn {##1} { 13 }
                    \exp_after:wN \exp_after:wN \exp_after:wN
                      \exp_not:N \char_generate:nn {##2} { 13 }
                    \tl_if_blank:nF {##3}
                      {
                        \exp_after:wN \exp_after:wN \exp_after:wN
                          \exp_not:N \char_generate:nn {##3} { 13 }
                      }
                  }
              }
            \use:x
              { \__text_tmp:w \char_to_utfviii_bytes:n { "#2 } }
          \group_end:
        }
      \__text_tmp:w \c__text_dotless_i_tl      { 0131 }
      \__text_tmp:w \c__text_dotted_I_tl       { 0130 }
      \__text_tmp:w \c__text_i_ogonek_tl       { 012F }
      \__text_tmp:w \c__text_I_ogonek_tl       { 012E }
      \__text_tmp:w \c__text_final_sigma_tl    { 03C2 }
      \__text_tmp:w \c__text_sigma_tl          { 03C3 }
      \__text_tmp:w \c__text_grosses_Eszett_tl { 1E9E }
    }
\group_end:
\group_begin:
  \bool_lazy_or:nnF
    { \sys_if_engine_luatex_p: }
    { \sys_if_engine_xetex_p: }
    {
      \cs_set_protected:Npn \__text_loop:nn #1#2
        {
          \quark_if_recursion_tail_stop:n {#1}
          \use:x
            {
              \__text_tmp:w
                \char_to_utfviii_bytes:n { "#1 }
                \char_to_utfviii_bytes:n { "#2 }
            }
          \__text_loop:nn
        }
      \cs_set_protected:Npn \__text_tmp:nnnn #1#2#3#4#5
        {
          \tl_const:cx
            {
              c__text_ #1 case_
              \char_generate:nn {#2} { 12 }
              \char_generate:nn {#3} { 12 }
              _tl
            }
            {
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#4} { 13 }
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#5} { 13 }
            }
        }
      \cs_set_protected:Npn \__text_tmp:w #1#2#3#4#5#6#7#8
        {
          \tl_const:cx
            {
              c__text_lowercase_
              \char_generate:nn {#1} { 12 }
              \char_generate:nn {#2} { 12 }
              _tl
            }
            {
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#5} { 13 }
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#6} { 13 }
            }
          \__text_tmp:nnnn { upper } {#5} {#6} {#1} {#2}
          \__text_tmp:nnnn { title } {#5} {#6} {#1} {#2}
        }
      \__text_loop:nn
        { 00C0 } { 00E0 }
        { 00C1 } { 00E1 }
        { 00C2 } { 00E2 }
        { 00C3 } { 00E3 }
        { 00C4 } { 00E4 }
        { 00C5 } { 00E5 }
        { 00C6 } { 00E6 }
        { 00C7 } { 00E7 }
        { 00C8 } { 00E8 }
        { 00C9 } { 00E9 }
        { 00CA } { 00EA }
        { 00CB } { 00EB }
        { 00CC } { 00EC }
        { 00CD } { 00ED }
        { 00CE } { 00EE }
        { 00CF } { 00EF }
        { 00D0 } { 00F0 }
        { 00D1 } { 00F1 }
        { 00D2 } { 00F2 }
        { 00D3 } { 00F3 }
        { 00D4 } { 00F4 }
        { 00D5 } { 00F5 }
        { 00D6 } { 00F6 }
        { 00D8 } { 00F8 }
        { 00D9 } { 00F9 }
        { 00DA } { 00FA }
        { 00DB } { 00FB }
        { 00DC } { 00FC }
        { 00DD } { 00FD }
        { 00DE } { 00FE }
        { 0100 } { 0101 }
        { 0102 } { 0103 }
        { 0104 } { 0105 }
        { 0106 } { 0107 }
        { 0108 } { 0109 }
        { 010A } { 010B }
        { 010C } { 010D }
        { 010E } { 010F }
        { 0110 } { 0111 }
        { 0112 } { 0113 }
        { 0114 } { 0115 }
        { 0116 } { 0117 }
        { 0118 } { 0119 }
        { 011A } { 011B }
        { 011C } { 011D }
        { 011E } { 011F }
        { 0120 } { 0121 }
        { 0122 } { 0123 }
        { 0124 } { 0125 }
        { 0128 } { 0129 }
        { 012A } { 012B }
        { 012C } { 012D }
        { 012E } { 012F }
        { 0132 } { 0133 }
        { 0134 } { 0135 }
        { 0136 } { 0137 }
        { 0139 } { 013A }
        { 013B } { 013C }
        { 013E } { 013F }
        { 0141 } { 0142 }
        { 0143 } { 0144 }
        { 0145 } { 0146 }
        { 0147 } { 0148 }
        { 014A } { 014B }
        { 014C } { 014D }
        { 014E } { 014F }
        { 0150 } { 0151 }
        { 0152 } { 0153 }
        { 0154 } { 0155 }
        { 0156 } { 0157 }
        { 0158 } { 0159 }
        { 015A } { 015B }
        { 015C } { 015D }
        { 015E } { 015F }
        { 0160 } { 0161 }
        { 0162 } { 0163 }
        { 0164 } { 0165 }
        { 0168 } { 0169 }
        { 016A } { 016B }
        { 016C } { 016D }
        { 016E } { 016F }
        { 0170 } { 0171 }
        { 0172 } { 0173 }
        { 0174 } { 0175 }
        { 0176 } { 0177 }
        { 0178 } { 00FF }
        { 0179 } { 017A }
        { 017B } { 017C }
        { 017D } { 017E }
        { 01CD } { 01CE }
        { 01CF } { 01D0 }
        { 01D1 } { 01D2 }
        { 01D3 } { 01D4 }
        { 01E2 } { 01E3 }
        { 01E6 } { 01E7 }
        { 01E8 } { 01E9 }
        { 01EA } { 01EB }
        { 01F4 } { 01F5 }
        { 0218 } { 0219 }
        { 021A } { 021B }
        { 0400 } { 0450 }
        { 0401 } { 0451 }
        { 0402 } { 0452 }
        { 0403 } { 0453 }
        { 0404 } { 0454 }
        { 0405 } { 0455 }
        { 0406 } { 0456 }
        { 0407 } { 0457 }
        { 0408 } { 0458 }
        { 0409 } { 0459 }
        { 040A } { 045A }
        { 040B } { 045B }
        { 040C } { 045C }
        { 040D } { 045D }
        { 040E } { 045E }
        { 040F } { 045F }
        { 0410 } { 0430 }
        { 0411 } { 0431 }
        { 0412 } { 0432 }
        { 0413 } { 0433 }
        { 0414 } { 0434 }
        { 0415 } { 0435 }
        { 0416 } { 0436 }
        { 0417 } { 0437 }
        { 0418 } { 0438 }
        { 0419 } { 0439 }
        { 041A } { 043A }
        { 041B } { 043B }
        { 041C } { 043C }
        { 041D } { 043D }
        { 041E } { 043E }
        { 041F } { 043F }
        { 0420 } { 0440 }
        { 0421 } { 0441 }
        { 0422 } { 0442 }
        { 0423 } { 0443 }
        { 0424 } { 0444 }
        { 0425 } { 0445 }
        { 0426 } { 0446 }
        { 0427 } { 0447 }
        { 0428 } { 0448 }
        { 0429 } { 0449 }
        { 042A } { 044A }
        { 042B } { 044B }
        { 042C } { 044C }
        { 042D } { 044D }
        { 042E } { 044E }
        { 042F } { 044F }
        { 0370 } { 0371 }
        { 0372 } { 0373 }
        { 0376 } { 0377 }
        { 03FD } { 037B }
        { 03FE } { 037C }
        { 03FF } { 037D }
        { 0386 } { 03AC }
        { 0388 } { 03AD }
        { 0389 } { 03AE }
        { 038A } { 03AF }
        { 0391 } { 03B1 }
        { 0392 } { 03B2 }
        { 0393 } { 03B3 }
        { 0394 } { 03B4 }
        { 0395 } { 03B5 }
        { 0396 } { 03B6 }
        { 0397 } { 03B7 }
        { 0398 } { 03B8 }
        { 0399 } { 03B9 }
        { 039A } { 03BA }
        { 039B } { 03BB }
        { 039C } { 03BC }
        { 039D } { 03BD }
        { 039E } { 03BE }
        { 039F } { 03BF }
        { 03A0 } { 03C0 }
        { 03A1 } { 03C1 }
        { 03A3 } { 03C3 }
        { 03A4 } { 03C4 }
        { 03A5 } { 03C5 }
        { 03A6 } { 03C6 }
        { 03A7 } { 03C7 }
        { 03A8 } { 03C8 }
        { 03A9 } { 03C9 }
        { 03AA } { 03CA }
        { 03AB } { 03CB }
        { 038C } { 03CC }
        { 038E } { 03CD }
        { 038F } { 03CE }
        { 03CF } { 03D7 }
        { 03D8 } { 03D9 }
        { 03DA } { 03DB }
        { 03DC } { 03DD }
        { 03DE } { 03DF }
        { 03E0 } { 03E1 }
        { 03E2 } { 03E3 }
        { 03E4 } { 03E5 }
        { 03E6 } { 03E7 }
        { 03E8 } { 03E9 }
        { 03EA } { 03EB }
        { 03EC } { 03ED }
        { 03EE } { 03EF }
        { 03F9 } { 03F2 }
        { 037F } { 03F3 }
        { 03F7 } { 03F8 }
        { 03FA } { 03FB }
        \q_recursion_tail ?
        \q_recursion_stop
      \cs_set_protected:Npn \__text_tmp:w #1#2#3
        {
          \group_begin:
            \cs_set_protected:Npn \__text_tmp:w ##1##2##3##4##5##6##7##8
              {
                \tl_const:cx
                  {
                    c__text_ #3 case_
                    \char_generate:nn {##1} { 12 }
                    \char_generate:nn {##2} { 12 }
                    _tl
                  }
                  {
                    \exp_after:wN \exp_after:wN \exp_after:wN
                      \exp_not:N \char_generate:nn {##5} { 13 }
                    \exp_after:wN \exp_after:wN \exp_after:wN
                      \exp_not:N \char_generate:nn {##6} { 13 }
                  }
              }
            \use:x
              {
                \__text_tmp:w
                  \char_to_utfviii_bytes:n { "#1 }
                  \char_to_utfviii_bytes:n { "#2 }
              }
          \group_end:
        }
      \__text_tmp:w { 0345 } { 0399 } { upper }
      \__text_tmp:w { 03C2 } { 03A3 } { upper }
      \__text_tmp:w { 03D0 } { 0392 } { upper }
      \__text_tmp:w { 03D1 } { 0398 } { upper }
      \__text_tmp:w { 03D5 } { 03A6 } { upper }
      \__text_tmp:w { 03D6 } { 03A0 } { upper }
      \__text_tmp:w { 03F0 } { 039A } { upper }
      \__text_tmp:w { 03F1 } { 03A1 } { upper }
      \__text_tmp:w { 03F4 } { 03B8 } { lower }
      \__text_tmp:w { 03F5 } { 0395 } { upper }
      \cs_set_protected:Npn \__text_tmp:w #1#2#3
        {
          \group_begin:
            \cs_set_protected:Npn \__text_tmp:w ##1##2##3##4
              {
                \tl_const:cn
                  {
                    c__text_ #3 case_
                    \char_generate:nn {##1} { 12 }
                    \char_generate:nn {##2} { 12 }
                    _tl
                  }
                    {#2}
              }
            \use:x
              { \__text_tmp:w \char_to_utfviii_bytes:n { "#1 } }
          \group_end:
        }
      \__text_tmp:w { 00DF } { SS } { upper }
      \__text_tmp:w { 00DF } { Ss } { title }
      \__text_tmp:w { 0131 } { I }  { upper }
      \cs_set_protected:Npn \__text_tmp:nnnnnn #1#2#3#4#5#6#7
        {
          \tl_const:cx
            {
              c__text_ #1 case_
              \char_generate:nn {#2} { 12 }
              \char_generate:nn {#3} { 12 }
              \char_generate:nn {#4} { 12 }
              _tl
            }
            {
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#5} { 13 }
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#6} { 13 }
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#7} { 13 }
            }
        }
      \cs_set_protected:Npn \__text_tmp:w #1#2#3#4#5#6#7#8
        {
          \tl_const:cx
            {
              c__text_lowercase_
              \char_generate:nn {#1} { 12 }
              \char_generate:nn {#2} { 12 }
              \char_generate:nn {#3} { 12 }
              _tl
            }
            {
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#5} { 13 }
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#6} { 13 }
              \exp_after:wN \exp_after:wN \exp_after:wN
                \exp_not:N \char_generate:nn {#7} { 13 }
            }
          \__text_tmp:nnnnnn { upper } {#5} {#6} {#7} {#1} {#2} {#3}
          \__text_tmp:nnnnnn { title } {#5} {#6} {#7} {#1} {#2} {#3}
        }
      \__text_loop:nn
        { 1F08 } { 1F00 }
        { 1F09 } { 1F01 }
        { 1F0A } { 1F02 }
        { 1F0B } { 1F03 }
        { 1F0C } { 1F04 }
        { 1F0D } { 1F05 }
        { 1F0E } { 1F06 }
        { 1F0F } { 1F07 }
        { 1F18 } { 1F10 }
        { 1F19 } { 1F11 }
        { 1F1A } { 1F12 }
        { 1F1B } { 1F13 }
        { 1F1C } { 1F14 }
        { 1F1D } { 1F15 }
        { 1F28 } { 1F20 }
        { 1F29 } { 1F21 }
        { 1F2A } { 1F22 }
        { 1F2B } { 1F23 }
        { 1F2C } { 1F24 }
        { 1F2D } { 1F25 }
        { 1F2E } { 1F26 }
        { 1F2F } { 1F27 }
        { 1F38 } { 1F30 }
        { 1F39 } { 1F31 }
        { 1F3A } { 1F32 }
        { 1F3B } { 1F33 }
        { 1F3C } { 1F34 }
        { 1F3D } { 1F35 }
        { 1F3E } { 1F36 }
        { 1F3F } { 1F37 }
        { 1F48 } { 1F40 }
        { 1F49 } { 1F41 }
        { 1F4A } { 1F42 }
        { 1F4B } { 1F43 }
        { 1F4C } { 1F44 }
        { 1F4D } { 1F45 }
        { 1F59 } { 1F51 }
        { 1F5B } { 1F53 }
        { 1F5D } { 1F55 }
        { 1F5F } { 1F57 }
        { 1F68 } { 1F60 }
        { 1F69 } { 1F61 }
        { 1F6A } { 1F62 }
        { 1F6B } { 1F63 }
        { 1F6C } { 1F64 }
        { 1F6D } { 1F65 }
        { 1F6E } { 1F66 }
        { 1F6F } { 1F67 }
        { 1FBA } { 1F70 }
        { 1FBB } { 1F71 }
        { 1FC8 } { 1F72 }
        { 1FC9 } { 1F73 }
        { 1FCA } { 1F74 }
        { 1FCB } { 1F75 }
        { 1FDA } { 1F76 }
        { 1FDB } { 1F77 }
        { 1FF8 } { 1F78 }
        { 1FF9 } { 1F79 }
        { 1FEA } { 1F7A }
        { 1FEB } { 1F7B }
        { 1FFA } { 1F7C }
        { 1FFB } { 1F7D }
        { 1F88 } { 1F80 }
        { 1F89 } { 1F81 }
        { 1F8A } { 1F82 }
        { 1F8B } { 1F83 }
        { 1F8C } { 1F84 }
        { 1F8D } { 1F85 }
        { 1F8E } { 1F86 }
        { 1F8F } { 1F87 }
        { 1F98 } { 1F90 }
        { 1F99 } { 1F91 }
        { 1F9A } { 1F92 }
        { 1F9B } { 1F93 }
        { 1F9C } { 1F94 }
        { 1F9D } { 1F95 }
        { 1F9E } { 1F96 }
        { 1F9F } { 1F97 }
        { 1FA8 } { 1FA0 }
        { 1FA9 } { 1FA1 }
        { 1FAA } { 1FA2 }
        { 1FAB } { 1FA3 }
        { 1FAC } { 1FA4 }
        { 1FAD } { 1FA5 }
        { 1FAE } { 1FA6 }
        { 1FAF } { 1FA7 }
        { 1FB8 } { 1FB0 }
        { 1FB9 } { 1FB1 }
        { 1FBC } { 1FB3 }
        { 1FCC } { 1FC3 }
        { 1FD8 } { 1FD0 }
        { 1FD9 } { 1FD1 }
        { 1FE8 } { 1FE0 }
        { 1FE9 } { 1FE1 }
        { 1FEC } { 1FE5 }
        { 1FFC } { 1FF3 }
        \q_recursion_tail ?
        \q_recursion_stop
      \cs_set_protected:Npn \__text_tmp:w #1#2#3
        {
          \group_begin:
            \cs_set_protected:Npn \__text_tmp:w ##1##2##3##4##5##6##7##8
              {
                \tl_const:cx
                  {
                    c__text_ #3 case_
                    \char_generate:nn {##1} { 12 }
                    \char_generate:nn {##2} { 12 }
                    \char_generate:nn {##3} { 12 }
                    _tl
                  }
                  {
                    \exp_after:wN \exp_after:wN \exp_after:wN
                      \exp_not:N \char_generate:nn {##5} { 13 }
                    \exp_after:wN \exp_after:wN \exp_after:wN
                      \exp_not:N \char_generate:nn {##6} { 13 }
                  }
              }
            \use:x
              {
                \__text_tmp:w
                  \char_to_utfviii_bytes:n { "#1 }
                  \char_to_utfviii_bytes:n { "#2 }
              }
          \group_end:
        }
    \__text_tmp:w { 1FBE } { 0399 } { upper }
  }
\group_end:
\group_begin:
  \cs_set_protected:Npn \__text_change_case_setup:NN #1#2
    {
      \quark_if_recursion_tail_stop:N #1
      \tl_const:cn { c__text_lowercase_ \token_to_str:N #1 _tl }
        { #2 }
      \tl_const:cn { c__text_uppercase_ \token_to_str:N #2 _tl }
        { #1 }
      \__text_change_case_setup:NN
    }
  \__text_change_case_setup:NN
  \AA \aa
  \AE \ae
  \DH \dh
  \DJ \dj
  \IJ \ij
  \L  \l
  \NG \ng
  \O  \o
  \OE \oe
  \SS \ss
  \TH \th
  \q_recursion_tail ?
  \q_recursion_stop
  \tl_const:cn { c__text_uppercase_ \token_to_str:N \i _tl } { I }
  \tl_const:cn { c__text_uppercase_ \token_to_str:N \j _tl } { J }
\group_end:
\cs_if_exist:cT { @uclclist }
  {
    \AtBeginDocument
      {
        \group_begin:
          \cs_set_protected:Npn \__text_change_case_setup:Nn #1#2
            {
              \quark_if_recursion_tail_stop:N #1
              \tl_if_single_token:nT {#2}
                {
                  \cs_if_exist:cF
                    { c__text_uppercase_ \token_to_str:N #1 _tl }
                    {
                      \tl_const:cn
                        { c__text_uppercase_ \token_to_str:N #1 _tl }
                        { #2 }
                    }
                  \cs_if_exist:cF
                    { c__text_lowercase_ \token_to_str:N #2 _tl }
                    {
                      \tl_const:cn
                        { c__text_lowercase_ \token_to_str:N #2 _tl }
                        { #1 }
                    }
                }
              \__text_change_case_setup:Nn
            }
          \exp_after:wN \__text_change_case_setup:Nn \@uclclist
          \q_recursion_tail ?
          \q_recursion_stop
        \group_end:
      }
  }
%% File: l3text-purify.dtx
\__kernel_quark_new_test:N \__text_if_recursion_tail_stop:N
\cs_new:Npn \text_purify:n #1
  {
    \__kernel_exp_not:w \exp_after:wN
      {
        \exp:w
        \exp_args:Ne \__text_purify:n
          { \text_expand:n {#1} }
      }
  }
\cs_new:Npn \__text_purify:n #1
  {
    \group_align_safe_begin:
    \__text_purify_loop:w #1
      \q__text_recursion_tail \q__text_recursion_stop
    \__text_purify_result:n { }
  }
\cs_new:Npn \__text_purify_store:n #1
  { \__text_purify_store:nw {#1} }
\cs_new:Npn \__text_purify_store:nw #1#2 \__text_purify_result:n #3
  { #2 \__text_purify_result:n { #3 #1 } }
\cs_new:Npn \__text_purify_end:w #1 \__text_purify_result:n #2
  {
    \group_align_safe_end:
    \exp_end:
    #2
  }
\cs_new:Npn \__text_purify_loop:w #1 \q__text_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#1}
      { \__text_purify_N_type:N }
      {
        \tl_if_head_is_group:nTF {#1}
          { \__text_purify_group:n }
          { \__text_purify_space:w }
      }
    #1 \q__text_recursion_stop
  }
\cs_new:Npn \__text_purify_group:n #1 { \__text_purify_loop:w #1 }
\exp_last_unbraced:NNo \cs_new:Npn \__text_purify_space:w \c_space_tl
  {
    \__text_purify_store:n { ~ }
    \__text_purify_loop:w
  }
\cs_new:Npn \__text_purify_N_type:N #1
  {
    \__text_if_recursion_tail_stop_do:Nn #1 { \__text_purify_end:w }
    \__text_purify_N_type_aux:N #1
  }
\cs_new:Npn \__text_purify_N_type_aux:N #1
  {
    \exp_after:wN \__text_purify_math_search:NNN
      \exp_after:wN #1 \l_text_math_delims_tl
      \q__text_recursion_tail ?
      \q__text_recursion_stop
  }
\cs_new:Npn \__text_purify_math_search:NNN #1#2#3
  {
    \__text_if_recursion_tail_stop_do:Nn #2
      { \__text_purify_math_cmd:N #1 }
    \token_if_eq_meaning:NNTF #1 #2
      {
        \__text_use_i_delimit_by_q_recursion_stop:nw
           { \__text_purify_math_start:NNw #2 #3 }
      }
      { \__text_purify_math_search:NNN #1 }
  }
\cs_new:Npn \__text_purify_math_start:NNw #1#2#3 \q__text_recursion_stop
  {
    \__text_purify_math_loop:NNw #1#2#3 \q__text_recursion_stop
      \__text_purify_math_result:n { }
  }
\cs_new:Npn \__text_purify_math_store:n #1
  { \__text_purify_math_store:nw {#1} }
\cs_new:Npn \__text_purify_math_store:nw #1#2 \__text_purify_math_result:n #3
  { #2 \__text_purify_math_result:n { #3 #1 } }
\cs_new:Npn \__text_purify_math_end:w #1 \__text_purify_math_result:n #2
  {
    \__text_purify_store:n { $ #2 $ }
    \__text_purify_loop:w #1
  }
\cs_new:Npn \__text_purify_math_stop:Nw #1 \__text_purify_math_result:n #2
  {
    \__text_purify_store:n {#1#2}
    \__text_purify_end:w
  }
\cs_new:Npn \__text_purify_math_loop:NNw #1#2#3 \q__text_recursion_stop
  {
    \tl_if_head_is_N_type:nTF {#3}
      { \__text_purify_math_N_type:NNN }
      {
        \tl_if_head_is_group:nTF {#3}
          { \__text_purify_math_group:NNn }
          { \__text_purify_math_space:NNw }
      }
        #1#2#3 \q__text_recursion_stop
  }
\cs_new:Npn \__text_purify_math_N_type:NNN #1#2#3
  {
    \__text_if_recursion_tail_stop_do:Nn #3
      { \__text_purify_math_stop:Nw #1 }
    \token_if_eq_meaning:NNTF #3 #2
      { \__text_purify_math_end:w }
      {
        \__text_purify_math_store:n {#3}
        \__text_purify_math_loop:NNw #1#2
      }
  }
\cs_new:Npn \__text_purify_math_group:NNn #1#2#3
  {
    \__text_purify_math_store:n { {#3} }
    \__text_purify_math_loop:NNw #1#2
  }
\exp_after:wN \cs_new:Npn \exp_after:wN \__text_purify_math_space:NNw
  \exp_after:wN # \exp_after:wN 1
  \exp_after:wN # \exp_after:wN 2 \c_space_tl
  {
    \__text_purify_math_store:n { ~ }
    \__text_purify_math_loop:NNw #1#2
  }
\cs_new:Npn \__text_purify_math_cmd:N #1
  {
    \exp_after:wN \__text_purify_math_cmd:NN \exp_after:wN #1
      \l_text_math_arg_tl \q__text_recursion_tail \q__text_recursion_stop
  }
\cs_new:Npn \__text_purify_math_cmd:NN #1#2
  {
    \__text_if_recursion_tail_stop_do:Nn #2
      { \__text_purify_replace:N #1 }
    \cs_if_eq:NNTF #2 #1
      {
        \__text_use_i_delimit_by_q_recursion_stop:nw
          { \__text_purify_math_cmd:n }
      }
      { \__text_purify_math_cmd:NN #1 }
  }
\cs_new:Npn \__text_purify_math_cmd:n #1
  { \__text_purify_math_end:w \__text_purify_math_result:n {#1} }
\cs_new:Npn \__text_purify_replace:N #1
  {
    \bool_lazy_and:nnTF
      { \cs_if_exist_p:c { l__text_purify_ \token_to_str:N #1 _tl } }
      {
        \bool_lazy_or_p:nn
          { \token_if_cs_p:N #1 }
          { \token_if_active_p:N #1 }
      }
      {
        \exp_args:Nv \__text_purify_replace:n
          { l__text_purify_ \token_to_str:N #1 _tl }
      }
      {
        \token_if_cs:NTF #1
          { \__text_purify_expand:N #1 }
          {
            \exp_args:Ne \__text_purify_store:n
              { \__text_token_to_explicit:N #1 }
            \__text_purify_loop:w
          }
      }
  }
\cs_new:Npn \__text_purify_replace:n #1 { \__text_purify_loop:w #1 }
\cs_new:Npn \__text_purify_expand:N #1
  {
    \str_if_eq:nnTF {#1} { \protect }
      { \__text_purify_protect:N }
      { \__text_purify_encoding:N #1 }
  }
\cs_new:Npn \__text_purify_protect:N #1
  {
    \__text_if_recursion_tail_stop_do:Nn #1 { \__text_purify_end:w }
    \__text_purify_loop:w
  }
\cs_new:Npn \__text_purify_encoding:N #1
  {
    \bool_lazy_or:nnTF
      { \cs_if_eq_p:NN #1 \@current@cmd }
      { \cs_if_eq_p:NN #1 \@changed@cmd }
      { \__text_purify_encoding_escape:NN }
      {
        \__text_if_expandable:NTF #1
          { \exp_after:wN \__text_purify_loop:w #1 }
          { \__text_purify_loop:w }
      }
  }
\cs_new:Npn \__text_purify_encoding_escape:NN #1#2
  {
    \__text_purify_store:n {#1}
    \__text_purify_loop:w
  }
\cs_new_protected:Npn \text_declare_purify_equivalent:Nn #1#2
  {
    \tl_clear_new:c { l__text_purify_ \token_to_str:N #1 _tl }
    \tl_set:cn { l__text_purify_ \token_to_str:N #1 _tl } {#2}
  }
\cs_generate_variant:Nn \text_declare_purify_equivalent:Nn { Nx }
\tl_map_inline:nn
  {
    \fontencoding
    \fontfamily
    \fontseries
    \fontshape
  }
  { \text_declare_purify_equivalent:Nn #1 { \use_none:n } }
\text_declare_purify_equivalent:Nn \fontsize { \use_none:nn }
\text_declare_purify_equivalent:Nn \selectfont { }
\text_declare_purify_equivalent:Nn \usefont { \use_none:nnnn }
\tl_map_inline:nn
  {
    \emph
    \text
    \textnormal
    \textrm
    \textsf
    \texttt
    \textbf
    \textmd
    \textit
    \textsl
    \textup
    \textsc
    \textulc
  }
  { \text_declare_purify_equivalent:Nn #1 { \use:n } }
\tl_map_inline:nn
  {
    \normalfont
    \rmfamily
    \sffamily
    \ttfamily
    \bfseries
    \mdseries
    \itshape
    \scshape
    \slshape
    \upshape
    \em
    \Huge
    \LARGE
    \Large
    \footnotesize
    \huge
    \large
    \normalsize
    \scriptsize
    \small
    \tiny
  }
  { \text_declare_purify_equivalent:Nn #1 { } }
\exp_args:Nc \text_declare_purify_equivalent:Nn
  { @protected@testopt } { \use_none:nnn }
\text_declare_purify_equivalent:Nn \begin { \use:c }
\text_declare_purify_equivalent:Nn \end { \__text_end_env:n }
\cs_new:Npn \__text_end_env:n #1 { \cs:w end #1 \cs_end: }
\text_declare_purify_equivalent:Nn \\ { }
\tl_map_inline:nn
  { \{ \} \# \$ \% \_ }
  { \text_declare_purify_equivalent:Nx #1 { \cs_to_str:N #1 } }
\text_declare_purify_equivalent:Nn \label { \use_none:n }
\group_begin:
\char_set_catcode_active:N \~
\use:n
  {
    \group_end:
    \text_declare_purify_equivalent:Nx ~ { \c_space_tl }
  }
\text_declare_purify_equivalent:Nn \nobreakspace { ~ }
\text_declare_purify_equivalent:Nn \  { ~ }
\text_declare_purify_equivalent:Nn \, { ~ }
\bool_lazy_or:nnTF
  { \sys_if_engine_luatex_p: }
  { \sys_if_engine_xetex_p: }
  {
    \cs_set_protected:Npn \__text_loop:Nn #1#2
      {
        \quark_if_recursion_tail_stop:N #1
        \text_declare_purify_equivalent:Nx #1
          {
            \char_generate:nn { "#2 }
              { \char_value_catcode:n { "#2 } }
          }
        \__text_loop:Nn
      }
  }
  {
    \cs_set_protected:Npn \__text_loop:Nn #1#2
      {
        \quark_if_recursion_tail_stop:N #1
        \text_declare_purify_equivalent:Nx #1
          {
            \exp_args:Ne \__text_tmp:n
              { \char_to_utfviii_bytes:n { "#2 } }
          }
        \__text_loop:Nn
      }
    \cs_set:Npn \__text_tmp:n #1 { \__text_tmp:nnnn #1 }
    \cs_set:Npn \__text_tmp:nnnn #1#2#3#4
      {
        \exp_after:wN \exp_after:wN \exp_after:wN
          \exp_not:N \char_generate:nn {#1} { 13 }
        \exp_after:wN \exp_after:wN \exp_after:wN
          \exp_not:N \char_generate:nn {#2} { 13 }
      }
  }
\__text_loop:Nn
  \AA { 00C5 }
  \AE { 00C6 }
  \DH { 00D0 }
  \DJ { 0110 }
  \IJ { 0132 }
  \L  { 0141 }
  \NG { 014A }
  \O  { 00D8 }
  \OE { 0152 }
  \TH { 00DE }
  \aa { 00E5 }
  \ae { 00E6 }
  \dh { 00F0 }
  \dj { 0111 }
  \i  { 0131 }
  \j  { 0237 }
  \ij { 0132 }
  \l  { 0142 }
  \ng { 014B }
  \o  { 00F8 }
  \oe { 0153 }
  \ss { 00DF }
  \th { 00FE }
  \q_recursion_tail ?
  \q_recursion_stop
\text_declare_purify_equivalent:Nn \SS { SS }
\cs_new:Npn \__text_purify_accent:NN #1#2
  {
    \cs_if_exist:cTF
      { c__text_purify_ \token_to_str:N #1 _ \token_to_str:N #2 _tl }
      {
        \exp_not:v
          { c__text_purify_ \token_to_str:N #1 _ \token_to_str:N #2 _tl }
      }
      {
        \exp_not:n {#2}
        \exp_not:v { c__text_purify_ \token_to_str:N #1 _tl }
      }
  }
\tl_map_inline:Nn \l_text_accents_tl
  { \text_declare_purify_equivalent:Nn #1 { \__text_purify_accent:NN #1 } }
\group_begin:
  \cs_set_protected:Npn \__text_loop:Nn #1#2
    {
      \quark_if_recursion_tail_stop:N #1
      \tl_const:cx { c__text_purify_ \token_to_str:N #1 _tl }
        { \__text_tmp:n {#2} }
      \__text_loop:Nn
    }
  \bool_lazy_or:nnTF
    { \sys_if_engine_luatex_p: }
    { \sys_if_engine_xetex_p: }
    {
      \cs_set:Npn \__text_tmp:n #1
        {
          \char_generate:nn { "#1 }
            { \char_value_catcode:n { "#1 } }
        }
    }
    {
      \cs_set:Npn \__text_tmp:n #1
        {
          \exp_args:Ne \__text_tmp_aux:n
            { \char_to_utfviii_bytes:n { "#1 } }
        }
      \cs_set:Npn \__text_tmp_aux:n #1 { \__text_tmp:nnnn #1 }
      \cs_set:Npn \__text_tmp:nnnn #1#2#3#4
        {
          \exp_after:wN \exp_after:wN \exp_after:wN
            \exp_not:N \char_generate:nn {#1} { 13 }
          \exp_after:wN \exp_after:wN \exp_after:wN
            \exp_not:N \char_generate:nn {#2} { 13 }
        }
    }
  \__text_loop:Nn
    \` { 0300 }
    \' { 0301 }
    \^ { 0302 }
    \~ { 0303 }
    \= { 0304 }
    \u { 0306 }
    \. { 0307 }
    \" { 0308 }
    \r { 030A }
    \H { 030B }
    \v { 030C }
    \d { 0323 }
    \c { 0327 }
    \k { 0328 }
    \b { 0331 }
    \t { 0361 }
    \q_recursion_tail { }
    \q_recursion_stop
  \cs_set_protected:Npn \__text_loop:NNn #1#2#3
    {
      \quark_if_recursion_tail_stop:N #1
      \tl_const:cx
        { c__text_purify_ \token_to_str:N #1 _ \token_to_str:N #2 _tl }
        { \__text_tmp:n {#3} }
      \__text_loop:NNn
    }
  \__text_loop:NNn
    \` A   { 00C0 }
    \' A   { 00C1 }
    \^ A   { 00C2 }
    \~ A   { 00C3 }
    \" A   { 00C4 }
    \r A   { 00C5 }
    \c C   { 00C7 }
    \` E   { 00C8 }
    \' E   { 00C9 }
    \^ E   { 00CA }
    \" E   { 00CB }
    \` I   { 00CC }
    \' I   { 00CD }
    \^ I   { 00CE }
    \" I   { 00CF }
    \~ N   { 00D1 }
    \` O   { 00D2 }
    \' O   { 00D3 }
    \^ O   { 00D4 }
    \~ O   { 00D5 }
    \" O   { 00D6 }
    \` U   { 00D9 }
    \' U   { 00DA }
    \^ U   { 00DB }
    \" U   { 00DC }
    \' Y   { 00DD }
    \` a   { 00E0 }
    \' a   { 00E1 }
    \^ a   { 00E2 }
    \~ a   { 00E3 }
    \" a   { 00E4 }
    \r a   { 00E5 }
    \c c   { 00E7 }
    \` e   { 00E8 }
    \' e   { 00E9 }
    \^ e   { 00EA }
    \" e   { 00EB }
    \` i   { 00EC }
    \` \i  { 00EC }
    \' i   { 00ED }
    \' \i  { 00ED }
    \^ i   { 00EE }
    \^ \i  { 00EE }
    \" i   { 00EF }
    \" \i  { 00EF }
    \~ n   { 00F1 }
    \` o   { 00F2 }
    \' o   { 00F3 }
    \^ o   { 00F4 }
    \~ o   { 00F5 }
    \" o   { 00F6 }
    \` u   { 00F9 }
    \' u   { 00FA }
    \^ u   { 00FB }
    \" u   { 00FC }
    \' y   { 00FD }
    \" y   { 00FF }
    \= A   { 0100 }
    \= a   { 0101 }
    \u A   { 0102 }
    \u a   { 0103 }
    \k A   { 0104 }
    \k a   { 0105 }
    \' C   { 0106 }
    \' c   { 0107 }
    \^ C   { 0108 }
    \^ c   { 0109 }
    \. C   { 010A }
    \. c   { 010B }
    \v C   { 010C }
    \v c   { 010D }
    \v D   { 010E }
    \v d   { 010F }
    \= E   { 0112 }
    \= e   { 0113 }
    \u E   { 0114 }
    \u e   { 0115 }
    \. E   { 0116 }
    \. e   { 0117 }
    \k E   { 0118 }
    \k e   { 0119 }
    \v E   { 011A }
    \v e   { 011B }
    \^ G   { 011C }
    \^ g   { 011D }
    \u G   { 011E }
    \u g   { 011F }
    \. G   { 0120 }
    \. g   { 0121 }
    \c G   { 0122 }
    \c g   { 0123 }
    \^ H   { 0124 }
    \^ h   { 0125 }
    \~ I   { 0128 }
    \~ i   { 0129 }
    \~ \i  { 0129 }
    \= I   { 012A }
    \= i   { 012B }
    \= \i  { 012B }
    \u I   { 012C }
    \u i   { 012D }
    \u \i  { 012D }
    \k I   { 012E }
    \k i   { 012F }
    \k \i  { 012F }
    \. I   { 0130 }
    \^ J   { 0134 }
    \^ j   { 0135 }
    \^ \j  { 0135 }
    \c K   { 0136 }
    \c k   { 0137 }
    \' L   { 0139 }
    \' l   { 013A }
    \c L   { 013B }
    \c l   { 013C }
    \v L   { 013D }
    \v l   { 013E }
    \. L   { 013F }
    \. l   { 0140 }
    \' N   { 0143 }
    \' n   { 0144 }
    \c N   { 0145 }
    \c n   { 0146 }
    \v N   { 0147 }
    \v n   { 0148 }
    \= O   { 014C }
    \= o   { 014D }
    \u O   { 014E }
    \u o   { 014F }
    \H O   { 0150 }
    \H o   { 0151 }
    \' R   { 0154 }
    \' r   { 0155 }
    \c R   { 0156 }
    \c r   { 0157 }
    \v R   { 0158 }
    \v r   { 0159 }
    \' S   { 015A }
    \' s   { 015B }
    \^ S   { 015C }
    \^ s   { 015D }
    \c S   { 015E }
    \c s   { 015F }
    \v S   { 0160 }
    \v s   { 0161 }
    \c T   { 0162 }
    \c t   { 0163 }
    \v T   { 0164 }
    \v t   { 0165 }
    \~ U   { 0168 }
    \~ u   { 0169 }
    \= U   { 016A }
    \= u   { 016B }
    \u U   { 016C }
    \u u   { 016D }
    \r U   { 016E }
    \r u   { 016F }
    \H U   { 0170 }
    \H u   { 0171 }
    \k U   { 0172 }
    \k u   { 0173 }
    \^ W   { 0174 }
    \^ w   { 0175 }
    \^ Y   { 0176 }
    \^ y   { 0177 }
    \" Y   { 0178 }
    \' Z   { 0179 }
    \' z   { 017A }
    \. Z   { 017B }
    \. z   { 017C }
    \v Z   { 017D }
    \v z   { 017E }
    \v A   { 01CD }
    \v a   { 01CE }
    \v I   { 01CF }
    \v \i  { 01D0 }
    \v i   { 01D0 }
    \v O   { 01D1 }
    \v o   { 01D2 }
    \v U   { 01D3 }
    \v u   { 01D4 }
    \v G   { 01E6 }
    \v g   { 01E7 }
    \v K   { 01E8 }
    \v k   { 01E9 }
    \k O   { 01EA }
    \k o   { 01EB }
    \v \j  { 01F0 }
    \v j   { 01F0 }
    \' G   { 01F4 }
    \' g   { 01F5 }
    \` N   { 01F8 }
    \` n   { 01F9 }
    \' \AE { 01FC }
    \' \ae { 01FD }
    \' \O  { 01FE }
    \' \o  { 01FF }
    \v H   { 021E }
    \v h   { 021F }
    \. A   { 0226 }
    \. a   { 0227 }
    \c E   { 0228 }
    \c e   { 0229 }
    \. O   { 022E }
    \. o   { 022F }
    \= Y   { 0232 }
    \= y   { 0233 }
    \q_recursion_tail ? { }
    \q_recursion_stop
\group_end:
%% File: l3candidates.dtx
\cs_new_protected:Npn \box_clip:N #1
  { \hbox_set:Nn #1 { \__box_backend_clip:N #1 } }
\cs_generate_variant:Nn \box_clip:N { c }
\cs_new_protected:Npn \box_gclip:N #1
  { \hbox_gset:Nn #1 { \__box_backend_clip:N #1 } }
\cs_generate_variant:Nn \box_gclip:N { c }
\cs_new_protected:Npn \box_set_trim:Nnnnn #1#2#3#4#5
  { \__box_set_trim:NnnnnN #1 {#2} {#3} {#4} {#5} \box_set_eq:NN }
\cs_generate_variant:Nn \box_set_trim:Nnnnn { c }
\cs_new_protected:Npn \box_gset_trim:Nnnnn #1#2#3#4#5
  { \__box_set_trim:NnnnnN #1 {#2} {#3} {#4} {#5} \box_gset_eq:NN }
\cs_generate_variant:Nn \box_gset_trim:Nnnnn { c }
\cs_new_protected:Npn \__box_set_trim:NnnnnN #1#2#3#4#5#6
  {
    \hbox_set:Nn \l__box_internal_box
      {
        \__kernel_kern:n { -#2 }
        \box_use:N #1
        \__kernel_kern:n { -#4 }
      }
    \dim_compare:nNnTF { \box_dp:N #1 } > {#3}
      {
        \hbox_set:Nn \l__box_internal_box
          {
            \box_move_down:nn \c_zero_dim
              { \box_use_drop:N \l__box_internal_box }
          }
        \box_set_dp:Nn \l__box_internal_box { \box_dp:N #1 - (#3) }
      }
      {
        \hbox_set:Nn \l__box_internal_box
          {
            \box_move_down:nn { (#3) - \box_dp:N #1 }
              { \box_use_drop:N \l__box_internal_box }
          }
        \box_set_dp:Nn \l__box_internal_box \c_zero_dim
      }
    \dim_compare:nNnTF { \box_ht:N \l__box_internal_box } > {#5}
      {
        \hbox_set:Nn \l__box_internal_box
          {
            \box_move_up:nn \c_zero_dim
              { \box_use_drop:N \l__box_internal_box }
          }
        \box_set_ht:Nn \l__box_internal_box
          { \box_ht:N \l__box_internal_box - (#5) }
      }
      {
        \hbox_set:Nn \l__box_internal_box
          {
            \box_move_up:nn { (#5) - \box_ht:N \l__box_internal_box }
              { \box_use_drop:N \l__box_internal_box }
          }
        \box_set_ht:Nn \l__box_internal_box \c_zero_dim
      }
    #6 #1 \l__box_internal_box
  }
\cs_new_protected:Npn \box_set_viewport:Nnnnn #1#2#3#4#5
  { \__box_set_viewport:NnnnnN #1 {#2} {#3} {#4} {#5} \box_set_eq:NN }
\cs_generate_variant:Nn \box_set_viewport:Nnnnn { c }
\cs_new_protected:Npn \box_gset_viewport:Nnnnn #1#2#3#4#5
  { \__box_set_viewport:NnnnnN #1 {#2} {#3} {#4} {#5} \box_gset_eq:NN }
\cs_generate_variant:Nn \box_gset_viewport:Nnnnn { c }
\cs_new_protected:Npn \__box_set_viewport:NnnnnN #1#2#3#4#5#6
  {
    \hbox_set:Nn \l__box_internal_box
      {
        \__kernel_kern:n { -#2 }
        \box_use:N #1
        \__kernel_kern:n { #4 - \box_wd:N #1 }
      }
    \dim_compare:nNnTF {#3} < \c_zero_dim
      {
        \hbox_set:Nn \l__box_internal_box
          {
            \box_move_down:nn \c_zero_dim
              { \box_use_drop:N \l__box_internal_box }
          }
        \box_set_dp:Nn \l__box_internal_box { - \__box_dim_eval:n {#3} }
      }
      {
        \hbox_set:Nn \l__box_internal_box
          { \box_move_down:nn {#3} { \box_use_drop:N \l__box_internal_box } }
        \box_set_dp:Nn \l__box_internal_box \c_zero_dim
      }
    \dim_compare:nNnTF {#5} > \c_zero_dim
      {
        \hbox_set:Nn \l__box_internal_box
          {
            \box_move_up:nn \c_zero_dim
              { \box_use_drop:N \l__box_internal_box }
          }
        \box_set_ht:Nn \l__box_internal_box
          {
            (#5)
            \dim_compare:nNnT {#3} > \c_zero_dim
              { - (#3) }
          }
      }
      {
        \hbox_set:Nn \l__box_internal_box
          {
            \box_move_up:nn { - \__box_dim_eval:n {#5} }
              { \box_use_drop:N \l__box_internal_box }
          }
        \box_set_ht:Nn \l__box_internal_box \c_zero_dim
      }
    #6 #1 \l__box_internal_box
  }
\cs_new:Npn \flag_raise_if_clear:n #1
  {
    \if_cs_exist:w flag~#1~0 \cs_end:
    \else:
      \cs:w flag~#1 \cs_end: 0 ;
    \fi:
  }
\cs_new_protected:Npn \msg_show_eval:Nn #1#2
  { \exp_args:Nf \__msg_show_eval:nnN { #1 {#2} } {#2} \tl_show:n }
\cs_new_protected:Npn \msg_log_eval:Nn #1#2
  { \exp_args:Nf \__msg_show_eval:nnN { #1 {#2} } {#2} \tl_log:n }
\cs_new_protected:Npn \__msg_show_eval:nnN #1#2#3 { #3 { #2 = #1 } }
\cs_new:Npx \msg_show_item:n #1
  { \iow_newline: > ~ \c_space_tl \exp_not:N \tl_to_str:n { {#1} } }
\cs_new:Npx \msg_show_item_unbraced:n #1
  { \iow_newline: > ~ \c_space_tl \exp_not:N \tl_to_str:n {#1} }
\cs_new:Npx \msg_show_item:nn #1#2
  {
    \iow_newline: > \use:nn { ~ } { ~ }
    \exp_not:N \tl_to_str:n { {#1} }
    \use:nn { ~ } { ~ } => \use:nn { ~ } { ~ }
    \exp_not:N \tl_to_str:n { {#2} }
  }
\cs_new:Npx \msg_show_item_unbraced:nn #1#2
  {
    \iow_newline: > \use:nn { ~ } { ~ }
    \exp_not:N \tl_to_str:n {#1}
    \use:nn { ~ } { ~ } => \use:nn { ~ } { ~ }
    \exp_not:N \tl_to_str:n {#2}
  }
\cs_new_protected:Npn \bool_set_inverse:N #1
  { \bool_if:NTF #1 { \bool_set_false:N } { \bool_set_true:N } #1 }
\cs_generate_variant:Nn \bool_set_inverse:N { c }
\cs_new_protected:Npn \bool_gset_inverse:N #1
  { \bool_if:NTF #1 { \bool_gset_false:N } { \bool_gset_true:N } #1 }
\cs_generate_variant:Nn \bool_gset_inverse:N { c }
\scan_new:N \s__bool_mark
\scan_new:N \s__bool_stop
\cs_new:Npn \bool_case_true:nTF
  { \exp:w \__bool_case:NnTF \c_true_bool }
\cs_new:Npn \bool_case_true:nT #1#2
  { \exp:w \__bool_case:NnTF \c_true_bool {#1} {#2} { } }
\cs_new:Npn \bool_case_true:nF #1
  { \exp:w \__bool_case:NnTF \c_true_bool {#1} { } }
\cs_new:Npn \bool_case_true:n #1
  { \exp:w \__bool_case:NnTF \c_true_bool {#1} { } { } }
\cs_new:Npn \bool_case_false:nTF
  { \exp:w \__bool_case:NnTF \c_false_bool }
\cs_new:Npn \bool_case_false:nT #1#2
  { \exp:w \__bool_case:NnTF \c_false_bool {#1} {#2} { } }
\cs_new:Npn \bool_case_false:nF #1
  { \exp:w \__bool_case:NnTF \c_false_bool {#1} { } }
\cs_new:Npn \bool_case_false:n #1
  { \exp:w \__bool_case:NnTF \c_false_bool {#1} { } { } }
\cs_new:Npn \__bool_case:NnTF #1#2#3#4
  {
    \bool_if:NTF #1 \__bool_case_true:w \__bool_case_false:w
    #2 #1 { } \s__bool_mark {#3} \s__bool_mark {#4} \s__bool_stop
  }
\cs_new:Npn \__bool_case_true:w #1#2
  {
    \bool_if:nTF {#1}
      { \__bool_case_end:nw {#2} }
      { \__bool_case_true:w }
  }
\cs_new:Npn \__bool_case_false:w #1#2
  {
    \bool_if:nTF {#1}
      { \__bool_case_false:w }
      { \__bool_case_end:nw {#2} }
  }
\cs_new:Npn \__bool_case_end:nw #1#2#3 \s__bool_mark #4#5 \s__bool_stop
  { \exp_end: #1 #4 }
\cs_new:Npn \__prop_use_i_delimit_by_s_stop:nw #1 #2 \s__prop_stop {#1}
\cs_new:Npn \prop_rand_key_value:N #1
  {
    \prop_if_empty:NF #1
      {
        \exp_after:wN \__prop_rand_item:w
        \int_value:w \int_rand:nn { 1 } { \prop_count:N #1 }
        #1 \s__prop_stop
      }
  }
\cs_generate_variant:Nn \prop_rand_key_value:N { c }
\cs_new:Npn \__prop_rand_item:w #1 \s__prop \__prop_pair:wn #2 \s__prop #3
  {
    \int_compare:nNnF {#1} > 1
      { \__prop_use_i_delimit_by_s_stop:nw { \exp_not:n { {#2} {#3} } } }
    \exp_after:wN \__prop_rand_item:w
    \int_value:w \int_eval:n { #1 - 1 } \s__prop
  }
\cs_new:Npn \seq_mapthread_function:NNN #1#2#3
  { \exp_after:wN \__seq_mapthread_function:wNN #2 \s__seq_stop #1 #3 }
\cs_new:Npn \__seq_mapthread_function:wNN \s__seq #1 \s__seq_stop #2#3
  {
    \exp_after:wN \__seq_mapthread_function:wNw #2 \s__seq_stop #3
      #1 { ? \prg_break: } { }
    \prg_break_point:
  }
\cs_new:Npn \__seq_mapthread_function:wNw \s__seq #1 \s__seq_stop #2
  {
    \__seq_mapthread_function:Nnnwnn #2
      #1 { ? \prg_break: } { }
    \s__seq_stop
  }
\cs_new:Npn \__seq_mapthread_function:Nnnwnn #1#2#3#4 \s__seq_stop #5#6
  {
    \use_none:n #2
    \use_none:n #5
    #1 {#3} {#6}
    \__seq_mapthread_function:Nnnwnn #1 #4 \s__seq_stop
  }
\cs_generate_variant:Nn \seq_mapthread_function:NNN { Nc , c , cc }
\cs_new_protected:Npn \seq_set_filter:NNn
  { \__seq_set_filter:NNNn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_gset_filter:NNn
  { \__seq_set_filter:NNNn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_set_filter:NNNn #1#2#3#4
  {
    \__seq_push_item_def:n { \bool_if:nT {#4} { \__seq_wrap_item:n {##1} } }
    #1 #2 { #3 }
    \__seq_pop_item_def:
  }
\cs_new_protected:Npn \seq_set_from_inline_x:Nnn
  { \__seq_set_from_inline_x:NNnn \__kernel_tl_set:Nx }
\cs_new_protected:Npn \seq_gset_from_inline_x:Nnn
  { \__seq_set_from_inline_x:NNnn \__kernel_tl_gset:Nx }
\cs_new_protected:Npn \__seq_set_from_inline_x:NNnn #1#2#3#4
  {
    \__seq_push_item_def:n { \exp_not:N \__seq_item:n {#4} }
    #1 #2 { \s__seq #3 \__seq_item:n }
    \__seq_pop_item_def:
  }
\cs_new_protected:Npn \seq_set_from_function:NnN #1#2#3
  { \seq_set_from_inline_x:Nnn #1 {#2} { #3 {##1} } }
\cs_new_protected:Npn \seq_gset_from_function:NnN #1#2#3
  { \seq_gset_from_inline_x:Nnn #1 {#2} { #3 {##1} } }
\str_const:Nx \c_sys_engine_version_str
  {
    \str_case:on \c_sys_engine_str
      {
        { pdftex }
          {
            \fp_eval:n { round(\int_use:N \tex_pdftexversion:D / 100 , 2) }
            .
            \tex_pdftexrevision:D
          }
        { ptex }
          {
            \cs_if_exist:NT \tex_ptexversion:D
              {
                p
                \int_use:N  \tex_ptexversion:D
                .
                \int_use:N \tex_ptexminorversion:D
                \tex_ptexrevision:D
                -
                \int_use:N \tex_epTeXversion:D
              }
          }
        { luatex }
          {
            \fp_eval:n { round(\int_use:N \tex_luatexversion:D / 100, 2) }
            .
            \tex_luatexrevision:D
          }
        { uptex }
          {
            \cs_if_exist:NT \tex_ptexversion:D
              {
                p
                \int_use:N  \tex_ptexversion:D
                .
                \int_use:N \tex_ptexminorversion:D
                \tex_ptexrevision:D
                -
                u
                \int_use:N  \tex_uptexversion:D
                \tex_uptexrevision:D
                -
                \int_use:N \tex_epTeXversion:D
              }
          }
        { xetex }
          {
            \int_use:N \tex_XeTeXversion:D
            \tex_XeTeXrevision:D
          }
      }
  }
\cs_new_protected:Npn \ior_shell_open:Nn #1#2
  {
    \sys_if_shell:TF
      { \exp_args:No \__ior_shell_open:nN { \tl_to_str:n {#2} } #1 }
      { \__kernel_msg_error:nn { kernel } { pipe-failed } }
  }
\cs_new_protected:Npn \__ior_shell_open:nN #1#2
  {
    \tl_if_in:nnTF {#1} { " }
      {
        \__kernel_msg_error:nnx
          { kernel } { quote-in-shell } {#1}
      }
      { \__kernel_ior_open:Nn #2 { |#1 } }
  }
\__kernel_msg_new:nnnn { kernel } { pipe-failed }
  { Cannot~run~piped~system~commands. }
  {
    LaTeX~tried~to~call~a~system~process~but~this~was~not~possible.\\
    Try~the~"--shell-escape"~(or~"--enable-pipes")~option.
  }
\cs_new_protected:Npn \tl_build_begin:N #1
  { \__tl_build_begin:NN \cs_set_nopar:Npx #1 }
\cs_new_protected:Npn \tl_build_gbegin:N #1
  { \__tl_build_begin:NN \cs_gset_nopar:Npx #1 }
\cs_new_protected:Npn \__tl_build_begin:NN #1#2
  { \exp_args:Nc \__tl_build_begin:NNN { \cs_to_str:N #2 ' } #2 #1 }
\cs_new_protected:Npn \__tl_build_begin:NNN #1#2#3
  {
    #3 #1 { }
    #3 #2
      {
        \exp_not:n { \exp_end: \exp_end: \exp_end: \exp_end: }
        \exp_not:n { \__tl_build_last:NNn #3 #1 { } }
      }
  }
\cs_new_eq:NN \tl_build_clear:N \tl_build_begin:N
\cs_new_eq:NN \tl_build_gclear:N \tl_build_gbegin:N
\cs_new_protected:Npn \tl_build_put_right:Nn #1#2
  {
    \cs_set_nopar:Npx #1
      { \exp_after:wN \exp_not:n \exp_after:wN { \exp:w #1 #2 } }
  }
\cs_new_protected:Npn \tl_build_put_right:Nx #1#2
  {
    \cs_set_nopar:Npx #1
      { \exp_after:wN \exp_not:n \exp_after:wN { \exp:w #1 } #2 }
  }
\cs_new_protected:Npn \tl_build_gput_right:Nn #1#2
  {
    \cs_gset_nopar:Npx #1
      { \exp_after:wN \exp_not:n \exp_after:wN { \exp:w #1 #2 } }
  }
\cs_new_protected:Npn \tl_build_gput_right:Nx #1#2
  {
    \cs_gset_nopar:Npx #1
      { \exp_after:wN \exp_not:n \exp_after:wN { \exp:w #1 } #2 }
  }
\cs_new_protected:Npn \__tl_build_last:NNn #1#2
  {
    \if_false: { { \fi:
          \exp_end: \exp_end: \exp_end: \exp_end: \exp_end:
          \__tl_build_last:NNn #1 #2 { }
        }
      }
    \if_meaning:w \c_empty_tl #2
      \__tl_build_begin:NN #1 #2
    \fi:
    #1 #2
      {
        \exp_after:wN \exp_not:n \exp_after:wN
          {
            \exp:w \if_false: } } \fi:
            \exp_after:wN \__tl_build_put:nn \exp_after:wN {#2}
  }
\cs_new_protected:Npn \__tl_build_put:nn #1#2 { \__tl_build_put:nw {#2} #1 }
\cs_new_protected:Npn \__tl_build_put:nw #1#2 \__tl_build_last:NNn #3#4#5
  { #2 \__tl_build_last:NNn #3 #4 { #1 #5 } }
\cs_new_protected:Npn \tl_build_put_left:Nn #1
  { \__tl_build_put_left:NNn \cs_set_nopar:Npx #1 }
\cs_generate_variant:Nn \tl_build_put_left:Nn { Nx }
\cs_new_protected:Npn \tl_build_gput_left:Nn #1
  { \__tl_build_put_left:NNn \cs_gset_nopar:Npx #1 }
\cs_generate_variant:Nn \tl_build_gput_left:Nn { Nx }
\cs_new_protected:Npn \__tl_build_put_left:NNn #1#2#3
  {
    #1 #2
      {
        \exp_after:wN \exp_not:n \exp_after:wN
          {
            \exp:w \exp_after:wN \__tl_build_put:nn
              \exp_after:wN {#2} {#3}
          }
      }
  }
\cs_new_protected:Npn \tl_build_get:NN
  { \__tl_build_get:NNN \__kernel_tl_set:Nx }
\cs_new_protected:Npn \__tl_build_get:NNN #1#2#3
  { #1 #3 { \if_false: { \fi: \exp_after:wN \__tl_build_get:w #2 } } }
\cs_new:Npn \__tl_build_get:w #1 \__tl_build_last:NNn #2#3#4
  {
    \exp_not:n {#4}
    \if_meaning:w \c_empty_tl #3
      \exp_after:wN \__tl_build_get_end:w
    \fi:
    \exp_after:wN \__tl_build_get:w #3
  }
\cs_new:Npn \__tl_build_get_end:w #1#2#3
  { \exp_after:wN \exp_not:n \exp_after:wN { \if_false: } \fi: }
\cs_new_protected:Npn \tl_build_end:N #1
  {
    \__tl_build_get:NNN \__kernel_tl_set:Nx #1 #1
    \exp_args:Nc \__tl_build_end_loop:NN { \cs_to_str:N #1 ' } \tl_clear:N
  }
\cs_new_protected:Npn \tl_build_gend:N #1
  {
    \__tl_build_get:NNN \__kernel_tl_gset:Nx #1 #1
    \exp_args:Nc \__tl_build_end_loop:NN { \cs_to_str:N #1 ' } \tl_gclear:N
  }
\cs_new_protected:Npn \__tl_build_end_loop:NN #1#2
  {
    \if_meaning:w \c_empty_tl #1
      \exp_after:wN \use_none:nnnnnn
    \fi:
    #2 #1
    \exp_args:Nc \__tl_build_end_loop:NN { \cs_to_str:N #1 ' } #2
  }
\cs_new:Npn \tl_range_braced:Nnn { \exp_args:No \tl_range_braced:nnn }
\cs_generate_variant:Nn \tl_range_braced:Nnn { c }
\cs_new:Npn \tl_range_braced:nnn { \__tl_range:Nnnn \__tl_range_braced:w }
\cs_new:Npn \tl_range_unbraced:Nnn
  { \exp_args:No \tl_range_unbraced:nnn }
\cs_generate_variant:Nn \tl_range_unbraced:Nnn { c }
\cs_new:Npn \tl_range_unbraced:nnn
  { \__tl_range:Nnnn \__tl_range_unbraced:w }
\cs_new:Npn \__tl_range_braced:w #1 ; #2
  { \__tl_range_collect_braced:w #1 ; { } #2 }
\cs_new:Npn \__tl_range_unbraced:w #1 ; #2
  { \__tl_range_collect_unbraced:w #1 ; { } #2 }
\cs_new:Npn \__tl_range_collect_braced:w #1 ; #2#3
  {
    \if_int_compare:w #1 > 1 \exp_stop_f:
      \exp_after:wN \__tl_range_collect_braced:w
      \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ;
    \fi:
    { #2 {#3} }
  }
\cs_new:Npn \__tl_range_collect_unbraced:w #1 ; #2#3
  {
    \if_int_compare:w #1 > 1 \exp_stop_f:
      \exp_after:wN \__tl_range_collect_unbraced:w
      \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ;
    \fi:
    { #2 #3 }
  }
\group_begin:
  \char_set_catcode_active:N *
  \char_set_lccode:nn { `* } { `\ }
  \tex_lowercase:D { \tl_const:Nn \c_catcode_active_space_tl { * } }
\group_end:
\tl_new:N \l__peek_collect_tl
\cs_new_protected:Npn \peek_catcode_collect_inline:Nn
  { \__peek_collect:NNn \__peek_execute_branches_catcode: }
\cs_new_protected:Npn \peek_charcode_collect_inline:Nn
  { \__peek_collect:NNn \__peek_execute_branches_charcode: }
\cs_new_protected:Npn \peek_meaning_collect_inline:Nn
  { \__peek_collect:NNn \__peek_execute_branches_meaning: }
\cs_new_protected:Npn \__peek_collect:NNn #1#2#3
  {
    \group_align_safe_begin:
    \cs_set_eq:NN \l__peek_search_token #2
    \tl_set:Nn \l__peek_search_tl {#2}
    \tl_clear:N \l__peek_collect_tl
    \cs_set:Npn \__peek_false:w
      { \exp_args:No \__peek_false_aux:n \l__peek_collect_tl }
    \cs_set:Npn \__peek_false_aux:n ##1
      {
        \group_align_safe_end:
        #3
      }
    \cs_set_eq:NN \__peek_true:w \__peek_collect_true:w
    \cs_set:Npn \__peek_true_aux:w { \peek_after:Nw #1 }
    \__peek_true_aux:w
  }
\cs_new_protected:Npn \__peek_collect_true:w
  {
    \if_case:w
        \if_catcode:w \exp_not:N \l_peek_token {   1 \exp_stop_f: \fi:
        \if_catcode:w \exp_not:N \l_peek_token }   2 \exp_stop_f: \fi:
        \if_meaning:w \l_peek_token \c_space_token 3 \exp_stop_f: \fi:
        0 \exp_stop_f:
      \exp_after:wN \__peek_collect:N
    \or: \__peek_collect_remove:nw { \c_group_begin_token }
    \or: \__peek_collect_remove:nw { \c_group_end_token }
    \or: \__peek_collect_remove:nw { ~ }
    \fi:
  }
\cs_new_protected:Npn \__peek_collect:N #1
  {
    \tl_put_right:Nn \l__peek_collect_tl {#1}
    \__peek_true_aux:w
  }
\cs_new_protected:Npn \__peek_collect_remove:nw #1
  {
    \tl_put_right:Nn \l__peek_collect_tl {#1}
    \exp_after:wN \__peek_true_remove:w
  }
%% File: l3legacy.dtx
\prg_new_conditional:Npnn \legacy_if:n #1 { p , T , F , TF }
  {
    \exp_args:Nc \if_meaning:w { if#1 } \iftrue
      \prg_return_true:
    \else:
      \prg_return_false:
    \fi:
  }
%% File: l3deprecation.dtx
\bool_new:N \l__deprecation_grace_period_bool
\scan_new:N \s__deprecation_mark
\scan_new:N \s__deprecation_stop
\cs_new:Npn \__deprecation_date_compare:nNnTF #1#2#3
  { \__deprecation_date_compare_aux:w #1 -0-0- \s__deprecation_mark #2 #3 -0-0- \s__deprecation_stop }
\cs_new:Npn \__deprecation_date_compare_aux:w
  #1 - #2 - #3 - #4 \s__deprecation_mark #5 #6 - #7 - #8 - #9 \s__deprecation_stop
  {
    \int_compare:nNnTF {#1} = {#6}
      {
        \int_compare:nNnTF {#2} = {#7}
          { \int_compare:nNnTF {#3} #5 {#8} }
          { \int_compare:nNnTF {#2} #5 {#7} }
      }
      { \int_compare:nNnTF {#1} #5 {#6} }
  }
\bool_new:N \g__kernel_deprecation_undo_recent_bool
\cs_new_protected:Npn \__deprecation_not_yet_deprecated:nTF #1
  {
    \bool_set_false:N \l__deprecation_grace_period_bool
    \exp_args:No \__deprecation_date_compare:nNnTF { \ExplLoaderFileDate } < {#1}
      { \use_i:nn }
      {
        \exp_args:Nf \__deprecation_date_compare:nNnTF
          {
            \exp_after:wN \__deprecation_minus_six_months:w
            \ExplLoaderFileDate -0-0- \s__deprecation_stop
          } < {#1}
          {
            \bool_set_true:N \l__deprecation_grace_period_bool
            \bool_if:NTF \g__kernel_deprecation_undo_recent_bool
          }
          { \use_ii:nn }
      }
  }
\cs_new:Npn \__deprecation_minus_six_months:w #1 - #2 - #3 - #4 \s__deprecation_stop
  {
    \int_compare:nNnTF {#2} > 6
      { #1 - \int_eval:n { #2 - 6 } - #3 }
      { \int_eval:n { #1 - 1 } - \int_eval:n { #2 + 6 } - #3 }
  }
\cs_new_protected:Npn \__kernel_patch_deprecation:nnNNpn #1#2#3#4#5#
  { \__deprecation_patch_aux:nnNNnn {#1} {#2} #3 #4 {#5} }
\cs_new_protected:Npn \__deprecation_patch_aux:nnNNnn #1#2#3#4#5#6
  {
    \__kernel_deprecation_code:nn
      {
        \tex_let:D #4 \scan_stop:
        \__kernel_deprecation_error:Nnn #4 {#2} {#1}
      }
      { \tex_let:D #4 \scan_stop: }
    \__deprecation_not_yet_deprecated:nTF {#1}
      {
        \bool_if:nTF
          {
            \cs_if_eq_p:NN #3 \cs_gset_protected:Npn &&
            \__kernel_if_debug:TF
              { \c_true_bool } { \g__kernel_deprecation_undo_recent_bool }
          }
          { \__deprecation_warn_once:nnNnn {#1} {#2} #4 {#5} {#6} }
          { \__deprecation_patch_aux:Nn #3 { #4 #5 {#6} } }
      }
      { \__deprecation_just_error:nnNN {#1} {#2} #3 #4 }
  }
\cs_new_protected:Npn \__deprecation_warn_once:nnNnn #1#2#3#4#5
  {
    \cs_gset_protected:Npx #3
      {
        \__kernel_if_debug:TF
          {
            \exp_not:N \__kernel_msg_warning:nnxxx
              { kernel } { deprecated-command }
              {#1}
              { \token_to_str:N #3 }
              { \tl_to_str:n {#2} }
          }
          { }
        \exp_not:n { \cs_gset_protected:Npn #3 #4 {#5} }
        \exp_not:N #3
      }
    \__kernel_deprecation_code:nn { }
      { \cs_set_protected:Npn #3 #4 {#5} }
  }
\cs_new_protected:Npn \__deprecation_patch_aux:Nn #1#2
  {
    #1 #2
    \cs_if_eq:NNTF #1 \cs_gset_protected:Npn
      { \__kernel_deprecation_code:nn { } { \cs_set_protected:Npn #2 } }
      { \__kernel_deprecation_code:nn { } { \cs_set:Npn #2 } }
  }
\cs_new_protected:Npn \__deprecation_just_error:nnNN #1#2#3#4
  {
    \exp_args:NNx \__deprecation_patch_aux:Nn #3
      {
        \exp_not:N #4
        {
          \cs_if_eq:NNTF #3 \cs_gset_protected:Npn
            { \exp_not:N \__kernel_msg_error:nnnnnn }
            { \exp_not:N \__kernel_msg_expandable_error:nnnnnn }
            { kernel } { deprecated-command }
            {#1}
            { \token_to_str:N #4 }
            { \tl_to_str:n {#2} }
            { \bool_if:NT \l__deprecation_grace_period_bool { grace } }
        }
      }
  }
\cs_new_protected:Npn \__kernel_deprecation_error:Nnn #1#2#3
  {
    \tex_protected:D \tex_outer:D \tex_edef:D #1
      {
        \exp_not:N \__kernel_msg_expandable_error:nnnnn
          { kernel } { deprecated-command }
          { \tl_to_str:n {#3} } { \token_to_str:N #1 } { \tl_to_str:n {#2} }
        \exp_not:N \__kernel_msg_error:nnxxx
          { kernel } { deprecated-command }
          { \tl_to_str:n {#3} } { \token_to_str:N #1 } { \tl_to_str:n {#2} }
      }
  }
\__kernel_msg_new:nnn { kernel } { deprecated-command }
  {
    \tl_if_blank:nF {#3} { Use~ \tl_trim_spaces:n {#3} ~not~ }
    #2~deprecated~on~#1.
    \str_if_eq:nnT {#4} { grace }
      {
        \c_space_tl
        For~6~months~after~that~date~one~can~restore~a~deprecated~
        command~by~loading~the~expl3~package~with~the~option~
        'undo-recent-deprecations'.
      }
  }
\cs_new_protected:Npn \__deprecation_old_protected:Nnn #1#2#3
  {
    \__kernel_patch_deprecation:nnNNpn {#3} {#2}
    \cs_gset_protected:Npn #1 { }
  }
\cs_new_protected:Npn \__deprecation_old:Nnn #1#2#3
  {
    \__kernel_patch_deprecation:nnNNpn {#3} {#2}
    \cs_gset:Npn #1 { }
  }
\__deprecation_old:Nnn \box_resize:Nnn
  { \box_resize_to_wd_and_ht_plus_dp:Nnn } { 2019-01-01 }
\__deprecation_old:Nnn \box_use_clear:N
  { \box_use_drop:N } { 2019-01-01 }
\__deprecation_old:Nnn \c_job_name_tl
  { \c_sys_jobname_str } { 2017-01-01 }
\__deprecation_old:Nnn \c_minus_one
  { -1 } { 2019-01-01 }
\__deprecation_old:Nnn \c_zero
  { 0 } { 2020-01-01 }
\__deprecation_old:Nnn \c_one
  { 1 } { 2020-01-01 }
\__deprecation_old:Nnn \c_two
  { 2 } { 2020-01-01 }
\__deprecation_old:Nnn \c_three
  { 3 } { 2020-01-01 }
\__deprecation_old:Nnn \c_four
  { 4 } { 2020-01-01 }
\__deprecation_old:Nnn \c_five
  { 5 } { 2020-01-01 }
\__deprecation_old:Nnn \c_six
  { 6 } { 2020-01-01 }
\__deprecation_old:Nnn \c_seven
  { 7 } { 2020-01-01 }
\__deprecation_old:Nnn \c_eight
  { 8 } { 2020-01-01 }
\__deprecation_old:Nnn \c_nine
  { 9 } { 2020-01-01 }
\__deprecation_old:Nnn \c_ten
  { 10 } { 2020-01-01 }
\__deprecation_old:Nnn \c_eleven
  { 11 } { 2020-01-01 }
\__deprecation_old:Nnn \c_twelve
  { 12 } { 2020-01-01 }
\__deprecation_old:Nnn \c_thirteen
  { 13 } { 2020-01-01 }
\__deprecation_old:Nnn \c_fourteen
  { 14 } { 2020-01-01 }
\__deprecation_old:Nnn \c_fifteen
  { 15 } { 2020-01-01 }
\__deprecation_old:Nnn \c_sixteen
  { 16 } { 2020-01-01 }
\__deprecation_old:Nnn \c_thirty_two
  { 32 } { 2020-01-01 }
\__deprecation_old:Nnn \c_one_hundred
  { 100 } { 2020-01-01 }
\__deprecation_old:Nnn \c_two_hundred_fifty_five
  { 255 } { 2020-01-01 }
\__deprecation_old:Nnn \c_two_hundred_fifty_six
  { 256 } { 2020-01-01 }
\__deprecation_old:Nnn \c_one_thousand
  { 1000 } { 2020-01-01 }
\__deprecation_old:Nnn \c_ten_thousand
  { 10000 } { 2020-01-01 }
\__deprecation_old:Nnn \dim_case:nnn
  { \dim_case:nnF } { 2015-07-14 }
\__deprecation_old:Nnn \file_add_path:nN
  { \file_get_full_name:nN } { 2019-01-01 }
\__deprecation_old_protected:Nnn \file_if_exist_input:nT
  { \file_if_exist:nT and~ \file_input:n } { 2018-03-05 }
\__deprecation_old_protected:Nnn \file_if_exist_input:nTF
  { \file_if_exist:nT and~ \file_input:n } { 2018-03-05 }
\__deprecation_old:Nnn \file_list:
  { \file_log_list: } { 2019-01-01 }
\__deprecation_old:Nnn \file_path_include:n
  { \seq_put_right:Nn \l_file_search_path_seq } { 2019-01-01 }
\__deprecation_old:Nnn \file_path_remove:n
  { \seq_remove_all:Nn \l_file_search_path_seq } { 2019-01-01 }
\__deprecation_old:Nnn \g_file_current_name_tl
  { \g_file_curr_name_str } { 2019-01-01 }
\__deprecation_old:Nnn \int_case:nnn
  { \int_case:nnF } { 2015-07-14 }
\__deprecation_old:Nnn \int_from_binary:n
  { \int_from_bin:n } { 2016-01-05 }
\__deprecation_old:Nnn \int_from_hexadecimal:n
  { \int_from_hex:n } { 2016-01-05 }
\__deprecation_old:Nnn \int_from_octal:n
  { \int_from_oct:n } { 2016-01-05 }
\__deprecation_old:Nnn \int_to_binary:n
  { \int_to_bin:n } { 2016-01-05 }
\__deprecation_old:Nnn \int_to_hexadecimal:n
  { \int_to_hex:n } { 2016-01-05 }
\__deprecation_old:Nnn \int_to_octal:n
  { \int_to_oct:n } { 2016-01-05 }
\__deprecation_old_protected:Nnn \ior_get_str:NN
  { \ior_str_get:NN } { 2018-03-05 }
\__deprecation_old:Nnn \ior_list_streams:
  { \ior_show_list: } { 2019-01-01 }
\__deprecation_old:Nnn \ior_log_streams:
  { \ior_log_list: } { 2019-01-01 }
\__deprecation_old:Nnn \iow_list_streams:
  { \iow_show_list: } { 2019-01-01 }
\__deprecation_old:Nnn \iow_log_streams:
  { \iow_log_list: } { 2019-01-01 }
\__deprecation_old:Nnn \lua_escape_x:n
  { \lua_escape:e } { 2020-01-01 }
\__deprecation_old:Nnn \lua_now_x:n
  { \lua_now:e } { 2020-01-01 }
\__deprecation_old_protected:Nnn \lua_shipout_x:n
  { \lua_shipout_e:n } { 2020-01-01 }
\__deprecation_old:Nnn \luatex_if_engine_p:
  { \sys_if_engine_luatex_p: } { 2017-01-01 }
\__deprecation_old:Nnn \luatex_if_engine:F
  { \sys_if_engine_luatex:F } { 2017-01-01 }
\__deprecation_old:Nnn \luatex_if_engine:T
  { \sys_if_engine_luatex:T } { 2017-01-01 }
\__deprecation_old:Nnn \luatex_if_engine:TF
  { \sys_if_engine_luatex:TF } { 2017-01-01 }
\__deprecation_old_protected:Nnn \msg_interrupt:nnn
  { [Defined~error~message] } { 2020-01-01 }
\__deprecation_old_protected:Nnn \msg_log:n
  { \iow_log:n } { 2020-01-01 }
\__deprecation_old_protected:Nnn \msg_term:n
  { \iow_term:n } { 2020-01-01 }
\__deprecation_old:Nnn \pdftex_if_engine_p:
  { \sys_if_engine_pdftex_p: } { 2017-01-01 }
\__deprecation_old:Nnn \pdftex_if_engine:F
  { \sys_if_engine_pdftex:F } { 2017-01-01 }
\__deprecation_old:Nnn \pdftex_if_engine:T
  { \sys_if_engine_pdftex:T } { 2017-01-01 }
\__deprecation_old:Nnn \pdftex_if_engine:TF
  { \sys_if_engine_pdftex:TF } { 2017-01-01 }
\__deprecation_old:Nnn \prop_get:cn
  { \prop_item:cn } { 2016-01-05 }
\__deprecation_old:Nnn \prop_get:Nn
  { \prop_item:Nn } { 2016-01-05 }
\__deprecation_old:Nnn \quark_if_recursion_tail_break:N
  { } { 2015-07-14 }
\__deprecation_old:Nnn \quark_if_recursion_tail_break:n
  { } { 2015-07-14 }
\__deprecation_old:Nnn \scan_align_safe_stop:
  { protected~commands } { 2017-01-01 }
\__deprecation_old:Nnn \sort_ordered:
  { \sort_return_same: } { 2019-01-01 }
\__deprecation_old:Nnn \sort_reversed:
  { \sort_return_swapped: } { 2019-01-01 }
\__deprecation_old:Nnn \str_case:nnn
  { \str_case:nnF } { 2015-07-14 }
\__deprecation_old:Nnn \str_case:onn
  { \str_case:onF } { 2015-07-14 }
\__deprecation_old:Nnn \str_case_x:nn
  { \str_case_e:nn } { 2020-01-01 }
\__deprecation_old:Nnn \str_case_x:nnn
  { \str_case_e:nnF } { 2015-07-14 }
\__deprecation_old:Nnn \str_case_x:nnT
  { \str_case_e:nnT } { 2020-01-01 }
\__deprecation_old:Nnn \str_case_x:nnTF
  { \str_case_e:nnTF } { 2020-01-01 }
\__deprecation_old:Nnn \str_case_x:nnF
  { \str_case_e:nnF } { 2020-01-01 }
\__deprecation_old:Nnn \str_if_eq_x_p:nn
  { \str_if_eq_p:ee } { 2020-01-01 }
\__deprecation_old:Nnn \str_if_eq_x:nnT
  { \str_if_eq:eeT } { 2020-01-01 }
\__deprecation_old:Nnn \str_if_eq_x:nnF
  { \str_if_eq:eeF } { 2020-01-01 }
\__deprecation_old:Nnn \str_if_eq_x:nnTF
  { \str_if_eq:eeTF } { 2020-01-01 }
\__deprecation_old_protected:Nnn \tl_show_analysis:N
  { \tl_analysis_show:N } { 2020-01-01 }
\__deprecation_old_protected:Nnn \tl_show_analysis:n
  { \tl_analysis_show:n } { 2020-01-01 }
\__deprecation_old:Nnn \tl_case:cnn
  { \tl_case:cnF } { 2015-07-14 }
\__deprecation_old:Nnn \tl_case:Nnn
  { \tl_case:NnF } { 2015-07-14 }
\__deprecation_old_protected:Nnn \tl_to_lowercase:n
  { \tex_lowercase:D } { 2018-03-05 }
\__deprecation_old_protected:Nnn \tl_to_uppercase:n
  { \tex_uppercase:D } { 2018-03-05 }
\__deprecation_old:Nnn \token_new:Nn
  { \cs_new_eq:NN } { 2019-01-01 }
\__deprecation_old:Nnn \xetex_if_engine_p:
  { \sys_if_engine_xetex_p: } { 2017-01-01 }
\__deprecation_old:Nnn \xetex_if_engine:F
  { \sys_if_engine_xetex:F } { 2017-01-01 }
\__deprecation_old:Nnn \xetex_if_engine:T
  { \sys_if_engine_xetex:T } { 2017-01-01 }
\__deprecation_old:Nnn \xetex_if_engine:TF
  { \sys_if_engine_xetex:TF } { 2017-01-01 }
\group_begin:
\cs_set_protected:Npn \ProvidesExplFile
  {
    \char_set_catcode_space:n { `\  }
    \ProvidesExplFileAux
  }
\cs_set_protected:Npx \ProvidesExplFileAux #1#2#3#4
  {
    \group_end:
    \cs_if_exist:NTF \ProvidesFile
      { \exp_not:N \ProvidesFile {#1} [ #2~v#3~#4 ] }
      { \iow_log:x { File:~#1~#2~v#3~#4 } }
  }
\cs_gset_protected:Npn \__kernel_sys_configuration_load:n #1
  { \file_input:n { #1 .def } }
\__kernel_sys_configuration_load:n { l3deprecation }
%% 
%%
%% End of file `expl3-code.tex'.
