%%
%% This is file `babel.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% babel.dtx  (with options: `package')
%% 
%%
%% Copyright (C) 2012-2025 Javier Bezos and Johannes L. Braams.
%% Copyright (C) 1989-2012 Johannes L. Braams and
%%           any individual authors listed elsewhere in this file.
%% All rights reserved.
%%
%%
%% This file is part of the Babel system.
%% --------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% The Current Maintainer of this work is Javier Bezos.
%%
%% The list of derived (unpacked) files belonging to the distribution
%% and covered by LPPL is defined by the unpacking scripts (with
%% extension |.ins|) which are part of the distribution.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{babel}%
  [2025/02/14 v25.4
   The multilingual framework for pdfLaTeX, LuaLaTeX and XeLaTeX]
\@ifpackagewith{babel}{debug}
  {\providecommand\bbl@trace[1]{\message{^^J[ #1 ]}}%
   \let\bbl@debug\@firstofone
   \ifx\directlua\@undefined\else
     \directlua{
       Babel = Babel or {}
       Babel.debug = true }%
     \input{babel-debug.tex}%
   \fi}
  {\providecommand\bbl@trace[1]{}%
   \let\bbl@debug\@gobble
   \ifx\directlua\@undefined\else
     \directlua{
       Babel = Babel or {}
       Babel.debug = false }%
   \fi}
\def\bbl@error#1{% Implicit #2#3#4
  \begingroup
    \catcode`\\=0 \catcode`\==12 \catcode`\`=12
    \input errbabel.def
  \endgroup
  \bbl@error{#1}}
\def\bbl@warning#1{%
  \begingroup
    \def\\{\MessageBreak}%
    \PackageWarning{babel}{#1}%
  \endgroup}
\def\bbl@infowarn#1{%
  \begingroup
    \def\\{\MessageBreak}%
    \PackageNote{babel}{#1}%
  \endgroup}
\def\bbl@info#1{%
  \begingroup
    \def\\{\MessageBreak}%
    \PackageInfo{babel}{#1}%
  \endgroup}
\bbl@trace{Basic macros}
\def\bbl@stripslash{\expandafter\@gobble\string}
\def\bbl@add#1#2{%
  \bbl@ifunset{\bbl@stripslash#1}%
    {\def#1{#2}}%
    {\expandafter\def\expandafter#1\expandafter{#1#2}}}
\def\bbl@xin@{\@expandtwoargs\in@}
\def\bbl@carg#1#2{\expandafter#1\csname#2\endcsname}%
\def\bbl@ncarg#1#2#3{\expandafter#1\expandafter#2\csname#3\endcsname}%
\def\bbl@ccarg#1#2#3{%
  \expandafter#1\csname#2\expandafter\endcsname\csname#3\endcsname}%
\def\bbl@csarg#1#2{\expandafter#1\csname bbl@#2\endcsname}%
\def\bbl@cs#1{\csname bbl@#1\endcsname}
\def\bbl@cl#1{\csname bbl@#1@\languagename\endcsname}
\def\bbl@loop#1#2#3{\bbl@@loop#1{#3}#2,\@nnil,}
\def\bbl@loopx#1#2{\expandafter\bbl@loop\expandafter#1\expandafter{#2}}
\def\bbl@@loop#1#2#3,{%
  \ifx\@nnil#3\relax\else
    \def#1{#3}#2\bbl@afterfi\bbl@@loop#1{#2}%
  \fi}
\def\bbl@for#1#2#3{\bbl@loopx#1{#2}{\ifx#1\@empty\else#3\fi}}
\def\bbl@add@list#1#2{%
  \edef#1{%
    \bbl@ifunset{\bbl@stripslash#1}%
      {}%
      {\ifx#1\@empty\else#1,\fi}%
    #2}}
\long\def\bbl@afterelse#1\else#2\fi{\fi#1}
\long\def\bbl@afterfi#1\fi{\fi#1}
\def\bbl@exp#1{%
  \begingroup
    \let\\\noexpand
    \let\<\bbl@exp@en
    \let\[\bbl@exp@ue
    \edef\bbl@exp@aux{\endgroup#1}%
  \bbl@exp@aux}
\def\bbl@exp@en#1>{\expandafter\noexpand\csname#1\endcsname}%
\def\bbl@exp@ue#1]{%
  \unexpanded\expandafter\expandafter\expandafter{\csname#1\endcsname}}%
\def\bbl@tempa#1{%
  \long\def\bbl@trim##1##2{%
    \futurelet\bbl@trim@a\bbl@trim@c##2\@nil\@nil#1\@nil\relax{##1}}%
  \def\bbl@trim@c{%
    \ifx\bbl@trim@a\@sptoken
      \expandafter\bbl@trim@b
    \else
      \expandafter\bbl@trim@b\expandafter#1%
    \fi}%
  \long\def\bbl@trim@b#1##1 \@nil{\bbl@trim@i##1}}
\bbl@tempa{ }
\long\def\bbl@trim@i#1\@nil#2\relax#3{#3{#1}}
\long\def\bbl@trim@def#1{\bbl@trim{\def#1}}
\begingroup
  \gdef\bbl@ifunset#1{%
    \expandafter\ifx\csname#1\endcsname\relax
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi}
  \bbl@ifunset{ifcsname}%
    {}%
    {\gdef\bbl@ifunset#1{%
       \ifcsname#1\endcsname
         \expandafter\ifx\csname#1\endcsname\relax
           \bbl@afterelse\expandafter\@firstoftwo
         \else
           \bbl@afterfi\expandafter\@secondoftwo
         \fi
       \else
         \expandafter\@firstoftwo
       \fi}}
\endgroup
\def\bbl@ifblank#1{%
  \bbl@ifblank@i#1\@nil\@nil\@secondoftwo\@firstoftwo\@nil}
\long\def\bbl@ifblank@i#1#2\@nil#3#4#5\@nil{#4}
\def\bbl@ifset#1#2#3{%
  \bbl@ifunset{#1}{#3}{\bbl@exp{\\\bbl@ifblank{\@nameuse{#1}}}{#3}{#2}}}
\def\bbl@forkv#1#2{%
  \def\bbl@kvcmd##1##2##3{#2}%
  \bbl@kvnext#1,\@nil,}
\def\bbl@kvnext#1,{%
  \ifx\@nil#1\relax\else
    \bbl@ifblank{#1}{}{\bbl@forkv@eq#1=\@empty=\@nil{#1}}%
    \expandafter\bbl@kvnext
  \fi}
\def\bbl@forkv@eq#1=#2=#3\@nil#4{%
  \bbl@trim@def\bbl@forkv@a{#1}%
  \bbl@trim{\expandafter\bbl@kvcmd\expandafter{\bbl@forkv@a}}{#2}{#4}}
\def\bbl@vforeach#1#2{%
  \def\bbl@forcmd##1{#2}%
  \bbl@fornext#1,\@nil,}
\def\bbl@fornext#1,{%
  \ifx\@nil#1\relax\else
    \bbl@ifblank{#1}{}{\bbl@trim\bbl@forcmd{#1}}%
    \expandafter\bbl@fornext
  \fi}
\def\bbl@foreach#1{\expandafter\bbl@vforeach\expandafter{#1}}
\def\bbl@replace#1#2#3{% in #1 -> repl #2 by #3
  \toks@{}%
  \def\bbl@replace@aux##1#2##2#2{%
    \ifx\bbl@nil##2%
      \toks@\expandafter{\the\toks@##1}%
    \else
      \toks@\expandafter{\the\toks@##1#3}%
      \bbl@afterfi
      \bbl@replace@aux##2#2%
    \fi}%
  \expandafter\bbl@replace@aux#1#2\bbl@nil#2%
  \edef#1{\the\toks@}}
\ifx\detokenize\@undefined\else % Unused macros if old Plain TeX
  \bbl@exp{\def\\\bbl@parsedef##1\detokenize{macro:}}#2->#3\relax{%
    \def\bbl@tempa{#1}%
    \def\bbl@tempb{#2}%
    \def\bbl@tempe{#3}}
  \def\bbl@sreplace#1#2#3{%
    \begingroup
      \expandafter\bbl@parsedef\meaning#1\relax
      \def\bbl@tempc{#2}%
      \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}%
      \def\bbl@tempd{#3}%
      \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}%
      \bbl@xin@{\bbl@tempc}{\bbl@tempe}% If not in macro, do nothing
      \ifin@
        \bbl@exp{\\\bbl@replace\\\bbl@tempe{\bbl@tempc}{\bbl@tempd}}%
        \def\bbl@tempc{%     Expanded an executed below as 'uplevel'
           \\\makeatletter % "internal" macros with @ are assumed
           \\\scantokens{%
             \bbl@tempa\\\@namedef{\bbl@stripslash#1}\bbl@tempb{\bbl@tempe}}%
           \catcode64=\the\catcode64\relax}%  Restore @
      \else
        \let\bbl@tempc\@empty  % Not \relax
      \fi
      \bbl@exp{%      For the 'uplevel' assignments
    \endgroup
      \bbl@tempc}}  % empty or expand to set #1 with changes
\fi
\def\bbl@ifsamestring#1#2{%
  \begingroup
    \protected@edef\bbl@tempb{#1}%
    \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}%
    \protected@edef\bbl@tempc{#2}%
    \edef\bbl@tempc{\expandafter\strip@prefix\meaning\bbl@tempc}%
    \ifx\bbl@tempb\bbl@tempc
      \aftergroup\@firstoftwo
    \else
      \aftergroup\@secondoftwo
    \fi
  \endgroup}
\chardef\bbl@engine=%
  \ifx\directlua\@undefined
    \ifx\XeTeXinputencoding\@undefined
      \z@
    \else
      \tw@
    \fi
  \else
    \@ne
  \fi
\def\bbl@bsphack{%
  \ifhmode
    \hskip\z@skip
    \def\bbl@esphack{\loop\ifdim\lastskip>\z@\unskip\repeat\unskip}%
  \else
    \let\bbl@esphack\@empty
  \fi}
\def\bbl@cased{%
  \ifx\oe\OE
    \expandafter\in@\expandafter
      {\expandafter\OE\expandafter}\expandafter{\oe}%
    \ifin@
      \bbl@afterelse\expandafter\MakeUppercase
    \else
      \bbl@afterfi\expandafter\MakeLowercase
    \fi
  \else
    \expandafter\@firstofone
  \fi}
\def\bbl@extras@wrap#1#2#3{% 1:in-test, 2:before, 3:after
  \toks@\expandafter\expandafter\expandafter{%
    \csname extras\languagename\endcsname}%
  \bbl@exp{\\\in@{#1}{\the\toks@}}%
  \ifin@\else
    \@temptokena{#2}%
    \edef\bbl@tempc{\the\@temptokena\the\toks@}%
    \toks@\expandafter{\bbl@tempc#3}%
    \expandafter\edef\csname extras\languagename\endcsname{\the\toks@}%
  \fi}
\@ifpackagewith{babel}{silent}
  {\let\bbl@info\@gobble
   \let\bbl@infowarn\@gobble
   \let\bbl@warning\@gobble}
  {}
\def\AfterBabelLanguage#1{%
  \global\expandafter\bbl@add\csname#1.ldf-h@@k\endcsname}%
\ifx\bbl@languages\@undefined\else
  \begingroup
    \catcode`\^^I=12
    \@ifpackagewith{babel}{showlanguages}{%
      \begingroup
        \def\bbl@elt#1#2#3#4{\wlog{#2^^I#1^^I#3^^I#4}}%
        \wlog{<*languages>}%
        \bbl@languages
        \wlog{</languages>}%
      \endgroup}{}
  \endgroup
  \def\bbl@elt#1#2#3#4{%
    \ifnum#2=\z@
      \gdef\bbl@nulllanguage{#1}%
      \def\bbl@elt##1##2##3##4{}%
    \fi}%
  \bbl@languages
\fi%
\bbl@trace{Defining option 'base'}
\@ifpackagewith{babel}{base}{%
  \let\bbl@onlyswitch\@empty
  \let\bbl@provide@locale\relax
  \input babel.def
  \let\bbl@onlyswitch\@undefined
  \ifx\directlua\@undefined
    \DeclareOption*{\bbl@patterns{\CurrentOption}}%
  \else
    \input luababel.def
    \DeclareOption*{\bbl@patterns@lua{\CurrentOption}}%
  \fi
  \DeclareOption{base}{}%
  \DeclareOption{showlanguages}{}%
  \ProcessOptions
  \global\expandafter\let\csname opt@babel.sty\endcsname\relax
  \global\expandafter\let\csname ver@babel.sty\endcsname\relax
  \global\let\@ifl@ter@@\@ifl@ter
  \def\@ifl@ter#1#2#3#4#5{\global\let\@ifl@ter\@ifl@ter@@}%
  \endinput}{}%
\bbl@trace{key=value and another general options}
\bbl@csarg\let{tempa\expandafter}\csname opt@babel.sty\endcsname
\def\bbl@tempb#1.#2{%  Remove trailing dot
   #1\ifx\@empty#2\else,\bbl@afterfi\bbl@tempb#2\fi}%
\def\bbl@tempe#1=#2\@@{%
  \bbl@csarg\edef{mod@#1}{\bbl@tempb#2}}
\def\bbl@tempd#1.#2\@nnil{%
  \ifx\@empty#2%
    \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1}%
  \else
    \in@{,provide=}{,#1}%
    \ifin@
      \edef\bbl@tempc{%
        \ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1.\bbl@tempb#2}%
    \else
      \in@{$modifiers$}{$#1$}%
      \ifin@
        \bbl@tempe#2\@@
      \else
        \in@{=}{#1}%
        \ifin@
          \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1.#2}%
        \else
          \edef\bbl@tempc{\ifx\bbl@tempc\@empty\else\bbl@tempc,\fi#1}%
          \bbl@csarg\edef{mod@#1}{\bbl@tempb#2}%
        \fi
      \fi
    \fi
  \fi}
\let\bbl@tempc\@empty
\bbl@foreach\bbl@tempa{\bbl@tempd#1.\@empty\@nnil}
\expandafter\let\csname opt@babel.sty\endcsname\bbl@tempc
\DeclareOption{KeepShorthandsActive}{}
\DeclareOption{activeacute}{}
\DeclareOption{activegrave}{}
\DeclareOption{debug}{}
\DeclareOption{noconfigs}{}
\DeclareOption{showlanguages}{}
\DeclareOption{silent}{}
\DeclareOption{shorthands=off}{\bbl@tempa shorthands=\bbl@tempa}
\chardef\bbl@iniflag\z@
\DeclareOption{provide=*}{\chardef\bbl@iniflag\@ne}    % main = 1
\DeclareOption{provide+=*}{\chardef\bbl@iniflag\tw@}   % second = 2
\DeclareOption{provide*=*}{\chardef\bbl@iniflag\thr@@} % second + main
\newif\ifbbl@single
\DeclareOption{selectors=off}{\bbl@singletrue}
\DeclareOption{math=active}{}
\DeclareOption{math=normal}{\def\bbl@mathnormal{\noexpand\textormath}}
\DeclareOption{nocase}{}
\let\bbl@opt@strings\@nnil % accept strings=value
\DeclareOption{strings}{\def\bbl@opt@strings{\BabelStringsDefault}}
\DeclareOption{strings=encoded}{\let\bbl@opt@strings\relax}
\def\BabelStringsDefault{generic}
\DeclareOption{hyphenmap=off}{\chardef\bbl@opt@hyphenmap\z@}
\DeclareOption{hyphenmap=first}{\chardef\bbl@opt@hyphenmap\@ne}
\DeclareOption{hyphenmap=select}{\chardef\bbl@opt@hyphenmap\tw@}
\DeclareOption{hyphenmap=other}{\chardef\bbl@opt@hyphenmap\thr@@}
\DeclareOption{hyphenmap=other*}{\chardef\bbl@opt@hyphenmap4\relax}
\DeclareOption{ensureinfo=off}{}
\DeclareOption{safe=none}{\let\bbl@opt@safe\@empty}
\DeclareOption{safe=bib}{\def\bbl@opt@safe{B}}
\DeclareOption{safe=ref}{\def\bbl@opt@safe{R}}
\DeclareOption{safe=refbib}{\def\bbl@opt@safe{BR}}
\DeclareOption{safe=bibref}{\def\bbl@opt@safe{BR}}
\chardef\bbl@bidimode\z@
\DeclareOption{bidi=default}{\chardef\bbl@bidimode=\@ne}
\DeclareOption{bidi=basic}{\chardef\bbl@bidimode=101 }
\DeclareOption{bidi=basic-r}{\chardef\bbl@bidimode=102 }
\DeclareOption{bidi=bidi}{\chardef\bbl@bidimode=201 }
\DeclareOption{bidi=bidi-r}{\chardef\bbl@bidimode=202 }
\DeclareOption{bidi=bidi-l}{\chardef\bbl@bidimode=203 }
\chardef\bbl@eqnpos\z@
\DeclareOption{leqno}{\chardef\bbl@eqnpos\@ne}
\DeclareOption{fleqn}{\chardef\bbl@eqnpos\tw@}
\let\bbl@opt@shorthands\@nnil
\let\bbl@opt@config\@nnil
\let\bbl@opt@main\@nnil
\let\bbl@opt@headfoot\@nnil
\let\bbl@opt@layout\@nnil
\let\bbl@opt@provide\@nnil
\def\bbl@tempa#1=#2\bbl@tempa{%
  \bbl@csarg\ifx{opt@#1}\@nnil
    \bbl@csarg\edef{opt@#1}{#2}%
  \else
    \bbl@error{bad-package-option}{#1}{#2}{}%
  \fi}
\let\bbl@language@opts\@empty
\DeclareOption*{%
  \bbl@xin@{\string=}{\CurrentOption}%
  \ifin@
    \expandafter\bbl@tempa\CurrentOption\bbl@tempa
  \else
    \bbl@add@list\bbl@language@opts{\CurrentOption}%
  \fi}
\ProcessOptions*
\ifx\bbl@opt@provide\@nnil
  \let\bbl@opt@provide\@empty  % %%% MOVE above
\else
  \chardef\bbl@iniflag\@ne
  \bbl@exp{\\\bbl@forkv{\@nameuse{@raw@opt@babel.sty}}}{%
    \in@{,provide,}{,#1,}%
    \ifin@
      \def\bbl@opt@provide{#2}%
    \fi}
\fi
\bbl@trace{Conditional loading of shorthands}
\def\bbl@sh@string#1{%
  \ifx#1\@empty\else
    \ifx#1t\string~%
    \else\ifx#1c\string,%
    \else\string#1%
    \fi\fi
    \expandafter\bbl@sh@string
  \fi}
\ifx\bbl@opt@shorthands\@nnil
  \def\bbl@ifshorthand#1#2#3{#2}%
\else\ifx\bbl@opt@shorthands\@empty
  \def\bbl@ifshorthand#1#2#3{#3}%
\else
  \def\bbl@ifshorthand#1{%
    \bbl@xin@{\string#1}{\bbl@opt@shorthands}%
    \ifin@
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi}
  \edef\bbl@opt@shorthands{%
    \expandafter\bbl@sh@string\bbl@opt@shorthands\@empty}%
  \bbl@ifshorthand{'}%
    {\PassOptionsToPackage{activeacute}{babel}}{}
  \bbl@ifshorthand{`}%
    {\PassOptionsToPackage{activegrave}{babel}}{}
\fi\fi
\ifx\bbl@opt@headfoot\@nnil\else
  \g@addto@macro\@resetactivechars{%
    \set@typeset@protect
    \expandafter\select@language@x\expandafter{\bbl@opt@headfoot}%
    \let\protect\noexpand}
\fi
\ifx\bbl@opt@safe\@undefined
  \def\bbl@opt@safe{BR}
  % \let\bbl@opt@safe\@empty % Pending of \cite
\fi
\bbl@trace{Defining IfBabelLayout}
\ifx\bbl@opt@layout\@nnil
  \newcommand\IfBabelLayout[3]{#3}%
\else
  \bbl@exp{\\\bbl@forkv{\@nameuse{@raw@opt@babel.sty}}}{%
    \in@{,layout,}{,#1,}%
    \ifin@
      \def\bbl@opt@layout{#2}%
      \bbl@replace\bbl@opt@layout{ }{.}%
    \fi}
  \newcommand\IfBabelLayout[1]{%
    \@expandtwoargs\in@{.#1.}{.\bbl@opt@layout.}%
    \ifin@
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi}
\fi
\def\bbl@version{25.4}
\def\bbl@date{2025/02/14}
\ifx\language\@undefined
  \csname newcount\endcsname\language
\fi
\countdef\last@language=19
\def\addlanguage{\csname newlanguage\endcsname}
\def\adddialect#1#2{%
  \global\chardef#1#2\relax
  \bbl@usehooks{adddialect}{{#1}{#2}}%
  \begingroup
    \count@#1\relax
    \def\bbl@elt##1##2##3##4{%
      \ifnum\count@=##2\relax
        \edef\bbl@tempa{\expandafter\@gobbletwo\string#1}%
        \bbl@info{Hyphen rules for '\expandafter\@gobble\bbl@tempa'
                  set to \expandafter\string\csname l@##1\endcsname\\%
                  (\string\language\the\count@). Reported}%
        \def\bbl@elt####1####2####3####4{}%
      \fi}%
    \bbl@cs{languages}%
  \endgroup}
\def\bbl@fixname#1{%
  \begingroup
    \def\bbl@tempe{l@}%
    \edef\bbl@tempd{\noexpand\@ifundefined{\noexpand\bbl@tempe#1}}%
    \bbl@tempd
      {\lowercase\expandafter{\bbl@tempd}%
         {\uppercase\expandafter{\bbl@tempd}%
           \@empty
           {\edef\bbl@tempd{\def\noexpand#1{#1}}%
            \uppercase\expandafter{\bbl@tempd}}}%
         {\edef\bbl@tempd{\def\noexpand#1{#1}}%
          \lowercase\expandafter{\bbl@tempd}}}%
      \@empty
    \edef\bbl@tempd{\endgroup\def\noexpand#1{#1}}%
  \bbl@tempd
  \bbl@exp{\\\bbl@usehooks{languagename}{{\languagename}{#1}}}}
\def\bbl@iflanguage#1{%
  \@ifundefined{l@#1}{\@nolanerr{#1}\@gobble}\@firstofone}
\def\bbl@bcpcase#1#2#3#4\@@#5{%
  \ifx\@empty#3%
    \uppercase{\def#5{#1#2}}%
  \else
    \uppercase{\def#5{#1}}%
    \lowercase{\edef#5{#5#2#3#4}}%
  \fi}
\def\bbl@bcplookup#1-#2-#3-#4\@@{%
  \let\bbl@bcp\relax
  \lowercase{\def\bbl@tempa{#1}}%
  \ifx\@empty#2%
    \IfFileExists{babel-\bbl@tempa.ini}{\let\bbl@bcp\bbl@tempa}{}%
  \else\ifx\@empty#3%
    \bbl@bcpcase#2\@empty\@empty\@@\bbl@tempb
    \IfFileExists{babel-\bbl@tempa-\bbl@tempb.ini}%
      {\edef\bbl@bcp{\bbl@tempa-\bbl@tempb}}%
      {}%
    \ifx\bbl@bcp\relax
      \IfFileExists{babel-\bbl@tempa.ini}{\let\bbl@bcp\bbl@tempa}{}%
    \fi
  \else
    \bbl@bcpcase#2\@empty\@empty\@@\bbl@tempb
    \bbl@bcpcase#3\@empty\@empty\@@\bbl@tempc
    \IfFileExists{babel-\bbl@tempa-\bbl@tempb-\bbl@tempc.ini}%
      {\edef\bbl@bcp{\bbl@tempa-\bbl@tempb-\bbl@tempc}}%
      {}%
    \ifx\bbl@bcp\relax
      \IfFileExists{babel-\bbl@tempa-\bbl@tempc.ini}%
        {\edef\bbl@bcp{\bbl@tempa-\bbl@tempc}}%
        {}%
    \fi
    \ifx\bbl@bcp\relax
      \IfFileExists{babel-\bbl@tempa-\bbl@tempc.ini}%
        {\edef\bbl@bcp{\bbl@tempa-\bbl@tempc}}%
        {}%
    \fi
    \ifx\bbl@bcp\relax
      \IfFileExists{babel-\bbl@tempa.ini}{\let\bbl@bcp\bbl@tempa}{}%
    \fi
  \fi\fi}
\let\bbl@initoload\relax
\def\iflanguage#1{%
  \bbl@iflanguage{#1}{%
    \ifnum\csname l@#1\endcsname=\language
      \expandafter\@firstoftwo
    \else
      \expandafter\@secondoftwo
    \fi}}
\let\bbl@select@type\z@
\edef\selectlanguage{%
  \noexpand\protect
  \expandafter\noexpand\csname selectlanguage \endcsname}
\ifx\@undefined\protect\let\protect\relax\fi
\let\xstring\string
\def\bbl@language@stack{}
\def\bbl@push@language{%
  \ifx\languagename\@undefined\else
    \ifx\currentgrouplevel\@undefined
      \xdef\bbl@language@stack{\languagename+\bbl@language@stack}%
    \else
      \ifnum\currentgrouplevel=\z@
        \xdef\bbl@language@stack{\languagename+}%
      \else
        \xdef\bbl@language@stack{\languagename+\bbl@language@stack}%
      \fi
    \fi
  \fi}
\def\bbl@pop@lang#1+#2\@@{%
  \edef\languagename{#1}%
  \xdef\bbl@language@stack{#2}}
\let\bbl@ifrestoring\@secondoftwo
\def\bbl@pop@language{%
  \expandafter\bbl@pop@lang\bbl@language@stack\@@
  \let\bbl@ifrestoring\@firstoftwo
  \expandafter\bbl@set@language\expandafter{\languagename}%
  \let\bbl@ifrestoring\@secondoftwo}
\chardef\localeid\z@
\def\bbl@id@last{0}    % No real need for a new counter
\def\bbl@id@assign{%
  \bbl@ifunset{bbl@id@@\languagename}%
    {\count@\bbl@id@last\relax
     \advance\count@\@ne
     \global\bbl@csarg\chardef{id@@\languagename}\count@
     \edef\bbl@id@last{\the\count@}%
     \ifcase\bbl@engine\or
       \directlua{
         Babel.locale_props[\bbl@id@last] = {}
         Babel.locale_props[\bbl@id@last].name = '\languagename'
         Babel.locale_props[\bbl@id@last].vars = {}
        }%
      \fi}%
    {}%
    \chardef\localeid\bbl@cl{id@}}
\expandafter\def\csname selectlanguage \endcsname#1{%
  \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\tw@\fi
  \bbl@push@language
  \aftergroup\bbl@pop@language
  \bbl@set@language{#1}}
\let\endselectlanguage\relax
\def\BabelContentsFiles{toc,lof,lot}
\def\bbl@set@language#1{% from selectlanguage, pop@
  % The old buggy way. Preserved for compatibility, but simplified
  \edef\languagename{\expandafter\string#1\@empty}%
  \select@language{\languagename}%
  % write to auxs
  \expandafter\ifx\csname date\languagename\endcsname\relax\else
    \if@filesw
      \ifx\babel@aux\@gobbletwo\else % Set if single in the first, redundant
        \bbl@savelastskip
        \protected@write\@auxout{}{\string\babel@aux{\bbl@auxname}{}}%
        \bbl@restorelastskip
      \fi
      \bbl@usehooks{write}{}%
    \fi
  \fi}
\let\bbl@restorelastskip\relax
\let\bbl@savelastskip\relax
\def\select@language#1{% from set@, babel@aux, babel@toc
  \ifx\bbl@selectorname\@empty
    \def\bbl@selectorname{select}%
  \fi
  % set hymap
  \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
  % set name (when coming from babel@aux)
  \edef\languagename{#1}%
  \bbl@fixname\languagename
  % define \localename when coming from set@, with a trick
  \ifx\scantokens\@undefined
    \def\localename{??}%
  \else
    \bbl@exp{\\\scantokens{\def\\\localename{\languagename}\\\noexpand}\relax}%
  \fi
  \bbl@provide@locale
  \bbl@iflanguage\languagename{%
    \let\bbl@select@type\z@
    \expandafter\bbl@switch\expandafter{\languagename}}}
\def\babel@aux#1#2{%
  \select@language{#1}%
  \bbl@foreach\BabelContentsFiles{% \relax -> don't assume vertical mode
    \@writefile{##1}{\babel@toc{#1}{#2}\relax}}}%
\def\babel@toc#1#2{%
  \select@language{#1}}
\newif\ifbbl@usedategroup
\let\bbl@savedextras\@empty
\def\bbl@switch#1{%  from select@, foreign@
  % make sure there is info for the language if so requested
  \bbl@ensureinfo{#1}%
  % restore
  \originalTeX
  \expandafter\def\expandafter\originalTeX\expandafter{%
    \csname noextras#1\endcsname
    \let\originalTeX\@empty
    \babel@beginsave}%
  \bbl@usehooks{afterreset}{}%
  \languageshorthands{none}%
  % set the locale id
  \bbl@id@assign
  % switch captions, date
  \bbl@bsphack
    \ifcase\bbl@select@type
      \csname captions#1\endcsname\relax
      \csname date#1\endcsname\relax
    \else
      \bbl@xin@{,captions,}{,\bbl@select@opts,}%
      \ifin@
        \csname captions#1\endcsname\relax
      \fi
      \bbl@xin@{,date,}{,\bbl@select@opts,}%
      \ifin@  % if \foreign... within \<language>date
        \csname date#1\endcsname\relax
      \fi
    \fi
  \bbl@esphack
  % switch extras
  \csname bbl@preextras@#1\endcsname
  \bbl@usehooks{beforeextras}{}%
  \csname extras#1\endcsname\relax
  \bbl@usehooks{afterextras}{}%
  %  > babel-ensure
  %  > babel-sh-<short>
  %  > babel-bidi
  %  > babel-fontspec
  \let\bbl@savedextras\@empty
  % hyphenation - case mapping
  \ifcase\bbl@opt@hyphenmap\or
    \def\BabelLower##1##2{\lccode##1=##2\relax}%
    \ifnum\bbl@hymapsel>4\else
      \csname\languagename @bbl@hyphenmap\endcsname
    \fi
    \chardef\bbl@opt@hyphenmap\z@
  \else
    \ifnum\bbl@hymapsel>\bbl@opt@hyphenmap\else
      \csname\languagename @bbl@hyphenmap\endcsname
    \fi
  \fi
  \let\bbl@hymapsel\@cclv
  % hyphenation - select rules
  \ifnum\csname l@\languagename\endcsname=\l@unhyphenated
    \edef\bbl@tempa{u}%
  \else
    \edef\bbl@tempa{\bbl@cl{lnbrk}}%
  \fi
  % linebreaking - handle u, e, k (v in the future)
  \bbl@xin@{/u}{/\bbl@tempa}%
  \ifin@\else\bbl@xin@{/e}{/\bbl@tempa}\fi % elongated forms
  \ifin@\else\bbl@xin@{/k}{/\bbl@tempa}\fi % only kashida
  \ifin@\else\bbl@xin@{/p}{/\bbl@tempa}\fi % padding (e.g., Tibetan)
  \ifin@\else\bbl@xin@{/v}{/\bbl@tempa}\fi % variable font
  % hyphenation - save mins
  \babel@savevariable\lefthyphenmin
  \babel@savevariable\righthyphenmin
  \ifnum\bbl@engine=\@ne
    \babel@savevariable\hyphenationmin
  \fi
  \ifin@
    % unhyphenated/kashida/elongated/padding = allow stretching
    \language\l@unhyphenated
    \babel@savevariable\emergencystretch
    \emergencystretch\maxdimen
    \babel@savevariable\hbadness
    \hbadness\@M
  \else
    % other = select patterns
    \bbl@patterns{#1}%
  \fi
  % hyphenation - set mins
  \expandafter\ifx\csname #1hyphenmins\endcsname\relax
    \set@hyphenmins\tw@\thr@@\relax
    \@nameuse{bbl@hyphenmins@}%
  \else
    \expandafter\expandafter\expandafter\set@hyphenmins
      \csname #1hyphenmins\endcsname\relax
  \fi
  \@nameuse{bbl@hyphenmins@}%
  \@nameuse{bbl@hyphenmins@\languagename}%
  \@nameuse{bbl@hyphenatmin@}%
  \@nameuse{bbl@hyphenatmin@\languagename}%
  \let\bbl@selectorname\@empty}
\long\def\otherlanguage#1{%
  \def\bbl@selectorname{other}%
  \ifnum\bbl@hymapsel=\@cclv\let\bbl@hymapsel\thr@@\fi
  \csname selectlanguage \endcsname{#1}%
  \ignorespaces}
\long\def\endotherlanguage{\@ignoretrue\ignorespaces}
\expandafter\def\csname otherlanguage*\endcsname{%
  \@ifnextchar[\bbl@otherlanguage@s{\bbl@otherlanguage@s[]}}
\def\bbl@otherlanguage@s[#1]#2{%
  \def\bbl@selectorname{other*}%
  \ifnum\bbl@hymapsel=\@cclv\chardef\bbl@hymapsel4\relax\fi
  \def\bbl@select@opts{#1}%
  \foreign@language{#2}}
\expandafter\let\csname endotherlanguage*\endcsname\relax
\providecommand\bbl@beforeforeign{}
\edef\foreignlanguage{%
  \noexpand\protect
  \expandafter\noexpand\csname foreignlanguage \endcsname}
\expandafter\def\csname foreignlanguage \endcsname{%
  \@ifstar\bbl@foreign@s\bbl@foreign@x}
\providecommand\bbl@foreign@x[3][]{%
  \begingroup
    \def\bbl@selectorname{foreign}%
    \def\bbl@select@opts{#1}%
    \let\BabelText\@firstofone
    \bbl@beforeforeign
    \foreign@language{#2}%
    \bbl@usehooks{foreign}{}%
    \BabelText{#3}% Now in horizontal mode!
  \endgroup}
\def\bbl@foreign@s#1#2{% TODO - \shapemode, \@setpar, ?\@@par
  \begingroup
    {\par}%
    \def\bbl@selectorname{foreign*}%
    \let\bbl@select@opts\@empty
    \let\BabelText\@firstofone
    \foreign@language{#1}%
    \bbl@usehooks{foreign*}{}%
    \bbl@dirparastext
    \BabelText{#2}% Still in vertical mode!
    {\par}%
  \endgroup}
\providecommand\BabelWrapText[1]{%
   \def\bbl@tempa{\def\BabelText####1}%
   \expandafter\bbl@tempa\expandafter{\BabelText{#1}}}
\def\foreign@language#1{%
  % set name
  \edef\languagename{#1}%
  \ifbbl@usedategroup
    \bbl@add\bbl@select@opts{,date,}%
    \bbl@usedategroupfalse
  \fi
  \bbl@fixname\languagename
  \let\localename\languagename
  % TODO. name@map here?
  \bbl@provide@locale
  \bbl@iflanguage\languagename{%
    \let\bbl@select@type\@ne
    \expandafter\bbl@switch\expandafter{\languagename}}}
\def\IfBabelSelectorTF#1{%
  \bbl@xin@{,\bbl@selectorname,}{,\zap@space#1 \@empty,}%
  \ifin@
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}
\let\bbl@hyphlist\@empty
\let\bbl@hyphenation@\relax
\let\bbl@pttnlist\@empty
\let\bbl@patterns@\relax
\let\bbl@hymapsel=\@cclv
\def\bbl@patterns#1{%
  \language=\expandafter\ifx\csname l@#1:\f@encoding\endcsname\relax
      \csname l@#1\endcsname
      \edef\bbl@tempa{#1}%
    \else
      \csname l@#1:\f@encoding\endcsname
      \edef\bbl@tempa{#1:\f@encoding}%
    \fi
  \@expandtwoargs\bbl@usehooks{patterns}{{#1}{\bbl@tempa}}%
  %  > luatex
  \@ifundefined{bbl@hyphenation@}{}{% Can be \relax!
    \begingroup
      \bbl@xin@{,\number\language,}{,\bbl@hyphlist}%
      \ifin@\else
        \@expandtwoargs\bbl@usehooks{hyphenation}{{#1}{\bbl@tempa}}%
        \hyphenation{%
          \bbl@hyphenation@
          \@ifundefined{bbl@hyphenation@#1}%
            \@empty
            {\space\csname bbl@hyphenation@#1\endcsname}}%
        \xdef\bbl@hyphlist{\bbl@hyphlist\number\language,}%
      \fi
    \endgroup}}
\def\hyphenrules#1{%
  \edef\bbl@tempf{#1}%
  \bbl@fixname\bbl@tempf
  \bbl@iflanguage\bbl@tempf{%
    \expandafter\bbl@patterns\expandafter{\bbl@tempf}%
    \ifx\languageshorthands\@undefined\else
      \languageshorthands{none}%
    \fi
    \expandafter\ifx\csname\bbl@tempf hyphenmins\endcsname\relax
      \set@hyphenmins\tw@\thr@@\relax
    \else
      \expandafter\expandafter\expandafter\set@hyphenmins
      \csname\bbl@tempf hyphenmins\endcsname\relax
    \fi}}
\let\endhyphenrules\@empty
\def\providehyphenmins#1#2{%
  \expandafter\ifx\csname #1hyphenmins\endcsname\relax
    \@namedef{#1hyphenmins}{#2}%
  \fi}
\def\set@hyphenmins#1#2{%
  \lefthyphenmin#1\relax
  \righthyphenmin#2\relax}
\ifx\ProvidesFile\@undefined
  \def\ProvidesLanguage#1[#2 #3 #4]{%
    \wlog{Language: #1 #4 #3 <#2>}%
    }
\else
  \def\ProvidesLanguage#1{%
    \begingroup
      \catcode`\ 10 %
      \@makeother\/%
      \@ifnextchar[%]
        {\@provideslanguage{#1}}{\@provideslanguage{#1}[]}}
  \def\@provideslanguage#1[#2]{%
    \wlog{Language: #1 #2}%
    \expandafter\xdef\csname ver@#1.ldf\endcsname{#2}%
    \endgroup}
\fi
\ifx\originalTeX\@undefined\let\originalTeX\@empty\fi
\ifx\babel@beginsave\@undefined\let\babel@beginsave\relax\fi
\providecommand\setlocale{\bbl@error{not-yet-available}{}{}{}}
\let\uselocale\setlocale
\let\locale\setlocale
\let\selectlocale\setlocale
\let\textlocale\setlocale
\let\textlanguage\setlocale
\let\languagetext\setlocale
\edef\bbl@nulllanguage{\string\language=0}
\def\bbl@nocaption{\protect\bbl@nocaption@i}
\def\bbl@nocaption@i#1#2{% 1: text to be printed 2: caption macro \langXname
  \global\@namedef{#2}{\textbf{?#1?}}%
  \@nameuse{#2}%
  \edef\bbl@tempa{#1}%
  \bbl@sreplace\bbl@tempa{name}{}%
  \bbl@warning{%
    \@backslashchar#1 not set for '\languagename'. Please,\\%
    define it after the language has been loaded\\%
    (typically in the preamble) with:\\%
    \string\setlocalecaption{\languagename}{\bbl@tempa}{..}\\%
    Feel free to contribute on github.com/latex3/babel.\\%
    Reported}}
\def\bbl@tentative{\protect\bbl@tentative@i}
\def\bbl@tentative@i#1{%
  \bbl@warning{%
    Some functions for '#1' are tentative.\\%
    They might not work as expected and their behavior\\%
    could change in the future.\\%
    Reported}}
\def\@nolanerr#1{\bbl@error{undefined-language}{#1}{}{}}
\def\@nopatterns#1{%
  \bbl@warning
    {No hyphenation patterns were preloaded for\\%
     the language '#1' into the format.\\%
     Please, configure your TeX system to add them and\\%
     rebuild the format. Now I will use the patterns\\%
     preloaded for \bbl@nulllanguage\space instead}}
\let\bbl@usehooks\@gobbletwo
\ifx\bbl@onlyswitch\@empty\endinput\fi
\bbl@trace{Defining babelensure}
\newcommand\babelensure[2][]{%
  \AddBabelHook{babel-ensure}{afterextras}{%
    \ifcase\bbl@select@type
      \bbl@cl{e}%
    \fi}%
  \begingroup
    \let\bbl@ens@include\@empty
    \let\bbl@ens@exclude\@empty
    \def\bbl@ens@fontenc{\relax}%
    \def\bbl@tempb##1{%
      \ifx\@empty##1\else\noexpand##1\expandafter\bbl@tempb\fi}%
    \edef\bbl@tempa{\bbl@tempb#1\@empty}%
    \def\bbl@tempb##1=##2\@@{\@namedef{bbl@ens@##1}{##2}}%
    \bbl@foreach\bbl@tempa{\bbl@tempb##1\@@}%
    \def\bbl@tempc{\bbl@ensure}%
    \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{%
      \expandafter{\bbl@ens@include}}%
    \expandafter\bbl@add\expandafter\bbl@tempc\expandafter{%
      \expandafter{\bbl@ens@exclude}}%
    \toks@\expandafter{\bbl@tempc}%
    \bbl@exp{%
  \endgroup
  \def\<bbl@e@#2>{\the\toks@{\bbl@ens@fontenc}}}}
\def\bbl@ensure#1#2#3{% 1: include 2: exclude 3: fontenc
  \def\bbl@tempb##1{% elt for (excluding) \bbl@captionslist list
    \ifx##1\@undefined % 3.32 - Don't assume the macro exists
      \edef##1{\noexpand\bbl@nocaption
        {\bbl@stripslash##1}{\languagename\bbl@stripslash##1}}%
    \fi
    \ifx##1\@empty\else
      \in@{##1}{#2}%
      \ifin@\else
        \bbl@ifunset{bbl@ensure@\languagename}%
          {\bbl@exp{%
            \\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{%
              \\\foreignlanguage{\languagename}%
              {\ifx\relax#3\else
                \\\fontencoding{#3}\\\selectfont
               \fi
               ########1}}}}%
          {}%
        \toks@\expandafter{##1}%
        \edef##1{%
           \bbl@csarg\noexpand{ensure@\languagename}%
           {\the\toks@}}%
      \fi
      \expandafter\bbl@tempb
    \fi}%
  \expandafter\bbl@tempb\bbl@captionslist\today\@empty
  \def\bbl@tempa##1{% elt for include list
    \ifx##1\@empty\else
      \bbl@csarg\in@{ensure@\languagename\expandafter}\expandafter{##1}%
      \ifin@\else
        \bbl@tempb##1\@empty
      \fi
      \expandafter\bbl@tempa
    \fi}%
  \bbl@tempa#1\@empty}
\def\bbl@captionslist{%
  \prefacename\refname\abstractname\bibname\chaptername\appendixname
  \contentsname\listfigurename\listtablename\indexname\figurename
  \tablename\partname\enclname\ccname\headtoname\pagename\seename
  \alsoname\proofname\glossaryname}
\bbl@trace{Short tags}
\newcommand\babeltags[1]{%
  \edef\bbl@tempa{\zap@space#1 \@empty}%
  \def\bbl@tempb##1=##2\@@{%
    \edef\bbl@tempc{%
      \noexpand\newcommand
      \expandafter\noexpand\csname ##1\endcsname{%
        \noexpand\protect
        \expandafter\noexpand\csname otherlanguage*\endcsname{##2}}
      \noexpand\newcommand
      \expandafter\noexpand\csname text##1\endcsname{%
        \noexpand\foreignlanguage{##2}}}
    \bbl@tempc}%
  \bbl@for\bbl@tempa\bbl@tempa{%
    \expandafter\bbl@tempb\bbl@tempa\@@}}
\bbl@trace{Compatibility with language.def}
\ifx\directlua\@undefined\else
  \ifx\bbl@luapatterns\@undefined
    \input luababel.def
  \fi
\fi
\ifx\bbl@languages\@undefined
  \ifx\directlua\@undefined
    \openin1 = language.def % TODO. Remove hardcoded number
    \ifeof1
      \closein1
      \message{I couldn't find the file language.def}
    \else
      \closein1
      \begingroup
        \def\addlanguage#1#2#3#4#5{%
          \expandafter\ifx\csname lang@#1\endcsname\relax\else
            \global\expandafter\let\csname l@#1\expandafter\endcsname
              \csname lang@#1\endcsname
          \fi}%
        \def\uselanguage#1{}%
        \input language.def
      \endgroup
    \fi
  \fi
  \chardef\l@english\z@
\fi
\def\addto#1#2{%
  \ifx#1\@undefined
    \def#1{#2}%
  \else
    \ifx#1\relax
      \def#1{#2}%
    \else
      {\toks@\expandafter{#1#2}%
       \xdef#1{\the\toks@}}%
    \fi
  \fi}
\bbl@trace{Hooks}
\newcommand\AddBabelHook[3][]{%
  \bbl@ifunset{bbl@hk@#2}{\EnableBabelHook{#2}}{}%
  \def\bbl@tempa##1,#3=##2,##3\@empty{\def\bbl@tempb{##2}}%
  \expandafter\bbl@tempa\bbl@evargs,#3=,\@empty
  \bbl@ifunset{bbl@ev@#2@#3@#1}%
    {\bbl@csarg\bbl@add{ev@#3@#1}{\bbl@elth{#2}}}%
    {\bbl@csarg\let{ev@#2@#3@#1}\relax}%
  \bbl@csarg\newcommand{ev@#2@#3@#1}[\bbl@tempb]}
\newcommand\EnableBabelHook[1]{\bbl@csarg\let{hk@#1}\@firstofone}
\newcommand\DisableBabelHook[1]{\bbl@csarg\let{hk@#1}\@gobble}
\def\bbl@usehooks{\bbl@usehooks@lang\languagename}
\def\bbl@usehooks@lang#1#2#3{% Test for Plain
  \ifx\UseHook\@undefined\else\UseHook{babel/*/#2}\fi
  \def\bbl@elth##1{%
    \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#2@}#3}}%
  \bbl@cs{ev@#2@}%
  \ifx\languagename\@undefined\else % Test required for Plain (?)
    \ifx\UseHook\@undefined\else\UseHook{babel/#1/#2}\fi
    \def\bbl@elth##1{%
      \bbl@cs{hk@##1}{\bbl@cs{ev@##1@#2@#1}#3}}%
    \bbl@cs{ev@#2@#1}%
  \fi}
\def\bbl@evargs{,% <- don't delete this comma
  everylanguage=1,loadkernel=1,loadpatterns=1,loadexceptions=1,%
  adddialect=2,patterns=2,defaultcommands=0,encodedcommands=2,write=0,%
  beforeextras=0,afterextras=0,stopcommands=0,stringprocess=0,%
  hyphenation=2,initiateactive=3,afterreset=0,foreign=0,foreign*=0,%
  beforestart=0,languagename=2,begindocument=1}
\ifx\NewHook\@undefined\else % Test for Plain (?)
  \def\bbl@tempa#1=#2\@@{\NewHook{babel/#1}}
  \bbl@foreach\bbl@evargs{\bbl@tempa#1\@@}
\fi
\providecommand\PassOptionsToLocale[2]{%
  \bbl@csarg\bbl@add@list{passto@#2}{#1}}
\bbl@trace{Macros for setting language files up}
\def\bbl@ldfinit{%
  \let\bbl@screset\@empty
  \let\BabelStrings\bbl@opt@string
  \let\BabelOptions\@empty
  \let\BabelLanguages\relax
  \ifx\originalTeX\@undefined
    \let\originalTeX\@empty
  \else
    \originalTeX
  \fi}
\def\LdfInit#1#2{%
  \chardef\atcatcode=\catcode`\@
  \catcode`\@=11\relax
  \chardef\eqcatcode=\catcode`\=
  \catcode`\==12\relax
  \expandafter\if\expandafter\@backslashchar
                 \expandafter\@car\string#2\@nil
    \ifx#2\@undefined\else
      \ldf@quit{#1}%
    \fi
  \else
    \expandafter\ifx\csname#2\endcsname\relax\else
      \ldf@quit{#1}%
    \fi
  \fi
  \bbl@ldfinit}
\def\ldf@quit#1{%
  \expandafter\main@language\expandafter{#1}%
  \catcode`\@=\atcatcode \let\atcatcode\relax
  \catcode`\==\eqcatcode \let\eqcatcode\relax
  \endinput}
\def\bbl@afterldf#1{%
  \bbl@afterlang
  \let\bbl@afterlang\relax
  \let\BabelModifiers\relax
  \let\bbl@screset\relax}%
\def\ldf@finish#1{%
  \loadlocalcfg{#1}%
  \bbl@afterldf{#1}%
  \expandafter\main@language\expandafter{#1}%
  \catcode`\@=\atcatcode \let\atcatcode\relax
  \catcode`\==\eqcatcode \let\eqcatcode\relax}
\@onlypreamble\LdfInit
\@onlypreamble\ldf@quit
\@onlypreamble\ldf@finish
\def\main@language#1{%
  \def\bbl@main@language{#1}%
  \let\languagename\bbl@main@language
  \let\localename\bbl@main@language
  \let\mainlocalename\bbl@main@language
  \bbl@id@assign
  \bbl@patterns{\languagename}}
\def\bbl@beforestart{%
  \def\@nolanerr##1{%
    \bbl@carg\chardef{l@##1}\z@
    \bbl@warning{Undefined language '##1' in aux.\\Reported}}%
  \bbl@usehooks{beforestart}{}%
  \global\let\bbl@beforestart\relax}
\AtBeginDocument{%
  {\@nameuse{bbl@beforestart}}%  Group!
  \if@filesw
    \providecommand\babel@aux[2]{}%
    \immediate\write\@mainaux{\unexpanded{%
      \providecommand\babel@aux[2]{\global\let\babel@toc\@gobbletwo}}}%
    \immediate\write\@mainaux{\string\@nameuse{bbl@beforestart}}%
  \fi
  \expandafter\selectlanguage\expandafter{\bbl@main@language}%
  \ifbbl@single  % must go after the line above.
    \renewcommand\selectlanguage[1]{}%
    \renewcommand\foreignlanguage[2]{#2}%
    \global\let\babel@aux\@gobbletwo  % Also as flag
  \fi}
\ifcase\bbl@engine\or
  \AtBeginDocument{\pagedir\bodydir}
\fi
\def\select@language@x#1{%
  \ifcase\bbl@select@type
    \bbl@ifsamestring\languagename{#1}{}{\select@language{#1}}%
  \else
    \select@language{#1}%
  \fi}
\bbl@trace{Shorhands}
\def\bbl@withactive#1#2{%
  \begingroup
    \lccode`~=`#2\relax
    \lowercase{\endgroup#1~}}
\def\bbl@add@special#1{% 1:a macro like \", \?, etc.
  \bbl@add\dospecials{\do#1}% test @sanitize = \relax, for back. compat.
  \bbl@ifunset{@sanitize}{}{\bbl@add\@sanitize{\@makeother#1}}%
  \ifx\nfss@catcodes\@undefined\else % TODO - same for above
    \begingroup
      \catcode`#1\active
      \nfss@catcodes
      \ifnum\catcode`#1=\active
        \endgroup
        \bbl@add\nfss@catcodes{\@makeother#1}%
      \else
        \endgroup
      \fi
  \fi}
\def\bbl@active@def#1#2#3#4{%
  \@namedef{#3#1}{%
    \expandafter\ifx\csname#2@sh@#1@\endcsname\relax
      \bbl@afterelse\bbl@sh@select#2#1{#3@arg#1}{#4#1}%
    \else
      \bbl@afterfi\csname#2@sh@#1@\endcsname
    \fi}%
  \long\@namedef{#3@arg#1}##1{%
    \expandafter\ifx\csname#2@sh@#1@\string##1@\endcsname\relax
      \bbl@afterelse\csname#4#1\endcsname##1%
    \else
      \bbl@afterfi\csname#2@sh@#1@\string##1@\endcsname
    \fi}}%
\def\initiate@active@char#1{%
  \bbl@ifunset{active@char\string#1}%
    {\bbl@withactive
      {\expandafter\@initiate@active@char\expandafter}#1\string#1#1}%
    {}}
\def\@initiate@active@char#1#2#3{%
  \bbl@csarg\edef{oricat@#2}{\catcode`#2=\the\catcode`#2\relax}%
  \ifx#1\@undefined
    \bbl@csarg\def{oridef@#2}{\def#1{\active@prefix#1\@undefined}}%
  \else
    \bbl@csarg\let{oridef@@#2}#1%
    \bbl@csarg\edef{oridef@#2}{%
      \let\noexpand#1%
      \expandafter\noexpand\csname bbl@oridef@@#2\endcsname}%
  \fi
  \ifx#1#3\relax
    \expandafter\let\csname normal@char#2\endcsname#3%
  \else
    \bbl@info{Making #2 an active character}%
    \ifnum\mathcode`#2=\ifodd\bbl@engine"1000000 \else"8000 \fi
      \@namedef{normal@char#2}{%
        \textormath{#3}{\csname bbl@oridef@@#2\endcsname}}%
    \else
      \@namedef{normal@char#2}{#3}%
    \fi
    \bbl@restoreactive{#2}%
    \AtBeginDocument{%
      \catcode`#2\active
      \if@filesw
        \immediate\write\@mainaux{\catcode`\string#2\active}%
      \fi}%
    \expandafter\bbl@add@special\csname#2\endcsname
    \catcode`#2\active
  \fi
  \let\bbl@tempa\@firstoftwo
  \if\string^#2%
    \def\bbl@tempa{\noexpand\textormath}%
  \else
    \ifx\bbl@mathnormal\@undefined\else
      \let\bbl@tempa\bbl@mathnormal
    \fi
  \fi
  \expandafter\edef\csname active@char#2\endcsname{%
    \bbl@tempa
      {\noexpand\if@safe@actives
         \noexpand\expandafter
         \expandafter\noexpand\csname normal@char#2\endcsname
       \noexpand\else
         \noexpand\expandafter
         \expandafter\noexpand\csname bbl@doactive#2\endcsname
       \noexpand\fi}%
     {\expandafter\noexpand\csname normal@char#2\endcsname}}%
  \bbl@csarg\edef{doactive#2}{%
    \expandafter\noexpand\csname user@active#2\endcsname}%
  \bbl@csarg\edef{active@#2}{%
    \noexpand\active@prefix\noexpand#1%
    \expandafter\noexpand\csname active@char#2\endcsname}%
  \bbl@csarg\edef{normal@#2}{%
    \noexpand\active@prefix\noexpand#1%
    \expandafter\noexpand\csname normal@char#2\endcsname}%
  \bbl@ncarg\let#1{bbl@normal@#2}%
  \bbl@active@def#2\user@group{user@active}{language@active}%
  \bbl@active@def#2\language@group{language@active}{system@active}%
  \bbl@active@def#2\system@group{system@active}{normal@char}%
  \expandafter\edef\csname\user@group @sh@#2@@\endcsname
    {\expandafter\noexpand\csname normal@char#2\endcsname}%
  \expandafter\edef\csname\user@group @sh@#2@\string\protect@\endcsname
    {\expandafter\noexpand\csname user@active#2\endcsname}%
  \if\string'#2%
    \let\prim@s\bbl@prim@s
    \let\active@math@prime#1%
  \fi
  \bbl@usehooks{initiateactive}{{#1}{#2}{#3}}}
\@ifpackagewith{babel}{KeepShorthandsActive}%
  {\let\bbl@restoreactive\@gobble}%
  {\def\bbl@restoreactive#1{%
     \bbl@exp{%
       \\\AfterBabelLanguage\\\CurrentOption
         {\catcode`#1=\the\catcode`#1\relax}%
       \\\AtEndOfPackage
         {\catcode`#1=\the\catcode`#1\relax}}}%
   \AtEndOfPackage{\let\bbl@restoreactive\@gobble}}
\def\bbl@sh@select#1#2{%
  \expandafter\ifx\csname#1@sh@#2@sel\endcsname\relax
    \bbl@afterelse\bbl@scndcs
  \else
    \bbl@afterfi\csname#1@sh@#2@sel\endcsname
  \fi}
\begingroup
\bbl@ifunset{ifincsname}%
  {\gdef\active@prefix#1{%
     \ifx\protect\@typeset@protect
     \else
       \ifx\protect\@unexpandable@protect
         \noexpand#1%
       \else
         \protect#1%
       \fi
       \expandafter\@gobble
     \fi}}
  {\gdef\active@prefix#1{%
     \ifincsname
       \string#1%
       \expandafter\@gobble
     \else
       \ifx\protect\@typeset@protect
       \else
         \ifx\protect\@unexpandable@protect
           \noexpand#1%
         \else
           \protect#1%
         \fi
         \expandafter\expandafter\expandafter\@gobble
       \fi
     \fi}}
\endgroup
\newif\if@safe@actives
\@safe@activesfalse
\def\bbl@restore@actives{\if@safe@actives\@safe@activesfalse\fi}
\chardef\bbl@activated\z@
\def\bbl@activate#1{%
  \chardef\bbl@activated\@ne
  \bbl@withactive{\expandafter\let\expandafter}#1%
    \csname bbl@active@\string#1\endcsname}
\def\bbl@deactivate#1{%
  \chardef\bbl@activated\tw@
  \bbl@withactive{\expandafter\let\expandafter}#1%
    \csname bbl@normal@\string#1\endcsname}
\def\bbl@firstcs#1#2{\csname#1\endcsname}
\def\bbl@scndcs#1#2{\csname#2\endcsname}
\def\babel@texpdf#1#2#3#4{%
  \ifx\texorpdfstring\@undefined
    \textormath{#1}{#3}%
  \else
    \texorpdfstring{\textormath{#1}{#3}}{#2}%
    % \texorpdfstring{\textormath{#1}{#3}}{\textormath{#2}{#4}}%
  \fi}
\def\declare@shorthand#1#2{\@decl@short{#1}#2\@nil}
\def\@decl@short#1#2#3\@nil#4{%
  \def\bbl@tempa{#3}%
  \ifx\bbl@tempa\@empty
    \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@scndcs
    \bbl@ifunset{#1@sh@\string#2@}{}%
      {\def\bbl@tempa{#4}%
       \expandafter\ifx\csname#1@sh@\string#2@\endcsname\bbl@tempa
       \else
         \bbl@info
           {Redefining #1 shorthand \string#2\\%
            in language \CurrentOption}%
       \fi}%
    \@namedef{#1@sh@\string#2@}{#4}%
  \else
    \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@firstcs
    \bbl@ifunset{#1@sh@\string#2@\string#3@}{}%
      {\def\bbl@tempa{#4}%
       \expandafter\ifx\csname#1@sh@\string#2@\string#3@\endcsname\bbl@tempa
       \else
         \bbl@info
           {Redefining #1 shorthand \string#2\string#3\\%
            in language \CurrentOption}%
       \fi}%
    \@namedef{#1@sh@\string#2@\string#3@}{#4}%
  \fi}
\def\textormath{%
  \ifmmode
    \expandafter\@secondoftwo
  \else
    \expandafter\@firstoftwo
  \fi}
\def\user@group{user}
\def\language@group{english}
\def\system@group{system}
\def\useshorthands{%
  \@ifstar\bbl@usesh@s{\bbl@usesh@x{}}}
\def\bbl@usesh@s#1{%
  \bbl@usesh@x
    {\AddBabelHook{babel-sh-\string#1}{afterextras}{\bbl@activate{#1}}}%
    {#1}}
\def\bbl@usesh@x#1#2{%
  \bbl@ifshorthand{#2}%
    {\def\user@group{user}%
     \initiate@active@char{#2}%
     #1%
     \bbl@activate{#2}}%
    {\bbl@error{shorthand-is-off}{}{#2}{}}}
\def\user@language@group{user@\language@group}
\def\bbl@set@user@generic#1#2{%
  \bbl@ifunset{user@generic@active#1}%
    {\bbl@active@def#1\user@language@group{user@active}{user@generic@active}%
     \bbl@active@def#1\user@group{user@generic@active}{language@active}%
     \expandafter\edef\csname#2@sh@#1@@\endcsname{%
       \expandafter\noexpand\csname normal@char#1\endcsname}%
     \expandafter\edef\csname#2@sh@#1@\string\protect@\endcsname{%
       \expandafter\noexpand\csname user@active#1\endcsname}}%
  \@empty}
\newcommand\defineshorthand[3][user]{%
  \edef\bbl@tempa{\zap@space#1 \@empty}%
  \bbl@for\bbl@tempb\bbl@tempa{%
    \if*\expandafter\@car\bbl@tempb\@nil
      \edef\bbl@tempb{user@\expandafter\@gobble\bbl@tempb}%
      \@expandtwoargs
        \bbl@set@user@generic{\expandafter\string\@car#2\@nil}\bbl@tempb
    \fi
    \declare@shorthand{\bbl@tempb}{#2}{#3}}}
\def\languageshorthands#1{\def\language@group{#1}}
\def\aliasshorthand#1#2{%
  \bbl@ifshorthand{#2}%
    {\expandafter\ifx\csname active@char\string#2\endcsname\relax
       \ifx\document\@notprerr
         \@notshorthand{#2}%
       \else
         \initiate@active@char{#2}%
         \bbl@ccarg\let{active@char\string#2}{active@char\string#1}%
         \bbl@ccarg\let{normal@char\string#2}{normal@char\string#1}%
         \bbl@activate{#2}%
       \fi
     \fi}%
    {\bbl@error{shorthand-is-off}{}{#2}{}}}
\def\@notshorthand#1{\bbl@error{not-a-shorthand}{#1}{}{}}
\newcommand*\shorthandon[1]{\bbl@switch@sh\@ne#1\@nnil}
\DeclareRobustCommand*\shorthandoff{%
  \@ifstar{\bbl@shorthandoff\tw@}{\bbl@shorthandoff\z@}}
\def\bbl@shorthandoff#1#2{\bbl@switch@sh#1#2\@nnil}
\def\bbl@switch@sh#1#2{%
  \ifx#2\@nnil\else
    \bbl@ifunset{bbl@active@\string#2}%
      {\bbl@error{not-a-shorthand-b}{}{#2}{}}%
      {\ifcase#1%   off, on, off*
         \catcode`#212\relax
       \or
         \catcode`#2\active
         \bbl@ifunset{bbl@shdef@\string#2}%
           {}%
           {\bbl@withactive{\expandafter\let\expandafter}#2%
              \csname bbl@shdef@\string#2\endcsname
            \bbl@csarg\let{shdef@\string#2}\relax}%
         \ifcase\bbl@activated\or
           \bbl@activate{#2}%
         \else
           \bbl@deactivate{#2}%
         \fi
       \or
         \bbl@ifunset{bbl@shdef@\string#2}%
           {\bbl@withactive{\bbl@csarg\let{shdef@\string#2}}#2}%
           {}%
         \csname bbl@oricat@\string#2\endcsname
         \csname bbl@oridef@\string#2\endcsname
       \fi}%
    \bbl@afterfi\bbl@switch@sh#1%
  \fi}
\def\babelshorthand{\active@prefix\babelshorthand\bbl@putsh}
\def\bbl@putsh#1{%
  \bbl@ifunset{bbl@active@\string#1}%
     {\bbl@putsh@i#1\@empty\@nnil}%
     {\csname bbl@active@\string#1\endcsname}}
\def\bbl@putsh@i#1#2\@nnil{%
  \csname\language@group @sh@\string#1@%
    \ifx\@empty#2\else\string#2@\fi\endcsname}
\ifx\bbl@opt@shorthands\@nnil\else
  \let\bbl@s@initiate@active@char\initiate@active@char
  \def\initiate@active@char#1{%
    \bbl@ifshorthand{#1}{\bbl@s@initiate@active@char{#1}}{}}
  \let\bbl@s@switch@sh\bbl@switch@sh
  \def\bbl@switch@sh#1#2{%
    \ifx#2\@nnil\else
      \bbl@afterfi
      \bbl@ifshorthand{#2}{\bbl@s@switch@sh#1{#2}}{\bbl@switch@sh#1}%
    \fi}
  \let\bbl@s@activate\bbl@activate
  \def\bbl@activate#1{%
    \bbl@ifshorthand{#1}{\bbl@s@activate{#1}}{}}
  \let\bbl@s@deactivate\bbl@deactivate
  \def\bbl@deactivate#1{%
    \bbl@ifshorthand{#1}{\bbl@s@deactivate{#1}}{}}
\fi
\newcommand\ifbabelshorthand[3]{\bbl@ifunset{bbl@active@\string#1}{#3}{#2}}
\def\bbl@prim@s{%
  \prime\futurelet\@let@token\bbl@pr@m@s}
\def\bbl@if@primes#1#2{%
  \ifx#1\@let@token
    \expandafter\@firstoftwo
  \else\ifx#2\@let@token
    \bbl@afterelse\expandafter\@firstoftwo
  \else
    \bbl@afterfi\expandafter\@secondoftwo
  \fi\fi}
\begingroup
  \catcode`\^=7  \catcode`\*=\active  \lccode`\*=`\^
  \catcode`\'=12 \catcode`\"=\active  \lccode`\"=`\'
  \lowercase{%
    \gdef\bbl@pr@m@s{%
      \bbl@if@primes"'%
        \pr@@@s
        {\bbl@if@primes*^\pr@@@t\egroup}}}
\endgroup
\initiate@active@char{~}
\declare@shorthand{system}{~}{\leavevmode\nobreak\ }
\bbl@activate{~}
\expandafter\def\csname OT1dqpos\endcsname{127}
\expandafter\def\csname T1dqpos\endcsname{4}
\ifx\f@encoding\@undefined
  \def\f@encoding{OT1}
\fi
\bbl@trace{Language attributes}
\newcommand\languageattribute[2]{%
  \def\bbl@tempc{#1}%
  \bbl@fixname\bbl@tempc
  \bbl@iflanguage\bbl@tempc{%
    \bbl@vforeach{#2}{%
      \ifx\bbl@known@attribs\@undefined
        \in@false
      \else
        \bbl@xin@{,\bbl@tempc-##1,}{,\bbl@known@attribs,}%
      \fi
      \ifin@
        \bbl@warning{%
          You have more than once selected the attribute '##1'\\%
          for language #1. Reported}%
      \else
        \bbl@exp{%
          \\\bbl@add@list\\\bbl@known@attribs{\bbl@tempc-##1}}%
        \edef\bbl@tempa{\bbl@tempc-##1}%
        \expandafter\bbl@ifknown@ttrib\expandafter{\bbl@tempa}\bbl@attributes%
        {\csname\bbl@tempc @attr@##1\endcsname}%
        {\@attrerr{\bbl@tempc}{##1}}%
     \fi}}}
\@onlypreamble\languageattribute
\newcommand*{\@attrerr}[2]{%
  \bbl@error{unknown-attribute}{#1}{#2}{}}
\def\bbl@declare@ttribute#1#2#3{%
  \bbl@xin@{,#2,}{,\BabelModifiers,}%
  \ifin@
    \AfterBabelLanguage{#1}{\languageattribute{#1}{#2}}%
  \fi
  \bbl@add@list\bbl@attributes{#1-#2}%
  \expandafter\def\csname#1@attr@#2\endcsname{#3}}
\def\bbl@ifattributeset#1#2#3#4{%
  \ifx\bbl@known@attribs\@undefined
    \in@false
  \else
    \bbl@xin@{,#1-#2,}{,\bbl@known@attribs,}%
  \fi
  \ifin@
    \bbl@afterelse#3%
  \else
    \bbl@afterfi#4%
  \fi}
\def\bbl@ifknown@ttrib#1#2{%
  \let\bbl@tempa\@secondoftwo
  \bbl@loopx\bbl@tempb{#2}{%
    \expandafter\in@\expandafter{\expandafter,\bbl@tempb,}{,#1,}%
    \ifin@
      \let\bbl@tempa\@firstoftwo
    \else
    \fi}%
  \bbl@tempa}
\def\bbl@clear@ttribs{%
  \ifx\bbl@attributes\@undefined\else
    \bbl@loopx\bbl@tempa{\bbl@attributes}{%
      \expandafter\bbl@clear@ttrib\bbl@tempa.}%
    \let\bbl@attributes\@undefined
  \fi}
\def\bbl@clear@ttrib#1-#2.{%
  \expandafter\let\csname#1@attr@#2\endcsname\@undefined}
\AtBeginDocument{\bbl@clear@ttribs}
\bbl@trace{Macros for saving definitions}
\def\babel@beginsave{\babel@savecnt\z@}
\newcount\babel@savecnt
\babel@beginsave
\def\babel@save#1{%
  \def\bbl@tempa{{,#1,}}% Clumsy, for Plain
  \expandafter\bbl@add\expandafter\bbl@tempa\expandafter{%
    \expandafter{\expandafter,\bbl@savedextras,}}%
  \expandafter\in@\bbl@tempa
  \ifin@\else
    \bbl@add\bbl@savedextras{,#1,}%
    \bbl@carg\let{babel@\number\babel@savecnt}#1\relax
    \toks@\expandafter{\originalTeX\let#1=}%
    \bbl@exp{%
      \def\\\originalTeX{\the\toks@\<babel@\number\babel@savecnt>\relax}}%
    \advance\babel@savecnt\@ne
  \fi}
\def\babel@savevariable#1{%
  \toks@\expandafter{\originalTeX #1=}%
  \bbl@exp{\def\\\originalTeX{\the\toks@\the#1\relax}}}
\def\bbl@redefine#1{%
  \edef\bbl@tempa{\bbl@stripslash#1}%
  \expandafter\let\csname org@\bbl@tempa\endcsname#1%
  \expandafter\def\csname\bbl@tempa\endcsname}
\@onlypreamble\bbl@redefine
\def\bbl@redefine@long#1{%
  \edef\bbl@tempa{\bbl@stripslash#1}%
  \expandafter\let\csname org@\bbl@tempa\endcsname#1%
  \long\expandafter\def\csname\bbl@tempa\endcsname}
\@onlypreamble\bbl@redefine@long
\def\bbl@redefinerobust#1{%
  \edef\bbl@tempa{\bbl@stripslash#1}%
  \bbl@ifunset{\bbl@tempa\space}%
    {\expandafter\let\csname org@\bbl@tempa\endcsname#1%
     \bbl@exp{\def\\#1{\\\protect\<\bbl@tempa\space>}}}%
    {\bbl@exp{\let\<org@\bbl@tempa>\<\bbl@tempa\space>}}%
    \@namedef{\bbl@tempa\space}}
\@onlypreamble\bbl@redefinerobust
\def\bbl@frenchspacing{%
  \ifnum\the\sfcode`\.=\@m
    \let\bbl@nonfrenchspacing\relax
  \else
    \frenchspacing
    \let\bbl@nonfrenchspacing\nonfrenchspacing
  \fi}
\let\bbl@nonfrenchspacing\nonfrenchspacing
\let\bbl@elt\relax
\edef\bbl@fs@chars{%
  \bbl@elt{\string.}\@m{3000}\bbl@elt{\string?}\@m{3000}%
  \bbl@elt{\string!}\@m{3000}\bbl@elt{\string:}\@m{2000}%
  \bbl@elt{\string;}\@m{1500}\bbl@elt{\string,}\@m{1250}}
\def\bbl@pre@fs{%
  \def\bbl@elt##1##2##3{\sfcode`##1=\the\sfcode`##1\relax}%
  \edef\bbl@save@sfcodes{\bbl@fs@chars}}%
\def\bbl@post@fs{%
  \bbl@save@sfcodes
  \edef\bbl@tempa{\bbl@cl{frspc}}%
  \edef\bbl@tempa{\expandafter\@car\bbl@tempa\@nil}%
  \if u\bbl@tempa          % do nothing
  \else\if n\bbl@tempa     % non french
    \def\bbl@elt##1##2##3{%
      \ifnum\sfcode`##1=##2\relax
        \babel@savevariable{\sfcode`##1}%
        \sfcode`##1=##3\relax
      \fi}%
    \bbl@fs@chars
  \else\if y\bbl@tempa     % french
    \def\bbl@elt##1##2##3{%
      \ifnum\sfcode`##1=##3\relax
        \babel@savevariable{\sfcode`##1}%
        \sfcode`##1=##2\relax
      \fi}%
    \bbl@fs@chars
  \fi\fi\fi}
\bbl@trace{Hyphens}
\@onlypreamble\babelhyphenation
\AtEndOfPackage{%
  \newcommand\babelhyphenation[2][\@empty]{%
    \ifx\bbl@hyphenation@\relax
      \let\bbl@hyphenation@\@empty
    \fi
    \ifx\bbl@hyphlist\@empty\else
      \bbl@warning{%
        You must not intermingle \string\selectlanguage\space and\\%
        \string\babelhyphenation\space or some exceptions will not\\%
        be taken into account. Reported}%
    \fi
    \ifx\@empty#1%
      \protected@edef\bbl@hyphenation@{\bbl@hyphenation@\space#2}%
    \else
      \bbl@vforeach{#1}{%
        \def\bbl@tempa{##1}%
        \bbl@fixname\bbl@tempa
        \bbl@iflanguage\bbl@tempa{%
          \bbl@csarg\protected@edef{hyphenation@\bbl@tempa}{%
            \bbl@ifunset{bbl@hyphenation@\bbl@tempa}%
              {}%
              {\csname bbl@hyphenation@\bbl@tempa\endcsname\space}%
            #2}}}%
    \fi}}
\ifx\NewDocumentCommand\@undefined\else
  \NewDocumentCommand\babelhyphenmins{sommo}{%
    \IfNoValueTF{#2}%
      {\protected@edef\bbl@hyphenmins@{\set@hyphenmins{#3}{#4}}%
       \IfValueT{#5}{%
         \protected@edef\bbl@hyphenatmin@{\hyphenationmin=#5\relax}}%
       \IfBooleanT{#1}{%
         \lefthyphenmin=#3\relax
         \righthyphenmin=#4\relax
         \IfValueT{#5}{\hyphenationmin=#5\relax}}}%
      {\edef\bbl@tempb{\zap@space#2 \@empty}%
       \bbl@for\bbl@tempa\bbl@tempb{%
         \@namedef{bbl@hyphenmins@\bbl@tempa}{\set@hyphenmins{#3}{#4}}%
         \IfValueT{#5}{%
           \@namedef{bbl@hyphenatmin@\bbl@tempa}{\hyphenationmin=#5\relax}}}%
       \IfBooleanT{#1}{\bbl@error{hyphenmins-args}{}{}{}}}}
\fi
\def\bbl@allowhyphens{\ifvmode\else\nobreak\hskip\z@skip\fi}
\def\bbl@t@one{T1}
\def\allowhyphens{\ifx\cf@encoding\bbl@t@one\else\bbl@allowhyphens\fi}
\newcommand\babelnullhyphen{\char\hyphenchar\font}
\def\babelhyphen{\active@prefix\babelhyphen\bbl@hyphen}
\def\bbl@hyphen{%
  \@ifstar{\bbl@hyphen@i @}{\bbl@hyphen@i\@empty}}
\def\bbl@hyphen@i#1#2{%
  \lowercase{\bbl@ifunset{bbl@hy@#1#2\@empty}}%
    {\csname bbl@#1usehyphen\endcsname{\discretionary{#2}{}{#2}}}%
    {\lowercase{\csname bbl@hy@#1#2\@empty\endcsname}}}
\def\bbl@usehyphen#1{%
  \leavevmode
  \ifdim\lastskip>\z@\mbox{#1}\else\nobreak#1\fi
  \nobreak\hskip\z@skip}
\def\bbl@@usehyphen#1{%
  \leavevmode\ifdim\lastskip>\z@\mbox{#1}\else#1\fi}
\def\bbl@hyphenchar{%
  \ifnum\hyphenchar\font=\m@ne
    \babelnullhyphen
  \else
    \char\hyphenchar\font
  \fi}
\def\bbl@hy@soft{\bbl@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}}
\def\bbl@hy@@soft{\bbl@@usehyphen{\discretionary{\bbl@hyphenchar}{}{}}}
\def\bbl@hy@hard{\bbl@usehyphen\bbl@hyphenchar}
\def\bbl@hy@@hard{\bbl@@usehyphen\bbl@hyphenchar}
\def\bbl@hy@nobreak{\bbl@usehyphen{\mbox{\bbl@hyphenchar}}}
\def\bbl@hy@@nobreak{\mbox{\bbl@hyphenchar}}
\def\bbl@hy@repeat{%
  \bbl@usehyphen{%
    \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}}
\def\bbl@hy@@repeat{%
  \bbl@@usehyphen{%
    \discretionary{\bbl@hyphenchar}{\bbl@hyphenchar}{\bbl@hyphenchar}}}
\def\bbl@hy@empty{\hskip\z@skip}
\def\bbl@hy@@empty{\discretionary{}{}{}}
\def\bbl@disc#1#2{\nobreak\discretionary{#2-}{}{#1}\bbl@allowhyphens}
\bbl@trace{Multiencoding strings}
\def\bbl@toglobal#1{\global\let#1#1}
\@onlypreamble\StartBabelCommands
\def\StartBabelCommands{%
  \begingroup
  \@tempcnta="7F
  \def\bbl@tempa{%
    \ifnum\@tempcnta>"FF\else
      \catcode\@tempcnta=11
      \advance\@tempcnta\@ne
      \expandafter\bbl@tempa
    \fi}%
  \bbl@tempa
  \def\SetStringLoop##1##2{%
    \def\bbl@templ####1{\expandafter\noexpand\csname##1\endcsname}%
    \count@\z@
    \bbl@loop\bbl@tempa{##2}{% empty items and spaces are ok
      \advance\count@\@ne
      \toks@\expandafter{\bbl@tempa}%
      \bbl@exp{%
        \\\SetString\bbl@templ{\romannumeral\count@}{\the\toks@}%
        \count@=\the\count@\relax}}}%
  \newcommand\SetCase[3][]{%
    \def\bbl@tempa####1####2{%
      \ifx####1\@empty\else
        \bbl@carg\bbl@add{extras\CurrentOption}{%
          \bbl@carg\babel@save{c__text_uppercase_\string####1_tl}%
          \bbl@carg\def{c__text_uppercase_\string####1_tl}{####2}%
          \bbl@carg\babel@save{c__text_lowercase_\string####2_tl}%
          \bbl@carg\def{c__text_lowercase_\string####2_tl}{####1}}%
        \expandafter\bbl@tempa
      \fi}%
    \bbl@tempa##1\@empty\@empty
    \bbl@carg\bbl@toglobal{extras\CurrentOption}}%
  \newcommand\SetHyphenMap[1]{%
    \bbl@forlang\bbl@tempa{%
      \expandafter\bbl@stringdef
        \csname\bbl@tempa @bbl@hyphenmap\endcsname{##1}}}%
  \def\bbl@provstring##1##2{%
    \providecommand##1{##2}%
    \bbl@toglobal##1}%
  \global\let\bbl@scafter\@empty
  \let\StartBabelCommands\bbl@startcmds
  \ifx\BabelLanguages\relax
     \let\BabelLanguages\CurrentOption
  \fi
  \begingroup
  \let\bbl@screset\@nnil % local flag - disable 1st stopcommands
  \StartBabelCommands}
\def\bbl@startcmds{%
  \ifx\bbl@screset\@nnil\else
    \bbl@usehooks{stopcommands}{}%
  \fi
  \endgroup
  \begingroup
  \@ifstar
    {\ifx\bbl@opt@strings\@nnil
       \let\bbl@opt@strings\BabelStringsDefault
     \fi
     \bbl@startcmds@i}%
    \bbl@startcmds@i}
\def\bbl@startcmds@i#1#2{%
  \edef\bbl@L{\zap@space#1 \@empty}%
  \edef\bbl@G{\zap@space#2 \@empty}%
  \bbl@startcmds@ii}
\let\bbl@startcommands\StartBabelCommands
\newcommand\bbl@startcmds@ii[1][\@empty]{%
  \let\SetString\@gobbletwo
  \let\bbl@stringdef\@gobbletwo
  \let\AfterBabelCommands\@gobble
  \ifx\@empty#1%
    \def\bbl@sc@label{generic}%
    \def\bbl@encstring##1##2{%
      \ProvideTextCommandDefault##1{##2}%
      \bbl@toglobal##1%
      \expandafter\bbl@toglobal\csname\string?\string##1\endcsname}%
    \let\bbl@sctest\in@true
  \else
    \let\bbl@sc@charset\space % <- zapped below
    \let\bbl@sc@fontenc\space % <-   "      "
    \def\bbl@tempa##1=##2\@nil{%
      \bbl@csarg\edef{sc@\zap@space##1 \@empty}{##2 }}%
    \bbl@vforeach{label=#1}{\bbl@tempa##1\@nil}%
    \def\bbl@tempa##1 ##2{% space -> comma
      ##1%
      \ifx\@empty##2\else\ifx,##1,\else,\fi\bbl@afterfi\bbl@tempa##2\fi}%
    \edef\bbl@sc@fontenc{\expandafter\bbl@tempa\bbl@sc@fontenc\@empty}%
    \edef\bbl@sc@label{\expandafter\zap@space\bbl@sc@label\@empty}%
    \edef\bbl@sc@charset{\expandafter\zap@space\bbl@sc@charset\@empty}%
    \def\bbl@encstring##1##2{%
      \bbl@foreach\bbl@sc@fontenc{%
        \bbl@ifunset{T@####1}%
          {}%
          {\ProvideTextCommand##1{####1}{##2}%
           \bbl@toglobal##1%
           \expandafter
           \bbl@toglobal\csname####1\string##1\endcsname}}}%
    \def\bbl@sctest{%
      \bbl@xin@{,\bbl@opt@strings,}{,\bbl@sc@label,\bbl@sc@fontenc,}}%
  \fi
  \ifx\bbl@opt@strings\@nnil         % i.e., no strings key -> defaults
  \else\ifx\bbl@opt@strings\relax    % i.e., strings=encoded
    \let\AfterBabelCommands\bbl@aftercmds
    \let\SetString\bbl@setstring
    \let\bbl@stringdef\bbl@encstring
  \else       % i.e., strings=value
  \bbl@sctest
  \ifin@
    \let\AfterBabelCommands\bbl@aftercmds
    \let\SetString\bbl@setstring
    \let\bbl@stringdef\bbl@provstring
  \fi\fi\fi
  \bbl@scswitch
  \ifx\bbl@G\@empty
    \def\SetString##1##2{%
      \bbl@error{missing-group}{##1}{}{}}%
  \fi
  \ifx\@empty#1%
    \bbl@usehooks{defaultcommands}{}%
  \else
    \@expandtwoargs
    \bbl@usehooks{encodedcommands}{{\bbl@sc@charset}{\bbl@sc@fontenc}}%
  \fi}
\def\bbl@forlang#1#2{%
  \bbl@for#1\bbl@L{%
    \bbl@xin@{,#1,}{,\BabelLanguages,}%
    \ifin@#2\relax\fi}}
\def\bbl@scswitch{%
  \bbl@forlang\bbl@tempa{%
    \ifx\bbl@G\@empty\else
      \ifx\SetString\@gobbletwo\else
        \edef\bbl@GL{\bbl@G\bbl@tempa}%
        \bbl@xin@{,\bbl@GL,}{,\bbl@screset,}%
        \ifin@\else
          \global\expandafter\let\csname\bbl@GL\endcsname\@undefined
          \xdef\bbl@screset{\bbl@screset,\bbl@GL}%
        \fi
      \fi
    \fi}}
\AtEndOfPackage{%
  \def\bbl@forlang#1#2{\bbl@for#1\bbl@L{\bbl@ifunset{date#1}{}{#2}}}%
  \let\bbl@scswitch\relax}
\@onlypreamble\EndBabelCommands
\def\EndBabelCommands{%
  \bbl@usehooks{stopcommands}{}%
  \endgroup
  \endgroup
  \bbl@scafter}
\let\bbl@endcommands\EndBabelCommands
\def\bbl@setstring#1#2{% e.g., \prefacename{<string>}
  \bbl@forlang\bbl@tempa{%
    \edef\bbl@LC{\bbl@tempa\bbl@stripslash#1}%
    \bbl@ifunset{\bbl@LC}% e.g., \germanchaptername
      {\bbl@exp{%
         \global\\\bbl@add\<\bbl@G\bbl@tempa>{\\\bbl@scset\\#1\<\bbl@LC>}}}%
      {}%
    \def\BabelString{#2}%
    \bbl@usehooks{stringprocess}{}%
    \expandafter\bbl@stringdef
      \csname\bbl@LC\expandafter\endcsname\expandafter{\BabelString}}}
\def\bbl@scset#1#2{\def#1{#2}}
\def\bbl@aftercmds#1{%
  \toks@\expandafter{\bbl@scafter#1}%
  \xdef\bbl@scafter{\the\toks@}}
\newcommand\BabelLower[2]{% one to one.
  \ifnum\lccode#1=#2\else
    \babel@savevariable{\lccode#1}%
    \lccode#1=#2\relax
  \fi}
\newcommand\BabelLowerMM[4]{% many-to-many
  \@tempcnta=#1\relax
  \@tempcntb=#4\relax
  \def\bbl@tempa{%
    \ifnum\@tempcnta>#2\else
      \@expandtwoargs\BabelLower{\the\@tempcnta}{\the\@tempcntb}%
      \advance\@tempcnta#3\relax
      \advance\@tempcntb#3\relax
      \expandafter\bbl@tempa
    \fi}%
  \bbl@tempa}
\newcommand\BabelLowerMO[4]{% many-to-one
  \@tempcnta=#1\relax
  \def\bbl@tempa{%
    \ifnum\@tempcnta>#2\else
      \@expandtwoargs\BabelLower{\the\@tempcnta}{#4}%
      \advance\@tempcnta#3
      \expandafter\bbl@tempa
    \fi}%
  \bbl@tempa}
\AtEndOfPackage{%
  \ifx\bbl@opt@hyphenmap\@undefined
    \bbl@xin@{,}{\bbl@language@opts}%
    \chardef\bbl@opt@hyphenmap\ifin@4\else\@ne\fi
  \fi}
\newcommand\setlocalecaption{%
  \@ifstar\bbl@setcaption@s\bbl@setcaption@x}
\def\bbl@setcaption@x#1#2#3{%  language caption-name string
  \bbl@trim@def\bbl@tempa{#2}%
  \bbl@xin@{.template}{\bbl@tempa}%
  \ifin@
    \bbl@ini@captions@template{#3}{#1}%
  \else
    \edef\bbl@tempd{%
      \expandafter\expandafter\expandafter
      \strip@prefix\expandafter\meaning\csname captions#1\endcsname}%
    \bbl@xin@
      {\expandafter\string\csname #2name\endcsname}%
      {\bbl@tempd}%
    \ifin@ % Renew caption
      \bbl@xin@{\string\bbl@scset}{\bbl@tempd}%
      \ifin@
        \bbl@exp{%
          \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
            {\\\bbl@scset\<#2name>\<#1#2name>}%
            {}}%
      \else % Old way converts to new way
        \bbl@ifunset{#1#2name}%
          {\bbl@exp{%
            \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
            \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
              {\def\<#2name>{\<#1#2name>}}%
              {}}}%
          {}%
      \fi
    \else
      \bbl@xin@{\string\bbl@scset}{\bbl@tempd}% New
      \ifin@ % New way
        \bbl@exp{%
          \\\bbl@add\<captions#1>{\\\bbl@scset\<#2name>\<#1#2name>}%
          \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
            {\\\bbl@scset\<#2name>\<#1#2name>}%
            {}}%
      \else  % Old way, but defined in the new way
        \bbl@exp{%
          \\\bbl@add\<captions#1>{\def\<#2name>{\<#1#2name>}}%
          \\\bbl@ifsamestring{\bbl@tempa}{\languagename}%
            {\def\<#2name>{\<#1#2name>}}%
            {}}%
      \fi%
    \fi
    \@namedef{#1#2name}{#3}%
    \toks@\expandafter{\bbl@captionslist}%
    \bbl@exp{\\\in@{\<#2name>}{\the\toks@}}%
    \ifin@\else
      \bbl@exp{\\\bbl@add\\\bbl@captionslist{\<#2name>}}%
      \bbl@toglobal\bbl@captionslist
    \fi
  \fi}
\bbl@trace{Macros related to glyphs}
\def\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}%
    \dimen\z@\ht\z@ \advance\dimen\z@ -\ht\tw@%
    \setbox\z@\hbox{\lower\dimen\z@ \box\z@}\ht\z@\ht\tw@ \dp\z@\dp\tw@}
\def\save@sf@q#1{\leavevmode
  \begingroup
    \edef\@SF{\spacefactor\the\spacefactor}#1\@SF
  \endgroup}
\ProvideTextCommand{\quotedblbase}{OT1}{%
  \save@sf@q{\set@low@box{\textquotedblright\/}%
    \box\z@\kern-.04em\bbl@allowhyphens}}
\ProvideTextCommandDefault{\quotedblbase}{%
  \UseTextSymbol{OT1}{\quotedblbase}}
\ProvideTextCommand{\quotesinglbase}{OT1}{%
  \save@sf@q{\set@low@box{\textquoteright\/}%
    \box\z@\kern-.04em\bbl@allowhyphens}}
\ProvideTextCommandDefault{\quotesinglbase}{%
  \UseTextSymbol{OT1}{\quotesinglbase}}
\ProvideTextCommand{\guillemetleft}{OT1}{%
  \ifmmode
    \ll
  \else
    \save@sf@q{\nobreak
      \raise.2ex\hbox{$\scriptscriptstyle\ll$}\bbl@allowhyphens}%
  \fi}
\ProvideTextCommand{\guillemetright}{OT1}{%
  \ifmmode
    \gg
  \else
    \save@sf@q{\nobreak
      \raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl@allowhyphens}%
  \fi}
\ProvideTextCommand{\guillemotleft}{OT1}{%
  \ifmmode
    \ll
  \else
    \save@sf@q{\nobreak
      \raise.2ex\hbox{$\scriptscriptstyle\ll$}\bbl@allowhyphens}%
  \fi}
\ProvideTextCommand{\guillemotright}{OT1}{%
  \ifmmode
    \gg
  \else
    \save@sf@q{\nobreak
      \raise.2ex\hbox{$\scriptscriptstyle\gg$}\bbl@allowhyphens}%
  \fi}
\ProvideTextCommandDefault{\guillemetleft}{%
  \UseTextSymbol{OT1}{\guillemetleft}}
\ProvideTextCommandDefault{\guillemetright}{%
  \UseTextSymbol{OT1}{\guillemetright}}
\ProvideTextCommandDefault{\guillemotleft}{%
  \UseTextSymbol{OT1}{\guillemotleft}}
\ProvideTextCommandDefault{\guillemotright}{%
  \UseTextSymbol{OT1}{\guillemotright}}
\ProvideTextCommand{\guilsinglleft}{OT1}{%
  \ifmmode
    <%
  \else
    \save@sf@q{\nobreak
      \raise.2ex\hbox{$\scriptscriptstyle<$}\bbl@allowhyphens}%
  \fi}
\ProvideTextCommand{\guilsinglright}{OT1}{%
  \ifmmode
    >%
  \else
    \save@sf@q{\nobreak
      \raise.2ex\hbox{$\scriptscriptstyle>$}\bbl@allowhyphens}%
  \fi}
\ProvideTextCommandDefault{\guilsinglleft}{%
  \UseTextSymbol{OT1}{\guilsinglleft}}
\ProvideTextCommandDefault{\guilsinglright}{%
  \UseTextSymbol{OT1}{\guilsinglright}}
\DeclareTextCommand{\ij}{OT1}{%
  i\kern-0.02em\bbl@allowhyphens j}
\DeclareTextCommand{\IJ}{OT1}{%
  I\kern-0.02em\bbl@allowhyphens J}
\DeclareTextCommand{\ij}{T1}{\char188}
\DeclareTextCommand{\IJ}{T1}{\char156}
\ProvideTextCommandDefault{\ij}{%
  \UseTextSymbol{OT1}{\ij}}
\ProvideTextCommandDefault{\IJ}{%
  \UseTextSymbol{OT1}{\IJ}}
\def\crrtic@{\hrule height0.1ex width0.3em}
\def\crttic@{\hrule height0.1ex width0.33em}
\def\ddj@{%
  \setbox0\hbox{d}\dimen@=\ht0
  \advance\dimen@1ex
  \dimen@.45\dimen@
  \dimen@ii\expandafter\rem@pt\the\fontdimen\@ne\font\dimen@
  \advance\dimen@ii.5ex
  \leavevmode\rlap{\raise\dimen@\hbox{\kern\dimen@ii\vbox{\crrtic@}}}}
\def\DDJ@{%
  \setbox0\hbox{D}\dimen@=.55\ht0
  \dimen@ii\expandafter\rem@pt\the\fontdimen\@ne\font\dimen@
  \advance\dimen@ii.15ex %            correction for the dash position
  \advance\dimen@ii-.15\fontdimen7\font %     correction for cmtt font
  \dimen\thr@@\expandafter\rem@pt\the\fontdimen7\font\dimen@
  \leavevmode\rlap{\raise\dimen@\hbox{\kern\dimen@ii\vbox{\crttic@}}}}
\DeclareTextCommand{\dj}{OT1}{\ddj@ d}
\DeclareTextCommand{\DJ}{OT1}{\DDJ@ D}
\ProvideTextCommandDefault{\dj}{%
  \UseTextSymbol{OT1}{\dj}}
\ProvideTextCommandDefault{\DJ}{%
  \UseTextSymbol{OT1}{\DJ}}
\DeclareTextCommand{\SS}{OT1}{SS}
\ProvideTextCommandDefault{\SS}{\UseTextSymbol{OT1}{\SS}}
\ProvideTextCommandDefault{\glq}{%
  \textormath{\quotesinglbase}{\mbox{\quotesinglbase}}}
\ProvideTextCommand{\grq}{T1}{%
  \textormath{\kern\z@\textquoteleft}{\mbox{\textquoteleft}}}
\ProvideTextCommand{\grq}{TU}{%
  \textormath{\textquoteleft}{\mbox{\textquoteleft}}}
\ProvideTextCommand{\grq}{OT1}{%
  \save@sf@q{\kern-.0125em
    \textormath{\textquoteleft}{\mbox{\textquoteleft}}%
    \kern.07em\relax}}
\ProvideTextCommandDefault{\grq}{\UseTextSymbol{OT1}\grq}
\ProvideTextCommandDefault{\glqq}{%
  \textormath{\quotedblbase}{\mbox{\quotedblbase}}}
\ProvideTextCommand{\grqq}{T1}{%
  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
\ProvideTextCommand{\grqq}{TU}{%
  \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}}
\ProvideTextCommand{\grqq}{OT1}{%
  \save@sf@q{\kern-.07em
    \textormath{\textquotedblleft}{\mbox{\textquotedblleft}}%
    \kern.07em\relax}}
\ProvideTextCommandDefault{\grqq}{\UseTextSymbol{OT1}\grqq}
\ProvideTextCommandDefault{\flq}{%
  \textormath{\guilsinglleft}{\mbox{\guilsinglleft}}}
\ProvideTextCommandDefault{\frq}{%
  \textormath{\guilsinglright}{\mbox{\guilsinglright}}}
\ProvideTextCommandDefault{\flqq}{%
  \textormath{\guillemetleft}{\mbox{\guillemetleft}}}
\ProvideTextCommandDefault{\frqq}{%
  \textormath{\guillemetright}{\mbox{\guillemetright}}}
\def\umlauthigh{%
  \def\bbl@umlauta##1{\leavevmode\bgroup%
      \accent\csname\f@encoding dqpos\endcsname
      ##1\bbl@allowhyphens\egroup}%
  \let\bbl@umlaute\bbl@umlauta}
\def\umlautlow{%
  \def\bbl@umlauta{\protect\lower@umlaut}}
\def\umlautelow{%
  \def\bbl@umlaute{\protect\lower@umlaut}}
\umlauthigh
\expandafter\ifx\csname U@D\endcsname\relax
  \csname newdimen\endcsname\U@D
\fi
\def\lower@umlaut#1{%
  \leavevmode\bgroup
    \U@D 1ex%
    {\setbox\z@\hbox{%
      \char\csname\f@encoding dqpos\endcsname}%
      \dimen@ -.45ex\advance\dimen@\ht\z@
      \ifdim 1ex<\dimen@ \fontdimen5\font\dimen@ \fi}%
    \accent\csname\f@encoding dqpos\endcsname
    \fontdimen5\font\U@D #1%
  \egroup}
\AtBeginDocument{%
  \DeclareTextCompositeCommand{\"}{OT1}{a}{\bbl@umlauta{a}}%
  \DeclareTextCompositeCommand{\"}{OT1}{e}{\bbl@umlaute{e}}%
  \DeclareTextCompositeCommand{\"}{OT1}{i}{\bbl@umlaute{\i}}%
  \DeclareTextCompositeCommand{\"}{OT1}{\i}{\bbl@umlaute{\i}}%
  \DeclareTextCompositeCommand{\"}{OT1}{o}{\bbl@umlauta{o}}%
  \DeclareTextCompositeCommand{\"}{OT1}{u}{\bbl@umlauta{u}}%
  \DeclareTextCompositeCommand{\"}{OT1}{A}{\bbl@umlauta{A}}%
  \DeclareTextCompositeCommand{\"}{OT1}{E}{\bbl@umlaute{E}}%
  \DeclareTextCompositeCommand{\"}{OT1}{I}{\bbl@umlaute{I}}%
  \DeclareTextCompositeCommand{\"}{OT1}{O}{\bbl@umlauta{O}}%
  \DeclareTextCompositeCommand{\"}{OT1}{U}{\bbl@umlauta{U}}}
\ifx\l@english\@undefined
  \chardef\l@english\z@
\fi
\ifx\l@unhyphenated\@undefined
  \newlanguage\l@unhyphenated
\fi
\bbl@trace{Bidi layout}
\providecommand\IfBabelLayout[3]{#3}%
\bbl@trace{Input engine specific macros}
\ifcase\bbl@engine
  \input txtbabel.def
\or
  \input luababel.def
\or
  \input xebabel.def
\fi
\providecommand\babelfont{\bbl@error{only-lua-xe}{}{}{}}
\providecommand\babelprehyphenation{\bbl@error{only-lua}{}{}{}}
\ifx\babelposthyphenation\@undefined
  \let\babelposthyphenation\babelprehyphenation
  \let\babelpatterns\babelprehyphenation
  \let\babelcharproperty\babelprehyphenation
\fi
\bbl@trace{Creating languages and reading ini files}
\let\bbl@extend@ini\@gobble
\newcommand\babelprovide[2][]{%
  \let\bbl@savelangname\languagename
  \edef\bbl@savelocaleid{\the\localeid}%
  % Set name and locale id
  \edef\languagename{#2}%
  \bbl@id@assign
  % Initialize keys
  \bbl@vforeach{captions,date,import,main,script,language,%
      hyphenrules,linebreaking,justification,mapfont,maparabic,%
      mapdigits,intraspace,intrapenalty,onchar,transforms,alph,%
      Alph,labels,labels*,calendar,date,casing,interchar,@import}%
    {\bbl@csarg\let{KVP@##1}\@nnil}%
  \global\let\bbl@release@transforms\@empty
  \global\let\bbl@release@casing\@empty
  \let\bbl@calendars\@empty
  \global\let\bbl@inidata\@empty
  \global\let\bbl@extend@ini\@gobble
  \global\let\bbl@included@inis\@empty
  \gdef\bbl@key@list{;}%
  \bbl@ifunset{bbl@passto@#2}%
    {\def\bbl@tempa{#1}}%
    {\bbl@exp{\def\\\bbl@tempa{\[bbl@passto@#2],\unexpanded{#1}}}}%
  \expandafter\bbl@forkv\expandafter{\bbl@tempa}{%
    \in@{/}{##1}% With /, (re)sets a value in the ini
    \ifin@
      \global\let\bbl@extend@ini\bbl@extend@ini@aux
      \bbl@renewinikey##1\@@{##2}%
    \else
      \bbl@csarg\ifx{KVP@##1}\@nnil\else
        \bbl@error{unknown-provide-key}{##1}{}{}%
      \fi
      \bbl@csarg\def{KVP@##1}{##2}%
    \fi}%
  \chardef\bbl@howloaded=% 0:none; 1:ldf without ini; 2:ini
    \bbl@ifunset{date#2}\z@{\bbl@ifunset{bbl@llevel@#2}\@ne\tw@}%
  % == init ==
  \ifx\bbl@screset\@undefined
    \bbl@ldfinit
  \fi
  % ==
  \ifx\bbl@KVP@@import\@nnil\else \ifx\bbl@KVP@import\@nnil
    \def\bbl@KVP@import{\@empty}%
  \fi\fi
  % == date (as option) ==
  % \ifx\bbl@KVP@date\@nnil\else
  % \fi
  % ==
  \let\bbl@lbkflag\relax % \@empty = do setup linebreak, only in 3 cases:
  \ifcase\bbl@howloaded
    \let\bbl@lbkflag\@empty % new
  \else
    \ifx\bbl@KVP@hyphenrules\@nnil\else
       \let\bbl@lbkflag\@empty
    \fi
    \ifx\bbl@KVP@import\@nnil\else
      \let\bbl@lbkflag\@empty
    \fi
  \fi
  % == import, captions ==
  \ifx\bbl@KVP@import\@nnil\else
    \bbl@exp{\\\bbl@ifblank{\bbl@KVP@import}}%
      {\ifx\bbl@initoload\relax
         \begingroup
           \def\BabelBeforeIni##1##2{\gdef\bbl@KVP@import{##1}\endinput}%
           \bbl@input@texini{#2}%
         \endgroup
       \else
         \xdef\bbl@KVP@import{\bbl@initoload}%
       \fi}%
      {}%
    \let\bbl@KVP@date\@empty
  \fi
  \let\bbl@KVP@captions@@\bbl@KVP@captions
  \ifx\bbl@KVP@captions\@nnil
    \let\bbl@KVP@captions\bbl@KVP@import
  \fi
  % ==
  \ifx\bbl@KVP@transforms\@nnil\else
    \bbl@replace\bbl@KVP@transforms{ }{,}%
  \fi
  % == Load ini ==
  \ifcase\bbl@howloaded
    \bbl@provide@new{#2}%
  \else
    \bbl@ifblank{#1}%
      {}%  With \bbl@load@basic below
      {\bbl@provide@renew{#2}}%
  \fi
  % == include == TODO
  % \ifx\bbl@included@inis\@empty\else
  %   \bbl@replace\bbl@included@inis{ }{,}%
  %   \bbl@foreach\bbl@included@inis{%
  %     \openin\bbl@readstream=babel-##1.ini
  %     \bbl@extend@ini{#2}}%
  %   \closein\bbl@readstream
  % \fi
  % Post tasks
  % ----------
  % == subsequent calls after the first provide for a locale ==
  \ifx\bbl@inidata\@empty\else
    \bbl@extend@ini{#2}%
  \fi
  % == ensure captions ==
  \ifx\bbl@KVP@captions\@nnil\else
    \bbl@ifunset{bbl@extracaps@#2}%
      {\bbl@exp{\\\babelensure[exclude=\\\today]{#2}}}%
      {\bbl@exp{\\\babelensure[exclude=\\\today,
                include=\[bbl@extracaps@#2]}]{#2}}%
    \bbl@ifunset{bbl@ensure@\languagename}%
      {\bbl@exp{%
        \\\DeclareRobustCommand\<bbl@ensure@\languagename>[1]{%
          \\\foreignlanguage{\languagename}%
          {####1}}}}%
      {}%
    \bbl@exp{%
       \\\bbl@toglobal\<bbl@ensure@\languagename>%
       \\\bbl@toglobal\<bbl@ensure@\languagename\space>}%
  \fi
  \bbl@load@basic{#2}%
  % == script, language ==
  % Override the values from ini or defines them
  \ifx\bbl@KVP@script\@nnil\else
    \bbl@csarg\edef{sname@#2}{\bbl@KVP@script}%
  \fi
  \ifx\bbl@KVP@language\@nnil\else
    \bbl@csarg\edef{lname@#2}{\bbl@KVP@language}%
  \fi
  \ifcase\bbl@engine\or
    \bbl@ifunset{bbl@chrng@\languagename}{}%
      {\directlua{
         Babel.set_chranges_b('\bbl@cl{sbcp}', '\bbl@cl{chrng}') }}%
  \fi
  % == Line breaking: intraspace, intrapenalty ==
  % For CJK, East Asian, Southeast Asian, if interspace in ini
  \ifx\bbl@KVP@intraspace\@nnil\else % We can override the ini or set
    \bbl@csarg\edef{intsp@#2}{\bbl@KVP@intraspace}%
  \fi
  \bbl@provide@intraspace
  % == Line breaking: justification ==
  \ifx\bbl@KVP@justification\@nnil\else
     \let\bbl@KVP@linebreaking\bbl@KVP@justification
  \fi
  \ifx\bbl@KVP@linebreaking\@nnil\else
    \bbl@xin@{,\bbl@KVP@linebreaking,}%
      {,elongated,kashida,cjk,padding,unhyphenated,}%
    \ifin@
      \bbl@csarg\xdef
        {lnbrk@\languagename}{\expandafter\@car\bbl@KVP@linebreaking\@nil}%
    \fi
  \fi
  \bbl@xin@{/e}{/\bbl@cl{lnbrk}}%
  \ifin@\else\bbl@xin@{/k}{/\bbl@cl{lnbrk}}\fi
  \ifin@\bbl@arabicjust\fi
  % WIP
  \bbl@xin@{/p}{/\bbl@cl{lnbrk}}%
  \ifin@\AtBeginDocument{\@nameuse{bbl@tibetanjust}}\fi
  % == Line breaking: hyphenate.other.(locale|script) ==
  \ifx\bbl@lbkflag\@empty
    \bbl@ifunset{bbl@hyotl@\languagename}{}%
      {\bbl@csarg\bbl@replace{hyotl@\languagename}{ }{,}%
       \bbl@startcommands*{\languagename}{}%
         \bbl@csarg\bbl@foreach{hyotl@\languagename}{%
           \ifcase\bbl@engine
             \ifnum##1<257
               \SetHyphenMap{\BabelLower{##1}{##1}}%
             \fi
           \else
             \SetHyphenMap{\BabelLower{##1}{##1}}%
           \fi}%
       \bbl@endcommands}%
    \bbl@ifunset{bbl@hyots@\languagename}{}%
      {\bbl@csarg\bbl@replace{hyots@\languagename}{ }{,}%
       \bbl@csarg\bbl@foreach{hyots@\languagename}{%
         \ifcase\bbl@engine
           \ifnum##1<257
             \global\lccode##1=##1\relax
           \fi
         \else
           \global\lccode##1=##1\relax
         \fi}}%
  \fi
  % == Counters: maparabic ==
  % Native digits, if provided in ini (TeX level, xe and lua)
  \ifcase\bbl@engine\else
    \bbl@ifunset{bbl@dgnat@\languagename}{}%
      {\expandafter\ifx\csname bbl@dgnat@\languagename\endcsname\@empty\else
        \expandafter\expandafter\expandafter
        \bbl@setdigits\csname bbl@dgnat@\languagename\endcsname
        \ifx\bbl@KVP@maparabic\@nnil\else
          \ifx\bbl@latinarabic\@undefined
            \expandafter\let\expandafter\@arabic
              \csname bbl@counter@\languagename\endcsname
          \else    % i.e., if layout=counters, which redefines \@arabic
            \expandafter\let\expandafter\bbl@latinarabic
              \csname bbl@counter@\languagename\endcsname
          \fi
        \fi
      \fi}%
  \fi
  % == Counters: mapdigits ==
  % > luababel.def
  % == Counters: alph, Alph ==
  \ifx\bbl@KVP@alph\@nnil\else
    \bbl@exp{%
      \\\bbl@add\<bbl@preextras@\languagename>{%
        \\\babel@save\\\@alph
        \let\\\@alph\<bbl@cntr@\bbl@KVP@alph @\languagename>}}%
  \fi
  \ifx\bbl@KVP@Alph\@nnil\else
    \bbl@exp{%
      \\\bbl@add\<bbl@preextras@\languagename>{%
        \\\babel@save\\\@Alph
        \let\\\@Alph\<bbl@cntr@\bbl@KVP@Alph @\languagename>}}%
  \fi
  % == Casing ==
  \bbl@release@casing
  \ifx\bbl@KVP@casing\@nnil\else
    \bbl@csarg\xdef{casing@\languagename}%
      {\@nameuse{bbl@casing@\languagename}\bbl@maybextx\bbl@KVP@casing}%
  \fi
  % == Calendars ==
  \ifx\bbl@KVP@calendar\@nnil
    \edef\bbl@KVP@calendar{\bbl@cl{calpr}}%
  \fi
  \def\bbl@tempe##1 ##2\@@{% Get first calendar
    \def\bbl@tempa{##1}}%
    \bbl@exp{\\\bbl@tempe\bbl@KVP@calendar\space\\\@@}%
  \def\bbl@tempe##1.##2.##3\@@{%
    \def\bbl@tempc{##1}%
    \def\bbl@tempb{##2}}%
  \expandafter\bbl@tempe\bbl@tempa..\@@
  \bbl@csarg\edef{calpr@\languagename}{%
    \ifx\bbl@tempc\@empty\else
      calendar=\bbl@tempc
    \fi
    \ifx\bbl@tempb\@empty\else
      ,variant=\bbl@tempb
    \fi}%
  % == engine specific extensions ==
  % Defined in XXXbabel.def
  \bbl@provide@extra{#2}%
  % == require.babel in ini ==
  % To load or reaload the babel-*.tex, if require.babel in ini
  \ifx\bbl@beforestart\relax\else  % But not in doc aux or body
    \bbl@ifunset{bbl@rqtex@\languagename}{}%
      {\expandafter\ifx\csname bbl@rqtex@\languagename\endcsname\@empty\else
         \let\BabelBeforeIni\@gobbletwo
         \chardef\atcatcode=\catcode`\@
         \catcode`\@=11\relax
         \def\CurrentOption{#2}%
         \bbl@input@texini{\bbl@cs{rqtex@\languagename}}%
         \catcode`\@=\atcatcode
         \let\atcatcode\relax
         \global\bbl@csarg\let{rqtex@\languagename}\relax
       \fi}%
    \bbl@foreach\bbl@calendars{%
      \bbl@ifunset{bbl@ca@##1}{%
        \chardef\atcatcode=\catcode`\@
        \catcode`\@=11\relax
        \InputIfFileExists{babel-ca-##1.tex}{}{}%
        \catcode`\@=\atcatcode
        \let\atcatcode\relax}%
      {}}%
  \fi
  % == frenchspacing ==
  \ifcase\bbl@howloaded\in@true\else\in@false\fi
  \ifin@\else\bbl@xin@{typography/frenchspacing}{\bbl@key@list}\fi
  \ifin@
    \bbl@extras@wrap{\\\bbl@pre@fs}%
      {\bbl@pre@fs}%
      {\bbl@post@fs}%
  \fi
  % == transforms ==
  % > luababel.def
  \def\CurrentOption{#2}%
  \@nameuse{bbl@icsave@#2}%
  % == main ==
  \ifx\bbl@KVP@main\@nnil  % Restore only if not 'main'
    \let\languagename\bbl@savelangname
    \chardef\localeid\bbl@savelocaleid\relax
  \fi
  % == hyphenrules (apply if current) ==
  \ifx\bbl@KVP@hyphenrules\@nnil\else
    \ifnum\bbl@savelocaleid=\localeid
      \language\@nameuse{l@\languagename}%
    \fi
  \fi}
\def\bbl@provide@new#1{%
  \@namedef{date#1}{}% marks lang exists - required by \StartBabelCommands
  \@namedef{extras#1}{}%
  \@namedef{noextras#1}{}%
  \bbl@startcommands*{#1}{captions}%
    \ifx\bbl@KVP@captions\@nnil %     and also if import, implicit
      \def\bbl@tempb##1{%             elt for \bbl@captionslist
        \ifx##1\@nnil\else
          \bbl@exp{%
            \\\SetString\\##1{%
              \\\bbl@nocaption{\bbl@stripslash##1}{#1\bbl@stripslash##1}}}%
          \expandafter\bbl@tempb
        \fi}%
      \expandafter\bbl@tempb\bbl@captionslist\@nnil
    \else
      \ifx\bbl@initoload\relax
        \bbl@read@ini{\bbl@KVP@captions}2%  % Here letters cat = 11
      \else
        \bbl@read@ini{\bbl@initoload}2%     % Same
      \fi
    \fi
  \StartBabelCommands*{#1}{date}%
    \ifx\bbl@KVP@date\@nnil
      \bbl@exp{%
        \\\SetString\\\today{\\\bbl@nocaption{today}{#1today}}}%
    \else
      \bbl@savetoday
      \bbl@savedate
    \fi
  \bbl@endcommands
  \bbl@load@basic{#1}%
  % == hyphenmins == (only if new)
  \bbl@exp{%
    \gdef\<#1hyphenmins>{%
      {\bbl@ifunset{bbl@lfthm@#1}{2}{\bbl@cs{lfthm@#1}}}%
      {\bbl@ifunset{bbl@rgthm@#1}{3}{\bbl@cs{rgthm@#1}}}}}%
  % == hyphenrules (also in renew) ==
  \bbl@provide@hyphens{#1}%
  \ifx\bbl@KVP@main\@nnil\else
     \expandafter\main@language\expandafter{#1}%
  \fi}
\def\bbl@provide@renew#1{%
  \ifx\bbl@KVP@captions\@nnil\else
    \StartBabelCommands*{#1}{captions}%
      \bbl@read@ini{\bbl@KVP@captions}2%   % Here all letters cat = 11
    \EndBabelCommands
  \fi
  \ifx\bbl@KVP@date\@nnil\else
    \StartBabelCommands*{#1}{date}%
      \bbl@savetoday
      \bbl@savedate
    \EndBabelCommands
  \fi
  % == hyphenrules (also in new) ==
  \ifx\bbl@lbkflag\@empty
    \bbl@provide@hyphens{#1}%
  \fi}
\def\bbl@load@basic#1{%
  \ifcase\bbl@howloaded\or\or
    \ifcase\csname bbl@llevel@\languagename\endcsname
      \bbl@csarg\let{lname@\languagename}\relax
    \fi
  \fi
  \bbl@ifunset{bbl@lname@#1}%
    {\def\BabelBeforeIni##1##2{%
       \begingroup
         \let\bbl@ini@captions@aux\@gobbletwo
         \def\bbl@inidate ####1.####2.####3.####4\relax ####5####6{}%
         \bbl@read@ini{##1}1%
         \ifx\bbl@initoload\relax\endinput\fi
       \endgroup}%
     \begingroup       % boxed, to avoid extra spaces:
       \ifx\bbl@initoload\relax
         \bbl@input@texini{#1}%
       \else
         \setbox\z@\hbox{\BabelBeforeIni{\bbl@initoload}{}}%
       \fi
     \endgroup}%
    {}}
\def\bbl@provide@hyphens#1{%
  \@tempcnta\m@ne  % a flag
  \ifx\bbl@KVP@hyphenrules\@nnil\else
    \bbl@replace\bbl@KVP@hyphenrules{ }{,}%
    \bbl@foreach\bbl@KVP@hyphenrules{%
      \ifnum\@tempcnta=\m@ne   % if not yet found
        \bbl@ifsamestring{##1}{+}%
          {\bbl@carg\addlanguage{l@##1}}%
          {}%
        \bbl@ifunset{l@##1}% After a possible +
          {}%
          {\@tempcnta\@nameuse{l@##1}}%
      \fi}%
    \ifnum\@tempcnta=\m@ne
      \bbl@warning{%
        Requested 'hyphenrules' for '\languagename' not found:\\%
        \bbl@KVP@hyphenrules.\\%
        Using the default value. Reported}%
    \fi
  \fi
  \ifnum\@tempcnta=\m@ne          % if no opt or no language in opt found
    \ifx\bbl@KVP@captions@@\@nnil % TODO. Hackish. See above.
      \bbl@ifunset{bbl@hyphr@#1}{}% use value in ini, if exists
        {\bbl@exp{\\\bbl@ifblank{\bbl@cs{hyphr@#1}}}%
           {}%
           {\bbl@ifunset{l@\bbl@cl{hyphr}}%
             {}%                   if hyphenrules found:
             {\@tempcnta\@nameuse{l@\bbl@cl{hyphr}}}}}%
    \fi
  \fi
  \bbl@ifunset{l@#1}%
    {\ifnum\@tempcnta=\m@ne
       \bbl@carg\adddialect{l@#1}\language
     \else
       \bbl@carg\adddialect{l@#1}\@tempcnta
     \fi}%
    {\ifnum\@tempcnta=\m@ne\else
       \global\bbl@carg\chardef{l@#1}\@tempcnta
     \fi}}
\def\bbl@input@texini#1{%
  \bbl@bsphack
    \bbl@exp{%
      \catcode`\\\%=14 \catcode`\\\\=0
      \catcode`\\\{=1  \catcode`\\\}=2
      \lowercase{\\\InputIfFileExists{babel-#1.tex}{}{}}%
      \catcode`\\\%=\the\catcode`\%\relax
      \catcode`\\\\=\the\catcode`\\\relax
      \catcode`\\\{=\the\catcode`\{\relax
      \catcode`\\\}=\the\catcode`\}\relax}%
  \bbl@esphack}
\def\bbl@iniline#1\bbl@iniline{%
  \@ifnextchar[\bbl@inisect{\@ifnextchar;\bbl@iniskip\bbl@inistore}#1\@@}% ]
\def\bbl@inisect[#1]#2\@@{\def\bbl@section{#1}}
\def\bbl@iniskip#1\@@{}%      if starts with ;
\def\bbl@inistore#1=#2\@@{%      full (default)
  \bbl@trim@def\bbl@tempa{#1}%
  \bbl@trim\toks@{#2}%
  \bbl@xin@{;\bbl@section/\bbl@tempa;}{\bbl@key@list}%
  \ifin@\else
    \bbl@xin@{,identification/include.}%
             {,\bbl@section/\bbl@tempa}%
    \ifin@\xdef\bbl@included@inis{\the\toks@}\fi
    \bbl@exp{%
      \\\g@addto@macro\\\bbl@inidata{%
        \\\bbl@elt{\bbl@section}{\bbl@tempa}{\the\toks@}}}%
  \fi}
\def\bbl@inistore@min#1=#2\@@{%  minimal (maybe set in \bbl@read@ini)
  \bbl@trim@def\bbl@tempa{#1}%
  \bbl@trim\toks@{#2}%
  \bbl@xin@{.identification.}{.\bbl@section.}%
  \ifin@
    \bbl@exp{\\\g@addto@macro\\\bbl@inidata{%
      \\\bbl@elt{identification}{\bbl@tempa}{\the\toks@}}}%
  \fi}
\def\bbl@loop@ini{%
  \loop
    \if T\ifeof\bbl@readstream F\fi T\relax % Trick, because inside \loop
      \endlinechar\m@ne
      \read\bbl@readstream to \bbl@line
      \endlinechar`\^^M
      \ifx\bbl@line\@empty\else
        \expandafter\bbl@iniline\bbl@line\bbl@iniline
      \fi
    \repeat}
\ifx\bbl@readstream\@undefined
  \csname newread\endcsname\bbl@readstream
\fi
\def\bbl@read@ini#1#2{%
  \global\let\bbl@extend@ini\@gobble
  \openin\bbl@readstream=babel-#1.ini
  \ifeof\bbl@readstream
    \bbl@error{no-ini-file}{#1}{}{}%
  \else
    % == Store ini data in \bbl@inidata ==
    \catcode`\[=12 \catcode`\]=12 \catcode`\==12 \catcode`\&=12
    \catcode`\;=12 \catcode`\|=12 \catcode`\%=14 \catcode`\-=12
    \bbl@info{Importing
                \ifcase#2font and identification \or basic \fi
                 data for \languagename\\%
              from babel-#1.ini. Reported}%
    \ifnum#2=\z@
      \global\let\bbl@inidata\@empty
      \let\bbl@inistore\bbl@inistore@min    % Remember it's local
    \fi
    \def\bbl@section{identification}%
    \bbl@exp{\\\bbl@inistore tag.ini=#1\\\@@}%
    \bbl@inistore load.level=#2\@@
    \bbl@loop@ini
    % == Process stored data ==
    \bbl@csarg\xdef{lini@\languagename}{#1}%
    \bbl@read@ini@aux
    % == 'Export' data ==
    \bbl@ini@exports{#2}%
    \global\bbl@csarg\let{inidata@\languagename}\bbl@inidata
    \global\let\bbl@inidata\@empty
    \bbl@exp{\\\bbl@add@list\\\bbl@ini@loaded{\languagename}}%
    \bbl@toglobal\bbl@ini@loaded
  \fi
  \closein\bbl@readstream}
\def\bbl@read@ini@aux{%
  \let\bbl@savestrings\@empty
  \let\bbl@savetoday\@empty
  \let\bbl@savedate\@empty
  \def\bbl@elt##1##2##3{%
    \def\bbl@section{##1}%
    \in@{=date.}{=##1}% Find a better place
    \ifin@
      \bbl@ifunset{bbl@inikv@##1}%
        {\bbl@ini@calendar{##1}}%
        {}%
    \fi
    \bbl@ifunset{bbl@inikv@##1}{}%
      {\csname bbl@inikv@##1\endcsname{##2}{##3}}}%
  \bbl@inidata}
\def\bbl@extend@ini@aux#1{%
  \bbl@startcommands*{#1}{captions}%
    % Activate captions/... and modify exports
    \bbl@csarg\def{inikv@captions.licr}##1##2{%
      \setlocalecaption{#1}{##1}{##2}}%
    \def\bbl@inikv@captions##1##2{%
      \bbl@ini@captions@aux{##1}{##2}}%
    \def\bbl@stringdef##1##2{\gdef##1{##2}}%
    \def\bbl@exportkey##1##2##3{%
      \bbl@ifunset{bbl@@kv@##2}{}%
        {\expandafter\ifx\csname bbl@@kv@##2\endcsname\@empty\else
           \bbl@exp{\global\let\<bbl@##1@\languagename>\<bbl@@kv@##2>}%
         \fi}}%
    % As with \bbl@read@ini, but with some changes
    \bbl@read@ini@aux
    \bbl@ini@exports\tw@
    % Update inidata@lang by pretending the ini is read.
    \def\bbl@elt##1##2##3{%
      \def\bbl@section{##1}%
      \bbl@iniline##2=##3\bbl@iniline}%
    \csname bbl@inidata@#1\endcsname
    \global\bbl@csarg\let{inidata@#1}\bbl@inidata
  \StartBabelCommands*{#1}{date}% And from the import stuff
    \def\bbl@stringdef##1##2{\gdef##1{##2}}%
    \bbl@savetoday
    \bbl@savedate
  \bbl@endcommands}
\def\bbl@ini@calendar#1{%
 \lowercase{\def\bbl@tempa{=#1=}}%
 \bbl@replace\bbl@tempa{=date.gregorian}{}%
 \bbl@replace\bbl@tempa{=date.}{}%
 \in@{.licr=}{#1=}%
 \ifin@
   \ifcase\bbl@engine
     \bbl@replace\bbl@tempa{.licr=}{}%
   \else
     \let\bbl@tempa\relax
   \fi
 \fi
 \ifx\bbl@tempa\relax\else
   \bbl@replace\bbl@tempa{=}{}%
   \ifx\bbl@tempa\@empty\else
     \xdef\bbl@calendars{\bbl@calendars,\bbl@tempa}%
   \fi
   \bbl@exp{%
     \def\<bbl@inikv@#1>####1####2{%
       \\\bbl@inidate####1...\relax{####2}{\bbl@tempa}}}%
 \fi}
\def\bbl@renewinikey#1/#2\@@#3{%
  \edef\bbl@tempa{\zap@space #1 \@empty}%   section
  \edef\bbl@tempb{\zap@space #2 \@empty}%   key
  \bbl@trim\toks@{#3}%                      value
  \bbl@exp{%
    \edef\\\bbl@key@list{\bbl@key@list \bbl@tempa/\bbl@tempb;}%
    \\\g@addto@macro\\\bbl@inidata{%
       \\\bbl@elt{\bbl@tempa}{\bbl@tempb}{\the\toks@}}}}%
\def\bbl@exportkey#1#2#3{%
  \bbl@ifunset{bbl@@kv@#2}%
    {\bbl@csarg\gdef{#1@\languagename}{#3}}%
    {\expandafter\ifx\csname bbl@@kv@#2\endcsname\@empty
       \bbl@csarg\gdef{#1@\languagename}{#3}%
     \else
       \bbl@exp{\global\let\<bbl@#1@\languagename>\<bbl@@kv@#2>}%
     \fi}}
\def\bbl@iniwarning#1{%
  \bbl@ifunset{bbl@@kv@identification.warning#1}{}%
    {\bbl@warning{%
       From babel-\bbl@cs{lini@\languagename}.ini:\\%
       \bbl@cs{@kv@identification.warning#1}\\%
       Reported }}}
\let\bbl@release@transforms\@empty
\let\bbl@release@casing\@empty
\def\bbl@ini@exports#1{%
  % Identification always exported
  \bbl@iniwarning{}%
  \ifcase\bbl@engine
    \bbl@iniwarning{.pdflatex}%
  \or
    \bbl@iniwarning{.lualatex}%
  \or
    \bbl@iniwarning{.xelatex}%
  \fi%
  \bbl@exportkey{llevel}{identification.load.level}{}%
  \bbl@exportkey{elname}{identification.name.english}{}%
  \bbl@exp{\\\bbl@exportkey{lname}{identification.name.opentype}%
    {\csname bbl@elname@\languagename\endcsname}}%
  \bbl@exportkey{tbcp}{identification.tag.bcp47}{}%
  % Somewhat hackish. TODO:
  \bbl@exportkey{casing}{identification.tag.bcp47}{}%
  \bbl@exportkey{lbcp}{identification.language.tag.bcp47}{}%
  \bbl@exportkey{lotf}{identification.tag.opentype}{dflt}%
  \bbl@exportkey{esname}{identification.script.name}{}%
  \bbl@exp{\\\bbl@exportkey{sname}{identification.script.name.opentype}%
    {\csname bbl@esname@\languagename\endcsname}}%
  \bbl@exportkey{sbcp}{identification.script.tag.bcp47}{}%
  \bbl@exportkey{sotf}{identification.script.tag.opentype}{DFLT}%
  \bbl@exportkey{rbcp}{identification.region.tag.bcp47}{}%
  \bbl@exportkey{vbcp}{identification.variant.tag.bcp47}{}%
  \bbl@exportkey{extt}{identification.extension.t.tag.bcp47}{}%
  \bbl@exportkey{extu}{identification.extension.u.tag.bcp47}{}%
  \bbl@exportkey{extx}{identification.extension.x.tag.bcp47}{}%
  % Also maps bcp47 -> languagename
  \ifbbl@bcptoname
    \bbl@csarg\xdef{bcp@map@\bbl@cl{tbcp}}{\languagename}%
  \fi
  \ifcase\bbl@engine\or
    \directlua{%
      Babel.locale_props[\the\bbl@cs{id@@\languagename}].script
        = '\bbl@cl{sbcp}'}%
  \fi
  % Conditional
  \ifnum#1>\z@         % 0 = only info, 1, 2 = basic, (re)new
    \bbl@exportkey{calpr}{date.calendar.preferred}{}%
    \bbl@exportkey{lnbrk}{typography.linebreaking}{h}%
    \bbl@exportkey{hyphr}{typography.hyphenrules}{}%
    \bbl@exportkey{lfthm}{typography.lefthyphenmin}{2}%
    \bbl@exportkey{rgthm}{typography.righthyphenmin}{3}%
    \bbl@exportkey{prehc}{typography.prehyphenchar}{}%
    \bbl@exportkey{hyotl}{typography.hyphenate.other.locale}{}%
    \bbl@exportkey{hyots}{typography.hyphenate.other.script}{}%
    \bbl@exportkey{intsp}{typography.intraspace}{}%
    \bbl@exportkey{frspc}{typography.frenchspacing}{u}%
    \bbl@exportkey{chrng}{characters.ranges}{}%
    \bbl@exportkey{quote}{characters.delimiters.quotes}{}%
    \bbl@exportkey{dgnat}{numbers.digits.native}{}%
    \ifnum#1=\tw@           % only (re)new
      \bbl@exportkey{rqtex}{identification.require.babel}{}%
      \bbl@toglobal\bbl@savetoday
      \bbl@toglobal\bbl@savedate
      \bbl@savestrings
    \fi
  \fi}
\def\bbl@inikv#1#2{%     key=value
  \toks@{#2}%            This hides #'s from ini values
  \bbl@csarg\edef{@kv@\bbl@section.#1}{\the\toks@}}
\let\bbl@inikv@identification\bbl@inikv
\let\bbl@inikv@date\bbl@inikv
\let\bbl@inikv@typography\bbl@inikv
\let\bbl@inikv@numbers\bbl@inikv
\def\bbl@maybextx{-\bbl@csarg\ifx{extx@\languagename}\@empty x-\fi}
\def\bbl@inikv@characters#1#2{%
  \bbl@ifsamestring{#1}{casing}%  e.g., casing = uV
    {\bbl@exp{%
       \\\g@addto@macro\\\bbl@release@casing{%
         \\\bbl@casemapping{}{\languagename}{\unexpanded{#2}}}}}%
    {\in@{$casing.}{$#1}%  e.g., casing.Uv = uV
     \ifin@
       \lowercase{\def\bbl@tempb{#1}}%
       \bbl@replace\bbl@tempb{casing.}{}%
       \bbl@exp{\\\g@addto@macro\\\bbl@release@casing{%
         \\\bbl@casemapping
           {\\\bbl@maybextx\bbl@tempb}{\languagename}{\unexpanded{#2}}}}%
     \else
       \bbl@inikv{#1}{#2}%
     \fi}}
\def\bbl@inikv@counters#1#2{%
  \bbl@ifsamestring{#1}{digits}%
    {\bbl@error{digits-is-reserved}{}{}{}}%
    {}%
  \def\bbl@tempc{#1}%
  \bbl@trim@def{\bbl@tempb*}{#2}%
  \in@{.1$}{#1$}%
  \ifin@
    \bbl@replace\bbl@tempc{.1}{}%
    \bbl@csarg\protected@xdef{cntr@\bbl@tempc @\languagename}{%
      \noexpand\bbl@alphnumeral{\bbl@tempc}}%
  \fi
  \in@{.F.}{#1}%
  \ifin@\else\in@{.S.}{#1}\fi
  \ifin@
    \bbl@csarg\protected@xdef{cntr@#1@\languagename}{\bbl@tempb*}%
  \else
    \toks@{}% Required by \bbl@buildifcase, which returns \bbl@tempa
    \expandafter\bbl@buildifcase\bbl@tempb* \\ % Space after \\
    \bbl@csarg{\global\expandafter\let}{cntr@#1@\languagename}\bbl@tempa
  \fi}
\ifcase\bbl@engine
  \bbl@csarg\def{inikv@captions.licr}#1#2{%
    \bbl@ini@captions@aux{#1}{#2}}
\else
  \def\bbl@inikv@captions#1#2{%
    \bbl@ini@captions@aux{#1}{#2}}
\fi
\def\bbl@ini@captions@template#1#2{% string language tempa=capt-name
  \bbl@replace\bbl@tempa{.template}{}%
  \def\bbl@toreplace{#1{}}%
  \bbl@replace\bbl@toreplace{[ ]}{\nobreakspace{}}%
  \bbl@replace\bbl@toreplace{[[}{\csname}%
  \bbl@replace\bbl@toreplace{[}{\csname the}%
  \bbl@replace\bbl@toreplace{]]}{name\endcsname{}}%
  \bbl@replace\bbl@toreplace{]}{\endcsname{}}%
  \bbl@xin@{,\bbl@tempa,}{,chapter,appendix,part,}%
  \ifin@
    \@nameuse{bbl@patch\bbl@tempa}%
    \global\bbl@csarg\let{\bbl@tempa fmt@#2}\bbl@toreplace
  \fi
  \bbl@xin@{,\bbl@tempa,}{,figure,table,}%
  \ifin@
    \global\bbl@csarg\let{\bbl@tempa fmt@#2}\bbl@toreplace
    \bbl@exp{\gdef\<fnum@\bbl@tempa>{%
      \\\bbl@ifunset{bbl@\bbl@tempa fmt@\\\languagename}%
        {\[fnum@\bbl@tempa]}%
        {\\\@nameuse{bbl@\bbl@tempa fmt@\\\languagename}}}}%
  \fi}
\def\bbl@ini@captions@aux#1#2{%
  \bbl@trim@def\bbl@tempa{#1}%
  \bbl@xin@{.template}{\bbl@tempa}%
  \ifin@
    \bbl@ini@captions@template{#2}\languagename
  \else
    \bbl@ifblank{#2}%
      {\bbl@exp{%
         \toks@{\\\bbl@nocaption{\bbl@tempa}{\languagename\bbl@tempa name}}}}%
      {\bbl@trim\toks@{#2}}%
    \bbl@exp{%
      \\\bbl@add\\\bbl@savestrings{%
        \\\SetString\<\bbl@tempa name>{\the\toks@}}}%
    \toks@\expandafter{\bbl@captionslist}%
    \bbl@exp{\\\in@{\<\bbl@tempa name>}{\the\toks@}}%
    \ifin@\else
      \bbl@exp{%
        \\\bbl@add\<bbl@extracaps@\languagename>{\<\bbl@tempa name>}%
        \\\bbl@toglobal\<bbl@extracaps@\languagename>}%
    \fi
  \fi}
\def\bbl@list@the{%
  part,chapter,section,subsection,subsubsection,paragraph,%
  subparagraph,enumi,enumii,enumiii,enumiv,equation,figure,%
  table,page,footnote,mpfootnote,mpfn}
\def\bbl@map@cnt#1{%  #1:roman,etc, // #2:enumi,etc
  \bbl@ifunset{bbl@map@#1@\languagename}%
    {\@nameuse{#1}}%
    {\@nameuse{bbl@map@#1@\languagename}}}
\def\bbl@inikv@labels#1#2{%
  \in@{.map}{#1}%
  \ifin@
    \ifx\bbl@KVP@labels\@nnil\else
      \bbl@xin@{ map }{ \bbl@KVP@labels\space}%
      \ifin@
        \def\bbl@tempc{#1}%
        \bbl@replace\bbl@tempc{.map}{}%
        \in@{,#2,}{,arabic,roman,Roman,alph,Alph,fnsymbol,}%
        \bbl@exp{%
          \gdef\<bbl@map@\bbl@tempc @\languagename>%
            {\ifin@\<#2>\else\\\localecounter{#2}\fi}}%
        \bbl@foreach\bbl@list@the{%
          \bbl@ifunset{the##1}{}%
            {\bbl@exp{\let\\\bbl@tempd\<the##1>}%
             \bbl@exp{%
               \\\bbl@sreplace\<the##1>%
                 {\<\bbl@tempc>{##1}}{\\\bbl@map@cnt{\bbl@tempc}{##1}}%
               \\\bbl@sreplace\<the##1>%
                 {\<\@empty @\bbl@tempc>\<c@##1>}{\\\bbl@map@cnt{\bbl@tempc}{##1}}}%
             \expandafter\ifx\csname the##1\endcsname\bbl@tempd\else
               \toks@\expandafter\expandafter\expandafter{%
                 \csname the##1\endcsname}%
               \expandafter\xdef\csname the##1\endcsname{{\the\toks@}}%
             \fi}}%
      \fi
    \fi
  %
  \else
    %
    % The following code is still under study. You can test it and make
    % suggestions. E.g., enumerate.2 = ([enumi]).([enumii]). It's
    % language dependent.
    \in@{enumerate.}{#1}%
    \ifin@
      \def\bbl@tempa{#1}%
      \bbl@replace\bbl@tempa{enumerate.}{}%
      \def\bbl@toreplace{#2}%
      \bbl@replace\bbl@toreplace{[ ]}{\nobreakspace{}}%
      \bbl@replace\bbl@toreplace{[}{\csname the}%
      \bbl@replace\bbl@toreplace{]}{\endcsname{}}%
      \toks@\expandafter{\bbl@toreplace}%
      % TODO. Execute only once:
      \bbl@exp{%
        \\\bbl@add\<extras\languagename>{%
          \\\babel@save\<labelenum\romannumeral\bbl@tempa>%
          \def\<labelenum\romannumeral\bbl@tempa>{\the\toks@}}%
        \\\bbl@toglobal\<extras\languagename>}%
    \fi
  \fi}
\def\bbl@chaptype{chapter}
\ifx\@makechapterhead\@undefined
  \let\bbl@patchchapter\relax
\else\ifx\thechapter\@undefined
  \let\bbl@patchchapter\relax
\else\ifx\ps@headings\@undefined
  \let\bbl@patchchapter\relax
\else
  \def\bbl@patchchapter{%
    \global\let\bbl@patchchapter\relax
    \gdef\bbl@chfmt{%
      \bbl@ifunset{bbl@\bbl@chaptype fmt@\languagename}%
        {\@chapapp\space\thechapter}
        {\@nameuse{bbl@\bbl@chaptype fmt@\languagename}}}
    \bbl@add\appendix{\def\bbl@chaptype{appendix}}% Not harmful, I hope
    \bbl@sreplace\ps@headings{\@chapapp\ \thechapter}{\bbl@chfmt}%
    \bbl@sreplace\chaptermark{\@chapapp\ \thechapter}{\bbl@chfmt}%
    \bbl@sreplace\@makechapterhead{\@chapapp\space\thechapter}{\bbl@chfmt}%
    \bbl@toglobal\appendix
    \bbl@toglobal\ps@headings
    \bbl@toglobal\chaptermark
    \bbl@toglobal\@makechapterhead}
  \let\bbl@patchappendix\bbl@patchchapter
\fi\fi\fi
\ifx\@part\@undefined
  \let\bbl@patchpart\relax
\else
  \def\bbl@patchpart{%
    \global\let\bbl@patchpart\relax
    \gdef\bbl@partformat{%
      \bbl@ifunset{bbl@partfmt@\languagename}%
        {\partname\nobreakspace\thepart}
        {\@nameuse{bbl@partfmt@\languagename}}}
    \bbl@sreplace\@part{\partname\nobreakspace\thepart}{\bbl@partformat}%
    \bbl@toglobal\@part}
\fi
\let\bbl@calendar\@empty
\DeclareRobustCommand\localedate[1][]{\bbl@localedate{#1}}
\def\bbl@localedate#1#2#3#4{%
  \begingroup
    \edef\bbl@they{#2}%
    \edef\bbl@them{#3}%
    \edef\bbl@thed{#4}%
    \edef\bbl@tempe{%
      \bbl@ifunset{bbl@calpr@\languagename}{}{\bbl@cl{calpr}},%
      #1}%
    \bbl@exp{\lowercase{\edef\\\bbl@tempe{\bbl@tempe}}}%
    \bbl@replace\bbl@tempe{ }{}%
    \bbl@replace\bbl@tempe{convert}{convert=}%
    \let\bbl@ld@calendar\@empty
    \let\bbl@ld@variant\@empty
    \let\bbl@ld@convert\relax
    \def\bbl@tempb##1=##2\@@{\@namedef{bbl@ld@##1}{##2}}%
    \bbl@foreach\bbl@tempe{\bbl@tempb##1\@@}%
    \bbl@replace\bbl@ld@calendar{gregorian}{}%
    \ifx\bbl@ld@calendar\@empty\else
      \ifx\bbl@ld@convert\relax\else
        \babelcalendar[\bbl@they-\bbl@them-\bbl@thed]%
          {\bbl@ld@calendar}\bbl@they\bbl@them\bbl@thed
      \fi
    \fi
    \@nameuse{bbl@precalendar}% Remove, e.g., +, -civil (-ca-islamic)
    \edef\bbl@calendar{% Used in \month..., too
      \bbl@ld@calendar
      \ifx\bbl@ld@variant\@empty\else
        .\bbl@ld@variant
      \fi}%
    \bbl@cased
      {\@nameuse{bbl@date@\languagename @\bbl@calendar}%
         \bbl@they\bbl@them\bbl@thed}%
  \endgroup}
\def\bbl@inidate#1.#2.#3.#4\relax#5#6{% TODO - ignore with 'captions'
  \bbl@trim@def\bbl@tempa{#1.#2}%
  \bbl@ifsamestring{\bbl@tempa}{months.wide}%      to savedate
    {\bbl@trim@def\bbl@tempa{#3}%
     \bbl@trim\toks@{#5}%
     \@temptokena\expandafter{\bbl@savedate}%
     \bbl@exp{%   Reverse order - in ini last wins
       \def\\\bbl@savedate{%
         \\\SetString\<month\romannumeral\bbl@tempa#6name>{\the\toks@}%
         \the\@temptokena}}}%
    {\bbl@ifsamestring{\bbl@tempa}{date.long}%     defined now
      {\lowercase{\def\bbl@tempb{#6}}%
       \bbl@trim@def\bbl@toreplace{#5}%
       \bbl@TG@@date
       \global\bbl@csarg\let{date@\languagename @\bbl@tempb}\bbl@toreplace
       \ifx\bbl@savetoday\@empty
         \bbl@exp{% TODO. Move to a better place.
           \\\AfterBabelCommands{%
             \gdef\<\languagename date>{\\\protect\<\languagename date >}%
             \gdef\<\languagename date >{\\\bbl@printdate{\languagename}}}%
           \def\\\bbl@savetoday{%
             \\\SetString\\\today{%
               \<\languagename date>[convert]%
                  {\\\the\year}{\\\the\month}{\\\the\day}}}}%
       \fi}%
      {}}}
\def\bbl@printdate#1{%
  \@ifnextchar[{\bbl@printdate@i{#1}}{\bbl@printdate@i{#1}[]}}
\def\bbl@printdate@i#1[#2]#3#4#5{%
  \bbl@usedategrouptrue
  \@nameuse{bbl@ensure@#1}{\localedate[#2]{#3}{#4}{#5}}}
\AddToHook{begindocument/before}{%
  \let\bbl@normalsf\normalsfcodes
  \let\normalsfcodes\relax}
\AtBeginDocument{%
  \ifx\bbl@normalsf\@empty
    \ifnum\sfcode`\.=\@m
      \let\normalsfcodes\frenchspacing
    \else
      \let\normalsfcodes\nonfrenchspacing
    \fi
  \else
    \let\normalsfcodes\bbl@normalsf
  \fi}
\let\bbl@calendar\@empty
\newcommand\babelcalendar[2][\the\year-\the\month-\the\day]{%
  \@nameuse{bbl@ca@#2}#1\@@}
\newcommand\BabelDateSpace{\nobreakspace}
\newcommand\BabelDateDot{.\@}  % TODO. \let instead of repeating
\newcommand\BabelDated[1]{{\number#1}}
\newcommand\BabelDatedd[1]{{\ifnum#1<10 0\fi\number#1}}
\newcommand\BabelDateM[1]{{\number#1}}
\newcommand\BabelDateMM[1]{{\ifnum#1<10 0\fi\number#1}}
\newcommand\BabelDateMMMM[1]{{%
  \csname month\romannumeral#1\bbl@calendar name\endcsname}}%
\newcommand\BabelDatey[1]{{\number#1}}%
\newcommand\BabelDateyy[1]{{%
  \ifnum#1<10 0\number#1 %
  \else\ifnum#1<100 \number#1 %
  \else\ifnum#1<1000 \expandafter\@gobble\number#1 %
  \else\ifnum#1<10000 \expandafter\@gobbletwo\number#1 %
  \else
    \bbl@error{limit-two-digits}{}{}{}%
  \fi\fi\fi\fi}}
\newcommand\BabelDateyyyy[1]{{\number#1}} % TODO - add leading 0
\newcommand\BabelDateU[1]{{\number#1}}%
\def\bbl@replace@finish@iii#1{%
  \bbl@exp{\def\\#1####1####2####3{\the\toks@}}}
\def\bbl@TG@@date{%
  \bbl@replace\bbl@toreplace{[ ]}{\BabelDateSpace{}}%
  \bbl@replace\bbl@toreplace{[.]}{\BabelDateDot{}}%
  \bbl@replace\bbl@toreplace{[d]}{\BabelDated{####3}}%
  \bbl@replace\bbl@toreplace{[dd]}{\BabelDatedd{####3}}%
  \bbl@replace\bbl@toreplace{[M]}{\BabelDateM{####2}}%
  \bbl@replace\bbl@toreplace{[MM]}{\BabelDateMM{####2}}%
  \bbl@replace\bbl@toreplace{[MMMM]}{\BabelDateMMMM{####2}}%
  \bbl@replace\bbl@toreplace{[y]}{\BabelDatey{####1}}%
  \bbl@replace\bbl@toreplace{[yy]}{\BabelDateyy{####1}}%
  \bbl@replace\bbl@toreplace{[yyyy]}{\BabelDateyyyy{####1}}%
  \bbl@replace\bbl@toreplace{[U]}{\BabelDateU{####1}}%
  \bbl@replace\bbl@toreplace{[y|}{\bbl@datecntr[####1|}%
  \bbl@replace\bbl@toreplace{[U|}{\bbl@datecntr[####1|}%
  \bbl@replace\bbl@toreplace{[m|}{\bbl@datecntr[####2|}%
  \bbl@replace\bbl@toreplace{[d|}{\bbl@datecntr[####3|}%
  \bbl@replace@finish@iii\bbl@toreplace}
\def\bbl@datecntr{\expandafter\bbl@xdatecntr\expandafter}
\def\bbl@xdatecntr[#1|#2]{\localenumeral{#2}{#1}}
\bbl@csarg\let{inikv@transforms.prehyphenation}\bbl@inikv
\bbl@csarg\let{inikv@transforms.posthyphenation}\bbl@inikv
\def\bbl@transforms@aux#1#2#3#4,#5\relax{%
  #1[#2]{#3}{#4}{#5}}
\begingroup %  A hack. TODO. Don't require a specific order
  \catcode`\%=12
  \catcode`\&=14
  \gdef\bbl@transforms#1#2#3{&%
    \directlua{
       local str = [==[#2]==]
       str = str:gsub('%.%d+%.%d+$', '')
       token.set_macro('babeltempa', str)
    }&%
    \def\babeltempc{}&%
    \bbl@xin@{,\babeltempa,}{,\bbl@KVP@transforms,}&%
    \ifin@\else
      \bbl@xin@{:\babeltempa,}{,\bbl@KVP@transforms,}&%
    \fi
    \ifin@
      \bbl@foreach\bbl@KVP@transforms{&%
        \bbl@xin@{:\babeltempa,}{,##1,}&%
        \ifin@  &% font:font:transform syntax
          \directlua{
            local t = {}
            for m in string.gmatch('##1'..':', '(.-):') do
              table.insert(t, m)
            end
            table.remove(t)
            token.set_macro('babeltempc', ',fonts=' .. table.concat(t, ' '))
          }&%
        \fi}&%
      \in@{.0$}{#2$}&%
      \ifin@
        \directlua{&% (\attribute) syntax
          local str = string.match([[\bbl@KVP@transforms]],
                        '%(([^%(]-)%)[^%)]-\babeltempa')
          if str == nil then
            token.set_macro('babeltempb', '')
          else
            token.set_macro('babeltempb', ',attribute=' .. str)
          end
        }&%
        \toks@{#3}&%
        \bbl@exp{&%
          \\\g@addto@macro\\\bbl@release@transforms{&%
            \relax  &% Closes previous \bbl@transforms@aux
            \\\bbl@transforms@aux
              \\#1{label=\babeltempa\babeltempb\babeltempc}&%
                 {\languagename}{\the\toks@}}}&%
      \else
        \g@addto@macro\bbl@release@transforms{, {#3}}&%
      \fi
    \fi}
\endgroup
\def\bbl@provide@lsys#1{%
  \bbl@ifunset{bbl@lname@#1}%
    {\bbl@load@info{#1}}%
    {}%
  \bbl@csarg\let{lsys@#1}\@empty
  \bbl@ifunset{bbl@sname@#1}{\bbl@csarg\gdef{sname@#1}{Default}}{}%
  \bbl@ifunset{bbl@sotf@#1}{\bbl@csarg\gdef{sotf@#1}{DFLT}}{}%
  \bbl@csarg\bbl@add@list{lsys@#1}{Script=\bbl@cs{sname@#1}}%
  \bbl@ifunset{bbl@lname@#1}{}%
    {\bbl@csarg\bbl@add@list{lsys@#1}{Language=\bbl@cs{lname@#1}}}%
  \ifcase\bbl@engine\or\or
    \bbl@ifunset{bbl@prehc@#1}{}%
      {\bbl@exp{\\\bbl@ifblank{\bbl@cs{prehc@#1}}}%
        {}%
        {\ifx\bbl@xenohyph\@undefined
           \global\let\bbl@xenohyph\bbl@xenohyph@d
           \ifx\AtBeginDocument\@notprerr
             \expandafter\@secondoftwo  % to execute right now
           \fi
           \AtBeginDocument{%
             \bbl@patchfont{\bbl@xenohyph}%
             {\expandafter\select@language\expandafter{\languagename}}}%
        \fi}}%
  \fi
  \bbl@csarg\bbl@toglobal{lsys@#1}}
\def\bbl@xenohyph@d{%
  \bbl@ifset{bbl@prehc@\languagename}%
    {\ifnum\hyphenchar\font=\defaulthyphenchar
       \iffontchar\font\bbl@cl{prehc}\relax
         \hyphenchar\font\bbl@cl{prehc}\relax
       \else\iffontchar\font"200B
         \hyphenchar\font"200B
       \else
         \bbl@warning
           {Neither 0 nor ZERO WIDTH SPACE are available\\%
            in the current font, and therefore the hyphen\\%
            will be printed. Try changing the fontspec's\\%
            'HyphenChar' to another value, but be aware\\%
            this setting is not safe (see the manual).\\%
            Reported}%
         \hyphenchar\font\defaulthyphenchar
       \fi\fi
     \fi}%
    {\hyphenchar\font\defaulthyphenchar}}
  % \fi}
\def\bbl@load@info#1{%
  \def\BabelBeforeIni##1##2{%
    \begingroup
      \bbl@read@ini{##1}0%
      \endinput          % babel- .tex may contain onlypreamble's
    \endgroup}%            boxed, to avoid extra spaces:
  {\bbl@input@texini{#1}}}
\def\bbl@setdigits#1#2#3#4#5{%
  \bbl@exp{%
    \def\<\languagename digits>####1{%       i.e., \langdigits
      \<bbl@digits@\languagename>####1\\\@nil}%
    \let\<bbl@cntr@digits@\languagename>\<\languagename digits>%
    \def\<\languagename counter>####1{%      i.e., \langcounter
      \\\expandafter\<bbl@counter@\languagename>%
      \\\csname c@####1\endcsname}%
    \def\<bbl@counter@\languagename>####1{% i.e., \bbl@counter@lang
      \\\expandafter\<bbl@digits@\languagename>%
      \\\number####1\\\@nil}}%
  \def\bbl@tempa##1##2##3##4##5{%
    \bbl@exp{%    Wow, quite a lot of hashes! :-(
      \def\<bbl@digits@\languagename>########1{%
       \\\ifx########1\\\@nil              % i.e., \bbl@digits@lang
       \\\else
         \\\ifx0########1#1%
         \\\else\\\ifx1########1#2%
         \\\else\\\ifx2########1#3%
         \\\else\\\ifx3########1#4%
         \\\else\\\ifx4########1#5%
         \\\else\\\ifx5########1##1%
         \\\else\\\ifx6########1##2%
         \\\else\\\ifx7########1##3%
         \\\else\\\ifx8########1##4%
         \\\else\\\ifx9########1##5%
         \\\else########1%
         \\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi\\\fi
         \\\expandafter\<bbl@digits@\languagename>%
       \\\fi}}}%
  \bbl@tempa}
\def\bbl@buildifcase#1 {% Returns \bbl@tempa, requires \toks@={}
  \ifx\\#1%             % \\ before, in case #1 is multiletter
    \bbl@exp{%
      \def\\\bbl@tempa####1{%
        \<ifcase>####1\space\the\toks@\<else>\\\@ctrerr\<fi>}}%
  \else
    \toks@\expandafter{\the\toks@\or #1}%
    \expandafter\bbl@buildifcase
  \fi}
\newcommand\localenumeral[2]{\bbl@cs{cntr@#1@\languagename}{#2}}
\def\bbl@localecntr#1#2{\localenumeral{#2}{#1}}
\newcommand\localecounter[2]{%
  \expandafter\bbl@localecntr
  \expandafter{\number\csname c@#2\endcsname}{#1}}
\def\bbl@alphnumeral#1#2{%
  \expandafter\bbl@alphnumeral@i\number#2 76543210\@@{#1}}
\def\bbl@alphnumeral@i#1#2#3#4#5#6#7#8\@@#9{%
  \ifcase\@car#8\@nil\or   % Currently <10000, but prepared for bigger
    \bbl@alphnumeral@ii{#9}000000#1\or
    \bbl@alphnumeral@ii{#9}00000#1#2\or
    \bbl@alphnumeral@ii{#9}0000#1#2#3\or
    \bbl@alphnumeral@ii{#9}000#1#2#3#4\else
    \bbl@alphnum@invalid{>9999}%
  \fi}
\def\bbl@alphnumeral@ii#1#2#3#4#5#6#7#8{%
  \bbl@ifunset{bbl@cntr@#1.F.\number#5#6#7#8@\languagename}%
    {\bbl@cs{cntr@#1.4@\languagename}#5%
     \bbl@cs{cntr@#1.3@\languagename}#6%
     \bbl@cs{cntr@#1.2@\languagename}#7%
     \bbl@cs{cntr@#1.1@\languagename}#8%
     \ifnum#6#7#8>\z@ % TODO. An ad hoc rule for Greek. Ugly.
       \bbl@ifunset{bbl@cntr@#1.S.321@\languagename}{}%
         {\bbl@cs{cntr@#1.S.321@\languagename}}%
     \fi}%
    {\bbl@cs{cntr@#1.F.\number#5#6#7#8@\languagename}}}
\def\bbl@alphnum@invalid#1{%
  \bbl@error{alphabetic-too-large}{#1}{}{}}
\newcommand\BabelUppercaseMapping[3]{%
  \DeclareUppercaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}}
\newcommand\BabelTitlecaseMapping[3]{%
  \DeclareTitlecaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}}
\newcommand\BabelLowercaseMapping[3]{%
  \DeclareLowercaseMapping[\@nameuse{bbl@casing@#1}]{#2}{#3}}
\ifcase\bbl@engine % Converts utf8 to its code (expandable)
  \def\bbl@utftocode#1{\the\numexpr\decode@UTFviii#1\relax}
\else
  \def\bbl@utftocode#1{\expandafter`\string#1}
\fi
\def\bbl@casemapping#1#2#3{% 1:variant
  \def\bbl@tempa##1 ##2{% Loop
    \bbl@casemapping@i{##1}%
    \ifx\@empty##2\else\bbl@afterfi\bbl@tempa##2\fi}%
  \edef\bbl@templ{\@nameuse{bbl@casing@#2}#1}%  Language code
  \def\bbl@tempe{0}%   Mode (upper/lower...)
  \def\bbl@tempc{#3 }% Casing list
  \expandafter\bbl@tempa\bbl@tempc\@empty}
\def\bbl@casemapping@i#1{%
  \def\bbl@tempb{#1}%
  \ifcase\bbl@engine % Handle utf8 in pdftex, by surrounding chars with {}
    \@nameuse{regex_replace_all:nnN}%
      {[\x{c0}-\x{ff}][\x{80}-\x{bf}]*}{{\0}}\bbl@tempb
  \else
    \@nameuse{regex_replace_all:nnN}{.}{{\0}}\bbl@tempb % TODO. needed?
  \fi
  \expandafter\bbl@casemapping@ii\bbl@tempb\@@}
\def\bbl@casemapping@ii#1#2#3\@@{%
  \in@{#1#3}{<>}% i.e., if <u>, <l>, <t>
  \ifin@
    \edef\bbl@tempe{%
      \if#2u1 \else\if#2l2 \else\if#2t3 \fi\fi\fi}%
  \else
    \ifcase\bbl@tempe\relax
      \DeclareUppercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
      \DeclareLowercaseMapping[\bbl@templ]{\bbl@utftocode{#2}}{#1}%
    \or
      \DeclareUppercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
    \or
      \DeclareLowercaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
    \or
      \DeclareTitlecaseMapping[\bbl@templ]{\bbl@utftocode{#1}}{#2}%
    \fi
  \fi}
\def\bbl@localeinfo#1#2{%
  \bbl@ifunset{bbl@info@#2}{#1}%
    {\bbl@ifunset{bbl@\csname bbl@info@#2\endcsname @\languagename}{#1}%
      {\bbl@cs{\csname bbl@info@#2\endcsname @\languagename}}}}
\newcommand\localeinfo[1]{%
  \ifx*#1\@empty   % TODO. A bit hackish to make it expandable.
    \bbl@afterelse\bbl@localeinfo{}%
  \else
    \bbl@localeinfo
      {\bbl@error{no-ini-info}{}{}{}}%
      {#1}%
  \fi}
\@namedef{bbl@info@tag.ini}{lini}
\@namedef{bbl@info@name.english}{elname}
\@namedef{bbl@info@name.opentype}{lname}
\@namedef{bbl@info@tag.bcp47}{tbcp}
\@namedef{bbl@info@language.tag.bcp47}{lbcp}
\@namedef{bbl@info@tag.opentype}{lotf}
\@namedef{bbl@info@script.name}{esname}
\@namedef{bbl@info@script.name.opentype}{sname}
\@namedef{bbl@info@script.tag.bcp47}{sbcp}
\@namedef{bbl@info@script.tag.opentype}{sotf}
\@namedef{bbl@info@region.tag.bcp47}{rbcp}
\@namedef{bbl@info@variant.tag.bcp47}{vbcp}
\@namedef{bbl@info@extension.t.tag.bcp47}{extt}
\@namedef{bbl@info@extension.u.tag.bcp47}{extu}
\@namedef{bbl@info@extension.x.tag.bcp47}{extx}
\let\bbl@ensureinfo\@gobble
\newcommand\BabelEnsureInfo{%
  \ifx\InputIfFileExists\@undefined\else
    \def\bbl@ensureinfo##1{%
      \bbl@ifunset{bbl@lname@##1}{\bbl@load@info{##1}}{}}%
  \fi
  \bbl@foreach\bbl@loaded{{%
    \let\bbl@ensuring\@empty % Flag used in a couple of babel-*.tex files
    \def\languagename{##1}%
    \bbl@ensureinfo{##1}}}}
\@ifpackagewith{babel}{ensureinfo=off}{}%
  {\AtEndOfPackage{% Test for plain.
    \ifx\@undefined\bbl@loaded\else\BabelEnsureInfo\fi}}
\newcommand\getlocaleproperty{%
  \@ifstar\bbl@getproperty@s\bbl@getproperty@x}
\def\bbl@getproperty@s#1#2#3{%
  \let#1\relax
  \def\bbl@elt##1##2##3{%
    \bbl@ifsamestring{##1/##2}{#3}%
      {\providecommand#1{##3}%
       \def\bbl@elt####1####2####3{}}%
      {}}%
  \bbl@cs{inidata@#2}}%
\def\bbl@getproperty@x#1#2#3{%
  \bbl@getproperty@s{#1}{#2}{#3}%
  \ifx#1\relax
    \bbl@error{unknown-locale-key}{#1}{#2}{#3}%
  \fi}
\let\bbl@ini@loaded\@empty
\newcommand\LocaleForEach{\bbl@foreach\bbl@ini@loaded}
\def\ShowLocaleProperties#1{%
  \typeout{}%
  \typeout{*** Properties for language '#1' ***}
  \def\bbl@elt##1##2##3{\typeout{##1/##2 = ##3}}%
  \@nameuse{bbl@inidata@#1}%
  \typeout{*******}}
\newif\ifbbl@bcpallowed
\bbl@bcpallowedfalse
\def\bbl@autoload@options{import}
\def\bbl@provide@locale{%
  \ifx\babelprovide\@undefined
    \bbl@error{base-on-the-fly}{}{}{}%
  \fi
  \let\bbl@auxname\languagename % Still necessary.
  \bbl@ifunset{bbl@bcp@map@\languagename}{}% Move uplevel??
    {\edef\languagename{\@nameuse{bbl@bcp@map@\languagename}}}%
  \ifbbl@bcpallowed
    \expandafter\ifx\csname date\languagename\endcsname\relax
      \expandafter
      \bbl@bcplookup\languagename-\@empty-\@empty-\@empty\@@
      \ifx\bbl@bcp\relax\else  % Returned by \bbl@bcplookup
        \edef\languagename{\bbl@bcp@prefix\bbl@bcp}%
        \edef\localename{\bbl@bcp@prefix\bbl@bcp}%
        \expandafter\ifx\csname date\languagename\endcsname\relax
          \let\bbl@initoload\bbl@bcp
          \bbl@exp{\\\babelprovide[\bbl@autoload@bcpoptions]{\languagename}}%
          \let\bbl@initoload\relax
        \fi
        \bbl@csarg\xdef{bcp@map@\bbl@bcp}{\localename}%
      \fi
    \fi
  \fi
  \expandafter\ifx\csname date\languagename\endcsname\relax
    \IfFileExists{babel-\languagename.tex}%
      {\bbl@exp{\\\babelprovide[\bbl@autoload@options]{\languagename}}}%
      {}%
  \fi}
\providecommand\BCPdata{}
\ifx\renewcommand\@undefined\else % For plain. TODO. It’s a quick fix
  \renewcommand\BCPdata[1]{\bbl@bcpdata@i#1\@empty\@empty\@empty}
  \def\bbl@bcpdata@i#1#2#3#4#5#6\@empty{%
    \@nameuse{str_if_eq:nnTF}{#1#2#3#4#5}{main.}%
      {\bbl@bcpdata@ii{#6}\bbl@main@language}%
      {\bbl@bcpdata@ii{#1#2#3#4#5#6}\languagename}}%
  \def\bbl@bcpdata@ii#1#2{%
    \bbl@ifunset{bbl@info@#1.tag.bcp47}%
      {\bbl@error{unknown-ini-field}{#1}{}{}}%
      {\bbl@ifunset{bbl@\csname bbl@info@#1.tag.bcp47\endcsname @#2}{}%
        {\bbl@cs{\csname bbl@info@#1.tag.bcp47\endcsname @#2}}}}
\fi
\@namedef{bbl@info@casing.tag.bcp47}{casing}
\@namedef{bbl@info@tag.tag.bcp47}{tbcp} % For \BCPdata
\newcommand\babeladjust[1]{%  TODO. Error handling.
  \bbl@forkv{#1}{%
    \bbl@ifunset{bbl@ADJ@##1@##2}%
      {\bbl@cs{ADJ@##1}{##2}}%
      {\bbl@cs{ADJ@##1@##2}}}}
\def\bbl@adjust@lua#1#2{%
  \ifvmode
    \ifnum\currentgrouplevel=\z@
      \directlua{ Babel.#2 }%
      \expandafter\expandafter\expandafter\@gobble
    \fi
  \fi
  {\bbl@error{adjust-only-vertical}{#1}{}{}}}% Gobbled if everything went ok.
\@namedef{bbl@ADJ@bidi.mirroring@on}{%
  \bbl@adjust@lua{bidi}{mirroring_enabled=true}}
\@namedef{bbl@ADJ@bidi.mirroring@off}{%
  \bbl@adjust@lua{bidi}{mirroring_enabled=false}}
\@namedef{bbl@ADJ@bidi.text@on}{%
  \bbl@adjust@lua{bidi}{bidi_enabled=true}}
\@namedef{bbl@ADJ@bidi.text@off}{%
  \bbl@adjust@lua{bidi}{bidi_enabled=false}}
\@namedef{bbl@ADJ@bidi.math@on}{%
  \let\bbl@noamsmath\@empty}
\@namedef{bbl@ADJ@bidi.math@off}{%
  \let\bbl@noamsmath\relax}
\@namedef{bbl@ADJ@bidi.mapdigits@on}{%
  \bbl@adjust@lua{bidi}{digits_mapped=true}}
\@namedef{bbl@ADJ@bidi.mapdigits@off}{%
  \bbl@adjust@lua{bidi}{digits_mapped=false}}
\@namedef{bbl@ADJ@linebreak.sea@on}{%
  \bbl@adjust@lua{linebreak}{sea_enabled=true}}
\@namedef{bbl@ADJ@linebreak.sea@off}{%
  \bbl@adjust@lua{linebreak}{sea_enabled=false}}
\@namedef{bbl@ADJ@linebreak.cjk@on}{%
  \bbl@adjust@lua{linebreak}{cjk_enabled=true}}
\@namedef{bbl@ADJ@linebreak.cjk@off}{%
  \bbl@adjust@lua{linebreak}{cjk_enabled=false}}
\@namedef{bbl@ADJ@justify.arabic@on}{%
  \bbl@adjust@lua{linebreak}{arabic.justify_enabled=true}}
\@namedef{bbl@ADJ@justify.arabic@off}{%
  \bbl@adjust@lua{linebreak}{arabic.justify_enabled=false}}
\def\bbl@adjust@layout#1{%
  \ifvmode
    #1%
    \expandafter\@gobble
  \fi
  {\bbl@error{layout-only-vertical}{}{}{}}}% Gobbled if everything went ok.
\@namedef{bbl@ADJ@layout.tabular@on}{%
  \ifnum\bbl@tabular@mode=\tw@
    \bbl@adjust@layout{\let\@tabular\bbl@NL@@tabular}%
  \else
    \chardef\bbl@tabular@mode\@ne
  \fi}
\@namedef{bbl@ADJ@layout.tabular@off}{%
  \ifnum\bbl@tabular@mode=\tw@
    \bbl@adjust@layout{\let\@tabular\bbl@OL@@tabular}%
  \else
    \chardef\bbl@tabular@mode\z@
  \fi}
\@namedef{bbl@ADJ@layout.lists@on}{%
  \bbl@adjust@layout{\let\list\bbl@NL@list}}
\@namedef{bbl@ADJ@layout.lists@off}{%
  \bbl@adjust@layout{\let\list\bbl@OL@list}}
\@namedef{bbl@ADJ@autoload.bcp47@on}{%
  \bbl@bcpallowedtrue}
\@namedef{bbl@ADJ@autoload.bcp47@off}{%
  \bbl@bcpallowedfalse}
\@namedef{bbl@ADJ@autoload.bcp47.prefix}#1{%
  \def\bbl@bcp@prefix{#1}}
\def\bbl@bcp@prefix{bcp47-}
\@namedef{bbl@ADJ@autoload.options}#1{%
  \def\bbl@autoload@options{#1}}
\def\bbl@autoload@bcpoptions{import}
\@namedef{bbl@ADJ@autoload.bcp47.options}#1{%
  \def\bbl@autoload@bcpoptions{#1}}
\newif\ifbbl@bcptoname
\@namedef{bbl@ADJ@bcp47.toname@on}{%
  \bbl@bcptonametrue
  \BabelEnsureInfo}
\@namedef{bbl@ADJ@bcp47.toname@off}{%
  \bbl@bcptonamefalse}
\@namedef{bbl@ADJ@prehyphenation.disable@nohyphenation}{%
  \directlua{ Babel.ignore_pre_char = function(node)
      return (node.lang == \the\csname l@nohyphenation\endcsname)
    end }}
\@namedef{bbl@ADJ@prehyphenation.disable@off}{%
  \directlua{ Babel.ignore_pre_char = function(node)
      return false
    end }}
\@namedef{bbl@ADJ@interchar.disable@nohyphenation}{%
  \def\bbl@ignoreinterchar{%
    \ifnum\language=\l@nohyphenation
      \expandafter\@gobble
    \else
      \expandafter\@firstofone
    \fi}}
\@namedef{bbl@ADJ@interchar.disable@off}{%
  \let\bbl@ignoreinterchar\@firstofone}
\@namedef{bbl@ADJ@select.write@shift}{%
  \let\bbl@restorelastskip\relax
  \def\bbl@savelastskip{%
    \let\bbl@restorelastskip\relax
    \ifvmode
      \ifdim\lastskip=\z@
        \let\bbl@restorelastskip\nobreak
      \else
        \bbl@exp{%
          \def\\\bbl@restorelastskip{%
            \skip@=\the\lastskip
            \\\nobreak \vskip-\skip@ \vskip\skip@}}%
      \fi
    \fi}}
\@namedef{bbl@ADJ@select.write@keep}{%
  \let\bbl@restorelastskip\relax
  \let\bbl@savelastskip\relax}
\@namedef{bbl@ADJ@select.write@omit}{%
  \AddBabelHook{babel-select}{beforestart}{%
    \expandafter\babel@aux\expandafter{\bbl@main@language}{}}%
  \let\bbl@restorelastskip\relax
  \def\bbl@savelastskip##1\bbl@restorelastskip{}}
\@namedef{bbl@ADJ@select.encoding@off}{%
  \let\bbl@encoding@select@off\@empty}
\bbl@trace{Cross referencing macros}
\ifx\bbl@opt@safe\@empty\else % i.e., if 'ref' and/or 'bib'
  \def\@newl@bel#1#2#3{%
   {\@safe@activestrue
    \bbl@ifunset{#1@#2}%
       \relax
       {\gdef\@multiplelabels{%
          \@latex@warning@no@line{There were multiply-defined labels}}%
        \@latex@warning@no@line{Label `#2' multiply defined}}%
    \global\@namedef{#1@#2}{#3}}}
  \CheckCommand*\@testdef[3]{%
    \def\reserved@a{#3}%
    \expandafter\ifx\csname#1@#2\endcsname\reserved@a
    \else
      \@tempswatrue
    \fi}
  \def\@testdef#1#2#3{%  TODO. With @samestring?
    \@safe@activestrue
    \expandafter\let\expandafter\bbl@tempa\csname #1@#2\endcsname
    \def\bbl@tempb{#3}%
    \@safe@activesfalse
    \ifx\bbl@tempa\relax
    \else
      \edef\bbl@tempa{\expandafter\strip@prefix\meaning\bbl@tempa}%
    \fi
    \edef\bbl@tempb{\expandafter\strip@prefix\meaning\bbl@tempb}%
    \ifx\bbl@tempa\bbl@tempb
    \else
      \@tempswatrue
    \fi}
\fi
\bbl@xin@{R}\bbl@opt@safe
\ifin@
  \edef\bbl@tempc{\expandafter\string\csname ref code\endcsname}%
  \bbl@xin@{\expandafter\strip@prefix\meaning\bbl@tempc}%
    {\expandafter\strip@prefix\meaning\ref}%
  \ifin@
    \bbl@redefine\@kernel@ref#1{%
      \@safe@activestrue\org@@kernel@ref{#1}\@safe@activesfalse}
    \bbl@redefine\@kernel@pageref#1{%
      \@safe@activestrue\org@@kernel@pageref{#1}\@safe@activesfalse}
    \bbl@redefine\@kernel@sref#1{%
      \@safe@activestrue\org@@kernel@sref{#1}\@safe@activesfalse}
    \bbl@redefine\@kernel@spageref#1{%
      \@safe@activestrue\org@@kernel@spageref{#1}\@safe@activesfalse}
  \else
    \bbl@redefinerobust\ref#1{%
      \@safe@activestrue\org@ref{#1}\@safe@activesfalse}
    \bbl@redefinerobust\pageref#1{%
      \@safe@activestrue\org@pageref{#1}\@safe@activesfalse}
  \fi
\else
  \let\org@ref\ref
  \let\org@pageref\pageref
\fi
\bbl@xin@{B}\bbl@opt@safe
\ifin@
  \bbl@redefine\@citex[#1]#2{%
    \@safe@activestrue\edef\bbl@tempa{#2}\@safe@activesfalse
    \org@@citex[#1]{\bbl@tempa}}
  \AtBeginDocument{%
    \@ifpackageloaded{natbib}{%
    \def\@citex[#1][#2]#3{%
      \@safe@activestrue\edef\bbl@tempa{#3}\@safe@activesfalse
      \org@@citex[#1][#2]{\bbl@tempa}}%
    }{}}
  \AtBeginDocument{%
    \@ifpackageloaded{cite}{%
      \def\@citex[#1]#2{%
        \@safe@activestrue\org@@citex[#1]{#2}\@safe@activesfalse}%
      }{}}
  \bbl@redefine\nocite#1{%
    \@safe@activestrue\org@nocite{#1}\@safe@activesfalse}
  \bbl@redefine\bibcite{%
    \bbl@cite@choice
    \bibcite}
  \def\bbl@bibcite#1#2{%
    \org@bibcite{#1}{\@safe@activesfalse#2}}
  \def\bbl@cite@choice{%
    \global\let\bibcite\bbl@bibcite
    \@ifpackageloaded{natbib}{\global\let\bibcite\org@bibcite}{}%
    \@ifpackageloaded{cite}{\global\let\bibcite\org@bibcite}{}%
    \global\let\bbl@cite@choice\relax}
  \AtBeginDocument{\bbl@cite@choice}
  \bbl@redefine\@bibitem#1{%
    \@safe@activestrue\org@@bibitem{#1}\@safe@activesfalse}
\else
  \let\org@nocite\nocite
  \let\org@@citex\@citex
  \let\org@bibcite\bibcite
  \let\org@@bibitem\@bibitem
\fi
\newcommand\BabelPatchSection[1]{%
  \@ifundefined{#1}{}{%
    \bbl@exp{\let\<bbl@ss@#1>\<#1>}%
    \@namedef{#1}{%
      \@ifstar{\bbl@presec@s{#1}}%
              {\@dblarg{\bbl@presec@x{#1}}}}}}
\def\bbl@presec@x#1[#2]#3{%
  \bbl@exp{%
    \\\select@language@x{\bbl@main@language}%
    \\\bbl@cs{sspre@#1}%
    \\\bbl@cs{ss@#1}%
      [\\\foreignlanguage{\languagename}{\unexpanded{#2}}]%
      {\\\foreignlanguage{\languagename}{\unexpanded{#3}}}%
    \\\select@language@x{\languagename}}}
\def\bbl@presec@s#1#2{%
  \bbl@exp{%
    \\\select@language@x{\bbl@main@language}%
    \\\bbl@cs{sspre@#1}%
    \\\bbl@cs{ss@#1}*%
      {\\\foreignlanguage{\languagename}{\unexpanded{#2}}}%
    \\\select@language@x{\languagename}}}
\IfBabelLayout{sectioning}%
  {\BabelPatchSection{part}%
   \BabelPatchSection{chapter}%
   \BabelPatchSection{section}%
   \BabelPatchSection{subsection}%
   \BabelPatchSection{subsubsection}%
   \BabelPatchSection{paragraph}%
   \BabelPatchSection{subparagraph}%
   \def\babel@toc#1{%
     \select@language@x{\bbl@main@language}}}{}
\IfBabelLayout{captions}%
  {\BabelPatchSection{caption}}{}
\bbl@trace{Marks}
\IfBabelLayout{sectioning}
  {\ifx\bbl@opt@headfoot\@nnil
     \g@addto@macro\@resetactivechars{%
       \set@typeset@protect
       \expandafter\select@language@x\expandafter{\bbl@main@language}%
       \let\protect\noexpand
       \ifcase\bbl@bidimode\else % Only with bidi. See also above
         \edef\thepage{%
           \noexpand\babelsublr{\unexpanded\expandafter{\thepage}}}%
       \fi}%
   \fi}
  {\ifbbl@single\else
     \bbl@ifunset{markright }\bbl@redefine\bbl@redefinerobust
     \markright#1{%
       \bbl@ifblank{#1}%
         {\org@markright{}}%
         {\toks@{#1}%
          \bbl@exp{%
            \\\org@markright{\\\protect\\\foreignlanguage{\languagename}%
              {\\\protect\\\bbl@restore@actives\the\toks@}}}}}%
     \ifx\@mkboth\markboth
       \def\bbl@tempc{\let\@mkboth\markboth}%
     \else
       \def\bbl@tempc{}%
     \fi
     \bbl@ifunset{markboth }\bbl@redefine\bbl@redefinerobust
     \markboth#1#2{%
       \protected@edef\bbl@tempb##1{%
         \protect\foreignlanguage
         {\languagename}{\protect\bbl@restore@actives##1}}%
       \bbl@ifblank{#1}%
         {\toks@{}}%
         {\toks@\expandafter{\bbl@tempb{#1}}}%
       \bbl@ifblank{#2}%
         {\@temptokena{}}%
         {\@temptokena\expandafter{\bbl@tempb{#2}}}%
       \bbl@exp{\\\org@markboth{\the\toks@}{\the\@temptokena}}}%
       \bbl@tempc
     \fi}  % end ifbbl@single, end \IfBabelLayout
\bbl@trace{Preventing clashes with other packages}
\ifx\org@ref\@undefined\else
  \bbl@xin@{R}\bbl@opt@safe
  \ifin@
    \AtBeginDocument{%
      \@ifpackageloaded{ifthen}{%
        \bbl@redefine@long\ifthenelse#1#2#3{%
          \let\bbl@temp@pref\pageref
          \let\pageref\org@pageref
          \let\bbl@temp@ref\ref
          \let\ref\org@ref
          \@safe@activestrue
          \org@ifthenelse{#1}%
            {\let\pageref\bbl@temp@pref
             \let\ref\bbl@temp@ref
             \@safe@activesfalse
             #2}%
            {\let\pageref\bbl@temp@pref
             \let\ref\bbl@temp@ref
             \@safe@activesfalse
             #3}%
          }%
        }{}%
      }
\fi
  \AtBeginDocument{%
    \@ifpackageloaded{varioref}{%
      \bbl@redefine\@@vpageref#1[#2]#3{%
        \@safe@activestrue
        \org@@@vpageref{#1}[#2]{#3}%
        \@safe@activesfalse}%
      \bbl@redefine\vrefpagenum#1#2{%
        \@safe@activestrue
        \org@vrefpagenum{#1}{#2}%
        \@safe@activesfalse}%
      \expandafter\def\csname Ref \endcsname#1{%
        \protected@edef\@tempa{\org@ref{#1}}\expandafter\MakeUppercase\@tempa}
      }{}%
    }
\fi
\AtEndOfPackage{%
  \AtBeginDocument{%
    \@ifpackageloaded{hhline}%
      {\expandafter\ifx\csname normal@char\string:\endcsname\relax
       \else
         \makeatletter
         \def\@currname{hhline}\input{hhline.sty}\makeatother
       \fi}%
      {}}}
\def\substitutefontfamily#1#2#3{%
  \lowercase{\immediate\openout15=#1#2.fd\relax}%
  \immediate\write15{%
    \string\ProvidesFile{#1#2.fd}%
    [\the\year/\two@digits{\the\month}/\two@digits{\the\day}
     \space generated font description file]^^J
    \string\DeclareFontFamily{#1}{#2}{}^^J
    \string\DeclareFontShape{#1}{#2}{m}{n}{<->ssub * #3/m/n}{}^^J
    \string\DeclareFontShape{#1}{#2}{m}{it}{<->ssub * #3/m/it}{}^^J
    \string\DeclareFontShape{#1}{#2}{m}{sl}{<->ssub * #3/m/sl}{}^^J
    \string\DeclareFontShape{#1}{#2}{m}{sc}{<->ssub * #3/m/sc}{}^^J
    \string\DeclareFontShape{#1}{#2}{b}{n}{<->ssub * #3/bx/n}{}^^J
    \string\DeclareFontShape{#1}{#2}{b}{it}{<->ssub * #3/bx/it}{}^^J
    \string\DeclareFontShape{#1}{#2}{b}{sl}{<->ssub * #3/bx/sl}{}^^J
    \string\DeclareFontShape{#1}{#2}{b}{sc}{<->ssub * #3/bx/sc}{}^^J
    }%
  \closeout15
  }
\@onlypreamble\substitutefontfamily
\bbl@trace{Encoding and fonts}
\newcommand\BabelNonASCII{LGR,LGI,X2,OT2,OT3,OT6,LHE,LWN,LMA,LMC,LMS,LMU}
\newcommand\BabelNonText{TS1,T3,TS3}
\let\org@TeX\TeX
\let\org@LaTeX\LaTeX
\let\ensureascii\@firstofone
\let\asciiencoding\@empty
\AtBeginDocument{%
  \def\@elt#1{,#1,}%
  \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
  \let\@elt\relax
  \let\bbl@tempb\@empty
  \def\bbl@tempc{OT1}%
  \bbl@foreach\BabelNonASCII{% LGR loaded in a non-standard way
    \bbl@ifunset{T@#1}{}{\def\bbl@tempb{#1}}}%
  \bbl@foreach\bbl@tempa{%
    \bbl@xin@{,#1,}{,\BabelNonASCII,}%
    \ifin@
      \def\bbl@tempb{#1}% Store last non-ascii
    \else\bbl@xin@{,#1,}{,\BabelNonText,}% Pass
      \ifin@\else
        \def\bbl@tempc{#1}% Store last ascii
      \fi
    \fi}%
  \ifx\bbl@tempb\@empty\else
    \bbl@xin@{,\cf@encoding,}{,\BabelNonASCII,\BabelNonText,}%
    \ifin@\else
      \edef\bbl@tempc{\cf@encoding}% The default if ascii wins
    \fi
    \let\asciiencoding\bbl@tempc
    \renewcommand\ensureascii[1]{%
      {\fontencoding{\asciiencoding}\selectfont#1}}%
    \DeclareTextCommandDefault{\TeX}{\ensureascii{\org@TeX}}%
    \DeclareTextCommandDefault{\LaTeX}{\ensureascii{\org@LaTeX}}%
  \fi}
\AtEndOfPackage{\edef\latinencoding{\cf@encoding}}
\AtBeginDocument{%
  \@ifpackageloaded{fontspec}%
    {\xdef\latinencoding{%
       \ifx\UTFencname\@undefined
         EU\ifcase\bbl@engine\or2\or1\fi
       \else
         \UTFencname
       \fi}}%
    {\gdef\latinencoding{OT1}%
     \ifx\cf@encoding\bbl@t@one
       \xdef\latinencoding{\bbl@t@one}%
     \else
       \def\@elt#1{,#1,}%
       \edef\bbl@tempa{\expandafter\@gobbletwo\@fontenc@load@list}%
       \let\@elt\relax
       \bbl@xin@{,T1,}\bbl@tempa
       \ifin@
         \xdef\latinencoding{\bbl@t@one}%
       \fi
     \fi}}
\DeclareRobustCommand{\latintext}{%
  \fontencoding{\latinencoding}\selectfont
  \def\encodingdefault{\latinencoding}}
\ifx\@undefined\DeclareTextFontCommand
  \DeclareRobustCommand{\textlatin}[1]{\leavevmode{\latintext #1}}
\else
  \DeclareTextFontCommand{\textlatin}{\latintext}
\fi
\def\bbl@patchfont#1{\AddToHook{selectfont}{#1}}
\bbl@trace{Loading basic (internal) bidi support}
\ifodd\bbl@engine
\else % TODO. Move to txtbabel. Any xe+lua bidi
  \ifnum\bbl@bidimode>100 \ifnum\bbl@bidimode<200
    \bbl@error{bidi-only-lua}{}{}{}%
    \let\bbl@beforeforeign\leavevmode
    \AtEndOfPackage{%
      \EnableBabelHook{babel-bidi}%
      \bbl@xebidipar}
  \fi\fi
  \def\bbl@loadxebidi#1{%
    \ifx\RTLfootnotetext\@undefined
      \AtEndOfPackage{%
        \EnableBabelHook{babel-bidi}%
        \ifx\fontspec\@undefined
          \usepackage{fontspec}% bidi needs fontspec
        \fi
        \usepackage#1{bidi}%
        \let\bbl@digitsdotdash\DigitsDotDashInterCharToks
        \def\DigitsDotDashInterCharToks{% See the 'bidi' package
          \ifnum\@nameuse{bbl@wdir@\languagename}=\tw@ % 'AL' bidi
            \bbl@digitsdotdash % So ignore in 'R' bidi
          \fi}}%
    \fi}
  \ifnum\bbl@bidimode>200 % Any xe bidi=
    \ifcase\expandafter\@gobbletwo\the\bbl@bidimode\or
      \bbl@tentative{bidi=bidi}
      \bbl@loadxebidi{}
    \or
      \bbl@loadxebidi{[rldocument]}
    \or
      \bbl@loadxebidi{}
    \fi
  \fi
\fi
\ifnum\bbl@bidimode=\@ne % bidi=default
  \let\bbl@beforeforeign\leavevmode
  \ifodd\bbl@engine % lua
    \newattribute\bbl@attr@dir
    \directlua{ Babel.attr_dir = luatexbase.registernumber'bbl@attr@dir' }
    \bbl@exp{\output{\bodydir\pagedir\the\output}}
  \fi
  \AtEndOfPackage{%
    \EnableBabelHook{babel-bidi}% pdf/lua/xe
    \ifodd\bbl@engine\else % pdf/xe
      \bbl@xebidipar
    \fi}
\fi
\bbl@trace{Macros to switch the text direction}
\def\bbl@alscripts{%
  ,Arabic,Syriac,Thaana,Hanifi Rohingya,Hanifi,Sogdian,}
\def\bbl@rscripts{%
  Adlam,Avestan,Chorasmian,Cypriot,Elymaic,Garay,%
  Hatran,Hebrew,Imperial Aramaic,Inscriptional Pahlavi,%
  Inscriptional Parthian,Kharoshthi,Lydian,Mandaic,Manichaean,%
  Mende Kikakui,Meroitic Cursive,Meroitic Hieroglyphs,Nabataean,%
  Nko,Old Hungarian,Old North Arabian,Old Sogdian,%
  Old South Arabian,Old Turkic,Old Uyghur,Palmyrene,Phoenician,%
  Psalter Pahlavi,Samaritan,Yezidi,Mandaean,%
  Meroitic,N'Ko,Orkhon,Todhri}
\def\bbl@provide@dirs#1{%
  \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts\bbl@rscripts}%
  \ifin@
    \global\bbl@csarg\chardef{wdir@#1}\@ne
    \bbl@xin@{\csname bbl@sname@#1\endcsname}{\bbl@alscripts}%
    \ifin@
      \global\bbl@csarg\chardef{wdir@#1}\tw@
    \fi
  \else
    \global\bbl@csarg\chardef{wdir@#1}\z@
  \fi
  \ifodd\bbl@engine
    \bbl@csarg\ifcase{wdir@#1}%
      \directlua{ Babel.locale_props[\the\localeid].textdir = 'l' }%
    \or
      \directlua{ Babel.locale_props[\the\localeid].textdir = 'r' }%
    \or
      \directlua{ Babel.locale_props[\the\localeid].textdir = 'al' }%
    \fi
  \fi}
\def\bbl@switchdir{%
  \bbl@ifunset{bbl@lsys@\languagename}{\bbl@provide@lsys{\languagename}}{}%
  \bbl@ifunset{bbl@wdir@\languagename}{\bbl@provide@dirs{\languagename}}{}%
  \bbl@exp{\\\bbl@setdirs\bbl@cl{wdir}}}
\def\bbl@setdirs#1{% TODO - math
  \ifcase\bbl@select@type % TODO - strictly, not the right test
    \bbl@bodydir{#1}%
    \bbl@pardir{#1}% <- Must precede \bbl@textdir
  \fi
  \bbl@textdir{#1}}
\ifnum\bbl@bidimode>\z@
  \AddBabelHook{babel-bidi}{afterextras}{\bbl@switchdir}
  \DisableBabelHook{babel-bidi}
\fi
\ifodd\bbl@engine  % luatex=1
\else % pdftex=0, xetex=2
  \newcount\bbl@dirlevel
  \chardef\bbl@thetextdir\z@
  \chardef\bbl@thepardir\z@
  \def\bbl@textdir#1{%
    \ifcase#1\relax
       \chardef\bbl@thetextdir\z@
       \@nameuse{setlatin}%
       \bbl@textdir@i\beginL\endL
     \else
       \chardef\bbl@thetextdir\@ne
       \@nameuse{setnonlatin}%
       \bbl@textdir@i\beginR\endR
    \fi}
  \def\bbl@textdir@i#1#2{%
    \ifhmode
      \ifnum\currentgrouplevel>\z@
        \ifnum\currentgrouplevel=\bbl@dirlevel
          \bbl@error{multiple-bidi}{}{}{}%
          \bgroup\aftergroup#2\aftergroup\egroup
        \else
          \ifcase\currentgrouptype\or % 0 bottom
            \aftergroup#2% 1 simple {}
          \or
            \bgroup\aftergroup#2\aftergroup\egroup % 2 hbox
          \or
            \bgroup\aftergroup#2\aftergroup\egroup % 3 adj hbox
          \or\or\or % vbox vtop align
          \or
            \bgroup\aftergroup#2\aftergroup\egroup % 7 noalign
          \or\or\or\or\or\or % output math disc insert vcent mathchoice
          \or
            \aftergroup#2% 14 \begingroup
          \else
            \bgroup\aftergroup#2\aftergroup\egroup % 15 adj
          \fi
        \fi
        \bbl@dirlevel\currentgrouplevel
      \fi
      #1%
    \fi}
  \def\bbl@pardir#1{\chardef\bbl@thepardir#1\relax}
  \let\bbl@bodydir\@gobble
  \let\bbl@pagedir\@gobble
  \def\bbl@dirparastext{\chardef\bbl@thepardir\bbl@thetextdir}
  \def\bbl@xebidipar{%
    \let\bbl@xebidipar\relax
    \TeXXeTstate\@ne
    \def\bbl@xeeverypar{%
      \ifcase\bbl@thepardir
        \ifcase\bbl@thetextdir\else\beginR\fi
      \else
        {\setbox\z@\lastbox\beginR\box\z@}%
      \fi}%
    \AddToHook{para/begin}{\bbl@xeeverypar}}
  \ifnum\bbl@bidimode>200 % Any xe bidi=
    \let\bbl@textdir@i\@gobbletwo
    \let\bbl@xebidipar\@empty
    \AddBabelHook{bidi}{foreign}{%
      \ifcase\bbl@thetextdir
        \BabelWrapText{\LR{##1}}%
      \else
        \BabelWrapText{\RL{##1}}%
      \fi}
    \def\bbl@pardir#1{\ifcase#1\relax\setLR\else\setRL\fi}
  \fi
\fi
\DeclareRobustCommand\babelsublr[1]{\leavevmode{\bbl@textdir\z@#1}}
\AtBeginDocument{%
  \ifx\pdfstringdefDisableCommands\@undefined\else
    \ifx\pdfstringdefDisableCommands\relax\else
      \pdfstringdefDisableCommands{\let\babelsublr\@firstofone}%
    \fi
  \fi}
\bbl@trace{Local Language Configuration}
\ifx\loadlocalcfg\@undefined
  \@ifpackagewith{babel}{noconfigs}%
    {\let\loadlocalcfg\@gobble}%
    {\def\loadlocalcfg#1{%
      \InputIfFileExists{#1.cfg}%
        {\typeout{*************************************^^J%
                       * Local config file #1.cfg used^^J%
                       *}}%
        \@empty}}
\fi
\bbl@trace{Language options}
\let\bbl@afterlang\relax
\let\BabelModifiers\relax
\let\bbl@loaded\@empty
\def\bbl@load@language#1{%
  \InputIfFileExists{#1.ldf}%
    {\edef\bbl@loaded{\CurrentOption
       \ifx\bbl@loaded\@empty\else,\bbl@loaded\fi}%
     \expandafter\let\expandafter\bbl@afterlang
        \csname\CurrentOption.ldf-h@@k\endcsname
     \expandafter\let\expandafter\BabelModifiers
        \csname bbl@mod@\CurrentOption\endcsname
     \bbl@exp{\\\AtBeginDocument{%
       \\\bbl@usehooks@lang{\CurrentOption}{begindocument}{{\CurrentOption}}}}}%
    {\IfFileExists{babel-#1.tex}%
      {\def\bbl@tempa{%
         .\\There is a locale ini file for this language.\\%
         If it’s the main language, try adding `provide=*'\\%
         to the babel package options}}%
      {\let\bbl@tempa\empty}%
     \bbl@error{unknown-package-option}{}{}{}}}
\def\bbl@try@load@lang#1#2#3{%
  \IfFileExists{\CurrentOption.ldf}%
    {\bbl@load@language{\CurrentOption}}%
    {#1\bbl@load@language{#2}#3}}
\DeclareOption{friulian}{\bbl@try@load@lang{}{friulan}{}}
\DeclareOption{hebrew}{%
  \ifcase\bbl@engine\or
    \bbl@error{only-pdftex-lang}{hebrew}{luatex}{}%
  \fi
  \input{rlbabel.def}%
  \bbl@load@language{hebrew}}
\DeclareOption{hungarian}{\bbl@try@load@lang{}{magyar}{}}
\DeclareOption{lowersorbian}{\bbl@try@load@lang{}{lsorbian}{}}
\DeclareOption{polutonikogreek}{%
  \bbl@try@load@lang{}{greek}{\languageattribute{greek}{polutoniko}}}
\DeclareOption{russian}{\bbl@try@load@lang{}{russianb}{}}
\DeclareOption{ukrainian}{\bbl@try@load@lang{}{ukraineb}{}}
\DeclareOption{uppersorbian}{\bbl@try@load@lang{}{usorbian}{}}
\ifx\bbl@opt@config\@nnil
  \@ifpackagewith{babel}{noconfigs}{}%
    {\InputIfFileExists{bblopts.cfg}%
      {\typeout{*************************************^^J%
               * Local config file bblopts.cfg used^^J%
               *}}%
      {}}%
\else
  \InputIfFileExists{\bbl@opt@config.cfg}%
    {\typeout{*************************************^^J%
             * Local config file \bbl@opt@config.cfg used^^J%
             *}}%
    {\bbl@error{config-not-found}{}{}{}}%
\fi
\def\bbl@tempf{,}
\bbl@foreach\@raw@classoptionslist{%
  \in@{=}{#1}%
  \ifin@\else
    \edef\bbl@tempf{\bbl@tempf\zap@space#1 \@empty,}%
  \fi}
\ifx\bbl@opt@main\@nnil
  \ifnum\bbl@iniflag>\z@  % if all ldf's: set implicitly, no main pass
    \let\bbl@tempb\@empty
    \edef\bbl@tempa{\bbl@tempf,\bbl@language@opts}%
    \bbl@foreach\bbl@tempa{\edef\bbl@tempb{#1,\bbl@tempb}}%
    \bbl@foreach\bbl@tempb{%    \bbl@tempb is a reversed list
      \ifx\bbl@opt@main\@nnil % i.e., if not yet assigned
        \ifodd\bbl@iniflag % = *=
          \IfFileExists{babel-#1.tex}{\def\bbl@opt@main{#1}}{}%
        \else % n +=
          \IfFileExists{#1.ldf}{\def\bbl@opt@main{#1}}{}%
        \fi
      \fi}%
  \fi
\else
  \bbl@info{Main language set with 'main='. Except if you have\\%
            problems, prefer the default mechanism for setting\\%
            the main language, i.e., as the last declared.\\%
            Reported}
\fi
\ifx\bbl@opt@main\@nnil\else
  \bbl@ncarg\let\bbl@loadmain{ds@\bbl@opt@main}%
  \expandafter\let\csname ds@\bbl@opt@main\endcsname\relax
\fi
\bbl@foreach\bbl@language@opts{%
  \def\bbl@tempa{#1}%
  \ifx\bbl@tempa\bbl@opt@main\else
    \ifnum\bbl@iniflag<\tw@    % 0 ø (other = ldf)
      \bbl@ifunset{ds@#1}%
        {\DeclareOption{#1}{\bbl@load@language{#1}}}%
        {}%
    \else                      % + * (other = ini)
      \DeclareOption{#1}{%
        \bbl@ldfinit
        \babelprovide[@import]{#1}% %%%%%
        \bbl@afterldf{}}%
    \fi
  \fi}
\bbl@foreach\bbl@tempf{%
  \def\bbl@tempa{#1}%
  \ifx\bbl@tempa\bbl@opt@main\else
    \ifnum\bbl@iniflag<\tw@    % 0 ø (other = ldf)
      \bbl@ifunset{ds@#1}%
        {\IfFileExists{#1.ldf}%
          {\DeclareOption{#1}{\bbl@load@language{#1}}}%
          {}}%
        {}%
     \else                      % + * (other = ini)
       \IfFileExists{babel-#1.tex}%
         {\DeclareOption{#1}{%
            \bbl@ldfinit
            \babelprovide[@import]{#1}%  %%%%%%
            \bbl@afterldf{}}}%
         {}%
     \fi
  \fi}
\NewHook{babel/presets}
\UseHook{babel/presets}
\def\AfterBabelLanguage#1{%
  \bbl@ifsamestring\CurrentOption{#1}{\global\bbl@add\bbl@afterlang}{}}
\DeclareOption*{}
\ProcessOptions*
\bbl@trace{Option 'main'}
\ifx\bbl@opt@main\@nnil
  \edef\bbl@tempa{\bbl@tempf,\bbl@language@opts}
  \let\bbl@tempc\@empty
  \edef\bbl@templ{,\bbl@loaded,}
  \edef\bbl@templ{\expandafter\strip@prefix\meaning\bbl@templ}
  \bbl@for\bbl@tempb\bbl@tempa{%
    \edef\bbl@tempd{,\bbl@tempb,}%
    \edef\bbl@tempd{\expandafter\strip@prefix\meaning\bbl@tempd}%
    \bbl@xin@{\bbl@tempd}{\bbl@templ}%
    \ifin@\edef\bbl@tempc{\bbl@tempb}\fi}
  \def\bbl@tempa#1,#2\@nnil{\def\bbl@tempb{#1}}
  \expandafter\bbl@tempa\bbl@loaded,\@nnil
  \ifx\bbl@tempb\bbl@tempc\else
    \bbl@warning{%
      Last declared language option is '\bbl@tempc',\\%
      but the last processed one was '\bbl@tempb'.\\%
      The main language can't be set as both a global\\%
      and a package option. Use 'main=\bbl@tempc' as\\%
      option. Reported}
  \fi
\else
  \ifodd\bbl@iniflag  % case 1,3 (main is ini)
    \bbl@ldfinit
    \let\CurrentOption\bbl@opt@main
    \bbl@exp{%  \bbl@opt@provide = empty if *
       \\\babelprovide
         [\bbl@opt@provide,@import,main]%  %%%%%
         {\bbl@opt@main}}%
    \bbl@afterldf{}
    \DeclareOption{\bbl@opt@main}{}
  \else % case 0,2 (main is ldf)
    \ifx\bbl@loadmain\relax
      \DeclareOption{\bbl@opt@main}{\bbl@load@language{\bbl@opt@main}}
    \else
      \DeclareOption{\bbl@opt@main}{\bbl@loadmain}
    \fi
    \ExecuteOptions{\bbl@opt@main}
    \@namedef{ds@\bbl@opt@main}{}%
  \fi
  \DeclareOption*{}
  \ProcessOptions*
\fi
\bbl@exp{%
  \\\AtBeginDocument{\\\bbl@usehooks@lang{/}{begindocument}{{}}}}%
\def\AfterBabelLanguage{\bbl@error{late-after-babel}{}{}{}}
\ifx\bbl@main@language\@undefined
  \bbl@info{%
    You haven't specified a language as a class or package\\%
    option. I'll load 'nil'. Reported}
    \bbl@load@language{nil}
\fi
\endinput
%%
%% End of file `babel.sty'.
