%%
%% This is file `l3backend-dvisvgm.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3backend-basics.dtx  (with options: `package,dvisvgm')
%% l3backend-color.dtx  (with options: `package,dvisvgm')
%% l3backend-box.dtx  (with options: `package,dvisvgm')
%% l3backend-draw.dtx  (with options: `package,dvisvgm')
%% l3backend-graphics.dtx  (with options: `package,dvisvgm')
%% l3backend-pdf.dtx  (with options: `package,dvisvgm')
%% l3backend-opacity.dtx  (with options: `package,dvisvgm')
%% 
%% Copyright (C) 2019-2021 The LaTeX Project
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    https://www.latex-project.org/lppl.txt
%% 
%% This file is part of the "l3backend bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: l3backend-basics.dtx
\ProvidesExplFile
  {l3backend-dvisvgm.def}{2021-10-17}{}
  {L3 backend support: dvisvgm}
\cs_if_exist:NTF \__kernel_dependency_version_check:nn
  {
    \__kernel_dependency_version_check:nn {2021-02-18}
      {l3backend-dvisvgm.def}
  }
  {
    \cs_if_exist_use:cF { @latex@error } { \errmessage }
      {
        Mismatched~LaTeX~support~files~detected. \MessageBreak
        Loading~aborted!
      }
      { \use:c { @ehd } }
    \tex_endinput:D
  }
\cs_new_eq:NN \__kernel_backend_literal:e \tex_special:D
\cs_new_protected:Npn \__kernel_backend_literal:n #1
  { \__kernel_backend_literal:e { \exp_not:n {#1} } }
\cs_generate_variant:Nn \__kernel_backend_literal:n { x }
\cs_if_exist:NTF \@ifl@t@r
  {
    \@ifl@t@r \fmtversion { 2020-10-01 }
      {
        \cs_new_protected:Npn \__kernel_backend_first_shipout:n #1
          { \hook_gput_code:nnn { shipout / firstpage } { l3backend } {#1} }
      }
      { \cs_new_eq:NN \__kernel_backend_first_shipout:n \AtBeginDvi }
  }
  { \cs_new_eq:NN \__kernel_backend_first_shipout:n \use:n }
\cs_new_protected:Npn \__kernel_backend_literal_svg:n #1
  { \__kernel_backend_literal:n { dvisvgm:raw~ #1 { ?nl } } }
\cs_generate_variant:Nn \__kernel_backend_literal_svg:n { x }
\int_new:N \g__kernel_backend_scope_int
\int_new:N \l__kernel_backend_scope_int
\cs_new_protected:Npn \__kernel_backend_scope_begin:
  {
    \__kernel_backend_literal_svg:n { <g> }
    \int_set_eq:NN
      \l__kernel_backend_scope_int
      \g__kernel_backend_scope_int
    \group_begin:
      \int_gset:Nn \g__kernel_backend_scope_int { 1 }
  }
\cs_new_protected:Npn \__kernel_backend_scope_end:
  {
      \prg_replicate:nn
        { \g__kernel_backend_scope_int }
        { \__kernel_backend_literal_svg:n { </g> } }
    \group_end:
    \int_gset_eq:NN
      \g__kernel_backend_scope_int
      \l__kernel_backend_scope_int
  }
\cs_new_protected:Npn \__kernel_backend_scope_begin:n #1
  {
    \__kernel_backend_literal_svg:n { <g ~ #1 > }
    \int_set_eq:NN
      \l__kernel_backend_scope_int
      \g__kernel_backend_scope_int
    \group_begin:
      \int_gset:Nn \g__kernel_backend_scope_int { 1 }
  }
\cs_generate_variant:Nn \__kernel_backend_scope_begin:n { x }
\cs_new_protected:Npn \__kernel_backend_scope:n #1
  {
    \__kernel_backend_literal_svg:n { <g ~ #1 > }
    \int_gincr:N \g__kernel_backend_scope_int
  }
\cs_generate_variant:Nn \__kernel_backend_scope:n { x }
%% File: l3backend-color.dtx
\cs_new_protected:Npn \__color_backend_pickup:N #1 { }
\cs_if_exist:cT { ver@color.sty }
  {
    \cs_set_protected:Npn \__color_backend_pickup:N #1
      {
        \exp_args:NV \tl_if_head_is_space:nTF \current@color
          {
            \tl_set:Nx #1
               {
                 { \exp_after:wN \use:n \current@color }
                 { 1 }
               }
          }
          {
            \exp_last_unbraced:Nx \__color_backend_pickup:w
              { \current@color } \s__color_stop #1
          }
      }
    \cs_new_protected:Npn \__color_backend_pickup:w #1 ~ #2 \s__color_stop #3
      { \tl_set:Nn #3 { {#1} {#2} } }
  }
\cs_new_protected:Npn \__color_backend_select_cmyk:n #1
  { \__color_backend_select:n { cmyk ~ #1 } }
\cs_new_protected:Npn \__color_backend_select_gray:n #1
  { \__color_backend_select:n { gray ~ #1 } }
\cs_new_protected:Npn \__color_backend_select_rgb:n #1
  { \__color_backend_select:n { rgb ~ #1 } }
\cs_new_protected:Npn \__color_backend_select:n #1
  {
    \__kernel_backend_literal:n { color~push~ #1 }
    \group_insert_after:N \__color_backend_reset:
  }
\cs_new_protected:Npn \__color_backend_reset:
  { \__kernel_backend_literal:n { color~pop } }
\cs_new_protected:Npn \__color_backend_select_separation:nn #1#2 { }
\cs_new_protected:Npn \__color_backend_select_devicen:nn #1#2 { }
\cs_new_protected:Npn \__color_backend_separation_init:nnnnn #1#2#3#4#5 { }
\cs_new_protected:Npn \__color_backend_separation_init_CIELAB:nnnnnn #1#2#3 { }
\cs_new_protected:Npn \__color_backend_fill_cmyk:n #1
  { \__color_backend_fill:n { cmyk ~ #1 } }
\cs_new_protected:Npn \__color_backend_fill_gray:n #1
  { \__color_backend_fill:n { gray ~ #1 } }
\cs_new_protected:Npn \__color_backend_fill_rgb:n #1
  { \__color_backend_fill:n { rgb ~ #1 } }
\cs_new_protected:Npn \__color_backend_fill:n #1
  {
    \__kernel_backend_literal:n { color~push~ #1 }
    \group_insert_after:N \__color_backend_reset:
  }
\cs_new_protected:Npn \__color_backend_stroke_cmyk:n #1
  { \__color_backend_cmyk:w #1 \s__color_stop }
\cs_new_protected:Npn \__color_backend_stroke_cmyk:w
  #1 ~ #2 ~ #3 ~ #4 \s__color_stop
  {
    \use:x
      {
        \__color_backend:nnn
          { \fp_eval:n { -100 * ( 1 - min ( 1 , #1 + #4 ) ) } }
          { \fp_eval:n { -100 * ( 1 - min ( 1 , #2 + #4 ) ) } }
          { \fp_eval:n { -100 * ( 1 - min ( 1 , #3 + #4 ) ) } }
      }
  }
\cs_new_protected:Npn \__color_backend_stroke_gray:n #1
  {
    \use:x
      {
        \__color_backend_stroke_gray_aux:n
          { \fp_eval:n { 100 * (#1) } }
      }
  }
\cs_new_protected:Npn \__color_backend_stroke_gray_aux:n #1
  { \__color_backend:nnn {#1} {#1} {#1} }
\cs_new_protected:Npn \__color_backend_stroke_rgb:n #1
  { \__color_backend_rgb:w #1 \s__color_stop }
\cs_new_protected:Npn \__color_backend_stroke_rgb:w
  #1 ~ #2 ~ #3 \s__color_stop
  {
    \use:x
      {
        \__color_backend:nnn
          { \fp_eval:n { 100 * (#1) } }
          { \fp_eval:n { 100 * (#2) } }
          { \fp_eval:n { 100 * (#3) } }
      }
  }
\cs_new_protected:Npx \__color_backend:nnn #1#2#3
  {
    \__kernel_backend_scope:n
      {
        stroke =
         "
           rgb
             (
               #1 \c_percent_str ,
               #2 \c_percent_str ,
               #3 \c_percent_str
             )
         "
      }
  }
\cs_new_protected:Npn \__color_backend_fill_separation:nn #1#2 { }
\cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 { }
\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn
\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn
%% File: l3backend-box.dtx
\cs_new_protected:Npn \__box_backend_clip:N #1
  {
    \int_gincr:N \g__box_clip_path_int
    \__kernel_backend_literal_svg:x
      { < clipPath~id = " l3cp \int_use:N \g__box_clip_path_int " > }
    \__kernel_backend_literal_svg:x
      {
        <
          path ~ d =
            "
              M ~ 0 ~
                  \dim_to_decimal:n { -\box_dp:N #1 } ~
              L ~ \dim_to_decimal:n { \box_wd:N #1 } ~
                  \dim_to_decimal:n { -\box_dp:N #1 } ~
              L ~ \dim_to_decimal:n { \box_wd:N #1 }  ~
                  \dim_to_decimal:n { \box_ht:N #1 + \box_dp:N #1 } ~
              L ~ 0 ~
                  \dim_to_decimal:n { \box_ht:N #1 + \box_dp:N #1 } ~
              Z
            "
        />
      }
    \__kernel_backend_literal_svg:n
      { < /clipPath > }
    \__kernel_backend_scope_begin:n
      {
        transform =
          "
            translate ( { ?x } , { ?y } ) ~
            scale ( 1 , -1 )
          "
      }
    \__kernel_backend_scope:x
      {
        clip-path =
          "url ( \c_hash_str l3cp \int_use:N \g__box_clip_path_int ) "
      }
    \__kernel_backend_scope:n
      {
        transform =
          "
            scale ( -1 , 1 ) ~
            translate ( { ?x } , { ?y } ) ~
            scale ( -1 , -1 )
          "
      }
    \box_use:N #1
    \__kernel_backend_scope_end:
  }
\int_new:N \g__box_clip_path_int
\cs_new_protected:Npn \__box_backend_rotate:Nn #1#2
  {
    \__kernel_backend_scope_begin:x
      {
        transform =
          "
            rotate
            ( \fp_eval:n { round ( -(#2) , 5 ) } , ~ { ?x } , ~ { ?y } )
          "
      }
    \box_use:N #1
    \__kernel_backend_scope_end:
  }
\cs_new_protected:Npn \__box_backend_scale:Nnn #1#2#3
  {
    \__kernel_backend_scope_begin:x
      {
        transform =
          "
            translate ( { ?x } , { ?y } ) ~
            scale
              (
                \fp_eval:n { round ( -#2 , 5 ) } ,
                \fp_eval:n { round ( -#3 , 5 ) }
              ) ~
            translate ( { ?x } , { ?y } ) ~
            scale ( -1 )
          "
      }
    \hbox_overlap_right:n { \box_use:N #1 }
    \__kernel_backend_scope_end:
  }
%% File: l3backend-draw.dtx
\cs_new_eq:NN \__draw_backend_literal:n \__kernel_backend_literal_svg:n
\cs_generate_variant:Nn \__draw_backend_literal:n { x }
\cs_new_protected:Npn \__draw_backend_begin:
  {
    \__kernel_backend_scope_begin:
    \__kernel_backend_scope:n { transform="translate({?x},{?y})~scale(1,-1)" }
  }
\cs_new_eq:NN \__draw_backend_end: \__kernel_backend_scope_end:
\cs_new_protected:Npn \__draw_backend_moveto:nn #1#2
  {
    \__draw_backend_add_to_path:n
      { M ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} }
  }
\cs_new_protected:Npn \__draw_backend_lineto:nn #1#2
  {
    \__draw_backend_add_to_path:n
      { L ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} }
  }
\cs_new_protected:Npn \__draw_backend_rectangle:nnnn #1#2#3#4
  {
    \__draw_backend_add_to_path:n
      {
        M ~ \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2}
        h ~ \dim_to_decimal:n {#3} ~
        v ~ \dim_to_decimal:n {#4} ~
        h ~ \dim_to_decimal:n { -#3 } ~
        Z
      }
  }
\cs_new_protected:Npn \__draw_backend_curveto:nnnnnn #1#2#3#4#5#6
  {
    \__draw_backend_add_to_path:n
      {
        C ~
        \dim_to_decimal:n {#1} ~ \dim_to_decimal:n {#2} ~
        \dim_to_decimal:n {#3} ~ \dim_to_decimal:n {#4} ~
        \dim_to_decimal:n {#5} ~ \dim_to_decimal:n {#6}
      }
  }
\cs_new_protected:Npn \__draw_backend_add_to_path:n #1
  {
    \tl_gset:Nx \g__draw_draw_path_tl
      {
        \g__draw_draw_path_tl
        \tl_if_empty:NF \g__draw_draw_path_tl { \c_space_tl }
        #1
      }
  }
\tl_new:N \g__draw_draw_path_tl
\cs_new_protected:Npn \__draw_backend_evenodd_rule:
  { \__draw_backend_scope:n { fill-rule="evenodd" } }
\cs_new_protected:Npn \__draw_backend_nonzero_rule:
  { \__draw_backend_scope:n { fill-rule="nonzero" } }
\cs_new_protected:Npn \__draw_backend_closepath:
  { \__draw_backend_add_to_path:n { Z } }
\cs_new_protected:Npn \__draw_backend_path:n #1
  {
    \bool_if:NTF \g__draw_draw_clip_bool
      {
        \int_gincr:N \g__draw_clip_path_int
        \__draw_backend_literal:x
          {
            < clipPath~id = " l3cp \int_use:N \g__draw_clip_path_int " >
              { ?nl }
            <path~d=" \g__draw_draw_path_tl "/> { ?nl }
            < /clipPath > { ? nl }
            <
              use~xlink:href =
                "\c_hash_str l3path \int_use:N \g__draw_path_int " ~
                #1
            />
          }
        \__draw_backend_scope:x
          {
            clip-path =
              "url( \c_hash_str l3cp \int_use:N \g__draw_clip_path_int)"
          }
      }
      {
        \__draw_backend_literal:x
          { <path ~ d=" \g__draw_draw_path_tl " ~ #1 /> }
      }
    \tl_gclear:N \g__draw_draw_path_tl
    \bool_gset_false:N \g__draw_draw_clip_bool
  }
\int_new:N \g__draw_path_int
\cs_new_protected:Npn \__draw_backend_stroke:
  { \__draw_backend_path:n { style="fill:none" } }
\cs_new_protected:Npn \__draw_backend_closestroke:
  {
    \__draw_backend_closepath:
    \__draw_backend_stroke:
  }
\cs_new_protected:Npn \__draw_backend_fill:
  { \__draw_backend_path:n { style="stroke:none" } }
\cs_new_protected:Npn \__draw_backend_fillstroke:
  { \__draw_backend_path:n { } }
\cs_new_protected:Npn \__draw_backend_clip:
  { \bool_gset_true:N \g__draw_draw_clip_bool }
\bool_new:N \g__draw_draw_clip_bool
\cs_new_protected:Npn \__draw_backend_discardpath:
  {
    \bool_if:NT \g__draw_draw_clip_bool
      {
        \int_gincr:N \g__draw_clip_path_int
        \__draw_backend_literal:x
          {
            < clipPath~id = " l3cp \int_use:N \g__draw_clip_path_int " >
              { ?nl }
            <path~d=" \g__draw_draw_path_tl "/> { ?nl }
            < /clipPath >
          }
        \__draw_backend_scope:x
          {
            clip-path =
              "url( \c_hash_str l3cp \int_use:N \g__draw_clip_path_int)"
          }
      }
    \tl_gclear:N \g__draw_draw_path_tl
    \bool_gset_false:N \g__draw_draw_clip_bool
  }
\cs_new_protected:Npn \__draw_backend_dash_pattern:nn #1#2
  {
    \use:x
      {
        \__draw_backend_dash_aux:nn
          { \clist_map_function:nn {#1} \__draw_backend_dash:n }
          { \dim_to_decimal:n {#2} }
      }
  }
\cs_new:Npn \__draw_backend_dash:n #1
  { , \dim_to_decimal_in_bp:n {#1} }
\cs_new_protected:Npn \__draw_backend_dash_aux:nn #1#2
  {
    \__draw_backend_scope:x
      {
        stroke-dasharray =
          "
            \tl_if_empty:oTF { \use_none:n #1 }
              { none }
              { \use_none:n #1 }
          " ~
          stroke-offset=" #2 "
      }
  }
\cs_new_protected:Npn \__draw_backend_linewidth:n #1
  { \__draw_backend_scope:x { stroke-width=" \dim_to_decimal:n {#1} " } }
\cs_new_protected:Npn \__draw_backend_miterlimit:n #1
  { \__draw_backend_scope:x { stroke-miterlimit=" #1 " } }
\cs_new_protected:Npn \__draw_backend_cap_butt:
  { \__draw_backend_scope:n { stroke-linecap="butt" } }
\cs_new_protected:Npn \__draw_backend_cap_round:
  { \__draw_backend_scope:n { stroke-linecap="round" } }
\cs_new_protected:Npn \__draw_backend_cap_rectangle:
  { \__draw_backend_scope:n { stroke-linecap="square" } }
\cs_new_protected:Npn \__draw_backend_join_miter:
  { \__draw_backend_scope:n { stroke-linejoin="miter" } }
\cs_new_protected:Npn \__draw_backend_join_round:
  { \__draw_backend_scope:n { stroke-linejoin="round" } }
\cs_new_protected:Npn \__draw_backend_join_bevel:
  { \__draw_backend_scope:n { stroke-linejoin="bevel" } }
\cs_new_protected:Npn \__draw_backend_cm:nnnn #1#2#3#4
  {
    \__draw_backend_scope:n
      {
       transform =
         " matrix ( #1 , #2 , #3 , #4 , 0pt , 0pt ) "
      }
  }
\cs_new_protected:Npn \__draw_backend_box_use:Nnnnn #1#2#3#4#5#6#7
  {
    \__kernel_backend_scope_begin:
    \__draw_backend_cm:nnnn {#2} {#3} {#4} {#5}
    \__kernel_backend_literal_svg:n
      {
        < g~
            stroke="none"~
            transform="scale(-1,1)~translate({?x},{?y})~scale(-1,-1)"
        >
      }
    \box_set_wd:Nn #1 { 0pt }
    \box_set_ht:Nn #1 { 0pt }
    \box_set_dp:Nn #1 { 0pt }
    \box_use:N #1
    \__kernel_backend_literal_svg:n { </g> }
    \__kernel_backend_scope_end:
  }
%% File: l3backend-graphics.dtx
\cs_new_eq:NN \__graphics_backend_getbb_eps:n \graphics_read_bb:n
\cs_new_protected:Npn \__graphics_backend_getbb_jpg:n #1
  {
    \int_zero:N \l_graphics_page_int
    \tl_clear:N \l_graphics_pagebox_tl
    \graphics_extract_bb:n {#1}
  }
\cs_new_eq:NN \__graphics_backend_getbb_png:n \__graphics_backend_getbb_jpg:n
\cs_new_protected:Npn \__graphics_backend_getbb_pdf:n #1
  {
    \tl_clear:N \l_graphics_decodearray_tl
    \bool_set_false:N \l_graphics_interpolate_bool
    \graphics_extract_bb:n {#1}
  }
\cs_new_protected:Npn \__graphics_backend_include_eps:n #1
  { __graphics_backend_include:nn { PSfile } {#1} }
\cs_new_protected:Npn \__graphics_backend_include_pdf:n #1
  { __graphics_backend_include:nn { pdffile } {#1} }
\cs_new_protected:Npn \__graphics_backend_include:nn #1#2
  {
    \__kernel_backend_literal:x
      {
        #1 = #2 \c_space_tl
        llx = \dim_to_decimal_in_bp:n \l_graphics_llx_dim \c_space_tl
        lly = \dim_to_decimal_in_bp:n \l_graphics_lly_dim \c_space_tl
        urx = \dim_to_decimal_in_bp:n \l_graphics_urx_dim \c_space_tl
        ury = \dim_to_decimal_in_bp:n \l_graphics_ury_dim
      }
  }
\cs_new_protected:Npn \__graphics_backend_include_png:n #1
  {
     \__kernel_backend_literal:x
       {
         dvisvgm:img~
         \dim_to_decimal:n { \l_graphics_ury_dim } ~
         \dim_to_decimal:n { \l_graphics_ury_dim } ~
         \__graphics_backend_include_bitmap_quote:w #1 " #1 " \s__graphics_stop
       }
  }
\cs_new_eq:NN \__graphics_backend_include_jpg:n \__graphics_backend_include_png:n
\cs_new:Npn \__graphics_backend_include_bitmap_quote:w #1 " #2 " #3 \s__graphics_stop
  { " #2 " }
%% File: l3backend-pdf.dtx
\box_new:N \l__pdf_internal_box
\cs_new_protected:Npn \__pdf_backend_catalog_gput:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_info_gput:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_new:nn #1#2 { }
\cs_new:Npn \__pdf_backend_object_ref:n #1 { }
\cs_new_protected:Npn \__pdf_backend_object_write:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_write:nx #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_now:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_object_now:nx #1#2 { }
\cs_new:Npn \__pdf_backend_object_last: { }
\cs_new:Npn \__pdf_backend_pageobject_ref:n #1 { }
\cs_new_protected:Npn \__pdf_backend_compresslevel:n #1 { }
\cs_new_protected:Npn \__pdf_backend_compress_objects:n #1 { }
\cs_new_protected:Npn \__pdf_backend_version_major_gset:n #1 { }
\cs_new_protected:Npn \__pdf_backend_version_minor_gset:n #1 { }
\cs_new:Npn \__pdf_backend_version_major: { -1 }
\cs_new:Npn \__pdf_backend_version_minor: { -1 }
\cs_new_protected:Npn \__pdf_backend_bdc:nn #1#2 { }
\cs_new_protected:Npn \__pdf_backend_emc: { }
%% File: l3backend-opacity.dtx
\cs_new_protected:Npn \__opacity_backend_select:n #1
  { \__opacity_backend:nn {#1} { } }
\cs_new_protected:Npn \__opacity_backend_fill:n #1
  { \__opacity_backend:nn {#1} { fill- } }
\cs_new_protected:Npn \__opacity_backend_stroke:n #1
  { \__opacity_backend:nn { {#1} } { stroke- } }
\cs_new_protected:Npn \__opacity_backend:nn #1#2
  { \__kernel_backend_scope:x { #2 opacity = " \fp_eval:n { min(max(0,#1),1) } " } }
%% 
%%
%% End of file `l3backend-dvisvgm.def'.
