mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2026-12-01 03:33:34 +08:00
2 lines
51 KiB
JavaScript
2 lines
51 KiB
JavaScript
import{M as Be,d as Ye,p as qe,w as Me,k as ce,l as he,ah as Ze,ai as Xe,o as j,D as et,C as g,b as R,aj as tt,ak as rt,v as nt,c as U,n as ze,G as ie,R as De,F as Te,a as q,t as Z,al as it,s as X,q as at,j as ae,am as Le,an as ot,ac as st,ao as lt,_ as ut}from"./framework.c0b2e358.js";import{u as ct,c as Ne,a as ht,b as ft,w as dt,o as oe,d as vt,e as pt,f as mt}from"./theme.a3a120a7.js";const yt={root:()=>Be(()=>import("./@localSearchIndexroot.ab7aea02.js"),[])};class Y{constructor(e,t=!0,r=[],i=5e3){this.ctx=e,this.iframes=t,this.exclude=r,this.iframesTimeout=i}static matches(e,t){const r=typeof t=="string"?[t]:t,i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(i){let n=!1;return r.every(a=>i.call(e,a)?(n=!0,!1):!0),n}else return!1}getContexts(){let e,t=[];return typeof this.ctx>"u"||!this.ctx?e=[]:NodeList.prototype.isPrototypeOf(this.ctx)?e=Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?e=this.ctx:typeof this.ctx=="string"?e=Array.prototype.slice.call(document.querySelectorAll(this.ctx)):e=[this.ctx],e.forEach(r=>{const i=t.filter(n=>n.contains(r)).length>0;t.indexOf(r)===-1&&!i&&t.push(r)}),t}getIframeContents(e,t,r=()=>{}){let i;try{const n=e.contentWindow;if(i=n.document,!n||!i)throw new Error("iframe inaccessible")}catch{r()}i&&t(i)}isIframeBlank(e){const t="about:blank",r=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&r!==t&&r}observeIframeLoad(e,t,r){let i=!1,n=null;const a=()=>{if(!i){i=!0,clearTimeout(n);try{this.isIframeBlank(e)||(e.removeEventListener("load",a),this.getIframeContents(e,t,r))}catch{r()}}};e.addEventListener("load",a),n=setTimeout(a,this.iframesTimeout)}onIframeReady(e,t,r){try{e.contentWindow.document.readyState==="complete"?this.isIframeBlank(e)?this.observeIframeLoad(e,t,r):this.getIframeContents(e,t,r):this.observeIframeLoad(e,t,r)}catch{r()}}waitForIframes(e,t){let r=0;this.forEachIframe(e,()=>!0,i=>{r++,this.waitForIframes(i.querySelector("html"),()=>{--r||t()})},i=>{i||t()})}forEachIframe(e,t,r,i=()=>{}){let n=e.querySelectorAll("iframe"),a=n.length,s=0;n=Array.prototype.slice.call(n);const l=()=>{--a<=0&&i(s)};a||l(),n.forEach(u=>{Y.matches(u,this.exclude)?l():this.onIframeReady(u,c=>{t(u)&&(s++,r(c)),l()},l)})}createIterator(e,t,r){return document.createNodeIterator(e,t,r,!1)}createInstanceOnIframe(e){return new Y(e.querySelector("html"),this.iframes)}compareNodeIframe(e,t,r){const i=e.compareDocumentPosition(r),n=Node.DOCUMENT_POSITION_PRECEDING;if(i&n)if(t!==null){const a=t.compareDocumentPosition(r),s=Node.DOCUMENT_POSITION_FOLLOWING;if(a&s)return!0}else return!0;return!1}getIteratorNode(e){const t=e.previousNode();let r;return t===null?r=e.nextNode():r=e.nextNode()&&e.nextNode(),{prevNode:t,node:r}}checkIframeFilter(e,t,r,i){let n=!1,a=!1;return i.forEach((s,l)=>{s.val===r&&(n=l,a=s.handled)}),this.compareNodeIframe(e,t,r)?(n===!1&&!a?i.push({val:r,handled:!0}):n!==!1&&!a&&(i[n].handled=!0),!0):(n===!1&&i.push({val:r,handled:!1}),!1)}handleOpenIframes(e,t,r,i){e.forEach(n=>{n.handled||this.getIframeContents(n.val,a=>{this.createInstanceOnIframe(a).forEachNode(t,r,i)})})}iterateThroughNodes(e,t,r,i,n){const a=this.createIterator(t,e,i);let s=[],l=[],u,c,h=()=>({prevNode:c,node:u}=this.getIteratorNode(a),u);for(;h();)this.iframes&&this.forEachIframe(t,f=>this.checkIframeFilter(u,c,f,s),f=>{this.createInstanceOnIframe(f).forEachNode(e,d=>l.push(d),i)}),l.push(u);l.forEach(f=>{r(f)}),this.iframes&&this.handleOpenIframes(s,e,r,i),n()}forEachNode(e,t,r,i=()=>{}){const n=this.getContexts();let a=n.length;a||i(),n.forEach(s=>{const l=()=>{this.iterateThroughNodes(e,s,t,r,()=>{--a<=0&&i()})};this.iframes?this.waitForIframes(s,l):l()})}}let gt=class{constructor(e){this.ctx=e,this.ie=!1;const t=window.navigator.userAgent;(t.indexOf("MSIE")>-1||t.indexOf("Trident")>-1)&&(this.ie=!0)}set opt(e){this._opt=Object.assign({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e3,separateWordSearch:!0,diacritics:!0,synonyms:{},accuracy:"partially",acrossElements:!1,caseSensitive:!1,ignoreJoiners:!1,ignoreGroups:0,ignorePunctuation:[],wildcards:"disabled",each:()=>{},noMatch:()=>{},filter:()=>!0,done:()=>{},debug:!1,log:window.console},e)}get opt(){return this._opt}get iterator(){return new Y(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}log(e,t="debug"){const r=this.opt.log;this.opt.debug&&typeof r=="object"&&typeof r[t]=="function"&&r[t](`mark.js: ${e}`)}escapeStr(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}createRegExp(e){return this.opt.wildcards!=="disabled"&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),this.opt.wildcards!=="disabled"&&(e=this.createWildcardsRegExp(e)),e=this.createAccuracyRegExp(e),e}createSynonymsRegExp(e){const t=this.opt.synonyms,r=this.opt.caseSensitive?"":"i",i=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(let n in t)if(t.hasOwnProperty(n)){const a=t[n],s=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(n):this.escapeStr(n),l=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(a):this.escapeStr(a);s!==""&&l!==""&&(e=e.replace(new RegExp(`(${this.escapeStr(s)}|${this.escapeStr(l)})`,`gm${r}`),i+`(${this.processSynomyms(s)}|${this.processSynomyms(l)})`+i))}return e}processSynomyms(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}setupWildcardsRegExp(e){return e=e.replace(/(?:\\)*\?/g,t=>t.charAt(0)==="\\"?"?":""),e.replace(/(?:\\)*\*/g,t=>t.charAt(0)==="\\"?"*":"")}createWildcardsRegExp(e){let t=this.opt.wildcards==="withSpaces";return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}setupIgnoreJoinersRegExp(e){return e.replace(/[^(|)\\]/g,(t,r,i)=>{let n=i.charAt(r+1);return/[(|)\\]/.test(n)||n===""?t:t+"\0"})}createJoinersRegExp(e){let t=[];const r=this.opt.ignorePunctuation;return Array.isArray(r)&&r.length&&t.push(this.escapeStr(r.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join(`[${t.join("")}]*`):e}createDiacriticsRegExp(e){const t=this.opt.caseSensitive?"":"i",r=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"];let i=[];return e.split("").forEach(n=>{r.every(a=>{if(a.indexOf(n)!==-1){if(i.indexOf(a)>-1)return!1;e=e.replace(new RegExp(`[${a}]`,`gm${t}`),`[${a}]`),i.push(a)}return!0})}),e}createMergedBlanksRegExp(e){return e.replace(/[\s]+/gmi,"[\\s]+")}createAccuracyRegExp(e){const t="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿";let r=this.opt.accuracy,i=typeof r=="string"?r:r.value,n=typeof r=="string"?[]:r.limiters,a="";switch(n.forEach(s=>{a+=`|${this.escapeStr(s)}`}),i){case"partially":default:return`()(${e})`;case"complementary":return a="\\s"+(a||this.escapeStr(t)),`()([^${a}]*${e}[^${a}]*)`;case"exactly":return`(^|\\s${a})(${e})(?=$|\\s${a})`}}getSeparatedKeywords(e){let t=[];return e.forEach(r=>{this.opt.separateWordSearch?r.split(" ").forEach(i=>{i.trim()&&t.indexOf(i)===-1&&t.push(i)}):r.trim()&&t.indexOf(r)===-1&&t.push(r)}),{keywords:t.sort((r,i)=>i.length-r.length),length:t.length}}isNumeric(e){return Number(parseFloat(e))==e}checkRanges(e){if(!Array.isArray(e)||Object.prototype.toString.call(e[0])!=="[object Object]")return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];const t=[];let r=0;return e.sort((i,n)=>i.start-n.start).forEach(i=>{let{start:n,end:a,valid:s}=this.callNoMatchOnInvalidRanges(i,r);s&&(i.start=n,i.length=a-n,t.push(i),r=a)}),t}callNoMatchOnInvalidRanges(e,t){let r,i,n=!1;return e&&typeof e.start<"u"?(r=parseInt(e.start,10),i=r+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&i-t>0&&i-r>0?n=!0:(this.log(`Ignoring invalid or overlapping range: ${JSON.stringify(e)}`),this.opt.noMatch(e))):(this.log(`Ignoring invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)),{start:r,end:i,valid:n}}checkWhitespaceRanges(e,t,r){let i,n=!0,a=r.length,s=t-a,l=parseInt(e.start,10)-s;return l=l>a?a:l,i=l+parseInt(e.length,10),i>a&&(i=a,this.log(`End range automatically set to the max value of ${a}`)),l<0||i-l<0||l>a||i>a?(n=!1,this.log(`Invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)):r.substring(l,i).replace(/\s+/g,"")===""&&(n=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:l,end:i,valid:n}}getTextNodes(e){let t="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,i=>{r.push({start:t.length,end:(t+=i.textContent).length,node:i})},i=>this.matchesExclude(i.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT,()=>{e({value:t,nodes:r})})}matchesExclude(e){return Y.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}wrapRangeInTextNode(e,t,r){const i=this.opt.element?this.opt.element:"mark",n=e.splitText(t),a=n.splitText(r-t);let s=document.createElement(i);return s.setAttribute("data-markjs","true"),this.opt.className&&s.setAttribute("class",this.opt.className),s.textContent=n.textContent,n.parentNode.replaceChild(s,n),a}wrapRangeInMappedTextNode(e,t,r,i,n){e.nodes.every((a,s)=>{const l=e.nodes[s+1];if(typeof l>"u"||l.start>t){if(!i(a.node))return!1;const u=t-a.start,c=(r>a.end?a.end:r)-a.start,h=e.value.substr(0,a.start),f=e.value.substr(c+a.start);if(a.node=this.wrapRangeInTextNode(a.node,u,c),e.value=h+f,e.nodes.forEach((d,m)=>{m>=s&&(e.nodes[m].start>0&&m!==s&&(e.nodes[m].start-=c),e.nodes[m].end-=c)}),r-=c,n(a.node.previousSibling,a.start),r>a.end)t=a.end;else return!1}return!0})}wrapMatches(e,t,r,i,n){const a=t===0?0:t+1;this.getTextNodes(s=>{s.nodes.forEach(l=>{l=l.node;let u;for(;(u=e.exec(l.textContent))!==null&&u[a]!=="";){if(!r(u[a],l))continue;let c=u.index;if(a!==0)for(let h=1;h<a;h++)c+=u[h].length;l=this.wrapRangeInTextNode(l,c,c+u[a].length),i(l.previousSibling),e.lastIndex=0}}),n()})}wrapMatchesAcrossElements(e,t,r,i,n){const a=t===0?0:t+1;this.getTextNodes(s=>{let l;for(;(l=e.exec(s.value))!==null&&l[a]!=="";){let u=l.index;if(a!==0)for(let h=1;h<a;h++)u+=l[h].length;const c=u+l[a].length;this.wrapRangeInMappedTextNode(s,u,c,h=>r(l[a],h),(h,f)=>{e.lastIndex=f,i(h)})}n()})}wrapRangeFromIndex(e,t,r,i){this.getTextNodes(n=>{const a=n.value.length;e.forEach((s,l)=>{let{start:u,end:c,valid:h}=this.checkWhitespaceRanges(s,a,n.value);h&&this.wrapRangeInMappedTextNode(n,u,c,f=>t(f,s,n.value.substring(u,c),l),f=>{r(f,s)})}),i()})}unwrapMatches(e){const t=e.parentNode;let r=document.createDocumentFragment();for(;e.firstChild;)r.appendChild(e.removeChild(e.firstChild));t.replaceChild(r,e),this.ie?this.normalizeTextNode(t):t.normalize()}normalizeTextNode(e){if(e){if(e.nodeType===3)for(;e.nextSibling&&e.nextSibling.nodeType===3;)e.nodeValue+=e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);else this.normalizeTextNode(e.firstChild);this.normalizeTextNode(e.nextSibling)}}markRegExp(e,t){this.opt=t,this.log(`Searching with expression "${e}"`);let r=0,i="wrapMatches";const n=a=>{r++,this.opt.each(a)};this.opt.acrossElements&&(i="wrapMatchesAcrossElements"),this[i](e,this.opt.ignoreGroups,(a,s)=>this.opt.filter(s,a,r),n,()=>{r===0&&this.opt.noMatch(e),this.opt.done(r)})}mark(e,t){this.opt=t;let r=0,i="wrapMatches";const{keywords:n,length:a}=this.getSeparatedKeywords(typeof e=="string"?[e]:e),s=this.opt.caseSensitive?"":"i",l=u=>{let c=new RegExp(this.createRegExp(u),`gm${s}`),h=0;this.log(`Searching with expression "${c}"`),this[i](c,1,(f,d)=>this.opt.filter(d,u,r,h),f=>{h++,r++,this.opt.each(f)},()=>{h===0&&this.opt.noMatch(u),n[a-1]===u?this.opt.done(r):l(n[n.indexOf(u)+1])})};this.opt.acrossElements&&(i="wrapMatchesAcrossElements"),a===0?this.opt.done(r):l(n[0])}markRanges(e,t){this.opt=t;let r=0,i=this.checkRanges(e);i&&i.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(i)),this.wrapRangeFromIndex(i,(n,a,s,l)=>this.opt.filter(n,a,s,l),(n,a)=>{r++,this.opt.each(n,a)},()=>{this.opt.done(r)})):this.opt.done(r)}unmark(e){this.opt=e;let t=this.opt.element?this.opt.element:"*";t+="[data-markjs]",this.opt.className&&(t+=`.${this.opt.className}`),this.log(`Removal selector "${t}"`),this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT,r=>{this.unwrapMatches(r)},r=>{const i=Y.matches(r,t),n=this.matchesExclude(r);return!i||n?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},this.opt.done)}};function xt(o){const e=new gt(o);return this.mark=(t,r)=>(e.mark(t,r),this),this.markRegExp=(t,r)=>(e.markRegExp(t,r),this),this.markRanges=(t,r)=>(e.markRanges(t,r),this),this.unmark=t=>(e.unmark(t),this),this}var N=function(){return N=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},N.apply(this,arguments)};function wt(o,e,t,r){function i(n){return n instanceof t?n:new t(function(a){a(n)})}return new(t||(t=Promise))(function(n,a){function s(c){try{u(r.next(c))}catch(h){a(h)}}function l(c){try{u(r.throw(c))}catch(h){a(h)}}function u(c){c.done?n(c.value):i(c.value).then(s,l)}u((r=r.apply(o,e||[])).next())})}function Ft(o,e){var t={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},r,i,n,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(t=0)),t;)try{if(r=1,i&&(n=u[0]&2?i.return:u[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,u[1])).done)return n;switch(i=0,n&&(u=[u[0]&2,n.value]),u[0]){case 0:case 1:n=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(n=t.trys,!(n=n.length>0&&n[n.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!n||u[1]>n[0]&&u[1]<n[3])){t.label=u[1];break}if(u[0]===6&&t.label<n[1]){t.label=n[1],n=u;break}if(n&&t.label<n[2]){t.label=n[2],t.ops.push(u);break}n[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(o,t)}catch(c){u=[6,c],i=0}finally{r=n=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function b(o){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&o[e],r=0;if(t)return t.call(o);if(o&&typeof o.length=="number")return{next:function(){return o&&r>=o.length&&(o=void 0),{value:o&&o[r++],done:!o}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(o,e){var t=typeof Symbol=="function"&&o[Symbol.iterator];if(!t)return o;var r=t.call(o),i,n=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)n.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(a)throw a.error}}return n}var Et="ENTRIES",Pe="KEYS",$e="VALUES",V="",fe=function(){function o(e,t){var r=e._tree,i=Array.from(r.keys());this.set=e,this._type=t,this._path=i.length>0?[{node:r,keys:i}]:[]}return o.prototype.next=function(){var e=this.dive();return this.backtrack(),e},o.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=G(this._path),t=e.node,r=e.keys;if(G(r)===V)return{done:!1,value:this.result()};var i=t.get(G(r));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()},o.prototype.backtrack=function(){if(this._path.length!==0){var e=G(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},o.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return G(t)}).filter(function(e){return e!==V}).join("")},o.prototype.value=function(){return G(this._path).node.get(V)},o.prototype.result=function(){switch(this._type){case $e:return this.value();case Pe:return this.key();default:return[this.key(),this.value()]}},o.prototype[Symbol.iterator]=function(){return this},o}(),G=function(o){return o[o.length-1]},bt=function(o,e,t){var r=new Map;if(e===void 0)return r;for(var i=e.length+1,n=i+t,a=new Uint8Array(n*i).fill(t+1),s=0;s<i;++s)a[s]=s;for(var l=1;l<n;++l)a[l*i]=l;return We(o,e,t,r,a,1,i,""),r},We=function(o,e,t,r,i,n,a,s){var l,u,c=n*a;try{e:for(var h=b(o.keys()),f=h.next();!f.done;f=h.next()){var d=f.value;if(d===V){var m=i[c-1];m<=t&&r.set(s,[o.get(d),m])}else{for(var x=n,y=0;y<d.length;++y,++x){for(var F=d[y],E=a*x,w=E-a,z=i[E],S=Math.max(0,x-t-1),L=Math.min(a-1,x+t),A=S;A<L;++A){var M=F!==e[A],D=i[w+A]+ +M,C=i[w+A+1]+1,T=i[E+A]+1,I=i[E+A+1]=Math.min(D,C,T);I<z&&(z=I)}if(z>t)continue e}We(o.get(d),e,t,r,i,x,a,s+d)}}}catch(O){l={error:O}}finally{try{f&&!f.done&&(u=h.return)&&u.call(h)}finally{if(l)throw l.error}}},de=function(){function o(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return o.prototype.atPrefix=function(e){var t,r;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var i=_(le(this._tree,e.slice(this._prefix.length)),2),n=i[0],a=i[1];if(n===void 0){var s=_(Fe(a),2),l=s[0],u=s[1];try{for(var c=b(l.keys()),h=c.next();!h.done;h=c.next()){var f=h.value;if(f!==V&&f.startsWith(u)){var d=new Map;return d.set(f.slice(u.length),l.get(f)),new o(d,e)}}}catch(m){t={error:m}}finally{try{h&&!h.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}}return new o(n,e)},o.prototype.clear=function(){this._size=void 0,this._tree.clear()},o.prototype.delete=function(e){return this._size=void 0,St(this._tree,e)},o.prototype.entries=function(){return new fe(this,Et)},o.prototype.forEach=function(e){var t,r;try{for(var i=b(this),n=i.next();!n.done;n=i.next()){var a=_(n.value,2),s=a[0],l=a[1];e(s,l,this)}}catch(u){t={error:u}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},o.prototype.fuzzyGet=function(e,t){return bt(this._tree,e,t)},o.prototype.get=function(e){var t=ge(this._tree,e);return t!==void 0?t.get(V):void 0},o.prototype.has=function(e){var t=ge(this._tree,e);return t!==void 0&&t.has(V)},o.prototype.keys=function(){return new fe(this,Pe)},o.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=ve(this._tree,e);return r.set(V,t),this},Object.defineProperty(o.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),o.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=ve(this._tree,e);return r.set(V,t(r.get(V))),this},o.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=ve(this._tree,e),i=r.get(V);return i===void 0&&r.set(V,i=t()),i},o.prototype.values=function(){return new fe(this,$e)},o.prototype[Symbol.iterator]=function(){return this.entries()},o.from=function(e){var t,r,i=new o;try{for(var n=b(e),a=n.next();!a.done;a=n.next()){var s=_(a.value,2),l=s[0],u=s[1];i.set(l,u)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i},o.fromObject=function(e){return o.from(Object.entries(e))},o}(),le=function(o,e,t){var r,i;if(t===void 0&&(t=[]),e.length===0||o==null)return[o,t];try{for(var n=b(o.keys()),a=n.next();!a.done;a=n.next()){var s=a.value;if(s!==V&&e.startsWith(s))return t.push([o,s]),le(o.get(s),e.slice(s.length),t)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return t.push([o,e]),le(void 0,"",t)},ge=function(o,e){var t,r;if(e.length===0||o==null)return o;try{for(var i=b(o.keys()),n=i.next();!n.done;n=i.next()){var a=n.value;if(a!==V&&e.startsWith(a))return ge(o.get(a),e.slice(a.length))}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},ve=function(o,e){var t,r,i=e.length;e:for(var n=0;o&&n<i;){try{for(var a=(t=void 0,b(o.keys())),s=a.next();!s.done;s=a.next()){var l=s.value;if(l!==V&&e[n]===l[0]){for(var u=Math.min(i-n,l.length),c=1;c<u&&e[n+c]===l[c];)++c;var h=o.get(l);if(c===l.length)o=h;else{var f=new Map;f.set(l.slice(c),h),o.set(e.slice(n,n+c),f),o.delete(l),o=f}n+=c;continue e}}}catch(m){t={error:m}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}var d=new Map;return o.set(e.slice(n),d),d}return o},St=function(o,e){var t=_(le(o,e),2),r=t[0],i=t[1];if(r!==void 0){if(r.delete(V),r.size===0)Je(i);else if(r.size===1){var n=_(r.entries().next().value,2),a=n[0],s=n[1];je(i,a,s)}}},Je=function(o){if(o.length!==0){var e=_(Fe(o),2),t=e[0],r=e[1];if(t.delete(r),t.size===0)Je(o.slice(0,-1));else if(t.size===1){var i=_(t.entries().next().value,2),n=i[0],a=i[1];n!==V&&je(o.slice(0,-1),n,a)}}},je=function(o,e,t){if(o.length!==0){var r=_(Fe(o),2),i=r[0],n=r[1];i.set(n+e,t),i.delete(n)}},Fe=function(o){return o[o.length-1]},ee,Ee="or",Ue="and",At="and_not",Ct=function(){function o(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?ye:e.autoVacuum;this._options=N(N(N({},me),e),{autoVacuum:t,searchOptions:N(N({},Oe),e.searchOptions||{}),autoSuggestOptions:N(N({},Dt),e.autoSuggestOptions||{})}),this._index=new de,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=we,this.addFields(this._options.fields)}return o.prototype.add=function(e){var t,r,i,n,a,s,l=this._options,u=l.extractField,c=l.tokenize,h=l.processTerm,f=l.fields,d=l.idField,m=u(e,d);if(m==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));if(this._idToShortId.has(m))throw new Error("MiniSearch: duplicate ID ".concat(m));var x=this.addDocumentId(m);this.saveStoredFields(x,e);try{for(var y=b(f),F=y.next();!F.done;F=y.next()){var E=F.value,w=u(e,E);if(w!=null){var z=c(w.toString(),E),S=this._fieldIds[E],L=new Set(z).size;this.addFieldLength(x,S,this._documentCount-1,L);try{for(var A=(i=void 0,b(z)),M=A.next();!M.done;M=A.next()){var D=M.value,C=h(D,E);if(Array.isArray(C))try{for(var T=(a=void 0,b(C)),I=T.next();!I.done;I=T.next()){var O=I.value;this.addTerm(S,x,O)}}catch(p){a={error:p}}finally{try{I&&!I.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}else C&&this.addTerm(S,x,C)}}catch(p){i={error:p}}finally{try{M&&!M.done&&(n=A.return)&&n.call(A)}finally{if(i)throw i.error}}}}}catch(p){t={error:p}}finally{try{F&&!F.done&&(r=y.return)&&r.call(y)}finally{if(t)throw t.error}}},o.prototype.addAll=function(e){var t,r;try{for(var i=b(e),n=i.next();!n.done;n=i.next()){var a=n.value;this.add(a)}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},o.prototype.addAllAsync=function(e,t){var r=this;t===void 0&&(t={});var i=t.chunkSize,n=i===void 0?10:i,a={chunk:[],promise:Promise.resolve()},s=e.reduce(function(c,h,f){var d=c.chunk,m=c.promise;return d.push(h),(f+1)%n===0?{chunk:[],promise:m.then(function(){return new Promise(function(x){return setTimeout(x,0)})}).then(function(){return r.addAll(d)})}:{chunk:d,promise:m}},a),l=s.chunk,u=s.promise;return u.then(function(){return r.addAll(l)})},o.prototype.remove=function(e){var t,r,i,n,a,s,l=this._options,u=l.tokenize,c=l.processTerm,h=l.extractField,f=l.fields,d=l.idField,m=h(e,d);if(m==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));var x=this._idToShortId.get(m);if(x==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(m,": it is not in the index"));try{for(var y=b(f),F=y.next();!F.done;F=y.next()){var E=F.value,w=h(e,E);if(w!=null){var z=u(w.toString(),E),S=this._fieldIds[E],L=new Set(z).size;this.removeFieldLength(x,S,this._documentCount,L);try{for(var A=(i=void 0,b(z)),M=A.next();!M.done;M=A.next()){var D=M.value,C=c(D,E);if(Array.isArray(C))try{for(var T=(a=void 0,b(C)),I=T.next();!I.done;I=T.next()){var O=I.value;this.removeTerm(S,x,O)}}catch(p){a={error:p}}finally{try{I&&!I.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}else C&&this.removeTerm(S,x,C)}}catch(p){i={error:p}}finally{try{M&&!M.done&&(n=A.return)&&n.call(A)}finally{if(i)throw i.error}}}}}catch(p){t={error:p}}finally{try{F&&!F.done&&(r=y.return)&&r.call(y)}finally{if(t)throw t.error}}this._storedFields.delete(x),this._documentIds.delete(x),this._idToShortId.delete(m),this._fieldLength.delete(x),this._documentCount-=1},o.prototype.removeAll=function(e){var t,r;if(e)try{for(var i=b(e),n=i.next();!n.done;n=i.next()){var a=n.value;this.remove(a)}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new de,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},o.prototype.discard=function(e){var t=this,r=this._idToShortId.get(e);if(r==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(r),this._storedFields.delete(r),(this._fieldLength.get(r)||[]).forEach(function(i,n){t.removeFieldLength(r,n,t._documentCount,i)}),this._fieldLength.delete(r),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},o.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,r=e.minDirtCount,i=e.batchSize,n=e.batchWait;this.conditionalVacuum({batchSize:i,batchWait:n},{minDirtCount:r,minDirtFactor:t})}},o.prototype.discardAll=function(e){var t,r,i=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var n=b(e),a=n.next();!a.done;a=n.next()){var s=a.value;this.discard(s)}}catch(l){t={error:l}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=i}this.maybeAutoVacuum()},o.prototype.replace=function(e){var t=this._options,r=t.idField,i=t.extractField,n=i(e,r);this.discard(n),this.add(e)},o.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},o.prototype.conditionalVacuum=function(e,t){var r=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var i=r._enqueuedVacuumConditions;return r._enqueuedVacuumConditions=we,r.performVacuuming(e,i)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},o.prototype.performVacuuming=function(e,t){return wt(this,void 0,void 0,function(){var r,i,n,a,s,l,u,c,h,f,d,m,x,y,F,E,w,z,S,L,A,M,D,C,T;return Ft(this,function(I){switch(I.label){case 0:if(r=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];i=e.batchSize||xe.batchSize,n=e.batchWait||xe.batchWait,a=1,I.label=1;case 1:I.trys.push([1,7,8,9]),s=b(this._index),l=s.next(),I.label=2;case 2:if(l.done)return[3,6];u=_(l.value,2),c=u[0],h=u[1];try{for(f=(M=void 0,b(h)),d=f.next();!d.done;d=f.next()){m=_(d.value,2),x=m[0],y=m[1];try{for(F=(C=void 0,b(y)),E=F.next();!E.done;E=F.next())w=_(E.value,1),z=w[0],!this._documentIds.has(z)&&(y.size<=1?h.delete(x):y.delete(z))}catch(O){C={error:O}}finally{try{E&&!E.done&&(T=F.return)&&T.call(F)}finally{if(C)throw C.error}}}}catch(O){M={error:O}}finally{try{d&&!d.done&&(D=f.return)&&D.call(f)}finally{if(M)throw M.error}}return this._index.get(c).size===0&&this._index.delete(c),a%i!==0?[3,4]:[4,new Promise(function(O){return setTimeout(O,n)})];case 3:I.sent(),I.label=4;case 4:a+=1,I.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return S=I.sent(),L={error:S},[3,9];case 8:try{l&&!l.done&&(A=s.return)&&A.call(s)}finally{if(L)throw L.error}return[7];case 9:this._dirtCount-=r,I.label=10;case 10:return[4,null];case 11:return I.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},o.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,r=e.minDirtFactor;return t=t||ye.minDirtCount,r=r||ye.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=r},Object.defineProperty(o.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),o.prototype.has=function(e){return this._idToShortId.has(e)},o.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},o.prototype.search=function(e,t){var r,i;t===void 0&&(t={});var n=this.executeQuery(e,t),a=[];try{for(var s=b(n),l=s.next();!l.done;l=s.next()){var u=_(l.value,2),c=u[0],h=u[1],f=h.score,d=h.terms,m=h.match,x=d.length||1,y={id:this._documentIds.get(c),score:f*x,terms:Object.keys(m),queryTerms:d,match:m};Object.assign(y,this._storedFields.get(c)),(t.filter==null||t.filter(y))&&a.push(y)}}catch(F){r={error:F}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e===o.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||a.sort(Re),a},o.prototype.autoSuggest=function(e,t){var r,i,n,a;t===void 0&&(t={}),t=N(N({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=b(this.search(e,t)),u=l.next();!u.done;u=l.next()){var c=u.value,h=c.score,f=c.terms,d=f.join(" "),m=s.get(d);m!=null?(m.score+=h,m.count+=1):s.set(d,{score:h,terms:f,count:1})}}catch(S){r={error:S}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}var x=[];try{for(var y=b(s),F=y.next();!F.done;F=y.next()){var E=_(F.value,2),m=E[0],w=E[1],h=w.score,f=w.terms,z=w.count;x.push({suggestion:m,terms:f,score:h/z})}}catch(S){n={error:S}}finally{try{F&&!F.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}return x.sort(Re),x},Object.defineProperty(o.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),o.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},o.getDefault=function(e){if(me.hasOwnProperty(e))return pe(me,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},o.loadJS=function(e,t){var r,i,n,a,s,l,u=e.index,c=e.documentCount,h=e.nextId,f=e.documentIds,d=e.fieldIds,m=e.fieldLength,x=e.averageFieldLength,y=e.storedFields,F=e.dirtCount,E=e.serializationVersion;if(E!==1&&E!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var w=new o(t);w._documentCount=c,w._nextId=h,w._documentIds=se(f),w._idToShortId=new Map,w._fieldIds=d,w._fieldLength=se(m),w._avgFieldLength=x,w._storedFields=se(y),w._dirtCount=F||0,w._index=new de;try{for(var z=b(w._documentIds),S=z.next();!S.done;S=z.next()){var L=_(S.value,2),A=L[0],M=L[1];w._idToShortId.set(M,A)}}catch(B){r={error:B}}finally{try{S&&!S.done&&(i=z.return)&&i.call(z)}finally{if(r)throw r.error}}try{for(var D=b(u),C=D.next();!C.done;C=D.next()){var T=_(C.value,2),I=T[0],O=T[1],p=new Map;try{for(var v=(s=void 0,b(Object.keys(O))),k=v.next();!k.done;k=v.next()){var P=k.value,$=O[P];E===1&&($=$.ds),p.set(parseInt(P,10),se($))}}catch(B){s={error:B}}finally{try{k&&!k.done&&(l=v.return)&&l.call(v)}finally{if(s)throw s.error}}w._index.set(I,p)}}catch(B){n={error:B}}finally{try{C&&!C.done&&(a=D.return)&&a.call(D)}finally{if(n)throw n.error}}return w},o.prototype.executeQuery=function(e,t){var r=this;if(t===void 0&&(t={}),e===o.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var i=N(N(N({},t),e),{queries:void 0}),n=e.queries.map(function(y){return r.executeQuery(y,i)});return this.combineResults(n,i.combineWith)}var a=this._options,s=a.tokenize,l=a.processTerm,u=a.searchOptions,c=N(N({tokenize:s,processTerm:l},u),t),h=c.tokenize,f=c.processTerm,d=h(e).flatMap(function(y){return f(y)}).filter(function(y){return!!y}),m=d.map(zt(c)),x=m.map(function(y){return r.executeQuerySpec(y,c)});return this.combineResults(x,c.combineWith)},o.prototype.executeQuerySpec=function(e,t){var r,i,n,a,s=N(N({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(P,$){var B;return N(N({},P),(B={},B[$]=pe(s.boost,$)||1,B))},{}),u=s.boostDocument,c=s.weights,h=s.maxFuzzy,f=s.bm25,d=N(N({},Oe.weights),c),m=d.fuzzy,x=d.prefix,y=this._index.get(e.term),F=this.termResults(e.term,e.term,1,y,l,u,f),E,w;if(e.prefix&&(E=this._index.atPrefix(e.term)),e.fuzzy){var z=e.fuzzy===!0?.2:e.fuzzy,S=z<1?Math.min(h,Math.round(e.term.length*z)):z;S&&(w=this._index.fuzzyGet(e.term,S))}if(E)try{for(var L=b(E),A=L.next();!A.done;A=L.next()){var M=_(A.value,2),D=M[0],C=M[1],T=D.length-e.term.length;if(T){w==null||w.delete(D);var I=x*D.length/(D.length+.3*T);this.termResults(e.term,D,I,C,l,u,f,F)}}}catch(P){r={error:P}}finally{try{A&&!A.done&&(i=L.return)&&i.call(L)}finally{if(r)throw r.error}}if(w)try{for(var O=b(w.keys()),p=O.next();!p.done;p=O.next()){var D=p.value,v=_(w.get(D),2),k=v[0],T=v[1];if(T){var I=m*D.length/(D.length+T);this.termResults(e.term,D,I,k,l,u,f,F)}}}catch(P){n={error:P}}finally{try{p&&!p.done&&(a=O.return)&&a.call(O)}finally{if(n)throw n.error}}return F},o.prototype.executeWildcardQuery=function(e){var t,r,i=new Map,n=N(N({},this._options.searchOptions),e);try{for(var a=b(this._documentIds),s=a.next();!s.done;s=a.next()){var l=_(s.value,2),u=l[0],c=l[1],h=n.boostDocument?n.boostDocument(c,"",this._storedFields.get(u)):1;i.set(u,{score:h,terms:[],match:{}})}}catch(f){t={error:f}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return i},o.prototype.combineResults=function(e,t){if(t===void 0&&(t=Ee),e.length===0)return new Map;var r=t.toLowerCase();return e.reduce(kt[r])||new Map},o.prototype.toJSON=function(){var e,t,r,i,n=[];try{for(var a=b(this._index),s=a.next();!s.done;s=a.next()){var l=_(s.value,2),u=l[0],c=l[1],h={};try{for(var f=(r=void 0,b(c)),d=f.next();!d.done;d=f.next()){var m=_(d.value,2),x=m[0],y=m[1];h[x]=Object.fromEntries(y)}}catch(F){r={error:F}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}n.push([u,h])}}catch(F){e={error:F}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:n,serializationVersion:2}},o.prototype.termResults=function(e,t,r,i,n,a,s,l){var u,c,h,f,d;if(l===void 0&&(l=new Map),i==null)return l;try{for(var m=b(Object.keys(n)),x=m.next();!x.done;x=m.next()){var y=x.value,F=n[y],E=this._fieldIds[y],w=i.get(E);if(w!=null){var z=w.size,S=this._avgFieldLength[E];try{for(var L=(h=void 0,b(w.keys())),A=L.next();!A.done;A=L.next()){var M=A.value;if(!this._documentIds.has(M)){this.removeTerm(E,M,t),z-=1;continue}var D=a?a(this._documentIds.get(M),t,this._storedFields.get(M)):1;if(D){var C=w.get(M),T=this._fieldLength.get(M)[E],I=Mt(C,z,this._documentCount,T,S,s),O=r*F*D*I,p=l.get(M);if(p){p.score+=O,Tt(p.terms,e);var v=pe(p.match,t);v?v.push(y):p.match[t]=[y]}else l.set(M,{score:O,terms:[e],match:(d={},d[t]=[y],d)})}}}catch(k){h={error:k}}finally{try{A&&!A.done&&(f=L.return)&&f.call(L)}finally{if(h)throw h.error}}}}}catch(k){u={error:k}}finally{try{x&&!x.done&&(c=m.return)&&c.call(m)}finally{if(u)throw u.error}}return l},o.prototype.addTerm=function(e,t,r){var i=this._index.fetch(r,Ve),n=i.get(e);if(n==null)n=new Map,n.set(t,1),i.set(e,n);else{var a=n.get(t);n.set(t,(a||0)+1)}},o.prototype.removeTerm=function(e,t,r){if(!this._index.has(r)){this.warnDocumentChanged(t,e,r);return}var i=this._index.fetch(r,Ve),n=i.get(e);n==null||n.get(t)==null?this.warnDocumentChanged(t,e,r):n.get(t)<=1?n.size<=1?i.delete(e):n.delete(t):n.set(t,n.get(t)-1),this._index.get(r).size===0&&this._index.delete(r)},o.prototype.warnDocumentChanged=function(e,t,r){var i,n;try{for(var a=b(Object.keys(this._fieldIds)),s=a.next();!s.done;s=a.next()){var l=s.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(r,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(u){i={error:u}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}},o.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},o.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},o.prototype.addFieldLength=function(e,t,r,i){var n=this._fieldLength.get(e);n==null&&this._fieldLength.set(e,n=[]),n[t]=i;var a=this._avgFieldLength[t]||0,s=a*r+i;this._avgFieldLength[t]=s/(r+1)},o.prototype.removeFieldLength=function(e,t,r,i){if(r===1){this._avgFieldLength[t]=0;return}var n=this._avgFieldLength[t]*r-i;this._avgFieldLength[t]=n/(r-1)},o.prototype.saveStoredFields=function(e,t){var r,i,n=this._options,a=n.storeFields,s=n.extractField;if(!(a==null||a.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var u=b(a),c=u.next();!c.done;c=u.next()){var h=c.value,f=s(t,h);f!==void 0&&(l[h]=f)}}catch(d){r={error:d}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}},o.wildcard=Symbol("*"),o}(),pe=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0},kt=(ee={},ee[Ee]=function(o,e){var t,r;try{for(var i=b(e.keys()),n=i.next();!n.done;n=i.next()){var a=n.value,s=o.get(a);if(s==null)o.set(a,e.get(a));else{var l=e.get(a),u=l.score,c=l.terms,h=l.match;s.score=s.score+u,s.match=Object.assign(s.match,h),_e(s.terms,c)}}}catch(f){t={error:f}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o},ee[Ue]=function(o,e){var t,r,i=new Map;try{for(var n=b(e.keys()),a=n.next();!a.done;a=n.next()){var s=a.value,l=o.get(s);if(l!=null){var u=e.get(s),c=u.score,h=u.terms,f=u.match;_e(l.terms,h),i.set(s,{score:l.score+c,terms:l.terms,match:Object.assign(l.match,f)})}}}catch(d){t={error:d}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i},ee[At]=function(o,e){var t,r;try{for(var i=b(e.keys()),n=i.next();!n.done;n=i.next()){var a=n.value;o.delete(a)}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return o},ee),It={k:1.2,b:.7,d:.5},Mt=function(o,e,t,r,i,n){var a=n.k,s=n.b,l=n.d,u=Math.log(1+(t-e+.5)/(e+.5));return u*(l+o*(a+1)/(o+a*(1-s+s*r/i)))},zt=function(o){return function(e,t,r){var i=typeof o.fuzzy=="function"?o.fuzzy(e,t,r):o.fuzzy||!1,n=typeof o.prefix=="function"?o.prefix(e,t,r):o.prefix===!0;return{term:e,fuzzy:i,prefix:n}}},me={idField:"id",extractField:function(o,e){return o[e]},tokenize:function(o){return o.split(Lt)},processTerm:function(o){return o.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(o,e){typeof(console==null?void 0:console[o])=="function"&&console[o](e)},autoVacuum:!0},Oe={combineWith:Ee,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:It},Dt={combineWith:Ue,prefix:function(o,e,t){return e===t.length-1}},xe={batchSize:1e3,batchWait:10},we={minDirtFactor:.1,minDirtCount:20},ye=N(N({},xe),we),Tt=function(o,e){o.includes(e)||o.push(e)},_e=function(o,e){var t,r;try{for(var i=b(e),n=i.next();!n.done;n=i.next()){var a=n.value;o.includes(a)||o.push(a)}}catch(s){t={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},Re=function(o,e){var t=o.score,r=e.score;return r-t},Ve=function(){return new Map},se=function(o){var e,t,r=new Map;try{for(var i=b(Object.keys(o)),n=i.next();!n.done;n=i.next()){var a=n.value;r.set(parseInt(a,10),o[a])}}catch(s){e={error:s}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},Lt=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;const Nt={class:"shell"},Ot={class:"search-actions before"},_t=["title"],Rt=["placeholder"],Vt={class:"search-actions"},Bt=["title"],Pt=["title"],$t=["href","aria-label","onMouseenter"],Wt={class:"titles"},Jt=["innerHTML"],jt={class:"title main"},Ut=["innerHTML"],Ht={key:0,class:"excerpt-wrapper"},Kt={key:0,class:"excerpt"},Qt=["innerHTML"],Gt={key:0,class:"no-results"},Yt={class:"search-keyboard-shortcuts"},qt=["aria-label"],Zt=["aria-label"],Xt=["aria-label"],er=["aria-label"],tr=Ye({__name:"VPLocalSearchBox",props:{placeholder:{}},emits:["close"],setup(o,{emit:e}){var O;const t=e,r=X(),i=X(),n=X(),a=X(yt),{localeIndex:s,theme:l}=ct(),u=Ne(async()=>{var p,v,k;return Le(Ct.loadJSON((k=await((v=(p=a.value)[s.value])==null?void 0:v.call(p)))==null?void 0:k.default,{fields:["title","titles","text"],storeFields:["title","titles"],searchOptions:{fuzzy:.2,prefix:!0,boost:{title:4,text:2,titles:1}}}))}),c=ht("vitepress:local-search-filter",""),h=ft("vitepress:local-search-detailed-list",!1),f=at(()=>{var p,v;return((p=l.value.search)==null?void 0:p.provider)==="local"&&((v=l.value.search.options)==null?void 0:v.disableDetailedView)===!0});qe(()=>{f.value&&(h.value=!1)});const d=X([]),m=/<h(\d*).*?>.*?<a.*? href="#(.*?)".*?>.*?<\/a><\/h\1>/gi,x=ae(!1);Me(c,()=>{x.value=!1});const y=Ne(async()=>{if(i.value)return Le(new xt(i.value))},null);dt(()=>[u.value,c.value,h.value],async([p,v,k],P,$)=>{var Se,Ae,Ce,ke;let B=!1;if($(()=>{B=!0}),!p)return;d.value=p.search(v).slice(0,16),x.value=!0;const He=k?await Promise.all(d.value.map(W=>F(W.id))):[];if(B)return;const ue=new Map;for(const{id:W,mod:H}of He){const J=H.default??H;if(J!=null&&J.render){const K=ot(J);K.config.warnHandler=()=>{};const te=document.createElement("div");K.mount(te);const Q=te.innerHTML.split(m);K.unmount(),Q.shift();const Ie=W.slice(0,W.indexOf("#"));let re=ue.get(Ie);re||(re=new Map,ue.set(Ie,re));for(let ne=0;ne<Q.length;ne+=3){const Qe=Q[ne+1],Ge=Q[ne+2];re.set(Qe,Ge)}}if(B)return}const be=new Set;if(d.value=d.value.map(W=>{const[H,J]=W.id.split("#"),K=ue.get(H),te=(K==null?void 0:K.get(J))??"";for(const Q in W.match)be.add(Q);return{...W,text:te}}),await he(),B)return;await new Promise(W=>{var H;(H=y.value)==null||H.unmark({done:()=>{var J;(J=y.value)==null||J.markRegExp(I(be),{done:W})}})});const Ke=((Se=r.value)==null?void 0:Se.querySelectorAll(".result .excerpt"))??[];for(const W of Ke)(Ae=W.querySelector('mark[data-markjs="true"]'))==null||Ae.scrollIntoView({block:"center"});(ke=(Ce=i.value)==null?void 0:Ce.firstElementChild)==null||ke.scrollIntoView({block:"start"})},{debounce:200,immediate:!0});async function F(p){const v=st(lt(p.slice(0,p.indexOf("#"))));try{return{id:p,mod:await Be(()=>import(v),[])}}catch(k){return console.error(k),{id:p,mod:{}}}}const E=ae();function w(){var p,v;(p=E.value)==null||p.focus(),(v=E.value)==null||v.select()}ce(()=>{w()});function z(p){p.pointerType==="mouse"&&w()}const S=ae(0),L=ae(!1);Me(d,()=>{S.value=0,A()});function A(){he(()=>{const p=document.querySelector(".result.selected");p&&p.scrollIntoView({block:"nearest"})})}oe("ArrowUp",p=>{p.preventDefault(),S.value--,S.value<0&&(S.value=d.value.length-1),L.value=!0,A()}),oe("ArrowDown",p=>{p.preventDefault(),S.value++,S.value>=d.value.length&&(S.value=0),L.value=!0,A()});const M=Ze();oe("Enter",()=>{const p=d.value[S.value];p&&(M.go(p.id),t("close"))}),oe("Escape",()=>{t("close")});const D={modal:{displayDetails:"Display detailed list",resetButtonTitle:"Reset search",backButtonTitle:"Close search",noResultsText:"No results for",footer:{selectText:"to select",selectKeyAriaLabel:"enter",navigateText:"to navigate",navigateUpKeyAriaLabel:"up arrow",navigateDownKeyAriaLabel:"down arrow",closeText:"to close",closeKeyAriaLabel:"escape"}}},C=vt((O=l.value.search)==null?void 0:O.options,D);ce(()=>{window.history.pushState(null,"",null)}),pt("popstate",p=>{p.preventDefault(),t("close")});const T=mt(n);ce(()=>{n.value=document.body,he(()=>{T.value=!0})}),Xe(()=>{T.value=!1});function I(p){return new RegExp([...p].sort((v,k)=>k.length-v.length).map(v=>`(${v.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")})`).join("|"),"gi")}return(p,v)=>(j(),et(it,{to:"body"},[g("div",{ref_key:"el",ref:r,class:"VPLocalSearchBox","aria-modal":"true"},[g("div",{class:"backdrop",onClick:v[0]||(v[0]=k=>p.$emit("close"))}),g("div",Nt,[g("div",{class:"search-bar",onPointerup:v[5]||(v[5]=k=>z(k))},[v[11]||(v[11]=g("svg",{class:"search-icon",width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[g("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("circle",{cx:"11",cy:"11",r:"8"}),g("path",{d:"m21 21l-4.35-4.35"})])],-1)),g("div",Ot,[g("button",{class:"back-button",title:R(C)("modal.backButtonTitle"),onClick:v[1]||(v[1]=k=>p.$emit("close"))},[...v[8]||(v[8]=[g("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 12H5m7 7l-7-7l7-7"})],-1)])],8,_t)]),tt(g("input",{ref_key:"searchInput",ref:E,"onUpdate:modelValue":v[2]||(v[2]=k=>nt(c)?c.value=k:null),placeholder:o.placeholder,class:"search-input"},null,8,Rt),[[rt,R(c)]]),g("div",Vt,[f.value?ie("",!0):(j(),U("button",{key:0,class:ze(["toggle-layout-button",{"detailed-list":R(h)}]),title:R(C)("modal.displayDetails"),onClick:v[3]||(v[3]=k=>h.value=!R(h))},[...v[9]||(v[9]=[g("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 14h7v7H3zM3 3h7v7H3zm11 1h7m-7 5h7m-7 6h7m-7 5h7"})],-1)])],10,Bt)),g("button",{class:"clear-button",title:R(C)("modal.resetButtonTitle"),onClick:v[4]||(v[4]=k=>c.value="")},[...v[10]||(v[10]=[g("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 5H9l-7 7l7 7h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2Zm-2 4l-6 6m0-6l6 6"})],-1)])],8,Pt)])],32),g("div",{ref_key:"resultsEl",ref:i,class:"results",onMousemove:v[7]||(v[7]=k=>L.value=!1)},[(j(!0),U(Te,null,De(d.value,(k,P)=>(j(),U("a",{key:k.id,href:k.id,class:ze(["result",{selected:S.value===P}]),"aria-label":[...k.titles,k.title].join(" > "),onMouseenter:$=>!L.value&&(S.value=P),onClick:v[6]||(v[6]=$=>p.$emit("close"))},[g("div",null,[g("div",Wt,[v[13]||(v[13]=g("span",{class:"title-icon"},"#",-1)),(j(!0),U(Te,null,De(k.titles,($,B)=>(j(),U("span",{key:B,class:"title"},[g("span",{class:"text",innerHTML:$},null,8,Jt),v[12]||(v[12]=g("svg",{width:"18",height:"18",viewBox:"0 0 24 24"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"})],-1))]))),128)),g("span",jt,[g("span",{class:"text",innerHTML:k.title},null,8,Ut)])]),R(h)?(j(),U("div",Ht,[k.text?(j(),U("div",Kt,[g("div",{class:"vp-doc",innerHTML:k.text},null,8,Qt)])):ie("",!0),v[14]||(v[14]=g("div",{class:"excerpt-gradient-bottom"},null,-1)),v[15]||(v[15]=g("div",{class:"excerpt-gradient-top"},null,-1))])):ie("",!0)])],42,$t))),128)),R(c)&&!d.value.length&&x.value?(j(),U("div",Gt,[q(Z(R(C)("modal.noResultsText"))+' "',1),g("strong",null,Z(R(c)),1),v[16]||(v[16]=q('" ',-1))])):ie("",!0)],544),g("div",Yt,[g("span",null,[g("kbd",{"aria-label":R(C)("modal.footer.navigateUpKeyAriaLabel")},[...v[17]||(v[17]=[g("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 19V5m-7 7l7-7l7 7"})],-1)])],8,qt),g("kbd",{"aria-label":R(C)("modal.footer.navigateDownKeyAriaLabel")},[...v[18]||(v[18]=[g("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 5v14m7-7l-7 7l-7-7"})],-1)])],8,Zt),q(" "+Z(R(C)("modal.footer.navigateText")),1)]),g("span",null,[g("kbd",{"aria-label":R(C)("modal.footer.selectKeyAriaLabel")},[...v[19]||(v[19]=[g("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[g("g",{fill:"none",stroke:"currentcolor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[g("path",{d:"m9 10l-5 5l5 5"}),g("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"})])],-1)])],8,Xt),q(" "+Z(R(C)("modal.footer.selectText")),1)]),g("span",null,[g("kbd",{"aria-label":R(C)("modal.footer.closeKeyAriaLabel")},"esc",8,er),q(" "+Z(R(C)("modal.footer.closeText")),1)])])])],512)]))}});const ar=ut(tr,[["__scopeId","data-v-272e0f11"]]);export{ar as default};
|