mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-23 13:52:26 +08:00
8 lines
69 KiB
JavaScript
8 lines
69 KiB
JavaScript
import{$ as Ve,h as ie,z as $e,d as Dt,D as de,g as _e,A as Ot,j as De,E as he,aj as Rt,ak as Mt,o as X,b as Pt,k as A,a3 as Lt,l as W,al as zt,am as Bt,C as Vt,c as te,n as rt,e as we,M as at,L as nt,a as ve,t as pe,an as $t,p as jt,m as Wt,ao as it,ap as Kt,a8 as Jt,ae as Ut,_ as Ht}from"./framework.6e839c56.js";import{u as Gt,a as qt,b as Qt,c as ot,d as Yt,e as Zt,w as Xt,o as xe,f as er,g as tr,h as rr}from"./theme.4451c782.js";const ar={root:()=>Ve(()=>import("./@localSearchIndexroot.84da4c78.js"),[]),en:()=>Ve(()=>import("./@localSearchIndexen.3dcccaf9.js"),[])};/*!
|
||
* tabbable 6.2.0
|
||
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
||
*/var gt=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Se=gt.join(","),bt=typeof Element>"u",se=bt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ae=!bt&&Element.prototype.getRootNode?function(o){var e;return o==null||(e=o.getRootNode)===null||e===void 0?void 0:e.call(o)}:function(o){return o==null?void 0:o.ownerDocument},Ce=function o(e,t){var r;t===void 0&&(t=!0);var n=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=n===""||n==="true",i=a||t&&e&&o(e.parentNode);return i},nr=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},wt=function(e,t,r){if(Ce(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(Se));return t&&se.call(e,Se)&&n.unshift(e),n=n.filter(r),n},xt=function o(e,t,r){for(var n=[],a=Array.from(e);a.length;){var i=a.shift();if(!Ce(i,!1))if(i.tagName==="SLOT"){var s=i.assignedElements(),l=s.length?s:i.children,u=o(l,!0,r);r.flatten?n.push.apply(n,u):n.push({scopeParent:i,candidates:u})}else{var d=se.call(i,Se);d&&r.filter(i)&&(t||!e.includes(i))&&n.push(i);var h=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),v=!Ce(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(h&&v){var p=o(h===!0?i.children:h.children,!0,r);r.flatten?n.push.apply(n,p):n.push({scopeParent:i,candidates:p})}else a.unshift.apply(a,i.children)}}return n},Ft=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},oe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||nr(e))&&!Ft(e)?0:e.tabIndex},ir=function(e,t){var r=oe(e);return r<0&&t&&!Ft(e)?0:r},or=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Et=function(e){return e.tagName==="INPUT"},sr=function(e){return Et(e)&&e.type==="hidden"},lr=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},ur=function(e,t){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===t)return e[r]},cr=function(e){if(!e.name)return!0;var t=e.form||Ae(e),r=function(s){return t.querySelectorAll('input[type="radio"][name="'+s+'"]')},n;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")n=r(window.CSS.escape(e.name));else try{n=r(e.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var a=ur(n,e.form);return!a||a===e},fr=function(e){return Et(e)&&e.type==="radio"},dr=function(e){return fr(e)&&!cr(e)},hr=function(e){var t,r=e&&Ae(e),n=(t=r)===null||t===void 0?void 0:t.host,a=!1;if(r&&r!==e){var i,s,l;for(a=!!((i=n)!==null&&i!==void 0&&(s=i.ownerDocument)!==null&&s!==void 0&&s.contains(n)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!a&&n;){var u,d,h;r=Ae(n),n=(u=r)===null||u===void 0?void 0:u.host,a=!!((d=n)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(n))}}return a},st=function(e){var t=e.getBoundingClientRect(),r=t.width,n=t.height;return r===0&&n===0},vr=function(e,t){var r=t.displayCheck,n=t.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var a=se.call(e,"details>summary:first-of-type"),i=a?e.parentElement:e;if(se.call(i,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof n=="function"){for(var s=e;e;){var l=e.parentElement,u=Ae(e);if(l&&!l.shadowRoot&&n(l)===!0)return st(e);e.assignedSlot?e=e.assignedSlot:!l&&u!==e.ownerDocument?e=u.host:e=l}e=s}if(hr(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return st(e);return!1},pr=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r<t.children.length;r++){var n=t.children.item(r);if(n.tagName==="LEGEND")return se.call(t,"fieldset[disabled] *")?!0:!n.contains(e)}return!0}t=t.parentElement}return!1},Ne=function(e,t){return!(t.disabled||Ce(t)||sr(t)||vr(t,e)||lr(t)||pr(t))},je=function(e,t){return!(dr(t)||oe(t)<0||!Ne(e,t))},yr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},mr=function o(e){var t=[],r=[];return e.forEach(function(n,a){var i=!!n.scopeParent,s=i?n.scopeParent:n,l=ir(s,i),u=i?o(n.candidates):s;l===0?i?t.push.apply(t,u):t.push(s):r.push({documentOrder:a,tabIndex:l,item:n,isScope:i,content:u})}),r.sort(or).reduce(function(n,a){return a.isScope?n.push.apply(n,a.content):n.push(a.content),n},[]).concat(t)},gr=function(e,t){t=t||{};var r;return t.getShadowRoot?r=xt([e],t.includeContainer,{filter:je.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:yr}):r=wt(e,t.includeContainer,je.bind(null,t)),mr(r)},br=function(e,t){t=t||{};var r;return t.getShadowRoot?r=xt([e],t.includeContainer,{filter:Ne.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=wt(e,t.includeContainer,Ne.bind(null,t)),r},le=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return se.call(e,Se)===!1?!1:je(t,e)},wr=gt.concat("iframe").join(","),Oe=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return se.call(e,wr)===!1?!1:Ne(t,e)};/*!
|
||
* focus-trap 7.5.2
|
||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
||
*/function lt(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(o,n).enumerable})),t.push.apply(t,r)}return t}function ut(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?lt(Object(t),!0).forEach(function(r){xr(o,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):lt(Object(t)).forEach(function(r){Object.defineProperty(o,r,Object.getOwnPropertyDescriptor(t,r))})}return o}function xr(o,e,t){return e=Er(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Fr(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var r=t.call(o,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function Er(o){var e=Fr(o,"string");return typeof e=="symbol"?e:String(e)}var ct={activateTrap:function(e,t){if(e.length>0){var r=e[e.length-1];r!==t&&r.pause()}var n=e.indexOf(t);n===-1||e.splice(n,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},Sr=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Ar=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},ge=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Cr=function(e){return ge(e)&&!e.shiftKey},Nr=function(e){return ge(e)&&e.shiftKey},ft=function(e){return setTimeout(e,0)},dt=function(e,t){var r=-1;return e.every(function(n,a){return t(n)?(r=a,!1):!0}),r},ye=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return typeof e=="function"?e.apply(void 0,r):e},Fe=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Tr=[],kr=function(e,t){var r=(t==null?void 0:t.document)||document,n=(t==null?void 0:t.trapStack)||Tr,a=ut({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Cr,isKeyBackward:Nr},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},s,l=function(f,c,y){return f&&f[c]!==void 0?f[c]:a[y||c]},u=function(f,c){var y=typeof(c==null?void 0:c.composedPath)=="function"?c.composedPath():void 0;return i.containerGroups.findIndex(function(x){var I=x.container,O=x.tabbableNodes;return I.contains(f)||(y==null?void 0:y.includes(I))||O.find(function(P){return P===f})})},d=function(f){var c=a[f];if(typeof c=="function"){for(var y=arguments.length,x=new Array(y>1?y-1:0),I=1;I<y;I++)x[I-1]=arguments[I];c=c.apply(void 0,x)}if(c===!0&&(c=void 0),!c){if(c===void 0||c===!1)return c;throw new Error("`".concat(f,"` was specified but was not a node, or did not return a node"))}var O=c;if(typeof c=="string"&&(O=r.querySelector(c),!O))throw new Error("`".concat(f,"` as selector refers to no known node"));return O},h=function(){var f=d("initialFocus");if(f===!1)return!1;if(f===void 0||!Oe(f,a.tabbableOptions))if(u(r.activeElement)>=0)f=r.activeElement;else{var c=i.tabbableGroups[0],y=c&&c.firstTabbableNode;f=y||d("fallbackFocus")}if(!f)throw new Error("Your focus-trap needs to have at least one focusable element");return f},v=function(){if(i.containerGroups=i.containers.map(function(f){var c=gr(f,a.tabbableOptions),y=br(f,a.tabbableOptions),x=c.length>0?c[0]:void 0,I=c.length>0?c[c.length-1]:void 0,O=y.find(function(m){return le(m)}),P=y.slice().reverse().find(function(m){return le(m)}),z=!!c.find(function(m){return oe(m)>0});return{container:f,tabbableNodes:c,focusableNodes:y,posTabIndexesFound:z,firstTabbableNode:x,lastTabbableNode:I,firstDomTabbableNode:O,lastDomTabbableNode:P,nextTabbableNode:function(N){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,J=c.indexOf(N);return J<0?$?y.slice(y.indexOf(N)+1).find(function(H){return le(H)}):y.slice(0,y.indexOf(N)).reverse().find(function(H){return le(H)}):c[J+($?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function(f){return f.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(i.containerGroups.find(function(f){return f.posTabIndexesFound})&&i.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function F(f){if(f!==!1&&f!==r.activeElement){if(!f||!f.focus){F(h());return}f.focus({preventScroll:!!a.preventScroll}),i.mostRecentlyFocusedNode=f,Sr(f)&&f.select()}},b=function(f){var c=d("setReturnFocus",f);return c||(c===!1?!1:f)},g=function(f){var c=f.target,y=f.event,x=f.isBackward,I=x===void 0?!1:x;c=c||Fe(y),v();var O=null;if(i.tabbableGroups.length>0){var P=u(c,y),z=P>=0?i.containerGroups[P]:void 0;if(P<0)I?O=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:O=i.tabbableGroups[0].firstTabbableNode;else if(I){var m=dt(i.tabbableGroups,function(B){var U=B.firstTabbableNode;return c===U});if(m<0&&(z.container===c||Oe(c,a.tabbableOptions)&&!le(c,a.tabbableOptions)&&!z.nextTabbableNode(c,!1))&&(m=P),m>=0){var N=m===0?i.tabbableGroups.length-1:m-1,$=i.tabbableGroups[N];O=oe(c)>=0?$.lastTabbableNode:$.lastDomTabbableNode}else ge(y)||(O=z.nextTabbableNode(c,!1))}else{var J=dt(i.tabbableGroups,function(B){var U=B.lastTabbableNode;return c===U});if(J<0&&(z.container===c||Oe(c,a.tabbableOptions)&&!le(c,a.tabbableOptions)&&!z.nextTabbableNode(c))&&(J=P),J>=0){var H=J===i.tabbableGroups.length-1?0:J+1,G=i.tabbableGroups[H];O=oe(c)>=0?G.firstTabbableNode:G.firstDomTabbableNode}else ge(y)||(O=z.nextTabbableNode(c))}}else O=d("fallbackFocus");return O},w=function(f){var c=Fe(f);if(!(u(c,f)>=0)){if(ye(a.clickOutsideDeactivates,f)){s.deactivate({returnFocus:a.returnFocusOnDeactivate});return}ye(a.allowOutsideClick,f)||f.preventDefault()}},C=function(f){var c=Fe(f),y=u(c,f)>=0;if(y||c instanceof Document)y&&(i.mostRecentlyFocusedNode=c);else{f.stopImmediatePropagation();var x,I=!0;if(i.mostRecentlyFocusedNode)if(oe(i.mostRecentlyFocusedNode)>0){var O=u(i.mostRecentlyFocusedNode),P=i.containerGroups[O].tabbableNodes;if(P.length>0){var z=P.findIndex(function(m){return m===i.mostRecentlyFocusedNode});z>=0&&(a.isKeyForward(i.recentNavEvent)?z+1<P.length&&(x=P[z+1],I=!1):z-1>=0&&(x=P[z-1],I=!1))}}else i.containerGroups.some(function(m){return m.tabbableNodes.some(function(N){return oe(N)>0})})||(I=!1);else I=!1;I&&(x=g({target:i.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(i.recentNavEvent)})),p(x||i.mostRecentlyFocusedNode||h())}i.recentNavEvent=void 0},T=function(f){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i.recentNavEvent=f;var y=g({event:f,isBackward:c});y&&(ge(f)&&f.preventDefault(),p(y))},E=function(f){if(Ar(f)&&ye(a.escapeDeactivates,f)!==!1){f.preventDefault(),s.deactivate();return}(a.isKeyForward(f)||a.isKeyBackward(f))&&T(f,a.isKeyBackward(f))},M=function(f){var c=Fe(f);u(c,f)>=0||ye(a.clickOutsideDeactivates,f)||ye(a.allowOutsideClick,f)||(f.preventDefault(),f.stopImmediatePropagation())},R=function(){if(i.active)return ct.activateTrap(n,s),i.delayInitialFocusTimer=a.delayInitialFocus?ft(function(){p(h())}):p(h()),r.addEventListener("focusin",C,!0),r.addEventListener("mousedown",w,{capture:!0,passive:!1}),r.addEventListener("touchstart",w,{capture:!0,passive:!1}),r.addEventListener("click",M,{capture:!0,passive:!1}),r.addEventListener("keydown",E,{capture:!0,passive:!1}),s},L=function(){if(i.active)return r.removeEventListener("focusin",C,!0),r.removeEventListener("mousedown",w,!0),r.removeEventListener("touchstart",w,!0),r.removeEventListener("click",M,!0),r.removeEventListener("keydown",E,!0),s},S=function(f){var c=f.some(function(y){var x=Array.from(y.removedNodes);return x.some(function(I){return I===i.mostRecentlyFocusedNode})});c&&p(h())},k=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(S):void 0,D=function(){k&&(k.disconnect(),i.active&&!i.paused&&i.containers.map(function(f){k.observe(f,{subtree:!0,childList:!0})}))};return s={get active(){return i.active},get paused(){return i.paused},activate:function(f){if(i.active)return this;var c=l(f,"onActivate"),y=l(f,"onPostActivate"),x=l(f,"checkCanFocusTrap");x||v(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=r.activeElement,c==null||c();var I=function(){x&&v(),R(),D(),y==null||y()};return x?(x(i.containers.concat()).then(I,I),this):(I(),this)},deactivate:function(f){if(!i.active)return this;var c=ut({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},f);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,L(),i.active=!1,i.paused=!1,D(),ct.deactivateTrap(n,s);var y=l(c,"onDeactivate"),x=l(c,"onPostDeactivate"),I=l(c,"checkCanReturnFocus"),O=l(c,"returnFocus","returnFocusOnDeactivate");y==null||y();var P=function(){ft(function(){O&&p(b(i.nodeFocusedBeforeActivation)),x==null||x()})};return O&&I?(I(b(i.nodeFocusedBeforeActivation)).then(P,P),this):(P(),this)},pause:function(f){if(i.paused||!i.active)return this;var c=l(f,"onPause"),y=l(f,"onPostPause");return i.paused=!0,c==null||c(),L(),D(),y==null||y(),this},unpause:function(f){if(!i.paused||!i.active)return this;var c=l(f,"onUnpause"),y=l(f,"onPostUnpause");return i.paused=!1,c==null||c(),v(),R(),D(),y==null||y(),this},updateContainerElements:function(f){var c=[].concat(f).filter(Boolean);return i.containers=c.map(function(y){return typeof y=="string"?r.querySelector(y):y}),i.active&&v(),D(),this}},s.updateContainerElements(e),s},Ir=Object.defineProperty,_r=Object.defineProperties,Dr=Object.getOwnPropertyDescriptors,Te=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,ht=(o,e,t)=>e in o?Ir(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Or=(o,e)=>{for(var t in e||(e={}))St.call(e,t)&&ht(o,t,e[t]);if(Te)for(var t of Te(e))At.call(e,t)&&ht(o,t,e[t]);return o},Rr=(o,e)=>_r(o,Dr(e)),Mr=(o,e)=>{var t={};for(var r in o)St.call(o,r)&&e.indexOf(r)<0&&(t[r]=o[r]);if(o!=null&&Te)for(var r of Te(o))e.indexOf(r)<0&&At.call(o,r)&&(t[r]=o[r]);return t};function Pr(o,e={}){let t;const r=e,{immediate:n}=r,a=Mr(r,["immediate"]),i=ie(!1),s=ie(!1),l=v=>t&&t.activate(v),u=v=>t&&t.deactivate(v),d=()=>{t&&(t.pause(),s.value=!0)},h=()=>{t&&(t.unpause(),s.value=!1)};return $e(()=>Gt(o),v=>{v&&(t=kr(v,Rr(Or({},a),{onActivate(){i.value=!0,e.onActivate&&e.onActivate()},onDeactivate(){i.value=!1,e.onDeactivate&&e.onDeactivate()}})),n&&l())},{flush:"post"}),qt(()=>u()),{hasFocus:i,isPaused:s,activate:l,deactivate:u,pause:d,unpause:h}}class ce{constructor(e,t=!0,r=[],n=5e3){this.ctx=e,this.iframes=t,this.exclude=r,this.iframesTimeout=n}static matches(e,t){const r=typeof t=="string"?[t]:t,n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(n){let a=!1;return r.every(i=>n.call(e,i)?(a=!0,!1):!0),a}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 n=t.filter(a=>a.contains(r)).length>0;t.indexOf(r)===-1&&!n&&t.push(r)}),t}getIframeContents(e,t,r=()=>{}){let n;try{const a=e.contentWindow;if(n=a.document,!a||!n)throw new Error("iframe inaccessible")}catch{r()}n&&t(n)}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 n=!1,a=null;const i=()=>{if(!n){n=!0,clearTimeout(a);try{this.isIframeBlank(e)||(e.removeEventListener("load",i),this.getIframeContents(e,t,r))}catch{r()}}};e.addEventListener("load",i),a=setTimeout(i,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,n=>{r++,this.waitForIframes(n.querySelector("html"),()=>{--r||t()})},n=>{n||t()})}forEachIframe(e,t,r,n=()=>{}){let a=e.querySelectorAll("iframe"),i=a.length,s=0;a=Array.prototype.slice.call(a);const l=()=>{--i<=0&&n(s)};i||l(),a.forEach(u=>{ce.matches(u,this.exclude)?l():this.onIframeReady(u,d=>{t(u)&&(s++,r(d)),l()},l)})}createIterator(e,t,r){return document.createNodeIterator(e,t,r,!1)}createInstanceOnIframe(e){return new ce(e.querySelector("html"),this.iframes)}compareNodeIframe(e,t,r){const n=e.compareDocumentPosition(r),a=Node.DOCUMENT_POSITION_PRECEDING;if(n&a)if(t!==null){const i=t.compareDocumentPosition(r),s=Node.DOCUMENT_POSITION_FOLLOWING;if(i&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,n){let a=!1,i=!1;return n.forEach((s,l)=>{s.val===r&&(a=l,i=s.handled)}),this.compareNodeIframe(e,t,r)?(a===!1&&!i?n.push({val:r,handled:!0}):a!==!1&&!i&&(n[a].handled=!0),!0):(a===!1&&n.push({val:r,handled:!1}),!1)}handleOpenIframes(e,t,r,n){e.forEach(a=>{a.handled||this.getIframeContents(a.val,i=>{this.createInstanceOnIframe(i).forEachNode(t,r,n)})})}iterateThroughNodes(e,t,r,n,a){const i=this.createIterator(t,e,n);let s=[],l=[],u,d,h=()=>({prevNode:d,node:u}=this.getIteratorNode(i),u);for(;h();)this.iframes&&this.forEachIframe(t,v=>this.checkIframeFilter(u,d,v,s),v=>{this.createInstanceOnIframe(v).forEachNode(e,p=>l.push(p),n)}),l.push(u);l.forEach(v=>{r(v)}),this.iframes&&this.handleOpenIframes(s,e,r,n),a()}forEachNode(e,t,r,n=()=>{}){const a=this.getContexts();let i=a.length;i||n(),a.forEach(s=>{const l=()=>{this.iterateThroughNodes(e,s,t,r,()=>{--i<=0&&n()})};this.iframes?this.waitForIframes(s,l):l()})}}let Lr=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 ce(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",n=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(let a in t)if(t.hasOwnProperty(a)){const i=t[a],s=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(a):this.escapeStr(a),l=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(i):this.escapeStr(i);s!==""&&l!==""&&(e=e.replace(new RegExp(`(${this.escapeStr(s)}|${this.escapeStr(l)})`,`gm${r}`),n+`(${this.processSynomyms(s)}|${this.processSynomyms(l)})`+n))}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,n)=>{let a=n.charAt(r+1);return/[(|)\\]/.test(a)||a===""?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 n=[];return e.split("").forEach(a=>{r.every(i=>{if(i.indexOf(a)!==-1){if(n.indexOf(i)>-1)return!1;e=e.replace(new RegExp(`[${i}]`,`gm${t}`),`[${i}]`),n.push(i)}return!0})}),e}createMergedBlanksRegExp(e){return e.replace(/[\s]+/gmi,"[\\s]+")}createAccuracyRegExp(e){const t="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿";let r=this.opt.accuracy,n=typeof r=="string"?r:r.value,a=typeof r=="string"?[]:r.limiters,i="";switch(a.forEach(s=>{i+=`|${this.escapeStr(s)}`}),n){case"partially":default:return`()(${e})`;case"complementary":return i="\\s"+(i||this.escapeStr(t)),`()([^${i}]*${e}[^${i}]*)`;case"exactly":return`(^|\\s${i})(${e})(?=$|\\s${i})`}}getSeparatedKeywords(e){let t=[];return e.forEach(r=>{this.opt.separateWordSearch?r.split(" ").forEach(n=>{n.trim()&&t.indexOf(n)===-1&&t.push(n)}):r.trim()&&t.indexOf(r)===-1&&t.push(r)}),{keywords:t.sort((r,n)=>n.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((n,a)=>n.start-a.start).forEach(n=>{let{start:a,end:i,valid:s}=this.callNoMatchOnInvalidRanges(n,r);s&&(n.start=a,n.length=i-a,t.push(n),r=i)}),t}callNoMatchOnInvalidRanges(e,t){let r,n,a=!1;return e&&typeof e.start<"u"?(r=parseInt(e.start,10),n=r+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&n-t>0&&n-r>0?a=!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:n,valid:a}}checkWhitespaceRanges(e,t,r){let n,a=!0,i=r.length,s=t-i,l=parseInt(e.start,10)-s;return l=l>i?i:l,n=l+parseInt(e.length,10),n>i&&(n=i,this.log(`End range automatically set to the max value of ${i}`)),l<0||n-l<0||l>i||n>i?(a=!1,this.log(`Invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)):r.substring(l,n).replace(/\s+/g,"")===""&&(a=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:l,end:n,valid:a}}getTextNodes(e){let t="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,n=>{r.push({start:t.length,end:(t+=n.textContent).length,node:n})},n=>this.matchesExclude(n.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT,()=>{e({value:t,nodes:r})})}matchesExclude(e){return ce.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}wrapRangeInTextNode(e,t,r){const n=this.opt.element?this.opt.element:"mark",a=e.splitText(t),i=a.splitText(r-t);let s=document.createElement(n);return s.setAttribute("data-markjs","true"),this.opt.className&&s.setAttribute("class",this.opt.className),s.textContent=a.textContent,a.parentNode.replaceChild(s,a),i}wrapRangeInMappedTextNode(e,t,r,n,a){e.nodes.every((i,s)=>{const l=e.nodes[s+1];if(typeof l>"u"||l.start>t){if(!n(i.node))return!1;const u=t-i.start,d=(r>i.end?i.end:r)-i.start,h=e.value.substr(0,i.start),v=e.value.substr(d+i.start);if(i.node=this.wrapRangeInTextNode(i.node,u,d),e.value=h+v,e.nodes.forEach((p,b)=>{b>=s&&(e.nodes[b].start>0&&b!==s&&(e.nodes[b].start-=d),e.nodes[b].end-=d)}),r-=d,a(i.node.previousSibling,i.start),r>i.end)t=i.end;else return!1}return!0})}wrapMatches(e,t,r,n,a){const i=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[i]!=="";){if(!r(u[i],l))continue;let d=u.index;if(i!==0)for(let h=1;h<i;h++)d+=u[h].length;l=this.wrapRangeInTextNode(l,d,d+u[i].length),n(l.previousSibling),e.lastIndex=0}}),a()})}wrapMatchesAcrossElements(e,t,r,n,a){const i=t===0?0:t+1;this.getTextNodes(s=>{let l;for(;(l=e.exec(s.value))!==null&&l[i]!=="";){let u=l.index;if(i!==0)for(let h=1;h<i;h++)u+=l[h].length;const d=u+l[i].length;this.wrapRangeInMappedTextNode(s,u,d,h=>r(l[i],h),(h,v)=>{e.lastIndex=v,n(h)})}a()})}wrapRangeFromIndex(e,t,r,n){this.getTextNodes(a=>{const i=a.value.length;e.forEach((s,l)=>{let{start:u,end:d,valid:h}=this.checkWhitespaceRanges(s,i,a.value);h&&this.wrapRangeInMappedTextNode(a,u,d,v=>t(v,s,a.value.substring(u,d),l),v=>{r(v,s)})}),n()})}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,n="wrapMatches";const a=i=>{r++,this.opt.each(i)};this.opt.acrossElements&&(n="wrapMatchesAcrossElements"),this[n](e,this.opt.ignoreGroups,(i,s)=>this.opt.filter(s,i,r),a,()=>{r===0&&this.opt.noMatch(e),this.opt.done(r)})}mark(e,t){this.opt=t;let r=0,n="wrapMatches";const{keywords:a,length:i}=this.getSeparatedKeywords(typeof e=="string"?[e]:e),s=this.opt.caseSensitive?"":"i",l=u=>{let d=new RegExp(this.createRegExp(u),`gm${s}`),h=0;this.log(`Searching with expression "${d}"`),this[n](d,1,(v,p)=>this.opt.filter(p,u,r,h),v=>{h++,r++,this.opt.each(v)},()=>{h===0&&this.opt.noMatch(u),a[i-1]===u?this.opt.done(r):l(a[a.indexOf(u)+1])})};this.opt.acrossElements&&(n="wrapMatchesAcrossElements"),i===0?this.opt.done(r):l(a[0])}markRanges(e,t){this.opt=t;let r=0,n=this.checkRanges(e);n&&n.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(n)),this.wrapRangeFromIndex(n,(a,i,s,l)=>this.opt.filter(a,i,s,l),(a,i)=>{r++,this.opt.each(a,i)},()=>{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 n=ce.matches(r,t),a=this.matchesExclude(r);return!n||a?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},this.opt.done)}};function zr(o){const e=new Lr(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 V=function(){return V=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},V.apply(this,arguments)};function Br(o,e,t,r){function n(a){return a instanceof t?a:new t(function(i){i(a)})}return new(t||(t=Promise))(function(a,i){function s(d){try{u(r.next(d))}catch(h){i(h)}}function l(d){try{u(r.throw(d))}catch(h){i(h)}}function u(d){d.done?a(d.value):n(d.value).then(s,l)}u((r=r.apply(o,e||[])).next())})}function Vr(o,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,n,a,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(u){return function(d){return l([u,d])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(t=0)),t;)try{if(r=1,n&&(a=u[0]&2?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(o,t)}catch(d){u=[6,d],n=0}finally{r=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function _(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 j(o,e){var t=typeof Symbol=="function"&&o[Symbol.iterator];if(!t)return o;var r=t.call(o),n,a=[],i;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return a}var $r="ENTRIES",Ct="KEYS",Nt="VALUES",K="",Re=function(){function o(e,t){var r=e._tree,n=Array.from(r.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:r,keys:n}]:[]}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=ue(this._path),t=e.node,r=e.keys;if(ue(r)===K)return{done:!1,value:this.result()};var n=t.get(ue(r));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},o.prototype.backtrack=function(){if(this._path.length!==0){var e=ue(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 ue(t)}).filter(function(e){return e!==K}).join("")},o.prototype.value=function(){return ue(this._path).node.get(K)},o.prototype.result=function(){switch(this._type){case Nt:return this.value();case Ct:return this.key();default:return[this.key(),this.value()]}},o.prototype[Symbol.iterator]=function(){return this},o}(),ue=function(o){return o[o.length-1]},jr=function(o,e,t){var r=new Map;if(e===void 0)return r;for(var n=e.length+1,a=n+t,i=new Uint8Array(a*n).fill(t+1),s=0;s<n;++s)i[s]=s;for(var l=1;l<a;++l)i[l*n]=l;return Tt(o,e,t,r,i,1,n,""),r},Tt=function(o,e,t,r,n,a,i,s){var l,u,d=a*i;try{e:for(var h=_(o.keys()),v=h.next();!v.done;v=h.next()){var p=v.value;if(p===K){var b=n[d-1];b<=t&&r.set(s,[o.get(p),b])}else{for(var g=a,w=0;w<p.length;++w,++g){for(var C=p[w],T=i*g,E=T-i,M=n[T],R=Math.max(0,g-t-1),L=Math.min(i-1,g+t),S=R;S<L;++S){var k=C!==e[S],D=n[E+S]+ +k,F=n[E+S+1]+1,f=n[T+S]+1,c=n[T+S+1]=Math.min(D,F,f);c<M&&(M=c)}if(M>t)continue e}Tt(o.get(p),e,t,r,n,g,i,s+p)}}}catch(y){l={error:y}}finally{try{v&&!v.done&&(u=h.return)&&u.call(h)}finally{if(l)throw l.error}}},Me=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 n=j(ke(this._tree,e.slice(this._prefix.length)),2),a=n[0],i=n[1];if(a===void 0){var s=j(Ue(i),2),l=s[0],u=s[1];try{for(var d=_(l.keys()),h=d.next();!h.done;h=d.next()){var v=h.value;if(v!==K&&v.startsWith(u)){var p=new Map;return p.set(v.slice(u.length),l.get(v)),new o(p,e)}}}catch(b){t={error:b}}finally{try{h&&!h.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}}return new o(a,e)},o.prototype.clear=function(){this._size=void 0,this._tree.clear()},o.prototype.delete=function(e){return this._size=void 0,Wr(this._tree,e)},o.prototype.entries=function(){return new Re(this,$r)},o.prototype.forEach=function(e){var t,r;try{for(var n=_(this),a=n.next();!a.done;a=n.next()){var i=j(a.value,2),s=i[0],l=i[1];e(s,l,this)}}catch(u){t={error:u}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},o.prototype.fuzzyGet=function(e,t){return jr(this._tree,e,t)},o.prototype.get=function(e){var t=We(this._tree,e);return t!==void 0?t.get(K):void 0},o.prototype.has=function(e){var t=We(this._tree,e);return t!==void 0&&t.has(K)},o.prototype.keys=function(){return new Re(this,Ct)},o.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var r=Pe(this._tree,e);return r.set(K,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=Pe(this._tree,e);return r.set(K,t(r.get(K))),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=Pe(this._tree,e),n=r.get(K);return n===void 0&&r.set(K,n=t()),n},o.prototype.values=function(){return new Re(this,Nt)},o.prototype[Symbol.iterator]=function(){return this.entries()},o.from=function(e){var t,r,n=new o;try{for(var a=_(e),i=a.next();!i.done;i=a.next()){var s=j(i.value,2),l=s[0],u=s[1];n.set(l,u)}}catch(d){t={error:d}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n},o.fromObject=function(e){return o.from(Object.entries(e))},o}(),ke=function(o,e,t){var r,n;if(t===void 0&&(t=[]),e.length===0||o==null)return[o,t];try{for(var a=_(o.keys()),i=a.next();!i.done;i=a.next()){var s=i.value;if(s!==K&&e.startsWith(s))return t.push([o,s]),ke(o.get(s),e.slice(s.length),t)}}catch(l){r={error:l}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return t.push([o,e]),ke(void 0,"",t)},We=function(o,e){var t,r;if(e.length===0||o==null)return o;try{for(var n=_(o.keys()),a=n.next();!a.done;a=n.next()){var i=a.value;if(i!==K&&e.startsWith(i))return We(o.get(i),e.slice(i.length))}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},Pe=function(o,e){var t,r,n=e.length;e:for(var a=0;o&&a<n;){try{for(var i=(t=void 0,_(o.keys())),s=i.next();!s.done;s=i.next()){var l=s.value;if(l!==K&&e[a]===l[0]){for(var u=Math.min(n-a,l.length),d=1;d<u&&e[a+d]===l[d];)++d;var h=o.get(l);if(d===l.length)o=h;else{var v=new Map;v.set(l.slice(d),h),o.set(e.slice(a,a+d),v),o.delete(l),o=v}a+=d;continue e}}}catch(b){t={error:b}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}var p=new Map;return o.set(e.slice(a),p),p}return o},Wr=function(o,e){var t=j(ke(o,e),2),r=t[0],n=t[1];if(r!==void 0){if(r.delete(K),r.size===0)kt(n);else if(r.size===1){var a=j(r.entries().next().value,2),i=a[0],s=a[1];It(n,i,s)}}},kt=function(o){if(o.length!==0){var e=j(Ue(o),2),t=e[0],r=e[1];if(t.delete(r),t.size===0)kt(o.slice(0,-1));else if(t.size===1){var n=j(t.entries().next().value,2),a=n[0],i=n[1];a!==K&&It(o.slice(0,-1),a,i)}}},It=function(o,e,t){if(o.length!==0){var r=j(Ue(o),2),n=r[0],a=r[1];n.set(a+e,t),n.delete(a)}},Ue=function(o){return o[o.length-1]},me,He="or",_t="and",Kr="and_not",Jr=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?Be:e.autoVacuum;this._options=V(V(V({},ze),e),{autoVacuum:t,searchOptions:V(V({},vt),e.searchOptions||{}),autoSuggestOptions:V(V({},Qr),e.autoSuggestOptions||{})}),this._index=new Me,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=Je,this.addFields(this._options.fields)}return o.prototype.add=function(e){var t,r,n,a,i,s,l=this._options,u=l.extractField,d=l.tokenize,h=l.processTerm,v=l.fields,p=l.idField,b=u(e,p);if(b==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));if(this._idToShortId.has(b))throw new Error("MiniSearch: duplicate ID ".concat(b));var g=this.addDocumentId(b);this.saveStoredFields(g,e);try{for(var w=_(v),C=w.next();!C.done;C=w.next()){var T=C.value,E=u(e,T);if(E!=null){var M=d(E.toString(),T),R=this._fieldIds[T],L=new Set(M).size;this.addFieldLength(g,R,this._documentCount-1,L);try{for(var S=(n=void 0,_(M)),k=S.next();!k.done;k=S.next()){var D=k.value,F=h(D,T);if(Array.isArray(F))try{for(var f=(i=void 0,_(F)),c=f.next();!c.done;c=f.next()){var y=c.value;this.addTerm(R,g,y)}}catch(x){i={error:x}}finally{try{c&&!c.done&&(s=f.return)&&s.call(f)}finally{if(i)throw i.error}}else F&&this.addTerm(R,g,F)}}catch(x){n={error:x}}finally{try{k&&!k.done&&(a=S.return)&&a.call(S)}finally{if(n)throw n.error}}}}}catch(x){t={error:x}}finally{try{C&&!C.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}},o.prototype.addAll=function(e){var t,r;try{for(var n=_(e),a=n.next();!a.done;a=n.next()){var i=a.value;this.add(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},o.prototype.addAllAsync=function(e,t){var r=this;t===void 0&&(t={});var n=t.chunkSize,a=n===void 0?10:n,i={chunk:[],promise:Promise.resolve()},s=e.reduce(function(d,h,v){var p=d.chunk,b=d.promise;return p.push(h),(v+1)%a===0?{chunk:[],promise:b.then(function(){return new Promise(function(g){return setTimeout(g,0)})}).then(function(){return r.addAll(p)})}:{chunk:p,promise:b}},i),l=s.chunk,u=s.promise;return u.then(function(){return r.addAll(l)})},o.prototype.remove=function(e){var t,r,n,a,i,s,l=this._options,u=l.tokenize,d=l.processTerm,h=l.extractField,v=l.fields,p=l.idField,b=h(e,p);if(b==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));var g=this._idToShortId.get(b);if(g==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(b,": it is not in the index"));try{for(var w=_(v),C=w.next();!C.done;C=w.next()){var T=C.value,E=h(e,T);if(E!=null){var M=u(E.toString(),T),R=this._fieldIds[T],L=new Set(M).size;this.removeFieldLength(g,R,this._documentCount,L);try{for(var S=(n=void 0,_(M)),k=S.next();!k.done;k=S.next()){var D=k.value,F=d(D,T);if(Array.isArray(F))try{for(var f=(i=void 0,_(F)),c=f.next();!c.done;c=f.next()){var y=c.value;this.removeTerm(R,g,y)}}catch(x){i={error:x}}finally{try{c&&!c.done&&(s=f.return)&&s.call(f)}finally{if(i)throw i.error}}else F&&this.removeTerm(R,g,F)}}catch(x){n={error:x}}finally{try{k&&!k.done&&(a=S.return)&&a.call(S)}finally{if(n)throw n.error}}}}}catch(x){t={error:x}}finally{try{C&&!C.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}this._storedFields.delete(g),this._documentIds.delete(g),this._idToShortId.delete(b),this._fieldLength.delete(g),this._documentCount-=1},o.prototype.removeAll=function(e){var t,r;if(e)try{for(var n=_(e),a=n.next();!a.done;a=n.next()){var i=a.value;this.remove(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}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 Me,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(n,a){t.removeFieldLength(r,a,t._documentCount,n)}),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,n=e.batchSize,a=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:a},{minDirtCount:r,minDirtFactor:t})}},o.prototype.discardAll=function(e){var t,r,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=_(e),i=a.next();!i.done;i=a.next()){var s=i.value;this.discard(s)}}catch(l){t={error:l}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},o.prototype.replace=function(e){var t=this._options,r=t.idField,n=t.extractField,a=n(e,r);this.discard(a),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 n=r._enqueuedVacuumConditions;return r._enqueuedVacuumConditions=Je,r.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},o.prototype.performVacuuming=function(e,t){return Br(this,void 0,void 0,function(){var r,n,a,i,s,l,u,d,h,v,p,b,g,w,C,T,E,M,R,L,S,k,D,F,f;return Vr(this,function(c){switch(c.label){case 0:if(r=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||Ke.batchSize,a=e.batchWait||Ke.batchWait,i=1,c.label=1;case 1:c.trys.push([1,7,8,9]),s=_(this._index),l=s.next(),c.label=2;case 2:if(l.done)return[3,6];u=j(l.value,2),d=u[0],h=u[1];try{for(v=(k=void 0,_(h)),p=v.next();!p.done;p=v.next()){b=j(p.value,2),g=b[0],w=b[1];try{for(C=(F=void 0,_(w)),T=C.next();!T.done;T=C.next())E=j(T.value,1),M=E[0],!this._documentIds.has(M)&&(w.size<=1?h.delete(g):w.delete(M))}catch(y){F={error:y}}finally{try{T&&!T.done&&(f=C.return)&&f.call(C)}finally{if(F)throw F.error}}}}catch(y){k={error:y}}finally{try{p&&!p.done&&(D=v.return)&&D.call(v)}finally{if(k)throw k.error}}return this._index.get(d).size===0&&this._index.delete(d),i%n!==0?[3,4]:[4,new Promise(function(y){return setTimeout(y,a)})];case 3:c.sent(),c.label=4;case 4:i+=1,c.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return R=c.sent(),L={error:R},[3,9];case 8:try{l&&!l.done&&(S=s.return)&&S.call(s)}finally{if(L)throw L.error}return[7];case 9:this._dirtCount-=r,c.label=10;case 10:return[4,null];case 11:return c.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||Be.minDirtCount,r=r||Be.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,n;t===void 0&&(t={});var a=this.executeQuery(e,t),i=[];try{for(var s=_(a),l=s.next();!l.done;l=s.next()){var u=j(l.value,2),d=u[0],h=u[1],v=h.score,p=h.terms,b=h.match,g=p.length,w={id:this._documentIds.get(d),score:v*g,terms:Object.keys(b),match:b};Object.assign(w,this._storedFields.get(d)),(t.filter==null||t.filter(w))&&i.push(w)}}catch(C){r={error:C}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i.sort(yt),i},o.prototype.autoSuggest=function(e,t){var r,n,a,i;t===void 0&&(t={}),t=V(V({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=_(this.search(e,t)),u=l.next();!u.done;u=l.next()){var d=u.value,h=d.score,v=d.terms,p=v.join(" "),b=s.get(p);b!=null?(b.score+=h,b.count+=1):s.set(p,{score:h,terms:v,count:1})}}catch(R){r={error:R}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}var g=[];try{for(var w=_(s),C=w.next();!C.done;C=w.next()){var T=j(C.value,2),b=T[0],E=T[1],h=E.score,v=E.terms,M=E.count;g.push({suggestion:b,terms:v,score:h/M})}}catch(R){a={error:R}}finally{try{C&&!C.done&&(i=w.return)&&i.call(w)}finally{if(a)throw a.error}}return g.sort(yt),g},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(ze.hasOwnProperty(e))return Le(ze,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},o.loadJS=function(e,t){var r,n,a,i,s,l,u=e.index,d=e.documentCount,h=e.nextId,v=e.documentIds,p=e.fieldIds,b=e.fieldLength,g=e.averageFieldLength,w=e.storedFields,C=e.dirtCount,T=e.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var E=new o(t);E._documentCount=d,E._nextId=h,E._documentIds=Ee(v),E._idToShortId=new Map,E._fieldIds=p,E._fieldLength=Ee(b),E._avgFieldLength=g,E._storedFields=Ee(w),E._dirtCount=C||0,E._index=new Me;try{for(var M=_(E._documentIds),R=M.next();!R.done;R=M.next()){var L=j(R.value,2),S=L[0],k=L[1];E._idToShortId.set(k,S)}}catch(m){r={error:m}}finally{try{R&&!R.done&&(n=M.return)&&n.call(M)}finally{if(r)throw r.error}}try{for(var D=_(u),F=D.next();!F.done;F=D.next()){var f=j(F.value,2),c=f[0],y=f[1],x=new Map;try{for(var I=(s=void 0,_(Object.keys(y))),O=I.next();!O.done;O=I.next()){var P=O.value,z=y[P];T===1&&(z=z.ds),x.set(parseInt(P,10),Ee(z))}}catch(m){s={error:m}}finally{try{O&&!O.done&&(l=I.return)&&l.call(I)}finally{if(s)throw s.error}}E._index.set(c,x)}}catch(m){a={error:m}}finally{try{F&&!F.done&&(i=D.return)&&i.call(D)}finally{if(a)throw a.error}}return E},o.prototype.executeQuery=function(e,t){var r=this;if(t===void 0&&(t={}),typeof e!="string"){var n=V(V(V({},t),e),{queries:void 0}),a=e.queries.map(function(w){return r.executeQuery(w,n)});return this.combineResults(a,n.combineWith)}var i=this._options,s=i.tokenize,l=i.processTerm,u=i.searchOptions,d=V(V({tokenize:s,processTerm:l},u),t),h=d.tokenize,v=d.processTerm,p=h(e).flatMap(function(w){return v(w)}).filter(function(w){return!!w}),b=p.map(qr(d)),g=b.map(function(w){return r.executeQuerySpec(w,d)});return this.combineResults(g,d.combineWith)},o.prototype.executeQuerySpec=function(e,t){var r,n,a,i,s=V(V({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(P,z){var m;return V(V({},P),(m={},m[z]=Le(s.boost,z)||1,m))},{}),u=s.boostDocument,d=s.weights,h=s.maxFuzzy,v=s.bm25,p=V(V({},vt.weights),d),b=p.fuzzy,g=p.prefix,w=this._index.get(e.term),C=this.termResults(e.term,e.term,1,w,l,u,v),T,E;if(e.prefix&&(T=this._index.atPrefix(e.term)),e.fuzzy){var M=e.fuzzy===!0?.2:e.fuzzy,R=M<1?Math.min(h,Math.round(e.term.length*M)):M;R&&(E=this._index.fuzzyGet(e.term,R))}if(T)try{for(var L=_(T),S=L.next();!S.done;S=L.next()){var k=j(S.value,2),D=k[0],F=k[1],f=D.length-e.term.length;if(f){E==null||E.delete(D);var c=g*D.length/(D.length+.3*f);this.termResults(e.term,D,c,F,l,u,v,C)}}}catch(P){r={error:P}}finally{try{S&&!S.done&&(n=L.return)&&n.call(L)}finally{if(r)throw r.error}}if(E)try{for(var y=_(E.keys()),x=y.next();!x.done;x=y.next()){var D=x.value,I=j(E.get(D),2),O=I[0],f=I[1];if(f){var c=b*D.length/(D.length+f);this.termResults(e.term,D,c,O,l,u,v,C)}}}catch(P){a={error:P}}finally{try{x&&!x.done&&(i=y.return)&&i.call(y)}finally{if(a)throw a.error}}return C},o.prototype.combineResults=function(e,t){if(t===void 0&&(t=He),e.length===0)return new Map;var r=t.toLowerCase();return e.reduce(Ur[r])||new Map},o.prototype.toJSON=function(){var e,t,r,n,a=[];try{for(var i=_(this._index),s=i.next();!s.done;s=i.next()){var l=j(s.value,2),u=l[0],d=l[1],h={};try{for(var v=(r=void 0,_(d)),p=v.next();!p.done;p=v.next()){var b=j(p.value,2),g=b[0],w=b[1];h[g]=Object.fromEntries(w)}}catch(C){r={error:C}}finally{try{p&&!p.done&&(n=v.return)&&n.call(v)}finally{if(r)throw r.error}}a.push([u,h])}}catch(C){e={error:C}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}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:a,serializationVersion:2}},o.prototype.termResults=function(e,t,r,n,a,i,s,l){var u,d,h,v,p;if(l===void 0&&(l=new Map),n==null)return l;try{for(var b=_(Object.keys(a)),g=b.next();!g.done;g=b.next()){var w=g.value,C=a[w],T=this._fieldIds[w],E=n.get(T);if(E!=null){var M=E.size,R=this._avgFieldLength[T];try{for(var L=(h=void 0,_(E.keys())),S=L.next();!S.done;S=L.next()){var k=S.value;if(!this._documentIds.has(k)){this.removeTerm(T,k,t),M-=1;continue}var D=i?i(this._documentIds.get(k),t,this._storedFields.get(k)):1;if(D){var F=E.get(k),f=this._fieldLength.get(k)[T],c=Gr(F,M,this._documentCount,f,R,s),y=r*C*D*c,x=l.get(k);if(x){x.score+=y,Yr(x.terms,e);var I=Le(x.match,t);I?I.push(w):x.match[t]=[w]}else l.set(k,{score:y,terms:[e],match:(p={},p[t]=[w],p)})}}}catch(O){h={error:O}}finally{try{S&&!S.done&&(v=L.return)&&v.call(L)}finally{if(h)throw h.error}}}}}catch(O){u={error:O}}finally{try{g&&!g.done&&(d=b.return)&&d.call(b)}finally{if(u)throw u.error}}return l},o.prototype.addTerm=function(e,t,r){var n=this._index.fetch(r,mt),a=n.get(e);if(a==null)a=new Map,a.set(t,1),n.set(e,a);else{var i=a.get(t);a.set(t,(i||0)+1)}},o.prototype.removeTerm=function(e,t,r){if(!this._index.has(r)){this.warnDocumentChanged(t,e,r);return}var n=this._index.fetch(r,mt),a=n.get(e);a==null||a.get(t)==null?this.warnDocumentChanged(t,e,r):a.get(t)<=1?a.size<=1?n.delete(e):a.delete(t):a.set(t,a.get(t)-1),this._index.get(r).size===0&&this._index.delete(r)},o.prototype.warnDocumentChanged=function(e,t,r){var n,a;try{for(var i=_(Object.keys(this._fieldIds)),s=i.next();!s.done;s=i.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){n={error:u}}finally{try{s&&!s.done&&(a=i.return)&&a.call(i)}finally{if(n)throw n.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,n){var a=this._fieldLength.get(e);a==null&&this._fieldLength.set(e,a=[]),a[t]=n;var i=this._avgFieldLength[t]||0,s=i*r+n;this._avgFieldLength[t]=s/(r+1)},o.prototype.removeFieldLength=function(e,t,r,n){if(r===1){this._avgFieldLength[t]=0;return}var a=this._avgFieldLength[t]*r-n;this._avgFieldLength[t]=a/(r-1)},o.prototype.saveStoredFields=function(e,t){var r,n,a=this._options,i=a.storeFields,s=a.extractField;if(!(i==null||i.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var u=_(i),d=u.next();!d.done;d=u.next()){var h=d.value,v=s(t,h);v!==void 0&&(l[h]=v)}}catch(p){r={error:p}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}},o}(),Le=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)?o[e]:void 0},Ur=(me={},me[He]=function(o,e){var t,r;try{for(var n=_(e.keys()),a=n.next();!a.done;a=n.next()){var i=a.value,s=o.get(i);if(s==null)o.set(i,e.get(i));else{var l=e.get(i),u=l.score,d=l.terms,h=l.match;s.score=s.score+u,s.match=Object.assign(s.match,h),pt(s.terms,d)}}}catch(v){t={error:v}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return o},me[_t]=function(o,e){var t,r,n=new Map;try{for(var a=_(e.keys()),i=a.next();!i.done;i=a.next()){var s=i.value,l=o.get(s);if(l!=null){var u=e.get(s),d=u.score,h=u.terms,v=u.match;pt(l.terms,h),n.set(s,{score:l.score+d,terms:l.terms,match:Object.assign(l.match,v)})}}}catch(p){t={error:p}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return n},me[Kr]=function(o,e){var t,r;try{for(var n=_(e.keys()),a=n.next();!a.done;a=n.next()){var i=a.value;o.delete(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return o},me),Hr={k:1.2,b:.7,d:.5},Gr=function(o,e,t,r,n,a){var i=a.k,s=a.b,l=a.d,u=Math.log(1+(t-e+.5)/(e+.5));return u*(l+o*(i+1)/(o+i*(1-s+s*r/n)))},qr=function(o){return function(e,t,r){var n=typeof o.fuzzy=="function"?o.fuzzy(e,t,r):o.fuzzy||!1,a=typeof o.prefix=="function"?o.prefix(e,t,r):o.prefix===!0;return{term:e,fuzzy:n,prefix:a}}},ze={idField:"id",extractField:function(o,e){return o[e]},tokenize:function(o,e){return o.split(Zr)},processTerm:function(o,e){return o.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(o,e,t){return console!=null&&console.warn!=null&&console[o](e)},autoVacuum:!0},vt={combineWith:He,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:Hr},Qr={combineWith:_t,prefix:function(o,e,t){return e===t.length-1}},Ke={batchSize:1e3,batchWait:10},Je={minDirtFactor:.1,minDirtCount:20},Be=V(V({},Ke),Je),Yr=function(o,e){o.includes(e)||o.push(e)},pt=function(o,e){var t,r;try{for(var n=_(e),a=n.next();!a.done;a=n.next()){var i=a.value;o.includes(i)||o.push(i)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},yt=function(o,e){var t=o.score,r=e.score;return r-t},mt=function(){return new Map},Ee=function(o){var e,t,r=new Map;try{for(var n=_(Object.keys(o)),a=n.next();!a.done;a=n.next()){var i=a.value;r.set(parseInt(i,10),o[i])}}catch(s){e={error:s}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},Zr=/[\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 Q=o=>(jt("data-v-58c4b8ff"),o=o(),Wt(),o),Xr=["aria-owns"],ea={class:"shell"},ta=["title"],ra=Q(()=>A("svg",{class:"search-icon",width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[A("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[A("circle",{cx:"11",cy:"11",r:"8"}),A("path",{d:"m21 21l-4.35-4.35"})])],-1)),aa=[ra],na={class:"search-actions before"},ia=["title"],oa=Q(()=>A("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[A("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 12H5m7 7l-7-7l7-7"})],-1)),sa=[oa],la=["placeholder"],ua={class:"search-actions"},ca=["title"],fa=Q(()=>A("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[A("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)),da=[fa],ha=["disabled","title"],va=Q(()=>A("svg",{width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"},[A("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)),pa=[va],ya=["id","role","aria-labelledby"],ma=["aria-selected"],ga=["href","aria-label","onMouseenter","onFocusin"],ba={class:"titles"},wa=Q(()=>A("span",{class:"title-icon"},"#",-1)),xa=["innerHTML"],Fa=Q(()=>A("svg",{width:"18",height:"18",viewBox:"0 0 24 24"},[A("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"})],-1)),Ea={class:"title main"},Sa=["innerHTML"],Aa={key:0,class:"excerpt-wrapper"},Ca={key:0,class:"excerpt",inert:""},Na=["innerHTML"],Ta=Q(()=>A("div",{class:"excerpt-gradient-bottom"},null,-1)),ka=Q(()=>A("div",{class:"excerpt-gradient-top"},null,-1)),Ia={key:0,class:"no-results"},_a={class:"search-keyboard-shortcuts"},Da=["aria-label"],Oa=Q(()=>A("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[A("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 19V5m-7 7l7-7l7 7"})],-1)),Ra=[Oa],Ma=["aria-label"],Pa=Q(()=>A("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[A("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 5v14m7-7l-7 7l-7-7"})],-1)),La=[Pa],za=["aria-label"],Ba=Q(()=>A("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[A("g",{fill:"none",stroke:"currentcolor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[A("path",{d:"m9 10l-5 5l5 5"}),A("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"})])],-1)),Va=[Ba],$a=["aria-label"],ja=Dt({__name:"VPLocalSearchBox",props:{placeholder:{}},emits:["close"],setup(o,{emit:e}){var O,P,z;const t=de(),r=de(),n=de(),a=de(ar),i=Qt(),{activate:s}=Pr(t,{immediate:!0,allowOutsideClick:!0,clickOutsideDeactivates:!0,escapeDeactivates:!0}),{localeIndex:l,theme:u}=i,d=ot(async()=>{var m,N,$,J,H,G,B,U,Y;return it(Jr.loadJSON(($=await((N=(m=a.value)[l.value])==null?void 0:N.call(m)))==null?void 0:$.default,{fields:["title","titles","text"],storeFields:["title","titles"],searchOptions:{fuzzy:.2,prefix:!0,boost:{title:4,text:2,titles:1},...((J=u.value.search)==null?void 0:J.provider)==="local"&&((G=(H=u.value.search.options)==null?void 0:H.miniSearch)==null?void 0:G.searchOptions)},...((B=u.value.search)==null?void 0:B.provider)==="local"&&((Y=(U=u.value.search.options)==null?void 0:U.miniSearch)==null?void 0:Y.options)}))}),v=_e(()=>{var m,N;return((m=u.value.search)==null?void 0:m.provider)==="local"&&((N=u.value.search.options)==null?void 0:N.disableQueryPersistence)===!0}).value?ie(""):Yt("vitepress:local-search-filter",""),p=Zt("vitepress:local-search-detailed-list",((O=u.value.search)==null?void 0:O.provider)==="local"&&((P=u.value.search.options)==null?void 0:P.detailedView)===!0),b=_e(()=>{var m,N,$;return((m=u.value.search)==null?void 0:m.provider)==="local"&&(((N=u.value.search.options)==null?void 0:N.disableDetailedView)===!0||(($=u.value.search.options)==null?void 0:$.detailedView)===!1)});Ot(()=>{b.value&&(p.value=!1)});const g=de([]),w=ie(!1);$e(v,()=>{w.value=!1});const C=ot(async()=>{if(r.value)return it(new zr(r.value))},null);Xt(()=>[d.value,v.value,p.value],async([m,N,$],J,H)=>{var Ge,qe,Qe,Ye;let G=!1;if(H(()=>{G=!0}),!m)return;g.value=m.search(N).slice(0,16),w.value=!0;const B=$?await Promise.all(g.value.map(q=>T(q.id))):[];if(G)return;const U=new Map;for(const{id:q,mod:re}of B){const ae=q.slice(0,q.indexOf("#"));let ee=U.get(ae);if(ee)continue;ee=new Map,U.set(ae,ee);const Z=re.default??re;if(Z!=null&&Z.render||Z!=null&&Z.setup){const ne=Kt(Z);ne.config.warnHandler=()=>{},ne.provide(Jt,i),Object.defineProperties(ne.config.globalProperties,{$frontmatter:{get(){return i.frontmatter.value}},$params:{get(){return i.page.value.params}}});const Ze=document.createElement("div");ne.mount(Ze),Ze.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(fe=>{var tt;const be=(tt=fe.querySelector("a"))==null?void 0:tt.getAttribute("href"),Xe=(be==null?void 0:be.startsWith("#"))&&be.slice(1);if(!Xe)return;let et="";for(;(fe=fe.nextElementSibling)&&!/^h[1-6]$/i.test(fe.tagName);)et+=fe.outerHTML;ee.set(Xe,et)}),ne.unmount()}if(G)return}const Y=new Set;if(g.value=g.value.map(q=>{const[re,ae]=q.id.split("#"),ee=U.get(re),Z=(ee==null?void 0:ee.get(ae))??"";for(const ne in q.match)Y.add(ne);return{...q,text:Z}}),await he(),G)return;await new Promise(q=>{var re;(re=C.value)==null||re.unmark({done:()=>{var ae;(ae=C.value)==null||ae.markRegExp(I(Y),{done:q})}})});const Ie=((Ge=t.value)==null?void 0:Ge.querySelectorAll(".result .excerpt"))??[];for(const q of Ie)(qe=q.querySelector('mark[data-markjs="true"]'))==null||qe.scrollIntoView({block:"center"});(Ye=(Qe=r.value)==null?void 0:Qe.firstElementChild)==null||Ye.scrollIntoView({block:"start"})},{debounce:200,immediate:!0});async function T(m){const N=Ut(m.slice(0,m.indexOf("#")));try{if(!N)throw new Error(`Cannot find file for id: ${m}`);return{id:m,mod:await Ve(()=>import(N),[])}}catch($){return console.error($),{id:m,mod:{}}}}const E=ie(),M=_e(()=>{var m;return((m=v.value)==null?void 0:m.length)<=0});function R(m=!0){var N,$;(N=E.value)==null||N.focus(),m&&(($=E.value)==null||$.select())}De(()=>{R()});function L(m){m.pointerType==="mouse"&&R()}const S=ie(-1),k=ie(!1);$e(g,m=>{S.value=m.length?0:-1,D()});function D(){he(()=>{const m=document.querySelector(".result.selected");m&&m.scrollIntoView({block:"nearest"})})}xe("ArrowUp",m=>{m.preventDefault(),S.value--,S.value<0&&(S.value=g.value.length-1),k.value=!0,D()}),xe("ArrowDown",m=>{m.preventDefault(),S.value++,S.value>=g.value.length&&(S.value=0),k.value=!0,D()});const F=Rt();xe("Enter",()=>{const m=g.value[S.value];m&&(F.go(m.id),e("close"))}),xe("Escape",()=>{e("close")});const f={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=er((z=u.value.search)==null?void 0:z.options,f);De(()=>{window.history.pushState(null,"",null)}),tr("popstate",m=>{m.preventDefault(),e("close")});const y=rr(n);De(()=>{n.value=document.body,he(()=>{y.value=!0,he().then(()=>s())})}),Mt(()=>{y.value=!1});function x(){v.value="",he().then(()=>R(!1))}function I(m){return new RegExp([...m].sort((N,$)=>$.length-N.length).map(N=>`(${N.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")})`).join("|"),"gi")}return(m,N)=>{var $,J,H,G;return X(),Pt($t,{to:"body"},[A("div",{ref_key:"el",ref:t,role:"button","aria-owns":($=g.value)!=null&&$.length?"localsearch-list":void 0,"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"localsearch-label",class:"VPLocalSearchBox"},[A("div",{class:"backdrop",onClick:N[0]||(N[0]=B=>m.$emit("close"))}),A("div",ea,[A("form",{class:"search-bar",onPointerup:N[4]||(N[4]=B=>L(B)),onSubmit:N[5]||(N[5]=Lt(()=>{},["prevent"]))},[A("label",{title:m.placeholder,id:"localsearch-label",for:"localsearch-input"},aa,8,ta),A("div",na,[A("button",{class:"back-button",title:W(c)("modal.backButtonTitle"),onClick:N[1]||(N[1]=B=>m.$emit("close"))},sa,8,ia)]),zt(A("input",{ref_key:"searchInput",ref:E,"onUpdate:modelValue":N[2]||(N[2]=B=>Vt(v)?v.value=B:null),placeholder:m.placeholder,id:"localsearch-input","aria-labelledby":"localsearch-label",class:"search-input"},null,8,la),[[Bt,W(v)]]),A("div",ua,[b.value?we("",!0):(X(),te("button",{key:0,class:rt(["toggle-layout-button",{"detailed-list":W(p)}]),title:W(c)("modal.displayDetails"),onClick:N[3]||(N[3]=B=>S.value>-1&&(p.value=!W(p)))},da,10,ca)),A("button",{class:"clear-button",type:"reset",disabled:M.value,title:W(c)("modal.resetButtonTitle"),onClick:x},pa,8,ha)])],32),A("ul",{ref_key:"resultsEl",ref:r,id:(J=g.value)!=null&&J.length?"localsearch-list":void 0,role:(H=g.value)!=null&&H.length?"listbox":void 0,"aria-labelledby":(G=g.value)!=null&&G.length?"localsearch-label":void 0,class:"results",onMousemove:N[7]||(N[7]=B=>k.value=!1)},[(X(!0),te(nt,null,at(g.value,(B,U)=>(X(),te("li",{key:B.id,role:"option","aria-selected":S.value===U?"true":"false"},[A("a",{href:B.id,class:rt(["result",{selected:S.value===U}]),"aria-label":[...B.titles,B.title].join(" > "),onMouseenter:Y=>!k.value&&(S.value=U),onFocusin:Y=>S.value=U,onClick:N[6]||(N[6]=Y=>m.$emit("close"))},[A("div",null,[A("div",ba,[wa,(X(!0),te(nt,null,at(B.titles,(Y,Ie)=>(X(),te("span",{key:Ie,class:"title"},[A("span",{class:"text",innerHTML:Y},null,8,xa),Fa]))),128)),A("span",Ea,[A("span",{class:"text",innerHTML:B.title},null,8,Sa)])]),W(p)?(X(),te("div",Aa,[B.text?(X(),te("div",Ca,[A("div",{class:"vp-doc",innerHTML:B.text},null,8,Na)])):we("",!0),Ta,ka])):we("",!0)])],42,ga)],8,ma))),128)),W(v)&&!g.value.length&&w.value?(X(),te("li",Ia,[ve(pe(W(c)("modal.noResultsText"))+' "',1),A("strong",null,pe(W(v)),1),ve('" ')])):we("",!0)],40,ya),A("div",_a,[A("span",null,[A("kbd",{"aria-label":W(c)("modal.footer.navigateUpKeyAriaLabel")},Ra,8,Da),A("kbd",{"aria-label":W(c)("modal.footer.navigateDownKeyAriaLabel")},La,8,Ma),ve(" "+pe(W(c)("modal.footer.navigateText")),1)]),A("span",null,[A("kbd",{"aria-label":W(c)("modal.footer.selectKeyAriaLabel")},Va,8,za),ve(" "+pe(W(c)("modal.footer.selectText")),1)]),A("span",null,[A("kbd",{"aria-label":W(c)("modal.footer.closeKeyAriaLabel")},"esc",8,$a),ve(" "+pe(W(c)("modal.footer.closeText")),1)])])])],8,Xr)])}}});const Ha=Ht(ja,[["__scopeId","data-v-58c4b8ff"]]);export{Ha as default};
|