19 lines
17 KiB
JavaScript
19 lines
17 KiB
JavaScript
|
/**
|
||
|
* Fuse.js v7.0.0 - Lightweight fuzzy-search (http://fusejs.io)
|
||
|
*
|
||
|
* Copyright (c) 2023 Kiro Risk (http://kiro.me)
|
||
|
* All Rights Reserved. Apache Software License 2.0
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*/
|
||
|
var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return(t=h(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function u(e){return Array.isArray?Array.isArray(e):"[object Array]"===m(e)}var l=1/0;function d(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-l?"-0":t}(e)}function f(e){return"string"==typeof e}function v(e){return"number"==typeof e}function g(e){return!0===e||!1===e||function(e){return function(e){return"object"===n(e)}(e)&&null!==e}(e)&&"[object Boolean]"==m(e)}function y(e){return null!=e}function p(e){return!e.trim().length}function m(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var b=function(e){return"Missing ".concat(e," property in key")},k=function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")},M=Object.prototype.hasOwnProperty,w=function(){function e(t){var n=this;r(this,e),this._keys=[],this._keyMap={};var i=0;t.forEach((function(e){var t=x(e);n._keys.push(t),n._keyMap[t.id]=t,i+=t.weight})),this._keys.forEach((function(e){e.weight/=i}))}return o(e,[{key:"get",value:function(e){return this._keyMap[e]}},{key:"keys",value:function(){return this._keys}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}();function x(e){var t=null,n=null,r=null,i=1,o=null;if(f(e)||u(e))r=e,t=L(e),n=S(e);else{if(!M.call(e,"name"))throw new Error(b("name"));var a=e.name;if(r=a,M.call(e,"weight")&&(i=e.weight)<=0)throw new Error(k(a));t=L(a),n=S(a),o=e.getFn}return{path:t,id:n,weight:i,src:r,getFn:o}}function L(e){return u(e)?e:e.split(".")}function S(e){return u(e)?e.join("."):e}var _={useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i,o){if(y(t))if(i[o]){var a=t[i[o]];
|
||
|
;
|
||
|
/*
|
||
|
PaperMod v7
|
||
|
License: MIT https://github.com/adityatelange/hugo-PaperMod/blob/master/LICENSE
|
||
|
Copyright (c) 2020 nanxiaobei and adityatelange
|
||
|
Copyright (c) 2021-2024 adityatelange
|
||
|
*/
|
||
|
|
||
|
;
|
||
|
(()=>{var s,r,c,e={distance:1e3,iscasesensitive:!1,location:0,minmatchcharlength:0,shouldsort:!0,threshold:.4},n=document.getElementById("searchResults"),t=document.getElementById("searchInput"),a=null,o=!1;window.onload=function(){let t=new XMLHttpRequest;t.onreadystatechange=function(){if(t.readyState===4)if(t.status===200){{let n=JSON.parse(t.responseText);if(n){let t={distance:100,threshold:.4,ignoreLocation:!0,keys:["title","permalink","summary","content"]};e&&(t={isCaseSensitive:e.iscasesensitive??!1,includeScore:e.includescore??!1,includeMatches:e.includematches??!1,minMatchCharLength:e.minmatchcharlength??1,shouldSort:e.shouldsort??!0,findAllMatches:e.findallmatches??!1,keys:e.keys??["title","permalink","summary","content"],location:e.location??0,threshold:e.threshold??.4,distance:e.distance??100,ignoreLocation:e.ignorelocation??!0}),s=new Fuse(n,t)}}}else console.log(t.responseText)},t.open("GET","../index.json"),t.send()};function i(e){document.querySelectorAll(".focus").forEach(function(e){e.classList.remove("focus")}),e?(e.focus(),document.activeElement=a=e,e.parentElement.classList.add("focus")):document.activeElement.parentElement.classList.add("focus")}function l(){o=!1,n.innerHTML=t.value="",t.focus()}t.onkeyup=function(){if(s){let t;if(e?t=s.search(this.value.trim(),{limit:e.limit}):t=s.search(this.value.trim()),t.length!==0){let e="";for(let n in t)e+=`<li class="post-entry"><header class="entry-header">${t[n].item.title} \xBB</header><a href="${t[n].item.permalink}" aria-label="${t[n].item.title}"></a></li>`;n.innerHTML=e,o=!0,r=n.firstChild,c=n.lastChild}else o=!1,n.innerHTML=""}},t.addEventListener("search",function(){this.value||l()}),document.onkeydown=function(e){let d=e.key,s=document.activeElement,u=document.getElementById("searchbox").contains(s);if(s===t){let e=document.getElementsByClassName("focus");for(;e.length>0;)e[0].classList.remove("focus")}else a&&(s=a);if(d==="Escape")l();else if(!o||!u)return;else d==="ArrowDown"?(e.preventDefault(),s==t?i(n.firstChild.lastChild):s.parentElement!=c&&i(s.parentElement.nextSibling.lastChild)):d==="ArrowUp"?(e.preventDefault(),s.parentElement==r?i(t):s!=t&&i(s.parentElement.previousSibling.lastChild)):d==="ArrowRight"&&s.click()}})()
|