(()=>{var d=t=>{document.readyState==="interactive"||document.readyState==="complete"?t():document.addEventListener("DOMContentLoaded",t)};d(()=>{let t=window.innerWidth-document.body.clientWidth;document.querySelector("html").style.setProperty("--sgb-scroll-bar-width",t+"px")});function g(t){t.style.opacity="1",function o(){let e=parseFloat(t.style.opacity);t.style.opacity=`${e-.1}`,e-.1<0?t.style.display="none":requestAnimationFrame(o)}()}function m(t,o="block"){t.style.opacity="0",t.style.display=o,function e(){let c=parseFloat(t.style.opacity);(c+=.1)>1||(t.style.opacity=`${c}`,requestAnimationFrame(e))}()}function L(t){let o=t.getBoundingClientRect(),e=window.pageYOffset||document.documentElement.scrollTop;return o.top+e}function E(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0}function h(t){return t.offsetWidth>0||t.offsetHeight>0}d(()=>{let t=document.querySelectorAll(".wp-block-sgb-tab .post-tab");[].forEach.call(t,(e,c)=>{let s="js-tab-id-"+c;e.classList.add(s);let i=e.getAttribute("data-active-color"),n=document.createElement("style");n.innerHTML=".post-tab."+s+" > label.tab-active { background: "+i+"}",document.body.appendChild(n)});let o=document.querySelectorAll(".post-tab > label");[].forEach.call(o,e=>{e.addEventListener("click",c=>{let s=e.closest(".wp-block-sgb-tab"),i=e.closest(".post-tab");if(s){let n=s.querySelectorAll(":scope > .post-tab > label");[].forEach.call(n,r=>{r.classList.remove("tab-active")}),e.classList.add("tab-active");let l=s.querySelectorAll(":scope > .post-tab__content");[].forEach.call(l,(r,a)=>{parseInt(e.getAttribute("class").replace("tab",""),10)-1===a?(r.classList.add("tab-active"),i.classList.contains("post-tab--animation-disabled")?r.style.display="block":m(r)):(r.classList.remove("tab-active"),i.classList.contains("post-tab--animation-disabled")?r.style.display="none":g(r))}),setTimeout(()=>{typeof jQuery<"u"&&(jQuery(".js-sng-slider").length>0&&jQuery(".js-sng-slider").slick("setPosition"),jQuery(".js-sng-slider-alt").length>0&&jQuery(".js-sng-slider-alt").slick("setPosition"),jQuery(".js-sng-post-slider").length>0&&jQuery(".js-sng-post-slider").slick("setPosition"))},100)}})})});d(()=>{let t=document.querySelectorAll("pre.js-sng-highlight code");[].forEach.call(t,o=>{hljs.highlightBlock(o)})});d(()=>{let t=document.querySelectorAll(".js-header-video");[].forEach.call(t,o=>{let e=o.getAttribute("data-src");e&&o.setAttribute("src",e)})});var w=()=>{typeof jQuery>"u"||(jQuery(".js-sng-post-slider").length>0&&jQuery(".js-sng-post-slider").slick(),jQuery(".js-sng-slider-alt").length>0&&jQuery(".js-sng-slider-alt").slick(),jQuery(".js-sng-slider").length>0&&jQuery(".js-sng-slider").slick({responsive:[{breakpoint:768,settings:{slidesToShow:1,slidesToScroll:1}}]}))};d(()=>{w()});var M=t=>{let o=document.querySelector("#toc_container"),e=o.querySelector(".toc_list"),s=`
    <dialog class="sgb-toc-dialog">
      <div class="sgb-toc-dialog__contents dfont">
        <div class="sgb-toc-dialog__header">
          <button class="sgb-toc-dialog__dismiss" aria-label="\u30C0\u30A4\u30A2\u30ED\u30B0\u3092\u9589\u3058\u308B">
            <span></span>
          </button>
          <p class="sgb-toc-dialog__title">${o.dataset.dialogTitle||"Table of Contents"}</p>
        </div>
        <div class="sgb-toc-dialog__list-wrap">
          <ul class="sgb-toc-dialog__list">
            ${e.innerHTML}
          </ul>
        </div>
      </p>
    </dialog>
  `;o.insertAdjacentHTML("beforeend",s);let i=document.querySelector(".sgb-toc-dialog"),n=document.querySelector(".sgb-toc-dialog__contents"),l=n.querySelectorAll("a"),r=document.querySelector(".sgb-toc-dialog__dismiss");t.addEventListener("click",a=>{a.preventDefault(),i.showModal()}),n.addEventListener("click",a=>{a.stopPropagation()}),i.addEventListener("click",a=>{i.close()}),r.addEventListener("click",a=>{i.close()}),l.forEach(a=>{a.addEventListener("click",()=>{i.close()})})};d(()=>{let t=document.querySelector(".js-toc-toggle");t&&t.addEventListener("click",i=>{let n=document.querySelector(".toc_list");if(n.offsetParent!==null){let l=t.getAttribute("data-open-toggle");t.innerHTML=l,g(n)}else{let l=t.getAttribute("data-close-toggle");t.innerHTML=l,m(n)}});let o=document.querySelectorAll(".js-smooth-scroll a:not(.js-toc-button):not(.js-no-scroll)"),e=document.querySelector(".js-toc-button"),c=document.querySelector("#toc_container");if(o.length){let i=document.querySelector("html");i&&(i.style.scrollBehavior="smooth")}e&&(e.dataset.openDialog==="true"&&typeof HTMLDialogElement=="function"?M(e):e.setAttribute("href","#toc_container")),e&&c&&window.addEventListener("scroll",i=>{(document.documentElement.scrollTop||document.body.scrollTop)>700?h(e)||sng.fadeIn(e):h(e)&&sng.fadeOut(e)},{passive:!0}),document.querySelector(".js-highlight-menu")&&window.addEventListener("scroll",i=>{let l=".entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5",r=-1,a=-1;document.querySelectorAll(l).forEach((f,_)=>{let S=f.getAttribute("id"),k="#"+S,j=!1;if(document.querySelectorAll(".js-highlight-menu li a:not(.js-no-highlight)").forEach((A,H)=>{if(A.getAttribute("href")===k)return j=!0,!1}),!j)return!0;a++,L(f)<=E()+5&&(r=a)}),document.querySelectorAll(".js-highlight-menu li a:not(.js-no-highlight)").forEach((f,_)=>{f.classList.remove("active"),_===r&&f.classList.add("active")})},{passive:!0})});var $=sgb_client_options.site_url,b=t=>{if(sgb_client_options.is_logged_in)return;t.querySelectorAll(".js-sgb-content-block").forEach(e=>{navigator.sendBeacon("?rest_route=/sng/v1/cb/pv",JSON.stringify({postId:e.dataset.id})),e.querySelectorAll("a").forEach(s=>{s.addEventListener("click",i=>{navigator.sendBeacon("?rest_route=/sng/v1/cb/click",JSON.stringify({postId:e.dataset.id,url:s.href,label:s.innerText}))})})})};d(()=>{b(document)});var T=(t,o)=>Math.floor(Math.random()*(o-t+1)+t);d(()=>{document.querySelectorAll(".js-ab-test").forEach(async o=>{let e=o.dataset.aId,c=o.dataset.bId,s=parseInt(o.dataset.deliveryRate,10),i=T(1,100),n="";i<=s?n=e:n=c;let l=await fetch("?rest_route=/sng/v1/cb/block",{method:"POST",body:JSON.stringify({id:n})}),{html:r,css:a}=await l.json(),u="";a&&(u=`<style>${a}</style>`),u+=r,o.innerHTML=u,b(o)})});function y(t){for(var o=1;o<arguments.length;o++){var e=arguments[o];for(var c in e)t[c]=e[c]}return t}var q={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function v(t,o){function e(s,i,n){if(!(typeof document>"u")){n=y({},o,n),typeof n.expires=="number"&&(n.expires=new Date(Date.now()+n.expires*864e5)),n.expires&&(n.expires=n.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var l="";for(var r in n)!n[r]||(l+="; "+r,n[r]!==!0&&(l+="="+n[r].split(";")[0]));return document.cookie=s+"="+t.write(i,s)+l}}function c(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],n={},l=0;l<i.length;l++){var r=i[l].split("="),a=r.slice(1).join("=");try{var u=decodeURIComponent(r[0]);if(n[u]=t.read(a,u),s===u)break}catch{}}return s?n[s]:n}}return Object.create({set:e,get:c,remove:function(s,i){e(s,"",y({},i,{expires:-1}))},withAttributes:function(s){return v(this.converter,y({},this.attributes,s))},withConverter:function(s){return v(y({},this.converter,s),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(t)}})}var p=v(q,{path:"/"});d(()=>{if(!sgb_client_options.save_post_views||!sgb_client_options.post_id)return;let t=p.get("sgb_post_view"),e=(t?t.split(","):[]).filter(s=>s!==sgb_client_options.post_id);e.push(sgb_client_options.post_id);let c=e.join(",");p.set("sgb_post_view",c,{expires:400})});d(()=>{if(!sgb_client_options.save_favorite_posts)return;let t=document.querySelectorAll(".js-sng-favorite-btn"),o=p.get("sgb_post_favorite");p.set("sgb_post_favorite",o,{expires:400}),t.forEach(e=>{let c=e.dataset.id||sgb_client_options.post_id;if(!c)return;let s=p.get("sgb_post_favorite"),i=s?s.split(","):[];i.includes(c)&&e.classList.add("is-active"),e.addEventListener("click",n=>{n.preventDefault();let l=i.filter(a=>a!==c);if(e.classList.toggle("is-active"),!e.classList.contains("is-active")){let a=l.join(",");p.set("sgb_post_favorite",a,{expires:400});return}l.push(c);let r=l.join(",");p.set("sgb_post_favorite",r,{expires:400})})})});})();
/*! js-cookie v3.0.5 | MIT */
