import{w as g}from"./entry.CFTpQVQ7.js";import{al as p,y as I,A as i,am as y,an as A}from"./VennDiagram.svelte_svelte_type_style_lang.BhK-BAty.js";import{T as w}from"./scheduler.DvKrEcvj.js";function O(e){e.setAttribute("data-highlighted","")}function R(e){e.removeAttribute("data-highlighted")}function v(e,t=500){let r=null;return function(...a){const o=()=>{r=null,e(...a)};r&&clearTimeout(r),r=setTimeout(o,t)}}function T(e){p&&I(1).then(()=>{const t=document.activeElement;!i(t)||t===e||(t.tabIndex=-1,e&&(e.tabIndex=0,e.focus()))})}function b(){return Array.from(document.querySelectorAll('a[href]:not([tabindex="-1"]), button:not([disabled]):not([tabindex="-1"]), input:not([disabled]):not([tabindex="-1"]), select:not([disabled]):not([tabindex="-1"]), textarea:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])'))}function N(e){const t=b(),a=t.indexOf(e)+1,o=t[a];return a=0&&i(o)?o:null}const C=new Set(["Shift","Control","Alt","Meta","CapsLock","NumLock"]),S={onMatch:T,getCurrentItem:()=>document.activeElement};function j(e={}){const t={...S,...e},r=y(g([])),a=v(()=>{r.update(()=>[])});return{typed:r,resetTyped:a,handleTypeaheadSearch:(l,m)=>{if(C.has(l))return;const u=t.getCurrentItem(),s=w(r);if(!Array.isArray(s))return;s.push(l.toLowerCase()),r.set(s);const f=m.filter(n=>!(n.getAttribute("disabled")==="true"||n.getAttribute("aria-disabled")==="true"||n.hasAttribute("data-disabled"))),h=s.length>1&&s.every(n=>n===s[0])?s[0]:s.join(""),x=i(u)?f.indexOf(u):-1;let c=A(f,Math.max(x,0));h.length===1&&(c=c.filter(n=>n!==u));const d=c.find(n=>(n==null?void 0:n.innerText)&&n.innerText.toLowerCase().startsWith(h.toLowerCase()));i(d)&&d!==u&&t.onMatch(d),a()}}}export{O as a,_ as b,j as c,N as g,T as h,R as r};