{{ $indexTemplate := resources.Get "js/index.js" -}}
{{ $index := $indexTemplate | resources.ExecuteAsTemplate "index.js" . -}}
{{ $bs := resources.Get "js/bootstrap.js" -}}
{{ $bs := $bs | js.Build -}}
{{ $highlight := resources.Get "js/highlight.js" -}}
{{ $highlight := $highlight | js.Build -}}
{{ $katex := resources.Get "js/vendor/katex/dist/katex.js" -}}
{{ $katexAutoRender := resources.Get "js/vendor/katex/dist/contrib/auto-render.js" -}}
{{ $mermaid := resources.Get "js/mermaid.js" | js.Build -}}
{{ $app := resources.Get "js/app.js" -}}
{{ $slice := slice $app -}}
{{ if .Site.Params.options.lazySizes -}}
{{ $lazySizes := resources.Get "js/lazysizes.js" -}}
{{ $lazySizes := $lazySizes | js.Build -}}
{{ $slice = $slice | append $lazySizes -}}
{{ end -}}
{{ if .Site.Params.options.clipBoard -}}
{{ $clipBoard := resources.Get "js/clipboard.js" -}}
{{ $clipBoard := $clipBoard | js.Build -}}
{{ $slice = $slice | append $clipBoard -}}
{{ end -}}
{{ if .Site.Params.options.instantPage -}}
{{ $instantPage := resources.Get "js/instant.page.js" -}}
{{ $instantPage := $instantPage | js.Build -}}
{{ $slice = $slice | append $instantPage -}}
{{ end -}}
{{ $showFlexSearch := .Site.Params.options.flexSearch }}
{{ if $showFlexSearch -}}
{{ $flexSearch := resources.Get "js/vendor/flexsearch/dist/flexsearch.bundle.js" -}}
{{ $slice = $slice | append $flexSearch -}}
{{ if and (isset .Site.Params.options "searchsectionsshow") (not (eq .Site.Params.options.searchSectionsShow "ALL")) -}}
{{ $showFlexSearch = or (eq (len .Site.Params.options.searchSectionsShow) 0) (in .Site.Params.options.searchSectionsShow .Section) (and .IsHome (in .Site.Params.options.searchSectionsShow "HomePage")) -}}
{{ end -}}
{{ end -}}
{{ if .Site.Params.options.darkMode -}}
{{ $darkMode := resources.Get "js/darkmode.js" -}}
{{ $darkMode := $darkMode | js.Build -}}
{{ $slice = $slice | append $darkMode -}}
{{ end -}}
{{ if and (.Site.Params.alert) (.Site.Params.alertDismissable) -}}
{{ $alert := resources.Get "js/alert.js" -}}
{{ $alert := $alert | js.Build -}}
{{ $slice = $slice | append $alert -}}
{{ end -}}
{{ if .Site.Params.options.kaTex -}}
{{ $katexConfig := resources.Get "js/katex.js" -}}
{{ $katexConfig := $katexConfig | js.Build -}}
{{ $slice = $slice | append $katexConfig -}}
{{ end -}}
{{ $scrollLock := resources.Get "js/scroll-lock.js" | js.Build -}}
{{ $slice = $slice | append $scrollLock -}}
{{ if .Site.Params.options.toTopButton -}}
{{ $toTopButton := resources.Get "js/to-top.js" -}}
{{ $toTopButton := $toTopButton | js.Build -}}
{{ $slice = $slice | append $toTopButton -}}
{{ end -}}
{{ $js := $slice | resources.Concat "main.js" -}}
{{ if eq (hugo.Environment) "development" -}}
{{ if .Site.Params.options.bootStrapJs -}}
{{ end -}}
{{ if .Site.Params.options.highLight -}}
{{ end -}}
{{ if .Site.Params.options.kaTex -}}
{{ end -}}
{{ with .Params.mermaid -}}
{{ end -}}
{{ if $showFlexSearch -}}
{{ end -}}
{{ else -}}
{{ $js := $js | minify | fingerprint "sha512" -}}
{{ $index := $index | minify | fingerprint "sha512" -}}
{{ $bs := $bs | minify | fingerprint "sha512" -}}
{{ $highlight := $highlight | minify | fingerprint "sha512" -}}
{{ $katex := $katex | minify | fingerprint "sha512" -}}
{{ $katexAutoRender := $katexAutoRender | minify | fingerprint "sha512" -}}
{{ $mermaid := $mermaid | minify | fingerprint "sha512" -}}
{{ if .Site.Params.options.bootStrapJs -}}
{{ end -}}
{{ if .Site.Params.options.highLight -}}
{{ end -}}
{{ if .Site.Params.options.kaTex -}}
{{ end -}}
{{ with .Params.mermaid -}}
{{ end -}}
{{ if $showFlexSearch -}}
{{ end -}}
{{ end -}}