/*! * Chirpy v6.2.3 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/ */ !function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r.container>.row"),g=$("#topbar-title"),h=$("search"),v=$("#search-result-wrapper"),b=$("#search-results"),y=$("#search-input"),w=$("#search-hints"),C=$("html,body"),k="loaded",S="unloaded",T="input-focus",A="d-flex",j=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){e.offset=window.scrollY,C.scrollTop(0)}},{key:"off",value:function(){C.scrollTop(e.offset)}}]),e}();n(j,"offset",0),n(j,"resultVisible",!1);var E=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){f.addClass(S),g.addClass(S),d.addClass(S),h.addClass(A),m.addClass(k)}},{key:"off",value:function(){m.removeClass(k),h.removeClass(A),f.removeClass(S),g.removeClass(S),d.removeClass(S)}}]),e}(),x=function(){function e(){t(this,e)}return r(e,null,[{key:"on",value:function(){j.resultVisible||(j.on(),v.removeClass(S),p.addClass(S),j.resultVisible=!0)}},{key:"off",value:function(){j.resultVisible&&(b.empty(),w.hasClass(S)&&w.removeClass(S),v.addClass(S),p.removeClass(S),j.off(),y.val(""),j.resultVisible=!1)}}]),e}();function I(){return m.hasClass(k)}$(".collapse");var M=".code-header>button",D="fas fa-check",O="timeout",F="data-title-succeed",P="data-bs-original-title",R=2e3;function q(t){if($(t)[0].hasAttribute(O)){var e=$(t).attr(O);if(Number(e)>Date.now())return!0}return!1}function N(t){$(t).attr(O,Date.now()+R)}function U(t){$(t).removeAttr(O)}var V=$(M).children().attr("class");var z="data-src",B="data-lqip",H={SHIMMER:"shimmer",BLUR:"blur"};function L(t){$(this).parent().removeClass(t)}function _(){this.complete&&(this.hasAttribute(B)?L.call(this,H.BLUR):L.call(this,H.SHIMMER))}function J(){var t=$(this),e=t.attr(z);t.attr("src",encodeURI(e)),t.removeAttr(z)}var Y,G,K=function(){function e(){t(this,e)}return r(e,null,[{key:"attrTimestamp",get:function(){return"data-ts"}},{key:"attrDateFormat",get:function(){return"data-df"}},{key:"locale",get:function(){return $("html").attr("lang").substring(0,2)}},{key:"getTimestamp",value:function(t){return Number(t.attr(e.attrTimestamp))}},{key:"getDateFormat",value:function(t){return t.attr(e.attrDateFormat)}}]),e}();0!==l.length&&l.off().on("click",(function(t){var e=$(t.target),r=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),r.trigger("blur")})),$("#sidebar-trigger").on("click",u.toggle),$("#mask").on("click",u.toggle),d.on("click",(function(){E.on(),x.on(),y.trigger("focus")})),m.on("click",(function(){E.off(),x.off()})),y.on("focus",(function(){h.addClass(T)})),y.on("focusout",(function(){h.removeClass(T)})),y.on("input",(function(){""===y.val()?I()?w.removeClass(S):x.off():(x.on(),I()&&w.addClass(S))})),function(){var t=$("article img");t.length&&t.on("load",_),$('article img[loading="lazy"]').each((function(){this.complete&&L.call(this,H.SHIMMER)}));var e=$("article img[".concat(B,'="true"]'));e.length&&e.each(J)}(),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),dayjs.locale(K.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(K.attrTimestamp,"]")).each((function(){var t=dayjs.unix(K.getTimestamp($(this))),e=t.format(K.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(K.attrTimestamp),$(this).removeAttr(K.attrDateFormat);var r=$(this).attr("data-bs-toggle");if(void 0!==r&&"tooltip"===r){var n=t.format("llll");$(this).attr("data-bs-title",n),new bootstrap.Tooltip($(this))}})),function(){if($(M).length){var t=new ClipboardJS(M,{target:function(t){return t.parentNode.nextElementSibling.querySelector("code .rouge-code")}});o(document.querySelectorAll(M)).map((function(t){return new bootstrap.Tooltip(t,{placement:"left"})})),t.on("success",(function(t){t.clearSelection();var e=t.trigger;q(e)||(!function(t){$(t).children().attr("class",D)}(e),function(t){var e=$(t).attr(F);$(t).attr(P,e).tooltip("show")}(e),N(e),setTimeout((function(){!function(t){$(t).tooltip("hide").removeAttr(P)}(e),function(t){$(t).children().attr("class",V)}(e),U(e)}),R))}))}var e=$("#copy-link");e.on("click",(function(t){var e=$(t.target);q(e)||navigator.clipboard.writeText(window.location.href).then((function(){var t=e.attr(P),r=e.attr(F);e.attr(P,r).tooltip("show"),N(e),setTimeout((function(){e.attr(P,t),U(e)}),R)}))})),e.on("mouseleave",(function(t){$(t.target).tooltip("hide")}))}(),document.querySelector("main h2")&&tocbot.init({tocSelector:"#toc",contentSelector:".content",ignoreSelector:"[data-toc-skip]",headingSelector:"h2, h3, h4",orderedList:!1,scrollSmooth:!1}),Y=$(window),G=$("#back-to-top"),Y.on("scroll",(function(){Y.scrollTop()>50?G.fadeIn():G.fadeOut()})),G.on("click",(function(){Y.scrollTop(0)})),o(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map((function(t){return new bootstrap.Tooltip(t)}))}();