You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
23 KiB
JavaScript
2 lines
23 KiB
JavaScript
!function(){const a=function(e){var t=new a.Index;return t.pipeline.add(a.trimmer,a.stopWordFilter,a.stemmer),e&&e.call(t,t),t};var t;a.version="0.9.5",(lunr=a).utils={},a.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),a.utils.toString=function(e){return null==e?"":e.toString()},a.EventEmitter=function(){this.events={}},a.EventEmitter.prototype.addListener=function(){const e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},a.EventEmitter.prototype.removeListener=function(e,t){this.hasHandler(e)&&-1!==(t=this.events[e].indexOf(t))&&(this.events[e].splice(t,1),0===this.events[e].length)&&delete this.events[e]},a.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){const t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},a.EventEmitter.prototype.hasHandler=function(e){return e in this.events},a.tokenizer=function(n){if(!arguments.length||null==n)return[];if(Array.isArray(n)){let e=n.filter(function(e){return null!=e}),t=(e=e.map(function(e){return a.utils.toString(e).toLowerCase()}),[]);return e.forEach(function(e){e=e.split(a.tokenizer.seperator),t=t.concat(e)},this),t}return n.toString().trim().toLowerCase().split(a.tokenizer.seperator)},a.tokenizer.defaultSeperator=/[\s-]+/,a.tokenizer.seperator=a.tokenizer.defaultSeperator,a.tokenizer.setSeperator=function(e){null!=e&&"object"==typeof e&&(a.tokenizer.seperator=e)},a.tokenizer.resetSeperator=function(){a.tokenizer.seperator=a.tokenizer.defaultSeperator},a.tokenizer.getSeperator=function(){return a.tokenizer.seperator},a.Pipeline=function(){this._queue=[]},a.Pipeline.registeredFunctions={},a.Pipeline.registerFunction=function(e,t){t in a.Pipeline.registeredFunctions&&a.utils.warn("Overwriting existing registered function: "+t),e.label=t,a.Pipeline.registeredFunctions[t]=e},a.Pipeline.getRegisteredFunction=function(e){return e in a.Pipeline.registeredFunctions!=1?null:a.Pipeline.registeredFunctions[e]},a.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||a.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},a.Pipeline.load=function(e){const n=new a.Pipeline;return e.forEach(function(e){var t=a.Pipeline.getRegisteredFunction(e);if(!t)throw new Error("Cannot load un-registered function: "+e);n.add(t)}),n},a.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){a.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},a.Pipeline.prototype.after=function(e,t){if(a.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e+1,0,t)},a.Pipeline.prototype.before=function(e,t){if(a.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e,0,t)},a.Pipeline.prototype.remove=function(e){-1!==(e=this._queue.indexOf(e))&&this._queue.splice(e,1)},a.Pipeline.prototype.run=function(o){var e=[],t=o.length,i=this._queue.length;for(let n=0;n<t;n++){let t=o[n];for(let e=0;e<i&&null!=(t=this._queue[e](t,n,o));e++);null!=t&&e.push(t)}return e},a.Pipeline.prototype.reset=function(){this._queue=[]},a.Pipeline.prototype.get=function(){return this._queue},a.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return a.Pipeline.warnIfFunctionNotRegistered(e),e.label})},a.Index=function(){this._fields=[],this._ref="id",this.pipeline=new a.Pipeline,this.documentStore=new a.DocumentStore,this.index={},this.eventEmitter=new a.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},a.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},a.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},a.Index.load=function(e){e.version!==a.version&&a.utils.warn("version mismatch: current "+a.version+" importing "+e.version);var t=new this;t._fields=e.fields,t._ref=e.ref,t.documentStore=a.DocumentStore.load(e.documentStore),t.pipeline=a.Pipeline.load(e.pipeline),t.index={};for(const n in e.index)t.index[n]=a.InvertedIndex.load(e.index[n]);return t},a.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new a.InvertedIndex,this},a.Index.prototype.setRef=function(e){return this._ref=e,this},a.Index.prototype.saveDocument=function(e){return this.documentStore=new a.DocumentStore(e),this},a.Index.prototype.addDoc=function(i,e){if(i){e=void 0===e||e;const r=i[this._ref];this.documentStore.addDoc(r,i),this._fields.forEach(function(e){var t=this.pipeline.run(a.tokenizer(i[e]));this.documentStore.addFieldLength(r,e,t.length);const n={};t.forEach(function(e){e in n?n[e]+=1:n[e]=1},this);for(const a in n){var o=n[a],o=Math.sqrt(o);this.index[e].addToken(a,{ref:r,tf:o})}},this),e&&this.eventEmitter.emit("add",i,this)}},a.Index.prototype.removeDocByRef=function(e,t){e&&!1!==this.documentStore.isDocStored()&&this.documentStore.hasDoc(e)&&(e=this.documentStore.getDoc(e),this.removeDoc(e,!1))},a.Index.prototype.removeDoc=function(e,t){if(e){t=void 0===t||t;const n=e[this._ref];this.documentStore.hasDoc(n)&&(this.documentStore.removeDoc(n),this._fields.forEach(function(t){this.pipeline.run(a.tokenizer(e[t])).forEach(function(e){this.index[t].removeToken(e,n)},this)},this),t)&&this.eventEmitter.emit("remove",e,this)}},a.Index.prototype.updateDoc=function(e,t){t=void 0===t||t,this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},a.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;return Object.prototype.hasOwnProperty.call(this._idfCache,n)?this._idfCache[n]:(t=this.index[t].getDocFreq(e),e=1+Math.log(this.documentStore.length/(t+1)),this._idfCache[n]=e)},a.Index.prototype.getFields=function(){return this._fields.slice()},a.Index.prototype.search=function(t,e){if(!t)return[];t="string"==typeof t?{any:t}:JSON.parse(JSON.stringify(t));let n=null;null!=e&&(n=JSON.stringify(e));var o=new a.Configuration(n,this.getFields()).get(),i={},r=Object.keys(t);for(let e=0;e<r.length;e++){const n=r[e];i[n]=this.pipeline.run(a.tokenizer(t[n]))}var s={};for(const a in o){const t=i[a]||i.any;if(t){const e=this.fieldSearch(t,a,o),n=o[a].boost;for(var l in e)e[l]=e[l]*n;for(var l in e)l in s?s[l]+=e[l]:s[l]=e[l]}}var u,c=[];for(l in s)u={ref:l,score:s[l]},this.documentStore.hasDoc(l)&&(u.doc=this.documentStore.getDoc(l)),c.push(u);return c.sort(function(e,t){return t.score-e.score}),c},a.Index.prototype.fieldSearch=function(e,c,t){const a=t[c].bool,n=t[c].expand,o=t[c].boost;let d=null;const f={};if(0!==o)return e.forEach(function(l){let e=[l];!0===n&&(e=this.index[c].expandToken(l));const u={};e.forEach(function(n){let o=this.index[c].getDocs(n);var i=this.idf(n,c);if(d&&"AND"===a){const l={};for(var r in d)r in o&&(l[r]=o[r]);o=l}for(r in n===l&&this.fieldSearchStats(f,n,o),o){const a=this.index[c].getTermFrequency(n,r),o=this.documentStore.getFieldLength(r,c);let e=1,t=(0!==o&&(e=1/Math.sqrt(o)),1);n!==l&&(t=.15*(1-(n.length-l.length)/n.length));var s=a*i*e*t;r in u?u[r]+=s:u[r]=s}},this),d=this.mergeScores(d,u,a)},this),d=this.coordNorm(d,f,e.length)},a.Index.prototype.mergeScores=function(e,t,n){if(!e)return t;if("AND"===n){const n={};for(var o in t)o in e&&(n[o]=e[o]+t[o]);return n}for(var o in t)o in e?e[o]+=t[o]:e[o]=t[o];return e},a.Index.prototype.fieldSearchStats=function(e,t,n){for(const o in n)o in e?e[o].push(t):e[o]=[t]},a.Index.prototype.coordNorm=function(e,t,n){for(const i in e){var o;i in t&&(o=t[i].length,e[i]=e[i]*o/n)}return e},a.Index.prototype.toJSON=function(){const t={};return this._fields.forEach(function(e){t[e]=this.index[e].toJSON()},this),{version:a.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),index:t,pipeline:this.pipeline.toJSON()}},a.Index.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},a.DocumentStore=function(e){this._save=null==e||e,this.docs={},this.docInfo={},this.length=0},a.DocumentStore.load=function(e){var t=new this;return t.length=e.length,t.docs=e.docs,t.docInfo=e.docInfo,t._save=e.save,t},a.DocumentStore.prototype.isDocStored=function(){return this._save},a.DocumentStore.prototype.addDoc=function(e,t){this.hasDoc(e)||this.length++,!0===this._save?this.docs[e]=function(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(const n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(t):this.docs[e]=null},a.DocumentStore.prototype.getDoc=function(e){return!1===this.hasDoc(e)?null:this.docs[e]},a.DocumentStore.prototype.hasDoc=function(e){return e in this.docs},a.DocumentStore.prototype.removeDoc=function(e){this.hasDoc(e)&&(delete this.docs[e],delete this.docInfo[e],this.length--)},a.DocumentStore.prototype.addFieldLength=function(e,t,n){null!=e&&0!=this.hasDoc(e)&&(this.docInfo[e]||(this.docInfo[e]={}),this.docInfo[e][t]=n)},a.DocumentStore.prototype.updateFieldLength=function(e,t,n){null!=e&&0!=this.hasDoc(e)&&this.addFieldLength(e,t,n)},a.DocumentStore.prototype.getFieldLength=function(e,t){return null!=e&&e in this.docs&&t in this.docInfo[e]?this.docInfo[e][t]:0},a.DocumentStore.prototype.toJSON=function(){return{docs:this.docs,docInfo:this.docInfo,length:this.length,save:this._save}},a.stemmer=function(){const c={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},e="[aeiouy]",t="[^aeiou][^aeiouy]*",d=new RegExp("^("+t+")?[aeiouy][aeiou]*"+t),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),p=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),g=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,v=/^(.+?)(ed|ing)$/,S=/.$/,x=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),b=new RegExp("^"+t+e+"[^aeiouwxy]$"),E=/^(.+?[^aeiou])y$/,I=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,k=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,D=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,A=/^(.+?)e$/,P=/ll$/,C=new RegExp("^"+t+e+"[^aeiouwxy]$");return function(e){let t,n,o,i,r,s,l;var u;return e.length<3||("y"==(o=e.substr(0,1))&&(e=o.toUpperCase()+e.substr(1)),i=g,r=y,i.test(e)?e=e.replace(i,"$1$2"):r.test(e)&&(e=e.replace(r,"$1$2")),i=m,r=v,i.test(e)?(u=i.exec(e),(i=d).test(u[1])&&(i=S,e=e.replace(i,""))):r.test(e)&&(t=(u=r.exec(e))[1],(r=p).test(t))&&(e=t,r=x,s=w,l=b,r.test(e)?e+="e":s.test(e)?(i=S,e=e.replace(i,"")):l.test(e)&&(e+="e")),(i=E).test(e)&&(e=(t=(u=i.exec(e))[1])+"i"),(i=I).test(e)&&(t=(u=i.exec(e))[1],n=u[2],(i=d).test(t))&&(e=t+c[n]),(i=k).test(e)&&(t=(u=i.exec(e))[1],n=u[2],(i=d).test(t))&&(e=t+a[n]),i=D,r=F,i.test(e)?(t=(u=i.exec(e))[1],(i=f).test(t)&&(e=t)):r.test(e)&&(t=(u=r.exec(e))[1]+u[2],(r=f).test(t))&&(e=t),(i=A).test(e)&&(t=(u=i.exec(e))[1],i=f,r=h,s=C,i.test(t)||r.test(t)&&!s.test(t))&&(e=t),i=P,r=f,i.test(e)&&r.test(e)&&(i=S,e=e.replace(i,"")),"y"==o&&(e=o.toLowerCase()+e.substr(1))),e}}(),a.Pipeline.registerFunction(a.stemmer,"stemmer"),a.stopWordFilter=function(e){if(e&&!0!==a.stopWordFilter.stopWords[e])return e},a.clearStopWords=function(){a.stopWordFilter.stopWords={}},a.addStopWords=function(e){null!=e&&!1!==Array.isArray(e)&&e.forEach(function(e){a.stopWordFilter.stopWords[e]=!0},this)},a.resetStopWords=function(){a.stopWordFilter.stopWords=a.defaultStopWords},a.defaultStopWords={"":!0,a:!0,able:!0,about:!0,across:!0,after:!0,all:!0,almost:!0,also:!0,am:!0,among:!0,an:!0,and:!0,any:!0,are:!0,as:!0,at:!0,be:!0,because:!0,been:!0,but:!0,by:!0,can:!0,cannot:!0,could:!0,dear:!0,did:!0,do:!0,does:!0,either:!0,else:!0,ever:!0,every:!0,for:!0,from:!0,get:!0,got:!0,had:!0,has:!0,have:!0,he:!0,her:!0,hers:!0,him:!0,his:!0,how:!0,however:!0,i:!0,if:!0,in:!0,into:!0,is:!0,it:!0,its:!0,just:!0,least:!0,let:!0,like:!0,likely:!0,may:!0,me:!0,might:!0,most:!0,must:!0,my:!0,neither:!0,no:!0,nor:!0,not:!0,of:!0,off:!0,often:!0,on:!0,only:!0,or:!0,other:!0,our:!0,own:!0,rather:!0,said:!0,say:!0,says:!0,she:!0,should:!0,since:!0,so:!0,some:!0,than:!0,that:!0,the:!0,their:!0,them:!0,then:!0,there:!0,these:!0,they:!0,this:!0,tis:!0,to:!0,too:!0,twas:!0,us:!0,wants:!0,was:!0,we:!0,were:!0,what:!0,when:!0,where:!0,which:!0,while:!0,who:!0,whom:!0,why:!0,will:!0,with:!0,would:!0,yet:!0,you:!0,your:!0},a.stopWordFilter.stopWords=a.defaultStopWords,a.Pipeline.registerFunction(a.stopWordFilter,"stopWordFilter"),a.trimmer=function(e){if(null==e)throw new Error("token should not be undefined");return e.replace(/^\W+/,"").replace(/\W+$/,"")},a.Pipeline.registerFunction(a.trimmer,"trimmer"),a.InvertedIndex=function(){this.root={docs:{},df:0}},a.InvertedIndex.load=function(e){var t=new this;return t.root=e.root,t},a.InvertedIndex.prototype.addToken=function(e,t,n){n=n||this.root;let o=0;for(;o<=e.length-1;){const t=e[o];t in n||(n[t]={docs:{},df:0}),o+=1,n=n[t]}var i=t.ref;n.docs[i]?n.docs[i]={tf:t.tf}:(n.docs[i]={tf:t.tf},n.df+=1)},a.InvertedIndex.prototype.hasToken=function(t){if(!t)return!1;let n=this.root;for(let e=0;e<t.length;e++){if(!n[t[e]])return!1;n=n[t[e]]}return!0},a.InvertedIndex.prototype.getNode=function(t){if(!t)return null;let n=this.root;for(let e=0;e<t.length;e++){if(!n[t[e]])return null;n=n[t[e]]}return n},a.InvertedIndex.prototype.getDocs=function(e){return null==(e=this.getNode(e))?{}:e.docs},a.InvertedIndex.prototype.getTermFrequency=function(e,t){return null!=(e=this.getNode(e))&&t in e.docs?e.docs[t].tf:0},a.InvertedIndex.prototype.getDocFreq=function(e){return null==(e=this.getNode(e))?0:e.df},a.InvertedIndex.prototype.removeToken=function(e,t){e&&null!=(e=this.getNode(e))&&t in e.docs&&(delete e.docs[t],--e.df)},a.InvertedIndex.prototype.expandToken=function(e,t,n){if(null==e||""==e)return[];if(t=t||[],null!=n||null!=(n=this.getNode(e))){0<n.df&&t.push(e);for(const o in n)"docs"!==o&&"df"!==o&&this.expandToken(e+o,t,n[o])}return t},a.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},a.Configuration=function(e,t){if(e=e||"",null==t)throw new Error("fields should not be null");var n;this.config={};try{n=JSON.parse(e),this.buildUserConfig(n,t)}catch(e){a.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(t)}},a.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},a.Configuration.prototype.buildUserConfig=function(t,e){let n="OR",o=!1;if(this.reset(),"bool"in t&&(n=t.bool||n),"expand"in t&&(o=t.expand||o),"fields"in t)for(const i in t.fields)if(-1<e.indexOf(i)){const a=t.fields[i];let e=o;null!=a.expand&&(e=a.expand),this.config[i]={boost:a.boost||0===a.boost?a.boost:1,bool:a.bool||n,expand:e}}else a.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(n,o,e)},a.Configuration.prototype.addAllFields2UserConfig=function(t,n,e){e.forEach(function(e){this.config[e]={boost:1,bool:t,expand:n}},this)},a.Configuration.prototype.get=function(){return this.config},a.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){let e,t;for(e=0;e<arguments.length;e++)t=arguments[e],~this.indexOf(t)||this.elements.splice(this.locationFor(t),0,t);this.length=this.elements.length},lunr.SortedSet.prototype.toArray=function(){return this.elements.slice()},lunr.SortedSet.prototype.map=function(e,t){return this.elements.map(e,t)},lunr.SortedSet.prototype.forEach=function(e,t){return this.elements.forEach(e,t)},lunr.SortedSet.prototype.indexOf=function(e){let t=0,n=this.elements.length,o=n-t,i=t+Math.floor(o/2),r=this.elements[i];for(;1<o;){if(r===e)return i;r<e&&(t=i),r>e&&(n=i),o=n-t,i=t+Math.floor(o/2),r=this.elements[i]}return r===e?i:-1},lunr.SortedSet.prototype.locationFor=function(e){let t=0,n=this.elements.length,o=n-t,i=t+Math.floor(o/2),r=this.elements[i];for(;1<o;)r<e&&(t=i),r>e&&(n=i),o=n-t,i=t+Math.floor(o/2),r=this.elements[i];return r>e?i:r<e?i+1:void 0},lunr.SortedSet.prototype.intersect=function(e){var t=new lunr.SortedSet;let n=0,o=0;for(var i=this.length,r=e.length,s=this.elements,l=e.elements;!(n>i-1||o>r-1);)s[n]!==l[o]?s[n]<l[o]?n++:s[n]>l[o]&&o++:(t.add(s[n]),n++,o++);return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){let t,n,o;n=this.length>=e.length?(t=this,e):(t=e,this),o=t.clone();for(let e=0,t=n.toArray();e<t.length;e++)o.add(t[e]);return o},lunr.SortedSet.prototype.toJSON=function(){return this.toArray()},"function"==typeof define&&define.amd?define(function(){return a}):"object"==typeof exports?module.exports=a:this.elasticlunr=a}(),window.onload=function(){if(document.body.contains(document.getElementById("searchModal"))){const d=document.getElementById("results"),f=document.getElementById("searchInput"),h=document.getElementById("searchModal"),s=document.getElementById("search-button"),p=document.getElementById("n-results"),y=document.getElementById("clear-search"),m=document.getElementById("results-container");let e;{var n=s;const v=window.navigator.userAgent.toLowerCase().includes("mac")?"Cmd + K":"Ctrl + K";["title","aria-label"].forEach(e=>{let t=n.getAttribute(e);t&&(t=t.replace("$SHORTCUT",v),n.setAttribute(e,t))})}s.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||s.click()}),h.addEventListener("click",o),h.addEventListener("touchend",o),document.addEventListener("keydown",function(e){"Escape"===e.key&&u()}),y.addEventListener("click",function(){t(),f.focus()}),y.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||(t(),f.focus(),e.preventDefault())}),s.addEventListener("mouseover",i),s.addEventListener("click",l),s.addEventListener("touchstart",l);let r=null;function l(){e=document.activeElement,i(),h.style.display="block",f.focus()}function u(){h.style.display="none",t(),e&&document.body.contains(e)&&e.focus()}function c(e){var t;"true"!==e.getAttribute("aria-selected")&&([t=null]=[e],d.querySelectorAll("#results > div").forEach(e=>{e!==t&&e.setAttribute("aria-selected","false")}),e.setAttribute("aria-selected","true")),f.setAttribute("aria-activedescendant",e.id)}function t(){f.value="",d.innerHTML="",p.textContent="0",m.style.display="none",f.removeAttribute("aria-activedescendant")}function o(e){e.target===h&&u(),e.stopPropagation()}function i(){if(!r)if(window.searchIndex)r=Promise.resolve(elasticlunr.Index.load(window.searchIndex));else{var t=document.documentElement.getAttribute("lang").substring(0,2);let e=document.querySelector("meta[name='base']").getAttribute("content");e.endsWith("/")&&(e=e.slice(0,-1)),r=fetch(e+"/search_index."+t+".json").then(e=>e.json()).then(e=>elasticlunr.Index.load(e))}}function g(e){return e=parseInt(e,16).toString(2),[0,1,2,3,4][Math.ceil(e.length/8)]}function a(){c(this)}f.addEventListener("input",async function(){const s=this.value.trim(),e=await r;d.innerHTML="",m.style.display=0<s.length?"block":"none";var t,n,o=e.search(s,{bool:"OR",fields:{title:{boost:3},body:{boost:2},description:{boost:1},path:{boost:1}}}),i=o.length;document.getElementById("n-results").textContent=i.toString(),t=document.getElementById("result-text-singular"),n=document.getElementById("result-text-plural"),1===i?(t.style.display="inline",n.style.display="none"):(t.style.display="none",n.style.display="inline");let l=0;o.forEach(function(t){if(t.doc.title||t.doc.path||t.doc.id){var n=document.createElement("div"),o=(n.setAttribute("role","option"),n.id="result-"+l++,n.innerHTML="<a href><span></span><span></span></a>",n.querySelector("a")),i=n.querySelector("span:first-child"),r=n.querySelector("span:nth-child(2)"),i=(i.textContent=t.doc.title||t.doc.path||t.doc.id,t.doc.body?function(n,e){const o=150,i=e.map(function(e){return elasticlunr.stemmer(e.toLowerCase())});let r=0;var s=[],e=n.toLowerCase().split(". ");for(const n of e){const e=n.split(/[\s\n]/);let t=!0;for(const n of e){if(0<n.length){let e=t?8:2;for(const o of i)elasticlunr.stemmer(n).startsWith(o)&&(e=40);s.push([n,e,r]),t=!1}r+=n.length+1}r+=1}if(0===s.length)return n.length>o?n.substring(0,o)+"…":n;var t=[];let l=0;for(var u=0;u<Math.min(s.length,30);u++)l+=s[u][1];for(t.push(l),u=1;u<=s.length-30;u++)l=(l-=s[u-1][1])+s[u+30-1][1],t.push(l);let c=0,a=0;for(u=t.length-1;0<=u;u--)a<t[u]&&(a=t[u],c=u);var d=[];let f=function(e,t){let n=0,o=t-1;for(;0<=o&&n<4;){if(" "===e[o]&&"."!==e[o-1])n++;else if("."===e[o]&&" "===e[o+1])break;o--}return 4===n?o+1:t}(n,s[c][2]);for(var h=/^[\x00-\xff]+$/,u=c;u<c+30&&u<s.length;u++){const e=s[u],o=(f<e[2]&&(d.push(n.substring(f,e[2])),f=e[2]),40===e[1]&&d.push("<b>"),e[2]+e[0].length);if(!h.test(e[0])&&12<=e[0].length){const i=function(t){let n="",o=!1,i=0,r=0,s=0;for(let e=0;e<t.length;e++){var l=t.codePointAt(e).toString(16);if(o=4<l.length&&++e+1<t.length?"200d"===t.codePointAt(e+1).toString(16):o){if(i+=g(l),e==t.length-1){if(!((r+=i)<=12))break;n+=t.substr(s,e-s+1)}}else if(0!=i){if(!((r=(r+=i)+g(l))<=12))break;n+=t.substr(s,e-s+1),s=e+1,i=0}else{if(!((r+=g(l))<=12))break;l.length<=4?n+=t[e]:n+=t[e-1]+t[e],s=e+1}}return n}(n.substring(e[2],o));d.push(i)}else d.push(n.substring(e[2],o));40===e[1]&&d.push("</b>"),f=o}d.push("…");var p=e=d.join("");return e.replace(/<[^>]+>/g,"").length>o?e.substring(0,o)+"…":p}(t.doc.body,s.split(/\s+/)):t.doc.description||"");r.innerHTML=i;let e=t.ref;t.doc.body&&(e+="#:~:text="+encodeURIComponent(s)),o.href=e,d.appendChild(n)}}),f.setAttribute("aria-expanded",0<l?"true":"false"),d.firstChild&&c(d.firstChild),d.addEventListener("mouseover",function(e){e.target.closest('div[role="option"]')&&c(e.target.closest('div[role="option"]'))}),document.querySelectorAll("#results > div").forEach(e=>{e.removeEventListener("touchstart",a),e.addEventListener("touchstart",a)})},!0),document.addEventListener("keydown",function(t){var e=navigator.userAgent.toLowerCase().includes("mac")?t.metaKey:t.ctrlKey;if("k"===t.key&&e)t.preventDefault(),("block"===h.style.display?u:l)();else if(e=document.activeElement,"Tab"!==t.key||e!==f&&e!==y){if(0!==(r=d.querySelectorAll("#results > div")).length){var n,o,i=Array.from(r),r=d.querySelector('[aria-selected="true"]'),s=i.indexOf(r);if(["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)){t.preventDefault();let e=s;switch(t.key){case"ArrowUp":e=Math.max(s-1,0);break;case"ArrowDown":e=Math.min(s+1,i.length-1);break;case"Home":e=0;break;case"End":e=i.length-1;break;case"PageUp":e=Math.max(s-3,0);break;case"PageDown":e=Math.min(s+3,i.length-1)}e!==s&&(c((o=i)[n=e]),o[n].scrollIntoView({block:"nearest",inline:"start"}))}if("Enter"===t.key&&r){t.preventDefault(),t.stopImmediatePropagation();const d=r.querySelector("a");d&&(window.location.href=d.getAttribute("href")),u()}}}else t.preventDefault(),(e===f?y:f).focus()})}};
|