blog-static/app.min.js
2024-09-08 13:58:55 +00:00

4 lines
12 KiB
JavaScript

/*!
* jekyll-theme-chirpy v7.1.0 | © 2019 Cotes Chung | MIT Licensed | https://github.com/cotes2020/jekyll-theme-chirpy/
*/
!function(){"use strict";const e=new Map;var t={set(t,n,o){e.has(t)||e.set(t,new Map);const r=e.get(t);r.has(n)||0===r.size?r.set(n,o):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(r.keys())[0]}.`)},get:(t,n)=>e.has(t)&&e.get(t).get(n)||null,remove(t,n){if(!e.has(t))return;const o=e.get(t);o.delete(n),0===o.size&&e.delete(t)}};const n="transitionend",o=e=>(e&&window.CSS&&window.CSS.escape&&(e=e.replace(/#([^\s"#']+)/g,((e,t)=>`#${CSS.escape(t)}`))),e),r=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),i=e=>r(e)?e.jquery?e[0]:e:"string"==typeof e&&e.length>0?document.querySelector(o(e)):null,s=e=>!e||e.nodeType!==Node.ELEMENT_NODE||(!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled"))),a=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,l=[],c=function(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e;return"function"==typeof e?e(...arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]):t},u=function(e,t){if(!(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]))return void c(e);const o=(e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:n}=window.getComputedStyle(e);const o=Number.parseFloat(t),r=Number.parseFloat(n);return o||r?(t=t.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(n))):0})(t)+5;let r=!1;const i=o=>{let{target:s}=o;s===t&&(r=!0,t.removeEventListener(n,i),c(e))};t.addEventListener(n,i),setTimeout((()=>{r||t.dispatchEvent(new Event(n))}),o)},d=/[^.]*(?=\..*)\.|.*/,f=/\..*/,h=/::\d+$/,g={};let m=1;const p={mouseenter:"mouseover",mouseleave:"mouseout"},b=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function v(e,t){return t&&`${t}::${m++}`||e.uidEvent||m++}function _(e){const t=v(e);return e.uidEvent=t,g[t]=g[t]||{},g[t]}function y(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return Object.values(e).find((e=>e.callable===t&&e.delegationSelector===n))}function E(e,t,n){const o="string"==typeof t,r=o?n:t||n;let i=C(e);return b.has(i)||(i=e),[o,r,i]}function w(e,t,n,o,r){if("string"!=typeof t||!e)return;let[i,s,a]=E(t,n,o);if(t in p){const e=e=>function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)};s=e(s)}const l=_(e),c=l[a]||(l[a]={}),u=y(c,s,i?n:null);if(u)return void(u.oneOff=u.oneOff&&r);const f=v(s,t.replace(d,"")),h=i?function(e,t,n){return function o(r){const i=e.querySelectorAll(t);for(let{target:s}=r;s&&s!==this;s=s.parentNode)for(const a of i)if(a===s)return T(r,{delegateTarget:s}),o.oneOff&&O.off(e,r.type,t,n),n.apply(s,[r])}}(e,n,s):function(e,t){return function n(o){return T(o,{delegateTarget:e}),n.oneOff&&O.off(e,o.type,t),t.apply(e,[o])}}(e,s);h.delegationSelector=i?n:null,h.callable=s,h.oneOff=r,h.uidEvent=f,c[f]=h,e.addEventListener(a,h,i)}function A(e,t,n,o,r){const i=y(t[n],o,r);i&&(e.removeEventListener(n,i,Boolean(r)),delete t[n][i.uidEvent])}function S(e,t,n,o){const r=t[n]||{};for(const[i,s]of Object.entries(r))i.includes(o)&&A(e,t,n,s.callable,s.delegationSelector)}function C(e){return e=e.replace(f,""),p[e]||e}const O={on(e,t,n,o){w(e,t,n,o,!1)},one(e,t,n,o){w(e,t,n,o,!0)},off(e,t,n,o){if("string"!=typeof t||!e)return;const[r,i,s]=E(t,n,o),a=s!==t,l=_(e),c=l[s]||{},u=t.startsWith(".");if(void 0===i){if(u)for(const n of Object.keys(l))S(e,l,n,t.slice(1));for(const[n,o]of Object.entries(c)){const r=n.replace(h,"");a&&!t.includes(r)||A(e,l,s,o.callable,o.delegationSelector)}}else{if(!Object.keys(c).length)return;A(e,l,s,i,r?n:null)}},trigger(e,t,n){if("string"!=typeof t||!e)return null;const o=a();let r=null,i=!0,s=!0,l=!1;t!==C(t)&&o&&(r=o.Event(t,n),o(e).trigger(r),i=!r.isPropagationStopped(),s=!r.isImmediatePropagationStopped(),l=r.isDefaultPrevented());const c=T(new Event(t,{bubbles:i,cancelable:!0}),n);return l&&c.preventDefault(),s&&e.dispatchEvent(c),c.defaultPrevented&&r&&r.preventDefault(),c}};function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(const[n,o]of Object.entries(t))try{e[n]=o}catch{Object.defineProperty(e,n,{configurable:!0,get:()=>o})}return e}function $(e){if("true"===e)return!0;if("false"===e)return!1;if(e===Number(e).toString())return Number(e);if(""===e||"null"===e)return null;if("string"!=typeof e)return e;try{return JSON.parse(decodeURIComponent(e))}catch{return e}}function N(e){return e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}const j={setDataAttribute(e,t,n){e.setAttribute(`data-bs-${N(t)}`,n)},removeDataAttribute(e,t){e.removeAttribute(`data-bs-${N(t)}`)},getDataAttributes(e){if(!e)return{};const t={},n=Object.keys(e.dataset).filter((e=>e.startsWith("bs")&&!e.startsWith("bsConfig")));for(const o of n){let n=o.replace(/^bs/,"");n=n.charAt(0).toLowerCase()+n.slice(1,n.length),t[n]=$(e.dataset[o])}return t},getDataAttribute:(e,t)=>$(e.getAttribute(`data-bs-${N(t)}`))};class D{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(e){return e=this._mergeConfigObj(e),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}_configAfterMerge(e){return e}_mergeConfigObj(e,t){const n=r(t)?j.getDataAttribute(t,"config"):{};return{...this.constructor.Default,..."object"==typeof n?n:{},...r(t)?j.getDataAttributes(t):{},..."object"==typeof e?e:{}}}_typeCheckConfig(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.constructor.DefaultType;for(const[o,i]of Object.entries(t)){const t=e[o],s=r(t)?"element":null==(n=t)?`${n}`:Object.prototype.toString.call(n).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(i).test(s))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${o}" provided type "${s}" but expected type "${i}".`)}var n}}class I extends D{constructor(e,n){super(),(e=i(e))&&(this._element=e,this._config=this._getConfig(n),t.set(this._element,this.constructor.DATA_KEY,this))}dispose(){t.remove(this._element,this.constructor.DATA_KEY),O.off(this._element,this.constructor.EVENT_KEY);for(const e of Object.getOwnPropertyNames(this))this[e]=null}_queueCallback(e,t){u(e,t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}_getConfig(e){return e=this._mergeConfigObj(e,this._element),e=this._configAfterMerge(e),this._typeCheckConfig(e),e}static getInstance(e){return t.get(i(e),this.DATA_KEY)}static getOrCreateInstance(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.3.3"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(e){return`${e}${this.EVENT_KEY}`}}const L=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let n=e.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n=`#${n.split("#")[1]}`),t=n&&"#"!==n?n.trim():null}return t?t.split(",").map((e=>o(e))).join(","):null},k={find(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return[].concat(...Element.prototype.querySelectorAll.call(t,e))},findOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return Element.prototype.querySelector.call(t,e)},children:(e,t)=>[].concat(...e.children).filter((e=>e.matches(t))),parents(e,t){const n=[];let o=e.parentNode.closest(t);for(;o;)n.push(o),o=o.parentNode.closest(t);return n},prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return[n];n=n.nextElementSibling}return[]},focusableChildren(e){const t=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((e=>`${e}:not([tabindex^="-"])`)).join(",");return this.find(t,e).filter((e=>!s(e)&&(e=>{if(!r(e)||0===e.getClientRects().length)return!1;const t="visible"===getComputedStyle(e).getPropertyValue("visibility"),n=e.closest("details:not([open])");if(!n)return t;if(n!==e){const t=e.closest("summary");if(t&&t.parentNode!==n)return!1;if(null===t)return!1}return t})(e)))},getSelectorFromElement(e){const t=L(e);return t&&k.findOne(t)?t:null},getElementFromSelector(e){const t=L(e);return t?k.findOne(t):null},getMultipleElementsFromSelector(e){const t=L(e);return t?k.find(t):[]}},M=".bs.toast",K=`mouseover${M}`,q=`mouseout${M}`,x=`focusin${M}`,P=`focusout${M}`,W=`hide${M}`,Y=`hidden${M}`,F=`show${M}`,V=`shown${M}`,Q="hide",R="show",z="showing",B={animation:"boolean",autohide:"boolean",delay:"number"},H={animation:!0,autohide:!0,delay:5e3};class U extends I{constructor(e,t){super(e,t),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return H}static get DefaultType(){return B}static get NAME(){return"toast"}show(){if(O.trigger(this._element,F).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");this._element.classList.remove(Q),this._element.offsetHeight,this._element.classList.add(R,z),this._queueCallback((()=>{this._element.classList.remove(z),O.trigger(this._element,V),this._maybeScheduleHide()}),this._element,this._config.animation)}hide(){if(!this.isShown())return;if(O.trigger(this._element,W).defaultPrevented)return;this._element.classList.add(z),this._queueCallback((()=>{this._element.classList.add(Q),this._element.classList.remove(z,R),O.trigger(this._element,Y)}),this._element,this._config.animation)}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(R),super.dispose()}isShown(){return this._element.classList.contains(R)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(e,t){switch(e.type){case"mouseover":case"mouseout":this._hasMouseInteraction=t;break;case"focusin":case"focusout":this._hasKeyboardInteraction=t}if(t)return void this._clearTimeout();const n=e.relatedTarget;this._element===n||this._element.contains(n)||this._maybeScheduleHide()}_setListeners(){O.on(this._element,K,(e=>this._onInteraction(e,!0))),O.on(this._element,q,(e=>this._onInteraction(e,!1))),O.on(this._element,x,(e=>this._onInteraction(e,!0))),O.on(this._element,P,(e=>this._onInteraction(e,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(e){return this.each((function(){const t=U.getOrCreateInstance(this,e);if("string"==typeof e){if(void 0===t[e])throw new TypeError(`No method named "${e}"`);t[e](this)}}))}}var G,J;if(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hide";const n=`click.dismiss${e.EVENT_KEY}`,o=e.NAME;O.on(document,n,`[data-bs-dismiss="${o}"]`,(function(n){if(["A","AREA"].includes(this.tagName)&&n.preventDefault(),s(this))return;const r=k.getElementFromSelector(this)||this.closest(`.${o}`);e.getOrCreateInstance(r)[t]()}))}(U),G=U,J=()=>{const e=a();if(e){const t=G.NAME,n=e.fn[t];e.fn[t]=G.jQueryInterface,e.fn[t].Constructor=G,e.fn[t].noConflict=()=>(e.fn[t]=n,G.jQueryInterface)}},"loading"===document.readyState?(l.length||document.addEventListener("DOMContentLoaded",(()=>{for(const e of l)e()})),l.push(J)):J(),"serviceWorker"in navigator){const e="/sw.min.js",t=document.getElementById("notification"),n=t.querySelector(".toast-body>button"),o=U.getOrCreateInstance(t);navigator.serviceWorker.register(e).then((e=>{e.waiting&&o.show(),e.addEventListener("updatefound",(()=>{e.installing.addEventListener("statechange",(()=>{e.waiting&&navigator.serviceWorker.controller&&o.show()}))})),n.addEventListener("click",(()=>{e.waiting&&e.waiting.postMessage("SKIP_WAITING"),o.hide()}))}));let r=!1;navigator.serviceWorker.addEventListener("controllerchange",(()=>{r||(window.location.reload(),r=!0)}))}}();