window.addEventListener("DOMContentLoaded",()=>{var e=document.querySelector(".toc_block");if(null!==e){e=e.querySelectorAll(".toc a");Array.prototype.forEach.call(e,n=>{let l=n.getAttribute("href")||"";var e;l&&(2===(e=l.split("#")).length&&(n.setAttribute("href",e[0]+"#"+decodeURIComponent(e[1])),l=n.getAttribute("href")),n.addEventListener("click",e=>{e.preventDefault(),l=n.getAttribute("href");var e=new URL(decodeURIComponent(l),location.href),t=new URL(decodeURIComponent(location.href)),o=e=>{var t,o=e.searchParams;if(o.has("p"))return t=o.get("page")||"1",`?p=${o.get("p")}&page=`+t;let n=decodeURIComponent(e.pathname);return n=(n=n.replace(/\/+$/,"")).replace(/\/\d+$/,"")};if(o(t)===o(e)){if(t.searchParams.has("p")){if(parseInt(t.searchParams.get("page")||"1")!==parseInt(e.searchParams.get("page")||"1"))return void(window.location.href=l)}else{o=t.pathname.match(/\/(\d+)\/?$/),t=e.pathname.match(/\/(\d+)\/?$/);if((o?parseInt(o[1]):1)!==(t?parseInt(t[1]):1))return void(window.location.href=l)}o=e.hash;o&&i(o)}else window.location.href=l}))});{let n=document.querySelector(".toc__caption"),l=document.querySelector(".toc");if(null!==n&&null!==l){let e="none"!==l.style.display;n.addEventListener("click",()=>{e=!e;var t=n.querySelector(".open"),o=n.querySelector(".close");if(e){t.style.display="none",o.style.display="";let e=getComputedStyle(l).paddingBottom;l.style.height=0,l.style.overflow="hidden",l.style.paddingBottom=0,l.style.display="",setTimeout(function(){l.style.paddingBottom=e,l.style.height=l.scrollHeight+parseInt(e)+"px"},1),setTimeout(function(){l.style.height="",l.style.overflow="",l.style.paddingBottom=""},400)}else t.style.display="",o.style.display="none",l.style.height=l.scrollHeight+"px",l.style.overflow="hidden",setTimeout(function(){l.style.height=0,l.style.paddingBottom=0},1),setTimeout(function(){l.style.display="none",l.style.paddingBottom="",l.style.height="",l.style.overflow=""},400)})}}window.location.hash&&setTimeout(()=>{i(window.location.hash)},0),window.addEventListener("load",()=>{window.location.hash&&setTimeout(()=>{i(window.location.hash)},0)})}function i(t){let e;if("#"===t||""===t)e=document.querySelector("html");else{var o=decodeURIComponent(t.substring(1));if(!(e=document.getElementById(o)))try{e=document.querySelector(t)}catch(e){return void console.warn("Target element not found: "+t)}}var o=e.getBoundingClientRect().top,n=window.scrollY;let l=o+n-50;var i,a,r=document.querySelector(".header-fix");null!==r&&(i=r.offsetHeight,a=document.documentElement.offsetWidth,r.classList.contains("-for-pc")&&992<a||r.classList.contains("-for-mb")&&a<991)&&(l=o+n-2*i),history.pushState("","",t),window.scrollTo({top:l,behavior:"smooth"})}});