"use strict";var i=null,a={};function c(e){var t=e||window.event;(t.code&&"Escape"===t.code||t.keyCode&&27===t.keyCode)&&r()}function s(e){r()}function n(e,t,n,r){var o=document.querySelector(e);o.classList.add("is-active"),document.documentElement.classList.add("is-clipped"),i=o,a={closeByBackground:t,closeByButton:n,closeByEsc:r},t&&o.querySelector(".modal-background").addEventListener("click",s),n&&o.querySelector(".modal-close").addEventListener("click",s),r&&document.addEventListener("keydown",c)}function r(){document.documentElement.classList.remove("is-clipped"),i.classList.remove("is-active"),a.closeByBackground&&i.querySelector(".modal-background").removeEventListener("click",s),a.closeByButton&&i.querySelector(".modal-close").removeEventListener("click",s),a.closeByEsc&&document.removeEventListener("keydown",c)}function t(e){var t=e||window.event;return t.code&&("Enter"===t.code||"NumpadEnter"===t.code)||t.keyCode&&13===t.keyCode}function o(e){var t=e||window.event;return t.code&&"Escape"===t.code||t.keyCode&&27===t.keyCode}var e=document.querySelector("#menu-tags");function u(e){var t,n,r=document.querySelector("#site-search-input");if(r.classList.contains("is-active")){if(r.classList.remove("is-active"),!r.value.trim())return e.preventDefault(),void e.stopPropagation();r.classList.contains("bing")&&(t=r.getAttribute("data-site-url"),t=new URL(t).hostname,r.value+=" site:"+t)}else{e.preventDefault(),e.stopPropagation(),r.classList.contains("bing")&&(n=r.value.split(" site:",1),r.value=0===n.length?"":n[0]),r.classList.add("is-active"),r.focus(),document.addEventListener("click",function e(t){r===t.target||r.contains(t.target)||(r.classList.remove("is-active"),document.removeEventListener("click",e))})}}e&&e.addEventListener("click",function(e){n("#tags-modal",!0,!0,!0),e.preventDefault()});var d=document.querySelector("#site-search-button");d&&d.addEventListener("click",u),d&&d.addEventListener("keydown",function(e){t(e)&&u()});var l=document.querySelectorAll("input:not([type=hidden]):not(.hidden)");function h(e){e&&(document.documentElement.classList.add("user-color-scheme"),window.localStorage.setItem("userColorScheme","light"))}function f(e){e&&(document.documentElement.classList.remove("user-color-scheme"),window.localStorage.removeItem("userColorScheme"))}function v(e){document.documentElement.classList.add("is-dark-mode");var t=document.querySelector(".dark-button.sun");t.classList.add("disabled"),t.removeAttribute("tabindex"),t.setAttribute("aria-hidden","true");var n=document.querySelector(".dark-button.moon");n.classList.remove("disabled"),n.setAttribute("tabindex","0"),n.removeAttribute("aria-hidden"),e&&(document.documentElement.classList.add("user-color-scheme"),window.localStorage.setItem("userColorScheme","dark"))}function m(e){document.documentElement.classList.remove("is-dark-mode");var t=document.querySelector(".dark-button.moon");t.classList.add("disabled"),t.removeAttribute("tabindex"),t.setAttribute("aria-hidden","true");var n=document.querySelector(".dark-button.sun");n.classList.remove("disabled"),n.setAttribute("tabindex","0"),n.removeAttribute("aria-hidden"),e&&(document.documentElement.classList.remove("user-color-scheme"),window.localStorage.removeItem("userColorScheme"))}function g(){var e=window.matchMedia("(prefers-color-scheme: dark)").matches,t=!e;document.documentElement.classList.contains("is-dark-mode")?(t&&document.documentElement.removeAttribute("data-theme"),m(!0),h(e)):(t&&document.documentElement.setAttribute("data-theme","dark"),f(!0),v(t))}l&&Array.prototype.forEach.call(l,function(t){t.addEventListener("keydown",function(e){o(e)&&e.target===t&&(e.target.value="")}.bind(this))});var y=document.querySelectorAll(".dark-button"),p=0!==y.length;p&&Array.prototype.forEach.call(y,function(e){e.addEventListener("click",g),e.addEventListener("keydown",function(e){t(e)&&g()})});var k=window.matchMedia("(prefers-color-scheme: dark)");try{p&&k.addEventListener("change",function(e){e.matches&&(localStorage.getItem("userColorScheme")||v(!1))})}catch(e){p&&k.addListener(function(e){e.matches&&(localStorage.getItem("userColorScheme")||v(!1))})}k=window.matchMedia("(prefers-color-scheme: light)");try{p&&k.addEventListener("change",function(e){e.matches&&(localStorage.getItem("userColorScheme")||m(!1))})}catch(e){p&&k.addListener(function(e){e.matches&&(localStorage.getItem("userColorScheme")||m(!1))})}var b=document.querySelector("#img-modal .modal-content .img-wrap");b&&function(){function e(e){Array.prototype.forEach.call(e,function(e){e.addEventListener("click",function(e){b.style.background="center / contain no-repeat url("+e.target.src+")",n("#img-modal",!0,!0,!0)})})}var t=document.querySelectorAll(".kg-gallery-card img");e(t),e(document.querySelectorAll(".kg-image-card img"))}(),b&&b.addEventListener("click",function(){r()}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t()}(this,function(){function t(e){return(t="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 A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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,r.key,r)}}function e(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach(function(e){o(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function k(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(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 c(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 l(e){return Array.isArray?Array.isArray(e):"[object Array]"===s(e)}var n=1/0;function u(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-n?"-0":t}(e)}function v(e){return"string"==typeof e}function m(e){return"number"==typeof e}function d(e){return!0===e||!1===e||h(t=e)&&null!==t&&"[object Boolean]"==s(e);var t}function h(e){return"object"===t(e)}function f(e){return null!=e}function g(e){return!e.trim().length}function s(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var y="Extended search is not available",p=function(e){return"Missing ".concat(e," property in key")},b=function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")},L=Object.prototype.hasOwnProperty,S=function(){function t(e){var n=this;A(this,t),this._keys=[],this._keyMap={};var r=0;e.forEach(function(e){var t=w(e);r+=t.weight,n._keys.push(t),n._keyMap[t.id]=t,r+=t.weight}),this._keys.forEach(function(e){e.weight/=r})}return e(t,[{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)}}]),t}();function w(e){var t=null,n=null,r=null,o=1;if(v(e)||l(e))t=E(r=e),n=M(e);else{if(!L.call(e,"name"))throw new Error(p("name"));var i=e.name,r=i;if(L.call(e,"weight")&&(o=e.weight)<=0)throw new Error(b(i));t=E(i),n=M(i)}return{path:t,id:n,weight:o,src:r}}function E(e){return l(e)?e:e.split(".")}function M(e){return l(e)?e.join("."):e}var U=a({},{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,t){var c=[],s=!1;return function e(t,n,r){if(n[r]){var o=t[n[r]];if(!f(o))return;if(r===n.length-1&&(v(o)||m(o)||d(o)))c.push(u(o));else if(l(o)){s=!0;for(var i=0,a=o.length;i<a;i+=1)e(o[i],n,r+1)}else n.length&&e(o,n,r+1)}else c.push(t)}(e,v(t)?t.split("."):t,0),s?c:c[0]},ignoreLocation:!1,ignoreFieldNorm:!1}),x=/[^ ]+/g;var C=function(){function n(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).getFn,t=void 0===e?U.getFn:e;A(this,n),this.norm=function(e){var r=0<arguments.length&&void 0!==e?e:3,o=new Map;return{get:function(e){var t=e.match(x).length;if(o.has(t))return o.get(t);var n=parseFloat((1/Math.sqrt(t)).toFixed(r));return o.set(t,n),n},clear:function(){o.clear()}}}(3),this.getFn=t,this.isCreated=!1,this.setIndexRecords()}return e(n,[{key:"setSources",value:function(e){var t=0<arguments.length&&void 0!==e?e:[];this.docs=t}},{key:"setIndexRecords",value:function(e){var t=0<arguments.length&&void 0!==e?e:[];this.records=t}},{key:"setKeys",value:function(e){var n=this,t=0<arguments.length&&void 0!==e?e:[];this.keys=t,this._keysMap={},t.forEach(function(e,t){n._keysMap[e.id]=t})}},{key:"create",value:function(){var n=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,v(this.docs[0])?this.docs.forEach(function(e,t){n._addString(e,t)}):this.docs.forEach(function(e,t){n._addObject(e,t)}),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();v(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}},{key:"getValueForItemAtKeyId",value:function(e,t){return e[this._keysMap[t]]}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){var n;f(e)&&!g(e)&&(n={v:e,i:t,n:this.norm.get(e)},this.records.push(n))}},{key:"_addObject",value:function(n,e){var s=this,u={i:e,$:{}};this.keys.forEach(function(e,a){var t,c=s.getFn(n,e.path);f(c)&&(l(c)?function(){for(var e=[],n=[{nestedArrIndex:-1,value:c}];n.length;){var t,r=n.pop(),o=r.nestedArrIndex,i=r.value;f(i)&&(v(i)&&!g(i)?(t={v:i,i:o,n:s.norm.get(i)},e.push(t)):l(i)&&i.forEach(function(e,t){n.push({nestedArrIndex:t,value:e})}))}u.$[a]=e}():g(c)||(t={v:c,n:s.norm.get(c)},u.$[a]=t))}),this.records.push(u)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),n}();function I(e,t){var n=(2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).getFn,r=void 0===n?U.getFn:n,o=new C({getFn:r});return o.setKeys(e.map(w)),o.setSources(t),o.create(),o}function _(e,n){var t=e.matches;n.matches=[],f(t)&&t.forEach(function(e){var t;f(e.indices)&&e.indices.length&&(t={indices:e.indices,value:e.value},e.key&&(t.key=e.key.src),-1<e.idx&&(t.refIndex=e.idx),n.matches.push(t))})}function O(e,t){t.score=e.score}function z(e,t){var n=1<arguments.length&&void 0!==t?t:{},r=n.errors,o=void 0===r?0:r,i=n.currentLocation,a=void 0===i?0:i,c=n.expectedLocation,s=void 0===c?0:c,u=n.distance,d=void 0===u?U.distance:u,l=n.ignoreLocation,h=void 0===l?U.ignoreLocation:l,f=o/e.length;if(h)return f;var v=Math.abs(s-a);return d?f+v/d:v?1:f}var H=32;function j(e,t,n,r){var o=3<arguments.length&&void 0!==r?r:{},i=o.location,a=void 0===i?U.location:i,c=o.distance,s=void 0===c?U.distance:c,u=o.threshold,d=void 0===u?U.threshold:u,l=o.findAllMatches,h=void 0===l?U.findAllMatches:l,f=o.minMatchCharLength,v=void 0===f?U.minMatchCharLength:f,m=o.includeMatches,g=void 0===m?U.includeMatches:m,y=o.ignoreLocation,p=void 0===y?U.ignoreLocation:y;if(t.length>H)throw new Error("Pattern length exceeds max of ".concat(H,"."));for(var k,b=t.length,L=e.length,S=Math.max(0,Math.min(a,L)),w=d,E=S,M=1<v||g,A=M?Array(L):[];-1<(k=e.indexOf(t,E));){var x=z(t,{currentLocation:k,expectedLocation:S,distance:s,ignoreLocation:p}),w=Math.min(x,w),E=k+b;if(M)for(var C=0;C<b;)C+=A[k+C]=1}E=-1;for(var I=[],_=1,O=b+L,j=1<<b-1,q=0;q<b;q+=1){for(var F=0,P=O;F<P;){z(t,{errors:q,currentLocation:S+P,expectedLocation:S,distance:s,ignoreLocation:p})<=w?F=P:O=P,P=Math.floor((O-F)/2+F)}O=P;var N=Math.max(1,S-P+1),T=h?L:Math.min(S+P,L)+b,B=Array(T+2);B[T+1]=(1<<q)-1;for(var D=T;N<=D;--D){var $=D-1,R=n[e.charAt($)];if(M&&(A[$]=+!!R),B[D]=(B[D+1]<<1|1)&R,q&&(B[D]|=(I[D+1]|I[D])<<1|1|I[D+1]),B[D]&j&&(_=z(t,{errors:q,currentLocation:$,expectedLocation:S,distance:s,ignoreLocation:p}))<=w){if(w=_,(E=$)<=S)break;N=Math.max(1,2*S-E)}}if(w<z(t,{errors:q+1,currentLocation:S,expectedLocation:S,distance:s,ignoreLocation:p}))break;I=B}var J,K={isMatch:0<=E,score:Math.max(.001,_)};return M&&((J=function(e,t){for(var n,r=0<arguments.length&&void 0!==e?e:[],o=1<arguments.length&&void 0!==t?t:U.minMatchCharLength,i=[],a=-1,c=0,s=r.length;c<s;c+=1){var u=r[c];u&&-1===a?a=c:u||-1===a||(o<=(n=c-1)-a+1&&i.push([a,n]),a=-1)}return r[c-1]&&o<=c-a&&i.push([a,c-1]),i}(A,v)).length?g&&(K.indices=J):K.isMatch=!1),K}var q=function(){function M(e){var n=this,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.location,o=void 0===r?U.location:r,i=t.threshold,a=void 0===i?U.threshold:i,c=t.distance,s=void 0===c?U.distance:c,u=t.includeMatches,d=void 0===u?U.includeMatches:u,l=t.findAllMatches,h=void 0===l?U.findAllMatches:l,f=t.minMatchCharLength,v=void 0===f?U.minMatchCharLength:f,m=t.isCaseSensitive,g=void 0===m?U.isCaseSensitive:m,y=t.ignoreLocation,p=void 0===y?U.ignoreLocation:y;if(A(this,M),this.options={location:o,threshold:a,distance:s,includeMatches:d,findAllMatches:h,minMatchCharLength:v,isCaseSensitive:g,ignoreLocation:p},this.pattern=g?e:e.toLowerCase(),this.chunks=[],this.pattern.length){var k=function(e,t){n.chunks.push({pattern:e,alphabet:function(e){for(var t={},n=0,r=e.length;n<r;n+=1){var o=e.charAt(n);t[o]=(t[o]||0)|1<<r-n-1}return t}(e),startIndex:t})},b=this.pattern.length;if(H<b){for(var L,S=0,w=b%H,E=b-w;S<E;)k(this.pattern.substr(S,H),S),S+=H;w&&(L=b-H,k(this.pattern.substr(L),L))}else k(this.pattern,0)}}return e(M,[{key:"searchIn",value:function(s){var e=this.options,t=e.isCaseSensitive,u=e.includeMatches;if(t||(s=s.toLowerCase()),this.pattern===s){var n={isMatch:!0,score:0};return u&&(n.indices=[[0,s.length-1]]),n}var r=this.options,d=r.location,l=r.distance,h=r.threshold,f=r.findAllMatches,v=r.minMatchCharLength,m=r.ignoreLocation,g=[],y=0,p=!1;this.chunks.forEach(function(e){var t=e.pattern,n=e.alphabet,r=e.startIndex,o=j(s,t,n,{location:d+r,distance:l,threshold:h,findAllMatches:f,minMatchCharLength:v,includeMatches:u,ignoreLocation:m}),i=o.isMatch,a=o.score,c=o.indices;i&&(p=!0),y+=a,i&&c&&(g=[].concat(k(g),k(c)))});var o={isMatch:p,score:p?y/this.chunks.length:1};return p&&u&&(o.indices=g),o}}]),M}(),F=[];function P(e,t){for(var n=0,r=F.length;n<r;n+=1){var o=F[n];if(o.condition(e,t))return new o(e,t)}return new q(e,t)}function N(e){return!(!e[B]&&!e[D])}function T(t){return o({},B,Object.keys(t).map(function(e){return o({},e,t[e])}))}var B="$and",D="$or",$="$path",R="$val";var J=function(){function r(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0;if(A(this,r),this.options=a({},U,{},t),this.options.useExtendedSearch)throw new Error(y);this._keyStore=new S(this.options.keys),this.setCollection(e,n)}return e(r,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof C))throw new Error("Incorrect 'index' type");this._myIndex=t||I(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(e){for(var t=0<arguments.length&&void 0!==e?e:function(){return!1},n=[],r=0,o=this._docs.length;r<o;r+=1){var i=this._docs[r];t(i,r)&&(this.removeAt(r),--r,n.push(i))}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,t){var n,r,a,o=(1<arguments.length&&void 0!==t?t:{}).limit,i=void 0===o?-1:o,c=this.options,s=c.includeMatches,u=c.includeScore,d=c.shouldSort,l=c.sortFn,h=c.ignoreFieldNorm,f=v(e)?v(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return n=f,r={ignoreFieldNorm:h}.ignoreFieldNorm,a=void 0===r?U.ignoreFieldNorm:r,n.forEach(function(e){var i=1;e.matches.forEach(function(e){var t=e.key,n=e.norm,r=e.score,o=t?t.weight:null;i*=Math.pow(0===r&&o?Number.EPSILON:r,(o||1)*(a?1:n))}),e.score=i}),d&&f.sort(l),m(i)&&-1<i&&(f=f.slice(0,i)),function(e,r){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},n=t.includeMatches,o=void 0===n?U.includeMatches:n,i=t.includeScore,a=void 0===i?U.includeScore:i,c=[];o&&c.push(_);a&&c.push(O);return e.map(function(t){var e=t.idx,n={item:r[e],refIndex:e};return c.length&&c.forEach(function(e){e(t,n)}),n})}(f,this._docs,{includeMatches:s,includeScore:u})}},{key:"_searchStringList",value:function(e){var s=P(e,this.options),t=this._myIndex.records,u=[];return t.forEach(function(e){var t,n,r,o,i=e.v,a=e.i,c=e.n;f(i)&&(n=(t=s.searchIn(i)).isMatch,r=t.score,o=t.indices,n&&u.push({item:i,idx:a,matches:[{score:r,value:i,norm:c,indices:o}]}))}),u}},{key:"_searchLogical",value:function(){throw new Error("Logical search is not available")}},{key:"_searchObjectList",value:function(e){var o=this,i=P(e,this.options),t=this._myIndex,a=t.keys,n=t.records,c=[];return n.forEach(function(e){var n,r=e.$,t=e.i;f(r)&&(n=[],a.forEach(function(e,t){n.push.apply(n,k(o._findMatches({key:e,value:r[t],searcher:i})))}),n.length&&c.push({idx:t,item:r,matches:n}))}),c}},{key:"_findMatches",value:function(e){var s=e.key,t=e.value,u=e.searcher;if(!f(t))return[];var n,r,o,i,a,c,d=[];return l(t)?t.forEach(function(e){var t,n,r,o,i=e.v,a=e.i,c=e.n;f(i)&&(n=(t=u.searchIn(i)).isMatch,r=t.score,o=t.indices,n&&d.push({score:r,key:s,value:i,idx:a,norm:c,indices:o}))}):(n=t.v,r=t.n,i=(o=u.searchIn(n)).isMatch,a=o.score,c=o.indices,i&&d.push({score:a,key:s,value:n,norm:r,indices:c})),d}}]),r}();return J.version="6.4.1",J.createIndex=I,J.parseIndex=function(e){var t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).getFn,n=void 0===t?U.getFn:t,r=e.keys,o=e.records,i=new C({getFn:n});return i.setKeys(r),i.setIndexRecords(o),i},J.config=U,J.parseQuery=function(e,u){var t=(2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).auto,d=void 0===t||t;return N(e)||(e=T(e)),function n(r){var e,t=Object.keys(r),o=!!r[$];if(!o&&1<t.length&&!N(r))return n(T(r));if(!l(e=r)&&h(e)&&!N(e)){var i=o?r[$]:t[0],a=o?r[R]:r[i];if(!v(a))throw new Error("Invalid value for key ".concat(i));var c={keyId:M(i),pattern:a};return d&&(c.searcher=P(a,u)),c}var s={children:[],operator:t[0]};return t.forEach(function(e){var t=r[e];l(t)&&t.forEach(function(e){s.children.push(n(e))})}),s}(e)},J});var L={threshold:0,ignoreLocation:!0,minMatchCharLength:2,keys:[{name:"title",weight:10},{name:"tags",weight:9},{name:"authors",weight:8},{name:"custom_excerpt",weight:7},"plaintext"]};function S(){var e=document.querySelector("#search-modal .control.search"),t=document.querySelector("#search-modal .control.search input.search");e.classList.remove("loading"),e.classList.add("loaded"),t.removeAttribute("disabled"),t.setAttribute("placeholder",""),t.focus()}function w(e){var t=document.querySelector("#search-modal .control.search"),n=document.querySelector("#search-modal .control.search input.search"),r=document.querySelector("#search-modal .tips.error");t.classList.remove("loading"),t.classList.add("loaded"),n.setAttribute("placeholder",""),r.innerText=e||r.getAttribute("data-error-tips"),r.classList.add("is-active")}var E=null;function M(e){window.sessionStorage.setItem("searchData",JSON.stringify(e))}function A(){var e=window.sessionStorage.getItem("searchData");return!!e&&(E=new Fuse(JSON.parse(e),L),S(),!0)}function x(){var e,i;"undefined"!=typeof searchContentAPIKey&&searchContentAPIKey?(e=("undefined"!=typeof ghostAdminURL&&ghostAdminURL?ghostAdminURL:"")+"/ghost/api/v2/content/posts/?key="+searchContentAPIKey+"&limit=all&formats=plaintext&include=authors,tags&fields=url,title,custom_excerpt,plaintext",(i=new XMLHttpRequest).open("GET",e,!0),i.onload=function(e){if(i.status<200||400<=i.status){for(var t="Can't load search data, HTTP response status code: "+i.status+"\n",n=JSON.parse(i.response).errors,r=0;r<n.length;r++)t+="  Error type: "+n[r].errorType+", Message: "+n[r].message+"\n";return w(0<n.length?n[0].message:""),void console.error(t)}var o=JSON.parse(i.response).posts;if(!o.length)return w(""),void console.error("No search data.");o.forEach(function(e){var t,n=[];e.authors.forEach(function(e){n.push(e.name)}),delete e.authors,e.authors=n,e.tags&&(t=[],e.tags.forEach(function(e){t.push(e.name)}),delete e.tags,e.tags=t)}),E=new Fuse(o,L),S(),M(o),3145728<=e.loaded&&console.warn("The index data of posts is larger than 3MB, size: ",e.loaded,"bytes.")},i.onerror=function(e){console.error("There was an error when loading search data,",e.loaded,"bytes transferred.")},i.send()):w(document.querySelector("#search-modal .control.search").getAttribute("data-no-api-key-tips"))}function C(){A()||x()}function I(){n("#search-modal",!1,!0,!1),E?document.querySelector("#search-modal .control.search input.search").focus():C()}var _=document.querySelector("#local-search");function O(e){var r,t,n=document.querySelector("#search-modal .results");e.length?(r=document.createElement("ul"),e.forEach(function(e){var t=document.createElement("li");t.classList.add("item");var n=document.createElement("a");n.href=e.url,n.classList.add("title"),n.innerText=e.title,t.appendChild(n),r.appendChild(t)}),n.innerText="",(t=document.querySelector("#search-modal .results > ul"))?n.replaceChild(r,t):n.appendChild(r)):n.innerText=n.getAttribute("data-no-result-tips")}_&&_.addEventListener("click",I),_&&_.addEventListener("keydown",function(e){t(e)&&I()});var j=null;document.querySelector("#search-modal .control.search .input.search").addEventListener("input",function(o){clearTimeout(j),j=setTimeout(function(){var t,n,r=[],e=o.target.value?o.target.value.split(/\s+/):[];e.length&&(t=""===e[e.length-1]?e.length-1:e.length)&&(n={},e.forEach(function(e){e.length&&E.search(e).forEach(function(e){n[e.item.title]?n[e.item.title]+=1:n[e.item.title]=1,n[e.item.title]>=t&&r.push(e.item)})})),O(r)}.bind(this),100)});