From d6da11798165cb29235a25c7caea844b43119111 Mon Sep 17 00:00:00 2001 From: Takagi Date: Thu, 5 Dec 2024 11:56:19 +0800 Subject: [PATCH] fix: resolve issue with links not working due to mobile navigation bar (#595) --- src/module/events.ts | 9 ++++++--- templates/assets/dist/main.min.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/module/events.ts b/src/module/events.ts index 48f80cc5..637d00a9 100644 --- a/src/module/events.ts +++ b/src/module/events.ts @@ -212,9 +212,12 @@ export class Events { }); document.querySelector(".container")?.addEventListener("click", (event) => { - event.stopPropagation(); - event.preventDefault(); - this.closeMobileNav(); + const siteSidebarElement = document.querySelector(".site-sidebar"); + if (siteSidebarElement && siteSidebarElement.classList.contains("open")) { + event.stopPropagation(); + event.preventDefault(); + this.closeMobileNav(); + } }); document.querySelectorAll(".menu-root .menu-item").forEach((element) => { diff --git a/templates/assets/dist/main.min.js b/templates/assets/dist/main.min.js index 0a3df9ae..3bb43ee5 100644 --- a/templates/assets/dist/main.min.js +++ b/templates/assets/dist/main.min.js @@ -1,4 +1,4 @@ -var cr=Object.defineProperty;var lr=(r,e,t)=>e in r?cr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var C=(r,e,t)=>(lr(r,typeof e!="symbol"?e+"":e,t),t);import{g as fr}from"./assets/_commonjsHelpers-042e6b4d.js";const dr="modulepreload",gr=function(r){return"/themes/theme-sakura/assets/dist/"+r},Tt={},j=function(e,t,i){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(o=>{if(o=gr(o),o in Tt)return;Tt[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!i)for(let c=n.length-1;c>=0;c--){const f=n[c];if(f.href===o&&(!a||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const l=document.createElement("link");if(l.rel=a?"stylesheet":dr,a||(l.as="script",l.crossOrigin=""),l.href=o,document.head.appendChild(l),a)return new Promise((c,f)=>{l.addEventListener("load",c),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())},hr=(r,e)=>{const t=r[e];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((i,n)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+e)))})},ne=class{static async retry(e,t=3,i=1e3){try{return await e()}catch(n){if(t>0)return await new Promise(o=>setTimeout(o,i)),await ne.retry(e,t-1,i);throw n}}static jsonToMap(e){try{let t=e;e instanceof String&&(t=JSON.parse(e.toString()));const i=Object.entries(t);return new Map(i)}catch(t){throw new Error(`解析 JSON 失败:${t.message}`)}}static generateColor(){const e=Math.floor(Math.random()*360),t=Math.floor(Math.random()*50)+50,i=Math.floor(Math.random()*40)+50,n=e/60,o=t/100,a=i/100,s=(1-Math.abs(2*a-1))*o,u=s*(1-Math.abs(n%2-1)),l=a-s/2;let c,f,g;0<=n&&n<1?[c,f,g]=[s,u,0]:1<=n&&n<2?[c,f,g]=[u,s,0]:2<=n&&n<3?[c,f,g]=[0,s,u]:3<=n&&n<4?[c,f,g]=[0,u,s]:4<=n&&n<5?[c,f,g]=[u,0,s]:[c,f,g]=[s,0,u],c=Math.round((c+l)*255),f=Math.round((f+l)*255),g=Math.round((g+l)*255);const d=c.toString(16).padStart(2,"0"),h=f.toString(16).padStart(2,"0"),v=g.toString(16).padStart(2,"0");return`#${d}${h}${v}`}static getWordCount(e){var t,i;return((i=(t=e.textContent)==null?void 0:t.normalize().match(ne.wordPattern))==null?void 0:i.length)??0}static caclEstimateReadTime(e,t=3){t=Math.min(6,Math.max(1,t));var n=400+(t-1)*100;return Math.ceil(e/n*60)}};let ge=ne;C(ge,"PatternString",{cjk:"\\p{Script=Han}|\\p{Script=Kana}|\\p{Script=Hira}|\\p{Script=Hangul}",word:"[\\p{L}|\\p{N}|._]+"}),C(ge,"wordPattern",new RegExp(`${ne.PatternString.cjk}|${ne.PatternString.word}`,"gu"));const wt=class{static addEventListener(e,t,i){let n=wt.throttle(t,i),o=this.eventThrottles.get(e);o||(o=new Set,this.eventThrottles.set(e,o)),o.add(n),window.addEventListener(e,n)}static throttle(e,t){let i=null;return(...n)=>{i||(e.apply(this,n),i=window.setTimeout(()=>{i=null},t))}}};let he=wt;C(he,"eventThrottles",new Map);var pr=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,A=(r,e,t,i)=>{for(var n=i>1?void 0:i?mr(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&pr(e,t,n),n};class N{searchModal(){const e=document.querySelector(".searchbox");if(!e)return;if(!S.getPageConfig("showSearchModal")){e.addEventListener("click",()=>{SearchWidget.open()});return}const t=document.querySelector(".search-form.search-form-modal");if(!t)return;e.addEventListener("click",()=>{t.classList.add("is-visible")});const i=a=>{if(!S.$pjax)return;a.preventDefault();const s=a.target;if(!(s&&s instanceof HTMLFormElement))return;const u=s.action,l=s.keyword;S.$pjax.loadUrl(`${u}?${l.name}=${l.value}`),t.classList.remove("is-visible"),S.$pjax.refresh(),this.closeMobileNav()};document.querySelectorAll(".search-form").forEach(a=>{a.addEventListener("submit",i)});const o=document.querySelector(".search-close");o&&o.addEventListener("click",()=>{t.classList.remove("is-visible")})}registerScrollEvent(){var a;const e=((a=document.querySelector(".site-header"))==null?void 0:a.offsetHeight)||75,t=document.querySelector(".cd-top"),i=document.querySelector(".m-cd-top"),n=document.querySelector(".change-skin-gear"),o=document.querySelector(".mobile-change-skin");window.addEventListener("scroll",()=>{document.documentElement.scrollTop>e?(t==null||t.classList.add("cd-is-visible"),n.style.bottom="0",t.offsetHeight>window.innerHeight?t.style.top=`${window.innerHeight-t.offsetHeight-e}px`:t.style.top="0"):(t.style.top="-900px",t==null||t.classList.remove("cd-is-visible"),n.style.bottom="-100px"),document.documentElement.scrollTop>0?(i.classList.add("cd-is-visible"),o.classList.add("cd-is-visible")):(i.classList.remove("cd-is-visible"),o.classList.remove("cd-is-visible"))})}registerBackToTopEvent(){document.querySelectorAll(".cd-top, .m-cd-top").forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),window.pageYOffset>0&&window.scrollTo({top:0,behavior:"smooth"})})})}registerCopyEvent(){he.addEventListener("copy",()=>{S.$toast&&S.$toast.create(S.translate("common.events.copy","复制成功!
Copied to clipboard successfully!"),2e3)},2e3)}registerCodeBlockZoomEvent(){document.querySelectorAll("pre").forEach(t=>{t.addEventListener("dblclick",i=>{var n;i.target===t&&(t.classList.toggle("code-block-fullscreen"),(n=document.querySelector("html"))==null||n.classList.toggle("code-block-fullscreen-html-scroll"))})})}registerNavigationChangeEvent(){window.addEventListener("hashchange",e=>{if(e.oldURL.includes("#gallery-"))return;const i=location.hash.substring(1);if(!i.match(/^[A-z0-9_-]+$/))return;const n=document.getElementById(i);n&&(n.tagName.match(/^(?:a|select|input|button|textarea)$/i)||(n.tabIndex=-1),n.focus())},!1)}registerMobileNav(){var t,i,n;const e=document.querySelectorAll(".container, .site-nav-toggle, .site-sidebar");(t=document.querySelector(".nav-toggle"))==null||t.addEventListener("click",o=>{o.stopPropagation(),o.preventDefault(),e.forEach(a=>{a.classList.add("open")})}),(i=document.querySelector(".sidebar-close"))==null||i.addEventListener("click",o=>{o.stopPropagation(),this.closeMobileNav()}),(n=document.querySelector(".container"))==null||n.addEventListener("click",o=>{o.stopPropagation(),o.preventDefault(),this.closeMobileNav()}),document.querySelectorAll(".menu-root .menu-item").forEach(o=>{o.addEventListener("click",()=>{this.closeMobileNav()})})}closeMobileNav(){document.querySelectorAll(".container, .site-nav-toggle, .site-sidebar").forEach(t=>{t.classList.remove("open")})}registerHeaderEvent(){let t=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;window.addEventListener("scroll",()=>{const i=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,n=document.querySelector(".site-header");i===0?n==null||n.classList.remove("yya"):n==null||n.classList.add("yya"),i>t?n==null||n.classList.remove("sabit"):n==null||n.classList.add("sabit"),t=i,j(()=>import("./assets/nprogress-2b5a08a9.js").then(o=>o.n),["assets/nprogress-2b5a08a9.js","assets/_commonjsHelpers-042e6b4d.js"]).then(o=>{o.default.configure({minimum:0,template:` +var cr=Object.defineProperty;var lr=(r,e,t)=>e in r?cr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var C=(r,e,t)=>(lr(r,typeof e!="symbol"?e+"":e,t),t);import{g as fr}from"./assets/_commonjsHelpers-042e6b4d.js";const dr="modulepreload",gr=function(r){return"/themes/theme-sakura/assets/dist/"+r},Tt={},j=function(e,t,i){if(!t||t.length===0)return e();const n=document.getElementsByTagName("link");return Promise.all(t.map(o=>{if(o=gr(o),o in Tt)return;Tt[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!i)for(let c=n.length-1;c>=0;c--){const f=n[c];if(f.href===o&&(!a||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const l=document.createElement("link");if(l.rel=a?"stylesheet":dr,a||(l.as="script",l.crossOrigin=""),l.href=o,document.head.appendChild(l),a)return new Promise((c,f)=>{l.addEventListener("load",c),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())},hr=(r,e)=>{const t=r[e];return t?typeof t=="function"?t():Promise.resolve(t):new Promise((i,n)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+e)))})},ne=class{static async retry(e,t=3,i=1e3){try{return await e()}catch(n){if(t>0)return await new Promise(o=>setTimeout(o,i)),await ne.retry(e,t-1,i);throw n}}static jsonToMap(e){try{let t=e;e instanceof String&&(t=JSON.parse(e.toString()));const i=Object.entries(t);return new Map(i)}catch(t){throw new Error(`解析 JSON 失败:${t.message}`)}}static generateColor(){const e=Math.floor(Math.random()*360),t=Math.floor(Math.random()*50)+50,i=Math.floor(Math.random()*40)+50,n=e/60,o=t/100,a=i/100,s=(1-Math.abs(2*a-1))*o,u=s*(1-Math.abs(n%2-1)),l=a-s/2;let c,f,g;0<=n&&n<1?[c,f,g]=[s,u,0]:1<=n&&n<2?[c,f,g]=[u,s,0]:2<=n&&n<3?[c,f,g]=[0,s,u]:3<=n&&n<4?[c,f,g]=[0,u,s]:4<=n&&n<5?[c,f,g]=[u,0,s]:[c,f,g]=[s,0,u],c=Math.round((c+l)*255),f=Math.round((f+l)*255),g=Math.round((g+l)*255);const d=c.toString(16).padStart(2,"0"),h=f.toString(16).padStart(2,"0"),v=g.toString(16).padStart(2,"0");return`#${d}${h}${v}`}static getWordCount(e){var t,i;return((i=(t=e.textContent)==null?void 0:t.normalize().match(ne.wordPattern))==null?void 0:i.length)??0}static caclEstimateReadTime(e,t=3){t=Math.min(6,Math.max(1,t));var n=400+(t-1)*100;return Math.ceil(e/n*60)}};let ge=ne;C(ge,"PatternString",{cjk:"\\p{Script=Han}|\\p{Script=Kana}|\\p{Script=Hira}|\\p{Script=Hangul}",word:"[\\p{L}|\\p{N}|._]+"}),C(ge,"wordPattern",new RegExp(`${ne.PatternString.cjk}|${ne.PatternString.word}`,"gu"));const wt=class{static addEventListener(e,t,i){let n=wt.throttle(t,i),o=this.eventThrottles.get(e);o||(o=new Set,this.eventThrottles.set(e,o)),o.add(n),window.addEventListener(e,n)}static throttle(e,t){let i=null;return(...n)=>{i||(e.apply(this,n),i=window.setTimeout(()=>{i=null},t))}}};let he=wt;C(he,"eventThrottles",new Map);var pr=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,A=(r,e,t,i)=>{for(var n=i>1?void 0:i?mr(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&pr(e,t,n),n};class N{searchModal(){const e=document.querySelector(".searchbox");if(!e)return;if(!S.getPageConfig("showSearchModal")){e.addEventListener("click",()=>{SearchWidget.open()});return}const t=document.querySelector(".search-form.search-form-modal");if(!t)return;e.addEventListener("click",()=>{t.classList.add("is-visible")});const i=a=>{if(!S.$pjax)return;a.preventDefault();const s=a.target;if(!(s&&s instanceof HTMLFormElement))return;const u=s.action,l=s.keyword;S.$pjax.loadUrl(`${u}?${l.name}=${l.value}`),t.classList.remove("is-visible"),S.$pjax.refresh(),this.closeMobileNav()};document.querySelectorAll(".search-form").forEach(a=>{a.addEventListener("submit",i)});const o=document.querySelector(".search-close");o&&o.addEventListener("click",()=>{t.classList.remove("is-visible")})}registerScrollEvent(){var a;const e=((a=document.querySelector(".site-header"))==null?void 0:a.offsetHeight)||75,t=document.querySelector(".cd-top"),i=document.querySelector(".m-cd-top"),n=document.querySelector(".change-skin-gear"),o=document.querySelector(".mobile-change-skin");window.addEventListener("scroll",()=>{document.documentElement.scrollTop>e?(t==null||t.classList.add("cd-is-visible"),n.style.bottom="0",t.offsetHeight>window.innerHeight?t.style.top=`${window.innerHeight-t.offsetHeight-e}px`:t.style.top="0"):(t.style.top="-900px",t==null||t.classList.remove("cd-is-visible"),n.style.bottom="-100px"),document.documentElement.scrollTop>0?(i.classList.add("cd-is-visible"),o.classList.add("cd-is-visible")):(i.classList.remove("cd-is-visible"),o.classList.remove("cd-is-visible"))})}registerBackToTopEvent(){document.querySelectorAll(".cd-top, .m-cd-top").forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),window.pageYOffset>0&&window.scrollTo({top:0,behavior:"smooth"})})})}registerCopyEvent(){he.addEventListener("copy",()=>{S.$toast&&S.$toast.create(S.translate("common.events.copy","复制成功!
Copied to clipboard successfully!"),2e3)},2e3)}registerCodeBlockZoomEvent(){document.querySelectorAll("pre").forEach(t=>{t.addEventListener("dblclick",i=>{var n;i.target===t&&(t.classList.toggle("code-block-fullscreen"),(n=document.querySelector("html"))==null||n.classList.toggle("code-block-fullscreen-html-scroll"))})})}registerNavigationChangeEvent(){window.addEventListener("hashchange",e=>{if(e.oldURL.includes("#gallery-"))return;const i=location.hash.substring(1);if(!i.match(/^[A-z0-9_-]+$/))return;const n=document.getElementById(i);n&&(n.tagName.match(/^(?:a|select|input|button|textarea)$/i)||(n.tabIndex=-1),n.focus())},!1)}registerMobileNav(){var t,i,n;const e=document.querySelectorAll(".container, .site-nav-toggle, .site-sidebar");(t=document.querySelector(".nav-toggle"))==null||t.addEventListener("click",o=>{o.stopPropagation(),o.preventDefault(),e.forEach(a=>{a.classList.add("open")})}),(i=document.querySelector(".sidebar-close"))==null||i.addEventListener("click",o=>{o.stopPropagation(),this.closeMobileNav()}),(n=document.querySelector(".container"))==null||n.addEventListener("click",o=>{const a=document.querySelector(".site-sidebar");a&&a.classList.contains("open")&&(o.stopPropagation(),o.preventDefault(),this.closeMobileNav())}),document.querySelectorAll(".menu-root .menu-item").forEach(o=>{o.addEventListener("click",()=>{this.closeMobileNav()})})}closeMobileNav(){document.querySelectorAll(".container, .site-nav-toggle, .site-sidebar").forEach(t=>{t.classList.remove("open")})}registerHeaderEvent(){let t=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;window.addEventListener("scroll",()=>{const i=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,n=document.querySelector(".site-header");i===0?n==null||n.classList.remove("yya"):n==null||n.classList.add("yya"),i>t?n==null||n.classList.remove("sabit"):n==null||n.classList.add("sabit"),t=i,j(()=>import("./assets/nprogress-2b5a08a9.js").then(o=>o.n),["assets/nprogress-2b5a08a9.js","assets/_commonjsHelpers-042e6b4d.js"]).then(o=>{o.default.configure({minimum:0,template:`
`});const a=document.documentElement.scrollHeight-document.documentElement.clientHeight,s=i/a;o.default.set(s)})})}registerPostListPaginationEvent(){const e=document.getElementById("pagination");if(!e)return;const t=e.querySelector("a");t&&t.addEventListener("click",i=>{i.preventDefault();const n=document.getElementById("main");if(!n)return;const o=i.target,a=o.href;return o.classList.add("loading"),o.textContent="",fetch(a,{method:"GET"}).then(s=>s.text()).then(s=>{const l=new DOMParser().parseFromString(s,"text/html"),c=l.querySelectorAll("#main .post");c&&c.length>0&&c.forEach(g=>{n.appendChild(g)}),S.$pjax&&S.$pjax.refresh(n);const f=l.querySelector("#pagination a");f?o.href=f.href:e.innerHTML=`${S.translate("page.theend","没有更多文章了")}`}).catch(s=>{console.error(s)}).finally(()=>{o.classList.remove("loading"),o.textContent=S.translate("page.next","下一页"),S.$localize&&S.$localize(".post")}),!1})}registerThemeChangeEvent(){document.querySelectorAll(".theme-change-js").forEach(t=>{t.addEventListener("click",()=>{var i;(i=document.querySelector(".skin-menu"))==null||i.classList.toggle("show")})})}registerThemeItemClickEventAndDefaultTheme(){const e=document.querySelector(".skin-menu"),t=e==null?void 0:e.querySelectorAll(".skin-menu .menu-item");t==null||t.forEach(i=>{const n=JSON.parse(i.getAttribute("data-item")||"{}");n.bg_isdefault&&this.registerThemeRevert(n),i.addEventListener("click",()=>{this.registerThemeRevert(n),localStorage.setItem("sakuraTheme",JSON.stringify(n)),e==null||e.classList.remove("show"),localStorage.setItem("systemMode","false")})}),he.addEventListener("scroll",()=>{e==null||e.classList.remove("show")},200)}registerThemeRevert(e){if(!e){const i=localStorage.getItem("sakuraTheme");if(!i)return;e=JSON.parse(i)}const t=document.querySelector("body");switch(e!=null&&e.bg_url?t.style.backgroundImage=`url(${e==null?void 0:e.bg_url})`:t.style.backgroundImage="",e!=null&&e.bg_night?t.classList.add("dark"):t.classList.remove("dark"),e==null?void 0:e.bg_img_strategy){case"cover":t.style.backgroundSize="cover";break;case"no-repeat":case"repeat":t.style.backgroundRepeat=e.bg_img_strategy;break;default:t.style.backgroundSize="auto",t.style.backgroundRepeat="auto";break}}registerSystemDarkModeChangeEvent(){const e=document.querySelector("body"),t=localStorage.getItem("systemMode"),i=window.matchMedia("(prefers-color-scheme: dark)");(!t||t==="true")&&(i.matches?e.classList.add("dark"):e.classList.remove("dark")),window.matchMedia("(prefers-color-scheme: dark)").onchange=n=>{n.matches?e.classList.add("dark"):e.classList.remove("dark"),localStorage.setItem("systemMode","true")}}}A([P(!1)],N.prototype,"searchModal",1);A([P(!1)],N.prototype,"registerScrollEvent",1);A([P(!1)],N.prototype,"registerBackToTopEvent",1);A([P(!1)],N.prototype,"registerCopyEvent",1);A([P()],N.prototype,"registerCodeBlockZoomEvent",1);A([P(!1)],N.prototype,"registerNavigationChangeEvent",1);A([P(!1)],N.prototype,"registerMobileNav",1);A([P(!1)],N.prototype,"registerHeaderEvent",1);A([P()],N.prototype,"registerPostListPaginationEvent",1);A([P(!1)],N.prototype,"registerThemeChangeEvent",1);A([P(!1)],N.prototype,"registerThemeItemClickEventAndDefaultTheme",1);A([P(!1)],N.prototype,"registerThemeRevert",1);A([P(!1)],N.prototype,"registerSystemDarkModeChangeEvent",1);var vr=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,W=(r,e,t,i)=>{for(var n=i>1?void 0:i?yr(e,t):e,o=r.length-1,a;o>=0;o--)(a=r[o])&&(n=(i?a(e,t,n):a(n))||n);return i&&n&&vr(e,t,n),n};class Q{loadHeaderAnimationCss(){const e=document.querySelectorAll(".menu-item .animation");e&&e.length>0&&j(()=>Promise.resolve({}),["css/font-awesome-animation.min.min.css"])}registerFixedAPlayer(){var u,l,c,f,g;if(!((u=S.getThemeConfig("additional","aplayer_float",Boolean))==null?void 0:u.valueOf()))return;const t=(l=S.getThemeConfig("additional","aplayer_host",String))==null?void 0:l.valueOf(),i=(c=S.getThemeConfig("additional","aplayer_server",String))==null?void 0:c.valueOf(),n=(f=S.getThemeConfig("additional","aplayer_type",String))==null?void 0:f.valueOf(),o=(g=S.getThemeConfig("additional","aplayer_id",String))==null?void 0:g.valueOf(),a=`${t}?server=${i}&type=${n}&id=${o}&r=${Math.random()}`;fetch(a).then(d=>d.json()).then(d=>{j(()=>import("./assets/APlayer.min-1b5a4167.js").then(h=>h.A),["assets/APlayer.min-1b5a4167.js","assets/_commonjsHelpers-042e6b4d.js"]).then(async h=>{var b,w,x,O,L,T;await j(()=>Promise.resolve({}),["css/APlayer.min.min.css"]);const v=h.default,y=s(),p={container:y,mini:!0,fixed:!0,autoplay:((b=S.getThemeConfig("additional","aplayer_autoplay",Boolean))==null?void 0:b.valueOf())||!1,mutex:!0,lrcType:3,preload:((w=S.getThemeConfig("additional","aplayer_preload",String))==null?void 0:w.valueOf())||"auto",theme:((x=S.getThemeConfig("additional","aplayer_theme",String))==null?void 0:x.valueOf())||"#2980b9",loop:"all",order:((O=S.getThemeConfig("additional","aplayer_order",String))==null?void 0:O.valueOf())||"list",volume:((L=S.getThemeConfig("additional","aplayer_volume",Number))==null?void 0:L.valueOf())||null,listFolded:!1,listMaxHeight:"250px",customAudioType:null,storageName:"sakura",audio:{}};p.audio=d;const m=new v(p);m.lrc.hide(),(T=y.querySelector(".aplayer-body"))==null||T.classList.add("ap-hover"),y.addEventListener("click",()=>{m.lrc.show()},{once:!0})})}).catch(d=>{console.error("APlayer API Error: ",d)});const s=()=>{if(document.querySelector("#aplayer-float"))return document.querySelector("#aplayer-float");const d=document.createElement("div");return d.id="aplayer-float",d.classList.add("aplayer"),d.classList.add("aplayer-float"),document.body.appendChild(d),d}}registerHeaderClass(){const e=document.querySelector(".container");S.getPageConfig("_templateId")==="index"?e.classList.add("is-homepage"):e.classList.remove("is-homepage")}wrapTableWithBox(){const e=document.querySelector(".entry-content"),t=e==null?void 0:e.querySelectorAll("table");t==null||t.forEach(i=>{var o,a;if((o=i.parentElement)!=null&&o.classList.contains("table-wrapper"))return;const n=document.createElement("div");n.classList.add("table-wrapper"),(a=i.parentNode)==null||a.insertBefore(n,i),n.appendChild(i)})}wrapWithFancybox(){const e=document.querySelectorAll(".fancybox-content");e==null||e.forEach(t=>{t.classList.contains("gallery")||(this.wrapImageWithBox(t),this.wrapVideoWithBox(t),j(()=>import("./assets/index.esm-e5442572.js"),[]).then(async i=>{await j(()=>Promise.resolve({}),["css/fancybox.min.css"]),await i.Fancybox.bind(t,'[data-fancybox="gallery"]')}))})}wrapVideoWithBox(e){const t=e==null?void 0:e.querySelectorAll("video");t&&t.forEach(i=>{this.buildFancybox(i).classList.add("video-wrapper")})}wrapImageWithBox(e){const t=e==null?void 0:e.querySelectorAll("img:not(.avatar)");t&&t.forEach(i=>{this.buildFancybox(i).classList.add("image-wrapper")})}buildFancybox(e){var i;const t=document.createElement("a");return t.setAttribute("data-fancybox","gallery"),e.getAttribute("data-src")?t.setAttribute("href",e.getAttribute("data-src")||""):t.setAttribute("href",e.getAttribute("src")||""),(i=e.parentNode)==null||i.insertBefore(t,e),e.classList.add("gallery"),t.appendChild(e),t}registerHighlight(){document.querySelectorAll("pre").forEach(t=>{t.classList.add("highlight-wrap"),t.setAttribute("autocomplete","off"),t.setAttribute("autocorrect","off"),t.setAttribute("autocapitalize","off"),t.setAttribute("spellcheck","false"),t.setAttribute("contenteditable","false");const i=t.querySelector("code");j(()=>import("./assets/index-c0aec26a.js"),["assets/index-c0aec26a.js","assets/_commonjsHelpers-042e6b4d.js"]).then(async n=>{var u;let o="";if(i.classList.forEach(l=>{l.startsWith("language-")&&(o=l.replace("language-",""))}),!n.default.getLanguage(o)){i.classList.remove(`language-${o}`);const l=n.default.highlightAuto(i.textContent||"");l.language?o=l.language:o="text",i.classList.add(`language-${o}`)}if(i.setAttribute("data-rel",o.toUpperCase()),i.classList.add(o.toLowerCase()),n.default.highlightElement(i),(u=S.getThemeConfig("post","code_line",Boolean))==null?void 0:u.valueOf()){const l=await j(()=>import("./libs/highlightjs-line-numbers.min.js"),[]);l.registerHljsLineNumbers(n.default),l.injectHljsLineNumbersCss(),n.default.lineNumbersBlock(i)}})})}registerCopyCode(){document.querySelectorAll("pre code").forEach(t=>{const i=document.createElement("span");i.classList.add("copy-code"),i.classList.add("flex-child-center"),i.setAttribute("title",S.translate("common.copy_code","复制代码")),i.innerHTML='',t.after(i),j(()=>import("./assets/clipboard-8ef9d310.js").then(n=>n.c),["assets/clipboard-8ef9d310.js","assets/_commonjsHelpers-042e6b4d.js"]).then(n=>{new n.default(i,{target:()=>t})})})}registerToc(){const e=document.querySelectorAll(".toc-container"),t=75;e==null||e.forEach(i=>{j(()=>import("./assets/index-5fe31283.js").then(n=>n.i),["assets/index-5fe31283.js","assets/_commonjsHelpers-042e6b4d.js"]).then(n=>{var u;const o=i.querySelector(".toc"),a=i.getBoundingClientRect().top+window.pageYOffset,s=(u=S.getThemeConfig("post","toc_depth",Number))==null?void 0:u.valueOf();o&&n.default.init({tocElement:o,contentSelector:[".entry-content",".links"],headingSelector:"h1, h2, h3, h4, h5",collapseDepth:s,scrollSmooth:!0,headingsOffset:-(a-t),scrollSmoothOffset:-t,disableTocScrollSync:!0})})})}}W([P(!1)],Q.prototype,"loadHeaderAnimationCss",1);W([P(!1)],Q.prototype,"registerFixedAPlayer",1);W([P()],Q.prototype,"registerHeaderClass",1);W([P()],Q.prototype,"wrapTableWithBox",1);W([P()],Q.prototype,"wrapWithFancybox",1);W([P()],Q.prototype,"registerHighlight",1);W([P()],Q.prototype,"registerCopyCode",1);W([P()],Q.prototype,"registerToc",1);/**