{{- $jquery := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_js -}}
{{- $jquery = .Site.Params.cdn.jquery_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/jquery/jquery.slim.min.js" | resources.Minify -}}
{{- $jquery = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $lazysizes := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.lazysizes_js -}}
{{- $lazysizes = .Site.Params.cdn.lazysizes_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/lazysizes/lazysizes.min.js" | resources.Minify -}}
{{- $lazysizes = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $smooth_scroll := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.smooth_scroll_js -}}
{{- $smooth_scroll = .Site.Params.cdn.smooth_scroll_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | resources.Minify -}}
{{- $smooth_scroll = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $smooth_scroll = delimit (slice $smooth_scroll "") "" -}}
{{- $katex_css := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_css -}}
{{- $katex_css = .Site.Params.cdn.katex_css -}}
{{- else -}}
{{- $res := resources.Get "css/lib/katex/katex.min.css" | resources.Minify -}}
{{- $katex_css = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $katex_js := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_js -}}
{{- $katex_js = .Site.Params.cdn.katex_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/katex/katex.min.js" | resources.Minify -}}
{{- $katex_js = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $katex_auto_render_js := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_auto_render_js -}}
{{- $katex_auto_render_js = .Site.Params.cdn.katex_auto_render_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/katex/auto-render.min.js" | resources.Minify -}}
{{- $katex_auto_render_js = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $katex := delimit (slice $katex_css $katex_js $katex_auto_render_js) "" -}}
{{- $mermaid := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.mermaid_js -}}
{{- $mermaid = .Site.Params.cdn.mermaid_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/mermaid/mermaid.min.js" | resources.Minify -}}
{{- $mermaid = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $mermaidInit := "" -}}
{{- $mermaid = delimit (slice $mermaid $mermaidInit) "" -}}
{{- $echarts_js := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_js -}}
{{- $echarts_js = .Site.Params.cdn.echarts_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/echarts/echarts.min.js" | resources.Minify -}}
{{- $echarts_js = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $echarts_macarons_js := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.echarts_macarons_js -}}
{{- $echarts_macarons_js = .Site.Params.cdn.echarts_macarons_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/echarts/macarons.js" | resources.Minify -}}
{{- $echarts_macarons_js = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $echarts := delimit (slice $echarts_js $echarts_macarons_js) "" -}}
{{- $typeit := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.typeit_js -}}
{{- $typeit = .Site.Params.cdn.typeit_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/typeit/typeit.min.js" | resources.Minify -}}
{{- $typeit = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $countdown := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.jquery_countdown_js -}}
{{- $countdown = .Site.Params.cdn.jquery_countdown_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/jquery-countdown/jquery.countdown.min.js" | resources.Minify -}}
{{- $countdown = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $aplayer_css := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_css -}}
{{- $aplayer_css = .Site.Params.cdn.aplayer_css -}}
{{- else -}}
{{- $res := resources.Get "css/lib/aplayer/APlayer.min.css" | resources.Minify -}}
{{- $aplayer_css = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $aplayer_js := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.aplayer_js -}}
{{- $aplayer_js = .Site.Params.cdn.aplayer_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/aplayer/APlayer.min.js" | resources.Minify -}}
{{- $aplayer_js = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $aplayer := delimit (slice $aplayer_css $aplayer_js) "" -}}
{{- $meting := "" -}}
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.meting_js -}}
{{- $meting = .Site.Params.cdn.meting_js -}}
{{- else -}}
{{- $res := resources.Get "js/lib/meting/Meting.min.js" | resources.Minify -}}
{{- $meting = printf "" $res.RelPermalink -}}
{{- end -}}
{{- $jquery | safeHTML -}}
{{- $lazysizes | safeHTML -}}
{{- $smooth_scroll | safeHTML -}}
{{- if .IsPage -}}
{{/* dev feature */}}
{{- if .Params.dev -}}
{{- with .Scratch.Get "echartsMap" -}}
{{- $echarts | safeHTML -}}
{{- end -}}
{{- end -}}
{{/* dev feature */}}
{{- with .Scratch.Get "mermaidMap" -}}
{{- $mermaid | safeHTML -}}
{{- end -}}
{{- if or .Params.math .Site.Params.math -}}
{{- $katex | safeHTML -}}
{{- end -}}
{{- if .Scratch.Get "music" -}}
{{- $aplayer | safeHTML -}}
{{- $meting | safeHTML -}}
{{- end -}}
{{- with .Scratch.Get "countdownMap" -}}
{{- $countdown | safeHTML -}}
{{- end -}}
{{- end -}}
{{- $typeitMap := .Scratch.Get "typeitMap" -}}
{{- if $typeitMap -}}
{{- $typeit | safeHTML -}}
{{- $typeitArr := slice -}}
{{- range $key, $val := $typeitMap -}}
{{- $typeitArr = $typeitArr | append (slice $val) -}}
{{- end -}}
{{- end -}}
{{- $res := resources.Get "/js/blog.js" | resources.Minify -}}
{{- if not .Site.IsServer -}}
{{- template "_internal/google_analytics_async.html" . -}}
{{- end -}}