const t='button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])';class e{static setDocumentBodyOverflow(e){const t=document.body.style.overflow;return document.body.style.overflow=e,t}static hideDocumentBodyOverflow(){return e.setDocumentBodyOverflow("hidden")}static focusNextElement(e,o=t){const n=Array.from(e.querySelectorAll(o));if(n.length>0){const e=n.indexOf(document.activeElement),t=n[(e+1)%n.length];t&&t.focus()}}static focusPreviousElement(e,o=t){const n=Array.from(e.querySelectorAll(o));if(n.length>0){const e=n.indexOf(document.activeElement),t=n[(e-1+n.length)%n.length];t&&t.focus()}}static preventLeavingDialog(t,o){"Tab"===o.key&&(o.preventDefault(),o.shiftKey?e.focusPreviousElement(t):e.focusNextElement(t))}static focusElement(e){const t=document.querySelector(e);null==t||t.focus()}static scrollElementIntoView(e,t={block:"nearest"}){const o=document.querySelector(e);o&&o.scrollIntoView(t)}static waitForElement(e){return new Promise((t,o)=>{const n=new MutationObserver(()=>{try{const o=document.querySelector(e);o&&(n.disconnect(),t(o))}catch(e){n.disconnect(),o(e)}});n.observe(document.body,{subtree:!0,childList:!0,attributes:!0})})}}export{e as H};