/*! * Chirpy v6.3.1 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/ */ !function(){"use strict";const t=$(".mode-toggle");function e(t,e,o){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var a=o.call(t,e||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}const o=$("body"),a="sidebar-display";class r{static toggle(){!1===r.isExpanded?o.attr(a,""):o.removeAttr(a),r.isExpanded=!r.isExpanded}}e(r,"isExpanded",!1);const s=$("#sidebar-trigger"),n=$("#search-trigger"),i=$("#search-cancel"),l=$("#main-wrapper>.container>.row"),c=$("#topbar-title"),u=$("search"),d=$("#search-result-wrapper"),m=$("#search-results"),f=$("#search-input"),p=$("#search-hints"),g=$("html,body"),h="loaded",b="unloaded",v="input-focus",C="d-flex";class w{static on(){w.offset=window.scrollY,g.scrollTop(0)}static off(){g.scrollTop(w.offset)}}e(w,"offset",0),e(w,"resultVisible",!1);class y{static on(){s.addClass(b),c.addClass(b),n.addClass(b),u.addClass(C),i.addClass(h)}static off(){i.removeClass(h),u.removeClass(C),s.removeClass(b),c.removeClass(b),n.removeClass(b)}}class S{static on(){w.resultVisible||(w.on(),d.removeClass(b),l.addClass(b),w.resultVisible=!0)}static off(){w.resultVisible&&(m.empty(),p.hasClass(b)&&p.removeClass(b),d.addClass(b),l.removeClass(b),w.off(),f.val(""),w.resultVisible=!1)}}function T(){return i.hasClass(h)}$(".collapse");const k=".code-header>button",x="fas fa-check",A="timeout",E="data-title-succeed",j="data-bs-original-title",D=2e3;function M(t){if($(t)[0].hasAttribute(A)){let e=$(t).attr(A);if(Number(e)>Date.now())return!0}return!1}function F(t){$(t).attr(A,Date.now()+D)}function R(t){$(t).removeAttr(A)}const q=$(k).children().attr("class");const I="data-src",N="data-lqip",V={SHIMMER:"shimmer",BLUR:"blur"};function P(t){$(this).parent().removeClass(t)}function U(){this.complete&&(this.hasAttribute(N)?P.call(this,V.BLUR):P.call(this,V.SHIMMER))}function z(){const t=$(this),e=t.attr(I);t.attr("src",encodeURI(e)),t.removeAttr(I)}class B{static get attrTimestamp(){return"data-ts"}static get attrDateFormat(){return"data-df"}static get locale(){return $("html").attr("lang").substring(0,2)}static getTimestamp(t){return Number(t.attr(B.attrTimestamp))}static getDateFormat(t){return t.attr(B.attrDateFormat)}}0!==t.length&&t.off().on("click",(t=>{const e=$(t.target);let o=e.prop("tagName")==="button".toUpperCase()?e:e.parent();modeToggle.flipMode(),o.trigger("blur")})),$("#sidebar-trigger").on("click",r.toggle),$("#mask").on("click",r.toggle),n.on("click",(function(){y.on(),S.on(),f.trigger("focus")})),i.on("click",(function(){y.off(),S.off()})),f.on("focus",(function(){u.addClass(v)})),f.on("focusout",(function(){u.removeClass(v)})),f.on("input",(()=>{""===f.val()?T()?p.removeClass(b):S.off():(S.on(),T()&&p.addClass(b))})),function(){const t=$("article img");t.length&&t.on("load",U),$('article img[loading="lazy"]').each((function(){this.complete&&P.call(this,V.SHIMMER)}));const e=$("article img[".concat(N,'="true"]'));e.length&&e.each(z)}(),$(".popup")<=0||$(".popup").magnificPopup({type:"image",closeOnContentClick:!0,showCloseBtn:!1,zoom:{enabled:!0,duration:300,easing:"ease-in-out"}}),dayjs.locale(B.locale),dayjs.extend(window.dayjs_plugin_localizedFormat),$("[".concat(B.attrTimestamp,"]")).each((function(){const t=dayjs.unix(B.getTimestamp($(this))),e=t.format(B.getDateFormat($(this)));$(this).text(e),$(this).removeAttr(B.attrTimestamp),$(this).removeAttr(B.attrDateFormat);const o=$(this).attr("data-bs-toggle");if(void 0===o||"tooltip"!==o)return;const a=t.format("llll");$(this).attr("data-bs-title",a),new bootstrap.Tooltip($(this))})),function(){if($(k).length){const t=new ClipboardJS(k,{target:t=>t.parentNode.nextElementSibling.querySelector("code .rouge-code")});[...document.querySelectorAll(k)].map((t=>new bootstrap.Tooltip(t,{placement:"left"}))),t.on("success",(t=>{t.clearSelection();const e=t.trigger;M(e)||(!function(t){$(t).children().attr("class",x)}(e),function(t){const e=$(t).attr(E);$(t).attr(j,e).tooltip("show")}(e),F(e),setTimeout((()=>{!function(t){$(t).tooltip("hide").removeAttr(j)}(e),function(t){$(t).children().attr("class",q)}(e),R(e)}),D))}))}const t=$("#copy-link");t.on("click",(t=>{let e=$(t.target);M(e)||navigator.clipboard.writeText(window.location.href).then((()=>{const t=e.attr(j),o=e.attr(E);e.attr(j,o).tooltip("show"),F(e),setTimeout((()=>{e.attr(j,t),R(e)}),D)}))})),t.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}),function(){const t=$(window),e=$("#back-to-top");t.on("scroll",(()=>{t.scrollTop()>50?e.fadeIn():e.fadeOut()})),e.on("click",(()=>{t.scrollTop(0)}))}(),[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map((t=>new bootstrap.Tooltip(t)))}();