var BAL_FOCUSED="bal-focused";var BAL_FOCUSABLE="bal-focusable";var FOCUS_KEYS=["Tab","ArrowDown","Space","Escape"," ","Shift","Enter","ArrowLeft","ArrowRight","ArrowUp","Home","End"];var focusableQueryString='[tabindex]:not([tabindex^="-"]), input:not([type=hidden]):not([tabindex^="-"]), textarea:not([tabindex^="-"]), button:not([tabindex^="-"]), select:not([tabindex^="-"]), .bal-focusable:not([tabindex^="-"])';var startFocusVisible=function(t){var n=[];var o=true;var r=t?t.shadowRoot:document;var e=t?t:document.body;var a=function(t){n.forEach((function(t){return t.classList.remove(BAL_FOCUSED)}));t.forEach((function(t){return t.classList.add(BAL_FOCUSED)}));n=t};var u=function(){o=false;a([])};var i=function(t){o=FOCUS_KEYS.includes(t.key);if(!o){a([])}};var c=function(t){if(o&&t.composedPath!==undefined){var n=t.composedPath().filter((function(t){if(t.classList){return t.classList.contains(BAL_FOCUSABLE)}return false}));a(n)}};var f=function(){if(r.activeElement===e){a([])}};r.addEventListener("keydown",i);r.addEventListener("focusin",c);r.addEventListener("focusout",f);r.addEventListener("touchstart",u);r.addEventListener("mousedown",u);var s=function(){r.removeEventListener("keydown",i);r.removeEventListener("focusin",c);r.removeEventListener("focusout",f);r.removeEventListener("touchstart",u);r.removeEventListener("mousedown",u)};return{destroy:s,setFocus:a}};export{FOCUS_KEYS,focusableQueryString,startFocusVisible};