const h=(o,t=200)=>{let e=0;return(...n)=>new Promise(r=>{e&&(clearTimeout(e),r("cancel")),e=window.setTimeout(()=>{o.apply(void 0,n),e=0,r("done")},t)})},T=(o,t={_blank:!0,nofollow:!0})=>{const e=document.createElement("a");e.href=o,t._blank&&(e.target="_blank"),t.nofollow&&(e.rel="noopener noreferrer"),e.click()},b=()=>{let o=-1;return(t,e,n,r=100)=>{const s=()=>{n&&(typeof r=="number"?setTimeout(n,r):n())};o!==-1&&(cancelAnimationFrame(o),s());let l=t.scrollTop;const i=()=>{o=-1;const m=e-l;l=l+m/5,Math.abs(m)<1?(t.scrollTo(0,e),s()):(t.scrollTo(0,l),o=requestAnimationFrame(i))};o=requestAnimationFrame(i)}},g=(o,t=200)=>{let e=0,n=null;return(...r)=>{const s=l=>{e===0&&(e=l),l-e>=t?(o.apply(void 0,n),n=null,e=0):window.requestAnimationFrame(s)};n===null&&window.requestAnimationFrame(s),n=r}},A=o=>{const t=e=>{const{scrollHeight:n,scrollWidth:r,offsetHeight:s,offsetWidth:l,scrollLeft:i,scrollTop:m}=o,f=e.x,w=e.y,d=p=>{const c=m+w-p.y,u=i+f-p.x,E=n-s,L=r-l,a={};u>=0&&u<=L&&(a.left=u),c>=0&&c<=E&&(a.top=c),o.scroll(a)};document.addEventListener("mousemove",d);const v=()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",v)};document.addEventListener("mouseup",v)};return o.addEventListener("mousedown",t),()=>{o.removeEventListener("mousedown",t)}},y=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`;export{A as $,g as H,y as I,T as L,h as R,b as x};
