document.addEventListener("DOMContentLoaded",function(){let e=document.getElementById("search-chapter-list"),s=document.getElementById("chapters-list-holder"),t=s.querySelectorAll(".chapter-list-item"),l=document.getElementById("switch-list-order");e.addEventListener("input",function(){let s=e.value.trim();if(""===s||isNaN(s)){t.forEach(e=>{e.classList.contains("d-none")&&(e.classList.remove("d-none"),e.classList.add("d-block"))});return}t.forEach(e=>{e.querySelector(".chapter-name").textContent.includes(s)?e.classList.contains("d-none")&&(e.classList.remove("d-none"),e.classList.add("d-block")):e.classList.contains("d-block")&&(e.classList.remove("d-block"),e.classList.add("d-none"))})}),l.addEventListener("click",function(){l.setAttribute("disabled",!0),s.classList.contains("flex-column")?(s.classList.remove("flex-column"),s.classList.add("flex-column-reverse")):(s.classList.remove("flex-column-reverse"),s.classList.add("flex-column")),s.classList.contains("flex-column")?s.scrollTop=0:s.scrollTop=-s.scrollHeight,setTimeout(function(){l.removeAttribute("disabled")},250)})});