var v=["text","search","url","password","tel"],N=["checkbox","radio"],f=void 0,p="a[href], area[href], input, select, textarea, button, iframe, object, embed, [contenteditable], [tabindex], video[controls], audio[controls], summary";function l(){for(var e=document.activeElement;e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function x(e){return e.matches(p)&&!e.disabled&&!/^-/.test(e.getAttribute("tabindex")||"")&&!e.hasAttribute("inert")&&(e.offsetWidth>0||e.offsetHeight>0)}function g(e){if(f)for(var t=e.parentElement;t;){if(f(t))return t;t=t.parentElement}}function y(e,t){var o=e.tagName,a=o==="TEXTAREA",r=o==="INPUT"&&v.indexOf(e.getAttribute("type").toLowerCase())!==-1,n=e.hasAttribute("contenteditable");if(!a&&!r&&!n)return!1;var i,s,u;if(n){var c=getSelection();i=c.anchorOffset,s=c.focusOffset,u=e.textContent.length}else i=e.selectionStart,s=e.selectionEnd,u=e.value.length;return!t&&i===s&&i===0?!1:!(t&&i===s&&i===u)}function T(e,t,o,a){var r=Array.prototype.slice.call(e.querySelectorAll("*")),n=r.indexOf(t);o?r=r.slice(n+1):(n===-1&&(n=r.length),r=r.slice(0,n),r.reverse());for(var i=0;i<r.length;i++){var s=r[i];if(s instanceof HTMLElement&&a.acceptNode(s)===NodeFilter.FILTER_ACCEPT)return s}}function b(e,t,o,a){var r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,a);return t&&(r.currentNode=t),o?r.nextNode():t?r.previousNode():r.lastChild()}function w(){return typeof ShadowRoot<"u"&&("polyfill"in ShadowRoot||!ShadowRoot.toString().includes("[native code]"))}function d(e,t,o){var a={acceptNode:function(n){return n===t||n.shadowRoot||x(n)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}},r=w()&&e instanceof ShadowRoot?T(e,t,o,a):b(e,t,o,a);return r&&r.shadowRoot?d(r.shadowRoot,null,o):!r&&e.host?d(e.host.getRootNode(),e.host,o):r}function R(e,t){var o=l(),a=t==="ArrowRight";if(!y(o,a)){var r=g(o)||o.getRootNode(),n=d(r,o,a);n&&n!==o&&(n.focus(),e.preventDefault())}}function E(e){var t=l();t.tagName==="INPUT"&&N.indexOf(t.getAttribute("type").toLowerCase())!==-1&&(t.click(),e.preventDefault())}function h(e){if(!(e.altKey||e.metaKey||e.ctrlKey)){var t=e.key;switch(t){case"ArrowLeft":case"ArrowRight":{R(e,t);break}case"Enter":{E(e);break}}}}function A(){addEventListener("keydown",h)}function S(){removeEventListener("keydown",h)}function k(e){f=e}export{A as register,k as setFocusTrapTest,S as unregister};
//# sourceMappingURL=dist-web-index-CJC0I6Gz.js.map
