(function(){try{var g=typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};g["__faroBundleId_Speechify Chrome Extension"]="13.4.1"}catch(l){}})();
import{g as v,n as f}from"./chunk-CLPINNGF.js";f();v();var m=(t,n,i)=>{t.style.top=`${Math.min(Math.max(n.clientY-i,0),window.innerHeight-t.clientHeight/window.devicePixelRatio)}px`},M=(t,n,i)=>{t.style.bottom=`${Math.min(Math.max(window.innerHeight-t.offsetHeight-n.clientY+i,0),window.innerHeight-t.clientHeight/window.devicePixelRatio)}px`},g=(t,n,i)=>{t.style.right=`${Math.min(Math.max(window.innerWidth-t.offsetWidth-n.clientX+i,0),window.innerWidth-t.clientWidth/window.devicePixelRatio)}px`};function L(t,{onDrag:n}={}){let i=0,s=0,r,o=!1;function u(e){let l={x:e.clientX,y:e.clientY},E=Math.sqrt((r.x-l.x)**2+(r.y-l.y)**2);!o&&E<16||(e.preventDefault(),o=!0,t.style.top?m(t,e,s):t.style.bottom&&M(t,e,s),g(t,e,i),typeof n=="function"&&n(t.getBoundingClientRect()))}function c(e){o&&(o=!1,e.stopPropagation(),t.removeEventListener("click",c,!0))}function a(e){return e.preventDefault(),document.removeEventListener("mouseup",a),document.removeEventListener("mousemove",u),!1}function d(e){e.target.tagName==="INPUT"||e.which!==1||(e.preventDefault(),s=e.clientY-t.getBoundingClientRect().top,i=e.clientX-t.getBoundingClientRect().left,r={x:e.clientX,y:e.clientY},document.addEventListener("mousemove",u),document.addEventListener("mouseup",a),t.addEventListener("click",c,!0))}return t.addEventListener("mousedown",d),()=>{t.removeEventListener("mousedown",d)}}export{L as a};
//# sourceMappingURL=chunk-JT6T45NR.js.map
