forge/docus/dist/_nuxt/CxBf5103.js
2026-05-23 09:23:12 -05:00

5 lines
80 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{c as z,t as ie,u as Gt,d as ne,w as ve,o as E,a as B,m as V,V as Ut,b as Ye,e as H,f as Q,F as ae,r as me,i as Yt,g as Qt,h as ke,j as Xt,k as Jt,l as _t,n as xe,p as O,q as j,s as f,P as he,v as te,x as Te,y as Zt,z as Qe,A as Mt,B as Z,C as ye,D as Xe,E as es,G as ts,H as ss,I as wt,J as kt,K as is,L as ns,M as rt,N as rs,O as as,Q as Je,R as ls,S as os,T as us,U as cs,W as ds,X as hs,Y as fs,Z as se,_ as Ft,$ as Lt,a0 as zt,a1 as Tt,a2 as ps,a3 as Ke,a4 as gs,a5 as ms,a6 as Bt,a7 as vs,a8 as ys,a9 as Re,aa as bs,ab as Se,ac as q,ad as xs,ae as Ss,af as at,ag as pe,ah as Be,ai as As,aj as Dt,ak as lt,al as $e,am as _e,an as Cs,ao as qe,ap as Is,aq as Es,ar as _s,as as Ms,at as ws,au as ks,av as ot,aw as ut,ax as ct,ay as Fs,az as Ls,aA as zs}from"./B3fabVUf.js";import{f as Ie}from"./C5B99YjC.js";import{_ as Ts}from"./DJxuwfoz.js";function Bs(n){return z(()=>ie(n)?!!Gt(n)?.closest("form"):!0)}function Ds(){return{ALT:"Alt",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",ARROW_UP:"ArrowUp",BACKSPACE:"Backspace",CAPS_LOCK:"CapsLock",CONTROL:"Control",DELETE:"Delete",END:"End",ENTER:"Enter",ESCAPE:"Escape",F1:"F1",F10:"F10",F11:"F11",F12:"F12",F2:"F2",F3:"F3",F4:"F4",F5:"F5",F6:"F6",F7:"F7",F8:"F8",F9:"F9",HOME:"Home",META:"Meta",PAGE_DOWN:"PageDown",PAGE_UP:"PageUp",SHIFT:"Shift",SPACE:" ",TAB:"Tab",CTRL:"Control",ASTERISK:"*",SPACE_CODE:"Space"}}var Os=ne({inheritAttrs:!1,__name:"VisuallyHiddenInputBubble",props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:"fully-hidden"}},setup(n){const t=n,{primitiveElement:e,currentElement:s}=Ye(),i=z(()=>t.checked??t.value);return ve(i,(r,a)=>{if(!s.value)return;const l=s.value,u=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(u,"value").set;if(d&&r!==a){const g=new Event("input",{bubbles:!0}),c=new Event("change",{bubbles:!0});d.call(l,r),l.dispatchEvent(g),l.dispatchEvent(c)}}),(r,a)=>(E(),B(Ut,V({ref_key:"primitiveElement",ref:e},{...t,...r.$attrs},{as:"input"}),null,16))}}),dt=Os,Ks=ne({inheritAttrs:!1,__name:"VisuallyHiddenInput",props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:"fully-hidden"}},setup(n){const t=n,e=z(()=>typeof t.value=="object"&&Array.isArray(t.value)&&t.value.length===0&&t.required),s=z(()=>typeof t.value=="string"||typeof t.value=="number"||typeof t.value=="boolean"||t.value===null||t.value===void 0?[{name:t.name,value:t.value}]:typeof t.value=="object"&&Array.isArray(t.value)?t.value.flatMap((i,r)=>typeof i=="object"?Object.entries(i).map(([a,l])=>({name:`${t.name}[${r}][${a}]`,value:l})):{name:`${t.name}[${r}]`,value:i}):t.value!==null&&typeof t.value=="object"&&!Array.isArray(t.value)?Object.entries(t.value).map(([i,r])=>({name:`${t.name}[${i}]`,value:r})):[]);return(i,r)=>(E(),H(ae,null,[Q(" We render single input if it's required "),e.value?(E(),B(dt,V({key:i.name},{...t,...i.$attrs},{name:i.name,value:i.value}),null,16,["name","value"])):(E(!0),H(ae,{key:1},me(s.value,a=>(E(),B(dt,V({key:a.name},{ref_for:!0},{...t,...i.$attrs},{name:a.name,value:a.value}),null,16,["name","value"]))),128))],2112))}}),Rs=Ks;function ht(n){return n?.querySelector("[data-state=checked]")}function $s(n,t,e){return n===void 0?!1:Array.isArray(n)?n.some(s=>le(s,t,e)):le(n,t,e)}function le(n,t,e){return n===void 0||t===void 0?!1:typeof n=="string"?n===t:typeof e=="function"?e(n,t):typeof e=="string"?n?.[e]===t?.[e]:Yt(n,t)}const[Fe,qs]=Qe("ListboxRoot");var Ps=ne({__name:"ListboxRoot",props:{modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},multiple:{type:Boolean,required:!1},orientation:{type:String,required:!1,default:"vertical"},dir:{type:String,required:!1},disabled:{type:Boolean,required:!1},selectionBehavior:{type:String,required:!1,default:"toggle"},highlightOnHover:{type:Boolean,required:!1},by:{type:[String,Function],required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:["update:modelValue","highlight","entryFocus","leave"],setup(n,{expose:t,emit:e}){const s=n,i=e,{multiple:r,highlightOnHover:a,orientation:l,disabled:u,selectionBehavior:p,dir:d}=Qt(s),{getItems:g}=ke({isProvider:!0}),{handleTypeaheadSearch:c}=Xt(),{primitiveElement:o,currentElement:m}=Ye(),v=Ds(),y=Jt(d),S=Bs(m),_=te(),L=te(!1),K=te(!0),w=_t(s,"modelValue",i,{defaultValue:s.defaultValue??(r.value?[]:void 0),passive:s.modelValue===void 0,deep:!0});function W(b){if(L.value=!0,s.multiple){const M=Array.isArray(w.value)?[...w.value]:[],F=M.findIndex(N=>le(N,b,s.by));s.selectionBehavior==="toggle"?(F===-1?M.push(b):M.splice(F,1),w.value=M):(w.value=[b],_.value=b)}else s.selectionBehavior==="toggle"&&le(w.value,b,s.by)?w.value=void 0:w.value=b;setTimeout(()=>{L.value=!1},1)}const A=te(null),k=te(null),R=te(!1),D=te(!1),J=Te(),ee=Te(),I=Te();function P(){return g().map(b=>b.ref).filter(b=>b.dataset.disabled!=="")}function h(b,M=!0,F){if(!b)return;A.value=b,(F??K.value)&&A.value.focus(),M&&A.value.scrollIntoView({block:"nearest"});const N=g().find(re=>re.ref===b);i("highlight",N)}function $(b){if(R.value)I.trigger(b);else{const M=g().find(F=>le(F.value,b,s.by));M&&(A.value=M.ref,h(M.ref))}}function x(b){A.value&&A.value.isConnected&&(b.preventDefault(),b.stopPropagation(),D.value||A.value.click())}function T(b){if(K.value){if(L.value=!0,R.value)ee.trigger(b);else{const M=b.altKey||b.ctrlKey||b.metaKey;if(M&&b.key==="a"&&r.value){const F=g(),N=F.map(ze=>ze.value);w.value=[...N],b.preventDefault();const re=F.at(-1);re&&h(re.ref)}else if(!M){const F=c(b.key,g());F&&h(F)}}setTimeout(()=>{L.value=!1},1)}}function Y(){D.value=!0}function G(){xe(()=>{D.value=!1})}function fe(){xe(()=>{const b=new KeyboardEvent("keydown",{key:"PageUp"});it(b)})}function Le(b){const M=A.value;M?.isConnected&&(k.value=M),A.value=null,i("leave",b)}function jt(b){const M=new CustomEvent("listbox.entryFocus",{bubbles:!1,cancelable:!0});if(b.currentTarget?.dispatchEvent(M),i("entryFocus",M),!M.defaultPrevented)if(k.value)h(k.value);else{const F=P()?.[0];h(F)}}function it(b){const M=Zt(b,l.value,y.value);if(!M)return;let F=P();if(A.value){if(M==="last")F.reverse();else if(M==="prev"||M==="next"){M==="prev"&&F.reverse();const N=F.indexOf(A.value);F=F.slice(N+1)}Wt(b,F[0])}if(F.length){const N=!A.value&&M==="prev"?F.length-1:0;h(F[N])}if(R.value)return ee.trigger(b)}function Wt(b,M){if(!(R.value||s.selectionBehavior!=="replace"||!r.value||!Array.isArray(w.value)||(b.altKey||b.ctrlKey||b.metaKey)&&!b.shiftKey)&&b.shiftKey){const N=g().filter(be=>be.ref.dataset.disabled!=="");let re=N.find(be=>be.ref===M)?.value;if(b.key===v.END?re=N.at(-1)?.value:b.key===v.HOME&&(re=N[0]?.value),!re||!_.value)return;const ze=Ie(N.map(be=>be.value),_.value,re);w.value=ze}}async function nt(b){if(await xe(),R.value)J.trigger(b);else{const M=P(),F=M.find(N=>N.dataset.state==="checked");F?h(F):M.length&&h(M[0])}}return ve(w,()=>{L.value||xe(()=>{nt()})},{immediate:!0,deep:!0}),t({highlightedElement:A,highlightItem:$,highlightFirstItem:fe,highlightSelected:nt,getItems:g}),qs({modelValue:w,onValueChange:W,multiple:r,orientation:l,dir:y,disabled:u,highlightOnHover:a,highlightedElement:A,isVirtual:R,virtualFocusHook:J,virtualKeydownHook:ee,virtualHighlightHook:I,by:s.by,firstValue:_,selectionBehavior:p,focusable:K,onLeave:Le,onEnter:jt,changeHighlight:h,onKeydownEnter:x,onKeydownNavigation:it,onKeydownTypeAhead:T,onCompositionStart:Y,onCompositionEnd:G,highlightFirstItem:fe}),(b,M)=>(E(),B(f(he),{ref_key:"primitiveElement",ref:o,as:b.as,"as-child":b.asChild,dir:f(y),"data-disabled":f(u)?"":void 0,onPointerleave:Le,onFocusout:M[0]||(M[0]=async F=>{const N=F.relatedTarget||F.target;await xe(),A.value&&f(m)&&!f(m).contains(N)&&Le(F)})},{default:O(()=>[j(b.$slots,"default",{modelValue:f(w)}),f(S)&&b.name?(E(),B(f(Rs),{key:0,name:b.name,value:f(w),disabled:f(u),required:b.required},null,8,["name","value","disabled","required"])):Q("v-if",!0)]),_:3},8,["as","as-child","dir","data-disabled"]))}}),Hs=Ps,Vs=ne({__name:"ListboxContent",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(n){const{CollectionSlot:t}=ke(),e=Fe(),s=Mt(!1,10);return(i,r)=>(E(),B(f(t),null,{default:O(()=>[Z(f(he),{role:"listbox",as:i.as,"as-child":i.asChild,tabindex:f(e).focusable.value?f(e).highlightedElement.value?"-1":"0":"-1","aria-orientation":f(e).orientation.value,"aria-multiselectable":!!f(e).multiple.value,"data-orientation":f(e).orientation.value,onMousedown:r[0]||(r[0]=Xe(a=>s.value=!0,["left"])),onFocus:r[1]||(r[1]=a=>{f(s)||f(e).onEnter(a)}),onKeydown:[r[2]||(r[2]=ye(a=>{f(e).orientation.value==="vertical"&&(a.key==="ArrowLeft"||a.key==="ArrowRight")||f(e).orientation.value==="horizontal"&&(a.key==="ArrowUp"||a.key==="ArrowDown")||(a.preventDefault(),f(e).focusable.value&&f(e).onKeydownNavigation(a))},["down","up","left","right","home","end"])),ye(f(e).onKeydownEnter,["enter"]),f(e).onKeydownTypeAhead]},{default:O(()=>[j(i.$slots,"default")]),_:3},8,["as","as-child","tabindex","aria-orientation","aria-multiselectable","data-orientation","onKeydown"])]),_:3}))}}),Ns=Vs,js=ne({__name:"ListboxFilter",props:{modelValue:{type:String,required:!1},autoFocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"input"}},emits:["update:modelValue"],setup(n,{emit:t}){const e=n,i=_t(e,"modelValue",t,{defaultValue:"",passive:e.modelValue===void 0}),r=Fe(),{primitiveElement:a,currentElement:l}=Ye(),u=z(()=>e.disabled||r.disabled.value||!1),p=te();return es(()=>p.value=r.highlightedElement.value?.id),ts(()=>{r.focusable.value=!1,setTimeout(()=>{e.autoFocus&&l.value?.focus()},1)}),ss(()=>{r.focusable.value=!0}),(d,g)=>(E(),B(f(he),{ref_key:"primitiveElement",ref:a,as:d.as,"as-child":d.asChild,value:f(i),disabled:u.value?"":void 0,"data-disabled":u.value?"":void 0,"aria-disabled":u.value??void 0,"aria-activedescendant":p.value,type:"text",onKeydown:[ye(Xe(f(r).onKeydownNavigation,["prevent"]),["down","up","home","end"]),ye(f(r).onKeydownEnter,["enter"])],onInput:g[0]||(g[0]=c=>{i.value=c.target.value,f(r).highlightFirstItem()}),onCompositionstart:f(r).onCompositionStart,onCompositionend:f(r).onCompositionEnd},{default:O(()=>[j(d.$slots,"default",{modelValue:f(i)})]),_:3},8,["as","as-child","value","disabled","data-disabled","aria-disabled","aria-activedescendant","onKeydown","onCompositionstart","onCompositionend"]))}}),Ws=js;const[Gs,Us]=Qe("ListboxGroup");var Ys=ne({__name:"ListboxGroup",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(n){const t=n,e=wt(void 0,"reka-listbox-group");return Us({id:e}),(s,i)=>(E(),B(f(he),V({role:"group"},t,{"aria-labelledby":f(e)}),{default:O(()=>[j(s.$slots,"default")]),_:3},16,["aria-labelledby"]))}}),Qs=Ys,Xs=ne({__name:"ListboxGroupLabel",props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"div"}},setup(n){const t=n,e=Gs({id:""});return(s,i)=>(E(),B(f(he),V(t,{id:f(e).id}),{default:O(()=>[j(s.$slots,"default")]),_:3},16,["id"]))}}),Js=Xs;const Zs="listbox.select",[ei,ti]=Qe("ListboxItem");var si=ne({__name:"ListboxItem",props:{value:{type:null,required:!0},disabled:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"div"}},emits:["select"],setup(n,{emit:t}){const e=n,s=t,i=wt(void 0,"reka-listbox-item"),{CollectionItem:r}=ke(),{forwardRef:a,currentElement:l}=kt(),u=Fe(),p=z(()=>l.value===u.highlightedElement.value),d=z(()=>$s(u.modelValue.value,e.value,u.by)),g=z(()=>u.disabled.value||e.disabled);async function c(m){s("select",m),!m?.defaultPrevented&&!g.value&&m&&(u.onValueChange(e.value),u.changeHighlight(l.value))}function o(m){const v={originalEvent:m,value:e.value};ns(Zs,c,v)}return ti({isSelected:d}),(m,v)=>(E(),B(f(r),{value:m.value},{default:O(()=>[is([p.value,d.value],()=>Z(f(he),V({id:f(i)},m.$attrs,{ref:f(a),role:"option",tabindex:f(u).focusable.value?p.value?"0":"-1":-1,"aria-selected":d.value,as:m.as,"as-child":m.asChild,disabled:g.value?"":void 0,"data-disabled":g.value?"":void 0,"data-highlighted":p.value?"":void 0,"data-state":d.value?"checked":"unchecked",onClick:o,onKeydown:ye(Xe(o,["prevent"]),["space"]),onPointermove:v[0]||(v[0]=()=>{f(u).highlightedElement.value!==f(l)&&f(u).highlightOnHover.value&&f(u).changeHighlight(f(l),!1,!1)})}),{default:O(()=>[j(m.$slots,"default")]),_:3},16,["id","tabindex","aria-selected","as","as-child","disabled","data-disabled","data-highlighted","data-state","onKeydown"]),v,1)]),_:3},8,["value"]))}}),ii=si,ni=ne({__name:"ListboxItemIndicator",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"span"}},setup(n){const t=n;kt();const e=ei();return(s,i)=>f(e).isSelected.value?(E(),B(f(he),V({key:0,"aria-hidden":"true"},t),{default:O(()=>[j(s.$slots,"default")]),_:3},16)):Q("v-if",!0)}}),ri=ni;function ge(n,t,e){let s=e.initialDeps??[],i,r=!0;function a(){var l,u,p;let d;e.key&&((l=e.debug)!=null&&l.call(e))&&(d=Date.now());const g=n();if(!(g.length!==s.length||g.some((m,v)=>s[v]!==m)))return i;s=g;let o;if(e.key&&((u=e.debug)!=null&&u.call(e))&&(o=Date.now()),i=t(...g),e.key&&((p=e.debug)!=null&&p.call(e))){const m=Math.round((Date.now()-d)*100)/100,v=Math.round((Date.now()-o)*100)/100,y=v/16,S=(_,L)=>{for(_=String(_);_.length<L;)_=" "+_;return _};console.info(`%c⏱ ${S(v,5)} /${S(m,5)} ms`,`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,e?.key)}return e?.onChange&&!(r&&e.skipInitialOnChange)&&e.onChange(i),r=!1,i}return a.updateDeps=l=>{s=l},a}function ft(n,t){if(n===void 0)throw new Error("Unexpected undefined");return n}const ai=(n,t)=>Math.abs(n-t)<1.01,li=(n,t,e)=>{let s;return function(...i){n.clearTimeout(s),s=n.setTimeout(()=>t.apply(this,i),e)}},pt=n=>{const{offsetWidth:t,offsetHeight:e}=n;return{width:t,height:e}},oi=n=>n,ui=n=>{const t=Math.max(n.startIndex-n.overscan,0),e=Math.min(n.endIndex+n.overscan,n.count-1),s=[];for(let i=t;i<=e;i++)s.push(i);return s},ci=(n,t)=>{const e=n.scrollElement;if(!e)return;const s=n.targetWindow;if(!s)return;const i=a=>{const{width:l,height:u}=a;t({width:Math.round(l),height:Math.round(u)})};if(i(pt(e)),!s.ResizeObserver)return()=>{};const r=new s.ResizeObserver(a=>{const l=()=>{const u=a[0];if(u?.borderBoxSize){const p=u.borderBoxSize[0];if(p){i({width:p.inlineSize,height:p.blockSize});return}}i(pt(e))};n.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return r.observe(e,{box:"border-box"}),()=>{r.unobserve(e)}},gt={passive:!0},mt=typeof window>"u"?!0:"onscrollend"in window,di=(n,t)=>{const e=n.scrollElement;if(!e)return;const s=n.targetWindow;if(!s)return;let i=0;const r=n.options.useScrollendEvent&&mt?()=>{}:li(s,()=>{t(i,!1)},n.options.isScrollingResetDelay),a=d=>()=>{const{horizontal:g,isRtl:c}=n.options;i=g?e.scrollLeft*(c&&-1||1):e.scrollTop,r(),t(i,d)},l=a(!0),u=a(!1);e.addEventListener("scroll",l,gt);const p=n.options.useScrollendEvent&&mt;return p&&e.addEventListener("scrollend",u,gt),()=>{e.removeEventListener("scroll",l),p&&e.removeEventListener("scrollend",u)}},hi=(n,t,e)=>{if(t?.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return n[e.options.horizontal?"offsetWidth":"offsetHeight"]},fi=(n,{adjustments:t=0,behavior:e},s)=>{var i,r;const a=n+t;(r=(i=s.scrollElement)==null?void 0:i.scrollTo)==null||r.call(i,{[s.options.horizontal?"left":"top"]:a,behavior:e})};class pi{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,s,i;return((i=(s=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:s.now)==null?void 0:i.call(s))??Date.now()},this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(i=>{i.forEach(r=>{const a=()=>{const l=r.target,u=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);return}this.shouldMeasureDuringScroll(u)&&this.resizeItem(u,this.options.measureElement(l,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var i;(i=s())==null||i.disconnect(),e=null},observe:i=>{var r;return(r=s())==null?void 0:r.observe(i,{box:"border-box"})},unobserve:i=>{var r;return(r=s())==null?void 0:r.unobserve(i)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,i])=>{typeof i>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:oi,rangeExtractor:ui,onChange:()=>{},measureElement:hi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...e}},this.notify=e=>{var s,i;(i=(s=this.options).onChange)==null||i.call(s,this,e)},this.maybeNotify=ge(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,r)=>{this.scrollAdjustments=0,this.scrollDirection=r?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=r,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const i=new Map,r=new Map;for(let a=s-1;a>=0;a--){const l=e[a];if(i.has(l.lane))continue;const u=r.get(l.lane);if(u==null||l.end>u.end?r.set(l.lane,l):l.end<u.end&&i.set(l.lane,!0),i.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=ge(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,s,i,r,a,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:i,getItemKey:r,enabled:a,lanes:l,laneAssignmentMode:u}),{key:!1}),this.getMeasurements=ge(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:i,getItemKey:r,enabled:a,lanes:l,laneAssignmentMode:u},p)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const o of this.laneAssignments.keys())o>=e&&this.laneAssignments.delete(o);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(o=>{this.itemSizeCache.set(o.key,o.size)}));const d=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const g=this.measurementsCache.slice(0,d),c=new Array(l).fill(void 0);for(let o=0;o<d;o++){const m=g[o];m&&(c[m.lane]=o)}for(let o=d;o<e;o++){const m=r(o),v=this.laneAssignments.get(o);let y,S;const _=u==="estimate"||p.has(m);if(v!==void 0&&this.options.lanes>1){y=v;const W=c[y],A=W!==void 0?g[W]:void 0;S=A?A.end+this.options.gap:s+i}else{const W=this.options.lanes===1?g[o-1]:this.getFurthestMeasurement(g,o);S=W?W.end+this.options.gap:s+i,y=W?W.lane:o%this.options.lanes,this.options.lanes>1&&_&&this.laneAssignments.set(o,y)}const L=p.get(m),K=typeof L=="number"?L:this.options.estimateSize(o),w=S+K;g[o]={index:o,start:S,size:K,end:w,key:m,lane:y},c[y]=o}return this.measurementsCache=g,g},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ge(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,i,r)=>this.range=e.length>0&&s>0?gi({measurements:e,outerSize:s,scrollOffset:i,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ge(()=>{let e=null,s=null;const i=this.calculateRange();return i&&(e=i.startIndex,s=i.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,i,r,a)=>r===null||a===null?[]:e({startIndex:r,endIndex:a,overscan:s,count:i}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,i=e.getAttribute(s);return i?parseInt(i,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const i=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(i!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,i-r),l=Math.min(this.options.count-1,i+r);return e>=a&&e<=l}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((a,l)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(l))});return}const s=this.indexFromElement(e),i=this.options.getItemKey(s),r=this.elementsCache.get(i);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(i,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,s)=>{var i;const r=this.measurementsCache[e];if(!r)return;const a=this.itemSizeCache.get(r.key)??r.size,l=s-a;l!==0&&(((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,l,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.getVirtualItems=ge(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const i=[];for(let r=0,a=e.length;r<a;r++){const l=e[r],u=s[l];i.push(u)}return i},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return ft(s[Ot(0,s.length-1,i=>ft(s[i]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,s,i=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=e>=a+r?"end":"start"),s==="center"?e+=(i-r)/2:s==="end"&&(e-=r);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const i=this.getSize(),r=this.getScrollOffset(),a=this.measurementsCache[e];if(!a)return;if(s==="auto")if(a.end>=r+i-this.options.scrollPaddingEnd)s="end";else if(a.start<=r+this.options.scrollPaddingStart)s="start";else return[r,s];if(s==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),s];const l=s==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,a.size),s]},this.scrollToOffset=(e,{align:s="start",behavior:i="auto"}={})=>{const r=this.getOffsetForAlignment(e,s),a=this.now();this.scrollState={index:null,align:s,behavior:i,startedAt:a,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:s="auto",behavior:i="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const r=this.getOffsetForIndex(e,s);if(!r)return;const[a,l]=r,u=this.now();this.scrollState={index:e,align:l,behavior:i,startedAt:u,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:s="auto"}={})=>{const i=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:r,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let i;if(s.length===0)i=this.options.paddingStart;else if(this.options.lanes===1)i=((e=s[s.length-1])==null?void 0:e.end)??0;else{const r=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&r.some(l=>l===null);){const l=s[a];r[l.lane]===null&&(r[l.lane]=l.end),a--}i=Math.max(...r.filter(l=>l!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:i})=>{this.options.scrollToFn(e,{behavior:i,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,i=s?s[0]:this.scrollState.lastTargetOffset,r=1,a=i!==this.scrollState.lastTargetOffset;if(!a&&ai(i,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=i,this.scrollState.behavior="auto",this._scrollToOffset(i,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Ot=(n,t,e,s)=>{for(;n<=t;){const i=(n+t)/2|0,r=e(i);if(r<s)n=i+1;else if(r>s)t=i-1;else return i}return n>0?n-1:0};function gi({measurements:n,outerSize:t,scrollOffset:e,lanes:s}){const i=n.length-1,r=u=>n[u].start;if(n.length<=s)return{startIndex:0,endIndex:i};let a=Ot(0,i,r,e),l=a;if(s===1)for(;l<i&&n[l].end<e+t;)l++;else if(s>1){const u=Array(s).fill(0);for(;l<i&&u.some(d=>d<e+t);){const d=n[l];u[d.lane]=d.end,l++}const p=Array(s).fill(e+t);for(;a>=0&&p.some(d=>d>=e);){const d=n[a];p[d.lane]=d.start,a--}a=Math.max(0,a-a%s),l=Math.min(i,l+(s-1-l%s))}return{startIndex:a,endIndex:l}}function mi(n){const t=new pi(f(n)),e=as(t),s=t._didMount();return ve(()=>f(n).getScrollElement(),i=>{i&&t._willUpdate()},{immediate:!0}),ve(()=>f(n),i=>{t.setOptions({...i,onChange:(r,a)=>{var l;rt(e),(l=i.onChange)==null||l.call(i,r,a)}}),t._willUpdate(),rt(e)},{immediate:!0}),rs(s),e}function vi(n){return mi(z(()=>({observeElementRect:ci,observeElementOffset:di,scrollToFn:fi,...f(n)})))}var yi=ne({__name:"ListboxVirtualizer",props:{options:{type:Array,required:!0},overscan:{type:Number,required:!1},estimateSize:{type:[Number,Function],required:!1},textContent:{type:Function,required:!1}},setup(n){const t=n,e=Je(),s=Fe(),i=ls(),{getItems:r}=ke();s.isVirtual.value=!0;const a=z(()=>{const c=i.value;if(c){const o=window.getComputedStyle(c);return{start:Number.parseFloat(o.paddingBlockStart||o.paddingTop),end:Number.parseFloat(o.paddingBlockEnd||o.paddingBottom)}}else return{start:0,end:0}}),l=vi({get scrollPaddingStart(){return a.value.start},get scrollPaddingEnd(){return a.value.end},get count(){return t.options.length},get horizontal(){return s.orientation.value==="horizontal"},estimateSize(c){return typeof t.estimateSize=="function"?t.estimateSize(c):t.estimateSize??28},getScrollElement(){return i.value},overscan:t.overscan??12}),u=z(()=>l.value.getVirtualItems().map(c=>{const o=e.default({option:t.options[c.index],virtualizer:l.value,virtualItem:c})[0],m=o.type===ae&&Array.isArray(o.children)?o.children[0]:o;return{item:c,is:fs(m,{key:`${c.key}`,"data-index":c.index,"aria-setsize":t.options.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}})}}));s.virtualFocusHook.on(c=>{const o=t.options.findIndex(m=>Array.isArray(s.modelValue.value)?le(m,s.modelValue.value[0],s.by):le(m,s.modelValue.value,s.by));o!==-1?(c?.preventDefault(),l.value.scrollToIndex(o,{align:"start"}),requestAnimationFrame(()=>{const m=ht(i.value);m&&(s.changeHighlight(m),c&&m?.focus())})):s.highlightFirstItem()}),s.virtualHighlightHook.on(c=>{const o=t.options.findIndex(m=>le(m,c,s.by));l.value.scrollToIndex(o,{align:"start"}),requestAnimationFrame(()=>{const m=ht(i.value);m&&s.changeHighlight(m)})});const p=Mt("",1e3),d=z(()=>{const c=o=>t.textContent?t.textContent(o):o?.toString().toLowerCase();return t.options.map((o,m)=>({index:m,textContent:c(o)}))});function g(c,o){if(!s.firstValue?.value||!s.multiple.value||!Array.isArray(s.modelValue.value))return;const v=r().filter(S=>S.ref.dataset.disabled!=="").find(S=>S.ref===s.highlightedElement.value)?.value;if(!v)return;let y=null;switch(o){case"prev":case"next":{y=Ie(t.options,s.firstValue.value,v);break}case"first":{y=Ie(t.options,s.firstValue.value,t.options?.[0]);break}case"last":{y=Ie(t.options,s.firstValue.value,t.options?.[t.options.length-1]);break}}s.modelValue.value=y}return s.virtualKeydownHook.on(c=>{const o=c.altKey||c.ctrlKey||c.metaKey;if(c.key==="Tab"&&!o)return;let v=os[c.key];if(o&&c.key==="a"&&s.multiple.value?(c.preventDefault(),s.modelValue.value=[...t.options],v="last"):c.shiftKey&&v&&g(c,v),["first","last"].includes(v)){c.preventDefault();const y=v==="first"?0:t.options.length-1;l.value.scrollToIndex(y),requestAnimationFrame(()=>{const S=r(),_=v==="first"?S[0]:S[S.length-1];_&&s.changeHighlight(_.ref)})}else if(!v&&!o){p.value+=c.key;const y=Number(us()?.getAttribute("data-index")),S=d.value[y].textContent,_=d.value.map(w=>w.textContent??""),L=cs(_,p.value,S),K=d.value.find(w=>w.textContent===L);K&&(l.value.scrollToIndex(K.index,{align:"start"}),requestAnimationFrame(()=>{const w=i.value.querySelector(`[data-index="${K.index}"]`);w instanceof HTMLElement&&s.changeHighlight(w)}))}}),(c,o)=>(E(),H("div",{"data-reka-virtualizer":"",style:hs({position:"relative",width:"100%",height:`${f(l).getTotalSize()}px`})},[(E(!0),H(ae,null,me(u.value,({is:m,item:v})=>(E(),B(ds(m),{key:v.index}))),128))],4))}}),bi=yi;function oe(n){return Array.isArray?Array.isArray(n):Rt(n)==="[object Array]"}function xi(n){if(typeof n=="string")return n;if(typeof n=="bigint")return n.toString();const t=n+"";return t=="0"&&1/n==-1/0?"-0":t}function Pe(n){return n==null?"":xi(n)}function U(n){return typeof n=="string"}function Ee(n){return typeof n=="number"}function Si(n){return n===!0||n===!1||Ai(n)&&Rt(n)=="[object Boolean]"}function Kt(n){return typeof n=="object"}function Ai(n){return Kt(n)&&n!==null}function X(n){return n!=null}function Ce(n){return!n.trim().length}function Rt(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}const Ci="Incorrect 'index' type",Ii=n=>`Invalid value for key ${n}`,Ei=n=>`Pattern length exceeds max of ${n}.`,_i=n=>`Missing ${n} property in key`,Mi=n=>`Property 'weight' in key '${n}' must be a positive integer`,vt=Object.prototype.hasOwnProperty;class wi{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach(s=>{const i=$t(s);this._keys.push(i),this._keyMap[i.id]=i,e+=i.weight}),this._keys.forEach(s=>{s.weight/=e})}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function $t(n){let t=null,e=null,s=null,i=1,r=null;if(U(n)||oe(n))s=n,t=yt(n),e=He(n);else{if(!vt.call(n,"name"))throw new Error(_i("name"));const a=n.name;if(s=a,vt.call(n,"weight")&&(i=n.weight,i<=0))throw new Error(Mi(a));t=yt(a),e=He(a),r=n.getFn}return{path:t,id:e,weight:i,src:s,getFn:r}}function yt(n){return oe(n)?n:n.split(".")}function He(n){return oe(n)?n.join("."):n}function ki(n,t){const e=[];let s=!1;const i=(r,a,l,u)=>{if(X(r))if(!a[l])e.push(u!==void 0?{v:r,i:u}:r);else{const p=a[l],d=r[p];if(!X(d))return;if(l===a.length-1&&(U(d)||Ee(d)||Si(d)||typeof d=="bigint"))e.push(u!==void 0?{v:Pe(d),i:u}:Pe(d));else if(oe(d)){s=!0;for(let g=0,c=d.length;g<c;g+=1)i(d[g],a,l+1,g)}else a.length&&i(d,a,l+1,u)}};return i(n,U(t)?t.split("."):t,0),s?e:e[0]}const Fi={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Li={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(n,t)=>n.score===t.score?n.idx<t.idx?-1:1:n.score<t.score?-1:1},zi={location:0,threshold:.6,distance:100},Ti={useExtendedSearch:!1,useTokenSearch:!1,getFn:ki,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},C=Object.freeze({...Li,...Fi,...zi,...Ti}),Bi=/[^ ]+/g;function Di(n=1,t=3){const e=new Map,s=Math.pow(10,t);return{get(i){const r=i.match(Bi).length;if(e.has(r))return e.get(r);const a=1/Math.pow(r,.5*n),l=parseFloat(Math.round(a*s)/s);return e.set(r,l),l},clear(){e.clear()}}}class Ze{constructor({getFn:t=C.getFn,fieldNormWeight:e=C.fieldNormWeight}={}){this.norm=Di(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach((e,s)=>{this._keysMap[e.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,U(this.docs[0])?this.docs.forEach((t,e)=>{this._addString(t,e)}):this.docs.forEach((t,e)=>{this._addObject(t,e)}),this.norm.clear())}add(t){const e=this.size();U(t)?this._addString(t,e):this._addObject(t,e)}removeAt(t){this.records.splice(t,1);for(let e=t,s=this.size();e<s;e+=1)this.records[e].i-=1}removeAll(t){for(let e=t.length-1;e>=0;e-=1)this.records.splice(t[e],1);for(let e=0,s=this.records.length;e<s;e+=1)this.records[e].i=e}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_addString(t,e){if(!X(t)||Ce(t))return;const s={v:t,i:e,n:this.norm.get(t)};this.records.push(s)}_addObject(t,e){const s={i:e,$:{}};this.keys.forEach((i,r)=>{const a=i.getFn?i.getFn(t):this.getFn(t,i.path);if(X(a)){if(oe(a)){const l=[];for(let u=0,p=a.length;u<p;u+=1){const d=a[u];if(X(d)){if(U(d)){if(!Ce(d)){const g={v:d,i:u,n:this.norm.get(d)};l.push(g)}}else if(X(d.v)){const g=U(d.v)?d.v:Pe(d.v);if(!Ce(g)){const c={v:g,i:d.i,n:this.norm.get(g)};l.push(c)}}}}s.$[r]=l}else if(U(a)&&!Ce(a)){const l={v:a,n:this.norm.get(a)};s.$[r]=l}}}),this.records.push(s)}toJSON(){return{keys:this.keys.map(({getFn:t,...e})=>e),records:this.records}}}function qt(n,t,{getFn:e=C.getFn,fieldNormWeight:s=C.fieldNormWeight}={}){const i=new Ze({getFn:e,fieldNormWeight:s});return i.setKeys(n.map($t)),i.setSources(t),i.create(),i}function Oi(n,{getFn:t=C.getFn,fieldNormWeight:e=C.fieldNormWeight}={}){const{keys:s,records:i}=n,r=new Ze({getFn:t,fieldNormWeight:e});return r.setKeys(s),r.setIndexRecords(i),r}function Ki(n=[],t=C.minMatchCharLength){const e=[];let s=-1,i=-1,r=0;for(let a=n.length;r<a;r+=1){const l=n[r];l&&s===-1?s=r:!l&&s!==-1&&(i=r-1,i-s+1>=t&&e.push([s,i]),s=-1)}return n[r-1]&&r-s>=t&&e.push([s,r-1]),e}const de=32;function Ri(n,t,e,{location:s=C.location,distance:i=C.distance,threshold:r=C.threshold,findAllMatches:a=C.findAllMatches,minMatchCharLength:l=C.minMatchCharLength,includeMatches:u=C.includeMatches,ignoreLocation:p=C.ignoreLocation}={}){if(t.length>de)throw new Error(Ei(de));const d=t.length,g=n.length,c=Math.max(0,Math.min(s,g));let o=r,m=c;const v=(k,R)=>{const D=k/d;if(p)return D;const J=Math.abs(c-R);return i?D+J/i:J?1:D},y=l>1||u,S=y?Array(g):[];let _;for(;(_=n.indexOf(t,m))>-1;){const k=v(0,_);if(o=Math.min(k,o),m=_+d,y){let R=0;for(;R<d;)S[_+R]=1,R+=1}}m=-1;let L=[],K=1,w=d+g;const W=1<<d-1;for(let k=0;k<d;k+=1){let R=0,D=w;for(;R<D;)v(k,c+D)<=o?R=D:w=D,D=Math.floor((w-R)/2+R);w=D;let J=Math.max(1,c-D+1);const ee=a?g:Math.min(c+D,g)+d,I=Array(ee+2);I[ee+1]=(1<<k)-1;for(let h=ee;h>=J;h-=1){const $=h-1,x=e[n[$]];if(y&&(S[$]=+!!x),I[h]=(I[h+1]<<1|1)&x,k&&(I[h]|=(L[h+1]|L[h])<<1|1|L[h+1]),I[h]&W&&(K=v(k,$),K<=o)){if(o=K,m=$,m<=c)break;J=Math.max(1,2*c-m)}}if(v(k+1,c)>o)break;L=I}const A={isMatch:m>=0,score:Math.max(.001,K)};if(y){const k=Ki(S,l);k.length?u&&(A.indices=k):A.isMatch=!1}return A}function $i(n){const t={};for(let e=0,s=n.length;e<s;e+=1){const i=n.charAt(e);t[i]=(t[i]||0)|1<<s-e-1}return t}function et(n){if(n.length<=1)return n;n.sort((e,s)=>e[0]-s[0]||e[1]-s[1]);const t=[n[0]];for(let e=1,s=n.length;e<s;e+=1){const i=t[t.length-1],r=n[e];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):t.push(r)}return t}const Pt={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},qi=new RegExp("["+Object.keys(Pt).join("")+"]","g"),Ae=String.prototype.normalize?n=>n.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(qi,t=>Pt[t]):n=>n;class tt{constructor(t,{location:e=C.location,threshold:s=C.threshold,distance:i=C.distance,includeMatches:r=C.includeMatches,findAllMatches:a=C.findAllMatches,minMatchCharLength:l=C.minMatchCharLength,isCaseSensitive:u=C.isCaseSensitive,ignoreDiacritics:p=C.ignoreDiacritics,ignoreLocation:d=C.ignoreLocation}={}){if(this.options={location:e,threshold:s,distance:i,includeMatches:r,findAllMatches:a,minMatchCharLength:l,isCaseSensitive:u,ignoreDiacritics:p,ignoreLocation:d},t=u?t:t.toLowerCase(),t=p?Ae(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const g=(o,m)=>{this.chunks.push({pattern:o,alphabet:$i(o),startIndex:m})},c=this.pattern.length;if(c>de){let o=0;const m=c%de,v=c-m;for(;o<v;)g(this.pattern.substr(o,de),o),o+=de;if(m){const y=c-de;g(this.pattern.substr(y),y)}}else g(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:s,includeMatches:i}=this.options;if(t=e?t:t.toLowerCase(),t=s?Ae(t):t,this.pattern===t){const v={isMatch:!0,score:0};return i&&(v.indices=[[0,t.length-1]]),v}const{location:r,distance:a,threshold:l,findAllMatches:u,minMatchCharLength:p,ignoreLocation:d}=this.options,g=[];let c=0,o=!1;this.chunks.forEach(({pattern:v,alphabet:y,startIndex:S})=>{const{isMatch:_,score:L,indices:K}=Ri(t,v,y,{location:r+S,distance:a,threshold:l,findAllMatches:u,minMatchCharLength:p,includeMatches:i,ignoreLocation:d});_&&(o=!0),c+=L,_&&K&&g.push(...K)});const m={isMatch:o,score:o?c/this.chunks.length:1};return o&&i&&(m.indices=et(g)),m}}class ue{constructor(t){this.pattern=t}static isMultiMatch(t){return bt(t,this.multiRegex)}static isSingleMatch(t){return bt(t,this.singleRegex)}search(t){return{isMatch:!1,score:1}}}function bt(n,t){const e=n.match(t);return e?e[1]:null}class Pi extends ue{constructor(t){super(t)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(t){const e=t===this.pattern;return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class Hi extends ue{constructor(t){super(t)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(t){const s=t.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,t.length-1]}}}class Vi extends ue{constructor(t){super(t)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(t){const e=t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,this.pattern.length-1]}}}class Ni extends ue{constructor(t){super(t)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(t){const e=!t.startsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class ji extends ue{constructor(t){super(t)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(t){const e=t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[t.length-this.pattern.length,t.length-1]}}}class Wi extends ue{constructor(t){super(t)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(t){const e=!t.endsWith(this.pattern);return{isMatch:e,score:e?0:1,indices:[0,t.length-1]}}}class Ht extends ue{constructor(t,{location:e=C.location,threshold:s=C.threshold,distance:i=C.distance,includeMatches:r=C.includeMatches,findAllMatches:a=C.findAllMatches,minMatchCharLength:l=C.minMatchCharLength,isCaseSensitive:u=C.isCaseSensitive,ignoreDiacritics:p=C.ignoreDiacritics,ignoreLocation:d=C.ignoreLocation}={}){super(t),this._bitapSearch=new tt(t,{location:e,threshold:s,distance:i,includeMatches:r,findAllMatches:a,minMatchCharLength:l,isCaseSensitive:u,ignoreDiacritics:p,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(t){return this._bitapSearch.searchIn(t)}}class Vt extends ue{constructor(t){super(t)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(t){let e=0,s;const i=[],r=this.pattern.length;for(;(s=t.indexOf(this.pattern,e))>-1;)e=s+r,i.push([s,e-1]);const a=!!i.length;return{isMatch:a,score:a?0:1,indices:i}}}const Ve=[Pi,Vt,Vi,Ni,Wi,ji,Hi,Ht],xt=Ve.length,Gi="\0",Ui="|";function Yi(n){const t=[],e=n.length;let s=0;for(;s<e;){for(;s<e&&n[s]===" ";)s++;if(s>=e)break;let i=s;for(;i<e&&n[i]!==" "&&n[i]!=='"';)i++;if(i<e&&n[i]==='"'){for(i++;i<e;){if(n[i]==='"'){const r=i+1;if(r>=e||n[r]===" "){i++;break}if(n[r]==="$"&&(r+1>=e||n[r+1]===" ")){i+=2;break}}i++}t.push(n.substring(s,i)),s=i}else{for(;i<e&&n[i]!==" ";)i++;t.push(n.substring(s,i)),s=i}}return t}function Qi(n,t={}){return n.replace(/\\\|/g,Gi).split(Ui).map(s=>{const i=s.replace(/\u0000/g,"|"),r=Yi(i.trim()).filter(l=>l&&!!l.trim()),a=[];for(let l=0,u=r.length;l<u;l+=1){const p=r[l];let d=!1,g=-1;for(;!d&&++g<xt;){const c=Ve[g],o=c.isMultiMatch(p);o&&(a.push(new c(o,t)),d=!0)}if(!d)for(g=-1;++g<xt;){const c=Ve[g],o=c.isSingleMatch(p);if(o){a.push(new c(o,t));break}}}return a})}const Xi=new Set([Ht.type,Vt.type]);class Ji{constructor(t,{isCaseSensitive:e=C.isCaseSensitive,ignoreDiacritics:s=C.ignoreDiacritics,includeMatches:i=C.includeMatches,minMatchCharLength:r=C.minMatchCharLength,ignoreLocation:a=C.ignoreLocation,findAllMatches:l=C.findAllMatches,location:u=C.location,threshold:p=C.threshold,distance:d=C.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:s,includeMatches:i,minMatchCharLength:r,findAllMatches:l,ignoreLocation:a,location:u,threshold:p,distance:d},t=e?t:t.toLowerCase(),t=s?Ae(t):t,this.pattern=t,this.query=Qi(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:s,isCaseSensitive:i,ignoreDiacritics:r}=this.options;t=i?t:t.toLowerCase(),t=r?Ae(t):t;let a=0;const l=[];let u=0,p=!1;for(let d=0,g=e.length;d<g;d+=1){const c=e[d];l.length=0,a=0,p=!1;for(let o=0,m=c.length;o<m;o+=1){const v=c[o],{isMatch:y,indices:S,score:_}=v.search(t);if(y){a+=1,u+=_;const L=v.constructor.type;L.startsWith("inverse")&&(p=!0),s&&(Xi.has(L)?l.push(...S):l.push(S))}else{u=0,a=0,l.length=0,p=!1;break}}if(a){const o={isMatch:!0,score:u/a};return p&&(o.hasInverse=!0),s&&(o.indices=et(l)),o}}return{isMatch:!1,score:1}}}const Ne=[];function st(...n){Ne.push(...n)}function Me(n,t){for(let e=0,s=Ne.length;e<s;e+=1){const i=Ne[e];if(i.condition(n,t))return new i(n,t)}return new tt(n,t)}const we={AND:"$and",OR:"$or"},je={PATH:"$path",PATTERN:"$val"},We=n=>!!(n[we.AND]||n[we.OR]),Zi=n=>!!n[je.PATH],en=n=>!oe(n)&&Kt(n)&&!We(n),St=n=>({[we.AND]:Object.keys(n).map(t=>({[t]:n[t]}))});function Nt(n,t,{auto:e=!0}={}){const s=i=>{if(U(i)){const u={keyId:null,pattern:i};return e&&(u.searcher=Me(i,t)),u}const r=Object.keys(i),a=Zi(i);if(!a&&r.length>1&&!We(i))return s(St(i));if(en(i)){const u=a?i[je.PATH]:r[0],p=a?i[je.PATTERN]:i[u];if(!U(p))throw new Error(Ii(u));const d={keyId:He(u),pattern:p};return e&&(d.searcher=Me(p,t)),d}const l={children:[],operator:r[0]};return r.forEach(u=>{const p=i[u];oe(p)&&p.forEach(d=>{l.children.push(s(d))})}),l};return We(n)||(n=St(n)),s(n)}function Ge(n,{ignoreFieldNorm:t=C.ignoreFieldNorm}){let e=1;return n.forEach(({key:s,norm:i,score:r})=>{const a=s?s.weight:null;e*=Math.pow(r===0&&a?Number.EPSILON:r,(a||1)*(t?1:i))}),e}function tn(n,{ignoreFieldNorm:t=C.ignoreFieldNorm}){n.forEach(e=>{e.score=Ge(e.matches,{ignoreFieldNorm:t})})}class sn{constructor(t){this.limit=t,this.heap=[]}get size(){return this.heap.length}shouldInsert(t){return this.size<this.limit||t<this.heap[0].score}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):t.score<this.heap[0].score&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(t){return this.heap.sort(t)}_bubbleUp(t){const e=this.heap;for(;t>0;){const s=t-1>>1;if(e[t].score<=e[s].score)break;const i=e[t];e[t]=e[s],e[s]=i,t=s}}_sinkDown(t){const e=this.heap,s=e.length;let i=t;do{t=i;const r=2*t+1,a=2*t+2;if(r<s&&e[r].score>e[i].score&&(i=r),a<s&&e[a].score>e[i].score&&(i=a),i!==t){const l=e[t];e[t]=e[i],e[i]=l}}while(i!==t)}}function nn(n,t){const e=n.matches;t.matches=[],X(e)&&e.forEach(s=>{if(!X(s.indices)||!s.indices.length)return;const{indices:i,value:r}=s,a={indices:i,value:r};s.key&&(a.key=s.key.src),s.idx>-1&&(a.refIndex=s.idx),t.matches.push(a)})}function rn(n,t){t.score=n.score}function an(n,t,{includeMatches:e=C.includeMatches,includeScore:s=C.includeScore}={}){const i=[];return e&&i.push(nn),s&&i.push(rn),n.map(r=>{const{idx:a}=r,l={item:t[a],refIndex:a};return i.length&&i.forEach(u=>{u(r,l)}),l})}const ln=/\b\w+\b/g;function Ue({isCaseSensitive:n=!1,ignoreDiacritics:t=!1}={}){return{tokenize(e){return n||(e=e.toLowerCase()),t&&(e=Ae(e)),e.match(ln)||[]}}}function on(n,t,e){const s=new Map,i=new Map;let r=0;function a(l,u,p,d){const g=e.tokenize(l);if(!g.length)return;r++;const c=new Map;for(const o of g)c.set(o,(c.get(o)||0)+1);for(const[o,m]of c){const v={docIdx:u,keyIdx:p,subIdx:d,tf:m};let y=s.get(o);y||(y=[],s.set(o,y)),y.push(v),i.set(o,(i.get(o)||0)+1)}}for(const l of n){const{i:u,v:p,$:d}=l;if(p!==void 0){a(p,u,-1,-1);continue}if(d)for(let g=0;g<t;g++){const c=d[g];if(c)if(Array.isArray(c))for(const o of c)a(o.v,u,g,o.i??-1);else a(c.v,u,g,-1)}}return{terms:s,fieldCount:r,df:i}}function un(n,t,e,s){const{i,v:r,$:a}=t;function l(u,p,d){const g=s.tokenize(u);if(!g.length)return;n.fieldCount++;const c=new Map;for(const o of g)c.set(o,(c.get(o)||0)+1);for(const[o,m]of c){const v={docIdx:i,keyIdx:p,subIdx:d,tf:m};let y=n.terms.get(o);y||(y=[],n.terms.set(o,y)),y.push(v),n.df.set(o,(n.df.get(o)||0)+1)}}if(r!==void 0){l(r,-1,-1);return}if(a)for(let u=0;u<e;u++){const p=a[u];if(p)if(Array.isArray(p))for(const d of p)l(d.v,u,d.i??-1);else l(p.v,u,-1)}}function At(n,t){for(const[e,s]of n.terms){const i=s.filter(a=>a.docIdx!==t),r=s.length-i.length;r>0&&(n.fieldCount-=r,n.df.set(e,(n.df.get(e)||0)-r),i.length===0?(n.terms.delete(e),n.df.delete(e)):n.terms.set(e,i))}}class ce{constructor(t,e,s){this.options={...C,...e},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new wi(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,s),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options,s=Me(t,e);return this._lastQuery=t,this._lastSearcher=s,s}setCollection(t,e){if(this._docs=t,e&&!(e instanceof Ze))throw new Error(Ci);if(this._myIndex=e||qt(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const s=Ue({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});this._invertedIndex=on(this._myIndex.records,this._myIndex.keys.length,s)}}add(t){if(X(t)&&(this._docs.push(t),this._myIndex.add(t),this._invertedIndex)){const e=this._myIndex.records[this._myIndex.records.length-1],s=Ue({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics});un(this._invertedIndex,e,this._myIndex.keys.length,s)}}remove(t=()=>!1){const e=[],s=[];for(let i=0,r=this._docs.length;i<r;i+=1)t(this._docs[i],i)&&(e.push(this._docs[i]),s.push(i));if(s.length){if(this._invertedIndex)for(const i of s)At(this._invertedIndex,i);for(let i=s.length-1;i>=0;i-=1)this._docs.splice(s[i],1);this._myIndex.removeAll(s)}return e}removeAt(t){this._invertedIndex&&At(this._invertedIndex,t);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),e}getIndex(){return this._myIndex}search(t,e){const{limit:s=-1}=e||{},{includeMatches:i,includeScore:r,shouldSort:a,sortFn:l,ignoreFieldNorm:u}=this.options;if(U(t)&&!t.trim()){let g=this._docs.map((c,o)=>({item:c,refIndex:o}));return Ee(s)&&s>-1&&(g=g.slice(0,s)),g}const p=Ee(s)&&s>0&&U(t);let d;if(p){const g=new sn(s);U(this._docs[0])?this._searchStringList(t,{heap:g,ignoreFieldNorm:u}):this._searchObjectList(t,{heap:g,ignoreFieldNorm:u}),d=g.extractSorted(l)}else d=U(t)?U(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),tn(d,{ignoreFieldNorm:u}),a&&d.sort(l),Ee(s)&&s>-1&&(d=d.slice(0,s));return an(d,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t,{heap:e,ignoreFieldNorm:s}={}){const i=this._getSearcher(t),{records:r}=this._myIndex,a=e?null:[];return r.forEach(({v:l,i:u,n:p})=>{if(!X(l))return;const{isMatch:d,score:g,indices:c}=i.searchIn(l);if(d){const o={item:l,idx:u,matches:[{score:g,value:l,norm:p,indices:c}]};e?(o.score=Ge(o.matches,{ignoreFieldNorm:s}),e.shouldInsert(o.score)&&e.insert(o)):a.push(o)}}),a}_searchLogical(t){const e=Nt(t,this.options),s=(l,u,p)=>{if(!("children"in l)){const{keyId:o,searcher:m}=l;let v;return o===null?(v=[],this._myIndex.keys.forEach((y,S)=>{v.push(...this._findMatches({key:y,value:u[S],searcher:m}))})):v=this._findMatches({key:this._keyStore.get(o),value:this._myIndex.getValueForItemAtKeyId(u,o),searcher:m}),v&&v.length?[{idx:p,item:u,matches:v}]:[]}const{children:d,operator:g}=l,c=[];for(let o=0,m=d.length;o<m;o+=1){const v=d[o],y=s(v,u,p);if(y.length)c.push(...y);else if(g===we.AND)return[]}return c},i=this._myIndex.records,r=new Map,a=[];return i.forEach(({$:l,i:u})=>{if(X(l)){const p=s(e,l,u);p.length&&(r.has(u)||(r.set(u,{idx:u,item:l,matches:[]}),a.push(r.get(u))),p.forEach(({matches:d})=>{r.get(u).matches.push(...d)}))}}),a}_searchObjectList(t,{heap:e,ignoreFieldNorm:s}={}){const i=this._getSearcher(t),{keys:r,records:a}=this._myIndex,l=e?null:[];return a.forEach(({$:u,i:p})=>{if(!X(u))return;const d=[];let g=!1,c=!1;if(r.forEach((o,m)=>{const v=this._findMatches({key:o,value:u[m],searcher:i});v.length?(d.push(...v),v[0].hasInverse&&(c=!0)):g=!0}),!(c&&g)&&d.length){const o={idx:p,item:u,matches:d};e?(o.score=Ge(o.matches,{ignoreFieldNorm:s}),e.shouldInsert(o.score)&&e.insert(o)):l.push(o)}}),l}_findMatches({key:t,value:e,searcher:s}){if(!X(e))return[];const i=[];if(oe(e))e.forEach(({v:r,i:a,n:l})=>{if(!X(r))return;const{isMatch:u,score:p,indices:d,hasInverse:g}=s.searchIn(r);u&&i.push({score:p,key:t,value:r,idx:a,norm:l,indices:d,hasInverse:g})});else{const{v:r,n:a}=e,{isMatch:l,score:u,indices:p,hasInverse:d}=s.searchIn(r);l&&i.push({score:u,key:t,value:r,norm:a,indices:p,hasInverse:d})}return i}}class cn{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=Ue({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics});const s=this.analyzer.tokenize(t),i=e._invertedIndex,{df:r,fieldCount:a}=i;this.termSearchers=[],this.idfWeights=[];for(const l of s){this.termSearchers.push(new tt(l,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const u=r.get(l)||0,p=Math.log(1+(a-u+.5)/(u+.5));this.idfWeights.push(p)}}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let s=0,i=0,r=0;for(let u=0;u<this.termSearchers.length;u++){const p=this.termSearchers[u].searchIn(t),d=this.idfWeights[u];i+=d,p.isMatch&&(r++,s+=d*(1-p.score),p.indices&&e.push(...p.indices))}if(r===0)return{isMatch:!1,score:1};const a=i>0?1-s/i:0,l={isMatch:!0,score:Math.max(.001,a)};return this.options.includeMatches&&e.length&&(l.indices=et(e)),l}}ce.version="7.3.0";ce.createIndex=qt;ce.parseIndex=Oi;ce.config=C;ce.match=function(n,t,e){return Me(n,{...C,...e}).searchIn(t)};ce.parseQuery=Nt;st(Ji);st(cn);ce.use=function(...n){n.forEach(t=>st(t))};function dn(n,t,e){const s=()=>{var r,a;return new ce((r=ie(t))!==null&&r!==void 0?r:[],(a=ie(e))===null||a===void 0?void 0:a.fuseOptions)},i=te(s());return ve(()=>{var r;return(r=ie(e))===null||r===void 0?void 0:r.fuseOptions},()=>{i.value=s()},{deep:!0}),ve(()=>ie(t),r=>{i.value.setCollection(r)},{deep:!0}),{fuse:i,results:z(()=>{const r=ie(e);if(r?.matchAllWhenSearchEmpty&&!ie(n))return ie(t).map((l,u)=>({item:l,refIndex:u}));const a=r?.resultLimit;return i.value.search(ie(n),a?{limit:a}:void 0)})}}const hn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function fn(n){return n.replace(/[&<>"']/g,t=>hn[t])}function pn(n){return/&(?:amp|lt|gt|quot|#39);/.test(n)}function De(n){return pn(n)?n:fn(n)}function gn(n,t){let e="",s=0,i=!1;for(let r=n.length-1;r>=0;r--){if(n[r]===">")i=!0;else if(n[r]==="<"){i=!1,e=n[r]+e;continue}if(i||s++,s<=t)e=n[r]+e;else{e="..."+e;break}}return e}function Ct(n,t,e,s){function i(r,a=[]){r=r||"";let l="",u=0;a.forEach(d=>{if(d.length===2&&d[0]===d[1])return;const g=d[1]+1,c=g-d[0]>=t.length;l+=[De(r.substring(u,d[0])),c&&"<mark>",De(r.substring(d[0],g)),c&&"</mark>"].filter(Boolean).join(""),u=g}),l+=De(r.substring(u));const p=l.indexOf("<mark>");return p!==-1&&(l=gn(l,l.length-p)),l}if(n.matches?.length){for(const r of n.matches)if(!(e&&r.key!==e)&&!s?.includes(r.key))return i(r.value,r.indices)}}function mn(n,t){if(typeof n!="object"||n===null)return!1;const e=se(n,t);return e!=null&&e!==""}function It(n,t){return t?{xs:44,sm:48,md:52,lg:56,xl:60}[n]:{xs:24,sm:28,md:32,lg:36,xl:40}[n]}function vn(n,t,e,s){const i=It(t,!0),r=It(t,!1);return s?()=>i:e?a=>mn(n[a],e)?i:r:()=>r}const yn={slots:{root:"flex flex-col min-h-0 min-w-0 divide-y divide-default",input:"",close:"",back:"p-0",content:"relative overflow-hidden flex flex-col",footer:"p-1",viewport:"relative scroll-py-1 overflow-y-auto flex-1 focus:outline-none",group:"p-1 isolate",empty:"text-center text-muted",label:"font-semibold text-highlighted",item:"group relative w-full flex items-start select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75",itemLeadingIcon:"shrink-0",itemLeadingAvatar:"shrink-0",itemLeadingAvatarSize:"",itemLeadingChip:"shrink-0",itemLeadingChipSize:"",itemTrailing:"ms-auto inline-flex items-center",itemTrailingIcon:"shrink-0",itemTrailingHighlightedIcon:"shrink-0 text-dimmed hidden group-data-highlighted:inline-flex",itemTrailingKbds:"hidden lg:inline-flex items-center shrink-0",itemTrailingKbdsSize:"",itemWrapper:"flex-1 flex flex-col text-start min-w-0",itemLabel:"truncate space-x-1 text-dimmed",itemDescription:"truncate text-muted",itemLabelBase:"text-highlighted [&>mark]:text-inverted [&>mark]:bg-primary",itemLabelPrefix:"text-default",itemLabelSuffix:"text-dimmed [&>mark]:text-inverted [&>mark]:bg-primary"},variants:{virtualize:{true:{viewport:"p-1 isolate"},false:{viewport:"divide-y divide-default"}},size:{xs:{input:"[&>input]:h-10",empty:"py-3 text-xs",label:"p-1 text-[10px]/3 gap-1",item:"p-1 text-xs gap-1",itemLeadingIcon:"size-4",itemLeadingAvatarSize:"3xs",itemLeadingChip:"size-4",itemLeadingChipSize:"sm",itemTrailing:"gap-1",itemTrailingIcon:"size-4",itemTrailingHighlightedIcon:"size-4",itemTrailingKbds:"gap-0.5",itemTrailingKbdsSize:"sm"},sm:{input:"[&>input]:h-11",empty:"py-4 text-xs",label:"p-1.5 text-[10px]/3 gap-1.5",item:"p-1.5 text-xs gap-1.5",itemLeadingIcon:"size-4",itemLeadingAvatarSize:"3xs",itemLeadingChip:"size-4",itemLeadingChipSize:"sm",itemTrailing:"gap-1.5",itemTrailingIcon:"size-4",itemTrailingHighlightedIcon:"size-4",itemTrailingKbds:"gap-0.5",itemTrailingKbdsSize:"sm"},md:{input:"[&>input]:h-12",empty:"py-6 text-sm",label:"p-1.5 text-xs gap-1.5",item:"p-1.5 text-sm gap-1.5",itemLeadingIcon:"size-5",itemLeadingAvatarSize:"2xs",itemLeadingChip:"size-5",itemLeadingChipSize:"md",itemTrailing:"gap-1.5",itemTrailingIcon:"size-5",itemTrailingHighlightedIcon:"size-5",itemTrailingKbds:"gap-0.5",itemTrailingKbdsSize:"md"},lg:{input:"[&>input]:h-13",empty:"py-7 text-sm",label:"p-2 text-xs gap-2",item:"p-2 text-sm gap-2",itemLeadingIcon:"size-5",itemLeadingAvatarSize:"2xs",itemLeadingChip:"size-5",itemLeadingChipSize:"md",itemTrailing:"gap-2",itemTrailingIcon:"size-5",itemTrailingHighlightedIcon:"size-5",itemTrailingKbds:"gap-0.5",itemTrailingKbdsSize:"md"},xl:{input:"[&>input]:h-14",empty:"py-8 text-base",label:"p-2 text-sm gap-2",item:"p-2 text-base gap-2",itemLeadingIcon:"size-6",itemLeadingAvatarSize:"xs",itemLeadingChip:"size-6",itemLeadingChipSize:"lg",itemTrailing:"gap-2",itemTrailingIcon:"size-6",itemTrailingHighlightedIcon:"size-6",itemTrailingKbds:"gap-0.5",itemTrailingKbdsSize:"lg"}},active:{true:{item:"text-highlighted before:bg-elevated",itemLeadingIcon:"text-default"},false:{item:["text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-data-disabled:before:bg-elevated/50","transition-colors before:transition-colors"],itemLeadingIcon:["text-dimmed group-data-highlighted:not-group-data-disabled:text-default","transition-colors"]}},loading:{true:{itemLeadingIcon:"animate-spin"}}},defaultVariants:{size:"md"}},bn=["innerHTML"],xn=["innerHTML"],Sn=Object.assign({inheritAttrs:!1},{__name:"UCommandPalette",props:$e({as:{type:null,required:!1},size:{type:null,required:!1},icon:{type:null,required:!1},trailingIcon:{type:null,required:!1},selectedIcon:{type:null,required:!1},childrenIcon:{type:null,required:!1},placeholder:{type:String,required:!1},autofocus:{type:Boolean,required:!1,default:!0},close:{type:[Boolean,Object],required:!1},closeIcon:{type:null,required:!1},back:{type:[Boolean,Object],required:!1,default:!0},backIcon:{type:null,required:!1},input:{type:[Boolean,Object],required:!1,default:!0},groups:{type:Array,required:!1},fuse:{type:Object,required:!1},virtualize:{type:[Boolean,Object],required:!1,default:!1},valueKey:{type:null,required:!1},labelKey:{type:null,required:!1,default:"label"},descriptionKey:{type:null,required:!1,default:"description"},preserveGroupOrder:{type:Boolean,required:!1,default:!1},class:{type:null,required:!1},ui:{type:Object,required:!1},multiple:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1},highlightOnHover:{type:Boolean,required:!1,default:!0},selectionBehavior:{type:String,required:!1},by:{type:[String,Function],required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1}},{searchTerm:{type:String,default:""},searchTermModifiers:{}}),emits:$e(["update:modelValue","highlight","entryFocus","leave","update:open"],["update:searchTerm"]),setup(n,{emit:t}){const e=n,s=t,i=Je(),r=Ft(n,"searchTerm",{type:String,default:""}),{t:a}=Lt(),l=zt(),u=Tt("commandPalette",e),p=ps(Ke(e,"as","disabled","multiple","modelValue","defaultValue","highlightOnHover","by"),s),d=Cs(()=>e.virtualize?qe(typeof e.virtualize=="boolean"?{}:e.virtualize,{estimateSize:vn(A.value,"md",e.descriptionKey,!!i["item-description"])}):!1),[g,c]=gs({props:{item:{type:Object,required:!0},group:{type:Object,required:!1},index:{type:Number,required:!1}}}),o=z(()=>_e({extend:_e(yn),...l.ui?.commandPalette||{}})({size:e.size,virtualize:!!e.virtualize})),m=z(()=>qe({},e.fuse,{fuseOptions:{ignoreLocation:!0,threshold:.1,keys:[e.labelKey,"suffix"]},resultLimit:12,matchAllWhenSearchEmpty:!0})),v=te([]),y=z(()=>v.value[v.value.length-1]?.placeholder||e.placeholder||a("commandPalette.placeholder")),S=z(()=>v.value?.length?[v.value[v.value.length-1]]:e.groups),_=z(()=>S.value?.filter(I=>I.id?!I.ignoreFilter:(console.warn("[@nuxt/ui] CommandPalette group is missing an `id` property"),!1))?.flatMap(I=>I.items?.map(P=>({...P,group:I.id}))||[])||[]),{results:L}=dn(r,_,m),K=ms(L,16,!0);function w(I,P){let h=P;return I?.postFilter&&typeof I.postFilter=="function"&&(h=I.postFilter(r.value,h)),{...I,items:h.slice(0,m.value.resultLimit).map($=>({...$,labelHtml:Ct($,r.value,e.labelKey),suffixHtml:Ct($,r.value,void 0,[e.labelKey])}))}}const W=z(()=>{const I=S.value,P=K.value.reduce((x,T)=>{const{item:Y,matches:G}=T;return Y.group&&(x[Y.group]||=[],x[Y.group]?.push({...Y,matches:G})),x},{});if(e.preserveGroupOrder){const x=[];for(const T of I||[]){if(!T.items?.length)continue;const Y=T.ignoreFilter?T.items:P[T.id];if(!Y?.length)continue;const G=w(T,Y);G.items?.length&&x.push(G)}return x}const h=Object.entries(P).map(([x,T])=>{const Y=I?.find(fe=>fe.id===x);if(!Y)return;const G=w(Y,T);return G.items?.length?G:void 0}).filter(x=>!!x);return(I?.map((x,T)=>({...x,index:T}))?.filter(x=>x.ignoreFilter&&x.items?.length)?.map(x=>({...w(x,x.items||[]),index:x.index}))?.filter(x=>x.items?.length)||[]).reduce((x,T)=>(x.splice(T.index,0,T),x),[...h])}),A=z(()=>W.value.flatMap(I=>I.items||[])),k=Bt("rootRef");function R(I){I.children?.length&&(v.value.push({id:`history-${v.value.length}`,label:I.label,slot:I.slot,placeholder:I.placeholder,items:I.children}),r.value="",k.value?.highlightFirstItem())}function D(){v.value.length&&(v.value.pop(),r.value="",k.value?.highlightFirstItem())}function J(){r.value||D()}function ee(I,P){P.children?.length?(I.preventDefault(),R(P)):P.onSelect?.(I)}return(I,P)=>(E(),H(ae,null,[Z(f(g),null,{default:O(({item:h,index:$,group:x})=>[Z(vs,V(f(ys)(h),{custom:""}),{default:O(({active:T,...Y})=>[Z(f(ii),{value:e.valueKey?f(se)(h,e.valueKey):f(Re)(h,["matches","group","onSelect","labelHtml","suffixHtml","children"]),disabled:h.disabled,"as-child":"",onSelect:G=>ee(G,h)},{default:O(()=>[Z(bs,V(Y,{"data-slot":"item",class:o.value.item({class:[f(u)?.item,h.ui?.item,h.class],active:T||h.active})}),{default:O(()=>[j(I.$slots,h.slot||x?.slot||"item",{item:h,index:$,ui:o.value},()=>[j(I.$slots,h.slot?`${h.slot}-leading`:x?.slot?`${x.slot}-leading`:"item-leading",{item:h,index:$,ui:o.value},()=>[h.loading?(E(),B(Se,{key:0,name:n.loadingIcon||f(l).ui.icons.loading,"data-slot":"itemLeadingIcon",class:q(o.value.itemLeadingIcon({class:[f(u)?.itemLeadingIcon,h.ui?.itemLeadingIcon],loading:!0}))},null,8,["name","class"])):h.icon?(E(),B(Se,{key:1,name:h.icon,"data-slot":"itemLeadingIcon",class:q(o.value.itemLeadingIcon({class:[f(u)?.itemLeadingIcon,h.ui?.itemLeadingIcon],active:T||h.active}))},null,8,["name","class"])):h.avatar?(E(),B(xs,V({key:2,size:h.ui?.itemLeadingAvatarSize||f(u)?.itemLeadingAvatarSize||o.value.itemLeadingAvatarSize()},h.avatar,{"data-slot":"itemLeadingAvatar",class:o.value.itemLeadingAvatar({class:[f(u)?.itemLeadingAvatar,h.ui?.itemLeadingAvatar],active:T||h.active})}),null,16,["size","class"])):h.chip?(E(),B(Ss,V({key:3,size:h.ui?.itemLeadingChipSize||f(u)?.itemLeadingChipSize||o.value.itemLeadingChipSize(),inset:"",standalone:""},h.chip,{"data-slot":"itemLeadingChip",class:o.value.itemLeadingChip({class:[f(u)?.itemLeadingChip,h.ui?.itemLeadingChip],active:T||h.active})}),null,16,["size","class"])):Q("",!0)]),h.prefix||h.labelHtml||f(se)(h,e.labelKey)||h.suffixHtml||h.suffix||i[h.slot?`${h.slot}-label`:x?.slot?`${x.slot}-label`:"item-label"]||f(se)(h,e.descriptionKey)||i[h.slot?`${h.slot}-description`:x?.slot?`${x.slot}-description`:"item-description"]?(E(),H("span",{key:0,"data-slot":"itemWrapper",class:q(o.value.itemWrapper({class:[f(u)?.itemWrapper,h.ui?.itemWrapper]}))},[at("span",{"data-slot":"itemLabel",class:q(o.value.itemLabel({class:[f(u)?.itemLabel,h.ui?.itemLabel],active:T||h.active}))},[j(I.$slots,h.slot?`${h.slot}-label`:x?.slot?`${x.slot}-label`:"item-label",{item:h,index:$,ui:o.value},()=>[h.prefix?(E(),H("span",{key:0,"data-slot":"itemLabelPrefix",class:q(o.value.itemLabelPrefix({class:[f(u)?.itemLabelPrefix,h.ui?.itemLabelPrefix]}))},pe(h.prefix),3)):Q("",!0),h.labelHtml?(E(),H("span",{key:1,"data-slot":"itemLabelBase",class:q(o.value.itemLabelBase({class:[f(u)?.itemLabelBase,h.ui?.itemLabelBase],active:T||h.active})),innerHTML:h.labelHtml},null,10,bn)):(E(),H("span",{key:2,"data-slot":"itemLabelBase",class:q(o.value.itemLabelBase({class:[f(u)?.itemLabelBase,h.ui?.itemLabelBase],active:T||h.active}))},pe(f(se)(h,e.labelKey)),3)),h.suffixHtml?(E(),H("span",{key:3,"data-slot":"itemLabelSuffix",class:q(o.value.itemLabelSuffix({class:[f(u)?.itemLabelSuffix,h.ui?.itemLabelSuffix],active:T||h.active})),innerHTML:h.suffixHtml},null,10,xn)):h.suffix?(E(),H("span",{key:4,"data-slot":"itemLabelSuffix",class:q(o.value.itemLabelSuffix({class:[f(u)?.itemLabelSuffix,h.ui?.itemLabelSuffix],active:T||h.active}))},pe(h.suffix),3)):Q("",!0)])],2),f(se)(h,e.descriptionKey)||i[h.slot?`${h.slot}-description`:x?.slot?`${x.slot}-description`:"item-description"]?(E(),H("span",{key:0,"data-slot":"itemDescription",class:q(o.value.itemDescription({class:[f(u)?.itemDescription,h.ui?.itemDescription]}))},[j(I.$slots,h.slot?`${h.slot}-description`:x?.slot?`${x.slot}-description`:"item-description",{item:h,index:$,ui:o.value},()=>[Be(pe(f(se)(h,e.descriptionKey)),1)])],2)):Q("",!0)],2)):Q("",!0),at("span",{"data-slot":"itemTrailing",class:q(o.value.itemTrailing({class:[f(u)?.itemTrailing,h.ui?.itemTrailing]}))},[j(I.$slots,h.slot?`${h.slot}-trailing`:x?.slot?`${x.slot}-trailing`:"item-trailing",{item:h,index:$,ui:o.value},()=>[h.children&&h.children.length>0?(E(),B(Se,{key:0,name:n.childrenIcon||f(l).ui.icons.chevronRight,"data-slot":"itemTrailingIcon",class:q(o.value.itemTrailingIcon({class:[f(u)?.itemTrailingIcon,h.ui?.itemTrailingIcon]}))},null,8,["name","class"])):h.kbds?.length?(E(),H("span",{key:1,"data-slot":"itemTrailingKbds",class:q(o.value.itemTrailingKbds({class:[f(u)?.itemTrailingKbds,h.ui?.itemTrailingKbds]}))},[(E(!0),H(ae,null,me(h.kbds,(G,fe)=>(E(),B(As,V({key:fe,size:h.ui?.itemTrailingKbdsSize||f(u)?.itemTrailingKbdsSize||o.value.itemTrailingKbdsSize()},{ref_for:!0},typeof G=="string"?{value:G}:G),null,16,["size"]))),128))],2)):x?.highlightedIcon?(E(),B(Se,{key:2,name:x.highlightedIcon,"data-slot":"itemTrailingHighlightedIcon",class:q(o.value.itemTrailingHighlightedIcon({class:[f(u)?.itemTrailingHighlightedIcon,h.ui?.itemTrailingHighlightedIcon]}))},null,8,["name","class"])):Q("",!0)]),h.children?.length?Q("",!0):(E(),B(f(ri),{key:0,"as-child":""},{default:O(()=>[Z(Se,{name:n.selectedIcon||f(l).ui.icons.check,"data-slot":"itemTrailingIcon",class:q(o.value.itemTrailingIcon({class:[f(u)?.itemTrailingIcon,h.ui?.itemTrailingIcon]}))},null,8,["name","class"])]),_:2},1024))],2)])]),_:2},1040,["class"])]),_:2},1032,["value","disabled","onSelect"])]),_:2},1040)]),_:3}),Z(f(Hs),V({...f(p),...I.$attrs},{ref_key:"rootRef",ref:k,"selection-behavior":n.selectionBehavior,"data-slot":"root",class:o.value.root({class:[f(u)?.root,e.class]})}),{default:O(()=>[n.input?(E(),B(f(Ws),{key:0,modelValue:r.value,"onUpdate:modelValue":P[1]||(P[1]=h=>r.value=h),"as-child":""},{default:O(()=>[Z(Ts,V({variant:"none",size:n.size},typeof e.input=="object"?e.input:{},{placeholder:y.value,autofocus:n.autofocus,loading:n.loading,"loading-icon":n.loadingIcon,"trailing-icon":n.trailingIcon,icon:n.icon||f(l).ui.icons.search,"data-slot":"input",class:o.value.input({class:f(u)?.input}),onKeydown:ye(J,["backspace"])}),Dt({_:2},[v.value?.length&&(n.back||i.back)?{name:"leading",fn:O(()=>[j(I.$slots,"back",{ui:o.value},()=>[Z(lt,V({size:n.size,icon:n.backIcon||f(l).ui.icons.arrowLeft,color:"neutral",variant:"link","aria-label":f(a)("commandPalette.back")},typeof n.back=="object"?n.back:{},{"data-slot":"back",class:o.value.back({class:f(u)?.back}),onClick:D}),null,16,["size","icon","aria-label","class"])])]),key:"0"}:void 0,n.close||i.close?{name:"trailing",fn:O(()=>[j(I.$slots,"close",{ui:o.value},()=>[n.close?(E(),B(lt,V({key:0,size:n.size,icon:n.closeIcon||f(l).ui.icons.close,color:"neutral",variant:"ghost","aria-label":f(a)("commandPalette.close")},typeof n.close=="object"?n.close:{},{"data-slot":"close",class:o.value.close({class:f(u)?.close}),onClick:P[0]||(P[0]=h=>s("update:open",!1))}),null,16,["size","icon","aria-label","class"])):Q("",!0)])]),key:"1"}:void 0]),1040,["size","placeholder","autofocus","loading","loading-icon","trailing-icon","icon","class"])]),_:3},8,["modelValue"])):Q("",!0),Z(f(Ns),{"data-slot":"content",class:q(o.value.content({class:f(u)?.content}))},{default:O(()=>[W.value?.length?(E(),H("div",{key:0,role:"presentation","data-slot":"viewport",class:q(o.value.viewport({class:f(u)?.viewport}))},[n.virtualize?(E(),B(f(bi),V({key:0,options:A.value,"text-content":h=>f(se)(h,e.labelKey)},d.value),{default:O(({option:h,virtualItem:$})=>[Z(f(c),{item:h,index:$.index},null,8,["item","index"])]),_:1},16,["options","text-content"])):(E(!0),H(ae,{key:1},me(W.value,h=>(E(),B(f(Qs),{key:`group-${h.id}`,"data-slot":"group",class:q(o.value.group({class:f(u)?.group}))},{default:O(()=>[f(se)(h,e.labelKey)?(E(),B(f(Js),{key:0,"data-slot":"label",class:q(o.value.label({class:f(u)?.label}))},{default:O(()=>[Be(pe(f(se)(h,e.labelKey)),1)]),_:2},1032,["class"])):Q("",!0),(E(!0),H(ae,null,me(h.items,($,x)=>(E(),B(f(c),{key:`group-${h.id}-${x}`,item:$,index:x,group:h},null,8,["item","index","group"]))),128))]),_:2},1032,["class"]))),128))],2)):(E(),H("div",{key:1,"data-slot":"empty",class:q(o.value.empty({class:f(u)?.empty}))},[j(I.$slots,"empty",{searchTerm:r.value},()=>[Be(pe(r.value?f(a)("commandPalette.noMatch",{searchTerm:r.value}):f(a)("commandPalette.noData")),1)])],2))]),_:3},8,["class"]),i.footer?(E(),H("div",{key:1,"data-slot":"footer",class:q(o.value.footer({class:f(u)?.footer}))},[j(I.$slots,"footer",{ui:o.value})],2)):Q("",!0)]),_:3},16,["selection-behavior","class"])],64))}}),An={slots:{modal:"",input:""},variants:{fullscreen:{false:{modal:"sm:max-w-3xl h-full sm:h-[28rem]"}},size:{xs:{},sm:{},md:{},lg:{},xl:{}}},defaultVariants:{size:"md"}},Cn=/^[^-]+.*-.*[^-]+$/,In=/^[^_]+.*_.*[^_]+$/,Et=["arrowleft","arrowright","arrowup","arrowright","tab","escape","enter","backspace"];function Oe(n){return/^[a-z]$/i.test(n)?`Key${n.toUpperCase()}`:/^\d$/.test(n)?`Digit${n}`:/^f\d+$/i.test(n)?n.toUpperCase():{space:"Space",enter:"Enter",escape:"Escape",tab:"Tab",backspace:"Backspace",delete:"Delete",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight"}[n.toLowerCase()]||n}function En(n,t={}){const e=te([]),s=()=>{e.value.splice(0,e.value.length)},i=Is(s,t.chainDelay??800),{macOS:r}=Es(),a=Ms(),l=t.layoutIndependent??!1,u=Et.map(c=>Oe(c)),p=c=>{if(!c.key)return;const o=l?/^Key[A-Z]$/i.test(c.code):/^[a-z]{1}$/i.test(c.key),m=l?u.includes(c.code):Et.includes(c.key.toLowerCase());let v;if(e.value.push(l?c.code:c.key),e.value.length>=2){v=e.value.slice(-2).join("-");for(const y of g.value.filter(S=>S.chained))if(y.key===v){y.enabled&&(c.preventDefault(),y.handler(c)),s();return}}for(const y of g.value.filter(S=>!S.chained)){if(l){if(c.code!==y.key)continue}else if(c.key.toLowerCase()!==y.key)continue;if(c.metaKey===y.metaKey&&c.ctrlKey===y.ctrlKey&&c.altKey===y.altKey&&!((o||m||y.shiftKey||c.shiftKey&&(c.metaKey||c.ctrlKey))&&c.shiftKey!==y.shiftKey)){y.enabled&&(c.preventDefault(),y.handler(c)),s();return}}i()},d=z(()=>{const c=a.value?.tagName,o=a.value?.contentEditable;return c==="INPUT"||c==="TEXTAREA"||o==="true"||o==="plaintext-only"?a.value?.name||!0:!1}),g=z(()=>Object.entries(ie(n)).map(([c,o])=>{if(!o)return null;let m;c.includes("-")&&c!=="-"&&!c.includes("_")&&!c.match(Cn)?.length&&console.trace(`[Shortcut] Invalid key: "${c}"`),c.includes("_")&&c!=="_"&&!c.match(In)?.length&&console.trace(`[Shortcut] Invalid key: "${c}"`);const v=c.includes("-")&&c!=="-"&&!c.includes("_");if(v)l?m={key:c.split("-").map(_=>Oe(_)).join("-"),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1}:m={key:c.toLowerCase(),metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1};else{const S=c.toLowerCase().split("_").map(L=>L);let _=S.filter(L=>!["meta","command","ctrl","shift","alt","option"].includes(L)).join("_");l&&(_=Oe(_)),m={key:_,metaKey:S.includes("meta")||S.includes("command"),ctrlKey:S.includes("ctrl"),shiftKey:S.includes("shift"),altKey:S.includes("alt")||S.includes("option")}}if(m.chained=v,!r.value&&m.metaKey&&!m.ctrlKey&&(m.metaKey=!1,m.ctrlKey=!0),typeof o=="function"?m.handler=o:typeof o=="object"&&(m={...m,handler:o.handler}),!m.handler)return console.trace("[Shortcut] Invalid value"),null;let y=!0;return o.usingInput?typeof o.usingInput=="string"&&(y=d.value===o.usingInput):y=!d.value,m.enabled=y,m}).filter(Boolean));return _s("keydown",p)}const kn={__name:"UContentSearch",props:$e({size:{type:null,required:!1},icon:{type:null,required:!1},placeholder:{type:String,required:!1},autofocus:{type:Boolean,required:!1},loading:{type:Boolean,required:!1},loadingIcon:{type:null,required:!1},close:{type:[Boolean,Object],required:!1,default:!0},closeIcon:{type:null,required:!1},shortcut:{type:String,required:!1,default:"meta_k"},links:{type:Array,required:!1},navigation:{type:Array,required:!1},groups:{type:Array,required:!1},files:{type:Array,required:!1},fuse:{type:Object,required:!1},colorMode:{type:Boolean,required:!1,default:!0},class:{type:null,required:!1},ui:{type:Object,required:!1},title:{type:String,required:!1},description:{type:String,required:!1},overlay:{type:Boolean,required:!1},transition:{type:Boolean,required:!1},content:{type:Object,required:!1},dismissible:{type:Boolean,required:!1},fullscreen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1},portal:{type:[Boolean,String],required:!1,skipCheck:!0}},{searchTerm:{type:String,default:""},searchTermModifiers:{}}),emits:["update:searchTerm"],setup(n,{expose:t}){const e=n,s=Je(),i=Ft(n,"searchTerm",{type:String,default:""}),{t:r}=Lt(),{open:a,mapNavigationItems:l,postFilter:u}=ws(),p=ks(),d=zt(),g=Tt("contentSearch",e),c=ot(Ke(e,"size","icon","placeholder","autofocus","loading","loadingIcon","close","closeIcon")),o=ot(Ke(e,"overlay","transition","content","dismissible","fullscreen","modal","portal")),m=()=>Re(s,["content"]),v=z(()=>qe({},e.fuse,{fuseOptions:{includeMatches:!0}})),y=z(()=>_e({extend:_e(An),...d.ui?.contentSearch||{}})({size:e.size,fullscreen:e.fullscreen})),S=Bt("commandPaletteRef"),_=z(()=>e.links?.length?e.links.flatMap(A=>[{...A,suffix:A.description,description:void 0,icon:A.icon||d.ui.icons.file,children:void 0},...A.children?.map(k=>({...k,prefix:A.label+" >",suffix:k.description,description:void 0,icon:k.icon||A.icon||d.ui.icons.file}))||[]]):[]),L=z(()=>e.navigation?.length?e.navigation.some(A=>!!A.children?.length)?e.navigation.map(A=>({id:A.path,label:A.title,items:l(A.children||[],e.files||[]),postFilter:u})):[{id:"docs",items:l(e.navigation,e.files||[]),postFilter:u}]:[]),K=z(()=>!e.colorMode||p?.forced?null:{id:"theme",label:r("contentSearch.theme"),items:[{label:r("colorMode.system"),icon:d.ui.icons.system,active:p.preference==="system",onSelect:()=>{p.preference="system"}},{label:r("colorMode.light"),icon:d.ui.icons.light,active:p.preference==="light",onSelect:()=>{p.preference="light"}},{label:r("colorMode.dark"),icon:d.ui.icons.dark,active:p.preference==="dark",onSelect:()=>{p.preference="dark"}}]}),w=z(()=>{const A=[];return _.value.length&&A.push({id:"links",label:r("contentSearch.links"),items:_.value}),A.push(...L.value),A.push(...e.groups||[]),K.value&&A.push(K.value),A});function W(A){A.disabled||(a.value=!1,i.value="")}return En({[e.shortcut]:{usingInput:!0,handler:()=>a.value=!a.value}}),t({commandPaletteRef:S}),(A,k)=>(E(),B(zs,V({open:f(a),"onUpdate:open":k[2]||(k[2]=R=>Ls(a)?a.value=R:null),title:n.title||f(r)("contentSearch.title"),description:n.description||f(r)("contentSearch.description")},f(o),{"data-slot":"modal",class:y.value.modal({class:[f(g)?.modal,e.class]})}),{content:O(R=>[j(A.$slots,"content",ut(ct(R)),()=>[Z(Sn,V({ref_key:"commandPaletteRef",ref:S,"search-term":i.value,"onUpdate:searchTerm":k[0]||(k[0]=D=>i.value=D)},f(c),{groups:w.value,fuse:v.value,input:{fixed:!0},ui:f(Fs)(f(Re)(y.value,["modal"]),f(g)),"onUpdate:modelValue":W,"onUpdate:open":k[1]||(k[1]=D=>a.value=D)}),Dt({_:2},[me(m(),(D,J)=>({name:J,fn:O(ee=>[j(A.$slots,J,ut(ct(ee)))])}))]),1040,["search-term","groups","fuse","ui"])])]),_:3},16,["open","title","description","class"]))}};export{kn as default};