%%
%% This is file `tagpdf-debug-generic.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tagpdf-mc-generic.dtx  (with options: `debug')
%% 
%% Copyright (C) 2019-2024 Ulrike Fischer
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    https://www.latex-project.org/lppl.txt
%% 
%% This file is part of the "tagpdf bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: tagpdf-mc-generic.dtx
\ProvidesExplPackage {tagpdf-debug-generic} {2025-03-26} {0.99p}
 {part of tagpdf - debugging code related to marking chunks - generic mode}
\cs_set_protected:Npn \tag_mc_begin:n #1 %#1 keyval
  {
    \__tag_check_if_active_mc:TF
      {
        \__tag_debug_mc_begin_insert:n { #1 }
        \group_begin: %hm
        \__tag_check_mc_if_nested:
        \bool_gset_true:N \g__tag_in_mc_bool
        \tl_set_eq:NN \l__tag_mc_key_tag_tl \g__tag_struct_tag_tl
        \tl_gset_eq:NN\g__tag_mc_key_tag_tl \g__tag_struct_tag_tl
        \keys_set:nn { __tag / mc } {#1}
        \bool_if:NTF \l__tag_mc_artifact_bool
          { %handle artifact
            \__tag_mc_handle_artifact:N \l__tag_mc_artifact_type_tl
            \exp_args:NV
            \__tag_mc_artifact_begin_marks:n \l__tag_mc_artifact_type_tl
          }
          { %handle mcid type
            \__tag_check_mc_tag:N  \l__tag_mc_key_tag_tl
            \__tag_mc_handle_mcid:VV
               \l__tag_mc_key_tag_tl
               \l__tag_mc_key_properties_tl
            \__tag_mc_begin_marks:oo{\l__tag_mc_key_tag_tl}{\l__tag_mc_key_label_tl}
            \tl_if_empty:NF {\l__tag_mc_key_label_tl}
              {
                \exp_args:NV
                \__tag_mc_handle_mc_label:e \l__tag_mc_key_label_tl
              }
            \bool_if:NF \l__tag_mc_key_stash_bool
              {
                \exp_args:NV\__tag_struct_get_parentrole:nNN
                    \g__tag_struct_stack_current_tl
                    \l__tag_get_parent_tmpa_tl
                    \l__tag_get_parent_tmpb_tl
                 \__tag_check_parent_child:VVnnN
                   \l__tag_get_parent_tmpa_tl
                   \l__tag_get_parent_tmpb_tl
                   {MC}{}
                   \l__tag_parent_child_check_tl
                \int_compare:nNnT {\l__tag_parent_child_check_tl}<{0}
                 {
                    \prop_get:cnN
                     { g__tag_struct_ \g__tag_struct_stack_current_tl _prop}
                     {S}
                     \l__tag_tmpa_tl
                    \msg_warning:nneee
                     { tag }
                     {role-parent-child}
                     { \l__tag_get_parent_tmpa_tl/\l__tag_get_parent_tmpb_tl  }
                     { MC~(real content) }
                     { not~allowed~
                       (struct~\g__tag_struct_stack_current_tl,~\l__tag_tmpa_tl)
                     }
                 }
                \__tag_mc_handle_stash:e { \int_use:N \c@g__tag_MCID_abs_int }
              }
          }
        \group_end:
      }
      {
        \__tag_debug_mc_begin_ignore:n { #1 }
      }
  }
\cs_set_protected:Nn \tag_mc_end:
  {
    \__tag_check_if_active_mc:TF
      {
        \__tag_debug_mc_end_insert:
        \__tag_check_mc_if_open:
        \bool_gset_false:N \g__tag_in_mc_bool
        \tl_gset:Nn  \g__tag_mc_key_tag_tl { }
        \__tag_mc_emc:
        \__tag_mc_end_marks:
      }
      {
        \__tag_debug_mc_end_ignore:
      }
  }

%% 
%%
%% End of file `tagpdf-debug-generic.sty'.
