Files
build_notes_simengweb/assets/SearchBox-BpAhG_qa.js
2026-03-29 16:10:06 +08:00

10 lines
62 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{y as Me,q as me,P as bt,Q as Be,R as yt,S as wt,T as St,U as ue,_ as xe,o as G,c as H,b as _,f as _t,V as xt,W as kt,X as Et,Y as Tt,Z as We,$ as Je,g as ie,a0 as It,a1 as Nt,h as Te,H as se,a2 as fe,a3 as Ft,x as Ot,a4 as Ct,L as Rt,k as At,a5 as Mt,e as Ie,p as z,z as Lt,B as Dt,C as Pt,m as Ke,n as zt,a6 as jt,F as Ge,d as ae,t as oe,l as Vt,a7 as $t,a8 as Bt}from"./app-t8Vldhgr.js";/*!
* tabbable 6.4.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/var it=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],ge=it.join(","),st=typeof Element>"u",X=st?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,be=!st&&Element.prototype.getRootNode?function(a){var e;return a==null||(e=a.getRootNode)===null||e===void 0?void 0:e.call(a)}:function(a){return a?.ownerDocument},ye=function(e,t){var n;t===void 0&&(t=!0);var r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"inert"),s=r===""||r==="true",i=s||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ye(e.parentNode));return i},Wt=function(e){var t,n=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return n===""||n==="true"},at=function(e,t,n){if(ye(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ge));return t&&X.call(e,ge)&&r.unshift(e),r=r.filter(n),r},we=function(e,t,n){for(var r=[],s=Array.from(e);s.length;){var i=s.shift();if(!ye(i,!1))if(i.tagName==="SLOT"){var o=i.assignedElements(),l=o.length?o:i.children,u=we(l,!0,n);n.flatten?r.push.apply(r,u):r.push({scopeParent:i,candidates:u})}else{var h=X.call(i,ge);h&&n.filter(i)&&(t||!e.includes(i))&&r.push(i);var p=i.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(i),v=!ye(p,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(p&&v){var b=we(p===!0?i.children:p.children,!0,n);n.flatten?r.push.apply(r,b):r.push({scopeParent:i,candidates:b})}else s.unshift.apply(s,i.children)}}return r},ot=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Z=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Wt(e))&&!ot(e)?0:e.tabIndex},Jt=function(e,t){var n=Z(e);return n<0&&t&&!ot(e)?0:n},Kt=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},lt=function(e){return e.tagName==="INPUT"},Gt=function(e){return lt(e)&&e.type==="hidden"},Ut=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return t},qt=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},Ht=function(e){if(!e.name)return!0;var t=e.form||be(e),n=function(o){return t.querySelectorAll('input[type="radio"][name="'+o+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=n(window.CSS.escape(e.name));else try{r=n(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 s=qt(r,e.form);return!s||s===e},Qt=function(e){return lt(e)&&e.type==="radio"},Yt=function(e){return Qt(e)&&!Ht(e)},Zt=function(e){var t,n=e&&be(e),r=(t=n)===null||t===void 0?void 0:t.host,s=!1;if(n&&n!==e){var i,o,l;for(s=!!((i=r)!==null&&i!==void 0&&(o=i.ownerDocument)!==null&&o!==void 0&&o.contains(r)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&r;){var u,h,p;n=be(r),r=(u=n)===null||u===void 0?void 0:u.host,s=!!((h=r)!==null&&h!==void 0&&(p=h.ownerDocument)!==null&&p!==void 0&&p.contains(r))}}return s},Ue=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return n===0&&r===0},Xt=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if(n==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var i=X.call(e,"details>summary:first-of-type"),o=i?e.parentElement:e;if(X.call(o,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="full-native"||n==="legacy-full"){if(typeof r=="function"){for(var l=e;e;){var u=e.parentElement,h=be(e);if(u&&!u.shadowRoot&&r(u)===!0)return Ue(e);e.assignedSlot?e=e.assignedSlot:!u&&h!==e.ownerDocument?e=h.host:e=u}e=l}if(Zt(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Ue(e);return!1},en=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if(r.tagName==="LEGEND")return X.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},Se=function(e,t){return!(t.disabled||Gt(t)||Xt(t,e)||Ut(t)||en(t))},Le=function(e,t){return!(Yt(t)||Z(t)<0||!Se(e,t))},tn=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ct=function(e){var t=[],n=[];return e.forEach(function(r,s){var i=!!r.scopeParent,o=i?r.scopeParent:r,l=Jt(o,i),u=i?ct(r.candidates):o;l===0?i?t.push.apply(t,u):t.push(o):n.push({documentOrder:s,tabIndex:l,item:r,isScope:i,content:u})}),n.sort(Kt).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(t)},nn=function(e,t){t=t||{};var n;return t.getShadowRoot?n=we([e],t.includeContainer,{filter:Le.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:tn}):n=at(e,t.includeContainer,Le.bind(null,t)),ct(n)},rn=function(e,t){t=t||{};var n;return t.getShadowRoot?n=we([e],t.includeContainer,{filter:Se.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):n=at(e,t.includeContainer,Se.bind(null,t)),n},ee=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return X.call(e,ge)===!1?!1:Le(t,e)},sn=it.concat("iframe:not([inert]):not([inert] *)").join(","),Ne=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return X.call(e,sn)===!1?!1:Se(t,e)};/*!
* focus-trap 8.0.1
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/function De(a,e){(e==null||e>a.length)&&(e=a.length);for(var t=0,n=Array(e);t<e;t++)n[t]=a[t];return n}function an(a){if(Array.isArray(a))return De(a)}function qe(a,e,t,n,r,s,i){try{var o=a[s](i),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(n,r)}function He(a){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=a.apply(e,t);function i(l){qe(s,n,r,i,o,"next",l)}function o(l){qe(s,n,r,i,o,"throw",l)}i(void 0)})}}function Qe(a,e){var t=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(!t){if(Array.isArray(a)||(t=ut(a))||e){t&&(a=t);var n=0,r=function(){};return{s:r,n:function(){return n>=a.length?{done:!0}:{done:!1,value:a[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,i=!0,o=!1;return{s:function(){t=t.call(a)},n:function(){var l=t.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{i||t.return==null||t.return()}finally{if(o)throw s}}}}function on(a,e,t){return(e=fn(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function ln(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function cn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ye(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(a,r).enumerable})),t.push.apply(t,n)}return t}function Ze(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ye(Object(t),!0).forEach(function(n){on(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):Ye(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function ce(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var a,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(b,g,E,x){var O=g&&g.prototype instanceof o?g:o,C=Object.create(O.prototype);return j(C,"_invoke",(function(J,V,B){var N,F,A,W=0,Y=B||[],$=!1,M={p:0,n:0,v:a,a:T,f:T.bind(a,4),d:function(d,c){return N=d,F=0,A=a,M.n=c,i}};function T(d,c){for(F=d,A=c,e=0;!$&&W&&!f&&e<Y.length;e++){var f,m=Y[e],y=M.p,S=m[2];d>3?(f=S===c)&&(A=m[(F=m[4])?5:(F=3,3)],m[4]=m[5]=a):m[0]<=y&&((f=d<2&&y<m[1])?(F=0,M.v=c,M.n=m[1]):y<S&&(f=d<3||m[0]>c||c>S)&&(m[4]=d,m[5]=c,M.n=S,F=0))}if(f||d>1)return i;throw $=!0,c}return function(d,c,f){if(W>1)throw TypeError("Generator is already running");for($&&c===1&&T(c,f),F=c,A=f;(e=F<2?a:A)||!$;){N||(F?F<3?(F>1&&(M.n=-1),T(F,A)):M.n=A:M.v=A);try{if(W=2,N){if(F||(d="next"),e=N[d]){if(!(e=e.call(N,A)))throw TypeError("iterator result is not an object");if(!e.done)return e;A=e.value,F<2&&(F=0)}else F===1&&(e=N.return)&&e.call(N),F<2&&(A=TypeError("The iterator does not provide a '"+d+"' method"),F=1);N=a}else if((e=($=M.n<0)?A:J.call(V,M))!==i)break}catch(m){N=a,F=1,A=m}finally{W=1}}return{value:e,done:$}}})(b,E,x),!0),C}var i={};function o(){}function l(){}function u(){}e=Object.getPrototypeOf;var h=[][n]?e(e([][n]())):(j(e={},n,function(){return this}),e),p=u.prototype=o.prototype=Object.create(h);function v(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,u):(b.__proto__=u,j(b,r,"GeneratorFunction")),b.prototype=Object.create(p),b}return l.prototype=u,j(p,"constructor",u),j(u,"constructor",l),l.displayName="GeneratorFunction",j(u,r,"GeneratorFunction"),j(p),j(p,r,"Generator"),j(p,n,function(){return this}),j(p,"toString",function(){return"[object Generator]"}),(ce=function(){return{w:s,m:v}})()}function j(a,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}j=function(s,i,o,l){function u(h,p){j(s,h,function(v){return this._invoke(h,p,v)})}i?r?r(s,i,{value:o,enumerable:!l,configurable:!l,writable:!l}):s[i]=o:(u("next",0),u("throw",1),u("return",2))},j(a,e,t,n)}function un(a){return an(a)||ln(a)||ut(a)||cn()}function dn(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var n=t.call(a,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function fn(a){var e=dn(a,"string");return typeof e=="symbol"?e:e+""}function ut(a,e){if(a){if(typeof a=="string")return De(a,e);var t={}.toString.call(a).slice(8,-1);return t==="Object"&&a.constructor&&(t=a.constructor.name),t==="Map"||t==="Set"?Array.from(a):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?De(a,e):void 0}}var U={getActiveTrap:function(e){return e?.length>0?e[e.length-1]:null},activateTrap:function(e,t){var n=U.getActiveTrap(e);t!==n&&U.pauseTrap(e);var r=e.indexOf(t);r===-1||e.splice(r,1),e.push(t)},deactivateTrap:function(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),U.unpauseTrap(e)},pauseTrap:function(e){var t=U.getActiveTrap(e);t?._setPausedState(!0)},unpauseTrap:function(e){var t=U.getActiveTrap(e);t&&!t._isManuallyPaused()&&t._setPausedState(!1)}},hn=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},pn=function(e){return e?.key==="Escape"||e?.key==="Esc"||e?.keyCode===27},de=function(e){return e?.key==="Tab"||e?.keyCode===9},vn=function(e){return de(e)&&!e.shiftKey},mn=function(e){return de(e)&&e.shiftKey},Xe=function(e){return setTimeout(e,0)},le=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return typeof e=="function"?e.apply(void 0,n):e},he=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},gn=[],bn=function(e,t){var n=t?.document||document,r=t?.trapStack||gn,s=Ze({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isolateSubtrees:!1,isKeyForward:vn,isKeyBackward:mn},t),i={containers:[],containerGroups:[],tabbableGroups:[],adjacentElements:new Set,alreadySilent:new Set,nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(d,c,f){return d&&d[c]!==void 0?d[c]:s[f||c]},u=function(d,c){var f=typeof c?.composedPath=="function"?c.composedPath():void 0;return i.containerGroups.findIndex(function(m){var y=m.container,S=m.tabbableNodes;return y.contains(d)||f?.includes(y)||S.find(function(w){return w===d})})},h=function(d){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=c.hasFallback,m=f===void 0?!1:f,y=c.params,S=y===void 0?[]:y,w=s[d];if(typeof w=="function"&&(w=w.apply(void 0,un(S))),w===!0&&(w=void 0),!w){if(w===void 0||w===!1)return w;throw new Error("`".concat(d,"` was specified but was not a node, or did not return a node"))}var k=w;if(typeof w=="string"){try{k=n.querySelector(w)}catch(I){throw new Error("`".concat(d,'` appears to be an invalid selector; error="').concat(I.message,'"'))}if(!k&&!m)throw new Error("`".concat(d,"` as selector refers to no known node"))}return k},p=function(){var d=h("initialFocus",{hasFallback:!0});if(d===!1)return!1;if(d===void 0||d&&!Ne(d,s.tabbableOptions))if(u(n.activeElement)>=0)d=n.activeElement;else{var c=i.tabbableGroups[0],f=c&&c.firstTabbableNode;d=f||h("fallbackFocus")}else d===null&&(d=h("fallbackFocus"));if(!d)throw new Error("Your focus-trap needs to have at least one focusable element");return d},v=function(){if(i.containerGroups=i.containers.map(function(d){var c=nn(d,s.tabbableOptions),f=rn(d,s.tabbableOptions),m=c.length>0?c[0]:void 0,y=c.length>0?c[c.length-1]:void 0,S=f.find(function(I){return ee(I)}),w=f.slice().reverse().find(function(I){return ee(I)}),k=!!c.find(function(I){return Z(I)>0});return{container:d,tabbableNodes:c,focusableNodes:f,posTabIndexesFound:k,firstTabbableNode:m,lastTabbableNode:y,firstDomTabbableNode:S,lastDomTabbableNode:w,nextTabbableNode:function(R){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,L=c.indexOf(R);return L<0?P?f.slice(f.indexOf(R)+1).find(function(K){return ee(K)}):f.slice(0,f.indexOf(R)).reverse().find(function(K){return ee(K)}):c[L+(P?1:-1)]}}}),i.tabbableGroups=i.containerGroups.filter(function(d){return d.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!h("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(d){return d.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.")},b=function(d){var c=d.activeElement;if(c)return c.shadowRoot&&c.shadowRoot.activeElement!==null?b(c.shadowRoot):c},g=function(d){if(d!==!1&&d!==b(document)){if(!d||!d.focus){g(p());return}d.focus({preventScroll:!!s.preventScroll}),i.mostRecentlyFocusedNode=d,hn(d)&&d.select()}},E=function(d){var c=h("setReturnFocus",{params:[d]});return c||(c===!1?!1:d)},x=function(d){var c=d.target,f=d.event,m=d.isBackward,y=m===void 0?!1:m;c=c||he(f),v();var S=null;if(i.tabbableGroups.length>0){var w=u(c,f),k=w>=0?i.containerGroups[w]:void 0;if(w<0)y?S=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:S=i.tabbableGroups[0].firstTabbableNode;else if(y){var I=i.tabbableGroups.findIndex(function(ke){var Ee=ke.firstTabbableNode;return c===Ee});if(I<0&&(k.container===c||Ne(c,s.tabbableOptions)&&!ee(c,s.tabbableOptions)&&!k.nextTabbableNode(c,!1))&&(I=w),I>=0){var R=I===0?i.tabbableGroups.length-1:I-1,P=i.tabbableGroups[R];S=Z(c)>=0?P.lastTabbableNode:P.lastDomTabbableNode}else de(f)||(S=k.nextTabbableNode(c,!1))}else{var L=i.tabbableGroups.findIndex(function(ke){var Ee=ke.lastTabbableNode;return c===Ee});if(L<0&&(k.container===c||Ne(c,s.tabbableOptions)&&!ee(c,s.tabbableOptions)&&!k.nextTabbableNode(c))&&(L=w),L>=0){var K=L===i.tabbableGroups.length-1?0:L+1,q=i.tabbableGroups[K];S=Z(c)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else de(f)||(S=k.nextTabbableNode(c))}}else S=h("fallbackFocus");return S},O=function(d){var c=he(d);if(!(u(c,d)>=0)){if(le(s.clickOutsideDeactivates,d)){o.deactivate({returnFocus:s.returnFocusOnDeactivate});return}le(s.allowOutsideClick,d)||d.preventDefault()}},C=function(d){var c=he(d),f=u(c,d)>=0;if(f||c instanceof Document)f&&(i.mostRecentlyFocusedNode=c);else{d.stopImmediatePropagation();var m,y=!0;if(i.mostRecentlyFocusedNode)if(Z(i.mostRecentlyFocusedNode)>0){var S=u(i.mostRecentlyFocusedNode),w=i.containerGroups[S].tabbableNodes;if(w.length>0){var k=w.findIndex(function(I){return I===i.mostRecentlyFocusedNode});k>=0&&(s.isKeyForward(i.recentNavEvent)?k+1<w.length&&(m=w[k+1],y=!1):k-1>=0&&(m=w[k-1],y=!1))}}else i.containerGroups.some(function(I){return I.tabbableNodes.some(function(R){return Z(R)>0})})||(y=!1);else y=!1;y&&(m=x({target:i.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(i.recentNavEvent)})),g(m||i.mostRecentlyFocusedNode||p())}i.recentNavEvent=void 0},J=function(d){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i.recentNavEvent=d;var f=x({event:d,isBackward:c});f&&(de(d)&&d.preventDefault(),g(f))},V=function(d){(s.isKeyForward(d)||s.isKeyBackward(d))&&J(d,s.isKeyBackward(d))},B=function(d){pn(d)&&le(s.escapeDeactivates,d)!==!1&&(d.preventDefault(),o.deactivate())},N=function(d){var c=he(d);u(c,d)>=0||le(s.clickOutsideDeactivates,d)||le(s.allowOutsideClick,d)||(d.preventDefault(),d.stopImmediatePropagation())},F=function(){if(!i.active)return Promise.resolve();U.activateTrap(r,o);var d;return s.delayInitialFocus?d=new Promise(function(c){i.delayInitialFocusTimer=Xe(function(){g(p()),c()})}):(d=Promise.resolve(),g(p())),n.addEventListener("focusin",C,!0),n.addEventListener("mousedown",O,{capture:!0,passive:!1}),n.addEventListener("touchstart",O,{capture:!0,passive:!1}),n.addEventListener("click",N,{capture:!0,passive:!1}),n.addEventListener("keydown",V,{capture:!0,passive:!1}),n.addEventListener("keydown",B),d},A=function(d){i.active&&!i.paused&&o._setSubtreeIsolation(!1),i.adjacentElements.clear(),i.alreadySilent.clear();var c=new Set,f=new Set,m=Qe(d),y;try{for(m.s();!(y=m.n()).done;){var S=y.value;c.add(S);for(var w=typeof ShadowRoot<"u"&&S.getRootNode()instanceof ShadowRoot,k=S;k;){c.add(k);var I=k.parentElement,R=[];I?R=I.children:!I&&w&&(R=k.getRootNode().children,I=k.getRootNode().host,w=typeof ShadowRoot<"u"&&I.getRootNode()instanceof ShadowRoot);var P=Qe(R),L;try{for(P.s();!(L=P.n()).done;){var K=L.value;f.add(K)}}catch(q){P.e(q)}finally{P.f()}k=I}}}catch(q){m.e(q)}finally{m.f()}c.forEach(function(q){f.delete(q)}),i.adjacentElements=f},W=function(){if(i.active)return n.removeEventListener("focusin",C,!0),n.removeEventListener("mousedown",O,!0),n.removeEventListener("touchstart",O,!0),n.removeEventListener("click",N,!0),n.removeEventListener("keydown",V,!0),n.removeEventListener("keydown",B),o},Y=function(d){var c=d.some(function(f){var m=Array.from(f.removedNodes);return m.some(function(y){return y===i.mostRecentlyFocusedNode})});c&&g(p())},$=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(Y):void 0,M=function(){$&&($.disconnect(),i.active&&!i.paused&&i.containers.map(function(d){$.observe(d,{subtree:!0,childList:!0})}))};return o={get active(){return i.active},get paused(){return i.paused},activate:function(d){if(i.active)return this;var c=l(d,"onActivate"),f=l(d,"onPostActivate"),m=l(d,"checkCanFocusTrap"),y=U.getActiveTrap(r),S=!1;if(y&&!y.paused){var w;(w=y._setSubtreeIsolation)===null||w===void 0||w.call(y,!1),S=!0}try{m||v(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=b(n),c?.();var k=(function(){var R=He(ce().m(function P(){return ce().w(function(L){for(;;)switch(L.n){case 0:return m&&v(),L.n=1,F();case 1:o._setSubtreeIsolation(!0),M(),f?.();case 2:return L.a(2)}},P)}));return function(){return R.apply(this,arguments)}})();if(m)return m(i.containers.concat()).then(k,k),this;k()}catch(R){if(y===U.getActiveTrap(r)&&S){var I;(I=y._setSubtreeIsolation)===null||I===void 0||I.call(y,!0)}throw R}return this},deactivate:function(d){if(!i.active)return this;var c=Ze({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},d);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,i.paused||o._setSubtreeIsolation(!1),i.alreadySilent.clear(),W(),i.active=!1,i.paused=!1,M(),U.deactivateTrap(r,o);var f=l(c,"onDeactivate"),m=l(c,"onPostDeactivate"),y=l(c,"checkCanReturnFocus"),S=l(c,"returnFocus","returnFocusOnDeactivate");f?.();var w=function(){Xe(function(){S&&g(E(i.nodeFocusedBeforeActivation)),m?.()})};return S&&y?(y(E(i.nodeFocusedBeforeActivation)).then(w,w),this):(w(),this)},pause:function(d){return i.active?(i.manuallyPaused=!0,this._setPausedState(!0,d)):this},unpause:function(d){return i.active?(i.manuallyPaused=!1,r[r.length-1]!==this?this:this._setPausedState(!1,d)):this},updateContainerElements:function(d){var c=[].concat(d).filter(Boolean);return i.containers=c.map(function(f){return typeof f=="string"?n.querySelector(f):f}),s.isolateSubtrees&&A(i.containers),i.active&&(v(),i.paused||o._setSubtreeIsolation(!0)),M(),this}},Object.defineProperties(o,{_isManuallyPaused:{value:function(){return i.manuallyPaused}},_setPausedState:{value:function(d,c){if(i.paused===d)return this;if(i.paused=d,d){var f=l(c,"onPause"),m=l(c,"onPostPause");f?.(),W(),o._setSubtreeIsolation(!1),M(),m?.()}else{var y=l(c,"onUnpause"),S=l(c,"onPostUnpause");y?.();var w=(function(){var k=He(ce().m(function I(){return ce().w(function(R){for(;;)switch(R.n){case 0:return v(),R.n=1,F();case 1:o._setSubtreeIsolation(!0),M(),S?.();case 2:return R.a(2)}},I)}));return function(){return k.apply(this,arguments)}})();w()}return this}},_setSubtreeIsolation:{value:function(d){s.isolateSubtrees&&i.adjacentElements.forEach(function(c){var f;if(d)switch(s.isolateSubtrees){case"aria-hidden":(c.ariaHidden==="true"||((f=c.getAttribute("aria-hidden"))===null||f===void 0?void 0:f.toLowerCase())==="true")&&i.alreadySilent.add(c),c.setAttribute("aria-hidden","true");break;default:(c.inert||c.hasAttribute("inert"))&&i.alreadySilent.add(c),c.setAttribute("inert",!0);break}else if(!i.alreadySilent.has(c))switch(s.isolateSubtrees){case"aria-hidden":c.removeAttribute("aria-hidden");break;default:c.removeAttribute("inert");break}})}}}),o.updateContainerElements(e),o};function yn(a,e={}){let t;const{immediate:n,...r}=e,s=ue(!1),i=ue(!1),o=p=>t&&t.activate(p),l=p=>t&&t.deactivate(p),u=()=>{t&&(t.pause(),i.value=!0)},h=()=>{t&&(t.unpause(),i.value=!1)};return Me(me(()=>bt(Be(a)).map(p=>{const v=Be(p);return typeof v=="string"?v:yt(v)}).filter(wt)),p=>{if(p.length)if(!t)t=bn(p,{...r,onActivate(){s.value=!0,e.onActivate&&e.onActivate()},onDeactivate(){s.value=!1,e.onDeactivate&&e.onDeactivate()}}),n&&o();else{const v=t?.active;t?.updateContainerElements(p),!v&&n&&o()}},{flush:"post"}),St(()=>l()),{hasFocus:s,isPaused:i,activate:o,deactivate:l,pause:u,unpause:h}}class ne{constructor(e,t=!0,n=[],r=5e3){this.ctx=e,this.iframes=t,this.exclude=n,this.iframesTimeout=r}static matches(e,t){const n=typeof t=="string"?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){let s=!1;return n.every(i=>r.call(e,i)?(s=!0,!1):!0),s}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(n=>{const r=t.filter(s=>s.contains(n)).length>0;t.indexOf(n)===-1&&!r&&t.push(n)}),t}getIframeContents(e,t,n=()=>{}){let r;try{const s=e.contentWindow;if(r=s.document,!s||!r)throw new Error("iframe inaccessible")}catch{n()}r&&t(r)}isIframeBlank(e){const t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}observeIframeLoad(e,t,n){let r=!1,s=null;const i=()=>{if(!r){r=!0,clearTimeout(s);try{this.isIframeBlank(e)||(e.removeEventListener("load",i),this.getIframeContents(e,t,n))}catch{n()}}};e.addEventListener("load",i),s=setTimeout(i,this.iframesTimeout)}onIframeReady(e,t,n){try{e.contentWindow.document.readyState==="complete"?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch{n()}}waitForIframes(e,t){let n=0;this.forEachIframe(e,()=>!0,r=>{n++,this.waitForIframes(r.querySelector("html"),()=>{--n||t()})},r=>{r||t()})}forEachIframe(e,t,n,r=()=>{}){let s=e.querySelectorAll("iframe"),i=s.length,o=0;s=Array.prototype.slice.call(s);const l=()=>{--i<=0&&r(o)};i||l(),s.forEach(u=>{ne.matches(u,this.exclude)?l():this.onIframeReady(u,h=>{t(u)&&(o++,n(h)),l()},l)})}createIterator(e,t,n){return document.createNodeIterator(e,t,n,!1)}createInstanceOnIframe(e){return new ne(e.querySelector("html"),this.iframes)}compareNodeIframe(e,t,n){const r=e.compareDocumentPosition(n),s=Node.DOCUMENT_POSITION_PRECEDING;if(r&s)if(t!==null){const i=t.compareDocumentPosition(n),o=Node.DOCUMENT_POSITION_FOLLOWING;if(i&o)return!0}else return!0;return!1}getIteratorNode(e){const t=e.previousNode();let n;return t===null?n=e.nextNode():n=e.nextNode()&&e.nextNode(),{prevNode:t,node:n}}checkIframeFilter(e,t,n,r){let s=!1,i=!1;return r.forEach((o,l)=>{o.val===n&&(s=l,i=o.handled)}),this.compareNodeIframe(e,t,n)?(s===!1&&!i?r.push({val:n,handled:!0}):s!==!1&&!i&&(r[s].handled=!0),!0):(s===!1&&r.push({val:n,handled:!1}),!1)}handleOpenIframes(e,t,n,r){e.forEach(s=>{s.handled||this.getIframeContents(s.val,i=>{this.createInstanceOnIframe(i).forEachNode(t,n,r)})})}iterateThroughNodes(e,t,n,r,s){const i=this.createIterator(t,e,r);let o=[],l=[],u,h,p=()=>({prevNode:h,node:u}=this.getIteratorNode(i),u);for(;p();)this.iframes&&this.forEachIframe(t,v=>this.checkIframeFilter(u,h,v,o),v=>{this.createInstanceOnIframe(v).forEachNode(e,b=>l.push(b),r)}),l.push(u);l.forEach(v=>{n(v)}),this.iframes&&this.handleOpenIframes(o,e,n,r),s()}forEachNode(e,t,n,r=()=>{}){const s=this.getContexts();let i=s.length;i||r(),s.forEach(o=>{const l=()=>{this.iterateThroughNodes(e,o,t,n,()=>{--i<=0&&r()})};this.iframes?this.waitForIframes(o,l):l()})}}let wn=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 ne(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}log(e,t="debug"){const n=this.opt.log;this.opt.debug&&typeof n=="object"&&typeof n[t]=="function"&&n[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,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(let s in t)if(t.hasOwnProperty(s)){const i=t[s],o=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(s):this.escapeStr(s),l=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(i):this.escapeStr(i);o!==""&&l!==""&&(e=e.replace(new RegExp(`(${this.escapeStr(o)}|${this.escapeStr(l)})`,`gm${n}`),r+`(${this.processSynomyms(o)}|${this.processSynomyms(l)})`+r))}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,n,r)=>{let s=r.charAt(n+1);return/[(|)\\]/.test(s)||s===""?t:t+"\0"})}createJoinersRegExp(e){let t=[];const n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.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",n=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 r=[];return e.split("").forEach(s=>{n.every(i=>{if(i.indexOf(s)!==-1){if(r.indexOf(i)>-1)return!1;e=e.replace(new RegExp(`[${i}]`,`gm${t}`),`[${i}]`),r.push(i)}return!0})}),e}createMergedBlanksRegExp(e){return e.replace(/[\s]+/gmi,"[\\s]+")}createAccuracyRegExp(e){const t="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿";let n=this.opt.accuracy,r=typeof n=="string"?n:n.value,s=typeof n=="string"?[]:n.limiters,i="";switch(s.forEach(o=>{i+=`|${this.escapeStr(o)}`}),r){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(n=>{this.opt.separateWordSearch?n.split(" ").forEach(r=>{r.trim()&&t.indexOf(r)===-1&&t.push(r)}):n.trim()&&t.indexOf(n)===-1&&t.push(n)}),{keywords:t.sort((n,r)=>r.length-n.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 n=0;return e.sort((r,s)=>r.start-s.start).forEach(r=>{let{start:s,end:i,valid:o}=this.callNoMatchOnInvalidRanges(r,n);o&&(r.start=s,r.length=i-s,t.push(r),n=i)}),t}callNoMatchOnInvalidRanges(e,t){let n,r,s=!1;return e&&typeof e.start<"u"?(n=parseInt(e.start,10),r=n+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?s=!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:n,end:r,valid:s}}checkWhitespaceRanges(e,t,n){let r,s=!0,i=n.length,o=t-i,l=parseInt(e.start,10)-o;return l=l>i?i:l,r=l+parseInt(e.length,10),r>i&&(r=i,this.log(`End range automatically set to the max value of ${i}`)),l<0||r-l<0||l>i||r>i?(s=!1,this.log(`Invalid range: ${JSON.stringify(e)}`),this.opt.noMatch(e)):n.substring(l,r).replace(/\s+/g,"")===""&&(s=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:l,end:r,valid:s}}getTextNodes(e){let t="",n=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,r=>{n.push({start:t.length,end:(t+=r.textContent).length,node:r})},r=>this.matchesExclude(r.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT,()=>{e({value:t,nodes:n})})}matchesExclude(e){return ne.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}wrapRangeInTextNode(e,t,n){const r=this.opt.element?this.opt.element:"mark",s=e.splitText(t),i=s.splitText(n-t);let o=document.createElement(r);return o.setAttribute("data-markjs","true"),this.opt.className&&o.setAttribute("class",this.opt.className),o.textContent=s.textContent,s.parentNode.replaceChild(o,s),i}wrapRangeInMappedTextNode(e,t,n,r,s){e.nodes.every((i,o)=>{const l=e.nodes[o+1];if(typeof l>"u"||l.start>t){if(!r(i.node))return!1;const u=t-i.start,h=(n>i.end?i.end:n)-i.start,p=e.value.substr(0,i.start),v=e.value.substr(h+i.start);if(i.node=this.wrapRangeInTextNode(i.node,u,h),e.value=p+v,e.nodes.forEach((b,g)=>{g>=o&&(e.nodes[g].start>0&&g!==o&&(e.nodes[g].start-=h),e.nodes[g].end-=h)}),n-=h,s(i.node.previousSibling,i.start),n>i.end)t=i.end;else return!1}return!0})}wrapMatches(e,t,n,r,s){const i=t===0?0:t+1;this.getTextNodes(o=>{o.nodes.forEach(l=>{l=l.node;let u;for(;(u=e.exec(l.textContent))!==null&&u[i]!=="";){if(!n(u[i],l))continue;let h=u.index;if(i!==0)for(let p=1;p<i;p++)h+=u[p].length;l=this.wrapRangeInTextNode(l,h,h+u[i].length),r(l.previousSibling),e.lastIndex=0}}),s()})}wrapMatchesAcrossElements(e,t,n,r,s){const i=t===0?0:t+1;this.getTextNodes(o=>{let l;for(;(l=e.exec(o.value))!==null&&l[i]!=="";){let u=l.index;if(i!==0)for(let p=1;p<i;p++)u+=l[p].length;const h=u+l[i].length;this.wrapRangeInMappedTextNode(o,u,h,p=>n(l[i],p),(p,v)=>{e.lastIndex=v,r(p)})}s()})}wrapRangeFromIndex(e,t,n,r){this.getTextNodes(s=>{const i=s.value.length;e.forEach((o,l)=>{let{start:u,end:h,valid:p}=this.checkWhitespaceRanges(o,i,s.value);p&&this.wrapRangeInMappedTextNode(s,u,h,v=>t(v,o,s.value.substring(u,h),l),v=>{n(v,o)})}),r()})}unwrapMatches(e){const t=e.parentNode;let n=document.createDocumentFragment();for(;e.firstChild;)n.appendChild(e.removeChild(e.firstChild));t.replaceChild(n,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 n=0,r="wrapMatches";const s=i=>{n++,this.opt.each(i)};this.opt.acrossElements&&(r="wrapMatchesAcrossElements"),this[r](e,this.opt.ignoreGroups,(i,o)=>this.opt.filter(o,i,n),s,()=>{n===0&&this.opt.noMatch(e),this.opt.done(n)})}mark(e,t){this.opt=t;let n=0,r="wrapMatches";const{keywords:s,length:i}=this.getSeparatedKeywords(typeof e=="string"?[e]:e),o=this.opt.caseSensitive?"":"i",l=u=>{let h=new RegExp(this.createRegExp(u),`gm${o}`),p=0;this.log(`Searching with expression "${h}"`),this[r](h,1,(v,b)=>this.opt.filter(b,u,n,p),v=>{p++,n++,this.opt.each(v)},()=>{p===0&&this.opt.noMatch(u),s[i-1]===u?this.opt.done(n):l(s[s.indexOf(u)+1])})};this.opt.acrossElements&&(r="wrapMatchesAcrossElements"),i===0?this.opt.done(n):l(s[0])}markRanges(e,t){this.opt=t;let n=0,r=this.checkRanges(e);r&&r.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(r)),this.wrapRangeFromIndex(r,(s,i,o,l)=>this.opt.filter(s,i,o,l),(s,i)=>{n++,this.opt.each(s,i)},()=>{this.opt.done(n)})):this.opt.done(n)}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,n=>{this.unwrapMatches(n)},n=>{const r=ne.matches(n,t),s=this.matchesExclude(n);return!r||s?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},this.opt.done)}};function Sn(a){const e=new wn(a);return this.mark=(t,n)=>(e.mark(t,n),this),this.markRegExp=(t,n)=>(e.markRegExp(t,n),this),this.markRanges=(t,n)=>(e.markRanges(t,n),this),this.unmark=t=>(e.unmark(t),this),this}const _n="ENTRIES",dt="KEYS",ft="VALUES",D="";class Fe{constructor(e,t){const n=e._tree,r=Array.from(n.keys());this.set=e,this._type=t,this._path=r.length>0?[{node:n,keys:r}]:[]}next(){const e=this.dive();return this.backtrack(),e}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:e,keys:t}=te(this._path);if(te(t)===D)return{done:!1,value:this.result()};const n=e.get(te(t));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const e=te(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:e})=>te(e)).filter(e=>e!==D).join("")}value(){return te(this._path).node.get(D)}result(){switch(this._type){case ft:return this.value();case dt:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const te=a=>a[a.length-1],xn=(a,e,t)=>{const n=new Map;if(e===void 0)return n;const r=e.length+1,s=r+t,i=new Uint8Array(s*r).fill(t+1);for(let o=0;o<r;++o)i[o]=o;for(let o=1;o<s;++o)i[o*r]=o;return ht(a,e,t,n,i,1,r,""),n},ht=(a,e,t,n,r,s,i,o)=>{const l=s*i;e:for(const u of a.keys())if(u===D){const h=r[l-1];h<=t&&n.set(o,[a.get(u),h])}else{let h=s;for(let p=0;p<u.length;++p,++h){const v=u[p],b=i*h,g=b-i;let E=r[b];const x=Math.max(0,h-t-1),O=Math.min(i-1,h+t);for(let C=x;C<O;++C){const J=v!==e[C],V=r[g+C]+ +J,B=r[g+C+1]+1,N=r[b+C]+1,F=r[b+C+1]=Math.min(V,B,N);F<E&&(E=F)}if(E>t)continue e}ht(a.get(u),e,t,n,r,h,i,o+u)}};class Q{constructor(e=new Map,t=""){this._size=void 0,this._tree=e,this._prefix=t}atPrefix(e){if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");const[t,n]=_e(this._tree,e.slice(this._prefix.length));if(t===void 0){const[r,s]=Ve(n);for(const i of r.keys())if(i!==D&&i.startsWith(s)){const o=new Map;return o.set(i.slice(s.length),r.get(i)),new Q(o,e)}}return new Q(t,e)}clear(){this._size=void 0,this._tree.clear()}delete(e){return this._size=void 0,kn(this._tree,e)}entries(){return new Fe(this,_n)}forEach(e){for(const[t,n]of this)e(t,n,this)}fuzzyGet(e,t){return xn(this._tree,e,t)}get(e){const t=Pe(this._tree,e);return t!==void 0?t.get(D):void 0}has(e){const t=Pe(this._tree,e);return t!==void 0&&t.has(D)}keys(){return new Fe(this,dt)}set(e,t){if(typeof e!="string")throw new Error("key must be a string");return this._size=void 0,Oe(this._tree,e).set(D,t),this}get size(){if(this._size)return this._size;this._size=0;const e=this.entries();for(;!e.next().done;)this._size+=1;return this._size}update(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Oe(this._tree,e);return n.set(D,t(n.get(D))),this}fetch(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;const n=Oe(this._tree,e);let r=n.get(D);return r===void 0&&n.set(D,r=t()),r}values(){return new Fe(this,ft)}[Symbol.iterator](){return this.entries()}static from(e){const t=new Q;for(const[n,r]of e)t.set(n,r);return t}static fromObject(e){return Q.from(Object.entries(e))}}const _e=(a,e,t=[])=>{if(e.length===0||a==null)return[a,t];for(const n of a.keys())if(n!==D&&e.startsWith(n))return t.push([a,n]),_e(a.get(n),e.slice(n.length),t);return t.push([a,e]),_e(void 0,"",t)},Pe=(a,e)=>{if(e.length===0||a==null)return a;for(const t of a.keys())if(t!==D&&e.startsWith(t))return Pe(a.get(t),e.slice(t.length))},Oe=(a,e)=>{const t=e.length;e:for(let n=0;a&&n<t;){for(const s of a.keys())if(s!==D&&e[n]===s[0]){const i=Math.min(t-n,s.length);let o=1;for(;o<i&&e[n+o]===s[o];)++o;const l=a.get(s);if(o===s.length)a=l;else{const u=new Map;u.set(s.slice(o),l),a.set(e.slice(n,n+o),u),a.delete(s),a=u}n+=o;continue e}const r=new Map;return a.set(e.slice(n),r),r}return a},kn=(a,e)=>{const[t,n]=_e(a,e);if(t!==void 0){if(t.delete(D),t.size===0)pt(n);else if(t.size===1){const[r,s]=t.entries().next().value;vt(n,r,s)}}},pt=a=>{if(a.length===0)return;const[e,t]=Ve(a);if(e.delete(t),e.size===0)pt(a.slice(0,-1));else if(e.size===1){const[n,r]=e.entries().next().value;n!==D&&vt(a.slice(0,-1),n,r)}},vt=(a,e,t)=>{if(a.length===0)return;const[n,r]=Ve(a);n.set(r+e,t),n.delete(r)},Ve=a=>a[a.length-1],$e="or",mt="and",En="and_not";class re{constructor(e){if(e?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');const t=e.autoVacuum==null||e.autoVacuum===!0?Ae:e.autoVacuum;this._options={...Re,...e,autoVacuum:t,searchOptions:{...et,...e.searchOptions||{}},autoSuggestOptions:{...On,...e.autoSuggestOptions||{}}},this._index=new Q,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)}add(e){const{extractField:t,stringifyField:n,tokenize:r,processTerm:s,fields:i,idField:o}=this._options,l=t(e,o);if(l==null)throw new Error(`MiniSearch: document does not have ID field "${o}"`);if(this._idToShortId.has(l))throw new Error(`MiniSearch: duplicate ID ${l}`);const u=this.addDocumentId(l);this.saveStoredFields(u,e);for(const h of i){const p=t(e,h);if(p==null)continue;const v=r(n(p,h),h),b=this._fieldIds[h],g=new Set(v).size;this.addFieldLength(u,b,this._documentCount-1,g);for(const E of v){const x=s(E,h);if(Array.isArray(x))for(const O of x)this.addTerm(b,u,O);else x&&this.addTerm(b,u,x)}}}addAll(e){for(const t of e)this.add(t)}addAllAsync(e,t={}){const{chunkSize:n=10}=t,r={chunk:[],promise:Promise.resolve()},{chunk:s,promise:i}=e.reduce(({chunk:o,promise:l},u,h)=>(o.push(u),(h+1)%n===0?{chunk:[],promise:l.then(()=>new Promise(p=>setTimeout(p,0))).then(()=>this.addAll(o))}:{chunk:o,promise:l}),r);return i.then(()=>this.addAll(s))}remove(e){const{tokenize:t,processTerm:n,extractField:r,stringifyField:s,fields:i,idField:o}=this._options,l=r(e,o);if(l==null)throw new Error(`MiniSearch: document does not have ID field "${o}"`);const u=this._idToShortId.get(l);if(u==null)throw new Error(`MiniSearch: cannot remove document with ID ${l}: it is not in the index`);for(const h of i){const p=r(e,h);if(p==null)continue;const v=t(s(p,h),h),b=this._fieldIds[h],g=new Set(v).size;this.removeFieldLength(u,b,this._documentCount,g);for(const E of v){const x=n(E,h);if(Array.isArray(x))for(const O of x)this.removeTerm(b,u,O);else x&&this.removeTerm(b,u,x)}}this._storedFields.delete(u),this._documentIds.delete(u),this._idToShortId.delete(l),this._fieldLength.delete(u),this._documentCount-=1}removeAll(e){if(e)for(const t of e)this.remove(t);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new Q,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(e){const t=this._idToShortId.get(e);if(t==null)throw new Error(`MiniSearch: cannot discard document with ID ${e}: it is not in the index`);this._idToShortId.delete(e),this._documentIds.delete(t),this._storedFields.delete(t),(this._fieldLength.get(t)||[]).forEach((n,r)=>{this.removeFieldLength(t,r,this._documentCount,n)}),this._fieldLength.delete(t),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:e,minDirtCount:t,batchSize:n,batchWait:r}=this._options.autoVacuum;this.conditionalVacuum({batchSize:n,batchWait:r},{minDirtCount:t,minDirtFactor:e})}discardAll(e){const t=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const n of e)this.discard(n)}finally{this._options.autoVacuum=t}this.maybeAutoVacuum()}replace(e){const{idField:t,extractField:n}=this._options,r=n(e,t);this.discard(r),this.add(e)}vacuum(e={}){return this.conditionalVacuum(e)}conditionalVacuum(e,t){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const n=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=je,this.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)}async performVacuuming(e,t){const n=this._dirtCount;if(this.vacuumConditionsMet(t)){const r=e.batchSize||ze.batchSize,s=e.batchWait||ze.batchWait;let i=1;for(const[o,l]of this._index){for(const[u,h]of l)for(const[p]of h)this._documentIds.has(p)||(h.size<=1?l.delete(u):h.delete(p));this._index.get(o).size===0&&this._index.delete(o),i%r===0&&await new Promise(u=>setTimeout(u,s)),i+=1}this._dirtCount-=n}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(e){if(e==null)return!0;let{minDirtCount:t,minDirtFactor:n}=e;return t=t||Ae.minDirtCount,n=n||Ae.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=n}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(e){return this._idToShortId.has(e)}getStoredFields(e){const t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)}search(e,t={}){const{searchOptions:n}=this._options,r={...n,...t},s=this.executeQuery(e,t),i=[];for(const[o,{score:l,terms:u,match:h}]of s){const p=u.length||1,v={id:this._documentIds.get(o),score:l*p,terms:Object.keys(h),queryTerms:u,match:h};Object.assign(v,this._storedFields.get(o)),(r.filter==null||r.filter(v))&&i.push(v)}return e===re.wildcard&&r.boostDocument==null||i.sort(nt),i}autoSuggest(e,t={}){t={...this._options.autoSuggestOptions,...t};const n=new Map;for(const{score:s,terms:i}of this.search(e,t)){const o=i.join(" "),l=n.get(o);l!=null?(l.score+=s,l.count+=1):n.set(o,{score:s,terms:i,count:1})}const r=[];for(const[s,{score:i,terms:o,count:l}]of n)r.push({suggestion:s,terms:o,score:i/l});return r.sort(nt),r}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(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)}static async loadJSONAsync(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(e),t)}static getDefault(e){if(Re.hasOwnProperty(e))return Ce(Re,e);throw new Error(`MiniSearch: unknown option "${e}"`)}static loadJS(e,t){const{index:n,documentIds:r,fieldLength:s,storedFields:i,serializationVersion:o}=e,l=this.instantiateMiniSearch(e,t);l._documentIds=pe(r),l._fieldLength=pe(s),l._storedFields=pe(i);for(const[u,h]of l._documentIds)l._idToShortId.set(h,u);for(const[u,h]of n){const p=new Map;for(const v of Object.keys(h)){let b=h[v];o===1&&(b=b.ds),p.set(parseInt(v,10),pe(b))}l._index.set(u,p)}return l}static async loadJSAsync(e,t){const{index:n,documentIds:r,fieldLength:s,storedFields:i,serializationVersion:o}=e,l=this.instantiateMiniSearch(e,t);l._documentIds=await ve(r),l._fieldLength=await ve(s),l._storedFields=await ve(i);for(const[h,p]of l._documentIds)l._idToShortId.set(p,h);let u=0;for(const[h,p]of n){const v=new Map;for(const b of Object.keys(p)){let g=p[b];o===1&&(g=g.ds),v.set(parseInt(b,10),await ve(g))}++u%1e3===0&&await gt(0),l._index.set(h,v)}return l}static instantiateMiniSearch(e,t){const{documentCount:n,nextId:r,fieldIds:s,averageFieldLength:i,dirtCount:o,serializationVersion:l}=e;if(l!==1&&l!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const u=new re(t);return u._documentCount=n,u._nextId=r,u._idToShortId=new Map,u._fieldIds=s,u._avgFieldLength=i,u._dirtCount=o||0,u._index=new Q,u}executeQuery(e,t={}){if(e===re.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){const v={...t,...e,queries:void 0},b=e.queries.map(g=>this.executeQuery(g,v));return this.combineResults(b,v.combineWith)}const{tokenize:n,processTerm:r,searchOptions:s}=this._options,i={tokenize:n,processTerm:r,...s,...t},{tokenize:o,processTerm:l}=i,p=o(e).flatMap(v=>l(v)).filter(v=>!!v).map(Fn(i)).map(v=>this.executeQuerySpec(v,i));return this.combineResults(p,i.combineWith)}executeQuerySpec(e,t){const n={...this._options.searchOptions,...t},r=(n.fields||this._options.fields).reduce((E,x)=>({...E,[x]:Ce(n.boost,x)||1}),{}),{boostDocument:s,weights:i,maxFuzzy:o,bm25:l}=n,{fuzzy:u,prefix:h}={...et.weights,...i},p=this._index.get(e.term),v=this.termResults(e.term,e.term,1,e.termBoost,p,r,s,l);let b,g;if(e.prefix&&(b=this._index.atPrefix(e.term)),e.fuzzy){const E=e.fuzzy===!0?.2:e.fuzzy,x=E<1?Math.min(o,Math.round(e.term.length*E)):E;x&&(g=this._index.fuzzyGet(e.term,x))}if(b)for(const[E,x]of b){const O=E.length-e.term.length;if(!O)continue;g?.delete(E);const C=h*E.length/(E.length+.3*O);this.termResults(e.term,E,C,e.termBoost,x,r,s,l,v)}if(g)for(const E of g.keys()){const[x,O]=g.get(E);if(!O)continue;const C=u*E.length/(E.length+O);this.termResults(e.term,E,C,e.termBoost,x,r,s,l,v)}return v}executeWildcardQuery(e){const t=new Map,n={...this._options.searchOptions,...e};for(const[r,s]of this._documentIds){const i=n.boostDocument?n.boostDocument(s,"",this._storedFields.get(r)):1;t.set(r,{score:i,terms:[],match:{}})}return t}combineResults(e,t=$e){if(e.length===0)return new Map;const n=t.toLowerCase(),r=Tn[n];if(!r)throw new Error(`Invalid combination operator: ${t}`);return e.reduce(r)||new Map}toJSON(){const e=[];for(const[t,n]of this._index){const r={};for(const[s,i]of n)r[s]=Object.fromEntries(i);e.push([t,r])}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:e,serializationVersion:2}}termResults(e,t,n,r,s,i,o,l,u=new Map){if(s==null)return u;for(const h of Object.keys(i)){const p=i[h],v=this._fieldIds[h],b=s.get(v);if(b==null)continue;let g=b.size;const E=this._avgFieldLength[v];for(const x of b.keys()){if(!this._documentIds.has(x)){this.removeTerm(v,x,t),g-=1;continue}const O=o?o(this._documentIds.get(x),t,this._storedFields.get(x)):1;if(!O)continue;const C=b.get(x),J=this._fieldLength.get(x)[v],V=Nn(C,g,this._documentCount,J,E,l),B=n*r*p*O*V,N=u.get(x);if(N){N.score+=B,Cn(N.terms,e);const F=Ce(N.match,t);F?F.push(h):N.match[t]=[h]}else u.set(x,{score:B,terms:[e],match:{[t]:[h]}})}}return u}addTerm(e,t,n){const r=this._index.fetch(n,rt);let s=r.get(e);if(s==null)s=new Map,s.set(t,1),r.set(e,s);else{const i=s.get(t);s.set(t,(i||0)+1)}}removeTerm(e,t,n){if(!this._index.has(n)){this.warnDocumentChanged(t,e,n);return}const r=this._index.fetch(n,rt),s=r.get(e);s==null||s.get(t)==null?this.warnDocumentChanged(t,e,n):s.get(t)<=1?s.size<=1?r.delete(e):s.delete(t):s.set(t,s.get(t)-1),this._index.get(n).size===0&&this._index.delete(n)}warnDocumentChanged(e,t,n){for(const r of Object.keys(this._fieldIds))if(this._fieldIds[r]===t){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(e)} has changed before removal: term "${n}" was not present in field "${r}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(e){const t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t}addFields(e){for(let t=0;t<e.length;t++)this._fieldIds[e[t]]=t}addFieldLength(e,t,n,r){let s=this._fieldLength.get(e);s==null&&this._fieldLength.set(e,s=[]),s[t]=r;const o=(this._avgFieldLength[t]||0)*n+r;this._avgFieldLength[t]=o/(n+1)}removeFieldLength(e,t,n,r){if(n===1){this._avgFieldLength[t]=0;return}const s=this._avgFieldLength[t]*n-r;this._avgFieldLength[t]=s/(n-1)}saveStoredFields(e,t){const{storeFields:n,extractField:r}=this._options;if(n==null||n.length===0)return;let s=this._storedFields.get(e);s==null&&this._storedFields.set(e,s={});for(const i of n){const o=r(t,i);o!==void 0&&(s[i]=o)}}}re.wildcard=Symbol("*");const Ce=(a,e)=>Object.prototype.hasOwnProperty.call(a,e)?a[e]:void 0,Tn={[$e]:(a,e)=>{for(const t of e.keys()){const n=a.get(t);if(n==null)a.set(t,e.get(t));else{const{score:r,terms:s,match:i}=e.get(t);n.score=n.score+r,n.match=Object.assign(n.match,i),tt(n.terms,s)}}return a},[mt]:(a,e)=>{const t=new Map;for(const n of e.keys()){const r=a.get(n);if(r==null)continue;const{score:s,terms:i,match:o}=e.get(n);tt(r.terms,i),t.set(n,{score:r.score+s,terms:r.terms,match:Object.assign(r.match,o)})}return t},[En]:(a,e)=>{for(const t of e.keys())a.delete(t);return a}},In={k:1.2,b:.7,d:.5},Nn=(a,e,t,n,r,s)=>{const{k:i,b:o,d:l}=s;return Math.log(1+(t-e+.5)/(e+.5))*(l+a*(i+1)/(a+i*(1-o+o*n/r)))},Fn=a=>(e,t,n)=>{const r=typeof a.fuzzy=="function"?a.fuzzy(e,t,n):a.fuzzy||!1,s=typeof a.prefix=="function"?a.prefix(e,t,n):a.prefix===!0,i=typeof a.boostTerm=="function"?a.boostTerm(e,t,n):1;return{term:e,fuzzy:r,prefix:s,termBoost:i}},Re={idField:"id",extractField:(a,e)=>a[e],stringifyField:(a,e)=>a.toString(),tokenize:a=>a.split(Rn),processTerm:a=>a.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(a,e)=>{typeof console?.[a]=="function"&&console[a](e)},autoVacuum:!0},et={combineWith:$e,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:In},On={combineWith:mt,prefix:(a,e,t)=>e===t.length-1},ze={batchSize:1e3,batchWait:10},je={minDirtFactor:.1,minDirtCount:20},Ae={...ze,...je},Cn=(a,e)=>{a.includes(e)||a.push(e)},tt=(a,e)=>{for(const t of e)a.includes(t)||a.push(t)},nt=({score:a},{score:e})=>e-a,rt=()=>new Map,pe=a=>{const e=new Map;for(const t of Object.keys(a))e.set(parseInt(t,10),a[t]);return e},ve=async a=>{const e=new Map;let t=0;for(const n of Object.keys(a))e.set(parseInt(n,10),a[n]),++t%1e3===0&&await gt(0);return e},gt=a=>new Promise(e=>setTimeout(e,a)),Rn=/[\n\r\p{Z}\p{P}]+/u;var An=class{max;cache;constructor(a=10){this.max=a,this.cache=new Map}get(a){const e=this.cache.get(a);return e!==void 0&&(this.cache.delete(a),this.cache.set(a,e)),e}set(a,e){this.cache.has(a)?this.cache.delete(a):this.cache.size===this.max&&this.cache.delete(this.first()),this.cache.set(a,e)}first(){return this.cache.keys().next().value}clear(){this.cache.clear()}};const Mn={},Ln={width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"};function Dn(a,e){return G(),H("svg",Ln,[...e[0]||(e[0]=[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 12H5m7 7l-7-7l7-7"},null,-1)])])}const Pn=xe(Mn,[["render",Dn]]),zn={},jn={width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"};function Vn(a,e){return G(),H("svg",jn,[...e[0]||(e[0]=[_("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"},null,-1)])])}const $n=xe(zn,[["render",Vn]]),Bn={},Wn={width:"18",height:"18",viewBox:"0 0 24 24","aria-hidden":"true"};function Jn(a,e){return G(),H("svg",Wn,[...e[0]||(e[0]=[_("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[_("circle",{cx:"11",cy:"11",r:"8"}),_("path",{d:"m21 21l-4.35-4.35"})],-1)])])}const Kn=xe(Bn,[["render",Jn]]),Gn=["aria-owns"],Un={class:"shell"},qn=["title"],Hn={class:"search-actions before"},Qn=["title"],Yn=["placeholder"],Zn={class:"search-actions"},Xn=["disabled","title"],er=["id","role","aria-labelledby"],tr=["aria-selected"],nr=["href","aria-label","onMouseenter","onFocusin","onClick"],rr={class:"titles"},ir=["innerHTML"],sr={class:"title main"},ar=["innerHTML"],or={key:0,class:"no-results"},lr={class:"search-keyboard-shortcuts"},cr=["aria-label"],ur=["aria-label"],dr=["aria-label"],fr=["aria-label"],hr=_t({__name:"SearchBox",props:{locales:{},options:{}},emits:["close"],setup(a,{emit:e}){const t=e,n=xt(),r=kt(Et(()=>a.locales)),s=Tt(),i=ue(),o=ue(),l=Bt(),{activate:u}=yn(i,{immediate:!0}),h=We(async()=>{let c;if(typeof Intl.Segmenter<"u"){const f=new Intl.Segmenter(s.value,{granularity:"word"});c=m=>Array.from(f.segment(m)).map(y=>y.segment)}return Je(re.loadJSON((await l.value[n.value]?.())?.default,{fields:["title","titles","text"],storeFields:["title","titles"],searchOptions:{fuzzy:.2,prefix:!0,boost:{title:4,text:2,titles:1},tokenize:c},...a.options.miniSearch?.searchOptions,...a.options.miniSearch?.options}))}),v=me(()=>a.options?.disableQueryPersistence===!0).value?ie(""):It("vuepress-plume:mini-search-filter",""),b=me(()=>r.value.buttonText||r.value.placeholder||"Search"),g=ue([]),E=ie(!1);Me(v,()=>{E.value=!1});const x=We(async()=>{if(o.value)return Je(new Sn(o.value))},null),O=new An(64);Nt(()=>[h.value,v.value],async([c,f],m,y)=>{m?.[0]!==c&&O.clear();let S=!1;if(y(()=>{S=!0}),!c)return;g.value=c.search(f),E.value=!0;const w=new Set;g.value=g.value.map(k=>{const[I,R]=k.id.split("#"),L=O.get(I)?.get(R)??"";for(const K in k.match)w.add(K);return{...k,text:L}}),await se(),!S&&await new Promise(k=>{x.value?.unmark({done:()=>{x.value?.markRegExp(T(w),{done:k})}})})},{debounce:200,immediate:!0});const C=ie(),J=me(()=>v.value?.length<=0);function V(c=!0){C.value?.focus(),c&&C.value?.select()}Te(()=>{V()});function B(c){c.pointerType==="mouse"&&V()}const N=ie(-1),F=ie(!1);Me(g,c=>{N.value=c.length?0:-1,A()});function A(){se(()=>{const c=document.querySelector(".result.selected");c&&c.scrollIntoView({block:"nearest"})})}fe("ArrowUp",c=>{c.preventDefault(),N.value--,N.value<0&&(N.value=g.value.length-1),F.value=!0,A()}),fe("ArrowDown",c=>{c.preventDefault(),N.value++,N.value>=g.value.length&&(N.value=0),F.value=!0,A()});const W=Ft();fe("Enter",c=>{if(c.isComposing||c.target instanceof HTMLButtonElement&&c.target.type!=="submit")return;const f=g.value[N.value];if(c.target instanceof HTMLInputElement&&!f){c.preventDefault();return}f&&(W.push(f.id),t("close"))}),fe("Escape",()=>{t("close")}),Te(()=>{window.history.pushState(null,"",null)}),Ot("popstate",c=>{c.preventDefault(),t("close")});const Y=Ct(typeof document<"u"?document.body:null);Te(()=>{se(()=>{Y.value=!0,se().then(()=>u())})}),Rt(()=>{Y.value=!1});function $(){v.value="",se().then(()=>V(!1))}function M(c){return c.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function T(c){return new RegExp([...c].sort((f,m)=>m.length-f.length).map(f=>`(${M(f)})`).join("|"),"gi")}function d(c,f){c.preventDefault(),W.push(f.id),t("close")}return(c,f)=>(G(),At($t,{to:"body"},[_("div",{ref_key:"el",ref:i,role:"button","aria-owns":g.value?.length?"localsearch-list":void 0,"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"mini-search-label",class:"VPLocalSearchBox"},[_("div",{class:"backdrop",onClick:f[0]||(f[0]=m=>c.$emit("close"))}),_("div",Un,[_("form",{class:"search-bar",onPointerup:f[3]||(f[3]=m=>B(m)),onSubmit:f[4]||(f[4]=Mt(()=>{},["prevent"]))},[_("label",{id:"localsearch-label",title:b.value,for:"localsearch-input"},[Ie(Kn,{class:"search-icon"})],8,qn),_("div",Hn,[_("button",{class:"back-button",title:z(r).backButtonTitle,onClick:f[1]||(f[1]=m=>c.$emit("close"))},[Ie(Pn)],8,Qn)]),Lt(_("input",{id:"localsearch-input",ref_key:"searchInput",ref:C,"onUpdate:modelValue":f[2]||(f[2]=m=>Pt(v)?v.value=m:null),placeholder:b.value,"aria-labelledby":"localsearch-label",class:"search-input"},null,8,Yn),[[Dt,z(v)]]),_("div",Zn,[_("button",{class:"clear-button",type:"reset",disabled:J.value,title:z(r).resetButtonTitle,onClick:$},[Ie($n)],8,Xn)])],32),_("ul",{id:g.value?.length?"localsearch-list":void 0,ref_key:"resultsEl",ref:o,role:g.value?.length?"listbox":void 0,"aria-labelledby":g.value?.length?"localsearch-label":void 0,class:"results",onMousemove:f[5]||(f[5]=m=>F.value=!1)},[(G(!0),H(Ge,null,Ke(g.value,(m,y)=>(G(),H("li",{key:m.id,role:"option","aria-selected":N.value===y?"true":"false"},[_("a",{href:z(jt)(m.id),class:zt(["result",{selected:N.value===y}]),"aria-label":[...m.titles,m.title].join(" > "),onMouseenter:S=>!F.value&&(N.value=y),onFocusin:S=>N.value=y,onClick:S=>d(S,m)},[_("div",null,[_("div",rr,[f[7]||(f[7]=_("span",{class:"title-icon"},"#",-1)),(G(!0),H(Ge,null,Ke(m.titles,(S,w)=>(G(),H("span",{key:w,class:"title"},[_("span",{class:"text",innerHTML:S},null,8,ir),f[6]||(f[6]=_("svg",{width:"18",height:"18",viewBox:"0 0 24 24"},[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"})],-1))]))),128)),_("span",sr,[_("span",{class:"text",innerHTML:m.title},null,8,ar)])])])],42,nr)],8,tr))),128)),z(v)&&!g.value.length&&E.value?(G(),H("li",or,[ae(oe(z(r).noResultsText)+' "',1),_("strong",null,oe(z(v)),1),f[8]||(f[8]=ae('" ',-1))])):Vt("",!0)],40,er),_("div",lr,[_("span",null,[_("kbd",{"aria-label":z(r).footer?.navigateUpKeyAriaLabel??""},[...f[9]||(f[9]=[_("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 19V5m-7 7l7-7l7 7"})],-1)])],8,cr),_("kbd",{"aria-label":z(r).footer?.navigateDownKeyAriaLabel??""},[...f[10]||(f[10]=[_("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[_("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 5v14m7-7l-7 7l-7-7"})],-1)])],8,ur),ae(" "+oe(z(r).footer?.navigateText??""),1)]),_("span",null,[_("kbd",{"aria-label":z(r).footer?.selectKeyAriaLabel??""},[...f[11]||(f[11]=[_("svg",{width:"14",height:"14",viewBox:"0 0 24 24"},[_("g",{fill:"none",stroke:"currentcolor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[_("path",{d:"m9 10l-5 5l5 5"}),_("path",{d:"M20 4v7a4 4 0 0 1-4 4H4"})])],-1)])],8,dr),ae(" "+oe(z(r).footer?.selectText??""),1)]),_("span",null,[_("kbd",{"aria-label":z(r).footer?.closeKeyAriaLabel??""},"esc",8,fr),ae(" "+oe(z(r).footer?.closeText??""),1)])])])],8,Gn)]))}}),mr=xe(hr,[["__scopeId","data-v-a8606ade"]]);export{mr as default};