%%
%% This is file `bookmark.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bookmark.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Project: bookmark
%% Version: 2023-12-10 v1.31
%% 
%% Copyright (C)
%%    2007-2011 Heiko Oberdiek
%%    2016-2023 Oberdiek Package Support Group
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    https://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainers of this work are
%% Heiko Oberdiek and the Oberdiek Package Support Group
%% https://github.com/ho-tex/bookmark/issues
%% 
%% This file is part of the "bookmark bundle" (The Work in LPPL)
%%  and all files in that bundle must be distributed together.
%% 
%%  The released version of this bundle is available from CTAN.
%% 
%%  This work consists of the main source files bookmark.dtx
%%  and bookmark.ins and the derived files
%%     bookmark.sty, bookmark.pdf,
%%     bkm-dvipdfm.def, bkm-dvips.def, bkm-pdftex.def, bkm-vtex.def,
%%     bookmark-example.tex.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bookmark}%
  [2023-12-10 v1.31 PDF bookmarks (HO)]%
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname numexpr\endcsname\relax
  \def\BKM@CalcExpr#1#2#3#4{%
    \begingroup
      \count@=#2\relax
      \advance\count@ by#3#4\relax
      \edef\x{\endgroup
        \def\noexpand#1{\the\count@}%
      }%
    \x
  }%
\else
  \def\BKM@CalcExpr#1#2#3#4{%
    \edef#1{%
      \the\numexpr#2#3#4\relax
    }%
  }%
\fi
\def\BKM@EscapeName#1{%
  \ifx#1\@empty
  \else
    \EdefEscapeName#1#1%
  \fi
}%
\def\BKM@EscapeString#1{%
  \ifx#1\@empty
  \else
    \EdefEscapeString#1#1%
  \fi
}%
\def\BKM@EscapeHex#1{%
  \ifx#1\@empty
  \else
    \EdefEscapeHex#1#1%
  \fi
}%
\def\BKM@UnescapeHex#1{%
  \EdefUnescapeHex#1#1%
}%
\ExplSyntaxOn
\let\BKM@LocalAppendToMacro\tl_put_right:Nn
\let\BKM@GlobalAppendToMacro\tl_gput_right:Nn
\ExplSyntaxOff
\def\BKM@space{ }
\long\def\BKM@ReturnAfterFi#1\fi{\fi#1}
\RequirePackage{hyperref}[2010/06/18]
\SetupKeyvalOptions{family=BKM,prefix=BKM@}
\DeclareLocalOptions{%
  atend,%
  bold,%
  color,%
  depth,%
  dest,%
  draft,%
  final,%
  gotor,%
  italic,%
  keeplevel,%
  level,%
  named,%
  numbered,%
  open,%
  openlevel,%
  page,%
  rawaction,%
  rellevel,%
  srcfile,%
  srcline,%
  startatroot,%
  uri,%
  view,%
}
\newcommand*{\bookmarksetup}{\kvsetkeys{BKM}}
\def\BKM@setup#1{%
  \bookmarksetup{#1}%
  \ifx\BKM@HookNext\@empty
  \else
    \expandafter\bookmarksetup\expandafter{\BKM@HookNext}%
    \BKM@HookNextClear
  \fi
  \BKM@hook
  \ifBKM@keeplevel
  \else
    \xdef\BKM@currentlevel{\BKM@level}%
  \fi
}
\newcommand*{\bookmarksetupnext}[1]{%
  \BKM@GlobalAppendToMacro\BKM@HookNext{,#1}%
}
\def\BKM@HookNextClear{%
  \global\let\BKM@HookNext\@empty
}
\BKM@HookNextClear
\DeclareBoolOption{draft}
\DeclareComplementaryOption{final}{draft}
\def\BKM@DisableOptions{%
  \DisableKeyvalOption[action=warning,package=bookmark]%
      {BKM}{draft}%
  \DisableKeyvalOption[action=warning,package=bookmark]%
      {BKM}{final}%
}
\DeclareBoolOption[\ifHy@bookmarksopen true\else false\fi]{open}
\def\bookmark@open{%
  \ifBKM@open\@ne\else\z@\fi
}
\DeclareStringOption[\maxdimen]{openlevel}
\edef\BKM@openlevel{\number\@bookmarksopenlevel}
\@ifundefined{Hy@bookmarksdepth}{%
  \def\BKM@depth{\c@tocdepth}%
}{%
  \let\BKM@depth\Hy@bookmarksdepth
}
\define@key{BKM}{depth}[]{%
  \edef\BKM@param{#1}%
  \ifx\BKM@param\@empty
    \def\BKM@depth{\c@tocdepth}%
  \else
    \@ifundefined{toclevel@\BKM@param}{%
      \@onelevel@sanitize\BKM@param
      \edef\BKM@temp{\expandafter\@car\BKM@param\@nil}%
      \ifcase 0\expandafter\ifx\BKM@temp-1\fi
              \expandafter\ifnum\expandafter`\BKM@temp>47 %
                \expandafter\ifnum\expandafter`\BKM@temp<58 %
                  1%
                \fi
              \fi
              \relax
        \PackageWarning{bookmark}{%
          Unknown document division name (\BKM@param)\MessageBreak
          for option `depth'%
        }%
      \else
        \BKM@SetDepthOrLevel\BKM@depth\BKM@param
      \fi
    }{%
      \BKM@SetDepthOrLevel\BKM@depth{%
        \csname toclevel@\BKM@param\endcsname
      }%
    }%
  \fi
}
\def\bookmark@depth{\BKM@depth}
\def\BKM@SetDepthOrLevel#1#2{%
  \begingroup
    \setbox\z@=\hbox{%
      \count@=#2\relax
      \expandafter
    }%
  \expandafter\endgroup
  \expandafter\def\expandafter#1\expandafter{\the\count@}%
}
\DeclareStringOption[\BKM@currentlevel]{level}[\BKM@currentlevel]
\define@key{BKM}{level}{%
  \edef\BKM@param{#1}%
  \ifx\BKM@param\BKM@MacroCurrentLevel
    \let\BKM@level\BKM@param
  \else
    \@ifundefined{toclevel@\BKM@param}{%
      \@onelevel@sanitize\BKM@param
      \edef\BKM@temp{\expandafter\@car\BKM@param\@nil}%
      \ifcase 0\expandafter\ifx\BKM@temp-1\fi
              \expandafter\ifnum\expandafter`\BKM@temp>47 %
                \expandafter\ifnum\expandafter`\BKM@temp<58 %
                  1%
                \fi
              \fi
              \relax
        \PackageWarning{bookmark}{%
          Unknown document division name (\BKM@param)\MessageBreak
          for option `level'%
        }%
      \else
        \BKM@SetDepthOrLevel\BKM@level\BKM@param
      \fi
    }{%
      \BKM@SetDepthOrLevel\BKM@level{%
        \csname toclevel@\BKM@param\endcsname
      }%
    }%
  \fi
}
\def\BKM@MacroCurrentLevel{\BKM@currentlevel}
\DeclareBoolOption{keeplevel}
\DeclareBoolOption{startatroot}
\def\BKM@startatrootfalse{%
  \global\let\ifBKM@startatroot\iffalse
}
\def\BKM@startatroottrue{%
  \global\let\ifBKM@startatroot\iftrue
}
\define@key{BKM}{rellevel}{%
  \BKM@CalcExpr\BKM@level{#1}+\BKM@currentlevel
}
\def\bookmark@level{\BKM@level}
\def\BKM@currentlevel{0}
\DeclareBoolOption[%
  \ifHy@bookmarksnumbered true\else false\fi
]{numbered}
\g@addto@macro\BKM@numberedtrue{%
  \let\ifHy@bookmarksnumbered\iftrue
}
\g@addto@macro\BKM@numberedfalse{%
  \let\ifHy@bookmarksnumbered\iffalse
}
\g@addto@macro\Hy@bookmarksnumberedtrue{%
  \let\ifBKM@numbered\iftrue
}
\g@addto@macro\Hy@bookmarksnumberedfalse{%
  \let\ifBKM@numbered\iffalse
}
\def\bookmark@numbered{%
  \ifBKM@numbered\@ne\else\z@\fi
}
\def\BKM@PatchHyperrefOption#1{%
  \expandafter\BKM@@PatchHyperrefOption\csname KV@Hyp@#1\endcsname%
}
\def\BKM@@PatchHyperrefOption#1{%
  \expandafter\BKM@@@PatchHyperrefOption#1{##1}\BKM@nil#1%
}
\def\BKM@@@PatchHyperrefOption#1\BKM@nil#2#3{%
  \def#2##1{%
    #1%
    \bookmarksetup{#3={##1}}%
  }%
}
\BKM@PatchHyperrefOption{bookmarksopen}{open}
\BKM@PatchHyperrefOption{bookmarksopenlevel}{openlevel}
\BKM@PatchHyperrefOption{bookmarksdepth}{depth}
\bitsetReset{BKM@FontStyle}%
\define@key{BKM}{italic}[true]{%
  \expandafter\ifx\csname if#1\endcsname\iftrue
    \bitsetSet{BKM@FontStyle}{0}%
  \else
    \bitsetClear{BKM@FontStyle}{0}%
  \fi
}%
\define@key{BKM}{bold}[true]{%
  \expandafter\ifx\csname if#1\endcsname\iftrue
    \bitsetSet{BKM@FontStyle}{1}%
  \else
    \bitsetClear{BKM@FontStyle}{1}%
  \fi
}%
\def\bookmark@italic{%
  \ifnum\bitsetGet{BKM@FontStyle}{0}=1 \@ne\else\z@\fi
}
\def\bookmark@bold{%
  \ifnum\bitsetGet{BKM@FontStyle}{1}=1 \@ne\else\z@\fi
}
\def\BKM@PrintStyle{%
  \bitsetGetDec{BKM@FontStyle}%
}%
\define@key{BKM}{color}{%
  \HyColor@BookmarkColor{#1}\BKM@color{bookmark}{color}%
}
\let\BKM@color\@empty
\def\bookmark@color{\BKM@color}
\def\BKM@temp#1{%
  \DeclareStringOption{#1}%
  \expandafter\edef\csname bookmark@#1\endcsname{%
    \expandafter\noexpand\csname BKM@#1\endcsname
  }%
}
\BKM@temp{dest}
\BKM@temp{named}
\BKM@temp{uri}
\BKM@temp{gotor}
\BKM@temp{rawaction}
\define@key{BKM}{page}{%
  \def\BKM@page{#1}%
  \ifx\BKM@page\@empty
  \else
    \edef\BKM@page{\number\BKM@page}%
    \ifnum\BKM@page>\z@
    \else
      \PackageError{bookmark}{Page must be positive}\@ehc
      \def\BKM@page{1}%
    \fi
  \fi
}
\let\BKM@page\@empty
\def\bookmark@page{\BKM@@page}
\define@key{BKM}{view}{%
  \BKM@CheckView{#1}%
}
\let\BKM@view\@empty
\def\bookmark@view{\BKM@view}
\def\BKM@CheckView#1{%
  \BKM@CheckViewType#1 \@nil
}
\def\BKM@CheckViewType#1 #2\@nil{%
  \def\BKM@type{#1}%
  \@onelevel@sanitize\BKM@type
  \BKM@TestViewType{Fit}{}%
  \BKM@TestViewType{FitB}{}%
  \BKM@TestViewType{FitH}{%
    \BKM@CheckParam#2 \@nil{top}%
  }%
  \BKM@TestViewType{FitBH}{%
    \BKM@CheckParam#2 \@nil{top}%
  }%
  \BKM@TestViewType{FitV}{%
    \BKM@CheckParam#2 \@nil{bottom}%
  }%
  \BKM@TestViewType{FitBV}{%
    \BKM@CheckParam#2 \@nil{bottom}%
  }%
  \BKM@TestViewType{FitR}{%
    \BKM@CheckRect{#2}{ }%
  }%
  \BKM@TestViewType{XYZ}{%
    \BKM@CheckXYZ{#2}{ }%
  }%
  \@car{%
    \PackageError{bookmark}{%
      Unknown view type `\BKM@type',\MessageBreak
      using `FitH' instead%
    }\@ehc
    \def\BKM@view{FitH}%
  }%
  \@nil
}
\def\BKM@TestViewType#1{%
  \def\BKM@temp{#1}%
  \@onelevel@sanitize\BKM@temp
  \ifx\BKM@type\BKM@temp
    \let\BKM@view\BKM@temp
    \expandafter\@car
  \else
    \expandafter\@gobble
  \fi
}
\def\BKM@CheckParam#1 #2\@nil#3{%
  \def\BKM@param{#1}%
  \ifx\BKM@param\@empty
    \PackageWarning{bookmark}{%
      Missing parameter (#3) for `\BKM@type',\MessageBreak
      using 0%
    }%
    \def\BKM@param{0}%
  \else
    \BKM@CalcParam
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
}
\def\BKM@CheckRect#1#2{%
  \BKM@@CheckRect#1#2#2#2#2\@nil
}
\def\BKM@@CheckRect#1 #2 #3 #4 #5\@nil{%
  \def\BKM@temp{0}%
  \def\BKM@param{#1}%
  \ifx\BKM@param\@empty
    \def\BKM@param{0}%
    \def\BKM@temp{1}%
  \else
    \BKM@CalcParam
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
  \def\BKM@param{#2}%
  \ifx\BKM@param\@empty
    \def\BKM@param{0}%
    \def\BKM@temp{1}%
  \else
    \BKM@CalcParam
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
  \def\BKM@param{#3}%
  \ifx\BKM@param\@empty
    \def\BKM@param{0}%
    \def\BKM@temp{1}%
  \else
    \BKM@CalcParam
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
  \def\BKM@param{#4}%
  \ifx\BKM@param\@empty
    \def\BKM@param{0}%
    \def\BKM@temp{1}%
  \else
    \BKM@CalcParam
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
  \ifnum\BKM@temp>\z@
    \PackageWarning{bookmark}{Missing parameters for `\BKM@type'}%
  \fi
}
\def\BKM@CheckXYZ#1#2{%
  \BKM@@CheckXYZ#1#2#2#2\@nil
}
\def\BKM@@CheckXYZ#1 #2 #3 #4\@nil{%
  \def\BKM@param{#1}%
  \let\BKM@temp\BKM@param
  \@onelevel@sanitize\BKM@temp
  \ifx\BKM@param\@empty
    \let\BKM@param\BKM@null
  \else
    \ifx\BKM@temp\BKM@null
    \else
      \BKM@CalcParam
    \fi
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
  \def\BKM@param{#2}%
  \let\BKM@temp\BKM@param
  \@onelevel@sanitize\BKM@temp
  \ifx\BKM@param\@empty
    \let\BKM@param\BKM@null
  \else
    \ifx\BKM@temp\BKM@null
    \else
      \BKM@CalcParam
    \fi
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
  \def\BKM@param{#3}%
  \ifx\BKM@param\@empty
    \let\BKM@param\BKM@null
  \fi
  \edef\BKM@view{\BKM@view\space\BKM@param}%
}
\def\BKM@null{null}
\@onelevel@sanitize\BKM@null
\def\BKM@CalcParam{%
  \begingroup
  \let\calc\@firstofone
  \expandafter\BKM@@CalcParam\BKM@param\@empty\@empty\@nil
}
\def\BKM@@CalcParam#1#2#3\@nil{%
  \ifx\calc#1%
    \@ifundefined{calc@assign@dimen}{%
      \@ifundefined{dimexpr}{%
        \setlength{\dimen@}{#2}%
      }{%
        \setlength{\dimen@}{\dimexpr#2\relax}%
      }%
    }{%
      \setlength{\dimen@}{#2}%
    }%
    \dimen@.99626\dimen@
    \edef\BKM@param{\strip@pt\dimen@}%
    \expandafter\endgroup
    \expandafter\def\expandafter\BKM@param\expandafter{\BKM@param}%
  \else
    \endgroup
  \fi
}
\DeclareBoolOption{atend}
\g@addto@macro\BKM@DisableOptions{%
  \DisableKeyvalOption[action=warning,package=bookmark]%
      {BKM}{atend}%
}
\newcommand*{\bookmarkdefinestyle}[2]{%
  \@ifundefined{BKM@style@#1}{%
  }{%
    \PackageInfo{bookmark}{Redefining style `#1'}%
  }%
  \@namedef{BKM@style@#1}{#2}%
}
\define@key{BKM}{style}{%
  \BKM@StyleCall{#1}%
}
\newif\ifBKM@ok
\def\BKM@StyleCall#1{%
  \@ifundefined{BKM@style@#1}{%
    \PackageWarning{bookmark}{%
      Ignoring unknown style `#1'%
    }%
  }{%
    \BKM@oktrue
    \edef\BKM@StyleCurrent{#1}%
    \@onelevel@sanitize\BKM@StyleCurrent
    \let\BKM@StyleEntry\BKM@StyleEntryCheck
    \BKM@StyleStack
    \ifBKM@ok
      \expandafter\@firstofone
    \else
      \PackageError{bookmark}{%
        Ignoring recursive call of style `\BKM@StyleCurrent'%
      }\@ehc
      \expandafter\@gobble
    \fi
    {%
      \let\BKM@StyleEntry\relax
      \edef\BKM@StyleStack{%
        \BKM@StyleEntry{\BKM@StyleCurrent}%
        \BKM@StyleStack
      }%
      \expandafter\expandafter\expandafter\bookmarksetup
      \expandafter\expandafter\expandafter{%
        \csname BKM@style@\BKM@StyleCurrent\endcsname
      }%
      \BKM@StyleStackPop
    }%
  }%
}
\def\BKM@StyleStackPop{%
  \let\BKM@StyleEntry\relax
  \edef\BKM@StyleStack{%
    \expandafter\@gobbletwo\BKM@StyleStack
  }%
}
\def\BKM@StyleEntryCheck#1{%
  \def\BKM@temp{#1}%
  \ifx\BKM@temp\BKM@StyleCurrent
    \BKM@okfalse
  \fi
}
\def\BKM@StyleStack{}
\DeclareStringOption{srcline}
\DeclareStringOption{srcfile}
\def\BKM@hook{}
\define@key{BKM}{addtohook}{%
  \BKM@LocalAppendToMacro\BKM@hook{#1}%
}
\newcommand*{\bookmarkget}[1]{%
  \romannumeral0%
  \@ifundefined{bookmark@#1}{%
    \BKM@space
  }{%
    \expandafter\expandafter\expandafter\BKM@space
    \csname bookmark@#1\endcsname
  }%
}
\def\BKM@DefineDriverKey#1{%
  \define@key{BKM}{#1}[]{%
    \def\BKM@driver{#1}%
  }%
  \g@addto@macro\BKM@DisableOptions{%
    \DisableKeyvalOption[action=warning,package=bookmark]%
        {BKM}{#1}%
  }%
}
\BKM@DefineDriverKey{pdftex}
\BKM@DefineDriverKey{dvips}
\BKM@DefineDriverKey{dvipdfm}
\BKM@DefineDriverKey{dvipdfmx}
\BKM@DefineDriverKey{xetex}
\BKM@DefineDriverKey{vtex}
\define@key{BKM}{dvipdfmx-outline-open}[true]{%
 \PackageWarning{bookmark}{Option 'dvipdfmx-outline-open' is obsolete
   and ignored}{}}
\def\bookmark@driver{\BKM@driver}
\InputIfFileExists{bookmark.cfg}{}{}
\providecommand*{\BookmarkDriverDefault}{dvips}
\ifpdf
  \def\BKM@driver{pdftex}%
  \ifx\pdfoutline\@undefined
    \ifx\pdfextension\@undefined\else
      \protected\def\pdfoutline{\pdfextension outline }
    \fi
  \fi
\else
  \ifxetex
    \def\BKM@driver{dvipdfm}%
  \else
    \ifvtex
      \def\BKM@driver{vtex}%
    \else
      \edef\BKM@driver{\BookmarkDriverDefault}%
    \fi
  \fi
\fi
\ProcessKeyvalOptions*
\BKM@DisableOptions
\ifBKM@draft
  \PackageWarningNoLine{bookmark}{Draft mode on}%
  \let\bookmarksetup\@gobble
  \let\BookmarkAtEnd\@gobble
  \let\bookmarkdefinestyle\@gobbletwo
  \let\bookmarkget\@gobble
  \let\pdfbookmark\@undefined
  \newcommand*{\pdfbookmark}[3][]{}%
  \let\currentpdfbookmark\@gobbletwo
  \let\subpdfbookmark\@gobbletwo
  \let\belowpdfbookmark\@gobbletwo
  \newcommand*{\bookmark}[2][]{}%
  \renewcommand*{\Hy@writebookmark}[5]{}%
  \let\ReadBookmarks\relax
  \let\BKM@DefGotoNameAction\@gobbletwo % package `hypdestopt'
  \expandafter\endinput
\fi
\def\BKM@temp{dvipdfmx}%
\ifx\BKM@temp\BKM@driver
  \def\BKM@driver{dvipdfm}%
\fi
\def\BKM@temp{pdftex}%
\ifpdf
  \ifx\BKM@temp\BKM@driver
  \else
    \PackageWarningNoLine{bookmark}{%
      Wrong driver `\BKM@driver', using `pdftex' instead%
    }%
    \let\BKM@driver\BKM@temp
  \fi
\else
  \ifx\BKM@temp\BKM@driver
    \PackageError{bookmark}{%
      Wrong driver, pdfTeX is not running in PDF mode.\MessageBreak
      Package loading is aborted%
    }\@ehc
    \expandafter\expandafter\expandafter\endinput
  \fi
  \def\BKM@temp{dvipdfm}%
  \ifxetex
    \ifx\BKM@temp\BKM@driver
    \else
      \PackageWarningNoLine{bookmark}{%
        Wrong driver `\BKM@driver',\MessageBreak
        using `dvipdfm' for XeTeX instead%
      }%
      \let\BKM@driver\BKM@temp
    \fi
  \else
    \def\BKM@temp{vtex}%
    \ifvtex
      \ifx\BKM@temp\BKM@driver
      \else
        \PackageWarningNoLine{bookmark}{%
          Wrong driver `\BKM@driver',\MessageBreak
          using `vtex' for VTeX instead%
        }%
        \let\BKM@driver\BKM@temp
      \fi
    \else
      \ifx\BKM@temp\BKM@driver
        \PackageError{bookmark}{%
          Wrong driver, VTeX is not running in PDF mode.\MessageBreak
          Package loading is aborted%
        }\@ehc
        \expandafter\expandafter\expandafter\endinput
      \fi
    \fi
  \fi
\fi
\InputIfFileExists{bkm-\BKM@driver.def}{}{%
  \PackageError{bookmark}{%
    Unsupported driver `\BKM@driver'.\MessageBreak
    Package loading is aborted%
  }\@ehc
  \endinput
}
\let\pdfbookmark\@undefined
\newcommand*{\pdfbookmark}[3][0]{%
  \bookmark[level=#1,dest={#3.#1}]{#2}%
  \hyper@anchorstart{#3.#1}\hyper@anchorend
}
\def\currentpdfbookmark{%
  \pdfbookmark[\BKM@currentlevel]%
}
\def\subpdfbookmark{%
  \BKM@CalcExpr\BKM@CalcResult\BKM@currentlevel+1%
  \expandafter\pdfbookmark\expandafter[\BKM@CalcResult]%
}
\def\belowpdfbookmark#1#2{%
  \xdef\BKM@gtemp{\number\BKM@currentlevel}%
  \subpdfbookmark{#1}{#2}%
  \global\let\BKM@currentlevel\BKM@gtemp
}
\def\Hy@writebookmark#1#2#3#4#5{%
  \ifnum#4>\BKM@depth\relax
  \else
    \edef\BKM@type{#5}%
    \ifx\BKM@type\Hy@bookmarkstype
      \begingroup
        \ifBKM@numbered
          \let\numberline\Hy@numberline
          \let\booknumberline\Hy@numberline
          \let\partnumberline\Hy@numberline
          \let\chapternumberline\Hy@numberline
        \else
          \let\numberline\@gobble
          \let\booknumberline\@gobble
          \let\partnumberline\@gobble
          \let\chapternumberline\@gobble
        \fi
        \bookmark[level=#4,dest={\HyperDestNameFilter{#3}}]{#2}%
      \endgroup
    \fi
  \fi
}
\let\ReadBookmarks\relax
\ifBKM@atend
\else
  \newcommand{\BookmarkAtEnd}[1]{%
    \PackageWarning{bookmark}{%
      Ignored, because option `atend' is missing%
    }%
  }%
  \expandafter\endinput
\fi
\newcommand*{\BookmarkAtEnd}{%
  \g@addto@macro\BKM@EndHook
}
\let\BKM@EndHook\@empty

\endinput
%%
%% End of file `bookmark.sty'.
