const t=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"])',"textarea:not([disabled])","button:not([disabled])",'[tabindex="0"]'].join(", "),a=a=>a&&a.matches&&a.matches(t),e=a=>Array.from(a.querySelectorAll(t)),n=(t,a)=>{const n=a.ownerDocument.activeElement,[d,o]=(t=>{const a=e(t);return[a[0],a[a.length-1]]})(a);t.shiftKey&&n===d?(t.preventDefault(),o.focus()):n===o&&(t.preventDefault(),d.focus())};export{n as c,e as g,a as i};