mirror of
https://gitlab.com/thelazyoxymoron/siddhartha-golu-website.git
synced 2025-07-27 17:17:58 +02:00
2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
var e=this,t=function(){"use strict";function E(e){return(E="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})(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n,s=0;s<t.length;s++)n=t[s],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function a(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){var n,s=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,n)),s}function w(e){for(var t,n=1;n<arguments.length;n++)t=null!=arguments[n]?arguments[n]:{},n%2?g(Object(t),!0).forEach(function(n){F(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))});return e}function l(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function d(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function s(e){return Array.isArray?Array.isArray(e):"[object Array]"===p(e)}function n(e){return"string"==typeof e}function C(e){return"number"==typeof e}function k(e){return!0===e||!1===e||function(e){return function(e){return"object"===E(e)}(e)&&null!==e}(e)&&"[object Boolean]"==p(e)}function t(e){return e!=null}function h(e){return!e.trim().length}function p(e){return e==null?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var e,o,c,u,O,x,R=function(e){return"Pattern length exceeds max of ".concat(e,".")},v=Object.prototype.hasOwnProperty,T=function(){function e(t){var n,s=this;r(this,e),this._keys=[],this._keyMap={},n=0,t.forEach(function(e){var t=j(e);n+=t.weight,s._keys.push(t),s._keyMap[t.id]=t,n+=t.weight}),this._keys.forEach(function(e){e.weight/=n})}return a(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 j(e){var t,o=null,i=null,a=null,r=1;if(n(e)||s(e))a=e,o=y(e),i=_(e);else{if(!v.call(e,"name"))throw new Error(function(e){return"Missing ".concat(e," property in key")}("name"));if(t=e.name,a=t,v.call(e,"weight")&&(r=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(t));o=y(t),i=_(t)}return{path:o,id:i,weight:r,src:a}}function y(e){return s(e)?e:e.split(".")}function _(e){return s(e)?e.join("."):e}e=w({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}},{},{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},{},{location:0,threshold:.6,distance:100},{},{useExtendedSearch:!1,getFn:function(e,o){var i=[],a=!1;return function e(o,r,c){if(t(o))if(r[c]){if(l=o[r[c]],!t(l))return;if(c===r.length-1&&(n(l)||C(l)||k(l)))i.push(function(e){return e==null?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(l));else if(s(l)){a=!0;for(var l,d=0,u=l.length;d<u;d+=1)e(l[d],r,c+1)}else r.length&&e(l,r,c+1)}else i.push(o)}(e,n(o)?o.split("."):o,0),a?i:i[0]},ignoreLocation:!1,ignoreFieldNorm:!1}),O=/[^ ]+/g;function M(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,e=new Map,t=Math.pow(10,n);return{get:function(n){if(s=n.match(O).length,e.has(s))return e.get(s);var s,i=1/Math.sqrt(s),o=parseFloat(Math.round(i*t)/t);return e.set(s,o),o},clear:function(){e.clear()}}}c=function(){function o(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.getFn,s=void 0===t?e.getFn:t;r(this,o),this.norm=M(3),this.getFn=s,this.isCreated=!1,this.setIndexRecords()}return a(o,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=e,this._keysMap={},e.forEach(function(e,n){t._keysMap[e.id]=n})}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,n(this.docs[0])?this.docs.forEach(function(t,n){e._addString(t,n)}):this.docs.forEach(function(t,n){e._addObject(t,n)}),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();n(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"getValueForItemAtKeyId",value:function(e,t){return e[this._keysMap[t]]}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,n){if(t(e)&&!h(e)){var s={v:e,i:n,n:this.norm.get(e)};this.records.push(s)}}},{key:"_addObject",value:function(e,o){var i=this,a={i:o,$:{}};this.keys.forEach(function(o,r){var l,c=i.getFn(e,o.path);t(c)&&(s(c)?!function(){for(l=[],o=[{nestedArrIndex:-1,value:c}];o.length;){var o,l,u,d=o.pop(),m=d.nestedArrIndex,e=d.value;t(e)&&(n(e)&&!h(e)?(u={v:e,i:m,n:i.norm.get(e)},l.push(u)):s(e)&&e.forEach(function(e,t){o.push({nestedArrIndex:t,value:e})}))}a.$[r]=l}():h(c)||(l={v:c,n:i.norm.get(c)},a.$[r]=l))}),this.records.push(a)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),o}();function f(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.getFn,a=void 0===o?e.getFn:o,s=new c({getFn:a});return s.setKeys(t.map(j)),s.setSources(n),s.create(),s}function i(t){var s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=n.errors,f=void 0===d?0:d,l=n.currentLocation,u=void 0===l?0:l,a=n.expectedLocation,h=void 0===a?0:a,r=n.distance,c=void 0===r?e.distance:r,i=n.ignoreLocation,m=void 0===i?e.ignoreLocation:i,o=f/t.length;return m?o:(s=Math.abs(h-u),c?o+s/c:s?1:o)}function A(){for(var i,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.minMatchCharLength,o=[],t=-1,r=-1,n=0,c=s.length;n<c;n+=1)i=s[n],i&&-1===t?t=n:i||-1===t||((r=n-1)-t+1>=a&&o.push([t,r]),t=-1);return s[n-1]&&n-t>=a&&o.push([t,n-1]),o}function S(e){for(var s,n={},t=0,o=e.length;t<o;t+=1)s=e.charAt(t),n[s]=(n[s]||0)|1<<o-t-1;return n}x=function(){function t(n){var o,i,c,j=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=s.location,x=void 0===u?e.location:u,p=s.threshold,w=void 0===p?e.threshold:p,l=s.distance,k=void 0===l?e.distance:l,h=s.includeMatches,C=void 0===h?e.includeMatches:h,f=s.findAllMatches,O=void 0===f?e.findAllMatches:f,g=s.minMatchCharLength,y=void 0===g?e.minMatchCharLength:g,d=s.isCaseSensitive,b=void 0===d?e.isCaseSensitive:d,v=s.ignoreLocation,_=void 0===v?e.ignoreLocation:v;if(r(this,t),this.options={location:x,threshold:w,distance:k,includeMatches:C,findAllMatches:O,minMatchCharLength:y,isCaseSensitive:b,ignoreLocation:_},this.pattern=b?n:n.toLowerCase(),this.chunks=[],this.pattern.length)if(i=function(e,t){j.chunks.push({pattern:e,alphabet:S(e),startIndex:t})},o=this.pattern.length,o>32){for(var a=0,m=o%32,E=o-m;a<E;)i(this.pattern.substr(a,32),a),a+=32;m&&(c=o-32,i(this.pattern.substr(c),c))}else i(this.pattern,0)}return a(t,[{key:"searchIn",value:function(t){var d=this.options,b=d.isCaseSensitive,r=d.includeMatches;if(b||(t=t.toLowerCase()),this.pattern===t)return c={isMatch:!0,score:0},r&&(c.indices=[[0,t.length-1]]),c;var a,c,n=this.options,v=n.location,h=n.distance,g=n.threshold,p=n.findAllMatches,m=n.minMatchCharLength,f=n.ignoreLocation,o=[],u=0,s=!1;return this.chunks.forEach(function(n){var b=n.pattern,j=n.alphabet,y=n.startIndex,a=function(t,n,s){var o,r,f,p,b,x,S,M,D,H,B,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},$=c.location,U=void 0===$?e.location:$,F=c.distance,j=void 0===F?e.distance:F,N=c.threshold,q=void 0===N?e.threshold:N,V=c.findAllMatches,K=void 0===V?e.findAllMatches:V,z=c.minMatchCharLength,T=void 0===z?e.minMatchCharLength:z,P=c.includeMatches,W=void 0===P?e.includeMatches:P,L=c.ignoreLocation,y=void 0===L?e.ignoreLocation:L;if(n.length>32)throw new Error(R(32));for(var _,d=n.length,g=t.length,a=Math.max(0,Math.min(U,g)),m=q,h=a,v=T>1||W,k=v?Array(g):[];(_=t.indexOf(n,h))>-1;)if(D=i(n,{currentLocation:_,expectedLocation:a,distance:j,ignoreLocation:y}),m=Math.min(D,m),h=_+d,v)for(x=0;x<d;)k[_+x]=1,x+=1;h=-1;for(var O=[],E=1,w=d+g,Y=1<<d-1,l=0;l<d;l+=1){for(f=0,r=w;f<r;)H=i(n,{errors:l,currentLocation:a+r,expectedLocation:a,distance:j,ignoreLocation:y}),H<=m?f=r:w=r,r=Math.floor((w-f)/2+f);var w=r,I=Math.max(1,a-r+1),C=K?g:Math.min(a+r,g)+d,u=Array(C+2);u[C+1]=(1<<l)-1;for(o=C;o>=I;o-=1)if(p=o-1,M=s[t.charAt(p)],v&&(k[p]=+!!M),u[o]=(u[o+1]<<1|1)&M,l&&(u[o]|=(O[o+1]|O[o])<<1|1|O[o+1]),u[o]&Y&&(E=i(n,{errors:l,currentLocation:p,expectedLocation:a,distance:j,ignoreLocation:y}))<=m){if(m=E,(h=p)<=a)break;I=Math.max(1,2*a-h)}if(B=i(n,{errors:l+1,currentLocation:a,expectedLocation:a,distance:j,ignoreLocation:y}),B>m)break;O=u}return b={isMatch:h>=0,score:Math.max(.001,E)},v&&(S=A(k,T),S.length?W&&(b.indices=S):b.isMatch=!1),b}(t,b,j,{location:v+y,distance:h,threshold:g,findAllMatches:p,minMatchCharLength:m,includeMatches:r,ignoreLocation:f}),c=a.isMatch,_=a.score,d=a.indices;c&&(s=!0),u+=_,c&&d&&(o=[].concat(l(o),l(d)))}),a={isMatch:s,score:s?u/this.chunks.length:1},s&&r&&(a.indices=o),a}}]),t}(),u=[];function b(e,t){for(var s,n=0,o=u.length;n<o;n+=1)if(s=u[n],s.condition(e,t))return new s(e,t);return new x(e,t)}function z(t,n){var s=n.ignoreFieldNorm,o=void 0===s?e.ignoreFieldNorm:s;t.forEach(function(e){var t=1;e.matches.forEach(function(e){var n=e.key,a=e.norm,s=e.score,i=n?n.weight:null;t*=Math.pow(0===s&&i?Number.EPSILON:s,(i||1)*(o?1:a))}),e.score=t})}function D(e,n){var s=e.matches;n.matches=[],t(s)&&s.forEach(function(e){if(t(e.indices)&&e.indices.length){var s={indices:e.indices,value:e.value};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),n.matches.push(s)}})}function N(e,t){t.score=e.score}function L(t,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=o.includeMatches,r=void 0===i?e.includeMatches:i,a=o.includeScore,c=void 0===a?e.includeScore:a,s=[];return r&&s.push(D),c&&s.push(N),t.map(function(e){var t=e.idx,o={item:n[t],refIndex:t};return s.length&&s.forEach(function(t){t(e,o)}),o})}return o=function(){function o(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(r(this,o),this.options=w({},e,{},n),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new T(this.options.keys),this.setCollection(t,s)}return a(o,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof c))throw new Error("Incorrect 'index' type");this._myIndex=t||f(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){t(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},n=[],e=0,s=this._docs.length;e<s;e+=1)t=this._docs[e],o(t,e)&&(this.removeAt(e),e-=1,s-=1,n.push(t));return n}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.limit,o=void 0===i?-1:i,t=this.options,r=t.includeMatches,c=t.includeScore,l=t.shouldSort,d=t.sortFn,u=t.ignoreFieldNorm,s=n(e)?n(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return z(s,{ignoreFieldNorm:u}),l&&s.sort(d),C(o)&&o>-1&&(s=s.slice(0,o)),L(s,this._docs,{includeMatches:r,includeScore:c})}},{key:"_searchStringList",value:function(e){var s=b(e,this.options),o=this._myIndex.records,n=[];return o.forEach(function(e){var o=e.v,a=e.i,r=e.n;if(t(o)){var i=s.searchIn(o),c=i.isMatch,l=i.score,d=i.indices;c&&n.push({item:o,idx:a,matches:[{score:l,value:o,norm:r,indices:d}]})}}),n}},{key:"_searchLogical",value:function(){throw new Error("Logical search is not available")}},{key:"_searchObjectList",value:function(e){var o=this,i=b(e,this.options),n=this._myIndex,a=n.keys,r=n.records,s=[];return r.forEach(function(e){var n,r=e.$,c=e.i;t(r)&&(n=[],a.forEach(function(e,t){n.push.apply(n,l(o._findMatches({key:e,value:r[t],searcher:i})))}),n.length&&s.push({idx:c,item:r,matches:n}))}),s}},{key:"_findMatches",value:function(e){var a=e.key,n=e.value,r=e.searcher;if(!t(n))return[];if(o=[],s(n))n.forEach(function(e){var n=e.v,i=e.i,c=e.n;if(t(n)){var s=r.searchIn(n),l=s.isMatch,d=s.score,u=s.indices;l&&o.push({score:d,key:a,value:n,idx:i,norm:c,indices:u})}});else{var o,c=n.v,l=n.n,i=r.searchIn(c),d=i.isMatch,u=i.score,h=i.indices;d&&o.push({score:u,key:a,value:c,norm:l,indices:h})}return o}}]),o}(),o.version="6.4.6",o.createIndex=f,o.parseIndex=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=o.getFn,i=void 0===s?e.getFn:s,a=t.keys,r=t.records,n=new c({getFn:i});return n.setKeys(a),n.setIndexRecords(r),n},o.config=e,o};"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(),(()=>{var i,r,c,e=null,n=document.getElementById("searchResults"),t=document.getElementById("searchInput"),a=null,s=!1;window.onload=function(){var t=new XMLHttpRequest;t.onreadystatechange=function(){if(t.readyState===4)if(t.status===200){var n,s=JSON.parse(t.responseText);s&&(n={distance:100,threshold:.4,ignoreLocation:!0,keys:["title","permalink","summary","content"]},e&&(n={isCaseSensitive:!!e.iscasesensitive&&e.iscasesensitive,includeScore:!!e.includescore&&e.includescore,includeMatches:!!e.includematches&&e.includematches,minMatchCharLength:e.minmatchcharlength?e.minmatchcharlength:1,shouldSort:!e.shouldsort||e.shouldsort,findAllMatches:!!e.findallmatches&&e.findallmatches,keys:e.keys?e.keys:["title","permalink","summary","content"],location:e.location?e.location:0,threshold:e.threshold?e.threshold:.4,distance:e.distance?e.distance:100,ignoreLocation:!e.ignorelocation||e.ignorelocation}),i=new Fuse(s,n))}else console.log(t.responseText)},t.open("GET","../index.json"),t.send()};function o(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(){s=!1,n.innerHTML=t.value="",t.focus()}t.onkeyup=function(){if(i){const e=i.search(this.value.trim());if(e.length!==0){let t="";for(let n in e)t+=`<li class="post-entry"><header class="entry-header">${e[n].item.title} \xBB</header><a href="${e[n].item.permalink}" aria-label="${e[n].item.title}"></a></li>`;n.innerHTML=t,s=!0,r=n.firstChild,c=n.lastChild}else s=!1,n.innerHTML=""}},t.addEventListener("search",function(){this.value||l()}),document.onkeydown=function(e){let d=e.key;var u,i=document.activeElement;let h=document.getElementById("searchbox").contains(i);if(i===t)for(u=document.getElementsByClassName("focus");u.length>0;)u[0].classList.remove("focus");else a&&(i=a);if(d==="Escape")l();else if(!s||!h)return;else d==="ArrowDown"?(e.preventDefault(),i==t?o(n.firstChild.lastChild):i.parentElement!=c&&o(i.parentElement.nextSibling.lastChild)):d==="ArrowUp"?(e.preventDefault(),i.parentElement==r?o(t):i!=t&&o(i.parentElement.previousSibling.lastChild)):d==="ArrowRight"&&i.click()}})() |