import{ad as e,bE as t,o,aj as n,i as s,ac as a,a1 as u,Z as l,G as d,c7 as c,a2 as i,J as m,K as r,c8 as v,D as p,bc as f,U as y,W as b,x as h,f as M,c9 as x,a6 as E,z as g}from"./index.286e9b79.js";import{a as k}from"./scroll.a50153b5.js";const w=(s,a,u,l)=>{let d={offsetX:0,offsetY:0};const c=e=>{const t=e.clientX,o=e.clientY,{offsetX:a,offsetY:u}=d,c=s.value.getBoundingClientRect(),i=c.left,m=c.top,r=c.width,v=c.height,p=document.documentElement.clientWidth,f=document.documentElement.clientHeight,y=-i+a,b=-m+u,h=p-i-r+a,M=f-m-v+u,x=e=>{let c=a+e.clientX-t,i=u+e.clientY-o;(null==l?void 0:l.value)||(c=Math.min(Math.max(c,y),h),i=Math.min(Math.max(i,b),M)),d={offsetX:c,offsetY:i},s.value&&(s.value.style.transform=`translate(${n(c)}, ${n(i)})`)},E=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E)};document.addEventListener("mousemove",x),document.addEventListener("mouseup",E)},i=()=>{a.value&&s.value&&a.value.removeEventListener("mousedown",c)};e((()=>{t((()=>{u.value?a.value&&s.value&&a.value.addEventListener("mousedown",c):i()}))})),o((()=>{i()}))},C=(e,t={})=>{s(e)||a("[useLockscreen]","You need to pass a ref param to this function");const o=t.ns||u("popup"),n=l((()=>o.bm("parent","hidden")));if(!d||c(document.body,n.value))return;let f=0,y=!1,b="0";const h=()=>{setTimeout((()=>{p(null==document?void 0:document.body,n.value),y&&document&&(document.body.style.width=b)}),200)};i(e,(e=>{if(!e)return void h();y=!c(document.body,n.value),y&&(b=document.body.style.width),f=k(o.namespace.value);const t=document.documentElement.clientHeight<document.body.scrollHeight,s=m(document.body,"overflowY");f>0&&(t||"scroll"===s)&&y&&(document.body.style.width=`calc(100% - ${f}px)`),r(document.body,n.value)})),v((()=>h()))},L=e=>{if(!e)return{onClick:f,onMousedown:f,onMouseup:f};let t=!1,o=!1;return{onClick:n=>{t&&o&&e(n),t=o=!1},onMousedown:e=>{t=e.target===e.currentTarget},onMouseup:e=>{o=e.target===e.currentTarget}}},Y=y({mask:{type:Boolean,default:!0},customMaskEvent:{type:Boolean,default:!1},overlayClass:{type:b([String,Array,Object])},zIndex:{type:b([String,Number])}});const z=h({name:"ElOverlay",props:Y,emits:{click:e=>e instanceof MouseEvent},setup(e,{slots:t,emit:o}){const n=u("overlay"),{onClick:s,onMousedown:a,onMouseup:l}=L(e.customMaskEvent?void 0:e=>{o("click",e)});return()=>e.mask?M("div",{class:[n.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:s,onMousedown:a,onMouseup:l},[E(t,"default")],x.STYLE|x.CLASS|x.PROPS,["onClick","onMouseup","onMousedown"]):g("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[E(t,"default")])}});export{z as E,C as a,L as b,w as u};
