async function fetchNote(e=null){e||(e=document.body.getAttribute("data-note-id"));const t=await fetch(`api/notes/${e}`);return await t.json()}document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("toggleMenuButton"),t=document.getElementById("mobileMenuContainer"),n=document.getElementById("bloggerInfoCard"),o=document.getElementById("menuCard"),d=document.getElementById("main");let l=!1;e.addEventListener("click",()=>{e.classList.toggle("active"),l?(t.removeChild(n),t.removeChild(o),d.style.display="block",l=!1):(n.style.setProperty("display","flex","important"),o.style.setProperty("display","flex","important"),t.appendChild(n),t.appendChild(o),d.style.display="none",l=!0),t.classList.toggle("showMenu")})},!1),document.addEventListener("DOMContentLoaded",()=>{var e=document.querySelectorAll(".navigationItemsStyle");e.forEach(function(e){var t=e.querySelector(".menuLinkStyle"),n=e.querySelector(".dropDownStyle");if(!t||!n)return;var o=t.querySelector("svg");let d=!1;t.addEventListener("mouseover",function(){d=!0,n.style.display="flex",o.classList.add("unfolding")}),t.addEventListener("mouseout",function(){d=!1,setTimeout(function(){d||(n.style.display="none",o.classList.remove("unfolding"))},200)}),n.addEventListener("mouseover",function(){d=!0}),n.addEventListener("mouseout",function(){d=!1,setTimeout(function(){d||(n.style.display="none",o.classList.remove("unfolding"))},200)})})},!1),document.addEventListener("DOMContentLoaded",()=>{var e=window.pageYOffset;const t=10;window.onscroll=function(){var n=window.pageYOffset;const o=document.getElementById("navigationBar");n<100||(e>n?o.classList.remove("hide"):n-e>t&&!document.querySelector("#mobileMenuContainer.showMenu")&&o.classList.add("hide"),e=n)}},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("rewardBtn"),t=document.getElementById("rewardImgContainer");e&&e.addEventListener("click",function(){"flex"===t.style.display?(t.style.opacity="0",setTimeout(function(){t.style.display="none",t.style.flexWrap=""},500)):(t.style.opacity="1",t.style.display="flex",t.style.flexWrap="wrap")})},!1),document.addEventListener("DOMContentLoaded",()=>{function e(){let e=n.length;for(;--e&&window.scrollY<n[e].offsetTop;);o.forEach(e=>e.classList.remove("tocActive")),o[e].classList.add("tocActive")}const t=document.getElementById("toc");if(!t)return;const n=document.querySelectorAll("#content h2, #content h3, #content h4, #content h5, #content h6"),o=t.querySelectorAll("a");o.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=document.getElementById(e.getAttribute("href").slice(1));n&&n.scrollIntoView({behavior:"smooth"})})}),e(),window.addEventListener("scroll",e)},!1),document.addEventListener("DOMContentLoaded",()=>{function e(e,t){e.textContent=t,setTimeout(function(){e.textContent="Copy"},1e3)}function t(e){var t=window.getSelection(),n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),t}function n(n){var o=document.createElement("button");o.className="copyButtonStyle",o.textContent="Copy",o.setAttribute("title","复制");var d=n.firstElementChild;o.addEventListener("click",function(){try{var n=t(d);document.execCommand("copy"),n.removeAllRanges(),e(o,"Copied!")}catch(t){console&&console.log(t),e(o,"Failed")}}),n.appendChild(o)}if(document.queryCommandSupported("copy")){var o=document.querySelectorAll("pre");Array.prototype.forEach.call(o,n)}},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("onTop");e.addEventListener("click",e=>{window.scrollTo({top:0,behavior:"smooth"})})},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("content");if(!e)return;const t=document.getElementById("articleWordCount");t.innerText=e.innerText.split(/[\s-+:,/\\]+/).filter(e=>""!==e).join("").length},!1);