/*!
 * Custom elements for Nanopore-Digital Web applications
 */
function e(e,t){const o={pageX:0,pageY:0,offsetX:0,offsetY:0};function n(n){const p=e.getBoundingClientRect(),c=e.ownerDocument.defaultView,u=p.left+c.pageXOffset,i=p.top+c.pageYOffset;let a=0,f=0;t.relative?(a=n.pageX-o.pageX-(u-o.offsetX),f=n.pageY-o.pageY-(i-o.offsetY)):(a=n.pageX-u,f=n.pageY-i),t?.onMove&&t.onMove(a,f)}if(document.addEventListener("pointermove",n,{passive:!0}),document.addEventListener("pointerup",(function e(){document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",e),t?.onStop&&t.onStop()})),!t?.initialEvent)return;let p;p=t?.initialEvent.touches?{pageX:(t?.initialEvent).touches[0].pageX,pageY:(t?.initialEvent).touches[0].pageY}:{pageX:(t?.initialEvent).pageX,pageY:(t?.initialEvent).pageY};const c=e.ownerDocument.defaultView,u=e.getBoundingClientRect();o.pageX=p.pageX,o.pageY=p.pageY,o.offsetX=u.left+c.pageXOffset,o.offsetY=u.top+c.pageYOffset}export{e as d}