function drag(e,n){function move(t){const o=e.getBoundingClientRect(),i=e.ownerDocument.defaultView,v=o.left+i.pageXOffset,p=o.top+i.pageYOffset,d=t.pageX-v,r=t.pageY-p;(null==n?void 0:n.onMove)&&n.onMove(d,r)}document.addEventListener("pointermove",move,{passive:!0}),document.addEventListener("pointerup",(function stop(){document.removeEventListener("pointermove",move),document.removeEventListener("pointerup",stop),(null==n?void 0:n.onStop)&&n.onStop()})),(null==n?void 0:n.initialEvent)instanceof PointerEvent&&move(n.initialEvent)}export{drag};