/*!
 * Custom elements for Nanopore-Digital Web applications
 */
import{a as t}from"./dom-dlicJTEJ.js";const o=new Set;function n(t){if(o.add(t),document.documentElement.classList.contains("nano-scroll-lock"))return;const n=function(){const t=document.documentElement.clientWidth,o=Math.abs(window.innerWidth-t),{paddingRight:n,paddingInlineEnd:e}=getComputedStyle(document.body);let c=Number((e||n).replace(/px/,""));return(c||isNaN(c))&&(c=0),o+c}();let e=getComputedStyle(document.documentElement).scrollbarGutter;e&&"auto"!==e||(e="stable"),n<=0&&(e="revert"),document.documentElement.style.setProperty("--nano-scroll-lock-gutter",e),document.documentElement.classList.add("nano-scroll-lock"),document.documentElement.style.setProperty("--nano-scroll-lock-size",`${n}px`)}function e(t){o.delete(t),0===o.size&&(document.documentElement.classList.remove("nano-scroll-lock"),document.documentElement.style.removeProperty("--nano-scroll-lock-size"))}function c(t,o,n=!1){if(n)try{t.scrollTo({top:o,behavior:"smooth"})}catch(n){t.scrollTop=o}else try{t.scrollTo({left:o,behavior:"smooth"})}catch(n){t.scrollLeft=o}}function r(o,n,e="vertical",r="start"){if(!o)return;const l=t(o,n),u=l.top+n.scrollTop,a=l.left+n.scrollLeft,i=n.scrollLeft+n.offsetWidth,s=n.scrollTop,d=n.scrollTop+n.offsetHeight;"horizontal"!==e&&"both"!==e||("start"===r?a<n.scrollLeft?c(n,a):a+o.clientWidth>i&&c(n,a-n.offsetWidth+o.clientWidth):c(n,n.scrollLeft+l.left-(n.offsetWidth/2-o.offsetWidth/2))),"vertical"!==e&&"both"!==e||("start"===r?u<s?c(n,u,!0):u+o.clientHeight>d&&c(n,u-n.offsetHeight+o.clientHeight,!0):c(n,n.scrollTop+l.top-(n.offsetHeight/2-o.offsetHeight/2),!0))}function l(t){let o=getComputedStyle(t);const n="absolute"===o.position,e=/(auto|scroll)/;if("fixed"===o.position)return document.documentElement;for(let c=t;c=c.parentElement;)if(o=getComputedStyle(c),(!n||"static"!==o.position)&&e.test(o.overflow+o.overflowY+o.overflowX))return c;return document.documentElement}function u(t,o=100,n="y"){const e=t.getBoundingClientRect(),c=window.innerHeight||document.documentElement.clientHeight,r=window.innerWidth||document.documentElement.clientWidth;if(!(e.bottom||e.top||e.left||e.right||e.height||e.width||e.x||e.y))return!1;let l=!0;return"y"!==n&&"both"!==n||(l=!(Math.floor(100-(e.top>=0?0:e.top)/+-e.height*100)<o||Math.floor(100-(e.bottom-c)/e.height*100)<o)),("x"===n||"both"===n&&l)&&(l=!(Math.floor(100-(e.left>=0?0:e.left)/+-e.width*100)<o||Math.floor(100-(e.right-r)/e.width*100)<o)),l}export{l as f,u as i,n as l,r as s,e as u}