var customSearch,Debounce=(o,t)=>{let e=t||100,a;return function(){let t=arguments;a&&clearTimeout(a),a=setTimeout(()=>{a=null,o.apply(this,t)},e)}};!function(n){"use strict";volantis.$bodyAnchor=n("#safearea"),volantis.$topBtn=n("#s-top"),volantis.$wrapper=n("#wrapper"),volantis.$postsBtn=n(".menu .active"),volantis.$titleBtn=n("h1.title","#header-meta"),volantis.$coverAnchor=n("#l_cover .cover-wrapper"),volantis.$switcher=n("#l_header .switcher .s-search"),volantis.$header=n("#l_header"),volantis.$headerMenu=n("body .navigation"),volantis.$search=n("#l_header .m_search"),volantis.$mPhoneList=n("#l_header .m-phone .list-v");const t=/mobile/i.test(window.navigator.userAgent);var o,i=80;function s(t,o=i){const e=t.href?n(decodeURI(t.getAttribute("href"))):n(t);window.scrollTo({top:e.offset().top-o,behavior:"smooth"})}function e(){volantis.$postsBtn.length&&volantis.$bodyAnchor&&volantis.$postsBtn.click(t=>{t.preventDefault(),t.stopPropagation(),"/"!=volantis.$postsBtn.attr("href")&&s(volantis.$bodyAnchor),t.stopImmediatePropagation(),volantis.$postsBtn.unbind("click")}),volantis.$titleBtn.length&&volantis.$bodyAnchor&&volantis.$titleBtn.click(t=>{t.preventDefault(),t.stopPropagation(),s(volantis.$bodyAnchor),t.stopImmediatePropagation(),volantis.$titleBtn.unbind("click")}),volantis.$topBtn.length&&volantis.$bodyAnchor&&volantis.$topBtn.click(t=>{t.preventDefault(),t.stopPropagation(),s(volantis.$bodyAnchor),t.stopImmediatePropagation()});var e=volantis.$bodyAnchor.offset().top-i,a=document.body.scrollTop;n(document,window).scroll(Debounce(()=>{var t=n(window).scrollTop(),o=t-a;(a=t)>volantis.$bodyAnchor.offset().top?(volantis.$topBtn.addClass("show"),0<o?volantis.$topBtn.removeClass("hl"):volantis.$topBtn.addClass("hl")):volantis.$topBtn.removeClass("show").removeClass("hl"),-1<t-e?volantis.$header.addClass("show"):volantis.$header.removeClass("show")}))}function a(){if(pdata.ispage&&(window.subData={title:pdata.postTitle,tools:!0}),window.subData){volantis.$comment=n("#s-comment"),volantis.$toc=n("#s-toc"),volantis.$commentTarget=n("#l_body article#comments"),volantis.$wrapper.find(".nav-sub .title").text(window.subData.title);let e=document.body.scrollTop;n(document,window).scroll(()=>{var t=n(window).scrollTop(),o=t-e;50<=o&&100<t?(e=t,volantis.$wrapper.addClass("sub")):o<=-50&&(e=t,volantis.$wrapper.removeClass("sub"))}),volantis.$commentTarget.length?volantis.$comment.click(t=>{t.preventDefault(),t.stopPropagation(),s(volantis.$commentTarget),t.stopImmediatePropagation()}):volantis.$comment.remove(),volantis.$tocTarget=n("#l_body .toc-wrapper"),volantis.$tocTarget.length&&volantis.$tocTarget.children().length?(volantis.$toc.click(t=>{t.stopPropagation(),volantis.$tocTarget.toggleClass("active"),volantis.$toc.toggleClass("active")}),n(document).click(function(t){t.stopPropagation(),volantis.$tocTarget.removeClass("active"),volantis.$toc.removeClass("active")}),n(document,window).scroll(Debounce(()=>{volantis.$tocTarget.removeClass("active"),volantis.$toc.removeClass("active")},100))):volantis.$toc.remove()}}function l(){volantis.$headerMenu.find("li a.active").removeClass("active"),volantis.$headerMenu.find("div a.active").removeClass("active");var t,o=location.pathname.replace(/\/|%|\./g,""),e=(o=0==o.length?"home":o).match(/page\d{0,}$/g);e&&(e=e[0],o=o.split(e)[0]);var a,e=o.match(/index.html/);e&&(e=e[0],o=o.split(e)[0]),(o=o.replace(/(\[|\]|~|#|@)/g,"\\$1"))&&volantis.$headerMenu&&(t=n("#"+o,volantis.$headerMenu),(a=t)&&a.length&&a.addClass("active").siblings().removeClass("active"))}function c(){t&&(n(document).click(function(t){volantis.$mPhoneList.hide()}),n(window).scroll(Debounce(()=>{volantis.$mPhoneList.hide()},25)))}function r(){n(".tabs .nav-tabs").on("click","a",t=>{t.preventDefault(),t.stopPropagation();let o=n(t.target.parentElement.parentElement.parentElement);return o.find(".nav-tabs .active").removeClass("active"),o.find(t.target.parentElement).addClass("active"),o.find(".tab-content .active").removeClass("active"),o.find(n(t.target).attr("class")).addClass("active"),!1})}volantis.$header[0]&&(i=volantis.$header[0].clientHeight+16),n(function(){a(),l(),t?n("#l_header .m-phone li").click(function(t){t.stopPropagation(),n(n(t.currentTarget).children("ul")).show()}):n("#wrapper .m-pc li > a[href]").parent().click(function(t){t.stopPropagation(),t.target.origin==t.target.baseURI&&n("#wrapper .m-pc .list-v").hide()}),c(),0!==volantis.$switcher.length&&(volantis.$switcher.click(function(t){t.stopPropagation(),volantis.$header.toggleClass("z_search-open"),volantis.$switcher.toggleClass("active"),volantis.$search.find("input").focus()}),n(document).click(function(t){volantis.$header.removeClass("z_search-open"),volantis.$switcher.removeClass("active")}),volantis.$search.click(function(t){t.stopPropagation()}),volantis.$header.ready(function(){volantis.$header.bind("keydown",function(t){if(9==t.keyCode)return!1;var o,e=!!document.all,t=e?(o=window.event.keyCode,window.event):(o=t.which,t);9==o&&(e?(t.keyCode=0,t.returnValue=!1):(t.which=0,t.preventDefault()))})})),e(),r(),n("#scroll-down").on("click",function(){s(volantis.$bodyAnchor)});try{document.addEventListener("pjax:complete",function(){n(function(){i=80,volantis.$header[0]&&(i=volantis.$header[0].clientHeight+16),volantis.$headerMenu=n("body .navigation"),a(),l(),c(),e(),r(),n("#scroll-down").on("click",function(){s(volantis.$bodyAnchor)}),0!==volantis.$switcher.length&&n(document).click(function(t){volantis.$header.removeClass("z_search-open"),volantis.$switcher.removeClass("active")})})},{passive:!0})}catch(t){}}),window.location.hash&&(o=setInterval(function(){n("#"+decodeURI(window.location.hash.split("#")[1]).replace(/\ /g,"-")).length&&(n("html, body").animate({scrollTop:n("#"+decodeURI(window.location.hash.split("#")[1]).replace(/\ /g,"-")).offset().top+50},500),clearInterval(o))},100))}(jQuery);