Loading
function(l,t,d){d.d(t,{a:()=>n,i:()=>o,n:()=>b,o:()=>h,r:()=>m,s:()=>u,t:()=>e});var i=d(248702),c="IncodeModalScrollLock",e="data-incode-modal-initial-focus",a='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function s(l){return Array.from(l.querySelectorAll(a))}function Z(l){try{return l.matches(a)}catch{return!1}}function n(l,t){let[d,c]=(0,i.p)(null);return(0,i._)(()=>{if(!l)return void c(null);if(t)return c(t),()=>{c(null)};let d=document.createElement("div");return d.setAttribute("data-incode-modal-portal",""),(document.querySelector(".IncodeComponent")??document.body).appendChild(d),c(d),()=>{d.remove(),c(null)}},[l,t]),d}function b(l){(0,i._)(()=>{if(!l)return;let t=document.querySelector(".IncodeComponent");return(t??document.body).classList.add(c),()=>{(t??document.body).classList.remove(c)}},[l])}function m(l,t,d){(0,i._)(()=>{if(!l||!t)return;let i=l=>{"Escape"===l.key&&(l.preventDefault(),d())};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[l,t,d])}function o(l,t,d=!0,c){(0,i._)(()=>{if(!l)return;let i=document.activeElement,n=c?.current??null;if(d){let l=t.current;l&&(function(l){let t=l.querySelector("[autofocus]");if(t&&Z(t))return t;let d=l.querySelector(`[${e}]`);if(d){if(Z(d))return d;let l=d.querySelector(a);if(l)return l}return s(l)[0]??l})(l).focus()}return()=>{n&&"function"==typeof n.focus?n.focus():i&&"function"==typeof i.focus&&i.focus()}},[l,t,d,c])}function u(l,t){(0,i._)(()=>{if(!l||typeof window>"u")return;let d=window.visualViewport;if(!d)return;let i=()=>{let l=t.current;l&&(l.style.setProperty("--incode-visual-viewport-height",`${d.height}px`),l.style.setProperty("--incode-visual-viewport-offset-top",`${d.offsetTop}px`))};return i(),d.addEventListener("resize",i),d.addEventListener("scroll",i),()=>{d.removeEventListener("resize",i),d.removeEventListener("scroll",i)}},[l,t])}function h(l,t){(0,i._)(()=>{if(!l)return;let d=l=>{if("Tab"!==l.key)return;let d=t.current;if(!d)return;let i=s(d);if(0===i.length&&document.activeElement===d)return void l.preventDefault();if(0===i.length)return;let c=i[0],e=i[i.length-1];l.shiftKey?document.activeElement===c&&(l.preventDefault(),e.focus()):document.activeElement===e&&(l.preventDefault(),c.focus())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l,t])}}